From 6fb225708a6a32e1cd1ca9303074cabb08401ee8 Mon Sep 17 00:00:00 2001 From: richarddancin Date: Tue, 28 Jul 2026 17:16:38 +0800 Subject: [PATCH 1/5] fix(studio): tolerate skillspace skill metadata --- tests/cli/test_frontend_skill_spaces.py | 49 ++++++++ ...enerated_agent_backend_codegen_extended.py | 40 ++++++ veadk/cli/cli_frontend.py | 114 ++++++++++++++++-- veadk/cli/generated_agent_skills.py | 56 +++++++-- 4 files changed, 235 insertions(+), 24 deletions(-) diff --git a/tests/cli/test_frontend_skill_spaces.py b/tests/cli/test_frontend_skill_spaces.py index 13b91c33..e287c2cc 100644 --- a/tests/cli/test_frontend_skill_spaces.py +++ b/tests/cli/test_frontend_skill_spaces.py @@ -16,6 +16,7 @@ import asyncio import json +import zipfile from pathlib import Path from types import SimpleNamespace @@ -448,6 +449,54 @@ def get_skill_version(self, request: Any) -> SimpleNamespace: assert request.skill_version == "1.2.0" +def test_get_skill_detail_falls_back_to_skillspace_package( + monkeypatch: pytest.MonkeyPatch, tmp_path: Path +) -> None: + app = _create_frontend_app(monkeypatch, tmp_path) + + class _FakeSkillsClient: + def __init__(self, **kwargs: Any) -> None: + del kwargs + + def get_skill_version(self, request: Any) -> SimpleNamespace: + del request + return SimpleNamespace( + name="ticket-classifier", + description="识别工单类型", + version="1.2.0", + skill_md="", + bucket_name="skills-bucket", + tos_path="skills/ticket-classifier.zip", + ) + + def _download_skill(skill: Any, zip_path: Path) -> bool: + assert skill.bucket_name == "skills-bucket" + assert skill.path == "skills/ticket-classifier.zip" + with zipfile.ZipFile(zip_path, "w") as archive: + archive.writestr( + "ticket-classifier/SKILL.md", + "---\nname: ticket-classifier\ndescription: Tickets.\n---\nBody.\n", + ) + return True + + monkeypatch.setattr( + "agentkit.sdk.skills.client.AgentkitSkillsClient", _FakeSkillsClient + ) + monkeypatch.setattr( + "veadk.skills.materializer._download_legacy_skill_space_skill", + _download_skill, + ) + + with TestClient(app) as client: + response = client.get( + "/web/skill-spaces/space-1/skills/skill-1", + params={"region": "cn-shanghai", "version": "1.2.0"}, + ) + + assert response.status_code == 200 + assert response.json()["skillMd"].endswith("Body.\n") + + def test_skill_space_routes_keep_missing_credentials_status( monkeypatch: pytest.MonkeyPatch, tmp_path: Path ) -> None: diff --git a/tests/cli/test_generated_agent_backend_codegen_extended.py b/tests/cli/test_generated_agent_backend_codegen_extended.py index 78e523b0..a3f03467 100644 --- a/tests/cli/test_generated_agent_backend_codegen_extended.py +++ b/tests/cli/test_generated_agent_backend_codegen_extended.py @@ -24,6 +24,7 @@ from typing import Any, ClassVar, Literal import pytest +import yaml from fastapi.testclient import TestClient from pydantic import ValidationError @@ -410,6 +411,45 @@ async def resolve(space_id: str, skill_id: str, version: str | None) -> str: assert [file.path for file in project.files] == ["skills/shared-skill/SKILL.md"] +@pytest.mark.asyncio +async def test_skillspace_materialization_normalizes_legacy_frontmatter() -> None: + skill = SelectedSkill( + source="skillspace", + folder="gate-info-web3", + name="gate-info-web3", + skillSpaceId="space-1", + skillId="skill-1", + version="v1", + ) + draft = AgentDraft(name="root", selectedSkills=[skill]) + project = GeneratedProject(name="root", files=[]) + + async def resolve(space_id: str, skill_id: str, version: str | None) -> str: + del space_id, skill_id, version + return ( + "---\n" + "name: gate-info-web3\n" + "description: Fetch market facts. Legacy alias: gate-info-defianalysis.\n" + "---\n" + "Use this skill for market analysis.\n" + ) + + await materialize_selected_skills( + draft, + project, + resolve_skillspace_detail=resolve, + ) + + assert [file.path for file in project.files] == [ + "skills/gate-info-web3/SKILL.md" + ] + frontmatter = project.files[0].content.split("---", 2)[1] + parsed = yaml.safe_load(frontmatter) + assert parsed["description"] == ( + "Fetch market facts. Legacy alias: gate-info-defianalysis." + ) + + def _skill_zip(files: dict[str, str]) -> bytes: output = io.BytesIO() with zipfile.ZipFile(output, "w") as archive: diff --git a/veadk/cli/cli_frontend.py b/veadk/cli/cli_frontend.py index a908ac46..c919d8b6 100644 --- a/veadk/cli/cli_frontend.py +++ b/veadk/cli/cli_frontend.py @@ -28,6 +28,8 @@ import os import re import sys +import tempfile +import zipfile from collections.abc import Iterable from concurrent.futures import ThreadPoolExecutor @@ -1596,6 +1598,90 @@ def _runner_response_error_detail( def _http_policy_error(exc: Exception) -> HTTPException: return HTTPException(status_code=400, detail=str(exc)) + def _skill_version_attr(resp: object, *names: str) -> str: + for name in names: + value = getattr(resp, name, None) + if value: + return str(value) + return "" + + def _read_skill_md_from_zip(zip_path: Path, skill_id: str) -> str: + try: + with zipfile.ZipFile(zip_path, "r") as archive: + candidates = [ + info + for info in archive.infolist() + if ( + not info.is_dir() + and info.filename.lower().endswith("skill.md") + and not info.filename.startswith(("/", "\\")) + and ".." not in Path(info.filename).parts + ) + ] + if not candidates: + raise HTTPException( + status_code=404, + detail="Skill version package has no SKILL.md content", + ) + chosen = sorted( + candidates, + key=lambda info: (len(Path(info.filename).parts), info.filename), + )[0] + raw = archive.read(chosen) + except HTTPException: + raise + except zipfile.BadZipFile as e: + raise HTTPException( + status_code=502, + detail=f"Skill version package for {skill_id} is not a valid zip", + ) from e + for encoding in ("utf-8-sig", "gb18030"): + try: + return raw.decode(encoding) + except UnicodeDecodeError: + pass + raise HTTPException( + status_code=502, + detail=f"Skill version package for {skill_id} has unsupported encoding", + ) + + def _skill_md_from_version_response( + *, + space_id: str, + skill_id: str, + version: str | None, + resp: object, + ) -> str: + skill_md = _skill_version_attr(resp, "skill_md", "skillMd") + if skill_md: + return skill_md + bucket_name = _skill_version_attr(resp, "bucket_name", "bucketName") + tos_path = _skill_version_attr(resp, "tos_path", "tosPath", "path") + if not bucket_name or not tos_path: + raise HTTPException( + status_code=404, detail="Skill version has no SKILL.md content" + ) + from veadk.skills.materializer import _download_legacy_skill_space_skill + from veadk.skills.skill import Skill as VeADKSkill + + remote_skill = VeADKSkill( + name=_skill_version_attr(resp, "name") or skill_id, + description=_skill_version_attr(resp, "description"), + path=tos_path, + skill_space_id=space_id, + bucket_name=bucket_name, + id=skill_id, + version_id=version or _skill_version_attr(resp, "version"), + ) + with tempfile.TemporaryDirectory(prefix="veadk_skillspace_") as temp_dir: + zip_path = Path(temp_dir) / "skill.zip" + if not _download_legacy_skill_space_skill(remote_skill, zip_path): + raise HTTPException( + status_code=502, + detail="Failed to download SkillSpace skill package", + ) + return _read_skill_md_from_zip(zip_path, skill_id) + async def _resolve_skillspace_skill_md( space_id: str, skill_id: str, @@ -1613,15 +1699,18 @@ async def _resolve_skillspace_skill_md( raise except Exception as e: logger.error( - f"GetSkillVersion({skill_id}@{version}) error for region {region or 'cn-beijing'}: {e}", + f"GetSkillVersion({skill_id}@{version}) error for region " + f"{region or 'cn-beijing'}: {e}", exc_info=True, ) raise HTTPException(status_code=502, detail=f"SkillSpaces API error: {e}") - if not resp.skill_md: - raise HTTPException( - status_code=404, detail="Skill version has no SKILL.md content" - ) - return str(resp.skill_md) + return await asyncio.to_thread( + _skill_md_from_version_response, + space_id=space_id, + skill_id=skill_id, + version=version, + resp=resp, + ) def _draft_for_debug_run(draft: AgentDraft) -> AgentDraft: """Return a debug-safe draft by omitting stdio MCP tools recursively.""" @@ -4001,10 +4090,13 @@ async def _web_get_skill_detail( detail="暂时无法加载该技能详情,请稍后重试。", ) - if not resp.skill_md: - raise HTTPException( - status_code=404, detail="Skill version has no SKILL.md content" - ) + skill_md = await asyncio.to_thread( + _skill_md_from_version_response, + space_id=space_id, + skill_id=skill_id, + version=version, + resp=resp, + ) return { "skillId": skill_id, @@ -4012,7 +4104,7 @@ async def _web_get_skill_detail( "name": resp.name or "", "description": resp.description or "", "version": resp.version or version or "", - "skillMd": resp.skill_md, + "skillMd": skill_md, "bucketName": resp.bucket_name or "", "tosPath": resp.tos_path or "", } diff --git a/veadk/cli/generated_agent_skills.py b/veadk/cli/generated_agent_skills.py index 5c352203..4b74285c 100644 --- a/veadk/cli/generated_agent_skills.py +++ b/veadk/cli/generated_agent_skills.py @@ -24,6 +24,7 @@ from urllib.parse import quote, urlencode import httpx +import yaml from veadk.cli.generated_agent_codegen import ( AgentDraft, @@ -133,6 +134,9 @@ async def _materialize_skillspace_skill( skill.version or None, ) _validate_skill_md(skill_md, f"SkillSpace skill {skill.skillId}") + skill_md = _normalize_skill_md_frontmatter( + skill_md, f"SkillSpace skill {skill.skillId}" + ) return [GeneratedFile(path=f"skills/{folder}/SKILL.md", content=skill_md)] @@ -256,6 +260,21 @@ def _normalize_relative_path(path: str) -> str: def _validate_skill_md(text: str, where: str) -> str: + meta, _ = _parse_skill_md(text, where) + name = str(meta.get("name") or "").strip() + description = str(meta.get("description") or "").strip() + if not name: + raise DebugPolicyError(f"{where} SKILL.md is missing name") + if len(name) > 64 or not re.fullmatch(r"[a-z0-9-]+", name): + raise DebugPolicyError(f"{where} SKILL.md name is invalid") + if not description: + raise DebugPolicyError(f"{where} SKILL.md is missing description") + if len(description) > 1024 or re.search(r"<[^>]+>", description): + raise DebugPolicyError(f"{where} SKILL.md description is invalid") + return name + + +def _parse_skill_md(text: str, where: str) -> tuple[dict[str, object], str]: lines = (text or "").replace("\r\n", "\n").replace("\r", "\n").split("\n") if not lines or lines[0].strip() != "---": raise DebugPolicyError(f"{where} SKILL.md must start with frontmatter") @@ -266,8 +285,23 @@ def _validate_skill_md(text: str, where: str) -> str: break if end_idx < 0: raise DebugPolicyError(f"{where} SKILL.md frontmatter is not closed") - meta: dict[str, str] = {} - for line in lines[1:end_idx]: + try: + parsed = yaml.safe_load("\n".join(lines[1:end_idx])) or {} + except yaml.YAMLError as e: + parsed = _parse_legacy_frontmatter_lines(lines[1:end_idx]) + if not parsed: + raise DebugPolicyError( + f"{where} SKILL.md frontmatter is invalid YAML: {e}" + ) from e + if not isinstance(parsed, dict): + raise DebugPolicyError(f"{where} SKILL.md frontmatter must be a mapping") + body = "\n".join(lines[end_idx + 1 :]) + return parsed, body + + +def _parse_legacy_frontmatter_lines(lines: list[str]) -> dict[str, object]: + meta: dict[str, object] = {} + for line in lines: stripped = line.strip() if not stripped or stripped.startswith("#") or ":" not in stripped: continue @@ -279,14 +313,10 @@ def _validate_skill_md(text: str, where: str) -> str: ): value = value[1:-1] meta[key.strip()] = value - name = (meta.get("name") or "").strip() - description = (meta.get("description") or "").strip() - if not name: - raise DebugPolicyError(f"{where} SKILL.md is missing name") - if len(name) > 64 or not re.fullmatch(r"[a-z0-9-]+", name): - raise DebugPolicyError(f"{where} SKILL.md name is invalid") - if not description: - raise DebugPolicyError(f"{where} SKILL.md is missing description") - if len(description) > 1024 or re.search(r"<[^>]+>", description): - raise DebugPolicyError(f"{where} SKILL.md description is invalid") - return name + return meta + + +def _normalize_skill_md_frontmatter(text: str, where: str) -> str: + meta, body = _parse_skill_md(text, where) + header = yaml.safe_dump(meta, allow_unicode=True, sort_keys=False).strip() + return f"---\n{header}\n---\n{body}" From c6636628e1aa0110edae5378754502cb292a4b03 Mon Sep 17 00:00:00 2001 From: richarddancin Date: Tue, 28 Jul 2026 17:39:51 +0800 Subject: [PATCH 2/5] fix(studio): relax local skill upload validation --- frontend/src/create/LocalPicker.tsx | 12 +- frontend/src/create/skills/local.ts | 95 ++--- frontend/tests/markdownPromptEditor.test.mjs | 8 + .../test_generated_agent_backend_codegen.py | 29 ++ ...enerated_agent_backend_codegen_extended.py | 4 +- veadk/cli/cli_frontend.py | 3 - veadk/cli/generated_agent_skills.py | 5 - ...tor-1j-FKm8y.js => CodeEditor-Cr6KNv6h.js} | 2 +- ...0I.js => MarkdownPromptEditor-DH4ASeh5.js} | 2 +- .../{index-D1GQjNfI.js => index-BKcJcY8v.js} | 382 +++++++++--------- veadk/webui/index.html | 2 +- 11 files changed, 267 insertions(+), 277 deletions(-) rename veadk/webui/assets/{CodeEditor-1j-FKm8y.js => CodeEditor-Cr6KNv6h.js} (99%) rename veadk/webui/assets/{MarkdownPromptEditor-rtM9dn0I.js => MarkdownPromptEditor-DH4ASeh5.js} (99%) rename veadk/webui/assets/{index-D1GQjNfI.js => index-BKcJcY8v.js} (59%) diff --git a/frontend/src/create/LocalPicker.tsx b/frontend/src/create/LocalPicker.tsx index bf448212..93b50777 100644 --- a/frontend/src/create/LocalPicker.tsx +++ b/frontend/src/create/LocalPicker.tsx @@ -1,6 +1,6 @@ // Local skill picker: user uploads a folder (via ) or a -// .zip file from their computer. Each skill directory must contain a SKILL.md -// with name/description frontmatter. Files are materialized client-side and +// .zip file from their computer. Each skill directory must contain a SKILL.md. +// Files are materialized client-side and // embedded directly in SelectedSkill.localFiles so they survive YAML // round-trip and project generation without any network round-trip. @@ -85,7 +85,7 @@ export function LocalPicker({ const [dragging, setDragging] = useState(false); const dragDepthRef = useRef(0); - // Match by folder name (frontmatter `name`), the de-dup key for local uploads. + // Match by generated folder name, the de-dup key for local uploads. const isSelectedByFolder = (folder: string) => selected.some((s) => s.source === "local" && s.folder === folder); @@ -125,8 +125,8 @@ export function LocalPicker({ const showResult = (res: LocalReadResult) => { // Merge new hits into the displayed list (append, don't replace) so - // repeated uploads accumulate. De-dupe by folder name (frontmatter - // `name`) across both the displayed list and already-selected skills. + // repeated uploads accumulate. De-dupe by generated folder name across + // both the displayed list and already-selected skills. const existing = new Set([ ...foundHitsRef.current.map((h) => h.folder || h.name), ...selectedRef.current @@ -244,7 +244,7 @@ export function LocalPicker({

- 每个技能需包含 SKILL.md(含 name / description frontmatter)。支持包含多个技能的目录。 + 每个技能需包含 SKILL.md。支持包含多个技能的目录。

{busy &&

正在读取文件…

} diff --git a/frontend/src/create/skills/local.ts b/frontend/src/create/skills/local.ts index a1bcaee4..282af106 100644 --- a/frontend/src/create/skills/local.ts +++ b/frontend/src/create/skills/local.ts @@ -1,13 +1,8 @@ // Local skill upload: read a browser folder (via ) or a // .zip file into SkillHit entries. Each skill directory must contain a -// SKILL.md (case-insensitive) with valid frontmatter. Validation mirrors what -// ADK's skill loader requires (so skills actually load at runtime): -// - SKILL.md starts with a closed `--- ... ---` frontmatter block -// - `name`: required, <=64 chars, matches [a-z0-9-]+ (kebab-case) -// - `description`: required, <=1024 chars, no XML tags -// - quoted name/description values are accepted (quotes stripped) — real YAML -// parsers handle them fine, and the platform's line-based parser only -// applies to pushed skills, not locally-uploaded ones. +// SKILL.md (case-insensitive). We keep local upload validation intentionally +// light: identify the skill folder, keep paths inside that folder, and let ADK +// report any deeper SKILL.md/frontmatter issues when the agent actually loads. // // Resulting ProjectFiles are rooted at `skills//...` so they // merge cleanly with the existing Skill Hub download layout. Zip-slip paths @@ -30,22 +25,12 @@ interface RawEntry { const SKILL_MD_RE = /(^|\/)skill\.md$/i; -/** Validation error: carries a human-readable message. */ -class SkillValidationError extends Error {} - -/** Parse a YAML "key: value" line the same way the agentkit validator does - * (simple line-based, no full YAML parser, rejects quoted name/description). - * Returns { name, description } on success, throws on any violation. */ -function parseAndValidateSkillMd(text: string, where: string): { +function readSkillMdMetadata(text: string): { name: string; description: string; } { const lines = (text ?? "").replace(/\r\n?/g, "\n").split("\n"); - if (!lines.length || lines[0].trim() !== "---") { - throw new SkillValidationError( - `${where} 的 SKILL.md 必须以 YAML frontmatter (--- ... ---) 开头`, - ); - } + if (!lines.length || lines[0].trim() !== "---") return { name: "", description: "" }; let endIdx = -1; for (let i = 1; i < lines.length; i++) { if (lines[i].trim() === "---") { @@ -53,11 +38,7 @@ function parseAndValidateSkillMd(text: string, where: string): { break; } } - if (endIdx < 0) { - throw new SkillValidationError( - `${where} 的 SKILL.md frontmatter 未闭合(缺少结束 ---)`, - ); - } + if (endIdx < 0) return { name: "", description: "" }; const meta: Record = {}; for (let i = 1; i < endIdx; i++) { const s = lines[i].trim(); @@ -72,43 +53,33 @@ function parseAndValidateSkillMd(text: string, where: string): { meta[key] = val; } - const name = (meta.name || "").trim(); - const description = (meta.description || "").trim(); - validateName(name, where); - validateDescription(description, where); - return { name, description }; + return { + name: (meta.name || "").trim(), + description: (meta.description || "").trim(), + }; } function isQuoted(v: string): boolean { return v.length >= 2 && ((v.startsWith('"') && v.endsWith('"')) || (v.startsWith("'") && v.endsWith("'"))); } -function validateName(name: string, where: string) { - if (!name) { - throw new SkillValidationError(`${where} 的 SKILL.md 缺少必填的 name frontmatter`); - } - if (name.length > 64) { - throw new SkillValidationError(`${where} 的 name 长度超过 64 个字符`); - } - if (!/^[a-z0-9-]+$/.test(name)) { - throw new SkillValidationError( - `${where} 的 name 必须匹配 [a-z0-9-]+(小写字母、数字、短横线)`, - ); - } +function safeSkillFolder(...candidates: string[]): string { + for (const candidate of candidates) { + const folder = candidate + .trim() + .replace(/\\/g, "/") + .split("/") + .filter(Boolean) + .pop() + ?.replace(/[^A-Za-z0-9_-]+/g, "-") + .replace(/^-+|-+$/g, ""); + if (folder) return folder.slice(0, 64); + } + return "local-skill"; } -function validateDescription(desc: string, where: string) { - if (!desc) { - throw new SkillValidationError( - `${where} 的 SKILL.md 缺少必填的 description frontmatter`, - ); - } - if (desc.length > 1024) { - throw new SkillValidationError(`${where} 的 description 长度超过 1024 个字符`); - } - if (/<[^>]+>/.test(desc)) { - throw new SkillValidationError(`${where} 的 description 不能包含 XML 标签`); - } +function displaySkillName(folder: string, frontmatterName: string): string { + return frontmatterName.trim() || folder; } /** Normalize path separators and strip a single common wrapper folder if the @@ -173,16 +144,8 @@ function materializeHit( if (!md) { return { hit: null, error: `${where} 缺少 SKILL.md` }; } - let fm: { name: string; description: string }; - try { - fm = parseAndValidateSkillMd(md.text, where); - } catch (e) { - return { - hit: null, - error: e instanceof Error ? e.message : String(e), - }; - } - const folder = fm.name; + const fm = readSkillMdMetadata(md.text); + const folder = safeSkillFolder(fm.name, folderKey, sourceLabel.replace(/\.[^.]+$/, "")); const projectFiles: ProjectFile[] = []; for (const e of files) { // Zip-slip guard: reject paths containing '..' or that would escape @@ -201,8 +164,8 @@ function materializeHit( hit: { source: "local", id: `local:${folder}:${files.length}`, - name: fm.name, - description: fm.description, + name: displaySkillName(folder, fm.name), + description: fm.description || "本地 Skill", folder, localFiles: projectFiles, }, diff --git a/frontend/tests/markdownPromptEditor.test.mjs b/frontend/tests/markdownPromptEditor.test.mjs index 026bf24e..c77a1f83 100644 --- a/frontend/tests/markdownPromptEditor.test.mjs +++ b/frontend/tests/markdownPromptEditor.test.mjs @@ -18,6 +18,10 @@ const localPickerSource = readFileSync( new URL("../src/create/LocalPicker.tsx", import.meta.url), "utf8", ); +const localSkillSource = readFileSync( + new URL("../src/create/skills/local.ts", import.meta.url), + "utf8", +); const configYamlSource = readFileSync( new URL("../src/create/configYaml.ts", import.meta.url), "utf8", @@ -465,6 +469,10 @@ test("local Skill folders and ZIP archives support drag and drop", () => { ); assert.match(localPickerSource, /readZipSkills\(dropped\[0\]\.file\)/); assert.match(localPickerSource, /readFolderSkills\(dropped\.map/); + assert.match(localSkillSource, /function readSkillMdMetadata/); + assert.match(localSkillSource, /function safeSkillFolder/); + assert.doesNotMatch(localSkillSource, /function validateName/); + assert.doesNotMatch(localSkillSource, /function validateDescription/); assert.match( createStyles, /\.cw-local-dropzone\.is-dragging\s*\{[\s\S]*?border-color:/, diff --git a/tests/cli/test_generated_agent_backend_codegen.py b/tests/cli/test_generated_agent_backend_codegen.py index 1f0a0739..6b85ea67 100644 --- a/tests/cli/test_generated_agent_backend_codegen.py +++ b/tests/cli/test_generated_agent_backend_codegen.py @@ -188,6 +188,35 @@ async def test_local_skill_materialization_accepts_safe_skill() -> None: ] +@pytest.mark.asyncio +async def test_local_skill_materialization_keeps_validation_minimal() -> None: + skill_md = "---\nname: Display Skill\n---\n\n# Local\n" + draft = AgentDraft( + name="demo", + instruction="You are helpful.", + selectedSkills=[ + SelectedSkill( + source="local", + folder="local-folder", + name="Display Skill", + localFiles=[ + GeneratedFile( + path="skills/local-folder/SKILL.md", + content=skill_md, + ) + ], + ) + ], + ) + project = GeneratedProject(name="demo", files=[]) + + await materialize_selected_skills(draft, project) + + assert project.files == [ + GeneratedFile(path="skills/local-folder/SKILL.md", content=skill_md) + ] + + @pytest.mark.asyncio async def test_local_skill_materialization_rejects_path_escape() -> None: skill_md = "---\nname: local-skill\ndescription: Local skill.\n---\n" diff --git a/tests/cli/test_generated_agent_backend_codegen_extended.py b/tests/cli/test_generated_agent_backend_codegen_extended.py index a3f03467..806a3bf4 100644 --- a/tests/cli/test_generated_agent_backend_codegen_extended.py +++ b/tests/cli/test_generated_agent_backend_codegen_extended.py @@ -440,9 +440,7 @@ async def resolve(space_id: str, skill_id: str, version: str | None) -> str: resolve_skillspace_detail=resolve, ) - assert [file.path for file in project.files] == [ - "skills/gate-info-web3/SKILL.md" - ] + assert [file.path for file in project.files] == ["skills/gate-info-web3/SKILL.md"] frontmatter = project.files[0].content.split("---", 2)[1] parsed = yaml.safe_load(frontmatter) assert parsed["description"] == ( diff --git a/veadk/cli/cli_frontend.py b/veadk/cli/cli_frontend.py index c919d8b6..a4ed3623 100644 --- a/veadk/cli/cli_frontend.py +++ b/veadk/cli/cli_frontend.py @@ -1360,7 +1360,6 @@ async def _agentkit_proxy(request: Request, path: str): import shutil import socket import subprocess - import tempfile import threading as _test_threading import time from dataclasses import dataclass @@ -4431,7 +4430,6 @@ def frontend_deploy( the public URL. Inside the function the frontend uses the bound IAM role's STS credentials to manage AgentKit runtimes. """ - import tempfile import shutil from veadk.config import veadk_environments @@ -4789,7 +4787,6 @@ def frontend_update( ) -> None: """Build local Studio sources and update an existing VeFaaS Application.""" import shutil - import tempfile from veadk.cli.studio_package import ( build_frontend_assets, diff --git a/veadk/cli/generated_agent_skills.py b/veadk/cli/generated_agent_skills.py index 4b74285c..a23b3f3b 100644 --- a/veadk/cli/generated_agent_skills.py +++ b/veadk/cli/generated_agent_skills.py @@ -160,11 +160,6 @@ def _materialize_local_skill(skill: SelectedSkill) -> list[GeneratedFile]: out.append(GeneratedFile(path=path, content=file.content)) if skill_md_content is None: raise DebugPolicyError(f"Local skill {folder} is missing SKILL.md") - declared_name = _validate_skill_md(skill_md_content, f"Local skill {folder}") - if declared_name != folder: - raise DebugPolicyError( - f"Local skill folder '{folder}' does not match SKILL.md name '{declared_name}'" - ) return out diff --git a/veadk/webui/assets/CodeEditor-1j-FKm8y.js b/veadk/webui/assets/CodeEditor-Cr6KNv6h.js similarity index 99% rename from veadk/webui/assets/CodeEditor-1j-FKm8y.js rename to veadk/webui/assets/CodeEditor-Cr6KNv6h.js index 9f0fb787..e0e1a94f 100644 --- a/veadk/webui/assets/CodeEditor-1j-FKm8y.js +++ b/veadk/webui/assets/CodeEditor-Cr6KNv6h.js @@ -1,4 +1,4 @@ -import{A as xe,t as sf}from"./index-D1GQjNfI.js";const of=1024;let Zm=0,Le=class{constructor(e,t){this.from=e,this.to=t}};class M{constructor(e={}){this.id=Zm++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Oe.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}}M.closedBy=new M({deserialize:i=>i.split(" ")});M.openedBy=new M({deserialize:i=>i.split(" ")});M.group=new M({deserialize:i=>i.split(" ")});M.isolate=new M({deserialize:i=>{if(i&&i!="rtl"&&i!="ltr"&&i!="auto")throw new RangeError("Invalid value for isolate: "+i);return i||"auto"}});M.contextHash=new M({perNode:!0});M.lookAhead=new M({perNode:!0});M.mounted=new M({perNode:!0});class Ri{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[M.mounted.id]}}const Am=Object.create(null);class Oe{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):Am,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new Oe(e.name||"",t,e.id,n);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(r)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(M.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(" "))t[r]=e[n];return n=>{for(let r=n.prop(M.group),s=-1;s<(r?r.length:0);s++){let o=t[s<0?n.name:r[s]];if(o)return o}}}}Oe.none=new Oe("",Object.create(null),0,8);class Kn{constructor(e){this.types=e;for(let t=0;t0;for(let a=this.cursor(o|I.IncludeAnonymous);;){let h=!1;if(a.from<=s&&a.to>=r&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&n&&(l||!a.type.isAnonymous)&&n(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:na(Oe.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,r)=>new U(this.type,t,n,r,this.propValues),e.makeTree||((t,n,r)=>new U(Oe.none,t,n,r)))}static build(e){return zm(e)}}U.empty=new U(Oe.none,[],[],0);class ta{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new ta(this.buffer,this.index)}}class It{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Oe.none}toString(){let e=[];for(let t=0;t0));a=o[a+3]);return l}slice(e,t,n){let r=this.buffer,s=new Uint16Array(t-e),o=0;for(let l=e,a=0;l=e&&te;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return!0}}function vn(i,e,t,n){for(var r;i.from==i.to||(t<1?i.from>=e:i.from>e)||(t>-1?i.to<=e:i.to0?l.length:-1;e!=h;e+=t){let c=l[e],O=a[e]+o.from,f;if(!(!(s&I.EnterBracketed&&c instanceof U&&(f=Ri.get(c))&&!f.overlay&&f.bracketed&&n>=O&&n<=O+c.length)&&!lf(r,n,O,O+c.length))){if(c instanceof It){if(s&I.ExcludeBuffers)continue;let u=c.findChild(0,c.buffer.length,t,n-O,r);if(u>-1)return new dt(new qm(o,c,e,O),null,u)}else if(s&I.IncludeAnonymous||!c.type.isAnonymous||ia(c)){let u;if(!(s&I.IgnoreMounts)&&(u=Ri.get(c))&&!u.overlay)return new Pe(u.tree,O,e,o);let d=new Pe(c,O,e,o);return s&I.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?c.children.length-1:0,t,n,r,s)}}}if(s&I.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,n=0){let r;if(!(n&I.IgnoreOverlays)&&(r=Ri.get(this._tree))&&r.overlay){let s=e-this.from,o=n&I.EnterBracketed&&r.bracketed;for(let{from:l,to:a}of r.overlay)if((t>0||o?l<=s:l=s:a>s))return new Pe(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function ch(i,e,t,n){let r=i.cursor(),s=[];if(!r.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=r.type.is(t),!r.nextSibling())return s}for(;;){if(n!=null&&r.type.is(n))return s;if(r.type.is(e)&&s.push(r.node),!r.nextSibling())return n==null?s:[]}}function Go(i,e,t=e.length-1){for(let n=i;t>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return!1;t--}}return!0}class qm{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}}class dt extends af{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,n);return s<0?null:new dt(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,n=0){if(n&I.ExcludeBuffers)return null;let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new dt(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new dt(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new dt(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,s=n.buffer[this.index+3];if(s>r){let o=n.buffer[this.index+1];e.push(n.slice(r,s,o)),t.push(0)}return new U(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function hf(i){if(!i.length)return null;let e=0,t=i[0];for(let s=1;st.from||o.to=e){let l=new Pe(o.tree,o.overlay[0].from+s.from,-1,s);(r||(r=[n])).push(vn(l,e,t,!1))}}return r?hf(r):n}class Ur{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~I.EnterBracketed,e instanceof Pe)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return e?e instanceof Pe?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&I.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&I.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&I.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let r=n<0?0:this.stack[n]+4;if(this.index!=r)return this.yieldBuf(t.findChild(r,this.index,-1,0,4))}else{let r=t.buffer[this.index+3];if(r<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(r)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index-1)for(let s=t+e,o=e<0?-1:n._tree.children.length;s!=o;s+=e){let l=n._tree.children[s];if(this.mode&I.IncludeAnonymous||l instanceof It||!l.type.isAnonymous||ia(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;t=o,n=s+1;break e}r=this.stack[--s]}for(let r=n;r=0;s--){if(s<0)return Go(this._tree,e,r);let o=n[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}}function ia(i){return i.children.some(e=>e instanceof It||!e.type.isAnonymous||ia(e))}function zm(i){var e;let{buffer:t,nodeSet:n,maxBufferLength:r=of,reused:s=[],minRepeatType:o=n.types.length}=i,l=Array.isArray(t)?new ta(t,t.length):t,a=n.types,h=0,c=0;function O(x,k,$,q,_,B){let{id:z,start:A,end:V,size:E}=l,G=c,oe=h;if(E<0)if(l.next(),E==-1){let me=s[z];$.push(me),q.push(A-x);return}else if(E==-3){h=z;return}else if(E==-4){c=z;return}else throw new RangeError(`Unrecognized record size: ${E}`);let fe=a[z],we,ie,pe=A-x;if(V-A<=r&&(ie=g(l.pos-k,_))){let me=new Uint16Array(ie.size-ie.skip),ve=l.pos-ie.size,Me=me.length;for(;l.pos>ve;)Me=Q(ie.start,me,Me);we=new It(me,V-ie.start,n),pe=ie.start-x}else{let me=l.pos-E;l.next();let ve=[],Me=[],H=z>=o?z:-1,Fe=0,ni=V;for(;l.pos>me;)H>=0&&l.id==H&&l.size>=0?(l.end<=ni-r&&(d(ve,Me,A,Fe,l.end,ni,H,G,oe),Fe=ve.length,ni=l.end),l.next()):B>2500?f(A,me,ve,Me):O(A,me,ve,Me,H,B+1);if(H>=0&&Fe>0&&Fe-1&&Fe>0){let ki=u(fe,oe);we=na(fe,ve,Me,0,ve.length,0,V-A,ki,ki)}else we=m(fe,ve,Me,V-A,G-V,oe)}$.push(we),q.push(pe)}function f(x,k,$,q){let _=[],B=0,z=-1;for(;l.pos>k;){let{id:A,start:V,end:E,size:G}=l;if(G>4)l.next();else{if(z>-1&&V=0;E-=3)A[G++]=_[E],A[G++]=_[E+1]-V,A[G++]=_[E+2]-V,A[G++]=G;$.push(new It(A,_[2]-V,n)),q.push(V-x)}}function u(x,k){return($,q,_)=>{let B=0,z=$.length-1,A,V;if(z>=0&&(A=$[z])instanceof U){if(!z&&A.type==x&&A.length==_)return A;(V=A.prop(M.lookAhead))&&(B=q[z]+A.length+V)}return m(x,$,q,_,B,k)}}function d(x,k,$,q,_,B,z,A,V){let E=[],G=[];for(;x.length>q;)E.push(x.pop()),G.push(k.pop()+$-_);x.push(m(n.types[z],E,G,B-_,A-B,V)),k.push(_-$)}function m(x,k,$,q,_,B,z){if(B){let A=[M.contextHash,B];z=z?[A].concat(z):[A]}if(_>25){let A=[M.lookAhead,_];z=z?[A].concat(z):[A]}return new U(x,k,$,q,z)}function g(x,k){let $=l.fork(),q=0,_=0,B=0,z=$.end-r,A={size:0,start:0,skip:0};e:for(let V=$.pos-x;$.pos>V;){let E=$.size;if($.id==k&&E>=0){A.size=q,A.start=_,A.skip=B,B+=4,q+=4,$.next();continue}let G=$.pos-E;if(E<0||G=o?4:0,fe=$.start;for($.next();$.pos>G;){if($.size<0)if($.size==-3||$.size==-4)oe+=4;else break e;else $.id>=o&&(oe+=4);$.next()}_=fe,q+=E,B+=oe}return(k<0||q==x)&&(A.size=q,A.start=_,A.skip=B),A.size>4?A:void 0}function Q(x,k,$){let{id:q,start:_,end:B,size:z}=l;if(l.next(),z>=0&&q4){let V=l.pos-(z-4);for(;l.pos>V;)$=Q(x,k,$)}k[--$]=A,k[--$]=B-x,k[--$]=_-x,k[--$]=q}else z==-3?h=q:z==-4&&(c=q);return $}let S=[],y=[];for(;l.pos>0;)O(i.start||0,i.bufferStart||0,S,y,-1,0);let w=(e=i.length)!==null&&e!==void 0?e:S.length?y[0]+S[0].length:0;return new U(a[i.topID],S.reverse(),y.reverse(),w)}const Oh=new WeakMap;function Wr(i,e){if(!i.isAnonymous||e instanceof It||e.type!=i)return 1;let t=Oh.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=i||!(n instanceof U)){t=1;break}t+=Wr(i,n)}Oh.set(e,t)}return t}function na(i,e,t,n,r,s,o,l,a){let h=0;for(let d=n;d=c)break;k+=$}if(y==w+1){if(k>c){let $=d[w];u($.children,$.positions,0,$.children.length,m[w]+S);continue}O.push(d[w])}else{let $=m[y-1]+d[y-1].length-x;O.push(na(i,d,m,w,y,x,$,null,a))}f.push(x+S-s)}}return u(e,t,n,r,0),(l||a)(O,f,o)}class ra{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let r=this.map.get(e);r||this.map.set(e,r=new Map),r.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof dt?this.setBuffer(e.context.buffer,e.index,t):e instanceof Pe&&this.map.set(e.tree,t)}get(e){return e instanceof dt?this.getBuffer(e.context.buffer,e.index):e instanceof Pe?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Xt{constructor(e,t,n,r,s=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],n=!1){let r=[new Xt(0,e.length,e,0,!1,n)];for(let s of t)s.to>e.length&&r.push(s);return r}static applyChanges(e,t,n=128){if(!t.length)return e;let r=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let c=l=n)for(;o&&o.from=f.from||O<=f.to||h){let u=Math.max(f.from,a)-h,d=Math.min(f.to,O)-h;f=u>=d?null:new Xt(u,d,f.tree,f.offset+h,l>0,!!c)}if(f&&r.push(f),o.to>O)break;o=snew Le(r.from,r.to)):[new Le(0,0)]:[new Le(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let s=r.advance();if(s)return s}}}class _m{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function cf(i){return(e,t,n,r)=>new jm(e,i,t,n,r)}class fh{constructor(e,t,n,r,s,o){this.parser=e,this.parse=t,this.overlay=n,this.bracketed=r,this.target=s,this.from=o}}function uh(i){if(!i.length||i.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(i))}class Em{constructor(e,t,n,r,s,o,l,a){this.parser=e,this.predicate=t,this.mounts=n,this.index=r,this.start=s,this.bracketed=o,this.target=l,this.prev=a,this.depth=0,this.ranges=[]}}const Io=new M({perNode:!0});class jm{constructor(e,t,n,r,s){this.nest=t,this.input=n,this.fragments=r,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let n=this.baseParse.advance();if(!n)return null;if(this.baseParse=null,this.baseTree=n,this.startInner(),this.stoppedAt!=null)for(let r of this.inner)r.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let n=this.baseTree;return this.stoppedAt!=null&&(n=new U(n.type,n.children,n.positions,n.length,n.propValues.concat([[Io,this.stoppedAt]]))),n}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[M.mounted.id]=new Ri(t,e.overlay,e.parser,e.bracketed),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t=this.stoppedAt)l=!1;else if(e.hasNode(r)){if(t){let h=t.mounts.find(c=>c.frag.from<=r.from&&c.frag.to>=r.to&&c.mount.overlay);if(h)for(let c of h.mount.overlay){let O=c.from+h.pos,f=c.to+h.pos;O>=r.from&&f<=r.to&&!t.ranges.some(u=>u.fromO)&&t.ranges.push({from:O,to:f})}}l=!1}else if(n&&(o=Vm(n.ranges,r.from,r.to)))l=o!=2;else if(!r.type.isAnonymous&&(s=this.nest(r,this.input))&&(r.fromnew Le(O.from-r.from,O.to-r.from)):null,!!s.bracketed,r.tree,c.length?c[0].from:r.from)),s.overlay?c.length&&(n={ranges:c,depth:0,prev:n}):l=!1}}else if(t&&(a=t.predicate(r))&&(a===!0&&(a=new Le(r.from,r.to)),a.from=0&&t.ranges[h].to==a.from?t.ranges[h]={from:t.ranges[h].from,to:a.to}:t.ranges.push(a)}if(l&&r.firstChild())t&&t.depth++,n&&n.depth++;else for(;!r.nextSibling();){if(!r.parent())break e;if(t&&!--t.depth){let h=mh(this.ranges,t.ranges);h.length&&(uh(h),this.inner.splice(t.index,0,new fh(t.parser,t.parser.startParse(this.input,gh(t.mounts,h),h),t.ranges.map(c=>new Le(c.from-t.start,c.to-t.start)),t.bracketed,t.target,h[0].from))),t=t.prev}n&&!--n.depth&&(n=n.prev)}}}}function Vm(i,e,t){for(let n of i){if(n.from>=t)break;if(n.to>e)return n.from<=e&&n.to>=t?2:1}return 0}function dh(i,e,t,n,r,s){if(e=e&&t.enter(n,1,I.IgnoreOverlays|I.ExcludeBuffers)))if(t.to<=e)t.next(!1)||(this.done=!0);else break}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof U)t=t.children[0];else break}return!1}}let Lm=class{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let n=this.curFrag=e[0];this.curTo=(t=n.tree.prop(Io))!==null&&t!==void 0?t:n.to,this.inner=new ph(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(Io))!==null&&e!==void 0?e:t.to,this.inner=new ph(t.tree,-t.offset)}}findMounts(e,t){var n;let r=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(n=s.tree)===null||n===void 0?void 0:n.prop(M.mounted);if(o&&o.parser==t)for(let l=this.fragI;l=s.to)break;a.tree==this.curFrag.tree&&r.push({frag:a,pos:s.from-a.offset,mount:o})}}}return r}};function mh(i,e){let t=null,n=e;for(let r=1,s=0;r=l)break;a.to<=o||(t||(n=t=e.slice()),a.froml&&t.splice(s+1,0,new Le(l,a.to))):a.to>l?t[s--]=new Le(l,a.to):t.splice(s--,1))}}return n}function Dm(i,e,t,n){let r=0,s=0,o=!1,l=!1,a=-1e9,h=[];for(;;){let c=r==i.length?1e9:o?i[r].to:i[r].from,O=s==e.length?1e9:l?e[s].to:e[s].from;if(o!=l){let f=Math.max(a,t),u=Math.min(c,O,n);fnew Le(f.from+n,f.to+n)),O=Dm(e,c,a,h);for(let f=0,u=a;;f++){let d=f==O.length,m=d?h:O[f].from;if(m>u&&t.push(new Xt(u,m,r.tree,-o,s.from>=u||s.openStart,s.to<=m||s.openEnd)),d)break;u=O[f].to}}else t.push(new Xt(a,h,r.tree,-o,s.from>=o||s.openStart,s.to<=l||s.openEnd))}return t}var Qh={};class Nr{constructor(e,t,n,r,s,o,l,a,h,c=0,O){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=h,this.lookAhead=c,this.parent=O}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let r=e.parser.context;return new Nr(e,[],t,n,n,0,[],0,r?new Sh(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,r=e&65535,{parser:s}=this.p,o=this.reducePos=2e3&&!(!((t=this.p.parser.nodeSet.types[r])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(r,h)}storeNode(e,t,n,r=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(t==n)return;if(this.buffer[o-2]>=t){this.buffer[o-2]=n;return}}}if(!s||this.pos==n)this.buffer.push(e,t,n,r);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let l=!1;for(let a=o;a>0&&this.buffer[a-2]>n;a-=4)if(this.buffer[a-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>n;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,r>4&&(r-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=n,this.buffer[o+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let s=e,{parser:o}=this.p;this.pos=r;let l=o.stateFlag(s,1);!l&&(r>n||t<=o.maxNode)&&(this.reducePos=r),this.pushState(s,l?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=o.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(t&&e.buffer[t-4]==0&&(t-=4);t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),r=e.bufferBase+t;for(;e&&r==e.bufferBase;)e=e.parent;return new Nr(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new Bm(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let r=[];for(let s=0,o;sa&1&&l==o)||r.push(t[s],o)}t=r}let n=[];for(let r=0;r>19,r=t&65535,s=this.stack.length-n*3;if(s<0||e.getGoto(this.stack[s],r,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,s)=>{if(!t.includes(r))return t.push(r),e.allActions(r,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let a=o&65535,h=this.stack.length-l*3;if(h>=0&&e.getGoto(this.stack[h],a,!1)>=0)return l<<19|65536|a}}else{let l=n(o,s+1);if(l!=null)return l}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t0&&this.emitLookAhead()}}class Sh{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class Bm{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}}class Fr{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Fr(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Fr(this.stack,this.pos,this.index)}}function un(i,e=Uint16Array){if(typeof i!="string")return i;let t=null;for(let n=0,r=0;n=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}t?t[r++]=s:t=new e(s)}return t}class Mr{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const bh=new Mr;class Gm{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=bh,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,s=this.pos+e;for(;sn.to:s>=n.to;){if(r==this.ranges.length-1)return null;let o=this.ranges[++r];s+=o.from-n.to,n=o}return s}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t=this.chunk2Pos&&nl.to&&(this.chunk2=this.chunk2.slice(0,l.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=bh,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}}class Zi{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;Of(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}Zi.prototype.contextual=Zi.prototype.fallback=Zi.prototype.extend=!1;class Hr{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e=="string"?un(e):e}token(e,t){let n=e.pos,r=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(Of(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||r++,o==null)break;e.reset(o,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}}Hr.prototype.contextual=Zi.prototype.fallback=Zi.prototype.extend=!1;class ae{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function Of(i,e,t,n,r,s){let o=0,l=1<0){let d=i[u];if(a.allows(d)&&(e.token.value==-1||e.token.value==d||Im(d,e.token.value,r,s))){e.acceptToken(d);break}}let c=e.next,O=0,f=i[o+2];if(e.next<0&&f>O&&i[h+f*3-3]==65535){o=i[h+f*3-1];continue e}for(;O>1,d=h+u+(u<<1),m=i[d],g=i[d+1]||65536;if(c=g)O=u+1;else{o=i[d+2],e.advance();continue e}}break}}function yh(i,e,t){for(let n=e,r;(r=i[n])!=65535;n++)if(r==t)return n-e;return-1}function Im(i,e,t,n){let r=yh(t,n,e);return r<0||yh(t,n,i)e)&&!n.type.isError)return t<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(i.length,Math.max(n.from+1,e+25));if(t<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return t<0?0:i.length}}let Um=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?xh(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?xh(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(s instanceof U){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}};class Nm{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new Mr)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:s}=r,o=r.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let h=0;hO.end+25&&(a=Math.max(O.lookAhead,a)),O.value!=0)){let f=t;if(O.extended>-1&&(t=this.addActions(e,O.extended,O.end,t)),t=this.addActions(e,O.value,O.end,t),!c.extend&&(n=O,t>f))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),!n&&e.pos==this.stream.end&&(n=new Mr,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Mr,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:s}=n.p;for(let o=0;o=0&&n.p.parser.dialect.allows(l>>1)){l&1?e.extended=l>>1:e.value=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let s=0;se.bufferLength*4?new Um(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;ot)n.push(l);else{if(this.advanceStack(l,n,e))continue;{r||(r=[],s=[]),r.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!n.length){let o=r&&Km(r);if(o)return ze&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw ze&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&r){let o=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,s,n);if(o)return ze&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(n.length>o)for(n.sort((l,a)=>a.score-l.score);n.length>o;)n.pop();n.some(l=>l.reducePos>t)&&this.recovering--}else if(n.length>1){e:for(let o=0;o500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)n.splice(a--,1);else{n.splice(o--,1);continue e}}}n.length>12&&(n.sort((o,l)=>l.score-o.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,c=h?e.curContext.hash:0;for(let O=this.fragments.nodeAt(r);O;){let f=this.parser.nodeSet.types[O.type.id]==O.type?s.getGoto(e.state,O.type.id):-1;if(f>-1&&O.length&&(!h||(O.prop(M.contextHash)||0)==c))return e.useNode(O,f),ze&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(O.type.id)})`),!0;if(!(O instanceof U)||O.children.length==0||O.positions[0]>0)break;let u=O.children[0];if(u instanceof U&&O.positions[0]==0)O=u;else break}}let l=s.stateSlot(e.state,4);if(l>0)return e.reduce(l),ze&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let h=0;hr?t.push(d):n.push(d)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return kh(e,t),!0}}runRecovery(e,t,n){let r=null,s=!1;for(let o=0;o ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),ze&&console.log(c+this.stackID(l)+" (restarted)"),this.advanceFully(l,n))))continue;let O=l.split(),f=c;for(let u=0;u<10&&O.forceReduce()&&(ze&&console.log(f+this.stackID(O)+" (via force-reduce)"),!this.advanceFully(O,n));u++)ze&&(f=this.stackID(O)+" -> ");for(let u of l.recoverByInsert(a))ze&&console.log(c+this.stackID(u)+" (via recover-insert)"),this.advanceFully(u,n);this.stream.end>l.pos?(h==l.pos&&(h++,a=0),l.recoverByDelete(a,h),ze&&console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),kh(l,n)):(!r||r.scorei;class Ts{constructor(e){this.start=e.start,this.shift=e.shift||Us,this.reduce=e.reduce||Us,this.reuse=e.reuse||Us,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Rt extends sa{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let l=0;le.topRules[l][1]),r=[];for(let l=0;l=0)s(c,a,l[h++]);else{let O=l[h+-c];for(let f=-c;f>0;f--)s(l[h++],a,O);h++}}}this.nodeSet=new Kn(t.map((l,a)=>Oe.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:r[a],top:n.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=of;let o=un(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new Zi(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new Fm(this,e,t,n);for(let s of this.wrappers)r=s(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let s=r[t+1];;){let o=r[s++],l=o&1,a=r[s++];if(l&&n)return a;for(let h=s+(o>>1);s0}validAction(e,t){return!!this.allActions(e,n=>n==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let s=this.stateSlot(e,1);r==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=vt(this.data,s+2);else break;r=t(vt(this.data,s+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=vt(this.data,n+2);else break;if(!(this.data[n+2]&1)){let r=this.data[n+1];t.some((s,o)=>o&1&&s==r)||t.push(this.data[n],r)}}return t}configure(e){let t=Object.assign(Object.create(Rt.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(n=>{let r=e.tokenizers.find(s=>s.from==n);return r?r.to:n})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,r)=>{let s=e.specializers.find(l=>l.from==n.external);if(!s)return n;let o=Object.assign(Object.assign({},n),{external:s.to});return t.specializers[r]=Ph(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(n[o]=!0)}let r=null;for(let s=0;sn)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.scorei.external(t,n)<<1|e}return i.get}let Jm=0,ct=class Uo{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=Jm++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n=typeof e=="string"?e:"?";if(e instanceof Uo&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let r=new Uo(n,[],null,[]);if(r.set.push(r),t)for(let s of t.set)r.set.push(s);return r}static defineModifier(e){let t=new Kr(e);return n=>n.modified.indexOf(t)>-1?n:Kr.get(n.base||n,n.modified.concat(t).sort((r,s)=>r.id-s.id))}},eg=0;class Kr{constructor(e){this.name=e,this.instances=[],this.id=eg++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(l=>l.base==e&&tg(t,l.modified));if(n)return n;let r=[],s=new ct(e.name,r,e,t);for(let l of t)l.instances.push(s);let o=ig(t);for(let l of e.set)if(!l.modified.length)for(let a of o)r.push(Kr.get(l,a));return s}}function tg(i,e){return i.length==e.length&&i.every((t,n)=>t==e[n])}function ig(i){let e=[[]];for(let t=0;tn.length-t.length)}function zt(i){let e=Object.create(null);for(let t in i){let n=i[t];Array.isArray(n)||(n=[n]);for(let r of t.split(" "))if(r){let s=[],o=2,l=r;for(let O=0;;){if(l=="..."&&O>0&&O+3==r.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!f)throw new RangeError("Invalid path: "+r);if(s.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),O+=f[0].length,O==r.length)break;let u=r[O++];if(O==r.length&&u=="!"){o=0;break}if(u!="/")throw new RangeError("Invalid path: "+r);l=r.slice(O)}let a=s.length-1,h=s[a];if(!h)throw new RangeError("Invalid path: "+r);let c=new Tn(n,o,a>0?s.slice(0,a):null);e[h]=c.sort(e[h])}}return ff.add(e)}const ff=new M({combine(i,e){let t,n,r;for(;i||e;){if(!i||e&&i.depth>=e.depth?(r=e,e=e.next):(r=i,i=i.next),t&&t.mode==r.mode&&!r.context&&!t.context)continue;let s=new Tn(r.tags,r.mode,r.context);t?t.next=s:n=s,t=s}return n}});class Tn{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=r;for(let l of s)for(let a of l.set){let h=t[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:n}}function ng(i,e){let t=null;for(let n of i){let r=n.style(e);r&&(t=t?t+" "+r:r)}return t}function rg(i,e,t,n=0,r=i.length){let s=new sg(n,Array.isArray(e)?e:[e],t);s.highlightRange(i.cursor(),n,r,"",s.highlighters),s.flush(r)}class sg{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,s){let{type:o,from:l,to:a}=e;if(l>=n||a<=t)return;o.isTop&&(s=this.highlighters.filter(u=>!u.scope||u.scope(o)));let h=r,c=og(e)||Tn.empty,O=ng(s,c.tags);if(O&&(h&&(h+=" "),h+=O,c.mode==1&&(r+=(r?" ":"")+O)),this.startSpan(Math.max(t,l),h),c.opaque)return;let f=e.tree&&e.tree.prop(M.mounted);if(f&&f.overlay){let u=e.node.enter(f.overlay[0].from+l,1),d=this.highlighters.filter(g=>!g.scope||g.scope(f.tree.type)),m=e.firstChild();for(let g=0,Q=l;;g++){let S=g=y||!e.nextSibling())););if(!S||y>n)break;Q=S.to+l,Q>t&&(this.highlightRange(u.cursor(),Math.max(t,S.from+l),Math.min(n,Q),"",d),this.startSpan(Math.min(n,Q),h))}m&&e.parent()}else if(e.firstChild()){f&&(r="");do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,s),this.startSpan(Math.min(n,e.to),h)}while(e.nextSibling());e.parent()}}}function og(i){let e=i.type.prop(ff);for(;e&&e.context&&!i.matchContext(e.context);)e=e.next;return e||null}const T=ct.define,cr=T(),Vt=T(),$h=T(Vt),wh=T(Vt),Yt=T(),Or=T(Yt),Ns=T(Yt),ht=T(),oi=T(ht),ot=T(),lt=T(),No=T(),sn=T(No),fr=T(),p={comment:cr,lineComment:T(cr),blockComment:T(cr),docComment:T(cr),name:Vt,variableName:T(Vt),typeName:$h,tagName:T($h),propertyName:wh,attributeName:T(wh),className:T(Vt),labelName:T(Vt),namespace:T(Vt),macroName:T(Vt),literal:Yt,string:Or,docString:T(Or),character:T(Or),attributeValue:T(Or),number:Ns,integer:T(Ns),float:T(Ns),bool:T(Yt),regexp:T(Yt),escape:T(Yt),color:T(Yt),url:T(Yt),keyword:ot,self:T(ot),null:T(ot),atom:T(ot),unit:T(ot),modifier:T(ot),operatorKeyword:T(ot),controlKeyword:T(ot),definitionKeyword:T(ot),moduleKeyword:T(ot),operator:lt,derefOperator:T(lt),arithmeticOperator:T(lt),logicOperator:T(lt),bitwiseOperator:T(lt),compareOperator:T(lt),updateOperator:T(lt),definitionOperator:T(lt),typeOperator:T(lt),controlOperator:T(lt),punctuation:No,separator:T(No),bracket:sn,angleBracket:T(sn),squareBracket:T(sn),paren:T(sn),brace:T(sn),content:ht,heading:oi,heading1:T(oi),heading2:T(oi),heading3:T(oi),heading4:T(oi),heading5:T(oi),heading6:T(oi),contentSeparator:T(ht),list:T(ht),quote:T(ht),emphasis:T(ht),strong:T(ht),link:T(ht),monospace:T(ht),strikethrough:T(ht),inserted:T(),deleted:T(),changed:T(),invalid:T(),meta:fr,documentMeta:T(fr),annotation:T(fr),processingInstruction:T(fr),definition:ct.defineModifier("definition"),constant:ct.defineModifier("constant"),function:ct.defineModifier("function"),standard:ct.defineModifier("standard"),local:ct.defineModifier("local"),special:ct.defineModifier("special")};for(let i in p){let e=p[i];e instanceof ct&&(e.name=i)}uf([{tag:p.link,class:"tok-link"},{tag:p.heading,class:"tok-heading"},{tag:p.emphasis,class:"tok-emphasis"},{tag:p.strong,class:"tok-strong"},{tag:p.keyword,class:"tok-keyword"},{tag:p.atom,class:"tok-atom"},{tag:p.bool,class:"tok-bool"},{tag:p.url,class:"tok-url"},{tag:p.labelName,class:"tok-labelName"},{tag:p.inserted,class:"tok-inserted"},{tag:p.deleted,class:"tok-deleted"},{tag:p.literal,class:"tok-literal"},{tag:p.string,class:"tok-string"},{tag:p.number,class:"tok-number"},{tag:[p.regexp,p.escape,p.special(p.string)],class:"tok-string2"},{tag:p.variableName,class:"tok-variableName"},{tag:p.local(p.variableName),class:"tok-variableName tok-local"},{tag:p.definition(p.variableName),class:"tok-variableName tok-definition"},{tag:p.special(p.variableName),class:"tok-variableName2"},{tag:p.definition(p.propertyName),class:"tok-propertyName tok-definition"},{tag:p.typeName,class:"tok-typeName"},{tag:p.namespace,class:"tok-namespace"},{tag:p.className,class:"tok-className"},{tag:p.macroName,class:"tok-macroName"},{tag:p.propertyName,class:"tok-propertyName"},{tag:p.operator,class:"tok-operator"},{tag:p.comment,class:"tok-comment"},{tag:p.meta,class:"tok-meta"},{tag:p.invalid,class:"tok-invalid"},{tag:p.punctuation,class:"tok-punctuation"}]);const lg=316,ag=317,vh=1,hg=2,cg=3,Og=4,fg=318,ug=320,dg=321,pg=5,mg=6,gg=0,Fo=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],df=125,Qg=59,Ho=47,Sg=42,bg=43,yg=45,xg=60,kg=44,Pg=63,$g=46,wg=91,vg=new Ts({start:!1,shift(i,e){return e==pg||e==mg||e==ug?i:e==dg},strict:!1}),Tg=new ae((i,e)=>{let{next:t}=i;(t==df||t==-1||e.context)&&i.acceptToken(fg)},{contextual:!0,fallback:!0}),Xg=new ae((i,e)=>{let{next:t}=i,n;Fo.indexOf(t)>-1||t==Ho&&((n=i.peek(1))==Ho||n==Sg)||t!=df&&t!=Qg&&t!=-1&&!e.context&&i.acceptToken(lg)},{contextual:!0}),Cg=new ae((i,e)=>{i.next==wg&&!e.context&&i.acceptToken(ag)},{contextual:!0}),Rg=new ae((i,e)=>{let{next:t}=i;if(t==bg||t==yg){if(i.advance(),t==i.next){i.advance();let n=!e.context&&e.canShift(vh);i.acceptToken(n?vh:hg)}}else t==Pg&&i.peek(1)==$g&&(i.advance(),i.advance(),(i.next<48||i.next>57)&&i.acceptToken(cg))},{contextual:!0});function Fs(i,e){return i>=65&&i<=90||i>=97&&i<=122||i==95||i>=192||!e&&i>=48&&i<=57}const Zg=new ae((i,e)=>{if(i.next!=xg||!e.dialectEnabled(gg)||(i.advance(),i.next==Ho))return;let t=0;for(;Fo.indexOf(i.next)>-1;)i.advance(),t++;if(Fs(i.next,!0)){for(i.advance(),t++;Fs(i.next,!1);)i.advance(),t++;for(;Fo.indexOf(i.next)>-1;)i.advance(),t++;if(i.next==kg)return;for(let n=0;;n++){if(n==7){if(!Fs(i.next,!0))return;break}if(i.next!="extends".charCodeAt(n))break;i.advance(),t++}}i.acceptToken(Og,-t)}),Ag=zt({"get set async static":p.modifier,"for while do if else switch try catch finally return throw break continue default case defer":p.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":p.operatorKeyword,"let var const using function class extends":p.definitionKeyword,"import export from":p.moduleKeyword,"with debugger new":p.keyword,TemplateString:p.special(p.string),super:p.atom,BooleanLiteral:p.bool,this:p.self,null:p.null,Star:p.modifier,VariableName:p.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":p.function(p.variableName),VariableDefinition:p.definition(p.variableName),Label:p.labelName,PropertyName:p.propertyName,PrivatePropertyName:p.special(p.propertyName),"CallExpression/MemberExpression/PropertyName":p.function(p.propertyName),"FunctionDeclaration/VariableDefinition":p.function(p.definition(p.variableName)),"ClassDeclaration/VariableDefinition":p.definition(p.className),"NewExpression/VariableName":p.className,PropertyDefinition:p.definition(p.propertyName),PrivatePropertyDefinition:p.definition(p.special(p.propertyName)),UpdateOp:p.updateOperator,"LineComment Hashbang":p.lineComment,BlockComment:p.blockComment,Number:p.number,String:p.string,Escape:p.escape,ArithOp:p.arithmeticOperator,LogicOp:p.logicOperator,BitOp:p.bitwiseOperator,CompareOp:p.compareOperator,RegExp:p.regexp,Equals:p.definitionOperator,Arrow:p.function(p.punctuation),": Spread":p.punctuation,"( )":p.paren,"[ ]":p.squareBracket,"{ }":p.brace,"InterpolationStart InterpolationEnd":p.special(p.brace),".":p.derefOperator,", ;":p.separator,"@":p.meta,TypeName:p.typeName,TypeDefinition:p.definition(p.typeName),"type enum interface implements namespace module declare":p.definitionKeyword,"abstract global Privacy readonly override":p.modifier,"is keyof unique infer asserts":p.operatorKeyword,JSXAttributeValue:p.attributeValue,JSXText:p.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":p.angleBracket,"JSXIdentifier JSXNameSpacedName":p.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":p.attributeName,"JSXBuiltin/JSXIdentifier":p.standard(p.tagName)}),qg={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:235,private:235,protected:235,readonly:237,instanceof:256,satisfies:259,import:292,keyof:349,unique:353,infer:359,asserts:395,is:397,abstract:417,implements:419,type:421,let:424,var:426,using:429,interface:435,enum:439,namespace:445,module:447,declare:451,global:455,defer:471,for:476,of:485,while:488,with:492,do:496,if:500,else:502,switch:506,case:512,try:518,catch:522,finally:526,return:530,throw:534,break:538,continue:542,debugger:546},Wg={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:401},Mg={__proto__:null,"<":193},zg=Rt.deserialize({version:14,states:"$F|Q%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&jO'#CjO+oO#@ItO'#DaO.QQlO'#DgO.bQlO'#DrO%[QlO'#DzO0fQlO'#ESOOQ!0Lf'#E['#E[O1PQ`O'#EXOOQO'#Ep'#EpOOQO'#Il'#IlO1XQ`O'#GsO1dQ`O'#EoO1iQ`O'#EoO3hQ!0MxO'#JrO6[Q!0MxO'#JsO6uQ`O'#F]O6zQ,UO'#FtOOQ!0Lf'#Ff'#FfO7VO7dO'#FfO9XQMhO'#F|O9`Q`O'#F{OOQ!0Lf'#Js'#JsOOQ!0Lb'#Jr'#JrO9eQ`O'#GwOOQ['#K_'#K_O9pQ`O'#IYO9uQ!0LrO'#IZOOQ['#J`'#J`OOQ['#I_'#I_Q`QlOOQ`QlOOO9}Q!L^O'#DvO:UQlO'#EOO:]QlO'#EQO9kQ`O'#GsO:dQMhO'#CoO:rQ`O'#EnO:}Q`O'#EyO;hQMhO'#FeO;xQ`O'#GsOOQO'#K`'#K`O;}Q`O'#K`O<]Q`O'#G{O<]Q`O'#G|O<]Q`O'#HOO9kQ`O'#HRO=SQ`O'#HUO>kQ`O'#CeO>{Q`O'#HcO?TQ`O'#HiO?TQ`O'#HkO`QlO'#HmO?TQ`O'#HoO?TQ`O'#HrO?YQ`O'#HxO?_Q!0LsO'#IOO%[QlO'#IQO?jQ!0LsO'#ISO?uQ!0LsO'#IUO9uQ!0LrO'#IWO@QQ!0MxO'#CiOASQpO'#DlQOQ`OOO%[QlO'#EQOAjQ`O'#ETO:dQMhO'#EnOAuQ`O'#EnOBQQ!bO'#FeOOQ['#Cg'#CgOOQ!0Lb'#Dq'#DqOOQ!0Lb'#Jv'#JvO%[QlO'#JvOOQO'#Jy'#JyOOQO'#Ih'#IhOCQQpO'#EgOOQ!0Lb'#Ef'#EfOOQ!0Lb'#J}'#J}OC|Q!0MSO'#EgODWQpO'#EWOOQO'#Jx'#JxODlQpO'#JyOEyQpO'#EWODWQpO'#EgPFWO&2DjO'#CbPOOO)CD})CD}OOOO'#I`'#I`OFcO#tO,59UOOQ!0Lh,59U,59UOOOO'#Ia'#IaOFqO&jO,59UOGPQ!L^O'#DcOOOO'#Ic'#IcOGWO#@ItO,59{OOQ!0Lf,59{,59{OGfQlO'#IdOGyQ`O'#JtOIxQ!fO'#JtO+}QlO'#JtOJPQ`O,5:ROJgQ`O'#EpOJtQ`O'#KTOKPQ`O'#KSOKPQ`O'#KSOKXQ`O,5;^OK^Q`O'#KROOQ!0Ln,5:^,5:^OKeQlO,5:^OMcQ!0MxO,5:fONSQ`O,5:nONmQ!0LrO'#KQONtQ`O'#KPO9eQ`O'#KPO! YQ`O'#KPO! bQ`O,5;]O! gQ`O'#KPO!#lQ!fO'#JsOOQ!0Lh'#Ci'#CiO%[QlO'#ESO!$[Q!fO,5:sOOQS'#Jz'#JzOOQO-EtOOQ['#Jh'#JhOOQ[,5>u,5>uOOQ[-E<]-E<]O!TO`QlO,5>VO!LOQ`O,5>XO`QlO,5>ZO!LTQ`O,5>^O!LYQlO,5>dOOQ[,5>j,5>jO%[QlO,5>jO9uQ!0LrO,5>lOOQ[,5>n,5>nO#!dQ`O,5>nOOQ[,5>p,5>pO#!dQ`O,5>pOOQ[,5>r,5>rO##QQpO'#D_O%[QlO'#JvO##sQpO'#JvO##}QpO'#DmO#$`QpO'#DmO#&qQlO'#DmO#&xQ`O'#JuO#'QQ`O,5:WO#'VQ`O'#EtO#'eQ`O'#KUO#'mQ`O,5;_O#'rQpO'#DmO#(PQpO'#EVOOQ!0Lf,5:o,5:oO%[QlO,5:oO#(WQ`O,5:oO?YQ`O,5;YO!CUQpO,5;YO!C^QMhO,5;YO:dQMhO,5;YO#(`Q`O,5@bO#(eQ07dO,5:sOOQO-EPO$6^Q`O,5>POOQ[1G3i1G3iO`QlO1G3iOOQ[1G3o1G3oOOQ[1G3q1G3qO?TQ`O1G3sO$6cQlO1G3uO$:gQlO'#HtOOQ[1G3x1G3xO$:tQ`O'#HzO?YQ`O'#H|OOQ[1G4O1G4OO$:|QlO1G4OO9uQ!0LrO1G4UOOQ[1G4W1G4WOOQ!0Lb'#G_'#G_O9uQ!0LrO1G4YO9uQ!0LrO1G4[O$?TQ`O,5@bO!)[QlO,5;`O9eQ`O,5;`O?YQ`O,5:XO!)[QlO,5:XO!CUQpO,5:XO$?YQ?MtO,5:XOOQO,5;`,5;`O$?dQpO'#IeO$?zQ`O,5@aOOQ!0Lf1G/r1G/rO$@SQpO'#IkO$@^Q`O,5@pOOQ!0Lb1G0y1G0yO#$`QpO,5:XOOQO'#Ig'#IgO$@fQpO,5:qOOQ!0Ln,5:q,5:qO#(ZQ`O1G0ZOOQ!0Lf1G0Z1G0ZO%[QlO1G0ZOOQ!0Lf1G0t1G0tO?YQ`O1G0tO!CUQpO1G0tO!C^QMhO1G0tOOQ!0Lb1G5|1G5|O!ByQ!0LrO1G0^OOQO1G0m1G0mO%[QlO1G0mO$@mQ!0LrO1G0mO$@xQ!0LrO1G0mO!CUQpO1G0^ODWQpO1G0^O$AWQ!0LrO1G0mOOQO1G0^1G0^O$AlQ!0MxO1G0mPOOO-E<[-E<[POOO1G.h1G.hOOOO1G/i1G/iO$AvQ!bO,5QQpO,5@}OOQ!0Lb1G3c1G3cOOQ[7+$V7+$VO@zQ`O7+$VO9uQ!0LrO7+$VO%>]Q`O7+$VO%[QlO1G6lO%[QlO1G6mO%>bQ!0LrO1G6lO%>lQlO1G3kO%>sQ`O1G3kO%>xQlO1G3kOOQ[7+)T7+)TO9uQ!0LrO7+)_O`QlO7+)aOOQ['#Kh'#KhOOQ['#JS'#JSO%?PQlO,5>`OOQ[,5>`,5>`O%[QlO'#HuO%?^Q`O'#HwOOQ[,5>f,5>fO9eQ`O,5>fOOQ[,5>h,5>hOOQ[7+)j7+)jOOQ[7+)p7+)pOOQ[7+)t7+)tOOQ[7+)v7+)vO%?cQpO1G5|O%?}Q?MtO1G0zO%@XQ`O1G0zOOQO1G/s1G/sO%@dQ?MtO1G/sO?YQ`O1G/sO!)[QlO'#DmOOQO,5?P,5?POOQO-ERQ`O7+,WO&>WQ`O7+,XO%[QlO7+,WO%[QlO7+,XOOQ[7+)V7+)VO&>]Q`O7+)VO&>bQlO7+)VO&>iQ`O7+)VOOQ[<nQ`O,5>aOOQ[,5>c,5>cO&>sQ`O1G4QO9eQ`O7+&fO!)[QlO7+&fOOQO7+%_7+%_O&>xQ?MtO1G6ZO?YQ`O7+%_OOQ!0Lf<yQ?MvO,5?aO'@|Q?MvO,5?cO'CPQ?MvO7+'|O'DuQMjOG27TOOQO<VO!l$xO#jROe!iOpkOrPO(T)]O(VTO(YUO(aVO(o[O~O!]$_Oa$qa'z$qa'w$qa!k$qa!Y$qa!_$qa%i$qa!g$qa~Ol)dO~P!&zOh%VOp%WOr%XOs$tOt$tOz%YO|%ZO!O%]O!S${O!_$|O!i%bO!l$xO#j%cO$W%`O$t%^O$v%_O$y%aO(T(vO(VTO(YUO(a$uO(y$}O(z%PO~Og(pP~P!,TO!Q)iO!g)hO!_$^X$Z$^X$]$^X$_$^X$f$^X~O!g)hO!_({X$Z({X$]({X$_({X$f({X~O!Q)iO~P!.^O!Q)iO!_({X$Z({X$]({X$_({X$f({X~O!_)kO$Z)oO$])jO$_)jO$f)pO~O![)sO~P!)[O$]$hO$_$gO$f)wO~On$zX!Q$zX#S$zX'y$zX(y$zX(z$zX~OgmXg$zXnmX!]mX#`mX~P!0SOx)yO(b)zO(c)|O~On*VO!Q*OO'y*PO(y$}O(z%PO~Og)}O~P!1WOg*WO~Oh%VOr%XOs$tOt$tOz%YO|%ZO!OVO!l$xO#jVO!l$xO#jROe!iOpkOrPO(VTO(YUO(aVO(o[O~O(T=QO~P#$qO!]-]O!^(iX~O!^-_O~O!g-VO#`-UO!]#hX!^#hX~O!]-`O!^(xX~O!^-bO~O!c-cO!d-cO(U!lO~P#$`O!^-fO~P'_On-iO!_'`O~O!Y-nO~Os!{a!b!{a!c!{a!d!{a#T!{a#U!{a#V!{a#W!{a#X!{a#[!{a#]!{a(U!{a(V!{a(Y!{a(e!{a(o!{a~P!#vO!p-sO#`-qO~PChO!c-uO!d-uO(U!lO~PDWOa%nO#`-qO'z%nO~Oa%nO!g#vO#`-qO'z%nO~Oa%nO!g#vO!p-sO#`-qO'z%nO(r'pO~O(P'xO(Q'xO(R-zO~Ov-{O~O!Y'Wa!]'Wa~P!:tO![.PO!Y'WX!]'WX~P%[O!](VO!Y(ha~O!Y(ha~PHRO!](^O!Y(va~O!S%hO![.TO!_%iO(T%gO!Y'^X!]'^X~O#`.VO!](ta!k(taa(ta'z(ta~O!g#vO~P#,wO!](jO!k(sa~O!S%hO!_%iO#j.ZO(T%gO~Op.`O!S%hO![.]O!_%iO!|]O#i._O#j.]O(T%gO!]'aX!k'aX~OR.dO!l#xO~Oh%VOn.gO!_'`O%i.fO~Oa#ci!]#ci'z#ci'w#ci!Y#ci!k#civ#ci!_#ci%i#ci!g#ci~P!:tOn>]O!Q*OO'y*PO(y$}O(z%PO~O#k#_aa#_a#`#_a'z#_a!]#_a!k#_a!_#_a!Y#_a~P#/sO#k(`XP(`XR(`X[(`Xa(`Xj(`Xr(`X!S(`X!l(`X!p(`X#R(`X#n(`X#o(`X#p(`X#q(`X#r(`X#s(`X#t(`X#u(`X#v(`X#x(`X#z(`X#{(`X'z(`X(a(`X(r(`X!k(`X!Y(`X'w(`Xv(`X!_(`X%i(`X!g(`X~P!6kO!].tO!k(kX~P!:tO!k.wO~O!Y.yO~OP$[OR#zO!Q#yO!S#{O!l#xO!p$[O(aVO[#mia#mij#mir#mi!]#mi#R#mi#o#mi#p#mi#q#mi#r#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#n#mi~P#3cO#n$OO~P#3cOP$[OR#zOr$aO!Q#yO!S#{O!l#xO!p$[O#n$OO#o$PO#p$PO#q$PO(aVO[#mia#mij#mi!]#mi#R#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#r#mi~P#6QO#r$QO~P#6QOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO(aVOa#mi!]#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#v#mi~P#8oOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO(aVO(z#}Oa#mi!]#mi#z#mi#{#mi'z#mi(r#mi(y#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#x$UO~P#;VO#x#mi~P#;VO#v$SO~P#8oOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO#x$UO(aVO(y#|O(z#}Oa#mi!]#mi#{#mi'z#mi(r#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#z#mi~P#={O#z$WO~P#={OP]XR]X[]Xj]Xr]X!Q]X!S]X!l]X!p]X#R]X#S]X#`]X#kfX#n]X#o]X#p]X#q]X#r]X#s]X#t]X#u]X#v]X#x]X#z]X#{]X$Q]X(a]X(r]X(y]X(z]X!]]X!^]X~O$O]X~P#@jOP$[OR#zO[]O!Q*OO'y*PO(y$}O(z%POP#miR#mi!S#mi!l#mi!p#mi#n#mi#o#mi#p#mi#q#mi(a#mi~P#EyO!]/POg(pX~P!1WOg/RO~Oa$Pi!]$Pi'z$Pi'w$Pi!Y$Pi!k$Piv$Pi!_$Pi%i$Pi!g$Pi~P!:tO$]/SO$_/SO~O$]/TO$_/TO~O!g)hO#`/UO!_$cX$Z$cX$]$cX$_$cX$f$cX~O![/VO~O!_)kO$Z/XO$])jO$_)jO$f/YO~O!]VO!l$xO#j^O!Q*OO'y*PO(y$}O(z%POP#miR#mi!S#mi!l#mi!p#mi#n#mi#o#mi#p#mi#q#mi(a#mi~P&,QO#S$dOP(`XR(`X[(`Xj(`Xn(`Xr(`X!Q(`X!S(`X!l(`X!p(`X#R(`X#n(`X#o(`X#p(`X#q(`X#r(`X#s(`X#t(`X#u(`X#v(`X#x(`X#z(`X#{(`X$O(`X'y(`X(a(`X(r(`X(y(`X(z(`X!](`X!^(`X~O$O$Pi!]$Pi!^$Pi~P#BwO$O!ri!^!ri~P$+oOg']a!]']a~P!1WO!^7nO~O!]'da!^'da~P#BwO!Y7oO~P#/sO!g#vO(r'pO!]'ea!k'ea~O!]/pO!k)Oi~O!]/pO!g#vO!k)Oi~Og$|q!]$|q#`$|q$O$|q~P!1WO!Y'ga!]'ga~P#/sO!g7vO~O!]/yO!Y)Pi~P#/sO!]/yO!Y)Pi~O!Y7yO~Oh%VOr8OO!l%eO(r'pO~Oj8QO!g#vO~Or8TO!g#vO(r'pO~O!Q*OO'y*PO(z%POn'ja(y'ja!]'ja#`'ja~Og'ja$O'ja~P&5RO!Q*OO'y*POn'la(y'la(z'la!]'la#`'la~Og'la$O'la~P&5tOg(_q!](_q~P!1WO#`8VOg(_q!](_q~P!1WO!Y8WO~Og%Oq!]%Oq#`%Oq$O%Oq~P!1WOa$oy!]$oy'z$oy'w$oy!Y$oy!k$oyv$oy!_$oy%i$oy!g$oy~P!:tO!g6rO~O!]5[O!_)Qa~O!_'`OP$TaR$Ta[$Taj$Tar$Ta!Q$Ta!S$Ta!]$Ta!l$Ta!p$Ta#R$Ta#n$Ta#o$Ta#p$Ta#q$Ta#r$Ta#s$Ta#t$Ta#u$Ta#v$Ta#x$Ta#z$Ta#{$Ta(a$Ta(r$Ta(y$Ta(z$Ta~O%i7WO~P&8fO%^8[Oa%[i!_%[i'z%[i!]%[i~Oa#cy!]#cy'z#cy'w#cy!Y#cy!k#cyv#cy!_#cy%i#cy!g#cy~P!:tO[8^O~Ob8`O(T+qO(VTO(YUO~O!]1TO!^)Xi~O`8dO~O(e(|O!]'pX!^'pX~O!]5uO!^)Ua~O!^8nO~P%;eO(o!sO~P$&YO#[8oO~O!_1oO~O!_1oO%i8qO~On8tO!_1oO%i8qO~O[8yO!]'sa!^'sa~O!]1zO!^)Vi~O!k8}O~O!k9OO~O!k9RO~O!k9RO~P%[Oa9TO~O!g9UO~O!k9VO~O!](wi!^(wi~P#BwOa%nO#`9_O'z%nO~O!](ty!k(tya(ty'z(ty~P!:tO!](jO!k(sy~O%i9bO~P&8fO!_'`O%i9bO~O#k$|qP$|qR$|q[$|qa$|qj$|qr$|q!S$|q!]$|q!l$|q!p$|q#R$|q#n$|q#o$|q#p$|q#q$|q#r$|q#s$|q#t$|q#u$|q#v$|q#x$|q#z$|q#{$|q'z$|q(a$|q(r$|q!k$|q!Y$|q'w$|q#`$|qv$|q!_$|q%i$|q!g$|q~P#/sO#k'jaP'jaR'ja['jaa'jaj'jar'ja!S'ja!l'ja!p'ja#R'ja#n'ja#o'ja#p'ja#q'ja#r'ja#s'ja#t'ja#u'ja#v'ja#x'ja#z'ja#{'ja'z'ja(a'ja(r'ja!k'ja!Y'ja'w'jav'ja!_'ja%i'ja!g'ja~P&5RO#k'laP'laR'la['laa'laj'lar'la!S'la!l'la!p'la#R'la#n'la#o'la#p'la#q'la#r'la#s'la#t'la#u'la#v'la#x'la#z'la#{'la'z'la(a'la(r'la!k'la!Y'la'w'lav'la!_'la%i'la!g'la~P&5tO#k%OqP%OqR%Oq[%Oqa%Oqj%Oqr%Oq!S%Oq!]%Oq!l%Oq!p%Oq#R%Oq#n%Oq#o%Oq#p%Oq#q%Oq#r%Oq#s%Oq#t%Oq#u%Oq#v%Oq#x%Oq#z%Oq#{%Oq'z%Oq(a%Oq(r%Oq!k%Oq!Y%Oq'w%Oq#`%Oqv%Oq!_%Oq%i%Oq!g%Oq~P#/sO!]'Yi!k'Yi~P!:tO$O#cq!]#cq!^#cq~P#BwO(y$}OP%aaR%aa[%aaj%aar%aa!S%aa!l%aa!p%aa#R%aa#n%aa#o%aa#p%aa#q%aa#r%aa#s%aa#t%aa#u%aa#v%aa#x%aa#z%aa#{%aa$O%aa(a%aa(r%aa!]%aa!^%aa~On%aa!Q%aa'y%aa(z%aa~P&IyO(z%POP%caR%ca[%caj%car%ca!S%ca!l%ca!p%ca#R%ca#n%ca#o%ca#p%ca#q%ca#r%ca#s%ca#t%ca#u%ca#v%ca#x%ca#z%ca#{%ca$O%ca(a%ca(r%ca!]%ca!^%ca~On%ca!Q%ca'y%ca(y%ca~P&LQOn>^O!Q*OO'y*PO(z%PO~P&IyOn>^O!Q*OO'y*PO(y$}O~P&LQOR0kO!Q0kO!S0lO#S$dOP}a[}aj}an}ar}a!l}a!p}a#R}a#n}a#o}a#p}a#q}a#r}a#s}a#t}a#u}a#v}a#x}a#z}a#{}a$O}a'y}a(a}a(r}a(y}a(z}a!]}a!^}a~O!Q*OO'y*POP$saR$sa[$saj$san$sar$sa!S$sa!l$sa!p$sa#R$sa#n$sa#o$sa#p$sa#q$sa#r$sa#s$sa#t$sa#u$sa#v$sa#x$sa#z$sa#{$sa$O$sa(a$sa(r$sa(y$sa(z$sa!]$sa!^$sa~O!Q*OO'y*POP$uaR$ua[$uaj$uan$uar$ua!S$ua!l$ua!p$ua#R$ua#n$ua#o$ua#p$ua#q$ua#r$ua#s$ua#t$ua#u$ua#v$ua#x$ua#z$ua#{$ua$O$ua(a$ua(r$ua(y$ua(z$ua!]$ua!^$ua~On>^O!Q*OO'y*PO(y$}O(z%PO~OP%TaR%Ta[%Taj%Tar%Ta!S%Ta!l%Ta!p%Ta#R%Ta#n%Ta#o%Ta#p%Ta#q%Ta#r%Ta#s%Ta#t%Ta#u%Ta#v%Ta#x%Ta#z%Ta#{%Ta$O%Ta(a%Ta(r%Ta!]%Ta!^%Ta~P''VO$O$mq!]$mq!^$mq~P#BwO$O$oq!]$oq!^$oq~P#BwO!^9oO~O$O9pO~P!1WO!g#vO!]'ei!k'ei~O!g#vO(r'pO!]'ei!k'ei~O!]/pO!k)Oq~O!Y'gi!]'gi~P#/sO!]/yO!Y)Pq~Or9wO!g#vO(r'pO~O[9yO!Y9xO~P#/sO!Y9xO~Oj:PO!g#vO~Og(_y!](_y~P!1WO!]'na!_'na~P#/sOa%[q!_%[q'z%[q!]%[q~P#/sO[:UO~O!]1TO!^)Xq~O`:YO~O#`:ZO!]'pa!^'pa~O!]5uO!^)Ui~P#BwO!S:]O~O!_1oO%i:`O~O(VTO(YUO(e:eO~O!]1zO!^)Vq~O!k:hO~O!k:iO~O!k:jO~O!k:jO~P%[O#`:mO!]#hy!^#hy~O!]#hy!^#hy~P#BwO%i:rO~P&8fO!_'`O%i:rO~O$O#|y!]#|y!^#|y~P#BwOP$|iR$|i[$|ij$|ir$|i!S$|i!l$|i!p$|i#R$|i#n$|i#o$|i#p$|i#q$|i#r$|i#s$|i#t$|i#u$|i#v$|i#x$|i#z$|i#{$|i$O$|i(a$|i(r$|i!]$|i!^$|i~P''VO!Q*OO'y*PO(z%POP'iaR'ia['iaj'ian'iar'ia!S'ia!l'ia!p'ia#R'ia#n'ia#o'ia#p'ia#q'ia#r'ia#s'ia#t'ia#u'ia#v'ia#x'ia#z'ia#{'ia$O'ia(a'ia(r'ia(y'ia!]'ia!^'ia~O!Q*OO'y*POP'kaR'ka['kaj'kan'kar'ka!S'ka!l'ka!p'ka#R'ka#n'ka#o'ka#p'ka#q'ka#r'ka#s'ka#t'ka#u'ka#v'ka#x'ka#z'ka#{'ka$O'ka(a'ka(r'ka(y'ka(z'ka!]'ka!^'ka~O(y$}OP%aiR%ai[%aij%ain%air%ai!Q%ai!S%ai!l%ai!p%ai#R%ai#n%ai#o%ai#p%ai#q%ai#r%ai#s%ai#t%ai#u%ai#v%ai#x%ai#z%ai#{%ai$O%ai'y%ai(a%ai(r%ai(z%ai!]%ai!^%ai~O(z%POP%ciR%ci[%cij%cin%cir%ci!Q%ci!S%ci!l%ci!p%ci#R%ci#n%ci#o%ci#p%ci#q%ci#r%ci#s%ci#t%ci#u%ci#v%ci#x%ci#z%ci#{%ci$O%ci'y%ci(a%ci(r%ci(y%ci!]%ci!^%ci~O$O$oy!]$oy!^$oy~P#BwO$O#cy!]#cy!^#cy~P#BwO!g#vO!]'eq!k'eq~O!]/pO!k)Oy~O!Y'gq!]'gq~P#/sOr:|O!g#vO(r'pO~O[;QO!Y;PO~P#/sO!Y;PO~Og(_!R!](_!R~P!1WOa%[y!_%[y'z%[y!]%[y~P#/sO!]1TO!^)Xy~O!]5uO!^)Uq~O(T;XO~O!_1oO%i;[O~O!k;_O~O%i;dO~P&8fOP$|qR$|q[$|qj$|qr$|q!S$|q!l$|q!p$|q#R$|q#n$|q#o$|q#p$|q#q$|q#r$|q#s$|q#t$|q#u$|q#v$|q#x$|q#z$|q#{$|q$O$|q(a$|q(r$|q!]$|q!^$|q~P''VO!Q*OO'y*PO(z%POP'jaR'ja['jaj'jan'jar'ja!S'ja!l'ja!p'ja#R'ja#n'ja#o'ja#p'ja#q'ja#r'ja#s'ja#t'ja#u'ja#v'ja#x'ja#z'ja#{'ja$O'ja(a'ja(r'ja(y'ja!]'ja!^'ja~O!Q*OO'y*POP'laR'la['laj'lan'lar'la!S'la!l'la!p'la#R'la#n'la#o'la#p'la#q'la#r'la#s'la#t'la#u'la#v'la#x'la#z'la#{'la$O'la(a'la(r'la(y'la(z'la!]'la!^'la~OP%OqR%Oq[%Oqj%Oqr%Oq!S%Oq!l%Oq!p%Oq#R%Oq#n%Oq#o%Oq#p%Oq#q%Oq#r%Oq#s%Oq#t%Oq#u%Oq#v%Oq#x%Oq#z%Oq#{%Oq$O%Oq(a%Oq(r%Oq!]%Oq!^%Oq~P''VOg%e!Z!]%e!Z#`%e!Z$O%e!Z~P!1WO!Y;hO~P#/sOr;iO!g#vO(r'pO~O[;kO!Y;hO~P#/sO!]'pq!^'pq~P#BwO!]#h!Z!^#h!Z~P#BwO#k%e!ZP%e!ZR%e!Z[%e!Za%e!Zj%e!Zr%e!Z!S%e!Z!]%e!Z!l%e!Z!p%e!Z#R%e!Z#n%e!Z#o%e!Z#p%e!Z#q%e!Z#r%e!Z#s%e!Z#t%e!Z#u%e!Z#v%e!Z#x%e!Z#z%e!Z#{%e!Z'z%e!Z(a%e!Z(r%e!Z!k%e!Z!Y%e!Z'w%e!Z#`%e!Zv%e!Z!_%e!Z%i%e!Z!g%e!Z~P#/sOr;tO!g#vO(r'pO~O!Y;uO~P#/sOr;|O!g#vO(r'pO~O!Y;}O~P#/sOP%e!ZR%e!Z[%e!Zj%e!Zr%e!Z!S%e!Z!l%e!Z!p%e!Z#R%e!Z#n%e!Z#o%e!Z#p%e!Z#q%e!Z#r%e!Z#s%e!Z#t%e!Z#u%e!Z#v%e!Z#x%e!Z#z%e!Z#{%e!Z$O%e!Z(a%e!Z(r%e!Z!]%e!Z!^%e!Z~P''VOrROe!iOpkOrPO(T)]O(VTO(YUO(aVO(o[O~O!]WO!l$xO#jgPPP!>oI[PPPPPPPPP!BOP!C]PPI[!DnPI[PI[I[I[I[I[PI[!FQP!I[P!LbP!Lf!Lp!Lt!LtP!IXP!Lx!LxP#!OP#!SI[PI[#!Y#%_CjA^PA^PA^A^P#&lA^A^#)OA^#+vA^#.SA^A^#.r#1W#1W#1]#1f#1W#1qPP#1WPA^#2ZA^#6YA^A^6mPPP#:_PPP#:x#:xP#:xP#;`#:xPP#;fP#;]P#;]#;y#;]#P#>V#>]#>k#>q#>{#?R#?]#?c#?s#?y#@k#@}#AT#AZ#Ai#BO#Cs#DR#DY#Et#FS#Gt#HS#HY#H`#Hf#Hp#Hv#H|#IW#Ij#IpPPPPPPPPPPP#IvPPPPPPP#Jk#Mx$ b$ i$ qPPP$']P$'f$*_$0x$0{$1O$1}$2Q$2X$2aP$2g$2jP$3W$3[$4S$5b$5g$5}PP$6S$6Y$6^$6a$6e$6i$7e$7|$8e$8i$8l$8o$8y$8|$9Q$9UR!|RoqOXst!Z#d%m&r&t&u&w,s,x2[2_Y!vQ'`-e1o5{Q%tvQ%|yQ&T|Q&j!VS'W!e-]Q'f!iS'l!r!yU*k$|*Z*oQ+o%}S+|&V&WQ,d&dQ-c'_Q-m'gQ-u'mQ0[*qQ1b,OQ1y,eR<{SU+P%]S!S!nQ!r!v!y!z$|'W'_'`'l'm'n*k*o*q*r-]-c-e-u0[0_1o5{5}%[$ti#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;kP>X>Y>]>^Q&X|Q'U!eS'[%i-`Q+t&PQ,P&WQ,f&gQ0n+SQ1Y+uQ1_+{Q2Q,jQ2R,kQ5f1TQ5o1aQ6[1zQ6_1|Q6`2PQ8`5gQ8c5lQ8|6bQ:X8dQ:f8yQ;V:YR<}*ZrnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_R,h&k&z^OPXYstuvwz!Z!`!g!j!o#S#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'b'r(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mR>S[#]WZ#W#Z'X(T!b%jm#h#i#l$x%e%h(^(h(i(j*Y*^*b+Z+[+^,o-V.T.Z.[.]._/m/p2d3[3]4a6r7TQ%wxQ%{yW&Q|&V&W,OQ&_!TQ'c!hQ'e!iQ(q#sS+n%|%}Q+r&PQ,_&bQ,c&dS-l'f'gQ.i(rQ1R+oQ1X+uQ1Z+vQ1^+zQ1t,`S1x,d,eQ2|-mQ5e1TQ5i1WQ5n1`Q6Z1yQ8_5gQ8b5kQ8f5pQ:T8^R;T:U!U$zi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y!^%yy!i!u%{%|%}'V'e'f'g'k'u*j+n+o-Y-l-m-t0R0U1R2u2|3T4r4s4v7}9{Q+h%wQ,T&[Q,W&]Q,b&dQ.h(qQ1s,_U1w,c,d,eQ3e.iQ6U1tS6Y1x1yQ8x6Z#f>T#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^o>UPS&[!Q&iQ&]!RQ&^!SU*}%[%d=sR,R&Y%]%Si#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;kP>X>Y>]>^T)z$u){V+P%]S$i$^c#Y#e%q%s%u(S(Y(t(y)R)S)T)U)V)W)X)Y)Z)[)^)`)b)g)q+d+x-Z-x-}.S.U.s.v.z.|.}/O/b0p2k2n3O3V3k3p3q3r3s3t3u3v3w3x3y3z3{3|4P4Q4X5X5c6u6{7Q7a7b7k7l8k9X9]9g9m9n:o;W;`SQ'Y!eR2q-]!W!nQ!e!r!v!y!z$|'W'_'`'l'm'n*Z*k*o*q*r-]-c-e-u0[0_1o5{5}R1l,ZnqOXst!Z#d%m&r&t&u&w,s,x2[2_Q&y!^Q'v!xS(s#u<^Q+l%zQ,]&_Q,^&aQ-j'dQ-w'oS.r(x=PS0q+X=ZQ1P+mQ1n,[Q2c,zQ2e,{Q2m-WQ2z-kQ2}-oS5Y0r=eQ5a1QS5d1S=fQ6t2oQ6x2{Q6}3SQ8]5bQ9Y6vQ9Z6yQ9^7OR:l9V$d$]c#Y#e%s%u(S(Y(t(y)R)S)T)U)V)W)X)Y)Z)[)^)`)b)g)q+d+x-Z-x-}.S.U.s.v.z.}/O/b0p2k2n3O3V3k3p3q3r3s3t3u3v3w3x3y3z3{3|4P4Q4X5X5c6u6{7Q7a7b7k7l8k9X9]9g9m9n:o;W;`SS#q]SU$fd)_,mS(p#p'iU*v%R(w4OU0m+O.n7gQ5^0xQ7V3`Q9d7YR:s9em!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}Q't!uS(f#g2US-s'k'wQ/s*]Q0R*jQ3U-vQ4f/tQ4r0TQ4s0UQ4x0^Q7r4`S7}4t4vS8R4y4{Q9r7sQ9v7yQ9{8OQ:Q8TS:{9w9xS;g:|;PS;s;h;iS;{;t;uSSR=o>R%^bOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_Q%fj!^%xy!i!u%{%|%}'V'e'f'g'k'u*j+n+o-Y-l-m-t0R0U1R2u2|3T4r4s4v7}9{S&Oz!jQ+k%yQ,a&dW1v,b,c,d,eU6X1w1x1yS8w6Y6ZQ:d8x!r=j$Z$n'X)s-U-X/V2p4T5w6s:Z:mSQ=t>QR=u>R%QeOPXYstuvw!Z!`!g!o#S#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_Y#bWZ#W#Z(T!b%jm#h#i#l$x%e%h(^(h(i(j*Y*^*b+Z+[+^,o-V.T.Z.[.]._/m/p2d3[3]4a6r7TQ,n&o!p=k$Z$n)s-U-X/V2p4T5w6s:Z:mSR=n'XU']!e%i*ZR2s-`%SdOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+],p,s,x-i-q.P.V.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3l4z6T6e6f6i6|8t9T9_!r)_$Z$n'X)s-U-X/V2p4T5w6s:Z:mSQ,m&oQ0x+gQ3`.gQ7Y3dR9e7[!b$Tc#Y%q(S(Y(t(y)Z)[)`)g+x-x-}.S.U.s.v/b0p3O3V3k3{5X5c6{7Q7a9]:oS)^)q-Z.|2k2n3p4P4X6u7b7k7l8k9X9g9m9n;W;`=vQ>X>ZR>Y>['QkOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mSS$oh$pR4U/U'XgOPWXYZhstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n$p%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/U/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mST$kf$qQ$ifS)j$l)nR)v$qT$jf$qT)l$l)n'XhOPWXYZhstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n$p%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/U/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mST$oh$pQ$rhR)u$p%^jOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_!s>Q$Z$n'X)s-U-X/V2p4T5w6s:Z:mS#glOPXZst!Z!`!o#S#d#o#{$n%m&k&n&o&r&t&u&w&{'T'b)O)s*i+]+g,p,s,x-i.g/V/n0]0l1r2S2T2V2X2[2_2a3d4T4z6T6e6f6i7[8t9T!U%Ri$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y#f(w#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^Q+T%aQ/c*Oo4OP>X>YQ*c$zU*l$|*Z*oQ+U%bQ0W*m#f=q#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^n=rTQ=x>UQ=y>VR=z>W!U%Ri$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y#f(w#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^o4OP>X>Y>]>^Q,U&]Q1h,WQ5s1gR8h5tV*n$|*Z*oU*n$|*Z*oT5z1o5{S0P*i/nQ4w0]T8S4z:]Q+j%xQ0V*lQ1O+kQ1u,aQ6W1vQ8v6XQ:c8wR;^:d!U%Oi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Yx*R$v)e*S*u+V/v0d0e4R4g5R5S5W7p8U:R:x=p=}>OS0`*t0a#f]>^nZ>[`=T3}7c7f7j9h:t:w;yS=_.l3iT=`7e9k!U%Qi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y|*T$v)e*U*t+V/g/v0d0e4R4g4|5R5S5W7p8U:R:x=p=}>OS0b*u0c#f]>^nZ>[d=V3}7d7e7j9h9i:t:u:w;yS=a.m3jT=b7f9lrnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_Q&f!UR,p&ornOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_R&f!UQ,Y&^R1d,RsnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_Q1p,_S6R1s1tU8p6P6Q6US:_8r8sS;Y:^:aQ;m;ZR;w;nQ&m!VR,i&iR6_1|R:f8yW&Q|&V&W,OR1Z+vQ&r!WR,s&sR,y&xT2],x2_R,}&yQ,|&yR2f,}Q'y!{R-y'ySsOtQ#dXT%ps#dQ#OTR'{#OQ#RUR'}#RQ){$uR/`){Q#UVR(Q#UQ#XWU(W#X(X.QQ(X#YR.Q(YQ-^'YR2r-^Q.u(yS3m.u3nR3n.vQ-e'`R2v-eY!rQ'`-e1o5{R'j!rQ/Q)eR4S/QU#_W%h*YU(_#_(`.RQ(`#`R.R(ZQ-a']R2t-at`OXst!V!Z#d%m&i&k&r&t&u&w,s,x2[2_S#hZ%eU#r`#h.[R.[(jQ(k#jQ.X(gW.a(k.X3X7RQ3X.YR7R3YQ)n$lR/W)nQ$phR)t$pQ$`cU)a$`-|O>Z>[Q/z*eU4k/z4m7xQ4m/|R7x4lS*o$|*ZR0Y*ox*S$v)e*t*u+V/v0d0e4R4g5R5S5W7p8U:R:x=p=}>O!d.j(u)c*[*e.l.m.q/_/k/|0v1e3h4[4h4l5r7]7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[U/h*S.j7ca7c3}7e7f7j9h:t:w;yQ0a*tQ3i.lU4}0a3i9kR9k7e|*U$v)e*t*u+V/g/v0d0e4R4g4|5R5S5W7p8U:R:x=p=}>O!h.k(u)c*[*e.l.m.q/_/k/|0v1e3f3h4[4h4l5r7]7^7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[U/j*U.k7de7d3}7e7f7j9h9i:t:u:w;yQ0c*uQ3j.mU5P0c3j9lR9l7fQ*z%UR0g*zQ5]0vR8Y5]Q+_%kR0u+_Q5v1jS8j5v:[R:[8kQ,[&_R1m,[Q5{1oR8m5{Q1{,fS6]1{8zR8z6_Q1U+rW5h1U5j8a:VQ5j1XQ8a5iR:V8bQ+w&QR1[+wQ2_,xR6m2_YrOXst#dQ&v!ZQ+a%mQ,r&rQ,t&tQ,u&uQ,w&wQ2Y,sS2],x2_R6l2[Q%opQ&z!_Q&}!aQ'P!bQ'R!cQ'q!uQ+`%lQ+l%zQ,Q&XQ,h&mQ-P&|W-p'k's't'wQ-w'oQ0X*nQ1P+mQ1c,PS2O,i,lQ2g-OQ2h-RQ2i-SQ2}-oW3P-r-s-v-xQ5a1QQ5m1_Q5q1eQ6V1uQ6a2QQ6k2ZU6z3O3R3UQ6}3SQ8]5bQ8e5oQ8g5rQ8l5zQ8u6WQ8{6`S9[6{7PQ9^7OQ:W8cQ:b8vQ:g8|Q:n9]Q;U:XQ;]:cQ;a:oQ;l;VR;o;^Q%zyQ'd!iQ'o!uU+m%{%|%}Q-W'VU-k'e'f'gS-o'k'uQ0Q*jS1Q+n+oQ2o-YS2{-l-mQ3S-tS4p0R0UQ5b1RQ6v2uQ6y2|Q7O3TU7{4r4s4vQ9z7}R;O9{S$wi>PR*{%VU%Ui%V>PR0f*yQ$viS(u#v+iS)c$b$cQ)e$dQ*[$xS*e${*YQ*t%OQ*u%QQ+Q%^Q+R%_Q+V%cQ.lPQ=}>XQ>O>YQ>Z>]R>[>^Q+O%]Q.nSR#[WR'Z!el!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}S'V!e-]U*j$|*Z*oS-Y'W'_S0U*k*qQ0^*rQ2u-cQ4v0[R4{0_R({#xQ!fQT-d'`-e]!qQ!r'`-e1o5{Q#p]R'i < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:380,context:vg,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,207,211,215,216,218,221,224,234,237,243,245,247,249,252,258,264,266,268,270,272,274,275,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,120,121,136,139,141,142,143,144,145,147,148,167,169,171,"Expression",-23,31,33,37,41,43,45,173,175,177,178,180,181,182,184,185,186,188,189,190,201,203,205,206,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"<",38,"InterpolationStart",56,"[",60,"{",73,"(",160,"JSXStartCloseTag"],["closedBy",-2,24,168,">",40,"InterpolationEnd",50,"]",61,"}",74,")",165,"JSXEndTag"]],propSources:[Ag],skippedNodes:[0,5,6,278],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q$4o#Q#R$5y#R#SEr#S#T$7W#T#o$8b#o#p$x#r#s$@U#s$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$I|Er$I|$I}$Dk$I}$JO$Dk$JO$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr(n%d_$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU(Z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$i&j(WpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU(WpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX(Wp(Z!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z07[+rq$i&j(Wp(Z!b'|0/lOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z07[.ST(X#S$i&j'}0/lO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c07[.n_$i&j(Wp(Z!b'}0/lOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)3p/x`$i&j!p),Q(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW1V`#v(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW2d_#v(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'At3l_(V':f$i&j(Z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k(^4r_$i&j(Z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k&z5vX$i&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q&z6jT$d`$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c`6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y`7bO$d``7eP;=`<%l6y&z7kP;=`<%l5q(^7w]$d`$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!r8uZ(Z!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p!r9oU$d`(Z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!r:UP;=`<%l8p(^:[P;=`<%l4k%9[:hh$i&j(Wp(Z!bOY%ZYZ&cZq%Zqr`#P#o`x!^=^!^!_?q!_#O=^#O#P>`#P#o=^#o#p?q#p;'S=^;'S;=`@h<%lO=^&n>gXWS$i&jOY>`YZ&cZ!^>`!^!_?S!_#o>`#o#p?S#p;'S>`;'S;=`?k<%lO>`S?XSWSOY?SZ;'S?S;'S;=`?e<%lO?SS?hP;=`<%l?S&n?nP;=`<%l>`!f?xWWS(Z!bOY?qZw?qwx?Sx#O?q#O#P?S#P;'S?q;'S;=`@b<%lO?q!f@eP;=`<%l?q(Q@kP;=`<%l=^'`@w]WS$i&j(WpOY@nYZ&cZr@nrs>`s!^@n!^!_Ap!_#O@n#O#P>`#P#o@n#o#pAp#p;'S@n;'S;=`Bg<%lO@ntAwWWS(WpOYApZrAprs?Ss#OAp#O#P?S#P;'SAp;'S;=`Ba<%lOAptBdP;=`<%lAp'`BjP;=`<%l@n#WBvYWS(Wp(Z!bOYBmZrBmrs?qswBmwxApx#OBm#O#P?S#P;'SBm;'S;=`Cf<%lOBm#WCiP;=`<%lBm(rCoP;=`<%l^!Q^$i&j!X7`OY!=yYZ&cZ!P!=y!P!Q!>|!Q!^!=y!^!_!@c!_!}!=y!}#O!CW#O#P!Dy#P#o!=y#o#p!@c#p;'S!=y;'S;=`!Ek<%lO!=y|#X#Z&c#Z#[!>|#[#]&c#]#^!>|#^#a&c#a#b!>|#b#g&c#g#h!>|#h#i&c#i#j!>|#j#k!>|#k#m&c#m#n!>|#n#o&c#p;'S&c;'S;=`&w<%lO&c7`!@hX!X7`OY!@cZ!P!@c!P!Q!AT!Q!}!@c!}#O!Ar#O#P!Bq#P;'S!@c;'S;=`!CQ<%lO!@c7`!AYW!X7`#W#X!AT#Z#[!AT#]#^!AT#a#b!AT#g#h!AT#i#j!AT#j#k!AT#m#n!AT7`!AuVOY!ArZ#O!Ar#O#P!B[#P#Q!@c#Q;'S!Ar;'S;=`!Bk<%lO!Ar7`!B_SOY!ArZ;'S!Ar;'S;=`!Bk<%lO!Ar7`!BnP;=`<%l!Ar7`!BtSOY!@cZ;'S!@c;'S;=`!CQ<%lO!@c7`!CTP;=`<%l!@c^!Ezl$i&j(Z!b!X7`OY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#W&}#W#X!Eq#X#Z&}#Z#[!Eq#[#]&}#]#^!Eq#^#a&}#a#b!Eq#b#g&}#g#h!Eq#h#i&}#i#j!Eq#j#k!Eq#k#m&}#m#n!Eq#n#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}8r!GyZ(Z!b!X7`OY!GrZw!Grwx!@cx!P!Gr!P!Q!Hl!Q!}!Gr!}#O!JU#O#P!Bq#P;'S!Gr;'S;=`!J|<%lO!Gr8r!Hse(Z!b!X7`OY'}Zw'}x#O'}#P#W'}#W#X!Hl#X#Z'}#Z#[!Hl#[#]'}#]#^!Hl#^#a'}#a#b!Hl#b#g'}#g#h!Hl#h#i'}#i#j!Hl#j#k!Hl#k#m'}#m#n!Hl#n;'S'};'S;=`(f<%lO'}8r!JZX(Z!bOY!JUZw!JUwx!Arx#O!JU#O#P!B[#P#Q!Gr#Q;'S!JU;'S;=`!Jv<%lO!JU8r!JyP;=`<%l!JU8r!KPP;=`<%l!Gr>^!KZ^$i&j(Z!bOY!KSYZ&cZw!KSwx!CWx!^!KS!^!_!JU!_#O!KS#O#P!DR#P#Q!^!LYP;=`<%l!KS>^!L`P;=`<%l!_#c#d#Bq#d#l%Z#l#m#Es#m#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#>j_$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#?rd$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#A]f$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Bzc$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Dbe$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#E|g$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Gpi$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z*)x#Il_!g$b$i&j$O)Lv(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)[#Jv_al$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z04f#LS^h#)`#R-v$?V_!^(CdvBr$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z?O$@a_!q7`$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z07[$Aq|$i&j(Wp(Z!b'|0/l$]#t(T,2j(e$I[OX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr07[$D|k$i&j(Wp(Z!b'}0/l$]#t(T,2j(e$I[OY%ZYZ&cZr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$g%Z$g;'SEr;'S;=`I|<%lOEr",tokenizers:[Xg,Cg,Rg,Zg,2,3,4,5,6,7,8,9,10,11,12,13,14,Tg,new Hr("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOx~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!U~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(c~~",141,340),new Hr("j~RQYZXz{^~^O(Q~~aP!P!Qd~iO(R~~",25,323)],topRules:{Script:[0,7],SingleExpression:[1,276],SingleClassItem:[2,277]},dialects:{jsx:0,ts:15175},dynamicPrecedences:{80:1,82:1,94:1,169:1,199:1},specialized:[{term:327,get:i=>qg[i]||-1},{term:343,get:i=>Wg[i]||-1},{term:95,get:i=>Mg[i]||-1}],tokenPrec:15201});let Ko=[],pf=[];(()=>{let i="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e>1;if(i=pf[n])e=n+1;else return!0;if(e==t)return!1}}function Th(i){return i>=127462&&i<=127487}const Xh=8205;function Eg(i,e,t=!0,n=!0){return(t?mf:jg)(i,e,n)}function mf(i,e,t){if(e==i.length)return e;e&&gf(i.charCodeAt(e))&&Qf(i.charCodeAt(e-1))&&e--;let n=Hs(i,e);for(e+=Ch(n);e=0&&Th(Hs(i,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function jg(i,e,t){for(;e>1;){let n=mf(i,e-2,t);if(n=56320&&i<57344}function Qf(i){return i>=55296&&i<56320}function Ch(i){return i<65536?1:2}class D{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=Vi(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),Ot.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Vi(this,e,t);let n=[];return this.decompose(e,t,n,0),Ot.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new gn(this),s=new gn(e);for(let o=t,l=t;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(l+=r.value.length,r.done||l>=n)return!0}}iter(e=1){return new gn(this,e)}iterRange(e,t=this.length){return new Sf(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new bf(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?D.empty:e.length<=32?new le(e):Ot.from(le.split(e,[]))}}class le extends D{constructor(e,t=Vg(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let s=0;;s++){let o=this.text[s],l=r+o.length;if((t?n:l)>=e)return new Yg(r,l,n,o);r=l+1,n++}}decompose(e,t,n,r){let s=e<=0&&t>=this.length?this:new le(Rh(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let o=n.pop(),l=zr(s.text,o.text.slice(),0,s.length);if(l.length<=32)n.push(new le(l,o.length+s.length));else{let a=l.length>>1;n.push(new le(l.slice(0,a)),new le(l.slice(a)))}}else n.push(s)}replace(e,t,n){if(!(n instanceof le))return super.replace(e,t,n);[e,t]=Vi(this,e,t);let r=zr(this.text,zr(n.text,Rh(this.text,0,e)),t),s=this.length+n.length-(t-e);return r.length<=32?new le(r,s):Ot.from(le.split(r,[]),s)}sliceString(e,t=this.length,n=` +import{A as xe,t as sf}from"./index-BKcJcY8v.js";const of=1024;let Zm=0,Le=class{constructor(e,t){this.from=e,this.to=t}};class M{constructor(e={}){this.id=Zm++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Oe.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}}M.closedBy=new M({deserialize:i=>i.split(" ")});M.openedBy=new M({deserialize:i=>i.split(" ")});M.group=new M({deserialize:i=>i.split(" ")});M.isolate=new M({deserialize:i=>{if(i&&i!="rtl"&&i!="ltr"&&i!="auto")throw new RangeError("Invalid value for isolate: "+i);return i||"auto"}});M.contextHash=new M({perNode:!0});M.lookAhead=new M({perNode:!0});M.mounted=new M({perNode:!0});class Ri{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[M.mounted.id]}}const Am=Object.create(null);class Oe{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):Am,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new Oe(e.name||"",t,e.id,n);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(r)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(M.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(" "))t[r]=e[n];return n=>{for(let r=n.prop(M.group),s=-1;s<(r?r.length:0);s++){let o=t[s<0?n.name:r[s]];if(o)return o}}}}Oe.none=new Oe("",Object.create(null),0,8);class Kn{constructor(e){this.types=e;for(let t=0;t0;for(let a=this.cursor(o|I.IncludeAnonymous);;){let h=!1;if(a.from<=s&&a.to>=r&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&n&&(l||!a.type.isAnonymous)&&n(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:na(Oe.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,r)=>new U(this.type,t,n,r,this.propValues),e.makeTree||((t,n,r)=>new U(Oe.none,t,n,r)))}static build(e){return zm(e)}}U.empty=new U(Oe.none,[],[],0);class ta{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new ta(this.buffer,this.index)}}class It{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Oe.none}toString(){let e=[];for(let t=0;t0));a=o[a+3]);return l}slice(e,t,n){let r=this.buffer,s=new Uint16Array(t-e),o=0;for(let l=e,a=0;l=e&&te;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return!0}}function vn(i,e,t,n){for(var r;i.from==i.to||(t<1?i.from>=e:i.from>e)||(t>-1?i.to<=e:i.to0?l.length:-1;e!=h;e+=t){let c=l[e],O=a[e]+o.from,f;if(!(!(s&I.EnterBracketed&&c instanceof U&&(f=Ri.get(c))&&!f.overlay&&f.bracketed&&n>=O&&n<=O+c.length)&&!lf(r,n,O,O+c.length))){if(c instanceof It){if(s&I.ExcludeBuffers)continue;let u=c.findChild(0,c.buffer.length,t,n-O,r);if(u>-1)return new dt(new qm(o,c,e,O),null,u)}else if(s&I.IncludeAnonymous||!c.type.isAnonymous||ia(c)){let u;if(!(s&I.IgnoreMounts)&&(u=Ri.get(c))&&!u.overlay)return new Pe(u.tree,O,e,o);let d=new Pe(c,O,e,o);return s&I.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?c.children.length-1:0,t,n,r,s)}}}if(s&I.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,n=0){let r;if(!(n&I.IgnoreOverlays)&&(r=Ri.get(this._tree))&&r.overlay){let s=e-this.from,o=n&I.EnterBracketed&&r.bracketed;for(let{from:l,to:a}of r.overlay)if((t>0||o?l<=s:l=s:a>s))return new Pe(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function ch(i,e,t,n){let r=i.cursor(),s=[];if(!r.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=r.type.is(t),!r.nextSibling())return s}for(;;){if(n!=null&&r.type.is(n))return s;if(r.type.is(e)&&s.push(r.node),!r.nextSibling())return n==null?s:[]}}function Go(i,e,t=e.length-1){for(let n=i;t>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return!1;t--}}return!0}class qm{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}}class dt extends af{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,n);return s<0?null:new dt(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,n=0){if(n&I.ExcludeBuffers)return null;let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new dt(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new dt(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new dt(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,s=n.buffer[this.index+3];if(s>r){let o=n.buffer[this.index+1];e.push(n.slice(r,s,o)),t.push(0)}return new U(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function hf(i){if(!i.length)return null;let e=0,t=i[0];for(let s=1;st.from||o.to=e){let l=new Pe(o.tree,o.overlay[0].from+s.from,-1,s);(r||(r=[n])).push(vn(l,e,t,!1))}}return r?hf(r):n}class Ur{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~I.EnterBracketed,e instanceof Pe)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return e?e instanceof Pe?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&I.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&I.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&I.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let r=n<0?0:this.stack[n]+4;if(this.index!=r)return this.yieldBuf(t.findChild(r,this.index,-1,0,4))}else{let r=t.buffer[this.index+3];if(r<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(r)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index-1)for(let s=t+e,o=e<0?-1:n._tree.children.length;s!=o;s+=e){let l=n._tree.children[s];if(this.mode&I.IncludeAnonymous||l instanceof It||!l.type.isAnonymous||ia(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;t=o,n=s+1;break e}r=this.stack[--s]}for(let r=n;r=0;s--){if(s<0)return Go(this._tree,e,r);let o=n[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}}function ia(i){return i.children.some(e=>e instanceof It||!e.type.isAnonymous||ia(e))}function zm(i){var e;let{buffer:t,nodeSet:n,maxBufferLength:r=of,reused:s=[],minRepeatType:o=n.types.length}=i,l=Array.isArray(t)?new ta(t,t.length):t,a=n.types,h=0,c=0;function O(x,k,$,q,_,B){let{id:z,start:A,end:V,size:E}=l,G=c,oe=h;if(E<0)if(l.next(),E==-1){let me=s[z];$.push(me),q.push(A-x);return}else if(E==-3){h=z;return}else if(E==-4){c=z;return}else throw new RangeError(`Unrecognized record size: ${E}`);let fe=a[z],we,ie,pe=A-x;if(V-A<=r&&(ie=g(l.pos-k,_))){let me=new Uint16Array(ie.size-ie.skip),ve=l.pos-ie.size,Me=me.length;for(;l.pos>ve;)Me=Q(ie.start,me,Me);we=new It(me,V-ie.start,n),pe=ie.start-x}else{let me=l.pos-E;l.next();let ve=[],Me=[],H=z>=o?z:-1,Fe=0,ni=V;for(;l.pos>me;)H>=0&&l.id==H&&l.size>=0?(l.end<=ni-r&&(d(ve,Me,A,Fe,l.end,ni,H,G,oe),Fe=ve.length,ni=l.end),l.next()):B>2500?f(A,me,ve,Me):O(A,me,ve,Me,H,B+1);if(H>=0&&Fe>0&&Fe-1&&Fe>0){let ki=u(fe,oe);we=na(fe,ve,Me,0,ve.length,0,V-A,ki,ki)}else we=m(fe,ve,Me,V-A,G-V,oe)}$.push(we),q.push(pe)}function f(x,k,$,q){let _=[],B=0,z=-1;for(;l.pos>k;){let{id:A,start:V,end:E,size:G}=l;if(G>4)l.next();else{if(z>-1&&V=0;E-=3)A[G++]=_[E],A[G++]=_[E+1]-V,A[G++]=_[E+2]-V,A[G++]=G;$.push(new It(A,_[2]-V,n)),q.push(V-x)}}function u(x,k){return($,q,_)=>{let B=0,z=$.length-1,A,V;if(z>=0&&(A=$[z])instanceof U){if(!z&&A.type==x&&A.length==_)return A;(V=A.prop(M.lookAhead))&&(B=q[z]+A.length+V)}return m(x,$,q,_,B,k)}}function d(x,k,$,q,_,B,z,A,V){let E=[],G=[];for(;x.length>q;)E.push(x.pop()),G.push(k.pop()+$-_);x.push(m(n.types[z],E,G,B-_,A-B,V)),k.push(_-$)}function m(x,k,$,q,_,B,z){if(B){let A=[M.contextHash,B];z=z?[A].concat(z):[A]}if(_>25){let A=[M.lookAhead,_];z=z?[A].concat(z):[A]}return new U(x,k,$,q,z)}function g(x,k){let $=l.fork(),q=0,_=0,B=0,z=$.end-r,A={size:0,start:0,skip:0};e:for(let V=$.pos-x;$.pos>V;){let E=$.size;if($.id==k&&E>=0){A.size=q,A.start=_,A.skip=B,B+=4,q+=4,$.next();continue}let G=$.pos-E;if(E<0||G=o?4:0,fe=$.start;for($.next();$.pos>G;){if($.size<0)if($.size==-3||$.size==-4)oe+=4;else break e;else $.id>=o&&(oe+=4);$.next()}_=fe,q+=E,B+=oe}return(k<0||q==x)&&(A.size=q,A.start=_,A.skip=B),A.size>4?A:void 0}function Q(x,k,$){let{id:q,start:_,end:B,size:z}=l;if(l.next(),z>=0&&q4){let V=l.pos-(z-4);for(;l.pos>V;)$=Q(x,k,$)}k[--$]=A,k[--$]=B-x,k[--$]=_-x,k[--$]=q}else z==-3?h=q:z==-4&&(c=q);return $}let S=[],y=[];for(;l.pos>0;)O(i.start||0,i.bufferStart||0,S,y,-1,0);let w=(e=i.length)!==null&&e!==void 0?e:S.length?y[0]+S[0].length:0;return new U(a[i.topID],S.reverse(),y.reverse(),w)}const Oh=new WeakMap;function Wr(i,e){if(!i.isAnonymous||e instanceof It||e.type!=i)return 1;let t=Oh.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=i||!(n instanceof U)){t=1;break}t+=Wr(i,n)}Oh.set(e,t)}return t}function na(i,e,t,n,r,s,o,l,a){let h=0;for(let d=n;d=c)break;k+=$}if(y==w+1){if(k>c){let $=d[w];u($.children,$.positions,0,$.children.length,m[w]+S);continue}O.push(d[w])}else{let $=m[y-1]+d[y-1].length-x;O.push(na(i,d,m,w,y,x,$,null,a))}f.push(x+S-s)}}return u(e,t,n,r,0),(l||a)(O,f,o)}class ra{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let r=this.map.get(e);r||this.map.set(e,r=new Map),r.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof dt?this.setBuffer(e.context.buffer,e.index,t):e instanceof Pe&&this.map.set(e.tree,t)}get(e){return e instanceof dt?this.getBuffer(e.context.buffer,e.index):e instanceof Pe?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Xt{constructor(e,t,n,r,s=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],n=!1){let r=[new Xt(0,e.length,e,0,!1,n)];for(let s of t)s.to>e.length&&r.push(s);return r}static applyChanges(e,t,n=128){if(!t.length)return e;let r=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let c=l=n)for(;o&&o.from=f.from||O<=f.to||h){let u=Math.max(f.from,a)-h,d=Math.min(f.to,O)-h;f=u>=d?null:new Xt(u,d,f.tree,f.offset+h,l>0,!!c)}if(f&&r.push(f),o.to>O)break;o=snew Le(r.from,r.to)):[new Le(0,0)]:[new Le(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let s=r.advance();if(s)return s}}}class _m{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function cf(i){return(e,t,n,r)=>new jm(e,i,t,n,r)}class fh{constructor(e,t,n,r,s,o){this.parser=e,this.parse=t,this.overlay=n,this.bracketed=r,this.target=s,this.from=o}}function uh(i){if(!i.length||i.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(i))}class Em{constructor(e,t,n,r,s,o,l,a){this.parser=e,this.predicate=t,this.mounts=n,this.index=r,this.start=s,this.bracketed=o,this.target=l,this.prev=a,this.depth=0,this.ranges=[]}}const Io=new M({perNode:!0});class jm{constructor(e,t,n,r,s){this.nest=t,this.input=n,this.fragments=r,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let n=this.baseParse.advance();if(!n)return null;if(this.baseParse=null,this.baseTree=n,this.startInner(),this.stoppedAt!=null)for(let r of this.inner)r.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let n=this.baseTree;return this.stoppedAt!=null&&(n=new U(n.type,n.children,n.positions,n.length,n.propValues.concat([[Io,this.stoppedAt]]))),n}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[M.mounted.id]=new Ri(t,e.overlay,e.parser,e.bracketed),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t=this.stoppedAt)l=!1;else if(e.hasNode(r)){if(t){let h=t.mounts.find(c=>c.frag.from<=r.from&&c.frag.to>=r.to&&c.mount.overlay);if(h)for(let c of h.mount.overlay){let O=c.from+h.pos,f=c.to+h.pos;O>=r.from&&f<=r.to&&!t.ranges.some(u=>u.fromO)&&t.ranges.push({from:O,to:f})}}l=!1}else if(n&&(o=Vm(n.ranges,r.from,r.to)))l=o!=2;else if(!r.type.isAnonymous&&(s=this.nest(r,this.input))&&(r.fromnew Le(O.from-r.from,O.to-r.from)):null,!!s.bracketed,r.tree,c.length?c[0].from:r.from)),s.overlay?c.length&&(n={ranges:c,depth:0,prev:n}):l=!1}}else if(t&&(a=t.predicate(r))&&(a===!0&&(a=new Le(r.from,r.to)),a.from=0&&t.ranges[h].to==a.from?t.ranges[h]={from:t.ranges[h].from,to:a.to}:t.ranges.push(a)}if(l&&r.firstChild())t&&t.depth++,n&&n.depth++;else for(;!r.nextSibling();){if(!r.parent())break e;if(t&&!--t.depth){let h=mh(this.ranges,t.ranges);h.length&&(uh(h),this.inner.splice(t.index,0,new fh(t.parser,t.parser.startParse(this.input,gh(t.mounts,h),h),t.ranges.map(c=>new Le(c.from-t.start,c.to-t.start)),t.bracketed,t.target,h[0].from))),t=t.prev}n&&!--n.depth&&(n=n.prev)}}}}function Vm(i,e,t){for(let n of i){if(n.from>=t)break;if(n.to>e)return n.from<=e&&n.to>=t?2:1}return 0}function dh(i,e,t,n,r,s){if(e=e&&t.enter(n,1,I.IgnoreOverlays|I.ExcludeBuffers)))if(t.to<=e)t.next(!1)||(this.done=!0);else break}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof U)t=t.children[0];else break}return!1}}let Lm=class{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let n=this.curFrag=e[0];this.curTo=(t=n.tree.prop(Io))!==null&&t!==void 0?t:n.to,this.inner=new ph(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(Io))!==null&&e!==void 0?e:t.to,this.inner=new ph(t.tree,-t.offset)}}findMounts(e,t){var n;let r=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(n=s.tree)===null||n===void 0?void 0:n.prop(M.mounted);if(o&&o.parser==t)for(let l=this.fragI;l=s.to)break;a.tree==this.curFrag.tree&&r.push({frag:a,pos:s.from-a.offset,mount:o})}}}return r}};function mh(i,e){let t=null,n=e;for(let r=1,s=0;r=l)break;a.to<=o||(t||(n=t=e.slice()),a.froml&&t.splice(s+1,0,new Le(l,a.to))):a.to>l?t[s--]=new Le(l,a.to):t.splice(s--,1))}}return n}function Dm(i,e,t,n){let r=0,s=0,o=!1,l=!1,a=-1e9,h=[];for(;;){let c=r==i.length?1e9:o?i[r].to:i[r].from,O=s==e.length?1e9:l?e[s].to:e[s].from;if(o!=l){let f=Math.max(a,t),u=Math.min(c,O,n);fnew Le(f.from+n,f.to+n)),O=Dm(e,c,a,h);for(let f=0,u=a;;f++){let d=f==O.length,m=d?h:O[f].from;if(m>u&&t.push(new Xt(u,m,r.tree,-o,s.from>=u||s.openStart,s.to<=m||s.openEnd)),d)break;u=O[f].to}}else t.push(new Xt(a,h,r.tree,-o,s.from>=o||s.openStart,s.to<=l||s.openEnd))}return t}var Qh={};class Nr{constructor(e,t,n,r,s,o,l,a,h,c=0,O){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=h,this.lookAhead=c,this.parent=O}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let r=e.parser.context;return new Nr(e,[],t,n,n,0,[],0,r?new Sh(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,r=e&65535,{parser:s}=this.p,o=this.reducePos=2e3&&!(!((t=this.p.parser.nodeSet.types[r])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(r,h)}storeNode(e,t,n,r=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(t==n)return;if(this.buffer[o-2]>=t){this.buffer[o-2]=n;return}}}if(!s||this.pos==n)this.buffer.push(e,t,n,r);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let l=!1;for(let a=o;a>0&&this.buffer[a-2]>n;a-=4)if(this.buffer[a-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>n;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,r>4&&(r-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=n,this.buffer[o+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let s=e,{parser:o}=this.p;this.pos=r;let l=o.stateFlag(s,1);!l&&(r>n||t<=o.maxNode)&&(this.reducePos=r),this.pushState(s,l?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=o.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(t&&e.buffer[t-4]==0&&(t-=4);t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),r=e.bufferBase+t;for(;e&&r==e.bufferBase;)e=e.parent;return new Nr(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new Bm(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let r=[];for(let s=0,o;sa&1&&l==o)||r.push(t[s],o)}t=r}let n=[];for(let r=0;r>19,r=t&65535,s=this.stack.length-n*3;if(s<0||e.getGoto(this.stack[s],r,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,s)=>{if(!t.includes(r))return t.push(r),e.allActions(r,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let a=o&65535,h=this.stack.length-l*3;if(h>=0&&e.getGoto(this.stack[h],a,!1)>=0)return l<<19|65536|a}}else{let l=n(o,s+1);if(l!=null)return l}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t0&&this.emitLookAhead()}}class Sh{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class Bm{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}}class Fr{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Fr(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Fr(this.stack,this.pos,this.index)}}function un(i,e=Uint16Array){if(typeof i!="string")return i;let t=null;for(let n=0,r=0;n=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}t?t[r++]=s:t=new e(s)}return t}class Mr{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const bh=new Mr;class Gm{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=bh,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,s=this.pos+e;for(;sn.to:s>=n.to;){if(r==this.ranges.length-1)return null;let o=this.ranges[++r];s+=o.from-n.to,n=o}return s}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t=this.chunk2Pos&&nl.to&&(this.chunk2=this.chunk2.slice(0,l.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=bh,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}}class Zi{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;Of(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}Zi.prototype.contextual=Zi.prototype.fallback=Zi.prototype.extend=!1;class Hr{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e=="string"?un(e):e}token(e,t){let n=e.pos,r=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(Of(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||r++,o==null)break;e.reset(o,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}}Hr.prototype.contextual=Zi.prototype.fallback=Zi.prototype.extend=!1;class ae{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function Of(i,e,t,n,r,s){let o=0,l=1<0){let d=i[u];if(a.allows(d)&&(e.token.value==-1||e.token.value==d||Im(d,e.token.value,r,s))){e.acceptToken(d);break}}let c=e.next,O=0,f=i[o+2];if(e.next<0&&f>O&&i[h+f*3-3]==65535){o=i[h+f*3-1];continue e}for(;O>1,d=h+u+(u<<1),m=i[d],g=i[d+1]||65536;if(c=g)O=u+1;else{o=i[d+2],e.advance();continue e}}break}}function yh(i,e,t){for(let n=e,r;(r=i[n])!=65535;n++)if(r==t)return n-e;return-1}function Im(i,e,t,n){let r=yh(t,n,e);return r<0||yh(t,n,i)e)&&!n.type.isError)return t<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(i.length,Math.max(n.from+1,e+25));if(t<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return t<0?0:i.length}}let Um=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?xh(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?xh(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(s instanceof U){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}};class Nm{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new Mr)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:s}=r,o=r.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let h=0;hO.end+25&&(a=Math.max(O.lookAhead,a)),O.value!=0)){let f=t;if(O.extended>-1&&(t=this.addActions(e,O.extended,O.end,t)),t=this.addActions(e,O.value,O.end,t),!c.extend&&(n=O,t>f))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),!n&&e.pos==this.stream.end&&(n=new Mr,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Mr,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:s}=n.p;for(let o=0;o=0&&n.p.parser.dialect.allows(l>>1)){l&1?e.extended=l>>1:e.value=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let s=0;se.bufferLength*4?new Um(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;ot)n.push(l);else{if(this.advanceStack(l,n,e))continue;{r||(r=[],s=[]),r.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!n.length){let o=r&&Km(r);if(o)return ze&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw ze&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&r){let o=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,s,n);if(o)return ze&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(n.length>o)for(n.sort((l,a)=>a.score-l.score);n.length>o;)n.pop();n.some(l=>l.reducePos>t)&&this.recovering--}else if(n.length>1){e:for(let o=0;o500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)n.splice(a--,1);else{n.splice(o--,1);continue e}}}n.length>12&&(n.sort((o,l)=>l.score-o.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,c=h?e.curContext.hash:0;for(let O=this.fragments.nodeAt(r);O;){let f=this.parser.nodeSet.types[O.type.id]==O.type?s.getGoto(e.state,O.type.id):-1;if(f>-1&&O.length&&(!h||(O.prop(M.contextHash)||0)==c))return e.useNode(O,f),ze&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(O.type.id)})`),!0;if(!(O instanceof U)||O.children.length==0||O.positions[0]>0)break;let u=O.children[0];if(u instanceof U&&O.positions[0]==0)O=u;else break}}let l=s.stateSlot(e.state,4);if(l>0)return e.reduce(l),ze&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let h=0;hr?t.push(d):n.push(d)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return kh(e,t),!0}}runRecovery(e,t,n){let r=null,s=!1;for(let o=0;o ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),ze&&console.log(c+this.stackID(l)+" (restarted)"),this.advanceFully(l,n))))continue;let O=l.split(),f=c;for(let u=0;u<10&&O.forceReduce()&&(ze&&console.log(f+this.stackID(O)+" (via force-reduce)"),!this.advanceFully(O,n));u++)ze&&(f=this.stackID(O)+" -> ");for(let u of l.recoverByInsert(a))ze&&console.log(c+this.stackID(u)+" (via recover-insert)"),this.advanceFully(u,n);this.stream.end>l.pos?(h==l.pos&&(h++,a=0),l.recoverByDelete(a,h),ze&&console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),kh(l,n)):(!r||r.scorei;class Ts{constructor(e){this.start=e.start,this.shift=e.shift||Us,this.reduce=e.reduce||Us,this.reuse=e.reuse||Us,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Rt extends sa{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let l=0;le.topRules[l][1]),r=[];for(let l=0;l=0)s(c,a,l[h++]);else{let O=l[h+-c];for(let f=-c;f>0;f--)s(l[h++],a,O);h++}}}this.nodeSet=new Kn(t.map((l,a)=>Oe.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:r[a],top:n.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=of;let o=un(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new Zi(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new Fm(this,e,t,n);for(let s of this.wrappers)r=s(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let s=r[t+1];;){let o=r[s++],l=o&1,a=r[s++];if(l&&n)return a;for(let h=s+(o>>1);s0}validAction(e,t){return!!this.allActions(e,n=>n==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let s=this.stateSlot(e,1);r==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=vt(this.data,s+2);else break;r=t(vt(this.data,s+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=vt(this.data,n+2);else break;if(!(this.data[n+2]&1)){let r=this.data[n+1];t.some((s,o)=>o&1&&s==r)||t.push(this.data[n],r)}}return t}configure(e){let t=Object.assign(Object.create(Rt.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(n=>{let r=e.tokenizers.find(s=>s.from==n);return r?r.to:n})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,r)=>{let s=e.specializers.find(l=>l.from==n.external);if(!s)return n;let o=Object.assign(Object.assign({},n),{external:s.to});return t.specializers[r]=Ph(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(n[o]=!0)}let r=null;for(let s=0;sn)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.scorei.external(t,n)<<1|e}return i.get}let Jm=0,ct=class Uo{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=Jm++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n=typeof e=="string"?e:"?";if(e instanceof Uo&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let r=new Uo(n,[],null,[]);if(r.set.push(r),t)for(let s of t.set)r.set.push(s);return r}static defineModifier(e){let t=new Kr(e);return n=>n.modified.indexOf(t)>-1?n:Kr.get(n.base||n,n.modified.concat(t).sort((r,s)=>r.id-s.id))}},eg=0;class Kr{constructor(e){this.name=e,this.instances=[],this.id=eg++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(l=>l.base==e&&tg(t,l.modified));if(n)return n;let r=[],s=new ct(e.name,r,e,t);for(let l of t)l.instances.push(s);let o=ig(t);for(let l of e.set)if(!l.modified.length)for(let a of o)r.push(Kr.get(l,a));return s}}function tg(i,e){return i.length==e.length&&i.every((t,n)=>t==e[n])}function ig(i){let e=[[]];for(let t=0;tn.length-t.length)}function zt(i){let e=Object.create(null);for(let t in i){let n=i[t];Array.isArray(n)||(n=[n]);for(let r of t.split(" "))if(r){let s=[],o=2,l=r;for(let O=0;;){if(l=="..."&&O>0&&O+3==r.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!f)throw new RangeError("Invalid path: "+r);if(s.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),O+=f[0].length,O==r.length)break;let u=r[O++];if(O==r.length&&u=="!"){o=0;break}if(u!="/")throw new RangeError("Invalid path: "+r);l=r.slice(O)}let a=s.length-1,h=s[a];if(!h)throw new RangeError("Invalid path: "+r);let c=new Tn(n,o,a>0?s.slice(0,a):null);e[h]=c.sort(e[h])}}return ff.add(e)}const ff=new M({combine(i,e){let t,n,r;for(;i||e;){if(!i||e&&i.depth>=e.depth?(r=e,e=e.next):(r=i,i=i.next),t&&t.mode==r.mode&&!r.context&&!t.context)continue;let s=new Tn(r.tags,r.mode,r.context);t?t.next=s:n=s,t=s}return n}});class Tn{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=r;for(let l of s)for(let a of l.set){let h=t[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:n}}function ng(i,e){let t=null;for(let n of i){let r=n.style(e);r&&(t=t?t+" "+r:r)}return t}function rg(i,e,t,n=0,r=i.length){let s=new sg(n,Array.isArray(e)?e:[e],t);s.highlightRange(i.cursor(),n,r,"",s.highlighters),s.flush(r)}class sg{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,s){let{type:o,from:l,to:a}=e;if(l>=n||a<=t)return;o.isTop&&(s=this.highlighters.filter(u=>!u.scope||u.scope(o)));let h=r,c=og(e)||Tn.empty,O=ng(s,c.tags);if(O&&(h&&(h+=" "),h+=O,c.mode==1&&(r+=(r?" ":"")+O)),this.startSpan(Math.max(t,l),h),c.opaque)return;let f=e.tree&&e.tree.prop(M.mounted);if(f&&f.overlay){let u=e.node.enter(f.overlay[0].from+l,1),d=this.highlighters.filter(g=>!g.scope||g.scope(f.tree.type)),m=e.firstChild();for(let g=0,Q=l;;g++){let S=g=y||!e.nextSibling())););if(!S||y>n)break;Q=S.to+l,Q>t&&(this.highlightRange(u.cursor(),Math.max(t,S.from+l),Math.min(n,Q),"",d),this.startSpan(Math.min(n,Q),h))}m&&e.parent()}else if(e.firstChild()){f&&(r="");do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,s),this.startSpan(Math.min(n,e.to),h)}while(e.nextSibling());e.parent()}}}function og(i){let e=i.type.prop(ff);for(;e&&e.context&&!i.matchContext(e.context);)e=e.next;return e||null}const T=ct.define,cr=T(),Vt=T(),$h=T(Vt),wh=T(Vt),Yt=T(),Or=T(Yt),Ns=T(Yt),ht=T(),oi=T(ht),ot=T(),lt=T(),No=T(),sn=T(No),fr=T(),p={comment:cr,lineComment:T(cr),blockComment:T(cr),docComment:T(cr),name:Vt,variableName:T(Vt),typeName:$h,tagName:T($h),propertyName:wh,attributeName:T(wh),className:T(Vt),labelName:T(Vt),namespace:T(Vt),macroName:T(Vt),literal:Yt,string:Or,docString:T(Or),character:T(Or),attributeValue:T(Or),number:Ns,integer:T(Ns),float:T(Ns),bool:T(Yt),regexp:T(Yt),escape:T(Yt),color:T(Yt),url:T(Yt),keyword:ot,self:T(ot),null:T(ot),atom:T(ot),unit:T(ot),modifier:T(ot),operatorKeyword:T(ot),controlKeyword:T(ot),definitionKeyword:T(ot),moduleKeyword:T(ot),operator:lt,derefOperator:T(lt),arithmeticOperator:T(lt),logicOperator:T(lt),bitwiseOperator:T(lt),compareOperator:T(lt),updateOperator:T(lt),definitionOperator:T(lt),typeOperator:T(lt),controlOperator:T(lt),punctuation:No,separator:T(No),bracket:sn,angleBracket:T(sn),squareBracket:T(sn),paren:T(sn),brace:T(sn),content:ht,heading:oi,heading1:T(oi),heading2:T(oi),heading3:T(oi),heading4:T(oi),heading5:T(oi),heading6:T(oi),contentSeparator:T(ht),list:T(ht),quote:T(ht),emphasis:T(ht),strong:T(ht),link:T(ht),monospace:T(ht),strikethrough:T(ht),inserted:T(),deleted:T(),changed:T(),invalid:T(),meta:fr,documentMeta:T(fr),annotation:T(fr),processingInstruction:T(fr),definition:ct.defineModifier("definition"),constant:ct.defineModifier("constant"),function:ct.defineModifier("function"),standard:ct.defineModifier("standard"),local:ct.defineModifier("local"),special:ct.defineModifier("special")};for(let i in p){let e=p[i];e instanceof ct&&(e.name=i)}uf([{tag:p.link,class:"tok-link"},{tag:p.heading,class:"tok-heading"},{tag:p.emphasis,class:"tok-emphasis"},{tag:p.strong,class:"tok-strong"},{tag:p.keyword,class:"tok-keyword"},{tag:p.atom,class:"tok-atom"},{tag:p.bool,class:"tok-bool"},{tag:p.url,class:"tok-url"},{tag:p.labelName,class:"tok-labelName"},{tag:p.inserted,class:"tok-inserted"},{tag:p.deleted,class:"tok-deleted"},{tag:p.literal,class:"tok-literal"},{tag:p.string,class:"tok-string"},{tag:p.number,class:"tok-number"},{tag:[p.regexp,p.escape,p.special(p.string)],class:"tok-string2"},{tag:p.variableName,class:"tok-variableName"},{tag:p.local(p.variableName),class:"tok-variableName tok-local"},{tag:p.definition(p.variableName),class:"tok-variableName tok-definition"},{tag:p.special(p.variableName),class:"tok-variableName2"},{tag:p.definition(p.propertyName),class:"tok-propertyName tok-definition"},{tag:p.typeName,class:"tok-typeName"},{tag:p.namespace,class:"tok-namespace"},{tag:p.className,class:"tok-className"},{tag:p.macroName,class:"tok-macroName"},{tag:p.propertyName,class:"tok-propertyName"},{tag:p.operator,class:"tok-operator"},{tag:p.comment,class:"tok-comment"},{tag:p.meta,class:"tok-meta"},{tag:p.invalid,class:"tok-invalid"},{tag:p.punctuation,class:"tok-punctuation"}]);const lg=316,ag=317,vh=1,hg=2,cg=3,Og=4,fg=318,ug=320,dg=321,pg=5,mg=6,gg=0,Fo=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],df=125,Qg=59,Ho=47,Sg=42,bg=43,yg=45,xg=60,kg=44,Pg=63,$g=46,wg=91,vg=new Ts({start:!1,shift(i,e){return e==pg||e==mg||e==ug?i:e==dg},strict:!1}),Tg=new ae((i,e)=>{let{next:t}=i;(t==df||t==-1||e.context)&&i.acceptToken(fg)},{contextual:!0,fallback:!0}),Xg=new ae((i,e)=>{let{next:t}=i,n;Fo.indexOf(t)>-1||t==Ho&&((n=i.peek(1))==Ho||n==Sg)||t!=df&&t!=Qg&&t!=-1&&!e.context&&i.acceptToken(lg)},{contextual:!0}),Cg=new ae((i,e)=>{i.next==wg&&!e.context&&i.acceptToken(ag)},{contextual:!0}),Rg=new ae((i,e)=>{let{next:t}=i;if(t==bg||t==yg){if(i.advance(),t==i.next){i.advance();let n=!e.context&&e.canShift(vh);i.acceptToken(n?vh:hg)}}else t==Pg&&i.peek(1)==$g&&(i.advance(),i.advance(),(i.next<48||i.next>57)&&i.acceptToken(cg))},{contextual:!0});function Fs(i,e){return i>=65&&i<=90||i>=97&&i<=122||i==95||i>=192||!e&&i>=48&&i<=57}const Zg=new ae((i,e)=>{if(i.next!=xg||!e.dialectEnabled(gg)||(i.advance(),i.next==Ho))return;let t=0;for(;Fo.indexOf(i.next)>-1;)i.advance(),t++;if(Fs(i.next,!0)){for(i.advance(),t++;Fs(i.next,!1);)i.advance(),t++;for(;Fo.indexOf(i.next)>-1;)i.advance(),t++;if(i.next==kg)return;for(let n=0;;n++){if(n==7){if(!Fs(i.next,!0))return;break}if(i.next!="extends".charCodeAt(n))break;i.advance(),t++}}i.acceptToken(Og,-t)}),Ag=zt({"get set async static":p.modifier,"for while do if else switch try catch finally return throw break continue default case defer":p.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":p.operatorKeyword,"let var const using function class extends":p.definitionKeyword,"import export from":p.moduleKeyword,"with debugger new":p.keyword,TemplateString:p.special(p.string),super:p.atom,BooleanLiteral:p.bool,this:p.self,null:p.null,Star:p.modifier,VariableName:p.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":p.function(p.variableName),VariableDefinition:p.definition(p.variableName),Label:p.labelName,PropertyName:p.propertyName,PrivatePropertyName:p.special(p.propertyName),"CallExpression/MemberExpression/PropertyName":p.function(p.propertyName),"FunctionDeclaration/VariableDefinition":p.function(p.definition(p.variableName)),"ClassDeclaration/VariableDefinition":p.definition(p.className),"NewExpression/VariableName":p.className,PropertyDefinition:p.definition(p.propertyName),PrivatePropertyDefinition:p.definition(p.special(p.propertyName)),UpdateOp:p.updateOperator,"LineComment Hashbang":p.lineComment,BlockComment:p.blockComment,Number:p.number,String:p.string,Escape:p.escape,ArithOp:p.arithmeticOperator,LogicOp:p.logicOperator,BitOp:p.bitwiseOperator,CompareOp:p.compareOperator,RegExp:p.regexp,Equals:p.definitionOperator,Arrow:p.function(p.punctuation),": Spread":p.punctuation,"( )":p.paren,"[ ]":p.squareBracket,"{ }":p.brace,"InterpolationStart InterpolationEnd":p.special(p.brace),".":p.derefOperator,", ;":p.separator,"@":p.meta,TypeName:p.typeName,TypeDefinition:p.definition(p.typeName),"type enum interface implements namespace module declare":p.definitionKeyword,"abstract global Privacy readonly override":p.modifier,"is keyof unique infer asserts":p.operatorKeyword,JSXAttributeValue:p.attributeValue,JSXText:p.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":p.angleBracket,"JSXIdentifier JSXNameSpacedName":p.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":p.attributeName,"JSXBuiltin/JSXIdentifier":p.standard(p.tagName)}),qg={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:235,private:235,protected:235,readonly:237,instanceof:256,satisfies:259,import:292,keyof:349,unique:353,infer:359,asserts:395,is:397,abstract:417,implements:419,type:421,let:424,var:426,using:429,interface:435,enum:439,namespace:445,module:447,declare:451,global:455,defer:471,for:476,of:485,while:488,with:492,do:496,if:500,else:502,switch:506,case:512,try:518,catch:522,finally:526,return:530,throw:534,break:538,continue:542,debugger:546},Wg={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:401},Mg={__proto__:null,"<":193},zg=Rt.deserialize({version:14,states:"$F|Q%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&jO'#CjO+oO#@ItO'#DaO.QQlO'#DgO.bQlO'#DrO%[QlO'#DzO0fQlO'#ESOOQ!0Lf'#E['#E[O1PQ`O'#EXOOQO'#Ep'#EpOOQO'#Il'#IlO1XQ`O'#GsO1dQ`O'#EoO1iQ`O'#EoO3hQ!0MxO'#JrO6[Q!0MxO'#JsO6uQ`O'#F]O6zQ,UO'#FtOOQ!0Lf'#Ff'#FfO7VO7dO'#FfO9XQMhO'#F|O9`Q`O'#F{OOQ!0Lf'#Js'#JsOOQ!0Lb'#Jr'#JrO9eQ`O'#GwOOQ['#K_'#K_O9pQ`O'#IYO9uQ!0LrO'#IZOOQ['#J`'#J`OOQ['#I_'#I_Q`QlOOQ`QlOOO9}Q!L^O'#DvO:UQlO'#EOO:]QlO'#EQO9kQ`O'#GsO:dQMhO'#CoO:rQ`O'#EnO:}Q`O'#EyO;hQMhO'#FeO;xQ`O'#GsOOQO'#K`'#K`O;}Q`O'#K`O<]Q`O'#G{O<]Q`O'#G|O<]Q`O'#HOO9kQ`O'#HRO=SQ`O'#HUO>kQ`O'#CeO>{Q`O'#HcO?TQ`O'#HiO?TQ`O'#HkO`QlO'#HmO?TQ`O'#HoO?TQ`O'#HrO?YQ`O'#HxO?_Q!0LsO'#IOO%[QlO'#IQO?jQ!0LsO'#ISO?uQ!0LsO'#IUO9uQ!0LrO'#IWO@QQ!0MxO'#CiOASQpO'#DlQOQ`OOO%[QlO'#EQOAjQ`O'#ETO:dQMhO'#EnOAuQ`O'#EnOBQQ!bO'#FeOOQ['#Cg'#CgOOQ!0Lb'#Dq'#DqOOQ!0Lb'#Jv'#JvO%[QlO'#JvOOQO'#Jy'#JyOOQO'#Ih'#IhOCQQpO'#EgOOQ!0Lb'#Ef'#EfOOQ!0Lb'#J}'#J}OC|Q!0MSO'#EgODWQpO'#EWOOQO'#Jx'#JxODlQpO'#JyOEyQpO'#EWODWQpO'#EgPFWO&2DjO'#CbPOOO)CD})CD}OOOO'#I`'#I`OFcO#tO,59UOOQ!0Lh,59U,59UOOOO'#Ia'#IaOFqO&jO,59UOGPQ!L^O'#DcOOOO'#Ic'#IcOGWO#@ItO,59{OOQ!0Lf,59{,59{OGfQlO'#IdOGyQ`O'#JtOIxQ!fO'#JtO+}QlO'#JtOJPQ`O,5:ROJgQ`O'#EpOJtQ`O'#KTOKPQ`O'#KSOKPQ`O'#KSOKXQ`O,5;^OK^Q`O'#KROOQ!0Ln,5:^,5:^OKeQlO,5:^OMcQ!0MxO,5:fONSQ`O,5:nONmQ!0LrO'#KQONtQ`O'#KPO9eQ`O'#KPO! YQ`O'#KPO! bQ`O,5;]O! gQ`O'#KPO!#lQ!fO'#JsOOQ!0Lh'#Ci'#CiO%[QlO'#ESO!$[Q!fO,5:sOOQS'#Jz'#JzOOQO-EtOOQ['#Jh'#JhOOQ[,5>u,5>uOOQ[-E<]-E<]O!TO`QlO,5>VO!LOQ`O,5>XO`QlO,5>ZO!LTQ`O,5>^O!LYQlO,5>dOOQ[,5>j,5>jO%[QlO,5>jO9uQ!0LrO,5>lOOQ[,5>n,5>nO#!dQ`O,5>nOOQ[,5>p,5>pO#!dQ`O,5>pOOQ[,5>r,5>rO##QQpO'#D_O%[QlO'#JvO##sQpO'#JvO##}QpO'#DmO#$`QpO'#DmO#&qQlO'#DmO#&xQ`O'#JuO#'QQ`O,5:WO#'VQ`O'#EtO#'eQ`O'#KUO#'mQ`O,5;_O#'rQpO'#DmO#(PQpO'#EVOOQ!0Lf,5:o,5:oO%[QlO,5:oO#(WQ`O,5:oO?YQ`O,5;YO!CUQpO,5;YO!C^QMhO,5;YO:dQMhO,5;YO#(`Q`O,5@bO#(eQ07dO,5:sOOQO-EPO$6^Q`O,5>POOQ[1G3i1G3iO`QlO1G3iOOQ[1G3o1G3oOOQ[1G3q1G3qO?TQ`O1G3sO$6cQlO1G3uO$:gQlO'#HtOOQ[1G3x1G3xO$:tQ`O'#HzO?YQ`O'#H|OOQ[1G4O1G4OO$:|QlO1G4OO9uQ!0LrO1G4UOOQ[1G4W1G4WOOQ!0Lb'#G_'#G_O9uQ!0LrO1G4YO9uQ!0LrO1G4[O$?TQ`O,5@bO!)[QlO,5;`O9eQ`O,5;`O?YQ`O,5:XO!)[QlO,5:XO!CUQpO,5:XO$?YQ?MtO,5:XOOQO,5;`,5;`O$?dQpO'#IeO$?zQ`O,5@aOOQ!0Lf1G/r1G/rO$@SQpO'#IkO$@^Q`O,5@pOOQ!0Lb1G0y1G0yO#$`QpO,5:XOOQO'#Ig'#IgO$@fQpO,5:qOOQ!0Ln,5:q,5:qO#(ZQ`O1G0ZOOQ!0Lf1G0Z1G0ZO%[QlO1G0ZOOQ!0Lf1G0t1G0tO?YQ`O1G0tO!CUQpO1G0tO!C^QMhO1G0tOOQ!0Lb1G5|1G5|O!ByQ!0LrO1G0^OOQO1G0m1G0mO%[QlO1G0mO$@mQ!0LrO1G0mO$@xQ!0LrO1G0mO!CUQpO1G0^ODWQpO1G0^O$AWQ!0LrO1G0mOOQO1G0^1G0^O$AlQ!0MxO1G0mPOOO-E<[-E<[POOO1G.h1G.hOOOO1G/i1G/iO$AvQ!bO,5QQpO,5@}OOQ!0Lb1G3c1G3cOOQ[7+$V7+$VO@zQ`O7+$VO9uQ!0LrO7+$VO%>]Q`O7+$VO%[QlO1G6lO%[QlO1G6mO%>bQ!0LrO1G6lO%>lQlO1G3kO%>sQ`O1G3kO%>xQlO1G3kOOQ[7+)T7+)TO9uQ!0LrO7+)_O`QlO7+)aOOQ['#Kh'#KhOOQ['#JS'#JSO%?PQlO,5>`OOQ[,5>`,5>`O%[QlO'#HuO%?^Q`O'#HwOOQ[,5>f,5>fO9eQ`O,5>fOOQ[,5>h,5>hOOQ[7+)j7+)jOOQ[7+)p7+)pOOQ[7+)t7+)tOOQ[7+)v7+)vO%?cQpO1G5|O%?}Q?MtO1G0zO%@XQ`O1G0zOOQO1G/s1G/sO%@dQ?MtO1G/sO?YQ`O1G/sO!)[QlO'#DmOOQO,5?P,5?POOQO-ERQ`O7+,WO&>WQ`O7+,XO%[QlO7+,WO%[QlO7+,XOOQ[7+)V7+)VO&>]Q`O7+)VO&>bQlO7+)VO&>iQ`O7+)VOOQ[<nQ`O,5>aOOQ[,5>c,5>cO&>sQ`O1G4QO9eQ`O7+&fO!)[QlO7+&fOOQO7+%_7+%_O&>xQ?MtO1G6ZO?YQ`O7+%_OOQ!0Lf<yQ?MvO,5?aO'@|Q?MvO,5?cO'CPQ?MvO7+'|O'DuQMjOG27TOOQO<VO!l$xO#jROe!iOpkOrPO(T)]O(VTO(YUO(aVO(o[O~O!]$_Oa$qa'z$qa'w$qa!k$qa!Y$qa!_$qa%i$qa!g$qa~Ol)dO~P!&zOh%VOp%WOr%XOs$tOt$tOz%YO|%ZO!O%]O!S${O!_$|O!i%bO!l$xO#j%cO$W%`O$t%^O$v%_O$y%aO(T(vO(VTO(YUO(a$uO(y$}O(z%PO~Og(pP~P!,TO!Q)iO!g)hO!_$^X$Z$^X$]$^X$_$^X$f$^X~O!g)hO!_({X$Z({X$]({X$_({X$f({X~O!Q)iO~P!.^O!Q)iO!_({X$Z({X$]({X$_({X$f({X~O!_)kO$Z)oO$])jO$_)jO$f)pO~O![)sO~P!)[O$]$hO$_$gO$f)wO~On$zX!Q$zX#S$zX'y$zX(y$zX(z$zX~OgmXg$zXnmX!]mX#`mX~P!0SOx)yO(b)zO(c)|O~On*VO!Q*OO'y*PO(y$}O(z%PO~Og)}O~P!1WOg*WO~Oh%VOr%XOs$tOt$tOz%YO|%ZO!OVO!l$xO#jVO!l$xO#jROe!iOpkOrPO(VTO(YUO(aVO(o[O~O(T=QO~P#$qO!]-]O!^(iX~O!^-_O~O!g-VO#`-UO!]#hX!^#hX~O!]-`O!^(xX~O!^-bO~O!c-cO!d-cO(U!lO~P#$`O!^-fO~P'_On-iO!_'`O~O!Y-nO~Os!{a!b!{a!c!{a!d!{a#T!{a#U!{a#V!{a#W!{a#X!{a#[!{a#]!{a(U!{a(V!{a(Y!{a(e!{a(o!{a~P!#vO!p-sO#`-qO~PChO!c-uO!d-uO(U!lO~PDWOa%nO#`-qO'z%nO~Oa%nO!g#vO#`-qO'z%nO~Oa%nO!g#vO!p-sO#`-qO'z%nO(r'pO~O(P'xO(Q'xO(R-zO~Ov-{O~O!Y'Wa!]'Wa~P!:tO![.PO!Y'WX!]'WX~P%[O!](VO!Y(ha~O!Y(ha~PHRO!](^O!Y(va~O!S%hO![.TO!_%iO(T%gO!Y'^X!]'^X~O#`.VO!](ta!k(taa(ta'z(ta~O!g#vO~P#,wO!](jO!k(sa~O!S%hO!_%iO#j.ZO(T%gO~Op.`O!S%hO![.]O!_%iO!|]O#i._O#j.]O(T%gO!]'aX!k'aX~OR.dO!l#xO~Oh%VOn.gO!_'`O%i.fO~Oa#ci!]#ci'z#ci'w#ci!Y#ci!k#civ#ci!_#ci%i#ci!g#ci~P!:tOn>]O!Q*OO'y*PO(y$}O(z%PO~O#k#_aa#_a#`#_a'z#_a!]#_a!k#_a!_#_a!Y#_a~P#/sO#k(`XP(`XR(`X[(`Xa(`Xj(`Xr(`X!S(`X!l(`X!p(`X#R(`X#n(`X#o(`X#p(`X#q(`X#r(`X#s(`X#t(`X#u(`X#v(`X#x(`X#z(`X#{(`X'z(`X(a(`X(r(`X!k(`X!Y(`X'w(`Xv(`X!_(`X%i(`X!g(`X~P!6kO!].tO!k(kX~P!:tO!k.wO~O!Y.yO~OP$[OR#zO!Q#yO!S#{O!l#xO!p$[O(aVO[#mia#mij#mir#mi!]#mi#R#mi#o#mi#p#mi#q#mi#r#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#n#mi~P#3cO#n$OO~P#3cOP$[OR#zOr$aO!Q#yO!S#{O!l#xO!p$[O#n$OO#o$PO#p$PO#q$PO(aVO[#mia#mij#mi!]#mi#R#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#r#mi~P#6QO#r$QO~P#6QOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO(aVOa#mi!]#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#v#mi~P#8oOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO(aVO(z#}Oa#mi!]#mi#z#mi#{#mi'z#mi(r#mi(y#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#x$UO~P#;VO#x#mi~P#;VO#v$SO~P#8oOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO#x$UO(aVO(y#|O(z#}Oa#mi!]#mi#{#mi'z#mi(r#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#z#mi~P#={O#z$WO~P#={OP]XR]X[]Xj]Xr]X!Q]X!S]X!l]X!p]X#R]X#S]X#`]X#kfX#n]X#o]X#p]X#q]X#r]X#s]X#t]X#u]X#v]X#x]X#z]X#{]X$Q]X(a]X(r]X(y]X(z]X!]]X!^]X~O$O]X~P#@jOP$[OR#zO[]O!Q*OO'y*PO(y$}O(z%POP#miR#mi!S#mi!l#mi!p#mi#n#mi#o#mi#p#mi#q#mi(a#mi~P#EyO!]/POg(pX~P!1WOg/RO~Oa$Pi!]$Pi'z$Pi'w$Pi!Y$Pi!k$Piv$Pi!_$Pi%i$Pi!g$Pi~P!:tO$]/SO$_/SO~O$]/TO$_/TO~O!g)hO#`/UO!_$cX$Z$cX$]$cX$_$cX$f$cX~O![/VO~O!_)kO$Z/XO$])jO$_)jO$f/YO~O!]VO!l$xO#j^O!Q*OO'y*PO(y$}O(z%POP#miR#mi!S#mi!l#mi!p#mi#n#mi#o#mi#p#mi#q#mi(a#mi~P&,QO#S$dOP(`XR(`X[(`Xj(`Xn(`Xr(`X!Q(`X!S(`X!l(`X!p(`X#R(`X#n(`X#o(`X#p(`X#q(`X#r(`X#s(`X#t(`X#u(`X#v(`X#x(`X#z(`X#{(`X$O(`X'y(`X(a(`X(r(`X(y(`X(z(`X!](`X!^(`X~O$O$Pi!]$Pi!^$Pi~P#BwO$O!ri!^!ri~P$+oOg']a!]']a~P!1WO!^7nO~O!]'da!^'da~P#BwO!Y7oO~P#/sO!g#vO(r'pO!]'ea!k'ea~O!]/pO!k)Oi~O!]/pO!g#vO!k)Oi~Og$|q!]$|q#`$|q$O$|q~P!1WO!Y'ga!]'ga~P#/sO!g7vO~O!]/yO!Y)Pi~P#/sO!]/yO!Y)Pi~O!Y7yO~Oh%VOr8OO!l%eO(r'pO~Oj8QO!g#vO~Or8TO!g#vO(r'pO~O!Q*OO'y*PO(z%POn'ja(y'ja!]'ja#`'ja~Og'ja$O'ja~P&5RO!Q*OO'y*POn'la(y'la(z'la!]'la#`'la~Og'la$O'la~P&5tOg(_q!](_q~P!1WO#`8VOg(_q!](_q~P!1WO!Y8WO~Og%Oq!]%Oq#`%Oq$O%Oq~P!1WOa$oy!]$oy'z$oy'w$oy!Y$oy!k$oyv$oy!_$oy%i$oy!g$oy~P!:tO!g6rO~O!]5[O!_)Qa~O!_'`OP$TaR$Ta[$Taj$Tar$Ta!Q$Ta!S$Ta!]$Ta!l$Ta!p$Ta#R$Ta#n$Ta#o$Ta#p$Ta#q$Ta#r$Ta#s$Ta#t$Ta#u$Ta#v$Ta#x$Ta#z$Ta#{$Ta(a$Ta(r$Ta(y$Ta(z$Ta~O%i7WO~P&8fO%^8[Oa%[i!_%[i'z%[i!]%[i~Oa#cy!]#cy'z#cy'w#cy!Y#cy!k#cyv#cy!_#cy%i#cy!g#cy~P!:tO[8^O~Ob8`O(T+qO(VTO(YUO~O!]1TO!^)Xi~O`8dO~O(e(|O!]'pX!^'pX~O!]5uO!^)Ua~O!^8nO~P%;eO(o!sO~P$&YO#[8oO~O!_1oO~O!_1oO%i8qO~On8tO!_1oO%i8qO~O[8yO!]'sa!^'sa~O!]1zO!^)Vi~O!k8}O~O!k9OO~O!k9RO~O!k9RO~P%[Oa9TO~O!g9UO~O!k9VO~O!](wi!^(wi~P#BwOa%nO#`9_O'z%nO~O!](ty!k(tya(ty'z(ty~P!:tO!](jO!k(sy~O%i9bO~P&8fO!_'`O%i9bO~O#k$|qP$|qR$|q[$|qa$|qj$|qr$|q!S$|q!]$|q!l$|q!p$|q#R$|q#n$|q#o$|q#p$|q#q$|q#r$|q#s$|q#t$|q#u$|q#v$|q#x$|q#z$|q#{$|q'z$|q(a$|q(r$|q!k$|q!Y$|q'w$|q#`$|qv$|q!_$|q%i$|q!g$|q~P#/sO#k'jaP'jaR'ja['jaa'jaj'jar'ja!S'ja!l'ja!p'ja#R'ja#n'ja#o'ja#p'ja#q'ja#r'ja#s'ja#t'ja#u'ja#v'ja#x'ja#z'ja#{'ja'z'ja(a'ja(r'ja!k'ja!Y'ja'w'jav'ja!_'ja%i'ja!g'ja~P&5RO#k'laP'laR'la['laa'laj'lar'la!S'la!l'la!p'la#R'la#n'la#o'la#p'la#q'la#r'la#s'la#t'la#u'la#v'la#x'la#z'la#{'la'z'la(a'la(r'la!k'la!Y'la'w'lav'la!_'la%i'la!g'la~P&5tO#k%OqP%OqR%Oq[%Oqa%Oqj%Oqr%Oq!S%Oq!]%Oq!l%Oq!p%Oq#R%Oq#n%Oq#o%Oq#p%Oq#q%Oq#r%Oq#s%Oq#t%Oq#u%Oq#v%Oq#x%Oq#z%Oq#{%Oq'z%Oq(a%Oq(r%Oq!k%Oq!Y%Oq'w%Oq#`%Oqv%Oq!_%Oq%i%Oq!g%Oq~P#/sO!]'Yi!k'Yi~P!:tO$O#cq!]#cq!^#cq~P#BwO(y$}OP%aaR%aa[%aaj%aar%aa!S%aa!l%aa!p%aa#R%aa#n%aa#o%aa#p%aa#q%aa#r%aa#s%aa#t%aa#u%aa#v%aa#x%aa#z%aa#{%aa$O%aa(a%aa(r%aa!]%aa!^%aa~On%aa!Q%aa'y%aa(z%aa~P&IyO(z%POP%caR%ca[%caj%car%ca!S%ca!l%ca!p%ca#R%ca#n%ca#o%ca#p%ca#q%ca#r%ca#s%ca#t%ca#u%ca#v%ca#x%ca#z%ca#{%ca$O%ca(a%ca(r%ca!]%ca!^%ca~On%ca!Q%ca'y%ca(y%ca~P&LQOn>^O!Q*OO'y*PO(z%PO~P&IyOn>^O!Q*OO'y*PO(y$}O~P&LQOR0kO!Q0kO!S0lO#S$dOP}a[}aj}an}ar}a!l}a!p}a#R}a#n}a#o}a#p}a#q}a#r}a#s}a#t}a#u}a#v}a#x}a#z}a#{}a$O}a'y}a(a}a(r}a(y}a(z}a!]}a!^}a~O!Q*OO'y*POP$saR$sa[$saj$san$sar$sa!S$sa!l$sa!p$sa#R$sa#n$sa#o$sa#p$sa#q$sa#r$sa#s$sa#t$sa#u$sa#v$sa#x$sa#z$sa#{$sa$O$sa(a$sa(r$sa(y$sa(z$sa!]$sa!^$sa~O!Q*OO'y*POP$uaR$ua[$uaj$uan$uar$ua!S$ua!l$ua!p$ua#R$ua#n$ua#o$ua#p$ua#q$ua#r$ua#s$ua#t$ua#u$ua#v$ua#x$ua#z$ua#{$ua$O$ua(a$ua(r$ua(y$ua(z$ua!]$ua!^$ua~On>^O!Q*OO'y*PO(y$}O(z%PO~OP%TaR%Ta[%Taj%Tar%Ta!S%Ta!l%Ta!p%Ta#R%Ta#n%Ta#o%Ta#p%Ta#q%Ta#r%Ta#s%Ta#t%Ta#u%Ta#v%Ta#x%Ta#z%Ta#{%Ta$O%Ta(a%Ta(r%Ta!]%Ta!^%Ta~P''VO$O$mq!]$mq!^$mq~P#BwO$O$oq!]$oq!^$oq~P#BwO!^9oO~O$O9pO~P!1WO!g#vO!]'ei!k'ei~O!g#vO(r'pO!]'ei!k'ei~O!]/pO!k)Oq~O!Y'gi!]'gi~P#/sO!]/yO!Y)Pq~Or9wO!g#vO(r'pO~O[9yO!Y9xO~P#/sO!Y9xO~Oj:PO!g#vO~Og(_y!](_y~P!1WO!]'na!_'na~P#/sOa%[q!_%[q'z%[q!]%[q~P#/sO[:UO~O!]1TO!^)Xq~O`:YO~O#`:ZO!]'pa!^'pa~O!]5uO!^)Ui~P#BwO!S:]O~O!_1oO%i:`O~O(VTO(YUO(e:eO~O!]1zO!^)Vq~O!k:hO~O!k:iO~O!k:jO~O!k:jO~P%[O#`:mO!]#hy!^#hy~O!]#hy!^#hy~P#BwO%i:rO~P&8fO!_'`O%i:rO~O$O#|y!]#|y!^#|y~P#BwOP$|iR$|i[$|ij$|ir$|i!S$|i!l$|i!p$|i#R$|i#n$|i#o$|i#p$|i#q$|i#r$|i#s$|i#t$|i#u$|i#v$|i#x$|i#z$|i#{$|i$O$|i(a$|i(r$|i!]$|i!^$|i~P''VO!Q*OO'y*PO(z%POP'iaR'ia['iaj'ian'iar'ia!S'ia!l'ia!p'ia#R'ia#n'ia#o'ia#p'ia#q'ia#r'ia#s'ia#t'ia#u'ia#v'ia#x'ia#z'ia#{'ia$O'ia(a'ia(r'ia(y'ia!]'ia!^'ia~O!Q*OO'y*POP'kaR'ka['kaj'kan'kar'ka!S'ka!l'ka!p'ka#R'ka#n'ka#o'ka#p'ka#q'ka#r'ka#s'ka#t'ka#u'ka#v'ka#x'ka#z'ka#{'ka$O'ka(a'ka(r'ka(y'ka(z'ka!]'ka!^'ka~O(y$}OP%aiR%ai[%aij%ain%air%ai!Q%ai!S%ai!l%ai!p%ai#R%ai#n%ai#o%ai#p%ai#q%ai#r%ai#s%ai#t%ai#u%ai#v%ai#x%ai#z%ai#{%ai$O%ai'y%ai(a%ai(r%ai(z%ai!]%ai!^%ai~O(z%POP%ciR%ci[%cij%cin%cir%ci!Q%ci!S%ci!l%ci!p%ci#R%ci#n%ci#o%ci#p%ci#q%ci#r%ci#s%ci#t%ci#u%ci#v%ci#x%ci#z%ci#{%ci$O%ci'y%ci(a%ci(r%ci(y%ci!]%ci!^%ci~O$O$oy!]$oy!^$oy~P#BwO$O#cy!]#cy!^#cy~P#BwO!g#vO!]'eq!k'eq~O!]/pO!k)Oy~O!Y'gq!]'gq~P#/sOr:|O!g#vO(r'pO~O[;QO!Y;PO~P#/sO!Y;PO~Og(_!R!](_!R~P!1WOa%[y!_%[y'z%[y!]%[y~P#/sO!]1TO!^)Xy~O!]5uO!^)Uq~O(T;XO~O!_1oO%i;[O~O!k;_O~O%i;dO~P&8fOP$|qR$|q[$|qj$|qr$|q!S$|q!l$|q!p$|q#R$|q#n$|q#o$|q#p$|q#q$|q#r$|q#s$|q#t$|q#u$|q#v$|q#x$|q#z$|q#{$|q$O$|q(a$|q(r$|q!]$|q!^$|q~P''VO!Q*OO'y*PO(z%POP'jaR'ja['jaj'jan'jar'ja!S'ja!l'ja!p'ja#R'ja#n'ja#o'ja#p'ja#q'ja#r'ja#s'ja#t'ja#u'ja#v'ja#x'ja#z'ja#{'ja$O'ja(a'ja(r'ja(y'ja!]'ja!^'ja~O!Q*OO'y*POP'laR'la['laj'lan'lar'la!S'la!l'la!p'la#R'la#n'la#o'la#p'la#q'la#r'la#s'la#t'la#u'la#v'la#x'la#z'la#{'la$O'la(a'la(r'la(y'la(z'la!]'la!^'la~OP%OqR%Oq[%Oqj%Oqr%Oq!S%Oq!l%Oq!p%Oq#R%Oq#n%Oq#o%Oq#p%Oq#q%Oq#r%Oq#s%Oq#t%Oq#u%Oq#v%Oq#x%Oq#z%Oq#{%Oq$O%Oq(a%Oq(r%Oq!]%Oq!^%Oq~P''VOg%e!Z!]%e!Z#`%e!Z$O%e!Z~P!1WO!Y;hO~P#/sOr;iO!g#vO(r'pO~O[;kO!Y;hO~P#/sO!]'pq!^'pq~P#BwO!]#h!Z!^#h!Z~P#BwO#k%e!ZP%e!ZR%e!Z[%e!Za%e!Zj%e!Zr%e!Z!S%e!Z!]%e!Z!l%e!Z!p%e!Z#R%e!Z#n%e!Z#o%e!Z#p%e!Z#q%e!Z#r%e!Z#s%e!Z#t%e!Z#u%e!Z#v%e!Z#x%e!Z#z%e!Z#{%e!Z'z%e!Z(a%e!Z(r%e!Z!k%e!Z!Y%e!Z'w%e!Z#`%e!Zv%e!Z!_%e!Z%i%e!Z!g%e!Z~P#/sOr;tO!g#vO(r'pO~O!Y;uO~P#/sOr;|O!g#vO(r'pO~O!Y;}O~P#/sOP%e!ZR%e!Z[%e!Zj%e!Zr%e!Z!S%e!Z!l%e!Z!p%e!Z#R%e!Z#n%e!Z#o%e!Z#p%e!Z#q%e!Z#r%e!Z#s%e!Z#t%e!Z#u%e!Z#v%e!Z#x%e!Z#z%e!Z#{%e!Z$O%e!Z(a%e!Z(r%e!Z!]%e!Z!^%e!Z~P''VOrROe!iOpkOrPO(T)]O(VTO(YUO(aVO(o[O~O!]WO!l$xO#jgPPP!>oI[PPPPPPPPP!BOP!C]PPI[!DnPI[PI[I[I[I[I[PI[!FQP!I[P!LbP!Lf!Lp!Lt!LtP!IXP!Lx!LxP#!OP#!SI[PI[#!Y#%_CjA^PA^PA^A^P#&lA^A^#)OA^#+vA^#.SA^A^#.r#1W#1W#1]#1f#1W#1qPP#1WPA^#2ZA^#6YA^A^6mPPP#:_PPP#:x#:xP#:xP#;`#:xPP#;fP#;]P#;]#;y#;]#P#>V#>]#>k#>q#>{#?R#?]#?c#?s#?y#@k#@}#AT#AZ#Ai#BO#Cs#DR#DY#Et#FS#Gt#HS#HY#H`#Hf#Hp#Hv#H|#IW#Ij#IpPPPPPPPPPPP#IvPPPPPPP#Jk#Mx$ b$ i$ qPPP$']P$'f$*_$0x$0{$1O$1}$2Q$2X$2aP$2g$2jP$3W$3[$4S$5b$5g$5}PP$6S$6Y$6^$6a$6e$6i$7e$7|$8e$8i$8l$8o$8y$8|$9Q$9UR!|RoqOXst!Z#d%m&r&t&u&w,s,x2[2_Y!vQ'`-e1o5{Q%tvQ%|yQ&T|Q&j!VS'W!e-]Q'f!iS'l!r!yU*k$|*Z*oQ+o%}S+|&V&WQ,d&dQ-c'_Q-m'gQ-u'mQ0[*qQ1b,OQ1y,eR<{SU+P%]S!S!nQ!r!v!y!z$|'W'_'`'l'm'n*k*o*q*r-]-c-e-u0[0_1o5{5}%[$ti#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;kP>X>Y>]>^Q&X|Q'U!eS'[%i-`Q+t&PQ,P&WQ,f&gQ0n+SQ1Y+uQ1_+{Q2Q,jQ2R,kQ5f1TQ5o1aQ6[1zQ6_1|Q6`2PQ8`5gQ8c5lQ8|6bQ:X8dQ:f8yQ;V:YR<}*ZrnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_R,h&k&z^OPXYstuvwz!Z!`!g!j!o#S#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'b'r(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mR>S[#]WZ#W#Z'X(T!b%jm#h#i#l$x%e%h(^(h(i(j*Y*^*b+Z+[+^,o-V.T.Z.[.]._/m/p2d3[3]4a6r7TQ%wxQ%{yW&Q|&V&W,OQ&_!TQ'c!hQ'e!iQ(q#sS+n%|%}Q+r&PQ,_&bQ,c&dS-l'f'gQ.i(rQ1R+oQ1X+uQ1Z+vQ1^+zQ1t,`S1x,d,eQ2|-mQ5e1TQ5i1WQ5n1`Q6Z1yQ8_5gQ8b5kQ8f5pQ:T8^R;T:U!U$zi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y!^%yy!i!u%{%|%}'V'e'f'g'k'u*j+n+o-Y-l-m-t0R0U1R2u2|3T4r4s4v7}9{Q+h%wQ,T&[Q,W&]Q,b&dQ.h(qQ1s,_U1w,c,d,eQ3e.iQ6U1tS6Y1x1yQ8x6Z#f>T#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^o>UPS&[!Q&iQ&]!RQ&^!SU*}%[%d=sR,R&Y%]%Si#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;kP>X>Y>]>^T)z$u){V+P%]S$i$^c#Y#e%q%s%u(S(Y(t(y)R)S)T)U)V)W)X)Y)Z)[)^)`)b)g)q+d+x-Z-x-}.S.U.s.v.z.|.}/O/b0p2k2n3O3V3k3p3q3r3s3t3u3v3w3x3y3z3{3|4P4Q4X5X5c6u6{7Q7a7b7k7l8k9X9]9g9m9n:o;W;`SQ'Y!eR2q-]!W!nQ!e!r!v!y!z$|'W'_'`'l'm'n*Z*k*o*q*r-]-c-e-u0[0_1o5{5}R1l,ZnqOXst!Z#d%m&r&t&u&w,s,x2[2_Q&y!^Q'v!xS(s#u<^Q+l%zQ,]&_Q,^&aQ-j'dQ-w'oS.r(x=PS0q+X=ZQ1P+mQ1n,[Q2c,zQ2e,{Q2m-WQ2z-kQ2}-oS5Y0r=eQ5a1QS5d1S=fQ6t2oQ6x2{Q6}3SQ8]5bQ9Y6vQ9Z6yQ9^7OR:l9V$d$]c#Y#e%s%u(S(Y(t(y)R)S)T)U)V)W)X)Y)Z)[)^)`)b)g)q+d+x-Z-x-}.S.U.s.v.z.}/O/b0p2k2n3O3V3k3p3q3r3s3t3u3v3w3x3y3z3{3|4P4Q4X5X5c6u6{7Q7a7b7k7l8k9X9]9g9m9n:o;W;`SS#q]SU$fd)_,mS(p#p'iU*v%R(w4OU0m+O.n7gQ5^0xQ7V3`Q9d7YR:s9em!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}Q't!uS(f#g2US-s'k'wQ/s*]Q0R*jQ3U-vQ4f/tQ4r0TQ4s0UQ4x0^Q7r4`S7}4t4vS8R4y4{Q9r7sQ9v7yQ9{8OQ:Q8TS:{9w9xS;g:|;PS;s;h;iS;{;t;uSSR=o>R%^bOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_Q%fj!^%xy!i!u%{%|%}'V'e'f'g'k'u*j+n+o-Y-l-m-t0R0U1R2u2|3T4r4s4v7}9{S&Oz!jQ+k%yQ,a&dW1v,b,c,d,eU6X1w1x1yS8w6Y6ZQ:d8x!r=j$Z$n'X)s-U-X/V2p4T5w6s:Z:mSQ=t>QR=u>R%QeOPXYstuvw!Z!`!g!o#S#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_Y#bWZ#W#Z(T!b%jm#h#i#l$x%e%h(^(h(i(j*Y*^*b+Z+[+^,o-V.T.Z.[.]._/m/p2d3[3]4a6r7TQ,n&o!p=k$Z$n)s-U-X/V2p4T5w6s:Z:mSR=n'XU']!e%i*ZR2s-`%SdOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+],p,s,x-i-q.P.V.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3l4z6T6e6f6i6|8t9T9_!r)_$Z$n'X)s-U-X/V2p4T5w6s:Z:mSQ,m&oQ0x+gQ3`.gQ7Y3dR9e7[!b$Tc#Y%q(S(Y(t(y)Z)[)`)g+x-x-}.S.U.s.v/b0p3O3V3k3{5X5c6{7Q7a9]:oS)^)q-Z.|2k2n3p4P4X6u7b7k7l8k9X9g9m9n;W;`=vQ>X>ZR>Y>['QkOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mSS$oh$pR4U/U'XgOPWXYZhstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n$p%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/U/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mST$kf$qQ$ifS)j$l)nR)v$qT$jf$qT)l$l)n'XhOPWXYZhstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n$p%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/U/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mST$oh$pQ$rhR)u$p%^jOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_!s>Q$Z$n'X)s-U-X/V2p4T5w6s:Z:mS#glOPXZst!Z!`!o#S#d#o#{$n%m&k&n&o&r&t&u&w&{'T'b)O)s*i+]+g,p,s,x-i.g/V/n0]0l1r2S2T2V2X2[2_2a3d4T4z6T6e6f6i7[8t9T!U%Ri$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y#f(w#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^Q+T%aQ/c*Oo4OP>X>YQ*c$zU*l$|*Z*oQ+U%bQ0W*m#f=q#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^n=rTQ=x>UQ=y>VR=z>W!U%Ri$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y#f(w#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^o4OP>X>Y>]>^Q,U&]Q1h,WQ5s1gR8h5tV*n$|*Z*oU*n$|*Z*oT5z1o5{S0P*i/nQ4w0]T8S4z:]Q+j%xQ0V*lQ1O+kQ1u,aQ6W1vQ8v6XQ:c8wR;^:d!U%Oi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Yx*R$v)e*S*u+V/v0d0e4R4g5R5S5W7p8U:R:x=p=}>OS0`*t0a#f]>^nZ>[`=T3}7c7f7j9h:t:w;yS=_.l3iT=`7e9k!U%Qi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y|*T$v)e*U*t+V/g/v0d0e4R4g4|5R5S5W7p8U:R:x=p=}>OS0b*u0c#f]>^nZ>[d=V3}7d7e7j9h9i:t:u:w;yS=a.m3jT=b7f9lrnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_Q&f!UR,p&ornOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_R&f!UQ,Y&^R1d,RsnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_Q1p,_S6R1s1tU8p6P6Q6US:_8r8sS;Y:^:aQ;m;ZR;w;nQ&m!VR,i&iR6_1|R:f8yW&Q|&V&W,OR1Z+vQ&r!WR,s&sR,y&xT2],x2_R,}&yQ,|&yR2f,}Q'y!{R-y'ySsOtQ#dXT%ps#dQ#OTR'{#OQ#RUR'}#RQ){$uR/`){Q#UVR(Q#UQ#XWU(W#X(X.QQ(X#YR.Q(YQ-^'YR2r-^Q.u(yS3m.u3nR3n.vQ-e'`R2v-eY!rQ'`-e1o5{R'j!rQ/Q)eR4S/QU#_W%h*YU(_#_(`.RQ(`#`R.R(ZQ-a']R2t-at`OXst!V!Z#d%m&i&k&r&t&u&w,s,x2[2_S#hZ%eU#r`#h.[R.[(jQ(k#jQ.X(gW.a(k.X3X7RQ3X.YR7R3YQ)n$lR/W)nQ$phR)t$pQ$`cU)a$`-|O>Z>[Q/z*eU4k/z4m7xQ4m/|R7x4lS*o$|*ZR0Y*ox*S$v)e*t*u+V/v0d0e4R4g5R5S5W7p8U:R:x=p=}>O!d.j(u)c*[*e.l.m.q/_/k/|0v1e3h4[4h4l5r7]7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[U/h*S.j7ca7c3}7e7f7j9h:t:w;yQ0a*tQ3i.lU4}0a3i9kR9k7e|*U$v)e*t*u+V/g/v0d0e4R4g4|5R5S5W7p8U:R:x=p=}>O!h.k(u)c*[*e.l.m.q/_/k/|0v1e3f3h4[4h4l5r7]7^7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[U/j*U.k7de7d3}7e7f7j9h9i:t:u:w;yQ0c*uQ3j.mU5P0c3j9lR9l7fQ*z%UR0g*zQ5]0vR8Y5]Q+_%kR0u+_Q5v1jS8j5v:[R:[8kQ,[&_R1m,[Q5{1oR8m5{Q1{,fS6]1{8zR8z6_Q1U+rW5h1U5j8a:VQ5j1XQ8a5iR:V8bQ+w&QR1[+wQ2_,xR6m2_YrOXst#dQ&v!ZQ+a%mQ,r&rQ,t&tQ,u&uQ,w&wQ2Y,sS2],x2_R6l2[Q%opQ&z!_Q&}!aQ'P!bQ'R!cQ'q!uQ+`%lQ+l%zQ,Q&XQ,h&mQ-P&|W-p'k's't'wQ-w'oQ0X*nQ1P+mQ1c,PS2O,i,lQ2g-OQ2h-RQ2i-SQ2}-oW3P-r-s-v-xQ5a1QQ5m1_Q5q1eQ6V1uQ6a2QQ6k2ZU6z3O3R3UQ6}3SQ8]5bQ8e5oQ8g5rQ8l5zQ8u6WQ8{6`S9[6{7PQ9^7OQ:W8cQ:b8vQ:g8|Q:n9]Q;U:XQ;]:cQ;a:oQ;l;VR;o;^Q%zyQ'd!iQ'o!uU+m%{%|%}Q-W'VU-k'e'f'gS-o'k'uQ0Q*jS1Q+n+oQ2o-YS2{-l-mQ3S-tS4p0R0UQ5b1RQ6v2uQ6y2|Q7O3TU7{4r4s4vQ9z7}R;O9{S$wi>PR*{%VU%Ui%V>PR0f*yQ$viS(u#v+iS)c$b$cQ)e$dQ*[$xS*e${*YQ*t%OQ*u%QQ+Q%^Q+R%_Q+V%cQ.lPQ=}>XQ>O>YQ>Z>]R>[>^Q+O%]Q.nSR#[WR'Z!el!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}S'V!e-]U*j$|*Z*oS-Y'W'_S0U*k*qQ0^*rQ2u-cQ4v0[R4{0_R({#xQ!fQT-d'`-e]!qQ!r'`-e1o5{Q#p]R'i < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:380,context:vg,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,207,211,215,216,218,221,224,234,237,243,245,247,249,252,258,264,266,268,270,272,274,275,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,120,121,136,139,141,142,143,144,145,147,148,167,169,171,"Expression",-23,31,33,37,41,43,45,173,175,177,178,180,181,182,184,185,186,188,189,190,201,203,205,206,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"<",38,"InterpolationStart",56,"[",60,"{",73,"(",160,"JSXStartCloseTag"],["closedBy",-2,24,168,">",40,"InterpolationEnd",50,"]",61,"}",74,")",165,"JSXEndTag"]],propSources:[Ag],skippedNodes:[0,5,6,278],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q$4o#Q#R$5y#R#SEr#S#T$7W#T#o$8b#o#p$x#r#s$@U#s$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$I|Er$I|$I}$Dk$I}$JO$Dk$JO$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr(n%d_$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU(Z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$i&j(WpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU(WpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX(Wp(Z!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z07[+rq$i&j(Wp(Z!b'|0/lOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z07[.ST(X#S$i&j'}0/lO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c07[.n_$i&j(Wp(Z!b'}0/lOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)3p/x`$i&j!p),Q(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW1V`#v(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW2d_#v(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'At3l_(V':f$i&j(Z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k(^4r_$i&j(Z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k&z5vX$i&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q&z6jT$d`$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c`6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y`7bO$d``7eP;=`<%l6y&z7kP;=`<%l5q(^7w]$d`$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!r8uZ(Z!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p!r9oU$d`(Z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!r:UP;=`<%l8p(^:[P;=`<%l4k%9[:hh$i&j(Wp(Z!bOY%ZYZ&cZq%Zqr`#P#o`x!^=^!^!_?q!_#O=^#O#P>`#P#o=^#o#p?q#p;'S=^;'S;=`@h<%lO=^&n>gXWS$i&jOY>`YZ&cZ!^>`!^!_?S!_#o>`#o#p?S#p;'S>`;'S;=`?k<%lO>`S?XSWSOY?SZ;'S?S;'S;=`?e<%lO?SS?hP;=`<%l?S&n?nP;=`<%l>`!f?xWWS(Z!bOY?qZw?qwx?Sx#O?q#O#P?S#P;'S?q;'S;=`@b<%lO?q!f@eP;=`<%l?q(Q@kP;=`<%l=^'`@w]WS$i&j(WpOY@nYZ&cZr@nrs>`s!^@n!^!_Ap!_#O@n#O#P>`#P#o@n#o#pAp#p;'S@n;'S;=`Bg<%lO@ntAwWWS(WpOYApZrAprs?Ss#OAp#O#P?S#P;'SAp;'S;=`Ba<%lOAptBdP;=`<%lAp'`BjP;=`<%l@n#WBvYWS(Wp(Z!bOYBmZrBmrs?qswBmwxApx#OBm#O#P?S#P;'SBm;'S;=`Cf<%lOBm#WCiP;=`<%lBm(rCoP;=`<%l^!Q^$i&j!X7`OY!=yYZ&cZ!P!=y!P!Q!>|!Q!^!=y!^!_!@c!_!}!=y!}#O!CW#O#P!Dy#P#o!=y#o#p!@c#p;'S!=y;'S;=`!Ek<%lO!=y|#X#Z&c#Z#[!>|#[#]&c#]#^!>|#^#a&c#a#b!>|#b#g&c#g#h!>|#h#i&c#i#j!>|#j#k!>|#k#m&c#m#n!>|#n#o&c#p;'S&c;'S;=`&w<%lO&c7`!@hX!X7`OY!@cZ!P!@c!P!Q!AT!Q!}!@c!}#O!Ar#O#P!Bq#P;'S!@c;'S;=`!CQ<%lO!@c7`!AYW!X7`#W#X!AT#Z#[!AT#]#^!AT#a#b!AT#g#h!AT#i#j!AT#j#k!AT#m#n!AT7`!AuVOY!ArZ#O!Ar#O#P!B[#P#Q!@c#Q;'S!Ar;'S;=`!Bk<%lO!Ar7`!B_SOY!ArZ;'S!Ar;'S;=`!Bk<%lO!Ar7`!BnP;=`<%l!Ar7`!BtSOY!@cZ;'S!@c;'S;=`!CQ<%lO!@c7`!CTP;=`<%l!@c^!Ezl$i&j(Z!b!X7`OY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#W&}#W#X!Eq#X#Z&}#Z#[!Eq#[#]&}#]#^!Eq#^#a&}#a#b!Eq#b#g&}#g#h!Eq#h#i&}#i#j!Eq#j#k!Eq#k#m&}#m#n!Eq#n#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}8r!GyZ(Z!b!X7`OY!GrZw!Grwx!@cx!P!Gr!P!Q!Hl!Q!}!Gr!}#O!JU#O#P!Bq#P;'S!Gr;'S;=`!J|<%lO!Gr8r!Hse(Z!b!X7`OY'}Zw'}x#O'}#P#W'}#W#X!Hl#X#Z'}#Z#[!Hl#[#]'}#]#^!Hl#^#a'}#a#b!Hl#b#g'}#g#h!Hl#h#i'}#i#j!Hl#j#k!Hl#k#m'}#m#n!Hl#n;'S'};'S;=`(f<%lO'}8r!JZX(Z!bOY!JUZw!JUwx!Arx#O!JU#O#P!B[#P#Q!Gr#Q;'S!JU;'S;=`!Jv<%lO!JU8r!JyP;=`<%l!JU8r!KPP;=`<%l!Gr>^!KZ^$i&j(Z!bOY!KSYZ&cZw!KSwx!CWx!^!KS!^!_!JU!_#O!KS#O#P!DR#P#Q!^!LYP;=`<%l!KS>^!L`P;=`<%l!_#c#d#Bq#d#l%Z#l#m#Es#m#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#>j_$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#?rd$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#A]f$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Bzc$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Dbe$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#E|g$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Gpi$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z*)x#Il_!g$b$i&j$O)Lv(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)[#Jv_al$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z04f#LS^h#)`#R-v$?V_!^(CdvBr$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z?O$@a_!q7`$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z07[$Aq|$i&j(Wp(Z!b'|0/l$]#t(T,2j(e$I[OX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr07[$D|k$i&j(Wp(Z!b'}0/l$]#t(T,2j(e$I[OY%ZYZ&cZr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$g%Z$g;'SEr;'S;=`I|<%lOEr",tokenizers:[Xg,Cg,Rg,Zg,2,3,4,5,6,7,8,9,10,11,12,13,14,Tg,new Hr("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOx~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!U~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(c~~",141,340),new Hr("j~RQYZXz{^~^O(Q~~aP!P!Qd~iO(R~~",25,323)],topRules:{Script:[0,7],SingleExpression:[1,276],SingleClassItem:[2,277]},dialects:{jsx:0,ts:15175},dynamicPrecedences:{80:1,82:1,94:1,169:1,199:1},specialized:[{term:327,get:i=>qg[i]||-1},{term:343,get:i=>Wg[i]||-1},{term:95,get:i=>Mg[i]||-1}],tokenPrec:15201});let Ko=[],pf=[];(()=>{let i="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e>1;if(i=pf[n])e=n+1;else return!0;if(e==t)return!1}}function Th(i){return i>=127462&&i<=127487}const Xh=8205;function Eg(i,e,t=!0,n=!0){return(t?mf:jg)(i,e,n)}function mf(i,e,t){if(e==i.length)return e;e&&gf(i.charCodeAt(e))&&Qf(i.charCodeAt(e-1))&&e--;let n=Hs(i,e);for(e+=Ch(n);e=0&&Th(Hs(i,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function jg(i,e,t){for(;e>1;){let n=mf(i,e-2,t);if(n=56320&&i<57344}function Qf(i){return i>=55296&&i<56320}function Ch(i){return i<65536?1:2}class D{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=Vi(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),Ot.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Vi(this,e,t);let n=[];return this.decompose(e,t,n,0),Ot.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new gn(this),s=new gn(e);for(let o=t,l=t;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(l+=r.value.length,r.done||l>=n)return!0}}iter(e=1){return new gn(this,e)}iterRange(e,t=this.length){return new Sf(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new bf(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?D.empty:e.length<=32?new le(e):Ot.from(le.split(e,[]))}}class le extends D{constructor(e,t=Vg(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let s=0;;s++){let o=this.text[s],l=r+o.length;if((t?n:l)>=e)return new Yg(r,l,n,o);r=l+1,n++}}decompose(e,t,n,r){let s=e<=0&&t>=this.length?this:new le(Rh(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let o=n.pop(),l=zr(s.text,o.text.slice(),0,s.length);if(l.length<=32)n.push(new le(l,o.length+s.length));else{let a=l.length>>1;n.push(new le(l.slice(0,a)),new le(l.slice(a)))}}else n.push(s)}replace(e,t,n){if(!(n instanceof le))return super.replace(e,t,n);[e,t]=Vi(this,e,t);let r=zr(this.text,zr(n.text,Rh(this.text,0,e)),t),s=this.length+n.length-(t-e);return r.length<=32?new le(r,s):Ot.from(le.split(r,[]),s)}sliceString(e,t=this.length,n=` `){[e,t]=Vi(this,e,t);let r="";for(let s=0,o=0;s<=t&&oe&&o&&(r+=n),es&&(r+=l.slice(Math.max(0,e-s),t-s)),s=a+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],r=-1;for(let s of e)n.push(s),r+=s.length+1,n.length==32&&(t.push(new le(n,r)),n=[],r=-1);return r>-1&&t.push(new le(n,r)),t}}class Ot extends D{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,t,n,r){for(let s=0;;s++){let o=this.children[s],l=r+o.length,a=n+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,n,r);r=l+1,n=a+1}}decompose(e,t,n,r){for(let s=0,o=0;o<=t&&s=o){let h=r&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?n.push(l):l.decompose(e-o,t-o,n,h)}o=a+1}}replace(e,t,n){if([e,t]=Vi(this,e,t),n.lines=s&&t<=l){let a=o.replace(e-s,t-s,n),h=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>h>>6){let c=this.children.slice();return c[r]=a,new Ot(c,this.length-(t-e)+n.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n=` `){[e,t]=Vi(this,e,t);let r="";for(let s=0,o=0;se&&s&&(r+=n),eo&&(r+=l.sliceString(e-o,t-o,n)),o=a+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Ot))return 0;let n=0,[r,s,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,s+=t){if(r==o||s==l)return n;let a=this.children[r],h=e.children[s];if(a!=h)return n+a.scanIdentical(h,t);n+=a.length+1}}static from(e,t=e.reduce((n,r)=>n+r.length+1,-1)){let n=0;for(let u of e)n+=u.lines;if(n<32){let u=[];for(let d of e)d.flatten(u);return new le(u,t)}let r=Math.max(32,n>>5),s=r<<1,o=r>>1,l=[],a=0,h=-1,c=[];function O(u){let d;if(u.lines>s&&u instanceof Ot)for(let m of u.children)O(m);else u.lines>o&&(a>o||!a)?(f(),l.push(u)):u instanceof le&&a&&(d=c[c.length-1])instanceof le&&u.lines+d.lines<=32?(a+=u.lines,h+=u.length+1,c[c.length-1]=new le(d.text.concat(u.text),d.length+1+u.length)):(a+u.lines>r&&f(),a+=u.lines,h+=u.length+1,c.push(u))}function f(){a!=0&&(l.push(c.length==1?c[0]:Ot.from(c,h)),h=-1,a=c.length=0)}for(let u of e)O(u);return f(),l.length==1?l[0]:new Ot(l,t)}}D.empty=new le([""],0);function Vg(i){let e=-1;for(let t of i)e+=t.length+1;return e}function zr(i,e,t=0,n=1e9){for(let r=0,s=0,o=!0;s=t&&(a>n&&(l=l.slice(0,n-r)),r0?1:(e instanceof le?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],s=this.offsets[n],o=s>>1,l=r instanceof le?r.text.length:r.children.length;if(o==(t>0?l:0)){if(n==0)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=` `,this;e--}else if(r instanceof le){let a=r.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=r.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof le?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Sf{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new gn(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class bf{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(D.prototype[Symbol.iterator]=function(){return this.iter()},gn.prototype[Symbol.iterator]=Sf.prototype[Symbol.iterator]=bf.prototype[Symbol.iterator]=function(){return this});let Yg=class{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}};function Vi(i,e,t){return e=Math.max(0,Math.min(i.length,e)),[e,Math.max(e,Math.min(i.length,t))]}function de(i,e,t=!0,n=!0){return Eg(i,e,t,n)}function Lg(i){return i>=56320&&i<57344}function Dg(i){return i>=55296&&i<56320}function Re(i,e){let t=i.charCodeAt(e);if(!Dg(t)||e+1==i.length)return t;let n=i.charCodeAt(e+1);return Lg(n)?(t-55296<<10)+(n-56320)+65536:t}function oa(i){return i<=65535?String.fromCharCode(i):(i-=65536,String.fromCharCode((i>>10)+55296,(i&1023)+56320))}function ft(i){return i<65536?1:2}const Jo=/\r\n?|\n/;var Se=function(i){return i[i.Simple=0]="Simple",i[i.TrackDel=1]="TrackDel",i[i.TrackBefore=2]="TrackBefore",i[i.TrackAfter=3]="TrackAfter",i}(Se||(Se={}));class Qt{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return s+(e-r);s+=l}else{if(n!=Se.Simple&&h>=e&&(n==Se.TrackDel&&re||n==Se.TrackBefore&&re))return null;if(h>e||h==e&&t<0&&!l)return e==r||t<0?s:s+a;s+=a}r=h}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return s}touchesRange(e,t=e){for(let n=0,r=0;n=0&&r<=t&&l>=e)return rt?"cover":!0;r=l}return!1}toString(){let e="";for(let t=0;t=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Qt(e)}static create(e){return new Qt(e)}}class ce extends Qt{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return el(this,(t,n,r,s,o)=>e=e.replace(r,r+(n-t),o),!1),e}mapDesc(e,t=!1){return tl(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let r=0,s=0;r=0){t[r]=l,t[r+1]=o;let a=r>>1;for(;n.length0&&Bt(n,t,s.text),s.forward(c),l+=c}let h=e[o++];for(;l>1].toJSON()))}return e}static of(e,t,n){let r=[],s=[],o=0,l=null;function a(c=!1){if(!c&&!r.length)return;of||O<0||f>t)throw new RangeError(`Invalid change range ${O} to ${f} (in doc of length ${t})`);let d=u?typeof u=="string"?D.of(u.split(n||Jo)):u:D.empty,m=d.length;if(O==f&&m==0)return;Oo&&ke(r,O-o,-1),ke(r,f-O,m),Bt(s,r,d),o=f}}return h(e),a(!l),l}static empty(e){return new ce(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let r=0;rl&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;n.length=0&&t<=0&&t==i[r+1]?i[r]+=e:r>=0&&e==0&&i[r]==0?i[r+1]+=t:n?(i[r]+=e,i[r+1]+=t):i.push(e,t)}function Bt(i,e,t){if(t.length==0)return;let n=e.length-2>>1;if(n>1])),!(t||o==i.sections.length||i.sections[o+1]<0);)l=i.sections[o++],a=i.sections[o++];e(r,h,s,c,O),r=h,s=c}}}function tl(i,e,t,n=!1){let r=[],s=n?[]:null,o=new Xn(i),l=new Xn(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);ke(r,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let O=Math.min(c,l.len);h+=O,c-=O,l.forward(O)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||n.length>h),s.forward2(a),o.forward(a)}}}}class Xn{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?D.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?D.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Lt{constructor(e,t,n,r){this.from=e,this.to=t,this.flags=n,this.goalColumn=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,t=-1){let n,r;return this.empty?n=r=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),n==this.from&&r==this.to?this:new Lt(n,r,this.flags,this.goalColumn)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return b.range(e,t,void 0,void 0,n);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return b.range(this.anchor,r,void 0,void 0,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return b.range(e.anchor,e.head)}static create(e,t,n,r){return new Lt(e,t,n,r)}}class b{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:b.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;ne.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new b(e.ranges.map(t=>Lt.fromJSON(t)),e.main)}static single(e,t=e){return new b([b.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let n=0,r=0;rr.from-s.from),t=e.indexOf(n);for(let r=1;rs.head?b.range(a,l):b.range(l,a))}}return new b(e,t)}}function xf(i,e){for(let t of i.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let la=0;class C{constructor(e,t,n,r,s){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=la++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new C(e.combine||(t=>t),e.compareInput||((t,n)=>t===n),e.compare||(e.combine?(t,n)=>t===n:aa),!!e.static,e.enables)}of(e){return new _r([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new _r(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new _r(e,this,2,t)}from(e,t){return t||(t=n=>n),this.compute([e],n=>t(n.field(e)))}}function aa(i,e){return i==e||i.length==e.length&&i.every((t,n)=>t===e[n])}class _r{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=la++}dynamicSlot(e){var t;let n=this.value,r=this.facet.compareInput,s=this.id,o=e[s]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let O of this.dependencies)O=="doc"?a=!0:O=="selection"?h=!0:((t=e[O.id])!==null&&t!==void 0?t:1)&1||c.push(e[O.id]);return{create(O){return O.values[o]=n(O),1},update(O,f){if(a&&f.docChanged||h&&(f.docChanged||f.selection)||il(O,c)){let u=n(O);if(l?!Zh(u,O.values[o],r):!r(u,O.values[o]))return O.values[o]=u,1}return 0},reconfigure:(O,f)=>{let u,d=f.config.address[s];if(d!=null){let m=es(f,d);if(this.dependencies.every(g=>g instanceof C?f.facet(g)===O.facet(g):g instanceof ye?f.field(g,!1)==O.field(g,!1):!0)||(l?Zh(u=n(O),m,r):r(u=n(O),m)))return O.values[o]=m,0}else u=n(O);return O.values[o]=u,1}}}get extension(){return this}}function Zh(i,e,t){if(i.length!=e.length)return!1;for(let n=0;ni[a.id]),r=t.map(a=>a.type),s=n.filter(a=>!(a&1)),o=i[e.id]>>1;function l(a){let h=[];for(let c=0;cn===r),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(ur).find(n=>n.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:n=>(n.values[t]=this.create(n),1),update:(n,r)=>{let s=n.values[t],o=this.updateF(s,r);return this.compareF(s,o)?0:(n.values[t]=o,1)},reconfigure:(n,r)=>{let s=n.facet(ur),o=r.facet(ur),l;return(l=s.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(n.values[t]=l.create(n),1):r.config.address[this.id]!=null?(n.values[t]=r.field(this),0):(n.values[t]=this.create(n),1)}}}init(e){return[this,ur.of({field:this,create:e})]}get extension(){return this}}const ai={lowest:4,low:3,default:2,high:1,highest:0};function on(i){return e=>new kf(e,i)}const _t={highest:on(ai.highest),high:on(ai.high),default:on(ai.default),low:on(ai.low),lowest:on(ai.lowest)};class kf{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}}class Xs{of(e){return new nl(this,e)}reconfigure(e){return Xs.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class nl{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}}class Jr{constructor(e,t,n,r,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,n){let r=[],s=Object.create(null),o=new Map;for(let f of Gg(e,t,o))f instanceof ye?r.push(f):(s[f.facet.id]||(s[f.facet.id]=[])).push(f);let l=Object.create(null),a=[],h=[];for(let f of r)l[f.id]=h.length<<1,h.push(u=>f.slot(u));let c=n==null?void 0:n.config.facets;for(let f in s){let u=s[f],d=u[0].facet,m=c&&c[f]||[];if(u.every(g=>g.type==0))if(l[d.id]=a.length<<1|1,aa(m,u))a.push(n.facet(d));else{let g=d.combine(u.map(Q=>Q.value));a.push(n&&d.compare(g,n.facet(d))?n.facet(d):g)}else{for(let g of u)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=h.length<<1,h.push(Q=>g.dynamicSlot(Q)));l[d.id]=h.length<<1,h.push(g=>Bg(g,d,u))}}let O=h.map(f=>f(l));return new Jr(e,o,O,l,a,s)}}function Gg(i,e,t){let n=[[],[],[],[],[]],r=new Map;function s(o,l){let a=r.get(o);if(a!=null){if(a<=l)return;let h=n[a].indexOf(o);h>-1&&n[a].splice(h,1),o instanceof nl&&t.delete(o.compartment)}if(r.set(o,l),Array.isArray(o))for(let h of o)s(h,l);else if(o instanceof nl){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),s(h,l)}else if(o instanceof kf)s(o.inner,o.prec);else if(o instanceof ye)n[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof _r)n[l].push(o),o.facet.extensions&&s(o.facet.extensions,ai.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}).`);if(h==o)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,l)}}return s(i,ai.default),n.reduce((o,l)=>o.concat(l))}function Qn(i,e){if(e&1)return 2;let t=e>>1,n=i.status[t];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;i.status[t]=4;let r=i.computeSlot(i,i.config.dynamicSlots[t]);return i.status[t]=2|r}function es(i,e){return e&1?i.config.staticValues[e>>1]:i.values[e>>1]}const Pf=C.define(),rl=C.define({combine:i=>i.some(e=>e),static:!0}),$f=C.define({combine:i=>i.length?i[0]:void 0,static:!0}),wf=C.define(),vf=C.define(),Tf=C.define(),Xf=C.define({combine:i=>i.length?i[0]:!1});class bt{constructor(e,t){this.type=e,this.value=t}static define(){return new Ig}}class Ig{of(e){return new bt(this,e)}}class Ug{constructor(e){this.map=e}of(e){return new W(this,e)}}class W{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new W(this.type,t)}is(e){return this.type==e}static define(e={}){return new Ug(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let s=r.map(t);s&&n.push(s)}return n}}W.reconfigure=W.define();W.appendConfig=W.define();class he{constructor(e,t,n,r,s,o){this.startState=e,this.changes=t,this.selection=n,this.effects=r,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,n&&xf(n,t.newLength),s.some(l=>l.type==he.time)||(this.annotations=s.concat(he.time.of(Date.now())))}static create(e,t,n,r,s,o){return new he(e,t,n,r,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(he.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}he.time=bt.define();he.userEvent=bt.define();he.addToHistory=bt.define();he.remote=bt.define();function Ng(i,e){let t=[];for(let n=0,r=0;;){let s,o;if(n=i[n]))s=i[n++],o=i[n++];else if(r=0;r--){let s=n[r](i);s instanceof he?i=s:Array.isArray(s)&&s.length==1&&s[0]instanceof he?i=s[0]:i=Rf(e,Ai(s),!1)}return i}function Hg(i){let e=i.startState,t=e.facet(Tf),n=i;for(let r=t.length-1;r>=0;r--){let s=t[r](i);s&&Object.keys(s).length&&(n=Cf(n,sl(e,s,i.changes.newLength),!0))}return n==i?i:he.create(e,i.changes,i.selection,n.effects,n.annotations,n.scrollIntoView)}const Kg=[];function Ai(i){return i==null?Kg:Array.isArray(i)?i:[i]}var te=function(i){return i[i.Word=0]="Word",i[i.Space=1]="Space",i[i.Other=2]="Other",i}(te||(te={}));const Jg=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let ol;try{ol=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function e0(i){if(ol)return ol.test(i);for(let e=0;e"€"&&(t.toUpperCase()!=t.toLowerCase()||Jg.test(t)))return!0}return!1}function t0(i){return e=>{if(!/\S/.test(e))return te.Space;if(e0(e))return te.Word;for(let t=0;t-1)return te.Word;return te.Other}}class Y{constructor(e,t,n,r,s,o){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;lr.set(h,a)),t=null),r.set(l.value.compartment,l.value.extension)):l.is(W.reconfigure)?(t=null,n=l.value):l.is(W.appendConfig)&&(t=null,n=Ai(n).concat(l.value));let s;t?s=e.startState.values.slice():(t=Jr.resolve(n,r,this),s=new Y(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(rl)?e.newSelection:e.newSelection.asSingle();new Y(t,e.newDoc,o,s,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:b.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),s=[n.range],o=Ai(n.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return Y.create({doc:e.doc,selection:b.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=Jr.resolve(e.extensions||[],new Map),n=e.doc instanceof D?e.doc:D.of((e.doc||"").split(t.staticFacet(Y.lineSeparator)||Jo)),r=e.selection?e.selection instanceof b?e.selection:b.single(e.selection.anchor,e.selection.head):b.single(0);return xf(r,n.length),t.staticFacet(rl)||(r=r.asSingle()),new Y(t,n,r,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(Y.tabSize)}get lineBreak(){return this.facet(Y.lineSeparator)||` diff --git a/veadk/webui/assets/MarkdownPromptEditor-rtM9dn0I.js b/veadk/webui/assets/MarkdownPromptEditor-DH4ASeh5.js similarity index 99% rename from veadk/webui/assets/MarkdownPromptEditor-rtM9dn0I.js rename to veadk/webui/assets/MarkdownPromptEditor-DH4ASeh5.js index 5912f3d4..3ffc6d9b 100644 --- a/veadk/webui/assets/MarkdownPromptEditor-rtM9dn0I.js +++ b/veadk/webui/assets/MarkdownPromptEditor-DH4ASeh5.js @@ -1,4 +1,4 @@ -var i2=Object.defineProperty;var s2=(t,e,n)=>e in t?i2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var P=(t,e,n)=>s2(t,typeof e!="symbol"?e+"":e,n);import{i as Dd,j as l2,f as a2,g as Fc,y as c2,G as u2,s as f2,A as C,a as N,e as Fd,c as Hd,V as it,x as mn,E as Ns,C as Za,B as d2,b as Vd,u as rn,w as pl,h as tf,v as xr,F as Un,D as zt,d as fi,k as h2,t as L,z as nr,o as g2,m as p2,n as m2,l as y2,r as x2,p as _2,q as v2,R as qo}from"./index-D1GQjNfI.js";const C2={}.hasOwnProperty;function am(t,e){let n=-1,r;if(e.extensions)for(;++ne in t?i2(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var P=(t,e,n)=>s2(t,typeof e!="symbol"?e+"":e,n);import{i as Dd,j as l2,f as a2,g as Fc,y as c2,G as u2,s as f2,A as C,a as N,e as Fd,c as Hd,V as it,x as mn,E as Ns,C as Za,B as d2,b as Vd,u as rn,w as pl,h as tf,v as xr,F as Un,D as zt,d as fi,k as h2,t as L,z as nr,o as g2,m as p2,n as m2,l as y2,r as x2,p as _2,q as v2,R as qo}from"./index-BKcJcY8v.js";const C2={}.hasOwnProperty;function am(t,e){let n=-1,r;if(e.extensions)for(;++ni.map(i=>d[i]); -var K5=Object.defineProperty;var Y5=(e,t,n)=>t in e?K5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var j_=(e,t,n)=>Y5(e,typeof t!="symbol"?t+"":t,n);function W5(e,t){for(var n=0;nr[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var Hp=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function mf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var SC={exports:{}},ig={},TC={exports:{}},bt={};/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownPromptEditor-DH4ASeh5.js","assets/MarkdownPromptEditor-ZH9qtki0.css"])))=>i.map(i=>d[i]); +var V5=Object.defineProperty;var K5=(e,t,n)=>t in e?V5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var M_=(e,t,n)=>K5(e,typeof t!="symbol"?t+"":t,n);function Y5(e,t){for(var n=0;nr[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var $p=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function pf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var NC={exports:{}},sg={},SC={exports:{}},bt={};/** * @license React * react.production.min.js * @@ -7,7 +7,7 @@ var K5=Object.defineProperty;var Y5=(e,t,n)=>t in e?K5(e,t,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var gf=Symbol.for("react.element"),G5=Symbol.for("react.portal"),q5=Symbol.for("react.fragment"),X5=Symbol.for("react.strict_mode"),Q5=Symbol.for("react.profiler"),Z5=Symbol.for("react.provider"),J5=Symbol.for("react.context"),eB=Symbol.for("react.forward_ref"),tB=Symbol.for("react.suspense"),nB=Symbol.for("react.memo"),rB=Symbol.for("react.lazy"),D_=Symbol.iterator;function sB(e){return e===null||typeof e!="object"?null:(e=D_&&e[D_]||e["@@iterator"],typeof e=="function"?e:null)}var AC={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},CC=Object.assign,IC={};function $c(e,t,n){this.props=e,this.context=t,this.refs=IC,this.updater=n||AC}$c.prototype.isReactComponent={};$c.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};$c.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function OC(){}OC.prototype=$c.prototype;function tx(e,t,n){this.props=e,this.context=t,this.refs=IC,this.updater=n||AC}var nx=tx.prototype=new OC;nx.constructor=tx;CC(nx,$c.prototype);nx.isPureReactComponent=!0;var P_=Array.isArray,RC=Object.prototype.hasOwnProperty,rx={current:null},LC={key:!0,ref:!0,__self:!0,__source:!0};function MC(e,t,n){var r,s={},i=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(i=""+t.key),t)RC.call(t,r)&&!LC.hasOwnProperty(r)&&(s[r]=t[r]);var o=arguments.length-2;if(o===1)s.children=n;else if(1t in e?K5(e,t,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var cB=w,uB=Symbol.for("react.element"),dB=Symbol.for("react.fragment"),fB=Object.prototype.hasOwnProperty,hB=cB.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,pB={key:!0,ref:!0,__self:!0,__source:!0};function DC(e,t,n){var r,s={},i=null,a=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)fB.call(t,r)&&!pB.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)s[r]===void 0&&(s[r]=t[r]);return{$$typeof:uB,type:e,key:i,ref:a,props:s,_owner:hB.current}}ig.Fragment=dB;ig.jsx=DC;ig.jsxs=DC;SC.exports=ig;var l=SC.exports,Ib={},PC={exports:{}},is={},BC={exports:{}},FC={};/** + */var lB=w,cB=Symbol.for("react.element"),uB=Symbol.for("react.fragment"),dB=Object.prototype.hasOwnProperty,fB=lB.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,hB={key:!0,ref:!0,__self:!0,__source:!0};function jC(e,t,n){var r,s={},i=null,a=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)dB.call(t,r)&&!hB.hasOwnProperty(r)&&(s[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)s[r]===void 0&&(s[r]=t[r]);return{$$typeof:cB,type:e,key:i,ref:a,props:s,_owner:fB.current}}sg.Fragment=uB;sg.jsx=jC;sg.jsxs=jC;NC.exports=sg;var l=NC.exports,Cb={},DC={exports:{}},is={},PC={exports:{}},BC={};/** * @license React * scheduler.production.min.js * @@ -23,7 +23,7 @@ var K5=Object.defineProperty;var Y5=(e,t,n)=>t in e?K5(e,t,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(e){function t(R,F){var I=R.length;R.push(F);e:for(;0>>1,W=R[V];if(0>>1;Vs(G,I))res(ue,G)?(R[V]=ue,R[re]=I,V=re):(R[V]=G,R[ie]=I,V=ie);else if(res(ue,I))R[V]=ue,R[re]=I,V=re;else break e}}return F}function s(R,F){var I=R.sortIndex-F.sortIndex;return I!==0?I:R.id-F.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var a=Date,o=a.now();e.unstable_now=function(){return a.now()-o}}var c=[],u=[],d=1,f=null,h=3,p=!1,m=!1,y=!1,E=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(R){for(var F=n(u);F!==null;){if(F.callback===null)r(u);else if(F.startTime<=R)r(u),F.sortIndex=F.expirationTime,t(c,F);else break;F=n(u)}}function _(R){if(y=!1,b(R),!m)if(n(c)!==null)m=!0,T(k);else{var F=n(u);F!==null&&L(_,F.startTime-R)}}function k(R,F){m=!1,y&&(y=!1,g(S),S=-1),p=!0;var I=h;try{for(b(F),f=n(c);f!==null&&(!(f.expirationTime>F)||R&&!D());){var V=f.callback;if(typeof V=="function"){f.callback=null,h=f.priorityLevel;var W=V(f.expirationTime<=F);F=e.unstable_now(),typeof W=="function"?f.callback=W:f===n(c)&&r(c),b(F)}else r(c);f=n(c)}if(f!==null)var P=!0;else{var ie=n(u);ie!==null&&L(_,ie.startTime-F),P=!1}return P}finally{f=null,h=I,p=!1}}var N=!1,C=null,S=-1,A=5,O=-1;function D(){return!(e.unstable_now()-OR||125V?(R.sortIndex=I,t(u,R),n(c)===null&&R===n(u)&&(y?(g(S),S=-1):y=!0,L(_,I-V))):(R.sortIndex=W,t(c,R),m||p||(m=!0,T(k))),R},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(R){var F=h;return function(){var I=h;h=F;try{return R.apply(this,arguments)}finally{h=I}}}})(FC);BC.exports=FC;var mB=BC.exports;/** + */(function(e){function t(R,F){var I=R.length;R.push(F);e:for(;0>>1,W=R[V];if(0>>1;Vs(G,I))res(ue,G)?(R[V]=ue,R[re]=I,V=re):(R[V]=G,R[ie]=I,V=ie);else if(res(ue,I))R[V]=ue,R[re]=I,V=re;else break e}}return F}function s(R,F){var I=R.sortIndex-F.sortIndex;return I!==0?I:R.id-F.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var a=Date,o=a.now();e.unstable_now=function(){return a.now()-o}}var c=[],u=[],d=1,f=null,h=3,p=!1,m=!1,y=!1,E=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(R){for(var F=n(u);F!==null;){if(F.callback===null)r(u);else if(F.startTime<=R)r(u),F.sortIndex=F.expirationTime,t(c,F);else break;F=n(u)}}function _(R){if(y=!1,b(R),!m)if(n(c)!==null)m=!0,T(k);else{var F=n(u);F!==null&&L(_,F.startTime-R)}}function k(R,F){m=!1,y&&(y=!1,g(S),S=-1),p=!0;var I=h;try{for(b(F),f=n(c);f!==null&&(!(f.expirationTime>F)||R&&!D());){var V=f.callback;if(typeof V=="function"){f.callback=null,h=f.priorityLevel;var W=V(f.expirationTime<=F);F=e.unstable_now(),typeof W=="function"?f.callback=W:f===n(c)&&r(c),b(F)}else r(c);f=n(c)}if(f!==null)var P=!0;else{var ie=n(u);ie!==null&&L(_,ie.startTime-F),P=!1}return P}finally{f=null,h=I,p=!1}}var N=!1,C=null,S=-1,A=5,O=-1;function D(){return!(e.unstable_now()-OR||125V?(R.sortIndex=I,t(u,R),n(c)===null&&R===n(u)&&(y?(g(S),S=-1):y=!0,L(_,I-V))):(R.sortIndex=W,t(c,R),m||p||(m=!0,T(k))),R},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(R){var F=h;return function(){var I=h;h=F;try{return R.apply(this,arguments)}finally{h=I}}}})(BC);PC.exports=BC;var pB=PC.exports;/** * @license React * react-dom.production.min.js * @@ -31,14 +31,14 @@ var K5=Object.defineProperty;var Y5=(e,t,n)=>t in e?K5(e,t,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var gB=w,ns=mB;function Ae(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ob=Object.prototype.hasOwnProperty,yB=/^[: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]*$/,F_={},U_={};function bB(e){return Ob.call(U_,e)?!0:Ob.call(F_,e)?!1:yB.test(e)?U_[e]=!0:(F_[e]=!0,!1)}function EB(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function xB(e,t,n,r){if(t===null||typeof t>"u"||EB(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ir(e,t,n,r,s,i,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=a}var ir={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ir[e]=new Ir(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ir[t]=new Ir(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ir[e]=new Ir(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ir[e]=new Ir(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){ir[e]=new Ir(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ir[e]=new Ir(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ir[e]=new Ir(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ir[e]=new Ir(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ir[e]=new Ir(e,5,!1,e.toLowerCase(),null,!1,!1)});var ix=/[\-:]([a-z])/g;function ax(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(ix,ax);ir[t]=new Ir(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(ix,ax);ir[t]=new Ir(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(ix,ax);ir[t]=new Ir(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ir[e]=new Ir(e,1,!1,e.toLowerCase(),null,!1,!1)});ir.xlinkHref=new Ir("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ir[e]=new Ir(e,1,!1,e.toLowerCase(),null,!0,!0)});function ox(e,t,n,r){var s=ir.hasOwnProperty(t)?ir[t]:null;(s!==null?s.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ib=Object.prototype.hasOwnProperty,gB=/^[: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]*$/,B_={},F_={};function yB(e){return Ib.call(F_,e)?!0:Ib.call(B_,e)?!1:gB.test(e)?F_[e]=!0:(B_[e]=!0,!1)}function bB(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function EB(e,t,n,r){if(t===null||typeof t>"u"||bB(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ir(e,t,n,r,s,i,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=a}var ir={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ir[e]=new Ir(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ir[t]=new Ir(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ir[e]=new Ir(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ir[e]=new Ir(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){ir[e]=new Ir(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ir[e]=new Ir(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ir[e]=new Ir(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ir[e]=new Ir(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ir[e]=new Ir(e,5,!1,e.toLowerCase(),null,!1,!1)});var sx=/[\-:]([a-z])/g;function ix(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(sx,ix);ir[t]=new Ir(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(sx,ix);ir[t]=new Ir(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(sx,ix);ir[t]=new Ir(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ir[e]=new Ir(e,1,!1,e.toLowerCase(),null,!1,!1)});ir.xlinkHref=new Ir("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ir[e]=new Ir(e,1,!1,e.toLowerCase(),null,!0,!0)});function ax(e,t,n,r){var s=ir.hasOwnProperty(t)?ir[t]:null;(s!==null?s.type!==0:r||!(2o||s[a]!==i[o]){var c=` -`+s[a].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=a&&0<=o);break}}}finally{M0=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ru(e):""}function wB(e){switch(e.tag){case 5:return Ru(e.type);case 16:return Ru("Lazy");case 13:return Ru("Suspense");case 19:return Ru("SuspenseList");case 0:case 2:case 15:return e=j0(e.type,!1),e;case 11:return e=j0(e.type.render,!1),e;case 1:return e=j0(e.type,!0),e;default:return""}}function jb(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Nl:return"Fragment";case kl:return"Portal";case Rb:return"Profiler";case lx:return"StrictMode";case Lb:return"Suspense";case Mb:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case HC:return(e.displayName||"Context")+".Consumer";case $C:return(e._context.displayName||"Context")+".Provider";case cx:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ux:return t=e.displayName||null,t!==null?t:jb(e.type)||"Memo";case ga:t=e._payload,e=e._init;try{return jb(e(t))}catch{}}return null}function vB(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return jb(t);case 8:return t===lx?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Ba(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function VC(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function _B(e){var t=VC(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(a){r=""+a,i.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function dh(e){e._valueTracker||(e._valueTracker=_B(e))}function KC(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=VC(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function zp(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Db(e,t){var n=t.checked;return dn({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function H_(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Ba(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function YC(e,t){t=t.checked,t!=null&&ox(e,"checked",t,!1)}function Pb(e,t){YC(e,t);var n=Ba(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Bb(e,t.type,n):t.hasOwnProperty("defaultValue")&&Bb(e,t.type,Ba(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function z_(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Bb(e,t,n){(t!=="number"||zp(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Lu=Array.isArray;function Xl(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=fh.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function _d(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Wu={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},kB=["Webkit","ms","Moz","O"];Object.keys(Wu).forEach(function(e){kB.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Wu[t]=Wu[e]})});function XC(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Wu.hasOwnProperty(e)&&Wu[e]?(""+t).trim():t+"px"}function QC(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=XC(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var NB=dn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function $b(e,t){if(t){if(NB[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Ae(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Ae(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Ae(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Ae(62))}}function Hb(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 zb=null;function dx(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Vb=null,Ql=null,Zl=null;function Y_(e){if(e=Ef(e)){if(typeof Vb!="function")throw Error(Ae(280));var t=e.stateNode;t&&(t=ug(t),Vb(e.stateNode,e.type,t))}}function ZC(e){Ql?Zl?Zl.push(e):Zl=[e]:Ql=e}function JC(){if(Ql){var e=Ql,t=Zl;if(Zl=Ql=null,Y_(e),t)for(e=0;e>>=0,e===0?32:31-(DB(e)/PB|0)|0}var hh=64,ph=4194304;function Mu(e){switch(e&-e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Wp(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,a=n&268435455;if(a!==0){var o=a&~s;o!==0?r=Mu(o):(i&=a,i!==0&&(r=Mu(i)))}else a=n&~s,a!==0?r=Mu(a):i!==0&&(r=Mu(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function yf(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ys(t),e[t]=n}function $B(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=qu),tk=" ",nk=!1;function EI(e,t){switch(e){case"keyup":return m8.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function xI(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Sl=!1;function y8(e,t){switch(e){case"compositionend":return xI(t);case"keypress":return t.which!==32?null:(nk=!0,tk);case"textInput":return e=t.data,e===tk&&nk?null:e;default:return null}}function b8(e,t){if(Sl)return e==="compositionend"||!Ex&&EI(e,t)?(e=yI(),dp=gx=_a=null,Sl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=ak(n)}}function kI(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?kI(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function NI(){for(var e=window,t=zp();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=zp(e.document)}return t}function xx(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function T8(e){var t=NI(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&kI(n.ownerDocument.documentElement,n)){if(r!==null&&xx(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=ok(n,i);var a=ok(n,r);s&&a&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Tl=null,Xb=null,Qu=null,Qb=!1;function lk(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Qb||Tl==null||Tl!==zp(r)||(r=Tl,"selectionStart"in r&&xx(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Qu&&Cd(Qu,r)||(Qu=r,r=Xp(Xb,"onSelect"),0Il||(e.current=r1[Il],r1[Il]=null,Il--)}function Ht(e,t){Il++,r1[Il]=e.current,e.current=t}var Fa={},gr=za(Fa),Fr=za(!1),Ro=Fa;function dc(e,t){var n=e.type.contextTypes;if(!n)return Fa;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Ur(e){return e=e.childContextTypes,e!=null}function Zp(){Wt(Fr),Wt(gr)}function mk(e,t,n){if(gr.current!==Fa)throw Error(Ae(168));Ht(gr,t),Ht(Fr,n)}function MI(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(Ae(108,vB(e)||"Unknown",s));return dn({},n,r)}function Jp(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Fa,Ro=gr.current,Ht(gr,e),Ht(Fr,Fr.current),!0}function gk(e,t,n){var r=e.stateNode;if(!r)throw Error(Ae(169));n?(e=MI(e,t,Ro),r.__reactInternalMemoizedMergedChildContext=e,Wt(Fr),Wt(gr),Ht(gr,e)):Wt(Fr),Ht(Fr,n)}var Fi=null,dg=!1,q0=!1;function jI(e){Fi===null?Fi=[e]:Fi.push(e)}function F8(e){dg=!0,jI(e)}function Va(){if(!q0&&Fi!==null){q0=!0;var e=0,t=Ot;try{var n=Fi;for(Ot=1;e>=a,s-=a,$i=1<<32-Ys(t)+s|n<S?(A=C,C=null):A=C.sibling;var O=h(g,C,b[S],_);if(O===null){C===null&&(C=A);break}e&&C&&O.alternate===null&&t(g,C),x=i(O,x,S),N===null?k=O:N.sibling=O,N=O,C=A}if(S===b.length)return n(g,C),Jt&&io(g,S),k;if(C===null){for(;SS?(A=C,C=null):A=C.sibling;var D=h(g,C,O.value,_);if(D===null){C===null&&(C=A);break}e&&C&&D.alternate===null&&t(g,C),x=i(D,x,S),N===null?k=D:N.sibling=D,N=D,C=A}if(O.done)return n(g,C),Jt&&io(g,S),k;if(C===null){for(;!O.done;S++,O=b.next())O=f(g,O.value,_),O!==null&&(x=i(O,x,S),N===null?k=O:N.sibling=O,N=O);return Jt&&io(g,S),k}for(C=r(g,C);!O.done;S++,O=b.next())O=p(C,g,S,O.value,_),O!==null&&(e&&O.alternate!==null&&C.delete(O.key===null?S:O.key),x=i(O,x,S),N===null?k=O:N.sibling=O,N=O);return e&&C.forEach(function(U){return t(g,U)}),Jt&&io(g,S),k}function E(g,x,b,_){if(typeof b=="object"&&b!==null&&b.type===Nl&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case uh:e:{for(var k=b.key,N=x;N!==null;){if(N.key===k){if(k=b.type,k===Nl){if(N.tag===7){n(g,N.sibling),x=s(N,b.props.children),x.return=g,g=x;break e}}else if(N.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===ga&&Ek(k)===N.type){n(g,N.sibling),x=s(N,b.props),x.ref=pu(g,N,b),x.return=g,g=x;break e}n(g,N);break}else t(g,N);N=N.sibling}b.type===Nl?(x=No(b.props.children,g.mode,_,b.key),x.return=g,g=x):(_=Ep(b.type,b.key,b.props,null,g.mode,_),_.ref=pu(g,x,b),_.return=g,g=_)}return a(g);case kl:e:{for(N=b.key;x!==null;){if(x.key===N)if(x.tag===4&&x.stateNode.containerInfo===b.containerInfo&&x.stateNode.implementation===b.implementation){n(g,x.sibling),x=s(x,b.children||[]),x.return=g,g=x;break e}else{n(g,x);break}else t(g,x);x=x.sibling}x=ry(b,g.mode,_),x.return=g,g=x}return a(g);case ga:return N=b._init,E(g,x,N(b._payload),_)}if(Lu(b))return m(g,x,b,_);if(cu(b))return y(g,x,b,_);wh(g,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,x!==null&&x.tag===6?(n(g,x.sibling),x=s(x,b),x.return=g,g=x):(n(g,x),x=ny(b,g.mode,_),x.return=g,g=x),a(g)):n(g,x)}return E}var hc=FI(!0),UI=FI(!1),nm=za(null),rm=null,Ll=null,kx=null;function Nx(){kx=Ll=rm=null}function Sx(e){var t=nm.current;Wt(nm),e._currentValue=t}function a1(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function ec(e,t){rm=e,kx=Ll=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Pr=!0),e.firstContext=null)}function ks(e){var t=e._currentValue;if(kx!==e)if(e={context:e,memoizedValue:t,next:null},Ll===null){if(rm===null)throw Error(Ae(308));Ll=e,rm.dependencies={lanes:0,firstContext:e}}else Ll=Ll.next=e;return t}var yo=null;function Tx(e){yo===null?yo=[e]:yo.push(e)}function $I(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Tx(t)):(n.next=s.next,s.next=n),t.interleaved=n,Qi(e,r)}function Qi(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var ya=!1;function Ax(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function HI(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Ki(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Oa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Nt&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,Qi(e,n)}return s=r.interleaved,s===null?(t.next=t,Tx(r)):(t.next=s.next,s.next=t),r.interleaved=t,Qi(e,n)}function hp(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,hx(e,n)}}function xk(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=a:i=i.next=a,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function sm(e,t,n,r){var s=e.updateQueue;ya=!1;var i=s.firstBaseUpdate,a=s.lastBaseUpdate,o=s.shared.pending;if(o!==null){s.shared.pending=null;var c=o,u=c.next;c.next=null,a===null?i=u:a.next=u,a=c;var d=e.alternate;d!==null&&(d=d.updateQueue,o=d.lastBaseUpdate,o!==a&&(o===null?d.firstBaseUpdate=u:o.next=u,d.lastBaseUpdate=c))}if(i!==null){var f=s.baseState;a=0,d=u=c=null,o=i;do{var h=o.lane,p=o.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:p,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var m=e,y=o;switch(h=t,p=n,y.tag){case 1:if(m=y.payload,typeof m=="function"){f=m.call(p,f,h);break e}f=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=y.payload,h=typeof m=="function"?m.call(p,f,h):m,h==null)break e;f=dn({},f,h);break e;case 2:ya=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,h=s.effects,h===null?s.effects=[o]:h.push(o))}else p={eventTime:p,lane:h,tag:o.tag,payload:o.payload,callback:o.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,a|=h;if(o=o.next,o===null){if(o=s.shared.pending,o===null)break;h=o,o=h.next,h.next=null,s.lastBaseUpdate=h,s.shared.pending=null}}while(!0);if(d===null&&(c=f),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do a|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);jo|=a,e.lanes=a,e.memoizedState=f}}function wk(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Q0.transition;Q0.transition={};try{e(!1),t()}finally{Ot=n,Q0.transition=r}}function iO(){return Ns().memoizedState}function z8(e,t,n){var r=La(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},aO(e))oO(t,n);else if(n=$I(e,t,n,r),n!==null){var s=Tr();Ws(n,e,r,s),lO(n,t,r)}}function V8(e,t,n){var r=La(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(aO(e))oO(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var a=t.lastRenderedState,o=i(a,n);if(s.hasEagerState=!0,s.eagerState=o,Qs(o,a)){var c=t.interleaved;c===null?(s.next=s,Tx(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=$I(e,t,s,r),n!==null&&(s=Tr(),Ws(n,e,r,s),lO(n,t,r))}}function aO(e){var t=e.alternate;return e===un||t!==null&&t===un}function oO(e,t){Zu=am=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function lO(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,hx(e,n)}}var om={readContext:ks,useCallback:cr,useContext:cr,useEffect:cr,useImperativeHandle:cr,useInsertionEffect:cr,useLayoutEffect:cr,useMemo:cr,useReducer:cr,useRef:cr,useState:cr,useDebugValue:cr,useDeferredValue:cr,useTransition:cr,useMutableSource:cr,useSyncExternalStore:cr,useId:cr,unstable_isNewReconciler:!1},K8={readContext:ks,useCallback:function(e,t){return ci().memoizedState=[e,t===void 0?null:t],e},useContext:ks,useEffect:_k,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,mp(4194308,4,eO.bind(null,t,e),n)},useLayoutEffect:function(e,t){return mp(4194308,4,e,t)},useInsertionEffect:function(e,t){return mp(4,2,e,t)},useMemo:function(e,t){var n=ci();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ci();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=z8.bind(null,un,e),[r.memoizedState,e]},useRef:function(e){var t=ci();return e={current:e},t.memoizedState=e},useState:vk,useDebugValue:Dx,useDeferredValue:function(e){return ci().memoizedState=e},useTransition:function(){var e=vk(!1),t=e[0];return e=H8.bind(null,e[1]),ci().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=un,s=ci();if(Jt){if(n===void 0)throw Error(Ae(407));n=n()}else{if(n=t(),qn===null)throw Error(Ae(349));Mo&30||YI(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,_k(GI.bind(null,r,i,e),[e]),r.flags|=2048,Pd(9,WI.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=ci(),t=qn.identifierPrefix;if(Jt){var n=Hi,r=$i;n=(r&~(1<<32-Ys(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=jd++,0")&&(c=c.replace("",e.displayName)),c}while(1<=a&&0<=o);break}}}finally{L0=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ou(e):""}function xB(e){switch(e.tag){case 5:return Ou(e.type);case 16:return Ou("Lazy");case 13:return Ou("Suspense");case 19:return Ou("SuspenseList");case 0:case 2:case 15:return e=M0(e.type,!1),e;case 11:return e=M0(e.type.render,!1),e;case 1:return e=M0(e.type,!0),e;default:return""}}function Mb(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case kl:return"Fragment";case _l:return"Portal";case Ob:return"Profiler";case ox:return"StrictMode";case Rb:return"Suspense";case Lb:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case $C:return(e.displayName||"Context")+".Consumer";case UC:return(e._context.displayName||"Context")+".Provider";case lx:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case cx:return t=e.displayName||null,t!==null?t:Mb(e.type)||"Memo";case ga:t=e._payload,e=e._init;try{return Mb(e(t))}catch{}}return null}function wB(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Mb(t);case 8:return t===ox?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Pa(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function zC(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function vB(e){var t=zC(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(a){r=""+a,i.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function uh(e){e._valueTracker||(e._valueTracker=vB(e))}function VC(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=zC(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Hp(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function jb(e,t){var n=t.checked;return dn({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function $_(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Pa(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function KC(e,t){t=t.checked,t!=null&&ax(e,"checked",t,!1)}function Db(e,t){KC(e,t);var n=Pa(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Pb(e,t.type,n):t.hasOwnProperty("defaultValue")&&Pb(e,t.type,Pa(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function H_(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Pb(e,t,n){(t!=="number"||Hp(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Ru=Array.isArray;function ql(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=dh.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function vd(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Yu={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},_B=["Webkit","ms","Moz","O"];Object.keys(Yu).forEach(function(e){_B.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Yu[t]=Yu[e]})});function qC(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Yu.hasOwnProperty(e)&&Yu[e]?(""+t).trim():t+"px"}function XC(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=qC(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var kB=dn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ub(e,t){if(t){if(kB[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Ae(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Ae(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Ae(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Ae(62))}}function $b(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 Hb=null;function ux(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var zb=null,Xl=null,Ql=null;function K_(e){if(e=bf(e)){if(typeof zb!="function")throw Error(Ae(280));var t=e.stateNode;t&&(t=cg(t),zb(e.stateNode,e.type,t))}}function QC(e){Xl?Ql?Ql.push(e):Ql=[e]:Xl=e}function ZC(){if(Xl){var e=Xl,t=Ql;if(Ql=Xl=null,K_(e),t)for(e=0;e>>=0,e===0?32:31-(jB(e)/DB|0)|0}var fh=64,hh=4194304;function Lu(e){switch(e&-e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Yp(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,a=n&268435455;if(a!==0){var o=a&~s;o!==0?r=Lu(o):(i&=a,i!==0&&(r=Lu(i)))}else a=n&~s,a!==0?r=Lu(a):i!==0&&(r=Lu(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function gf(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ys(t),e[t]=n}function UB(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Gu),ek=" ",tk=!1;function bI(e,t){switch(e){case"keyup":return p8.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function EI(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Nl=!1;function g8(e,t){switch(e){case"compositionend":return EI(t);case"keypress":return t.which!==32?null:(tk=!0,ek);case"textInput":return e=t.data,e===ek&&tk?null:e;default:return null}}function y8(e,t){if(Nl)return e==="compositionend"||!bx&&bI(e,t)?(e=gI(),up=mx=_a=null,Nl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=ik(n)}}function _I(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?_I(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function kI(){for(var e=window,t=Hp();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Hp(e.document)}return t}function Ex(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function S8(e){var t=kI(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&_I(n.ownerDocument.documentElement,n)){if(r!==null&&Ex(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=ak(n,i);var a=ak(n,r);s&&a&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Sl=null,qb=null,Xu=null,Xb=!1;function ok(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Xb||Sl==null||Sl!==Hp(r)||(r=Sl,"selectionStart"in r&&Ex(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Xu&&Ad(Xu,r)||(Xu=r,r=qp(qb,"onSelect"),0Cl||(e.current=n1[Cl],n1[Cl]=null,Cl--)}function Ht(e,t){Cl++,n1[Cl]=e.current,e.current=t}var Ba={},gr=Ha(Ba),Fr=Ha(!1),Oo=Ba;function uc(e,t){var n=e.type.contextTypes;if(!n)return Ba;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Ur(e){return e=e.childContextTypes,e!=null}function Qp(){Wt(Fr),Wt(gr)}function pk(e,t,n){if(gr.current!==Ba)throw Error(Ae(168));Ht(gr,t),Ht(Fr,n)}function LI(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(Ae(108,wB(e)||"Unknown",s));return dn({},n,r)}function Zp(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ba,Oo=gr.current,Ht(gr,e),Ht(Fr,Fr.current),!0}function mk(e,t,n){var r=e.stateNode;if(!r)throw Error(Ae(169));n?(e=LI(e,t,Oo),r.__reactInternalMemoizedMergedChildContext=e,Wt(Fr),Wt(gr),Ht(gr,e)):Wt(Fr),Ht(Fr,n)}var Fi=null,ug=!1,G0=!1;function MI(e){Fi===null?Fi=[e]:Fi.push(e)}function B8(e){ug=!0,MI(e)}function za(){if(!G0&&Fi!==null){G0=!0;var e=0,t=Ot;try{var n=Fi;for(Ot=1;e>=a,s-=a,$i=1<<32-Ys(t)+s|n<S?(A=C,C=null):A=C.sibling;var O=h(g,C,b[S],_);if(O===null){C===null&&(C=A);break}e&&C&&O.alternate===null&&t(g,C),x=i(O,x,S),N===null?k=O:N.sibling=O,N=O,C=A}if(S===b.length)return n(g,C),Jt&&so(g,S),k;if(C===null){for(;SS?(A=C,C=null):A=C.sibling;var D=h(g,C,O.value,_);if(D===null){C===null&&(C=A);break}e&&C&&D.alternate===null&&t(g,C),x=i(D,x,S),N===null?k=D:N.sibling=D,N=D,C=A}if(O.done)return n(g,C),Jt&&so(g,S),k;if(C===null){for(;!O.done;S++,O=b.next())O=f(g,O.value,_),O!==null&&(x=i(O,x,S),N===null?k=O:N.sibling=O,N=O);return Jt&&so(g,S),k}for(C=r(g,C);!O.done;S++,O=b.next())O=p(C,g,S,O.value,_),O!==null&&(e&&O.alternate!==null&&C.delete(O.key===null?S:O.key),x=i(O,x,S),N===null?k=O:N.sibling=O,N=O);return e&&C.forEach(function(U){return t(g,U)}),Jt&&so(g,S),k}function E(g,x,b,_){if(typeof b=="object"&&b!==null&&b.type===kl&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case ch:e:{for(var k=b.key,N=x;N!==null;){if(N.key===k){if(k=b.type,k===kl){if(N.tag===7){n(g,N.sibling),x=s(N,b.props.children),x.return=g,g=x;break e}}else if(N.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===ga&&bk(k)===N.type){n(g,N.sibling),x=s(N,b.props),x.ref=hu(g,N,b),x.return=g,g=x;break e}n(g,N);break}else t(g,N);N=N.sibling}b.type===kl?(x=ko(b.props.children,g.mode,_,b.key),x.return=g,g=x):(_=bp(b.type,b.key,b.props,null,g.mode,_),_.ref=hu(g,x,b),_.return=g,g=_)}return a(g);case _l:e:{for(N=b.key;x!==null;){if(x.key===N)if(x.tag===4&&x.stateNode.containerInfo===b.containerInfo&&x.stateNode.implementation===b.implementation){n(g,x.sibling),x=s(x,b.children||[]),x.return=g,g=x;break e}else{n(g,x);break}else t(g,x);x=x.sibling}x=ny(b,g.mode,_),x.return=g,g=x}return a(g);case ga:return N=b._init,E(g,x,N(b._payload),_)}if(Ru(b))return m(g,x,b,_);if(lu(b))return y(g,x,b,_);xh(g,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,x!==null&&x.tag===6?(n(g,x.sibling),x=s(x,b),x.return=g,g=x):(n(g,x),x=ty(b,g.mode,_),x.return=g,g=x),a(g)):n(g,x)}return E}var fc=BI(!0),FI=BI(!1),tm=Ha(null),nm=null,Rl=null,_x=null;function kx(){_x=Rl=nm=null}function Nx(e){var t=tm.current;Wt(tm),e._currentValue=t}function i1(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Jl(e,t){nm=e,_x=Rl=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Pr=!0),e.firstContext=null)}function ks(e){var t=e._currentValue;if(_x!==e)if(e={context:e,memoizedValue:t,next:null},Rl===null){if(nm===null)throw Error(Ae(308));Rl=e,nm.dependencies={lanes:0,firstContext:e}}else Rl=Rl.next=e;return t}var go=null;function Sx(e){go===null?go=[e]:go.push(e)}function UI(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Sx(t)):(n.next=s.next,s.next=n),t.interleaved=n,Qi(e,r)}function Qi(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var ya=!1;function Tx(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function $I(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Ki(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Oa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Nt&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,Qi(e,n)}return s=r.interleaved,s===null?(t.next=t,Sx(r)):(t.next=s.next,s.next=t),r.interleaved=t,Qi(e,n)}function fp(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,fx(e,n)}}function Ek(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=a:i=i.next=a,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function rm(e,t,n,r){var s=e.updateQueue;ya=!1;var i=s.firstBaseUpdate,a=s.lastBaseUpdate,o=s.shared.pending;if(o!==null){s.shared.pending=null;var c=o,u=c.next;c.next=null,a===null?i=u:a.next=u,a=c;var d=e.alternate;d!==null&&(d=d.updateQueue,o=d.lastBaseUpdate,o!==a&&(o===null?d.firstBaseUpdate=u:o.next=u,d.lastBaseUpdate=c))}if(i!==null){var f=s.baseState;a=0,d=u=c=null,o=i;do{var h=o.lane,p=o.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:p,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var m=e,y=o;switch(h=t,p=n,y.tag){case 1:if(m=y.payload,typeof m=="function"){f=m.call(p,f,h);break e}f=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=y.payload,h=typeof m=="function"?m.call(p,f,h):m,h==null)break e;f=dn({},f,h);break e;case 2:ya=!0}}o.callback!==null&&o.lane!==0&&(e.flags|=64,h=s.effects,h===null?s.effects=[o]:h.push(o))}else p={eventTime:p,lane:h,tag:o.tag,payload:o.payload,callback:o.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,a|=h;if(o=o.next,o===null){if(o=s.shared.pending,o===null)break;h=o,o=h.next,h.next=null,s.lastBaseUpdate=h,s.shared.pending=null}}while(!0);if(d===null&&(c=f),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do a|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);Mo|=a,e.lanes=a,e.memoizedState=f}}function xk(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=X0.transition;X0.transition={};try{e(!1),t()}finally{Ot=n,X0.transition=r}}function sO(){return Ns().memoizedState}function H8(e,t,n){var r=La(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},iO(e))aO(t,n);else if(n=UI(e,t,n,r),n!==null){var s=Tr();Ws(n,e,r,s),oO(n,t,r)}}function z8(e,t,n){var r=La(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(iO(e))aO(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var a=t.lastRenderedState,o=i(a,n);if(s.hasEagerState=!0,s.eagerState=o,Qs(o,a)){var c=t.interleaved;c===null?(s.next=s,Sx(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=UI(e,t,s,r),n!==null&&(s=Tr(),Ws(n,e,r,s),oO(n,t,r))}}function iO(e){var t=e.alternate;return e===un||t!==null&&t===un}function aO(e,t){Qu=im=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function oO(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,fx(e,n)}}var am={readContext:ks,useCallback:cr,useContext:cr,useEffect:cr,useImperativeHandle:cr,useInsertionEffect:cr,useLayoutEffect:cr,useMemo:cr,useReducer:cr,useRef:cr,useState:cr,useDebugValue:cr,useDeferredValue:cr,useTransition:cr,useMutableSource:cr,useSyncExternalStore:cr,useId:cr,unstable_isNewReconciler:!1},V8={readContext:ks,useCallback:function(e,t){return ci().memoizedState=[e,t===void 0?null:t],e},useContext:ks,useEffect:vk,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,pp(4194308,4,JI.bind(null,t,e),n)},useLayoutEffect:function(e,t){return pp(4194308,4,e,t)},useInsertionEffect:function(e,t){return pp(4,2,e,t)},useMemo:function(e,t){var n=ci();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ci();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=H8.bind(null,un,e),[r.memoizedState,e]},useRef:function(e){var t=ci();return e={current:e},t.memoizedState=e},useState:wk,useDebugValue:jx,useDeferredValue:function(e){return ci().memoizedState=e},useTransition:function(){var e=wk(!1),t=e[0];return e=$8.bind(null,e[1]),ci().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=un,s=ci();if(Jt){if(n===void 0)throw Error(Ae(407));n=n()}else{if(n=t(),qn===null)throw Error(Ae(349));Lo&30||KI(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,vk(WI.bind(null,r,i,e),[e]),r.flags|=2048,Dd(9,YI.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=ci(),t=qn.identifierPrefix;if(Jt){var n=Hi,r=$i;n=(r&~(1<<32-Ys(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Md++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[hi]=t,e[Rd]=r,bO(e,t,!1,!1),t.stateNode=e;e:{switch(a=Hb(n,r),n){case"dialog":Yt("cancel",e),Yt("close",e),s=r;break;case"iframe":case"object":case"embed":Yt("load",e),s=r;break;case"video":case"audio":for(s=0;sgc&&(t.flags|=128,r=!0,mu(i,!1),t.lanes=4194304)}else{if(!r)if(e=im(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),mu(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!Jt)return ur(t),null}else 2*wn()-i.renderingStartTime>gc&&n!==1073741824&&(t.flags|=128,r=!0,mu(i,!1),t.lanes=4194304);i.isBackwards?(a.sibling=t.child,t.child=a):(n=i.last,n!==null?n.sibling=a:t.child=a,i.last=a)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=wn(),t.sibling=null,n=ln.current,Ht(ln,r?n&1|2:n&1),t):(ur(t),null);case 22:case 23:return Hx(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Xr&1073741824&&(ur(t),t.subtreeFlags&6&&(t.flags|=8192)):ur(t),null;case 24:return null;case 25:return null}throw Error(Ae(156,t.tag))}function J8(e,t){switch(vx(t),t.tag){case 1:return Ur(t.type)&&Zp(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return pc(),Wt(Fr),Wt(gr),Ox(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ix(t),null;case 13:if(Wt(ln),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Ae(340));fc()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Wt(ln),null;case 4:return pc(),null;case 10:return Sx(t.type._context),null;case 22:case 23:return Hx(),null;case 24:return null;default:return null}}var _h=!1,fr=!1,eF=typeof WeakSet=="function"?WeakSet:Set,Fe=null;function Ml(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){yn(e,t,r)}else n.current=null}function m1(e,t,n){try{n()}catch(r){yn(e,t,r)}}var Mk=!1;function tF(e,t){if(Zb=Gp,e=NI(),xx(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var a=0,o=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var p;f!==n||s!==0&&f.nodeType!==3||(o=a+s),f!==i||r!==0&&f.nodeType!==3||(c=a+r),f.nodeType===3&&(a+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===s&&(o=a),h===i&&++d===r&&(c=a),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=o===-1||c===-1?null:{start:o,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Jb={focusedElem:e,selectionRange:n},Gp=!1,Fe=t;Fe!==null;)if(t=Fe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Fe=e;else for(;Fe!==null;){t=Fe;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var y=m.memoizedProps,E=m.memoizedState,g=t.stateNode,x=g.getSnapshotBeforeUpdate(t.elementType===t.type?y:Bs(t.type,y),E);g.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var b=t.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Ae(163))}}catch(_){yn(t,t.return,_)}if(e=t.sibling,e!==null){e.return=t.return,Fe=e;break}Fe=t.return}return m=Mk,Mk=!1,m}function Ju(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&m1(t,n,i)}s=s.next}while(s!==r)}}function pg(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function g1(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function wO(e){var t=e.alternate;t!==null&&(e.alternate=null,wO(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[hi],delete t[Rd],delete t[n1],delete t[P8],delete t[B8])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function vO(e){return e.tag===5||e.tag===3||e.tag===4}function jk(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||vO(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function y1(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Qp));else if(r!==4&&(e=e.child,e!==null))for(y1(e,t,n),e=e.sibling;e!==null;)y1(e,t,n),e=e.sibling}function b1(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(b1(e,t,n),e=e.sibling;e!==null;)b1(e,t,n),e=e.sibling}var tr=null,Fs=!1;function la(e,t,n){for(n=n.child;n!==null;)_O(e,t,n),n=n.sibling}function _O(e,t,n){if(gi&&typeof gi.onCommitFiberUnmount=="function")try{gi.onCommitFiberUnmount(ag,n)}catch{}switch(n.tag){case 5:fr||Ml(n,t);case 6:var r=tr,s=Fs;tr=null,la(e,t,n),tr=r,Fs=s,tr!==null&&(Fs?(e=tr,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):tr.removeChild(n.stateNode));break;case 18:tr!==null&&(Fs?(e=tr,n=n.stateNode,e.nodeType===8?G0(e.parentNode,n):e.nodeType===1&&G0(e,n),Td(e)):G0(tr,n.stateNode));break;case 4:r=tr,s=Fs,tr=n.stateNode.containerInfo,Fs=!0,la(e,t,n),tr=r,Fs=s;break;case 0:case 11:case 14:case 15:if(!fr&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,a=i.destroy;i=i.tag,a!==void 0&&(i&2||i&4)&&m1(n,t,a),s=s.next}while(s!==r)}la(e,t,n);break;case 1:if(!fr&&(Ml(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){yn(n,t,o)}la(e,t,n);break;case 21:la(e,t,n);break;case 22:n.mode&1?(fr=(r=fr)||n.memoizedState!==null,la(e,t,n),fr=r):la(e,t,n);break;default:la(e,t,n)}}function Dk(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new eF),t.forEach(function(r){var s=uF.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Ms(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=a),r&=~i}if(r=s,r=wn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*rF(r/1960))-r,10e?16:e,ka===null)var r=!1;else{if(e=ka,ka=null,um=0,Nt&6)throw Error(Ae(331));var s=Nt;for(Nt|=4,Fe=e.current;Fe!==null;){var i=Fe,a=i.child;if(Fe.flags&16){var o=i.deletions;if(o!==null){for(var c=0;cwn()-Ux?ko(e,0):Fx|=n),$r(e,t)}function OO(e,t){t===0&&(e.mode&1?(t=ph,ph<<=1,!(ph&130023424)&&(ph=4194304)):t=1);var n=Tr();e=Qi(e,t),e!==null&&(yf(e,t,n),$r(e,n))}function cF(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),OO(e,n)}function uF(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Ae(314))}r!==null&&r.delete(t),OO(e,n)}var RO;RO=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Fr.current)Pr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Pr=!1,Q8(e,t,n);Pr=!!(e.flags&131072)}else Pr=!1,Jt&&t.flags&1048576&&DI(t,tm,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;gp(e,t),e=t.pendingProps;var s=dc(t,gr.current);ec(t,n),s=Lx(null,t,r,e,s,n);var i=Mx();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ur(r)?(i=!0,Jp(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Ax(t),s.updater=hg,t.stateNode=s,s._reactInternals=t,l1(t,r,e,n),t=d1(null,t,r,!0,i,n)):(t.tag=0,Jt&&i&&wx(t),_r(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(gp(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=fF(r),e=Bs(r,e),s){case 0:t=u1(null,t,r,e,n);break e;case 1:t=Ok(null,t,r,e,n);break e;case 11:t=Ck(null,t,r,e,n);break e;case 14:t=Ik(null,t,r,Bs(r.type,e),n);break e}throw Error(Ae(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Bs(r,s),u1(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Bs(r,s),Ok(e,t,r,s,n);case 3:e:{if(mO(t),e===null)throw Error(Ae(387));r=t.pendingProps,i=t.memoizedState,s=i.element,HI(e,t),sm(t,r,null,n);var a=t.memoizedState;if(r=a.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=mc(Error(Ae(423)),t),t=Rk(e,t,r,n,s);break e}else if(r!==s){s=mc(Error(Ae(424)),t),t=Rk(e,t,r,n,s);break e}else for(Zr=Ia(t.stateNode.containerInfo.firstChild),Jr=t,Jt=!0,$s=null,n=UI(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(fc(),r===s){t=Zi(e,t,n);break e}_r(e,t,r,n)}t=t.child}return t;case 5:return zI(t),e===null&&i1(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,a=s.children,e1(r,s)?a=null:i!==null&&e1(r,i)&&(t.flags|=32),pO(e,t),_r(e,t,a,n),t.child;case 6:return e===null&&i1(t),null;case 13:return gO(e,t,n);case 4:return Cx(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=hc(t,null,r,n):_r(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Bs(r,s),Ck(e,t,r,s,n);case 7:return _r(e,t,t.pendingProps,n),t.child;case 8:return _r(e,t,t.pendingProps.children,n),t.child;case 12:return _r(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,a=s.value,Ht(nm,r._currentValue),r._currentValue=a,i!==null)if(Qs(i.value,a)){if(i.children===s.children&&!Fr.current){t=Zi(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var o=i.dependencies;if(o!==null){a=i.child;for(var c=o.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=Ki(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),a1(i.return,n,t),o.lanes|=n;break}c=c.next}}else if(i.tag===10)a=i.type===t.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(Ae(341));a.lanes|=n,o=a.alternate,o!==null&&(o.lanes|=n),a1(a,n,t),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===t){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}_r(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,ec(t,n),s=ks(s),r=r(s),t.flags|=1,_r(e,t,r,n),t.child;case 14:return r=t.type,s=Bs(r,t.pendingProps),s=Bs(r.type,s),Ik(e,t,r,s,n);case 15:return fO(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Bs(r,s),gp(e,t),t.tag=1,Ur(r)?(e=!0,Jp(t)):e=!1,ec(t,n),cO(t,r,s),l1(t,r,s,n),d1(null,t,r,!0,e,n);case 19:return yO(e,t,n);case 22:return hO(e,t,n)}throw Error(Ae(156,t.tag))};function LO(e,t){return aI(e,t)}function dF(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function xs(e,t,n,r){return new dF(e,t,n,r)}function Vx(e){return e=e.prototype,!(!e||!e.isReactComponent)}function fF(e){if(typeof e=="function")return Vx(e)?1:0;if(e!=null){if(e=e.$$typeof,e===cx)return 11;if(e===ux)return 14}return 2}function Ma(e,t){var n=e.alternate;return n===null?(n=xs(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ep(e,t,n,r,s,i){var a=2;if(r=e,typeof e=="function")Vx(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Nl:return No(n.children,s,i,t);case lx:a=8,s|=8;break;case Rb:return e=xs(12,n,t,s|2),e.elementType=Rb,e.lanes=i,e;case Lb:return e=xs(13,n,t,s),e.elementType=Lb,e.lanes=i,e;case Mb:return e=xs(19,n,t,s),e.elementType=Mb,e.lanes=i,e;case zC:return gg(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case $C:a=10;break e;case HC:a=9;break e;case cx:a=11;break e;case ux:a=14;break e;case ga:a=16,r=null;break e}throw Error(Ae(130,e==null?e:typeof e,""))}return t=xs(a,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function No(e,t,n,r){return e=xs(7,e,r,t),e.lanes=n,e}function gg(e,t,n,r){return e=xs(22,e,r,t),e.elementType=zC,e.lanes=n,e.stateNode={isHidden:!1},e}function ny(e,t,n){return e=xs(6,e,null,t),e.lanes=n,e}function ry(e,t,n){return t=xs(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function hF(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=P0(0),this.expirationTimes=P0(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=P0(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Kx(e,t,n,r,s,i,a,o,c){return e=new hF(e,t,n,o,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=xs(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ax(i),e}function pF(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(PO)}catch(e){console.error(e)}}PO(),PC.exports=is;var Ss=PC.exports,Vk=Ss;Ib.createRoot=Vk.createRoot,Ib.hydrateRoot=Vk.hydrateRoot;const qx=w.createContext({});function wg(e){const t=w.useRef(null);return t.current===null&&(t.current=e()),t.current}const vg=w.createContext(null),Fd=w.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class EF extends w.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function xF({children:e,isPresent:t}){const n=w.useId(),r=w.useRef(null),s=w.useRef({width:0,height:0,top:0,left:0}),{nonce:i}=w.useContext(Fd);return w.useInsertionEffect(()=>{const{width:a,height:o,top:c,left:u}=s.current;if(t||!r.current||!a||!o)return;r.current.dataset.motionPopId=n;const d=document.createElement("style");return i&&(d.nonce=i),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` +`+i.stack}return{value:e,source:t,stack:s,digest:null}}function J0(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function l1(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var W8=typeof WeakMap=="function"?WeakMap:Map;function cO(e,t,n){n=Ki(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){lm||(lm=!0,b1=r),l1(e,t)},n}function uO(e,t,n){n=Ki(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var s=t.value;n.payload=function(){return r(s)},n.callback=function(){l1(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){l1(e,t),typeof r!="function"&&(Ra===null?Ra=new Set([this]):Ra.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function Nk(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new W8;var s=new Set;r.set(t,s)}else s=r.get(t),s===void 0&&(s=new Set,r.set(t,s));s.has(n)||(s.add(n),e=oF.bind(null,e,t,n),t.then(e,e))}function Sk(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Tk(e,t,n,r,s){return e.mode&1?(e.flags|=65536,e.lanes=s,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Ki(-1,1),t.tag=2,Oa(n,t,1))),n.lanes|=1),e)}var G8=ra.ReactCurrentOwner,Pr=!1;function _r(e,t,n,r){t.child=e===null?FI(t,null,n,r):fc(t,e.child,n,r)}function Ak(e,t,n,r,s){n=n.render;var i=t.ref;return Jl(t,s),r=Rx(e,t,n,r,i,s),n=Lx(),e!==null&&!Pr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Zi(e,t,s)):(Jt&&n&&xx(t),t.flags|=1,_r(e,t,r,s),t.child)}function Ck(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!zx(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,dO(e,t,i,r,s)):(e=bp(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&s)){var a=i.memoizedProps;if(n=n.compare,n=n!==null?n:Ad,n(a,r)&&e.ref===t.ref)return Zi(e,t,s)}return t.flags|=1,e=Ma(i,r),e.ref=t.ref,e.return=t,t.child=e}function dO(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(Ad(i,r)&&e.ref===t.ref)if(Pr=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(Pr=!0);else return t.lanes=e.lanes,Zi(e,t,s)}return c1(e,t,n,r,s)}function fO(e,t,n){var r=t.pendingProps,s=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ht(Ml,Xr),Xr|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ht(Ml,Xr),Xr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Ht(Ml,Xr),Xr|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,Ht(Ml,Xr),Xr|=r;return _r(e,t,s,n),t.child}function hO(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function c1(e,t,n,r,s){var i=Ur(n)?Oo:gr.current;return i=uc(t,i),Jl(t,s),n=Rx(e,t,n,r,i,s),r=Lx(),e!==null&&!Pr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Zi(e,t,s)):(Jt&&r&&xx(t),t.flags|=1,_r(e,t,n,s),t.child)}function Ik(e,t,n,r,s){if(Ur(n)){var i=!0;Zp(t)}else i=!1;if(Jl(t,s),t.stateNode===null)mp(e,t),lO(t,n,r),o1(t,n,r,s),r=!0;else if(e===null){var a=t.stateNode,o=t.memoizedProps;a.props=o;var c=a.context,u=n.contextType;typeof u=="object"&&u!==null?u=ks(u):(u=Ur(n)?Oo:gr.current,u=uc(t,u));var d=n.getDerivedStateFromProps,f=typeof d=="function"||typeof a.getSnapshotBeforeUpdate=="function";f||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==r||c!==u)&&kk(t,a,r,u),ya=!1;var h=t.memoizedState;a.state=h,rm(t,r,a,s),c=t.memoizedState,o!==r||h!==c||Fr.current||ya?(typeof d=="function"&&(a1(t,n,d,r),c=t.memoizedState),(o=ya||_k(t,n,o,r,h,c,u))?(f||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),a.props=r,a.state=c,a.context=u,r=o):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,$I(e,t),o=t.memoizedProps,u=t.type===t.elementType?o:Bs(t.type,o),a.props=u,f=t.pendingProps,h=a.context,c=n.contextType,typeof c=="object"&&c!==null?c=ks(c):(c=Ur(n)?Oo:gr.current,c=uc(t,c));var p=n.getDerivedStateFromProps;(d=typeof p=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==f||h!==c)&&kk(t,a,r,c),ya=!1,h=t.memoizedState,a.state=h,rm(t,r,a,s);var m=t.memoizedState;o!==f||h!==m||Fr.current||ya?(typeof p=="function"&&(a1(t,n,p,r),m=t.memoizedState),(u=ya||_k(t,n,u,r,h,m,c)||!1)?(d||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,m,c),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,m,c)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),a.props=r,a.state=m,a.context=c,r=u):(typeof a.componentDidUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return u1(e,t,n,r,i,s)}function u1(e,t,n,r,s,i){hO(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return s&&mk(t,n,!1),Zi(e,t,i);r=t.stateNode,G8.current=t;var o=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=fc(t,e.child,null,i),t.child=fc(t,null,o,i)):_r(e,t,o,i),t.memoizedState=r.state,s&&mk(t,n,!0),t.child}function pO(e){var t=e.stateNode;t.pendingContext?pk(e,t.pendingContext,t.pendingContext!==t.context):t.context&&pk(e,t.context,!1),Ax(e,t.containerInfo)}function Ok(e,t,n,r,s){return dc(),vx(s),t.flags|=256,_r(e,t,n,r),t.child}var d1={dehydrated:null,treeContext:null,retryLane:0};function f1(e){return{baseLanes:e,cachePool:null,transitions:null}}function mO(e,t,n){var r=t.pendingProps,s=ln.current,i=!1,a=(t.flags&128)!==0,o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:(s&2)!==0),o?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),Ht(ln,s&1),e===null)return s1(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=r.children,e=r.fallback,i?(r=t.mode,i=t.child,a={mode:"hidden",children:a},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=a):i=mg(a,r,0,null),e=ko(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=f1(n),t.memoizedState=d1,e):Dx(t,a));if(s=e.memoizedState,s!==null&&(o=s.dehydrated,o!==null))return q8(e,t,a,r,o,s,n);if(i){i=r.fallback,a=t.mode,s=e.child,o=s.sibling;var c={mode:"hidden",children:r.children};return!(a&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Ma(s,c),r.subtreeFlags=s.subtreeFlags&14680064),o!==null?i=Ma(o,i):(i=ko(i,a,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,a=e.child.memoizedState,a=a===null?f1(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~n,t.memoizedState=d1,r}return i=e.child,e=i.sibling,r=Ma(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Dx(e,t){return t=mg({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function wh(e,t,n,r){return r!==null&&vx(r),fc(t,e.child,null,n),e=Dx(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function q8(e,t,n,r,s,i,a){if(n)return t.flags&256?(t.flags&=-257,r=J0(Error(Ae(422))),wh(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=mg({mode:"visible",children:r.children},s,0,null),i=ko(i,s,a,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&fc(t,e.child,null,a),t.child.memoizedState=f1(a),t.memoizedState=d1,i);if(!(t.mode&1))return wh(e,t,a,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var o=r.dgst;return r=o,i=Error(Ae(419)),r=J0(i,r,void 0),wh(e,t,a,r)}if(o=(a&e.childLanes)!==0,Pr||o){if(r=qn,r!==null){switch(a&-a){case 4:s=2;break;case 16:s=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|a)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,Qi(e,s),Ws(r,e,s,-1))}return Hx(),r=J0(Error(Ae(421))),wh(e,t,a,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=lF.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,Zr=Ia(s.nextSibling),Jr=t,Jt=!0,$s=null,e!==null&&(ms[gs++]=$i,ms[gs++]=Hi,ms[gs++]=Ro,$i=e.id,Hi=e.overflow,Ro=t),t=Dx(t,r.children),t.flags|=4096,t)}function Rk(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),i1(e.return,t,n)}function ey(e,t,n,r,s){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=s)}function gO(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if(_r(e,t,r.children,n),r=ln.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Rk(e,n,t);else if(e.tag===19)Rk(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Ht(ln,r),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&sm(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),ey(t,!1,s,n,i);break;case"backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&sm(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}ey(t,!0,n,null,i);break;case"together":ey(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function mp(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Zi(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Mo|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Ae(153));if(t.child!==null){for(e=t.child,n=Ma(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ma(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function X8(e,t,n){switch(t.tag){case 3:pO(t),dc();break;case 5:HI(t);break;case 1:Ur(t.type)&&Zp(t);break;case 4:Ax(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;Ht(tm,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Ht(ln,ln.current&1),t.flags|=128,null):n&t.child.childLanes?mO(e,t,n):(Ht(ln,ln.current&1),e=Zi(e,t,n),e!==null?e.sibling:null);Ht(ln,ln.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return gO(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),Ht(ln,ln.current),r)break;return null;case 22:case 23:return t.lanes=0,fO(e,t,n)}return Zi(e,t,n)}var yO,h1,bO,EO;yO=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};h1=function(){};bO=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,yo(yi.current);var i=null;switch(n){case"input":s=jb(e,s),r=jb(e,r),i=[];break;case"select":s=dn({},s,{value:void 0}),r=dn({},r,{value:void 0}),i=[];break;case"textarea":s=Bb(e,s),r=Bb(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Xp)}Ub(n,r);var a;n=null;for(u in s)if(!r.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var o=s[u];for(a in o)o.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(wd.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var c=r[u];if(o=s!=null?s[u]:void 0,r.hasOwnProperty(u)&&c!==o&&(c!=null||o!=null))if(u==="style")if(o){for(a in o)!o.hasOwnProperty(a)||c&&c.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in c)c.hasOwnProperty(a)&&o[a]!==c[a]&&(n||(n={}),n[a]=c[a])}else n||(i||(i=[]),i.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,o=o?o.__html:void 0,c!=null&&o!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(wd.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&Yt("scroll",e),i||o===c||(i=[])):(i=i||[]).push(u,c))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};EO=function(e,t,n,r){n!==r&&(t.flags|=4)};function pu(e,t){if(!Jt)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function ur(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=e,s=s.sibling;else for(s=e.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=e,s=s.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Q8(e,t,n){var r=t.pendingProps;switch(wx(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ur(t),null;case 1:return Ur(t.type)&&Qp(),ur(t),null;case 3:return r=t.stateNode,hc(),Wt(Fr),Wt(gr),Ix(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Eh(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,$s!==null&&(w1($s),$s=null))),h1(e,t),ur(t),null;case 5:Cx(t);var s=yo(Ld.current);if(n=t.type,e!==null&&t.stateNode!=null)bO(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(Ae(166));return ur(t),null}if(e=yo(yi.current),Eh(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[hi]=t,r[Od]=i,e=(t.mode&1)!==0,n){case"dialog":Yt("cancel",r),Yt("close",r);break;case"iframe":case"object":case"embed":Yt("load",r);break;case"video":case"audio":for(s=0;s<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[hi]=t,e[Od]=r,yO(e,t,!1,!1),t.stateNode=e;e:{switch(a=$b(n,r),n){case"dialog":Yt("cancel",e),Yt("close",e),s=r;break;case"iframe":case"object":case"embed":Yt("load",e),s=r;break;case"video":case"audio":for(s=0;smc&&(t.flags|=128,r=!0,pu(i,!1),t.lanes=4194304)}else{if(!r)if(e=sm(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),pu(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!Jt)return ur(t),null}else 2*wn()-i.renderingStartTime>mc&&n!==1073741824&&(t.flags|=128,r=!0,pu(i,!1),t.lanes=4194304);i.isBackwards?(a.sibling=t.child,t.child=a):(n=i.last,n!==null?n.sibling=a:t.child=a,i.last=a)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=wn(),t.sibling=null,n=ln.current,Ht(ln,r?n&1|2:n&1),t):(ur(t),null);case 22:case 23:return $x(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Xr&1073741824&&(ur(t),t.subtreeFlags&6&&(t.flags|=8192)):ur(t),null;case 24:return null;case 25:return null}throw Error(Ae(156,t.tag))}function Z8(e,t){switch(wx(t),t.tag){case 1:return Ur(t.type)&&Qp(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return hc(),Wt(Fr),Wt(gr),Ix(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Cx(t),null;case 13:if(Wt(ln),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Ae(340));dc()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Wt(ln),null;case 4:return hc(),null;case 10:return Nx(t.type._context),null;case 22:case 23:return $x(),null;case 24:return null;default:return null}}var vh=!1,fr=!1,J8=typeof WeakSet=="function"?WeakSet:Set,Fe=null;function Ll(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){yn(e,t,r)}else n.current=null}function p1(e,t,n){try{n()}catch(r){yn(e,t,r)}}var Lk=!1;function eF(e,t){if(Qb=Wp,e=kI(),Ex(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var a=0,o=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var p;f!==n||s!==0&&f.nodeType!==3||(o=a+s),f!==i||r!==0&&f.nodeType!==3||(c=a+r),f.nodeType===3&&(a+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===s&&(o=a),h===i&&++d===r&&(c=a),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=o===-1||c===-1?null:{start:o,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Zb={focusedElem:e,selectionRange:n},Wp=!1,Fe=t;Fe!==null;)if(t=Fe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Fe=e;else for(;Fe!==null;){t=Fe;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var y=m.memoizedProps,E=m.memoizedState,g=t.stateNode,x=g.getSnapshotBeforeUpdate(t.elementType===t.type?y:Bs(t.type,y),E);g.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var b=t.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Ae(163))}}catch(_){yn(t,t.return,_)}if(e=t.sibling,e!==null){e.return=t.return,Fe=e;break}Fe=t.return}return m=Lk,Lk=!1,m}function Zu(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&p1(t,n,i)}s=s.next}while(s!==r)}}function hg(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function m1(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function xO(e){var t=e.alternate;t!==null&&(e.alternate=null,xO(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[hi],delete t[Od],delete t[t1],delete t[D8],delete t[P8])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function wO(e){return e.tag===5||e.tag===3||e.tag===4}function Mk(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||wO(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function g1(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Xp));else if(r!==4&&(e=e.child,e!==null))for(g1(e,t,n),e=e.sibling;e!==null;)g1(e,t,n),e=e.sibling}function y1(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(y1(e,t,n),e=e.sibling;e!==null;)y1(e,t,n),e=e.sibling}var tr=null,Fs=!1;function la(e,t,n){for(n=n.child;n!==null;)vO(e,t,n),n=n.sibling}function vO(e,t,n){if(gi&&typeof gi.onCommitFiberUnmount=="function")try{gi.onCommitFiberUnmount(ig,n)}catch{}switch(n.tag){case 5:fr||Ll(n,t);case 6:var r=tr,s=Fs;tr=null,la(e,t,n),tr=r,Fs=s,tr!==null&&(Fs?(e=tr,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):tr.removeChild(n.stateNode));break;case 18:tr!==null&&(Fs?(e=tr,n=n.stateNode,e.nodeType===8?W0(e.parentNode,n):e.nodeType===1&&W0(e,n),Sd(e)):W0(tr,n.stateNode));break;case 4:r=tr,s=Fs,tr=n.stateNode.containerInfo,Fs=!0,la(e,t,n),tr=r,Fs=s;break;case 0:case 11:case 14:case 15:if(!fr&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,a=i.destroy;i=i.tag,a!==void 0&&(i&2||i&4)&&p1(n,t,a),s=s.next}while(s!==r)}la(e,t,n);break;case 1:if(!fr&&(Ll(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){yn(n,t,o)}la(e,t,n);break;case 21:la(e,t,n);break;case 22:n.mode&1?(fr=(r=fr)||n.memoizedState!==null,la(e,t,n),fr=r):la(e,t,n);break;default:la(e,t,n)}}function jk(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new J8),t.forEach(function(r){var s=cF.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Ms(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=a),r&=~i}if(r=s,r=wn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*nF(r/1960))-r,10e?16:e,ka===null)var r=!1;else{if(e=ka,ka=null,cm=0,Nt&6)throw Error(Ae(331));var s=Nt;for(Nt|=4,Fe=e.current;Fe!==null;){var i=Fe,a=i.child;if(Fe.flags&16){var o=i.deletions;if(o!==null){for(var c=0;cwn()-Fx?_o(e,0):Bx|=n),$r(e,t)}function IO(e,t){t===0&&(e.mode&1?(t=hh,hh<<=1,!(hh&130023424)&&(hh=4194304)):t=1);var n=Tr();e=Qi(e,t),e!==null&&(gf(e,t,n),$r(e,n))}function lF(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),IO(e,n)}function cF(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Ae(314))}r!==null&&r.delete(t),IO(e,n)}var OO;OO=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Fr.current)Pr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Pr=!1,X8(e,t,n);Pr=!!(e.flags&131072)}else Pr=!1,Jt&&t.flags&1048576&&jI(t,em,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;mp(e,t),e=t.pendingProps;var s=uc(t,gr.current);Jl(t,n),s=Rx(null,t,r,e,s,n);var i=Lx();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ur(r)?(i=!0,Zp(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Tx(t),s.updater=fg,t.stateNode=s,s._reactInternals=t,o1(t,r,e,n),t=u1(null,t,r,!0,i,n)):(t.tag=0,Jt&&i&&xx(t),_r(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(mp(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=dF(r),e=Bs(r,e),s){case 0:t=c1(null,t,r,e,n);break e;case 1:t=Ik(null,t,r,e,n);break e;case 11:t=Ak(null,t,r,e,n);break e;case 14:t=Ck(null,t,r,Bs(r.type,e),n);break e}throw Error(Ae(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Bs(r,s),c1(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Bs(r,s),Ik(e,t,r,s,n);case 3:e:{if(pO(t),e===null)throw Error(Ae(387));r=t.pendingProps,i=t.memoizedState,s=i.element,$I(e,t),rm(t,r,null,n);var a=t.memoizedState;if(r=a.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=pc(Error(Ae(423)),t),t=Ok(e,t,r,n,s);break e}else if(r!==s){s=pc(Error(Ae(424)),t),t=Ok(e,t,r,n,s);break e}else for(Zr=Ia(t.stateNode.containerInfo.firstChild),Jr=t,Jt=!0,$s=null,n=FI(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(dc(),r===s){t=Zi(e,t,n);break e}_r(e,t,r,n)}t=t.child}return t;case 5:return HI(t),e===null&&s1(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,a=s.children,Jb(r,s)?a=null:i!==null&&Jb(r,i)&&(t.flags|=32),hO(e,t),_r(e,t,a,n),t.child;case 6:return e===null&&s1(t),null;case 13:return mO(e,t,n);case 4:return Ax(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=fc(t,null,r,n):_r(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Bs(r,s),Ak(e,t,r,s,n);case 7:return _r(e,t,t.pendingProps,n),t.child;case 8:return _r(e,t,t.pendingProps.children,n),t.child;case 12:return _r(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,a=s.value,Ht(tm,r._currentValue),r._currentValue=a,i!==null)if(Qs(i.value,a)){if(i.children===s.children&&!Fr.current){t=Zi(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var o=i.dependencies;if(o!==null){a=i.child;for(var c=o.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=Ki(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),i1(i.return,n,t),o.lanes|=n;break}c=c.next}}else if(i.tag===10)a=i.type===t.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(Ae(341));a.lanes|=n,o=a.alternate,o!==null&&(o.lanes|=n),i1(a,n,t),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===t){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}_r(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Jl(t,n),s=ks(s),r=r(s),t.flags|=1,_r(e,t,r,n),t.child;case 14:return r=t.type,s=Bs(r,t.pendingProps),s=Bs(r.type,s),Ck(e,t,r,s,n);case 15:return dO(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Bs(r,s),mp(e,t),t.tag=1,Ur(r)?(e=!0,Zp(t)):e=!1,Jl(t,n),lO(t,r,s),o1(t,r,s,n),u1(null,t,r,!0,e,n);case 19:return gO(e,t,n);case 22:return fO(e,t,n)}throw Error(Ae(156,t.tag))};function RO(e,t){return iI(e,t)}function uF(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function xs(e,t,n,r){return new uF(e,t,n,r)}function zx(e){return e=e.prototype,!(!e||!e.isReactComponent)}function dF(e){if(typeof e=="function")return zx(e)?1:0;if(e!=null){if(e=e.$$typeof,e===lx)return 11;if(e===cx)return 14}return 2}function Ma(e,t){var n=e.alternate;return n===null?(n=xs(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function bp(e,t,n,r,s,i){var a=2;if(r=e,typeof e=="function")zx(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case kl:return ko(n.children,s,i,t);case ox:a=8,s|=8;break;case Ob:return e=xs(12,n,t,s|2),e.elementType=Ob,e.lanes=i,e;case Rb:return e=xs(13,n,t,s),e.elementType=Rb,e.lanes=i,e;case Lb:return e=xs(19,n,t,s),e.elementType=Lb,e.lanes=i,e;case HC:return mg(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case UC:a=10;break e;case $C:a=9;break e;case lx:a=11;break e;case cx:a=14;break e;case ga:a=16,r=null;break e}throw Error(Ae(130,e==null?e:typeof e,""))}return t=xs(a,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function ko(e,t,n,r){return e=xs(7,e,r,t),e.lanes=n,e}function mg(e,t,n,r){return e=xs(22,e,r,t),e.elementType=HC,e.lanes=n,e.stateNode={isHidden:!1},e}function ty(e,t,n){return e=xs(6,e,null,t),e.lanes=n,e}function ny(e,t,n){return t=xs(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function fF(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=D0(0),this.expirationTimes=D0(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=D0(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Vx(e,t,n,r,s,i,a,o,c){return e=new fF(e,t,n,o,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=xs(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Tx(i),e}function hF(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(DO)}catch(e){console.error(e)}}DO(),DC.exports=is;var Ss=DC.exports,zk=Ss;Cb.createRoot=zk.createRoot,Cb.hydrateRoot=zk.hydrateRoot;const Gx=w.createContext({});function xg(e){const t=w.useRef(null);return t.current===null&&(t.current=e()),t.current}const wg=w.createContext(null),Bd=w.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class bF extends w.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function EF({children:e,isPresent:t}){const n=w.useId(),r=w.useRef(null),s=w.useRef({width:0,height:0,top:0,left:0}),{nonce:i}=w.useContext(Bd);return w.useInsertionEffect(()=>{const{width:a,height:o,top:c,left:u}=s.current;if(t||!r.current||!a||!o)return;r.current.dataset.motionPopId=n;const d=document.createElement("style");return i&&(d.nonce=i),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` [data-motion-pop-id="${n}"] { position: absolute !important; width: ${a}px !important; @@ -46,82 +46,82 @@ Error generating stack: `+i.message+` top: ${c}px !important; left: ${u}px !important; } - `),()=>{document.head.removeChild(d)}},[t]),l.jsx(EF,{isPresent:t,childRef:r,sizeRef:s,children:w.cloneElement(e,{ref:r})})}const wF=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:a})=>{const o=wg(vF),c=w.useId(),u=w.useCallback(f=>{o.set(f,!0);for(const h of o.values())if(!h)return;r&&r()},[o,r]),d=w.useMemo(()=>({id:c,initial:t,isPresent:n,custom:s,onExitComplete:u,register:f=>(o.set(f,!1),()=>o.delete(f))}),i?[Math.random(),u]:[n,u]);return w.useMemo(()=>{o.forEach((f,h)=>o.set(h,!1))},[n]),w.useEffect(()=>{!n&&!o.size&&r&&r()},[n]),a==="popLayout"&&(e=l.jsx(xF,{isPresent:n,children:e})),l.jsx(vg.Provider,{value:d,children:e})};function vF(){return new Map}function BO(e=!0){const t=w.useContext(vg);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=t,i=w.useId();w.useEffect(()=>{e&&s(i)},[e]);const a=w.useCallback(()=>e&&r&&r(i),[i,r,e]);return!n&&r?[!1,a]:[!0]}const Sh=e=>e.key||"";function Kk(e){const t=[];return w.Children.forEach(e,n=>{w.isValidElement(n)&&t.push(n)}),t}const Xx=typeof window<"u",FO=Xx?w.useLayoutEffect:w.useEffect,pi=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:i="sync",propagate:a=!1})=>{const[o,c]=BO(a),u=w.useMemo(()=>Kk(e),[e]),d=a&&!o?[]:u.map(Sh),f=w.useRef(!0),h=w.useRef(u),p=wg(()=>new Map),[m,y]=w.useState(u),[E,g]=w.useState(u);FO(()=>{f.current=!1,h.current=u;for(let _=0;_{const k=Sh(_),N=a&&!o?!1:u===E||d.includes(k),C=()=>{if(p.has(k))p.set(k,!0);else return;let S=!0;p.forEach(A=>{A||(S=!1)}),S&&(b==null||b(),g(h.current),a&&(c==null||c()),r&&r())};return l.jsx(wF,{isPresent:N,initial:!f.current||n?void 0:!1,custom:N?void 0:t,presenceAffectsLayout:s,mode:i,onExitComplete:N?void 0:C,children:_},k)})})},es=e=>e;let UO=es;const _F={useManualTiming:!1};function kF(e){let t=new Set,n=new Set,r=!1,s=!1;const i=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function o(u){i.has(u)&&(c.schedule(u),e()),u(a)}const c={schedule:(u,d=!1,f=!1)=>{const p=f&&r?t:n;return d&&i.add(u),p.has(u)||p.add(u),u},cancel:u=>{n.delete(u),i.delete(u)},process:u=>{if(a=u,r){s=!0;return}r=!0,[t,n]=[n,t],t.forEach(o),t.clear(),r=!1,s&&(s=!1,c.process(u))}};return c}const Th=["read","resolveKeyframes","update","preRender","render","postRender"],NF=40;function $O(e,t){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=Th.reduce((g,x)=>(g[x]=kF(i),g),{}),{read:o,resolveKeyframes:c,update:u,preRender:d,render:f,postRender:h}=a,p=()=>{const g=performance.now();n=!1,s.delta=r?1e3/60:Math.max(Math.min(g-s.timestamp,NF),1),s.timestamp=g,s.isProcessing=!0,o.process(s),c.process(s),u.process(s),d.process(s),f.process(s),h.process(s),s.isProcessing=!1,n&&t&&(r=!1,e(p))},m=()=>{n=!0,r=!0,s.isProcessing||e(p)};return{schedule:Th.reduce((g,x)=>{const b=a[x];return g[x]=(_,k=!1,N=!1)=>(n||m(),b.schedule(_,k,N)),g},{}),cancel:g=>{for(let x=0;xYk[e].some(n=>!!t[n])};function SF(e){for(const t in e)yc[t]={...yc[t],...e[t]}}const TF=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function hm(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||TF.has(e)}let zO=e=>!hm(e);function VO(e){e&&(zO=t=>t.startsWith("on")?!hm(t):e(t))}try{VO(require("@emotion/is-prop-valid").default)}catch{}function AF(e,t,n){const r={};for(const s in e)s==="values"&&typeof e.values=="object"||(zO(s)||n===!0&&hm(s)||!t&&!hm(s)||e.draggable&&s.startsWith("onDrag"))&&(r[s]=e[s]);return r}function CF({children:e,isValidProp:t,...n}){t&&VO(t),n={...w.useContext(Fd),...n},n.isStatic=wg(()=>n.isStatic);const r=w.useMemo(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion]);return l.jsx(Fd.Provider,{value:r,children:e})}function IF(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...r)=>e(...r);return new Proxy(n,{get:(r,s)=>s==="create"?e:(t.has(s)||t.set(s,e(s)),t.get(s))})}const _g=w.createContext({});function Ud(e){return typeof e=="string"||Array.isArray(e)}function kg(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const Qx=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Zx=["initial",...Qx];function Ng(e){return kg(e.animate)||Zx.some(t=>Ud(e[t]))}function KO(e){return!!(Ng(e)||e.variants)}function OF(e,t){if(Ng(e)){const{initial:n,animate:r}=e;return{initial:n===!1||Ud(n)?n:void 0,animate:Ud(r)?r:void 0}}return e.inherit!==!1?t:{}}function RF(e){const{initial:t,animate:n}=OF(e,w.useContext(_g));return w.useMemo(()=>({initial:t,animate:n}),[Wk(t),Wk(n)])}function Wk(e){return Array.isArray(e)?e.join(" "):e}const LF=Symbol.for("motionComponentSymbol");function Dl(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function MF(e,t,n){return w.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):Dl(n)&&(n.current=r))},[t])}const Jx=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),jF="framerAppearId",YO="data-"+Jx(jF),{schedule:ew}=$O(queueMicrotask,!1),WO=w.createContext({});function DF(e,t,n,r,s){var i,a;const{visualElement:o}=w.useContext(_g),c=w.useContext(HO),u=w.useContext(vg),d=w.useContext(Fd).reducedMotion,f=w.useRef(null);r=r||c.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:d}));const h=f.current,p=w.useContext(WO);h&&!h.projection&&s&&(h.type==="html"||h.type==="svg")&&PF(f.current,n,s,p);const m=w.useRef(!1);w.useInsertionEffect(()=>{h&&m.current&&h.update(n,u)});const y=n[YO],E=w.useRef(!!y&&!(!((i=window.MotionHandoffIsComplete)===null||i===void 0)&&i.call(window,y))&&((a=window.MotionHasOptimisedAnimation)===null||a===void 0?void 0:a.call(window,y)));return FO(()=>{h&&(m.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),ew.render(h.render),E.current&&h.animationState&&h.animationState.animateChanges())}),w.useEffect(()=>{h&&(!E.current&&h.animationState&&h.animationState.animateChanges(),E.current&&(queueMicrotask(()=>{var g;(g=window.MotionHandoffMarkAsComplete)===null||g===void 0||g.call(window,y)}),E.current=!1))}),h}function PF(e,t,n,r){const{layoutId:s,layout:i,drag:a,dragConstraints:o,layoutScroll:c,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:GO(e.parent)),e.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!a||o&&Dl(o),visualElement:e,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,layoutScroll:c,layoutRoot:u})}function GO(e){if(e)return e.options.allowProjection!==!1?e.projection:GO(e.parent)}function BF({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:s}){var i,a;e&&SF(e);function o(u,d){let f;const h={...w.useContext(Fd),...u,layoutId:FF(u)},{isStatic:p}=h,m=RF(u),y=r(u,p);if(!p&&Xx){UF();const E=$F(h);f=E.MeasureLayout,m.visualElement=DF(s,y,h,t,E.ProjectionNode)}return l.jsxs(_g.Provider,{value:m,children:[f&&m.visualElement?l.jsx(f,{visualElement:m.visualElement,...h}):null,n(s,u,MF(y,m.visualElement,d),y,p,m.visualElement)]})}o.displayName=`motion.${typeof s=="string"?s:`create(${(a=(i=s.displayName)!==null&&i!==void 0?i:s.name)!==null&&a!==void 0?a:""})`}`;const c=w.forwardRef(o);return c[LF]=s,c}function FF({layoutId:e}){const t=w.useContext(qx).id;return t&&e!==void 0?t+"-"+e:e}function UF(e,t){w.useContext(HO).strict}function $F(e){const{drag:t,layout:n}=yc;if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const HF=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function tw(e){return typeof e!="string"||e.includes("-")?!1:!!(HF.indexOf(e)>-1||/[A-Z]/u.test(e))}function Gk(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function nw(e,t,n,r){if(typeof t=="function"){const[s,i]=Gk(r);t=t(n!==void 0?n:e.custom,s,i)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,i]=Gk(r);t=t(n!==void 0?n:e.custom,s,i)}return t}const _1=e=>Array.isArray(e),zF=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),VF=e=>_1(e)?e[e.length-1]||0:e,hr=e=>!!(e&&e.getVelocity);function xp(e){const t=hr(e)?e.get():e;return zF(t)?t.toValue():t}function KF({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},r,s,i){const a={latestValues:YF(r,s,i,e),renderState:t()};return n&&(a.onMount=o=>n({props:r,current:o,...a}),a.onUpdate=o=>n(o)),a}const qO=e=>(t,n)=>{const r=w.useContext(_g),s=w.useContext(vg),i=()=>KF(e,t,r,s);return n?i():wg(i)};function YF(e,t,n,r){const s={},i=r(e,{});for(const h in i)s[h]=xp(i[h]);let{initial:a,animate:o}=e;const c=Ng(e),u=KO(e);t&&u&&!c&&e.inherit!==!1&&(a===void 0&&(a=t.initial),o===void 0&&(o=t.animate));let d=n?n.initial===!1:!1;d=d||a===!1;const f=d?o:a;if(f&&typeof f!="boolean"&&!kg(f)){const h=Array.isArray(f)?f:[f];for(let p=0;pt=>typeof t=="string"&&t.startsWith(e),QO=XO("--"),WF=XO("var(--"),rw=e=>WF(e)?GF.test(e.split("/*")[0].trim()):!1,GF=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,ZO=(e,t)=>t&&typeof e=="number"?t.transform(e):e,Ji=(e,t,n)=>n>t?t:ntypeof e=="number",parse:parseFloat,transform:e=>e},$d={...Kc,transform:e=>Ji(0,1,e)},Ah={...Kc,default:1},wf=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),ha=wf("deg"),bi=wf("%"),et=wf("px"),qF=wf("vh"),XF=wf("vw"),qk={...bi,parse:e=>bi.parse(e)/100,transform:e=>bi.transform(e*100)},QF={borderWidth:et,borderTopWidth:et,borderRightWidth:et,borderBottomWidth:et,borderLeftWidth:et,borderRadius:et,radius:et,borderTopLeftRadius:et,borderTopRightRadius:et,borderBottomRightRadius:et,borderBottomLeftRadius:et,width:et,maxWidth:et,height:et,maxHeight:et,top:et,right:et,bottom:et,left:et,padding:et,paddingTop:et,paddingRight:et,paddingBottom:et,paddingLeft:et,margin:et,marginTop:et,marginRight:et,marginBottom:et,marginLeft:et,backgroundPositionX:et,backgroundPositionY:et},ZF={rotate:ha,rotateX:ha,rotateY:ha,rotateZ:ha,scale:Ah,scaleX:Ah,scaleY:Ah,scaleZ:Ah,skew:ha,skewX:ha,skewY:ha,distance:et,translateX:et,translateY:et,translateZ:et,x:et,y:et,z:et,perspective:et,transformPerspective:et,opacity:$d,originX:qk,originY:qk,originZ:et},Xk={...Kc,transform:Math.round},sw={...QF,...ZF,zIndex:Xk,size:et,fillOpacity:$d,strokeOpacity:$d,numOctaves:Xk},JF={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},e9=Vc.length;function t9(e,t,n){let r="",s=!0;for(let i=0;i({style:{},transform:{},transformOrigin:{},vars:{}}),JO=()=>({...ow(),attrs:{}}),lw=e=>typeof e=="string"&&e.toLowerCase()==="svg";function eR(e,{style:t,vars:n},r,s){Object.assign(e.style,t,s&&s.getProjectionStyles(r));for(const i in n)e.style.setProperty(i,n[i])}const tR=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function nR(e,t,n,r){eR(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(tR.has(s)?s:Jx(s),t.attrs[s])}const pm={};function a9(e){Object.assign(pm,e)}function rR(e,{layout:t,layoutId:n}){return qo.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!pm[e]||e==="opacity")}function cw(e,t,n){var r;const{style:s}=e,i={};for(const a in s)(hr(s[a])||t.style&&hr(t.style[a])||rR(a,e)||((r=n==null?void 0:n.getValue(a))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(i[a]=s[a]);return i}function sR(e,t,n){const r=cw(e,t,n);for(const s in e)if(hr(e[s])||hr(t[s])){const i=Vc.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=e[s]}return r}function o9(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const Zk=["x","y","width","height","cx","cy","r"],l9={useVisualState:qO({scrapeMotionValuesFromProps:sR,createRenderState:JO,onUpdate:({props:e,prevProps:t,current:n,renderState:r,latestValues:s})=>{if(!n)return;let i=!!e.drag;if(!i){for(const o in s)if(qo.has(o)){i=!0;break}}if(!i)return;let a=!t;if(t)for(let o=0;o{o9(n,r),Gt.render(()=>{aw(r,s,lw(n.tagName),e.transformTemplate),nR(n,r)})})}})},c9={useVisualState:qO({scrapeMotionValuesFromProps:cw,createRenderState:ow})};function iR(e,t,n){for(const r in t)!hr(t[r])&&!rR(r,n)&&(e[r]=t[r])}function u9({transformTemplate:e},t){return w.useMemo(()=>{const n=ow();return iw(n,t,e),Object.assign({},n.vars,n.style)},[t])}function d9(e,t){const n=e.style||{},r={};return iR(r,n,e),Object.assign(r,u9(e,t)),r}function f9(e,t){const n={},r=d9(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}function h9(e,t,n,r){const s=w.useMemo(()=>{const i=JO();return aw(i,t,lw(r),e.transformTemplate),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};iR(i,e.style,e),s.style={...i,...s.style}}return s}function p9(e=!1){return(n,r,s,{latestValues:i},a)=>{const c=(tw(n)?h9:f9)(r,i,a,n),u=AF(r,typeof n=="string",e),d=n!==w.Fragment?{...u,...c,ref:s}:{},{children:f}=r,h=w.useMemo(()=>hr(f)?f.get():f,[f]);return w.createElement(n,{...d,children:h})}}function m9(e,t){return function(r,{forwardMotionProps:s}={forwardMotionProps:!1}){const a={...tw(r)?l9:c9,preloadedFeatures:e,useRender:p9(s),createVisualElement:t,Component:r};return BF(a)}}function aR(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r(wp===void 0&&Ei.set(nr.isProcessing||_F.useManualTiming?nr.timestamp:performance.now()),wp),set:e=>{wp=e,queueMicrotask(g9)}};function dw(e,t){e.indexOf(t)===-1&&e.push(t)}function fw(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class hw{constructor(){this.subscriptions=[]}add(t){return dw(this.subscriptions,t),()=>fw(this.subscriptions,t)}notify(t,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,r);else for(let i=0;i!isNaN(parseFloat(e));class b9{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{const i=Ei.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),s&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Ei.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=y9(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new hw);const r=this.events[t].add(n);return t==="change"?()=>{r(),Gt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Ei.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Jk)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Jk);return lR(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Hd(e,t){return new b9(e,t)}function E9(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Hd(n))}function x9(e,t){const n=Sg(e,t);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const a in i){const o=VF(i[a]);E9(e,a,o)}}function w9(e){return!!(hr(e)&&e.add)}function k1(e,t){const n=e.getValue("willChange");if(w9(n))return n.add(t)}function cR(e){return e.props[YO]}function pw(e){let t;return()=>(t===void 0&&(t=e()),t)}const v9=pw(()=>window.ScrollTimeline!==void 0);class _9{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let r=0;r{if(v9()&&s.attachTimeline)return s.attachTimeline(t);if(typeof n=="function")return n(s)});return()=>{r.forEach((s,i)=>{s&&s(),this.animations[i].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let n=0;nn[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class k9 extends _9{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}const Yi=e=>e*1e3,Wi=e=>e/1e3;function mw(e){return typeof e=="function"}function eN(e,t){e.timeline=t,e.onfinish=null}const gw=e=>Array.isArray(e)&&typeof e[0]=="number",N9={linearEasing:void 0};function S9(e,t){const n=pw(e);return()=>{var r;return(r=N9[t])!==null&&r!==void 0?r:n()}}const mm=S9(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),bc=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},uR=(e,t,n=10)=>{let r="";const s=Math.max(Math.round(t/n),2);for(let i=0;i`cubic-bezier(${e}, ${t}, ${n}, ${r})`,N1={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Du([0,.65,.55,1]),circOut:Du([.55,0,1,.45]),backIn:Du([.31,.01,.66,-.59]),backOut:Du([.33,1.53,.69,.99])};function fR(e,t){if(e)return typeof e=="function"&&mm()?uR(e,t):gw(e)?Du(e):Array.isArray(e)?e.map(n=>fR(n,t)||N1.easeOut):N1[e]}const hR=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,T9=1e-7,A9=12;function C9(e,t,n,r,s){let i,a,o=0;do a=t+(n-t)/2,i=hR(a,r,s)-e,i>0?n=a:t=a;while(Math.abs(i)>T9&&++oC9(i,0,1,e,n);return i=>i===0||i===1?i:hR(s(i),t,r)}const pR=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,mR=e=>t=>1-e(1-t),gR=vf(.33,1.53,.69,.99),yw=mR(gR),yR=pR(yw),bR=e=>(e*=2)<1?.5*yw(e):.5*(2-Math.pow(2,-10*(e-1))),bw=e=>1-Math.sin(Math.acos(e)),ER=mR(bw),xR=pR(bw),wR=e=>/^0[^.\s]+$/u.test(e);function I9(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||wR(e):!0}const nd=e=>Math.round(e*1e5)/1e5,Ew=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function O9(e){return e==null}const R9=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,xw=(e,t)=>n=>!!(typeof n=="string"&&R9.test(n)&&n.startsWith(e)||t&&!O9(n)&&Object.prototype.hasOwnProperty.call(n,t)),vR=(e,t,n)=>r=>{if(typeof r!="string")return r;const[s,i,a,o]=r.match(Ew);return{[e]:parseFloat(s),[t]:parseFloat(i),[n]:parseFloat(a),alpha:o!==void 0?parseFloat(o):1}},L9=e=>Ji(0,255,e),iy={...Kc,transform:e=>Math.round(L9(e))},Eo={test:xw("rgb","red"),parse:vR("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+iy.transform(e)+", "+iy.transform(t)+", "+iy.transform(n)+", "+nd($d.transform(r))+")"};function M9(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const S1={test:xw("#"),parse:M9,transform:Eo.transform},Pl={test:xw("hsl","hue"),parse:vR("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+bi.transform(nd(t))+", "+bi.transform(nd(n))+", "+nd($d.transform(r))+")"},dr={test:e=>Eo.test(e)||S1.test(e)||Pl.test(e),parse:e=>Eo.test(e)?Eo.parse(e):Pl.test(e)?Pl.parse(e):S1.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Eo.transform(e):Pl.transform(e)},j9=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function D9(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Ew))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(j9))===null||n===void 0?void 0:n.length)||0)>0}const _R="number",kR="color",P9="var",B9="var(",tN="${}",F9=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function zd(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const o=t.replace(F9,c=>(dr.test(c)?(r.color.push(i),s.push(kR),n.push(dr.parse(c))):c.startsWith(B9)?(r.var.push(i),s.push(P9),n.push(c)):(r.number.push(i),s.push(_R),n.push(parseFloat(c))),++i,tN)).split(tN);return{values:n,split:o,indexes:r,types:s}}function NR(e){return zd(e).values}function SR(e){const{split:t,types:n}=zd(e),r=t.length;return s=>{let i="";for(let a=0;atypeof e=="number"?0:e;function $9(e){const t=NR(e);return SR(e)(t.map(U9))}const $a={test:D9,parse:NR,createTransformer:SR,getAnimatableNone:$9},H9=new Set(["brightness","contrast","saturate","opacity"]);function z9(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(Ew)||[];if(!r)return e;const s=n.replace(r,"");let i=H9.has(t)?1:0;return r!==n&&(i*=100),t+"("+i+s+")"}const V9=/\b([a-z-]*)\(.*?\)/gu,T1={...$a,getAnimatableNone:e=>{const t=e.match(V9);return t?t.map(z9).join(" "):e}},K9={...sw,color:dr,backgroundColor:dr,outlineColor:dr,fill:dr,stroke:dr,borderColor:dr,borderTopColor:dr,borderRightColor:dr,borderBottomColor:dr,borderLeftColor:dr,filter:T1,WebkitFilter:T1},ww=e=>K9[e];function TR(e,t){let n=ww(e);return n!==T1&&(n=$a),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const Y9=new Set(["auto","none","0"]);function W9(e,t,n){let r=0,s;for(;re===Kc||e===et,rN=(e,t)=>parseFloat(e.split(", ")[t]),sN=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/u);if(s)return rN(s[1],t);{const i=r.match(/^matrix\((.+)\)$/u);return i?rN(i[1],e):0}},G9=new Set(["x","y","z"]),q9=Vc.filter(e=>!G9.has(e));function X9(e){const t=[];return q9.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const Ec={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:sN(4,13),y:sN(5,14)};Ec.translateX=Ec.x;Ec.translateY=Ec.y;const So=new Set;let A1=!1,C1=!1;function AR(){if(C1){const e=Array.from(So).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const s=X9(r);s.length&&(n.set(r,s),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,a])=>{var o;(o=r.getValue(i))===null||o===void 0||o.set(a)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}C1=!1,A1=!1,So.forEach(e=>e.complete()),So.clear()}function CR(){So.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(C1=!0)})}function Q9(){CR(),AR()}class vw{constructor(t,n,r,s,i,a=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(So.add(this),A1||(A1=!0,Gt.read(CR),Gt.resolveKeyframes(AR))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:s}=this;for(let i=0;i/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),Z9=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function J9(e){const t=Z9.exec(e);if(!t)return[,];const[,n,r,s]=t;return[`--${n??r}`,s]}function OR(e,t,n=1){const[r,s]=J9(e);if(!r)return;const i=window.getComputedStyle(t).getPropertyValue(r);if(i){const a=i.trim();return IR(a)?parseFloat(a):a}return rw(s)?OR(s,t,n+1):s}const RR=e=>t=>t.test(e),eU={test:e=>e==="auto",parse:e=>e},LR=[Kc,et,bi,ha,XF,qF,eU],iN=e=>LR.find(RR(e));class MR extends vw{constructor(t,n,r,s,i){super(t,n,r,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c{n.getValue(c).set(u)}),this.resolveNoneKeyframes()}}const aN=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&($a.test(e)||e==="0")&&!e.startsWith("url("));function tU(e){const t=e[0];if(e.length===1)return!0;for(let n=0;ne!==null;function Tg(e,{repeat:t,repeatType:n="loop"},r){const s=e.filter(rU),i=t&&n!=="loop"&&t%2===1?0:s.length-1;return!i||r===void 0?s[i]:r}const sU=40;class jR{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:a="loop",...o}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Ei.now(),this.options={autoplay:t,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:a,...o},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>sU?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&Q9(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=Ei.now(),this.hasAttemptedResolve=!0;const{name:r,type:s,velocity:i,delay:a,onComplete:o,onUpdate:c,isGenerator:u}=this.options;if(!u&&!nU(t,r,s,i))if(a)this.options.duration=0;else{c&&c(Tg(t,this.options,n)),o&&o(),this.resolveFinishedPromise();return}const d=this.initPlayback(t,n);d!==!1&&(this._resolved={keyframes:t,finalKeyframe:n,...d},this.onPostResolved())}onPostResolved(){}then(t,n){return this.currentFinishedPromise.then(t,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const I1=2e4;function DR(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=I1?1/0:t}const cn=(e,t,n)=>e+(t-e)*n;function ay(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function iU({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let s=0,i=0,a=0;if(!t)s=i=a=n;else{const o=n<.5?n*(1+t):n+t-n*t,c=2*n-o;s=ay(c,o,e+1/3),i=ay(c,o,e),a=ay(c,o,e-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(a*255),alpha:r}}function gm(e,t){return n=>n>0?t:e}const oy=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},aU=[S1,Eo,Pl],oU=e=>aU.find(t=>t.test(e));function oN(e){const t=oU(e);if(!t)return!1;let n=t.parse(e);return t===Pl&&(n=iU(n)),n}const lN=(e,t)=>{const n=oN(e),r=oN(t);if(!n||!r)return gm(e,t);const s={...n};return i=>(s.red=oy(n.red,r.red,i),s.green=oy(n.green,r.green,i),s.blue=oy(n.blue,r.blue,i),s.alpha=cn(n.alpha,r.alpha,i),Eo.transform(s))},lU=(e,t)=>n=>t(e(n)),_f=(...e)=>e.reduce(lU),O1=new Set(["none","hidden"]);function cU(e,t){return O1.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function uU(e,t){return n=>cn(e,t,n)}function _w(e){return typeof e=="number"?uU:typeof e=="string"?rw(e)?gm:dr.test(e)?lN:hU:Array.isArray(e)?PR:typeof e=="object"?dr.test(e)?lN:dU:gm}function PR(e,t){const n=[...e],r=n.length,s=e.map((i,a)=>_w(i)(i,t[a]));return i=>{for(let a=0;a{for(const i in r)n[i]=r[i](s);return n}}function fU(e,t){var n;const r=[],s={color:0,var:0,number:0};for(let i=0;i{const n=$a.createTransformer(t),r=zd(e),s=zd(t);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?O1.has(e)&&!s.values.length||O1.has(t)&&!r.values.length?cU(e,t):_f(PR(fU(r,s),s.values),n):gm(e,t)};function BR(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?cn(e,t,n):_w(e)(e,t)}const pU=5;function FR(e,t,n){const r=Math.max(t-pU,0);return lR(n-e(r),t-r)}const gn={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},ly=.001;function mU({duration:e=gn.duration,bounce:t=gn.bounce,velocity:n=gn.velocity,mass:r=gn.mass}){let s,i,a=1-t;a=Ji(gn.minDamping,gn.maxDamping,a),e=Ji(gn.minDuration,gn.maxDuration,Wi(e)),a<1?(s=u=>{const d=u*a,f=d*e,h=d-n,p=R1(u,a),m=Math.exp(-f);return ly-h/p*m},i=u=>{const f=u*a*e,h=f*n+n,p=Math.pow(a,2)*Math.pow(u,2)*e,m=Math.exp(-f),y=R1(Math.pow(u,2),a);return(-s(u)+ly>0?-1:1)*((h-p)*m)/y}):(s=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-ly+d*f},i=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const o=5/e,c=yU(s,i,o);if(e=Yi(e),isNaN(c))return{stiffness:gn.stiffness,damping:gn.damping,duration:e};{const u=Math.pow(c,2)*r;return{stiffness:u,damping:a*2*Math.sqrt(r*u),duration:e}}}const gU=12;function yU(e,t,n){let r=n;for(let s=1;se[n]!==void 0)}function xU(e){let t={velocity:gn.velocity,stiffness:gn.stiffness,damping:gn.damping,mass:gn.mass,isResolvedFromDuration:!1,...e};if(!cN(e,EU)&&cN(e,bU))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*Ji(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:gn.mass,stiffness:s,damping:i}}else{const n=mU(e);t={...t,...n,mass:gn.mass},t.isResolvedFromDuration=!0}return t}function UR(e=gn.visualDuration,t=gn.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:s}=n;const i=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],o={done:!1,value:i},{stiffness:c,damping:u,mass:d,duration:f,velocity:h,isResolvedFromDuration:p}=xU({...n,velocity:-Wi(n.velocity||0)}),m=h||0,y=u/(2*Math.sqrt(c*d)),E=a-i,g=Wi(Math.sqrt(c/d)),x=Math.abs(E)<5;r||(r=x?gn.restSpeed.granular:gn.restSpeed.default),s||(s=x?gn.restDelta.granular:gn.restDelta.default);let b;if(y<1){const k=R1(g,y);b=N=>{const C=Math.exp(-y*g*N);return a-C*((m+y*g*E)/k*Math.sin(k*N)+E*Math.cos(k*N))}}else if(y===1)b=k=>a-Math.exp(-g*k)*(E+(m+g*E)*k);else{const k=g*Math.sqrt(y*y-1);b=N=>{const C=Math.exp(-y*g*N),S=Math.min(k*N,300);return a-C*((m+y*g*E)*Math.sinh(S)+k*E*Math.cosh(S))/k}}const _={calculatedDuration:p&&f||null,next:k=>{const N=b(k);if(p)o.done=k>=f;else{let C=0;y<1&&(C=k===0?Yi(m):FR(b,k,N));const S=Math.abs(C)<=r,A=Math.abs(a-N)<=s;o.done=S&&A}return o.value=o.done?a:N,o},toString:()=>{const k=Math.min(DR(_),I1),N=uR(C=>_.next(k*C).value,k,30);return k+"ms "+N}};return _}function uN({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:a,min:o,max:c,restDelta:u=.5,restSpeed:d}){const f=e[0],h={done:!1,value:f},p=S=>o!==void 0&&Sc,m=S=>o===void 0?c:c===void 0||Math.abs(o-S)-y*Math.exp(-S/r),b=S=>g+x(S),_=S=>{const A=x(S),O=b(S);h.done=Math.abs(A)<=u,h.value=h.done?g:O};let k,N;const C=S=>{p(h.value)&&(k=S,N=UR({keyframes:[h.value,m(h.value)],velocity:FR(b,S,h.value),damping:s,stiffness:i,restDelta:u,restSpeed:d}))};return C(0),{calculatedDuration:null,next:S=>{let A=!1;return!N&&k===void 0&&(A=!0,_(S),C(S)),k!==void 0&&S>=k?N.next(S-k):(!A&&_(S),h)}}}const wU=vf(.42,0,1,1),vU=vf(0,0,.58,1),$R=vf(.42,0,.58,1),_U=e=>Array.isArray(e)&&typeof e[0]!="number",kU={linear:es,easeIn:wU,easeInOut:$R,easeOut:vU,circIn:bw,circInOut:xR,circOut:ER,backIn:yw,backInOut:yR,backOut:gR,anticipate:bR},dN=e=>{if(gw(e)){UO(e.length===4);const[t,n,r,s]=e;return vf(t,n,r,s)}else if(typeof e=="string")return kU[e];return e};function NU(e,t,n){const r=[],s=n||BR,i=e.length-1;for(let a=0;at[0];if(i===2&&t[0]===t[1])return()=>t[1];const a=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const o=NU(t,r,s),c=o.length,u=d=>{if(a&&d1)for(;fu(Ji(e[0],e[i-1],d)):u}function TU(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=bc(0,t,r);e.push(cn(n,1,s))}}function AU(e){const t=[0];return TU(t,e.length-1),t}function CU(e,t){return e.map(n=>n*t)}function IU(e,t){return e.map(()=>t||$R).splice(0,e.length-1)}function ym({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const s=_U(r)?r.map(dN):dN(r),i={done:!1,value:t[0]},a=CU(n&&n.length===t.length?n:AU(t),e),o=SU(a,t,{ease:Array.isArray(s)?s:IU(t,s)});return{calculatedDuration:e,next:c=>(i.value=o(c),i.done=c>=e,i)}}const OU=e=>{const t=({timestamp:n})=>e(n);return{start:()=>Gt.update(t,!0),stop:()=>Ua(t),now:()=>nr.isProcessing?nr.timestamp:Ei.now()}},RU={decay:uN,inertia:uN,tween:ym,keyframes:ym,spring:UR},LU=e=>e/100;class kw extends jR{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:c}=this.options;c&&c()};const{name:n,motionValue:r,element:s,keyframes:i}=this.options,a=(s==null?void 0:s.KeyframeResolver)||vw,o=(c,u)=>this.onKeyframesResolved(c,u);this.resolver=new a(i,o,n,r,s),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:n="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:a=0}=this.options,o=mw(n)?n:RU[n]||ym;let c,u;o!==ym&&typeof t[0]!="number"&&(c=_f(LU,BR(t[0],t[1])),t=[0,100]);const d=o({...this.options,keyframes:t});i==="mirror"&&(u=o({...this.options,keyframes:[...t].reverse(),velocity:-a})),d.calculatedDuration===null&&(d.calculatedDuration=DR(d));const{calculatedDuration:f}=d,h=f+s,p=h*(r+1)-s;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:c,calculatedDuration:f,resolvedDuration:h,totalDuration:p}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:r}=this;if(!r){const{keyframes:S}=this.options;return{done:!0,value:S[S.length-1]}}const{finalKeyframe:s,generator:i,mirroredGenerator:a,mapPercentToKeyframes:o,keyframes:c,calculatedDuration:u,totalDuration:d,resolvedDuration:f}=r;if(this.startTime===null)return i.next(0);const{delay:h,repeat:p,repeatType:m,repeatDelay:y,onUpdate:E}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-d/this.speed,this.startTime)),n?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const g=this.currentTime-h*(this.speed>=0?1:-1),x=this.speed>=0?g<0:g>d;this.currentTime=Math.max(g,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let b=this.currentTime,_=i;if(p){const S=Math.min(this.currentTime,d)/f;let A=Math.floor(S),O=S%1;!O&&S>=1&&(O=1),O===1&&A--,A=Math.min(A,p+1),!!(A%2)&&(m==="reverse"?(O=1-O,y&&(O-=y/f)):m==="mirror"&&(_=a)),b=Ji(0,1,O)*f}const k=x?{done:!1,value:c[0]}:_.next(b);o&&(k.value=o(k.value));let{done:N}=k;!x&&u!==null&&(N=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const C=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&N);return C&&s!==void 0&&(k.value=Tg(c,this.options,s)),E&&E(k.value),C&&this.finish(),k}get duration(){const{resolved:t}=this;return t?Wi(t.calculatedDuration):0}get time(){return Wi(this.currentTime)}set time(t){t=Yi(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=Wi(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=OU,onPlay:n,startTime:r}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),n&&n();const s=this.driver.now();this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=s):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const MU=new Set(["opacity","clipPath","filter","transform"]);function jU(e,t,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:a="loop",ease:o="easeInOut",times:c}={}){const u={[t]:n};c&&(u.offset=c);const d=fR(o,s);return Array.isArray(d)&&(u.easing=d),e.animate(u,{delay:r,duration:s,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:i+1,direction:a==="reverse"?"alternate":"normal"})}const DU=pw(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),bm=10,PU=2e4;function BU(e){return mw(e.type)||e.type==="spring"||!dR(e.ease)}function FU(e,t){const n=new kw({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:e[0]};const s=[];let i=0;for(;!r.done&&ithis.onKeyframesResolved(a,o),n,r,s),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:r=300,times:s,ease:i,type:a,motionValue:o,name:c,startTime:u}=this.options;if(!o.owner||!o.owner.current)return!1;if(typeof i=="string"&&mm()&&UU(i)&&(i=HR[i]),BU(this.options)){const{onComplete:f,onUpdate:h,motionValue:p,element:m,...y}=this.options,E=FU(t,y);t=E.keyframes,t.length===1&&(t[1]=t[0]),r=E.duration,s=E.times,i=E.ease,a="keyframes"}const d=jU(o.owner.current,c,t,{...this.options,duration:r,times:s,ease:i});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(eN(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:f}=this.options;o.set(Tg(t,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:r,times:s,type:a,ease:i,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return Wi(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return Wi(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=Yi(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:n}=t;return n.playbackRate}set speed(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:n}=t;return n.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:n}=t;return n.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:n}=this;if(!n)return es;const{animation:r}=n;eN(r,t)}return es}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:n,keyframes:r,duration:s,type:i,ease:a,times:o}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:d,onComplete:f,element:h,...p}=this.options,m=new kw({...p,keyframes:r,duration:s,type:i,ease:a,times:o,isGenerator:!0}),y=Yi(this.time);u.setWithVelocity(m.sample(y-bm).value,m.sample(y).value,bm)}const{onStop:c}=this.options;c&&c(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:n,name:r,repeatDelay:s,repeatType:i,damping:a,type:o}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=n.owner.getProps();return DU()&&r&&MU.has(r)&&!c&&!u&&!s&&i!=="mirror"&&a!==0&&o!=="inertia"}}const $U={type:"spring",stiffness:500,damping:25,restSpeed:10},HU=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),zU={type:"keyframes",duration:.8},VU={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},KU=(e,{keyframes:t})=>t.length>2?zU:qo.has(e)?e.startsWith("scale")?HU(t[1]):$U:VU;function YU({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:a,repeatDelay:o,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const Nw=(e,t,n,r={},s,i)=>a=>{const o=uw(r,e)||{},c=o.delay||r.delay||0;let{elapsed:u=0}=r;u=u-Yi(c);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...o,delay:-u,onUpdate:h=>{t.set(h),o.onUpdate&&o.onUpdate(h)},onComplete:()=>{a(),o.onComplete&&o.onComplete()},name:e,motionValue:t,element:i?void 0:s};YU(o)||(d={...d,...KU(e,d)}),d.duration&&(d.duration=Yi(d.duration)),d.repeatDelay&&(d.repeatDelay=Yi(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(f=!0)),f&&!i&&t.get()!==void 0){const h=Tg(d.keyframes,o);if(h!==void 0)return Gt.update(()=>{d.onUpdate(h),d.onComplete()}),new k9([])}return!i&&fN.supports(d)?new fN(d):new kw(d)};function WU({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function zR(e,t,{delay:n=0,transitionOverride:r,type:s}={}){var i;let{transition:a=e.getDefaultTransition(),transitionEnd:o,...c}=t;r&&(a=r);const u=[],d=s&&e.animationState&&e.animationState.getState()[s];for(const f in c){const h=e.getValue(f,(i=e.latestValues[f])!==null&&i!==void 0?i:null),p=c[f];if(p===void 0||d&&WU(d,f))continue;const m={delay:n,...uw(a||{},f)};let y=!1;if(window.MotionHandoffAnimation){const g=cR(e);if(g){const x=window.MotionHandoffAnimation(g,f,Gt);x!==null&&(m.startTime=x,y=!0)}}k1(e,f),h.start(Nw(f,h,p,e.shouldReduceMotion&&oR.has(f)?{type:!1}:m,e,y));const E=h.animation;E&&u.push(E)}return o&&Promise.all(u).then(()=>{Gt.update(()=>{o&&x9(e,o)})}),u}function L1(e,t,n={}){var r;const s=Sg(e,t,n.type==="exit"?(r=e.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const a=s?()=>Promise.all(zR(e,s,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=i;return GU(e,t,d+u,f,h,n)}:()=>Promise.resolve(),{when:c}=i;if(c){const[u,d]=c==="beforeChildren"?[a,o]:[o,a];return u().then(()=>d())}else return Promise.all([a(),o(n.delay)])}function GU(e,t,n=0,r=0,s=1,i){const a=[],o=(e.variantChildren.size-1)*r,c=s===1?(u=0)=>u*r:(u=0)=>o-u*r;return Array.from(e.variantChildren).sort(qU).forEach((u,d)=>{u.notify("AnimationStart",t),a.push(L1(u,t,{...i,delay:n+c(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function qU(e,t){return e.sortNodePosition(t)}function XU(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const s=t.map(i=>L1(e,i,n));r=Promise.all(s)}else if(typeof t=="string")r=L1(e,t,n);else{const s=typeof t=="function"?Sg(e,t,n.custom):t;r=Promise.all(zR(e,s,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const QU=Zx.length;function VR(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?VR(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;nPromise.all(t.map(({animation:n,options:r})=>XU(e,n,r)))}function t$(e){let t=e$(e),n=hN(),r=!0;const s=c=>(u,d)=>{var f;const h=Sg(e,d,c==="exit"?(f=e.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(h){const{transition:p,transitionEnd:m,...y}=h;u={...u,...y,...m}}return u};function i(c){t=c(e)}function a(c){const{props:u}=e,d=VR(e.parent)||{},f=[],h=new Set;let p={},m=1/0;for(let E=0;Em&&_,A=!1;const O=Array.isArray(b)?b:[b];let D=O.reduce(s(g),{});k===!1&&(D={});const{prevResolvedValues:U={}}=x,X={...U,...D},M=L=>{S=!0,h.has(L)&&(A=!0,h.delete(L)),x.needsAnimating[L]=!0;const R=e.getValue(L);R&&(R.liveStyle=!1)};for(const L in X){const R=D[L],F=U[L];if(p.hasOwnProperty(L))continue;let I=!1;_1(R)&&_1(F)?I=!aR(R,F):I=R!==F,I?R!=null?M(L):h.add(L):R!==void 0&&h.has(L)?M(L):x.protectedKeys[L]=!0}x.prevProp=b,x.prevResolvedValues=D,x.isActive&&(p={...p,...D}),r&&e.blockInitialAnimation&&(S=!1),S&&(!(N&&C)||A)&&f.push(...O.map(L=>({animation:L,options:{type:g}})))}if(h.size){const E={};h.forEach(g=>{const x=e.getBaseTarget(g),b=e.getValue(g);b&&(b.liveStyle=!0),E[g]=x??null}),f.push({animation:E})}let y=!!f.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(y=!1),r=!1,y?t(f):Promise.resolve()}function o(c,u){var d;if(n[c].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(c,u)}),n[c].isActive=u;const f=a(c);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:a,setActive:o,setAnimateFunction:i,getState:()=>n,reset:()=>{n=hN(),r=!0}}}function n$(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!aR(t,e):!1}function no(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function hN(){return{animate:no(!0),whileInView:no(),whileHover:no(),whileTap:no(),whileDrag:no(),whileFocus:no(),exit:no()}}class Ka{constructor(t){this.isMounted=!1,this.node=t}update(){}}class r$ extends Ka{constructor(t){super(t),t.animationState||(t.animationState=t$(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();kg(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let s$=0;class i$ extends Ka{constructor(){super(...arguments),this.id=s$++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const s=this.node.animationState.setActive("exit",!t);n&&!t&&s.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const a$={animation:{Feature:r$},exit:{Feature:i$}},Ps={x:!1,y:!1};function KR(){return Ps.x||Ps.y}function o$(e){return e==="x"||e==="y"?Ps[e]?null:(Ps[e]=!0,()=>{Ps[e]=!1}):Ps.x||Ps.y?null:(Ps.x=Ps.y=!0,()=>{Ps.x=Ps.y=!1})}const Sw=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function Vd(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function kf(e){return{point:{x:e.pageX,y:e.pageY}}}const l$=e=>t=>Sw(t)&&e(t,kf(t));function rd(e,t,n,r){return Vd(e,t,l$(n),r)}const pN=(e,t)=>Math.abs(e-t);function c$(e,t){const n=pN(e.x,t.x),r=pN(e.y,t.y);return Math.sqrt(n**2+r**2)}class YR{constructor(t,n,{transformPagePoint:r,contextWindow:s,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=uy(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,p=c$(f.offset,{x:0,y:0})>=3;if(!h&&!p)return;const{point:m}=f,{timestamp:y}=nr;this.history.push({...m,timestamp:y});const{onStart:E,onMove:g}=this.handlers;h||(E&&E(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),g&&g(this.lastMoveEvent,f)},this.handlePointerMove=(f,h)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=cy(h,this.transformPagePoint),Gt.update(this.updatePoint,!0)},this.handlePointerUp=(f,h)=>{this.end();const{onEnd:p,onSessionEnd:m,resumeAnimation:y}=this.handlers;if(this.dragSnapToOrigin&&y&&y(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const E=uy(f.type==="pointercancel"?this.lastMoveEventInfo:cy(h,this.transformPagePoint),this.history);this.startEvent&&p&&p(f,E),m&&m(f,E)},!Sw(t))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.contextWindow=s||window;const a=kf(t),o=cy(a,this.transformPagePoint),{point:c}=o,{timestamp:u}=nr;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,uy(o,this.history)),this.removeListeners=_f(rd(this.contextWindow,"pointermove",this.handlePointerMove),rd(this.contextWindow,"pointerup",this.handlePointerUp),rd(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Ua(this.updatePoint)}}function cy(e,t){return t?{point:t(e.point)}:e}function mN(e,t){return{x:e.x-t.x,y:e.y-t.y}}function uy({point:e},t){return{point:e,delta:mN(e,WR(t)),offset:mN(e,u$(t)),velocity:d$(t,.1)}}function u$(e){return e[0]}function WR(e){return e[e.length-1]}function d$(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=WR(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>Yi(t)));)n--;if(!r)return{x:0,y:0};const i=Wi(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const a={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}const GR=1e-4,f$=1-GR,h$=1+GR,qR=.01,p$=0-qR,m$=0+qR;function rs(e){return e.max-e.min}function g$(e,t,n){return Math.abs(e-t)<=n}function gN(e,t,n,r=.5){e.origin=r,e.originPoint=cn(t.min,t.max,e.origin),e.scale=rs(n)/rs(t),e.translate=cn(n.min,n.max,e.origin)-e.originPoint,(e.scale>=f$&&e.scale<=h$||isNaN(e.scale))&&(e.scale=1),(e.translate>=p$&&e.translate<=m$||isNaN(e.translate))&&(e.translate=0)}function sd(e,t,n,r){gN(e.x,t.x,n.x,r?r.originX:void 0),gN(e.y,t.y,n.y,r?r.originY:void 0)}function yN(e,t,n){e.min=n.min+t.min,e.max=e.min+rs(t)}function y$(e,t,n){yN(e.x,t.x,n.x),yN(e.y,t.y,n.y)}function bN(e,t,n){e.min=t.min-n.min,e.max=e.min+rs(t)}function id(e,t,n){bN(e.x,t.x,n.x),bN(e.y,t.y,n.y)}function b$(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?cn(n,e,r.max):Math.min(e,n)),e}function EN(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function E$(e,{top:t,left:n,bottom:r,right:s}){return{x:EN(e.x,n,s),y:EN(e.y,t,r)}}function xN(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=bc(t.min,t.max-r,e.min):r>s&&(n=bc(e.min,e.max-s,t.min)),Ji(0,1,n)}function v$(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const M1=.35;function _$(e=M1){return e===!1?e=0:e===!0&&(e=M1),{x:wN(e,"left","right"),y:wN(e,"top","bottom")}}function wN(e,t,n){return{min:vN(e,t),max:vN(e,n)}}function vN(e,t){return typeof e=="number"?e:e[t]||0}const _N=()=>({translate:0,scale:1,origin:0,originPoint:0}),Bl=()=>({x:_N(),y:_N()}),kN=()=>({min:0,max:0}),xn=()=>({x:kN(),y:kN()});function hs(e){return[e("x"),e("y")]}function XR({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function k$({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function N$(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function dy(e){return e===void 0||e===1}function j1({scale:e,scaleX:t,scaleY:n}){return!dy(e)||!dy(t)||!dy(n)}function oo(e){return j1(e)||QR(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function QR(e){return NN(e.x)||NN(e.y)}function NN(e){return e&&e!=="0%"}function Em(e,t,n){const r=e-n,s=t*r;return n+s}function SN(e,t,n,r,s){return s!==void 0&&(e=Em(e,s,r)),Em(e,n,r)+t}function D1(e,t=0,n=1,r,s){e.min=SN(e.min,t,n,r,s),e.max=SN(e.max,t,n,r,s)}function ZR(e,{x:t,y:n}){D1(e.x,t.translate,t.scale,t.originPoint),D1(e.y,n.translate,n.scale,n.originPoint)}const TN=.999999999999,AN=1.0000000000001;function S$(e,t,n,r=!1){const s=n.length;if(!s)return;t.x=t.y=1;let i,a;for(let o=0;oTN&&(t.x=1),t.yTN&&(t.y=1)}function Fl(e,t){e.min=e.min+t,e.max=e.max+t}function CN(e,t,n,r,s=.5){const i=cn(e.min,e.max,s);D1(e,t,n,i,r)}function Ul(e,t){CN(e.x,t.x,t.scaleX,t.scale,t.originX),CN(e.y,t.y,t.scaleY,t.scale,t.originY)}function JR(e,t){return XR(N$(e.getBoundingClientRect(),t))}function T$(e,t,n){const r=JR(e,n),{scroll:s}=t;return s&&(Fl(r.x,s.offset.x),Fl(r.y,s.offset.y)),r}const eL=({current:e})=>e?e.ownerDocument.defaultView:null,A$=new WeakMap;class C${constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=xn(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=d=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(kf(d).point)},i=(d,f)=>{const{drag:h,dragPropagation:p,onDragStart:m}=this.getProps();if(h&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=o$(h),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),hs(E=>{let g=this.getAxisMotionValue(E).get()||0;if(bi.test(g)){const{projection:x}=this.visualElement;if(x&&x.layout){const b=x.layout.layoutBox[E];b&&(g=rs(b)*(parseFloat(g)/100))}}this.originPoint[E]=g}),m&&Gt.postRender(()=>m(d,f)),k1(this.visualElement,"transform");const{animationState:y}=this.visualElement;y&&y.setActive("whileDrag",!0)},a=(d,f)=>{const{dragPropagation:h,dragDirectionLock:p,onDirectionLock:m,onDrag:y}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:E}=f;if(p&&this.currentDirection===null){this.currentDirection=I$(E),this.currentDirection!==null&&m&&m(this.currentDirection);return}this.updateAxis("x",f.point,E),this.updateAxis("y",f.point,E),this.visualElement.render(),y&&y(d,f)},o=(d,f)=>this.stop(d,f),c=()=>hs(d=>{var f;return this.getAnimationState(d)==="paused"&&((f=this.getAxisMotionValue(d).animation)===null||f===void 0?void 0:f.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new YR(t,{onSessionStart:s,onStart:i,onMove:a,onSessionEnd:o,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:eL(this.visualElement)})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=n;this.startAnimation(s);const{onDragEnd:i}=this.getProps();i&&Gt.postRender(()=>i(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:s}=this.getProps();if(!r||!Ch(t,s,this.currentDirection))return;const i=this.getAxisMotionValue(t);let a=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(a=b$(a,this.constraints[t],this.elastic[t])),i.set(a)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:r}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,i=this.constraints;n&&Dl(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&s?this.constraints=E$(s.layoutBox,n):this.constraints=!1,this.elastic=_$(r),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&hs(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=v$(s.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Dl(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=T$(r,s.root,this.visualElement.getTransformPagePoint());let a=x$(s.layout.layoutBox,i);if(n){const o=n(k$(a));this.hasMutatedConstraints=!!o,o&&(a=XR(o))}return a}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),c=this.constraints||{},u=hs(d=>{if(!Ch(d,n,this.currentDirection))return;let f=c&&c[d]||{};a&&(f={min:0,max:0});const h=s?200:1e6,p=s?40:1e7,m={type:"inertia",velocity:r?t[d]:0,bounceStiffness:h,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...i,...f};return this.startAxisValueAnimation(d,m)});return Promise.all(u).then(o)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return k1(this.visualElement,t),r.start(Nw(t,r,0,n,this.visualElement,!1))}stopAnimation(){hs(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){hs(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){hs(n=>{const{drag:r}=this.getProps();if(!Ch(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:a,max:o}=s.layout.layoutBox[n];i.set(t[n]-cn(a,o,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Dl(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};hs(a=>{const o=this.getAxisMotionValue(a);if(o&&this.constraints!==!1){const c=o.get();s[a]=w$({min:c,max:c},this.constraints[a])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),hs(a=>{if(!Ch(a,t,null))return;const o=this.getAxisMotionValue(a),{min:c,max:u}=this.constraints[a];o.set(cn(c,u,s[a]))})}addListeners(){if(!this.visualElement.current)return;A$.set(this.visualElement,this);const t=this.visualElement.current,n=rd(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();Dl(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),Gt.read(r);const a=Vd(window,"resize",()=>this.scalePositionWithinConstraints()),o=s.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(hs(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=c[d].translate,f.set(f.get()+c[d].translate))}),this.visualElement.render())});return()=>{a(),n(),i(),o&&o()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:a=M1,dragMomentum:o=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:a,dragMomentum:o}}}function Ch(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function I$(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class O$ extends Ka{constructor(t){super(t),this.removeGroupControls=es,this.removeListeners=es,this.controls=new C$(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||es}unmount(){this.removeGroupControls(),this.removeListeners()}}const IN=e=>(t,n)=>{e&&Gt.postRender(()=>e(t,n))};class R$ extends Ka{constructor(){super(...arguments),this.removePointerDownListener=es}onPointerDown(t){this.session=new YR(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:eL(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:IN(t),onStart:IN(n),onMove:r,onEnd:(i,a)=>{delete this.session,s&&Gt.postRender(()=>s(i,a))}}}mount(){this.removePointerDownListener=rd(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const vp={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function ON(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const yu={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(et.test(e))e=parseFloat(e);else return e;const n=ON(e,t.target.x),r=ON(e,t.target.y);return`${n}% ${r}%`}},L$={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,s=$a.parse(e);if(s.length>5)return r;const i=$a.createTransformer(e),a=typeof s[0]!="number"?1:0,o=n.x.scale*t.x,c=n.y.scale*t.y;s[0+a]/=o,s[1+a]/=c;const u=cn(o,c,.5);return typeof s[2+a]=="number"&&(s[2+a]/=u),typeof s[3+a]=="number"&&(s[3+a]/=u),i(s)}};class M$ extends w.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=t;a9(j$),i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),vp.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,a=r.projection;return a&&(a.isPresent=i,s||t.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?a.promote():a.relegate()||Gt.postRender(()=>{const o=a.getStack();(!o||!o.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),ew.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=t;s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function tL(e){const[t,n]=BO(),r=w.useContext(qx);return l.jsx(M$,{...e,layoutGroup:r,switchLayoutGroup:w.useContext(WO),isPresent:t,safeToRemove:n})}const j$={borderRadius:{...yu,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:yu,borderTopRightRadius:yu,borderBottomLeftRadius:yu,borderBottomRightRadius:yu,boxShadow:L$};function D$(e,t,n){const r=hr(e)?e:Hd(e);return r.start(Nw("",r,t,n)),r.animation}function P$(e){return e instanceof SVGElement&&e.tagName!=="svg"}const B$=(e,t)=>e.depth-t.depth;class F${constructor(){this.children=[],this.isDirty=!1}add(t){dw(this.children,t),this.isDirty=!0}remove(t){fw(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(B$),this.isDirty=!1,this.children.forEach(t)}}function U$(e,t){const n=Ei.now(),r=({timestamp:s})=>{const i=s-n;i>=t&&(Ua(r),e(i-t))};return Gt.read(r,!0),()=>Ua(r)}const nL=["TopLeft","TopRight","BottomLeft","BottomRight"],$$=nL.length,RN=e=>typeof e=="string"?parseFloat(e):e,LN=e=>typeof e=="number"||et.test(e);function H$(e,t,n,r,s,i){s?(e.opacity=cn(0,n.opacity!==void 0?n.opacity:1,z$(r)),e.opacityExit=cn(t.opacity!==void 0?t.opacity:1,0,V$(r))):i&&(e.opacity=cn(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let a=0;a<$$;a++){const o=`border${nL[a]}Radius`;let c=MN(t,o),u=MN(n,o);if(c===void 0&&u===void 0)continue;c||(c=0),u||(u=0),c===0||u===0||LN(c)===LN(u)?(e[o]=Math.max(cn(RN(c),RN(u),r),0),(bi.test(u)||bi.test(c))&&(e[o]+="%")):e[o]=u}(t.rotate||n.rotate)&&(e.rotate=cn(t.rotate||0,n.rotate||0,r))}function MN(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const z$=rL(0,.5,ER),V$=rL(.5,.95,es);function rL(e,t,n){return r=>rt?1:n(bc(e,t,r))}function jN(e,t){e.min=t.min,e.max=t.max}function fs(e,t){jN(e.x,t.x),jN(e.y,t.y)}function DN(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function PN(e,t,n,r,s){return e-=t,e=Em(e,1/n,r),s!==void 0&&(e=Em(e,1/s,r)),e}function K$(e,t=0,n=1,r=.5,s,i=e,a=e){if(bi.test(t)&&(t=parseFloat(t),t=cn(a.min,a.max,t/100)-a.min),typeof t!="number")return;let o=cn(i.min,i.max,r);e===i&&(o-=t),e.min=PN(e.min,t,n,o,s),e.max=PN(e.max,t,n,o,s)}function BN(e,t,[n,r,s],i,a){K$(e,t[n],t[r],t[s],t.scale,i,a)}const Y$=["x","scaleX","originX"],W$=["y","scaleY","originY"];function FN(e,t,n,r){BN(e.x,t,Y$,n?n.x:void 0,r?r.x:void 0),BN(e.y,t,W$,n?n.y:void 0,r?r.y:void 0)}function UN(e){return e.translate===0&&e.scale===1}function sL(e){return UN(e.x)&&UN(e.y)}function $N(e,t){return e.min===t.min&&e.max===t.max}function G$(e,t){return $N(e.x,t.x)&&$N(e.y,t.y)}function HN(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function iL(e,t){return HN(e.x,t.x)&&HN(e.y,t.y)}function zN(e){return rs(e.x)/rs(e.y)}function VN(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class q${constructor(){this.members=[]}add(t){dw(this.members,t),t.scheduleRender()}remove(t){if(fw(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(s=>t===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:s}=t.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function X$(e,t,n){let r="";const s=e.x.translate/t.x,i=e.y.translate/t.y,a=(n==null?void 0:n.z)||0;if((s||i||a)&&(r=`translate3d(${s}px, ${i}px, ${a}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:f,rotateY:h,skewX:p,skewY:m}=n;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),f&&(r+=`rotateX(${f}deg) `),h&&(r+=`rotateY(${h}deg) `),p&&(r+=`skewX(${p}deg) `),m&&(r+=`skewY(${m}deg) `)}const o=e.x.scale*t.x,c=e.y.scale*t.y;return(o!==1||c!==1)&&(r+=`scale(${o}, ${c})`),r||"none"}const lo={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Pu=typeof window<"u"&&window.MotionDebug!==void 0,fy=["","X","Y","Z"],Q$={visibility:"hidden"},KN=1e3;let Z$=0;function hy(e,t,n,r){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),r&&(r[e]=0))}function aL(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=cR(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Gt,!(s||i))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&aL(r)}function oL({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(a={},o=t==null?void 0:t()){this.id=Z$++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Pu&&(lo.totalNodes=lo.resolvedTargetDeltas=lo.recalculatedProjection=0),this.nodes.forEach(t7),this.nodes.forEach(a7),this.nodes.forEach(o7),this.nodes.forEach(n7),Pu&&window.MotionDebug.record(lo)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=o?o.root||o:this,this.path=o?[...o.path,o]:[],this.parent=o,this.depth=o?o.depth+1:0;for(let c=0;cthis.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=U$(h,250),vp.hasAnimatedSinceResize&&(vp.hasAnimatedSinceResize=!1,this.nodes.forEach(WN))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:p,layout:m})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const y=this.options.transition||d.getDefaultTransition()||f7,{onLayoutAnimationStart:E,onLayoutAnimationComplete:g}=d.getProps(),x=!this.targetLayout||!iL(this.targetLayout,m)||p,b=!h&&p;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||b||h&&(x||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,b);const _={...uw(y,"layout"),onPlay:E,onComplete:g};(d.shouldReduceMotion||this.options.layoutRoot)&&(_.delay=0,_.type=!1),this.startAnimation(_)}else h||WN(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=m})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Ua(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(l7),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&aL(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c{const k=_/1e3;GN(f.x,a.x,k),GN(f.y,a.y,k),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(id(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),u7(this.relativeTarget,this.relativeTargetOrigin,h,k),b&&G$(this.relativeTarget,b)&&(this.isProjectionDirty=!1),b||(b=xn()),fs(b,this.relativeTarget)),y&&(this.animationValues=d,H$(d,u,this.latestValues,k,x,g)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=k},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Ua(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Gt.update(()=>{vp.hasAnimatedSinceResize=!0,this.currentAnimation=D$(0,KN,{...a,onUpdate:o=>{this.mixTargetDelta(o),a.onUpdate&&a.onUpdate(o)},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(KN),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:o,target:c,layout:u,latestValues:d}=a;if(!(!o||!c||!u)){if(this!==a&&this.layout&&u&&lL(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||xn();const f=rs(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+f;const h=rs(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+h}fs(o,c),Ul(o,d),sd(this.projectionDeltaWithTransform,this.layoutCorrected,o,d)}}registerSharedNode(a,o){this.sharedNodes.has(a)||this.sharedNodes.set(a,new q$),this.sharedNodes.get(a).add(o);const u=o.options.initialPromotionConfig;o.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(o):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:o}=this.options;return o?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:o}=this.options;return o?(a=this.getStack())===null||a===void 0?void 0:a.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:o,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),a&&(this.projectionDelta=void 0,this.needsReset=!0),o&&this.setOptions({transition:o})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let o=!1;const{latestValues:c}=a;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(o=!0),!o)return;const u={};c.z&&hy("z",a,u,this.animationValues);for(let d=0;d{var o;return(o=a.currentAnimation)===null||o===void 0?void 0:o.stop()}),this.root.nodes.forEach(YN),this.root.sharedNodes.clear()}}}function J$(e){e.updateLayout()}function e7(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=e.layout,{animationType:i}=e.options,a=n.source!==e.layout.source;i==="size"?hs(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=rs(h);h.min=r[f].min,h.max=h.min+p}):lL(i,n.layoutBox,r)&&hs(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=rs(r[f]);h.max=h.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+p)});const o=Bl();sd(o,r,n.layoutBox);const c=Bl();a?sd(c,e.applyTransform(s,!0),n.measuredBox):sd(c,r,n.layoutBox);const u=!sL(o);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:p}=f;if(h&&p){const m=xn();id(m,n.layoutBox,h.layoutBox);const y=xn();id(y,r,p.layoutBox),iL(m,y)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=y,e.relativeTargetOrigin=m,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:c,layoutDelta:o,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function t7(e){Pu&&lo.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function n7(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function r7(e){e.clearSnapshot()}function YN(e){e.clearMeasurements()}function s7(e){e.isLayoutDirty=!1}function i7(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function WN(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function a7(e){e.resolveTargetDelta()}function o7(e){e.calcProjection()}function l7(e){e.resetSkewAndRotation()}function c7(e){e.removeLeadSnapshot()}function GN(e,t,n){e.translate=cn(t.translate,0,n),e.scale=cn(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function qN(e,t,n,r){e.min=cn(t.min,n.min,r),e.max=cn(t.max,n.max,r)}function u7(e,t,n,r){qN(e.x,t.x,n.x,r),qN(e.y,t.y,n.y,r)}function d7(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const f7={duration:.45,ease:[.4,0,.1,1]},XN=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),QN=XN("applewebkit/")&&!XN("chrome/")?Math.round:es;function ZN(e){e.min=QN(e.min),e.max=QN(e.max)}function h7(e){ZN(e.x),ZN(e.y)}function lL(e,t,n){return e==="position"||e==="preserve-aspect"&&!g$(zN(t),zN(n),.2)}function p7(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const m7=oL({attachResizeListener:(e,t)=>Vd(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),py={current:void 0},cL=oL({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!py.current){const e=new m7({});e.mount(window),e.setOptions({layoutScroll:!0}),py.current=e}return py.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),g7={pan:{Feature:R$},drag:{Feature:O$,ProjectionNode:cL,MeasureLayout:tL}};function y7(e,t,n){var r;if(e instanceof Element)return[e];if(typeof e=="string"){let s=document;const i=(r=void 0)!==null&&r!==void 0?r:s.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}function uL(e,t){const n=y7(e),r=new AbortController,s={passive:!0,...t,signal:r.signal};return[n,s,()=>r.abort()]}function JN(e){return t=>{t.pointerType==="touch"||KR()||e(t)}}function b7(e,t,n={}){const[r,s,i]=uL(e,n),a=JN(o=>{const{target:c}=o,u=t(o);if(typeof u!="function"||!c)return;const d=JN(f=>{u(f),c.removeEventListener("pointerleave",d)});c.addEventListener("pointerleave",d,s)});return r.forEach(o=>{o.addEventListener("pointerenter",a,s)}),i}function eS(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,i=r[s];i&&Gt.postRender(()=>i(t,kf(t)))}class E7 extends Ka{mount(){const{current:t}=this.node;t&&(this.unmount=b7(t,n=>(eS(this.node,n,"Start"),r=>eS(this.node,r,"End"))))}unmount(){}}class x7 extends Ka{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=_f(Vd(this.node.current,"focus",()=>this.onFocus()),Vd(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const dL=(e,t)=>t?e===t?!0:dL(e,t.parentElement):!1,w7=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function v7(e){return w7.has(e.tagName)||e.tabIndex!==-1}const Bu=new WeakSet;function tS(e){return t=>{t.key==="Enter"&&e(t)}}function my(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const _7=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=tS(()=>{if(Bu.has(n))return;my(n,"down");const s=tS(()=>{my(n,"up")}),i=()=>my(n,"cancel");n.addEventListener("keyup",s,t),n.addEventListener("blur",i,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function nS(e){return Sw(e)&&!KR()}function k7(e,t,n={}){const[r,s,i]=uL(e,n),a=o=>{const c=o.currentTarget;if(!nS(o)||Bu.has(c))return;Bu.add(c);const u=t(o),d=(p,m)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),!(!nS(p)||!Bu.has(c))&&(Bu.delete(c),typeof u=="function"&&u(p,{success:m}))},f=p=>{d(p,n.useGlobalTarget||dL(c,p.target))},h=p=>{d(p,!1)};window.addEventListener("pointerup",f,s),window.addEventListener("pointercancel",h,s)};return r.forEach(o=>{!v7(o)&&o.getAttribute("tabindex")===null&&(o.tabIndex=0),(n.useGlobalTarget?window:o).addEventListener("pointerdown",a,s),o.addEventListener("focus",u=>_7(u,s),s)}),i}function rS(e,t,n){const{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),i=r[s];i&&Gt.postRender(()=>i(t,kf(t)))}class N7 extends Ka{mount(){const{current:t}=this.node;t&&(this.unmount=k7(t,n=>(rS(this.node,n,"Start"),(r,{success:s})=>rS(this.node,r,s?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const P1=new WeakMap,gy=new WeakMap,S7=e=>{const t=P1.get(e.target);t&&t(e)},T7=e=>{e.forEach(S7)};function A7({root:e,...t}){const n=e||document;gy.has(n)||gy.set(n,{});const r=gy.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(T7,{root:e,...t})),r[s]}function C7(e,t,n){const r=A7(t);return P1.set(e,n),r.observe(e),()=>{P1.delete(e),r.unobserve(e)}}const I7={some:0,all:1};class O7 extends Ka{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=t,a={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:I7[s]},o=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,i&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:f}=this.node.getProps(),h=u?d:f;h&&h(c)};return C7(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(R7(t,n))&&this.startObserver()}unmount(){}}function R7({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const L7={inView:{Feature:O7},tap:{Feature:N7},focus:{Feature:x7},hover:{Feature:E7}},M7={layout:{ProjectionNode:cL,MeasureLayout:tL}},B1={current:null},fL={current:!1};function j7(){if(fL.current=!0,!!Xx)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>B1.current=e.matches;e.addListener(t),t()}else B1.current=!1}const D7=[...LR,dr,$a],P7=e=>D7.find(RR(e)),sS=new WeakMap;function B7(e,t,n){for(const r in t){const s=t[r],i=n[r];if(hr(s))e.addValue(r,s);else if(hr(i))e.addValue(r,Hd(s,{owner:e}));else if(i!==s)if(e.hasValue(r)){const a=e.getValue(r);a.liveStyle===!0?a.jump(s):a.hasAnimated||a.set(s)}else{const a=e.getStaticValue(r);e.addValue(r,Hd(a!==void 0?a:s,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const iS=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class F7{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:i,visualState:a},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=vw,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=Ei.now();this.renderScheduledAtthis.bindToMotionValue(r,n)),fL.current||j7(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:B1.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){sS.delete(this.current),this.projection&&this.projection.unmount(),Ua(this.notifyUpdate),Ua(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const r=qo.has(t),s=n.on("change",o=>{this.latestValues[t]=o,this.props.onUpdate&&Gt.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),i=n.on("renderRequest",this.scheduleRender);let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{s(),i(),a&&a(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in yc){const n=yc[t];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[t]&&s&&r(this.props)&&(this.features[t]=new s(this)),this.features[t]){const i=this.features[t];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):xn()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=Hd(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){var r;let s=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(r=this.getBaseTargetFromProps(this.props,t))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,t,this.options);return s!=null&&(typeof s=="string"&&(IR(s)||wR(s))?s=parseFloat(s):!P7(s)&&$a.test(n)&&(s=TR(t,n)),this.setBaseTarget(t,hr(s)?s.get():s)),hr(s)?s.get():s}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props;let s;if(typeof r=="string"||typeof r=="object"){const a=nw(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);a&&(s=a[t])}if(r&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!hr(i)?i:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new hw),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class hL extends F7{constructor(){super(...arguments),this.KeyframeResolver=MR}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;hr(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function U7(e){return window.getComputedStyle(e)}class $7 extends hL{constructor(){super(...arguments),this.type="html",this.renderInstance=eR}readValueFromInstance(t,n){if(qo.has(n)){const r=ww(n);return r&&r.default||0}else{const r=U7(t),s=(QO(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return JR(t,n)}build(t,n,r){iw(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return cw(t,n,r)}}class H7 extends hL{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=xn}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(qo.has(n)){const r=ww(n);return r&&r.default||0}return n=tR.has(n)?n:Jx(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return sR(t,n,r)}build(t,n,r){aw(t,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,n,r,s){nR(t,n,r,s)}mount(t){this.isSVGTag=lw(t.tagName),super.mount(t)}}const z7=(e,t)=>tw(e)?new H7(t):new $7(t,{allowProjection:e!==w.Fragment}),V7=m9({...a$,...L7,...g7,...M7},z7),$t=IF(V7);function Pn(){return Pn=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u"||/ServerSideRendering/.test(navigator&&navigator.userAgent)?w.useEffect:w.useLayoutEffect;function El(e,t,n){var r=w.useRef(t);r.current=t,w.useEffect(function(){function s(i){r.current(i)}return e&&window.addEventListener(e,s,n),function(){e&&window.removeEventListener(e,s)}},[e])}var K7=["container"];function Y7(e){var t=e.container,n=t===void 0?document.body:t,r=Ag(e,K7);return Ss.createPortal(dt.createElement("div",Pn({},r)),n)}function W7(e){return dt.createElement("svg",Pn({width:"44",height:"44",viewBox:"0 0 768 768"},e),dt.createElement("path",{d:"M607.5 205.5l-178.5 178.5 178.5 178.5-45 45-178.5-178.5-178.5 178.5-45-45 178.5-178.5-178.5-178.5 45-45 178.5 178.5 178.5-178.5z"}))}function G7(e){return dt.createElement("svg",Pn({width:"44",height:"44",viewBox:"0 0 768 768"},e),dt.createElement("path",{d:"M640.5 352.5v63h-390l178.5 180-45 45-256.5-256.5 256.5-256.5 45 45-178.5 180h390z"}))}function q7(e){return dt.createElement("svg",Pn({width:"44",height:"44",viewBox:"0 0 768 768"},e),dt.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function X7(){return w.useEffect(function(){var e=document.body.style,t=e.overflow;return e.overflow="hidden",function(){e.overflow=t}},[]),null}function oS(e){var t=e.touches[0],n=t.clientX,r=t.clientY;if(e.touches.length>=2){var s=e.touches[1],i=s.clientX,a=s.clientY;return[(n+i)/2,(r+a)/2,Math.sqrt(Math.pow(i-n,2)+Math.pow(a-r,2))]}return[n,r,0]}var ba=function(e,t,n,r){var s,i=n*t,a=(i-r)/2,o=e;return i<=r?(s=1,o=0):e>0&&a-e<=0?(s=2,o=a):e<0&&a+e<=0&&(s=3,o=-a),[s,o]};function yy(e,t,n,r,s,i,a,o,c,u){a===void 0&&(a=innerWidth/2),o===void 0&&(o=innerHeight/2),c===void 0&&(c=0),u===void 0&&(u=0);var d=ba(e,i,n,innerWidth)[0],f=ba(t,i,r,innerHeight),h=innerWidth/2,p=innerHeight/2;return{x:a-i/s*(a-(h+e))-h+(r/n>=3&&n*i===innerWidth?0:d?c/2:c),y:o-i/s*(o-(p+t))-p+(f[0]?u/2:u),lastCX:a,lastCY:o}}function $1(e,t,n){var r=e%180!=0;return r?[n,t,r]:[t,n,r]}function by(e,t,n){var r=$1(n,innerWidth,innerHeight),s=r[0],i=r[1],a=0,o=s,c=i,u=e/t*i,d=t/e*s;return e=i?o=u:e>=s&&ts/i?c=d:t/e>=3&&!r[2]?a=((c=d)-i)/2:o=u,{width:o,height:c,x:0,y:a,pause:!0}}function Oh(e,t){var n=t.leading,r=n!==void 0&&n,s=t.maxWait,i=t.wait,a=i===void 0?s||0:i,o=w.useRef(e);o.current=e;var c=w.useRef(0),u=w.useRef(),d=function(){return u.current&&clearTimeout(u.current)},f=w.useCallback(function(){var h=[].slice.call(arguments),p=Date.now();function m(){c.current=p,d(),o.current.apply(null,h)}var y=c.current,E=p-y;if(y===0&&(r&&m(),c.current=p),s!==void 0){if(E>s)return void m()}else E=1&&i&&i())};d()}function d(){c=requestAnimationFrame(u)}}var Z7={T:0,L:0,W:0,H:0,FIT:void 0},mL=function(){var e=w.useRef(!1);return w.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),e},J7=["className"];function eH(e){var t=e.className,n=t===void 0?"":t,r=Ag(e,J7);return dt.createElement("div",Pn({className:"PhotoView__Spinner "+n},r),dt.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},dt.createElement("path",{opacity:".25",d:"M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4"}),dt.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}var tH=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function nH(e){var t=e.src,n=e.loaded,r=e.broken,s=e.className,i=e.onPhotoLoad,a=e.loadingElement,o=e.brokenElement,c=Ag(e,tH),u=mL();return t&&!r?dt.createElement(dt.Fragment,null,dt.createElement("img",Pn({className:"PhotoView__Photo"+(s?" "+s:""),src:t,onLoad:function(d){var f=d.target;u.current&&i({loaded:!0,naturalWidth:f.naturalWidth,naturalHeight:f.naturalHeight})},onError:function(){u.current&&i({broken:!0})},draggable:!1,alt:""},c)),!n&&(a?dt.createElement("span",{className:"PhotoView__icon"},a):dt.createElement(eH,{className:"PhotoView__icon"}))):o?dt.createElement("span",{className:"PhotoView__icon"},typeof o=="function"?o({src:t}):o):null}var rH={naturalWidth:void 0,naturalHeight:void 0,width:void 0,height:void 0,loaded:void 0,broken:!1,x:0,y:0,touched:!1,maskTouched:!1,rotate:0,scale:1,CX:0,CY:0,lastX:0,lastY:0,lastCX:0,lastCY:0,lastScale:1,touchTime:0,touchLength:0,pause:!0,stopRaf:!0,reach:void 0};function sH(e){var t=e.item,n=t.src,r=t.render,s=t.width,i=s===void 0?0:s,a=t.height,o=a===void 0?0:a,c=t.originRef,u=e.visible,d=e.speed,f=e.easing,h=e.wrapClassName,p=e.className,m=e.style,y=e.loadingElement,E=e.brokenElement,g=e.onPhotoTap,x=e.onMaskTap,b=e.onReachMove,_=e.onReachUp,k=e.onPhotoResize,N=e.isActive,C=e.expose,S=xm(rH),A=S[0],O=S[1],D=w.useRef(0),U=mL(),X=A.naturalWidth,M=X===void 0?i:X,j=A.naturalHeight,T=j===void 0?o:j,L=A.width,R=L===void 0?i:L,F=A.height,I=F===void 0?o:F,V=A.loaded,W=V===void 0?!n:V,P=A.broken,ie=A.x,G=A.y,re=A.touched,ue=A.stopRaf,ee=A.maskTouched,le=A.rotate,ne=A.scale,me=A.CX,ye=A.CY,te=A.lastX,de=A.lastY,Ee=A.lastCX,Te=A.lastCY,Ke=A.lastScale,Ne=A.touchTime,it=A.touchLength,He=A.pause,Ue=A.reach,Et=To({onScale:function(fe){return rt(Ih(fe))},onRotate:function(fe){le!==fe&&(C({rotate:fe}),O(Pn({rotate:fe},by(M,T,fe))))}});function rt(fe,$e,nt){ne!==fe&&(C({scale:fe}),O(Pn({scale:fe},yy(ie,G,R,I,ne,fe,$e,nt),fe<=1&&{x:0,y:0})))}var St=Oh(function(fe,$e,nt){if(nt===void 0&&(nt=0),(re||ee)&&N){var qt=$1(le,R,I),fn=qt[0],Lt=qt[1];if(nt===0&&D.current===0){var J=Math.abs(fe-me)<=20,he=Math.abs($e-ye)<=20;if(J&&he)return void O({lastCX:fe,lastCY:$e});D.current=J?$e>ye?3:2:1}var Le,Be=fe-Ee,ot=$e-Te;if(nt===0){var It=ba(Be+te,ne,fn,innerWidth)[0],st=ba(ot+de,ne,Lt,innerHeight);Le=function(we,_e,We,Ve){return _e&&we===1||Ve==="x"?"x":We&&we>1||Ve==="y"?"y":void 0}(D.current,It,st[0],Ue),Le!==void 0&&b(Le,fe,$e,ne)}if(Le==="x"||ee)return void O({reach:"x"});var Z=Ih(ne+(nt-it)/100/2*ne,M/R,.2);C({scale:Z}),O(Pn({touchLength:nt,reach:Le,scale:Z},yy(ie,G,R,I,ne,Z,fe,$e,Be,ot)))}},{maxWait:8});function ct(fe){return!ue&&!re&&(U.current&&O(Pn({},fe,{pause:u})),U.current)}var B,Q,oe,be,Oe,Ye,tt,ze,Tt=(Oe=function(fe){return ct({x:fe})},Ye=function(fe){return ct({y:fe})},tt=function(fe){return U.current&&(C({scale:fe}),O({scale:fe})),!re&&U.current},ze=To({X:function(fe){return Oe(fe)},Y:function(fe){return Ye(fe)},S:function(fe){return tt(fe)}}),function(fe,$e,nt,qt,fn,Lt,J,he,Le,Be,ot){var It=$1(Be,fn,Lt),st=It[0],Z=It[1],we=ba(fe,he,st,innerWidth),_e=we[0],We=we[1],Ve=ba($e,he,Z,innerHeight),Je=Ve[0],ut=Ve[1],Vt=Date.now()-ot;if(Vt>=200||he!==J||Math.abs(Le-J)>1){var Ft=yy(fe,$e,fn,Lt,J,he),hn=Ft.x,Tn=Ft.y,Kt=_e?We:hn!==fe?hn:null,os=Je?ut:Tn!==$e?Tn:null;return Kt!==null&&ho(fe,Kt,ze.X),os!==null&&ho($e,os,ze.Y),void(he!==J&&ho(J,he,ze.S))}var Er=(fe-nt)/Vt,Xn=($e-qt)/Vt,Or=Math.sqrt(Math.pow(Er,2)+Math.pow(Xn,2)),Qn=!1,ar=!1;(function(An,Xt){var En,Un=An,or=0,nn=0,ls=function(Jn){En||(En=Jn);var Is=Jn-En,Rr=Math.sign(An),xr=-.001*Rr,cs=Math.sign(-Un)*Math.pow(Un,2)*2e-4,Kr=Un*Is+(xr+cs)*Math.pow(Is,2)/2;or+=Kr,En=Jn,Rr*(Un+=(xr+cs)*Is)<=0?$n():Xt(or)?Zn():$n()};function Zn(){nn=requestAnimationFrame(ls)}function $n(){cancelAnimationFrame(nn)}Zn()})(Or,function(An){var Xt=fe+An*(Er/Or),En=$e+An*(Xn/Or),Un=ba(Xt,J,st,innerWidth),or=Un[0],nn=Un[1],ls=ba(En,J,Z,innerHeight),Zn=ls[0],$n=ls[1];if(or&&!Qn&&(Qn=!0,_e?ho(Xt,nn,ze.X):lS(nn,Xt+(Xt-nn),ze.X)),Zn&&!ar&&(ar=!0,Je?ho(En,$n,ze.Y):lS($n,En+(En-$n),ze.Y)),Qn&&ar)return!1;var Jn=Qn||ze.X(nn),Is=ar||ze.Y($n);return Jn&&Is})}),Re=(B=g,Q=function(fe,$e){Ue||rt(ne!==1?1:Math.max(2,M/R),fe,$e)},oe=w.useRef(0),be=Oh(function(){oe.current=0,B.apply(void 0,[].slice.call(arguments))},{wait:300}),function(){var fe=[].slice.call(arguments);oe.current+=1,be.apply(void 0,fe),oe.current>=2&&(be.cancel(),oe.current=0,Q.apply(void 0,fe))});function kt(fe,$e){if(D.current=0,(re||ee)&&N){O({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});var nt=Ih(ne,M/R);if(Tt(ie,G,te,de,R,I,ne,nt,Ke,le,Ne),_(fe,$e),me===fe&&ye===$e){if(re)return void Re(fe,$e);ee&&x(fe,$e)}}}function Pt(fe,$e,nt){nt===void 0&&(nt=0),O({touched:!0,CX:fe,CY:$e,lastCX:fe,lastCY:$e,lastX:ie,lastY:G,lastScale:ne,touchLength:nt,touchTime:Date.now()})}function Bt(fe){O({maskTouched:!0,CX:fe.clientX,CY:fe.clientY,lastX:ie,lastY:G})}El(Pi?void 0:"mousemove",function(fe){fe.preventDefault(),St(fe.clientX,fe.clientY)}),El(Pi?void 0:"mouseup",function(fe){kt(fe.clientX,fe.clientY)}),El(Pi?"touchmove":void 0,function(fe){fe.preventDefault();var $e=oS(fe);St.apply(void 0,$e)},{passive:!1}),El(Pi?"touchend":void 0,function(fe){var $e=fe.changedTouches[0];kt($e.clientX,$e.clientY)},{passive:!1}),El("resize",Oh(function(){W&&!re&&(O(by(M,T,le)),k())},{maxWait:8})),U1(function(){N&&C(Pn({scale:ne,rotate:le},Et))},[N]);var bn=function(fe,$e,nt,qt,fn,Lt,J,he,Le,Be){var ot=function(hn,Tn,Kt,os,Er){var Xn=w.useRef(!1),Or=xm({lead:!0,scale:Kt}),Qn=Or[0],ar=Qn.lead,An=Qn.scale,Xt=Or[1],En=Oh(function(Un){try{return Er(!0),Xt({lead:!1,scale:Un}),Promise.resolve()}catch(or){return Promise.reject(or)}},{wait:os});return U1(function(){Xn.current?(Er(!1),Xt({lead:!0}),En(Kt)):Xn.current=!0},[Kt]),ar?[hn*An,Tn*An,Kt/An]:[hn*Kt,Tn*Kt,1]}(Lt,J,he,Le,Be),It=ot[0],st=ot[1],Z=ot[2],we=function(hn,Tn,Kt,os,Er){var Xn=w.useState(Z7),Or=Xn[0],Qn=Xn[1],ar=w.useState(0),An=ar[0],Xt=ar[1],En=w.useRef(),Un=To({OK:function(){return hn&&Xt(4)}});function or(nn){Er(!1),Xt(nn)}return w.useEffect(function(){if(En.current||(En.current=Date.now()),Kt){if(function(nn,ls){var Zn=nn&&nn.current;if(Zn&&Zn.nodeType===1){var $n=Zn.getBoundingClientRect();ls({T:$n.top,L:$n.left,W:$n.width,H:$n.height,FIT:Zn.tagName==="IMG"?getComputedStyle(Zn).objectFit:void 0})}}(Tn,Qn),hn)return Date.now()-En.current<250?(Xt(1),requestAnimationFrame(function(){Xt(2),requestAnimationFrame(function(){return or(3)})}),void setTimeout(Un.OK,os)):void Xt(4);or(5)}},[hn,Kt]),[An,Or]}(fe,$e,nt,Le,Be),_e=we[0],We=we[1],Ve=We.W,Je=We.FIT,ut=innerWidth/2,Vt=innerHeight/2,Ft=_e<3||_e>4;return[Ft?Ve?We.L:ut:qt+(ut-Lt*he/2),Ft?Ve?We.T:Vt:fn+(Vt-J*he/2),It,Ft&&Je?It*(We.H/Ve):st,_e===0?Z:Ft?Ve/(Lt*he)||.01:Z,Ft?Je?1:0:1,_e,Je]}(u,c,W,ie,G,R,I,ne,d,function(fe){return O({pause:fe})}),Xe=bn[4],ft=bn[6],xt="transform "+d+"ms "+f,vt={className:p,onMouseDown:Pi?void 0:function(fe){fe.stopPropagation(),fe.button===0&&Pt(fe.clientX,fe.clientY,0)},onTouchStart:Pi?function(fe){fe.stopPropagation(),Pt.apply(void 0,oS(fe))}:void 0,onWheel:function(fe){if(!Ue){var $e=Ih(ne-fe.deltaY/100/2,M/R);O({stopRaf:!0}),rt($e,fe.clientX,fe.clientY)}},style:{width:bn[2]+"px",height:bn[3]+"px",opacity:bn[5],objectFit:ft===4?void 0:bn[7],transform:le?"rotate("+le+"deg)":void 0,transition:ft>2?xt+", opacity "+d+"ms ease, height "+(ft<4?d/2:ft>4?d:0)+"ms "+f:void 0}};return dt.createElement("div",{className:"PhotoView__PhotoWrap"+(h?" "+h:""),style:m,onMouseDown:!Pi&&N?Bt:void 0,onTouchStart:Pi&&N?function(fe){return Bt(fe.touches[0])}:void 0},dt.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:"matrix("+Xe+", 0, 0, "+Xe+", "+bn[0]+", "+bn[1]+")",transition:re||He?void 0:xt,willChange:N?"transform":void 0}},n?dt.createElement(nH,Pn({src:n,loaded:W,broken:P},vt,{onPhotoLoad:function(fe){O(Pn({},fe,fe.loaded&&by(fe.naturalWidth||0,fe.naturalHeight||0,le)))},loadingElement:y,brokenElement:E})):r&&r({attrs:vt,scale:Xe,rotate:le})))}var cS={x:0,touched:!1,pause:!1,lastCX:void 0,lastCY:void 0,bg:void 0,lastBg:void 0,overlay:!0,minimal:!0,scale:1,rotate:0};function iH(e){var t=e.loop,n=t===void 0?3:t,r=e.speed,s=e.easing,i=e.photoClosable,a=e.maskClosable,o=a===void 0||a,c=e.maskOpacity,u=c===void 0?1:c,d=e.pullClosable,f=d===void 0||d,h=e.bannerVisible,p=h===void 0||h,m=e.overlayRender,y=e.toolbarRender,E=e.className,g=e.maskClassName,x=e.photoClassName,b=e.photoWrapClassName,_=e.loadingElement,k=e.brokenElement,N=e.images,C=e.index,S=C===void 0?0:C,A=e.onIndexChange,O=e.visible,D=e.onClose,U=e.afterClose,X=e.portalContainer,M=xm(cS),j=M[0],T=M[1],L=w.useState(0),R=L[0],F=L[1],I=j.x,V=j.touched,W=j.pause,P=j.lastCX,ie=j.lastCY,G=j.bg,re=G===void 0?u:G,ue=j.lastBg,ee=j.overlay,le=j.minimal,ne=j.scale,me=j.rotate,ye=j.onScale,te=j.onRotate,de=e.hasOwnProperty("index"),Ee=de?S:R,Te=de?A:F,Ke=w.useRef(Ee),Ne=N.length,it=N[Ee],He=typeof n=="boolean"?n:Ne>n,Ue=function(Xe,ft){var xt=w.useReducer(function(nt){return!nt},!1)[1],vt=w.useRef(0),fe=function(nt){var qt=w.useRef(nt);function fn(Lt){qt.current=Lt}return w.useMemo(function(){(function(Lt){Xe?(Lt(Xe),vt.current=1):vt.current=2})(fn)},[nt]),[qt.current,fn]}(Xe),$e=fe[1];return[fe[0],vt.current,function(){xt(),vt.current===2&&($e(!1),ft&&ft()),vt.current=0}]}(O,U),Et=Ue[0],rt=Ue[1],St=Ue[2];U1(function(){if(Et)return T({pause:!0,x:Ee*-(innerWidth+dl)}),void(Ke.current=Ee);T(cS)},[Et]);var ct=To({close:function(Xe){te&&te(0),T({overlay:!0,lastBg:re}),D(Xe)},changeIndex:function(Xe,ft){ft===void 0&&(ft=!1);var xt=He?Ke.current+(Xe-Ee):Xe,vt=Ne-1,fe=F1(xt,0,vt),$e=He?xt:fe,nt=innerWidth+dl;T({touched:!1,lastCX:void 0,lastCY:void 0,x:-nt*$e,pause:ft}),Ke.current=$e,Te&&Te(He?Xe<0?vt:Xe>vt?0:Xe:fe)}}),B=ct.close,Q=ct.changeIndex;function oe(Xe){return Xe?B():T({overlay:!ee})}function be(){T({x:-(innerWidth+dl)*Ee,lastCX:void 0,lastCY:void 0,pause:!0}),Ke.current=Ee}function Oe(Xe,ft,xt,vt){Xe==="x"?function(fe){if(P!==void 0){var $e=fe-P,nt=$e;!He&&(Ee===0&&$e>0||Ee===Ne-1&&$e<0)&&(nt=$e/2),T({touched:!0,lastCX:P,x:-(innerWidth+dl)*Ke.current+nt,pause:!1})}else T({touched:!0,lastCX:fe,x:I,pause:!1})}(ft):Xe==="y"&&function(fe,$e){if(ie!==void 0){var nt=u===null?null:F1(u,.01,u-Math.abs(fe-ie)/100/4);T({touched:!0,lastCY:ie,bg:$e===1?nt:u,minimal:$e===1})}else T({touched:!0,lastCY:fe,bg:re,minimal:!0})}(xt,vt)}function Ye(Xe,ft){var xt=Xe-(P??Xe),vt=ft-(ie??ft),fe=!1;if(xt<-40)Q(Ee+1);else if(xt>40)Q(Ee-1);else{var $e=-(innerWidth+dl)*Ke.current;Math.abs(vt)>100&&le&&f&&(fe=!0,B()),T({touched:!1,x:$e,lastCX:void 0,lastCY:void 0,bg:u,overlay:!!fe||ee})}}El("keydown",function(Xe){if(O)switch(Xe.key){case"ArrowLeft":Q(Ee-1,!0);break;case"ArrowRight":Q(Ee+1,!0);break;case"Escape":B()}});var tt=function(Xe,ft,xt){return w.useMemo(function(){var vt=Xe.length;return xt?Xe.concat(Xe).concat(Xe).slice(vt+ft-1,vt+ft+2):Xe.slice(Math.max(ft-1,0),Math.min(ft+2,vt+1))},[Xe,ft,xt])}(N,Ee,He);if(!Et)return null;var ze=ee&&!rt,Tt=O?re:ue,Re=ye&&te&&{images:N,index:Ee,visible:O,onClose:B,onIndexChange:Q,overlayVisible:ze,overlay:it&&it.overlay,scale:ne,rotate:me,onScale:ye,onRotate:te},kt=r?r(rt):400,Pt=s?s(rt):aS,Bt=r?r(3):600,bn=s?s(3):aS;return dt.createElement(Y7,{className:"PhotoView-Portal"+(ze?"":" PhotoView-Slider__clean")+(O?"":" PhotoView-Slider__willClose")+(E?" "+E:""),role:"dialog",onClick:function(Xe){return Xe.stopPropagation()},container:X},O&&dt.createElement(X7,null),dt.createElement("div",{className:"PhotoView-Slider__Backdrop"+(g?" "+g:"")+(rt===1?" PhotoView-Slider__fadeIn":rt===2?" PhotoView-Slider__fadeOut":""),style:{background:Tt?"rgba(0, 0, 0, "+Tt+")":void 0,transitionTimingFunction:Pt,transitionDuration:(V?0:kt)+"ms",animationDuration:kt+"ms"},onAnimationEnd:St}),p&&dt.createElement("div",{className:"PhotoView-Slider__BannerWrap"},dt.createElement("div",{className:"PhotoView-Slider__Counter"},Ee+1," / ",Ne),dt.createElement("div",{className:"PhotoView-Slider__BannerRight"},y&&Re&&y(Re),dt.createElement(W7,{className:"PhotoView-Slider__toolbarIcon",onClick:B}))),tt.map(function(Xe,ft){var xt=He||Ee!==0?Ke.current-1+ft:Ee+ft;return dt.createElement(sH,{key:He?Xe.key+"/"+Xe.src+"/"+xt:Xe.key,item:Xe,speed:kt,easing:Pt,visible:O,onReachMove:Oe,onReachUp:Ye,onPhotoTap:function(){return oe(i)},onMaskTap:function(){return oe(o)},wrapClassName:b,className:x,style:{left:(innerWidth+dl)*xt+"px",transform:"translate3d("+I+"px, 0px, 0)",transition:V||W?void 0:"transform "+Bt+"ms "+bn},loadingElement:_,brokenElement:k,onPhotoResize:be,isActive:Ke.current===xt,expose:T})}),!Pi&&p&&dt.createElement(dt.Fragment,null,(He||Ee!==0)&&dt.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:function(){return Q(Ee-1,!0)}},dt.createElement(G7,null)),(He||Ee+1-1){var g=u.slice();return g.splice(E,1,y),void o({images:g})}o(function(x){return{images:x.images.concat(y)}})},remove:function(y){o(function(E){var g=E.images.filter(function(x){return x.key!==y});return{images:g,index:Math.min(g.length-1,f)}})},show:function(y){var E=u.findIndex(function(g){return g.key===y});o({visible:!0,index:E}),r&&r(!0,E,a)}}),p=To({close:function(){o({visible:!1}),r&&r(!1,f,a)},changeIndex:function(y){o({index:y}),n&&n(y,a)}}),m=w.useMemo(function(){return Pn({},a,h)},[a,h]);return dt.createElement(pL.Provider,{value:m},t,dt.createElement(iH,Pn({images:u,visible:d,index:f,onIndexChange:p.changeIndex,onClose:p.close},s)))}var gL=function(e){var t,n,r=e.src,s=e.render,i=e.overlay,a=e.width,o=e.height,c=e.triggers,u=c===void 0?["onClick"]:c,d=e.children,f=w.useContext(pL),h=(t=function(){return f.nextId()},(n=w.useRef({sign:!1,fn:void 0}).current).sign||(n.sign=!0,n.fn=t()),n.fn),p=w.useRef(null);w.useImperativeHandle(d==null?void 0:d.ref,function(){return p.current}),w.useEffect(function(){return function(){f.remove(h)}},[]);var m=To({render:function(E){return s&&s(E)},show:function(E,g){f.show(h),function(x,b){if(d){var _=d.props[x];_&&_(b)}}(E,g)}}),y=w.useMemo(function(){var E={};return u.forEach(function(g){E[g]=m.show.bind(null,g)}),E},[]);return w.useEffect(function(){f.update({key:h,src:r,originRef:p,render:m.render,overlay:i,width:a,height:o})},[r]),d?w.Children.only(w.cloneElement(d,Pn({},y,{ref:p}))):null};/** + `),()=>{document.head.removeChild(d)}},[t]),l.jsx(bF,{isPresent:t,childRef:r,sizeRef:s,children:w.cloneElement(e,{ref:r})})}const xF=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:a})=>{const o=xg(wF),c=w.useId(),u=w.useCallback(f=>{o.set(f,!0);for(const h of o.values())if(!h)return;r&&r()},[o,r]),d=w.useMemo(()=>({id:c,initial:t,isPresent:n,custom:s,onExitComplete:u,register:f=>(o.set(f,!1),()=>o.delete(f))}),i?[Math.random(),u]:[n,u]);return w.useMemo(()=>{o.forEach((f,h)=>o.set(h,!1))},[n]),w.useEffect(()=>{!n&&!o.size&&r&&r()},[n]),a==="popLayout"&&(e=l.jsx(EF,{isPresent:n,children:e})),l.jsx(wg.Provider,{value:d,children:e})};function wF(){return new Map}function PO(e=!0){const t=w.useContext(wg);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=t,i=w.useId();w.useEffect(()=>{e&&s(i)},[e]);const a=w.useCallback(()=>e&&r&&r(i),[i,r,e]);return!n&&r?[!1,a]:[!0]}const Nh=e=>e.key||"";function Vk(e){const t=[];return w.Children.forEach(e,n=>{w.isValidElement(n)&&t.push(n)}),t}const qx=typeof window<"u",BO=qx?w.useLayoutEffect:w.useEffect,pi=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:i="sync",propagate:a=!1})=>{const[o,c]=PO(a),u=w.useMemo(()=>Vk(e),[e]),d=a&&!o?[]:u.map(Nh),f=w.useRef(!0),h=w.useRef(u),p=xg(()=>new Map),[m,y]=w.useState(u),[E,g]=w.useState(u);BO(()=>{f.current=!1,h.current=u;for(let _=0;_{const k=Nh(_),N=a&&!o?!1:u===E||d.includes(k),C=()=>{if(p.has(k))p.set(k,!0);else return;let S=!0;p.forEach(A=>{A||(S=!1)}),S&&(b==null||b(),g(h.current),a&&(c==null||c()),r&&r())};return l.jsx(xF,{isPresent:N,initial:!f.current||n?void 0:!1,custom:N?void 0:t,presenceAffectsLayout:s,mode:i,onExitComplete:N?void 0:C,children:_},k)})})},es=e=>e;let FO=es;const vF={useManualTiming:!1};function _F(e){let t=new Set,n=new Set,r=!1,s=!1;const i=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function o(u){i.has(u)&&(c.schedule(u),e()),u(a)}const c={schedule:(u,d=!1,f=!1)=>{const p=f&&r?t:n;return d&&i.add(u),p.has(u)||p.add(u),u},cancel:u=>{n.delete(u),i.delete(u)},process:u=>{if(a=u,r){s=!0;return}r=!0,[t,n]=[n,t],t.forEach(o),t.clear(),r=!1,s&&(s=!1,c.process(u))}};return c}const Sh=["read","resolveKeyframes","update","preRender","render","postRender"],kF=40;function UO(e,t){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,a=Sh.reduce((g,x)=>(g[x]=_F(i),g),{}),{read:o,resolveKeyframes:c,update:u,preRender:d,render:f,postRender:h}=a,p=()=>{const g=performance.now();n=!1,s.delta=r?1e3/60:Math.max(Math.min(g-s.timestamp,kF),1),s.timestamp=g,s.isProcessing=!0,o.process(s),c.process(s),u.process(s),d.process(s),f.process(s),h.process(s),s.isProcessing=!1,n&&t&&(r=!1,e(p))},m=()=>{n=!0,r=!0,s.isProcessing||e(p)};return{schedule:Sh.reduce((g,x)=>{const b=a[x];return g[x]=(_,k=!1,N=!1)=>(n||m(),b.schedule(_,k,N)),g},{}),cancel:g=>{for(let x=0;xKk[e].some(n=>!!t[n])};function NF(e){for(const t in e)gc[t]={...gc[t],...e[t]}}const SF=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function fm(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||SF.has(e)}let HO=e=>!fm(e);function zO(e){e&&(HO=t=>t.startsWith("on")?!fm(t):e(t))}try{zO(require("@emotion/is-prop-valid").default)}catch{}function TF(e,t,n){const r={};for(const s in e)s==="values"&&typeof e.values=="object"||(HO(s)||n===!0&&fm(s)||!t&&!fm(s)||e.draggable&&s.startsWith("onDrag"))&&(r[s]=e[s]);return r}function AF({children:e,isValidProp:t,...n}){t&&zO(t),n={...w.useContext(Bd),...n},n.isStatic=xg(()=>n.isStatic);const r=w.useMemo(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion]);return l.jsx(Bd.Provider,{value:r,children:e})}function CF(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...r)=>e(...r);return new Proxy(n,{get:(r,s)=>s==="create"?e:(t.has(s)||t.set(s,e(s)),t.get(s))})}const vg=w.createContext({});function Fd(e){return typeof e=="string"||Array.isArray(e)}function _g(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const Xx=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Qx=["initial",...Xx];function kg(e){return _g(e.animate)||Qx.some(t=>Fd(e[t]))}function VO(e){return!!(kg(e)||e.variants)}function IF(e,t){if(kg(e)){const{initial:n,animate:r}=e;return{initial:n===!1||Fd(n)?n:void 0,animate:Fd(r)?r:void 0}}return e.inherit!==!1?t:{}}function OF(e){const{initial:t,animate:n}=IF(e,w.useContext(vg));return w.useMemo(()=>({initial:t,animate:n}),[Yk(t),Yk(n)])}function Yk(e){return Array.isArray(e)?e.join(" "):e}const RF=Symbol.for("motionComponentSymbol");function jl(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function LF(e,t,n){return w.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):jl(n)&&(n.current=r))},[t])}const Zx=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),MF="framerAppearId",KO="data-"+Zx(MF),{schedule:Jx}=UO(queueMicrotask,!1),YO=w.createContext({});function jF(e,t,n,r,s){var i,a;const{visualElement:o}=w.useContext(vg),c=w.useContext($O),u=w.useContext(wg),d=w.useContext(Bd).reducedMotion,f=w.useRef(null);r=r||c.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:d}));const h=f.current,p=w.useContext(YO);h&&!h.projection&&s&&(h.type==="html"||h.type==="svg")&&DF(f.current,n,s,p);const m=w.useRef(!1);w.useInsertionEffect(()=>{h&&m.current&&h.update(n,u)});const y=n[KO],E=w.useRef(!!y&&!(!((i=window.MotionHandoffIsComplete)===null||i===void 0)&&i.call(window,y))&&((a=window.MotionHasOptimisedAnimation)===null||a===void 0?void 0:a.call(window,y)));return BO(()=>{h&&(m.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),Jx.render(h.render),E.current&&h.animationState&&h.animationState.animateChanges())}),w.useEffect(()=>{h&&(!E.current&&h.animationState&&h.animationState.animateChanges(),E.current&&(queueMicrotask(()=>{var g;(g=window.MotionHandoffMarkAsComplete)===null||g===void 0||g.call(window,y)}),E.current=!1))}),h}function DF(e,t,n,r){const{layoutId:s,layout:i,drag:a,dragConstraints:o,layoutScroll:c,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:WO(e.parent)),e.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!a||o&&jl(o),visualElement:e,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,layoutScroll:c,layoutRoot:u})}function WO(e){if(e)return e.options.allowProjection!==!1?e.projection:WO(e.parent)}function PF({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:s}){var i,a;e&&NF(e);function o(u,d){let f;const h={...w.useContext(Bd),...u,layoutId:BF(u)},{isStatic:p}=h,m=OF(u),y=r(u,p);if(!p&&qx){FF();const E=UF(h);f=E.MeasureLayout,m.visualElement=jF(s,y,h,t,E.ProjectionNode)}return l.jsxs(vg.Provider,{value:m,children:[f&&m.visualElement?l.jsx(f,{visualElement:m.visualElement,...h}):null,n(s,u,LF(y,m.visualElement,d),y,p,m.visualElement)]})}o.displayName=`motion.${typeof s=="string"?s:`create(${(a=(i=s.displayName)!==null&&i!==void 0?i:s.name)!==null&&a!==void 0?a:""})`}`;const c=w.forwardRef(o);return c[RF]=s,c}function BF({layoutId:e}){const t=w.useContext(Gx).id;return t&&e!==void 0?t+"-"+e:e}function FF(e,t){w.useContext($O).strict}function UF(e){const{drag:t,layout:n}=gc;if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(e)||n!=null&&n.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}const $F=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function ew(e){return typeof e!="string"||e.includes("-")?!1:!!($F.indexOf(e)>-1||/[A-Z]/u.test(e))}function Wk(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function tw(e,t,n,r){if(typeof t=="function"){const[s,i]=Wk(r);t=t(n!==void 0?n:e.custom,s,i)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,i]=Wk(r);t=t(n!==void 0?n:e.custom,s,i)}return t}const v1=e=>Array.isArray(e),HF=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),zF=e=>v1(e)?e[e.length-1]||0:e,hr=e=>!!(e&&e.getVelocity);function Ep(e){const t=hr(e)?e.get():e;return HF(t)?t.toValue():t}function VF({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},r,s,i){const a={latestValues:KF(r,s,i,e),renderState:t()};return n&&(a.onMount=o=>n({props:r,current:o,...a}),a.onUpdate=o=>n(o)),a}const GO=e=>(t,n)=>{const r=w.useContext(vg),s=w.useContext(wg),i=()=>VF(e,t,r,s);return n?i():xg(i)};function KF(e,t,n,r){const s={},i=r(e,{});for(const h in i)s[h]=Ep(i[h]);let{initial:a,animate:o}=e;const c=kg(e),u=VO(e);t&&u&&!c&&e.inherit!==!1&&(a===void 0&&(a=t.initial),o===void 0&&(o=t.animate));let d=n?n.initial===!1:!1;d=d||a===!1;const f=d?o:a;if(f&&typeof f!="boolean"&&!_g(f)){const h=Array.isArray(f)?f:[f];for(let p=0;pt=>typeof t=="string"&&t.startsWith(e),XO=qO("--"),YF=qO("var(--"),nw=e=>YF(e)?WF.test(e.split("/*")[0].trim()):!1,WF=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,QO=(e,t)=>t&&typeof e=="number"?t.transform(e):e,Ji=(e,t,n)=>n>t?t:ntypeof e=="number",parse:parseFloat,transform:e=>e},Ud={...Vc,transform:e=>Ji(0,1,e)},Th={...Vc,default:1},xf=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),ha=xf("deg"),bi=xf("%"),et=xf("px"),GF=xf("vh"),qF=xf("vw"),Gk={...bi,parse:e=>bi.parse(e)/100,transform:e=>bi.transform(e*100)},XF={borderWidth:et,borderTopWidth:et,borderRightWidth:et,borderBottomWidth:et,borderLeftWidth:et,borderRadius:et,radius:et,borderTopLeftRadius:et,borderTopRightRadius:et,borderBottomRightRadius:et,borderBottomLeftRadius:et,width:et,maxWidth:et,height:et,maxHeight:et,top:et,right:et,bottom:et,left:et,padding:et,paddingTop:et,paddingRight:et,paddingBottom:et,paddingLeft:et,margin:et,marginTop:et,marginRight:et,marginBottom:et,marginLeft:et,backgroundPositionX:et,backgroundPositionY:et},QF={rotate:ha,rotateX:ha,rotateY:ha,rotateZ:ha,scale:Th,scaleX:Th,scaleY:Th,scaleZ:Th,skew:ha,skewX:ha,skewY:ha,distance:et,translateX:et,translateY:et,translateZ:et,x:et,y:et,z:et,perspective:et,transformPerspective:et,opacity:Ud,originX:Gk,originY:Gk,originZ:et},qk={...Vc,transform:Math.round},rw={...XF,...QF,zIndex:qk,size:et,fillOpacity:Ud,strokeOpacity:Ud,numOctaves:qk},ZF={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},JF=zc.length;function e9(e,t,n){let r="",s=!0;for(let i=0;i({style:{},transform:{},transformOrigin:{},vars:{}}),ZO=()=>({...aw(),attrs:{}}),ow=e=>typeof e=="string"&&e.toLowerCase()==="svg";function JO(e,{style:t,vars:n},r,s){Object.assign(e.style,t,s&&s.getProjectionStyles(r));for(const i in n)e.style.setProperty(i,n[i])}const eR=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function tR(e,t,n,r){JO(e,t,void 0,r);for(const s in t.attrs)e.setAttribute(eR.has(s)?s:Zx(s),t.attrs[s])}const hm={};function i9(e){Object.assign(hm,e)}function nR(e,{layout:t,layoutId:n}){return Go.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!hm[e]||e==="opacity")}function lw(e,t,n){var r;const{style:s}=e,i={};for(const a in s)(hr(s[a])||t.style&&hr(t.style[a])||nR(a,e)||((r=n==null?void 0:n.getValue(a))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(i[a]=s[a]);return i}function rR(e,t,n){const r=lw(e,t,n);for(const s in e)if(hr(e[s])||hr(t[s])){const i=zc.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=e[s]}return r}function a9(e,t){try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}const Qk=["x","y","width","height","cx","cy","r"],o9={useVisualState:GO({scrapeMotionValuesFromProps:rR,createRenderState:ZO,onUpdate:({props:e,prevProps:t,current:n,renderState:r,latestValues:s})=>{if(!n)return;let i=!!e.drag;if(!i){for(const o in s)if(Go.has(o)){i=!0;break}}if(!i)return;let a=!t;if(t)for(let o=0;o{a9(n,r),Gt.render(()=>{iw(r,s,ow(n.tagName),e.transformTemplate),tR(n,r)})})}})},l9={useVisualState:GO({scrapeMotionValuesFromProps:lw,createRenderState:aw})};function sR(e,t,n){for(const r in t)!hr(t[r])&&!nR(r,n)&&(e[r]=t[r])}function c9({transformTemplate:e},t){return w.useMemo(()=>{const n=aw();return sw(n,t,e),Object.assign({},n.vars,n.style)},[t])}function u9(e,t){const n=e.style||{},r={};return sR(r,n,e),Object.assign(r,c9(e,t)),r}function d9(e,t){const n={},r=u9(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}function f9(e,t,n,r){const s=w.useMemo(()=>{const i=ZO();return iw(i,t,ow(r),e.transformTemplate),{...i.attrs,style:{...i.style}}},[t]);if(e.style){const i={};sR(i,e.style,e),s.style={...i,...s.style}}return s}function h9(e=!1){return(n,r,s,{latestValues:i},a)=>{const c=(ew(n)?f9:d9)(r,i,a,n),u=TF(r,typeof n=="string",e),d=n!==w.Fragment?{...u,...c,ref:s}:{},{children:f}=r,h=w.useMemo(()=>hr(f)?f.get():f,[f]);return w.createElement(n,{...d,children:h})}}function p9(e,t){return function(r,{forwardMotionProps:s}={forwardMotionProps:!1}){const a={...ew(r)?o9:l9,preloadedFeatures:e,useRender:h9(s),createVisualElement:t,Component:r};return PF(a)}}function iR(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r(xp===void 0&&Ei.set(nr.isProcessing||vF.useManualTiming?nr.timestamp:performance.now()),xp),set:e=>{xp=e,queueMicrotask(m9)}};function uw(e,t){e.indexOf(t)===-1&&e.push(t)}function dw(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class fw{constructor(){this.subscriptions=[]}add(t){return uw(this.subscriptions,t),()=>dw(this.subscriptions,t)}notify(t,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,n,r);else for(let i=0;i!isNaN(parseFloat(e));class y9{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{const i=Ei.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),s&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Ei.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=g9(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new fw);const r=this.events[t].add(n);return t==="change"?()=>{r(),Gt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Ei.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Zk)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Zk);return oR(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function $d(e,t){return new y9(e,t)}function b9(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,$d(n))}function E9(e,t){const n=Ng(e,t);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const a in i){const o=zF(i[a]);b9(e,a,o)}}function x9(e){return!!(hr(e)&&e.add)}function _1(e,t){const n=e.getValue("willChange");if(x9(n))return n.add(t)}function lR(e){return e.props[KO]}function hw(e){let t;return()=>(t===void 0&&(t=e()),t)}const w9=hw(()=>window.ScrollTimeline!==void 0);class v9{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let r=0;r{if(w9()&&s.attachTimeline)return s.attachTimeline(t);if(typeof n=="function")return n(s)});return()=>{r.forEach((s,i)=>{s&&s(),this.animations[i].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let n=0;nn[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class _9 extends v9{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}const Yi=e=>e*1e3,Wi=e=>e/1e3;function pw(e){return typeof e=="function"}function Jk(e,t){e.timeline=t,e.onfinish=null}const mw=e=>Array.isArray(e)&&typeof e[0]=="number",k9={linearEasing:void 0};function N9(e,t){const n=hw(e);return()=>{var r;return(r=k9[t])!==null&&r!==void 0?r:n()}}const pm=N9(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),yc=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},cR=(e,t,n=10)=>{let r="";const s=Math.max(Math.round(t/n),2);for(let i=0;i`cubic-bezier(${e}, ${t}, ${n}, ${r})`,k1={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ju([0,.65,.55,1]),circOut:ju([.55,0,1,.45]),backIn:ju([.31,.01,.66,-.59]),backOut:ju([.33,1.53,.69,.99])};function dR(e,t){if(e)return typeof e=="function"&&pm()?cR(e,t):mw(e)?ju(e):Array.isArray(e)?e.map(n=>dR(n,t)||k1.easeOut):k1[e]}const fR=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,S9=1e-7,T9=12;function A9(e,t,n,r,s){let i,a,o=0;do a=t+(n-t)/2,i=fR(a,r,s)-e,i>0?n=a:t=a;while(Math.abs(i)>S9&&++oA9(i,0,1,e,n);return i=>i===0||i===1?i:fR(s(i),t,r)}const hR=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,pR=e=>t=>1-e(1-t),mR=wf(.33,1.53,.69,.99),gw=pR(mR),gR=hR(gw),yR=e=>(e*=2)<1?.5*gw(e):.5*(2-Math.pow(2,-10*(e-1))),yw=e=>1-Math.sin(Math.acos(e)),bR=pR(yw),ER=hR(yw),xR=e=>/^0[^.\s]+$/u.test(e);function C9(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||xR(e):!0}const td=e=>Math.round(e*1e5)/1e5,bw=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function I9(e){return e==null}const O9=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Ew=(e,t)=>n=>!!(typeof n=="string"&&O9.test(n)&&n.startsWith(e)||t&&!I9(n)&&Object.prototype.hasOwnProperty.call(n,t)),wR=(e,t,n)=>r=>{if(typeof r!="string")return r;const[s,i,a,o]=r.match(bw);return{[e]:parseFloat(s),[t]:parseFloat(i),[n]:parseFloat(a),alpha:o!==void 0?parseFloat(o):1}},R9=e=>Ji(0,255,e),sy={...Vc,transform:e=>Math.round(R9(e))},bo={test:Ew("rgb","red"),parse:wR("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+sy.transform(e)+", "+sy.transform(t)+", "+sy.transform(n)+", "+td(Ud.transform(r))+")"};function L9(e){let t="",n="",r="",s="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),s=e.substring(4,5),t+=t,n+=n,r+=r,s+=s),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const N1={test:Ew("#"),parse:L9,transform:bo.transform},Dl={test:Ew("hsl","hue"),parse:wR("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+bi.transform(td(t))+", "+bi.transform(td(n))+", "+td(Ud.transform(r))+")"},dr={test:e=>bo.test(e)||N1.test(e)||Dl.test(e),parse:e=>bo.test(e)?bo.parse(e):Dl.test(e)?Dl.parse(e):N1.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?bo.transform(e):Dl.transform(e)},M9=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function j9(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(bw))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(M9))===null||n===void 0?void 0:n.length)||0)>0}const vR="number",_R="color",D9="var",P9="var(",eN="${}",B9=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Hd(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const o=t.replace(B9,c=>(dr.test(c)?(r.color.push(i),s.push(_R),n.push(dr.parse(c))):c.startsWith(P9)?(r.var.push(i),s.push(D9),n.push(c)):(r.number.push(i),s.push(vR),n.push(parseFloat(c))),++i,eN)).split(eN);return{values:n,split:o,indexes:r,types:s}}function kR(e){return Hd(e).values}function NR(e){const{split:t,types:n}=Hd(e),r=t.length;return s=>{let i="";for(let a=0;atypeof e=="number"?0:e;function U9(e){const t=kR(e);return NR(e)(t.map(F9))}const Ua={test:j9,parse:kR,createTransformer:NR,getAnimatableNone:U9},$9=new Set(["brightness","contrast","saturate","opacity"]);function H9(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(bw)||[];if(!r)return e;const s=n.replace(r,"");let i=$9.has(t)?1:0;return r!==n&&(i*=100),t+"("+i+s+")"}const z9=/\b([a-z-]*)\(.*?\)/gu,S1={...Ua,getAnimatableNone:e=>{const t=e.match(z9);return t?t.map(H9).join(" "):e}},V9={...rw,color:dr,backgroundColor:dr,outlineColor:dr,fill:dr,stroke:dr,borderColor:dr,borderTopColor:dr,borderRightColor:dr,borderBottomColor:dr,borderLeftColor:dr,filter:S1,WebkitFilter:S1},xw=e=>V9[e];function SR(e,t){let n=xw(e);return n!==S1&&(n=Ua),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const K9=new Set(["auto","none","0"]);function Y9(e,t,n){let r=0,s;for(;re===Vc||e===et,nN=(e,t)=>parseFloat(e.split(", ")[t]),rN=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/u);if(s)return nN(s[1],t);{const i=r.match(/^matrix\((.+)\)$/u);return i?nN(i[1],e):0}},W9=new Set(["x","y","z"]),G9=zc.filter(e=>!W9.has(e));function q9(e){const t=[];return G9.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const bc={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:rN(4,13),y:rN(5,14)};bc.translateX=bc.x;bc.translateY=bc.y;const No=new Set;let T1=!1,A1=!1;function TR(){if(A1){const e=Array.from(No).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const s=q9(r);s.length&&(n.set(r,s),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,a])=>{var o;(o=r.getValue(i))===null||o===void 0||o.set(a)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}A1=!1,T1=!1,No.forEach(e=>e.complete()),No.clear()}function AR(){No.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(A1=!0)})}function X9(){AR(),TR()}class ww{constructor(t,n,r,s,i,a=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(No.add(this),T1||(T1=!0,Gt.read(AR),Gt.resolveKeyframes(TR))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:s}=this;for(let i=0;i/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),Q9=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Z9(e){const t=Q9.exec(e);if(!t)return[,];const[,n,r,s]=t;return[`--${n??r}`,s]}function IR(e,t,n=1){const[r,s]=Z9(e);if(!r)return;const i=window.getComputedStyle(t).getPropertyValue(r);if(i){const a=i.trim();return CR(a)?parseFloat(a):a}return nw(s)?IR(s,t,n+1):s}const OR=e=>t=>t.test(e),J9={test:e=>e==="auto",parse:e=>e},RR=[Vc,et,bi,ha,qF,GF,J9],sN=e=>RR.find(OR(e));class LR extends ww{constructor(t,n,r,s,i){super(t,n,r,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let c=0;c{n.getValue(c).set(u)}),this.resolveNoneKeyframes()}}const iN=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Ua.test(e)||e==="0")&&!e.startsWith("url("));function eU(e){const t=e[0];if(e.length===1)return!0;for(let n=0;ne!==null;function Sg(e,{repeat:t,repeatType:n="loop"},r){const s=e.filter(nU),i=t&&n!=="loop"&&t%2===1?0:s.length-1;return!i||r===void 0?s[i]:r}const rU=40;class MR{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:a="loop",...o}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Ei.now(),this.options={autoplay:t,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:a,...o},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>rU?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&X9(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=Ei.now(),this.hasAttemptedResolve=!0;const{name:r,type:s,velocity:i,delay:a,onComplete:o,onUpdate:c,isGenerator:u}=this.options;if(!u&&!tU(t,r,s,i))if(a)this.options.duration=0;else{c&&c(Sg(t,this.options,n)),o&&o(),this.resolveFinishedPromise();return}const d=this.initPlayback(t,n);d!==!1&&(this._resolved={keyframes:t,finalKeyframe:n,...d},this.onPostResolved())}onPostResolved(){}then(t,n){return this.currentFinishedPromise.then(t,n)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const C1=2e4;function jR(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=C1?1/0:t}const cn=(e,t,n)=>e+(t-e)*n;function iy(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function sU({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let s=0,i=0,a=0;if(!t)s=i=a=n;else{const o=n<.5?n*(1+t):n+t-n*t,c=2*n-o;s=iy(c,o,e+1/3),i=iy(c,o,e),a=iy(c,o,e-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(a*255),alpha:r}}function mm(e,t){return n=>n>0?t:e}const ay=(e,t,n)=>{const r=e*e,s=n*(t*t-r)+r;return s<0?0:Math.sqrt(s)},iU=[N1,bo,Dl],aU=e=>iU.find(t=>t.test(e));function aN(e){const t=aU(e);if(!t)return!1;let n=t.parse(e);return t===Dl&&(n=sU(n)),n}const oN=(e,t)=>{const n=aN(e),r=aN(t);if(!n||!r)return mm(e,t);const s={...n};return i=>(s.red=ay(n.red,r.red,i),s.green=ay(n.green,r.green,i),s.blue=ay(n.blue,r.blue,i),s.alpha=cn(n.alpha,r.alpha,i),bo.transform(s))},oU=(e,t)=>n=>t(e(n)),vf=(...e)=>e.reduce(oU),I1=new Set(["none","hidden"]);function lU(e,t){return I1.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function cU(e,t){return n=>cn(e,t,n)}function vw(e){return typeof e=="number"?cU:typeof e=="string"?nw(e)?mm:dr.test(e)?oN:fU:Array.isArray(e)?DR:typeof e=="object"?dr.test(e)?oN:uU:mm}function DR(e,t){const n=[...e],r=n.length,s=e.map((i,a)=>vw(i)(i,t[a]));return i=>{for(let a=0;a{for(const i in r)n[i]=r[i](s);return n}}function dU(e,t){var n;const r=[],s={color:0,var:0,number:0};for(let i=0;i{const n=Ua.createTransformer(t),r=Hd(e),s=Hd(t);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?I1.has(e)&&!s.values.length||I1.has(t)&&!r.values.length?lU(e,t):vf(DR(dU(r,s),s.values),n):mm(e,t)};function PR(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?cn(e,t,n):vw(e)(e,t)}const hU=5;function BR(e,t,n){const r=Math.max(t-hU,0);return oR(n-e(r),t-r)}const gn={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},oy=.001;function pU({duration:e=gn.duration,bounce:t=gn.bounce,velocity:n=gn.velocity,mass:r=gn.mass}){let s,i,a=1-t;a=Ji(gn.minDamping,gn.maxDamping,a),e=Ji(gn.minDuration,gn.maxDuration,Wi(e)),a<1?(s=u=>{const d=u*a,f=d*e,h=d-n,p=O1(u,a),m=Math.exp(-f);return oy-h/p*m},i=u=>{const f=u*a*e,h=f*n+n,p=Math.pow(a,2)*Math.pow(u,2)*e,m=Math.exp(-f),y=O1(Math.pow(u,2),a);return(-s(u)+oy>0?-1:1)*((h-p)*m)/y}):(s=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-oy+d*f},i=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const o=5/e,c=gU(s,i,o);if(e=Yi(e),isNaN(c))return{stiffness:gn.stiffness,damping:gn.damping,duration:e};{const u=Math.pow(c,2)*r;return{stiffness:u,damping:a*2*Math.sqrt(r*u),duration:e}}}const mU=12;function gU(e,t,n){let r=n;for(let s=1;se[n]!==void 0)}function EU(e){let t={velocity:gn.velocity,stiffness:gn.stiffness,damping:gn.damping,mass:gn.mass,isResolvedFromDuration:!1,...e};if(!lN(e,bU)&&lN(e,yU))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*Ji(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:gn.mass,stiffness:s,damping:i}}else{const n=pU(e);t={...t,...n,mass:gn.mass},t.isResolvedFromDuration=!0}return t}function FR(e=gn.visualDuration,t=gn.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:s}=n;const i=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],o={done:!1,value:i},{stiffness:c,damping:u,mass:d,duration:f,velocity:h,isResolvedFromDuration:p}=EU({...n,velocity:-Wi(n.velocity||0)}),m=h||0,y=u/(2*Math.sqrt(c*d)),E=a-i,g=Wi(Math.sqrt(c/d)),x=Math.abs(E)<5;r||(r=x?gn.restSpeed.granular:gn.restSpeed.default),s||(s=x?gn.restDelta.granular:gn.restDelta.default);let b;if(y<1){const k=O1(g,y);b=N=>{const C=Math.exp(-y*g*N);return a-C*((m+y*g*E)/k*Math.sin(k*N)+E*Math.cos(k*N))}}else if(y===1)b=k=>a-Math.exp(-g*k)*(E+(m+g*E)*k);else{const k=g*Math.sqrt(y*y-1);b=N=>{const C=Math.exp(-y*g*N),S=Math.min(k*N,300);return a-C*((m+y*g*E)*Math.sinh(S)+k*E*Math.cosh(S))/k}}const _={calculatedDuration:p&&f||null,next:k=>{const N=b(k);if(p)o.done=k>=f;else{let C=0;y<1&&(C=k===0?Yi(m):BR(b,k,N));const S=Math.abs(C)<=r,A=Math.abs(a-N)<=s;o.done=S&&A}return o.value=o.done?a:N,o},toString:()=>{const k=Math.min(jR(_),C1),N=cR(C=>_.next(k*C).value,k,30);return k+"ms "+N}};return _}function cN({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:a,min:o,max:c,restDelta:u=.5,restSpeed:d}){const f=e[0],h={done:!1,value:f},p=S=>o!==void 0&&Sc,m=S=>o===void 0?c:c===void 0||Math.abs(o-S)-y*Math.exp(-S/r),b=S=>g+x(S),_=S=>{const A=x(S),O=b(S);h.done=Math.abs(A)<=u,h.value=h.done?g:O};let k,N;const C=S=>{p(h.value)&&(k=S,N=FR({keyframes:[h.value,m(h.value)],velocity:BR(b,S,h.value),damping:s,stiffness:i,restDelta:u,restSpeed:d}))};return C(0),{calculatedDuration:null,next:S=>{let A=!1;return!N&&k===void 0&&(A=!0,_(S),C(S)),k!==void 0&&S>=k?N.next(S-k):(!A&&_(S),h)}}}const xU=wf(.42,0,1,1),wU=wf(0,0,.58,1),UR=wf(.42,0,.58,1),vU=e=>Array.isArray(e)&&typeof e[0]!="number",_U={linear:es,easeIn:xU,easeInOut:UR,easeOut:wU,circIn:yw,circInOut:ER,circOut:bR,backIn:gw,backInOut:gR,backOut:mR,anticipate:yR},uN=e=>{if(mw(e)){FO(e.length===4);const[t,n,r,s]=e;return wf(t,n,r,s)}else if(typeof e=="string")return _U[e];return e};function kU(e,t,n){const r=[],s=n||PR,i=e.length-1;for(let a=0;at[0];if(i===2&&t[0]===t[1])return()=>t[1];const a=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());const o=kU(t,r,s),c=o.length,u=d=>{if(a&&d1)for(;fu(Ji(e[0],e[i-1],d)):u}function SU(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const s=yc(0,t,r);e.push(cn(n,1,s))}}function TU(e){const t=[0];return SU(t,e.length-1),t}function AU(e,t){return e.map(n=>n*t)}function CU(e,t){return e.map(()=>t||UR).splice(0,e.length-1)}function gm({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const s=vU(r)?r.map(uN):uN(r),i={done:!1,value:t[0]},a=AU(n&&n.length===t.length?n:TU(t),e),o=NU(a,t,{ease:Array.isArray(s)?s:CU(t,s)});return{calculatedDuration:e,next:c=>(i.value=o(c),i.done=c>=e,i)}}const IU=e=>{const t=({timestamp:n})=>e(n);return{start:()=>Gt.update(t,!0),stop:()=>Fa(t),now:()=>nr.isProcessing?nr.timestamp:Ei.now()}},OU={decay:cN,inertia:cN,tween:gm,keyframes:gm,spring:FR},RU=e=>e/100;class _w extends MR{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:c}=this.options;c&&c()};const{name:n,motionValue:r,element:s,keyframes:i}=this.options,a=(s==null?void 0:s.KeyframeResolver)||ww,o=(c,u)=>this.onKeyframesResolved(c,u);this.resolver=new a(i,o,n,r,s),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:n="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:a=0}=this.options,o=pw(n)?n:OU[n]||gm;let c,u;o!==gm&&typeof t[0]!="number"&&(c=vf(RU,PR(t[0],t[1])),t=[0,100]);const d=o({...this.options,keyframes:t});i==="mirror"&&(u=o({...this.options,keyframes:[...t].reverse(),velocity:-a})),d.calculatedDuration===null&&(d.calculatedDuration=jR(d));const{calculatedDuration:f}=d,h=f+s,p=h*(r+1)-s;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:c,calculatedDuration:f,resolvedDuration:h,totalDuration:p}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:r}=this;if(!r){const{keyframes:S}=this.options;return{done:!0,value:S[S.length-1]}}const{finalKeyframe:s,generator:i,mirroredGenerator:a,mapPercentToKeyframes:o,keyframes:c,calculatedDuration:u,totalDuration:d,resolvedDuration:f}=r;if(this.startTime===null)return i.next(0);const{delay:h,repeat:p,repeatType:m,repeatDelay:y,onUpdate:E}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-d/this.speed,this.startTime)),n?this.currentTime=t:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const g=this.currentTime-h*(this.speed>=0?1:-1),x=this.speed>=0?g<0:g>d;this.currentTime=Math.max(g,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let b=this.currentTime,_=i;if(p){const S=Math.min(this.currentTime,d)/f;let A=Math.floor(S),O=S%1;!O&&S>=1&&(O=1),O===1&&A--,A=Math.min(A,p+1),!!(A%2)&&(m==="reverse"?(O=1-O,y&&(O-=y/f)):m==="mirror"&&(_=a)),b=Ji(0,1,O)*f}const k=x?{done:!1,value:c[0]}:_.next(b);o&&(k.value=o(k.value));let{done:N}=k;!x&&u!==null&&(N=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const C=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&N);return C&&s!==void 0&&(k.value=Sg(c,this.options,s)),E&&E(k.value),C&&this.finish(),k}get duration(){const{resolved:t}=this;return t?Wi(t.calculatedDuration):0}get time(){return Wi(this.currentTime)}set time(t){t=Yi(t),this.currentTime=t,this.holdTime!==null||this.speed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=Wi(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=IU,onPlay:n,startTime:r}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),n&&n();const s=this.driver.now();this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=s):this.startTime=r??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(t=this.currentTime)!==null&&t!==void 0?t:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const LU=new Set(["opacity","clipPath","filter","transform"]);function MU(e,t,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:a="loop",ease:o="easeInOut",times:c}={}){const u={[t]:n};c&&(u.offset=c);const d=dR(o,s);return Array.isArray(d)&&(u.easing=d),e.animate(u,{delay:r,duration:s,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:i+1,direction:a==="reverse"?"alternate":"normal"})}const jU=hw(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),ym=10,DU=2e4;function PU(e){return pw(e.type)||e.type==="spring"||!uR(e.ease)}function BU(e,t){const n=new _w({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:e[0]};const s=[];let i=0;for(;!r.done&&ithis.onKeyframesResolved(a,o),n,r,s),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:r=300,times:s,ease:i,type:a,motionValue:o,name:c,startTime:u}=this.options;if(!o.owner||!o.owner.current)return!1;if(typeof i=="string"&&pm()&&FU(i)&&(i=$R[i]),PU(this.options)){const{onComplete:f,onUpdate:h,motionValue:p,element:m,...y}=this.options,E=BU(t,y);t=E.keyframes,t.length===1&&(t[1]=t[0]),r=E.duration,s=E.times,i=E.ease,a="keyframes"}const d=MU(o.owner.current,c,t,{...this.options,duration:r,times:s,ease:i});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(Jk(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:f}=this.options;o.set(Sg(t,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:r,times:s,type:a,ease:i,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return Wi(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return Wi(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=Yi(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:n}=t;return n.playbackRate}set speed(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:n}=t;return n.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:n}=t;return n.startTime}attachTimeline(t){if(!this._resolved)this.pendingTimeline=t;else{const{resolved:n}=this;if(!n)return es;const{animation:r}=n;Jk(r,t)}return es}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:n}=t;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:n,keyframes:r,duration:s,type:i,ease:a,times:o}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:d,onComplete:f,element:h,...p}=this.options,m=new _w({...p,keyframes:r,duration:s,type:i,ease:a,times:o,isGenerator:!0}),y=Yi(this.time);u.setWithVelocity(m.sample(y-ym).value,m.sample(y).value,ym)}const{onStop:c}=this.options;c&&c(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:n,name:r,repeatDelay:s,repeatType:i,damping:a,type:o}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=n.owner.getProps();return jU()&&r&&LU.has(r)&&!c&&!u&&!s&&i!=="mirror"&&a!==0&&o!=="inertia"}}const UU={type:"spring",stiffness:500,damping:25,restSpeed:10},$U=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),HU={type:"keyframes",duration:.8},zU={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},VU=(e,{keyframes:t})=>t.length>2?HU:Go.has(e)?e.startsWith("scale")?$U(t[1]):UU:zU;function KU({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:a,repeatDelay:o,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const kw=(e,t,n,r={},s,i)=>a=>{const o=cw(r,e)||{},c=o.delay||r.delay||0;let{elapsed:u=0}=r;u=u-Yi(c);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...o,delay:-u,onUpdate:h=>{t.set(h),o.onUpdate&&o.onUpdate(h)},onComplete:()=>{a(),o.onComplete&&o.onComplete()},name:e,motionValue:t,element:i?void 0:s};KU(o)||(d={...d,...VU(e,d)}),d.duration&&(d.duration=Yi(d.duration)),d.repeatDelay&&(d.repeatDelay=Yi(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(f=!0)),f&&!i&&t.get()!==void 0){const h=Sg(d.keyframes,o);if(h!==void 0)return Gt.update(()=>{d.onUpdate(h),d.onComplete()}),new _9([])}return!i&&dN.supports(d)?new dN(d):new _w(d)};function YU({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function HR(e,t,{delay:n=0,transitionOverride:r,type:s}={}){var i;let{transition:a=e.getDefaultTransition(),transitionEnd:o,...c}=t;r&&(a=r);const u=[],d=s&&e.animationState&&e.animationState.getState()[s];for(const f in c){const h=e.getValue(f,(i=e.latestValues[f])!==null&&i!==void 0?i:null),p=c[f];if(p===void 0||d&&YU(d,f))continue;const m={delay:n,...cw(a||{},f)};let y=!1;if(window.MotionHandoffAnimation){const g=lR(e);if(g){const x=window.MotionHandoffAnimation(g,f,Gt);x!==null&&(m.startTime=x,y=!0)}}_1(e,f),h.start(kw(f,h,p,e.shouldReduceMotion&&aR.has(f)?{type:!1}:m,e,y));const E=h.animation;E&&u.push(E)}return o&&Promise.all(u).then(()=>{Gt.update(()=>{o&&E9(e,o)})}),u}function R1(e,t,n={}){var r;const s=Ng(e,t,n.type==="exit"?(r=e.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const a=s?()=>Promise.all(HR(e,s,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=i;return WU(e,t,d+u,f,h,n)}:()=>Promise.resolve(),{when:c}=i;if(c){const[u,d]=c==="beforeChildren"?[a,o]:[o,a];return u().then(()=>d())}else return Promise.all([a(),o(n.delay)])}function WU(e,t,n=0,r=0,s=1,i){const a=[],o=(e.variantChildren.size-1)*r,c=s===1?(u=0)=>u*r:(u=0)=>o-u*r;return Array.from(e.variantChildren).sort(GU).forEach((u,d)=>{u.notify("AnimationStart",t),a.push(R1(u,t,{...i,delay:n+c(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function GU(e,t){return e.sortNodePosition(t)}function qU(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const s=t.map(i=>R1(e,i,n));r=Promise.all(s)}else if(typeof t=="string")r=R1(e,t,n);else{const s=typeof t=="function"?Ng(e,t,n.custom):t;r=Promise.all(HR(e,s,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const XU=Qx.length;function zR(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?zR(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;nPromise.all(t.map(({animation:n,options:r})=>qU(e,n,r)))}function e$(e){let t=JU(e),n=fN(),r=!0;const s=c=>(u,d)=>{var f;const h=Ng(e,d,c==="exit"?(f=e.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(h){const{transition:p,transitionEnd:m,...y}=h;u={...u,...y,...m}}return u};function i(c){t=c(e)}function a(c){const{props:u}=e,d=zR(e.parent)||{},f=[],h=new Set;let p={},m=1/0;for(let E=0;Em&&_,A=!1;const O=Array.isArray(b)?b:[b];let D=O.reduce(s(g),{});k===!1&&(D={});const{prevResolvedValues:U={}}=x,X={...U,...D},M=L=>{S=!0,h.has(L)&&(A=!0,h.delete(L)),x.needsAnimating[L]=!0;const R=e.getValue(L);R&&(R.liveStyle=!1)};for(const L in X){const R=D[L],F=U[L];if(p.hasOwnProperty(L))continue;let I=!1;v1(R)&&v1(F)?I=!iR(R,F):I=R!==F,I?R!=null?M(L):h.add(L):R!==void 0&&h.has(L)?M(L):x.protectedKeys[L]=!0}x.prevProp=b,x.prevResolvedValues=D,x.isActive&&(p={...p,...D}),r&&e.blockInitialAnimation&&(S=!1),S&&(!(N&&C)||A)&&f.push(...O.map(L=>({animation:L,options:{type:g}})))}if(h.size){const E={};h.forEach(g=>{const x=e.getBaseTarget(g),b=e.getValue(g);b&&(b.liveStyle=!0),E[g]=x??null}),f.push({animation:E})}let y=!!f.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(y=!1),r=!1,y?t(f):Promise.resolve()}function o(c,u){var d;if(n[c].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(c,u)}),n[c].isActive=u;const f=a(c);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:a,setActive:o,setAnimateFunction:i,getState:()=>n,reset:()=>{n=fN(),r=!0}}}function t$(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!iR(t,e):!1}function to(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function fN(){return{animate:to(!0),whileInView:to(),whileHover:to(),whileTap:to(),whileDrag:to(),whileFocus:to(),exit:to()}}class Va{constructor(t){this.isMounted=!1,this.node=t}update(){}}class n$ extends Va{constructor(t){super(t),t.animationState||(t.animationState=e$(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();_g(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)===null||t===void 0||t.call(this)}}let r$=0;class s$ extends Va{constructor(){super(...arguments),this.id=r$++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===r)return;const s=this.node.animationState.setActive("exit",!t);n&&!t&&s.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const i$={animation:{Feature:n$},exit:{Feature:s$}},Ps={x:!1,y:!1};function VR(){return Ps.x||Ps.y}function a$(e){return e==="x"||e==="y"?Ps[e]?null:(Ps[e]=!0,()=>{Ps[e]=!1}):Ps.x||Ps.y?null:(Ps.x=Ps.y=!0,()=>{Ps.x=Ps.y=!1})}const Nw=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function zd(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function _f(e){return{point:{x:e.pageX,y:e.pageY}}}const o$=e=>t=>Nw(t)&&e(t,_f(t));function nd(e,t,n,r){return zd(e,t,o$(n),r)}const hN=(e,t)=>Math.abs(e-t);function l$(e,t){const n=hN(e.x,t.x),r=hN(e.y,t.y);return Math.sqrt(n**2+r**2)}class KR{constructor(t,n,{transformPagePoint:r,contextWindow:s,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=cy(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,p=l$(f.offset,{x:0,y:0})>=3;if(!h&&!p)return;const{point:m}=f,{timestamp:y}=nr;this.history.push({...m,timestamp:y});const{onStart:E,onMove:g}=this.handlers;h||(E&&E(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),g&&g(this.lastMoveEvent,f)},this.handlePointerMove=(f,h)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=ly(h,this.transformPagePoint),Gt.update(this.updatePoint,!0)},this.handlePointerUp=(f,h)=>{this.end();const{onEnd:p,onSessionEnd:m,resumeAnimation:y}=this.handlers;if(this.dragSnapToOrigin&&y&&y(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const E=cy(f.type==="pointercancel"?this.lastMoveEventInfo:ly(h,this.transformPagePoint),this.history);this.startEvent&&p&&p(f,E),m&&m(f,E)},!Nw(t))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.contextWindow=s||window;const a=_f(t),o=ly(a,this.transformPagePoint),{point:c}=o,{timestamp:u}=nr;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,cy(o,this.history)),this.removeListeners=vf(nd(this.contextWindow,"pointermove",this.handlePointerMove),nd(this.contextWindow,"pointerup",this.handlePointerUp),nd(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Fa(this.updatePoint)}}function ly(e,t){return t?{point:t(e.point)}:e}function pN(e,t){return{x:e.x-t.x,y:e.y-t.y}}function cy({point:e},t){return{point:e,delta:pN(e,YR(t)),offset:pN(e,c$(t)),velocity:u$(t,.1)}}function c$(e){return e[0]}function YR(e){return e[e.length-1]}function u$(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const s=YR(e);for(;n>=0&&(r=e[n],!(s.timestamp-r.timestamp>Yi(t)));)n--;if(!r)return{x:0,y:0};const i=Wi(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const a={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}const WR=1e-4,d$=1-WR,f$=1+WR,GR=.01,h$=0-GR,p$=0+GR;function rs(e){return e.max-e.min}function m$(e,t,n){return Math.abs(e-t)<=n}function mN(e,t,n,r=.5){e.origin=r,e.originPoint=cn(t.min,t.max,e.origin),e.scale=rs(n)/rs(t),e.translate=cn(n.min,n.max,e.origin)-e.originPoint,(e.scale>=d$&&e.scale<=f$||isNaN(e.scale))&&(e.scale=1),(e.translate>=h$&&e.translate<=p$||isNaN(e.translate))&&(e.translate=0)}function rd(e,t,n,r){mN(e.x,t.x,n.x,r?r.originX:void 0),mN(e.y,t.y,n.y,r?r.originY:void 0)}function gN(e,t,n){e.min=n.min+t.min,e.max=e.min+rs(t)}function g$(e,t,n){gN(e.x,t.x,n.x),gN(e.y,t.y,n.y)}function yN(e,t,n){e.min=t.min-n.min,e.max=e.min+rs(t)}function sd(e,t,n){yN(e.x,t.x,n.x),yN(e.y,t.y,n.y)}function y$(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?cn(n,e,r.max):Math.min(e,n)),e}function bN(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function b$(e,{top:t,left:n,bottom:r,right:s}){return{x:bN(e.x,n,s),y:bN(e.y,t,r)}}function EN(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=yc(t.min,t.max-r,e.min):r>s&&(n=yc(e.min,e.max-s,t.min)),Ji(0,1,n)}function w$(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const L1=.35;function v$(e=L1){return e===!1?e=0:e===!0&&(e=L1),{x:xN(e,"left","right"),y:xN(e,"top","bottom")}}function xN(e,t,n){return{min:wN(e,t),max:wN(e,n)}}function wN(e,t){return typeof e=="number"?e:e[t]||0}const vN=()=>({translate:0,scale:1,origin:0,originPoint:0}),Pl=()=>({x:vN(),y:vN()}),_N=()=>({min:0,max:0}),xn=()=>({x:_N(),y:_N()});function hs(e){return[e("x"),e("y")]}function qR({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function _$({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function k$(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function uy(e){return e===void 0||e===1}function M1({scale:e,scaleX:t,scaleY:n}){return!uy(e)||!uy(t)||!uy(n)}function ao(e){return M1(e)||XR(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function XR(e){return kN(e.x)||kN(e.y)}function kN(e){return e&&e!=="0%"}function bm(e,t,n){const r=e-n,s=t*r;return n+s}function NN(e,t,n,r,s){return s!==void 0&&(e=bm(e,s,r)),bm(e,n,r)+t}function j1(e,t=0,n=1,r,s){e.min=NN(e.min,t,n,r,s),e.max=NN(e.max,t,n,r,s)}function QR(e,{x:t,y:n}){j1(e.x,t.translate,t.scale,t.originPoint),j1(e.y,n.translate,n.scale,n.originPoint)}const SN=.999999999999,TN=1.0000000000001;function N$(e,t,n,r=!1){const s=n.length;if(!s)return;t.x=t.y=1;let i,a;for(let o=0;oSN&&(t.x=1),t.ySN&&(t.y=1)}function Bl(e,t){e.min=e.min+t,e.max=e.max+t}function AN(e,t,n,r,s=.5){const i=cn(e.min,e.max,s);j1(e,t,n,i,r)}function Fl(e,t){AN(e.x,t.x,t.scaleX,t.scale,t.originX),AN(e.y,t.y,t.scaleY,t.scale,t.originY)}function ZR(e,t){return qR(k$(e.getBoundingClientRect(),t))}function S$(e,t,n){const r=ZR(e,n),{scroll:s}=t;return s&&(Bl(r.x,s.offset.x),Bl(r.y,s.offset.y)),r}const JR=({current:e})=>e?e.ownerDocument.defaultView:null,T$=new WeakMap;class A${constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=xn(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=d=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(_f(d).point)},i=(d,f)=>{const{drag:h,dragPropagation:p,onDragStart:m}=this.getProps();if(h&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=a$(h),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),hs(E=>{let g=this.getAxisMotionValue(E).get()||0;if(bi.test(g)){const{projection:x}=this.visualElement;if(x&&x.layout){const b=x.layout.layoutBox[E];b&&(g=rs(b)*(parseFloat(g)/100))}}this.originPoint[E]=g}),m&&Gt.postRender(()=>m(d,f)),_1(this.visualElement,"transform");const{animationState:y}=this.visualElement;y&&y.setActive("whileDrag",!0)},a=(d,f)=>{const{dragPropagation:h,dragDirectionLock:p,onDirectionLock:m,onDrag:y}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:E}=f;if(p&&this.currentDirection===null){this.currentDirection=C$(E),this.currentDirection!==null&&m&&m(this.currentDirection);return}this.updateAxis("x",f.point,E),this.updateAxis("y",f.point,E),this.visualElement.render(),y&&y(d,f)},o=(d,f)=>this.stop(d,f),c=()=>hs(d=>{var f;return this.getAnimationState(d)==="paused"&&((f=this.getAxisMotionValue(d).animation)===null||f===void 0?void 0:f.play())}),{dragSnapToOrigin:u}=this.getProps();this.panSession=new KR(t,{onSessionStart:s,onStart:i,onMove:a,onSessionEnd:o,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:JR(this.visualElement)})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=n;this.startAnimation(s);const{onDragEnd:i}=this.getProps();i&&Gt.postRender(()=>i(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:s}=this.getProps();if(!r||!Ah(t,s,this.currentDirection))return;const i=this.getAxisMotionValue(t);let a=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(a=y$(a,this.constraints[t],this.elastic[t])),i.set(a)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:r}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,i=this.constraints;n&&jl(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&s?this.constraints=b$(s.layoutBox,n):this.constraints=!1,this.elastic=v$(r),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&hs(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=w$(s.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!jl(t))return!1;const r=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=S$(r,s.root,this.visualElement.getTransformPagePoint());let a=E$(s.layout.layoutBox,i);if(n){const o=n(_$(a));this.hasMutatedConstraints=!!o,o&&(a=qR(o))}return a}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),c=this.constraints||{},u=hs(d=>{if(!Ah(d,n,this.currentDirection))return;let f=c&&c[d]||{};a&&(f={min:0,max:0});const h=s?200:1e6,p=s?40:1e7,m={type:"inertia",velocity:r?t[d]:0,bounceStiffness:h,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...i,...f};return this.startAxisValueAnimation(d,m)});return Promise.all(u).then(o)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return _1(this.visualElement,t),r.start(kw(t,r,0,n,this.visualElement,!1))}stopAnimation(){hs(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){hs(t=>{var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(t){var n;return(n=this.getAxisMotionValue(t).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(t){const n=`_drag${t.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){hs(n=>{const{drag:r}=this.getProps();if(!Ah(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:a,max:o}=s.layout.layoutBox[n];i.set(t[n]-cn(a,o,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!jl(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};hs(a=>{const o=this.getAxisMotionValue(a);if(o&&this.constraints!==!1){const c=o.get();s[a]=x$({min:c,max:c},this.constraints[a])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),hs(a=>{if(!Ah(a,t,null))return;const o=this.getAxisMotionValue(a),{min:c,max:u}=this.constraints[a];o.set(cn(c,u,s[a]))})}addListeners(){if(!this.visualElement.current)return;T$.set(this.visualElement,this);const t=this.visualElement.current,n=nd(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();jl(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),Gt.read(r);const a=zd(window,"resize",()=>this.scalePositionWithinConstraints()),o=s.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(hs(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=c[d].translate,f.set(f.get()+c[d].translate))}),this.visualElement.render())});return()=>{a(),n(),i(),o&&o()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:a=L1,dragMomentum:o=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:a,dragMomentum:o}}}function Ah(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function C$(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class I$ extends Va{constructor(t){super(t),this.removeGroupControls=es,this.removeListeners=es,this.controls=new A$(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||es}unmount(){this.removeGroupControls(),this.removeListeners()}}const CN=e=>(t,n)=>{e&&Gt.postRender(()=>e(t,n))};class O$ extends Va{constructor(){super(...arguments),this.removePointerDownListener=es}onPointerDown(t){this.session=new KR(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:JR(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:CN(t),onStart:CN(n),onMove:r,onEnd:(i,a)=>{delete this.session,s&&Gt.postRender(()=>s(i,a))}}}mount(){this.removePointerDownListener=nd(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const wp={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function IN(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const gu={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(et.test(e))e=parseFloat(e);else return e;const n=IN(e,t.target.x),r=IN(e,t.target.y);return`${n}% ${r}%`}},R$={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,s=Ua.parse(e);if(s.length>5)return r;const i=Ua.createTransformer(e),a=typeof s[0]!="number"?1:0,o=n.x.scale*t.x,c=n.y.scale*t.y;s[0+a]/=o,s[1+a]/=c;const u=cn(o,c,.5);return typeof s[2+a]=="number"&&(s[2+a]/=u),typeof s[3+a]=="number"&&(s[3+a]/=u),i(s)}};class L$ extends w.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=t;i9(M$),i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),wp.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,a=r.projection;return a&&(a.isPresent=i,s||t.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?a.promote():a.relegate()||Gt.postRender(()=>{const o=a.getStack();(!o||!o.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),Jx.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=t;s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function eL(e){const[t,n]=PO(),r=w.useContext(Gx);return l.jsx(L$,{...e,layoutGroup:r,switchLayoutGroup:w.useContext(YO),isPresent:t,safeToRemove:n})}const M$={borderRadius:{...gu,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:gu,borderTopRightRadius:gu,borderBottomLeftRadius:gu,borderBottomRightRadius:gu,boxShadow:R$};function j$(e,t,n){const r=hr(e)?e:$d(e);return r.start(kw("",r,t,n)),r.animation}function D$(e){return e instanceof SVGElement&&e.tagName!=="svg"}const P$=(e,t)=>e.depth-t.depth;class B${constructor(){this.children=[],this.isDirty=!1}add(t){uw(this.children,t),this.isDirty=!0}remove(t){dw(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(P$),this.isDirty=!1,this.children.forEach(t)}}function F$(e,t){const n=Ei.now(),r=({timestamp:s})=>{const i=s-n;i>=t&&(Fa(r),e(i-t))};return Gt.read(r,!0),()=>Fa(r)}const tL=["TopLeft","TopRight","BottomLeft","BottomRight"],U$=tL.length,ON=e=>typeof e=="string"?parseFloat(e):e,RN=e=>typeof e=="number"||et.test(e);function $$(e,t,n,r,s,i){s?(e.opacity=cn(0,n.opacity!==void 0?n.opacity:1,H$(r)),e.opacityExit=cn(t.opacity!==void 0?t.opacity:1,0,z$(r))):i&&(e.opacity=cn(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let a=0;art?1:n(yc(e,t,r))}function MN(e,t){e.min=t.min,e.max=t.max}function fs(e,t){MN(e.x,t.x),MN(e.y,t.y)}function jN(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function DN(e,t,n,r,s){return e-=t,e=bm(e,1/n,r),s!==void 0&&(e=bm(e,1/s,r)),e}function V$(e,t=0,n=1,r=.5,s,i=e,a=e){if(bi.test(t)&&(t=parseFloat(t),t=cn(a.min,a.max,t/100)-a.min),typeof t!="number")return;let o=cn(i.min,i.max,r);e===i&&(o-=t),e.min=DN(e.min,t,n,o,s),e.max=DN(e.max,t,n,o,s)}function PN(e,t,[n,r,s],i,a){V$(e,t[n],t[r],t[s],t.scale,i,a)}const K$=["x","scaleX","originX"],Y$=["y","scaleY","originY"];function BN(e,t,n,r){PN(e.x,t,K$,n?n.x:void 0,r?r.x:void 0),PN(e.y,t,Y$,n?n.y:void 0,r?r.y:void 0)}function FN(e){return e.translate===0&&e.scale===1}function rL(e){return FN(e.x)&&FN(e.y)}function UN(e,t){return e.min===t.min&&e.max===t.max}function W$(e,t){return UN(e.x,t.x)&&UN(e.y,t.y)}function $N(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function sL(e,t){return $N(e.x,t.x)&&$N(e.y,t.y)}function HN(e){return rs(e.x)/rs(e.y)}function zN(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class G${constructor(){this.members=[]}add(t){uw(this.members,t),t.scheduleRender()}remove(t){if(dw(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(s=>t===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:s}=t.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function q$(e,t,n){let r="";const s=e.x.translate/t.x,i=e.y.translate/t.y,a=(n==null?void 0:n.z)||0;if((s||i||a)&&(r=`translate3d(${s}px, ${i}px, ${a}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:f,rotateY:h,skewX:p,skewY:m}=n;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),f&&(r+=`rotateX(${f}deg) `),h&&(r+=`rotateY(${h}deg) `),p&&(r+=`skewX(${p}deg) `),m&&(r+=`skewY(${m}deg) `)}const o=e.x.scale*t.x,c=e.y.scale*t.y;return(o!==1||c!==1)&&(r+=`scale(${o}, ${c})`),r||"none"}const oo={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Du=typeof window<"u"&&window.MotionDebug!==void 0,dy=["","X","Y","Z"],X$={visibility:"hidden"},VN=1e3;let Q$=0;function fy(e,t,n,r){const{latestValues:s}=t;s[e]&&(n[e]=s[e],t.setStaticValue(e,0),r&&(r[e]=0))}function iL(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=lR(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Gt,!(s||i))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&iL(r)}function aL({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(a={},o=t==null?void 0:t()){this.id=Q$++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Du&&(oo.totalNodes=oo.resolvedTargetDeltas=oo.recalculatedProjection=0),this.nodes.forEach(e7),this.nodes.forEach(i7),this.nodes.forEach(a7),this.nodes.forEach(t7),Du&&window.MotionDebug.record(oo)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=o?o.root||o:this,this.path=o?[...o.path,o]:[],this.parent=o,this.depth=o?o.depth+1:0;for(let c=0;cthis.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=F$(h,250),wp.hasAnimatedSinceResize&&(wp.hasAnimatedSinceResize=!1,this.nodes.forEach(YN))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:p,layout:m})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const y=this.options.transition||d.getDefaultTransition()||d7,{onLayoutAnimationStart:E,onLayoutAnimationComplete:g}=d.getProps(),x=!this.targetLayout||!sL(this.targetLayout,m)||p,b=!h&&p;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||b||h&&(x||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,b);const _={...cw(y,"layout"),onPlay:E,onComplete:g};(d.shouldReduceMotion||this.options.layoutRoot)&&(_.delay=0,_.type=!1),this.startAnimation(_)}else h||YN(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=m})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Fa(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(o7),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&iL(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c{const k=_/1e3;WN(f.x,a.x,k),WN(f.y,a.y,k),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(sd(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),c7(this.relativeTarget,this.relativeTargetOrigin,h,k),b&&W$(this.relativeTarget,b)&&(this.isProjectionDirty=!1),b||(b=xn()),fs(b,this.relativeTarget)),y&&(this.animationValues=d,$$(d,u,this.latestValues,k,x,g)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=k},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Fa(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Gt.update(()=>{wp.hasAnimatedSinceResize=!0,this.currentAnimation=j$(0,VN,{...a,onUpdate:o=>{this.mixTargetDelta(o),a.onUpdate&&a.onUpdate(o)},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(VN),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:o,target:c,layout:u,latestValues:d}=a;if(!(!o||!c||!u)){if(this!==a&&this.layout&&u&&oL(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||xn();const f=rs(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+f;const h=rs(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+h}fs(o,c),Fl(o,d),rd(this.projectionDeltaWithTransform,this.layoutCorrected,o,d)}}registerSharedNode(a,o){this.sharedNodes.has(a)||this.sharedNodes.set(a,new G$),this.sharedNodes.get(a).add(o);const u=o.options.initialPromotionConfig;o.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(o):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:o}=this.options;return o?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:o}=this.options;return o?(a=this.getStack())===null||a===void 0?void 0:a.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:o,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),a&&(this.projectionDelta=void 0,this.needsReset=!0),o&&this.setOptions({transition:o})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let o=!1;const{latestValues:c}=a;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(o=!0),!o)return;const u={};c.z&&fy("z",a,u,this.animationValues);for(let d=0;d{var o;return(o=a.currentAnimation)===null||o===void 0?void 0:o.stop()}),this.root.nodes.forEach(KN),this.root.sharedNodes.clear()}}}function Z$(e){e.updateLayout()}function J$(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=e.layout,{animationType:i}=e.options,a=n.source!==e.layout.source;i==="size"?hs(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=rs(h);h.min=r[f].min,h.max=h.min+p}):oL(i,n.layoutBox,r)&&hs(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=rs(r[f]);h.max=h.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+p)});const o=Pl();rd(o,r,n.layoutBox);const c=Pl();a?rd(c,e.applyTransform(s,!0),n.measuredBox):rd(c,r,n.layoutBox);const u=!rL(o);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:p}=f;if(h&&p){const m=xn();sd(m,n.layoutBox,h.layoutBox);const y=xn();sd(y,r,p.layoutBox),sL(m,y)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=y,e.relativeTargetOrigin=m,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:c,layoutDelta:o,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function e7(e){Du&&oo.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function t7(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function n7(e){e.clearSnapshot()}function KN(e){e.clearMeasurements()}function r7(e){e.isLayoutDirty=!1}function s7(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function YN(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function i7(e){e.resolveTargetDelta()}function a7(e){e.calcProjection()}function o7(e){e.resetSkewAndRotation()}function l7(e){e.removeLeadSnapshot()}function WN(e,t,n){e.translate=cn(t.translate,0,n),e.scale=cn(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function GN(e,t,n,r){e.min=cn(t.min,n.min,r),e.max=cn(t.max,n.max,r)}function c7(e,t,n,r){GN(e.x,t.x,n.x,r),GN(e.y,t.y,n.y,r)}function u7(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const d7={duration:.45,ease:[.4,0,.1,1]},qN=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),XN=qN("applewebkit/")&&!qN("chrome/")?Math.round:es;function QN(e){e.min=XN(e.min),e.max=XN(e.max)}function f7(e){QN(e.x),QN(e.y)}function oL(e,t,n){return e==="position"||e==="preserve-aspect"&&!m$(HN(t),HN(n),.2)}function h7(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const p7=aL({attachResizeListener:(e,t)=>zd(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),hy={current:void 0},lL=aL({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!hy.current){const e=new p7({});e.mount(window),e.setOptions({layoutScroll:!0}),hy.current=e}return hy.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),m7={pan:{Feature:O$},drag:{Feature:I$,ProjectionNode:lL,MeasureLayout:eL}};function g7(e,t,n){var r;if(e instanceof Element)return[e];if(typeof e=="string"){let s=document;const i=(r=void 0)!==null&&r!==void 0?r:s.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}function cL(e,t){const n=g7(e),r=new AbortController,s={passive:!0,...t,signal:r.signal};return[n,s,()=>r.abort()]}function ZN(e){return t=>{t.pointerType==="touch"||VR()||e(t)}}function y7(e,t,n={}){const[r,s,i]=cL(e,n),a=ZN(o=>{const{target:c}=o,u=t(o);if(typeof u!="function"||!c)return;const d=ZN(f=>{u(f),c.removeEventListener("pointerleave",d)});c.addEventListener("pointerleave",d,s)});return r.forEach(o=>{o.addEventListener("pointerenter",a,s)}),i}function JN(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,i=r[s];i&&Gt.postRender(()=>i(t,_f(t)))}class b7 extends Va{mount(){const{current:t}=this.node;t&&(this.unmount=y7(t,n=>(JN(this.node,n,"Start"),r=>JN(this.node,r,"End"))))}unmount(){}}class E7 extends Va{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=vf(zd(this.node.current,"focus",()=>this.onFocus()),zd(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const uL=(e,t)=>t?e===t?!0:uL(e,t.parentElement):!1,x7=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function w7(e){return x7.has(e.tagName)||e.tabIndex!==-1}const Pu=new WeakSet;function eS(e){return t=>{t.key==="Enter"&&e(t)}}function py(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const v7=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=eS(()=>{if(Pu.has(n))return;py(n,"down");const s=eS(()=>{py(n,"up")}),i=()=>py(n,"cancel");n.addEventListener("keyup",s,t),n.addEventListener("blur",i,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function tS(e){return Nw(e)&&!VR()}function _7(e,t,n={}){const[r,s,i]=cL(e,n),a=o=>{const c=o.currentTarget;if(!tS(o)||Pu.has(c))return;Pu.add(c);const u=t(o),d=(p,m)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),!(!tS(p)||!Pu.has(c))&&(Pu.delete(c),typeof u=="function"&&u(p,{success:m}))},f=p=>{d(p,n.useGlobalTarget||uL(c,p.target))},h=p=>{d(p,!1)};window.addEventListener("pointerup",f,s),window.addEventListener("pointercancel",h,s)};return r.forEach(o=>{!w7(o)&&o.getAttribute("tabindex")===null&&(o.tabIndex=0),(n.useGlobalTarget?window:o).addEventListener("pointerdown",a,s),o.addEventListener("focus",u=>v7(u,s),s)}),i}function nS(e,t,n){const{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),i=r[s];i&&Gt.postRender(()=>i(t,_f(t)))}class k7 extends Va{mount(){const{current:t}=this.node;t&&(this.unmount=_7(t,n=>(nS(this.node,n,"Start"),(r,{success:s})=>nS(this.node,r,s?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const D1=new WeakMap,my=new WeakMap,N7=e=>{const t=D1.get(e.target);t&&t(e)},S7=e=>{e.forEach(N7)};function T7({root:e,...t}){const n=e||document;my.has(n)||my.set(n,{});const r=my.get(n),s=JSON.stringify(t);return r[s]||(r[s]=new IntersectionObserver(S7,{root:e,...t})),r[s]}function A7(e,t,n){const r=T7(t);return D1.set(e,n),r.observe(e),()=>{D1.delete(e),r.unobserve(e)}}const C7={some:0,all:1};class I7 extends Va{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=t,a={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:C7[s]},o=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,i&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:f}=this.node.getProps(),h=u?d:f;h&&h(c)};return A7(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(O7(t,n))&&this.startObserver()}unmount(){}}function O7({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const R7={inView:{Feature:I7},tap:{Feature:k7},focus:{Feature:E7},hover:{Feature:b7}},L7={layout:{ProjectionNode:lL,MeasureLayout:eL}},P1={current:null},dL={current:!1};function M7(){if(dL.current=!0,!!qx)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>P1.current=e.matches;e.addListener(t),t()}else P1.current=!1}const j7=[...RR,dr,Ua],D7=e=>j7.find(OR(e)),rS=new WeakMap;function P7(e,t,n){for(const r in t){const s=t[r],i=n[r];if(hr(s))e.addValue(r,s);else if(hr(i))e.addValue(r,$d(s,{owner:e}));else if(i!==s)if(e.hasValue(r)){const a=e.getValue(r);a.liveStyle===!0?a.jump(s):a.hasAnimated||a.set(s)}else{const a=e.getStaticValue(r);e.addValue(r,$d(a!==void 0?a:s,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const sS=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class B7{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:i,visualState:a},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=ww,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=Ei.now();this.renderScheduledAtthis.bindToMotionValue(r,n)),dL.current||M7(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:P1.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){rS.delete(this.current),this.projection&&this.projection.unmount(),Fa(this.notifyUpdate),Fa(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(t,n){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const r=Go.has(t),s=n.on("change",o=>{this.latestValues[t]=o,this.props.onUpdate&&Gt.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),i=n.on("renderRequest",this.scheduleRender);let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{s(),i(),a&&a(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in gc){const n=gc[t];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[t]&&s&&r(this.props)&&(this.features[t]=new s(this)),this.features[t]){const i=this.features[t];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):xn()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=$d(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){var r;let s=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(r=this.getBaseTargetFromProps(this.props,t))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,t,this.options);return s!=null&&(typeof s=="string"&&(CR(s)||xR(s))?s=parseFloat(s):!D7(s)&&Ua.test(n)&&(s=SR(t,n)),this.setBaseTarget(t,hr(s)?s.get():s)),hr(s)?s.get():s}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props;let s;if(typeof r=="string"||typeof r=="object"){const a=tw(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);a&&(s=a[t])}if(r&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!hr(i)?i:this.initialValues[t]!==void 0&&s===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new fw),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class fL extends B7{constructor(){super(...arguments),this.KeyframeResolver=LR}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;hr(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function F7(e){return window.getComputedStyle(e)}class U7 extends fL{constructor(){super(...arguments),this.type="html",this.renderInstance=JO}readValueFromInstance(t,n){if(Go.has(n)){const r=xw(n);return r&&r.default||0}else{const r=F7(t),s=(XO(n)?r.getPropertyValue(n):r[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return ZR(t,n)}build(t,n,r){sw(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return lw(t,n,r)}}class $7 extends fL{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=xn}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Go.has(n)){const r=xw(n);return r&&r.default||0}return n=eR.has(n)?n:Zx(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return rR(t,n,r)}build(t,n,r){iw(t,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,n,r,s){tR(t,n,r,s)}mount(t){this.isSVGTag=ow(t.tagName),super.mount(t)}}const H7=(e,t)=>ew(e)?new $7(t):new U7(t,{allowProjection:e!==w.Fragment}),z7=p9({...i$,...R7,...m7,...L7},H7),$t=CF(z7);function Pn(){return Pn=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u"||/ServerSideRendering/.test(navigator&&navigator.userAgent)?w.useEffect:w.useLayoutEffect;function bl(e,t,n){var r=w.useRef(t);r.current=t,w.useEffect(function(){function s(i){r.current(i)}return e&&window.addEventListener(e,s,n),function(){e&&window.removeEventListener(e,s)}},[e])}var V7=["container"];function K7(e){var t=e.container,n=t===void 0?document.body:t,r=Tg(e,V7);return Ss.createPortal(dt.createElement("div",Pn({},r)),n)}function Y7(e){return dt.createElement("svg",Pn({width:"44",height:"44",viewBox:"0 0 768 768"},e),dt.createElement("path",{d:"M607.5 205.5l-178.5 178.5 178.5 178.5-45 45-178.5-178.5-178.5 178.5-45-45 178.5-178.5-178.5-178.5 45-45 178.5 178.5 178.5-178.5z"}))}function W7(e){return dt.createElement("svg",Pn({width:"44",height:"44",viewBox:"0 0 768 768"},e),dt.createElement("path",{d:"M640.5 352.5v63h-390l178.5 180-45 45-256.5-256.5 256.5-256.5 45 45-178.5 180h390z"}))}function G7(e){return dt.createElement("svg",Pn({width:"44",height:"44",viewBox:"0 0 768 768"},e),dt.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function q7(){return w.useEffect(function(){var e=document.body.style,t=e.overflow;return e.overflow="hidden",function(){e.overflow=t}},[]),null}function aS(e){var t=e.touches[0],n=t.clientX,r=t.clientY;if(e.touches.length>=2){var s=e.touches[1],i=s.clientX,a=s.clientY;return[(n+i)/2,(r+a)/2,Math.sqrt(Math.pow(i-n,2)+Math.pow(a-r,2))]}return[n,r,0]}var ba=function(e,t,n,r){var s,i=n*t,a=(i-r)/2,o=e;return i<=r?(s=1,o=0):e>0&&a-e<=0?(s=2,o=a):e<0&&a+e<=0&&(s=3,o=-a),[s,o]};function gy(e,t,n,r,s,i,a,o,c,u){a===void 0&&(a=innerWidth/2),o===void 0&&(o=innerHeight/2),c===void 0&&(c=0),u===void 0&&(u=0);var d=ba(e,i,n,innerWidth)[0],f=ba(t,i,r,innerHeight),h=innerWidth/2,p=innerHeight/2;return{x:a-i/s*(a-(h+e))-h+(r/n>=3&&n*i===innerWidth?0:d?c/2:c),y:o-i/s*(o-(p+t))-p+(f[0]?u/2:u),lastCX:a,lastCY:o}}function U1(e,t,n){var r=e%180!=0;return r?[n,t,r]:[t,n,r]}function yy(e,t,n){var r=U1(n,innerWidth,innerHeight),s=r[0],i=r[1],a=0,o=s,c=i,u=e/t*i,d=t/e*s;return e=i?o=u:e>=s&&ts/i?c=d:t/e>=3&&!r[2]?a=((c=d)-i)/2:o=u,{width:o,height:c,x:0,y:a,pause:!0}}function Ih(e,t){var n=t.leading,r=n!==void 0&&n,s=t.maxWait,i=t.wait,a=i===void 0?s||0:i,o=w.useRef(e);o.current=e;var c=w.useRef(0),u=w.useRef(),d=function(){return u.current&&clearTimeout(u.current)},f=w.useCallback(function(){var h=[].slice.call(arguments),p=Date.now();function m(){c.current=p,d(),o.current.apply(null,h)}var y=c.current,E=p-y;if(y===0&&(r&&m(),c.current=p),s!==void 0){if(E>s)return void m()}else E=1&&i&&i())};d()}function d(){c=requestAnimationFrame(u)}}var Q7={T:0,L:0,W:0,H:0,FIT:void 0},pL=function(){var e=w.useRef(!1);return w.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),e},Z7=["className"];function J7(e){var t=e.className,n=t===void 0?"":t,r=Tg(e,Z7);return dt.createElement("div",Pn({className:"PhotoView__Spinner "+n},r),dt.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},dt.createElement("path",{opacity:".25",d:"M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4"}),dt.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}var eH=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function tH(e){var t=e.src,n=e.loaded,r=e.broken,s=e.className,i=e.onPhotoLoad,a=e.loadingElement,o=e.brokenElement,c=Tg(e,eH),u=pL();return t&&!r?dt.createElement(dt.Fragment,null,dt.createElement("img",Pn({className:"PhotoView__Photo"+(s?" "+s:""),src:t,onLoad:function(d){var f=d.target;u.current&&i({loaded:!0,naturalWidth:f.naturalWidth,naturalHeight:f.naturalHeight})},onError:function(){u.current&&i({broken:!0})},draggable:!1,alt:""},c)),!n&&(a?dt.createElement("span",{className:"PhotoView__icon"},a):dt.createElement(J7,{className:"PhotoView__icon"}))):o?dt.createElement("span",{className:"PhotoView__icon"},typeof o=="function"?o({src:t}):o):null}var nH={naturalWidth:void 0,naturalHeight:void 0,width:void 0,height:void 0,loaded:void 0,broken:!1,x:0,y:0,touched:!1,maskTouched:!1,rotate:0,scale:1,CX:0,CY:0,lastX:0,lastY:0,lastCX:0,lastCY:0,lastScale:1,touchTime:0,touchLength:0,pause:!0,stopRaf:!0,reach:void 0};function rH(e){var t=e.item,n=t.src,r=t.render,s=t.width,i=s===void 0?0:s,a=t.height,o=a===void 0?0:a,c=t.originRef,u=e.visible,d=e.speed,f=e.easing,h=e.wrapClassName,p=e.className,m=e.style,y=e.loadingElement,E=e.brokenElement,g=e.onPhotoTap,x=e.onMaskTap,b=e.onReachMove,_=e.onReachUp,k=e.onPhotoResize,N=e.isActive,C=e.expose,S=Em(nH),A=S[0],O=S[1],D=w.useRef(0),U=pL(),X=A.naturalWidth,M=X===void 0?i:X,j=A.naturalHeight,T=j===void 0?o:j,L=A.width,R=L===void 0?i:L,F=A.height,I=F===void 0?o:F,V=A.loaded,W=V===void 0?!n:V,P=A.broken,ie=A.x,G=A.y,re=A.touched,ue=A.stopRaf,ee=A.maskTouched,le=A.rotate,ne=A.scale,me=A.CX,ye=A.CY,te=A.lastX,de=A.lastY,Ee=A.lastCX,Te=A.lastCY,Ke=A.lastScale,Ne=A.touchTime,it=A.touchLength,He=A.pause,Ue=A.reach,Et=So({onScale:function(fe){return rt(Ch(fe))},onRotate:function(fe){le!==fe&&(C({rotate:fe}),O(Pn({rotate:fe},yy(M,T,fe))))}});function rt(fe,$e,nt){ne!==fe&&(C({scale:fe}),O(Pn({scale:fe},gy(ie,G,R,I,ne,fe,$e,nt),fe<=1&&{x:0,y:0})))}var St=Ih(function(fe,$e,nt){if(nt===void 0&&(nt=0),(re||ee)&&N){var qt=U1(le,R,I),fn=qt[0],Lt=qt[1];if(nt===0&&D.current===0){var J=Math.abs(fe-me)<=20,he=Math.abs($e-ye)<=20;if(J&&he)return void O({lastCX:fe,lastCY:$e});D.current=J?$e>ye?3:2:1}var Le,Be=fe-Ee,ot=$e-Te;if(nt===0){var It=ba(Be+te,ne,fn,innerWidth)[0],st=ba(ot+de,ne,Lt,innerHeight);Le=function(we,_e,We,Ve){return _e&&we===1||Ve==="x"?"x":We&&we>1||Ve==="y"?"y":void 0}(D.current,It,st[0],Ue),Le!==void 0&&b(Le,fe,$e,ne)}if(Le==="x"||ee)return void O({reach:"x"});var Z=Ch(ne+(nt-it)/100/2*ne,M/R,.2);C({scale:Z}),O(Pn({touchLength:nt,reach:Le,scale:Z},gy(ie,G,R,I,ne,Z,fe,$e,Be,ot)))}},{maxWait:8});function ct(fe){return!ue&&!re&&(U.current&&O(Pn({},fe,{pause:u})),U.current)}var B,Q,oe,be,Oe,Ye,tt,ze,Tt=(Oe=function(fe){return ct({x:fe})},Ye=function(fe){return ct({y:fe})},tt=function(fe){return U.current&&(C({scale:fe}),O({scale:fe})),!re&&U.current},ze=So({X:function(fe){return Oe(fe)},Y:function(fe){return Ye(fe)},S:function(fe){return tt(fe)}}),function(fe,$e,nt,qt,fn,Lt,J,he,Le,Be,ot){var It=U1(Be,fn,Lt),st=It[0],Z=It[1],we=ba(fe,he,st,innerWidth),_e=we[0],We=we[1],Ve=ba($e,he,Z,innerHeight),Je=Ve[0],ut=Ve[1],Vt=Date.now()-ot;if(Vt>=200||he!==J||Math.abs(Le-J)>1){var Ft=gy(fe,$e,fn,Lt,J,he),hn=Ft.x,Tn=Ft.y,Kt=_e?We:hn!==fe?hn:null,os=Je?ut:Tn!==$e?Tn:null;return Kt!==null&&fo(fe,Kt,ze.X),os!==null&&fo($e,os,ze.Y),void(he!==J&&fo(J,he,ze.S))}var Er=(fe-nt)/Vt,Xn=($e-qt)/Vt,Or=Math.sqrt(Math.pow(Er,2)+Math.pow(Xn,2)),Qn=!1,ar=!1;(function(An,Xt){var En,Un=An,or=0,nn=0,ls=function(Jn){En||(En=Jn);var Is=Jn-En,Rr=Math.sign(An),xr=-.001*Rr,cs=Math.sign(-Un)*Math.pow(Un,2)*2e-4,Kr=Un*Is+(xr+cs)*Math.pow(Is,2)/2;or+=Kr,En=Jn,Rr*(Un+=(xr+cs)*Is)<=0?$n():Xt(or)?Zn():$n()};function Zn(){nn=requestAnimationFrame(ls)}function $n(){cancelAnimationFrame(nn)}Zn()})(Or,function(An){var Xt=fe+An*(Er/Or),En=$e+An*(Xn/Or),Un=ba(Xt,J,st,innerWidth),or=Un[0],nn=Un[1],ls=ba(En,J,Z,innerHeight),Zn=ls[0],$n=ls[1];if(or&&!Qn&&(Qn=!0,_e?fo(Xt,nn,ze.X):oS(nn,Xt+(Xt-nn),ze.X)),Zn&&!ar&&(ar=!0,Je?fo(En,$n,ze.Y):oS($n,En+(En-$n),ze.Y)),Qn&&ar)return!1;var Jn=Qn||ze.X(nn),Is=ar||ze.Y($n);return Jn&&Is})}),Re=(B=g,Q=function(fe,$e){Ue||rt(ne!==1?1:Math.max(2,M/R),fe,$e)},oe=w.useRef(0),be=Ih(function(){oe.current=0,B.apply(void 0,[].slice.call(arguments))},{wait:300}),function(){var fe=[].slice.call(arguments);oe.current+=1,be.apply(void 0,fe),oe.current>=2&&(be.cancel(),oe.current=0,Q.apply(void 0,fe))});function kt(fe,$e){if(D.current=0,(re||ee)&&N){O({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});var nt=Ch(ne,M/R);if(Tt(ie,G,te,de,R,I,ne,nt,Ke,le,Ne),_(fe,$e),me===fe&&ye===$e){if(re)return void Re(fe,$e);ee&&x(fe,$e)}}}function Pt(fe,$e,nt){nt===void 0&&(nt=0),O({touched:!0,CX:fe,CY:$e,lastCX:fe,lastCY:$e,lastX:ie,lastY:G,lastScale:ne,touchLength:nt,touchTime:Date.now()})}function Bt(fe){O({maskTouched:!0,CX:fe.clientX,CY:fe.clientY,lastX:ie,lastY:G})}bl(Pi?void 0:"mousemove",function(fe){fe.preventDefault(),St(fe.clientX,fe.clientY)}),bl(Pi?void 0:"mouseup",function(fe){kt(fe.clientX,fe.clientY)}),bl(Pi?"touchmove":void 0,function(fe){fe.preventDefault();var $e=aS(fe);St.apply(void 0,$e)},{passive:!1}),bl(Pi?"touchend":void 0,function(fe){var $e=fe.changedTouches[0];kt($e.clientX,$e.clientY)},{passive:!1}),bl("resize",Ih(function(){W&&!re&&(O(yy(M,T,le)),k())},{maxWait:8})),F1(function(){N&&C(Pn({scale:ne,rotate:le},Et))},[N]);var bn=function(fe,$e,nt,qt,fn,Lt,J,he,Le,Be){var ot=function(hn,Tn,Kt,os,Er){var Xn=w.useRef(!1),Or=Em({lead:!0,scale:Kt}),Qn=Or[0],ar=Qn.lead,An=Qn.scale,Xt=Or[1],En=Ih(function(Un){try{return Er(!0),Xt({lead:!1,scale:Un}),Promise.resolve()}catch(or){return Promise.reject(or)}},{wait:os});return F1(function(){Xn.current?(Er(!1),Xt({lead:!0}),En(Kt)):Xn.current=!0},[Kt]),ar?[hn*An,Tn*An,Kt/An]:[hn*Kt,Tn*Kt,1]}(Lt,J,he,Le,Be),It=ot[0],st=ot[1],Z=ot[2],we=function(hn,Tn,Kt,os,Er){var Xn=w.useState(Q7),Or=Xn[0],Qn=Xn[1],ar=w.useState(0),An=ar[0],Xt=ar[1],En=w.useRef(),Un=So({OK:function(){return hn&&Xt(4)}});function or(nn){Er(!1),Xt(nn)}return w.useEffect(function(){if(En.current||(En.current=Date.now()),Kt){if(function(nn,ls){var Zn=nn&&nn.current;if(Zn&&Zn.nodeType===1){var $n=Zn.getBoundingClientRect();ls({T:$n.top,L:$n.left,W:$n.width,H:$n.height,FIT:Zn.tagName==="IMG"?getComputedStyle(Zn).objectFit:void 0})}}(Tn,Qn),hn)return Date.now()-En.current<250?(Xt(1),requestAnimationFrame(function(){Xt(2),requestAnimationFrame(function(){return or(3)})}),void setTimeout(Un.OK,os)):void Xt(4);or(5)}},[hn,Kt]),[An,Or]}(fe,$e,nt,Le,Be),_e=we[0],We=we[1],Ve=We.W,Je=We.FIT,ut=innerWidth/2,Vt=innerHeight/2,Ft=_e<3||_e>4;return[Ft?Ve?We.L:ut:qt+(ut-Lt*he/2),Ft?Ve?We.T:Vt:fn+(Vt-J*he/2),It,Ft&&Je?It*(We.H/Ve):st,_e===0?Z:Ft?Ve/(Lt*he)||.01:Z,Ft?Je?1:0:1,_e,Je]}(u,c,W,ie,G,R,I,ne,d,function(fe){return O({pause:fe})}),Xe=bn[4],ft=bn[6],xt="transform "+d+"ms "+f,vt={className:p,onMouseDown:Pi?void 0:function(fe){fe.stopPropagation(),fe.button===0&&Pt(fe.clientX,fe.clientY,0)},onTouchStart:Pi?function(fe){fe.stopPropagation(),Pt.apply(void 0,aS(fe))}:void 0,onWheel:function(fe){if(!Ue){var $e=Ch(ne-fe.deltaY/100/2,M/R);O({stopRaf:!0}),rt($e,fe.clientX,fe.clientY)}},style:{width:bn[2]+"px",height:bn[3]+"px",opacity:bn[5],objectFit:ft===4?void 0:bn[7],transform:le?"rotate("+le+"deg)":void 0,transition:ft>2?xt+", opacity "+d+"ms ease, height "+(ft<4?d/2:ft>4?d:0)+"ms "+f:void 0}};return dt.createElement("div",{className:"PhotoView__PhotoWrap"+(h?" "+h:""),style:m,onMouseDown:!Pi&&N?Bt:void 0,onTouchStart:Pi&&N?function(fe){return Bt(fe.touches[0])}:void 0},dt.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:"matrix("+Xe+", 0, 0, "+Xe+", "+bn[0]+", "+bn[1]+")",transition:re||He?void 0:xt,willChange:N?"transform":void 0}},n?dt.createElement(tH,Pn({src:n,loaded:W,broken:P},vt,{onPhotoLoad:function(fe){O(Pn({},fe,fe.loaded&&yy(fe.naturalWidth||0,fe.naturalHeight||0,le)))},loadingElement:y,brokenElement:E})):r&&r({attrs:vt,scale:Xe,rotate:le})))}var lS={x:0,touched:!1,pause:!1,lastCX:void 0,lastCY:void 0,bg:void 0,lastBg:void 0,overlay:!0,minimal:!0,scale:1,rotate:0};function sH(e){var t=e.loop,n=t===void 0?3:t,r=e.speed,s=e.easing,i=e.photoClosable,a=e.maskClosable,o=a===void 0||a,c=e.maskOpacity,u=c===void 0?1:c,d=e.pullClosable,f=d===void 0||d,h=e.bannerVisible,p=h===void 0||h,m=e.overlayRender,y=e.toolbarRender,E=e.className,g=e.maskClassName,x=e.photoClassName,b=e.photoWrapClassName,_=e.loadingElement,k=e.brokenElement,N=e.images,C=e.index,S=C===void 0?0:C,A=e.onIndexChange,O=e.visible,D=e.onClose,U=e.afterClose,X=e.portalContainer,M=Em(lS),j=M[0],T=M[1],L=w.useState(0),R=L[0],F=L[1],I=j.x,V=j.touched,W=j.pause,P=j.lastCX,ie=j.lastCY,G=j.bg,re=G===void 0?u:G,ue=j.lastBg,ee=j.overlay,le=j.minimal,ne=j.scale,me=j.rotate,ye=j.onScale,te=j.onRotate,de=e.hasOwnProperty("index"),Ee=de?S:R,Te=de?A:F,Ke=w.useRef(Ee),Ne=N.length,it=N[Ee],He=typeof n=="boolean"?n:Ne>n,Ue=function(Xe,ft){var xt=w.useReducer(function(nt){return!nt},!1)[1],vt=w.useRef(0),fe=function(nt){var qt=w.useRef(nt);function fn(Lt){qt.current=Lt}return w.useMemo(function(){(function(Lt){Xe?(Lt(Xe),vt.current=1):vt.current=2})(fn)},[nt]),[qt.current,fn]}(Xe),$e=fe[1];return[fe[0],vt.current,function(){xt(),vt.current===2&&($e(!1),ft&&ft()),vt.current=0}]}(O,U),Et=Ue[0],rt=Ue[1],St=Ue[2];F1(function(){if(Et)return T({pause:!0,x:Ee*-(innerWidth+ul)}),void(Ke.current=Ee);T(lS)},[Et]);var ct=So({close:function(Xe){te&&te(0),T({overlay:!0,lastBg:re}),D(Xe)},changeIndex:function(Xe,ft){ft===void 0&&(ft=!1);var xt=He?Ke.current+(Xe-Ee):Xe,vt=Ne-1,fe=B1(xt,0,vt),$e=He?xt:fe,nt=innerWidth+ul;T({touched:!1,lastCX:void 0,lastCY:void 0,x:-nt*$e,pause:ft}),Ke.current=$e,Te&&Te(He?Xe<0?vt:Xe>vt?0:Xe:fe)}}),B=ct.close,Q=ct.changeIndex;function oe(Xe){return Xe?B():T({overlay:!ee})}function be(){T({x:-(innerWidth+ul)*Ee,lastCX:void 0,lastCY:void 0,pause:!0}),Ke.current=Ee}function Oe(Xe,ft,xt,vt){Xe==="x"?function(fe){if(P!==void 0){var $e=fe-P,nt=$e;!He&&(Ee===0&&$e>0||Ee===Ne-1&&$e<0)&&(nt=$e/2),T({touched:!0,lastCX:P,x:-(innerWidth+ul)*Ke.current+nt,pause:!1})}else T({touched:!0,lastCX:fe,x:I,pause:!1})}(ft):Xe==="y"&&function(fe,$e){if(ie!==void 0){var nt=u===null?null:B1(u,.01,u-Math.abs(fe-ie)/100/4);T({touched:!0,lastCY:ie,bg:$e===1?nt:u,minimal:$e===1})}else T({touched:!0,lastCY:fe,bg:re,minimal:!0})}(xt,vt)}function Ye(Xe,ft){var xt=Xe-(P??Xe),vt=ft-(ie??ft),fe=!1;if(xt<-40)Q(Ee+1);else if(xt>40)Q(Ee-1);else{var $e=-(innerWidth+ul)*Ke.current;Math.abs(vt)>100&&le&&f&&(fe=!0,B()),T({touched:!1,x:$e,lastCX:void 0,lastCY:void 0,bg:u,overlay:!!fe||ee})}}bl("keydown",function(Xe){if(O)switch(Xe.key){case"ArrowLeft":Q(Ee-1,!0);break;case"ArrowRight":Q(Ee+1,!0);break;case"Escape":B()}});var tt=function(Xe,ft,xt){return w.useMemo(function(){var vt=Xe.length;return xt?Xe.concat(Xe).concat(Xe).slice(vt+ft-1,vt+ft+2):Xe.slice(Math.max(ft-1,0),Math.min(ft+2,vt+1))},[Xe,ft,xt])}(N,Ee,He);if(!Et)return null;var ze=ee&&!rt,Tt=O?re:ue,Re=ye&&te&&{images:N,index:Ee,visible:O,onClose:B,onIndexChange:Q,overlayVisible:ze,overlay:it&&it.overlay,scale:ne,rotate:me,onScale:ye,onRotate:te},kt=r?r(rt):400,Pt=s?s(rt):iS,Bt=r?r(3):600,bn=s?s(3):iS;return dt.createElement(K7,{className:"PhotoView-Portal"+(ze?"":" PhotoView-Slider__clean")+(O?"":" PhotoView-Slider__willClose")+(E?" "+E:""),role:"dialog",onClick:function(Xe){return Xe.stopPropagation()},container:X},O&&dt.createElement(q7,null),dt.createElement("div",{className:"PhotoView-Slider__Backdrop"+(g?" "+g:"")+(rt===1?" PhotoView-Slider__fadeIn":rt===2?" PhotoView-Slider__fadeOut":""),style:{background:Tt?"rgba(0, 0, 0, "+Tt+")":void 0,transitionTimingFunction:Pt,transitionDuration:(V?0:kt)+"ms",animationDuration:kt+"ms"},onAnimationEnd:St}),p&&dt.createElement("div",{className:"PhotoView-Slider__BannerWrap"},dt.createElement("div",{className:"PhotoView-Slider__Counter"},Ee+1," / ",Ne),dt.createElement("div",{className:"PhotoView-Slider__BannerRight"},y&&Re&&y(Re),dt.createElement(Y7,{className:"PhotoView-Slider__toolbarIcon",onClick:B}))),tt.map(function(Xe,ft){var xt=He||Ee!==0?Ke.current-1+ft:Ee+ft;return dt.createElement(rH,{key:He?Xe.key+"/"+Xe.src+"/"+xt:Xe.key,item:Xe,speed:kt,easing:Pt,visible:O,onReachMove:Oe,onReachUp:Ye,onPhotoTap:function(){return oe(i)},onMaskTap:function(){return oe(o)},wrapClassName:b,className:x,style:{left:(innerWidth+ul)*xt+"px",transform:"translate3d("+I+"px, 0px, 0)",transition:V||W?void 0:"transform "+Bt+"ms "+bn},loadingElement:_,brokenElement:k,onPhotoResize:be,isActive:Ke.current===xt,expose:T})}),!Pi&&p&&dt.createElement(dt.Fragment,null,(He||Ee!==0)&&dt.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:function(){return Q(Ee-1,!0)}},dt.createElement(W7,null)),(He||Ee+1-1){var g=u.slice();return g.splice(E,1,y),void o({images:g})}o(function(x){return{images:x.images.concat(y)}})},remove:function(y){o(function(E){var g=E.images.filter(function(x){return x.key!==y});return{images:g,index:Math.min(g.length-1,f)}})},show:function(y){var E=u.findIndex(function(g){return g.key===y});o({visible:!0,index:E}),r&&r(!0,E,a)}}),p=So({close:function(){o({visible:!1}),r&&r(!1,f,a)},changeIndex:function(y){o({index:y}),n&&n(y,a)}}),m=w.useMemo(function(){return Pn({},a,h)},[a,h]);return dt.createElement(hL.Provider,{value:m},t,dt.createElement(sH,Pn({images:u,visible:d,index:f,onIndexChange:p.changeIndex,onClose:p.close},s)))}var mL=function(e){var t,n,r=e.src,s=e.render,i=e.overlay,a=e.width,o=e.height,c=e.triggers,u=c===void 0?["onClick"]:c,d=e.children,f=w.useContext(hL),h=(t=function(){return f.nextId()},(n=w.useRef({sign:!1,fn:void 0}).current).sign||(n.sign=!0,n.fn=t()),n.fn),p=w.useRef(null);w.useImperativeHandle(d==null?void 0:d.ref,function(){return p.current}),w.useEffect(function(){return function(){f.remove(h)}},[]);var m=So({render:function(E){return s&&s(E)},show:function(E,g){f.show(h),function(x,b){if(d){var _=d.props[x];_&&_(b)}}(E,g)}}),y=w.useMemo(function(){var E={};return u.forEach(function(g){E[g]=m.show.bind(null,g)}),E},[]);return w.useEffect(function(){f.update({key:h,src:r,originRef:p,render:m.render,overlay:i,width:a,height:o})},[r]),d?w.Children.only(w.cloneElement(d,Pn({},y,{ref:p}))):null};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const cH=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),yL=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/** + */const lH=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),gL=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */var uH={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"};/** + */var cH={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"};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const dH=w.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:a,...o},c)=>w.createElement("svg",{ref:c,...uH,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:yL("lucide",s),...o},[...a.map(([u,d])=>w.createElement(u,d)),...Array.isArray(i)?i:[i]]));/** + */const uH=w.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:a,...o},c)=>w.createElement("svg",{ref:c,...cH,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:gL("lucide",s),...o},[...a.map(([u,d])=>w.createElement(u,d)),...Array.isArray(i)?i:[i]]));/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ie=(e,t)=>{const n=w.forwardRef(({className:r,...s},i)=>w.createElement(dH,{ref:i,iconNode:t,className:yL(`lucide-${cH(e)}`,r),...s}));return n.displayName=`${e}`,n};/** + */const Ie=(e,t)=>{const n=w.forwardRef(({className:r,...s},i)=>w.createElement(uH,{ref:i,iconNode:t,className:gL(`lucide-${lH(e)}`,r),...s}));return n.displayName=`${e}`,n};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const fH=Ie("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"}]]);/** + */const dH=Ie("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const bL=Ie("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** + */const yL=Ie("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const EL=Ie("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/** + */const bL=Ie("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ad=Ie("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** + */const id=Ie("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const xL=Ie("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** + */const EL=Ie("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const wL=Ie("AtSign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]);/** + */const xL=Ie("AtSign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const hH=Ie("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"}]]);/** + */const fH=Ie("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Po=Ie("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"}]]);/** + */const Do=Ie("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const vL=Ie("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** + */const wL=Ie("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const pH=Ie("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"}]]);/** + */const hH=Ie("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const mH=Ie("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** + */const pH=Ie("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -131,12 +131,12 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Tw=Ie("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + */const Sw=Ie("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const gH=Ie("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** + */const mH=Ie("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -146,192 +146,192 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Cg=Ie("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** + */const Ag=Ie("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _L=Ie("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + */const vL=Ie("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const H1=Ie("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** + */const $1=Ie("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const yH=Ie("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/** + */const gH=Ie("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Aw=Ie("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/** + */const Tw=Ie("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Cw=Ie("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"}]]);/** + */const Aw=Ie("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const bH=Ie("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/** + */const yH=Ie("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const EH=Ie("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** + */const bH=Ie("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _p=Ie("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** + */const vp=Ie("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Iw=Ie("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"}]]);/** + */const Cw=Ie("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const xH=Ie("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"}]]);/** + */const EH=Ie("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ow=Ie("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** + */const Iw=Ie("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const wH=Ie("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"}]]);/** + */const xH=Ie("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const kL=Ie("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"}]]);/** + */const _L=Ie("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const vH=Ie("FileArchive",[["path",{d:"M10 12v-1",key:"v7bkov"}],["path",{d:"M10 18v-2",key:"1cjy8d"}],["path",{d:"M10 7V6",key:"dljcrl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01",key:"gkbcor"}],["circle",{cx:"10",cy:"20",r:"2",key:"1xzdoj"}]]);/** + */const wH=Ie("FileArchive",[["path",{d:"M10 12v-1",key:"v7bkov"}],["path",{d:"M10 18v-2",key:"1cjy8d"}],["path",{d:"M10 7V6",key:"dljcrl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01",key:"gkbcor"}],["circle",{cx:"10",cy:"20",r:"2",key:"1xzdoj"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const uS=Ie("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/** + */const cS=Ie("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _H=Ie("FileDown",[["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:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/** + */const vH=Ie("FileDown",[["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:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const kH=Ie("FilePlus",[["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:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/** + */const _H=Ie("FilePlus",[["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:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const NL=Ie("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"}]]);/** + */const kL=Ie("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const NH=Ie("FileType2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 13v-1h6v1",key:"1dh9dg"}],["path",{d:"M5 12v6",key:"150t9c"}],["path",{d:"M4 18h2",key:"1xrofg"}]]);/** + */const kH=Ie("FileType2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 13v-1h6v1",key:"1dh9dg"}],["path",{d:"M5 12v6",key:"150t9c"}],["path",{d:"M4 18h2",key:"1xrofg"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const SL=Ie("FileVideo2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"8",height:"6",x:"2",y:"12",rx:"1",key:"1a6c1e"}],["path",{d:"m10 15.5 4 2.5v-6l-4 2.5",key:"t7cp39"}]]);/** + */const NL=Ie("FileVideo2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"8",height:"6",x:"2",y:"12",rx:"1",key:"1a6c1e"}],["path",{d:"m10 15.5 4 2.5v-6l-4 2.5",key:"t7cp39"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const SH=Ie("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"}]]);/** + */const NH=Ie("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const TH=Ie("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/** + */const SH=Ie("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const AH=Ie("FolderTree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]);/** + */const TH=Ie("FolderTree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Rw=Ie("FolderUp",[["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:"M12 10v6",key:"1bos4e"}],["path",{d:"m9 13 3-3 3 3",key:"1pxg3c"}]]);/** + */const Ow=Ie("FolderUp",[["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:"M12 10v6",key:"1bos4e"}],["path",{d:"m9 13 3-3 3 3",key:"1pxg3c"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const TL=Ie("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"}]]);/** + */const SL=Ie("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const CH=Ie("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/** + */const AH=Ie("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const IH=Ie("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/** + */const CH=Ie("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ig=Ie("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"}]]);/** + */const Cg=Ie("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const OH=Ie("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"}]]);/** + */const IH=Ie("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const RH=Ie("Headset",[["path",{d:"M3 11h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-5Zm0 0a9 9 0 1 1 18 0m0 0v5a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3Z",key:"12oyoe"}],["path",{d:"M21 16v2a4 4 0 0 1-4 4h-5",key:"1x7m43"}]]);/** + */const OH=Ie("Headset",[["path",{d:"M3 11h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-5Zm0 0a9 9 0 1 1 18 0m0 0v5a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3Z",key:"12oyoe"}],["path",{d:"M21 16v2a4 4 0 0 1-4 4h-5",key:"1x7m43"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const AL=Ie("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"}]]);/** + */const TL=Ie("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ya=Ie("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** + */const Ka=Ie("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const LH=Ie("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);/** + */const RH=Ie("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const CL=Ie("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"}]]);/** + */const AL=Ie("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const MH=Ie("LayoutTemplate",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);/** + */const LH=Ie("LayoutTemplate",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const IL=Ie("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/** + */const CL=Ie("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const jH=Ie("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** + */const MH=Ie("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -341,62 +341,62 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const DH=Ie("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** + */const jH=Ie("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const PH=Ie("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** + */const DH=Ie("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const nc=Ie("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"}]]);/** + */const tc=Ie("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const OL=Ie("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"}]]);/** + */const IL=Ie("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const BH=Ie("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"}]]);/** + */const PH=Ie("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const FH=Ie("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]);/** + */const BH=Ie("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const UH=Ie("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** + */const FH=Ie("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const RL=Ie("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"}]]);/** + */const OL=Ie("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $H=Ie("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/** + */const UH=Ie("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const HH=Ie("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/** + */const $H=Ie("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const zH=Ie("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** + */const HH=Ie("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const VH=Ie("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** + */const zH=Ie("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -406,52 +406,52 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const z1=Ie("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"}]]);/** + */const H1=Ie("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Lw=Ie("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/** + */const Rw=Ie("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const KH=Ie("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);/** + */const VH=Ie("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const YH=Ie("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** + */const KH=Ie("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Kd=Ie("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + */const Vd=Ie("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const WH=Ie("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"}]]);/** + */const YH=Ie("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const GH=Ie("Shapes",[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]]);/** + */const WH=Ie("Shapes",[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const dS=Ie("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + */const uS=Ie("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Bo=Ie("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"}]]);/** + */const Po=Ie("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const qH=Ie("Split",[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M8 3H3v5",key:"15dfkv"}],["path",{d:"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3",key:"1qrqzj"}],["path",{d:"m15 9 6-6",key:"ko1vev"}]]);/** + */const GH=Ie("Split",[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M8 3H3v5",key:"15dfkv"}],["path",{d:"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3",key:"1qrqzj"}],["path",{d:"m15 9 6-6",key:"ko1vev"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -461,82 +461,82 @@ Error generating stack: `+i.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const XH=Ie("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"}]]);/** + */const qH=Ie("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const QH=Ie("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** + */const XH=Ie("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ZH=Ie("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"}]]);/** + */const QH=Ie("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const JH=Ie("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"}]]);/** + */const ZH=Ie("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ez=Ie("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/** + */const JH=Ie("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const LL=Ie("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"}]]);/** + */const RL=Ie("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"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const zr=Ie("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),fS="veadk_auth_qs";let bu=null;function tz(){if(bu!==null)return bu;const e=window.location.search.replace(/^\?/,"");return e?(sessionStorage.setItem(fS,e),window.history.replaceState(null,"",window.location.pathname+window.location.hash),bu=e):bu=sessionStorage.getItem(fS)??"",bu}function xi(e){const t=tz();if(!t)return e;const n=new URL(e,window.location.origin);return new URLSearchParams(t).forEach((r,s)=>{n.searchParams.has(s)||n.searchParams.set(s,r)}),/^https?:\/\//i.test(e)?n.toString():n.pathname+n.search+n.hash}const Yc=3e4,Mw=12e4,ML=1e4;function Gs(e,t=Yc){if(t<=0)return e??void 0;const n=AbortSignal.timeout(t);return e?AbortSignal.any([e,n]):n}const wm="veadk_local_user",vm="veadk_local_user_tab",nz=/^[A-Za-z0-9]{1,16}$/;function jL(){try{const e=sessionStorage.getItem(vm);if(e)return e;const t=localStorage.getItem(wm);return t&&sessionStorage.setItem(vm,t),t}catch{try{return localStorage.getItem(wm)}catch{return null}}}function hS(e){try{sessionStorage.setItem(vm,e)}catch{}try{localStorage.setItem(wm,e)}catch{}}function rz(){try{sessionStorage.removeItem(vm)}catch{}try{localStorage.removeItem(wm)}catch{}}function Og(e){const t=new Headers(e),n=jL();return n&&t.set("X-VeADK-Local-User",n),t}async function DL(){let e;try{e=await fetch("/web/auth-config",{headers:{Accept:"application/json"},signal:Gs(void 0,ML)})}catch(t){throw console.warn("[identity] /web/auth-config is unreachable:",t),new Error("无法加载登录配置,请检查网络后重试。")}if(!e.ok)throw new Error(`登录配置服务异常(HTTP ${e.status}),请稍后重试。`);try{const t=await e.json();if(!Array.isArray(t.providers))throw new TypeError("providers is not an array");return t.providers}catch(t){throw console.warn("[identity] /web/auth-config returned an invalid response:",t),new Error("登录配置服务返回了无法解析的响应,请稍后重试。")}}function sz(e){const t=window.location.pathname+window.location.search+window.location.hash,n=e.includes("?")?"&":"?";window.location.assign(`${e}${n}redirect=${encodeURIComponent(t)}`)}function iz(){const e=window.location.pathname+window.location.search+window.location.hash,t=window.open("about:blank","_blank","popup,width=520,height=720");if(!t)return null;try{t.opener=null,t.location.replace(`/oauth2/login?redirect=${encodeURIComponent(e)}`)}catch{return t.close(),null}return t}async function az(){const[e,t]=await Promise.all([V1(),DL()]);return e.status==="unauthenticated"&&t.length>0}function oz(){window.location.assign("/oauth2/logout")}async function V1(){let e;try{e=await fetch("/oauth2/userinfo",{headers:{Accept:"application/json"},signal:Gs(void 0,ML)})}catch(n){throw console.warn("[identity] /oauth2/userinfo is unreachable:",n),new Error("无法连接身份服务,请检查网络后重试。")}if(e.ok){let n;try{n=await e.json()}catch(s){throw console.warn("[identity] /oauth2/userinfo returned a non-JSON response:",s),new Error("身份服务返回了无法解析的响应,请稍后重试。")}return{status:"authenticated",userId:String(n.sub??n.user_id??n.email??""),info:n}}if(e.status===401)return{status:"unauthenticated",userId:"",local:!1};if(e.status!==404)throw new Error(`身份服务异常(HTTP ${e.status}),请稍后重试。`);const t=jL();return t?{status:"authenticated",userId:t,info:{name:t},local:!0}:{status:"unauthenticated",userId:"",local:!0}}function lz(e){return e?String(e.name??e.preferred_username??e.email??e.sub??""):""}function cz(e){const t=e==null?void 0:e.picture;return typeof t=="string"?t.trim():""}const K1="veadk:authentication-required";let od=null,Fu=null;function uz(e){if(!e.redirected||!e.url)return!1;try{const t=new URL(e.url);return t.pathname.includes("/authorize")||t.pathname.includes("/oauth2/login")||t.hostname.includes(".userpool.auth.")}catch{return!1}}function dz(e){od||(od=new Promise(n=>{Fu=n}),window.dispatchEvent(new Event(K1)));const t=od;return e?e.aborted?Promise.reject(e.reason??new Error("Request aborted")):new Promise((n,r)=>{const s=()=>r(e.reason??new Error("Request aborted"));e.addEventListener("abort",s,{once:!0}),t.then(()=>{e.removeEventListener("abort",s),n()},i=>{e.removeEventListener("abort",s),r(i)})}):t}function fz(){return od!==null}function hz(){Fu==null||Fu(),Fu=null,od=null}async function PL(e,t){var r;const n=await e.text().catch(()=>"");try{return JSON.parse(n)}catch{const s=((r=e.headers.get("content-type"))==null?void 0:r.split(";",1)[0])||"Content-Type 缺失",i=n.trim().slice(0,2e3),a=i?` -响应:${i}`:"";throw new Error(`${t}:服务端返回非 JSON 响应(HTTP ${e.status},${s})${a}`)}}const pz=/\brun_sse\s*failed\s*:\s*404\b/i,pS="提示:该 404 可能是多实例部署使用 in-memory 或 SQLite 短期记忆导致的:请求落到不同实例后,会话无法找到。请改用基于数据库的持久化短期记忆存储。";function Rh(e){const t=String(e);return!pz.test(t)||t.includes(pS)?t:`${t} + */const zr=Ie("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),dS="veadk_auth_qs";let yu=null;function ez(){if(yu!==null)return yu;const e=window.location.search.replace(/^\?/,"");return e?(sessionStorage.setItem(dS,e),window.history.replaceState(null,"",window.location.pathname+window.location.hash),yu=e):yu=sessionStorage.getItem(dS)??"",yu}function xi(e){const t=ez();if(!t)return e;const n=new URL(e,window.location.origin);return new URLSearchParams(t).forEach((r,s)=>{n.searchParams.has(s)||n.searchParams.set(s,r)}),/^https?:\/\//i.test(e)?n.toString():n.pathname+n.search+n.hash}const Kc=3e4,Lw=12e4,LL=1e4;function Gs(e,t=Kc){if(t<=0)return e??void 0;const n=AbortSignal.timeout(t);return e?AbortSignal.any([e,n]):n}const xm="veadk_local_user",wm="veadk_local_user_tab",tz=/^[A-Za-z0-9]{1,16}$/;function ML(){try{const e=sessionStorage.getItem(wm);if(e)return e;const t=localStorage.getItem(xm);return t&&sessionStorage.setItem(wm,t),t}catch{try{return localStorage.getItem(xm)}catch{return null}}}function fS(e){try{sessionStorage.setItem(wm,e)}catch{}try{localStorage.setItem(xm,e)}catch{}}function nz(){try{sessionStorage.removeItem(wm)}catch{}try{localStorage.removeItem(xm)}catch{}}function Ig(e){const t=new Headers(e),n=ML();return n&&t.set("X-VeADK-Local-User",n),t}async function jL(){let e;try{e=await fetch("/web/auth-config",{headers:{Accept:"application/json"},signal:Gs(void 0,LL)})}catch(t){throw console.warn("[identity] /web/auth-config is unreachable:",t),new Error("无法加载登录配置,请检查网络后重试。")}if(!e.ok)throw new Error(`登录配置服务异常(HTTP ${e.status}),请稍后重试。`);try{const t=await e.json();if(!Array.isArray(t.providers))throw new TypeError("providers is not an array");return t.providers}catch(t){throw console.warn("[identity] /web/auth-config returned an invalid response:",t),new Error("登录配置服务返回了无法解析的响应,请稍后重试。")}}function rz(e){const t=window.location.pathname+window.location.search+window.location.hash,n=e.includes("?")?"&":"?";window.location.assign(`${e}${n}redirect=${encodeURIComponent(t)}`)}function sz(){const e=window.location.pathname+window.location.search+window.location.hash,t=window.open("about:blank","_blank","popup,width=520,height=720");if(!t)return null;try{t.opener=null,t.location.replace(`/oauth2/login?redirect=${encodeURIComponent(e)}`)}catch{return t.close(),null}return t}async function iz(){const[e,t]=await Promise.all([z1(),jL()]);return e.status==="unauthenticated"&&t.length>0}function az(){window.location.assign("/oauth2/logout")}async function z1(){let e;try{e=await fetch("/oauth2/userinfo",{headers:{Accept:"application/json"},signal:Gs(void 0,LL)})}catch(n){throw console.warn("[identity] /oauth2/userinfo is unreachable:",n),new Error("无法连接身份服务,请检查网络后重试。")}if(e.ok){let n;try{n=await e.json()}catch(s){throw console.warn("[identity] /oauth2/userinfo returned a non-JSON response:",s),new Error("身份服务返回了无法解析的响应,请稍后重试。")}return{status:"authenticated",userId:String(n.sub??n.user_id??n.email??""),info:n}}if(e.status===401)return{status:"unauthenticated",userId:"",local:!1};if(e.status!==404)throw new Error(`身份服务异常(HTTP ${e.status}),请稍后重试。`);const t=ML();return t?{status:"authenticated",userId:t,info:{name:t},local:!0}:{status:"unauthenticated",userId:"",local:!0}}function oz(e){return e?String(e.name??e.preferred_username??e.email??e.sub??""):""}function lz(e){const t=e==null?void 0:e.picture;return typeof t=="string"?t.trim():""}const V1="veadk:authentication-required";let ad=null,Bu=null;function cz(e){if(!e.redirected||!e.url)return!1;try{const t=new URL(e.url);return t.pathname.includes("/authorize")||t.pathname.includes("/oauth2/login")||t.hostname.includes(".userpool.auth.")}catch{return!1}}function uz(e){ad||(ad=new Promise(n=>{Bu=n}),window.dispatchEvent(new Event(V1)));const t=ad;return e?e.aborted?Promise.reject(e.reason??new Error("Request aborted")):new Promise((n,r)=>{const s=()=>r(e.reason??new Error("Request aborted"));e.addEventListener("abort",s,{once:!0}),t.then(()=>{e.removeEventListener("abort",s),n()},i=>{e.removeEventListener("abort",s),r(i)})}):t}function dz(){return ad!==null}function fz(){Bu==null||Bu(),Bu=null,ad=null}async function DL(e,t){var r;const n=await e.text().catch(()=>"");try{return JSON.parse(n)}catch{const s=((r=e.headers.get("content-type"))==null?void 0:r.split(";",1)[0])||"Content-Type 缺失",i=n.trim().slice(0,2e3),a=i?` +响应:${i}`:"";throw new Error(`${t}:服务端返回非 JSON 响应(HTTP ${e.status},${s})${a}`)}}const hz=/\brun_sse\s*failed\s*:\s*404\b/i,hS="提示:该 404 可能是多实例部署使用 in-memory 或 SQLite 短期记忆导致的:请求落到不同实例后,会话无法找到。请改用基于数据库的持久化短期记忆存储。";function Oh(e){const t=String(e);return!hz.test(t)||t.includes(hS)?t:`${t} -${pS}`}async function*jw(e){if(!e.body)throw new Error("Response has no body");const t=e.body.getReader(),n=new TextDecoder;let r="";try{for(;;){const{done:s,value:i}=await t.read();if(s)break;r+=n.decode(i,{stream:!0});let a=r.match(/\r?\n\r?\n/);for(;(a==null?void 0:a.index)!==void 0;){const o=r.slice(0,a.index);r=r.slice(a.index+a[0].length);const c=o.split(/\r?\n/).filter(u=>u.startsWith("data:")).map(u=>u.slice(5).trimStart()).join(` -`);if(c)try{yield JSON.parse(c)}catch{c!=="[DONE]"&&c!=="ping"&&console.debug(`parseSSE: dropping unparseable frame (${c.length} chars):`,c.slice(0,200))}a=r.match(/\r?\n\r?\n/)}}}finally{try{await t.cancel()}catch{}finally{t.releaseLock()}}}const BL="veadk.messageFeedback.v1";function FL(e,t,n,r){return[e,t,n,r].join(":")}function UL(){if(typeof window>"u")return{};try{const e=JSON.parse(localStorage.getItem(BL)??"{}");return e&&typeof e=="object"?e:{}}catch{return{}}}function mz(e,t,n){if(typeof window>"u")return;const r=UL();r[e]={...r[e]??{},[`veadk_feedback:${t}`]:n},localStorage.setItem(BL,JSON.stringify(r))}const kp="",Dw=new Map;function $L(e,t){Dw.set(e,t)}function HL(){Dw.clear()}function Fn(e){const t=Dw.get(e);return t?{app:t.app,ep:{base:t.base,apiKey:t.apiKey,runtimeId:t.runtimeId,region:t.region}}:{app:e,ep:{}}}async function pt(e,t={},n={},r=Yc){const s={...t,headers:Og(t.headers)},i=()=>{const c={...s,signal:Gs(t.signal,r)};if(n.runtimeId){const u=n.region?`${e.includes("?")?"&":"?"}region=${encodeURIComponent(n.region)}`:"";return fetch(xi(`${kp}/web/runtime-proxy/${n.runtimeId}${e}${u}`),c)}if(n.base){const u=new Headers(c.headers);return u.set("X-AgentKit-Base",n.base),n.apiKey&&u.set("X-AgentKit-Key",n.apiKey),fetch(xi(`${kp}/agentkit-proxy${e}`),{...c,headers:u})}return fetch(xi(`${kp}${e}`),c)},a=async c=>{if(uz(c))return!0;if(c.status!==401)return!1;try{return await az()}catch{return!1}};let o=await i();for(;await a(o);)await dz(t.signal),o=await i();return o}function gz(e){return typeof e=="string"?e:Array.isArray(e)?e.map(t=>{var n;if(t&&typeof t=="object"&&"msg"in t){const r=Array.isArray(t.loc)?(n=t.loc)==null?void 0:n.join("."):"",s=String(t.msg??"");return r?`${r}: ${s}`:s}return String(t)}).filter(Boolean).join(` -`):e&&typeof e=="object"?JSON.stringify(e):""}async function Sn(e,t){const n=await e.text().catch(()=>"");if(!n)return`${t} (${e.status})`;try{const r=JSON.parse(n);return gz(r.detail??r.error)||n||`${t} (${e.status})`}catch{return n||`${t} (${e.status})`}}async function zL(){const e=await pt("/list-apps");if(!e.ok)throw new Error(`list-apps failed: ${e.status}`);return e.json()}class Nf extends Error{constructor(){super("当前账号无权访问该 Runtime,请刷新列表或重新登录后重试。"),this.name="RuntimeAccessDeniedError"}}class Yd extends Error{constructor(t,n=!1){super(t),this.unsupported=n,this.name="RuntimeProbeError"}}async function yz(e){try{const t=await e.clone().json();return typeof t.detail=="string"?t.detail:""}catch{return""}}async function Rg(e,t,n){const r=await pt("/list-apps",{},n??{base:e,apiKey:t}),s=n!=null&&n.runtimeId?await yz(r):"";if(n!=null&&n.runtimeId&&s==="runtime_access_denied")throw new Nf;if(n!=null&&n.runtimeId&&r.status===404)throw new Yd("该 Runtime 的 Agent Server 未提供连接接口,请确认 Runtime 已就绪且版本兼容。",!0);if(n!=null&&n.runtimeId&&(r.status===401||r.status===403))throw new Yd("Runtime 服务拒绝了连接请求,请检查 Runtime 的鉴权配置。");if(!r.ok)throw new Error(await Sn(r,"读取 Agent 列表失败"));return r.json()}async function _m(e,t){const{app:n,ep:r}=Fn(e),s=await pt(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"},r);if(!s.ok){const a=`创建会话失败 (${s.status})`,o=await Sn(s,"创建会话失败");throw new Error(o===a?a:`${a}:${o}`)}return(await s.json()).id}async function Pw(e,t){const{app:n,ep:r}=Fn(e),s=await pt(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{},r);if(!s.ok)throw new Error(`list sessions failed: ${s.status}`);return s.json()}async function km(e,t,n){const{app:r,ep:s}=Fn(e),i=await pt(`/apps/${r}/users/${encodeURIComponent(t)}/sessions/${n}`,{},s);if(!i.ok)throw new Error(`get session failed: ${i.status}`);const a=await i.json();if(s.runtimeId){const o=FL(s.runtimeId,r,t,n);a.state={...UL()[o]??{},...a.state??{}}}return a}async function VL(e){const{app:t,ep:n}=Fn(e.appName);if(!n.runtimeId)throw new Error("只有连接到 AgentKit Runtime 的会话支持反馈回流");const r=await pt("/web/evaluation/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:n.runtimeId,region:n.region??"cn-beijing",appName:t,userId:e.userId,sessionId:e.sessionId,eventId:e.eventId,rating:e.rating,comment:e.comment??""})},{},Mw);if(!r.ok)throw new Error(await Sn(r,"提交反馈失败"));const s=await r.json(),i=FL(n.runtimeId,t,e.userId,e.sessionId);return mz(i,e.eventId,s),s}async function Y1(e,t,n){const{app:r,ep:s}=Fn(e),i=await pt(`/apps/${r}/users/${encodeURIComponent(t)}/sessions/${n}`,{method:"DELETE"},s);if(!i.ok&&i.status!==404)throw new Error(`delete session failed: ${i.status}`)}async function bz(e){const t=await pt("/web/media/capabilities");if(!t.ok)throw new Error(await Sn(t,"media capabilities failed"));return t.json()}async function KL(e,t,n,r){const{app:s}=Fn(e),i=new FormData;i.set("app_name",s),i.set("user_id",t),i.set("session_id",n),i.set("file",r);const a=await pt("/web/media",{method:"POST",body:i},{},Mw);if(!a.ok)throw new Error(await Sn(a,"文件上传失败"));return{...await a.json(),status:"ready"}}async function W1(e,t,n){const{app:r}=Fn(e),s=`/web/media/${encodeURIComponent(r)}/${encodeURIComponent(t)}/${encodeURIComponent(n)}`,i=await pt(s,{method:"DELETE"});if(!i.ok&&i.status!==404)throw new Error(await Sn(i,"media cleanup failed"))}function YL(e){try{const t=new URL(e);if(t.protocol!=="veadk-media:"||t.hostname!=="apps")return;const n=t.pathname.split("/").filter(Boolean).map(decodeURIComponent);return n.length!==7||n[1]!=="users"||n[3]!=="sessions"||n[5]!=="media"?void 0:`/web/media/${n.map(encodeURIComponent).filter((r,s)=>![1,3,5].includes(s)).join("/")}`}catch{return}}async function Np(e,t){const n=YL(t);if(!n)throw new Error("Invalid VeADK media URI");const r=await pt(n,{method:"DELETE"});if(!r.ok&&r.status!==404)throw new Error(await Sn(r,"media cleanup failed"))}function WL(e,t){if(t.startsWith("data:")||t.startsWith("blob:")||/^https?:/.test(t))return t;const n=YL(t);if(!n)return t;const r=`${n}/content`;return xi(`${kp}${r}`)}async function GL(e,t){const{app:n,ep:r}=Fn(e),s=await pt(`/dev/apps/${encodeURIComponent(n)}/debug/trace/session/${encodeURIComponent(t)}`,{},r);if(!s.ok)throw new Error(`trace failed: ${s.status}`);const i=s.headers.get("content-type")??"";if(!i.includes("application/json")){const o=i.split(";",1)[0]||"Content-Type 缺失";throw new Error(`trace failed: 服务端返回了非 JSON 响应(${o}),请检查 Studio API 代理配置`)}const a=await s.json();if(!Array.isArray(a))throw new Error("trace failed: 返回格式无效");return a}function Bw(e){const t=n=>({id:String(n.id??""),kind:n.kind==="skill"?"skill":"tool",name:String(n.name??""),custom:n.custom===!0,description:typeof n.description=="string"?n.description:void 0,skillSourceId:typeof n.skill_source_id=="string"?n.skill_source_id:void 0,version:typeof n.version=="string"?n.version:void 0});return{schemaVersion:Number(e.schema_version??1),revision:Number(e.revision??0),tools:Array.isArray(e.tools)?e.tools.map(n=>t(n)):[],skills:Array.isArray(e.skills)?e.skills.map(n=>t(n)):[]}}function Fw(e,t,n){return`/harness/apps/${encodeURIComponent(e)}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}/capabilities`}async function qL(e,t,n){const{app:r,ep:s}=Fn(e),i=await pt(Fw(r,t,n),{},s);if(!i.ok)throw new Error(await Sn(i,"读取会话能力失败"));return Bw(await i.json())}async function XL(e){const{ep:t}=Fn(e),n=await pt("/harness/capabilities/tools",{},t);if(!n.ok)throw new Error(await Sn(n,"读取内置工具失败"));return((await n.json()).tools??[]).map(s=>{var i;return((i=s.name)==null?void 0:i.trim())??""}).filter(Boolean)}async function Ez(e){const{ep:t}=Fn(e),n=await pt("/harness/skills/spaces?region=all",{},t);if(!n.ok)throw new Error(await Sn(n,"读取 Skill Space 失败"));return(await n.json()).items??[]}async function xz(e,t,n){const{ep:r}=Fn(e),s=new URLSearchParams({region:n||"cn-beijing"}),i=`/harness/skills/spaces/${encodeURIComponent(t)}/skills?${s.toString()}`,a=await pt(i,{},r);if(!a.ok)throw new Error(await Sn(a,"读取 Skill 列表失败"));return(await a.json()).items??[]}async function QL(e,t,n=1,r=20){const{ep:s}=Fn(e),i=new URLSearchParams({query:t,page_number:String(n),page_size:String(r)}),a=await pt(`/harness/skills/findskill?${i.toString()}`,{},s);if(!a.ok)throw new Error(await Sn(a,"搜索 Skill Hub 失败"));const o=await a.json();return{items:o.items??[],totalCount:Number(o.totalCount??0)}}async function ZL(e,t,n,r,s){const{app:i,ep:a}=Fn(e),o=await pt(Fw(i,t,n),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:r.kind,name:r.name,skill_source_id:r.skillSourceId,description:r.description,version:r.version,expected_revision:s})},a);if(!o.ok)throw new Error(await Sn(o,"添加会话能力失败"));return Bw(await o.json())}async function JL(e,t,n,r,s){const{app:i,ep:a}=Fn(e),o=`${Fw(i,t,n)}/${encodeURIComponent(r)}?expected_revision=${s}`,c=await pt(o,{method:"DELETE"},a);if(!c.ok)throw new Error(await Sn(c,"移除会话能力失败"));return Bw(await c.json())}async function eM(e,t){const n=await pt(`/web/agent-info/${e}`,{},t);if(!n.ok)throw new Error(`agent-info failed: ${n.status}`);const r=await n.json();if(!r.draft)try{const s=await pt(`/web/agent-draft/${e}`,{},t);if(s.ok){const i=await s.json();r.draft=i.draft}}catch{}return{name:r.name??e,description:r.description??"",type:r.type,model:r.model??"",tools:r.tools??[],skillsPreviewSupported:Array.isArray(r.skills),skills:r.skills??[],subAgents:r.subAgents??[],components:r.components??[],searchSources:r.searchSources??[],graph:r.graph,draft:r.draft}}async function Uw(e){const{app:t,ep:n}=Fn(e);return eM(t,n)}async function tM(e,t){const n={runtimeId:e,region:t},s=(await Rg("","",n))[0];if(!s)throw new Error("该 Runtime 未提供可预览的 Agent。");return eM(s,n)}async function nM(e,t,n,r){const{app:s,ep:i}=Fn(e),a=new URLSearchParams({source:t,app_name:s,q:n,user_id:r}),o=await pt(`/web/search?${a.toString()}`,{},i);if(!o.ok)throw new Error(await Sn(o,"Agent 检索失败"));return o.json()}async function rM(e,t){const{app:n}=Fn(e),r=await pt(`/web/search?source=web&app_name=${encodeURIComponent(n)}&q=${encodeURIComponent(t)}`);if(!r.ok)throw new Error(`web search failed: ${r.status}`);return r.json()}async function*Wd({appName:e,userId:t,sessionId:n,text:r,attachments:s=[],invocation:i,functionResponses:a=[],signal:o,sessionCapabilities:c=!1}){const{app:u,ep:d}=Fn(e),f=s.flatMap(y=>y.status&&y.status!=="ready"?[]:y.uri?[{fileData:{mimeType:y.mimeType,fileUri:y.uri,displayName:y.name},partMetadata:{veadkMedia:{id:y.id,uri:y.uri,name:y.name,mimeType:y.mimeType,sizeBytes:y.sizeBytes}}}]:y.data?[{inlineData:{mimeType:y.mimeType,data:y.data,displayName:y.name}}]:[]),h=i&&(i.skills.length>0||i.targetAgent)?i:void 0,p=[...f,...a.map(y=>({functionResponse:{id:y.id,name:y.name,response:y.response}})),...r.trim()?[{text:r}]:[]];if(h&&p.length>0){const y=p[0],E=y.partMetadata;p[0]={...y,partMetadata:{...E,veadkInvocation:h}}}const m=await pt(c?"/harness/run_sse":"/run_sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({app_name:u,user_id:t,session_id:n,new_message:{role:"user",parts:p},streaming:!0,custom_metadata:h?{veadkInvocation:h}:void 0}),signal:o},d,0);if(!m.ok)throw new Error(Rh(`run_sse failed: ${m.status}`));for await(const y of jw(m)){const E=y;typeof E.error=="string"&&(E.error=Rh(E.error)),typeof E.errorMessage=="string"&&(E.errorMessage=Rh(E.errorMessage)),typeof E.error_message=="string"&&(E.error_message=Rh(E.error_message)),yield E}}const ld=new Map;async function Lg(e,t,n,r){var u,d,f;const s=r==null?void 0:r.taskId,i=s?new AbortController:void 0;s&&i&&ld.set(s,i);const a=()=>{s&&ld.get(s)===i&&ld.delete(s)};let o;try{(u=r==null?void 0:r.onStage)==null||u.call(r,{level:"info",phase:"upload",message:"正在上传代码包",pct:0}),o=await pt("/web/deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},signal:i==null?void 0:i.signal,body:JSON.stringify({name:e,files:t,config:n,taskId:s,runtimeId:r==null?void 0:r.runtimeId,description:r==null?void 0:r.description,im:r==null?void 0:r.im,envs:r==null?void 0:r.envs})},{},0),(d=r==null?void 0:r.onStage)==null||d.call(r,{level:"success",phase:"upload",message:"代码包上传完成",pct:100})}catch(h){throw a(),h}if(!o.ok){const h=await o.text().catch(()=>"");throw a(),new Error(h||`部署失败 (${o.status})`)}let c=null;try{for await(const h of jw(o)){const p=h;if(p&&p.done){c=p;break}p&&p.message&&((f=r==null?void 0:r.onStage)==null||f.call(r,p))}}catch(h){throw a(),h}if(a(),!c)throw new Error("部署失败:连接中断");if(!c.success)throw new Error(c.error||"部署失败");if(!c.agentName)throw new Error("部署失败:返回缺少 Agent 名称");if(!c.runtimeId&&!c.url)throw new Error("部署失败:返回缺少 AgentKit 连接信息");return{apikey:c.apikey??"",url:c.url??"",agentName:c.agentName,runtimeId:c.runtimeId,consoleUrl:c.consoleUrl,region:c.region,version:c.version,feishuChannel:c.feishuChannel}}async function sM(e){var n;const t=await pt("/web/cancel-deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({taskId:e})});if(!t.ok){const r=await t.text().catch(()=>"");throw new Error(r||`取消部署失败 (${t.status})`)}(n=ld.get(e))==null||n.abort(),ld.delete(e)}async function wz(e="cn-beijing"){const t=await pt(`/web/my-runtimes?region=${encodeURIComponent(e)}`);if(!t.ok)throw new Error(`加载失败 (${t.status})`);return(await t.json()).runtimes??[]}const Gd={title:"VeADK Studio",logoUrl:""},Ey={studio:!1,version:"",branding:Gd,features:{newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,addAgentkit:!0,generatedAgentTestRun:!0},defaultView:"chat",agentsSource:"local"};async function iM(){var e,t;try{const n=await pt("/web/ui-config");if(!n.ok)return Ey;const r=await n.json(),s=typeof((e=r.branding)==null?void 0:e.logoUrl)=="string"?r.branding.logoUrl:Gd.logoUrl;return{studio:r.studio??!1,version:typeof r.version=="string"?r.version:"",branding:{title:typeof((t=r.branding)==null?void 0:t.title)=="string"?r.branding.title:Gd.title,logoUrl:s?xi(s):""},features:{...Ey.features,...r.features??{}},defaultView:r.defaultView??"chat",agentsSource:r.agentsSource==="cloud"?"cloud":"local"}}catch{return Ey}}const aM={role:"user",capabilities:{createAgents:!1,manageAgents:!1,runtimeScope:"mine"}};async function oM(){var n,r,s;const e=await pt("/web/access");if(!e.ok)throw new Error(`加载权限失败 (${e.status})`);const t=await e.json();if(!["admin","developer","user"].includes(t.role)||typeof((n=t.capabilities)==null?void 0:n.createAgents)!="boolean"||typeof((r=t.capabilities)==null?void 0:r.manageAgents)!="boolean"||!["all","mine"].includes((s=t.capabilities)==null?void 0:s.runtimeScope))throw new Error("权限服务返回了无法解析的响应");return t}async function lM(e,t){const n=new URLSearchParams;e&&n.set("targetVersion",e),t&&n.set("startedAt",String(t));const r=n.size?`?${n.toString()}`:"",s=await pt(`/web/studio-update${r}`);if(!s.ok)throw new Error(`检查 Studio 更新失败 (${s.status})`);return await s.json()}async function cM(e){const t=await pt("/web/studio-update",{method:"POST",headers:{"Content-Type":"application/json","X-VeADK-Studio-Update":"1"},body:JSON.stringify({version:e})},{},Mw);if(!t.ok){let n="";try{const r=await t.json();n=typeof r.detail=="string"?r.detail:""}catch{n=""}throw new Error(n||`提交 Studio 更新失败 (${t.status})`)}return await t.json()}async function cd(e={}){const t=new URLSearchParams({scope:e.scope??"all",page_size:String(e.pageSize??30),region:e.region??"all"});e.nextToken&&t.set("next_token",e.nextToken);const n=await pt(`/web/runtimes?${t.toString()}`);if(!n.ok)throw new Error(`加载 Runtime 失败 (${n.status})`);const r=await n.json();return{runtimes:r.runtimes??[],nextToken:r.nextToken??""}}async function uM(e,t="cn-beijing"){try{return await Rg("","",{runtimeId:e,region:t})}catch(n){if(n instanceof Nf||n instanceof Yd)throw n;return null}}async function dM(e,t="cn-beijing"){const n=await pt("/web/delete-runtime",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e,region:t})});if(!n.ok){const r=await n.text().catch(()=>"");throw new Error(r||`删除失败 (${n.status})`)}}async function $w(e,t="cn-beijing"){const n=await pt(`/web/runtime-detail?runtimeId=${encodeURIComponent(e)}®ion=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(await Sn(n,"加载 Runtime 详情失败"));return n.json()}async function Hw(e){const t=await pt("/web/generated-agent-projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e})});if(!t.ok)throw new Error(await Sn(t,"生成项目失败"));return t.json()}async function fM(e){const t=await pt("/web/generated-agent-test-runs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e})});if(!t.ok)throw new Error(await Sn(t,"创建调试运行失败"));return PL(t,"创建调试运行失败")}async function hM(e,t){const n=await pt(`/web/generated-agent-test-runs/${e}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:t})});if(!n.ok)throw new Error(await Sn(n,"创建调试会话失败"));return(await PL(n,"创建调试会话失败")).id}async function*pM({runId:e,userId:t,sessionId:n,text:r,signal:s}){const i=r.trim()?[{text:r}]:[],a=await pt(`/web/generated-agent-test-runs/${e}/run_sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({user_id:t,session_id:n,new_message:{role:"user",parts:i},streaming:!0}),signal:s},{},0);if(!a.ok)throw new Error(await Sn(a,"调试运行失败"));for await(const o of jw(a))yield o}async function Uu(e){const t=await pt(`/web/generated-agent-test-runs/${e}`,{method:"DELETE"});if(!t.ok&&t.status!==404)throw new Error(await Sn(t,"清理调试运行失败"))}const vz=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_SITE_BRANDING:Gd,DEFAULT_STUDIO_ACCESS:aM,RuntimeAccessDeniedError:Nf,RuntimeProbeError:Yd,addSessionCapability:ZL,cancelAgentkitDeployment:sM,clearRemoteApps:HL,componentSearch:nM,createGeneratedAgentTestRun:fM,createGeneratedAgentTestSession:hM,createSession:_m,deleteGeneratedAgentTestRun:Uu,deleteMedia:Np,deleteRuntime:dM,deleteSession:Y1,deleteSessionMedia:W1,deployAgentkitProject:Lg,fetchRemoteApps:Rg,generateAgentProject:Hw,getAgentInfo:Uw,getMediaCapabilities:bz,getMyRuntimes:wz,getRuntimeAgentInfo:tM,getRuntimeDetail:$w,getRuntimes:cd,getSession:km,getSessionCapabilities:qL,getSessionTrace:GL,getStudioAccess:oM,getStudioUpdateStatus:lM,getUiConfig:iM,listApps:zL,listSessionBuiltinTools:XL,listSessionSkillSpaces:Ez,listSessionSkillsInSpace:xz,listSessions:Pw,mediaContentUrl:WL,probeRuntimeApps:uM,registerRemoteApp:$L,removeSessionCapability:JL,runGeneratedAgentTestSSE:pM,runSSE:Wd,searchSessionPublicSkills:QL,startStudioUpdate:cM,submitMessageFeedback:VL,uploadMedia:KL,webSearch:rM},Symbol.toStringTag,{value:"Module"})),_z="send_a2ui_json_to_client",kz="validated_a2ui_json",G1="adk_request_credential",mS="transfer_to_agent";function Nz(e){var r,s,i,a;const t=e,n=((r=t==null?void 0:t.exchangedAuthCredential)==null?void 0:r.oauth2)??((s=t==null?void 0:t.exchanged_auth_credential)==null?void 0:s.oauth2)??((i=t==null?void 0:t.rawAuthCredential)==null?void 0:i.oauth2)??((a=t==null?void 0:t.raw_auth_credential)==null?void 0:a.oauth2);return(n==null?void 0:n.authUri)??(n==null?void 0:n.auth_uri)}function zs(){return{blocks:[],liveStart:0}}const gS=e=>e.functionCall??e.function_call,q1=e=>e.functionResponse??e.function_response;function Sz(e){if(!e||typeof e!="object")return"";const t=e,n=t.agentName??t.agent_name;return typeof n=="string"?n:""}function Tz(e){return e.replace(/-/g,"+").replace(/_/g,"/")}function mM(e){const t=[];for(const[n,r]of e.entries()){const s=r.partMetadata??r.part_metadata,i=s==null?void 0:s.veadkTransport;if((i==null?void 0:i.hidden)===!0)continue;const a=s==null?void 0:s.veadkMedia;if(typeof(a==null?void 0:a.uri)=="string"){t.push({id:String(a.id??a.uri),mimeType:typeof a.mimeType=="string"?a.mimeType:void 0,uri:a.uri,name:typeof a.name=="string"?a.name:void 0,sizeBytes:typeof a.sizeBytes=="number"?a.sizeBytes:void 0});continue}const o=r.inlineData??r.inline_data;if(o&&o.data){t.push({id:`inline-${n}-${o.displayName??o.display_name??"media"}`,mimeType:o.mimeType??o.mime_type,data:Tz(o.data),name:o.displayName??o.display_name});continue}const c=r.fileData??r.file_data,u=(c==null?void 0:c.fileUri)??(c==null?void 0:c.file_uri);c&&u&&t.push({id:u,mimeType:c.mimeType??c.mime_type,uri:u,name:c.displayName??c.display_name})}return t}function X1(e){const t=e.partMetadata??e.part_metadata,n=t==null?void 0:t.veadkTransport;return(n==null?void 0:n.hideText)===!0?void 0:e.text}const Az=new Set(["llm","sequential","parallel","loop","a2a"]);function Cz(e){var t;for(const n of e){const r=(t=n.partMetadata??n.part_metadata)==null?void 0:t.veadkInvocation;if(!r||typeof r!="object")continue;const s=r,i=Array.isArray(s.skills)?s.skills.flatMap(c=>{if(!c||typeof c!="object")return[];const u=c;return typeof u.name=="string"?[{name:u.name,description:typeof u.description=="string"?u.description:""}]:[]}):[];let a;const o=s.targetAgent;if(o&&typeof o=="object"){const c=o,u=c.type;typeof c.name=="string"&&typeof u=="string"&&Az.has(u)&&Array.isArray(c.path)&&(a={name:c.name,description:typeof c.description=="string"?c.description:"",type:u,path:c.path.filter(d=>typeof d=="string")})}if(i.length>0||a)return{skills:i,targetAgent:a}}}function Iz(e,t){if(!t.length)return;const n=e[e.length-1];(n==null?void 0:n.kind)==="attachment"?n.files.push(...t):e.push({kind:"attachment",files:t})}function yS(e,t,n){const r=e[e.length-1];r&&r.kind===t?r.text+=n:e.push(t==="thinking"?{kind:t,text:n,done:!1}:{kind:t,text:n})}function Lh(e){for(const t of e)t.kind==="thinking"&&(t.done=!0)}function xc(e,t){var a,o,c,u;const n=e.blocks.map(d=>({...d}));let r=e.liveStart;const s=((a=t.content)==null?void 0:a.parts)??[],i=s.some(d=>gS(d)||q1(d));if(t.partial&&!i){for(const d of s){const f=X1(d);typeof f=="string"&&f&&yS(n,d.thought?"thinking":"text",f)}return{blocks:n,liveStart:r}}n.length=r;for(const d of s){const f=gS(d),h=q1(d),p=mM([d]),m=X1(d);if(typeof m=="string"&&m)yS(n,d.thought?"thinking":"text",m);else if(p.length)Lh(n),Iz(n,p);else if(f)if(Lh(n),f.name===mS){const y=Sz(f.args)||((o=t.actions)==null?void 0:o.transferToAgent)||((c=t.actions)==null?void 0:c.transfer_to_agent)||"未知 Agent";n.push({kind:"agent-transfer",agentName:y,done:!1})}else if(f.name===G1){const y=f.args??{},E=y.authConfig??y.auth_config??y,x=String(y.functionCallId??y.function_call_id??"").replace(/^_adk_toolset_auth_/,"")||void 0;n.push({kind:"auth",callId:f.id??"",label:x,authUri:Nz(E),authConfig:E,done:!1})}else n.push({kind:"tool",name:f.name??"",args:f.args,done:!1});else if(h){if(Lh(n),h.name===mS)for(let y=n.length-1;y>=0;y--){const E=n[y];if(E.kind==="agent-transfer"&&!E.done){E.done=!0;break}}if(h.name===G1)for(let y=n.length-1;y>=0;y--){const E=n[y];if(E.kind==="auth"&&!E.done){E.done=!0;break}}for(let y=n.length-1;y>=0;y--){const E=n[y];if(E.kind==="tool"&&!E.done&&E.name===h.name){E.done=!0,E.response=h.response;break}}if(h.name===_z){const y=((u=h.response)==null?void 0:u[kz])??[];if(y.length){const E=n[n.length-1];E&&E.kind==="a2ui"?E.messages.push(...y):n.push({kind:"a2ui",messages:y})}}}}return Lh(n),r=n.length,{blocks:n,liveStart:r}}function Oz(e,t={}){var s,i;const n=[];let r=zs();for(const a of e)if(a.author==="user"){const c=((s=a.content)==null?void 0:s.parts)??[];if(c.some(p=>{var m;return((m=q1(p))==null?void 0:m.name)===G1})){for(let p=n.length-1;p>=0;p--)if(n[p].role==="assistant"){for(let m=n[p].blocks.length-1;m>=0;m--){const y=n[p].blocks[m];if(y.kind==="auth"){y.done=!0;break}}break}}const u=c.map(X1).filter(p=>!!p).join(""),d=mM(c),f=Cz(c);if(!u&&!d.length&&!f){r=zs();continue}const h=[];f&&h.push({kind:"invocation",value:f}),d.length&&h.push({kind:"attachment",files:d}),u&&h.push({kind:"text",text:u}),n.push({role:"user",blocks:h,meta:{ts:a.timestamp}}),r=zs()}else{const c=a.author??"";let u=n[n.length-1];(!u||u.role!=="assistant"||c&&((i=u.meta)==null?void 0:i.author)!==c)&&(u={role:"assistant",blocks:[],meta:{author:c||void 0}},n.push(u),r=zs()),r=xc(r,a),u.blocks=r.blocks;const d=a.usageMetadata??a.usage_metadata,f=u.meta??(u.meta={});c&&(f.author=c),d!=null&&d.totalTokenCount&&(f.tokens=d.totalTokenCount),a.timestamp&&(f.ts=a.timestamp),a.id&&(f.eventId=a.id);const h=a.invocationId??a.invocation_id;h&&(f.invocationId=h)}for(const a of n){const o=a.meta,c=o==null?void 0:o.eventId;if(!c)continue;const u=t[`veadk_feedback:${c}`];if(!u||typeof u!="object")continue;const d=u;d.rating!=="good"&&d.rating!=="bad"||(o.feedback=u)}return n}function Rz(e){var t,n;for(const r of e??[])if(r.author==="user"||((t=r.content)==null?void 0:t.role)==="user"){const s=(((n=r.content)==null?void 0:n.parts)??[]).map(i=>i.text).find(Boolean);if(s)return s}return"新会话"}const Lz=50,bS=48;function Mz(e){return(e.events??[]).flatMap(t=>{var s,i;const r=(((s=t.content)==null?void 0:s.parts)??[]).map(a=>typeof a.text=="string"?a.text:"").filter(Boolean).join("");return r?[{text:r,role:t.author??((i=t.content)==null?void 0:i.role)??"",ts:t.timestamp}]:[]})}function jz(e){var t,n;for(const r of e.events??[])if(r.author==="user"||((t=r.content)==null?void 0:t.role)==="user"){const s=(((n=r.content)==null?void 0:n.parts)??[]).map(i=>i.text).find(Boolean);if(s)return s}return"未命名会话"}function Dz(e,t,n){const r=Math.max(0,t-bS),s=Math.min(e.length,t+n+bS);return(r>0?"…":"")+e.slice(r,s).trim()+(s{var c;if((c=o.events)!=null&&c.length)return o;try{return await km(t,e,o.id)}catch{return o}})),a=[];for(const o of i)for(const{text:c,role:u,ts:d}of Mz(o)){const f=c.toLowerCase().indexOf(r);if(f!==-1){a.push({type:"session",appId:t,sessionId:o.id,title:jz(o),snippet:Dz(c,f,r.length),role:u,ts:d??o.lastUpdateTime});break}}return a.sort((o,c)=>(c.ts??0)-(o.ts??0)),a.slice(0,Lz)}async function Bz(e,t){if(!e||!t.trim())return{results:[]};let n;try{n=await rM(e,t.trim())}catch(a){const o=String(a);return{results:[],note:o.includes("404")?"网络搜索接口未就绪(后端未启用 /web/search)。":`网络搜索失败:${o}`}}const{mounted:r,results:s,error:i}=n;return r?i?{results:[],note:i}:{results:s.map((a,o)=>({type:"web",index:o,title:a.title,url:a.url,siteName:a.siteName,summary:a.summary}))}:{results:[],note:"当前 Agent 未挂载 web_search 工具。"}}async function Fz(e,t,n,r){if(!t||!r.trim())return{results:[]};const s=await nM(t,e,r.trim(),n);if(!s.mounted)return{results:[],note:e==="knowledge"?"该 Agent 未挂载知识库。":"该 Agent 未挂载长期记忆。"};if(s.error)return{results:[],note:s.error};const i=s.sourceName??(e==="knowledge"?"知识库":"长期记忆");return{results:s.results.map((a,o)=>e==="knowledge"?{type:"knowledge",index:o,content:a.content,sourceName:i,sourceType:s.sourceType}:{type:"memory",index:o,content:a.content,sourceName:i,sourceType:s.sourceType,author:a.author,ts:a.timestamp})}}async function Uz(e,t,n){return e==="session"?{results:await Pz(n.userId,n.appId,t)}:e==="web"?Bz(n.appId,t):Fz(e,n.appId,n.userId,t)}function gM({className:e="icon"}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M16.4 10.7a5.7 5.7 0 1 1-1.67-4.03"}),l.jsx("path",{d:"M15.25 15.25 19.6 19.6"})]})}function $z({open:e}){return l.jsx("svg",{className:`search-source-chevron ${e?"open":""}`,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:"m3.25 4.75 2.75 2.5 2.75-2.5"})})}function Hz({onClick:e}){return l.jsxs("button",{className:"new-chat",onClick:e,"aria-label":"搜索",title:"搜索",children:[l.jsx(gM,{}),l.jsx("span",{className:"sidebar-nav-label",children:"搜索"})]})}function zz(e,t,n){const r=!!e,s=new Set((t==null?void 0:t.searchSources)??[]),i=a=>r?n?"正在检测 Agent 能力":`当前 Agent 未挂载${a}`:"请选择 Agent";return[{id:"session",label:"会话",ready:r,unavailableLabel:"请选择 Agent"},{id:"web",label:"网络",ready:r&&s.has("web"),description:"通过 web_search 工具检索",unavailableLabel:i(" web_search 工具")},{id:"knowledge",label:"知识库",ready:r&&s.has("knowledge"),unavailableLabel:i("知识库")},{id:"memory",label:"长期记忆",ready:r&&s.has("memory"),unavailableLabel:i("长期记忆")}]}function Nm(e){return{context_search:"Context Search",local:"本地",mem0:"Mem0",milvus:"Milvus",opensearch:"OpenSearch",openviking:"OpenViking",redis:"Redis",tos_vector:"TOS Vector",viking:"VikingDB"}[e.toLowerCase()]??e}function ES(e){return e?new Date(e*1e3).toLocaleString("zh-CN",{timeZone:"Asia/Shanghai",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):""}function Vz({userId:e,appId:t,agentInfo:n,capabilitiesLoading:r,agentLabel:s,onOpenSession:i}){var j,T;const[a,o]=w.useState("session"),[c,u]=w.useState(""),[d,f]=w.useState([]),[h,p]=w.useState(),[m,y]=w.useState(!1),[E,g]=w.useState(!1),[x,b]=w.useState(!1),_=w.useRef(0),k=w.useRef(null),N=zz(t,n,r),C=N.find(L=>L.id===a),S=a==="knowledge"?(j=n==null?void 0:n.components)==null?void 0:j.find(L=>L.source==="knowledgebase"||L.kind==="knowledgebase"):a==="memory"?(T=n==null?void 0:n.components)==null?void 0:T.find(L=>L.source==="long_term_memory"||L.kind==="memory"):void 0;w.useEffect(()=>{_.current+=1,o("session"),f([]),p(void 0),g(!1),y(!1),b(!1)},[t]),w.useEffect(()=>{if(!x)return;function L(R){var F;(F=k.current)!=null&&F.contains(R.target)||b(!1)}return document.addEventListener("pointerdown",L),()=>document.removeEventListener("pointerdown",L)},[x]);async function A(L,R){var W;const F=L.trim();if(!F||!((W=N.find(P=>P.id===R))!=null&&W.ready))return;const I=++_.current;y(!0),g(!0);let V;try{V=await Uz(R,F,{userId:e,appId:t})}catch(P){const ie=P instanceof Error?P.message:String(P);V={results:[],note:`搜索失败:${ie}`}}I===_.current&&(f(V.results),p(V.note),y(!1))}function O(L){_.current+=1,u(L),f([]),p(void 0),g(!1),y(!1)}function D(L){_.current+=1,o(L),b(!1),f([]),p(void 0),g(!1),y(!1)}const U=!!(C!=null&&C.ready),X=t?a==="web"?"在网络中检索":a==="knowledge"?`在 ${(S==null?void 0:S.name)??"当前 Agent 的知识库"} 中检索`:a==="memory"?`在 ${(S==null?void 0:S.name)??"当前用户的长期记忆"} 中检索`:"在当前 Agent 的会话中检索":"请先选择 Agent",M=S!=null&&S.backend?Nm(S.backend):"";return l.jsxs("div",{className:"search",children:[l.jsxs("div",{className:"search-box",children:[l.jsxs("div",{className:"search-source-picker-wrap",ref:k,children:[l.jsxs("button",{className:"search-source-picker",type:"button","aria-label":`搜索类型:${(C==null?void 0:C.label)??"未选择"}`,"aria-haspopup":"listbox","aria-expanded":x,onClick:()=>b(L=>!L),children:[l.jsx("span",{children:(C==null?void 0:C.label)??"搜索类型"}),M&&l.jsx("small",{children:M}),l.jsx($z,{open:x})]}),x&&l.jsx("div",{className:"search-source-menu",role:"listbox","aria-label":"选择搜索类型",children:N.map(L=>{var I,V;const R=L.id==="knowledge"?(I=n==null?void 0:n.components)==null?void 0:I.find(W=>W.source==="knowledgebase"||W.kind==="knowledgebase"):L.id==="memory"?(V=n==null?void 0:n.components)==null?void 0:V.find(W=>W.source==="long_term_memory"||W.kind==="memory"):void 0,F=R?[R.name,R.backend?Nm(R.backend):""].filter(Boolean).join(" · "):L.ready?L.description:L.unavailableLabel;return l.jsxs("button",{type:"button",role:"option","aria-selected":a===L.id,disabled:!L.ready,onClick:()=>D(L.id),children:[l.jsx("span",{children:L.label}),F&&l.jsx("small",{children:F})]},L.id)})})]}),l.jsx("span",{className:"search-box-divider","aria-hidden":!0}),l.jsx("input",{className:"search-input",value:c,onChange:L=>O(L.target.value),onKeyDown:L=>{L.key==="Enter"&&(L.preventDefault(),A(c,a))},placeholder:X,disabled:!U,autoFocus:!0}),l.jsx("button",{className:"search-go",onClick:()=>void A(c,a),disabled:!c.trim()||m,"aria-label":"搜索",children:m?l.jsx(Rt,{className:"icon spin"}):l.jsx(gM,{className:"icon"})})]}),l.jsx("div",{className:"search-results",children:U?E?m?null:h?l.jsx("div",{className:"search-empty",children:h}):d.length===0&&E?l.jsxs("div",{className:"search-empty",children:["未找到匹配「",c.trim(),"」的结果。"]}):d.map((L,R)=>l.jsx(Kz,{result:L,agentLabel:s,onOpen:i},R)):l.jsx("div",{className:"search-empty",children:a==="web"?"输入关键词后回车或点击按钮,通过 web_search 工具检索。":a==="knowledge"?"输入问题,检索当前 Agent 挂载的知识库。":a==="memory"?"输入线索,检索当前用户跨会话保存的长期记忆。":"输入关键词后回车或点击按钮,搜索当前 Agent 的会话。"}):l.jsx("div",{className:"search-empty",children:t?r?"正在读取当前 Agent 的检索能力…":(C==null?void 0:C.unavailableLabel)??"当前 Agent 未挂载该数据源":"选择一个 Agent 后,即可检索会话、网络及其挂载的数据源。"})})]})}function Kz({result:e,agentLabel:t,onOpen:n}){switch(e.type){case"session":return l.jsxs("button",{className:"search-result",onClick:()=>n(e.appId,e.sessionId),children:[l.jsx(OL,{className:"search-result-icon"}),l.jsxs("div",{className:"search-result-body",children:[l.jsxs("div",{className:"search-result-head",children:[l.jsx("span",{className:"search-result-title",children:e.title}),l.jsxs("span",{className:"search-result-meta",children:[t(e.appId),e.ts?` · ${ES(e.ts)}`:""]})]}),l.jsx("div",{className:"search-result-snippet",children:e.snippet})]})]});case"web":return l.jsxs("a",{className:"search-result",href:e.url||void 0,target:"_blank",rel:"noreferrer noopener",children:[l.jsx(Ig,{className:"search-result-icon"}),l.jsxs("div",{className:"search-result-body",children:[l.jsxs("div",{className:"search-result-head",children:[l.jsx("span",{className:"search-result-title",children:e.title||e.url}),l.jsxs("span",{className:"search-result-meta",children:[e.siteName,e.url&&l.jsx(Ow,{className:"search-result-ext"})]})]}),e.summary&&l.jsx("div",{className:"search-result-snippet",children:e.summary})]})]});case"knowledge":return l.jsxs("div",{className:"search-result search-result-static",children:[l.jsx(xS,{source:"knowledge"}),l.jsxs("div",{className:"search-result-body",children:[l.jsxs("div",{className:"search-result-head",children:[l.jsxs("span",{className:"search-result-title",children:["知识片段 ",e.index+1]}),l.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${Nm(e.sourceType)}`:""]})]}),l.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});case"memory":return l.jsxs("div",{className:"search-result search-result-static",children:[l.jsx(xS,{source:"memory"}),l.jsxs("div",{className:"search-result-body",children:[l.jsxs("div",{className:"search-result-head",children:[l.jsxs("span",{className:"search-result-title",children:["记忆片段 ",e.index+1]}),l.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${Nm(e.sourceType)}`:"",e.ts?` · ${ES(e.ts)}`:""]})]}),l.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});default:return null}}function xS({source:e,className:t="search-result-icon"}){return e==="knowledge"?l.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[l.jsx("path",{d:"M5 5.5h10.5A3.5 3.5 0 0 1 19 9v9.5H8.5A3.5 3.5 0 0 1 5 15V5.5Z"}),l.jsx("path",{d:"M8.25 9h7.5M8.25 12.25h6"})]}):l.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[l.jsx("path",{d:"M12 4.5a7.5 7.5 0 1 0 7.5 7.5"}),l.jsx("path",{d:"M12 8a4 4 0 1 0 4 4M12 11.3a.7.7 0 1 0 0 1.4.7.7 0 0 0 0-1.4Z"})]})}const zw="/assets/volcengine-DM14a-L-.svg",wS="(max-width: 860px)";function Yz(){return l.jsxs("svg",{className:"icon sidebar-agent-face",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("rect",{x:"4.25",y:"5.25",width:"15.5",height:"13.5",rx:"4.75"}),l.jsx("path",{className:"sidebar-agent-face__eye sidebar-agent-face__eye--left",d:"M8.5 10.7v2"}),l.jsx("path",{className:"sidebar-agent-face__eye sidebar-agent-face__eye--right",d:"M15.5 10.7v2"})]})}function Wz(e){let t=2166136261;for(const r of e)t^=r.charCodeAt(0),t=Math.imul(t,16777619);const n=t>>>0;return{"--avatar-hue-a":194+n%22,"--avatar-hue-b":214+(n>>>6)%25,"--avatar-hue-c":176+(n>>>12)%25,"--avatar-x":`${22+(n>>>18)%55}%`,"--avatar-y":`${18+(n>>>24)%58}%`}}const Gz={admin:"管理员",developer:"开发者",user:"普通用户"};function vS({role:e}){const t=Gz[e];return l.jsx("span",{className:`studio-role-badge studio-role-badge--${e}`,title:t,children:t})}function qz({version:e,onClose:t}){return w.useEffect(()=>{const n=r=>{r.key==="Escape"&&t()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t]),Ss.createPortal(l.jsx("div",{className:"confirm-scrim",onMouseDown:t,children:l.jsxs("section",{className:"confirm-box system-info-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"system-info-title",onMouseDown:n=>n.stopPropagation(),children:[l.jsxs("header",{className:"system-info-head",children:[l.jsx("h2",{id:"system-info-title",children:"系统信息"}),l.jsx("button",{type:"button",className:"icon-btn",onClick:t,"aria-label":"关闭系统信息",autoFocus:!0,children:l.jsx(zr,{className:"icon","aria-hidden":"true"})})]}),l.jsx("dl",{className:"system-info-meta",children:l.jsxs("div",{children:[l.jsx("dt",{children:"当前版本"}),l.jsx("dd",{children:e||"—"})]})})]})}),document.body)}function Xz({access:e,userInfo:t,version:n,onLogout:r}){const[s,i]=w.useState(!1),[a,o]=w.useState(!1),[c,u]=w.useState("");if(!t)return null;const d=lz(t),f=typeof t.email=="string"?t.email:"",h=(d||"U").slice(0,1).toUpperCase(),p=Wz(d||f||h),m=cz(t),y=m===c?"":m;return l.jsxs("div",{className:"sidebar-user",children:[l.jsxs("button",{className:"sidebar-user-btn",onClick:()=>i(E=>!E),title:f?`${d} -${f}`:d,children:[l.jsxs("span",{className:`account-avatar${y?" has-image":""}`,style:p,children:[h,y?l.jsx("img",{className:"account-avatar-image",src:y,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>u(y)}):null]}),l.jsxs("span",{className:"sidebar-user-identity",children:[l.jsxs("span",{className:"sidebar-user-primary",children:[l.jsx("span",{className:"sidebar-user-name",children:d}),l.jsx(vS,{role:e.role})]}),f&&f!==d&&l.jsx("span",{className:"sidebar-user-email",children:f})]})]}),s&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"menu-scrim",onClick:()=>i(!1)}),l.jsxs("div",{className:"account-pop sidebar-user-pop",children:[l.jsxs("div",{className:"account-head",children:[l.jsxs("span",{className:`account-avatar account-avatar--lg${y?" has-image":""}`,style:p,children:[h,y?l.jsx("img",{className:"account-avatar-image",src:y,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>u(y)}):null]}),l.jsxs("div",{className:"account-id",children:[l.jsxs("div",{className:"account-name-row",children:[l.jsx("div",{className:"account-name",children:d}),l.jsx(vS,{role:e.role})]}),f&&f!==d&&l.jsx("div",{className:"account-sub",children:f})]})]}),l.jsxs("button",{type:"button",className:"account-action",onClick:()=>{i(!1),o(!0)},children:[l.jsx(Ya,{className:"icon"})," 系统信息"]}),l.jsxs("button",{type:"button",className:"account-action",onClick:()=>{i(!1),r()},children:[l.jsx(PH,{className:"icon"})," 退出登录"]})]})]}),a?l.jsx(qz,{version:n,onClose:()=>o(!1)}):null]})}function Qz({branding:e,sessions:t,currentSessionId:n,features:r,access:s,streamingSids:i,onNewChat:a,onSearch:o,onQuickCreate:c,onSkillCenter:u,onAddAgent:d,onManageAgents:f,onPickSession:h,onDeleteSession:p,userInfo:m,version:y,onLogout:E}){const g=A=>(r==null?void 0:r[A])!==!1,[x,b]=w.useState(null),_=w.useRef(typeof window<"u"&&window.matchMedia(wS).matches),[k,N]=w.useState(_.current),C=[...t].sort((A,O)=>(O.lastUpdateTime??0)-(A.lastUpdateTime??0)),S=()=>{_.current=!1,N(A=>!A),b(null)};return w.useEffect(()=>{const A=window.matchMedia(wS),O=D=>{D.matches?N(U=>U||(_.current=!0,!0)):_.current&&(_.current=!1,N(!1))};return A.addEventListener("change",O),()=>A.removeEventListener("change",O)},[]),l.jsxs("aside",{className:`sidebar ${k?"is-collapsed":""}`,children:[l.jsxs("div",{className:"sidebar-top",children:[l.jsxs("div",{className:"sidebar-brand-row",children:[l.jsxs("button",{type:"button",className:"brand",onClick:a,"aria-label":"返回首页",title:"返回首页",children:[l.jsx("img",{className:"brand-logo",src:e.logoUrl||zw,width:20,height:20,alt:"","aria-hidden":!0}),l.jsx("span",{className:"brand-title",children:e.title})]}),l.jsx("button",{type:"button",className:"sidebar-collapse-toggle",onClick:S,"aria-label":k?"展开侧边栏":"收起侧边栏",title:k?"展开侧边栏":"收起侧边栏",children:k?l.jsx(HH,{className:"icon"}):l.jsx($H,{className:"icon"})})]}),g("newChat")&&l.jsxs("button",{className:"new-chat new-chat--conversation",onClick:a,"aria-label":"新会话",title:"新会话",children:[l.jsx(rr,{className:"icon"}),l.jsx("span",{className:"sidebar-nav-label",children:"新会话"})]}),l.jsxs("button",{className:"new-chat new-chat--agents",onClick:f,"aria-label":"智能体",title:"智能体",children:[l.jsx(Yz,{}),l.jsx("span",{className:"sidebar-nav-label",children:"智能体"})]}),g("search")&&l.jsx(Hz,{onClick:o})]}),g("history")&&l.jsxs("div",{className:"sidebar-history",children:[l.jsxs("div",{className:"history-head",children:[l.jsx("span",{children:"历史会话"}),g("newChat")&&l.jsx("button",{type:"button",className:"history-new-chat",onClick:a,"aria-label":"新建会话",title:"新建会话",children:l.jsx(rr,{className:"icon"})})]}),l.jsxs("div",{className:"history-list",children:[C.length===0&&l.jsx("div",{className:"history-empty",children:"暂无会话"}),C.map(A=>{const O=Rz(A.events);return l.jsxs("div",{className:`history-item ${A.id===n?"active":""}`,children:[l.jsxs("button",{className:"history-item-btn",onClick:()=>h(A.id),title:O,children:[(i==null?void 0:i.has(A.id))&&l.jsx("span",{className:"history-streaming",title:"正在生成…","aria-label":"正在生成"}),l.jsx("span",{className:"history-title",children:O})]}),l.jsx("button",{className:"history-more",title:"更多",onClick:()=>b(D=>D===A.id?null:A.id),children:l.jsx(xH,{className:"icon"})}),x===A.id&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"menu-scrim",onClick:()=>b(null)}),l.jsx("div",{className:"history-menu",children:l.jsxs("button",{className:"menu-item menu-item--danger",onClick:()=>{b(null),p(A.id)},children:[l.jsx(ea,{className:"icon"})," 删除"]})})]})]},A.id)})]})]}),l.jsx(Xz,{access:s,userInfo:m,version:y,onLogout:E})]})}const yM="veadk_agentkit_connections";function ps(){try{const e=localStorage.getItem(yM);return e?JSON.parse(e):[]}catch{return[]}}function Mg(e){try{localStorage.setItem(yM,JSON.stringify(e))}catch{}}function Fo(e,t){return`agentkit:${e}:${t}`}function bM(e){try{return new URL(e).host}catch{return e}}function Wc(e){HL();for(const t of e)for(const n of t.apps)$L(Fo(t.id,n),t.runtimeId?{app:n,runtimeId:t.runtimeId,region:t.region}:{app:n,base:t.base,apiKey:t.apiKey})}function EM(e,t,n,r,s,i){const a={id:`rt_${e}`,name:t||e,runtimeId:e,region:n,apps:r,appLabels:s,currentVersion:i},o=[...ps().filter(c=>c.runtimeId!==e),a];return Mg(o),Wc(o),a}async function Sm(e,t,n,r){let s;try{s=await uM(e,n)}catch(o){throw o instanceof Nf&&Tm(e),o}if(!s||s.length===0)throw Tm(e),new Error("该 Runtime 暂不支持连接,请确认服务已正常运行。");const i=Object.fromEntries(s.map(o=>[o,t])),a=EM(e,t,n,s,i,r);return Fo(a.id,s[0])}async function xM(e,t,n,r){const s=t.trim().replace(/\/+$/,""),i=await Rg(s,n.trim()),a={id:Date.now().toString(36),name:e.trim()||bM(s),base:s,apiKey:n.trim(),apps:i,appLabels:r&&i.length>0?{[i[0]]:r}:void 0},o=[...ps().filter(c=>c.base!==s),a];return Mg(o),Wc(o),a}function Zz(e){const t=ps().filter(n=>n.id!==e);return Mg(t),Wc(t),t}function Tm(e){const t=ps().filter(n=>n.runtimeId!==e);return Mg(t),Wc(t),t}function wM(e,t){const n=e.map(s=>({id:s,label:s,app:s,remote:!1})),r=t.flatMap(s=>s.apps.map(i=>{var o;const a=((o=s.appLabels)==null?void 0:o[i])??i;return{id:Fo(s.id,i),label:a,app:i,remote:!0,host:s.runtimeId?s.name:bM(s.base??""),runtimeId:s.runtimeId,region:s.region,currentVersion:s.currentVersion}}));return[...n,...r]}const _S=Object.freeze(Object.defineProperty({__proto__:null,addConnection:xM,addRuntimeConnection:EM,buildAgentEntries:wM,connectRuntime:Sm,loadConnections:ps,registerConnections:Wc,remoteAppId:Fo,removeConnection:Zz,removeRuntimeConnection:Tm},Symbol.toStringTag,{value:"Module"}));function wc({className:e="icon"}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"m10.05 3.7 1.95-1.12 1.95 1.12"}),l.jsx("path",{d:"m16.25 5.03 3.9 2.25v4.5"}),l.jsx("path",{d:"M20.15 15.08v1.64l-3.9 2.25"}),l.jsx("path",{d:"m13.95 20.3-1.95 1.12-1.95-1.12"}),l.jsx("path",{d:"m7.75 18.97-3.9-2.25v-4.5"}),l.jsx("path",{d:"M3.85 8.92V7.28l3.9-2.25"}),l.jsx("path",{d:"m12 7.55 1.28 3.17L16.45 12l-3.17 1.28L12 16.45l-1.28-3.17L7.55 12l3.17-1.28L12 7.55Z",fill:"currentColor",stroke:"none"})]})}function Q1({className:e="icon"}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M4.5 6.7h4.2M12.3 6.7h7.2"}),l.jsx("path",{d:"M4.5 12h8.2M16.3 12h3.2"}),l.jsx("path",{d:"M4.5 17.3h2.7M10.8 17.3h8.7"}),l.jsx("circle",{cx:"10.5",cy:"6.7",r:"1.8",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14.5",cy:"12",r:"1.8",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"9",cy:"17.3",r:"1.8",fill:"currentColor",stroke:"none"})]})}function Jz({className:e="icon"}){return l.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsxs("g",{transform:"translate(0 2)",children:[l.jsx("path",{d:"M11.6 3.5c.45 3.75 2.75 6.05 6.5 6.5-3.75.45-6.05 2.75-6.5 6.5-.45-3.75-2.75-6.05-6.5-6.5 3.75-.45 6.05-2.75 6.5-6.5Z"}),l.jsx("path",{d:"M18.7 3.8v3.4M20.4 5.5H17"})]})})}function vM({className:e="icon"}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M18.7 8.15A7.55 7.55 0 0 0 5.35 7.1"}),l.jsx("path",{d:"m18.7 8.15-.2-3.05-3.02.3"}),l.jsx("path",{d:"M5.3 15.85A7.55 7.55 0 0 0 18.65 16.9"}),l.jsx("path",{d:"m5.3 15.85.2 3.05 3.02-.3"}),l.jsx("path",{d:"M6.85 12h2.8l1.4-2.9 1.9 5.8 1.42-2.9h2.78"})]})}const kS=15,eV=1e4,tV=[{value:"cn-beijing",label:"北京"},{value:"cn-shanghai",label:"上海"}];function nV(e){return e==="cn-beijing"?"北京":e==="cn-shanghai"?"上海":e}function _M(e){const t=e.toLowerCase();return t.includes("invalidagentkitruntime.notfound")||t.includes("specified agentkitruntime does not exist")?"该 Runtime 已不存在或列表信息已过期,请刷新列表后重试。":t.includes("accessdenied")||t.includes("forbidden")||t.includes("permission")||t.includes("(401)")||t.includes("(403)")?"当前账号无权访问该 Runtime,请检查所属 Project 和访问权限。":t.includes("agent-info failed: 404")||t.includes("读取 agent 列表失败 (404)")?"该 Agent Server 版本暂不支持信息预览。":"该 Runtime 暂时无法访问,请确认其状态为“就绪”后重试。"}function xy(e,t=eV){return new Promise((n,r)=>{const s=setTimeout(()=>r(new Error("加载超时,请重试")),t);e.then(i=>{clearTimeout(s),n(i)},i=>{clearTimeout(s),r(i)})})}function rV({open:e,onClose:t,variant:n="drawer",anchorTop:r=0,agentsSource:s,localApps:i,currentId:a,currentRuntime:o,runtimeScope:c,onSelect:u}){const[d,f]=w.useState([]),[h,p]=w.useState([""]),[m,y]=w.useState(0),[E,g]=w.useState(c==="mine"),[x,b]=w.useState(null),[_,k]=w.useState("cn-beijing"),[N,C]=w.useState(!1),[S,A]=w.useState(""),[O,D]=w.useState(""),[U,X]=w.useState(null),[M,j]=w.useState(new Set),[T,L]=w.useState(),[R,F]=w.useState("agent"),I=w.useRef(!1);function V(ne){L(me=>(me==null?void 0:me.runtimeId)===ne.runtimeId?void 0:{runtimeId:ne.runtimeId,name:ne.name,region:ne.region})}const W=w.useCallback(async ne=>{if(d[ne]){y(ne);return}const me=h[ne];if(me!==void 0){C(!0),A("");try{const ye=await xy(cd({nextToken:me,pageSize:kS,region:_,scope:"all"}));f(te=>{const de=[...te];return de[ne]=ye.runtimes,de}),p(te=>{const de=[...te];return ye.nextToken&&(de[ne+1]=ye.nextToken),de}),y(ne)}catch(ye){A(ye instanceof Error?ye.message:String(ye))}finally{C(!1)}}},[h,d,_]),P=w.useCallback(async()=>{C(!0),A("");try{const ne=[];let me="";do{const ye=await xy(cd({scope:"mine",nextToken:me,pageSize:100,region:_}));ne.push(...ye.runtimes),me=ye.nextToken}while(me&&ne.length<2e3);b(ne)}catch(ne){A(ne instanceof Error?ne.message:String(ne))}finally{C(!1)}},[_]);w.useEffect(()=>{g(c==="mine"),f([]),p([""]),y(0),b(null),I.current=!1},[c]),w.useEffect(()=>{e&&s==="cloud"&&!E&&!I.current&&(I.current=!0,W(0))},[e,s,E,W]),w.useEffect(()=>{E&&x===null&&s==="cloud"&&P()},[E,x,s,P]),w.useEffect(()=>{e&&(L(void 0),F("agent"))},[e]);function ie(){j(new Set),E?(b(null),P()):(f([]),p([""]),y(0),I.current=!0,C(!0),A(""),xy(cd({nextToken:"",pageSize:kS,region:_,scope:"all"})).then(ne=>{f([ne.runtimes]),p(ne.nextToken?["",ne.nextToken]:[""])}).catch(ne=>A(ne instanceof Error?ne.message:String(ne))).finally(()=>C(!1)))}function G(ne){ne!==_&&(k(ne),f([]),p([""]),y(0),b(null),j(new Set),I.current=!1)}const re=!E&&(d[m+1]!==void 0||h[m+1]!==void 0);function ue(ne){X(ne.runtimeId),Sm(ne.runtimeId,ne.name,ne.region).then(me=>{u(me),t()}).catch(me=>{if(me instanceof Nf){A(me.message);return}if(me instanceof Yd){me.unsupported&&j(ye=>new Set(ye).add(ne.runtimeId)),A(me.message);return}j(ye=>new Set(ye).add(ne.runtimeId))}).finally(()=>X(null))}if(!e)return null;const le=(E?x??[]:d[m]??[]).filter(ne=>O?ne.name.toLowerCase().includes(O.toLowerCase()):!0);return l.jsxs(l.Fragment,{children:[n==="drawer"?l.jsx("div",{className:"menu-scrim",onClick:t}):null,l.jsxs("div",{className:`agentsel agentsel--${n}${T&&n==="drawer"?" has-detail":""}`,role:"dialog","aria-label":"选择 Agent",style:n==="drawer"?{top:r,height:`min(640px, calc(100dvh - ${r}px - 10px))`}:void 0,children:[l.jsxs("div",{className:"agentsel-main",children:[l.jsxs("div",{className:"agentsel-head",children:[l.jsxs("span",{className:"agentsel-title",children:[l.jsx(wc,{})," 选择 Agent"]}),l.jsxs("div",{className:"agentsel-head-actions",children:[s==="cloud"&&l.jsx("button",{className:"agentsel-refresh",onClick:ie,title:"刷新",disabled:N,children:l.jsx(z1,{className:`icon ${N?"spin":""}`})}),l.jsx("button",{className:"agentsel-refresh",onClick:t,title:"关闭",children:l.jsx(zr,{className:"icon"})})]})]}),s==="local"?l.jsx("div",{className:"agentsel-body",children:i.length===0?l.jsx("div",{className:"agentsel-empty",children:"暂无本地 Agent。"}):l.jsx("ul",{className:"agentsel-list",children:i.map(ne=>l.jsx("li",{children:l.jsxs("button",{className:`agentsel-item ${ne===a?"active":""}`,onClick:()=>{u(ne),t()},children:[l.jsx(wc,{}),l.jsx("span",{className:"agentsel-item-name",children:ne})]})},ne))})}):l.jsxs("div",{className:"agentsel-body agentsel-body--cloud",children:[l.jsxs("div",{className:"agentsel-tools",children:[l.jsxs("div",{className:"agentsel-search",children:[l.jsx(Kd,{className:"icon"}),l.jsx("input",{value:O,onChange:ne=>D(ne.target.value),placeholder:"搜索 Runtime 名称"})]}),l.jsx("div",{className:"agentsel-regions","aria-label":"按部署地域筛选",children:tV.map(ne=>l.jsx("button",{type:"button",className:_===ne.value?"active":"","aria-pressed":_===ne.value,onClick:()=>G(ne.value),children:ne.label},ne.value))}),c==="all"&&l.jsxs("label",{className:"agentsel-mine",children:[l.jsx("input",{type:"checkbox",checked:E,onChange:ne=>g(ne.target.checked)}),"只看我创建的"]})]}),S&&l.jsx("div",{className:"agentsel-error",children:S}),l.jsxs("div",{className:"agentsel-listwrap",children:[le.length===0&&!N?l.jsx("div",{className:"agentsel-empty",children:"暂无 Runtime。"}):l.jsx("ul",{className:"agentsel-list",children:le.map(ne=>{const me=M.has(ne.runtimeId),ye=U===ne.runtimeId,te=(o==null?void 0:o.runtimeId)===ne.runtimeId,de=(T==null?void 0:T.runtimeId)===ne.runtimeId;return l.jsx("li",{children:l.jsxs("div",{className:`agentsel-item agentsel-runtime-item ${te?"active":""} ${de?"is-previewed":""}`,title:ne.runtimeId,children:[l.jsx(vM,{}),l.jsxs("div",{className:"agentsel-item-main",children:[l.jsx("span",{className:"agentsel-item-name",title:ne.name,children:ne.name}),l.jsxs("div",{className:"agentsel-item-meta",children:[l.jsx("span",{className:`agentsel-status is-${me?"bad":uV(ne.status)}`,children:me?"不支持":kM(ne.status)}),ne.isMine&&l.jsx("span",{className:"agentsel-badge",children:"我创建的"})]})]}),l.jsxs("div",{className:"agentsel-item-actions",children:[l.jsx("button",{type:"button",className:"agentsel-connect",disabled:ye||te,onClick:()=>ue(ne),children:ye?"连接中…":te?"已连接":me?"重试":"连接"}),n==="drawer"?l.jsx("button",{type:"button",className:`agentsel-info ${de?"active":""}`,"aria-label":`查看 ${ne.name} 信息`,"aria-pressed":de,title:"查看信息",onClick:()=>V(ne),children:l.jsx(Ya,{className:"icon"})}):null]})]})},ne.runtimeId)})}),N&&l.jsxs("div",{className:"agentsel-loading",children:[l.jsx(Rt,{className:"icon spin"})," 加载中…"]})]}),l.jsxs("div",{className:"agentsel-pager",children:[l.jsx("button",{disabled:E||m===0||N,onClick:()=>void W(m-1),"aria-label":"上一页",children:l.jsx(gH,{className:"icon"})}),l.jsx("span",{className:"agentsel-pager-label",children:E?1:m+1}),l.jsx("button",{disabled:E||!re||N,onClick:()=>void W(m+1),"aria-label":"下一页",children:l.jsx(ws,{className:"icon"})})]})]})]}),n==="drawer"&&s==="cloud"&&T&&l.jsx(oV,{runtime:T,tab:R,onTabChange:F})]})]})}const sV={knowledgebase:"知识库",memory:"记忆",prompt_manager:"提示词管理",example_store:"样例库",run_processor:"运行处理器",tracer:"链路追踪",toolset:"工具集",plugin:"插件",other:"其他"};function iV(e){return sV[e.toLowerCase()]??e}function aV(e){return{context_search:"Context Search",local:"本地",mem0:"Mem0",milvus:"Milvus",opensearch:"OpenSearch",openviking:"OpenViking",redis:"Redis",tos_vector:"TOS Vector",viking:"VikingDB"}[e.toLowerCase()]??e}function oV({runtime:e,tab:t,onTabChange:n}){return l.jsxs("section",{className:"agentsel-detail agentsel-preview","aria-label":"Agent 与 Runtime 信息",children:[l.jsx("div",{className:"agentsel-head agentsel-preview-head",children:l.jsxs("div",{className:`agentsel-detail-tabs is-${t}`,role:"tablist","aria-label":"详情类型",children:[l.jsx("span",{className:"agentsel-detail-tabs-slider","aria-hidden":!0}),l.jsx("button",{id:"agentsel-agent-tab",type:"button",role:"tab","aria-selected":t==="agent","aria-controls":"agentsel-agent-panel",onClick:()=>n("agent"),children:"Agent 信息"}),l.jsx("button",{id:"agentsel-runtime-tab",type:"button",role:"tab","aria-selected":t==="runtime","aria-controls":"agentsel-runtime-panel",onClick:()=>n("runtime"),children:"Runtime 信息"})]})}),l.jsx("div",{id:"agentsel-agent-panel",className:"agentsel-tab-panel",role:"tabpanel","aria-labelledby":"agentsel-agent-tab",hidden:t!=="agent",children:l.jsx(lV,{runtime:e})}),l.jsx("div",{id:"agentsel-runtime-panel",className:"agentsel-tab-panel",role:"tabpanel","aria-labelledby":"agentsel-runtime-tab",hidden:t!=="runtime",children:l.jsx(cV,{runtime:e})})]})}function lV({runtime:e}){const[t,n]=w.useState(null),[r,s]=w.useState(!0),[i,a]=w.useState(""),o=e.runtimeId,c=e.region;w.useEffect(()=>{let d=!0;return n(null),s(!0),a(""),tM(o,c).then(f=>d&&n(f)).catch(f=>{if(!d)return;const h=f instanceof Error?f.message:String(f);a(_M(h))}).finally(()=>d&&s(!1)),()=>{d=!1}},[o,c]);const u=(t==null?void 0:t.components)??[];return l.jsx("div",{className:"agentsel-detail-body",children:r?l.jsxs("div",{className:"agentsel-panel-state",children:[l.jsx(Rt,{className:"icon spin"})," 读取 Agent 信息…"]}):i?l.jsxs("div",{className:"agentsel-panel-empty",children:[l.jsx("span",{children:"暂时无法读取 Agent 信息"}),l.jsx("small",{title:i,children:i})]}):t?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"agentsel-identity",children:[l.jsx(wc,{className:"agentsel-identity-icon"}),l.jsxs("div",{className:"agentsel-identity-copy",children:[l.jsx("strong",{title:t.name,children:t.name||"未命名 Agent"}),t.model&&l.jsx("span",{title:t.model,children:t.model})]})]}),t.description&&l.jsxs("section",{className:"agentsel-info-section",children:[l.jsx("h3",{children:"描述"}),l.jsx("p",{className:"agentsel-description",title:t.description,children:t.description})]}),t.subAgents.length>0&&l.jsx(NS,{icon:l.jsx(RL,{className:"icon"}),title:"子 Agent",values:t.subAgents}),t.tools.length>0&&l.jsx(NS,{icon:l.jsx(Q1,{}),title:"工具",values:t.tools}),l.jsxs("section",{className:"agentsel-info-section",children:[l.jsxs("h3",{children:[l.jsx(Jz,{})," 技能"]}),t.skillsPreviewSupported?t.skills.length>0?l.jsx("div",{className:"agentsel-info-list",children:t.skills.map(d=>l.jsxs("div",{className:"agentsel-info-list-item",children:[l.jsx("strong",{title:d.name,children:d.name}),d.description&&l.jsx("span",{title:d.description,children:d.description})]},d.name))}):l.jsx("div",{className:"agentsel-info-empty",children:"未配置"}):l.jsx("div",{className:"agentsel-info-empty",children:"暂不支持预览"})]}),u.length>0&&l.jsxs("section",{className:"agentsel-info-section",children:[l.jsxs("h3",{children:[l.jsx(vL,{className:"icon"})," 挂载组件"]}),l.jsx("div",{className:"agentsel-info-list",children:u.map((d,f)=>l.jsxs("div",{className:"agentsel-info-list-item agentsel-component",children:[l.jsxs("div",{className:"agentsel-component-head",children:[l.jsx("strong",{title:d.name,children:d.name}),l.jsxs("span",{children:[iV(d.kind),d.backend?` · ${aV(d.backend)}`:""]})]}),d.description&&l.jsx("span",{title:d.description,children:d.description})]},`${d.kind}:${d.name}:${f}`))})]}),!t.description&&t.subAgents.length===0&&t.tools.length===0&&t.skillsPreviewSupported&&t.skills.length===0&&u.length===0&&l.jsx("div",{className:"agentsel-panel-empty",children:"暂无更多 Agent 配置信息。"})]}):null})}function NS({icon:e,title:t,values:n}){return l.jsxs("section",{className:"agentsel-info-section",children:[l.jsxs("h3",{children:[e,t]}),l.jsx("div",{className:"agentsel-chips",children:n.map((r,s)=>l.jsx("span",{className:"agentsel-chip",title:r,children:r},`${r}:${s}`))})]})}function cV({runtime:e}){const[t,n]=w.useState(null),[r,s]=w.useState(!0),[i,a]=w.useState(""),o=e.runtimeId,c=e.region;w.useEffect(()=>{let d=!0;return s(!0),a(""),n(null),$w(o,c).then(f=>d&&n(f)).catch(f=>d&&a(_M(f instanceof Error?f.message:String(f)))).finally(()=>d&&s(!1)),()=>{d=!1}},[o,c]);const u=[];if(t){t.model&&u.push(["模型",t.model]),t.description&&u.push(["描述",t.description]),t.status&&u.push(["状态",kM(t.status)]),t.region&&u.push(["区域",nV(t.region)]);const d=t.resources,f=[d.cpuMilli!=null?`CPU ${d.cpuMilli}m`:"",d.memoryMb!=null?`内存 ${d.memoryMb}MB`:"",d.minInstance!=null||d.maxInstance!=null?`实例 ${d.minInstance??"?"}~${d.maxInstance??"?"}`:""].filter(Boolean).join(" · ");f&&u.push(["资源",f]),t.currentVersion!=null&&u.push(["版本",String(t.currentVersion)])}return l.jsxs("div",{className:"agentsel-detail-body",children:[l.jsxs("div",{className:"agentsel-runtime-identity",children:[l.jsx(vM,{}),l.jsxs("div",{children:[l.jsx("strong",{title:e.name,children:e.name}),l.jsx("span",{title:e.runtimeId,children:e.runtimeId})]})]}),r?l.jsxs("div",{className:"agentsel-apps-note",children:[l.jsx(Rt,{className:"icon spin"})," 读取详情…"]}):i?l.jsx("div",{className:"agentsel-error",children:i}):t?l.jsxs(l.Fragment,{children:[l.jsx("dl",{className:"agentsel-kv",children:u.map(([d,f])=>l.jsxs("div",{className:"agentsel-kv-row",children:[l.jsx("dt",{children:d}),l.jsx("dd",{children:f})]},d))}),t.envs.length>0&&l.jsxs("div",{className:"agentsel-envs",children:[l.jsx("div",{className:"agentsel-envs-head",children:"环境变量"}),t.envs.map(d=>l.jsxs("div",{className:"agentsel-env",children:[l.jsx("span",{className:"agentsel-env-k",children:d.key}),l.jsx("span",{className:"agentsel-env-v",children:d.value})]},d.key))]})]}):null]})}function uV(e){const t=(e||"").toLowerCase();return t.includes("run")||t.includes("ready")||t.includes("active")?"ok":t.includes("creat")||t.includes("pend")||t.includes("deploy")?"warn":t.includes("fail")||t.includes("error")||t.includes("delet")?"bad":"muted"}const dV={ready:"就绪",unreleased:"未发布",running:"运行中",active:"运行中",creating:"创建中",pending:"等待中",deploying:"部署中",updating:"更新中",failed:"失败",error:"异常",stopping:"停止中",stopped:"已停止",deleting:"删除中",deleted:"已删除"};function kM(e){const t=e.toLowerCase().replace(/[\s_-]/g,"");return dV[t]??(e||"-")}function fV({appName:e,onAppChange:t,agentLabel:n,agentsSource:r,localApps:s,currentRuntime:i,runtimeScope:a,title:o,titleLeading:c,crumbs:u,rightContent:d}){return l.jsxs("div",{className:"navbar",children:[l.jsxs("div",{className:"navbar-left",children:[l.jsx("div",{className:"navbar-default",children:u&&u.length>0?l.jsx("nav",{className:"navbar-crumbs","aria-label":"面包屑",children:u.map((f,h)=>l.jsxs(w.Fragment,{children:[h>0&&l.jsx(ws,{className:"crumb-sep"}),f.onClick?l.jsx("button",{className:"crumb crumb-link",onClick:f.onClick,children:f.label}):l.jsx("span",{className:"crumb crumb-current",children:f.label})]},h))}):o?l.jsxs("div",{className:"navbar-title-group",children:[c,l.jsx("div",{className:"navbar-title",title:o,children:o})]}):l.jsxs("div",{className:"navbar-title-group",children:[c,l.jsx(hV,{appName:e,onAppChange:t,agentLabel:n,agentsSource:r,localApps:s,currentRuntime:i,runtimeScope:a})]})}),l.jsx("div",{id:"veadk-page-header-left",className:"navbar-portal-slot"})]}),l.jsxs("div",{className:"navbar-right",children:[l.jsx("div",{id:"veadk-page-header-actions",className:"navbar-portal-actions"}),d]})]})}function hV({appName:e,onAppChange:t,agentLabel:n,agentsSource:r,localApps:s,currentRuntime:i,runtimeScope:a}){const[o,c]=w.useState(!1),u=f=>n?n(f):f;function d(){c(!1)}return l.jsxs("div",{className:"agent-dd",children:[l.jsxs("button",{className:"agent-dd-trigger",onClick:()=>c(f=>!f),children:[l.jsx("span",{className:"agent-dd-current",children:e?u(e):"选择 Agent"}),l.jsx(Tw,{className:`agent-dd-chev ${o?"open":""}`})]}),o&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"menu-scrim",onClick:d}),l.jsx(rV,{open:!0,variant:"navbar",agentsSource:r,localApps:s,currentId:e,currentRuntime:i,runtimeScope:a,onSelect:f=>{t(f),d()},onClose:d})]})]})}async function Sf(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:Gs(void 0,Yc)});if(t.status===409)throw new Error("服务端未配置 Volcengine AK/SK,无法访问 AgentKit Skills 中心");if(t.status===401)throw new Error("请先登录以访问 AgentKit Skills 中心");if(t.status===404)throw new Error("技能不存在或无 SKILL.md 内容");if(!t.ok){let n="";try{n=(await t.json()).detail||""}catch{}throw new Error(`请求失败 (${t.status})${n?": "+n:""}`)}return t.json()}async function NM(){return(await Sf("/web/skill-spaces?region=all")).items||[]}async function pV(e){const t=new URLSearchParams({region:e.region,page:String(e.page),page_size:String(e.pageSize)});return e.project&&t.set("project",e.project),Sf(`/web/skill-spaces?${t.toString()}`)}async function SM(e,t){const n=t?`?region=${encodeURIComponent(t)}`:"";return(await Sf(`/web/skill-spaces/${encodeURIComponent(e)}/skills${n}`)).items||[]}async function mV(e,t){const n=new URLSearchParams({region:t.region,page:String(t.page),page_size:String(t.pageSize)});return t.project&&n.set("project",t.project),Sf(`/web/skill-spaces/${encodeURIComponent(e)}/skills?${n.toString()}`)}async function gV(e,t,n,r,s){const i=[];n&&i.push(`version=${encodeURIComponent(n)}`),r&&i.push(`region=${encodeURIComponent(r)}`),s&&i.push(`project=${encodeURIComponent(s)}`);const a=i.length>0?`?${i.join("&")}`:"";return Sf(`/web/skill-spaces/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}${a}`)}function yV(e,t){return{source:"skillspace",id:`ss:${e.id}/${t.skillId}/${t.version}`,name:t.skillName,description:t.skillDescription,folder:t.skillName,skillSpaceId:e.id,skillSpaceName:e.name,skillSpaceRegion:e.region,skillId:t.skillId,version:t.version}}function bV(e,t){return`https://console.volcengine.com/agentkit/${(t||"cn-beijing")==="cn-beijing"?"cn":"cn-shanghai"}/skillspace/detail/${encodeURIComponent(e)}`}const EV="https://ark.cn-beijing.volces.com/api/v3/",Sp=[{key:"MODEL_EMBEDDING_NAME",required:!1,placeholder:"doubao-embedding-vision-250615",comment:"向量化模型(记忆/知识库需要)"},{key:"MODEL_EMBEDDING_DIM",required:!1,placeholder:"2048"},{key:"MODEL_EMBEDDING_API_BASE",required:!1,placeholder:EV}],vc=[],Eu=[{key:"FEISHU_APP_ID",required:!0,placeholder:"cli_xxx",comment:"飞书应用 App ID"},{key:"FEISHU_APP_SECRET",required:!0,placeholder:"输入 App Secret",comment:"飞书应用 App Secret"}],qs={topK:"3",region:"cn-beijing",endpoint:"https://open.volcengineapi.com/"},TM=[{key:"REGISTRY_SPACE_ID",required:!0,placeholder:"请选择智能体中心",comment:"AgentKit 智能体中心"},{key:"REGISTRY_TOP_K",required:!1,placeholder:qs.topK,comment:"召回 Agent 数量"},{key:"REGISTRY_REGION",required:!1,placeholder:qs.region,comment:"AgentKit 智能体中心地域"},{key:"REGISTRY_ENDPOINT",required:!1,placeholder:qs.endpoint,comment:"AgentKit 智能体中心 OpenAPI 地址"}],_c=[{id:"web_search",label:"联网搜索",desc:"火山引擎 Web Search,获取实时信息。",importLine:"from veadk.tools.builtin_tools.web_search import web_search",toolNames:["web_search"],env:vc},{id:"parallel_web_search",label:"并行联网搜索",desc:"并行发起多条搜索查询,更快汇总。",importLine:"from veadk.tools.builtin_tools.parallel_web_search import parallel_web_search",toolNames:["parallel_web_search"],env:vc},{id:"link_reader",label:"网页读取",desc:"抓取并阅读给定链接的正文内容。",importLine:"from veadk.tools.builtin_tools.link_reader import link_reader",toolNames:["link_reader"],env:[]},{id:"web_scraper",label:"网页爬取",desc:"结构化爬取网页(需要 Scraper 服务)。",importLine:"from veadk.tools.builtin_tools.web_scraper import web_scraper",toolNames:["web_scraper"],env:[{key:"TOOL_WEB_SCRAPER_ENDPOINT",required:!0},{key:"TOOL_WEB_SCRAPER_API_KEY",required:!0}]},{id:"image_generate",label:"图像生成",desc:"文生图(Doubao Seedream)。",importLine:"from veadk.tools.builtin_tools.image_generate import image_generate",toolNames:["image_generate"],env:[{key:"MODEL_IMAGE_NAME",required:!1,placeholder:"doubao-seedream-5-0-260128"}]},{id:"image_edit",label:"图像编辑",desc:"图生图 / 编辑(Doubao SeedEdit)。",importLine:"from veadk.tools.builtin_tools.image_edit import image_edit",toolNames:["image_edit"],env:[{key:"MODEL_EDIT_NAME",required:!1,placeholder:"doubao-seededit-3-0-i2i-250628"}]},{id:"video_generate",label:"视频生成",desc:"文/图生视频(Doubao Seedance),含任务查询。",importLine:"from veadk.tools.builtin_tools.video_generate import video_generate, video_task_query",toolNames:["video_generate","video_task_query"],env:[{key:"MODEL_VIDEO_NAME",required:!1,placeholder:"doubao-seedance-2-0-260128"}]},{id:"text_to_speech",label:"语音合成 (TTS)",desc:"把文本转成语音(火山语音)。",importLine:"from veadk.tools.builtin_tools.tts import text_to_speech",toolNames:["text_to_speech"],env:[{key:"TOOL_VESPEECH_APP_ID",required:!0},{key:"TOOL_VESPEECH_SPEAKER",required:!1,placeholder:"zh_female_vv_uranus_bigtts"}]},{id:"run_code",label:"代码执行",desc:"在沙箱中执行代码",importLine:"from veadk.tools.builtin_tools.run_code import run_code",toolNames:["run_code"],env:[{key:"AGENTKIT_TOOL_ID",required:!0,placeholder:"t-xxxx",comment:"代码执行沙箱 ID"},{key:"AGENTKIT_TOOL_REGION",required:!1,placeholder:"cn-beijing",comment:"AgentKit Tools 地域"}]},{id:"vesearch",label:"VeSearch 智能搜索",desc:"火山 VeSearch(需要 bot 端点)。",importLine:"from veadk.tools.builtin_tools.vesearch import vesearch",toolNames:["vesearch"],env:[{key:"TOOL_VESEARCH_ENDPOINT",required:!0,comment:"VeSearch bot_id"}]}],Z1=[{id:"local",label:"本地内存",desc:"进程内,不持久化。适合开发调试。",env:[]},{id:"sqlite",label:"SQLite 文件",desc:"持久化到本地 .db 文件。",extraArgs:'local_database_path="./short_term_memory.db"',env:[]},{id:"mysql",label:"MySQL",desc:"持久化到 MySQL。",env:[{key:"DATABASE_MYSQL_HOST",required:!0},{key:"DATABASE_MYSQL_USER",required:!0},{key:"DATABASE_MYSQL_PASSWORD",required:!0},{key:"DATABASE_MYSQL_DATABASE",required:!0}]},{id:"postgresql",label:"PostgreSQL",desc:"持久化到 PostgreSQL。",env:[{key:"DATABASE_POSTGRESQL_HOST",required:!0},{key:"DATABASE_POSTGRESQL_PORT",required:!1,placeholder:"5432"},{key:"DATABASE_POSTGRESQL_USER",required:!0},{key:"DATABASE_POSTGRESQL_PASSWORD",required:!0},{key:"DATABASE_POSTGRESQL_DATABASE",required:!0}]}],J1=[{id:"local",label:"本地向量库",desc:"进程内 llama-index 向量库。",env:Sp,pipExtra:"extensions",needsEmbedding:!0},{id:"opensearch",label:"OpenSearch",desc:"OpenSearch 向量检索。",env:[{key:"DATABASE_OPENSEARCH_HOST",required:!0},{key:"DATABASE_OPENSEARCH_PORT",required:!1,placeholder:"9200"},{key:"DATABASE_OPENSEARCH_USERNAME",required:!0},{key:"DATABASE_OPENSEARCH_PASSWORD",required:!0},...Sp],pipExtra:"extensions",needsEmbedding:!0},{id:"redis",label:"Redis",desc:"Redis 向量检索。",env:[{key:"DATABASE_REDIS_HOST",required:!0},{key:"DATABASE_REDIS_PORT",required:!1,placeholder:"6379"},{key:"DATABASE_REDIS_PASSWORD",required:!1},...Sp],pipExtra:"extensions",needsEmbedding:!0},{id:"viking",label:"VikingDB Memory",desc:"火山 VikingDB 记忆库(支持用户画像)。",env:vc},{id:"mem0",label:"Mem0",desc:"Mem0 托管记忆服务。",env:[{key:"DATABASE_MEM0_API_KEY",required:!0},{key:"DATABASE_MEM0_BASE_URL",required:!1}]}],qd="viking",eE=[{id:"viking",label:"VikingDB Knowledge",desc:"火山 VikingDB 知识库。",env:vc},{id:"opensearch",label:"OpenSearch",desc:"OpenSearch 向量检索。",env:[{key:"DATABASE_OPENSEARCH_HOST",required:!0},{key:"DATABASE_OPENSEARCH_PORT",required:!1,placeholder:"9200"},{key:"DATABASE_OPENSEARCH_USERNAME",required:!0},{key:"DATABASE_OPENSEARCH_PASSWORD",required:!0},...Sp],pipExtra:"extensions",needsEmbedding:!0},{id:"context_search",label:"Context Search",desc:"火山 Context Search 引擎(无需向量化)。",env:[...vc,{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ID",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ENDPOINT",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_APIKEY",required:!0}]}],tE=[{id:"apmplus",label:"APMPlus",desc:"火山 APMPlus 应用性能监控。",enableFlag:"ENABLE_APMPLUS",env:[{key:"OBSERVABILITY_OPENTELEMETRY_APMPLUS_SERVICE_NAME",required:!1}]},{id:"cozeloop",label:"CozeLoop",desc:"扣子 CozeLoop 链路观测。",enableFlag:"ENABLE_COZELOOP",env:[{key:"OBSERVABILITY_OPENTELEMETRY_COZELOOP_API_KEY",required:!0},{key:"OBSERVABILITY_OPENTELEMETRY_COZELOOP_SERVICE_NAME",required:!1,comment:"CozeLoop space_id"}]},{id:"tls",label:"TLS (日志服务)",desc:"火山 TLS 日志服务导出。",enableFlag:"ENABLE_TLS",env:[...vc,{key:"OBSERVABILITY_OPENTELEMETRY_TLS_SERVICE_NAME",required:!1,comment:"TLS topic_id,留空自动创建"}]}],xV={coding:"智能编程",get_city_weather:"城市天气查询",get_location_weather:"位置天气查询",web_fetch:"网页内容获取"};function nE(e){const t=_c.find(n=>n.id===e||n.toolNames.includes(e));return xV[e]??(t==null?void 0:t.label)??e}function SS(e){const t=_c.find(r=>r.id===e||r.toolNames.includes(e));return((t==null?void 0:t.desc)??"由 VeADK 提供的内置工具").replace(/[。.]+$/,"")}function wV(){return l.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:l.jsx("path",{d:"m7 7 10 10M17 7 7 17",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function vV(){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[l.jsx("circle",{cx:"10.8",cy:"10.8",r:"5.8",stroke:"currentColor",strokeWidth:"1.7"}),l.jsx("path",{d:"m15.2 15.2 4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function TS(){return l.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:l.jsx("path",{d:"M12 5.5v13M5.5 12h13",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function AM({title:e,description:t,icon:n,wide:r=!1,onClose:s,children:i}){const a=w.useRef(`session-capability-${Math.random().toString(36).slice(2)}`);return w.useEffect(()=>{const o=document.body.style.overflow;document.body.style.overflow="hidden";const c=u=>{u.key==="Escape"&&s()};return document.addEventListener("keydown",c),()=>{document.removeEventListener("keydown",c),document.body.style.overflow=o}},[s]),Ss.createPortal(l.jsxs("div",{className:"session-capability-dialog-layer",children:[l.jsx("button",{type:"button",className:"session-capability-dialog-scrim","aria-label":"关闭弹窗",onClick:s}),l.jsxs("section",{className:`session-capability-dialog${r?" is-wide":""}`,role:"dialog","aria-modal":"true","aria-labelledby":a.current,children:[l.jsxs("header",{className:`session-capability-dialog-head${n?"":" is-iconless"}`,children:[n&&l.jsx("span",{className:"session-capability-dialog-mark",children:n}),l.jsxs("div",{children:[l.jsx("h2",{id:a.current,children:e}),l.jsx("p",{children:t})]}),l.jsx("button",{type:"button",className:"session-capability-dialog-close","aria-label":`关闭${e}`,onClick:s,children:l.jsx(wV,{})})]}),i]})]}),document.body)}function Tp({value:e,placeholder:t,label:n,onChange:r,autoFocus:s=!1}){return l.jsxs("label",{className:"session-capability-search",children:[l.jsx(vV,{}),l.jsx("input",{value:e,"aria-label":n,placeholder:t,autoFocus:s,onChange:i=>r(i.target.value)})]})}function _V({agentName:e,tools:t,selectedNames:n,mutating:r,onAdd:s,onClose:i}){const[a,o]=w.useState(""),[c,u]=w.useState(""),d=w.useMemo(()=>new Set(n),[n]),f=w.useMemo(()=>{const p=a.trim().toLowerCase();return t.filter(m=>p?`${nE(m)} ${m} ${SS(m)}`.toLowerCase().includes(p):!0)},[a,t]),h=async p=>{u(p);const m=await s({kind:"tool",name:p});u(""),m&&i()};return l.jsx(AM,{title:"添加内置工具",description:`添加后仅对 ${e} 的当前会话生效`,icon:l.jsx(Q1,{}),onClose:i,children:l.jsxs("div",{className:"session-tool-dialog-body",children:[l.jsx(Tp,{value:a,label:"搜索内置工具",placeholder:"搜索中文名称或工具标识",onChange:o,autoFocus:!0}),l.jsx("div",{className:"session-tool-picker",role:"list","aria-label":"可用内置工具",children:f.length===0?l.jsx("div",{className:"session-capability-empty",children:"没有匹配的内置工具"}):f.map(p=>{const m=d.has(p),y=c===p;return l.jsxs("article",{className:"session-tool-option",role:"listitem",children:[l.jsx("span",{className:"session-tool-option-icon",children:l.jsx(Q1,{})}),l.jsxs("span",{className:"session-tool-option-copy",children:[l.jsx("strong",{children:nE(p)}),l.jsx("code",{children:p}),l.jsx("span",{children:SS(p)})]}),l.jsx("button",{type:"button",disabled:m||r||!!c,onClick:()=>void h(p),children:m?"已添加":y?"添加中…":"添加"})]},p)})})]})})}function kV({appName:e,agentName:t,selectedNames:n,mutating:r,onAdd:s,onClose:i}){const[a,o]=w.useState("public"),[c,u]=w.useState(""),[d,f]=w.useState([]),[h,p]=w.useState(0),[m,y]=w.useState(!0),[E,g]=w.useState(""),[x,b]=w.useState([]),[_,k]=w.useState(null),[N,C]=w.useState([]),[S,A]=w.useState(""),[O,D]=w.useState(""),[U,X]=w.useState(!0),[M,j]=w.useState(!1),[T,L]=w.useState(""),[R,F]=w.useState(""),I=w.useMemo(()=>new Set(n),[n]);w.useEffect(()=>{if(a!=="public")return;let G=!0;const re=window.setTimeout(()=>{y(!0),g(""),QL(e,c.trim()).then(ue=>{G&&(f(ue.items),p(ue.totalCount))}).catch(ue=>{G&&(f([]),p(0),g(ue instanceof Error?ue.message:"搜索 Skill Hub 失败"))}).finally(()=>{G&&y(!1)})},250);return()=>{G=!1,window.clearTimeout(re)}},[e,c,a]),w.useEffect(()=>{if(a!=="agentkit")return;let G=!0;return X(!0),L(""),NM().then(re=>{G&&(b(re),k(re[0]??null))}).catch(re=>{G&&L(re instanceof Error?re.message:"读取 Skill Space 失败")}).finally(()=>{G&&X(!1)}),()=>{G=!1}},[a]),w.useEffect(()=>{if(a!=="agentkit")return;if(!_){C([]);return}let G=!0;return j(!0),L(""),SM(_.id,_.region).then(re=>{G&&C(re)}).catch(re=>{G&&L(re instanceof Error?re.message:"读取技能失败")}).finally(()=>{G&&j(!1)}),()=>{G=!1}},[_,a]);const V=w.useMemo(()=>{const G=S.trim().toLowerCase();return G?x.filter(re=>`${re.name} ${re.id} ${re.description}`.toLowerCase().includes(G)):x},[S,x]),W=w.useMemo(()=>{const G=O.trim().toLowerCase();return G?N.filter(re=>`${re.skillName} ${re.skillDescription}`.toLowerCase().includes(G)):N},[O,N]),P=async G=>{if(!_)return;F(G.skillId);const re=await s({kind:"skill",name:G.skillName,skillSourceId:_.id,description:G.skillDescription,version:G.version});F(""),re&&i()},ie=async G=>{F(G.slug);const re=await s({kind:"skill",name:G.name,skillSourceId:`findskill:${G.slug}`,description:G.description,version:G.version||G.updatedAt});F(""),re&&i()};return l.jsx(AM,{title:"添加技能",description:`从公域 Skill Hub 或 AgentKit Skill 中心添加到 ${t} 当前会话`,wide:!0,onClose:i,children:l.jsxs("div",{className:"session-skill-dialog-body",children:[l.jsxs("div",{className:"session-skill-source-tabs",role:"tablist","aria-label":"技能来源",children:[l.jsxs("button",{type:"button",role:"tab","aria-selected":a==="public",className:a==="public"?"is-active":"",onClick:()=>o("public"),children:["Skill Hub",l.jsx("span",{children:"公域"})]}),l.jsx("button",{type:"button",role:"tab","aria-selected":a==="agentkit",className:a==="agentkit"?"is-active":"",onClick:()=>o("agentkit"),children:"AgentKit Skill 中心"})]}),a==="public"?l.jsxs("section",{className:"session-public-skill-browser","aria-label":"Skill Hub 公域技能",children:[l.jsxs("div",{className:"session-public-skill-head",children:[l.jsx(Tp,{value:c,label:"搜索 Skill Hub",placeholder:"搜索技能名称、用途或关键词",onChange:u,autoFocus:!0}),l.jsxs("span",{children:[h.toLocaleString()," 个公域技能"]})]}),l.jsx("div",{className:"session-public-skill-list",children:E?l.jsx("div",{className:"session-capability-error",children:E}):m?l.jsx("div",{className:"session-capability-loading",children:"正在搜索 Skill Hub…"}):d.length===0?l.jsx("div",{className:"session-capability-empty",children:"没有匹配的公域技能"}):d.map(G=>{const re=I.has(G.name),ue=R===G.slug;return l.jsxs("article",{className:"session-skill-option session-public-skill-option",children:[l.jsxs("span",{className:"session-skill-option-copy",children:[l.jsx("strong",{children:G.name}),l.jsx("span",{children:G.description||"暂无描述"}),l.jsxs("small",{children:[G.sourceRepo||G.sourceType||"FindSkill",l.jsx("span",{"aria-hidden":"true",children:" · "}),G.downloadCount.toLocaleString()," 次下载",G.evaluationScore>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{"aria-hidden":"true",children:" · "}),G.evaluationScore.toFixed(1)," 分"]})]})]}),l.jsx("button",{type:"button",disabled:re||r||!!R,onClick:()=>void ie(G),children:re?"已添加":ue?"添加中…":l.jsxs(l.Fragment,{children:[l.jsx(TS,{}),"添加"]})})]},G.slug)})})]}):l.jsxs("div",{className:"session-skill-browser",children:[l.jsxs("section",{className:"session-skill-spaces","aria-label":"Skill Space 列表",children:[l.jsxs("div",{className:"session-skill-pane-head",children:[l.jsxs("div",{children:[l.jsx("strong",{children:"Skill Space"}),l.jsx("span",{children:x.length})]}),l.jsx(Tp,{value:S,label:"搜索 Skill Space",placeholder:"搜索空间",onChange:A,autoFocus:!0})]}),l.jsx("div",{className:"session-skill-pane-list",children:U?l.jsx("div",{className:"session-capability-loading",children:"正在读取 Skill Space…"}):V.length===0?l.jsx("div",{className:"session-capability-empty",children:"没有匹配的 Skill Space"}):V.map(G=>l.jsx("button",{type:"button",className:`session-skill-space${(_==null?void 0:_.id)===G.id?" is-active":""}`,onClick:()=>{k(G),D("")},children:l.jsxs("span",{children:[l.jsx("strong",{children:G.name||G.id}),l.jsx("small",{children:G.description||G.id}),l.jsxs("em",{children:[G.skillCount??0," 个技能"]})]})},`${G.projectName??"default"}:${G.id}`))})]}),l.jsxs("section",{className:"session-skill-results","aria-label":"AgentKit Skill 列表",children:[l.jsxs("div",{className:"session-skill-pane-head",children:[l.jsxs("div",{children:[l.jsx("strong",{title:_==null?void 0:_.name,children:(_==null?void 0:_.name)||"选择 Skill Space"}),l.jsx("span",{children:N.length})]}),l.jsx(Tp,{value:O,label:"搜索 AgentKit 技能",placeholder:"搜索技能名称或描述",onChange:D})]}),l.jsx("div",{className:"session-skill-pane-list",children:T?l.jsx("div",{className:"session-capability-error",children:T}):_?M?l.jsx("div",{className:"session-capability-loading",children:"正在读取技能…"}):W.length===0?l.jsx("div",{className:"session-capability-empty",children:"没有匹配的技能"}):W.map(G=>{const re=I.has(G.skillName),ue=R===G.skillId;return l.jsxs("article",{className:"session-skill-option",children:[l.jsxs("span",{className:"session-skill-option-copy",children:[l.jsx("strong",{children:G.skillName}),l.jsx("span",{children:G.skillDescription||"暂无描述"}),l.jsxs("small",{children:["版本 ",G.version||"—"]})]}),l.jsx("button",{type:"button",disabled:re||r||!!R,onClick:()=>void P(G),children:re?"已添加":ue?"添加中…":l.jsxs(l.Fragment,{children:[l.jsx(TS,{}),"添加"]})})]},`${G.skillId}:${G.version}`)}):l.jsx("div",{className:"session-capability-empty",children:"选择一个 Skill Space 查看技能"})})]})]})]})})}function ta({as:e="span",className:t="",duration:n=4,spread:r=20,children:s,style:i,...a}){const o=Math.min(Math.max(r,5),45);return l.jsx(e,{className:`text-shimmer${t?` ${t}`:""}`,style:{...i,backgroundImage:`linear-gradient(to right, hsl(var(--muted-foreground)) ${50-o}%, hsl(var(--foreground)) 50%, hsl(var(--muted-foreground)) ${50+o}%)`,animationDuration:`${n}s`},...a,children:s})}const NV={llm:"LLM",sequential:"顺序",parallel:"并行",loop:"循环",a2a:"A2A"};function CM(e){return 1+e.children.reduce((t,n)=>t+CM(n),0)}function kc(e){return e.id||e.name}function SV(e,t){const n=kc(e);if(e.id&&e.name&&e.name!==n)return e.name;if(t&&n==="agent")return"主 Agent";const r=/^agent_sub_(\d+)$/.exec(n);return r?`子 Agent ${r[1]}`:e.name||n}function IM(e,t=!0){return{...e,id:kc(e),name:SV(e,t),children:e.children.map(n=>IM(n,!1))}}function OM(e,t){t.set(kc(e),e.name||kc(e)),e.children.forEach(n=>OM(n,t))}function TV(e){return[...new Set(e.map(t=>t.trim()).filter(Boolean))]}function AV(e){return[...new Map(e.filter(t=>t.name.trim()).map(t=>[t.name.trim(),{...t,name:t.name.trim()}])).values()]}function RM({node:e,activeAgent:t,seen:n,path:r}){const s=kc(e),i=!!s&&s===t,a=!!s&&!i&&r.has(s),o=!!s&&!i&&!a&&n.has(s);return l.jsxs("div",{className:"topo-branch",children:[l.jsxs("div",{className:`topo-node topo-type-${e.type} ${i?"is-active":""} ${a?"is-onpath":""} ${o?"is-done":""}`,title:e.description||e.name,children:[l.jsx(wc,{className:"topo-icon"}),l.jsx("span",{className:"topo-name",children:e.name||"未命名 Agent"}),l.jsx("span",{className:"topo-badge",children:NV[e.type]??"Agent"})]}),i&&e.type==="a2a"&&l.jsx("div",{className:"topo-remote",children:"远程执行中…"}),e.children.length>0&&l.jsx("div",{className:"topo-children",children:e.children.map(c=>l.jsx(RM,{node:c,activeAgent:t,seen:n,path:r},kc(c)))})]})}function wy({title:e,count:t}){return l.jsxs("div",{className:"topo-module-title",children:[l.jsx("span",{className:"topo-module-label",title:e,children:e}),t!==void 0&&l.jsx("span",{className:"topo-section-count","aria-label":`${t} 项`,children:t})]})}function LM({appName:e,info:t,loading:n,activeAgent:r,seenAgents:s,execPath:i=[],variant:a="rail",capabilities:o=null,capabilityLoading:c=!1,capabilityMutating:u=!1,builtinTools:d=[],onAddCapability:f,onRemoveCapability:h}){const[p,m]=w.useState(null);if(n&&!t)return l.jsx("aside",{className:`topo is-loading${a==="drawer"?" is-drawer":""}`,"aria-label":"Agent 信息","aria-live":"polite",children:l.jsx(ta,{as:"span",className:"topo-loading-label",duration:2.2,children:"正在读取 Agent 信息…"})});if(!t)return null;const y=IM(t.graph??{id:t.name,name:t.name,description:t.description,type:t.type??"llm",model:t.model,tools:t.tools,skills:t.skills,path:[t.name],mentionable:!1,children:[]}),E=(o==null?void 0:o.tools)??TV(t.tools).map(k=>({id:`base:tool:${k}`,kind:"tool",name:k,custom:!1})),g=(o==null?void 0:o.skills)??AV(t.skills).map(k=>({id:`base:skill:${k.name}`,kind:"skill",name:k.name,description:k.description,custom:!1})),x=!!(o&&f&&h),b=new Set(i),_=new Map;return OM(y,_),l.jsxs("aside",{className:`topo${a==="drawer"?" is-drawer":""}`,"aria-label":"Agent 信息与拓扑",children:[l.jsxs("section",{className:"topo-agent-card","aria-label":"Agent 信息",children:[l.jsxs("div",{className:"topo-agent-heading",children:[l.jsx("h2",{title:t.name,children:t.name||"未命名 Agent"}),t.model&&l.jsx("span",{title:t.model,children:t.model})]}),t.description&&l.jsx("p",{className:"topo-description",title:t.description,children:t.description})]}),l.jsxs("div",{className:"topo-module-stack",children:[l.jsxs("section",{className:"topo-module-card topo-tools-card","aria-label":"工具",children:[l.jsx(wy,{title:"工具",count:E.length}),l.jsx("div",{className:"topo-module-scroll topo-tools-scroll",role:"region","aria-label":"工具列表",tabIndex:0,children:E.length>0?l.jsx("div",{className:"topo-tool-list",children:E.map(k=>l.jsxs("div",{className:"topo-tool",title:k.name,children:[l.jsxs("span",{className:"topo-capability-title",children:[l.jsxs("span",{className:"topo-capability-copy",children:[l.jsx("span",{className:"topo-capability-name",children:nE(k.name)}),l.jsx("code",{children:k.name})]}),k.custom&&l.jsx("span",{className:"topo-custom-badge",children:"自定义"})]}),k.custom&&l.jsx("button",{type:"button",className:"topo-remove-capability","aria-label":`移除工具 ${k.name}`,title:"移除",disabled:u,onClick:()=>h==null?void 0:h(k.id),children:"×"})]},k.id))}):l.jsx("div",{className:"topo-empty",children:"未配置"})}),x&&l.jsx("div",{className:"topo-capability-add-dock",children:l.jsxs("button",{type:"button",className:"topo-capability-add-slot","aria-label":"添加内置工具",disabled:c||u,onClick:()=>m("tool"),children:[l.jsx("span",{"aria-hidden":"true",children:"+"}),l.jsx("span",{children:"在此对话中添加工具"})]})})]}),l.jsxs("section",{className:"topo-module-card topo-skills-card","aria-label":"技能",children:[l.jsx(wy,{title:"技能",count:t.skillsPreviewSupported?g.length:void 0}),l.jsx("div",{className:"topo-module-scroll topo-skills-scroll",role:"region","aria-label":"技能列表",tabIndex:0,children:t.skillsPreviewSupported?g.length>0?l.jsx("div",{className:"topo-skill-list",children:g.map(k=>l.jsxs("div",{className:"topo-skill",title:k.description||k.name,children:[l.jsxs("div",{className:"topo-skill-title",children:[l.jsx("span",{className:"topo-skill-name",children:k.name}),k.custom&&l.jsx("span",{className:"topo-custom-badge",children:"自定义"}),k.custom&&l.jsx("button",{type:"button",className:"topo-remove-capability","aria-label":`移除技能 ${k.name}`,title:"移除",disabled:u,onClick:()=>h==null?void 0:h(k.id),children:"×"})]}),k.description&&l.jsx("span",{className:"topo-skill-description",children:k.description})]},`${k.name}:${k.description}`))}):l.jsx("div",{className:"topo-empty",children:"未配置"}):l.jsx("div",{className:"topo-empty",children:"暂不支持预览"})}),x&&l.jsx("div",{className:"topo-capability-add-dock",children:l.jsxs("button",{type:"button",className:"topo-capability-add-slot","aria-label":"添加技能",disabled:c||u,onClick:()=>m("skill"),children:[l.jsx("span",{"aria-hidden":"true",children:"+"}),l.jsx("span",{children:"在此对话中添加技能"})]})})]}),l.jsxs("section",{className:"topo-module-card topo-topology","aria-label":"Agent 拓扑",children:[l.jsx(wy,{title:"拓扑",count:CM(y)}),l.jsxs("div",{className:"topo-module-scroll topo-topology-scroll",role:"region","aria-label":"Agent 拓扑列表",tabIndex:0,children:[i.length>1&&l.jsx("div",{className:"topo-path","aria-label":"执行路径",children:i.map((k,N)=>l.jsx("span",{className:"topo-path-seg",children:l.jsx("span",{className:N===i.length-1?"topo-path-name is-current":"topo-path-name",children:_.get(k)??k})},`${k}-${N}`))}),l.jsx("div",{className:"topo-tree",children:l.jsx(RM,{node:y,activeAgent:r,seen:s,path:b})})]})]})]}),p==="tool"&&f&&l.jsx(_V,{agentName:t.name,tools:d,selectedNames:E.map(k=>k.name),mutating:u,onAdd:f,onClose:()=>m(null)}),p==="skill"&&f&&l.jsx(kV,{appName:e,agentName:t.name,selectedNames:g.map(k=>k.name),mutating:u,onAdd:f,onClose:()=>m(null)})]})}function CV(){return l.jsx("svg",{className:"icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round","aria-hidden":"true",children:l.jsx("path",{d:"M6 6l12 12M18 6 6 18"})})}function IV({appName:e,info:t,loading:n,activeAgent:r,seenAgents:s,execPath:i,capabilities:a,capabilityLoading:o,capabilityMutating:c,builtinTools:u,onAddCapability:d,onRemoveCapability:f,onClose:h,returnFocusRef:p}){return w.useEffect(()=>{const m=document.body.style.overflow;document.body.style.overflow="hidden";const y=E=>{E.key==="Escape"&&h()};return document.addEventListener("keydown",y),()=>{var E;document.removeEventListener("keydown",y),document.body.style.overflow=m,(E=p.current)==null||E.focus()}},[h,p]),l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"drawer-scrim agent-info-scrim",onClick:h}),l.jsxs("aside",{className:"drawer drawer--agent-info",role:"dialog","aria-modal":"true","aria-labelledby":"agent-info-drawer-title",children:[l.jsxs("header",{className:"drawer-head",children:[l.jsxs("div",{children:[l.jsx("div",{id:"agent-info-drawer-title",className:"drawer-title",children:"Agent 信息"}),l.jsx("div",{className:"drawer-sub",children:"能力与协作拓扑"})]}),l.jsx("button",{type:"button",className:"drawer-close",onClick:h,"aria-label":"关闭 Agent 信息",autoFocus:!0,children:l.jsx(CV,{})})]}),l.jsx("div",{className:"agent-info-drawer-body",children:t||n?l.jsx(LM,{appName:e,info:t,loading:n,activeAgent:r,seenAgents:s,execPath:i,capabilities:a,capabilityLoading:o,capabilityMutating:c,builtinTools:u,onAddCapability:d,onRemoveCapability:f,variant:"drawer"}):l.jsx("div",{className:"drawer-empty",children:"暂时无法读取 Agent 信息。"})})]})]})}function zye(){}function AS(e){const t=[],n=String(e||"");let r=n.indexOf(","),s=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const a=n.slice(s,r).trim();(a||!i)&&t.push(a),s=r+1,r=n.indexOf(",",s)}return t}function MM(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const OV=/[$_\p{ID_Start}]/u,RV=/[$_\u{200C}\u{200D}\p{ID_Continue}]/u,LV=/[-$_\u{200C}\u{200D}\p{ID_Continue}]/u,MV=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,jV=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,jM={};function Vye(e){return e?OV.test(String.fromCodePoint(e)):!1}function Kye(e,t){const r=(t||jM).jsx?LV:RV;return e?r.test(String.fromCodePoint(e)):!1}function CS(e,t){return(jM.jsx?jV:MV).test(e)}const DV=/[ \t\n\f\r]/g;function PV(e){return typeof e=="object"?e.type==="text"?IS(e.value):!1:IS(e)}function IS(e){return e.replace(DV,"")===""}let Tf=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};Tf.prototype.normal={};Tf.prototype.property={};Tf.prototype.space=void 0;function DM(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new Tf(n,r,t)}function Xd(e){return e.toLowerCase()}class Vr{constructor(t,n){this.attribute=n,this.property=t}}Vr.prototype.attribute="";Vr.prototype.booleanish=!1;Vr.prototype.boolean=!1;Vr.prototype.commaOrSpaceSeparated=!1;Vr.prototype.commaSeparated=!1;Vr.prototype.defined=!1;Vr.prototype.mustUseProperty=!1;Vr.prototype.number=!1;Vr.prototype.overloadedBoolean=!1;Vr.prototype.property="";Vr.prototype.spaceSeparated=!1;Vr.prototype.space=void 0;let BV=0;const lt=Xo(),On=Xo(),rE=Xo(),Ce=Xo(),Ut=Xo(),rc=Xo(),qr=Xo();function Xo(){return 2**++BV}const sE=Object.freeze(Object.defineProperty({__proto__:null,boolean:lt,booleanish:On,commaOrSpaceSeparated:qr,commaSeparated:rc,number:Ce,overloadedBoolean:rE,spaceSeparated:Ut},Symbol.toStringTag,{value:"Module"})),vy=Object.keys(sE);class Vw extends Vr{constructor(t,n,r,s){let i=-1;if(super(t,n),OS(this,"space",s),typeof r=="number")for(;++i4&&n.slice(0,4)==="data"&&zV.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(RS,KV);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!RS.test(i)){let a=i.replace(HV,VV);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}s=Vw}return new s(r,t)}function VV(e){return"-"+e.toLowerCase()}function KV(e){return e.charAt(1).toUpperCase()}const Af=DM([PM,FV,UM,$M,HM],"html"),Wa=DM([PM,UV,UM,$M,HM],"svg");function LS(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function zM(e){return e.join(" ").trim()}var Kw={},MS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,YV=/\n/g,WV=/^\s*/,GV=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,qV=/^:\s*/,XV=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,QV=/^[;\s]*/,ZV=/^\s+|\s+$/g,JV=` -`,jS="/",DS="*",po="",eK="comment",tK="declaration";function nK(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function s(m){var y=m.match(YV);y&&(n+=y.length);var E=m.lastIndexOf(JV);r=~E?m.length-E:r+m.length}function i(){var m={line:n,column:r};return function(y){return y.position=new a(m),u(),y}}function a(m){this.start=m,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function o(m){var y=new Error(t.source+":"+n+":"+r+": "+m);if(y.reason=m,y.filename=t.source,y.line=n,y.column=r,y.source=e,!t.silent)throw y}function c(m){var y=m.exec(e);if(y){var E=y[0];return s(E),e=e.slice(E.length),y}}function u(){c(WV)}function d(m){var y;for(m=m||[];y=f();)y!==!1&&m.push(y);return m}function f(){var m=i();if(!(jS!=e.charAt(0)||DS!=e.charAt(1))){for(var y=2;po!=e.charAt(y)&&(DS!=e.charAt(y)||jS!=e.charAt(y+1));)++y;if(y+=2,po===e.charAt(y-1))return o("End of comment missing");var E=e.slice(2,y-2);return r+=2,s(E),e=e.slice(y),r+=2,m({type:eK,comment:E})}}function h(){var m=i(),y=c(GV);if(y){if(f(),!c(qV))return o("property missing ':'");var E=c(XV),g=m({type:tK,property:PS(y[0].replace(MS,po)),value:E?PS(E[0].replace(MS,po)):po});return c(QV),g}}function p(){var m=[];d(m);for(var y;y=h();)y!==!1&&(m.push(y),d(m));return m}return u(),p()}function PS(e){return e?e.replace(ZV,po):po}var rK=nK,sK=Hp&&Hp.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Kw,"__esModule",{value:!0});Kw.default=aK;const iK=sK(rK);function aK(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,iK.default)(e),s=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:a,value:o}=i;s?t(a,o,i):o&&(n=n||{},n[a]=o)}),n}var Dg={};Object.defineProperty(Dg,"__esModule",{value:!0});Dg.camelCase=void 0;var oK=/^--[a-zA-Z0-9_-]+$/,lK=/-([a-z])/g,cK=/^[^-]+$/,uK=/^-(webkit|moz|ms|o|khtml)-/,dK=/^-(ms)-/,fK=function(e){return!e||cK.test(e)||oK.test(e)},hK=function(e,t){return t.toUpperCase()},BS=function(e,t){return"".concat(t,"-")},pK=function(e,t){return t===void 0&&(t={}),fK(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(dK,BS):e=e.replace(uK,BS),e.replace(lK,hK))};Dg.camelCase=pK;var mK=Hp&&Hp.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},gK=mK(Kw),yK=Dg;function iE(e,t){var n={};return!e||typeof e!="string"||(0,gK.default)(e,function(r,s){r&&s&&(n[(0,yK.camelCase)(r,t)]=s)}),n}iE.default=iE;var bK=iE;const EK=mf(bK),Pg=VM("end"),_i=VM("start");function VM(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 xK(e){const t=_i(e),n=Pg(e);if(t&&n)return{start:t,end:n}}function ud(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?FS(e.position):"start"in e||"end"in e?FS(e):"line"in e||"column"in e?aE(e):""}function aE(e){return US(e&&e.line)+":"+US(e&&e.column)}function FS(e){return aE(e&&e.start)+"-"+aE(e&&e.end)}function US(e){return e&&typeof e=="number"?e:1}class yr extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},a=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?s=t:!i.cause&&t&&(a=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=o?o.line:void 0,this.name=ud(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}yr.prototype.file="";yr.prototype.name="";yr.prototype.reason="";yr.prototype.message="";yr.prototype.stack="";yr.prototype.column=void 0;yr.prototype.line=void 0;yr.prototype.ancestors=void 0;yr.prototype.cause=void 0;yr.prototype.fatal=void 0;yr.prototype.place=void 0;yr.prototype.ruleId=void 0;yr.prototype.source=void 0;const Yw={}.hasOwnProperty,wK=new Map,vK=/[A-Z]/g,_K=new Set(["table","tbody","thead","tfoot","tr"]),kK=new Set(["td","th"]),KM="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function NK(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=LK(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=RK(n,t.jsx,t.jsxs)}const s={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"?Wa:Af,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=YM(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function YM(e,t,n){if(t.type==="element")return SK(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return TK(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return CK(e,t,n);if(t.type==="mdxjsEsm")return AK(e,t);if(t.type==="root")return IK(e,t,n);if(t.type==="text")return OK(e,t)}function SK(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Wa,e.schema=s),e.ancestors.push(t);const i=GM(e,t.tagName,!1),a=MK(e,t);let o=Gw(e,t);return _K.has(t.tagName)&&(o=o.filter(function(c){return typeof c=="string"?!PV(c):!0})),WM(e,a,i,t),Ww(a,o),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function TK(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)}Qd(e,t.position)}function AK(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Qd(e,t.position)}function CK(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=Wa,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:GM(e,t.name,!0),a=jK(e,t),o=Gw(e,t);return WM(e,a,i,t),Ww(a,o),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function IK(e,t,n){const r={};return Ww(r,Gw(e,t)),e.create(t,e.Fragment,r,n)}function OK(e,t){return t.value}function WM(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Ww(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function RK(e,t,n){return r;function r(s,i,a,o){const u=Array.isArray(a.children)?n:t;return o?u(i,a,o):u(i,a)}}function LK(e,t){return n;function n(r,s,i,a){const o=Array.isArray(i.children),c=_i(r);return t(s,i,a,o,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function MK(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&Yw.call(t.properties,s)){const i=DK(e,s,t.properties[s]);if(i){const[a,o]=i;e.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&kK.has(t.tagName)?r=o:n[a]=o}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function jK(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const a=i.expression;a.type;const o=a.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else Qd(e,t.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,i=e.evaluater.evaluateExpression(o.expression)}else Qd(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function Gw(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:wK;for(;++rs?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);i0?(ts(e,e.length,0,t),e):t}const zS={}.hasOwnProperty;function XM(e){const t={};let n=-1;for(;++n13&&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 Xs(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Nr=Ga(/[A-Za-z]/),pr=Ga(/[\dA-Za-z]/),KK=Ga(/[#-'*+\--9=?A-Z^-~]/);function Am(e){return e!==null&&(e<32||e===127)}const oE=Ga(/\d/),YK=Ga(/[\dA-Fa-f]/),WK=Ga(/[!-/:-@[-`{-~]/);function qe(e){return e!==null&&e<-2}function Dt(e){return e!==null&&(e<0||e===32)}function yt(e){return e===-2||e===-1||e===32}const Bg=Ga(new RegExp("\\p{P}|\\p{S}","u")),Uo=Ga(/\s/);function Ga(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function qc(e){const t=[];let n=-1,r=0,s=0;for(;++n55295&&i<57344){const o=e.charCodeAt(n+1);i<56320&&o>56319&&o<57344?(a=String.fromCharCode(i,o),s=1):a="�"}else a=String.fromCharCode(i);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+s+1,a=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function _t(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(c){return yt(c)?(e.enter(n),o(c)):t(c)}function o(c){return yt(c)&&i++a))return;const C=t.events.length;let S=C,A,O;for(;S--;)if(t.events[S][0]==="exit"&&t.events[S][1].type==="chunkFlow"){if(A){O=t.events[S][1].end;break}A=!0}for(g(r),N=C;Nb;){const k=n[_];t.containerState=k[1],k[0].exit.call(t,e)}n.length=b}function x(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function ZK(e,t,n){return _t(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Nc(e){if(e===null||Dt(e)||Uo(e))return 1;if(Bg(e))return 2}function Fg(e,t,n){const r=[];let s=-1;for(;++s1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[r][1].end},h={...e[n][1].start};KS(f,-c),KS(h,c),a={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},o={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},i={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},e[r][1].end={...a.start},e[n][1].start={...o.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=ys(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=ys(u,[["enter",s,t],["enter",a,t],["exit",a,t],["enter",i,t]]),u=ys(u,Fg(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=ys(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=ys(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,ts(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n0&&yt(N)?_t(e,x,"linePrefix",i+1)(N):x(N)}function x(N){return N===null||qe(N)?e.check(YS,y,_)(N):(e.enter("codeFlowValue"),b(N))}function b(N){return N===null||qe(N)?(e.exit("codeFlowValue"),x(N)):(e.consume(N),b)}function _(N){return e.exit("codeFenced"),t(N)}function k(N,C,S){let A=0;return O;function O(j){return N.enter("lineEnding"),N.consume(j),N.exit("lineEnding"),D}function D(j){return N.enter("codeFencedFence"),yt(j)?_t(N,U,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):U(j)}function U(j){return j===o?(N.enter("codeFencedFenceSequence"),X(j)):S(j)}function X(j){return j===o?(A++,N.consume(j),X):A>=a?(N.exit("codeFencedFenceSequence"),yt(j)?_t(N,M,"whitespace")(j):M(j)):S(j)}function M(j){return j===null||qe(j)?(N.exit("codeFencedFence"),C(j)):S(j)}}}function uY(e,t,n){const r=this;return s;function s(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const ky={name:"codeIndented",tokenize:fY},dY={partial:!0,tokenize:hY};function fY(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),_t(e,i,"linePrefix",5)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?a(u):n(u)}function a(u){return u===null?c(u):qe(u)?e.attempt(dY,a,c)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||qe(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),o)}function c(u){return e.exit("codeIndented"),t(u)}}function hY(e,t,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):qe(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):_t(e,i,"linePrefix",5)(a)}function i(a){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(a):qe(a)?s(a):n(a)}}const pY={name:"codeText",previous:gY,resolve:mY,tokenize:yY};function mY(e){let t=e.length-4,n=3,r,s;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=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 tthis.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 s=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&xu(this.left,r),i.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),xu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),xu(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=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function n3(e,t,n,r,s,i,a,o,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(g){return g===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(g),e.exit(i),h):g===null||g===32||g===41||Am(g)?n(g):(e.enter(r),e.enter(a),e.enter(o),e.enter("chunkString",{contentType:"string"}),y(g))}function h(g){return g===62?(e.enter(i),e.consume(g),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===62?(e.exit("chunkString"),e.exit(o),h(g)):g===null||g===60||qe(g)?n(g):(e.consume(g),g===92?m:p)}function m(g){return g===60||g===62||g===92?(e.consume(g),p):p(g)}function y(g){return!d&&(g===null||g===41||Dt(g))?(e.exit("chunkString"),e.exit(o),e.exit(a),e.exit(r),t(g)):d999||p===null||p===91||p===93&&!c||p===94&&!o&&"_hiddenFootnoteSupport"in a.parser.constructs?n(p):p===93?(e.exit(i),e.enter(s),e.consume(p),e.exit(s),e.exit(r),t):qe(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||qe(p)||o++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!yt(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),o++,f):f(p)}}function s3(e,t,n,r,s,i){let a;return o;function o(h){return h===34||h===39||h===40?(e.enter(r),e.enter(s),e.consume(h),e.exit(s),a=h===40?41:h,c):n(h)}function c(h){return h===a?(e.enter(s),e.consume(h),e.exit(s),e.exit(r),t):(e.enter(i),u(h))}function u(h){return h===a?(e.exit(i),c(a)):h===null?n(h):qe(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),_t(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===a||h===null||qe(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?f:d)}function f(h){return h===a||h===92?(e.consume(h),d):d(h)}}function dd(e,t){let n;return r;function r(s){return qe(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):yt(s)?_t(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const NY={name:"definition",tokenize:TY},SY={partial:!0,tokenize:AY};function TY(e,t,n){const r=this;let s;return i;function i(p){return e.enter("definition"),a(p)}function a(p){return r3.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function o(p){return s=Xs(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),c):n(p)}function c(p){return Dt(p)?dd(e,u)(p):u(p)}function u(p){return n3(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(SY,f,f)(p)}function f(p){return yt(p)?_t(e,h,"whitespace")(p):h(p)}function h(p){return p===null||qe(p)?(e.exit("definition"),r.parser.defined.push(s),t(p)):n(p)}}function AY(e,t,n){return r;function r(o){return Dt(o)?dd(e,s)(o):n(o)}function s(o){return s3(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return yt(o)?_t(e,a,"whitespace")(o):a(o)}function a(o){return o===null||qe(o)?t(o):n(o)}}const CY={name:"hardBreakEscape",tokenize:IY};function IY(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return qe(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const OY={name:"headingAtx",resolve:RY,tokenize:LY};function RY(e,t){let n=e.length-2,r=3,s,i;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&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},ts(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function LY(e,t,n){let r=0;return s;function s(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&r++<6?(e.consume(d),a):d===null||Dt(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||qe(d)?(e.exit("atxHeading"),t(d)):yt(d)?_t(e,o,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),o(d))}function u(d){return d===null||d===35||Dt(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),u)}}const MY=["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"],GS=["pre","script","style","textarea"],jY={concrete:!0,name:"htmlFlow",resolveTo:BY,tokenize:FY},DY={partial:!0,tokenize:$Y},PY={partial:!0,tokenize:UY};function BY(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 FY(e,t,n){const r=this;let s,i,a,o,c;return u;function u(P){return d(P)}function d(P){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(P),f}function f(P){return P===33?(e.consume(P),h):P===47?(e.consume(P),i=!0,y):P===63?(e.consume(P),s=3,r.interrupt?t:I):Nr(P)?(e.consume(P),a=String.fromCharCode(P),E):n(P)}function h(P){return P===45?(e.consume(P),s=2,p):P===91?(e.consume(P),s=5,o=0,m):Nr(P)?(e.consume(P),s=4,r.interrupt?t:I):n(P)}function p(P){return P===45?(e.consume(P),r.interrupt?t:I):n(P)}function m(P){const ie="CDATA[";return P===ie.charCodeAt(o++)?(e.consume(P),o===ie.length?r.interrupt?t:U:m):n(P)}function y(P){return Nr(P)?(e.consume(P),a=String.fromCharCode(P),E):n(P)}function E(P){if(P===null||P===47||P===62||Dt(P)){const ie=P===47,G=a.toLowerCase();return!ie&&!i&&GS.includes(G)?(s=1,r.interrupt?t(P):U(P)):MY.includes(a.toLowerCase())?(s=6,ie?(e.consume(P),g):r.interrupt?t(P):U(P)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(P):i?x(P):b(P))}return P===45||pr(P)?(e.consume(P),a+=String.fromCharCode(P),E):n(P)}function g(P){return P===62?(e.consume(P),r.interrupt?t:U):n(P)}function x(P){return yt(P)?(e.consume(P),x):O(P)}function b(P){return P===47?(e.consume(P),O):P===58||P===95||Nr(P)?(e.consume(P),_):yt(P)?(e.consume(P),b):O(P)}function _(P){return P===45||P===46||P===58||P===95||pr(P)?(e.consume(P),_):k(P)}function k(P){return P===61?(e.consume(P),N):yt(P)?(e.consume(P),k):b(P)}function N(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(e.consume(P),c=P,C):yt(P)?(e.consume(P),N):S(P)}function C(P){return P===c?(e.consume(P),c=null,A):P===null||qe(P)?n(P):(e.consume(P),C)}function S(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||Dt(P)?k(P):(e.consume(P),S)}function A(P){return P===47||P===62||yt(P)?b(P):n(P)}function O(P){return P===62?(e.consume(P),D):n(P)}function D(P){return P===null||qe(P)?U(P):yt(P)?(e.consume(P),D):n(P)}function U(P){return P===45&&s===2?(e.consume(P),T):P===60&&s===1?(e.consume(P),L):P===62&&s===4?(e.consume(P),V):P===63&&s===3?(e.consume(P),I):P===93&&s===5?(e.consume(P),F):qe(P)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(DY,W,X)(P)):P===null||qe(P)?(e.exit("htmlFlowData"),X(P)):(e.consume(P),U)}function X(P){return e.check(PY,M,W)(P)}function M(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),j}function j(P){return P===null||qe(P)?X(P):(e.enter("htmlFlowData"),U(P))}function T(P){return P===45?(e.consume(P),I):U(P)}function L(P){return P===47?(e.consume(P),a="",R):U(P)}function R(P){if(P===62){const ie=a.toLowerCase();return GS.includes(ie)?(e.consume(P),V):U(P)}return Nr(P)&&a.length<8?(e.consume(P),a+=String.fromCharCode(P),R):U(P)}function F(P){return P===93?(e.consume(P),I):U(P)}function I(P){return P===62?(e.consume(P),V):P===45&&s===2?(e.consume(P),I):U(P)}function V(P){return P===null||qe(P)?(e.exit("htmlFlowData"),W(P)):(e.consume(P),V)}function W(P){return e.exit("htmlFlow"),t(P)}}function UY(e,t,n){const r=this;return s;function s(a){return qe(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):n(a)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function $Y(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Cf,t,n)}}const HY={name:"htmlText",tokenize:zY};function zY(e,t,n){const r=this;let s,i,a;return o;function o(I){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(I),c}function c(I){return I===33?(e.consume(I),u):I===47?(e.consume(I),k):I===63?(e.consume(I),b):Nr(I)?(e.consume(I),S):n(I)}function u(I){return I===45?(e.consume(I),d):I===91?(e.consume(I),i=0,m):Nr(I)?(e.consume(I),x):n(I)}function d(I){return I===45?(e.consume(I),p):n(I)}function f(I){return I===null?n(I):I===45?(e.consume(I),h):qe(I)?(a=f,L(I)):(e.consume(I),f)}function h(I){return I===45?(e.consume(I),p):f(I)}function p(I){return I===62?T(I):I===45?h(I):f(I)}function m(I){const V="CDATA[";return I===V.charCodeAt(i++)?(e.consume(I),i===V.length?y:m):n(I)}function y(I){return I===null?n(I):I===93?(e.consume(I),E):qe(I)?(a=y,L(I)):(e.consume(I),y)}function E(I){return I===93?(e.consume(I),g):y(I)}function g(I){return I===62?T(I):I===93?(e.consume(I),g):y(I)}function x(I){return I===null||I===62?T(I):qe(I)?(a=x,L(I)):(e.consume(I),x)}function b(I){return I===null?n(I):I===63?(e.consume(I),_):qe(I)?(a=b,L(I)):(e.consume(I),b)}function _(I){return I===62?T(I):b(I)}function k(I){return Nr(I)?(e.consume(I),N):n(I)}function N(I){return I===45||pr(I)?(e.consume(I),N):C(I)}function C(I){return qe(I)?(a=C,L(I)):yt(I)?(e.consume(I),C):T(I)}function S(I){return I===45||pr(I)?(e.consume(I),S):I===47||I===62||Dt(I)?A(I):n(I)}function A(I){return I===47?(e.consume(I),T):I===58||I===95||Nr(I)?(e.consume(I),O):qe(I)?(a=A,L(I)):yt(I)?(e.consume(I),A):T(I)}function O(I){return I===45||I===46||I===58||I===95||pr(I)?(e.consume(I),O):D(I)}function D(I){return I===61?(e.consume(I),U):qe(I)?(a=D,L(I)):yt(I)?(e.consume(I),D):A(I)}function U(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),s=I,X):qe(I)?(a=U,L(I)):yt(I)?(e.consume(I),U):(e.consume(I),M)}function X(I){return I===s?(e.consume(I),s=void 0,j):I===null?n(I):qe(I)?(a=X,L(I)):(e.consume(I),X)}function M(I){return I===null||I===34||I===39||I===60||I===61||I===96?n(I):I===47||I===62||Dt(I)?A(I):(e.consume(I),M)}function j(I){return I===47||I===62||Dt(I)?A(I):n(I)}function T(I){return I===62?(e.consume(I),e.exit("htmlTextData"),e.exit("htmlText"),t):n(I)}function L(I){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),R}function R(I){return yt(I)?_t(e,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):F(I)}function F(I){return e.enter("htmlTextData"),a(I)}}const Qw={name:"labelEnd",resolveAll:WY,resolveTo:GY,tokenize:qY},VY={tokenize:XY},KY={tokenize:QY},YY={tokenize:ZY};function WY(e){let t=-1;const n=[];for(;++t=3&&(u===null||qe(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===s?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),yt(u)?_t(e,o,"whitespace")(u):o(u))}}const jr={continuation:{tokenize:lW},exit:uW,name:"list",tokenize:oW},iW={partial:!0,tokenize:dW},aW={partial:!0,tokenize:cW};function oW(e,t,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return o;function o(p){const m=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:oE(p)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Ap,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return oE(p)&&++a<10?(e.consume(p),c):(!r.interrupt||a<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Cf,r.interrupt?n:d,e.attempt(iW,h,f))}function d(p){return r.containerState.initialBlankLine=!0,i++,h(p)}function f(p){return yt(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function lW(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Cf,s,i);function s(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,_t(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!yt(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(aW,t,a)(o))}function a(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,_t(e,e.attempt(jr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function cW(e,t,n){const r=this;return _t(e,s,"listItemIndent",r.containerState.size+1);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(i):n(i)}}function uW(e){e.exit(this.containerState.type)}function dW(e,t,n){const r=this;return _t(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const a=r.events[r.events.length-1];return!yt(i)&&a&&a[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const qS={name:"setextUnderline",resolveTo:fW,tokenize:hW};function fW(e,t){let n=e.length,r,s,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",a,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function hW(e,t,n){const r=this;let s;return i;function i(u){let d=r.events.length,f;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){f=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),s=u,a(u)):n(u)}function a(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===s?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),yt(u)?_t(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||qe(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const pW={tokenize:mW};function mW(e){const t=this,n=e.attempt(Cf,r,e.attempt(this.parser.constructs.flowInitial,s,_t(e,e.attempt(this.parser.constructs.flow,s,e.attempt(xY,s)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const gW={resolveAll:a3()},yW=i3("string"),bW=i3("text");function i3(e){return{resolveAll:a3(e==="text"?EW:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],i=n.attempt(s,a,o);return a;function a(d){return u(d)?i(d):o(d)}function o(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const f=s[d];let h=-1;if(f)for(;++h-1){const o=a[0];typeof o=="string"?a[0]=o.slice(r):a.shift()}i>0&&a.push(e[s].slice(0,i))}return a}function RW(e,t){let n=-1;const r=[];let s;for(;++nu.startsWith("data:")).map(u=>u.slice(5).trimStart()).join(` +`);if(c)try{yield JSON.parse(c)}catch{c!=="[DONE]"&&c!=="ping"&&console.debug(`parseSSE: dropping unparseable frame (${c.length} chars):`,c.slice(0,200))}a=r.match(/\r?\n\r?\n/)}}}finally{try{await t.cancel()}catch{}finally{t.releaseLock()}}}const PL="veadk.messageFeedback.v1";function BL(e,t,n,r){return[e,t,n,r].join(":")}function FL(){if(typeof window>"u")return{};try{const e=JSON.parse(localStorage.getItem(PL)??"{}");return e&&typeof e=="object"?e:{}}catch{return{}}}function pz(e,t,n){if(typeof window>"u")return;const r=FL();r[e]={...r[e]??{},[`veadk_feedback:${t}`]:n},localStorage.setItem(PL,JSON.stringify(r))}const _p="",jw=new Map;function UL(e,t){jw.set(e,t)}function $L(){jw.clear()}function Fn(e){const t=jw.get(e);return t?{app:t.app,ep:{base:t.base,apiKey:t.apiKey,runtimeId:t.runtimeId,region:t.region}}:{app:e,ep:{}}}async function pt(e,t={},n={},r=Kc){const s={...t,headers:Ig(t.headers)},i=()=>{const c={...s,signal:Gs(t.signal,r)};if(n.runtimeId){const u=n.region?`${e.includes("?")?"&":"?"}region=${encodeURIComponent(n.region)}`:"";return fetch(xi(`${_p}/web/runtime-proxy/${n.runtimeId}${e}${u}`),c)}if(n.base){const u=new Headers(c.headers);return u.set("X-AgentKit-Base",n.base),n.apiKey&&u.set("X-AgentKit-Key",n.apiKey),fetch(xi(`${_p}/agentkit-proxy${e}`),{...c,headers:u})}return fetch(xi(`${_p}${e}`),c)},a=async c=>{if(cz(c))return!0;if(c.status!==401)return!1;try{return await iz()}catch{return!1}};let o=await i();for(;await a(o);)await uz(t.signal),o=await i();return o}function mz(e){return typeof e=="string"?e:Array.isArray(e)?e.map(t=>{var n;if(t&&typeof t=="object"&&"msg"in t){const r=Array.isArray(t.loc)?(n=t.loc)==null?void 0:n.join("."):"",s=String(t.msg??"");return r?`${r}: ${s}`:s}return String(t)}).filter(Boolean).join(` +`):e&&typeof e=="object"?JSON.stringify(e):""}async function Sn(e,t){const n=await e.text().catch(()=>"");if(!n)return`${t} (${e.status})`;try{const r=JSON.parse(n);return mz(r.detail??r.error)||n||`${t} (${e.status})`}catch{return n||`${t} (${e.status})`}}async function HL(){const e=await pt("/list-apps");if(!e.ok)throw new Error(`list-apps failed: ${e.status}`);return e.json()}class kf extends Error{constructor(){super("当前账号无权访问该 Runtime,请刷新列表或重新登录后重试。"),this.name="RuntimeAccessDeniedError"}}class Kd extends Error{constructor(t,n=!1){super(t),this.unsupported=n,this.name="RuntimeProbeError"}}async function gz(e){try{const t=await e.clone().json();return typeof t.detail=="string"?t.detail:""}catch{return""}}async function Og(e,t,n){const r=await pt("/list-apps",{},n??{base:e,apiKey:t}),s=n!=null&&n.runtimeId?await gz(r):"";if(n!=null&&n.runtimeId&&s==="runtime_access_denied")throw new kf;if(n!=null&&n.runtimeId&&r.status===404)throw new Kd("该 Runtime 的 Agent Server 未提供连接接口,请确认 Runtime 已就绪且版本兼容。",!0);if(n!=null&&n.runtimeId&&(r.status===401||r.status===403))throw new Kd("Runtime 服务拒绝了连接请求,请检查 Runtime 的鉴权配置。");if(!r.ok)throw new Error(await Sn(r,"读取 Agent 列表失败"));return r.json()}async function vm(e,t){const{app:n,ep:r}=Fn(e),s=await pt(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"},r);if(!s.ok){const a=`创建会话失败 (${s.status})`,o=await Sn(s,"创建会话失败");throw new Error(o===a?a:`${a}:${o}`)}return(await s.json()).id}async function Dw(e,t){const{app:n,ep:r}=Fn(e),s=await pt(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{},r);if(!s.ok)throw new Error(`list sessions failed: ${s.status}`);return s.json()}async function _m(e,t,n){const{app:r,ep:s}=Fn(e),i=await pt(`/apps/${r}/users/${encodeURIComponent(t)}/sessions/${n}`,{},s);if(!i.ok)throw new Error(`get session failed: ${i.status}`);const a=await i.json();if(s.runtimeId){const o=BL(s.runtimeId,r,t,n);a.state={...FL()[o]??{},...a.state??{}}}return a}async function zL(e){const{app:t,ep:n}=Fn(e.appName);if(!n.runtimeId)throw new Error("只有连接到 AgentKit Runtime 的会话支持反馈回流");const r=await pt("/web/evaluation/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:n.runtimeId,region:n.region??"cn-beijing",appName:t,userId:e.userId,sessionId:e.sessionId,eventId:e.eventId,rating:e.rating,comment:e.comment??""})},{},Lw);if(!r.ok)throw new Error(await Sn(r,"提交反馈失败"));const s=await r.json(),i=BL(n.runtimeId,t,e.userId,e.sessionId);return pz(i,e.eventId,s),s}async function K1(e,t,n){const{app:r,ep:s}=Fn(e),i=await pt(`/apps/${r}/users/${encodeURIComponent(t)}/sessions/${n}`,{method:"DELETE"},s);if(!i.ok&&i.status!==404)throw new Error(`delete session failed: ${i.status}`)}async function yz(e){const t=await pt("/web/media/capabilities");if(!t.ok)throw new Error(await Sn(t,"media capabilities failed"));return t.json()}async function VL(e,t,n,r){const{app:s}=Fn(e),i=new FormData;i.set("app_name",s),i.set("user_id",t),i.set("session_id",n),i.set("file",r);const a=await pt("/web/media",{method:"POST",body:i},{},Lw);if(!a.ok)throw new Error(await Sn(a,"文件上传失败"));return{...await a.json(),status:"ready"}}async function Y1(e,t,n){const{app:r}=Fn(e),s=`/web/media/${encodeURIComponent(r)}/${encodeURIComponent(t)}/${encodeURIComponent(n)}`,i=await pt(s,{method:"DELETE"});if(!i.ok&&i.status!==404)throw new Error(await Sn(i,"media cleanup failed"))}function KL(e){try{const t=new URL(e);if(t.protocol!=="veadk-media:"||t.hostname!=="apps")return;const n=t.pathname.split("/").filter(Boolean).map(decodeURIComponent);return n.length!==7||n[1]!=="users"||n[3]!=="sessions"||n[5]!=="media"?void 0:`/web/media/${n.map(encodeURIComponent).filter((r,s)=>![1,3,5].includes(s)).join("/")}`}catch{return}}async function kp(e,t){const n=KL(t);if(!n)throw new Error("Invalid VeADK media URI");const r=await pt(n,{method:"DELETE"});if(!r.ok&&r.status!==404)throw new Error(await Sn(r,"media cleanup failed"))}function YL(e,t){if(t.startsWith("data:")||t.startsWith("blob:")||/^https?:/.test(t))return t;const n=KL(t);if(!n)return t;const r=`${n}/content`;return xi(`${_p}${r}`)}async function WL(e,t){const{app:n,ep:r}=Fn(e),s=await pt(`/dev/apps/${encodeURIComponent(n)}/debug/trace/session/${encodeURIComponent(t)}`,{},r);if(!s.ok)throw new Error(`trace failed: ${s.status}`);const i=s.headers.get("content-type")??"";if(!i.includes("application/json")){const o=i.split(";",1)[0]||"Content-Type 缺失";throw new Error(`trace failed: 服务端返回了非 JSON 响应(${o}),请检查 Studio API 代理配置`)}const a=await s.json();if(!Array.isArray(a))throw new Error("trace failed: 返回格式无效");return a}function Pw(e){const t=n=>({id:String(n.id??""),kind:n.kind==="skill"?"skill":"tool",name:String(n.name??""),custom:n.custom===!0,description:typeof n.description=="string"?n.description:void 0,skillSourceId:typeof n.skill_source_id=="string"?n.skill_source_id:void 0,version:typeof n.version=="string"?n.version:void 0});return{schemaVersion:Number(e.schema_version??1),revision:Number(e.revision??0),tools:Array.isArray(e.tools)?e.tools.map(n=>t(n)):[],skills:Array.isArray(e.skills)?e.skills.map(n=>t(n)):[]}}function Bw(e,t,n){return`/harness/apps/${encodeURIComponent(e)}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}/capabilities`}async function GL(e,t,n){const{app:r,ep:s}=Fn(e),i=await pt(Bw(r,t,n),{},s);if(!i.ok)throw new Error(await Sn(i,"读取会话能力失败"));return Pw(await i.json())}async function qL(e){const{ep:t}=Fn(e),n=await pt("/harness/capabilities/tools",{},t);if(!n.ok)throw new Error(await Sn(n,"读取内置工具失败"));return((await n.json()).tools??[]).map(s=>{var i;return((i=s.name)==null?void 0:i.trim())??""}).filter(Boolean)}async function bz(e){const{ep:t}=Fn(e),n=await pt("/harness/skills/spaces?region=all",{},t);if(!n.ok)throw new Error(await Sn(n,"读取 Skill Space 失败"));return(await n.json()).items??[]}async function Ez(e,t,n){const{ep:r}=Fn(e),s=new URLSearchParams({region:n||"cn-beijing"}),i=`/harness/skills/spaces/${encodeURIComponent(t)}/skills?${s.toString()}`,a=await pt(i,{},r);if(!a.ok)throw new Error(await Sn(a,"读取 Skill 列表失败"));return(await a.json()).items??[]}async function XL(e,t,n=1,r=20){const{ep:s}=Fn(e),i=new URLSearchParams({query:t,page_number:String(n),page_size:String(r)}),a=await pt(`/harness/skills/findskill?${i.toString()}`,{},s);if(!a.ok)throw new Error(await Sn(a,"搜索 Skill Hub 失败"));const o=await a.json();return{items:o.items??[],totalCount:Number(o.totalCount??0)}}async function QL(e,t,n,r,s){const{app:i,ep:a}=Fn(e),o=await pt(Bw(i,t,n),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:r.kind,name:r.name,skill_source_id:r.skillSourceId,description:r.description,version:r.version,expected_revision:s})},a);if(!o.ok)throw new Error(await Sn(o,"添加会话能力失败"));return Pw(await o.json())}async function ZL(e,t,n,r,s){const{app:i,ep:a}=Fn(e),o=`${Bw(i,t,n)}/${encodeURIComponent(r)}?expected_revision=${s}`,c=await pt(o,{method:"DELETE"},a);if(!c.ok)throw new Error(await Sn(c,"移除会话能力失败"));return Pw(await c.json())}async function JL(e,t){const n=await pt(`/web/agent-info/${e}`,{},t);if(!n.ok)throw new Error(`agent-info failed: ${n.status}`);const r=await n.json();if(!r.draft)try{const s=await pt(`/web/agent-draft/${e}`,{},t);if(s.ok){const i=await s.json();r.draft=i.draft}}catch{}return{name:r.name??e,description:r.description??"",type:r.type,model:r.model??"",tools:r.tools??[],skillsPreviewSupported:Array.isArray(r.skills),skills:r.skills??[],subAgents:r.subAgents??[],components:r.components??[],searchSources:r.searchSources??[],graph:r.graph,draft:r.draft}}async function Fw(e){const{app:t,ep:n}=Fn(e);return JL(t,n)}async function eM(e,t){const n={runtimeId:e,region:t},s=(await Og("","",n))[0];if(!s)throw new Error("该 Runtime 未提供可预览的 Agent。");return JL(s,n)}async function tM(e,t,n,r){const{app:s,ep:i}=Fn(e),a=new URLSearchParams({source:t,app_name:s,q:n,user_id:r}),o=await pt(`/web/search?${a.toString()}`,{},i);if(!o.ok)throw new Error(await Sn(o,"Agent 检索失败"));return o.json()}async function nM(e,t){const{app:n}=Fn(e),r=await pt(`/web/search?source=web&app_name=${encodeURIComponent(n)}&q=${encodeURIComponent(t)}`);if(!r.ok)throw new Error(`web search failed: ${r.status}`);return r.json()}async function*Yd({appName:e,userId:t,sessionId:n,text:r,attachments:s=[],invocation:i,functionResponses:a=[],signal:o,sessionCapabilities:c=!1}){const{app:u,ep:d}=Fn(e),f=s.flatMap(y=>y.status&&y.status!=="ready"?[]:y.uri?[{fileData:{mimeType:y.mimeType,fileUri:y.uri,displayName:y.name},partMetadata:{veadkMedia:{id:y.id,uri:y.uri,name:y.name,mimeType:y.mimeType,sizeBytes:y.sizeBytes}}}]:y.data?[{inlineData:{mimeType:y.mimeType,data:y.data,displayName:y.name}}]:[]),h=i&&(i.skills.length>0||i.targetAgent)?i:void 0,p=[...f,...a.map(y=>({functionResponse:{id:y.id,name:y.name,response:y.response}})),...r.trim()?[{text:r}]:[]];if(h&&p.length>0){const y=p[0],E=y.partMetadata;p[0]={...y,partMetadata:{...E,veadkInvocation:h}}}const m=await pt(c?"/harness/run_sse":"/run_sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({app_name:u,user_id:t,session_id:n,new_message:{role:"user",parts:p},streaming:!0,custom_metadata:h?{veadkInvocation:h}:void 0}),signal:o},d,0);if(!m.ok)throw new Error(Oh(`run_sse failed: ${m.status}`));for await(const y of Mw(m)){const E=y;typeof E.error=="string"&&(E.error=Oh(E.error)),typeof E.errorMessage=="string"&&(E.errorMessage=Oh(E.errorMessage)),typeof E.error_message=="string"&&(E.error_message=Oh(E.error_message)),yield E}}const od=new Map;async function Rg(e,t,n,r){var u,d,f;const s=r==null?void 0:r.taskId,i=s?new AbortController:void 0;s&&i&&od.set(s,i);const a=()=>{s&&od.get(s)===i&&od.delete(s)};let o;try{(u=r==null?void 0:r.onStage)==null||u.call(r,{level:"info",phase:"upload",message:"正在上传代码包",pct:0}),o=await pt("/web/deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},signal:i==null?void 0:i.signal,body:JSON.stringify({name:e,files:t,config:n,taskId:s,runtimeId:r==null?void 0:r.runtimeId,description:r==null?void 0:r.description,im:r==null?void 0:r.im,envs:r==null?void 0:r.envs})},{},0),(d=r==null?void 0:r.onStage)==null||d.call(r,{level:"success",phase:"upload",message:"代码包上传完成",pct:100})}catch(h){throw a(),h}if(!o.ok){const h=await o.text().catch(()=>"");throw a(),new Error(h||`部署失败 (${o.status})`)}let c=null;try{for await(const h of Mw(o)){const p=h;if(p&&p.done){c=p;break}p&&p.message&&((f=r==null?void 0:r.onStage)==null||f.call(r,p))}}catch(h){throw a(),h}if(a(),!c)throw new Error("部署失败:连接中断");if(!c.success)throw new Error(c.error||"部署失败");if(!c.agentName)throw new Error("部署失败:返回缺少 Agent 名称");if(!c.runtimeId&&!c.url)throw new Error("部署失败:返回缺少 AgentKit 连接信息");return{apikey:c.apikey??"",url:c.url??"",agentName:c.agentName,runtimeId:c.runtimeId,consoleUrl:c.consoleUrl,region:c.region,version:c.version,feishuChannel:c.feishuChannel}}async function rM(e){var n;const t=await pt("/web/cancel-deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({taskId:e})});if(!t.ok){const r=await t.text().catch(()=>"");throw new Error(r||`取消部署失败 (${t.status})`)}(n=od.get(e))==null||n.abort(),od.delete(e)}async function xz(e="cn-beijing"){const t=await pt(`/web/my-runtimes?region=${encodeURIComponent(e)}`);if(!t.ok)throw new Error(`加载失败 (${t.status})`);return(await t.json()).runtimes??[]}const Wd={title:"VeADK Studio",logoUrl:""},by={studio:!1,version:"",branding:Wd,features:{newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,addAgentkit:!0,generatedAgentTestRun:!0},defaultView:"chat",agentsSource:"local"};async function sM(){var e,t;try{const n=await pt("/web/ui-config");if(!n.ok)return by;const r=await n.json(),s=typeof((e=r.branding)==null?void 0:e.logoUrl)=="string"?r.branding.logoUrl:Wd.logoUrl;return{studio:r.studio??!1,version:typeof r.version=="string"?r.version:"",branding:{title:typeof((t=r.branding)==null?void 0:t.title)=="string"?r.branding.title:Wd.title,logoUrl:s?xi(s):""},features:{...by.features,...r.features??{}},defaultView:r.defaultView??"chat",agentsSource:r.agentsSource==="cloud"?"cloud":"local"}}catch{return by}}const iM={role:"user",capabilities:{createAgents:!1,manageAgents:!1,runtimeScope:"mine"}};async function aM(){var n,r,s;const e=await pt("/web/access");if(!e.ok)throw new Error(`加载权限失败 (${e.status})`);const t=await e.json();if(!["admin","developer","user"].includes(t.role)||typeof((n=t.capabilities)==null?void 0:n.createAgents)!="boolean"||typeof((r=t.capabilities)==null?void 0:r.manageAgents)!="boolean"||!["all","mine"].includes((s=t.capabilities)==null?void 0:s.runtimeScope))throw new Error("权限服务返回了无法解析的响应");return t}async function oM(e,t){const n=new URLSearchParams;e&&n.set("targetVersion",e),t&&n.set("startedAt",String(t));const r=n.size?`?${n.toString()}`:"",s=await pt(`/web/studio-update${r}`);if(!s.ok)throw new Error(`检查 Studio 更新失败 (${s.status})`);return await s.json()}async function lM(e){const t=await pt("/web/studio-update",{method:"POST",headers:{"Content-Type":"application/json","X-VeADK-Studio-Update":"1"},body:JSON.stringify({version:e})},{},Lw);if(!t.ok){let n="";try{const r=await t.json();n=typeof r.detail=="string"?r.detail:""}catch{n=""}throw new Error(n||`提交 Studio 更新失败 (${t.status})`)}return await t.json()}async function ld(e={}){const t=new URLSearchParams({scope:e.scope??"all",page_size:String(e.pageSize??30),region:e.region??"all"});e.nextToken&&t.set("next_token",e.nextToken);const n=await pt(`/web/runtimes?${t.toString()}`);if(!n.ok)throw new Error(`加载 Runtime 失败 (${n.status})`);const r=await n.json();return{runtimes:r.runtimes??[],nextToken:r.nextToken??""}}async function cM(e,t="cn-beijing"){try{return await Og("","",{runtimeId:e,region:t})}catch(n){if(n instanceof kf||n instanceof Kd)throw n;return null}}async function uM(e,t="cn-beijing"){const n=await pt("/web/delete-runtime",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e,region:t})});if(!n.ok){const r=await n.text().catch(()=>"");throw new Error(r||`删除失败 (${n.status})`)}}async function Uw(e,t="cn-beijing"){const n=await pt(`/web/runtime-detail?runtimeId=${encodeURIComponent(e)}®ion=${encodeURIComponent(t)}`);if(!n.ok)throw new Error(await Sn(n,"加载 Runtime 详情失败"));return n.json()}async function $w(e){const t=await pt("/web/generated-agent-projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e})});if(!t.ok)throw new Error(await Sn(t,"生成项目失败"));return t.json()}async function dM(e){const t=await pt("/web/generated-agent-test-runs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e})});if(!t.ok)throw new Error(await Sn(t,"创建调试运行失败"));return DL(t,"创建调试运行失败")}async function fM(e,t){const n=await pt(`/web/generated-agent-test-runs/${e}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:t})});if(!n.ok)throw new Error(await Sn(n,"创建调试会话失败"));return(await DL(n,"创建调试会话失败")).id}async function*hM({runId:e,userId:t,sessionId:n,text:r,signal:s}){const i=r.trim()?[{text:r}]:[],a=await pt(`/web/generated-agent-test-runs/${e}/run_sse`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({user_id:t,session_id:n,new_message:{role:"user",parts:i},streaming:!0}),signal:s},{},0);if(!a.ok)throw new Error(await Sn(a,"调试运行失败"));for await(const o of Mw(a))yield o}async function Fu(e){const t=await pt(`/web/generated-agent-test-runs/${e}`,{method:"DELETE"});if(!t.ok&&t.status!==404)throw new Error(await Sn(t,"清理调试运行失败"))}const wz=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_SITE_BRANDING:Wd,DEFAULT_STUDIO_ACCESS:iM,RuntimeAccessDeniedError:kf,RuntimeProbeError:Kd,addSessionCapability:QL,cancelAgentkitDeployment:rM,clearRemoteApps:$L,componentSearch:tM,createGeneratedAgentTestRun:dM,createGeneratedAgentTestSession:fM,createSession:vm,deleteGeneratedAgentTestRun:Fu,deleteMedia:kp,deleteRuntime:uM,deleteSession:K1,deleteSessionMedia:Y1,deployAgentkitProject:Rg,fetchRemoteApps:Og,generateAgentProject:$w,getAgentInfo:Fw,getMediaCapabilities:yz,getMyRuntimes:xz,getRuntimeAgentInfo:eM,getRuntimeDetail:Uw,getRuntimes:ld,getSession:_m,getSessionCapabilities:GL,getSessionTrace:WL,getStudioAccess:aM,getStudioUpdateStatus:oM,getUiConfig:sM,listApps:HL,listSessionBuiltinTools:qL,listSessionSkillSpaces:bz,listSessionSkillsInSpace:Ez,listSessions:Dw,mediaContentUrl:YL,probeRuntimeApps:cM,registerRemoteApp:UL,removeSessionCapability:ZL,runGeneratedAgentTestSSE:hM,runSSE:Yd,searchSessionPublicSkills:XL,startStudioUpdate:lM,submitMessageFeedback:zL,uploadMedia:VL,webSearch:nM},Symbol.toStringTag,{value:"Module"})),vz="send_a2ui_json_to_client",_z="validated_a2ui_json",W1="adk_request_credential",pS="transfer_to_agent";function kz(e){var r,s,i,a;const t=e,n=((r=t==null?void 0:t.exchangedAuthCredential)==null?void 0:r.oauth2)??((s=t==null?void 0:t.exchanged_auth_credential)==null?void 0:s.oauth2)??((i=t==null?void 0:t.rawAuthCredential)==null?void 0:i.oauth2)??((a=t==null?void 0:t.raw_auth_credential)==null?void 0:a.oauth2);return(n==null?void 0:n.authUri)??(n==null?void 0:n.auth_uri)}function zs(){return{blocks:[],liveStart:0}}const mS=e=>e.functionCall??e.function_call,G1=e=>e.functionResponse??e.function_response;function Nz(e){if(!e||typeof e!="object")return"";const t=e,n=t.agentName??t.agent_name;return typeof n=="string"?n:""}function Sz(e){return e.replace(/-/g,"+").replace(/_/g,"/")}function pM(e){const t=[];for(const[n,r]of e.entries()){const s=r.partMetadata??r.part_metadata,i=s==null?void 0:s.veadkTransport;if((i==null?void 0:i.hidden)===!0)continue;const a=s==null?void 0:s.veadkMedia;if(typeof(a==null?void 0:a.uri)=="string"){t.push({id:String(a.id??a.uri),mimeType:typeof a.mimeType=="string"?a.mimeType:void 0,uri:a.uri,name:typeof a.name=="string"?a.name:void 0,sizeBytes:typeof a.sizeBytes=="number"?a.sizeBytes:void 0});continue}const o=r.inlineData??r.inline_data;if(o&&o.data){t.push({id:`inline-${n}-${o.displayName??o.display_name??"media"}`,mimeType:o.mimeType??o.mime_type,data:Sz(o.data),name:o.displayName??o.display_name});continue}const c=r.fileData??r.file_data,u=(c==null?void 0:c.fileUri)??(c==null?void 0:c.file_uri);c&&u&&t.push({id:u,mimeType:c.mimeType??c.mime_type,uri:u,name:c.displayName??c.display_name})}return t}function q1(e){const t=e.partMetadata??e.part_metadata,n=t==null?void 0:t.veadkTransport;return(n==null?void 0:n.hideText)===!0?void 0:e.text}const Tz=new Set(["llm","sequential","parallel","loop","a2a"]);function Az(e){var t;for(const n of e){const r=(t=n.partMetadata??n.part_metadata)==null?void 0:t.veadkInvocation;if(!r||typeof r!="object")continue;const s=r,i=Array.isArray(s.skills)?s.skills.flatMap(c=>{if(!c||typeof c!="object")return[];const u=c;return typeof u.name=="string"?[{name:u.name,description:typeof u.description=="string"?u.description:""}]:[]}):[];let a;const o=s.targetAgent;if(o&&typeof o=="object"){const c=o,u=c.type;typeof c.name=="string"&&typeof u=="string"&&Tz.has(u)&&Array.isArray(c.path)&&(a={name:c.name,description:typeof c.description=="string"?c.description:"",type:u,path:c.path.filter(d=>typeof d=="string")})}if(i.length>0||a)return{skills:i,targetAgent:a}}}function Cz(e,t){if(!t.length)return;const n=e[e.length-1];(n==null?void 0:n.kind)==="attachment"?n.files.push(...t):e.push({kind:"attachment",files:t})}function gS(e,t,n){const r=e[e.length-1];r&&r.kind===t?r.text+=n:e.push(t==="thinking"?{kind:t,text:n,done:!1}:{kind:t,text:n})}function Rh(e){for(const t of e)t.kind==="thinking"&&(t.done=!0)}function Ec(e,t){var a,o,c,u;const n=e.blocks.map(d=>({...d}));let r=e.liveStart;const s=((a=t.content)==null?void 0:a.parts)??[],i=s.some(d=>mS(d)||G1(d));if(t.partial&&!i){for(const d of s){const f=q1(d);typeof f=="string"&&f&&gS(n,d.thought?"thinking":"text",f)}return{blocks:n,liveStart:r}}n.length=r;for(const d of s){const f=mS(d),h=G1(d),p=pM([d]),m=q1(d);if(typeof m=="string"&&m)gS(n,d.thought?"thinking":"text",m);else if(p.length)Rh(n),Cz(n,p);else if(f)if(Rh(n),f.name===pS){const y=Nz(f.args)||((o=t.actions)==null?void 0:o.transferToAgent)||((c=t.actions)==null?void 0:c.transfer_to_agent)||"未知 Agent";n.push({kind:"agent-transfer",agentName:y,done:!1})}else if(f.name===W1){const y=f.args??{},E=y.authConfig??y.auth_config??y,x=String(y.functionCallId??y.function_call_id??"").replace(/^_adk_toolset_auth_/,"")||void 0;n.push({kind:"auth",callId:f.id??"",label:x,authUri:kz(E),authConfig:E,done:!1})}else n.push({kind:"tool",name:f.name??"",args:f.args,done:!1});else if(h){if(Rh(n),h.name===pS)for(let y=n.length-1;y>=0;y--){const E=n[y];if(E.kind==="agent-transfer"&&!E.done){E.done=!0;break}}if(h.name===W1)for(let y=n.length-1;y>=0;y--){const E=n[y];if(E.kind==="auth"&&!E.done){E.done=!0;break}}for(let y=n.length-1;y>=0;y--){const E=n[y];if(E.kind==="tool"&&!E.done&&E.name===h.name){E.done=!0,E.response=h.response;break}}if(h.name===vz){const y=((u=h.response)==null?void 0:u[_z])??[];if(y.length){const E=n[n.length-1];E&&E.kind==="a2ui"?E.messages.push(...y):n.push({kind:"a2ui",messages:y})}}}}return Rh(n),r=n.length,{blocks:n,liveStart:r}}function Iz(e,t={}){var s,i;const n=[];let r=zs();for(const a of e)if(a.author==="user"){const c=((s=a.content)==null?void 0:s.parts)??[];if(c.some(p=>{var m;return((m=G1(p))==null?void 0:m.name)===W1})){for(let p=n.length-1;p>=0;p--)if(n[p].role==="assistant"){for(let m=n[p].blocks.length-1;m>=0;m--){const y=n[p].blocks[m];if(y.kind==="auth"){y.done=!0;break}}break}}const u=c.map(q1).filter(p=>!!p).join(""),d=pM(c),f=Az(c);if(!u&&!d.length&&!f){r=zs();continue}const h=[];f&&h.push({kind:"invocation",value:f}),d.length&&h.push({kind:"attachment",files:d}),u&&h.push({kind:"text",text:u}),n.push({role:"user",blocks:h,meta:{ts:a.timestamp}}),r=zs()}else{const c=a.author??"";let u=n[n.length-1];(!u||u.role!=="assistant"||c&&((i=u.meta)==null?void 0:i.author)!==c)&&(u={role:"assistant",blocks:[],meta:{author:c||void 0}},n.push(u),r=zs()),r=Ec(r,a),u.blocks=r.blocks;const d=a.usageMetadata??a.usage_metadata,f=u.meta??(u.meta={});c&&(f.author=c),d!=null&&d.totalTokenCount&&(f.tokens=d.totalTokenCount),a.timestamp&&(f.ts=a.timestamp),a.id&&(f.eventId=a.id);const h=a.invocationId??a.invocation_id;h&&(f.invocationId=h)}for(const a of n){const o=a.meta,c=o==null?void 0:o.eventId;if(!c)continue;const u=t[`veadk_feedback:${c}`];if(!u||typeof u!="object")continue;const d=u;d.rating!=="good"&&d.rating!=="bad"||(o.feedback=u)}return n}function Oz(e){var t,n;for(const r of e??[])if(r.author==="user"||((t=r.content)==null?void 0:t.role)==="user"){const s=(((n=r.content)==null?void 0:n.parts)??[]).map(i=>i.text).find(Boolean);if(s)return s}return"新会话"}const Rz=50,yS=48;function Lz(e){return(e.events??[]).flatMap(t=>{var s,i;const r=(((s=t.content)==null?void 0:s.parts)??[]).map(a=>typeof a.text=="string"?a.text:"").filter(Boolean).join("");return r?[{text:r,role:t.author??((i=t.content)==null?void 0:i.role)??"",ts:t.timestamp}]:[]})}function Mz(e){var t,n;for(const r of e.events??[])if(r.author==="user"||((t=r.content)==null?void 0:t.role)==="user"){const s=(((n=r.content)==null?void 0:n.parts)??[]).map(i=>i.text).find(Boolean);if(s)return s}return"未命名会话"}function jz(e,t,n){const r=Math.max(0,t-yS),s=Math.min(e.length,t+n+yS);return(r>0?"…":"")+e.slice(r,s).trim()+(s{var c;if((c=o.events)!=null&&c.length)return o;try{return await _m(t,e,o.id)}catch{return o}})),a=[];for(const o of i)for(const{text:c,role:u,ts:d}of Lz(o)){const f=c.toLowerCase().indexOf(r);if(f!==-1){a.push({type:"session",appId:t,sessionId:o.id,title:Mz(o),snippet:jz(c,f,r.length),role:u,ts:d??o.lastUpdateTime});break}}return a.sort((o,c)=>(c.ts??0)-(o.ts??0)),a.slice(0,Rz)}async function Pz(e,t){if(!e||!t.trim())return{results:[]};let n;try{n=await nM(e,t.trim())}catch(a){const o=String(a);return{results:[],note:o.includes("404")?"网络搜索接口未就绪(后端未启用 /web/search)。":`网络搜索失败:${o}`}}const{mounted:r,results:s,error:i}=n;return r?i?{results:[],note:i}:{results:s.map((a,o)=>({type:"web",index:o,title:a.title,url:a.url,siteName:a.siteName,summary:a.summary}))}:{results:[],note:"当前 Agent 未挂载 web_search 工具。"}}async function Bz(e,t,n,r){if(!t||!r.trim())return{results:[]};const s=await tM(t,e,r.trim(),n);if(!s.mounted)return{results:[],note:e==="knowledge"?"该 Agent 未挂载知识库。":"该 Agent 未挂载长期记忆。"};if(s.error)return{results:[],note:s.error};const i=s.sourceName??(e==="knowledge"?"知识库":"长期记忆");return{results:s.results.map((a,o)=>e==="knowledge"?{type:"knowledge",index:o,content:a.content,sourceName:i,sourceType:s.sourceType}:{type:"memory",index:o,content:a.content,sourceName:i,sourceType:s.sourceType,author:a.author,ts:a.timestamp})}}async function Fz(e,t,n){return e==="session"?{results:await Dz(n.userId,n.appId,t)}:e==="web"?Pz(n.appId,t):Bz(e,n.appId,n.userId,t)}function mM({className:e="icon"}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M16.4 10.7a5.7 5.7 0 1 1-1.67-4.03"}),l.jsx("path",{d:"M15.25 15.25 19.6 19.6"})]})}function Uz({open:e}){return l.jsx("svg",{className:`search-source-chevron ${e?"open":""}`,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:"m3.25 4.75 2.75 2.5 2.75-2.5"})})}function $z({onClick:e}){return l.jsxs("button",{className:"new-chat",onClick:e,"aria-label":"搜索",title:"搜索",children:[l.jsx(mM,{}),l.jsx("span",{className:"sidebar-nav-label",children:"搜索"})]})}function Hz(e,t,n){const r=!!e,s=new Set((t==null?void 0:t.searchSources)??[]),i=a=>r?n?"正在检测 Agent 能力":`当前 Agent 未挂载${a}`:"请选择 Agent";return[{id:"session",label:"会话",ready:r,unavailableLabel:"请选择 Agent"},{id:"web",label:"网络",ready:r&&s.has("web"),description:"通过 web_search 工具检索",unavailableLabel:i(" web_search 工具")},{id:"knowledge",label:"知识库",ready:r&&s.has("knowledge"),unavailableLabel:i("知识库")},{id:"memory",label:"长期记忆",ready:r&&s.has("memory"),unavailableLabel:i("长期记忆")}]}function km(e){return{context_search:"Context Search",local:"本地",mem0:"Mem0",milvus:"Milvus",opensearch:"OpenSearch",openviking:"OpenViking",redis:"Redis",tos_vector:"TOS Vector",viking:"VikingDB"}[e.toLowerCase()]??e}function bS(e){return e?new Date(e*1e3).toLocaleString("zh-CN",{timeZone:"Asia/Shanghai",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):""}function zz({userId:e,appId:t,agentInfo:n,capabilitiesLoading:r,agentLabel:s,onOpenSession:i}){var j,T;const[a,o]=w.useState("session"),[c,u]=w.useState(""),[d,f]=w.useState([]),[h,p]=w.useState(),[m,y]=w.useState(!1),[E,g]=w.useState(!1),[x,b]=w.useState(!1),_=w.useRef(0),k=w.useRef(null),N=Hz(t,n,r),C=N.find(L=>L.id===a),S=a==="knowledge"?(j=n==null?void 0:n.components)==null?void 0:j.find(L=>L.source==="knowledgebase"||L.kind==="knowledgebase"):a==="memory"?(T=n==null?void 0:n.components)==null?void 0:T.find(L=>L.source==="long_term_memory"||L.kind==="memory"):void 0;w.useEffect(()=>{_.current+=1,o("session"),f([]),p(void 0),g(!1),y(!1),b(!1)},[t]),w.useEffect(()=>{if(!x)return;function L(R){var F;(F=k.current)!=null&&F.contains(R.target)||b(!1)}return document.addEventListener("pointerdown",L),()=>document.removeEventListener("pointerdown",L)},[x]);async function A(L,R){var W;const F=L.trim();if(!F||!((W=N.find(P=>P.id===R))!=null&&W.ready))return;const I=++_.current;y(!0),g(!0);let V;try{V=await Fz(R,F,{userId:e,appId:t})}catch(P){const ie=P instanceof Error?P.message:String(P);V={results:[],note:`搜索失败:${ie}`}}I===_.current&&(f(V.results),p(V.note),y(!1))}function O(L){_.current+=1,u(L),f([]),p(void 0),g(!1),y(!1)}function D(L){_.current+=1,o(L),b(!1),f([]),p(void 0),g(!1),y(!1)}const U=!!(C!=null&&C.ready),X=t?a==="web"?"在网络中检索":a==="knowledge"?`在 ${(S==null?void 0:S.name)??"当前 Agent 的知识库"} 中检索`:a==="memory"?`在 ${(S==null?void 0:S.name)??"当前用户的长期记忆"} 中检索`:"在当前 Agent 的会话中检索":"请先选择 Agent",M=S!=null&&S.backend?km(S.backend):"";return l.jsxs("div",{className:"search",children:[l.jsxs("div",{className:"search-box",children:[l.jsxs("div",{className:"search-source-picker-wrap",ref:k,children:[l.jsxs("button",{className:"search-source-picker",type:"button","aria-label":`搜索类型:${(C==null?void 0:C.label)??"未选择"}`,"aria-haspopup":"listbox","aria-expanded":x,onClick:()=>b(L=>!L),children:[l.jsx("span",{children:(C==null?void 0:C.label)??"搜索类型"}),M&&l.jsx("small",{children:M}),l.jsx(Uz,{open:x})]}),x&&l.jsx("div",{className:"search-source-menu",role:"listbox","aria-label":"选择搜索类型",children:N.map(L=>{var I,V;const R=L.id==="knowledge"?(I=n==null?void 0:n.components)==null?void 0:I.find(W=>W.source==="knowledgebase"||W.kind==="knowledgebase"):L.id==="memory"?(V=n==null?void 0:n.components)==null?void 0:V.find(W=>W.source==="long_term_memory"||W.kind==="memory"):void 0,F=R?[R.name,R.backend?km(R.backend):""].filter(Boolean).join(" · "):L.ready?L.description:L.unavailableLabel;return l.jsxs("button",{type:"button",role:"option","aria-selected":a===L.id,disabled:!L.ready,onClick:()=>D(L.id),children:[l.jsx("span",{children:L.label}),F&&l.jsx("small",{children:F})]},L.id)})})]}),l.jsx("span",{className:"search-box-divider","aria-hidden":!0}),l.jsx("input",{className:"search-input",value:c,onChange:L=>O(L.target.value),onKeyDown:L=>{L.key==="Enter"&&(L.preventDefault(),A(c,a))},placeholder:X,disabled:!U,autoFocus:!0}),l.jsx("button",{className:"search-go",onClick:()=>void A(c,a),disabled:!c.trim()||m,"aria-label":"搜索",children:m?l.jsx(Rt,{className:"icon spin"}):l.jsx(mM,{className:"icon"})})]}),l.jsx("div",{className:"search-results",children:U?E?m?null:h?l.jsx("div",{className:"search-empty",children:h}):d.length===0&&E?l.jsxs("div",{className:"search-empty",children:["未找到匹配「",c.trim(),"」的结果。"]}):d.map((L,R)=>l.jsx(Vz,{result:L,agentLabel:s,onOpen:i},R)):l.jsx("div",{className:"search-empty",children:a==="web"?"输入关键词后回车或点击按钮,通过 web_search 工具检索。":a==="knowledge"?"输入问题,检索当前 Agent 挂载的知识库。":a==="memory"?"输入线索,检索当前用户跨会话保存的长期记忆。":"输入关键词后回车或点击按钮,搜索当前 Agent 的会话。"}):l.jsx("div",{className:"search-empty",children:t?r?"正在读取当前 Agent 的检索能力…":(C==null?void 0:C.unavailableLabel)??"当前 Agent 未挂载该数据源":"选择一个 Agent 后,即可检索会话、网络及其挂载的数据源。"})})]})}function Vz({result:e,agentLabel:t,onOpen:n}){switch(e.type){case"session":return l.jsxs("button",{className:"search-result",onClick:()=>n(e.appId,e.sessionId),children:[l.jsx(IL,{className:"search-result-icon"}),l.jsxs("div",{className:"search-result-body",children:[l.jsxs("div",{className:"search-result-head",children:[l.jsx("span",{className:"search-result-title",children:e.title}),l.jsxs("span",{className:"search-result-meta",children:[t(e.appId),e.ts?` · ${bS(e.ts)}`:""]})]}),l.jsx("div",{className:"search-result-snippet",children:e.snippet})]})]});case"web":return l.jsxs("a",{className:"search-result",href:e.url||void 0,target:"_blank",rel:"noreferrer noopener",children:[l.jsx(Cg,{className:"search-result-icon"}),l.jsxs("div",{className:"search-result-body",children:[l.jsxs("div",{className:"search-result-head",children:[l.jsx("span",{className:"search-result-title",children:e.title||e.url}),l.jsxs("span",{className:"search-result-meta",children:[e.siteName,e.url&&l.jsx(Iw,{className:"search-result-ext"})]})]}),e.summary&&l.jsx("div",{className:"search-result-snippet",children:e.summary})]})]});case"knowledge":return l.jsxs("div",{className:"search-result search-result-static",children:[l.jsx(ES,{source:"knowledge"}),l.jsxs("div",{className:"search-result-body",children:[l.jsxs("div",{className:"search-result-head",children:[l.jsxs("span",{className:"search-result-title",children:["知识片段 ",e.index+1]}),l.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${km(e.sourceType)}`:""]})]}),l.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});case"memory":return l.jsxs("div",{className:"search-result search-result-static",children:[l.jsx(ES,{source:"memory"}),l.jsxs("div",{className:"search-result-body",children:[l.jsxs("div",{className:"search-result-head",children:[l.jsxs("span",{className:"search-result-title",children:["记忆片段 ",e.index+1]}),l.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${km(e.sourceType)}`:"",e.ts?` · ${bS(e.ts)}`:""]})]}),l.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});default:return null}}function ES({source:e,className:t="search-result-icon"}){return e==="knowledge"?l.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[l.jsx("path",{d:"M5 5.5h10.5A3.5 3.5 0 0 1 19 9v9.5H8.5A3.5 3.5 0 0 1 5 15V5.5Z"}),l.jsx("path",{d:"M8.25 9h7.5M8.25 12.25h6"})]}):l.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[l.jsx("path",{d:"M12 4.5a7.5 7.5 0 1 0 7.5 7.5"}),l.jsx("path",{d:"M12 8a4 4 0 1 0 4 4M12 11.3a.7.7 0 1 0 0 1.4.7.7 0 0 0 0-1.4Z"})]})}const Hw="/assets/volcengine-DM14a-L-.svg",xS="(max-width: 860px)";function Kz(){return l.jsxs("svg",{className:"icon sidebar-agent-face",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("rect",{x:"4.25",y:"5.25",width:"15.5",height:"13.5",rx:"4.75"}),l.jsx("path",{className:"sidebar-agent-face__eye sidebar-agent-face__eye--left",d:"M8.5 10.7v2"}),l.jsx("path",{className:"sidebar-agent-face__eye sidebar-agent-face__eye--right",d:"M15.5 10.7v2"})]})}function Yz(e){let t=2166136261;for(const r of e)t^=r.charCodeAt(0),t=Math.imul(t,16777619);const n=t>>>0;return{"--avatar-hue-a":194+n%22,"--avatar-hue-b":214+(n>>>6)%25,"--avatar-hue-c":176+(n>>>12)%25,"--avatar-x":`${22+(n>>>18)%55}%`,"--avatar-y":`${18+(n>>>24)%58}%`}}const Wz={admin:"管理员",developer:"开发者",user:"普通用户"};function wS({role:e}){const t=Wz[e];return l.jsx("span",{className:`studio-role-badge studio-role-badge--${e}`,title:t,children:t})}function Gz({version:e,onClose:t}){return w.useEffect(()=>{const n=r=>{r.key==="Escape"&&t()};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[t]),Ss.createPortal(l.jsx("div",{className:"confirm-scrim",onMouseDown:t,children:l.jsxs("section",{className:"confirm-box system-info-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"system-info-title",onMouseDown:n=>n.stopPropagation(),children:[l.jsxs("header",{className:"system-info-head",children:[l.jsx("h2",{id:"system-info-title",children:"系统信息"}),l.jsx("button",{type:"button",className:"icon-btn",onClick:t,"aria-label":"关闭系统信息",autoFocus:!0,children:l.jsx(zr,{className:"icon","aria-hidden":"true"})})]}),l.jsx("dl",{className:"system-info-meta",children:l.jsxs("div",{children:[l.jsx("dt",{children:"当前版本"}),l.jsx("dd",{children:e||"—"})]})})]})}),document.body)}function qz({access:e,userInfo:t,version:n,onLogout:r}){const[s,i]=w.useState(!1),[a,o]=w.useState(!1),[c,u]=w.useState("");if(!t)return null;const d=oz(t),f=typeof t.email=="string"?t.email:"",h=(d||"U").slice(0,1).toUpperCase(),p=Yz(d||f||h),m=lz(t),y=m===c?"":m;return l.jsxs("div",{className:"sidebar-user",children:[l.jsxs("button",{className:"sidebar-user-btn",onClick:()=>i(E=>!E),title:f?`${d} +${f}`:d,children:[l.jsxs("span",{className:`account-avatar${y?" has-image":""}`,style:p,children:[h,y?l.jsx("img",{className:"account-avatar-image",src:y,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>u(y)}):null]}),l.jsxs("span",{className:"sidebar-user-identity",children:[l.jsxs("span",{className:"sidebar-user-primary",children:[l.jsx("span",{className:"sidebar-user-name",children:d}),l.jsx(wS,{role:e.role})]}),f&&f!==d&&l.jsx("span",{className:"sidebar-user-email",children:f})]})]}),s&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"menu-scrim",onClick:()=>i(!1)}),l.jsxs("div",{className:"account-pop sidebar-user-pop",children:[l.jsxs("div",{className:"account-head",children:[l.jsxs("span",{className:`account-avatar account-avatar--lg${y?" has-image":""}`,style:p,children:[h,y?l.jsx("img",{className:"account-avatar-image",src:y,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>u(y)}):null]}),l.jsxs("div",{className:"account-id",children:[l.jsxs("div",{className:"account-name-row",children:[l.jsx("div",{className:"account-name",children:d}),l.jsx(wS,{role:e.role})]}),f&&f!==d&&l.jsx("div",{className:"account-sub",children:f})]})]}),l.jsxs("button",{type:"button",className:"account-action",onClick:()=>{i(!1),o(!0)},children:[l.jsx(Ka,{className:"icon"})," 系统信息"]}),l.jsxs("button",{type:"button",className:"account-action",onClick:()=>{i(!1),r()},children:[l.jsx(DH,{className:"icon"})," 退出登录"]})]})]}),a?l.jsx(Gz,{version:n,onClose:()=>o(!1)}):null]})}function Xz({branding:e,sessions:t,currentSessionId:n,features:r,access:s,streamingSids:i,onNewChat:a,onSearch:o,onQuickCreate:c,onSkillCenter:u,onAddAgent:d,onManageAgents:f,onPickSession:h,onDeleteSession:p,userInfo:m,version:y,onLogout:E}){const g=A=>(r==null?void 0:r[A])!==!1,[x,b]=w.useState(null),_=w.useRef(typeof window<"u"&&window.matchMedia(xS).matches),[k,N]=w.useState(_.current),C=[...t].sort((A,O)=>(O.lastUpdateTime??0)-(A.lastUpdateTime??0)),S=()=>{_.current=!1,N(A=>!A),b(null)};return w.useEffect(()=>{const A=window.matchMedia(xS),O=D=>{D.matches?N(U=>U||(_.current=!0,!0)):_.current&&(_.current=!1,N(!1))};return A.addEventListener("change",O),()=>A.removeEventListener("change",O)},[]),l.jsxs("aside",{className:`sidebar ${k?"is-collapsed":""}`,children:[l.jsxs("div",{className:"sidebar-top",children:[l.jsxs("div",{className:"sidebar-brand-row",children:[l.jsxs("button",{type:"button",className:"brand",onClick:a,"aria-label":"返回首页",title:"返回首页",children:[l.jsx("img",{className:"brand-logo",src:e.logoUrl||Hw,width:20,height:20,alt:"","aria-hidden":!0}),l.jsx("span",{className:"brand-title",children:e.title})]}),l.jsx("button",{type:"button",className:"sidebar-collapse-toggle",onClick:S,"aria-label":k?"展开侧边栏":"收起侧边栏",title:k?"展开侧边栏":"收起侧边栏",children:k?l.jsx($H,{className:"icon"}):l.jsx(UH,{className:"icon"})})]}),g("newChat")&&l.jsxs("button",{className:"new-chat new-chat--conversation",onClick:a,"aria-label":"新会话",title:"新会话",children:[l.jsx(rr,{className:"icon"}),l.jsx("span",{className:"sidebar-nav-label",children:"新会话"})]}),l.jsxs("button",{className:"new-chat new-chat--agents",onClick:f,"aria-label":"智能体",title:"智能体",children:[l.jsx(Kz,{}),l.jsx("span",{className:"sidebar-nav-label",children:"智能体"})]}),g("search")&&l.jsx($z,{onClick:o})]}),g("history")&&l.jsxs("div",{className:"sidebar-history",children:[l.jsxs("div",{className:"history-head",children:[l.jsx("span",{children:"历史会话"}),g("newChat")&&l.jsx("button",{type:"button",className:"history-new-chat",onClick:a,"aria-label":"新建会话",title:"新建会话",children:l.jsx(rr,{className:"icon"})})]}),l.jsxs("div",{className:"history-list",children:[C.length===0&&l.jsx("div",{className:"history-empty",children:"暂无会话"}),C.map(A=>{const O=Oz(A.events);return l.jsxs("div",{className:`history-item ${A.id===n?"active":""}`,children:[l.jsxs("button",{className:"history-item-btn",onClick:()=>h(A.id),title:O,children:[(i==null?void 0:i.has(A.id))&&l.jsx("span",{className:"history-streaming",title:"正在生成…","aria-label":"正在生成"}),l.jsx("span",{className:"history-title",children:O})]}),l.jsx("button",{className:"history-more",title:"更多",onClick:()=>b(D=>D===A.id?null:A.id),children:l.jsx(EH,{className:"icon"})}),x===A.id&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"menu-scrim",onClick:()=>b(null)}),l.jsx("div",{className:"history-menu",children:l.jsxs("button",{className:"menu-item menu-item--danger",onClick:()=>{b(null),p(A.id)},children:[l.jsx(ea,{className:"icon"})," 删除"]})})]})]},A.id)})]})]}),l.jsx(qz,{access:s,userInfo:m,version:y,onLogout:E})]})}const gM="veadk_agentkit_connections";function ps(){try{const e=localStorage.getItem(gM);return e?JSON.parse(e):[]}catch{return[]}}function Lg(e){try{localStorage.setItem(gM,JSON.stringify(e))}catch{}}function Bo(e,t){return`agentkit:${e}:${t}`}function yM(e){try{return new URL(e).host}catch{return e}}function Yc(e){$L();for(const t of e)for(const n of t.apps)UL(Bo(t.id,n),t.runtimeId?{app:n,runtimeId:t.runtimeId,region:t.region}:{app:n,base:t.base,apiKey:t.apiKey})}function bM(e,t,n,r,s,i){const a={id:`rt_${e}`,name:t||e,runtimeId:e,region:n,apps:r,appLabels:s,currentVersion:i},o=[...ps().filter(c=>c.runtimeId!==e),a];return Lg(o),Yc(o),a}async function Nm(e,t,n,r){let s;try{s=await cM(e,n)}catch(o){throw o instanceof kf&&Sm(e),o}if(!s||s.length===0)throw Sm(e),new Error("该 Runtime 暂不支持连接,请确认服务已正常运行。");const i=Object.fromEntries(s.map(o=>[o,t])),a=bM(e,t,n,s,i,r);return Bo(a.id,s[0])}async function EM(e,t,n,r){const s=t.trim().replace(/\/+$/,""),i=await Og(s,n.trim()),a={id:Date.now().toString(36),name:e.trim()||yM(s),base:s,apiKey:n.trim(),apps:i,appLabels:r&&i.length>0?{[i[0]]:r}:void 0},o=[...ps().filter(c=>c.base!==s),a];return Lg(o),Yc(o),a}function Qz(e){const t=ps().filter(n=>n.id!==e);return Lg(t),Yc(t),t}function Sm(e){const t=ps().filter(n=>n.runtimeId!==e);return Lg(t),Yc(t),t}function xM(e,t){const n=e.map(s=>({id:s,label:s,app:s,remote:!1})),r=t.flatMap(s=>s.apps.map(i=>{var o;const a=((o=s.appLabels)==null?void 0:o[i])??i;return{id:Bo(s.id,i),label:a,app:i,remote:!0,host:s.runtimeId?s.name:yM(s.base??""),runtimeId:s.runtimeId,region:s.region,currentVersion:s.currentVersion}}));return[...n,...r]}const vS=Object.freeze(Object.defineProperty({__proto__:null,addConnection:EM,addRuntimeConnection:bM,buildAgentEntries:xM,connectRuntime:Nm,loadConnections:ps,registerConnections:Yc,remoteAppId:Bo,removeConnection:Qz,removeRuntimeConnection:Sm},Symbol.toStringTag,{value:"Module"}));function xc({className:e="icon"}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"m10.05 3.7 1.95-1.12 1.95 1.12"}),l.jsx("path",{d:"m16.25 5.03 3.9 2.25v4.5"}),l.jsx("path",{d:"M20.15 15.08v1.64l-3.9 2.25"}),l.jsx("path",{d:"m13.95 20.3-1.95 1.12-1.95-1.12"}),l.jsx("path",{d:"m7.75 18.97-3.9-2.25v-4.5"}),l.jsx("path",{d:"M3.85 8.92V7.28l3.9-2.25"}),l.jsx("path",{d:"m12 7.55 1.28 3.17L16.45 12l-3.17 1.28L12 16.45l-1.28-3.17L7.55 12l3.17-1.28L12 7.55Z",fill:"currentColor",stroke:"none"})]})}function X1({className:e="icon"}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M4.5 6.7h4.2M12.3 6.7h7.2"}),l.jsx("path",{d:"M4.5 12h8.2M16.3 12h3.2"}),l.jsx("path",{d:"M4.5 17.3h2.7M10.8 17.3h8.7"}),l.jsx("circle",{cx:"10.5",cy:"6.7",r:"1.8",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14.5",cy:"12",r:"1.8",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"9",cy:"17.3",r:"1.8",fill:"currentColor",stroke:"none"})]})}function Zz({className:e="icon"}){return l.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsxs("g",{transform:"translate(0 2)",children:[l.jsx("path",{d:"M11.6 3.5c.45 3.75 2.75 6.05 6.5 6.5-3.75.45-6.05 2.75-6.5 6.5-.45-3.75-2.75-6.05-6.5-6.5 3.75-.45 6.05-2.75 6.5-6.5Z"}),l.jsx("path",{d:"M18.7 3.8v3.4M20.4 5.5H17"})]})})}function wM({className:e="icon"}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M18.7 8.15A7.55 7.55 0 0 0 5.35 7.1"}),l.jsx("path",{d:"m18.7 8.15-.2-3.05-3.02.3"}),l.jsx("path",{d:"M5.3 15.85A7.55 7.55 0 0 0 18.65 16.9"}),l.jsx("path",{d:"m5.3 15.85.2 3.05 3.02-.3"}),l.jsx("path",{d:"M6.85 12h2.8l1.4-2.9 1.9 5.8 1.42-2.9h2.78"})]})}const _S=15,Jz=1e4,eV=[{value:"cn-beijing",label:"北京"},{value:"cn-shanghai",label:"上海"}];function tV(e){return e==="cn-beijing"?"北京":e==="cn-shanghai"?"上海":e}function vM(e){const t=e.toLowerCase();return t.includes("invalidagentkitruntime.notfound")||t.includes("specified agentkitruntime does not exist")?"该 Runtime 已不存在或列表信息已过期,请刷新列表后重试。":t.includes("accessdenied")||t.includes("forbidden")||t.includes("permission")||t.includes("(401)")||t.includes("(403)")?"当前账号无权访问该 Runtime,请检查所属 Project 和访问权限。":t.includes("agent-info failed: 404")||t.includes("读取 agent 列表失败 (404)")?"该 Agent Server 版本暂不支持信息预览。":"该 Runtime 暂时无法访问,请确认其状态为“就绪”后重试。"}function Ey(e,t=Jz){return new Promise((n,r)=>{const s=setTimeout(()=>r(new Error("加载超时,请重试")),t);e.then(i=>{clearTimeout(s),n(i)},i=>{clearTimeout(s),r(i)})})}function nV({open:e,onClose:t,variant:n="drawer",anchorTop:r=0,agentsSource:s,localApps:i,currentId:a,currentRuntime:o,runtimeScope:c,onSelect:u}){const[d,f]=w.useState([]),[h,p]=w.useState([""]),[m,y]=w.useState(0),[E,g]=w.useState(c==="mine"),[x,b]=w.useState(null),[_,k]=w.useState("cn-beijing"),[N,C]=w.useState(!1),[S,A]=w.useState(""),[O,D]=w.useState(""),[U,X]=w.useState(null),[M,j]=w.useState(new Set),[T,L]=w.useState(),[R,F]=w.useState("agent"),I=w.useRef(!1);function V(ne){L(me=>(me==null?void 0:me.runtimeId)===ne.runtimeId?void 0:{runtimeId:ne.runtimeId,name:ne.name,region:ne.region})}const W=w.useCallback(async ne=>{if(d[ne]){y(ne);return}const me=h[ne];if(me!==void 0){C(!0),A("");try{const ye=await Ey(ld({nextToken:me,pageSize:_S,region:_,scope:"all"}));f(te=>{const de=[...te];return de[ne]=ye.runtimes,de}),p(te=>{const de=[...te];return ye.nextToken&&(de[ne+1]=ye.nextToken),de}),y(ne)}catch(ye){A(ye instanceof Error?ye.message:String(ye))}finally{C(!1)}}},[h,d,_]),P=w.useCallback(async()=>{C(!0),A("");try{const ne=[];let me="";do{const ye=await Ey(ld({scope:"mine",nextToken:me,pageSize:100,region:_}));ne.push(...ye.runtimes),me=ye.nextToken}while(me&&ne.length<2e3);b(ne)}catch(ne){A(ne instanceof Error?ne.message:String(ne))}finally{C(!1)}},[_]);w.useEffect(()=>{g(c==="mine"),f([]),p([""]),y(0),b(null),I.current=!1},[c]),w.useEffect(()=>{e&&s==="cloud"&&!E&&!I.current&&(I.current=!0,W(0))},[e,s,E,W]),w.useEffect(()=>{E&&x===null&&s==="cloud"&&P()},[E,x,s,P]),w.useEffect(()=>{e&&(L(void 0),F("agent"))},[e]);function ie(){j(new Set),E?(b(null),P()):(f([]),p([""]),y(0),I.current=!0,C(!0),A(""),Ey(ld({nextToken:"",pageSize:_S,region:_,scope:"all"})).then(ne=>{f([ne.runtimes]),p(ne.nextToken?["",ne.nextToken]:[""])}).catch(ne=>A(ne instanceof Error?ne.message:String(ne))).finally(()=>C(!1)))}function G(ne){ne!==_&&(k(ne),f([]),p([""]),y(0),b(null),j(new Set),I.current=!1)}const re=!E&&(d[m+1]!==void 0||h[m+1]!==void 0);function ue(ne){X(ne.runtimeId),Nm(ne.runtimeId,ne.name,ne.region).then(me=>{u(me),t()}).catch(me=>{if(me instanceof kf){A(me.message);return}if(me instanceof Kd){me.unsupported&&j(ye=>new Set(ye).add(ne.runtimeId)),A(me.message);return}j(ye=>new Set(ye).add(ne.runtimeId))}).finally(()=>X(null))}if(!e)return null;const le=(E?x??[]:d[m]??[]).filter(ne=>O?ne.name.toLowerCase().includes(O.toLowerCase()):!0);return l.jsxs(l.Fragment,{children:[n==="drawer"?l.jsx("div",{className:"menu-scrim",onClick:t}):null,l.jsxs("div",{className:`agentsel agentsel--${n}${T&&n==="drawer"?" has-detail":""}`,role:"dialog","aria-label":"选择 Agent",style:n==="drawer"?{top:r,height:`min(640px, calc(100dvh - ${r}px - 10px))`}:void 0,children:[l.jsxs("div",{className:"agentsel-main",children:[l.jsxs("div",{className:"agentsel-head",children:[l.jsxs("span",{className:"agentsel-title",children:[l.jsx(xc,{})," 选择 Agent"]}),l.jsxs("div",{className:"agentsel-head-actions",children:[s==="cloud"&&l.jsx("button",{className:"agentsel-refresh",onClick:ie,title:"刷新",disabled:N,children:l.jsx(H1,{className:`icon ${N?"spin":""}`})}),l.jsx("button",{className:"agentsel-refresh",onClick:t,title:"关闭",children:l.jsx(zr,{className:"icon"})})]})]}),s==="local"?l.jsx("div",{className:"agentsel-body",children:i.length===0?l.jsx("div",{className:"agentsel-empty",children:"暂无本地 Agent。"}):l.jsx("ul",{className:"agentsel-list",children:i.map(ne=>l.jsx("li",{children:l.jsxs("button",{className:`agentsel-item ${ne===a?"active":""}`,onClick:()=>{u(ne),t()},children:[l.jsx(xc,{}),l.jsx("span",{className:"agentsel-item-name",children:ne})]})},ne))})}):l.jsxs("div",{className:"agentsel-body agentsel-body--cloud",children:[l.jsxs("div",{className:"agentsel-tools",children:[l.jsxs("div",{className:"agentsel-search",children:[l.jsx(Vd,{className:"icon"}),l.jsx("input",{value:O,onChange:ne=>D(ne.target.value),placeholder:"搜索 Runtime 名称"})]}),l.jsx("div",{className:"agentsel-regions","aria-label":"按部署地域筛选",children:eV.map(ne=>l.jsx("button",{type:"button",className:_===ne.value?"active":"","aria-pressed":_===ne.value,onClick:()=>G(ne.value),children:ne.label},ne.value))}),c==="all"&&l.jsxs("label",{className:"agentsel-mine",children:[l.jsx("input",{type:"checkbox",checked:E,onChange:ne=>g(ne.target.checked)}),"只看我创建的"]})]}),S&&l.jsx("div",{className:"agentsel-error",children:S}),l.jsxs("div",{className:"agentsel-listwrap",children:[le.length===0&&!N?l.jsx("div",{className:"agentsel-empty",children:"暂无 Runtime。"}):l.jsx("ul",{className:"agentsel-list",children:le.map(ne=>{const me=M.has(ne.runtimeId),ye=U===ne.runtimeId,te=(o==null?void 0:o.runtimeId)===ne.runtimeId,de=(T==null?void 0:T.runtimeId)===ne.runtimeId;return l.jsx("li",{children:l.jsxs("div",{className:`agentsel-item agentsel-runtime-item ${te?"active":""} ${de?"is-previewed":""}`,title:ne.runtimeId,children:[l.jsx(wM,{}),l.jsxs("div",{className:"agentsel-item-main",children:[l.jsx("span",{className:"agentsel-item-name",title:ne.name,children:ne.name}),l.jsxs("div",{className:"agentsel-item-meta",children:[l.jsx("span",{className:`agentsel-status is-${me?"bad":cV(ne.status)}`,children:me?"不支持":_M(ne.status)}),ne.isMine&&l.jsx("span",{className:"agentsel-badge",children:"我创建的"})]})]}),l.jsxs("div",{className:"agentsel-item-actions",children:[l.jsx("button",{type:"button",className:"agentsel-connect",disabled:ye||te,onClick:()=>ue(ne),children:ye?"连接中…":te?"已连接":me?"重试":"连接"}),n==="drawer"?l.jsx("button",{type:"button",className:`agentsel-info ${de?"active":""}`,"aria-label":`查看 ${ne.name} 信息`,"aria-pressed":de,title:"查看信息",onClick:()=>V(ne),children:l.jsx(Ka,{className:"icon"})}):null]})]})},ne.runtimeId)})}),N&&l.jsxs("div",{className:"agentsel-loading",children:[l.jsx(Rt,{className:"icon spin"})," 加载中…"]})]}),l.jsxs("div",{className:"agentsel-pager",children:[l.jsx("button",{disabled:E||m===0||N,onClick:()=>void W(m-1),"aria-label":"上一页",children:l.jsx(mH,{className:"icon"})}),l.jsx("span",{className:"agentsel-pager-label",children:E?1:m+1}),l.jsx("button",{disabled:E||!re||N,onClick:()=>void W(m+1),"aria-label":"下一页",children:l.jsx(ws,{className:"icon"})})]})]})]}),n==="drawer"&&s==="cloud"&&T&&l.jsx(aV,{runtime:T,tab:R,onTabChange:F})]})]})}const rV={knowledgebase:"知识库",memory:"记忆",prompt_manager:"提示词管理",example_store:"样例库",run_processor:"运行处理器",tracer:"链路追踪",toolset:"工具集",plugin:"插件",other:"其他"};function sV(e){return rV[e.toLowerCase()]??e}function iV(e){return{context_search:"Context Search",local:"本地",mem0:"Mem0",milvus:"Milvus",opensearch:"OpenSearch",openviking:"OpenViking",redis:"Redis",tos_vector:"TOS Vector",viking:"VikingDB"}[e.toLowerCase()]??e}function aV({runtime:e,tab:t,onTabChange:n}){return l.jsxs("section",{className:"agentsel-detail agentsel-preview","aria-label":"Agent 与 Runtime 信息",children:[l.jsx("div",{className:"agentsel-head agentsel-preview-head",children:l.jsxs("div",{className:`agentsel-detail-tabs is-${t}`,role:"tablist","aria-label":"详情类型",children:[l.jsx("span",{className:"agentsel-detail-tabs-slider","aria-hidden":!0}),l.jsx("button",{id:"agentsel-agent-tab",type:"button",role:"tab","aria-selected":t==="agent","aria-controls":"agentsel-agent-panel",onClick:()=>n("agent"),children:"Agent 信息"}),l.jsx("button",{id:"agentsel-runtime-tab",type:"button",role:"tab","aria-selected":t==="runtime","aria-controls":"agentsel-runtime-panel",onClick:()=>n("runtime"),children:"Runtime 信息"})]})}),l.jsx("div",{id:"agentsel-agent-panel",className:"agentsel-tab-panel",role:"tabpanel","aria-labelledby":"agentsel-agent-tab",hidden:t!=="agent",children:l.jsx(oV,{runtime:e})}),l.jsx("div",{id:"agentsel-runtime-panel",className:"agentsel-tab-panel",role:"tabpanel","aria-labelledby":"agentsel-runtime-tab",hidden:t!=="runtime",children:l.jsx(lV,{runtime:e})})]})}function oV({runtime:e}){const[t,n]=w.useState(null),[r,s]=w.useState(!0),[i,a]=w.useState(""),o=e.runtimeId,c=e.region;w.useEffect(()=>{let d=!0;return n(null),s(!0),a(""),eM(o,c).then(f=>d&&n(f)).catch(f=>{if(!d)return;const h=f instanceof Error?f.message:String(f);a(vM(h))}).finally(()=>d&&s(!1)),()=>{d=!1}},[o,c]);const u=(t==null?void 0:t.components)??[];return l.jsx("div",{className:"agentsel-detail-body",children:r?l.jsxs("div",{className:"agentsel-panel-state",children:[l.jsx(Rt,{className:"icon spin"})," 读取 Agent 信息…"]}):i?l.jsxs("div",{className:"agentsel-panel-empty",children:[l.jsx("span",{children:"暂时无法读取 Agent 信息"}),l.jsx("small",{title:i,children:i})]}):t?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"agentsel-identity",children:[l.jsx(xc,{className:"agentsel-identity-icon"}),l.jsxs("div",{className:"agentsel-identity-copy",children:[l.jsx("strong",{title:t.name,children:t.name||"未命名 Agent"}),t.model&&l.jsx("span",{title:t.model,children:t.model})]})]}),t.description&&l.jsxs("section",{className:"agentsel-info-section",children:[l.jsx("h3",{children:"描述"}),l.jsx("p",{className:"agentsel-description",title:t.description,children:t.description})]}),t.subAgents.length>0&&l.jsx(kS,{icon:l.jsx(OL,{className:"icon"}),title:"子 Agent",values:t.subAgents}),t.tools.length>0&&l.jsx(kS,{icon:l.jsx(X1,{}),title:"工具",values:t.tools}),l.jsxs("section",{className:"agentsel-info-section",children:[l.jsxs("h3",{children:[l.jsx(Zz,{})," 技能"]}),t.skillsPreviewSupported?t.skills.length>0?l.jsx("div",{className:"agentsel-info-list",children:t.skills.map(d=>l.jsxs("div",{className:"agentsel-info-list-item",children:[l.jsx("strong",{title:d.name,children:d.name}),d.description&&l.jsx("span",{title:d.description,children:d.description})]},d.name))}):l.jsx("div",{className:"agentsel-info-empty",children:"未配置"}):l.jsx("div",{className:"agentsel-info-empty",children:"暂不支持预览"})]}),u.length>0&&l.jsxs("section",{className:"agentsel-info-section",children:[l.jsxs("h3",{children:[l.jsx(wL,{className:"icon"})," 挂载组件"]}),l.jsx("div",{className:"agentsel-info-list",children:u.map((d,f)=>l.jsxs("div",{className:"agentsel-info-list-item agentsel-component",children:[l.jsxs("div",{className:"agentsel-component-head",children:[l.jsx("strong",{title:d.name,children:d.name}),l.jsxs("span",{children:[sV(d.kind),d.backend?` · ${iV(d.backend)}`:""]})]}),d.description&&l.jsx("span",{title:d.description,children:d.description})]},`${d.kind}:${d.name}:${f}`))})]}),!t.description&&t.subAgents.length===0&&t.tools.length===0&&t.skillsPreviewSupported&&t.skills.length===0&&u.length===0&&l.jsx("div",{className:"agentsel-panel-empty",children:"暂无更多 Agent 配置信息。"})]}):null})}function kS({icon:e,title:t,values:n}){return l.jsxs("section",{className:"agentsel-info-section",children:[l.jsxs("h3",{children:[e,t]}),l.jsx("div",{className:"agentsel-chips",children:n.map((r,s)=>l.jsx("span",{className:"agentsel-chip",title:r,children:r},`${r}:${s}`))})]})}function lV({runtime:e}){const[t,n]=w.useState(null),[r,s]=w.useState(!0),[i,a]=w.useState(""),o=e.runtimeId,c=e.region;w.useEffect(()=>{let d=!0;return s(!0),a(""),n(null),Uw(o,c).then(f=>d&&n(f)).catch(f=>d&&a(vM(f instanceof Error?f.message:String(f)))).finally(()=>d&&s(!1)),()=>{d=!1}},[o,c]);const u=[];if(t){t.model&&u.push(["模型",t.model]),t.description&&u.push(["描述",t.description]),t.status&&u.push(["状态",_M(t.status)]),t.region&&u.push(["区域",tV(t.region)]);const d=t.resources,f=[d.cpuMilli!=null?`CPU ${d.cpuMilli}m`:"",d.memoryMb!=null?`内存 ${d.memoryMb}MB`:"",d.minInstance!=null||d.maxInstance!=null?`实例 ${d.minInstance??"?"}~${d.maxInstance??"?"}`:""].filter(Boolean).join(" · ");f&&u.push(["资源",f]),t.currentVersion!=null&&u.push(["版本",String(t.currentVersion)])}return l.jsxs("div",{className:"agentsel-detail-body",children:[l.jsxs("div",{className:"agentsel-runtime-identity",children:[l.jsx(wM,{}),l.jsxs("div",{children:[l.jsx("strong",{title:e.name,children:e.name}),l.jsx("span",{title:e.runtimeId,children:e.runtimeId})]})]}),r?l.jsxs("div",{className:"agentsel-apps-note",children:[l.jsx(Rt,{className:"icon spin"})," 读取详情…"]}):i?l.jsx("div",{className:"agentsel-error",children:i}):t?l.jsxs(l.Fragment,{children:[l.jsx("dl",{className:"agentsel-kv",children:u.map(([d,f])=>l.jsxs("div",{className:"agentsel-kv-row",children:[l.jsx("dt",{children:d}),l.jsx("dd",{children:f})]},d))}),t.envs.length>0&&l.jsxs("div",{className:"agentsel-envs",children:[l.jsx("div",{className:"agentsel-envs-head",children:"环境变量"}),t.envs.map(d=>l.jsxs("div",{className:"agentsel-env",children:[l.jsx("span",{className:"agentsel-env-k",children:d.key}),l.jsx("span",{className:"agentsel-env-v",children:d.value})]},d.key))]})]}):null]})}function cV(e){const t=(e||"").toLowerCase();return t.includes("run")||t.includes("ready")||t.includes("active")?"ok":t.includes("creat")||t.includes("pend")||t.includes("deploy")?"warn":t.includes("fail")||t.includes("error")||t.includes("delet")?"bad":"muted"}const uV={ready:"就绪",unreleased:"未发布",running:"运行中",active:"运行中",creating:"创建中",pending:"等待中",deploying:"部署中",updating:"更新中",failed:"失败",error:"异常",stopping:"停止中",stopped:"已停止",deleting:"删除中",deleted:"已删除"};function _M(e){const t=e.toLowerCase().replace(/[\s_-]/g,"");return uV[t]??(e||"-")}function dV({appName:e,onAppChange:t,agentLabel:n,agentsSource:r,localApps:s,currentRuntime:i,runtimeScope:a,title:o,titleLeading:c,crumbs:u,rightContent:d}){return l.jsxs("div",{className:"navbar",children:[l.jsxs("div",{className:"navbar-left",children:[l.jsx("div",{className:"navbar-default",children:u&&u.length>0?l.jsx("nav",{className:"navbar-crumbs","aria-label":"面包屑",children:u.map((f,h)=>l.jsxs(w.Fragment,{children:[h>0&&l.jsx(ws,{className:"crumb-sep"}),f.onClick?l.jsx("button",{className:"crumb crumb-link",onClick:f.onClick,children:f.label}):l.jsx("span",{className:"crumb crumb-current",children:f.label})]},h))}):o?l.jsxs("div",{className:"navbar-title-group",children:[c,l.jsx("div",{className:"navbar-title",title:o,children:o})]}):l.jsxs("div",{className:"navbar-title-group",children:[c,l.jsx(fV,{appName:e,onAppChange:t,agentLabel:n,agentsSource:r,localApps:s,currentRuntime:i,runtimeScope:a})]})}),l.jsx("div",{id:"veadk-page-header-left",className:"navbar-portal-slot"})]}),l.jsxs("div",{className:"navbar-right",children:[l.jsx("div",{id:"veadk-page-header-actions",className:"navbar-portal-actions"}),d]})]})}function fV({appName:e,onAppChange:t,agentLabel:n,agentsSource:r,localApps:s,currentRuntime:i,runtimeScope:a}){const[o,c]=w.useState(!1),u=f=>n?n(f):f;function d(){c(!1)}return l.jsxs("div",{className:"agent-dd",children:[l.jsxs("button",{className:"agent-dd-trigger",onClick:()=>c(f=>!f),children:[l.jsx("span",{className:"agent-dd-current",children:e?u(e):"选择 Agent"}),l.jsx(Sw,{className:`agent-dd-chev ${o?"open":""}`})]}),o&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"menu-scrim",onClick:d}),l.jsx(nV,{open:!0,variant:"navbar",agentsSource:r,localApps:s,currentId:e,currentRuntime:i,runtimeScope:a,onSelect:f=>{t(f),d()},onClose:d})]})]})}async function Nf(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:Gs(void 0,Kc)});if(t.status===409)throw new Error("服务端未配置 Volcengine AK/SK,无法访问 AgentKit Skills 中心");if(t.status===401)throw new Error("请先登录以访问 AgentKit Skills 中心");if(t.status===404)throw new Error("技能不存在或无 SKILL.md 内容");if(!t.ok){let n="";try{n=(await t.json()).detail||""}catch{}throw new Error(`请求失败 (${t.status})${n?": "+n:""}`)}return t.json()}async function kM(){return(await Nf("/web/skill-spaces?region=all")).items||[]}async function hV(e){const t=new URLSearchParams({region:e.region,page:String(e.page),page_size:String(e.pageSize)});return e.project&&t.set("project",e.project),Nf(`/web/skill-spaces?${t.toString()}`)}async function NM(e,t){const n=t?`?region=${encodeURIComponent(t)}`:"";return(await Nf(`/web/skill-spaces/${encodeURIComponent(e)}/skills${n}`)).items||[]}async function pV(e,t){const n=new URLSearchParams({region:t.region,page:String(t.page),page_size:String(t.pageSize)});return t.project&&n.set("project",t.project),Nf(`/web/skill-spaces/${encodeURIComponent(e)}/skills?${n.toString()}`)}async function mV(e,t,n,r,s){const i=[];n&&i.push(`version=${encodeURIComponent(n)}`),r&&i.push(`region=${encodeURIComponent(r)}`),s&&i.push(`project=${encodeURIComponent(s)}`);const a=i.length>0?`?${i.join("&")}`:"";return Nf(`/web/skill-spaces/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}${a}`)}function gV(e,t){return{source:"skillspace",id:`ss:${e.id}/${t.skillId}/${t.version}`,name:t.skillName,description:t.skillDescription,folder:t.skillName,skillSpaceId:e.id,skillSpaceName:e.name,skillSpaceRegion:e.region,skillId:t.skillId,version:t.version}}function yV(e,t){return`https://console.volcengine.com/agentkit/${(t||"cn-beijing")==="cn-beijing"?"cn":"cn-shanghai"}/skillspace/detail/${encodeURIComponent(e)}`}const bV="https://ark.cn-beijing.volces.com/api/v3/",Np=[{key:"MODEL_EMBEDDING_NAME",required:!1,placeholder:"doubao-embedding-vision-250615",comment:"向量化模型(记忆/知识库需要)"},{key:"MODEL_EMBEDDING_DIM",required:!1,placeholder:"2048"},{key:"MODEL_EMBEDDING_API_BASE",required:!1,placeholder:bV}],wc=[],bu=[{key:"FEISHU_APP_ID",required:!0,placeholder:"cli_xxx",comment:"飞书应用 App ID"},{key:"FEISHU_APP_SECRET",required:!0,placeholder:"输入 App Secret",comment:"飞书应用 App Secret"}],qs={topK:"3",region:"cn-beijing",endpoint:"https://open.volcengineapi.com/"},SM=[{key:"REGISTRY_SPACE_ID",required:!0,placeholder:"请选择智能体中心",comment:"AgentKit 智能体中心"},{key:"REGISTRY_TOP_K",required:!1,placeholder:qs.topK,comment:"召回 Agent 数量"},{key:"REGISTRY_REGION",required:!1,placeholder:qs.region,comment:"AgentKit 智能体中心地域"},{key:"REGISTRY_ENDPOINT",required:!1,placeholder:qs.endpoint,comment:"AgentKit 智能体中心 OpenAPI 地址"}],vc=[{id:"web_search",label:"联网搜索",desc:"火山引擎 Web Search,获取实时信息。",importLine:"from veadk.tools.builtin_tools.web_search import web_search",toolNames:["web_search"],env:wc},{id:"parallel_web_search",label:"并行联网搜索",desc:"并行发起多条搜索查询,更快汇总。",importLine:"from veadk.tools.builtin_tools.parallel_web_search import parallel_web_search",toolNames:["parallel_web_search"],env:wc},{id:"link_reader",label:"网页读取",desc:"抓取并阅读给定链接的正文内容。",importLine:"from veadk.tools.builtin_tools.link_reader import link_reader",toolNames:["link_reader"],env:[]},{id:"web_scraper",label:"网页爬取",desc:"结构化爬取网页(需要 Scraper 服务)。",importLine:"from veadk.tools.builtin_tools.web_scraper import web_scraper",toolNames:["web_scraper"],env:[{key:"TOOL_WEB_SCRAPER_ENDPOINT",required:!0},{key:"TOOL_WEB_SCRAPER_API_KEY",required:!0}]},{id:"image_generate",label:"图像生成",desc:"文生图(Doubao Seedream)。",importLine:"from veadk.tools.builtin_tools.image_generate import image_generate",toolNames:["image_generate"],env:[{key:"MODEL_IMAGE_NAME",required:!1,placeholder:"doubao-seedream-5-0-260128"}]},{id:"image_edit",label:"图像编辑",desc:"图生图 / 编辑(Doubao SeedEdit)。",importLine:"from veadk.tools.builtin_tools.image_edit import image_edit",toolNames:["image_edit"],env:[{key:"MODEL_EDIT_NAME",required:!1,placeholder:"doubao-seededit-3-0-i2i-250628"}]},{id:"video_generate",label:"视频生成",desc:"文/图生视频(Doubao Seedance),含任务查询。",importLine:"from veadk.tools.builtin_tools.video_generate import video_generate, video_task_query",toolNames:["video_generate","video_task_query"],env:[{key:"MODEL_VIDEO_NAME",required:!1,placeholder:"doubao-seedance-2-0-260128"}]},{id:"text_to_speech",label:"语音合成 (TTS)",desc:"把文本转成语音(火山语音)。",importLine:"from veadk.tools.builtin_tools.tts import text_to_speech",toolNames:["text_to_speech"],env:[{key:"TOOL_VESPEECH_APP_ID",required:!0},{key:"TOOL_VESPEECH_SPEAKER",required:!1,placeholder:"zh_female_vv_uranus_bigtts"}]},{id:"run_code",label:"代码执行",desc:"在沙箱中执行代码",importLine:"from veadk.tools.builtin_tools.run_code import run_code",toolNames:["run_code"],env:[{key:"AGENTKIT_TOOL_ID",required:!0,placeholder:"t-xxxx",comment:"代码执行沙箱 ID"},{key:"AGENTKIT_TOOL_REGION",required:!1,placeholder:"cn-beijing",comment:"AgentKit Tools 地域"}]},{id:"vesearch",label:"VeSearch 智能搜索",desc:"火山 VeSearch(需要 bot 端点)。",importLine:"from veadk.tools.builtin_tools.vesearch import vesearch",toolNames:["vesearch"],env:[{key:"TOOL_VESEARCH_ENDPOINT",required:!0,comment:"VeSearch bot_id"}]}],Q1=[{id:"local",label:"本地内存",desc:"进程内,不持久化。适合开发调试。",env:[]},{id:"sqlite",label:"SQLite 文件",desc:"持久化到本地 .db 文件。",extraArgs:'local_database_path="./short_term_memory.db"',env:[]},{id:"mysql",label:"MySQL",desc:"持久化到 MySQL。",env:[{key:"DATABASE_MYSQL_HOST",required:!0},{key:"DATABASE_MYSQL_USER",required:!0},{key:"DATABASE_MYSQL_PASSWORD",required:!0},{key:"DATABASE_MYSQL_DATABASE",required:!0}]},{id:"postgresql",label:"PostgreSQL",desc:"持久化到 PostgreSQL。",env:[{key:"DATABASE_POSTGRESQL_HOST",required:!0},{key:"DATABASE_POSTGRESQL_PORT",required:!1,placeholder:"5432"},{key:"DATABASE_POSTGRESQL_USER",required:!0},{key:"DATABASE_POSTGRESQL_PASSWORD",required:!0},{key:"DATABASE_POSTGRESQL_DATABASE",required:!0}]}],Z1=[{id:"local",label:"本地向量库",desc:"进程内 llama-index 向量库。",env:Np,pipExtra:"extensions",needsEmbedding:!0},{id:"opensearch",label:"OpenSearch",desc:"OpenSearch 向量检索。",env:[{key:"DATABASE_OPENSEARCH_HOST",required:!0},{key:"DATABASE_OPENSEARCH_PORT",required:!1,placeholder:"9200"},{key:"DATABASE_OPENSEARCH_USERNAME",required:!0},{key:"DATABASE_OPENSEARCH_PASSWORD",required:!0},...Np],pipExtra:"extensions",needsEmbedding:!0},{id:"redis",label:"Redis",desc:"Redis 向量检索。",env:[{key:"DATABASE_REDIS_HOST",required:!0},{key:"DATABASE_REDIS_PORT",required:!1,placeholder:"6379"},{key:"DATABASE_REDIS_PASSWORD",required:!1},...Np],pipExtra:"extensions",needsEmbedding:!0},{id:"viking",label:"VikingDB Memory",desc:"火山 VikingDB 记忆库(支持用户画像)。",env:wc},{id:"mem0",label:"Mem0",desc:"Mem0 托管记忆服务。",env:[{key:"DATABASE_MEM0_API_KEY",required:!0},{key:"DATABASE_MEM0_BASE_URL",required:!1}]}],Gd="viking",J1=[{id:"viking",label:"VikingDB Knowledge",desc:"火山 VikingDB 知识库。",env:wc},{id:"opensearch",label:"OpenSearch",desc:"OpenSearch 向量检索。",env:[{key:"DATABASE_OPENSEARCH_HOST",required:!0},{key:"DATABASE_OPENSEARCH_PORT",required:!1,placeholder:"9200"},{key:"DATABASE_OPENSEARCH_USERNAME",required:!0},{key:"DATABASE_OPENSEARCH_PASSWORD",required:!0},...Np],pipExtra:"extensions",needsEmbedding:!0},{id:"context_search",label:"Context Search",desc:"火山 Context Search 引擎(无需向量化)。",env:[...wc,{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ID",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ENDPOINT",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_APIKEY",required:!0}]}],eE=[{id:"apmplus",label:"APMPlus",desc:"火山 APMPlus 应用性能监控。",enableFlag:"ENABLE_APMPLUS",env:[{key:"OBSERVABILITY_OPENTELEMETRY_APMPLUS_SERVICE_NAME",required:!1}]},{id:"cozeloop",label:"CozeLoop",desc:"扣子 CozeLoop 链路观测。",enableFlag:"ENABLE_COZELOOP",env:[{key:"OBSERVABILITY_OPENTELEMETRY_COZELOOP_API_KEY",required:!0},{key:"OBSERVABILITY_OPENTELEMETRY_COZELOOP_SERVICE_NAME",required:!1,comment:"CozeLoop space_id"}]},{id:"tls",label:"TLS (日志服务)",desc:"火山 TLS 日志服务导出。",enableFlag:"ENABLE_TLS",env:[...wc,{key:"OBSERVABILITY_OPENTELEMETRY_TLS_SERVICE_NAME",required:!1,comment:"TLS topic_id,留空自动创建"}]}],EV={coding:"智能编程",get_city_weather:"城市天气查询",get_location_weather:"位置天气查询",web_fetch:"网页内容获取"};function tE(e){const t=vc.find(n=>n.id===e||n.toolNames.includes(e));return EV[e]??(t==null?void 0:t.label)??e}function NS(e){const t=vc.find(r=>r.id===e||r.toolNames.includes(e));return((t==null?void 0:t.desc)??"由 VeADK 提供的内置工具").replace(/[。.]+$/,"")}function xV(){return l.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:l.jsx("path",{d:"m7 7 10 10M17 7 7 17",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function wV(){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[l.jsx("circle",{cx:"10.8",cy:"10.8",r:"5.8",stroke:"currentColor",strokeWidth:"1.7"}),l.jsx("path",{d:"m15.2 15.2 4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function SS(){return l.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:l.jsx("path",{d:"M12 5.5v13M5.5 12h13",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function TM({title:e,description:t,icon:n,wide:r=!1,onClose:s,children:i}){const a=w.useRef(`session-capability-${Math.random().toString(36).slice(2)}`);return w.useEffect(()=>{const o=document.body.style.overflow;document.body.style.overflow="hidden";const c=u=>{u.key==="Escape"&&s()};return document.addEventListener("keydown",c),()=>{document.removeEventListener("keydown",c),document.body.style.overflow=o}},[s]),Ss.createPortal(l.jsxs("div",{className:"session-capability-dialog-layer",children:[l.jsx("button",{type:"button",className:"session-capability-dialog-scrim","aria-label":"关闭弹窗",onClick:s}),l.jsxs("section",{className:`session-capability-dialog${r?" is-wide":""}`,role:"dialog","aria-modal":"true","aria-labelledby":a.current,children:[l.jsxs("header",{className:`session-capability-dialog-head${n?"":" is-iconless"}`,children:[n&&l.jsx("span",{className:"session-capability-dialog-mark",children:n}),l.jsxs("div",{children:[l.jsx("h2",{id:a.current,children:e}),l.jsx("p",{children:t})]}),l.jsx("button",{type:"button",className:"session-capability-dialog-close","aria-label":`关闭${e}`,onClick:s,children:l.jsx(xV,{})})]}),i]})]}),document.body)}function Sp({value:e,placeholder:t,label:n,onChange:r,autoFocus:s=!1}){return l.jsxs("label",{className:"session-capability-search",children:[l.jsx(wV,{}),l.jsx("input",{value:e,"aria-label":n,placeholder:t,autoFocus:s,onChange:i=>r(i.target.value)})]})}function vV({agentName:e,tools:t,selectedNames:n,mutating:r,onAdd:s,onClose:i}){const[a,o]=w.useState(""),[c,u]=w.useState(""),d=w.useMemo(()=>new Set(n),[n]),f=w.useMemo(()=>{const p=a.trim().toLowerCase();return t.filter(m=>p?`${tE(m)} ${m} ${NS(m)}`.toLowerCase().includes(p):!0)},[a,t]),h=async p=>{u(p);const m=await s({kind:"tool",name:p});u(""),m&&i()};return l.jsx(TM,{title:"添加内置工具",description:`添加后仅对 ${e} 的当前会话生效`,icon:l.jsx(X1,{}),onClose:i,children:l.jsxs("div",{className:"session-tool-dialog-body",children:[l.jsx(Sp,{value:a,label:"搜索内置工具",placeholder:"搜索中文名称或工具标识",onChange:o,autoFocus:!0}),l.jsx("div",{className:"session-tool-picker",role:"list","aria-label":"可用内置工具",children:f.length===0?l.jsx("div",{className:"session-capability-empty",children:"没有匹配的内置工具"}):f.map(p=>{const m=d.has(p),y=c===p;return l.jsxs("article",{className:"session-tool-option",role:"listitem",children:[l.jsx("span",{className:"session-tool-option-icon",children:l.jsx(X1,{})}),l.jsxs("span",{className:"session-tool-option-copy",children:[l.jsx("strong",{children:tE(p)}),l.jsx("code",{children:p}),l.jsx("span",{children:NS(p)})]}),l.jsx("button",{type:"button",disabled:m||r||!!c,onClick:()=>void h(p),children:m?"已添加":y?"添加中…":"添加"})]},p)})})]})})}function _V({appName:e,agentName:t,selectedNames:n,mutating:r,onAdd:s,onClose:i}){const[a,o]=w.useState("public"),[c,u]=w.useState(""),[d,f]=w.useState([]),[h,p]=w.useState(0),[m,y]=w.useState(!0),[E,g]=w.useState(""),[x,b]=w.useState([]),[_,k]=w.useState(null),[N,C]=w.useState([]),[S,A]=w.useState(""),[O,D]=w.useState(""),[U,X]=w.useState(!0),[M,j]=w.useState(!1),[T,L]=w.useState(""),[R,F]=w.useState(""),I=w.useMemo(()=>new Set(n),[n]);w.useEffect(()=>{if(a!=="public")return;let G=!0;const re=window.setTimeout(()=>{y(!0),g(""),XL(e,c.trim()).then(ue=>{G&&(f(ue.items),p(ue.totalCount))}).catch(ue=>{G&&(f([]),p(0),g(ue instanceof Error?ue.message:"搜索 Skill Hub 失败"))}).finally(()=>{G&&y(!1)})},250);return()=>{G=!1,window.clearTimeout(re)}},[e,c,a]),w.useEffect(()=>{if(a!=="agentkit")return;let G=!0;return X(!0),L(""),kM().then(re=>{G&&(b(re),k(re[0]??null))}).catch(re=>{G&&L(re instanceof Error?re.message:"读取 Skill Space 失败")}).finally(()=>{G&&X(!1)}),()=>{G=!1}},[a]),w.useEffect(()=>{if(a!=="agentkit")return;if(!_){C([]);return}let G=!0;return j(!0),L(""),NM(_.id,_.region).then(re=>{G&&C(re)}).catch(re=>{G&&L(re instanceof Error?re.message:"读取技能失败")}).finally(()=>{G&&j(!1)}),()=>{G=!1}},[_,a]);const V=w.useMemo(()=>{const G=S.trim().toLowerCase();return G?x.filter(re=>`${re.name} ${re.id} ${re.description}`.toLowerCase().includes(G)):x},[S,x]),W=w.useMemo(()=>{const G=O.trim().toLowerCase();return G?N.filter(re=>`${re.skillName} ${re.skillDescription}`.toLowerCase().includes(G)):N},[O,N]),P=async G=>{if(!_)return;F(G.skillId);const re=await s({kind:"skill",name:G.skillName,skillSourceId:_.id,description:G.skillDescription,version:G.version});F(""),re&&i()},ie=async G=>{F(G.slug);const re=await s({kind:"skill",name:G.name,skillSourceId:`findskill:${G.slug}`,description:G.description,version:G.version||G.updatedAt});F(""),re&&i()};return l.jsx(TM,{title:"添加技能",description:`从公域 Skill Hub 或 AgentKit Skill 中心添加到 ${t} 当前会话`,wide:!0,onClose:i,children:l.jsxs("div",{className:"session-skill-dialog-body",children:[l.jsxs("div",{className:"session-skill-source-tabs",role:"tablist","aria-label":"技能来源",children:[l.jsxs("button",{type:"button",role:"tab","aria-selected":a==="public",className:a==="public"?"is-active":"",onClick:()=>o("public"),children:["Skill Hub",l.jsx("span",{children:"公域"})]}),l.jsx("button",{type:"button",role:"tab","aria-selected":a==="agentkit",className:a==="agentkit"?"is-active":"",onClick:()=>o("agentkit"),children:"AgentKit Skill 中心"})]}),a==="public"?l.jsxs("section",{className:"session-public-skill-browser","aria-label":"Skill Hub 公域技能",children:[l.jsxs("div",{className:"session-public-skill-head",children:[l.jsx(Sp,{value:c,label:"搜索 Skill Hub",placeholder:"搜索技能名称、用途或关键词",onChange:u,autoFocus:!0}),l.jsxs("span",{children:[h.toLocaleString()," 个公域技能"]})]}),l.jsx("div",{className:"session-public-skill-list",children:E?l.jsx("div",{className:"session-capability-error",children:E}):m?l.jsx("div",{className:"session-capability-loading",children:"正在搜索 Skill Hub…"}):d.length===0?l.jsx("div",{className:"session-capability-empty",children:"没有匹配的公域技能"}):d.map(G=>{const re=I.has(G.name),ue=R===G.slug;return l.jsxs("article",{className:"session-skill-option session-public-skill-option",children:[l.jsxs("span",{className:"session-skill-option-copy",children:[l.jsx("strong",{children:G.name}),l.jsx("span",{children:G.description||"暂无描述"}),l.jsxs("small",{children:[G.sourceRepo||G.sourceType||"FindSkill",l.jsx("span",{"aria-hidden":"true",children:" · "}),G.downloadCount.toLocaleString()," 次下载",G.evaluationScore>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{"aria-hidden":"true",children:" · "}),G.evaluationScore.toFixed(1)," 分"]})]})]}),l.jsx("button",{type:"button",disabled:re||r||!!R,onClick:()=>void ie(G),children:re?"已添加":ue?"添加中…":l.jsxs(l.Fragment,{children:[l.jsx(SS,{}),"添加"]})})]},G.slug)})})]}):l.jsxs("div",{className:"session-skill-browser",children:[l.jsxs("section",{className:"session-skill-spaces","aria-label":"Skill Space 列表",children:[l.jsxs("div",{className:"session-skill-pane-head",children:[l.jsxs("div",{children:[l.jsx("strong",{children:"Skill Space"}),l.jsx("span",{children:x.length})]}),l.jsx(Sp,{value:S,label:"搜索 Skill Space",placeholder:"搜索空间",onChange:A,autoFocus:!0})]}),l.jsx("div",{className:"session-skill-pane-list",children:U?l.jsx("div",{className:"session-capability-loading",children:"正在读取 Skill Space…"}):V.length===0?l.jsx("div",{className:"session-capability-empty",children:"没有匹配的 Skill Space"}):V.map(G=>l.jsx("button",{type:"button",className:`session-skill-space${(_==null?void 0:_.id)===G.id?" is-active":""}`,onClick:()=>{k(G),D("")},children:l.jsxs("span",{children:[l.jsx("strong",{children:G.name||G.id}),l.jsx("small",{children:G.description||G.id}),l.jsxs("em",{children:[G.skillCount??0," 个技能"]})]})},`${G.projectName??"default"}:${G.id}`))})]}),l.jsxs("section",{className:"session-skill-results","aria-label":"AgentKit Skill 列表",children:[l.jsxs("div",{className:"session-skill-pane-head",children:[l.jsxs("div",{children:[l.jsx("strong",{title:_==null?void 0:_.name,children:(_==null?void 0:_.name)||"选择 Skill Space"}),l.jsx("span",{children:N.length})]}),l.jsx(Sp,{value:O,label:"搜索 AgentKit 技能",placeholder:"搜索技能名称或描述",onChange:D})]}),l.jsx("div",{className:"session-skill-pane-list",children:T?l.jsx("div",{className:"session-capability-error",children:T}):_?M?l.jsx("div",{className:"session-capability-loading",children:"正在读取技能…"}):W.length===0?l.jsx("div",{className:"session-capability-empty",children:"没有匹配的技能"}):W.map(G=>{const re=I.has(G.skillName),ue=R===G.skillId;return l.jsxs("article",{className:"session-skill-option",children:[l.jsxs("span",{className:"session-skill-option-copy",children:[l.jsx("strong",{children:G.skillName}),l.jsx("span",{children:G.skillDescription||"暂无描述"}),l.jsxs("small",{children:["版本 ",G.version||"—"]})]}),l.jsx("button",{type:"button",disabled:re||r||!!R,onClick:()=>void P(G),children:re?"已添加":ue?"添加中…":l.jsxs(l.Fragment,{children:[l.jsx(SS,{}),"添加"]})})]},`${G.skillId}:${G.version}`)}):l.jsx("div",{className:"session-capability-empty",children:"选择一个 Skill Space 查看技能"})})]})]})]})})}function ta({as:e="span",className:t="",duration:n=4,spread:r=20,children:s,style:i,...a}){const o=Math.min(Math.max(r,5),45);return l.jsx(e,{className:`text-shimmer${t?` ${t}`:""}`,style:{...i,backgroundImage:`linear-gradient(to right, hsl(var(--muted-foreground)) ${50-o}%, hsl(var(--foreground)) 50%, hsl(var(--muted-foreground)) ${50+o}%)`,animationDuration:`${n}s`},...a,children:s})}const kV={llm:"LLM",sequential:"顺序",parallel:"并行",loop:"循环",a2a:"A2A"};function AM(e){return 1+e.children.reduce((t,n)=>t+AM(n),0)}function _c(e){return e.id||e.name}function NV(e,t){const n=_c(e);if(e.id&&e.name&&e.name!==n)return e.name;if(t&&n==="agent")return"主 Agent";const r=/^agent_sub_(\d+)$/.exec(n);return r?`子 Agent ${r[1]}`:e.name||n}function CM(e,t=!0){return{...e,id:_c(e),name:NV(e,t),children:e.children.map(n=>CM(n,!1))}}function IM(e,t){t.set(_c(e),e.name||_c(e)),e.children.forEach(n=>IM(n,t))}function SV(e){return[...new Set(e.map(t=>t.trim()).filter(Boolean))]}function TV(e){return[...new Map(e.filter(t=>t.name.trim()).map(t=>[t.name.trim(),{...t,name:t.name.trim()}])).values()]}function OM({node:e,activeAgent:t,seen:n,path:r}){const s=_c(e),i=!!s&&s===t,a=!!s&&!i&&r.has(s),o=!!s&&!i&&!a&&n.has(s);return l.jsxs("div",{className:"topo-branch",children:[l.jsxs("div",{className:`topo-node topo-type-${e.type} ${i?"is-active":""} ${a?"is-onpath":""} ${o?"is-done":""}`,title:e.description||e.name,children:[l.jsx(xc,{className:"topo-icon"}),l.jsx("span",{className:"topo-name",children:e.name||"未命名 Agent"}),l.jsx("span",{className:"topo-badge",children:kV[e.type]??"Agent"})]}),i&&e.type==="a2a"&&l.jsx("div",{className:"topo-remote",children:"远程执行中…"}),e.children.length>0&&l.jsx("div",{className:"topo-children",children:e.children.map(c=>l.jsx(OM,{node:c,activeAgent:t,seen:n,path:r},_c(c)))})]})}function xy({title:e,count:t}){return l.jsxs("div",{className:"topo-module-title",children:[l.jsx("span",{className:"topo-module-label",title:e,children:e}),t!==void 0&&l.jsx("span",{className:"topo-section-count","aria-label":`${t} 项`,children:t})]})}function RM({appName:e,info:t,loading:n,activeAgent:r,seenAgents:s,execPath:i=[],variant:a="rail",capabilities:o=null,capabilityLoading:c=!1,capabilityMutating:u=!1,builtinTools:d=[],onAddCapability:f,onRemoveCapability:h}){const[p,m]=w.useState(null);if(n&&!t)return l.jsx("aside",{className:`topo is-loading${a==="drawer"?" is-drawer":""}`,"aria-label":"Agent 信息","aria-live":"polite",children:l.jsx(ta,{as:"span",className:"topo-loading-label",duration:2.2,children:"正在读取 Agent 信息…"})});if(!t)return null;const y=CM(t.graph??{id:t.name,name:t.name,description:t.description,type:t.type??"llm",model:t.model,tools:t.tools,skills:t.skills,path:[t.name],mentionable:!1,children:[]}),E=(o==null?void 0:o.tools)??SV(t.tools).map(k=>({id:`base:tool:${k}`,kind:"tool",name:k,custom:!1})),g=(o==null?void 0:o.skills)??TV(t.skills).map(k=>({id:`base:skill:${k.name}`,kind:"skill",name:k.name,description:k.description,custom:!1})),x=!!(o&&f&&h),b=new Set(i),_=new Map;return IM(y,_),l.jsxs("aside",{className:`topo${a==="drawer"?" is-drawer":""}`,"aria-label":"Agent 信息与拓扑",children:[l.jsxs("section",{className:"topo-agent-card","aria-label":"Agent 信息",children:[l.jsxs("div",{className:"topo-agent-heading",children:[l.jsx("h2",{title:t.name,children:t.name||"未命名 Agent"}),t.model&&l.jsx("span",{title:t.model,children:t.model})]}),t.description&&l.jsx("p",{className:"topo-description",title:t.description,children:t.description})]}),l.jsxs("div",{className:"topo-module-stack",children:[l.jsxs("section",{className:"topo-module-card topo-tools-card","aria-label":"工具",children:[l.jsx(xy,{title:"工具",count:E.length}),l.jsx("div",{className:"topo-module-scroll topo-tools-scroll",role:"region","aria-label":"工具列表",tabIndex:0,children:E.length>0?l.jsx("div",{className:"topo-tool-list",children:E.map(k=>l.jsxs("div",{className:"topo-tool",title:k.name,children:[l.jsxs("span",{className:"topo-capability-title",children:[l.jsxs("span",{className:"topo-capability-copy",children:[l.jsx("span",{className:"topo-capability-name",children:tE(k.name)}),l.jsx("code",{children:k.name})]}),k.custom&&l.jsx("span",{className:"topo-custom-badge",children:"自定义"})]}),k.custom&&l.jsx("button",{type:"button",className:"topo-remove-capability","aria-label":`移除工具 ${k.name}`,title:"移除",disabled:u,onClick:()=>h==null?void 0:h(k.id),children:"×"})]},k.id))}):l.jsx("div",{className:"topo-empty",children:"未配置"})}),x&&l.jsx("div",{className:"topo-capability-add-dock",children:l.jsxs("button",{type:"button",className:"topo-capability-add-slot","aria-label":"添加内置工具",disabled:c||u,onClick:()=>m("tool"),children:[l.jsx("span",{"aria-hidden":"true",children:"+"}),l.jsx("span",{children:"在此对话中添加工具"})]})})]}),l.jsxs("section",{className:"topo-module-card topo-skills-card","aria-label":"技能",children:[l.jsx(xy,{title:"技能",count:t.skillsPreviewSupported?g.length:void 0}),l.jsx("div",{className:"topo-module-scroll topo-skills-scroll",role:"region","aria-label":"技能列表",tabIndex:0,children:t.skillsPreviewSupported?g.length>0?l.jsx("div",{className:"topo-skill-list",children:g.map(k=>l.jsxs("div",{className:"topo-skill",title:k.description||k.name,children:[l.jsxs("div",{className:"topo-skill-title",children:[l.jsx("span",{className:"topo-skill-name",children:k.name}),k.custom&&l.jsx("span",{className:"topo-custom-badge",children:"自定义"}),k.custom&&l.jsx("button",{type:"button",className:"topo-remove-capability","aria-label":`移除技能 ${k.name}`,title:"移除",disabled:u,onClick:()=>h==null?void 0:h(k.id),children:"×"})]}),k.description&&l.jsx("span",{className:"topo-skill-description",children:k.description})]},`${k.name}:${k.description}`))}):l.jsx("div",{className:"topo-empty",children:"未配置"}):l.jsx("div",{className:"topo-empty",children:"暂不支持预览"})}),x&&l.jsx("div",{className:"topo-capability-add-dock",children:l.jsxs("button",{type:"button",className:"topo-capability-add-slot","aria-label":"添加技能",disabled:c||u,onClick:()=>m("skill"),children:[l.jsx("span",{"aria-hidden":"true",children:"+"}),l.jsx("span",{children:"在此对话中添加技能"})]})})]}),l.jsxs("section",{className:"topo-module-card topo-topology","aria-label":"Agent 拓扑",children:[l.jsx(xy,{title:"拓扑",count:AM(y)}),l.jsxs("div",{className:"topo-module-scroll topo-topology-scroll",role:"region","aria-label":"Agent 拓扑列表",tabIndex:0,children:[i.length>1&&l.jsx("div",{className:"topo-path","aria-label":"执行路径",children:i.map((k,N)=>l.jsx("span",{className:"topo-path-seg",children:l.jsx("span",{className:N===i.length-1?"topo-path-name is-current":"topo-path-name",children:_.get(k)??k})},`${k}-${N}`))}),l.jsx("div",{className:"topo-tree",children:l.jsx(OM,{node:y,activeAgent:r,seen:s,path:b})})]})]})]}),p==="tool"&&f&&l.jsx(vV,{agentName:t.name,tools:d,selectedNames:E.map(k=>k.name),mutating:u,onAdd:f,onClose:()=>m(null)}),p==="skill"&&f&&l.jsx(_V,{appName:e,agentName:t.name,selectedNames:g.map(k=>k.name),mutating:u,onAdd:f,onClose:()=>m(null)})]})}function AV(){return l.jsx("svg",{className:"icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round","aria-hidden":"true",children:l.jsx("path",{d:"M6 6l12 12M18 6 6 18"})})}function CV({appName:e,info:t,loading:n,activeAgent:r,seenAgents:s,execPath:i,capabilities:a,capabilityLoading:o,capabilityMutating:c,builtinTools:u,onAddCapability:d,onRemoveCapability:f,onClose:h,returnFocusRef:p}){return w.useEffect(()=>{const m=document.body.style.overflow;document.body.style.overflow="hidden";const y=E=>{E.key==="Escape"&&h()};return document.addEventListener("keydown",y),()=>{var E;document.removeEventListener("keydown",y),document.body.style.overflow=m,(E=p.current)==null||E.focus()}},[h,p]),l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"drawer-scrim agent-info-scrim",onClick:h}),l.jsxs("aside",{className:"drawer drawer--agent-info",role:"dialog","aria-modal":"true","aria-labelledby":"agent-info-drawer-title",children:[l.jsxs("header",{className:"drawer-head",children:[l.jsxs("div",{children:[l.jsx("div",{id:"agent-info-drawer-title",className:"drawer-title",children:"Agent 信息"}),l.jsx("div",{className:"drawer-sub",children:"能力与协作拓扑"})]}),l.jsx("button",{type:"button",className:"drawer-close",onClick:h,"aria-label":"关闭 Agent 信息",autoFocus:!0,children:l.jsx(AV,{})})]}),l.jsx("div",{className:"agent-info-drawer-body",children:t||n?l.jsx(RM,{appName:e,info:t,loading:n,activeAgent:r,seenAgents:s,execPath:i,capabilities:a,capabilityLoading:o,capabilityMutating:c,builtinTools:u,onAddCapability:d,onRemoveCapability:f,variant:"drawer"}):l.jsx("div",{className:"drawer-empty",children:"暂时无法读取 Agent 信息。"})})]})]})}function Hye(){}function TS(e){const t=[],n=String(e||"");let r=n.indexOf(","),s=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const a=n.slice(s,r).trim();(a||!i)&&t.push(a),s=r+1,r=n.indexOf(",",s)}return t}function LM(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const IV=/[$_\p{ID_Start}]/u,OV=/[$_\u{200C}\u{200D}\p{ID_Continue}]/u,RV=/[-$_\u{200C}\u{200D}\p{ID_Continue}]/u,LV=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,MV=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,MM={};function zye(e){return e?IV.test(String.fromCodePoint(e)):!1}function Vye(e,t){const r=(t||MM).jsx?RV:OV;return e?r.test(String.fromCodePoint(e)):!1}function AS(e,t){return(MM.jsx?MV:LV).test(e)}const jV=/[ \t\n\f\r]/g;function DV(e){return typeof e=="object"?e.type==="text"?CS(e.value):!1:CS(e)}function CS(e){return e.replace(jV,"")===""}let Sf=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};Sf.prototype.normal={};Sf.prototype.property={};Sf.prototype.space=void 0;function jM(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new Sf(n,r,t)}function qd(e){return e.toLowerCase()}class Vr{constructor(t,n){this.attribute=n,this.property=t}}Vr.prototype.attribute="";Vr.prototype.booleanish=!1;Vr.prototype.boolean=!1;Vr.prototype.commaOrSpaceSeparated=!1;Vr.prototype.commaSeparated=!1;Vr.prototype.defined=!1;Vr.prototype.mustUseProperty=!1;Vr.prototype.number=!1;Vr.prototype.overloadedBoolean=!1;Vr.prototype.property="";Vr.prototype.spaceSeparated=!1;Vr.prototype.space=void 0;let PV=0;const lt=qo(),On=qo(),nE=qo(),Ce=qo(),Ut=qo(),nc=qo(),qr=qo();function qo(){return 2**++PV}const rE=Object.freeze(Object.defineProperty({__proto__:null,boolean:lt,booleanish:On,commaOrSpaceSeparated:qr,commaSeparated:nc,number:Ce,overloadedBoolean:nE,spaceSeparated:Ut},Symbol.toStringTag,{value:"Module"})),wy=Object.keys(rE);class zw extends Vr{constructor(t,n,r,s){let i=-1;if(super(t,n),IS(this,"space",s),typeof r=="number")for(;++i4&&n.slice(0,4)==="data"&&HV.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(OS,VV);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!OS.test(i)){let a=i.replace($V,zV);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}s=zw}return new s(r,t)}function zV(e){return"-"+e.toLowerCase()}function VV(e){return e.charAt(1).toUpperCase()}const Tf=jM([DM,BV,FM,UM,$M],"html"),Ya=jM([DM,FV,FM,UM,$M],"svg");function RS(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function HM(e){return e.join(" ").trim()}var Vw={},LS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,KV=/\n/g,YV=/^\s*/,WV=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,GV=/^:\s*/,qV=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,XV=/^[;\s]*/,QV=/^\s+|\s+$/g,ZV=` +`,MS="/",jS="*",ho="",JV="comment",eK="declaration";function tK(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function s(m){var y=m.match(KV);y&&(n+=y.length);var E=m.lastIndexOf(ZV);r=~E?m.length-E:r+m.length}function i(){var m={line:n,column:r};return function(y){return y.position=new a(m),u(),y}}function a(m){this.start=m,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function o(m){var y=new Error(t.source+":"+n+":"+r+": "+m);if(y.reason=m,y.filename=t.source,y.line=n,y.column=r,y.source=e,!t.silent)throw y}function c(m){var y=m.exec(e);if(y){var E=y[0];return s(E),e=e.slice(E.length),y}}function u(){c(YV)}function d(m){var y;for(m=m||[];y=f();)y!==!1&&m.push(y);return m}function f(){var m=i();if(!(MS!=e.charAt(0)||jS!=e.charAt(1))){for(var y=2;ho!=e.charAt(y)&&(jS!=e.charAt(y)||MS!=e.charAt(y+1));)++y;if(y+=2,ho===e.charAt(y-1))return o("End of comment missing");var E=e.slice(2,y-2);return r+=2,s(E),e=e.slice(y),r+=2,m({type:JV,comment:E})}}function h(){var m=i(),y=c(WV);if(y){if(f(),!c(GV))return o("property missing ':'");var E=c(qV),g=m({type:eK,property:DS(y[0].replace(LS,ho)),value:E?DS(E[0].replace(LS,ho)):ho});return c(XV),g}}function p(){var m=[];d(m);for(var y;y=h();)y!==!1&&(m.push(y),d(m));return m}return u(),p()}function DS(e){return e?e.replace(QV,ho):ho}var nK=tK,rK=$p&&$p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Vw,"__esModule",{value:!0});Vw.default=iK;const sK=rK(nK);function iK(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,sK.default)(e),s=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:a,value:o}=i;s?t(a,o,i):o&&(n=n||{},n[a]=o)}),n}var jg={};Object.defineProperty(jg,"__esModule",{value:!0});jg.camelCase=void 0;var aK=/^--[a-zA-Z0-9_-]+$/,oK=/-([a-z])/g,lK=/^[^-]+$/,cK=/^-(webkit|moz|ms|o|khtml)-/,uK=/^-(ms)-/,dK=function(e){return!e||lK.test(e)||aK.test(e)},fK=function(e,t){return t.toUpperCase()},PS=function(e,t){return"".concat(t,"-")},hK=function(e,t){return t===void 0&&(t={}),dK(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(uK,PS):e=e.replace(cK,PS),e.replace(oK,fK))};jg.camelCase=hK;var pK=$p&&$p.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},mK=pK(Vw),gK=jg;function sE(e,t){var n={};return!e||typeof e!="string"||(0,mK.default)(e,function(r,s){r&&s&&(n[(0,gK.camelCase)(r,t)]=s)}),n}sE.default=sE;var yK=sE;const bK=pf(yK),Dg=zM("end"),_i=zM("start");function zM(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 EK(e){const t=_i(e),n=Dg(e);if(t&&n)return{start:t,end:n}}function cd(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?BS(e.position):"start"in e||"end"in e?BS(e):"line"in e||"column"in e?iE(e):""}function iE(e){return FS(e&&e.line)+":"+FS(e&&e.column)}function BS(e){return iE(e&&e.start)+"-"+iE(e&&e.end)}function FS(e){return e&&typeof e=="number"?e:1}class yr extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},a=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?s=t:!i.cause&&t&&(a=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=o?o.line:void 0,this.name=cd(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}yr.prototype.file="";yr.prototype.name="";yr.prototype.reason="";yr.prototype.message="";yr.prototype.stack="";yr.prototype.column=void 0;yr.prototype.line=void 0;yr.prototype.ancestors=void 0;yr.prototype.cause=void 0;yr.prototype.fatal=void 0;yr.prototype.place=void 0;yr.prototype.ruleId=void 0;yr.prototype.source=void 0;const Kw={}.hasOwnProperty,xK=new Map,wK=/[A-Z]/g,vK=new Set(["table","tbody","thead","tfoot","tr"]),_K=new Set(["td","th"]),VM="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function kK(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=RK(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=OK(n,t.jsx,t.jsxs)}const s={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"?Ya:Tf,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=KM(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function KM(e,t,n){if(t.type==="element")return NK(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return SK(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return AK(e,t,n);if(t.type==="mdxjsEsm")return TK(e,t);if(t.type==="root")return CK(e,t,n);if(t.type==="text")return IK(e,t)}function NK(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Ya,e.schema=s),e.ancestors.push(t);const i=WM(e,t.tagName,!1),a=LK(e,t);let o=Ww(e,t);return vK.has(t.tagName)&&(o=o.filter(function(c){return typeof c=="string"?!DV(c):!0})),YM(e,a,i,t),Yw(a,o),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function SK(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)}Xd(e,t.position)}function TK(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Xd(e,t.position)}function AK(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=Ya,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:WM(e,t.name,!0),a=MK(e,t),o=Ww(e,t);return YM(e,a,i,t),Yw(a,o),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function CK(e,t,n){const r={};return Yw(r,Ww(e,t)),e.create(t,e.Fragment,r,n)}function IK(e,t){return t.value}function YM(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Yw(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function OK(e,t,n){return r;function r(s,i,a,o){const u=Array.isArray(a.children)?n:t;return o?u(i,a,o):u(i,a)}}function RK(e,t){return n;function n(r,s,i,a){const o=Array.isArray(i.children),c=_i(r);return t(s,i,a,o,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function LK(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&Kw.call(t.properties,s)){const i=jK(e,s,t.properties[s]);if(i){const[a,o]=i;e.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&_K.has(t.tagName)?r=o:n[a]=o}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function MK(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const a=i.expression;a.type;const o=a.properties[0];o.type,Object.assign(n,e.evaluater.evaluateExpression(o.argument))}else Xd(e,t.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const o=r.value.data.estree.body[0];o.type,i=e.evaluater.evaluateExpression(o.expression)}else Xd(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function Ww(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:xK;for(;++rs?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);i0?(ts(e,e.length,0,t),e):t}const HS={}.hasOwnProperty;function qM(e){const t={};let n=-1;for(;++n13&&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 Xs(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Nr=Wa(/[A-Za-z]/),pr=Wa(/[\dA-Za-z]/),VK=Wa(/[#-'*+\--9=?A-Z^-~]/);function Tm(e){return e!==null&&(e<32||e===127)}const aE=Wa(/\d/),KK=Wa(/[\dA-Fa-f]/),YK=Wa(/[!-/:-@[-`{-~]/);function qe(e){return e!==null&&e<-2}function Dt(e){return e!==null&&(e<0||e===32)}function yt(e){return e===-2||e===-1||e===32}const Pg=Wa(new RegExp("\\p{P}|\\p{S}","u")),Fo=Wa(/\s/);function Wa(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Gc(e){const t=[];let n=-1,r=0,s=0;for(;++n55295&&i<57344){const o=e.charCodeAt(n+1);i<56320&&o>56319&&o<57344?(a=String.fromCharCode(i,o),s=1):a="�"}else a=String.fromCharCode(i);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+s+1,a=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function _t(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(c){return yt(c)?(e.enter(n),o(c)):t(c)}function o(c){return yt(c)&&i++a))return;const C=t.events.length;let S=C,A,O;for(;S--;)if(t.events[S][0]==="exit"&&t.events[S][1].type==="chunkFlow"){if(A){O=t.events[S][1].end;break}A=!0}for(g(r),N=C;Nb;){const k=n[_];t.containerState=k[1],k[0].exit.call(t,e)}n.length=b}function x(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function QK(e,t,n){return _t(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function kc(e){if(e===null||Dt(e)||Fo(e))return 1;if(Pg(e))return 2}function Bg(e,t,n){const r=[];let s=-1;for(;++s1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[r][1].end},h={...e[n][1].start};VS(f,-c),VS(h,c),a={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},o={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},i={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},e[r][1].end={...a.start},e[n][1].start={...o.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=ys(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=ys(u,[["enter",s,t],["enter",a,t],["exit",a,t],["enter",i,t]]),u=ys(u,Bg(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=ys(u,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=ys(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,ts(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n0&&yt(N)?_t(e,x,"linePrefix",i+1)(N):x(N)}function x(N){return N===null||qe(N)?e.check(KS,y,_)(N):(e.enter("codeFlowValue"),b(N))}function b(N){return N===null||qe(N)?(e.exit("codeFlowValue"),x(N)):(e.consume(N),b)}function _(N){return e.exit("codeFenced"),t(N)}function k(N,C,S){let A=0;return O;function O(j){return N.enter("lineEnding"),N.consume(j),N.exit("lineEnding"),D}function D(j){return N.enter("codeFencedFence"),yt(j)?_t(N,U,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):U(j)}function U(j){return j===o?(N.enter("codeFencedFenceSequence"),X(j)):S(j)}function X(j){return j===o?(A++,N.consume(j),X):A>=a?(N.exit("codeFencedFenceSequence"),yt(j)?_t(N,M,"whitespace")(j):M(j)):S(j)}function M(j){return j===null||qe(j)?(N.exit("codeFencedFence"),C(j)):S(j)}}}function cY(e,t,n){const r=this;return s;function s(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const _y={name:"codeIndented",tokenize:dY},uY={partial:!0,tokenize:fY};function dY(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),_t(e,i,"linePrefix",5)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?a(u):n(u)}function a(u){return u===null?c(u):qe(u)?e.attempt(uY,a,c)(u):(e.enter("codeFlowValue"),o(u))}function o(u){return u===null||qe(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),o)}function c(u){return e.exit("codeIndented"),t(u)}}function fY(e,t,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):qe(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):_t(e,i,"linePrefix",5)(a)}function i(a){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?t(a):qe(a)?s(a):n(a)}}const hY={name:"codeText",previous:mY,resolve:pY,tokenize:gY};function pY(e){let t=e.length-4,n=3,r,s;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=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 tthis.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 s=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&Eu(this.left,r),i.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),Eu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Eu(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=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function t3(e,t,n,r,s,i,a,o,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(g){return g===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(g),e.exit(i),h):g===null||g===32||g===41||Tm(g)?n(g):(e.enter(r),e.enter(a),e.enter(o),e.enter("chunkString",{contentType:"string"}),y(g))}function h(g){return g===62?(e.enter(i),e.consume(g),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(o),e.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===62?(e.exit("chunkString"),e.exit(o),h(g)):g===null||g===60||qe(g)?n(g):(e.consume(g),g===92?m:p)}function m(g){return g===60||g===62||g===92?(e.consume(g),p):p(g)}function y(g){return!d&&(g===null||g===41||Dt(g))?(e.exit("chunkString"),e.exit(o),e.exit(a),e.exit(r),t(g)):d999||p===null||p===91||p===93&&!c||p===94&&!o&&"_hiddenFootnoteSupport"in a.parser.constructs?n(p):p===93?(e.exit(i),e.enter(s),e.consume(p),e.exit(s),e.exit(r),t):qe(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||qe(p)||o++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!yt(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),o++,f):f(p)}}function r3(e,t,n,r,s,i){let a;return o;function o(h){return h===34||h===39||h===40?(e.enter(r),e.enter(s),e.consume(h),e.exit(s),a=h===40?41:h,c):n(h)}function c(h){return h===a?(e.enter(s),e.consume(h),e.exit(s),e.exit(r),t):(e.enter(i),u(h))}function u(h){return h===a?(e.exit(i),c(a)):h===null?n(h):qe(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),_t(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===a||h===null||qe(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?f:d)}function f(h){return h===a||h===92?(e.consume(h),d):d(h)}}function ud(e,t){let n;return r;function r(s){return qe(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):yt(s)?_t(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const kY={name:"definition",tokenize:SY},NY={partial:!0,tokenize:TY};function SY(e,t,n){const r=this;let s;return i;function i(p){return e.enter("definition"),a(p)}function a(p){return n3.call(r,e,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function o(p){return s=Xs(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),c):n(p)}function c(p){return Dt(p)?ud(e,u)(p):u(p)}function u(p){return t3(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(NY,f,f)(p)}function f(p){return yt(p)?_t(e,h,"whitespace")(p):h(p)}function h(p){return p===null||qe(p)?(e.exit("definition"),r.parser.defined.push(s),t(p)):n(p)}}function TY(e,t,n){return r;function r(o){return Dt(o)?ud(e,s)(o):n(o)}function s(o){return r3(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return yt(o)?_t(e,a,"whitespace")(o):a(o)}function a(o){return o===null||qe(o)?t(o):n(o)}}const AY={name:"hardBreakEscape",tokenize:CY};function CY(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return qe(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const IY={name:"headingAtx",resolve:OY,tokenize:RY};function OY(e,t){let n=e.length-2,r=3,s,i;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&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},ts(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function RY(e,t,n){let r=0;return s;function s(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&r++<6?(e.consume(d),a):d===null||Dt(d)?(e.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||qe(d)?(e.exit("atxHeading"),t(d)):yt(d)?_t(e,o,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),o(d))}function u(d){return d===null||d===35||Dt(d)?(e.exit("atxHeadingText"),o(d)):(e.consume(d),u)}}const LY=["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"],WS=["pre","script","style","textarea"],MY={concrete:!0,name:"htmlFlow",resolveTo:PY,tokenize:BY},jY={partial:!0,tokenize:UY},DY={partial:!0,tokenize:FY};function PY(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 BY(e,t,n){const r=this;let s,i,a,o,c;return u;function u(P){return d(P)}function d(P){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(P),f}function f(P){return P===33?(e.consume(P),h):P===47?(e.consume(P),i=!0,y):P===63?(e.consume(P),s=3,r.interrupt?t:I):Nr(P)?(e.consume(P),a=String.fromCharCode(P),E):n(P)}function h(P){return P===45?(e.consume(P),s=2,p):P===91?(e.consume(P),s=5,o=0,m):Nr(P)?(e.consume(P),s=4,r.interrupt?t:I):n(P)}function p(P){return P===45?(e.consume(P),r.interrupt?t:I):n(P)}function m(P){const ie="CDATA[";return P===ie.charCodeAt(o++)?(e.consume(P),o===ie.length?r.interrupt?t:U:m):n(P)}function y(P){return Nr(P)?(e.consume(P),a=String.fromCharCode(P),E):n(P)}function E(P){if(P===null||P===47||P===62||Dt(P)){const ie=P===47,G=a.toLowerCase();return!ie&&!i&&WS.includes(G)?(s=1,r.interrupt?t(P):U(P)):LY.includes(a.toLowerCase())?(s=6,ie?(e.consume(P),g):r.interrupt?t(P):U(P)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(P):i?x(P):b(P))}return P===45||pr(P)?(e.consume(P),a+=String.fromCharCode(P),E):n(P)}function g(P){return P===62?(e.consume(P),r.interrupt?t:U):n(P)}function x(P){return yt(P)?(e.consume(P),x):O(P)}function b(P){return P===47?(e.consume(P),O):P===58||P===95||Nr(P)?(e.consume(P),_):yt(P)?(e.consume(P),b):O(P)}function _(P){return P===45||P===46||P===58||P===95||pr(P)?(e.consume(P),_):k(P)}function k(P){return P===61?(e.consume(P),N):yt(P)?(e.consume(P),k):b(P)}function N(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(e.consume(P),c=P,C):yt(P)?(e.consume(P),N):S(P)}function C(P){return P===c?(e.consume(P),c=null,A):P===null||qe(P)?n(P):(e.consume(P),C)}function S(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||Dt(P)?k(P):(e.consume(P),S)}function A(P){return P===47||P===62||yt(P)?b(P):n(P)}function O(P){return P===62?(e.consume(P),D):n(P)}function D(P){return P===null||qe(P)?U(P):yt(P)?(e.consume(P),D):n(P)}function U(P){return P===45&&s===2?(e.consume(P),T):P===60&&s===1?(e.consume(P),L):P===62&&s===4?(e.consume(P),V):P===63&&s===3?(e.consume(P),I):P===93&&s===5?(e.consume(P),F):qe(P)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(jY,W,X)(P)):P===null||qe(P)?(e.exit("htmlFlowData"),X(P)):(e.consume(P),U)}function X(P){return e.check(DY,M,W)(P)}function M(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),j}function j(P){return P===null||qe(P)?X(P):(e.enter("htmlFlowData"),U(P))}function T(P){return P===45?(e.consume(P),I):U(P)}function L(P){return P===47?(e.consume(P),a="",R):U(P)}function R(P){if(P===62){const ie=a.toLowerCase();return WS.includes(ie)?(e.consume(P),V):U(P)}return Nr(P)&&a.length<8?(e.consume(P),a+=String.fromCharCode(P),R):U(P)}function F(P){return P===93?(e.consume(P),I):U(P)}function I(P){return P===62?(e.consume(P),V):P===45&&s===2?(e.consume(P),I):U(P)}function V(P){return P===null||qe(P)?(e.exit("htmlFlowData"),W(P)):(e.consume(P),V)}function W(P){return e.exit("htmlFlow"),t(P)}}function FY(e,t,n){const r=this;return s;function s(a){return qe(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):n(a)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function UY(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Af,t,n)}}const $Y={name:"htmlText",tokenize:HY};function HY(e,t,n){const r=this;let s,i,a;return o;function o(I){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(I),c}function c(I){return I===33?(e.consume(I),u):I===47?(e.consume(I),k):I===63?(e.consume(I),b):Nr(I)?(e.consume(I),S):n(I)}function u(I){return I===45?(e.consume(I),d):I===91?(e.consume(I),i=0,m):Nr(I)?(e.consume(I),x):n(I)}function d(I){return I===45?(e.consume(I),p):n(I)}function f(I){return I===null?n(I):I===45?(e.consume(I),h):qe(I)?(a=f,L(I)):(e.consume(I),f)}function h(I){return I===45?(e.consume(I),p):f(I)}function p(I){return I===62?T(I):I===45?h(I):f(I)}function m(I){const V="CDATA[";return I===V.charCodeAt(i++)?(e.consume(I),i===V.length?y:m):n(I)}function y(I){return I===null?n(I):I===93?(e.consume(I),E):qe(I)?(a=y,L(I)):(e.consume(I),y)}function E(I){return I===93?(e.consume(I),g):y(I)}function g(I){return I===62?T(I):I===93?(e.consume(I),g):y(I)}function x(I){return I===null||I===62?T(I):qe(I)?(a=x,L(I)):(e.consume(I),x)}function b(I){return I===null?n(I):I===63?(e.consume(I),_):qe(I)?(a=b,L(I)):(e.consume(I),b)}function _(I){return I===62?T(I):b(I)}function k(I){return Nr(I)?(e.consume(I),N):n(I)}function N(I){return I===45||pr(I)?(e.consume(I),N):C(I)}function C(I){return qe(I)?(a=C,L(I)):yt(I)?(e.consume(I),C):T(I)}function S(I){return I===45||pr(I)?(e.consume(I),S):I===47||I===62||Dt(I)?A(I):n(I)}function A(I){return I===47?(e.consume(I),T):I===58||I===95||Nr(I)?(e.consume(I),O):qe(I)?(a=A,L(I)):yt(I)?(e.consume(I),A):T(I)}function O(I){return I===45||I===46||I===58||I===95||pr(I)?(e.consume(I),O):D(I)}function D(I){return I===61?(e.consume(I),U):qe(I)?(a=D,L(I)):yt(I)?(e.consume(I),D):A(I)}function U(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),s=I,X):qe(I)?(a=U,L(I)):yt(I)?(e.consume(I),U):(e.consume(I),M)}function X(I){return I===s?(e.consume(I),s=void 0,j):I===null?n(I):qe(I)?(a=X,L(I)):(e.consume(I),X)}function M(I){return I===null||I===34||I===39||I===60||I===61||I===96?n(I):I===47||I===62||Dt(I)?A(I):(e.consume(I),M)}function j(I){return I===47||I===62||Dt(I)?A(I):n(I)}function T(I){return I===62?(e.consume(I),e.exit("htmlTextData"),e.exit("htmlText"),t):n(I)}function L(I){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),R}function R(I){return yt(I)?_t(e,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):F(I)}function F(I){return e.enter("htmlTextData"),a(I)}}const Xw={name:"labelEnd",resolveAll:YY,resolveTo:WY,tokenize:GY},zY={tokenize:qY},VY={tokenize:XY},KY={tokenize:QY};function YY(e){let t=-1;const n=[];for(;++t=3&&(u===null||qe(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===s?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),yt(u)?_t(e,o,"whitespace")(u):o(u))}}const jr={continuation:{tokenize:oW},exit:cW,name:"list",tokenize:aW},sW={partial:!0,tokenize:uW},iW={partial:!0,tokenize:lW};function aW(e,t,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return o;function o(p){const m=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:aE(p)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Tp,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return aE(p)&&++a<10?(e.consume(p),c):(!r.interrupt||a<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(Af,r.interrupt?n:d,e.attempt(sW,h,f))}function d(p){return r.containerState.initialBlankLine=!0,i++,h(p)}function f(p){return yt(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function oW(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Af,s,i);function s(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,_t(e,t,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!yt(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(iW,t,a)(o))}function a(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,_t(e,e.attempt(jr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function lW(e,t,n){const r=this;return _t(e,s,"listItemIndent",r.containerState.size+1);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(i):n(i)}}function cW(e){e.exit(this.containerState.type)}function uW(e,t,n){const r=this;return _t(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const a=r.events[r.events.length-1];return!yt(i)&&a&&a[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const GS={name:"setextUnderline",resolveTo:dW,tokenize:fW};function dW(e,t){let n=e.length,r,s,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",a,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function fW(e,t,n){const r=this;let s;return i;function i(u){let d=r.events.length,f;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){f=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),s=u,a(u)):n(u)}function a(u){return e.enter("setextHeadingLineSequence"),o(u)}function o(u){return u===s?(e.consume(u),o):(e.exit("setextHeadingLineSequence"),yt(u)?_t(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||qe(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const hW={tokenize:pW};function pW(e){const t=this,n=e.attempt(Af,r,e.attempt(this.parser.constructs.flowInitial,s,_t(e,e.attempt(this.parser.constructs.flow,s,e.attempt(EY,s)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const mW={resolveAll:i3()},gW=s3("string"),yW=s3("text");function s3(e){return{resolveAll:i3(e==="text"?bW:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],i=n.attempt(s,a,o);return a;function a(d){return u(d)?i(d):o(d)}function o(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const f=s[d];let h=-1;if(f)for(;++h-1){const o=a[0];typeof o=="string"?a[0]=o.slice(r):a.shift()}i>0&&a.push(e[s].slice(0,i))}return a}function OW(e,t){let n=-1;const r=[];let s;for(;++n0){const Ye=oe.tokenStack[oe.tokenStack.length-1];(Ye[1]||QS).call(oe,void 0,Ye[0])}for(Q.position={start:ca(B.length>0?B[0][1].start:{line:1,column:1,offset:0}),end:ca(B.length>0?B[B.length-2][1].end:{line:1,column:1,offset:0})},Oe=-1;++Oe0&&(r.className=["language-"+s[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function YW(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function WW(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function GW(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=qc(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let a,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=i+1,o+=1,e.footnoteCounts.set(r,o);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function qW(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 XW(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function c3(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 s=e.all(t),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const a=s[s.length-1];return a&&a.type==="text"?a.value+=r:s.push({type:"text",value:r}),s}function QW(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return c3(e,t);const s={src:qc(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,i),e.applyData(t,i)}function ZW(e,t){const n={src:qc(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 JW(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 eG(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return c3(e,t);const s={href:qc(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function tG(e,t){const n={href:qc(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 nG(e,t,n){const r=e.all(t),s=n?rG(n):u3(t),i={},a=[];if(typeof t.checked=="boolean"){const d=r[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let o=-1;for(;++o0){const Ye=oe.tokenStack[oe.tokenStack.length-1];(Ye[1]||XS).call(oe,void 0,Ye[0])}for(Q.position={start:ca(B.length>0?B[0][1].start:{line:1,column:1,offset:0}),end:ca(B.length>0?B[B.length-2][1].end:{line:1,column:1,offset:0})},Oe=-1;++Oe0&&(r.className=["language-"+s[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function KW(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function YW(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function WW(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=Gc(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let a,o=e.footnoteCounts.get(r);o===void 0?(o=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=i+1,o+=1,e.footnoteCounts.set(r,o);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function GW(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 qW(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function l3(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 s=e.all(t),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const a=s[s.length-1];return a&&a.type==="text"?a.value+=r:s.push({type:"text",value:r}),s}function XW(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return l3(e,t);const s={src:Gc(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,i),e.applyData(t,i)}function QW(e,t){const n={src:Gc(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 ZW(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 JW(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return l3(e,t);const s={href:Gc(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function eG(e,t){const n={href:Gc(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 tG(e,t,n){const r=e.all(t),s=n?nG(n):c3(t),i={},a=[];if(typeof t.checked=="boolean"){const d=r[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let o=-1;for(;++o1}function sG(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=_i(t.children[1]),c=Pg(t.children[t.children.length-1]);o&&c&&(a.position={start:o,end:c}),s.push(a)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function cG(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,o=a?a.length:t.children.length;let c=-1;const u=[];for(;++c0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(eT(t.slice(s),s>0,!1)),i.join("")}function eT(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===ZS||i===JS;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===ZS||i===JS;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function fG(e,t){const n={type:"text",value:dG(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function hG(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const pG={blockquote:zW,break:VW,code:KW,delete:YW,emphasis:WW,footnoteReference:GW,heading:qW,html:XW,imageReference:QW,image:ZW,inlineCode:JW,linkReference:eG,link:tG,listItem:nG,list:sG,paragraph:iG,root:aG,strong:oG,table:lG,tableCell:uG,tableRow:cG,text:fG,thematicBreak:hG,toml:Mh,yaml:Mh,definition:Mh,footnoteDefinition:Mh};function Mh(){}const d3=-1,Ug=0,fd=1,Cm=2,Zw=3,Jw=4,ev=5,tv=6,f3=7,h3=8,mG=typeof self=="object"?self:globalThis,tT=(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 mG[e](t)},gG=(e,t)=>{const n=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,a]=t[s];switch(i){case Ug:case d3:return n(a,s);case fd:{const o=n([],s);for(const c of a)o.push(r(c));return o}case Cm:{const o=n({},s);for(const[c,u]of a)o[r(c)]=r(u);return o}case Zw:return n(new Date(a),s);case Jw:{const{source:o,flags:c}=a;return n(new RegExp(o,c),s)}case ev:{const o=n(new Map,s);for(const[c,u]of a)o.set(r(c),r(u));return o}case tv:{const o=n(new Set,s);for(const c of a)o.add(r(c));return o}case f3:{const{name:o,message:c}=a;return n(tT(o,c),s)}case h3:return n(BigInt(a),s);case"BigInt":return n(Object(BigInt(a)),s);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:o}=new Uint8Array(a);return n(new DataView(o),a)}}return n(tT(i,a),s)};return r},nT=e=>gG(new Map,e)(0),fl="",{toString:yG}={},{keys:bG}=Object,wu=e=>{const t=typeof e;if(t!=="object"||!e)return[Ug,t];const n=yG.call(e).slice(8,-1);switch(n){case"Array":return[fd,fl];case"Object":return[Cm,fl];case"Date":return[Zw,fl];case"RegExp":return[Jw,fl];case"Map":return[ev,fl];case"Set":return[tv,fl];case"DataView":return[fd,n]}return n.includes("Array")?[fd,n]:n.includes("Error")?[f3,n]:[Cm,n]},jh=([e,t])=>e===Ug&&(t==="function"||t==="symbol"),EG=(e,t,n,r)=>{const s=(a,o)=>{const c=r.push(a)-1;return n.set(o,c),c},i=a=>{if(n.has(a))return n.get(a);let[o,c]=wu(a);switch(o){case Ug:{let d=a;switch(c){case"bigint":o=h3,d=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return s([d3],a)}return s([o,d],a)}case fd:{if(c){let h=a;return c==="DataView"?h=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(h=new Uint8Array(a)),s([c,[...h]],a)}const d=[],f=s([o,d],a);for(const h of a)d.push(i(h));return f}case Cm:{if(c)switch(c){case"BigInt":return s([c,a.toString()],a);case"Boolean":case"Number":case"String":return s([c,a.valueOf()],a)}if(t&&"toJSON"in a)return i(a.toJSON());const d=[],f=s([o,d],a);for(const h of bG(a))(e||!jh(wu(a[h])))&&d.push([i(h),i(a[h])]);return f}case Zw:return s([o,a.toISOString()],a);case Jw:{const{source:d,flags:f}=a;return s([o,{source:d,flags:f}],a)}case ev:{const d=[],f=s([o,d],a);for(const[h,p]of a)(e||!(jh(wu(h))||jh(wu(p))))&&d.push([i(h),i(p)]);return f}case tv:{const d=[],f=s([o,d],a);for(const h of a)(e||!jh(wu(h)))&&d.push(i(h));return f}}const{message:u}=a;return s([o,{name:c,message:u}],a)};return i},rT=(e,{json:t,lossy:n}={})=>{const r=[];return EG(!(t||n),!!t,new Map,r)(e),r},Sc=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?nT(rT(e,t)):structuredClone(e):(e,t)=>nT(rT(e,t));function xG(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 wG(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function vG(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||xG,r=e.options.footnoteBackLabel||wG,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let c=-1;for(;++c0&&m.push({type:"text",value:" "});let x=typeof n=="string"?n:n(c,p);typeof x=="string"&&(x={type:"text",value:x}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,p),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const E=d[d.length-1];if(E&&E.type==="element"&&E.tagName==="p"){const x=E.children[E.children.length-1];x&&x.type==="text"?x.value+=" ":E.children.push({type:"text",value:" "}),E.children.push(...m)}else d.push(...m);const g={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(d,!0)};e.patch(u,g),o.push(g)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Sc(a),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:` +`});const u={type:"element",tagName:"li",properties:i,children:a};return e.patch(t,u),e.applyData(t,u)}function nG(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r1}function rG(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},o=_i(t.children[1]),c=Dg(t.children[t.children.length-1]);o&&c&&(a.position={start:o,end:c}),s.push(a)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function lG(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,o=a?a.length:t.children.length;let c=-1;const u=[];for(;++c0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(JS(t.slice(s),s>0,!1)),i.join("")}function JS(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===QS||i===ZS;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===QS||i===ZS;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function dG(e,t){const n={type:"text",value:uG(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function fG(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const hG={blockquote:HW,break:zW,code:VW,delete:KW,emphasis:YW,footnoteReference:WW,heading:GW,html:qW,imageReference:XW,image:QW,inlineCode:ZW,linkReference:JW,link:eG,listItem:tG,list:rG,paragraph:sG,root:iG,strong:aG,table:oG,tableCell:cG,tableRow:lG,text:dG,thematicBreak:fG,toml:Lh,yaml:Lh,definition:Lh,footnoteDefinition:Lh};function Lh(){}const u3=-1,Fg=0,dd=1,Am=2,Qw=3,Zw=4,Jw=5,ev=6,d3=7,f3=8,pG=typeof self=="object"?self:globalThis,eT=(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 pG[e](t)},mG=(e,t)=>{const n=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,a]=t[s];switch(i){case Fg:case u3:return n(a,s);case dd:{const o=n([],s);for(const c of a)o.push(r(c));return o}case Am:{const o=n({},s);for(const[c,u]of a)o[r(c)]=r(u);return o}case Qw:return n(new Date(a),s);case Zw:{const{source:o,flags:c}=a;return n(new RegExp(o,c),s)}case Jw:{const o=n(new Map,s);for(const[c,u]of a)o.set(r(c),r(u));return o}case ev:{const o=n(new Set,s);for(const c of a)o.add(r(c));return o}case d3:{const{name:o,message:c}=a;return n(eT(o,c),s)}case f3:return n(BigInt(a),s);case"BigInt":return n(Object(BigInt(a)),s);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:o}=new Uint8Array(a);return n(new DataView(o),a)}}return n(eT(i,a),s)};return r},tT=e=>mG(new Map,e)(0),dl="",{toString:gG}={},{keys:yG}=Object,xu=e=>{const t=typeof e;if(t!=="object"||!e)return[Fg,t];const n=gG.call(e).slice(8,-1);switch(n){case"Array":return[dd,dl];case"Object":return[Am,dl];case"Date":return[Qw,dl];case"RegExp":return[Zw,dl];case"Map":return[Jw,dl];case"Set":return[ev,dl];case"DataView":return[dd,n]}return n.includes("Array")?[dd,n]:n.includes("Error")?[d3,n]:[Am,n]},Mh=([e,t])=>e===Fg&&(t==="function"||t==="symbol"),bG=(e,t,n,r)=>{const s=(a,o)=>{const c=r.push(a)-1;return n.set(o,c),c},i=a=>{if(n.has(a))return n.get(a);let[o,c]=xu(a);switch(o){case Fg:{let d=a;switch(c){case"bigint":o=f3,d=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return s([u3],a)}return s([o,d],a)}case dd:{if(c){let h=a;return c==="DataView"?h=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(h=new Uint8Array(a)),s([c,[...h]],a)}const d=[],f=s([o,d],a);for(const h of a)d.push(i(h));return f}case Am:{if(c)switch(c){case"BigInt":return s([c,a.toString()],a);case"Boolean":case"Number":case"String":return s([c,a.valueOf()],a)}if(t&&"toJSON"in a)return i(a.toJSON());const d=[],f=s([o,d],a);for(const h of yG(a))(e||!Mh(xu(a[h])))&&d.push([i(h),i(a[h])]);return f}case Qw:return s([o,a.toISOString()],a);case Zw:{const{source:d,flags:f}=a;return s([o,{source:d,flags:f}],a)}case Jw:{const d=[],f=s([o,d],a);for(const[h,p]of a)(e||!(Mh(xu(h))||Mh(xu(p))))&&d.push([i(h),i(p)]);return f}case ev:{const d=[],f=s([o,d],a);for(const h of a)(e||!Mh(xu(h)))&&d.push(i(h));return f}}const{message:u}=a;return s([o,{name:c,message:u}],a)};return i},nT=(e,{json:t,lossy:n}={})=>{const r=[];return bG(!(t||n),!!t,new Map,r)(e),r},Nc=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?tT(nT(e,t)):structuredClone(e):(e,t)=>tT(nT(e,t));function EG(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 xG(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function wG(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||EG,r=e.options.footnoteBackLabel||xG,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let c=-1;for(;++c0&&m.push({type:"text",value:" "});let x=typeof n=="string"?n:n(c,p);typeof x=="string"&&(x={type:"text",value:x}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,p),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const E=d[d.length-1];if(E&&E.type==="element"&&E.tagName==="p"){const x=E.children[E.children.length-1];x&&x.type==="text"?x.value+=" ":E.children.push({type:"text",value:" "}),E.children.push(...m)}else d.push(...m);const g={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(d,!0)};e.patch(u,g),o.push(g)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Nc(a),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:` `},{type:"element",tagName:"ol",properties:{},children:e.wrap(o,!0)},{type:"text",value:` -`}]}}const If=function(e){if(e==null)return SG;if(typeof e=="function")return $g(e);if(typeof e=="object")return Array.isArray(e)?_G(e):kG(e);if(typeof e=="string")return NG(e);throw new Error("Expected function, string, or object as test")};function _G(e){const t=[];let n=-1;for(;++n":""))+")"})}return h;function h(){let p=p3,m,y,E;if((!t||i(c,u,d[d.length-1]||void 0))&&(p=IG(n(c,d)),p[0]===cE))return p;if("children"in c&&c.children){const g=c;if(g.children&&p[0]!==CG)for(y=(r?g.children.length:-1)+a,E=d.concat(g);y>-1&&y":""))+")"})}return h;function h(){let p=h3,m,y,E;if((!t||i(c,u,d[d.length-1]||void 0))&&(p=CG(n(c,d)),p[0]===lE))return p;if("children"in c&&c.children){const g=c;if(g.children&&p[0]!==AG)for(y=(r?g.children.length:-1)+a,E=d.concat(g);y>-1&&y0&&n.push({type:"text",value:` -`}),n}function sT(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function iT(e,t){const n=RG(e,t),r=n.one(e,void 0),s=vG(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:` -`},s),i}function PG(e,t){return e&&"run"in e?async function(n,r){const s=iT(n,{file:r,...t});await e.run(s,r)}:function(n,r){return iT(n,{file:r,...e||t})}}function aT(e){if(e)throw e}var Cp=Object.prototype.hasOwnProperty,g3=Object.prototype.toString,oT=Object.defineProperty,lT=Object.getOwnPropertyDescriptor,cT=function(t){return typeof Array.isArray=="function"?Array.isArray(t):g3.call(t)==="[object Array]"},uT=function(t){if(!t||g3.call(t)!=="[object Object]")return!1;var n=Cp.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Cp.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||Cp.call(t,s)},dT=function(t,n){oT&&n.name==="__proto__"?oT(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},fT=function(t,n){if(n==="__proto__")if(Cp.call(t,n)){if(lT)return lT(t,n).value}else return;return t[n]},BG=function e(){var t,n,r,s,i,a,o=arguments[0],c=1,u=arguments.length,d=!1;for(typeof o=="boolean"&&(d=o,o=arguments[1]||{},c=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});ca.length;let c;o&&a.push(s);try{c=e.apply(this,a)}catch(u){const d=u;if(o&&n)throw d;return s(d)}o||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(a,...o){n||(n=!0,t(a,...o))}function i(a){s(null,a)}}const ui={basename:$G,dirname:HG,extname:zG,join:VG,sep:"/"};function $G(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Rf(e);let n=0,r=-1,s=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,o=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else a<0&&(i=!0,a=s+1),o>-1&&(e.codePointAt(s)===t.codePointAt(o--)?o<0&&(r=s):(o=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function HG(e){if(Rf(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 zG(e){Rf(e);let t=e.length,n=-1,r=0,s=-1,i=0,a;for(;t--;){const o=e.codePointAt(t);if(o===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),o===46?s<0?s=t:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function VG(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function YG(e,t){let n="",r=0,s=-1,i=0,a=-1,o,c;for(;++a<=e.length;){if(a2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=a,i=0;continue}}else if(n.length>0){n="",r=0,s=a,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,a):n=e.slice(s+1,a),r=a-s-1;s=a,i=0}else o===46&&i>-1?i++:i=-1}return n}function Rf(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const WG={cwd:GG};function GG(){return"/"}function fE(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function qG(e){if(typeof e=="string")e=new URL(e);else if(!fE(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 XG(e)}function XG(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(;++n0){let[p,...m]=d;const y=r[h][1];dE(y)&&dE(p)&&(p=Sy(!0,y,p)),r[h]=[u,p,...m]}}}}const eq=new nv().freeze();function Iy(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Oy(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ry(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 pT(e){if(!dE(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function mT(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Dh(e){return tq(e)?e:new y3(e)}function tq(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function nq(e){return typeof e=="string"||rq(e)}function rq(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const sq="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",gT=[],yT={allowDangerousHtml:!0},iq=/^(https?|ircs?|mailto|xmpp)$/i,aq=[{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 oq(e){const t=lq(e),n=cq(e);return uq(t.runSync(t.parse(n),n),e)}function lq(e){const t=e.rehypePlugins||gT,n=e.remarkPlugins||gT,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...yT}:yT;return eq().use(HW).use(n).use(PG,r).use(t)}function cq(e){const t=e.children||"",n=new y3;return typeof t=="string"&&(n.value=t),n}function uq(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,a=t.skipHtml,o=t.unwrapDisallowed,c=t.urlTransform||dq;for(const d of aq)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+sq+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),Of(e,u),NK(e,{Fragment:l.Fragment,components:s,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function u(d,f,h){if(d.type==="raw"&&h&&typeof f=="number")return a?h.children.splice(f,1):h.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let p;for(p in _y)if(Object.hasOwn(_y,p)&&Object.hasOwn(d.properties,p)){const m=d.properties[p],y=_y[p];(y===null||y.includes(d.tagName))&&(d.properties[p]=c(String(m||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):i?i.includes(d.tagName):!1;if(!p&&r&&typeof f=="number"&&(p=!r(d,f,h)),p&&h&&typeof f=="number")return o&&d.children?h.children.splice(f,1,...d.children):h.children.splice(f,1),f}}}function dq(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||iq.test(e.slice(0,t))?e:""}function bT(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;s!==-1;)r++,s=n.indexOf(t,s+t.length);return r}function fq(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function hq(e,t,n){const s=If((n||{}).ignore||[]),i=pq(t);let a=-1;for(;++a0?{type:"text",value:N}:void 0),N===!1?h.lastIndex=_+1:(m!==_&&x.push({type:"text",value:u.value.slice(m,_)}),Array.isArray(N)?x.push(...N):N&&x.push(N),m=_+b[0].length,g=!0),!h.global)break;b=h.exec(u.value)}return g?(m?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const s=bT(e,"(");let i=bT(e,")");for(;r!==-1&&s>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}function b3(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Uo(n)||Bg(n))&&(!t||n!==47)}E3.peek=Pq;function Cq(){this.buffer()}function Iq(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Oq(){this.buffer()}function Rq(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Lq(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Xs(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Mq(e){this.exit(e)}function jq(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Xs(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Dq(e){this.exit(e)}function Pq(){return"["}function E3(e,t,n,r){const s=n.createTracker(r);let i=s.move("[^");const a=n.enter("footnoteReference"),o=n.enter("reference");return i+=s.move(n.safe(n.associationId(e),{after:"]",before:i})),o(),a(),i+=s.move("]"),i}function Bq(){return{enter:{gfmFootnoteCallString:Cq,gfmFootnoteCall:Iq,gfmFootnoteDefinitionLabelString:Oq,gfmFootnoteDefinition:Rq},exit:{gfmFootnoteCallString:Lq,gfmFootnoteCall:Mq,gfmFootnoteDefinitionLabelString:jq,gfmFootnoteDefinition:Dq}}}function Fq(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:E3},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,a){const o=i.createTracker(a);let c=o.move("[^");const u=i.enter("footnoteDefinition"),d=i.enter("label");return c+=o.move(i.safe(i.associationId(r),{before:c,after:"]"})),d(),c+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),c+=o.move((t?` -`:" ")+i.indentLines(i.containerFlow(r,o.current()),t?x3:Uq))),u(),c}}function Uq(e,t,n){return t===0?e:x3(e,t,n)}function x3(e,t,n){return(n?"":" ")+e}const $q=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];w3.peek=Yq;function Hq(){return{canContainEols:["delete"],enter:{strikethrough:Vq},exit:{strikethrough:Kq}}}function zq(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:$q}],handlers:{delete:w3}}}function Vq(e){this.enter({type:"delete",children:[]},e)}function Kq(e){this.exit(e)}function w3(e,t,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let a=s.move("~~");return a+=n.containerPhrasing(e,{...s.current(),before:a,after:"~"}),a+=s.move("~~"),i(),a}function Yq(){return"~"}function Wq(e){return e.length}function Gq(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||Wq,i=[],a=[],o=[],c=[];let u=0,d=-1;for(;++du&&(u=e[d].length);++gc[g])&&(c[g]=b)}y.push(x)}a[d]=y,o[d]=E}let f=-1;if(typeof r=="object"&&"length"in r)for(;++fc[f]&&(c[f]=x),p[f]=x),h[f]=b}a.splice(1,0,h),o.splice(1,0,p),d=-1;const m=[];for(;++d "),i.shift(2);const a=n.indentLines(n.containerFlow(e,i.current()),Qq);return s(),a}function Qq(e,t,n){return">"+(n?"":" ")+e}function Zq(e,t){return wT(e,t.inConstruct,!0)&&!wT(e,t.notInConstruct,!1)}function wT(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++ra&&(a=i):i=1,s=r+t.length,r=n.indexOf(t,s);return a}function eX(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 tX(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 nX(e,t,n,r){const s=tX(n),i=e.value||"",a=s==="`"?"GraveAccent":"Tilde";if(eX(e,n)){const f=n.enter("codeIndented"),h=n.indentLines(i,rX);return f(),h}const o=n.createTracker(r),c=s.repeat(Math.max(Jq(i,s)+1,3)),u=n.enter("codeFenced");let d=o.move(c);if(e.lang){const f=n.enter(`codeFencedLang${a}`);d+=o.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...o.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${a}`);d+=o.move(" "),d+=o.move(n.safe(e.meta,{before:d,after:` +`}),n}function rT(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function sT(e,t){const n=OG(e,t),r=n.one(e,void 0),s=wG(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:` +`},s),i}function DG(e,t){return e&&"run"in e?async function(n,r){const s=sT(n,{file:r,...t});await e.run(s,r)}:function(n,r){return sT(n,{file:r,...e||t})}}function iT(e){if(e)throw e}var Ap=Object.prototype.hasOwnProperty,m3=Object.prototype.toString,aT=Object.defineProperty,oT=Object.getOwnPropertyDescriptor,lT=function(t){return typeof Array.isArray=="function"?Array.isArray(t):m3.call(t)==="[object Array]"},cT=function(t){if(!t||m3.call(t)!=="[object Object]")return!1;var n=Ap.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Ap.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||Ap.call(t,s)},uT=function(t,n){aT&&n.name==="__proto__"?aT(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},dT=function(t,n){if(n==="__proto__")if(Ap.call(t,n)){if(oT)return oT(t,n).value}else return;return t[n]},PG=function e(){var t,n,r,s,i,a,o=arguments[0],c=1,u=arguments.length,d=!1;for(typeof o=="boolean"&&(d=o,o=arguments[1]||{},c=2),(o==null||typeof o!="object"&&typeof o!="function")&&(o={});ca.length;let c;o&&a.push(s);try{c=e.apply(this,a)}catch(u){const d=u;if(o&&n)throw d;return s(d)}o||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(a,...o){n||(n=!0,t(a,...o))}function i(a){s(null,a)}}const ui={basename:UG,dirname:$G,extname:HG,join:zG,sep:"/"};function UG(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Of(e);let n=0,r=-1,s=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,o=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else a<0&&(i=!0,a=s+1),o>-1&&(e.codePointAt(s)===t.codePointAt(o--)?o<0&&(r=s):(o=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function $G(e){if(Of(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 HG(e){Of(e);let t=e.length,n=-1,r=0,s=-1,i=0,a;for(;t--;){const o=e.codePointAt(t);if(o===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),o===46?s<0?s=t:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function zG(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function KG(e,t){let n="",r=0,s=-1,i=0,a=-1,o,c;for(;++a<=e.length;){if(a2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=a,i=0;continue}}else if(n.length>0){n="",r=0,s=a,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,a):n=e.slice(s+1,a),r=a-s-1;s=a,i=0}else o===46&&i>-1?i++:i=-1}return n}function Of(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const YG={cwd:WG};function WG(){return"/"}function dE(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function GG(e){if(typeof e=="string")e=new URL(e);else if(!dE(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 qG(e)}function qG(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(;++n0){let[p,...m]=d;const y=r[h][1];uE(y)&&uE(p)&&(p=Ny(!0,y,p)),r[h]=[u,p,...m]}}}}const JG=new tv().freeze();function Cy(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Iy(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Oy(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 hT(e){if(!uE(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function pT(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function jh(e){return eq(e)?e:new g3(e)}function eq(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function tq(e){return typeof e=="string"||nq(e)}function nq(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const rq="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",mT=[],gT={allowDangerousHtml:!0},sq=/^(https?|ircs?|mailto|xmpp)$/i,iq=[{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 aq(e){const t=oq(e),n=lq(e);return cq(t.runSync(t.parse(n),n),e)}function oq(e){const t=e.rehypePlugins||mT,n=e.remarkPlugins||mT,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...gT}:gT;return JG().use($W).use(n).use(DG,r).use(t)}function lq(e){const t=e.children||"",n=new g3;return typeof t=="string"&&(n.value=t),n}function cq(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,a=t.skipHtml,o=t.unwrapDisallowed,c=t.urlTransform||uq;for(const d of iq)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+rq+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),If(e,u),kK(e,{Fragment:l.Fragment,components:s,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function u(d,f,h){if(d.type==="raw"&&h&&typeof f=="number")return a?h.children.splice(f,1):h.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let p;for(p in vy)if(Object.hasOwn(vy,p)&&Object.hasOwn(d.properties,p)){const m=d.properties[p],y=vy[p];(y===null||y.includes(d.tagName))&&(d.properties[p]=c(String(m||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):i?i.includes(d.tagName):!1;if(!p&&r&&typeof f=="number"&&(p=!r(d,f,h)),p&&h&&typeof f=="number")return o&&d.children?h.children.splice(f,1,...d.children):h.children.splice(f,1),f}}}function uq(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||sq.test(e.slice(0,t))?e:""}function yT(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;s!==-1;)r++,s=n.indexOf(t,s+t.length);return r}function dq(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function fq(e,t,n){const s=Cf((n||{}).ignore||[]),i=hq(t);let a=-1;for(;++a0?{type:"text",value:N}:void 0),N===!1?h.lastIndex=_+1:(m!==_&&x.push({type:"text",value:u.value.slice(m,_)}),Array.isArray(N)?x.push(...N):N&&x.push(N),m=_+b[0].length,g=!0),!h.global)break;b=h.exec(u.value)}return g?(m?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const s=yT(e,"(");let i=yT(e,")");for(;r!==-1&&s>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}function y3(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Fo(n)||Pg(n))&&(!t||n!==47)}b3.peek=Dq;function Aq(){this.buffer()}function Cq(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Iq(){this.buffer()}function Oq(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Rq(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Xs(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Lq(e){this.exit(e)}function Mq(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Xs(this.sliceSerialize(e)).toLowerCase(),n.label=t}function jq(e){this.exit(e)}function Dq(){return"["}function b3(e,t,n,r){const s=n.createTracker(r);let i=s.move("[^");const a=n.enter("footnoteReference"),o=n.enter("reference");return i+=s.move(n.safe(n.associationId(e),{after:"]",before:i})),o(),a(),i+=s.move("]"),i}function Pq(){return{enter:{gfmFootnoteCallString:Aq,gfmFootnoteCall:Cq,gfmFootnoteDefinitionLabelString:Iq,gfmFootnoteDefinition:Oq},exit:{gfmFootnoteCallString:Rq,gfmFootnoteCall:Lq,gfmFootnoteDefinitionLabelString:Mq,gfmFootnoteDefinition:jq}}}function Bq(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:b3},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,a){const o=i.createTracker(a);let c=o.move("[^");const u=i.enter("footnoteDefinition"),d=i.enter("label");return c+=o.move(i.safe(i.associationId(r),{before:c,after:"]"})),d(),c+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),c+=o.move((t?` +`:" ")+i.indentLines(i.containerFlow(r,o.current()),t?E3:Fq))),u(),c}}function Fq(e,t,n){return t===0?e:E3(e,t,n)}function E3(e,t,n){return(n?"":" ")+e}const Uq=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];x3.peek=Kq;function $q(){return{canContainEols:["delete"],enter:{strikethrough:zq},exit:{strikethrough:Vq}}}function Hq(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Uq}],handlers:{delete:x3}}}function zq(e){this.enter({type:"delete",children:[]},e)}function Vq(e){this.exit(e)}function x3(e,t,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let a=s.move("~~");return a+=n.containerPhrasing(e,{...s.current(),before:a,after:"~"}),a+=s.move("~~"),i(),a}function Kq(){return"~"}function Yq(e){return e.length}function Wq(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||Yq,i=[],a=[],o=[],c=[];let u=0,d=-1;for(;++du&&(u=e[d].length);++gc[g])&&(c[g]=b)}y.push(x)}a[d]=y,o[d]=E}let f=-1;if(typeof r=="object"&&"length"in r)for(;++fc[f]&&(c[f]=x),p[f]=x),h[f]=b}a.splice(1,0,h),o.splice(1,0,p),d=-1;const m=[];for(;++d "),i.shift(2);const a=n.indentLines(n.containerFlow(e,i.current()),Xq);return s(),a}function Xq(e,t,n){return">"+(n?"":" ")+e}function Qq(e,t){return xT(e,t.inConstruct,!0)&&!xT(e,t.notInConstruct,!1)}function xT(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++ra&&(a=i):i=1,s=r+t.length,r=n.indexOf(t,s);return a}function Jq(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 eX(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 tX(e,t,n,r){const s=eX(n),i=e.value||"",a=s==="`"?"GraveAccent":"Tilde";if(Jq(e,n)){const f=n.enter("codeIndented"),h=n.indentLines(i,nX);return f(),h}const o=n.createTracker(r),c=s.repeat(Math.max(Zq(i,s)+1,3)),u=n.enter("codeFenced");let d=o.move(c);if(e.lang){const f=n.enter(`codeFencedLang${a}`);d+=o.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...o.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${a}`);d+=o.move(" "),d+=o.move(n.safe(e.meta,{before:d,after:` `,encode:["`"],...o.current()})),f()}return d+=o.move(` `),i&&(d+=o.move(i+` -`)),d+=o.move(c),u(),d}function rX(e,t,n){return(n?"":" ")+e}function rv(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 sX(e,t,n,r){const s=rv(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("definition");let o=n.enter("label");const c=n.createTracker(r);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),{before:u,after:"]",...c.current()})),u+=c.move("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(o=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":` -`,...c.current()}))),o(),e.title&&(o=n.enter(`title${i}`),u+=c.move(" "+s),u+=c.move(n.safe(e.title,{before:u,after:s,...c.current()})),u+=c.move(s),o()),a(),u}function iX(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 Zd(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Im(e,t,n){const r=Nc(e),s=Nc(t);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}_3.peek=aX;function _3(e,t,n,r){const s=iX(n),i=n.enter("emphasis"),a=n.createTracker(r),o=a.move(s);let c=a.move(n.containerPhrasing(e,{after:s,before:o,...a.current()}));const u=c.charCodeAt(0),d=Im(r.before.charCodeAt(r.before.length-1),u,s);d.inside&&(c=Zd(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=Im(r.after.charCodeAt(0),f,s);h.inside&&(c=c.slice(0,-1)+Zd(f));const p=a.move(s);return i(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},o+c+p}function aX(e,t,n){return n.options.emphasis||"*"}function oX(e,t){let n=!1;return Of(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,cE}),!!((!e.depth||e.depth<3)&&qw(e)&&(t.options.setext||n))}function lX(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(oX(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),h=n.containerPhrasing(e,{...i.current(),before:` +`)),d+=o.move(c),u(),d}function nX(e,t,n){return(n?"":" ")+e}function nv(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 rX(e,t,n,r){const s=nv(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("definition");let o=n.enter("label");const c=n.createTracker(r);let u=c.move("[");return u+=c.move(n.safe(n.associationId(e),{before:u,after:"]",...c.current()})),u+=c.move("]: "),o(),!e.url||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(o=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":` +`,...c.current()}))),o(),e.title&&(o=n.enter(`title${i}`),u+=c.move(" "+s),u+=c.move(n.safe(e.title,{before:u,after:s,...c.current()})),u+=c.move(s),o()),a(),u}function sX(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 Qd(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Cm(e,t,n){const r=kc(e),s=kc(t);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}v3.peek=iX;function v3(e,t,n,r){const s=sX(n),i=n.enter("emphasis"),a=n.createTracker(r),o=a.move(s);let c=a.move(n.containerPhrasing(e,{after:s,before:o,...a.current()}));const u=c.charCodeAt(0),d=Cm(r.before.charCodeAt(r.before.length-1),u,s);d.inside&&(c=Qd(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=Cm(r.after.charCodeAt(0),f,s);h.inside&&(c=c.slice(0,-1)+Qd(f));const p=a.move(s);return i(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},o+c+p}function iX(e,t,n){return n.options.emphasis||"*"}function aX(e,t){let n=!1;return If(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,lE}),!!((!e.depth||e.depth<3)&&Gw(e)&&(t.options.setext||n))}function oX(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(aX(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),h=n.containerPhrasing(e,{...i.current(),before:` `,after:` `});return f(),d(),h+` `+(s===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(` `))+1))}const a="#".repeat(s),o=n.enter("headingAtx"),c=n.enter("phrasing");i.move(a+" ");let u=n.containerPhrasing(e,{before:"# ",after:` -`,...i.current()});return/^[\t ]/.test(u)&&(u=Zd(u.charCodeAt(0))+u.slice(1)),u=u?a+" "+u:a,n.options.closeAtx&&(u+=" "+a),c(),o(),u}k3.peek=cX;function k3(e){return e.value||""}function cX(){return"<"}N3.peek=uX;function N3(e,t,n,r){const s=rv(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("image");let o=n.enter("label");const c=n.createTracker(r);let u=c.move("![");return u+=c.move(n.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(o=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),o(),e.title&&(o=n.enter(`title${i}`),u+=c.move(" "+s),u+=c.move(n.safe(e.title,{before:u,after:s,...c.current()})),u+=c.move(s),o()),u+=c.move(")"),a(),u}function uX(){return"!"}S3.peek=dX;function S3(e,t,n,r){const s=e.referenceType,i=n.enter("imageReference");let a=n.enter("label");const o=n.createTracker(r);let c=o.move("![");const u=n.safe(e.alt,{before:c,after:"]",...o.current()});c+=o.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...o.current()});return a(),n.stack=d,i(),s==="full"||!u||u!==f?c+=o.move(f+"]"):s==="shortcut"?c=c.slice(0,-1):c+=o.move("]"),c}function dX(){return"!"}T3.peek=fX;function T3(e,t,n){let r=e.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i\u007F]/.test(e.url))}C3.peek=hX;function C3(e,t,n,r){const s=rv(n),i=s==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let o,c;if(A3(e,n)){const d=n.stack;n.stack=[],o=n.enter("autolink");let f=a.move("<");return f+=a.move(n.containerPhrasing(e,{before:f,after:">",...a.current()})),f+=a.move(">"),o(),n.stack=d,f}o=n.enter("link"),c=n.enter("label");let u=a.move("[");return u+=a.move(n.containerPhrasing(e,{before:u,after:"](",...a.current()})),u+=a.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=a.move("<"),u+=a.move(n.safe(e.url,{before:u,after:">",...a.current()})),u+=a.move(">")):(c=n.enter("destinationRaw"),u+=a.move(n.safe(e.url,{before:u,after:e.title?" ":")",...a.current()}))),c(),e.title&&(c=n.enter(`title${i}`),u+=a.move(" "+s),u+=a.move(n.safe(e.title,{before:u,after:s,...a.current()})),u+=a.move(s),c()),u+=a.move(")"),o(),u}function hX(e,t,n){return A3(e,n)?"<":"["}I3.peek=pX;function I3(e,t,n,r){const s=e.referenceType,i=n.enter("linkReference");let a=n.enter("label");const o=n.createTracker(r);let c=o.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...o.current()});c+=o.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...o.current()});return a(),n.stack=d,i(),s==="full"||!u||u!==f?c+=o.move(f+"]"):s==="shortcut"?c=c.slice(0,-1):c+=o.move("]"),c}function pX(){return"["}function sv(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 mX(e){const t=sv(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 gX(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 O3(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 yX(e,t,n,r){const s=n.enter("list"),i=n.bulletCurrent;let a=e.ordered?gX(n):sv(n);const o=e.ordered?a==="."?")":".":mX(n);let c=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&d&&(!d.children||!d.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&&(c=!0),O3(n)===a&&d){let f=-1;for(;++f-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let a=i.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const o=n.createTracker(r);o.move(i+" ".repeat(a-i.length)),o.shift(a);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,o.current()),d);return c(),u;function d(f,h,p){return h?(p?"":" ".repeat(a))+f:(p?i:i+" ".repeat(a-i.length))+f}}function xX(e,t,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),a=n.containerPhrasing(e,r);return i(),s(),a}const wX=If(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function vX(e,t,n,r){return(e.children.some(function(a){return wX(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function _X(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}R3.peek=kX;function R3(e,t,n,r){const s=_X(n),i=n.enter("strong"),a=n.createTracker(r),o=a.move(s+s);let c=a.move(n.containerPhrasing(e,{after:s,before:o,...a.current()}));const u=c.charCodeAt(0),d=Im(r.before.charCodeAt(r.before.length-1),u,s);d.inside&&(c=Zd(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=Im(r.after.charCodeAt(0),f,s);h.inside&&(c=c.slice(0,-1)+Zd(f));const p=a.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},o+c+p}function kX(e,t,n){return n.options.strong||"*"}function NX(e,t,n,r){return n.safe(e.value,r)}function SX(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 TX(e,t,n){const r=(O3(n)+(n.options.ruleSpaces?" ":"")).repeat(SX(n));return n.options.ruleSpaces?r.slice(0,-1):r}const L3={blockquote:Xq,break:vT,code:nX,definition:sX,emphasis:_3,hardBreak:vT,heading:lX,html:k3,image:N3,imageReference:S3,inlineCode:T3,link:C3,linkReference:I3,list:yX,listItem:EX,paragraph:xX,root:vX,strong:R3,text:NX,thematicBreak:TX};function AX(){return{enter:{table:CX,tableData:_T,tableHeader:_T,tableRow:OX},exit:{codeText:RX,table:IX,tableData:Dy,tableHeader:Dy,tableRow:Dy}}}function CX(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 IX(e){this.exit(e),this.data.inTable=void 0}function OX(e){this.enter({type:"tableRow",children:[]},e)}function Dy(e){this.exit(e)}function _T(e){this.enter({type:"tableCell",children:[]},e)}function RX(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,LX));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function LX(e,t){return t==="|"?t:e}function MX(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,s=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` +`,...i.current()});return/^[\t ]/.test(u)&&(u=Qd(u.charCodeAt(0))+u.slice(1)),u=u?a+" "+u:a,n.options.closeAtx&&(u+=" "+a),c(),o(),u}_3.peek=lX;function _3(e){return e.value||""}function lX(){return"<"}k3.peek=cX;function k3(e,t,n,r){const s=nv(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("image");let o=n.enter("label");const c=n.createTracker(r);let u=c.move("![");return u+=c.move(n.safe(e.alt,{before:u,after:"]",...c.current()})),u+=c.move("]("),o(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(o=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(o=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),o(),e.title&&(o=n.enter(`title${i}`),u+=c.move(" "+s),u+=c.move(n.safe(e.title,{before:u,after:s,...c.current()})),u+=c.move(s),o()),u+=c.move(")"),a(),u}function cX(){return"!"}N3.peek=uX;function N3(e,t,n,r){const s=e.referenceType,i=n.enter("imageReference");let a=n.enter("label");const o=n.createTracker(r);let c=o.move("![");const u=n.safe(e.alt,{before:c,after:"]",...o.current()});c+=o.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...o.current()});return a(),n.stack=d,i(),s==="full"||!u||u!==f?c+=o.move(f+"]"):s==="shortcut"?c=c.slice(0,-1):c+=o.move("]"),c}function uX(){return"!"}S3.peek=dX;function S3(e,t,n){let r=e.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i\u007F]/.test(e.url))}A3.peek=fX;function A3(e,t,n,r){const s=nv(n),i=s==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let o,c;if(T3(e,n)){const d=n.stack;n.stack=[],o=n.enter("autolink");let f=a.move("<");return f+=a.move(n.containerPhrasing(e,{before:f,after:">",...a.current()})),f+=a.move(">"),o(),n.stack=d,f}o=n.enter("link"),c=n.enter("label");let u=a.move("[");return u+=a.move(n.containerPhrasing(e,{before:u,after:"](",...a.current()})),u+=a.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),u+=a.move("<"),u+=a.move(n.safe(e.url,{before:u,after:">",...a.current()})),u+=a.move(">")):(c=n.enter("destinationRaw"),u+=a.move(n.safe(e.url,{before:u,after:e.title?" ":")",...a.current()}))),c(),e.title&&(c=n.enter(`title${i}`),u+=a.move(" "+s),u+=a.move(n.safe(e.title,{before:u,after:s,...a.current()})),u+=a.move(s),c()),u+=a.move(")"),o(),u}function fX(e,t,n){return T3(e,n)?"<":"["}C3.peek=hX;function C3(e,t,n,r){const s=e.referenceType,i=n.enter("linkReference");let a=n.enter("label");const o=n.createTracker(r);let c=o.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...o.current()});c+=o.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...o.current()});return a(),n.stack=d,i(),s==="full"||!u||u!==f?c+=o.move(f+"]"):s==="shortcut"?c=c.slice(0,-1):c+=o.move("]"),c}function hX(){return"["}function rv(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 pX(e){const t=rv(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 mX(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 I3(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 gX(e,t,n,r){const s=n.enter("list"),i=n.bulletCurrent;let a=e.ordered?mX(n):rv(n);const o=e.ordered?a==="."?")":".":pX(n);let c=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const d=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&d&&(!d.children||!d.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&&(c=!0),I3(n)===a&&d){let f=-1;for(;++f-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let a=i.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const o=n.createTracker(r);o.move(i+" ".repeat(a-i.length)),o.shift(a);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,o.current()),d);return c(),u;function d(f,h,p){return h?(p?"":" ".repeat(a))+f:(p?i:i+" ".repeat(a-i.length))+f}}function EX(e,t,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),a=n.containerPhrasing(e,r);return i(),s(),a}const xX=Cf(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function wX(e,t,n,r){return(e.children.some(function(a){return xX(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function vX(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}O3.peek=_X;function O3(e,t,n,r){const s=vX(n),i=n.enter("strong"),a=n.createTracker(r),o=a.move(s+s);let c=a.move(n.containerPhrasing(e,{after:s,before:o,...a.current()}));const u=c.charCodeAt(0),d=Cm(r.before.charCodeAt(r.before.length-1),u,s);d.inside&&(c=Qd(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=Cm(r.after.charCodeAt(0),f,s);h.inside&&(c=c.slice(0,-1)+Qd(f));const p=a.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},o+c+p}function _X(e,t,n){return n.options.strong||"*"}function kX(e,t,n,r){return n.safe(e.value,r)}function NX(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 SX(e,t,n){const r=(I3(n)+(n.options.ruleSpaces?" ":"")).repeat(NX(n));return n.options.ruleSpaces?r.slice(0,-1):r}const R3={blockquote:qq,break:wT,code:tX,definition:rX,emphasis:v3,hardBreak:wT,heading:oX,html:_3,image:k3,imageReference:N3,inlineCode:S3,link:A3,linkReference:C3,list:gX,listItem:bX,paragraph:EX,root:wX,strong:O3,text:kX,thematicBreak:SX};function TX(){return{enter:{table:AX,tableData:vT,tableHeader:vT,tableRow:IX},exit:{codeText:OX,table:CX,tableData:jy,tableHeader:jy,tableRow:jy}}}function AX(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 CX(e){this.exit(e),this.data.inTable=void 0}function IX(e){this.enter({type:"tableRow",children:[]},e)}function jy(e){this.exit(e)}function vT(e){this.enter({type:"tableCell",children:[]},e)}function OX(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,RX));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function RX(e,t){return t==="|"?t:e}function LX(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,s=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:h,table:a,tableCell:c,tableRow:o}};function a(p,m,y,E){return u(d(p,y,E),p.align)}function o(p,m,y,E){const g=f(p,y,E),x=u([g]);return x.slice(0,x.indexOf(` -`))}function c(p,m,y,E){const g=y.enter("tableCell"),x=y.enter("phrasing"),b=y.containerPhrasing(p,{...E,before:i,after:i});return x(),g(),b}function u(p,m){return Gq(p,{align:m,alignDelimiters:r,padding:n,stringLength:s})}function d(p,m,y){const E=p.children;let g=-1;const x=[],b=m.enter("table");for(;++g0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const ZX={tokenize:aQ,partial:!0};function JX(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:rQ,continuation:{tokenize:sQ},exit:iQ}},text:{91:{name:"gfmFootnoteCall",tokenize:nQ},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:eQ,resolveTo:tQ}}}}function eQ(e,t,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;s--;){const c=r.events[s][1];if(c.type==="labelImage"){a=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return o;function o(c){if(!a||!a._balanced)return n(c);const u=Xs(r.sliceSerialize({start:a.end,end:r.now()}));return u.codePointAt(0)!==94||!i.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function tQ(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)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},o=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...o),e}function nQ(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,a;return o;function o(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),c}function c(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(f){if(i>999||f===93&&!a||f===null||f===91||Dt(f))return n(f);if(f===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return s.includes(Xs(r.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return Dt(f)||(a=!0),i++,e.consume(f),f===92?d:u}function d(f){return f===91||f===92||f===93?(e.consume(f),i++,u):u(f)}}function rQ(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,a=0,o;return c;function c(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(m)}function d(m){if(a>999||m===93&&!o||m===null||m===91||Dt(m))return n(m);if(m===93){e.exit("chunkString");const y=e.exit("gfmFootnoteDefinitionLabelString");return i=Xs(r.sliceSerialize(y)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return Dt(m)||(o=!0),a++,e.consume(m),m===92?f:d}function f(m){return m===91||m===92||m===93?(e.consume(m),a++,d):d(m)}function h(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),s.includes(i)||s.push(i),_t(e,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return t(m)}}function sQ(e,t,n){return e.check(Cf,t,e.attempt(ZX,t,n))}function iQ(e){e.exit("gfmFootnoteDefinition")}function aQ(e,t,n){const r=this;return _t(e,s,"gfmFootnoteDefinitionIndent",5);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(i):n(i)}}function oQ(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(a,o){let c=-1;for(;++c1?c(m):(a.consume(m),f++,p);if(f<2&&!n)return c(m);const E=a.exit("strikethroughSequenceTemporary"),g=Nc(m);return E._open=!g||g===2&&!!y,E._close=!y||y===2&&!!g,o(m)}}}class lQ{constructor(){this.map=[]}add(t,n,r){cQ(this,t,n,r)}consume(t){if(this.map.sort(function(i,a){return i[0]-a[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 s=r.pop();for(;s;){for(const i of s)t.push(i);s=r.pop()}this.map.length=0}}function cQ(e,t,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s-1;){const M=r.events[D][1].type;if(M==="lineEnding"||M==="linePrefix")D--;else break}const U=D>-1?r.events[D][1].type:null,X=U==="tableHead"||U==="tableRow"?N:c;return X===N&&r.parser.lazy[r.now().line]?n(O):X(O)}function c(O){return e.enter("tableHead"),e.enter("tableRow"),u(O)}function u(O){return O===124||(a=!0,i+=1),d(O)}function d(O){return O===null?n(O):qe(O)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),p):n(O):yt(O)?_t(e,d,"whitespace")(O):(i+=1,a&&(a=!1,s+=1),O===124?(e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),a=!0,d):(e.enter("data"),f(O)))}function f(O){return O===null||O===124||Dt(O)?(e.exit("data"),d(O)):(e.consume(O),O===92?h:f)}function h(O){return O===92||O===124?(e.consume(O),f):f(O)}function p(O){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(O):(e.enter("tableDelimiterRow"),a=!1,yt(O)?_t(e,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):m(O))}function m(O){return O===45||O===58?E(O):O===124?(a=!0,e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),y):k(O)}function y(O){return yt(O)?_t(e,E,"whitespace")(O):E(O)}function E(O){return O===58?(i+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(O),e.exit("tableDelimiterMarker"),g):O===45?(i+=1,g(O)):O===null||qe(O)?_(O):k(O)}function g(O){return O===45?(e.enter("tableDelimiterFiller"),x(O)):k(O)}function x(O){return O===45?(e.consume(O),x):O===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(O),e.exit("tableDelimiterMarker"),b):(e.exit("tableDelimiterFiller"),b(O))}function b(O){return yt(O)?_t(e,_,"whitespace")(O):_(O)}function _(O){return O===124?m(O):O===null||qe(O)?!a||s!==i?k(O):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(O)):k(O)}function k(O){return n(O)}function N(O){return e.enter("tableRow"),C(O)}function C(O){return O===124?(e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),C):O===null||qe(O)?(e.exit("tableRow"),t(O)):yt(O)?_t(e,C,"whitespace")(O):(e.enter("data"),S(O))}function S(O){return O===null||O===124||Dt(O)?(e.exit("data"),C(O)):(e.consume(O),O===92?A:S)}function A(O){return O===92||O===124?(e.consume(O),S):S(O)}}function hQ(e,t){let n=-1,r=!0,s=0,i=[0,0,0,0],a=[0,0,0,0],o=!1,c=0,u,d,f;const h=new lQ;for(;++nn[2]+1){const m=n[2]+1,y=n[3]-n[2]-1;e.add(m,y,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return s!==void 0&&(i.end=Object.assign({},xl(t.events,s)),e.add(s,0,[["exit",i,t]]),i=void 0),i}function NT(e,t,n,r,s){const i=[],a=xl(t.events,n);s&&(s.end=Object.assign({},a),i.push(["exit",s,t])),r.end=Object.assign({},a),i.push(["exit",r,t]),e.add(n+1,0,i)}function xl(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const pQ={name:"tasklistCheck",tokenize:gQ};function mQ(){return{text:{91:pQ}}}function gQ(e,t,n){const r=this;return s;function s(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return Dt(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(c)}function o(c){return qe(c)?t(c):yt(c)?e.check({tokenize:yQ},t,n)(c):n(c)}}function yQ(e,t,n){return _t(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function bQ(e){return XM([zX(),JX(),oQ(e),dQ(),mQ()])}const EQ={};function xQ(e){const t=this,n=e||EQ,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(bQ(n)),i.push(FX()),a.push(UX(n))}const ST=function(e,t,n){const r=If(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(;++tu&&(u=d):d&&(u!==void 0&&u>-1&&c.push(` -`.repeat(u)||" "),u=-1,c.push(d))}return c.join("")}function z3(e,t,n){return e.type==="element"?AQ(e,t,n):e.type==="text"?n.whitespace==="normal"?V3(e,n):CQ(e):[]}function AQ(e,t,n){const r=K3(e,n),s=e.children||[];let i=-1,a=[];if(SQ(e))return a;let o,c;for(pE(e)||IT(e)&&ST(t,e,IT)?c=` -`:NQ(e)?(o=2,c=2):H3(e)&&(o=1,c=1);++i]+>")+")",o={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={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})"/})]},d={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},f={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(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(s)+e.IDENT_RE,relevance:0},p=t.optional(s)+e.IDENT_RE+"\\s*\\(",m=["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"],y=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],E=["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"],g=["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"],_={type:y,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:E},k={className:"function.dispatch",relevance:0,keywords:{_hint:g},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},N=[k,f,o,n,e.C_BLOCK_COMMENT_MODE,d,u],C={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:_,contains:N.concat([{begin:/\(/,end:/\)/,keywords:_,contains:N.concat(["self"]),relevance:0}]),relevance:0},S={className:"function",begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:_,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:_,relevance:0},{begin:p,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,o,{begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,o]}]},o,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:_,illegal:"",keywords:_,contains:["self",o]},{begin:e.IDENT_RE+"::",keywords:_},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function DQ(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=jQ(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 Y3(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 s={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},i=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),a={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},o={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,s]};s.contains.push(o);const c={match:/\\"/},u={className:"string",begin:/'/,end:/'/},d={match:/\\'/},f={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},h=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],p=e.SHEBANG({binary:`(${h.join("|")})`,relevance:10}),m={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},y=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],E=["true","false"],g={match:/(\/[a-z._-]+)+/},x=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],b=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],_=["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"],k=["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:y,literal:E,built_in:[...x,...b,"set","shopt",..._,...k]},contains:[p,e.SHEBANG(),m,f,i,a,g,o,c,u,d,n]}}function PQ(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",a="("+r+"|"+t.optional(s)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",o={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},u={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})"/})]},d={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},f={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(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(s)+e.IDENT_RE,relevance:0},p=t.optional(s)+e.IDENT_RE+"\\s*\\(",E={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"},g=[f,o,n,e.C_BLOCK_COMMENT_MODE,d,u],x={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:E,contains:g.concat([{begin:/\(/,end:/\)/,keywords:E,contains:g.concat(["self"]),relevance:0}]),relevance:0},b={begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:E,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:E,relevance:0},{begin:p,returnBegin:!0,contains:[e.inherit(h,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:E,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,o,{begin:/\(/,end:/\)/,keywords:E,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,o]}]},o,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C",aliases:["h"],keywords:E,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:f,strings:u,keywords:E}}}function BQ(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",a="(?!struct)("+r+"|"+t.optional(s)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",o={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={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})"/})]},d={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},f={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(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(s)+e.IDENT_RE,relevance:0},p=t.optional(s)+e.IDENT_RE+"\\s*\\(",m=["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"],y=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],E=["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"],g=["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"],_={type:y,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:E},k={className:"function.dispatch",relevance:0,keywords:{_hint:g},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},N=[k,f,o,n,e.C_BLOCK_COMMENT_MODE,d,u],C={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:_,contains:N.concat([{begin:/\(/,end:/\)/,keywords:_,contains:N.concat(["self"]),relevance:0}]),relevance:0},S={className:"function",begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:_,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:_,relevance:0},{begin:p,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,o,{begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,o]}]},o,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:_,illegal:"",keywords:_,contains:["self",o]},{begin:e.IDENT_RE+"::",keywords:_},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function FQ(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"],s=["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"],i=["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"],a={keyword:s.concat(i),built_in:t,literal:r},o=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),c={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},u={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},d={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},f=e.inherit(d,{illegal:/\n/}),h={className:"subst",begin:/\{/,end:/\}/,keywords:a},p=e.inherit(h,{illegal:/\n/}),m={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,p]},y={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]},E=e.inherit(y,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},p]});h.contains=[y,m,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.C_BLOCK_COMMENT_MODE],p.contains=[E,m,f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const g={variants:[u,y,m,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},x={begin:"<",end:">",contains:[{beginKeywords:"in out"},o]},b=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",_={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:a,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:""},{begin:""}]}]}),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"}},g,c,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},o,x,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[o,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[o,x,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:"("+b+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:a,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,x],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,relevance:0,contains:[g,c,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},_]}}const UQ=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_-]*/}}),$Q=["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"],HQ=["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"],zQ=[...$Q,...HQ],VQ=["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(),KQ=["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(),YQ=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),WQ=["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 GQ(e){const t=e.regex,n=UQ(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},s="and or not only",i=/@-?\w[\w]*(-\w+)*/,a="[a-zA-Z-][a-zA-Z0-9_-]*",o=[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:"\\."+a,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+KQ.join("|")+")"},{begin:":(:)?("+YQ.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+WQ.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...o,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...o,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:VQ.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...o,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+zQ.join("|")+")\\b"}]}}function qQ(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 XQ(e){const i={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:i,illegal:"G3(e,t,n-1))}function ZQ(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+G3("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),c={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"]},u={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},d={className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:c,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:[d,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:c,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[u,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,OT,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},OT,u]}}const RT="[A-Za-z$_][0-9A-Za-z$_]*",JQ=["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"],eZ=["true","false","null","undefined","NaN","Infinity"],q3=["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"],X3=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Q3=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],tZ=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],nZ=[].concat(Q3,q3,X3);function Z3(e){const t=e.regex,n=(R,{after:F})=>{const I="",end:""},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(R,F)=>{const I=R[0].length+R.index,V=R.input[I];if(V==="<"||V===","){F.ignoreMatch();return}V===">"&&(n(R,{after:I})||F.ignoreMatch());let W;const P=R.input.substring(I);if(W=P.match(/^\s*=/)){F.ignoreMatch();return}if((W=P.match(/^\s+extends\s+/))&&W.index===0){F.ignoreMatch();return}}},o={$pattern:RT,keyword:JQ,literal:eZ,built_in:nZ,"variable.language":tZ},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\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},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:o,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},y={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},E={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},x={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]},b=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,y,E,{match:/\$\d+/},f];h.contains=b.concat({begin:/\{/,end:/\}/,keywords:o,contains:["self"].concat(b)});const _=[].concat(x,h.contains),k=_.concat([{begin:/(\s*)\(/,end:/\)/,keywords:o,contains:["self"].concat(_)}]),N={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:k},C={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"}}]},S={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:{_:[...q3,...X3]}},A={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},O={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[N],illegal:/%/},D={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function U(R){return t.concat("(?!",R.join("|"),")")}const X={match:t.concat(/\b/,U([...Q3,"super","import"].map(R=>`${R}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},M={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},j={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},N]},T="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",L={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(T)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[N]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:k,CLASS_REFERENCE:S},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),A,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,y,E,x,{match:/\$\d+/},f,S,{scope:"attr",match:r+t.lookahead(":"),relevance:0},L,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[x,e.REGEXP_MODE,{className:"function",begin:T,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:o,contains:k}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:i},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},O,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[N,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},M,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[N]},X,D,C,j,{match:/\$[(.]/}]}}function J3(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],s={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,s,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var vl="[0-9](_*[0-9])*",Uh=`\\.(${vl})`,$h="[0-9a-fA-F](_*[0-9a-fA-F])*",rZ={className:"number",variants:[{begin:`(\\b(${vl})((${Uh})|\\.)?|(${Uh}))[eE][+-]?(${vl})[fFdD]?\\b`},{begin:`\\b(${vl})((${Uh})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Uh})[fFdD]?\\b`},{begin:`\\b(${vl})[fFdD]\\b`},{begin:`\\b0[xX]((${$h})\\.?|(${$h})?\\.(${$h}))[pP][+-]?(${vl})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${$h})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function sZ(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+"@"},s={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},i={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},a={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[i,s]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,i,s]}]};s.contains.push(a);const o={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},c={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(a,{className:"string"}),"self"]}]},u=rZ,d=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),f={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},h=f;return h.variants[1].contains=[f],f.variants[1].contains=[h],{name:"Kotlin",aliases:["kt","kts"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,d,n,r,o,c,{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://,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[f,e.C_LINE_COMMENT_MODE,d],relevance:0},e.C_LINE_COMMENT_MODE,d,o,c,a,e.C_NUMBER_MODE]},d]},{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://,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},o,c]},a,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:` -`},u]}}const iZ=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_-]*/}}),aZ=["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"],oZ=["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"],lZ=[...aZ,...oZ],cZ=["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(),ej=["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(),tj=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),uZ=["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(),dZ=ej.concat(tj).sort().reverse();function fZ(e){const t=iZ(e),n=dZ,r="and or not only",s="[\\w-]+",i="("+s+"|@\\{"+s+"\\})",a=[],o=[],c=function(b){return{className:"string",begin:"~?"+b+".*?"+b}},u=function(b,_,k){return{className:b,begin:_,relevance:k}},d={$pattern:/[a-z-]+/,keyword:r,attribute:cZ.join(" ")},f={begin:"\\(",end:"\\)",contains:o,keywords:d,relevance:0};o.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,c("'"),c('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.HEXCOLOR,f,u("variable","@@?"+s,10),u("variable","@\\{"+s+"\\}"),u("built_in","~?`[^`]*?`"),{className:"attribute",begin:s+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);const h=o.concat({begin:/\{/,end:/\}/,contains:a}),p={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(o)},m={begin:i+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+uZ.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:o}}]},y={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:d,returnEnd:!0,contains:o,relevance:0}},E={className:"variable",variants:[{begin:"@"+s+"\\s*:",relevance:15},{begin:"@"+s}],starts:{end:"[;}]",returnEnd:!0,contains:h}},g={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:i,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,p,u("keyword","all\\b"),u("variable","@\\{"+s+"\\}"),{begin:"\\b("+lZ.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,u("selector-tag",i,0),u("selector-id","#"+i),u("selector-class","\\."+i,0),u("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+ej.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+tj.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:h},{begin:"!important"},t.FUNCTION_DISPATCH]},x={begin:s+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[g]};return a.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,y,E,x,m,g,p,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:a}}function hZ(e){const t="\\[=*\\[",n="\\]=*\\]",r={begin:t,end:n,contains:["self"]},s=[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:s.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:s}].concat(s)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[r],relevance:5}])}}function nj(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},s={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}]},i={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},a={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},o=/[A-Za-z][A-Za-z0-9+.-]*/,c={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,o,/:\/\/.*?\)/),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}]},u={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},d={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},f=e.inherit(u,{contains:[]}),h=e.inherit(d,{contains:[]});u.contains.push(h),d.contains.push(f);let p=[n,c];return[u,d,f,h].forEach(g=>{g.contains=g.contains.concat(p)}),p=p.concat(u,d),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:p},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:p}]}]},n,i,u,d,{className:"quote",begin:"^>\\s+",contains:p,end:"$"},s,r,c,a,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function pZ(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_]*/,o={"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"]},c={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:o,illegal:"/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+c.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:c,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function mZ(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}/,s={$pattern:/[\w.]+/,keyword:n.join(" ")},i={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:s},a={begin:/->\{/,end:/\}/},o={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},c={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[o]},u={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},d=[e.BACKSLASH_ESCAPE,i,c],f=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],h=(y,E,g="\\1")=>{const x=g==="\\1"?g:t.concat(g,E);return t.concat(t.concat("(?:",y,")"),E,/(?:\\.|[^\\\/])*?/,x,/(?:\\.|[^\\\/])*?/,g,r)},p=(y,E,g)=>t.concat(t.concat("(?:",y,")"),E,/(?:\\.|[^\\\/])*?/,g,r),m=[c,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),a,{className:"string",contains:d,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}]},u,{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:h("s|tr|y",t.either(...f,{capture:!0}))},{begin:h("s|tr|y","\\(","\\)")},{begin:h("s|tr|y","\\[","\\]")},{begin:h("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p("(?:m|qr)?",/\//,/\//)},{begin:p("m|qr",t.either(...f,{capture:!0}),/\1/)},{begin:p("m|qr",/\(/,/\)/)},{begin:p("m|qr",/\[/,/\]/)},{begin:p("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,o]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,o,u]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return i.contains=m,a.contains=m,{name:"Perl",aliases:["pl","pm"],keywords:s,contains:m}}function gZ(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),s=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),i=t.concat(/[A-Z]+/,n),a={scope:"variable",match:"\\$+"+r},o={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},c={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},u=e.inherit(e.APOS_STRING_MODE,{illegal:null}),d=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(c)}),f={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(c),"on:begin":(M,j)=>{j.data._beginMatch=M[1]||M[2]},"on:end":(M,j)=>{j.data._beginMatch!==M[1]&&j.ignoreMatch()}},h=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),p=`[ -]`,m={scope:"string",variants:[d,u,f,h]},y={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},E=["false","null","true"],g=["__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"],x=["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"],_={keyword:g,literal:(M=>{const j=[];return M.forEach(T=>{j.push(T),T.toLowerCase()===T?j.push(T.toUpperCase()):j.push(T.toLowerCase())}),j})(E),built_in:x},k=M=>M.map(j=>j.replace(/\|\d+$/,"")),N={variants:[{match:[/new/,t.concat(p,"+"),t.concat("(?!",k(x).join("\\b|"),"\\b)"),s],scope:{1:"keyword",4:"title.class"}}]},C=t.concat(r,"\\b(?!\\()"),S={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),C],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[s,t.concat(/::/,t.lookahead(/(?!class\b)/)),C],scope:{1:"title.class",3:"variable.constant"}},{match:[s,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[s,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},A={scope:"attr",match:t.concat(r,t.lookahead(":"),t.lookahead(/(?!::)/))},O={relevance:0,begin:/\(/,end:/\)/,keywords:_,contains:[A,a,S,e.C_BLOCK_COMMENT_MODE,m,y,N]},D={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",k(g).join("\\b|"),"|",k(x).join("\\b|"),"\\b)"),r,t.concat(p,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[O]};O.contains.push(D);const U=[A,S,e.C_BLOCK_COMMENT_MODE,m,y,N],X={begin:t.concat(/#\[\s*\\?/,t.either(s,i)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:E,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:E,keyword:["new","array"]},contains:["self",...U]},...U,{scope:"meta",variants:[{match:s},{match:i}]}]};return{case_insensitive:!1,keywords:_,contains:[X,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}]}},o,{scope:"variable.language",match:/\$this\b/},a,D,S,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},N,{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:_,contains:["self",X,a,S,e.C_BLOCK_COMMENT_MODE,m,y]}]},{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]},m,y]}}function yZ(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 bZ(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function sj(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"],o={$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"]},c={className:"meta",begin:/^(>>>|\.\.\.) /},u={className:"subst",begin:/\{/,end:/\}/,keywords:o,illegal:/#/},d={begin:/\{\{/,relevance:0},f={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,c,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,c,d,u]},{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,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,d,u]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},h="[0-9](_?[0-9])*",p=`(\\b(${h}))?\\.(${h})|\\b(${h})\\.`,m=`\\b|${r.join("|")}`,y={className:"number",relevance:0,variants:[{begin:`(\\b(${h})|(${p}))[eE][+-]?(${h})[jJ]?(?=${m})`},{begin:`(${p})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${m})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${m})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${m})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${m})`},{begin:`\\b(${h})[jJ](?=${m})`}]},E={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:o,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},g={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:["self",c,y,f,e.HASH_COMMENT_MODE]}]};return u.contains=[f,y,c],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:o,illegal:/(<\/|\?)|=>/,contains:[c,y,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},f,E,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[g]},{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:[y,g,f]}]}}function EZ(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function xZ(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]?/),s=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,i=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:[s,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[i,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:s},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:i},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function wZ(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]+/),s=t.concat(r,/(::\w+)*/),a={"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"]},o={className:"doctag",begin:"@[A-Za-z]+"},c={begin:"#<",end:">"},u=[e.COMMENT("#","$",{contains:[o]}),e.COMMENT("^=begin","^=end",{contains:[o],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],d={className:"subst",begin:/#\{/,end:/\}/,keywords:a},f={className:"string",contains:[e.BACKSLASH_ESCAPE,d],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?/},{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,d]})]}]},h="[1-9](_?[0-9])*|0",p="[0-9](_?[0-9])*",m={className:"number",relevance:0,variants:[{begin:`\\b(${h})(\\.(${p}))?([eE][+-]?(${p})|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"}]},y={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:a}]},N=[f,{variants:[{match:[/class\s+/,s,/\s+<\s+/,s]},{match:[/\b(class|module)\s+/,s]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:a},{match:[/(include|extend)\s+/,s],scope:{2:"title.class"},keywords:a},{relevance:0,match:[s,/\.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:[y]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[f,{begin:n}],relevance:0},m,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:a},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,d],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(c,u),relevance:0}].concat(c,u);d.contains=N,y.contains=N;const O=[{begin:/^\s*=>/,starts:{end:"$",contains:N}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:a,contains:N}}];return u.unshift(c),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:a,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(O).concat(u).concat(N)}}function vZ(e){const t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),s=t.concat(n,e.IDENT_RE),i={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,s,t.lookahead(/\s*\(/))},a="([ui](8|16|32|64|128|size)|f(32|64))?",o=["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"],c=["true","false","Some","None","Ok","Err"],u=["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!"],d=["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:d,keyword:o,literal:c,built_in:u},illegal:""},i]}}const _Z=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_-]*/}}),kZ=["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"],NZ=["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"],SZ=[...kZ,...NZ],TZ=["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(),AZ=["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(),CZ=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),IZ=["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 OZ(e){const t=_Z(e),n=CZ,r=AZ,s="@[a-z-]+",i="and or not only",o={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("+SZ.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},o,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+IZ.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,o,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:s,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:TZ.join(" ")},contains:[{begin:s,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},o,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function RZ(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function LZ(e){const t=e.regex,n=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},s={begin:/"/,end:/"/,contains:[{match:/""/}]},i=["true","false","unknown"],a=["double precision","large object","with timezone","without timezone"],o=["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"],c=["add","asc","collation","desc","final","first","last","view"],u=["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"],d=["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"],f=["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"],h=["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"],p=d,m=[...u,...c].filter(k=>!d.includes(k)),y={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},E={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},g={match:t.concat(/\b/,t.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function x(k){return t.concat(/\b/,t.either(...k.map(N=>N.replace(/\s+/,"\\s+"))),/\b/)}const b={scope:"keyword",match:x(h),relevance:0};function _(k,{exceptions:N,when:C}={}){const S=C;return N=N||[],k.map(A=>A.match(/\|\d+$/)||N.includes(A)?A:S(A)?`${A}|0`:A)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:_(m,{when:k=>k.length<3}),literal:i,type:o,built_in:f},contains:[{scope:"type",match:x(a)},b,g,y,r,s,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,E]}}function ij(e){return e?typeof e=="string"?e:e.source:null}function vu(e){return jt("(?=",e,")")}function jt(...e){return e.map(n=>ij(n)).join("")}function MZ(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function vr(...e){return"("+(MZ(e).capture?"":"?:")+e.map(r=>ij(r)).join("|")+")"}const ov=e=>jt(/\b/,e,/\w$/.test(e)?/\b/:/\B/),jZ=["Protocol","Type"].map(ov),LT=["init","self"].map(ov),DZ=["Any","Self"],Py=["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"],MT=["false","nil","true"],PZ=["assignment","associativity","higherThan","left","lowerThan","none","right"],BZ=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],jT=["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"],aj=vr(/[/=\-+!*%<>&|^~?]/,/[\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]/),oj=vr(aj,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),By=jt(aj,oj,"*"),lj=vr(/[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]/),Om=vr(lj,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),li=jt(lj,Om,"*"),Hh=jt(/[A-Z]/,Om,"*"),FZ=["attached","autoclosure",jt(/convention\(/,vr("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",jt(/objc\(/,li,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],UZ=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function $Z(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],s={match:[/\./,vr(...jZ,...LT)],className:{2:"keyword"}},i={match:jt(/\./,vr(...Py)),relevance:0},a=Py.filter(Te=>typeof Te=="string").concat(["_|0"]),o=Py.filter(Te=>typeof Te!="string").concat(DZ).map(ov),c={variants:[{className:"keyword",match:vr(...o,...LT)}]},u={$pattern:vr(/\b\w+/,/#\w+/),keyword:a.concat(BZ),literal:MT},d=[s,i,c],f={match:jt(/\./,vr(...jT)),relevance:0},h={className:"built_in",match:jt(/\b/,vr(...jT),/(?=\()/)},p=[f,h],m={match:/->/,relevance:0},y={className:"operator",relevance:0,variants:[{match:By},{match:`\\.(\\.|${oj})+`}]},E=[m,y],g="([0-9]_*)+",x="([0-9a-fA-F]_*)+",b={className:"number",relevance:0,variants:[{match:`\\b(${g})(\\.(${g}))?([eE][+-]?(${g}))?\\b`},{match:`\\b0x(${x})(\\.(${x}))?([pP][+-]?(${g}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},_=(Te="")=>({className:"subst",variants:[{match:jt(/\\/,Te,/[0\\tnr"']/)},{match:jt(/\\/,Te,/u\{[0-9a-fA-F]{1,8}\}/)}]}),k=(Te="")=>({className:"subst",match:jt(/\\/,Te,/[\t ]*(?:[\r\n]|\r\n)/)}),N=(Te="")=>({className:"subst",label:"interpol",begin:jt(/\\/,Te,/\(/),end:/\)/}),C=(Te="")=>({begin:jt(Te,/"""/),end:jt(/"""/,Te),contains:[_(Te),k(Te),N(Te)]}),S=(Te="")=>({begin:jt(Te,/"/),end:jt(/"/,Te),contains:[_(Te),N(Te)]}),A={className:"string",variants:[C(),C("#"),C("##"),C("###"),S(),S("#"),S("##"),S("###")]},O=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],D={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:O},U=Te=>{const Ke=jt(Te,/\//),Ne=jt(/\//,Te);return{begin:Ke,end:Ne,contains:[...O,{scope:"comment",begin:`#(?!.*${Ne})`,end:/$/}]}},X={scope:"regexp",variants:[U("###"),U("##"),U("#"),D]},M={match:jt(/`/,li,/`/)},j={className:"variable",match:/\$\d+/},T={className:"variable",match:`\\$${Om}+`},L=[M,j,T],R={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:UZ,contains:[...E,b,A]}]}},F={scope:"keyword",match:jt(/@/,vr(...FZ),vu(vr(/\(/,/\s+/)))},I={scope:"meta",match:jt(/@/,li)},V=[R,F,I],W={match:vu(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:jt(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Om,"+")},{className:"type",match:Hh,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:jt(/\s+&\s+/,vu(Hh)),relevance:0}]},P={begin://,keywords:u,contains:[...r,...d,...V,m,W]};W.contains.push(P);const ie={match:jt(li,/\s*:/),keywords:"_|0",relevance:0},G={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",ie,...r,X,...d,...p,...E,b,A,...L,...V,W]},re={begin://,keywords:"repeat each",contains:[...r,W]},ue={begin:vr(vu(jt(li,/\s*:/)),vu(jt(li,/\s+/,li,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:li}]},ee={begin:/\(/,end:/\)/,keywords:u,contains:[ue,...r,...d,...E,b,A,...V,W,G],endsParent:!0,illegal:/["']/},le={match:[/(func|macro)/,/\s+/,vr(M.match,li,By)],className:{1:"keyword",3:"title.function"},contains:[re,ee,t],illegal:[/\[/,/%/]},ne={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[re,ee,t],illegal:/\[|%/},me={match:[/operator/,/\s+/,By],className:{1:"keyword",3:"title"}},ye={begin:[/precedencegroup/,/\s+/,Hh],className:{1:"keyword",3:"title"},contains:[W],keywords:[...PZ,...MT],end:/}/},te={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},de={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},Ee={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,li,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:u,contains:[re,...d,{begin:/:/,end:/\{/,keywords:u,contains:[{scope:"title.class.inherited",match:Hh},...d],relevance:0}]};for(const Te of A.variants){const Ke=Te.contains.find(it=>it.label==="interpol");Ke.keywords=u;const Ne=[...d,...p,...E,b,A,...L];Ke.contains=[...Ne,{begin:/\(/,end:/\)/,contains:["self",...Ne]}]}return{name:"Swift",keywords:u,contains:[...r,le,ne,te,de,Ee,me,ye,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},X,...d,...p,...E,b,A,...L,...V,W,G]}}const Rm="[A-Za-z$_][0-9A-Za-z$_]*",cj=["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"],uj=["true","false","null","undefined","NaN","Infinity"],dj=["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"],fj=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],hj=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],pj=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],mj=[].concat(hj,dj,fj);function HZ(e){const t=e.regex,n=(R,{after:F})=>{const I="",end:""},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(R,F)=>{const I=R[0].length+R.index,V=R.input[I];if(V==="<"||V===","){F.ignoreMatch();return}V===">"&&(n(R,{after:I})||F.ignoreMatch());let W;const P=R.input.substring(I);if(W=P.match(/^\s*=/)){F.ignoreMatch();return}if((W=P.match(/^\s+extends\s+/))&&W.index===0){F.ignoreMatch();return}}},o={$pattern:Rm,keyword:cj,literal:uj,built_in:mj,"variable.language":pj},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\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},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:o,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},y={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},E={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},x={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]},b=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,y,E,{match:/\$\d+/},f];h.contains=b.concat({begin:/\{/,end:/\}/,keywords:o,contains:["self"].concat(b)});const _=[].concat(x,h.contains),k=_.concat([{begin:/(\s*)\(/,end:/\)/,keywords:o,contains:["self"].concat(_)}]),N={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:k},C={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"}}]},S={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:{_:[...dj,...fj]}},A={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},O={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[N],illegal:/%/},D={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function U(R){return t.concat("(?!",R.join("|"),")")}const X={match:t.concat(/\b/,U([...hj,"super","import"].map(R=>`${R}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},M={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},j={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},N]},T="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",L={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(T)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[N]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:k,CLASS_REFERENCE:S},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),A,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,y,E,x,{match:/\$\d+/},f,S,{scope:"attr",match:r+t.lookahead(":"),relevance:0},L,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[x,e.REGEXP_MODE,{className:"function",begin:T,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:o,contains:k}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:i},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},O,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[N,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},M,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[N]},X,D,C,j,{match:/\$[(.]/}]}}function gj(e){const t=e.regex,n=HZ(e),r=Rm,s=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},a={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:s},contains:[n.exports.CLASS_REFERENCE]},o={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},c=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],u={$pattern:Rm,keyword:cj.concat(c),literal:uj,built_in:mj.concat(s),"variable.language":pj},d={className:"meta",begin:"@"+r},f=(y,E,g)=>{const x=y.contains.findIndex(b=>b.label===E);if(x===-1)throw new Error("can not find mode to replace");y.contains.splice(x,1,g)};Object.assign(n.keywords,u),n.exports.PARAMS_CONTAINS.push(d);const h=n.contains.find(y=>y.scope==="attr"),p=Object.assign({},h,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,h,p]),n.contains=n.contains.concat([d,i,a,p]),f(n,"shebang",e.SHEBANG()),f(n,"use_strict",o);const m=n.contains.find(y=>y.label==="func.def");return m.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function zZ(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},s=/\d{1,2}\/\d{1,2}\/\d{4}/,i=/\d{4}-\d{1,2}-\d{1,2}/,a=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,o=/\d{1,2}(:\d{1,2}){1,2}/,c={className:"literal",variants:[{begin:t.concat(/# */,t.either(i,s),/ *#/)},{begin:t.concat(/# */,o,/ *#/)},{begin:t.concat(/# */,a,/ *#/)},{begin:t.concat(/# */,t.either(i,s),/ +/,t.either(a,o),/ *#/)}]},u={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])|[%&])?/}]},d={className:"label",begin:/^\w+:/},f=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),h=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,c,u,d,f,h,{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:[h]}]}}function VZ(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"],s={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},i={className:"variable",begin:/\$[\w_]+/},a={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},o={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/},c={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},u={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"}},i,a,s,e.QUOTE_STRING_MODE,c,u,o]}}function KZ(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,s={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},a=e.inherit(i,{begin:/\(/,end:/\)/}),o=e.inherit(e.APOS_STRING_MODE,{className:"string"}),c=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),u={endsWithParent:!0,illegal:/`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[i,c,o,a,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[i,a,c,o]}]}]},e.COMMENT(//,{relevance:10}),{begin://,relevance:10},s,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/)/,end:/>/,keywords:{name:"style"},contains:[u],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/)/,end:/>/,keywords:{name:"script"},contains:[u],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(//,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:u}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function yj(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]|$)/}]},s={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},a={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,s]},o=e.inherit(a,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),h={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"},p={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},m={begin:/\{/,end:/\}/,contains:[p],illegal:"\\n",relevance:0},y={begin:"\\[",end:"\\]",contains:[p],illegal:"\\n",relevance:0},E=[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}},h,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},m,y,i,a],g=[...E];return g.pop(),g.push(o),p.contains=g,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:E}}const YZ={arduino:DQ,bash:Y3,c:PQ,cpp:BQ,csharp:FQ,css:GQ,diff:qQ,go:XQ,graphql:QQ,ini:W3,java:ZQ,javascript:Z3,json:J3,kotlin:sZ,less:fZ,lua:hZ,makefile:nj,markdown:rj,objectivec:pZ,perl:mZ,php:gZ,"php-template":yZ,plaintext:bZ,python:sj,"python-repl":EZ,r:xZ,ruby:wZ,rust:vZ,scss:OZ,shell:RZ,sql:LZ,swift:$Z,typescript:gj,vbnet:zZ,wasm:VZ,xml:KZ,yaml:yj};function bj(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{const n=e[t],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&bj(n)}),e}let DT=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function Ej(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Na(e,...t){const n=Object.create(null);for(const r in e)n[r]=e[r];return t.forEach(function(r){for(const s in r)n[s]=r[s]}),n}const WZ="",PT=e=>!!e.scope,GZ=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map((r,s)=>`${r}${"_".repeat(s+1)}`)].join(" ")}return`${t}${e}`};class qZ{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=Ej(t)}openNode(t){if(!PT(t))return;const n=GZ(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){PT(t)&&(this.buffer+=WZ)}value(){return this.buffer}span(t){this.buffer+=``}}const BT=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class lv{constructor(){this.rootNode=BT(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){const n=BT({scope:t});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,n){return typeof n=="string"?t.addText(n):n.children&&(t.openNode(n),n.children.forEach(r=>this._walk(t,r)),t.closeNode(n)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(n=>typeof n=="string")?t.children=[t.children.join("")]:t.children.forEach(n=>{lv._collapse(n)}))}}class XZ extends lv{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){const r=t.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new qZ(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Jd(e){return e?typeof e=="string"?e:e.source:null}function xj(e){return Zo("(?=",e,")")}function QZ(e){return Zo("(?:",e,")*")}function ZZ(e){return Zo("(?:",e,")?")}function Zo(...e){return e.map(n=>Jd(n)).join("")}function JZ(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function cv(...e){return"("+(JZ(e).capture?"":"?:")+e.map(r=>Jd(r)).join("|")+")"}function wj(e){return new RegExp(e.toString()+"|").exec("").length-1}function eJ(e,t){const n=e&&e.exec(t);return n&&n.index===0}const tJ=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function uv(e,{joinWith:t}){let n=0;return e.map(r=>{n+=1;const s=n;let i=Jd(r),a="";for(;i.length>0;){const o=tJ.exec(i);if(!o){a+=i;break}a+=i.substring(0,o.index),i=i.substring(o.index+o[0].length),o[0][0]==="\\"&&o[1]?a+="\\"+String(Number(o[1])+s):(a+=o[0],o[0]==="("&&n++)}return a}).map(r=>`(${r})`).join(t)}const nJ=/\b\B/,vj="[a-zA-Z]\\w*",dv="[a-zA-Z_]\\w*",_j="\\b\\d+(\\.\\d+)?",kj="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Nj="\\b(0b[01]+)",rJ="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",sJ=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=Zo(t,/.*\b/,e.binary,/\b.*/)),Na({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},e)},ef={begin:"\\\\[\\s\\S]",relevance:0},iJ={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[ef]},aJ={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[ef]},oJ={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/},Hg=function(e,t,n={}){const r=Na({scope:"comment",begin:e,end:t,contains:[]},n);r.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 s=cv("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 r.contains.push({begin:Zo(/[ ]+/,"(",s,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},lJ=Hg("//","$"),cJ=Hg("/\\*","\\*/"),uJ=Hg("#","$"),dJ={scope:"number",begin:_j,relevance:0},fJ={scope:"number",begin:kj,relevance:0},hJ={scope:"number",begin:Nj,relevance:0},pJ={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[ef,{begin:/\[/,end:/\]/,relevance:0,contains:[ef]}]},mJ={scope:"title",begin:vj,relevance:0},gJ={scope:"title",begin:dv,relevance:0},yJ={begin:"\\.\\s*"+dv,relevance:0},bJ=function(e){return Object.assign(e,{"on:begin":(t,n)=>{n.data._beginMatch=t[1]},"on:end":(t,n)=>{n.data._beginMatch!==t[1]&&n.ignoreMatch()}})};var zh=Object.freeze({__proto__:null,APOS_STRING_MODE:iJ,BACKSLASH_ESCAPE:ef,BINARY_NUMBER_MODE:hJ,BINARY_NUMBER_RE:Nj,COMMENT:Hg,C_BLOCK_COMMENT_MODE:cJ,C_LINE_COMMENT_MODE:lJ,C_NUMBER_MODE:fJ,C_NUMBER_RE:kj,END_SAME_AS_BEGIN:bJ,HASH_COMMENT_MODE:uJ,IDENT_RE:vj,MATCH_NOTHING_RE:nJ,METHOD_GUARD:yJ,NUMBER_MODE:dJ,NUMBER_RE:_j,PHRASAL_WORDS_MODE:oJ,QUOTE_STRING_MODE:aJ,REGEXP_MODE:pJ,RE_STARTERS_RE:rJ,SHEBANG:sJ,TITLE_MODE:mJ,UNDERSCORE_IDENT_RE:dv,UNDERSCORE_TITLE_MODE:gJ});function EJ(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function xJ(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function wJ(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=EJ,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function vJ(e,t){Array.isArray(e.illegal)&&(e.illegal=cv(...e.illegal))}function _J(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function kJ(e,t){e.relevance===void 0&&(e.relevance=1)}const NJ=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach(r=>{delete e[r]}),e.keywords=n.keywords,e.begin=Zo(n.beforeMatch,xj(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},SJ=["of","and","for","in","not","or","if","then","parent","list","value"],TJ="keyword";function Sj(e,t,n=TJ){const r=Object.create(null);return typeof e=="string"?s(n,e.split(" ")):Array.isArray(e)?s(n,e):Object.keys(e).forEach(function(i){Object.assign(r,Sj(e[i],t,i))}),r;function s(i,a){t&&(a=a.map(o=>o.toLowerCase())),a.forEach(function(o){const c=o.split("|");r[c[0]]=[i,AJ(c[0],c[1])]})}}function AJ(e,t){return t?Number(t):CJ(e)?0:1}function CJ(e){return SJ.includes(e.toLowerCase())}const FT={},Ao=e=>{console.error(e)},UT=(e,...t)=>{console.log(`WARN: ${e}`,...t)},hl=(e,t)=>{FT[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),FT[`${e}/${t}`]=!0)},Lm=new Error;function Tj(e,t,{key:n}){let r=0;const s=e[n],i={},a={};for(let o=1;o<=t.length;o++)a[o+r]=s[o],i[o+r]=!0,r+=wj(t[o-1]);e[n]=a,e[n]._emit=i,e[n]._multi=!0}function IJ(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw Ao("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Lm;if(typeof e.beginScope!="object"||e.beginScope===null)throw Ao("beginScope must be object"),Lm;Tj(e,e.begin,{key:"beginScope"}),e.begin=uv(e.begin,{joinWith:""})}}function OJ(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw Ao("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Lm;if(typeof e.endScope!="object"||e.endScope===null)throw Ao("endScope must be object"),Lm;Tj(e,e.end,{key:"endScope"}),e.end=uv(e.end,{joinWith:""})}}function RJ(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function LJ(e){RJ(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),IJ(e),OJ(e)}function MJ(e){function t(a,o){return new RegExp(Jd(a),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(o?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(o,c){c.position=this.position++,this.matchIndexes[this.matchAt]=c,this.regexes.push([c,o]),this.matchAt+=wj(o)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const o=this.regexes.map(c=>c[1]);this.matcherRe=t(uv(o,{joinWith:"|"}),!0),this.lastIndex=0}exec(o){this.matcherRe.lastIndex=this.lastIndex;const c=this.matcherRe.exec(o);if(!c)return null;const u=c.findIndex((f,h)=>h>0&&f!==void 0),d=this.matchIndexes[u];return c.splice(0,u),Object.assign(c,d)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(o){if(this.multiRegexes[o])return this.multiRegexes[o];const c=new n;return this.rules.slice(o).forEach(([u,d])=>c.addRule(u,d)),c.compile(),this.multiRegexes[o]=c,c}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(o,c){this.rules.push([o,c]),c.type==="begin"&&this.count++}exec(o){const c=this.getMatcher(this.regexIndex);c.lastIndex=this.lastIndex;let u=c.exec(o);if(this.resumingScanAtSamePosition()&&!(u&&u.index===this.lastIndex)){const d=this.getMatcher(0);d.lastIndex=this.lastIndex+1,u=d.exec(o)}return u&&(this.regexIndex+=u.position+1,this.regexIndex===this.count&&this.considerAll()),u}}function s(a){const o=new r;return a.contains.forEach(c=>o.addRule(c.begin,{rule:c,type:"begin"})),a.terminatorEnd&&o.addRule(a.terminatorEnd,{type:"end"}),a.illegal&&o.addRule(a.illegal,{type:"illegal"}),o}function i(a,o){const c=a;if(a.isCompiled)return c;[xJ,_J,LJ,NJ].forEach(d=>d(a,o)),e.compilerExtensions.forEach(d=>d(a,o)),a.__beforeBegin=null,[wJ,vJ,kJ].forEach(d=>d(a,o)),a.isCompiled=!0;let u=null;return typeof a.keywords=="object"&&a.keywords.$pattern&&(a.keywords=Object.assign({},a.keywords),u=a.keywords.$pattern,delete a.keywords.$pattern),u=u||/\w+/,a.keywords&&(a.keywords=Sj(a.keywords,e.case_insensitive)),c.keywordPatternRe=t(u,!0),o&&(a.begin||(a.begin=/\B|\b/),c.beginRe=t(c.begin),!a.end&&!a.endsWithParent&&(a.end=/\B|\b/),a.end&&(c.endRe=t(c.end)),c.terminatorEnd=Jd(c.end)||"",a.endsWithParent&&o.terminatorEnd&&(c.terminatorEnd+=(a.end?"|":"")+o.terminatorEnd)),a.illegal&&(c.illegalRe=t(a.illegal)),a.contains||(a.contains=[]),a.contains=[].concat(...a.contains.map(function(d){return jJ(d==="self"?a:d)})),a.contains.forEach(function(d){i(d,c)}),a.starts&&i(a.starts,o),c.matcher=s(c),c}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=Na(e.classNameAliases||{}),i(e)}function Aj(e){return e?e.endsWithParent||Aj(e.starts):!1}function jJ(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return Na(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:Aj(e)?Na(e,{starts:e.starts?Na(e.starts):null}):Object.isFrozen(e)?Na(e):e}var DJ="11.11.1";class PJ extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}}const Fy=Ej,$T=Na,HT=Symbol("nomatch"),BJ=7,Cj=function(e){const t=Object.create(null),n=Object.create(null),r=[];let s=!0;const i="Could not find the language '{}', did you forget to load/include a language module?",a={disableAutodetect:!0,name:"Plain text",contains:[]};let o={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:XZ};function c(T){return o.noHighlightRe.test(T)}function u(T){let L=T.className+" ";L+=T.parentNode?T.parentNode.className:"";const R=o.languageDetectRe.exec(L);if(R){const F=S(R[1]);return F||(UT(i.replace("{}",R[1])),UT("Falling back to no-highlight mode for this block.",T)),F?R[1]:"no-highlight"}return L.split(/\s+/).find(F=>c(F)||S(F))}function d(T,L,R){let F="",I="";typeof L=="object"?(F=T,R=L.ignoreIllegals,I=L.language):(hl("10.7.0","highlight(lang, code, ...args) has been deprecated."),hl("10.7.0",`Please use highlight(code, options) instead. -https://github.com/highlightjs/highlight.js/issues/2277`),I=T,F=L),R===void 0&&(R=!0);const V={code:F,language:I};M("before:highlight",V);const W=V.result?V.result:f(V.language,V.code,R);return W.code=V.code,M("after:highlight",W),W}function f(T,L,R,F){const I=Object.create(null);function V(B,Q){return B.keywords[Q]}function W(){if(!Ne.keywords){He.addText(Ue);return}let B=0;Ne.keywordPatternRe.lastIndex=0;let Q=Ne.keywordPatternRe.exec(Ue),oe="";for(;Q;){oe+=Ue.substring(B,Q.index);const be=Ee.case_insensitive?Q[0].toLowerCase():Q[0],Oe=V(Ne,be);if(Oe){const[Ye,tt]=Oe;if(He.addText(oe),oe="",I[be]=(I[be]||0)+1,I[be]<=BJ&&(Et+=tt),Ye.startsWith("_"))oe+=Q[0];else{const ze=Ee.classNameAliases[Ye]||Ye;G(Q[0],ze)}}else oe+=Q[0];B=Ne.keywordPatternRe.lastIndex,Q=Ne.keywordPatternRe.exec(Ue)}oe+=Ue.substring(B),He.addText(oe)}function P(){if(Ue==="")return;let B=null;if(typeof Ne.subLanguage=="string"){if(!t[Ne.subLanguage]){He.addText(Ue);return}B=f(Ne.subLanguage,Ue,!0,it[Ne.subLanguage]),it[Ne.subLanguage]=B._top}else B=p(Ue,Ne.subLanguage.length?Ne.subLanguage:null);Ne.relevance>0&&(Et+=B.relevance),He.__addSublanguage(B._emitter,B.language)}function ie(){Ne.subLanguage!=null?P():W(),Ue=""}function G(B,Q){B!==""&&(He.startScope(Q),He.addText(B),He.endScope())}function re(B,Q){let oe=1;const be=Q.length-1;for(;oe<=be;){if(!B._emit[oe]){oe++;continue}const Oe=Ee.classNameAliases[B[oe]]||B[oe],Ye=Q[oe];Oe?G(Ye,Oe):(Ue=Ye,W(),Ue=""),oe++}}function ue(B,Q){return B.scope&&typeof B.scope=="string"&&He.openNode(Ee.classNameAliases[B.scope]||B.scope),B.beginScope&&(B.beginScope._wrap?(G(Ue,Ee.classNameAliases[B.beginScope._wrap]||B.beginScope._wrap),Ue=""):B.beginScope._multi&&(re(B.beginScope,Q),Ue="")),Ne=Object.create(B,{parent:{value:Ne}}),Ne}function ee(B,Q,oe){let be=eJ(B.endRe,oe);if(be){if(B["on:end"]){const Oe=new DT(B);B["on:end"](Q,Oe),Oe.isMatchIgnored&&(be=!1)}if(be){for(;B.endsParent&&B.parent;)B=B.parent;return B}}if(B.endsWithParent)return ee(B.parent,Q,oe)}function le(B){return Ne.matcher.regexIndex===0?(Ue+=B[0],1):(ct=!0,0)}function ne(B){const Q=B[0],oe=B.rule,be=new DT(oe),Oe=[oe.__beforeBegin,oe["on:begin"]];for(const Ye of Oe)if(Ye&&(Ye(B,be),be.isMatchIgnored))return le(Q);return oe.skip?Ue+=Q:(oe.excludeBegin&&(Ue+=Q),ie(),!oe.returnBegin&&!oe.excludeBegin&&(Ue=Q)),ue(oe,B),oe.returnBegin?0:Q.length}function me(B){const Q=B[0],oe=L.substring(B.index),be=ee(Ne,B,oe);if(!be)return HT;const Oe=Ne;Ne.endScope&&Ne.endScope._wrap?(ie(),G(Q,Ne.endScope._wrap)):Ne.endScope&&Ne.endScope._multi?(ie(),re(Ne.endScope,B)):Oe.skip?Ue+=Q:(Oe.returnEnd||Oe.excludeEnd||(Ue+=Q),ie(),Oe.excludeEnd&&(Ue=Q));do Ne.scope&&He.closeNode(),!Ne.skip&&!Ne.subLanguage&&(Et+=Ne.relevance),Ne=Ne.parent;while(Ne!==be.parent);return be.starts&&ue(be.starts,B),Oe.returnEnd?0:Q.length}function ye(){const B=[];for(let Q=Ne;Q!==Ee;Q=Q.parent)Q.scope&&B.unshift(Q.scope);B.forEach(Q=>He.openNode(Q))}let te={};function de(B,Q){const oe=Q&&Q[0];if(Ue+=B,oe==null)return ie(),0;if(te.type==="begin"&&Q.type==="end"&&te.index===Q.index&&oe===""){if(Ue+=L.slice(Q.index,Q.index+1),!s){const be=new Error(`0 width match regex (${T})`);throw be.languageName=T,be.badRule=te.rule,be}return 1}if(te=Q,Q.type==="begin")return ne(Q);if(Q.type==="illegal"&&!R){const be=new Error('Illegal lexeme "'+oe+'" for mode "'+(Ne.scope||"")+'"');throw be.mode=Ne,be}else if(Q.type==="end"){const be=me(Q);if(be!==HT)return be}if(Q.type==="illegal"&&oe==="")return Ue+=` -`,1;if(St>1e5&&St>Q.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Ue+=oe,oe.length}const Ee=S(T);if(!Ee)throw Ao(i.replace("{}",T)),new Error('Unknown language: "'+T+'"');const Te=MJ(Ee);let Ke="",Ne=F||Te;const it={},He=new o.__emitter(o);ye();let Ue="",Et=0,rt=0,St=0,ct=!1;try{if(Ee.__emitTokens)Ee.__emitTokens(L,He);else{for(Ne.matcher.considerAll();;){St++,ct?ct=!1:Ne.matcher.considerAll(),Ne.matcher.lastIndex=rt;const B=Ne.matcher.exec(L);if(!B)break;const Q=L.substring(rt,B.index),oe=de(Q,B);rt=B.index+oe}de(L.substring(rt))}return He.finalize(),Ke=He.toHTML(),{language:T,value:Ke,relevance:Et,illegal:!1,_emitter:He,_top:Ne}}catch(B){if(B.message&&B.message.includes("Illegal"))return{language:T,value:Fy(L),illegal:!0,relevance:0,_illegalBy:{message:B.message,index:rt,context:L.slice(rt-100,rt+100),mode:B.mode,resultSoFar:Ke},_emitter:He};if(s)return{language:T,value:Fy(L),illegal:!1,relevance:0,errorRaised:B,_emitter:He,_top:Ne};throw B}}function h(T){const L={value:Fy(T),illegal:!1,relevance:0,_top:a,_emitter:new o.__emitter(o)};return L._emitter.addText(T),L}function p(T,L){L=L||o.languages||Object.keys(t);const R=h(T),F=L.filter(S).filter(O).map(ie=>f(ie,T,!1));F.unshift(R);const I=F.sort((ie,G)=>{if(ie.relevance!==G.relevance)return G.relevance-ie.relevance;if(ie.language&&G.language){if(S(ie.language).supersetOf===G.language)return 1;if(S(G.language).supersetOf===ie.language)return-1}return 0}),[V,W]=I,P=V;return P.secondBest=W,P}function m(T,L,R){const F=L&&n[L]||R;T.classList.add("hljs"),T.classList.add(`language-${F}`)}function y(T){let L=null;const R=u(T);if(c(R))return;if(M("before:highlightElement",{el:T,language:R}),T.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",T);return}if(T.children.length>0&&(o.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(T)),o.throwUnescapedHTML))throw new PJ("One of your code blocks includes unescaped HTML.",T.innerHTML);L=T;const F=L.textContent,I=R?d(F,{language:R,ignoreIllegals:!0}):p(F);T.innerHTML=I.value,T.dataset.highlighted="yes",m(T,R,I.language),T.result={language:I.language,re:I.relevance,relevance:I.relevance},I.secondBest&&(T.secondBest={language:I.secondBest.language,relevance:I.secondBest.relevance}),M("after:highlightElement",{el:T,result:I,text:F})}function E(T){o=$T(o,T)}const g=()=>{_(),hl("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function x(){_(),hl("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let b=!1;function _(){function T(){_()}if(document.readyState==="loading"){b||window.addEventListener("DOMContentLoaded",T,!1),b=!0;return}document.querySelectorAll(o.cssSelector).forEach(y)}function k(T,L){let R=null;try{R=L(e)}catch(F){if(Ao("Language definition for '{}' could not be registered.".replace("{}",T)),s)Ao(F);else throw F;R=a}R.name||(R.name=T),t[T]=R,R.rawDefinition=L.bind(null,e),R.aliases&&A(R.aliases,{languageName:T})}function N(T){delete t[T];for(const L of Object.keys(n))n[L]===T&&delete n[L]}function C(){return Object.keys(t)}function S(T){return T=(T||"").toLowerCase(),t[T]||t[n[T]]}function A(T,{languageName:L}){typeof T=="string"&&(T=[T]),T.forEach(R=>{n[R.toLowerCase()]=L})}function O(T){const L=S(T);return L&&!L.disableAutodetect}function D(T){T["before:highlightBlock"]&&!T["before:highlightElement"]&&(T["before:highlightElement"]=L=>{T["before:highlightBlock"](Object.assign({block:L.el},L))}),T["after:highlightBlock"]&&!T["after:highlightElement"]&&(T["after:highlightElement"]=L=>{T["after:highlightBlock"](Object.assign({block:L.el},L))})}function U(T){D(T),r.push(T)}function X(T){const L=r.indexOf(T);L!==-1&&r.splice(L,1)}function M(T,L){const R=T;r.forEach(function(F){F[R]&&F[R](L)})}function j(T){return hl("10.7.0","highlightBlock will be removed entirely in v12.0"),hl("10.7.0","Please use highlightElement now."),y(T)}Object.assign(e,{highlight:d,highlightAuto:p,highlightAll:_,highlightElement:y,highlightBlock:j,configure:E,initHighlighting:g,initHighlightingOnLoad:x,registerLanguage:k,unregisterLanguage:N,listLanguages:C,getLanguage:S,registerAliases:A,autoDetection:O,inherit:$T,addPlugin:U,removePlugin:X}),e.debugMode=function(){s=!1},e.safeMode=function(){s=!0},e.versionString=DJ,e.regex={concat:Zo,lookahead:xj,either:cv,optional:ZZ,anyNumberOfTimes:QZ};for(const T in zh)typeof zh[T]=="object"&&bj(zh[T]);return Object.assign(e,zh),e},Tc=Cj({});Tc.newInstance=()=>Cj({});var FJ=Tc;Tc.HighlightJS=Tc;Tc.default=Tc;const Hr=mf(FJ),zT={},UJ="hljs-";function $J(e){const t=Hr.newInstance();return e&&i(e),{highlight:n,highlightAuto:r,listLanguages:s,register:i,registerAlias:a,registered:o};function n(c,u,d){const f=d||zT,h=typeof f.prefix=="string"?f.prefix:UJ;if(!t.getLanguage(c))throw new Error("Unknown language: `"+c+"` is not registered");t.configure({__emitter:HJ,classPrefix:h});const p=t.highlight(u,{ignoreIllegals:!0,language:c});if(p.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:p.errorRaised});const m=p._emitter.root,y=m.data;return y.language=p.language,y.relevance=p.relevance,m}function r(c,u){const f=(u||zT).subset||s();let h=-1,p=0,m;for(;++hp&&(p=E.data.relevance,m=E)}return m||{type:"root",children:[],data:{language:void 0,relevance:p}}}function s(){return t.listLanguages()}function i(c,u){if(typeof c=="string")t.registerLanguage(c,u);else{let d;for(d in c)Object.hasOwn(c,d)&&t.registerLanguage(d,c[d])}}function a(c,u){if(typeof c=="string")t.registerAliases(typeof u=="string"?u:[...u],{languageName:c});else{let d;for(d in c)if(Object.hasOwn(c,d)){const f=c[d];t.registerAliases(typeof f=="string"?f:[...f],{languageName:d})}}}function o(c){return!!t.getLanguage(c)}}class HJ{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],s=t.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:s}):r.children.push(...s)}openNode(t){const n=this,r=t.split(".").map(function(a,o){return o?a+"_".repeat(o):n.options.classPrefix+a}),s=this.stack[this.stack.length-1],i={type:"element",tagName:"span",properties:{className:r},children:[]};s.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const zJ={};function VT(e){const t=e||zJ,n=t.aliases,r=t.detect||!1,s=t.languages||YZ,i=t.plainText,a=t.prefix,o=t.subset;let c="hljs";const u=$J(s);if(n&&u.registerAlias(n),a){const d=a.indexOf("-");c=d===-1?a:a.slice(0,d)}return function(d,f){Of(d,"element",function(h,p,m){if(h.tagName!=="code"||!m||m.type!=="element"||m.tagName!=="pre")return;const y=VJ(h);if(y===!1||!y&&!r||y&&i&&i.includes(y))return;Array.isArray(h.properties.className)||(h.properties.className=[]),h.properties.className.includes(c)||h.properties.className.unshift(c);const E=TQ(h,{whitespace:"pre"});let g;try{g=y?u.highlight(y,E,{prefix:a}):u.highlightAuto(E,{prefix:a,subset:o})}catch(x){const b=x;if(y&&/Unknown language/.test(b.message)){f.message("Cannot highlight as `"+y+"`, it’s not registered",{ancestors:[m,h],cause:b,place:h.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw b}!y&&g.data&&g.data.language&&h.properties.className.push("language-"+g.data.language),g.children.length>0&&(h.children=g.children)})}}function VJ(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let r;for(;++n-1&&i<=t.length){let a=0;for(;;){let o=n[a];if(o===void 0){const c=WT(t,n[a-1]);o=c===-1?t.length+1:c+1,n[a]=o}if(o>i)return{line:a+1,column:i-(a>0?n[a-1]:0)+1,offset:i};a++}}}function s(i){if(i&&typeof i.line=="number"&&typeof i.column=="number"&&!Number.isNaN(i.line)&&!Number.isNaN(i.column)){for(;n.length1?n[i.line-2]:0)+i.column-1;if(a=55296&&e<=57343}function gee(e){return e>=56320&&e<=57343}function yee(e,t){return(e-55296)*1024+9216+t}function jj(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function Dj(e){return e>=64976&&e<=65007||mee.has(e)}var ce;(function(e){e.controlCharacterInInputStream="control-character-in-input-stream",e.noncharacterInInputStream="noncharacter-in-input-stream",e.surrogateInInputStream="surrogate-in-input-stream",e.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",e.endTagWithAttributes="end-tag-with-attributes",e.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",e.unexpectedSolidusInTag="unexpected-solidus-in-tag",e.unexpectedNullCharacter="unexpected-null-character",e.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",e.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",e.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",e.missingEndTagName="missing-end-tag-name",e.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",e.unknownNamedCharacterReference="unknown-named-character-reference",e.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",e.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",e.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",e.eofBeforeTagName="eof-before-tag-name",e.eofInTag="eof-in-tag",e.missingAttributeValue="missing-attribute-value",e.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",e.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",e.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",e.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",e.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",e.missingDoctypePublicIdentifier="missing-doctype-public-identifier",e.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",e.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",e.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",e.cdataInHtmlContent="cdata-in-html-content",e.incorrectlyOpenedComment="incorrectly-opened-comment",e.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",e.eofInDoctype="eof-in-doctype",e.nestedComment="nested-comment",e.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",e.eofInComment="eof-in-comment",e.incorrectlyClosedComment="incorrectly-closed-comment",e.eofInCdata="eof-in-cdata",e.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",e.nullCharacterReference="null-character-reference",e.surrogateCharacterReference="surrogate-character-reference",e.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",e.controlCharacterReference="control-character-reference",e.noncharacterCharacterReference="noncharacter-character-reference",e.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",e.missingDoctypeName="missing-doctype-name",e.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",e.duplicateAttribute="duplicate-attribute",e.nonConformingDoctype="non-conforming-doctype",e.missingDoctype="missing-doctype",e.misplacedDoctype="misplaced-doctype",e.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",e.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",e.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",e.openElementsLeftAfterEof="open-elements-left-after-eof",e.abandonedHeadElementChild="abandoned-head-element-child",e.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",e.nestedNoscriptInHead="nested-noscript-in-head",e.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(ce||(ce={}));const bee=65536;class Eee{constructor(t){this.handler=t,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=bee,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(t,n){const{line:r,col:s,offset:i}=this,a=s+n,o=i+n;return{code:t,startLine:r,endLine:r,startCol:a,endCol:a,startOffset:o,endOffset:o}}_err(t){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(t,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(t){if(this.pos!==this.html.length-1){const n=this.html.charCodeAt(this.pos+1);if(gee(n))return this.pos++,this._addGap(),yee(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,H.EOF;return this._err(ce.surrogateInInputStream),t}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(t,n){this.html.length>0?this.html+=t:this.html=t,this.endOfChunkHit=!1,this.lastChunkWritten=n}insertHtmlAtCurrentPos(t){this.html=this.html.substring(0,this.pos+1)+t+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(t,n){if(this.pos+t.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(n)return this.html.startsWith(t,this.pos);for(let r=0;r=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,H.EOF;const r=this.html.charCodeAt(n);return r===H.CARRIAGE_RETURN?H.LINE_FEED:r}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,H.EOF;let t=this.html.charCodeAt(this.pos);return t===H.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,H.LINE_FEED):t===H.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,Mj(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===H.LINE_FEED||t===H.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){jj(t)?this._err(ce.controlCharacterInInputStream):Dj(t)&&this._err(ce.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.pos=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}const xee=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(e=>e.charCodeAt(0))),wee=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function vee(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=wee.get(e))!==null&&t!==void 0?t:e}var Gn;(function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"})(Gn||(Gn={}));const _ee=32;var Sa;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(Sa||(Sa={}));function gE(e){return e>=Gn.ZERO&&e<=Gn.NINE}function kee(e){return e>=Gn.UPPER_A&&e<=Gn.UPPER_F||e>=Gn.LOWER_A&&e<=Gn.LOWER_F}function Nee(e){return e>=Gn.UPPER_A&&e<=Gn.UPPER_Z||e>=Gn.LOWER_A&&e<=Gn.LOWER_Z||gE(e)}function See(e){return e===Gn.EQUALS||Nee(e)}var Yn;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(Yn||(Yn={}));var Ui;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(Ui||(Ui={}));class Tee{constructor(t,n,r){this.decodeTree=t,this.emitCodePoint=n,this.errors=r,this.state=Yn.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Ui.Strict}startEntity(t){this.decodeMode=t,this.state=Yn.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case Yn.EntityStart:return t.charCodeAt(n)===Gn.NUM?(this.state=Yn.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=Yn.NamedEntity,this.stateNamedEntity(t,n));case Yn.NumericStart:return this.stateNumericStart(t,n);case Yn.NumericDecimal:return this.stateNumericDecimal(t,n);case Yn.NumericHex:return this.stateNumericHex(t,n);case Yn.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|_ee)===Gn.LOWER_X?(this.state=Yn.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=Yn.NumericDecimal,this.stateNumericDecimal(t,n))}addToNumericResult(t,n,r,s){if(n!==r){const i=r-n;this.result=this.result*Math.pow(s,i)+Number.parseInt(t.substr(n,i),s),this.consumed+=i}}stateNumericHex(t,n){const r=n;for(;n>14;for(;n>14,i!==0){if(a===Gn.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==Ui.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;const{result:n,decodeTree:r}=this,s=(r[n]&Sa.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,s,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,r){const{decodeTree:s}=this;return this.emitCodePoint(n===1?s[t]&~Sa.VALUE_LENGTH:s[t+1],r),n===3&&this.emitCodePoint(s[t+2],r),r}end(){var t;switch(this.state){case Yn.NamedEntity:return this.result!==0&&(this.decodeMode!==Ui.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Yn.NumericDecimal:return this.emitNumericEntity(0,2);case Yn.NumericHex:return this.emitNumericEntity(0,3);case Yn.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Yn.EntityStart:return 0}}}function Aee(e,t,n,r){const s=(t&Sa.BRANCH_LENGTH)>>7,i=t&Sa.JUMP_TABLE;if(s===0)return i!==0&&r===i?n:-1;if(i){const c=r-i;return c<0||c>=s?-1:e[n+c]-1}let a=n,o=a+s-1;for(;a<=o;){const c=a+o>>>1,u=e[c];if(ur)o=c-1;else return e[c+s]}return-1}var xe;(function(e){e.HTML="http://www.w3.org/1999/xhtml",e.MATHML="http://www.w3.org/1998/Math/MathML",e.SVG="http://www.w3.org/2000/svg",e.XLINK="http://www.w3.org/1999/xlink",e.XML="http://www.w3.org/XML/1998/namespace",e.XMLNS="http://www.w3.org/2000/xmlns/"})(xe||(xe={}));var Co;(function(e){e.TYPE="type",e.ACTION="action",e.ENCODING="encoding",e.PROMPT="prompt",e.NAME="name",e.COLOR="color",e.FACE="face",e.SIZE="size"})(Co||(Co={}));var bs;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(bs||(bs={}));var se;(function(e){e.A="a",e.ADDRESS="address",e.ANNOTATION_XML="annotation-xml",e.APPLET="applet",e.AREA="area",e.ARTICLE="article",e.ASIDE="aside",e.B="b",e.BASE="base",e.BASEFONT="basefont",e.BGSOUND="bgsound",e.BIG="big",e.BLOCKQUOTE="blockquote",e.BODY="body",e.BR="br",e.BUTTON="button",e.CAPTION="caption",e.CENTER="center",e.CODE="code",e.COL="col",e.COLGROUP="colgroup",e.DD="dd",e.DESC="desc",e.DETAILS="details",e.DIALOG="dialog",e.DIR="dir",e.DIV="div",e.DL="dl",e.DT="dt",e.EM="em",e.EMBED="embed",e.FIELDSET="fieldset",e.FIGCAPTION="figcaption",e.FIGURE="figure",e.FONT="font",e.FOOTER="footer",e.FOREIGN_OBJECT="foreignObject",e.FORM="form",e.FRAME="frame",e.FRAMESET="frameset",e.H1="h1",e.H2="h2",e.H3="h3",e.H4="h4",e.H5="h5",e.H6="h6",e.HEAD="head",e.HEADER="header",e.HGROUP="hgroup",e.HR="hr",e.HTML="html",e.I="i",e.IMG="img",e.IMAGE="image",e.INPUT="input",e.IFRAME="iframe",e.KEYGEN="keygen",e.LABEL="label",e.LI="li",e.LINK="link",e.LISTING="listing",e.MAIN="main",e.MALIGNMARK="malignmark",e.MARQUEE="marquee",e.MATH="math",e.MENU="menu",e.META="meta",e.MGLYPH="mglyph",e.MI="mi",e.MO="mo",e.MN="mn",e.MS="ms",e.MTEXT="mtext",e.NAV="nav",e.NOBR="nobr",e.NOFRAMES="noframes",e.NOEMBED="noembed",e.NOSCRIPT="noscript",e.OBJECT="object",e.OL="ol",e.OPTGROUP="optgroup",e.OPTION="option",e.P="p",e.PARAM="param",e.PLAINTEXT="plaintext",e.PRE="pre",e.RB="rb",e.RP="rp",e.RT="rt",e.RTC="rtc",e.RUBY="ruby",e.S="s",e.SCRIPT="script",e.SEARCH="search",e.SECTION="section",e.SELECT="select",e.SOURCE="source",e.SMALL="small",e.SPAN="span",e.STRIKE="strike",e.STRONG="strong",e.STYLE="style",e.SUB="sub",e.SUMMARY="summary",e.SUP="sup",e.TABLE="table",e.TBODY="tbody",e.TEMPLATE="template",e.TEXTAREA="textarea",e.TFOOT="tfoot",e.TD="td",e.TH="th",e.THEAD="thead",e.TITLE="title",e.TR="tr",e.TRACK="track",e.TT="tt",e.U="u",e.UL="ul",e.SVG="svg",e.VAR="var",e.WBR="wbr",e.XMP="xmp"})(se||(se={}));var v;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.A=1]="A",e[e.ADDRESS=2]="ADDRESS",e[e.ANNOTATION_XML=3]="ANNOTATION_XML",e[e.APPLET=4]="APPLET",e[e.AREA=5]="AREA",e[e.ARTICLE=6]="ARTICLE",e[e.ASIDE=7]="ASIDE",e[e.B=8]="B",e[e.BASE=9]="BASE",e[e.BASEFONT=10]="BASEFONT",e[e.BGSOUND=11]="BGSOUND",e[e.BIG=12]="BIG",e[e.BLOCKQUOTE=13]="BLOCKQUOTE",e[e.BODY=14]="BODY",e[e.BR=15]="BR",e[e.BUTTON=16]="BUTTON",e[e.CAPTION=17]="CAPTION",e[e.CENTER=18]="CENTER",e[e.CODE=19]="CODE",e[e.COL=20]="COL",e[e.COLGROUP=21]="COLGROUP",e[e.DD=22]="DD",e[e.DESC=23]="DESC",e[e.DETAILS=24]="DETAILS",e[e.DIALOG=25]="DIALOG",e[e.DIR=26]="DIR",e[e.DIV=27]="DIV",e[e.DL=28]="DL",e[e.DT=29]="DT",e[e.EM=30]="EM",e[e.EMBED=31]="EMBED",e[e.FIELDSET=32]="FIELDSET",e[e.FIGCAPTION=33]="FIGCAPTION",e[e.FIGURE=34]="FIGURE",e[e.FONT=35]="FONT",e[e.FOOTER=36]="FOOTER",e[e.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",e[e.FORM=38]="FORM",e[e.FRAME=39]="FRAME",e[e.FRAMESET=40]="FRAMESET",e[e.H1=41]="H1",e[e.H2=42]="H2",e[e.H3=43]="H3",e[e.H4=44]="H4",e[e.H5=45]="H5",e[e.H6=46]="H6",e[e.HEAD=47]="HEAD",e[e.HEADER=48]="HEADER",e[e.HGROUP=49]="HGROUP",e[e.HR=50]="HR",e[e.HTML=51]="HTML",e[e.I=52]="I",e[e.IMG=53]="IMG",e[e.IMAGE=54]="IMAGE",e[e.INPUT=55]="INPUT",e[e.IFRAME=56]="IFRAME",e[e.KEYGEN=57]="KEYGEN",e[e.LABEL=58]="LABEL",e[e.LI=59]="LI",e[e.LINK=60]="LINK",e[e.LISTING=61]="LISTING",e[e.MAIN=62]="MAIN",e[e.MALIGNMARK=63]="MALIGNMARK",e[e.MARQUEE=64]="MARQUEE",e[e.MATH=65]="MATH",e[e.MENU=66]="MENU",e[e.META=67]="META",e[e.MGLYPH=68]="MGLYPH",e[e.MI=69]="MI",e[e.MO=70]="MO",e[e.MN=71]="MN",e[e.MS=72]="MS",e[e.MTEXT=73]="MTEXT",e[e.NAV=74]="NAV",e[e.NOBR=75]="NOBR",e[e.NOFRAMES=76]="NOFRAMES",e[e.NOEMBED=77]="NOEMBED",e[e.NOSCRIPT=78]="NOSCRIPT",e[e.OBJECT=79]="OBJECT",e[e.OL=80]="OL",e[e.OPTGROUP=81]="OPTGROUP",e[e.OPTION=82]="OPTION",e[e.P=83]="P",e[e.PARAM=84]="PARAM",e[e.PLAINTEXT=85]="PLAINTEXT",e[e.PRE=86]="PRE",e[e.RB=87]="RB",e[e.RP=88]="RP",e[e.RT=89]="RT",e[e.RTC=90]="RTC",e[e.RUBY=91]="RUBY",e[e.S=92]="S",e[e.SCRIPT=93]="SCRIPT",e[e.SEARCH=94]="SEARCH",e[e.SECTION=95]="SECTION",e[e.SELECT=96]="SELECT",e[e.SOURCE=97]="SOURCE",e[e.SMALL=98]="SMALL",e[e.SPAN=99]="SPAN",e[e.STRIKE=100]="STRIKE",e[e.STRONG=101]="STRONG",e[e.STYLE=102]="STYLE",e[e.SUB=103]="SUB",e[e.SUMMARY=104]="SUMMARY",e[e.SUP=105]="SUP",e[e.TABLE=106]="TABLE",e[e.TBODY=107]="TBODY",e[e.TEMPLATE=108]="TEMPLATE",e[e.TEXTAREA=109]="TEXTAREA",e[e.TFOOT=110]="TFOOT",e[e.TD=111]="TD",e[e.TH=112]="TH",e[e.THEAD=113]="THEAD",e[e.TITLE=114]="TITLE",e[e.TR=115]="TR",e[e.TRACK=116]="TRACK",e[e.TT=117]="TT",e[e.U=118]="U",e[e.UL=119]="UL",e[e.SVG=120]="SVG",e[e.VAR=121]="VAR",e[e.WBR=122]="WBR",e[e.XMP=123]="XMP"})(v||(v={}));const Cee=new Map([[se.A,v.A],[se.ADDRESS,v.ADDRESS],[se.ANNOTATION_XML,v.ANNOTATION_XML],[se.APPLET,v.APPLET],[se.AREA,v.AREA],[se.ARTICLE,v.ARTICLE],[se.ASIDE,v.ASIDE],[se.B,v.B],[se.BASE,v.BASE],[se.BASEFONT,v.BASEFONT],[se.BGSOUND,v.BGSOUND],[se.BIG,v.BIG],[se.BLOCKQUOTE,v.BLOCKQUOTE],[se.BODY,v.BODY],[se.BR,v.BR],[se.BUTTON,v.BUTTON],[se.CAPTION,v.CAPTION],[se.CENTER,v.CENTER],[se.CODE,v.CODE],[se.COL,v.COL],[se.COLGROUP,v.COLGROUP],[se.DD,v.DD],[se.DESC,v.DESC],[se.DETAILS,v.DETAILS],[se.DIALOG,v.DIALOG],[se.DIR,v.DIR],[se.DIV,v.DIV],[se.DL,v.DL],[se.DT,v.DT],[se.EM,v.EM],[se.EMBED,v.EMBED],[se.FIELDSET,v.FIELDSET],[se.FIGCAPTION,v.FIGCAPTION],[se.FIGURE,v.FIGURE],[se.FONT,v.FONT],[se.FOOTER,v.FOOTER],[se.FOREIGN_OBJECT,v.FOREIGN_OBJECT],[se.FORM,v.FORM],[se.FRAME,v.FRAME],[se.FRAMESET,v.FRAMESET],[se.H1,v.H1],[se.H2,v.H2],[se.H3,v.H3],[se.H4,v.H4],[se.H5,v.H5],[se.H6,v.H6],[se.HEAD,v.HEAD],[se.HEADER,v.HEADER],[se.HGROUP,v.HGROUP],[se.HR,v.HR],[se.HTML,v.HTML],[se.I,v.I],[se.IMG,v.IMG],[se.IMAGE,v.IMAGE],[se.INPUT,v.INPUT],[se.IFRAME,v.IFRAME],[se.KEYGEN,v.KEYGEN],[se.LABEL,v.LABEL],[se.LI,v.LI],[se.LINK,v.LINK],[se.LISTING,v.LISTING],[se.MAIN,v.MAIN],[se.MALIGNMARK,v.MALIGNMARK],[se.MARQUEE,v.MARQUEE],[se.MATH,v.MATH],[se.MENU,v.MENU],[se.META,v.META],[se.MGLYPH,v.MGLYPH],[se.MI,v.MI],[se.MO,v.MO],[se.MN,v.MN],[se.MS,v.MS],[se.MTEXT,v.MTEXT],[se.NAV,v.NAV],[se.NOBR,v.NOBR],[se.NOFRAMES,v.NOFRAMES],[se.NOEMBED,v.NOEMBED],[se.NOSCRIPT,v.NOSCRIPT],[se.OBJECT,v.OBJECT],[se.OL,v.OL],[se.OPTGROUP,v.OPTGROUP],[se.OPTION,v.OPTION],[se.P,v.P],[se.PARAM,v.PARAM],[se.PLAINTEXT,v.PLAINTEXT],[se.PRE,v.PRE],[se.RB,v.RB],[se.RP,v.RP],[se.RT,v.RT],[se.RTC,v.RTC],[se.RUBY,v.RUBY],[se.S,v.S],[se.SCRIPT,v.SCRIPT],[se.SEARCH,v.SEARCH],[se.SECTION,v.SECTION],[se.SELECT,v.SELECT],[se.SOURCE,v.SOURCE],[se.SMALL,v.SMALL],[se.SPAN,v.SPAN],[se.STRIKE,v.STRIKE],[se.STRONG,v.STRONG],[se.STYLE,v.STYLE],[se.SUB,v.SUB],[se.SUMMARY,v.SUMMARY],[se.SUP,v.SUP],[se.TABLE,v.TABLE],[se.TBODY,v.TBODY],[se.TEMPLATE,v.TEMPLATE],[se.TEXTAREA,v.TEXTAREA],[se.TFOOT,v.TFOOT],[se.TD,v.TD],[se.TH,v.TH],[se.THEAD,v.THEAD],[se.TITLE,v.TITLE],[se.TR,v.TR],[se.TRACK,v.TRACK],[se.TT,v.TT],[se.U,v.U],[se.UL,v.UL],[se.SVG,v.SVG],[se.VAR,v.VAR],[se.WBR,v.WBR],[se.XMP,v.XMP]]);function Qc(e){var t;return(t=Cee.get(e))!==null&&t!==void 0?t:v.UNKNOWN}const ke=v,Iee={[xe.HTML]:new Set([ke.ADDRESS,ke.APPLET,ke.AREA,ke.ARTICLE,ke.ASIDE,ke.BASE,ke.BASEFONT,ke.BGSOUND,ke.BLOCKQUOTE,ke.BODY,ke.BR,ke.BUTTON,ke.CAPTION,ke.CENTER,ke.COL,ke.COLGROUP,ke.DD,ke.DETAILS,ke.DIR,ke.DIV,ke.DL,ke.DT,ke.EMBED,ke.FIELDSET,ke.FIGCAPTION,ke.FIGURE,ke.FOOTER,ke.FORM,ke.FRAME,ke.FRAMESET,ke.H1,ke.H2,ke.H3,ke.H4,ke.H5,ke.H6,ke.HEAD,ke.HEADER,ke.HGROUP,ke.HR,ke.HTML,ke.IFRAME,ke.IMG,ke.INPUT,ke.LI,ke.LINK,ke.LISTING,ke.MAIN,ke.MARQUEE,ke.MENU,ke.META,ke.NAV,ke.NOEMBED,ke.NOFRAMES,ke.NOSCRIPT,ke.OBJECT,ke.OL,ke.P,ke.PARAM,ke.PLAINTEXT,ke.PRE,ke.SCRIPT,ke.SECTION,ke.SELECT,ke.SOURCE,ke.STYLE,ke.SUMMARY,ke.TABLE,ke.TBODY,ke.TD,ke.TEMPLATE,ke.TEXTAREA,ke.TFOOT,ke.TH,ke.THEAD,ke.TITLE,ke.TR,ke.TRACK,ke.UL,ke.WBR,ke.XMP]),[xe.MATHML]:new Set([ke.MI,ke.MO,ke.MN,ke.MS,ke.MTEXT,ke.ANNOTATION_XML]),[xe.SVG]:new Set([ke.TITLE,ke.FOREIGN_OBJECT,ke.DESC]),[xe.XLINK]:new Set,[xe.XML]:new Set,[xe.XMLNS]:new Set},yE=new Set([ke.H1,ke.H2,ke.H3,ke.H4,ke.H5,ke.H6]);se.STYLE,se.SCRIPT,se.XMP,se.IFRAME,se.NOEMBED,se.NOFRAMES,se.PLAINTEXT;var z;(function(e){e[e.DATA=0]="DATA",e[e.RCDATA=1]="RCDATA",e[e.RAWTEXT=2]="RAWTEXT",e[e.SCRIPT_DATA=3]="SCRIPT_DATA",e[e.PLAINTEXT=4]="PLAINTEXT",e[e.TAG_OPEN=5]="TAG_OPEN",e[e.END_TAG_OPEN=6]="END_TAG_OPEN",e[e.TAG_NAME=7]="TAG_NAME",e[e.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",e[e.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",e[e.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",e[e.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",e[e.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",e[e.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",e[e.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",e[e.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",e[e.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",e[e.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",e[e.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",e[e.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",e[e.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",e[e.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",e[e.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",e[e.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",e[e.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",e[e.BOGUS_COMMENT=40]="BOGUS_COMMENT",e[e.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",e[e.COMMENT_START=42]="COMMENT_START",e[e.COMMENT_START_DASH=43]="COMMENT_START_DASH",e[e.COMMENT=44]="COMMENT",e[e.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",e[e.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",e[e.COMMENT_END_DASH=49]="COMMENT_END_DASH",e[e.COMMENT_END=50]="COMMENT_END",e[e.COMMENT_END_BANG=51]="COMMENT_END_BANG",e[e.DOCTYPE=52]="DOCTYPE",e[e.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",e[e.DOCTYPE_NAME=54]="DOCTYPE_NAME",e[e.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",e[e.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",e[e.CDATA_SECTION=68]="CDATA_SECTION",e[e.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",e[e.CDATA_SECTION_END=70]="CDATA_SECTION_END",e[e.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",e[e.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(z||(z={}));const vn={DATA:z.DATA,RCDATA:z.RCDATA,RAWTEXT:z.RAWTEXT,SCRIPT_DATA:z.SCRIPT_DATA,PLAINTEXT:z.PLAINTEXT,CDATA_SECTION:z.CDATA_SECTION};function Oee(e){return e>=H.DIGIT_0&&e<=H.DIGIT_9}function $u(e){return e>=H.LATIN_CAPITAL_A&&e<=H.LATIN_CAPITAL_Z}function Ree(e){return e>=H.LATIN_SMALL_A&&e<=H.LATIN_SMALL_Z}function pa(e){return Ree(e)||$u(e)}function qT(e){return pa(e)||Oee(e)}function Vh(e){return e+32}function Bj(e){return e===H.SPACE||e===H.LINE_FEED||e===H.TABULATION||e===H.FORM_FEED}function XT(e){return Bj(e)||e===H.SOLIDUS||e===H.GREATER_THAN_SIGN}function Lee(e){return e===H.NULL?ce.nullCharacterReference:e>1114111?ce.characterReferenceOutsideUnicodeRange:Mj(e)?ce.surrogateCharacterReference:Dj(e)?ce.noncharacterCharacterReference:jj(e)||e===H.CARRIAGE_RETURN?ce.controlCharacterReference:null}class Mee{constructor(t,n){this.options=t,this.handler=n,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=z.DATA,this.returnState=z.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new Eee(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new Tee(xee,(r,s)=>{this.preprocessor.pos=this.entityStartPos+s-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(ce.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(ce.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const s=Lee(r);s&&this._err(s,1)}}:void 0)}_err(t,n=0){var r,s;(s=(r=this.handler).onParseError)===null||s===void 0||s.call(r,this.preprocessor.getError(t,n))}getCurrentLocation(t){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-t,startOffset:this.preprocessor.offset-t,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const t=this._consume();this._ensureHibernation()||this._callState(t)}this.inLoop=!1}}pause(){this.paused=!0}resume(t){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||t==null||t())}write(t,n,r){this.active=!0,this.preprocessor.write(t,n),this._runParsingLoop(),this.paused||r==null||r()}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(t){this.consumedAfterSnapshot+=t;for(let n=0;n0&&this._err(ce.endTagWithAttributes),t.selfClosing&&this._err(ce.endTagWithTrailingSolidus),this.handler.onEndTag(t)),this.preprocessor.dropParsedChunk()}emitCurrentComment(t){this.prepareToken(t),this.handler.onComment(t),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(t){this.prepareToken(t),this.handler.onDoctype(t),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(t){if(this.currentCharacterToken){switch(t&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=t.startLine,this.currentCharacterToken.location.endCol=t.startCol,this.currentCharacterToken.location.endOffset=t.startOffset),this.currentCharacterToken.type){case mt.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case mt.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case mt.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){const t=this.getCurrentLocation(0);t&&(t.endLine=t.startLine,t.endCol=t.startCol,t.endOffset=t.startOffset),this._emitCurrentCharacterToken(t),this.handler.onEof({type:mt.EOF,location:t}),this.active=!1}_appendCharToCurrentCharacterToken(t,n){if(this.currentCharacterToken)if(this.currentCharacterToken.type===t){this.currentCharacterToken.chars+=n;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(t,n)}_emitCodePoint(t){const n=Bj(t)?mt.WHITESPACE_CHARACTER:t===H.NULL?mt.NULL_CHARACTER:mt.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(mt.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=z.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Ui.Attribute:Ui.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===z.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===z.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===z.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case z.DATA:{this._stateData(t);break}case z.RCDATA:{this._stateRcdata(t);break}case z.RAWTEXT:{this._stateRawtext(t);break}case z.SCRIPT_DATA:{this._stateScriptData(t);break}case z.PLAINTEXT:{this._statePlaintext(t);break}case z.TAG_OPEN:{this._stateTagOpen(t);break}case z.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case z.TAG_NAME:{this._stateTagName(t);break}case z.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case z.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case z.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case z.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case z.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case z.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case z.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case z.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case z.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case z.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case z.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case z.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case z.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case z.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case z.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case z.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case z.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case z.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case z.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case z.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case z.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case z.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case z.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case z.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case z.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case z.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case z.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case z.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case z.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case z.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case z.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case z.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case z.BOGUS_COMMENT:{this._stateBogusComment(t);break}case z.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case z.COMMENT_START:{this._stateCommentStart(t);break}case z.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case z.COMMENT:{this._stateComment(t);break}case z.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case z.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case z.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case z.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case z.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case z.COMMENT_END:{this._stateCommentEnd(t);break}case z.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case z.DOCTYPE:{this._stateDoctype(t);break}case z.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case z.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case z.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case z.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case z.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case z.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case z.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case z.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case z.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case z.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case z.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case z.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case z.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case z.CDATA_SECTION:{this._stateCdataSection(t);break}case z.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case z.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case z.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case z.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case H.LESS_THAN_SIGN:{this.state=z.TAG_OPEN;break}case H.AMPERSAND:{this._startCharacterReference();break}case H.NULL:{this._err(ce.unexpectedNullCharacter),this._emitCodePoint(t);break}case H.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case H.AMPERSAND:{this._startCharacterReference();break}case H.LESS_THAN_SIGN:{this.state=z.RCDATA_LESS_THAN_SIGN;break}case H.NULL:{this._err(ce.unexpectedNullCharacter),this._emitChars(Qt);break}case H.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case H.LESS_THAN_SIGN:{this.state=z.RAWTEXT_LESS_THAN_SIGN;break}case H.NULL:{this._err(ce.unexpectedNullCharacter),this._emitChars(Qt);break}case H.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case H.LESS_THAN_SIGN:{this.state=z.SCRIPT_DATA_LESS_THAN_SIGN;break}case H.NULL:{this._err(ce.unexpectedNullCharacter),this._emitChars(Qt);break}case H.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case H.NULL:{this._err(ce.unexpectedNullCharacter),this._emitChars(Qt);break}case H.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(pa(t))this._createStartTagToken(),this.state=z.TAG_NAME,this._stateTagName(t);else switch(t){case H.EXCLAMATION_MARK:{this.state=z.MARKUP_DECLARATION_OPEN;break}case H.SOLIDUS:{this.state=z.END_TAG_OPEN;break}case H.QUESTION_MARK:{this._err(ce.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=z.BOGUS_COMMENT,this._stateBogusComment(t);break}case H.EOF:{this._err(ce.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(ce.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=z.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(pa(t))this._createEndTagToken(),this.state=z.TAG_NAME,this._stateTagName(t);else switch(t){case H.GREATER_THAN_SIGN:{this._err(ce.missingEndTagName),this.state=z.DATA;break}case H.EOF:{this._err(ce.eofBeforeTagName),this._emitChars("");break}case H.NULL:{this._err(ce.unexpectedNullCharacter),this.state=z.SCRIPT_DATA_ESCAPED,this._emitChars(Qt);break}case H.EOF:{this._err(ce.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=z.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===H.SOLIDUS?this.state=z.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:pa(t)?(this._emitChars("<"),this.state=z.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=z.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){pa(t)?(this.state=z.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("");break}case H.NULL:{this._err(ce.unexpectedNullCharacter),this.state=z.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(Qt);break}case H.EOF:{this._err(ce.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=z.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===H.SOLIDUS?(this.state=z.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=z.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(Mr.SCRIPT,!1)&&XT(this.preprocessor.peek(Mr.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!0)}replace(t,n){const r=this._indexOf(t);this.items[r]=n,r===this.stackTop&&(this.current=n)}insertAfter(t,n,r){const s=this._indexOf(t)+1;this.items.splice(s,0,n),this.tagIDs.splice(s,0,r),this.stackTop++,s===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,s===this.stackTop)}popUntilTagNamePopped(t){let n=this.stackTop+1;do n=this.tagIDs.lastIndexOf(t,n-1);while(n>0&&this.treeAdapter.getNamespaceURI(this.items[n])!==xe.HTML);this.shortenToLength(Math.max(n,0))}shortenToLength(t){for(;this.stackTop>=t;){const n=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(n,this.stackTop=0;r--)if(t.has(this.tagIDs[r])&&this.treeAdapter.getNamespaceURI(this.items[r])===n)return r;return-1}clearBackTo(t,n){const r=this._indexOfTagNames(t,n);this.shortenToLength(r+1)}clearBackToTableContext(){this.clearBackTo(Fee,xe.HTML)}clearBackToTableBodyContext(){this.clearBackTo(Bee,xe.HTML)}clearBackToTableRowContext(){this.clearBackTo(Pee,xe.HTML)}remove(t){const n=this._indexOf(t);n>=0&&(n===this.stackTop?this.pop():(this.items.splice(n,1),this.tagIDs.splice(n,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===v.BODY?this.items[1]:null}contains(t){return this._indexOf(t)>-1}getCommonAncestor(t){const n=this._indexOf(t)-1;return n>=0?this.items[n]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===v.HTML}hasInDynamicScope(t,n){for(let r=this.stackTop;r>=0;r--){const s=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case xe.HTML:{if(s===t)return!0;if(n.has(s))return!1;break}case xe.SVG:{if(JT.has(s))return!1;break}case xe.MATHML:{if(ZT.has(s))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,Mm)}hasInListItemScope(t){return this.hasInDynamicScope(t,jee)}hasInButtonScope(t){return this.hasInDynamicScope(t,Dee)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const n=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case xe.HTML:{if(yE.has(n))return!0;if(Mm.has(n))return!1;break}case xe.SVG:{if(JT.has(n))return!1;break}case xe.MATHML:{if(ZT.has(n))return!1;break}}}return!0}hasInTableScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===xe.HTML)switch(this.tagIDs[n]){case t:return!0;case v.TABLE:case v.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===xe.HTML)switch(this.tagIDs[t]){case v.TBODY:case v.THEAD:case v.TFOOT:return!0;case v.TABLE:case v.HTML:return!1}return!0}hasInSelectScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===xe.HTML)switch(this.tagIDs[n]){case t:return!0;case v.OPTION:case v.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&Fj.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&QT.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&QT.has(this.currentTagId);)this.pop()}}const Uy=3;var di;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(di||(di={}));const e2={type:di.Marker};class Hee{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){const r=[],s=n.length,i=this.treeAdapter.getTagName(t),a=this.treeAdapter.getNamespaceURI(t);for(let o=0;o[a.name,a.value]));let i=0;for(let a=0;as.get(c.name)===c.value)&&(i+=1,i>=Uy&&this.entries.splice(o.idx,1))}}insertMarker(){this.entries.unshift(e2)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:di.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:di.Element,element:t,token:n})}removeEntry(t){const n=this.entries.indexOf(t);n!==-1&&this.entries.splice(n,1)}clearToLastMarker(){const t=this.entries.indexOf(e2);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(r=>r.type===di.Marker||this.treeAdapter.getTagName(r.element)===t);return n&&n.type===di.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===di.Element&&n.element===t)}}const ma={createDocument(){return{nodeName:"#document",mode:bs.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:"#comment",data:e,parentNode:null}},createTextNode(e){return{nodeName:"#text",value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){const r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,r){const s=e.childNodes.find(i=>i.nodeName==="#documentType");if(s)s.name=t,s.publicId=n,s.systemId=r;else{const i={nodeName:"#documentType",name:t,publicId:n,systemId:r,parentNode:null};ma.appendChild(e,i)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){const t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){const n=e.childNodes[e.childNodes.length-1];if(ma.isTextNode(n)){n.value+=t;return}}ma.appendChild(e,ma.createTextNode(t))},insertTextBefore(e,t,n){const r=e.childNodes[e.childNodes.indexOf(n)-1];r&&ma.isTextNode(r)?r.value+=t:ma.insertBefore(e,ma.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(r=>r.name));for(let r=0;re.startsWith(n))}function Gee(e){return e.name===Uj&&e.publicId===null&&(e.systemId===null||e.systemId===zee)}function qee(e){if(e.name!==Uj)return bs.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===Vee)return bs.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),Yee.has(n))return bs.QUIRKS;let r=t===null?Kee:$j;if(t2(n,r))return bs.QUIRKS;if(r=t===null?Hj:Wee,t2(n,r))return bs.LIMITED_QUIRKS}return bs.NO_QUIRKS}const n2={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},Xee="definitionurl",Qee="definitionURL",Zee=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(e=>[e.toLowerCase(),e])),Jee=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:xe.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:xe.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:xe.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:xe.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:xe.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:xe.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:xe.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:xe.XML}],["xml:space",{prefix:"xml",name:"space",namespace:xe.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:xe.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:xe.XMLNS}]]),ete=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(e=>[e.toLowerCase(),e])),tte=new Set([v.B,v.BIG,v.BLOCKQUOTE,v.BODY,v.BR,v.CENTER,v.CODE,v.DD,v.DIV,v.DL,v.DT,v.EM,v.EMBED,v.H1,v.H2,v.H3,v.H4,v.H5,v.H6,v.HEAD,v.HR,v.I,v.IMG,v.LI,v.LISTING,v.MENU,v.META,v.NOBR,v.OL,v.P,v.PRE,v.RUBY,v.S,v.SMALL,v.SPAN,v.STRONG,v.STRIKE,v.SUB,v.SUP,v.TABLE,v.TT,v.U,v.UL,v.VAR]);function nte(e){const t=e.tagID;return t===v.FONT&&e.attrs.some(({name:r})=>r===Co.COLOR||r===Co.SIZE||r===Co.FACE)||tte.has(t)}function zj(e){for(let t=0;t0&&this._setContextModes(t,n)}onItemPop(t,n){var r,s;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(s=(r=this.treeAdapter).onItemPop)===null||s===void 0||s.call(r,t,this.openElements.current),n){let i,a;this.openElements.stackTop===0&&this.fragmentContext?(i=this.fragmentContext,a=this.fragmentContextID):{current:i,currentTagId:a}=this.openElements,this._setContextModes(i,a)}}_setContextModes(t,n){const r=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===xe.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&t!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,t)}_switchToTextParsing(t,n){this._insertElement(t,xe.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=Y.TEXT}switchToPlaintextParsing(){this.insertionMode=Y.TEXT,this.originalInsertionMode=Y.IN_BODY,this.tokenizer.state=vn.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let t=this.fragmentContext;for(;t;){if(this.treeAdapter.getTagName(t)===se.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==xe.HTML))switch(this.fragmentContextID){case v.TITLE:case v.TEXTAREA:{this.tokenizer.state=vn.RCDATA;break}case v.STYLE:case v.XMP:case v.IFRAME:case v.NOEMBED:case v.NOFRAMES:case v.NOSCRIPT:{this.tokenizer.state=vn.RAWTEXT;break}case v.SCRIPT:{this.tokenizer.state=vn.SCRIPT_DATA;break}case v.PLAINTEXT:{this.tokenizer.state=vn.PLAINTEXT;break}}}_setDocumentType(t){const n=t.name||"",r=t.publicId||"",s=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,r,s),t.location){const a=this.treeAdapter.getChildNodes(this.document).find(o=>this.treeAdapter.isDocumentTypeNode(o));a&&this.treeAdapter.setNodeSourceCodeLocation(a,t.location)}}_attachElementToTree(t,n){if(this.options.sourceCodeLocationInfo){const r=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(t,r)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{const r=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(r??this.document,t)}}_appendElement(t,n){const r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location)}_insertElement(t,n){const r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location),this.openElements.push(r,t.tagID)}_insertFakeElement(t,n){const r=this.treeAdapter.createElement(t,xe.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,n)}_insertTemplate(t){const n=this.treeAdapter.createElement(t.tagName,xe.HTML,t.attrs),r=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,r),this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,null)}_insertFakeRootElement(){const t=this.treeAdapter.createElement(se.HTML,xe.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,v.HTML)}_appendCommentNode(t,n){const r=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(n,r),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,t.location)}_insertCharacters(t){let n,r;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:r}=this._findFosterParentingLocation(),r?this.treeAdapter.insertTextBefore(n,t.chars,r):this.treeAdapter.insertText(n,t.chars)):(n=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(n,t.chars)),!t.location)return;const s=this.treeAdapter.getChildNodes(n),i=r?s.lastIndexOf(r):s.length,a=s[i-1];if(this.treeAdapter.getNodeSourceCodeLocation(a)){const{endLine:c,endCol:u,endOffset:d}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(a,{endLine:c,endCol:u,endOffset:d})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(a,t.location)}_adoptNodes(t,n){for(let r=this.treeAdapter.getFirstChild(t);r;r=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(r),this.treeAdapter.appendChild(n,r)}_setEndLocation(t,n){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&n.location){const r=n.location,s=this.treeAdapter.getTagName(t),i=n.type===mt.END_TAG&&s===n.tagName?{endTag:{...r},endLine:r.endLine,endCol:r.endCol,endOffset:r.endOffset}:{endLine:r.startLine,endCol:r.startCol,endOffset:r.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,i)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let n,r;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,r=this.fragmentContextID):{current:n,currentTagId:r}=this.openElements,t.tagID===v.SVG&&this.treeAdapter.getTagName(n)===se.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===xe.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===v.MGLYPH||t.tagID===v.MALIGNMARK)&&r!==void 0&&!this._isIntegrationPoint(r,n,xe.HTML)}_processToken(t){switch(t.type){case mt.CHARACTER:{this.onCharacter(t);break}case mt.NULL_CHARACTER:{this.onNullCharacter(t);break}case mt.COMMENT:{this.onComment(t);break}case mt.DOCTYPE:{this.onDoctype(t);break}case mt.START_TAG:{this._processStartTag(t);break}case mt.END_TAG:{this.onEndTag(t);break}case mt.EOF:{this.onEof(t);break}case mt.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,r){const s=this.treeAdapter.getNamespaceURI(n),i=this.treeAdapter.getAttrList(n);return ate(t,s,i,r)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(s=>s.type===di.Marker||this.openElements.contains(s.element)),r=n===-1?t-1:n-1;for(let s=r;s>=0;s--){const i=this.activeFormattingElements.entries[s];this._insertElement(i.token,this.treeAdapter.getNamespaceURI(i.element)),i.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=Y.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(v.P),this.openElements.popUntilTagNamePopped(v.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case v.TR:{this.insertionMode=Y.IN_ROW;return}case v.TBODY:case v.THEAD:case v.TFOOT:{this.insertionMode=Y.IN_TABLE_BODY;return}case v.CAPTION:{this.insertionMode=Y.IN_CAPTION;return}case v.COLGROUP:{this.insertionMode=Y.IN_COLUMN_GROUP;return}case v.TABLE:{this.insertionMode=Y.IN_TABLE;return}case v.BODY:{this.insertionMode=Y.IN_BODY;return}case v.FRAMESET:{this.insertionMode=Y.IN_FRAMESET;return}case v.SELECT:{this._resetInsertionModeForSelect(t);return}case v.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case v.HTML:{this.insertionMode=this.headElement?Y.AFTER_HEAD:Y.BEFORE_HEAD;return}case v.TD:case v.TH:{if(t>0){this.insertionMode=Y.IN_CELL;return}break}case v.HEAD:{if(t>0){this.insertionMode=Y.IN_HEAD;return}break}}this.insertionMode=Y.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let n=t-1;n>0;n--){const r=this.openElements.tagIDs[n];if(r===v.TEMPLATE)break;if(r===v.TABLE){this.insertionMode=Y.IN_SELECT_IN_TABLE;return}}this.insertionMode=Y.IN_SELECT}_isElementCausesFosterParenting(t){return Kj.has(t)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let t=this.openElements.stackTop;t>=0;t--){const n=this.openElements.items[t];switch(this.openElements.tagIDs[t]){case v.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===xe.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case v.TABLE:{const r=this.treeAdapter.getParentNode(n);return r?{parent:r,beforeElement:n}:{parent:this.openElements.items[t-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(t){const n=this._findFosterParentingLocation();n.beforeElement?this.treeAdapter.insertBefore(n.parent,t,n.beforeElement):this.treeAdapter.appendChild(n.parent,t)}_isSpecialElement(t,n){const r=this.treeAdapter.getNamespaceURI(t);return Iee[r].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Une(this,t);return}switch(this.insertionMode){case Y.INITIAL:{_u(this,t);break}case Y.BEFORE_HTML:{hd(this,t);break}case Y.BEFORE_HEAD:{pd(this,t);break}case Y.IN_HEAD:{md(this,t);break}case Y.IN_HEAD_NO_SCRIPT:{gd(this,t);break}case Y.AFTER_HEAD:{yd(this,t);break}case Y.IN_BODY:case Y.IN_CAPTION:case Y.IN_CELL:case Y.IN_TEMPLATE:{Wj(this,t);break}case Y.TEXT:case Y.IN_SELECT:case Y.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case Y.IN_TABLE:case Y.IN_TABLE_BODY:case Y.IN_ROW:{$y(this,t);break}case Y.IN_TABLE_TEXT:{Jj(this,t);break}case Y.IN_COLUMN_GROUP:{jm(this,t);break}case Y.AFTER_BODY:{Dm(this,t);break}case Y.AFTER_AFTER_BODY:{Op(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Fne(this,t);return}switch(this.insertionMode){case Y.INITIAL:{_u(this,t);break}case Y.BEFORE_HTML:{hd(this,t);break}case Y.BEFORE_HEAD:{pd(this,t);break}case Y.IN_HEAD:{md(this,t);break}case Y.IN_HEAD_NO_SCRIPT:{gd(this,t);break}case Y.AFTER_HEAD:{yd(this,t);break}case Y.TEXT:{this._insertCharacters(t);break}case Y.IN_TABLE:case Y.IN_TABLE_BODY:case Y.IN_ROW:{$y(this,t);break}case Y.IN_COLUMN_GROUP:{jm(this,t);break}case Y.AFTER_BODY:{Dm(this,t);break}case Y.AFTER_AFTER_BODY:{Op(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){bE(this,t);return}switch(this.insertionMode){case Y.INITIAL:case Y.BEFORE_HTML:case Y.BEFORE_HEAD:case Y.IN_HEAD:case Y.IN_HEAD_NO_SCRIPT:case Y.AFTER_HEAD:case Y.IN_BODY:case Y.IN_TABLE:case Y.IN_CAPTION:case Y.IN_COLUMN_GROUP:case Y.IN_TABLE_BODY:case Y.IN_ROW:case Y.IN_CELL:case Y.IN_SELECT:case Y.IN_SELECT_IN_TABLE:case Y.IN_TEMPLATE:case Y.IN_FRAMESET:case Y.AFTER_FRAMESET:{bE(this,t);break}case Y.IN_TABLE_TEXT:{ku(this,t);break}case Y.AFTER_BODY:{yte(this,t);break}case Y.AFTER_AFTER_BODY:case Y.AFTER_AFTER_FRAMESET:{bte(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case Y.INITIAL:{Ete(this,t);break}case Y.BEFORE_HEAD:case Y.IN_HEAD:case Y.IN_HEAD_NO_SCRIPT:case Y.AFTER_HEAD:{this._err(t,ce.misplacedDoctype);break}case Y.IN_TABLE_TEXT:{ku(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,ce.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?$ne(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case Y.INITIAL:{_u(this,t);break}case Y.BEFORE_HTML:{xte(this,t);break}case Y.BEFORE_HEAD:{vte(this,t);break}case Y.IN_HEAD:{ei(this,t);break}case Y.IN_HEAD_NO_SCRIPT:{Nte(this,t);break}case Y.AFTER_HEAD:{Tte(this,t);break}case Y.IN_BODY:{br(this,t);break}case Y.IN_TABLE:{Ac(this,t);break}case Y.IN_TABLE_TEXT:{ku(this,t);break}case Y.IN_CAPTION:{_ne(this,t);break}case Y.IN_COLUMN_GROUP:{yv(this,t);break}case Y.IN_TABLE_BODY:{Kg(this,t);break}case Y.IN_ROW:{Yg(this,t);break}case Y.IN_CELL:{Sne(this,t);break}case Y.IN_SELECT:{nD(this,t);break}case Y.IN_SELECT_IN_TABLE:{Ane(this,t);break}case Y.IN_TEMPLATE:{Ine(this,t);break}case Y.AFTER_BODY:{Rne(this,t);break}case Y.IN_FRAMESET:{Lne(this,t);break}case Y.AFTER_FRAMESET:{jne(this,t);break}case Y.AFTER_AFTER_BODY:{Pne(this,t);break}case Y.AFTER_AFTER_FRAMESET:{Bne(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?Hne(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case Y.INITIAL:{_u(this,t);break}case Y.BEFORE_HTML:{wte(this,t);break}case Y.BEFORE_HEAD:{_te(this,t);break}case Y.IN_HEAD:{kte(this,t);break}case Y.IN_HEAD_NO_SCRIPT:{Ste(this,t);break}case Y.AFTER_HEAD:{Ate(this,t);break}case Y.IN_BODY:{Vg(this,t);break}case Y.TEXT:{hne(this,t);break}case Y.IN_TABLE:{tf(this,t);break}case Y.IN_TABLE_TEXT:{ku(this,t);break}case Y.IN_CAPTION:{kne(this,t);break}case Y.IN_COLUMN_GROUP:{Nne(this,t);break}case Y.IN_TABLE_BODY:{EE(this,t);break}case Y.IN_ROW:{tD(this,t);break}case Y.IN_CELL:{Tne(this,t);break}case Y.IN_SELECT:{rD(this,t);break}case Y.IN_SELECT_IN_TABLE:{Cne(this,t);break}case Y.IN_TEMPLATE:{One(this,t);break}case Y.AFTER_BODY:{iD(this,t);break}case Y.IN_FRAMESET:{Mne(this,t);break}case Y.AFTER_FRAMESET:{Dne(this,t);break}case Y.AFTER_AFTER_BODY:{Op(this,t);break}}}onEof(t){switch(this.insertionMode){case Y.INITIAL:{_u(this,t);break}case Y.BEFORE_HTML:{hd(this,t);break}case Y.BEFORE_HEAD:{pd(this,t);break}case Y.IN_HEAD:{md(this,t);break}case Y.IN_HEAD_NO_SCRIPT:{gd(this,t);break}case Y.AFTER_HEAD:{yd(this,t);break}case Y.IN_BODY:case Y.IN_TABLE:case Y.IN_CAPTION:case Y.IN_COLUMN_GROUP:case Y.IN_TABLE_BODY:case Y.IN_ROW:case Y.IN_CELL:case Y.IN_SELECT:case Y.IN_SELECT_IN_TABLE:{Qj(this,t);break}case Y.TEXT:{pne(this,t);break}case Y.IN_TABLE_TEXT:{ku(this,t);break}case Y.IN_TEMPLATE:{sD(this,t);break}case Y.AFTER_BODY:case Y.IN_FRAMESET:case Y.AFTER_FRAMESET:case Y.AFTER_AFTER_BODY:case Y.AFTER_AFTER_FRAMESET:{gv(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===H.LINE_FEED)){if(t.chars.length===1)return;t.chars=t.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(t);return}switch(this.insertionMode){case Y.IN_HEAD:case Y.IN_HEAD_NO_SCRIPT:case Y.AFTER_HEAD:case Y.TEXT:case Y.IN_COLUMN_GROUP:case Y.IN_SELECT:case Y.IN_SELECT_IN_TABLE:case Y.IN_FRAMESET:case Y.AFTER_FRAMESET:{this._insertCharacters(t);break}case Y.IN_BODY:case Y.IN_CAPTION:case Y.IN_CELL:case Y.IN_TEMPLATE:case Y.AFTER_BODY:case Y.AFTER_AFTER_BODY:case Y.AFTER_AFTER_FRAMESET:{Yj(this,t);break}case Y.IN_TABLE:case Y.IN_TABLE_BODY:case Y.IN_ROW:{$y(this,t);break}case Y.IN_TABLE_TEXT:{Zj(this,t);break}}}};function dte(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):Xj(e,t),n}function fte(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){const s=e.openElements.items[r];if(s===t.element)break;e._isSpecialElement(s,e.openElements.tagIDs[r])&&(n=s)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function hte(e,t,n){let r=t,s=e.openElements.getCommonAncestor(t);for(let i=0,a=s;a!==n;i++,a=s){s=e.openElements.getCommonAncestor(a);const o=e.activeFormattingElements.getElementEntry(a),c=o&&i>=cte;!o||c?(c&&e.activeFormattingElements.removeEntry(o),e.openElements.remove(a)):(a=pte(e,o),r===t&&(e.activeFormattingElements.bookmark=o),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(a,r),r=a)}return r}function pte(e,t){const n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function mte(e,t,n){const r=e.treeAdapter.getTagName(t),s=Qc(r);if(e._isElementCausesFosterParenting(s))e._fosterParentElement(n);else{const i=e.treeAdapter.getNamespaceURI(t);s===v.TEMPLATE&&i===xe.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function gte(e,t,n){const r=e.treeAdapter.getNamespaceURI(n.element),{token:s}=n,i=e.treeAdapter.createElement(s.tagName,r,s.attrs);e._adoptNodes(t,i),e.treeAdapter.appendChild(t,i),e.activeFormattingElements.insertElementAfterBookmark(i,s),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,i,s.tagID)}function mv(e,t){for(let n=0;n=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){const r=e.openElements.items[0],s=e.treeAdapter.getNodeSourceCodeLocation(r);if(s&&!s.endTag&&(e._setEndLocation(r,t),e.openElements.stackTop>=1)){const i=e.openElements.items[1],a=e.treeAdapter.getNodeSourceCodeLocation(i);a&&!a.endTag&&e._setEndLocation(i,t)}}}}function Ete(e,t){e._setDocumentType(t);const n=t.forceQuirks?bs.QUIRKS:qee(t);Gee(t)||e._err(t,ce.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=Y.BEFORE_HTML}function _u(e,t){e._err(t,ce.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,bs.QUIRKS),e.insertionMode=Y.BEFORE_HTML,e._processToken(t)}function xte(e,t){t.tagID===v.HTML?(e._insertElement(t,xe.HTML),e.insertionMode=Y.BEFORE_HEAD):hd(e,t)}function wte(e,t){const n=t.tagID;(n===v.HTML||n===v.HEAD||n===v.BODY||n===v.BR)&&hd(e,t)}function hd(e,t){e._insertFakeRootElement(),e.insertionMode=Y.BEFORE_HEAD,e._processToken(t)}function vte(e,t){switch(t.tagID){case v.HTML:{br(e,t);break}case v.HEAD:{e._insertElement(t,xe.HTML),e.headElement=e.openElements.current,e.insertionMode=Y.IN_HEAD;break}default:pd(e,t)}}function _te(e,t){const n=t.tagID;n===v.HEAD||n===v.BODY||n===v.HTML||n===v.BR?pd(e,t):e._err(t,ce.endTagWithoutMatchingOpenElement)}function pd(e,t){e._insertFakeElement(se.HEAD,v.HEAD),e.headElement=e.openElements.current,e.insertionMode=Y.IN_HEAD,e._processToken(t)}function ei(e,t){switch(t.tagID){case v.HTML:{br(e,t);break}case v.BASE:case v.BASEFONT:case v.BGSOUND:case v.LINK:case v.META:{e._appendElement(t,xe.HTML),t.ackSelfClosing=!0;break}case v.TITLE:{e._switchToTextParsing(t,vn.RCDATA);break}case v.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,vn.RAWTEXT):(e._insertElement(t,xe.HTML),e.insertionMode=Y.IN_HEAD_NO_SCRIPT);break}case v.NOFRAMES:case v.STYLE:{e._switchToTextParsing(t,vn.RAWTEXT);break}case v.SCRIPT:{e._switchToTextParsing(t,vn.SCRIPT_DATA);break}case v.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=Y.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(Y.IN_TEMPLATE);break}case v.HEAD:{e._err(t,ce.misplacedStartTagForHeadElement);break}default:md(e,t)}}function kte(e,t){switch(t.tagID){case v.HEAD:{e.openElements.pop(),e.insertionMode=Y.AFTER_HEAD;break}case v.BODY:case v.BR:case v.HTML:{md(e,t);break}case v.TEMPLATE:{Jo(e,t);break}default:e._err(t,ce.endTagWithoutMatchingOpenElement)}}function Jo(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==v.TEMPLATE&&e._err(t,ce.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(v.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,ce.endTagWithoutMatchingOpenElement)}function md(e,t){e.openElements.pop(),e.insertionMode=Y.AFTER_HEAD,e._processToken(t)}function Nte(e,t){switch(t.tagID){case v.HTML:{br(e,t);break}case v.BASEFONT:case v.BGSOUND:case v.HEAD:case v.LINK:case v.META:case v.NOFRAMES:case v.STYLE:{ei(e,t);break}case v.NOSCRIPT:{e._err(t,ce.nestedNoscriptInHead);break}default:gd(e,t)}}function Ste(e,t){switch(t.tagID){case v.NOSCRIPT:{e.openElements.pop(),e.insertionMode=Y.IN_HEAD;break}case v.BR:{gd(e,t);break}default:e._err(t,ce.endTagWithoutMatchingOpenElement)}}function gd(e,t){const n=t.type===mt.EOF?ce.openElementsLeftAfterEof:ce.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=Y.IN_HEAD,e._processToken(t)}function Tte(e,t){switch(t.tagID){case v.HTML:{br(e,t);break}case v.BODY:{e._insertElement(t,xe.HTML),e.framesetOk=!1,e.insertionMode=Y.IN_BODY;break}case v.FRAMESET:{e._insertElement(t,xe.HTML),e.insertionMode=Y.IN_FRAMESET;break}case v.BASE:case v.BASEFONT:case v.BGSOUND:case v.LINK:case v.META:case v.NOFRAMES:case v.SCRIPT:case v.STYLE:case v.TEMPLATE:case v.TITLE:{e._err(t,ce.abandonedHeadElementChild),e.openElements.push(e.headElement,v.HEAD),ei(e,t),e.openElements.remove(e.headElement);break}case v.HEAD:{e._err(t,ce.misplacedStartTagForHeadElement);break}default:yd(e,t)}}function Ate(e,t){switch(t.tagID){case v.BODY:case v.HTML:case v.BR:{yd(e,t);break}case v.TEMPLATE:{Jo(e,t);break}default:e._err(t,ce.endTagWithoutMatchingOpenElement)}}function yd(e,t){e._insertFakeElement(se.BODY,v.BODY),e.insertionMode=Y.IN_BODY,zg(e,t)}function zg(e,t){switch(t.type){case mt.CHARACTER:{Wj(e,t);break}case mt.WHITESPACE_CHARACTER:{Yj(e,t);break}case mt.COMMENT:{bE(e,t);break}case mt.START_TAG:{br(e,t);break}case mt.END_TAG:{Vg(e,t);break}case mt.EOF:{Qj(e,t);break}}}function Yj(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function Wj(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function Cte(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function Ite(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function Ote(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,xe.HTML),e.insertionMode=Y.IN_FRAMESET)}function Rte(e,t){e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._insertElement(t,xe.HTML)}function Lte(e,t){e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&yE.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,xe.HTML)}function Mte(e,t){e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._insertElement(t,xe.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function jte(e,t){const n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._insertElement(t,xe.HTML),n||(e.formElement=e.openElements.current))}function Dte(e,t){e.framesetOk=!1;const n=t.tagID;for(let r=e.openElements.stackTop;r>=0;r--){const s=e.openElements.tagIDs[r];if(n===v.LI&&s===v.LI||(n===v.DD||n===v.DT)&&(s===v.DD||s===v.DT)){e.openElements.generateImpliedEndTagsWithExclusion(s),e.openElements.popUntilTagNamePopped(s);break}if(s!==v.ADDRESS&&s!==v.DIV&&s!==v.P&&e._isSpecialElement(e.openElements.items[r],s))break}e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._insertElement(t,xe.HTML)}function Pte(e,t){e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._insertElement(t,xe.HTML),e.tokenizer.state=vn.PLAINTEXT}function Bte(e,t){e.openElements.hasInScope(v.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(v.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,xe.HTML),e.framesetOk=!1}function Fte(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(se.A);n&&(mv(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,xe.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function Ute(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,xe.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function $te(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(v.NOBR)&&(mv(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,xe.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function Hte(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,xe.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function zte(e,t){e.treeAdapter.getDocumentMode(e.document)!==bs.QUIRKS&&e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._insertElement(t,xe.HTML),e.framesetOk=!1,e.insertionMode=Y.IN_TABLE}function Gj(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,xe.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function qj(e){const t=Pj(e,Co.TYPE);return t!=null&&t.toLowerCase()===ote}function Vte(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,xe.HTML),qj(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function Kte(e,t){e._appendElement(t,xe.HTML),t.ackSelfClosing=!0}function Yte(e,t){e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._appendElement(t,xe.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function Wte(e,t){t.tagName=se.IMG,t.tagID=v.IMG,Gj(e,t)}function Gte(e,t){e._insertElement(t,xe.HTML),e.skipNextNewLine=!0,e.tokenizer.state=vn.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=Y.TEXT}function qte(e,t){e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,vn.RAWTEXT)}function Xte(e,t){e.framesetOk=!1,e._switchToTextParsing(t,vn.RAWTEXT)}function i2(e,t){e._switchToTextParsing(t,vn.RAWTEXT)}function Qte(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,xe.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===Y.IN_TABLE||e.insertionMode===Y.IN_CAPTION||e.insertionMode===Y.IN_TABLE_BODY||e.insertionMode===Y.IN_ROW||e.insertionMode===Y.IN_CELL?Y.IN_SELECT_IN_TABLE:Y.IN_SELECT}function Zte(e,t){e.openElements.currentTagId===v.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,xe.HTML)}function Jte(e,t){e.openElements.hasInScope(v.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,xe.HTML)}function ene(e,t){e.openElements.hasInScope(v.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(v.RTC),e._insertElement(t,xe.HTML)}function tne(e,t){e._reconstructActiveFormattingElements(),zj(t),pv(t),t.selfClosing?e._appendElement(t,xe.MATHML):e._insertElement(t,xe.MATHML),t.ackSelfClosing=!0}function nne(e,t){e._reconstructActiveFormattingElements(),Vj(t),pv(t),t.selfClosing?e._appendElement(t,xe.SVG):e._insertElement(t,xe.SVG),t.ackSelfClosing=!0}function a2(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,xe.HTML)}function br(e,t){switch(t.tagID){case v.I:case v.S:case v.B:case v.U:case v.EM:case v.TT:case v.BIG:case v.CODE:case v.FONT:case v.SMALL:case v.STRIKE:case v.STRONG:{Ute(e,t);break}case v.A:{Fte(e,t);break}case v.H1:case v.H2:case v.H3:case v.H4:case v.H5:case v.H6:{Lte(e,t);break}case v.P:case v.DL:case v.OL:case v.UL:case v.DIV:case v.DIR:case v.NAV:case v.MAIN:case v.MENU:case v.ASIDE:case v.CENTER:case v.FIGURE:case v.FOOTER:case v.HEADER:case v.HGROUP:case v.DIALOG:case v.DETAILS:case v.ADDRESS:case v.ARTICLE:case v.SEARCH:case v.SECTION:case v.SUMMARY:case v.FIELDSET:case v.BLOCKQUOTE:case v.FIGCAPTION:{Rte(e,t);break}case v.LI:case v.DD:case v.DT:{Dte(e,t);break}case v.BR:case v.IMG:case v.WBR:case v.AREA:case v.EMBED:case v.KEYGEN:{Gj(e,t);break}case v.HR:{Yte(e,t);break}case v.RB:case v.RTC:{Jte(e,t);break}case v.RT:case v.RP:{ene(e,t);break}case v.PRE:case v.LISTING:{Mte(e,t);break}case v.XMP:{qte(e,t);break}case v.SVG:{nne(e,t);break}case v.HTML:{Cte(e,t);break}case v.BASE:case v.LINK:case v.META:case v.STYLE:case v.TITLE:case v.SCRIPT:case v.BGSOUND:case v.BASEFONT:case v.TEMPLATE:{ei(e,t);break}case v.BODY:{Ite(e,t);break}case v.FORM:{jte(e,t);break}case v.NOBR:{$te(e,t);break}case v.MATH:{tne(e,t);break}case v.TABLE:{zte(e,t);break}case v.INPUT:{Vte(e,t);break}case v.PARAM:case v.TRACK:case v.SOURCE:{Kte(e,t);break}case v.IMAGE:{Wte(e,t);break}case v.BUTTON:{Bte(e,t);break}case v.APPLET:case v.OBJECT:case v.MARQUEE:{Hte(e,t);break}case v.IFRAME:{Xte(e,t);break}case v.SELECT:{Qte(e,t);break}case v.OPTION:case v.OPTGROUP:{Zte(e,t);break}case v.NOEMBED:case v.NOFRAMES:{i2(e,t);break}case v.FRAMESET:{Ote(e,t);break}case v.TEXTAREA:{Gte(e,t);break}case v.NOSCRIPT:{e.options.scriptingEnabled?i2(e,t):a2(e,t);break}case v.PLAINTEXT:{Pte(e,t);break}case v.COL:case v.TH:case v.TD:case v.TR:case v.HEAD:case v.FRAME:case v.TBODY:case v.TFOOT:case v.THEAD:case v.CAPTION:case v.COLGROUP:break;default:a2(e,t)}}function rne(e,t){if(e.openElements.hasInScope(v.BODY)&&(e.insertionMode=Y.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function sne(e,t){e.openElements.hasInScope(v.BODY)&&(e.insertionMode=Y.AFTER_BODY,iD(e,t))}function ine(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function ane(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(v.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(v.FORM):n&&e.openElements.remove(n))}function one(e){e.openElements.hasInButtonScope(v.P)||e._insertFakeElement(se.P,v.P),e._closePElement()}function lne(e){e.openElements.hasInListItemScope(v.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(v.LI),e.openElements.popUntilTagNamePopped(v.LI))}function cne(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function une(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function dne(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function fne(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(se.BR,v.BR),e.openElements.pop(),e.framesetOk=!1}function Xj(e,t){const n=t.tagName,r=t.tagID;for(let s=e.openElements.stackTop;s>0;s--){const i=e.openElements.items[s],a=e.openElements.tagIDs[s];if(r===a&&(r!==v.UNKNOWN||e.treeAdapter.getTagName(i)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=s&&e.openElements.shortenToLength(s);break}if(e._isSpecialElement(i,a))break}}function Vg(e,t){switch(t.tagID){case v.A:case v.B:case v.I:case v.S:case v.U:case v.EM:case v.TT:case v.BIG:case v.CODE:case v.FONT:case v.NOBR:case v.SMALL:case v.STRIKE:case v.STRONG:{mv(e,t);break}case v.P:{one(e);break}case v.DL:case v.UL:case v.OL:case v.DIR:case v.DIV:case v.NAV:case v.PRE:case v.MAIN:case v.MENU:case v.ASIDE:case v.BUTTON:case v.CENTER:case v.FIGURE:case v.FOOTER:case v.HEADER:case v.HGROUP:case v.DIALOG:case v.ADDRESS:case v.ARTICLE:case v.DETAILS:case v.SEARCH:case v.SECTION:case v.SUMMARY:case v.LISTING:case v.FIELDSET:case v.BLOCKQUOTE:case v.FIGCAPTION:{ine(e,t);break}case v.LI:{lne(e);break}case v.DD:case v.DT:{cne(e,t);break}case v.H1:case v.H2:case v.H3:case v.H4:case v.H5:case v.H6:{une(e);break}case v.BR:{fne(e);break}case v.BODY:{rne(e,t);break}case v.HTML:{sne(e,t);break}case v.FORM:{ane(e);break}case v.APPLET:case v.OBJECT:case v.MARQUEE:{dne(e,t);break}case v.TEMPLATE:{Jo(e,t);break}default:Xj(e,t)}}function Qj(e,t){e.tmplInsertionModeStack.length>0?sD(e,t):gv(e,t)}function hne(e,t){var n;t.tagID===v.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function pne(e,t){e._err(t,ce.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function $y(e,t){if(e.openElements.currentTagId!==void 0&&Kj.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=Y.IN_TABLE_TEXT,t.type){case mt.CHARACTER:{Jj(e,t);break}case mt.WHITESPACE_CHARACTER:{Zj(e,t);break}}else Lf(e,t)}function mne(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,xe.HTML),e.insertionMode=Y.IN_CAPTION}function gne(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,xe.HTML),e.insertionMode=Y.IN_COLUMN_GROUP}function yne(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(se.COLGROUP,v.COLGROUP),e.insertionMode=Y.IN_COLUMN_GROUP,yv(e,t)}function bne(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,xe.HTML),e.insertionMode=Y.IN_TABLE_BODY}function Ene(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(se.TBODY,v.TBODY),e.insertionMode=Y.IN_TABLE_BODY,Kg(e,t)}function xne(e,t){e.openElements.hasInTableScope(v.TABLE)&&(e.openElements.popUntilTagNamePopped(v.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function wne(e,t){qj(t)?e._appendElement(t,xe.HTML):Lf(e,t),t.ackSelfClosing=!0}function vne(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,xe.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function Ac(e,t){switch(t.tagID){case v.TD:case v.TH:case v.TR:{Ene(e,t);break}case v.STYLE:case v.SCRIPT:case v.TEMPLATE:{ei(e,t);break}case v.COL:{yne(e,t);break}case v.FORM:{vne(e,t);break}case v.TABLE:{xne(e,t);break}case v.TBODY:case v.TFOOT:case v.THEAD:{bne(e,t);break}case v.INPUT:{wne(e,t);break}case v.CAPTION:{mne(e,t);break}case v.COLGROUP:{gne(e,t);break}default:Lf(e,t)}}function tf(e,t){switch(t.tagID){case v.TABLE:{e.openElements.hasInTableScope(v.TABLE)&&(e.openElements.popUntilTagNamePopped(v.TABLE),e._resetInsertionMode());break}case v.TEMPLATE:{Jo(e,t);break}case v.BODY:case v.CAPTION:case v.COL:case v.COLGROUP:case v.HTML:case v.TBODY:case v.TD:case v.TFOOT:case v.TH:case v.THEAD:case v.TR:break;default:Lf(e,t)}}function Lf(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,zg(e,t),e.fosterParentingEnabled=n}function Zj(e,t){e.pendingCharacterTokens.push(t)}function Jj(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function ku(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n0&&e.openElements.currentTagId===v.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===v.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===v.OPTGROUP&&e.openElements.pop();break}case v.OPTION:{e.openElements.currentTagId===v.OPTION&&e.openElements.pop();break}case v.SELECT:{e.openElements.hasInSelectScope(v.SELECT)&&(e.openElements.popUntilTagNamePopped(v.SELECT),e._resetInsertionMode());break}case v.TEMPLATE:{Jo(e,t);break}}}function Ane(e,t){const n=t.tagID;n===v.CAPTION||n===v.TABLE||n===v.TBODY||n===v.TFOOT||n===v.THEAD||n===v.TR||n===v.TD||n===v.TH?(e.openElements.popUntilTagNamePopped(v.SELECT),e._resetInsertionMode(),e._processStartTag(t)):nD(e,t)}function Cne(e,t){const n=t.tagID;n===v.CAPTION||n===v.TABLE||n===v.TBODY||n===v.TFOOT||n===v.THEAD||n===v.TR||n===v.TD||n===v.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(v.SELECT),e._resetInsertionMode(),e.onEndTag(t)):rD(e,t)}function Ine(e,t){switch(t.tagID){case v.BASE:case v.BASEFONT:case v.BGSOUND:case v.LINK:case v.META:case v.NOFRAMES:case v.SCRIPT:case v.STYLE:case v.TEMPLATE:case v.TITLE:{ei(e,t);break}case v.CAPTION:case v.COLGROUP:case v.TBODY:case v.TFOOT:case v.THEAD:{e.tmplInsertionModeStack[0]=Y.IN_TABLE,e.insertionMode=Y.IN_TABLE,Ac(e,t);break}case v.COL:{e.tmplInsertionModeStack[0]=Y.IN_COLUMN_GROUP,e.insertionMode=Y.IN_COLUMN_GROUP,yv(e,t);break}case v.TR:{e.tmplInsertionModeStack[0]=Y.IN_TABLE_BODY,e.insertionMode=Y.IN_TABLE_BODY,Kg(e,t);break}case v.TD:case v.TH:{e.tmplInsertionModeStack[0]=Y.IN_ROW,e.insertionMode=Y.IN_ROW,Yg(e,t);break}default:e.tmplInsertionModeStack[0]=Y.IN_BODY,e.insertionMode=Y.IN_BODY,br(e,t)}}function One(e,t){t.tagID===v.TEMPLATE&&Jo(e,t)}function sD(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(v.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):gv(e,t)}function Rne(e,t){t.tagID===v.HTML?br(e,t):Dm(e,t)}function iD(e,t){var n;if(t.tagID===v.HTML){if(e.fragmentContext||(e.insertionMode=Y.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===v.HTML){e._setEndLocation(e.openElements.items[0],t);const r=e.openElements.items[1];r&&!(!((n=e.treeAdapter.getNodeSourceCodeLocation(r))===null||n===void 0)&&n.endTag)&&e._setEndLocation(r,t)}}else Dm(e,t)}function Dm(e,t){e.insertionMode=Y.IN_BODY,zg(e,t)}function Lne(e,t){switch(t.tagID){case v.HTML:{br(e,t);break}case v.FRAMESET:{e._insertElement(t,xe.HTML);break}case v.FRAME:{e._appendElement(t,xe.HTML),t.ackSelfClosing=!0;break}case v.NOFRAMES:{ei(e,t);break}}}function Mne(e,t){t.tagID===v.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==v.FRAMESET&&(e.insertionMode=Y.AFTER_FRAMESET))}function jne(e,t){switch(t.tagID){case v.HTML:{br(e,t);break}case v.NOFRAMES:{ei(e,t);break}}}function Dne(e,t){t.tagID===v.HTML&&(e.insertionMode=Y.AFTER_AFTER_FRAMESET)}function Pne(e,t){t.tagID===v.HTML?br(e,t):Op(e,t)}function Op(e,t){e.insertionMode=Y.IN_BODY,zg(e,t)}function Bne(e,t){switch(t.tagID){case v.HTML:{br(e,t);break}case v.NOFRAMES:{ei(e,t);break}}}function Fne(e,t){t.chars=Qt,e._insertCharacters(t)}function Une(e,t){e._insertCharacters(t),e.framesetOk=!1}function aD(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==xe.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function $ne(e,t){if(nte(t))aD(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===xe.MATHML?zj(t):r===xe.SVG&&(rte(t),Vj(t)),pv(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function Hne(e,t){if(t.tagID===v.P||t.tagID===v.BR){aD(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){const r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===xe.HTML){e._endTagOutsideForeignContent(t);break}const s=e.treeAdapter.getTagName(r);if(s.toLowerCase()===t.tagName){t.tagName=s,e.openElements.shortenToLength(n);break}}}se.AREA,se.BASE,se.BASEFONT,se.BGSOUND,se.BR,se.COL,se.EMBED,se.FRAME,se.HR,se.IMG,se.INPUT,se.KEYGEN,se.LINK,se.META,se.PARAM,se.SOURCE,se.TRACK,se.WBR;const zne=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,Vne=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),o2={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function oD(e,t){const n=ere(e),r=v3("type",{handlers:{root:Kne,element:Yne,text:Wne,comment:cD,doctype:Gne,raw:Xne},unknown:Qne}),s={parser:n?new s2(o2):s2.getFragmentParser(void 0,o2),handle(o){r(o,s)},stitches:!1,options:t||{}};r(e,s),Zc(s,_i());const i=n?s.parser.document:s.parser.getFragment(),a=tee(i,{file:s.options.file});return s.stitches&&Of(a,"comment",function(o,c,u){const d=o;if(d.value.stitch&&u&&c!==void 0){const f=u.children;return f[c]=d.value.stitch,c}}),a.type==="root"&&a.children.length===1&&a.children[0].type===e.type?a.children[0]:a}function lD(e,t){let n=-1;if(e)for(;++n4&&(t.parser.tokenizer.state=0);const n={type:mt.CHARACTER,chars:e.value,location:Mf(e)};Zc(t,_i(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function Gne(e,t){const n={type:mt.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:Mf(e)};Zc(t,_i(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function qne(e,t){t.stitches=!0;const n=tre(e);if("children"in e&&"children"in n){const r=oD({type:"root",children:e.children},t.options);n.children=r.children}cD({type:"comment",value:{stitch:n}},t)}function cD(e,t){const n=e.value,r={type:mt.COMMENT,data:n,location:Mf(e)};Zc(t,_i(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function Xne(e,t){if(t.parser.tokenizer.preprocessor.html="",t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,uD(t,_i(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(zne,"<$1$2"):e.value,!1),t.parser.tokenizer._runParsingLoop(),t.parser.tokenizer.state===72||t.parser.tokenizer.state===78){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;const n=t.parser.tokenizer._consume();t.parser.tokenizer._callState(n)}}function Qne(e,t){const n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))qne(n,t);else{let r="";throw Vne.has(n.type)&&(r=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),new Error("Cannot compile `"+n.type+"` node"+r)}}function Zc(e,t){uD(e,t);const n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=vn.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:"",value:""}}function uD(e,t){if(t&&t.offset!==void 0){const n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function Zne(e,t){const n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===vn.PLAINTEXT)return;Zc(t,_i(e));const r=t.parser.openElements.current;let s="namespaceURI"in r?r.namespaceURI:xo.html;s===xo.html&&n==="svg"&&(s=xo.svg);const i=aee({...e,children:[]},{space:s===xo.svg?"svg":"html"}),a={type:mt.START_TAG,tagName:n,tagID:Qc(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in i?i.attrs:[],location:Mf(e)};t.parser.currentToken=a,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function Jne(e,t){const n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&pee.includes(n)||t.parser.tokenizer.state===vn.PLAINTEXT)return;Zc(t,Pg(e));const r={type:mt.END_TAG,tagName:n,tagID:Qc(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:Mf(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===vn.RCDATA||t.parser.tokenizer.state===vn.RAWTEXT||t.parser.tokenizer.state===vn.SCRIPT_DATA)&&(t.parser.tokenizer.state=vn.DATA)}function ere(e){const t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function Mf(e){const t=_i(e)||{line:void 0,column:void 0,offset:void 0},n=Pg(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}function tre(e){return"children"in e?Sc({...e,children:[]}):Sc(e)}function nre(e){return function(t,n){return oD(t,{...e,file:n})}}const dD=[".mp4",".webm",".mov",".m4v",".ogg",".avi"];function fD(e){if(!e)return!1;try{const t=e.toLowerCase();return dD.some(n=>t.includes(n))}catch{return!1}}function rre(e){var r;const t=(r=e==null?void 0:e.properties)==null?void 0:r.href;if(!t)return!1;if(fD(t))return!0;const n=e==null?void 0:e.children;if(n&&Array.isArray(n)){const s=n.map(i=>(i==null?void 0:i.value)||"").join("").toLowerCase();return dD.some(i=>s.includes(i))}return!1}function sre({text:e,className:t,allowRawHtml:n=!0}){const[r,s]=w.useState(null),i=(c,u)=>{if(c.src)return c.src;if(u){const d=h=>{var p;if(!h)return null;if(h.type==="source"&&((p=h.properties)!=null&&p.src))return h.properties.src;if(h.children)for(const m of h.children){const y=d(m);if(y)return y}return null},f=d({children:u});if(f)return f}return""},a=c=>{try{const d=new URL(c).pathname.split("/");return d[d.length-1]||"video.mp4"}catch{return"video.mp4"}},o=c=>c?Array.isArray(c)?c.map(u=>(u==null?void 0:u.value)||"").join("")||"video":(c==null?void 0:c.value)||"video":"video";return l.jsxs("div",{className:t?`md ${t}`:"md",children:[l.jsx(oq,{remarkPlugins:[xQ],rehypePlugins:n?[nre,VT]:[VT],components:{a:({node:c,...u})=>{const d=u.href;if(d&&(fD(d)||rre(c))){const f=d,h=o(c==null?void 0:c.children);return l.jsxs("div",{className:"video-container",children:[l.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":`点击播放视频: ${h}`,onClick:()=>s({src:f,title:h}),children:[l.jsx("video",{src:f,playsInline:!0,className:"video-thumbnail",preload:"metadata"}),l.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:l.jsx(nc,{})})]}),l.jsx("div",{className:"video-caption",children:l.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"video-link-text",children:h})})]})}return l.jsx("a",{...u,target:"_blank",rel:"noopener noreferrer"})},img:({node:c,src:u,alt:d,...f})=>{const h=l.jsx("img",{...f,src:u,alt:d??"",loading:"lazy"});return u?l.jsx(gL,{src:u,children:l.jsxs("button",{type:"button",className:"image-preview-trigger","aria-label":`放大预览:${d||"图片"}`,children:[h,l.jsx("span",{className:"image-preview-hint","aria-hidden":"true",children:l.jsx(nc,{})})]})}):h},video:({node:c,src:u,children:d,...f})=>{const h=i({src:u},d);return h?l.jsx("div",{className:"video-container",children:l.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":"点击放大视频",onClick:()=>s({src:h}),children:[l.jsx("video",{src:h,...f,playsInline:!0,className:"video-thumbnail",children:d}),l.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:l.jsx(nc,{})})]})}):l.jsx("video",{src:u,controls:!0,playsInline:!0,className:"video-inline",...f,children:d})}},children:e}),r&&l.jsx("div",{className:"video-viewer-backdrop",role:"dialog","aria-modal":"true","aria-label":"视频预览",onClick:()=>s(null),children:l.jsxs("div",{className:"video-viewer",onClick:c=>c.stopPropagation(),children:[l.jsxs("div",{className:"video-viewer-header",children:[l.jsx("div",{className:"video-viewer-title",children:r.title||a(r.src)}),l.jsxs("nav",{className:"video-viewer-nav",children:[l.jsx("a",{href:r.src,download:r.title||a(r.src),"aria-label":"下载视频",title:"下载视频",className:"video-viewer-download",children:l.jsx(Iw,{})}),l.jsx("button",{type:"button",className:"video-viewer-close","aria-label":"关闭",onClick:()=>s(null),children:l.jsx(zr,{})})]})]}),l.jsx("div",{className:"video-viewer-body",children:l.jsx("video",{src:r.src,controls:!0,autoPlay:!0,playsInline:!0,className:"video-fullscreen"})})]})})]})}const jf=w.memo(sre),l2=6,c2=7,ire={active:"可用",available:"可用",creating:"创建中",disabled:"已停用",enabled:"已启用",failed:"异常",inactive:"未启用",pending:"等待中",published:"已发布",ready:"就绪",released:"已发布",running:"运行中",success:"正常",unavailable:"不可用",unreleased:"未发布",updating:"更新中"};function xE(e){return ire[(e||"").trim().toLowerCase()]||"未知"}function u2(e){const t=(e||"").toLowerCase();return["active","available","enabled","published","ready","released","success"].includes(t)?"is-positive":["creating","pending","running","updating"].includes(t)?"is-progress":["failed","unavailable"].includes(t)?"is-danger":"is-muted"}function are(e){if(!e)return"";const t=e.trim(),n=Number(t),r=/^\d+(?:\.\d+)?$/.test(t)?new Date(n<1e12?n*1e3:n):new Date(t);return Number.isNaN(r.getTime())?e:new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(r)}function ore(e){const t=e.replace(/\r\n/g,` +`))}function c(p,m,y,E){const g=y.enter("tableCell"),x=y.enter("phrasing"),b=y.containerPhrasing(p,{...E,before:i,after:i});return x(),g(),b}function u(p,m){return Wq(p,{align:m,alignDelimiters:r,padding:n,stringLength:s})}function d(p,m,y){const E=p.children;let g=-1;const x=[],b=m.enter("table");for(;++g0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const QX={tokenize:iQ,partial:!0};function ZX(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:nQ,continuation:{tokenize:rQ},exit:sQ}},text:{91:{name:"gfmFootnoteCall",tokenize:tQ},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:JX,resolveTo:eQ}}}}function JX(e,t,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;s--;){const c=r.events[s][1];if(c.type==="labelImage"){a=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return o;function o(c){if(!a||!a._balanced)return n(c);const u=Xs(r.sliceSerialize({start:a.end,end:r.now()}));return u.codePointAt(0)!==94||!i.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function eQ(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)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},o=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...o),e}function tQ(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,a;return o;function o(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),c}function c(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(f){if(i>999||f===93&&!a||f===null||f===91||Dt(f))return n(f);if(f===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return s.includes(Xs(r.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return Dt(f)||(a=!0),i++,e.consume(f),f===92?d:u}function d(f){return f===91||f===92||f===93?(e.consume(f),i++,u):u(f)}}function nQ(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,a=0,o;return c;function c(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(m)}function d(m){if(a>999||m===93&&!o||m===null||m===91||Dt(m))return n(m);if(m===93){e.exit("chunkString");const y=e.exit("gfmFootnoteDefinitionLabelString");return i=Xs(r.sliceSerialize(y)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return Dt(m)||(o=!0),a++,e.consume(m),m===92?f:d}function f(m){return m===91||m===92||m===93?(e.consume(m),a++,d):d(m)}function h(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),s.includes(i)||s.push(i),_t(e,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return t(m)}}function rQ(e,t,n){return e.check(Af,t,e.attempt(QX,t,n))}function sQ(e){e.exit("gfmFootnoteDefinition")}function iQ(e,t,n){const r=this;return _t(e,s,"gfmFootnoteDefinitionIndent",5);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(i):n(i)}}function aQ(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(a,o){let c=-1;for(;++c1?c(m):(a.consume(m),f++,p);if(f<2&&!n)return c(m);const E=a.exit("strikethroughSequenceTemporary"),g=kc(m);return E._open=!g||g===2&&!!y,E._close=!y||y===2&&!!g,o(m)}}}class oQ{constructor(){this.map=[]}add(t,n,r){lQ(this,t,n,r)}consume(t){if(this.map.sort(function(i,a){return i[0]-a[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 s=r.pop();for(;s;){for(const i of s)t.push(i);s=r.pop()}this.map.length=0}}function lQ(e,t,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s-1;){const M=r.events[D][1].type;if(M==="lineEnding"||M==="linePrefix")D--;else break}const U=D>-1?r.events[D][1].type:null,X=U==="tableHead"||U==="tableRow"?N:c;return X===N&&r.parser.lazy[r.now().line]?n(O):X(O)}function c(O){return e.enter("tableHead"),e.enter("tableRow"),u(O)}function u(O){return O===124||(a=!0,i+=1),d(O)}function d(O){return O===null?n(O):qe(O)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),p):n(O):yt(O)?_t(e,d,"whitespace")(O):(i+=1,a&&(a=!1,s+=1),O===124?(e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),a=!0,d):(e.enter("data"),f(O)))}function f(O){return O===null||O===124||Dt(O)?(e.exit("data"),d(O)):(e.consume(O),O===92?h:f)}function h(O){return O===92||O===124?(e.consume(O),f):f(O)}function p(O){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(O):(e.enter("tableDelimiterRow"),a=!1,yt(O)?_t(e,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(O):m(O))}function m(O){return O===45||O===58?E(O):O===124?(a=!0,e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),y):k(O)}function y(O){return yt(O)?_t(e,E,"whitespace")(O):E(O)}function E(O){return O===58?(i+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(O),e.exit("tableDelimiterMarker"),g):O===45?(i+=1,g(O)):O===null||qe(O)?_(O):k(O)}function g(O){return O===45?(e.enter("tableDelimiterFiller"),x(O)):k(O)}function x(O){return O===45?(e.consume(O),x):O===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(O),e.exit("tableDelimiterMarker"),b):(e.exit("tableDelimiterFiller"),b(O))}function b(O){return yt(O)?_t(e,_,"whitespace")(O):_(O)}function _(O){return O===124?m(O):O===null||qe(O)?!a||s!==i?k(O):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(O)):k(O)}function k(O){return n(O)}function N(O){return e.enter("tableRow"),C(O)}function C(O){return O===124?(e.enter("tableCellDivider"),e.consume(O),e.exit("tableCellDivider"),C):O===null||qe(O)?(e.exit("tableRow"),t(O)):yt(O)?_t(e,C,"whitespace")(O):(e.enter("data"),S(O))}function S(O){return O===null||O===124||Dt(O)?(e.exit("data"),C(O)):(e.consume(O),O===92?A:S)}function A(O){return O===92||O===124?(e.consume(O),S):S(O)}}function fQ(e,t){let n=-1,r=!0,s=0,i=[0,0,0,0],a=[0,0,0,0],o=!1,c=0,u,d,f;const h=new oQ;for(;++nn[2]+1){const m=n[2]+1,y=n[3]-n[2]-1;e.add(m,y,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return s!==void 0&&(i.end=Object.assign({},El(t.events,s)),e.add(s,0,[["exit",i,t]]),i=void 0),i}function kT(e,t,n,r,s){const i=[],a=El(t.events,n);s&&(s.end=Object.assign({},a),i.push(["exit",s,t])),r.end=Object.assign({},a),i.push(["exit",r,t]),e.add(n+1,0,i)}function El(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const hQ={name:"tasklistCheck",tokenize:mQ};function pQ(){return{text:{91:hQ}}}function mQ(e,t,n){const r=this;return s;function s(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i)}function i(c){return Dt(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(c)}function o(c){return qe(c)?t(c):yt(c)?e.check({tokenize:gQ},t,n)(c):n(c)}}function gQ(e,t,n){return _t(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function yQ(e){return qM([HX(),ZX(),aQ(e),uQ(),pQ()])}const bQ={};function EQ(e){const t=this,n=e||bQ,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(yQ(n)),i.push(BX()),a.push(FX(n))}const NT=function(e,t,n){const r=Cf(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(;++tu&&(u=d):d&&(u!==void 0&&u>-1&&c.push(` +`.repeat(u)||" "),u=-1,c.push(d))}return c.join("")}function H3(e,t,n){return e.type==="element"?TQ(e,t,n):e.type==="text"?n.whitespace==="normal"?z3(e,n):AQ(e):[]}function TQ(e,t,n){const r=V3(e,n),s=e.children||[];let i=-1,a=[];if(NQ(e))return a;let o,c;for(hE(e)||CT(e)&&NT(t,e,CT)?c=` +`:kQ(e)?(o=2,c=2):$3(e)&&(o=1,c=1);++i]+>")+")",o={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={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})"/})]},d={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},f={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(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(s)+e.IDENT_RE,relevance:0},p=t.optional(s)+e.IDENT_RE+"\\s*\\(",m=["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"],y=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],E=["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"],g=["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"],_={type:y,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:E},k={className:"function.dispatch",relevance:0,keywords:{_hint:g},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},N=[k,f,o,n,e.C_BLOCK_COMMENT_MODE,d,u],C={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:_,contains:N.concat([{begin:/\(/,end:/\)/,keywords:_,contains:N.concat(["self"]),relevance:0}]),relevance:0},S={className:"function",begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:_,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:_,relevance:0},{begin:p,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,o,{begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,o]}]},o,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:_,illegal:"",keywords:_,contains:["self",o]},{begin:e.IDENT_RE+"::",keywords:_},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function jQ(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=MQ(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 K3(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 s={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},i=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),a={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},o={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,s]};s.contains.push(o);const c={match:/\\"/},u={className:"string",begin:/'/,end:/'/},d={match:/\\'/},f={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},h=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],p=e.SHEBANG({binary:`(${h.join("|")})`,relevance:10}),m={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},y=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],E=["true","false"],g={match:/(\/[a-z._-]+)+/},x=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],b=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],_=["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"],k=["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:y,literal:E,built_in:[...x,...b,"set","shopt",..._,...k]},contains:[p,e.SHEBANG(),m,f,i,a,g,o,c,u,d,n]}}function DQ(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",a="("+r+"|"+t.optional(s)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",o={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},u={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})"/})]},d={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},f={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(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(s)+e.IDENT_RE,relevance:0},p=t.optional(s)+e.IDENT_RE+"\\s*\\(",E={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"},g=[f,o,n,e.C_BLOCK_COMMENT_MODE,d,u],x={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:E,contains:g.concat([{begin:/\(/,end:/\)/,keywords:E,contains:g.concat(["self"]),relevance:0}]),relevance:0},b={begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:E,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:E,relevance:0},{begin:p,returnBegin:!0,contains:[e.inherit(h,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:E,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,o,{begin:/\(/,end:/\)/,keywords:E,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,o]}]},o,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C",aliases:["h"],keywords:E,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:f,strings:u,keywords:E}}}function PQ(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",a="(?!struct)("+r+"|"+t.optional(s)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",o={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={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})"/})]},d={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},f={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(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},h={className:"title",begin:t.optional(s)+e.IDENT_RE,relevance:0},p=t.optional(s)+e.IDENT_RE+"\\s*\\(",m=["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"],y=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],E=["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"],g=["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"],_={type:y,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:E},k={className:"function.dispatch",relevance:0,keywords:{_hint:g},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},N=[k,f,o,n,e.C_BLOCK_COMMENT_MODE,d,u],C={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:_,contains:N.concat([{begin:/\(/,end:/\)/,keywords:_,contains:N.concat(["self"]),relevance:0}]),relevance:0},S={className:"function",begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:_,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:_,relevance:0},{begin:p,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,o,{begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,o]}]},o,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:_,illegal:"",keywords:_,contains:["self",o]},{begin:e.IDENT_RE+"::",keywords:_},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function BQ(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"],s=["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"],i=["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"],a={keyword:s.concat(i),built_in:t,literal:r},o=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),c={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},u={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},d={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},f=e.inherit(d,{illegal:/\n/}),h={className:"subst",begin:/\{/,end:/\}/,keywords:a},p=e.inherit(h,{illegal:/\n/}),m={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,p]},y={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]},E=e.inherit(y,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},p]});h.contains=[y,m,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.C_BLOCK_COMMENT_MODE],p.contains=[E,m,f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const g={variants:[u,y,m,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},x={begin:"<",end:">",contains:[{beginKeywords:"in out"},o]},b=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",_={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:a,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:""},{begin:""}]}]}),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"}},g,c,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},o,x,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[o,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[o,x,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:"("+b+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:a,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,x],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,relevance:0,contains:[g,c,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},_]}}const FQ=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_-]*/}}),UQ=["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"],$Q=["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"],HQ=[...UQ,...$Q],zQ=["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(),VQ=["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(),KQ=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),YQ=["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 WQ(e){const t=e.regex,n=FQ(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},s="and or not only",i=/@-?\w[\w]*(-\w+)*/,a="[a-zA-Z-][a-zA-Z0-9_-]*",o=[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:"\\."+a,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+VQ.join("|")+")"},{begin:":(:)?("+KQ.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+YQ.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...o,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...o,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:zQ.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...o,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+HQ.join("|")+")\\b"}]}}function GQ(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 qQ(e){const i={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:i,illegal:"W3(e,t,n-1))}function QQ(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+W3("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),c={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"]},u={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},d={className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:c,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:[d,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:c,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[u,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,IT,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},IT,u]}}const OT="[A-Za-z$_][0-9A-Za-z$_]*",ZQ=["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"],JQ=["true","false","null","undefined","NaN","Infinity"],G3=["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"],q3=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],X3=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],eZ=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],tZ=[].concat(X3,G3,q3);function Q3(e){const t=e.regex,n=(R,{after:F})=>{const I="",end:""},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(R,F)=>{const I=R[0].length+R.index,V=R.input[I];if(V==="<"||V===","){F.ignoreMatch();return}V===">"&&(n(R,{after:I})||F.ignoreMatch());let W;const P=R.input.substring(I);if(W=P.match(/^\s*=/)){F.ignoreMatch();return}if((W=P.match(/^\s+extends\s+/))&&W.index===0){F.ignoreMatch();return}}},o={$pattern:OT,keyword:ZQ,literal:JQ,built_in:tZ,"variable.language":eZ},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\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},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:o,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},y={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},E={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},x={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]},b=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,y,E,{match:/\$\d+/},f];h.contains=b.concat({begin:/\{/,end:/\}/,keywords:o,contains:["self"].concat(b)});const _=[].concat(x,h.contains),k=_.concat([{begin:/(\s*)\(/,end:/\)/,keywords:o,contains:["self"].concat(_)}]),N={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:k},C={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"}}]},S={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:{_:[...G3,...q3]}},A={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},O={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[N],illegal:/%/},D={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function U(R){return t.concat("(?!",R.join("|"),")")}const X={match:t.concat(/\b/,U([...X3,"super","import"].map(R=>`${R}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},M={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},j={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},N]},T="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",L={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(T)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[N]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:k,CLASS_REFERENCE:S},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),A,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,y,E,x,{match:/\$\d+/},f,S,{scope:"attr",match:r+t.lookahead(":"),relevance:0},L,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[x,e.REGEXP_MODE,{className:"function",begin:T,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:o,contains:k}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:i},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},O,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[N,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},M,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[N]},X,D,C,j,{match:/\$[(.]/}]}}function Z3(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],s={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,s,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var wl="[0-9](_*[0-9])*",Fh=`\\.(${wl})`,Uh="[0-9a-fA-F](_*[0-9a-fA-F])*",nZ={className:"number",variants:[{begin:`(\\b(${wl})((${Fh})|\\.)?|(${Fh}))[eE][+-]?(${wl})[fFdD]?\\b`},{begin:`\\b(${wl})((${Fh})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Fh})[fFdD]?\\b`},{begin:`\\b(${wl})[fFdD]\\b`},{begin:`\\b0[xX]((${Uh})\\.?|(${Uh})?\\.(${Uh}))[pP][+-]?(${wl})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Uh})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function rZ(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+"@"},s={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},i={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},a={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[i,s]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,i,s]}]};s.contains.push(a);const o={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},c={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(a,{className:"string"}),"self"]}]},u=nZ,d=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),f={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},h=f;return h.variants[1].contains=[f],f.variants[1].contains=[h],{name:"Kotlin",aliases:["kt","kts"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,d,n,r,o,c,{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://,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[f,e.C_LINE_COMMENT_MODE,d],relevance:0},e.C_LINE_COMMENT_MODE,d,o,c,a,e.C_NUMBER_MODE]},d]},{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://,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},o,c]},a,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:` +`},u]}}const sZ=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_-]*/}}),iZ=["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"],aZ=["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"],oZ=[...iZ,...aZ],lZ=["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(),J3=["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(),ej=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),cZ=["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(),uZ=J3.concat(ej).sort().reverse();function dZ(e){const t=sZ(e),n=uZ,r="and or not only",s="[\\w-]+",i="("+s+"|@\\{"+s+"\\})",a=[],o=[],c=function(b){return{className:"string",begin:"~?"+b+".*?"+b}},u=function(b,_,k){return{className:b,begin:_,relevance:k}},d={$pattern:/[a-z-]+/,keyword:r,attribute:lZ.join(" ")},f={begin:"\\(",end:"\\)",contains:o,keywords:d,relevance:0};o.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,c("'"),c('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.HEXCOLOR,f,u("variable","@@?"+s,10),u("variable","@\\{"+s+"\\}"),u("built_in","~?`[^`]*?`"),{className:"attribute",begin:s+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);const h=o.concat({begin:/\{/,end:/\}/,contains:a}),p={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(o)},m={begin:i+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+cZ.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:o}}]},y={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:d,returnEnd:!0,contains:o,relevance:0}},E={className:"variable",variants:[{begin:"@"+s+"\\s*:",relevance:15},{begin:"@"+s}],starts:{end:"[;}]",returnEnd:!0,contains:h}},g={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:i,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,p,u("keyword","all\\b"),u("variable","@\\{"+s+"\\}"),{begin:"\\b("+oZ.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,u("selector-tag",i,0),u("selector-id","#"+i),u("selector-class","\\."+i,0),u("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+J3.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+ej.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:h},{begin:"!important"},t.FUNCTION_DISPATCH]},x={begin:s+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[g]};return a.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,y,E,x,m,g,p,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:a}}function fZ(e){const t="\\[=*\\[",n="\\]=*\\]",r={begin:t,end:n,contains:["self"]},s=[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:s.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:s}].concat(s)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[r],relevance:5}])}}function tj(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},s={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}]},i={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},a={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},o=/[A-Za-z][A-Za-z0-9+.-]*/,c={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,o,/:\/\/.*?\)/),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}]},u={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},d={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},f=e.inherit(u,{contains:[]}),h=e.inherit(d,{contains:[]});u.contains.push(h),d.contains.push(f);let p=[n,c];return[u,d,f,h].forEach(g=>{g.contains=g.contains.concat(p)}),p=p.concat(u,d),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:p},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:p}]}]},n,i,u,d,{className:"quote",begin:"^>\\s+",contains:p,end:"$"},s,r,c,a,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function hZ(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_]*/,o={"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"]},c={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:o,illegal:"/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+c.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:c,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function pZ(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}/,s={$pattern:/[\w.]+/,keyword:n.join(" ")},i={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:s},a={begin:/->\{/,end:/\}/},o={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},c={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[o]},u={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},d=[e.BACKSLASH_ESCAPE,i,c],f=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],h=(y,E,g="\\1")=>{const x=g==="\\1"?g:t.concat(g,E);return t.concat(t.concat("(?:",y,")"),E,/(?:\\.|[^\\\/])*?/,x,/(?:\\.|[^\\\/])*?/,g,r)},p=(y,E,g)=>t.concat(t.concat("(?:",y,")"),E,/(?:\\.|[^\\\/])*?/,g,r),m=[c,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),a,{className:"string",contains:d,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}]},u,{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:h("s|tr|y",t.either(...f,{capture:!0}))},{begin:h("s|tr|y","\\(","\\)")},{begin:h("s|tr|y","\\[","\\]")},{begin:h("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p("(?:m|qr)?",/\//,/\//)},{begin:p("m|qr",t.either(...f,{capture:!0}),/\1/)},{begin:p("m|qr",/\(/,/\)/)},{begin:p("m|qr",/\[/,/\]/)},{begin:p("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,o]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,o,u]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return i.contains=m,a.contains=m,{name:"Perl",aliases:["pl","pm"],keywords:s,contains:m}}function mZ(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),s=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),i=t.concat(/[A-Z]+/,n),a={scope:"variable",match:"\\$+"+r},o={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},c={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},u=e.inherit(e.APOS_STRING_MODE,{illegal:null}),d=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(c)}),f={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(c),"on:begin":(M,j)=>{j.data._beginMatch=M[1]||M[2]},"on:end":(M,j)=>{j.data._beginMatch!==M[1]&&j.ignoreMatch()}},h=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),p=`[ +]`,m={scope:"string",variants:[d,u,f,h]},y={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},E=["false","null","true"],g=["__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"],x=["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"],_={keyword:g,literal:(M=>{const j=[];return M.forEach(T=>{j.push(T),T.toLowerCase()===T?j.push(T.toUpperCase()):j.push(T.toLowerCase())}),j})(E),built_in:x},k=M=>M.map(j=>j.replace(/\|\d+$/,"")),N={variants:[{match:[/new/,t.concat(p,"+"),t.concat("(?!",k(x).join("\\b|"),"\\b)"),s],scope:{1:"keyword",4:"title.class"}}]},C=t.concat(r,"\\b(?!\\()"),S={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),C],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[s,t.concat(/::/,t.lookahead(/(?!class\b)/)),C],scope:{1:"title.class",3:"variable.constant"}},{match:[s,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[s,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},A={scope:"attr",match:t.concat(r,t.lookahead(":"),t.lookahead(/(?!::)/))},O={relevance:0,begin:/\(/,end:/\)/,keywords:_,contains:[A,a,S,e.C_BLOCK_COMMENT_MODE,m,y,N]},D={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",k(g).join("\\b|"),"|",k(x).join("\\b|"),"\\b)"),r,t.concat(p,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[O]};O.contains.push(D);const U=[A,S,e.C_BLOCK_COMMENT_MODE,m,y,N],X={begin:t.concat(/#\[\s*\\?/,t.either(s,i)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:E,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:E,keyword:["new","array"]},contains:["self",...U]},...U,{scope:"meta",variants:[{match:s},{match:i}]}]};return{case_insensitive:!1,keywords:_,contains:[X,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}]}},o,{scope:"variable.language",match:/\$this\b/},a,D,S,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},N,{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:_,contains:["self",X,a,S,e.C_BLOCK_COMMENT_MODE,m,y]}]},{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]},m,y]}}function gZ(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 yZ(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function rj(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"],o={$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"]},c={className:"meta",begin:/^(>>>|\.\.\.) /},u={className:"subst",begin:/\{/,end:/\}/,keywords:o,illegal:/#/},d={begin:/\{\{/,relevance:0},f={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,c,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,c,d,u]},{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,d,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,d,u]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},h="[0-9](_?[0-9])*",p=`(\\b(${h}))?\\.(${h})|\\b(${h})\\.`,m=`\\b|${r.join("|")}`,y={className:"number",relevance:0,variants:[{begin:`(\\b(${h})|(${p}))[eE][+-]?(${h})[jJ]?(?=${m})`},{begin:`(${p})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${m})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${m})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${m})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${m})`},{begin:`\\b(${h})[jJ](?=${m})`}]},E={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:o,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},g={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:["self",c,y,f,e.HASH_COMMENT_MODE]}]};return u.contains=[f,y,c],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:o,illegal:/(<\/|\?)|=>/,contains:[c,y,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},f,E,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[g]},{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:[y,g,f]}]}}function bZ(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function EZ(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]?/),s=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,i=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:[s,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[i,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:s},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:i},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function xZ(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]+/),s=t.concat(r,/(::\w+)*/),a={"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"]},o={className:"doctag",begin:"@[A-Za-z]+"},c={begin:"#<",end:">"},u=[e.COMMENT("#","$",{contains:[o]}),e.COMMENT("^=begin","^=end",{contains:[o],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],d={className:"subst",begin:/#\{/,end:/\}/,keywords:a},f={className:"string",contains:[e.BACKSLASH_ESCAPE,d],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?/},{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,d]})]}]},h="[1-9](_?[0-9])*|0",p="[0-9](_?[0-9])*",m={className:"number",relevance:0,variants:[{begin:`\\b(${h})(\\.(${p}))?([eE][+-]?(${p})|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"}]},y={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:a}]},N=[f,{variants:[{match:[/class\s+/,s,/\s+<\s+/,s]},{match:[/\b(class|module)\s+/,s]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:a},{match:[/(include|extend)\s+/,s],scope:{2:"title.class"},keywords:a},{relevance:0,match:[s,/\.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:[y]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[f,{begin:n}],relevance:0},m,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:a},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,d],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(c,u),relevance:0}].concat(c,u);d.contains=N,y.contains=N;const O=[{begin:/^\s*=>/,starts:{end:"$",contains:N}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:a,contains:N}}];return u.unshift(c),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:a,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(O).concat(u).concat(N)}}function wZ(e){const t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),s=t.concat(n,e.IDENT_RE),i={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,s,t.lookahead(/\s*\(/))},a="([ui](8|16|32|64|128|size)|f(32|64))?",o=["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"],c=["true","false","Some","None","Ok","Err"],u=["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!"],d=["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:d,keyword:o,literal:c,built_in:u},illegal:""},i]}}const vZ=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_-]*/}}),_Z=["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"],kZ=["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"],NZ=[..._Z,...kZ],SZ=["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(),TZ=["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(),AZ=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),CZ=["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 IZ(e){const t=vZ(e),n=AZ,r=TZ,s="@[a-z-]+",i="and or not only",o={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("+NZ.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},o,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+CZ.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,o,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:s,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:SZ.join(" ")},contains:[{begin:s,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},o,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function OZ(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function RZ(e){const t=e.regex,n=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},s={begin:/"/,end:/"/,contains:[{match:/""/}]},i=["true","false","unknown"],a=["double precision","large object","with timezone","without timezone"],o=["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"],c=["add","asc","collation","desc","final","first","last","view"],u=["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"],d=["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"],f=["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"],h=["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"],p=d,m=[...u,...c].filter(k=>!d.includes(k)),y={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},E={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},g={match:t.concat(/\b/,t.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function x(k){return t.concat(/\b/,t.either(...k.map(N=>N.replace(/\s+/,"\\s+"))),/\b/)}const b={scope:"keyword",match:x(h),relevance:0};function _(k,{exceptions:N,when:C}={}){const S=C;return N=N||[],k.map(A=>A.match(/\|\d+$/)||N.includes(A)?A:S(A)?`${A}|0`:A)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:_(m,{when:k=>k.length<3}),literal:i,type:o,built_in:f},contains:[{scope:"type",match:x(a)},b,g,y,r,s,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,E]}}function sj(e){return e?typeof e=="string"?e:e.source:null}function wu(e){return jt("(?=",e,")")}function jt(...e){return e.map(n=>sj(n)).join("")}function LZ(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function vr(...e){return"("+(LZ(e).capture?"":"?:")+e.map(r=>sj(r)).join("|")+")"}const av=e=>jt(/\b/,e,/\w$/.test(e)?/\b/:/\B/),MZ=["Protocol","Type"].map(av),RT=["init","self"].map(av),jZ=["Any","Self"],Dy=["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"],LT=["false","nil","true"],DZ=["assignment","associativity","higherThan","left","lowerThan","none","right"],PZ=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],MT=["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"],ij=vr(/[/=\-+!*%<>&|^~?]/,/[\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]/),aj=vr(ij,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),Py=jt(ij,aj,"*"),oj=vr(/[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]/),Im=vr(oj,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),li=jt(oj,Im,"*"),$h=jt(/[A-Z]/,Im,"*"),BZ=["attached","autoclosure",jt(/convention\(/,vr("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",jt(/objc\(/,li,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],FZ=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function UZ(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],s={match:[/\./,vr(...MZ,...RT)],className:{2:"keyword"}},i={match:jt(/\./,vr(...Dy)),relevance:0},a=Dy.filter(Te=>typeof Te=="string").concat(["_|0"]),o=Dy.filter(Te=>typeof Te!="string").concat(jZ).map(av),c={variants:[{className:"keyword",match:vr(...o,...RT)}]},u={$pattern:vr(/\b\w+/,/#\w+/),keyword:a.concat(PZ),literal:LT},d=[s,i,c],f={match:jt(/\./,vr(...MT)),relevance:0},h={className:"built_in",match:jt(/\b/,vr(...MT),/(?=\()/)},p=[f,h],m={match:/->/,relevance:0},y={className:"operator",relevance:0,variants:[{match:Py},{match:`\\.(\\.|${aj})+`}]},E=[m,y],g="([0-9]_*)+",x="([0-9a-fA-F]_*)+",b={className:"number",relevance:0,variants:[{match:`\\b(${g})(\\.(${g}))?([eE][+-]?(${g}))?\\b`},{match:`\\b0x(${x})(\\.(${x}))?([pP][+-]?(${g}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},_=(Te="")=>({className:"subst",variants:[{match:jt(/\\/,Te,/[0\\tnr"']/)},{match:jt(/\\/,Te,/u\{[0-9a-fA-F]{1,8}\}/)}]}),k=(Te="")=>({className:"subst",match:jt(/\\/,Te,/[\t ]*(?:[\r\n]|\r\n)/)}),N=(Te="")=>({className:"subst",label:"interpol",begin:jt(/\\/,Te,/\(/),end:/\)/}),C=(Te="")=>({begin:jt(Te,/"""/),end:jt(/"""/,Te),contains:[_(Te),k(Te),N(Te)]}),S=(Te="")=>({begin:jt(Te,/"/),end:jt(/"/,Te),contains:[_(Te),N(Te)]}),A={className:"string",variants:[C(),C("#"),C("##"),C("###"),S(),S("#"),S("##"),S("###")]},O=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],D={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:O},U=Te=>{const Ke=jt(Te,/\//),Ne=jt(/\//,Te);return{begin:Ke,end:Ne,contains:[...O,{scope:"comment",begin:`#(?!.*${Ne})`,end:/$/}]}},X={scope:"regexp",variants:[U("###"),U("##"),U("#"),D]},M={match:jt(/`/,li,/`/)},j={className:"variable",match:/\$\d+/},T={className:"variable",match:`\\$${Im}+`},L=[M,j,T],R={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:FZ,contains:[...E,b,A]}]}},F={scope:"keyword",match:jt(/@/,vr(...BZ),wu(vr(/\(/,/\s+/)))},I={scope:"meta",match:jt(/@/,li)},V=[R,F,I],W={match:wu(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:jt(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Im,"+")},{className:"type",match:$h,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:jt(/\s+&\s+/,wu($h)),relevance:0}]},P={begin://,keywords:u,contains:[...r,...d,...V,m,W]};W.contains.push(P);const ie={match:jt(li,/\s*:/),keywords:"_|0",relevance:0},G={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",ie,...r,X,...d,...p,...E,b,A,...L,...V,W]},re={begin://,keywords:"repeat each",contains:[...r,W]},ue={begin:vr(wu(jt(li,/\s*:/)),wu(jt(li,/\s+/,li,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:li}]},ee={begin:/\(/,end:/\)/,keywords:u,contains:[ue,...r,...d,...E,b,A,...V,W,G],endsParent:!0,illegal:/["']/},le={match:[/(func|macro)/,/\s+/,vr(M.match,li,Py)],className:{1:"keyword",3:"title.function"},contains:[re,ee,t],illegal:[/\[/,/%/]},ne={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[re,ee,t],illegal:/\[|%/},me={match:[/operator/,/\s+/,Py],className:{1:"keyword",3:"title"}},ye={begin:[/precedencegroup/,/\s+/,$h],className:{1:"keyword",3:"title"},contains:[W],keywords:[...DZ,...LT],end:/}/},te={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},de={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},Ee={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,li,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:u,contains:[re,...d,{begin:/:/,end:/\{/,keywords:u,contains:[{scope:"title.class.inherited",match:$h},...d],relevance:0}]};for(const Te of A.variants){const Ke=Te.contains.find(it=>it.label==="interpol");Ke.keywords=u;const Ne=[...d,...p,...E,b,A,...L];Ke.contains=[...Ne,{begin:/\(/,end:/\)/,contains:["self",...Ne]}]}return{name:"Swift",keywords:u,contains:[...r,le,ne,te,de,Ee,me,ye,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},X,...d,...p,...E,b,A,...L,...V,W,G]}}const Om="[A-Za-z$_][0-9A-Za-z$_]*",lj=["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"],cj=["true","false","null","undefined","NaN","Infinity"],uj=["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"],dj=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],fj=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],hj=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],pj=[].concat(fj,uj,dj);function $Z(e){const t=e.regex,n=(R,{after:F})=>{const I="",end:""},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(R,F)=>{const I=R[0].length+R.index,V=R.input[I];if(V==="<"||V===","){F.ignoreMatch();return}V===">"&&(n(R,{after:I})||F.ignoreMatch());let W;const P=R.input.substring(I);if(W=P.match(/^\s*=/)){F.ignoreMatch();return}if((W=P.match(/^\s+extends\s+/))&&W.index===0){F.ignoreMatch();return}}},o={$pattern:Om,keyword:lj,literal:cj,built_in:pj,"variable.language":hj},c="[0-9](_?[0-9])*",u=`\\.(${c})`,d="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${d})((${u})|\\.)?|(${u}))[eE][+-]?(${c})\\b`},{begin:`\\b(${d})\\b((${u})\\b|\\.)?|(${u})\\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},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:o,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},y={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},E={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},x={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]},b=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,y,E,{match:/\$\d+/},f];h.contains=b.concat({begin:/\{/,end:/\}/,keywords:o,contains:["self"].concat(b)});const _=[].concat(x,h.contains),k=_.concat([{begin:/(\s*)\(/,end:/\)/,keywords:o,contains:["self"].concat(_)}]),N={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,contains:k},C={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"}}]},S={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:{_:[...uj,...dj]}},A={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},O={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[N],illegal:/%/},D={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function U(R){return t.concat("(?!",R.join("|"),")")}const X={match:t.concat(/\b/,U([...fj,"super","import"].map(R=>`${R}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},M={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},j={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},N]},T="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",L={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(T)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[N]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:o,exports:{PARAMS_CONTAINS:k,CLASS_REFERENCE:S},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),A,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,y,E,x,{match:/\$\d+/},f,S,{scope:"attr",match:r+t.lookahead(":"),relevance:0},L,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[x,e.REGEXP_MODE,{className:"function",begin:T,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:o,contains:k}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:i},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},O,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[N,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},M,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[N]},X,D,C,j,{match:/\$[(.]/}]}}function mj(e){const t=e.regex,n=$Z(e),r=Om,s=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},a={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:s},contains:[n.exports.CLASS_REFERENCE]},o={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},c=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],u={$pattern:Om,keyword:lj.concat(c),literal:cj,built_in:pj.concat(s),"variable.language":hj},d={className:"meta",begin:"@"+r},f=(y,E,g)=>{const x=y.contains.findIndex(b=>b.label===E);if(x===-1)throw new Error("can not find mode to replace");y.contains.splice(x,1,g)};Object.assign(n.keywords,u),n.exports.PARAMS_CONTAINS.push(d);const h=n.contains.find(y=>y.scope==="attr"),p=Object.assign({},h,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,h,p]),n.contains=n.contains.concat([d,i,a,p]),f(n,"shebang",e.SHEBANG()),f(n,"use_strict",o);const m=n.contains.find(y=>y.label==="func.def");return m.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function HZ(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},s=/\d{1,2}\/\d{1,2}\/\d{4}/,i=/\d{4}-\d{1,2}-\d{1,2}/,a=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,o=/\d{1,2}(:\d{1,2}){1,2}/,c={className:"literal",variants:[{begin:t.concat(/# */,t.either(i,s),/ *#/)},{begin:t.concat(/# */,o,/ *#/)},{begin:t.concat(/# */,a,/ *#/)},{begin:t.concat(/# */,t.either(i,s),/ +/,t.either(a,o),/ *#/)}]},u={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])|[%&])?/}]},d={className:"label",begin:/^\w+:/},f=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),h=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,c,u,d,f,h,{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:[h]}]}}function zZ(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"],s={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},i={className:"variable",begin:/\$[\w_]+/},a={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},o={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/},c={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},u={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"}},i,a,s,e.QUOTE_STRING_MODE,c,u,o]}}function VZ(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,s={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},a=e.inherit(i,{begin:/\(/,end:/\)/}),o=e.inherit(e.APOS_STRING_MODE,{className:"string"}),c=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),u={endsWithParent:!0,illegal:/`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[i,c,o,a,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[i,a,c,o]}]}]},e.COMMENT(//,{relevance:10}),{begin://,relevance:10},s,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/)/,end:/>/,keywords:{name:"style"},contains:[u],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/)/,end:/>/,keywords:{name:"script"},contains:[u],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(//,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:u}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function gj(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]|$)/}]},s={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},a={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,s]},o=e.inherit(a,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),h={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"},p={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},m={begin:/\{/,end:/\}/,contains:[p],illegal:"\\n",relevance:0},y={begin:"\\[",end:"\\]",contains:[p],illegal:"\\n",relevance:0},E=[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}},h,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},m,y,i,a],g=[...E];return g.pop(),g.push(o),p.contains=g,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:E}}const KZ={arduino:jQ,bash:K3,c:DQ,cpp:PQ,csharp:BQ,css:WQ,diff:GQ,go:qQ,graphql:XQ,ini:Y3,java:QQ,javascript:Q3,json:Z3,kotlin:rZ,less:dZ,lua:fZ,makefile:tj,markdown:nj,objectivec:hZ,perl:pZ,php:mZ,"php-template":gZ,plaintext:yZ,python:rj,"python-repl":bZ,r:EZ,ruby:xZ,rust:wZ,scss:IZ,shell:OZ,sql:RZ,swift:UZ,typescript:mj,vbnet:HZ,wasm:zZ,xml:VZ,yaml:gj};function yj(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{const n=e[t],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&yj(n)}),e}let jT=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function bj(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Na(e,...t){const n=Object.create(null);for(const r in e)n[r]=e[r];return t.forEach(function(r){for(const s in r)n[s]=r[s]}),n}const YZ="",DT=e=>!!e.scope,WZ=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map((r,s)=>`${r}${"_".repeat(s+1)}`)].join(" ")}return`${t}${e}`};class GZ{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=bj(t)}openNode(t){if(!DT(t))return;const n=WZ(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){DT(t)&&(this.buffer+=YZ)}value(){return this.buffer}span(t){this.buffer+=``}}const PT=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class ov{constructor(){this.rootNode=PT(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){const n=PT({scope:t});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,n){return typeof n=="string"?t.addText(n):n.children&&(t.openNode(n),n.children.forEach(r=>this._walk(t,r)),t.closeNode(n)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(n=>typeof n=="string")?t.children=[t.children.join("")]:t.children.forEach(n=>{ov._collapse(n)}))}}class qZ extends ov{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){const r=t.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new GZ(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Zd(e){return e?typeof e=="string"?e:e.source:null}function Ej(e){return Qo("(?=",e,")")}function XZ(e){return Qo("(?:",e,")*")}function QZ(e){return Qo("(?:",e,")?")}function Qo(...e){return e.map(n=>Zd(n)).join("")}function ZZ(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function lv(...e){return"("+(ZZ(e).capture?"":"?:")+e.map(r=>Zd(r)).join("|")+")"}function xj(e){return new RegExp(e.toString()+"|").exec("").length-1}function JZ(e,t){const n=e&&e.exec(t);return n&&n.index===0}const eJ=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function cv(e,{joinWith:t}){let n=0;return e.map(r=>{n+=1;const s=n;let i=Zd(r),a="";for(;i.length>0;){const o=eJ.exec(i);if(!o){a+=i;break}a+=i.substring(0,o.index),i=i.substring(o.index+o[0].length),o[0][0]==="\\"&&o[1]?a+="\\"+String(Number(o[1])+s):(a+=o[0],o[0]==="("&&n++)}return a}).map(r=>`(${r})`).join(t)}const tJ=/\b\B/,wj="[a-zA-Z]\\w*",uv="[a-zA-Z_]\\w*",vj="\\b\\d+(\\.\\d+)?",_j="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",kj="\\b(0b[01]+)",nJ="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",rJ=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=Qo(t,/.*\b/,e.binary,/\b.*/)),Na({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},e)},Jd={begin:"\\\\[\\s\\S]",relevance:0},sJ={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Jd]},iJ={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Jd]},aJ={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/},$g=function(e,t,n={}){const r=Na({scope:"comment",begin:e,end:t,contains:[]},n);r.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 s=lv("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 r.contains.push({begin:Qo(/[ ]+/,"(",s,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},oJ=$g("//","$"),lJ=$g("/\\*","\\*/"),cJ=$g("#","$"),uJ={scope:"number",begin:vj,relevance:0},dJ={scope:"number",begin:_j,relevance:0},fJ={scope:"number",begin:kj,relevance:0},hJ={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Jd,{begin:/\[/,end:/\]/,relevance:0,contains:[Jd]}]},pJ={scope:"title",begin:wj,relevance:0},mJ={scope:"title",begin:uv,relevance:0},gJ={begin:"\\.\\s*"+uv,relevance:0},yJ=function(e){return Object.assign(e,{"on:begin":(t,n)=>{n.data._beginMatch=t[1]},"on:end":(t,n)=>{n.data._beginMatch!==t[1]&&n.ignoreMatch()}})};var Hh=Object.freeze({__proto__:null,APOS_STRING_MODE:sJ,BACKSLASH_ESCAPE:Jd,BINARY_NUMBER_MODE:fJ,BINARY_NUMBER_RE:kj,COMMENT:$g,C_BLOCK_COMMENT_MODE:lJ,C_LINE_COMMENT_MODE:oJ,C_NUMBER_MODE:dJ,C_NUMBER_RE:_j,END_SAME_AS_BEGIN:yJ,HASH_COMMENT_MODE:cJ,IDENT_RE:wj,MATCH_NOTHING_RE:tJ,METHOD_GUARD:gJ,NUMBER_MODE:uJ,NUMBER_RE:vj,PHRASAL_WORDS_MODE:aJ,QUOTE_STRING_MODE:iJ,REGEXP_MODE:hJ,RE_STARTERS_RE:nJ,SHEBANG:rJ,TITLE_MODE:pJ,UNDERSCORE_IDENT_RE:uv,UNDERSCORE_TITLE_MODE:mJ});function bJ(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function EJ(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function xJ(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=bJ,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function wJ(e,t){Array.isArray(e.illegal)&&(e.illegal=lv(...e.illegal))}function vJ(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function _J(e,t){e.relevance===void 0&&(e.relevance=1)}const kJ=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach(r=>{delete e[r]}),e.keywords=n.keywords,e.begin=Qo(n.beforeMatch,Ej(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},NJ=["of","and","for","in","not","or","if","then","parent","list","value"],SJ="keyword";function Nj(e,t,n=SJ){const r=Object.create(null);return typeof e=="string"?s(n,e.split(" ")):Array.isArray(e)?s(n,e):Object.keys(e).forEach(function(i){Object.assign(r,Nj(e[i],t,i))}),r;function s(i,a){t&&(a=a.map(o=>o.toLowerCase())),a.forEach(function(o){const c=o.split("|");r[c[0]]=[i,TJ(c[0],c[1])]})}}function TJ(e,t){return t?Number(t):AJ(e)?0:1}function AJ(e){return NJ.includes(e.toLowerCase())}const BT={},To=e=>{console.error(e)},FT=(e,...t)=>{console.log(`WARN: ${e}`,...t)},fl=(e,t)=>{BT[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),BT[`${e}/${t}`]=!0)},Rm=new Error;function Sj(e,t,{key:n}){let r=0;const s=e[n],i={},a={};for(let o=1;o<=t.length;o++)a[o+r]=s[o],i[o+r]=!0,r+=xj(t[o-1]);e[n]=a,e[n]._emit=i,e[n]._multi=!0}function CJ(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw To("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Rm;if(typeof e.beginScope!="object"||e.beginScope===null)throw To("beginScope must be object"),Rm;Sj(e,e.begin,{key:"beginScope"}),e.begin=cv(e.begin,{joinWith:""})}}function IJ(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw To("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Rm;if(typeof e.endScope!="object"||e.endScope===null)throw To("endScope must be object"),Rm;Sj(e,e.end,{key:"endScope"}),e.end=cv(e.end,{joinWith:""})}}function OJ(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function RJ(e){OJ(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),CJ(e),IJ(e)}function LJ(e){function t(a,o){return new RegExp(Zd(a),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(o?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(o,c){c.position=this.position++,this.matchIndexes[this.matchAt]=c,this.regexes.push([c,o]),this.matchAt+=xj(o)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const o=this.regexes.map(c=>c[1]);this.matcherRe=t(cv(o,{joinWith:"|"}),!0),this.lastIndex=0}exec(o){this.matcherRe.lastIndex=this.lastIndex;const c=this.matcherRe.exec(o);if(!c)return null;const u=c.findIndex((f,h)=>h>0&&f!==void 0),d=this.matchIndexes[u];return c.splice(0,u),Object.assign(c,d)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(o){if(this.multiRegexes[o])return this.multiRegexes[o];const c=new n;return this.rules.slice(o).forEach(([u,d])=>c.addRule(u,d)),c.compile(),this.multiRegexes[o]=c,c}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(o,c){this.rules.push([o,c]),c.type==="begin"&&this.count++}exec(o){const c=this.getMatcher(this.regexIndex);c.lastIndex=this.lastIndex;let u=c.exec(o);if(this.resumingScanAtSamePosition()&&!(u&&u.index===this.lastIndex)){const d=this.getMatcher(0);d.lastIndex=this.lastIndex+1,u=d.exec(o)}return u&&(this.regexIndex+=u.position+1,this.regexIndex===this.count&&this.considerAll()),u}}function s(a){const o=new r;return a.contains.forEach(c=>o.addRule(c.begin,{rule:c,type:"begin"})),a.terminatorEnd&&o.addRule(a.terminatorEnd,{type:"end"}),a.illegal&&o.addRule(a.illegal,{type:"illegal"}),o}function i(a,o){const c=a;if(a.isCompiled)return c;[EJ,vJ,RJ,kJ].forEach(d=>d(a,o)),e.compilerExtensions.forEach(d=>d(a,o)),a.__beforeBegin=null,[xJ,wJ,_J].forEach(d=>d(a,o)),a.isCompiled=!0;let u=null;return typeof a.keywords=="object"&&a.keywords.$pattern&&(a.keywords=Object.assign({},a.keywords),u=a.keywords.$pattern,delete a.keywords.$pattern),u=u||/\w+/,a.keywords&&(a.keywords=Nj(a.keywords,e.case_insensitive)),c.keywordPatternRe=t(u,!0),o&&(a.begin||(a.begin=/\B|\b/),c.beginRe=t(c.begin),!a.end&&!a.endsWithParent&&(a.end=/\B|\b/),a.end&&(c.endRe=t(c.end)),c.terminatorEnd=Zd(c.end)||"",a.endsWithParent&&o.terminatorEnd&&(c.terminatorEnd+=(a.end?"|":"")+o.terminatorEnd)),a.illegal&&(c.illegalRe=t(a.illegal)),a.contains||(a.contains=[]),a.contains=[].concat(...a.contains.map(function(d){return MJ(d==="self"?a:d)})),a.contains.forEach(function(d){i(d,c)}),a.starts&&i(a.starts,o),c.matcher=s(c),c}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=Na(e.classNameAliases||{}),i(e)}function Tj(e){return e?e.endsWithParent||Tj(e.starts):!1}function MJ(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return Na(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:Tj(e)?Na(e,{starts:e.starts?Na(e.starts):null}):Object.isFrozen(e)?Na(e):e}var jJ="11.11.1";class DJ extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}}const By=bj,UT=Na,$T=Symbol("nomatch"),PJ=7,Aj=function(e){const t=Object.create(null),n=Object.create(null),r=[];let s=!0;const i="Could not find the language '{}', did you forget to load/include a language module?",a={disableAutodetect:!0,name:"Plain text",contains:[]};let o={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:qZ};function c(T){return o.noHighlightRe.test(T)}function u(T){let L=T.className+" ";L+=T.parentNode?T.parentNode.className:"";const R=o.languageDetectRe.exec(L);if(R){const F=S(R[1]);return F||(FT(i.replace("{}",R[1])),FT("Falling back to no-highlight mode for this block.",T)),F?R[1]:"no-highlight"}return L.split(/\s+/).find(F=>c(F)||S(F))}function d(T,L,R){let F="",I="";typeof L=="object"?(F=T,R=L.ignoreIllegals,I=L.language):(fl("10.7.0","highlight(lang, code, ...args) has been deprecated."),fl("10.7.0",`Please use highlight(code, options) instead. +https://github.com/highlightjs/highlight.js/issues/2277`),I=T,F=L),R===void 0&&(R=!0);const V={code:F,language:I};M("before:highlight",V);const W=V.result?V.result:f(V.language,V.code,R);return W.code=V.code,M("after:highlight",W),W}function f(T,L,R,F){const I=Object.create(null);function V(B,Q){return B.keywords[Q]}function W(){if(!Ne.keywords){He.addText(Ue);return}let B=0;Ne.keywordPatternRe.lastIndex=0;let Q=Ne.keywordPatternRe.exec(Ue),oe="";for(;Q;){oe+=Ue.substring(B,Q.index);const be=Ee.case_insensitive?Q[0].toLowerCase():Q[0],Oe=V(Ne,be);if(Oe){const[Ye,tt]=Oe;if(He.addText(oe),oe="",I[be]=(I[be]||0)+1,I[be]<=PJ&&(Et+=tt),Ye.startsWith("_"))oe+=Q[0];else{const ze=Ee.classNameAliases[Ye]||Ye;G(Q[0],ze)}}else oe+=Q[0];B=Ne.keywordPatternRe.lastIndex,Q=Ne.keywordPatternRe.exec(Ue)}oe+=Ue.substring(B),He.addText(oe)}function P(){if(Ue==="")return;let B=null;if(typeof Ne.subLanguage=="string"){if(!t[Ne.subLanguage]){He.addText(Ue);return}B=f(Ne.subLanguage,Ue,!0,it[Ne.subLanguage]),it[Ne.subLanguage]=B._top}else B=p(Ue,Ne.subLanguage.length?Ne.subLanguage:null);Ne.relevance>0&&(Et+=B.relevance),He.__addSublanguage(B._emitter,B.language)}function ie(){Ne.subLanguage!=null?P():W(),Ue=""}function G(B,Q){B!==""&&(He.startScope(Q),He.addText(B),He.endScope())}function re(B,Q){let oe=1;const be=Q.length-1;for(;oe<=be;){if(!B._emit[oe]){oe++;continue}const Oe=Ee.classNameAliases[B[oe]]||B[oe],Ye=Q[oe];Oe?G(Ye,Oe):(Ue=Ye,W(),Ue=""),oe++}}function ue(B,Q){return B.scope&&typeof B.scope=="string"&&He.openNode(Ee.classNameAliases[B.scope]||B.scope),B.beginScope&&(B.beginScope._wrap?(G(Ue,Ee.classNameAliases[B.beginScope._wrap]||B.beginScope._wrap),Ue=""):B.beginScope._multi&&(re(B.beginScope,Q),Ue="")),Ne=Object.create(B,{parent:{value:Ne}}),Ne}function ee(B,Q,oe){let be=JZ(B.endRe,oe);if(be){if(B["on:end"]){const Oe=new jT(B);B["on:end"](Q,Oe),Oe.isMatchIgnored&&(be=!1)}if(be){for(;B.endsParent&&B.parent;)B=B.parent;return B}}if(B.endsWithParent)return ee(B.parent,Q,oe)}function le(B){return Ne.matcher.regexIndex===0?(Ue+=B[0],1):(ct=!0,0)}function ne(B){const Q=B[0],oe=B.rule,be=new jT(oe),Oe=[oe.__beforeBegin,oe["on:begin"]];for(const Ye of Oe)if(Ye&&(Ye(B,be),be.isMatchIgnored))return le(Q);return oe.skip?Ue+=Q:(oe.excludeBegin&&(Ue+=Q),ie(),!oe.returnBegin&&!oe.excludeBegin&&(Ue=Q)),ue(oe,B),oe.returnBegin?0:Q.length}function me(B){const Q=B[0],oe=L.substring(B.index),be=ee(Ne,B,oe);if(!be)return $T;const Oe=Ne;Ne.endScope&&Ne.endScope._wrap?(ie(),G(Q,Ne.endScope._wrap)):Ne.endScope&&Ne.endScope._multi?(ie(),re(Ne.endScope,B)):Oe.skip?Ue+=Q:(Oe.returnEnd||Oe.excludeEnd||(Ue+=Q),ie(),Oe.excludeEnd&&(Ue=Q));do Ne.scope&&He.closeNode(),!Ne.skip&&!Ne.subLanguage&&(Et+=Ne.relevance),Ne=Ne.parent;while(Ne!==be.parent);return be.starts&&ue(be.starts,B),Oe.returnEnd?0:Q.length}function ye(){const B=[];for(let Q=Ne;Q!==Ee;Q=Q.parent)Q.scope&&B.unshift(Q.scope);B.forEach(Q=>He.openNode(Q))}let te={};function de(B,Q){const oe=Q&&Q[0];if(Ue+=B,oe==null)return ie(),0;if(te.type==="begin"&&Q.type==="end"&&te.index===Q.index&&oe===""){if(Ue+=L.slice(Q.index,Q.index+1),!s){const be=new Error(`0 width match regex (${T})`);throw be.languageName=T,be.badRule=te.rule,be}return 1}if(te=Q,Q.type==="begin")return ne(Q);if(Q.type==="illegal"&&!R){const be=new Error('Illegal lexeme "'+oe+'" for mode "'+(Ne.scope||"")+'"');throw be.mode=Ne,be}else if(Q.type==="end"){const be=me(Q);if(be!==$T)return be}if(Q.type==="illegal"&&oe==="")return Ue+=` +`,1;if(St>1e5&&St>Q.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Ue+=oe,oe.length}const Ee=S(T);if(!Ee)throw To(i.replace("{}",T)),new Error('Unknown language: "'+T+'"');const Te=LJ(Ee);let Ke="",Ne=F||Te;const it={},He=new o.__emitter(o);ye();let Ue="",Et=0,rt=0,St=0,ct=!1;try{if(Ee.__emitTokens)Ee.__emitTokens(L,He);else{for(Ne.matcher.considerAll();;){St++,ct?ct=!1:Ne.matcher.considerAll(),Ne.matcher.lastIndex=rt;const B=Ne.matcher.exec(L);if(!B)break;const Q=L.substring(rt,B.index),oe=de(Q,B);rt=B.index+oe}de(L.substring(rt))}return He.finalize(),Ke=He.toHTML(),{language:T,value:Ke,relevance:Et,illegal:!1,_emitter:He,_top:Ne}}catch(B){if(B.message&&B.message.includes("Illegal"))return{language:T,value:By(L),illegal:!0,relevance:0,_illegalBy:{message:B.message,index:rt,context:L.slice(rt-100,rt+100),mode:B.mode,resultSoFar:Ke},_emitter:He};if(s)return{language:T,value:By(L),illegal:!1,relevance:0,errorRaised:B,_emitter:He,_top:Ne};throw B}}function h(T){const L={value:By(T),illegal:!1,relevance:0,_top:a,_emitter:new o.__emitter(o)};return L._emitter.addText(T),L}function p(T,L){L=L||o.languages||Object.keys(t);const R=h(T),F=L.filter(S).filter(O).map(ie=>f(ie,T,!1));F.unshift(R);const I=F.sort((ie,G)=>{if(ie.relevance!==G.relevance)return G.relevance-ie.relevance;if(ie.language&&G.language){if(S(ie.language).supersetOf===G.language)return 1;if(S(G.language).supersetOf===ie.language)return-1}return 0}),[V,W]=I,P=V;return P.secondBest=W,P}function m(T,L,R){const F=L&&n[L]||R;T.classList.add("hljs"),T.classList.add(`language-${F}`)}function y(T){let L=null;const R=u(T);if(c(R))return;if(M("before:highlightElement",{el:T,language:R}),T.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",T);return}if(T.children.length>0&&(o.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(T)),o.throwUnescapedHTML))throw new DJ("One of your code blocks includes unescaped HTML.",T.innerHTML);L=T;const F=L.textContent,I=R?d(F,{language:R,ignoreIllegals:!0}):p(F);T.innerHTML=I.value,T.dataset.highlighted="yes",m(T,R,I.language),T.result={language:I.language,re:I.relevance,relevance:I.relevance},I.secondBest&&(T.secondBest={language:I.secondBest.language,relevance:I.secondBest.relevance}),M("after:highlightElement",{el:T,result:I,text:F})}function E(T){o=UT(o,T)}const g=()=>{_(),fl("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function x(){_(),fl("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let b=!1;function _(){function T(){_()}if(document.readyState==="loading"){b||window.addEventListener("DOMContentLoaded",T,!1),b=!0;return}document.querySelectorAll(o.cssSelector).forEach(y)}function k(T,L){let R=null;try{R=L(e)}catch(F){if(To("Language definition for '{}' could not be registered.".replace("{}",T)),s)To(F);else throw F;R=a}R.name||(R.name=T),t[T]=R,R.rawDefinition=L.bind(null,e),R.aliases&&A(R.aliases,{languageName:T})}function N(T){delete t[T];for(const L of Object.keys(n))n[L]===T&&delete n[L]}function C(){return Object.keys(t)}function S(T){return T=(T||"").toLowerCase(),t[T]||t[n[T]]}function A(T,{languageName:L}){typeof T=="string"&&(T=[T]),T.forEach(R=>{n[R.toLowerCase()]=L})}function O(T){const L=S(T);return L&&!L.disableAutodetect}function D(T){T["before:highlightBlock"]&&!T["before:highlightElement"]&&(T["before:highlightElement"]=L=>{T["before:highlightBlock"](Object.assign({block:L.el},L))}),T["after:highlightBlock"]&&!T["after:highlightElement"]&&(T["after:highlightElement"]=L=>{T["after:highlightBlock"](Object.assign({block:L.el},L))})}function U(T){D(T),r.push(T)}function X(T){const L=r.indexOf(T);L!==-1&&r.splice(L,1)}function M(T,L){const R=T;r.forEach(function(F){F[R]&&F[R](L)})}function j(T){return fl("10.7.0","highlightBlock will be removed entirely in v12.0"),fl("10.7.0","Please use highlightElement now."),y(T)}Object.assign(e,{highlight:d,highlightAuto:p,highlightAll:_,highlightElement:y,highlightBlock:j,configure:E,initHighlighting:g,initHighlightingOnLoad:x,registerLanguage:k,unregisterLanguage:N,listLanguages:C,getLanguage:S,registerAliases:A,autoDetection:O,inherit:UT,addPlugin:U,removePlugin:X}),e.debugMode=function(){s=!1},e.safeMode=function(){s=!0},e.versionString=jJ,e.regex={concat:Qo,lookahead:Ej,either:lv,optional:QZ,anyNumberOfTimes:XZ};for(const T in Hh)typeof Hh[T]=="object"&&yj(Hh[T]);return Object.assign(e,Hh),e},Sc=Aj({});Sc.newInstance=()=>Aj({});var BJ=Sc;Sc.HighlightJS=Sc;Sc.default=Sc;const Hr=pf(BJ),HT={},FJ="hljs-";function UJ(e){const t=Hr.newInstance();return e&&i(e),{highlight:n,highlightAuto:r,listLanguages:s,register:i,registerAlias:a,registered:o};function n(c,u,d){const f=d||HT,h=typeof f.prefix=="string"?f.prefix:FJ;if(!t.getLanguage(c))throw new Error("Unknown language: `"+c+"` is not registered");t.configure({__emitter:$J,classPrefix:h});const p=t.highlight(u,{ignoreIllegals:!0,language:c});if(p.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:p.errorRaised});const m=p._emitter.root,y=m.data;return y.language=p.language,y.relevance=p.relevance,m}function r(c,u){const f=(u||HT).subset||s();let h=-1,p=0,m;for(;++hp&&(p=E.data.relevance,m=E)}return m||{type:"root",children:[],data:{language:void 0,relevance:p}}}function s(){return t.listLanguages()}function i(c,u){if(typeof c=="string")t.registerLanguage(c,u);else{let d;for(d in c)Object.hasOwn(c,d)&&t.registerLanguage(d,c[d])}}function a(c,u){if(typeof c=="string")t.registerAliases(typeof u=="string"?u:[...u],{languageName:c});else{let d;for(d in c)if(Object.hasOwn(c,d)){const f=c[d];t.registerAliases(typeof f=="string"?f:[...f],{languageName:d})}}}function o(c){return!!t.getLanguage(c)}}class $J{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],s=t.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:s}):r.children.push(...s)}openNode(t){const n=this,r=t.split(".").map(function(a,o){return o?a+"_".repeat(o):n.options.classPrefix+a}),s=this.stack[this.stack.length-1],i={type:"element",tagName:"span",properties:{className:r},children:[]};s.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const HJ={};function zT(e){const t=e||HJ,n=t.aliases,r=t.detect||!1,s=t.languages||KZ,i=t.plainText,a=t.prefix,o=t.subset;let c="hljs";const u=UJ(s);if(n&&u.registerAlias(n),a){const d=a.indexOf("-");c=d===-1?a:a.slice(0,d)}return function(d,f){If(d,"element",function(h,p,m){if(h.tagName!=="code"||!m||m.type!=="element"||m.tagName!=="pre")return;const y=zJ(h);if(y===!1||!y&&!r||y&&i&&i.includes(y))return;Array.isArray(h.properties.className)||(h.properties.className=[]),h.properties.className.includes(c)||h.properties.className.unshift(c);const E=SQ(h,{whitespace:"pre"});let g;try{g=y?u.highlight(y,E,{prefix:a}):u.highlightAuto(E,{prefix:a,subset:o})}catch(x){const b=x;if(y&&/Unknown language/.test(b.message)){f.message("Cannot highlight as `"+y+"`, it’s not registered",{ancestors:[m,h],cause:b,place:h.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw b}!y&&g.data&&g.data.language&&h.properties.className.push("language-"+g.data.language),g.children.length>0&&(h.children=g.children)})}}function zJ(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let r;for(;++n-1&&i<=t.length){let a=0;for(;;){let o=n[a];if(o===void 0){const c=YT(t,n[a-1]);o=c===-1?t.length+1:c+1,n[a]=o}if(o>i)return{line:a+1,column:i-(a>0?n[a-1]:0)+1,offset:i};a++}}}function s(i){if(i&&typeof i.line=="number"&&typeof i.column=="number"&&!Number.isNaN(i.line)&&!Number.isNaN(i.column)){for(;n.length1?n[i.line-2]:0)+i.column-1;if(a=55296&&e<=57343}function mee(e){return e>=56320&&e<=57343}function gee(e,t){return(e-55296)*1024+9216+t}function Mj(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function jj(e){return e>=64976&&e<=65007||pee.has(e)}var ce;(function(e){e.controlCharacterInInputStream="control-character-in-input-stream",e.noncharacterInInputStream="noncharacter-in-input-stream",e.surrogateInInputStream="surrogate-in-input-stream",e.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",e.endTagWithAttributes="end-tag-with-attributes",e.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",e.unexpectedSolidusInTag="unexpected-solidus-in-tag",e.unexpectedNullCharacter="unexpected-null-character",e.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",e.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",e.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",e.missingEndTagName="missing-end-tag-name",e.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",e.unknownNamedCharacterReference="unknown-named-character-reference",e.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",e.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",e.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",e.eofBeforeTagName="eof-before-tag-name",e.eofInTag="eof-in-tag",e.missingAttributeValue="missing-attribute-value",e.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",e.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",e.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",e.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",e.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",e.missingDoctypePublicIdentifier="missing-doctype-public-identifier",e.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",e.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",e.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",e.cdataInHtmlContent="cdata-in-html-content",e.incorrectlyOpenedComment="incorrectly-opened-comment",e.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",e.eofInDoctype="eof-in-doctype",e.nestedComment="nested-comment",e.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",e.eofInComment="eof-in-comment",e.incorrectlyClosedComment="incorrectly-closed-comment",e.eofInCdata="eof-in-cdata",e.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",e.nullCharacterReference="null-character-reference",e.surrogateCharacterReference="surrogate-character-reference",e.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",e.controlCharacterReference="control-character-reference",e.noncharacterCharacterReference="noncharacter-character-reference",e.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",e.missingDoctypeName="missing-doctype-name",e.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",e.duplicateAttribute="duplicate-attribute",e.nonConformingDoctype="non-conforming-doctype",e.missingDoctype="missing-doctype",e.misplacedDoctype="misplaced-doctype",e.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",e.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",e.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",e.openElementsLeftAfterEof="open-elements-left-after-eof",e.abandonedHeadElementChild="abandoned-head-element-child",e.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",e.nestedNoscriptInHead="nested-noscript-in-head",e.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(ce||(ce={}));const yee=65536;class bee{constructor(t){this.handler=t,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=yee,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(t,n){const{line:r,col:s,offset:i}=this,a=s+n,o=i+n;return{code:t,startLine:r,endLine:r,startCol:a,endCol:a,startOffset:o,endOffset:o}}_err(t){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(t,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(t){if(this.pos!==this.html.length-1){const n=this.html.charCodeAt(this.pos+1);if(mee(n))return this.pos++,this._addGap(),gee(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,H.EOF;return this._err(ce.surrogateInInputStream),t}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(t,n){this.html.length>0?this.html+=t:this.html=t,this.endOfChunkHit=!1,this.lastChunkWritten=n}insertHtmlAtCurrentPos(t){this.html=this.html.substring(0,this.pos+1)+t+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(t,n){if(this.pos+t.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(n)return this.html.startsWith(t,this.pos);for(let r=0;r=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,H.EOF;const r=this.html.charCodeAt(n);return r===H.CARRIAGE_RETURN?H.LINE_FEED:r}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,H.EOF;let t=this.html.charCodeAt(this.pos);return t===H.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,H.LINE_FEED):t===H.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,Lj(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===H.LINE_FEED||t===H.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){Mj(t)?this._err(ce.controlCharacterInInputStream):jj(t)&&this._err(ce.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.pos=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}const Eee=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(e=>e.charCodeAt(0))),xee=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function wee(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=xee.get(e))!==null&&t!==void 0?t:e}var Gn;(function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"})(Gn||(Gn={}));const vee=32;var Sa;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(Sa||(Sa={}));function mE(e){return e>=Gn.ZERO&&e<=Gn.NINE}function _ee(e){return e>=Gn.UPPER_A&&e<=Gn.UPPER_F||e>=Gn.LOWER_A&&e<=Gn.LOWER_F}function kee(e){return e>=Gn.UPPER_A&&e<=Gn.UPPER_Z||e>=Gn.LOWER_A&&e<=Gn.LOWER_Z||mE(e)}function Nee(e){return e===Gn.EQUALS||kee(e)}var Yn;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(Yn||(Yn={}));var Ui;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(Ui||(Ui={}));class See{constructor(t,n,r){this.decodeTree=t,this.emitCodePoint=n,this.errors=r,this.state=Yn.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Ui.Strict}startEntity(t){this.decodeMode=t,this.state=Yn.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case Yn.EntityStart:return t.charCodeAt(n)===Gn.NUM?(this.state=Yn.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=Yn.NamedEntity,this.stateNamedEntity(t,n));case Yn.NumericStart:return this.stateNumericStart(t,n);case Yn.NumericDecimal:return this.stateNumericDecimal(t,n);case Yn.NumericHex:return this.stateNumericHex(t,n);case Yn.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|vee)===Gn.LOWER_X?(this.state=Yn.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=Yn.NumericDecimal,this.stateNumericDecimal(t,n))}addToNumericResult(t,n,r,s){if(n!==r){const i=r-n;this.result=this.result*Math.pow(s,i)+Number.parseInt(t.substr(n,i),s),this.consumed+=i}}stateNumericHex(t,n){const r=n;for(;n>14;for(;n>14,i!==0){if(a===Gn.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==Ui.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;const{result:n,decodeTree:r}=this,s=(r[n]&Sa.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,s,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,r){const{decodeTree:s}=this;return this.emitCodePoint(n===1?s[t]&~Sa.VALUE_LENGTH:s[t+1],r),n===3&&this.emitCodePoint(s[t+2],r),r}end(){var t;switch(this.state){case Yn.NamedEntity:return this.result!==0&&(this.decodeMode!==Ui.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Yn.NumericDecimal:return this.emitNumericEntity(0,2);case Yn.NumericHex:return this.emitNumericEntity(0,3);case Yn.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Yn.EntityStart:return 0}}}function Tee(e,t,n,r){const s=(t&Sa.BRANCH_LENGTH)>>7,i=t&Sa.JUMP_TABLE;if(s===0)return i!==0&&r===i?n:-1;if(i){const c=r-i;return c<0||c>=s?-1:e[n+c]-1}let a=n,o=a+s-1;for(;a<=o;){const c=a+o>>>1,u=e[c];if(ur)o=c-1;else return e[c+s]}return-1}var xe;(function(e){e.HTML="http://www.w3.org/1999/xhtml",e.MATHML="http://www.w3.org/1998/Math/MathML",e.SVG="http://www.w3.org/2000/svg",e.XLINK="http://www.w3.org/1999/xlink",e.XML="http://www.w3.org/XML/1998/namespace",e.XMLNS="http://www.w3.org/2000/xmlns/"})(xe||(xe={}));var Ao;(function(e){e.TYPE="type",e.ACTION="action",e.ENCODING="encoding",e.PROMPT="prompt",e.NAME="name",e.COLOR="color",e.FACE="face",e.SIZE="size"})(Ao||(Ao={}));var bs;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(bs||(bs={}));var se;(function(e){e.A="a",e.ADDRESS="address",e.ANNOTATION_XML="annotation-xml",e.APPLET="applet",e.AREA="area",e.ARTICLE="article",e.ASIDE="aside",e.B="b",e.BASE="base",e.BASEFONT="basefont",e.BGSOUND="bgsound",e.BIG="big",e.BLOCKQUOTE="blockquote",e.BODY="body",e.BR="br",e.BUTTON="button",e.CAPTION="caption",e.CENTER="center",e.CODE="code",e.COL="col",e.COLGROUP="colgroup",e.DD="dd",e.DESC="desc",e.DETAILS="details",e.DIALOG="dialog",e.DIR="dir",e.DIV="div",e.DL="dl",e.DT="dt",e.EM="em",e.EMBED="embed",e.FIELDSET="fieldset",e.FIGCAPTION="figcaption",e.FIGURE="figure",e.FONT="font",e.FOOTER="footer",e.FOREIGN_OBJECT="foreignObject",e.FORM="form",e.FRAME="frame",e.FRAMESET="frameset",e.H1="h1",e.H2="h2",e.H3="h3",e.H4="h4",e.H5="h5",e.H6="h6",e.HEAD="head",e.HEADER="header",e.HGROUP="hgroup",e.HR="hr",e.HTML="html",e.I="i",e.IMG="img",e.IMAGE="image",e.INPUT="input",e.IFRAME="iframe",e.KEYGEN="keygen",e.LABEL="label",e.LI="li",e.LINK="link",e.LISTING="listing",e.MAIN="main",e.MALIGNMARK="malignmark",e.MARQUEE="marquee",e.MATH="math",e.MENU="menu",e.META="meta",e.MGLYPH="mglyph",e.MI="mi",e.MO="mo",e.MN="mn",e.MS="ms",e.MTEXT="mtext",e.NAV="nav",e.NOBR="nobr",e.NOFRAMES="noframes",e.NOEMBED="noembed",e.NOSCRIPT="noscript",e.OBJECT="object",e.OL="ol",e.OPTGROUP="optgroup",e.OPTION="option",e.P="p",e.PARAM="param",e.PLAINTEXT="plaintext",e.PRE="pre",e.RB="rb",e.RP="rp",e.RT="rt",e.RTC="rtc",e.RUBY="ruby",e.S="s",e.SCRIPT="script",e.SEARCH="search",e.SECTION="section",e.SELECT="select",e.SOURCE="source",e.SMALL="small",e.SPAN="span",e.STRIKE="strike",e.STRONG="strong",e.STYLE="style",e.SUB="sub",e.SUMMARY="summary",e.SUP="sup",e.TABLE="table",e.TBODY="tbody",e.TEMPLATE="template",e.TEXTAREA="textarea",e.TFOOT="tfoot",e.TD="td",e.TH="th",e.THEAD="thead",e.TITLE="title",e.TR="tr",e.TRACK="track",e.TT="tt",e.U="u",e.UL="ul",e.SVG="svg",e.VAR="var",e.WBR="wbr",e.XMP="xmp"})(se||(se={}));var v;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.A=1]="A",e[e.ADDRESS=2]="ADDRESS",e[e.ANNOTATION_XML=3]="ANNOTATION_XML",e[e.APPLET=4]="APPLET",e[e.AREA=5]="AREA",e[e.ARTICLE=6]="ARTICLE",e[e.ASIDE=7]="ASIDE",e[e.B=8]="B",e[e.BASE=9]="BASE",e[e.BASEFONT=10]="BASEFONT",e[e.BGSOUND=11]="BGSOUND",e[e.BIG=12]="BIG",e[e.BLOCKQUOTE=13]="BLOCKQUOTE",e[e.BODY=14]="BODY",e[e.BR=15]="BR",e[e.BUTTON=16]="BUTTON",e[e.CAPTION=17]="CAPTION",e[e.CENTER=18]="CENTER",e[e.CODE=19]="CODE",e[e.COL=20]="COL",e[e.COLGROUP=21]="COLGROUP",e[e.DD=22]="DD",e[e.DESC=23]="DESC",e[e.DETAILS=24]="DETAILS",e[e.DIALOG=25]="DIALOG",e[e.DIR=26]="DIR",e[e.DIV=27]="DIV",e[e.DL=28]="DL",e[e.DT=29]="DT",e[e.EM=30]="EM",e[e.EMBED=31]="EMBED",e[e.FIELDSET=32]="FIELDSET",e[e.FIGCAPTION=33]="FIGCAPTION",e[e.FIGURE=34]="FIGURE",e[e.FONT=35]="FONT",e[e.FOOTER=36]="FOOTER",e[e.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",e[e.FORM=38]="FORM",e[e.FRAME=39]="FRAME",e[e.FRAMESET=40]="FRAMESET",e[e.H1=41]="H1",e[e.H2=42]="H2",e[e.H3=43]="H3",e[e.H4=44]="H4",e[e.H5=45]="H5",e[e.H6=46]="H6",e[e.HEAD=47]="HEAD",e[e.HEADER=48]="HEADER",e[e.HGROUP=49]="HGROUP",e[e.HR=50]="HR",e[e.HTML=51]="HTML",e[e.I=52]="I",e[e.IMG=53]="IMG",e[e.IMAGE=54]="IMAGE",e[e.INPUT=55]="INPUT",e[e.IFRAME=56]="IFRAME",e[e.KEYGEN=57]="KEYGEN",e[e.LABEL=58]="LABEL",e[e.LI=59]="LI",e[e.LINK=60]="LINK",e[e.LISTING=61]="LISTING",e[e.MAIN=62]="MAIN",e[e.MALIGNMARK=63]="MALIGNMARK",e[e.MARQUEE=64]="MARQUEE",e[e.MATH=65]="MATH",e[e.MENU=66]="MENU",e[e.META=67]="META",e[e.MGLYPH=68]="MGLYPH",e[e.MI=69]="MI",e[e.MO=70]="MO",e[e.MN=71]="MN",e[e.MS=72]="MS",e[e.MTEXT=73]="MTEXT",e[e.NAV=74]="NAV",e[e.NOBR=75]="NOBR",e[e.NOFRAMES=76]="NOFRAMES",e[e.NOEMBED=77]="NOEMBED",e[e.NOSCRIPT=78]="NOSCRIPT",e[e.OBJECT=79]="OBJECT",e[e.OL=80]="OL",e[e.OPTGROUP=81]="OPTGROUP",e[e.OPTION=82]="OPTION",e[e.P=83]="P",e[e.PARAM=84]="PARAM",e[e.PLAINTEXT=85]="PLAINTEXT",e[e.PRE=86]="PRE",e[e.RB=87]="RB",e[e.RP=88]="RP",e[e.RT=89]="RT",e[e.RTC=90]="RTC",e[e.RUBY=91]="RUBY",e[e.S=92]="S",e[e.SCRIPT=93]="SCRIPT",e[e.SEARCH=94]="SEARCH",e[e.SECTION=95]="SECTION",e[e.SELECT=96]="SELECT",e[e.SOURCE=97]="SOURCE",e[e.SMALL=98]="SMALL",e[e.SPAN=99]="SPAN",e[e.STRIKE=100]="STRIKE",e[e.STRONG=101]="STRONG",e[e.STYLE=102]="STYLE",e[e.SUB=103]="SUB",e[e.SUMMARY=104]="SUMMARY",e[e.SUP=105]="SUP",e[e.TABLE=106]="TABLE",e[e.TBODY=107]="TBODY",e[e.TEMPLATE=108]="TEMPLATE",e[e.TEXTAREA=109]="TEXTAREA",e[e.TFOOT=110]="TFOOT",e[e.TD=111]="TD",e[e.TH=112]="TH",e[e.THEAD=113]="THEAD",e[e.TITLE=114]="TITLE",e[e.TR=115]="TR",e[e.TRACK=116]="TRACK",e[e.TT=117]="TT",e[e.U=118]="U",e[e.UL=119]="UL",e[e.SVG=120]="SVG",e[e.VAR=121]="VAR",e[e.WBR=122]="WBR",e[e.XMP=123]="XMP"})(v||(v={}));const Aee=new Map([[se.A,v.A],[se.ADDRESS,v.ADDRESS],[se.ANNOTATION_XML,v.ANNOTATION_XML],[se.APPLET,v.APPLET],[se.AREA,v.AREA],[se.ARTICLE,v.ARTICLE],[se.ASIDE,v.ASIDE],[se.B,v.B],[se.BASE,v.BASE],[se.BASEFONT,v.BASEFONT],[se.BGSOUND,v.BGSOUND],[se.BIG,v.BIG],[se.BLOCKQUOTE,v.BLOCKQUOTE],[se.BODY,v.BODY],[se.BR,v.BR],[se.BUTTON,v.BUTTON],[se.CAPTION,v.CAPTION],[se.CENTER,v.CENTER],[se.CODE,v.CODE],[se.COL,v.COL],[se.COLGROUP,v.COLGROUP],[se.DD,v.DD],[se.DESC,v.DESC],[se.DETAILS,v.DETAILS],[se.DIALOG,v.DIALOG],[se.DIR,v.DIR],[se.DIV,v.DIV],[se.DL,v.DL],[se.DT,v.DT],[se.EM,v.EM],[se.EMBED,v.EMBED],[se.FIELDSET,v.FIELDSET],[se.FIGCAPTION,v.FIGCAPTION],[se.FIGURE,v.FIGURE],[se.FONT,v.FONT],[se.FOOTER,v.FOOTER],[se.FOREIGN_OBJECT,v.FOREIGN_OBJECT],[se.FORM,v.FORM],[se.FRAME,v.FRAME],[se.FRAMESET,v.FRAMESET],[se.H1,v.H1],[se.H2,v.H2],[se.H3,v.H3],[se.H4,v.H4],[se.H5,v.H5],[se.H6,v.H6],[se.HEAD,v.HEAD],[se.HEADER,v.HEADER],[se.HGROUP,v.HGROUP],[se.HR,v.HR],[se.HTML,v.HTML],[se.I,v.I],[se.IMG,v.IMG],[se.IMAGE,v.IMAGE],[se.INPUT,v.INPUT],[se.IFRAME,v.IFRAME],[se.KEYGEN,v.KEYGEN],[se.LABEL,v.LABEL],[se.LI,v.LI],[se.LINK,v.LINK],[se.LISTING,v.LISTING],[se.MAIN,v.MAIN],[se.MALIGNMARK,v.MALIGNMARK],[se.MARQUEE,v.MARQUEE],[se.MATH,v.MATH],[se.MENU,v.MENU],[se.META,v.META],[se.MGLYPH,v.MGLYPH],[se.MI,v.MI],[se.MO,v.MO],[se.MN,v.MN],[se.MS,v.MS],[se.MTEXT,v.MTEXT],[se.NAV,v.NAV],[se.NOBR,v.NOBR],[se.NOFRAMES,v.NOFRAMES],[se.NOEMBED,v.NOEMBED],[se.NOSCRIPT,v.NOSCRIPT],[se.OBJECT,v.OBJECT],[se.OL,v.OL],[se.OPTGROUP,v.OPTGROUP],[se.OPTION,v.OPTION],[se.P,v.P],[se.PARAM,v.PARAM],[se.PLAINTEXT,v.PLAINTEXT],[se.PRE,v.PRE],[se.RB,v.RB],[se.RP,v.RP],[se.RT,v.RT],[se.RTC,v.RTC],[se.RUBY,v.RUBY],[se.S,v.S],[se.SCRIPT,v.SCRIPT],[se.SEARCH,v.SEARCH],[se.SECTION,v.SECTION],[se.SELECT,v.SELECT],[se.SOURCE,v.SOURCE],[se.SMALL,v.SMALL],[se.SPAN,v.SPAN],[se.STRIKE,v.STRIKE],[se.STRONG,v.STRONG],[se.STYLE,v.STYLE],[se.SUB,v.SUB],[se.SUMMARY,v.SUMMARY],[se.SUP,v.SUP],[se.TABLE,v.TABLE],[se.TBODY,v.TBODY],[se.TEMPLATE,v.TEMPLATE],[se.TEXTAREA,v.TEXTAREA],[se.TFOOT,v.TFOOT],[se.TD,v.TD],[se.TH,v.TH],[se.THEAD,v.THEAD],[se.TITLE,v.TITLE],[se.TR,v.TR],[se.TRACK,v.TRACK],[se.TT,v.TT],[se.U,v.U],[se.UL,v.UL],[se.SVG,v.SVG],[se.VAR,v.VAR],[se.WBR,v.WBR],[se.XMP,v.XMP]]);function Xc(e){var t;return(t=Aee.get(e))!==null&&t!==void 0?t:v.UNKNOWN}const ke=v,Cee={[xe.HTML]:new Set([ke.ADDRESS,ke.APPLET,ke.AREA,ke.ARTICLE,ke.ASIDE,ke.BASE,ke.BASEFONT,ke.BGSOUND,ke.BLOCKQUOTE,ke.BODY,ke.BR,ke.BUTTON,ke.CAPTION,ke.CENTER,ke.COL,ke.COLGROUP,ke.DD,ke.DETAILS,ke.DIR,ke.DIV,ke.DL,ke.DT,ke.EMBED,ke.FIELDSET,ke.FIGCAPTION,ke.FIGURE,ke.FOOTER,ke.FORM,ke.FRAME,ke.FRAMESET,ke.H1,ke.H2,ke.H3,ke.H4,ke.H5,ke.H6,ke.HEAD,ke.HEADER,ke.HGROUP,ke.HR,ke.HTML,ke.IFRAME,ke.IMG,ke.INPUT,ke.LI,ke.LINK,ke.LISTING,ke.MAIN,ke.MARQUEE,ke.MENU,ke.META,ke.NAV,ke.NOEMBED,ke.NOFRAMES,ke.NOSCRIPT,ke.OBJECT,ke.OL,ke.P,ke.PARAM,ke.PLAINTEXT,ke.PRE,ke.SCRIPT,ke.SECTION,ke.SELECT,ke.SOURCE,ke.STYLE,ke.SUMMARY,ke.TABLE,ke.TBODY,ke.TD,ke.TEMPLATE,ke.TEXTAREA,ke.TFOOT,ke.TH,ke.THEAD,ke.TITLE,ke.TR,ke.TRACK,ke.UL,ke.WBR,ke.XMP]),[xe.MATHML]:new Set([ke.MI,ke.MO,ke.MN,ke.MS,ke.MTEXT,ke.ANNOTATION_XML]),[xe.SVG]:new Set([ke.TITLE,ke.FOREIGN_OBJECT,ke.DESC]),[xe.XLINK]:new Set,[xe.XML]:new Set,[xe.XMLNS]:new Set},gE=new Set([ke.H1,ke.H2,ke.H3,ke.H4,ke.H5,ke.H6]);se.STYLE,se.SCRIPT,se.XMP,se.IFRAME,se.NOEMBED,se.NOFRAMES,se.PLAINTEXT;var z;(function(e){e[e.DATA=0]="DATA",e[e.RCDATA=1]="RCDATA",e[e.RAWTEXT=2]="RAWTEXT",e[e.SCRIPT_DATA=3]="SCRIPT_DATA",e[e.PLAINTEXT=4]="PLAINTEXT",e[e.TAG_OPEN=5]="TAG_OPEN",e[e.END_TAG_OPEN=6]="END_TAG_OPEN",e[e.TAG_NAME=7]="TAG_NAME",e[e.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",e[e.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",e[e.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",e[e.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",e[e.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",e[e.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",e[e.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",e[e.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",e[e.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",e[e.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",e[e.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",e[e.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",e[e.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",e[e.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",e[e.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",e[e.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",e[e.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",e[e.BOGUS_COMMENT=40]="BOGUS_COMMENT",e[e.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",e[e.COMMENT_START=42]="COMMENT_START",e[e.COMMENT_START_DASH=43]="COMMENT_START_DASH",e[e.COMMENT=44]="COMMENT",e[e.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",e[e.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",e[e.COMMENT_END_DASH=49]="COMMENT_END_DASH",e[e.COMMENT_END=50]="COMMENT_END",e[e.COMMENT_END_BANG=51]="COMMENT_END_BANG",e[e.DOCTYPE=52]="DOCTYPE",e[e.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",e[e.DOCTYPE_NAME=54]="DOCTYPE_NAME",e[e.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",e[e.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",e[e.CDATA_SECTION=68]="CDATA_SECTION",e[e.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",e[e.CDATA_SECTION_END=70]="CDATA_SECTION_END",e[e.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",e[e.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(z||(z={}));const vn={DATA:z.DATA,RCDATA:z.RCDATA,RAWTEXT:z.RAWTEXT,SCRIPT_DATA:z.SCRIPT_DATA,PLAINTEXT:z.PLAINTEXT,CDATA_SECTION:z.CDATA_SECTION};function Iee(e){return e>=H.DIGIT_0&&e<=H.DIGIT_9}function Uu(e){return e>=H.LATIN_CAPITAL_A&&e<=H.LATIN_CAPITAL_Z}function Oee(e){return e>=H.LATIN_SMALL_A&&e<=H.LATIN_SMALL_Z}function pa(e){return Oee(e)||Uu(e)}function GT(e){return pa(e)||Iee(e)}function zh(e){return e+32}function Pj(e){return e===H.SPACE||e===H.LINE_FEED||e===H.TABULATION||e===H.FORM_FEED}function qT(e){return Pj(e)||e===H.SOLIDUS||e===H.GREATER_THAN_SIGN}function Ree(e){return e===H.NULL?ce.nullCharacterReference:e>1114111?ce.characterReferenceOutsideUnicodeRange:Lj(e)?ce.surrogateCharacterReference:jj(e)?ce.noncharacterCharacterReference:Mj(e)||e===H.CARRIAGE_RETURN?ce.controlCharacterReference:null}class Lee{constructor(t,n){this.options=t,this.handler=n,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=z.DATA,this.returnState=z.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new bee(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new See(Eee,(r,s)=>{this.preprocessor.pos=this.entityStartPos+s-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(ce.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(ce.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const s=Ree(r);s&&this._err(s,1)}}:void 0)}_err(t,n=0){var r,s;(s=(r=this.handler).onParseError)===null||s===void 0||s.call(r,this.preprocessor.getError(t,n))}getCurrentLocation(t){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-t,startOffset:this.preprocessor.offset-t,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const t=this._consume();this._ensureHibernation()||this._callState(t)}this.inLoop=!1}}pause(){this.paused=!0}resume(t){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||t==null||t())}write(t,n,r){this.active=!0,this.preprocessor.write(t,n),this._runParsingLoop(),this.paused||r==null||r()}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(t){this.consumedAfterSnapshot+=t;for(let n=0;n0&&this._err(ce.endTagWithAttributes),t.selfClosing&&this._err(ce.endTagWithTrailingSolidus),this.handler.onEndTag(t)),this.preprocessor.dropParsedChunk()}emitCurrentComment(t){this.prepareToken(t),this.handler.onComment(t),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(t){this.prepareToken(t),this.handler.onDoctype(t),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(t){if(this.currentCharacterToken){switch(t&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=t.startLine,this.currentCharacterToken.location.endCol=t.startCol,this.currentCharacterToken.location.endOffset=t.startOffset),this.currentCharacterToken.type){case mt.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case mt.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case mt.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){const t=this.getCurrentLocation(0);t&&(t.endLine=t.startLine,t.endCol=t.startCol,t.endOffset=t.startOffset),this._emitCurrentCharacterToken(t),this.handler.onEof({type:mt.EOF,location:t}),this.active=!1}_appendCharToCurrentCharacterToken(t,n){if(this.currentCharacterToken)if(this.currentCharacterToken.type===t){this.currentCharacterToken.chars+=n;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(t,n)}_emitCodePoint(t){const n=Pj(t)?mt.WHITESPACE_CHARACTER:t===H.NULL?mt.NULL_CHARACTER:mt.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(mt.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=z.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Ui.Attribute:Ui.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===z.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===z.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===z.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case z.DATA:{this._stateData(t);break}case z.RCDATA:{this._stateRcdata(t);break}case z.RAWTEXT:{this._stateRawtext(t);break}case z.SCRIPT_DATA:{this._stateScriptData(t);break}case z.PLAINTEXT:{this._statePlaintext(t);break}case z.TAG_OPEN:{this._stateTagOpen(t);break}case z.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case z.TAG_NAME:{this._stateTagName(t);break}case z.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case z.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case z.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case z.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case z.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case z.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case z.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case z.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case z.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case z.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case z.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case z.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case z.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case z.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case z.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case z.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case z.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case z.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case z.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case z.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case z.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case z.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case z.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case z.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case z.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case z.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case z.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case z.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case z.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case z.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case z.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case z.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case z.BOGUS_COMMENT:{this._stateBogusComment(t);break}case z.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case z.COMMENT_START:{this._stateCommentStart(t);break}case z.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case z.COMMENT:{this._stateComment(t);break}case z.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case z.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case z.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case z.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case z.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case z.COMMENT_END:{this._stateCommentEnd(t);break}case z.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case z.DOCTYPE:{this._stateDoctype(t);break}case z.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case z.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case z.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case z.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case z.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case z.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case z.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case z.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case z.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case z.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case z.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case z.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case z.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case z.CDATA_SECTION:{this._stateCdataSection(t);break}case z.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case z.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case z.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case z.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case H.LESS_THAN_SIGN:{this.state=z.TAG_OPEN;break}case H.AMPERSAND:{this._startCharacterReference();break}case H.NULL:{this._err(ce.unexpectedNullCharacter),this._emitCodePoint(t);break}case H.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case H.AMPERSAND:{this._startCharacterReference();break}case H.LESS_THAN_SIGN:{this.state=z.RCDATA_LESS_THAN_SIGN;break}case H.NULL:{this._err(ce.unexpectedNullCharacter),this._emitChars(Qt);break}case H.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case H.LESS_THAN_SIGN:{this.state=z.RAWTEXT_LESS_THAN_SIGN;break}case H.NULL:{this._err(ce.unexpectedNullCharacter),this._emitChars(Qt);break}case H.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case H.LESS_THAN_SIGN:{this.state=z.SCRIPT_DATA_LESS_THAN_SIGN;break}case H.NULL:{this._err(ce.unexpectedNullCharacter),this._emitChars(Qt);break}case H.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case H.NULL:{this._err(ce.unexpectedNullCharacter),this._emitChars(Qt);break}case H.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(pa(t))this._createStartTagToken(),this.state=z.TAG_NAME,this._stateTagName(t);else switch(t){case H.EXCLAMATION_MARK:{this.state=z.MARKUP_DECLARATION_OPEN;break}case H.SOLIDUS:{this.state=z.END_TAG_OPEN;break}case H.QUESTION_MARK:{this._err(ce.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=z.BOGUS_COMMENT,this._stateBogusComment(t);break}case H.EOF:{this._err(ce.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(ce.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=z.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(pa(t))this._createEndTagToken(),this.state=z.TAG_NAME,this._stateTagName(t);else switch(t){case H.GREATER_THAN_SIGN:{this._err(ce.missingEndTagName),this.state=z.DATA;break}case H.EOF:{this._err(ce.eofBeforeTagName),this._emitChars("");break}case H.NULL:{this._err(ce.unexpectedNullCharacter),this.state=z.SCRIPT_DATA_ESCAPED,this._emitChars(Qt);break}case H.EOF:{this._err(ce.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=z.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===H.SOLIDUS?this.state=z.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:pa(t)?(this._emitChars("<"),this.state=z.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=z.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){pa(t)?(this.state=z.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("");break}case H.NULL:{this._err(ce.unexpectedNullCharacter),this.state=z.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(Qt);break}case H.EOF:{this._err(ce.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=z.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===H.SOLIDUS?(this.state=z.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=z.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(Mr.SCRIPT,!1)&&qT(this.preprocessor.peek(Mr.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!0)}replace(t,n){const r=this._indexOf(t);this.items[r]=n,r===this.stackTop&&(this.current=n)}insertAfter(t,n,r){const s=this._indexOf(t)+1;this.items.splice(s,0,n),this.tagIDs.splice(s,0,r),this.stackTop++,s===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,s===this.stackTop)}popUntilTagNamePopped(t){let n=this.stackTop+1;do n=this.tagIDs.lastIndexOf(t,n-1);while(n>0&&this.treeAdapter.getNamespaceURI(this.items[n])!==xe.HTML);this.shortenToLength(Math.max(n,0))}shortenToLength(t){for(;this.stackTop>=t;){const n=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(n,this.stackTop=0;r--)if(t.has(this.tagIDs[r])&&this.treeAdapter.getNamespaceURI(this.items[r])===n)return r;return-1}clearBackTo(t,n){const r=this._indexOfTagNames(t,n);this.shortenToLength(r+1)}clearBackToTableContext(){this.clearBackTo(Bee,xe.HTML)}clearBackToTableBodyContext(){this.clearBackTo(Pee,xe.HTML)}clearBackToTableRowContext(){this.clearBackTo(Dee,xe.HTML)}remove(t){const n=this._indexOf(t);n>=0&&(n===this.stackTop?this.pop():(this.items.splice(n,1),this.tagIDs.splice(n,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===v.BODY?this.items[1]:null}contains(t){return this._indexOf(t)>-1}getCommonAncestor(t){const n=this._indexOf(t)-1;return n>=0?this.items[n]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===v.HTML}hasInDynamicScope(t,n){for(let r=this.stackTop;r>=0;r--){const s=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case xe.HTML:{if(s===t)return!0;if(n.has(s))return!1;break}case xe.SVG:{if(ZT.has(s))return!1;break}case xe.MATHML:{if(QT.has(s))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,Lm)}hasInListItemScope(t){return this.hasInDynamicScope(t,Mee)}hasInButtonScope(t){return this.hasInDynamicScope(t,jee)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const n=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case xe.HTML:{if(gE.has(n))return!0;if(Lm.has(n))return!1;break}case xe.SVG:{if(ZT.has(n))return!1;break}case xe.MATHML:{if(QT.has(n))return!1;break}}}return!0}hasInTableScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===xe.HTML)switch(this.tagIDs[n]){case t:return!0;case v.TABLE:case v.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===xe.HTML)switch(this.tagIDs[t]){case v.TBODY:case v.THEAD:case v.TFOOT:return!0;case v.TABLE:case v.HTML:return!1}return!0}hasInSelectScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===xe.HTML)switch(this.tagIDs[n]){case t:return!0;case v.OPTION:case v.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&Bj.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&XT.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&XT.has(this.currentTagId);)this.pop()}}const Fy=3;var di;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(di||(di={}));const JT={type:di.Marker};class $ee{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){const r=[],s=n.length,i=this.treeAdapter.getTagName(t),a=this.treeAdapter.getNamespaceURI(t);for(let o=0;o[a.name,a.value]));let i=0;for(let a=0;as.get(c.name)===c.value)&&(i+=1,i>=Fy&&this.entries.splice(o.idx,1))}}insertMarker(){this.entries.unshift(JT)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:di.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:di.Element,element:t,token:n})}removeEntry(t){const n=this.entries.indexOf(t);n!==-1&&this.entries.splice(n,1)}clearToLastMarker(){const t=this.entries.indexOf(JT);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(r=>r.type===di.Marker||this.treeAdapter.getTagName(r.element)===t);return n&&n.type===di.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===di.Element&&n.element===t)}}const ma={createDocument(){return{nodeName:"#document",mode:bs.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:"#comment",data:e,parentNode:null}},createTextNode(e){return{nodeName:"#text",value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){const r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,r){const s=e.childNodes.find(i=>i.nodeName==="#documentType");if(s)s.name=t,s.publicId=n,s.systemId=r;else{const i={nodeName:"#documentType",name:t,publicId:n,systemId:r,parentNode:null};ma.appendChild(e,i)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){const t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){const n=e.childNodes[e.childNodes.length-1];if(ma.isTextNode(n)){n.value+=t;return}}ma.appendChild(e,ma.createTextNode(t))},insertTextBefore(e,t,n){const r=e.childNodes[e.childNodes.indexOf(n)-1];r&&ma.isTextNode(r)?r.value+=t:ma.insertBefore(e,ma.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(r=>r.name));for(let r=0;re.startsWith(n))}function Wee(e){return e.name===Fj&&e.publicId===null&&(e.systemId===null||e.systemId===Hee)}function Gee(e){if(e.name!==Fj)return bs.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===zee)return bs.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),Kee.has(n))return bs.QUIRKS;let r=t===null?Vee:Uj;if(e2(n,r))return bs.QUIRKS;if(r=t===null?$j:Yee,e2(n,r))return bs.LIMITED_QUIRKS}return bs.NO_QUIRKS}const t2={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},qee="definitionurl",Xee="definitionURL",Qee=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(e=>[e.toLowerCase(),e])),Zee=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:xe.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:xe.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:xe.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:xe.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:xe.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:xe.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:xe.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:xe.XML}],["xml:space",{prefix:"xml",name:"space",namespace:xe.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:xe.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:xe.XMLNS}]]),Jee=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(e=>[e.toLowerCase(),e])),ete=new Set([v.B,v.BIG,v.BLOCKQUOTE,v.BODY,v.BR,v.CENTER,v.CODE,v.DD,v.DIV,v.DL,v.DT,v.EM,v.EMBED,v.H1,v.H2,v.H3,v.H4,v.H5,v.H6,v.HEAD,v.HR,v.I,v.IMG,v.LI,v.LISTING,v.MENU,v.META,v.NOBR,v.OL,v.P,v.PRE,v.RUBY,v.S,v.SMALL,v.SPAN,v.STRONG,v.STRIKE,v.SUB,v.SUP,v.TABLE,v.TT,v.U,v.UL,v.VAR]);function tte(e){const t=e.tagID;return t===v.FONT&&e.attrs.some(({name:r})=>r===Ao.COLOR||r===Ao.SIZE||r===Ao.FACE)||ete.has(t)}function Hj(e){for(let t=0;t0&&this._setContextModes(t,n)}onItemPop(t,n){var r,s;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(s=(r=this.treeAdapter).onItemPop)===null||s===void 0||s.call(r,t,this.openElements.current),n){let i,a;this.openElements.stackTop===0&&this.fragmentContext?(i=this.fragmentContext,a=this.fragmentContextID):{current:i,currentTagId:a}=this.openElements,this._setContextModes(i,a)}}_setContextModes(t,n){const r=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===xe.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&t!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,t)}_switchToTextParsing(t,n){this._insertElement(t,xe.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=Y.TEXT}switchToPlaintextParsing(){this.insertionMode=Y.TEXT,this.originalInsertionMode=Y.IN_BODY,this.tokenizer.state=vn.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let t=this.fragmentContext;for(;t;){if(this.treeAdapter.getTagName(t)===se.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==xe.HTML))switch(this.fragmentContextID){case v.TITLE:case v.TEXTAREA:{this.tokenizer.state=vn.RCDATA;break}case v.STYLE:case v.XMP:case v.IFRAME:case v.NOEMBED:case v.NOFRAMES:case v.NOSCRIPT:{this.tokenizer.state=vn.RAWTEXT;break}case v.SCRIPT:{this.tokenizer.state=vn.SCRIPT_DATA;break}case v.PLAINTEXT:{this.tokenizer.state=vn.PLAINTEXT;break}}}_setDocumentType(t){const n=t.name||"",r=t.publicId||"",s=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,r,s),t.location){const a=this.treeAdapter.getChildNodes(this.document).find(o=>this.treeAdapter.isDocumentTypeNode(o));a&&this.treeAdapter.setNodeSourceCodeLocation(a,t.location)}}_attachElementToTree(t,n){if(this.options.sourceCodeLocationInfo){const r=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(t,r)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{const r=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(r??this.document,t)}}_appendElement(t,n){const r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location)}_insertElement(t,n){const r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location),this.openElements.push(r,t.tagID)}_insertFakeElement(t,n){const r=this.treeAdapter.createElement(t,xe.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,n)}_insertTemplate(t){const n=this.treeAdapter.createElement(t.tagName,xe.HTML,t.attrs),r=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,r),this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,null)}_insertFakeRootElement(){const t=this.treeAdapter.createElement(se.HTML,xe.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,v.HTML)}_appendCommentNode(t,n){const r=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(n,r),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,t.location)}_insertCharacters(t){let n,r;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:r}=this._findFosterParentingLocation(),r?this.treeAdapter.insertTextBefore(n,t.chars,r):this.treeAdapter.insertText(n,t.chars)):(n=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(n,t.chars)),!t.location)return;const s=this.treeAdapter.getChildNodes(n),i=r?s.lastIndexOf(r):s.length,a=s[i-1];if(this.treeAdapter.getNodeSourceCodeLocation(a)){const{endLine:c,endCol:u,endOffset:d}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(a,{endLine:c,endCol:u,endOffset:d})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(a,t.location)}_adoptNodes(t,n){for(let r=this.treeAdapter.getFirstChild(t);r;r=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(r),this.treeAdapter.appendChild(n,r)}_setEndLocation(t,n){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&n.location){const r=n.location,s=this.treeAdapter.getTagName(t),i=n.type===mt.END_TAG&&s===n.tagName?{endTag:{...r},endLine:r.endLine,endCol:r.endCol,endOffset:r.endOffset}:{endLine:r.startLine,endCol:r.startCol,endOffset:r.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,i)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let n,r;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,r=this.fragmentContextID):{current:n,currentTagId:r}=this.openElements,t.tagID===v.SVG&&this.treeAdapter.getTagName(n)===se.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===xe.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===v.MGLYPH||t.tagID===v.MALIGNMARK)&&r!==void 0&&!this._isIntegrationPoint(r,n,xe.HTML)}_processToken(t){switch(t.type){case mt.CHARACTER:{this.onCharacter(t);break}case mt.NULL_CHARACTER:{this.onNullCharacter(t);break}case mt.COMMENT:{this.onComment(t);break}case mt.DOCTYPE:{this.onDoctype(t);break}case mt.START_TAG:{this._processStartTag(t);break}case mt.END_TAG:{this.onEndTag(t);break}case mt.EOF:{this.onEof(t);break}case mt.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,r){const s=this.treeAdapter.getNamespaceURI(n),i=this.treeAdapter.getAttrList(n);return ite(t,s,i,r)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(s=>s.type===di.Marker||this.openElements.contains(s.element)),r=n===-1?t-1:n-1;for(let s=r;s>=0;s--){const i=this.activeFormattingElements.entries[s];this._insertElement(i.token,this.treeAdapter.getNamespaceURI(i.element)),i.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=Y.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(v.P),this.openElements.popUntilTagNamePopped(v.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case v.TR:{this.insertionMode=Y.IN_ROW;return}case v.TBODY:case v.THEAD:case v.TFOOT:{this.insertionMode=Y.IN_TABLE_BODY;return}case v.CAPTION:{this.insertionMode=Y.IN_CAPTION;return}case v.COLGROUP:{this.insertionMode=Y.IN_COLUMN_GROUP;return}case v.TABLE:{this.insertionMode=Y.IN_TABLE;return}case v.BODY:{this.insertionMode=Y.IN_BODY;return}case v.FRAMESET:{this.insertionMode=Y.IN_FRAMESET;return}case v.SELECT:{this._resetInsertionModeForSelect(t);return}case v.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case v.HTML:{this.insertionMode=this.headElement?Y.AFTER_HEAD:Y.BEFORE_HEAD;return}case v.TD:case v.TH:{if(t>0){this.insertionMode=Y.IN_CELL;return}break}case v.HEAD:{if(t>0){this.insertionMode=Y.IN_HEAD;return}break}}this.insertionMode=Y.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let n=t-1;n>0;n--){const r=this.openElements.tagIDs[n];if(r===v.TEMPLATE)break;if(r===v.TABLE){this.insertionMode=Y.IN_SELECT_IN_TABLE;return}}this.insertionMode=Y.IN_SELECT}_isElementCausesFosterParenting(t){return Vj.has(t)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let t=this.openElements.stackTop;t>=0;t--){const n=this.openElements.items[t];switch(this.openElements.tagIDs[t]){case v.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===xe.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case v.TABLE:{const r=this.treeAdapter.getParentNode(n);return r?{parent:r,beforeElement:n}:{parent:this.openElements.items[t-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(t){const n=this._findFosterParentingLocation();n.beforeElement?this.treeAdapter.insertBefore(n.parent,t,n.beforeElement):this.treeAdapter.appendChild(n.parent,t)}_isSpecialElement(t,n){const r=this.treeAdapter.getNamespaceURI(t);return Cee[r].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Fne(this,t);return}switch(this.insertionMode){case Y.INITIAL:{vu(this,t);break}case Y.BEFORE_HTML:{fd(this,t);break}case Y.BEFORE_HEAD:{hd(this,t);break}case Y.IN_HEAD:{pd(this,t);break}case Y.IN_HEAD_NO_SCRIPT:{md(this,t);break}case Y.AFTER_HEAD:{gd(this,t);break}case Y.IN_BODY:case Y.IN_CAPTION:case Y.IN_CELL:case Y.IN_TEMPLATE:{Yj(this,t);break}case Y.TEXT:case Y.IN_SELECT:case Y.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case Y.IN_TABLE:case Y.IN_TABLE_BODY:case Y.IN_ROW:{Uy(this,t);break}case Y.IN_TABLE_TEXT:{Zj(this,t);break}case Y.IN_COLUMN_GROUP:{Mm(this,t);break}case Y.AFTER_BODY:{jm(this,t);break}case Y.AFTER_AFTER_BODY:{Ip(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Bne(this,t);return}switch(this.insertionMode){case Y.INITIAL:{vu(this,t);break}case Y.BEFORE_HTML:{fd(this,t);break}case Y.BEFORE_HEAD:{hd(this,t);break}case Y.IN_HEAD:{pd(this,t);break}case Y.IN_HEAD_NO_SCRIPT:{md(this,t);break}case Y.AFTER_HEAD:{gd(this,t);break}case Y.TEXT:{this._insertCharacters(t);break}case Y.IN_TABLE:case Y.IN_TABLE_BODY:case Y.IN_ROW:{Uy(this,t);break}case Y.IN_COLUMN_GROUP:{Mm(this,t);break}case Y.AFTER_BODY:{jm(this,t);break}case Y.AFTER_AFTER_BODY:{Ip(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){yE(this,t);return}switch(this.insertionMode){case Y.INITIAL:case Y.BEFORE_HTML:case Y.BEFORE_HEAD:case Y.IN_HEAD:case Y.IN_HEAD_NO_SCRIPT:case Y.AFTER_HEAD:case Y.IN_BODY:case Y.IN_TABLE:case Y.IN_CAPTION:case Y.IN_COLUMN_GROUP:case Y.IN_TABLE_BODY:case Y.IN_ROW:case Y.IN_CELL:case Y.IN_SELECT:case Y.IN_SELECT_IN_TABLE:case Y.IN_TEMPLATE:case Y.IN_FRAMESET:case Y.AFTER_FRAMESET:{yE(this,t);break}case Y.IN_TABLE_TEXT:{_u(this,t);break}case Y.AFTER_BODY:{gte(this,t);break}case Y.AFTER_AFTER_BODY:case Y.AFTER_AFTER_FRAMESET:{yte(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case Y.INITIAL:{bte(this,t);break}case Y.BEFORE_HEAD:case Y.IN_HEAD:case Y.IN_HEAD_NO_SCRIPT:case Y.AFTER_HEAD:{this._err(t,ce.misplacedDoctype);break}case Y.IN_TABLE_TEXT:{_u(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,ce.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?Une(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case Y.INITIAL:{vu(this,t);break}case Y.BEFORE_HTML:{Ete(this,t);break}case Y.BEFORE_HEAD:{wte(this,t);break}case Y.IN_HEAD:{ei(this,t);break}case Y.IN_HEAD_NO_SCRIPT:{kte(this,t);break}case Y.AFTER_HEAD:{Ste(this,t);break}case Y.IN_BODY:{br(this,t);break}case Y.IN_TABLE:{Tc(this,t);break}case Y.IN_TABLE_TEXT:{_u(this,t);break}case Y.IN_CAPTION:{vne(this,t);break}case Y.IN_COLUMN_GROUP:{gv(this,t);break}case Y.IN_TABLE_BODY:{Vg(this,t);break}case Y.IN_ROW:{Kg(this,t);break}case Y.IN_CELL:{Nne(this,t);break}case Y.IN_SELECT:{tD(this,t);break}case Y.IN_SELECT_IN_TABLE:{Tne(this,t);break}case Y.IN_TEMPLATE:{Cne(this,t);break}case Y.AFTER_BODY:{One(this,t);break}case Y.IN_FRAMESET:{Rne(this,t);break}case Y.AFTER_FRAMESET:{Mne(this,t);break}case Y.AFTER_AFTER_BODY:{Dne(this,t);break}case Y.AFTER_AFTER_FRAMESET:{Pne(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?$ne(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case Y.INITIAL:{vu(this,t);break}case Y.BEFORE_HTML:{xte(this,t);break}case Y.BEFORE_HEAD:{vte(this,t);break}case Y.IN_HEAD:{_te(this,t);break}case Y.IN_HEAD_NO_SCRIPT:{Nte(this,t);break}case Y.AFTER_HEAD:{Tte(this,t);break}case Y.IN_BODY:{zg(this,t);break}case Y.TEXT:{fne(this,t);break}case Y.IN_TABLE:{ef(this,t);break}case Y.IN_TABLE_TEXT:{_u(this,t);break}case Y.IN_CAPTION:{_ne(this,t);break}case Y.IN_COLUMN_GROUP:{kne(this,t);break}case Y.IN_TABLE_BODY:{bE(this,t);break}case Y.IN_ROW:{eD(this,t);break}case Y.IN_CELL:{Sne(this,t);break}case Y.IN_SELECT:{nD(this,t);break}case Y.IN_SELECT_IN_TABLE:{Ane(this,t);break}case Y.IN_TEMPLATE:{Ine(this,t);break}case Y.AFTER_BODY:{sD(this,t);break}case Y.IN_FRAMESET:{Lne(this,t);break}case Y.AFTER_FRAMESET:{jne(this,t);break}case Y.AFTER_AFTER_BODY:{Ip(this,t);break}}}onEof(t){switch(this.insertionMode){case Y.INITIAL:{vu(this,t);break}case Y.BEFORE_HTML:{fd(this,t);break}case Y.BEFORE_HEAD:{hd(this,t);break}case Y.IN_HEAD:{pd(this,t);break}case Y.IN_HEAD_NO_SCRIPT:{md(this,t);break}case Y.AFTER_HEAD:{gd(this,t);break}case Y.IN_BODY:case Y.IN_TABLE:case Y.IN_CAPTION:case Y.IN_COLUMN_GROUP:case Y.IN_TABLE_BODY:case Y.IN_ROW:case Y.IN_CELL:case Y.IN_SELECT:case Y.IN_SELECT_IN_TABLE:{Xj(this,t);break}case Y.TEXT:{hne(this,t);break}case Y.IN_TABLE_TEXT:{_u(this,t);break}case Y.IN_TEMPLATE:{rD(this,t);break}case Y.AFTER_BODY:case Y.IN_FRAMESET:case Y.AFTER_FRAMESET:case Y.AFTER_AFTER_BODY:case Y.AFTER_AFTER_FRAMESET:{mv(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===H.LINE_FEED)){if(t.chars.length===1)return;t.chars=t.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(t);return}switch(this.insertionMode){case Y.IN_HEAD:case Y.IN_HEAD_NO_SCRIPT:case Y.AFTER_HEAD:case Y.TEXT:case Y.IN_COLUMN_GROUP:case Y.IN_SELECT:case Y.IN_SELECT_IN_TABLE:case Y.IN_FRAMESET:case Y.AFTER_FRAMESET:{this._insertCharacters(t);break}case Y.IN_BODY:case Y.IN_CAPTION:case Y.IN_CELL:case Y.IN_TEMPLATE:case Y.AFTER_BODY:case Y.AFTER_AFTER_BODY:case Y.AFTER_AFTER_FRAMESET:{Kj(this,t);break}case Y.IN_TABLE:case Y.IN_TABLE_BODY:case Y.IN_ROW:{Uy(this,t);break}case Y.IN_TABLE_TEXT:{Qj(this,t);break}}}};function ute(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):qj(e,t),n}function dte(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){const s=e.openElements.items[r];if(s===t.element)break;e._isSpecialElement(s,e.openElements.tagIDs[r])&&(n=s)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function fte(e,t,n){let r=t,s=e.openElements.getCommonAncestor(t);for(let i=0,a=s;a!==n;i++,a=s){s=e.openElements.getCommonAncestor(a);const o=e.activeFormattingElements.getElementEntry(a),c=o&&i>=lte;!o||c?(c&&e.activeFormattingElements.removeEntry(o),e.openElements.remove(a)):(a=hte(e,o),r===t&&(e.activeFormattingElements.bookmark=o),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(a,r),r=a)}return r}function hte(e,t){const n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function pte(e,t,n){const r=e.treeAdapter.getTagName(t),s=Xc(r);if(e._isElementCausesFosterParenting(s))e._fosterParentElement(n);else{const i=e.treeAdapter.getNamespaceURI(t);s===v.TEMPLATE&&i===xe.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function mte(e,t,n){const r=e.treeAdapter.getNamespaceURI(n.element),{token:s}=n,i=e.treeAdapter.createElement(s.tagName,r,s.attrs);e._adoptNodes(t,i),e.treeAdapter.appendChild(t,i),e.activeFormattingElements.insertElementAfterBookmark(i,s),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,i,s.tagID)}function pv(e,t){for(let n=0;n=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){const r=e.openElements.items[0],s=e.treeAdapter.getNodeSourceCodeLocation(r);if(s&&!s.endTag&&(e._setEndLocation(r,t),e.openElements.stackTop>=1)){const i=e.openElements.items[1],a=e.treeAdapter.getNodeSourceCodeLocation(i);a&&!a.endTag&&e._setEndLocation(i,t)}}}}function bte(e,t){e._setDocumentType(t);const n=t.forceQuirks?bs.QUIRKS:Gee(t);Wee(t)||e._err(t,ce.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=Y.BEFORE_HTML}function vu(e,t){e._err(t,ce.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,bs.QUIRKS),e.insertionMode=Y.BEFORE_HTML,e._processToken(t)}function Ete(e,t){t.tagID===v.HTML?(e._insertElement(t,xe.HTML),e.insertionMode=Y.BEFORE_HEAD):fd(e,t)}function xte(e,t){const n=t.tagID;(n===v.HTML||n===v.HEAD||n===v.BODY||n===v.BR)&&fd(e,t)}function fd(e,t){e._insertFakeRootElement(),e.insertionMode=Y.BEFORE_HEAD,e._processToken(t)}function wte(e,t){switch(t.tagID){case v.HTML:{br(e,t);break}case v.HEAD:{e._insertElement(t,xe.HTML),e.headElement=e.openElements.current,e.insertionMode=Y.IN_HEAD;break}default:hd(e,t)}}function vte(e,t){const n=t.tagID;n===v.HEAD||n===v.BODY||n===v.HTML||n===v.BR?hd(e,t):e._err(t,ce.endTagWithoutMatchingOpenElement)}function hd(e,t){e._insertFakeElement(se.HEAD,v.HEAD),e.headElement=e.openElements.current,e.insertionMode=Y.IN_HEAD,e._processToken(t)}function ei(e,t){switch(t.tagID){case v.HTML:{br(e,t);break}case v.BASE:case v.BASEFONT:case v.BGSOUND:case v.LINK:case v.META:{e._appendElement(t,xe.HTML),t.ackSelfClosing=!0;break}case v.TITLE:{e._switchToTextParsing(t,vn.RCDATA);break}case v.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,vn.RAWTEXT):(e._insertElement(t,xe.HTML),e.insertionMode=Y.IN_HEAD_NO_SCRIPT);break}case v.NOFRAMES:case v.STYLE:{e._switchToTextParsing(t,vn.RAWTEXT);break}case v.SCRIPT:{e._switchToTextParsing(t,vn.SCRIPT_DATA);break}case v.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=Y.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(Y.IN_TEMPLATE);break}case v.HEAD:{e._err(t,ce.misplacedStartTagForHeadElement);break}default:pd(e,t)}}function _te(e,t){switch(t.tagID){case v.HEAD:{e.openElements.pop(),e.insertionMode=Y.AFTER_HEAD;break}case v.BODY:case v.BR:case v.HTML:{pd(e,t);break}case v.TEMPLATE:{Zo(e,t);break}default:e._err(t,ce.endTagWithoutMatchingOpenElement)}}function Zo(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==v.TEMPLATE&&e._err(t,ce.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(v.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,ce.endTagWithoutMatchingOpenElement)}function pd(e,t){e.openElements.pop(),e.insertionMode=Y.AFTER_HEAD,e._processToken(t)}function kte(e,t){switch(t.tagID){case v.HTML:{br(e,t);break}case v.BASEFONT:case v.BGSOUND:case v.HEAD:case v.LINK:case v.META:case v.NOFRAMES:case v.STYLE:{ei(e,t);break}case v.NOSCRIPT:{e._err(t,ce.nestedNoscriptInHead);break}default:md(e,t)}}function Nte(e,t){switch(t.tagID){case v.NOSCRIPT:{e.openElements.pop(),e.insertionMode=Y.IN_HEAD;break}case v.BR:{md(e,t);break}default:e._err(t,ce.endTagWithoutMatchingOpenElement)}}function md(e,t){const n=t.type===mt.EOF?ce.openElementsLeftAfterEof:ce.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=Y.IN_HEAD,e._processToken(t)}function Ste(e,t){switch(t.tagID){case v.HTML:{br(e,t);break}case v.BODY:{e._insertElement(t,xe.HTML),e.framesetOk=!1,e.insertionMode=Y.IN_BODY;break}case v.FRAMESET:{e._insertElement(t,xe.HTML),e.insertionMode=Y.IN_FRAMESET;break}case v.BASE:case v.BASEFONT:case v.BGSOUND:case v.LINK:case v.META:case v.NOFRAMES:case v.SCRIPT:case v.STYLE:case v.TEMPLATE:case v.TITLE:{e._err(t,ce.abandonedHeadElementChild),e.openElements.push(e.headElement,v.HEAD),ei(e,t),e.openElements.remove(e.headElement);break}case v.HEAD:{e._err(t,ce.misplacedStartTagForHeadElement);break}default:gd(e,t)}}function Tte(e,t){switch(t.tagID){case v.BODY:case v.HTML:case v.BR:{gd(e,t);break}case v.TEMPLATE:{Zo(e,t);break}default:e._err(t,ce.endTagWithoutMatchingOpenElement)}}function gd(e,t){e._insertFakeElement(se.BODY,v.BODY),e.insertionMode=Y.IN_BODY,Hg(e,t)}function Hg(e,t){switch(t.type){case mt.CHARACTER:{Yj(e,t);break}case mt.WHITESPACE_CHARACTER:{Kj(e,t);break}case mt.COMMENT:{yE(e,t);break}case mt.START_TAG:{br(e,t);break}case mt.END_TAG:{zg(e,t);break}case mt.EOF:{Xj(e,t);break}}}function Kj(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function Yj(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function Ate(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function Cte(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function Ite(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,xe.HTML),e.insertionMode=Y.IN_FRAMESET)}function Ote(e,t){e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._insertElement(t,xe.HTML)}function Rte(e,t){e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&gE.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,xe.HTML)}function Lte(e,t){e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._insertElement(t,xe.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function Mte(e,t){const n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._insertElement(t,xe.HTML),n||(e.formElement=e.openElements.current))}function jte(e,t){e.framesetOk=!1;const n=t.tagID;for(let r=e.openElements.stackTop;r>=0;r--){const s=e.openElements.tagIDs[r];if(n===v.LI&&s===v.LI||(n===v.DD||n===v.DT)&&(s===v.DD||s===v.DT)){e.openElements.generateImpliedEndTagsWithExclusion(s),e.openElements.popUntilTagNamePopped(s);break}if(s!==v.ADDRESS&&s!==v.DIV&&s!==v.P&&e._isSpecialElement(e.openElements.items[r],s))break}e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._insertElement(t,xe.HTML)}function Dte(e,t){e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._insertElement(t,xe.HTML),e.tokenizer.state=vn.PLAINTEXT}function Pte(e,t){e.openElements.hasInScope(v.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(v.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,xe.HTML),e.framesetOk=!1}function Bte(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(se.A);n&&(pv(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,xe.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function Fte(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,xe.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function Ute(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(v.NOBR)&&(pv(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,xe.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function $te(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,xe.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function Hte(e,t){e.treeAdapter.getDocumentMode(e.document)!==bs.QUIRKS&&e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._insertElement(t,xe.HTML),e.framesetOk=!1,e.insertionMode=Y.IN_TABLE}function Wj(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,xe.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function Gj(e){const t=Dj(e,Ao.TYPE);return t!=null&&t.toLowerCase()===ate}function zte(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,xe.HTML),Gj(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function Vte(e,t){e._appendElement(t,xe.HTML),t.ackSelfClosing=!0}function Kte(e,t){e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._appendElement(t,xe.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function Yte(e,t){t.tagName=se.IMG,t.tagID=v.IMG,Wj(e,t)}function Wte(e,t){e._insertElement(t,xe.HTML),e.skipNextNewLine=!0,e.tokenizer.state=vn.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=Y.TEXT}function Gte(e,t){e.openElements.hasInButtonScope(v.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,vn.RAWTEXT)}function qte(e,t){e.framesetOk=!1,e._switchToTextParsing(t,vn.RAWTEXT)}function s2(e,t){e._switchToTextParsing(t,vn.RAWTEXT)}function Xte(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,xe.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===Y.IN_TABLE||e.insertionMode===Y.IN_CAPTION||e.insertionMode===Y.IN_TABLE_BODY||e.insertionMode===Y.IN_ROW||e.insertionMode===Y.IN_CELL?Y.IN_SELECT_IN_TABLE:Y.IN_SELECT}function Qte(e,t){e.openElements.currentTagId===v.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,xe.HTML)}function Zte(e,t){e.openElements.hasInScope(v.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,xe.HTML)}function Jte(e,t){e.openElements.hasInScope(v.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(v.RTC),e._insertElement(t,xe.HTML)}function ene(e,t){e._reconstructActiveFormattingElements(),Hj(t),hv(t),t.selfClosing?e._appendElement(t,xe.MATHML):e._insertElement(t,xe.MATHML),t.ackSelfClosing=!0}function tne(e,t){e._reconstructActiveFormattingElements(),zj(t),hv(t),t.selfClosing?e._appendElement(t,xe.SVG):e._insertElement(t,xe.SVG),t.ackSelfClosing=!0}function i2(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,xe.HTML)}function br(e,t){switch(t.tagID){case v.I:case v.S:case v.B:case v.U:case v.EM:case v.TT:case v.BIG:case v.CODE:case v.FONT:case v.SMALL:case v.STRIKE:case v.STRONG:{Fte(e,t);break}case v.A:{Bte(e,t);break}case v.H1:case v.H2:case v.H3:case v.H4:case v.H5:case v.H6:{Rte(e,t);break}case v.P:case v.DL:case v.OL:case v.UL:case v.DIV:case v.DIR:case v.NAV:case v.MAIN:case v.MENU:case v.ASIDE:case v.CENTER:case v.FIGURE:case v.FOOTER:case v.HEADER:case v.HGROUP:case v.DIALOG:case v.DETAILS:case v.ADDRESS:case v.ARTICLE:case v.SEARCH:case v.SECTION:case v.SUMMARY:case v.FIELDSET:case v.BLOCKQUOTE:case v.FIGCAPTION:{Ote(e,t);break}case v.LI:case v.DD:case v.DT:{jte(e,t);break}case v.BR:case v.IMG:case v.WBR:case v.AREA:case v.EMBED:case v.KEYGEN:{Wj(e,t);break}case v.HR:{Kte(e,t);break}case v.RB:case v.RTC:{Zte(e,t);break}case v.RT:case v.RP:{Jte(e,t);break}case v.PRE:case v.LISTING:{Lte(e,t);break}case v.XMP:{Gte(e,t);break}case v.SVG:{tne(e,t);break}case v.HTML:{Ate(e,t);break}case v.BASE:case v.LINK:case v.META:case v.STYLE:case v.TITLE:case v.SCRIPT:case v.BGSOUND:case v.BASEFONT:case v.TEMPLATE:{ei(e,t);break}case v.BODY:{Cte(e,t);break}case v.FORM:{Mte(e,t);break}case v.NOBR:{Ute(e,t);break}case v.MATH:{ene(e,t);break}case v.TABLE:{Hte(e,t);break}case v.INPUT:{zte(e,t);break}case v.PARAM:case v.TRACK:case v.SOURCE:{Vte(e,t);break}case v.IMAGE:{Yte(e,t);break}case v.BUTTON:{Pte(e,t);break}case v.APPLET:case v.OBJECT:case v.MARQUEE:{$te(e,t);break}case v.IFRAME:{qte(e,t);break}case v.SELECT:{Xte(e,t);break}case v.OPTION:case v.OPTGROUP:{Qte(e,t);break}case v.NOEMBED:case v.NOFRAMES:{s2(e,t);break}case v.FRAMESET:{Ite(e,t);break}case v.TEXTAREA:{Wte(e,t);break}case v.NOSCRIPT:{e.options.scriptingEnabled?s2(e,t):i2(e,t);break}case v.PLAINTEXT:{Dte(e,t);break}case v.COL:case v.TH:case v.TD:case v.TR:case v.HEAD:case v.FRAME:case v.TBODY:case v.TFOOT:case v.THEAD:case v.CAPTION:case v.COLGROUP:break;default:i2(e,t)}}function nne(e,t){if(e.openElements.hasInScope(v.BODY)&&(e.insertionMode=Y.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function rne(e,t){e.openElements.hasInScope(v.BODY)&&(e.insertionMode=Y.AFTER_BODY,sD(e,t))}function sne(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function ine(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(v.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(v.FORM):n&&e.openElements.remove(n))}function ane(e){e.openElements.hasInButtonScope(v.P)||e._insertFakeElement(se.P,v.P),e._closePElement()}function one(e){e.openElements.hasInListItemScope(v.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(v.LI),e.openElements.popUntilTagNamePopped(v.LI))}function lne(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function cne(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function une(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function dne(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(se.BR,v.BR),e.openElements.pop(),e.framesetOk=!1}function qj(e,t){const n=t.tagName,r=t.tagID;for(let s=e.openElements.stackTop;s>0;s--){const i=e.openElements.items[s],a=e.openElements.tagIDs[s];if(r===a&&(r!==v.UNKNOWN||e.treeAdapter.getTagName(i)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=s&&e.openElements.shortenToLength(s);break}if(e._isSpecialElement(i,a))break}}function zg(e,t){switch(t.tagID){case v.A:case v.B:case v.I:case v.S:case v.U:case v.EM:case v.TT:case v.BIG:case v.CODE:case v.FONT:case v.NOBR:case v.SMALL:case v.STRIKE:case v.STRONG:{pv(e,t);break}case v.P:{ane(e);break}case v.DL:case v.UL:case v.OL:case v.DIR:case v.DIV:case v.NAV:case v.PRE:case v.MAIN:case v.MENU:case v.ASIDE:case v.BUTTON:case v.CENTER:case v.FIGURE:case v.FOOTER:case v.HEADER:case v.HGROUP:case v.DIALOG:case v.ADDRESS:case v.ARTICLE:case v.DETAILS:case v.SEARCH:case v.SECTION:case v.SUMMARY:case v.LISTING:case v.FIELDSET:case v.BLOCKQUOTE:case v.FIGCAPTION:{sne(e,t);break}case v.LI:{one(e);break}case v.DD:case v.DT:{lne(e,t);break}case v.H1:case v.H2:case v.H3:case v.H4:case v.H5:case v.H6:{cne(e);break}case v.BR:{dne(e);break}case v.BODY:{nne(e,t);break}case v.HTML:{rne(e,t);break}case v.FORM:{ine(e);break}case v.APPLET:case v.OBJECT:case v.MARQUEE:{une(e,t);break}case v.TEMPLATE:{Zo(e,t);break}default:qj(e,t)}}function Xj(e,t){e.tmplInsertionModeStack.length>0?rD(e,t):mv(e,t)}function fne(e,t){var n;t.tagID===v.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function hne(e,t){e._err(t,ce.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function Uy(e,t){if(e.openElements.currentTagId!==void 0&&Vj.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=Y.IN_TABLE_TEXT,t.type){case mt.CHARACTER:{Zj(e,t);break}case mt.WHITESPACE_CHARACTER:{Qj(e,t);break}}else Rf(e,t)}function pne(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,xe.HTML),e.insertionMode=Y.IN_CAPTION}function mne(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,xe.HTML),e.insertionMode=Y.IN_COLUMN_GROUP}function gne(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(se.COLGROUP,v.COLGROUP),e.insertionMode=Y.IN_COLUMN_GROUP,gv(e,t)}function yne(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,xe.HTML),e.insertionMode=Y.IN_TABLE_BODY}function bne(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(se.TBODY,v.TBODY),e.insertionMode=Y.IN_TABLE_BODY,Vg(e,t)}function Ene(e,t){e.openElements.hasInTableScope(v.TABLE)&&(e.openElements.popUntilTagNamePopped(v.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function xne(e,t){Gj(t)?e._appendElement(t,xe.HTML):Rf(e,t),t.ackSelfClosing=!0}function wne(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,xe.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function Tc(e,t){switch(t.tagID){case v.TD:case v.TH:case v.TR:{bne(e,t);break}case v.STYLE:case v.SCRIPT:case v.TEMPLATE:{ei(e,t);break}case v.COL:{gne(e,t);break}case v.FORM:{wne(e,t);break}case v.TABLE:{Ene(e,t);break}case v.TBODY:case v.TFOOT:case v.THEAD:{yne(e,t);break}case v.INPUT:{xne(e,t);break}case v.CAPTION:{pne(e,t);break}case v.COLGROUP:{mne(e,t);break}default:Rf(e,t)}}function ef(e,t){switch(t.tagID){case v.TABLE:{e.openElements.hasInTableScope(v.TABLE)&&(e.openElements.popUntilTagNamePopped(v.TABLE),e._resetInsertionMode());break}case v.TEMPLATE:{Zo(e,t);break}case v.BODY:case v.CAPTION:case v.COL:case v.COLGROUP:case v.HTML:case v.TBODY:case v.TD:case v.TFOOT:case v.TH:case v.THEAD:case v.TR:break;default:Rf(e,t)}}function Rf(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,Hg(e,t),e.fosterParentingEnabled=n}function Qj(e,t){e.pendingCharacterTokens.push(t)}function Zj(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function _u(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n0&&e.openElements.currentTagId===v.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===v.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===v.OPTGROUP&&e.openElements.pop();break}case v.OPTION:{e.openElements.currentTagId===v.OPTION&&e.openElements.pop();break}case v.SELECT:{e.openElements.hasInSelectScope(v.SELECT)&&(e.openElements.popUntilTagNamePopped(v.SELECT),e._resetInsertionMode());break}case v.TEMPLATE:{Zo(e,t);break}}}function Tne(e,t){const n=t.tagID;n===v.CAPTION||n===v.TABLE||n===v.TBODY||n===v.TFOOT||n===v.THEAD||n===v.TR||n===v.TD||n===v.TH?(e.openElements.popUntilTagNamePopped(v.SELECT),e._resetInsertionMode(),e._processStartTag(t)):tD(e,t)}function Ane(e,t){const n=t.tagID;n===v.CAPTION||n===v.TABLE||n===v.TBODY||n===v.TFOOT||n===v.THEAD||n===v.TR||n===v.TD||n===v.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(v.SELECT),e._resetInsertionMode(),e.onEndTag(t)):nD(e,t)}function Cne(e,t){switch(t.tagID){case v.BASE:case v.BASEFONT:case v.BGSOUND:case v.LINK:case v.META:case v.NOFRAMES:case v.SCRIPT:case v.STYLE:case v.TEMPLATE:case v.TITLE:{ei(e,t);break}case v.CAPTION:case v.COLGROUP:case v.TBODY:case v.TFOOT:case v.THEAD:{e.tmplInsertionModeStack[0]=Y.IN_TABLE,e.insertionMode=Y.IN_TABLE,Tc(e,t);break}case v.COL:{e.tmplInsertionModeStack[0]=Y.IN_COLUMN_GROUP,e.insertionMode=Y.IN_COLUMN_GROUP,gv(e,t);break}case v.TR:{e.tmplInsertionModeStack[0]=Y.IN_TABLE_BODY,e.insertionMode=Y.IN_TABLE_BODY,Vg(e,t);break}case v.TD:case v.TH:{e.tmplInsertionModeStack[0]=Y.IN_ROW,e.insertionMode=Y.IN_ROW,Kg(e,t);break}default:e.tmplInsertionModeStack[0]=Y.IN_BODY,e.insertionMode=Y.IN_BODY,br(e,t)}}function Ine(e,t){t.tagID===v.TEMPLATE&&Zo(e,t)}function rD(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(v.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):mv(e,t)}function One(e,t){t.tagID===v.HTML?br(e,t):jm(e,t)}function sD(e,t){var n;if(t.tagID===v.HTML){if(e.fragmentContext||(e.insertionMode=Y.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===v.HTML){e._setEndLocation(e.openElements.items[0],t);const r=e.openElements.items[1];r&&!(!((n=e.treeAdapter.getNodeSourceCodeLocation(r))===null||n===void 0)&&n.endTag)&&e._setEndLocation(r,t)}}else jm(e,t)}function jm(e,t){e.insertionMode=Y.IN_BODY,Hg(e,t)}function Rne(e,t){switch(t.tagID){case v.HTML:{br(e,t);break}case v.FRAMESET:{e._insertElement(t,xe.HTML);break}case v.FRAME:{e._appendElement(t,xe.HTML),t.ackSelfClosing=!0;break}case v.NOFRAMES:{ei(e,t);break}}}function Lne(e,t){t.tagID===v.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==v.FRAMESET&&(e.insertionMode=Y.AFTER_FRAMESET))}function Mne(e,t){switch(t.tagID){case v.HTML:{br(e,t);break}case v.NOFRAMES:{ei(e,t);break}}}function jne(e,t){t.tagID===v.HTML&&(e.insertionMode=Y.AFTER_AFTER_FRAMESET)}function Dne(e,t){t.tagID===v.HTML?br(e,t):Ip(e,t)}function Ip(e,t){e.insertionMode=Y.IN_BODY,Hg(e,t)}function Pne(e,t){switch(t.tagID){case v.HTML:{br(e,t);break}case v.NOFRAMES:{ei(e,t);break}}}function Bne(e,t){t.chars=Qt,e._insertCharacters(t)}function Fne(e,t){e._insertCharacters(t),e.framesetOk=!1}function iD(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==xe.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function Une(e,t){if(tte(t))iD(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===xe.MATHML?Hj(t):r===xe.SVG&&(nte(t),zj(t)),hv(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function $ne(e,t){if(t.tagID===v.P||t.tagID===v.BR){iD(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){const r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===xe.HTML){e._endTagOutsideForeignContent(t);break}const s=e.treeAdapter.getTagName(r);if(s.toLowerCase()===t.tagName){t.tagName=s,e.openElements.shortenToLength(n);break}}}se.AREA,se.BASE,se.BASEFONT,se.BGSOUND,se.BR,se.COL,se.EMBED,se.FRAME,se.HR,se.IMG,se.INPUT,se.KEYGEN,se.LINK,se.META,se.PARAM,se.SOURCE,se.TRACK,se.WBR;const Hne=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,zne=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),a2={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function aD(e,t){const n=Jne(e),r=w3("type",{handlers:{root:Vne,element:Kne,text:Yne,comment:lD,doctype:Wne,raw:qne},unknown:Xne}),s={parser:n?new r2(a2):r2.getFragmentParser(void 0,a2),handle(o){r(o,s)},stitches:!1,options:t||{}};r(e,s),Qc(s,_i());const i=n?s.parser.document:s.parser.getFragment(),a=eee(i,{file:s.options.file});return s.stitches&&If(a,"comment",function(o,c,u){const d=o;if(d.value.stitch&&u&&c!==void 0){const f=u.children;return f[c]=d.value.stitch,c}}),a.type==="root"&&a.children.length===1&&a.children[0].type===e.type?a.children[0]:a}function oD(e,t){let n=-1;if(e)for(;++n4&&(t.parser.tokenizer.state=0);const n={type:mt.CHARACTER,chars:e.value,location:Lf(e)};Qc(t,_i(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function Wne(e,t){const n={type:mt.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:Lf(e)};Qc(t,_i(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function Gne(e,t){t.stitches=!0;const n=ere(e);if("children"in e&&"children"in n){const r=aD({type:"root",children:e.children},t.options);n.children=r.children}lD({type:"comment",value:{stitch:n}},t)}function lD(e,t){const n=e.value,r={type:mt.COMMENT,data:n,location:Lf(e)};Qc(t,_i(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function qne(e,t){if(t.parser.tokenizer.preprocessor.html="",t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,cD(t,_i(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(Hne,"<$1$2"):e.value,!1),t.parser.tokenizer._runParsingLoop(),t.parser.tokenizer.state===72||t.parser.tokenizer.state===78){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;const n=t.parser.tokenizer._consume();t.parser.tokenizer._callState(n)}}function Xne(e,t){const n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))Gne(n,t);else{let r="";throw zne.has(n.type)&&(r=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),new Error("Cannot compile `"+n.type+"` node"+r)}}function Qc(e,t){cD(e,t);const n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=vn.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:"",value:""}}function cD(e,t){if(t&&t.offset!==void 0){const n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function Qne(e,t){const n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===vn.PLAINTEXT)return;Qc(t,_i(e));const r=t.parser.openElements.current;let s="namespaceURI"in r?r.namespaceURI:Eo.html;s===Eo.html&&n==="svg"&&(s=Eo.svg);const i=iee({...e,children:[]},{space:s===Eo.svg?"svg":"html"}),a={type:mt.START_TAG,tagName:n,tagID:Xc(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in i?i.attrs:[],location:Lf(e)};t.parser.currentToken=a,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function Zne(e,t){const n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&hee.includes(n)||t.parser.tokenizer.state===vn.PLAINTEXT)return;Qc(t,Dg(e));const r={type:mt.END_TAG,tagName:n,tagID:Xc(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:Lf(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===vn.RCDATA||t.parser.tokenizer.state===vn.RAWTEXT||t.parser.tokenizer.state===vn.SCRIPT_DATA)&&(t.parser.tokenizer.state=vn.DATA)}function Jne(e){const t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function Lf(e){const t=_i(e)||{line:void 0,column:void 0,offset:void 0},n=Dg(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}function ere(e){return"children"in e?Nc({...e,children:[]}):Nc(e)}function tre(e){return function(t,n){return aD(t,{...e,file:n})}}const uD=[".mp4",".webm",".mov",".m4v",".ogg",".avi"];function dD(e){if(!e)return!1;try{const t=e.toLowerCase();return uD.some(n=>t.includes(n))}catch{return!1}}function nre(e){var r;const t=(r=e==null?void 0:e.properties)==null?void 0:r.href;if(!t)return!1;if(dD(t))return!0;const n=e==null?void 0:e.children;if(n&&Array.isArray(n)){const s=n.map(i=>(i==null?void 0:i.value)||"").join("").toLowerCase();return uD.some(i=>s.includes(i))}return!1}function rre({text:e,className:t,allowRawHtml:n=!0}){const[r,s]=w.useState(null),i=(c,u)=>{if(c.src)return c.src;if(u){const d=h=>{var p;if(!h)return null;if(h.type==="source"&&((p=h.properties)!=null&&p.src))return h.properties.src;if(h.children)for(const m of h.children){const y=d(m);if(y)return y}return null},f=d({children:u});if(f)return f}return""},a=c=>{try{const d=new URL(c).pathname.split("/");return d[d.length-1]||"video.mp4"}catch{return"video.mp4"}},o=c=>c?Array.isArray(c)?c.map(u=>(u==null?void 0:u.value)||"").join("")||"video":(c==null?void 0:c.value)||"video":"video";return l.jsxs("div",{className:t?`md ${t}`:"md",children:[l.jsx(aq,{remarkPlugins:[EQ],rehypePlugins:n?[tre,zT]:[zT],components:{a:({node:c,...u})=>{const d=u.href;if(d&&(dD(d)||nre(c))){const f=d,h=o(c==null?void 0:c.children);return l.jsxs("div",{className:"video-container",children:[l.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":`点击播放视频: ${h}`,onClick:()=>s({src:f,title:h}),children:[l.jsx("video",{src:f,playsInline:!0,className:"video-thumbnail",preload:"metadata"}),l.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:l.jsx(tc,{})})]}),l.jsx("div",{className:"video-caption",children:l.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer",className:"video-link-text",children:h})})]})}return l.jsx("a",{...u,target:"_blank",rel:"noopener noreferrer"})},img:({node:c,src:u,alt:d,...f})=>{const h=l.jsx("img",{...f,src:u,alt:d??"",loading:"lazy"});return u?l.jsx(mL,{src:u,children:l.jsxs("button",{type:"button",className:"image-preview-trigger","aria-label":`放大预览:${d||"图片"}`,children:[h,l.jsx("span",{className:"image-preview-hint","aria-hidden":"true",children:l.jsx(tc,{})})]})}):h},video:({node:c,src:u,children:d,...f})=>{const h=i({src:u},d);return h?l.jsx("div",{className:"video-container",children:l.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":"点击放大视频",onClick:()=>s({src:h}),children:[l.jsx("video",{src:h,...f,playsInline:!0,className:"video-thumbnail",children:d}),l.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:l.jsx(tc,{})})]})}):l.jsx("video",{src:u,controls:!0,playsInline:!0,className:"video-inline",...f,children:d})}},children:e}),r&&l.jsx("div",{className:"video-viewer-backdrop",role:"dialog","aria-modal":"true","aria-label":"视频预览",onClick:()=>s(null),children:l.jsxs("div",{className:"video-viewer",onClick:c=>c.stopPropagation(),children:[l.jsxs("div",{className:"video-viewer-header",children:[l.jsx("div",{className:"video-viewer-title",children:r.title||a(r.src)}),l.jsxs("nav",{className:"video-viewer-nav",children:[l.jsx("a",{href:r.src,download:r.title||a(r.src),"aria-label":"下载视频",title:"下载视频",className:"video-viewer-download",children:l.jsx(Cw,{})}),l.jsx("button",{type:"button",className:"video-viewer-close","aria-label":"关闭",onClick:()=>s(null),children:l.jsx(zr,{})})]})]}),l.jsx("div",{className:"video-viewer-body",children:l.jsx("video",{src:r.src,controls:!0,autoPlay:!0,playsInline:!0,className:"video-fullscreen"})})]})})]})}const Mf=w.memo(rre),o2=6,l2=7,sre={active:"可用",available:"可用",creating:"创建中",disabled:"已停用",enabled:"已启用",failed:"异常",inactive:"未启用",pending:"等待中",published:"已发布",ready:"就绪",released:"已发布",running:"运行中",success:"正常",unavailable:"不可用",unreleased:"未发布",updating:"更新中"};function EE(e){return sre[(e||"").trim().toLowerCase()]||"未知"}function c2(e){const t=(e||"").toLowerCase();return["active","available","enabled","published","ready","released","success"].includes(t)?"is-positive":["creating","pending","running","updating"].includes(t)?"is-progress":["failed","unavailable"].includes(t)?"is-danger":"is-muted"}function ire(e){if(!e)return"";const t=e.trim(),n=Number(t),r=/^\d+(?:\.\d+)?$/.test(t)?new Date(n<1e12?n*1e3:n):new Date(t);return Number.isNaN(r.getTime())?e:new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(r)}function are(e){const t=e.replace(/\r\n/g,` `);if(!t.startsWith(`--- `))return e;const n=t.indexOf(` --- -`,4);return n>=0?t.slice(n+5).trimStart():e}function lre({className:e="icon"}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[l.jsx("path",{d:"M6.25 4.75h8.6l2.9 2.9v11.6h-11.5z",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),l.jsx("path",{d:"M14.75 4.9v3h2.85M8.9 11.1h4.2M8.9 14h5.7",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),l.jsx("path",{d:"m17.85 13.85.42 1.13 1.13.42-1.13.42-.42 1.13-.42-1.13-1.13-.42 1.13-.42z",fill:"currentColor"})]})}function cre(){return l.jsx("svg",{className:"icon",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:l.jsx("path",{d:"m7.5 7.5 9 9m0-9-9 9",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function d2({direction:e}){return l.jsx("svg",{className:"icon",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,children:l.jsx("path",{d:e==="left"?"m11.7 5.5-4.2 4.5 4.2 4.5":"m8.3 5.5 4.2 4.5-4.2 4.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function wE(){return l.jsx("span",{className:"skillcenter-loading-mark","aria-hidden":!0})}function f2({page:e,total:t,pageSize:n,onPage:r}){const s=Math.max(1,Math.ceil(t/n));return l.jsxs("footer",{className:"skillcenter-pager",children:[l.jsxs("span",{children:["共 ",t," 项"]}),l.jsxs("div",{className:"skillcenter-pager-actions",children:[l.jsx("button",{type:"button",onClick:()=>r(e-1),disabled:e<=1,"aria-label":"上一页",children:l.jsx(d2,{direction:"left"})}),l.jsxs("span",{children:[e," / ",s]}),l.jsx("button",{type:"button",onClick:()=>r(e+1),disabled:e>=s,"aria-label":"下一页",children:l.jsx(d2,{direction:"right"})})]})]})}function Rp({children:e}){return l.jsx("div",{className:"skillcenter-empty",children:e})}function ure({skill:e,space:t,region:n,detail:r,loading:s,error:i,onClose:a}){return w.useEffect(()=>{const o=c=>{c.key==="Escape"&&a()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[a]),l.jsx("div",{className:"skill-detail-backdrop",role:"presentation",onMouseDown:a,children:l.jsxs("section",{className:"skill-detail-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"skill-detail-title",onMouseDown:o=>o.stopPropagation(),children:[l.jsxs("header",{className:"skill-detail-head",children:[l.jsxs("div",{className:"skill-detail-heading",children:[l.jsx("span",{className:"skillcenter-symbol skillcenter-symbol--skill",children:l.jsx(lre,{})}),l.jsxs("div",{children:[l.jsx("h2",{id:"skill-detail-title",children:(r==null?void 0:r.name)||e.skillName}),l.jsx("p",{children:(r==null?void 0:r.description)||e.skillDescription||"暂无描述"})]})]}),l.jsx("button",{type:"button",className:"skill-detail-close",onClick:a,"aria-label":"关闭技能详情",children:l.jsx(cre,{})})]}),l.jsxs("dl",{className:"skill-detail-meta",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"技能 ID"}),l.jsx("dd",{title:e.skillId,children:e.skillId})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"版本"}),l.jsx("dd",{children:(r==null?void 0:r.version)||e.version||"—"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"状态"}),l.jsx("dd",{children:xE(e.skillStatus)})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"技能空间"}),l.jsx("dd",{title:t.name,children:t.name})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"Project"}),l.jsx("dd",{title:t.projectName||"default",children:t.projectName||"default"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"地域"}),l.jsx("dd",{children:n==="cn-beijing"?"北京":"上海"})]})]}),l.jsxs("div",{className:"skill-detail-content",children:[l.jsx("div",{className:"skill-detail-content-title",children:"SKILL.md"}),s?l.jsxs("div",{className:"skillcenter-loading",children:[l.jsx(wE,{}),"正在读取技能内容…"]}):i?l.jsx("div",{className:"skillcenter-error",children:i}):r!=null&&r.skillMd?l.jsx(jf,{text:ore(r.skillMd),className:"skill-detail-markdown",allowRawHtml:!1}):l.jsx(Rp,{children:"该技能暂无 SKILL.md 内容"})]})]})})}function dre(){const[e,t]=w.useState("cn-beijing"),[n,r]=w.useState([]),[s,i]=w.useState(1),[a,o]=w.useState(0),[c,u]=w.useState(!1),[d,f]=w.useState(""),[h,p]=w.useState(null),[m,y]=w.useState([]),[E,g]=w.useState(1),[x,b]=w.useState(0),[_,k]=w.useState(!1),[N,C]=w.useState(""),[S,A]=w.useState(null),[O,D]=w.useState(null),[U,X]=w.useState(!1),[M,j]=w.useState(""),T=w.useRef(0);w.useEffect(()=>{let V=!0;return u(!0),f(""),pV({region:e,page:s,pageSize:l2}).then(W=>{if(!V)return;const P=W.items||[];r(P),o(W.totalCount||0),p(ie=>P.find(G=>G.id===(ie==null?void 0:ie.id))||null)}).catch(W=>{V&&(r([]),o(0),p(null),f(W instanceof Error?W.message:"读取技能空间失败,请稍后重试"))}).finally(()=>{V&&u(!1)}),()=>{V=!1}},[e,s]),w.useEffect(()=>{if(!h){y([]),b(0);return}let V=!0;return k(!0),C(""),mV(h.id,{region:e,page:E,pageSize:c2,project:h.projectName}).then(W=>{V&&(y(W.items||[]),b(W.totalCount||0))}).catch(W=>{V&&(y([]),b(0),C(W instanceof Error?W.message:"读取技能失败,请稍后重试"))}).finally(()=>{V&&k(!1)}),()=>{V=!1}},[e,h,E]);const L=V=>{V!==e&&(F(),t(V),i(1),g(1),p(null),y([]))},R=V=>{F(),p(V),g(1)},F=()=>{T.current+=1,A(null),D(null),j(""),X(!1)},I=async V=>{if(!h)return;const W=T.current+1;T.current=W,A(V),D(null),j(""),X(!0);try{const P=await gV(h.id,V.skillId,V.version,e,h.projectName);T.current===W&&D(P)}catch(P){T.current===W&&j(P instanceof Error?P.message:"读取技能详情失败,请稍后重试")}finally{T.current===W&&X(!1)}};return l.jsxs("section",{className:"skillcenter",children:[l.jsxs("div",{className:"skillcenter-browser",children:[l.jsxs("section",{className:"skillcenter-panel","aria-label":"技能空间列表",children:[l.jsxs("header",{className:"skillcenter-panel-head",children:[l.jsxs("div",{children:[l.jsx("h2",{children:"技能空间"}),l.jsx("span",{className:"skillcenter-count-badge",children:a})]}),l.jsxs("div",{className:"skillcenter-regions","aria-label":"地域",children:[l.jsx("button",{type:"button",className:e==="cn-beijing"?"active":"",onClick:()=>L("cn-beijing"),children:"北京"}),l.jsx("button",{type:"button",className:e==="cn-shanghai"?"active":"",onClick:()=>L("cn-shanghai"),children:"上海"})]})]}),l.jsxs("div",{className:"skillcenter-listwrap",children:[c&&l.jsxs("div",{className:"skillcenter-loading skillcenter-loading--overlay",children:[l.jsx(wE,{}),"正在读取技能空间…"]}),d?l.jsx("div",{className:"skillcenter-error",children:d}):n.length===0&&!c?l.jsx(Rp,{children:"当前地域暂无可访问的技能空间"}):l.jsx("div",{className:"skillcenter-list",children:n.map(V=>l.jsx("button",{type:"button",className:`skillcenter-space-item ${(h==null?void 0:h.id)===V.id?"active":""}`,onClick:()=>R(V),children:l.jsxs("span",{className:"skillcenter-item-body",children:[l.jsx("span",{className:"skillcenter-item-title",title:V.name,children:V.name}),l.jsx("span",{className:"skillcenter-item-description",children:V.description||"暂无描述"}),l.jsxs("span",{className:"skillcenter-item-meta",children:[l.jsx("span",{className:`skillcenter-status ${u2(V.status)}`,children:xE(V.status)}),l.jsxs("span",{className:"skillcenter-meta-text",title:V.projectName||"default",children:["Project · ",V.projectName||"default"]}),l.jsxs("span",{className:"skillcenter-meta-text",children:[V.skillCount??0," 个技能"]}),V.updatedAt&&l.jsxs("span",{className:"skillcenter-meta-text",children:["更新于 ",are(V.updatedAt)]})]})]})},`${V.projectName||"default"}:${V.id}`))})]}),l.jsx(f2,{page:s,total:a,pageSize:l2,onPage:i})]}),l.jsx("section",{className:"skillcenter-panel","aria-label":"技能列表",children:h?l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:"skillcenter-panel-head",children:[l.jsx("div",{children:l.jsxs("h2",{title:h.name,children:[h.name," · 技能"]})}),l.jsx("span",{children:x})]}),l.jsxs("div",{className:"skillcenter-listwrap",children:[_&&l.jsxs("div",{className:"skillcenter-loading skillcenter-loading--overlay",children:[l.jsx(wE,{}),"正在读取技能…"]}),N?l.jsx("div",{className:"skillcenter-error",children:N}):m.length===0&&!_?l.jsx(Rp,{children:"这个空间中暂无技能"}):l.jsx("div",{className:"skillcenter-list skillcenter-list--skills",children:m.map(V=>l.jsx("button",{type:"button",className:"skillcenter-skill-item",onClick:()=>void I(V),children:l.jsxs("span",{className:"skillcenter-item-body",children:[l.jsx("span",{className:"skillcenter-item-title",title:V.skillName,children:V.skillName}),l.jsx("span",{className:"skillcenter-item-description",children:V.skillDescription||"暂无描述"}),l.jsxs("span",{className:"skillcenter-item-meta",children:[l.jsx("span",{className:`skillcenter-status ${u2(V.skillStatus)}`,children:xE(V.skillStatus)}),l.jsxs("span",{className:"skillcenter-meta-text",children:["版本 · ",V.version||"—"]})]})]})},`${V.skillId}:${V.version}`))})]}),l.jsx(f2,{page:E,total:x,pageSize:c2,onPage:g})]}):l.jsx(Rp,{children:"点击 Skill 空间以查看详情"})})]}),S&&h&&l.jsx(ure,{skill:S,space:h,region:e,detail:O,loading:U,error:M,onClose:F})]})}function fre({onAdded:e,onCancel:t}){const[n,r]=w.useState(""),[s,i]=w.useState(""),[a,o]=w.useState(""),[c,u]=w.useState(!1),[d,f]=w.useState(""),h=n.trim().length>0&&s.trim().length>0&&!c;async function p(){if(h){u(!0),f("");try{const m=await xM(a,n,s,a);if(m.apps.length===0){f("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。"),u(!1);return}e(Fo(m.id,m.apps[0]))}catch(m){f(`连接失败:${String(m)}。请检查 URL、API Key,以及该网关是否允许跨域。`),u(!1)}}}return l.jsx("div",{className:"addagent",children:l.jsxs("div",{className:"addagent-card",children:[l.jsx("h2",{className:"addagent-title",children:"添加 AgentKit 智能体"}),l.jsx("p",{className:"addagent-sub",children:"填入 AgentKit 部署的访问地址与 API Key,将通过 ADK 协议连接,连接成功后其 Agent 会出现在左上角的下拉中。"}),l.jsxs("label",{className:"addagent-field",children:[l.jsx("span",{className:"addagent-label",children:"访问地址 URL"}),l.jsx("input",{className:"addagent-input",value:n,onChange:m=>r(m.target.value),placeholder:"https://xxxxx.apigateway-cn-beijing.volceapi.com",autoFocus:!0})]}),l.jsxs("label",{className:"addagent-field",children:[l.jsx("span",{className:"addagent-label",children:"API Key"}),l.jsx("input",{className:"addagent-input",type:"password",value:s,onChange:m=>i(m.target.value),placeholder:"以 Authorization: Bearer 方式连接"})]}),l.jsxs("label",{className:"addagent-field",children:[l.jsx("span",{className:"addagent-label",children:"显示名称(可选)"}),l.jsx("input",{className:"addagent-input",value:a,onChange:m=>o(m.target.value),placeholder:"默认取 URL 的主机名"})]}),d&&l.jsx("div",{className:"addagent-error",children:d}),l.jsxs("div",{className:"addagent-actions",children:[l.jsx("button",{className:"addagent-btn addagent-btn--ghost",onClick:t,disabled:c,children:"取消"}),l.jsxs("button",{className:"addagent-btn addagent-btn--primary",onClick:p,disabled:!h,children:[c?l.jsx(Rt,{className:"icon spin"}):null,c?"连接中…":"连接并添加"]})]})]})})}function Ln(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{}};function Wg(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Lp.prototype=Wg.prototype={constructor:Lp,on:function(e,t){var n=this._,r=pre(e+"",n),s,i=-1,a=r.length;if(arguments.length<2){for(;++i0)for(var n=new Array(s),r=0,s,i;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),p2.hasOwnProperty(t)?{space:p2[t],local:e}:e}function gre(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===vE&&t.documentElement.namespaceURI===vE?t.createElement(e):t.createElementNS(n,e)}}function yre(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function hD(e){var t=Gg(e);return(t.local?yre:gre)(t)}function bre(){}function bv(e){return e==null?bre:function(){return this.querySelector(e)}}function Ere(e){typeof e!="function"&&(e=bv(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s=b&&(b=x+1);!(k=E[b])&&++b=0;)(a=r[s])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function Vre(e){e||(e=Kre);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,r=n.length,s=new Array(r),i=0;it?1:e>=t?0:NaN}function Yre(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Wre(){return Array.from(this)}function Gre(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?ise:typeof t=="function"?ose:ase)(e,t,n??"")):Cc(this.node(),e)}function Cc(e,t){return e.style.getPropertyValue(t)||bD(e).getComputedStyle(e,null).getPropertyValue(t)}function cse(e){return function(){delete this[e]}}function use(e,t){return function(){this[e]=t}}function dse(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function fse(e,t){return arguments.length>1?this.each((t==null?cse:typeof t=="function"?dse:use)(e,t)):this.node()[e]}function ED(e){return e.trim().split(/^|\s+/)}function Ev(e){return e.classList||new xD(e)}function xD(e){this._node=e,this._names=ED(e.getAttribute("class")||"")}xD.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function wD(e,t){for(var n=Ev(e),r=-1,s=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function Use(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,i;n()=>e;function _E(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:i,x:a,y:o,dx:c,dy:u,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}_E.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Xse(e){return!e.ctrlKey&&!e.button}function Qse(){return this.parentNode}function Zse(e,t){return t??{x:e.x,y:e.y}}function Jse(){return navigator.maxTouchPoints||"ontouchstart"in this}function TD(){var e=Xse,t=Qse,n=Zse,r=Jse,s={},i=Wg("start","drag","end"),a=0,o,c,u,d,f=0;function h(_){_.on("mousedown.drag",p).filter(r).on("touchstart.drag",E).on("touchmove.drag",g,qse).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(_,k){if(!(d||!e.call(this,_,k))){var N=b(this,t.call(this,_,k),_,k,"mouse");N&&(Qr(_.view).on("mousemove.drag",m,nf).on("mouseup.drag",y,nf),ND(_.view),Hy(_),u=!1,o=_.clientX,c=_.clientY,N("start",_))}}function m(_){if(sc(_),!u){var k=_.clientX-o,N=_.clientY-c;u=k*k+N*N>f}s.mouse("drag",_)}function y(_){Qr(_.view).on("mousemove.drag mouseup.drag",null),SD(_.view,u),sc(_),s.mouse("end",_)}function E(_,k){if(e.call(this,_,k)){var N=_.changedTouches,C=t.call(this,_,k),S=N.length,A,O;for(A=0;A>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Yh(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Yh(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=tie.exec(e))?new Br(t[1],t[2],t[3],1):(t=nie.exec(e))?new Br(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=rie.exec(e))?Yh(t[1],t[2],t[3],t[4]):(t=sie.exec(e))?Yh(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=iie.exec(e))?w2(t[1],t[2]/100,t[3]/100,1):(t=aie.exec(e))?w2(t[1],t[2]/100,t[3]/100,t[4]):m2.hasOwnProperty(e)?b2(m2[e]):e==="transparent"?new Br(NaN,NaN,NaN,0):null}function b2(e){return new Br(e>>16&255,e>>8&255,e&255,1)}function Yh(e,t,n,r){return r<=0&&(e=t=n=NaN),new Br(e,t,n,r)}function cie(e){return e instanceof Pf||(e=$o(e)),e?(e=e.rgb(),new Br(e.r,e.g,e.b,e.opacity)):new Br}function kE(e,t,n,r){return arguments.length===1?cie(e):new Br(e,t,n,r??1)}function Br(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}xv(Br,kE,AD(Pf,{brighter(e){return e=e==null?Bm:Math.pow(Bm,e),new Br(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?rf:Math.pow(rf,e),new Br(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Br(Io(this.r),Io(this.g),Io(this.b),Fm(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:E2,formatHex:E2,formatHex8:uie,formatRgb:x2,toString:x2}));function E2(){return`#${wo(this.r)}${wo(this.g)}${wo(this.b)}`}function uie(){return`#${wo(this.r)}${wo(this.g)}${wo(this.b)}${wo((isNaN(this.opacity)?1:this.opacity)*255)}`}function x2(){const e=Fm(this.opacity);return`${e===1?"rgb(":"rgba("}${Io(this.r)}, ${Io(this.g)}, ${Io(this.b)}${e===1?")":`, ${e})`}`}function Fm(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Io(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function wo(e){return e=Io(e),(e<16?"0":"")+e.toString(16)}function w2(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Hs(e,t,n,r)}function CD(e){if(e instanceof Hs)return new Hs(e.h,e.s,e.l,e.opacity);if(e instanceof Pf||(e=$o(e)),!e)return new Hs;if(e instanceof Hs)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),i=Math.max(t,n,r),a=NaN,o=i-s,c=(i+s)/2;return o?(t===i?a=(n-r)/o+(n0&&c<1?0:a,new Hs(a,o,c,e.opacity)}function die(e,t,n,r){return arguments.length===1?CD(e):new Hs(e,t,n,r??1)}function Hs(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}xv(Hs,die,AD(Pf,{brighter(e){return e=e==null?Bm:Math.pow(Bm,e),new Hs(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?rf:Math.pow(rf,e),new Hs(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new Br(zy(e>=240?e-240:e+120,s,r),zy(e,s,r),zy(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new Hs(v2(this.h),Wh(this.s),Wh(this.l),Fm(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Fm(this.opacity);return`${e===1?"hsl(":"hsla("}${v2(this.h)}, ${Wh(this.s)*100}%, ${Wh(this.l)*100}%${e===1?")":`, ${e})`}`}}));function v2(e){return e=(e||0)%360,e<0?e+360:e}function Wh(e){return Math.max(0,Math.min(1,e||0))}function zy(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const wv=e=>()=>e;function fie(e,t){return function(n){return e+n*t}}function hie(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function pie(e){return(e=+e)==1?ID:function(t,n){return n-t?hie(t,n,e):wv(isNaN(t)?n:t)}}function ID(e,t){var n=t-e;return n?fie(e,n):wv(isNaN(e)?t:e)}const Um=function e(t){var n=pie(t);function r(s,i){var a=n((s=kE(s)).r,(i=kE(i)).r),o=n(s.g,i.g),c=n(s.b,i.b),u=ID(s.opacity,i.opacity);return function(d){return s.r=a(d),s.g=o(d),s.b=c(d),s.opacity=u(d),s+""}}return r.gamma=e,r}(1);function mie(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),s;return function(i){for(s=0;sn&&(i=t.slice(n,i),o[a]?o[a]+=i:o[++a]=i),(r=r[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,c.push({i:a,x:fi(r,s)})),n=Vy.lastIndex;return n180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(s(f)+"rotate(",null,r)-2,x:fi(u,d)})):d&&f.push(s(f)+"rotate("+d+r)}function o(u,d,f,h){u!==d?h.push({i:f.push(s(f)+"skewX(",null,r)-2,x:fi(u,d)}):d&&f.push(s(f)+"skewX("+d+r)}function c(u,d,f,h,p,m){if(u!==f||d!==h){var y=p.push(s(p)+"scale(",null,",",null,")");m.push({i:y-4,x:fi(u,f)},{i:y-2,x:fi(d,h)})}else(f!==1||h!==1)&&p.push(s(p)+"scale("+f+","+h+")")}return function(u,d){var f=[],h=[];return u=e(u),d=e(d),i(u.translateX,u.translateY,d.translateX,d.translateY,f,h),a(u.rotate,d.rotate,f,h),o(u.skewX,d.skewX,f,h),c(u.scaleX,u.scaleY,d.scaleX,d.scaleY,f,h),u=d=null,function(p){for(var m=-1,y=h.length,E;++m=0&&e._call.call(void 0,t),e=e._next;--Ic}function N2(){Ho=(Hm=af.now())+qg,Ic=Hu=0;try{Iie()}finally{Ic=0,Rie(),Ho=0}}function Oie(){var e=af.now(),t=e-Hm;t>MD&&(qg-=t,Hm=e)}function Rie(){for(var e,t=$m,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:$m=n);zu=e,TE(r)}function TE(e){if(!Ic){Hu&&(Hu=clearTimeout(Hu));var t=e-Ho;t>24?(e<1/0&&(Hu=setTimeout(N2,e-af.now()-qg)),Nu&&(Nu=clearInterval(Nu))):(Nu||(Hm=af.now(),Nu=setInterval(Oie,MD)),Ic=1,jD(N2))}}function S2(e,t,n){var r=new zm;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var Lie=Wg("start","end","cancel","interrupt"),Mie=[],PD=0,T2=1,AE=2,jp=3,A2=4,CE=5,Dp=6;function Xg(e,t,n,r,s,i){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;jie(e,n,{name:t,index:r,group:s,on:Lie,tween:Mie,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:PD})}function _v(e,t){var n=ti(e,t);if(n.state>PD)throw new Error("too late; already scheduled");return n}function Ni(e,t){var n=ti(e,t);if(n.state>jp)throw new Error("too late; already running");return n}function ti(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function jie(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=DD(i,0,n.time);function i(u){n.state=T2,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var d,f,h,p;if(n.state!==T2)return c();for(d in r)if(p=r[d],p.name===n.name){if(p.state===jp)return S2(a);p.state===A2?(p.state=Dp,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete r[d]):+dAE&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function dae(e,t,n){var r,s,i=uae(t)?_v:Ni;return function(){var a=i(this,e),o=a.on;o!==r&&(s=(r=o).copy()).on(t,n),a.on=s}}function fae(e,t){var n=this._id;return arguments.length<2?ti(this.node(),n).on.on(e):this.each(dae(n,e,t))}function hae(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function pae(){return this.on("end.remove",hae(this._id))}function mae(e){var t=this._name,n=this._id;typeof e!="function"&&(e=bv(e));for(var r=this._groups,s=r.length,i=new Array(s),a=0;a()=>e;function Uae(e,{sourceEvent:t,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function zi(e,t,n){this.k=e,this.x=t,this.y=n}zi.prototype={constructor:zi,scale:function(e){return e===1?this:new zi(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new zi(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Qg=new zi(1,0,0);$D.prototype=zi.prototype;function $D(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Qg;return e.__zoom}function Ky(e){e.stopImmediatePropagation()}function Su(e){e.preventDefault(),e.stopImmediatePropagation()}function $ae(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Hae(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function C2(){return this.__zoom||Qg}function zae(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Vae(){return navigator.maxTouchPoints||"ontouchstart"in this}function Kae(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function HD(){var e=$ae,t=Hae,n=Kae,r=zae,s=Vae,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],o=250,c=Mp,u=Wg("start","zoom","end"),d,f,h,p=500,m=150,y=0,E=10;function g(M){M.property("__zoom",C2).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",O).filter(s).on("touchstart.zoom",D).on("touchmove.zoom",U).on("touchend.zoom touchcancel.zoom",X).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(M,j,T,L){var R=M.selection?M.selection():M;R.property("__zoom",C2),M!==R?k(M,j,T,L):R.interrupt().each(function(){N(this,arguments).event(L).start().zoom(null,typeof j=="function"?j.apply(this,arguments):j).end()})},g.scaleBy=function(M,j,T,L){g.scaleTo(M,function(){var R=this.__zoom.k,F=typeof j=="function"?j.apply(this,arguments):j;return R*F},T,L)},g.scaleTo=function(M,j,T,L){g.transform(M,function(){var R=t.apply(this,arguments),F=this.__zoom,I=T==null?_(R):typeof T=="function"?T.apply(this,arguments):T,V=F.invert(I),W=typeof j=="function"?j.apply(this,arguments):j;return n(b(x(F,W),I,V),R,a)},T,L)},g.translateBy=function(M,j,T,L){g.transform(M,function(){return n(this.__zoom.translate(typeof j=="function"?j.apply(this,arguments):j,typeof T=="function"?T.apply(this,arguments):T),t.apply(this,arguments),a)},null,L)},g.translateTo=function(M,j,T,L,R){g.transform(M,function(){var F=t.apply(this,arguments),I=this.__zoom,V=L==null?_(F):typeof L=="function"?L.apply(this,arguments):L;return n(Qg.translate(V[0],V[1]).scale(I.k).translate(typeof j=="function"?-j.apply(this,arguments):-j,typeof T=="function"?-T.apply(this,arguments):-T),F,a)},L,R)};function x(M,j){return j=Math.max(i[0],Math.min(i[1],j)),j===M.k?M:new zi(j,M.x,M.y)}function b(M,j,T){var L=j[0]-T[0]*M.k,R=j[1]-T[1]*M.k;return L===M.x&&R===M.y?M:new zi(M.k,L,R)}function _(M){return[(+M[0][0]+ +M[1][0])/2,(+M[0][1]+ +M[1][1])/2]}function k(M,j,T,L){M.on("start.zoom",function(){N(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){N(this,arguments).event(L).end()}).tween("zoom",function(){var R=this,F=arguments,I=N(R,F).event(L),V=t.apply(R,F),W=T==null?_(V):typeof T=="function"?T.apply(R,F):T,P=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),ie=R.__zoom,G=typeof j=="function"?j.apply(R,F):j,re=c(ie.invert(W).concat(P/ie.k),G.invert(W).concat(P/G.k));return function(ue){if(ue===1)ue=G;else{var ee=re(ue),le=P/ee[2];ue=new zi(le,W[0]-ee[0]*le,W[1]-ee[1]*le)}I.zoom(null,ue)}})}function N(M,j,T){return!T&&M.__zooming||new C(M,j)}function C(M,j){this.that=M,this.args=j,this.active=0,this.sourceEvent=null,this.extent=t.apply(M,j),this.taps=0}C.prototype={event:function(M){return M&&(this.sourceEvent=M),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(M,j){return this.mouse&&M!=="mouse"&&(this.mouse[1]=j.invert(this.mouse[0])),this.touch0&&M!=="touch"&&(this.touch0[1]=j.invert(this.touch0[0])),this.touch1&&M!=="touch"&&(this.touch1[1]=j.invert(this.touch1[0])),this.that.__zoom=j,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(M){var j=Qr(this.that).datum();u.call(M,this.that,new Uae(M,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:u}),j)}};function S(M,...j){if(!e.apply(this,arguments))return;var T=N(this,j).event(M),L=this.__zoom,R=Math.max(i[0],Math.min(i[1],L.k*Math.pow(2,r.apply(this,arguments)))),F=Us(M);if(T.wheel)(T.mouse[0][0]!==F[0]||T.mouse[0][1]!==F[1])&&(T.mouse[1]=L.invert(T.mouse[0]=F)),clearTimeout(T.wheel);else{if(L.k===R)return;T.mouse=[F,L.invert(F)],Pp(this),T.start()}Su(M),T.wheel=setTimeout(I,m),T.zoom("mouse",n(b(x(L,R),T.mouse[0],T.mouse[1]),T.extent,a));function I(){T.wheel=null,T.end()}}function A(M,...j){if(h||!e.apply(this,arguments))return;var T=M.currentTarget,L=N(this,j,!0).event(M),R=Qr(M.view).on("mousemove.zoom",W,!0).on("mouseup.zoom",P,!0),F=Us(M,T),I=M.clientX,V=M.clientY;ND(M.view),Ky(M),L.mouse=[F,this.__zoom.invert(F)],Pp(this),L.start();function W(ie){if(Su(ie),!L.moved){var G=ie.clientX-I,re=ie.clientY-V;L.moved=G*G+re*re>y}L.event(ie).zoom("mouse",n(b(L.that.__zoom,L.mouse[0]=Us(ie,T),L.mouse[1]),L.extent,a))}function P(ie){R.on("mousemove.zoom mouseup.zoom",null),SD(ie.view,L.moved),Su(ie),L.event(ie).end()}}function O(M,...j){if(e.apply(this,arguments)){var T=this.__zoom,L=Us(M.changedTouches?M.changedTouches[0]:M,this),R=T.invert(L),F=T.k*(M.shiftKey?.5:2),I=n(b(x(T,F),L,R),t.apply(this,j),a);Su(M),o>0?Qr(this).transition().duration(o).call(k,I,L,M):Qr(this).call(g.transform,I,L,M)}}function D(M,...j){if(e.apply(this,arguments)){var T=M.touches,L=T.length,R=N(this,j,M.changedTouches.length===L).event(M),F,I,V,W;for(Ky(M),I=0;I`Seems like you have not used zustand provider as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},of=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],zD=["Enter"," ","Escape"],VD={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Oc;(function(e){e.Strict="strict",e.Loose="loose"})(Oc||(Oc={}));var Oo;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Oo||(Oo={}));var lf;(function(e){e.Partial="partial",e.Full="full"})(lf||(lf={}));const KD={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var va;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(va||(va={}));var Rc;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Rc||(Rc={}));var Pe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Pe||(Pe={}));const I2={[Pe.Left]:Pe.Right,[Pe.Right]:Pe.Left,[Pe.Top]:Pe.Bottom,[Pe.Bottom]:Pe.Top};function YD(e){return e===null?null:e?"valid":"invalid"}const WD=e=>"id"in e&&"source"in e&&"target"in e,Yae=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Nv=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Bf=(e,t=[0,0])=>{const{width:n,height:r}=ia(e),s=e.origin??t,i=n*s[0],a=r*s[1];return{x:e.position.x-i,y:e.position.y-a}},Wae=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,s)=>{const i=typeof s=="string";let a=!t.nodeLookup&&!i?s:void 0;t.nodeLookup&&(a=i?t.nodeLookup.get(s):Nv(s)?s:t.nodeLookup.get(s.id));const o=a?Vm(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Zg(r,o)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Jg(n)},Ff=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(s=>{(t.filter===void 0||t.filter(s))&&(n=Zg(n,Vm(s)),r=!0)}),r?Jg(n):{x:0,y:0,width:0,height:0}},Sv=(e,t,[n,r,s]=[0,0,1],i=!1,a=!1)=>{const o={...Jc(t,[n,r,s]),width:t.width/s,height:t.height/s},c=[];for(const u of e.values()){const{measured:d,selectable:f=!0,hidden:h=!1}=u;if(a&&!f||h)continue;const p=d.width??u.width??u.initialWidth??null,m=d.height??u.height??u.initialHeight??null,y=cf(o,Mc(u)),E=(p??0)*(m??0),g=i&&y>0;(!u.internals.handleBounds||g||y>=E||u.dragging)&&c.push(u)}return c},Gae=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function qae(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(s=>s.id)):null;return e.forEach(s=>{s.measured.width&&s.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!s.hidden)&&(!r||r.has(s.id))&&n.set(s.id,s)}),n}async function Xae({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:i},a){if(e.size===0)return!0;const o=qae(e,a),c=Ff(o),u=Av(c,t,n,(a==null?void 0:a.minZoom)??s,(a==null?void 0:a.maxZoom)??i,(a==null?void 0:a.padding)??.1);return await r.setViewport(u,{duration:a==null?void 0:a.duration,ease:a==null?void 0:a.ease,interpolate:a==null?void 0:a.interpolate}),!0}function GD({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:s,onError:i}){const a=n.get(e),o=a.parentId?n.get(a.parentId):void 0,{x:c,y:u}=o?o.internals.positionAbsolute:{x:0,y:0},d=a.origin??r;let f=a.extent||s;if(a.extent==="parent"&&!a.expandParent)if(!o)i==null||i("005",Zs.error005());else{const p=o.measured.width,m=o.measured.height;p&&m&&(f=[[c,u],[c+p,u+m]])}else o&&Vo(a.extent)&&(f=[[a.extent[0][0]+c,a.extent[0][1]+u],[a.extent[1][0]+c,a.extent[1][1]+u]]);const h=Vo(f)?zo(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(i==null||i("015",Zs.error015())),{position:{x:h.x-c+(a.measured.width??0)*d[0],y:h.y-u+(a.measured.height??0)*d[1]},positionAbsolute:h}}async function Qae({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const i=new Set(e.map(h=>h.id)),a=[];for(const h of n){if(h.deletable===!1)continue;const p=i.has(h.id),m=!p&&h.parentId&&a.find(y=>y.id===h.parentId);(p||m)&&a.push(h)}const o=new Set(t.map(h=>h.id)),c=r.filter(h=>h.deletable!==!1),d=Gae(a,c);for(const h of c)o.has(h.id)&&!d.find(m=>m.id===h.id)&&d.push(h);if(!s)return{edges:d,nodes:a};const f=await s({nodes:a,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:a}:{edges:[],nodes:[]}:f}const Lc=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),zo=(e={x:0,y:0},t,n)=>({x:Lc(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Lc(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function qD(e,t,n){const{width:r,height:s}=ia(n),{x:i,y:a}=n.internals.positionAbsolute;return zo(e,[[i,a],[i+r,a+s]],t)}const O2=(e,t,n)=>en?-Lc(Math.abs(e-n),1,t)/t:0,Tv=(e,t,n=15,r=40)=>{const s=O2(e.x,r,t.width-r)*n,i=O2(e.y,r,t.height-r)*n;return[s,i]},Zg=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),IE=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Jg=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Mc=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Nv(e)?e.internals.positionAbsolute:Bf(e,t);return{x:n,y:r,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},Vm=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Nv(e)?e.internals.positionAbsolute:Bf(e,t);return{x:n,y:r,x2:n+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},XD=(e,t)=>Jg(Zg(IE(e),IE(t))),cf=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},R2=e=>Vs(e.width)&&Vs(e.height)&&Vs(e.x)&&Vs(e.y),Vs=e=>!isNaN(e)&&isFinite(e),QD=(e,t)=>(n,r)=>{},Uf=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Jc=({x:e,y:t},[n,r,s],i=!1,a=[1,1])=>{const o={x:(e-n)/s,y:(t-r)/s};return i?Uf(o,a):o},jc=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function pl(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Zae(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=pl(e,n),s=pl(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=pl(e.top??e.y??0,n),s=pl(e.bottom??e.y??0,n),i=pl(e.left??e.x??0,t),a=pl(e.right??e.x??0,t);return{top:r,right:a,bottom:s,left:i,x:i+a,y:r+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Jae(e,t,n,r,s,i){const{x:a,y:o}=jc(e,[t,n,r]),{x:c,y:u}=jc({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=s-c,f=i-u;return{left:Math.floor(a),top:Math.floor(o),right:Math.floor(d),bottom:Math.floor(f)}}const Av=(e,t,n,r,s,i)=>{const a=Zae(i,t,n),o=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(o,c),d=Lc(u,r,s),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d,m=n/2-h*d,y=Jae(e,p,m,d,t,n),E={left:Math.min(y.left-a.left,0),top:Math.min(y.top-a.top,0),right:Math.min(y.right-a.right,0),bottom:Math.min(y.bottom-a.bottom,0)};return{x:p-E.left+E.right,y:m-E.top+E.bottom,zoom:d}},uf=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Vo(e){return e!=null&&e!=="parent"}function ia(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function Cv(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function ZD(e,t={width:0,height:0},n,r,s){const i={...e},a=r.get(n);if(a){const o=a.origin||s;i.x+=a.internals.positionAbsolute.x-(t.width??0)*o[0],i.y+=a.internals.positionAbsolute.y-(t.height??0)*o[1]}return i}function L2(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function eoe(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function toe(e){return{...VD,...e||{}}}function Ed(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:i,y:a}=Ks(e),o=Jc({x:i-((s==null?void 0:s.left)??0),y:a-((s==null?void 0:s.top)??0)},r),{x:c,y:u}=n?Uf(o,t):o;return{xSnapped:c,ySnapped:u,...o}}const Iv=e=>({width:e.offsetWidth,height:e.offsetHeight}),JD=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},noe=["INPUT","SELECT","TEXTAREA"];function eP(e){var r,s;const t=((s=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:s[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:noe.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const tP=e=>"clientX"in e,Ks=(e,t)=>{var i,a;const n=tP(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,s=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},M2=(e,t,n,r,s)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(a=>{const o=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:s,position:a.getAttribute("data-handlepos"),x:(o.left-n.left)/r,y:(o.top-n.top)/r,...Iv(a)}})};function nP({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:a,targetControlY:o}){const c=e*.125+s*.375+a*.375+n*.125,u=t*.125+i*.375+o*.375+r*.125,d=Math.abs(c-e),f=Math.abs(u-t);return[c,u,d,f]}function Xh(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function j2({pos:e,x1:t,y1:n,x2:r,y2:s,c:i}){switch(e){case Pe.Left:return[t-Xh(t-r,i),n];case Pe.Right:return[t+Xh(r-t,i),n];case Pe.Top:return[t,n-Xh(n-s,i)];case Pe.Bottom:return[t,n+Xh(s-n,i)]}}function rP({sourceX:e,sourceY:t,sourcePosition:n=Pe.Bottom,targetX:r,targetY:s,targetPosition:i=Pe.Top,curvature:a=.25}){const[o,c]=j2({pos:n,x1:e,y1:t,x2:r,y2:s,c:a}),[u,d]=j2({pos:i,x1:r,y1:s,x2:e,y2:t,c:a}),[f,h,p,m]=nP({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:o,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${o},${c} ${u},${d} ${r},${s}`,f,h,p,m]}function sP({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,i=n0}const ioe=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,aoe=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),ooe=(e,t,n={})=>{var i;if(!e.source||!e.target)return(i=n.onError)==null||i.call(n,"006",Zs.error006()),t;const r=n.getEdgeId||ioe;let s;return WD(e)?s={...e}:s={...e,id:r(e)},aoe(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function iP({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,i,a,o]=sP({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,i,a,o]}const D2={[Pe.Left]:{x:-1,y:0},[Pe.Right]:{x:1,y:0},[Pe.Top]:{x:0,y:-1},[Pe.Bottom]:{x:0,y:1}},loe=({source:e,sourcePosition:t=Pe.Bottom,target:n})=>t===Pe.Left||t===Pe.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function coe({source:e,sourcePosition:t=Pe.Bottom,target:n,targetPosition:r=Pe.Top,center:s,offset:i,stepPosition:a}){const o=D2[t],c=D2[r],u={x:e.x+o.x*i,y:e.y+o.y*i},d={x:n.x+c.x*i,y:n.y+c.y*i},f=loe({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",p=f[h];let m=[],y,E;const g={x:0,y:0},x={x:0,y:0},[,,b,_]=sP({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(o[h]*c[h]===-1){h==="x"?(y=s.x??u.x+(d.x-u.x)*a,E=s.y??(u.y+d.y)/2):(y=s.x??(u.x+d.x)/2,E=s.y??u.y+(d.y-u.y)*a);const S=[{x:y,y:u.y},{x:y,y:d.y}],A=[{x:u.x,y:E},{x:d.x,y:E}];o[h]===p?m=h==="x"?S:A:m=h==="x"?A:S}else{const S=[{x:u.x,y:d.y}],A=[{x:d.x,y:u.y}];if(h==="x"?m=o.x===p?A:S:m=o.y===p?S:A,t===r){const M=Math.abs(e[h]-n[h]);if(M<=i){const j=Math.min(i-1,i-M);o[h]===p?g[h]=(u[h]>e[h]?-1:1)*j:x[h]=(d[h]>n[h]?-1:1)*j}}if(t!==r){const M=h==="x"?"y":"x",j=o[h]===c[M],T=u[M]>d[M],L=u[M]=X?(y=(O.x+D.x)/2,E=m[0].y):(y=m[0].x,E=(O.y+D.y)/2)}const k={x:u.x+g.x,y:u.y+g.y},N={x:d.x+x.x,y:d.y+x.y};return[[e,...k.x!==m[0].x||k.y!==m[0].y?[k]:[],...m,...N.x!==m[m.length-1].x||N.y!==m[m.length-1].y?[N]:[],n],y,E,b,_]}function uoe(e,t,n,r){const s=Math.min(P2(e,t)/2,P2(t,n)/2,r),{x:i,y:a}=t;if(e.x===i&&i===n.x||e.y===a&&a===n.y)return`L${i} ${a}`;if(e.y===a){const u=e.xn.id===t):e[0])||null}function OE(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function foe(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:s}){const i=new Set;return e.reduce((a,o)=>([o.markerStart||r,o.markerEnd||s].forEach(c=>{if(c&&typeof c=="object"){const u=OE(c,t);i.has(u)||(a.push({id:u,color:c.color||n,...c}),i.add(u))}}),a),[]).sort((a,o)=>a.id.localeCompare(o.id))}const aP=1e3,hoe=10,Ov={nodeOrigin:[0,0],nodeExtent:of,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},poe={...Ov,checkEquality:!0};function Rv(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function moe(e,t,n){const r=Rv(Ov,n);for(const s of e.values())if(s.parentId)Mv(s,e,t,r);else{const i=Bf(s,r.nodeOrigin),a=Vo(s.extent)?s.extent:r.nodeExtent,o=zo(i,a,ia(s));s.internals.positionAbsolute=o}}function goe(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const s of e.handles){const i={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(i):s.type==="target"&&r.push(i)}return{source:n,target:r}}function Lv(e){return e==="manual"}function RE(e,t,n,r={}){var d,f;const s=Rv(poe,r),i={i:0},a=new Map(t),o=s!=null&&s.elevateNodesOnSelect&&!Lv(s.zIndexMode)?aP:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const h of e){let p=a.get(h.id);if(s.checkEquality&&h===(p==null?void 0:p.internals.userNode))t.set(h.id,p);else{const m=Bf(h,s.nodeOrigin),y=Vo(h.extent)?h.extent:s.nodeExtent,E=zo(m,y,ia(h));p={...s.defaults,...h,measured:{width:(d=h.measured)==null?void 0:d.width,height:(f=h.measured)==null?void 0:f.height},internals:{positionAbsolute:E,handleBounds:goe(h,p),z:oP(h,o,s.zIndexMode),userNode:h}},t.set(h.id,p)}(p.measured===void 0||p.measured.width===void 0||p.measured.height===void 0)&&!p.hidden&&(c=!1),h.parentId&&Mv(p,t,n,r,i),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function yoe(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Mv(e,t,n,r,s){const{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:o,zIndexMode:c}=Rv(Ov,r),u=e.parentId,d=t.get(u);if(!d){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}yoe(e,n),s&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++s.i,d.internals.z=d.internals.z+s.i*hoe),s&&d.internals.rootParentIndex!==void 0&&(s.i=d.internals.rootParentIndex);const f=i&&!Lv(c)?aP:0,{x:h,y:p,z:m}=boe(e,d,a,o,f,c),{positionAbsolute:y}=e.internals,E=h!==y.x||p!==y.y;(E||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:E?{x:h,y:p}:y,z:m}})}function oP(e,t,n){const r=Vs(e.zIndex)?e.zIndex:0;return Lv(n)?r:r+(e.selected?t:0)}function boe(e,t,n,r,s,i){const{x:a,y:o}=t.internals.positionAbsolute,c=ia(e),u=Bf(e,n),d=Vo(e.extent)?zo(u,e.extent,c):u;let f=zo({x:a+d.x,y:o+d.y},r,c);e.extent==="parent"&&(f=qD(f,c,t));const h=oP(e,s,i),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=h?p+1:h}}function jv(e,t,n,r=[0,0]){var a;const s=[],i=new Map;for(const o of e){const c=t.get(o.parentId);if(!c)continue;const u=((a=i.get(o.parentId))==null?void 0:a.expandedRect)??Mc(c),d=XD(u,o.rect);i.set(o.parentId,{expandedRect:d,parent:c})}return i.size>0&&i.forEach(({expandedRect:o,parent:c},u)=>{var b;const d=c.internals.positionAbsolute,f=ia(c),h=c.origin??r,p=o.x0||m>0||g||x)&&(s.push({id:u,type:"position",position:{x:c.position.x-p+g,y:c.position.y-m+x}}),(b=n.get(u))==null||b.forEach(_=>{e.some(k=>k.id===_.id)||s.push({id:_.id,type:"position",position:{x:_.position.x+p,y:_.position.y+m}})})),(f.width0){const p=jv(h,t,n,s);u.push(...p)}return{changes:u,updatedInternals:c}}async function xoe({delta:e,panZoom:t,transform:n,translateExtent:r,width:s,height:i}){if(!t||!e.x&&!e.y)return!1;const a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[s,i]],r);return!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2])}function $2(e,t,n,r,s,i){let a=s;const o=r.get(a)||new Map;r.set(a,o.set(n,t)),a=`${s}-${e}`;const c=r.get(a)||new Map;if(r.set(a,c.set(n,t)),i){a=`${s}-${e}-${i}`;const u=r.get(a)||new Map;r.set(a,u.set(n,t))}}function lP(e,t,n){e.clear(),t.clear();for(const r of n){const{source:s,target:i,sourceHandle:a=null,targetHandle:o=null}=r,c={edgeId:r.id,source:s,target:i,sourceHandle:a,targetHandle:o},u=`${s}-${a}--${i}-${o}`,d=`${i}-${o}--${s}-${a}`;$2("source",c,d,e,s,a),$2("target",c,u,e,i,o),t.set(r.id,r)}}function cP(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:cP(n,t):!1}function H2(e,t,n){var s;let r=e;do{if((s=r==null?void 0:r.matches)!=null&&s.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function woe(e,t,n,r){const s=new Map;for(const[i,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!cP(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){const o=e.get(i);o&&s.set(i,{id:i,position:o.position||{x:0,y:0},distance:{x:n.x-o.internals.positionAbsolute.x,y:n.y-o.internals.positionAbsolute.y},extent:o.extent,parentId:o.parentId,origin:o.origin,expandParent:o.expandParent,internals:{positionAbsolute:o.internals.positionAbsolute||{x:0,y:0}},measured:{width:o.measured.width??0,height:o.measured.height??0}})}return s}function Yy({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var a,o,c;const s=[];for(const[u,d]of t){const f=(a=n.get(u))==null?void 0:a.internals.userNode;f&&s.push({...f,position:d.position,dragging:r})}if(!e)return[s[0],s];const i=(o=n.get(e))==null?void 0:o.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:r}:s[0],s]}function voe({dragItems:e,snapGrid:t,x:n,y:r}){const s=e.values().next().value;if(!s)return null;const i={x:n-s.distance.x,y:r-s.distance.y},a=Uf(i,t);return{x:a.x-i.x,y:a.y-i.y}}function _oe({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let i={x:null,y:null},a=0,o=new Map,c=!1,u={x:0,y:0},d=null,f=!1,h=null,p=!1,m=!1,y=null;function E({noDragClassName:x,handleSelector:b,domNode:_,isSelectable:k,nodeId:N,nodeClickDistance:C=0}){h=Qr(_);function S({x:U,y:X}){const{nodeLookup:M,nodeExtent:j,snapGrid:T,snapToGrid:L,nodeOrigin:R,onNodeDrag:F,onSelectionDrag:I,onError:V,updateNodePositions:W}=t();i={x:U,y:X};let P=!1;const ie=o.size>1,G=ie&&j?IE(Ff(o)):null,re=ie&&L?voe({dragItems:o,snapGrid:T,x:U,y:X}):null;for(const[ue,ee]of o){if(!M.has(ue))continue;let le={x:U-ee.distance.x,y:X-ee.distance.y};L&&(le=re?{x:Math.round(le.x+re.x),y:Math.round(le.y+re.y)}:Uf(le,T));let ne=null;if(ie&&j&&!ee.extent&&G){const{positionAbsolute:te}=ee.internals,de=te.x-G.x+j[0][0],Ee=te.x+ee.measured.width-G.x2+j[1][0],Te=te.y-G.y+j[0][1],Ke=te.y+ee.measured.height-G.y2+j[1][1];ne=[[de,Te],[Ee,Ke]]}const{position:me,positionAbsolute:ye}=GD({nodeId:ue,nextPosition:le,nodeLookup:M,nodeExtent:ne||j,nodeOrigin:R,onError:V});P=P||ee.position.x!==me.x||ee.position.y!==me.y,ee.position=me,ee.internals.positionAbsolute=ye}if(m=m||P,!!P&&(W(o,!0),y&&(r||F||!N&&I))){const[ue,ee]=Yy({nodeId:N,dragItems:o,nodeLookup:M});r==null||r(y,o,ue,ee),F==null||F(y,ue,ee),N||I==null||I(y,ee)}}async function A(){if(!d)return;const{transform:U,panBy:X,autoPanSpeed:M,autoPanOnNodeDrag:j}=t();if(!j){c=!1,cancelAnimationFrame(a);return}const[T,L]=Tv(u,d,M);(T!==0||L!==0)&&(i.x=(i.x??0)-T/U[2],i.y=(i.y??0)-L/U[2],await X({x:T,y:L})&&S(i)),a=requestAnimationFrame(A)}function O(U){var ie;const{nodeLookup:X,multiSelectionActive:M,nodesDraggable:j,transform:T,snapGrid:L,snapToGrid:R,selectNodesOnDrag:F,onNodeDragStart:I,onSelectionDragStart:V,unselectNodesAndEdges:W}=t();f=!0,(!F||!k)&&!M&&N&&((ie=X.get(N))!=null&&ie.selected||W()),k&&F&&N&&(e==null||e(N));const P=Ed(U.sourceEvent,{transform:T,snapGrid:L,snapToGrid:R,containerBounds:d});if(i=P,o=woe(X,j,P,N),o.size>0&&(n||I||!N&&V)){const[G,re]=Yy({nodeId:N,dragItems:o,nodeLookup:X});n==null||n(U.sourceEvent,o,G,re),I==null||I(U.sourceEvent,G,re),N||V==null||V(U.sourceEvent,re)}}const D=TD().clickDistance(C).on("start",U=>{const{domNode:X,nodeDragThreshold:M,transform:j,snapGrid:T,snapToGrid:L}=t();d=(X==null?void 0:X.getBoundingClientRect())||null,p=!1,m=!1,y=U.sourceEvent,M===0&&O(U),i=Ed(U.sourceEvent,{transform:j,snapGrid:T,snapToGrid:L,containerBounds:d}),u=Ks(U.sourceEvent,d)}).on("drag",U=>{const{autoPanOnNodeDrag:X,transform:M,snapGrid:j,snapToGrid:T,nodeDragThreshold:L,nodeLookup:R}=t(),F=Ed(U.sourceEvent,{transform:M,snapGrid:j,snapToGrid:T,containerBounds:d});if(y=U.sourceEvent,(U.sourceEvent.type==="touchmove"&&U.sourceEvent.touches.length>1||N&&!R.has(N))&&(p=!0),!p){if(!c&&X&&f&&(c=!0,A()),!f){const I=Ks(U.sourceEvent,d),V=I.x-u.x,W=I.y-u.y;Math.sqrt(V*V+W*W)>L&&O(U)}(i.x!==F.xSnapped||i.y!==F.ySnapped)&&o&&f&&(u=Ks(U.sourceEvent,d),S(F))}}).on("end",U=>{if(!f||p){p&&o.size>0&&t().updateNodePositions(o,!1);return}if(c=!1,f=!1,cancelAnimationFrame(a),o.size>0){const{nodeLookup:X,updateNodePositions:M,onNodeDragStop:j,onSelectionDragStop:T}=t();if(m&&(M(o,!1),m=!1),s||j||!N&&T){const[L,R]=Yy({nodeId:N,dragItems:o,nodeLookup:X,dragging:!1});s==null||s(U.sourceEvent,o,L,R),j==null||j(U.sourceEvent,L,R),N||T==null||T(U.sourceEvent,R)}}}).filter(U=>{const X=U.target;return!U.button&&(!x||!H2(X,`.${x}`,_))&&(!b||H2(X,b,_))});h.call(D)}function g(){h==null||h.on(".drag",null)}return{update:E,destroy:g}}function koe(e,t,n){const r=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())cf(s,Mc(i))>0&&r.push(i);return r}const Noe=250;function Soe(e,t,n,r){var o,c;let s=[],i=1/0;const a=koe(e,n,t+Noe);for(const u of a){const d=[...((o=u.internals.handleBounds)==null?void 0:o.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of d){if(r.nodeId===f.nodeId&&r.type===f.type&&r.id===f.id)continue;const{x:h,y:p}=Ko(u,f,f.position,!0),m=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(p-e.y,2));m>t||(m1){const u=r.type==="source"?"target":"source";return s.find(d=>d.type===u)??s[0]}return s[0]}function uP(e,t,n,r,s,i=!1){var u,d,f;const a=r.get(e);if(!a)return null;const o=s==="strict"?(u=a.internals.handleBounds)==null?void 0:u[t]:[...((d=a.internals.handleBounds)==null?void 0:d.source)??[],...((f=a.internals.handleBounds)==null?void 0:f.target)??[]],c=(n?o==null?void 0:o.find(h=>h.id===n):o==null?void 0:o[0])??null;return c&&i?{...c,...Ko(a,c,c.position,!0)}:c}function dP(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Toe(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const fP=()=>!0;function Aoe(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:i,isTarget:a,domNode:o,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:p,onConnectStart:m,onConnect:y,onConnectEnd:E,isValidConnection:g=fP,onReconnectEnd:x,updateConnection:b,getTransform:_,getFromHandle:k,autoPanSpeed:N,dragThreshold:C=1,handleDomNode:S}){const A=JD(e.target);let O=0,D;const{x:U,y:X}=Ks(e),M=dP(i,S),j=o==null?void 0:o.getBoundingClientRect();let T=!1;if(!j||!M)return;const L=uP(s,M,r,c,t);if(!L)return;let R=Ks(e,j),F=!1,I=null,V=!1,W=null;function P(){if(!d||!j)return;const[me,ye]=Tv(R,j,N);h({x:me,y:ye}),O=requestAnimationFrame(P)}const ie={...L,nodeId:s,type:M,position:L.position},G=c.get(s);let ue={inProgress:!0,isValid:null,from:Ko(G,ie,Pe.Left,!0),fromHandle:ie,fromPosition:ie.position,fromNode:G,to:R,toHandle:null,toPosition:I2[ie.position],toNode:null,pointer:R};function ee(){T=!0,b(ue),m==null||m(e,{nodeId:s,handleId:r,handleType:M})}C===0&&ee();function le(me){if(!T){const{x:Ke,y:Ne}=Ks(me),it=Ke-U,He=Ne-X;if(!(it*it+He*He>C*C))return;ee()}if(!k()||!ie){ne(me);return}const ye=_();R=Ks(me,j),D=Soe(Jc(R,ye,!1,[1,1]),n,c,ie),F||(P(),F=!0);const te=hP(me,{handle:D,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:a?"target":"source",isValidConnection:g,doc:A,lib:u,flowId:f,nodeLookup:c});W=te.handleDomNode,I=te.connection,V=Toe(!!D,te.isValid);const de=c.get(s),Ee=de?Ko(de,ie,Pe.Left,!0):ue.from,Te={...ue,from:Ee,isValid:V,to:te.toHandle&&V?jc({x:te.toHandle.x,y:te.toHandle.y},ye):R,toHandle:te.toHandle,toPosition:V&&te.toHandle?te.toHandle.position:I2[ie.position],toNode:te.toHandle?c.get(te.toHandle.nodeId):null,pointer:R};b(Te),ue=Te}function ne(me){if(!("touches"in me&&me.touches.length>0)){if(T){(D||W)&&I&&V&&(y==null||y(I));const{inProgress:ye,...te}=ue,de={...te,toPosition:ue.toHandle?ue.toPosition:null};E==null||E(me,de),i&&(x==null||x(me,de))}p(),cancelAnimationFrame(O),F=!1,V=!1,I=null,W=null,A.removeEventListener("mousemove",le),A.removeEventListener("mouseup",ne),A.removeEventListener("touchmove",le),A.removeEventListener("touchend",ne)}}A.addEventListener("mousemove",le),A.addEventListener("mouseup",ne),A.addEventListener("touchmove",le),A.addEventListener("touchend",ne)}function hP(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:i,doc:a,lib:o,flowId:c,isValidConnection:u=fP,nodeLookup:d}){const f=i==="target",h=t?a.querySelector(`.${o}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:p,y:m}=Ks(e),y=a.elementFromPoint(p,m),E=y!=null&&y.classList.contains(`${o}-flow__handle`)?y:h,g={handleDomNode:E,isValid:!1,connection:null,toHandle:null};if(E){const x=dP(void 0,E),b=E.getAttribute("data-nodeid"),_=E.getAttribute("data-handleid"),k=E.classList.contains("connectable"),N=E.classList.contains("connectableend");if(!b||!x)return g;const C={source:f?b:r,sourceHandle:f?_:s,target:f?r:b,targetHandle:f?s:_};g.connection=C;const A=k&&N&&(n===Oc.Strict?f&&x==="source"||!f&&x==="target":b!==r||_!==s);g.isValid=A&&u(C),g.toHandle=uP(b,x,_,d,n,!0)}return g}const LE={onPointerDown:Aoe,isValid:hP};function Coe({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=Qr(e);function i({translateExtent:o,width:c,height:u,zoomStep:d=1,pannable:f=!0,zoomable:h=!0,inversePan:p=!1}){const m=b=>{if(b.sourceEvent.type!=="wheel"||!t)return;const _=n(),k=b.sourceEvent.ctrlKey&&uf()?10:1,N=-b.sourceEvent.deltaY*(b.sourceEvent.deltaMode===1?.05:b.sourceEvent.deltaMode?1:.002)*d,C=_[2]*Math.pow(2,N*k);t.scaleTo(C)};let y=[0,0];const E=b=>{(b.sourceEvent.type==="mousedown"||b.sourceEvent.type==="touchstart")&&(y=[b.sourceEvent.clientX??b.sourceEvent.touches[0].clientX,b.sourceEvent.clientY??b.sourceEvent.touches[0].clientY])},g=b=>{const _=n();if(b.sourceEvent.type!=="mousemove"&&b.sourceEvent.type!=="touchmove"||!t)return;const k=[b.sourceEvent.clientX??b.sourceEvent.touches[0].clientX,b.sourceEvent.clientY??b.sourceEvent.touches[0].clientY],N=[k[0]-y[0],k[1]-y[1]];y=k;const C=r()*Math.max(_[2],Math.log(_[2]))*(p?-1:1),S={x:_[0]-N[0]*C,y:_[1]-N[1]*C},A=[[0,0],[c,u]];t.setViewportConstrained({x:S.x,y:S.y,zoom:_[2]},A,o)},x=HD().on("start",E).on("zoom",f?g:null).on("zoom.wheel",h?m:null);s.call(x,{})}function a(){s.on("zoom",null)}return{update:i,destroy:a,pointer:Us}}const e0=e=>({x:e.x,y:e.y,zoom:e.k}),Wy=({x:e,y:t,zoom:n})=>Qg.translate(e,t).scale(n),Hl=(e,t)=>e.target.closest(`.${t}`),pP=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Ioe=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Gy=(e,t=0,n=Ioe,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},mP=e=>{const t=e.ctrlKey&&uf()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Ooe({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:o,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(Hl(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&a){const E=Us(d),g=mP(d),x=f*Math.pow(2,g);r.scaleTo(n,x,E,d);return}const h=d.deltaMode===1?20:1;let p=s===Oo.Vertical?0:d.deltaX*h,m=s===Oo.Horizontal?0:d.deltaY*h;!uf()&&d.shiftKey&&s!==Oo.Vertical&&(p=d.deltaY*h,m=0),r.translateBy(n,-(p/f)*i,-(m/f)*i,{internal:!0});const y=e0(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,y),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,y),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,o==null||o(d,y))}}function Roe({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const i=r.type==="wheel",a=!t&&i&&!r.ctrlKey,o=Hl(r,e);if(r.ctrlKey&&i&&o&&r.preventDefault(),a||o)return null;r.preventDefault(),n.call(this,r,s)}}function Loe({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,a,o;if((i=r.sourceEvent)!=null&&i.internal)return;const s=e0(r.transform);e.mouseButton=((a=r.sourceEvent)==null?void 0:a.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((o=r.sourceEvent)==null?void 0:o.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,s))}}function Moe({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return i=>{var a,o;e.usedRightMouseButton=!!(n&&pP(t,e.mouseButton??0)),(a=i.sourceEvent)!=null&&a.sync||r([i.transform.x,i.transform.y,i.transform.k]),s&&!((o=i.sourceEvent)!=null&&o.internal)&&(s==null||s(i.sourceEvent,e0(i.transform)))}}function joe({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:s,onPaneContextMenu:i}){return a=>{var o;if(!((o=a.sourceEvent)!=null&&o.internal)&&(e.isZoomingOrPanning=!1,i&&pP(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const c=e0(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(a.sourceEvent,c)},n?150:0)}}}function Doe({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:o,noPanClassName:c,lib:u,connectionInProgress:d}){return f=>{var E;const h=e||t,p=n&&f.ctrlKey,m=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(Hl(f,`${u}-flow__node`)||Hl(f,`${u}-flow__edge`)))return!0;if(!r&&!h&&!s&&!i&&!n||a||d&&!m||Hl(f,o)&&m||Hl(f,c)&&(!m||s&&m&&!e)||!n&&f.ctrlKey&&m)return!1;if(!n&&f.type==="touchstart"&&((E=f.touches)==null?void 0:E.length)>1)return f.preventDefault(),!1;if(!h&&!s&&!p&&m||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const y=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||m)&&y}}function Poe({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:s,onPanZoom:i,onPanZoomStart:a,onPanZoomEnd:o,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),f=HD().scaleExtent([t,n]).translateExtent(r),h=Qr(e).call(f);x({x:s.x,y:s.y,zoom:Lc(s.zoom,t,n)},[[0,0],[d.width,d.height]],r);const p=h.on("wheel.zoom"),m=h.on("dblclick.zoom");f.wheelDelta(mP);async function y(D,U){return h?new Promise(X=>{f==null||f.interpolate((U==null?void 0:U.interpolate)==="linear"?bd:Mp).transform(Gy(h,U==null?void 0:U.duration,U==null?void 0:U.ease,()=>X(!0)),D)}):!1}function E({noWheelClassName:D,noPanClassName:U,onPaneContextMenu:X,userSelectionActive:M,panOnScroll:j,panOnDrag:T,panOnScrollMode:L,panOnScrollSpeed:R,preventScrolling:F,zoomOnPinch:I,zoomOnScroll:V,zoomOnDoubleClick:W,zoomActivationKeyPressed:P,lib:ie,onTransformChange:G,connectionInProgress:re,paneClickDistance:ue,selectionOnDrag:ee}){M&&!u.isZoomingOrPanning&&g();const le=j&&!P&&!M;f.clickDistance(ee?1/0:!Vs(ue)||ue<0?0:ue);const ne=le?Ooe({zoomPanValues:u,noWheelClassName:D,d3Selection:h,d3Zoom:f,panOnScrollMode:L,panOnScrollSpeed:R,zoomOnPinch:I,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:o}):Roe({noWheelClassName:D,preventScrolling:F,d3ZoomHandler:p});h.on("wheel.zoom",ne,{passive:!1});const me=Loe({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});f.on("start",me);const ye=Moe({zoomPanValues:u,panOnDrag:T,onPaneContextMenu:!!X,onPanZoom:i,onTransformChange:G});f.on("zoom",ye);const te=joe({zoomPanValues:u,panOnDrag:T,panOnScroll:j,onPaneContextMenu:X,onPanZoomEnd:o,onDraggingChange:c});f.on("end",te);const de=Doe({zoomActivationKeyPressed:P,panOnDrag:T,zoomOnScroll:V,panOnScroll:j,zoomOnDoubleClick:W,zoomOnPinch:I,userSelectionActive:M,noPanClassName:U,noWheelClassName:D,lib:ie,connectionInProgress:re});f.filter(de),W?h.on("dblclick.zoom",m):h.on("dblclick.zoom",null)}function g(){f.on("zoom",null)}async function x(D,U,X){const M=Wy(D),j=f==null?void 0:f.constrain()(M,U,X);return j&&await y(j),j}async function b(D,U){const X=Wy(D);return await y(X,U),X}function _(D){if(h){const U=Wy(D),X=h.property("__zoom");(X.k!==D.zoom||X.x!==D.x||X.y!==D.y)&&(f==null||f.transform(h,U,null,{sync:!0}))}}function k(){const D=h?$D(h.node()):{x:0,y:0,k:1};return{x:D.x,y:D.y,zoom:D.k}}async function N(D,U){return h?new Promise(X=>{f==null||f.interpolate((U==null?void 0:U.interpolate)==="linear"?bd:Mp).scaleTo(Gy(h,U==null?void 0:U.duration,U==null?void 0:U.ease,()=>X(!0)),D)}):!1}async function C(D,U){return h?new Promise(X=>{f==null||f.interpolate((U==null?void 0:U.interpolate)==="linear"?bd:Mp).scaleBy(Gy(h,U==null?void 0:U.duration,U==null?void 0:U.ease,()=>X(!0)),D)}):!1}function S(D){f==null||f.scaleExtent(D)}function A(D){f==null||f.translateExtent(D)}function O(D){const U=!Vs(D)||D<0?0:D;f==null||f.clickDistance(U)}return{update:E,destroy:g,setViewport:b,setViewportConstrained:x,getViewport:k,scaleTo:N,scaleBy:C,setScaleExtent:S,setTranslateExtent:A,syncViewport:_,setClickDistance:O}}var Dc;(function(e){e.Line="line",e.Handle="handle"})(Dc||(Dc={}));function Boe({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:s,affectsY:i}){const a=e-t,o=n-r,c=[a>0?1:a<0?-1:0,o>0?1:o<0?-1:0];return a&&s&&(c[0]=c[0]*-1),o&&i&&(c[1]=c[1]*-1),c}function z2(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),s=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:s}}function ua(e,t){return Math.max(0,t-e)}function da(e,t){return Math.max(0,e-t)}function Qh(e,t,n){return Math.max(0,t-e,e-n)}function V2(e,t){return e?!t:t}function Foe(e,t,n,r,s,i,a,o){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:f}=t,h=d&&f,{xSnapped:p,ySnapped:m}=n,{minWidth:y,maxWidth:E,minHeight:g,maxHeight:x}=r,{x:b,y:_,width:k,height:N,aspectRatio:C}=e;let S=Math.floor(d?p-e.pointerX:0),A=Math.floor(f?m-e.pointerY:0);const O=k+(c?-S:S),D=N+(u?-A:A),U=-i[0]*k,X=-i[1]*N;let M=Qh(O,y,E),j=Qh(D,g,x);if(a){let R=0,F=0;c&&S<0?R=ua(b+S+U,a[0][0]):!c&&S>0&&(R=da(b+O+U,a[1][0])),u&&A<0?F=ua(_+A+X,a[0][1]):!u&&A>0&&(F=da(_+D+X,a[1][1])),M=Math.max(M,R),j=Math.max(j,F)}if(o){let R=0,F=0;c&&S>0?R=da(b+S,o[0][0]):!c&&S<0&&(R=ua(b+O,o[1][0])),u&&A>0?F=da(_+A,o[0][1]):!u&&A<0&&(F=ua(_+D,o[1][1])),M=Math.max(M,R),j=Math.max(j,F)}if(s){if(d){const R=Qh(O/C,g,x)*C;if(M=Math.max(M,R),a){let F=0;!c&&!u||c&&!u&&h?F=da(_+X+O/C,a[1][1])*C:F=ua(_+X+(c?S:-S)/C,a[0][1])*C,M=Math.max(M,F)}if(o){let F=0;!c&&!u||c&&!u&&h?F=ua(_+O/C,o[1][1])*C:F=da(_+(c?S:-S)/C,o[0][1])*C,M=Math.max(M,F)}}if(f){const R=Qh(D*C,y,E)/C;if(j=Math.max(j,R),a){let F=0;!c&&!u||u&&!c&&h?F=da(b+D*C+U,a[1][0])/C:F=ua(b+(u?A:-A)*C+U,a[0][0])/C,j=Math.max(j,F)}if(o){let F=0;!c&&!u||u&&!c&&h?F=ua(b+D*C,o[1][0])/C:F=da(b+(u?A:-A)*C,o[0][0])/C,j=Math.max(j,F)}}}A=A+(A<0?j:-j),S=S+(S<0?M:-M),s&&(h?O>D*C?A=(V2(c,u)?-S:S)/C:S=(V2(c,u)?-A:A)*C:d?(A=S/C,u=c):(S=A*C,c=u));const T=c?b+S:b,L=u?_+A:_;return{width:k+(c?-S:S),height:N+(u?-A:A),x:i[0]*S*(c?-1:1)+T,y:i[1]*A*(u?-1:1)+L}}const gP={width:0,height:0,x:0,y:0},Uoe={...gP,pointerX:0,pointerY:0,aspectRatio:1};function $oe(e,t,n){const r=t.position.x+e.position.x,s=t.position.y+e.position.y,i=e.measured.width??0,a=e.measured.height??0,o=n[0]*i,c=n[1]*a;return[[r-o,s-c],[r+i-o,s+a-c]]}function Hoe({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const i=Qr(e);let a={controlDirection:z2("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function o({controlPosition:u,boundaries:d,keepAspectRatio:f,resizeDirection:h,onResizeStart:p,onResize:m,onResizeEnd:y,shouldResize:E}){let g={...gP},x={...Uoe};a={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:z2(u)};let b,_=null,k=[],N,C,S,A=!1;const O=TD().on("start",D=>{const{nodeLookup:U,transform:X,snapGrid:M,snapToGrid:j,nodeOrigin:T,paneDomNode:L}=n();if(b=U.get(t),!b)return;_=(L==null?void 0:L.getBoundingClientRect())??null;const{xSnapped:R,ySnapped:F}=Ed(D.sourceEvent,{transform:X,snapGrid:M,snapToGrid:j,containerBounds:_});g={width:b.measured.width??0,height:b.measured.height??0,x:b.position.x??0,y:b.position.y??0},x={...g,pointerX:R,pointerY:F,aspectRatio:g.width/g.height},N=void 0,C=Vo(b.extent)?b.extent:void 0,b.parentId&&(b.extent==="parent"||b.expandParent)&&(N=U.get(b.parentId)),N&&b.extent==="parent"&&(C=[[0,0],[N.measured.width,N.measured.height]]),k=[],S=void 0;for(const[I,V]of U)if(V.parentId===t&&(k.push({id:I,position:{...V.position},extent:V.extent}),V.extent==="parent"||V.expandParent)){const W=$oe(V,b,V.origin??T);S?S=[[Math.min(W[0][0],S[0][0]),Math.min(W[0][1],S[0][1])],[Math.max(W[1][0],S[1][0]),Math.max(W[1][1],S[1][1])]]:S=W}p==null||p(D,{...g})}).on("drag",D=>{const{transform:U,snapGrid:X,snapToGrid:M,nodeOrigin:j}=n(),T=Ed(D.sourceEvent,{transform:U,snapGrid:X,snapToGrid:M,containerBounds:_}),L=[];if(!b)return;const{x:R,y:F,width:I,height:V}=g,W={},P=b.origin??j,{width:ie,height:G,x:re,y:ue}=Foe(x,a.controlDirection,T,a.boundaries,a.keepAspectRatio,P,C,S),ee=ie!==I,le=G!==V,ne=re!==R&&ee,me=ue!==F&≤if(!ne&&!me&&!ee&&!le)return;if((ne||me||P[0]===1||P[1]===1)&&(W.x=ne?re:g.x,W.y=me?ue:g.y,g.x=W.x,g.y=W.y,k.length>0)){const Ee=re-R,Te=ue-F;for(const Ke of k)Ke.position={x:Ke.position.x-Ee+P[0]*(ie-I),y:Ke.position.y-Te+P[1]*(G-V)},L.push(Ke)}if((ee||le)&&(W.width=ee&&(!a.resizeDirection||a.resizeDirection==="horizontal")?ie:g.width,W.height=le&&(!a.resizeDirection||a.resizeDirection==="vertical")?G:g.height,g.width=W.width,g.height=W.height),N&&b.expandParent){const Ee=P[0]*(W.width??0);W.x&&W.x{A&&(y==null||y(D,{...g}),s==null||s({...g}),A=!1)});i.call(O)}function c(){i.on(".drag",null)}return{update:o,destroy:c}}var yP={exports:{}},bP={},EP={exports:{}},xP={};/** +`,4);return n>=0?t.slice(n+5).trimStart():e}function ore({className:e="icon"}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[l.jsx("path",{d:"M6.25 4.75h8.6l2.9 2.9v11.6h-11.5z",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),l.jsx("path",{d:"M14.75 4.9v3h2.85M8.9 11.1h4.2M8.9 14h5.7",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),l.jsx("path",{d:"m17.85 13.85.42 1.13 1.13.42-1.13.42-.42 1.13-.42-1.13-1.13-.42 1.13-.42z",fill:"currentColor"})]})}function lre(){return l.jsx("svg",{className:"icon",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:l.jsx("path",{d:"m7.5 7.5 9 9m0-9-9 9",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function u2({direction:e}){return l.jsx("svg",{className:"icon",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,children:l.jsx("path",{d:e==="left"?"m11.7 5.5-4.2 4.5 4.2 4.5":"m8.3 5.5 4.2 4.5-4.2 4.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function xE(){return l.jsx("span",{className:"skillcenter-loading-mark","aria-hidden":!0})}function d2({page:e,total:t,pageSize:n,onPage:r}){const s=Math.max(1,Math.ceil(t/n));return l.jsxs("footer",{className:"skillcenter-pager",children:[l.jsxs("span",{children:["共 ",t," 项"]}),l.jsxs("div",{className:"skillcenter-pager-actions",children:[l.jsx("button",{type:"button",onClick:()=>r(e-1),disabled:e<=1,"aria-label":"上一页",children:l.jsx(u2,{direction:"left"})}),l.jsxs("span",{children:[e," / ",s]}),l.jsx("button",{type:"button",onClick:()=>r(e+1),disabled:e>=s,"aria-label":"下一页",children:l.jsx(u2,{direction:"right"})})]})]})}function Op({children:e}){return l.jsx("div",{className:"skillcenter-empty",children:e})}function cre({skill:e,space:t,region:n,detail:r,loading:s,error:i,onClose:a}){return w.useEffect(()=>{const o=c=>{c.key==="Escape"&&a()};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[a]),l.jsx("div",{className:"skill-detail-backdrop",role:"presentation",onMouseDown:a,children:l.jsxs("section",{className:"skill-detail-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"skill-detail-title",onMouseDown:o=>o.stopPropagation(),children:[l.jsxs("header",{className:"skill-detail-head",children:[l.jsxs("div",{className:"skill-detail-heading",children:[l.jsx("span",{className:"skillcenter-symbol skillcenter-symbol--skill",children:l.jsx(ore,{})}),l.jsxs("div",{children:[l.jsx("h2",{id:"skill-detail-title",children:(r==null?void 0:r.name)||e.skillName}),l.jsx("p",{children:(r==null?void 0:r.description)||e.skillDescription||"暂无描述"})]})]}),l.jsx("button",{type:"button",className:"skill-detail-close",onClick:a,"aria-label":"关闭技能详情",children:l.jsx(lre,{})})]}),l.jsxs("dl",{className:"skill-detail-meta",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"技能 ID"}),l.jsx("dd",{title:e.skillId,children:e.skillId})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"版本"}),l.jsx("dd",{children:(r==null?void 0:r.version)||e.version||"—"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"状态"}),l.jsx("dd",{children:EE(e.skillStatus)})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"技能空间"}),l.jsx("dd",{title:t.name,children:t.name})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"Project"}),l.jsx("dd",{title:t.projectName||"default",children:t.projectName||"default"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"地域"}),l.jsx("dd",{children:n==="cn-beijing"?"北京":"上海"})]})]}),l.jsxs("div",{className:"skill-detail-content",children:[l.jsx("div",{className:"skill-detail-content-title",children:"SKILL.md"}),s?l.jsxs("div",{className:"skillcenter-loading",children:[l.jsx(xE,{}),"正在读取技能内容…"]}):i?l.jsx("div",{className:"skillcenter-error",children:i}):r!=null&&r.skillMd?l.jsx(Mf,{text:are(r.skillMd),className:"skill-detail-markdown",allowRawHtml:!1}):l.jsx(Op,{children:"该技能暂无 SKILL.md 内容"})]})]})})}function ure(){const[e,t]=w.useState("cn-beijing"),[n,r]=w.useState([]),[s,i]=w.useState(1),[a,o]=w.useState(0),[c,u]=w.useState(!1),[d,f]=w.useState(""),[h,p]=w.useState(null),[m,y]=w.useState([]),[E,g]=w.useState(1),[x,b]=w.useState(0),[_,k]=w.useState(!1),[N,C]=w.useState(""),[S,A]=w.useState(null),[O,D]=w.useState(null),[U,X]=w.useState(!1),[M,j]=w.useState(""),T=w.useRef(0);w.useEffect(()=>{let V=!0;return u(!0),f(""),hV({region:e,page:s,pageSize:o2}).then(W=>{if(!V)return;const P=W.items||[];r(P),o(W.totalCount||0),p(ie=>P.find(G=>G.id===(ie==null?void 0:ie.id))||null)}).catch(W=>{V&&(r([]),o(0),p(null),f(W instanceof Error?W.message:"读取技能空间失败,请稍后重试"))}).finally(()=>{V&&u(!1)}),()=>{V=!1}},[e,s]),w.useEffect(()=>{if(!h){y([]),b(0);return}let V=!0;return k(!0),C(""),pV(h.id,{region:e,page:E,pageSize:l2,project:h.projectName}).then(W=>{V&&(y(W.items||[]),b(W.totalCount||0))}).catch(W=>{V&&(y([]),b(0),C(W instanceof Error?W.message:"读取技能失败,请稍后重试"))}).finally(()=>{V&&k(!1)}),()=>{V=!1}},[e,h,E]);const L=V=>{V!==e&&(F(),t(V),i(1),g(1),p(null),y([]))},R=V=>{F(),p(V),g(1)},F=()=>{T.current+=1,A(null),D(null),j(""),X(!1)},I=async V=>{if(!h)return;const W=T.current+1;T.current=W,A(V),D(null),j(""),X(!0);try{const P=await mV(h.id,V.skillId,V.version,e,h.projectName);T.current===W&&D(P)}catch(P){T.current===W&&j(P instanceof Error?P.message:"读取技能详情失败,请稍后重试")}finally{T.current===W&&X(!1)}};return l.jsxs("section",{className:"skillcenter",children:[l.jsxs("div",{className:"skillcenter-browser",children:[l.jsxs("section",{className:"skillcenter-panel","aria-label":"技能空间列表",children:[l.jsxs("header",{className:"skillcenter-panel-head",children:[l.jsxs("div",{children:[l.jsx("h2",{children:"技能空间"}),l.jsx("span",{className:"skillcenter-count-badge",children:a})]}),l.jsxs("div",{className:"skillcenter-regions","aria-label":"地域",children:[l.jsx("button",{type:"button",className:e==="cn-beijing"?"active":"",onClick:()=>L("cn-beijing"),children:"北京"}),l.jsx("button",{type:"button",className:e==="cn-shanghai"?"active":"",onClick:()=>L("cn-shanghai"),children:"上海"})]})]}),l.jsxs("div",{className:"skillcenter-listwrap",children:[c&&l.jsxs("div",{className:"skillcenter-loading skillcenter-loading--overlay",children:[l.jsx(xE,{}),"正在读取技能空间…"]}),d?l.jsx("div",{className:"skillcenter-error",children:d}):n.length===0&&!c?l.jsx(Op,{children:"当前地域暂无可访问的技能空间"}):l.jsx("div",{className:"skillcenter-list",children:n.map(V=>l.jsx("button",{type:"button",className:`skillcenter-space-item ${(h==null?void 0:h.id)===V.id?"active":""}`,onClick:()=>R(V),children:l.jsxs("span",{className:"skillcenter-item-body",children:[l.jsx("span",{className:"skillcenter-item-title",title:V.name,children:V.name}),l.jsx("span",{className:"skillcenter-item-description",children:V.description||"暂无描述"}),l.jsxs("span",{className:"skillcenter-item-meta",children:[l.jsx("span",{className:`skillcenter-status ${c2(V.status)}`,children:EE(V.status)}),l.jsxs("span",{className:"skillcenter-meta-text",title:V.projectName||"default",children:["Project · ",V.projectName||"default"]}),l.jsxs("span",{className:"skillcenter-meta-text",children:[V.skillCount??0," 个技能"]}),V.updatedAt&&l.jsxs("span",{className:"skillcenter-meta-text",children:["更新于 ",ire(V.updatedAt)]})]})]})},`${V.projectName||"default"}:${V.id}`))})]}),l.jsx(d2,{page:s,total:a,pageSize:o2,onPage:i})]}),l.jsx("section",{className:"skillcenter-panel","aria-label":"技能列表",children:h?l.jsxs(l.Fragment,{children:[l.jsxs("header",{className:"skillcenter-panel-head",children:[l.jsx("div",{children:l.jsxs("h2",{title:h.name,children:[h.name," · 技能"]})}),l.jsx("span",{children:x})]}),l.jsxs("div",{className:"skillcenter-listwrap",children:[_&&l.jsxs("div",{className:"skillcenter-loading skillcenter-loading--overlay",children:[l.jsx(xE,{}),"正在读取技能…"]}),N?l.jsx("div",{className:"skillcenter-error",children:N}):m.length===0&&!_?l.jsx(Op,{children:"这个空间中暂无技能"}):l.jsx("div",{className:"skillcenter-list skillcenter-list--skills",children:m.map(V=>l.jsx("button",{type:"button",className:"skillcenter-skill-item",onClick:()=>void I(V),children:l.jsxs("span",{className:"skillcenter-item-body",children:[l.jsx("span",{className:"skillcenter-item-title",title:V.skillName,children:V.skillName}),l.jsx("span",{className:"skillcenter-item-description",children:V.skillDescription||"暂无描述"}),l.jsxs("span",{className:"skillcenter-item-meta",children:[l.jsx("span",{className:`skillcenter-status ${c2(V.skillStatus)}`,children:EE(V.skillStatus)}),l.jsxs("span",{className:"skillcenter-meta-text",children:["版本 · ",V.version||"—"]})]})]})},`${V.skillId}:${V.version}`))})]}),l.jsx(d2,{page:E,total:x,pageSize:l2,onPage:g})]}):l.jsx(Op,{children:"点击 Skill 空间以查看详情"})})]}),S&&h&&l.jsx(cre,{skill:S,space:h,region:e,detail:O,loading:U,error:M,onClose:F})]})}function dre({onAdded:e,onCancel:t}){const[n,r]=w.useState(""),[s,i]=w.useState(""),[a,o]=w.useState(""),[c,u]=w.useState(!1),[d,f]=w.useState(""),h=n.trim().length>0&&s.trim().length>0&&!c;async function p(){if(h){u(!0),f("");try{const m=await EM(a,n,s,a);if(m.apps.length===0){f("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。"),u(!1);return}e(Bo(m.id,m.apps[0]))}catch(m){f(`连接失败:${String(m)}。请检查 URL、API Key,以及该网关是否允许跨域。`),u(!1)}}}return l.jsx("div",{className:"addagent",children:l.jsxs("div",{className:"addagent-card",children:[l.jsx("h2",{className:"addagent-title",children:"添加 AgentKit 智能体"}),l.jsx("p",{className:"addagent-sub",children:"填入 AgentKit 部署的访问地址与 API Key,将通过 ADK 协议连接,连接成功后其 Agent 会出现在左上角的下拉中。"}),l.jsxs("label",{className:"addagent-field",children:[l.jsx("span",{className:"addagent-label",children:"访问地址 URL"}),l.jsx("input",{className:"addagent-input",value:n,onChange:m=>r(m.target.value),placeholder:"https://xxxxx.apigateway-cn-beijing.volceapi.com",autoFocus:!0})]}),l.jsxs("label",{className:"addagent-field",children:[l.jsx("span",{className:"addagent-label",children:"API Key"}),l.jsx("input",{className:"addagent-input",type:"password",value:s,onChange:m=>i(m.target.value),placeholder:"以 Authorization: Bearer 方式连接"})]}),l.jsxs("label",{className:"addagent-field",children:[l.jsx("span",{className:"addagent-label",children:"显示名称(可选)"}),l.jsx("input",{className:"addagent-input",value:a,onChange:m=>o(m.target.value),placeholder:"默认取 URL 的主机名"})]}),d&&l.jsx("div",{className:"addagent-error",children:d}),l.jsxs("div",{className:"addagent-actions",children:[l.jsx("button",{className:"addagent-btn addagent-btn--ghost",onClick:t,disabled:c,children:"取消"}),l.jsxs("button",{className:"addagent-btn addagent-btn--primary",onClick:p,disabled:!h,children:[c?l.jsx(Rt,{className:"icon spin"}):null,c?"连接中…":"连接并添加"]})]})]})})}function Ln(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{}};function Yg(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Rp.prototype=Yg.prototype={constructor:Rp,on:function(e,t){var n=this._,r=hre(e+"",n),s,i=-1,a=r.length;if(arguments.length<2){for(;++i0)for(var n=new Array(s),r=0,s,i;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),h2.hasOwnProperty(t)?{space:h2[t],local:e}:e}function mre(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===wE&&t.documentElement.namespaceURI===wE?t.createElement(e):t.createElementNS(n,e)}}function gre(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function fD(e){var t=Wg(e);return(t.local?gre:mre)(t)}function yre(){}function yv(e){return e==null?yre:function(){return this.querySelector(e)}}function bre(e){typeof e!="function"&&(e=yv(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s=b&&(b=x+1);!(k=E[b])&&++b=0;)(a=r[s])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function zre(e){e||(e=Vre);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,r=n.length,s=new Array(r),i=0;it?1:e>=t?0:NaN}function Kre(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Yre(){return Array.from(this)}function Wre(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?sse:typeof t=="function"?ase:ise)(e,t,n??"")):Ac(this.node(),e)}function Ac(e,t){return e.style.getPropertyValue(t)||yD(e).getComputedStyle(e,null).getPropertyValue(t)}function lse(e){return function(){delete this[e]}}function cse(e,t){return function(){this[e]=t}}function use(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function dse(e,t){return arguments.length>1?this.each((t==null?lse:typeof t=="function"?use:cse)(e,t)):this.node()[e]}function bD(e){return e.trim().split(/^|\s+/)}function bv(e){return e.classList||new ED(e)}function ED(e){this._node=e,this._names=bD(e.getAttribute("class")||"")}ED.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function xD(e,t){for(var n=bv(e),r=-1,s=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function Fse(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,i;n()=>e;function vE(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:i,x:a,y:o,dx:c,dy:u,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}vE.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function qse(e){return!e.ctrlKey&&!e.button}function Xse(){return this.parentNode}function Qse(e,t){return t??{x:e.x,y:e.y}}function Zse(){return navigator.maxTouchPoints||"ontouchstart"in this}function SD(){var e=qse,t=Xse,n=Qse,r=Zse,s={},i=Yg("start","drag","end"),a=0,o,c,u,d,f=0;function h(_){_.on("mousedown.drag",p).filter(r).on("touchstart.drag",E).on("touchmove.drag",g,Gse).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(_,k){if(!(d||!e.call(this,_,k))){var N=b(this,t.call(this,_,k),_,k,"mouse");N&&(Qr(_.view).on("mousemove.drag",m,tf).on("mouseup.drag",y,tf),kD(_.view),$y(_),u=!1,o=_.clientX,c=_.clientY,N("start",_))}}function m(_){if(rc(_),!u){var k=_.clientX-o,N=_.clientY-c;u=k*k+N*N>f}s.mouse("drag",_)}function y(_){Qr(_.view).on("mousemove.drag mouseup.drag",null),ND(_.view,u),rc(_),s.mouse("end",_)}function E(_,k){if(e.call(this,_,k)){var N=_.changedTouches,C=t.call(this,_,k),S=N.length,A,O;for(A=0;A>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Kh(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Kh(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=eie.exec(e))?new Br(t[1],t[2],t[3],1):(t=tie.exec(e))?new Br(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=nie.exec(e))?Kh(t[1],t[2],t[3],t[4]):(t=rie.exec(e))?Kh(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=sie.exec(e))?x2(t[1],t[2]/100,t[3]/100,1):(t=iie.exec(e))?x2(t[1],t[2]/100,t[3]/100,t[4]):p2.hasOwnProperty(e)?y2(p2[e]):e==="transparent"?new Br(NaN,NaN,NaN,0):null}function y2(e){return new Br(e>>16&255,e>>8&255,e&255,1)}function Kh(e,t,n,r){return r<=0&&(e=t=n=NaN),new Br(e,t,n,r)}function lie(e){return e instanceof Df||(e=Uo(e)),e?(e=e.rgb(),new Br(e.r,e.g,e.b,e.opacity)):new Br}function _E(e,t,n,r){return arguments.length===1?lie(e):new Br(e,t,n,r??1)}function Br(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Ev(Br,_E,TD(Df,{brighter(e){return e=e==null?Pm:Math.pow(Pm,e),new Br(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?nf:Math.pow(nf,e),new Br(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Br(Co(this.r),Co(this.g),Co(this.b),Bm(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:b2,formatHex:b2,formatHex8:cie,formatRgb:E2,toString:E2}));function b2(){return`#${xo(this.r)}${xo(this.g)}${xo(this.b)}`}function cie(){return`#${xo(this.r)}${xo(this.g)}${xo(this.b)}${xo((isNaN(this.opacity)?1:this.opacity)*255)}`}function E2(){const e=Bm(this.opacity);return`${e===1?"rgb(":"rgba("}${Co(this.r)}, ${Co(this.g)}, ${Co(this.b)}${e===1?")":`, ${e})`}`}function Bm(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Co(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function xo(e){return e=Co(e),(e<16?"0":"")+e.toString(16)}function x2(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Hs(e,t,n,r)}function AD(e){if(e instanceof Hs)return new Hs(e.h,e.s,e.l,e.opacity);if(e instanceof Df||(e=Uo(e)),!e)return new Hs;if(e instanceof Hs)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),i=Math.max(t,n,r),a=NaN,o=i-s,c=(i+s)/2;return o?(t===i?a=(n-r)/o+(n0&&c<1?0:a,new Hs(a,o,c,e.opacity)}function uie(e,t,n,r){return arguments.length===1?AD(e):new Hs(e,t,n,r??1)}function Hs(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Ev(Hs,uie,TD(Df,{brighter(e){return e=e==null?Pm:Math.pow(Pm,e),new Hs(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?nf:Math.pow(nf,e),new Hs(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new Br(Hy(e>=240?e-240:e+120,s,r),Hy(e,s,r),Hy(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new Hs(w2(this.h),Yh(this.s),Yh(this.l),Bm(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Bm(this.opacity);return`${e===1?"hsl(":"hsla("}${w2(this.h)}, ${Yh(this.s)*100}%, ${Yh(this.l)*100}%${e===1?")":`, ${e})`}`}}));function w2(e){return e=(e||0)%360,e<0?e+360:e}function Yh(e){return Math.max(0,Math.min(1,e||0))}function Hy(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const xv=e=>()=>e;function die(e,t){return function(n){return e+n*t}}function fie(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function hie(e){return(e=+e)==1?CD:function(t,n){return n-t?fie(t,n,e):xv(isNaN(t)?n:t)}}function CD(e,t){var n=t-e;return n?die(e,n):xv(isNaN(e)?t:e)}const Fm=function e(t){var n=hie(t);function r(s,i){var a=n((s=_E(s)).r,(i=_E(i)).r),o=n(s.g,i.g),c=n(s.b,i.b),u=CD(s.opacity,i.opacity);return function(d){return s.r=a(d),s.g=o(d),s.b=c(d),s.opacity=u(d),s+""}}return r.gamma=e,r}(1);function pie(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),s;return function(i){for(s=0;sn&&(i=t.slice(n,i),o[a]?o[a]+=i:o[++a]=i),(r=r[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,c.push({i:a,x:fi(r,s)})),n=zy.lastIndex;return n180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(s(f)+"rotate(",null,r)-2,x:fi(u,d)})):d&&f.push(s(f)+"rotate("+d+r)}function o(u,d,f,h){u!==d?h.push({i:f.push(s(f)+"skewX(",null,r)-2,x:fi(u,d)}):d&&f.push(s(f)+"skewX("+d+r)}function c(u,d,f,h,p,m){if(u!==f||d!==h){var y=p.push(s(p)+"scale(",null,",",null,")");m.push({i:y-4,x:fi(u,f)},{i:y-2,x:fi(d,h)})}else(f!==1||h!==1)&&p.push(s(p)+"scale("+f+","+h+")")}return function(u,d){var f=[],h=[];return u=e(u),d=e(d),i(u.translateX,u.translateY,d.translateX,d.translateY,f,h),a(u.rotate,d.rotate,f,h),o(u.skewX,d.skewX,f,h),c(u.scaleX,u.scaleY,d.scaleX,d.scaleY,f,h),u=d=null,function(p){for(var m=-1,y=h.length,E;++m=0&&e._call.call(void 0,t),e=e._next;--Cc}function k2(){$o=($m=sf.now())+Gg,Cc=$u=0;try{Cie()}finally{Cc=0,Oie(),$o=0}}function Iie(){var e=sf.now(),t=e-$m;t>LD&&(Gg-=t,$m=e)}function Oie(){for(var e,t=Um,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:Um=n);Hu=e,SE(r)}function SE(e){if(!Cc){$u&&($u=clearTimeout($u));var t=e-$o;t>24?(e<1/0&&($u=setTimeout(k2,e-sf.now()-Gg)),ku&&(ku=clearInterval(ku))):(ku||($m=sf.now(),ku=setInterval(Iie,LD)),Cc=1,MD(k2))}}function N2(e,t,n){var r=new Hm;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var Rie=Yg("start","end","cancel","interrupt"),Lie=[],DD=0,S2=1,TE=2,Mp=3,T2=4,AE=5,jp=6;function qg(e,t,n,r,s,i){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;Mie(e,n,{name:t,index:r,group:s,on:Rie,tween:Lie,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:DD})}function vv(e,t){var n=ti(e,t);if(n.state>DD)throw new Error("too late; already scheduled");return n}function Ni(e,t){var n=ti(e,t);if(n.state>Mp)throw new Error("too late; already running");return n}function ti(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Mie(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=jD(i,0,n.time);function i(u){n.state=S2,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var d,f,h,p;if(n.state!==S2)return c();for(d in r)if(p=r[d],p.name===n.name){if(p.state===Mp)return N2(a);p.state===T2?(p.state=jp,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete r[d]):+dTE&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function uae(e,t,n){var r,s,i=cae(t)?vv:Ni;return function(){var a=i(this,e),o=a.on;o!==r&&(s=(r=o).copy()).on(t,n),a.on=s}}function dae(e,t){var n=this._id;return arguments.length<2?ti(this.node(),n).on.on(e):this.each(uae(n,e,t))}function fae(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function hae(){return this.on("end.remove",fae(this._id))}function pae(e){var t=this._name,n=this._id;typeof e!="function"&&(e=yv(e));for(var r=this._groups,s=r.length,i=new Array(s),a=0;a()=>e;function Fae(e,{sourceEvent:t,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function zi(e,t,n){this.k=e,this.x=t,this.y=n}zi.prototype={constructor:zi,scale:function(e){return e===1?this:new zi(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new zi(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Xg=new zi(1,0,0);UD.prototype=zi.prototype;function UD(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Xg;return e.__zoom}function Vy(e){e.stopImmediatePropagation()}function Nu(e){e.preventDefault(),e.stopImmediatePropagation()}function Uae(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function $ae(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function A2(){return this.__zoom||Xg}function Hae(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function zae(){return navigator.maxTouchPoints||"ontouchstart"in this}function Vae(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function $D(){var e=Uae,t=$ae,n=Vae,r=Hae,s=zae,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],o=250,c=Lp,u=Yg("start","zoom","end"),d,f,h,p=500,m=150,y=0,E=10;function g(M){M.property("__zoom",A2).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",O).filter(s).on("touchstart.zoom",D).on("touchmove.zoom",U).on("touchend.zoom touchcancel.zoom",X).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(M,j,T,L){var R=M.selection?M.selection():M;R.property("__zoom",A2),M!==R?k(M,j,T,L):R.interrupt().each(function(){N(this,arguments).event(L).start().zoom(null,typeof j=="function"?j.apply(this,arguments):j).end()})},g.scaleBy=function(M,j,T,L){g.scaleTo(M,function(){var R=this.__zoom.k,F=typeof j=="function"?j.apply(this,arguments):j;return R*F},T,L)},g.scaleTo=function(M,j,T,L){g.transform(M,function(){var R=t.apply(this,arguments),F=this.__zoom,I=T==null?_(R):typeof T=="function"?T.apply(this,arguments):T,V=F.invert(I),W=typeof j=="function"?j.apply(this,arguments):j;return n(b(x(F,W),I,V),R,a)},T,L)},g.translateBy=function(M,j,T,L){g.transform(M,function(){return n(this.__zoom.translate(typeof j=="function"?j.apply(this,arguments):j,typeof T=="function"?T.apply(this,arguments):T),t.apply(this,arguments),a)},null,L)},g.translateTo=function(M,j,T,L,R){g.transform(M,function(){var F=t.apply(this,arguments),I=this.__zoom,V=L==null?_(F):typeof L=="function"?L.apply(this,arguments):L;return n(Xg.translate(V[0],V[1]).scale(I.k).translate(typeof j=="function"?-j.apply(this,arguments):-j,typeof T=="function"?-T.apply(this,arguments):-T),F,a)},L,R)};function x(M,j){return j=Math.max(i[0],Math.min(i[1],j)),j===M.k?M:new zi(j,M.x,M.y)}function b(M,j,T){var L=j[0]-T[0]*M.k,R=j[1]-T[1]*M.k;return L===M.x&&R===M.y?M:new zi(M.k,L,R)}function _(M){return[(+M[0][0]+ +M[1][0])/2,(+M[0][1]+ +M[1][1])/2]}function k(M,j,T,L){M.on("start.zoom",function(){N(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){N(this,arguments).event(L).end()}).tween("zoom",function(){var R=this,F=arguments,I=N(R,F).event(L),V=t.apply(R,F),W=T==null?_(V):typeof T=="function"?T.apply(R,F):T,P=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),ie=R.__zoom,G=typeof j=="function"?j.apply(R,F):j,re=c(ie.invert(W).concat(P/ie.k),G.invert(W).concat(P/G.k));return function(ue){if(ue===1)ue=G;else{var ee=re(ue),le=P/ee[2];ue=new zi(le,W[0]-ee[0]*le,W[1]-ee[1]*le)}I.zoom(null,ue)}})}function N(M,j,T){return!T&&M.__zooming||new C(M,j)}function C(M,j){this.that=M,this.args=j,this.active=0,this.sourceEvent=null,this.extent=t.apply(M,j),this.taps=0}C.prototype={event:function(M){return M&&(this.sourceEvent=M),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(M,j){return this.mouse&&M!=="mouse"&&(this.mouse[1]=j.invert(this.mouse[0])),this.touch0&&M!=="touch"&&(this.touch0[1]=j.invert(this.touch0[0])),this.touch1&&M!=="touch"&&(this.touch1[1]=j.invert(this.touch1[0])),this.that.__zoom=j,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(M){var j=Qr(this.that).datum();u.call(M,this.that,new Fae(M,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:u}),j)}};function S(M,...j){if(!e.apply(this,arguments))return;var T=N(this,j).event(M),L=this.__zoom,R=Math.max(i[0],Math.min(i[1],L.k*Math.pow(2,r.apply(this,arguments)))),F=Us(M);if(T.wheel)(T.mouse[0][0]!==F[0]||T.mouse[0][1]!==F[1])&&(T.mouse[1]=L.invert(T.mouse[0]=F)),clearTimeout(T.wheel);else{if(L.k===R)return;T.mouse=[F,L.invert(F)],Dp(this),T.start()}Nu(M),T.wheel=setTimeout(I,m),T.zoom("mouse",n(b(x(L,R),T.mouse[0],T.mouse[1]),T.extent,a));function I(){T.wheel=null,T.end()}}function A(M,...j){if(h||!e.apply(this,arguments))return;var T=M.currentTarget,L=N(this,j,!0).event(M),R=Qr(M.view).on("mousemove.zoom",W,!0).on("mouseup.zoom",P,!0),F=Us(M,T),I=M.clientX,V=M.clientY;kD(M.view),Vy(M),L.mouse=[F,this.__zoom.invert(F)],Dp(this),L.start();function W(ie){if(Nu(ie),!L.moved){var G=ie.clientX-I,re=ie.clientY-V;L.moved=G*G+re*re>y}L.event(ie).zoom("mouse",n(b(L.that.__zoom,L.mouse[0]=Us(ie,T),L.mouse[1]),L.extent,a))}function P(ie){R.on("mousemove.zoom mouseup.zoom",null),ND(ie.view,L.moved),Nu(ie),L.event(ie).end()}}function O(M,...j){if(e.apply(this,arguments)){var T=this.__zoom,L=Us(M.changedTouches?M.changedTouches[0]:M,this),R=T.invert(L),F=T.k*(M.shiftKey?.5:2),I=n(b(x(T,F),L,R),t.apply(this,j),a);Nu(M),o>0?Qr(this).transition().duration(o).call(k,I,L,M):Qr(this).call(g.transform,I,L,M)}}function D(M,...j){if(e.apply(this,arguments)){var T=M.touches,L=T.length,R=N(this,j,M.changedTouches.length===L).event(M),F,I,V,W;for(Vy(M),I=0;I`Seems like you have not used zustand provider as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},af=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],HD=["Enter"," ","Escape"],zD={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Ic;(function(e){e.Strict="strict",e.Loose="loose"})(Ic||(Ic={}));var Io;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Io||(Io={}));var of;(function(e){e.Partial="partial",e.Full="full"})(of||(of={}));const VD={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var va;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(va||(va={}));var Oc;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Oc||(Oc={}));var Pe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Pe||(Pe={}));const C2={[Pe.Left]:Pe.Right,[Pe.Right]:Pe.Left,[Pe.Top]:Pe.Bottom,[Pe.Bottom]:Pe.Top};function KD(e){return e===null?null:e?"valid":"invalid"}const YD=e=>"id"in e&&"source"in e&&"target"in e,Kae=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),kv=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Pf=(e,t=[0,0])=>{const{width:n,height:r}=ia(e),s=e.origin??t,i=n*s[0],a=r*s[1];return{x:e.position.x-i,y:e.position.y-a}},Yae=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,s)=>{const i=typeof s=="string";let a=!t.nodeLookup&&!i?s:void 0;t.nodeLookup&&(a=i?t.nodeLookup.get(s):kv(s)?s:t.nodeLookup.get(s.id));const o=a?zm(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Qg(r,o)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Zg(n)},Bf=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(s=>{(t.filter===void 0||t.filter(s))&&(n=Qg(n,zm(s)),r=!0)}),r?Zg(n):{x:0,y:0,width:0,height:0}},Nv=(e,t,[n,r,s]=[0,0,1],i=!1,a=!1)=>{const o={...Zc(t,[n,r,s]),width:t.width/s,height:t.height/s},c=[];for(const u of e.values()){const{measured:d,selectable:f=!0,hidden:h=!1}=u;if(a&&!f||h)continue;const p=d.width??u.width??u.initialWidth??null,m=d.height??u.height??u.initialHeight??null,y=lf(o,Lc(u)),E=(p??0)*(m??0),g=i&&y>0;(!u.internals.handleBounds||g||y>=E||u.dragging)&&c.push(u)}return c},Wae=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function Gae(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(s=>s.id)):null;return e.forEach(s=>{s.measured.width&&s.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!s.hidden)&&(!r||r.has(s.id))&&n.set(s.id,s)}),n}async function qae({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:i},a){if(e.size===0)return!0;const o=Gae(e,a),c=Bf(o),u=Tv(c,t,n,(a==null?void 0:a.minZoom)??s,(a==null?void 0:a.maxZoom)??i,(a==null?void 0:a.padding)??.1);return await r.setViewport(u,{duration:a==null?void 0:a.duration,ease:a==null?void 0:a.ease,interpolate:a==null?void 0:a.interpolate}),!0}function WD({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:s,onError:i}){const a=n.get(e),o=a.parentId?n.get(a.parentId):void 0,{x:c,y:u}=o?o.internals.positionAbsolute:{x:0,y:0},d=a.origin??r;let f=a.extent||s;if(a.extent==="parent"&&!a.expandParent)if(!o)i==null||i("005",Zs.error005());else{const p=o.measured.width,m=o.measured.height;p&&m&&(f=[[c,u],[c+p,u+m]])}else o&&zo(a.extent)&&(f=[[a.extent[0][0]+c,a.extent[0][1]+u],[a.extent[1][0]+c,a.extent[1][1]+u]]);const h=zo(f)?Ho(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(i==null||i("015",Zs.error015())),{position:{x:h.x-c+(a.measured.width??0)*d[0],y:h.y-u+(a.measured.height??0)*d[1]},positionAbsolute:h}}async function Xae({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const i=new Set(e.map(h=>h.id)),a=[];for(const h of n){if(h.deletable===!1)continue;const p=i.has(h.id),m=!p&&h.parentId&&a.find(y=>y.id===h.parentId);(p||m)&&a.push(h)}const o=new Set(t.map(h=>h.id)),c=r.filter(h=>h.deletable!==!1),d=Wae(a,c);for(const h of c)o.has(h.id)&&!d.find(m=>m.id===h.id)&&d.push(h);if(!s)return{edges:d,nodes:a};const f=await s({nodes:a,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:a}:{edges:[],nodes:[]}:f}const Rc=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Ho=(e={x:0,y:0},t,n)=>({x:Rc(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Rc(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function GD(e,t,n){const{width:r,height:s}=ia(n),{x:i,y:a}=n.internals.positionAbsolute;return Ho(e,[[i,a],[i+r,a+s]],t)}const I2=(e,t,n)=>en?-Rc(Math.abs(e-n),1,t)/t:0,Sv=(e,t,n=15,r=40)=>{const s=I2(e.x,r,t.width-r)*n,i=I2(e.y,r,t.height-r)*n;return[s,i]},Qg=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),CE=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Zg=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Lc=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=kv(e)?e.internals.positionAbsolute:Pf(e,t);return{x:n,y:r,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},zm=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=kv(e)?e.internals.positionAbsolute:Pf(e,t);return{x:n,y:r,x2:n+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},qD=(e,t)=>Zg(Qg(CE(e),CE(t))),lf=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},O2=e=>Vs(e.width)&&Vs(e.height)&&Vs(e.x)&&Vs(e.y),Vs=e=>!isNaN(e)&&isFinite(e),XD=(e,t)=>(n,r)=>{},Ff=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Zc=({x:e,y:t},[n,r,s],i=!1,a=[1,1])=>{const o={x:(e-n)/s,y:(t-r)/s};return i?Ff(o,a):o},Mc=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function hl(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Qae(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=hl(e,n),s=hl(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=hl(e.top??e.y??0,n),s=hl(e.bottom??e.y??0,n),i=hl(e.left??e.x??0,t),a=hl(e.right??e.x??0,t);return{top:r,right:a,bottom:s,left:i,x:i+a,y:r+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Zae(e,t,n,r,s,i){const{x:a,y:o}=Mc(e,[t,n,r]),{x:c,y:u}=Mc({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=s-c,f=i-u;return{left:Math.floor(a),top:Math.floor(o),right:Math.floor(d),bottom:Math.floor(f)}}const Tv=(e,t,n,r,s,i)=>{const a=Qae(i,t,n),o=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(o,c),d=Rc(u,r,s),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d,m=n/2-h*d,y=Zae(e,p,m,d,t,n),E={left:Math.min(y.left-a.left,0),top:Math.min(y.top-a.top,0),right:Math.min(y.right-a.right,0),bottom:Math.min(y.bottom-a.bottom,0)};return{x:p-E.left+E.right,y:m-E.top+E.bottom,zoom:d}},cf=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function zo(e){return e!=null&&e!=="parent"}function ia(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function Av(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function QD(e,t={width:0,height:0},n,r,s){const i={...e},a=r.get(n);if(a){const o=a.origin||s;i.x+=a.internals.positionAbsolute.x-(t.width??0)*o[0],i.y+=a.internals.positionAbsolute.y-(t.height??0)*o[1]}return i}function R2(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Jae(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function eoe(e){return{...zD,...e||{}}}function bd(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:i,y:a}=Ks(e),o=Zc({x:i-((s==null?void 0:s.left)??0),y:a-((s==null?void 0:s.top)??0)},r),{x:c,y:u}=n?Ff(o,t):o;return{xSnapped:c,ySnapped:u,...o}}const Cv=e=>({width:e.offsetWidth,height:e.offsetHeight}),ZD=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},toe=["INPUT","SELECT","TEXTAREA"];function JD(e){var r,s;const t=((s=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:s[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:toe.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const eP=e=>"clientX"in e,Ks=(e,t)=>{var i,a;const n=eP(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,s=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},L2=(e,t,n,r,s)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(a=>{const o=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:s,position:a.getAttribute("data-handlepos"),x:(o.left-n.left)/r,y:(o.top-n.top)/r,...Cv(a)}})};function tP({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:a,targetControlY:o}){const c=e*.125+s*.375+a*.375+n*.125,u=t*.125+i*.375+o*.375+r*.125,d=Math.abs(c-e),f=Math.abs(u-t);return[c,u,d,f]}function qh(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function M2({pos:e,x1:t,y1:n,x2:r,y2:s,c:i}){switch(e){case Pe.Left:return[t-qh(t-r,i),n];case Pe.Right:return[t+qh(r-t,i),n];case Pe.Top:return[t,n-qh(n-s,i)];case Pe.Bottom:return[t,n+qh(s-n,i)]}}function nP({sourceX:e,sourceY:t,sourcePosition:n=Pe.Bottom,targetX:r,targetY:s,targetPosition:i=Pe.Top,curvature:a=.25}){const[o,c]=M2({pos:n,x1:e,y1:t,x2:r,y2:s,c:a}),[u,d]=M2({pos:i,x1:r,y1:s,x2:e,y2:t,c:a}),[f,h,p,m]=tP({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:o,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${o},${c} ${u},${d} ${r},${s}`,f,h,p,m]}function rP({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,i=n0}const soe=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,ioe=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),aoe=(e,t,n={})=>{var i;if(!e.source||!e.target)return(i=n.onError)==null||i.call(n,"006",Zs.error006()),t;const r=n.getEdgeId||soe;let s;return YD(e)?s={...e}:s={...e,id:r(e)},ioe(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function sP({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,i,a,o]=rP({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,i,a,o]}const j2={[Pe.Left]:{x:-1,y:0},[Pe.Right]:{x:1,y:0},[Pe.Top]:{x:0,y:-1},[Pe.Bottom]:{x:0,y:1}},ooe=({source:e,sourcePosition:t=Pe.Bottom,target:n})=>t===Pe.Left||t===Pe.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function loe({source:e,sourcePosition:t=Pe.Bottom,target:n,targetPosition:r=Pe.Top,center:s,offset:i,stepPosition:a}){const o=j2[t],c=j2[r],u={x:e.x+o.x*i,y:e.y+o.y*i},d={x:n.x+c.x*i,y:n.y+c.y*i},f=ooe({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",p=f[h];let m=[],y,E;const g={x:0,y:0},x={x:0,y:0},[,,b,_]=rP({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(o[h]*c[h]===-1){h==="x"?(y=s.x??u.x+(d.x-u.x)*a,E=s.y??(u.y+d.y)/2):(y=s.x??(u.x+d.x)/2,E=s.y??u.y+(d.y-u.y)*a);const S=[{x:y,y:u.y},{x:y,y:d.y}],A=[{x:u.x,y:E},{x:d.x,y:E}];o[h]===p?m=h==="x"?S:A:m=h==="x"?A:S}else{const S=[{x:u.x,y:d.y}],A=[{x:d.x,y:u.y}];if(h==="x"?m=o.x===p?A:S:m=o.y===p?S:A,t===r){const M=Math.abs(e[h]-n[h]);if(M<=i){const j=Math.min(i-1,i-M);o[h]===p?g[h]=(u[h]>e[h]?-1:1)*j:x[h]=(d[h]>n[h]?-1:1)*j}}if(t!==r){const M=h==="x"?"y":"x",j=o[h]===c[M],T=u[M]>d[M],L=u[M]=X?(y=(O.x+D.x)/2,E=m[0].y):(y=m[0].x,E=(O.y+D.y)/2)}const k={x:u.x+g.x,y:u.y+g.y},N={x:d.x+x.x,y:d.y+x.y};return[[e,...k.x!==m[0].x||k.y!==m[0].y?[k]:[],...m,...N.x!==m[m.length-1].x||N.y!==m[m.length-1].y?[N]:[],n],y,E,b,_]}function coe(e,t,n,r){const s=Math.min(D2(e,t)/2,D2(t,n)/2,r),{x:i,y:a}=t;if(e.x===i&&i===n.x||e.y===a&&a===n.y)return`L${i} ${a}`;if(e.y===a){const u=e.xn.id===t):e[0])||null}function IE(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function doe(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:s}){const i=new Set;return e.reduce((a,o)=>([o.markerStart||r,o.markerEnd||s].forEach(c=>{if(c&&typeof c=="object"){const u=IE(c,t);i.has(u)||(a.push({id:u,color:c.color||n,...c}),i.add(u))}}),a),[]).sort((a,o)=>a.id.localeCompare(o.id))}const iP=1e3,foe=10,Iv={nodeOrigin:[0,0],nodeExtent:af,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},hoe={...Iv,checkEquality:!0};function Ov(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function poe(e,t,n){const r=Ov(Iv,n);for(const s of e.values())if(s.parentId)Lv(s,e,t,r);else{const i=Pf(s,r.nodeOrigin),a=zo(s.extent)?s.extent:r.nodeExtent,o=Ho(i,a,ia(s));s.internals.positionAbsolute=o}}function moe(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const s of e.handles){const i={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(i):s.type==="target"&&r.push(i)}return{source:n,target:r}}function Rv(e){return e==="manual"}function OE(e,t,n,r={}){var d,f;const s=Ov(hoe,r),i={i:0},a=new Map(t),o=s!=null&&s.elevateNodesOnSelect&&!Rv(s.zIndexMode)?iP:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const h of e){let p=a.get(h.id);if(s.checkEquality&&h===(p==null?void 0:p.internals.userNode))t.set(h.id,p);else{const m=Pf(h,s.nodeOrigin),y=zo(h.extent)?h.extent:s.nodeExtent,E=Ho(m,y,ia(h));p={...s.defaults,...h,measured:{width:(d=h.measured)==null?void 0:d.width,height:(f=h.measured)==null?void 0:f.height},internals:{positionAbsolute:E,handleBounds:moe(h,p),z:aP(h,o,s.zIndexMode),userNode:h}},t.set(h.id,p)}(p.measured===void 0||p.measured.width===void 0||p.measured.height===void 0)&&!p.hidden&&(c=!1),h.parentId&&Lv(p,t,n,r,i),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function goe(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Lv(e,t,n,r,s){const{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:o,zIndexMode:c}=Ov(Iv,r),u=e.parentId,d=t.get(u);if(!d){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}goe(e,n),s&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++s.i,d.internals.z=d.internals.z+s.i*foe),s&&d.internals.rootParentIndex!==void 0&&(s.i=d.internals.rootParentIndex);const f=i&&!Rv(c)?iP:0,{x:h,y:p,z:m}=yoe(e,d,a,o,f,c),{positionAbsolute:y}=e.internals,E=h!==y.x||p!==y.y;(E||m!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:E?{x:h,y:p}:y,z:m}})}function aP(e,t,n){const r=Vs(e.zIndex)?e.zIndex:0;return Rv(n)?r:r+(e.selected?t:0)}function yoe(e,t,n,r,s,i){const{x:a,y:o}=t.internals.positionAbsolute,c=ia(e),u=Pf(e,n),d=zo(e.extent)?Ho(u,e.extent,c):u;let f=Ho({x:a+d.x,y:o+d.y},r,c);e.extent==="parent"&&(f=GD(f,c,t));const h=aP(e,s,i),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=h?p+1:h}}function Mv(e,t,n,r=[0,0]){var a;const s=[],i=new Map;for(const o of e){const c=t.get(o.parentId);if(!c)continue;const u=((a=i.get(o.parentId))==null?void 0:a.expandedRect)??Lc(c),d=qD(u,o.rect);i.set(o.parentId,{expandedRect:d,parent:c})}return i.size>0&&i.forEach(({expandedRect:o,parent:c},u)=>{var b;const d=c.internals.positionAbsolute,f=ia(c),h=c.origin??r,p=o.x0||m>0||g||x)&&(s.push({id:u,type:"position",position:{x:c.position.x-p+g,y:c.position.y-m+x}}),(b=n.get(u))==null||b.forEach(_=>{e.some(k=>k.id===_.id)||s.push({id:_.id,type:"position",position:{x:_.position.x+p,y:_.position.y+m}})})),(f.width0){const p=Mv(h,t,n,s);u.push(...p)}return{changes:u,updatedInternals:c}}async function Eoe({delta:e,panZoom:t,transform:n,translateExtent:r,width:s,height:i}){if(!t||!e.x&&!e.y)return!1;const a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[s,i]],r);return!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2])}function U2(e,t,n,r,s,i){let a=s;const o=r.get(a)||new Map;r.set(a,o.set(n,t)),a=`${s}-${e}`;const c=r.get(a)||new Map;if(r.set(a,c.set(n,t)),i){a=`${s}-${e}-${i}`;const u=r.get(a)||new Map;r.set(a,u.set(n,t))}}function oP(e,t,n){e.clear(),t.clear();for(const r of n){const{source:s,target:i,sourceHandle:a=null,targetHandle:o=null}=r,c={edgeId:r.id,source:s,target:i,sourceHandle:a,targetHandle:o},u=`${s}-${a}--${i}-${o}`,d=`${i}-${o}--${s}-${a}`;U2("source",c,d,e,s,a),U2("target",c,u,e,i,o),t.set(r.id,r)}}function lP(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:lP(n,t):!1}function $2(e,t,n){var s;let r=e;do{if((s=r==null?void 0:r.matches)!=null&&s.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function xoe(e,t,n,r){const s=new Map;for(const[i,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!lP(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){const o=e.get(i);o&&s.set(i,{id:i,position:o.position||{x:0,y:0},distance:{x:n.x-o.internals.positionAbsolute.x,y:n.y-o.internals.positionAbsolute.y},extent:o.extent,parentId:o.parentId,origin:o.origin,expandParent:o.expandParent,internals:{positionAbsolute:o.internals.positionAbsolute||{x:0,y:0}},measured:{width:o.measured.width??0,height:o.measured.height??0}})}return s}function Ky({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var a,o,c;const s=[];for(const[u,d]of t){const f=(a=n.get(u))==null?void 0:a.internals.userNode;f&&s.push({...f,position:d.position,dragging:r})}if(!e)return[s[0],s];const i=(o=n.get(e))==null?void 0:o.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:r}:s[0],s]}function woe({dragItems:e,snapGrid:t,x:n,y:r}){const s=e.values().next().value;if(!s)return null;const i={x:n-s.distance.x,y:r-s.distance.y},a=Ff(i,t);return{x:a.x-i.x,y:a.y-i.y}}function voe({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let i={x:null,y:null},a=0,o=new Map,c=!1,u={x:0,y:0},d=null,f=!1,h=null,p=!1,m=!1,y=null;function E({noDragClassName:x,handleSelector:b,domNode:_,isSelectable:k,nodeId:N,nodeClickDistance:C=0}){h=Qr(_);function S({x:U,y:X}){const{nodeLookup:M,nodeExtent:j,snapGrid:T,snapToGrid:L,nodeOrigin:R,onNodeDrag:F,onSelectionDrag:I,onError:V,updateNodePositions:W}=t();i={x:U,y:X};let P=!1;const ie=o.size>1,G=ie&&j?CE(Bf(o)):null,re=ie&&L?woe({dragItems:o,snapGrid:T,x:U,y:X}):null;for(const[ue,ee]of o){if(!M.has(ue))continue;let le={x:U-ee.distance.x,y:X-ee.distance.y};L&&(le=re?{x:Math.round(le.x+re.x),y:Math.round(le.y+re.y)}:Ff(le,T));let ne=null;if(ie&&j&&!ee.extent&&G){const{positionAbsolute:te}=ee.internals,de=te.x-G.x+j[0][0],Ee=te.x+ee.measured.width-G.x2+j[1][0],Te=te.y-G.y+j[0][1],Ke=te.y+ee.measured.height-G.y2+j[1][1];ne=[[de,Te],[Ee,Ke]]}const{position:me,positionAbsolute:ye}=WD({nodeId:ue,nextPosition:le,nodeLookup:M,nodeExtent:ne||j,nodeOrigin:R,onError:V});P=P||ee.position.x!==me.x||ee.position.y!==me.y,ee.position=me,ee.internals.positionAbsolute=ye}if(m=m||P,!!P&&(W(o,!0),y&&(r||F||!N&&I))){const[ue,ee]=Ky({nodeId:N,dragItems:o,nodeLookup:M});r==null||r(y,o,ue,ee),F==null||F(y,ue,ee),N||I==null||I(y,ee)}}async function A(){if(!d)return;const{transform:U,panBy:X,autoPanSpeed:M,autoPanOnNodeDrag:j}=t();if(!j){c=!1,cancelAnimationFrame(a);return}const[T,L]=Sv(u,d,M);(T!==0||L!==0)&&(i.x=(i.x??0)-T/U[2],i.y=(i.y??0)-L/U[2],await X({x:T,y:L})&&S(i)),a=requestAnimationFrame(A)}function O(U){var ie;const{nodeLookup:X,multiSelectionActive:M,nodesDraggable:j,transform:T,snapGrid:L,snapToGrid:R,selectNodesOnDrag:F,onNodeDragStart:I,onSelectionDragStart:V,unselectNodesAndEdges:W}=t();f=!0,(!F||!k)&&!M&&N&&((ie=X.get(N))!=null&&ie.selected||W()),k&&F&&N&&(e==null||e(N));const P=bd(U.sourceEvent,{transform:T,snapGrid:L,snapToGrid:R,containerBounds:d});if(i=P,o=xoe(X,j,P,N),o.size>0&&(n||I||!N&&V)){const[G,re]=Ky({nodeId:N,dragItems:o,nodeLookup:X});n==null||n(U.sourceEvent,o,G,re),I==null||I(U.sourceEvent,G,re),N||V==null||V(U.sourceEvent,re)}}const D=SD().clickDistance(C).on("start",U=>{const{domNode:X,nodeDragThreshold:M,transform:j,snapGrid:T,snapToGrid:L}=t();d=(X==null?void 0:X.getBoundingClientRect())||null,p=!1,m=!1,y=U.sourceEvent,M===0&&O(U),i=bd(U.sourceEvent,{transform:j,snapGrid:T,snapToGrid:L,containerBounds:d}),u=Ks(U.sourceEvent,d)}).on("drag",U=>{const{autoPanOnNodeDrag:X,transform:M,snapGrid:j,snapToGrid:T,nodeDragThreshold:L,nodeLookup:R}=t(),F=bd(U.sourceEvent,{transform:M,snapGrid:j,snapToGrid:T,containerBounds:d});if(y=U.sourceEvent,(U.sourceEvent.type==="touchmove"&&U.sourceEvent.touches.length>1||N&&!R.has(N))&&(p=!0),!p){if(!c&&X&&f&&(c=!0,A()),!f){const I=Ks(U.sourceEvent,d),V=I.x-u.x,W=I.y-u.y;Math.sqrt(V*V+W*W)>L&&O(U)}(i.x!==F.xSnapped||i.y!==F.ySnapped)&&o&&f&&(u=Ks(U.sourceEvent,d),S(F))}}).on("end",U=>{if(!f||p){p&&o.size>0&&t().updateNodePositions(o,!1);return}if(c=!1,f=!1,cancelAnimationFrame(a),o.size>0){const{nodeLookup:X,updateNodePositions:M,onNodeDragStop:j,onSelectionDragStop:T}=t();if(m&&(M(o,!1),m=!1),s||j||!N&&T){const[L,R]=Ky({nodeId:N,dragItems:o,nodeLookup:X,dragging:!1});s==null||s(U.sourceEvent,o,L,R),j==null||j(U.sourceEvent,L,R),N||T==null||T(U.sourceEvent,R)}}}).filter(U=>{const X=U.target;return!U.button&&(!x||!$2(X,`.${x}`,_))&&(!b||$2(X,b,_))});h.call(D)}function g(){h==null||h.on(".drag",null)}return{update:E,destroy:g}}function _oe(e,t,n){const r=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())lf(s,Lc(i))>0&&r.push(i);return r}const koe=250;function Noe(e,t,n,r){var o,c;let s=[],i=1/0;const a=_oe(e,n,t+koe);for(const u of a){const d=[...((o=u.internals.handleBounds)==null?void 0:o.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of d){if(r.nodeId===f.nodeId&&r.type===f.type&&r.id===f.id)continue;const{x:h,y:p}=Vo(u,f,f.position,!0),m=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(p-e.y,2));m>t||(m1){const u=r.type==="source"?"target":"source";return s.find(d=>d.type===u)??s[0]}return s[0]}function cP(e,t,n,r,s,i=!1){var u,d,f;const a=r.get(e);if(!a)return null;const o=s==="strict"?(u=a.internals.handleBounds)==null?void 0:u[t]:[...((d=a.internals.handleBounds)==null?void 0:d.source)??[],...((f=a.internals.handleBounds)==null?void 0:f.target)??[]],c=(n?o==null?void 0:o.find(h=>h.id===n):o==null?void 0:o[0])??null;return c&&i?{...c,...Vo(a,c,c.position,!0)}:c}function uP(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Soe(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const dP=()=>!0;function Toe(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:i,isTarget:a,domNode:o,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:p,onConnectStart:m,onConnect:y,onConnectEnd:E,isValidConnection:g=dP,onReconnectEnd:x,updateConnection:b,getTransform:_,getFromHandle:k,autoPanSpeed:N,dragThreshold:C=1,handleDomNode:S}){const A=ZD(e.target);let O=0,D;const{x:U,y:X}=Ks(e),M=uP(i,S),j=o==null?void 0:o.getBoundingClientRect();let T=!1;if(!j||!M)return;const L=cP(s,M,r,c,t);if(!L)return;let R=Ks(e,j),F=!1,I=null,V=!1,W=null;function P(){if(!d||!j)return;const[me,ye]=Sv(R,j,N);h({x:me,y:ye}),O=requestAnimationFrame(P)}const ie={...L,nodeId:s,type:M,position:L.position},G=c.get(s);let ue={inProgress:!0,isValid:null,from:Vo(G,ie,Pe.Left,!0),fromHandle:ie,fromPosition:ie.position,fromNode:G,to:R,toHandle:null,toPosition:C2[ie.position],toNode:null,pointer:R};function ee(){T=!0,b(ue),m==null||m(e,{nodeId:s,handleId:r,handleType:M})}C===0&&ee();function le(me){if(!T){const{x:Ke,y:Ne}=Ks(me),it=Ke-U,He=Ne-X;if(!(it*it+He*He>C*C))return;ee()}if(!k()||!ie){ne(me);return}const ye=_();R=Ks(me,j),D=Noe(Zc(R,ye,!1,[1,1]),n,c,ie),F||(P(),F=!0);const te=fP(me,{handle:D,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:a?"target":"source",isValidConnection:g,doc:A,lib:u,flowId:f,nodeLookup:c});W=te.handleDomNode,I=te.connection,V=Soe(!!D,te.isValid);const de=c.get(s),Ee=de?Vo(de,ie,Pe.Left,!0):ue.from,Te={...ue,from:Ee,isValid:V,to:te.toHandle&&V?Mc({x:te.toHandle.x,y:te.toHandle.y},ye):R,toHandle:te.toHandle,toPosition:V&&te.toHandle?te.toHandle.position:C2[ie.position],toNode:te.toHandle?c.get(te.toHandle.nodeId):null,pointer:R};b(Te),ue=Te}function ne(me){if(!("touches"in me&&me.touches.length>0)){if(T){(D||W)&&I&&V&&(y==null||y(I));const{inProgress:ye,...te}=ue,de={...te,toPosition:ue.toHandle?ue.toPosition:null};E==null||E(me,de),i&&(x==null||x(me,de))}p(),cancelAnimationFrame(O),F=!1,V=!1,I=null,W=null,A.removeEventListener("mousemove",le),A.removeEventListener("mouseup",ne),A.removeEventListener("touchmove",le),A.removeEventListener("touchend",ne)}}A.addEventListener("mousemove",le),A.addEventListener("mouseup",ne),A.addEventListener("touchmove",le),A.addEventListener("touchend",ne)}function fP(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:i,doc:a,lib:o,flowId:c,isValidConnection:u=dP,nodeLookup:d}){const f=i==="target",h=t?a.querySelector(`.${o}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:p,y:m}=Ks(e),y=a.elementFromPoint(p,m),E=y!=null&&y.classList.contains(`${o}-flow__handle`)?y:h,g={handleDomNode:E,isValid:!1,connection:null,toHandle:null};if(E){const x=uP(void 0,E),b=E.getAttribute("data-nodeid"),_=E.getAttribute("data-handleid"),k=E.classList.contains("connectable"),N=E.classList.contains("connectableend");if(!b||!x)return g;const C={source:f?b:r,sourceHandle:f?_:s,target:f?r:b,targetHandle:f?s:_};g.connection=C;const A=k&&N&&(n===Ic.Strict?f&&x==="source"||!f&&x==="target":b!==r||_!==s);g.isValid=A&&u(C),g.toHandle=cP(b,x,_,d,n,!0)}return g}const RE={onPointerDown:Toe,isValid:fP};function Aoe({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=Qr(e);function i({translateExtent:o,width:c,height:u,zoomStep:d=1,pannable:f=!0,zoomable:h=!0,inversePan:p=!1}){const m=b=>{if(b.sourceEvent.type!=="wheel"||!t)return;const _=n(),k=b.sourceEvent.ctrlKey&&cf()?10:1,N=-b.sourceEvent.deltaY*(b.sourceEvent.deltaMode===1?.05:b.sourceEvent.deltaMode?1:.002)*d,C=_[2]*Math.pow(2,N*k);t.scaleTo(C)};let y=[0,0];const E=b=>{(b.sourceEvent.type==="mousedown"||b.sourceEvent.type==="touchstart")&&(y=[b.sourceEvent.clientX??b.sourceEvent.touches[0].clientX,b.sourceEvent.clientY??b.sourceEvent.touches[0].clientY])},g=b=>{const _=n();if(b.sourceEvent.type!=="mousemove"&&b.sourceEvent.type!=="touchmove"||!t)return;const k=[b.sourceEvent.clientX??b.sourceEvent.touches[0].clientX,b.sourceEvent.clientY??b.sourceEvent.touches[0].clientY],N=[k[0]-y[0],k[1]-y[1]];y=k;const C=r()*Math.max(_[2],Math.log(_[2]))*(p?-1:1),S={x:_[0]-N[0]*C,y:_[1]-N[1]*C},A=[[0,0],[c,u]];t.setViewportConstrained({x:S.x,y:S.y,zoom:_[2]},A,o)},x=$D().on("start",E).on("zoom",f?g:null).on("zoom.wheel",h?m:null);s.call(x,{})}function a(){s.on("zoom",null)}return{update:i,destroy:a,pointer:Us}}const Jg=e=>({x:e.x,y:e.y,zoom:e.k}),Yy=({x:e,y:t,zoom:n})=>Xg.translate(e,t).scale(n),$l=(e,t)=>e.target.closest(`.${t}`),hP=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Coe=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Wy=(e,t=0,n=Coe,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},pP=e=>{const t=e.ctrlKey&&cf()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Ioe({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:o,onPanZoom:c,onPanZoomEnd:u}){return d=>{if($l(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&a){const E=Us(d),g=pP(d),x=f*Math.pow(2,g);r.scaleTo(n,x,E,d);return}const h=d.deltaMode===1?20:1;let p=s===Io.Vertical?0:d.deltaX*h,m=s===Io.Horizontal?0:d.deltaY*h;!cf()&&d.shiftKey&&s!==Io.Vertical&&(p=d.deltaY*h,m=0),r.translateBy(n,-(p/f)*i,-(m/f)*i,{internal:!0});const y=Jg(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,y),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,y),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,o==null||o(d,y))}}function Ooe({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const i=r.type==="wheel",a=!t&&i&&!r.ctrlKey,o=$l(r,e);if(r.ctrlKey&&i&&o&&r.preventDefault(),a||o)return null;r.preventDefault(),n.call(this,r,s)}}function Roe({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,a,o;if((i=r.sourceEvent)!=null&&i.internal)return;const s=Jg(r.transform);e.mouseButton=((a=r.sourceEvent)==null?void 0:a.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((o=r.sourceEvent)==null?void 0:o.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,s))}}function Loe({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return i=>{var a,o;e.usedRightMouseButton=!!(n&&hP(t,e.mouseButton??0)),(a=i.sourceEvent)!=null&&a.sync||r([i.transform.x,i.transform.y,i.transform.k]),s&&!((o=i.sourceEvent)!=null&&o.internal)&&(s==null||s(i.sourceEvent,Jg(i.transform)))}}function Moe({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:s,onPaneContextMenu:i}){return a=>{var o;if(!((o=a.sourceEvent)!=null&&o.internal)&&(e.isZoomingOrPanning=!1,i&&hP(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const c=Jg(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(a.sourceEvent,c)},n?150:0)}}}function joe({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:o,noPanClassName:c,lib:u,connectionInProgress:d}){return f=>{var E;const h=e||t,p=n&&f.ctrlKey,m=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&($l(f,`${u}-flow__node`)||$l(f,`${u}-flow__edge`)))return!0;if(!r&&!h&&!s&&!i&&!n||a||d&&!m||$l(f,o)&&m||$l(f,c)&&(!m||s&&m&&!e)||!n&&f.ctrlKey&&m)return!1;if(!n&&f.type==="touchstart"&&((E=f.touches)==null?void 0:E.length)>1)return f.preventDefault(),!1;if(!h&&!s&&!p&&m||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const y=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||m)&&y}}function Doe({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:s,onPanZoom:i,onPanZoomStart:a,onPanZoomEnd:o,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),f=$D().scaleExtent([t,n]).translateExtent(r),h=Qr(e).call(f);x({x:s.x,y:s.y,zoom:Rc(s.zoom,t,n)},[[0,0],[d.width,d.height]],r);const p=h.on("wheel.zoom"),m=h.on("dblclick.zoom");f.wheelDelta(pP);async function y(D,U){return h?new Promise(X=>{f==null||f.interpolate((U==null?void 0:U.interpolate)==="linear"?yd:Lp).transform(Wy(h,U==null?void 0:U.duration,U==null?void 0:U.ease,()=>X(!0)),D)}):!1}function E({noWheelClassName:D,noPanClassName:U,onPaneContextMenu:X,userSelectionActive:M,panOnScroll:j,panOnDrag:T,panOnScrollMode:L,panOnScrollSpeed:R,preventScrolling:F,zoomOnPinch:I,zoomOnScroll:V,zoomOnDoubleClick:W,zoomActivationKeyPressed:P,lib:ie,onTransformChange:G,connectionInProgress:re,paneClickDistance:ue,selectionOnDrag:ee}){M&&!u.isZoomingOrPanning&&g();const le=j&&!P&&!M;f.clickDistance(ee?1/0:!Vs(ue)||ue<0?0:ue);const ne=le?Ioe({zoomPanValues:u,noWheelClassName:D,d3Selection:h,d3Zoom:f,panOnScrollMode:L,panOnScrollSpeed:R,zoomOnPinch:I,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:o}):Ooe({noWheelClassName:D,preventScrolling:F,d3ZoomHandler:p});h.on("wheel.zoom",ne,{passive:!1});const me=Roe({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});f.on("start",me);const ye=Loe({zoomPanValues:u,panOnDrag:T,onPaneContextMenu:!!X,onPanZoom:i,onTransformChange:G});f.on("zoom",ye);const te=Moe({zoomPanValues:u,panOnDrag:T,panOnScroll:j,onPaneContextMenu:X,onPanZoomEnd:o,onDraggingChange:c});f.on("end",te);const de=joe({zoomActivationKeyPressed:P,panOnDrag:T,zoomOnScroll:V,panOnScroll:j,zoomOnDoubleClick:W,zoomOnPinch:I,userSelectionActive:M,noPanClassName:U,noWheelClassName:D,lib:ie,connectionInProgress:re});f.filter(de),W?h.on("dblclick.zoom",m):h.on("dblclick.zoom",null)}function g(){f.on("zoom",null)}async function x(D,U,X){const M=Yy(D),j=f==null?void 0:f.constrain()(M,U,X);return j&&await y(j),j}async function b(D,U){const X=Yy(D);return await y(X,U),X}function _(D){if(h){const U=Yy(D),X=h.property("__zoom");(X.k!==D.zoom||X.x!==D.x||X.y!==D.y)&&(f==null||f.transform(h,U,null,{sync:!0}))}}function k(){const D=h?UD(h.node()):{x:0,y:0,k:1};return{x:D.x,y:D.y,zoom:D.k}}async function N(D,U){return h?new Promise(X=>{f==null||f.interpolate((U==null?void 0:U.interpolate)==="linear"?yd:Lp).scaleTo(Wy(h,U==null?void 0:U.duration,U==null?void 0:U.ease,()=>X(!0)),D)}):!1}async function C(D,U){return h?new Promise(X=>{f==null||f.interpolate((U==null?void 0:U.interpolate)==="linear"?yd:Lp).scaleBy(Wy(h,U==null?void 0:U.duration,U==null?void 0:U.ease,()=>X(!0)),D)}):!1}function S(D){f==null||f.scaleExtent(D)}function A(D){f==null||f.translateExtent(D)}function O(D){const U=!Vs(D)||D<0?0:D;f==null||f.clickDistance(U)}return{update:E,destroy:g,setViewport:b,setViewportConstrained:x,getViewport:k,scaleTo:N,scaleBy:C,setScaleExtent:S,setTranslateExtent:A,syncViewport:_,setClickDistance:O}}var jc;(function(e){e.Line="line",e.Handle="handle"})(jc||(jc={}));function Poe({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:s,affectsY:i}){const a=e-t,o=n-r,c=[a>0?1:a<0?-1:0,o>0?1:o<0?-1:0];return a&&s&&(c[0]=c[0]*-1),o&&i&&(c[1]=c[1]*-1),c}function H2(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),s=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:s}}function ua(e,t){return Math.max(0,t-e)}function da(e,t){return Math.max(0,e-t)}function Xh(e,t,n){return Math.max(0,t-e,e-n)}function z2(e,t){return e?!t:t}function Boe(e,t,n,r,s,i,a,o){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:f}=t,h=d&&f,{xSnapped:p,ySnapped:m}=n,{minWidth:y,maxWidth:E,minHeight:g,maxHeight:x}=r,{x:b,y:_,width:k,height:N,aspectRatio:C}=e;let S=Math.floor(d?p-e.pointerX:0),A=Math.floor(f?m-e.pointerY:0);const O=k+(c?-S:S),D=N+(u?-A:A),U=-i[0]*k,X=-i[1]*N;let M=Xh(O,y,E),j=Xh(D,g,x);if(a){let R=0,F=0;c&&S<0?R=ua(b+S+U,a[0][0]):!c&&S>0&&(R=da(b+O+U,a[1][0])),u&&A<0?F=ua(_+A+X,a[0][1]):!u&&A>0&&(F=da(_+D+X,a[1][1])),M=Math.max(M,R),j=Math.max(j,F)}if(o){let R=0,F=0;c&&S>0?R=da(b+S,o[0][0]):!c&&S<0&&(R=ua(b+O,o[1][0])),u&&A>0?F=da(_+A,o[0][1]):!u&&A<0&&(F=ua(_+D,o[1][1])),M=Math.max(M,R),j=Math.max(j,F)}if(s){if(d){const R=Xh(O/C,g,x)*C;if(M=Math.max(M,R),a){let F=0;!c&&!u||c&&!u&&h?F=da(_+X+O/C,a[1][1])*C:F=ua(_+X+(c?S:-S)/C,a[0][1])*C,M=Math.max(M,F)}if(o){let F=0;!c&&!u||c&&!u&&h?F=ua(_+O/C,o[1][1])*C:F=da(_+(c?S:-S)/C,o[0][1])*C,M=Math.max(M,F)}}if(f){const R=Xh(D*C,y,E)/C;if(j=Math.max(j,R),a){let F=0;!c&&!u||u&&!c&&h?F=da(b+D*C+U,a[1][0])/C:F=ua(b+(u?A:-A)*C+U,a[0][0])/C,j=Math.max(j,F)}if(o){let F=0;!c&&!u||u&&!c&&h?F=ua(b+D*C,o[1][0])/C:F=da(b+(u?A:-A)*C,o[0][0])/C,j=Math.max(j,F)}}}A=A+(A<0?j:-j),S=S+(S<0?M:-M),s&&(h?O>D*C?A=(z2(c,u)?-S:S)/C:S=(z2(c,u)?-A:A)*C:d?(A=S/C,u=c):(S=A*C,c=u));const T=c?b+S:b,L=u?_+A:_;return{width:k+(c?-S:S),height:N+(u?-A:A),x:i[0]*S*(c?-1:1)+T,y:i[1]*A*(u?-1:1)+L}}const mP={width:0,height:0,x:0,y:0},Foe={...mP,pointerX:0,pointerY:0,aspectRatio:1};function Uoe(e,t,n){const r=t.position.x+e.position.x,s=t.position.y+e.position.y,i=e.measured.width??0,a=e.measured.height??0,o=n[0]*i,c=n[1]*a;return[[r-o,s-c],[r+i-o,s+a-c]]}function $oe({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const i=Qr(e);let a={controlDirection:H2("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function o({controlPosition:u,boundaries:d,keepAspectRatio:f,resizeDirection:h,onResizeStart:p,onResize:m,onResizeEnd:y,shouldResize:E}){let g={...mP},x={...Foe};a={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:H2(u)};let b,_=null,k=[],N,C,S,A=!1;const O=SD().on("start",D=>{const{nodeLookup:U,transform:X,snapGrid:M,snapToGrid:j,nodeOrigin:T,paneDomNode:L}=n();if(b=U.get(t),!b)return;_=(L==null?void 0:L.getBoundingClientRect())??null;const{xSnapped:R,ySnapped:F}=bd(D.sourceEvent,{transform:X,snapGrid:M,snapToGrid:j,containerBounds:_});g={width:b.measured.width??0,height:b.measured.height??0,x:b.position.x??0,y:b.position.y??0},x={...g,pointerX:R,pointerY:F,aspectRatio:g.width/g.height},N=void 0,C=zo(b.extent)?b.extent:void 0,b.parentId&&(b.extent==="parent"||b.expandParent)&&(N=U.get(b.parentId)),N&&b.extent==="parent"&&(C=[[0,0],[N.measured.width,N.measured.height]]),k=[],S=void 0;for(const[I,V]of U)if(V.parentId===t&&(k.push({id:I,position:{...V.position},extent:V.extent}),V.extent==="parent"||V.expandParent)){const W=Uoe(V,b,V.origin??T);S?S=[[Math.min(W[0][0],S[0][0]),Math.min(W[0][1],S[0][1])],[Math.max(W[1][0],S[1][0]),Math.max(W[1][1],S[1][1])]]:S=W}p==null||p(D,{...g})}).on("drag",D=>{const{transform:U,snapGrid:X,snapToGrid:M,nodeOrigin:j}=n(),T=bd(D.sourceEvent,{transform:U,snapGrid:X,snapToGrid:M,containerBounds:_}),L=[];if(!b)return;const{x:R,y:F,width:I,height:V}=g,W={},P=b.origin??j,{width:ie,height:G,x:re,y:ue}=Boe(x,a.controlDirection,T,a.boundaries,a.keepAspectRatio,P,C,S),ee=ie!==I,le=G!==V,ne=re!==R&&ee,me=ue!==F&≤if(!ne&&!me&&!ee&&!le)return;if((ne||me||P[0]===1||P[1]===1)&&(W.x=ne?re:g.x,W.y=me?ue:g.y,g.x=W.x,g.y=W.y,k.length>0)){const Ee=re-R,Te=ue-F;for(const Ke of k)Ke.position={x:Ke.position.x-Ee+P[0]*(ie-I),y:Ke.position.y-Te+P[1]*(G-V)},L.push(Ke)}if((ee||le)&&(W.width=ee&&(!a.resizeDirection||a.resizeDirection==="horizontal")?ie:g.width,W.height=le&&(!a.resizeDirection||a.resizeDirection==="vertical")?G:g.height,g.width=W.width,g.height=W.height),N&&b.expandParent){const Ee=P[0]*(W.width??0);W.x&&W.x{A&&(y==null||y(D,{...g}),s==null||s({...g}),A=!1)});i.call(O)}function c(){i.on(".drag",null)}return{update:o,destroy:c}}var gP={exports:{}},yP={},bP={exports:{}},EP={};/** * @license React * use-sync-external-store-shim.production.js * @@ -544,7 +544,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),I=T,F=L),R===void 0&&( * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Pc=w;function zoe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Voe=typeof Object.is=="function"?Object.is:zoe,Koe=Pc.useState,Yoe=Pc.useEffect,Woe=Pc.useLayoutEffect,Goe=Pc.useDebugValue;function qoe(e,t){var n=t(),r=Koe({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return Woe(function(){s.value=n,s.getSnapshot=t,qy(s)&&i({inst:s})},[e,n,t]),Yoe(function(){return qy(s)&&i({inst:s}),e(function(){qy(s)&&i({inst:s})})},[e]),Goe(n),n}function qy(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Voe(e,n)}catch{return!0}}function Xoe(e,t){return t()}var Qoe=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Xoe:qoe;xP.useSyncExternalStore=Pc.useSyncExternalStore!==void 0?Pc.useSyncExternalStore:Qoe;EP.exports=xP;var Zoe=EP.exports;/** + */var Dc=w;function Hoe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var zoe=typeof Object.is=="function"?Object.is:Hoe,Voe=Dc.useState,Koe=Dc.useEffect,Yoe=Dc.useLayoutEffect,Woe=Dc.useDebugValue;function Goe(e,t){var n=t(),r=Voe({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return Yoe(function(){s.value=n,s.getSnapshot=t,Gy(s)&&i({inst:s})},[e,n,t]),Koe(function(){return Gy(s)&&i({inst:s}),e(function(){Gy(s)&&i({inst:s})})},[e]),Woe(n),n}function Gy(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!zoe(e,n)}catch{return!0}}function qoe(e,t){return t()}var Xoe=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?qoe:Goe;EP.useSyncExternalStore=Dc.useSyncExternalStore!==void 0?Dc.useSyncExternalStore:Xoe;bP.exports=EP;var Qoe=bP.exports;/** * @license React * use-sync-external-store-shim/with-selector.production.js * @@ -552,55 +552,55 @@ https://github.com/highlightjs/highlight.js/issues/2277`),I=T,F=L),R===void 0&&( * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var t0=w,Joe=Zoe;function ele(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var tle=typeof Object.is=="function"?Object.is:ele,nle=Joe.useSyncExternalStore,rle=t0.useRef,sle=t0.useEffect,ile=t0.useMemo,ale=t0.useDebugValue;bP.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=rle(null);if(i.current===null){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=ile(function(){function c(p){if(!u){if(u=!0,d=p,p=r(p),s!==void 0&&a.hasValue){var m=a.value;if(s(m,p))return f=m}return f=p}if(m=f,tle(d,p))return m;var y=r(p);return s!==void 0&&s(m,y)?(d=p,m):(d=p,f=y)}var u=!1,d,f,h=n===void 0?null:n;return[function(){return c(t())},h===null?void 0:function(){return c(h())}]},[t,n,r,s]);var o=nle(e,i[0],i[1]);return sle(function(){a.hasValue=!0,a.value=o},[o]),ale(o),o};yP.exports=bP;var ole=yP.exports;const lle=mf(ole),cle={},K2=e=>{let t;const n=new Set,r=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const p=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(m=>m(t,p))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(cle?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(r,s,c);return c},ule=e=>e?K2(e):K2,{useDebugValue:dle}=dt,{useSyncExternalStoreWithSelector:fle}=lle,hle=e=>e;function wP(e,t=hle,n){const r=fle(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return dle(r),r}const Y2=(e,t)=>{const n=ule(e),r=(s,i=t)=>wP(n,s,i);return Object.assign(r,n),r},ple=(e,t)=>e?Y2(e,t):Y2;function en(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,s]of e)if(!Object.is(s,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const n0=w.createContext(null),mle=n0.Provider,vP=Zs.error001("react");function wt(e,t){const n=w.useContext(n0);if(n===null)throw new Error(vP);return wP(n,e,t)}function tn(){const e=w.useContext(n0);if(e===null)throw new Error(vP);return w.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const W2={display:"none"},gle={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},_P="react-flow__node-desc",kP="react-flow__edge-desc",yle="react-flow__aria-live",ble=e=>e.ariaLiveMessage,Ele=e=>e.ariaLabelConfig;function xle({rfId:e}){const t=wt(ble);return l.jsx("div",{id:`${yle}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:gle,children:t})}function wle({rfId:e,disableKeyboardA11y:t}){const n=wt(Ele);return l.jsxs(l.Fragment,{children:[l.jsx("div",{id:`${_P}-${e}`,style:W2,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),l.jsx("div",{id:`${kP}-${e}`,style:W2,children:n["edge.a11yDescription.default"]}),!t&&l.jsx(xle,{rfId:e})]})}const r0=w.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},i)=>{const a=`${e}`.split("-");return l.jsx("div",{className:Ln(["react-flow__panel",n,...a]),style:r,ref:i,...s,children:t})});r0.displayName="Panel";function vle({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:l.jsx(r0,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:l.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const _le=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},Zh=e=>e.id;function kle(e,t){return en(e.selectedNodes.map(Zh),t.selectedNodes.map(Zh))&&en(e.selectedEdges.map(Zh),t.selectedEdges.map(Zh))}function Nle({onSelectionChange:e}){const t=tn(),{selectedNodes:n,selectedEdges:r}=wt(_le,kle);return w.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(i=>i(s))},[n,r,e]),null}const Sle=e=>!!e.onSelectionChangeHandlers;function Tle({onSelectionChange:e}){const t=wt(Sle);return e||t?l.jsx(Nle,{onSelectionChange:e}):null}const NP=[0,0],Ale={x:0,y:0,zoom:1},Cle=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],G2=[...Cle,"rfId"],Ile=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),q2={translateExtent:of,nodeOrigin:NP,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Ole(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:i,setNodeExtent:a,reset:o,setDefaultNodesAndEdges:c}=wt(Ile,en),u=tn();w.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=q2,o()}),[]);const d=w.useRef(q2);return w.useEffect(()=>{for(const f of G2){const h=e[f],p=d.current[f];h!==p&&(typeof e[f]>"u"||(f==="nodes"?t(h):f==="edges"?n(h):f==="minZoom"?r(h):f==="maxZoom"?s(h):f==="translateExtent"?i(h):f==="nodeExtent"?a(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:toe(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},G2.map(f=>e[f])),null}function X2(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Rle(e){var r;const[t,n]=w.useState(e==="system"?null:e);return w.useEffect(()=>{if(e!=="system"){n(e);return}const s=X2(),i=()=>n(s!=null&&s.matches?"dark":"light");return i(),s==null||s.addEventListener("change",i),()=>{s==null||s.removeEventListener("change",i)}},[e]),t!==null?t:(r=X2())!=null&&r.matches?"dark":"light"}const Q2=typeof document<"u"?document:null;function df(e=null,t={target:Q2,actInsideInputWithModifier:!0}){const[n,r]=w.useState(!1),s=w.useRef(!1),i=w.useRef(new Set([])),[a,o]=w.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",` + */var e0=w,Zoe=Qoe;function Joe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ele=typeof Object.is=="function"?Object.is:Joe,tle=Zoe.useSyncExternalStore,nle=e0.useRef,rle=e0.useEffect,sle=e0.useMemo,ile=e0.useDebugValue;yP.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=nle(null);if(i.current===null){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=sle(function(){function c(p){if(!u){if(u=!0,d=p,p=r(p),s!==void 0&&a.hasValue){var m=a.value;if(s(m,p))return f=m}return f=p}if(m=f,ele(d,p))return m;var y=r(p);return s!==void 0&&s(m,y)?(d=p,m):(d=p,f=y)}var u=!1,d,f,h=n===void 0?null:n;return[function(){return c(t())},h===null?void 0:function(){return c(h())}]},[t,n,r,s]);var o=tle(e,i[0],i[1]);return rle(function(){a.hasValue=!0,a.value=o},[o]),ile(o),o};gP.exports=yP;var ale=gP.exports;const ole=pf(ale),lle={},V2=e=>{let t;const n=new Set,r=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const p=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(m=>m(t,p))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(lle?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},u=t=e(r,s,c);return c},cle=e=>e?V2(e):V2,{useDebugValue:ule}=dt,{useSyncExternalStoreWithSelector:dle}=ole,fle=e=>e;function xP(e,t=fle,n){const r=dle(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return ule(r),r}const K2=(e,t)=>{const n=cle(e),r=(s,i=t)=>xP(n,s,i);return Object.assign(r,n),r},hle=(e,t)=>e?K2(e,t):K2;function en(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,s]of e)if(!Object.is(s,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const t0=w.createContext(null),ple=t0.Provider,wP=Zs.error001("react");function wt(e,t){const n=w.useContext(t0);if(n===null)throw new Error(wP);return xP(n,e,t)}function tn(){const e=w.useContext(t0);if(e===null)throw new Error(wP);return w.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Y2={display:"none"},mle={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},vP="react-flow__node-desc",_P="react-flow__edge-desc",gle="react-flow__aria-live",yle=e=>e.ariaLiveMessage,ble=e=>e.ariaLabelConfig;function Ele({rfId:e}){const t=wt(yle);return l.jsx("div",{id:`${gle}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:mle,children:t})}function xle({rfId:e,disableKeyboardA11y:t}){const n=wt(ble);return l.jsxs(l.Fragment,{children:[l.jsx("div",{id:`${vP}-${e}`,style:Y2,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),l.jsx("div",{id:`${_P}-${e}`,style:Y2,children:n["edge.a11yDescription.default"]}),!t&&l.jsx(Ele,{rfId:e})]})}const n0=w.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},i)=>{const a=`${e}`.split("-");return l.jsx("div",{className:Ln(["react-flow__panel",n,...a]),style:r,ref:i,...s,children:t})});n0.displayName="Panel";function wle({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:l.jsx(n0,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:l.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const vle=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},Qh=e=>e.id;function _le(e,t){return en(e.selectedNodes.map(Qh),t.selectedNodes.map(Qh))&&en(e.selectedEdges.map(Qh),t.selectedEdges.map(Qh))}function kle({onSelectionChange:e}){const t=tn(),{selectedNodes:n,selectedEdges:r}=wt(vle,_le);return w.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(i=>i(s))},[n,r,e]),null}const Nle=e=>!!e.onSelectionChangeHandlers;function Sle({onSelectionChange:e}){const t=wt(Nle);return e||t?l.jsx(kle,{onSelectionChange:e}):null}const kP=[0,0],Tle={x:0,y:0,zoom:1},Ale=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],W2=[...Ale,"rfId"],Cle=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),G2={translateExtent:af,nodeOrigin:kP,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Ile(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:i,setNodeExtent:a,reset:o,setDefaultNodesAndEdges:c}=wt(Cle,en),u=tn();w.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=G2,o()}),[]);const d=w.useRef(G2);return w.useEffect(()=>{for(const f of W2){const h=e[f],p=d.current[f];h!==p&&(typeof e[f]>"u"||(f==="nodes"?t(h):f==="edges"?n(h):f==="minZoom"?r(h):f==="maxZoom"?s(h):f==="translateExtent"?i(h):f==="nodeExtent"?a(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:eoe(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},W2.map(f=>e[f])),null}function q2(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Ole(e){var r;const[t,n]=w.useState(e==="system"?null:e);return w.useEffect(()=>{if(e!=="system"){n(e);return}const s=q2(),i=()=>n(s!=null&&s.matches?"dark":"light");return i(),s==null||s.addEventListener("change",i),()=>{s==null||s.removeEventListener("change",i)}},[e]),t!==null?t:(r=q2())!=null&&r.matches?"dark":"light"}const X2=typeof document<"u"?document:null;function uf(e=null,t={target:X2,actInsideInputWithModifier:!0}){const[n,r]=w.useState(!1),s=w.useRef(!1),i=w.useRef(new Set([])),[a,o]=w.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",` `).replace(` `,` +`).split(` -`)),d=u.reduce((f,h)=>f.concat(...h),[]);return[u,d]}return[[],[]]},[e]);return w.useEffect(()=>{const c=(t==null?void 0:t.target)??Q2,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=p=>{var E,g;if(s.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!s.current||s.current&&!u)&&eP(p))return!1;const y=J2(p.code,o);if(i.current.add(p[y]),Z2(a,i.current,!1)){const x=((g=(E=p.composedPath)==null?void 0:E.call(p))==null?void 0:g[0])||p.target,b=(x==null?void 0:x.nodeName)==="BUTTON"||(x==null?void 0:x.nodeName)==="A";t.preventDefault!==!1&&(s.current||!b)&&p.preventDefault(),r(!0)}},f=p=>{const m=J2(p.code,o);Z2(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(p[m]),p.key==="Meta"&&i.current.clear(),s.current=!1},h=()=>{i.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",f),window.addEventListener("blur",h),window.addEventListener("contextmenu",h),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",f),window.removeEventListener("blur",h),window.removeEventListener("contextmenu",h)}}},[e,r]),n}function Z2(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function J2(e,t){return t.includes(e)?"code":"key"}const Lle=()=>{const e=tn();return w.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,s,i],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??r,y:t.y??s,zoom:t.zoom??i},n),!0):!1},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:s,minZoom:i,maxZoom:a,panZoom:o}=e.getState(),c=Av(t,r,s,i,a,(n==null?void 0:n.padding)??.1);return o?(await o.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:s,snapToGrid:i,domNode:a}=e.getState();if(!a)return t;const{x:o,y:c}=a.getBoundingClientRect(),u={x:t.x-o,y:t.y-c},d=n.snapGrid??s,f=n.snapToGrid??i;return Jc(u,r,f,d)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:i}=r.getBoundingClientRect(),a=jc(t,n);return{x:a.x+s,y:a.y+i}}}),[])};function SP(e,t){const n=[],r=new Map,s=[];for(const i of e)if(i.type==="add"){s.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const a=r.get(i.id);a?a.push(i):r.set(i.id,[i])}for(const i of t){const a=r.get(i.id);if(!a){n.push(i);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const o={...i};for(const c of a)Mle(c,o);n.push(o)}return s.length&&s.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function Mle(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function TP(e,t){return SP(e,t)}function AP(e,t){return SP(e,t)}function co(e,t){return{id:e,type:"select",selected:t}}function zl(e,t=new Set,n=!1){const r=[];for(const[s,i]of e){const a=t.has(s);!(i.selected===void 0&&!a)&&i.selected!==a&&(n&&(i.selected=a),r.push(co(i.id,a)))}return r}function eA({items:e=[],lookup:t}){var s;const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,a]of e.entries()){const o=t.get(a.id),c=((s=o==null?void 0:o.internals)==null?void 0:s.userNode)??o;c!==void 0&&c!==a&&n.push({id:a.id,item:a,type:"replace"}),c===void 0&&n.push({item:a,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function tA(e){return{id:e.id,type:"remove"}}const jle=QD();function CP(e,t,n={}){return ooe(e,t,{...n,onError:n.onError??jle})}const nA=e=>Yae(e),Dle=e=>WD(e);function IP(e){return w.forwardRef(e)}const Ple=typeof window<"u"?w.useLayoutEffect:w.useEffect;function rA(e){const[t,n]=w.useState(BigInt(0)),[r]=w.useState(()=>Ble(()=>n(s=>s+BigInt(1))));return Ple(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function Ble(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const OP=w.createContext(null);function Fle({children:e}){const t=tn(),n=w.useCallback(o=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:h,fitViewQueued:p,onNodesChangeMiddlewareMap:m}=t.getState();let y=c;for(const g of o)y=typeof g=="function"?g(y):g;let E=eA({items:y,lookup:h});for(const g of m.values())E=g(E);d&&u(y),E.length>0?f==null||f(E):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:g,nodes:x,setNodes:b}=t.getState();g&&b(x)})},[]),r=rA(n),s=w.useCallback(o=>{const{edges:c=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:h}=t.getState();let p=c;for(const m of o)p=typeof m=="function"?m(p):m;d?u(p):f&&f(eA({items:p,lookup:h}))},[]),i=rA(s),a=w.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return l.jsx(OP.Provider,{value:a,children:e})}function Ule(){const e=w.useContext(OP);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const $le=e=>!!e.panZoom;function s0(){const e=Lle(),t=tn(),n=Ule(),r=wt($le),s=w.useMemo(()=>{const i=f=>t.getState().nodeLookup.get(f),a=f=>{n.nodeQueue.push(f)},o=f=>{n.edgeQueue.push(f)},c=f=>{var g,x;const{nodeLookup:h,nodeOrigin:p}=t.getState(),m=nA(f)?f:h.get(f.id),y=m.parentId?ZD(m.position,m.measured,m.parentId,h,p):m.position,E={...m,position:y,width:((g=m.measured)==null?void 0:g.width)??m.width,height:((x=m.measured)==null?void 0:x.height)??m.height};return Mc(E)},u=(f,h,p={replace:!1})=>{a(m=>m.map(y=>{if(y.id===f){const E=typeof h=="function"?h(y):h;return p.replace&&nA(E)?E:{...y,...E}}return y}))},d=(f,h,p={replace:!1})=>{o(m=>m.map(y=>{if(y.id===f){const E=typeof h=="function"?h(y):h;return p.replace&&Dle(E)?E:{...y,...E}}return y}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var h;return(h=i(f))==null?void 0:h.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(h=>({...h}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:a,setEdges:o,addNodes:f=>{const h=Array.isArray(f)?f:[f];n.nodeQueue.push(p=>[...p,...h])},addEdges:f=>{const h=Array.isArray(f)?f:[f];n.edgeQueue.push(p=>[...p,...h])},toObject:()=>{const{nodes:f=[],edges:h=[],transform:p}=t.getState(),[m,y,E]=p;return{nodes:f.map(g=>({...g})),edges:h.map(g=>({...g})),viewport:{x:m,y,zoom:E}}},deleteElements:async({nodes:f=[],edges:h=[]})=>{const{nodes:p,edges:m,onNodesDelete:y,onEdgesDelete:E,triggerNodeChanges:g,triggerEdgeChanges:x,onDelete:b,onBeforeDelete:_}=t.getState(),{nodes:k,edges:N}=await Qae({nodesToRemove:f,edgesToRemove:h,nodes:p,edges:m,onBeforeDelete:_}),C=N.length>0,S=k.length>0;if(C){const A=N.map(tA);E==null||E(N),x(A)}if(S){const A=k.map(tA);y==null||y(k),g(A)}return(S||C)&&(b==null||b({nodes:k,edges:N})),{deletedNodes:k,deletedEdges:N}},getIntersectingNodes:(f,h=!0,p)=>{const m=R2(f),y=m?f:c(f),E=p!==void 0;return y?(p||t.getState().nodes).filter(g=>{const x=t.getState().nodeLookup.get(g.id);if(x&&!m&&(g.id===f.id||!x.internals.positionAbsolute))return!1;const b=Mc(E?g:x),_=cf(b,y);return h&&_>0||_>=b.width*b.height||_>=y.width*y.height}):[]},isNodeIntersecting:(f,h,p=!0)=>{const y=R2(f)?f:c(f);if(!y)return!1;const E=cf(y,h);return p&&E>0||E>=h.width*h.height||E>=y.width*y.height},updateNode:u,updateNodeData:(f,h,p={replace:!1})=>{u(f,m=>{const y=typeof h=="function"?h(m):h;return p.replace?{...m,data:y}:{...m,data:{...m.data,...y}}},p)},updateEdge:d,updateEdgeData:(f,h,p={replace:!1})=>{d(f,m=>{const y=typeof h=="function"?h(m):h;return p.replace?{...m,data:y}:{...m,data:{...m.data,...y}}},p)},getNodesBounds:f=>{const{nodeLookup:h,nodeOrigin:p}=t.getState();return Wae(f,{nodeLookup:h,nodeOrigin:p})},getHandleConnections:({type:f,id:h,nodeId:p})=>{var m;return Array.from(((m=t.getState().connectionLookup.get(`${p}-${f}${h?`-${h}`:""}`))==null?void 0:m.values())??[])},getNodeConnections:({type:f,handleId:h,nodeId:p})=>{var m;return Array.from(((m=t.getState().connectionLookup.get(`${p}${f?h?`-${f}-${h}`:`-${f}`:""}`))==null?void 0:m.values())??[])},fitView:async f=>{const h=t.getState().fitViewResolver??eoe();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:h}),n.nodeQueue.push(p=>[...p]),h.promise}}},[]);return w.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const sA=e=>e.selected,Hle=typeof window<"u"?window:void 0;function zle({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=tn(),{deleteElements:r}=s0(),s=df(e,{actInsideInputWithModifier:!1}),i=df(t,{target:Hle});w.useEffect(()=>{if(s){const{edges:a,nodes:o}=n.getState();r({nodes:o.filter(sA),edges:a.filter(sA)}),n.setState({nodesSelectionActive:!1})}},[s]),w.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function Vle(e){const t=tn();w.useEffect(()=>{const n=()=>{var s,i,a,o;if(!e.current||!(((i=(s=e.current).checkVisibility)==null?void 0:i.call(s))??!0))return!1;const r=Iv(e.current);(r.height===0||r.width===0)&&((o=(a=t.getState()).onError)==null||o.call(a,"004",Zs.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const i0={position:"absolute",width:"100%",height:"100%",top:0,left:0},Kle=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Yle({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=Oo.Free,zoomOnDoubleClick:a=!0,panOnDrag:o=!0,defaultViewport:c,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:p=!0,children:m,noWheelClassName:y,noPanClassName:E,onViewportChange:g,isControlledViewport:x,paneClickDistance:b,selectionOnDrag:_}){const k=tn(),N=w.useRef(null),{userSelectionActive:C,lib:S,connectionInProgress:A}=wt(Kle,en),O=df(h),D=w.useRef();Vle(N);const U=w.useCallback(X=>{g==null||g({x:X[0],y:X[1],zoom:X[2]}),x||k.setState({transform:X})},[g,x]);return w.useEffect(()=>{if(N.current){D.current=Poe({domNode:N.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:T=>k.setState(L=>L.paneDragging===T?L:{paneDragging:T}),onPanZoomStart:(T,L)=>{const{onViewportChangeStart:R,onMoveStart:F}=k.getState();F==null||F(T,L),R==null||R(L)},onPanZoom:(T,L)=>{const{onViewportChange:R,onMove:F}=k.getState();F==null||F(T,L),R==null||R(L)},onPanZoomEnd:(T,L)=>{const{onViewportChangeEnd:R,onMoveEnd:F}=k.getState();F==null||F(T,L),R==null||R(L)}});const{x:X,y:M,zoom:j}=D.current.getViewport();return k.setState({panZoom:D.current,transform:[X,M,j],domNode:N.current.closest(".react-flow")}),()=>{var T;(T=D.current)==null||T.destroy()}}},[]),w.useEffect(()=>{var X;(X=D.current)==null||X.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:a,panOnDrag:o,zoomActivationKeyPressed:O,preventScrolling:p,noPanClassName:E,userSelectionActive:C,noWheelClassName:y,lib:S,onTransformChange:U,connectionInProgress:A,selectionOnDrag:_,paneClickDistance:b})},[e,t,n,r,s,i,a,o,O,p,E,C,y,S,U,A,_,b]),l.jsx("div",{className:"react-flow__renderer",ref:N,style:i0,children:m})}const Wle=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Gle(){const{userSelectionActive:e,userSelectionRect:t}=wt(Wle,en);return e&&t?l.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const Xy=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},qle=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function Xle({isSelecting:e,selectionKeyPressed:t,selectionMode:n=lf.Full,panOnDrag:r,autoPanOnSelection:s,paneClickDistance:i,selectionOnDrag:a,onSelectionStart:o,onSelectionEnd:c,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:m,children:y}){const E=w.useRef(0),g=tn(),{userSelectionActive:x,elementsSelectable:b,dragging:_,connectionInProgress:k,panBy:N,autoPanSpeed:C}=wt(qle,en),S=b&&(e||x),A=w.useRef(null),O=w.useRef(),D=w.useRef(new Set),U=w.useRef(new Set),X=w.useRef(!1),M=w.useRef({x:0,y:0}),j=w.useRef(!1),T=ee=>{if(X.current||k){X.current=!1;return}u==null||u(ee),g.getState().resetSelectedElements(),g.setState({nodesSelectionActive:!1})},L=ee=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){ee.preventDefault();return}d==null||d(ee)},R=f?ee=>f(ee):void 0,F=ee=>{X.current&&(ee.stopPropagation(),X.current=!1)},I=ee=>{var Ke,Ne;const{domNode:le,transform:ne}=g.getState();if(O.current=le==null?void 0:le.getBoundingClientRect(),!O.current)return;const me=ee.target===A.current;if(!me&&!!ee.target.closest(".nokey")||!e||!(a&&me||t)||ee.button!==0||!ee.isPrimary)return;(Ne=(Ke=ee.target)==null?void 0:Ke.setPointerCapture)==null||Ne.call(Ke,ee.pointerId),X.current=!1;const{x:de,y:Ee}=Ks(ee.nativeEvent,O.current),Te=Jc({x:de,y:Ee},ne);g.setState({userSelectionRect:{width:0,height:0,startX:Te.x,startY:Te.y,x:de,y:Ee}}),me||(ee.stopPropagation(),ee.preventDefault())};function V(ee,le){const{userSelectionRect:ne}=g.getState();if(!ne)return;const{transform:me,nodeLookup:ye,edgeLookup:te,connectionLookup:de,triggerNodeChanges:Ee,triggerEdgeChanges:Te,defaultEdgeOptions:Ke}=g.getState(),Ne={x:ne.startX,y:ne.startY},{x:it,y:He}=jc(Ne,me),Ue={startX:Ne.x,startY:Ne.y,x:eect.id)),U.current=new Set;const St=(Ke==null?void 0:Ke.selectable)??!0;for(const ct of D.current){const B=de.get(ct);if(B)for(const{edgeId:Q}of B.values()){const oe=te.get(Q);oe&&(oe.selectable??St)&&U.current.add(Q)}}if(!L2(Et,D.current)){const ct=zl(ye,D.current,!0);Ee(ct)}if(!L2(rt,U.current)){const ct=zl(te,U.current);Te(ct)}g.setState({userSelectionRect:Ue,userSelectionActive:!0,nodesSelectionActive:!1})}function W(){if(!s||!O.current)return;const[ee,le]=Tv(M.current,O.current,C);N({x:ee,y:le}).then(ne=>{if(!X.current||!ne){E.current=requestAnimationFrame(W);return}const{x:me,y:ye}=M.current;V(me,ye),E.current=requestAnimationFrame(W)})}const P=()=>{cancelAnimationFrame(E.current),E.current=0,j.current=!1};w.useEffect(()=>()=>P(),[]);const ie=ee=>{const{userSelectionRect:le,transform:ne,resetSelectedElements:me}=g.getState();if(!O.current||!le)return;const{x:ye,y:te}=Ks(ee.nativeEvent,O.current);M.current={x:ye,y:te};const de=jc({x:le.startX,y:le.startY},ne);if(!X.current){const Ee=t?0:i;if(Math.hypot(ye-de.x,te-de.y)<=Ee)return;me(),o==null||o(ee)}X.current=!0,j.current||(W(),j.current=!0),V(ye,te)},G=ee=>{var le,ne;ee.button===0&&((ne=(le=ee.target)==null?void 0:le.releasePointerCapture)==null||ne.call(le,ee.pointerId),!x&&ee.target===A.current&&g.getState().userSelectionRect&&(T==null||T(ee)),g.setState({userSelectionActive:!1,userSelectionRect:null}),X.current&&(c==null||c(ee),g.setState({nodesSelectionActive:D.current.size>0})),P())},re=ee=>{var le,ne;(ne=(le=ee.target)==null?void 0:le.releasePointerCapture)==null||ne.call(le,ee.pointerId),P()},ue=r===!0||Array.isArray(r)&&r.includes(0);return l.jsxs("div",{className:Ln(["react-flow__pane",{draggable:ue,dragging:_,selection:e}]),onClick:S?void 0:Xy(T,A),onContextMenu:Xy(L,A),onWheel:Xy(R,A),onPointerEnter:S?void 0:h,onPointerMove:S?ie:p,onPointerUp:S?G:void 0,onPointerCancel:S?re:void 0,onPointerDownCapture:S?I:void 0,onClickCapture:S?F:void 0,onPointerLeave:m,ref:A,style:i0,children:[y,l.jsx(Gle,{})]})}function ME({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:a,nodeLookup:o,onError:c}=t.getState(),u=o.get(e);if(!u){c==null||c("012",Zs.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(i({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=r==null?void 0:r.current)==null?void 0:d.blur()})):s([e])}function RP({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:a}){const o=tn(),[c,u]=w.useState(!1),d=w.useRef();return w.useEffect(()=>{d.current=_oe({getStoreItems:()=>o.getState(),onNodeMouseDown:f=>{ME({id:f,store:o,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),w.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:s,nodeClickDistance:a}),()=>{var f;(f=d.current)==null||f.destroy()}},[n,r,t,i,e,s,a]),c}const Qle=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function LP(){const e=tn();return w.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:c,nodeLookup:u,nodeOrigin:d}=e.getState(),f=new Map,h=Qle(a),p=s?i[0]:5,m=s?i[1]:5,y=n.direction.x*p*n.factor,E=n.direction.y*m*n.factor;for(const[,g]of u){if(!h(g))continue;let x={x:g.internals.positionAbsolute.x+y,y:g.internals.positionAbsolute.y+E};s&&(x=Uf(x,i));const{position:b,positionAbsolute:_}=GD({nodeId:g.id,nextPosition:x,nodeLookup:u,nodeExtent:r,nodeOrigin:d,onError:o});g.position=b,g.internals.positionAbsolute=_,f.set(g.id,g)}c(f)},[])}const Dv=w.createContext(null),Zle=Dv.Provider;Dv.Consumer;const MP=()=>w.useContext(Dv),Jle=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),ece=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:a}=r,{fromHandle:o,toHandle:c,isValid:u}=a,d=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,connectingTo:d,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:i===Oc.Strict?(o==null?void 0:o.type)!==n:e!==(o==null?void 0:o.nodeId)||t!==(o==null?void 0:o.id),connectionInProcess:!!o,clickConnectionInProcess:!!s,valid:d&&u}};function tce({type:e="source",position:t=Pe.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:a,onConnect:o,children:c,className:u,onMouseDown:d,onTouchStart:f,...h},p){var j,T;const m=a||null,y=e==="target",E=tn(),g=MP(),{connectOnClick:x,noPanClassName:b,rfId:_}=wt(Jle,en),{connectingFrom:k,connectingTo:N,clickConnecting:C,isPossibleEndHandle:S,connectionInProcess:A,clickConnectionInProcess:O,valid:D}=wt(ece(g,m,e),en);g||(T=(j=E.getState()).onError)==null||T.call(j,"010",Zs.error010());const U=L=>{const{defaultEdgeOptions:R,onConnect:F,hasDefaultEdges:I}=E.getState(),V={...R,...L};if(I){const{edges:W,setEdges:P,onError:ie}=E.getState();P(CP(V,W,{onError:ie}))}F==null||F(V),o==null||o(V)},X=L=>{if(!g)return;const R=tP(L.nativeEvent);if(s&&(R&&L.button===0||!R)){const F=E.getState();LE.onPointerDown(L.nativeEvent,{handleDomNode:L.currentTarget,autoPanOnConnect:F.autoPanOnConnect,connectionMode:F.connectionMode,connectionRadius:F.connectionRadius,domNode:F.domNode,nodeLookup:F.nodeLookup,lib:F.lib,isTarget:y,handleId:m,nodeId:g,flowId:F.rfId,panBy:F.panBy,cancelConnection:F.cancelConnection,onConnectStart:F.onConnectStart,onConnectEnd:(...I)=>{var V,W;return(W=(V=E.getState()).onConnectEnd)==null?void 0:W.call(V,...I)},updateConnection:F.updateConnection,onConnect:U,isValidConnection:n||((...I)=>{var V,W;return((W=(V=E.getState()).isValidConnection)==null?void 0:W.call(V,...I))??!0}),getTransform:()=>E.getState().transform,getFromHandle:()=>E.getState().connection.fromHandle,autoPanSpeed:F.autoPanSpeed,dragThreshold:F.connectionDragThreshold})}R?d==null||d(L):f==null||f(L)},M=L=>{const{onClickConnectStart:R,onClickConnectEnd:F,connectionClickStartHandle:I,connectionMode:V,isValidConnection:W,lib:P,rfId:ie,nodeLookup:G,connection:re}=E.getState();if(!g||!I&&!s)return;if(!I){R==null||R(L.nativeEvent,{nodeId:g,handleId:m,handleType:e}),E.setState({connectionClickStartHandle:{nodeId:g,type:e,id:m}});return}const ue=JD(L.target),ee=n||W,{connection:le,isValid:ne}=LE.isValid(L.nativeEvent,{handle:{nodeId:g,id:m,type:e},connectionMode:V,fromNodeId:I.nodeId,fromHandleId:I.id||null,fromType:I.type,isValidConnection:ee,flowId:ie,doc:ue,lib:P,nodeLookup:G});ne&&le&&U(le);const me=structuredClone(re);delete me.inProgress,me.toPosition=me.toHandle?me.toHandle.position:null,F==null||F(L,me),E.setState({connectionClickStartHandle:null})};return l.jsx("div",{"data-handleid":m,"data-nodeid":g,"data-handlepos":t,"data-id":`${_}-${g}-${m}-${e}`,className:Ln(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",b,u,{source:!y,target:y,connectable:r,connectablestart:s,connectableend:i,clickconnecting:C,connectingfrom:k,connectingto:N,valid:D,connectionindicator:r&&(!A||S)&&(A||O?i:s)}]),onMouseDown:X,onTouchStart:X,onClick:x?M:void 0,ref:p,...h,children:c})}const mr=w.memo(IP(tce));function nce({data:e,isConnectable:t,sourcePosition:n=Pe.Bottom}){return l.jsxs(l.Fragment,{children:[e==null?void 0:e.label,l.jsx(mr,{type:"source",position:n,isConnectable:t})]})}function rce({data:e,isConnectable:t,targetPosition:n=Pe.Top,sourcePosition:r=Pe.Bottom}){return l.jsxs(l.Fragment,{children:[l.jsx(mr,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,l.jsx(mr,{type:"source",position:r,isConnectable:t})]})}function sce(){return null}function ice({data:e,isConnectable:t,targetPosition:n=Pe.Top}){return l.jsxs(l.Fragment,{children:[l.jsx(mr,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Ym={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},iA={input:nce,default:rce,output:ice,group:sce};function ace(e){var t,n,r,s;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((s=e.style)==null?void 0:s.height)}}const oce=e=>{const{width:t,height:n,x:r,y:s}=Ff(e.nodeLookup,{filter:i=>!!i.selected});return{width:Vs(t)?t:null,height:Vs(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${s}px)`}};function lce({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=tn(),{width:s,height:i,transformString:a,userSelectionActive:o}=wt(oce,en),c=LP(),u=w.useRef(null);w.useEffect(()=>{var p;n||(p=u.current)==null||p.focus({preventScroll:!0})},[n]);const d=!o&&s!==null&&i!==null;if(RP({nodeRef:u,disabled:!d}),!d)return null;const f=e?p=>{const m=r.getState().nodes.filter(y=>y.selected);e(p,m)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(Ym,p.key)&&(p.preventDefault(),c({direction:Ym[p.key],factor:p.shiftKey?4:1}))};return l.jsx("div",{className:Ln(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:l.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:s,height:i}})})}const aA=typeof window<"u"?window:void 0,cce=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function jP({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,paneClickDistance:o,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:d,selectionMode:f,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:y,zoomActivationKeyCode:E,elementsSelectable:g,zoomOnScroll:x,zoomOnPinch:b,panOnScroll:_,panOnScrollSpeed:k,panOnScrollMode:N,zoomOnDoubleClick:C,panOnDrag:S,autoPanOnSelection:A,defaultViewport:O,translateExtent:D,minZoom:U,maxZoom:X,preventScrolling:M,onSelectionContextMenu:j,noWheelClassName:T,noPanClassName:L,disableKeyboardA11y:R,onViewportChange:F,isControlledViewport:I}){const{nodesSelectionActive:V,userSelectionActive:W}=wt(cce,en),P=df(u,{target:aA}),ie=df(y,{target:aA}),G=ie||S,re=ie||_,ue=d&&G!==!0,ee=P||W||ue;return zle({deleteKeyCode:c,multiSelectionKeyCode:m}),l.jsx(Yle,{onPaneContextMenu:i,elementsSelectable:g,zoomOnScroll:x,zoomOnPinch:b,panOnScroll:re,panOnScrollSpeed:k,panOnScrollMode:N,zoomOnDoubleClick:C,panOnDrag:!P&&G,defaultViewport:O,translateExtent:D,minZoom:U,maxZoom:X,zoomActivationKeyCode:E,preventScrolling:M,noWheelClassName:T,noPanClassName:L,onViewportChange:F,isControlledViewport:I,paneClickDistance:o,selectionOnDrag:ue,children:l.jsxs(Xle,{onSelectionStart:h,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:G,autoPanOnSelection:A,isSelecting:!!ee,selectionMode:f,selectionKeyPressed:P,paneClickDistance:o,selectionOnDrag:ue,children:[e,V&&l.jsx(lce,{onSelectionContextMenu:j,noPanClassName:L,disableKeyboardA11y:R})]})})}jP.displayName="FlowRenderer";const uce=w.memo(jP),dce=e=>t=>e?Sv(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function fce(e){return wt(w.useCallback(dce(e),[e]),en)}const hce=e=>e.updateNodeInternals;function pce(){const e=wt(hce),[t]=w.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(s=>{const i=s.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:s.target,force:!0})}),e(r)}));return w.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function mce({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=tn(),i=w.useRef(null),a=w.useRef(null),o=w.useRef(e.sourcePosition),c=w.useRef(e.targetPosition),u=w.useRef(t),d=n&&!!e.internals.handleBounds;return w.useEffect(()=>{i.current&&!e.hidden&&(!d||a.current!==i.current)&&(a.current&&(r==null||r.unobserve(a.current)),r==null||r.observe(i.current),a.current=i.current)},[d,e.hidden]),w.useEffect(()=>()=>{a.current&&(r==null||r.unobserve(a.current),a.current=null)},[]),w.useEffect(()=>{if(i.current){const f=u.current!==t,h=o.current!==e.sourcePosition,p=c.current!==e.targetPosition;(f||h||p)&&(u.current=t,o.current=e.sourcePosition,c.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function gce({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:i,onDoubleClick:a,nodesDraggable:o,elementsSelectable:c,nodesConnectable:u,nodesFocusable:d,resizeObserver:f,noDragClassName:h,noPanClassName:p,disableKeyboardA11y:m,rfId:y,nodeTypes:E,nodeClickDistance:g,onError:x}){const{node:b,internals:_,isParent:k}=wt(ee=>{const le=ee.nodeLookup.get(e),ne=ee.parentLookup.has(e);return{node:le,internals:le.internals,isParent:ne}},en);let N=b.type||"default",C=(E==null?void 0:E[N])||iA[N];C===void 0&&(x==null||x("003",Zs.error003(N)),N="default",C=(E==null?void 0:E.default)||iA.default);const S=!!(b.draggable||o&&typeof b.draggable>"u"),A=!!(b.selectable||c&&typeof b.selectable>"u"),O=!!(b.connectable||u&&typeof b.connectable>"u"),D=!!(b.focusable||d&&typeof b.focusable>"u"),U=tn(),X=Cv(b),M=mce({node:b,nodeType:N,hasDimensions:X,resizeObserver:f}),j=RP({nodeRef:M,disabled:b.hidden||!S,noDragClassName:h,handleSelector:b.dragHandle,nodeId:e,isSelectable:A,nodeClickDistance:g}),T=LP();if(b.hidden)return null;const L=ia(b),R=ace(b),F=A||S||t||n||r||s,I=n?ee=>n(ee,{..._.userNode}):void 0,V=r?ee=>r(ee,{..._.userNode}):void 0,W=s?ee=>s(ee,{..._.userNode}):void 0,P=i?ee=>i(ee,{..._.userNode}):void 0,ie=a?ee=>a(ee,{..._.userNode}):void 0,G=ee=>{const{selectNodesOnDrag:le,nodeDragThreshold:ne}=U.getState();A&&(!le||!S||ne>0)&&ME({id:e,store:U,nodeRef:M}),t&&t(ee,{..._.userNode})},re=ee=>{if(!(eP(ee.nativeEvent)||m)){if(zD.includes(ee.key)&&A){const le=ee.key==="Escape";ME({id:e,store:U,unselect:le,nodeRef:M})}else if(S&&b.selected&&Object.prototype.hasOwnProperty.call(Ym,ee.key)){ee.preventDefault();const{ariaLabelConfig:le}=U.getState();U.setState({ariaLiveMessage:le["node.a11yDescription.ariaLiveMessage"]({direction:ee.key.replace("Arrow","").toLowerCase(),x:~~_.positionAbsolute.x,y:~~_.positionAbsolute.y})}),T({direction:Ym[ee.key],factor:ee.shiftKey?4:1})}}},ue=()=>{var de;if(m||!((de=M.current)!=null&&de.matches(":focus-visible")))return;const{transform:ee,width:le,height:ne,autoPanOnNodeFocus:me,setCenter:ye}=U.getState();if(!me)return;Sv(new Map([[e,b]]),{x:0,y:0,width:le,height:ne},ee,!0).length>0||ye(b.position.x+L.width/2,b.position.y+L.height/2,{zoom:ee[2]})};return l.jsx("div",{className:Ln(["react-flow__node",`react-flow__node-${N}`,{[p]:S},b.className,{selected:b.selected,selectable:A,parent:k,draggable:S,dragging:j}]),ref:M,style:{zIndex:_.z,transform:`translate(${_.positionAbsolute.x}px,${_.positionAbsolute.y}px)`,pointerEvents:F?"all":"none",visibility:X?"visible":"hidden",...b.style,...R},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:I,onMouseMove:V,onMouseLeave:W,onContextMenu:P,onClick:G,onDoubleClick:ie,onKeyDown:D?re:void 0,tabIndex:D?0:void 0,onFocus:D?ue:void 0,role:b.ariaRole??(D?"group":void 0),"aria-roledescription":"node","aria-describedby":m?void 0:`${_P}-${y}`,"aria-label":b.ariaLabel,...b.domAttributes,children:l.jsx(Zle,{value:e,children:l.jsx(C,{id:e,data:b.data,type:N,positionAbsoluteX:_.positionAbsolute.x,positionAbsoluteY:_.positionAbsolute.y,selected:b.selected??!1,selectable:A,draggable:S,deletable:b.deletable??!0,isConnectable:O,sourcePosition:b.sourcePosition,targetPosition:b.targetPosition,dragging:j,dragHandle:b.dragHandle,zIndex:_.z,parentId:b.parentId,...L})})})}var yce=w.memo(gce);const bce=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function DP(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:i}=wt(bce,en),a=fce(e.onlyRenderVisibleElements),o=pce();return l.jsx("div",{className:"react-flow__nodes",style:i0,children:a.map(c=>l.jsx(yce,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:i},c))})}DP.displayName="NodeRenderer";const Ece=w.memo(DP);function xce(e){return wt(w.useCallback(n=>{if(!e)return n.edges.map(s=>s.id);const r=[];if(n.width&&n.height)for(const s of n.edges){const i=n.nodeLookup.get(s.source),a=n.nodeLookup.get(s.target);i&&a&&soe({sourceNode:i,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),en)}const wce=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return l.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},vce=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return l.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},oA={[Rc.Arrow]:wce,[Rc.ArrowClosed]:vce};function _ce(e){const t=tn();return w.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(oA,e)?oA[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",Zs.error009(e)),null)},[e])}const kce=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:a,orient:o="auto-start-reverse"})=>{const c=_ce(t);return c?l.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:o,refX:"0",refY:"0",children:l.jsx(c,{color:n,strokeWidth:a})}):null},PP=({defaultColor:e,rfId:t})=>{const n=wt(i=>i.edges),r=wt(i=>i.defaultEdgeOptions),s=w.useMemo(()=>foe(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return s.length?l.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:l.jsx("defs",{children:s.map(i=>l.jsx(kce,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};PP.displayName="MarkerDefinitions";var Nce=w.memo(PP);function BP({x:e,y:t,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:i,labelBgPadding:a=[2,4],labelBgBorderRadius:o=2,children:c,className:u,...d}){const[f,h]=w.useState({x:1,y:0,width:0,height:0}),p=Ln(["react-flow__edge-textwrapper",u]),m=w.useRef(null);return w.useEffect(()=>{if(m.current){const y=m.current.getBBox();h({x:y.x,y:y.y,width:y.width,height:y.height})}},[n]),n?l.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...d,children:[s&&l.jsx("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:i,rx:o,ry:o}),l.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:m,style:r,children:n}),c]}):null}BP.displayName="EdgeText";const Sce=w.memo(BP);function $f({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:o,labelBgBorderRadius:c,interactionWidth:u=20,...d}){return l.jsxs(l.Fragment,{children:[l.jsx("path",{...d,d:e,fill:"none",className:Ln(["react-flow__edge-path",d.className])}),u?l.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&Vs(t)&&Vs(n)?l.jsx(Sce,{x:t,y:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:o,labelBgBorderRadius:c}):null]})}function lA({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===Pe.Left||e===Pe.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function FP({sourceX:e,sourceY:t,sourcePosition:n=Pe.Bottom,targetX:r,targetY:s,targetPosition:i=Pe.Top}){const[a,o]=lA({pos:n,x1:e,y1:t,x2:r,y2:s}),[c,u]=lA({pos:i,x1:r,y1:s,x2:e,y2:t}),[d,f,h,p]=nP({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:a,sourceControlY:o,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${o} ${c},${u} ${r},${s}`,d,f,h,p]}function UP(e){return w.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a,targetPosition:o,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:y,markerStart:E,interactionWidth:g})=>{const[x,b,_]=FP({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:o}),k=e.isInternal?void 0:t;return l.jsx($f,{id:k,path:x,labelX:b,labelY:_,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:y,markerStart:E,interactionWidth:g})})}const Tce=UP({isInternal:!1}),$P=UP({isInternal:!0});Tce.displayName="SimpleBezierEdge";$P.displayName="SimpleBezierEdgeInternal";function HP(e){return w.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:p=Pe.Bottom,targetPosition:m=Pe.Top,markerEnd:y,markerStart:E,pathOptions:g,interactionWidth:x})=>{const[b,_,k]=Km({sourceX:n,sourceY:r,sourcePosition:p,targetX:s,targetY:i,targetPosition:m,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset,stepPosition:g==null?void 0:g.stepPosition}),N=e.isInternal?void 0:t;return l.jsx($f,{id:N,path:b,labelX:_,labelY:k,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:y,markerStart:E,interactionWidth:x})})}const zP=HP({isInternal:!1}),VP=HP({isInternal:!0});zP.displayName="SmoothStepEdge";VP.displayName="SmoothStepEdgeInternal";function KP(e){return w.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return l.jsx(zP,{...n,id:r,pathOptions:w.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const Ace=KP({isInternal:!1}),YP=KP({isInternal:!0});Ace.displayName="StepEdge";YP.displayName="StepEdgeInternal";function WP(e){return w.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:m,interactionWidth:y})=>{const[E,g,x]=iP({sourceX:n,sourceY:r,targetX:s,targetY:i}),b=e.isInternal?void 0:t;return l.jsx($f,{id:b,path:E,labelX:g,labelY:x,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:m,interactionWidth:y})})}const Cce=WP({isInternal:!1}),GP=WP({isInternal:!0});Cce.displayName="StraightEdge";GP.displayName="StraightEdgeInternal";function qP(e){return w.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a=Pe.Bottom,targetPosition:o=Pe.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:y,markerStart:E,pathOptions:g,interactionWidth:x})=>{const[b,_,k]=rP({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:o,curvature:g==null?void 0:g.curvature}),N=e.isInternal?void 0:t;return l.jsx($f,{id:N,path:b,labelX:_,labelY:k,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:y,markerStart:E,interactionWidth:x})})}const Ice=qP({isInternal:!1}),XP=qP({isInternal:!0});Ice.displayName="BezierEdge";XP.displayName="BezierEdgeInternal";const cA={default:XP,straight:GP,step:YP,smoothstep:VP,simplebezier:$P},uA={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Oce=(e,t,n)=>n===Pe.Left?e-t:n===Pe.Right?e+t:e,Rce=(e,t,n)=>n===Pe.Top?e-t:n===Pe.Bottom?e+t:e,dA="react-flow__edgeupdater";function fA({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:a,type:o}){return l.jsx("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:a,className:Ln([dA,`${dA}-${o}`]),cx:Oce(t,r,e),cy:Rce(n,r,e),r,stroke:"transparent",fill:"transparent"})}function Lce({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:i,targetY:a,sourcePosition:o,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:h,setUpdateHover:p}){const m=tn(),y=(_,k)=>{if(_.button!==0)return;const{autoPanOnConnect:N,domNode:C,connectionMode:S,connectionRadius:A,lib:O,onConnectStart:D,cancelConnection:U,nodeLookup:X,rfId:M,panBy:j,updateConnection:T}=m.getState(),L=k.type==="target",R=(V,W)=>{h(!1),f==null||f(V,n,k.type,W)},F=V=>u==null?void 0:u(n,V),I=(V,W)=>{h(!0),d==null||d(_,n,k.type),D==null||D(V,W)};LE.onPointerDown(_.nativeEvent,{autoPanOnConnect:N,connectionMode:S,connectionRadius:A,domNode:C,handleId:k.id,nodeId:k.nodeId,nodeLookup:X,isTarget:L,edgeUpdaterType:k.type,lib:O,flowId:M,cancelConnection:U,panBy:j,isValidConnection:(...V)=>{var W,P;return((P=(W=m.getState()).isValidConnection)==null?void 0:P.call(W,...V))??!0},onConnect:F,onConnectStart:I,onConnectEnd:(...V)=>{var W,P;return(P=(W=m.getState()).onConnectEnd)==null?void 0:P.call(W,...V)},onReconnectEnd:R,updateConnection:T,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:_.currentTarget})},E=_=>y(_,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),g=_=>y(_,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),x=()=>p(!0),b=()=>p(!1);return l.jsxs(l.Fragment,{children:[(e===!0||e==="source")&&l.jsx(fA,{position:o,centerX:r,centerY:s,radius:t,onMouseDown:E,onMouseEnter:x,onMouseOut:b,type:"source"}),(e===!0||e==="target")&&l.jsx(fA,{position:c,centerX:i,centerY:a,radius:t,onMouseDown:g,onMouseEnter:x,onMouseOut:b,type:"target"})]})}function Mce({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:i,onContextMenu:a,onMouseEnter:o,onMouseMove:c,onMouseLeave:u,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,rfId:m,edgeTypes:y,noPanClassName:E,onError:g,disableKeyboardA11y:x}){let b=wt(ye=>ye.edgeLookup.get(e));const _=wt(ye=>ye.defaultEdgeOptions);b=_?{..._,...b}:b;let k=b.type||"default",N=(y==null?void 0:y[k])||cA[k];N===void 0&&(g==null||g("011",Zs.error011(k)),k="default",N=(y==null?void 0:y.default)||cA.default);const C=!!(b.focusable||t&&typeof b.focusable>"u"),S=typeof f<"u"&&(b.reconnectable||n&&typeof b.reconnectable>"u"),A=!!(b.selectable||r&&typeof b.selectable>"u"),O=w.useRef(null),[D,U]=w.useState(!1),[X,M]=w.useState(!1),j=tn(),{zIndex:T,sourceX:L,sourceY:R,targetX:F,targetY:I,sourcePosition:V,targetPosition:W}=wt(w.useCallback(ye=>{const te=ye.nodeLookup.get(b.source),de=ye.nodeLookup.get(b.target);if(!te||!de)return{zIndex:b.zIndex,...uA};const Ee=doe({id:e,sourceNode:te,targetNode:de,sourceHandle:b.sourceHandle||null,targetHandle:b.targetHandle||null,connectionMode:ye.connectionMode,onError:g});return{zIndex:roe({selected:b.selected,zIndex:b.zIndex,sourceNode:te,targetNode:de,elevateOnSelect:ye.elevateEdgesOnSelect,zIndexMode:ye.zIndexMode}),...Ee||uA}},[b.source,b.target,b.sourceHandle,b.targetHandle,b.selected,b.zIndex]),en),P=w.useMemo(()=>b.markerStart?`url('#${OE(b.markerStart,m)}')`:void 0,[b.markerStart,m]),ie=w.useMemo(()=>b.markerEnd?`url('#${OE(b.markerEnd,m)}')`:void 0,[b.markerEnd,m]);if(b.hidden||L===null||R===null||F===null||I===null)return null;const G=ye=>{var Te;const{addSelectedEdges:te,unselectNodesAndEdges:de,multiSelectionActive:Ee}=j.getState();A&&(j.setState({nodesSelectionActive:!1}),b.selected&&Ee?(de({nodes:[],edges:[b]}),(Te=O.current)==null||Te.blur()):te([e])),s&&s(ye,b)},re=i?ye=>{i(ye,{...b})}:void 0,ue=a?ye=>{a(ye,{...b})}:void 0,ee=o?ye=>{o(ye,{...b})}:void 0,le=c?ye=>{c(ye,{...b})}:void 0,ne=u?ye=>{u(ye,{...b})}:void 0,me=ye=>{var te;if(!x&&zD.includes(ye.key)&&A){const{unselectNodesAndEdges:de,addSelectedEdges:Ee}=j.getState();ye.key==="Escape"?((te=O.current)==null||te.blur(),de({edges:[b]})):Ee([e])}};return l.jsx("svg",{style:{zIndex:T},children:l.jsxs("g",{className:Ln(["react-flow__edge",`react-flow__edge-${k}`,b.className,E,{selected:b.selected,animated:b.animated,inactive:!A&&!s,updating:D,selectable:A}]),onClick:G,onDoubleClick:re,onContextMenu:ue,onMouseEnter:ee,onMouseMove:le,onMouseLeave:ne,onKeyDown:C?me:void 0,tabIndex:C?0:void 0,role:b.ariaRole??(C?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":b.ariaLabel===null?void 0:b.ariaLabel||`Edge from ${b.source} to ${b.target}`,"aria-describedby":C?`${kP}-${m}`:void 0,ref:O,...b.domAttributes,children:[!X&&l.jsx(N,{id:e,source:b.source,target:b.target,type:b.type,selected:b.selected,animated:b.animated,selectable:A,deletable:b.deletable??!0,label:b.label,labelStyle:b.labelStyle,labelShowBg:b.labelShowBg,labelBgStyle:b.labelBgStyle,labelBgPadding:b.labelBgPadding,labelBgBorderRadius:b.labelBgBorderRadius,sourceX:L,sourceY:R,targetX:F,targetY:I,sourcePosition:V,targetPosition:W,data:b.data,style:b.style,sourceHandleId:b.sourceHandle,targetHandleId:b.targetHandle,markerStart:P,markerEnd:ie,pathOptions:"pathOptions"in b?b.pathOptions:void 0,interactionWidth:b.interactionWidth}),S&&l.jsx(Lce,{edge:b,isReconnectable:S,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,sourceX:L,sourceY:R,targetX:F,targetY:I,sourcePosition:V,targetPosition:W,setUpdateHover:U,setReconnecting:M})]})})}var jce=w.memo(Mce);const Dce=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function QP({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:i,onEdgeContextMenu:a,onEdgeMouseEnter:o,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:h,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:y}){const{edgesFocusable:E,edgesReconnectable:g,elementsSelectable:x,onError:b}=wt(Dce,en),_=xce(t);return l.jsxs("div",{className:"react-flow__edges",children:[l.jsx(Nce,{defaultColor:e,rfId:n}),_.map(k=>l.jsx(jce,{id:k,edgesFocusable:E,edgesReconnectable:g,elementsSelectable:x,noPanClassName:s,onReconnect:i,onContextMenu:a,onMouseEnter:o,onMouseMove:c,onMouseLeave:u,onClick:d,reconnectRadius:f,onDoubleClick:h,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:b,edgeTypes:r,disableKeyboardA11y:y},k))]})}QP.displayName="EdgeRenderer";const Pce=w.memo(QP),Bce=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Fce({children:e}){const t=wt(Bce);return l.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Uce(e){const t=s0(),n=w.useRef(!1);w.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const $ce=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function Hce(e){const t=wt($ce),n=tn();return w.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function zce(e){return e.connection.inProgress?{...e.connection,to:Jc(e.connection.to,e.transform)}:{...e.connection}}function Vce(e){return zce}function Kce(e){const t=Vce();return wt(t,en)}const Yce=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Wce({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:i,height:a,isValid:o,inProgress:c}=wt(Yce,en);return!(i&&s&&c)?null:l.jsx("svg",{style:e,width:i,height:a,className:"react-flow__connectionline react-flow__container",children:l.jsx("g",{className:Ln(["react-flow__connection",YD(o)]),children:l.jsx(ZP,{style:t,type:n,CustomComponent:r,isValid:o})})})}const ZP=({style:e,type:t=va.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:i,fromNode:a,fromHandle:o,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h,pointer:p}=Kce();if(!s)return;if(n)return l.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:o,fromX:i.x,fromY:i.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:h,connectionStatus:YD(r),toNode:d,toHandle:f,pointer:p});let m="";const y={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case va.Bezier:[m]=rP(y);break;case va.SimpleBezier:[m]=FP(y);break;case va.Step:[m]=Km({...y,borderRadius:0});break;case va.SmoothStep:[m]=Km(y);break;default:[m]=iP(y)}return l.jsx("path",{d:m,fill:"none",className:"react-flow__connection-path",style:e})};ZP.displayName="ConnectionLine";const Gce={};function hA(e=Gce){w.useRef(e),tn(),w.useEffect(()=>{},[e])}function qce(){tn(),w.useRef(!1),w.useEffect(()=>{},[])}function JP({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:i,onEdgeDoubleClick:a,onNodeMouseEnter:o,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:h,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:y,connectionLineComponent:E,connectionLineContainerStyle:g,selectionKeyCode:x,selectionOnDrag:b,selectionMode:_,multiSelectionKeyCode:k,panActivationKeyCode:N,zoomActivationKeyCode:C,deleteKeyCode:S,onlyRenderVisibleElements:A,elementsSelectable:O,defaultViewport:D,translateExtent:U,minZoom:X,maxZoom:M,preventScrolling:j,defaultMarkerColor:T,zoomOnScroll:L,zoomOnPinch:R,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:V,zoomOnDoubleClick:W,panOnDrag:P,autoPanOnSelection:ie,onPaneClick:G,onPaneMouseEnter:re,onPaneMouseMove:ue,onPaneMouseLeave:ee,onPaneScroll:le,onPaneContextMenu:ne,paneClickDistance:me,nodeClickDistance:ye,onEdgeContextMenu:te,onEdgeMouseEnter:de,onEdgeMouseMove:Ee,onEdgeMouseLeave:Te,reconnectRadius:Ke,onReconnect:Ne,onReconnectStart:it,onReconnectEnd:He,noDragClassName:Ue,noWheelClassName:Et,noPanClassName:rt,disableKeyboardA11y:St,nodeExtent:ct,rfId:B,viewport:Q,onViewportChange:oe}){return hA(e),hA(t),qce(),Uce(n),Hce(Q),l.jsx(uce,{onPaneClick:G,onPaneMouseEnter:re,onPaneMouseMove:ue,onPaneMouseLeave:ee,onPaneContextMenu:ne,onPaneScroll:le,paneClickDistance:me,deleteKeyCode:S,selectionKeyCode:x,selectionOnDrag:b,selectionMode:_,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:k,panActivationKeyCode:N,zoomActivationKeyCode:C,elementsSelectable:O,zoomOnScroll:L,zoomOnPinch:R,zoomOnDoubleClick:W,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:V,panOnDrag:P,autoPanOnSelection:ie,defaultViewport:D,translateExtent:U,minZoom:X,maxZoom:M,onSelectionContextMenu:f,preventScrolling:j,noDragClassName:Ue,noWheelClassName:Et,noPanClassName:rt,disableKeyboardA11y:St,onViewportChange:oe,isControlledViewport:!!Q,children:l.jsxs(Fce,{children:[l.jsx(Pce,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:a,onReconnect:Ne,onReconnectStart:it,onReconnectEnd:He,onlyRenderVisibleElements:A,onEdgeContextMenu:te,onEdgeMouseEnter:de,onEdgeMouseMove:Ee,onEdgeMouseLeave:Te,reconnectRadius:Ke,defaultMarkerColor:T,noPanClassName:rt,disableKeyboardA11y:St,rfId:B}),l.jsx(Wce,{style:y,type:m,component:E,containerStyle:g}),l.jsx("div",{className:"react-flow__edgelabel-renderer"}),l.jsx(Ece,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:o,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:ye,onlyRenderVisibleElements:A,noPanClassName:rt,noDragClassName:Ue,disableKeyboardA11y:St,nodeExtent:ct,rfId:B}),l.jsx("div",{className:"react-flow__viewport-portal"})]})})}JP.displayName="GraphView";const Xce=w.memo(JP),Qce=QD(),pA=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:o,minZoom:c=.5,maxZoom:u=2,nodeOrigin:d,nodeExtent:f,zIndexMode:h="basic"}={})=>{const p=new Map,m=new Map,y=new Map,E=new Map,g=r??t??[],x=n??e??[],b=d??[0,0],_=f??of;lP(y,E,g);const{nodesInitialized:k}=RE(x,p,m,{nodeOrigin:b,nodeExtent:_,zIndexMode:h});let N=[0,0,1];if(a&&s&&i){const C=Ff(p,{filter:D=>!!((D.width||D.initialWidth)&&(D.height||D.initialHeight))}),{x:S,y:A,zoom:O}=Av(C,s,i,c,u,(o==null?void 0:o.padding)??.1);N=[S,A,O]}return{rfId:"1",width:s??0,height:i??0,transform:N,nodes:x,nodesInitialized:k,nodeLookup:p,parentLookup:m,edges:g,edgeLookup:E,connectionLookup:y,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:of,nodeExtent:_,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Oc.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:b,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:o,fitViewResolver:null,connection:{...KD},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Qce,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:VD,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Zce=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:o,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h})=>ple((p,m)=>{async function y(){const{nodeLookup:E,panZoom:g,fitViewOptions:x,fitViewResolver:b,width:_,height:k,minZoom:N,maxZoom:C}=m();g&&(await Xae({nodes:E,width:_,height:k,panZoom:g,minZoom:N,maxZoom:C},x),b==null||b.resolve(!0),p({fitViewResolver:null}))}return{...pA({nodes:e,edges:t,width:s,height:i,fitView:a,fitViewOptions:o,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,defaultNodes:n,defaultEdges:r,zIndexMode:h}),setNodes:E=>{const{nodeLookup:g,parentLookup:x,nodeOrigin:b,elevateNodesOnSelect:_,fitViewQueued:k,zIndexMode:N,nodesSelectionActive:C}=m(),{nodesInitialized:S,hasSelectedNodes:A}=RE(E,g,x,{nodeOrigin:b,nodeExtent:f,elevateNodesOnSelect:_,checkEquality:!0,zIndexMode:N}),O=C&&A;k&&S?(y(),p({nodes:E,nodesInitialized:S,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:O})):p({nodes:E,nodesInitialized:S,nodesSelectionActive:O})},setEdges:E=>{const{connectionLookup:g,edgeLookup:x}=m();lP(g,x,E),p({edges:E})},setDefaultNodesAndEdges:(E,g)=>{if(E){const{setNodes:x}=m();x(E),p({hasDefaultNodes:!0})}if(g){const{setEdges:x}=m();x(g),p({hasDefaultEdges:!0})}},updateNodeInternals:E=>{const{triggerNodeChanges:g,nodeLookup:x,parentLookup:b,domNode:_,nodeOrigin:k,nodeExtent:N,debug:C,fitViewQueued:S,zIndexMode:A}=m(),{changes:O,updatedInternals:D}=Eoe(E,x,b,_,k,N,A);D&&(moe(x,b,{nodeOrigin:k,nodeExtent:N,zIndexMode:A}),S?(y(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),(O==null?void 0:O.length)>0&&(C&&console.log("React Flow: trigger node changes",O),g==null||g(O)))},updateNodePositions:(E,g=!1)=>{const x=[];let b=[];const{nodeLookup:_,triggerNodeChanges:k,connection:N,updateConnection:C,onNodesChangeMiddlewareMap:S}=m();for(const[A,O]of E){const D=_.get(A),U=!!(D!=null&&D.expandParent&&(D!=null&&D.parentId)&&(O!=null&&O.position)),X={id:A,type:"position",position:U?{x:Math.max(0,O.position.x),y:Math.max(0,O.position.y)}:O.position,dragging:g};if(D&&N.inProgress&&N.fromNode.id===D.id){const M=Ko(D,N.fromHandle,Pe.Left,!0);C({...N,from:M})}U&&D.parentId&&x.push({id:A,parentId:D.parentId,rect:{...O.internals.positionAbsolute,width:O.measured.width??0,height:O.measured.height??0}}),b.push(X)}if(x.length>0){const{parentLookup:A,nodeOrigin:O}=m(),D=jv(x,_,A,O);b.push(...D)}for(const A of S.values())b=A(b);k(b)},triggerNodeChanges:E=>{const{onNodesChange:g,setNodes:x,nodes:b,hasDefaultNodes:_,debug:k}=m();if(E!=null&&E.length){if(_){const N=TP(E,b);x(N)}k&&console.log("React Flow: trigger node changes",E),g==null||g(E)}},triggerEdgeChanges:E=>{const{onEdgesChange:g,setEdges:x,edges:b,hasDefaultEdges:_,debug:k}=m();if(E!=null&&E.length){if(_){const N=AP(E,b);x(N)}k&&console.log("React Flow: trigger edge changes",E),g==null||g(E)}},addSelectedNodes:E=>{const{multiSelectionActive:g,edgeLookup:x,nodeLookup:b,triggerNodeChanges:_,triggerEdgeChanges:k}=m();if(g){const N=E.map(C=>co(C,!0));_(N);return}_(zl(b,new Set([...E]),!0)),k(zl(x))},addSelectedEdges:E=>{const{multiSelectionActive:g,edgeLookup:x,nodeLookup:b,triggerNodeChanges:_,triggerEdgeChanges:k}=m();if(g){const N=E.map(C=>co(C,!0));k(N);return}k(zl(x,new Set([...E]))),_(zl(b,new Set,!0))},unselectNodesAndEdges:({nodes:E,edges:g}={})=>{const{edges:x,nodes:b,nodeLookup:_,triggerNodeChanges:k,triggerEdgeChanges:N}=m(),C=E||b,S=g||x,A=[];for(const D of C){if(!D.selected)continue;const U=_.get(D.id);U&&(U.selected=!1),A.push(co(D.id,!1))}const O=[];for(const D of S)D.selected&&O.push(co(D.id,!1));k(A),N(O)},setMinZoom:E=>{const{panZoom:g,maxZoom:x}=m();g==null||g.setScaleExtent([E,x]),p({minZoom:E})},setMaxZoom:E=>{const{panZoom:g,minZoom:x}=m();g==null||g.setScaleExtent([x,E]),p({maxZoom:E})},setTranslateExtent:E=>{var g;(g=m().panZoom)==null||g.setTranslateExtent(E),p({translateExtent:E})},resetSelectedElements:()=>{const{edges:E,nodes:g,triggerNodeChanges:x,triggerEdgeChanges:b,elementsSelectable:_}=m();if(!_)return;const k=g.reduce((C,S)=>S.selected?[...C,co(S.id,!1)]:C,[]),N=E.reduce((C,S)=>S.selected?[...C,co(S.id,!1)]:C,[]);x(k),b(N)},setNodeExtent:E=>{const{nodes:g,nodeLookup:x,parentLookup:b,nodeOrigin:_,elevateNodesOnSelect:k,nodeExtent:N,zIndexMode:C}=m();E[0][0]===N[0][0]&&E[0][1]===N[0][1]&&E[1][0]===N[1][0]&&E[1][1]===N[1][1]||(RE(g,x,b,{nodeOrigin:_,nodeExtent:E,elevateNodesOnSelect:k,checkEquality:!1,zIndexMode:C}),p({nodeExtent:E}))},panBy:E=>{const{transform:g,width:x,height:b,panZoom:_,translateExtent:k}=m();return xoe({delta:E,panZoom:_,transform:g,translateExtent:k,width:x,height:b})},setCenter:async(E,g,x)=>{const{width:b,height:_,maxZoom:k,panZoom:N}=m();if(!N)return!1;const C=typeof(x==null?void 0:x.zoom)<"u"?x.zoom:k;return await N.setViewport({x:b/2-E*C,y:_/2-g*C,zoom:C},{duration:x==null?void 0:x.duration,ease:x==null?void 0:x.ease,interpolate:x==null?void 0:x.interpolate}),!0},cancelConnection:()=>{p({connection:{...KD}})},updateConnection:E=>{p({connection:E})},reset:()=>p({...pA()})}},Object.is);function Pv({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:i,initialMinZoom:a,initialMaxZoom:o,initialFitViewOptions:c,fitView:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:p}){const[m]=w.useState(()=>Zce({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:u,minZoom:a,maxZoom:o,fitViewOptions:c,nodeOrigin:d,nodeExtent:f,zIndexMode:h}));return l.jsx(mle,{value:m,children:l.jsx(Fle,{children:p})})}function Jce({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:i,height:a,fitView:o,fitViewOptions:c,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p}){return w.useContext(n0)?l.jsx(l.Fragment,{children:e}):l.jsx(Pv,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:i,initialHeight:a,fitView:o,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p,children:e})}const eue={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function tue({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i,edgeTypes:a,onNodeClick:o,onEdgeClick:c,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:h,onConnect:p,onConnectStart:m,onConnectEnd:y,onClickConnectStart:E,onClickConnectEnd:g,onNodeMouseEnter:x,onNodeMouseMove:b,onNodeMouseLeave:_,onNodeContextMenu:k,onNodeDoubleClick:N,onNodeDragStart:C,onNodeDrag:S,onNodeDragStop:A,onNodesDelete:O,onEdgesDelete:D,onDelete:U,onSelectionChange:X,onSelectionDragStart:M,onSelectionDrag:j,onSelectionDragStop:T,onSelectionContextMenu:L,onSelectionStart:R,onSelectionEnd:F,onBeforeDelete:I,connectionMode:V,connectionLineType:W=va.Bezier,connectionLineStyle:P,connectionLineComponent:ie,connectionLineContainerStyle:G,deleteKeyCode:re="Backspace",selectionKeyCode:ue="Shift",selectionOnDrag:ee=!1,selectionMode:le=lf.Full,panActivationKeyCode:ne="Space",multiSelectionKeyCode:me=uf()?"Meta":"Control",zoomActivationKeyCode:ye=uf()?"Meta":"Control",snapToGrid:te,snapGrid:de,onlyRenderVisibleElements:Ee=!1,selectNodesOnDrag:Te,nodesDraggable:Ke,autoPanOnNodeFocus:Ne,nodesConnectable:it,nodesFocusable:He,nodeOrigin:Ue=NP,edgesFocusable:Et,edgesReconnectable:rt,elementsSelectable:St=!0,defaultViewport:ct=Ale,minZoom:B=.5,maxZoom:Q=2,translateExtent:oe=of,preventScrolling:be=!0,nodeExtent:Oe,defaultMarkerColor:Ye="#b1b1b7",zoomOnScroll:tt=!0,zoomOnPinch:ze=!0,panOnScroll:Tt=!1,panOnScrollSpeed:Re=.5,panOnScrollMode:kt=Oo.Free,zoomOnDoubleClick:Pt=!0,panOnDrag:Bt=!0,onPaneClick:bn,onPaneMouseEnter:Xe,onPaneMouseMove:ft,onPaneMouseLeave:xt,onPaneScroll:vt,onPaneContextMenu:fe,paneClickDistance:$e=1,nodeClickDistance:nt=0,children:qt,onReconnect:fn,onReconnectStart:Lt,onReconnectEnd:J,onEdgeContextMenu:he,onEdgeDoubleClick:Le,onEdgeMouseEnter:Be,onEdgeMouseMove:ot,onEdgeMouseLeave:It,reconnectRadius:st=10,onNodesChange:Z,onEdgesChange:we,noDragClassName:_e="nodrag",noWheelClassName:We="nowheel",noPanClassName:Ve="nopan",fitView:Je,fitViewOptions:ut,connectOnClick:Vt,attributionPosition:Ft,proOptions:hn,defaultEdgeOptions:Tn,elevateNodesOnSelect:Kt=!0,elevateEdgesOnSelect:os=!1,disableKeyboardA11y:Er=!1,autoPanOnConnect:Xn,autoPanOnNodeDrag:Or,autoPanOnSelection:Qn=!0,autoPanSpeed:ar,connectionRadius:An,isValidConnection:Xt,onError:En,style:Un,id:or,nodeDragThreshold:nn,connectionDragThreshold:ls,viewport:Zn,onViewportChange:$n,width:Jn,height:Is,colorMode:Rr="light",debug:xr,onScroll:cs,ariaLabelConfig:Kr,zIndexMode:qa="basic",...Xa},Qa){const Si=or||"1",Hn=Rle(Rr),Za=w.useCallback(Ti=>{Ti.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),cs==null||cs(Ti)},[cs]);return l.jsx("div",{"data-testid":"rf__wrapper",...Xa,onScroll:Za,style:{...Un,...eue},ref:Qa,className:Ln(["react-flow",s,Hn]),id:or,role:"application",children:l.jsxs(Jce,{nodes:e,edges:t,width:Jn,height:Is,fitView:Je,fitViewOptions:ut,minZoom:B,maxZoom:Q,nodeOrigin:Ue,nodeExtent:Oe,zIndexMode:qa,children:[l.jsx(Ole,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:y,onClickConnectStart:E,onClickConnectEnd:g,nodesDraggable:Ke,autoPanOnNodeFocus:Ne,nodesConnectable:it,nodesFocusable:He,edgesFocusable:Et,edgesReconnectable:rt,elementsSelectable:St,elevateNodesOnSelect:Kt,elevateEdgesOnSelect:os,minZoom:B,maxZoom:Q,nodeExtent:Oe,onNodesChange:Z,onEdgesChange:we,snapToGrid:te,snapGrid:de,connectionMode:V,translateExtent:oe,connectOnClick:Vt,defaultEdgeOptions:Tn,fitView:Je,fitViewOptions:ut,onNodesDelete:O,onEdgesDelete:D,onDelete:U,onNodeDragStart:C,onNodeDrag:S,onNodeDragStop:A,onSelectionDrag:j,onSelectionDragStart:M,onSelectionDragStop:T,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:Ve,nodeOrigin:Ue,rfId:Si,autoPanOnConnect:Xn,autoPanOnNodeDrag:Or,autoPanSpeed:ar,onError:En,connectionRadius:An,isValidConnection:Xt,selectNodesOnDrag:Te,nodeDragThreshold:nn,connectionDragThreshold:ls,onBeforeDelete:I,debug:xr,ariaLabelConfig:Kr,zIndexMode:qa}),l.jsx(Xce,{onInit:u,onNodeClick:o,onEdgeClick:c,onNodeMouseEnter:x,onNodeMouseMove:b,onNodeMouseLeave:_,onNodeContextMenu:k,onNodeDoubleClick:N,nodeTypes:i,edgeTypes:a,connectionLineType:W,connectionLineStyle:P,connectionLineComponent:ie,connectionLineContainerStyle:G,selectionKeyCode:ue,selectionOnDrag:ee,selectionMode:le,deleteKeyCode:re,multiSelectionKeyCode:me,panActivationKeyCode:ne,zoomActivationKeyCode:ye,onlyRenderVisibleElements:Ee,defaultViewport:ct,translateExtent:oe,minZoom:B,maxZoom:Q,preventScrolling:be,zoomOnScroll:tt,zoomOnPinch:ze,zoomOnDoubleClick:Pt,panOnScroll:Tt,panOnScrollSpeed:Re,panOnScrollMode:kt,panOnDrag:Bt,autoPanOnSelection:Qn,onPaneClick:bn,onPaneMouseEnter:Xe,onPaneMouseMove:ft,onPaneMouseLeave:xt,onPaneScroll:vt,onPaneContextMenu:fe,paneClickDistance:$e,nodeClickDistance:nt,onSelectionContextMenu:L,onSelectionStart:R,onSelectionEnd:F,onReconnect:fn,onReconnectStart:Lt,onReconnectEnd:J,onEdgeContextMenu:he,onEdgeDoubleClick:Le,onEdgeMouseEnter:Be,onEdgeMouseMove:ot,onEdgeMouseLeave:It,reconnectRadius:st,defaultMarkerColor:Ye,noDragClassName:_e,noWheelClassName:We,noPanClassName:Ve,rfId:Si,disableKeyboardA11y:Er,nodeExtent:Oe,viewport:Zn,onViewportChange:$n}),l.jsx(Tle,{onSelectionChange:X}),qt,l.jsx(vle,{proOptions:hn,position:Ft}),l.jsx(wle,{rfId:Si,disableKeyboardA11y:Er})]})})}var e4=IP(tue);const nue=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function rue({children:e}){const t=wt(nue);return t?Ss.createPortal(e,t):null}function t4(e){const[t,n]=w.useState(e),r=w.useCallback(s=>n(i=>TP(s,i)),[]);return[t,n,r]}function n4(e){const[t,n]=w.useState(e),r=w.useCallback(s=>n(i=>AP(s,i)),[]);return[t,n,r]}const sue=e=>t=>{if(!e.includeHiddenNodes)return t.nodesInitialized;if(t.nodeLookup.size===0)return!1;for(const[,{internals:n}]of t.nodeLookup)if(n.handleBounds===void 0||!Cv(n.userNode))return!1;return!0};function iue(e={includeHiddenNodes:!1}){return wt(sue(e))}function aue({dimensions:e,lineWidth:t,variant:n,className:r}){return l.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Ln(["react-flow__background-pattern",n,r])})}function oue({radius:e,className:t}){return l.jsx("circle",{cx:e,cy:e,r:e,className:Ln(["react-flow__background-pattern","dots",t])})}var ja;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ja||(ja={}));const lue={[ja.Dots]:1,[ja.Lines]:1,[ja.Cross]:6},cue=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function r4({id:e,variant:t=ja.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=0,color:a,bgColor:o,style:c,className:u,patternClassName:d}){const f=w.useRef(null),{transform:h,patternId:p}=wt(cue,en),m=r||lue[t],y=t===ja.Dots,E=t===ja.Cross,g=Array.isArray(n)?n:[n,n],x=[g[0]*h[2]||1,g[1]*h[2]||1],b=m*h[2],_=Array.isArray(i)?i:[i,i],k=E?[b,b]:x,N=[_[0]*h[2]||1+k[0]/2,_[1]*h[2]||1+k[1]/2],C=`${p}${e||""}`;return l.jsxs("svg",{className:Ln(["react-flow__background",u]),style:{...c,...i0,"--xy-background-color-props":o,"--xy-background-pattern-color-props":a},ref:f,"data-testid":"rf__background",children:[l.jsx("pattern",{id:C,x:h[0]%x[0],y:h[1]%x[1],width:x[0],height:x[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${N[0]},-${N[1]})`,children:y?l.jsx(oue,{radius:b/2,className:d}):l.jsx(aue,{dimensions:k,lineWidth:s,variant:t,className:d})}),l.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${C})`})]})}r4.displayName="Background";const s4=w.memo(r4);function uue(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:l.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function due(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:l.jsx("path",{d:"M0 0h32v4.2H0z"})})}function fue(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:l.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function hue(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:l.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function pue(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:l.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Jh({children:e,className:t,...n}){return l.jsx("button",{type:"button",className:Ln(["react-flow__controls-button",t]),...n,children:e})}const mue=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function i4({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:a,onFitView:o,onInteractiveChange:c,className:u,children:d,position:f="bottom-left",orientation:h="vertical","aria-label":p}){const m=tn(),{isInteractive:y,minZoomReached:E,maxZoomReached:g,ariaLabelConfig:x}=wt(mue,en),{zoomIn:b,zoomOut:_,fitView:k}=s0(),N=()=>{b(),i==null||i()},C=()=>{_(),a==null||a()},S=()=>{k(s),o==null||o()},A=()=>{m.setState({nodesDraggable:!y,nodesConnectable:!y,elementsSelectable:!y}),c==null||c(!y)},O=h==="horizontal"?"horizontal":"vertical";return l.jsxs(r0,{className:Ln(["react-flow__controls",O,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":p??x["controls.ariaLabel"],children:[t&&l.jsxs(l.Fragment,{children:[l.jsx(Jh,{onClick:N,className:"react-flow__controls-zoomin",title:x["controls.zoomIn.ariaLabel"],"aria-label":x["controls.zoomIn.ariaLabel"],disabled:g,children:l.jsx(uue,{})}),l.jsx(Jh,{onClick:C,className:"react-flow__controls-zoomout",title:x["controls.zoomOut.ariaLabel"],"aria-label":x["controls.zoomOut.ariaLabel"],disabled:E,children:l.jsx(due,{})})]}),n&&l.jsx(Jh,{className:"react-flow__controls-fitview",onClick:S,title:x["controls.fitView.ariaLabel"],"aria-label":x["controls.fitView.ariaLabel"],children:l.jsx(fue,{})}),r&&l.jsx(Jh,{className:"react-flow__controls-interactive",onClick:A,title:x["controls.interactive.ariaLabel"],"aria-label":x["controls.interactive.ariaLabel"],children:y?l.jsx(pue,{}):l.jsx(hue,{})}),d]})}i4.displayName="Controls";const a4=w.memo(i4);function gue({id:e,x:t,y:n,width:r,height:s,style:i,color:a,strokeColor:o,strokeWidth:c,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:p}){const{background:m,backgroundColor:y}=i||{},E=a||m||y;return l.jsx("rect",{className:Ln(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:d,ry:d,width:r,height:s,style:{fill:E,stroke:o,strokeWidth:c},shapeRendering:f,onClick:p?g=>p(g,e):void 0})}const yue=w.memo(gue),bue=e=>e.nodes.map(t=>t.id),Qy=e=>e instanceof Function?e:()=>e;function Eue({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=yue,onClick:a}){const o=wt(bue,en),c=Qy(t),u=Qy(e),d=Qy(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return l.jsx(l.Fragment,{children:o.map(h=>l.jsx(wue,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:a,shapeRendering:f},h))})}function xue({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:i,shapeRendering:a,NodeComponent:o,onClick:c}){const{node:u,x:d,y:f,width:h,height:p}=wt(m=>{const y=m.nodeLookup.get(e);if(!y)return{node:void 0,x:0,y:0,width:0,height:0};const E=y.internals.userNode,{x:g,y:x}=y.internals.positionAbsolute,{width:b,height:_}=ia(E);return{node:E,x:g,y:x,width:b,height:_}},en);return!u||u.hidden||!Cv(u)?null:l.jsx(o,{x:d,y:f,width:h,height:p,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:s,strokeColor:n(u),strokeWidth:i,shapeRendering:a,onClick:c,id:u.id})}const wue=w.memo(xue);var vue=w.memo(Eue);const _ue=200,kue=150,Nue=e=>!e.hidden,Sue=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?XD(Ff(e.nodeLookup,{filter:Nue}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Tue="react-flow__minimap-desc";function o4({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:a,nodeComponent:o,bgColor:c,maskColor:u,maskStrokeColor:d,maskStrokeWidth:f,position:h="bottom-right",onClick:p,onNodeClick:m,pannable:y=!1,zoomable:E=!1,ariaLabel:g,inversePan:x,zoomStep:b=1,offsetScale:_=5}){const k=tn(),N=w.useRef(null),{boundingRect:C,viewBB:S,rfId:A,panZoom:O,translateExtent:D,flowWidth:U,flowHeight:X,ariaLabelConfig:M}=wt(Sue,en),j=(e==null?void 0:e.width)??_ue,T=(e==null?void 0:e.height)??kue,L=C.width/j,R=C.height/T,F=Math.max(L,R),I=F*j,V=F*T,W=_*F,P=C.x-(I-C.width)/2-W,ie=C.y-(V-C.height)/2-W,G=I+W*2,re=V+W*2,ue=`${Tue}-${A}`,ee=w.useRef(0),le=w.useRef();ee.current=F,w.useEffect(()=>{if(N.current&&O)return le.current=Coe({domNode:N.current,panZoom:O,getTransform:()=>k.getState().transform,getViewScale:()=>ee.current}),()=>{var te;(te=le.current)==null||te.destroy()}},[O]),w.useEffect(()=>{var te;(te=le.current)==null||te.update({translateExtent:D,width:U,height:X,inversePan:x,pannable:y,zoomStep:b,zoomable:E})},[y,E,x,b,D,U,X]);const ne=p?te=>{var Te;const[de,Ee]=((Te=le.current)==null?void 0:Te.pointer(te))||[0,0];p(te,{x:de,y:Ee})}:void 0,me=m?w.useCallback((te,de)=>{const Ee=k.getState().nodeLookup.get(de).internals.userNode;m(te,Ee)},[]):void 0,ye=g??M["minimap.ariaLabel"];return l.jsx(r0,{position:h,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*F:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof a=="number"?a:void 0},className:Ln(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:l.jsxs("svg",{width:j,height:T,viewBox:`${P} ${ie} ${G} ${re}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ue,ref:N,onClick:ne,children:[ye&&l.jsx("title",{id:ue,children:ye}),l.jsx(vue,{onClick:me,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:o}),l.jsx("path",{className:"react-flow__minimap-mask",d:`M${P-W},${ie-W}h${G+W*2}v${re+W*2}h${-G-W*2}z - M${S.x},${S.y}h${S.width}v${S.height}h${-S.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}o4.displayName="MiniMap";const Aue=w.memo(o4),Cue=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Iue={[Dc.Line]:"right",[Dc.Handle]:"bottom-right"};function Oue({nodeId:e,position:t,variant:n=Dc.Handle,className:r,style:s=void 0,children:i,color:a,minWidth:o=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:h,autoScale:p=!0,shouldResize:m,onResizeStart:y,onResize:E,onResizeEnd:g}){const x=MP(),b=typeof e=="string"?e:x,_=tn(),k=w.useRef(null),N=n===Dc.Handle,C=wt(w.useCallback(Cue(N&&p),[N,p]),en),S=w.useRef(null),A=t??Iue[n];w.useEffect(()=>{if(!(!k.current||!b))return S.current||(S.current=Hoe({domNode:k.current,nodeId:b,getStoreItems:()=>{const{nodeLookup:D,transform:U,snapGrid:X,snapToGrid:M,nodeOrigin:j,domNode:T}=_.getState();return{nodeLookup:D,transform:U,snapGrid:X,snapToGrid:M,nodeOrigin:j,paneDomNode:T}},onChange:(D,U)=>{const{triggerNodeChanges:X,nodeLookup:M,parentLookup:j,nodeOrigin:T}=_.getState(),L=[],R={x:D.x,y:D.y},F=M.get(b);if(F&&F.expandParent&&F.parentId){const I=F.origin??T,V=D.width??F.measured.width??0,W=D.height??F.measured.height??0,P={id:F.id,parentId:F.parentId,rect:{width:V,height:W,...ZD({x:D.x??F.position.x,y:D.y??F.position.y},{width:V,height:W},F.parentId,M,I)}},ie=jv([P],M,j,T);L.push(...ie),R.x=D.x?Math.max(I[0]*V,D.x):void 0,R.y=D.y?Math.max(I[1]*W,D.y):void 0}if(R.x!==void 0&&R.y!==void 0){const I={id:b,type:"position",position:{...R}};L.push(I)}if(D.width!==void 0&&D.height!==void 0){const V={id:b,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:D.width,height:D.height}};L.push(V)}for(const I of U){const V={...I,type:"position"};L.push(V)}X(L)},onEnd:({width:D,height:U})=>{const X={id:b,type:"dimensions",resizing:!1,dimensions:{width:D,height:U}};_.getState().triggerNodeChanges([X])}})),S.current.update({controlPosition:A,boundaries:{minWidth:o,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:y,onResize:E,onResizeEnd:g,shouldResize:m}),()=>{var D;(D=S.current)==null||D.destroy()}},[A,o,c,u,d,f,y,E,g,m]);const O=A.split("-");return l.jsx("div",{className:Ln(["react-flow__resize-control","nodrag",...O,n,r]),ref:k,style:{...s,scale:C,...a&&{[N?"backgroundColor":"borderColor"]:a}},children:i})}w.memo(Oue);var l4=Object.defineProperty,Rue=(e,t,n)=>t in e?l4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Lue=(e,t)=>{for(var n in t)l4(e,n,{get:t[n],enumerable:!0})},Mue=(e,t,n)=>Rue(e,t+"",n),c4={};Lue(c4,{Graph:()=>Cs,alg:()=>Bv,json:()=>d4,version:()=>Pue});var jue=Object.defineProperty,u4=(e,t)=>{for(var n in t)jue(e,n,{get:t[n],enumerable:!0})},Cs=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected="directed"in e?e.directed:!0,this._isMultigraph="multigraph"in e?e.multigraph:!1,this._isCompound="compound"in e?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return typeof e!="function"?this._defaultNodeLabelFn=()=>e:this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(n=>{t!==void 0?this.setNode(n,t):this.setNode(n)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]="\0",this._children[e]={},this._children["\0"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(n=>{this.setParent(n)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t===void 0)t="\0";else{t+="";for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw new Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!=="\0")return t}}children(e="\0"){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e==="\0")return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t);for(let r of this.successors(e))n.add(r);return Array.from(n.values())}}isLeaf(e){let t;return this.isDirected()?t=this.successors(e):t=this.neighbors(e),t.length===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([s,i])=>{e(s)&&t.setNode(s,i)}),Object.values(this._edgeObjs).forEach(s=>{t.hasNode(s.v)&&t.hasNode(s.w)&&t.setEdge(s,this.edge(s))});let n={},r=s=>{let i=this.parent(s);return!i||t.hasNode(i)?(n[s]=i??void 0,i??void 0):i in n?n[i]:r(i)};return this._isCompound&&t.nodes().forEach(s=>t.setParent(s,r(s))),t}setDefaultEdgeLabel(e){return typeof e!="function"?this._defaultEdgeLabelFn=()=>e:this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((n,r)=>(t!==void 0?this.setEdge(n,r,t):this.setEdge(n,r),r)),this}setEdge(e,t,n,r){let s,i,a,o,c=!1;typeof e=="object"&&e!==null&&"v"in e?(s=e.v,i=e.w,a=e.name,arguments.length===2&&(o=t,c=!0)):(s=e,i=t,a=r,arguments.length>2&&(o=n,c=!0)),s=""+s,i=""+i,a!==void 0&&(a=""+a);let u=Vu(this._isDirected,s,i,a);if(u in this._edgeLabels)return c&&(this._edgeLabels[u]=o),this;if(a!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(s),this.setNode(i),this._edgeLabels[u]=c?o:this._defaultEdgeLabelFn(s,i,a);let d=Due(this._isDirected,s,i,a);return s=d.v,i=d.w,Object.freeze(d),this._edgeObjs[u]=d,mA(this._preds[i],s),mA(this._sucs[s],i),this._in[i][u]=d,this._out[s][u]=d,this._edgeCount++,this}edge(e,t,n){let r=arguments.length===1?Zy(this._isDirected,e):Vu(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof r!="object"?{label:r}:r}hasEdge(e,t,n){return(arguments.length===1?Zy(this._isDirected,e):Vu(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?Zy(this._isDirected,e):Vu(this._isDirected,e,t,n),s=this._edgeObjs[r];if(s){let i=s.v,a=s.w;delete this._edgeLabels[r],delete this._edgeObjs[r],gA(this._preds[a],i),gA(this._sucs[i],a),delete this._in[a][r],delete this._out[i][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(s=>s.v===t&&s.w===n||s.v===n&&s.w===t):r}};function mA(e,t){e[t]?e[t]++:e[t]=1}function gA(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function Vu(e,t,n,r){let s=""+t,i=""+n;if(!e&&s>i){let a=s;s=i,i=a}return s+""+i+""+(r===void 0?"\0":r)}function Due(e,t,n,r){let s=""+t,i=""+n;if(!e&&s>i){let o=s;s=i,i=o}let a={v:s,w:i};return r&&(a.name=r),a}function Zy(e,t){return Vu(e,t.v,t.w,t.name)}var Pue="4.0.1",d4={};u4(d4,{read:()=>$ue,write:()=>Bue});function Bue(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:Fue(e),edges:Uue(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function Fue(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),s={v:t};return n!==void 0&&(s.value=n),r!==void 0&&(s.parent=r),s})}function Uue(e){return e.edges().map(t=>{let n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function $ue(e){let t=new Cs(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(n=>{t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(n=>{t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var Bv={};u4(Bv,{CycleException:()=>Gm,bellmanFord:()=>f4,components:()=>Vue,dijkstra:()=>Wm,dijkstraAll:()=>Wue,findCycles:()=>Gue,floydWarshall:()=>Xue,isAcyclic:()=>Zue,postorder:()=>ede,preorder:()=>tde,prim:()=>nde,shortestPaths:()=>rde,tarjan:()=>p4,topsort:()=>m4});var Hue=()=>1;function f4(e,t,n,r){return zue(e,String(t),n||Hue,r||function(s){return e.outEdges(s)})}function zue(e,t,n,r){let s={},i,a=0,o=e.nodes(),c=function(f){let h=n(f);s[f.v].distance+he.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let s=this._arr,i=s.length;return n[r]=i,s.push({key:r,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw new Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,s=e;n>1,!(t[r].priority1;function Wm(e,t,n,r){let s=function(i){return e.outEdges(i)};return Yue(e,String(t),n||Kue,r||s)}function Yue(e,t,n,r){let s={},i=new h4,a,o,c=function(u){let d=u.v!==a?u.v:u.w,f=s[d],h=n(u),p=o.distance+h;if(h<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+h);p0&&(a=i.removeMin(),o=s[a],o.distance!==Number.POSITIVE_INFINITY);)r(a).forEach(c);return s}function Wue(e,t,n){return e.nodes().reduce(function(r,s){return r[s]=Wm(e,s,t,n),r},{})}function p4(e){let t=0,n=[],r={},s=[];function i(a){let o=r[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(c){c in r?r[c].onStack&&(o.lowlink=Math.min(o.lowlink,r[c].index)):(i(c),o.lowlink=Math.min(o.lowlink,r[c].lowlink))}),o.lowlink===o.index){let c=[],u;do u=n.pop(),r[u].onStack=!1,c.push(u);while(a!==u);s.push(c)}}return e.nodes().forEach(function(a){a in r||i(a)}),s}function Gue(e){return p4(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var que=()=>1;function Xue(e,t,n){return Que(e,t||que,n||function(r){return e.outEdges(r)})}function Que(e,t,n){let r={},s=e.nodes();return s.forEach(function(i){r[i]={},r[i][i]={distance:0,predecessor:""},s.forEach(function(a){i!==a&&(r[i][a]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(i).forEach(function(a){let o=a.v===i?a.w:a.v,c=t(a);r[i][o]={distance:c,predecessor:i}})}),s.forEach(function(i){let a=r[i];s.forEach(function(o){let c=r[o];s.forEach(function(u){let d=c[i],f=a[u],h=c[u],p=d.distance+f.distance;p{var c;return(c=e.isDirected()?e.successors(o):e.neighbors(o))!=null?c:[]},a={};return t.forEach(function(o){if(!e.hasNode(o))throw new Error("Graph does not have node: "+o);s=g4(e,o,n==="post",a,i,r,s)}),s}function g4(e,t,n,r,s,i,a){return t in r||(r[t]=!0,n||(a=i(a,t)),s(t).forEach(function(o){a=g4(e,o,n,r,s,i,a)}),n&&(a=i(a,t))),a}function y4(e,t,n){return Jue(e,t,n,function(r,s){return r.push(s),r},[])}function ede(e,t){return y4(e,t,"post")}function tde(e,t){return y4(e,t,"pre")}function nde(e,t){let n=new Cs,r={},s=new h4,i;function a(c){let u=c.v===i?c.w:c.v,d=s.priority(u);if(d!==void 0){let f=t(c);f0;){if(i=s.removeMin(),i in r)n.setEdge(i,r[i]);else{if(o)throw new Error("Input graph is not connected: "+e);o=!0}e.nodeEdges(i).forEach(a)}return n}function rde(e,t,n,r){return sde(e,t,n,r??(s=>{let i=e.outEdges(s);return i??[]}))}function sde(e,t,n,r){if(n===void 0)return Wm(e,t,n,r);let s=!1,i=e.nodes();for(let a=0;at.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},s=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+s.weight,minlen:Math.max(r.minlen,s.minlen)})}),t}function b4(e){let t=new Cs({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function yA(e,t){let n=e.x,r=e.y,s=t.x-n,i=t.y-r,a=e.width/2,o=e.height/2;if(!s&&!i)throw new Error("Not possible to find intersection inside of the rectangle");let c,u;return Math.abs(i)*a>Math.abs(s)*o?(i<0&&(o=-o),c=o*s/i,u=o):(s<0&&(a=-a),c=a,u=a*i/s),{x:n+c,y:r+u}}function Hf(e){let t=ff(x4(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),s=r.rank;s!==void 0&&(t[s]||(t[s]=[]),t[s][r.order]=n)}),t}function ade(e){let t=e.nodes().map(r=>{let s=e.node(r).rank;return s===void 0?Number.MAX_VALUE:s}),n=mi(Math.min,t);e.nodes().forEach(r=>{let s=e.node(r);Object.hasOwn(s,"rank")&&(s.rank-=n)})}function ode(e){let t=e.nodes().map(a=>e.node(a).rank).filter(a=>a!==void 0),n=mi(Math.min,t),r=[];e.nodes().forEach(a=>{let o=e.node(a).rank-n;r[o]||(r[o]=[]),r[o].push(a)});let s=0,i=e.graph().nodeRankFactor;Array.from(r).forEach((a,o)=>{a===void 0&&o%i!==0?--s:a!==void 0&&s&&a.forEach(c=>e.node(c).rank+=s)})}function bA(e,t,n,r){let s={width:0,height:0};return arguments.length>=4&&(s.rank=n,s.order=r),eu(e,"border",s,t)}function lde(e,t=E4){let n=[];for(let r=0;rE4){let n=lde(t);return e(...n.map(r=>e(...r)))}else return e(...t)}function x4(e){let t=e.nodes().map(n=>{let r=e.node(n).rank;return r===void 0?Number.MIN_VALUE:r});return mi(Math.max,t)}function cde(e,t){let n={lhs:[],rhs:[]};return e.forEach(r=>{t(r)?n.lhs.push(r):n.rhs.push(r)}),n}function w4(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function v4(e,t){return t()}var ude=0;function Fv(e){let t=++ude;return e+(""+t)}function ff(e,t,n=1){t==null&&(t=e,e=0);let r=i=>itr[t]:n=t,Object.entries(e).reduce((r,[s,i])=>(r[s]=n(i,s),r),{})}function dde(e,t){return e.reduce((n,r,s)=>(n[r]=t[s],n),{})}var o0="\0",fde="3.0.0",hde=class{constructor(){Mue(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return EA(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&EA(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,pde)),n=n._prev;return"["+e.join(", ")+"]"}};function EA(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function pde(e,t){if(e!=="_next"&&e!=="_prev")return t}var mde=hde,gde=()=>1;function yde(e,t){if(e.nodeCount()<=1)return[];let n=Ede(e,t||gde);return bde(n.graph,n.buckets,n.zeroIdx).flatMap(r=>e.outEdges(r.v,r.w)||[])}function bde(e,t,n){var r;let s=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)Jy(e,t,n,o);for(;o=i.dequeue();)Jy(e,t,n,o);if(e.nodeCount()){for(let c=t.length-2;c>0;--c)if(o=(r=t[c])==null?void 0:r.dequeue(),o){s=s.concat(Jy(e,t,n,o,!0)||[]);break}}}return s}function Jy(e,t,n,r,s){let i=[],a=s?i:void 0;return(e.inEdges(r.v)||[]).forEach(o=>{let c=e.edge(o),u=e.node(o.v);s&&i.push({v:o.v,w:o.w}),u.out-=c,jE(t,n,u)}),(e.outEdges(r.v)||[]).forEach(o=>{let c=e.edge(o),u=o.w,d=e.node(u);d.in-=c,jE(t,n,d)}),e.removeNode(r.v),a}function Ede(e,t){let n=new Cs,r=0,s=0;e.nodes().forEach(o=>{n.setNode(o,{v:o,in:0,out:0})}),e.edges().forEach(o=>{let c=n.edge(o.v,o.w)||0,u=t(o),d=c+u;n.setEdge(o.v,o.w,d);let f=n.node(o.v),h=n.node(o.w);s=Math.max(s,f.out+=u),r=Math.max(r,h.in+=u)});let i=xde(s+r+3).map(()=>new mde),a=r+1;return n.nodes().forEach(o=>{jE(i,a,n.node(o))}),{graph:n,buckets:i,zeroIdx:a}}function jE(e,t,n){var r,s,i;n.out?n.in?(i=e[n.out-n.in+t])==null||i.enqueue(n):(s=e[e.length-1])==null||s.enqueue(n):(r=e[0])==null||r.enqueue(n)}function xde(e){let t=[];for(let n=0;n{let r=e.edge(n);e.removeEdge(n),r.forwardName=n.name,r.reversed=!0,e.setEdge(n.w,n.v,r,Fv("rev"))});function t(n){return r=>n.edge(r).weight}}function vde(e){let t=[],n={},r={};function s(i){Object.hasOwn(r,i)||(r[i]=!0,n[i]=!0,e.outEdges(i).forEach(a=>{Object.hasOwn(n,a.w)?t.push(a):s(a.w)}),delete n[i])}return e.nodes().forEach(s),t}function _de(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function kde(e){e.graph().dummyChains=[],e.edges().forEach(t=>Nde(e,t))}function Nde(e,t){let n=t.v,r=e.node(n).rank,s=t.w,i=e.node(s).rank,a=t.name,o=e.edge(t),c=o.labelRank;if(i===r+1)return;e.removeEdge(t);let u,d,f;for(f=0,++r;r{let n=e.node(t),r=n.edgeLabel,s;for(e.setEdge(n.edgeObj,r);n.dummy;)s=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=s,n=e.node(t)})}function Uv(e){let t={};function n(r){let s=e.node(r);if(Object.hasOwn(t,r))return s.rank;t[r]=!0;let i=e.outEdges(r),a=i?i.map(c=>c==null?Number.POSITIVE_INFINITY:n(c.w)-e.edge(c).minlen):[],o=mi(Math.min,a);return o===Number.POSITIVE_INFINITY&&(o=0),s.rank=o}e.sources().forEach(n)}function Bc(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var _4=Tde;function Tde(e){let t=new Cs({directed:!1}),n=e.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let r=n[0],s=e.nodeCount();t.setNode(r,{});let i,a;for(;Ade(t,e){let a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!Bc(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return e.nodes().forEach(n),e.nodeCount()}function Cde(e,t){return t.edges().reduce((n,r)=>{let s=Number.POSITIVE_INFINITY;return e.hasNode(r.v)!==e.hasNode(r.w)&&(s=Bc(t,r)),st.node(r).rank+=n)}var{preorder:Ode,postorder:Rde}=Bv,Lde=el;el.initLowLimValues=Hv;el.initCutValues=$v;el.calcCutValue=k4;el.leaveEdge=S4;el.enterEdge=T4;el.exchangeEdges=A4;function el(e){e=ide(e),Uv(e);let t=_4(e);Hv(t),$v(t,e);let n,r;for(;n=S4(t);)r=T4(t,e,n),A4(t,e,n,r)}function $v(e,t){let n=Rde(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(r=>Mde(e,t,r))}function Mde(e,t,n){let r=e.node(n).parent,s=e.edge(n,r);s.cutvalue=k4(e,t,n)}function k4(e,t,n){let r=e.node(n).parent,s=!0,i=t.edge(n,r),a=0;i||(s=!1,i=t.edge(r,n)),a=i.weight;let o=t.nodeEdges(n);return o&&o.forEach(c=>{let u=c.v===n,d=u?c.w:c.v;if(d!==r){let f=u===s,h=t.edge(c).weight;if(a+=f?h:-h,Dde(e,n,d)){let p=e.edge(n,d).cutvalue;a+=f?-p:p}}}),a}function Hv(e,t){arguments.length<2&&(t=e.nodes()[0]),N4(e,{},1,t)}function N4(e,t,n,r,s){let i=n,a=e.node(r);t[r]=!0;let o=e.neighbors(r);return o&&o.forEach(c=>{Object.hasOwn(t,c)||(n=N4(e,t,n,c,r))}),a.low=i,a.lim=n++,s?a.parent=s:delete a.parent,n}function S4(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function T4(e,t,n){let r=n.v,s=n.w;t.hasEdge(r,s)||(r=n.w,s=n.v);let i=e.node(r),a=e.node(s),o=i,c=!1;return i.lim>a.lim&&(o=a,c=!0),t.edges().filter(u=>c===xA(e,e.node(u.v),o)&&c!==xA(e,e.node(u.w),o)).reduce((u,d)=>Bc(t,d)!e.node(s).parent);if(!n)return;let r=Ode(e,[n]);r=r.slice(1),r.forEach(s=>{let i=e.node(s).parent,a=t.edge(s,i),o=!1;a||(a=t.edge(i,s),o=!0),t.node(s).rank=t.node(i).rank+(o?a.minlen:-a.minlen)})}function Dde(e,t,n){return e.hasEdge(t,n)}function xA(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var Pde=Bde;function Bde(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":wA(e);break;case"tight-tree":Ude(e);break;case"longest-path":Fde(e);break;case"none":break;default:wA(e)}}var Fde=Uv;function Ude(e){Uv(e),_4(e)}function wA(e){Lde(e)}var $de=Hde;function Hde(e){let t=Vde(e);e.graph().dummyChains.forEach(n=>{let r=e.node(n),s=r.edgeObj,i=zde(e,t,s.v,s.w),a=i.path,o=i.lca,c=0,u=a[c],d=!0;for(;n!==s.w;){if(r=e.node(n),d){for(;(u=a[c])!==o&&e.node(u).maxRanka||o>t[c].lim));let u=c,d=r;for(;(d=e.parent(d))!==u;)i.push(d);return{path:s.concat(i.reverse()),lca:u}}function Vde(e){let t={},n=0;function r(s){let i=n;e.children(s).forEach(r),t[s]={low:i,lim:n++}}return e.children(o0).forEach(r),t}function Kde(e){let t=eu(e,"root",{},"_root"),n=Yde(e),r=Object.values(n),s=mi(Math.max,r)-1,i=2*s+1;e.graph().nestingRoot=t,e.edges().forEach(o=>e.edge(o).minlen*=i);let a=Wde(e)+1;e.children(o0).forEach(o=>C4(e,t,i,a,s,n,o)),e.graph().nodeRankFactor=i}function C4(e,t,n,r,s,i,a){var o;let c=e.children(a);if(!c.length){a!==t&&e.setEdge(t,a,{weight:0,minlen:n});return}let u=bA(e,"_bt"),d=bA(e,"_bb"),f=e.node(a);e.setParent(u,a),f.borderTop=u,e.setParent(d,a),f.borderBottom=d,c.forEach(h=>{var p;C4(e,t,n,r,s,i,h);let m=e.node(h),y=m.borderTop?m.borderTop:h,E=m.borderBottom?m.borderBottom:h,g=m.borderTop?r:2*r,x=y!==E?1:s-((p=i[a])!=null?p:0)+1;e.setEdge(u,y,{weight:g,minlen:x,nestingEdge:!0}),e.setEdge(E,d,{weight:g,minlen:x,nestingEdge:!0})}),e.parent(a)||e.setEdge(t,u,{weight:0,minlen:s+((o=i[a])!=null?o:0)})}function Yde(e){let t={};function n(r,s){let i=e.children(r);i&&i.length&&i.forEach(a=>n(a,s+1)),t[r]=s}return e.children(o0).forEach(r=>n(r,1)),t}function Wde(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function Gde(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var qde=Xde;function Xde(e){function t(n){let r=e.children(n),s=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(s,"minRank")){s.borderLeft=[],s.borderRight=[];for(let i=s.minRank,a=s.maxRank+1;i_A(e.node(t))),e.edges().forEach(t=>_A(e.edge(t)))}function _A(e){let t=e.width;e.width=e.height,e.height=t}function Jde(e){e.nodes().forEach(t=>eb(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(eb),Object.hasOwn(r,"y")&&eb(r)})}function eb(e){e.y=-e.y}function efe(e){e.nodes().forEach(t=>tb(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(tb),Object.hasOwn(r,"x")&&tb(r)})}function tb(e){let t=e.x;e.x=e.y,e.y=t}function tfe(e){let t={},n=e.nodes().filter(o=>!e.children(o).length),r=n.map(o=>e.node(o).rank),s=mi(Math.max,r),i=ff(s+1).map(()=>[]);function a(o){if(t[o])return;t[o]=!0;let c=e.node(o);i[c.rank].push(o);let u=e.successors(o);u&&u.forEach(a)}return n.sort((o,c)=>e.node(o).rank-e.node(c).rank).forEach(a),i}function nfe(e,t){let n=0;for(let r=1;rd)),s=t.flatMap(u=>{let d=e.outEdges(u);return d?d.map(f=>({pos:r[f.w],weight:e.edge(f).weight})).sort((f,h)=>f.pos-h.pos):[]}),i=1;for(;i{let d=u.pos+i;o[d]+=u.weight;let f=0;for(;d>0;)d%2&&(f+=o[d+1]),d=d-1>>1,o[d]+=u.weight;c+=u.weight*f}),c}function sfe(e,t=[]){return t.map(n=>{let r=e.inEdges(n);if(!r||!r.length)return{v:n};{let s=r.reduce((i,a)=>{let o=e.edge(a),c=e.node(a.v);return{sum:i.sum+o.weight*c.order,weight:i.weight+o.weight}},{sum:0,weight:0});return{v:n,barycenter:s.sum/s.weight,weight:s.weight}}})}function ife(e,t){let n={};e.forEach((s,i)=>{let a={indegree:0,in:[],out:[],vs:[s.v],i};s.barycenter!==void 0&&(a.barycenter=s.barycenter,a.weight=s.weight),n[s.v]=a}),t.edges().forEach(s=>{let i=n[s.v],a=n[s.w];i!==void 0&&a!==void 0&&(a.indegree++,i.out.push(a))});let r=Object.values(n).filter(s=>!s.indegree);return afe(r)}function afe(e){let t=[];function n(s){return i=>{i.merged||(i.barycenter===void 0||s.barycenter===void 0||i.barycenter>=s.barycenter)&&ofe(s,i)}}function r(s){return i=>{i.in.push(s),--i.indegree===0&&e.push(i)}}for(;e.length;){let s=e.pop();t.push(s),s.in.reverse().forEach(n(s)),s.out.forEach(r(s))}return t.filter(s=>!s.merged).map(s=>qm(s,["vs","i","barycenter","weight"]))}function ofe(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function lfe(e,t){let n=cde(e,d=>Object.hasOwn(d,"barycenter")),r=n.lhs,s=n.rhs.sort((d,f)=>f.i-d.i),i=[],a=0,o=0,c=0;r.sort(cfe(!!t)),c=kA(i,s,c),r.forEach(d=>{c+=d.vs.length,i.push(d.vs),a+=d.barycenter*d.weight,o+=d.weight,c=kA(i,s,c)});let u={vs:i.flat(1)};return o&&(u.barycenter=a/o,u.weight=o),u}function kA(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function cfe(e){return(t,n)=>t.barycentern.barycenter?1:e?n.i-t.i:t.i-n.i}function O4(e,t,n,r){let s=e.children(t),i=e.node(t),a=i?i.borderLeft:void 0,o=i?i.borderRight:void 0,c={};a&&(s=s.filter(h=>h!==a&&h!==o));let u=sfe(e,s);u.forEach(h=>{if(e.children(h.v).length){let p=O4(e,h.v,n,r);c[h.v]=p,Object.hasOwn(p,"barycenter")&&dfe(h,p)}});let d=ife(u,n);ufe(d,c);let f=lfe(d,r);if(a&&o){f.vs=[a,f.vs,o].flat(1);let h=e.predecessors(a);if(h&&h.length){let p=e.node(h[0]),m=e.predecessors(o),y=e.node(m[0]);Object.hasOwn(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+p.order+y.order)/(f.weight+2),f.weight+=2}}return f}function ufe(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(r=>t[r]?t[r].vs:r)})}function dfe(e,t){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight):(e.barycenter=t.barycenter,e.weight=t.weight)}function ffe(e,t,n,r){r||(r=e.nodes());let s=hfe(e),i=new Cs({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(a=>e.node(a));return r.forEach(a=>{let o=e.node(a),c=e.parent(a);if(o.rank===t||o.minRank<=t&&t<=o.maxRank){i.setNode(a),i.setParent(a,c||s);let u=e[n](a);u&&u.forEach(d=>{let f=d.v===a?d.w:d.v,h=i.edge(f,a),p=h!==void 0?h.weight:0;i.setEdge(f,a,{weight:e.edge(d).weight+p})}),Object.hasOwn(o,"minRank")&&i.setNode(a,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]})}}),i}function hfe(e){let t;for(;e.hasNode(t=Fv("_root")););return t}function pfe(e,t,n){let r={},s;n.forEach(i=>{let a=e.parent(i),o,c;for(;a;){if(o=e.parent(a),o?(c=r[o],r[o]=a):(c=s,s=a),c&&c!==a){t.setEdge(c,a);return}a=o}})}function R4(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,R4);return}let n=x4(e),r=NA(e,ff(1,n+1),"inEdges"),s=NA(e,ff(n-1,-1,-1),"outEdges"),i=tfe(e);if(SA(e,i),t.disableOptimalOrderHeuristic)return;let a=Number.POSITIVE_INFINITY,o,c=t.constraints||[];for(let u=0,d=0;d<4;++u,++d){mfe(u%2?r:s,u%4>=2,c),i=Hf(e);let f=nfe(e,i);f{r.has(i)||r.set(i,[]),r.get(i).push(a)};for(let i of e.nodes()){let a=e.node(i);if(typeof a.rank=="number"&&s(a.rank,i),typeof a.minRank=="number"&&typeof a.maxRank=="number")for(let o=a.minRank;o<=a.maxRank;o++)o!==a.rank&&s(o,i)}return t.map(function(i){return ffe(e,i,n,r.get(i)||[])})}function mfe(e,t,n){let r=new Cs;e.forEach(function(s){n.forEach(o=>r.setEdge(o.left,o.right));let i=s.graph().root,a=O4(s,i,r,t);a.vs.forEach((o,c)=>s.node(o).order=c),pfe(s,r,a.vs)})}function SA(e,t){Object.values(t).forEach(n=>n.forEach((r,s)=>e.node(r).order=s))}function gfe(e,t){let n={};function r(s,i){let a=0,o=0,c=s.length,u=i[i.length-1];return i.forEach((d,f)=>{let h=bfe(e,d),p=h?e.node(h).order:c;(h||d===u)&&(i.slice(o,f+1).forEach(m=>{let y=e.predecessors(m);y&&y.forEach(E=>{let g=e.node(E),x=g.order;(x{let f=i[d];if(f!==void 0&&e.node(f).dummy){let h=e.predecessors(f);h&&h.forEach(p=>{if(p===void 0)return;let m=e.node(p);m.dummy&&(m.orderu)&&L4(n,p,f)})}})}function s(i,a){let o=-1,c=-1,u=0;return a.forEach((d,f)=>{if(e.node(d).dummy==="border"){let h=e.predecessors(d);if(h&&h.length){let p=h[0];if(p===void 0)return;c=e.node(p).order,r(a,u,f,o,c),u=f,o=c}}r(a,u,a.length,c,i.length)}),a}return t.length&&t.reduce(s),n}function bfe(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(r=>e.node(r).dummy)}}function L4(e,t,n){if(t>n){let s=t;t=n,n=s}let r=e[t];r||(e[t]=r={}),r[n]=!0}function Efe(e,t,n){if(t>n){let s=t;t=n,n=s}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function xfe(e,t,n,r){let s={},i={},a={};return t.forEach(o=>{o.forEach((c,u)=>{s[c]=c,i[c]=c,a[c]=u})}),t.forEach(o=>{let c=-1;o.forEach(u=>{let d=r(u);if(d&&d.length){let f=d.sort((p,m)=>{let y=a[p],E=a[m];return(y!==void 0?y:0)-(E!==void 0?E:0)}),h=(f.length-1)/2;for(let p=Math.floor(h),m=Math.ceil(h);p<=m;++p){let y=f[p];if(y===void 0)continue;let E=a[y];if(E!==void 0&&i[u]===u&&c{var g;let x=(g=i[E.v])!=null?g:0,b=a.edge(E);return Math.max(y,x+(b!==void 0?b:0))},0):i[p]=0}function d(p){let m=a.outEdges(p),y=Number.POSITIVE_INFINITY;m&&(y=m.reduce((g,x)=>{let b=i[x.w],_=a.edge(x);return Math.min(g,(b!==void 0?b:0)-(_!==void 0?_:0))},Number.POSITIVE_INFINITY));let E=e.node(p);y!==Number.POSITIVE_INFINITY&&E.borderType!==o&&(i[p]=Math.max(i[p]!==void 0?i[p]:0,y))}function f(p){return a.predecessors(p)||[]}function h(p){return a.successors(p)||[]}return c(u,f),c(d,h),Object.keys(r).forEach(p=>{var m;let y=n[p];y!==void 0&&(i[p]=(m=i[y])!=null?m:0)}),i}function vfe(e,t,n,r){let s=new Cs,i=e.graph(),a=Tfe(i.nodesep,i.edgesep,r);return t.forEach(o=>{let c;o.forEach(u=>{let d=n[u];if(d!==void 0){if(s.setNode(d),c!==void 0){let f=n[c];if(f!==void 0){let h=s.edge(f,d);s.setEdge(f,d,Math.max(a(e,u,c),h||0))}}c=u}})}),s}function _fe(e,t){return Object.values(t).reduce((n,r)=>{let s=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;Object.entries(r).forEach(([o,c])=>{let u=Afe(e,o)/2;s=Math.max(c+u,s),i=Math.min(c-u,i)});let a=s-i;return a{["l","r"].forEach(a=>{let o=i+a,c=e[o];if(!c||c===t)return;let u=Object.values(c),d=r-mi(Math.min,u);a!=="l"&&(d=s-mi(Math.max,u)),d&&(e[o]=a0(c,f=>f+d))})})}function Nfe(e,t=void 0){let n=e.ul;return n?a0(n,(r,s)=>{var i,a;if(t){let c=t.toLowerCase(),u=e[c];if(u&&u[s]!==void 0)return u[s]}let o=Object.values(e).map(c=>{let u=c[s];return u!==void 0?u:0}).sort((c,u)=>c-u);return(((i=o[1])!=null?i:0)+((a=o[2])!=null?a:0))/2}):{}}function Sfe(e){let t=Hf(e),n=Object.assign(gfe(e,t),yfe(e,t)),r={},s;["u","d"].forEach(a=>{s=a==="u"?t:Object.values(t).reverse(),["l","r"].forEach(o=>{o==="r"&&(s=s.map(d=>Object.values(d).reverse()));let c=xfe(e,s,n,d=>(a==="u"?e.predecessors(d):e.successors(d))||[]),u=wfe(e,s,c.root,c.align,o==="r");o==="r"&&(u=a0(u,d=>-d)),r[a+o]=u})});let i=_fe(e,r);return kfe(r,i),Nfe(r,e.graph().align)}function Tfe(e,t,n){return(r,s,i)=>{let a=r.node(s),o=r.node(i),c=0,u;if(c+=a.width/2,Object.hasOwn(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":u=-a.width/2;break;case"r":u=a.width/2;break}if(u&&(c+=n?u:-u),u=void 0,c+=(a.dummy?t:e)/2,c+=(o.dummy?t:e)/2,c+=o.width/2,Object.hasOwn(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":u=o.width/2;break;case"r":u=-o.width/2;break}return u&&(c+=n?u:-u),c}}function Afe(e,t){return e.node(t).width}function Cfe(e){e=b4(e),Ife(e),Object.entries(Sfe(e)).forEach(([t,n])=>e.node(t).x=n)}function Ife(e){let t=Hf(e),n=e.graph(),r=n.ranksep,s=n.rankalign,i=0;t.forEach(a=>{let o=a.reduce((c,u)=>{var d;let f=(d=e.node(u).height)!=null?d:0;return c>f?c:f},0);a.forEach(c=>{let u=e.node(c);s==="top"?u.y=i+u.height/2:s==="bottom"?u.y=i+o-u.height/2:u.y=i+o/2}),i+=o+r})}function Ofe(e,t={}){let n=t.debugTiming?w4:v4;return n("layout",()=>{let r=n(" buildLayoutGraph",()=>$fe(e));return n(" runLayout",()=>Rfe(r,n,t)),n(" updateInputGraph",()=>Lfe(e,r)),r})}function Rfe(e,t,n){t(" makeSpaceForEdgeLabels",()=>Hfe(e)),t(" removeSelfEdges",()=>Qfe(e)),t(" acyclic",()=>wde(e)),t(" nestingGraph.run",()=>Kde(e)),t(" rank",()=>Pde(b4(e))),t(" injectEdgeLabelProxies",()=>zfe(e)),t(" removeEmptyRanks",()=>ode(e)),t(" nestingGraph.cleanup",()=>Gde(e)),t(" normalizeRanks",()=>ade(e)),t(" assignRankMinMax",()=>Vfe(e)),t(" removeEdgeLabelProxies",()=>Kfe(e)),t(" normalize.run",()=>kde(e)),t(" parentDummyChains",()=>$de(e)),t(" addBorderSegments",()=>qde(e)),t(" order",()=>R4(e,n)),t(" insertSelfEdges",()=>Zfe(e)),t(" adjustCoordinateSystem",()=>Qde(e)),t(" position",()=>Cfe(e)),t(" positionSelfEdges",()=>Jfe(e)),t(" removeBorderNodes",()=>Xfe(e)),t(" normalize.undo",()=>Sde(e)),t(" fixupEdgeLabelCoords",()=>Gfe(e)),t(" undoCoordinateSystem",()=>Zde(e)),t(" translateGraph",()=>Yfe(e)),t(" assignNodeIntersects",()=>Wfe(e)),t(" reversePoints",()=>qfe(e)),t(" acyclic.undo",()=>_de(e))}function Lfe(e,t){e.nodes().forEach(n=>{let r=e.node(n),s=t.node(n);r&&(r.x=s.x,r.y=s.y,r.order=s.order,r.rank=s.rank,t.children(n).length&&(r.width=s.width,r.height=s.height))}),e.edges().forEach(n=>{let r=e.edge(n),s=t.edge(n);r.points=s.points,Object.hasOwn(s,"x")&&(r.x=s.x,r.y=s.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var Mfe=["nodesep","edgesep","ranksep","marginx","marginy"],jfe={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},Dfe=["acyclicer","ranker","rankdir","align","rankalign"],Pfe=["width","height","rank"],TA={width:0,height:0},Bfe=["minlen","weight","width","height","labeloffset"],Ffe={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Ufe=["labelpos"];function $fe(e){let t=new Cs({multigraph:!0,compound:!0}),n=rb(e.graph());return t.setGraph(Object.assign({},jfe,nb(n,Mfe),qm(n,Dfe))),e.nodes().forEach(r=>{let s=rb(e.node(r)),i=nb(s,Pfe);Object.keys(TA).forEach(o=>{i[o]===void 0&&(i[o]=TA[o])}),t.setNode(r,i);let a=e.parent(r);a!==void 0&&t.setParent(r,a)}),e.edges().forEach(r=>{let s=rb(e.edge(r));t.setEdge(r,Object.assign({},Ffe,nb(s,Bfe),qm(s,Ufe)))}),t}function Hfe(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function zfe(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let r=e.node(t.v),s={rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t};eu(e,"edge-proxy",s,"_ep")}})}function Vfe(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function Kfe(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="edge-proxy"){let r=n;e.edge(r.e).labelRank=n.rank,e.removeNode(t)}})}function Yfe(e){let t=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,s=0,i=e.graph(),a=i.marginx||0,o=i.marginy||0;function c(u){let d=u.x,f=u.y,h=u.width,p=u.height;t=Math.min(t,d-h/2),n=Math.max(n,d+h/2),r=Math.min(r,f-p/2),s=Math.max(s,f+p/2)}e.nodes().forEach(u=>c(e.node(u))),e.edges().forEach(u=>{let d=e.edge(u);Object.hasOwn(d,"x")&&c(d)}),t-=a,r-=o,e.nodes().forEach(u=>{let d=e.node(u);d.x-=t,d.y-=r}),e.edges().forEach(u=>{let d=e.edge(u);d.points.forEach(f=>{f.x-=t,f.y-=r}),Object.hasOwn(d,"x")&&(d.x-=t),Object.hasOwn(d,"y")&&(d.y-=r)}),i.width=n-t+a,i.height=s-r+o}function Wfe(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),s=e.node(t.w),i,a;n.points?(i=n.points[0],a=n.points[n.points.length-1]):(n.points=[],i=s,a=r),n.points.unshift(yA(r,i)),n.points.push(yA(s,a))})}function Gfe(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function qfe(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function Xfe(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),s=e.node(n.borderBottom),i=e.node(n.borderLeft[n.borderLeft.length-1]),a=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(a.x-i.x),n.height=Math.abs(s.y-r.y),n.x=i.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function Qfe(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function Zfe(e){Hf(e).forEach(t=>{let n=0;t.forEach((r,s)=>{let i=e.node(r);i.order=s+n,(i.selfEdges||[]).forEach(a=>{eu(e,"selfedge",{width:a.label.width,height:a.label.height,rank:i.rank,order:s+ ++n,e:a.e,label:a.label},"_se")}),delete i.selfEdges})})}function Jfe(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="selfedge"){let r=n,s=e.node(r.e.v),i=s.x+s.width/2,a=s.y,o=n.x-i,c=s.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:i+2*o/3,y:a-c},{x:i+5*o/6,y:a-c},{x:i+o,y:a},{x:i+5*o/6,y:a+c},{x:i+2*o/3,y:a+c}],r.label.x=n.x,r.label.y=n.y}})}function nb(e,t){return a0(qm(e,t),Number)}function rb(e){let t={};return e&&Object.entries(e).forEach(([n,r])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=r}),t}function ehe(e){let t=Hf(e),n=new Cs({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(r=>{n.setNode(r,{label:r}),n.setParent(r,"layer"+e.node(r).rank)}),e.edges().forEach(r=>n.setEdge(r.v,r.w,{},r.name)),t.forEach((r,s)=>{let i="layer"+s;n.setNode(i,{rank:"same"}),r.reduce((a,o)=>(n.setEdge(a,o,{style:"invis"}),o))}),n}var the={graphlib:c4,version:fde,layout:Ofe,debug:ehe,util:{time:w4,notime:v4}},AA=the;/*! For license information please see dagre.esm.js.LEGAL.txt */const Vl={llm:{label:"智能体",description:"理解任务并直接完成一个具体工作",icon:Po},sequential:{label:"分步协作",description:"内部步骤按照顺序依次执行",icon:IL},parallel:{label:"同时处理",description:"内部步骤同时工作,完成后统一汇总",icon:EL},loop:{label:"循环执行",description:"重复执行内部步骤,直到满足停止条件",icon:Lw},a2a:{label:"远程智能体",description:"调用已经存在的远程 Agent",icon:Ig}},DE=220,PE=88,CA=96,IA=34,Xm=64,OA=310,Kl=24,M4=56,BE=40,RA=40,nhe=18,rhe=58,she=!1,ihe=e=>e==="sequential"||e==="parallel"||e==="loop";function FE(e,t){const n=e.agentType??"llm";return ihe(n)||n==="llm"&&(t.length===0||e.subAgents.length>0)}function UE(e,t=[],n="horizontal"){const r=e.agentType??"llm";if(!FE(e,t))return{width:DE,height:PE};const s=e.subAgents.map((d,f)=>UE(d,[...t,f],n)),i=s.length?Math.max(...s.map(d=>d.width)):0,a=s.length?Math.max(...s.map(d=>d.height)):0,o=s.length&&r!=="parallel"?M4:Kl,c=n==="horizontal"?r!=="parallel":r==="parallel",u=s.length?r==="parallel"?nhe+RA:r==="loop"?rhe:0:RA;return c?{width:Math.max(OA,s.reduce((d,f)=>d+f.width,0)+BE*Math.max(0,s.length-1)+o*2),height:Xm+Kl+a+u+Kl}:{width:Math.max(OA,i+Kl*2),height:Xm+o+s.reduce((d,f)=>d+f.height,0)+BE*Math.max(0,s.length-1)+u+o}}function Tu(e){return e.length===0?"agent-root":`agent-${e.join("-")}`}function ahe(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function LA(e){const t=n=>[n.agentType??"llm",n.subAgents.map(t)];return JSON.stringify(t(e))}function Au(e,t,n,r){const s=(r==null?void 0:r.tone)==="sequential"?"hsl(213 40% 40%)":(r==null?void 0:r.tone)==="loop"?"hsl(151 34% 34%)":"hsl(220 9% 38%)";return{id:`${e}-${t}${r!=null&&r.loop?"-loop":""}`,source:e,target:t,sourceHandle:r!=null&&r.loop?"loop-source":void 0,targetHandle:r!=null&&r.loop?"loop-target":void 0,label:n,type:"insertStep",data:r?{insert:r.insert,loop:r.loop,tone:r.tone}:void 0,animated:r==null?void 0:r.loop,markerEnd:{type:Rc.ArrowClosed,width:16,height:16,color:s},style:{stroke:s,strokeWidth:1.5},labelStyle:{fill:"hsl(215 14% 42%)",fontSize:10,fontWeight:600},labelBgStyle:{fill:"hsl(var(--background))",fillOpacity:.92}}}function MA(e,t){const n=[{id:"terminal-input",type:"terminal",position:{x:0,y:0},data:{kind:"terminal",title:"用户请求"},selectable:!1,draggable:!1},{id:"terminal-output",type:"terminal",position:{x:0,y:0},data:{kind:"terminal",title:"最终回复"},selectable:!1,draggable:!1}],r=[];function s(u,d,f,h,p){const m=u.agentType??"llm",y=Tu(d);return FE(u,d)?(i(u,d,f,h,p),y):(n.push({id:y,type:"agent",parentId:f,extent:"parent",position:h,data:{kind:"agent",path:d,agent:u,title:m==="a2a"?"远程智能体":u.name.trim()||(d.length===0?"主 Agent":"未命名步骤"),pattern:m,description:u.description.trim()||Vl[m].description,childCount:u.subAgents.length,containedIn:p}}),y)}function i(u,d,f,h={x:0,y:0},p){const m=u.agentType??"sequential",y=Tu(d),E=UE(u,d,t);n.push({id:y,type:"group",parentId:f,extent:f?"parent":void 0,position:h,style:{width:E.width,height:E.height},data:{kind:"agent",path:d,agent:u,title:u.name.trim()||(d.length===0?"主 Agent":Vl[m].label),pattern:m,description:Vl[m].description,childCount:u.subAgents.length,containedIn:p,layoutWidth:E.width,layoutHeight:E.height}});const g=u.subAgents.map((N,C)=>UE(N,[...d,C],t)),x=g.length&&m!=="parallel"?M4:Kl,b=t==="horizontal"?m!=="parallel":m==="parallel";let _=x;const k=u.subAgents.map((N,C)=>{const S=g[C],A=b?{x:_,y:Xm+Kl}:{x:(E.width-S.width)/2,y:Xm+_};return _+=(b?S.width:S.height)+BE,s(N,[...d,C],y,A,m)});if(m==="sequential"||m==="loop"){for(let N=0;N1&&r.push(Au(k[k.length-1],k[0],"继续循环",{loop:!0,tone:"loop"}))}return y}const a=(u,d)=>{const f=u.agentType??"llm",h=Tu(d);if(FE(u,d))return i(u,d),[h];if(n.push({id:h,type:"agent",position:{x:0,y:0},data:{kind:"agent",path:d,agent:u,title:f==="a2a"?"远程智能体":u.name.trim()||(d.length===0?"主 Agent":"未命名步骤"),pattern:f,description:u.description.trim()||Vl[f].description,childCount:u.subAgents.length}}),u.subAgents.length===0)return[h];const p=[];return u.subAgents.forEach((m,y)=>{const E=[...d,y],g=Tu(E);r.push(Au(h,g,"调用",{insert:{parentPath:d,index:y}})),p.push(...a(m,E))}),p},o=Tu([]),c=a(e,[]);return r.push(Au("terminal-input",o)),c.forEach(u=>r.push(Au(u,"terminal-output"))),ohe(n,r,t)}function ohe(e,t,n){const r=new AA.graphlib.Graph().setDefaultEdgeLabel(()=>({}));r.setGraph({rankdir:n==="vertical"?"TB":"LR",ranksep:50,nodesep:34,edgesep:14,marginx:24,marginy:24});const s=new Set(e.filter(i=>!i.parentId).map(i=>i.id));return e.filter(i=>!i.parentId).forEach(i=>{const a=i.data.kind==="terminal";r.setNode(i.id,{width:a?CA:i.data.layoutWidth??DE,height:a?IA:i.data.layoutHeight??PE})}),t.filter(i=>s.has(i.source)&&s.has(i.target)).forEach(i=>r.setEdge(i.source,i.target)),AA.layout(r),{nodes:e.map(i=>{if(i.parentId)return i;const a=r.node(i.id),o=i.data.kind==="terminal",c=o?CA:i.data.layoutWidth??DE,u=o?IA:i.data.layoutHeight??PE;return{...i,position:{x:a.x-c/2,y:a.y-u/2}}}),edges:t}}const l0=w.createContext(null),c0=w.createContext("horizontal");function lhe({id:e,sourceX:t,sourceY:n,targetX:r,targetY:s,sourcePosition:i,targetPosition:a,markerEnd:o,style:c,label:u,data:d}){const f=w.useContext(l0),[h,p]=w.useState(!1),[m,y,E]=Km({sourceX:t,sourceY:n,targetX:r,targetY:s,sourcePosition:i,targetPosition:a,offset:d!=null&&d.loop?28:20});return l.jsxs(l.Fragment,{children:[l.jsx($f,{id:e,path:m,markerEnd:o,style:c}),f&&(d==null?void 0:d.insert)&&l.jsx("path",{d:m,className:"abc-edge-hover-path",onPointerEnter:()=>p(!0),onPointerLeave:()=>p(!1)}),(u||f&&(d==null?void 0:d.insert))&&l.jsx(rue,{children:l.jsxs("div",{className:`abc-edge-tools${f&&(d!=null&&d.insert)?" can-insert":""}${h?" is-visible":""}`,style:{transform:`translate(-50%, -50%) translate(${y}px, ${E}px)`},onPointerEnter:()=>p(!0),onPointerLeave:()=>p(!1),children:[u&&l.jsx("span",{className:"abc-edge-label",children:u}),f&&(d==null?void 0:d.insert)&&l.jsx("button",{type:"button",className:"abc-edge-add nodrag nopan","aria-label":"在这里插入步骤",title:"在这里插入步骤",onClick:g=>{g.stopPropagation(),f==null||f.onInsert(d.insert.parentPath,d.insert.index)},children:l.jsx(rr,{})})]})})]})}function che({data:e,selected:t}){const n=w.useContext(l0),r=w.useContext(c0),s=r==="vertical"?Pe.Top:Pe.Left,i=r==="vertical"?Pe.Bottom:Pe.Right,a=r==="vertical"?Pe.Right:Pe.Bottom,o=e.pattern??"llm",c=Vl[o],u=c.icon;return l.jsxs("div",{className:`abc-node is-${o}${e.containedIn?` is-contained-in-${e.containedIn}`:""}${t?" is-selected":""}`,children:[l.jsx(mr,{type:"target",position:s,className:"abc-handle"}),o!=="llm"&&l.jsx("span",{className:"abc-node-icon",children:l.jsx(u,{})}),l.jsxs("span",{className:"abc-node-copy",children:[l.jsxs("span",{className:"abc-node-meta",children:[l.jsx("span",{children:c.label}),!!e.childCount&&l.jsxs("small",{children:[e.childCount," 个步骤"]})]}),l.jsx("strong",{children:e.title}),l.jsx("small",{children:e.description})]}),n&&e.path!==void 0&&e.path.length>0&&l.jsx("button",{type:"button",className:"abc-node-delete nodrag nopan","aria-label":`删除 ${e.title}`,title:"删除节点",onClick:d=>{d.stopPropagation(),n==null||n.onDelete(e.path)},children:l.jsx(ea,{})}),l.jsx(mr,{type:"source",position:i,className:"abc-handle"}),e.containedIn==="loop"&&l.jsxs(l.Fragment,{children:[l.jsx(mr,{id:"loop-target",type:"target",position:a,className:"abc-handle abc-loop-handle"}),l.jsx(mr,{id:"loop-source",type:"source",position:a,className:"abc-handle abc-loop-handle"})]})]})}function uhe({data:e,selected:t}){const n=w.useContext(l0),r=w.useContext(c0),s=r==="vertical"?Pe.Top:Pe.Left,i=r==="vertical"?Pe.Bottom:Pe.Right,a=r==="vertical"?Pe.Right:Pe.Bottom,o=e.pattern??"sequential",c=Vl[o],u=o==="llm"?"子 Agent":"步骤",d=e.childCount??0,f=o==="llm"?"添加子 Agent":o==="parallel"?"添加一个同时处理的步骤":o==="loop"?"添加循环步骤":"添加下一个步骤";return l.jsxs("div",{className:`abc-group is-${o}${t?" is-selected":""}`,children:[l.jsx(mr,{type:"target",position:s,className:"abc-handle"}),l.jsxs("header",{className:"abc-group-head",children:[l.jsxs("span",{children:[l.jsx("strong",{title:e.title,children:e.title}),l.jsx("small",{children:o==="llm"?"智能体 · 可根据任务调用框内子 Agent":o==="parallel"?`${c.label} · 框内步骤同时开始,全部完成后再继续`:`${c.label} · ${c.description}`})]}),l.jsxs("em",{children:[d," 个",u]})]}),n&&e.path!==void 0&&d>0&&o!=="parallel"&&l.jsxs("div",{className:"abc-group-boundary-actions",children:[l.jsx("button",{type:"button",className:"abc-group-boundary-add is-start nodrag nopan","aria-label":"添加到最前",title:"添加到最前",onClick:h=>{h.stopPropagation(),n.onInsert(e.path,0)},children:l.jsx(rr,{})}),l.jsx("button",{type:"button",className:"abc-group-boundary-add is-end nodrag nopan","aria-label":"添加到最后",title:"添加到最后",onClick:h=>{h.stopPropagation(),n.onAdd(e.path)},children:l.jsx(rr,{})})]}),n&&e.path!==void 0&&d>0&&o==="parallel"&&l.jsxs("button",{type:"button",className:"abc-group-add abc-group-add-bottom nodrag nopan",onClick:h=>{h.stopPropagation(),n.onAdd(e.path)},children:[l.jsx(rr,{}),l.jsx("span",{children:f})]}),n&&e.path!==void 0&&d===0&&l.jsxs("button",{type:"button",className:"abc-group-add abc-group-add-empty nodrag nopan",onClick:h=>{h.stopPropagation(),n.onAdd(e.path)},children:[l.jsx(rr,{}),l.jsx("span",{children:f})]}),n&&e.path!==void 0&&e.path.length>0&&l.jsx("button",{type:"button",className:"abc-node-delete nodrag nopan","aria-label":`删除 ${e.title}`,title:"删除节点",onClick:h=>{h.stopPropagation(),n==null||n.onDelete(e.path)},children:l.jsx(ea,{})}),l.jsx(mr,{type:"source",position:i,className:"abc-handle"}),e.containedIn==="loop"&&l.jsxs(l.Fragment,{children:[l.jsx(mr,{id:"loop-target",type:"target",position:a,className:"abc-handle abc-loop-handle"}),l.jsx(mr,{id:"loop-source",type:"source",position:a,className:"abc-handle abc-loop-handle"})]})]})}function dhe({data:e}){const t=w.useContext(c0);return l.jsxs("div",{className:"abc-terminal",children:[l.jsx(mr,{type:"target",position:t==="vertical"?Pe.Top:Pe.Left,className:"abc-handle"}),l.jsx("span",{children:e.title}),l.jsx(mr,{type:"source",position:t==="vertical"?Pe.Bottom:Pe.Right,className:"abc-handle"})]})}const fhe={agent:che,group:uhe,terminal:dhe},hhe={insertStep:lhe};function phe({draft:e,selectedPath:t,onSelect:n,onAdd:r,onInsert:s,onDelete:i,readOnly:a=!1,interactivePreview:o=!1,direction:c="horizontal"}){const u=w.useMemo(()=>MA(e,c),[]),[d,f,h]=t4(u.nodes),[p,m,y]=n4(u.edges),E=iue(),g=w.useRef(`${c}:${LA(e)}`),x=w.useRef(null),{fitView:b}=s0(),_=w.useMemo(()=>MA(e,c),[c,e]),[k,N]=w.useState(()=>window.matchMedia("(max-width: 860px)").matches),C=w.useMemo(()=>a?{padding:.16,minZoom:.05,maxZoom:.9}:k?{padding:.08,minZoom:.35,maxZoom:.9}:{padding:.14,minZoom:.42,maxZoom:1.1},[k,a]),S=w.useCallback(()=>{window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>void b(C))})},[C,b]);w.useEffect(()=>{const O=window.matchMedia("(max-width: 860px)"),D=U=>N(U.matches);return O.addEventListener("change",D),()=>O.removeEventListener("change",D)},[]),w.useEffect(()=>{const O=`${c}:${LA(e)}`,D=O!==g.current;g.current=O,m(_.edges),f(U=>{const X=new Map(U.map(M=>[M.id,M.position]));return _.nodes.map(M=>({...M,position:!D&&X.get(M.id)?X.get(M.id):M.position,selected:M.data.kind==="agent"&&!!M.data.path&&ahe(M.data.path,t)}))}),D&&S()},[_,e,S,t,m,f]),w.useEffect(()=>{S()},[k,S]),w.useEffect(()=>{E&&S()},[_,S,E]),w.useEffect(()=>{if(!a||!x.current)return;const O=new ResizeObserver(()=>S());return O.observe(x.current),S(),()=>O.disconnect()},[S,a]);const A=w.useMemo(()=>a?null:{onAdd:r,onInsert:s,onDelete:i},[r,i,s,a]);return l.jsx(c0.Provider,{value:c,children:l.jsx(l0.Provider,{value:A,children:l.jsx("section",{className:`abc-root is-${c}${a?" is-readonly":""}`,"aria-label":a?"只读 Agent 执行画布":"Agent 执行画布",children:l.jsx("div",{ref:x,className:"abc-canvas",children:l.jsxs(e4,{nodes:d,edges:p,nodeTypes:fhe,edgeTypes:hhe,onNodesChange:h,onEdgesChange:y,onNodeClick:(O,D)=>{!a&&D.data.kind==="agent"&&D.data.path&&n(D.data.path)},nodesDraggable:!a,nodesConnectable:!1,nodesFocusable:!a,elementsSelectable:!a,edgesFocusable:!1,edgesReconnectable:!1,panOnDrag:!a||o,zoomOnDoubleClick:o,zoomOnPinch:!a||o,zoomOnScroll:!a||o,fitView:!0,fitViewOptions:C,minZoom:a?.05:.35,maxZoom:1.6,proOptions:{hideAttribution:!0},children:[l.jsx(s4,{gap:20,size:1.2,color:"hsl(34 20% 82%)"}),(!a||o)&&l.jsx(a4,{showInteractive:!1}),she]})})})})})}function Qm(e){return l.jsx(Pv,{children:l.jsx(phe,{...e})})}const mhe="doubao-seed-2-1-pro-260628",ghe="一个基于 VeADK 构建的智能助手,理解用户意图并调用合适的工具完成任务。",yhe=`你是一个专业、可靠的智能助手。 +`)),d=u.reduce((f,h)=>f.concat(...h),[]);return[u,d]}return[[],[]]},[e]);return w.useEffect(()=>{const c=(t==null?void 0:t.target)??X2,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=p=>{var E,g;if(s.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!s.current||s.current&&!u)&&JD(p))return!1;const y=Z2(p.code,o);if(i.current.add(p[y]),Q2(a,i.current,!1)){const x=((g=(E=p.composedPath)==null?void 0:E.call(p))==null?void 0:g[0])||p.target,b=(x==null?void 0:x.nodeName)==="BUTTON"||(x==null?void 0:x.nodeName)==="A";t.preventDefault!==!1&&(s.current||!b)&&p.preventDefault(),r(!0)}},f=p=>{const m=Z2(p.code,o);Q2(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(p[m]),p.key==="Meta"&&i.current.clear(),s.current=!1},h=()=>{i.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",f),window.addEventListener("blur",h),window.addEventListener("contextmenu",h),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",f),window.removeEventListener("blur",h),window.removeEventListener("contextmenu",h)}}},[e,r]),n}function Q2(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function Z2(e,t){return t.includes(e)?"code":"key"}const Rle=()=>{const e=tn();return w.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,s,i],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??r,y:t.y??s,zoom:t.zoom??i},n),!0):!1},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:s,minZoom:i,maxZoom:a,panZoom:o}=e.getState(),c=Tv(t,r,s,i,a,(n==null?void 0:n.padding)??.1);return o?(await o.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:s,snapToGrid:i,domNode:a}=e.getState();if(!a)return t;const{x:o,y:c}=a.getBoundingClientRect(),u={x:t.x-o,y:t.y-c},d=n.snapGrid??s,f=n.snapToGrid??i;return Zc(u,r,f,d)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:i}=r.getBoundingClientRect(),a=Mc(t,n);return{x:a.x+s,y:a.y+i}}}),[])};function NP(e,t){const n=[],r=new Map,s=[];for(const i of e)if(i.type==="add"){s.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const a=r.get(i.id);a?a.push(i):r.set(i.id,[i])}for(const i of t){const a=r.get(i.id);if(!a){n.push(i);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const o={...i};for(const c of a)Lle(c,o);n.push(o)}return s.length&&s.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function Lle(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function SP(e,t){return NP(e,t)}function TP(e,t){return NP(e,t)}function lo(e,t){return{id:e,type:"select",selected:t}}function Hl(e,t=new Set,n=!1){const r=[];for(const[s,i]of e){const a=t.has(s);!(i.selected===void 0&&!a)&&i.selected!==a&&(n&&(i.selected=a),r.push(lo(i.id,a)))}return r}function J2({items:e=[],lookup:t}){var s;const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,a]of e.entries()){const o=t.get(a.id),c=((s=o==null?void 0:o.internals)==null?void 0:s.userNode)??o;c!==void 0&&c!==a&&n.push({id:a.id,item:a,type:"replace"}),c===void 0&&n.push({item:a,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function eA(e){return{id:e.id,type:"remove"}}const Mle=XD();function AP(e,t,n={}){return aoe(e,t,{...n,onError:n.onError??Mle})}const tA=e=>Kae(e),jle=e=>YD(e);function CP(e){return w.forwardRef(e)}const Dle=typeof window<"u"?w.useLayoutEffect:w.useEffect;function nA(e){const[t,n]=w.useState(BigInt(0)),[r]=w.useState(()=>Ple(()=>n(s=>s+BigInt(1))));return Dle(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function Ple(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const IP=w.createContext(null);function Ble({children:e}){const t=tn(),n=w.useCallback(o=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:h,fitViewQueued:p,onNodesChangeMiddlewareMap:m}=t.getState();let y=c;for(const g of o)y=typeof g=="function"?g(y):g;let E=J2({items:y,lookup:h});for(const g of m.values())E=g(E);d&&u(y),E.length>0?f==null||f(E):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:g,nodes:x,setNodes:b}=t.getState();g&&b(x)})},[]),r=nA(n),s=w.useCallback(o=>{const{edges:c=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:h}=t.getState();let p=c;for(const m of o)p=typeof m=="function"?m(p):m;d?u(p):f&&f(J2({items:p,lookup:h}))},[]),i=nA(s),a=w.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return l.jsx(IP.Provider,{value:a,children:e})}function Fle(){const e=w.useContext(IP);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Ule=e=>!!e.panZoom;function r0(){const e=Rle(),t=tn(),n=Fle(),r=wt(Ule),s=w.useMemo(()=>{const i=f=>t.getState().nodeLookup.get(f),a=f=>{n.nodeQueue.push(f)},o=f=>{n.edgeQueue.push(f)},c=f=>{var g,x;const{nodeLookup:h,nodeOrigin:p}=t.getState(),m=tA(f)?f:h.get(f.id),y=m.parentId?QD(m.position,m.measured,m.parentId,h,p):m.position,E={...m,position:y,width:((g=m.measured)==null?void 0:g.width)??m.width,height:((x=m.measured)==null?void 0:x.height)??m.height};return Lc(E)},u=(f,h,p={replace:!1})=>{a(m=>m.map(y=>{if(y.id===f){const E=typeof h=="function"?h(y):h;return p.replace&&tA(E)?E:{...y,...E}}return y}))},d=(f,h,p={replace:!1})=>{o(m=>m.map(y=>{if(y.id===f){const E=typeof h=="function"?h(y):h;return p.replace&&jle(E)?E:{...y,...E}}return y}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var h;return(h=i(f))==null?void 0:h.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(h=>({...h}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:a,setEdges:o,addNodes:f=>{const h=Array.isArray(f)?f:[f];n.nodeQueue.push(p=>[...p,...h])},addEdges:f=>{const h=Array.isArray(f)?f:[f];n.edgeQueue.push(p=>[...p,...h])},toObject:()=>{const{nodes:f=[],edges:h=[],transform:p}=t.getState(),[m,y,E]=p;return{nodes:f.map(g=>({...g})),edges:h.map(g=>({...g})),viewport:{x:m,y,zoom:E}}},deleteElements:async({nodes:f=[],edges:h=[]})=>{const{nodes:p,edges:m,onNodesDelete:y,onEdgesDelete:E,triggerNodeChanges:g,triggerEdgeChanges:x,onDelete:b,onBeforeDelete:_}=t.getState(),{nodes:k,edges:N}=await Xae({nodesToRemove:f,edgesToRemove:h,nodes:p,edges:m,onBeforeDelete:_}),C=N.length>0,S=k.length>0;if(C){const A=N.map(eA);E==null||E(N),x(A)}if(S){const A=k.map(eA);y==null||y(k),g(A)}return(S||C)&&(b==null||b({nodes:k,edges:N})),{deletedNodes:k,deletedEdges:N}},getIntersectingNodes:(f,h=!0,p)=>{const m=O2(f),y=m?f:c(f),E=p!==void 0;return y?(p||t.getState().nodes).filter(g=>{const x=t.getState().nodeLookup.get(g.id);if(x&&!m&&(g.id===f.id||!x.internals.positionAbsolute))return!1;const b=Lc(E?g:x),_=lf(b,y);return h&&_>0||_>=b.width*b.height||_>=y.width*y.height}):[]},isNodeIntersecting:(f,h,p=!0)=>{const y=O2(f)?f:c(f);if(!y)return!1;const E=lf(y,h);return p&&E>0||E>=h.width*h.height||E>=y.width*y.height},updateNode:u,updateNodeData:(f,h,p={replace:!1})=>{u(f,m=>{const y=typeof h=="function"?h(m):h;return p.replace?{...m,data:y}:{...m,data:{...m.data,...y}}},p)},updateEdge:d,updateEdgeData:(f,h,p={replace:!1})=>{d(f,m=>{const y=typeof h=="function"?h(m):h;return p.replace?{...m,data:y}:{...m,data:{...m.data,...y}}},p)},getNodesBounds:f=>{const{nodeLookup:h,nodeOrigin:p}=t.getState();return Yae(f,{nodeLookup:h,nodeOrigin:p})},getHandleConnections:({type:f,id:h,nodeId:p})=>{var m;return Array.from(((m=t.getState().connectionLookup.get(`${p}-${f}${h?`-${h}`:""}`))==null?void 0:m.values())??[])},getNodeConnections:({type:f,handleId:h,nodeId:p})=>{var m;return Array.from(((m=t.getState().connectionLookup.get(`${p}${f?h?`-${f}-${h}`:`-${f}`:""}`))==null?void 0:m.values())??[])},fitView:async f=>{const h=t.getState().fitViewResolver??Jae();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:h}),n.nodeQueue.push(p=>[...p]),h.promise}}},[]);return w.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const rA=e=>e.selected,$le=typeof window<"u"?window:void 0;function Hle({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=tn(),{deleteElements:r}=r0(),s=uf(e,{actInsideInputWithModifier:!1}),i=uf(t,{target:$le});w.useEffect(()=>{if(s){const{edges:a,nodes:o}=n.getState();r({nodes:o.filter(rA),edges:a.filter(rA)}),n.setState({nodesSelectionActive:!1})}},[s]),w.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function zle(e){const t=tn();w.useEffect(()=>{const n=()=>{var s,i,a,o;if(!e.current||!(((i=(s=e.current).checkVisibility)==null?void 0:i.call(s))??!0))return!1;const r=Cv(e.current);(r.height===0||r.width===0)&&((o=(a=t.getState()).onError)==null||o.call(a,"004",Zs.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const s0={position:"absolute",width:"100%",height:"100%",top:0,left:0},Vle=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Kle({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=Io.Free,zoomOnDoubleClick:a=!0,panOnDrag:o=!0,defaultViewport:c,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:p=!0,children:m,noWheelClassName:y,noPanClassName:E,onViewportChange:g,isControlledViewport:x,paneClickDistance:b,selectionOnDrag:_}){const k=tn(),N=w.useRef(null),{userSelectionActive:C,lib:S,connectionInProgress:A}=wt(Vle,en),O=uf(h),D=w.useRef();zle(N);const U=w.useCallback(X=>{g==null||g({x:X[0],y:X[1],zoom:X[2]}),x||k.setState({transform:X})},[g,x]);return w.useEffect(()=>{if(N.current){D.current=Doe({domNode:N.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:T=>k.setState(L=>L.paneDragging===T?L:{paneDragging:T}),onPanZoomStart:(T,L)=>{const{onViewportChangeStart:R,onMoveStart:F}=k.getState();F==null||F(T,L),R==null||R(L)},onPanZoom:(T,L)=>{const{onViewportChange:R,onMove:F}=k.getState();F==null||F(T,L),R==null||R(L)},onPanZoomEnd:(T,L)=>{const{onViewportChangeEnd:R,onMoveEnd:F}=k.getState();F==null||F(T,L),R==null||R(L)}});const{x:X,y:M,zoom:j}=D.current.getViewport();return k.setState({panZoom:D.current,transform:[X,M,j],domNode:N.current.closest(".react-flow")}),()=>{var T;(T=D.current)==null||T.destroy()}}},[]),w.useEffect(()=>{var X;(X=D.current)==null||X.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:a,panOnDrag:o,zoomActivationKeyPressed:O,preventScrolling:p,noPanClassName:E,userSelectionActive:C,noWheelClassName:y,lib:S,onTransformChange:U,connectionInProgress:A,selectionOnDrag:_,paneClickDistance:b})},[e,t,n,r,s,i,a,o,O,p,E,C,y,S,U,A,_,b]),l.jsx("div",{className:"react-flow__renderer",ref:N,style:s0,children:m})}const Yle=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Wle(){const{userSelectionActive:e,userSelectionRect:t}=wt(Yle,en);return e&&t?l.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const qy=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Gle=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function qle({isSelecting:e,selectionKeyPressed:t,selectionMode:n=of.Full,panOnDrag:r,autoPanOnSelection:s,paneClickDistance:i,selectionOnDrag:a,onSelectionStart:o,onSelectionEnd:c,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:m,children:y}){const E=w.useRef(0),g=tn(),{userSelectionActive:x,elementsSelectable:b,dragging:_,connectionInProgress:k,panBy:N,autoPanSpeed:C}=wt(Gle,en),S=b&&(e||x),A=w.useRef(null),O=w.useRef(),D=w.useRef(new Set),U=w.useRef(new Set),X=w.useRef(!1),M=w.useRef({x:0,y:0}),j=w.useRef(!1),T=ee=>{if(X.current||k){X.current=!1;return}u==null||u(ee),g.getState().resetSelectedElements(),g.setState({nodesSelectionActive:!1})},L=ee=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){ee.preventDefault();return}d==null||d(ee)},R=f?ee=>f(ee):void 0,F=ee=>{X.current&&(ee.stopPropagation(),X.current=!1)},I=ee=>{var Ke,Ne;const{domNode:le,transform:ne}=g.getState();if(O.current=le==null?void 0:le.getBoundingClientRect(),!O.current)return;const me=ee.target===A.current;if(!me&&!!ee.target.closest(".nokey")||!e||!(a&&me||t)||ee.button!==0||!ee.isPrimary)return;(Ne=(Ke=ee.target)==null?void 0:Ke.setPointerCapture)==null||Ne.call(Ke,ee.pointerId),X.current=!1;const{x:de,y:Ee}=Ks(ee.nativeEvent,O.current),Te=Zc({x:de,y:Ee},ne);g.setState({userSelectionRect:{width:0,height:0,startX:Te.x,startY:Te.y,x:de,y:Ee}}),me||(ee.stopPropagation(),ee.preventDefault())};function V(ee,le){const{userSelectionRect:ne}=g.getState();if(!ne)return;const{transform:me,nodeLookup:ye,edgeLookup:te,connectionLookup:de,triggerNodeChanges:Ee,triggerEdgeChanges:Te,defaultEdgeOptions:Ke}=g.getState(),Ne={x:ne.startX,y:ne.startY},{x:it,y:He}=Mc(Ne,me),Ue={startX:Ne.x,startY:Ne.y,x:eect.id)),U.current=new Set;const St=(Ke==null?void 0:Ke.selectable)??!0;for(const ct of D.current){const B=de.get(ct);if(B)for(const{edgeId:Q}of B.values()){const oe=te.get(Q);oe&&(oe.selectable??St)&&U.current.add(Q)}}if(!R2(Et,D.current)){const ct=Hl(ye,D.current,!0);Ee(ct)}if(!R2(rt,U.current)){const ct=Hl(te,U.current);Te(ct)}g.setState({userSelectionRect:Ue,userSelectionActive:!0,nodesSelectionActive:!1})}function W(){if(!s||!O.current)return;const[ee,le]=Sv(M.current,O.current,C);N({x:ee,y:le}).then(ne=>{if(!X.current||!ne){E.current=requestAnimationFrame(W);return}const{x:me,y:ye}=M.current;V(me,ye),E.current=requestAnimationFrame(W)})}const P=()=>{cancelAnimationFrame(E.current),E.current=0,j.current=!1};w.useEffect(()=>()=>P(),[]);const ie=ee=>{const{userSelectionRect:le,transform:ne,resetSelectedElements:me}=g.getState();if(!O.current||!le)return;const{x:ye,y:te}=Ks(ee.nativeEvent,O.current);M.current={x:ye,y:te};const de=Mc({x:le.startX,y:le.startY},ne);if(!X.current){const Ee=t?0:i;if(Math.hypot(ye-de.x,te-de.y)<=Ee)return;me(),o==null||o(ee)}X.current=!0,j.current||(W(),j.current=!0),V(ye,te)},G=ee=>{var le,ne;ee.button===0&&((ne=(le=ee.target)==null?void 0:le.releasePointerCapture)==null||ne.call(le,ee.pointerId),!x&&ee.target===A.current&&g.getState().userSelectionRect&&(T==null||T(ee)),g.setState({userSelectionActive:!1,userSelectionRect:null}),X.current&&(c==null||c(ee),g.setState({nodesSelectionActive:D.current.size>0})),P())},re=ee=>{var le,ne;(ne=(le=ee.target)==null?void 0:le.releasePointerCapture)==null||ne.call(le,ee.pointerId),P()},ue=r===!0||Array.isArray(r)&&r.includes(0);return l.jsxs("div",{className:Ln(["react-flow__pane",{draggable:ue,dragging:_,selection:e}]),onClick:S?void 0:qy(T,A),onContextMenu:qy(L,A),onWheel:qy(R,A),onPointerEnter:S?void 0:h,onPointerMove:S?ie:p,onPointerUp:S?G:void 0,onPointerCancel:S?re:void 0,onPointerDownCapture:S?I:void 0,onClickCapture:S?F:void 0,onPointerLeave:m,ref:A,style:s0,children:[y,l.jsx(Wle,{})]})}function LE({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:a,nodeLookup:o,onError:c}=t.getState(),u=o.get(e);if(!u){c==null||c("012",Zs.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(i({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=r==null?void 0:r.current)==null?void 0:d.blur()})):s([e])}function OP({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:a}){const o=tn(),[c,u]=w.useState(!1),d=w.useRef();return w.useEffect(()=>{d.current=voe({getStoreItems:()=>o.getState(),onNodeMouseDown:f=>{LE({id:f,store:o,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),w.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:s,nodeClickDistance:a}),()=>{var f;(f=d.current)==null||f.destroy()}},[n,r,t,i,e,s,a]),c}const Xle=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function RP(){const e=tn();return w.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:c,nodeLookup:u,nodeOrigin:d}=e.getState(),f=new Map,h=Xle(a),p=s?i[0]:5,m=s?i[1]:5,y=n.direction.x*p*n.factor,E=n.direction.y*m*n.factor;for(const[,g]of u){if(!h(g))continue;let x={x:g.internals.positionAbsolute.x+y,y:g.internals.positionAbsolute.y+E};s&&(x=Ff(x,i));const{position:b,positionAbsolute:_}=WD({nodeId:g.id,nextPosition:x,nodeLookup:u,nodeExtent:r,nodeOrigin:d,onError:o});g.position=b,g.internals.positionAbsolute=_,f.set(g.id,g)}c(f)},[])}const jv=w.createContext(null),Qle=jv.Provider;jv.Consumer;const LP=()=>w.useContext(jv),Zle=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Jle=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:a}=r,{fromHandle:o,toHandle:c,isValid:u}=a,d=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,connectingTo:d,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:i===Ic.Strict?(o==null?void 0:o.type)!==n:e!==(o==null?void 0:o.nodeId)||t!==(o==null?void 0:o.id),connectionInProcess:!!o,clickConnectionInProcess:!!s,valid:d&&u}};function ece({type:e="source",position:t=Pe.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:a,onConnect:o,children:c,className:u,onMouseDown:d,onTouchStart:f,...h},p){var j,T;const m=a||null,y=e==="target",E=tn(),g=LP(),{connectOnClick:x,noPanClassName:b,rfId:_}=wt(Zle,en),{connectingFrom:k,connectingTo:N,clickConnecting:C,isPossibleEndHandle:S,connectionInProcess:A,clickConnectionInProcess:O,valid:D}=wt(Jle(g,m,e),en);g||(T=(j=E.getState()).onError)==null||T.call(j,"010",Zs.error010());const U=L=>{const{defaultEdgeOptions:R,onConnect:F,hasDefaultEdges:I}=E.getState(),V={...R,...L};if(I){const{edges:W,setEdges:P,onError:ie}=E.getState();P(AP(V,W,{onError:ie}))}F==null||F(V),o==null||o(V)},X=L=>{if(!g)return;const R=eP(L.nativeEvent);if(s&&(R&&L.button===0||!R)){const F=E.getState();RE.onPointerDown(L.nativeEvent,{handleDomNode:L.currentTarget,autoPanOnConnect:F.autoPanOnConnect,connectionMode:F.connectionMode,connectionRadius:F.connectionRadius,domNode:F.domNode,nodeLookup:F.nodeLookup,lib:F.lib,isTarget:y,handleId:m,nodeId:g,flowId:F.rfId,panBy:F.panBy,cancelConnection:F.cancelConnection,onConnectStart:F.onConnectStart,onConnectEnd:(...I)=>{var V,W;return(W=(V=E.getState()).onConnectEnd)==null?void 0:W.call(V,...I)},updateConnection:F.updateConnection,onConnect:U,isValidConnection:n||((...I)=>{var V,W;return((W=(V=E.getState()).isValidConnection)==null?void 0:W.call(V,...I))??!0}),getTransform:()=>E.getState().transform,getFromHandle:()=>E.getState().connection.fromHandle,autoPanSpeed:F.autoPanSpeed,dragThreshold:F.connectionDragThreshold})}R?d==null||d(L):f==null||f(L)},M=L=>{const{onClickConnectStart:R,onClickConnectEnd:F,connectionClickStartHandle:I,connectionMode:V,isValidConnection:W,lib:P,rfId:ie,nodeLookup:G,connection:re}=E.getState();if(!g||!I&&!s)return;if(!I){R==null||R(L.nativeEvent,{nodeId:g,handleId:m,handleType:e}),E.setState({connectionClickStartHandle:{nodeId:g,type:e,id:m}});return}const ue=ZD(L.target),ee=n||W,{connection:le,isValid:ne}=RE.isValid(L.nativeEvent,{handle:{nodeId:g,id:m,type:e},connectionMode:V,fromNodeId:I.nodeId,fromHandleId:I.id||null,fromType:I.type,isValidConnection:ee,flowId:ie,doc:ue,lib:P,nodeLookup:G});ne&&le&&U(le);const me=structuredClone(re);delete me.inProgress,me.toPosition=me.toHandle?me.toHandle.position:null,F==null||F(L,me),E.setState({connectionClickStartHandle:null})};return l.jsx("div",{"data-handleid":m,"data-nodeid":g,"data-handlepos":t,"data-id":`${_}-${g}-${m}-${e}`,className:Ln(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",b,u,{source:!y,target:y,connectable:r,connectablestart:s,connectableend:i,clickconnecting:C,connectingfrom:k,connectingto:N,valid:D,connectionindicator:r&&(!A||S)&&(A||O?i:s)}]),onMouseDown:X,onTouchStart:X,onClick:x?M:void 0,ref:p,...h,children:c})}const mr=w.memo(CP(ece));function tce({data:e,isConnectable:t,sourcePosition:n=Pe.Bottom}){return l.jsxs(l.Fragment,{children:[e==null?void 0:e.label,l.jsx(mr,{type:"source",position:n,isConnectable:t})]})}function nce({data:e,isConnectable:t,targetPosition:n=Pe.Top,sourcePosition:r=Pe.Bottom}){return l.jsxs(l.Fragment,{children:[l.jsx(mr,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,l.jsx(mr,{type:"source",position:r,isConnectable:t})]})}function rce(){return null}function sce({data:e,isConnectable:t,targetPosition:n=Pe.Top}){return l.jsxs(l.Fragment,{children:[l.jsx(mr,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Km={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},sA={input:tce,default:nce,output:sce,group:rce};function ice(e){var t,n,r,s;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((s=e.style)==null?void 0:s.height)}}const ace=e=>{const{width:t,height:n,x:r,y:s}=Bf(e.nodeLookup,{filter:i=>!!i.selected});return{width:Vs(t)?t:null,height:Vs(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${s}px)`}};function oce({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=tn(),{width:s,height:i,transformString:a,userSelectionActive:o}=wt(ace,en),c=RP(),u=w.useRef(null);w.useEffect(()=>{var p;n||(p=u.current)==null||p.focus({preventScroll:!0})},[n]);const d=!o&&s!==null&&i!==null;if(OP({nodeRef:u,disabled:!d}),!d)return null;const f=e?p=>{const m=r.getState().nodes.filter(y=>y.selected);e(p,m)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(Km,p.key)&&(p.preventDefault(),c({direction:Km[p.key],factor:p.shiftKey?4:1}))};return l.jsx("div",{className:Ln(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:l.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:s,height:i}})})}const iA=typeof window<"u"?window:void 0,lce=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function MP({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,paneClickDistance:o,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:d,selectionMode:f,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:y,zoomActivationKeyCode:E,elementsSelectable:g,zoomOnScroll:x,zoomOnPinch:b,panOnScroll:_,panOnScrollSpeed:k,panOnScrollMode:N,zoomOnDoubleClick:C,panOnDrag:S,autoPanOnSelection:A,defaultViewport:O,translateExtent:D,minZoom:U,maxZoom:X,preventScrolling:M,onSelectionContextMenu:j,noWheelClassName:T,noPanClassName:L,disableKeyboardA11y:R,onViewportChange:F,isControlledViewport:I}){const{nodesSelectionActive:V,userSelectionActive:W}=wt(lce,en),P=uf(u,{target:iA}),ie=uf(y,{target:iA}),G=ie||S,re=ie||_,ue=d&&G!==!0,ee=P||W||ue;return Hle({deleteKeyCode:c,multiSelectionKeyCode:m}),l.jsx(Kle,{onPaneContextMenu:i,elementsSelectable:g,zoomOnScroll:x,zoomOnPinch:b,panOnScroll:re,panOnScrollSpeed:k,panOnScrollMode:N,zoomOnDoubleClick:C,panOnDrag:!P&&G,defaultViewport:O,translateExtent:D,minZoom:U,maxZoom:X,zoomActivationKeyCode:E,preventScrolling:M,noWheelClassName:T,noPanClassName:L,onViewportChange:F,isControlledViewport:I,paneClickDistance:o,selectionOnDrag:ue,children:l.jsxs(qle,{onSelectionStart:h,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:G,autoPanOnSelection:A,isSelecting:!!ee,selectionMode:f,selectionKeyPressed:P,paneClickDistance:o,selectionOnDrag:ue,children:[e,V&&l.jsx(oce,{onSelectionContextMenu:j,noPanClassName:L,disableKeyboardA11y:R})]})})}MP.displayName="FlowRenderer";const cce=w.memo(MP),uce=e=>t=>e?Nv(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function dce(e){return wt(w.useCallback(uce(e),[e]),en)}const fce=e=>e.updateNodeInternals;function hce(){const e=wt(fce),[t]=w.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(s=>{const i=s.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:s.target,force:!0})}),e(r)}));return w.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function pce({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=tn(),i=w.useRef(null),a=w.useRef(null),o=w.useRef(e.sourcePosition),c=w.useRef(e.targetPosition),u=w.useRef(t),d=n&&!!e.internals.handleBounds;return w.useEffect(()=>{i.current&&!e.hidden&&(!d||a.current!==i.current)&&(a.current&&(r==null||r.unobserve(a.current)),r==null||r.observe(i.current),a.current=i.current)},[d,e.hidden]),w.useEffect(()=>()=>{a.current&&(r==null||r.unobserve(a.current),a.current=null)},[]),w.useEffect(()=>{if(i.current){const f=u.current!==t,h=o.current!==e.sourcePosition,p=c.current!==e.targetPosition;(f||h||p)&&(u.current=t,o.current=e.sourcePosition,c.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function mce({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:i,onDoubleClick:a,nodesDraggable:o,elementsSelectable:c,nodesConnectable:u,nodesFocusable:d,resizeObserver:f,noDragClassName:h,noPanClassName:p,disableKeyboardA11y:m,rfId:y,nodeTypes:E,nodeClickDistance:g,onError:x}){const{node:b,internals:_,isParent:k}=wt(ee=>{const le=ee.nodeLookup.get(e),ne=ee.parentLookup.has(e);return{node:le,internals:le.internals,isParent:ne}},en);let N=b.type||"default",C=(E==null?void 0:E[N])||sA[N];C===void 0&&(x==null||x("003",Zs.error003(N)),N="default",C=(E==null?void 0:E.default)||sA.default);const S=!!(b.draggable||o&&typeof b.draggable>"u"),A=!!(b.selectable||c&&typeof b.selectable>"u"),O=!!(b.connectable||u&&typeof b.connectable>"u"),D=!!(b.focusable||d&&typeof b.focusable>"u"),U=tn(),X=Av(b),M=pce({node:b,nodeType:N,hasDimensions:X,resizeObserver:f}),j=OP({nodeRef:M,disabled:b.hidden||!S,noDragClassName:h,handleSelector:b.dragHandle,nodeId:e,isSelectable:A,nodeClickDistance:g}),T=RP();if(b.hidden)return null;const L=ia(b),R=ice(b),F=A||S||t||n||r||s,I=n?ee=>n(ee,{..._.userNode}):void 0,V=r?ee=>r(ee,{..._.userNode}):void 0,W=s?ee=>s(ee,{..._.userNode}):void 0,P=i?ee=>i(ee,{..._.userNode}):void 0,ie=a?ee=>a(ee,{..._.userNode}):void 0,G=ee=>{const{selectNodesOnDrag:le,nodeDragThreshold:ne}=U.getState();A&&(!le||!S||ne>0)&&LE({id:e,store:U,nodeRef:M}),t&&t(ee,{..._.userNode})},re=ee=>{if(!(JD(ee.nativeEvent)||m)){if(HD.includes(ee.key)&&A){const le=ee.key==="Escape";LE({id:e,store:U,unselect:le,nodeRef:M})}else if(S&&b.selected&&Object.prototype.hasOwnProperty.call(Km,ee.key)){ee.preventDefault();const{ariaLabelConfig:le}=U.getState();U.setState({ariaLiveMessage:le["node.a11yDescription.ariaLiveMessage"]({direction:ee.key.replace("Arrow","").toLowerCase(),x:~~_.positionAbsolute.x,y:~~_.positionAbsolute.y})}),T({direction:Km[ee.key],factor:ee.shiftKey?4:1})}}},ue=()=>{var de;if(m||!((de=M.current)!=null&&de.matches(":focus-visible")))return;const{transform:ee,width:le,height:ne,autoPanOnNodeFocus:me,setCenter:ye}=U.getState();if(!me)return;Nv(new Map([[e,b]]),{x:0,y:0,width:le,height:ne},ee,!0).length>0||ye(b.position.x+L.width/2,b.position.y+L.height/2,{zoom:ee[2]})};return l.jsx("div",{className:Ln(["react-flow__node",`react-flow__node-${N}`,{[p]:S},b.className,{selected:b.selected,selectable:A,parent:k,draggable:S,dragging:j}]),ref:M,style:{zIndex:_.z,transform:`translate(${_.positionAbsolute.x}px,${_.positionAbsolute.y}px)`,pointerEvents:F?"all":"none",visibility:X?"visible":"hidden",...b.style,...R},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:I,onMouseMove:V,onMouseLeave:W,onContextMenu:P,onClick:G,onDoubleClick:ie,onKeyDown:D?re:void 0,tabIndex:D?0:void 0,onFocus:D?ue:void 0,role:b.ariaRole??(D?"group":void 0),"aria-roledescription":"node","aria-describedby":m?void 0:`${vP}-${y}`,"aria-label":b.ariaLabel,...b.domAttributes,children:l.jsx(Qle,{value:e,children:l.jsx(C,{id:e,data:b.data,type:N,positionAbsoluteX:_.positionAbsolute.x,positionAbsoluteY:_.positionAbsolute.y,selected:b.selected??!1,selectable:A,draggable:S,deletable:b.deletable??!0,isConnectable:O,sourcePosition:b.sourcePosition,targetPosition:b.targetPosition,dragging:j,dragHandle:b.dragHandle,zIndex:_.z,parentId:b.parentId,...L})})})}var gce=w.memo(mce);const yce=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function jP(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:i}=wt(yce,en),a=dce(e.onlyRenderVisibleElements),o=hce();return l.jsx("div",{className:"react-flow__nodes",style:s0,children:a.map(c=>l.jsx(gce,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:i},c))})}jP.displayName="NodeRenderer";const bce=w.memo(jP);function Ece(e){return wt(w.useCallback(n=>{if(!e)return n.edges.map(s=>s.id);const r=[];if(n.width&&n.height)for(const s of n.edges){const i=n.nodeLookup.get(s.source),a=n.nodeLookup.get(s.target);i&&a&&roe({sourceNode:i,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),en)}const xce=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return l.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},wce=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return l.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},aA={[Oc.Arrow]:xce,[Oc.ArrowClosed]:wce};function vce(e){const t=tn();return w.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(aA,e)?aA[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",Zs.error009(e)),null)},[e])}const _ce=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:a,orient:o="auto-start-reverse"})=>{const c=vce(t);return c?l.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:o,refX:"0",refY:"0",children:l.jsx(c,{color:n,strokeWidth:a})}):null},DP=({defaultColor:e,rfId:t})=>{const n=wt(i=>i.edges),r=wt(i=>i.defaultEdgeOptions),s=w.useMemo(()=>doe(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return s.length?l.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:l.jsx("defs",{children:s.map(i=>l.jsx(_ce,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};DP.displayName="MarkerDefinitions";var kce=w.memo(DP);function PP({x:e,y:t,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:i,labelBgPadding:a=[2,4],labelBgBorderRadius:o=2,children:c,className:u,...d}){const[f,h]=w.useState({x:1,y:0,width:0,height:0}),p=Ln(["react-flow__edge-textwrapper",u]),m=w.useRef(null);return w.useEffect(()=>{if(m.current){const y=m.current.getBBox();h({x:y.x,y:y.y,width:y.width,height:y.height})}},[n]),n?l.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...d,children:[s&&l.jsx("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:i,rx:o,ry:o}),l.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:m,style:r,children:n}),c]}):null}PP.displayName="EdgeText";const Nce=w.memo(PP);function Uf({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:o,labelBgBorderRadius:c,interactionWidth:u=20,...d}){return l.jsxs(l.Fragment,{children:[l.jsx("path",{...d,d:e,fill:"none",className:Ln(["react-flow__edge-path",d.className])}),u?l.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&Vs(t)&&Vs(n)?l.jsx(Nce,{x:t,y:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:o,labelBgBorderRadius:c}):null]})}function oA({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===Pe.Left||e===Pe.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function BP({sourceX:e,sourceY:t,sourcePosition:n=Pe.Bottom,targetX:r,targetY:s,targetPosition:i=Pe.Top}){const[a,o]=oA({pos:n,x1:e,y1:t,x2:r,y2:s}),[c,u]=oA({pos:i,x1:r,y1:s,x2:e,y2:t}),[d,f,h,p]=tP({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:a,sourceControlY:o,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${o} ${c},${u} ${r},${s}`,d,f,h,p]}function FP(e){return w.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a,targetPosition:o,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:y,markerStart:E,interactionWidth:g})=>{const[x,b,_]=BP({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:o}),k=e.isInternal?void 0:t;return l.jsx(Uf,{id:k,path:x,labelX:b,labelY:_,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:y,markerStart:E,interactionWidth:g})})}const Sce=FP({isInternal:!1}),UP=FP({isInternal:!0});Sce.displayName="SimpleBezierEdge";UP.displayName="SimpleBezierEdgeInternal";function $P(e){return w.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:p=Pe.Bottom,targetPosition:m=Pe.Top,markerEnd:y,markerStart:E,pathOptions:g,interactionWidth:x})=>{const[b,_,k]=Vm({sourceX:n,sourceY:r,sourcePosition:p,targetX:s,targetY:i,targetPosition:m,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset,stepPosition:g==null?void 0:g.stepPosition}),N=e.isInternal?void 0:t;return l.jsx(Uf,{id:N,path:b,labelX:_,labelY:k,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:y,markerStart:E,interactionWidth:x})})}const HP=$P({isInternal:!1}),zP=$P({isInternal:!0});HP.displayName="SmoothStepEdge";zP.displayName="SmoothStepEdgeInternal";function VP(e){return w.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return l.jsx(HP,{...n,id:r,pathOptions:w.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const Tce=VP({isInternal:!1}),KP=VP({isInternal:!0});Tce.displayName="StepEdge";KP.displayName="StepEdgeInternal";function YP(e){return w.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:m,interactionWidth:y})=>{const[E,g,x]=sP({sourceX:n,sourceY:r,targetX:s,targetY:i}),b=e.isInternal?void 0:t;return l.jsx(Uf,{id:b,path:E,labelX:g,labelY:x,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:m,interactionWidth:y})})}const Ace=YP({isInternal:!1}),WP=YP({isInternal:!0});Ace.displayName="StraightEdge";WP.displayName="StraightEdgeInternal";function GP(e){return w.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a=Pe.Bottom,targetPosition:o=Pe.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:y,markerStart:E,pathOptions:g,interactionWidth:x})=>{const[b,_,k]=nP({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:o,curvature:g==null?void 0:g.curvature}),N=e.isInternal?void 0:t;return l.jsx(Uf,{id:N,path:b,labelX:_,labelY:k,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:m,markerEnd:y,markerStart:E,interactionWidth:x})})}const Cce=GP({isInternal:!1}),qP=GP({isInternal:!0});Cce.displayName="BezierEdge";qP.displayName="BezierEdgeInternal";const lA={default:qP,straight:WP,step:KP,smoothstep:zP,simplebezier:UP},cA={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Ice=(e,t,n)=>n===Pe.Left?e-t:n===Pe.Right?e+t:e,Oce=(e,t,n)=>n===Pe.Top?e-t:n===Pe.Bottom?e+t:e,uA="react-flow__edgeupdater";function dA({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:a,type:o}){return l.jsx("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:a,className:Ln([uA,`${uA}-${o}`]),cx:Ice(t,r,e),cy:Oce(n,r,e),r,stroke:"transparent",fill:"transparent"})}function Rce({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:i,targetY:a,sourcePosition:o,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:h,setUpdateHover:p}){const m=tn(),y=(_,k)=>{if(_.button!==0)return;const{autoPanOnConnect:N,domNode:C,connectionMode:S,connectionRadius:A,lib:O,onConnectStart:D,cancelConnection:U,nodeLookup:X,rfId:M,panBy:j,updateConnection:T}=m.getState(),L=k.type==="target",R=(V,W)=>{h(!1),f==null||f(V,n,k.type,W)},F=V=>u==null?void 0:u(n,V),I=(V,W)=>{h(!0),d==null||d(_,n,k.type),D==null||D(V,W)};RE.onPointerDown(_.nativeEvent,{autoPanOnConnect:N,connectionMode:S,connectionRadius:A,domNode:C,handleId:k.id,nodeId:k.nodeId,nodeLookup:X,isTarget:L,edgeUpdaterType:k.type,lib:O,flowId:M,cancelConnection:U,panBy:j,isValidConnection:(...V)=>{var W,P;return((P=(W=m.getState()).isValidConnection)==null?void 0:P.call(W,...V))??!0},onConnect:F,onConnectStart:I,onConnectEnd:(...V)=>{var W,P;return(P=(W=m.getState()).onConnectEnd)==null?void 0:P.call(W,...V)},onReconnectEnd:R,updateConnection:T,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:_.currentTarget})},E=_=>y(_,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),g=_=>y(_,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),x=()=>p(!0),b=()=>p(!1);return l.jsxs(l.Fragment,{children:[(e===!0||e==="source")&&l.jsx(dA,{position:o,centerX:r,centerY:s,radius:t,onMouseDown:E,onMouseEnter:x,onMouseOut:b,type:"source"}),(e===!0||e==="target")&&l.jsx(dA,{position:c,centerX:i,centerY:a,radius:t,onMouseDown:g,onMouseEnter:x,onMouseOut:b,type:"target"})]})}function Lce({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:i,onContextMenu:a,onMouseEnter:o,onMouseMove:c,onMouseLeave:u,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,rfId:m,edgeTypes:y,noPanClassName:E,onError:g,disableKeyboardA11y:x}){let b=wt(ye=>ye.edgeLookup.get(e));const _=wt(ye=>ye.defaultEdgeOptions);b=_?{..._,...b}:b;let k=b.type||"default",N=(y==null?void 0:y[k])||lA[k];N===void 0&&(g==null||g("011",Zs.error011(k)),k="default",N=(y==null?void 0:y.default)||lA.default);const C=!!(b.focusable||t&&typeof b.focusable>"u"),S=typeof f<"u"&&(b.reconnectable||n&&typeof b.reconnectable>"u"),A=!!(b.selectable||r&&typeof b.selectable>"u"),O=w.useRef(null),[D,U]=w.useState(!1),[X,M]=w.useState(!1),j=tn(),{zIndex:T,sourceX:L,sourceY:R,targetX:F,targetY:I,sourcePosition:V,targetPosition:W}=wt(w.useCallback(ye=>{const te=ye.nodeLookup.get(b.source),de=ye.nodeLookup.get(b.target);if(!te||!de)return{zIndex:b.zIndex,...cA};const Ee=uoe({id:e,sourceNode:te,targetNode:de,sourceHandle:b.sourceHandle||null,targetHandle:b.targetHandle||null,connectionMode:ye.connectionMode,onError:g});return{zIndex:noe({selected:b.selected,zIndex:b.zIndex,sourceNode:te,targetNode:de,elevateOnSelect:ye.elevateEdgesOnSelect,zIndexMode:ye.zIndexMode}),...Ee||cA}},[b.source,b.target,b.sourceHandle,b.targetHandle,b.selected,b.zIndex]),en),P=w.useMemo(()=>b.markerStart?`url('#${IE(b.markerStart,m)}')`:void 0,[b.markerStart,m]),ie=w.useMemo(()=>b.markerEnd?`url('#${IE(b.markerEnd,m)}')`:void 0,[b.markerEnd,m]);if(b.hidden||L===null||R===null||F===null||I===null)return null;const G=ye=>{var Te;const{addSelectedEdges:te,unselectNodesAndEdges:de,multiSelectionActive:Ee}=j.getState();A&&(j.setState({nodesSelectionActive:!1}),b.selected&&Ee?(de({nodes:[],edges:[b]}),(Te=O.current)==null||Te.blur()):te([e])),s&&s(ye,b)},re=i?ye=>{i(ye,{...b})}:void 0,ue=a?ye=>{a(ye,{...b})}:void 0,ee=o?ye=>{o(ye,{...b})}:void 0,le=c?ye=>{c(ye,{...b})}:void 0,ne=u?ye=>{u(ye,{...b})}:void 0,me=ye=>{var te;if(!x&&HD.includes(ye.key)&&A){const{unselectNodesAndEdges:de,addSelectedEdges:Ee}=j.getState();ye.key==="Escape"?((te=O.current)==null||te.blur(),de({edges:[b]})):Ee([e])}};return l.jsx("svg",{style:{zIndex:T},children:l.jsxs("g",{className:Ln(["react-flow__edge",`react-flow__edge-${k}`,b.className,E,{selected:b.selected,animated:b.animated,inactive:!A&&!s,updating:D,selectable:A}]),onClick:G,onDoubleClick:re,onContextMenu:ue,onMouseEnter:ee,onMouseMove:le,onMouseLeave:ne,onKeyDown:C?me:void 0,tabIndex:C?0:void 0,role:b.ariaRole??(C?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":b.ariaLabel===null?void 0:b.ariaLabel||`Edge from ${b.source} to ${b.target}`,"aria-describedby":C?`${_P}-${m}`:void 0,ref:O,...b.domAttributes,children:[!X&&l.jsx(N,{id:e,source:b.source,target:b.target,type:b.type,selected:b.selected,animated:b.animated,selectable:A,deletable:b.deletable??!0,label:b.label,labelStyle:b.labelStyle,labelShowBg:b.labelShowBg,labelBgStyle:b.labelBgStyle,labelBgPadding:b.labelBgPadding,labelBgBorderRadius:b.labelBgBorderRadius,sourceX:L,sourceY:R,targetX:F,targetY:I,sourcePosition:V,targetPosition:W,data:b.data,style:b.style,sourceHandleId:b.sourceHandle,targetHandleId:b.targetHandle,markerStart:P,markerEnd:ie,pathOptions:"pathOptions"in b?b.pathOptions:void 0,interactionWidth:b.interactionWidth}),S&&l.jsx(Rce,{edge:b,isReconnectable:S,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,sourceX:L,sourceY:R,targetX:F,targetY:I,sourcePosition:V,targetPosition:W,setUpdateHover:U,setReconnecting:M})]})})}var Mce=w.memo(Lce);const jce=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function XP({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:i,onEdgeContextMenu:a,onEdgeMouseEnter:o,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:h,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:y}){const{edgesFocusable:E,edgesReconnectable:g,elementsSelectable:x,onError:b}=wt(jce,en),_=Ece(t);return l.jsxs("div",{className:"react-flow__edges",children:[l.jsx(kce,{defaultColor:e,rfId:n}),_.map(k=>l.jsx(Mce,{id:k,edgesFocusable:E,edgesReconnectable:g,elementsSelectable:x,noPanClassName:s,onReconnect:i,onContextMenu:a,onMouseEnter:o,onMouseMove:c,onMouseLeave:u,onClick:d,reconnectRadius:f,onDoubleClick:h,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:b,edgeTypes:r,disableKeyboardA11y:y},k))]})}XP.displayName="EdgeRenderer";const Dce=w.memo(XP),Pce=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Bce({children:e}){const t=wt(Pce);return l.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Fce(e){const t=r0(),n=w.useRef(!1);w.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Uce=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function $ce(e){const t=wt(Uce),n=tn();return w.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Hce(e){return e.connection.inProgress?{...e.connection,to:Zc(e.connection.to,e.transform)}:{...e.connection}}function zce(e){return Hce}function Vce(e){const t=zce();return wt(t,en)}const Kce=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Yce({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:i,height:a,isValid:o,inProgress:c}=wt(Kce,en);return!(i&&s&&c)?null:l.jsx("svg",{style:e,width:i,height:a,className:"react-flow__connectionline react-flow__container",children:l.jsx("g",{className:Ln(["react-flow__connection",KD(o)]),children:l.jsx(QP,{style:t,type:n,CustomComponent:r,isValid:o})})})}const QP=({style:e,type:t=va.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:i,fromNode:a,fromHandle:o,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h,pointer:p}=Vce();if(!s)return;if(n)return l.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:o,fromX:i.x,fromY:i.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:h,connectionStatus:KD(r),toNode:d,toHandle:f,pointer:p});let m="";const y={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case va.Bezier:[m]=nP(y);break;case va.SimpleBezier:[m]=BP(y);break;case va.Step:[m]=Vm({...y,borderRadius:0});break;case va.SmoothStep:[m]=Vm(y);break;default:[m]=sP(y)}return l.jsx("path",{d:m,fill:"none",className:"react-flow__connection-path",style:e})};QP.displayName="ConnectionLine";const Wce={};function fA(e=Wce){w.useRef(e),tn(),w.useEffect(()=>{},[e])}function Gce(){tn(),w.useRef(!1),w.useEffect(()=>{},[])}function ZP({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:i,onEdgeDoubleClick:a,onNodeMouseEnter:o,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:h,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:y,connectionLineComponent:E,connectionLineContainerStyle:g,selectionKeyCode:x,selectionOnDrag:b,selectionMode:_,multiSelectionKeyCode:k,panActivationKeyCode:N,zoomActivationKeyCode:C,deleteKeyCode:S,onlyRenderVisibleElements:A,elementsSelectable:O,defaultViewport:D,translateExtent:U,minZoom:X,maxZoom:M,preventScrolling:j,defaultMarkerColor:T,zoomOnScroll:L,zoomOnPinch:R,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:V,zoomOnDoubleClick:W,panOnDrag:P,autoPanOnSelection:ie,onPaneClick:G,onPaneMouseEnter:re,onPaneMouseMove:ue,onPaneMouseLeave:ee,onPaneScroll:le,onPaneContextMenu:ne,paneClickDistance:me,nodeClickDistance:ye,onEdgeContextMenu:te,onEdgeMouseEnter:de,onEdgeMouseMove:Ee,onEdgeMouseLeave:Te,reconnectRadius:Ke,onReconnect:Ne,onReconnectStart:it,onReconnectEnd:He,noDragClassName:Ue,noWheelClassName:Et,noPanClassName:rt,disableKeyboardA11y:St,nodeExtent:ct,rfId:B,viewport:Q,onViewportChange:oe}){return fA(e),fA(t),Gce(),Fce(n),$ce(Q),l.jsx(cce,{onPaneClick:G,onPaneMouseEnter:re,onPaneMouseMove:ue,onPaneMouseLeave:ee,onPaneContextMenu:ne,onPaneScroll:le,paneClickDistance:me,deleteKeyCode:S,selectionKeyCode:x,selectionOnDrag:b,selectionMode:_,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:k,panActivationKeyCode:N,zoomActivationKeyCode:C,elementsSelectable:O,zoomOnScroll:L,zoomOnPinch:R,zoomOnDoubleClick:W,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:V,panOnDrag:P,autoPanOnSelection:ie,defaultViewport:D,translateExtent:U,minZoom:X,maxZoom:M,onSelectionContextMenu:f,preventScrolling:j,noDragClassName:Ue,noWheelClassName:Et,noPanClassName:rt,disableKeyboardA11y:St,onViewportChange:oe,isControlledViewport:!!Q,children:l.jsxs(Bce,{children:[l.jsx(Dce,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:a,onReconnect:Ne,onReconnectStart:it,onReconnectEnd:He,onlyRenderVisibleElements:A,onEdgeContextMenu:te,onEdgeMouseEnter:de,onEdgeMouseMove:Ee,onEdgeMouseLeave:Te,reconnectRadius:Ke,defaultMarkerColor:T,noPanClassName:rt,disableKeyboardA11y:St,rfId:B}),l.jsx(Yce,{style:y,type:m,component:E,containerStyle:g}),l.jsx("div",{className:"react-flow__edgelabel-renderer"}),l.jsx(bce,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:o,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:ye,onlyRenderVisibleElements:A,noPanClassName:rt,noDragClassName:Ue,disableKeyboardA11y:St,nodeExtent:ct,rfId:B}),l.jsx("div",{className:"react-flow__viewport-portal"})]})})}ZP.displayName="GraphView";const qce=w.memo(ZP),Xce=XD(),hA=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:o,minZoom:c=.5,maxZoom:u=2,nodeOrigin:d,nodeExtent:f,zIndexMode:h="basic"}={})=>{const p=new Map,m=new Map,y=new Map,E=new Map,g=r??t??[],x=n??e??[],b=d??[0,0],_=f??af;oP(y,E,g);const{nodesInitialized:k}=OE(x,p,m,{nodeOrigin:b,nodeExtent:_,zIndexMode:h});let N=[0,0,1];if(a&&s&&i){const C=Bf(p,{filter:D=>!!((D.width||D.initialWidth)&&(D.height||D.initialHeight))}),{x:S,y:A,zoom:O}=Tv(C,s,i,c,u,(o==null?void 0:o.padding)??.1);N=[S,A,O]}return{rfId:"1",width:s??0,height:i??0,transform:N,nodes:x,nodesInitialized:k,nodeLookup:p,parentLookup:m,edges:g,edgeLookup:E,connectionLookup:y,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:af,nodeExtent:_,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ic.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:b,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:o,fitViewResolver:null,connection:{...VD},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Xce,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:zD,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Qce=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:o,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h})=>hle((p,m)=>{async function y(){const{nodeLookup:E,panZoom:g,fitViewOptions:x,fitViewResolver:b,width:_,height:k,minZoom:N,maxZoom:C}=m();g&&(await qae({nodes:E,width:_,height:k,panZoom:g,minZoom:N,maxZoom:C},x),b==null||b.resolve(!0),p({fitViewResolver:null}))}return{...hA({nodes:e,edges:t,width:s,height:i,fitView:a,fitViewOptions:o,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,defaultNodes:n,defaultEdges:r,zIndexMode:h}),setNodes:E=>{const{nodeLookup:g,parentLookup:x,nodeOrigin:b,elevateNodesOnSelect:_,fitViewQueued:k,zIndexMode:N,nodesSelectionActive:C}=m(),{nodesInitialized:S,hasSelectedNodes:A}=OE(E,g,x,{nodeOrigin:b,nodeExtent:f,elevateNodesOnSelect:_,checkEquality:!0,zIndexMode:N}),O=C&&A;k&&S?(y(),p({nodes:E,nodesInitialized:S,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:O})):p({nodes:E,nodesInitialized:S,nodesSelectionActive:O})},setEdges:E=>{const{connectionLookup:g,edgeLookup:x}=m();oP(g,x,E),p({edges:E})},setDefaultNodesAndEdges:(E,g)=>{if(E){const{setNodes:x}=m();x(E),p({hasDefaultNodes:!0})}if(g){const{setEdges:x}=m();x(g),p({hasDefaultEdges:!0})}},updateNodeInternals:E=>{const{triggerNodeChanges:g,nodeLookup:x,parentLookup:b,domNode:_,nodeOrigin:k,nodeExtent:N,debug:C,fitViewQueued:S,zIndexMode:A}=m(),{changes:O,updatedInternals:D}=boe(E,x,b,_,k,N,A);D&&(poe(x,b,{nodeOrigin:k,nodeExtent:N,zIndexMode:A}),S?(y(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),(O==null?void 0:O.length)>0&&(C&&console.log("React Flow: trigger node changes",O),g==null||g(O)))},updateNodePositions:(E,g=!1)=>{const x=[];let b=[];const{nodeLookup:_,triggerNodeChanges:k,connection:N,updateConnection:C,onNodesChangeMiddlewareMap:S}=m();for(const[A,O]of E){const D=_.get(A),U=!!(D!=null&&D.expandParent&&(D!=null&&D.parentId)&&(O!=null&&O.position)),X={id:A,type:"position",position:U?{x:Math.max(0,O.position.x),y:Math.max(0,O.position.y)}:O.position,dragging:g};if(D&&N.inProgress&&N.fromNode.id===D.id){const M=Vo(D,N.fromHandle,Pe.Left,!0);C({...N,from:M})}U&&D.parentId&&x.push({id:A,parentId:D.parentId,rect:{...O.internals.positionAbsolute,width:O.measured.width??0,height:O.measured.height??0}}),b.push(X)}if(x.length>0){const{parentLookup:A,nodeOrigin:O}=m(),D=Mv(x,_,A,O);b.push(...D)}for(const A of S.values())b=A(b);k(b)},triggerNodeChanges:E=>{const{onNodesChange:g,setNodes:x,nodes:b,hasDefaultNodes:_,debug:k}=m();if(E!=null&&E.length){if(_){const N=SP(E,b);x(N)}k&&console.log("React Flow: trigger node changes",E),g==null||g(E)}},triggerEdgeChanges:E=>{const{onEdgesChange:g,setEdges:x,edges:b,hasDefaultEdges:_,debug:k}=m();if(E!=null&&E.length){if(_){const N=TP(E,b);x(N)}k&&console.log("React Flow: trigger edge changes",E),g==null||g(E)}},addSelectedNodes:E=>{const{multiSelectionActive:g,edgeLookup:x,nodeLookup:b,triggerNodeChanges:_,triggerEdgeChanges:k}=m();if(g){const N=E.map(C=>lo(C,!0));_(N);return}_(Hl(b,new Set([...E]),!0)),k(Hl(x))},addSelectedEdges:E=>{const{multiSelectionActive:g,edgeLookup:x,nodeLookup:b,triggerNodeChanges:_,triggerEdgeChanges:k}=m();if(g){const N=E.map(C=>lo(C,!0));k(N);return}k(Hl(x,new Set([...E]))),_(Hl(b,new Set,!0))},unselectNodesAndEdges:({nodes:E,edges:g}={})=>{const{edges:x,nodes:b,nodeLookup:_,triggerNodeChanges:k,triggerEdgeChanges:N}=m(),C=E||b,S=g||x,A=[];for(const D of C){if(!D.selected)continue;const U=_.get(D.id);U&&(U.selected=!1),A.push(lo(D.id,!1))}const O=[];for(const D of S)D.selected&&O.push(lo(D.id,!1));k(A),N(O)},setMinZoom:E=>{const{panZoom:g,maxZoom:x}=m();g==null||g.setScaleExtent([E,x]),p({minZoom:E})},setMaxZoom:E=>{const{panZoom:g,minZoom:x}=m();g==null||g.setScaleExtent([x,E]),p({maxZoom:E})},setTranslateExtent:E=>{var g;(g=m().panZoom)==null||g.setTranslateExtent(E),p({translateExtent:E})},resetSelectedElements:()=>{const{edges:E,nodes:g,triggerNodeChanges:x,triggerEdgeChanges:b,elementsSelectable:_}=m();if(!_)return;const k=g.reduce((C,S)=>S.selected?[...C,lo(S.id,!1)]:C,[]),N=E.reduce((C,S)=>S.selected?[...C,lo(S.id,!1)]:C,[]);x(k),b(N)},setNodeExtent:E=>{const{nodes:g,nodeLookup:x,parentLookup:b,nodeOrigin:_,elevateNodesOnSelect:k,nodeExtent:N,zIndexMode:C}=m();E[0][0]===N[0][0]&&E[0][1]===N[0][1]&&E[1][0]===N[1][0]&&E[1][1]===N[1][1]||(OE(g,x,b,{nodeOrigin:_,nodeExtent:E,elevateNodesOnSelect:k,checkEquality:!1,zIndexMode:C}),p({nodeExtent:E}))},panBy:E=>{const{transform:g,width:x,height:b,panZoom:_,translateExtent:k}=m();return Eoe({delta:E,panZoom:_,transform:g,translateExtent:k,width:x,height:b})},setCenter:async(E,g,x)=>{const{width:b,height:_,maxZoom:k,panZoom:N}=m();if(!N)return!1;const C=typeof(x==null?void 0:x.zoom)<"u"?x.zoom:k;return await N.setViewport({x:b/2-E*C,y:_/2-g*C,zoom:C},{duration:x==null?void 0:x.duration,ease:x==null?void 0:x.ease,interpolate:x==null?void 0:x.interpolate}),!0},cancelConnection:()=>{p({connection:{...VD}})},updateConnection:E=>{p({connection:E})},reset:()=>p({...hA()})}},Object.is);function Dv({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:i,initialMinZoom:a,initialMaxZoom:o,initialFitViewOptions:c,fitView:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:p}){const[m]=w.useState(()=>Qce({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:u,minZoom:a,maxZoom:o,fitViewOptions:c,nodeOrigin:d,nodeExtent:f,zIndexMode:h}));return l.jsx(ple,{value:m,children:l.jsx(Ble,{children:p})})}function Zce({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:i,height:a,fitView:o,fitViewOptions:c,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p}){return w.useContext(t0)?l.jsx(l.Fragment,{children:e}):l.jsx(Dv,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:i,initialHeight:a,fitView:o,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p,children:e})}const Jce={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function eue({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i,edgeTypes:a,onNodeClick:o,onEdgeClick:c,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:h,onConnect:p,onConnectStart:m,onConnectEnd:y,onClickConnectStart:E,onClickConnectEnd:g,onNodeMouseEnter:x,onNodeMouseMove:b,onNodeMouseLeave:_,onNodeContextMenu:k,onNodeDoubleClick:N,onNodeDragStart:C,onNodeDrag:S,onNodeDragStop:A,onNodesDelete:O,onEdgesDelete:D,onDelete:U,onSelectionChange:X,onSelectionDragStart:M,onSelectionDrag:j,onSelectionDragStop:T,onSelectionContextMenu:L,onSelectionStart:R,onSelectionEnd:F,onBeforeDelete:I,connectionMode:V,connectionLineType:W=va.Bezier,connectionLineStyle:P,connectionLineComponent:ie,connectionLineContainerStyle:G,deleteKeyCode:re="Backspace",selectionKeyCode:ue="Shift",selectionOnDrag:ee=!1,selectionMode:le=of.Full,panActivationKeyCode:ne="Space",multiSelectionKeyCode:me=cf()?"Meta":"Control",zoomActivationKeyCode:ye=cf()?"Meta":"Control",snapToGrid:te,snapGrid:de,onlyRenderVisibleElements:Ee=!1,selectNodesOnDrag:Te,nodesDraggable:Ke,autoPanOnNodeFocus:Ne,nodesConnectable:it,nodesFocusable:He,nodeOrigin:Ue=kP,edgesFocusable:Et,edgesReconnectable:rt,elementsSelectable:St=!0,defaultViewport:ct=Tle,minZoom:B=.5,maxZoom:Q=2,translateExtent:oe=af,preventScrolling:be=!0,nodeExtent:Oe,defaultMarkerColor:Ye="#b1b1b7",zoomOnScroll:tt=!0,zoomOnPinch:ze=!0,panOnScroll:Tt=!1,panOnScrollSpeed:Re=.5,panOnScrollMode:kt=Io.Free,zoomOnDoubleClick:Pt=!0,panOnDrag:Bt=!0,onPaneClick:bn,onPaneMouseEnter:Xe,onPaneMouseMove:ft,onPaneMouseLeave:xt,onPaneScroll:vt,onPaneContextMenu:fe,paneClickDistance:$e=1,nodeClickDistance:nt=0,children:qt,onReconnect:fn,onReconnectStart:Lt,onReconnectEnd:J,onEdgeContextMenu:he,onEdgeDoubleClick:Le,onEdgeMouseEnter:Be,onEdgeMouseMove:ot,onEdgeMouseLeave:It,reconnectRadius:st=10,onNodesChange:Z,onEdgesChange:we,noDragClassName:_e="nodrag",noWheelClassName:We="nowheel",noPanClassName:Ve="nopan",fitView:Je,fitViewOptions:ut,connectOnClick:Vt,attributionPosition:Ft,proOptions:hn,defaultEdgeOptions:Tn,elevateNodesOnSelect:Kt=!0,elevateEdgesOnSelect:os=!1,disableKeyboardA11y:Er=!1,autoPanOnConnect:Xn,autoPanOnNodeDrag:Or,autoPanOnSelection:Qn=!0,autoPanSpeed:ar,connectionRadius:An,isValidConnection:Xt,onError:En,style:Un,id:or,nodeDragThreshold:nn,connectionDragThreshold:ls,viewport:Zn,onViewportChange:$n,width:Jn,height:Is,colorMode:Rr="light",debug:xr,onScroll:cs,ariaLabelConfig:Kr,zIndexMode:Ga="basic",...qa},Xa){const Si=or||"1",Hn=Ole(Rr),Qa=w.useCallback(Ti=>{Ti.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),cs==null||cs(Ti)},[cs]);return l.jsx("div",{"data-testid":"rf__wrapper",...qa,onScroll:Qa,style:{...Un,...Jce},ref:Xa,className:Ln(["react-flow",s,Hn]),id:or,role:"application",children:l.jsxs(Zce,{nodes:e,edges:t,width:Jn,height:Is,fitView:Je,fitViewOptions:ut,minZoom:B,maxZoom:Q,nodeOrigin:Ue,nodeExtent:Oe,zIndexMode:Ga,children:[l.jsx(Ile,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:y,onClickConnectStart:E,onClickConnectEnd:g,nodesDraggable:Ke,autoPanOnNodeFocus:Ne,nodesConnectable:it,nodesFocusable:He,edgesFocusable:Et,edgesReconnectable:rt,elementsSelectable:St,elevateNodesOnSelect:Kt,elevateEdgesOnSelect:os,minZoom:B,maxZoom:Q,nodeExtent:Oe,onNodesChange:Z,onEdgesChange:we,snapToGrid:te,snapGrid:de,connectionMode:V,translateExtent:oe,connectOnClick:Vt,defaultEdgeOptions:Tn,fitView:Je,fitViewOptions:ut,onNodesDelete:O,onEdgesDelete:D,onDelete:U,onNodeDragStart:C,onNodeDrag:S,onNodeDragStop:A,onSelectionDrag:j,onSelectionDragStart:M,onSelectionDragStop:T,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:Ve,nodeOrigin:Ue,rfId:Si,autoPanOnConnect:Xn,autoPanOnNodeDrag:Or,autoPanSpeed:ar,onError:En,connectionRadius:An,isValidConnection:Xt,selectNodesOnDrag:Te,nodeDragThreshold:nn,connectionDragThreshold:ls,onBeforeDelete:I,debug:xr,ariaLabelConfig:Kr,zIndexMode:Ga}),l.jsx(qce,{onInit:u,onNodeClick:o,onEdgeClick:c,onNodeMouseEnter:x,onNodeMouseMove:b,onNodeMouseLeave:_,onNodeContextMenu:k,onNodeDoubleClick:N,nodeTypes:i,edgeTypes:a,connectionLineType:W,connectionLineStyle:P,connectionLineComponent:ie,connectionLineContainerStyle:G,selectionKeyCode:ue,selectionOnDrag:ee,selectionMode:le,deleteKeyCode:re,multiSelectionKeyCode:me,panActivationKeyCode:ne,zoomActivationKeyCode:ye,onlyRenderVisibleElements:Ee,defaultViewport:ct,translateExtent:oe,minZoom:B,maxZoom:Q,preventScrolling:be,zoomOnScroll:tt,zoomOnPinch:ze,zoomOnDoubleClick:Pt,panOnScroll:Tt,panOnScrollSpeed:Re,panOnScrollMode:kt,panOnDrag:Bt,autoPanOnSelection:Qn,onPaneClick:bn,onPaneMouseEnter:Xe,onPaneMouseMove:ft,onPaneMouseLeave:xt,onPaneScroll:vt,onPaneContextMenu:fe,paneClickDistance:$e,nodeClickDistance:nt,onSelectionContextMenu:L,onSelectionStart:R,onSelectionEnd:F,onReconnect:fn,onReconnectStart:Lt,onReconnectEnd:J,onEdgeContextMenu:he,onEdgeDoubleClick:Le,onEdgeMouseEnter:Be,onEdgeMouseMove:ot,onEdgeMouseLeave:It,reconnectRadius:st,defaultMarkerColor:Ye,noDragClassName:_e,noWheelClassName:We,noPanClassName:Ve,rfId:Si,disableKeyboardA11y:Er,nodeExtent:Oe,viewport:Zn,onViewportChange:$n}),l.jsx(Sle,{onSelectionChange:X}),qt,l.jsx(wle,{proOptions:hn,position:Ft}),l.jsx(xle,{rfId:Si,disableKeyboardA11y:Er})]})})}var JP=CP(eue);const tue=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function nue({children:e}){const t=wt(tue);return t?Ss.createPortal(e,t):null}function e4(e){const[t,n]=w.useState(e),r=w.useCallback(s=>n(i=>SP(s,i)),[]);return[t,n,r]}function t4(e){const[t,n]=w.useState(e),r=w.useCallback(s=>n(i=>TP(s,i)),[]);return[t,n,r]}const rue=e=>t=>{if(!e.includeHiddenNodes)return t.nodesInitialized;if(t.nodeLookup.size===0)return!1;for(const[,{internals:n}]of t.nodeLookup)if(n.handleBounds===void 0||!Av(n.userNode))return!1;return!0};function sue(e={includeHiddenNodes:!1}){return wt(rue(e))}function iue({dimensions:e,lineWidth:t,variant:n,className:r}){return l.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Ln(["react-flow__background-pattern",n,r])})}function aue({radius:e,className:t}){return l.jsx("circle",{cx:e,cy:e,r:e,className:Ln(["react-flow__background-pattern","dots",t])})}var ja;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ja||(ja={}));const oue={[ja.Dots]:1,[ja.Lines]:1,[ja.Cross]:6},lue=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function n4({id:e,variant:t=ja.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=0,color:a,bgColor:o,style:c,className:u,patternClassName:d}){const f=w.useRef(null),{transform:h,patternId:p}=wt(lue,en),m=r||oue[t],y=t===ja.Dots,E=t===ja.Cross,g=Array.isArray(n)?n:[n,n],x=[g[0]*h[2]||1,g[1]*h[2]||1],b=m*h[2],_=Array.isArray(i)?i:[i,i],k=E?[b,b]:x,N=[_[0]*h[2]||1+k[0]/2,_[1]*h[2]||1+k[1]/2],C=`${p}${e||""}`;return l.jsxs("svg",{className:Ln(["react-flow__background",u]),style:{...c,...s0,"--xy-background-color-props":o,"--xy-background-pattern-color-props":a},ref:f,"data-testid":"rf__background",children:[l.jsx("pattern",{id:C,x:h[0]%x[0],y:h[1]%x[1],width:x[0],height:x[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${N[0]},-${N[1]})`,children:y?l.jsx(aue,{radius:b/2,className:d}):l.jsx(iue,{dimensions:k,lineWidth:s,variant:t,className:d})}),l.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${C})`})]})}n4.displayName="Background";const r4=w.memo(n4);function cue(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:l.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function uue(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:l.jsx("path",{d:"M0 0h32v4.2H0z"})})}function due(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:l.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function fue(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:l.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function hue(){return l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:l.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Zh({children:e,className:t,...n}){return l.jsx("button",{type:"button",className:Ln(["react-flow__controls-button",t]),...n,children:e})}const pue=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function s4({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:a,onFitView:o,onInteractiveChange:c,className:u,children:d,position:f="bottom-left",orientation:h="vertical","aria-label":p}){const m=tn(),{isInteractive:y,minZoomReached:E,maxZoomReached:g,ariaLabelConfig:x}=wt(pue,en),{zoomIn:b,zoomOut:_,fitView:k}=r0(),N=()=>{b(),i==null||i()},C=()=>{_(),a==null||a()},S=()=>{k(s),o==null||o()},A=()=>{m.setState({nodesDraggable:!y,nodesConnectable:!y,elementsSelectable:!y}),c==null||c(!y)},O=h==="horizontal"?"horizontal":"vertical";return l.jsxs(n0,{className:Ln(["react-flow__controls",O,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":p??x["controls.ariaLabel"],children:[t&&l.jsxs(l.Fragment,{children:[l.jsx(Zh,{onClick:N,className:"react-flow__controls-zoomin",title:x["controls.zoomIn.ariaLabel"],"aria-label":x["controls.zoomIn.ariaLabel"],disabled:g,children:l.jsx(cue,{})}),l.jsx(Zh,{onClick:C,className:"react-flow__controls-zoomout",title:x["controls.zoomOut.ariaLabel"],"aria-label":x["controls.zoomOut.ariaLabel"],disabled:E,children:l.jsx(uue,{})})]}),n&&l.jsx(Zh,{className:"react-flow__controls-fitview",onClick:S,title:x["controls.fitView.ariaLabel"],"aria-label":x["controls.fitView.ariaLabel"],children:l.jsx(due,{})}),r&&l.jsx(Zh,{className:"react-flow__controls-interactive",onClick:A,title:x["controls.interactive.ariaLabel"],"aria-label":x["controls.interactive.ariaLabel"],children:y?l.jsx(hue,{}):l.jsx(fue,{})}),d]})}s4.displayName="Controls";const i4=w.memo(s4);function mue({id:e,x:t,y:n,width:r,height:s,style:i,color:a,strokeColor:o,strokeWidth:c,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:p}){const{background:m,backgroundColor:y}=i||{},E=a||m||y;return l.jsx("rect",{className:Ln(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:d,ry:d,width:r,height:s,style:{fill:E,stroke:o,strokeWidth:c},shapeRendering:f,onClick:p?g=>p(g,e):void 0})}const gue=w.memo(mue),yue=e=>e.nodes.map(t=>t.id),Xy=e=>e instanceof Function?e:()=>e;function bue({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=gue,onClick:a}){const o=wt(yue,en),c=Xy(t),u=Xy(e),d=Xy(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return l.jsx(l.Fragment,{children:o.map(h=>l.jsx(xue,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:a,shapeRendering:f},h))})}function Eue({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:i,shapeRendering:a,NodeComponent:o,onClick:c}){const{node:u,x:d,y:f,width:h,height:p}=wt(m=>{const y=m.nodeLookup.get(e);if(!y)return{node:void 0,x:0,y:0,width:0,height:0};const E=y.internals.userNode,{x:g,y:x}=y.internals.positionAbsolute,{width:b,height:_}=ia(E);return{node:E,x:g,y:x,width:b,height:_}},en);return!u||u.hidden||!Av(u)?null:l.jsx(o,{x:d,y:f,width:h,height:p,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:s,strokeColor:n(u),strokeWidth:i,shapeRendering:a,onClick:c,id:u.id})}const xue=w.memo(Eue);var wue=w.memo(bue);const vue=200,_ue=150,kue=e=>!e.hidden,Nue=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?qD(Bf(e.nodeLookup,{filter:kue}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Sue="react-flow__minimap-desc";function a4({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:a,nodeComponent:o,bgColor:c,maskColor:u,maskStrokeColor:d,maskStrokeWidth:f,position:h="bottom-right",onClick:p,onNodeClick:m,pannable:y=!1,zoomable:E=!1,ariaLabel:g,inversePan:x,zoomStep:b=1,offsetScale:_=5}){const k=tn(),N=w.useRef(null),{boundingRect:C,viewBB:S,rfId:A,panZoom:O,translateExtent:D,flowWidth:U,flowHeight:X,ariaLabelConfig:M}=wt(Nue,en),j=(e==null?void 0:e.width)??vue,T=(e==null?void 0:e.height)??_ue,L=C.width/j,R=C.height/T,F=Math.max(L,R),I=F*j,V=F*T,W=_*F,P=C.x-(I-C.width)/2-W,ie=C.y-(V-C.height)/2-W,G=I+W*2,re=V+W*2,ue=`${Sue}-${A}`,ee=w.useRef(0),le=w.useRef();ee.current=F,w.useEffect(()=>{if(N.current&&O)return le.current=Aoe({domNode:N.current,panZoom:O,getTransform:()=>k.getState().transform,getViewScale:()=>ee.current}),()=>{var te;(te=le.current)==null||te.destroy()}},[O]),w.useEffect(()=>{var te;(te=le.current)==null||te.update({translateExtent:D,width:U,height:X,inversePan:x,pannable:y,zoomStep:b,zoomable:E})},[y,E,x,b,D,U,X]);const ne=p?te=>{var Te;const[de,Ee]=((Te=le.current)==null?void 0:Te.pointer(te))||[0,0];p(te,{x:de,y:Ee})}:void 0,me=m?w.useCallback((te,de)=>{const Ee=k.getState().nodeLookup.get(de).internals.userNode;m(te,Ee)},[]):void 0,ye=g??M["minimap.ariaLabel"];return l.jsx(n0,{position:h,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*F:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof a=="number"?a:void 0},className:Ln(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:l.jsxs("svg",{width:j,height:T,viewBox:`${P} ${ie} ${G} ${re}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ue,ref:N,onClick:ne,children:[ye&&l.jsx("title",{id:ue,children:ye}),l.jsx(wue,{onClick:me,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:o}),l.jsx("path",{className:"react-flow__minimap-mask",d:`M${P-W},${ie-W}h${G+W*2}v${re+W*2}h${-G-W*2}z + M${S.x},${S.y}h${S.width}v${S.height}h${-S.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}a4.displayName="MiniMap";const Tue=w.memo(a4),Aue=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Cue={[jc.Line]:"right",[jc.Handle]:"bottom-right"};function Iue({nodeId:e,position:t,variant:n=jc.Handle,className:r,style:s=void 0,children:i,color:a,minWidth:o=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:h,autoScale:p=!0,shouldResize:m,onResizeStart:y,onResize:E,onResizeEnd:g}){const x=LP(),b=typeof e=="string"?e:x,_=tn(),k=w.useRef(null),N=n===jc.Handle,C=wt(w.useCallback(Aue(N&&p),[N,p]),en),S=w.useRef(null),A=t??Cue[n];w.useEffect(()=>{if(!(!k.current||!b))return S.current||(S.current=$oe({domNode:k.current,nodeId:b,getStoreItems:()=>{const{nodeLookup:D,transform:U,snapGrid:X,snapToGrid:M,nodeOrigin:j,domNode:T}=_.getState();return{nodeLookup:D,transform:U,snapGrid:X,snapToGrid:M,nodeOrigin:j,paneDomNode:T}},onChange:(D,U)=>{const{triggerNodeChanges:X,nodeLookup:M,parentLookup:j,nodeOrigin:T}=_.getState(),L=[],R={x:D.x,y:D.y},F=M.get(b);if(F&&F.expandParent&&F.parentId){const I=F.origin??T,V=D.width??F.measured.width??0,W=D.height??F.measured.height??0,P={id:F.id,parentId:F.parentId,rect:{width:V,height:W,...QD({x:D.x??F.position.x,y:D.y??F.position.y},{width:V,height:W},F.parentId,M,I)}},ie=Mv([P],M,j,T);L.push(...ie),R.x=D.x?Math.max(I[0]*V,D.x):void 0,R.y=D.y?Math.max(I[1]*W,D.y):void 0}if(R.x!==void 0&&R.y!==void 0){const I={id:b,type:"position",position:{...R}};L.push(I)}if(D.width!==void 0&&D.height!==void 0){const V={id:b,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:D.width,height:D.height}};L.push(V)}for(const I of U){const V={...I,type:"position"};L.push(V)}X(L)},onEnd:({width:D,height:U})=>{const X={id:b,type:"dimensions",resizing:!1,dimensions:{width:D,height:U}};_.getState().triggerNodeChanges([X])}})),S.current.update({controlPosition:A,boundaries:{minWidth:o,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:y,onResize:E,onResizeEnd:g,shouldResize:m}),()=>{var D;(D=S.current)==null||D.destroy()}},[A,o,c,u,d,f,y,E,g,m]);const O=A.split("-");return l.jsx("div",{className:Ln(["react-flow__resize-control","nodrag",...O,n,r]),ref:k,style:{...s,scale:C,...a&&{[N?"backgroundColor":"borderColor"]:a}},children:i})}w.memo(Iue);var o4=Object.defineProperty,Oue=(e,t,n)=>t in e?o4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rue=(e,t)=>{for(var n in t)o4(e,n,{get:t[n],enumerable:!0})},Lue=(e,t,n)=>Oue(e,t+"",n),l4={};Rue(l4,{Graph:()=>Cs,alg:()=>Pv,json:()=>u4,version:()=>Due});var Mue=Object.defineProperty,c4=(e,t)=>{for(var n in t)Mue(e,n,{get:t[n],enumerable:!0})},Cs=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected="directed"in e?e.directed:!0,this._isMultigraph="multigraph"in e?e.multigraph:!1,this._isCompound="compound"in e?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return typeof e!="function"?this._defaultNodeLabelFn=()=>e:this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(n=>{t!==void 0?this.setNode(n,t):this.setNode(n)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]="\0",this._children[e]={},this._children["\0"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(n=>{this.setParent(n)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t===void 0)t="\0";else{t+="";for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw new Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!=="\0")return t}}children(e="\0"){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e==="\0")return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t);for(let r of this.successors(e))n.add(r);return Array.from(n.values())}}isLeaf(e){let t;return this.isDirected()?t=this.successors(e):t=this.neighbors(e),t.length===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([s,i])=>{e(s)&&t.setNode(s,i)}),Object.values(this._edgeObjs).forEach(s=>{t.hasNode(s.v)&&t.hasNode(s.w)&&t.setEdge(s,this.edge(s))});let n={},r=s=>{let i=this.parent(s);return!i||t.hasNode(i)?(n[s]=i??void 0,i??void 0):i in n?n[i]:r(i)};return this._isCompound&&t.nodes().forEach(s=>t.setParent(s,r(s))),t}setDefaultEdgeLabel(e){return typeof e!="function"?this._defaultEdgeLabelFn=()=>e:this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((n,r)=>(t!==void 0?this.setEdge(n,r,t):this.setEdge(n,r),r)),this}setEdge(e,t,n,r){let s,i,a,o,c=!1;typeof e=="object"&&e!==null&&"v"in e?(s=e.v,i=e.w,a=e.name,arguments.length===2&&(o=t,c=!0)):(s=e,i=t,a=r,arguments.length>2&&(o=n,c=!0)),s=""+s,i=""+i,a!==void 0&&(a=""+a);let u=zu(this._isDirected,s,i,a);if(u in this._edgeLabels)return c&&(this._edgeLabels[u]=o),this;if(a!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(s),this.setNode(i),this._edgeLabels[u]=c?o:this._defaultEdgeLabelFn(s,i,a);let d=jue(this._isDirected,s,i,a);return s=d.v,i=d.w,Object.freeze(d),this._edgeObjs[u]=d,pA(this._preds[i],s),pA(this._sucs[s],i),this._in[i][u]=d,this._out[s][u]=d,this._edgeCount++,this}edge(e,t,n){let r=arguments.length===1?Qy(this._isDirected,e):zu(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof r!="object"?{label:r}:r}hasEdge(e,t,n){return(arguments.length===1?Qy(this._isDirected,e):zu(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?Qy(this._isDirected,e):zu(this._isDirected,e,t,n),s=this._edgeObjs[r];if(s){let i=s.v,a=s.w;delete this._edgeLabels[r],delete this._edgeObjs[r],mA(this._preds[a],i),mA(this._sucs[i],a),delete this._in[a][r],delete this._out[i][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(s=>s.v===t&&s.w===n||s.v===n&&s.w===t):r}};function pA(e,t){e[t]?e[t]++:e[t]=1}function mA(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function zu(e,t,n,r){let s=""+t,i=""+n;if(!e&&s>i){let a=s;s=i,i=a}return s+""+i+""+(r===void 0?"\0":r)}function jue(e,t,n,r){let s=""+t,i=""+n;if(!e&&s>i){let o=s;s=i,i=o}let a={v:s,w:i};return r&&(a.name=r),a}function Qy(e,t){return zu(e,t.v,t.w,t.name)}var Due="4.0.1",u4={};c4(u4,{read:()=>Uue,write:()=>Pue});function Pue(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:Bue(e),edges:Fue(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function Bue(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),s={v:t};return n!==void 0&&(s.value=n),r!==void 0&&(s.parent=r),s})}function Fue(e){return e.edges().map(t=>{let n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function Uue(e){let t=new Cs(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(n=>{t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(n=>{t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var Pv={};c4(Pv,{CycleException:()=>Wm,bellmanFord:()=>d4,components:()=>zue,dijkstra:()=>Ym,dijkstraAll:()=>Yue,findCycles:()=>Wue,floydWarshall:()=>que,isAcyclic:()=>Que,postorder:()=>Jue,preorder:()=>ede,prim:()=>tde,shortestPaths:()=>nde,tarjan:()=>h4,topsort:()=>p4});var $ue=()=>1;function d4(e,t,n,r){return Hue(e,String(t),n||$ue,r||function(s){return e.outEdges(s)})}function Hue(e,t,n,r){let s={},i,a=0,o=e.nodes(),c=function(f){let h=n(f);s[f.v].distance+he.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let s=this._arr,i=s.length;return n[r]=i,s.push({key:r,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw new Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,s=e;n>1,!(t[r].priority1;function Ym(e,t,n,r){let s=function(i){return e.outEdges(i)};return Kue(e,String(t),n||Vue,r||s)}function Kue(e,t,n,r){let s={},i=new f4,a,o,c=function(u){let d=u.v!==a?u.v:u.w,f=s[d],h=n(u),p=o.distance+h;if(h<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+h);p0&&(a=i.removeMin(),o=s[a],o.distance!==Number.POSITIVE_INFINITY);)r(a).forEach(c);return s}function Yue(e,t,n){return e.nodes().reduce(function(r,s){return r[s]=Ym(e,s,t,n),r},{})}function h4(e){let t=0,n=[],r={},s=[];function i(a){let o=r[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(c){c in r?r[c].onStack&&(o.lowlink=Math.min(o.lowlink,r[c].index)):(i(c),o.lowlink=Math.min(o.lowlink,r[c].lowlink))}),o.lowlink===o.index){let c=[],u;do u=n.pop(),r[u].onStack=!1,c.push(u);while(a!==u);s.push(c)}}return e.nodes().forEach(function(a){a in r||i(a)}),s}function Wue(e){return h4(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var Gue=()=>1;function que(e,t,n){return Xue(e,t||Gue,n||function(r){return e.outEdges(r)})}function Xue(e,t,n){let r={},s=e.nodes();return s.forEach(function(i){r[i]={},r[i][i]={distance:0,predecessor:""},s.forEach(function(a){i!==a&&(r[i][a]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(i).forEach(function(a){let o=a.v===i?a.w:a.v,c=t(a);r[i][o]={distance:c,predecessor:i}})}),s.forEach(function(i){let a=r[i];s.forEach(function(o){let c=r[o];s.forEach(function(u){let d=c[i],f=a[u],h=c[u],p=d.distance+f.distance;p{var c;return(c=e.isDirected()?e.successors(o):e.neighbors(o))!=null?c:[]},a={};return t.forEach(function(o){if(!e.hasNode(o))throw new Error("Graph does not have node: "+o);s=m4(e,o,n==="post",a,i,r,s)}),s}function m4(e,t,n,r,s,i,a){return t in r||(r[t]=!0,n||(a=i(a,t)),s(t).forEach(function(o){a=m4(e,o,n,r,s,i,a)}),n&&(a=i(a,t))),a}function g4(e,t,n){return Zue(e,t,n,function(r,s){return r.push(s),r},[])}function Jue(e,t){return g4(e,t,"post")}function ede(e,t){return g4(e,t,"pre")}function tde(e,t){let n=new Cs,r={},s=new f4,i;function a(c){let u=c.v===i?c.w:c.v,d=s.priority(u);if(d!==void 0){let f=t(c);f0;){if(i=s.removeMin(),i in r)n.setEdge(i,r[i]);else{if(o)throw new Error("Input graph is not connected: "+e);o=!0}e.nodeEdges(i).forEach(a)}return n}function nde(e,t,n,r){return rde(e,t,n,r??(s=>{let i=e.outEdges(s);return i??[]}))}function rde(e,t,n,r){if(n===void 0)return Ym(e,t,n,r);let s=!1,i=e.nodes();for(let a=0;at.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},s=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+s.weight,minlen:Math.max(r.minlen,s.minlen)})}),t}function y4(e){let t=new Cs({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function gA(e,t){let n=e.x,r=e.y,s=t.x-n,i=t.y-r,a=e.width/2,o=e.height/2;if(!s&&!i)throw new Error("Not possible to find intersection inside of the rectangle");let c,u;return Math.abs(i)*a>Math.abs(s)*o?(i<0&&(o=-o),c=o*s/i,u=o):(s<0&&(a=-a),c=a,u=a*i/s),{x:n+c,y:r+u}}function $f(e){let t=df(E4(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),s=r.rank;s!==void 0&&(t[s]||(t[s]=[]),t[s][r.order]=n)}),t}function ide(e){let t=e.nodes().map(r=>{let s=e.node(r).rank;return s===void 0?Number.MAX_VALUE:s}),n=mi(Math.min,t);e.nodes().forEach(r=>{let s=e.node(r);Object.hasOwn(s,"rank")&&(s.rank-=n)})}function ade(e){let t=e.nodes().map(a=>e.node(a).rank).filter(a=>a!==void 0),n=mi(Math.min,t),r=[];e.nodes().forEach(a=>{let o=e.node(a).rank-n;r[o]||(r[o]=[]),r[o].push(a)});let s=0,i=e.graph().nodeRankFactor;Array.from(r).forEach((a,o)=>{a===void 0&&o%i!==0?--s:a!==void 0&&s&&a.forEach(c=>e.node(c).rank+=s)})}function yA(e,t,n,r){let s={width:0,height:0};return arguments.length>=4&&(s.rank=n,s.order=r),Jc(e,"border",s,t)}function ode(e,t=b4){let n=[];for(let r=0;rb4){let n=ode(t);return e(...n.map(r=>e(...r)))}else return e(...t)}function E4(e){let t=e.nodes().map(n=>{let r=e.node(n).rank;return r===void 0?Number.MIN_VALUE:r});return mi(Math.max,t)}function lde(e,t){let n={lhs:[],rhs:[]};return e.forEach(r=>{t(r)?n.lhs.push(r):n.rhs.push(r)}),n}function x4(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function w4(e,t){return t()}var cde=0;function Bv(e){let t=++cde;return e+(""+t)}function df(e,t,n=1){t==null&&(t=e,e=0);let r=i=>itr[t]:n=t,Object.entries(e).reduce((r,[s,i])=>(r[s]=n(i,s),r),{})}function ude(e,t){return e.reduce((n,r,s)=>(n[r]=t[s],n),{})}var a0="\0",dde="3.0.0",fde=class{constructor(){Lue(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return bA(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&bA(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,hde)),n=n._prev;return"["+e.join(", ")+"]"}};function bA(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function hde(e,t){if(e!=="_next"&&e!=="_prev")return t}var pde=fde,mde=()=>1;function gde(e,t){if(e.nodeCount()<=1)return[];let n=bde(e,t||mde);return yde(n.graph,n.buckets,n.zeroIdx).flatMap(r=>e.outEdges(r.v,r.w)||[])}function yde(e,t,n){var r;let s=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)Zy(e,t,n,o);for(;o=i.dequeue();)Zy(e,t,n,o);if(e.nodeCount()){for(let c=t.length-2;c>0;--c)if(o=(r=t[c])==null?void 0:r.dequeue(),o){s=s.concat(Zy(e,t,n,o,!0)||[]);break}}}return s}function Zy(e,t,n,r,s){let i=[],a=s?i:void 0;return(e.inEdges(r.v)||[]).forEach(o=>{let c=e.edge(o),u=e.node(o.v);s&&i.push({v:o.v,w:o.w}),u.out-=c,ME(t,n,u)}),(e.outEdges(r.v)||[]).forEach(o=>{let c=e.edge(o),u=o.w,d=e.node(u);d.in-=c,ME(t,n,d)}),e.removeNode(r.v),a}function bde(e,t){let n=new Cs,r=0,s=0;e.nodes().forEach(o=>{n.setNode(o,{v:o,in:0,out:0})}),e.edges().forEach(o=>{let c=n.edge(o.v,o.w)||0,u=t(o),d=c+u;n.setEdge(o.v,o.w,d);let f=n.node(o.v),h=n.node(o.w);s=Math.max(s,f.out+=u),r=Math.max(r,h.in+=u)});let i=Ede(s+r+3).map(()=>new pde),a=r+1;return n.nodes().forEach(o=>{ME(i,a,n.node(o))}),{graph:n,buckets:i,zeroIdx:a}}function ME(e,t,n){var r,s,i;n.out?n.in?(i=e[n.out-n.in+t])==null||i.enqueue(n):(s=e[e.length-1])==null||s.enqueue(n):(r=e[0])==null||r.enqueue(n)}function Ede(e){let t=[];for(let n=0;n{let r=e.edge(n);e.removeEdge(n),r.forwardName=n.name,r.reversed=!0,e.setEdge(n.w,n.v,r,Bv("rev"))});function t(n){return r=>n.edge(r).weight}}function wde(e){let t=[],n={},r={};function s(i){Object.hasOwn(r,i)||(r[i]=!0,n[i]=!0,e.outEdges(i).forEach(a=>{Object.hasOwn(n,a.w)?t.push(a):s(a.w)}),delete n[i])}return e.nodes().forEach(s),t}function vde(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function _de(e){e.graph().dummyChains=[],e.edges().forEach(t=>kde(e,t))}function kde(e,t){let n=t.v,r=e.node(n).rank,s=t.w,i=e.node(s).rank,a=t.name,o=e.edge(t),c=o.labelRank;if(i===r+1)return;e.removeEdge(t);let u,d,f;for(f=0,++r;r{let n=e.node(t),r=n.edgeLabel,s;for(e.setEdge(n.edgeObj,r);n.dummy;)s=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=s,n=e.node(t)})}function Fv(e){let t={};function n(r){let s=e.node(r);if(Object.hasOwn(t,r))return s.rank;t[r]=!0;let i=e.outEdges(r),a=i?i.map(c=>c==null?Number.POSITIVE_INFINITY:n(c.w)-e.edge(c).minlen):[],o=mi(Math.min,a);return o===Number.POSITIVE_INFINITY&&(o=0),s.rank=o}e.sources().forEach(n)}function Pc(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var v4=Sde;function Sde(e){let t=new Cs({directed:!1}),n=e.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let r=n[0],s=e.nodeCount();t.setNode(r,{});let i,a;for(;Tde(t,e){let a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!Pc(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return e.nodes().forEach(n),e.nodeCount()}function Ade(e,t){return t.edges().reduce((n,r)=>{let s=Number.POSITIVE_INFINITY;return e.hasNode(r.v)!==e.hasNode(r.w)&&(s=Pc(t,r)),st.node(r).rank+=n)}var{preorder:Ide,postorder:Ode}=Pv,Rde=Jo;Jo.initLowLimValues=$v;Jo.initCutValues=Uv;Jo.calcCutValue=_4;Jo.leaveEdge=N4;Jo.enterEdge=S4;Jo.exchangeEdges=T4;function Jo(e){e=sde(e),Fv(e);let t=v4(e);$v(t),Uv(t,e);let n,r;for(;n=N4(t);)r=S4(t,e,n),T4(t,e,n,r)}function Uv(e,t){let n=Ode(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(r=>Lde(e,t,r))}function Lde(e,t,n){let r=e.node(n).parent,s=e.edge(n,r);s.cutvalue=_4(e,t,n)}function _4(e,t,n){let r=e.node(n).parent,s=!0,i=t.edge(n,r),a=0;i||(s=!1,i=t.edge(r,n)),a=i.weight;let o=t.nodeEdges(n);return o&&o.forEach(c=>{let u=c.v===n,d=u?c.w:c.v;if(d!==r){let f=u===s,h=t.edge(c).weight;if(a+=f?h:-h,jde(e,n,d)){let p=e.edge(n,d).cutvalue;a+=f?-p:p}}}),a}function $v(e,t){arguments.length<2&&(t=e.nodes()[0]),k4(e,{},1,t)}function k4(e,t,n,r,s){let i=n,a=e.node(r);t[r]=!0;let o=e.neighbors(r);return o&&o.forEach(c=>{Object.hasOwn(t,c)||(n=k4(e,t,n,c,r))}),a.low=i,a.lim=n++,s?a.parent=s:delete a.parent,n}function N4(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function S4(e,t,n){let r=n.v,s=n.w;t.hasEdge(r,s)||(r=n.w,s=n.v);let i=e.node(r),a=e.node(s),o=i,c=!1;return i.lim>a.lim&&(o=a,c=!0),t.edges().filter(u=>c===EA(e,e.node(u.v),o)&&c!==EA(e,e.node(u.w),o)).reduce((u,d)=>Pc(t,d)!e.node(s).parent);if(!n)return;let r=Ide(e,[n]);r=r.slice(1),r.forEach(s=>{let i=e.node(s).parent,a=t.edge(s,i),o=!1;a||(a=t.edge(i,s),o=!0),t.node(s).rank=t.node(i).rank+(o?a.minlen:-a.minlen)})}function jde(e,t,n){return e.hasEdge(t,n)}function EA(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var Dde=Pde;function Pde(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":xA(e);break;case"tight-tree":Fde(e);break;case"longest-path":Bde(e);break;case"none":break;default:xA(e)}}var Bde=Fv;function Fde(e){Fv(e),v4(e)}function xA(e){Rde(e)}var Ude=$de;function $de(e){let t=zde(e);e.graph().dummyChains.forEach(n=>{let r=e.node(n),s=r.edgeObj,i=Hde(e,t,s.v,s.w),a=i.path,o=i.lca,c=0,u=a[c],d=!0;for(;n!==s.w;){if(r=e.node(n),d){for(;(u=a[c])!==o&&e.node(u).maxRanka||o>t[c].lim));let u=c,d=r;for(;(d=e.parent(d))!==u;)i.push(d);return{path:s.concat(i.reverse()),lca:u}}function zde(e){let t={},n=0;function r(s){let i=n;e.children(s).forEach(r),t[s]={low:i,lim:n++}}return e.children(a0).forEach(r),t}function Vde(e){let t=Jc(e,"root",{},"_root"),n=Kde(e),r=Object.values(n),s=mi(Math.max,r)-1,i=2*s+1;e.graph().nestingRoot=t,e.edges().forEach(o=>e.edge(o).minlen*=i);let a=Yde(e)+1;e.children(a0).forEach(o=>A4(e,t,i,a,s,n,o)),e.graph().nodeRankFactor=i}function A4(e,t,n,r,s,i,a){var o;let c=e.children(a);if(!c.length){a!==t&&e.setEdge(t,a,{weight:0,minlen:n});return}let u=yA(e,"_bt"),d=yA(e,"_bb"),f=e.node(a);e.setParent(u,a),f.borderTop=u,e.setParent(d,a),f.borderBottom=d,c.forEach(h=>{var p;A4(e,t,n,r,s,i,h);let m=e.node(h),y=m.borderTop?m.borderTop:h,E=m.borderBottom?m.borderBottom:h,g=m.borderTop?r:2*r,x=y!==E?1:s-((p=i[a])!=null?p:0)+1;e.setEdge(u,y,{weight:g,minlen:x,nestingEdge:!0}),e.setEdge(E,d,{weight:g,minlen:x,nestingEdge:!0})}),e.parent(a)||e.setEdge(t,u,{weight:0,minlen:s+((o=i[a])!=null?o:0)})}function Kde(e){let t={};function n(r,s){let i=e.children(r);i&&i.length&&i.forEach(a=>n(a,s+1)),t[r]=s}return e.children(a0).forEach(r=>n(r,1)),t}function Yde(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function Wde(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var Gde=qde;function qde(e){function t(n){let r=e.children(n),s=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(s,"minRank")){s.borderLeft=[],s.borderRight=[];for(let i=s.minRank,a=s.maxRank+1;ivA(e.node(t))),e.edges().forEach(t=>vA(e.edge(t)))}function vA(e){let t=e.width;e.width=e.height,e.height=t}function Zde(e){e.nodes().forEach(t=>Jy(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(Jy),Object.hasOwn(r,"y")&&Jy(r)})}function Jy(e){e.y=-e.y}function Jde(e){e.nodes().forEach(t=>eb(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(eb),Object.hasOwn(r,"x")&&eb(r)})}function eb(e){let t=e.x;e.x=e.y,e.y=t}function efe(e){let t={},n=e.nodes().filter(o=>!e.children(o).length),r=n.map(o=>e.node(o).rank),s=mi(Math.max,r),i=df(s+1).map(()=>[]);function a(o){if(t[o])return;t[o]=!0;let c=e.node(o);i[c.rank].push(o);let u=e.successors(o);u&&u.forEach(a)}return n.sort((o,c)=>e.node(o).rank-e.node(c).rank).forEach(a),i}function tfe(e,t){let n=0;for(let r=1;rd)),s=t.flatMap(u=>{let d=e.outEdges(u);return d?d.map(f=>({pos:r[f.w],weight:e.edge(f).weight})).sort((f,h)=>f.pos-h.pos):[]}),i=1;for(;i{let d=u.pos+i;o[d]+=u.weight;let f=0;for(;d>0;)d%2&&(f+=o[d+1]),d=d-1>>1,o[d]+=u.weight;c+=u.weight*f}),c}function rfe(e,t=[]){return t.map(n=>{let r=e.inEdges(n);if(!r||!r.length)return{v:n};{let s=r.reduce((i,a)=>{let o=e.edge(a),c=e.node(a.v);return{sum:i.sum+o.weight*c.order,weight:i.weight+o.weight}},{sum:0,weight:0});return{v:n,barycenter:s.sum/s.weight,weight:s.weight}}})}function sfe(e,t){let n={};e.forEach((s,i)=>{let a={indegree:0,in:[],out:[],vs:[s.v],i};s.barycenter!==void 0&&(a.barycenter=s.barycenter,a.weight=s.weight),n[s.v]=a}),t.edges().forEach(s=>{let i=n[s.v],a=n[s.w];i!==void 0&&a!==void 0&&(a.indegree++,i.out.push(a))});let r=Object.values(n).filter(s=>!s.indegree);return ife(r)}function ife(e){let t=[];function n(s){return i=>{i.merged||(i.barycenter===void 0||s.barycenter===void 0||i.barycenter>=s.barycenter)&&afe(s,i)}}function r(s){return i=>{i.in.push(s),--i.indegree===0&&e.push(i)}}for(;e.length;){let s=e.pop();t.push(s),s.in.reverse().forEach(n(s)),s.out.forEach(r(s))}return t.filter(s=>!s.merged).map(s=>Gm(s,["vs","i","barycenter","weight"]))}function afe(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function ofe(e,t){let n=lde(e,d=>Object.hasOwn(d,"barycenter")),r=n.lhs,s=n.rhs.sort((d,f)=>f.i-d.i),i=[],a=0,o=0,c=0;r.sort(lfe(!!t)),c=_A(i,s,c),r.forEach(d=>{c+=d.vs.length,i.push(d.vs),a+=d.barycenter*d.weight,o+=d.weight,c=_A(i,s,c)});let u={vs:i.flat(1)};return o&&(u.barycenter=a/o,u.weight=o),u}function _A(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function lfe(e){return(t,n)=>t.barycentern.barycenter?1:e?n.i-t.i:t.i-n.i}function I4(e,t,n,r){let s=e.children(t),i=e.node(t),a=i?i.borderLeft:void 0,o=i?i.borderRight:void 0,c={};a&&(s=s.filter(h=>h!==a&&h!==o));let u=rfe(e,s);u.forEach(h=>{if(e.children(h.v).length){let p=I4(e,h.v,n,r);c[h.v]=p,Object.hasOwn(p,"barycenter")&&ufe(h,p)}});let d=sfe(u,n);cfe(d,c);let f=ofe(d,r);if(a&&o){f.vs=[a,f.vs,o].flat(1);let h=e.predecessors(a);if(h&&h.length){let p=e.node(h[0]),m=e.predecessors(o),y=e.node(m[0]);Object.hasOwn(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+p.order+y.order)/(f.weight+2),f.weight+=2}}return f}function cfe(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(r=>t[r]?t[r].vs:r)})}function ufe(e,t){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight):(e.barycenter=t.barycenter,e.weight=t.weight)}function dfe(e,t,n,r){r||(r=e.nodes());let s=ffe(e),i=new Cs({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(a=>e.node(a));return r.forEach(a=>{let o=e.node(a),c=e.parent(a);if(o.rank===t||o.minRank<=t&&t<=o.maxRank){i.setNode(a),i.setParent(a,c||s);let u=e[n](a);u&&u.forEach(d=>{let f=d.v===a?d.w:d.v,h=i.edge(f,a),p=h!==void 0?h.weight:0;i.setEdge(f,a,{weight:e.edge(d).weight+p})}),Object.hasOwn(o,"minRank")&&i.setNode(a,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]})}}),i}function ffe(e){let t;for(;e.hasNode(t=Bv("_root")););return t}function hfe(e,t,n){let r={},s;n.forEach(i=>{let a=e.parent(i),o,c;for(;a;){if(o=e.parent(a),o?(c=r[o],r[o]=a):(c=s,s=a),c&&c!==a){t.setEdge(c,a);return}a=o}})}function O4(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,O4);return}let n=E4(e),r=kA(e,df(1,n+1),"inEdges"),s=kA(e,df(n-1,-1,-1),"outEdges"),i=efe(e);if(NA(e,i),t.disableOptimalOrderHeuristic)return;let a=Number.POSITIVE_INFINITY,o,c=t.constraints||[];for(let u=0,d=0;d<4;++u,++d){pfe(u%2?r:s,u%4>=2,c),i=$f(e);let f=tfe(e,i);f{r.has(i)||r.set(i,[]),r.get(i).push(a)};for(let i of e.nodes()){let a=e.node(i);if(typeof a.rank=="number"&&s(a.rank,i),typeof a.minRank=="number"&&typeof a.maxRank=="number")for(let o=a.minRank;o<=a.maxRank;o++)o!==a.rank&&s(o,i)}return t.map(function(i){return dfe(e,i,n,r.get(i)||[])})}function pfe(e,t,n){let r=new Cs;e.forEach(function(s){n.forEach(o=>r.setEdge(o.left,o.right));let i=s.graph().root,a=I4(s,i,r,t);a.vs.forEach((o,c)=>s.node(o).order=c),hfe(s,r,a.vs)})}function NA(e,t){Object.values(t).forEach(n=>n.forEach((r,s)=>e.node(r).order=s))}function mfe(e,t){let n={};function r(s,i){let a=0,o=0,c=s.length,u=i[i.length-1];return i.forEach((d,f)=>{let h=yfe(e,d),p=h?e.node(h).order:c;(h||d===u)&&(i.slice(o,f+1).forEach(m=>{let y=e.predecessors(m);y&&y.forEach(E=>{let g=e.node(E),x=g.order;(x{let f=i[d];if(f!==void 0&&e.node(f).dummy){let h=e.predecessors(f);h&&h.forEach(p=>{if(p===void 0)return;let m=e.node(p);m.dummy&&(m.orderu)&&R4(n,p,f)})}})}function s(i,a){let o=-1,c=-1,u=0;return a.forEach((d,f)=>{if(e.node(d).dummy==="border"){let h=e.predecessors(d);if(h&&h.length){let p=h[0];if(p===void 0)return;c=e.node(p).order,r(a,u,f,o,c),u=f,o=c}}r(a,u,a.length,c,i.length)}),a}return t.length&&t.reduce(s),n}function yfe(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(r=>e.node(r).dummy)}}function R4(e,t,n){if(t>n){let s=t;t=n,n=s}let r=e[t];r||(e[t]=r={}),r[n]=!0}function bfe(e,t,n){if(t>n){let s=t;t=n,n=s}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function Efe(e,t,n,r){let s={},i={},a={};return t.forEach(o=>{o.forEach((c,u)=>{s[c]=c,i[c]=c,a[c]=u})}),t.forEach(o=>{let c=-1;o.forEach(u=>{let d=r(u);if(d&&d.length){let f=d.sort((p,m)=>{let y=a[p],E=a[m];return(y!==void 0?y:0)-(E!==void 0?E:0)}),h=(f.length-1)/2;for(let p=Math.floor(h),m=Math.ceil(h);p<=m;++p){let y=f[p];if(y===void 0)continue;let E=a[y];if(E!==void 0&&i[u]===u&&c{var g;let x=(g=i[E.v])!=null?g:0,b=a.edge(E);return Math.max(y,x+(b!==void 0?b:0))},0):i[p]=0}function d(p){let m=a.outEdges(p),y=Number.POSITIVE_INFINITY;m&&(y=m.reduce((g,x)=>{let b=i[x.w],_=a.edge(x);return Math.min(g,(b!==void 0?b:0)-(_!==void 0?_:0))},Number.POSITIVE_INFINITY));let E=e.node(p);y!==Number.POSITIVE_INFINITY&&E.borderType!==o&&(i[p]=Math.max(i[p]!==void 0?i[p]:0,y))}function f(p){return a.predecessors(p)||[]}function h(p){return a.successors(p)||[]}return c(u,f),c(d,h),Object.keys(r).forEach(p=>{var m;let y=n[p];y!==void 0&&(i[p]=(m=i[y])!=null?m:0)}),i}function wfe(e,t,n,r){let s=new Cs,i=e.graph(),a=Sfe(i.nodesep,i.edgesep,r);return t.forEach(o=>{let c;o.forEach(u=>{let d=n[u];if(d!==void 0){if(s.setNode(d),c!==void 0){let f=n[c];if(f!==void 0){let h=s.edge(f,d);s.setEdge(f,d,Math.max(a(e,u,c),h||0))}}c=u}})}),s}function vfe(e,t){return Object.values(t).reduce((n,r)=>{let s=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;Object.entries(r).forEach(([o,c])=>{let u=Tfe(e,o)/2;s=Math.max(c+u,s),i=Math.min(c-u,i)});let a=s-i;return a{["l","r"].forEach(a=>{let o=i+a,c=e[o];if(!c||c===t)return;let u=Object.values(c),d=r-mi(Math.min,u);a!=="l"&&(d=s-mi(Math.max,u)),d&&(e[o]=i0(c,f=>f+d))})})}function kfe(e,t=void 0){let n=e.ul;return n?i0(n,(r,s)=>{var i,a;if(t){let c=t.toLowerCase(),u=e[c];if(u&&u[s]!==void 0)return u[s]}let o=Object.values(e).map(c=>{let u=c[s];return u!==void 0?u:0}).sort((c,u)=>c-u);return(((i=o[1])!=null?i:0)+((a=o[2])!=null?a:0))/2}):{}}function Nfe(e){let t=$f(e),n=Object.assign(mfe(e,t),gfe(e,t)),r={},s;["u","d"].forEach(a=>{s=a==="u"?t:Object.values(t).reverse(),["l","r"].forEach(o=>{o==="r"&&(s=s.map(d=>Object.values(d).reverse()));let c=Efe(e,s,n,d=>(a==="u"?e.predecessors(d):e.successors(d))||[]),u=xfe(e,s,c.root,c.align,o==="r");o==="r"&&(u=i0(u,d=>-d)),r[a+o]=u})});let i=vfe(e,r);return _fe(r,i),kfe(r,e.graph().align)}function Sfe(e,t,n){return(r,s,i)=>{let a=r.node(s),o=r.node(i),c=0,u;if(c+=a.width/2,Object.hasOwn(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":u=-a.width/2;break;case"r":u=a.width/2;break}if(u&&(c+=n?u:-u),u=void 0,c+=(a.dummy?t:e)/2,c+=(o.dummy?t:e)/2,c+=o.width/2,Object.hasOwn(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":u=o.width/2;break;case"r":u=-o.width/2;break}return u&&(c+=n?u:-u),c}}function Tfe(e,t){return e.node(t).width}function Afe(e){e=y4(e),Cfe(e),Object.entries(Nfe(e)).forEach(([t,n])=>e.node(t).x=n)}function Cfe(e){let t=$f(e),n=e.graph(),r=n.ranksep,s=n.rankalign,i=0;t.forEach(a=>{let o=a.reduce((c,u)=>{var d;let f=(d=e.node(u).height)!=null?d:0;return c>f?c:f},0);a.forEach(c=>{let u=e.node(c);s==="top"?u.y=i+u.height/2:s==="bottom"?u.y=i+o-u.height/2:u.y=i+o/2}),i+=o+r})}function Ife(e,t={}){let n=t.debugTiming?x4:w4;return n("layout",()=>{let r=n(" buildLayoutGraph",()=>Ufe(e));return n(" runLayout",()=>Ofe(r,n,t)),n(" updateInputGraph",()=>Rfe(e,r)),r})}function Ofe(e,t,n){t(" makeSpaceForEdgeLabels",()=>$fe(e)),t(" removeSelfEdges",()=>Xfe(e)),t(" acyclic",()=>xde(e)),t(" nestingGraph.run",()=>Vde(e)),t(" rank",()=>Dde(y4(e))),t(" injectEdgeLabelProxies",()=>Hfe(e)),t(" removeEmptyRanks",()=>ade(e)),t(" nestingGraph.cleanup",()=>Wde(e)),t(" normalizeRanks",()=>ide(e)),t(" assignRankMinMax",()=>zfe(e)),t(" removeEdgeLabelProxies",()=>Vfe(e)),t(" normalize.run",()=>_de(e)),t(" parentDummyChains",()=>Ude(e)),t(" addBorderSegments",()=>Gde(e)),t(" order",()=>O4(e,n)),t(" insertSelfEdges",()=>Qfe(e)),t(" adjustCoordinateSystem",()=>Xde(e)),t(" position",()=>Afe(e)),t(" positionSelfEdges",()=>Zfe(e)),t(" removeBorderNodes",()=>qfe(e)),t(" normalize.undo",()=>Nde(e)),t(" fixupEdgeLabelCoords",()=>Wfe(e)),t(" undoCoordinateSystem",()=>Qde(e)),t(" translateGraph",()=>Kfe(e)),t(" assignNodeIntersects",()=>Yfe(e)),t(" reversePoints",()=>Gfe(e)),t(" acyclic.undo",()=>vde(e))}function Rfe(e,t){e.nodes().forEach(n=>{let r=e.node(n),s=t.node(n);r&&(r.x=s.x,r.y=s.y,r.order=s.order,r.rank=s.rank,t.children(n).length&&(r.width=s.width,r.height=s.height))}),e.edges().forEach(n=>{let r=e.edge(n),s=t.edge(n);r.points=s.points,Object.hasOwn(s,"x")&&(r.x=s.x,r.y=s.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var Lfe=["nodesep","edgesep","ranksep","marginx","marginy"],Mfe={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},jfe=["acyclicer","ranker","rankdir","align","rankalign"],Dfe=["width","height","rank"],SA={width:0,height:0},Pfe=["minlen","weight","width","height","labeloffset"],Bfe={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Ffe=["labelpos"];function Ufe(e){let t=new Cs({multigraph:!0,compound:!0}),n=nb(e.graph());return t.setGraph(Object.assign({},Mfe,tb(n,Lfe),Gm(n,jfe))),e.nodes().forEach(r=>{let s=nb(e.node(r)),i=tb(s,Dfe);Object.keys(SA).forEach(o=>{i[o]===void 0&&(i[o]=SA[o])}),t.setNode(r,i);let a=e.parent(r);a!==void 0&&t.setParent(r,a)}),e.edges().forEach(r=>{let s=nb(e.edge(r));t.setEdge(r,Object.assign({},Bfe,tb(s,Pfe),Gm(s,Ffe)))}),t}function $fe(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function Hfe(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let r=e.node(t.v),s={rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t};Jc(e,"edge-proxy",s,"_ep")}})}function zfe(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function Vfe(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="edge-proxy"){let r=n;e.edge(r.e).labelRank=n.rank,e.removeNode(t)}})}function Kfe(e){let t=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,s=0,i=e.graph(),a=i.marginx||0,o=i.marginy||0;function c(u){let d=u.x,f=u.y,h=u.width,p=u.height;t=Math.min(t,d-h/2),n=Math.max(n,d+h/2),r=Math.min(r,f-p/2),s=Math.max(s,f+p/2)}e.nodes().forEach(u=>c(e.node(u))),e.edges().forEach(u=>{let d=e.edge(u);Object.hasOwn(d,"x")&&c(d)}),t-=a,r-=o,e.nodes().forEach(u=>{let d=e.node(u);d.x-=t,d.y-=r}),e.edges().forEach(u=>{let d=e.edge(u);d.points.forEach(f=>{f.x-=t,f.y-=r}),Object.hasOwn(d,"x")&&(d.x-=t),Object.hasOwn(d,"y")&&(d.y-=r)}),i.width=n-t+a,i.height=s-r+o}function Yfe(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),s=e.node(t.w),i,a;n.points?(i=n.points[0],a=n.points[n.points.length-1]):(n.points=[],i=s,a=r),n.points.unshift(gA(r,i)),n.points.push(gA(s,a))})}function Wfe(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function Gfe(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function qfe(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),s=e.node(n.borderBottom),i=e.node(n.borderLeft[n.borderLeft.length-1]),a=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(a.x-i.x),n.height=Math.abs(s.y-r.y),n.x=i.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function Xfe(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function Qfe(e){$f(e).forEach(t=>{let n=0;t.forEach((r,s)=>{let i=e.node(r);i.order=s+n,(i.selfEdges||[]).forEach(a=>{Jc(e,"selfedge",{width:a.label.width,height:a.label.height,rank:i.rank,order:s+ ++n,e:a.e,label:a.label},"_se")}),delete i.selfEdges})})}function Zfe(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="selfedge"){let r=n,s=e.node(r.e.v),i=s.x+s.width/2,a=s.y,o=n.x-i,c=s.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:i+2*o/3,y:a-c},{x:i+5*o/6,y:a-c},{x:i+o,y:a},{x:i+5*o/6,y:a+c},{x:i+2*o/3,y:a+c}],r.label.x=n.x,r.label.y=n.y}})}function tb(e,t){return i0(Gm(e,t),Number)}function nb(e){let t={};return e&&Object.entries(e).forEach(([n,r])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=r}),t}function Jfe(e){let t=$f(e),n=new Cs({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(r=>{n.setNode(r,{label:r}),n.setParent(r,"layer"+e.node(r).rank)}),e.edges().forEach(r=>n.setEdge(r.v,r.w,{},r.name)),t.forEach((r,s)=>{let i="layer"+s;n.setNode(i,{rank:"same"}),r.reduce((a,o)=>(n.setEdge(a,o,{style:"invis"}),o))}),n}var ehe={graphlib:l4,version:dde,layout:Ife,debug:Jfe,util:{time:x4,notime:w4}},TA=ehe;/*! For license information please see dagre.esm.js.LEGAL.txt */const zl={llm:{label:"智能体",description:"理解任务并直接完成一个具体工作",icon:Do},sequential:{label:"分步协作",description:"内部步骤按照顺序依次执行",icon:CL},parallel:{label:"同时处理",description:"内部步骤同时工作,完成后统一汇总",icon:bL},loop:{label:"循环执行",description:"重复执行内部步骤,直到满足停止条件",icon:Rw},a2a:{label:"远程智能体",description:"调用已经存在的远程 Agent",icon:Cg}},jE=220,DE=88,AA=96,CA=34,qm=64,IA=310,Vl=24,L4=56,PE=40,OA=40,the=18,nhe=58,rhe=!1,she=e=>e==="sequential"||e==="parallel"||e==="loop";function BE(e,t){const n=e.agentType??"llm";return she(n)||n==="llm"&&(t.length===0||e.subAgents.length>0)}function FE(e,t=[],n="horizontal"){const r=e.agentType??"llm";if(!BE(e,t))return{width:jE,height:DE};const s=e.subAgents.map((d,f)=>FE(d,[...t,f],n)),i=s.length?Math.max(...s.map(d=>d.width)):0,a=s.length?Math.max(...s.map(d=>d.height)):0,o=s.length&&r!=="parallel"?L4:Vl,c=n==="horizontal"?r!=="parallel":r==="parallel",u=s.length?r==="parallel"?the+OA:r==="loop"?nhe:0:OA;return c?{width:Math.max(IA,s.reduce((d,f)=>d+f.width,0)+PE*Math.max(0,s.length-1)+o*2),height:qm+Vl+a+u+Vl}:{width:Math.max(IA,i+Vl*2),height:qm+o+s.reduce((d,f)=>d+f.height,0)+PE*Math.max(0,s.length-1)+u+o}}function Su(e){return e.length===0?"agent-root":`agent-${e.join("-")}`}function ihe(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function RA(e){const t=n=>[n.agentType??"llm",n.subAgents.map(t)];return JSON.stringify(t(e))}function Tu(e,t,n,r){const s=(r==null?void 0:r.tone)==="sequential"?"hsl(213 40% 40%)":(r==null?void 0:r.tone)==="loop"?"hsl(151 34% 34%)":"hsl(220 9% 38%)";return{id:`${e}-${t}${r!=null&&r.loop?"-loop":""}`,source:e,target:t,sourceHandle:r!=null&&r.loop?"loop-source":void 0,targetHandle:r!=null&&r.loop?"loop-target":void 0,label:n,type:"insertStep",data:r?{insert:r.insert,loop:r.loop,tone:r.tone}:void 0,animated:r==null?void 0:r.loop,markerEnd:{type:Oc.ArrowClosed,width:16,height:16,color:s},style:{stroke:s,strokeWidth:1.5},labelStyle:{fill:"hsl(215 14% 42%)",fontSize:10,fontWeight:600},labelBgStyle:{fill:"hsl(var(--background))",fillOpacity:.92}}}function LA(e,t){const n=[{id:"terminal-input",type:"terminal",position:{x:0,y:0},data:{kind:"terminal",title:"用户请求"},selectable:!1,draggable:!1},{id:"terminal-output",type:"terminal",position:{x:0,y:0},data:{kind:"terminal",title:"最终回复"},selectable:!1,draggable:!1}],r=[];function s(u,d,f,h,p){const m=u.agentType??"llm",y=Su(d);return BE(u,d)?(i(u,d,f,h,p),y):(n.push({id:y,type:"agent",parentId:f,extent:"parent",position:h,data:{kind:"agent",path:d,agent:u,title:m==="a2a"?"远程智能体":u.name.trim()||(d.length===0?"主 Agent":"未命名步骤"),pattern:m,description:u.description.trim()||zl[m].description,childCount:u.subAgents.length,containedIn:p}}),y)}function i(u,d,f,h={x:0,y:0},p){const m=u.agentType??"sequential",y=Su(d),E=FE(u,d,t);n.push({id:y,type:"group",parentId:f,extent:f?"parent":void 0,position:h,style:{width:E.width,height:E.height},data:{kind:"agent",path:d,agent:u,title:u.name.trim()||(d.length===0?"主 Agent":zl[m].label),pattern:m,description:zl[m].description,childCount:u.subAgents.length,containedIn:p,layoutWidth:E.width,layoutHeight:E.height}});const g=u.subAgents.map((N,C)=>FE(N,[...d,C],t)),x=g.length&&m!=="parallel"?L4:Vl,b=t==="horizontal"?m!=="parallel":m==="parallel";let _=x;const k=u.subAgents.map((N,C)=>{const S=g[C],A=b?{x:_,y:qm+Vl}:{x:(E.width-S.width)/2,y:qm+_};return _+=(b?S.width:S.height)+PE,s(N,[...d,C],y,A,m)});if(m==="sequential"||m==="loop"){for(let N=0;N1&&r.push(Tu(k[k.length-1],k[0],"继续循环",{loop:!0,tone:"loop"}))}return y}const a=(u,d)=>{const f=u.agentType??"llm",h=Su(d);if(BE(u,d))return i(u,d),[h];if(n.push({id:h,type:"agent",position:{x:0,y:0},data:{kind:"agent",path:d,agent:u,title:f==="a2a"?"远程智能体":u.name.trim()||(d.length===0?"主 Agent":"未命名步骤"),pattern:f,description:u.description.trim()||zl[f].description,childCount:u.subAgents.length}}),u.subAgents.length===0)return[h];const p=[];return u.subAgents.forEach((m,y)=>{const E=[...d,y],g=Su(E);r.push(Tu(h,g,"调用",{insert:{parentPath:d,index:y}})),p.push(...a(m,E))}),p},o=Su([]),c=a(e,[]);return r.push(Tu("terminal-input",o)),c.forEach(u=>r.push(Tu(u,"terminal-output"))),ahe(n,r,t)}function ahe(e,t,n){const r=new TA.graphlib.Graph().setDefaultEdgeLabel(()=>({}));r.setGraph({rankdir:n==="vertical"?"TB":"LR",ranksep:50,nodesep:34,edgesep:14,marginx:24,marginy:24});const s=new Set(e.filter(i=>!i.parentId).map(i=>i.id));return e.filter(i=>!i.parentId).forEach(i=>{const a=i.data.kind==="terminal";r.setNode(i.id,{width:a?AA:i.data.layoutWidth??jE,height:a?CA:i.data.layoutHeight??DE})}),t.filter(i=>s.has(i.source)&&s.has(i.target)).forEach(i=>r.setEdge(i.source,i.target)),TA.layout(r),{nodes:e.map(i=>{if(i.parentId)return i;const a=r.node(i.id),o=i.data.kind==="terminal",c=o?AA:i.data.layoutWidth??jE,u=o?CA:i.data.layoutHeight??DE;return{...i,position:{x:a.x-c/2,y:a.y-u/2}}}),edges:t}}const o0=w.createContext(null),l0=w.createContext("horizontal");function ohe({id:e,sourceX:t,sourceY:n,targetX:r,targetY:s,sourcePosition:i,targetPosition:a,markerEnd:o,style:c,label:u,data:d}){const f=w.useContext(o0),[h,p]=w.useState(!1),[m,y,E]=Vm({sourceX:t,sourceY:n,targetX:r,targetY:s,sourcePosition:i,targetPosition:a,offset:d!=null&&d.loop?28:20});return l.jsxs(l.Fragment,{children:[l.jsx(Uf,{id:e,path:m,markerEnd:o,style:c}),f&&(d==null?void 0:d.insert)&&l.jsx("path",{d:m,className:"abc-edge-hover-path",onPointerEnter:()=>p(!0),onPointerLeave:()=>p(!1)}),(u||f&&(d==null?void 0:d.insert))&&l.jsx(nue,{children:l.jsxs("div",{className:`abc-edge-tools${f&&(d!=null&&d.insert)?" can-insert":""}${h?" is-visible":""}`,style:{transform:`translate(-50%, -50%) translate(${y}px, ${E}px)`},onPointerEnter:()=>p(!0),onPointerLeave:()=>p(!1),children:[u&&l.jsx("span",{className:"abc-edge-label",children:u}),f&&(d==null?void 0:d.insert)&&l.jsx("button",{type:"button",className:"abc-edge-add nodrag nopan","aria-label":"在这里插入步骤",title:"在这里插入步骤",onClick:g=>{g.stopPropagation(),f==null||f.onInsert(d.insert.parentPath,d.insert.index)},children:l.jsx(rr,{})})]})})]})}function lhe({data:e,selected:t}){const n=w.useContext(o0),r=w.useContext(l0),s=r==="vertical"?Pe.Top:Pe.Left,i=r==="vertical"?Pe.Bottom:Pe.Right,a=r==="vertical"?Pe.Right:Pe.Bottom,o=e.pattern??"llm",c=zl[o],u=c.icon;return l.jsxs("div",{className:`abc-node is-${o}${e.containedIn?` is-contained-in-${e.containedIn}`:""}${t?" is-selected":""}`,children:[l.jsx(mr,{type:"target",position:s,className:"abc-handle"}),o!=="llm"&&l.jsx("span",{className:"abc-node-icon",children:l.jsx(u,{})}),l.jsxs("span",{className:"abc-node-copy",children:[l.jsxs("span",{className:"abc-node-meta",children:[l.jsx("span",{children:c.label}),!!e.childCount&&l.jsxs("small",{children:[e.childCount," 个步骤"]})]}),l.jsx("strong",{children:e.title}),l.jsx("small",{children:e.description})]}),n&&e.path!==void 0&&e.path.length>0&&l.jsx("button",{type:"button",className:"abc-node-delete nodrag nopan","aria-label":`删除 ${e.title}`,title:"删除节点",onClick:d=>{d.stopPropagation(),n==null||n.onDelete(e.path)},children:l.jsx(ea,{})}),l.jsx(mr,{type:"source",position:i,className:"abc-handle"}),e.containedIn==="loop"&&l.jsxs(l.Fragment,{children:[l.jsx(mr,{id:"loop-target",type:"target",position:a,className:"abc-handle abc-loop-handle"}),l.jsx(mr,{id:"loop-source",type:"source",position:a,className:"abc-handle abc-loop-handle"})]})]})}function che({data:e,selected:t}){const n=w.useContext(o0),r=w.useContext(l0),s=r==="vertical"?Pe.Top:Pe.Left,i=r==="vertical"?Pe.Bottom:Pe.Right,a=r==="vertical"?Pe.Right:Pe.Bottom,o=e.pattern??"sequential",c=zl[o],u=o==="llm"?"子 Agent":"步骤",d=e.childCount??0,f=o==="llm"?"添加子 Agent":o==="parallel"?"添加一个同时处理的步骤":o==="loop"?"添加循环步骤":"添加下一个步骤";return l.jsxs("div",{className:`abc-group is-${o}${t?" is-selected":""}`,children:[l.jsx(mr,{type:"target",position:s,className:"abc-handle"}),l.jsxs("header",{className:"abc-group-head",children:[l.jsxs("span",{children:[l.jsx("strong",{title:e.title,children:e.title}),l.jsx("small",{children:o==="llm"?"智能体 · 可根据任务调用框内子 Agent":o==="parallel"?`${c.label} · 框内步骤同时开始,全部完成后再继续`:`${c.label} · ${c.description}`})]}),l.jsxs("em",{children:[d," 个",u]})]}),n&&e.path!==void 0&&d>0&&o!=="parallel"&&l.jsxs("div",{className:"abc-group-boundary-actions",children:[l.jsx("button",{type:"button",className:"abc-group-boundary-add is-start nodrag nopan","aria-label":"添加到最前",title:"添加到最前",onClick:h=>{h.stopPropagation(),n.onInsert(e.path,0)},children:l.jsx(rr,{})}),l.jsx("button",{type:"button",className:"abc-group-boundary-add is-end nodrag nopan","aria-label":"添加到最后",title:"添加到最后",onClick:h=>{h.stopPropagation(),n.onAdd(e.path)},children:l.jsx(rr,{})})]}),n&&e.path!==void 0&&d>0&&o==="parallel"&&l.jsxs("button",{type:"button",className:"abc-group-add abc-group-add-bottom nodrag nopan",onClick:h=>{h.stopPropagation(),n.onAdd(e.path)},children:[l.jsx(rr,{}),l.jsx("span",{children:f})]}),n&&e.path!==void 0&&d===0&&l.jsxs("button",{type:"button",className:"abc-group-add abc-group-add-empty nodrag nopan",onClick:h=>{h.stopPropagation(),n.onAdd(e.path)},children:[l.jsx(rr,{}),l.jsx("span",{children:f})]}),n&&e.path!==void 0&&e.path.length>0&&l.jsx("button",{type:"button",className:"abc-node-delete nodrag nopan","aria-label":`删除 ${e.title}`,title:"删除节点",onClick:h=>{h.stopPropagation(),n==null||n.onDelete(e.path)},children:l.jsx(ea,{})}),l.jsx(mr,{type:"source",position:i,className:"abc-handle"}),e.containedIn==="loop"&&l.jsxs(l.Fragment,{children:[l.jsx(mr,{id:"loop-target",type:"target",position:a,className:"abc-handle abc-loop-handle"}),l.jsx(mr,{id:"loop-source",type:"source",position:a,className:"abc-handle abc-loop-handle"})]})]})}function uhe({data:e}){const t=w.useContext(l0);return l.jsxs("div",{className:"abc-terminal",children:[l.jsx(mr,{type:"target",position:t==="vertical"?Pe.Top:Pe.Left,className:"abc-handle"}),l.jsx("span",{children:e.title}),l.jsx(mr,{type:"source",position:t==="vertical"?Pe.Bottom:Pe.Right,className:"abc-handle"})]})}const dhe={agent:lhe,group:che,terminal:uhe},fhe={insertStep:ohe};function hhe({draft:e,selectedPath:t,onSelect:n,onAdd:r,onInsert:s,onDelete:i,readOnly:a=!1,interactivePreview:o=!1,direction:c="horizontal"}){const u=w.useMemo(()=>LA(e,c),[]),[d,f,h]=e4(u.nodes),[p,m,y]=t4(u.edges),E=sue(),g=w.useRef(`${c}:${RA(e)}`),x=w.useRef(null),{fitView:b}=r0(),_=w.useMemo(()=>LA(e,c),[c,e]),[k,N]=w.useState(()=>window.matchMedia("(max-width: 860px)").matches),C=w.useMemo(()=>a?{padding:.16,minZoom:.05,maxZoom:.9}:k?{padding:.08,minZoom:.35,maxZoom:.9}:{padding:.14,minZoom:.42,maxZoom:1.1},[k,a]),S=w.useCallback(()=>{window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>void b(C))})},[C,b]);w.useEffect(()=>{const O=window.matchMedia("(max-width: 860px)"),D=U=>N(U.matches);return O.addEventListener("change",D),()=>O.removeEventListener("change",D)},[]),w.useEffect(()=>{const O=`${c}:${RA(e)}`,D=O!==g.current;g.current=O,m(_.edges),f(U=>{const X=new Map(U.map(M=>[M.id,M.position]));return _.nodes.map(M=>({...M,position:!D&&X.get(M.id)?X.get(M.id):M.position,selected:M.data.kind==="agent"&&!!M.data.path&&ihe(M.data.path,t)}))}),D&&S()},[_,e,S,t,m,f]),w.useEffect(()=>{S()},[k,S]),w.useEffect(()=>{E&&S()},[_,S,E]),w.useEffect(()=>{if(!a||!x.current)return;const O=new ResizeObserver(()=>S());return O.observe(x.current),S(),()=>O.disconnect()},[S,a]);const A=w.useMemo(()=>a?null:{onAdd:r,onInsert:s,onDelete:i},[r,i,s,a]);return l.jsx(l0.Provider,{value:c,children:l.jsx(o0.Provider,{value:A,children:l.jsx("section",{className:`abc-root is-${c}${a?" is-readonly":""}`,"aria-label":a?"只读 Agent 执行画布":"Agent 执行画布",children:l.jsx("div",{ref:x,className:"abc-canvas",children:l.jsxs(JP,{nodes:d,edges:p,nodeTypes:dhe,edgeTypes:fhe,onNodesChange:h,onEdgesChange:y,onNodeClick:(O,D)=>{!a&&D.data.kind==="agent"&&D.data.path&&n(D.data.path)},nodesDraggable:!a,nodesConnectable:!1,nodesFocusable:!a,elementsSelectable:!a,edgesFocusable:!1,edgesReconnectable:!1,panOnDrag:!a||o,zoomOnDoubleClick:o,zoomOnPinch:!a||o,zoomOnScroll:!a||o,fitView:!0,fitViewOptions:C,minZoom:a?.05:.35,maxZoom:1.6,proOptions:{hideAttribution:!0},children:[l.jsx(r4,{gap:20,size:1.2,color:"hsl(34 20% 82%)"}),(!a||o)&&l.jsx(i4,{showInteractive:!1}),rhe]})})})})})}function Xm(e){return l.jsx(Dv,{children:l.jsx(hhe,{...e})})}const phe="doubao-seed-2-1-pro-260628",mhe="一个基于 VeADK 构建的智能助手,理解用户意图并调用合适的工具完成任务。",ghe=`你是一个专业、可靠的智能助手。 你的目标是准确理解用户的需求,并给出条理清晰、简洁有用的回答。 约束: - 信息不足时主动提问澄清,不要臆造事实。 - 需要时合理调用可用的工具,并说明关键结论。 -- 保持礼貌、专业的语气。`;function Sr(){return{name:"",description:ghe,instruction:yhe,agentType:"llm",maxIterations:3,a2aUrl:"",tools:[],skills:[],memory:{shortTerm:!1,longTerm:!1},knowledgebase:!1,tracing:!1,subAgents:[],builtinTools:[],customTools:[],mcpTools:[],a2aRegistry:{enabled:!1,registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},modelName:mhe,modelProvider:"",modelApiBase:"",shortTermBackend:"local",longTermBackend:"local",autoSaveSession:!1,knowledgebaseBackend:qd,knowledgebaseIndex:"",tracingExporters:[],selectedSkills:[],deployment:{feishuEnabled:!1}}}const bhe=[{id:"case-1",kind:"good",input:"总结本周客户反馈,并按优先级归类。",expectation:"覆盖主要问题,给出清晰的优先级与下一步动作。",tag:"总结"},{id:"case-2",kind:"good",input:"查询最新公开资料并附上来源。",expectation:"调用搜索工具,结论与引用一一对应。",tag:"工具调用"},{id:"case-3",kind:"bad",input:"在信息不足时直接给出确定结论。",expectation:"应明确说明未知,并主动询问缺失信息。",tag:"幻觉"},{id:"case-4",kind:"bad",input:"连续重复调用相同工具获取同一结果。",expectation:"复用已有结果,避免无意义的重复调用。",tag:"效率"}],Ehe=[{id:"eval-regression",name:"核心能力回归",agentIds:[],caseSet:"核心回归集",evaluator:"综合质量评估器",metrics:["回答质量","工具调用"],concurrency:"4",history:[{id:"run-1",createdAt:"今天 10:32",score:88,status:"completed"},{id:"run-2",createdAt:"昨天 16:08",score:84,status:"completed"}]},{id:"eval-safety",name:"安全与幻觉检查",agentIds:[],caseSet:"安全边界集",evaluator:"事实一致性评估器",metrics:["事实准确性","拒答合理性"],concurrency:"2",history:[{id:"run-3",createdAt:"7 月 25 日 14:20",score:91,status:"completed"}]}],xhe=[{id:"basic",label:"基本信息"},{id:"evaluations",label:"评测集"}];function j4(e){const t=e.tools??[],n=_c.filter(s=>s.toolNames.some(i=>t.includes(i))),r=new Set(n.flatMap(s=>s.toolNames));return{...Sr(),name:e.name,description:e.description,instruction:e.instruction||Sr().instruction,agentType:e.type,modelName:e.model,tools:t.filter(s=>!r.has(s)),builtinTools:n.map(s=>s.id),skills:(e.skills??[]).map(s=>s.name),subAgents:(e.children??[]).map(j4)}}function whe(e,t){var n;return e!=null&&e.draft?e.draft:e!=null&&e.graph?j4(e.graph):{...Sr(),name:(e==null?void 0:e.name)||t,description:(e==null?void 0:e.description)||"暂无描述",agentType:(e==null?void 0:e.type)??"llm",modelName:e==null?void 0:e.model,tools:(e==null?void 0:e.tools)??[],skills:((n=e==null?void 0:e.skills)==null?void 0:n.map(r=>r.name))??[]}}function D4(e){return e?1+e.children.reduce((t,n)=>t+D4(n),0):1}function P4(e){return 1+e.subAgents.reduce((t,n)=>t+P4(n),0)}const $E=[{phase:"prepare",label:"准备部署",description:"校验配置并创建部署任务"},{phase:"build",label:"构建镜像",description:"生成运行环境与智能体代码"},{phase:"deploy",label:"部署服务",description:"创建并启动 AgentKit Runtime"},{phase:"publish",label:"发布服务",description:"等待服务就绪并生成访问地址"},{phase:"complete",label:"部署完成",description:"智能体已可以正常使用"}];function vhe(e){if(e.status==="success")return $E.length-1;const t=e.phase??{准备部署:"prepare",构建镜像:"build",部署:"deploy",发布:"publish",部署完成:"complete"}[e.label],n=$E.findIndex(r=>r.phase===t);return n<0?0:n}function jA({task:e}){const t=vhe(e),n=e.status==="success"?100:Math.max(6,Math.min(100,e.pct??6)),r=e.status==="running"?"正在部署":e.status==="success"?"部署完成":e.status==="error"?"部署失败":"部署已取消";return l.jsxs("section",{className:`aw-deploy-progress-card is-${e.status}`,"aria-live":"polite",children:[l.jsxs("div",{className:"aw-deploy-progress-head",children:[l.jsxs("div",{children:[l.jsx("span",{className:"aw-deploy-progress-icon","aria-hidden":!0,children:e.status==="running"?l.jsx(Rt,{className:"spin"}):e.status==="success"?l.jsx(_L,{}):e.status==="error"?l.jsx(Cg,{}):l.jsx(H1,{})}),l.jsxs("div",{children:[l.jsx("h3",{children:r}),l.jsx("p",{children:e.runtimeName})]})]}),l.jsx("strong",{children:e.status==="running"?`${Math.round(n)}%`:e.label})]}),l.jsx("div",{className:"aw-deploy-progress-track",role:"progressbar","aria-label":"部署进度","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(n),children:l.jsx("span",{style:{width:`${n}%`}})}),l.jsx("ol",{className:"aw-deploy-steps",children:$E.map((s,i)=>{const a=e.status==="success"||i{e.length!==0&&Te(J=>J.map((he,Le)=>Le===0&&he.agentIds.length===0?{...he,agentIds:e.slice(0,2).map(Be=>Be.id)}:he))},[e]);const it=w.useMemo(()=>{const J=new Map;for(const he of e)he.runtimeId&&J.set(he.runtimeId,he);return J},[e]),He=w.useMemo(()=>{var he;const J=new Map;for(const Le of t){const Be=(he=Le.deploymentTarget)==null?void 0:he.runtimeId;if(!Be||!it.has(Be))continue;const ot=J.get(Be);(!ot||Le.updatedAt>ot.updatedAt)&&J.set(Be,Le)}return J},[it,t]),Ue=w.useMemo(()=>{const J=new Map;for(const he of d){if(!he.runtimeId)continue;const Le=J.get(he.runtimeId);(!Le||he.startedAt>Le.startedAt)&&J.set(he.runtimeId,he)}return J},[d]),Et=w.useMemo(()=>{const J=L.trim().toLowerCase();return J?e.filter(he=>{const Le=he.runtimeId?He.get(he.runtimeId):void 0,Be=he.runtimeId?Ue.get(he.runtimeId):void 0;return[he.label,he.app,he.host??"",(Le==null?void 0:Le.draft.name)??"",(Le==null?void 0:Le.draft.description)??"",(Be==null?void 0:Be.runtimeName)??""].join(" ").toLowerCase().includes(J)}):e},[e,Ue,L,He]),rt=w.useMemo(()=>{const J=L.trim().toLowerCase();return t.filter(he=>{var Be;const Le=(Be=he.deploymentTarget)==null?void 0:Be.runtimeId;return Le&&it.has(Le)?!1:J?`${he.draft.name} ${he.draft.description}`.toLowerCase().includes(J):!0})},[it,t,L]),St=w.useMemo(()=>t.filter(J=>{var Le;const he=(Le=J.deploymentTarget)==null?void 0:Le.runtimeId;return!he||!it.has(he)}).length,[it,t]),ct=w.useMemo(()=>{const J=L.trim().toLowerCase();return J?Ee.filter(he=>he.name.toLowerCase().includes(J)):Ee},[Ee,L]),B=e.find(J=>J.id===A),Q=t.find(J=>J.id===D),oe=d.find(J=>J.id===X),be=B!=null&&B.runtimeId?He.get(B.runtimeId):void 0,Oe=A&&s===A?r:null,Ye=w.useMemo(()=>{const J=new Map(e.map((Le,Be)=>[Le.id,Be])),he=new Map(n.map((Le,Be)=>[Le,Be]));return[...Et].sort((Le,Be)=>{const ot=Le.runtimeId?Ue.get(Le.runtimeId):void 0,It=Be.runtimeId?Ue.get(Be.runtimeId):void 0,st=(ot==null?void 0:ot.status)==="running"?ot.startedAt:0,Z=(It==null?void 0:It.status)==="running"?It.startedAt:0;if(st!==Z)return Z-st;const we=he.get(Le.id),_e=he.get(Be.id);return we!=null&&_e!=null?we-_e:we!=null?-1:_e!=null?1:(J.get(Le.id)??0)-(J.get(Be.id)??0)})},[n,e,Et,Ue]),tt=(B==null?void 0:B.label)||(Oe==null?void 0:Oe.name)||(Q==null?void 0:Q.draft.name)||(oe==null?void 0:oe.runtimeName)||"未选择智能体",ze=Ee.find(J=>J.id===Ke),Tt=w.useMemo(()=>(oe==null?void 0:oe.agentDraft)??(Q==null?void 0:Q.draft)??(be==null?void 0:be.draft)??whe(Oe,(B==null?void 0:B.label)??"agent"),[Oe,B==null?void 0:B.label,be==null?void 0:be.draft,Q==null?void 0:Q.draft,oe==null?void 0:oe.agentDraft]),Re=w.useMemo(()=>{if(oe)return oe;if(Q)return d.filter(J=>{var he,Le;return((he=J.agentDraft)==null?void 0:he.name)===Q.draft.name||J.runtimeName===Q.draft.name||!!((Le=Q.deploymentTarget)!=null&&Le.runtimeId)&&J.runtimeId===Q.deploymentTarget.runtimeId}).sort((J,he)=>he.startedAt-J.startedAt)[0];if(B)return d.filter(J=>!!B.runtimeId&&J.runtimeId===B.runtimeId||J.runtimeName===B.label).sort((J,he)=>he.startedAt-J.startedAt)[0]},[d,B,Q,oe]);w.useEffect(()=>{if(!f)return;const J=d.find(Le=>Le.id===f),he=J!=null&&J.runtimeId?it.get(J.runtimeId):void 0;if(he){M(""),U(""),O(he.id),S("basic");return}O(""),U(""),M(f),S("basic")},[it,d,f]),w.useEffect(()=>{!h||!e.some(J=>J.id===h)||(M(""),U(""),O(h),S("basic"))},[e,h]),w.useEffect(()=>{let J=!1;if(T(null),!!(B!=null&&B.runtimeId))return $w(B.runtimeId,B.region??"cn-beijing").then(he=>{J||T(he)}).catch(()=>{J||T(null)}),()=>{J=!0}},[B==null?void 0:B.region,B==null?void 0:B.runtimeId]);const kt=de.filter(J=>{if(J.kind!==F)return!1;const he=V.trim().toLowerCase();return he?`${J.input} ${J.expectation} ${J.tag}`.toLowerCase().includes(he):!0}),Pt=J=>{Te(he=>he.map(Le=>Le.id===J.id?J:Le))},Bt=()=>{const J=new Set(e.map(Be=>Be.id)),he=n.filter(Be=>J.has(Be)),Le=new Set(he);return[...he,...e.filter(Be=>!Le.has(Be.id)).map(Be=>Be.id)]},bn=(J,he,Le)=>{if(!m||J===he)return;const Be=Bt().filter(st=>st!==J),ot=Be.indexOf(he),It=ot<0?Be.length:Le==="after"?ot+1:ot;Be.splice(It,0,J),m(Be)},Xe=(J,he)=>{if(!P||P===he)return;const Le=J.currentTarget.getBoundingClientRect();re(he),ee(J.clientY>Le.top+Le.height/2?"after":"before")},ft=(J,he)=>{if(!m)return;const Le=Bt(),Be=Le.indexOf(J),ot=Math.max(0,Math.min(Le.length-1,Be+he));Be<0||Be===ot||(Le.splice(Be,1),Le.splice(ot,0,J),m(Le))},xt=async J=>{if(!(!y||J.canDelete!==!0||le)&&window.confirm(`确定删除 Agent "${J.label}"?该 Runtime 将被永久删除。`)){ne(!0),ye("");try{await y([J]),A===J.id&&O("")}catch(he){ye(he instanceof Error?he.message:String(he))}finally{ne(!1)}}},vt=J=>{if(!E||le)return;const he=J.draft.name||"未命名 Agent";window.confirm(`确定删除草稿 "${he}"?`)&&(ye(""),E([J]),D===J.id&&U(""))},fe=()=>{const J=`eval-${Date.now()}`,he={id:J,name:`新评测组 ${Ee.length+1}`,agentIds:[],caseSet:"核心回归集",evaluator:"综合质量评估器",metrics:["回答质量"],concurrency:"4",history:[]};Te(Le=>[he,...Le]),Ne(J)},$e=J=>{Pt({...J,history:[{id:`run-${Date.now()}`,createdAt:"刚刚",score:86+J.history.length%7,status:"completed"},...J.history]})};return l.jsxs("div",{className:"aw-root",children:[l.jsxs("nav",{className:"aw-view-tabs","aria-label":"智能体工作台",children:[l.jsx("button",{type:"button",className:k==="library"?"is-active":"","aria-pressed":k==="library",onClick:()=>{N("library"),R("")},children:"智能体库"}),l.jsx("button",{type:"button",className:k==="evaluation"?"is-active":"","aria-pressed":k==="evaluation",onClick:()=>{N("evaluation"),R("")},children:"评测"})]}),l.jsxs("div",{className:"aw-workspace-frame",children:[l.jsxs("div",{className:"aw-workspace","aria-hidden":k==="evaluation"||void 0,ref:J=>J==null?void 0:J.toggleAttribute("inert",k==="evaluation"),children:[l.jsxs("aside",{className:"aw-sidebar","aria-label":k==="library"?"智能体列表":"评测组列表",children:[l.jsxs("label",{className:"aw-search",children:[l.jsx(Kd,{"aria-hidden":!0}),l.jsx("input",{value:L,onChange:J=>R(J.currentTarget.value),placeholder:k==="library"?"搜索智能体":"搜索评测组","aria-label":k==="library"?"搜索智能体":"搜索评测组"})]}),l.jsxs("button",{type:"button",className:"aw-create-card",onClick:k==="library"?x:fe,disabled:k==="library"&&!a,children:[l.jsx(rr,{"aria-hidden":!0}),l.jsx("span",{children:k==="library"?"新建 Agent":"新建评测组"})]}),k==="library"&&me&&l.jsx("div",{className:"aw-delete-error",role:"alert",children:me}),l.jsx("div",{className:"aw-agent-list",children:k==="evaluation"?ct.length===0?l.jsx("div",{className:"aw-list-empty",children:"没有匹配的评测组"}):ct.map(J=>l.jsxs("button",{type:"button",className:`aw-agent-item${J.id===Ke?" is-active":""}`,onClick:()=>Ne(J.id),children:[l.jsxs("span",{className:"aw-agent-copy aw-eval-group-copy",children:[l.jsx("strong",{children:J.name}),l.jsxs("small",{children:[J.agentIds.length," 个智能体 · ",J.history.length," 次运行"]})]}),l.jsx(ad,{"aria-hidden":!0})]},J.id)):c&&Ye.length===0&&rt.length===0?l.jsx("div",{className:"aw-list-empty",children:"正在读取云端智能体…"}):u&&Ye.length===0&&rt.length===0?l.jsxs("div",{className:"aw-list-empty aw-list-error",children:[l.jsx("span",{children:u}),p&&l.jsx("button",{type:"button",onClick:p,children:"重试"})]}):Ye.length===0&&rt.length===0?l.jsx("div",{className:"aw-list-empty",children:"没有匹配的智能体"}):l.jsxs(l.Fragment,{children:[rt.map(J=>{const he=d.filter(Le=>{var Be,ot;return((Be=Le.agentDraft)==null?void 0:Be.name)===J.draft.name||Le.runtimeName===J.draft.name||!!((ot=J.deploymentTarget)!=null&&ot.runtimeId)&&Le.runtimeId===J.deploymentTarget.runtimeId}).sort((Le,Be)=>Be.startedAt-Le.startedAt)[0];return l.jsxs("button",{type:"button",className:`aw-agent-item${J.id===D?" is-active":""}`,onClick:()=>{O(""),M(""),U(J.id),S("basic")},children:[l.jsxs("span",{className:"aw-agent-copy",children:[l.jsxs("span",{className:"aw-agent-name-row",children:[l.jsx("strong",{children:J.draft.name||"未命名 Agent"}),l.jsx("span",{className:`aw-draft-badge${(he==null?void 0:he.status)==="running"?" is-deploying":""}`,children:(he==null?void 0:he.status)==="running"?"部署中":"草稿"})]}),l.jsx("small",{children:J.deploymentTarget?"待更新":"尚未发布"})]}),l.jsx(ad,{"aria-hidden":!0})]},J.id)}),Ye.map(J=>{const he=J.runtimeId?Ue.get(J.runtimeId):void 0,Le=J.runtimeId?He.get(J.runtimeId):void 0,Be=(he==null?void 0:he.status)==="running"?{label:"部署中",className:" is-deploying"}:(he==null?void 0:he.status)==="error"?{label:"失败",className:" is-error"}:(he==null?void 0:he.status)==="cancelled"?{label:"已取消",className:" is-muted"}:Le?{label:"待更新",className:""}:null,ot=(he==null?void 0:he.status)==="running"?"正在更新部署":Le?"待更新":J.remote?J.host||"远程智能体":"本地智能体",It=["aw-agent-item","aw-agent-item--sortable",J.id===A?"is-active":"",J.id===P?"is-dragging":"",J.id===G&&J.id!==P?`is-drop-target is-drop-${ue}`:""].filter(Boolean).join(" ");return l.jsxs("button",{type:"button",draggable:!!m,className:It,"aria-keyshortcuts":m?"Alt+ArrowUp Alt+ArrowDown":void 0,onDragStart:st=>{m&&(te.current=!0,ie(J.id),st.dataTransfer.effectAllowed="move",st.dataTransfer.setData("text/plain",J.id))},onDragEnter:st=>{Xe(st,J.id)},onDragOver:st=>{!P||P===J.id||(st.preventDefault(),st.dataTransfer.dropEffect="move",Xe(st,J.id))},onDragLeave:st=>{const Z=st.relatedTarget;Z instanceof Node&&st.currentTarget.contains(Z)||G===J.id&&re("")},onDrop:st=>{st.preventDefault();const Z=st.dataTransfer.getData("text/plain")||P;bn(Z,J.id,ue),ie(""),re(""),ee("before")},onDragEnd:()=>{ie(""),re(""),ee("before"),window.setTimeout(()=>{te.current=!1},0)},onKeyDown:st=>{st.altKey&&(st.key==="ArrowUp"?(st.preventDefault(),ft(J.id,-1)):st.key==="ArrowDown"&&(st.preventDefault(),ft(J.id,1)))},onClick:st=>{if(te.current){st.preventDefault(),te.current=!1;return}M(""),U(""),O(J.id),S("basic"),g(J.id)},children:[l.jsxs("span",{className:"aw-agent-copy",children:[l.jsxs("span",{className:"aw-agent-name-row",children:[l.jsx("strong",{children:J.label}),J.currentVersion!=null&&l.jsxs("span",{className:"aw-version-badge",children:["v",J.currentVersion]}),Be&&l.jsx("span",{className:`aw-draft-badge${Be.className}`,children:Be.label})]}),l.jsx("small",{children:ot})]}),l.jsx(ad,{"aria-hidden":!0})]},J.id)})]})}),l.jsxs("div",{className:"aw-list-count",children:["共 ",k==="library"?e.length+St:Ee.length," 个"]})]}),k==="evaluation"&&ze?l.jsx(Nhe,{group:ze,agents:e,cases:de,onChange:Pt,onRun:$e}):k==="evaluation"?l.jsx("main",{className:"aw-main aw-empty-selection",children:l.jsx("p",{children:"未选择评测组"})}):!B&&!Q&&!oe?l.jsx("main",{className:"aw-main aw-empty-selection",children:l.jsx("p",{children:"未选择智能体"})}):(Re==null?void 0:Re.status)==="running"?l.jsx("main",{className:"aw-main aw-deployment-focus",children:l.jsx(jA,{task:Re})}):l.jsxs("main",{className:"aw-main",children:[l.jsx("div",{className:"aw-agent-head",children:l.jsxs("div",{children:[l.jsxs("div",{className:"aw-agent-title-row",children:[l.jsx("h2",{children:tt}),(B==null?void 0:B.currentVersion)!=null&&l.jsxs("span",{children:["v",B.currentVersion]}),Q&&l.jsx("span",{children:"草稿"}),be&&l.jsx("span",{children:"待更新"}),!B&&!Q&&oe&&l.jsx("span",{children:oe.label})]}),l.jsx("p",{children:Tt.description||(i?"正在读取智能体信息…":"暂无描述")})]})}),l.jsx("nav",{className:"aw-agent-tabs","aria-label":"智能体详情",children:xhe.map(J=>l.jsx("button",{type:"button",className:C===J.id?"is-active":"","aria-pressed":C===J.id,onClick:()=>S(J.id),children:J.label},J.id))}),l.jsxs("div",{className:"aw-content",children:[C==="basic"&&l.jsxs("div",{className:"aw-basic-stack",children:[l.jsxs("section",{className:"aw-canvas-card",children:[l.jsx("div",{className:"aw-card-head",children:l.jsx("strong",{children:"执行流程"})}),l.jsx("div",{className:"aw-canvas",children:l.jsx(Qm,{draft:Tt,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0})})]}),l.jsxs("section",{className:"aw-details-card",children:[l.jsx("div",{className:"aw-card-head",children:l.jsx("strong",{children:"详细信息"})}),l.jsxs("dl",{className:"aw-facts",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"模型"}),l.jsx("dd",{children:(Oe==null?void 0:Oe.model)||Tt.modelName||"暂未提供"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"智能体数量"}),l.jsx("dd",{children:Oe!=null&&Oe.graph?D4(Oe.graph):P4(Tt)})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"工具"}),l.jsx("dd",{children:(Oe==null?void 0:Oe.tools.length)??Tt.tools.length+(((nt=Tt.builtinTools)==null?void 0:nt.length)??0)+(((qt=Tt.customTools)==null?void 0:qt.length)??0)+(((fn=Tt.mcpTools)==null?void 0:fn.length)??0)})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"技能"}),l.jsx("dd",{children:Oe?Oe.skillsPreviewSupported?Oe.skills.length:"暂不支持预览":((Lt=Tt.selectedSkills)==null?void 0:Lt.length)??Tt.skills.length})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"当前版本"}),l.jsx("dd",{children:(j==null?void 0:j.currentVersion)!=null?`v${j.currentVersion}`:(B==null?void 0:B.currentVersion)!=null?`v${B.currentVersion}`:"暂未提供"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"状态"}),l.jsx("dd",{children:Q?"草稿":(Re==null?void 0:Re.status)==="error"?"部署失败":(Re==null?void 0:Re.status)==="cancelled"?"已取消":be?"待更新":l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"aw-status-dot"}),"可用"]})})]})]})]}),Re&&l.jsx(jA,{task:Re}),l.jsxs("section",{className:"aw-deployment-panel aw-settings-card",children:[l.jsx("div",{className:"aw-section-head",children:l.jsxs("div",{children:[l.jsx("h3",{children:"部署配置"}),l.jsx("p",{children:"配置目标环境与网络访问方式。"})]})}),l.jsxs("dl",{className:"aw-readonly-config",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"运行状态"}),l.jsx("dd",{children:(j==null?void 0:j.status)||"读取中…"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"部署区域"}),l.jsx("dd",{children:(j==null?void 0:j.region)||(B==null?void 0:B.region)||(Re==null?void 0:Re.region)||"暂未提供"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"网络访问"}),l.jsx("dd",{children:j!=null&&j.networkTypes.length?j.networkTypes.join(" / "):"暂未提供"})]})]})]}),l.jsxs("section",{className:"aw-option-panel aw-settings-card",children:[l.jsx("div",{className:"aw-section-head",children:l.jsxs("div",{children:[l.jsx("h3",{children:"优化项"}),l.jsx("p",{children:"针对运行质量开启专项优化策略。"})]})}),l.jsxs("div",{className:"aw-option-content",children:[l.jsx("div",{className:"aw-option-list","aria-disabled":"true",children:[["上下文优化","压缩冗余信息,保留对当前任务最有价值的上下文。"],["幻觉抑制","在证据不足时降低确定性表达并主动请求补充信息。"],["工具调用优化","减少重复调用,并优先复用已经获得的结果。"]].map(([J,he])=>l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",disabled:!0}),l.jsxs("span",{children:[l.jsx("strong",{children:J}),l.jsx("small",{children:he})]})]},J))}),l.jsx("div",{className:"aw-option-glass",role:"status",children:l.jsx("span",{children:"暂未开放"})})]})]})]}),C==="evaluations"&&l.jsxs("section",{className:"aw-cases",children:[l.jsx("div",{className:"aw-case-filters",children:["good","bad"].map(J=>l.jsx("button",{type:"button",className:F===J?"is-active":"","aria-pressed":F===J,onClick:()=>I(J),children:J==="good"?"Good case":"Bad case"},J))}),l.jsxs("label",{className:"aw-case-search",children:[l.jsx(Kd,{"aria-hidden":!0}),l.jsx("input",{type:"search",value:V,onChange:J=>W(J.currentTarget.value),placeholder:"搜索用户输入、期望行为或标签","aria-label":"搜索评测案例"})]}),l.jsx(khe,{cases:kt})]})]}),C==="basic"&&(B||Q)&&l.jsxs("div",{className:"aw-basic-actions",children:[l.jsx("button",{type:"button",className:"aw-update studio-update-action",disabled:Q||be?!a:!(B!=null&&B.runtimeId)||!o||i||!Oe,onClick:()=>Q?_==null?void 0:_(Q):be?_==null?void 0:_(be):b(Tt),children:Q||be?"继续编辑":"更新"}),(Q||be)&&l.jsxs("button",{type:"button",className:"aw-head-delete studio-update-action",onClick:()=>{const J=Q??be;J&&vt(J)},disabled:le,"aria-label":"删除草稿",title:"删除草稿",children:[l.jsx(ea,{"aria-hidden":!0}),l.jsx("span",{children:"删除草稿"})]}),(B==null?void 0:B.canDelete)&&l.jsxs("button",{type:"button",className:"aw-head-delete studio-update-action",onClick:()=>void xt(B),disabled:le,"aria-label":"删除 Agent",title:"删除 Agent",children:[l.jsx(ea,{"aria-hidden":!0}),l.jsx("span",{children:le?"删除中…":"删除 Agent"})]})]})]})]}),k==="evaluation"&&l.jsx("div",{className:"aw-evaluation-glass",role:"status",children:l.jsx("span",{children:"敬请期待"})})]})]})}function khe({cases:e}){return l.jsxs("div",{className:"aw-case-table",children:[l.jsxs("div",{className:"aw-case-row aw-case-row-head",children:[l.jsx("span",{children:"用户输入"}),l.jsx("span",{children:"期望行为"}),l.jsx("span",{children:"标签"})]}),e.length===0?l.jsx("div",{className:"aw-case-empty",children:"没有匹配的案例"}):e.map(t=>l.jsxs("div",{className:"aw-case-row",children:[l.jsx("strong",{children:t.input}),l.jsx("p",{children:t.expectation}),l.jsx("span",{className:"aw-case-tag",children:t.tag})]},t.id))]})}function Nhe({group:e,agents:t,cases:n,onChange:r,onRun:s}){const[i,a]=w.useState("config"),o=e.agentIds.map(f=>t.find(h=>h.id===f)).filter(f=>!!f),c=["回答质量","事实准确性","工具调用","响应效率"];w.useEffect(()=>a("config"),[e.id]);const u=f=>{r({...e,agentIds:e.agentIds.includes(f)?e.agentIds.filter(h=>h!==f):[...e.agentIds,f]})},d=f=>{r({...e,metrics:e.metrics.includes(f)?e.metrics.filter(h=>h!==f):[...e.metrics,f]})};return l.jsxs("main",{className:"aw-main",children:[l.jsxs("div",{className:"aw-eval-head",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"aw-agent-title-row",children:[l.jsx("h2",{children:e.name}),l.jsx("span",{children:"评测组"})]}),l.jsxs("p",{children:[o.length," 个参评智能体 · ",e.caseSet," · ",e.history.length," 次运行"]})]}),l.jsxs("button",{type:"button",className:"aw-run",onClick:()=>s(e),disabled:!0,children:[l.jsx(TH,{"aria-hidden":!0}),"开始评测"]})]}),l.jsxs("nav",{className:"aw-agent-tabs","aria-label":"评测组详情",children:[l.jsx("button",{type:"button",className:i==="config"?"is-active":"","aria-pressed":i==="config",onClick:()=>a("config"),disabled:!0,children:"评测配置"}),l.jsx("button",{type:"button",className:i==="history"?"is-active":"","aria-pressed":i==="history",onClick:()=>a("history"),disabled:!0,children:"历史结果"})]}),l.jsx("div",{className:"aw-content",children:i==="config"?l.jsxs("div",{className:"aw-eval-setup",children:[l.jsxs("section",{className:"aw-eval-block",children:[l.jsxs("div",{className:"aw-card-head",children:[l.jsx("strong",{children:"参评智能体"}),l.jsxs("span",{children:["已选择 ",o.length," 个"]})]}),l.jsx("div",{className:"aw-eval-agent-grid",children:t.map(f=>l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",checked:e.agentIds.includes(f.id),onChange:()=>u(f.id)}),l.jsxs("span",{children:[l.jsx("strong",{children:f.label}),l.jsx("small",{children:f.remote?"远程":"本地"})]})]},f.id))})]}),l.jsxs("div",{className:"aw-eval-setting-grid",children:[l.jsxs("section",{className:"aw-eval-block",children:[l.jsx("div",{className:"aw-card-head",children:l.jsx("strong",{children:"评测资源"})}),l.jsxs("div",{className:"aw-eval-fields",children:[l.jsxs("label",{children:[l.jsx("span",{children:"评测集"}),l.jsxs("select",{value:e.caseSet,onChange:f=>r({...e,caseSet:f.currentTarget.value}),children:[l.jsx("option",{children:"核心回归集"}),l.jsx("option",{children:"安全边界集"}),l.jsx("option",{children:"工具调用集"})]}),l.jsxs("small",{children:[n.length," 条案例"]})]}),l.jsxs("label",{children:[l.jsx("span",{children:"评估器"}),l.jsxs("select",{value:e.evaluator,onChange:f=>r({...e,evaluator:f.currentTarget.value}),children:[l.jsx("option",{children:"综合质量评估器"}),l.jsx("option",{children:"事实一致性评估器"}),l.jsx("option",{children:"工具调用评估器"})]})]}),l.jsxs("label",{children:[l.jsx("span",{children:"并发数"}),l.jsxs("select",{value:e.concurrency,onChange:f=>r({...e,concurrency:f.currentTarget.value}),children:[l.jsx("option",{value:"2",children:"2"}),l.jsx("option",{value:"4",children:"4"}),l.jsx("option",{value:"8",children:"8"})]})]})]})]}),l.jsxs("section",{className:"aw-eval-block",children:[l.jsxs("div",{className:"aw-card-head",children:[l.jsx("strong",{children:"评测指标"}),l.jsxs("span",{children:["已选择 ",e.metrics.length," 项"]})]}),l.jsx("div",{className:"aw-metric-list",children:c.map(f=>l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",checked:e.metrics.includes(f),onChange:()=>d(f)}),l.jsx("span",{children:f})]},f))})]})]})]}):l.jsxs("section",{className:"aw-eval-history",children:[l.jsx("div",{className:"aw-section-head",children:l.jsxs("div",{children:[l.jsx("h3",{children:"历史结果"}),l.jsx("p",{children:"查看该评测组历次运行的总体表现。"})]})}),e.history.length===0?l.jsxs("div",{className:"aw-results-empty",children:[l.jsx("strong",{children:"暂无历史结果"}),l.jsx("span",{children:"完成首次评测后,结果会出现在这里。"})]}):l.jsx("div",{className:"aw-history-list",children:e.history.map((f,h)=>l.jsxs("button",{type:"button",children:[l.jsxs("span",{children:[l.jsxs("strong",{children:["评测运行 #",e.history.length-h]}),l.jsxs("small",{children:[f.createdAt," · ",o.length," 个智能体"]})]}),l.jsxs("span",{className:"aw-history-score",children:[l.jsx("strong",{children:f.score}),l.jsx("small",{children:"综合得分"})]}),l.jsxs("span",{className:"aw-complete",children:[l.jsx(Js,{}),"已完成"]}),l.jsx(ad,{"aria-hidden":!0})]},f.id))})]})})]})}const She={formatDate(e){const t=e.value??e.date??e.timestamp;if(t==null)return"";const n=new Date(t);return isNaN(n.getTime())?String(t):n.toLocaleString()}};function The(e,t){if(!t||t==="/")return e;const n=t.replace(/^\//,"").split("/").map(s=>s.replace(/~1/g,"/").replace(/~0/g,"~"));let r=e;for(const s of n){if(r==null||typeof r!="object")return;r=r[s]}return r}function Ahe(e){return typeof e=="object"&&e!==null&&typeof e.path=="string"}function Che(e){return typeof e=="object"&&e!==null&&typeof e.call=="string"}function zv(e,t){if(Ahe(e))return The(t,e.path);if(Che(e)){const n=She[e.call],r={};for(const[s,i]of Object.entries(e.args??{}))r[s]=zv(i,t);return n?n(r):`[unknown fn: ${e.call}]`}return e}function Ihe(e,t){const n=zv(e,t);return n==null?"":typeof n=="string"?n:String(n)}const B4=new Map;function tl(e,t){B4.set(e,t)}function Ohe(e){return B4.get(e)}function Rhe(e,t,n){const r=t.replace(/^\//,"").split("/").map(i=>i.replace(/~1/g,"/").replace(/~0/g,"~"));let s=e;for(let i=0;izv(r,e.dataModel),resolveString:r=>Ihe(r,e.dataModel),dispatchAction:t,render:r=>{if(!r)return null;const s=e.components[r];if(!s)return null;const i=Ohe(s.component)??Lhe;return l.jsx(i,{node:s,ctx:n},r)}};return l.jsx("div",{className:"a2ui-surface","data-a2ui-surface":e.surfaceId,children:n.render(e.rootId)})}function jhe(e){const t=w.useRef(null),n=w.useRef(!0),r=28,s=w.useCallback(()=>{const i=t.current;i&&(n.current=i.scrollHeight-i.scrollTop-i.clientHeight{const i=t.current;i&&n.current&&(i.scrollTop=i.scrollHeight)},[e]),{ref:t,onScroll:s}}function Vv({value:e,onRemoveSkill:t,onRemoveAgent:n}){return e.skills.length===0&&!e.targetAgent?null:l.jsxs("div",{className:"invocation-chips","aria-label":"本轮调用上下文",children:[e.skills.map(r=>l.jsxs("span",{className:"invocation-chip invocation-chip--skill",title:r.description,children:[l.jsx(Bo,{"aria-hidden":!0}),l.jsxs("span",{children:["/",r.name]}),t?l.jsx("button",{type:"button",onClick:()=>t(r.name),"aria-label":`移除技能 ${r.name}`,children:l.jsx(zr,{})}):null]},r.name)),e.targetAgent?l.jsxs("span",{className:"invocation-chip invocation-chip--agent",title:e.targetAgent.description,children:[l.jsx(wL,{"aria-hidden":!0}),l.jsx("span",{children:e.targetAgent.name}),n?l.jsx("button",{type:"button",onClick:n,"aria-label":`移除 Agent ${e.targetAgent.name}`,children:l.jsx(zr,{})}):null]}):null]})}function Kv(e=""){return e.startsWith("image/")?"image":e.startsWith("video/")?"video":e==="application/pdf"?"pdf":e==="text/markdown"?"markdown":"text"}function U4(e){var n,r,s,i;const t=Kv(e.mimeType);return t==="pdf"?"PDF":t==="markdown"?"MD":t==="video"?((r=(n=e.mimeType)==null?void 0:n.split("/")[1])==null?void 0:r.toUpperCase())??"VIDEO":t==="image"?((i=(s=e.mimeType)==null?void 0:s.split("/")[1])==null?void 0:i.toUpperCase())??"IMAGE":"TXT"}function $4(e){return e?e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:""}function H4(e,t){return e.previewUrl?e.previewUrl:e.data?`data:${e.mimeType??"application/octet-stream"};base64,${e.data}`:e.uri?WL(t,e.uri):""}function Dhe({kind:e}){return e==="image"?l.jsx(AL,{}):e==="video"?l.jsx(SL,{}):e==="pdf"?l.jsx(NH,{}):l.jsx(NL,{})}function Yv({appName:e,items:t,compact:n=!1,onRemove:r}){const[s,i]=w.useState(null);return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:`media-grid${n?" media-grid--compact":""}`,children:t.map(a=>{const o=Kv(a.mimeType),c=H4(a,e),u=a.status==="uploading"||a.status==="error"||!c,d=l.jsxs("button",{type:"button",className:"media-card-main",disabled:u,onClick:()=>i(a),"aria-label":`预览 ${a.name??"附件"}`,children:[o==="image"&&c?l.jsx("img",{className:"media-card-image",src:c,alt:a.name??"图片",loading:"lazy"}):o==="video"&&c?l.jsxs("div",{className:"media-card-video-container",children:[l.jsx("video",{className:"media-card-video",src:c,muted:!0,playsInline:!0,preload:"metadata","aria-hidden":"true"}),l.jsx("span",{className:"media-card-video-play",children:l.jsx(VH,{})})]}):l.jsx("span",{className:"media-card-icon",children:l.jsx(Dhe,{kind:o})}),l.jsxs("span",{className:"media-card-copy",children:[l.jsx("span",{className:"media-card-name",children:a.name??"附件"}),l.jsxs("span",{className:"media-card-meta",children:[l.jsx("span",{className:"media-card-type",children:U4(a)}),a.status==="uploading"?l.jsxs(l.Fragment,{children:[l.jsx(Rt,{className:"media-card-spinner"})," 上传中"]}):a.status==="error"?a.error??"上传失败":$4(a.sizeBytes)]})]}),!n&&a.status!=="uploading"&&a.status!=="error"?l.jsx(nc,{className:"media-card-open"}):null]});return l.jsxs($t.div,{className:`media-card media-card--${o}${a.status==="error"?" media-card--error":""}`,layout:!0,initial:{opacity:0,scale:.985,y:4},animate:{opacity:1,scale:1,y:0},children:[o==="image"&&!u?l.jsx(gL,{src:c,children:d}):d,r?l.jsx("button",{type:"button",className:"media-card-remove","aria-label":`移除 ${a.name??"附件"}`,onClick:()=>r(a.id),children:l.jsx(zr,{})}):null]},a.id)})}),l.jsx(pi,{children:s?l.jsx(Phe,{appName:e,item:s,onClose:()=>i(null)}):null})]})}function Phe({appName:e,item:t,onClose:n}){const r=w.useMemo(()=>H4(t,e),[e,t]),s=Kv(t.mimeType),[i,a]=w.useState(""),[o,c]=w.useState(s==="text"||s==="markdown"),[u,d]=w.useState("");return w.useEffect(()=>{const f=h=>{h.key==="Escape"&&n()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[n]),w.useEffect(()=>{if(s!=="text"&&s!=="markdown")return;const f=new AbortController;return c(!0),d(""),fetch(r,{signal:f.signal}).then(h=>{if(!h.ok)throw new Error(`HTTP ${h.status}`);return h.text()}).then(a).catch(h=>{f.signal.aborted||d(h instanceof Error?h.message:String(h))}).finally(()=>{f.signal.aborted||c(!1)}),()=>f.abort()},[s,r]),l.jsx($t.div,{className:"media-viewer-backdrop",role:"dialog","aria-modal":"true","aria-label":t.name??"附件预览",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onMouseDown:f=>{f.target===f.currentTarget&&n()},children:l.jsxs($t.div,{className:"media-viewer",initial:{opacity:0,y:18,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.99},transition:{type:"spring",stiffness:420,damping:30},children:[l.jsxs("header",{className:"media-viewer-header",children:[l.jsxs("div",{children:[l.jsx("strong",{children:t.name??"附件"}),l.jsxs("span",{children:[U4(t),t.sizeBytes?` · ${$4(t.sizeBytes)}`:""]})]}),l.jsxs("nav",{children:[l.jsx("a",{href:r,download:t.name,"aria-label":"下载",children:l.jsx(Iw,{})}),l.jsx("button",{type:"button",onClick:n,"aria-label":"关闭",children:l.jsx(zr,{})})]})]}),l.jsxs("div",{className:`media-viewer-body media-viewer-body--${s}`,children:[s==="image"?l.jsx("img",{src:r,alt:t.name??"图片"}):null,s==="video"?l.jsx("div",{className:"media-viewer-video-wrapper",children:l.jsx("video",{src:r,controls:!0,autoPlay:!0,playsInline:!0,preload:"auto",className:"media-viewer-video"})}):null,s==="pdf"?l.jsx("iframe",{src:r,title:t.name??"PDF"}):null,o?l.jsxs("div",{className:"media-viewer-loading",children:[l.jsx(Rt,{})," 正在读取文档…"]}):null,!o&&u?l.jsxs("div",{className:"media-viewer-loading",children:["文档加载失败:",u]}):null,!o&&s==="markdown"?l.jsx("div",{className:"media-document",children:l.jsx(jf,{text:i})}):null,!o&&s==="text"?l.jsx("pre",{className:"media-document media-document--plain",children:i}):null]})]})})}function Bhe(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("circle",{cx:"10.25",cy:"10.25",r:"6.25"}),l.jsx("path",{d:"M4.15 10.25h12.2M10.25 4c1.65 1.72 2.5 3.8 2.5 6.25s-.85 4.53-2.5 6.25M10.25 4c-1.65 1.72-2.5 3.8-2.5 6.25s.85 4.53 2.5 6.25M14.8 14.8 20 20"})]})}function Fhe(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("rect",{x:"3.25",y:"5.25",width:"15.5",height:"13.5",rx:"2.25"}),l.jsx("circle",{cx:"8.1",cy:"9.3",r:"1.35"}),l.jsx("path",{d:"m4.7 16.5 3.65-3.7 2.45 2.25 2.2-2.2 4.35 4.1"}),l.jsx("path",{d:"m19.4 2.75.48 1.37 1.37.48-1.37.48-.48 1.37-.48-1.37-1.37-.48 1.37-.48.48-1.37Z",fill:"currentColor",stroke:"none"})]})}function Uhe(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("rect",{x:"3.25",y:"5.5",width:"16.25",height:"13",rx:"2.4"}),l.jsx("path",{d:"m10.2 9.2 4.4 2.8-4.4 2.8V9.2Z"}),l.jsx("path",{d:"m19.25 2.5.42 1.2 1.2.42-1.2.42-.42 1.2-.42-1.2-1.2-.42 1.2-.42.42-1.2Z",fill:"currentColor",stroke:"none"})]})}function $he(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("path",{d:"M5 7.4c0-1.55 3.13-2.8 7-2.8s7 1.25 7 2.8-3.13 2.8-7 2.8-7-1.25-7-2.8Z"}),l.jsx("path",{d:"M5 7.4v4.55c0 1.55 3.13 2.8 7 2.8s7-1.25 7-2.8V7.4M5 11.95v4.55c0 1.55 3.13 2.8 7 2.8s7-1.25 7-2.8v-4.55"}),l.jsx("path",{d:"M8.2 12.25h.01M8.2 16.8h.01"})]})}function Hhe(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("path",{d:"M4.25 4.25h4.5v15.5h-4.5zM8.75 5.75h5v14h-5zM13.75 4.25h4.1v10.25h-4.1z"}),l.jsx("path",{d:"M5.75 7h1.5M10.25 8.25h2M10.25 11h2M15.15 7h1.3"}),l.jsx("circle",{cx:"17.45",cy:"17.35",r:"2.45"}),l.jsx("path",{d:"m19.25 19.15 1.55 1.55"})]})}function zhe(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("path",{d:"M4.25 6.25h6.25c1 0 1.5.55 1.5 1.45v11.05c0-.9-.5-1.45-1.5-1.45H4.25V6.25Z"}),l.jsx("path",{d:"M19.75 9.1v8.2H13.5c-1 0-1.5.55-1.5 1.45V7.7c0-.9.5-1.45 1.5-1.45h2.15"}),l.jsx("path",{d:"m19 3.2.58 1.62 1.62.58-1.62.58L19 7.6l-.58-1.62-1.62-.58 1.62-.58L19 3.2Z",fill:"currentColor",stroke:"none"})]})}function Vhe(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("path",{d:"m4.2 8.4 1.15 10.2h13.3L19.8 8.4"}),l.jsx("path",{d:"M4.2 8.4h15.6L17.9 5H6.1L4.2 8.4Z"}),l.jsx("path",{d:"M7.2 12.2c1.1-1 2.25 1.25 3.4.25 1.05-.9 2.15 1.3 3.3.25"}),l.jsx("path",{d:"m8.2 15.1 1.45 1.35 1.45-1.35M13.55 16.45h2.35"})]})}function z4(e){return l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:l.jsx("path",{d:"m6 3.25 4.5 4.75L6 12.75"})})}function Khe({definition:e,label:t,done:n,open:r,onToggle:s}){const i=e.icon,a=t??(n?e.doneLabel:e.runningLabel);return l.jsxs("button",{type:"button",className:`builtin-tool-head${n?" is-done":" is-running"}`,"data-tool-tone":e.tone,onClick:s,"aria-expanded":r,children:[l.jsx("span",{className:"builtin-tool-icon","aria-hidden":"true",children:l.jsx(i,{})}),n?l.jsx("span",{className:"builtin-tool-label",children:a}):l.jsx(ta,{className:"builtin-tool-label",duration:2.4,spread:18,"aria-live":"polite",children:a}),l.jsx(z4,{className:`builtin-tool-chevron${r?" is-open":""}`})]})}const Yhe={web_search:{name:"web_search",runningLabel:"正在进行网络搜索",doneLabel:"已完成网络搜索",tone:"search",icon:Bhe},run_code:{name:"run_code",runningLabel:"正在 AgentKit 沙箱中执行代码",doneLabel:"已在 AgentKit 沙箱中完成代码执行",tone:"sandbox",icon:Vhe},image_generate:{name:"image_generate",runningLabel:"正在生成图片",doneLabel:"已完成图片生成",tone:"image",icon:Fhe},video_generate:{name:"video_generate",runningLabel:"正在生成视频",doneLabel:"已完成视频生成",tone:"video",icon:Uhe},load_memory:{name:"load_memory",runningLabel:"正在检索长期记忆",doneLabel:"已完成记忆检索",tone:"memory",icon:$he},load_knowledgebase:{name:"load_knowledgebase",runningLabel:"正在检索知识库",doneLabel:"已完成知识库检索",tone:"knowledge",icon:Hhe},load_skill:{name:"load_skill",runningLabel:"正在加载技能",doneLabel:"已加载技能",tone:"skill",icon:zhe}};function Whe(e){return Yhe[e]}const V4="send_a2ui_json_to_client",Ghe=28;function qhe(e,t,n){let r=t;for(let s=0;s65535?2:1}return r}function Xhe(e){return e<=4?1:Math.min(18,Math.max(2,Math.ceil(e/6)))}function K4(e,t,n){const[r,s]=w.useState(()=>t?"":e),i=w.useRef(r),a=w.useRef(e),o=w.useRef(null),c=w.useRef(0),u=w.useRef(n);return a.current=e,u.current=n,w.useEffect(()=>{const d=i.current,f=window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(!t||f||!e.startsWith(d)){o.current!==null&&window.cancelAnimationFrame(o.current),o.current=null,d!==e&&(i.current=e,s(e));return}if(d===e||o.current!==null)return;const h=p=>{const m=a.current,y=i.current;if(!m.startsWith(y)){i.current=m,s(m),o.current=null;return}if(p-c.current{var d;(d=u.current)==null||d.call(u)},[r]),w.useEffect(()=>()=>{o.current!==null&&(window.cancelAnimationFrame(o.current),o.current=null)},[]),r}function Qhe({className:e}){return l.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:l.jsx("path",{d:"M12 2.2l1.7 5.1a3 3 0 0 0 1.9 1.9L20.8 11l-5.1 1.7a3 3 0 0 0-1.9 1.9L12 19.8l-1.7-5.1a3 3 0 0 0-1.9-1.9L3.2 11l5.1-1.7a3 3 0 0 0 1.9-1.9L12 2.2z"})})}function Zhe(){return l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"M14.3 5.25a4.6 4.6 0 0 0-5.55 5.55L3.6 15.95a1.8 1.8 0 0 0 0 2.55l1.9 1.9a1.8 1.8 0 0 0 2.55 0l5.15-5.15a4.6 4.6 0 0 0 5.55-5.55l-2.9 2.9-2.45-.55-.55-2.45 2.9-2.9a4.6 4.6 0 0 0-1.45-1.45Z"})})}function Jhe(e,t){if(e!=="load_skill"||t==null||typeof t!="object"||Array.isArray(t))return;const n=t.skill_name;if(!(typeof n!="string"||!n.trim()))return`使用 ${n.trim()} 技能`}function Y4({text:e,done:t,streaming:n=!1,onStreamFrame:r}){const[s,i]=w.useState(!t),a=w.useRef(!1);w.useEffect(()=>{a.current||i(!t)},[t]);const o=()=>{a.current=!0,i(h=>!h)},c=e.replace(/^\s+/,""),u=K4(c,!t||n,r),{ref:d,onScroll:f}=jhe(u);return l.jsxs("div",{className:"block-thinking",children:[l.jsxs("button",{className:"think-head",onClick:o,type:"button",children:[l.jsx("span",{className:"think-icon","aria-hidden":"true",children:l.jsx(Qhe,{className:`spark ${t?"":"pulse"}`})}),t?l.jsx("span",{className:"think-label think-label--done",children:"已完成思考"}):l.jsx(ta,{className:"think-label",duration:2.4,spread:18,children:"思考中"}),l.jsx(ws,{className:`chev ${s?"open":""}`})]}),l.jsx("div",{className:`think-collapse ${s&&u?"open":""}`,children:l.jsx("div",{className:"think-collapse-inner",children:l.jsx("div",{className:"think-body scroll",ref:d,onScroll:f,children:u})})})]})}function W4(){return l.jsx(Y4,{text:"",done:!1})}const epe=w.memo(function({text:t,streaming:n,onStreamFrame:r}){const s=K4(t,n,r);return s?l.jsx("div",{className:"bubble",children:l.jsx(jf,{text:s})}):null});function tpe({name:e,args:t,response:n,done:r}){const[s,i]=w.useState(!1),a=e===V4?"渲染 UI":e,o=Whe(e),c=n==null?null:typeof n=="string"?n:JSON.stringify(n,null,2),u=c&&c.length>2e3?c.slice(0,2e3)+` -…(已截断)`:c;return l.jsxs($t.div,{className:`block-tool${o?" block-tool--builtin":""}`,initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[o?l.jsx(Khe,{definition:o,label:Jhe(e,t),done:r,open:s,onToggle:()=>i(d=>!d)}):l.jsxs("button",{className:"tool-head tool-head--generic",onClick:()=>i(d=>!d),type:"button","aria-expanded":s,children:[l.jsx("span",{className:"tool-icon tool-icon--generic","aria-hidden":"true",children:l.jsx(Zhe,{})}),r?l.jsx("span",{className:"tool-name",children:a}):l.jsx(ta,{className:"tool-name",duration:2.2,spread:15,children:a}),l.jsx(z4,{className:`tool-chevron${s?" is-open":""}`})]}),l.jsx("div",{className:`think-collapse ${s?"open":""}`,children:l.jsx("div",{className:"think-collapse-inner",children:l.jsxs("div",{className:"tool-detail",children:[t!=null&&l.jsxs("div",{className:"tool-section",children:[l.jsx("div",{className:"tool-section-label",children:"参数"}),l.jsx("pre",{className:"tool-args",children:JSON.stringify(t,null,2)})]}),u!=null&&l.jsxs("div",{className:"tool-section",children:[l.jsx("div",{className:"tool-section-label",children:"返回"}),l.jsx("pre",{className:"tool-args tool-result",children:u})]})]})})})]})}function npe({block:e,onAuth:t}){const[n,r]=w.useState(e.done?"done":"idle"),[s,i]=w.useState(""),a=e.label||"MCP 工具集",o=(()=>{try{return e.authUri?new URL(e.authUri).host:""}catch{return""}})(),c=async()=>{if(t){i(""),r("authorizing");try{await t(e),r("done")}catch(d){i(d instanceof Error?d.message:String(d)),r("idle")}}};return e.done||n==="done"?l.jsxs($t.div,{className:"auth-card-collapsed",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},children:[l.jsx(dS,{className:"auth-card-icon auth-card-icon--done"}),l.jsxs("span",{children:["已授权 · ",a]})]}):l.jsxs($t.div,{className:"auth-card",initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[l.jsxs("div",{className:"auth-card-head",children:[l.jsx(dS,{className:"auth-card-icon"}),l.jsxs("span",{className:"auth-card-title",children:[a," 需要授权"]})]}),l.jsxs("p",{className:"auth-card-desc",children:["工具集 ",l.jsx("code",{className:"auth-card-code",children:a})," 使用 OAuth 保护, 需登录授权后方可调用。",o&&l.jsxs(l.Fragment,{children:[" ","将跳转至 ",l.jsx("code",{className:"auth-card-code",children:o})," 完成登录,"]}),"授权完成后对话自动继续。"]}),l.jsx("button",{className:"auth-card-btn",onClick:c,disabled:n==="authorizing"||!e.authUri,children:n==="authorizing"?l.jsxs(l.Fragment,{children:[l.jsx(Rt,{className:"cw-i spin"})," 等待授权…"]}):l.jsx(l.Fragment,{children:"去授权"})}),!e.authUri&&l.jsx("div",{className:"auth-card-err",children:"未在事件中找到授权地址。"}),s&&l.jsx("div",{className:"auth-card-err",children:s})]})}function Wv({blocks:e,appName:t="",streaming:n=!1,onStreamFrame:r,onAction:s,onAuth:i}){return l.jsx(l.Fragment,{children:e.map((a,o)=>{switch(a.kind){case"thinking":return l.jsx(Y4,{text:a.text,done:a.done,streaming:n,onStreamFrame:r},o);case"text":{const c=a.text.replace(/^\s+/,"");return c?l.jsx(epe,{text:c,streaming:n,onStreamFrame:r},o):null}case"attachment":return l.jsx(Yv,{appName:t,items:a.files},o);case"invocation":return l.jsx(Vv,{value:a.value},o);case"tool":return a.name===V4&&a.done?null:l.jsx(tpe,{name:a.name,args:a.args,response:a.response,done:a.done},o);case"agent-transfer":return null;case"auth":return l.jsx(npe,{block:a,onAuth:i},o);case"a2ui":return F4(a.messages).filter(c=>c.components[c.rootId]).map(c=>l.jsx($t.div,{initial:{opacity:0,y:8,scale:.985},animate:{opacity:1,y:0,scale:1},transition:{type:"spring",stiffness:380,damping:30},children:l.jsx(Mhe,{surface:c,onAction:s})},`${o}-${c.surfaceId}`));default:return null}})})}function G4(e){return e.isComposing||e.keyCode===229}const rpe="/assets/arkclaw-DG3MhHYM.png",spe="/assets/codex-Csw-JJxq.png",ipe="/assets/hermes-C6L-CfGS.png",js=[{value:"agent",label:"Agent",description:"与当前选择的 Agent 对话"},{value:"temporary",label:"内置智能体",description:"使用平台提供的智能体"},{value:"skill-create",label:"创建 Skill",description:"使用两个模型生成并对比 Skill"}],ape=[{label:"ArkClaw",logo:rpe},{label:"Hermes 智能体",logo:ipe}];function DA({mode:e}){return e==="skill-create"?l.jsxs("svg",{className:"new-chat-mode__skill-icon",viewBox:"0 0 20 20","aria-hidden":"true",children:[l.jsx("path",{d:"M10 2.2l1.35 4.1 4.15 1.35-4.15 1.35L10 13.1 8.65 9 4.5 7.65 8.65 6.3 10 2.2Z"}),l.jsx("path",{d:"M15.6 12.2l.6 1.8 1.8.6-1.8.6-.6 1.8-.6-1.8-1.8-.6 1.8-.6.6-1.8Z"})]}):e==="temporary"?l.jsxs("svg",{className:"new-chat-mode__temporary-icon",viewBox:"0 0 20 20","aria-hidden":"true",children:[l.jsx("path",{d:"m10 2.8 6.1 3.45v7.5L10 17.2l-6.1-3.45v-7.5L10 2.8Z"}),l.jsx("path",{d:"m3.9 6.25 6.1 3.5 6.1-3.5M10 9.75v7.45"})]}):l.jsx(wc,{className:"new-chat-mode__agent-icon"})}function ope(){return l.jsx("svg",{className:"new-chat-mode__nested-chevron",viewBox:"0 0 12 12","aria-hidden":"true",children:l.jsx("path",{d:"m4.5 3 3 3-3 3"})})}function lpe({value:e,onChange:t,disabled:n=!1,temporaryEnabled:r,skillCreateEnabled:s}){const[i,a]=w.useState(!1),[o,c]=w.useState(!1),[u,d]=w.useState(()=>js.findIndex(k=>k.value===e)),f=w.useRef(null),h=w.useRef(null),p=js.find(k=>k.value===e)??js[0],m=p.value==="temporary"?"Codex 智能体":p.label;function y(k){return k.value==="temporary"?r:k.value==="skill-create"?s:!0}function E(k){return y(k)!==!0}function g(k){const N=y(k);return N===void 0?"正在检查配置":N?k.description:"管理员未配置"}w.useEffect(()=>{if(!i)return;const k=N=>{var C;(C=f.current)!=null&&C.contains(N.target)||(a(!1),c(!1))};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[i]);function x(k){let N=u;do N=(N+k+js.length)%js.length;while(E(js[N]));d(N),c(js[N].value==="temporary")}function b(k){var N;if(!E(k)){if(k.value==="temporary"){c(!0);return}t(k.value),a(!1),c(!1),(N=h.current)==null||N.focus()}}function _(){t("temporary"),a(!1),c(!1)}return l.jsxs("div",{className:"new-chat-mode",ref:f,children:[l.jsxs("button",{ref:h,type:"button",className:"new-chat-mode__trigger","aria-label":"选择新会话模式","aria-haspopup":"listbox","aria-expanded":i,disabled:n,onClick:()=>{d(js.findIndex(k=>k.value===e)),a(k=>(k&&c(!1),!k))},onKeyDown:k=>{k.key==="ArrowDown"||k.key==="ArrowUp"?(k.preventDefault(),i?x(k.key==="ArrowDown"?1:-1):a(!0)):i&&(k.key==="Enter"||k.key===" ")?(k.preventDefault(),b(js[u])):i&&k.key==="Escape"&&(k.preventDefault(),a(!1),c(!1))},children:[l.jsx("span",{className:"new-chat-mode__icon",children:l.jsx(DA,{mode:p.value})}),l.jsx("span",{className:"new-chat-mode__current",title:m,children:m}),l.jsx("svg",{className:"new-chat-mode__chevron",viewBox:"0 0 12 12","aria-hidden":"true",children:l.jsx("path",{d:"m3 4.5 3 3 3-3"})})]}),i?l.jsx("div",{className:"new-chat-mode__menu",role:"listbox","aria-label":"新会话模式",tabIndex:-1,onKeyDown:k=>{var N;k.key==="ArrowDown"||k.key==="ArrowUp"?(k.preventDefault(),x(k.key==="ArrowDown"?1:-1)):k.key==="Enter"?(k.preventDefault(),b(js[u])):k.key==="Escape"&&(k.preventDefault(),a(!1),c(!1),(N=h.current)==null||N.focus())},children:js.map((k,N)=>{const C=k.value==="temporary";return l.jsxs("button",{type:"button",role:"option","aria-selected":e===k.value,"aria-haspopup":C?"menu":void 0,"aria-expanded":C?o:void 0,"aria-disabled":E(k),disabled:E(k),className:`new-chat-mode__option${N===u?" is-active":""}`,onMouseEnter:()=>{d(N),c(k.value==="temporary")},onClick:()=>b(k),children:[l.jsx("span",{className:"new-chat-mode__option-icon",children:l.jsx(DA,{mode:k.value})}),l.jsxs("span",{className:"new-chat-mode__copy",children:[l.jsxs("span",{className:"new-chat-mode__label",children:[k.label,k.value==="skill-create"?l.jsx("span",{className:"new-chat-mode__beta",children:"Beta"}):null]}),l.jsx("span",{children:g(k)})]}),C?l.jsx(ope,{}):e===k.value?l.jsx("svg",{className:"new-chat-mode__check",viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"m3.5 8.2 2.8 2.8 6.2-6"})}):null]},k.value)})}):null,i&&o?l.jsxs("div",{className:"new-chat-mode__submenu",role:"menu","aria-label":"内置智能体",children:[l.jsxs("button",{type:"button",role:"menuitem",className:"new-chat-mode__submenu-option",onClick:_,children:[l.jsx("img",{className:"new-chat-mode__builtin-icon",src:spe,alt:"","aria-hidden":"true"}),l.jsxs("span",{className:"new-chat-mode__copy",children:[l.jsx("span",{className:"new-chat-mode__label",children:"Codex 智能体"}),l.jsx("span",{children:"在沙箱中执行任务"})]})]}),ape.map(({label:k,logo:N})=>l.jsxs("button",{type:"button",role:"menuitem",className:"new-chat-mode__submenu-option",disabled:!0,children:[l.jsx("img",{className:"new-chat-mode__builtin-icon",src:N,alt:"","aria-hidden":"true"}),l.jsxs("span",{className:"new-chat-mode__copy",children:[l.jsx("span",{className:"new-chat-mode__label",children:k}),l.jsx("span",{children:"暂不可用"})]})]},k))]}):null]})}const Gv=["doubao-seed-2-0-pro-260215","deepseek-v4-flash-260425"];function cpe(){return l.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[l.jsx("circle",{cx:"8.2",cy:"8.2",r:"4.7"}),l.jsx("path",{d:"m11.7 11.7 4.1 4.1"}),l.jsx("path",{d:"M14.8 2.7v3.2M13.2 4.3h3.2"}),l.jsx("circle",{cx:"8.2",cy:"8.2",r:"1",fill:"currentColor",stroke:"none"})]})}function upe(){return l.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[l.jsx("circle",{cx:"4.2",cy:"15.4",r:"1.4"}),l.jsx("circle",{cx:"15.7",cy:"4.2",r:"1.4"}),l.jsx("path",{d:"M5.7 15.1c3.5-.3 1.8-4.7 5.1-5.1 2.8-.4 2.1-3.7 3.5-4.8"}),l.jsx("path",{d:"m12.7 14.2 1.5 1.5 2.9-3.3"})]})}function dpe(){return l.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[l.jsx("path",{d:"M3.2 5.2h7.1M3.2 9.5h5.2M3.2 13.8h4"}),l.jsx("path",{d:"m10.1 14.8.6-2.8 4.7-4.7 2.2 2.2-4.7 4.7-2.8.6Z"}),l.jsx("path",{d:"M14.5 3.1v2.5M13.2 4.4h2.6"})]})}const fpe=[{icon:cpe,text:"帮我分析一个问题,并给出清晰的解决思路"},{icon:upe,text:"根据我的目标,制定一份可执行的行动计划"},{icon:dpe,text:"帮我整理并润色一段内容,让表达更清晰"}];function hpe({sessionId:e,sessionInitializing:t=!1,appName:n,agentName:r,value:s,onChange:i,onSubmit:a,disabled:o,busy:c,showMeta:u,attachments:d,skills:f,agents:h,invocation:p,capabilitiesLoading:m=!1,allowAttachments:y=!0,onInvocationChange:E,onAddFiles:g,onRemoveAttachment:x,newChatMode:b="agent",newChatLayout:_=!1,showModeSelector:k=!1,onModeChange:N,temporaryEnabled:C,skillCreateEnabled:S}){const A=w.useRef(null),O=w.useRef(null),D=w.useRef(null),U=w.useRef(null),[X,M]=w.useState(!1),[j,T]=w.useState(null),[L,R]=w.useState(0),[F,I]=w.useState(!1);async function V(){if(e)try{await navigator.clipboard.writeText(e),I(!0),setTimeout(()=>I(!1),1500)}catch{I(!1)}}w.useLayoutEffect(()=>{const te=A.current;te&&(te.style.height="auto",te.style.height=`${Math.min(te.scrollHeight,200)}px`)},[s]);const W=b==="skill-create";w.useEffect(()=>{W&&(M(!1),T(null))},[W]);const P=!W&&d.some(te=>te.status!=="ready"),ie=!o&&!c&&!P&&(s.trim().length>0||!W&&d.length>0),G=(j==null?void 0:j.query.toLocaleLowerCase())??"",re=(j==null?void 0:j.kind)==="skill"?f.filter(te=>!p.skills.some(de=>de.name===te.name)).filter(te=>`${te.name} ${te.description}`.toLocaleLowerCase().includes(G)).map(te=>({kind:"skill",value:te})):(j==null?void 0:j.kind)==="agent"?h.filter(te=>`${te.name} ${te.description}`.toLocaleLowerCase().includes(G)).map(te=>({kind:"agent",value:te})):[];function ue(te){var de;M(!1),T(null),(de=te.current)==null||de.click()}function ee(te){i(te),M(!1),T(null),requestAnimationFrame(()=>{var de,Ee;(de=A.current)==null||de.focus(),(Ee=A.current)==null||Ee.setSelectionRange(te.length,te.length)})}function le(te,de){const Ee=te.slice(0,de),Te=/(^|\s)([/@])([^\s/@]*)$/.exec(Ee);if(!Te){T(null);return}const Ke=Te[2].length+Te[3].length,Ne={kind:Te[2]==="/"?"skill":"agent",query:Te[3],start:de-Ke,end:de},it=!j||j.kind!==Ne.kind||j.query!==Ne.query||j.start!==Ne.start||j.end!==Ne.end;T(Ne),it&&R(0),M(!1)}function ne(te){if(!j)return;const de=s.slice(0,j.start)+s.slice(j.end);i(de),te.kind==="skill"?E({...p,skills:[...p.skills,te.value]}):E({skills:[],targetAgent:te.value});const Ee=j.start;T(null),requestAnimationFrame(()=>{var Te,Ke;(Te=A.current)==null||Te.focus(),(Ke=A.current)==null||Ke.setSelectionRange(Ee,Ee)})}function me(){if(p.targetAgent){E({skills:[]});return}p.skills.length>0&&E({...p,skills:p.skills.slice(0,-1)})}function ye(te){const de=te.target.files?Array.from(te.target.files):[];de.length&&g(de),te.target.value=""}return l.jsxs("div",{className:`composer${_?" composer--new-chat":""}${W?" composer--skill-mode":""}`,children:[W?null:l.jsx(Vv,{value:p,onRemoveSkill:te=>E({...p,skills:p.skills.filter(de=>de.name!==te)}),onRemoveAgent:()=>E({skills:[]})}),!W&&d.length>0&&l.jsx(Yv,{appName:n,compact:!0,items:d,onRemove:x}),l.jsxs("div",{className:"composer-box",children:[j?l.jsxs("div",{className:"composer-command-menu",role:"listbox","aria-label":j.kind==="skill"?"可用技能":"可用子 Agent",children:[l.jsxs("div",{className:"composer-command-head",children:[j.kind==="skill"?l.jsx(Bo,{}):l.jsx(wL,{}),l.jsx("span",{children:j.kind==="skill"?"调用技能":"使用子 Agent"}),l.jsx("kbd",{children:j.kind==="skill"?"/":"@"})]}),m?l.jsxs("div",{className:"composer-command-empty",children:[l.jsx(Rt,{className:"spin"})," 正在读取 Agent 能力…"]}):re.length===0?l.jsx("div",{className:"composer-command-empty",children:j.kind==="skill"?"当前 Agent 没有匹配技能":"当前 Agent 没有匹配子 Agent"}):l.jsx("div",{className:"composer-command-list",children:re.map((te,de)=>l.jsxs("button",{type:"button",role:"option","aria-selected":de===L,className:`composer-command-item${de===L?" is-active":""}`,onMouseDown:Ee=>{Ee.preventDefault(),ne(te)},onMouseEnter:()=>R(de),children:[l.jsx("span",{className:`composer-command-icon composer-command-icon--${te.kind}`,children:te.kind==="skill"?l.jsx(Bo,{}):l.jsx(Po,{})}),l.jsxs("span",{className:"composer-command-copy",children:[l.jsxs("strong",{children:[te.kind==="skill"?"/":"@",te.value.name]}),l.jsx("span",{children:te.value.description||(te.kind==="skill"?"加载并执行该技能":"将本轮交给该 Agent")})]}),l.jsx("kbd",{children:de===L?"↵":te.kind==="skill"?"技能":"Agent"})]},`${te.kind}-${te.value.name}`))})]}):null,W?null:l.jsxs("div",{className:"composer-menu-wrap",children:[l.jsx("button",{type:"button",className:"comp-icon",title:"添加","aria-label":"添加",disabled:o||!y,onClick:()=>{T(null),M(te=>!te)},children:l.jsx(rr,{className:"icon"})}),X&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"menu-scrim",onClick:()=>M(!1)}),l.jsxs("div",{className:"composer-menu",role:"menu",children:[l.jsxs("button",{type:"button",className:"menu-item",onClick:()=>ue(O),children:[l.jsx(AL,{className:"icon"}),"上传图片"]}),l.jsxs("button",{type:"button",className:"menu-item",onClick:()=>ue(D),children:[l.jsx(NL,{className:"icon"}),"上传文档或 PDF"]}),l.jsxs("button",{type:"button",className:"menu-item",onClick:()=>ue(U),children:[l.jsx(SL,{className:"icon"}),"上传视频"]})]})]})]}),k&&N?l.jsx(lpe,{value:b,onChange:N,disabled:c,temporaryEnabled:C,skillCreateEnabled:S}):null,l.jsx("div",{className:"composer-input-stack",children:l.jsx("textarea",{ref:A,className:"comp-input scroll",rows:_?4:1,value:s,disabled:o,placeholder:W?`描述你想创建的 Skill,将使用 ${Gv.join(" 和 ")} 并行创建…`:o?"请在页面左上角选择智能体":`向 ${r} 发消息…`,"aria-expanded":!!j,onChange:te=>{i(te.target.value),W||le(te.target.value,te.target.selectionStart)},onSelect:te=>{W||le(te.currentTarget.value,te.currentTarget.selectionStart)},onBlur:()=>setTimeout(()=>T(null),0),onKeyDown:te=>{if(!G4(te.nativeEvent)){if(j){if(te.key==="ArrowDown"&&re.length>0){te.preventDefault(),R(de=>(de+1)%re.length);return}if(te.key==="ArrowUp"&&re.length>0){te.preventDefault(),R(de=>(de-1+re.length)%re.length);return}if((te.key==="Enter"||te.key==="Tab")&&re[L]){te.preventDefault(),ne(re[L]);return}if(te.key==="Escape"){te.preventDefault(),T(null);return}}if(te.key==="Backspace"&&!s&&te.currentTarget.selectionStart===0&&te.currentTarget.selectionEnd===0){me();return}te.key==="Enter"&&!te.shiftKey&&(te.preventDefault(),ie&&a())}}})}),l.jsx($t.button,{type:"button",className:"comp-send",disabled:!ie,onClick:a,"aria-label":"发送",whileTap:ie?{scale:.9}:void 0,transition:{type:"spring",stiffness:600,damping:22},children:c?l.jsx(Rt,{className:"icon spin"}):l.jsx(xL,{className:"icon"})})]}),_&&b==="agent"&&!s.trim()?l.jsx("div",{className:"prompt-suggestions","aria-label":"快捷提示",children:fpe.map(te=>{const de=te.icon;return l.jsxs("button",{type:"button",className:"prompt-suggestion",disabled:o||c,onClick:()=>ee(te.text),children:[l.jsx(de,{}),l.jsx("span",{children:te.text})]},te.text)})}):null,u&&l.jsxs("div",{className:"composer-meta",children:[l.jsxs("span",{className:"composer-session-line",children:["会话 ID:",l.jsx("span",{className:"composer-session-id",title:e||void 0,"aria-live":"polite",children:t?"初始化中":e||"—"}),e&&l.jsx("button",{type:"button",className:"composer-session-copy",title:F?"已复制":"复制会话 ID","aria-label":F?"已复制会话 ID":"复制会话 ID",onClick:()=>void V(),children:F?l.jsx(Js,{}):l.jsx(Cw,{})})]}),l.jsx("span",{className:"composer-meta-separator","aria-hidden":!0,children:"|"}),l.jsx("span",{children:"回答仅供参考"})]}),l.jsx("input",{ref:O,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:ye}),l.jsx("input",{ref:D,type:"file",accept:".txt,.md,.markdown,.pdf,text/plain,text/markdown,application/pdf",multiple:!0,hidden:!0,onChange:ye}),l.jsx("input",{ref:U,type:"file",accept:"video/mp4,video/webm,video/quicktime",multiple:!0,hidden:!0,onChange:ye})]})}function q4({title:e,sub:t,cards:n,footer:r}){return l.jsxs("div",{className:"stk",children:[l.jsxs("div",{className:"stk-head",children:[l.jsx("h1",{className:"stk-title",children:e}),t&&l.jsx("p",{className:"stk-sub",children:t})]}),l.jsx("div",{className:"stk-list",children:n.map((s,i)=>l.jsxs($t.button,{type:"button",className:`stk-card ${s.disabled?"stk-card-disabled":""}`,onClick:s.disabled?void 0:s.onClick,disabled:s.disabled,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.18,ease:"easeOut",delay:i*.04},children:[l.jsx("span",{className:"stk-card-icon",children:l.jsx(s.icon,{})}),l.jsxs("span",{className:"stk-card-text",children:[l.jsx("span",{className:"stk-card-title",children:s.title}),l.jsx("span",{className:"stk-card-desc",children:s.desc})]}),l.jsx(ws,{className:"stk-card-arrow"})]},s.key))}),r&&l.jsx("div",{className:"stk-footer",children:r})]})}const qv=Symbol.for("yaml.alias"),HE=Symbol.for("yaml.document"),Da=Symbol.for("yaml.map"),X4=Symbol.for("yaml.pair"),vi=Symbol.for("yaml.scalar"),tu=Symbol.for("yaml.seq"),Ts=Symbol.for("yaml.node.type"),nu=e=>!!e&&typeof e=="object"&&e[Ts]===qv,zf=e=>!!e&&typeof e=="object"&&e[Ts]===HE,Vf=e=>!!e&&typeof e=="object"&&e[Ts]===Da,Nn=e=>!!e&&typeof e=="object"&&e[Ts]===X4,zt=e=>!!e&&typeof e=="object"&&e[Ts]===vi,Kf=e=>!!e&&typeof e=="object"&&e[Ts]===tu;function _n(e){if(e&&typeof e=="object")switch(e[Ts]){case Da:case tu:return!0}return!1}function kn(e){if(e&&typeof e=="object")switch(e[Ts]){case qv:case Da:case vi:case tu:return!0}return!1}const Q4=e=>(zt(e)||_n(e))&&!!e.anchor,uo=Symbol("break visit"),ppe=Symbol("skip children"),xd=Symbol("remove node");function ru(e,t){const n=mpe(t);zf(e)?Yl(null,e.contents,n,Object.freeze([e]))===xd&&(e.contents=null):Yl(null,e,n,Object.freeze([]))}ru.BREAK=uo;ru.SKIP=ppe;ru.REMOVE=xd;function Yl(e,t,n,r){const s=gpe(e,t,n,r);if(kn(s)||Nn(s))return ype(e,r,s),Yl(e,s,n,r);if(typeof s!="symbol"){if(_n(t)){r=Object.freeze(r.concat(t));for(let i=0;ie.replace(/[!,[\]{}]/g,t=>bpe[t]);class kr{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},kr.defaultYaml,t),this.tags=Object.assign({},kr.defaultTags,n)}clone(){const t=new kr(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new kr(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:kr.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},kr.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:kr.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},kr.defaultTags),this.atNextDocument=!1);const r=t.trim().split(/[ \t]+/),s=r.shift();switch(s){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;const[i,a]=r;return this.tags[i]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;const[i]=r;if(i==="1.1"||i==="1.2")return this.yaml.version=i,!0;{const a=/^\d+\.\d+$/.test(i);return n(6,`Unsupported YAML version ${i}`,a),!1}}default:return n(0,`Unknown directive ${s}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){const a=t.slice(2,-1);return a==="!"||a==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),a)}const[,r,s]=t.match(/^(.*!)([^!]*)$/s);s||n(`The ${t} tag has no suffix`);const i=this.tags[r];if(i)try{return i+decodeURIComponent(s)}catch(a){return n(String(a)),null}return r==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[n,r]of Object.entries(this.tags))if(t.startsWith(r))return n+Epe(t.substring(r.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags);let s;if(t&&r.length>0&&kn(t.contents)){const i={};ru(t.contents,(a,o)=>{kn(o)&&o.tag&&(i[o.tag]=!0)}),s=Object.keys(i)}else s=[];for(const[i,a]of r)i==="!!"&&a==="tag:yaml.org,2002:"||(!t||s.some(o=>o.startsWith(a)))&&n.push(`%TAG ${i} ${a}`);return n.join(` -`)}}kr.defaultYaml={explicit:!1,version:"1.2"};kr.defaultTags={"!!":"tag:yaml.org,2002:"};function Z4(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){const n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function J4(e){const t=new Set;return ru(e,{Value(n,r){r.anchor&&t.add(r.anchor)}}),t}function e6(e,t){for(let n=1;;++n){const r=`${e}${n}`;if(!t.has(r))return r}}function xpe(e,t){const n=[],r=new Map;let s=null;return{onAnchor:i=>{n.push(i),s??(s=J4(e));const a=e6(t,s);return s.add(a),a},setAnchors:()=>{for(const i of n){const a=r.get(i);if(typeof a=="object"&&a.anchor&&(zt(a.node)||_n(a.node)))a.node.anchor=a.anchor;else{const o=new Error("Failed to resolve repeated object (this should not happen)");throw o.source=i,o}}},sourceObjects:r}}function Wl(e,t,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let s=0,i=r.length;s_s(r,String(s),n));if(e&&typeof e.toJSON=="function"){if(!n||!Q4(e))return e.toJSON(t,n);const r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=i=>{r.res=i,delete n.onCreate};const s=e.toJSON(t,n);return n.onCreate&&n.onCreate(s),s}return typeof e=="bigint"&&!(n!=null&&n.keep)?Number(e):e}class Xv{constructor(t){Object.defineProperty(this,Ts,{value:t})}clone(){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:r,onAnchor:s,reviver:i}={}){if(!zf(t))throw new TypeError("A document argument is required");const a={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},o=_s(this,"",a);if(typeof s=="function")for(const{count:c,res:u}of a.anchors.values())s(u,c);return typeof i=="function"?Wl(i,{"":o},"",o):o}}class Qv extends Xv{constructor(t){super(qv),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){if((n==null?void 0:n.maxAliasCount)===0)throw new ReferenceError("Alias resolution is disabled");let r;n!=null&&n.aliasResolveCache?r=n.aliasResolveCache:(r=[],ru(t,{Node:(i,a)=>{(nu(a)||Q4(a))&&r.push(a)}}),n&&(n.aliasResolveCache=r));let s;for(const i of r){if(i===this)break;i.anchor===this.source&&(s=i)}return s}toJSON(t,n){if(!n)return{source:this.source};const{anchors:r,doc:s,maxAliasCount:i}=n,a=this.resolve(s,n);if(!a){const c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let o=r.get(a);if(o||(_s(a,null,n),o=r.get(a)),(o==null?void 0:o.res)===void 0){const c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=Bp(s,a,r)),o.count*o.aliasCount>i)){const c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return o.res}toString(t,n,r){const s=`*${this.source}`;if(t){if(Z4(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){const i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(i)}if(t.implicitKey)return`${s} `}return s}}function Bp(e,t,n){if(nu(t)){const r=t.resolve(e),s=n&&r&&n.get(r);return s?s.count*s.aliasCount:0}else if(_n(t)){let r=0;for(const s of t.items){const i=Bp(e,s,n);i>r&&(r=i)}return r}else if(Nn(t)){const r=Bp(e,t.key,n),s=Bp(e,t.value,n);return Math.max(r,s)}return 1}const t6=e=>!e||typeof e!="function"&&typeof e!="object";class at extends Xv{constructor(t){super(vi),this.value=t}toJSON(t,n){return n!=null&&n.keep?this.value:_s(this.value,t,n)}toString(){return String(this.value)}}at.BLOCK_FOLDED="BLOCK_FOLDED";at.BLOCK_LITERAL="BLOCK_LITERAL";at.PLAIN="PLAIN";at.QUOTE_DOUBLE="QUOTE_DOUBLE";at.QUOTE_SINGLE="QUOTE_SINGLE";const wpe="tag:yaml.org,2002:";function vpe(e,t,n){if(t){const r=n.filter(i=>i.tag===t),s=r.find(i=>!i.format)??r[0];if(!s)throw new Error(`Tag ${t} not found`);return s}return n.find(r=>{var s;return((s=r.identify)==null?void 0:s.call(r,e))&&!r.format})}function hf(e,t,n){var f,h,p;if(zf(e)&&(e=e.contents),kn(e))return e;if(Nn(e)){const m=(h=(f=n.schema[Da]).createNode)==null?void 0:h.call(f,n.schema,null,n);return m.items.push(e),m}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());const{aliasDuplicateObjects:r,onAnchor:s,onTagObj:i,schema:a,sourceObjects:o}=n;let c;if(r&&e&&typeof e=="object"){if(c=o.get(e),c)return c.anchor??(c.anchor=s(e)),new Qv(c.anchor);c={anchor:null,node:null},o.set(e,c)}t!=null&&t.startsWith("!!")&&(t=wpe+t.slice(2));let u=vpe(e,t,a.tags);if(!u){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const m=new at(e);return c&&(c.node=m),m}u=e instanceof Map?a[Da]:Symbol.iterator in Object(e)?a[tu]:a[Da]}i&&(i(u),delete n.onTagObj);const d=u!=null&&u.createNode?u.createNode(n.schema,e,n):typeof((p=u==null?void 0:u.nodeClass)==null?void 0:p.from)=="function"?u.nodeClass.from(n.schema,e,n):new at(e);return t?d.tag=t:u.default||(d.tag=u.tag),c&&(c.node=d),d}function Zm(e,t,n){let r=n;for(let s=t.length-1;s>=0;--s){const i=t[s];if(typeof i=="number"&&Number.isInteger(i)&&i>=0){const a=[];a[i]=r,r=a}else r=new Map([[i,r]])}return hf(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}const Ku=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done;class n6 extends Xv{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){const n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(r=>kn(r)||Nn(r)?r.clone(t):r),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(Ku(t))this.add(n);else{const[r,...s]=t,i=this.get(r,!0);if(_n(i))i.addIn(s,n);else if(i===void 0&&this.schema)this.set(r,Zm(this.schema,s,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${s}`)}}deleteIn(t){const[n,...r]=t;if(r.length===0)return this.delete(n);const s=this.get(n,!0);if(_n(s))return s.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(t,n){const[r,...s]=t,i=this.get(r,!0);return s.length===0?!n&&zt(i)?i.value:i:_n(i)?i.getIn(s,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!Nn(n))return!1;const r=n.value;return r==null||t&&zt(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(t){const[n,...r]=t;if(r.length===0)return this.has(n);const s=this.get(n,!0);return _n(s)?s.hasIn(r):!1}setIn(t,n){const[r,...s]=t;if(s.length===0)this.set(r,n);else{const i=this.get(r,!0);if(_n(i))i.setIn(s,n);else if(i===void 0&&this.schema)this.set(r,Zm(this.schema,s,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${s}`)}}}const _pe=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Vi(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const vo=(e,t,n)=>e.endsWith(` +- 保持礼貌、专业的语气。`;function Sr(){return{name:"",description:mhe,instruction:ghe,agentType:"llm",maxIterations:3,a2aUrl:"",tools:[],skills:[],memory:{shortTerm:!1,longTerm:!1},knowledgebase:!1,tracing:!1,subAgents:[],builtinTools:[],customTools:[],mcpTools:[],a2aRegistry:{enabled:!1,registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},modelName:phe,modelProvider:"",modelApiBase:"",shortTermBackend:"local",longTermBackend:"local",autoSaveSession:!1,knowledgebaseBackend:Gd,knowledgebaseIndex:"",tracingExporters:[],selectedSkills:[],deployment:{feishuEnabled:!1}}}const yhe=[{id:"case-1",kind:"good",input:"总结本周客户反馈,并按优先级归类。",expectation:"覆盖主要问题,给出清晰的优先级与下一步动作。",tag:"总结"},{id:"case-2",kind:"good",input:"查询最新公开资料并附上来源。",expectation:"调用搜索工具,结论与引用一一对应。",tag:"工具调用"},{id:"case-3",kind:"bad",input:"在信息不足时直接给出确定结论。",expectation:"应明确说明未知,并主动询问缺失信息。",tag:"幻觉"},{id:"case-4",kind:"bad",input:"连续重复调用相同工具获取同一结果。",expectation:"复用已有结果,避免无意义的重复调用。",tag:"效率"}],bhe=[{id:"eval-regression",name:"核心能力回归",agentIds:[],caseSet:"核心回归集",evaluator:"综合质量评估器",metrics:["回答质量","工具调用"],concurrency:"4",history:[{id:"run-1",createdAt:"今天 10:32",score:88,status:"completed"},{id:"run-2",createdAt:"昨天 16:08",score:84,status:"completed"}]},{id:"eval-safety",name:"安全与幻觉检查",agentIds:[],caseSet:"安全边界集",evaluator:"事实一致性评估器",metrics:["事实准确性","拒答合理性"],concurrency:"2",history:[{id:"run-3",createdAt:"7 月 25 日 14:20",score:91,status:"completed"}]}],Ehe=[{id:"basic",label:"基本信息"},{id:"evaluations",label:"评测集"}];function M4(e){const t=e.tools??[],n=vc.filter(s=>s.toolNames.some(i=>t.includes(i))),r=new Set(n.flatMap(s=>s.toolNames));return{...Sr(),name:e.name,description:e.description,instruction:e.instruction||Sr().instruction,agentType:e.type,modelName:e.model,tools:t.filter(s=>!r.has(s)),builtinTools:n.map(s=>s.id),skills:(e.skills??[]).map(s=>s.name),subAgents:(e.children??[]).map(M4)}}function xhe(e,t){var n;return e!=null&&e.draft?e.draft:e!=null&&e.graph?M4(e.graph):{...Sr(),name:(e==null?void 0:e.name)||t,description:(e==null?void 0:e.description)||"暂无描述",agentType:(e==null?void 0:e.type)??"llm",modelName:e==null?void 0:e.model,tools:(e==null?void 0:e.tools)??[],skills:((n=e==null?void 0:e.skills)==null?void 0:n.map(r=>r.name))??[]}}function j4(e){return e?1+e.children.reduce((t,n)=>t+j4(n),0):1}function D4(e){return 1+e.subAgents.reduce((t,n)=>t+D4(n),0)}const UE=[{phase:"prepare",label:"准备部署",description:"校验配置并创建部署任务"},{phase:"build",label:"构建镜像",description:"生成运行环境与智能体代码"},{phase:"deploy",label:"部署服务",description:"创建并启动 AgentKit Runtime"},{phase:"publish",label:"发布服务",description:"等待服务就绪并生成访问地址"},{phase:"complete",label:"部署完成",description:"智能体已可以正常使用"}];function whe(e){if(e.status==="success")return UE.length-1;const t=e.phase??{准备部署:"prepare",构建镜像:"build",部署:"deploy",发布:"publish",部署完成:"complete"}[e.label],n=UE.findIndex(r=>r.phase===t);return n<0?0:n}function MA({task:e}){const t=whe(e),n=e.status==="success"?100:Math.max(6,Math.min(100,e.pct??6)),r=e.status==="running"?"正在部署":e.status==="success"?"部署完成":e.status==="error"?"部署失败":"部署已取消";return l.jsxs("section",{className:`aw-deploy-progress-card is-${e.status}`,"aria-live":"polite",children:[l.jsxs("div",{className:"aw-deploy-progress-head",children:[l.jsxs("div",{children:[l.jsx("span",{className:"aw-deploy-progress-icon","aria-hidden":!0,children:e.status==="running"?l.jsx(Rt,{className:"spin"}):e.status==="success"?l.jsx(vL,{}):e.status==="error"?l.jsx(Ag,{}):l.jsx($1,{})}),l.jsxs("div",{children:[l.jsx("h3",{children:r}),l.jsx("p",{children:e.runtimeName})]})]}),l.jsx("strong",{children:e.status==="running"?`${Math.round(n)}%`:e.label})]}),l.jsx("div",{className:"aw-deploy-progress-track",role:"progressbar","aria-label":"部署进度","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(n),children:l.jsx("span",{style:{width:`${n}%`}})}),l.jsx("ol",{className:"aw-deploy-steps",children:UE.map((s,i)=>{const a=e.status==="success"||i{e.length!==0&&Te(J=>J.map((he,Le)=>Le===0&&he.agentIds.length===0?{...he,agentIds:e.slice(0,2).map(Be=>Be.id)}:he))},[e]);const it=w.useMemo(()=>{const J=new Map;for(const he of e)he.runtimeId&&J.set(he.runtimeId,he);return J},[e]),He=w.useMemo(()=>{var he;const J=new Map;for(const Le of t){const Be=(he=Le.deploymentTarget)==null?void 0:he.runtimeId;if(!Be||!it.has(Be))continue;const ot=J.get(Be);(!ot||Le.updatedAt>ot.updatedAt)&&J.set(Be,Le)}return J},[it,t]),Ue=w.useMemo(()=>{const J=new Map;for(const he of d){if(!he.runtimeId)continue;const Le=J.get(he.runtimeId);(!Le||he.startedAt>Le.startedAt)&&J.set(he.runtimeId,he)}return J},[d]),Et=w.useMemo(()=>{const J=L.trim().toLowerCase();return J?e.filter(he=>{const Le=he.runtimeId?He.get(he.runtimeId):void 0,Be=he.runtimeId?Ue.get(he.runtimeId):void 0;return[he.label,he.app,he.host??"",(Le==null?void 0:Le.draft.name)??"",(Le==null?void 0:Le.draft.description)??"",(Be==null?void 0:Be.runtimeName)??""].join(" ").toLowerCase().includes(J)}):e},[e,Ue,L,He]),rt=w.useMemo(()=>{const J=L.trim().toLowerCase();return t.filter(he=>{var Be;const Le=(Be=he.deploymentTarget)==null?void 0:Be.runtimeId;return Le&&it.has(Le)?!1:J?`${he.draft.name} ${he.draft.description}`.toLowerCase().includes(J):!0})},[it,t,L]),St=w.useMemo(()=>t.filter(J=>{var Le;const he=(Le=J.deploymentTarget)==null?void 0:Le.runtimeId;return!he||!it.has(he)}).length,[it,t]),ct=w.useMemo(()=>{const J=L.trim().toLowerCase();return J?Ee.filter(he=>he.name.toLowerCase().includes(J)):Ee},[Ee,L]),B=e.find(J=>J.id===A),Q=t.find(J=>J.id===D),oe=d.find(J=>J.id===X),be=B!=null&&B.runtimeId?He.get(B.runtimeId):void 0,Oe=A&&s===A?r:null,Ye=w.useMemo(()=>{const J=new Map(e.map((Le,Be)=>[Le.id,Be])),he=new Map(n.map((Le,Be)=>[Le,Be]));return[...Et].sort((Le,Be)=>{const ot=Le.runtimeId?Ue.get(Le.runtimeId):void 0,It=Be.runtimeId?Ue.get(Be.runtimeId):void 0,st=(ot==null?void 0:ot.status)==="running"?ot.startedAt:0,Z=(It==null?void 0:It.status)==="running"?It.startedAt:0;if(st!==Z)return Z-st;const we=he.get(Le.id),_e=he.get(Be.id);return we!=null&&_e!=null?we-_e:we!=null?-1:_e!=null?1:(J.get(Le.id)??0)-(J.get(Be.id)??0)})},[n,e,Et,Ue]),tt=(B==null?void 0:B.label)||(Oe==null?void 0:Oe.name)||(Q==null?void 0:Q.draft.name)||(oe==null?void 0:oe.runtimeName)||"未选择智能体",ze=Ee.find(J=>J.id===Ke),Tt=w.useMemo(()=>(oe==null?void 0:oe.agentDraft)??(Q==null?void 0:Q.draft)??(be==null?void 0:be.draft)??xhe(Oe,(B==null?void 0:B.label)??"agent"),[Oe,B==null?void 0:B.label,be==null?void 0:be.draft,Q==null?void 0:Q.draft,oe==null?void 0:oe.agentDraft]),Re=w.useMemo(()=>{if(oe)return oe;if(Q)return d.filter(J=>{var he,Le;return((he=J.agentDraft)==null?void 0:he.name)===Q.draft.name||J.runtimeName===Q.draft.name||!!((Le=Q.deploymentTarget)!=null&&Le.runtimeId)&&J.runtimeId===Q.deploymentTarget.runtimeId}).sort((J,he)=>he.startedAt-J.startedAt)[0];if(B)return d.filter(J=>!!B.runtimeId&&J.runtimeId===B.runtimeId||J.runtimeName===B.label).sort((J,he)=>he.startedAt-J.startedAt)[0]},[d,B,Q,oe]);w.useEffect(()=>{if(!f)return;const J=d.find(Le=>Le.id===f),he=J!=null&&J.runtimeId?it.get(J.runtimeId):void 0;if(he){M(""),U(""),O(he.id),S("basic");return}O(""),U(""),M(f),S("basic")},[it,d,f]),w.useEffect(()=>{!h||!e.some(J=>J.id===h)||(M(""),U(""),O(h),S("basic"))},[e,h]),w.useEffect(()=>{let J=!1;if(T(null),!!(B!=null&&B.runtimeId))return Uw(B.runtimeId,B.region??"cn-beijing").then(he=>{J||T(he)}).catch(()=>{J||T(null)}),()=>{J=!0}},[B==null?void 0:B.region,B==null?void 0:B.runtimeId]);const kt=de.filter(J=>{if(J.kind!==F)return!1;const he=V.trim().toLowerCase();return he?`${J.input} ${J.expectation} ${J.tag}`.toLowerCase().includes(he):!0}),Pt=J=>{Te(he=>he.map(Le=>Le.id===J.id?J:Le))},Bt=()=>{const J=new Set(e.map(Be=>Be.id)),he=n.filter(Be=>J.has(Be)),Le=new Set(he);return[...he,...e.filter(Be=>!Le.has(Be.id)).map(Be=>Be.id)]},bn=(J,he,Le)=>{if(!m||J===he)return;const Be=Bt().filter(st=>st!==J),ot=Be.indexOf(he),It=ot<0?Be.length:Le==="after"?ot+1:ot;Be.splice(It,0,J),m(Be)},Xe=(J,he)=>{if(!P||P===he)return;const Le=J.currentTarget.getBoundingClientRect();re(he),ee(J.clientY>Le.top+Le.height/2?"after":"before")},ft=(J,he)=>{if(!m)return;const Le=Bt(),Be=Le.indexOf(J),ot=Math.max(0,Math.min(Le.length-1,Be+he));Be<0||Be===ot||(Le.splice(Be,1),Le.splice(ot,0,J),m(Le))},xt=async J=>{if(!(!y||J.canDelete!==!0||le)&&window.confirm(`确定删除 Agent "${J.label}"?该 Runtime 将被永久删除。`)){ne(!0),ye("");try{await y([J]),A===J.id&&O("")}catch(he){ye(he instanceof Error?he.message:String(he))}finally{ne(!1)}}},vt=J=>{if(!E||le)return;const he=J.draft.name||"未命名 Agent";window.confirm(`确定删除草稿 "${he}"?`)&&(ye(""),E([J]),D===J.id&&U(""))},fe=()=>{const J=`eval-${Date.now()}`,he={id:J,name:`新评测组 ${Ee.length+1}`,agentIds:[],caseSet:"核心回归集",evaluator:"综合质量评估器",metrics:["回答质量"],concurrency:"4",history:[]};Te(Le=>[he,...Le]),Ne(J)},$e=J=>{Pt({...J,history:[{id:`run-${Date.now()}`,createdAt:"刚刚",score:86+J.history.length%7,status:"completed"},...J.history]})};return l.jsxs("div",{className:"aw-root",children:[l.jsxs("nav",{className:"aw-view-tabs","aria-label":"智能体工作台",children:[l.jsx("button",{type:"button",className:k==="library"?"is-active":"","aria-pressed":k==="library",onClick:()=>{N("library"),R("")},children:"智能体库"}),l.jsx("button",{type:"button",className:k==="evaluation"?"is-active":"","aria-pressed":k==="evaluation",onClick:()=>{N("evaluation"),R("")},children:"评测"})]}),l.jsxs("div",{className:"aw-workspace-frame",children:[l.jsxs("div",{className:"aw-workspace","aria-hidden":k==="evaluation"||void 0,ref:J=>J==null?void 0:J.toggleAttribute("inert",k==="evaluation"),children:[l.jsxs("aside",{className:"aw-sidebar","aria-label":k==="library"?"智能体列表":"评测组列表",children:[l.jsxs("label",{className:"aw-search",children:[l.jsx(Vd,{"aria-hidden":!0}),l.jsx("input",{value:L,onChange:J=>R(J.currentTarget.value),placeholder:k==="library"?"搜索智能体":"搜索评测组","aria-label":k==="library"?"搜索智能体":"搜索评测组"})]}),l.jsxs("button",{type:"button",className:"aw-create-card",onClick:k==="library"?x:fe,disabled:k==="library"&&!a,children:[l.jsx(rr,{"aria-hidden":!0}),l.jsx("span",{children:k==="library"?"新建 Agent":"新建评测组"})]}),k==="library"&&me&&l.jsx("div",{className:"aw-delete-error",role:"alert",children:me}),l.jsx("div",{className:"aw-agent-list",children:k==="evaluation"?ct.length===0?l.jsx("div",{className:"aw-list-empty",children:"没有匹配的评测组"}):ct.map(J=>l.jsxs("button",{type:"button",className:`aw-agent-item${J.id===Ke?" is-active":""}`,onClick:()=>Ne(J.id),children:[l.jsxs("span",{className:"aw-agent-copy aw-eval-group-copy",children:[l.jsx("strong",{children:J.name}),l.jsxs("small",{children:[J.agentIds.length," 个智能体 · ",J.history.length," 次运行"]})]}),l.jsx(id,{"aria-hidden":!0})]},J.id)):c&&Ye.length===0&&rt.length===0?l.jsx("div",{className:"aw-list-empty",children:"正在读取云端智能体…"}):u&&Ye.length===0&&rt.length===0?l.jsxs("div",{className:"aw-list-empty aw-list-error",children:[l.jsx("span",{children:u}),p&&l.jsx("button",{type:"button",onClick:p,children:"重试"})]}):Ye.length===0&&rt.length===0?l.jsx("div",{className:"aw-list-empty",children:"没有匹配的智能体"}):l.jsxs(l.Fragment,{children:[rt.map(J=>{const he=d.filter(Le=>{var Be,ot;return((Be=Le.agentDraft)==null?void 0:Be.name)===J.draft.name||Le.runtimeName===J.draft.name||!!((ot=J.deploymentTarget)!=null&&ot.runtimeId)&&Le.runtimeId===J.deploymentTarget.runtimeId}).sort((Le,Be)=>Be.startedAt-Le.startedAt)[0];return l.jsxs("button",{type:"button",className:`aw-agent-item${J.id===D?" is-active":""}`,onClick:()=>{O(""),M(""),U(J.id),S("basic")},children:[l.jsxs("span",{className:"aw-agent-copy",children:[l.jsxs("span",{className:"aw-agent-name-row",children:[l.jsx("strong",{children:J.draft.name||"未命名 Agent"}),l.jsx("span",{className:`aw-draft-badge${(he==null?void 0:he.status)==="running"?" is-deploying":""}`,children:(he==null?void 0:he.status)==="running"?"部署中":"草稿"})]}),l.jsx("small",{children:J.deploymentTarget?"待更新":"尚未发布"})]}),l.jsx(id,{"aria-hidden":!0})]},J.id)}),Ye.map(J=>{const he=J.runtimeId?Ue.get(J.runtimeId):void 0,Le=J.runtimeId?He.get(J.runtimeId):void 0,Be=(he==null?void 0:he.status)==="running"?{label:"部署中",className:" is-deploying"}:(he==null?void 0:he.status)==="error"?{label:"失败",className:" is-error"}:(he==null?void 0:he.status)==="cancelled"?{label:"已取消",className:" is-muted"}:Le?{label:"待更新",className:""}:null,ot=(he==null?void 0:he.status)==="running"?"正在更新部署":Le?"待更新":J.remote?J.host||"远程智能体":"本地智能体",It=["aw-agent-item","aw-agent-item--sortable",J.id===A?"is-active":"",J.id===P?"is-dragging":"",J.id===G&&J.id!==P?`is-drop-target is-drop-${ue}`:""].filter(Boolean).join(" ");return l.jsxs("button",{type:"button",draggable:!!m,className:It,"aria-keyshortcuts":m?"Alt+ArrowUp Alt+ArrowDown":void 0,onDragStart:st=>{m&&(te.current=!0,ie(J.id),st.dataTransfer.effectAllowed="move",st.dataTransfer.setData("text/plain",J.id))},onDragEnter:st=>{Xe(st,J.id)},onDragOver:st=>{!P||P===J.id||(st.preventDefault(),st.dataTransfer.dropEffect="move",Xe(st,J.id))},onDragLeave:st=>{const Z=st.relatedTarget;Z instanceof Node&&st.currentTarget.contains(Z)||G===J.id&&re("")},onDrop:st=>{st.preventDefault();const Z=st.dataTransfer.getData("text/plain")||P;bn(Z,J.id,ue),ie(""),re(""),ee("before")},onDragEnd:()=>{ie(""),re(""),ee("before"),window.setTimeout(()=>{te.current=!1},0)},onKeyDown:st=>{st.altKey&&(st.key==="ArrowUp"?(st.preventDefault(),ft(J.id,-1)):st.key==="ArrowDown"&&(st.preventDefault(),ft(J.id,1)))},onClick:st=>{if(te.current){st.preventDefault(),te.current=!1;return}M(""),U(""),O(J.id),S("basic"),g(J.id)},children:[l.jsxs("span",{className:"aw-agent-copy",children:[l.jsxs("span",{className:"aw-agent-name-row",children:[l.jsx("strong",{children:J.label}),J.currentVersion!=null&&l.jsxs("span",{className:"aw-version-badge",children:["v",J.currentVersion]}),Be&&l.jsx("span",{className:`aw-draft-badge${Be.className}`,children:Be.label})]}),l.jsx("small",{children:ot})]}),l.jsx(id,{"aria-hidden":!0})]},J.id)})]})}),l.jsxs("div",{className:"aw-list-count",children:["共 ",k==="library"?e.length+St:Ee.length," 个"]})]}),k==="evaluation"&&ze?l.jsx(khe,{group:ze,agents:e,cases:de,onChange:Pt,onRun:$e}):k==="evaluation"?l.jsx("main",{className:"aw-main aw-empty-selection",children:l.jsx("p",{children:"未选择评测组"})}):!B&&!Q&&!oe?l.jsx("main",{className:"aw-main aw-empty-selection",children:l.jsx("p",{children:"未选择智能体"})}):(Re==null?void 0:Re.status)==="running"?l.jsx("main",{className:"aw-main aw-deployment-focus",children:l.jsx(MA,{task:Re})}):l.jsxs("main",{className:"aw-main",children:[l.jsx("div",{className:"aw-agent-head",children:l.jsxs("div",{children:[l.jsxs("div",{className:"aw-agent-title-row",children:[l.jsx("h2",{children:tt}),(B==null?void 0:B.currentVersion)!=null&&l.jsxs("span",{children:["v",B.currentVersion]}),Q&&l.jsx("span",{children:"草稿"}),be&&l.jsx("span",{children:"待更新"}),!B&&!Q&&oe&&l.jsx("span",{children:oe.label})]}),l.jsx("p",{children:Tt.description||(i?"正在读取智能体信息…":"暂无描述")})]})}),l.jsx("nav",{className:"aw-agent-tabs","aria-label":"智能体详情",children:Ehe.map(J=>l.jsx("button",{type:"button",className:C===J.id?"is-active":"","aria-pressed":C===J.id,onClick:()=>S(J.id),children:J.label},J.id))}),l.jsxs("div",{className:"aw-content",children:[C==="basic"&&l.jsxs("div",{className:"aw-basic-stack",children:[l.jsxs("section",{className:"aw-canvas-card",children:[l.jsx("div",{className:"aw-card-head",children:l.jsx("strong",{children:"执行流程"})}),l.jsx("div",{className:"aw-canvas",children:l.jsx(Xm,{draft:Tt,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0})})]}),l.jsxs("section",{className:"aw-details-card",children:[l.jsx("div",{className:"aw-card-head",children:l.jsx("strong",{children:"详细信息"})}),l.jsxs("dl",{className:"aw-facts",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"模型"}),l.jsx("dd",{children:(Oe==null?void 0:Oe.model)||Tt.modelName||"暂未提供"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"智能体数量"}),l.jsx("dd",{children:Oe!=null&&Oe.graph?j4(Oe.graph):D4(Tt)})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"工具"}),l.jsx("dd",{children:(Oe==null?void 0:Oe.tools.length)??Tt.tools.length+(((nt=Tt.builtinTools)==null?void 0:nt.length)??0)+(((qt=Tt.customTools)==null?void 0:qt.length)??0)+(((fn=Tt.mcpTools)==null?void 0:fn.length)??0)})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"技能"}),l.jsx("dd",{children:Oe?Oe.skillsPreviewSupported?Oe.skills.length:"暂不支持预览":((Lt=Tt.selectedSkills)==null?void 0:Lt.length)??Tt.skills.length})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"当前版本"}),l.jsx("dd",{children:(j==null?void 0:j.currentVersion)!=null?`v${j.currentVersion}`:(B==null?void 0:B.currentVersion)!=null?`v${B.currentVersion}`:"暂未提供"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"状态"}),l.jsx("dd",{children:Q?"草稿":(Re==null?void 0:Re.status)==="error"?"部署失败":(Re==null?void 0:Re.status)==="cancelled"?"已取消":be?"待更新":l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"aw-status-dot"}),"可用"]})})]})]})]}),Re&&l.jsx(MA,{task:Re}),l.jsxs("section",{className:"aw-deployment-panel aw-settings-card",children:[l.jsx("div",{className:"aw-section-head",children:l.jsxs("div",{children:[l.jsx("h3",{children:"部署配置"}),l.jsx("p",{children:"配置目标环境与网络访问方式。"})]})}),l.jsxs("dl",{className:"aw-readonly-config",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"运行状态"}),l.jsx("dd",{children:(j==null?void 0:j.status)||"读取中…"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"部署区域"}),l.jsx("dd",{children:(j==null?void 0:j.region)||(B==null?void 0:B.region)||(Re==null?void 0:Re.region)||"暂未提供"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"网络访问"}),l.jsx("dd",{children:j!=null&&j.networkTypes.length?j.networkTypes.join(" / "):"暂未提供"})]})]})]}),l.jsxs("section",{className:"aw-option-panel aw-settings-card",children:[l.jsx("div",{className:"aw-section-head",children:l.jsxs("div",{children:[l.jsx("h3",{children:"优化项"}),l.jsx("p",{children:"针对运行质量开启专项优化策略。"})]})}),l.jsxs("div",{className:"aw-option-content",children:[l.jsx("div",{className:"aw-option-list","aria-disabled":"true",children:[["上下文优化","压缩冗余信息,保留对当前任务最有价值的上下文。"],["幻觉抑制","在证据不足时降低确定性表达并主动请求补充信息。"],["工具调用优化","减少重复调用,并优先复用已经获得的结果。"]].map(([J,he])=>l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",disabled:!0}),l.jsxs("span",{children:[l.jsx("strong",{children:J}),l.jsx("small",{children:he})]})]},J))}),l.jsx("div",{className:"aw-option-glass",role:"status",children:l.jsx("span",{children:"暂未开放"})})]})]})]}),C==="evaluations"&&l.jsxs("section",{className:"aw-cases",children:[l.jsx("div",{className:"aw-case-filters",children:["good","bad"].map(J=>l.jsx("button",{type:"button",className:F===J?"is-active":"","aria-pressed":F===J,onClick:()=>I(J),children:J==="good"?"Good case":"Bad case"},J))}),l.jsxs("label",{className:"aw-case-search",children:[l.jsx(Vd,{"aria-hidden":!0}),l.jsx("input",{type:"search",value:V,onChange:J=>W(J.currentTarget.value),placeholder:"搜索用户输入、期望行为或标签","aria-label":"搜索评测案例"})]}),l.jsx(_he,{cases:kt})]})]}),C==="basic"&&(B||Q)&&l.jsxs("div",{className:"aw-basic-actions",children:[l.jsx("button",{type:"button",className:"aw-update studio-update-action",disabled:Q||be?!a:!(B!=null&&B.runtimeId)||!o||i||!Oe,onClick:()=>Q?_==null?void 0:_(Q):be?_==null?void 0:_(be):b(Tt),children:Q||be?"继续编辑":"更新"}),(Q||be)&&l.jsxs("button",{type:"button",className:"aw-head-delete studio-update-action",onClick:()=>{const J=Q??be;J&&vt(J)},disabled:le,"aria-label":"删除草稿",title:"删除草稿",children:[l.jsx(ea,{"aria-hidden":!0}),l.jsx("span",{children:"删除草稿"})]}),(B==null?void 0:B.canDelete)&&l.jsxs("button",{type:"button",className:"aw-head-delete studio-update-action",onClick:()=>void xt(B),disabled:le,"aria-label":"删除 Agent",title:"删除 Agent",children:[l.jsx(ea,{"aria-hidden":!0}),l.jsx("span",{children:le?"删除中…":"删除 Agent"})]})]})]})]}),k==="evaluation"&&l.jsx("div",{className:"aw-evaluation-glass",role:"status",children:l.jsx("span",{children:"敬请期待"})})]})]})}function _he({cases:e}){return l.jsxs("div",{className:"aw-case-table",children:[l.jsxs("div",{className:"aw-case-row aw-case-row-head",children:[l.jsx("span",{children:"用户输入"}),l.jsx("span",{children:"期望行为"}),l.jsx("span",{children:"标签"})]}),e.length===0?l.jsx("div",{className:"aw-case-empty",children:"没有匹配的案例"}):e.map(t=>l.jsxs("div",{className:"aw-case-row",children:[l.jsx("strong",{children:t.input}),l.jsx("p",{children:t.expectation}),l.jsx("span",{className:"aw-case-tag",children:t.tag})]},t.id))]})}function khe({group:e,agents:t,cases:n,onChange:r,onRun:s}){const[i,a]=w.useState("config"),o=e.agentIds.map(f=>t.find(h=>h.id===f)).filter(f=>!!f),c=["回答质量","事实准确性","工具调用","响应效率"];w.useEffect(()=>a("config"),[e.id]);const u=f=>{r({...e,agentIds:e.agentIds.includes(f)?e.agentIds.filter(h=>h!==f):[...e.agentIds,f]})},d=f=>{r({...e,metrics:e.metrics.includes(f)?e.metrics.filter(h=>h!==f):[...e.metrics,f]})};return l.jsxs("main",{className:"aw-main",children:[l.jsxs("div",{className:"aw-eval-head",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"aw-agent-title-row",children:[l.jsx("h2",{children:e.name}),l.jsx("span",{children:"评测组"})]}),l.jsxs("p",{children:[o.length," 个参评智能体 · ",e.caseSet," · ",e.history.length," 次运行"]})]}),l.jsxs("button",{type:"button",className:"aw-run",onClick:()=>s(e),disabled:!0,children:[l.jsx(SH,{"aria-hidden":!0}),"开始评测"]})]}),l.jsxs("nav",{className:"aw-agent-tabs","aria-label":"评测组详情",children:[l.jsx("button",{type:"button",className:i==="config"?"is-active":"","aria-pressed":i==="config",onClick:()=>a("config"),disabled:!0,children:"评测配置"}),l.jsx("button",{type:"button",className:i==="history"?"is-active":"","aria-pressed":i==="history",onClick:()=>a("history"),disabled:!0,children:"历史结果"})]}),l.jsx("div",{className:"aw-content",children:i==="config"?l.jsxs("div",{className:"aw-eval-setup",children:[l.jsxs("section",{className:"aw-eval-block",children:[l.jsxs("div",{className:"aw-card-head",children:[l.jsx("strong",{children:"参评智能体"}),l.jsxs("span",{children:["已选择 ",o.length," 个"]})]}),l.jsx("div",{className:"aw-eval-agent-grid",children:t.map(f=>l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",checked:e.agentIds.includes(f.id),onChange:()=>u(f.id)}),l.jsxs("span",{children:[l.jsx("strong",{children:f.label}),l.jsx("small",{children:f.remote?"远程":"本地"})]})]},f.id))})]}),l.jsxs("div",{className:"aw-eval-setting-grid",children:[l.jsxs("section",{className:"aw-eval-block",children:[l.jsx("div",{className:"aw-card-head",children:l.jsx("strong",{children:"评测资源"})}),l.jsxs("div",{className:"aw-eval-fields",children:[l.jsxs("label",{children:[l.jsx("span",{children:"评测集"}),l.jsxs("select",{value:e.caseSet,onChange:f=>r({...e,caseSet:f.currentTarget.value}),children:[l.jsx("option",{children:"核心回归集"}),l.jsx("option",{children:"安全边界集"}),l.jsx("option",{children:"工具调用集"})]}),l.jsxs("small",{children:[n.length," 条案例"]})]}),l.jsxs("label",{children:[l.jsx("span",{children:"评估器"}),l.jsxs("select",{value:e.evaluator,onChange:f=>r({...e,evaluator:f.currentTarget.value}),children:[l.jsx("option",{children:"综合质量评估器"}),l.jsx("option",{children:"事实一致性评估器"}),l.jsx("option",{children:"工具调用评估器"})]})]}),l.jsxs("label",{children:[l.jsx("span",{children:"并发数"}),l.jsxs("select",{value:e.concurrency,onChange:f=>r({...e,concurrency:f.currentTarget.value}),children:[l.jsx("option",{value:"2",children:"2"}),l.jsx("option",{value:"4",children:"4"}),l.jsx("option",{value:"8",children:"8"})]})]})]})]}),l.jsxs("section",{className:"aw-eval-block",children:[l.jsxs("div",{className:"aw-card-head",children:[l.jsx("strong",{children:"评测指标"}),l.jsxs("span",{children:["已选择 ",e.metrics.length," 项"]})]}),l.jsx("div",{className:"aw-metric-list",children:c.map(f=>l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",checked:e.metrics.includes(f),onChange:()=>d(f)}),l.jsx("span",{children:f})]},f))})]})]})]}):l.jsxs("section",{className:"aw-eval-history",children:[l.jsx("div",{className:"aw-section-head",children:l.jsxs("div",{children:[l.jsx("h3",{children:"历史结果"}),l.jsx("p",{children:"查看该评测组历次运行的总体表现。"})]})}),e.history.length===0?l.jsxs("div",{className:"aw-results-empty",children:[l.jsx("strong",{children:"暂无历史结果"}),l.jsx("span",{children:"完成首次评测后,结果会出现在这里。"})]}):l.jsx("div",{className:"aw-history-list",children:e.history.map((f,h)=>l.jsxs("button",{type:"button",children:[l.jsxs("span",{children:[l.jsxs("strong",{children:["评测运行 #",e.history.length-h]}),l.jsxs("small",{children:[f.createdAt," · ",o.length," 个智能体"]})]}),l.jsxs("span",{className:"aw-history-score",children:[l.jsx("strong",{children:f.score}),l.jsx("small",{children:"综合得分"})]}),l.jsxs("span",{className:"aw-complete",children:[l.jsx(Js,{}),"已完成"]}),l.jsx(id,{"aria-hidden":!0})]},f.id))})]})})]})}const Nhe={formatDate(e){const t=e.value??e.date??e.timestamp;if(t==null)return"";const n=new Date(t);return isNaN(n.getTime())?String(t):n.toLocaleString()}};function She(e,t){if(!t||t==="/")return e;const n=t.replace(/^\//,"").split("/").map(s=>s.replace(/~1/g,"/").replace(/~0/g,"~"));let r=e;for(const s of n){if(r==null||typeof r!="object")return;r=r[s]}return r}function The(e){return typeof e=="object"&&e!==null&&typeof e.path=="string"}function Ahe(e){return typeof e=="object"&&e!==null&&typeof e.call=="string"}function Hv(e,t){if(The(e))return She(t,e.path);if(Ahe(e)){const n=Nhe[e.call],r={};for(const[s,i]of Object.entries(e.args??{}))r[s]=Hv(i,t);return n?n(r):`[unknown fn: ${e.call}]`}return e}function Che(e,t){const n=Hv(e,t);return n==null?"":typeof n=="string"?n:String(n)}const P4=new Map;function el(e,t){P4.set(e,t)}function Ihe(e){return P4.get(e)}function Ohe(e,t,n){const r=t.replace(/^\//,"").split("/").map(i=>i.replace(/~1/g,"/").replace(/~0/g,"~"));let s=e;for(let i=0;iHv(r,e.dataModel),resolveString:r=>Che(r,e.dataModel),dispatchAction:t,render:r=>{if(!r)return null;const s=e.components[r];if(!s)return null;const i=Ihe(s.component)??Rhe;return l.jsx(i,{node:s,ctx:n},r)}};return l.jsx("div",{className:"a2ui-surface","data-a2ui-surface":e.surfaceId,children:n.render(e.rootId)})}function Mhe(e){const t=w.useRef(null),n=w.useRef(!0),r=28,s=w.useCallback(()=>{const i=t.current;i&&(n.current=i.scrollHeight-i.scrollTop-i.clientHeight{const i=t.current;i&&n.current&&(i.scrollTop=i.scrollHeight)},[e]),{ref:t,onScroll:s}}function zv({value:e,onRemoveSkill:t,onRemoveAgent:n}){return e.skills.length===0&&!e.targetAgent?null:l.jsxs("div",{className:"invocation-chips","aria-label":"本轮调用上下文",children:[e.skills.map(r=>l.jsxs("span",{className:"invocation-chip invocation-chip--skill",title:r.description,children:[l.jsx(Po,{"aria-hidden":!0}),l.jsxs("span",{children:["/",r.name]}),t?l.jsx("button",{type:"button",onClick:()=>t(r.name),"aria-label":`移除技能 ${r.name}`,children:l.jsx(zr,{})}):null]},r.name)),e.targetAgent?l.jsxs("span",{className:"invocation-chip invocation-chip--agent",title:e.targetAgent.description,children:[l.jsx(xL,{"aria-hidden":!0}),l.jsx("span",{children:e.targetAgent.name}),n?l.jsx("button",{type:"button",onClick:n,"aria-label":`移除 Agent ${e.targetAgent.name}`,children:l.jsx(zr,{})}):null]}):null]})}function Vv(e=""){return e.startsWith("image/")?"image":e.startsWith("video/")?"video":e==="application/pdf"?"pdf":e==="text/markdown"?"markdown":"text"}function F4(e){var n,r,s,i;const t=Vv(e.mimeType);return t==="pdf"?"PDF":t==="markdown"?"MD":t==="video"?((r=(n=e.mimeType)==null?void 0:n.split("/")[1])==null?void 0:r.toUpperCase())??"VIDEO":t==="image"?((i=(s=e.mimeType)==null?void 0:s.split("/")[1])==null?void 0:i.toUpperCase())??"IMAGE":"TXT"}function U4(e){return e?e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:""}function $4(e,t){return e.previewUrl?e.previewUrl:e.data?`data:${e.mimeType??"application/octet-stream"};base64,${e.data}`:e.uri?YL(t,e.uri):""}function jhe({kind:e}){return e==="image"?l.jsx(TL,{}):e==="video"?l.jsx(NL,{}):e==="pdf"?l.jsx(kH,{}):l.jsx(kL,{})}function Kv({appName:e,items:t,compact:n=!1,onRemove:r}){const[s,i]=w.useState(null);return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:`media-grid${n?" media-grid--compact":""}`,children:t.map(a=>{const o=Vv(a.mimeType),c=$4(a,e),u=a.status==="uploading"||a.status==="error"||!c,d=l.jsxs("button",{type:"button",className:"media-card-main",disabled:u,onClick:()=>i(a),"aria-label":`预览 ${a.name??"附件"}`,children:[o==="image"&&c?l.jsx("img",{className:"media-card-image",src:c,alt:a.name??"图片",loading:"lazy"}):o==="video"&&c?l.jsxs("div",{className:"media-card-video-container",children:[l.jsx("video",{className:"media-card-video",src:c,muted:!0,playsInline:!0,preload:"metadata","aria-hidden":"true"}),l.jsx("span",{className:"media-card-video-play",children:l.jsx(zH,{})})]}):l.jsx("span",{className:"media-card-icon",children:l.jsx(jhe,{kind:o})}),l.jsxs("span",{className:"media-card-copy",children:[l.jsx("span",{className:"media-card-name",children:a.name??"附件"}),l.jsxs("span",{className:"media-card-meta",children:[l.jsx("span",{className:"media-card-type",children:F4(a)}),a.status==="uploading"?l.jsxs(l.Fragment,{children:[l.jsx(Rt,{className:"media-card-spinner"})," 上传中"]}):a.status==="error"?a.error??"上传失败":U4(a.sizeBytes)]})]}),!n&&a.status!=="uploading"&&a.status!=="error"?l.jsx(tc,{className:"media-card-open"}):null]});return l.jsxs($t.div,{className:`media-card media-card--${o}${a.status==="error"?" media-card--error":""}`,layout:!0,initial:{opacity:0,scale:.985,y:4},animate:{opacity:1,scale:1,y:0},children:[o==="image"&&!u?l.jsx(mL,{src:c,children:d}):d,r?l.jsx("button",{type:"button",className:"media-card-remove","aria-label":`移除 ${a.name??"附件"}`,onClick:()=>r(a.id),children:l.jsx(zr,{})}):null]},a.id)})}),l.jsx(pi,{children:s?l.jsx(Dhe,{appName:e,item:s,onClose:()=>i(null)}):null})]})}function Dhe({appName:e,item:t,onClose:n}){const r=w.useMemo(()=>$4(t,e),[e,t]),s=Vv(t.mimeType),[i,a]=w.useState(""),[o,c]=w.useState(s==="text"||s==="markdown"),[u,d]=w.useState("");return w.useEffect(()=>{const f=h=>{h.key==="Escape"&&n()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[n]),w.useEffect(()=>{if(s!=="text"&&s!=="markdown")return;const f=new AbortController;return c(!0),d(""),fetch(r,{signal:f.signal}).then(h=>{if(!h.ok)throw new Error(`HTTP ${h.status}`);return h.text()}).then(a).catch(h=>{f.signal.aborted||d(h instanceof Error?h.message:String(h))}).finally(()=>{f.signal.aborted||c(!1)}),()=>f.abort()},[s,r]),l.jsx($t.div,{className:"media-viewer-backdrop",role:"dialog","aria-modal":"true","aria-label":t.name??"附件预览",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onMouseDown:f=>{f.target===f.currentTarget&&n()},children:l.jsxs($t.div,{className:"media-viewer",initial:{opacity:0,y:18,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:10,scale:.99},transition:{type:"spring",stiffness:420,damping:30},children:[l.jsxs("header",{className:"media-viewer-header",children:[l.jsxs("div",{children:[l.jsx("strong",{children:t.name??"附件"}),l.jsxs("span",{children:[F4(t),t.sizeBytes?` · ${U4(t.sizeBytes)}`:""]})]}),l.jsxs("nav",{children:[l.jsx("a",{href:r,download:t.name,"aria-label":"下载",children:l.jsx(Cw,{})}),l.jsx("button",{type:"button",onClick:n,"aria-label":"关闭",children:l.jsx(zr,{})})]})]}),l.jsxs("div",{className:`media-viewer-body media-viewer-body--${s}`,children:[s==="image"?l.jsx("img",{src:r,alt:t.name??"图片"}):null,s==="video"?l.jsx("div",{className:"media-viewer-video-wrapper",children:l.jsx("video",{src:r,controls:!0,autoPlay:!0,playsInline:!0,preload:"auto",className:"media-viewer-video"})}):null,s==="pdf"?l.jsx("iframe",{src:r,title:t.name??"PDF"}):null,o?l.jsxs("div",{className:"media-viewer-loading",children:[l.jsx(Rt,{})," 正在读取文档…"]}):null,!o&&u?l.jsxs("div",{className:"media-viewer-loading",children:["文档加载失败:",u]}):null,!o&&s==="markdown"?l.jsx("div",{className:"media-document",children:l.jsx(Mf,{text:i})}):null,!o&&s==="text"?l.jsx("pre",{className:"media-document media-document--plain",children:i}):null]})]})})}function Phe(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("circle",{cx:"10.25",cy:"10.25",r:"6.25"}),l.jsx("path",{d:"M4.15 10.25h12.2M10.25 4c1.65 1.72 2.5 3.8 2.5 6.25s-.85 4.53-2.5 6.25M10.25 4c-1.65 1.72-2.5 3.8-2.5 6.25s.85 4.53 2.5 6.25M14.8 14.8 20 20"})]})}function Bhe(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("rect",{x:"3.25",y:"5.25",width:"15.5",height:"13.5",rx:"2.25"}),l.jsx("circle",{cx:"8.1",cy:"9.3",r:"1.35"}),l.jsx("path",{d:"m4.7 16.5 3.65-3.7 2.45 2.25 2.2-2.2 4.35 4.1"}),l.jsx("path",{d:"m19.4 2.75.48 1.37 1.37.48-1.37.48-.48 1.37-.48-1.37-1.37-.48 1.37-.48.48-1.37Z",fill:"currentColor",stroke:"none"})]})}function Fhe(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("rect",{x:"3.25",y:"5.5",width:"16.25",height:"13",rx:"2.4"}),l.jsx("path",{d:"m10.2 9.2 4.4 2.8-4.4 2.8V9.2Z"}),l.jsx("path",{d:"m19.25 2.5.42 1.2 1.2.42-1.2.42-.42 1.2-.42-1.2-1.2-.42 1.2-.42.42-1.2Z",fill:"currentColor",stroke:"none"})]})}function Uhe(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("path",{d:"M5 7.4c0-1.55 3.13-2.8 7-2.8s7 1.25 7 2.8-3.13 2.8-7 2.8-7-1.25-7-2.8Z"}),l.jsx("path",{d:"M5 7.4v4.55c0 1.55 3.13 2.8 7 2.8s7-1.25 7-2.8V7.4M5 11.95v4.55c0 1.55 3.13 2.8 7 2.8s7-1.25 7-2.8v-4.55"}),l.jsx("path",{d:"M8.2 12.25h.01M8.2 16.8h.01"})]})}function $he(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("path",{d:"M4.25 4.25h4.5v15.5h-4.5zM8.75 5.75h5v14h-5zM13.75 4.25h4.1v10.25h-4.1z"}),l.jsx("path",{d:"M5.75 7h1.5M10.25 8.25h2M10.25 11h2M15.15 7h1.3"}),l.jsx("circle",{cx:"17.45",cy:"17.35",r:"2.45"}),l.jsx("path",{d:"m19.25 19.15 1.55 1.55"})]})}function Hhe(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("path",{d:"M4.25 6.25h6.25c1 0 1.5.55 1.5 1.45v11.05c0-.9-.5-1.45-1.5-1.45H4.25V6.25Z"}),l.jsx("path",{d:"M19.75 9.1v8.2H13.5c-1 0-1.5.55-1.5 1.45V7.7c0-.9.5-1.45 1.5-1.45h2.15"}),l.jsx("path",{d:"m19 3.2.58 1.62 1.62.58-1.62.58L19 7.6l-.58-1.62-1.62-.58 1.62-.58L19 3.2Z",fill:"currentColor",stroke:"none"})]})}function zhe(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("path",{d:"m4.2 8.4 1.15 10.2h13.3L19.8 8.4"}),l.jsx("path",{d:"M4.2 8.4h15.6L17.9 5H6.1L4.2 8.4Z"}),l.jsx("path",{d:"M7.2 12.2c1.1-1 2.25 1.25 3.4.25 1.05-.9 2.15 1.3 3.3.25"}),l.jsx("path",{d:"m8.2 15.1 1.45 1.35 1.45-1.35M13.55 16.45h2.35"})]})}function H4(e){return l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:l.jsx("path",{d:"m6 3.25 4.5 4.75L6 12.75"})})}function Vhe({definition:e,label:t,done:n,open:r,onToggle:s}){const i=e.icon,a=t??(n?e.doneLabel:e.runningLabel);return l.jsxs("button",{type:"button",className:`builtin-tool-head${n?" is-done":" is-running"}`,"data-tool-tone":e.tone,onClick:s,"aria-expanded":r,children:[l.jsx("span",{className:"builtin-tool-icon","aria-hidden":"true",children:l.jsx(i,{})}),n?l.jsx("span",{className:"builtin-tool-label",children:a}):l.jsx(ta,{className:"builtin-tool-label",duration:2.4,spread:18,"aria-live":"polite",children:a}),l.jsx(H4,{className:`builtin-tool-chevron${r?" is-open":""}`})]})}const Khe={web_search:{name:"web_search",runningLabel:"正在进行网络搜索",doneLabel:"已完成网络搜索",tone:"search",icon:Phe},run_code:{name:"run_code",runningLabel:"正在 AgentKit 沙箱中执行代码",doneLabel:"已在 AgentKit 沙箱中完成代码执行",tone:"sandbox",icon:zhe},image_generate:{name:"image_generate",runningLabel:"正在生成图片",doneLabel:"已完成图片生成",tone:"image",icon:Bhe},video_generate:{name:"video_generate",runningLabel:"正在生成视频",doneLabel:"已完成视频生成",tone:"video",icon:Fhe},load_memory:{name:"load_memory",runningLabel:"正在检索长期记忆",doneLabel:"已完成记忆检索",tone:"memory",icon:Uhe},load_knowledgebase:{name:"load_knowledgebase",runningLabel:"正在检索知识库",doneLabel:"已完成知识库检索",tone:"knowledge",icon:$he},load_skill:{name:"load_skill",runningLabel:"正在加载技能",doneLabel:"已加载技能",tone:"skill",icon:Hhe}};function Yhe(e){return Khe[e]}const z4="send_a2ui_json_to_client",Whe=28;function Ghe(e,t,n){let r=t;for(let s=0;s65535?2:1}return r}function qhe(e){return e<=4?1:Math.min(18,Math.max(2,Math.ceil(e/6)))}function V4(e,t,n){const[r,s]=w.useState(()=>t?"":e),i=w.useRef(r),a=w.useRef(e),o=w.useRef(null),c=w.useRef(0),u=w.useRef(n);return a.current=e,u.current=n,w.useEffect(()=>{const d=i.current,f=window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(!t||f||!e.startsWith(d)){o.current!==null&&window.cancelAnimationFrame(o.current),o.current=null,d!==e&&(i.current=e,s(e));return}if(d===e||o.current!==null)return;const h=p=>{const m=a.current,y=i.current;if(!m.startsWith(y)){i.current=m,s(m),o.current=null;return}if(p-c.current{var d;(d=u.current)==null||d.call(u)},[r]),w.useEffect(()=>()=>{o.current!==null&&(window.cancelAnimationFrame(o.current),o.current=null)},[]),r}function Xhe({className:e}){return l.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:l.jsx("path",{d:"M12 2.2l1.7 5.1a3 3 0 0 0 1.9 1.9L20.8 11l-5.1 1.7a3 3 0 0 0-1.9 1.9L12 19.8l-1.7-5.1a3 3 0 0 0-1.9-1.9L3.2 11l5.1-1.7a3 3 0 0 0 1.9-1.9L12 2.2z"})})}function Qhe(){return l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"M14.3 5.25a4.6 4.6 0 0 0-5.55 5.55L3.6 15.95a1.8 1.8 0 0 0 0 2.55l1.9 1.9a1.8 1.8 0 0 0 2.55 0l5.15-5.15a4.6 4.6 0 0 0 5.55-5.55l-2.9 2.9-2.45-.55-.55-2.45 2.9-2.9a4.6 4.6 0 0 0-1.45-1.45Z"})})}function Zhe(e,t){if(e!=="load_skill"||t==null||typeof t!="object"||Array.isArray(t))return;const n=t.skill_name;if(!(typeof n!="string"||!n.trim()))return`使用 ${n.trim()} 技能`}function K4({text:e,done:t,streaming:n=!1,onStreamFrame:r}){const[s,i]=w.useState(!t),a=w.useRef(!1);w.useEffect(()=>{a.current||i(!t)},[t]);const o=()=>{a.current=!0,i(h=>!h)},c=e.replace(/^\s+/,""),u=V4(c,!t||n,r),{ref:d,onScroll:f}=Mhe(u);return l.jsxs("div",{className:"block-thinking",children:[l.jsxs("button",{className:"think-head",onClick:o,type:"button",children:[l.jsx("span",{className:"think-icon","aria-hidden":"true",children:l.jsx(Xhe,{className:`spark ${t?"":"pulse"}`})}),t?l.jsx("span",{className:"think-label think-label--done",children:"已完成思考"}):l.jsx(ta,{className:"think-label",duration:2.4,spread:18,children:"思考中"}),l.jsx(ws,{className:`chev ${s?"open":""}`})]}),l.jsx("div",{className:`think-collapse ${s&&u?"open":""}`,children:l.jsx("div",{className:"think-collapse-inner",children:l.jsx("div",{className:"think-body scroll",ref:d,onScroll:f,children:u})})})]})}function Y4(){return l.jsx(K4,{text:"",done:!1})}const Jhe=w.memo(function({text:t,streaming:n,onStreamFrame:r}){const s=V4(t,n,r);return s?l.jsx("div",{className:"bubble",children:l.jsx(Mf,{text:s})}):null});function epe({name:e,args:t,response:n,done:r}){const[s,i]=w.useState(!1),a=e===z4?"渲染 UI":e,o=Yhe(e),c=n==null?null:typeof n=="string"?n:JSON.stringify(n,null,2),u=c&&c.length>2e3?c.slice(0,2e3)+` +…(已截断)`:c;return l.jsxs($t.div,{className:`block-tool${o?" block-tool--builtin":""}`,initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[o?l.jsx(Vhe,{definition:o,label:Zhe(e,t),done:r,open:s,onToggle:()=>i(d=>!d)}):l.jsxs("button",{className:"tool-head tool-head--generic",onClick:()=>i(d=>!d),type:"button","aria-expanded":s,children:[l.jsx("span",{className:"tool-icon tool-icon--generic","aria-hidden":"true",children:l.jsx(Qhe,{})}),r?l.jsx("span",{className:"tool-name",children:a}):l.jsx(ta,{className:"tool-name",duration:2.2,spread:15,children:a}),l.jsx(H4,{className:`tool-chevron${s?" is-open":""}`})]}),l.jsx("div",{className:`think-collapse ${s?"open":""}`,children:l.jsx("div",{className:"think-collapse-inner",children:l.jsxs("div",{className:"tool-detail",children:[t!=null&&l.jsxs("div",{className:"tool-section",children:[l.jsx("div",{className:"tool-section-label",children:"参数"}),l.jsx("pre",{className:"tool-args",children:JSON.stringify(t,null,2)})]}),u!=null&&l.jsxs("div",{className:"tool-section",children:[l.jsx("div",{className:"tool-section-label",children:"返回"}),l.jsx("pre",{className:"tool-args tool-result",children:u})]})]})})})]})}function tpe({block:e,onAuth:t}){const[n,r]=w.useState(e.done?"done":"idle"),[s,i]=w.useState(""),a=e.label||"MCP 工具集",o=(()=>{try{return e.authUri?new URL(e.authUri).host:""}catch{return""}})(),c=async()=>{if(t){i(""),r("authorizing");try{await t(e),r("done")}catch(d){i(d instanceof Error?d.message:String(d)),r("idle")}}};return e.done||n==="done"?l.jsxs($t.div,{className:"auth-card-collapsed",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},children:[l.jsx(uS,{className:"auth-card-icon auth-card-icon--done"}),l.jsxs("span",{children:["已授权 · ",a]})]}):l.jsxs($t.div,{className:"auth-card",initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[l.jsxs("div",{className:"auth-card-head",children:[l.jsx(uS,{className:"auth-card-icon"}),l.jsxs("span",{className:"auth-card-title",children:[a," 需要授权"]})]}),l.jsxs("p",{className:"auth-card-desc",children:["工具集 ",l.jsx("code",{className:"auth-card-code",children:a})," 使用 OAuth 保护, 需登录授权后方可调用。",o&&l.jsxs(l.Fragment,{children:[" ","将跳转至 ",l.jsx("code",{className:"auth-card-code",children:o})," 完成登录,"]}),"授权完成后对话自动继续。"]}),l.jsx("button",{className:"auth-card-btn",onClick:c,disabled:n==="authorizing"||!e.authUri,children:n==="authorizing"?l.jsxs(l.Fragment,{children:[l.jsx(Rt,{className:"cw-i spin"})," 等待授权…"]}):l.jsx(l.Fragment,{children:"去授权"})}),!e.authUri&&l.jsx("div",{className:"auth-card-err",children:"未在事件中找到授权地址。"}),s&&l.jsx("div",{className:"auth-card-err",children:s})]})}function Yv({blocks:e,appName:t="",streaming:n=!1,onStreamFrame:r,onAction:s,onAuth:i}){return l.jsx(l.Fragment,{children:e.map((a,o)=>{switch(a.kind){case"thinking":return l.jsx(K4,{text:a.text,done:a.done,streaming:n,onStreamFrame:r},o);case"text":{const c=a.text.replace(/^\s+/,"");return c?l.jsx(Jhe,{text:c,streaming:n,onStreamFrame:r},o):null}case"attachment":return l.jsx(Kv,{appName:t,items:a.files},o);case"invocation":return l.jsx(zv,{value:a.value},o);case"tool":return a.name===z4&&a.done?null:l.jsx(epe,{name:a.name,args:a.args,response:a.response,done:a.done},o);case"agent-transfer":return null;case"auth":return l.jsx(tpe,{block:a,onAuth:i},o);case"a2ui":return B4(a.messages).filter(c=>c.components[c.rootId]).map(c=>l.jsx($t.div,{initial:{opacity:0,y:8,scale:.985},animate:{opacity:1,y:0,scale:1},transition:{type:"spring",stiffness:380,damping:30},children:l.jsx(Lhe,{surface:c,onAction:s})},`${o}-${c.surfaceId}`));default:return null}})})}function W4(e){return e.isComposing||e.keyCode===229}const npe="/assets/arkclaw-DG3MhHYM.png",rpe="/assets/codex-Csw-JJxq.png",spe="/assets/hermes-C6L-CfGS.png",js=[{value:"agent",label:"Agent",description:"与当前选择的 Agent 对话"},{value:"temporary",label:"内置智能体",description:"使用平台提供的智能体"},{value:"skill-create",label:"创建 Skill",description:"使用两个模型生成并对比 Skill"}],ipe=[{label:"ArkClaw",logo:npe},{label:"Hermes 智能体",logo:spe}];function jA({mode:e}){return e==="skill-create"?l.jsxs("svg",{className:"new-chat-mode__skill-icon",viewBox:"0 0 20 20","aria-hidden":"true",children:[l.jsx("path",{d:"M10 2.2l1.35 4.1 4.15 1.35-4.15 1.35L10 13.1 8.65 9 4.5 7.65 8.65 6.3 10 2.2Z"}),l.jsx("path",{d:"M15.6 12.2l.6 1.8 1.8.6-1.8.6-.6 1.8-.6-1.8-1.8-.6 1.8-.6.6-1.8Z"})]}):e==="temporary"?l.jsxs("svg",{className:"new-chat-mode__temporary-icon",viewBox:"0 0 20 20","aria-hidden":"true",children:[l.jsx("path",{d:"m10 2.8 6.1 3.45v7.5L10 17.2l-6.1-3.45v-7.5L10 2.8Z"}),l.jsx("path",{d:"m3.9 6.25 6.1 3.5 6.1-3.5M10 9.75v7.45"})]}):l.jsx(xc,{className:"new-chat-mode__agent-icon"})}function ape(){return l.jsx("svg",{className:"new-chat-mode__nested-chevron",viewBox:"0 0 12 12","aria-hidden":"true",children:l.jsx("path",{d:"m4.5 3 3 3-3 3"})})}function ope({value:e,onChange:t,disabled:n=!1,temporaryEnabled:r,skillCreateEnabled:s}){const[i,a]=w.useState(!1),[o,c]=w.useState(!1),[u,d]=w.useState(()=>js.findIndex(k=>k.value===e)),f=w.useRef(null),h=w.useRef(null),p=js.find(k=>k.value===e)??js[0],m=p.value==="temporary"?"Codex 智能体":p.label;function y(k){return k.value==="temporary"?r:k.value==="skill-create"?s:!0}function E(k){return y(k)!==!0}function g(k){const N=y(k);return N===void 0?"正在检查配置":N?k.description:"管理员未配置"}w.useEffect(()=>{if(!i)return;const k=N=>{var C;(C=f.current)!=null&&C.contains(N.target)||(a(!1),c(!1))};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[i]);function x(k){let N=u;do N=(N+k+js.length)%js.length;while(E(js[N]));d(N),c(js[N].value==="temporary")}function b(k){var N;if(!E(k)){if(k.value==="temporary"){c(!0);return}t(k.value),a(!1),c(!1),(N=h.current)==null||N.focus()}}function _(){t("temporary"),a(!1),c(!1)}return l.jsxs("div",{className:"new-chat-mode",ref:f,children:[l.jsxs("button",{ref:h,type:"button",className:"new-chat-mode__trigger","aria-label":"选择新会话模式","aria-haspopup":"listbox","aria-expanded":i,disabled:n,onClick:()=>{d(js.findIndex(k=>k.value===e)),a(k=>(k&&c(!1),!k))},onKeyDown:k=>{k.key==="ArrowDown"||k.key==="ArrowUp"?(k.preventDefault(),i?x(k.key==="ArrowDown"?1:-1):a(!0)):i&&(k.key==="Enter"||k.key===" ")?(k.preventDefault(),b(js[u])):i&&k.key==="Escape"&&(k.preventDefault(),a(!1),c(!1))},children:[l.jsx("span",{className:"new-chat-mode__icon",children:l.jsx(jA,{mode:p.value})}),l.jsx("span",{className:"new-chat-mode__current",title:m,children:m}),l.jsx("svg",{className:"new-chat-mode__chevron",viewBox:"0 0 12 12","aria-hidden":"true",children:l.jsx("path",{d:"m3 4.5 3 3 3-3"})})]}),i?l.jsx("div",{className:"new-chat-mode__menu",role:"listbox","aria-label":"新会话模式",tabIndex:-1,onKeyDown:k=>{var N;k.key==="ArrowDown"||k.key==="ArrowUp"?(k.preventDefault(),x(k.key==="ArrowDown"?1:-1)):k.key==="Enter"?(k.preventDefault(),b(js[u])):k.key==="Escape"&&(k.preventDefault(),a(!1),c(!1),(N=h.current)==null||N.focus())},children:js.map((k,N)=>{const C=k.value==="temporary";return l.jsxs("button",{type:"button",role:"option","aria-selected":e===k.value,"aria-haspopup":C?"menu":void 0,"aria-expanded":C?o:void 0,"aria-disabled":E(k),disabled:E(k),className:`new-chat-mode__option${N===u?" is-active":""}`,onMouseEnter:()=>{d(N),c(k.value==="temporary")},onClick:()=>b(k),children:[l.jsx("span",{className:"new-chat-mode__option-icon",children:l.jsx(jA,{mode:k.value})}),l.jsxs("span",{className:"new-chat-mode__copy",children:[l.jsxs("span",{className:"new-chat-mode__label",children:[k.label,k.value==="skill-create"?l.jsx("span",{className:"new-chat-mode__beta",children:"Beta"}):null]}),l.jsx("span",{children:g(k)})]}),C?l.jsx(ape,{}):e===k.value?l.jsx("svg",{className:"new-chat-mode__check",viewBox:"0 0 16 16","aria-hidden":"true",children:l.jsx("path",{d:"m3.5 8.2 2.8 2.8 6.2-6"})}):null]},k.value)})}):null,i&&o?l.jsxs("div",{className:"new-chat-mode__submenu",role:"menu","aria-label":"内置智能体",children:[l.jsxs("button",{type:"button",role:"menuitem",className:"new-chat-mode__submenu-option",onClick:_,children:[l.jsx("img",{className:"new-chat-mode__builtin-icon",src:rpe,alt:"","aria-hidden":"true"}),l.jsxs("span",{className:"new-chat-mode__copy",children:[l.jsx("span",{className:"new-chat-mode__label",children:"Codex 智能体"}),l.jsx("span",{children:"在沙箱中执行任务"})]})]}),ipe.map(({label:k,logo:N})=>l.jsxs("button",{type:"button",role:"menuitem",className:"new-chat-mode__submenu-option",disabled:!0,children:[l.jsx("img",{className:"new-chat-mode__builtin-icon",src:N,alt:"","aria-hidden":"true"}),l.jsxs("span",{className:"new-chat-mode__copy",children:[l.jsx("span",{className:"new-chat-mode__label",children:k}),l.jsx("span",{children:"暂不可用"})]})]},k))]}):null]})}const Wv=["doubao-seed-2-0-pro-260215","deepseek-v4-flash-260425"];function lpe(){return l.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[l.jsx("circle",{cx:"8.2",cy:"8.2",r:"4.7"}),l.jsx("path",{d:"m11.7 11.7 4.1 4.1"}),l.jsx("path",{d:"M14.8 2.7v3.2M13.2 4.3h3.2"}),l.jsx("circle",{cx:"8.2",cy:"8.2",r:"1",fill:"currentColor",stroke:"none"})]})}function cpe(){return l.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[l.jsx("circle",{cx:"4.2",cy:"15.4",r:"1.4"}),l.jsx("circle",{cx:"15.7",cy:"4.2",r:"1.4"}),l.jsx("path",{d:"M5.7 15.1c3.5-.3 1.8-4.7 5.1-5.1 2.8-.4 2.1-3.7 3.5-4.8"}),l.jsx("path",{d:"m12.7 14.2 1.5 1.5 2.9-3.3"})]})}function upe(){return l.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[l.jsx("path",{d:"M3.2 5.2h7.1M3.2 9.5h5.2M3.2 13.8h4"}),l.jsx("path",{d:"m10.1 14.8.6-2.8 4.7-4.7 2.2 2.2-4.7 4.7-2.8.6Z"}),l.jsx("path",{d:"M14.5 3.1v2.5M13.2 4.4h2.6"})]})}const dpe=[{icon:lpe,text:"帮我分析一个问题,并给出清晰的解决思路"},{icon:cpe,text:"根据我的目标,制定一份可执行的行动计划"},{icon:upe,text:"帮我整理并润色一段内容,让表达更清晰"}];function fpe({sessionId:e,sessionInitializing:t=!1,appName:n,agentName:r,value:s,onChange:i,onSubmit:a,disabled:o,busy:c,showMeta:u,attachments:d,skills:f,agents:h,invocation:p,capabilitiesLoading:m=!1,allowAttachments:y=!0,onInvocationChange:E,onAddFiles:g,onRemoveAttachment:x,newChatMode:b="agent",newChatLayout:_=!1,showModeSelector:k=!1,onModeChange:N,temporaryEnabled:C,skillCreateEnabled:S}){const A=w.useRef(null),O=w.useRef(null),D=w.useRef(null),U=w.useRef(null),[X,M]=w.useState(!1),[j,T]=w.useState(null),[L,R]=w.useState(0),[F,I]=w.useState(!1);async function V(){if(e)try{await navigator.clipboard.writeText(e),I(!0),setTimeout(()=>I(!1),1500)}catch{I(!1)}}w.useLayoutEffect(()=>{const te=A.current;te&&(te.style.height="auto",te.style.height=`${Math.min(te.scrollHeight,200)}px`)},[s]);const W=b==="skill-create";w.useEffect(()=>{W&&(M(!1),T(null))},[W]);const P=!W&&d.some(te=>te.status!=="ready"),ie=!o&&!c&&!P&&(s.trim().length>0||!W&&d.length>0),G=(j==null?void 0:j.query.toLocaleLowerCase())??"",re=(j==null?void 0:j.kind)==="skill"?f.filter(te=>!p.skills.some(de=>de.name===te.name)).filter(te=>`${te.name} ${te.description}`.toLocaleLowerCase().includes(G)).map(te=>({kind:"skill",value:te})):(j==null?void 0:j.kind)==="agent"?h.filter(te=>`${te.name} ${te.description}`.toLocaleLowerCase().includes(G)).map(te=>({kind:"agent",value:te})):[];function ue(te){var de;M(!1),T(null),(de=te.current)==null||de.click()}function ee(te){i(te),M(!1),T(null),requestAnimationFrame(()=>{var de,Ee;(de=A.current)==null||de.focus(),(Ee=A.current)==null||Ee.setSelectionRange(te.length,te.length)})}function le(te,de){const Ee=te.slice(0,de),Te=/(^|\s)([/@])([^\s/@]*)$/.exec(Ee);if(!Te){T(null);return}const Ke=Te[2].length+Te[3].length,Ne={kind:Te[2]==="/"?"skill":"agent",query:Te[3],start:de-Ke,end:de},it=!j||j.kind!==Ne.kind||j.query!==Ne.query||j.start!==Ne.start||j.end!==Ne.end;T(Ne),it&&R(0),M(!1)}function ne(te){if(!j)return;const de=s.slice(0,j.start)+s.slice(j.end);i(de),te.kind==="skill"?E({...p,skills:[...p.skills,te.value]}):E({skills:[],targetAgent:te.value});const Ee=j.start;T(null),requestAnimationFrame(()=>{var Te,Ke;(Te=A.current)==null||Te.focus(),(Ke=A.current)==null||Ke.setSelectionRange(Ee,Ee)})}function me(){if(p.targetAgent){E({skills:[]});return}p.skills.length>0&&E({...p,skills:p.skills.slice(0,-1)})}function ye(te){const de=te.target.files?Array.from(te.target.files):[];de.length&&g(de),te.target.value=""}return l.jsxs("div",{className:`composer${_?" composer--new-chat":""}${W?" composer--skill-mode":""}`,children:[W?null:l.jsx(zv,{value:p,onRemoveSkill:te=>E({...p,skills:p.skills.filter(de=>de.name!==te)}),onRemoveAgent:()=>E({skills:[]})}),!W&&d.length>0&&l.jsx(Kv,{appName:n,compact:!0,items:d,onRemove:x}),l.jsxs("div",{className:"composer-box",children:[j?l.jsxs("div",{className:"composer-command-menu",role:"listbox","aria-label":j.kind==="skill"?"可用技能":"可用子 Agent",children:[l.jsxs("div",{className:"composer-command-head",children:[j.kind==="skill"?l.jsx(Po,{}):l.jsx(xL,{}),l.jsx("span",{children:j.kind==="skill"?"调用技能":"使用子 Agent"}),l.jsx("kbd",{children:j.kind==="skill"?"/":"@"})]}),m?l.jsxs("div",{className:"composer-command-empty",children:[l.jsx(Rt,{className:"spin"})," 正在读取 Agent 能力…"]}):re.length===0?l.jsx("div",{className:"composer-command-empty",children:j.kind==="skill"?"当前 Agent 没有匹配技能":"当前 Agent 没有匹配子 Agent"}):l.jsx("div",{className:"composer-command-list",children:re.map((te,de)=>l.jsxs("button",{type:"button",role:"option","aria-selected":de===L,className:`composer-command-item${de===L?" is-active":""}`,onMouseDown:Ee=>{Ee.preventDefault(),ne(te)},onMouseEnter:()=>R(de),children:[l.jsx("span",{className:`composer-command-icon composer-command-icon--${te.kind}`,children:te.kind==="skill"?l.jsx(Po,{}):l.jsx(Do,{})}),l.jsxs("span",{className:"composer-command-copy",children:[l.jsxs("strong",{children:[te.kind==="skill"?"/":"@",te.value.name]}),l.jsx("span",{children:te.value.description||(te.kind==="skill"?"加载并执行该技能":"将本轮交给该 Agent")})]}),l.jsx("kbd",{children:de===L?"↵":te.kind==="skill"?"技能":"Agent"})]},`${te.kind}-${te.value.name}`))})]}):null,W?null:l.jsxs("div",{className:"composer-menu-wrap",children:[l.jsx("button",{type:"button",className:"comp-icon",title:"添加","aria-label":"添加",disabled:o||!y,onClick:()=>{T(null),M(te=>!te)},children:l.jsx(rr,{className:"icon"})}),X&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"menu-scrim",onClick:()=>M(!1)}),l.jsxs("div",{className:"composer-menu",role:"menu",children:[l.jsxs("button",{type:"button",className:"menu-item",onClick:()=>ue(O),children:[l.jsx(TL,{className:"icon"}),"上传图片"]}),l.jsxs("button",{type:"button",className:"menu-item",onClick:()=>ue(D),children:[l.jsx(kL,{className:"icon"}),"上传文档或 PDF"]}),l.jsxs("button",{type:"button",className:"menu-item",onClick:()=>ue(U),children:[l.jsx(NL,{className:"icon"}),"上传视频"]})]})]})]}),k&&N?l.jsx(ope,{value:b,onChange:N,disabled:c,temporaryEnabled:C,skillCreateEnabled:S}):null,l.jsx("div",{className:"composer-input-stack",children:l.jsx("textarea",{ref:A,className:"comp-input scroll",rows:_?4:1,value:s,disabled:o,placeholder:W?`描述你想创建的 Skill,将使用 ${Wv.join(" 和 ")} 并行创建…`:o?"请在页面左上角选择智能体":`向 ${r} 发消息…`,"aria-expanded":!!j,onChange:te=>{i(te.target.value),W||le(te.target.value,te.target.selectionStart)},onSelect:te=>{W||le(te.currentTarget.value,te.currentTarget.selectionStart)},onBlur:()=>setTimeout(()=>T(null),0),onKeyDown:te=>{if(!W4(te.nativeEvent)){if(j){if(te.key==="ArrowDown"&&re.length>0){te.preventDefault(),R(de=>(de+1)%re.length);return}if(te.key==="ArrowUp"&&re.length>0){te.preventDefault(),R(de=>(de-1+re.length)%re.length);return}if((te.key==="Enter"||te.key==="Tab")&&re[L]){te.preventDefault(),ne(re[L]);return}if(te.key==="Escape"){te.preventDefault(),T(null);return}}if(te.key==="Backspace"&&!s&&te.currentTarget.selectionStart===0&&te.currentTarget.selectionEnd===0){me();return}te.key==="Enter"&&!te.shiftKey&&(te.preventDefault(),ie&&a())}}})}),l.jsx($t.button,{type:"button",className:"comp-send",disabled:!ie,onClick:a,"aria-label":"发送",whileTap:ie?{scale:.9}:void 0,transition:{type:"spring",stiffness:600,damping:22},children:c?l.jsx(Rt,{className:"icon spin"}):l.jsx(EL,{className:"icon"})})]}),_&&b==="agent"&&!s.trim()?l.jsx("div",{className:"prompt-suggestions","aria-label":"快捷提示",children:dpe.map(te=>{const de=te.icon;return l.jsxs("button",{type:"button",className:"prompt-suggestion",disabled:o||c,onClick:()=>ee(te.text),children:[l.jsx(de,{}),l.jsx("span",{children:te.text})]},te.text)})}):null,u&&l.jsxs("div",{className:"composer-meta",children:[l.jsxs("span",{className:"composer-session-line",children:["会话 ID:",l.jsx("span",{className:"composer-session-id",title:e||void 0,"aria-live":"polite",children:t?"初始化中":e||"—"}),e&&l.jsx("button",{type:"button",className:"composer-session-copy",title:F?"已复制":"复制会话 ID","aria-label":F?"已复制会话 ID":"复制会话 ID",onClick:()=>void V(),children:F?l.jsx(Js,{}):l.jsx(Aw,{})})]}),l.jsx("span",{className:"composer-meta-separator","aria-hidden":!0,children:"|"}),l.jsx("span",{children:"回答仅供参考"})]}),l.jsx("input",{ref:O,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:ye}),l.jsx("input",{ref:D,type:"file",accept:".txt,.md,.markdown,.pdf,text/plain,text/markdown,application/pdf",multiple:!0,hidden:!0,onChange:ye}),l.jsx("input",{ref:U,type:"file",accept:"video/mp4,video/webm,video/quicktime",multiple:!0,hidden:!0,onChange:ye})]})}function G4({title:e,sub:t,cards:n,footer:r}){return l.jsxs("div",{className:"stk",children:[l.jsxs("div",{className:"stk-head",children:[l.jsx("h1",{className:"stk-title",children:e}),t&&l.jsx("p",{className:"stk-sub",children:t})]}),l.jsx("div",{className:"stk-list",children:n.map((s,i)=>l.jsxs($t.button,{type:"button",className:`stk-card ${s.disabled?"stk-card-disabled":""}`,onClick:s.disabled?void 0:s.onClick,disabled:s.disabled,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.18,ease:"easeOut",delay:i*.04},children:[l.jsx("span",{className:"stk-card-icon",children:l.jsx(s.icon,{})}),l.jsxs("span",{className:"stk-card-text",children:[l.jsx("span",{className:"stk-card-title",children:s.title}),l.jsx("span",{className:"stk-card-desc",children:s.desc})]}),l.jsx(ws,{className:"stk-card-arrow"})]},s.key))}),r&&l.jsx("div",{className:"stk-footer",children:r})]})}const Gv=Symbol.for("yaml.alias"),$E=Symbol.for("yaml.document"),Da=Symbol.for("yaml.map"),q4=Symbol.for("yaml.pair"),vi=Symbol.for("yaml.scalar"),eu=Symbol.for("yaml.seq"),Ts=Symbol.for("yaml.node.type"),tu=e=>!!e&&typeof e=="object"&&e[Ts]===Gv,Hf=e=>!!e&&typeof e=="object"&&e[Ts]===$E,zf=e=>!!e&&typeof e=="object"&&e[Ts]===Da,Nn=e=>!!e&&typeof e=="object"&&e[Ts]===q4,zt=e=>!!e&&typeof e=="object"&&e[Ts]===vi,Vf=e=>!!e&&typeof e=="object"&&e[Ts]===eu;function _n(e){if(e&&typeof e=="object")switch(e[Ts]){case Da:case eu:return!0}return!1}function kn(e){if(e&&typeof e=="object")switch(e[Ts]){case Gv:case Da:case vi:case eu:return!0}return!1}const X4=e=>(zt(e)||_n(e))&&!!e.anchor,co=Symbol("break visit"),hpe=Symbol("skip children"),Ed=Symbol("remove node");function nu(e,t){const n=ppe(t);Hf(e)?Kl(null,e.contents,n,Object.freeze([e]))===Ed&&(e.contents=null):Kl(null,e,n,Object.freeze([]))}nu.BREAK=co;nu.SKIP=hpe;nu.REMOVE=Ed;function Kl(e,t,n,r){const s=mpe(e,t,n,r);if(kn(s)||Nn(s))return gpe(e,r,s),Kl(e,s,n,r);if(typeof s!="symbol"){if(_n(t)){r=Object.freeze(r.concat(t));for(let i=0;ie.replace(/[!,[\]{}]/g,t=>ype[t]);class kr{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},kr.defaultYaml,t),this.tags=Object.assign({},kr.defaultTags,n)}clone(){const t=new kr(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new kr(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:kr.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},kr.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:kr.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},kr.defaultTags),this.atNextDocument=!1);const r=t.trim().split(/[ \t]+/),s=r.shift();switch(s){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;const[i,a]=r;return this.tags[i]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;const[i]=r;if(i==="1.1"||i==="1.2")return this.yaml.version=i,!0;{const a=/^\d+\.\d+$/.test(i);return n(6,`Unsupported YAML version ${i}`,a),!1}}default:return n(0,`Unknown directive ${s}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){const a=t.slice(2,-1);return a==="!"||a==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),a)}const[,r,s]=t.match(/^(.*!)([^!]*)$/s);s||n(`The ${t} tag has no suffix`);const i=this.tags[r];if(i)try{return i+decodeURIComponent(s)}catch(a){return n(String(a)),null}return r==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[n,r]of Object.entries(this.tags))if(t.startsWith(r))return n+bpe(t.substring(r.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags);let s;if(t&&r.length>0&&kn(t.contents)){const i={};nu(t.contents,(a,o)=>{kn(o)&&o.tag&&(i[o.tag]=!0)}),s=Object.keys(i)}else s=[];for(const[i,a]of r)i==="!!"&&a==="tag:yaml.org,2002:"||(!t||s.some(o=>o.startsWith(a)))&&n.push(`%TAG ${i} ${a}`);return n.join(` +`)}}kr.defaultYaml={explicit:!1,version:"1.2"};kr.defaultTags={"!!":"tag:yaml.org,2002:"};function Q4(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){const n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function Z4(e){const t=new Set;return nu(e,{Value(n,r){r.anchor&&t.add(r.anchor)}}),t}function J4(e,t){for(let n=1;;++n){const r=`${e}${n}`;if(!t.has(r))return r}}function Epe(e,t){const n=[],r=new Map;let s=null;return{onAnchor:i=>{n.push(i),s??(s=Z4(e));const a=J4(t,s);return s.add(a),a},setAnchors:()=>{for(const i of n){const a=r.get(i);if(typeof a=="object"&&a.anchor&&(zt(a.node)||_n(a.node)))a.node.anchor=a.anchor;else{const o=new Error("Failed to resolve repeated object (this should not happen)");throw o.source=i,o}}},sourceObjects:r}}function Yl(e,t,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let s=0,i=r.length;s_s(r,String(s),n));if(e&&typeof e.toJSON=="function"){if(!n||!X4(e))return e.toJSON(t,n);const r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=i=>{r.res=i,delete n.onCreate};const s=e.toJSON(t,n);return n.onCreate&&n.onCreate(s),s}return typeof e=="bigint"&&!(n!=null&&n.keep)?Number(e):e}class qv{constructor(t){Object.defineProperty(this,Ts,{value:t})}clone(){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:r,onAnchor:s,reviver:i}={}){if(!Hf(t))throw new TypeError("A document argument is required");const a={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},o=_s(this,"",a);if(typeof s=="function")for(const{count:c,res:u}of a.anchors.values())s(u,c);return typeof i=="function"?Yl(i,{"":o},"",o):o}}class Xv extends qv{constructor(t){super(Gv),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){if((n==null?void 0:n.maxAliasCount)===0)throw new ReferenceError("Alias resolution is disabled");let r;n!=null&&n.aliasResolveCache?r=n.aliasResolveCache:(r=[],nu(t,{Node:(i,a)=>{(tu(a)||X4(a))&&r.push(a)}}),n&&(n.aliasResolveCache=r));let s;for(const i of r){if(i===this)break;i.anchor===this.source&&(s=i)}return s}toJSON(t,n){if(!n)return{source:this.source};const{anchors:r,doc:s,maxAliasCount:i}=n,a=this.resolve(s,n);if(!a){const c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let o=r.get(a);if(o||(_s(a,null,n),o=r.get(a)),(o==null?void 0:o.res)===void 0){const c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=Pp(s,a,r)),o.count*o.aliasCount>i)){const c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return o.res}toString(t,n,r){const s=`*${this.source}`;if(t){if(Q4(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){const i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(i)}if(t.implicitKey)return`${s} `}return s}}function Pp(e,t,n){if(tu(t)){const r=t.resolve(e),s=n&&r&&n.get(r);return s?s.count*s.aliasCount:0}else if(_n(t)){let r=0;for(const s of t.items){const i=Pp(e,s,n);i>r&&(r=i)}return r}else if(Nn(t)){const r=Pp(e,t.key,n),s=Pp(e,t.value,n);return Math.max(r,s)}return 1}const e6=e=>!e||typeof e!="function"&&typeof e!="object";class at extends qv{constructor(t){super(vi),this.value=t}toJSON(t,n){return n!=null&&n.keep?this.value:_s(this.value,t,n)}toString(){return String(this.value)}}at.BLOCK_FOLDED="BLOCK_FOLDED";at.BLOCK_LITERAL="BLOCK_LITERAL";at.PLAIN="PLAIN";at.QUOTE_DOUBLE="QUOTE_DOUBLE";at.QUOTE_SINGLE="QUOTE_SINGLE";const xpe="tag:yaml.org,2002:";function wpe(e,t,n){if(t){const r=n.filter(i=>i.tag===t),s=r.find(i=>!i.format)??r[0];if(!s)throw new Error(`Tag ${t} not found`);return s}return n.find(r=>{var s;return((s=r.identify)==null?void 0:s.call(r,e))&&!r.format})}function ff(e,t,n){var f,h,p;if(Hf(e)&&(e=e.contents),kn(e))return e;if(Nn(e)){const m=(h=(f=n.schema[Da]).createNode)==null?void 0:h.call(f,n.schema,null,n);return m.items.push(e),m}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());const{aliasDuplicateObjects:r,onAnchor:s,onTagObj:i,schema:a,sourceObjects:o}=n;let c;if(r&&e&&typeof e=="object"){if(c=o.get(e),c)return c.anchor??(c.anchor=s(e)),new Xv(c.anchor);c={anchor:null,node:null},o.set(e,c)}t!=null&&t.startsWith("!!")&&(t=xpe+t.slice(2));let u=wpe(e,t,a.tags);if(!u){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const m=new at(e);return c&&(c.node=m),m}u=e instanceof Map?a[Da]:Symbol.iterator in Object(e)?a[eu]:a[Da]}i&&(i(u),delete n.onTagObj);const d=u!=null&&u.createNode?u.createNode(n.schema,e,n):typeof((p=u==null?void 0:u.nodeClass)==null?void 0:p.from)=="function"?u.nodeClass.from(n.schema,e,n):new at(e);return t?d.tag=t:u.default||(d.tag=u.tag),c&&(c.node=d),d}function Qm(e,t,n){let r=n;for(let s=t.length-1;s>=0;--s){const i=t[s];if(typeof i=="number"&&Number.isInteger(i)&&i>=0){const a=[];a[i]=r,r=a}else r=new Map([[i,r]])}return ff(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}const Vu=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done;class t6 extends qv{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){const n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(r=>kn(r)||Nn(r)?r.clone(t):r),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(Vu(t))this.add(n);else{const[r,...s]=t,i=this.get(r,!0);if(_n(i))i.addIn(s,n);else if(i===void 0&&this.schema)this.set(r,Qm(this.schema,s,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${s}`)}}deleteIn(t){const[n,...r]=t;if(r.length===0)return this.delete(n);const s=this.get(n,!0);if(_n(s))return s.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(t,n){const[r,...s]=t,i=this.get(r,!0);return s.length===0?!n&&zt(i)?i.value:i:_n(i)?i.getIn(s,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!Nn(n))return!1;const r=n.value;return r==null||t&&zt(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(t){const[n,...r]=t;if(r.length===0)return this.has(n);const s=this.get(n,!0);return _n(s)?s.hasIn(r):!1}setIn(t,n){const[r,...s]=t;if(s.length===0)this.set(r,n);else{const i=this.get(r,!0);if(_n(i))i.setIn(s,n);else if(i===void 0&&this.schema)this.set(r,Qm(this.schema,s,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${s}`)}}}const vpe=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Vi(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const wo=(e,t,n)=>e.endsWith(` `)?Vi(n,t):n.includes(` `)?` -`+Vi(n,t):(e.endsWith(" ")?"":" ")+n,r6="flow",zE="block",Fp="quoted";function u0(e,t,n="flow",{indentAtStart:r,lineWidth:s=80,minContentWidth:i=20,onFold:a,onOverflow:o}={}){if(!s||s<0)return e;ss-Math.max(2,i)?u.push(0):f=s-r);let h,p,m=!1,y=-1,E=-1,g=-1;n===zE&&(y=PA(e,y,t.length),y!==-1&&(f=y+c));for(let b;b=e[y+=1];){if(n===Fp&&b==="\\"){switch(E=y,e[y+1]){case"x":y+=3;break;case"u":y+=5;break;case"U":y+=9;break;default:y+=1}g=y}if(b===` -`)n===zE&&(y=PA(e,y,t.length)),f=y+t.length+c,h=void 0;else{if(b===" "&&p&&p!==" "&&p!==` +`+Vi(n,t):(e.endsWith(" ")?"":" ")+n,n6="flow",HE="block",Bp="quoted";function c0(e,t,n="flow",{indentAtStart:r,lineWidth:s=80,minContentWidth:i=20,onFold:a,onOverflow:o}={}){if(!s||s<0)return e;ss-Math.max(2,i)?u.push(0):f=s-r);let h,p,m=!1,y=-1,E=-1,g=-1;n===HE&&(y=DA(e,y,t.length),y!==-1&&(f=y+c));for(let b;b=e[y+=1];){if(n===Bp&&b==="\\"){switch(E=y,e[y+1]){case"x":y+=3;break;case"u":y+=5;break;case"U":y+=9;break;default:y+=1}g=y}if(b===` +`)n===HE&&(y=DA(e,y,t.length)),f=y+t.length+c,h=void 0;else{if(b===" "&&p&&p!==" "&&p!==` `&&p!==" "){const _=e[y+1];_&&_!==" "&&_!==` -`&&_!==" "&&(h=y)}if(y>=f)if(h)u.push(h),f=h+c,h=void 0;else if(n===Fp){for(;p===" "||p===" ";)p=b,b=e[y+=1],m=!0;const _=y>g+1?y-2:E-1;if(d[_])return e;u.push(_),d[_]=!0,f=_+c,h=void 0}else m=!0}p=b}if(m&&o&&o(),u.length===0)return e;a&&a();let x=e.slice(0,u[0]);for(let b=0;b({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),f0=e=>/^(%|---|\.\.\.)/m.test(e);function kpe(e,t,n){if(!t||t<0)return!1;const r=t-n,s=e.length;if(s<=r)return!1;for(let i=0,a=0;ir)return!0;if(a=i+1,s-a<=r)return!1}return!0}function wd(e,t){const n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;const{implicitKey:r}=t,s=t.options.doubleQuotedMinMultiLineLength,i=t.indent||(f0(e)?" ":"");let a="",o=0;for(let c=0,u=n[c];u;u=n[++c])if(u===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(a+=n.slice(o,c)+"\\ ",c+=1,o=c,u="\\"),u==="\\")switch(n[c+1]){case"u":{a+=n.slice(o,c);const d=n.substr(c+2,4);switch(d){case"0000":a+="\\0";break;case"0007":a+="\\a";break;case"000b":a+="\\v";break;case"001b":a+="\\e";break;case"0085":a+="\\N";break;case"00a0":a+="\\_";break;case"2028":a+="\\L";break;case"2029":a+="\\P";break;default:d.substr(0,2)==="00"?a+="\\x"+d.substr(2):a+=n.substr(c,6)}c+=5,o=c+1}break;case"n":if(r||n[c+2]==='"'||n.length=f)if(h)u.push(h),f=h+c,h=void 0;else if(n===Bp){for(;p===" "||p===" ";)p=b,b=e[y+=1],m=!0;const _=y>g+1?y-2:E-1;if(d[_])return e;u.push(_),d[_]=!0,f=_+c,h=void 0}else m=!0}p=b}if(m&&o&&o(),u.length===0)return e;a&&a();let x=e.slice(0,u[0]);for(let b=0;b({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),d0=e=>/^(%|---|\.\.\.)/m.test(e);function _pe(e,t,n){if(!t||t<0)return!1;const r=t-n,s=e.length;if(s<=r)return!1;for(let i=0,a=0;ir)return!0;if(a=i+1,s-a<=r)return!1}return!0}function xd(e,t){const n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;const{implicitKey:r}=t,s=t.options.doubleQuotedMinMultiLineLength,i=t.indent||(d0(e)?" ":"");let a="",o=0;for(let c=0,u=n[c];u;u=n[++c])if(u===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(a+=n.slice(o,c)+"\\ ",c+=1,o=c,u="\\"),u==="\\")switch(n[c+1]){case"u":{a+=n.slice(o,c);const d=n.substr(c+2,4);switch(d){case"0000":a+="\\0";break;case"0007":a+="\\a";break;case"000b":a+="\\v";break;case"001b":a+="\\e";break;case"0085":a+="\\N";break;case"00a0":a+="\\_";break;case"2028":a+="\\L";break;case"2029":a+="\\P";break;default:d.substr(0,2)==="00"?a+="\\x"+d.substr(2):a+=n.substr(c,6)}c+=5,o=c+1}break;case"n":if(r||n[c+2]==='"'||n.length `;let f,h;for(h=n.length;h>0;--h){const k=n[h-1];if(k!==` `&&k!==" "&&k!==" ")break}let p=n.substring(h);const m=p.indexOf(` `);m===-1?f="-":n===p||m!==p.length-1?(f="+",i&&i()):f="",p&&(n=n.slice(0,-p.length),p[p.length-1]===` -`&&(p=p.slice(0,-1)),p=p.replace(KE,`$&${u}`));let y=!1,E,g=-1;for(E=0;E{N=!0});const S=u0(`${x}${k}${p}`,u,zE,C);if(!N)return`>${_} +$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${u}`);let N=!1;const C=u0(r,!0);a!=="folded"&&t!==at.BLOCK_FOLDED&&(C.onOverflow=()=>{N=!0});const S=c0(`${x}${k}${p}`,u,HE,C);if(!N)return`>${_} ${u}${S}`}return n=n.replace(/\n+/g,`$&${u}`),`|${_} -${u}${x}${n}${p}`}function Npe(e,t,n,r){const{type:s,value:i}=e,{actualString:a,implicitKey:o,indent:c,indentStep:u,inFlow:d}=t;if(o&&i.includes(` -`)||d&&/[[\]{},]/.test(i))return Gl(i,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(i))return o||d||!i.includes(` -`)?Gl(i,t):Up(e,t,n,r);if(!o&&!d&&s!==at.PLAIN&&i.includes(` -`))return Up(e,t,n,r);if(f0(i)){if(c==="")return t.forceBlockIndent=!0,Up(e,t,n,r);if(o&&c===u)return Gl(i,t)}const f=i.replace(/\n+/g,`$& -${c}`);if(a){const h=y=>{var E;return y.default&&y.tag!=="tag:yaml.org,2002:str"&&((E=y.test)==null?void 0:E.test(f))},{compat:p,tags:m}=t.doc.schema;if(m.some(h)||p!=null&&p.some(h))return Gl(i,t)}return o?f:u0(f,c,r6,d0(t,!1))}function Zv(e,t,n,r){const{implicitKey:s,inFlow:i}=t,a=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)});let{type:o}=e;o!==at.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(o=at.QUOTE_DOUBLE);const c=d=>{switch(d){case at.BLOCK_FOLDED:case at.BLOCK_LITERAL:return s||i?Gl(a.value,t):Up(a,t,n,r);case at.QUOTE_DOUBLE:return wd(a.value,t);case at.QUOTE_SINGLE:return VE(a.value,t);case at.PLAIN:return Npe(a,t,n,r);default:return null}};let u=c(o);if(u===null){const{defaultKeyType:d,defaultStringType:f}=t.options,h=s&&d||f;if(u=c(h),u===null)throw new Error(`Unsupported default string type ${h}`)}return u}function s6(e,t){const n=Object.assign({blockQuote:!0,commentString:_pe,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t);let r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function Spe(e,t){var s;if(t.tag){const i=e.filter(a=>a.tag===t.tag);if(i.length>0)return i.find(a=>a.format===t.format)??i[0]}let n,r;if(zt(t)){r=t.value;let i=e.filter(a=>{var o;return(o=a.identify)==null?void 0:o.call(a,r)});if(i.length>1){const a=i.filter(o=>o.test);a.length>0&&(i=a)}n=i.find(a=>a.format===t.format)??i.find(a=>!a.format)}else r=t,n=e.find(i=>i.nodeClass&&r instanceof i.nodeClass);if(!n){const i=((s=r==null?void 0:r.constructor)==null?void 0:s.name)??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${i} value`)}return n}function Tpe(e,t,{anchors:n,doc:r}){if(!r.directives)return"";const s=[],i=(zt(e)||_n(e))&&e.anchor;i&&Z4(i)&&(n.add(i),s.push(`&${i}`));const a=e.tag??(t.default?null:t.tag);return a&&s.push(r.directives.tagString(a)),s.join(" ")}function Fc(e,t,n,r){var c;if(Nn(e))return e.toString(t,n,r);if(nu(e)){if(t.doc.directives)return e.toString(t);if((c=t.resolvedAliases)!=null&&c.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let s;const i=kn(e)?e:t.doc.createNode(e,{onTagObj:u=>s=u});s??(s=Spe(t.doc.schema.tags,i));const a=Tpe(i,s,t);a.length>0&&(t.indentAtStart=(t.indentAtStart??0)+a.length+1);const o=typeof s.stringify=="function"?s.stringify(i,t,n,r):zt(i)?Zv(i,t,n,r):i.toString(t,n,r);return a?zt(i)||o[0]==="{"||o[0]==="["?`${a} ${o}`:`${a} -${t.indent}${o}`:o}function Ape({key:e,value:t},n,r,s){const{allNullValues:i,doc:a,indent:o,indentStep:c,options:{commentString:u,indentSeq:d,simpleKeys:f}}=n;let h=kn(e)&&e.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(_n(e)||!kn(e)&&typeof e=="object"){const C="With simple keys, collection cannot be used as a key value";throw new Error(C)}}let p=!f&&(!e||h&&t==null&&!n.inFlow||_n(e)||(zt(e)?e.type===at.BLOCK_FOLDED||e.type===at.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(f||!i),indent:o+c});let m=!1,y=!1,E=Fc(e,n,()=>m=!0,()=>y=!0);if(!p&&!n.inFlow&&E.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(n.inFlow){if(i||t==null)return m&&r&&r(),E===""?"?":p?`? ${E}`:E}else if(i&&!f||t==null&&p)return E=`? ${E}`,h&&!m?E+=vo(E,n.indent,u(h)):y&&s&&s(),E;m&&(h=null),p?(h&&(E+=vo(E,n.indent,u(h))),E=`? ${E} -${o}:`):(E=`${E}:`,h&&(E+=vo(E,n.indent,u(h))));let g,x,b;kn(t)?(g=!!t.spaceBefore,x=t.commentBefore,b=t.comment):(g=!1,x=null,b=null,t&&typeof t=="object"&&(t=a.createNode(t))),n.implicitKey=!1,!p&&!h&&zt(t)&&(n.indentAtStart=E.length+1),y=!1,!d&&c.length>=2&&!n.inFlow&&!p&&Kf(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let _=!1;const k=Fc(t,n,()=>_=!0,()=>y=!0);let N=" ";if(h||g||x){if(N=g?` +${u}${x}${n}${p}`}function kpe(e,t,n,r){const{type:s,value:i}=e,{actualString:a,implicitKey:o,indent:c,indentStep:u,inFlow:d}=t;if(o&&i.includes(` +`)||d&&/[[\]{},]/.test(i))return Wl(i,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(i))return o||d||!i.includes(` +`)?Wl(i,t):Fp(e,t,n,r);if(!o&&!d&&s!==at.PLAIN&&i.includes(` +`))return Fp(e,t,n,r);if(d0(i)){if(c==="")return t.forceBlockIndent=!0,Fp(e,t,n,r);if(o&&c===u)return Wl(i,t)}const f=i.replace(/\n+/g,`$& +${c}`);if(a){const h=y=>{var E;return y.default&&y.tag!=="tag:yaml.org,2002:str"&&((E=y.test)==null?void 0:E.test(f))},{compat:p,tags:m}=t.doc.schema;if(m.some(h)||p!=null&&p.some(h))return Wl(i,t)}return o?f:c0(f,c,n6,u0(t,!1))}function Qv(e,t,n,r){const{implicitKey:s,inFlow:i}=t,a=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)});let{type:o}=e;o!==at.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(o=at.QUOTE_DOUBLE);const c=d=>{switch(d){case at.BLOCK_FOLDED:case at.BLOCK_LITERAL:return s||i?Wl(a.value,t):Fp(a,t,n,r);case at.QUOTE_DOUBLE:return xd(a.value,t);case at.QUOTE_SINGLE:return zE(a.value,t);case at.PLAIN:return kpe(a,t,n,r);default:return null}};let u=c(o);if(u===null){const{defaultKeyType:d,defaultStringType:f}=t.options,h=s&&d||f;if(u=c(h),u===null)throw new Error(`Unsupported default string type ${h}`)}return u}function r6(e,t){const n=Object.assign({blockQuote:!0,commentString:vpe,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t);let r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function Npe(e,t){var s;if(t.tag){const i=e.filter(a=>a.tag===t.tag);if(i.length>0)return i.find(a=>a.format===t.format)??i[0]}let n,r;if(zt(t)){r=t.value;let i=e.filter(a=>{var o;return(o=a.identify)==null?void 0:o.call(a,r)});if(i.length>1){const a=i.filter(o=>o.test);a.length>0&&(i=a)}n=i.find(a=>a.format===t.format)??i.find(a=>!a.format)}else r=t,n=e.find(i=>i.nodeClass&&r instanceof i.nodeClass);if(!n){const i=((s=r==null?void 0:r.constructor)==null?void 0:s.name)??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${i} value`)}return n}function Spe(e,t,{anchors:n,doc:r}){if(!r.directives)return"";const s=[],i=(zt(e)||_n(e))&&e.anchor;i&&Q4(i)&&(n.add(i),s.push(`&${i}`));const a=e.tag??(t.default?null:t.tag);return a&&s.push(r.directives.tagString(a)),s.join(" ")}function Bc(e,t,n,r){var c;if(Nn(e))return e.toString(t,n,r);if(tu(e)){if(t.doc.directives)return e.toString(t);if((c=t.resolvedAliases)!=null&&c.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let s;const i=kn(e)?e:t.doc.createNode(e,{onTagObj:u=>s=u});s??(s=Npe(t.doc.schema.tags,i));const a=Spe(i,s,t);a.length>0&&(t.indentAtStart=(t.indentAtStart??0)+a.length+1);const o=typeof s.stringify=="function"?s.stringify(i,t,n,r):zt(i)?Qv(i,t,n,r):i.toString(t,n,r);return a?zt(i)||o[0]==="{"||o[0]==="["?`${a} ${o}`:`${a} +${t.indent}${o}`:o}function Tpe({key:e,value:t},n,r,s){const{allNullValues:i,doc:a,indent:o,indentStep:c,options:{commentString:u,indentSeq:d,simpleKeys:f}}=n;let h=kn(e)&&e.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(_n(e)||!kn(e)&&typeof e=="object"){const C="With simple keys, collection cannot be used as a key value";throw new Error(C)}}let p=!f&&(!e||h&&t==null&&!n.inFlow||_n(e)||(zt(e)?e.type===at.BLOCK_FOLDED||e.type===at.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(f||!i),indent:o+c});let m=!1,y=!1,E=Bc(e,n,()=>m=!0,()=>y=!0);if(!p&&!n.inFlow&&E.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(n.inFlow){if(i||t==null)return m&&r&&r(),E===""?"?":p?`? ${E}`:E}else if(i&&!f||t==null&&p)return E=`? ${E}`,h&&!m?E+=wo(E,n.indent,u(h)):y&&s&&s(),E;m&&(h=null),p?(h&&(E+=wo(E,n.indent,u(h))),E=`? ${E} +${o}:`):(E=`${E}:`,h&&(E+=wo(E,n.indent,u(h))));let g,x,b;kn(t)?(g=!!t.spaceBefore,x=t.commentBefore,b=t.comment):(g=!1,x=null,b=null,t&&typeof t=="object"&&(t=a.createNode(t))),n.implicitKey=!1,!p&&!h&&zt(t)&&(n.indentAtStart=E.length+1),y=!1,!d&&c.length>=2&&!n.inFlow&&!p&&Vf(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let _=!1;const k=Bc(t,n,()=>_=!0,()=>y=!0);let N=" ";if(h||g||x){if(N=g?` `:"",x){const C=u(x);N+=` ${Vi(C,n.indent)}`}k===""&&!n.inFlow?N===` `&&b&&(N=` @@ -609,32 +609,32 @@ ${Vi(C,n.indent)}`}k===""&&!n.inFlow?N===` ${n.indent}`}else if(!p&&_n(t)){const C=k[0],S=k.indexOf(` `),A=S!==-1,O=n.inFlow??t.flow??t.items.length===0;if(A||!O){let D=!1;if(A&&(C==="&"||C==="!")){let U=k.indexOf(" ");C==="&"&&U!==-1&&Ue===ep||typeof e=="symbol"&&e.description===ep,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new at(Symbol(ep)),{addToJSMap:a6}),stringify:()=>ep},Cpe=(e,t)=>(Gi.identify(t)||zt(t)&&(!t.type||t.type===at.PLAIN)&&Gi.identify(t.value))&&(e==null?void 0:e.doc.schema.tags.some(n=>n.tag===Gi.tag&&n.default));function a6(e,t,n){const r=o6(e,n);if(Kf(r))for(const s of r.items)sb(e,t,s);else if(Array.isArray(r))for(const s of r)sb(e,t,s);else sb(e,t,r)}function sb(e,t,n){const r=o6(e,n);if(!Vf(r))throw new Error("Merge sources must be maps or map aliases");const s=r.toJSON(null,e,Map);for(const[i,a]of s)t instanceof Map?t.has(i)||t.set(i,a):t instanceof Set?t.add(i):Object.prototype.hasOwnProperty.call(t,i)||Object.defineProperty(t,i,{value:a,writable:!0,enumerable:!0,configurable:!0});return t}function o6(e,t){return e&&nu(t)?t.resolve(e.doc,e):t}function l6(e,t,{key:n,value:r}){if(kn(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(Cpe(e,n))a6(e,t,r);else{const s=_s(n,"",e);if(t instanceof Map)t.set(s,_s(r,s,e));else if(t instanceof Set)t.add(s);else{const i=Ipe(n,s,e),a=_s(r,i,e);i in t?Object.defineProperty(t,i,{value:a,writable:!0,enumerable:!0,configurable:!0}):t[i]=a}}return t}function Ipe(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(kn(e)&&(n!=null&&n.doc)){const r=s6(n.doc,{});r.anchors=new Set;for(const i of n.anchors.keys())r.anchors.add(i.anchor);r.inFlow=!0,r.inStringifyKey=!0;const s=e.toString(r);if(!n.mapKeyWarned){let i=JSON.stringify(s);i.length>40&&(i=i.substring(0,36)+'..."'),i6(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${i}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return s}return JSON.stringify(t)}function Jv(e,t,n){const r=hf(e,void 0,n),s=hf(t,void 0,n);return new Ar(r,s)}class Ar{constructor(t,n=null){Object.defineProperty(this,Ts,{value:X4}),this.key=t,this.value=n}clone(t){let{key:n,value:r}=this;return kn(n)&&(n=n.clone(t)),kn(r)&&(r=r.clone(t)),new Ar(n,r)}toJSON(t,n){const r=n!=null&&n.mapAsMap?new Map:{};return l6(n,r,this)}toString(t,n,r){return t!=null&&t.doc?Ape(this,t,n,r):JSON.stringify(this)}}function c6(e,t,n){return(t.inFlow??e.flow?Rpe:Ope)(e,t,n)}function Ope({comment:e,items:t},n,{blockItemPrefix:r,flowChars:s,itemIndent:i,onChompKeep:a,onComment:o}){const{indent:c,options:{commentString:u}}=n,d=Object.assign({},n,{indent:i,type:null});let f=!1;const h=[];for(let m=0;mE=null,()=>f=!0);E&&(g+=vo(g,i,u(E))),f&&E&&(f=!1),h.push(r+g)}let p;if(h.length===0)p=s.start+s.end;else{p=h[0];for(let m=1;me===Jh||typeof e=="symbol"&&e.description===Jh,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new at(Symbol(Jh)),{addToJSMap:i6}),stringify:()=>Jh},Ape=(e,t)=>(Gi.identify(t)||zt(t)&&(!t.type||t.type===at.PLAIN)&&Gi.identify(t.value))&&(e==null?void 0:e.doc.schema.tags.some(n=>n.tag===Gi.tag&&n.default));function i6(e,t,n){const r=a6(e,n);if(Vf(r))for(const s of r.items)rb(e,t,s);else if(Array.isArray(r))for(const s of r)rb(e,t,s);else rb(e,t,r)}function rb(e,t,n){const r=a6(e,n);if(!zf(r))throw new Error("Merge sources must be maps or map aliases");const s=r.toJSON(null,e,Map);for(const[i,a]of s)t instanceof Map?t.has(i)||t.set(i,a):t instanceof Set?t.add(i):Object.prototype.hasOwnProperty.call(t,i)||Object.defineProperty(t,i,{value:a,writable:!0,enumerable:!0,configurable:!0});return t}function a6(e,t){return e&&tu(t)?t.resolve(e.doc,e):t}function o6(e,t,{key:n,value:r}){if(kn(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(Ape(e,n))i6(e,t,r);else{const s=_s(n,"",e);if(t instanceof Map)t.set(s,_s(r,s,e));else if(t instanceof Set)t.add(s);else{const i=Cpe(n,s,e),a=_s(r,i,e);i in t?Object.defineProperty(t,i,{value:a,writable:!0,enumerable:!0,configurable:!0}):t[i]=a}}return t}function Cpe(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(kn(e)&&(n!=null&&n.doc)){const r=r6(n.doc,{});r.anchors=new Set;for(const i of n.anchors.keys())r.anchors.add(i.anchor);r.inFlow=!0,r.inStringifyKey=!0;const s=e.toString(r);if(!n.mapKeyWarned){let i=JSON.stringify(s);i.length>40&&(i=i.substring(0,36)+'..."'),s6(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${i}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return s}return JSON.stringify(t)}function Zv(e,t,n){const r=ff(e,void 0,n),s=ff(t,void 0,n);return new Ar(r,s)}class Ar{constructor(t,n=null){Object.defineProperty(this,Ts,{value:q4}),this.key=t,this.value=n}clone(t){let{key:n,value:r}=this;return kn(n)&&(n=n.clone(t)),kn(r)&&(r=r.clone(t)),new Ar(n,r)}toJSON(t,n){const r=n!=null&&n.mapAsMap?new Map:{};return o6(n,r,this)}toString(t,n,r){return t!=null&&t.doc?Tpe(this,t,n,r):JSON.stringify(this)}}function l6(e,t,n){return(t.inFlow??e.flow?Ope:Ipe)(e,t,n)}function Ipe({comment:e,items:t},n,{blockItemPrefix:r,flowChars:s,itemIndent:i,onChompKeep:a,onComment:o}){const{indent:c,options:{commentString:u}}=n,d=Object.assign({},n,{indent:i,type:null});let f=!1;const h=[];for(let m=0;mE=null,()=>f=!0);E&&(g+=wo(g,i,u(E))),f&&E&&(f=!1),h.push(r+g)}let p;if(h.length===0)p=s.start+s.end;else{p=h[0];for(let m=1;mE=null);u||(u=f.length>d||g.includes(` -`)),m0&&(u||(u=f.reduce((x,b)=>x+b.length+2,2)+(g.length+2)>t.options.lineWidth)),u&&(g+=",")),E&&(g+=vo(g,r,o(E))),f.push(g),d=f.length}const{start:h,end:p}=n;if(f.length===0)return h+p;if(!u){const m=f.reduce((y,E)=>y+E.length+2,2);u=t.options.lineWidth>0&&m>t.options.lineWidth}if(u){let m=h;for(const y of f)m+=y?` +`+Vi(u(e),c),o&&o()):f&&a&&a(),p}function Ope({items:e},t,{flowChars:n,itemIndent:r}){const{indent:s,indentStep:i,flowCollectionPadding:a,options:{commentString:o}}=t;r+=i;const c=Object.assign({},t,{indent:r,inFlow:!0,type:null});let u=!1,d=0;const f=[];for(let m=0;mE=null);u||(u=f.length>d||g.includes(` +`)),m0&&(u||(u=f.reduce((x,b)=>x+b.length+2,2)+(g.length+2)>t.options.lineWidth)),u&&(g+=",")),E&&(g+=wo(g,r,o(E))),f.push(g),d=f.length}const{start:h,end:p}=n;if(f.length===0)return h+p;if(!u){const m=f.reduce((y,E)=>y+E.length+2,2);u=t.options.lineWidth>0&&m>t.options.lineWidth}if(u){let m=h;for(const y of f)m+=y?` ${i}${s}${y}`:` `;return`${m} -${s}${p}`}else return`${h}${a}${f.join(" ")}${a}${p}`}function Jm({indent:e,options:{commentString:t}},n,r,s){if(r&&s&&(r=r.replace(/^\n+/,"")),r){const i=Vi(t(r),e);n.push(i.trimStart())}}function _o(e,t){const n=zt(t)?t.value:t;for(const r of e)if(Nn(r)&&(r.key===t||r.key===n||zt(r.key)&&r.key.value===n))return r}class Es extends n6{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Da,t),this.items=[]}static from(t,n,r){const{keepUndefined:s,replacer:i}=r,a=new this(t),o=(c,u)=>{if(typeof i=="function")u=i.call(n,c,u);else if(Array.isArray(i)&&!i.includes(c))return;(u!==void 0||s)&&a.items.push(Jv(c,u,r))};if(n instanceof Map)for(const[c,u]of n)o(c,u);else if(n&&typeof n=="object")for(const c of Object.keys(n))o(c,n[c]);return typeof t.sortMapEntries=="function"&&a.items.sort(t.sortMapEntries),a}add(t,n){var a;let r;Nn(t)?r=t:!t||typeof t!="object"||!("key"in t)?r=new Ar(t,t==null?void 0:t.value):r=new Ar(t.key,t.value);const s=_o(this.items,r.key),i=(a=this.schema)==null?void 0:a.sortMapEntries;if(s){if(!n)throw new Error(`Key ${r.key} already set`);zt(s.value)&&t6(r.value)?s.value.value=r.value:s.value=r.value}else if(i){const o=this.items.findIndex(c=>i(r,c)<0);o===-1?this.items.push(r):this.items.splice(o,0,r)}else this.items.push(r)}delete(t){const n=_o(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){const r=_o(this.items,t),s=r==null?void 0:r.value;return(!n&&zt(s)?s.value:s)??void 0}has(t){return!!_o(this.items,t)}set(t,n){this.add(new Ar(t,n),!0)}toJSON(t,n,r){const s=r?new r:n!=null&&n.mapAsMap?new Map:{};n!=null&&n.onCreate&&n.onCreate(s);for(const i of this.items)l6(n,s,i);return s}toString(t,n,r){if(!t)return JSON.stringify(this);for(const s of this.items)if(!Nn(s))throw new Error(`Map items must all be pairs; found ${JSON.stringify(s)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),c6(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:r,onComment:n})}}const su={collection:"map",default:!0,nodeClass:Es,tag:"tag:yaml.org,2002:map",resolve(e,t){return Vf(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>Es.from(e,t,n)};class Yo extends n6{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(tu,t),this.items=[]}add(t){this.items.push(t)}delete(t){const n=tp(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){const r=tp(t);if(typeof r!="number")return;const s=this.items[r];return!n&&zt(s)?s.value:s}has(t){const n=tp(t);return typeof n=="number"&&n=0?t:null}const iu={collection:"seq",default:!0,nodeClass:Yo,tag:"tag:yaml.org,2002:seq",resolve(e,t){return Kf(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>Yo.from(e,t,n)},h0={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),Zv(e,t,n,r)}},p0={identify:e=>e==null,createNode:()=>new at(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new at(null),stringify:({source:e},t)=>typeof e=="string"&&p0.test.test(e)?e:t.options.nullStr},e_={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new at(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&e_.test.test(e)){const r=e[0]==="t"||e[0]==="T";if(t===r)return e}return t?n.options.trueStr:n.options.falseStr}};function ni({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r=="bigint")return String(r);const s=typeof r=="number"?r:Number(r);if(!isFinite(s))return isNaN(s)?".nan":s<0?"-.inf":".inf";let i=Object.is(r,-0)?"-0":JSON.stringify(r);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(i)&&!i.includes("e")){let a=i.indexOf(".");a<0&&(a=i.length,i+=".");let o=t-(i.length-a-1);for(;o-- >0;)i+="0"}return i}const u6={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ni},d6={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():ni(e)}},f6={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){const t=new at(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:ni},m0=e=>typeof e=="bigint"||Number.isInteger(e),t_=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function h6(e,t,n){const{value:r}=e;return m0(r)&&r>=0?n+r.toString(t):ni(e)}const p6={identify:e=>m0(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>t_(e,2,8,n),stringify:e=>h6(e,8,"0o")},m6={identify:m0,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>t_(e,0,10,n),stringify:ni},g6={identify:e=>m0(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>t_(e,2,16,n),stringify:e=>h6(e,16,"0x")},Lpe=[su,iu,h0,p0,e_,p6,m6,g6,u6,d6,f6];function BA(e){return typeof e=="bigint"||Number.isInteger(e)}const np=({value:e})=>JSON.stringify(e),Mpe=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:np},{identify:e=>e==null,createNode:()=>new at(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:np},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:np},{identify:BA,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>BA(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:np}],jpe={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},Dpe=[su,iu].concat(Mpe,jpe),n_={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof atob=="function"){const n=atob(e.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let s=0;s1&&t("Each pair must have its own sequence indicator");const s=r.items[0]||new Ar(new at(null));if(r.commentBefore&&(s.key.commentBefore=s.key.commentBefore?`${r.commentBefore} +${s}${p}`}else return`${h}${a}${f.join(" ")}${a}${p}`}function Zm({indent:e,options:{commentString:t}},n,r,s){if(r&&s&&(r=r.replace(/^\n+/,"")),r){const i=Vi(t(r),e);n.push(i.trimStart())}}function vo(e,t){const n=zt(t)?t.value:t;for(const r of e)if(Nn(r)&&(r.key===t||r.key===n||zt(r.key)&&r.key.value===n))return r}class Es extends t6{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Da,t),this.items=[]}static from(t,n,r){const{keepUndefined:s,replacer:i}=r,a=new this(t),o=(c,u)=>{if(typeof i=="function")u=i.call(n,c,u);else if(Array.isArray(i)&&!i.includes(c))return;(u!==void 0||s)&&a.items.push(Zv(c,u,r))};if(n instanceof Map)for(const[c,u]of n)o(c,u);else if(n&&typeof n=="object")for(const c of Object.keys(n))o(c,n[c]);return typeof t.sortMapEntries=="function"&&a.items.sort(t.sortMapEntries),a}add(t,n){var a;let r;Nn(t)?r=t:!t||typeof t!="object"||!("key"in t)?r=new Ar(t,t==null?void 0:t.value):r=new Ar(t.key,t.value);const s=vo(this.items,r.key),i=(a=this.schema)==null?void 0:a.sortMapEntries;if(s){if(!n)throw new Error(`Key ${r.key} already set`);zt(s.value)&&e6(r.value)?s.value.value=r.value:s.value=r.value}else if(i){const o=this.items.findIndex(c=>i(r,c)<0);o===-1?this.items.push(r):this.items.splice(o,0,r)}else this.items.push(r)}delete(t){const n=vo(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){const r=vo(this.items,t),s=r==null?void 0:r.value;return(!n&&zt(s)?s.value:s)??void 0}has(t){return!!vo(this.items,t)}set(t,n){this.add(new Ar(t,n),!0)}toJSON(t,n,r){const s=r?new r:n!=null&&n.mapAsMap?new Map:{};n!=null&&n.onCreate&&n.onCreate(s);for(const i of this.items)o6(n,s,i);return s}toString(t,n,r){if(!t)return JSON.stringify(this);for(const s of this.items)if(!Nn(s))throw new Error(`Map items must all be pairs; found ${JSON.stringify(s)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),l6(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:r,onComment:n})}}const ru={collection:"map",default:!0,nodeClass:Es,tag:"tag:yaml.org,2002:map",resolve(e,t){return zf(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>Es.from(e,t,n)};class Ko extends t6{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(eu,t),this.items=[]}add(t){this.items.push(t)}delete(t){const n=ep(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){const r=ep(t);if(typeof r!="number")return;const s=this.items[r];return!n&&zt(s)?s.value:s}has(t){const n=ep(t);return typeof n=="number"&&n=0?t:null}const su={collection:"seq",default:!0,nodeClass:Ko,tag:"tag:yaml.org,2002:seq",resolve(e,t){return Vf(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>Ko.from(e,t,n)},f0={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),Qv(e,t,n,r)}},h0={identify:e=>e==null,createNode:()=>new at(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new at(null),stringify:({source:e},t)=>typeof e=="string"&&h0.test.test(e)?e:t.options.nullStr},Jv={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new at(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&Jv.test.test(e)){const r=e[0]==="t"||e[0]==="T";if(t===r)return e}return t?n.options.trueStr:n.options.falseStr}};function ni({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r=="bigint")return String(r);const s=typeof r=="number"?r:Number(r);if(!isFinite(s))return isNaN(s)?".nan":s<0?"-.inf":".inf";let i=Object.is(r,-0)?"-0":JSON.stringify(r);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(i)&&!i.includes("e")){let a=i.indexOf(".");a<0&&(a=i.length,i+=".");let o=t-(i.length-a-1);for(;o-- >0;)i+="0"}return i}const c6={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ni},u6={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():ni(e)}},d6={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){const t=new at(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:ni},p0=e=>typeof e=="bigint"||Number.isInteger(e),e_=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function f6(e,t,n){const{value:r}=e;return p0(r)&&r>=0?n+r.toString(t):ni(e)}const h6={identify:e=>p0(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>e_(e,2,8,n),stringify:e=>f6(e,8,"0o")},p6={identify:p0,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>e_(e,0,10,n),stringify:ni},m6={identify:e=>p0(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>e_(e,2,16,n),stringify:e=>f6(e,16,"0x")},Rpe=[ru,su,f0,h0,Jv,h6,p6,m6,c6,u6,d6];function PA(e){return typeof e=="bigint"||Number.isInteger(e)}const tp=({value:e})=>JSON.stringify(e),Lpe=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:tp},{identify:e=>e==null,createNode:()=>new at(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:tp},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:tp},{identify:PA,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>PA(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:tp}],Mpe={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},jpe=[ru,su].concat(Lpe,Mpe),t_={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof atob=="function"){const n=atob(e.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let s=0;s1&&t("Each pair must have its own sequence indicator");const s=r.items[0]||new Ar(new at(null));if(r.commentBefore&&(s.key.commentBefore=s.key.commentBefore?`${r.commentBefore} ${s.key.commentBefore}`:r.commentBefore),r.comment){const i=s.value??s.key;i.comment=i.comment?`${r.comment} -${i.comment}`:r.comment}r=s}e.items[n]=Nn(r)?r:new Ar(r)}}else t("Expected a sequence for this tag");return e}function b6(e,t,n){const{replacer:r}=n,s=new Yo(e);s.tag="tag:yaml.org,2002:pairs";let i=0;if(t&&Symbol.iterator in Object(t))for(let a of t){typeof r=="function"&&(a=r.call(t,String(i++),a));let o,c;if(Array.isArray(a))if(a.length===2)o=a[0],c=a[1];else throw new TypeError(`Expected [key, value] tuple: ${a}`);else if(a&&a instanceof Object){const u=Object.keys(a);if(u.length===1)o=u[0],c=a[o];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else o=a;s.items.push(Jv(o,c,n))}return s}const r_={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:y6,createNode:b6};class ac extends Yo{constructor(){super(),this.add=Es.prototype.add.bind(this),this.delete=Es.prototype.delete.bind(this),this.get=Es.prototype.get.bind(this),this.has=Es.prototype.has.bind(this),this.set=Es.prototype.set.bind(this),this.tag=ac.tag}toJSON(t,n){if(!n)return super.toJSON(t);const r=new Map;n!=null&&n.onCreate&&n.onCreate(r);for(const s of this.items){let i,a;if(Nn(s)?(i=_s(s.key,"",n),a=_s(s.value,i,n)):i=_s(s,"",n),r.has(i))throw new Error("Ordered maps must not include duplicate keys");r.set(i,a)}return r}static from(t,n,r){const s=b6(t,n,r),i=new this;return i.items=s.items,i}}ac.tag="tag:yaml.org,2002:omap";const s_={collection:"seq",identify:e=>e instanceof Map,nodeClass:ac,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const n=y6(e,t),r=[];for(const{key:s}of n.items)zt(s)&&(r.includes(s.value)?t(`Ordered maps must not include duplicate keys: ${s.value}`):r.push(s.value));return Object.assign(new ac,n)},createNode:(e,t,n)=>ac.from(e,t,n)};function E6({value:e,source:t},n){return t&&(e?x6:w6).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}const x6={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new at(!0),stringify:E6},w6={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new at(!1),stringify:E6},Ppe={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ni},Bpe={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():ni(e)}},Fpe={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){const t=new at(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){const r=e.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(t.minFractionDigits=r.length)}return t},stringify:ni},Yf=e=>typeof e=="bigint"||Number.isInteger(e);function g0(e,t,n,{intAsBigInt:r}){const s=e[0];if((s==="-"||s==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}const a=BigInt(e);return s==="-"?BigInt(-1)*a:a}const i=parseInt(e,n);return s==="-"?-1*i:i}function i_(e,t,n){const{value:r}=e;if(Yf(r)){const s=r.toString(t);return r<0?"-"+n+s.substr(1):n+s}return ni(e)}const Upe={identify:Yf,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>g0(e,2,2,n),stringify:e=>i_(e,2,"0b")},$pe={identify:Yf,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>g0(e,1,8,n),stringify:e=>i_(e,8,"0")},Hpe={identify:Yf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>g0(e,0,10,n),stringify:ni},zpe={identify:Yf,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>g0(e,2,16,n),stringify:e=>i_(e,16,"0x")};class oc extends Es{constructor(t){super(t),this.tag=oc.tag}add(t){let n;Nn(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new Ar(t.key,null):n=new Ar(t,null),_o(this.items,n.key)||this.items.push(n)}get(t,n){const r=_o(this.items,t);return!n&&Nn(r)?zt(r.key)?r.key.value:r.key:r}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);const r=_o(this.items,t);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new Ar(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,r){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(t,n,r){const{replacer:s}=r,i=new this(t);if(n&&Symbol.iterator in Object(n))for(let a of n)typeof s=="function"&&(a=s.call(n,a,a)),i.items.push(Jv(a,null,r));return i}}oc.tag="tag:yaml.org,2002:set";const a_={collection:"map",identify:e=>e instanceof Set,nodeClass:oc,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>oc.from(e,t,n),resolve(e,t){if(Vf(e)){if(e.hasAllNullValues(!0))return Object.assign(new oc,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function o_(e,t){const n=e[0],r=n==="-"||n==="+"?e.substring(1):e,s=a=>t?BigInt(a):Number(a),i=r.replace(/_/g,"").split(":").reduce((a,o)=>a*s(60)+s(o),s(0));return n==="-"?s(-1)*i:i}function v6(e){let{value:t}=e,n=a=>a;if(typeof t=="bigint")n=a=>BigInt(a);else if(isNaN(t)||!isFinite(t))return ni(e);let r="";t<0&&(r="-",t*=n(-1));const s=n(60),i=[t%s];return t<60?i.unshift(0):(t=(t-i[0])/s,i.unshift(t%s),t>=60&&(t=(t-i[0])/s,i.unshift(t))),r+i.map(a=>String(a).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const _6={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>o_(e,n),stringify:v6},k6={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>o_(e,!1),stringify:v6},y0={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){const t=e.match(y0.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,n,r,s,i,a,o]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0;let u=Date.UTC(n,r-1,s,i||0,a||0,o||0,c);const d=t[8];if(d&&d!=="Z"){let f=o_(d,!1);Math.abs(f)<30&&(f*=60),u-=6e4*f}return new Date(u)},stringify:({value:e})=>(e==null?void 0:e.toISOString().replace(/(T00:00:00)?\.000Z$/,""))??""},FA=[su,iu,h0,p0,x6,w6,Upe,$pe,Hpe,zpe,Ppe,Bpe,Fpe,n_,Gi,s_,r_,a_,_6,k6,y0],UA=new Map([["core",Lpe],["failsafe",[su,iu,h0]],["json",Dpe],["yaml11",FA],["yaml-1.1",FA]]),$A={binary:n_,bool:e_,float:f6,floatExp:d6,floatNaN:u6,floatTime:k6,int:m6,intHex:g6,intOct:p6,intTime:_6,map:su,merge:Gi,null:p0,omap:s_,pairs:r_,seq:iu,set:a_,timestamp:y0},Vpe={"tag:yaml.org,2002:binary":n_,"tag:yaml.org,2002:merge":Gi,"tag:yaml.org,2002:omap":s_,"tag:yaml.org,2002:pairs":r_,"tag:yaml.org,2002:set":a_,"tag:yaml.org,2002:timestamp":y0};function ib(e,t,n){const r=UA.get(t);if(r&&!e)return n&&!r.includes(Gi)?r.concat(Gi):r.slice();let s=r;if(!s)if(Array.isArray(e))s=[];else{const i=Array.from(UA.keys()).filter(a=>a!=="yaml11").map(a=>JSON.stringify(a)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${i} or define customTags array`)}if(Array.isArray(e))for(const i of e)s=s.concat(i);else typeof e=="function"&&(s=e(s.slice()));return n&&(s=s.concat(Gi)),s.reduce((i,a)=>{const o=typeof a=="string"?$A[a]:a;if(!o){const c=JSON.stringify(a),u=Object.keys($A).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${u}`)}return i.includes(o)||i.push(o),i},[])}const Kpe=(e,t)=>e.keyt.key?1:0;class l_{constructor({compat:t,customTags:n,merge:r,resolveKnownTags:s,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(t)?ib(t,"compat"):t?ib(null,t):null,this.name=typeof i=="string"&&i||"core",this.knownTags=s?Vpe:{},this.tags=ib(n,this.name,r),this.toStringOptions=o??null,Object.defineProperty(this,Da,{value:su}),Object.defineProperty(this,vi,{value:h0}),Object.defineProperty(this,tu,{value:iu}),this.sortMapEntries=typeof a=="function"?a:a===!0?Kpe:null}clone(){const t=Object.create(l_.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}}function Ype(e,t){var c;const n=[];let r=t.directives===!0;if(t.directives!==!1&&e.directives){const u=e.directives.toString(e);u?(n.push(u),r=!0):e.directives.docStart&&(r=!0)}r&&n.push("---");const s=s6(e,t),{commentString:i}=s.options;if(e.commentBefore){n.length!==1&&n.unshift("");const u=i(e.commentBefore);n.unshift(Vi(u,""))}let a=!1,o=null;if(e.contents){if(kn(e.contents)){if(e.contents.spaceBefore&&r&&n.push(""),e.contents.commentBefore){const f=i(e.contents.commentBefore);n.push(Vi(f,""))}s.forceBlockIndent=!!e.comment,o=e.contents.comment}const u=o?void 0:()=>a=!0;let d=Fc(e.contents,s,()=>o=null,u);o&&(d+=vo(d,"",i(o))),(d[0]==="|"||d[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${d}`:n.push(d)}else n.push(Fc(e.contents,s));if((c=e.directives)!=null&&c.docEnd)if(e.comment){const u=i(e.comment);u.includes(` +${i.comment}`:r.comment}r=s}e.items[n]=Nn(r)?r:new Ar(r)}}else t("Expected a sequence for this tag");return e}function y6(e,t,n){const{replacer:r}=n,s=new Ko(e);s.tag="tag:yaml.org,2002:pairs";let i=0;if(t&&Symbol.iterator in Object(t))for(let a of t){typeof r=="function"&&(a=r.call(t,String(i++),a));let o,c;if(Array.isArray(a))if(a.length===2)o=a[0],c=a[1];else throw new TypeError(`Expected [key, value] tuple: ${a}`);else if(a&&a instanceof Object){const u=Object.keys(a);if(u.length===1)o=u[0],c=a[o];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else o=a;s.items.push(Zv(o,c,n))}return s}const n_={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:g6,createNode:y6};class ic extends Ko{constructor(){super(),this.add=Es.prototype.add.bind(this),this.delete=Es.prototype.delete.bind(this),this.get=Es.prototype.get.bind(this),this.has=Es.prototype.has.bind(this),this.set=Es.prototype.set.bind(this),this.tag=ic.tag}toJSON(t,n){if(!n)return super.toJSON(t);const r=new Map;n!=null&&n.onCreate&&n.onCreate(r);for(const s of this.items){let i,a;if(Nn(s)?(i=_s(s.key,"",n),a=_s(s.value,i,n)):i=_s(s,"",n),r.has(i))throw new Error("Ordered maps must not include duplicate keys");r.set(i,a)}return r}static from(t,n,r){const s=y6(t,n,r),i=new this;return i.items=s.items,i}}ic.tag="tag:yaml.org,2002:omap";const r_={collection:"seq",identify:e=>e instanceof Map,nodeClass:ic,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const n=g6(e,t),r=[];for(const{key:s}of n.items)zt(s)&&(r.includes(s.value)?t(`Ordered maps must not include duplicate keys: ${s.value}`):r.push(s.value));return Object.assign(new ic,n)},createNode:(e,t,n)=>ic.from(e,t,n)};function b6({value:e,source:t},n){return t&&(e?E6:x6).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}const E6={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new at(!0),stringify:b6},x6={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new at(!1),stringify:b6},Dpe={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ni},Ppe={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():ni(e)}},Bpe={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){const t=new at(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){const r=e.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(t.minFractionDigits=r.length)}return t},stringify:ni},Kf=e=>typeof e=="bigint"||Number.isInteger(e);function m0(e,t,n,{intAsBigInt:r}){const s=e[0];if((s==="-"||s==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}const a=BigInt(e);return s==="-"?BigInt(-1)*a:a}const i=parseInt(e,n);return s==="-"?-1*i:i}function s_(e,t,n){const{value:r}=e;if(Kf(r)){const s=r.toString(t);return r<0?"-"+n+s.substr(1):n+s}return ni(e)}const Fpe={identify:Kf,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>m0(e,2,2,n),stringify:e=>s_(e,2,"0b")},Upe={identify:Kf,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>m0(e,1,8,n),stringify:e=>s_(e,8,"0")},$pe={identify:Kf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>m0(e,0,10,n),stringify:ni},Hpe={identify:Kf,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>m0(e,2,16,n),stringify:e=>s_(e,16,"0x")};class ac extends Es{constructor(t){super(t),this.tag=ac.tag}add(t){let n;Nn(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new Ar(t.key,null):n=new Ar(t,null),vo(this.items,n.key)||this.items.push(n)}get(t,n){const r=vo(this.items,t);return!n&&Nn(r)?zt(r.key)?r.key.value:r.key:r}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);const r=vo(this.items,t);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new Ar(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,r){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(t,n,r){const{replacer:s}=r,i=new this(t);if(n&&Symbol.iterator in Object(n))for(let a of n)typeof s=="function"&&(a=s.call(n,a,a)),i.items.push(Zv(a,null,r));return i}}ac.tag="tag:yaml.org,2002:set";const i_={collection:"map",identify:e=>e instanceof Set,nodeClass:ac,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>ac.from(e,t,n),resolve(e,t){if(zf(e)){if(e.hasAllNullValues(!0))return Object.assign(new ac,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function a_(e,t){const n=e[0],r=n==="-"||n==="+"?e.substring(1):e,s=a=>t?BigInt(a):Number(a),i=r.replace(/_/g,"").split(":").reduce((a,o)=>a*s(60)+s(o),s(0));return n==="-"?s(-1)*i:i}function w6(e){let{value:t}=e,n=a=>a;if(typeof t=="bigint")n=a=>BigInt(a);else if(isNaN(t)||!isFinite(t))return ni(e);let r="";t<0&&(r="-",t*=n(-1));const s=n(60),i=[t%s];return t<60?i.unshift(0):(t=(t-i[0])/s,i.unshift(t%s),t>=60&&(t=(t-i[0])/s,i.unshift(t))),r+i.map(a=>String(a).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const v6={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>a_(e,n),stringify:w6},_6={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>a_(e,!1),stringify:w6},g0={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){const t=e.match(g0.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,n,r,s,i,a,o]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0;let u=Date.UTC(n,r-1,s,i||0,a||0,o||0,c);const d=t[8];if(d&&d!=="Z"){let f=a_(d,!1);Math.abs(f)<30&&(f*=60),u-=6e4*f}return new Date(u)},stringify:({value:e})=>(e==null?void 0:e.toISOString().replace(/(T00:00:00)?\.000Z$/,""))??""},BA=[ru,su,f0,h0,E6,x6,Fpe,Upe,$pe,Hpe,Dpe,Ppe,Bpe,t_,Gi,r_,n_,i_,v6,_6,g0],FA=new Map([["core",Rpe],["failsafe",[ru,su,f0]],["json",jpe],["yaml11",BA],["yaml-1.1",BA]]),UA={binary:t_,bool:Jv,float:d6,floatExp:u6,floatNaN:c6,floatTime:_6,int:p6,intHex:m6,intOct:h6,intTime:v6,map:ru,merge:Gi,null:h0,omap:r_,pairs:n_,seq:su,set:i_,timestamp:g0},zpe={"tag:yaml.org,2002:binary":t_,"tag:yaml.org,2002:merge":Gi,"tag:yaml.org,2002:omap":r_,"tag:yaml.org,2002:pairs":n_,"tag:yaml.org,2002:set":i_,"tag:yaml.org,2002:timestamp":g0};function sb(e,t,n){const r=FA.get(t);if(r&&!e)return n&&!r.includes(Gi)?r.concat(Gi):r.slice();let s=r;if(!s)if(Array.isArray(e))s=[];else{const i=Array.from(FA.keys()).filter(a=>a!=="yaml11").map(a=>JSON.stringify(a)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${i} or define customTags array`)}if(Array.isArray(e))for(const i of e)s=s.concat(i);else typeof e=="function"&&(s=e(s.slice()));return n&&(s=s.concat(Gi)),s.reduce((i,a)=>{const o=typeof a=="string"?UA[a]:a;if(!o){const c=JSON.stringify(a),u=Object.keys(UA).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${u}`)}return i.includes(o)||i.push(o),i},[])}const Vpe=(e,t)=>e.keyt.key?1:0;class o_{constructor({compat:t,customTags:n,merge:r,resolveKnownTags:s,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(t)?sb(t,"compat"):t?sb(null,t):null,this.name=typeof i=="string"&&i||"core",this.knownTags=s?zpe:{},this.tags=sb(n,this.name,r),this.toStringOptions=o??null,Object.defineProperty(this,Da,{value:ru}),Object.defineProperty(this,vi,{value:f0}),Object.defineProperty(this,eu,{value:su}),this.sortMapEntries=typeof a=="function"?a:a===!0?Vpe:null}clone(){const t=Object.create(o_.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}}function Kpe(e,t){var c;const n=[];let r=t.directives===!0;if(t.directives!==!1&&e.directives){const u=e.directives.toString(e);u?(n.push(u),r=!0):e.directives.docStart&&(r=!0)}r&&n.push("---");const s=r6(e,t),{commentString:i}=s.options;if(e.commentBefore){n.length!==1&&n.unshift("");const u=i(e.commentBefore);n.unshift(Vi(u,""))}let a=!1,o=null;if(e.contents){if(kn(e.contents)){if(e.contents.spaceBefore&&r&&n.push(""),e.contents.commentBefore){const f=i(e.contents.commentBefore);n.push(Vi(f,""))}s.forceBlockIndent=!!e.comment,o=e.contents.comment}const u=o?void 0:()=>a=!0;let d=Bc(e.contents,s,()=>o=null,u);o&&(d+=wo(d,"",i(o))),(d[0]==="|"||d[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${d}`:n.push(d)}else n.push(Bc(e.contents,s));if((c=e.directives)!=null&&c.docEnd)if(e.comment){const u=i(e.comment);u.includes(` `)?(n.push("..."),n.push(Vi(u,""))):n.push(`... ${u}`)}else n.push("...");else{let u=e.comment;u&&a&&(u=u.replace(/^\n+/,"")),u&&((!a||o)&&n[n.length-1]!==""&&n.push(""),n.push(Vi(i(u),"")))}return n.join(` `)+` -`}class Wf{constructor(t,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Ts,{value:HE});let s=null;typeof n=="function"||Array.isArray(n)?s=n:r===void 0&&n&&(r=n,n=void 0);const i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=i;let{version:a}=i;r!=null&&r._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new kr({version:a}),this.setSchema(a,r),this.contents=t===void 0?null:this.createNode(t,s,r)}clone(){const t=Object.create(Wf.prototype,{[Ts]:{value:HE}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=kn(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){ml(this.contents)&&this.contents.add(t)}addIn(t,n){ml(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){const r=J4(this);t.anchor=!n||r.has(n)?e6(n||"a",r):n}return new Qv(t.anchor)}createNode(t,n,r){let s;if(typeof n=="function")t=n.call({"":t},"",t),s=n;else if(Array.isArray(n)){const E=x=>typeof x=="number"||x instanceof String||x instanceof Number,g=n.filter(E).map(String);g.length>0&&(n=n.concat(g)),s=n}else r===void 0&&n&&(r=n,n=void 0);const{aliasDuplicateObjects:i,anchorPrefix:a,flow:o,keepUndefined:c,onTagObj:u,tag:d}=r??{},{onAnchor:f,setAnchors:h,sourceObjects:p}=xpe(this,a||"a"),m={aliasDuplicateObjects:i??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:u,replacer:s,schema:this.schema,sourceObjects:p},y=hf(t,d,m);return o&&_n(y)&&(y.flow=!0),h(),y}createPair(t,n,r={}){const s=this.createNode(t,null,r),i=this.createNode(n,null,r);return new Ar(s,i)}delete(t){return ml(this.contents)?this.contents.delete(t):!1}deleteIn(t){return Ku(t)?this.contents==null?!1:(this.contents=null,!0):ml(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return _n(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return Ku(t)?!n&&zt(this.contents)?this.contents.value:this.contents:_n(this.contents)?this.contents.getIn(t,n):void 0}has(t){return _n(this.contents)?this.contents.has(t):!1}hasIn(t){return Ku(t)?this.contents!==void 0:_n(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=Zm(this.schema,[t],n):ml(this.contents)&&this.contents.set(t,n)}setIn(t,n){Ku(t)?this.contents=n:this.contents==null?this.contents=Zm(this.schema,Array.from(t),n):ml(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let r;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new kr({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new kr({version:t}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{const s=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${s}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new l_(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:r,maxAliasCount:s,onAnchor:i,reviver:a}={}){const o={anchors:new Map,doc:this,keep:!t,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},c=_s(this.contents,n??"",o);if(typeof i=="function")for(const{count:u,res:d}of o.anchors.values())i(d,u);return typeof a=="function"?Wl(a,{"":c},"",c):c}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){const n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return Ype(this,t)}}function ml(e){if(_n(e))return!0;throw new Error("Expected a YAML collection as document contents")}class N6 extends Error{constructor(t,n,r,s){super(),this.name=t,this.code=r,this.message=s,this.pos=n}}class Yu extends N6{constructor(t,n,r){super("YAMLParseError",t,n,r)}}class Wpe extends N6{constructor(t,n,r){super("YAMLWarning",t,n,r)}}const HA=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(o=>t.linePos(o));const{line:r,col:s}=n.linePos[0];n.message+=` at line ${r}, column ${s}`;let i=s-1,a=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,"");if(i>=60&&a.length>80){const o=Math.min(i-39,a.length-79);a="…"+a.substring(o),i-=o-1}if(a.length>80&&(a=a.substring(0,79)+"…"),r>1&&/^ *$/.test(a.substring(0,i))){let o=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);o.length>80&&(o=o.substring(0,79)+`… +`}class Yf{constructor(t,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Ts,{value:$E});let s=null;typeof n=="function"||Array.isArray(n)?s=n:r===void 0&&n&&(r=n,n=void 0);const i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=i;let{version:a}=i;r!=null&&r._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new kr({version:a}),this.setSchema(a,r),this.contents=t===void 0?null:this.createNode(t,s,r)}clone(){const t=Object.create(Yf.prototype,{[Ts]:{value:$E}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=kn(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){pl(this.contents)&&this.contents.add(t)}addIn(t,n){pl(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){const r=Z4(this);t.anchor=!n||r.has(n)?J4(n||"a",r):n}return new Xv(t.anchor)}createNode(t,n,r){let s;if(typeof n=="function")t=n.call({"":t},"",t),s=n;else if(Array.isArray(n)){const E=x=>typeof x=="number"||x instanceof String||x instanceof Number,g=n.filter(E).map(String);g.length>0&&(n=n.concat(g)),s=n}else r===void 0&&n&&(r=n,n=void 0);const{aliasDuplicateObjects:i,anchorPrefix:a,flow:o,keepUndefined:c,onTagObj:u,tag:d}=r??{},{onAnchor:f,setAnchors:h,sourceObjects:p}=Epe(this,a||"a"),m={aliasDuplicateObjects:i??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:u,replacer:s,schema:this.schema,sourceObjects:p},y=ff(t,d,m);return o&&_n(y)&&(y.flow=!0),h(),y}createPair(t,n,r={}){const s=this.createNode(t,null,r),i=this.createNode(n,null,r);return new Ar(s,i)}delete(t){return pl(this.contents)?this.contents.delete(t):!1}deleteIn(t){return Vu(t)?this.contents==null?!1:(this.contents=null,!0):pl(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return _n(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return Vu(t)?!n&&zt(this.contents)?this.contents.value:this.contents:_n(this.contents)?this.contents.getIn(t,n):void 0}has(t){return _n(this.contents)?this.contents.has(t):!1}hasIn(t){return Vu(t)?this.contents!==void 0:_n(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=Qm(this.schema,[t],n):pl(this.contents)&&this.contents.set(t,n)}setIn(t,n){Vu(t)?this.contents=n:this.contents==null?this.contents=Qm(this.schema,Array.from(t),n):pl(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let r;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new kr({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new kr({version:t}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{const s=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${s}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new o_(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:r,maxAliasCount:s,onAnchor:i,reviver:a}={}){const o={anchors:new Map,doc:this,keep:!t,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},c=_s(this.contents,n??"",o);if(typeof i=="function")for(const{count:u,res:d}of o.anchors.values())i(d,u);return typeof a=="function"?Yl(a,{"":c},"",c):c}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){const n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return Kpe(this,t)}}function pl(e){if(_n(e))return!0;throw new Error("Expected a YAML collection as document contents")}class k6 extends Error{constructor(t,n,r,s){super(),this.name=t,this.code=r,this.message=s,this.pos=n}}class Ku extends k6{constructor(t,n,r){super("YAMLParseError",t,n,r)}}class Ype extends k6{constructor(t,n,r){super("YAMLWarning",t,n,r)}}const $A=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(o=>t.linePos(o));const{line:r,col:s}=n.linePos[0];n.message+=` at line ${r}, column ${s}`;let i=s-1,a=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,"");if(i>=60&&a.length>80){const o=Math.min(i-39,a.length-79);a="…"+a.substring(o),i-=o-1}if(a.length>80&&(a=a.substring(0,79)+"…"),r>1&&/^ *$/.test(a.substring(0,i))){let o=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);o.length>80&&(o=o.substring(0,79)+`… `),a=o+a}if(/[^ ]/.test(a)){let o=1;const c=n.linePos[1];(c==null?void 0:c.line)===r&&c.col>s&&(o=Math.max(1,Math.min(c.col-s,80-i)));const u=" ".repeat(i)+"^".repeat(o);n.message+=`: ${a} ${u} -`}};function Uc(e,{flow:t,indicator:n,next:r,offset:s,onError:i,parentIndent:a,startOnNewline:o}){let c=!1,u=o,d=o,f="",h="",p=!1,m=!1,y=null,E=null,g=null,x=null,b=null,_=null,k=null;for(const S of e)switch(m&&(S.type!=="space"&&S.type!=="newline"&&S.type!=="comma"&&i(S.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),y&&(u&&S.type!=="comment"&&S.type!=="newline"&&i(y,"TAB_AS_INDENT","Tabs are not allowed as indentation"),y=null),S.type){case"space":!t&&(n!=="doc-start"||(r==null?void 0:r.type)!=="flow-collection")&&S.source.includes(" ")&&(y=S),d=!0;break;case"comment":{d||i(S,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const A=S.source.substring(1)||" ";f?f+=h+A:f=A,h="",u=!1;break}case"newline":u?f?f+=S.source:(!_||n!=="seq-item-ind")&&(c=!0):h+=S.source,u=!0,p=!0,(E||g)&&(x=S),d=!0;break;case"anchor":E&&i(S,"MULTIPLE_ANCHORS","A node can have at most one anchor"),S.source.endsWith(":")&&i(S.offset+S.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),E=S,k??(k=S.offset),u=!1,d=!1,m=!0;break;case"tag":{g&&i(S,"MULTIPLE_TAGS","A node can have at most one tag"),g=S,k??(k=S.offset),u=!1,d=!1,m=!0;break}case n:(E||g)&&i(S,"BAD_PROP_ORDER",`Anchors and tags must be after the ${S.source} indicator`),_&&i(S,"UNEXPECTED_TOKEN",`Unexpected ${S.source} in ${t??"collection"}`),_=S,u=n==="seq-item-ind"||n==="explicit-key-ind",d=!1;break;case"comma":if(t){b&&i(S,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),b=S,u=!1,d=!1;break}default:i(S,"UNEXPECTED_TOKEN",`Unexpected ${S.type} token`),u=!1,d=!1}const N=e[e.length-1],C=N?N.offset+N.source.length:s;return m&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&i(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),y&&(u&&y.indent<=a||(r==null?void 0:r.type)==="block-map"||(r==null?void 0:r.type)==="block-seq")&&i(y,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:_,spaceBefore:c,comment:f,hasNewline:p,anchor:E,tag:g,newlineAfterProp:x,end:C,start:k??C}}function pf(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(` -`))return!0;if(e.end){for(const t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(const t of e.items){for(const n of t.start)if(n.type==="newline")return!0;if(t.sep){for(const n of t.sep)if(n.type==="newline")return!0}if(pf(t.key)||pf(t.value))return!0}return!1;default:return!0}}function YE(e,t,n){if((t==null?void 0:t.type)==="flow-collection"){const r=t.end[0];r.indent===e&&(r.source==="]"||r.source==="}")&&pf(t)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function S6(e,t,n){const{uniqueKeys:r}=e.options;if(r===!1)return!1;const s=typeof r=="function"?r:(i,a)=>i===a||zt(i)&&zt(a)&&i.value===a.value;return t.some(i=>s(i.key,n))}const zA="All mapping items must start at the same column";function Gpe({composeNode:e,composeEmptyNode:t},n,r,s,i){var d;const a=(i==null?void 0:i.nodeClass)??Es,o=new a(n.schema);n.atRoot&&(n.atRoot=!1);let c=r.offset,u=null;for(const f of r.items){const{start:h,key:p,sep:m,value:y}=f,E=Uc(h,{indicator:"explicit-key-ind",next:p??(m==null?void 0:m[0]),offset:c,onError:s,parentIndent:r.indent,startOnNewline:!0}),g=!E.found;if(g){if(p&&(p.type==="block-seq"?s(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==r.indent&&s(c,"BAD_INDENT",zA)),!E.anchor&&!E.tag&&!m){u=E.end,E.comment&&(o.comment?o.comment+=` -`+E.comment:o.comment=E.comment);continue}(E.newlineAfterProp||pf(p))&&s(p??h[h.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else((d=E.found)==null?void 0:d.indent)!==r.indent&&s(c,"BAD_INDENT",zA);n.atKey=!0;const x=E.end,b=p?e(n,p,E,s):t(n,x,h,null,E,s);n.schema.compat&&YE(r.indent,p,s),n.atKey=!1,S6(n,o.items,b)&&s(x,"DUPLICATE_KEY","Map keys must be unique");const _=Uc(m??[],{indicator:"map-value-ind",next:y,offset:b.range[2],onError:s,parentIndent:r.indent,startOnNewline:!p||p.type==="block-scalar"});if(c=_.end,_.found){g&&((y==null?void 0:y.type)==="block-map"&&!_.hasNewline&&s(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&E.start<_.found.offset-1024&&s(b.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));const k=y?e(n,y,_,s):t(n,c,m,null,_,s);n.schema.compat&&YE(r.indent,y,s),c=k.range[2];const N=new Ar(b,k);n.options.keepSourceTokens&&(N.srcToken=f),o.items.push(N)}else{g&&s(b.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),_.comment&&(b.comment?b.comment+=` -`+_.comment:b.comment=_.comment);const k=new Ar(b);n.options.keepSourceTokens&&(k.srcToken=f),o.items.push(k)}}return u&&ue&&(e.type==="block-map"||e.type==="block-seq");function Xpe({composeNode:e,composeEmptyNode:t},n,r,s,i){var E;const a=r.start.source==="{",o=a?"flow map":"flow sequence",c=(i==null?void 0:i.nodeClass)??(a?Es:Yo),u=new c(n.schema);u.flow=!0;const d=n.atRoot;d&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=r.offset+r.start.source.length;for(let g=0;g0){const g=Gf(m,y,n.options.strict,s);g.comment&&(u.comment?u.comment+=` -`+g.comment:u.comment=g.comment),u.range=[r.offset,y,g.offset]}else u.range=[r.offset,y,y];return u}function lb(e,t,n,r,s,i){const a=n.type==="block-map"?Gpe(e,t,n,r,i):n.type==="block-seq"?qpe(e,t,n,r,i):Xpe(e,t,n,r,i),o=a.constructor;return s==="!"||s===o.tagName?(a.tag=o.tagName,a):(s&&(a.tag=s),a)}function Qpe(e,t,n,r,s){var h;const i=r.tag,a=i?t.directives.tagName(i.source,p=>s(i,"TAG_RESOLVE_FAILED",p)):null;if(n.type==="block-seq"){const{anchor:p,newlineAfterProp:m}=r,y=p&&i?p.offset>i.offset?p:i:p??i;y&&(!m||m.offsetp.tag===a&&p.collection===o);if(!c){const p=t.schema.knownTags[a];if((p==null?void 0:p.collection)===o)t.schema.tags.push(Object.assign({},p,{default:!1})),c=p;else return p?s(i,"BAD_COLLECTION_TYPE",`${p.tag} used for ${o} collection, but expects ${p.collection??"scalar"}`,!0):s(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),lb(e,t,n,s,a)}const u=lb(e,t,n,s,a,c),d=((h=c.resolve)==null?void 0:h.call(c,u,p=>s(i,"TAG_RESOLVE_FAILED",p),t.options))??u,f=kn(d)?d:new at(d);return f.range=u.range,f.tag=a,c!=null&&c.format&&(f.format=c.format),f}function Zpe(e,t,n){const r=t.offset,s=Jpe(t,e.options.strict,n);if(!s)return{value:"",type:null,comment:"",range:[r,r,r]};const i=s.mode===">"?at.BLOCK_FOLDED:at.BLOCK_LITERAL,a=t.source?eme(t.source):[];let o=a.length;for(let y=a.length-1;y>=0;--y){const E=a[y][1];if(E===""||E==="\r")o=y;else break}if(o===0){const y=s.chomp==="+"&&a.length>0?` +`}};function Fc(e,{flow:t,indicator:n,next:r,offset:s,onError:i,parentIndent:a,startOnNewline:o}){let c=!1,u=o,d=o,f="",h="",p=!1,m=!1,y=null,E=null,g=null,x=null,b=null,_=null,k=null;for(const S of e)switch(m&&(S.type!=="space"&&S.type!=="newline"&&S.type!=="comma"&&i(S.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),y&&(u&&S.type!=="comment"&&S.type!=="newline"&&i(y,"TAB_AS_INDENT","Tabs are not allowed as indentation"),y=null),S.type){case"space":!t&&(n!=="doc-start"||(r==null?void 0:r.type)!=="flow-collection")&&S.source.includes(" ")&&(y=S),d=!0;break;case"comment":{d||i(S,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const A=S.source.substring(1)||" ";f?f+=h+A:f=A,h="",u=!1;break}case"newline":u?f?f+=S.source:(!_||n!=="seq-item-ind")&&(c=!0):h+=S.source,u=!0,p=!0,(E||g)&&(x=S),d=!0;break;case"anchor":E&&i(S,"MULTIPLE_ANCHORS","A node can have at most one anchor"),S.source.endsWith(":")&&i(S.offset+S.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),E=S,k??(k=S.offset),u=!1,d=!1,m=!0;break;case"tag":{g&&i(S,"MULTIPLE_TAGS","A node can have at most one tag"),g=S,k??(k=S.offset),u=!1,d=!1,m=!0;break}case n:(E||g)&&i(S,"BAD_PROP_ORDER",`Anchors and tags must be after the ${S.source} indicator`),_&&i(S,"UNEXPECTED_TOKEN",`Unexpected ${S.source} in ${t??"collection"}`),_=S,u=n==="seq-item-ind"||n==="explicit-key-ind",d=!1;break;case"comma":if(t){b&&i(S,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),b=S,u=!1,d=!1;break}default:i(S,"UNEXPECTED_TOKEN",`Unexpected ${S.type} token`),u=!1,d=!1}const N=e[e.length-1],C=N?N.offset+N.source.length:s;return m&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&i(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),y&&(u&&y.indent<=a||(r==null?void 0:r.type)==="block-map"||(r==null?void 0:r.type)==="block-seq")&&i(y,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:_,spaceBefore:c,comment:f,hasNewline:p,anchor:E,tag:g,newlineAfterProp:x,end:C,start:k??C}}function hf(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(` +`))return!0;if(e.end){for(const t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(const t of e.items){for(const n of t.start)if(n.type==="newline")return!0;if(t.sep){for(const n of t.sep)if(n.type==="newline")return!0}if(hf(t.key)||hf(t.value))return!0}return!1;default:return!0}}function KE(e,t,n){if((t==null?void 0:t.type)==="flow-collection"){const r=t.end[0];r.indent===e&&(r.source==="]"||r.source==="}")&&hf(t)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function N6(e,t,n){const{uniqueKeys:r}=e.options;if(r===!1)return!1;const s=typeof r=="function"?r:(i,a)=>i===a||zt(i)&&zt(a)&&i.value===a.value;return t.some(i=>s(i.key,n))}const HA="All mapping items must start at the same column";function Wpe({composeNode:e,composeEmptyNode:t},n,r,s,i){var d;const a=(i==null?void 0:i.nodeClass)??Es,o=new a(n.schema);n.atRoot&&(n.atRoot=!1);let c=r.offset,u=null;for(const f of r.items){const{start:h,key:p,sep:m,value:y}=f,E=Fc(h,{indicator:"explicit-key-ind",next:p??(m==null?void 0:m[0]),offset:c,onError:s,parentIndent:r.indent,startOnNewline:!0}),g=!E.found;if(g){if(p&&(p.type==="block-seq"?s(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==r.indent&&s(c,"BAD_INDENT",HA)),!E.anchor&&!E.tag&&!m){u=E.end,E.comment&&(o.comment?o.comment+=` +`+E.comment:o.comment=E.comment);continue}(E.newlineAfterProp||hf(p))&&s(p??h[h.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else((d=E.found)==null?void 0:d.indent)!==r.indent&&s(c,"BAD_INDENT",HA);n.atKey=!0;const x=E.end,b=p?e(n,p,E,s):t(n,x,h,null,E,s);n.schema.compat&&KE(r.indent,p,s),n.atKey=!1,N6(n,o.items,b)&&s(x,"DUPLICATE_KEY","Map keys must be unique");const _=Fc(m??[],{indicator:"map-value-ind",next:y,offset:b.range[2],onError:s,parentIndent:r.indent,startOnNewline:!p||p.type==="block-scalar"});if(c=_.end,_.found){g&&((y==null?void 0:y.type)==="block-map"&&!_.hasNewline&&s(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&E.start<_.found.offset-1024&&s(b.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));const k=y?e(n,y,_,s):t(n,c,m,null,_,s);n.schema.compat&&KE(r.indent,y,s),c=k.range[2];const N=new Ar(b,k);n.options.keepSourceTokens&&(N.srcToken=f),o.items.push(N)}else{g&&s(b.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),_.comment&&(b.comment?b.comment+=` +`+_.comment:b.comment=_.comment);const k=new Ar(b);n.options.keepSourceTokens&&(k.srcToken=f),o.items.push(k)}}return u&&ue&&(e.type==="block-map"||e.type==="block-seq");function qpe({composeNode:e,composeEmptyNode:t},n,r,s,i){var E;const a=r.start.source==="{",o=a?"flow map":"flow sequence",c=(i==null?void 0:i.nodeClass)??(a?Es:Ko),u=new c(n.schema);u.flow=!0;const d=n.atRoot;d&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=r.offset+r.start.source.length;for(let g=0;g0){const g=Wf(m,y,n.options.strict,s);g.comment&&(u.comment?u.comment+=` +`+g.comment:u.comment=g.comment),u.range=[r.offset,y,g.offset]}else u.range=[r.offset,y,y];return u}function ob(e,t,n,r,s,i){const a=n.type==="block-map"?Wpe(e,t,n,r,i):n.type==="block-seq"?Gpe(e,t,n,r,i):qpe(e,t,n,r,i),o=a.constructor;return s==="!"||s===o.tagName?(a.tag=o.tagName,a):(s&&(a.tag=s),a)}function Xpe(e,t,n,r,s){var h;const i=r.tag,a=i?t.directives.tagName(i.source,p=>s(i,"TAG_RESOLVE_FAILED",p)):null;if(n.type==="block-seq"){const{anchor:p,newlineAfterProp:m}=r,y=p&&i?p.offset>i.offset?p:i:p??i;y&&(!m||m.offsetp.tag===a&&p.collection===o);if(!c){const p=t.schema.knownTags[a];if((p==null?void 0:p.collection)===o)t.schema.tags.push(Object.assign({},p,{default:!1})),c=p;else return p?s(i,"BAD_COLLECTION_TYPE",`${p.tag} used for ${o} collection, but expects ${p.collection??"scalar"}`,!0):s(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),ob(e,t,n,s,a)}const u=ob(e,t,n,s,a,c),d=((h=c.resolve)==null?void 0:h.call(c,u,p=>s(i,"TAG_RESOLVE_FAILED",p),t.options))??u,f=kn(d)?d:new at(d);return f.range=u.range,f.tag=a,c!=null&&c.format&&(f.format=c.format),f}function Qpe(e,t,n){const r=t.offset,s=Zpe(t,e.options.strict,n);if(!s)return{value:"",type:null,comment:"",range:[r,r,r]};const i=s.mode===">"?at.BLOCK_FOLDED:at.BLOCK_LITERAL,a=t.source?Jpe(t.source):[];let o=a.length;for(let y=a.length-1;y>=0;--y){const E=a[y][1];if(E===""||E==="\r")o=y;else break}if(o===0){const y=s.chomp==="+"&&a.length>0?` `.repeat(Math.max(1,a.length-1)):"";let E=r+s.length;return t.source&&(E+=t.source.length),{value:y,type:i,comment:s.comment,range:[r,E,E]}}let c=t.indent+s.indent,u=t.offset+s.length,d=0;for(let y=0;yc&&(c=E.length);else{E.length=o;--y)a[y][0].length>c&&(o=y+1);let f="",h="",p=!1;for(let y=0;yc||g[0]===" "?(h===" "?h=` @@ -649,60 +649,60 @@ ${u} `+a[y][0].slice(c);f[f.length-1]!==` `&&(f+=` `);break;default:f+=` -`}const m=r+s.length+t.source.length;return{value:f,type:i,comment:s.comment,range:[r,m,m]}}function Jpe({offset:e,props:t},n,r){if(t[0].type!=="block-scalar-header")return r(t[0],"IMPOSSIBLE","Block scalar header not found"),null;const{source:s}=t[0],i=s[0];let a=0,o="",c=-1;for(let h=1;hn(r+h,p,m);switch(s){case"scalar":o=at.PLAIN,c=nme(i,u);break;case"single-quoted-scalar":o=at.QUOTE_SINGLE,c=rme(i,u);break;case"double-quoted-scalar":o=at.QUOTE_DOUBLE,c=sme(i,u);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${s}`),{value:"",type:null,comment:"",range:[r,r+i.length,r+i.length]}}const d=r+i.length,f=Gf(a,d,t,n);return{value:c,type:o,comment:f.comment,range:[r,d,f.offset]}}function nme(e,t){let n="";switch(e[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),T6(e)}function rme(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),T6(e.slice(1,-1)).replace(/''/g,"'")}function T6(e){let t,n;try{t=new RegExp(`(.*?)(?n(r+h,p,m);switch(s){case"scalar":o=at.PLAIN,c=tme(i,u);break;case"single-quoted-scalar":o=at.QUOTE_SINGLE,c=nme(i,u);break;case"double-quoted-scalar":o=at.QUOTE_DOUBLE,c=rme(i,u);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${s}`),{value:"",type:null,comment:"",range:[r,r+i.length,r+i.length]}}const d=r+i.length,f=Wf(a,d,t,n);return{value:c,type:o,comment:f.comment,range:[r,d,f.offset]}}function tme(e,t){let n="";switch(e[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),S6(e)}function nme(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),S6(e.slice(1,-1)).replace(/''/g,"'")}function S6(e){let t,n;try{t=new RegExp(`(.*?)(?i?e.slice(i,r+1):s)}else n+=s}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function ime(e,t){let n="",r=e[t+1];for(;(r===" "||r===" "||r===` +`)&&(n+=r>i?e.slice(i,r+1):s)}else n+=s}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function sme(e,t){let n="",r=e[t+1];for(;(r===" "||r===" "||r===` `||r==="\r")&&!(r==="\r"&&e[t+2]!==` `);)r===` `&&(n+=` -`),t+=1,r=e[t+1];return n||(n=" "),{fold:n,offset:t}}const ame={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function ome(e,t,n,r){const s=e.substr(t,n),a=s.length===n&&/^[0-9a-fA-F]+$/.test(s)?parseInt(s,16):NaN;try{return String.fromCodePoint(a)}catch{const o=e.substr(t-2,n+2);return r(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${o}`),o}}function A6(e,t,n,r){const{value:s,type:i,comment:a,range:o}=t.type==="block-scalar"?Zpe(e,t,r):tme(t,e.options.strict,r),c=n?e.directives.tagName(n.source,f=>r(n,"TAG_RESOLVE_FAILED",f)):null;let u;e.options.stringKeys&&e.atKey?u=e.schema[vi]:c?u=lme(e.schema,s,c,n,r):t.type==="scalar"?u=cme(e,s,t,r):u=e.schema[vi];let d;try{const f=u.resolve(s,h=>r(n??t,"TAG_RESOLVE_FAILED",h),e.options);d=zt(f)?f:new at(f)}catch(f){const h=f instanceof Error?f.message:String(f);r(n??t,"TAG_RESOLVE_FAILED",h),d=new at(s)}return d.range=o,d.source=s,i&&(d.type=i),c&&(d.tag=c),u.format&&(d.format=u.format),a&&(d.comment=a),d}function lme(e,t,n,r,s){var o;if(n==="!")return e[vi];const i=[];for(const c of e.tags)if(!c.collection&&c.tag===n)if(c.default&&c.test)i.push(c);else return c;for(const c of i)if((o=c.test)!=null&&o.test(t))return c;const a=e.knownTags[n];return a&&!a.collection?(e.tags.push(Object.assign({},a,{default:!1,test:void 0})),a):(s(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[vi])}function cme({atKey:e,directives:t,schema:n},r,s,i){const a=n.tags.find(o=>{var c;return(o.default===!0||e&&o.default==="key")&&((c=o.test)==null?void 0:c.test(r))})||n[vi];if(n.compat){const o=n.compat.find(c=>{var u;return c.default&&((u=c.test)==null?void 0:u.test(r))})??n[vi];if(a.tag!==o.tag){const c=t.tagString(a.tag),u=t.tagString(o.tag),d=`Value may be parsed as either ${c} or ${u}`;i(s,"TAG_RESOLVE_FAILED",d,!0)}}return a}function ume(e,t,n){if(t){n??(n=t.length);for(let r=n-1;r>=0;--r){let s=t[r];switch(s.type){case"space":case"comment":case"newline":e-=s.source.length;continue}for(s=t[++r];(s==null?void 0:s.type)==="space";)e+=s.source.length,s=t[++r];break}}return e}const dme={composeNode:C6,composeEmptyNode:c_};function C6(e,t,n,r){const s=e.atKey,{spaceBefore:i,comment:a,anchor:o,tag:c}=n;let u,d=!0;switch(t.type){case"alias":u=fme(e,t,r),(o||c)&&r(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":u=A6(e,t,c,r),o&&(u.anchor=o.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=Qpe(dme,e,t,n,r),o&&(u.anchor=o.source.substring(1))}catch(f){const h=f instanceof Error?f.message:String(f);r(t,"RESOURCE_EXHAUSTION",h)}break;default:{const f=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;r(t,"UNEXPECTED_TOKEN",f),d=!1}}return u??(u=c_(e,t.offset,void 0,null,n,r)),o&&u.anchor===""&&r(o,"BAD_ALIAS","Anchor cannot be an empty string"),s&&e.options.stringKeys&&(!zt(u)||typeof u.value!="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str")&&r(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),i&&(u.spaceBefore=!0),a&&(t.type==="scalar"&&t.source===""?u.comment=a:u.commentBefore=a),e.options.keepSourceTokens&&d&&(u.srcToken=t),u}function c_(e,t,n,r,{spaceBefore:s,comment:i,anchor:a,tag:o,end:c},u){const d={type:"scalar",offset:ume(t,n,r),indent:-1,source:""},f=A6(e,d,o,u);return a&&(f.anchor=a.source.substring(1),f.anchor===""&&u(a,"BAD_ALIAS","Anchor cannot be an empty string")),s&&(f.spaceBefore=!0),i&&(f.comment=i,f.range[2]=c),f}function fme({options:e},{offset:t,source:n,end:r},s){const i=new Qv(n.substring(1));i.source===""&&s(t,"BAD_ALIAS","Alias cannot be an empty string"),i.source.endsWith(":")&&s(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const a=t+n.length,o=Gf(r,a,e.strict,s);return i.range=[t,a,o.offset],o.comment&&(i.comment=o.comment),i}function hme(e,t,{offset:n,start:r,value:s,end:i},a){const o=Object.assign({_directives:t},e),c=new Wf(void 0,o),u={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=Uc(r,{indicator:"doc-start",next:s??(i==null?void 0:i[0]),offset:n,onError:a,parentIndent:0,startOnNewline:!0});d.found&&(c.directives.docStart=!0,s&&(s.type==="block-map"||s.type==="block-seq")&&!d.hasNewline&&a(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=s?C6(u,s,d,a):c_(u,d.end,r,null,d,a);const f=c.contents.range[2],h=Gf(i,f,!1,a);return h.comment&&(c.comment=h.comment),c.range=[n,f,h.offset],c}function Cu(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];const{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function VA(e){var s;let t="",n=!1,r=!1;for(let i=0;ir(n,"TAG_RESOLVE_FAILED",f)):null;let u;e.options.stringKeys&&e.atKey?u=e.schema[vi]:c?u=ome(e.schema,s,c,n,r):t.type==="scalar"?u=lme(e,s,t,r):u=e.schema[vi];let d;try{const f=u.resolve(s,h=>r(n??t,"TAG_RESOLVE_FAILED",h),e.options);d=zt(f)?f:new at(f)}catch(f){const h=f instanceof Error?f.message:String(f);r(n??t,"TAG_RESOLVE_FAILED",h),d=new at(s)}return d.range=o,d.source=s,i&&(d.type=i),c&&(d.tag=c),u.format&&(d.format=u.format),a&&(d.comment=a),d}function ome(e,t,n,r,s){var o;if(n==="!")return e[vi];const i=[];for(const c of e.tags)if(!c.collection&&c.tag===n)if(c.default&&c.test)i.push(c);else return c;for(const c of i)if((o=c.test)!=null&&o.test(t))return c;const a=e.knownTags[n];return a&&!a.collection?(e.tags.push(Object.assign({},a,{default:!1,test:void 0})),a):(s(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[vi])}function lme({atKey:e,directives:t,schema:n},r,s,i){const a=n.tags.find(o=>{var c;return(o.default===!0||e&&o.default==="key")&&((c=o.test)==null?void 0:c.test(r))})||n[vi];if(n.compat){const o=n.compat.find(c=>{var u;return c.default&&((u=c.test)==null?void 0:u.test(r))})??n[vi];if(a.tag!==o.tag){const c=t.tagString(a.tag),u=t.tagString(o.tag),d=`Value may be parsed as either ${c} or ${u}`;i(s,"TAG_RESOLVE_FAILED",d,!0)}}return a}function cme(e,t,n){if(t){n??(n=t.length);for(let r=n-1;r>=0;--r){let s=t[r];switch(s.type){case"space":case"comment":case"newline":e-=s.source.length;continue}for(s=t[++r];(s==null?void 0:s.type)==="space";)e+=s.source.length,s=t[++r];break}}return e}const ume={composeNode:A6,composeEmptyNode:l_};function A6(e,t,n,r){const s=e.atKey,{spaceBefore:i,comment:a,anchor:o,tag:c}=n;let u,d=!0;switch(t.type){case"alias":u=dme(e,t,r),(o||c)&&r(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":u=T6(e,t,c,r),o&&(u.anchor=o.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=Xpe(ume,e,t,n,r),o&&(u.anchor=o.source.substring(1))}catch(f){const h=f instanceof Error?f.message:String(f);r(t,"RESOURCE_EXHAUSTION",h)}break;default:{const f=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;r(t,"UNEXPECTED_TOKEN",f),d=!1}}return u??(u=l_(e,t.offset,void 0,null,n,r)),o&&u.anchor===""&&r(o,"BAD_ALIAS","Anchor cannot be an empty string"),s&&e.options.stringKeys&&(!zt(u)||typeof u.value!="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str")&&r(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),i&&(u.spaceBefore=!0),a&&(t.type==="scalar"&&t.source===""?u.comment=a:u.commentBefore=a),e.options.keepSourceTokens&&d&&(u.srcToken=t),u}function l_(e,t,n,r,{spaceBefore:s,comment:i,anchor:a,tag:o,end:c},u){const d={type:"scalar",offset:cme(t,n,r),indent:-1,source:""},f=T6(e,d,o,u);return a&&(f.anchor=a.source.substring(1),f.anchor===""&&u(a,"BAD_ALIAS","Anchor cannot be an empty string")),s&&(f.spaceBefore=!0),i&&(f.comment=i,f.range[2]=c),f}function dme({options:e},{offset:t,source:n,end:r},s){const i=new Xv(n.substring(1));i.source===""&&s(t,"BAD_ALIAS","Alias cannot be an empty string"),i.source.endsWith(":")&&s(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const a=t+n.length,o=Wf(r,a,e.strict,s);return i.range=[t,a,o.offset],o.comment&&(i.comment=o.comment),i}function fme(e,t,{offset:n,start:r,value:s,end:i},a){const o=Object.assign({_directives:t},e),c=new Yf(void 0,o),u={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=Fc(r,{indicator:"doc-start",next:s??(i==null?void 0:i[0]),offset:n,onError:a,parentIndent:0,startOnNewline:!0});d.found&&(c.directives.docStart=!0,s&&(s.type==="block-map"||s.type==="block-seq")&&!d.hasNewline&&a(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=s?A6(u,s,d,a):l_(u,d.end,r,null,d,a);const f=c.contents.range[2],h=Wf(i,f,!1,a);return h.comment&&(c.comment=h.comment),c.range=[n,f,h.offset],c}function Au(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];const{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function zA(e){var s;let t="",n=!1,r=!1;for(let i=0;i{const a=Cu(n);i?this.warnings.push(new Wpe(a,r,s)):this.errors.push(new Yu(a,r,s))},this.directives=new kr({version:t.version||"1.2"}),this.options=t}decorate(t,n){const{comment:r,afterEmptyLine:s}=VA(this.prelude);if(r){const i=t.contents;if(n)t.comment=t.comment?`${t.comment} +`)+(a.substring(1)||" "),n=!0,r=!1;break;case"%":((s=e[i+1])==null?void 0:s[0])!=="#"&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}class hme{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,r,s,i)=>{const a=Au(n);i?this.warnings.push(new Ype(a,r,s)):this.errors.push(new Ku(a,r,s))},this.directives=new kr({version:t.version||"1.2"}),this.options=t}decorate(t,n){const{comment:r,afterEmptyLine:s}=zA(this.prelude);if(r){const i=t.contents;if(n)t.comment=t.comment?`${t.comment} ${r}`:r;else if(s||t.directives.docStart||!i)t.commentBefore=r;else if(_n(i)&&!i.flow&&i.items.length>0){let a=i.items[0];Nn(a)&&(a=a.key);const o=a.commentBefore;a.commentBefore=o?`${r} ${o}`:r}else{const a=i.commentBefore;i.commentBefore=a?`${r} -${a}`:r}}if(n){for(let i=0;i{const i=Cu(t);i[0]+=n,this.onError(i,"BAD_DIRECTIVE",r,s)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{const n=hme(this.options,this.directives,t,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{const n=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,r=new Yu(Cu(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){const r="Unexpected doc-end without preceding document";this.errors.push(new Yu(Cu(t),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;const n=Gf(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){const r=this.doc.comment;this.doc.comment=r?`${r} -${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new Yu(Cu(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){const r=Object.assign({_directives:this.directives},this.options),s=new Wf(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),s.range=[0,n,n],this.decorate(s,!1),yield s}}}const I6="\uFEFF",O6="",R6="",WE="";function mme(e){switch(e){case I6:return"byte-order-mark";case O6:return"doc-mode";case R6:return"flow-error-end";case WE:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` +${a}`:r}}if(n){for(let i=0;i{const i=Au(t);i[0]+=n,this.onError(i,"BAD_DIRECTIVE",r,s)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{const n=fme(this.options,this.directives,t,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{const n=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,r=new Ku(Au(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){const r="Unexpected doc-end without preceding document";this.errors.push(new Ku(Au(t),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;const n=Wf(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){const r=this.doc.comment;this.doc.comment=r?`${r} +${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new Ku(Au(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){const r=Object.assign({_directives:this.directives},this.options),s=new Yf(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),s.range=[0,n,n],this.decorate(s,!1),yield s}}}const C6="\uFEFF",I6="",O6="",YE="";function pme(e){switch(e){case C6:return"byte-order-mark";case I6:return"doc-mode";case O6:return"flow-error-end";case YE:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` `:case`\r `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function Ds(e){switch(e){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}const KA=new Set("0123456789ABCDEFabcdef"),gme=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),rp=new Set(",[]{}"),yme=new Set(` ,[]{} -\r `),cb=e=>!e||yme.has(e);class bme{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,n=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!n;let r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===` +`:case"\r":case" ":return!0;default:return!1}}const VA=new Set("0123456789ABCDEFabcdef"),mme=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),np=new Set(",[]{}"),gme=new Set(` ,[]{} +\r `),lb=e=>!e||gme.has(e);class yme{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,n=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!n;let r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===` `?!0:n==="\r"?this.buffer[t+1]===` `:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let n=this.buffer[t];if(this.indentNext>0){let r=0;for(;n===" ";)n=this.buffer[++r+t];if(n==="\r"){const s=this.buffer[r+t+1];if(s===` `||!s&&!this.atEnd)return t+r+1}return n===` `||r>=this.indentNext||!n&&!this.atEnd?t+r:-1}if(n==="-"||n==="."){const r=this.buffer.substr(t,3);if((r==="---"||r==="...")&&Ds(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&tthis.indentValue&&!Ds(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){const[t,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&Ds(n)){const r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);const t=this.getLine();if(t===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(t[n]){case"#":yield*this.pushCount(t.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(cb),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,n,r=-1;do t=yield*this.pushNewline(),t>0?(n=yield*this.pushSpaces(!1),this.indentValue=r=n):n=0,n+=yield*this.pushSpaces(!0);while(t+n>0);const s=this.getLine();if(s===null)return this.setNext("flow");if((r!==-1&&rthis.indentValue&&!Ds(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){const[t,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&Ds(n)){const r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);const t=this.getLine();if(t===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(t[n]){case"#":yield*this.pushCount(t.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(lb),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,n,r=-1;do t=yield*this.pushNewline(),t>0?(n=yield*this.pushSpaces(!1),this.indentValue=r=n):n=0,n+=yield*this.pushSpaces(!0);while(t+n>0);const s=this.getLine();if(s===null)return this.setNext("flow");if((r!==-1&&r"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>Ds(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,r;e:for(let i=this.pos;r=this.buffer[i];++i)switch(r){case" ":n+=1;break;case` `:t=i,n=0;break;case"\r":{const a=this.buffer[i+1];if(!a&&!this.atEnd)return this.setNext("block-scalar");if(a===` `)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{const i=this.continueScalar(t+1);if(i===-1)break;t=this.buffer.indexOf(` `,i)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let s=t+1;for(r=this.buffer[s];r===" ";)r=this.buffer[++s];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===` `;)r=this.buffer[++s];t=s-1}else if(!this.blockScalarKeep)do{let i=t-1,a=this.buffer[i];a==="\r"&&(a=this.buffer[--i]);const o=i;for(;a===" ";)a=this.buffer[--i];if(a===` -`&&i>=this.pos&&i+1+n>o)t=i;else break}while(!0);return yield WE,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const t=this.flowLevel>0;let n=this.pos-1,r=this.pos-1,s;for(;s=this.buffer[++r];)if(s===":"){const i=this.buffer[r+1];if(Ds(i)||t&&rp.has(i))break;n=r}else if(Ds(s)){let i=this.buffer[r+1];if(s==="\r"&&(i===` +`&&i>=this.pos&&i+1+n>o)t=i;else break}while(!0);return yield YE,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const t=this.flowLevel>0;let n=this.pos-1,r=this.pos-1,s;for(;s=this.buffer[++r];)if(s===":"){const i=this.buffer[r+1];if(Ds(i)||t&&np.has(i))break;n=r}else if(Ds(s)){let i=this.buffer[r+1];if(s==="\r"&&(i===` `?(r+=1,s=` -`,i=this.buffer[r+1]):n=r),i==="#"||t&&rp.has(i))break;if(s===` -`){const a=this.continueScalar(r+1);if(a===-1)break;r=Math.max(r,a-2)}}else{if(t&&rp.has(s))break;n=r}return!s&&!this.atEnd?this.setNext("plain-scalar"):(yield WE,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){const r=this.buffer.slice(this.pos,t);return r?(yield r,this.pos+=r.length,r.length):(n&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(cb),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{const n=this.flowLevel>0,r=this.charAt(1);if(Ds(r)||n&&rp.has(r)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,n=this.buffer[t];for(;!Ds(n)&&n!==">";)n=this.buffer[++t];return yield*this.pushToIndex(n===">"?t+1:t,!1)}else{let t=this.pos+1,n=this.buffer[t];for(;n;)if(gme.has(n))n=this.buffer[++t];else if(n==="%"&&KA.has(this.buffer[t+1])&&KA.has(this.buffer[t+2]))n=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){const t=this.buffer[this.pos];return t===` +`,i=this.buffer[r+1]):n=r),i==="#"||t&&np.has(i))break;if(s===` +`){const a=this.continueScalar(r+1);if(a===-1)break;r=Math.max(r,a-2)}}else{if(t&&np.has(s))break;n=r}return!s&&!this.atEnd?this.setNext("plain-scalar"):(yield YE,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){const r=this.buffer.slice(this.pos,t);return r?(yield r,this.pos+=r.length,r.length):(n&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(lb),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{const n=this.flowLevel>0,r=this.charAt(1);if(Ds(r)||n&&np.has(r)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,n=this.buffer[t];for(;!Ds(n)&&n!==">";)n=this.buffer[++t];return yield*this.pushToIndex(n===">"?t+1:t,!1)}else{let t=this.pos+1,n=this.buffer[t];for(;n;)if(mme.has(n))n=this.buffer[++t];else if(n==="%"&&VA.has(this.buffer[t+1])&&VA.has(this.buffer[t+2]))n=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){const t=this.buffer[this.pos];return t===` `?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===` -`?yield*this.pushCount(2):0}*pushSpaces(t){let n=this.pos-1,r;do r=this.buffer[++n];while(r===" "||t&&r===" ");const s=n-this.pos;return s>0&&(yield this.buffer.substr(this.pos,s),this.pos=n),s}*pushUntil(t){let n=this.pos,r=this.buffer[n];for(;!t(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}}class Eme{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,r=this.lineStarts.length;for(;n>1;this.lineStarts[i]=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;((n=e[++t])==null?void 0:n.type)==="space";);return e.splice(t,e.length)}function eg(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){const t=this.peek(1);if(this.type==="doc-end"&&(t==null?void 0:t.type)!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){const n=t??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{const r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&WA(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{const s=r.items[r.items.length-1];if(s.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(s.sep)s.value=n;else{Object.assign(s,{key:n,sep:[]}),this.onKeyLine=!s.explicitKey;return}break}case"block-seq":{const s=r.items[r.items.length-1];s.value?r.items.push({start:[],value:n}):s.value=n;break}case"flow-collection":{const s=r.items[r.items.length-1];!s||s.value?r.items.push({start:[],key:n,sep:[]}):s.sep?s.value=n:Object.assign(s,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){const s=n.items[n.items.length-1];s&&!s.sep&&!s.value&&s.start.length>0&&YA(s.start)===-1&&(n.indent===0||s.start.every(i=>i.type!=="comment"||i.indent0&&(yield this.buffer.substr(this.pos,s),this.pos=n),s}*pushUntil(t){let n=this.pos,r=this.buffer[n];for(;!t(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}}class bme{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,r=this.lineStarts.length;for(;n>1;this.lineStarts[i]=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;((n=e[++t])==null?void 0:n.type)==="space";);return e.splice(t,e.length)}function Jm(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){const t=this.peek(1);if(this.type==="doc-end"&&(t==null?void 0:t.type)!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){const n=t??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{const r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&YA(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{const s=r.items[r.items.length-1];if(s.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(s.sep)s.value=n;else{Object.assign(s,{key:n,sep:[]}),this.onKeyLine=!s.explicitKey;return}break}case"block-seq":{const s=r.items[r.items.length-1];s.value?r.items.push({start:[],value:n}):s.value=n;break}case"flow-collection":{const s=r.items[r.items.length-1];!s||s.value?r.items.push({start:[],key:n,sep:[]}):s.sep?s.value=n:Object.assign(s,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){const s=n.items[n.items.length-1];s&&!s.sep&&!s.value&&s.start.length>0&&KA(s.start)===-1&&(n.indent===0||s.start.every(i=>i.type!=="comment"||i.indent=t.indent){const s=!this.onKeyLine&&this.indent===t.indent,i=s&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind";let a=[];if(i&&n.sep&&!n.value){const o=[];for(let c=0;ct.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(a=n.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||n.value?(a.push(this.sourceToken),t.items.push({start:a}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):i||n.value?(a.push(this.sourceToken),t.items.push({start:a,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ea(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]});else if(L6(n.key)&&!Ea(n.sep,"newline")){const o=gl(n.start),c=n.key,u=n.sep;u.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:c,sep:u}]})}else a.length>0?n.sep=n.sep.concat(a,this.sourceToken):n.sep.push(this.sourceToken);else if(Ea(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const o=gl(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||i?t.items.push({start:a,key:null,sep:[this.sourceToken]}):Ea(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const o=this.flowScalar(this.type);i||n.value?(t.items.push({start:a,key:o,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(o):(Object.assign(n,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{const o=this.startBlockValue(t);if(o){if(o.type==="block-seq"){if(!n.explicitKey&&n.sep&&!Ea(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else s&&t.items.push({start:a});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){var r;const n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){const s="end"in n.value?n.value.end:void 0,i=Array.isArray(s)?s[s.length-1]:void 0;(i==null?void 0:i.type)==="comment"?s==null||s.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,t.indent)){const s=t.items[t.items.length-2],i=(r=s==null?void 0:s.value)==null?void 0:r.end;if(Array.isArray(i)){eg(i,n.start),i.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=t.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;n.value||Ea(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){const s=this.startBlockValue(t);if(s){this.stack.push(s);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){const n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while((r==null?void 0:r.type)==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?t.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const s=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:s,sep:[]}):n.sep?this.stack.push(s):Object.assign(n,{key:s,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}const r=this.startBlockValue(t);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{const r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===t.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){const s=sp(r),i=gl(s);WA(t);const a=t.end.splice(1,t.end.length);a.push(this.sourceToken);const o={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:i,key:t,sep:a}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(` +`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){var r;const n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){const s="end"in n.value?n.value.end:void 0,i=Array.isArray(s)?s[s.length-1]:void 0;(i==null?void 0:i.type)==="comment"?s==null||s.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,t.indent)){const s=t.items[t.items.length-2],i=(r=s==null?void 0:s.value)==null?void 0:r.end;if(Array.isArray(i)){Jm(i,n.start),i.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=t.indent){const s=!this.onKeyLine&&this.indent===t.indent,i=s&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind";let a=[];if(i&&n.sep&&!n.value){const o=[];for(let c=0;ct.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(a=n.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||n.value?(a.push(this.sourceToken),t.items.push({start:a}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):i||n.value?(a.push(this.sourceToken),t.items.push({start:a,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ea(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]});else if(R6(n.key)&&!Ea(n.sep,"newline")){const o=ml(n.start),c=n.key,u=n.sep;u.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:c,sep:u}]})}else a.length>0?n.sep=n.sep.concat(a,this.sourceToken):n.sep.push(this.sourceToken);else if(Ea(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const o=ml(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||i?t.items.push({start:a,key:null,sep:[this.sourceToken]}):Ea(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const o=this.flowScalar(this.type);i||n.value?(t.items.push({start:a,key:o,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(o):(Object.assign(n,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{const o=this.startBlockValue(t);if(o){if(o.type==="block-seq"){if(!n.explicitKey&&n.sep&&!Ea(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else s&&t.items.push({start:a});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){var r;const n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){const s="end"in n.value?n.value.end:void 0,i=Array.isArray(s)?s[s.length-1]:void 0;(i==null?void 0:i.type)==="comment"?s==null||s.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,t.indent)){const s=t.items[t.items.length-2],i=(r=s==null?void 0:s.value)==null?void 0:r.end;if(Array.isArray(i)){Jm(i,n.start),i.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=t.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;n.value||Ea(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){const s=this.startBlockValue(t);if(s){this.stack.push(s);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){const n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while((r==null?void 0:r.type)==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?t.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const s=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:s,sep:[]}):n.sep?this.stack.push(s):Object.assign(n,{key:s,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}const r=this.startBlockValue(t);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{const r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===t.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){const s=rp(r),i=ml(s);YA(t);const a=t.end.splice(1,t.end.length);a.push(this.sourceToken);const o={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:i,key:t,sep:a}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(` `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(` -`,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const n=sp(t),r=gl(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=sp(t),r=gl(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function wme(e){const t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Eme||null,prettyErrors:t}}function vme(e,t={}){const{lineCounter:n,prettyErrors:r}=wme(t),s=new xme(n==null?void 0:n.addNewLine),i=new pme(t);let a=null;for(const o of i.compose(s.parse(e),!0,e.length))if(!a)a=o;else if(a.options.logLevel!=="silent"){a.errors.push(new Yu(o.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(a.errors.forEach(HA(e,n)),a.warnings.forEach(HA(e,n))),a}function _me(e,t,n){let r;const s=vme(e,n);if(!s)return null;if(s.warnings.forEach(i=>i6(s.options.logLevel,i)),s.errors.length>0){if(s.options.logLevel!=="silent")throw s.errors[0];s.errors=[]}return s.toJS(Object.assign({reviver:r},n))}function kme(e,t,n){let r=null;if(Array.isArray(t)&&(r=t),e===void 0){const{keepUndefined:s}={};if(!s)return}return zf(e)&&!r?e.toString(n):new Wf(e,r,n).toString(n)}const Nme=new Set(["local","sqlite","mysql","postgresql"]),Sme=new Set(["local","opensearch","redis","viking","mem0"]),Tme=new Set(["opensearch","viking","context_search"]),Ame=new Set(["apmplus","cozeloop","tls"]),M6=new Set(["web_search","parallel_web_search","link_reader","web_scraper","image_generate","image_edit","video_generate","text_to_speech","run_code","vesearch"]),Cme=new Set(["llm","sequential","parallel","loop","a2a"]);function gt(e,t=""){return typeof e=="string"?e:t}function fo(e){return e===!0}function $p(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function j6(e){return Array.isArray(e)?e.map(t=>t&&typeof t=="object"?{name:gt(t.name),description:gt(t.description)}:null).filter(t=>!!t&&!!t.name.trim()):[]}function ub(e,t,n){return typeof e=="string"&&t.has(e)?e:n}function D6(e){return typeof e=="string"&&Cme.has(e)?e:"llm"}function P6(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?Math.floor(e):3}function B6(e){const t=e&&typeof e=="object"?e:{};return{enabled:fo(t.enabled),registrySpaceId:gt(t.registrySpaceId),registryTopK:gt(t.registryTopK),registryRegion:gt(t.registryRegion),registryEndpoint:gt(t.registryEndpoint)}}function F6(e){return Array.isArray(e)?e.map(t=>{const n=t&&typeof t=="object"?t:{},r=B6(n.a2aRegistry),s=D6(n.agentType),i=r.enabled&&s==="llm"?"a2a":s;return{...Sr(),name:gt(n.name),description:gt(n.description),instruction:gt(n.instruction),agentType:i,maxIterations:P6(n.maxIterations),a2aUrl:gt(n.a2aUrl),builtinTools:$p(n.builtinTools).filter(a=>M6.has(a)),customTools:j6(n.customTools),a2aRegistry:i==="a2a"?{...r,enabled:!0}:r,subAgents:F6(n.subAgents)}}):[]}function Ime(e){if(!Array.isArray(e.selectedSkills))return[];const t=[];for(const n of e.selectedSkills){const r=n&&typeof n=="object"?n:{},s=gt(r.source),i=s==="local"||s==="skillspace"||s==="skillhub"?s:"skillhub",a=gt(r.name)||gt(r.slug)||gt(r.skillName)||gt(r.skillId)||"skill",o=gt(r.folder)||a,c=gt(r.description);if(i==="skillhub"){const f=gt(r.slug);if(!f)continue;t.push({source:i,folder:o,name:a,description:c,slug:f,namespace:gt(r.namespace)||"public"});continue}if(i==="local"){const h=(Array.isArray(r.localFiles)?r.localFiles:[]).map(p=>{const m=p&&typeof p=="object"?p:{},y=gt(m.path),E=gt(m.content);return y?{path:y,content:E}:null}).filter(p=>p!==null);if(h.length===0)continue;t.push({source:i,folder:o,name:a,description:c,localFiles:h});continue}const u=gt(r.skillSpaceId),d=gt(r.skillId);!u||!d||t.push({source:i,folder:o,name:a,description:c,skillSpaceId:u,skillSpaceName:gt(r.skillSpaceName),skillId:d,version:gt(r.version)})}return t}function U6(e){const t=e&&typeof e=="object"?e:{},n=t.memory&&typeof t.memory=="object"?t.memory:{},r=t.deployment&&typeof t.deployment=="object"?t.deployment:{},s=B6(t.a2aRegistry),i=D6(t.agentType),a=s.enabled&&i==="llm"?"a2a":i,o=Array.isArray(t.mcpTools)?t.mcpTools.map(c=>{const u=c&&typeof c=="object"?c:{},d=u.transport==="stdio"?"stdio":"http";return{name:gt(u.name),transport:d,url:gt(u.url),authToken:gt(u.authToken),command:gt(u.command),args:$p(u.args)}}).filter(c=>c.transport==="http"?!!c.url:!!c.command):[];return{...Sr(),name:gt(t.name)||"my_agent",description:gt(t.description),instruction:gt(t.instruction)||"You are a helpful assistant.",agentType:a,maxIterations:P6(t.maxIterations),a2aUrl:gt(t.a2aUrl),modelName:gt(t.modelName),modelProvider:gt(t.modelProvider),modelApiBase:gt(t.modelApiBase),builtinTools:$p(t.builtinTools).filter(c=>M6.has(c)),customTools:j6(t.customTools),mcpTools:o,a2aRegistry:a==="a2a"?{...s,enabled:!0}:s,memory:{shortTerm:fo(n.shortTerm),longTerm:fo(n.longTerm)},shortTermBackend:ub(t.shortTermBackend,Nme,"local"),longTermBackend:ub(t.longTermBackend,Sme,"local"),autoSaveSession:fo(t.autoSaveSession),knowledgebase:fo(t.knowledgebase),knowledgebaseBackend:ub(t.knowledgebaseBackend,Tme,qd),knowledgebaseIndex:gt(t.knowledgebaseIndex),tracing:fo(t.tracing),tracingExporters:$p(t.tracingExporters).filter(c=>Ame.has(c)),deployment:{feishuEnabled:fo(r.feishuEnabled)},subAgents:F6(t.subAgents),selectedSkills:Ime(t)}}function $6(e){var n,r,s,i,a,o,c,u,d,f,h,p,m,y,E,g,x,b;const t={agentType:e.agentType??"llm"};if(e.agentType==="a2a"){if((n=e.a2aRegistry)!=null&&n.enabled){const _={enabled:!0};(r=e.a2aRegistry.registrySpaceId)!=null&&r.trim()&&(_.registrySpaceId=e.a2aRegistry.registrySpaceId.trim()),_.registryTopK=((s=e.a2aRegistry.registryTopK)==null?void 0:s.trim())||qs.topK,_.registryRegion=((i=e.a2aRegistry.registryRegion)==null?void 0:i.trim())||qs.region,_.registryEndpoint=((a=e.a2aRegistry.registryEndpoint)==null?void 0:a.trim())||qs.endpoint,t.a2aRegistry=_}return t}return t.name=e.name,t.description=e.description,t.instruction=e.instruction,e.agentType==="loop"&&(t.maxIterations=e.maxIterations??3),(o=e.modelName)!=null&&o.trim()&&(t.modelName=e.modelName.trim()),(c=e.modelProvider)!=null&&c.trim()&&(t.modelProvider=e.modelProvider.trim()),(u=e.modelApiBase)!=null&&u.trim()&&(t.modelApiBase=e.modelApiBase.trim()),(d=e.builtinTools)!=null&&d.length&&(t.builtinTools=[...e.builtinTools]),(f=e.customTools)!=null&&f.length&&(t.customTools=e.customTools.map(_=>({name:_.name,description:_.description}))),(h=e.mcpTools)!=null&&h.length&&(t.mcpTools=e.mcpTools.map(_=>{var N,C,S,A;const k={name:_.name,transport:_.transport};return(N=_.url)!=null&&N.trim()&&(k.url=_.url.trim()),(C=_.authToken)!=null&&C.trim()&&(k.authToken=_.authToken.trim()),(S=_.command)!=null&&S.trim()&&(k.command=_.command.trim()),(A=_.args)!=null&&A.length&&(k.args=_.args),k})),((p=e.memory)!=null&&p.shortTerm||(m=e.memory)!=null&&m.longTerm)&&(t.memory={shortTerm:!!e.memory.shortTerm,longTerm:!!e.memory.longTerm},e.memory.shortTerm&&(t.shortTermBackend=e.shortTermBackend||"local"),e.memory.longTerm&&(t.longTermBackend=e.longTermBackend||"local",t.autoSaveSession=!!e.autoSaveSession)),e.knowledgebase&&(t.knowledgebase=!0,t.knowledgebaseBackend=e.knowledgebaseBackend||"viking",(y=e.knowledgebaseIndex)!=null&&y.trim()&&(t.knowledgebaseIndex=e.knowledgebaseIndex.trim())),e.tracing&&((E=e.tracingExporters)!=null&&E.length)&&(t.tracing=!0,t.tracingExporters=[...e.tracingExporters]),(g=e.deployment)!=null&&g.feishuEnabled&&(t.deployment={feishuEnabled:!0}),(x=e.selectedSkills)!=null&&x.length&&(t.selectedSkills=e.selectedSkills.map(_=>{const k={source:_.source,name:_.name,folder:_.folder};return _.description&&(k.description=_.description),_.source==="skillhub"?(k.slug=_.slug,k.namespace=_.namespace??"public"):_.source==="local"?k.localFiles=_.localFiles??[]:(k.skillSpaceId=_.skillSpaceId,k.skillSpaceName=_.skillSpaceName,k.skillId=_.skillId,_.version&&(k.version=_.version)),k})),(b=e.subAgents)!=null&&b.length&&(t.subAgents=e.subAgents.map($6)),t}function Ome(e){return`# VeADK Agent 结构配置 +`,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const n=rp(t),r=ml(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=rp(t),r=ml(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function xme(e){const t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new bme||null,prettyErrors:t}}function wme(e,t={}){const{lineCounter:n,prettyErrors:r}=xme(t),s=new Eme(n==null?void 0:n.addNewLine),i=new hme(t);let a=null;for(const o of i.compose(s.parse(e),!0,e.length))if(!a)a=o;else if(a.options.logLevel!=="silent"){a.errors.push(new Ku(o.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(a.errors.forEach($A(e,n)),a.warnings.forEach($A(e,n))),a}function vme(e,t,n){let r;const s=wme(e,n);if(!s)return null;if(s.warnings.forEach(i=>s6(s.options.logLevel,i)),s.errors.length>0){if(s.options.logLevel!=="silent")throw s.errors[0];s.errors=[]}return s.toJS(Object.assign({reviver:r},n))}function _me(e,t,n){let r=null;if(Array.isArray(t)&&(r=t),e===void 0){const{keepUndefined:s}={};if(!s)return}return Hf(e)&&!r?e.toString(n):new Yf(e,r,n).toString(n)}const kme=new Set(["local","sqlite","mysql","postgresql"]),Nme=new Set(["local","opensearch","redis","viking","mem0"]),Sme=new Set(["opensearch","viking","context_search"]),Tme=new Set(["apmplus","cozeloop","tls"]),L6=new Set(["web_search","parallel_web_search","link_reader","web_scraper","image_generate","image_edit","video_generate","text_to_speech","run_code","vesearch"]),Ame=new Set(["llm","sequential","parallel","loop","a2a"]);function gt(e,t=""){return typeof e=="string"?e:t}function uo(e){return e===!0}function Up(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function M6(e){return Array.isArray(e)?e.map(t=>t&&typeof t=="object"?{name:gt(t.name),description:gt(t.description)}:null).filter(t=>!!t&&!!t.name.trim()):[]}function cb(e,t,n){return typeof e=="string"&&t.has(e)?e:n}function j6(e){return typeof e=="string"&&Ame.has(e)?e:"llm"}function D6(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?Math.floor(e):3}function P6(e){const t=e&&typeof e=="object"?e:{};return{enabled:uo(t.enabled),registrySpaceId:gt(t.registrySpaceId),registryTopK:gt(t.registryTopK),registryRegion:gt(t.registryRegion),registryEndpoint:gt(t.registryEndpoint)}}function B6(e){return Array.isArray(e)?e.map(t=>{const n=t&&typeof t=="object"?t:{},r=P6(n.a2aRegistry),s=j6(n.agentType),i=r.enabled&&s==="llm"?"a2a":s;return{...Sr(),name:gt(n.name),description:gt(n.description),instruction:gt(n.instruction),agentType:i,maxIterations:D6(n.maxIterations),a2aUrl:gt(n.a2aUrl),builtinTools:Up(n.builtinTools).filter(a=>L6.has(a)),customTools:M6(n.customTools),a2aRegistry:i==="a2a"?{...r,enabled:!0}:r,subAgents:B6(n.subAgents)}}):[]}function Cme(e){if(!Array.isArray(e.selectedSkills))return[];const t=[];for(const n of e.selectedSkills){const r=n&&typeof n=="object"?n:{},s=gt(r.source),i=s==="local"||s==="skillspace"||s==="skillhub"?s:"skillhub",a=gt(r.name)||gt(r.slug)||gt(r.skillName)||gt(r.skillId)||"skill",o=gt(r.folder)||a,c=gt(r.description);if(i==="skillhub"){const f=gt(r.slug);if(!f)continue;t.push({source:i,folder:o,name:a,description:c,slug:f,namespace:gt(r.namespace)||"public"});continue}if(i==="local"){const h=(Array.isArray(r.localFiles)?r.localFiles:[]).map(p=>{const m=p&&typeof p=="object"?p:{},y=gt(m.path),E=gt(m.content);return y?{path:y,content:E}:null}).filter(p=>p!==null);if(h.length===0)continue;t.push({source:i,folder:o,name:a,description:c,localFiles:h});continue}const u=gt(r.skillSpaceId),d=gt(r.skillId);!u||!d||t.push({source:i,folder:o,name:a,description:c,skillSpaceId:u,skillSpaceName:gt(r.skillSpaceName),skillId:d,version:gt(r.version)})}return t}function F6(e){const t=e&&typeof e=="object"?e:{},n=t.memory&&typeof t.memory=="object"?t.memory:{},r=t.deployment&&typeof t.deployment=="object"?t.deployment:{},s=P6(t.a2aRegistry),i=j6(t.agentType),a=s.enabled&&i==="llm"?"a2a":i,o=Array.isArray(t.mcpTools)?t.mcpTools.map(c=>{const u=c&&typeof c=="object"?c:{},d=u.transport==="stdio"?"stdio":"http";return{name:gt(u.name),transport:d,url:gt(u.url),authToken:gt(u.authToken),command:gt(u.command),args:Up(u.args)}}).filter(c=>c.transport==="http"?!!c.url:!!c.command):[];return{...Sr(),name:gt(t.name)||"my_agent",description:gt(t.description),instruction:gt(t.instruction)||"You are a helpful assistant.",agentType:a,maxIterations:D6(t.maxIterations),a2aUrl:gt(t.a2aUrl),modelName:gt(t.modelName),modelProvider:gt(t.modelProvider),modelApiBase:gt(t.modelApiBase),builtinTools:Up(t.builtinTools).filter(c=>L6.has(c)),customTools:M6(t.customTools),mcpTools:o,a2aRegistry:a==="a2a"?{...s,enabled:!0}:s,memory:{shortTerm:uo(n.shortTerm),longTerm:uo(n.longTerm)},shortTermBackend:cb(t.shortTermBackend,kme,"local"),longTermBackend:cb(t.longTermBackend,Nme,"local"),autoSaveSession:uo(t.autoSaveSession),knowledgebase:uo(t.knowledgebase),knowledgebaseBackend:cb(t.knowledgebaseBackend,Sme,Gd),knowledgebaseIndex:gt(t.knowledgebaseIndex),tracing:uo(t.tracing),tracingExporters:Up(t.tracingExporters).filter(c=>Tme.has(c)),deployment:{feishuEnabled:uo(r.feishuEnabled)},subAgents:B6(t.subAgents),selectedSkills:Cme(t)}}function U6(e){var n,r,s,i,a,o,c,u,d,f,h,p,m,y,E,g,x,b;const t={agentType:e.agentType??"llm"};if(e.agentType==="a2a"){if((n=e.a2aRegistry)!=null&&n.enabled){const _={enabled:!0};(r=e.a2aRegistry.registrySpaceId)!=null&&r.trim()&&(_.registrySpaceId=e.a2aRegistry.registrySpaceId.trim()),_.registryTopK=((s=e.a2aRegistry.registryTopK)==null?void 0:s.trim())||qs.topK,_.registryRegion=((i=e.a2aRegistry.registryRegion)==null?void 0:i.trim())||qs.region,_.registryEndpoint=((a=e.a2aRegistry.registryEndpoint)==null?void 0:a.trim())||qs.endpoint,t.a2aRegistry=_}return t}return t.name=e.name,t.description=e.description,t.instruction=e.instruction,e.agentType==="loop"&&(t.maxIterations=e.maxIterations??3),(o=e.modelName)!=null&&o.trim()&&(t.modelName=e.modelName.trim()),(c=e.modelProvider)!=null&&c.trim()&&(t.modelProvider=e.modelProvider.trim()),(u=e.modelApiBase)!=null&&u.trim()&&(t.modelApiBase=e.modelApiBase.trim()),(d=e.builtinTools)!=null&&d.length&&(t.builtinTools=[...e.builtinTools]),(f=e.customTools)!=null&&f.length&&(t.customTools=e.customTools.map(_=>({name:_.name,description:_.description}))),(h=e.mcpTools)!=null&&h.length&&(t.mcpTools=e.mcpTools.map(_=>{var N,C,S,A;const k={name:_.name,transport:_.transport};return(N=_.url)!=null&&N.trim()&&(k.url=_.url.trim()),(C=_.authToken)!=null&&C.trim()&&(k.authToken=_.authToken.trim()),(S=_.command)!=null&&S.trim()&&(k.command=_.command.trim()),(A=_.args)!=null&&A.length&&(k.args=_.args),k})),((p=e.memory)!=null&&p.shortTerm||(m=e.memory)!=null&&m.longTerm)&&(t.memory={shortTerm:!!e.memory.shortTerm,longTerm:!!e.memory.longTerm},e.memory.shortTerm&&(t.shortTermBackend=e.shortTermBackend||"local"),e.memory.longTerm&&(t.longTermBackend=e.longTermBackend||"local",t.autoSaveSession=!!e.autoSaveSession)),e.knowledgebase&&(t.knowledgebase=!0,t.knowledgebaseBackend=e.knowledgebaseBackend||"viking",(y=e.knowledgebaseIndex)!=null&&y.trim()&&(t.knowledgebaseIndex=e.knowledgebaseIndex.trim())),e.tracing&&((E=e.tracingExporters)!=null&&E.length)&&(t.tracing=!0,t.tracingExporters=[...e.tracingExporters]),(g=e.deployment)!=null&&g.feishuEnabled&&(t.deployment={feishuEnabled:!0}),(x=e.selectedSkills)!=null&&x.length&&(t.selectedSkills=e.selectedSkills.map(_=>{const k={source:_.source,name:_.name,folder:_.folder};return _.description&&(k.description=_.description),_.source==="skillhub"?(k.slug=_.slug,k.namespace=_.namespace??"public"):_.source==="local"?k.localFiles=_.localFiles??[]:(k.skillSpaceId=_.skillSpaceId,k.skillSpaceName=_.skillSpaceName,k.skillId=_.skillId,_.version&&(k.version=_.version)),k})),(b=e.subAgents)!=null&&b.length&&(t.subAgents=e.subAgents.map(U6)),t}function Ime(e){return`# VeADK Agent 结构配置 # 可在「创建 Agent」页通过「导入 YAML」重新载入。 -`+kme($6(e))}function Rme(e){const t=_me(e);return U6(t)}const Lme=[{kind:"custom",icon:JH,title:"自定义",desc:"分步配置模型、工具、记忆、知识库等组件。"},{kind:"intelligent",icon:BH,title:"智能模式",desc:"敬请期待",disabled:!0},{kind:"template",icon:MH,title:"从模板新建",desc:"敬请期待",disabled:!0},{kind:"workflow",icon:ez,title:"工作流",desc:"敬请期待",disabled:!0}];function Mme({onSelect:e,onImport:t}){const n=w.useRef(null),[r,s]=w.useState(""),i=Lme.map(o=>({key:o.kind,icon:o.icon,title:o.title,desc:o.desc,disabled:o.disabled,onClick:()=>e(o.kind)})),a=async o=>{var u;const c=(u=o.target.files)==null?void 0:u[0];if(o.target.value="",!!c)try{const d=await c.text();t(Rme(d))}catch(d){s(`导入失败:${d instanceof Error?d.message:String(d)}`)}};return l.jsx(q4,{title:"从 0 快速创建",sub:"选择一种方式开始",cards:i,footer:l.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[l.jsxs("button",{className:"stk-import",onClick:()=>{var o;return(o=n.current)==null?void 0:o.click()},children:[l.jsx(QH,{}),"导入 YAML 配置"]}),r&&l.jsx("span",{style:{fontSize:12,color:"hsl(var(--destructive))"},children:r}),l.jsx("input",{ref:n,type:"file",accept:".yaml,.yml,text/yaml",style:{display:"none"},onChange:a})]})})}const jme="modulepreload",Dme=function(e){return"/"+e},GA={},lc=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),o=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=Promise.allSettled(n.map(c=>{if(c=Dme(c),c in GA)return;GA[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":jme,u||(f.as="script"),f.crossOrigin="",f.href=c,o&&f.setAttribute("nonce",o),document.head.appendChild(f),u)return new Promise((h,p)=>{f.addEventListener("load",h),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return s.then(a=>{for(const o of a||[])o.status==="rejected"&&i(o.reason);return t().catch(i)})};function H6(e){const t=new Map,n={};for(const r of e){for(const s of r.env){const i=t.get(s.key);(!i||s.required&&!i.required)&&t.set(s.key,s)}r.enableFlag&&(t.set(r.enableFlag,{key:r.enableFlag,required:!0}),n[r.enableFlag]="true")}return{specs:[...t.values()],fixedValues:n}}function Pme(e,t){return H6([{env:e}]).specs.map(r=>({...r,value:t[r.key]??""}))}function z6(e,t){const n=new Map;for(const r of e){const s=t[r.key]??"";s.trim()&&n.set(r.key,s)}return[...n].map(([r,s])=>({key:r,value:s}))}function qA(e,t){return e.find(n=>{var r;return n.required&&!((r=t[n.key])!=null&&r.trim())})}const Bme="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2048%2048'%3e%3cimage%20width='48'%20height='48'%20href='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAMKADAAQAAAABAAAAMAAAAADbN2wMAAAH7UlEQVRoBdVZWWwbVRQ9492Onc1xTfaWLukq9oSqLKnYBZRSNgn6AagsAgmJRfzxg4SEEDtiER8IBKKAChK0FS1tKYWW0lZQKKV0gxCVJm3ikDiO17EdzrUzSdw4jj1OpeQqNzO237vvnHfvu/e9GWVwcBBDYue1mrqE2kI1UqeSJAnmIHUzNUCNUmGiKtQy6oPUR6geqnw/FSVOUH9R36KupfaDHnBQn6MGqEnqVJcEAfZTBbNL4b+lZPI1VbwwnaSfYO8z8N+TVMd0Qj6EVdbs3eIBP29cVFkL00kk+wSEwHAamgh9bDAJSQWTITZFnF+85J1tBPyOUC9OqqnsVdTIRkVBi70Msy125uriHJ8XAXFRfzKBTQM+rO0/hc54cSQE8iyzAx/XLcEltjIU44uCQijOaHvPfxIv97TjWCzEcMo7+sZ4TGa+2V6KT2rPQ73ZptsPBZE30fVrymvxTvUCtDoqYC0ijhMk/3MkgDd62xFheOqVggjIIAbOVaujEh/ULsaNzioUsxhVAv/A34GD0YBubxZMQJupWpMNr58zHytcHth1ekICsDcRx4u+fxBK6vOCbgKyEIXEK975WOmaoZuErKv1QR8ORQd0eUE3Ac0TNSYrXvI24fZSLxwGfebiDKW3e08gln9J0oYvKoMNG6kmiRdmzMOtTi8sOsJJJfANA93oiseGbeZ7k1EHZAKCEcApu4wCxUsSz3rm4HQiim3B/wpOsBJA2yP/4cZIJYIBFcGwCjWeSKEwm4wosZtR7rKizGXJQJZRB1TuttftAprnAbOrM9rl9UHqwg+s1o+eOow/GNN5CaPOklSgdKq4us+Ji7pt6Dw1AF9vBOGImjJht5lRVWFDY7UL58/3wOt2YPEcN2xWVpPRe6EQC+y9rwINPNKsuRaYX5cXhIxGkks+Y7V+6vQRdLBi5yx1bGwicFebivj+ARgOhZGMJMFyQyWpoV2GRIa2ZXOX2bDyqnPxzEPNKC+1Zj957eDBTbz34PXAwvoMfBN+kGV8Bxf00VgQz/vaEB6nSCnRQVj2h2DZG4TyZwQWlSils3m8RDDEhk2uaqlHaYklVb3Ha42dh4B3eMzZ//eEmMc0kGL3cEU9WksqU4XvzAYKZ9n6fQCOz3thORCGkhgCf2bDMz4bjQpW39yE65Y1QO5FxiUgP+76E3hzI7D1VyBcwP5NTFcZzXjaPRMNZmvGPkfA23YMwLHRD0Mf3ZwTgaBIi8GgYMGsSjx2z3kEP9Jp5E5rOeoqQH75C3htPfDpD4CskXxFvHC5vQKPVjSwPqQfcKTAfxuA/Ws/lBAXwEhUTGjWSAL3r1qYykSju+UkIFbZDx09wPvb0iH1W9uEYw03MHAV3ltew1CqgDkyCNtWgt/cnwY/3GriG5n9hbMrccNljRmzLz0nJCCNJBsEwsCH24E3NgDr96brhfyWS2Sm3EYLVsOL0i0DsG8h+LDkqcLExHhfc9siVDDrjJ59sZJRyHKZFRKybiSkTtIjR08CrXwEdtGcXL2A4+192LOuDeatfqg6wMvsL5lbhWuWysIdO995E9BgSkh19THX7wQOtANXLgKWLQSaarUWI9dNP7bjo68OY9uef6GqhcW8ZkViX2a/nBWYQ4+RggmIBfFGnHgOcD0c7wD2HgOW0xuXk0xN5SDaOwL4cnsb1m05joPHejKK0hgEOb4Q8Muba3H1pXUwZZl96aqLgHSU2RCbEe6/9hzh875OYPdhYF5NDLt/Oohd+46gNxBjm2zzJhZyi/RyV5TggdsvRJnTOm5j3QQ0i9ra6OHj1u9+B/YdNcLXVQdDmYNPy9oZ971IcIPHjUHadVrHHFfZNphtTtx508W4eJEHsg7Gk6IJaIZlDEn3EdUEl7sBg4la2MtqkYgNIOz/F9FgF6IhX6p5mozcjgbGasw/xWCCs7IeN7U24b4VddwZj26jjTZynTQCmknxSBqIETanh7ceWEpmpIiokT7E6JFosBvxaD/iJCeNDQYzTFYnzHY3SsobmfM9eOyucjTO0KyOf510AqOHkl2kiMlSQoAlsPLAk4hHSCaIJMMqmUgfYBQeggxGK4xmOxprXHh8lYK51em+E/0/qwQyBh8iY+Q52pjlOZD8XFcFPHELcGlT3stlbBaymtOROTReBoZJ+0DjZ9pv4SFq9fL0YWqcjJl1+AwP8OSGS+amq6y4P/fyyWqvoC9lDAG7ainPEJcBs7xMBGOLbU6bGQTMJHAnDUlG2biPFZevEM4GCZl9sSsnPgG+bAHfa+l8vZJxpNSo+oPp/c4XP6bPBN0kog2qtdFz1WzIkfXmZuAKVm6JewlbvZKVgGZMilMPwW9ngdr5B3CEG7iEbCY5ffl6RgPtYDGdybS4ogW4YDbgLefTD5s2kv5rTgKaWdlKi1fau4BDJ3jM5I70NDd0J7grzfZEUMg5CM5Tmg4TiW3ZtVYxTKpcgM2iWS7+mhcBbRiZ/TBTd4jPjtSEVF3AxxdUPgkxTrUUMTcBykKUmLZwhQlYPhWBeCBV5DRjk3QtiEC2McUDsjPVCEhWEQ8Umk2y2c7nOyEwrV/ySdbdQo3nw3aKtRHM3wiBtVQu02knISJ+SQh8Q32TyqTJJ6xTXyQzyzb2LeoBWQOy5pjwcDf1YSqzNIooLex99kTCppsq4N+l+oUArylhoku9sb+O18VU8c5UEiZu7KGyrKKTmgr7/wGxhy03aZIycwAAAABJRU5ErkJggg=='%20/%3e%3c/svg%3e",Fme=(()=>{const e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let r=0;r<8;r++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function Ume(e){let t=4294967295;for(let n=0;n>>8;return(t^4294967295)>>>0}function on(e,t){e.push(t&255,t>>>8&255)}function Gr(e,t){e.push(t&255,t>>>8&255,t>>>16&255,t>>>24&255)}const XA=2048,db=20,QA=0;function $me(e){const t=new TextEncoder,n=[],r=[];let s=0;for(const p of e){const m=t.encode(p.path),y=t.encode(p.content),E=Ume(y),g=y.length,x=[];Gr(x,67324752),on(x,db),on(x,XA),on(x,QA),on(x,0),on(x,0),Gr(x,E),Gr(x,g),Gr(x,g),on(x,m.length),on(x,0);const b=Uint8Array.from(x);n.push(b,m,y),r.push({nameBytes:m,dataBytes:y,crc:E,size:g,offset:s}),s+=b.length+m.length+y.length}const i=s,a=[];let o=0;for(const p of r){const m=[];Gr(m,33639248),on(m,db),on(m,db),on(m,XA),on(m,QA),on(m,0),on(m,0),Gr(m,p.crc),Gr(m,p.size),Gr(m,p.size),on(m,p.nameBytes.length),on(m,0),on(m,0),on(m,0),on(m,0),Gr(m,0),Gr(m,p.offset);const y=Uint8Array.from(m);a.push(y,p.nameBytes),o+=y.length+p.nameBytes.length}const c=[];Gr(c,101010256),on(c,0),on(c,0),on(c,r.length),on(c,r.length),Gr(c,o),Gr(c,i),on(c,0);const u=[...n,...a,Uint8Array.from(c)],d=u.reduce((p,m)=>p+m.length,0),f=new Uint8Array(d);let h=0;for(const p of u)f.set(p,h),h+=p.length;return new Blob([f],{type:"application/zip"})}const Hme=w.lazy(()=>lc(()=>import("./CodeEditor-1j-FKm8y.js"),[]));function zme(e){const t={name:"",children:new Map};for(const n of e){const r=n.path.split("/").filter(Boolean);let s=t;r.forEach((i,a)=>{let o=s.children.get(i);o||(o={name:i,children:new Map},s.children.set(i,o)),a===r.length-1&&(o.path=n.path),s=o})}return t}function Vme(e){return[...e.children.values()].sort((t,n)=>{const r=t.children.size>0&&t.path===void 0,s=n.children.size>0&&n.path===void 0;return r!==s?r?-1:1:t.name.localeCompare(n.name)})}function V6({project:e,open:t,onClose:n,onChange:r}){var m;const[s,i]=w.useState(((m=e.files[0])==null?void 0:m.path)??null),[a,o]=w.useState(new Set),c=w.useRef(null),u=w.useMemo(()=>zme(e.files),[e.files]),d=e.files.find(y=>y.path===s)??null;if(w.useEffect(()=>{var g;if(!t)return;const y=document.body.style.overflow;document.body.style.overflow="hidden",(g=c.current)==null||g.focus();const E=x=>{x.key==="Escape"&&n()};return window.addEventListener("keydown",E),()=>{document.body.style.overflow=y,window.removeEventListener("keydown",E)}},[n,t]),w.useEffect(()=>{d||e.files.length===0||i(e.files[0].path)},[e.files,d]),!t)return null;function f(y){o(E=>{const g=new Set(E);return g.has(y)?g.delete(y):g.add(y),g})}function h(y,E,g){return Vme(y).map(x=>{const b=g?`${g}/${x.name}`:x.name;if(!(x.children.size>0&&x.path===void 0)&&x.path)return l.jsxs("button",{type:"button",className:`code-browser-file${s===x.path?" is-active":""}`,style:{paddingLeft:`${12+E*16}px`},onClick:()=>i(x.path??null),title:x.path,children:[l.jsx(uS,{"aria-hidden":"true"}),l.jsx("span",{children:x.name})]},b);const k=a.has(b);return l.jsxs("div",{children:[l.jsxs("button",{type:"button",className:"code-browser-folder",style:{paddingLeft:`${10+E*16}px`},onClick:()=>f(b),"aria-expanded":!k,children:[l.jsx(ws,{className:k?"":"is-open","aria-hidden":"true"}),l.jsx(TL,{"aria-hidden":"true"}),l.jsx("span",{children:x.name})]}),!k&&h(x,E+1,b)]},b)})}function p(y){d&&r({...e,files:e.files.map(E=>E.path===d.path?{...E,content:y}:E)})}return Ss.createPortal(l.jsx("div",{className:"code-browser-backdrop",onMouseDown:y=>{y.target===y.currentTarget&&n()},children:l.jsxs("section",{className:"code-browser-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"code-browser-title",children:[l.jsxs("header",{className:"code-browser-head",children:[l.jsxs("div",{className:"code-browser-title-wrap",children:[l.jsx("span",{className:"code-browser-title-icon","aria-hidden":"true",children:l.jsx(Aw,{})}),l.jsxs("div",{children:[l.jsx("h2",{id:"code-browser-title",children:"项目代码"}),l.jsx("p",{children:e.name||"Agent 项目"})]})]}),l.jsx("button",{ref:c,type:"button",className:"code-browser-close",onClick:n,"aria-label":"关闭代码浏览器",children:l.jsx(zr,{"aria-hidden":"true"})})]}),l.jsxs("div",{className:"code-browser-workspace",children:[l.jsxs("aside",{className:"code-browser-sidebar","aria-label":"项目文件",children:[l.jsxs("div",{className:"code-browser-sidebar-head",children:["文件 ",l.jsx("span",{children:e.files.length})]}),l.jsx("div",{className:"code-browser-tree",children:e.files.length>0?h(u,0,""):l.jsx("div",{className:"code-browser-empty",children:"暂无项目文件"})})]}),l.jsxs("main",{className:"code-browser-main",children:[l.jsxs("div",{className:"code-browser-path",children:[l.jsx(uS,{"aria-hidden":"true"}),l.jsx("span",{children:(d==null?void 0:d.path)??"未选择文件"})]}),l.jsx("div",{className:"code-browser-editor",children:d?l.jsx(w.Suspense,{fallback:l.jsx("div",{className:"code-browser-empty",children:"正在加载编辑器…"}),children:l.jsx(Hme,{value:d.content,path:d.path,onChange:p})}):l.jsx("div",{className:"code-browser-empty",children:"从左侧选择文件以查看代码"})})]})]})]})}),document.body)}function Kme({project:e,onChange:t,className:n=""}){const[r,s]=w.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",className:`code-browser-trigger ${n}`.trim(),onClick:()=>s(!0),"aria-label":"查看和编辑项目源码",title:"查看源码",children:[l.jsx(Aw,{"aria-hidden":"true"}),l.jsx("span",{children:"查看源码"})]}),l.jsx(V6,{project:e,open:r,onClose:()=>s(!1),onChange:t})]})}function tg({message:e,className:t="",onRetry:n,retryLabel:r="重试部署"}){const[s,i]=w.useState(!1),[a,o]=w.useState(!1),[c,u]=w.useState(!1),d=async()=>{try{await navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),1500)}catch{o(!1)}},f=async()=>{if(!(!n||c)){u(!0);try{await n()}finally{u(!1)}}};return l.jsxs("div",{className:`deploy-error-message${s?" is-expanded":""}${t?` ${t}`:""}`,children:[l.jsx("p",{className:"deploy-error-message-text",children:e}),l.jsxs("div",{className:"deploy-error-message-actions",children:[n&&l.jsxs("button",{type:"button",className:"deploy-error-retry",disabled:c,onClick:()=>void f(),children:[c?l.jsx(Rt,{className:"spin"}):l.jsx(YH,{}),c?"重试中…":r]}),l.jsx("button",{type:"button",title:s?"收起错误信息":"展开完整错误信息","aria-label":s?"收起错误信息":"展开完整错误信息",onClick:()=>i(h=>!h),children:s?l.jsx(UH,{}):l.jsx(nc,{})}),l.jsx("button",{type:"button",title:a?"已复制":"复制完整错误信息","aria-label":a?"已复制":"复制完整错误信息",onClick:()=>void d(),children:a?l.jsx(Js,{}):l.jsx(Cw,{})})]})]})}Hr.registerLanguage("python",sj);Hr.registerLanguage("typescript",gj);Hr.registerLanguage("javascript",Z3);Hr.registerLanguage("json",J3);Hr.registerLanguage("yaml",yj);Hr.registerLanguage("markdown",rj);Hr.registerLanguage("bash",Y3);Hr.registerLanguage("ini",W3);Hr.registerLanguage("dockerfile",MQ);Hr.registerLanguage("makefile",nj);const Yme=w.lazy(()=>lc(()=>import("./CodeEditor-1j-FKm8y.js"),[])),fa=()=>{};function Wme({open:e,isUpdate:t,onCancel:n,onConfirm:r}){const s=w.useRef(null);return w.useEffect(()=>{var o;if(!e)return;const i=document.body.style.overflow;document.body.style.overflow="hidden",(o=s.current)==null||o.focus();const a=c=>{c.key==="Escape"&&n()};return window.addEventListener("keydown",a),()=>{document.body.style.overflow=i,window.removeEventListener("keydown",a)}},[n,e]),e?Ss.createPortal(l.jsx("div",{className:"code-browser-backdrop pp-confirm-backdrop",onMouseDown:i=>{i.target===i.currentTarget&&n()},children:l.jsxs("section",{className:"code-browser-dialog pp-confirm-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"pp-confirm-title","aria-describedby":"pp-confirm-description",children:[l.jsxs("header",{className:"code-browser-head pp-confirm-head",children:[l.jsxs("div",{className:"code-browser-title-wrap",children:[l.jsx("span",{className:"code-browser-title-icon pp-confirm-icon","aria-hidden":"true",children:l.jsx(XH,{})}),l.jsx("h2",{id:"pp-confirm-title",children:t?"确认更新":"确认部署"})]}),l.jsx("button",{type:"button",className:"code-browser-close",onClick:n,"aria-label":"关闭部署确认",children:l.jsx(zr,{"aria-hidden":"true"})})]}),l.jsx("div",{className:"pp-confirm-body",children:l.jsx("p",{id:"pp-confirm-description",children:t?"将更新并发布到当前云端 Runtime,过程可能需要几分钟。确定继续吗?":"将创建新的云端 Runtime,部署过程可能需要几分钟。确定继续吗?"})}),l.jsxs("footer",{className:"pp-confirm-actions",children:[l.jsx("button",{ref:s,type:"button",onClick:n,children:"取消"}),l.jsx("button",{type:"button",className:"is-primary",onClick:r,children:t?"确定更新":"确定部署"})]})]})}),document.body):null}const Gme={py:"python",pyi:"python",ts:"typescript",tsx:"typescript",mts:"typescript",cts:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",json:"json",jsonc:"json",yaml:"yaml",yml:"yaml",md:"markdown",markdown:"markdown",sh:"bash",bash:"bash",zsh:"bash",toml:"ini",ini:"ini",cfg:"ini",conf:"ini",env:"ini",txt:"plaintext"},ZA={dockerfile:"dockerfile","requirements.txt":"plaintext","requirements-dev.txt":"plaintext",".env":"ini",".gitignore":"plaintext",makefile:"makefile"};function JA(e){return e.replace(/&/g,"&").replace(//g,">")}function qme(e){const n=(e.split("/").pop()??e).toLowerCase();if(ZA[n])return ZA[n];if(n.startsWith("dockerfile"))return"dockerfile";if(n.startsWith(".env"))return"ini";const r=n.lastIndexOf(".");if(r===-1)return null;const s=n.slice(r+1);return Gme[s]??null}function Xme(e,t){try{const n=qme(t);return n&&Hr.getLanguage(n)?Hr.highlight(e,{language:n,ignoreIllegals:!0}).value:n===null?Hr.highlightAuto(e).value:JA(e)}catch{return JA(e)}}const Qme=[{phase:"build",label:"构建镜像"},{phase:"deploy",label:"部署"},{phase:"publish",label:"发布"}],Zme=[{phase:"upload",label:"上传代码包"},{phase:"build",label:"镜像打包"},{phase:"deploy",label:"创建 Runtime"},{phase:"publish",label:"发布服务"}];function Jme(e){const t={name:"",children:new Map};for(const n of e){const r=n.path.split("/").filter(Boolean);let s=t;r.forEach((i,a)=>{let o=s.children.get(i);o||(o={name:i,children:new Map},s.children.set(i,o)),a===r.length-1&&(o.path=n.path),s=o})}return t}function ege(e){return[...e.children.values()].sort((t,n)=>{const r=t.children.size>0&&t.path===void 0,s=n.children.size>0&&n.path===void 0;return r!==s?r?-1:1:t.name.localeCompare(n.name)})}function tge(e="",t=""){return{id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,key:e,value:t}}function nge({left:e,right:t}){const[n,r]=w.useState(null);return w.useLayoutEffect(()=>{const s=document.getElementById("veadk-page-header-left"),i=document.getElementById("veadk-page-header-actions");s&&i&&r({left:s,right:i})},[]),n?l.jsxs(l.Fragment,{children:[Ss.createPortal(e,n.left),Ss.createPortal(t,n.right)]}):l.jsxs("header",{className:"pp-toolbar",children:[e,t]})}function b0({project:e,embedded:t=!1,deployDisabledReason:n,agentDraft:r,agentName:s,agentCount:i,releaseConfiguration:a,onChange:o,onDeploy:c,onAgentAdded:u,onDeploymentComplete:d,deploymentActionLabel:f="部署",deploymentRuntimeId:h,onDeploymentStarted:p,onDeploymentTaskChange:m,feishuEnabled:y=!1,onFeishuEnabledChange:E,deploymentEnv:g=[],deploymentEnvValues:x={},onDeploymentEnvChange:b,network:_,onNetworkChange:k,deployRegion:N="cn-beijing",onDeployRegionChange:C,onBack:S,backLabel:A="返回配置",onExportYaml:O,deploymentPrimaryPane:D,deployDisabled:U=!1}){var ot,It,st;const X=typeof o=="function",M=f.includes("更新"),j=D?Zme:Qme,[T,L]=w.useState(((It=(ot=e==null?void 0:e.files)==null?void 0:ot[0])==null?void 0:It.path)??null),[R,F]=w.useState(new Set),[I,V]=w.useState(!1),[W,P]=w.useState(""),[ie,G]=w.useState(!1),[re,ue]=w.useState(!1),[ee,le]=w.useState(!1),[ne,me]=w.useState(!1),[ye,te]=w.useState(null),[de,Ee]=w.useState(null),[Te,Ke]=w.useState({}),[Ne,it]=w.useState(null),[He,Ue]=w.useState(!1),[Et,rt]=w.useState([]),[St,ct]=w.useState(!1),[B,Q]=w.useState(!1),oe=w.useRef(!0),be=Z=>l.jsxs("div",{className:"pp-network-region",onKeyDown:we=>{we.key==="Escape"&&Q(!1)},children:[Z&&l.jsx("span",{children:"发布区域"}),l.jsxs("button",{type:"button",className:"pp-region-trigger","aria-label":"部署区域","aria-haspopup":"listbox","aria-expanded":B,disabled:ie||M||!C,onClick:()=>Q(we=>!we),children:[l.jsx("span",{children:N==="cn-shanghai"?"华东 2(上海)":"华北 2(北京)"}),l.jsx(Tw,{className:`pp-region-chevron${B?" is-open":""}`})]}),B&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"menu-scrim",onClick:()=>Q(!1)}),l.jsx("div",{className:"pp-region-menu",role:"listbox","aria-label":"部署区域",children:[{value:"cn-beijing",label:"华北 2(北京)"},{value:"cn-shanghai",label:"华东 2(上海)"}].map(we=>{const _e=we.value===N;return l.jsxs("button",{type:"button",role:"option","aria-selected":_e,className:`pp-region-option${_e?" is-selected":""}`,onClick:()=>{C==null||C(we.value),Q(!1)},children:[l.jsx("span",{children:we.label}),_e&&l.jsx(Js,{"aria-hidden":"true"})]},we.value)})})]})]});w.useEffect(()=>(oe.current=!0,()=>{oe.current=!1}),[]),w.useEffect(()=>{if(!ee)return;const Z=document.body.style.overflow;document.body.style.overflow="hidden";const we=_e=>{_e.key==="Escape"&&le(!1)};return window.addEventListener("keydown",we),()=>{document.body.style.overflow=Z,window.removeEventListener("keydown",we)}},[ee]);const Oe=w.useMemo(()=>!(e!=null&&e.files)||!Array.isArray(e.files)?{name:"",children:new Map}:Jme(e.files),[e==null?void 0:e.files]);if(!e||!Array.isArray(e.files))return l.jsx("div",{className:"pp-error",children:"项目数据无效"});const Ye=e.files.find(Z=>Z.path===T)??null,tt=(_==null?void 0:_.mode)??"public",ze=Pme(y?[...g,...Eu]:g,x),Tt=ze.length+Et.length;function Re(Z){F(we=>{const _e=new Set(we);return _e.has(Z)?_e.delete(Z):_e.add(Z),_e})}function kt(Z,we){o&&(o({...e,files:Z}),we!==void 0&&L(we))}function Pt(Z){Ye&&kt(e.files.map(we=>we.path===Ye.path?{...we,content:Z}:we))}function Bt(){const Z=W.trim();if(V(!1),P(""),!!Z){if(e.files.some(we=>we.path===Z)){L(Z);return}kt([...e.files,{path:Z,content:""}],Z)}}function bn(){if(!Ye)return;const Z=window.prompt("重命名文件",Ye.path),we=Z==null?void 0:Z.trim();!we||we===Ye.path||e.files.some(_e=>_e.path===we)||kt(e.files.map(_e=>_e.path===Ye.path?{..._e,path:we}:_e),we)}function Xe(){var we;if(!Ye)return;const Z=e.files.filter(_e=>_e.path!==Ye.path);kt(Z,((we=Z[0])==null?void 0:we.path)??null)}function ft(Z,we){rt(_e=>_e.map(We=>We.id===Z?{...We,...we}:We))}function xt(Z){rt(we=>we.filter(_e=>_e.id!==Z))}function vt(){rt(Z=>[...Z,tge()])}function fe(Z){k&&k(Z==="public"?void 0:{..._??{mode:Z},mode:Z})}function $e(Z){k==null||k({..._??{mode:"private"},...Z})}function nt(){const Z=new Map(Et.map(_e=>({key:_e.key.trim(),value:_e.value})).filter(_e=>_e.key.length>0).map(_e=>[_e.key,_e.value])),we=y?[...g,...Eu]:g;for(const _e of z6(we,x))Z.set(_e.key,_e.value);return[...Z].map(([_e,We])=>({key:_e,value:We}))}async function qt(){if(!(!E||ie||ne)){te(null),me(!0);try{await E(!y)}catch(Z){oe.current&&te(`更新飞书配置失败:${Z instanceof Error?Z.message:String(Z)}`)}finally{oe.current&&me(!1)}}}async function fn(){var we;if(!c||ie||U)return;if(tt!=="public"&&!((we=_==null?void 0:_.vpcId)!=null&&we.trim())){te("使用 VPC 网络时,请填写 VPC ID。");return}const Z=qA(g,x);if(Z){const _e=g.find(We=>We.key===Z.key);te(`请返回配置页填写 ${(_e==null?void 0:_e.comment)||(_e==null?void 0:_e.key)}(${_e==null?void 0:_e.key})。`);return}if(y){const _e=qA(Eu,x);if(_e){const We=Eu.find(Ve=>Ve.key===_e.key);te(`启用飞书后,请填写${(We==null?void 0:We.comment)||(We==null?void 0:We.key)}。`);return}}ue(!0)}async function Lt(){if(!c||ie)return;ue(!1);const Z=nt();oe.current&&(te(null),Ee(null),Ke({}),it(null),G(!0));const we=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;let _e=(s==null?void 0:s.trim())||e.name||"生成中…";const We=Date.now(),Ve={id:we,runtimeName:_e,runtimeId:h,region:N,startedAt:We,status:"running",phase:"prepare",label:"准备部署",agentDraft:r};m==null||m(Ve),p==null||p(Ve);try{const Je=await c(e,ut=>{var Vt;ut.runtimeName&&(_e=ut.runtimeName),oe.current&&(Ke(Ft=>({...Ft,[ut.phase]:ut})),it(ut.phase)),m==null||m({id:we,runtimeName:_e,runtimeId:h,region:N,startedAt:We,status:"running",phase:ut.phase,label:((Vt=j.find(Ft=>Ft.phase===ut.phase))==null?void 0:Vt.label)??ut.phase,message:ut.message,pct:ut.pct})},y?{taskId:we,im:{feishu:{enabled:!0}},envs:Z}:{taskId:we,envs:Z});oe.current&&(Ee(Je),it(null)),await(d==null?void 0:d(Je)),m==null||m({id:we,runtimeName:Je.agentName||_e,runtimeId:Je.runtimeId||h,region:Je.region||N,startedAt:We,status:"success",phase:"complete",label:"部署完成"})}catch(Je){const ut=Je instanceof Error?Je.message:String(Je);if(Je instanceof DOMException&&Je.name==="AbortError"){oe.current&&(te(null),it(null)),m==null||m({id:we,runtimeName:_e,runtimeId:h,region:N,startedAt:We,status:"cancelled",label:"已取消",message:"部署已取消,相关 Runtime 资源已请求销毁。"});return}oe.current&&te(ut),m==null||m({id:we,runtimeName:_e,runtimeId:h,region:N,startedAt:We,status:"error",label:"部署失败",message:ut,retry:fn})}finally{oe.current&&G(!1)}}function J(){ue(!1)}async function he(){if(!(!de||He)){Ue(!0),te(null);try{const{addConnection:Z,addRuntimeConnection:we,remoteAppId:_e,loadConnections:We}=await lc(async()=>{const{addConnection:ut,addRuntimeConnection:Vt,remoteAppId:Ft,loadConnections:hn}=await Promise.resolve().then(()=>_S);return{addConnection:ut,addRuntimeConnection:Vt,remoteAppId:Ft,loadConnections:hn}},void 0),{probeRuntimeApps:Ve}=await lc(async()=>{const{probeRuntimeApps:ut}=await Promise.resolve().then(()=>vz);return{probeRuntimeApps:ut}},void 0);let Je;if(de.runtimeId){const ut=de.region??"cn-beijing",Vt=await Ve(de.runtimeId,ut)??[];Je=we(de.runtimeId,de.agentName,ut,Vt,Vt.length>0?{[Vt[0]]:de.agentName}:void 0,de.version)}else Je=await Z(de.agentName,de.url,de.apikey,"");if(Je.apps.length===0)te("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。");else{const ut={[Je.apps[0]]:de.agentName},Vt={...Je,appLabels:{...Je.appLabels??{},...ut}},hn=We().map(Kt=>Kt.id===Je.id?Vt:Kt);localStorage.setItem("veadk_agentkit_connections",JSON.stringify(hn));const{registerConnections:Tn}=await lc(async()=>{const{registerConnections:Kt}=await Promise.resolve().then(()=>_S);return{registerConnections:Kt}},void 0);if(Tn(hn),u){const Kt=_e(Je.id,Je.apps[0]);u(Kt,de.agentName)}else alert(`🎉 Agent "${de.agentName}" 已添加到左上角下拉列表!`)}}catch(Z){te(`添加 Agent 失败:${Z instanceof Error?Z.message:String(Z)}`)}finally{Ue(!1)}}}function Le(){const Z=$me(e.files),we=URL.createObjectURL(Z),_e=document.createElement("a");_e.href=we,_e.download=`${e.name||"project"}.zip`,document.body.appendChild(_e),_e.click(),document.body.removeChild(_e),URL.revokeObjectURL(we)}function Be(Z,we,_e){return ege(Z).map(We=>{const Ve=_e?`${_e}/${We.name}`:We.name,Je=We.path!==void 0,ut={paddingLeft:8+we*14};if(Je){const Ft=We.path===T;return l.jsxs("button",{type:"button",className:`pp-row pp-file${Ft?" pp-active":""}`,style:ut,onClick:()=>L(We.path),title:We.path,children:[l.jsx(SH,{className:"pp-ic"}),l.jsx("span",{className:"pp-label",children:We.name})]},Ve)}const Vt=R.has(Ve);return l.jsxs("div",{children:[l.jsxs("button",{type:"button",className:"pp-row pp-folder",style:ut,onClick:()=>Re(Ve),children:[l.jsx(ws,{className:`pp-ic pp-chevron${Vt?"":" pp-open"}`}),l.jsx(TL,{className:"pp-ic"}),l.jsx("span",{className:"pp-label",children:We.name})]}),!Vt&&Be(We,we+1,Ve)]},Ve)})}return l.jsxs("div",{className:`pp-root${c?" is-deploy":""}${t?" is-embedded":""}${D?" has-primary-pane":""}`,children:[c&&!t&&l.jsx(nge,{left:l.jsxs("div",{className:"pp-toolbar-left",children:[S&&l.jsxs("button",{type:"button",className:"pp-toolbar-back",onClick:S,children:[l.jsx(bL,{className:"pp-ic"}),A]}),l.jsxs("span",{className:"pp-toolbar-title",children:["部署 ",s||e.name||"未命名 Agent",i&&i>1?` 等 ${i} 个智能体`:""]})]}),right:null}),l.jsxs("div",{className:"pp-body",children:[c&&!D&&l.jsx("section",{className:"pp-release-overview","aria-label":"发布概览",children:l.jsxs("div",{className:"pp-release-preview",children:[l.jsxs("div",{className:"pp-flow-thumbnail",children:[r&&l.jsx(Qm,{draft:r,direction:"horizontal",selectedPath:[],onSelect:fa,onAdd:fa,onInsert:fa,onDelete:fa,readOnly:!0,interactivePreview:!0}),l.jsx("button",{type:"button",className:"pp-flow-expand",onClick:()=>le(!0),"aria-label":"放大查看执行流程",title:"放大查看",children:l.jsx(nc,{"aria-hidden":!0})})]}),l.jsxs("div",{className:"pp-release-info",children:[l.jsxs("div",{className:"pp-release-info-main",children:[l.jsx("h2",{children:s||e.name||"未命名 Agent"}),(r==null?void 0:r.description)&&l.jsx("p",{className:"pp-release-description",title:r.description,children:r.description}),l.jsxs("dl",{className:"pp-release-facts",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"Agent 数量"}),l.jsx("dd",{children:i??1})]}),a&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx("dt",{children:"模型"}),l.jsx("dd",{children:a.modelName})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"描述"}),l.jsx("dd",{className:"pp-release-fact-long",children:a.description})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"系统提示词"}),l.jsx("dd",{className:"pp-release-fact-long pp-release-prompt",children:a.instruction})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"优化选项"}),l.jsx("dd",{children:a.optimizations.length>0?a.optimizations.join("、"):"未启用"})]})]})]})]}),l.jsxs("div",{className:"pp-artifact-actions",children:[O&&l.jsxs("button",{type:"button",className:"pp-secondary",onClick:O,children:[l.jsx(_H,{className:"pp-ic"}),"导出配置文件"]}),X&&o&&l.jsx(Kme,{project:e,onChange:o,className:"pp-artifact-source"}),e.files.length>0&&l.jsxs("button",{type:"button",className:"pp-secondary",onClick:Le,children:[l.jsx(Iw,{className:"pp-ic"}),"导出源码"]})]})]})]})}),l.jsxs("div",{className:"pp-files-area",children:[l.jsxs("div",{className:"pp-sidebar",children:[l.jsxs("div",{className:"pp-sidebar-head",children:[l.jsx("span",{className:"pp-project-name",title:e.name,children:"文件预览"}),X&&l.jsx("button",{type:"button",className:"pp-icon-btn",title:"新建文件",onClick:()=>{V(!0),P("")},children:l.jsx(kH,{className:"pp-ic"})})]}),l.jsxs("div",{className:"pp-tree",children:[I&&l.jsx("input",{className:"pp-new-input",autoFocus:!0,placeholder:"path/to/file.py",value:W,onChange:Z=>P(Z.target.value),onBlur:Bt,onKeyDown:Z=>{Z.key==="Enter"&&Bt(),Z.key==="Escape"&&(V(!1),P(""))}}),e.files.length===0&&!I?l.jsx("div",{className:"pp-empty",children:"暂无文件"}):Be(Oe,0,"")]})]}),l.jsxs("div",{className:"pp-main",children:[l.jsxs("div",{className:"pp-main-head",children:[l.jsx("span",{className:"pp-path",title:Ye==null?void 0:Ye.path,children:(Ye==null?void 0:Ye.path)??"未选择文件"}),l.jsx("div",{className:"pp-actions",children:X&&Ye&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"pp-icon-btn",title:"重命名",onClick:bn,children:l.jsx(zH,{className:"pp-ic"})}),l.jsx("button",{type:"button",className:"pp-icon-btn pp-danger",title:"删除",onClick:Xe,children:l.jsx(ea,{className:"pp-ic"})})]})})]}),l.jsx("div",{className:"pp-content",children:Ye==null?l.jsx("div",{className:"pp-placeholder",children:"选择左侧文件以查看内容"}):X?l.jsx("div",{className:"pp-codemirror",children:l.jsx(w.Suspense,{fallback:l.jsx("div",{className:"pp-editor-loading",children:"加载编辑器…"}),children:l.jsx(Yme,{value:Ye.content,path:Ye.path,onChange:Pt})})}):l.jsx("pre",{className:"pp-pre hljs",dangerouslySetInnerHTML:{__html:Xme(Ye.content,Ye.path)}})})]})]}),c&&l.jsxs("aside",{className:"pp-config","aria-label":"部署配置",children:[l.jsx("div",{className:"pp-config-head",children:l.jsx("div",{className:"pp-config-title",children:"部署配置"})}),l.jsxs("div",{className:"pp-config-scroll",children:[D,!D&&l.jsxs("section",{className:"pp-config-section",children:[l.jsx("div",{className:"pp-config-label",children:"发布区域"}),be(!1)]}),!D&&l.jsxs("section",{className:"pp-config-section",children:[l.jsx("div",{className:"pp-config-label",children:"消息渠道"}),l.jsx("div",{className:`pp-channel-card${y?" is-flipped":""}`,children:l.jsxs("div",{className:"pp-channel-card-inner",children:[l.jsxs("button",{type:"button",className:"pp-channel-card-face pp-channel-card-front","aria-pressed":y,"aria-hidden":y,tabIndex:y?-1:0,onClick:()=>void qt(),disabled:y||ie||ne||!E,children:[l.jsx("span",{className:"pp-channel-logo",children:l.jsx("img",{src:Bme,alt:""})}),l.jsxs("span",{className:"pp-channel-card-copy",children:[l.jsx("strong",{children:"飞书"}),l.jsx("small",{children:ne?"正在启用并更新配置…":"接收消息并通过飞书机器人回复"})]})]}),l.jsxs("div",{className:"pp-channel-card-face pp-channel-card-back","aria-hidden":!y,children:[l.jsxs("div",{className:"pp-channel-card-head",children:[l.jsx("strong",{children:"飞书配置"}),l.jsx("button",{type:"button",className:"pp-channel-remove",tabIndex:y?0:-1,onClick:()=>void qt(),disabled:!y||ie||ne||!E,children:ne?"取消中…":"取消"})]}),l.jsx("div",{className:"pp-channel-fields",children:Eu.map(Z=>l.jsxs("label",{children:[l.jsxs("span",{children:[Z.comment||Z.key,Z.required&&l.jsx("small",{children:"必填"})]}),l.jsx("input",{type:Z.key.includes("SECRET")?"password":"text",value:x[Z.key]??"",placeholder:Z.placeholder,tabIndex:y?0:-1,disabled:!y||ie||!b,autoComplete:"off",onChange:we=>b==null?void 0:b(Z.key,we.currentTarget.value)})]},Z.key))})]})]})})]}),l.jsxs("section",{className:"pp-config-section",children:[l.jsx("div",{className:"pp-config-label",children:"网络"}),D&&be(!0),M&&l.jsx("p",{className:"pp-config-note",children:"现有 Runtime 的区域与网络模式保持不变。"}),l.jsxs("div",{className:"pp-network-layout",children:[l.jsx("div",{className:"pp-network-modes",role:"radiogroup","aria-label":"网络模式",children:["public","private","both"].map(Z=>l.jsxs("label",{className:"pp-network-option",children:[l.jsx("input",{type:"radio",name:"deployment-network-mode",value:Z,checked:tt===Z,onChange:()=>fe(Z),disabled:ie||M||!k}),l.jsx("span",{children:Z==="public"?"公网":Z==="private"?"VPC":"公网 + VPC"})]},Z))}),tt!=="public"&&l.jsxs("div",{className:"pp-network-fields",children:[l.jsxs("label",{children:[l.jsx("span",{children:"VPC ID"}),l.jsx("input",{value:(_==null?void 0:_.vpcId)??"",placeholder:"vpc-xxxxxxxx",disabled:ie||M,onChange:Z=>$e({vpcId:Z.target.value})})]}),l.jsxs("label",{children:[l.jsxs("span",{children:["子网 ID ",l.jsx("small",{children:"可选,多个用逗号分隔"})]}),l.jsx("input",{value:(_==null?void 0:_.subnetIds)??"",placeholder:"subnet-xxx, subnet-yyy",disabled:ie||M,onChange:Z=>$e({subnetIds:Z.target.value})})]}),l.jsxs("label",{className:"pp-network-check",children:[l.jsx("input",{type:"checkbox",checked:!!(_!=null&&_.enableSharedInternetAccess),disabled:ie||M,onChange:Z=>$e({enableSharedInternetAccess:Z.target.checked})}),"VPC 内共享公网出口"]})]})]})]}),l.jsxs("section",{className:"pp-config-section pp-env-section",children:[l.jsxs("div",{className:"pp-env-head",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"pp-config-label",children:["环境变量",l.jsxs("span",{className:"pp-agent-child-count pp-env-count",children:[Tt," 项"]})]}),l.jsx("div",{className:"pp-env-sub",children:"组件配置会自动同步到这里,部署前可核对最终值。"})]}),l.jsx("button",{type:"button",className:"pp-icon-btn",title:St?"隐藏值":"显示值",onClick:()=>ct(Z=>!Z),children:St?l.jsx(wH,{className:"pp-ic"}):l.jsx(kL,{className:"pp-ic"})})]}),l.jsxs("button",{type:"button",className:"pp-env-add",onClick:vt,disabled:ie,children:[l.jsx(rr,{className:"pp-ic"}),"添加变量"]}),(ze.length>0||Et.length>0)&&l.jsxs("div",{className:"pp-env-table",children:[ze.length>0&&l.jsxs("div",{className:"pp-env-group",children:[l.jsxs("div",{className:"pp-env-group-head",children:[l.jsx("span",{children:"组件自动生成"}),l.jsxs("small",{children:[ze.length," 项"]})]}),ze.map(Z=>{const we=Z.key.startsWith("ENABLE_");return l.jsxs("div",{className:"pp-env-row pp-env-row-derived",children:[l.jsx("input",{className:"pp-env-key-fixed",value:Z.key,readOnly:!0,disabled:ie,"aria-label":`${Z.key} 环境变量名`}),l.jsx("input",{type:we||St?"text":"password",value:Z.value,placeholder:Z.required?"必填,尚未填写":"可选,尚未填写",readOnly:we,disabled:ie||!we&&!b,autoComplete:"off","aria-label":`${Z.key} 环境变量值`,onChange:_e=>b==null?void 0:b(Z.key,_e.currentTarget.value)}),l.jsx("span",{className:"pp-env-source",children:we?"自动":"同步"})]},Z.key)})]}),Et.length>0&&l.jsxs("div",{className:"pp-env-group-head pp-env-group-head-custom",children:[l.jsx("span",{children:"自定义变量"}),l.jsxs("small",{children:[Et.length," 项"]})]}),Et.map(Z=>l.jsxs("div",{className:"pp-env-row",children:[l.jsx("input",{value:Z.key,placeholder:"名称",disabled:ie,autoComplete:"off",onChange:we=>ft(Z.id,{key:we.currentTarget.value})}),l.jsx("input",{type:St?"text":"password",value:Z.value,placeholder:"值",disabled:ie,autoComplete:"off",onChange:we=>ft(Z.id,{value:we.currentTarget.value})}),l.jsx("button",{type:"button",className:"pp-icon-btn pp-env-remove",title:"删除变量",disabled:ie,onClick:()=>xt(Z.id),children:l.jsx(zr,{className:"pp-ic"})})]},Z.id))]})]}),(ie||de||Object.keys(Te).length>0)&&l.jsxs("section",{className:"pp-config-section pp-progress-section",children:[l.jsx("div",{className:"pp-config-label",children:"部署进度"}),l.jsx("ol",{className:"pp-steps",children:j.map((Z,we)=>{const _e=Ne?j.findIndex(ut=>ut.phase===Ne):-1,We=!!ye&&(_e===-1?we===0:we===_e);let Ve;de?Ve="done":We?Ve="failed":_e===-1?Ve=ie?"active":"pending":we<_e?Ve="done":we===_e?Ve=ye?"failed":"active":Ve="pending";const Je=Te[Z.phase];return l.jsxs("li",{className:`pp-step is-${Ve}`,children:[l.jsx("span",{className:"pp-step-dot",children:Ve==="active"?l.jsx(Rt,{className:"pp-ic spin"}):Ve==="done"?"✓":Ve==="failed"?"✕":we+1}),l.jsxs("span",{className:"pp-step-body",children:[l.jsx("span",{className:"pp-step-label",children:Z.label}),Ve==="active"&&(Je==null?void 0:Je.message)&&l.jsxs("span",{className:"pp-step-msg",children:[Je.message,typeof Je.pct=="number"?` (${Je.pct}%)`:""]})]})]},Z.phase)})})]}),ye&&l.jsx(tg,{className:"pp-error",message:`${Ne?`${M?"更新":"部署"}失败(${((st=j.find(Z=>Z.phase===Ne))==null?void 0:st.label)??Ne}阶段):`:""}${ye}`,onRetry:fn,retryLabel:M?"重试更新":"重试部署"}),de&&l.jsxs("section",{className:"pp-deploy-result",children:[l.jsx("div",{className:"pp-deploy-result-header",children:M?"更新成功":"部署成功"}),l.jsxs("div",{className:"pp-deploy-result-body",children:[de.region&&l.jsxs("div",{className:"pp-deploy-result-field",children:[l.jsx("label",{children:"区域"}),l.jsx("code",{children:de.region==="cn-shanghai"?"上海 (cn-shanghai)":"北京 (cn-beijing)"})]}),l.jsxs("div",{className:"pp-deploy-result-field",children:[l.jsx("label",{children:"Agent 名称"}),l.jsx("code",{children:de.agentName})]}),l.jsxs("div",{className:"pp-deploy-result-field",children:[l.jsx("label",{children:"API 端点"}),l.jsx("code",{className:"pp-deploy-result-url",children:de.url})]})]}),l.jsxs("div",{className:"pp-deploy-result-actions",children:[l.jsxs("button",{type:"button",className:"pp-deploy-result-btn",onClick:he,disabled:He,children:[He?l.jsx(Rt,{className:"pp-ic spin"}):l.jsx(OL,{className:"pp-ic"}),He?"连接中…":"立即对话"]}),de.consoleUrl&&l.jsxs("a",{href:de.consoleUrl,target:"_blank",rel:"noopener noreferrer",className:"pp-console-link pp-console-link-btn",children:[l.jsx(Ow,{className:"pp-ic"}),"控制台"]})]})]})]}),l.jsx("div",{className:"pp-config-actions",children:l.jsx("button",{type:"button",className:"pp-deploy studio-update-action",onClick:fn,disabled:ie||ne||U||!!n,title:n,children:ie?`${f}中…`:ye?`重试${f}`:f})})]})]}),ee&&r&&Ss.createPortal(l.jsx("div",{className:"pp-flow-backdrop",onMouseDown:Z=>{Z.target===Z.currentTarget&&le(!1)},children:l.jsxs("section",{className:"pp-flow-dialog",role:"dialog","aria-modal":"true","aria-label":"执行流程预览",children:[l.jsxs("header",{children:[l.jsxs("div",{children:[l.jsx("strong",{children:"执行流程"}),l.jsx("span",{children:"只读预览,可缩放与拖动画布"})]}),l.jsx("button",{type:"button",onClick:()=>le(!1),"aria-label":"关闭执行流程预览",children:l.jsx(zr,{"aria-hidden":!0})})]}),l.jsx("div",{className:"pp-flow-dialog-canvas",children:l.jsx(Qm,{draft:r,direction:"horizontal",selectedPath:[],onSelect:fa,onAdd:fa,onInsert:fa,onDelete:fa,readOnly:!0,interactivePreview:!0})})]})}),document.body),l.jsx(Wme,{open:re,isUpdate:M,onCancel:J,onConfirm:()=>void Lt()})]})}const eC="dogfooding",fb="dogfooding",hb="dogfooding_b";let rge=0;const pb=()=>++rge;function tC(e){return e.blocks.filter(t=>t.kind==="text").map(t=>t.text).join("")}function sge(e){const t=e.trim(),n=t.match(/^```(?:json)?\s*\n?([\s\S]*?)\n?```$/i);return(n?n[1]:t).trim()}async function nC(e){const t=[],n=sge(e);t.push(n);const r=n.indexOf("{"),s=n.lastIndexOf("}");r>=0&&s>r&&t.push(n.slice(r,s+1));for(const i of t)try{const a=JSON.parse(i);if(a&&typeof a=="object"&&(typeof a.name=="string"||typeof a.instruction=="string"))return await Hw(U6(a))}catch{}return null}function ige({userId:e,onBack:t,onCreate:n,onAgentAdded:r,onDeploymentTaskChange:s}){const[i,a]=w.useState([{id:pb(),role:"assistant",text:"你好,我是 VeADK 的智能构建助手。用自然语言描述你想要的 Agent,我会直接帮你生成一个可运行的 VeADK 项目,并在右侧实时预览。"}]),[o,c]=w.useState(""),[u,d]=w.useState(!1),[f,h]=w.useState(null),[p,m]=w.useState(null),[y,E]=w.useState(!1),[g,x]=w.useState(null),[b,_]=w.useState(null),[k,N]=w.useState(!1),[C,S]=w.useState(!1),[A,O]=w.useState({}),D=w.useRef(null),U=w.useRef(null),X=w.useRef(null),M=w.useRef(null),j=w.useRef(null);w.useEffect(()=>{const G=M.current;G&&G.scrollTo({top:G.scrollHeight,behavior:"smooth"})},[i,u]),w.useEffect(()=>{const G=j.current;G&&(G.style.height="auto",G.style.height=Math.min(G.scrollHeight,160)+"px")},[o]);const T=G=>a(re=>[...re,{id:pb(),role:"assistant",text:G}]);async function L(){if(D.current)return D.current;const G=await _m(eC,e);return D.current=G,G}async function R(G,re){if(re.current)return re.current;const ue=await _m(G,e);return re.current=ue,ue}async function F(G,re){if(!A[G])try{const ue=await Uw(re);O(ee=>({...ee,[G]:ue.model||re}))}catch{O(ue=>({...ue,[G]:re}))}}async function I(G,re,ue){const ee=await R(G,re);let le=zs();for await(const me of Wd({appName:G,userId:e,sessionId:ee,text:ue}))le=xc(le,me);const ne=tC(le).trim();return{project:await nC(ne),finalText:ne}}const V=async(G,re,ue)=>Lg(G.name,G.files,{region:"cn-beijing",projectName:"default"},{...ue,onStage:re}),W=async()=>{const G=o.trim();if(!(!G||u)){if(a(re=>[...re,{id:pb(),role:"user",text:G}]),c(""),h(null),d(!0),y){x(null),_(null),N(!0),S(!0),F("a",fb),F("b",hb);const re=I(fb,U,G).then(({project:ee})=>(x(ee),ee)).catch(ee=>{const le=ee instanceof Error?ee.message:String(ee);return h(le),null}).finally(()=>N(!1)),ue=I(hb,X,G).then(({project:ee})=>(_(ee),ee)).catch(ee=>{const le=ee instanceof Error?ee.message:String(ee);return h(le),null}).finally(()=>S(!1));try{const[ee,le]=await Promise.all([re,ue]),ne=[ee?`方案 A:${ee.name}`:null,le?`方案 B:${le.name}`:null].filter(Boolean);ne.length?T(`已生成两个方案(${ne.join(",")}),请在右侧对比后采用其一。`):T("(两个方案都没有返回可用的项目,请再描述一下你的需求。)")}finally{d(!1)}return}try{const re=await L();let ue=zs();for await(const ne of Wd({appName:eC,userId:e,sessionId:re,text:G}))ue=xc(ue,ne);const ee=tC(ue).trim(),le=await nC(ee);le?(m(le),T(`已生成项目:${le.name}(${le.files.length} 个文件),可在右侧预览和编辑。`)):T(ee||"(助手没有返回内容,请再描述一下你的需求。)")}catch(re){const ue=re instanceof Error?re.message:String(re);h(ue),T(`抱歉,调用智能构建助手失败:${ue}`)}finally{d(!1)}}},P=G=>{const re=G==="a"?g:b;if(!re)return;m(re),E(!1),x(null),_(null),N(!1),S(!1);const ue=G==="a"?"A":"B",ee=G==="a"?A.a:A.b;T(`已采用方案 ${ue}(${ee??(G==="a"?fb:hb)}),可继续编辑。`)},ie=G=>{G.key==="Enter"&&!G.shiftKey&&!G.nativeEvent.isComposing&&(G.preventDefault(),W())};return l.jsx("div",{className:"ic-root",children:l.jsxs("div",{className:"ic-body",children:[l.jsxs("div",{className:"ic-chat",children:[l.jsxs("div",{className:"ic-transcript",ref:M,children:[l.jsx(pi,{initial:!1,children:i.map(G=>l.jsxs($t.div,{className:`ic-turn ic-turn--${G.role}`,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.22,ease:"easeOut"},children:[G.role==="assistant"&&l.jsx("div",{className:"ic-avatar",children:l.jsx(Po,{className:"ic-avatar-icon"})}),l.jsx("div",{className:"ic-bubble",children:G.role==="assistant"?l.jsx(jf,{text:G.text}):G.text})]},G.id))}),u&&l.jsxs($t.div,{className:"ic-turn ic-turn--assistant",initial:{opacity:0,y:8},animate:{opacity:1,y:0},children:[l.jsx("div",{className:"ic-avatar",children:l.jsx(Po,{className:"ic-avatar-icon"})}),l.jsxs("div",{className:"ic-bubble ic-bubble--typing",children:[l.jsx("span",{className:"ic-dot"}),l.jsx("span",{className:"ic-dot"}),l.jsx("span",{className:"ic-dot"})]})]})]}),f&&l.jsxs("div",{className:"ic-error",children:[l.jsx(Cg,{className:"ic-error-icon"}),f]}),l.jsxs("div",{className:"ic-composer",children:[l.jsxs("div",{className:"ic-composer-box",children:[l.jsx("textarea",{ref:j,className:"ic-input",rows:1,placeholder:"描述你想要的 Agent,例如「一个帮我整理周报的写作助手」…",value:o,onChange:G=>c(G.target.value),onKeyDown:ie,disabled:u}),l.jsx("button",{className:"ic-send",onClick:()=>void W(),disabled:!o.trim()||u,title:"发送 (Enter)",children:l.jsx(WH,{className:"ic-send-icon"})})]}),l.jsxs("div",{className:"ic-composer-foot",children:[l.jsxs("label",{className:"ic-ab-toggle",title:"同时用两个模型生成方案进行对比",children:[l.jsx("input",{type:"checkbox",className:"ic-ab-checkbox",checked:y,disabled:u,onChange:G=>E(G.target.checked)}),l.jsx("span",{className:"ic-ab-track",children:l.jsx("span",{className:"ic-ab-thumb"})}),l.jsx("span",{className:"ic-ab-label",children:"A/B 对比"})]}),l.jsx("div",{className:"ic-composer-hint",children:"Enter 发送 · Shift+Enter 换行"})]})]})]}),l.jsx("aside",{className:"ic-preview",children:y?l.jsxs("div",{className:"ic-compare",children:[l.jsx(rC,{side:"a",project:g,loading:k,model:A.a,onAdopt:()=>P("a")}),l.jsx("div",{className:"ic-compare-divider"}),l.jsx(rC,{side:"b",project:b,loading:C,model:A.b,onAdopt:()=>P("b")})]}):p?l.jsx(b0,{project:p,onChange:m,onDeploy:V,onAgentAdded:r,onDeploymentTaskChange:s}):l.jsxs("div",{className:"ic-preview-empty",children:[l.jsxs("div",{className:"ic-preview-empty-icon",children:[l.jsx(AH,{className:"ic-preview-empty-glyph"}),l.jsx(Bo,{className:"ic-preview-empty-spark"})]}),l.jsx("div",{className:"ic-preview-empty-title",children:"还没有项目"}),l.jsx("div",{className:"ic-preview-empty-sub",children:"描述你的需求,我会帮你生成 VeADK 项目"})]})})]})})}function rC({side:e,project:t,loading:n,model:r,onAdopt:s}){const i=e==="a"?"方案 A":"方案 B";return l.jsxs("div",{className:"ic-pane",children:[l.jsxs("div",{className:"ic-pane-head",children:[l.jsxs("div",{className:"ic-pane-title",children:[l.jsx("span",{className:`ic-pane-tag ic-pane-tag--${e}`,children:i}),r&&l.jsx("span",{className:"ic-pane-model",children:r})]}),l.jsxs("button",{className:"ic-adopt",onClick:s,disabled:!t||n,title:`采用${i}`,children:["采用",e==="a"?"方案 A":"方案 B"]})]}),l.jsx("div",{className:"ic-pane-body",children:n?l.jsxs("div",{className:"ic-pane-loading",children:[l.jsx(Rt,{className:"ic-pane-spinner"}),l.jsx("span",{children:"正在生成…"})]}):t?l.jsx(b0,{project:t}):l.jsx("div",{className:"ic-pane-empty",children:"该方案未返回可用项目"})})]})}const age=/^[A-Za-z_][A-Za-z0-9_]*$/;function cc(e){return e.trim().length===0?"名称为必填项":e==="user"?"user 是 Google ADK 保留名称,请使用其他名称":age.test(e)?null:"名称须以英文字母或下划线开头,且只能包含英文字母、数字和下划线"}function K6(e){const t=new Set,n=new Set,r=s=>{cc(s.name)===null&&(t.has(s.name)?n.add(s.name):t.add(s.name)),s.subAgents.forEach(r)};return r(e),n}function oge({className:e,...t}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[l.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"}),l.jsx("path",{d:"M12 6.5c.4 2.4 1 3 3.4 3.4-2.4.4-3 1-3.4 3.4-.4-2.4-1-3-3.4-3.4 2.4-.4 3-1 3.4-3.4Z"})]})}const Iu={llm:{id:"llm",label:"LLM 智能体",desc:"大模型驱动,自主完成任务",icon:oge},sequential:{id:"sequential",label:"顺序型智能体",desc:"子 Agent 按顺序依次执行",icon:CH},parallel:{id:"parallel",label:"并行型智能体",desc:"子 Agent 并行执行后汇总",icon:qH},loop:{id:"loop",label:"循环型智能体",desc:"子 Agent 循环执行到满足条件",icon:Lw},a2a:{id:"a2a",label:"远程智能体",desc:"通过 A2A 协议调用远程 Agent",icon:Ig}},lge=[Iu.llm,Iu.sequential,Iu.parallel,Iu.loop,Iu.a2a],Y6=e=>e==="sequential"||e==="parallel"||e==="loop",E0=e=>e==="a2a";function As(e){return e.trimEnd().replace(/[。.]+$/,"")}function ng(e,t){const n=e.trim().toLocaleLowerCase();return n?t.some(r=>r==null?void 0:r.toLocaleLowerCase().includes(n)):!0}function so(e,t){return e[t]|e[t+1]<<8}function yl(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}async function cge(e){const t=new DecompressionStream("deflate-raw"),n=new Blob([new Uint8Array(e)]).stream().pipeThrough(t);return new Uint8Array(await new Response(n).arrayBuffer())}async function W6(e,t={}){let r=-1;for(let u=e.length-22;u>=0&&u>e.length-65557;u--)if(yl(e,u)===101010256){r=u;break}if(r<0)throw new Error("无效的 zip:找不到 EOCD");const s=so(e,r+10);if(t.maxEntries!==void 0&&s>t.maxEntries)throw new Error(`zip 文件数不能超过 ${t.maxEntries} 个`);let i=yl(e,r+16);const a=new TextDecoder("utf-8"),o=[];let c=0;for(let u=0;ut.maxUncompressedBytes)throw new Error("zip 解压后的内容过大");const x=so(e,E+26),b=so(e,E+28),_=E+30+x+b,k=e.subarray(_,_+f);let N;if(d===0)N=k;else if(d===8)N=await cge(k);else{i+=46+p+m+y;continue}o.push({name:g,text:a.decode(N)}),i+=46+p+m+y}return o}const uge="/skillhub/v1/skills";async function dge(e,t="public"){const n=e.trim(),r=`${uge}?query=${encodeURIComponent(n)}&namespace=${encodeURIComponent(t)}`,s=await fetch(r,{headers:{accept:"application/json"},signal:Gs(void 0,Yc)});if(!s.ok)throw new Error(`搜索失败 (${s.status})`);return((await s.json()).Skills??[]).map(a=>{var o;return{source:"skillhub",id:a.Id??a.Slug??"",slug:a.Slug??"",name:a.Name??a.Slug??"",description:((o=a.Metadata)==null?void 0:o.DisplayDescription)||a.Description||"",namespace:a.Namespace??t,sourceRepo:a.SourceRepo,downloadCount:a.DownloadCount}})}function fge({selected:e,onChange:t}){const[n,r]=w.useState(""),[s,i]=w.useState([]),[a,o]=w.useState(!1),[c,u]=w.useState(null),[d,f]=w.useState(!1),h=y=>e.some(E=>E.source==="skillhub"&&E.slug===y),p=y=>{y.slug&&(h(y.slug)?t(e.filter(E=>!(E.source==="skillhub"&&E.slug===y.slug))):t([...e,{source:"skillhub",slug:y.slug,name:y.name,folder:y.slug.split("/").pop()||y.name,namespace:y.namespace||"public",description:y.description}]))},m=async y=>{o(!0),u(null),f(!0);try{const E=await dge(y);i(E)}catch(E){u(E instanceof Error?E.message:"搜索失败,请稍后重试。"),i([])}finally{o(!1)}};return w.useEffect(()=>{const y=n.trim();if(!y){i([]),f(!1),u(null);return}const E=setTimeout(()=>m(y),300);return()=>clearTimeout(E)},[n]),l.jsxs("div",{className:"cw-skillhub",children:[l.jsxs("div",{className:"cw-skill-searchrow",children:[l.jsxs("div",{className:"cw-skill-searchbox",children:[l.jsx(Kd,{className:"cw-i cw-skill-searchicon","aria-hidden":!0}),l.jsx("input",{className:"cw-input cw-skill-input",value:n,placeholder:"搜索火山 Find Skill 技能广场,例如 数据分析、PDF…",onChange:y=>r(y.target.value),onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),n.trim()&&m(n))}})]}),l.jsxs("button",{type:"button",className:"cw-btn cw-btn-soft",onClick:()=>n.trim()&&m(n),disabled:!n.trim()||a,children:[a?l.jsx(Rt,{className:"cw-i cw-spin"}):l.jsx(Kd,{className:"cw-i"}),"搜索"]})]}),c&&l.jsxs("div",{className:"cw-banner",children:[l.jsx(Ya,{className:"cw-i"}),l.jsx("span",{children:c})]}),a&&s.length===0?l.jsx("p",{className:"cw-empty-line",children:"正在搜索…"}):s.length>0?l.jsx("div",{className:"cw-skill-results",children:s.map(y=>{const E=h(y.slug||"");return l.jsxs("button",{type:"button",className:`cw-skill-result ${E?"is-on":""}`,onClick:()=>p(y),"aria-pressed":E,children:[l.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:E?l.jsx(Js,{className:"cw-i cw-i-sm"}):l.jsx(rr,{className:"cw-i cw-i-sm"})}),l.jsxs("span",{className:"cw-skill-result-meta",children:[l.jsx("span",{className:"cw-skill-result-name",children:y.name}),y.description&&l.jsx("span",{className:"cw-skill-result-desc",children:As(y.description)}),y.sourceRepo&&l.jsx("span",{className:"cw-skill-result-repo",children:y.sourceRepo})]})]},y.id||y.slug)})}):d&&!c?l.jsx("p",{className:"cw-empty-line",children:"没有找到匹配的技能,换个关键词试试。"}):!d&&l.jsx("p",{className:"cw-empty-line",children:"输入关键词搜索火山 Find Skill 技能广场,所选技能会在生成项目时下载到 skills/ 目录。"})]})}const GE=/(^|\/)skill\.md$/i;class Pa extends Error{}function hge(e,t){const n=(e??"").replace(/\r\n?/g,` +`+_me(U6(e))}function Ome(e){const t=vme(e);return F6(t)}const Rme=[{kind:"custom",icon:ZH,title:"自定义",desc:"分步配置模型、工具、记忆、知识库等组件。"},{kind:"intelligent",icon:PH,title:"智能模式",desc:"敬请期待",disabled:!0},{kind:"template",icon:LH,title:"从模板新建",desc:"敬请期待",disabled:!0},{kind:"workflow",icon:JH,title:"工作流",desc:"敬请期待",disabled:!0}];function Lme({onSelect:e,onImport:t}){const n=w.useRef(null),[r,s]=w.useState(""),i=Rme.map(o=>({key:o.kind,icon:o.icon,title:o.title,desc:o.desc,disabled:o.disabled,onClick:()=>e(o.kind)})),a=async o=>{var u;const c=(u=o.target.files)==null?void 0:u[0];if(o.target.value="",!!c)try{const d=await c.text();t(Ome(d))}catch(d){s(`导入失败:${d instanceof Error?d.message:String(d)}`)}};return l.jsx(G4,{title:"从 0 快速创建",sub:"选择一种方式开始",cards:i,footer:l.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[l.jsxs("button",{className:"stk-import",onClick:()=>{var o;return(o=n.current)==null?void 0:o.click()},children:[l.jsx(XH,{}),"导入 YAML 配置"]}),r&&l.jsx("span",{style:{fontSize:12,color:"hsl(var(--destructive))"},children:r}),l.jsx("input",{ref:n,type:"file",accept:".yaml,.yml,text/yaml",style:{display:"none"},onChange:a})]})})}const Mme="modulepreload",jme=function(e){return"/"+e},WA={},oc=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),o=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=Promise.allSettled(n.map(c=>{if(c=jme(c),c in WA)return;WA[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":Mme,u||(f.as="script"),f.crossOrigin="",f.href=c,o&&f.setAttribute("nonce",o),document.head.appendChild(f),u)return new Promise((h,p)=>{f.addEventListener("load",h),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return s.then(a=>{for(const o of a||[])o.status==="rejected"&&i(o.reason);return t().catch(i)})};function $6(e){const t=new Map,n={};for(const r of e){for(const s of r.env){const i=t.get(s.key);(!i||s.required&&!i.required)&&t.set(s.key,s)}r.enableFlag&&(t.set(r.enableFlag,{key:r.enableFlag,required:!0}),n[r.enableFlag]="true")}return{specs:[...t.values()],fixedValues:n}}function Dme(e,t){return $6([{env:e}]).specs.map(r=>({...r,value:t[r.key]??""}))}function H6(e,t){const n=new Map;for(const r of e){const s=t[r.key]??"";s.trim()&&n.set(r.key,s)}return[...n].map(([r,s])=>({key:r,value:s}))}function GA(e,t){return e.find(n=>{var r;return n.required&&!((r=t[n.key])!=null&&r.trim())})}const Pme="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2048%2048'%3e%3cimage%20width='48'%20height='48'%20href='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAMKADAAQAAAABAAAAMAAAAADbN2wMAAAH7UlEQVRoBdVZWWwbVRQ9492Onc1xTfaWLukq9oSqLKnYBZRSNgn6AagsAgmJRfzxg4SEEDtiER8IBKKAChK0FS1tKYWW0lZQKKV0gxCVJm3ikDiO17EdzrUzSdw4jj1OpeQqNzO237vvnHfvu/e9GWVwcBBDYue1mrqE2kI1UqeSJAnmIHUzNUCNUmGiKtQy6oPUR6geqnw/FSVOUH9R36KupfaDHnBQn6MGqEnqVJcEAfZTBbNL4b+lZPI1VbwwnaSfYO8z8N+TVMd0Qj6EVdbs3eIBP29cVFkL00kk+wSEwHAamgh9bDAJSQWTITZFnF+85J1tBPyOUC9OqqnsVdTIRkVBi70Msy125uriHJ8XAXFRfzKBTQM+rO0/hc54cSQE8iyzAx/XLcEltjIU44uCQijOaHvPfxIv97TjWCzEcMo7+sZ4TGa+2V6KT2rPQ73ZptsPBZE30fVrymvxTvUCtDoqYC0ijhMk/3MkgDd62xFheOqVggjIIAbOVaujEh/ULsaNzioUsxhVAv/A34GD0YBubxZMQJupWpMNr58zHytcHth1ekICsDcRx4u+fxBK6vOCbgKyEIXEK975WOmaoZuErKv1QR8ORQd0eUE3Ac0TNSYrXvI24fZSLxwGfebiDKW3e08gln9J0oYvKoMNG6kmiRdmzMOtTi8sOsJJJfANA93oiseGbeZ7k1EHZAKCEcApu4wCxUsSz3rm4HQiim3B/wpOsBJA2yP/4cZIJYIBFcGwCjWeSKEwm4wosZtR7rKizGXJQJZRB1TuttftAprnAbOrM9rl9UHqwg+s1o+eOow/GNN5CaPOklSgdKq4us+Ji7pt6Dw1AF9vBOGImjJht5lRVWFDY7UL58/3wOt2YPEcN2xWVpPRe6EQC+y9rwINPNKsuRaYX5cXhIxGkks+Y7V+6vQRdLBi5yx1bGwicFebivj+ARgOhZGMJMFyQyWpoV2GRIa2ZXOX2bDyqnPxzEPNKC+1Zj957eDBTbz34PXAwvoMfBN+kGV8Bxf00VgQz/vaEB6nSCnRQVj2h2DZG4TyZwQWlSils3m8RDDEhk2uaqlHaYklVb3Ha42dh4B3eMzZ//eEmMc0kGL3cEU9WksqU4XvzAYKZ9n6fQCOz3thORCGkhgCf2bDMz4bjQpW39yE65Y1QO5FxiUgP+76E3hzI7D1VyBcwP5NTFcZzXjaPRMNZmvGPkfA23YMwLHRD0Mf3ZwTgaBIi8GgYMGsSjx2z3kEP9Jp5E5rOeoqQH75C3htPfDpD4CskXxFvHC5vQKPVjSwPqQfcKTAfxuA/Ws/lBAXwEhUTGjWSAL3r1qYykSju+UkIFbZDx09wPvb0iH1W9uEYw03MHAV3ltew1CqgDkyCNtWgt/cnwY/3GriG5n9hbMrccNljRmzLz0nJCCNJBsEwsCH24E3NgDr96brhfyWS2Sm3EYLVsOL0i0DsG8h+LDkqcLExHhfc9siVDDrjJ59sZJRyHKZFRKybiSkTtIjR08CrXwEdtGcXL2A4+192LOuDeatfqg6wMvsL5lbhWuWysIdO995E9BgSkh19THX7wQOtANXLgKWLQSaarUWI9dNP7bjo68OY9uef6GqhcW8ZkViX2a/nBWYQ4+RggmIBfFGnHgOcD0c7wD2HgOW0xuXk0xN5SDaOwL4cnsb1m05joPHejKK0hgEOb4Q8Muba3H1pXUwZZl96aqLgHSU2RCbEe6/9hzh875OYPdhYF5NDLt/Oohd+46gNxBjm2zzJhZyi/RyV5TggdsvRJnTOm5j3QQ0i9ra6OHj1u9+B/YdNcLXVQdDmYNPy9oZ971IcIPHjUHadVrHHFfZNphtTtx508W4eJEHsg7Gk6IJaIZlDEn3EdUEl7sBg4la2MtqkYgNIOz/F9FgF6IhX6p5mozcjgbGasw/xWCCs7IeN7U24b4VddwZj26jjTZynTQCmknxSBqIETanh7ceWEpmpIiokT7E6JFosBvxaD/iJCeNDQYzTFYnzHY3SsobmfM9eOyucjTO0KyOf510AqOHkl2kiMlSQoAlsPLAk4hHSCaIJMMqmUgfYBQeggxGK4xmOxprXHh8lYK51em+E/0/qwQyBh8iY+Q52pjlOZD8XFcFPHELcGlT3stlbBaymtOROTReBoZJ+0DjZ9pv4SFq9fL0YWqcjJl1+AwP8OSGS+amq6y4P/fyyWqvoC9lDAG7ainPEJcBs7xMBGOLbU6bGQTMJHAnDUlG2biPFZevEM4GCZl9sSsnPgG+bAHfa+l8vZJxpNSo+oPp/c4XP6bPBN0kog2qtdFz1WzIkfXmZuAKVm6JewlbvZKVgGZMilMPwW9ngdr5B3CEG7iEbCY5ffl6RgPtYDGdybS4ogW4YDbgLefTD5s2kv5rTgKaWdlKi1fau4BDJ3jM5I70NDd0J7grzfZEUMg5CM5Tmg4TiW3ZtVYxTKpcgM2iWS7+mhcBbRiZ/TBTd4jPjtSEVF3AxxdUPgkxTrUUMTcBykKUmLZwhQlYPhWBeCBV5DRjk3QtiEC2McUDsjPVCEhWEQ8Umk2y2c7nOyEwrV/ySdbdQo3nw3aKtRHM3wiBtVQu02knISJ+SQh8Q32TyqTJJ6xTXyQzyzb2LeoBWQOy5pjwcDf1YSqzNIooLex99kTCppsq4N+l+oUArylhoku9sb+O18VU8c5UEiZu7KGyrKKTmgr7/wGxhy03aZIycwAAAABJRU5ErkJggg=='%20/%3e%3c/svg%3e",Bme=(()=>{const e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let r=0;r<8;r++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function Fme(e){let t=4294967295;for(let n=0;n>>8;return(t^4294967295)>>>0}function on(e,t){e.push(t&255,t>>>8&255)}function Gr(e,t){e.push(t&255,t>>>8&255,t>>>16&255,t>>>24&255)}const qA=2048,ub=20,XA=0;function Ume(e){const t=new TextEncoder,n=[],r=[];let s=0;for(const p of e){const m=t.encode(p.path),y=t.encode(p.content),E=Fme(y),g=y.length,x=[];Gr(x,67324752),on(x,ub),on(x,qA),on(x,XA),on(x,0),on(x,0),Gr(x,E),Gr(x,g),Gr(x,g),on(x,m.length),on(x,0);const b=Uint8Array.from(x);n.push(b,m,y),r.push({nameBytes:m,dataBytes:y,crc:E,size:g,offset:s}),s+=b.length+m.length+y.length}const i=s,a=[];let o=0;for(const p of r){const m=[];Gr(m,33639248),on(m,ub),on(m,ub),on(m,qA),on(m,XA),on(m,0),on(m,0),Gr(m,p.crc),Gr(m,p.size),Gr(m,p.size),on(m,p.nameBytes.length),on(m,0),on(m,0),on(m,0),on(m,0),Gr(m,0),Gr(m,p.offset);const y=Uint8Array.from(m);a.push(y,p.nameBytes),o+=y.length+p.nameBytes.length}const c=[];Gr(c,101010256),on(c,0),on(c,0),on(c,r.length),on(c,r.length),Gr(c,o),Gr(c,i),on(c,0);const u=[...n,...a,Uint8Array.from(c)],d=u.reduce((p,m)=>p+m.length,0),f=new Uint8Array(d);let h=0;for(const p of u)f.set(p,h),h+=p.length;return new Blob([f],{type:"application/zip"})}const $me=w.lazy(()=>oc(()=>import("./CodeEditor-Cr6KNv6h.js"),[]));function Hme(e){const t={name:"",children:new Map};for(const n of e){const r=n.path.split("/").filter(Boolean);let s=t;r.forEach((i,a)=>{let o=s.children.get(i);o||(o={name:i,children:new Map},s.children.set(i,o)),a===r.length-1&&(o.path=n.path),s=o})}return t}function zme(e){return[...e.children.values()].sort((t,n)=>{const r=t.children.size>0&&t.path===void 0,s=n.children.size>0&&n.path===void 0;return r!==s?r?-1:1:t.name.localeCompare(n.name)})}function z6({project:e,open:t,onClose:n,onChange:r}){var m;const[s,i]=w.useState(((m=e.files[0])==null?void 0:m.path)??null),[a,o]=w.useState(new Set),c=w.useRef(null),u=w.useMemo(()=>Hme(e.files),[e.files]),d=e.files.find(y=>y.path===s)??null;if(w.useEffect(()=>{var g;if(!t)return;const y=document.body.style.overflow;document.body.style.overflow="hidden",(g=c.current)==null||g.focus();const E=x=>{x.key==="Escape"&&n()};return window.addEventListener("keydown",E),()=>{document.body.style.overflow=y,window.removeEventListener("keydown",E)}},[n,t]),w.useEffect(()=>{d||e.files.length===0||i(e.files[0].path)},[e.files,d]),!t)return null;function f(y){o(E=>{const g=new Set(E);return g.has(y)?g.delete(y):g.add(y),g})}function h(y,E,g){return zme(y).map(x=>{const b=g?`${g}/${x.name}`:x.name;if(!(x.children.size>0&&x.path===void 0)&&x.path)return l.jsxs("button",{type:"button",className:`code-browser-file${s===x.path?" is-active":""}`,style:{paddingLeft:`${12+E*16}px`},onClick:()=>i(x.path??null),title:x.path,children:[l.jsx(cS,{"aria-hidden":"true"}),l.jsx("span",{children:x.name})]},b);const k=a.has(b);return l.jsxs("div",{children:[l.jsxs("button",{type:"button",className:"code-browser-folder",style:{paddingLeft:`${10+E*16}px`},onClick:()=>f(b),"aria-expanded":!k,children:[l.jsx(ws,{className:k?"":"is-open","aria-hidden":"true"}),l.jsx(SL,{"aria-hidden":"true"}),l.jsx("span",{children:x.name})]}),!k&&h(x,E+1,b)]},b)})}function p(y){d&&r({...e,files:e.files.map(E=>E.path===d.path?{...E,content:y}:E)})}return Ss.createPortal(l.jsx("div",{className:"code-browser-backdrop",onMouseDown:y=>{y.target===y.currentTarget&&n()},children:l.jsxs("section",{className:"code-browser-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"code-browser-title",children:[l.jsxs("header",{className:"code-browser-head",children:[l.jsxs("div",{className:"code-browser-title-wrap",children:[l.jsx("span",{className:"code-browser-title-icon","aria-hidden":"true",children:l.jsx(Tw,{})}),l.jsxs("div",{children:[l.jsx("h2",{id:"code-browser-title",children:"项目代码"}),l.jsx("p",{children:e.name||"Agent 项目"})]})]}),l.jsx("button",{ref:c,type:"button",className:"code-browser-close",onClick:n,"aria-label":"关闭代码浏览器",children:l.jsx(zr,{"aria-hidden":"true"})})]}),l.jsxs("div",{className:"code-browser-workspace",children:[l.jsxs("aside",{className:"code-browser-sidebar","aria-label":"项目文件",children:[l.jsxs("div",{className:"code-browser-sidebar-head",children:["文件 ",l.jsx("span",{children:e.files.length})]}),l.jsx("div",{className:"code-browser-tree",children:e.files.length>0?h(u,0,""):l.jsx("div",{className:"code-browser-empty",children:"暂无项目文件"})})]}),l.jsxs("main",{className:"code-browser-main",children:[l.jsxs("div",{className:"code-browser-path",children:[l.jsx(cS,{"aria-hidden":"true"}),l.jsx("span",{children:(d==null?void 0:d.path)??"未选择文件"})]}),l.jsx("div",{className:"code-browser-editor",children:d?l.jsx(w.Suspense,{fallback:l.jsx("div",{className:"code-browser-empty",children:"正在加载编辑器…"}),children:l.jsx($me,{value:d.content,path:d.path,onChange:p})}):l.jsx("div",{className:"code-browser-empty",children:"从左侧选择文件以查看代码"})})]})]})]})}),document.body)}function Vme({project:e,onChange:t,className:n=""}){const[r,s]=w.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",className:`code-browser-trigger ${n}`.trim(),onClick:()=>s(!0),"aria-label":"查看和编辑项目源码",title:"查看源码",children:[l.jsx(Tw,{"aria-hidden":"true"}),l.jsx("span",{children:"查看源码"})]}),l.jsx(z6,{project:e,open:r,onClose:()=>s(!1),onChange:t})]})}function eg({message:e,className:t="",onRetry:n,retryLabel:r="重试部署"}){const[s,i]=w.useState(!1),[a,o]=w.useState(!1),[c,u]=w.useState(!1),d=async()=>{try{await navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),1500)}catch{o(!1)}},f=async()=>{if(!(!n||c)){u(!0);try{await n()}finally{u(!1)}}};return l.jsxs("div",{className:`deploy-error-message${s?" is-expanded":""}${t?` ${t}`:""}`,children:[l.jsx("p",{className:"deploy-error-message-text",children:e}),l.jsxs("div",{className:"deploy-error-message-actions",children:[n&&l.jsxs("button",{type:"button",className:"deploy-error-retry",disabled:c,onClick:()=>void f(),children:[c?l.jsx(Rt,{className:"spin"}):l.jsx(KH,{}),c?"重试中…":r]}),l.jsx("button",{type:"button",title:s?"收起错误信息":"展开完整错误信息","aria-label":s?"收起错误信息":"展开完整错误信息",onClick:()=>i(h=>!h),children:s?l.jsx(FH,{}):l.jsx(tc,{})}),l.jsx("button",{type:"button",title:a?"已复制":"复制完整错误信息","aria-label":a?"已复制":"复制完整错误信息",onClick:()=>void d(),children:a?l.jsx(Js,{}):l.jsx(Aw,{})})]})]})}Hr.registerLanguage("python",rj);Hr.registerLanguage("typescript",mj);Hr.registerLanguage("javascript",Q3);Hr.registerLanguage("json",Z3);Hr.registerLanguage("yaml",gj);Hr.registerLanguage("markdown",nj);Hr.registerLanguage("bash",K3);Hr.registerLanguage("ini",Y3);Hr.registerLanguage("dockerfile",LQ);Hr.registerLanguage("makefile",tj);const Kme=w.lazy(()=>oc(()=>import("./CodeEditor-Cr6KNv6h.js"),[])),fa=()=>{};function Yme({open:e,isUpdate:t,onCancel:n,onConfirm:r}){const s=w.useRef(null);return w.useEffect(()=>{var o;if(!e)return;const i=document.body.style.overflow;document.body.style.overflow="hidden",(o=s.current)==null||o.focus();const a=c=>{c.key==="Escape"&&n()};return window.addEventListener("keydown",a),()=>{document.body.style.overflow=i,window.removeEventListener("keydown",a)}},[n,e]),e?Ss.createPortal(l.jsx("div",{className:"code-browser-backdrop pp-confirm-backdrop",onMouseDown:i=>{i.target===i.currentTarget&&n()},children:l.jsxs("section",{className:"code-browser-dialog pp-confirm-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"pp-confirm-title","aria-describedby":"pp-confirm-description",children:[l.jsxs("header",{className:"code-browser-head pp-confirm-head",children:[l.jsxs("div",{className:"code-browser-title-wrap",children:[l.jsx("span",{className:"code-browser-title-icon pp-confirm-icon","aria-hidden":"true",children:l.jsx(qH,{})}),l.jsx("h2",{id:"pp-confirm-title",children:t?"确认更新":"确认部署"})]}),l.jsx("button",{type:"button",className:"code-browser-close",onClick:n,"aria-label":"关闭部署确认",children:l.jsx(zr,{"aria-hidden":"true"})})]}),l.jsx("div",{className:"pp-confirm-body",children:l.jsx("p",{id:"pp-confirm-description",children:t?"将更新并发布到当前云端 Runtime,过程可能需要几分钟。确定继续吗?":"将创建新的云端 Runtime,部署过程可能需要几分钟。确定继续吗?"})}),l.jsxs("footer",{className:"pp-confirm-actions",children:[l.jsx("button",{ref:s,type:"button",onClick:n,children:"取消"}),l.jsx("button",{type:"button",className:"is-primary",onClick:r,children:t?"确定更新":"确定部署"})]})]})}),document.body):null}const Wme={py:"python",pyi:"python",ts:"typescript",tsx:"typescript",mts:"typescript",cts:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",json:"json",jsonc:"json",yaml:"yaml",yml:"yaml",md:"markdown",markdown:"markdown",sh:"bash",bash:"bash",zsh:"bash",toml:"ini",ini:"ini",cfg:"ini",conf:"ini",env:"ini",txt:"plaintext"},QA={dockerfile:"dockerfile","requirements.txt":"plaintext","requirements-dev.txt":"plaintext",".env":"ini",".gitignore":"plaintext",makefile:"makefile"};function ZA(e){return e.replace(/&/g,"&").replace(//g,">")}function Gme(e){const n=(e.split("/").pop()??e).toLowerCase();if(QA[n])return QA[n];if(n.startsWith("dockerfile"))return"dockerfile";if(n.startsWith(".env"))return"ini";const r=n.lastIndexOf(".");if(r===-1)return null;const s=n.slice(r+1);return Wme[s]??null}function qme(e,t){try{const n=Gme(t);return n&&Hr.getLanguage(n)?Hr.highlight(e,{language:n,ignoreIllegals:!0}).value:n===null?Hr.highlightAuto(e).value:ZA(e)}catch{return ZA(e)}}const Xme=[{phase:"build",label:"构建镜像"},{phase:"deploy",label:"部署"},{phase:"publish",label:"发布"}],Qme=[{phase:"upload",label:"上传代码包"},{phase:"build",label:"镜像打包"},{phase:"deploy",label:"创建 Runtime"},{phase:"publish",label:"发布服务"}];function Zme(e){const t={name:"",children:new Map};for(const n of e){const r=n.path.split("/").filter(Boolean);let s=t;r.forEach((i,a)=>{let o=s.children.get(i);o||(o={name:i,children:new Map},s.children.set(i,o)),a===r.length-1&&(o.path=n.path),s=o})}return t}function Jme(e){return[...e.children.values()].sort((t,n)=>{const r=t.children.size>0&&t.path===void 0,s=n.children.size>0&&n.path===void 0;return r!==s?r?-1:1:t.name.localeCompare(n.name)})}function ege(e="",t=""){return{id:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,key:e,value:t}}function tge({left:e,right:t}){const[n,r]=w.useState(null);return w.useLayoutEffect(()=>{const s=document.getElementById("veadk-page-header-left"),i=document.getElementById("veadk-page-header-actions");s&&i&&r({left:s,right:i})},[]),n?l.jsxs(l.Fragment,{children:[Ss.createPortal(e,n.left),Ss.createPortal(t,n.right)]}):l.jsxs("header",{className:"pp-toolbar",children:[e,t]})}function y0({project:e,embedded:t=!1,deployDisabledReason:n,agentDraft:r,agentName:s,agentCount:i,releaseConfiguration:a,onChange:o,onDeploy:c,onAgentAdded:u,onDeploymentComplete:d,deploymentActionLabel:f="部署",deploymentRuntimeId:h,onDeploymentStarted:p,onDeploymentTaskChange:m,feishuEnabled:y=!1,onFeishuEnabledChange:E,deploymentEnv:g=[],deploymentEnvValues:x={},onDeploymentEnvChange:b,network:_,onNetworkChange:k,deployRegion:N="cn-beijing",onDeployRegionChange:C,onBack:S,backLabel:A="返回配置",onExportYaml:O,deploymentPrimaryPane:D,deployDisabled:U=!1}){var ot,It,st;const X=typeof o=="function",M=f.includes("更新"),j=D?Qme:Xme,[T,L]=w.useState(((It=(ot=e==null?void 0:e.files)==null?void 0:ot[0])==null?void 0:It.path)??null),[R,F]=w.useState(new Set),[I,V]=w.useState(!1),[W,P]=w.useState(""),[ie,G]=w.useState(!1),[re,ue]=w.useState(!1),[ee,le]=w.useState(!1),[ne,me]=w.useState(!1),[ye,te]=w.useState(null),[de,Ee]=w.useState(null),[Te,Ke]=w.useState({}),[Ne,it]=w.useState(null),[He,Ue]=w.useState(!1),[Et,rt]=w.useState([]),[St,ct]=w.useState(!1),[B,Q]=w.useState(!1),oe=w.useRef(!0),be=Z=>l.jsxs("div",{className:"pp-network-region",onKeyDown:we=>{we.key==="Escape"&&Q(!1)},children:[Z&&l.jsx("span",{children:"发布区域"}),l.jsxs("button",{type:"button",className:"pp-region-trigger","aria-label":"部署区域","aria-haspopup":"listbox","aria-expanded":B,disabled:ie||M||!C,onClick:()=>Q(we=>!we),children:[l.jsx("span",{children:N==="cn-shanghai"?"华东 2(上海)":"华北 2(北京)"}),l.jsx(Sw,{className:`pp-region-chevron${B?" is-open":""}`})]}),B&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"menu-scrim",onClick:()=>Q(!1)}),l.jsx("div",{className:"pp-region-menu",role:"listbox","aria-label":"部署区域",children:[{value:"cn-beijing",label:"华北 2(北京)"},{value:"cn-shanghai",label:"华东 2(上海)"}].map(we=>{const _e=we.value===N;return l.jsxs("button",{type:"button",role:"option","aria-selected":_e,className:`pp-region-option${_e?" is-selected":""}`,onClick:()=>{C==null||C(we.value),Q(!1)},children:[l.jsx("span",{children:we.label}),_e&&l.jsx(Js,{"aria-hidden":"true"})]},we.value)})})]})]});w.useEffect(()=>(oe.current=!0,()=>{oe.current=!1}),[]),w.useEffect(()=>{if(!ee)return;const Z=document.body.style.overflow;document.body.style.overflow="hidden";const we=_e=>{_e.key==="Escape"&&le(!1)};return window.addEventListener("keydown",we),()=>{document.body.style.overflow=Z,window.removeEventListener("keydown",we)}},[ee]);const Oe=w.useMemo(()=>!(e!=null&&e.files)||!Array.isArray(e.files)?{name:"",children:new Map}:Zme(e.files),[e==null?void 0:e.files]);if(!e||!Array.isArray(e.files))return l.jsx("div",{className:"pp-error",children:"项目数据无效"});const Ye=e.files.find(Z=>Z.path===T)??null,tt=(_==null?void 0:_.mode)??"public",ze=Dme(y?[...g,...bu]:g,x),Tt=ze.length+Et.length;function Re(Z){F(we=>{const _e=new Set(we);return _e.has(Z)?_e.delete(Z):_e.add(Z),_e})}function kt(Z,we){o&&(o({...e,files:Z}),we!==void 0&&L(we))}function Pt(Z){Ye&&kt(e.files.map(we=>we.path===Ye.path?{...we,content:Z}:we))}function Bt(){const Z=W.trim();if(V(!1),P(""),!!Z){if(e.files.some(we=>we.path===Z)){L(Z);return}kt([...e.files,{path:Z,content:""}],Z)}}function bn(){if(!Ye)return;const Z=window.prompt("重命名文件",Ye.path),we=Z==null?void 0:Z.trim();!we||we===Ye.path||e.files.some(_e=>_e.path===we)||kt(e.files.map(_e=>_e.path===Ye.path?{..._e,path:we}:_e),we)}function Xe(){var we;if(!Ye)return;const Z=e.files.filter(_e=>_e.path!==Ye.path);kt(Z,((we=Z[0])==null?void 0:we.path)??null)}function ft(Z,we){rt(_e=>_e.map(We=>We.id===Z?{...We,...we}:We))}function xt(Z){rt(we=>we.filter(_e=>_e.id!==Z))}function vt(){rt(Z=>[...Z,ege()])}function fe(Z){k&&k(Z==="public"?void 0:{..._??{mode:Z},mode:Z})}function $e(Z){k==null||k({..._??{mode:"private"},...Z})}function nt(){const Z=new Map(Et.map(_e=>({key:_e.key.trim(),value:_e.value})).filter(_e=>_e.key.length>0).map(_e=>[_e.key,_e.value])),we=y?[...g,...bu]:g;for(const _e of H6(we,x))Z.set(_e.key,_e.value);return[...Z].map(([_e,We])=>({key:_e,value:We}))}async function qt(){if(!(!E||ie||ne)){te(null),me(!0);try{await E(!y)}catch(Z){oe.current&&te(`更新飞书配置失败:${Z instanceof Error?Z.message:String(Z)}`)}finally{oe.current&&me(!1)}}}async function fn(){var we;if(!c||ie||U)return;if(tt!=="public"&&!((we=_==null?void 0:_.vpcId)!=null&&we.trim())){te("使用 VPC 网络时,请填写 VPC ID。");return}const Z=GA(g,x);if(Z){const _e=g.find(We=>We.key===Z.key);te(`请返回配置页填写 ${(_e==null?void 0:_e.comment)||(_e==null?void 0:_e.key)}(${_e==null?void 0:_e.key})。`);return}if(y){const _e=GA(bu,x);if(_e){const We=bu.find(Ve=>Ve.key===_e.key);te(`启用飞书后,请填写${(We==null?void 0:We.comment)||(We==null?void 0:We.key)}。`);return}}ue(!0)}async function Lt(){if(!c||ie)return;ue(!1);const Z=nt();oe.current&&(te(null),Ee(null),Ke({}),it(null),G(!0));const we=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;let _e=(s==null?void 0:s.trim())||e.name||"生成中…";const We=Date.now(),Ve={id:we,runtimeName:_e,runtimeId:h,region:N,startedAt:We,status:"running",phase:"prepare",label:"准备部署",agentDraft:r};m==null||m(Ve),p==null||p(Ve);try{const Je=await c(e,ut=>{var Vt;ut.runtimeName&&(_e=ut.runtimeName),oe.current&&(Ke(Ft=>({...Ft,[ut.phase]:ut})),it(ut.phase)),m==null||m({id:we,runtimeName:_e,runtimeId:h,region:N,startedAt:We,status:"running",phase:ut.phase,label:((Vt=j.find(Ft=>Ft.phase===ut.phase))==null?void 0:Vt.label)??ut.phase,message:ut.message,pct:ut.pct})},y?{taskId:we,im:{feishu:{enabled:!0}},envs:Z}:{taskId:we,envs:Z});oe.current&&(Ee(Je),it(null)),await(d==null?void 0:d(Je)),m==null||m({id:we,runtimeName:Je.agentName||_e,runtimeId:Je.runtimeId||h,region:Je.region||N,startedAt:We,status:"success",phase:"complete",label:"部署完成"})}catch(Je){const ut=Je instanceof Error?Je.message:String(Je);if(Je instanceof DOMException&&Je.name==="AbortError"){oe.current&&(te(null),it(null)),m==null||m({id:we,runtimeName:_e,runtimeId:h,region:N,startedAt:We,status:"cancelled",label:"已取消",message:"部署已取消,相关 Runtime 资源已请求销毁。"});return}oe.current&&te(ut),m==null||m({id:we,runtimeName:_e,runtimeId:h,region:N,startedAt:We,status:"error",label:"部署失败",message:ut,retry:fn})}finally{oe.current&&G(!1)}}function J(){ue(!1)}async function he(){if(!(!de||He)){Ue(!0),te(null);try{const{addConnection:Z,addRuntimeConnection:we,remoteAppId:_e,loadConnections:We}=await oc(async()=>{const{addConnection:ut,addRuntimeConnection:Vt,remoteAppId:Ft,loadConnections:hn}=await Promise.resolve().then(()=>vS);return{addConnection:ut,addRuntimeConnection:Vt,remoteAppId:Ft,loadConnections:hn}},void 0),{probeRuntimeApps:Ve}=await oc(async()=>{const{probeRuntimeApps:ut}=await Promise.resolve().then(()=>wz);return{probeRuntimeApps:ut}},void 0);let Je;if(de.runtimeId){const ut=de.region??"cn-beijing",Vt=await Ve(de.runtimeId,ut)??[];Je=we(de.runtimeId,de.agentName,ut,Vt,Vt.length>0?{[Vt[0]]:de.agentName}:void 0,de.version)}else Je=await Z(de.agentName,de.url,de.apikey,"");if(Je.apps.length===0)te("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。");else{const ut={[Je.apps[0]]:de.agentName},Vt={...Je,appLabels:{...Je.appLabels??{},...ut}},hn=We().map(Kt=>Kt.id===Je.id?Vt:Kt);localStorage.setItem("veadk_agentkit_connections",JSON.stringify(hn));const{registerConnections:Tn}=await oc(async()=>{const{registerConnections:Kt}=await Promise.resolve().then(()=>vS);return{registerConnections:Kt}},void 0);if(Tn(hn),u){const Kt=_e(Je.id,Je.apps[0]);u(Kt,de.agentName)}else alert(`🎉 Agent "${de.agentName}" 已添加到左上角下拉列表!`)}}catch(Z){te(`添加 Agent 失败:${Z instanceof Error?Z.message:String(Z)}`)}finally{Ue(!1)}}}function Le(){const Z=Ume(e.files),we=URL.createObjectURL(Z),_e=document.createElement("a");_e.href=we,_e.download=`${e.name||"project"}.zip`,document.body.appendChild(_e),_e.click(),document.body.removeChild(_e),URL.revokeObjectURL(we)}function Be(Z,we,_e){return Jme(Z).map(We=>{const Ve=_e?`${_e}/${We.name}`:We.name,Je=We.path!==void 0,ut={paddingLeft:8+we*14};if(Je){const Ft=We.path===T;return l.jsxs("button",{type:"button",className:`pp-row pp-file${Ft?" pp-active":""}`,style:ut,onClick:()=>L(We.path),title:We.path,children:[l.jsx(NH,{className:"pp-ic"}),l.jsx("span",{className:"pp-label",children:We.name})]},Ve)}const Vt=R.has(Ve);return l.jsxs("div",{children:[l.jsxs("button",{type:"button",className:"pp-row pp-folder",style:ut,onClick:()=>Re(Ve),children:[l.jsx(ws,{className:`pp-ic pp-chevron${Vt?"":" pp-open"}`}),l.jsx(SL,{className:"pp-ic"}),l.jsx("span",{className:"pp-label",children:We.name})]}),!Vt&&Be(We,we+1,Ve)]},Ve)})}return l.jsxs("div",{className:`pp-root${c?" is-deploy":""}${t?" is-embedded":""}${D?" has-primary-pane":""}`,children:[c&&!t&&l.jsx(tge,{left:l.jsxs("div",{className:"pp-toolbar-left",children:[S&&l.jsxs("button",{type:"button",className:"pp-toolbar-back",onClick:S,children:[l.jsx(yL,{className:"pp-ic"}),A]}),l.jsxs("span",{className:"pp-toolbar-title",children:["部署 ",s||e.name||"未命名 Agent",i&&i>1?` 等 ${i} 个智能体`:""]})]}),right:null}),l.jsxs("div",{className:"pp-body",children:[c&&!D&&l.jsx("section",{className:"pp-release-overview","aria-label":"发布概览",children:l.jsxs("div",{className:"pp-release-preview",children:[l.jsxs("div",{className:"pp-flow-thumbnail",children:[r&&l.jsx(Xm,{draft:r,direction:"horizontal",selectedPath:[],onSelect:fa,onAdd:fa,onInsert:fa,onDelete:fa,readOnly:!0,interactivePreview:!0}),l.jsx("button",{type:"button",className:"pp-flow-expand",onClick:()=>le(!0),"aria-label":"放大查看执行流程",title:"放大查看",children:l.jsx(tc,{"aria-hidden":!0})})]}),l.jsxs("div",{className:"pp-release-info",children:[l.jsxs("div",{className:"pp-release-info-main",children:[l.jsx("h2",{children:s||e.name||"未命名 Agent"}),(r==null?void 0:r.description)&&l.jsx("p",{className:"pp-release-description",title:r.description,children:r.description}),l.jsxs("dl",{className:"pp-release-facts",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"Agent 数量"}),l.jsx("dd",{children:i??1})]}),a&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{children:[l.jsx("dt",{children:"模型"}),l.jsx("dd",{children:a.modelName})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"描述"}),l.jsx("dd",{className:"pp-release-fact-long",children:a.description})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"系统提示词"}),l.jsx("dd",{className:"pp-release-fact-long pp-release-prompt",children:a.instruction})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"优化选项"}),l.jsx("dd",{children:a.optimizations.length>0?a.optimizations.join("、"):"未启用"})]})]})]})]}),l.jsxs("div",{className:"pp-artifact-actions",children:[O&&l.jsxs("button",{type:"button",className:"pp-secondary",onClick:O,children:[l.jsx(vH,{className:"pp-ic"}),"导出配置文件"]}),X&&o&&l.jsx(Vme,{project:e,onChange:o,className:"pp-artifact-source"}),e.files.length>0&&l.jsxs("button",{type:"button",className:"pp-secondary",onClick:Le,children:[l.jsx(Cw,{className:"pp-ic"}),"导出源码"]})]})]})]})}),l.jsxs("div",{className:"pp-files-area",children:[l.jsxs("div",{className:"pp-sidebar",children:[l.jsxs("div",{className:"pp-sidebar-head",children:[l.jsx("span",{className:"pp-project-name",title:e.name,children:"文件预览"}),X&&l.jsx("button",{type:"button",className:"pp-icon-btn",title:"新建文件",onClick:()=>{V(!0),P("")},children:l.jsx(_H,{className:"pp-ic"})})]}),l.jsxs("div",{className:"pp-tree",children:[I&&l.jsx("input",{className:"pp-new-input",autoFocus:!0,placeholder:"path/to/file.py",value:W,onChange:Z=>P(Z.target.value),onBlur:Bt,onKeyDown:Z=>{Z.key==="Enter"&&Bt(),Z.key==="Escape"&&(V(!1),P(""))}}),e.files.length===0&&!I?l.jsx("div",{className:"pp-empty",children:"暂无文件"}):Be(Oe,0,"")]})]}),l.jsxs("div",{className:"pp-main",children:[l.jsxs("div",{className:"pp-main-head",children:[l.jsx("span",{className:"pp-path",title:Ye==null?void 0:Ye.path,children:(Ye==null?void 0:Ye.path)??"未选择文件"}),l.jsx("div",{className:"pp-actions",children:X&&Ye&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"pp-icon-btn",title:"重命名",onClick:bn,children:l.jsx(HH,{className:"pp-ic"})}),l.jsx("button",{type:"button",className:"pp-icon-btn pp-danger",title:"删除",onClick:Xe,children:l.jsx(ea,{className:"pp-ic"})})]})})]}),l.jsx("div",{className:"pp-content",children:Ye==null?l.jsx("div",{className:"pp-placeholder",children:"选择左侧文件以查看内容"}):X?l.jsx("div",{className:"pp-codemirror",children:l.jsx(w.Suspense,{fallback:l.jsx("div",{className:"pp-editor-loading",children:"加载编辑器…"}),children:l.jsx(Kme,{value:Ye.content,path:Ye.path,onChange:Pt})})}):l.jsx("pre",{className:"pp-pre hljs",dangerouslySetInnerHTML:{__html:qme(Ye.content,Ye.path)}})})]})]}),c&&l.jsxs("aside",{className:"pp-config","aria-label":"部署配置",children:[l.jsx("div",{className:"pp-config-head",children:l.jsx("div",{className:"pp-config-title",children:"部署配置"})}),l.jsxs("div",{className:"pp-config-scroll",children:[D,!D&&l.jsxs("section",{className:"pp-config-section",children:[l.jsx("div",{className:"pp-config-label",children:"发布区域"}),be(!1)]}),!D&&l.jsxs("section",{className:"pp-config-section",children:[l.jsx("div",{className:"pp-config-label",children:"消息渠道"}),l.jsx("div",{className:`pp-channel-card${y?" is-flipped":""}`,children:l.jsxs("div",{className:"pp-channel-card-inner",children:[l.jsxs("button",{type:"button",className:"pp-channel-card-face pp-channel-card-front","aria-pressed":y,"aria-hidden":y,tabIndex:y?-1:0,onClick:()=>void qt(),disabled:y||ie||ne||!E,children:[l.jsx("span",{className:"pp-channel-logo",children:l.jsx("img",{src:Pme,alt:""})}),l.jsxs("span",{className:"pp-channel-card-copy",children:[l.jsx("strong",{children:"飞书"}),l.jsx("small",{children:ne?"正在启用并更新配置…":"接收消息并通过飞书机器人回复"})]})]}),l.jsxs("div",{className:"pp-channel-card-face pp-channel-card-back","aria-hidden":!y,children:[l.jsxs("div",{className:"pp-channel-card-head",children:[l.jsx("strong",{children:"飞书配置"}),l.jsx("button",{type:"button",className:"pp-channel-remove",tabIndex:y?0:-1,onClick:()=>void qt(),disabled:!y||ie||ne||!E,children:ne?"取消中…":"取消"})]}),l.jsx("div",{className:"pp-channel-fields",children:bu.map(Z=>l.jsxs("label",{children:[l.jsxs("span",{children:[Z.comment||Z.key,Z.required&&l.jsx("small",{children:"必填"})]}),l.jsx("input",{type:Z.key.includes("SECRET")?"password":"text",value:x[Z.key]??"",placeholder:Z.placeholder,tabIndex:y?0:-1,disabled:!y||ie||!b,autoComplete:"off",onChange:we=>b==null?void 0:b(Z.key,we.currentTarget.value)})]},Z.key))})]})]})})]}),l.jsxs("section",{className:"pp-config-section",children:[l.jsx("div",{className:"pp-config-label",children:"网络"}),D&&be(!0),M&&l.jsx("p",{className:"pp-config-note",children:"现有 Runtime 的区域与网络模式保持不变。"}),l.jsxs("div",{className:"pp-network-layout",children:[l.jsx("div",{className:"pp-network-modes",role:"radiogroup","aria-label":"网络模式",children:["public","private","both"].map(Z=>l.jsxs("label",{className:"pp-network-option",children:[l.jsx("input",{type:"radio",name:"deployment-network-mode",value:Z,checked:tt===Z,onChange:()=>fe(Z),disabled:ie||M||!k}),l.jsx("span",{children:Z==="public"?"公网":Z==="private"?"VPC":"公网 + VPC"})]},Z))}),tt!=="public"&&l.jsxs("div",{className:"pp-network-fields",children:[l.jsxs("label",{children:[l.jsx("span",{children:"VPC ID"}),l.jsx("input",{value:(_==null?void 0:_.vpcId)??"",placeholder:"vpc-xxxxxxxx",disabled:ie||M,onChange:Z=>$e({vpcId:Z.target.value})})]}),l.jsxs("label",{children:[l.jsxs("span",{children:["子网 ID ",l.jsx("small",{children:"可选,多个用逗号分隔"})]}),l.jsx("input",{value:(_==null?void 0:_.subnetIds)??"",placeholder:"subnet-xxx, subnet-yyy",disabled:ie||M,onChange:Z=>$e({subnetIds:Z.target.value})})]}),l.jsxs("label",{className:"pp-network-check",children:[l.jsx("input",{type:"checkbox",checked:!!(_!=null&&_.enableSharedInternetAccess),disabled:ie||M,onChange:Z=>$e({enableSharedInternetAccess:Z.target.checked})}),"VPC 内共享公网出口"]})]})]})]}),l.jsxs("section",{className:"pp-config-section pp-env-section",children:[l.jsxs("div",{className:"pp-env-head",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"pp-config-label",children:["环境变量",l.jsxs("span",{className:"pp-agent-child-count pp-env-count",children:[Tt," 项"]})]}),l.jsx("div",{className:"pp-env-sub",children:"组件配置会自动同步到这里,部署前可核对最终值。"})]}),l.jsx("button",{type:"button",className:"pp-icon-btn",title:St?"隐藏值":"显示值",onClick:()=>ct(Z=>!Z),children:St?l.jsx(xH,{className:"pp-ic"}):l.jsx(_L,{className:"pp-ic"})})]}),l.jsxs("button",{type:"button",className:"pp-env-add",onClick:vt,disabled:ie,children:[l.jsx(rr,{className:"pp-ic"}),"添加变量"]}),(ze.length>0||Et.length>0)&&l.jsxs("div",{className:"pp-env-table",children:[ze.length>0&&l.jsxs("div",{className:"pp-env-group",children:[l.jsxs("div",{className:"pp-env-group-head",children:[l.jsx("span",{children:"组件自动生成"}),l.jsxs("small",{children:[ze.length," 项"]})]}),ze.map(Z=>{const we=Z.key.startsWith("ENABLE_");return l.jsxs("div",{className:"pp-env-row pp-env-row-derived",children:[l.jsx("input",{className:"pp-env-key-fixed",value:Z.key,readOnly:!0,disabled:ie,"aria-label":`${Z.key} 环境变量名`}),l.jsx("input",{type:we||St?"text":"password",value:Z.value,placeholder:Z.required?"必填,尚未填写":"可选,尚未填写",readOnly:we,disabled:ie||!we&&!b,autoComplete:"off","aria-label":`${Z.key} 环境变量值`,onChange:_e=>b==null?void 0:b(Z.key,_e.currentTarget.value)}),l.jsx("span",{className:"pp-env-source",children:we?"自动":"同步"})]},Z.key)})]}),Et.length>0&&l.jsxs("div",{className:"pp-env-group-head pp-env-group-head-custom",children:[l.jsx("span",{children:"自定义变量"}),l.jsxs("small",{children:[Et.length," 项"]})]}),Et.map(Z=>l.jsxs("div",{className:"pp-env-row",children:[l.jsx("input",{value:Z.key,placeholder:"名称",disabled:ie,autoComplete:"off",onChange:we=>ft(Z.id,{key:we.currentTarget.value})}),l.jsx("input",{type:St?"text":"password",value:Z.value,placeholder:"值",disabled:ie,autoComplete:"off",onChange:we=>ft(Z.id,{value:we.currentTarget.value})}),l.jsx("button",{type:"button",className:"pp-icon-btn pp-env-remove",title:"删除变量",disabled:ie,onClick:()=>xt(Z.id),children:l.jsx(zr,{className:"pp-ic"})})]},Z.id))]})]}),(ie||de||Object.keys(Te).length>0)&&l.jsxs("section",{className:"pp-config-section pp-progress-section",children:[l.jsx("div",{className:"pp-config-label",children:"部署进度"}),l.jsx("ol",{className:"pp-steps",children:j.map((Z,we)=>{const _e=Ne?j.findIndex(ut=>ut.phase===Ne):-1,We=!!ye&&(_e===-1?we===0:we===_e);let Ve;de?Ve="done":We?Ve="failed":_e===-1?Ve=ie?"active":"pending":we<_e?Ve="done":we===_e?Ve=ye?"failed":"active":Ve="pending";const Je=Te[Z.phase];return l.jsxs("li",{className:`pp-step is-${Ve}`,children:[l.jsx("span",{className:"pp-step-dot",children:Ve==="active"?l.jsx(Rt,{className:"pp-ic spin"}):Ve==="done"?"✓":Ve==="failed"?"✕":we+1}),l.jsxs("span",{className:"pp-step-body",children:[l.jsx("span",{className:"pp-step-label",children:Z.label}),Ve==="active"&&(Je==null?void 0:Je.message)&&l.jsxs("span",{className:"pp-step-msg",children:[Je.message,typeof Je.pct=="number"?` (${Je.pct}%)`:""]})]})]},Z.phase)})})]}),ye&&l.jsx(eg,{className:"pp-error",message:`${Ne?`${M?"更新":"部署"}失败(${((st=j.find(Z=>Z.phase===Ne))==null?void 0:st.label)??Ne}阶段):`:""}${ye}`,onRetry:fn,retryLabel:M?"重试更新":"重试部署"}),de&&l.jsxs("section",{className:"pp-deploy-result",children:[l.jsx("div",{className:"pp-deploy-result-header",children:M?"更新成功":"部署成功"}),l.jsxs("div",{className:"pp-deploy-result-body",children:[de.region&&l.jsxs("div",{className:"pp-deploy-result-field",children:[l.jsx("label",{children:"区域"}),l.jsx("code",{children:de.region==="cn-shanghai"?"上海 (cn-shanghai)":"北京 (cn-beijing)"})]}),l.jsxs("div",{className:"pp-deploy-result-field",children:[l.jsx("label",{children:"Agent 名称"}),l.jsx("code",{children:de.agentName})]}),l.jsxs("div",{className:"pp-deploy-result-field",children:[l.jsx("label",{children:"API 端点"}),l.jsx("code",{className:"pp-deploy-result-url",children:de.url})]})]}),l.jsxs("div",{className:"pp-deploy-result-actions",children:[l.jsxs("button",{type:"button",className:"pp-deploy-result-btn",onClick:he,disabled:He,children:[He?l.jsx(Rt,{className:"pp-ic spin"}):l.jsx(IL,{className:"pp-ic"}),He?"连接中…":"立即对话"]}),de.consoleUrl&&l.jsxs("a",{href:de.consoleUrl,target:"_blank",rel:"noopener noreferrer",className:"pp-console-link pp-console-link-btn",children:[l.jsx(Iw,{className:"pp-ic"}),"控制台"]})]})]})]}),l.jsx("div",{className:"pp-config-actions",children:l.jsx("button",{type:"button",className:"pp-deploy studio-update-action",onClick:fn,disabled:ie||ne||U||!!n,title:n,children:ie?`${f}中…`:ye?`重试${f}`:f})})]})]}),ee&&r&&Ss.createPortal(l.jsx("div",{className:"pp-flow-backdrop",onMouseDown:Z=>{Z.target===Z.currentTarget&&le(!1)},children:l.jsxs("section",{className:"pp-flow-dialog",role:"dialog","aria-modal":"true","aria-label":"执行流程预览",children:[l.jsxs("header",{children:[l.jsxs("div",{children:[l.jsx("strong",{children:"执行流程"}),l.jsx("span",{children:"只读预览,可缩放与拖动画布"})]}),l.jsx("button",{type:"button",onClick:()=>le(!1),"aria-label":"关闭执行流程预览",children:l.jsx(zr,{"aria-hidden":!0})})]}),l.jsx("div",{className:"pp-flow-dialog-canvas",children:l.jsx(Xm,{draft:r,direction:"horizontal",selectedPath:[],onSelect:fa,onAdd:fa,onInsert:fa,onDelete:fa,readOnly:!0,interactivePreview:!0})})]})}),document.body),l.jsx(Yme,{open:re,isUpdate:M,onCancel:J,onConfirm:()=>void Lt()})]})}const JA="dogfooding",db="dogfooding",fb="dogfooding_b";let nge=0;const hb=()=>++nge;function eC(e){return e.blocks.filter(t=>t.kind==="text").map(t=>t.text).join("")}function rge(e){const t=e.trim(),n=t.match(/^```(?:json)?\s*\n?([\s\S]*?)\n?```$/i);return(n?n[1]:t).trim()}async function tC(e){const t=[],n=rge(e);t.push(n);const r=n.indexOf("{"),s=n.lastIndexOf("}");r>=0&&s>r&&t.push(n.slice(r,s+1));for(const i of t)try{const a=JSON.parse(i);if(a&&typeof a=="object"&&(typeof a.name=="string"||typeof a.instruction=="string"))return await $w(F6(a))}catch{}return null}function sge({userId:e,onBack:t,onCreate:n,onAgentAdded:r,onDeploymentTaskChange:s}){const[i,a]=w.useState([{id:hb(),role:"assistant",text:"你好,我是 VeADK 的智能构建助手。用自然语言描述你想要的 Agent,我会直接帮你生成一个可运行的 VeADK 项目,并在右侧实时预览。"}]),[o,c]=w.useState(""),[u,d]=w.useState(!1),[f,h]=w.useState(null),[p,m]=w.useState(null),[y,E]=w.useState(!1),[g,x]=w.useState(null),[b,_]=w.useState(null),[k,N]=w.useState(!1),[C,S]=w.useState(!1),[A,O]=w.useState({}),D=w.useRef(null),U=w.useRef(null),X=w.useRef(null),M=w.useRef(null),j=w.useRef(null);w.useEffect(()=>{const G=M.current;G&&G.scrollTo({top:G.scrollHeight,behavior:"smooth"})},[i,u]),w.useEffect(()=>{const G=j.current;G&&(G.style.height="auto",G.style.height=Math.min(G.scrollHeight,160)+"px")},[o]);const T=G=>a(re=>[...re,{id:hb(),role:"assistant",text:G}]);async function L(){if(D.current)return D.current;const G=await vm(JA,e);return D.current=G,G}async function R(G,re){if(re.current)return re.current;const ue=await vm(G,e);return re.current=ue,ue}async function F(G,re){if(!A[G])try{const ue=await Fw(re);O(ee=>({...ee,[G]:ue.model||re}))}catch{O(ue=>({...ue,[G]:re}))}}async function I(G,re,ue){const ee=await R(G,re);let le=zs();for await(const me of Yd({appName:G,userId:e,sessionId:ee,text:ue}))le=Ec(le,me);const ne=eC(le).trim();return{project:await tC(ne),finalText:ne}}const V=async(G,re,ue)=>Rg(G.name,G.files,{region:"cn-beijing",projectName:"default"},{...ue,onStage:re}),W=async()=>{const G=o.trim();if(!(!G||u)){if(a(re=>[...re,{id:hb(),role:"user",text:G}]),c(""),h(null),d(!0),y){x(null),_(null),N(!0),S(!0),F("a",db),F("b",fb);const re=I(db,U,G).then(({project:ee})=>(x(ee),ee)).catch(ee=>{const le=ee instanceof Error?ee.message:String(ee);return h(le),null}).finally(()=>N(!1)),ue=I(fb,X,G).then(({project:ee})=>(_(ee),ee)).catch(ee=>{const le=ee instanceof Error?ee.message:String(ee);return h(le),null}).finally(()=>S(!1));try{const[ee,le]=await Promise.all([re,ue]),ne=[ee?`方案 A:${ee.name}`:null,le?`方案 B:${le.name}`:null].filter(Boolean);ne.length?T(`已生成两个方案(${ne.join(",")}),请在右侧对比后采用其一。`):T("(两个方案都没有返回可用的项目,请再描述一下你的需求。)")}finally{d(!1)}return}try{const re=await L();let ue=zs();for await(const ne of Yd({appName:JA,userId:e,sessionId:re,text:G}))ue=Ec(ue,ne);const ee=eC(ue).trim(),le=await tC(ee);le?(m(le),T(`已生成项目:${le.name}(${le.files.length} 个文件),可在右侧预览和编辑。`)):T(ee||"(助手没有返回内容,请再描述一下你的需求。)")}catch(re){const ue=re instanceof Error?re.message:String(re);h(ue),T(`抱歉,调用智能构建助手失败:${ue}`)}finally{d(!1)}}},P=G=>{const re=G==="a"?g:b;if(!re)return;m(re),E(!1),x(null),_(null),N(!1),S(!1);const ue=G==="a"?"A":"B",ee=G==="a"?A.a:A.b;T(`已采用方案 ${ue}(${ee??(G==="a"?db:fb)}),可继续编辑。`)},ie=G=>{G.key==="Enter"&&!G.shiftKey&&!G.nativeEvent.isComposing&&(G.preventDefault(),W())};return l.jsx("div",{className:"ic-root",children:l.jsxs("div",{className:"ic-body",children:[l.jsxs("div",{className:"ic-chat",children:[l.jsxs("div",{className:"ic-transcript",ref:M,children:[l.jsx(pi,{initial:!1,children:i.map(G=>l.jsxs($t.div,{className:`ic-turn ic-turn--${G.role}`,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.22,ease:"easeOut"},children:[G.role==="assistant"&&l.jsx("div",{className:"ic-avatar",children:l.jsx(Do,{className:"ic-avatar-icon"})}),l.jsx("div",{className:"ic-bubble",children:G.role==="assistant"?l.jsx(Mf,{text:G.text}):G.text})]},G.id))}),u&&l.jsxs($t.div,{className:"ic-turn ic-turn--assistant",initial:{opacity:0,y:8},animate:{opacity:1,y:0},children:[l.jsx("div",{className:"ic-avatar",children:l.jsx(Do,{className:"ic-avatar-icon"})}),l.jsxs("div",{className:"ic-bubble ic-bubble--typing",children:[l.jsx("span",{className:"ic-dot"}),l.jsx("span",{className:"ic-dot"}),l.jsx("span",{className:"ic-dot"})]})]})]}),f&&l.jsxs("div",{className:"ic-error",children:[l.jsx(Ag,{className:"ic-error-icon"}),f]}),l.jsxs("div",{className:"ic-composer",children:[l.jsxs("div",{className:"ic-composer-box",children:[l.jsx("textarea",{ref:j,className:"ic-input",rows:1,placeholder:"描述你想要的 Agent,例如「一个帮我整理周报的写作助手」…",value:o,onChange:G=>c(G.target.value),onKeyDown:ie,disabled:u}),l.jsx("button",{className:"ic-send",onClick:()=>void W(),disabled:!o.trim()||u,title:"发送 (Enter)",children:l.jsx(YH,{className:"ic-send-icon"})})]}),l.jsxs("div",{className:"ic-composer-foot",children:[l.jsxs("label",{className:"ic-ab-toggle",title:"同时用两个模型生成方案进行对比",children:[l.jsx("input",{type:"checkbox",className:"ic-ab-checkbox",checked:y,disabled:u,onChange:G=>E(G.target.checked)}),l.jsx("span",{className:"ic-ab-track",children:l.jsx("span",{className:"ic-ab-thumb"})}),l.jsx("span",{className:"ic-ab-label",children:"A/B 对比"})]}),l.jsx("div",{className:"ic-composer-hint",children:"Enter 发送 · Shift+Enter 换行"})]})]})]}),l.jsx("aside",{className:"ic-preview",children:y?l.jsxs("div",{className:"ic-compare",children:[l.jsx(nC,{side:"a",project:g,loading:k,model:A.a,onAdopt:()=>P("a")}),l.jsx("div",{className:"ic-compare-divider"}),l.jsx(nC,{side:"b",project:b,loading:C,model:A.b,onAdopt:()=>P("b")})]}):p?l.jsx(y0,{project:p,onChange:m,onDeploy:V,onAgentAdded:r,onDeploymentTaskChange:s}):l.jsxs("div",{className:"ic-preview-empty",children:[l.jsxs("div",{className:"ic-preview-empty-icon",children:[l.jsx(TH,{className:"ic-preview-empty-glyph"}),l.jsx(Po,{className:"ic-preview-empty-spark"})]}),l.jsx("div",{className:"ic-preview-empty-title",children:"还没有项目"}),l.jsx("div",{className:"ic-preview-empty-sub",children:"描述你的需求,我会帮你生成 VeADK 项目"})]})})]})})}function nC({side:e,project:t,loading:n,model:r,onAdopt:s}){const i=e==="a"?"方案 A":"方案 B";return l.jsxs("div",{className:"ic-pane",children:[l.jsxs("div",{className:"ic-pane-head",children:[l.jsxs("div",{className:"ic-pane-title",children:[l.jsx("span",{className:`ic-pane-tag ic-pane-tag--${e}`,children:i}),r&&l.jsx("span",{className:"ic-pane-model",children:r})]}),l.jsxs("button",{className:"ic-adopt",onClick:s,disabled:!t||n,title:`采用${i}`,children:["采用",e==="a"?"方案 A":"方案 B"]})]}),l.jsx("div",{className:"ic-pane-body",children:n?l.jsxs("div",{className:"ic-pane-loading",children:[l.jsx(Rt,{className:"ic-pane-spinner"}),l.jsx("span",{children:"正在生成…"})]}):t?l.jsx(y0,{project:t}):l.jsx("div",{className:"ic-pane-empty",children:"该方案未返回可用项目"})})]})}const ige=/^[A-Za-z_][A-Za-z0-9_]*$/;function lc(e){return e.trim().length===0?"名称为必填项":e==="user"?"user 是 Google ADK 保留名称,请使用其他名称":ige.test(e)?null:"名称须以英文字母或下划线开头,且只能包含英文字母、数字和下划线"}function V6(e){const t=new Set,n=new Set,r=s=>{lc(s.name)===null&&(t.has(s.name)?n.add(s.name):t.add(s.name)),s.subAgents.forEach(r)};return r(e),n}function age({className:e,...t}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[l.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"}),l.jsx("path",{d:"M12 6.5c.4 2.4 1 3 3.4 3.4-2.4.4-3 1-3.4 3.4-.4-2.4-1-3-3.4-3.4 2.4-.4 3-1 3.4-3.4Z"})]})}const Cu={llm:{id:"llm",label:"LLM 智能体",desc:"大模型驱动,自主完成任务",icon:age},sequential:{id:"sequential",label:"顺序型智能体",desc:"子 Agent 按顺序依次执行",icon:AH},parallel:{id:"parallel",label:"并行型智能体",desc:"子 Agent 并行执行后汇总",icon:GH},loop:{id:"loop",label:"循环型智能体",desc:"子 Agent 循环执行到满足条件",icon:Rw},a2a:{id:"a2a",label:"远程智能体",desc:"通过 A2A 协议调用远程 Agent",icon:Cg}},oge=[Cu.llm,Cu.sequential,Cu.parallel,Cu.loop,Cu.a2a],K6=e=>e==="sequential"||e==="parallel"||e==="loop",b0=e=>e==="a2a";function As(e){return e.trimEnd().replace(/[。.]+$/,"")}function tg(e,t){const n=e.trim().toLocaleLowerCase();return n?t.some(r=>r==null?void 0:r.toLocaleLowerCase().includes(n)):!0}function ro(e,t){return e[t]|e[t+1]<<8}function gl(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}async function lge(e){const t=new DecompressionStream("deflate-raw"),n=new Blob([new Uint8Array(e)]).stream().pipeThrough(t);return new Uint8Array(await new Response(n).arrayBuffer())}async function Y6(e,t={}){let r=-1;for(let u=e.length-22;u>=0&&u>e.length-65557;u--)if(gl(e,u)===101010256){r=u;break}if(r<0)throw new Error("无效的 zip:找不到 EOCD");const s=ro(e,r+10);if(t.maxEntries!==void 0&&s>t.maxEntries)throw new Error(`zip 文件数不能超过 ${t.maxEntries} 个`);let i=gl(e,r+16);const a=new TextDecoder("utf-8"),o=[];let c=0;for(let u=0;ut.maxUncompressedBytes)throw new Error("zip 解压后的内容过大");const x=ro(e,E+26),b=ro(e,E+28),_=E+30+x+b,k=e.subarray(_,_+f);let N;if(d===0)N=k;else if(d===8)N=await lge(k);else{i+=46+p+m+y;continue}o.push({name:g,text:a.decode(N)}),i+=46+p+m+y}return o}const cge="/skillhub/v1/skills";async function uge(e,t="public"){const n=e.trim(),r=`${cge}?query=${encodeURIComponent(n)}&namespace=${encodeURIComponent(t)}`,s=await fetch(r,{headers:{accept:"application/json"},signal:Gs(void 0,Kc)});if(!s.ok)throw new Error(`搜索失败 (${s.status})`);return((await s.json()).Skills??[]).map(a=>{var o;return{source:"skillhub",id:a.Id??a.Slug??"",slug:a.Slug??"",name:a.Name??a.Slug??"",description:((o=a.Metadata)==null?void 0:o.DisplayDescription)||a.Description||"",namespace:a.Namespace??t,sourceRepo:a.SourceRepo,downloadCount:a.DownloadCount}})}function dge({selected:e,onChange:t}){const[n,r]=w.useState(""),[s,i]=w.useState([]),[a,o]=w.useState(!1),[c,u]=w.useState(null),[d,f]=w.useState(!1),h=y=>e.some(E=>E.source==="skillhub"&&E.slug===y),p=y=>{y.slug&&(h(y.slug)?t(e.filter(E=>!(E.source==="skillhub"&&E.slug===y.slug))):t([...e,{source:"skillhub",slug:y.slug,name:y.name,folder:y.slug.split("/").pop()||y.name,namespace:y.namespace||"public",description:y.description}]))},m=async y=>{o(!0),u(null),f(!0);try{const E=await uge(y);i(E)}catch(E){u(E instanceof Error?E.message:"搜索失败,请稍后重试。"),i([])}finally{o(!1)}};return w.useEffect(()=>{const y=n.trim();if(!y){i([]),f(!1),u(null);return}const E=setTimeout(()=>m(y),300);return()=>clearTimeout(E)},[n]),l.jsxs("div",{className:"cw-skillhub",children:[l.jsxs("div",{className:"cw-skill-searchrow",children:[l.jsxs("div",{className:"cw-skill-searchbox",children:[l.jsx(Vd,{className:"cw-i cw-skill-searchicon","aria-hidden":!0}),l.jsx("input",{className:"cw-input cw-skill-input",value:n,placeholder:"搜索火山 Find Skill 技能广场,例如 数据分析、PDF…",onChange:y=>r(y.target.value),onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),n.trim()&&m(n))}})]}),l.jsxs("button",{type:"button",className:"cw-btn cw-btn-soft",onClick:()=>n.trim()&&m(n),disabled:!n.trim()||a,children:[a?l.jsx(Rt,{className:"cw-i cw-spin"}):l.jsx(Vd,{className:"cw-i"}),"搜索"]})]}),c&&l.jsxs("div",{className:"cw-banner",children:[l.jsx(Ka,{className:"cw-i"}),l.jsx("span",{children:c})]}),a&&s.length===0?l.jsx("p",{className:"cw-empty-line",children:"正在搜索…"}):s.length>0?l.jsx("div",{className:"cw-skill-results",children:s.map(y=>{const E=h(y.slug||"");return l.jsxs("button",{type:"button",className:`cw-skill-result ${E?"is-on":""}`,onClick:()=>p(y),"aria-pressed":E,children:[l.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:E?l.jsx(Js,{className:"cw-i cw-i-sm"}):l.jsx(rr,{className:"cw-i cw-i-sm"})}),l.jsxs("span",{className:"cw-skill-result-meta",children:[l.jsx("span",{className:"cw-skill-result-name",children:y.name}),y.description&&l.jsx("span",{className:"cw-skill-result-desc",children:As(y.description)}),y.sourceRepo&&l.jsx("span",{className:"cw-skill-result-repo",children:y.sourceRepo})]})]},y.id||y.slug)})}):d&&!c?l.jsx("p",{className:"cw-empty-line",children:"没有找到匹配的技能,换个关键词试试。"}):!d&&l.jsx("p",{className:"cw-empty-line",children:"输入关键词搜索火山 Find Skill 技能广场,所选技能会在生成项目时下载到 skills/ 目录。"})]})}const WE=/(^|\/)skill\.md$/i;function fge(e){const t=(e??"").replace(/\r\n?/g,` `).split(` -`);if(!n.length||n[0].trim()!=="---")throw new Pa(`${t} 的 SKILL.md 必须以 YAML frontmatter (--- ... ---) 开头`);let r=-1;for(let o=1;o=2&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))}function mge(e,t){if(!e)throw new Pa(`${t} 的 SKILL.md 缺少必填的 name frontmatter`);if(e.length>64)throw new Pa(`${t} 的 name 长度超过 64 个字符`);if(!/^[a-z0-9-]+$/.test(e))throw new Pa(`${t} 的 name 必须匹配 [a-z0-9-]+(小写字母、数字、短横线)`)}function gge(e,t){if(!e)throw new Pa(`${t} 的 SKILL.md 缺少必填的 description frontmatter`);if(e.length>1024)throw new Pa(`${t} 的 description 长度超过 1024 个字符`);if(/<[^>]+>/.test(e))throw new Pa(`${t} 的 description 不能包含 XML 标签`)}function G6(e){const t=e.map(r=>({path:r.path.replace(/\\/g,"/").replace(/^\.\//,""),text:r.text})).filter(r=>r.path.length>0&&!r.path.endsWith("/")),n=new Set(t.map(r=>r.path.split("/")[0]));if(n.size===1&&t.every(r=>r.path.includes("/"))){const r=[...n][0]+"/";return t.map(s=>({path:s.path.slice(r.length),text:s.text}))}return t}function yge(e){const t=new Map,n=new Set;for(const r of e)if(GE.test("/"+r.path)){const s=r.path.split("/");n.add(s.slice(0,-1).join("/"))}for(const r of e){const s=r.path.split("/");let i="";for(let u=s.length-1;u>=0;u--){const d=s.slice(0,u).join("/");if(n.has(d)){i=d;break}}const a=GE.test("/"+r.path);if(!i&&!a&&!n.has("")||!n.has(i)&&!a)continue;const o=i?r.path.slice(i.length+1):r.path,c=t.get(i)||[];c.push({path:o,text:r.text}),t.set(i,c)}return t}function bge(e,t,n){const r=`${n}${e?"/"+e:""}`,s=t.find(c=>GE.test("/"+c.path));if(!s)return{hit:null,error:`${r} 缺少 SKILL.md`};let i;try{i=hge(s.text,r)}catch(c){return{hit:null,error:c instanceof Error?c.message:String(c)}}const a=i.name,o=[];for(const c of t){if(c.path.split("/").some(f=>f===".."))return{hit:null,error:`${r} 包含非法路径(..):${c.path}`};const d=`skills/${a}/${c.path}`;if(!d.startsWith(`skills/${a}/`))return{hit:null,error:`${r} 包含非法路径:${c.path}`};o.push({path:d,content:c.text})}return{hit:{source:"local",id:`local:${a}:${t.length}`,name:i.name,description:i.description,folder:a,localFiles:o},error:null}}async function Ege(e){const t=new Uint8Array(await e.arrayBuffer()),r=(await W6(t)).map(s=>({path:s.name,text:s.text}));return q6(G6(r),e.name)}async function xge(e,t=new Map){const n=[];for(let r=0;re.file(t,n))}async function vge(e){const t=e.createReader(),n=[];for(;;){const r=await new Promise((s,i)=>t.readEntries(s,i));if(r.length===0)return n;n.push(...r)}}async function X6(e,t=""){const n=t?`${t}/${e.name}`:e.name;if(e.isFile)return[{file:await wge(e),path:n}];if(!e.isDirectory)return[];const r=await vge(e);return(await Promise.all(r.map(s=>X6(s,n)))).flat()}function _ge({selected:e,onChange:t}){const[n,r]=w.useState([]),[s,i]=w.useState([]),[a,o]=w.useState(!1),[c,u]=w.useState(!1),d=w.useRef(0),f=b=>e.some(_=>_.source==="local"&&_.folder===b),h=b=>{b.localFiles&&(f(b.folder||b.name)?t(e.filter(_=>!(_.source==="local"&&_.folder===(b.folder||b.name)))):t([...e,{source:"local",folder:b.folder||b.name,name:b.name,description:b.description,localFiles:b.localFiles}]))},p=w.useRef([]),m=w.useRef(e);w.useEffect(()=>{p.current=s},[s]),w.useEffect(()=>{m.current=e},[e]);const y=b=>{const _=new Set([...p.current.map(S=>S.folder||S.name),...m.current.filter(S=>S.source==="local").map(S=>S.folder)]),k=[],N=[];for(const S of b.hits){const A=S.folder||S.name;if(_.has(A)){k.push(S.name);continue}_.add(A),N.push(S)}i(S=>[...S,...N]);const C=[...b.errors];if(k.length>0&&C.push(`已跳过重复技能:${k.join("、")}`),r(C),N.length===1&&b.errors.length===0&&k.length===0){const S=N[0];S.localFiles&&t([...m.current,{source:"local",folder:S.folder||S.name,name:S.name,description:S.description,localFiles:S.localFiles}])}},E=b=>{b.preventDefault(),d.current+=1,u(!0)},g=b=>{b.preventDefault(),d.current=Math.max(0,d.current-1),d.current===0&&u(!1)},x=async b=>{if(b.preventDefault(),d.current=0,u(!1),a)return;const _=Array.from(b.dataTransfer.items).map(k=>{var N;return(N=k.webkitGetAsEntry)==null?void 0:N.call(k)}).filter(k=>k!==null);if(_.length===0){r(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}o(!0);try{const k=(await Promise.all(_.map(S=>X6(S)))).flat(),N=_.some(S=>S.isDirectory);if(!N&&k.length===1&&k[0].file.name.toLowerCase().endsWith(".zip")){y(await Ege(k[0].file));return}if(!N){r(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}const C=new Map(k.map(({file:S,path:A})=>[S,A]));y(await xge(k.map(({file:S})=>S),C))}catch(k){r([`读取失败:${k instanceof Error?k.message:String(k)}`])}finally{o(!1)}};return l.jsxs("div",{className:"cw-local",children:[l.jsxs("div",{className:`cw-local-dropzone ${c?"is-dragging":""}`,role:"group","aria-label":"拖入文件夹或 ZIP,自动识别 Skill",onDragEnter:E,onDragOver:b=>b.preventDefault(),onDragLeave:g,onDrop:b=>void x(b),children:[l.jsx(Rw,{className:"cw-local-drop-icon","aria-hidden":!0}),l.jsx("p",{className:"cw-local-drop-hint",children:"拖入文件夹或 ZIP,自动识别 Skill"})]}),l.jsx("p",{className:"cw-local-hint",children:"每个技能需包含 SKILL.md(含 name / description frontmatter)。支持包含多个技能的目录。"}),a&&l.jsx("p",{className:"cw-empty-line",children:"正在读取文件…"}),n.length>0&&l.jsxs("div",{className:"cw-banner",children:[l.jsx(Ya,{className:"cw-i"}),l.jsx("span",{children:n.join(";")})]}),s.length>0&&l.jsx("div",{className:"cw-skill-results",children:s.map(b=>{var k;const _=f(b.folder||b.name);return l.jsxs("button",{type:"button",className:`cw-skill-result ${_?"is-on":""}`,onClick:()=>h(b),"aria-pressed":_,children:[l.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:_?l.jsx(Js,{className:"cw-i cw-i-sm"}):l.jsx(rr,{className:"cw-i cw-i-sm"})}),l.jsxs("span",{className:"cw-skill-result-meta",children:[l.jsx("span",{className:"cw-skill-result-name",children:b.name}),b.description&&l.jsx("span",{className:"cw-skill-result-desc",children:As(b.description)}),l.jsxs("span",{className:"cw-skill-result-repo",children:["本地 · ",((k=b.localFiles)==null?void 0:k.length)??0," 个文件"]})]})]},b.id)})})]})}function kge({selected:e,onChange:t}){const[n,r]=w.useState([]),[s,i]=w.useState([]),[a,o]=w.useState(""),[c,u]=w.useState(!0),[d,f]=w.useState(!1),[h,p]=w.useState(null);w.useEffect(()=>{let g=!1;return(async()=>{u(!0),p(null);try{const x=await NM();g||(r(x),x.length>0&&o(x[0].id))}catch(x){g||p(x instanceof Error?x.message:"加载失败")}finally{g||u(!1)}})(),()=>{g=!0}},[]),w.useEffect(()=>{if(!a){i([]);return}const g=n.find(b=>b.id===a);let x=!1;return(async()=>{f(!0),p(null);try{const b=await SM(a,g==null?void 0:g.region);x||i(b)}catch(b){x||p(b instanceof Error?b.message:"加载失败")}finally{x||f(!1)}})(),()=>{x=!0}},[a,n]);const m=n.find(g=>g.id===a),y=(g,x)=>e.some(b=>b.source==="skillspace"&&b.skillId===g&&(b.version||"")===x),E=g=>{if(m)if(y(g.skillId,g.version))t(e.filter(x=>!(x.source==="skillspace"&&x.skillId===g.skillId&&(x.version||"")===g.version)));else{const x=yV(m,g);t([...e,{source:"skillspace",folder:x.folder||g.skillName,name:x.name,description:x.description,skillSpaceId:x.skillSpaceId,skillSpaceName:x.skillSpaceName,skillSpaceRegion:x.skillSpaceRegion,skillId:x.skillId,version:x.version}])}};return l.jsx("div",{className:"cw-skillspace",children:c?l.jsxs("p",{className:"cw-empty-line",children:[l.jsx(Rt,{className:"cw-i cw-spin"})," 正在加载 AgentKit Skills 中心…"]}):h?l.jsxs("div",{className:"cw-banner",children:[l.jsx(Ya,{className:"cw-i"}),l.jsx("span",{children:h})]}):n.length===0?l.jsx("p",{className:"cw-empty-line",children:"此账号下没有 AgentKit Skills 中心。"}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"cw-skillspace-header",children:[l.jsx("select",{className:"cw-input cw-skillspace-select",value:a,onChange:g=>o(g.target.value),"aria-label":"选择 AgentKit Skills 中心",children:n.map(g=>l.jsxs("option",{value:g.id,children:[g.name||g.id,g.region?` [${g.region}]`:"",g.description?` — ${As(g.description)}`:""]},g.id))}),m&&l.jsx("a",{href:bV(m.id,m.region),target:"_blank",rel:"noopener noreferrer",className:"cw-button cw-button-secondary cw-skillspace-console-link",title:"在火山引擎控制台打开",children:l.jsx(Ow,{className:"cw-i cw-i-sm"})})]}),d?l.jsxs("p",{className:"cw-empty-line",children:[l.jsx(Rt,{className:"cw-i cw-spin"})," 正在加载技能列表…"]}):s.length===0?l.jsx("p",{className:"cw-empty-line",children:"此 AgentKit Skills 中心暂无技能。"}):l.jsx("div",{className:"cw-skill-results",children:s.map(g=>{const x=y(g.skillId,g.version);return l.jsxs("button",{type:"button",className:`cw-skill-result ${x?"is-on":""}`,onClick:()=>E(g),"aria-pressed":x,children:[l.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:x?l.jsx(Js,{className:"cw-i cw-i-sm"}):l.jsx(rr,{className:"cw-i cw-i-sm"})}),l.jsxs("span",{className:"cw-skill-result-meta",children:[l.jsxs("span",{className:"cw-skill-result-name",children:[g.skillName,g.version&&l.jsxs("span",{className:"cw-skill-result-version",children:[" ","v",g.version]})]}),g.skillDescription&&l.jsx("span",{className:"cw-skill-result-desc",children:As(g.skillDescription)}),l.jsxs("span",{className:"cw-skill-result-repo",children:[l.jsx(yH,{className:"cw-i cw-i-sm"})," ",(m==null?void 0:m.name)||a]})]})]},`${g.skillId}/${g.version}`)})})]})})}async function Nge(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:Gs(void 0,Yc)});if(t.status===409)throw new Error("服务端未配置 Volcengine AK/SK,无法访问 AgentKit 智能体中心");if(t.status===401)throw new Error("请先登录以访问 AgentKit 智能体中心");if(!t.ok){let n="";try{n=(await t.json()).detail||""}catch{}throw new Error(`请求失败 (${t.status})${n?": "+n:""}`)}return t.json()}async function Sge(e={}){const t=new URLSearchParams({region:e.region||"cn-beijing",page_size:String(e.pageSize??100),project:e.project||"default"});return(await Nge(`/web/a2a-spaces?${t.toString()}`)).items||[]}async function Tge(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:Gs(void 0,Yc)});if(t.status===409)throw new Error("服务端未配置 Volcengine AK/SK,无法访问 VikingDB 知识库");if(t.status===401)throw new Error("请先登录以访问 VikingDB 知识库");if(!t.ok){let n="";try{n=(await t.json()).detail||""}catch{}throw new Error(`请求失败 (${t.status})${n?": "+n:""}`)}return t.json()}async function Age(e={}){const t=new URLSearchParams({region:e.region||"cn-beijing",project:e.project||"default"});return(await Tge(`/web/viking-knowledgebases?${t.toString()}`)).items||[]}const Cge=w.lazy(()=>lc(()=>import("./MarkdownPromptEditor-rtM9dn0I.js"),__vite__mapDeps([0,1])));function Ige(e,t,n="text/plain"){const r=URL.createObjectURL(new Blob([t],{type:`${n};charset=utf-8`})),s=document.createElement("a");s.href=r,s.download=e,document.body.appendChild(s),s.click(),s.remove(),URL.revokeObjectURL(r)}const sC=[{id:"type",label:"Agent 类型",hint:"选择 Agent 类型",icon:GH,required:!0},{id:"basic",label:"基本信息",hint:"名称、描述与系统提示词",icon:Ya,required:!0},{id:"model",label:"模型配置",hint:"模型与服务(可选)",icon:EH},{id:"tools",label:"工具",hint:"可调用的能力",icon:LL},{id:"skills",label:"技能",hint:"声明式技能",icon:Bo},{id:"knowledge",label:"知识库",hint:"外部知识检索",icon:_p},{id:"advanced",label:"进阶配置",hint:"记忆与观测",icon:CL},{id:"subagents",label:"子 Agent",hint:"嵌套协作",icon:vL},{id:"review",label:"完成",hint:"预览并创建",icon:KH}];function Oge({className:e}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M9 7.15v9.7a1.15 1.15 0 0 0 1.78.96l7.2-4.85a1.15 1.15 0 0 0 0-1.92l-7.2-4.85A1.15 1.15 0 0 0 9 7.15Z"}),l.jsx("path",{d:"M5.75 8.25v7.5",opacity:"0.8"}),l.jsx("path",{d:"M3 10v4",opacity:"0.45"}),l.jsx("path",{d:"M17.9 5.25v2.2M19 6.35h-2.2",strokeWidth:"1.55"})]})}function Q6({className:e}){return l.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m7 9 5 5 5-5"})})}function Z6({className:e}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M18.25 8.2A7.1 7.1 0 0 0 6.1 6.65L4.5 8.25"}),l.jsx("path",{d:"M4.5 4.75v3.5H8"}),l.jsx("path",{d:"M5.75 15.8A7.1 7.1 0 0 0 17.9 17.35l1.6-1.6"}),l.jsx("path",{d:"M19.5 19.25v-3.5H16"})]})}const Rge={llm:"智能体",sequential:"分步协作",parallel:"同时处理",loop:"循环执行",a2a:"远程智能体"},iC={llm:"理解任务并完成一个具体工作",sequential:"内部步骤按照顺序依次执行",parallel:"内部步骤同时工作,完成后统一汇总",loop:"重复执行内部步骤,直到满足停止条件",a2a:"调用已经存在的远程 Agent"},aC={REGISTRY_SPACE_ID:"registrySpaceId",REGISTRY_TOP_K:"registryTopK",REGISTRY_REGION:"registryRegion",REGISTRY_ENDPOINT:"registryEndpoint"},J6="REGISTRY_SPACE_ID",Lge=TM.filter(e=>e.key!==J6);function e5(e,t){var r,s,i;if(!(e!=null&&e.enabled))return{};const n={REGISTRY_SPACE_ID:e.registrySpaceId??""};return t.includeDefaults?(n.REGISTRY_TOP_K=((r=e.registryTopK)==null?void 0:r.trim())||qs.topK,n.REGISTRY_REGION=((s=e.registryRegion)==null?void 0:s.trim())||qs.region,n.REGISTRY_ENDPOINT=((i=e.registryEndpoint)==null?void 0:i.trim())||qs.endpoint):(n.REGISTRY_TOP_K=e.registryTopK??"",n.REGISTRY_REGION=e.registryRegion??"",n.REGISTRY_ENDPOINT=e.registryEndpoint??""),n}function oC({items:e,selected:t,onToggle:n,scrollRows:r}){return l.jsx("div",{className:`cw-checklist ${r?"cw-checklist-tools":""}`,style:r?{"--cw-checklist-max-height":`${r*65+(r-1)*8}px`}:void 0,children:e.map(s=>{const i=t.includes(s.id);return l.jsxs("button",{type:"button",className:`cw-check ${i?"is-on":""}`,onClick:()=>n(s.id),"aria-pressed":i,children:[l.jsx("span",{className:"cw-check-box","aria-hidden":!0,children:i&&l.jsx(Js,{className:"cw-i cw-i-sm"})}),l.jsxs("span",{className:"cw-check-text",children:[l.jsx("span",{className:"cw-check-title",children:s.label}),l.jsx("span",{className:"cw-check-desc",children:As(s.desc)})]})]},s.id)})})}function mb({options:e,value:t,onChange:n}){return l.jsx("div",{className:"cw-segmented",children:e.map(r=>{var i;const s=(t??((i=e[0])==null?void 0:i.id))===r.id;return l.jsxs("button",{type:"button",className:`cw-seg ${s?"is-on":""}`,onClick:()=>n(r.id),"aria-pressed":s,title:As(r.desc),children:[l.jsx("span",{className:"cw-seg-title",children:r.label}),l.jsx("span",{className:"cw-seg-desc",children:As(r.desc)})]},r.id)})})}function Mge(e){return/(SECRET|PASSWORD|KEY|TOKEN)$/.test(e)}function bl({env:e,values:t,onChange:n}){return e.length===0?l.jsx("p",{className:"cw-env-empty",children:"此后端无需额外运行参数。"}):l.jsx("div",{className:"cw-env-fields",children:e.map(r=>l.jsxs("label",{className:"cw-env-field",children:[l.jsxs("span",{className:"cw-env-field-head",children:[l.jsxs("span",{className:"cw-env-field-label",children:[r.comment||r.key,r.required&&l.jsx("span",{className:"cw-req",children:"*"})]}),r.comment&&l.jsx("code",{title:r.key,children:r.key})]}),l.jsx("input",{className:"cw-input",type:Mge(r.key)?"password":"text",value:t[r.key]??"",placeholder:r.placeholder||"请输入参数值",autoComplete:"off",onChange:s=>n(r.key,s.currentTarget.value)})]},r.key))})}function gb(e){return e.name.trim()||"未命名智能体中心"}function yb(e){return e.name.trim()||e.id||"未命名知识库"}function jge({value:e,region:t,invalid:n,onChange:r}){const s=t.trim()||qs.region,[i,a]=w.useState([]),[o,c]=w.useState(!1),[u,d]=w.useState(null),[f,h]=w.useState(0),[p,m]=w.useState(!1),[y,E]=w.useState(""),g=w.useRef(null);w.useEffect(()=>{let A=!1;return c(!0),d(null),Sge({region:s}).then(O=>{A||a(O)}).catch(O=>{A||(a([]),d(O instanceof Error?O.message:"加载失败"))}).finally(()=>{A||c(!1)}),()=>{A=!0}},[s,f]);const x=!e||i.some(A=>A.id===e.trim()),b=i.find(A=>A.id===e.trim()),_=b?gb(b):e&&!x?"已选择的智能体中心":"请选择智能体中心",k=o&&i.length===0,N=w.useMemo(()=>i.filter(A=>ng(y,[gb(A),A.id,A.projectName])),[y,i]),C=!!(e&&!x&&ng(y,["已选择的智能体中心",e]));w.useEffect(()=>{if(!p)return;const A=D=>{const U=D.target;U instanceof Node&&g.current&&!g.current.contains(U)&&m(!1)},O=D=>{D.key==="Escape"&&m(!1)};return window.addEventListener("pointerdown",A),window.addEventListener("keydown",O),()=>{window.removeEventListener("pointerdown",A),window.removeEventListener("keydown",O)}},[p]);const S=A=>{r(A),m(!1)};return l.jsxs("div",{className:"cw-a2a-space-picker",ref:g,children:[l.jsxs("div",{className:"cw-a2a-space-row",children:[l.jsxs("div",{className:"cw-a2a-space-select-wrap",children:[l.jsxs("button",{type:"button",className:`cw-a2a-space-trigger ${n?"is-error":""}`,disabled:k,"aria-haspopup":"listbox","aria-expanded":p,"aria-label":"选择 AgentKit 智能体中心",onClick:()=>{E(""),m(A=>!A)},children:[l.jsx("span",{className:e?void 0:"is-placeholder",children:_}),l.jsx(Q6,{className:"cw-a2a-space-trigger-icon"})]}),p&&l.jsxs("div",{className:"cw-a2a-space-menu",children:[l.jsx("div",{className:"cw-picker-search",children:l.jsx("input",{className:"cw-picker-search-input",type:"search",value:y,autoFocus:!0,autoComplete:"off","aria-label":"搜索 AgentKit 智能体中心",placeholder:"搜索名称或 ID",onChange:A=>E(A.currentTarget.value)})}),l.jsxs("div",{className:"cw-picker-options",role:"listbox","aria-label":"AgentKit 智能体中心",children:[C&&l.jsx("button",{type:"button",role:"option","aria-selected":!0,className:"cw-a2a-space-option is-selected",onClick:()=>S(e),children:"已选择的智能体中心"}),N.map(A=>{const O=gb(A),D=A.id===e;return l.jsx("button",{type:"button",role:"option","aria-selected":D,className:`cw-a2a-space-option ${D?"is-selected":""}`,title:`${O} (${A.id})`,onClick:()=>S(A.id),children:O},A.id)}),!C&&N.length===0&&l.jsx("div",{className:"cw-picker-empty",children:"未找到匹配的智能体中心"})]})]})]}),l.jsx("button",{type:"button",className:"cw-icon-btn cw-a2a-space-refresh",title:"刷新智能体中心列表","aria-label":"刷新智能体中心列表",disabled:o,onClick:()=>h(A=>A+1),children:o?l.jsx(Rt,{className:"cw-i cw-i-sm cw-spin"}):l.jsx(Z6,{className:"cw-i cw-i-sm"})})]}),u?l.jsxs("div",{className:"cw-banner cw-a2a-space-error",children:[l.jsx(Ya,{className:"cw-i"}),l.jsx("span",{children:u})]}):o?l.jsxs("span",{className:"cw-help cw-a2a-space-status",children:[l.jsx(Rt,{className:"cw-i cw-i-sm cw-spin"}),"正在加载 AgentKit 智能体中心…"]}):i.length===0?l.jsx("span",{className:"cw-help",children:"此账号下暂无 AgentKit 智能体中心。"}):l.jsxs("span",{className:"cw-help",children:["已加载 ",i.length," 个智能体中心,列表仅展示中心名称。"]})]})}function Dge({value:e,onChange:t}){const[n,r]=w.useState([]),[s,i]=w.useState(!1),[a,o]=w.useState(null),[c,u]=w.useState(0),[d,f]=w.useState(!1),[h,p]=w.useState(""),m=w.useRef(null);w.useEffect(()=>{let N=!1;return i(!0),o(null),Age().then(C=>{N||r(C)}).catch(C=>{N||(r([]),o(C instanceof Error?C.message:"加载失败"))}).finally(()=>{N||i(!1)}),()=>{N=!0}},[c]);const y=!e||n.some(N=>N.id===e.trim()),E=n.find(N=>N.id===e.trim()),g=E?yb(E):e&&!y?e:"请选择 VikingDB 知识库",x=s&&n.length===0,b=w.useMemo(()=>n.filter(N=>ng(h,[yb(N),N.id,N.description,N.projectName])),[n,h]),_=!!(e&&!y&&ng(h,[e]));w.useEffect(()=>{if(!d)return;const N=S=>{const A=S.target;A instanceof Node&&m.current&&!m.current.contains(A)&&f(!1)},C=S=>{S.key==="Escape"&&f(!1)};return window.addEventListener("pointerdown",N),window.addEventListener("keydown",C),()=>{window.removeEventListener("pointerdown",N),window.removeEventListener("keydown",C)}},[d]);const k=N=>{t(N),f(!1)};return l.jsxs("div",{className:"cw-a2a-space-picker cw-viking-kb-picker",ref:m,children:[l.jsxs("div",{className:"cw-a2a-space-row",children:[l.jsxs("div",{className:"cw-a2a-space-select-wrap",children:[l.jsxs("button",{type:"button",className:"cw-a2a-space-trigger",disabled:x,"aria-haspopup":"listbox","aria-expanded":d,"aria-label":"选择 VikingDB 知识库",onClick:()=>{p(""),f(N=>!N)},children:[l.jsx("span",{className:e?void 0:"is-placeholder",children:g}),l.jsx(Q6,{className:"cw-a2a-space-trigger-icon"})]}),d&&l.jsxs("div",{className:"cw-a2a-space-menu cw-viking-kb-menu",children:[l.jsx("div",{className:"cw-picker-search",children:l.jsx("input",{className:"cw-picker-search-input",type:"search",value:h,autoFocus:!0,autoComplete:"off","aria-label":"搜索 VikingDB 知识库",placeholder:"搜索名称或 ID",onChange:N=>p(N.currentTarget.value)})}),l.jsxs("div",{className:"cw-picker-options",role:"listbox","aria-label":"VikingDB 知识库",children:[_&&l.jsx("button",{type:"button",role:"option","aria-selected":!0,className:"cw-a2a-space-option is-selected",onClick:()=>k(e),children:e}),b.map(N=>{const C=yb(N),S=N.id===e;return l.jsx("button",{type:"button",role:"option","aria-selected":S,className:`cw-a2a-space-option ${S?"is-selected":""}`,title:`${C} (${N.id})`,onClick:()=>k(N.id),children:C},N.id)}),!_&&b.length===0&&l.jsx("div",{className:"cw-picker-empty",children:"未找到匹配的知识库"})]})]})]}),l.jsx("button",{type:"button",className:"cw-icon-btn cw-a2a-space-refresh cw-viking-kb-refresh",title:"刷新知识库列表","aria-label":"刷新知识库列表",disabled:s,onClick:()=>u(N=>N+1),children:s?l.jsx(Rt,{className:"cw-i cw-i-sm cw-spin"}):l.jsx(Z6,{className:"cw-i cw-i-sm"})})]}),a?l.jsxs("div",{className:"cw-banner cw-a2a-space-error",children:[l.jsx(Ya,{className:"cw-i"}),l.jsx("span",{children:a})]}):s?l.jsxs("span",{className:"cw-help cw-a2a-space-status",children:[l.jsx(Rt,{className:"cw-i cw-i-sm cw-spin"}),"正在加载 VikingDB 知识库…"]}):n.length===0?l.jsx("span",{className:"cw-help",children:"此账号下暂无 VikingDB 知识库。"}):l.jsxs("span",{className:"cw-help",children:["已加载 ",n.length," 个知识库,选择的知识库会用于当前 Agent。"]})]})}function Pge({tools:e,onChange:t}){const n=(i,a)=>t(e.map((o,c)=>c===i?{...o,...a}:o)),r=i=>t(e.filter((a,o)=>o!==i)),s=()=>t([...e,{name:"",transport:"http",url:""}]);return l.jsxs("div",{className:"cw-mcp",children:[e.length>0&&l.jsx("div",{className:"cw-mcp-list",children:l.jsx(pi,{initial:!1,children:e.map((i,a)=>l.jsxs($t.div,{className:"cw-mcp-row",layout:!0,initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},transition:{duration:.16},children:[l.jsxs("div",{className:"cw-mcp-rowhead",children:[l.jsxs("div",{className:"cw-mcp-transport",children:[l.jsx("button",{type:"button",className:`cw-seg cw-seg-sm ${i.transport==="http"?"is-on":""}`,onClick:()=>n(a,{transport:"http"}),"aria-pressed":i.transport==="http",children:l.jsx("span",{className:"cw-seg-title",children:"HTTP"})}),l.jsx("button",{type:"button",className:`cw-seg cw-seg-sm ${i.transport==="stdio"?"is-on":""}`,onClick:()=>n(a,{transport:"stdio"}),"aria-pressed":i.transport==="stdio",children:l.jsx("span",{className:"cw-seg-title",children:"stdio"})})]}),l.jsx("button",{type:"button",className:"cw-icon-btn cw-icon-danger",onClick:()=>r(a),"aria-label":"移除 MCP 工具",children:l.jsx(ea,{className:"cw-i cw-i-sm"})})]}),l.jsx("input",{className:"cw-input",value:i.name,placeholder:"名称(用于命名,可留空)",onChange:o=>n(a,{name:o.target.value})}),i.transport==="http"?l.jsxs(l.Fragment,{children:[l.jsx("input",{className:"cw-input",value:i.url??"",placeholder:"MCP 服务地址(StreamableHTTP)",onChange:o=>n(a,{url:o.target.value})}),l.jsx("input",{className:"cw-input",value:i.authToken??"",placeholder:"Bearer Token(可选)",onChange:o=>n(a,{authToken:o.target.value})})]}):l.jsxs(l.Fragment,{children:[l.jsx("input",{className:"cw-input",value:i.command??"",placeholder:"启动命令,例如 npx",onChange:o=>n(a,{command:o.target.value})}),l.jsx("input",{className:"cw-input",value:(i.args??[]).join(" "),placeholder:"参数(用空格分隔),例如 -y @playwright/mcp@latest",onChange:o=>n(a,{args:o.target.value.split(/\s+/).filter(Boolean)})}),l.jsx("p",{className:"cw-mcp-note",children:"stdio MCP 暂不参与调试运行;点击“去部署”时会完整保留这项配置并生成对应代码。"})]})]},a))})}),l.jsxs("button",{type:"button",className:"cw-add-sub",onClick:s,children:[l.jsx(rr,{className:"cw-i"}),"添加 MCP 工具"]}),e.length===0&&l.jsx("p",{className:"cw-empty-line",children:"暂无 MCP 工具,点击「添加 MCP 工具」连接外部 MCP 服务。"})]})}function t5({className:e}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M5.5 7.5h10.75a2 2 0 0 1 2 2v7.75a2 2 0 0 1-2 2H5.5a2 2 0 0 1-2-2V9.5a2 2 0 0 1 2-2Z"}),l.jsx("path",{d:"M7 4.75h9.5a2 2 0 0 1 2 2",opacity:".58"}),l.jsx("path",{d:"m11 10.25.72 1.48 1.63.24-1.18 1.15.28 1.62-1.45-.77-1.45.77.28-1.62-1.18-1.15 1.63-.24.72-1.48Z"}),l.jsx("path",{d:"M19.25 11.25h1.5M20 10.5V12",opacity:".72"})]})}function Bge({s:e,onRemove:t}){let n=Bo,r="火山 Find Skill 技能广场";return e.source==="local"?(n=Rw,r="本地"):e.source==="skillspace"&&(n=t5,r="AgentKit Skills 中心"),l.jsxs($t.div,{className:"cw-selected-skill-row",layout:!0,initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.16},children:[l.jsx("span",{className:"cw-selected-skill-icon","aria-hidden":!0,children:l.jsx(n,{className:"cw-i cw-i-sm"})}),l.jsxs("span",{className:"cw-selected-skill-meta",children:[l.jsx("span",{className:"cw-selected-skill-name",children:e.name}),l.jsxs("span",{className:"cw-selected-skill-detail",children:[r,e.description?` · ${As(e.description)}`:""]})]}),l.jsx("button",{type:"button",className:"cw-selected-skill-remove",onClick:t,"aria-label":`移除 ${e.name}`,title:`移除 ${e.name}`,children:l.jsx(zr,{className:"cw-i cw-i-sm"})})]},`${e.source}:${e.folder}:${e.skillId||e.slug||""}:${e.version||""}`)}const bb=[{id:"local",label:"本地文件",icon:Rw},{id:"skillspace",label:"AgentKit Skills 中心",icon:t5},{id:"skillhub",label:"火山 Find Skill 技能广场",icon:Ig}];function Fge({selected:e,onChange:t}){const[n,r]=w.useState("local"),[s,i]=w.useState(!1),a=bb.findIndex(c=>c.id===n),o=c=>t(e.filter(u=>Eb(u)!==c));return w.useEffect(()=>{if(!s)return;const c=u=>{u.key==="Escape"&&i(!1)};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[s]),l.jsxs("div",{className:"cw-skillspane",children:[l.jsxs("button",{type:"button",className:"cw-skill-add","aria-haspopup":"dialog",onClick:()=>i(!0),children:[l.jsx("span",{className:"cw-skill-add-icon","aria-hidden":!0,children:l.jsx(rr,{className:"cw-i"})}),l.jsx("span",{children:"添加 Skill"})]}),e.length>0&&l.jsxs("div",{className:"cw-skill-selected",children:[l.jsxs("span",{className:"cw-skill-selected-label",children:["已加入技能 · ",e.length]}),l.jsx("div",{className:"cw-selected-skill-list",children:l.jsx(pi,{initial:!1,children:e.map(c=>l.jsx(Bge,{s:c,onRemove:()=>o(Eb(c))},Eb(c)))})})]}),l.jsx(pi,{children:s&&l.jsx($t.div,{className:"cw-skill-dialog-backdrop",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.16},onMouseDown:c=>{c.target===c.currentTarget&&i(!1)},children:l.jsxs($t.div,{className:"cw-skill-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"cw-skill-dialog-title",initial:{opacity:0,y:10,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:6,scale:.99},transition:{duration:.18,ease:"easeOut"},children:[l.jsxs("div",{className:"cw-skill-dialog-head",children:[l.jsx("h3",{id:"cw-skill-dialog-title",children:"添加 Skill"}),l.jsx("button",{type:"button",className:"cw-skill-dialog-close","aria-label":"关闭添加 Skill",onClick:()=>i(!1),children:l.jsx(zr,{className:"cw-i"})})]}),l.jsxs("div",{className:"cw-skill-dialog-body",children:[l.jsxs("div",{className:"cw-skill-sourcetabs",role:"tablist",style:{"--cw-skill-tab-slider-width":`calc((100% - 16px) / ${bb.length})`,"--cw-active-skill-tab-offset":`calc(${a*100}% + ${a*4}px)`},children:[l.jsx("span",{className:"cw-skill-tab-slider","aria-hidden":!0}),bb.map(({id:c,label:u,icon:d})=>l.jsxs("button",{type:"button",role:"tab",id:`cw-skill-tab-${c}`,"aria-controls":"cw-skill-tabpanel","aria-selected":n===c,className:`cw-skill-pickertab ${n===c?"is-on":""}`,onClick:()=>r(c),children:[l.jsx(d,{className:"cw-i cw-i-sm"}),u]},c))]}),l.jsxs("div",{id:"cw-skill-tabpanel",className:"cw-skill-tabbody",role:"tabpanel","aria-labelledby":`cw-skill-tab-${n}`,children:[n==="skillhub"&&l.jsx(fge,{selected:e,onChange:t}),n==="local"&&l.jsx(_ge,{selected:e,onChange:t}),n==="skillspace"&&l.jsx(kge,{selected:e,onChange:t})]})]})]})})})]})}function Eb(e){return e.source==="skillhub"?`hub:${e.namespace}/${e.slug}`:e.source==="local"?`local:${e.folder}`:`ss:${e.skillSpaceId}/${e.skillId}/${e.version||""}`}function Ou({checked:e,onChange:t,title:n,desc:r,icon:s}){return l.jsxs("button",{type:"button",className:`cw-toggle ${e?"is-on":""}`,onClick:()=>t(!e),"aria-pressed":e,children:[l.jsx("span",{className:"cw-toggle-icon",children:l.jsx(s,{className:"cw-i"})}),l.jsxs("span",{className:"cw-toggle-text",children:[l.jsx("span",{className:"cw-toggle-title",children:n}),l.jsx("span",{className:"cw-toggle-desc",children:As(r)})]}),l.jsx("span",{className:"cw-switch","aria-hidden":!0,children:l.jsx($t.span,{className:"cw-switch-knob",layout:!0,transition:{type:"spring",stiffness:520,damping:34}})})]})}function Uge(e,t){var r;let n=e;for(const s of t)if(n=(r=n.subAgents)==null?void 0:r[s],!n)return!1;return!0}function ip(e,t){let n=e;for(const r of t)n=n.subAgents[r];return n}function qf(e,t,n){if(t.length===0)return n(e);const[r,...s]=t,i=e.subAgents.slice();return i[r]=qf(i[r],s,n),{...e,subAgents:i}}function $ge(e,t){return qf(e,t,n=>({...n,subAgents:[...n.subAgents,Sr()]}))}function Hge(e,t,n){return qf(e,t,r=>{const s=r.subAgents.slice();return s.splice(n,0,Sr()),{...r,subAgents:s}})}function zge(e,t){if(t.length===0)return e;const n=t.slice(0,-1),r=t[t.length-1];return qf(e,n,s=>({...s,subAgents:s.subAgents.filter((i,a)=>a!==r)}))}const qE=e=>!E0(e.agentType),lC=3;function Vge(e,t,n=!1){var s;if(E0(e.agentType))return n?"远程 Agent 只能作为子 Agent":(s=e.a2aRegistry)!=null&&s.registrySpaceId.trim()?null:"缺少 AgentKit 智能体中心";const r=cc(e.name);return r||(t.has(e.name)?"Agent 名称在当前结构中必须唯一":e.description.trim().length===0?"缺少描述":Y6(e.agentType)?e.subAgents.length===0?"缺少子 Agent":null:e.instruction.trim().length===0?"缺少系统提示词":null)}function n5(e,t,n=[]){const r=[],s=E0(e.agentType),i=Vge(e,t,n.length===0);return i&&r.push({path:n,name:s?"远程 Agent":e.name.trim()||"未命名",problem:i}),qE(e)&&e.subAgents.forEach((a,o)=>r.push(...n5(a,t,[...n,o]))),r}function r5(e){return 1+e.subAgents.reduce((t,n)=>t+r5(n),0)}function s5(e){const t=[],n={},r=i=>{var a,o,c,u;for(const d of i.builtinTools??[]){const f=_c.find(h=>h.id===d);f&&t.push({env:f.env})}if((a=i.a2aRegistry)!=null&&a.enabled&&(t.push({env:TM}),Object.assign(n,e5(i.a2aRegistry,{includeDefaults:!0}))),i.memory.shortTerm&&t.push({env:((o=Z1.find(d=>d.id===(i.shortTermBackend??"local")))==null?void 0:o.env)??[]}),i.memory.longTerm&&t.push({env:((c=J1.find(d=>d.id===(i.longTermBackend??"local")))==null?void 0:c.env)??[]}),i.knowledgebase&&t.push({env:((u=eE.find(d=>d.id===(i.knowledgebaseBackend??qd)))==null?void 0:u.env)??[]}),i.tracing)for(const d of i.tracingExporters??[]){const f=tE.find(h=>h.id===d);f&&t.push({env:f.env,enableFlag:f.enableFlag})}i.subAgents.forEach(r)};r(e);const s=H6(t);return{specs:s.specs,fixedValues:{...s.fixedValues,...n}}}function i5(e){var t;return{...e,deployment:{feishuEnabled:!!((t=e.deployment)!=null&&t.feishuEnabled)}}}function Kge(e){var n;const t=e.name.trim();return t||(e.agentType!=="sequential"?"":((n=e.subAgents.find(r=>r.name.trim()))==null?void 0:n.name.trim())??"")}function a5(e){var r,s;const t=s5(e),n={...((r=e.deployment)==null?void 0:r.envValues)??{},...t.fixedValues};return{...i5(e),deployment:{feishuEnabled:!!((s=e.deployment)!=null&&s.feishuEnabled),envValues:Object.fromEntries(z6(t.specs,n).map(({key:i,value:a})=>[i,a]))}}}function Yge(e){return JSON.stringify(a5(e))}function rg(e,t){return JSON.stringify({draftSnapshot:e,modelName:t.modelName,description:t.description,instruction:t.instruction,optimizations:t.optimizations})}function ql(e){return JSON.stringify({modelName:e.modelName.trim(),description:e.description.trim(),instruction:e.instruction.trim(),optimizations:e.optimizations})}function Wge({enabled:e,disabledReason:t,variants:n,draftSnapshot:r,input:s,onInput:i,onSend:a,onStartVariant:o,onDeployVariant:c,onAddVariant:u,onRemoveVariant:d,onToggleConfig:f,onCompleteConfig:h,onConfigChange:p}){const m=n.filter(g=>g.phase!=="ready"?!1:g.runtimeSnapshot===rg(r,g)),y=n.some(g=>g.phase==="sending"),E=m.length>0&&!y;return l.jsxs("section",{className:"cw-ab-workspace","aria-label":"A/B 调试工作台",children:[l.jsx("div",{className:"cw-ab-stage",children:e?l.jsxs("div",{className:"cw-ab-grid",children:[n.map((g,x)=>{const b=g.modelName.trim(),_=g.description.trim(),k=g.instruction.trim(),N=ql(g),C=!!(b&&_&&k&&n.findIndex(T=>ql(T)===N)!==x),S=!b||!_||!k||C,A=!!(g.runtimeSnapshot&&g.runtimeSnapshot!==rg(r,g)),O=g.phase==="starting",D=g.phase==="ready"&&!A,U=O||g.phase==="sending",X=U||g.configOpen||S,M=b?_?k?C?"该配置与已有测试组相同":"":"请填写系统提示词":"请填写描述":"请先选择模型",j=O?"正在启动":A?"应用配置并重启":D||g.phase==="error"?"重新启动环境":"启动环境";return l.jsx("article",{className:"cw-ab-card",children:l.jsxs("div",{className:`cw-ab-card-inner${g.configOpen?" is-flipped":""}`,children:[l.jsxs("section",{className:"cw-ab-card-face cw-ab-card-front","aria-hidden":g.configOpen,children:[l.jsxs("header",{className:"cw-ab-card-head",children:[l.jsxs("div",{className:"cw-ab-card-title",children:[l.jsx("strong",{children:g.name}),l.jsx("span",{children:g.modelName||"默认模型"})]}),l.jsxs("div",{className:"cw-ab-card-actions",children:[l.jsx("button",{type:"button",className:"cw-ab-config-trigger",disabled:g.configOpen||U,onClick:()=>f(g.id),children:"测试配置"}),g.id!=="baseline"&&l.jsx("button",{type:"button",className:"cw-ab-remove","aria-label":`删除${g.name}`,disabled:g.configOpen||U,onClick:()=>d(g.id),children:l.jsx(ea,{className:"cw-i"})})]})]}),l.jsx("div",{className:"cw-ab-conversation",children:g.error?l.jsx(tg,{message:g.error,className:"cw-debug-error-detail",onRetry:async()=>{await o(g.id)}}):O?l.jsxs("div",{className:"cw-ab-empty cw-ab-starting",children:[l.jsx(Rt,{className:"cw-i cw-spin"}),l.jsx("span",{children:"正在创建独立测试环境"})]}):A?l.jsxs("div",{className:"cw-ab-empty cw-ab-launch",children:[l.jsx("span",{children:"配置已变更,请重新启动此环境"}),l.jsxs("button",{type:"button",className:"cw-ab-start",disabled:X,onClick:()=>o(g.id),children:[l.jsx(z1,{className:"cw-i"}),j]})]}):g.messages.length===0?l.jsxs("div",{className:"cw-ab-empty cw-ab-launch",children:[l.jsxs("button",{type:"button",className:"cw-ab-start",disabled:X,title:M||void 0,onClick:()=>o(g.id),children:[D?l.jsx(z1,{className:"cw-i"}):l.jsx(Oge,{className:"cw-i cw-debug-run-icon"}),j]}),M?l.jsx("span",{className:"cw-ab-launch-hint",children:M}):D?l.jsx("span",{className:"cw-ab-launch-hint",children:"等待测试输入"}):null]}):g.messages.map((T,L)=>l.jsx("div",{className:`cw-debug-msg cw-debug-msg-${T.role}`,children:l.jsx("div",{className:"cw-debug-content",children:T.role==="user"?T.content:T.error?l.jsx(tg,{message:T.error,className:"cw-debug-msg-error"}):T.blocks&&T.blocks.length>0?l.jsx(Wv,{blocks:T.blocks,onAction:()=>{}}):T.content?T.content:L===g.messages.length-1&&g.phase==="sending"?l.jsx(W4,{}):null})},L))}),l.jsx("footer",{className:"cw-ab-deploy-footer",children:l.jsx("button",{type:"button",className:"cw-ab-deploy",disabled:U||!b,onClick:()=>c(g.id),children:"部署该配置"})})]}),l.jsxs("section",{className:"cw-ab-card-face cw-ab-card-back","aria-hidden":!g.configOpen,children:[l.jsxs("header",{className:"cw-ab-config-head",children:[l.jsxs("div",{children:[l.jsx("strong",{children:"测试配置"}),l.jsx("span",{children:g.name})]}),l.jsxs("span",{className:`cw-ab-config-done-wrap${M?" is-disabled":""}`,tabIndex:M?0:void 0,children:[l.jsx("button",{type:"button",className:"cw-ab-config-done",disabled:!g.configOpen||S,onClick:()=>h(g.id),children:g.id==="baseline"?"完成配置":"完成并启动"}),M&&l.jsx("span",{className:"cw-ab-config-done-tip",role:"tooltip",children:M})]})]}),l.jsxs("div",{className:"cw-ab-config",children:[l.jsxs("label",{children:[l.jsx("span",{children:"模型"}),l.jsx("input",{value:g.modelName,placeholder:"使用 Agent 当前模型",disabled:!g.configOpen,onChange:T=>p(g.id,"modelName",T.target.value)})]}),l.jsxs("label",{children:[l.jsx("span",{children:"描述"}),l.jsx("textarea",{rows:2,value:g.description,disabled:!g.configOpen,onChange:T=>p(g.id,"description",T.target.value)})]}),l.jsxs("label",{children:[l.jsx("span",{children:"系统提示词"}),l.jsx("textarea",{rows:5,value:g.instruction,disabled:!g.configOpen,onChange:T=>p(g.id,"instruction",T.target.value)})]}),l.jsxs("fieldset",{className:"cw-ab-optimizations-disabled",children:[l.jsxs("legend",{children:[l.jsx("span",{children:"优化选项"}),l.jsx("em",{children:"待开放"})]}),l.jsx("div",{className:"cw-ab-optimization-list",children:o5.map(T=>l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",checked:g.optimizations.includes(T.id),disabled:!0}),l.jsx("span",{children:T.label})]},T.id))})]}),l.jsx("p",{children:"设置完成后返回正面,再启动当前测试环境。"})]})]})]})},g.id)}),n.length<3&&l.jsxs("button",{type:"button",className:"cw-ab-add",onClick:u,children:[l.jsx(rr,{className:"cw-i"}),l.jsx("strong",{children:"添加对照组"}),l.jsx("span",{children:"最多同时创建 3 个测试组"})]})]}):l.jsx("div",{className:"cw-debug-empty",children:t})}),l.jsx("div",{className:"cw-ab-composer",children:l.jsxs("div",{className:"cw-debug-composerbox",children:[l.jsx("textarea",{className:"cw-debug-input",rows:1,value:s,placeholder:E?"输入测试消息,将发送到所有已启动测试组...":"请先启动至少一个测试组",disabled:!E,onChange:g=>i(g.target.value),onKeyDown:g=>{G4(g.nativeEvent)||g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),a())}}),l.jsx("button",{type:"button",className:"cw-debug-send",title:"发送",disabled:!E||!s.trim(),onClick:a,children:y?l.jsx(Rt,{className:"cw-i cw-spin"}):l.jsx(xL,{className:"cw-i"})})]})})]})}const cC=[{id:"build",label:"构建"},{id:"validate",label:"调试"},{id:"publish",label:"发布"}],o5=[{id:"context",label:"上下文优化",description:"压缩历史对话,保留与当前任务相关的信息"},{id:"grounding",label:"幻觉抑制",description:"对不确定内容要求依据,并明确表达未知"},{id:"tools",label:"工具调用优化",description:"减少重复调用,优先复用可信的工具结果"},{id:"latency",label:"响应加速",description:"缓存稳定上下文,降低重复推理开销"}];function Gge({mode:e,agentName:t,busy:n,onChange:r,onDiscard:s}){const i=cC.findIndex(a=>a.id===e);return l.jsxs("header",{className:"cw-workspace-header",children:[l.jsx("div",{className:"cw-workspace-identity",children:l.jsx("strong",{title:t,children:t||"未命名 Agent"})}),l.jsx("nav",{className:"cw-workspace-stepper","aria-label":"Agent 创建步骤",children:cC.map((a,o)=>{const c=a.id===e,u=or(a.id),children:l.jsx("strong",{children:a.label})},a.id)})}),s&&l.jsx("div",{className:"cw-workspace-actions",children:l.jsx("button",{type:"button",className:"cw-discard-edit",disabled:n,onClick:s,children:"放弃编辑"})})]})}function qge({onBack:e,onCreate:t,onAgentAdded:n,initialDraft:r,features:s,onDeploymentTaskChange:i,deploymentTarget:a,onDeploymentComplete:o,onDeploymentStarted:c,onDraftChange:u,onDiscard:d}){var cs,Kr,qa,Xa,Qa,Si,Hn,Za,Ti,Qf,Zf,rl,sl,il,Jf;const[f,h]=w.useState(()=>r??Sr()),p=w.useRef(JSON.stringify(f)),m=w.useRef(p.current),y=JSON.stringify(f),E=y!==p.current,g=w.useRef(u);w.useEffect(()=>{g.current=u},[u]),w.useEffect(()=>{var q;y!==m.current&&(m.current=y,(q=g.current)==null||q.call(g,f,E))},[f,E,y]);const[x,b]=w.useState("build"),[_,k]=w.useState(!1),[N,C]=w.useState(!1),[S,A]=w.useState(0),[O,D]=w.useState(null),[U,X]=w.useState(!1),[M,j]=w.useState((a==null?void 0:a.region)??"cn-beijing"),T=(s==null?void 0:s.generatedAgentTestRun)===!0,L=(s==null?void 0:s.generatedAgentTestRunDisabledReason)||"当前后端暂不支持生成 Agent 调试运行。",[R,F]=w.useState(()=>[{id:"baseline",name:"基准组",modelName:(r??Sr()).modelName??"",description:(r??Sr()).description,instruction:(r??Sr()).instruction,optimizations:[],configOpen:!1,phase:"idle",runtimeSnapshot:"",messages:[],error:null}]),[I,V]=w.useState("baseline"),W=w.useRef(1),P=w.useRef(new Map),[ie,G]=w.useState(0),[re,ue]=w.useState(""),[ee,le]=w.useState("basic"),[ne,me]=w.useState(""),[ye,te]=w.useState(!1),[de,Ee]=w.useState(!1),[Te,Ke]=w.useState(!1),[Ne,it]=w.useState(!1),[He,Ue]=w.useState([]),Et=w.useRef(null),rt=w.useRef({});w.useEffect(()=>()=>{for(const{run:q}of P.current.values())Uu(q.runId).catch(pe=>console.warn("清理调试运行失败",pe));P.current.clear()},[]);const St=w.useRef(null);St.current||(St.current=({meta:q,children:pe})=>l.jsxs("section",{ref:ve=>{rt.current[q.id]=ve},id:`cw-sec-${q.id}`,"data-step-id":q.id,className:"cw-section",children:[l.jsx("header",{className:"cw-sec-head",children:l.jsxs("h2",{className:"cw-sec-title",children:[q.label,q.required&&l.jsx("span",{className:"cw-sec-required",children:"必填"})]})}),pe]}));const ct=Uge(f,He)?He:[],B=ip(f,ct),Q=ct.length===0,oe=`cw-model-advanced-${ct.join("-")||"root"}`,be=`cw-a2a-registry-advanced-${ct.join("-")||"root"}`,Oe=`cw-more-tool-types-${ct.join("-")||"root"}`,Ye=`cw-advanced-config-${ct.join("-")||"root"}`,tt=q=>h(pe=>qf(pe,ct,ve=>({...ve,...q}))),ze=(q,pe)=>h(ve=>{var Qe;return{...ve,deployment:{...ve.deployment??{feishuEnabled:!1},envValues:{...((Qe=ve.deployment)==null?void 0:Qe.envValues)??{},[q]:pe}}}}),Tt=q=>tt({a2aRegistry:{...B.a2aRegistry??{enabled:!1,registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},...q}}),Re=(q,pe)=>{if(!(q in aC))return;const ve=aC[q];Tt({[ve]:pe}),ze(q,pe)},kt=q=>{if(!(Q&&q==="a2a")){if(q==="a2a"){tt({agentType:q,a2aRegistry:{...B.a2aRegistry??{registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},enabled:!0}});return}tt({agentType:q,a2aRegistry:B.a2aRegistry?{...B.a2aRegistry,enabled:!1}:void 0})}},Pt=(q,pe)=>{h(q),pe&&Ue(pe)},Bt=q=>{const pe=ip(f,q);if(!qE(pe)||q.length>=lC)return;const ve=$ge(f,q),Qe=ip(ve,q).subAgents.length-1;Pt(ve,[...q,Qe])},bn=(q,pe)=>{const ve=ip(f,q);if(!qE(ve)||q.length>=lC)return;const Qe=Math.max(0,Math.min(pe,ve.subAgents.length)),Mt=Hge(f,q,Qe);Pt(Mt,[...q,Qe])},Xe=()=>{window.confirm("清空根 Agent 的全部配置和子 Agent?此操作无法撤销。")&&(h(Sr()),Ue([]),C(!1),it(!1))},ft=q=>{if(q.length===0){Xe();return}Pt(zge(f,q),q.slice(0,-1))},xt=B.builtinTools??[],vt=B.mcpTools??[],fe=B.tracingExporters??[],$e=B.selectedSkills??[],nt=[B.memory.shortTerm,B.memory.longTerm,B.tracing].filter(Boolean).length,qt=q=>tt({builtinTools:xt.includes(q)?xt.filter(pe=>pe!==q):[...xt,q]}),fn=q=>{const pe=fe.includes(q)?fe.filter(ve=>ve!==q):[...fe,q];tt({tracingExporters:pe,tracing:pe.length>0?!0:B.tracing})},Lt=Y6(B.agentType),J=E0(B.agentType),he=w.useMemo(()=>K6(f),[f]),Le=J?null:cc(B.name)??(he.has(B.name)?"Agent 名称在当前结构中必须唯一":null),Be=Le!==null,ot=!J&&B.description.trim().length===0,It=B.instruction.trim().length===0,st=J&&!((cs=B.a2aRegistry)!=null&&cs.registrySpaceId.trim()),Z=q=>N&&q?`is-error cw-error-shake-${S%2}`:"",we=w.useMemo(()=>n5(f,he),[f,he]),_e=we.length===0,We=w.useMemo(()=>Yge(f),[f]),Ve=R.find(q=>q.id===I)??R[0],Je=w.useMemo(()=>s5(f),[f]),ut=w.useMemo(()=>{var q,pe,ve,Qe;return{type:!0,basic:J?!st:!Be&&(Lt||!It),model:!!((q=B.modelName)!=null&&q.trim()||(pe=B.modelProvider)!=null&&pe.trim()||(ve=B.modelApiBase)!=null&&ve.trim()),tools:xt.length>0||vt.length>0,skills:$e.length>0,knowledge:B.knowledgebase,advanced:B.memory.shortTerm||B.memory.longTerm||B.tracing,subagents:(((Qe=B.subAgents)==null?void 0:Qe.length)??0)>0,review:_e}},[B,Be,It,Lt,J,_e,xt,vt,$e]),Ft=Lt||J?["type","basic"]:["type","basic","model","tools","skills","knowledge",...Q?["advanced"]:[]],hn=sC.filter(q=>Ft.includes(q.id)),Tn=Ft.join("|"),Kt=ct.join("."),os=hn.findIndex(q=>q.id===ee),Er=q=>{var pe;(pe=rt.current[q])==null||pe.scrollIntoView({behavior:"smooth",block:"start"})};w.useEffect(()=>{if(O)return;const q=Et.current;if(!q)return;const pe=Tn.split("|");let ve=0;const Qe=()=>{ve=0;const rn=pe[pe.length-1];let pn=pe[0];if(q.scrollTop+q.clientHeight>=q.scrollHeight-2)pn=rn;else{const Mn=q.getBoundingClientRect().top+24;for(const Cn of pe){const In=rt.current[Cn];if(!In||In.getBoundingClientRect().top>Mn)break;pn=Cn}}pn&&le(Mn=>Mn===pn?Mn:pn)},Mt=()=>{ve||(ve=window.requestAnimationFrame(Qe))};return Qe(),q.addEventListener("scroll",Mt,{passive:!0}),window.addEventListener("resize",Mt),()=>{q.removeEventListener("scroll",Mt),window.removeEventListener("resize",Mt),ve&&window.cancelAnimationFrame(ve)}},[O,Tn,Kt]);const Xn=()=>_e?!0:(C(!0),A(q=>q+1),we[0]&&(Ue(we[0].path),window.requestAnimationFrame(()=>Er("basic"))),!1),Or=async()=>{const q=[...P.current.values()];P.current.clear(),G(0),F(pe=>pe.map(ve=>({...ve,phase:"idle",runtimeSnapshot:"",messages:[],error:null}))),await Promise.all(q.map(async({run:pe})=>{try{await Uu(pe.runId)}catch(ve){console.warn("清理调试运行失败",ve)}}))},Qn=async q=>{const pe=P.current.get(q);if(pe){P.current.delete(q),G(P.current.size);try{await Uu(pe.run.runId)}catch(ve){console.warn("清理调试运行失败",ve)}}},ar=async()=>x!=="validate"||ie===0?!0:window.confirm("离开调试页面后,当前环境将被清理。您可以通过重新启动环境进行新的测试。")?(await Or(),!0):!1,An=async q=>{if(await ar()){if(me(""),!Xn()){b("build");return}X(!0);try{const pe=q?R.find(Mt=>Mt.id===q):Ve;pe&&V(pe.id);const ve=pe?{...f,modelName:pe.modelName||f.modelName,description:pe.description,instruction:pe.instruction}:f,Qe=await Hw(i5(ve));ve!==f&&h(ve),D(Qe),b("publish")}catch(pe){me(pe instanceof Error?pe.message:String(pe))}finally{X(!1)}}},Xt=async q=>{if(!T||U||!Xn())return;const pe=R.find(Ct=>Ct.id===q);if(!pe||pe.phase==="starting"||pe.phase==="sending")return;const ve=pe.modelName.trim(),Qe=pe.description.trim(),Mt=pe.instruction.trim(),rn=ql(pe),pn=R.findIndex(Ct=>Ct.id===q),Mn=R.findIndex(Ct=>ql(Ct)===rn);if(!ve||!Qe||!Mt||Mn!==pn)return;const Cn=rg(We,pe);F(Ct=>Ct.map(lr=>lr.id===q?{...lr,configOpen:!1,phase:"starting",messages:[],error:null}:lr)),ue("");let In=null;try{await Qn(q);const Ct={...f,modelName:pe.modelName||f.modelName,description:pe.description,instruction:pe.instruction};In=await fM(a5(Ct));const lr=await hM(In.runId,"test_user");P.current.set(q,{run:In,sessionId:lr}),G(P.current.size),F(sn=>sn.map(au=>au.id===q?{...au,phase:"ready",runtimeSnapshot:Cn}:au))}catch(Ct){if(In)try{await Uu(In.runId)}catch(lr){console.warn("清理调试运行失败",lr)}F(lr=>lr.map(sn=>sn.id===q?{...sn,phase:"error",runtimeSnapshot:"",error:Ct instanceof Error?Ct.message:String(Ct)}:sn))}},En=async()=>{const q=re.trim(),pe=R.filter(Qe=>Qe.phase==="ready"&&Qe.runtimeSnapshot===rg(We,Qe)&&P.current.has(Qe.id));if(!q||pe.length===0)return;ue("");const ve=new Set(pe.map(Qe=>Qe.id));F(Qe=>Qe.map(Mt=>ve.has(Mt.id)?{...Mt,phase:"sending",messages:[...Mt.messages,{role:"user",content:q},{role:"assistant",content:"",blocks:[]}]}:Mt)),await Promise.all(pe.map(async Qe=>{const Mt=P.current.get(Qe.id);if(Mt)try{let rn=zs();for await(const pn of pM({runId:Mt.run.runId,userId:"test_user",sessionId:Mt.sessionId,text:q})){const Mn=pn.error||pn.errorMessage||pn.error_message;if(F(Cn=>Cn.map(In=>{if(In.id!==Qe.id)return In;const Ct=[...In.messages],lr={...Ct[Ct.length-1]};return Mn?lr.error=String(Mn):(rn=xc(rn,pn),lr.content=rn.blocks.filter(sn=>sn.kind==="text").map(sn=>sn.text).join(""),lr.blocks=rn.blocks),Ct[Ct.length-1]=lr,{...In,messages:Ct}})),Mn)break}}catch(rn){F(pn=>pn.map(Mn=>{if(Mn.id!==Qe.id)return Mn;const Cn=[...Mn.messages],In={...Cn[Cn.length-1]};return In.error=rn instanceof Error?rn.message:String(rn),Cn[Cn.length-1]=In,{...Mn,messages:Cn}}))}finally{F(rn=>rn.map(pn=>pn.id===Qe.id?{...pn,phase:"ready"}:pn))}}))},Un=()=>{F(q=>{if(q.length>=3)return q;const pe=W.current++,ve=`variant-${pe}`;return[...q,{id:ve,name:`对照组 ${pe}`,modelName:f.modelName??"",description:f.description,instruction:f.instruction,optimizations:[],configOpen:!0,phase:"idle",runtimeSnapshot:"",messages:[],error:null}]})},or=async q=>{await Qn(q),F(pe=>pe.filter(ve=>ve.id!==q)),I===q&&V("baseline")},nn=(q,pe)=>F(ve=>ve.map(Qe=>Qe.id===q?{...Qe,...pe}:Qe)),ls=(q,pe,ve)=>{nn(q,{[pe]:ve}),!(I!==q||q==="baseline")&&V("baseline")},Zn=q=>{const pe=R.find(Cn=>Cn.id===q);if(!pe)return;const ve=pe.modelName.trim(),Qe=pe.description.trim(),Mt=pe.instruction.trim(),rn=ql(pe),pn=R.findIndex(Cn=>Cn.id===q),Mn=R.findIndex(Cn=>ql(Cn)===rn);if(!(!ve||!Qe||!Mt||Mn!==pn)){if(q==="baseline"){nn(q,{configOpen:!1});return}Xt(q)}},$n=async(q,pe,ve)=>{var rn;const Qe=(rn=f.deployment)==null?void 0:rn.network,Mt=Qe&&Qe.mode&&Qe.mode!=="public"?{mode:Qe.mode,vpc_id:Qe.vpcId,subnet_ids:Qe.subnetIds,enable_shared_internet_access:Qe.enableSharedInternetAccess}:void 0;return Lg(q.name,q.files,{region:(a==null?void 0:a.region)??M,projectName:"default",network:Mt},{...ve,onStage:pe,runtimeId:a==null?void 0:a.runtimeId,description:f.description})},Jn=()=>{Xn()&&(F(q=>q.map(pe=>pe.id==="baseline"&&!P.current.has(pe.id)?{...pe,modelName:f.modelName??"",description:f.description,instruction:f.instruction}:pe)),b("validate"))},Is=async q=>{if(q==="publish"){O?b("publish"):An();return}if(q==="validate"){Jn();return}await ar()&&b(q)},Rr=St.current,xr=q=>sC.find(pe=>pe.id===q);return l.jsxs("div",{className:"cw-root",children:[l.jsx(Gge,{mode:x,agentName:Kge(f),busy:U,onChange:Is,onDiscard:d?()=>{E?k(!0):d()}:void 0}),ne&&l.jsx("div",{className:"cw-workspace-alert",role:"alert",children:ne}),l.jsxs("main",{className:"cw-workspace-main",id:"cw-workspace-main",children:[x==="build"&&l.jsxs("div",{className:"cw-editor",children:[l.jsx(Qm,{draft:f,direction:"vertical",selectedPath:ct,onSelect:Ue,onAdd:Bt,onInsert:bn,onDelete:ft}),l.jsxs("div",{className:"cw-detail",children:[l.jsx("div",{className:"cw-detail-scroll",ref:Et,children:l.jsx("div",{className:"cw-detail-inner",children:l.jsxs("div",{className:"cw-lower",children:[l.jsxs("div",{className:"cw-form-col",children:[l.jsx(Rr,{meta:xr("type"),children:l.jsx("div",{className:"cw-agent-type-options",role:"radiogroup","aria-label":"Agent 类型",children:lge.map(q=>{const pe=(B.agentType??"llm")===q.id,ve=Q&&q.id==="a2a",Qe=ve?"cw-remote-agent-disabled-hint":void 0;return l.jsxs("label",{"data-agent-type":q.id,className:`cw-agent-type-option ${pe?"is-on":""} ${ve?"is-disabled":""}`,title:ve?void 0:iC[q.id],tabIndex:ve?0:void 0,"aria-describedby":Qe,children:[l.jsx("input",{type:"radio",name:"agentType",className:"cw-agent-type-radio",checked:pe,disabled:ve,onChange:()=>kt(q.id)}),l.jsxs("span",{className:"cw-agent-type-copy",children:[l.jsx("strong",{children:Rge[q.id]}),l.jsx("small",{children:iC[q.id]})]}),ve&&l.jsx("span",{id:Qe,className:"cw-agent-type-disabled-hint",role:"tooltip",children:"远程智能体只能作为子步骤使用"})]},q.id)})})}),l.jsx(Rr,{meta:xr("basic"),children:l.jsxs("div",{className:"cw-form",children:[!J&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"cw-field",children:[l.jsxs("label",{className:"cw-label",children:[Q?"Agent 名称":"步骤名称",l.jsx("span",{className:"cw-req",children:"*"})]}),l.jsx("input",{className:`cw-input ${Z(Be)}`,value:B.name,placeholder:"customer_service",onChange:q=>tt({name:q.target.value})}),N&&Le?l.jsx("span",{className:"cw-error-text",children:Le}):l.jsx("span",{className:"cw-help",children:"遵循 Google ADK 命名规则,且在执行流程中保持唯一。"})]}),l.jsxs("div",{className:"cw-field",children:[l.jsxs("label",{className:"cw-label",children:[Q?"描述":"任务说明",l.jsx("span",{className:"cw-req",children:"*"})]}),l.jsx("textarea",{className:`cw-textarea cw-textarea-sm ${Z(ot)}`,value:B.description,placeholder:"简要描述这个 Agent 的用途,便于团队识别…",onChange:q=>tt({description:q.target.value})}),N&&ot?l.jsx("span",{className:"cw-error-text",children:"描述为必填项"}):l.jsx("span",{className:"cw-help",children:"描述会显示在 Agent 列表与选择器中。"})]})]}),Lt?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"cw-section-desc",children:"这是一个协作容器,本身不生成回答。请在左侧画布中 添加任务步骤,并通过拖拽调整它们的位置。"}),B.agentType==="loop"&&l.jsxs("div",{className:"cw-field",children:[l.jsx("label",{className:"cw-label",children:"最大轮次"}),l.jsx("input",{className:"cw-input",type:"number",min:1,value:B.maxIterations??3,onChange:q=>tt({maxIterations:Math.max(1,Number(q.target.value)||1)})}),l.jsx("span",{className:"cw-help",children:"循环编排反复执行子 Agent,直到满足条件或达到该轮次上限。"})]})]}):J?l.jsxs("div",{className:"cw-field cw-remote-center-fields",children:[l.jsxs("div",{className:"cw-remote-center-head",children:[l.jsxs("div",{className:"cw-label",children:["AgentKit 智能体中心",l.jsx("span",{className:"cw-req",children:"*"})]}),l.jsx("p",{className:"cw-help cw-remote-center-description",children:"远程 Agent 的名称、描述和能力来自中心返回的 Agent Card。 系统会根据每轮任务动态发现并挂载匹配的 Agent。"})]}),l.jsx(jge,{value:((Kr=B.a2aRegistry)==null?void 0:Kr.registrySpaceId)??"",region:((qa=B.a2aRegistry)==null?void 0:qa.registryRegion)||qs.region,invalid:N&&st,onChange:q=>Re(J6,q)}),l.jsxs("button",{type:"button",className:"cw-more-options","aria-expanded":de,"aria-controls":be,onClick:()=>Ee(q=>!q),children:[l.jsx("span",{children:"更多选项"}),l.jsx(ws,{className:`cw-more-options-chevron ${de?"is-open":""}`,"aria-hidden":!0})]}),l.jsx(pi,{initial:!1,children:de&&l.jsx($t.div,{id:be,className:"cw-model-advanced",initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.18,ease:"easeOut"},children:l.jsx(bl,{env:Lge,values:e5(B.a2aRegistry,{includeDefaults:!1}),onChange:Re})})}),N&&st&&l.jsx("span",{className:"cw-error-text",children:"请选择 AgentKit 智能体中心"})]}):l.jsxs("div",{className:"cw-field",children:[l.jsxs("label",{className:"cw-label",children:["系统提示词",l.jsx("span",{className:"cw-req",children:"*"})]}),l.jsx(w.Suspense,{fallback:l.jsx("div",{className:"cw-markdown-loading",role:"status",children:"正在加载 Markdown 编辑器…"}),children:l.jsx(Cge,{value:B.instruction,invalid:It,onChange:q=>tt({instruction:q})})}),N&&It?l.jsx("span",{className:"cw-error-text",children:"系统提示词为必填项"}):l.jsx("span",{className:"cw-help",children:"支持 Markdown 快捷输入,例如键入 ## 加空格创建二级标题。"})]})]})}),!Lt&&!J&&l.jsxs(l.Fragment,{children:[l.jsx(Rr,{meta:xr("model"),children:l.jsxs("div",{className:"cw-form",children:[l.jsxs("div",{className:"cw-field",children:[l.jsx("label",{className:"cw-label",children:"模型名称"}),l.jsx("input",{className:"cw-input",value:B.modelName??"",placeholder:"doubao-seed-2-1-pro-260628",onChange:q=>tt({modelName:q.target.value})})]}),l.jsxs("button",{type:"button",className:"cw-more-options","aria-expanded":ye,"aria-controls":oe,onClick:()=>te(q=>!q),children:[l.jsx("span",{children:"更多选项"}),l.jsx(ws,{className:`cw-more-options-chevron ${ye?"is-open":""}`,"aria-hidden":!0})]}),l.jsx(pi,{initial:!1,children:ye&&l.jsxs($t.div,{id:oe,className:"cw-model-advanced",initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.18,ease:"easeOut"},children:[l.jsxs("div",{className:"cw-field",children:[l.jsx("label",{className:"cw-label",children:"服务商 Provider"}),l.jsx("input",{className:"cw-input",value:B.modelProvider??"",placeholder:"openai",onChange:q=>tt({modelProvider:q.target.value})})]}),l.jsxs("div",{className:"cw-field",children:[l.jsx("label",{className:"cw-label",children:"API Base"}),l.jsx("input",{className:"cw-input",value:B.modelApiBase??"",placeholder:"https://ark.cn-beijing.volces.com/api/v3/",onChange:q=>tt({modelApiBase:q.target.value})}),l.jsx("span",{className:"cw-help",children:"留空则使用 VeADK 默认模型配置;Ark API Key 会由 Studio 服务端凭据自动获取。其他服务商的 Key 可在部署页添加。"})]})]})})]})}),l.jsx(Rr,{meta:xr("tools"),children:l.jsxs("div",{className:"cw-form",children:[l.jsxs("div",{className:"cw-field",children:[l.jsx("label",{className:"cw-label",children:"内置工具"}),l.jsx("span",{className:"cw-help",children:"勾选 VeADK 提供的内置能力,生成时会自动补全 import 与所需环境变量。"}),l.jsx("div",{className:"cw-tools-list-shell",children:l.jsx(oC,{items:_c,selected:xt,onToggle:qt,scrollRows:6})}),l.jsx(pi,{initial:!1,children:xt.includes("run_code")&&l.jsxs($t.div,{className:"cw-tool-config",initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.16,ease:"easeOut"},children:[l.jsxs("div",{className:"cw-tool-config-head",children:[l.jsx("span",{className:"cw-label",children:"代码执行配置"}),l.jsx("span",{className:"cw-help",children:"指定 AgentKit 代码执行沙箱。"})]}),l.jsx(bl,{env:((Xa=_c.find(q=>q.id==="run_code"))==null?void 0:Xa.env)??[],values:((Qa=f.deployment)==null?void 0:Qa.envValues)??{},onChange:ze})]})})]}),l.jsxs("button",{type:"button",className:"cw-more-options","aria-expanded":Te,"aria-controls":Oe,onClick:()=>Ke(q=>!q),children:[l.jsx("span",{children:"更多类型工具"}),vt.length>0&&l.jsxs("span",{className:"cw-more-options-count",children:["已配置 ",vt.length]}),l.jsx(ws,{className:`cw-more-options-chevron ${Te?"is-open":""}`,"aria-hidden":!0})]}),l.jsx(pi,{initial:!1,children:Te&&l.jsx($t.div,{id:Oe,className:"cw-model-advanced",initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.18,ease:"easeOut"},children:l.jsxs("div",{className:"cw-field",children:[l.jsx("label",{className:"cw-label",children:"MCP 工具"}),l.jsx("span",{className:"cw-help",children:"连接外部 MCP 服务,生成时会为每个条目创建对应的 MCPToolset。"}),l.jsx(Pge,{tools:vt,onChange:q=>tt({mcpTools:q})})]})})})]})}),l.jsx(Rr,{meta:xr("skills"),children:l.jsx("div",{className:"cw-form",children:l.jsx(Fge,{selected:$e,onChange:q=>tt({selectedSkills:q})})})}),l.jsx(Rr,{meta:xr("knowledge"),children:l.jsxs("div",{className:"cw-form cw-toggle-stack",children:[l.jsx(Ou,{checked:B.knowledgebase,onChange:q=>tt({knowledgebase:q}),title:"知识库",desc:"启用外部知识检索(RAG),让 Agent 基于你的资料作答。",icon:_p}),B.knowledgebase&&l.jsxs("div",{className:"cw-field cw-subfield",children:[l.jsx("label",{className:"cw-label",children:"知识库后端"}),l.jsx(mb,{options:eE,value:B.knowledgebaseBackend,onChange:q=>tt({knowledgebaseBackend:q,knowledgebaseIndex:q==="viking"?B.knowledgebaseIndex:""})}),(B.knowledgebaseBackend??qd)==="viking"&&l.jsxs("div",{className:"cw-field cw-subfield",children:[l.jsx("label",{className:"cw-label",children:"VikingDB 知识库"}),l.jsx(Dge,{value:B.knowledgebaseIndex??"",onChange:q=>tt({knowledgebaseIndex:q})})]}),l.jsx(bl,{env:((Si=eE.find(q=>q.id===(B.knowledgebaseBackend??qd)))==null?void 0:Si.env)??[],values:((Hn=f.deployment)==null?void 0:Hn.envValues)??{},onChange:ze})]})]})}),Q&&l.jsxs("section",{ref:q=>{rt.current.advanced=q},id:"cw-sec-advanced","data-step-id":"advanced",className:"cw-section cw-advanced-section",children:[l.jsxs("button",{type:"button",className:"cw-advanced-disclosure","aria-expanded":Ne,"aria-controls":Ye,onClick:()=>it(q=>!q),children:[l.jsx("span",{className:"cw-advanced-disclosure-title",children:"进阶配置"}),l.jsx(ws,{className:`cw-advanced-disclosure-chevron ${Ne?"is-open":""}`,"aria-hidden":!0}),nt>0&&l.jsxs("span",{className:"cw-more-options-count",children:["已启用 ",nt]})]}),l.jsx(pi,{initial:!1,children:Ne&&l.jsxs($t.div,{id:Ye,className:"cw-advanced-content",initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeOut"},children:[l.jsxs("div",{className:"cw-advanced-group",children:[l.jsx("div",{className:"cw-advanced-group-head",children:l.jsx("span",{children:"记忆"})}),l.jsxs("div",{className:"cw-form cw-toggle-stack",children:[l.jsx(Ou,{checked:B.memory.shortTerm,onChange:q=>tt({memory:{...B.memory,shortTerm:q}}),title:"短期记忆",desc:"在单次会话内保留上下文,跨轮次记住对话内容。",icon:CL}),B.memory.shortTerm&&l.jsxs("div",{className:"cw-field cw-subfield",children:[l.jsx("label",{className:"cw-label",children:"短期记忆后端"}),l.jsx(mb,{options:Z1,value:B.shortTermBackend,onChange:q=>tt({shortTermBackend:q})}),l.jsx(bl,{env:((Za=Z1.find(q=>q.id===(B.shortTermBackend??"local")))==null?void 0:Za.env)??[],values:((Ti=f.deployment)==null?void 0:Ti.envValues)??{},onChange:ze})]}),l.jsx(Ou,{checked:B.memory.longTerm,onChange:q=>tt({memory:{...B.memory,longTerm:q}}),title:"长期记忆",desc:"跨会话持久化关键信息,让 Agent 记住历史偏好。",icon:_p}),B.memory.longTerm&&l.jsxs("div",{className:"cw-field cw-subfield",children:[l.jsx("label",{className:"cw-label",children:"长期记忆后端"}),l.jsx(mb,{options:J1,value:B.longTermBackend,onChange:q=>tt({longTermBackend:q})}),l.jsx(bl,{env:((Qf=J1.find(q=>q.id===(B.longTermBackend??"local")))==null?void 0:Qf.env)??[],values:((Zf=f.deployment)==null?void 0:Zf.envValues)??{},onChange:ze}),l.jsx(Ou,{checked:!!B.autoSaveSession,onChange:q=>tt({autoSaveSession:q}),title:"自动保存会话到长期记忆",desc:"会话结束时自动把内容写入长期记忆,无需手动调用。",icon:_p})]})]})]}),l.jsxs("div",{className:"cw-advanced-group",children:[l.jsx("div",{className:"cw-advanced-group-head",children:l.jsx("span",{children:"观测"})}),l.jsxs("div",{className:"cw-form cw-toggle-stack",children:[l.jsx(Ou,{checked:B.tracing,onChange:q=>tt({tracing:q}),title:"观测 / Tracing",desc:"记录每一步的调用链路与耗时,便于调试与性能分析。",icon:kL}),B.tracing&&l.jsxs("div",{className:"cw-field cw-subfield",children:[l.jsx("label",{className:"cw-label",children:"Tracing 导出器"}),l.jsx("span",{className:"cw-help",children:"选择一个或多个观测平台,生成时会写入对应的 ENABLE_* 开关与环境变量。"}),l.jsx(oC,{items:tE,selected:fe,onToggle:fn}),l.jsx(bl,{env:tE.filter(q=>fe.includes(q.id)).flatMap(q=>q.env),values:((rl=f.deployment)==null?void 0:rl.envValues)??{},onChange:ze})]})]})]})]})})]})]})]}),l.jsx("nav",{className:"cw-rail","aria-label":"步骤导航",children:l.jsxs("ol",{className:"cw-steps",children:[l.jsx("div",{className:"cw-rail-track","aria-hidden":!0,children:l.jsx($t.div,{className:"cw-rail-fill",animate:{height:`${Math.max(os,0)/Math.max(hn.length-1,1)*100}%`},transition:{type:"spring",stiffness:260,damping:32}})}),hn.map(q=>{const pe=q.id===ee,ve=ut[q.id];return l.jsx("li",{children:l.jsxs("button",{type:"button",className:`cw-step ${pe?"is-active":""} ${ve?"is-done":""}`,onClick:()=>Er(q.id),"aria-current":pe?"step":void 0,"aria-label":q.label,children:[l.jsx("span",{className:"cw-step-marker","aria-hidden":!0,children:pe?l.jsx("span",{className:"cw-dot"}):ve?l.jsx(Js,{className:"cw-step-check"}):l.jsx("span",{className:"cw-dot"})}),l.jsx("span",{className:"cw-step-tooltip","aria-hidden":!0,children:q.label})]})},q.id)})]})})]})})}),l.jsx("button",{type:"button",className:"cw-build-next studio-update-action",onClick:Jn,children:l.jsx("span",{children:"开始调试"})})]})]}),x==="validate"&&l.jsx("div",{className:"cw-validation-workspace",children:l.jsx("div",{className:"cw-validation-content",children:l.jsx(Wge,{enabled:T,disabledReason:L,variants:R,draftSnapshot:We,input:re,onInput:ue,onSend:En,onStartVariant:Xt,onDeployVariant:q=>void An(q),onAddVariant:Un,onRemoveVariant:or,onToggleConfig:q=>{const pe=R.find(ve=>ve.id===q);pe&&nn(q,{configOpen:!pe.configOpen})},onCompleteConfig:Zn,onConfigChange:ls})})}),x==="publish"&&l.jsx("div",{className:"cw-preview-body",children:O?l.jsx(b0,{embedded:!0,project:O,agentDraft:f,agentName:f.name||"未命名 Agent",agentCount:r5(f),releaseConfiguration:Ve?{modelName:Ve.modelName||f.modelName||"默认模型",description:Ve.description,instruction:Ve.instruction,optimizations:Ve.optimizations.flatMap(q=>{const pe=o5.find(ve=>ve.id===q);return pe?[pe.label]:[]})}:void 0,onChange:D,onDeploy:$n,onAgentAdded:n,onDeploymentTaskChange:i,deploymentActionLabel:a?"更新并发布":"部署",deploymentRuntimeId:a==null?void 0:a.runtimeId,onDeploymentStarted:c,onDeploymentComplete:o,feishuEnabled:!!((sl=f.deployment)!=null&&sl.feishuEnabled),onFeishuEnabledChange:q=>{const pe={...f,deployment:{...f.deployment??{feishuEnabled:!1},feishuEnabled:q}};h(pe)},deploymentEnv:Je.specs,deploymentEnvValues:{...(il=f.deployment)==null?void 0:il.envValues,...Je.fixedValues},onDeploymentEnvChange:ze,network:(Jf=f.deployment)==null?void 0:Jf.network,onNetworkChange:q=>h(pe=>({...pe,deployment:{...pe.deployment??{feishuEnabled:!1},network:q}})),deployRegion:M,onDeployRegionChange:j,onExportYaml:()=>Ige(`${f.name||"agent"}.yaml`,Ome(f),"text/yaml")}):l.jsxs("div",{className:"cw-publish-loading",role:"status",children:[l.jsx(Rt,{className:"cw-i cw-spin"}),l.jsx("strong",{children:"正在生成发布配置"}),l.jsx("span",{children:"校验 Agent 结构并准备部署快照…"})]})})]}),_&&l.jsx("div",{className:"confirm-scrim",onClick:()=>k(!1),children:l.jsxs("div",{className:"confirm-box",role:"dialog","aria-modal":"true","aria-labelledby":"discard-edit-title",onClick:q=>q.stopPropagation(),children:[l.jsx("div",{className:"confirm-title",id:"discard-edit-title",children:"放弃本次编辑?"}),l.jsx("div",{className:"confirm-text",children:"本次修改将不会保留,智能体会恢复到进入编辑前的状态。"}),l.jsxs("div",{className:"confirm-actions",children:[l.jsx("button",{type:"button",className:"confirm-btn",onClick:()=>k(!1),children:"继续编辑"}),l.jsx("button",{type:"button",className:"confirm-btn confirm-btn--danger",onClick:()=>{k(!1),d==null||d()},children:"放弃编辑"})]})]})})]})}function ji(e){return{...Sr(),...e}}const Xge=[{id:"support",icon:RH,draft:ji({name:"客服助手",description:"7×24 在线答疑,结合知识库与历史对话,稳定、礼貌地解决用户问题。",instruction:"你是一名专业、耐心的客服助手。请始终保持礼貌、友好的语气,优先依据知识库中的资料回答用户问题;当资料不足以确定答案时,如实告知用户并主动引导其提供更多信息,切勿编造。回答尽量简洁、分点清晰,必要时给出操作步骤。",model:"doubao-1.5-pro-32k",knowledgebase:!0,memory:{shortTerm:!0,longTerm:!0}})},{id:"analyst",icon:mH,draft:ji({name:"数据分析师",description:"运行代码完成统计与可视化,开启链路追踪,分析过程可观测、可复现。",instruction:"你是一名严谨的数据分析师。面对数据问题时,先厘清分析目标与口径,再通过编写并运行代码完成清洗、统计与可视化。每一步都要说明你的假设与方法,给出结论时附上关键数据支撑,并指出潜在的偏差与局限。",model:"doubao-1.5-pro-32k",tools:["code_runner"],tracing:!0})},{id:"translator",icon:LH,draft:ji({name:"翻译助手",description:"中英互译,忠实、通顺、地道,保留原文语气与专业术语。",instruction:"你是一名专业的翻译助手,精通中英互译。请在忠实于原文含义的前提下,使译文自然、地道、符合目标语言表达习惯;保留专有名词与专业术语的准确性,并尽量贴合原文的语气与风格。仅输出译文,除非用户额外要求解释。",model:"doubao-1.5-pro-32k"})},{id:"coder",icon:Aw,draft:ji({name:"代码助手",description:"编写、调试与重构代码,可运行代码验证结果,给出清晰可维护的实现。",instruction:"你是一名资深软件工程师。请根据需求编写正确、清晰、可维护的代码,遵循目标语言的惯用风格与最佳实践。在不确定时通过运行代码验证你的实现,给出关键的边界条件与测试思路,并对复杂逻辑附上简要注释。",model:"doubao-1.5-pro-32k",tools:["code_runner","file_reader"],tracing:!0})},{id:"researcher",icon:FH,draft:ji({name:"研究员",description:"联网检索一手资料,结合知识库与长期记忆,输出有据可查的研究结论。",instruction:"你是一名严谨的研究员。面对研究问题时,先拆解关键子问题,再通过联网检索收集多个一手、可信的来源,交叉验证后再下结论。结论需注明出处与不确定性,区分事实与推断,避免以偏概全。",model:"doubao-1.5-pro-32k",tools:["web_search"],knowledgebase:!0,memory:{shortTerm:!0,longTerm:!0}})},{id:"research-team",icon:ZH,draft:ji({name:"多智能体研究团队",description:"由检索员、分析员、撰写员协作的研究编排,分工完成端到端调研报告。",instruction:"你是一支研究团队的总协调者。负责拆解用户的研究任务,将检索、分析、撰写分别委派给对应的子 Agent,汇总各子 Agent 的产出,把控整体质量,最终输出结构清晰、有据可查的研究报告。",model:"doubao-1.5-pro-32k",tracing:!0,memory:{shortTerm:!0,longTerm:!0},subAgents:[ji({name:"检索员",description:"联网搜集与课题相关的一手资料与数据。",instruction:"你是研究团队中的检索员。根据课题联网检索多个可信来源,整理出关键事实、数据与原文出处,交付给分析员,不做主观结论。",tools:["web_search"]}),ji({name:"分析员",description:"对检索到的材料做交叉验证与归纳分析。",instruction:"你是研究团队中的分析员。对检索员提供的材料做交叉验证、归纳与对比,提炼洞见、识别矛盾与不确定性,形成结构化的分析要点。",tools:["code_runner"]}),ji({name:"撰写员",description:"将分析结论组织为结构清晰、引用规范的报告。",instruction:"你是研究团队中的撰写员。把分析员的要点组织成结构清晰、语言通顺、引用规范的研究报告,确保每个结论都能追溯到来源。"})]})}];function Qge(e){const t=[];return e.tools.length&&t.push({icon:LL,label:"工具"}),(e.memory.shortTerm||e.memory.longTerm)&&t.push({icon:pH,label:"记忆"}),e.knowledgebase&&t.push({icon:hH,label:"知识库"}),e.tracing&&t.push({icon:fH,label:"观测"}),e.subAgents.length&&t.push({icon:RL,label:`子Agent ${e.subAgents.length}`}),t}function Zge({onBack:e,onCreate:t}){const[n,r]=w.useState(null);return l.jsx("div",{className:"tpl-root",children:n?l.jsx(e0e,{template:n,onBack:()=>r(null),onCreate:t}):l.jsx(Jge,{onPick:r})})}function Jge({onPick:e}){return l.jsxs("div",{className:"tpl-scroll",children:[l.jsxs("div",{className:"tpl-head",children:[l.jsx("h1",{className:"tpl-title",children:"从模板新建"}),l.jsx("p",{className:"tpl-sub",children:"选择一个预制 agent 模板,按需微调后即可创建。"})]}),l.jsx("div",{className:"tpl-grid",children:Xge.map((t,n)=>l.jsxs($t.button,{type:"button",className:"tpl-card",onClick:()=>e(t),initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:n*.03,duration:.24,ease:[.22,1,.36,1]},children:[l.jsx("span",{className:"tpl-card-icon",children:l.jsx(t.icon,{className:"icon"})}),l.jsx("span",{className:"tpl-card-name",children:t.draft.name}),l.jsx("span",{className:"tpl-card-desc",children:As(t.draft.description)})]},t.id))})]})}function e0e({template:e,onBack:t,onCreate:n}){const[r,s]=w.useState(e.draft.name),i=e.icon,a=Qge(e.draft);function o(){const c=r.trim()||e.draft.name;n({...e.draft,name:c})}return l.jsxs("div",{className:"tpl-scroll tpl-scroll--detail",children:[l.jsxs("button",{className:"tpl-back",onClick:t,children:[l.jsx(bL,{className:"icon"})," 返回模板列表"]}),l.jsxs($t.div,{className:"tpl-detail",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.28,ease:[.22,1,.36,1]},children:[l.jsxs("div",{className:"tpl-detail-head",children:[l.jsx("span",{className:"tpl-detail-icon",children:l.jsx(i,{className:"icon"})}),l.jsxs("div",{className:"tpl-detail-headtext",children:[l.jsx("div",{className:"tpl-detail-name",children:e.draft.name}),l.jsx("div",{className:"tpl-detail-desc",children:As(e.draft.description)})]})]}),a.length>0&&l.jsx("div",{className:"tpl-tags tpl-tags--detail",children:a.map(c=>l.jsxs("span",{className:"tpl-tag",children:[l.jsx(c.icon,{className:"tpl-tag-icon"})," ",c.label]},c.label))}),l.jsxs("label",{className:"tpl-field",children:[l.jsx("span",{className:"tpl-field-label",children:"名称"}),l.jsx("input",{className:"tpl-input",value:r,onChange:c=>s(c.target.value),placeholder:e.draft.name})]}),l.jsxs("div",{className:"tpl-field",children:[l.jsx("span",{className:"tpl-field-label",children:"系统提示词"}),l.jsx("p",{className:"tpl-instruction",children:e.draft.instruction})]}),l.jsxs("div",{className:"tpl-meta-grid",children:[e.draft.model&&l.jsxs("div",{className:"tpl-meta",children:[l.jsx("span",{className:"tpl-meta-key",children:"模型"}),l.jsx("span",{className:"tpl-meta-val tpl-mono",children:e.draft.model})]}),l.jsxs("div",{className:"tpl-meta",children:[l.jsx("span",{className:"tpl-meta-key",children:"工具"}),l.jsx("span",{className:"tpl-meta-val",children:e.draft.tools.length?e.draft.tools.join("、"):"无"})]}),l.jsxs("div",{className:"tpl-meta",children:[l.jsx("span",{className:"tpl-meta-key",children:"记忆"}),l.jsx("span",{className:"tpl-meta-val",children:t0e(e.draft)})]}),l.jsxs("div",{className:"tpl-meta",children:[l.jsx("span",{className:"tpl-meta-key",children:"知识库"}),l.jsx("span",{className:"tpl-meta-val",children:e.draft.knowledgebase?"已开启":"关闭"})]}),l.jsxs("div",{className:"tpl-meta",children:[l.jsx("span",{className:"tpl-meta-key",children:"观测追踪"}),l.jsx("span",{className:"tpl-meta-val",children:e.draft.tracing?"已开启":"关闭"})]})]}),e.draft.subAgents.length>0&&l.jsxs("div",{className:"tpl-field",children:[l.jsxs("span",{className:"tpl-field-label",children:["子 Agent(",e.draft.subAgents.length,")"]}),l.jsx("div",{className:"tpl-subagents",children:e.draft.subAgents.map((c,u)=>l.jsxs("div",{className:"tpl-subagent",children:[l.jsxs("div",{className:"tpl-subagent-top",children:[l.jsx("span",{className:"tpl-subagent-name",children:c.name}),c.tools.length>0&&l.jsx("span",{className:"tpl-subagent-tools",children:c.tools.join("、")})]}),l.jsx("div",{className:"tpl-subagent-desc",children:As(c.description)})]},u))})]}),l.jsxs("button",{className:"tpl-create",onClick:o,children:["使用此模板创建 ",l.jsx(ws,{className:"icon"})]})]})]})}function t0e(e){const t=[];return e.memory.shortTerm&&t.push("短期"),e.memory.longTerm&&t.push("长期"),t.length?t.join(" + "):"关闭"}const n0e=[{type:"sequential",label:"顺序",desc:"节点依次执行",Icon:IL},{type:"parallel",label:"并行",desc:"节点同时执行",Icon:EL},{type:"loop",label:"循环",desc:"节点循环执行",Icon:Lw}];let XE=0;function xb(){return XE+=1,`node_${XE}`}function wb(e,t,n){const r=Sr();return{id:e,type:"agentNode",position:t,data:{agent:{...r,name:(n==null?void 0:n.name)??`agent_${e.replace("node_","")}`,...n}}}}function r0e({data:e,selected:t}){const n=e.agent;return l.jsxs("div",{className:`wfb-node ${t?"wfb-node--selected":""}`,children:[l.jsx(mr,{type:"target",position:Pe.Left,className:"wfb-handle"}),l.jsx("div",{className:"wfb-node-icon",children:l.jsx(Po,{className:"icon"})}),l.jsxs("div",{className:"wfb-node-body",children:[l.jsx("div",{className:"wfb-node-name",children:n.name||"未命名节点"}),l.jsx("div",{className:"wfb-node-desc",children:n.instruction?n.instruction.slice(0,48):"点击编辑指令…"})]}),l.jsx(mr,{type:"source",position:Pe.Right,className:"wfb-handle"})]})}const s0e={agentNode:r0e},uC={type:"smoothstep",markerEnd:{type:Rc.ArrowClosed,width:16,height:16}};function i0e({onBack:e,onCreate:t}){const n=w.useRef(null),[r,s]=w.useState(""),[i,a]=w.useState(""),[o,c]=w.useState("sequential"),u=w.useMemo(()=>{XE=0;const T=xb();return wb(T,{x:80,y:120},{name:"agent_1"})},[]),[d,f,h]=t4([u]),[p,m,y]=n4([]),[E,g]=w.useState(u.id),x=d.find(T=>T.id===E)??null,b=r.trim()||"workflow_agent",_=w.useMemo(()=>K6({name:b,subAgents:d.map(T=>T.data.agent)}),[b,d]),k=cc(b)??(_.has(b)?"名称须与 Agent 节点名称保持唯一":null),N=x?cc(x.data.agent.name)??(_.has(x.data.agent.name)?"Agent 名称在当前工作流中必须唯一":null):null,C=d.length>0&&k===null&&d.every(T=>cc(T.data.agent.name)===null&&!_.has(T.data.agent.name)),S=w.useCallback(T=>m(L=>CP({...T,...uC},L)),[m]),A=w.useCallback(()=>{const T=xb(),L=d.length*28,R=wb(T,{x:80+L,y:120+L});f(F=>F.concat(R)),g(T)},[d.length,f]),O=T=>{T.dataTransfer.setData("application/wfb-node","agentNode"),T.dataTransfer.effectAllowed="move"},D=w.useCallback(T=>{T.preventDefault(),T.dataTransfer.dropEffect="move"},[]),U=w.useCallback(T=>{if(T.preventDefault(),T.dataTransfer.getData("application/wfb-node")!=="agentNode"||!n.current)return;const R=n.current.screenToFlowPosition({x:T.clientX,y:T.clientY}),F=xb(),I=wb(F,R);f(V=>V.concat(I)),g(F)},[f]),X=w.useCallback(T=>{E&&f(L=>L.map(R=>R.id===E?{...R,data:{...R.data,agent:{...R.data.agent,...T}}}:R))},[E,f]),M=w.useCallback(()=>{E&&(f(T=>T.filter(L=>L.id!==E)),m(T=>T.filter(L=>L.source!==E&&L.target!==E)),g(null))},[E,f,m]),j=w.useCallback(()=>{if(!C)return;const T=d.map(R=>R.data.agent),L={...Sr(),name:b,description:i.trim(),instruction:i.trim(),subAgents:T,workflow:{type:o,nodes:d.map(R=>({id:R.id,agent:R.data.agent})),edges:p.map(R=>({from:R.source,to:R.target}))}};t(L)},[C,d,p,b,i,o,t]);return l.jsx("div",{className:"wfb",children:l.jsxs("div",{className:"wfb-grid",children:[l.jsxs("aside",{className:"wfb-palette",children:[l.jsx("div",{className:"wfb-section-label",children:"工作流信息"}),l.jsxs("label",{className:"wfb-field",children:[l.jsx("span",{className:"wfb-field-label",children:"名称"}),l.jsx("input",{className:`wfb-input ${k?"wfb-input--error":""}`,value:r,onChange:T=>s(T.target.value),placeholder:"my_workflow"}),k&&l.jsx("span",{className:"wfb-field-error",children:k})]}),l.jsxs("label",{className:"wfb-field",children:[l.jsx("span",{className:"wfb-field-label",children:"描述"}),l.jsx("textarea",{className:"wfb-input wfb-textarea",value:i,onChange:T=>a(T.target.value),placeholder:"这个工作流做什么…",rows:2})]}),l.jsx("div",{className:"wfb-section-label",children:"执行方式"}),l.jsx("div",{className:"wfb-types",children:n0e.map(({type:T,label:L,desc:R,Icon:F})=>l.jsxs("button",{type:"button",className:`wfb-type ${o===T?"wfb-type--active":""}`,onClick:()=>c(T),children:[l.jsx(F,{className:"icon"}),l.jsxs("span",{className:"wfb-type-text",children:[l.jsx("span",{className:"wfb-type-name",children:L}),l.jsx("span",{className:"wfb-type-desc",children:R})]})]},T))}),l.jsx("div",{className:"wfb-section-label",children:"节点"}),l.jsxs("div",{className:"wfb-palette-item",draggable:!0,onDragStart:O,title:"拖拽到画布,或点击下方按钮添加",children:[l.jsx(OH,{className:"icon wfb-grip"}),l.jsx("span",{className:"wfb-node-icon wfb-node-icon--sm",children:l.jsx(Po,{className:"icon"})}),l.jsx("span",{className:"wfb-palette-item-text",children:"Agent 节点"})]}),l.jsxs("button",{className:"wfb-add",type:"button",onClick:A,children:[l.jsx(rr,{className:"icon"}),"添加节点"]}),l.jsx("div",{className:"wfb-hint",children:"拖拽节点的圆点连线以表达执行顺序。"})]}),l.jsxs("div",{className:"wfb-canvas",children:[l.jsxs("button",{className:"wfb-create",onClick:j,disabled:!C,type:"button",children:[l.jsx(Bo,{className:"icon"}),"创建工作流"]}),l.jsxs(e4,{nodes:d,edges:p,onNodesChange:h,onEdgesChange:y,onConnect:S,onInit:T=>n.current=T,nodeTypes:s0e,defaultEdgeOptions:uC,onDrop:U,onDragOver:D,onNodeClick:(T,L)=>g(L.id),onPaneClick:()=>g(null),fitView:!0,fitViewOptions:{padding:.3,maxZoom:1},proOptions:{hideAttribution:!0},children:[l.jsx(s4,{gap:16,size:1,color:"hsl(240 5.9% 88%)"}),l.jsx(a4,{showInteractive:!1}),l.jsx(Aue,{pannable:!0,zoomable:!0,className:"wfb-minimap"})]})]}),l.jsx("aside",{className:"wfb-inspector",children:x?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"wfb-inspector-head",children:[l.jsx("div",{className:"wfb-section-label",children:"节点配置"}),l.jsx("button",{className:"wfb-icon-btn",type:"button",onClick:M,title:"删除节点",children:l.jsx(ea,{className:"icon"})})]}),l.jsxs("label",{className:"wfb-field",children:[l.jsx("span",{className:"wfb-field-label",children:"名称"}),l.jsx("input",{className:`wfb-input ${N?"wfb-input--error":""}`,value:x.data.agent.name,onChange:T=>X({name:T.target.value}),placeholder:"agent_name"}),N?l.jsx("span",{className:"wfb-field-error",children:N}):l.jsx("span",{className:"wfb-field-help",children:"仅使用英文字母、数字和下划线,且名称保持唯一。"})]}),l.jsxs("label",{className:"wfb-field",children:[l.jsx("span",{className:"wfb-field-label",children:"描述"}),l.jsx("input",{className:"wfb-input",value:x.data.agent.description,onChange:T=>X({description:T.target.value}),placeholder:"这个 agent 做什么…"})]}),l.jsxs("label",{className:"wfb-field",children:[l.jsx("span",{className:"wfb-field-label",children:"指令 (instruction)"}),l.jsx("textarea",{className:"wfb-input wfb-textarea",value:x.data.agent.instruction,onChange:T=>X({instruction:T.target.value}),placeholder:"你是一个…",rows:6})]}),l.jsxs("label",{className:"wfb-field",children:[l.jsx("span",{className:"wfb-field-label",children:"工具 (逗号分隔)"}),l.jsx("input",{className:"wfb-input",value:x.data.agent.tools.join(", "),onChange:T=>X({tools:T.target.value.split(",").map(L=>L.trim()).filter(Boolean)}),placeholder:"web_search, calculator"})]}),l.jsxs("div",{className:"wfb-inspector-meta",children:[l.jsx("span",{className:"wfb-meta-key",children:"节点 ID"}),l.jsx("code",{className:"wfb-meta-val",children:x.id})]})]}):l.jsxs("div",{className:"wfb-inspector-empty",children:[l.jsx(Po,{className:"wfb-empty-icon"}),l.jsx("p",{children:"选择一个节点以编辑其配置"}),l.jsxs("p",{className:"wfb-empty-sub",children:["共 ",d.length," 个节点 · ",p.length," 条连线"]})]})})]})})}function a0e(e){return l.jsx(Pv,{children:l.jsx(i0e,{...e})})}const dC=50*1024*1024,QE=800,o0e={name:"code_package",files:[]};function l0e(e){let n=e.replace(/\.zip$/i,"").trim().replace(/[^A-Za-z0-9_]+/g,"_").replace(/^_+|_+$/g,"");return n||(n="uploaded_agent"),/^[A-Za-z_]/.test(n)||(n=`agent_${n}`),n==="user"&&(n="uploaded_agent"),n.slice(0,64)}function c0e(e){const t=e.replace(/\\/g,"/").replace(/^\.\//,"");if(!t||t.endsWith("/"))return null;if(t.startsWith("/")||t.includes("\0"))throw new Error(`压缩包包含非法路径:${e}`);const n=t.split("/");if(n.some(r=>!r||r==="."||r===".."))throw new Error(`压缩包包含非法路径:${e}`);return n[0]==="__MACOSX"||n[n.length-1]===".DS_Store"?null:n.join("/")}function u0e(e){const t=e.flatMap(a=>{const o=c0e(a.name);return o?[{path:o,content:a.text}]:[]});if(t.length===0)throw new Error("压缩包中没有可部署的文件。");if(t.length>QE)throw new Error(`代码包文件数不能超过 ${QE} 个。`);const s=new Set(t.map(a=>a.path.split("/")[0])).size===1&&t.every(a=>a.path.includes("/"))?t.map(a=>({...a,path:a.path.split("/").slice(1).join("/")})):t,i=new Set;for(const a of s){if(i.has(a.path))throw new Error(`代码包包含重复文件:${a.path}`);i.add(a.path)}if(!i.has("app.py"))throw new Error("代码包根目录必须包含 app.py,作为 AgentKit 启动入口。");return s}function d0e({onBack:e,onAgentAdded:t,onDeploymentTaskChange:n}){const r=w.useRef(null),s=w.useRef(0),[i,a]=w.useState(null),[o,c]=w.useState(""),[u,d]=w.useState(!1),[f,h]=w.useState(!1),[p,m]=w.useState(!1),[y,E]=w.useState(""),[g,x]=w.useState("cn-beijing"),[b,_]=w.useState();w.useEffect(()=>()=>{s.current+=1},[]);async function k(A){const O=++s.current;if(E(""),!A.name.toLowerCase().endsWith(".zip")){E("请选择 .zip 格式的代码包。");return}if(A.size>dC){E("代码包不能超过 50 MB。");return}h(!0);try{const D=await W6(new Uint8Array(await A.arrayBuffer()),{maxEntries:QE,maxUncompressedBytes:dC}),U=u0e(D);if(O!==s.current)return;c(A.name),a({name:l0e(A.name),files:U})}catch(D){if(O!==s.current)return;c(""),a(null),E(D instanceof Error?D.message:String(D))}finally{O===s.current&&h(!1)}}function N(A){var D;const O=(D=A.currentTarget.files)==null?void 0:D[0];A.currentTarget.value="",O&&k(O)}function C(A){var D;A.preventDefault(),m(!1);const O=(D=A.dataTransfer.files)==null?void 0:D[0];O&&k(O)}async function S(A,O,D){const U=b&&b.mode!=="public"?{mode:b.mode,vpc_id:b.vpcId,subnet_ids:b.subnetIds,enable_shared_internet_access:b.enableSharedInternetAccess}:void 0;return Lg(A.name,A.files,{region:g,projectName:"default",network:U},{...D,onStage:O})}return l.jsxs("div",{className:"package-create package-create-preview",children:[l.jsx(b0,{project:i??o0e,agentName:(i==null?void 0:i.name)||"代码包",onChange:i?a:void 0,onDeploy:S,onAgentAdded:t,onDeploymentTaskChange:n,network:b,onNetworkChange:_,deployRegion:g,onDeployRegionChange:x,onBack:e,backLabel:"返回创建方式",deployDisabled:!i||f,deployDisabledReason:f?"正在读取代码包":i?void 0:"请先上传代码包",deploymentPrimaryPane:l.jsxs("section",{className:"package-source-pane","aria-label":"代码包上传",children:[l.jsx("div",{className:"package-source-label",children:"代码包"}),l.jsxs("div",{className:`package-dropzone${p?" is-dragging":""}${i?" is-ready":""}`,onDragEnter:A=>{A.preventDefault(),m(!0)},onDragOver:A=>A.preventDefault(),onDragLeave:A=>{A.currentTarget.contains(A.relatedTarget)||m(!1)},onDrop:C,onClick:()=>{var A;f||(A=r.current)==null||A.click()},onKeyDown:A=>{var O;!f&&(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),(O=r.current)==null||O.click())},role:"button",tabIndex:f?-1:0,"aria-label":i?"重新上传代码包":"上传代码包","aria-disabled":f,children:[l.jsx("strong",{children:f?"正在读取代码包…":i?o:"请上传代码包"}),l.jsx("span",{children:i?`已识别 ${i.files.length} 个文件,点击区域可重新上传`:"点击或拖拽上传,支持 .zip 格式,最大 50 MB,根目录需包含 app.py"}),l.jsx("div",{className:"package-upload-actions",children:i&&l.jsx("button",{type:"button",className:"package-upload-secondary",onClick:A=>{A.stopPropagation(),d(!0)},onKeyDown:A=>A.stopPropagation(),children:"查看文件"})}),l.jsx("input",{ref:r,type:"file",accept:".zip,application/zip","aria-label":"选择代码包",onChange:N})]}),y&&l.jsx("div",{className:"package-create-error",role:"alert",children:y})]})}),i&&l.jsx(V6,{project:i,open:u,onClose:()=>d(!1),onChange:a})]})}const f0e=3*60*1e3,h0e=3e3,p0e=10*60*1e3,sg="veadk.studio.pending-update",fC=[{id:"resolving",label:"读取目标版本信息"},{id:"downloading",label:"下载并校验完整更新包"},{id:"preparing",label:"准备 VeFaaS Function 代码"},{id:"submitting",label:"提交 Function 更新"},{id:"publishing",label:"发布新 Revision 并重启服务"}],m0e={resolving:"读取版本信息",downloading:"下载更新包",preparing:"准备 Function 代码",submitting:"提交 Function 更新",publishing:"发布 Revision",checking:"检查更新",unknown:"未知阶段"};function g0e(e){return e<60?`${e} 秒`:`${Math.floor(e/60)} 分 ${e%60} 秒`}function y0e(e,t){return e===t?!0:/^\d{14}$/.test(e)&&/^\d{14}$/.test(t)&&e>t}function b0e(){if(typeof window>"u")return null;const e=window.localStorage.getItem(sg);if(!e)return null;try{const t=JSON.parse(e);if(typeof t.targetVersion=="string"&&typeof t.startedAt=="number")return{targetVersion:t.targetVersion,startedAt:t.startedAt}}catch{}return window.localStorage.removeItem(sg),null}function vb(e,t){window.localStorage.setItem(sg,JSON.stringify({targetVersion:e,startedAt:t}))}function ap(){window.localStorage.removeItem(sg)}function hC({className:e}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M19.2 8.3A8 8 0 1 0 20 13"}),l.jsx("path",{d:"M19.2 4.8v3.5h-3.5"}),l.jsx("path",{d:"M12 7.8v7.7"}),l.jsx("path",{d:"m9.2 12.7 2.8 2.8 2.8-2.8"})]})}function E0e(){return l.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:l.jsx("path",{d:"m4 6 4 4 4-4"})})}function x0e(){return l.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:l.jsx("path",{d:"m3.5 8.2 2.8 2.8 6.2-6"})})}function pC({lines:e,phase:t,copyState:n,onCopy:r}){const s=w.useRef(null),i=w.useRef(!0);return w.useEffect(()=>{const a=s.current;a&&i.current&&(a.scrollTop=a.scrollHeight)},[e]),l.jsxs("section",{className:"studio-update-live-log","aria-label":"VeFaaS 更新日志",children:[l.jsxs("div",{className:"studio-update-log-header",children:[l.jsxs("span",{children:[l.jsx("i",{className:`is-${t}`,"aria-hidden":!0}),"VeFaaS 更新日志",l.jsx("small",{children:t==="active"?"实时":t==="complete"?"已完成":"已停止"})]}),l.jsx("button",{type:"button",onClick:r,disabled:!e.length,children:n==="copied"?"已复制":n==="error"?"复制失败":"复制日志"})]}),l.jsx("div",{ref:s,className:"studio-update-log-lines",role:"log","aria-live":"off",tabIndex:0,onScroll:a=>{const o=a.currentTarget;i.current=o.scrollHeight-o.scrollTop-o.clientHeight<24},children:e.length?e.map((a,o)=>l.jsx("div",{children:a},`${o}-${a}`)):l.jsx("p",{children:t==="active"?"等待 VeFaaS 返回更新日志…":"本次更新未返回发布日志"})})]})}function w0e(){var X,M;const[e]=w.useState(b0e),[t,n]=w.useState(null),[r,s]=w.useState(e?"submitting":"idle"),[i,a]=w.useState(!1),[o,c]=w.useState(""),[u,d]=w.useState((e==null?void 0:e.targetVersion)??""),[f,h]=w.useState(!1),[p,m]=w.useState("idle"),[y,E]=w.useState(0),g=w.useRef(null),x=w.useRef((e==null?void 0:e.targetVersion)??""),b=w.useRef((e==null?void 0:e.startedAt)??0);w.useEffect(()=>{if(!f)return;const j=L=>{var R;L.target instanceof Node&&!((R=g.current)!=null&&R.contains(L.target))&&h(!1)},T=L=>{L.key==="Escape"&&h(!1)};return window.addEventListener("pointerdown",j),window.addEventListener("keydown",T),()=>{window.removeEventListener("pointerdown",j),window.removeEventListener("keydown",T)}},[f]);const _=w.useCallback(async()=>{const j=await lM(x.current||void 0,b.current||void 0);return n(j),j},[]);if(w.useEffect(()=>{let j=!0;const T=()=>{_().catch(()=>{j&&n(R=>R)})};T();const L=window.setInterval(T,f0e);return()=>{j=!1,window.clearInterval(L)}},[_]),w.useEffect(()=>{if(r!=="submitting")return;const j=window.setInterval(()=>{_().then(T=>{const L=x.current;if(L&&y0e(T.currentVersion,L)||!L&&!T.available&&T.latestVersion){window.clearInterval(j),ap(),s("published"),c("Studio 已更新,刷新页面即可使用新版本");return}if(T.state==="error"){window.clearInterval(j),ap(),s("error"),c(T.message||"Studio 更新失败");return}Date.now()-b.current>p0e&&(window.clearInterval(j),ap(),s("error"),c("等待 VeFaaS 发布超时,请稍后重新检查版本"))}).catch(()=>{})},h0e);return()=>window.clearInterval(j)},[r,_]),w.useEffect(()=>{r!=="idle"||(t==null?void 0:t.state)!=="updating"||(x.current=t.targetVersion,b.current=t.startedAt||Date.now(),vb(t.targetVersion,b.current),d(t.targetVersion),s("submitting"))},[r,t]),w.useEffect(()=>{if(r!=="submitting"){E(0);return}const j=()=>{const L=b.current||Date.now();E(Math.max(0,Math.floor((Date.now()-L)/1e3)))};j();const T=window.setInterval(j,1e3);return()=>window.clearInterval(T)},[r]),!(t!=null&&t.enabled)||!(t.available||t.state==="updating"||r!=="idle"))return null;const N=t.releases??[],C=u||((X=N[0])==null?void 0:X.version)||t.latestVersion,S=N.find(j=>j.version===C),A=async()=>{x.current=C,b.current=Date.now(),vb(C,b.current),s("submitting"),c(""),m("idle");try{const j=await cM(C);x.current=j.version,vb(j.version,b.current),c("更新已提交,正在等待 VeFaaS 发布新版本")}catch(j){if(j instanceof TypeError){c("连接已切换,正在确认新版本状态");return}ap(),s("error");const T=j instanceof Error?j.message:"Studio 更新失败";try{const L=await _();c(L.message||T)}catch{c(T)}}},O=(M=t.updateLogs)!=null&&M.length?t.updateLogs:(t.errorLog||t.progressMessage||o).split(` +`);if(!t.length||t[0].trim()!=="---")return{name:"",description:""};let n=-1;for(let s=1;s=2&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))}function pge(...e){var t;for(const n of e){const r=(t=n.trim().replace(/\\/g,"/").split("/").filter(Boolean).pop())==null?void 0:t.replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"");if(r)return r.slice(0,64)}return"local-skill"}function mge(e,t){return t.trim()||e}function W6(e){const t=e.map(r=>({path:r.path.replace(/\\/g,"/").replace(/^\.\//,""),text:r.text})).filter(r=>r.path.length>0&&!r.path.endsWith("/")),n=new Set(t.map(r=>r.path.split("/")[0]));if(n.size===1&&t.every(r=>r.path.includes("/"))){const r=[...n][0]+"/";return t.map(s=>({path:s.path.slice(r.length),text:s.text}))}return t}function gge(e){const t=new Map,n=new Set;for(const r of e)if(WE.test("/"+r.path)){const s=r.path.split("/");n.add(s.slice(0,-1).join("/"))}for(const r of e){const s=r.path.split("/");let i="";for(let u=s.length-1;u>=0;u--){const d=s.slice(0,u).join("/");if(n.has(d)){i=d;break}}const a=WE.test("/"+r.path);if(!i&&!a&&!n.has("")||!n.has(i)&&!a)continue;const o=i?r.path.slice(i.length+1):r.path,c=t.get(i)||[];c.push({path:o,text:r.text}),t.set(i,c)}return t}function yge(e,t,n){const r=`${n}${e?"/"+e:""}`,s=t.find(c=>WE.test("/"+c.path));if(!s)return{hit:null,error:`${r} 缺少 SKILL.md`};const i=fge(s.text),a=pge(i.name,e,n.replace(/\.[^.]+$/,"")),o=[];for(const c of t){if(c.path.split("/").some(f=>f===".."))return{hit:null,error:`${r} 包含非法路径(..):${c.path}`};const d=`skills/${a}/${c.path}`;if(!d.startsWith(`skills/${a}/`))return{hit:null,error:`${r} 包含非法路径:${c.path}`};o.push({path:d,content:c.text})}return{hit:{source:"local",id:`local:${a}:${t.length}`,name:mge(a,i.name),description:i.description||"本地 Skill",folder:a,localFiles:o},error:null}}async function bge(e){const t=new Uint8Array(await e.arrayBuffer()),r=(await Y6(t)).map(s=>({path:s.name,text:s.text}));return G6(W6(r),e.name)}async function Ege(e,t=new Map){const n=[];for(let r=0;re.file(t,n))}async function wge(e){const t=e.createReader(),n=[];for(;;){const r=await new Promise((s,i)=>t.readEntries(s,i));if(r.length===0)return n;n.push(...r)}}async function q6(e,t=""){const n=t?`${t}/${e.name}`:e.name;if(e.isFile)return[{file:await xge(e),path:n}];if(!e.isDirectory)return[];const r=await wge(e);return(await Promise.all(r.map(s=>q6(s,n)))).flat()}function vge({selected:e,onChange:t}){const[n,r]=w.useState([]),[s,i]=w.useState([]),[a,o]=w.useState(!1),[c,u]=w.useState(!1),d=w.useRef(0),f=b=>e.some(_=>_.source==="local"&&_.folder===b),h=b=>{b.localFiles&&(f(b.folder||b.name)?t(e.filter(_=>!(_.source==="local"&&_.folder===(b.folder||b.name)))):t([...e,{source:"local",folder:b.folder||b.name,name:b.name,description:b.description,localFiles:b.localFiles}]))},p=w.useRef([]),m=w.useRef(e);w.useEffect(()=>{p.current=s},[s]),w.useEffect(()=>{m.current=e},[e]);const y=b=>{const _=new Set([...p.current.map(S=>S.folder||S.name),...m.current.filter(S=>S.source==="local").map(S=>S.folder)]),k=[],N=[];for(const S of b.hits){const A=S.folder||S.name;if(_.has(A)){k.push(S.name);continue}_.add(A),N.push(S)}i(S=>[...S,...N]);const C=[...b.errors];if(k.length>0&&C.push(`已跳过重复技能:${k.join("、")}`),r(C),N.length===1&&b.errors.length===0&&k.length===0){const S=N[0];S.localFiles&&t([...m.current,{source:"local",folder:S.folder||S.name,name:S.name,description:S.description,localFiles:S.localFiles}])}},E=b=>{b.preventDefault(),d.current+=1,u(!0)},g=b=>{b.preventDefault(),d.current=Math.max(0,d.current-1),d.current===0&&u(!1)},x=async b=>{if(b.preventDefault(),d.current=0,u(!1),a)return;const _=Array.from(b.dataTransfer.items).map(k=>{var N;return(N=k.webkitGetAsEntry)==null?void 0:N.call(k)}).filter(k=>k!==null);if(_.length===0){r(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}o(!0);try{const k=(await Promise.all(_.map(S=>q6(S)))).flat(),N=_.some(S=>S.isDirectory);if(!N&&k.length===1&&k[0].file.name.toLowerCase().endsWith(".zip")){y(await bge(k[0].file));return}if(!N){r(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}const C=new Map(k.map(({file:S,path:A})=>[S,A]));y(await Ege(k.map(({file:S})=>S),C))}catch(k){r([`读取失败:${k instanceof Error?k.message:String(k)}`])}finally{o(!1)}};return l.jsxs("div",{className:"cw-local",children:[l.jsxs("div",{className:`cw-local-dropzone ${c?"is-dragging":""}`,role:"group","aria-label":"拖入文件夹或 ZIP,自动识别 Skill",onDragEnter:E,onDragOver:b=>b.preventDefault(),onDragLeave:g,onDrop:b=>void x(b),children:[l.jsx(Ow,{className:"cw-local-drop-icon","aria-hidden":!0}),l.jsx("p",{className:"cw-local-drop-hint",children:"拖入文件夹或 ZIP,自动识别 Skill"})]}),l.jsx("p",{className:"cw-local-hint",children:"每个技能需包含 SKILL.md。支持包含多个技能的目录。"}),a&&l.jsx("p",{className:"cw-empty-line",children:"正在读取文件…"}),n.length>0&&l.jsxs("div",{className:"cw-banner",children:[l.jsx(Ka,{className:"cw-i"}),l.jsx("span",{children:n.join(";")})]}),s.length>0&&l.jsx("div",{className:"cw-skill-results",children:s.map(b=>{var k;const _=f(b.folder||b.name);return l.jsxs("button",{type:"button",className:`cw-skill-result ${_?"is-on":""}`,onClick:()=>h(b),"aria-pressed":_,children:[l.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:_?l.jsx(Js,{className:"cw-i cw-i-sm"}):l.jsx(rr,{className:"cw-i cw-i-sm"})}),l.jsxs("span",{className:"cw-skill-result-meta",children:[l.jsx("span",{className:"cw-skill-result-name",children:b.name}),b.description&&l.jsx("span",{className:"cw-skill-result-desc",children:As(b.description)}),l.jsxs("span",{className:"cw-skill-result-repo",children:["本地 · ",((k=b.localFiles)==null?void 0:k.length)??0," 个文件"]})]})]},b.id)})})]})}function _ge({selected:e,onChange:t}){const[n,r]=w.useState([]),[s,i]=w.useState([]),[a,o]=w.useState(""),[c,u]=w.useState(!0),[d,f]=w.useState(!1),[h,p]=w.useState(null);w.useEffect(()=>{let g=!1;return(async()=>{u(!0),p(null);try{const x=await kM();g||(r(x),x.length>0&&o(x[0].id))}catch(x){g||p(x instanceof Error?x.message:"加载失败")}finally{g||u(!1)}})(),()=>{g=!0}},[]),w.useEffect(()=>{if(!a){i([]);return}const g=n.find(b=>b.id===a);let x=!1;return(async()=>{f(!0),p(null);try{const b=await NM(a,g==null?void 0:g.region);x||i(b)}catch(b){x||p(b instanceof Error?b.message:"加载失败")}finally{x||f(!1)}})(),()=>{x=!0}},[a,n]);const m=n.find(g=>g.id===a),y=(g,x)=>e.some(b=>b.source==="skillspace"&&b.skillId===g&&(b.version||"")===x),E=g=>{if(m)if(y(g.skillId,g.version))t(e.filter(x=>!(x.source==="skillspace"&&x.skillId===g.skillId&&(x.version||"")===g.version)));else{const x=gV(m,g);t([...e,{source:"skillspace",folder:x.folder||g.skillName,name:x.name,description:x.description,skillSpaceId:x.skillSpaceId,skillSpaceName:x.skillSpaceName,skillSpaceRegion:x.skillSpaceRegion,skillId:x.skillId,version:x.version}])}};return l.jsx("div",{className:"cw-skillspace",children:c?l.jsxs("p",{className:"cw-empty-line",children:[l.jsx(Rt,{className:"cw-i cw-spin"})," 正在加载 AgentKit Skills 中心…"]}):h?l.jsxs("div",{className:"cw-banner",children:[l.jsx(Ka,{className:"cw-i"}),l.jsx("span",{children:h})]}):n.length===0?l.jsx("p",{className:"cw-empty-line",children:"此账号下没有 AgentKit Skills 中心。"}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"cw-skillspace-header",children:[l.jsx("select",{className:"cw-input cw-skillspace-select",value:a,onChange:g=>o(g.target.value),"aria-label":"选择 AgentKit Skills 中心",children:n.map(g=>l.jsxs("option",{value:g.id,children:[g.name||g.id,g.region?` [${g.region}]`:"",g.description?` — ${As(g.description)}`:""]},g.id))}),m&&l.jsx("a",{href:yV(m.id,m.region),target:"_blank",rel:"noopener noreferrer",className:"cw-button cw-button-secondary cw-skillspace-console-link",title:"在火山引擎控制台打开",children:l.jsx(Iw,{className:"cw-i cw-i-sm"})})]}),d?l.jsxs("p",{className:"cw-empty-line",children:[l.jsx(Rt,{className:"cw-i cw-spin"})," 正在加载技能列表…"]}):s.length===0?l.jsx("p",{className:"cw-empty-line",children:"此 AgentKit Skills 中心暂无技能。"}):l.jsx("div",{className:"cw-skill-results",children:s.map(g=>{const x=y(g.skillId,g.version);return l.jsxs("button",{type:"button",className:`cw-skill-result ${x?"is-on":""}`,onClick:()=>E(g),"aria-pressed":x,children:[l.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:x?l.jsx(Js,{className:"cw-i cw-i-sm"}):l.jsx(rr,{className:"cw-i cw-i-sm"})}),l.jsxs("span",{className:"cw-skill-result-meta",children:[l.jsxs("span",{className:"cw-skill-result-name",children:[g.skillName,g.version&&l.jsxs("span",{className:"cw-skill-result-version",children:[" ","v",g.version]})]}),g.skillDescription&&l.jsx("span",{className:"cw-skill-result-desc",children:As(g.skillDescription)}),l.jsxs("span",{className:"cw-skill-result-repo",children:[l.jsx(gH,{className:"cw-i cw-i-sm"})," ",(m==null?void 0:m.name)||a]})]})]},`${g.skillId}/${g.version}`)})})]})})}async function kge(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:Gs(void 0,Kc)});if(t.status===409)throw new Error("服务端未配置 Volcengine AK/SK,无法访问 AgentKit 智能体中心");if(t.status===401)throw new Error("请先登录以访问 AgentKit 智能体中心");if(!t.ok){let n="";try{n=(await t.json()).detail||""}catch{}throw new Error(`请求失败 (${t.status})${n?": "+n:""}`)}return t.json()}async function Nge(e={}){const t=new URLSearchParams({region:e.region||"cn-beijing",page_size:String(e.pageSize??100),project:e.project||"default"});return(await kge(`/web/a2a-spaces?${t.toString()}`)).items||[]}async function Sge(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:Gs(void 0,Kc)});if(t.status===409)throw new Error("服务端未配置 Volcengine AK/SK,无法访问 VikingDB 知识库");if(t.status===401)throw new Error("请先登录以访问 VikingDB 知识库");if(!t.ok){let n="";try{n=(await t.json()).detail||""}catch{}throw new Error(`请求失败 (${t.status})${n?": "+n:""}`)}return t.json()}async function Tge(e={}){const t=new URLSearchParams({region:e.region||"cn-beijing",project:e.project||"default"});return(await Sge(`/web/viking-knowledgebases?${t.toString()}`)).items||[]}const Age=w.lazy(()=>oc(()=>import("./MarkdownPromptEditor-DH4ASeh5.js"),__vite__mapDeps([0,1])));function Cge(e,t,n="text/plain"){const r=URL.createObjectURL(new Blob([t],{type:`${n};charset=utf-8`})),s=document.createElement("a");s.href=r,s.download=e,document.body.appendChild(s),s.click(),s.remove(),URL.revokeObjectURL(r)}const rC=[{id:"type",label:"Agent 类型",hint:"选择 Agent 类型",icon:WH,required:!0},{id:"basic",label:"基本信息",hint:"名称、描述与系统提示词",icon:Ka,required:!0},{id:"model",label:"模型配置",hint:"模型与服务(可选)",icon:bH},{id:"tools",label:"工具",hint:"可调用的能力",icon:RL},{id:"skills",label:"技能",hint:"声明式技能",icon:Po},{id:"knowledge",label:"知识库",hint:"外部知识检索",icon:vp},{id:"advanced",label:"进阶配置",hint:"记忆与观测",icon:AL},{id:"subagents",label:"子 Agent",hint:"嵌套协作",icon:wL},{id:"review",label:"完成",hint:"预览并创建",icon:VH}];function Ige({className:e}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M9 7.15v9.7a1.15 1.15 0 0 0 1.78.96l7.2-4.85a1.15 1.15 0 0 0 0-1.92l-7.2-4.85A1.15 1.15 0 0 0 9 7.15Z"}),l.jsx("path",{d:"M5.75 8.25v7.5",opacity:"0.8"}),l.jsx("path",{d:"M3 10v4",opacity:"0.45"}),l.jsx("path",{d:"M17.9 5.25v2.2M19 6.35h-2.2",strokeWidth:"1.55"})]})}function X6({className:e}){return l.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:l.jsx("path",{d:"m7 9 5 5 5-5"})})}function Q6({className:e}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[l.jsx("path",{d:"M18.25 8.2A7.1 7.1 0 0 0 6.1 6.65L4.5 8.25"}),l.jsx("path",{d:"M4.5 4.75v3.5H8"}),l.jsx("path",{d:"M5.75 15.8A7.1 7.1 0 0 0 17.9 17.35l1.6-1.6"}),l.jsx("path",{d:"M19.5 19.25v-3.5H16"})]})}const Oge={llm:"智能体",sequential:"分步协作",parallel:"同时处理",loop:"循环执行",a2a:"远程智能体"},sC={llm:"理解任务并完成一个具体工作",sequential:"内部步骤按照顺序依次执行",parallel:"内部步骤同时工作,完成后统一汇总",loop:"重复执行内部步骤,直到满足停止条件",a2a:"调用已经存在的远程 Agent"},iC={REGISTRY_SPACE_ID:"registrySpaceId",REGISTRY_TOP_K:"registryTopK",REGISTRY_REGION:"registryRegion",REGISTRY_ENDPOINT:"registryEndpoint"},Z6="REGISTRY_SPACE_ID",Rge=SM.filter(e=>e.key!==Z6);function J6(e,t){var r,s,i;if(!(e!=null&&e.enabled))return{};const n={REGISTRY_SPACE_ID:e.registrySpaceId??""};return t.includeDefaults?(n.REGISTRY_TOP_K=((r=e.registryTopK)==null?void 0:r.trim())||qs.topK,n.REGISTRY_REGION=((s=e.registryRegion)==null?void 0:s.trim())||qs.region,n.REGISTRY_ENDPOINT=((i=e.registryEndpoint)==null?void 0:i.trim())||qs.endpoint):(n.REGISTRY_TOP_K=e.registryTopK??"",n.REGISTRY_REGION=e.registryRegion??"",n.REGISTRY_ENDPOINT=e.registryEndpoint??""),n}function aC({items:e,selected:t,onToggle:n,scrollRows:r}){return l.jsx("div",{className:`cw-checklist ${r?"cw-checklist-tools":""}`,style:r?{"--cw-checklist-max-height":`${r*65+(r-1)*8}px`}:void 0,children:e.map(s=>{const i=t.includes(s.id);return l.jsxs("button",{type:"button",className:`cw-check ${i?"is-on":""}`,onClick:()=>n(s.id),"aria-pressed":i,children:[l.jsx("span",{className:"cw-check-box","aria-hidden":!0,children:i&&l.jsx(Js,{className:"cw-i cw-i-sm"})}),l.jsxs("span",{className:"cw-check-text",children:[l.jsx("span",{className:"cw-check-title",children:s.label}),l.jsx("span",{className:"cw-check-desc",children:As(s.desc)})]})]},s.id)})})}function pb({options:e,value:t,onChange:n}){return l.jsx("div",{className:"cw-segmented",children:e.map(r=>{var i;const s=(t??((i=e[0])==null?void 0:i.id))===r.id;return l.jsxs("button",{type:"button",className:`cw-seg ${s?"is-on":""}`,onClick:()=>n(r.id),"aria-pressed":s,title:As(r.desc),children:[l.jsx("span",{className:"cw-seg-title",children:r.label}),l.jsx("span",{className:"cw-seg-desc",children:As(r.desc)})]},r.id)})})}function Lge(e){return/(SECRET|PASSWORD|KEY|TOKEN)$/.test(e)}function yl({env:e,values:t,onChange:n}){return e.length===0?l.jsx("p",{className:"cw-env-empty",children:"此后端无需额外运行参数。"}):l.jsx("div",{className:"cw-env-fields",children:e.map(r=>l.jsxs("label",{className:"cw-env-field",children:[l.jsxs("span",{className:"cw-env-field-head",children:[l.jsxs("span",{className:"cw-env-field-label",children:[r.comment||r.key,r.required&&l.jsx("span",{className:"cw-req",children:"*"})]}),r.comment&&l.jsx("code",{title:r.key,children:r.key})]}),l.jsx("input",{className:"cw-input",type:Lge(r.key)?"password":"text",value:t[r.key]??"",placeholder:r.placeholder||"请输入参数值",autoComplete:"off",onChange:s=>n(r.key,s.currentTarget.value)})]},r.key))})}function mb(e){return e.name.trim()||"未命名智能体中心"}function gb(e){return e.name.trim()||e.id||"未命名知识库"}function Mge({value:e,region:t,invalid:n,onChange:r}){const s=t.trim()||qs.region,[i,a]=w.useState([]),[o,c]=w.useState(!1),[u,d]=w.useState(null),[f,h]=w.useState(0),[p,m]=w.useState(!1),[y,E]=w.useState(""),g=w.useRef(null);w.useEffect(()=>{let A=!1;return c(!0),d(null),Nge({region:s}).then(O=>{A||a(O)}).catch(O=>{A||(a([]),d(O instanceof Error?O.message:"加载失败"))}).finally(()=>{A||c(!1)}),()=>{A=!0}},[s,f]);const x=!e||i.some(A=>A.id===e.trim()),b=i.find(A=>A.id===e.trim()),_=b?mb(b):e&&!x?"已选择的智能体中心":"请选择智能体中心",k=o&&i.length===0,N=w.useMemo(()=>i.filter(A=>tg(y,[mb(A),A.id,A.projectName])),[y,i]),C=!!(e&&!x&&tg(y,["已选择的智能体中心",e]));w.useEffect(()=>{if(!p)return;const A=D=>{const U=D.target;U instanceof Node&&g.current&&!g.current.contains(U)&&m(!1)},O=D=>{D.key==="Escape"&&m(!1)};return window.addEventListener("pointerdown",A),window.addEventListener("keydown",O),()=>{window.removeEventListener("pointerdown",A),window.removeEventListener("keydown",O)}},[p]);const S=A=>{r(A),m(!1)};return l.jsxs("div",{className:"cw-a2a-space-picker",ref:g,children:[l.jsxs("div",{className:"cw-a2a-space-row",children:[l.jsxs("div",{className:"cw-a2a-space-select-wrap",children:[l.jsxs("button",{type:"button",className:`cw-a2a-space-trigger ${n?"is-error":""}`,disabled:k,"aria-haspopup":"listbox","aria-expanded":p,"aria-label":"选择 AgentKit 智能体中心",onClick:()=>{E(""),m(A=>!A)},children:[l.jsx("span",{className:e?void 0:"is-placeholder",children:_}),l.jsx(X6,{className:"cw-a2a-space-trigger-icon"})]}),p&&l.jsxs("div",{className:"cw-a2a-space-menu",children:[l.jsx("div",{className:"cw-picker-search",children:l.jsx("input",{className:"cw-picker-search-input",type:"search",value:y,autoFocus:!0,autoComplete:"off","aria-label":"搜索 AgentKit 智能体中心",placeholder:"搜索名称或 ID",onChange:A=>E(A.currentTarget.value)})}),l.jsxs("div",{className:"cw-picker-options",role:"listbox","aria-label":"AgentKit 智能体中心",children:[C&&l.jsx("button",{type:"button",role:"option","aria-selected":!0,className:"cw-a2a-space-option is-selected",onClick:()=>S(e),children:"已选择的智能体中心"}),N.map(A=>{const O=mb(A),D=A.id===e;return l.jsx("button",{type:"button",role:"option","aria-selected":D,className:`cw-a2a-space-option ${D?"is-selected":""}`,title:`${O} (${A.id})`,onClick:()=>S(A.id),children:O},A.id)}),!C&&N.length===0&&l.jsx("div",{className:"cw-picker-empty",children:"未找到匹配的智能体中心"})]})]})]}),l.jsx("button",{type:"button",className:"cw-icon-btn cw-a2a-space-refresh",title:"刷新智能体中心列表","aria-label":"刷新智能体中心列表",disabled:o,onClick:()=>h(A=>A+1),children:o?l.jsx(Rt,{className:"cw-i cw-i-sm cw-spin"}):l.jsx(Q6,{className:"cw-i cw-i-sm"})})]}),u?l.jsxs("div",{className:"cw-banner cw-a2a-space-error",children:[l.jsx(Ka,{className:"cw-i"}),l.jsx("span",{children:u})]}):o?l.jsxs("span",{className:"cw-help cw-a2a-space-status",children:[l.jsx(Rt,{className:"cw-i cw-i-sm cw-spin"}),"正在加载 AgentKit 智能体中心…"]}):i.length===0?l.jsx("span",{className:"cw-help",children:"此账号下暂无 AgentKit 智能体中心。"}):l.jsxs("span",{className:"cw-help",children:["已加载 ",i.length," 个智能体中心,列表仅展示中心名称。"]})]})}function jge({value:e,onChange:t}){const[n,r]=w.useState([]),[s,i]=w.useState(!1),[a,o]=w.useState(null),[c,u]=w.useState(0),[d,f]=w.useState(!1),[h,p]=w.useState(""),m=w.useRef(null);w.useEffect(()=>{let N=!1;return i(!0),o(null),Tge().then(C=>{N||r(C)}).catch(C=>{N||(r([]),o(C instanceof Error?C.message:"加载失败"))}).finally(()=>{N||i(!1)}),()=>{N=!0}},[c]);const y=!e||n.some(N=>N.id===e.trim()),E=n.find(N=>N.id===e.trim()),g=E?gb(E):e&&!y?e:"请选择 VikingDB 知识库",x=s&&n.length===0,b=w.useMemo(()=>n.filter(N=>tg(h,[gb(N),N.id,N.description,N.projectName])),[n,h]),_=!!(e&&!y&&tg(h,[e]));w.useEffect(()=>{if(!d)return;const N=S=>{const A=S.target;A instanceof Node&&m.current&&!m.current.contains(A)&&f(!1)},C=S=>{S.key==="Escape"&&f(!1)};return window.addEventListener("pointerdown",N),window.addEventListener("keydown",C),()=>{window.removeEventListener("pointerdown",N),window.removeEventListener("keydown",C)}},[d]);const k=N=>{t(N),f(!1)};return l.jsxs("div",{className:"cw-a2a-space-picker cw-viking-kb-picker",ref:m,children:[l.jsxs("div",{className:"cw-a2a-space-row",children:[l.jsxs("div",{className:"cw-a2a-space-select-wrap",children:[l.jsxs("button",{type:"button",className:"cw-a2a-space-trigger",disabled:x,"aria-haspopup":"listbox","aria-expanded":d,"aria-label":"选择 VikingDB 知识库",onClick:()=>{p(""),f(N=>!N)},children:[l.jsx("span",{className:e?void 0:"is-placeholder",children:g}),l.jsx(X6,{className:"cw-a2a-space-trigger-icon"})]}),d&&l.jsxs("div",{className:"cw-a2a-space-menu cw-viking-kb-menu",children:[l.jsx("div",{className:"cw-picker-search",children:l.jsx("input",{className:"cw-picker-search-input",type:"search",value:h,autoFocus:!0,autoComplete:"off","aria-label":"搜索 VikingDB 知识库",placeholder:"搜索名称或 ID",onChange:N=>p(N.currentTarget.value)})}),l.jsxs("div",{className:"cw-picker-options",role:"listbox","aria-label":"VikingDB 知识库",children:[_&&l.jsx("button",{type:"button",role:"option","aria-selected":!0,className:"cw-a2a-space-option is-selected",onClick:()=>k(e),children:e}),b.map(N=>{const C=gb(N),S=N.id===e;return l.jsx("button",{type:"button",role:"option","aria-selected":S,className:`cw-a2a-space-option ${S?"is-selected":""}`,title:`${C} (${N.id})`,onClick:()=>k(N.id),children:C},N.id)}),!_&&b.length===0&&l.jsx("div",{className:"cw-picker-empty",children:"未找到匹配的知识库"})]})]})]}),l.jsx("button",{type:"button",className:"cw-icon-btn cw-a2a-space-refresh cw-viking-kb-refresh",title:"刷新知识库列表","aria-label":"刷新知识库列表",disabled:s,onClick:()=>u(N=>N+1),children:s?l.jsx(Rt,{className:"cw-i cw-i-sm cw-spin"}):l.jsx(Q6,{className:"cw-i cw-i-sm"})})]}),a?l.jsxs("div",{className:"cw-banner cw-a2a-space-error",children:[l.jsx(Ka,{className:"cw-i"}),l.jsx("span",{children:a})]}):s?l.jsxs("span",{className:"cw-help cw-a2a-space-status",children:[l.jsx(Rt,{className:"cw-i cw-i-sm cw-spin"}),"正在加载 VikingDB 知识库…"]}):n.length===0?l.jsx("span",{className:"cw-help",children:"此账号下暂无 VikingDB 知识库。"}):l.jsxs("span",{className:"cw-help",children:["已加载 ",n.length," 个知识库,选择的知识库会用于当前 Agent。"]})]})}function Dge({tools:e,onChange:t}){const n=(i,a)=>t(e.map((o,c)=>c===i?{...o,...a}:o)),r=i=>t(e.filter((a,o)=>o!==i)),s=()=>t([...e,{name:"",transport:"http",url:""}]);return l.jsxs("div",{className:"cw-mcp",children:[e.length>0&&l.jsx("div",{className:"cw-mcp-list",children:l.jsx(pi,{initial:!1,children:e.map((i,a)=>l.jsxs($t.div,{className:"cw-mcp-row",layout:!0,initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,y:-6},transition:{duration:.16},children:[l.jsxs("div",{className:"cw-mcp-rowhead",children:[l.jsxs("div",{className:"cw-mcp-transport",children:[l.jsx("button",{type:"button",className:`cw-seg cw-seg-sm ${i.transport==="http"?"is-on":""}`,onClick:()=>n(a,{transport:"http"}),"aria-pressed":i.transport==="http",children:l.jsx("span",{className:"cw-seg-title",children:"HTTP"})}),l.jsx("button",{type:"button",className:`cw-seg cw-seg-sm ${i.transport==="stdio"?"is-on":""}`,onClick:()=>n(a,{transport:"stdio"}),"aria-pressed":i.transport==="stdio",children:l.jsx("span",{className:"cw-seg-title",children:"stdio"})})]}),l.jsx("button",{type:"button",className:"cw-icon-btn cw-icon-danger",onClick:()=>r(a),"aria-label":"移除 MCP 工具",children:l.jsx(ea,{className:"cw-i cw-i-sm"})})]}),l.jsx("input",{className:"cw-input",value:i.name,placeholder:"名称(用于命名,可留空)",onChange:o=>n(a,{name:o.target.value})}),i.transport==="http"?l.jsxs(l.Fragment,{children:[l.jsx("input",{className:"cw-input",value:i.url??"",placeholder:"MCP 服务地址(StreamableHTTP)",onChange:o=>n(a,{url:o.target.value})}),l.jsx("input",{className:"cw-input",value:i.authToken??"",placeholder:"Bearer Token(可选)",onChange:o=>n(a,{authToken:o.target.value})})]}):l.jsxs(l.Fragment,{children:[l.jsx("input",{className:"cw-input",value:i.command??"",placeholder:"启动命令,例如 npx",onChange:o=>n(a,{command:o.target.value})}),l.jsx("input",{className:"cw-input",value:(i.args??[]).join(" "),placeholder:"参数(用空格分隔),例如 -y @playwright/mcp@latest",onChange:o=>n(a,{args:o.target.value.split(/\s+/).filter(Boolean)})}),l.jsx("p",{className:"cw-mcp-note",children:"stdio MCP 暂不参与调试运行;点击“去部署”时会完整保留这项配置并生成对应代码。"})]})]},a))})}),l.jsxs("button",{type:"button",className:"cw-add-sub",onClick:s,children:[l.jsx(rr,{className:"cw-i"}),"添加 MCP 工具"]}),e.length===0&&l.jsx("p",{className:"cw-empty-line",children:"暂无 MCP 工具,点击「添加 MCP 工具」连接外部 MCP 服务。"})]})}function e5({className:e}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M5.5 7.5h10.75a2 2 0 0 1 2 2v7.75a2 2 0 0 1-2 2H5.5a2 2 0 0 1-2-2V9.5a2 2 0 0 1 2-2Z"}),l.jsx("path",{d:"M7 4.75h9.5a2 2 0 0 1 2 2",opacity:".58"}),l.jsx("path",{d:"m11 10.25.72 1.48 1.63.24-1.18 1.15.28 1.62-1.45-.77-1.45.77.28-1.62-1.18-1.15 1.63-.24.72-1.48Z"}),l.jsx("path",{d:"M19.25 11.25h1.5M20 10.5V12",opacity:".72"})]})}function Pge({s:e,onRemove:t}){let n=Po,r="火山 Find Skill 技能广场";return e.source==="local"?(n=Ow,r="本地"):e.source==="skillspace"&&(n=e5,r="AgentKit Skills 中心"),l.jsxs($t.div,{className:"cw-selected-skill-row",layout:!0,initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.16},children:[l.jsx("span",{className:"cw-selected-skill-icon","aria-hidden":!0,children:l.jsx(n,{className:"cw-i cw-i-sm"})}),l.jsxs("span",{className:"cw-selected-skill-meta",children:[l.jsx("span",{className:"cw-selected-skill-name",children:e.name}),l.jsxs("span",{className:"cw-selected-skill-detail",children:[r,e.description?` · ${As(e.description)}`:""]})]}),l.jsx("button",{type:"button",className:"cw-selected-skill-remove",onClick:t,"aria-label":`移除 ${e.name}`,title:`移除 ${e.name}`,children:l.jsx(zr,{className:"cw-i cw-i-sm"})})]},`${e.source}:${e.folder}:${e.skillId||e.slug||""}:${e.version||""}`)}const yb=[{id:"local",label:"本地文件",icon:Ow},{id:"skillspace",label:"AgentKit Skills 中心",icon:e5},{id:"skillhub",label:"火山 Find Skill 技能广场",icon:Cg}];function Bge({selected:e,onChange:t}){const[n,r]=w.useState("local"),[s,i]=w.useState(!1),a=yb.findIndex(c=>c.id===n),o=c=>t(e.filter(u=>bb(u)!==c));return w.useEffect(()=>{if(!s)return;const c=u=>{u.key==="Escape"&&i(!1)};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[s]),l.jsxs("div",{className:"cw-skillspane",children:[l.jsxs("button",{type:"button",className:"cw-skill-add","aria-haspopup":"dialog",onClick:()=>i(!0),children:[l.jsx("span",{className:"cw-skill-add-icon","aria-hidden":!0,children:l.jsx(rr,{className:"cw-i"})}),l.jsx("span",{children:"添加 Skill"})]}),e.length>0&&l.jsxs("div",{className:"cw-skill-selected",children:[l.jsxs("span",{className:"cw-skill-selected-label",children:["已加入技能 · ",e.length]}),l.jsx("div",{className:"cw-selected-skill-list",children:l.jsx(pi,{initial:!1,children:e.map(c=>l.jsx(Pge,{s:c,onRemove:()=>o(bb(c))},bb(c)))})})]}),l.jsx(pi,{children:s&&l.jsx($t.div,{className:"cw-skill-dialog-backdrop",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.16},onMouseDown:c=>{c.target===c.currentTarget&&i(!1)},children:l.jsxs($t.div,{className:"cw-skill-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"cw-skill-dialog-title",initial:{opacity:0,y:10,scale:.985},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:6,scale:.99},transition:{duration:.18,ease:"easeOut"},children:[l.jsxs("div",{className:"cw-skill-dialog-head",children:[l.jsx("h3",{id:"cw-skill-dialog-title",children:"添加 Skill"}),l.jsx("button",{type:"button",className:"cw-skill-dialog-close","aria-label":"关闭添加 Skill",onClick:()=>i(!1),children:l.jsx(zr,{className:"cw-i"})})]}),l.jsxs("div",{className:"cw-skill-dialog-body",children:[l.jsxs("div",{className:"cw-skill-sourcetabs",role:"tablist",style:{"--cw-skill-tab-slider-width":`calc((100% - 16px) / ${yb.length})`,"--cw-active-skill-tab-offset":`calc(${a*100}% + ${a*4}px)`},children:[l.jsx("span",{className:"cw-skill-tab-slider","aria-hidden":!0}),yb.map(({id:c,label:u,icon:d})=>l.jsxs("button",{type:"button",role:"tab",id:`cw-skill-tab-${c}`,"aria-controls":"cw-skill-tabpanel","aria-selected":n===c,className:`cw-skill-pickertab ${n===c?"is-on":""}`,onClick:()=>r(c),children:[l.jsx(d,{className:"cw-i cw-i-sm"}),u]},c))]}),l.jsxs("div",{id:"cw-skill-tabpanel",className:"cw-skill-tabbody",role:"tabpanel","aria-labelledby":`cw-skill-tab-${n}`,children:[n==="skillhub"&&l.jsx(dge,{selected:e,onChange:t}),n==="local"&&l.jsx(vge,{selected:e,onChange:t}),n==="skillspace"&&l.jsx(_ge,{selected:e,onChange:t})]})]})]})})})]})}function bb(e){return e.source==="skillhub"?`hub:${e.namespace}/${e.slug}`:e.source==="local"?`local:${e.folder}`:`ss:${e.skillSpaceId}/${e.skillId}/${e.version||""}`}function Iu({checked:e,onChange:t,title:n,desc:r,icon:s}){return l.jsxs("button",{type:"button",className:`cw-toggle ${e?"is-on":""}`,onClick:()=>t(!e),"aria-pressed":e,children:[l.jsx("span",{className:"cw-toggle-icon",children:l.jsx(s,{className:"cw-i"})}),l.jsxs("span",{className:"cw-toggle-text",children:[l.jsx("span",{className:"cw-toggle-title",children:n}),l.jsx("span",{className:"cw-toggle-desc",children:As(r)})]}),l.jsx("span",{className:"cw-switch","aria-hidden":!0,children:l.jsx($t.span,{className:"cw-switch-knob",layout:!0,transition:{type:"spring",stiffness:520,damping:34}})})]})}function Fge(e,t){var r;let n=e;for(const s of t)if(n=(r=n.subAgents)==null?void 0:r[s],!n)return!1;return!0}function sp(e,t){let n=e;for(const r of t)n=n.subAgents[r];return n}function Gf(e,t,n){if(t.length===0)return n(e);const[r,...s]=t,i=e.subAgents.slice();return i[r]=Gf(i[r],s,n),{...e,subAgents:i}}function Uge(e,t){return Gf(e,t,n=>({...n,subAgents:[...n.subAgents,Sr()]}))}function $ge(e,t,n){return Gf(e,t,r=>{const s=r.subAgents.slice();return s.splice(n,0,Sr()),{...r,subAgents:s}})}function Hge(e,t){if(t.length===0)return e;const n=t.slice(0,-1),r=t[t.length-1];return Gf(e,n,s=>({...s,subAgents:s.subAgents.filter((i,a)=>a!==r)}))}const GE=e=>!b0(e.agentType),oC=3;function zge(e,t,n=!1){var s;if(b0(e.agentType))return n?"远程 Agent 只能作为子 Agent":(s=e.a2aRegistry)!=null&&s.registrySpaceId.trim()?null:"缺少 AgentKit 智能体中心";const r=lc(e.name);return r||(t.has(e.name)?"Agent 名称在当前结构中必须唯一":e.description.trim().length===0?"缺少描述":K6(e.agentType)?e.subAgents.length===0?"缺少子 Agent":null:e.instruction.trim().length===0?"缺少系统提示词":null)}function t5(e,t,n=[]){const r=[],s=b0(e.agentType),i=zge(e,t,n.length===0);return i&&r.push({path:n,name:s?"远程 Agent":e.name.trim()||"未命名",problem:i}),GE(e)&&e.subAgents.forEach((a,o)=>r.push(...t5(a,t,[...n,o]))),r}function n5(e){return 1+e.subAgents.reduce((t,n)=>t+n5(n),0)}function r5(e){const t=[],n={},r=i=>{var a,o,c,u;for(const d of i.builtinTools??[]){const f=vc.find(h=>h.id===d);f&&t.push({env:f.env})}if((a=i.a2aRegistry)!=null&&a.enabled&&(t.push({env:SM}),Object.assign(n,J6(i.a2aRegistry,{includeDefaults:!0}))),i.memory.shortTerm&&t.push({env:((o=Q1.find(d=>d.id===(i.shortTermBackend??"local")))==null?void 0:o.env)??[]}),i.memory.longTerm&&t.push({env:((c=Z1.find(d=>d.id===(i.longTermBackend??"local")))==null?void 0:c.env)??[]}),i.knowledgebase&&t.push({env:((u=J1.find(d=>d.id===(i.knowledgebaseBackend??Gd)))==null?void 0:u.env)??[]}),i.tracing)for(const d of i.tracingExporters??[]){const f=eE.find(h=>h.id===d);f&&t.push({env:f.env,enableFlag:f.enableFlag})}i.subAgents.forEach(r)};r(e);const s=$6(t);return{specs:s.specs,fixedValues:{...s.fixedValues,...n}}}function s5(e){var t;return{...e,deployment:{feishuEnabled:!!((t=e.deployment)!=null&&t.feishuEnabled)}}}function Vge(e){var n;const t=e.name.trim();return t||(e.agentType!=="sequential"?"":((n=e.subAgents.find(r=>r.name.trim()))==null?void 0:n.name.trim())??"")}function i5(e){var r,s;const t=r5(e),n={...((r=e.deployment)==null?void 0:r.envValues)??{},...t.fixedValues};return{...s5(e),deployment:{feishuEnabled:!!((s=e.deployment)!=null&&s.feishuEnabled),envValues:Object.fromEntries(H6(t.specs,n).map(({key:i,value:a})=>[i,a]))}}}function Kge(e){return JSON.stringify(i5(e))}function ng(e,t){return JSON.stringify({draftSnapshot:e,modelName:t.modelName,description:t.description,instruction:t.instruction,optimizations:t.optimizations})}function Gl(e){return JSON.stringify({modelName:e.modelName.trim(),description:e.description.trim(),instruction:e.instruction.trim(),optimizations:e.optimizations})}function Yge({enabled:e,disabledReason:t,variants:n,draftSnapshot:r,input:s,onInput:i,onSend:a,onStartVariant:o,onDeployVariant:c,onAddVariant:u,onRemoveVariant:d,onToggleConfig:f,onCompleteConfig:h,onConfigChange:p}){const m=n.filter(g=>g.phase!=="ready"?!1:g.runtimeSnapshot===ng(r,g)),y=n.some(g=>g.phase==="sending"),E=m.length>0&&!y;return l.jsxs("section",{className:"cw-ab-workspace","aria-label":"A/B 调试工作台",children:[l.jsx("div",{className:"cw-ab-stage",children:e?l.jsxs("div",{className:"cw-ab-grid",children:[n.map((g,x)=>{const b=g.modelName.trim(),_=g.description.trim(),k=g.instruction.trim(),N=Gl(g),C=!!(b&&_&&k&&n.findIndex(T=>Gl(T)===N)!==x),S=!b||!_||!k||C,A=!!(g.runtimeSnapshot&&g.runtimeSnapshot!==ng(r,g)),O=g.phase==="starting",D=g.phase==="ready"&&!A,U=O||g.phase==="sending",X=U||g.configOpen||S,M=b?_?k?C?"该配置与已有测试组相同":"":"请填写系统提示词":"请填写描述":"请先选择模型",j=O?"正在启动":A?"应用配置并重启":D||g.phase==="error"?"重新启动环境":"启动环境";return l.jsx("article",{className:"cw-ab-card",children:l.jsxs("div",{className:`cw-ab-card-inner${g.configOpen?" is-flipped":""}`,children:[l.jsxs("section",{className:"cw-ab-card-face cw-ab-card-front","aria-hidden":g.configOpen,children:[l.jsxs("header",{className:"cw-ab-card-head",children:[l.jsxs("div",{className:"cw-ab-card-title",children:[l.jsx("strong",{children:g.name}),l.jsx("span",{children:g.modelName||"默认模型"})]}),l.jsxs("div",{className:"cw-ab-card-actions",children:[l.jsx("button",{type:"button",className:"cw-ab-config-trigger",disabled:g.configOpen||U,onClick:()=>f(g.id),children:"测试配置"}),g.id!=="baseline"&&l.jsx("button",{type:"button",className:"cw-ab-remove","aria-label":`删除${g.name}`,disabled:g.configOpen||U,onClick:()=>d(g.id),children:l.jsx(ea,{className:"cw-i"})})]})]}),l.jsx("div",{className:"cw-ab-conversation",children:g.error?l.jsx(eg,{message:g.error,className:"cw-debug-error-detail",onRetry:async()=>{await o(g.id)}}):O?l.jsxs("div",{className:"cw-ab-empty cw-ab-starting",children:[l.jsx(Rt,{className:"cw-i cw-spin"}),l.jsx("span",{children:"正在创建独立测试环境"})]}):A?l.jsxs("div",{className:"cw-ab-empty cw-ab-launch",children:[l.jsx("span",{children:"配置已变更,请重新启动此环境"}),l.jsxs("button",{type:"button",className:"cw-ab-start",disabled:X,onClick:()=>o(g.id),children:[l.jsx(H1,{className:"cw-i"}),j]})]}):g.messages.length===0?l.jsxs("div",{className:"cw-ab-empty cw-ab-launch",children:[l.jsxs("button",{type:"button",className:"cw-ab-start",disabled:X,title:M||void 0,onClick:()=>o(g.id),children:[D?l.jsx(H1,{className:"cw-i"}):l.jsx(Ige,{className:"cw-i cw-debug-run-icon"}),j]}),M?l.jsx("span",{className:"cw-ab-launch-hint",children:M}):D?l.jsx("span",{className:"cw-ab-launch-hint",children:"等待测试输入"}):null]}):g.messages.map((T,L)=>l.jsx("div",{className:`cw-debug-msg cw-debug-msg-${T.role}`,children:l.jsx("div",{className:"cw-debug-content",children:T.role==="user"?T.content:T.error?l.jsx(eg,{message:T.error,className:"cw-debug-msg-error"}):T.blocks&&T.blocks.length>0?l.jsx(Yv,{blocks:T.blocks,onAction:()=>{}}):T.content?T.content:L===g.messages.length-1&&g.phase==="sending"?l.jsx(Y4,{}):null})},L))}),l.jsx("footer",{className:"cw-ab-deploy-footer",children:l.jsx("button",{type:"button",className:"cw-ab-deploy",disabled:U||!b,onClick:()=>c(g.id),children:"部署该配置"})})]}),l.jsxs("section",{className:"cw-ab-card-face cw-ab-card-back","aria-hidden":!g.configOpen,children:[l.jsxs("header",{className:"cw-ab-config-head",children:[l.jsxs("div",{children:[l.jsx("strong",{children:"测试配置"}),l.jsx("span",{children:g.name})]}),l.jsxs("span",{className:`cw-ab-config-done-wrap${M?" is-disabled":""}`,tabIndex:M?0:void 0,children:[l.jsx("button",{type:"button",className:"cw-ab-config-done",disabled:!g.configOpen||S,onClick:()=>h(g.id),children:g.id==="baseline"?"完成配置":"完成并启动"}),M&&l.jsx("span",{className:"cw-ab-config-done-tip",role:"tooltip",children:M})]})]}),l.jsxs("div",{className:"cw-ab-config",children:[l.jsxs("label",{children:[l.jsx("span",{children:"模型"}),l.jsx("input",{value:g.modelName,placeholder:"使用 Agent 当前模型",disabled:!g.configOpen,onChange:T=>p(g.id,"modelName",T.target.value)})]}),l.jsxs("label",{children:[l.jsx("span",{children:"描述"}),l.jsx("textarea",{rows:2,value:g.description,disabled:!g.configOpen,onChange:T=>p(g.id,"description",T.target.value)})]}),l.jsxs("label",{children:[l.jsx("span",{children:"系统提示词"}),l.jsx("textarea",{rows:5,value:g.instruction,disabled:!g.configOpen,onChange:T=>p(g.id,"instruction",T.target.value)})]}),l.jsxs("fieldset",{className:"cw-ab-optimizations-disabled",children:[l.jsxs("legend",{children:[l.jsx("span",{children:"优化选项"}),l.jsx("em",{children:"待开放"})]}),l.jsx("div",{className:"cw-ab-optimization-list",children:a5.map(T=>l.jsxs("label",{children:[l.jsx("input",{type:"checkbox",checked:g.optimizations.includes(T.id),disabled:!0}),l.jsx("span",{children:T.label})]},T.id))})]}),l.jsx("p",{children:"设置完成后返回正面,再启动当前测试环境。"})]})]})]})},g.id)}),n.length<3&&l.jsxs("button",{type:"button",className:"cw-ab-add",onClick:u,children:[l.jsx(rr,{className:"cw-i"}),l.jsx("strong",{children:"添加对照组"}),l.jsx("span",{children:"最多同时创建 3 个测试组"})]})]}):l.jsx("div",{className:"cw-debug-empty",children:t})}),l.jsx("div",{className:"cw-ab-composer",children:l.jsxs("div",{className:"cw-debug-composerbox",children:[l.jsx("textarea",{className:"cw-debug-input",rows:1,value:s,placeholder:E?"输入测试消息,将发送到所有已启动测试组...":"请先启动至少一个测试组",disabled:!E,onChange:g=>i(g.target.value),onKeyDown:g=>{W4(g.nativeEvent)||g.key==="Enter"&&!g.shiftKey&&(g.preventDefault(),a())}}),l.jsx("button",{type:"button",className:"cw-debug-send",title:"发送",disabled:!E||!s.trim(),onClick:a,children:y?l.jsx(Rt,{className:"cw-i cw-spin"}):l.jsx(EL,{className:"cw-i"})})]})})]})}const lC=[{id:"build",label:"构建"},{id:"validate",label:"调试"},{id:"publish",label:"发布"}],a5=[{id:"context",label:"上下文优化",description:"压缩历史对话,保留与当前任务相关的信息"},{id:"grounding",label:"幻觉抑制",description:"对不确定内容要求依据,并明确表达未知"},{id:"tools",label:"工具调用优化",description:"减少重复调用,优先复用可信的工具结果"},{id:"latency",label:"响应加速",description:"缓存稳定上下文,降低重复推理开销"}];function Wge({mode:e,agentName:t,busy:n,onChange:r,onDiscard:s}){const i=lC.findIndex(a=>a.id===e);return l.jsxs("header",{className:"cw-workspace-header",children:[l.jsx("div",{className:"cw-workspace-identity",children:l.jsx("strong",{title:t,children:t||"未命名 Agent"})}),l.jsx("nav",{className:"cw-workspace-stepper","aria-label":"Agent 创建步骤",children:lC.map((a,o)=>{const c=a.id===e,u=or(a.id),children:l.jsx("strong",{children:a.label})},a.id)})}),s&&l.jsx("div",{className:"cw-workspace-actions",children:l.jsx("button",{type:"button",className:"cw-discard-edit",disabled:n,onClick:s,children:"放弃编辑"})})]})}function Gge({onBack:e,onCreate:t,onAgentAdded:n,initialDraft:r,features:s,onDeploymentTaskChange:i,deploymentTarget:a,onDeploymentComplete:o,onDeploymentStarted:c,onDraftChange:u,onDiscard:d}){var cs,Kr,Ga,qa,Xa,Si,Hn,Qa,Ti,Xf,Qf,nl,rl,sl,Zf;const[f,h]=w.useState(()=>r??Sr()),p=w.useRef(JSON.stringify(f)),m=w.useRef(p.current),y=JSON.stringify(f),E=y!==p.current,g=w.useRef(u);w.useEffect(()=>{g.current=u},[u]),w.useEffect(()=>{var q;y!==m.current&&(m.current=y,(q=g.current)==null||q.call(g,f,E))},[f,E,y]);const[x,b]=w.useState("build"),[_,k]=w.useState(!1),[N,C]=w.useState(!1),[S,A]=w.useState(0),[O,D]=w.useState(null),[U,X]=w.useState(!1),[M,j]=w.useState((a==null?void 0:a.region)??"cn-beijing"),T=(s==null?void 0:s.generatedAgentTestRun)===!0,L=(s==null?void 0:s.generatedAgentTestRunDisabledReason)||"当前后端暂不支持生成 Agent 调试运行。",[R,F]=w.useState(()=>[{id:"baseline",name:"基准组",modelName:(r??Sr()).modelName??"",description:(r??Sr()).description,instruction:(r??Sr()).instruction,optimizations:[],configOpen:!1,phase:"idle",runtimeSnapshot:"",messages:[],error:null}]),[I,V]=w.useState("baseline"),W=w.useRef(1),P=w.useRef(new Map),[ie,G]=w.useState(0),[re,ue]=w.useState(""),[ee,le]=w.useState("basic"),[ne,me]=w.useState(""),[ye,te]=w.useState(!1),[de,Ee]=w.useState(!1),[Te,Ke]=w.useState(!1),[Ne,it]=w.useState(!1),[He,Ue]=w.useState([]),Et=w.useRef(null),rt=w.useRef({});w.useEffect(()=>()=>{for(const{run:q}of P.current.values())Fu(q.runId).catch(pe=>console.warn("清理调试运行失败",pe));P.current.clear()},[]);const St=w.useRef(null);St.current||(St.current=({meta:q,children:pe})=>l.jsxs("section",{ref:ve=>{rt.current[q.id]=ve},id:`cw-sec-${q.id}`,"data-step-id":q.id,className:"cw-section",children:[l.jsx("header",{className:"cw-sec-head",children:l.jsxs("h2",{className:"cw-sec-title",children:[q.label,q.required&&l.jsx("span",{className:"cw-sec-required",children:"必填"})]})}),pe]}));const ct=Fge(f,He)?He:[],B=sp(f,ct),Q=ct.length===0,oe=`cw-model-advanced-${ct.join("-")||"root"}`,be=`cw-a2a-registry-advanced-${ct.join("-")||"root"}`,Oe=`cw-more-tool-types-${ct.join("-")||"root"}`,Ye=`cw-advanced-config-${ct.join("-")||"root"}`,tt=q=>h(pe=>Gf(pe,ct,ve=>({...ve,...q}))),ze=(q,pe)=>h(ve=>{var Qe;return{...ve,deployment:{...ve.deployment??{feishuEnabled:!1},envValues:{...((Qe=ve.deployment)==null?void 0:Qe.envValues)??{},[q]:pe}}}}),Tt=q=>tt({a2aRegistry:{...B.a2aRegistry??{enabled:!1,registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},...q}}),Re=(q,pe)=>{if(!(q in iC))return;const ve=iC[q];Tt({[ve]:pe}),ze(q,pe)},kt=q=>{if(!(Q&&q==="a2a")){if(q==="a2a"){tt({agentType:q,a2aRegistry:{...B.a2aRegistry??{registrySpaceId:"",registryTopK:"",registryRegion:"",registryEndpoint:""},enabled:!0}});return}tt({agentType:q,a2aRegistry:B.a2aRegistry?{...B.a2aRegistry,enabled:!1}:void 0})}},Pt=(q,pe)=>{h(q),pe&&Ue(pe)},Bt=q=>{const pe=sp(f,q);if(!GE(pe)||q.length>=oC)return;const ve=Uge(f,q),Qe=sp(ve,q).subAgents.length-1;Pt(ve,[...q,Qe])},bn=(q,pe)=>{const ve=sp(f,q);if(!GE(ve)||q.length>=oC)return;const Qe=Math.max(0,Math.min(pe,ve.subAgents.length)),Mt=$ge(f,q,Qe);Pt(Mt,[...q,Qe])},Xe=()=>{window.confirm("清空根 Agent 的全部配置和子 Agent?此操作无法撤销。")&&(h(Sr()),Ue([]),C(!1),it(!1))},ft=q=>{if(q.length===0){Xe();return}Pt(Hge(f,q),q.slice(0,-1))},xt=B.builtinTools??[],vt=B.mcpTools??[],fe=B.tracingExporters??[],$e=B.selectedSkills??[],nt=[B.memory.shortTerm,B.memory.longTerm,B.tracing].filter(Boolean).length,qt=q=>tt({builtinTools:xt.includes(q)?xt.filter(pe=>pe!==q):[...xt,q]}),fn=q=>{const pe=fe.includes(q)?fe.filter(ve=>ve!==q):[...fe,q];tt({tracingExporters:pe,tracing:pe.length>0?!0:B.tracing})},Lt=K6(B.agentType),J=b0(B.agentType),he=w.useMemo(()=>V6(f),[f]),Le=J?null:lc(B.name)??(he.has(B.name)?"Agent 名称在当前结构中必须唯一":null),Be=Le!==null,ot=!J&&B.description.trim().length===0,It=B.instruction.trim().length===0,st=J&&!((cs=B.a2aRegistry)!=null&&cs.registrySpaceId.trim()),Z=q=>N&&q?`is-error cw-error-shake-${S%2}`:"",we=w.useMemo(()=>t5(f,he),[f,he]),_e=we.length===0,We=w.useMemo(()=>Kge(f),[f]),Ve=R.find(q=>q.id===I)??R[0],Je=w.useMemo(()=>r5(f),[f]),ut=w.useMemo(()=>{var q,pe,ve,Qe;return{type:!0,basic:J?!st:!Be&&(Lt||!It),model:!!((q=B.modelName)!=null&&q.trim()||(pe=B.modelProvider)!=null&&pe.trim()||(ve=B.modelApiBase)!=null&&ve.trim()),tools:xt.length>0||vt.length>0,skills:$e.length>0,knowledge:B.knowledgebase,advanced:B.memory.shortTerm||B.memory.longTerm||B.tracing,subagents:(((Qe=B.subAgents)==null?void 0:Qe.length)??0)>0,review:_e}},[B,Be,It,Lt,J,_e,xt,vt,$e]),Ft=Lt||J?["type","basic"]:["type","basic","model","tools","skills","knowledge",...Q?["advanced"]:[]],hn=rC.filter(q=>Ft.includes(q.id)),Tn=Ft.join("|"),Kt=ct.join("."),os=hn.findIndex(q=>q.id===ee),Er=q=>{var pe;(pe=rt.current[q])==null||pe.scrollIntoView({behavior:"smooth",block:"start"})};w.useEffect(()=>{if(O)return;const q=Et.current;if(!q)return;const pe=Tn.split("|");let ve=0;const Qe=()=>{ve=0;const rn=pe[pe.length-1];let pn=pe[0];if(q.scrollTop+q.clientHeight>=q.scrollHeight-2)pn=rn;else{const Mn=q.getBoundingClientRect().top+24;for(const Cn of pe){const In=rt.current[Cn];if(!In||In.getBoundingClientRect().top>Mn)break;pn=Cn}}pn&&le(Mn=>Mn===pn?Mn:pn)},Mt=()=>{ve||(ve=window.requestAnimationFrame(Qe))};return Qe(),q.addEventListener("scroll",Mt,{passive:!0}),window.addEventListener("resize",Mt),()=>{q.removeEventListener("scroll",Mt),window.removeEventListener("resize",Mt),ve&&window.cancelAnimationFrame(ve)}},[O,Tn,Kt]);const Xn=()=>_e?!0:(C(!0),A(q=>q+1),we[0]&&(Ue(we[0].path),window.requestAnimationFrame(()=>Er("basic"))),!1),Or=async()=>{const q=[...P.current.values()];P.current.clear(),G(0),F(pe=>pe.map(ve=>({...ve,phase:"idle",runtimeSnapshot:"",messages:[],error:null}))),await Promise.all(q.map(async({run:pe})=>{try{await Fu(pe.runId)}catch(ve){console.warn("清理调试运行失败",ve)}}))},Qn=async q=>{const pe=P.current.get(q);if(pe){P.current.delete(q),G(P.current.size);try{await Fu(pe.run.runId)}catch(ve){console.warn("清理调试运行失败",ve)}}},ar=async()=>x!=="validate"||ie===0?!0:window.confirm("离开调试页面后,当前环境将被清理。您可以通过重新启动环境进行新的测试。")?(await Or(),!0):!1,An=async q=>{if(await ar()){if(me(""),!Xn()){b("build");return}X(!0);try{const pe=q?R.find(Mt=>Mt.id===q):Ve;pe&&V(pe.id);const ve=pe?{...f,modelName:pe.modelName||f.modelName,description:pe.description,instruction:pe.instruction}:f,Qe=await $w(s5(ve));ve!==f&&h(ve),D(Qe),b("publish")}catch(pe){me(pe instanceof Error?pe.message:String(pe))}finally{X(!1)}}},Xt=async q=>{if(!T||U||!Xn())return;const pe=R.find(Ct=>Ct.id===q);if(!pe||pe.phase==="starting"||pe.phase==="sending")return;const ve=pe.modelName.trim(),Qe=pe.description.trim(),Mt=pe.instruction.trim(),rn=Gl(pe),pn=R.findIndex(Ct=>Ct.id===q),Mn=R.findIndex(Ct=>Gl(Ct)===rn);if(!ve||!Qe||!Mt||Mn!==pn)return;const Cn=ng(We,pe);F(Ct=>Ct.map(lr=>lr.id===q?{...lr,configOpen:!1,phase:"starting",messages:[],error:null}:lr)),ue("");let In=null;try{await Qn(q);const Ct={...f,modelName:pe.modelName||f.modelName,description:pe.description,instruction:pe.instruction};In=await dM(i5(Ct));const lr=await fM(In.runId,"test_user");P.current.set(q,{run:In,sessionId:lr}),G(P.current.size),F(sn=>sn.map(iu=>iu.id===q?{...iu,phase:"ready",runtimeSnapshot:Cn}:iu))}catch(Ct){if(In)try{await Fu(In.runId)}catch(lr){console.warn("清理调试运行失败",lr)}F(lr=>lr.map(sn=>sn.id===q?{...sn,phase:"error",runtimeSnapshot:"",error:Ct instanceof Error?Ct.message:String(Ct)}:sn))}},En=async()=>{const q=re.trim(),pe=R.filter(Qe=>Qe.phase==="ready"&&Qe.runtimeSnapshot===ng(We,Qe)&&P.current.has(Qe.id));if(!q||pe.length===0)return;ue("");const ve=new Set(pe.map(Qe=>Qe.id));F(Qe=>Qe.map(Mt=>ve.has(Mt.id)?{...Mt,phase:"sending",messages:[...Mt.messages,{role:"user",content:q},{role:"assistant",content:"",blocks:[]}]}:Mt)),await Promise.all(pe.map(async Qe=>{const Mt=P.current.get(Qe.id);if(Mt)try{let rn=zs();for await(const pn of hM({runId:Mt.run.runId,userId:"test_user",sessionId:Mt.sessionId,text:q})){const Mn=pn.error||pn.errorMessage||pn.error_message;if(F(Cn=>Cn.map(In=>{if(In.id!==Qe.id)return In;const Ct=[...In.messages],lr={...Ct[Ct.length-1]};return Mn?lr.error=String(Mn):(rn=Ec(rn,pn),lr.content=rn.blocks.filter(sn=>sn.kind==="text").map(sn=>sn.text).join(""),lr.blocks=rn.blocks),Ct[Ct.length-1]=lr,{...In,messages:Ct}})),Mn)break}}catch(rn){F(pn=>pn.map(Mn=>{if(Mn.id!==Qe.id)return Mn;const Cn=[...Mn.messages],In={...Cn[Cn.length-1]};return In.error=rn instanceof Error?rn.message:String(rn),Cn[Cn.length-1]=In,{...Mn,messages:Cn}}))}finally{F(rn=>rn.map(pn=>pn.id===Qe.id?{...pn,phase:"ready"}:pn))}}))},Un=()=>{F(q=>{if(q.length>=3)return q;const pe=W.current++,ve=`variant-${pe}`;return[...q,{id:ve,name:`对照组 ${pe}`,modelName:f.modelName??"",description:f.description,instruction:f.instruction,optimizations:[],configOpen:!0,phase:"idle",runtimeSnapshot:"",messages:[],error:null}]})},or=async q=>{await Qn(q),F(pe=>pe.filter(ve=>ve.id!==q)),I===q&&V("baseline")},nn=(q,pe)=>F(ve=>ve.map(Qe=>Qe.id===q?{...Qe,...pe}:Qe)),ls=(q,pe,ve)=>{nn(q,{[pe]:ve}),!(I!==q||q==="baseline")&&V("baseline")},Zn=q=>{const pe=R.find(Cn=>Cn.id===q);if(!pe)return;const ve=pe.modelName.trim(),Qe=pe.description.trim(),Mt=pe.instruction.trim(),rn=Gl(pe),pn=R.findIndex(Cn=>Cn.id===q),Mn=R.findIndex(Cn=>Gl(Cn)===rn);if(!(!ve||!Qe||!Mt||Mn!==pn)){if(q==="baseline"){nn(q,{configOpen:!1});return}Xt(q)}},$n=async(q,pe,ve)=>{var rn;const Qe=(rn=f.deployment)==null?void 0:rn.network,Mt=Qe&&Qe.mode&&Qe.mode!=="public"?{mode:Qe.mode,vpc_id:Qe.vpcId,subnet_ids:Qe.subnetIds,enable_shared_internet_access:Qe.enableSharedInternetAccess}:void 0;return Rg(q.name,q.files,{region:(a==null?void 0:a.region)??M,projectName:"default",network:Mt},{...ve,onStage:pe,runtimeId:a==null?void 0:a.runtimeId,description:f.description})},Jn=()=>{Xn()&&(F(q=>q.map(pe=>pe.id==="baseline"&&!P.current.has(pe.id)?{...pe,modelName:f.modelName??"",description:f.description,instruction:f.instruction}:pe)),b("validate"))},Is=async q=>{if(q==="publish"){O?b("publish"):An();return}if(q==="validate"){Jn();return}await ar()&&b(q)},Rr=St.current,xr=q=>rC.find(pe=>pe.id===q);return l.jsxs("div",{className:"cw-root",children:[l.jsx(Wge,{mode:x,agentName:Vge(f),busy:U,onChange:Is,onDiscard:d?()=>{E?k(!0):d()}:void 0}),ne&&l.jsx("div",{className:"cw-workspace-alert",role:"alert",children:ne}),l.jsxs("main",{className:"cw-workspace-main",id:"cw-workspace-main",children:[x==="build"&&l.jsxs("div",{className:"cw-editor",children:[l.jsx(Xm,{draft:f,direction:"vertical",selectedPath:ct,onSelect:Ue,onAdd:Bt,onInsert:bn,onDelete:ft}),l.jsxs("div",{className:"cw-detail",children:[l.jsx("div",{className:"cw-detail-scroll",ref:Et,children:l.jsx("div",{className:"cw-detail-inner",children:l.jsxs("div",{className:"cw-lower",children:[l.jsxs("div",{className:"cw-form-col",children:[l.jsx(Rr,{meta:xr("type"),children:l.jsx("div",{className:"cw-agent-type-options",role:"radiogroup","aria-label":"Agent 类型",children:oge.map(q=>{const pe=(B.agentType??"llm")===q.id,ve=Q&&q.id==="a2a",Qe=ve?"cw-remote-agent-disabled-hint":void 0;return l.jsxs("label",{"data-agent-type":q.id,className:`cw-agent-type-option ${pe?"is-on":""} ${ve?"is-disabled":""}`,title:ve?void 0:sC[q.id],tabIndex:ve?0:void 0,"aria-describedby":Qe,children:[l.jsx("input",{type:"radio",name:"agentType",className:"cw-agent-type-radio",checked:pe,disabled:ve,onChange:()=>kt(q.id)}),l.jsxs("span",{className:"cw-agent-type-copy",children:[l.jsx("strong",{children:Oge[q.id]}),l.jsx("small",{children:sC[q.id]})]}),ve&&l.jsx("span",{id:Qe,className:"cw-agent-type-disabled-hint",role:"tooltip",children:"远程智能体只能作为子步骤使用"})]},q.id)})})}),l.jsx(Rr,{meta:xr("basic"),children:l.jsxs("div",{className:"cw-form",children:[!J&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"cw-field",children:[l.jsxs("label",{className:"cw-label",children:[Q?"Agent 名称":"步骤名称",l.jsx("span",{className:"cw-req",children:"*"})]}),l.jsx("input",{className:`cw-input ${Z(Be)}`,value:B.name,placeholder:"customer_service",onChange:q=>tt({name:q.target.value})}),N&&Le?l.jsx("span",{className:"cw-error-text",children:Le}):l.jsx("span",{className:"cw-help",children:"遵循 Google ADK 命名规则,且在执行流程中保持唯一。"})]}),l.jsxs("div",{className:"cw-field",children:[l.jsxs("label",{className:"cw-label",children:[Q?"描述":"任务说明",l.jsx("span",{className:"cw-req",children:"*"})]}),l.jsx("textarea",{className:`cw-textarea cw-textarea-sm ${Z(ot)}`,value:B.description,placeholder:"简要描述这个 Agent 的用途,便于团队识别…",onChange:q=>tt({description:q.target.value})}),N&&ot?l.jsx("span",{className:"cw-error-text",children:"描述为必填项"}):l.jsx("span",{className:"cw-help",children:"描述会显示在 Agent 列表与选择器中。"})]})]}),Lt?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"cw-section-desc",children:"这是一个协作容器,本身不生成回答。请在左侧画布中 添加任务步骤,并通过拖拽调整它们的位置。"}),B.agentType==="loop"&&l.jsxs("div",{className:"cw-field",children:[l.jsx("label",{className:"cw-label",children:"最大轮次"}),l.jsx("input",{className:"cw-input",type:"number",min:1,value:B.maxIterations??3,onChange:q=>tt({maxIterations:Math.max(1,Number(q.target.value)||1)})}),l.jsx("span",{className:"cw-help",children:"循环编排反复执行子 Agent,直到满足条件或达到该轮次上限。"})]})]}):J?l.jsxs("div",{className:"cw-field cw-remote-center-fields",children:[l.jsxs("div",{className:"cw-remote-center-head",children:[l.jsxs("div",{className:"cw-label",children:["AgentKit 智能体中心",l.jsx("span",{className:"cw-req",children:"*"})]}),l.jsx("p",{className:"cw-help cw-remote-center-description",children:"远程 Agent 的名称、描述和能力来自中心返回的 Agent Card。 系统会根据每轮任务动态发现并挂载匹配的 Agent。"})]}),l.jsx(Mge,{value:((Kr=B.a2aRegistry)==null?void 0:Kr.registrySpaceId)??"",region:((Ga=B.a2aRegistry)==null?void 0:Ga.registryRegion)||qs.region,invalid:N&&st,onChange:q=>Re(Z6,q)}),l.jsxs("button",{type:"button",className:"cw-more-options","aria-expanded":de,"aria-controls":be,onClick:()=>Ee(q=>!q),children:[l.jsx("span",{children:"更多选项"}),l.jsx(ws,{className:`cw-more-options-chevron ${de?"is-open":""}`,"aria-hidden":!0})]}),l.jsx(pi,{initial:!1,children:de&&l.jsx($t.div,{id:be,className:"cw-model-advanced",initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.18,ease:"easeOut"},children:l.jsx(yl,{env:Rge,values:J6(B.a2aRegistry,{includeDefaults:!1}),onChange:Re})})}),N&&st&&l.jsx("span",{className:"cw-error-text",children:"请选择 AgentKit 智能体中心"})]}):l.jsxs("div",{className:"cw-field",children:[l.jsxs("label",{className:"cw-label",children:["系统提示词",l.jsx("span",{className:"cw-req",children:"*"})]}),l.jsx(w.Suspense,{fallback:l.jsx("div",{className:"cw-markdown-loading",role:"status",children:"正在加载 Markdown 编辑器…"}),children:l.jsx(Age,{value:B.instruction,invalid:It,onChange:q=>tt({instruction:q})})}),N&&It?l.jsx("span",{className:"cw-error-text",children:"系统提示词为必填项"}):l.jsx("span",{className:"cw-help",children:"支持 Markdown 快捷输入,例如键入 ## 加空格创建二级标题。"})]})]})}),!Lt&&!J&&l.jsxs(l.Fragment,{children:[l.jsx(Rr,{meta:xr("model"),children:l.jsxs("div",{className:"cw-form",children:[l.jsxs("div",{className:"cw-field",children:[l.jsx("label",{className:"cw-label",children:"模型名称"}),l.jsx("input",{className:"cw-input",value:B.modelName??"",placeholder:"doubao-seed-2-1-pro-260628",onChange:q=>tt({modelName:q.target.value})})]}),l.jsxs("button",{type:"button",className:"cw-more-options","aria-expanded":ye,"aria-controls":oe,onClick:()=>te(q=>!q),children:[l.jsx("span",{children:"更多选项"}),l.jsx(ws,{className:`cw-more-options-chevron ${ye?"is-open":""}`,"aria-hidden":!0})]}),l.jsx(pi,{initial:!1,children:ye&&l.jsxs($t.div,{id:oe,className:"cw-model-advanced",initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.18,ease:"easeOut"},children:[l.jsxs("div",{className:"cw-field",children:[l.jsx("label",{className:"cw-label",children:"服务商 Provider"}),l.jsx("input",{className:"cw-input",value:B.modelProvider??"",placeholder:"openai",onChange:q=>tt({modelProvider:q.target.value})})]}),l.jsxs("div",{className:"cw-field",children:[l.jsx("label",{className:"cw-label",children:"API Base"}),l.jsx("input",{className:"cw-input",value:B.modelApiBase??"",placeholder:"https://ark.cn-beijing.volces.com/api/v3/",onChange:q=>tt({modelApiBase:q.target.value})}),l.jsx("span",{className:"cw-help",children:"留空则使用 VeADK 默认模型配置;Ark API Key 会由 Studio 服务端凭据自动获取。其他服务商的 Key 可在部署页添加。"})]})]})})]})}),l.jsx(Rr,{meta:xr("tools"),children:l.jsxs("div",{className:"cw-form",children:[l.jsxs("div",{className:"cw-field",children:[l.jsx("label",{className:"cw-label",children:"内置工具"}),l.jsx("span",{className:"cw-help",children:"勾选 VeADK 提供的内置能力,生成时会自动补全 import 与所需环境变量。"}),l.jsx("div",{className:"cw-tools-list-shell",children:l.jsx(aC,{items:vc,selected:xt,onToggle:qt,scrollRows:6})}),l.jsx(pi,{initial:!1,children:xt.includes("run_code")&&l.jsxs($t.div,{className:"cw-tool-config",initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.16,ease:"easeOut"},children:[l.jsxs("div",{className:"cw-tool-config-head",children:[l.jsx("span",{className:"cw-label",children:"代码执行配置"}),l.jsx("span",{className:"cw-help",children:"指定 AgentKit 代码执行沙箱。"})]}),l.jsx(yl,{env:((qa=vc.find(q=>q.id==="run_code"))==null?void 0:qa.env)??[],values:((Xa=f.deployment)==null?void 0:Xa.envValues)??{},onChange:ze})]})})]}),l.jsxs("button",{type:"button",className:"cw-more-options","aria-expanded":Te,"aria-controls":Oe,onClick:()=>Ke(q=>!q),children:[l.jsx("span",{children:"更多类型工具"}),vt.length>0&&l.jsxs("span",{className:"cw-more-options-count",children:["已配置 ",vt.length]}),l.jsx(ws,{className:`cw-more-options-chevron ${Te?"is-open":""}`,"aria-hidden":!0})]}),l.jsx(pi,{initial:!1,children:Te&&l.jsx($t.div,{id:Oe,className:"cw-model-advanced",initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.18,ease:"easeOut"},children:l.jsxs("div",{className:"cw-field",children:[l.jsx("label",{className:"cw-label",children:"MCP 工具"}),l.jsx("span",{className:"cw-help",children:"连接外部 MCP 服务,生成时会为每个条目创建对应的 MCPToolset。"}),l.jsx(Dge,{tools:vt,onChange:q=>tt({mcpTools:q})})]})})})]})}),l.jsx(Rr,{meta:xr("skills"),children:l.jsx("div",{className:"cw-form",children:l.jsx(Bge,{selected:$e,onChange:q=>tt({selectedSkills:q})})})}),l.jsx(Rr,{meta:xr("knowledge"),children:l.jsxs("div",{className:"cw-form cw-toggle-stack",children:[l.jsx(Iu,{checked:B.knowledgebase,onChange:q=>tt({knowledgebase:q}),title:"知识库",desc:"启用外部知识检索(RAG),让 Agent 基于你的资料作答。",icon:vp}),B.knowledgebase&&l.jsxs("div",{className:"cw-field cw-subfield",children:[l.jsx("label",{className:"cw-label",children:"知识库后端"}),l.jsx(pb,{options:J1,value:B.knowledgebaseBackend,onChange:q=>tt({knowledgebaseBackend:q,knowledgebaseIndex:q==="viking"?B.knowledgebaseIndex:""})}),(B.knowledgebaseBackend??Gd)==="viking"&&l.jsxs("div",{className:"cw-field cw-subfield",children:[l.jsx("label",{className:"cw-label",children:"VikingDB 知识库"}),l.jsx(jge,{value:B.knowledgebaseIndex??"",onChange:q=>tt({knowledgebaseIndex:q})})]}),l.jsx(yl,{env:((Si=J1.find(q=>q.id===(B.knowledgebaseBackend??Gd)))==null?void 0:Si.env)??[],values:((Hn=f.deployment)==null?void 0:Hn.envValues)??{},onChange:ze})]})]})}),Q&&l.jsxs("section",{ref:q=>{rt.current.advanced=q},id:"cw-sec-advanced","data-step-id":"advanced",className:"cw-section cw-advanced-section",children:[l.jsxs("button",{type:"button",className:"cw-advanced-disclosure","aria-expanded":Ne,"aria-controls":Ye,onClick:()=>it(q=>!q),children:[l.jsx("span",{className:"cw-advanced-disclosure-title",children:"进阶配置"}),l.jsx(ws,{className:`cw-advanced-disclosure-chevron ${Ne?"is-open":""}`,"aria-hidden":!0}),nt>0&&l.jsxs("span",{className:"cw-more-options-count",children:["已启用 ",nt]})]}),l.jsx(pi,{initial:!1,children:Ne&&l.jsxs($t.div,{id:Ye,className:"cw-advanced-content",initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeOut"},children:[l.jsxs("div",{className:"cw-advanced-group",children:[l.jsx("div",{className:"cw-advanced-group-head",children:l.jsx("span",{children:"记忆"})}),l.jsxs("div",{className:"cw-form cw-toggle-stack",children:[l.jsx(Iu,{checked:B.memory.shortTerm,onChange:q=>tt({memory:{...B.memory,shortTerm:q}}),title:"短期记忆",desc:"在单次会话内保留上下文,跨轮次记住对话内容。",icon:AL}),B.memory.shortTerm&&l.jsxs("div",{className:"cw-field cw-subfield",children:[l.jsx("label",{className:"cw-label",children:"短期记忆后端"}),l.jsx(pb,{options:Q1,value:B.shortTermBackend,onChange:q=>tt({shortTermBackend:q})}),l.jsx(yl,{env:((Qa=Q1.find(q=>q.id===(B.shortTermBackend??"local")))==null?void 0:Qa.env)??[],values:((Ti=f.deployment)==null?void 0:Ti.envValues)??{},onChange:ze})]}),l.jsx(Iu,{checked:B.memory.longTerm,onChange:q=>tt({memory:{...B.memory,longTerm:q}}),title:"长期记忆",desc:"跨会话持久化关键信息,让 Agent 记住历史偏好。",icon:vp}),B.memory.longTerm&&l.jsxs("div",{className:"cw-field cw-subfield",children:[l.jsx("label",{className:"cw-label",children:"长期记忆后端"}),l.jsx(pb,{options:Z1,value:B.longTermBackend,onChange:q=>tt({longTermBackend:q})}),l.jsx(yl,{env:((Xf=Z1.find(q=>q.id===(B.longTermBackend??"local")))==null?void 0:Xf.env)??[],values:((Qf=f.deployment)==null?void 0:Qf.envValues)??{},onChange:ze}),l.jsx(Iu,{checked:!!B.autoSaveSession,onChange:q=>tt({autoSaveSession:q}),title:"自动保存会话到长期记忆",desc:"会话结束时自动把内容写入长期记忆,无需手动调用。",icon:vp})]})]})]}),l.jsxs("div",{className:"cw-advanced-group",children:[l.jsx("div",{className:"cw-advanced-group-head",children:l.jsx("span",{children:"观测"})}),l.jsxs("div",{className:"cw-form cw-toggle-stack",children:[l.jsx(Iu,{checked:B.tracing,onChange:q=>tt({tracing:q}),title:"观测 / Tracing",desc:"记录每一步的调用链路与耗时,便于调试与性能分析。",icon:_L}),B.tracing&&l.jsxs("div",{className:"cw-field cw-subfield",children:[l.jsx("label",{className:"cw-label",children:"Tracing 导出器"}),l.jsx("span",{className:"cw-help",children:"选择一个或多个观测平台,生成时会写入对应的 ENABLE_* 开关与环境变量。"}),l.jsx(aC,{items:eE,selected:fe,onToggle:fn}),l.jsx(yl,{env:eE.filter(q=>fe.includes(q.id)).flatMap(q=>q.env),values:((nl=f.deployment)==null?void 0:nl.envValues)??{},onChange:ze})]})]})]})]})})]})]})]}),l.jsx("nav",{className:"cw-rail","aria-label":"步骤导航",children:l.jsxs("ol",{className:"cw-steps",children:[l.jsx("div",{className:"cw-rail-track","aria-hidden":!0,children:l.jsx($t.div,{className:"cw-rail-fill",animate:{height:`${Math.max(os,0)/Math.max(hn.length-1,1)*100}%`},transition:{type:"spring",stiffness:260,damping:32}})}),hn.map(q=>{const pe=q.id===ee,ve=ut[q.id];return l.jsx("li",{children:l.jsxs("button",{type:"button",className:`cw-step ${pe?"is-active":""} ${ve?"is-done":""}`,onClick:()=>Er(q.id),"aria-current":pe?"step":void 0,"aria-label":q.label,children:[l.jsx("span",{className:"cw-step-marker","aria-hidden":!0,children:pe?l.jsx("span",{className:"cw-dot"}):ve?l.jsx(Js,{className:"cw-step-check"}):l.jsx("span",{className:"cw-dot"})}),l.jsx("span",{className:"cw-step-tooltip","aria-hidden":!0,children:q.label})]})},q.id)})]})})]})})}),l.jsx("button",{type:"button",className:"cw-build-next studio-update-action",onClick:Jn,children:l.jsx("span",{children:"开始调试"})})]})]}),x==="validate"&&l.jsx("div",{className:"cw-validation-workspace",children:l.jsx("div",{className:"cw-validation-content",children:l.jsx(Yge,{enabled:T,disabledReason:L,variants:R,draftSnapshot:We,input:re,onInput:ue,onSend:En,onStartVariant:Xt,onDeployVariant:q=>void An(q),onAddVariant:Un,onRemoveVariant:or,onToggleConfig:q=>{const pe=R.find(ve=>ve.id===q);pe&&nn(q,{configOpen:!pe.configOpen})},onCompleteConfig:Zn,onConfigChange:ls})})}),x==="publish"&&l.jsx("div",{className:"cw-preview-body",children:O?l.jsx(y0,{embedded:!0,project:O,agentDraft:f,agentName:f.name||"未命名 Agent",agentCount:n5(f),releaseConfiguration:Ve?{modelName:Ve.modelName||f.modelName||"默认模型",description:Ve.description,instruction:Ve.instruction,optimizations:Ve.optimizations.flatMap(q=>{const pe=a5.find(ve=>ve.id===q);return pe?[pe.label]:[]})}:void 0,onChange:D,onDeploy:$n,onAgentAdded:n,onDeploymentTaskChange:i,deploymentActionLabel:a?"更新并发布":"部署",deploymentRuntimeId:a==null?void 0:a.runtimeId,onDeploymentStarted:c,onDeploymentComplete:o,feishuEnabled:!!((rl=f.deployment)!=null&&rl.feishuEnabled),onFeishuEnabledChange:q=>{const pe={...f,deployment:{...f.deployment??{feishuEnabled:!1},feishuEnabled:q}};h(pe)},deploymentEnv:Je.specs,deploymentEnvValues:{...(sl=f.deployment)==null?void 0:sl.envValues,...Je.fixedValues},onDeploymentEnvChange:ze,network:(Zf=f.deployment)==null?void 0:Zf.network,onNetworkChange:q=>h(pe=>({...pe,deployment:{...pe.deployment??{feishuEnabled:!1},network:q}})),deployRegion:M,onDeployRegionChange:j,onExportYaml:()=>Cge(`${f.name||"agent"}.yaml`,Ime(f),"text/yaml")}):l.jsxs("div",{className:"cw-publish-loading",role:"status",children:[l.jsx(Rt,{className:"cw-i cw-spin"}),l.jsx("strong",{children:"正在生成发布配置"}),l.jsx("span",{children:"校验 Agent 结构并准备部署快照…"})]})})]}),_&&l.jsx("div",{className:"confirm-scrim",onClick:()=>k(!1),children:l.jsxs("div",{className:"confirm-box",role:"dialog","aria-modal":"true","aria-labelledby":"discard-edit-title",onClick:q=>q.stopPropagation(),children:[l.jsx("div",{className:"confirm-title",id:"discard-edit-title",children:"放弃本次编辑?"}),l.jsx("div",{className:"confirm-text",children:"本次修改将不会保留,智能体会恢复到进入编辑前的状态。"}),l.jsxs("div",{className:"confirm-actions",children:[l.jsx("button",{type:"button",className:"confirm-btn",onClick:()=>k(!1),children:"继续编辑"}),l.jsx("button",{type:"button",className:"confirm-btn confirm-btn--danger",onClick:()=>{k(!1),d==null||d()},children:"放弃编辑"})]})]})})]})}function ji(e){return{...Sr(),...e}}const qge=[{id:"support",icon:OH,draft:ji({name:"客服助手",description:"7×24 在线答疑,结合知识库与历史对话,稳定、礼貌地解决用户问题。",instruction:"你是一名专业、耐心的客服助手。请始终保持礼貌、友好的语气,优先依据知识库中的资料回答用户问题;当资料不足以确定答案时,如实告知用户并主动引导其提供更多信息,切勿编造。回答尽量简洁、分点清晰,必要时给出操作步骤。",model:"doubao-1.5-pro-32k",knowledgebase:!0,memory:{shortTerm:!0,longTerm:!0}})},{id:"analyst",icon:pH,draft:ji({name:"数据分析师",description:"运行代码完成统计与可视化,开启链路追踪,分析过程可观测、可复现。",instruction:"你是一名严谨的数据分析师。面对数据问题时,先厘清分析目标与口径,再通过编写并运行代码完成清洗、统计与可视化。每一步都要说明你的假设与方法,给出结论时附上关键数据支撑,并指出潜在的偏差与局限。",model:"doubao-1.5-pro-32k",tools:["code_runner"],tracing:!0})},{id:"translator",icon:RH,draft:ji({name:"翻译助手",description:"中英互译,忠实、通顺、地道,保留原文语气与专业术语。",instruction:"你是一名专业的翻译助手,精通中英互译。请在忠实于原文含义的前提下,使译文自然、地道、符合目标语言表达习惯;保留专有名词与专业术语的准确性,并尽量贴合原文的语气与风格。仅输出译文,除非用户额外要求解释。",model:"doubao-1.5-pro-32k"})},{id:"coder",icon:Tw,draft:ji({name:"代码助手",description:"编写、调试与重构代码,可运行代码验证结果,给出清晰可维护的实现。",instruction:"你是一名资深软件工程师。请根据需求编写正确、清晰、可维护的代码,遵循目标语言的惯用风格与最佳实践。在不确定时通过运行代码验证你的实现,给出关键的边界条件与测试思路,并对复杂逻辑附上简要注释。",model:"doubao-1.5-pro-32k",tools:["code_runner","file_reader"],tracing:!0})},{id:"researcher",icon:BH,draft:ji({name:"研究员",description:"联网检索一手资料,结合知识库与长期记忆,输出有据可查的研究结论。",instruction:"你是一名严谨的研究员。面对研究问题时,先拆解关键子问题,再通过联网检索收集多个一手、可信的来源,交叉验证后再下结论。结论需注明出处与不确定性,区分事实与推断,避免以偏概全。",model:"doubao-1.5-pro-32k",tools:["web_search"],knowledgebase:!0,memory:{shortTerm:!0,longTerm:!0}})},{id:"research-team",icon:QH,draft:ji({name:"多智能体研究团队",description:"由检索员、分析员、撰写员协作的研究编排,分工完成端到端调研报告。",instruction:"你是一支研究团队的总协调者。负责拆解用户的研究任务,将检索、分析、撰写分别委派给对应的子 Agent,汇总各子 Agent 的产出,把控整体质量,最终输出结构清晰、有据可查的研究报告。",model:"doubao-1.5-pro-32k",tracing:!0,memory:{shortTerm:!0,longTerm:!0},subAgents:[ji({name:"检索员",description:"联网搜集与课题相关的一手资料与数据。",instruction:"你是研究团队中的检索员。根据课题联网检索多个可信来源,整理出关键事实、数据与原文出处,交付给分析员,不做主观结论。",tools:["web_search"]}),ji({name:"分析员",description:"对检索到的材料做交叉验证与归纳分析。",instruction:"你是研究团队中的分析员。对检索员提供的材料做交叉验证、归纳与对比,提炼洞见、识别矛盾与不确定性,形成结构化的分析要点。",tools:["code_runner"]}),ji({name:"撰写员",description:"将分析结论组织为结构清晰、引用规范的报告。",instruction:"你是研究团队中的撰写员。把分析员的要点组织成结构清晰、语言通顺、引用规范的研究报告,确保每个结论都能追溯到来源。"})]})}];function Xge(e){const t=[];return e.tools.length&&t.push({icon:RL,label:"工具"}),(e.memory.shortTerm||e.memory.longTerm)&&t.push({icon:hH,label:"记忆"}),e.knowledgebase&&t.push({icon:fH,label:"知识库"}),e.tracing&&t.push({icon:dH,label:"观测"}),e.subAgents.length&&t.push({icon:OL,label:`子Agent ${e.subAgents.length}`}),t}function Qge({onBack:e,onCreate:t}){const[n,r]=w.useState(null);return l.jsx("div",{className:"tpl-root",children:n?l.jsx(Jge,{template:n,onBack:()=>r(null),onCreate:t}):l.jsx(Zge,{onPick:r})})}function Zge({onPick:e}){return l.jsxs("div",{className:"tpl-scroll",children:[l.jsxs("div",{className:"tpl-head",children:[l.jsx("h1",{className:"tpl-title",children:"从模板新建"}),l.jsx("p",{className:"tpl-sub",children:"选择一个预制 agent 模板,按需微调后即可创建。"})]}),l.jsx("div",{className:"tpl-grid",children:qge.map((t,n)=>l.jsxs($t.button,{type:"button",className:"tpl-card",onClick:()=>e(t),initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:n*.03,duration:.24,ease:[.22,1,.36,1]},children:[l.jsx("span",{className:"tpl-card-icon",children:l.jsx(t.icon,{className:"icon"})}),l.jsx("span",{className:"tpl-card-name",children:t.draft.name}),l.jsx("span",{className:"tpl-card-desc",children:As(t.draft.description)})]},t.id))})]})}function Jge({template:e,onBack:t,onCreate:n}){const[r,s]=w.useState(e.draft.name),i=e.icon,a=Xge(e.draft);function o(){const c=r.trim()||e.draft.name;n({...e.draft,name:c})}return l.jsxs("div",{className:"tpl-scroll tpl-scroll--detail",children:[l.jsxs("button",{className:"tpl-back",onClick:t,children:[l.jsx(yL,{className:"icon"})," 返回模板列表"]}),l.jsxs($t.div,{className:"tpl-detail",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.28,ease:[.22,1,.36,1]},children:[l.jsxs("div",{className:"tpl-detail-head",children:[l.jsx("span",{className:"tpl-detail-icon",children:l.jsx(i,{className:"icon"})}),l.jsxs("div",{className:"tpl-detail-headtext",children:[l.jsx("div",{className:"tpl-detail-name",children:e.draft.name}),l.jsx("div",{className:"tpl-detail-desc",children:As(e.draft.description)})]})]}),a.length>0&&l.jsx("div",{className:"tpl-tags tpl-tags--detail",children:a.map(c=>l.jsxs("span",{className:"tpl-tag",children:[l.jsx(c.icon,{className:"tpl-tag-icon"})," ",c.label]},c.label))}),l.jsxs("label",{className:"tpl-field",children:[l.jsx("span",{className:"tpl-field-label",children:"名称"}),l.jsx("input",{className:"tpl-input",value:r,onChange:c=>s(c.target.value),placeholder:e.draft.name})]}),l.jsxs("div",{className:"tpl-field",children:[l.jsx("span",{className:"tpl-field-label",children:"系统提示词"}),l.jsx("p",{className:"tpl-instruction",children:e.draft.instruction})]}),l.jsxs("div",{className:"tpl-meta-grid",children:[e.draft.model&&l.jsxs("div",{className:"tpl-meta",children:[l.jsx("span",{className:"tpl-meta-key",children:"模型"}),l.jsx("span",{className:"tpl-meta-val tpl-mono",children:e.draft.model})]}),l.jsxs("div",{className:"tpl-meta",children:[l.jsx("span",{className:"tpl-meta-key",children:"工具"}),l.jsx("span",{className:"tpl-meta-val",children:e.draft.tools.length?e.draft.tools.join("、"):"无"})]}),l.jsxs("div",{className:"tpl-meta",children:[l.jsx("span",{className:"tpl-meta-key",children:"记忆"}),l.jsx("span",{className:"tpl-meta-val",children:e0e(e.draft)})]}),l.jsxs("div",{className:"tpl-meta",children:[l.jsx("span",{className:"tpl-meta-key",children:"知识库"}),l.jsx("span",{className:"tpl-meta-val",children:e.draft.knowledgebase?"已开启":"关闭"})]}),l.jsxs("div",{className:"tpl-meta",children:[l.jsx("span",{className:"tpl-meta-key",children:"观测追踪"}),l.jsx("span",{className:"tpl-meta-val",children:e.draft.tracing?"已开启":"关闭"})]})]}),e.draft.subAgents.length>0&&l.jsxs("div",{className:"tpl-field",children:[l.jsxs("span",{className:"tpl-field-label",children:["子 Agent(",e.draft.subAgents.length,")"]}),l.jsx("div",{className:"tpl-subagents",children:e.draft.subAgents.map((c,u)=>l.jsxs("div",{className:"tpl-subagent",children:[l.jsxs("div",{className:"tpl-subagent-top",children:[l.jsx("span",{className:"tpl-subagent-name",children:c.name}),c.tools.length>0&&l.jsx("span",{className:"tpl-subagent-tools",children:c.tools.join("、")})]}),l.jsx("div",{className:"tpl-subagent-desc",children:As(c.description)})]},u))})]}),l.jsxs("button",{className:"tpl-create",onClick:o,children:["使用此模板创建 ",l.jsx(ws,{className:"icon"})]})]})]})}function e0e(e){const t=[];return e.memory.shortTerm&&t.push("短期"),e.memory.longTerm&&t.push("长期"),t.length?t.join(" + "):"关闭"}const t0e=[{type:"sequential",label:"顺序",desc:"节点依次执行",Icon:CL},{type:"parallel",label:"并行",desc:"节点同时执行",Icon:bL},{type:"loop",label:"循环",desc:"节点循环执行",Icon:Rw}];let qE=0;function Eb(){return qE+=1,`node_${qE}`}function xb(e,t,n){const r=Sr();return{id:e,type:"agentNode",position:t,data:{agent:{...r,name:(n==null?void 0:n.name)??`agent_${e.replace("node_","")}`,...n}}}}function n0e({data:e,selected:t}){const n=e.agent;return l.jsxs("div",{className:`wfb-node ${t?"wfb-node--selected":""}`,children:[l.jsx(mr,{type:"target",position:Pe.Left,className:"wfb-handle"}),l.jsx("div",{className:"wfb-node-icon",children:l.jsx(Do,{className:"icon"})}),l.jsxs("div",{className:"wfb-node-body",children:[l.jsx("div",{className:"wfb-node-name",children:n.name||"未命名节点"}),l.jsx("div",{className:"wfb-node-desc",children:n.instruction?n.instruction.slice(0,48):"点击编辑指令…"})]}),l.jsx(mr,{type:"source",position:Pe.Right,className:"wfb-handle"})]})}const r0e={agentNode:n0e},cC={type:"smoothstep",markerEnd:{type:Oc.ArrowClosed,width:16,height:16}};function s0e({onBack:e,onCreate:t}){const n=w.useRef(null),[r,s]=w.useState(""),[i,a]=w.useState(""),[o,c]=w.useState("sequential"),u=w.useMemo(()=>{qE=0;const T=Eb();return xb(T,{x:80,y:120},{name:"agent_1"})},[]),[d,f,h]=e4([u]),[p,m,y]=t4([]),[E,g]=w.useState(u.id),x=d.find(T=>T.id===E)??null,b=r.trim()||"workflow_agent",_=w.useMemo(()=>V6({name:b,subAgents:d.map(T=>T.data.agent)}),[b,d]),k=lc(b)??(_.has(b)?"名称须与 Agent 节点名称保持唯一":null),N=x?lc(x.data.agent.name)??(_.has(x.data.agent.name)?"Agent 名称在当前工作流中必须唯一":null):null,C=d.length>0&&k===null&&d.every(T=>lc(T.data.agent.name)===null&&!_.has(T.data.agent.name)),S=w.useCallback(T=>m(L=>AP({...T,...cC},L)),[m]),A=w.useCallback(()=>{const T=Eb(),L=d.length*28,R=xb(T,{x:80+L,y:120+L});f(F=>F.concat(R)),g(T)},[d.length,f]),O=T=>{T.dataTransfer.setData("application/wfb-node","agentNode"),T.dataTransfer.effectAllowed="move"},D=w.useCallback(T=>{T.preventDefault(),T.dataTransfer.dropEffect="move"},[]),U=w.useCallback(T=>{if(T.preventDefault(),T.dataTransfer.getData("application/wfb-node")!=="agentNode"||!n.current)return;const R=n.current.screenToFlowPosition({x:T.clientX,y:T.clientY}),F=Eb(),I=xb(F,R);f(V=>V.concat(I)),g(F)},[f]),X=w.useCallback(T=>{E&&f(L=>L.map(R=>R.id===E?{...R,data:{...R.data,agent:{...R.data.agent,...T}}}:R))},[E,f]),M=w.useCallback(()=>{E&&(f(T=>T.filter(L=>L.id!==E)),m(T=>T.filter(L=>L.source!==E&&L.target!==E)),g(null))},[E,f,m]),j=w.useCallback(()=>{if(!C)return;const T=d.map(R=>R.data.agent),L={...Sr(),name:b,description:i.trim(),instruction:i.trim(),subAgents:T,workflow:{type:o,nodes:d.map(R=>({id:R.id,agent:R.data.agent})),edges:p.map(R=>({from:R.source,to:R.target}))}};t(L)},[C,d,p,b,i,o,t]);return l.jsx("div",{className:"wfb",children:l.jsxs("div",{className:"wfb-grid",children:[l.jsxs("aside",{className:"wfb-palette",children:[l.jsx("div",{className:"wfb-section-label",children:"工作流信息"}),l.jsxs("label",{className:"wfb-field",children:[l.jsx("span",{className:"wfb-field-label",children:"名称"}),l.jsx("input",{className:`wfb-input ${k?"wfb-input--error":""}`,value:r,onChange:T=>s(T.target.value),placeholder:"my_workflow"}),k&&l.jsx("span",{className:"wfb-field-error",children:k})]}),l.jsxs("label",{className:"wfb-field",children:[l.jsx("span",{className:"wfb-field-label",children:"描述"}),l.jsx("textarea",{className:"wfb-input wfb-textarea",value:i,onChange:T=>a(T.target.value),placeholder:"这个工作流做什么…",rows:2})]}),l.jsx("div",{className:"wfb-section-label",children:"执行方式"}),l.jsx("div",{className:"wfb-types",children:t0e.map(({type:T,label:L,desc:R,Icon:F})=>l.jsxs("button",{type:"button",className:`wfb-type ${o===T?"wfb-type--active":""}`,onClick:()=>c(T),children:[l.jsx(F,{className:"icon"}),l.jsxs("span",{className:"wfb-type-text",children:[l.jsx("span",{className:"wfb-type-name",children:L}),l.jsx("span",{className:"wfb-type-desc",children:R})]})]},T))}),l.jsx("div",{className:"wfb-section-label",children:"节点"}),l.jsxs("div",{className:"wfb-palette-item",draggable:!0,onDragStart:O,title:"拖拽到画布,或点击下方按钮添加",children:[l.jsx(IH,{className:"icon wfb-grip"}),l.jsx("span",{className:"wfb-node-icon wfb-node-icon--sm",children:l.jsx(Do,{className:"icon"})}),l.jsx("span",{className:"wfb-palette-item-text",children:"Agent 节点"})]}),l.jsxs("button",{className:"wfb-add",type:"button",onClick:A,children:[l.jsx(rr,{className:"icon"}),"添加节点"]}),l.jsx("div",{className:"wfb-hint",children:"拖拽节点的圆点连线以表达执行顺序。"})]}),l.jsxs("div",{className:"wfb-canvas",children:[l.jsxs("button",{className:"wfb-create",onClick:j,disabled:!C,type:"button",children:[l.jsx(Po,{className:"icon"}),"创建工作流"]}),l.jsxs(JP,{nodes:d,edges:p,onNodesChange:h,onEdgesChange:y,onConnect:S,onInit:T=>n.current=T,nodeTypes:r0e,defaultEdgeOptions:cC,onDrop:U,onDragOver:D,onNodeClick:(T,L)=>g(L.id),onPaneClick:()=>g(null),fitView:!0,fitViewOptions:{padding:.3,maxZoom:1},proOptions:{hideAttribution:!0},children:[l.jsx(r4,{gap:16,size:1,color:"hsl(240 5.9% 88%)"}),l.jsx(i4,{showInteractive:!1}),l.jsx(Tue,{pannable:!0,zoomable:!0,className:"wfb-minimap"})]})]}),l.jsx("aside",{className:"wfb-inspector",children:x?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"wfb-inspector-head",children:[l.jsx("div",{className:"wfb-section-label",children:"节点配置"}),l.jsx("button",{className:"wfb-icon-btn",type:"button",onClick:M,title:"删除节点",children:l.jsx(ea,{className:"icon"})})]}),l.jsxs("label",{className:"wfb-field",children:[l.jsx("span",{className:"wfb-field-label",children:"名称"}),l.jsx("input",{className:`wfb-input ${N?"wfb-input--error":""}`,value:x.data.agent.name,onChange:T=>X({name:T.target.value}),placeholder:"agent_name"}),N?l.jsx("span",{className:"wfb-field-error",children:N}):l.jsx("span",{className:"wfb-field-help",children:"仅使用英文字母、数字和下划线,且名称保持唯一。"})]}),l.jsxs("label",{className:"wfb-field",children:[l.jsx("span",{className:"wfb-field-label",children:"描述"}),l.jsx("input",{className:"wfb-input",value:x.data.agent.description,onChange:T=>X({description:T.target.value}),placeholder:"这个 agent 做什么…"})]}),l.jsxs("label",{className:"wfb-field",children:[l.jsx("span",{className:"wfb-field-label",children:"指令 (instruction)"}),l.jsx("textarea",{className:"wfb-input wfb-textarea",value:x.data.agent.instruction,onChange:T=>X({instruction:T.target.value}),placeholder:"你是一个…",rows:6})]}),l.jsxs("label",{className:"wfb-field",children:[l.jsx("span",{className:"wfb-field-label",children:"工具 (逗号分隔)"}),l.jsx("input",{className:"wfb-input",value:x.data.agent.tools.join(", "),onChange:T=>X({tools:T.target.value.split(",").map(L=>L.trim()).filter(Boolean)}),placeholder:"web_search, calculator"})]}),l.jsxs("div",{className:"wfb-inspector-meta",children:[l.jsx("span",{className:"wfb-meta-key",children:"节点 ID"}),l.jsx("code",{className:"wfb-meta-val",children:x.id})]})]}):l.jsxs("div",{className:"wfb-inspector-empty",children:[l.jsx(Do,{className:"wfb-empty-icon"}),l.jsx("p",{children:"选择一个节点以编辑其配置"}),l.jsxs("p",{className:"wfb-empty-sub",children:["共 ",d.length," 个节点 · ",p.length," 条连线"]})]})})]})})}function i0e(e){return l.jsx(Dv,{children:l.jsx(s0e,{...e})})}const uC=50*1024*1024,XE=800,a0e={name:"code_package",files:[]};function o0e(e){let n=e.replace(/\.zip$/i,"").trim().replace(/[^A-Za-z0-9_]+/g,"_").replace(/^_+|_+$/g,"");return n||(n="uploaded_agent"),/^[A-Za-z_]/.test(n)||(n=`agent_${n}`),n==="user"&&(n="uploaded_agent"),n.slice(0,64)}function l0e(e){const t=e.replace(/\\/g,"/").replace(/^\.\//,"");if(!t||t.endsWith("/"))return null;if(t.startsWith("/")||t.includes("\0"))throw new Error(`压缩包包含非法路径:${e}`);const n=t.split("/");if(n.some(r=>!r||r==="."||r===".."))throw new Error(`压缩包包含非法路径:${e}`);return n[0]==="__MACOSX"||n[n.length-1]===".DS_Store"?null:n.join("/")}function c0e(e){const t=e.flatMap(a=>{const o=l0e(a.name);return o?[{path:o,content:a.text}]:[]});if(t.length===0)throw new Error("压缩包中没有可部署的文件。");if(t.length>XE)throw new Error(`代码包文件数不能超过 ${XE} 个。`);const s=new Set(t.map(a=>a.path.split("/")[0])).size===1&&t.every(a=>a.path.includes("/"))?t.map(a=>({...a,path:a.path.split("/").slice(1).join("/")})):t,i=new Set;for(const a of s){if(i.has(a.path))throw new Error(`代码包包含重复文件:${a.path}`);i.add(a.path)}if(!i.has("app.py"))throw new Error("代码包根目录必须包含 app.py,作为 AgentKit 启动入口。");return s}function u0e({onBack:e,onAgentAdded:t,onDeploymentTaskChange:n}){const r=w.useRef(null),s=w.useRef(0),[i,a]=w.useState(null),[o,c]=w.useState(""),[u,d]=w.useState(!1),[f,h]=w.useState(!1),[p,m]=w.useState(!1),[y,E]=w.useState(""),[g,x]=w.useState("cn-beijing"),[b,_]=w.useState();w.useEffect(()=>()=>{s.current+=1},[]);async function k(A){const O=++s.current;if(E(""),!A.name.toLowerCase().endsWith(".zip")){E("请选择 .zip 格式的代码包。");return}if(A.size>uC){E("代码包不能超过 50 MB。");return}h(!0);try{const D=await Y6(new Uint8Array(await A.arrayBuffer()),{maxEntries:XE,maxUncompressedBytes:uC}),U=c0e(D);if(O!==s.current)return;c(A.name),a({name:o0e(A.name),files:U})}catch(D){if(O!==s.current)return;c(""),a(null),E(D instanceof Error?D.message:String(D))}finally{O===s.current&&h(!1)}}function N(A){var D;const O=(D=A.currentTarget.files)==null?void 0:D[0];A.currentTarget.value="",O&&k(O)}function C(A){var D;A.preventDefault(),m(!1);const O=(D=A.dataTransfer.files)==null?void 0:D[0];O&&k(O)}async function S(A,O,D){const U=b&&b.mode!=="public"?{mode:b.mode,vpc_id:b.vpcId,subnet_ids:b.subnetIds,enable_shared_internet_access:b.enableSharedInternetAccess}:void 0;return Rg(A.name,A.files,{region:g,projectName:"default",network:U},{...D,onStage:O})}return l.jsxs("div",{className:"package-create package-create-preview",children:[l.jsx(y0,{project:i??a0e,agentName:(i==null?void 0:i.name)||"代码包",onChange:i?a:void 0,onDeploy:S,onAgentAdded:t,onDeploymentTaskChange:n,network:b,onNetworkChange:_,deployRegion:g,onDeployRegionChange:x,onBack:e,backLabel:"返回创建方式",deployDisabled:!i||f,deployDisabledReason:f?"正在读取代码包":i?void 0:"请先上传代码包",deploymentPrimaryPane:l.jsxs("section",{className:"package-source-pane","aria-label":"代码包上传",children:[l.jsx("div",{className:"package-source-label",children:"代码包"}),l.jsxs("div",{className:`package-dropzone${p?" is-dragging":""}${i?" is-ready":""}`,onDragEnter:A=>{A.preventDefault(),m(!0)},onDragOver:A=>A.preventDefault(),onDragLeave:A=>{A.currentTarget.contains(A.relatedTarget)||m(!1)},onDrop:C,onClick:()=>{var A;f||(A=r.current)==null||A.click()},onKeyDown:A=>{var O;!f&&(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),(O=r.current)==null||O.click())},role:"button",tabIndex:f?-1:0,"aria-label":i?"重新上传代码包":"上传代码包","aria-disabled":f,children:[l.jsx("strong",{children:f?"正在读取代码包…":i?o:"请上传代码包"}),l.jsx("span",{children:i?`已识别 ${i.files.length} 个文件,点击区域可重新上传`:"点击或拖拽上传,支持 .zip 格式,最大 50 MB,根目录需包含 app.py"}),l.jsx("div",{className:"package-upload-actions",children:i&&l.jsx("button",{type:"button",className:"package-upload-secondary",onClick:A=>{A.stopPropagation(),d(!0)},onKeyDown:A=>A.stopPropagation(),children:"查看文件"})}),l.jsx("input",{ref:r,type:"file",accept:".zip,application/zip","aria-label":"选择代码包",onChange:N})]}),y&&l.jsx("div",{className:"package-create-error",role:"alert",children:y})]})}),i&&l.jsx(z6,{project:i,open:u,onClose:()=>d(!1),onChange:a})]})}const d0e=3*60*1e3,f0e=3e3,h0e=10*60*1e3,rg="veadk.studio.pending-update",dC=[{id:"resolving",label:"读取目标版本信息"},{id:"downloading",label:"下载并校验完整更新包"},{id:"preparing",label:"准备 VeFaaS Function 代码"},{id:"submitting",label:"提交 Function 更新"},{id:"publishing",label:"发布新 Revision 并重启服务"}],p0e={resolving:"读取版本信息",downloading:"下载更新包",preparing:"准备 Function 代码",submitting:"提交 Function 更新",publishing:"发布 Revision",checking:"检查更新",unknown:"未知阶段"};function m0e(e){return e<60?`${e} 秒`:`${Math.floor(e/60)} 分 ${e%60} 秒`}function g0e(e,t){return e===t?!0:/^\d{14}$/.test(e)&&/^\d{14}$/.test(t)&&e>t}function y0e(){if(typeof window>"u")return null;const e=window.localStorage.getItem(rg);if(!e)return null;try{const t=JSON.parse(e);if(typeof t.targetVersion=="string"&&typeof t.startedAt=="number")return{targetVersion:t.targetVersion,startedAt:t.startedAt}}catch{}return window.localStorage.removeItem(rg),null}function wb(e,t){window.localStorage.setItem(rg,JSON.stringify({targetVersion:e,startedAt:t}))}function ip(){window.localStorage.removeItem(rg)}function fC({className:e}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M19.2 8.3A8 8 0 1 0 20 13"}),l.jsx("path",{d:"M19.2 4.8v3.5h-3.5"}),l.jsx("path",{d:"M12 7.8v7.7"}),l.jsx("path",{d:"m9.2 12.7 2.8 2.8 2.8-2.8"})]})}function b0e(){return l.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:l.jsx("path",{d:"m4 6 4 4 4-4"})})}function E0e(){return l.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:l.jsx("path",{d:"m3.5 8.2 2.8 2.8 6.2-6"})})}function hC({lines:e,phase:t,copyState:n,onCopy:r}){const s=w.useRef(null),i=w.useRef(!0);return w.useEffect(()=>{const a=s.current;a&&i.current&&(a.scrollTop=a.scrollHeight)},[e]),l.jsxs("section",{className:"studio-update-live-log","aria-label":"VeFaaS 更新日志",children:[l.jsxs("div",{className:"studio-update-log-header",children:[l.jsxs("span",{children:[l.jsx("i",{className:`is-${t}`,"aria-hidden":!0}),"VeFaaS 更新日志",l.jsx("small",{children:t==="active"?"实时":t==="complete"?"已完成":"已停止"})]}),l.jsx("button",{type:"button",onClick:r,disabled:!e.length,children:n==="copied"?"已复制":n==="error"?"复制失败":"复制日志"})]}),l.jsx("div",{ref:s,className:"studio-update-log-lines",role:"log","aria-live":"off",tabIndex:0,onScroll:a=>{const o=a.currentTarget;i.current=o.scrollHeight-o.scrollTop-o.clientHeight<24},children:e.length?e.map((a,o)=>l.jsx("div",{children:a},`${o}-${a}`)):l.jsx("p",{children:t==="active"?"等待 VeFaaS 返回更新日志…":"本次更新未返回发布日志"})})]})}function x0e(){var X,M;const[e]=w.useState(y0e),[t,n]=w.useState(null),[r,s]=w.useState(e?"submitting":"idle"),[i,a]=w.useState(!1),[o,c]=w.useState(""),[u,d]=w.useState((e==null?void 0:e.targetVersion)??""),[f,h]=w.useState(!1),[p,m]=w.useState("idle"),[y,E]=w.useState(0),g=w.useRef(null),x=w.useRef((e==null?void 0:e.targetVersion)??""),b=w.useRef((e==null?void 0:e.startedAt)??0);w.useEffect(()=>{if(!f)return;const j=L=>{var R;L.target instanceof Node&&!((R=g.current)!=null&&R.contains(L.target))&&h(!1)},T=L=>{L.key==="Escape"&&h(!1)};return window.addEventListener("pointerdown",j),window.addEventListener("keydown",T),()=>{window.removeEventListener("pointerdown",j),window.removeEventListener("keydown",T)}},[f]);const _=w.useCallback(async()=>{const j=await oM(x.current||void 0,b.current||void 0);return n(j),j},[]);if(w.useEffect(()=>{let j=!0;const T=()=>{_().catch(()=>{j&&n(R=>R)})};T();const L=window.setInterval(T,d0e);return()=>{j=!1,window.clearInterval(L)}},[_]),w.useEffect(()=>{if(r!=="submitting")return;const j=window.setInterval(()=>{_().then(T=>{const L=x.current;if(L&&g0e(T.currentVersion,L)||!L&&!T.available&&T.latestVersion){window.clearInterval(j),ip(),s("published"),c("Studio 已更新,刷新页面即可使用新版本");return}if(T.state==="error"){window.clearInterval(j),ip(),s("error"),c(T.message||"Studio 更新失败");return}Date.now()-b.current>h0e&&(window.clearInterval(j),ip(),s("error"),c("等待 VeFaaS 发布超时,请稍后重新检查版本"))}).catch(()=>{})},f0e);return()=>window.clearInterval(j)},[r,_]),w.useEffect(()=>{r!=="idle"||(t==null?void 0:t.state)!=="updating"||(x.current=t.targetVersion,b.current=t.startedAt||Date.now(),wb(t.targetVersion,b.current),d(t.targetVersion),s("submitting"))},[r,t]),w.useEffect(()=>{if(r!=="submitting"){E(0);return}const j=()=>{const L=b.current||Date.now();E(Math.max(0,Math.floor((Date.now()-L)/1e3)))};j();const T=window.setInterval(j,1e3);return()=>window.clearInterval(T)},[r]),!(t!=null&&t.enabled)||!(t.available||t.state==="updating"||r!=="idle"))return null;const N=t.releases??[],C=u||((X=N[0])==null?void 0:X.version)||t.latestVersion,S=N.find(j=>j.version===C),A=async()=>{x.current=C,b.current=Date.now(),wb(C,b.current),s("submitting"),c(""),m("idle");try{const j=await lM(C);x.current=j.version,wb(j.version,b.current),c("更新已提交,正在等待 VeFaaS 发布新版本")}catch(j){if(j instanceof TypeError){c("连接已切换,正在确认新版本状态");return}ip(),s("error");const T=j instanceof Error?j.message:"Studio 更新失败";try{const L=await _();c(L.message||T)}catch{c(T)}}},O=(M=t.updateLogs)!=null&&M.length?t.updateLogs:(t.errorLog||t.progressMessage||o).split(` `).filter(Boolean),D=async()=>{try{await navigator.clipboard.writeText(O.join(` -`)),m("copied")}catch{m("error")}},U=()=>{var j;h(!1),m("idle"),c(""),d(x.current||((j=N[0])==null?void 0:j.version)||""),s("confirm")};return l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",className:`studio-update-trigger is-${r}`,title:r==="submitting"?"正在更新 Studio":r==="published"?"Studio 已更新":`更新 Studio 至 ${t.latestVersion}`,onClick:()=>{var j;r==="published"?window.location.reload():(r==="submitting"||r==="error"||(d(((j=N[0])==null?void 0:j.version)||t.latestVersion),s("confirm")),a(!0))},children:[l.jsx(hC,{className:"studio-update-icon"}),r==="submitting"?l.jsx(ta,{as:"span",children:"正在更新"}):r==="published"?l.jsx("span",{children:"刷新使用新版"}):r==="error"?l.jsx("span",{children:"更新失败"}):l.jsx("span",{children:"有新版更新"})]}),i&&r!=="idle"&&l.jsx("div",{className:"confirm-scrim",role:"presentation",children:l.jsxs("section",{className:"confirm-box studio-update-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"studio-update-title",children:[l.jsx("div",{className:"studio-update-dialog-mark",children:l.jsx(hC,{})}),l.jsx("div",{id:"studio-update-title",className:"confirm-title",children:r==="error"?"Studio 更新失败":r==="submitting"?"正在更新 Studio":r==="published"?"Studio 更新完成":"发现新版本"}),r==="error"?l.jsxs("div",{className:"studio-update-error-panel",children:[l.jsx("p",{className:"confirm-text studio-update-error",children:o}),l.jsxs("dl",{className:"studio-update-error-meta",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"失败阶段"}),l.jsx("dd",{children:m0e[t.errorStage]||t.errorStage||"未知阶段"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"错误 ID"}),l.jsx("dd",{children:t.errorId||"未生成"})]})]}),l.jsx(pC,{lines:O,phase:"error",copyState:p,onCopy:()=>void D()}),t.consoleUrl&&l.jsxs("a",{className:"studio-update-console-link",href:t.consoleUrl,target:"_blank",rel:"noreferrer",children:["前往 VeFaaS 控制台查看 Function 日志",l.jsx("span",{"aria-hidden":!0,children:"↗"})]})]}):r==="submitting"||r==="published"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"studio-update-progress-summary",children:[l.jsxs("div",{children:[l.jsx("span",{children:"目标版本"}),l.jsx("strong",{children:x.current||C})]}),l.jsxs("div",{children:[l.jsx("span",{children:r==="published"?"更新状态":"已用时"}),l.jsx("strong",{children:r==="published"?"已完成":g0e(y)})]})]}),l.jsx("ol",{className:"studio-update-progress","aria-label":"Studio 更新进度",children:fC.map((j,T)=>{const L=fC.findIndex(I=>I.id===t.progressStage),R=r==="published"||Tvoid D()}),l.jsx("p",{className:"studio-update-progress-note",children:"发布阶段会短暂中断连接;关闭此窗口不会停止更新,可随时点击右上角按钮重新查看。"})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"confirm-text",children:"更新会重启 Studio 服务,预计约 3–5 分钟完成更新与发布。期间正在进行的对话、 流式响应或部署任务可能中断,登录态不会受到影响。"}),l.jsxs("div",{className:"studio-update-field",ref:g,children:[l.jsx("span",{children:"选择版本"}),l.jsxs("button",{type:"button",className:"studio-update-version-trigger","aria-label":"选择版本","aria-haspopup":"listbox","aria-expanded":f,onClick:()=>h(j=>!j),onKeyDown:j=>{(j.key==="ArrowDown"||j.key==="ArrowUp")&&(j.preventDefault(),h(!0))},children:[l.jsx("span",{children:C}),l.jsx(E0e,{})]}),f&&l.jsx("div",{className:"studio-update-version-menu",role:"listbox","aria-label":"选择版本",children:N.map(j=>{const T=j.version===C;return l.jsxs("button",{type:"button",role:"option","aria-selected":T,className:`studio-update-version-option${T?" is-selected":""}`,onClick:()=>{d(j.version),h(!1)},children:[l.jsx("span",{children:j.version}),T&&l.jsx(x0e,{})]},j.version)})})]}),l.jsxs("dl",{className:"studio-update-versions",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"当前版本"}),l.jsx("dd",{children:t.currentVersion})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"目标版本"}),l.jsx("dd",{children:C})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"Commit"}),l.jsx("dd",{children:((S==null?void 0:S.gitSha)||t.latestGitSha).slice(0,8)})]})]}),l.jsxs("section",{className:"studio-update-changelog","aria-labelledby":"studio-update-changelog-title",children:[l.jsx("div",{id:"studio-update-changelog-title",children:"更新内容"}),S!=null&&S.changelog.length?l.jsx("ul",{children:S.changelog.map(j=>l.jsx("li",{children:j},j))}):l.jsx("p",{children:"暂无更新说明"})]})]}),l.jsxs("div",{className:"confirm-actions",children:[l.jsx("button",{type:"button",className:"confirm-btn",onClick:()=>{a(!1),h(!1),r==="confirm"&&(s("idle"),c(""))},children:r==="submitting"?"后台运行":r==="confirm"?"取消":"关闭"}),r==="confirm"&&l.jsx("button",{type:"button",className:"confirm-btn studio-update-confirm",onClick:()=>void A(),children:"立即更新"}),r==="error"&&l.jsx("button",{type:"button",className:"confirm-btn studio-update-confirm",onClick:U,children:"重新尝试"})]})]})})]})}const v0e="/web/skill-creator";class u_ extends Error{constructor(n,r){super(n);j_(this,"status");this.name="SkillCreatorApiError",this.status=r}}function nl(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} 格式错误`);return e}function Zt(e,...t){for(const n of t){const r=e[n];if(typeof r=="string"&&r)return r}}function l5(e,...t){for(const n of t){const r=e[n];if(typeof r=="number"&&Number.isFinite(r))return r}}async function Xf(e,t){return fetch(xi(`${v0e}${e}`),{...t,headers:Og({Accept:"application/json",...t!=null&&t.body?{"Content-Type":"application/json"}:{},...t==null?void 0:t.headers})})}async function d_(e,t){if((e.headers.get("content-type")??"").includes("application/json")){const s=nl(await e.json(),"错误响应");return Zt(s,"detail","message","error")??t}return(await e.text()).trim()||t}async function f_(e,t){if(!e.ok)throw new u_(await d_(e,t),e.status);if(!(e.headers.get("content-type")??"").includes("application/json"))throw new Error(`${t}:服务端返回了非 JSON 响应`);return e.json()}function _0e(e){if(e==="queued")return"queued";if(e==="running")return"running";if(e==="succeeded")return"succeeded";if(e==="failed")return"failed";throw new Error(`未知的 Skill 生成状态:${String(e)}`)}function k0e(e){if(e==="provisioning"||e==="generating"||e==="validating"||e==="packaging"||e==="completed"||e==="failed")return e;throw new Error(`未知的 Skill 生成阶段:${String(e)}`)}function N0e(e){return Array.isArray(e)?e.map((t,n)=>{const r=nl(t,`文件 ${n+1}`),s=Zt(r,"path");if(!s)throw new Error(`文件 ${n+1} 缺少 path`);const i=l5(r,"size");if(i===void 0)throw new Error(`文件 ${n+1} 缺少 size`);return{path:s,size:i}}):[]}function S0e(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,n=Array.isArray(t.errors)?t.errors.map(String):[],r=Array.isArray(t.warnings)?t.warnings.map(String):[];return{valid:typeof t.valid=="boolean"?t.valid:n.length===0,errors:n,warnings:r}}function T0e(e){if(e===void 0)return[];if(!Array.isArray(e))throw new Error("Skill 生成活动记录格式错误");return e.map((t,n)=>{const r=nl(t,`活动 ${n+1}`),s=Zt(r,"id"),i=Zt(r,"kind"),a=Zt(r,"status");if(!s||!i||!["status","thinking","tool","message"].includes(i))throw new Error(`活动 ${n+1} 格式错误`);if(a!=="running"&&a!=="done")throw new Error(`活动 ${n+1} 状态错误`);if(i==="tool"){const c=Zt(r,"name");if(!c)throw new Error(`活动 ${n+1} 缺少工具名称`);return{id:s,kind:i,name:c,args:r.input,response:r.output,status:a}}const o=Zt(r,"text");if(!o)throw new Error(`活动 ${n+1} 缺少文本`);return{id:s,kind:i,text:o,status:a}})}function A0e(e,t){const n=nl(e,`候选方案 ${t+1}`),r=Zt(n,"id","candidate_id","candidateId"),s=Zt(n,"model","model_id","modelId");if(!r||!s)throw new Error(`候选方案 ${t+1} 缺少 id 或 model`);return{id:r,model:s,modelLabel:Zt(n,"modelLabel","model_label")??s,status:_0e(n.status),stage:k0e(n.stage),name:Zt(n,"name","skill_name","skillName"),description:Zt(n,"description"),skillMd:Zt(n,"skillMd","skill_md"),files:N0e(n.files),activities:T0e(n.activities),validation:S0e(n.validation),durationMs:l5(n,"elapsedMs","elapsed_ms"),error:Zt(n,"error","error_message","errorMessage"),published:n.published===!0,skillId:Zt(n,"skill_id","skillId"),version:Zt(n,"version")}}function ZE(e,t=""){const n=nl(e,"Skill 创建任务"),r=Zt(n,"id","job_id","jobId");if(!r)throw new Error("Skill 创建任务缺少 id");const s=Array.isArray(n.candidates)?n.candidates.map(A0e):[],i=Zt(n,"status")??"running";if(i!=="provisioning"&&i!=="running"&&i!=="completed")throw new Error(`未知的 Skill 任务状态:${i}`);return{id:r,prompt:Zt(n,"prompt")??t,status:i,candidates:s}}async function C0e(e,t){const n=await Xf("/jobs",{method:"POST",body:JSON.stringify({prompt:e})});if(!n.ok)throw new u_(await d_(n,"创建 Skill 任务失败"),n.status);const r=n.headers.get("content-type")??"";if(r.includes("application/json")){const u=ZE(await n.json(),e);return t==null||t(u),u}if(!r.includes("application/x-ndjson")||!n.body)throw new Error("创建 Skill 任务失败:服务端返回了非流式响应");const s=n.body.getReader(),i=new TextDecoder;let a="",o;const c=u=>{if(!u.trim())return;const d=nl(JSON.parse(u),"Skill 创建进度");if(d.type==="error")throw new Error(Zt(d,"error")??"创建 Skill 任务失败");if(d.type!=="progress"&&d.type!=="complete")throw new Error("未知的 Skill 创建进度事件");o=ZE(d.job,e),t==null||t(o)};for(;;){const{done:u,value:d}=await s.read();a+=i.decode(d,{stream:!u});const f=a.split(` -`);if(a=f.pop()??"",f.forEach(c),u)break}if(c(a),!o)throw new Error("创建 Skill 任务失败:服务端未返回任务");return o}async function I0e(e){const t=await Xf(`/jobs/${encodeURIComponent(e)}`);return ZE(await f_(t,"读取 Skill 任务失败"))}async function O0e(e){const t=await Xf(`/jobs/${encodeURIComponent(e)}`,{method:"DELETE"});await f_(t,"清理 Skill 任务失败")}async function R0e(e,t){var o;const n=await Xf(`/jobs/${encodeURIComponent(e)}/candidates/${encodeURIComponent(t)}/download`);if(!n.ok)throw new Error(await d_(n,"下载 Skill 失败"));const s=((o=(n.headers.get("content-disposition")??"").match(/filename="([^"]+)"/))==null?void 0:o[1])??"skill.zip",i=URL.createObjectURL(await n.blob()),a=document.createElement("a");a.href=i,a.download=s,a.click(),URL.revokeObjectURL(i)}async function L0e(e,t,n){const r=await Xf(`/jobs/${encodeURIComponent(e)}/candidates/${encodeURIComponent(t)}/publish`,{method:"POST",body:JSON.stringify(n)}),s=nl(await f_(r,"添加到 AgentKit 失败"),"发布结果"),i=Zt(s,"skill_id","skillId","id");if(!i)throw new Error("发布结果缺少 skill_id");return{skillId:i,name:Zt(s,"name"),version:Zt(s,"version"),skillSpaceIds:Array.isArray(s.skillSpaceIds)?s.skillSpaceIds.map(String):Array.isArray(s.skill_space_ids)?s.skill_space_ids.map(String):[],message:Zt(s,"message")}}const M0e=()=>{};function j0e(e){if(e.kind==="message")return{kind:"text",text:e.text};if(e.kind==="thinking")return{kind:"thinking",text:e.text,done:e.status==="done"};if(e.kind==="tool")return{kind:"tool",name:e.name,args:e.args,response:e.response,done:e.status==="done"};throw new Error("不支持的 Skill 对话活动")}function D0e({activities:e}){const t=w.useMemo(()=>e.filter(n=>n.kind!=="status").map(j0e),[e]);return t.length===0?null:l.jsx("div",{className:"skill-conversation","aria-label":"Skill 生成对话","aria-live":"polite",children:l.jsx(Wv,{blocks:t,onAction:M0e})})}const mC={provisioning:"正在准备 Sandbox",generating:"正在生成 Skill",validating:"正在校验结构",packaging:"正在打包",completed:"生成完成",failed:"生成失败"},gC=12e4;function P0e({status:e}){return e==="succeeded"?l.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[l.jsx("circle",{cx:"10",cy:"10",r:"7"}),l.jsx("path",{d:"m6.7 10.1 2.1 2.2 4.6-4.8"})]}):e==="failed"?l.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[l.jsx("circle",{cx:"10",cy:"10",r:"7"}),l.jsx("path",{d:"M10 6.2v4.5M10 13.6h.01"})]}):l.jsxs("svg",{className:"skill-candidate__spinner",viewBox:"0 0 20 20","aria-hidden":"true",children:[l.jsx("circle",{cx:"10",cy:"10",r:"7"}),l.jsx("path",{d:"M10 3a7 7 0 0 1 7 7"})]})}function B0e(){return l.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[l.jsx("path",{d:"M4.2 3.5h7.1l4.5 4.6v8.4H4.2z"}),l.jsx("path",{d:"M11.3 3.5v4.6h4.5M7 11h6M7 13.8h4.2"})]})}function F0e(){return l.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:l.jsx("path",{d:"m9 5-5 5 5 5M4.5 10H16"})})}function U0e({candidate:e}){var c,u;const[t,n]=w.useState("SKILL.md"),r=e.files.find(d=>d.path.endsWith("SKILL.md")),s=e.skillMd&&!r?[{path:"SKILL.md",size:new Blob([e.skillMd]).size},...e.files]:e.files,i=s.find(d=>d.path===t)??s[0],a=(c=e.skillMd)==null?void 0:c.slice(0,gC),o=(((u=e.skillMd)==null?void 0:u.length)??0)>gC;return s.length===0?null:l.jsxs("div",{className:"skill-files",children:[l.jsx("div",{className:"skill-files__tabs",role:"tablist","aria-label":`${e.name??"Skill"} 文件`,children:s.map(d=>l.jsx("button",{type:"button",role:"tab","aria-selected":(i==null?void 0:i.path)===d.path,className:(i==null?void 0:i.path)===d.path?"is-active":"",onClick:()=>n(d.path),children:d.path},d.path))}),e.skillMd&&(i!=null&&i.path.endsWith("SKILL.md"))?l.jsxs(l.Fragment,{children:[l.jsx("pre",{className:"skill-files__content",children:l.jsx("code",{children:a})}),o?l.jsx("p",{className:"skill-files__truncated",children:"预览内容较长,完整文件请下载 ZIP 查看。"}):null]}):l.jsx("div",{className:"skill-files__unavailable",children:i?`${i.path} · ${i.size.toLocaleString()} bytes`:"文件内容将在下载包中提供"})]})}function $0e({label:e,jobId:t,candidate:n,selected:r,publishing:s,publishDisabled:i,publishError:a,onSelect:o,onPublish:c}){const[u,d]=w.useState("conversation"),[f,h]=w.useState(!1),[p,m]=w.useState(!1),[y,E]=w.useState(""),[g,x]=w.useState(""),[b,_]=w.useState(""),[k,N]=w.useState(""),C=w.useRef(null),S=w.useRef(null),A=n.status==="queued"||n.status==="running",O=n.status==="succeeded",D=n.validation;return l.jsxs("article",{className:`skill-candidate skill-candidate--${n.status}${r?" is-selected":""}`,"aria-label":`${e} ${n.model}`,children:[l.jsxs("header",{className:"skill-candidate__header",children:[l.jsx("h2",{children:n.model}),r?l.jsx("span",{className:"skill-candidate__selected",children:"已选方案"}):null]}),u==="conversation"?l.jsxs("div",{className:"skill-candidate__view skill-candidate__view--conversation",children:[l.jsxs("div",{className:"skill-candidate__status","aria-live":"polite",children:[l.jsx("span",{className:"skill-candidate__status-icon",children:l.jsx(P0e,{status:n.status})}),A?l.jsx(ta,{duration:2.2,spread:16,children:mC[n.stage]}):l.jsx("span",{children:mC[n.stage]}),n.durationMs!==void 0&&O?l.jsxs("span",{className:"skill-candidate__duration",children:[(n.durationMs/1e3).toFixed(1)," 秒"]}):null]}),l.jsx(D0e,{activities:n.activities}),n.error?l.jsx("div",{className:"skill-candidate__error",children:n.error}):null,O?l.jsx("div",{className:"skill-candidate__view-actions",children:l.jsxs("button",{ref:C,type:"button",className:"skill-action skill-action--preview",onClick:()=>{d("preview"),requestAnimationFrame(()=>{var U;return(U=S.current)==null?void 0:U.focus()})},children:[l.jsx(B0e,{}),"查看 Skill"]})}):null]}):l.jsxs("div",{className:"skill-candidate__view skill-candidate__view--preview",children:[l.jsx("div",{className:"skill-candidate__preview-nav",children:l.jsxs("button",{ref:S,type:"button",className:"skill-candidate__back",onClick:()=>{d("conversation"),requestAnimationFrame(()=>{var U;return(U=C.current)==null?void 0:U.focus()})},children:[l.jsx(F0e,{}),"返回对话"]})}),l.jsxs("div",{className:"skill-candidate__result",children:[l.jsxs("div",{className:"skill-candidate__summary",children:[l.jsxs("div",{children:[l.jsx("span",{children:"Skill"}),l.jsx("strong",{children:n.name??"未命名 Skill"})]}),l.jsxs("div",{children:[l.jsx("span",{children:"文件"}),l.jsx("strong",{children:n.files.length})]}),l.jsxs("div",{children:[l.jsx("span",{children:"校验"}),l.jsx("strong",{className:(D==null?void 0:D.valid)===!1?"is-invalid":"is-valid",children:(D==null?void 0:D.valid)===!1?"未通过":"已通过"})]})]}),n.description?l.jsx("p",{className:"skill-candidate__description",children:n.description}):null,D&&(D.errors.length>0||D.warnings.length>0)?l.jsxs("details",{className:"skill-validation",children:[l.jsx("summary",{children:"查看校验详情"}),[...D.errors,...D.warnings].map((U,X)=>l.jsx("div",{children:U},`${U}-${X}`))]}):null,l.jsx(U0e,{candidate:n}),l.jsxs("div",{className:"skill-candidate__actions",children:[l.jsx("button",{type:"button",className:"skill-action skill-action--select","aria-pressed":r,onClick:o,children:r?"已采用此方案":"采用此方案"}),l.jsx("button",{type:"button",className:"skill-action",disabled:p,onClick:()=>{m(!0),E(""),R0e(t,n.id).catch(U=>{E(U instanceof Error?U.message:String(U))}).finally(()=>m(!1))},children:p?"正在下载…":"下载 ZIP"}),l.jsx("button",{type:"button",className:"skill-action",disabled:!r||s||i||n.published,title:r?void 0:"请先采用此方案",onClick:()=>h(U=>!U),children:n.published?"已添加到 AgentKit":s?"正在添加…":"添加到 AgentKit"})]}),y?l.jsx("div",{className:"skill-candidate__error",children:y}):null,f&&r&&!n.published?l.jsxs("form",{className:"skill-publish-form",onSubmit:U=>{U.preventDefault();const X=g.split(",").map(M=>M.trim()).filter(Boolean);c({skillSpaceIds:X,...b.trim()?{projectName:b.trim()}:{},...k.trim()?{skillId:k.trim()}:{}})},children:[l.jsxs("label",{children:[l.jsx("span",{children:"SkillSpace ID(可选)"}),l.jsx("input",{value:g,onChange:U=>x(U.target.value),placeholder:"多个 ID 用英文逗号分隔"})]}),l.jsxs("div",{className:"skill-publish-form__optional",children:[l.jsxs("label",{children:[l.jsx("span",{children:"项目名称(可选)"}),l.jsx("input",{value:b,onChange:U=>_(U.target.value)})]}),l.jsxs("label",{children:[l.jsx("span",{children:"已有 Skill ID(可选)"}),l.jsx("input",{value:k,onChange:U=>N(U.target.value)})]})]}),l.jsx("button",{type:"submit",className:"skill-action skill-action--select",disabled:s,children:s?"正在添加…":"确认添加"})]}):null,a?l.jsx("div",{className:"skill-candidate__error",children:a}):null]})]})]})}const yC=new Set(["completed"]),op=1100,H0e=3e4;function z0e(e,t){return{id:`pending-${t}`,model:e,modelLabel:e,status:"queued",stage:"provisioning",files:[],activities:[{id:"provisioning",kind:"status",text:"正在拉起 Sandbox",status:"running"}]}}function V0e({initialJob:e}){const[t,n]=w.useState(e),[r,s]=w.useState(""),[i,a]=w.useState(!1),[o,c]=w.useState(),[u,d]=w.useState(),[f,h]=w.useState(()=>new Set),[p,m]=w.useState({});w.useEffect(()=>{n(e),s(""),a(!1)},[e]),w.useEffect(()=>{if(yC.has(e.status)||e.id.startsWith("pending-"))return;let g=!1,x;const b=Date.now()+H0e,_=async()=>{try{const k=await I0e(e.id);g||(n({...k,prompt:k.prompt||e.prompt}),s(""),yC.has(k.status)||(x=window.setTimeout(_,op)))}catch(k){if(!g){const N=k instanceof u_?k:void 0;if((N==null?void 0:N.status)===404&&Date.now(){g=!0,x!==void 0&&window.clearTimeout(x)}},[e.id,e.status]);const y=Gv.map((g,x)=>t.candidates.find(b=>b.model===g)??t.candidates[x]??z0e(g,x));async function E(g,x){d(g.id),m(b=>({...b,[g.id]:""}));try{await L0e(t.id,g.id,x),h(b=>new Set(b).add(g.id))}catch(b){m(_=>({..._,[g.id]:b instanceof Error?b.message:String(b)}))}finally{d(void 0)}}return l.jsxs("section",{className:"skill-workspace",children:[l.jsx("header",{className:"skill-workspace__intro",children:l.jsx("h1",{children:"正在把需求变成可运行的 Skill"})}),r?l.jsxs("div",{className:"skill-workspace__poll-error",role:"alert",children:["状态刷新失败:",r,"。",i?"":"页面会继续重试。"]}):null,l.jsx("div",{className:"skill-workspace__grid",children:y.map((g,x)=>{const _=f.has(g.id)||g.published?{...g,published:!0}:g;return l.jsx($0e,{label:`方案 ${x===0?"A":"B"}`,jobId:t.id,candidate:_,selected:o===g.id,publishing:u===g.id,publishDisabled:u!==void 0&&u!==g.id,publishError:p[g.id],onSelect:()=>c(g.id),onPublish:k=>void E(g,k)},`${g.model}-${g.id}`)})})]})}const _b="/web/sandbox/sessions",K0e=33e4,Y0e=6e5,W0e=15e3;function kb(e){const t=Og(e);return t.set("Accept","application/json"),t}async function Nb(e,t){let n={};try{n=await e.json()}catch{return new Error(`${t}(HTTP ${e.status})`)}const r=n.detail,s=r&&typeof r=="object"&&"message"in r?r.message:r??n.message;return new Error(typeof s=="string"&&s?s:t)}async function G0e(e,t){if(!e.body)throw new Error("沙箱对话服务未返回内容。");const n=e.body.getReader(),r=new TextDecoder;let s="",i="";const a=[],o=new Map;function c(){t==null||t(a.map(h=>({...h})))}function u(h){i+=h;const p=a[a.length-1];(p==null?void 0:p.kind)==="text"?p.text+=h:a.push({kind:"text",text:h}),c()}function d(h){if(typeof h.id!="string"||h.kind!=="thinking"&&h.kind!=="tool"||h.status!=="running"&&h.status!=="done")return;const p=h.status==="done";let m;if(h.kind==="thinking"){if(typeof h.text!="string"||!h.text)return;m={kind:"thinking",text:h.text,done:p}}else{if(typeof h.name!="string"||!h.name)return;m={kind:"tool",name:h.name,args:h.args,response:h.response,done:p}}const y=o.get(h.id);y===void 0?(o.set(h.id,a.length),a.push(m)):a[y]=m,c()}function f(h){let p="message";const m=[];for(const E of h.split(/\r?\n/))E.startsWith("event:")&&(p=E.slice(6).trim()),E.startsWith("data:")&&m.push(E.slice(5).trimStart());if(m.length===0)return;let y;try{y=JSON.parse(m.join(` -`))}catch{throw new Error("沙箱对话服务返回了无法解析的响应。")}if(p==="error")throw new Error(typeof y.message=="string"&&y.message?y.message:"沙箱对话失败,请稍后重试。");p==="activity"&&d(y),p==="delta"&&typeof y.text=="string"&&u(y.text),p==="done"&&!i&&typeof y.text=="string"&&u(y.text)}for(;;){const{done:h,value:p}=await n.read();s+=r.decode(p,{stream:!h});const m=s.split(/\r?\n\r?\n/);if(s=m.pop()??"",m.forEach(f),h)break}if(s.trim()&&f(s),a.length===0)throw new Error("沙箱未返回有效回复,请重试。");return{text:i,blocks:a}}const Sb={async startSession(e={}){const t=await fetch(xi(_b),{method:"POST",headers:kb({"Content-Type":"application/json"}),signal:Gs(e.signal,K0e)});if(!t.ok)throw await Nb(t,"无法启动 AgentKit 沙箱,请稍后重试。");const n=await t.json();if(!n.sessionId||n.status!=="ready")throw new Error("AgentKit 沙箱返回了无效的会话信息。");return{id:n.sessionId,toolName:"codex",createdAt:new Date().toISOString()}},async sendMessage(e,t={}){if(!e.sessionId||!e.text.trim())throw new Error("内置智能体会话缺少有效的消息内容。");const n=await fetch(xi(`${_b}/${encodeURIComponent(e.sessionId)}/messages`),{method:"POST",headers:kb({Accept:"text/event-stream","Content-Type":"application/json"}),body:JSON.stringify({message:e.text}),signal:Gs(t.signal,Y0e)});if(!n.ok)throw await Nb(n,"沙箱对话失败,请稍后重试。");return G0e(n,t.onBlocks)},async closeSession(e,t={}){if(!e)return;const n=await fetch(xi(`${_b}/${encodeURIComponent(e)}`),{method:"DELETE",headers:kb(),signal:Gs(t.signal,W0e)});if(!n.ok&&n.status!==404)throw await Nb(n,"无法清理 AgentKit 沙箱会话。")}},q0e=1e4;async function c5(e){const t=await fetch(xi(e),{headers:Og({Accept:"application/json"}),signal:Gs(void 0,q0e)});if(!t.ok)throw new Error(`读取会话模式能力失败(HTTP ${t.status})`);const n=await t.json();if(typeof n.enabled!="boolean")throw new Error("会话模式能力响应格式错误");return{enabled:n.enabled,reason:typeof n.reason=="string"?n.reason:void 0}}async function X0e(){return c5("/web/sandbox/capabilities")}async function Q0e(){return c5("/web/skill-creator/capabilities")}function Z0e(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("path",{d:"M12 3.5c.35 3.05 1.62 5.32 4.9 6.1-3.28.78-4.55 3.05-4.9 6.1-.35-3.05-1.62-5.32-4.9-6.1 3.28-.78 4.55-3.05 4.9-6.1Z"}),l.jsx("path",{d:"M18.5 14.5c.18 1.55.84 2.7 2.5 3.1-1.66.4-2.32 1.55-2.5 3.1-.18-1.55-.84-2.7-2.5-3.1 1.66-.4 2.32-1.55 2.5-3.1Z"}),l.jsx("path",{d:"M5.3 14.2c.14 1.15.62 2 1.85 2.3-1.23.3-1.71 1.15-1.85 2.3-.14-1.15-.62-2-1.85-2.3 1.23-.3 1.71-1.15 1.85-2.3Z"})]})}function J0e({open:e,state:t,error:n,onCancel:r,onConfirm:s}){const i=w.useRef(null),a=w.useRef(null);if(w.useEffect(()=>{var f;if(!e)return;const u=document.body.style.overflow;document.body.style.overflow="hidden",(f=a.current)==null||f.focus();const d=h=>{var E;if(h.key==="Escape"){h.preventDefault(),r();return}if(h.key!=="Tab")return;const p=(E=i.current)==null?void 0:E.querySelectorAll("button:not(:disabled)");if(!(p!=null&&p.length))return;const m=p[0],y=p[p.length-1];h.shiftKey&&document.activeElement===m?(h.preventDefault(),y.focus()):!h.shiftKey&&document.activeElement===y&&(h.preventDefault(),m.focus())};return window.addEventListener("keydown",d),()=>{document.body.style.overflow=u,window.removeEventListener("keydown",d)}},[r,e]),!e)return null;const o=t==="loading",c=o?"正在初始化沙箱":t==="error"?"启动失败":"启用 Codex 智能体";return Ss.createPortal(l.jsx("div",{className:"sandbox-dialog-backdrop",onMouseDown:u=>{u.target===u.currentTarget&&!o&&r()},children:l.jsxs("section",{ref:i,className:"sandbox-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"sandbox-dialog-title","aria-describedby":"sandbox-dialog-description",children:[l.jsxs("div",{className:"sandbox-dialog-visual","aria-hidden":"true",children:[l.jsx("span",{className:"sandbox-dialog-orbit"}),l.jsx("span",{className:"sandbox-dialog-icon",children:o?l.jsx("span",{className:"sandbox-spinner"}):l.jsx(Z0e,{})})]}),l.jsxs("div",{className:"sandbox-dialog-copy",children:[l.jsx("h2",{id:"sandbox-dialog-title",children:c}),t==="error"?l.jsx("p",{id:"sandbox-dialog-description",className:"sandbox-dialog-error",role:"alert",children:n||"AgentKit 沙箱初始化失败,请稍后重新尝试。"}):o?l.jsx("p",{id:"sandbox-dialog-description","aria-live":"polite",children:"正在寻找可用工具并创建内置智能体会话,通常需要一点时间。"}):l.jsx("p",{id:"sandbox-dialog-description",children:"将启动 AgentKit 沙箱与 Codex 智能体,本次对话不会被持久化保存。"})]}),l.jsxs("footer",{className:"sandbox-dialog-actions",children:[l.jsx("button",{ref:a,type:"button",onClick:r,children:o?"取消启动":"取消"}),!o&&l.jsx("button",{type:"button",className:"is-primary",onClick:s,children:t==="error"?"重新尝试":"确认开启"})]})]})}),document.body)}function eye({onExit:e}){return l.jsxs("div",{className:"sandbox-session-warning",role:"status",children:[l.jsx("span",{className:"sandbox-session-warning-dot","aria-hidden":"true"}),l.jsx("span",{className:"sandbox-session-warning-copy",children:"当前为 Codex 智能体会话,退出后对话内容消失"}),l.jsx("button",{type:"button",onClick:e,children:"退出内置智能体"})]})}function tye({filled:e=!1,...t}){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[l.jsx("rect",{x:"3.5",y:"9.3",width:"4.5",height:"10.2",rx:"1.5"}),l.jsx("path",{d:"M8 10.2 11.3 4.8c.5-.8 1.7-.45 1.7.5v3.8h4.2a2.1 2.1 0 0 1 2.04 2.6l-1.4 5.75A2.1 2.1 0 0 1 15.8 19H8"})]})}function nye({filled:e=!1,...t}){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[l.jsx("rect",{x:"3.5",y:"4.5",width:"4.5",height:"10.2",rx:"1.5"}),l.jsx("path",{d:"M8 13.8 11.3 19.2c.5.8 1.7.45 1.7-.5v-3.8h4.2a2.1 2.1 0 0 0 2.04-2.6l-1.4-5.75A2.1 2.1 0 0 0 15.8 5H8"})]})}const bC=["#6366f1","#0ea5e9","#10b981","#f59e0b","#f43f5e","#a855f7","#14b8a6","#f472b6"];function Tb(e){let t=0;for(let n=0;n>>0;return bC[t%bC.length]}function rye(e){const t=new Map;e.forEach(u=>t.set(u.span_id,u));const n=new Map,r=[];for(const u of e)u.parent_span_id!=null&&t.has(u.parent_span_id)?(n.get(u.parent_span_id)??n.set(u.parent_span_id,[]).get(u.parent_span_id)).push(u):r.push(u);const s=(u,d)=>u.start_time-d.start_time,i=(u,d)=>({span:u,depth:d,children:(n.get(u.span_id)??[]).sort(s).map(f=>i(f,d+1))}),a=r.sort(s).map(u=>i(u,0)),o=e.length?Math.min(...e.map(u=>u.start_time)):0,c=e.length?Math.max(...e.map(u=>u.end_time)):1;return{rootNodes:a,min:o,total:c-o||1}}function sye(e,t){const n=[],r=s=>{n.push(s),t.has(s.span.span_id)||s.children.forEach(r)};return e.forEach(r),n}function EC(e){const t=e/1e6;return t>=1e3?`${(t/1e3).toFixed(2)} s`:`${t.toFixed(t<10?2:1)} ms`}const iye=e=>e.replace(/^(gen_ai|a2ui|adk)\./,"");function xC(e){return Object.entries(e.attributes).filter(([,t])=>t!=null&&typeof t!="object").map(([t,n])=>{const r=String(n);return{key:iye(t),value:r,long:r.length>80||r.includes(` -`)}}).sort((t,n)=>Number(t.long)-Number(n.long))}function aye({appName:e,sessionId:t,onClose:n}){const[r,s]=w.useState(null),[i,a]=w.useState(""),[o,c]=w.useState(new Set),[u,d]=w.useState(null);w.useEffect(()=>{s(null),a(""),GL(e,t).then(x=>{s(x),d(x.length?x.reduce((b,_)=>b.start_time<=_.start_time?b:_).span_id:null)}).catch(x=>a(String(x)))},[e,t]);const{rootNodes:f,min:h,total:p}=w.useMemo(()=>rye(r??[]),[r]),m=w.useMemo(()=>sye(f,o),[f,o]),y=(r==null?void 0:r.find(x=>x.span_id===u))??null,E=p/1e6,g=x=>c(b=>{const _=new Set(b);return _.has(x)?_.delete(x):_.add(x),_});return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"drawer-scrim",onClick:n}),l.jsxs("aside",{className:"drawer drawer--trace",children:[l.jsxs("header",{className:"drawer-head",children:[l.jsxs("div",{children:[l.jsx("div",{className:"drawer-title",children:"调用链路观测"}),l.jsx("div",{className:"drawer-sub",children:r?`${r.length} 个调用 · ${E.toFixed(1)} ms`:"加载中"})]}),l.jsx("button",{className:"drawer-close",onClick:n,"aria-label":"关闭",children:l.jsx(zr,{className:"icon"})})]}),r==null&&!i&&l.jsxs("div",{className:"drawer-loading",children:[l.jsx(Rt,{className:"icon spin"})," 加载调用链路…"]}),i&&l.jsx("div",{className:"error",children:i}),r&&r.length===0&&l.jsx("div",{className:"drawer-empty",children:"该会话暂无调用链路(可能尚未产生调用)。"}),m.length>0&&l.jsxs("div",{className:"trace-split",children:[l.jsx("div",{className:"trace-tree scroll",children:m.map(x=>{const b=x.span,_=(b.start_time-h)/p*100,k=Math.max((b.end_time-b.start_time)/p*100,.6),N=x.children.length>0;return l.jsxs("button",{className:`trace-row ${u===b.span_id?"active":""}`,onClick:()=>d(b.span_id),children:[l.jsxs("span",{className:"trace-label",style:{paddingLeft:x.depth*14},children:[l.jsx("span",{className:`trace-caret ${N?"":"hidden"} ${o.has(b.span_id)?"":"open"}`,onClick:C=>{C.stopPropagation(),N&&g(b.span_id)},children:l.jsx(ws,{className:"chev"})}),l.jsx("span",{className:"trace-dot",style:{background:Tb(b.name)}}),l.jsx("span",{className:"trace-name",title:b.name,children:b.name})]}),l.jsx("span",{className:"trace-dur",children:EC(b.end_time-b.start_time)}),l.jsx("span",{className:"trace-track",children:l.jsx("span",{className:"trace-bar",style:{left:`${_}%`,width:`${k}%`,background:Tb(b.name)}})})]},b.span_id)})}),l.jsx("div",{className:"trace-detail scroll",children:y?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"td-title",children:y.name}),l.jsxs("div",{className:"td-dur",children:[l.jsx("span",{className:"td-dot",style:{background:Tb(y.name)}}),EC(y.end_time-y.start_time)]}),l.jsx("div",{className:"td-section",children:"属性"}),l.jsx("div",{className:"td-props",children:xC(y).filter(x=>!x.long).map(x=>l.jsxs("div",{className:"td-prop",children:[l.jsx("span",{className:"td-key",children:x.key}),l.jsx("span",{className:"td-val",children:x.value})]},x.key))}),xC(y).filter(x=>x.long).map(x=>l.jsxs("div",{className:"td-block",children:[l.jsx("div",{className:"td-section",children:x.key}),l.jsx("pre",{className:"td-pre",children:x.value})]},x.key))]}):l.jsx("div",{className:"drawer-empty",children:"选择左侧的一个调用查看详情"})})]})]})]})}function oye(e){return e.toLowerCase()==="github"?l.jsx(IH,{className:"icon"}):l.jsx(DH,{className:"icon"})}function lye({branding:e,onUsername:t}){const[n,r]=w.useState(null),[s,i]=w.useState(""),[a,o]=w.useState(0),[c,u]=w.useState(""),d=w.useRef(null);w.useEffect(()=>{let m=!0;return r(null),i(""),DL().then(y=>{m&&r(y)}).catch(y=>{m&&i(y instanceof Error?y.message:String(y))}),()=>{m=!1}},[a]);const f=n!==null&&n.length===0;w.useEffect(()=>{var m;f&&((m=d.current)==null||m.focus())},[f]);const h=nz.test(c),p=()=>{h&&t(c)};return l.jsxs("div",{className:"login",children:[l.jsx("header",{className:"login-top",children:l.jsxs("span",{className:"login-brand",children:[l.jsx("img",{className:"login-brand-logo",src:e.logoUrl||zw,width:20,height:20,alt:"","aria-hidden":!0}),e.title]})}),l.jsx("main",{className:"login-main",children:l.jsxs("div",{className:"login-card",children:[l.jsx(ta,{as:"h1",className:"login-title",duration:4.8,spread:22,children:e.title}),s?l.jsxs("div",{className:"login-provider-error",role:"alert",children:[l.jsx("p",{children:s}),l.jsx("button",{type:"button",onClick:()=>o(m=>m+1),children:"重试"})]}):n===null?null:n.length>0?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"login-sub",children:"登录以继续使用"}),l.jsx("div",{className:"login-providers",children:n.map(m=>l.jsxs("button",{className:"login-btn",onClick:()=>sz(m.loginUrl),children:[oye(m.id),l.jsxs("span",{children:["使用 ",m.label," 登录"]})]},m.id))})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"login-sub",children:"输入一个用户名即可开始"}),l.jsxs("form",{className:"login-name",onSubmit:m=>{m.preventDefault(),p()},children:[l.jsx("input",{ref:d,className:"login-name-input",value:c,onChange:m=>u(m.target.value),placeholder:"用户名(字母 + 数字,最多 16 位)",maxLength:16}),l.jsx("button",{type:"submit",className:"login-name-go",disabled:!h,"aria-label":"进入",children:l.jsx(ad,{className:"icon"})})]}),l.jsx("p",{className:"login-hint","aria-live":"polite",children:c&&!h?"只能包含大小写字母和数字,最多 16 位。":""})]}),l.jsx("p",{className:"login-powered",children:"火山引擎 AgentKit 提供企业级 Agent 解决方案"}),l.jsxs("p",{className:"login-legal",children:["继续即表示你已阅读并同意 AgentKit"," ",l.jsx("a",{href:"https://docs.volcengine.com/docs/86681/1925174?lang=zh",target:"_blank",rel:"noreferrer",children:"产品和服务条款"})]})]})}),l.jsx("footer",{className:"login-footer",children:"© 2026 VeADK. All rights reserved."})]})}function cye({open:e,checking:t,error:n,onLogin:r}){const s=w.useRef(null);return w.useEffect(()=>{var a;if(!e)return;const i=document.body.style.overflow;return document.body.style.overflow="hidden",(a=s.current)==null||a.focus(),()=>{document.body.style.overflow=i}},[e]),e?Ss.createPortal(l.jsx("div",{className:"auth-expired-backdrop",children:l.jsxs("section",{className:"auth-expired-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":"auth-expired-title","aria-describedby":"auth-expired-description",children:[l.jsx("div",{className:"auth-expired-mark","aria-hidden":"true",children:l.jsx(Cg,{})}),l.jsxs("div",{className:"auth-expired-copy",children:[l.jsx("h2",{id:"auth-expired-title",children:"登录状态已过期"}),l.jsx("p",{id:"auth-expired-description",children:"当前编辑内容会保留。重新登录后,刚才的操作将自动继续。"}),n&&l.jsx("p",{className:"auth-expired-error",role:"alert",children:n})]}),l.jsx("footer",{className:"auth-expired-actions",children:l.jsx("button",{ref:s,type:"button",onClick:r,disabled:t,children:t?"等待登录完成…":"重新登录"})})]})}),document.body):null}function uye({node:e,ctx:t}){const n=e.variant??"default";return l.jsx("button",{type:"button",className:`a2ui-button a2ui-button--${n}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component,onClick:()=>t.dispatchAction(e.action,e),children:t.render(e.child)})}tl("Button",uye);function dye({node:e,ctx:t}){return l.jsx("div",{className:"a2ui-card","data-a2ui-id":e.id,"data-a2ui-component":e.component,children:t.render(e.child)})}tl("Card",dye);const fye={start:"flex-start",center:"center",end:"flex-end",spaceBetween:"space-between",spaceAround:"space-around",spaceEvenly:"space-evenly",stretch:"stretch"},hye={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch"};function u5(e){return fye[e]??"flex-start"}function d5(e){return hye[e]??"stretch"}function pye({node:e,ctx:t}){const n=e.children??[];return l.jsx("div",{className:"a2ui-column","data-a2ui-id":e.id,"data-a2ui-component":e.component,style:{display:"flex",flexDirection:"column",justifyContent:u5(e.justify),alignItems:d5(e.align)},children:n.map(r=>t.render(r))})}tl("Column",pye);function mye({node:e}){const t=e.axis==="vertical";return l.jsx("div",{className:`a2ui-divider ${t?"a2ui-divider--v":"a2ui-divider--h"}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component})}tl("Divider",mye);const gye={send:"✈️",check:"✅",close:"✖️",star:"⭐",favorite:"❤️",info:"ℹ️",help:"❓",error:"⛔",calendarToday:"📅",event:"📅",schedule:"🕒",locationOn:"📍",accountCircle:"👤",mail:"✉️",call:"📞",home:"🏠",settings:"⚙️",search:"🔍"};function yye({node:e}){const t=e.name??"";return l.jsx("span",{className:"a2ui-icon",title:t,"aria-label":t,"data-a2ui-id":e.id,"data-a2ui-component":e.component,children:gye[t]??"•"})}tl("Icon",yye);function bye({node:e,ctx:t}){const n=e.children??[];return l.jsx("div",{className:"a2ui-row","data-a2ui-id":e.id,"data-a2ui-component":e.component,style:{display:"flex",flexDirection:"row",justifyContent:u5(e.justify),alignItems:d5(e.align??"center")},children:n.map(r=>t.render(r))})}tl("Row",bye);const Eye=new Set(["h1","h2","h3","h4","h5"]);function xye({node:e,ctx:t}){const n=e.variant??"body",r=t.resolveString(e.text),s=Eye.has(n)?n:"p";return l.jsx(s,{className:`a2ui-text a2ui-text--${n}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component,children:r})}tl("Text",xye);const wye="创建 Agent",vye={intelligent:"智能模式",custom:"自定义",template:"从模板新建",workflow:"工作流",package:"代码包部署"},_l={app:"veadk.appName",view:"veadk.view",session:"veadk.sessionId"},_ye=new Set,kye=[];function Di(){return{skills:[]}}function mo(e){return`veadk.agentDrafts.${encodeURIComponent(e)}`}function Ab(e){return`${mo(e)}.active`}function JE(e){return`veadk.agentOrder.${encodeURIComponent(e)}`}function Nye(e){if(!e)return[];try{const t=JSON.parse(localStorage.getItem(mo(e))||"[]");return Array.isArray(t)?t:[]}catch{return[]}}function Sye(e){if(!e)return[];try{const t=JSON.parse(localStorage.getItem(JE(e))||"[]");return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function ex(e,t){if(e.name===t||e.id===t)return e;for(const n of e.children){const r=ex(n,t);if(r)return r}}function f5(e){const t=[];for(const n of e.children)n.mentionable&&(t.push({name:n.name,description:n.description,type:n.type,path:n.path}),t.push(...f5(n)));return t}function wC(){const e=typeof localStorage<"u"?localStorage.getItem(_l.view):null;return e==="menu"||e==="intelligent"||e==="custom"||e==="template"||e==="workflow"?e:null}function Tye({className:e}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("ellipse",{cx:"12",cy:"12",rx:"6.6",ry:"8.2"}),l.jsx("path",{d:"M12 8.2l1.05 2.75 2.75 1.05-2.75 1.05L12 15.8l-1.05-2.75L8.2 12l2.75-1.05z",fill:"currentColor",stroke:"none"})]})}function Aye(){return l.jsxs("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":!0,children:[l.jsx("rect",{x:"3",y:"4",width:"14",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none"}),l.jsx("rect",{x:"6",y:"10.4",width:"13",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none",opacity:"0.7"}),l.jsx("rect",{x:"9",y:"16.8",width:"9",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none",opacity:"0.45"})]})}function h5(e){return e?new Date(e*1e3).toLocaleString("zh-CN",{timeZone:"Asia/Shanghai",hour12:!1,month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):""}function Cye(e){if(!e)return"";const t=[];return e.ts&&t.push(h5(e.ts)),e.tokens!=null&&t.push(`${e.tokens.toLocaleString()} tokens`),t.join(" · ")}function vC(e){return e.blocks.map(t=>t.kind==="text"?t.text:"").join("").trim()}const Iye="send_a2ui_json_to_client";function Oye(e){return e.blocks.some(t=>t.kind==="text"?t.text.trim().length>0:t.kind==="attachment"?t.files.length>0:t.kind==="tool"?!(t.name===Iye&&t.done):t.kind==="agent-transfer"?!1:t.kind==="a2ui"?F4(t.messages).some(n=>n.components[n.rootId]):t.kind==="auth")}function Rye(e){return e.blocks.some(t=>t.kind==="auth"&&!t.done)}function Lye(e){return new Promise((t,n)=>{let r="";try{r=new URL(e,window.location.href).protocol}catch{}if(r!=="http:"&&r!=="https:"){n(new Error("授权链接不是 http/https 地址,已阻止打开。"));return}const s=window.open(e,"veadk_oauth","width=520,height=720");if(!s){n(new Error("弹窗被拦截,请允许弹窗后重试。"));return}let i=!1;const a=()=>{clearInterval(u),window.removeEventListener("message",c)},o=d=>{if(!i){i=!0,a();try{s.close()}catch{}t(d)}},c=d=>{if(d.origin!==window.location.origin)return;const f=d.data;f&&f.veadkOAuth&&typeof f.url=="string"&&o(f.url)};window.addEventListener("message",c);const u=setInterval(()=>{if(!i){if(s.closed){a();const d=window.prompt("授权完成后,请粘贴回调页面(浏览器地址栏)的完整 URL:");d&&d.trim()?(i=!0,t(d.trim())):n(new Error("授权已取消。"));return}try{const d=s.location.href;d&&d!=="about:blank"&&new URL(d).origin===window.location.origin&&/[?&](code|state|error)=/.test(d)&&o(d)}catch{}}},500)})}function Mye(e,t){const n=JSON.parse(JSON.stringify(e??{})),r=n.exchangedAuthCredential??n.exchanged_auth_credential??{},s=r.oauth2??{};return s.authResponseUri=t,s.auth_response_uri=t,r.oauth2=s,n.exchangedAuthCredential=r,n}function _C({text:e}){const[t,n]=w.useState(!1);return l.jsx("button",{className:"icon-btn",title:t?"已复制":"复制",disabled:!e,onClick:async()=>{if(e)try{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)}catch{}},children:t?l.jsx(Js,{className:"icon"}):l.jsx(Cw,{className:"icon"})})}function jye(e){return e==="cn-beijing"?"华北 2(北京)":e==="cn-shanghai"?"华东 2(上海)":e||"未指定"}function Dye({tasks:e,onCancel:t}){const[n,r]=w.useState(!1),[s,i]=w.useState(null),a=e.filter(f=>f.status==="running").length,o=e[0],c=a>0?"running":(o==null?void 0:o.status)??"idle",u=a>0?`${a} 个部署任务进行中`:(o==null?void 0:o.status)==="success"?"最近部署已完成":(o==null?void 0:o.status)==="error"?"最近部署失败":(o==null?void 0:o.status)==="cancelled"?"最近部署已取消":"部署任务",d=f=>{i(f.id),t(f).finally(()=>i(null))};return l.jsxs("div",{className:"global-deploy-center",children:[l.jsxs("button",{type:"button",className:`global-deploy-task is-${c}`,"aria-expanded":n,"aria-haspopup":"dialog",onClick:()=>r(f=>!f),children:[c==="running"?l.jsx(Rt,{className:"global-deploy-task-icon spin"}):c==="success"?l.jsx(_L,{className:"global-deploy-task-icon"}):c==="error"?l.jsx(Cg,{className:"global-deploy-task-icon"}):c==="cancelled"?l.jsx(H1,{className:"global-deploy-task-icon"}):l.jsx(jH,{className:"global-deploy-task-icon"}),l.jsx("span",{className:"global-deploy-task-detail",children:u}),l.jsx(Tw,{className:`global-deploy-task-chevron${n?" is-open":""}`})]}),n&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"global-deploy-task-scrim","aria-label":"关闭部署任务",onClick:()=>r(!1)}),l.jsxs("section",{className:"global-deploy-popover",role:"dialog","aria-label":"部署任务",children:[l.jsxs("header",{className:"global-deploy-popover-head",children:[l.jsx("span",{children:"部署任务"}),l.jsx("span",{children:e.length})]}),l.jsx("div",{className:"global-deploy-list",children:e.length===0?l.jsx("div",{className:"global-deploy-empty",children:"暂无部署任务"}):e.map(f=>{const h=`${f.label}${f.status==="running"&&typeof f.pct=="number"?` ${Math.round(f.pct)}%`:""}`;return l.jsxs("article",{className:`global-deploy-item is-${f.status}`,children:[l.jsxs("div",{className:"global-deploy-item-head",children:[l.jsx("span",{className:"global-deploy-runtime-name",children:f.runtimeName}),l.jsx("span",{className:"global-deploy-status",children:h})]}),l.jsxs("dl",{className:"global-deploy-meta",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"Runtime 名称"}),l.jsx("dd",{children:f.runtimeName})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"部署地域"}),l.jsx("dd",{children:jye(f.region)})]}),f.runtimeId&&l.jsxs("div",{children:[l.jsx("dt",{children:"Runtime ID"}),l.jsx("dd",{children:f.runtimeId})]})]}),f.message&&f.status==="error"?l.jsx(tg,{className:"global-deploy-error",message:f.message,onRetry:f.retry}):f.message?l.jsx("p",{className:"global-deploy-message",children:f.message}):null,f.status==="running"&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"global-deploy-progress","aria-hidden":!0,children:l.jsx("span",{style:{width:`${Math.max(6,Math.min(100,f.pct??6))}%`}})}),l.jsx("div",{className:"global-deploy-item-actions",children:l.jsx("button",{type:"button",disabled:s===f.id,onClick:()=>d(f),children:s===f.id?"取消中…":"取消部署"})})]})]},f.id)})})]})]})]})}const kC=["今天想做点什么?","有什么可以帮你的?","需要我帮你查点什么吗?","有问题尽管问我","嗨,我们开始吧","开始一段新对话吧","今天想先解决哪件事?","把你的想法告诉我吧","我们从哪里开始?","有什么任务交给我?","准备好一起推进了吗?","说说你现在最关心的问题","今天也一起把事情做好","我在,随时可以开始"],NC=()=>kC[Math.floor(Math.random()*kC.length)];function Cb(e){var t;for(const n of e)(t=n.previewUrl)!=null&&t.startsWith("blob:")&&URL.revokeObjectURL(n.previewUrl)}function Pye(){return`draft-${Date.now()}-${Math.random().toString(36).slice(2)}`}function Bye(e){var n;if(e.type)return e.type;const t=(n=e.name.split(".").pop())==null?void 0:n.toLowerCase();return t==="md"||t==="markdown"?"text/markdown":t==="txt"?"text/plain":"application/octet-stream"}function Fye(){const[e,t]=w.useState([]),[n,r]=w.useState(""),[s,i]=w.useState([]),[a,o]=w.useState(""),c=w.useRef(null),[u,d]=w.useState(!1),[f,h]=w.useState([]),[p,m]=w.useState(null),[y,E]=w.useState([]),[g,x]=w.useState(!1),[b,_]=w.useState(!1),[k,N]=w.useState("confirm"),[C,S]=w.useState(""),A=w.useRef(null),O=w.useRef(null),[D,U]=w.useState({}),X=a?D[a]??[]:f,M=p?y:X,j=($,K)=>U(ae=>({...ae,[$]:typeof K=="function"?K(ae[$]??[]):K})),[T,L]=w.useState(""),[R,F]=w.useState("agent"),[I,V]=w.useState({}),[W,P]=w.useState(null),[ie,G]=w.useState(!1),re=w.useRef(0),[ue,ee]=w.useState([]),[le,ne]=w.useState(Di),[me,ye]=w.useState(null),[te,de]=w.useState(!1),[Ee,Te]=w.useState(null),[Ke,Ne]=w.useState(!1),[it,He]=w.useState([]),[Ue,Et]=w.useState(!1),rt=w.useRef(new Set),[St,ct]=w.useState(()=>new Set),[B,Q]=w.useState(()=>new Set),oe=w.useRef(new Map),be=w.useRef(new Map),Oe=($,K)=>ct(ae=>{const ge=new Set(ae);return K?ge.add($):ge.delete($),ge}),Ye=$=>{const K=be.current.get($);K!==void 0&&window.clearTimeout(K),be.current.delete($),Q(ae=>new Set(ae).add($))},tt=$=>{const K=be.current.get($);K!==void 0&&window.clearTimeout(K);const ae=window.setTimeout(()=>{be.current.delete($),Q(ge=>{const Me=new Set(ge);return Me.delete($),Me})},2400);be.current.set($,ae)},ze=w.useRef(""),[Tt,Re]=w.useState(""),[kt,Pt]=w.useState(()=>new Set),[Bt,bn]=w.useState(!1),[Xe,ft]=w.useState(!1),xt=w.useRef(null),vt=w.useCallback(()=>ft(!1),[]),[fe,$e]=w.useState(NC),[nt,qt]=w.useState(null),[fn,Lt]=w.useState(!1),[J,he]=w.useState(!1),[Le,Be]=w.useState(""),ot=w.useRef(!1),[It,st]=w.useState(null),[Z,we]=w.useState(""),[_e,We]=w.useState(),[Ve,Je]=w.useState(null),[ut,Vt]=w.useState({newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,addAgentkit:!0}),[Ft,hn]=w.useState("cloud"),[Tn,Kt]=w.useState(Gd),[os,Er]=w.useState(""),[Xn,Or]=w.useState("chat"),[Qn,ar]=w.useState(!1),[An,Xt]=w.useState(!1),[En,Un]=w.useState(!1),[or,nn]=w.useState({}),[ls,Zn]=w.useState({}),[$n,Jn]=w.useState({}),Is=St.has(a),Rr=B.has(a),xr=Is||u,cs=!!a&&Ke,Kr=p?g:xr,qa=Kr||!p&&Rr,Xa=or[a]??"",Qa=ls[a]??_ye,Si=$n[a]??kye,Hn=me==null?void 0:me.graph,Za=[me==null?void 0:me.name,Hn==null?void 0:Hn.name,Hn==null?void 0:Hn.id].filter($=>!!$),Ti=le.targetAgent&&Hn?ex(Hn,le.targetAgent.name):Hn,Qf=(Ti==null?void 0:Ti.skills)??(le.targetAgent?[]:(me==null?void 0:me.skills)??[]),Zf=Hn?f5(Hn):[];function rl($){Cb($);for(const K of $)K.status==="uploading"?rt.current.add(K.id):K.uri&&Np(n,K.uri).catch(ae=>Re(String(ae)))}function sl(){re.current+=1;const $=W;P(null),G(!1),$&&!$.id.startsWith("pending-")&&O0e($.id).catch(K=>{Re(K instanceof Error?K.message:String(K))})}async function il($){try{await W1(n,Z,$),await Y1(n,Z,$),i(K=>K.filter(ae=>ae.id!==$)),U(K=>{const{[$]:ae,...ge}=K;return ge})}catch(K){Re(String(K))}}function Jf($){const K=ue.find(Me=>Me.id===$);if(!K)return;const ae=ue.filter(Me=>Me.id!==$);Cb([K]),K.status==="uploading"&&rt.current.add($),ee(ae),ae.length===0&&!T.trim()&&!!a&&M.length===0?(ze.current="",o(""),il(a)):K.uri&&Np(n,K.uri).catch(Me=>Re(String(Me)))}const q=($,K)=>{var Se,je,Ge,De,At;const ae=K.author&&K.author!=="user"?K.author:void 0;ae&&(nn(Ze=>({...Ze,[$]:ae})),Zn(Ze=>({...Ze,[$]:new Set(Ze[$]??[]).add(ae)})),Jn(Ze=>{var ht;return(ht=Ze[$])!=null&&ht.length?Ze:{...Ze,[$]:[ae]}}));const ge=((Se=K.actions)==null?void 0:Se.transferToAgent)??((je=K.actions)==null?void 0:je.transfer_to_agent);ge&&Jn(Ze=>{const ht=Ze[$]??[];return ht[ht.length-1]===ge?Ze:{...Ze,[$]:[...ht,ge]}}),(((Ge=K.actions)==null?void 0:Ge.endOfAgent)??((De=K.actions)==null?void 0:De.end_of_agent)??((At=K.actions)==null?void 0:At.escalate))&&Jn(Ze=>{const ht=Ze[$]??[];return ht.length<=1?Ze:{...Ze,[$]:ht.slice(0,-1)}})},[pe,ve]=w.useState(wC),[Qe,Mt]=w.useState([]),rn=w.useCallback($=>{Mt(K=>{const ae=K.findIndex(Me=>Me.id===$.id);if(ae===-1)return[$,...K];const ge=[...K];return ge[ae]={...ge[ae],...$},ge})},[]),pn=w.useCallback(async $=>{try{await sM($.id),Mt(K=>K.map(ae=>ae.id===$.id?{...ae,status:"cancelled",label:"已取消",message:"部署已取消,相关 Runtime 资源已请求销毁。"}:ae))}catch(K){const ae=K instanceof Error?K.message:String(K);Mt(ge=>ge.map(Me=>Me.id===$.id?{...Me,message:`取消失败:${ae}`}:Me))}},[]),[Mn,Cn]=w.useState(!0),[In,Ct]=w.useState(!1),[lr,sn]=w.useState(!1),[au,zn]=w.useState(!1),[p5,wr]=w.useState(null),[h_,Ja]=w.useState([]),[p_,eh]=w.useState([]),[Lr,Os]=w.useState(""),us=w.useRef(null),[x0,Rs]=w.useState(!1),[m5,Vn]=w.useState(!1),w0=w.useRef(null),[v0,al]=w.useState(()=>{const $=ps();return Wc($),$}),[g5,m_]=w.useState(!1),[y5,_0]=w.useState(""),[g_,th]=w.useState(null),[b5,y_]=w.useState({}),[ol,ri]=w.useState(null),[E5,Ai]=w.useState(""),[x5,Ci]=w.useState(""),[w5,nh]=w.useState(!1),k0=w.useRef(!1),rh=w.useRef(!1),v5=w.useCallback(($,K,ae)=>{!$||!Z||Ja(ge=>{const Se=[{id:$,draft:K,updatedAt:Date.now(),deploymentTarget:ae},...ge.filter(je=>je.id!==$)];return localStorage.setItem(mo(Z),JSON.stringify(Se)),Se})},[Z]),N0=w.useCallback($=>{!$||!Z||Ja(K=>{const ae=K.filter(ge=>ge.id!==$);return localStorage.setItem(mo(Z),JSON.stringify(ae)),ae})},[Z]),_5=w.useCallback($=>{if(!Z||$.length===0)return;const K=new Set($.map(ae=>ae.id));Ja(ae=>{const ge=ae.filter(Me=>!K.has(Me.id));return localStorage.setItem(mo(Z),JSON.stringify(ge)),ge}),K.has(Lr)&&(Os(""),wr(null),ri(null),us.current=null,localStorage.removeItem(Ab(Z)))},[Lr,Z]),b_=w.useCallback($=>{if(!$||!Z)return;const K=us.current;Ja(ae=>{const ge=ae.filter(Se=>Se.id!==$),Me=(K==null?void 0:K.id)===$?[K,...ge]:ge;return localStorage.setItem(mo(Z),JSON.stringify(Me)),Me})},[Z]);w.useEffect(()=>{if(!Z){Ja([]),eh([]),Os(""),us.current=null;return}const $=Nye(Z);Ja($),eh(Sye(Z));const K=localStorage.getItem(Ab(Z))||"",ae=$.find(ge=>ge.id===K);us.current=ae??null,pe==="custom"&&ae&&(Os(ae.id),wr(ae.draft),ri(ae.deploymentTarget??null))},[Z]),w.useEffect(()=>{if(!Z)return;const $=Ab(Z);pe==="custom"&&Lr?localStorage.setItem($,Lr):localStorage.removeItem($)},[pe,Lr,Z]);const k5=w.useCallback($=>{if(!Z)return;const K=[...new Set($.filter(Boolean))];eh(K),localStorage.setItem(JE(Z),JSON.stringify(K))},[Z]),N5=w.useCallback(async $=>{const K=$.filter(Se=>!!Se.runtimeId&&Se.canDelete===!0);if(K.length===0)return;const ae=new Set,ge=new Set,Me=[];for(const Se of K)try{await dM(Se.runtimeId,Se.region??"cn-beijing"),Tm(Se.runtimeId),ae.add(Se.runtimeId),ge.add(Se.id)}catch(je){const Ge=je instanceof Error?je.message:String(je);Me.push(`${Se.label}: ${Ge}`)}if(ae.size>0&&(al(ps()),th(Se=>{if(!Se)return Se;const je=new Set(Se);for(const Ge of ae)je.delete(Ge);return je}),y_(Se=>Object.fromEntries(Object.entries(Se).filter(([je])=>!ae.has(je)))),eh(Se=>{const je=Se.filter(Ge=>!ge.has(Ge));return Z&&localStorage.setItem(JE(Z),JSON.stringify(je)),je}),Ja(Se=>{const je=Se.filter(Ge=>{var De;return!((De=Ge.deploymentTarget)!=null&&De.runtimeId)||!ae.has(Ge.deploymentTarget.runtimeId)});return Z&&localStorage.setItem(mo(Z),JSON.stringify(je)),je}),K.some(Se=>Se.id===n)&&(ze.current="",o(""),r(""))),Me.length>0){const Se=Me.slice(0,3).join(";"),je=Me.length>3?`;另有 ${Me.length-3} 个失败`:"";throw new Error(`${Me.length} 个 Agent 删除失败:${Se}${je}`)}},[n,Z]),E_=w.useCallback(async()=>{m_(!0),_0("");try{const $=[];let K="";do{const ge=await cd({scope:"mine",region:"all",pageSize:100,nextToken:K});$.push(...ge.runtimes),K=ge.nextToken}while(K&&$.length<2e3);th(new Set($.map(ge=>ge.runtimeId))),y_(Object.fromEntries($.map(ge=>[ge.runtimeId,{canDelete:ge.canDelete}])));const ae=[];for(const ge of $)try{await Sm(ge.runtimeId,ge.name,ge.region,ge.currentVersion)}catch{ae.push(ge.name)}al(ps()),ae.length>0&&_0(`${ae.length} 个 Runtime 暂时无法读取,请稍后重试。`)}catch($){_0($ instanceof Error?$.message:String($))}finally{m_(!1)}},[]);function sh($){console.log("create agent draft:",$),ve(null),cl()}function S0($,K){console.log("Agent added, navigating to:",$,K),al(ps()),th(null),N0(Lr),Os(""),us.current=null,ri(null),Ai(""),Ci($),ve(null),Vn(!0),r($)}const S5=w.useCallback($=>{ve(null),zn(!1),Vn(!0),Ci(""),Ai($.id),Re("")},[]),T5=w.useCallback(async $=>{if(!$.runtimeId)throw new Error("部署完成,但未返回 Runtime ID。");const K=(ol==null?void 0:ol.region)??"cn-beijing",ae=await Sm($.runtimeId,$.agentName,$.region??K,$.version);al(ps()),th(ge=>{const Me=new Set(ge??[]);return Me.add($.runtimeId),Me}),ri(null),N0(Lr),Os(""),us.current=null,Ai(""),Ci(ae),ve(null),Vn(!0),r(ae)},[Lr,N0,ol]),ou=w.useRef(null),ll=w.useRef(!0),aa=w.useRef(!1),eo=w.useRef(null),x_=w.useRef({key:"",turnCount:0}),T0=(p==null?void 0:p.id)??a;w.useLayoutEffect(()=>{const $=ou.current,K=x_.current,ae=K.key!==T0,ge=!ae&&M.length>K.turnCount;if(x_.current={key:T0,turnCount:M.length},!$||M.length===0||!ae&&!ge)return;ll.current=!0,aa.current=!1,eo.current!==null&&(window.clearTimeout(eo.current),eo.current=null);const Me=window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(ae||Me){$.scrollTop=$.scrollHeight;return}aa.current=!0,$.scrollTo({top:$.scrollHeight,behavior:"smooth"}),eo.current=window.setTimeout(()=>{aa.current=!1,eo.current=null},450)},[T0,M.length]),w.useLayoutEffect(()=>{const $=ou.current;!$||!ll.current||aa.current||($.scrollTop=$.scrollHeight)},[Kr,M]),w.useEffect(()=>()=>{eo.current!==null&&window.clearTimeout(eo.current)},[]);const A5=w.useCallback(()=>{const $=ou.current;!$||aa.current||(ll.current=$.scrollHeight-$.scrollTop-$.clientHeight<32)},[]),C5=w.useCallback($=>{$.deltaY<0&&(aa.current=!1,ll.current=!1)},[]),I5=w.useCallback(()=>{aa.current=!1,ll.current=!1},[]),O5=w.useCallback(()=>{const $=ou.current;!$||!ll.current||aa.current||($.scrollTop=$.scrollHeight)},[]),A0=w.useCallback(()=>{st(null),V1().then($=>{we($.userId),We($.info),Xt(!!$.local),qt($.status)}).catch($=>{st($ instanceof Error?$.message:String($))})},[]);w.useEffect(()=>{A0()},[A0]),w.useEffect(()=>{const $=()=>{Be(""),Lt(!0)};return window.addEventListener(K1,$),fz()&&$(),()=>window.removeEventListener(K1,$)},[]);const R5=w.useCallback(async()=>{if(ot.current)return;ot.current=!0;const $=iz();if(!$){ot.current=!1,Be("登录窗口被浏览器拦截,请允许弹出窗口后重试。");return}he(!0),Be("");try{for(;;){await new Promise(K=>window.setTimeout(K,1e3));try{const K=await V1();if(K.status==="authenticated"){we(K.userId),We(K.info),Xt(!!K.local),qt(K.status),Lt(!1),hz(),$.close();return}}catch{}if($.closed){Be("登录窗口已关闭,请重新登录以继续当前操作。");return}}}finally{ot.current=!1,he(!1)}},[]);w.useEffect(()=>{An&&Z&&hS(Z)},[An,Z]),w.useEffect(()=>{if(nt!=="authenticated"||!Z){V({});return}let $=!1;return Promise.allSettled([X0e(),Q0e()]).then(([K,ae])=>{$||V({temporaryEnabled:K.status==="fulfilled"&&K.value.enabled,skillCreateEnabled:ae.status==="fulfilled"&&ae.value.enabled})}),()=>{$=!0}},[nt,Z]),w.useEffect(()=>{if(nt!=="authenticated"||!Z){Je(null);return}let $=!1;return Je(null),oM().then(K=>{$||Je(K)}).catch(K=>{console.warn("[app] /web/access failed; using ordinary-user access:",K),$||Je(aM)}),()=>{$=!0}},[nt,Z]),w.useEffect(()=>{iM().then($=>{Vt($.features),hn($.agentsSource),Kt($.branding),Er($.version),Or($.defaultView),ar(!0)})},[]),w.useEffect(()=>{!Ve||!Qn||rh.current||(rh.current=!0,Xn==="addAgent"&&Ve.capabilities.createAgents&&(ve(null),Ct(!1),Rs(!1),Vn(!1),sn(!1),zn(!0)))},[Ve,Xn,Qn]),w.useEffect(()=>{Ve&&(Ve.capabilities.createAgents||(ve(null),wr(null),sn(!1),zn(!1),Mt([])),Ve.capabilities.manageAgents||Vn(!1))},[Ve]),w.useEffect(()=>{document.title=Tn.title;let $=document.querySelector('link[rel~="icon"]');$||($=document.createElement("link"),$.rel="icon",document.head.appendChild($)),$.removeAttribute("type"),$.href=Tn.logoUrl||zw},[Tn]),w.useEffect(()=>{fetch("/web/runtime-config",{signal:AbortSignal.timeout(1e4)}).then($=>$.ok?$.json():null).then($=>{$&&Cn(!!$.credentials)}).catch($=>{console.warn("[app] /web/runtime-config probe failed; workbench stays hidden:",$)})},[]);function L5($){hS($),k0.current=!0,rh.current=!1,Je(null),ve(null),wr(null),Ct(!1),sn(!1),zn(!1),Rs(!1),Vn(!1),cl(),we($),We({name:$}),Xt(!0),qt("authenticated")}function M5(){rh.current=!1,Je(null),An?(rz(),we(""),We(void 0),qt("unauthenticated")):oz()}w.useEffect(()=>{nt!=="unauthenticated"&&zL().then($=>{if(t($),Ft==="cloud"){r("");return}const K=localStorage.getItem(_l.app),ae=v0.flatMap(Se=>Se.apps.map(je=>Fo(Se.id,je))),ge=K&&($.includes(K)||ae.includes(K)),Me=["web_search_agent","web_demo"].find(Se=>$.includes(Se))??$.find(Se=>!/^\d/.test(Se))??$[0];r(ge?K:Me||"")}).catch($=>Re(String($)))},[nt,Ft]),w.useEffect(()=>{n&&localStorage.setItem(_l.app,n)},[n]),w.useEffect(()=>{let $=!1;if(Te(null),He([]),!n||!Z||!a){Ne(!1);return}return Ne(!0),qL(n,Z,a).then(K=>{$||(Te(K),XL(n).then(ae=>{$||He(ae)}).catch(()=>{$||He([])}))}).catch(()=>{$||Te(null)}).finally(()=>{$||Ne(!1)}),()=>{$=!0}},[n,Z,a]),w.useEffect(()=>{let $=!1;if(ye(null),ne(Di()),!n){de(!1);return}return de(!0),Uw(n).then(K=>{$||ye(K)}).catch(()=>{$||ye(null)}).finally(()=>{$||de(!1)}),()=>{$=!0}},[n]),w.useEffect(()=>{Ve&&localStorage.setItem(_l.view,Ve.capabilities.createAgents?pe??"chat":"chat")},[Ve,pe]),w.useEffect(()=>{localStorage.setItem(_l.session,a),ze.current=a},[a]),w.useEffect(()=>()=>oe.current.forEach($=>$.abort()),[]),w.useEffect(()=>()=>be.current.forEach($=>{window.clearTimeout($)}),[]),w.useEffect(()=>()=>{var $,K;($=A.current)==null||$.abort(),(K=O.current)==null||K.abort()},[]),w.useEffect(()=>{!n||!Z||(async()=>{const $=await ih(n);if(!k0.current){k0.current=!0;const K=localStorage.getItem(_l.session)||"";if(wC()===null&&K&&$.some(ae=>ae.id===K)){ah(K);return}}cl()})()},[n,Z]),w.useEffect(()=>{const $=w0.current;$&&$.app===n&&(w0.current=null,ah($.sid))},[n]);function j5($,K){Rs(!1),$===n?ah(K):(w0.current={app:$,sid:K},r($))}async function ih($){try{const K=await Pw($,Z),ae=await Promise.all(K.map(ge=>{var Me;return(Me=ge.events)!=null&&Me.length?Promise.resolve(ge):km($,Z,ge.id)}));return i(ae),ae}catch(K){return Re(String(K)),[]}}function D5(){p||(Re(""),S(""),N("confirm"),_(!0))}function P5(){var $;($=A.current)==null||$.abort(),A.current=null,_(!1),N("confirm"),S(""),!p&&R==="temporary"&&F("agent")}async function B5(){var K;(K=A.current)==null||K.abort();const $=new AbortController;A.current=$,N("loading"),S("");try{const ae=await Sb.startSession({signal:$.signal});if(A.current!==$)return;ze.current="",o(""),h([]),L(""),ne(Di()),F("temporary"),sl(),G(!1),rl(ue),ee([]),E([]),m(ae),ve(null),Ct(!1),sn(!1),zn(!1),Rs(!1),Vn(!1),_(!1),N("confirm")}catch(ae){if((ae==null?void 0:ae.name)==="AbortError"||A.current!==$)return;S(ae instanceof Error?ae.message:String(ae)),N("error")}finally{A.current===$&&(A.current=null)}}function to(){var K;(K=O.current)==null||K.abort(),O.current=null,x(!1),E([]),L(""),Re(""),F("agent");const $=p;m(null),$&&Sb.closeSession($.id).catch(ae=>Re(String(ae)))}async function F5($){var Me;const K=p;if(!K||g||!$.trim())return;Re("");const ae=new AbortController;(Me=O.current)==null||Me.abort(),O.current=ae;const ge=[{role:"user",blocks:[{kind:"text",text:$}],meta:{ts:Date.now()/1e3}},{role:"assistant",blocks:[]}];E(Se=>[...Se,...ge]),x(!0);try{const Se=await Sb.sendMessage({sessionId:K.id,text:$},{signal:ae.signal,onBlocks:je=>{O.current===ae&&E(Ge=>{const De=Ge.slice(),At=De[De.length-1];return(At==null?void 0:At.role)==="assistant"&&(De[De.length-1]={...At,blocks:je}),De})}});if(O.current!==ae)return;E(je=>{const Ge=je.slice(),De=Ge[Ge.length-1];return(De==null?void 0:De.role)==="assistant"&&(Ge[Ge.length-1]={...De,blocks:Se.blocks,meta:{ts:Date.now()/1e3}}),Ge})}catch(Se){if((Se==null?void 0:Se.name)==="AbortError"||O.current!==ae)return;E(je=>je.slice(0,-2)),L($),Re(`内置智能体发送失败:${Se instanceof Error?Se.message:String(Se)}`)}finally{O.current===ae&&(O.current=null,x(!1))}}function cl(){to(),Re(""),ft(!1),$e(NC()),F("agent"),sl(),G(!1);const $=a&&X.length===0&&ue.length>0?a:"";ze.current="",o(""),Te(null),He([]),d(!1),h([]),ne(Di()),rl(ue),ee([]),$&&il($)}async function U5($){var K;try{(K=oe.current.get($))==null||K.abort(),await W1(n,Z,$),await Y1(n,Z,$);const ae=be.current.get($);ae!==void 0&&window.clearTimeout(ae),be.current.delete($),Q(ge=>{if(!ge.has($))return ge;const Me=new Set(ge);return Me.delete($),Me}),U(ge=>{const{[$]:Me,...Se}=ge;return Se}),$===a&&cl(),await ih(n)}catch(ae){Re(String(ae))}}async function ah($){if(p&&to(),$!==a&&(ze.current=$,Re(""),d(!1),h([]),F("agent"),sl(),ne(Di()),Te(null),He([]),o($),D[$]===void 0)){Un(!0);try{const K=await km(n,Z,$);j($,Oz(K.events??[],K.state))}catch(K){Re(String(K))}finally{Un(!1)}}}async function w_($=!0){if(a)return a;c.current||(c.current=_m(n,Z));const K=c.current;try{const ae=await K;$&&o(ae);const ge=Date.now()/1e3,Me={id:ae,lastUpdateTime:ge,events:[]};return i(Se=>[Me,...Se.filter(je=>je.id!==ae)]),ae}finally{c.current===K&&(c.current=null)}}async function v_($){if(!n||!Z||!a||!Ee)return!1;Et(!0),Re("");try{const K=await ZL(n,Z,a,$,Ee.revision);return Te(K),!0}catch(K){return Re(String(K)),!1}finally{Et(!1)}}async function __($){if(!(!n||!Z||!a||!Ee)){Et(!0),Re("");try{const K=await JL(n,Z,a,$,Ee.revision);Te(K)}catch(K){Re(String(K))}finally{Et(!1)}}}async function $5($){Re("");let K;try{K=await w_()}catch(ge){Re(String(ge));return}const ae=Array.from($).map(ge=>({file:ge,attachment:{id:Pye(),mimeType:Bye(ge),name:ge.name,sizeBytes:ge.size,status:"uploading"}}));ee(ge=>[...ge,...ae.map(Me=>Me.attachment)]),await Promise.all(ae.map(async({file:ge,attachment:Me})=>{try{const Se=await KL(n,Z,K,ge);if(rt.current.delete(Me.id)){Se.uri&&await Np(n,Se.uri);return}ee(je=>je.map(Ge=>Ge.id===Me.id?Se:Ge))}catch(Se){if(rt.current.delete(Me.id))return;const je=Se instanceof Error?Se.message:String(Se);ee(Ge=>Ge.map(De=>De.id===Me.id?{...De,status:"error",error:je}:De)),Re(je)}}))}async function k_($,K=[],ae=Di()){if(!$.trim()&&K.length===0||xr||cs||!n||!Z)return;Re("");const ge=[];(ae.skills.length>0||ae.targetAgent)&&ge.push({kind:"invocation",value:ae}),K.length&&ge.push({kind:"attachment",files:K.map(De=>({id:De.id,mimeType:De.mimeType,data:De.data,uri:De.uri,name:De.name,sizeBytes:De.sizeBytes}))}),$.trim()&&ge.push({kind:"text",text:$});const Me=[{role:"user",blocks:ge,meta:{ts:Date.now()/1e3}},{role:"assistant",blocks:[]}],Se=!a;Se&&(h(Me),d(!0));let je;try{je=await w_(!Se)}catch(De){Se&&(h([]),d(!1),L($),ne(ae)),Re(String(De));return}j(je,De=>Se?Me:[...De,...Me]),Se&&(ze.current=je,o(je),h([]),d(!1));const Ge=new AbortController;oe.current.set(je,Ge),Oe(je,!0),Ye(je),ze.current=je,nn(De=>({...De,[je]:""})),Zn(De=>({...De,[je]:new Set})),Jn(De=>({...De,[je]:[]}));try{let De=zs(),At="",Ze=0,ht=Date.now()/1e3,an="",Wr="";for await(const mn of Wd({appName:n,userId:Z,sessionId:je,text:$,attachments:K,invocation:ae,signal:Ge.signal,sessionCapabilities:Ee!==null})){if(Ge.signal.aborted)break;const Ii=mn.error??mn.errorMessage??mn.error_message;if(typeof Ii=="string"&&Ii){ze.current===je&&Re(Ii);break}q(je,mn);const Oi=mn.author&&mn.author!=="user"?mn.author:"";Oi&&Oi!==At&&(At=Oi,De=zs()),De=xc(De,mn);const ii=mn.usageMetadata??mn.usage_metadata;ii!=null&&ii.totalTokenCount&&(Ze=ii.totalTokenCount),mn.timestamp&&(ht=mn.timestamp),mn.id&&(an=mn.id);const jn=mn.invocationId??mn.invocation_id;jn&&(Wr=jn);const ds=De.blocks,ai={author:At||void 0,tokens:Ze||void 0,ts:ht,eventId:an||void 0,invocationId:Wr||void 0};j(je,Ri=>{var Li;const er=Ri.slice(),oa=er[er.length-1];return(oa==null?void 0:oa.role)==="assistant"&&(!((Li=oa.meta)!=null&&Li.author)||oa.meta.author===At)?er[er.length-1]={...oa,blocks:ds,meta:ai}:er.push({role:"assistant",blocks:ds,meta:ai}),er})}ih(n)}catch(De){(De==null?void 0:De.name)!=="AbortError"&&!Ge.signal.aborted&&ze.current===je&&Re(String(De))}finally{oe.current.get(je)===Ge&&oe.current.delete(je),Oe(je,!1),tt(je),nn(De=>({...De,[je]:""})),Jn(De=>({...De,[je]:[]}))}}function H5($,K){var Me,Se;const ae=((Me=$==null?void 0:$.event)==null?void 0:Me.name)??K.id,ge=((Se=$==null?void 0:$.event)==null?void 0:Se.context)??{};k_(`[ui-action] ${ae}: ${JSON.stringify(ge)}`)}async function z5($){var De,At,Ze;if(!$.authUri)throw new Error("事件中没有授权地址。");if(!n||!Z||!a)throw new Error("会话尚未就绪。");const K=a,ae=await Lye($.authUri),ge=Mye($.authConfig,ae),Me=ht=>ht.map(an=>an.kind==="auth"&&!an.done?{...an,done:!0}:an);j(K,ht=>{const an=ht.slice(),Wr=an[an.length-1];return(Wr==null?void 0:Wr.role)==="assistant"&&(an[an.length-1]={...Wr,blocks:Me(Wr.blocks)}),an});const Se=M[M.length-1],je=Me(Se&&Se.role==="assistant"?Se.blocks:[]),Ge=new AbortController;oe.current.set(K,Ge),Oe(K,!0),Ye(K);try{let ht=zs(),an=((De=Se==null?void 0:Se.meta)==null?void 0:De.author)??"",Wr=je,mn=0,Ii=Date.now()/1e3,Oi=((At=Se==null?void 0:Se.meta)==null?void 0:At.eventId)??"",ii=((Ze=Se==null?void 0:Se.meta)==null?void 0:Ze.invocationId)??"";for await(const jn of Wd({appName:n,userId:Z,sessionId:a,text:"",functionResponses:[{id:$.callId,name:"adk_request_credential",response:ge}],signal:Ge.signal,sessionCapabilities:Ee!==null})){if(Ge.signal.aborted)break;q(K,jn);const ds=jn.author&&jn.author!=="user"?jn.author:"";ds&&ds!==an&&(an=ds,Wr=[],ht=zs()),ht=xc(ht,jn);const ai=jn.usageMetadata??jn.usage_metadata;ai!=null&&ai.totalTokenCount&&(mn=ai.totalTokenCount),jn.timestamp&&(Ii=jn.timestamp),jn.id&&(Oi=jn.id);const Ri=jn.invocationId??jn.invocation_id;Ri&&(ii=Ri);const er=[...Wr,...ht.blocks];j(K,oa=>{var I_,O_,R_,L_,M_;const Li=oa.slice(),Kn=Li[Li.length-1],C_={author:an||((I_=Kn==null?void 0:Kn.meta)==null?void 0:I_.author),tokens:mn||((O_=Kn==null?void 0:Kn.meta)==null?void 0:O_.tokens),ts:Ii,eventId:Oi||((R_=Kn==null?void 0:Kn.meta)==null?void 0:R_.eventId),invocationId:ii||((L_=Kn==null?void 0:Kn.meta)==null?void 0:L_.invocationId)};return(Kn==null?void 0:Kn.role)==="assistant"&&(!((M_=Kn.meta)!=null&&M_.author)||Kn.meta.author===an)?Li[Li.length-1]={...Kn,blocks:er,meta:C_}:Li.push({role:"assistant",blocks:er,meta:C_}),Li})}ih(n)}catch(ht){(ht==null?void 0:ht.name)!=="AbortError"&&!Ge.signal.aborted&&ze.current===K&&Re(String(ht))}finally{oe.current.get(K)===Ge&&oe.current.delete(K),Oe(K,!1),tt(K),nn(ht=>({...ht,[K]:""})),Jn(ht=>({...ht,[K]:[]}))}}if(It)return l.jsxs("div",{className:"boot boot-error",children:[l.jsx("p",{children:It}),l.jsx("button",{type:"button",onClick:A0,children:"重试"})]});if(nt===null)return l.jsx("div",{className:"boot"});if(nt==="unauthenticated")return l.jsx(lye,{branding:Tn,onUsername:L5});if(!Ve)return l.jsx("div",{className:"boot"});const si=Ve.capabilities.createAgents,N_=Ve.capabilities.manageAgents,Ls=si?pe:null,oh=si&&au,lh=si&&lr,C0=m5,S_=wM(e,v0),lu=S_.filter($=>$.runtimeId&&(g_===null||g_.has($.runtimeId))).map($=>{var K;return{...$,canDelete:$.runtimeId?((K=b5[$.runtimeId])==null?void 0:K.canDelete)===!0:!1}}),V5=(()=>{if(lu.length===0)return lu;const $=new Map(p_.map((K,ae)=>[K,ae]));return[...lu].sort((K,ae)=>{const ge=$.get(K.id),Me=$.get(ae.id);return ge!=null&&Me!=null?ge-Me:ge!=null?-1:Me!=null?1:lu.indexOf(K)-lu.indexOf(ae)})})(),I0=$=>{var K;return((K=S_.find(ae=>ae.id===$))==null?void 0:K.label)??$},Yr=v0.find($=>$.runtimeId&&$.apps.some(K=>Fo($.id,K)===n)),O0=Yr&&Yr.runtimeId?{runtimeId:Yr.runtimeId,name:Yr.name,region:Yr.region??"cn-beijing"}:void 0,T_=async($,K)=>{var je,Ge;const ae=(je=$.meta)==null?void 0:je.eventId,ge=a;if(!ae||!ge||!O0)return;const Me=(Ge=$.meta)==null?void 0:Ge.feedback,Se={...Me,rating:K,syncStatus:"syncing",updatedAt:Date.now()/1e3};j(ge,De=>De.map(At=>{var Ze;return((Ze=At.meta)==null?void 0:Ze.eventId)===ae?{...At,meta:{...At.meta,feedback:Se}}:At})),Pt(De=>new Set(De).add(ae));try{const De=await VL({appName:n,userId:Z,sessionId:ge,eventId:ae,rating:K});j(ge,At=>At.map(Ze=>{var ht;return((ht=Ze.meta)==null?void 0:ht.eventId)===ae?{...Ze,meta:{...Ze.meta,feedback:De}}:Ze})),i(At=>At.map(Ze=>Ze.id===ge?{...Ze,state:{...Ze.state??{},[`veadk_feedback:${ae}`]:De}}:Ze))}catch(De){j(ge,At=>At.map(Ze=>{var ht;return((ht=Ze.meta)==null?void 0:ht.eventId)===ae?{...Ze,meta:{...Ze.meta,feedback:Me}}:Ze})),ze.current===ge&&Re(De instanceof Error?De.message:String(De))}finally{Pt(De=>{const At=new Set(De);return At.delete(ae),At})}},A_=$=>{al(ps()),ze.current="",o(""),r($)};return l.jsxs("div",{className:"layout",children:[l.jsx(Qz,{branding:Tn,access:Ve,features:ut,sessions:s,currentSessionId:a,streamingSids:St,onNewChat:()=>{ve(null),Ct(!1),sn(!1),zn(!1),Rs(!1),Vn(!1),cl()},onSearch:()=>{p&&to(),ve(null),Ct(!1),sn(!1),zn(!1),Vn(!1),Rs(!0),Re("")},onQuickCreate:()=>{if(!si){Re("当前账号没有添加 Agent 的权限。");return}p&&to(),ze.current="",o(""),Ct(!1),sn(!1),Rs(!1),Vn(!1),ve(null),wr(null),zn(!0),Re("")},onSkillCenter:()=>{p&&to(),ve(null),sn(!1),zn(!1),Rs(!1),Vn(!1),Ct(!0),Re("")},onAddAgent:()=>{if(!si){Re("当前账号没有添加 Agent 的权限。");return}p&&to(),ze.current="",ve(null),Ct(!1),Rs(!1),Vn(!1),o(""),zn(!1),sn(!0),Re("")},onManageAgents:()=>{p&&to(),ze.current="",o(""),ve(null),Ct(!1),sn(!1),zn(!1),Rs(!1),Vn(!0),Re(""),E_()},onPickSession:$=>{ve(null),Ct(!1),sn(!1),zn(!1),Rs(!1),Vn(!1),Re(""),ah($)},onDeleteSession:U5,userInfo:_e,version:os,onLogout:M5}),(()=>{const $=l.jsxs("div",{className:`composer-slot${p?" sandbox-composer-wrap":""}`,children:[p&&l.jsx(eye,{onExit:cl}),l.jsx(hpe,{sessionId:p?p.id:a,sessionInitializing:!p&&u,appName:n,agentName:p?"AgentKit 沙箱":n?I0(n):"Agent",value:T,onChange:L,onSubmit:()=>{if(!p&&R==="skill-create"){const Me=T.trim();if(!Me||ie)return;const Se={id:`pending-${Date.now()}`,prompt:Me,status:"provisioning",candidates:Gv.map((Ge,De)=>({id:`pending-${De}`,model:Ge,modelLabel:Ge,status:"queued",stage:"provisioning",files:[],activities:[{id:"provisioning",kind:"status",text:"正在拉起 Sandbox",status:"running"}]}))};G(!0);const je=++re.current;Re(""),P(Se),L(""),C0e(Me,Ge=>{re.current===je&&P(Ge)}).then(Ge=>{re.current===je&&P(Ge)}).catch(Ge=>{re.current===je&&(P(null),L(Me),Re(Ge instanceof Error?Ge.message:String(Ge)))}).finally(()=>{re.current===je&&G(!1)});return}const K=T;if(L(""),p){F5(K);return}const ae=ue,ge=le;ee([]),ne(Di()),k_(K,ae,ge),Cb(ae)},disabled:p?!1:!Z||R==="temporary"||R==="agent"&&!n,busy:p?g:R==="skill-create"?ie:xr,showMeta:M.length>0&&!p,attachments:p?[]:ue,skills:p?[]:Qf,agents:p?[]:Zf,invocation:p?Di():le,capabilitiesLoading:!p&&te,allowAttachments:!p,onInvocationChange:ne,onAddFiles:$5,onRemoveAttachment:Jf,newChatMode:p?"agent":R,newChatLayout:!p&&M.length===0&&W===null,showModeSelector:!p&&M.length===0&&W===null,temporaryEnabled:I.temporaryEnabled,skillCreateEnabled:I.skillCreateEnabled,onModeChange:K=>{if(!(K==="temporary"&&!I.temporaryEnabled||K==="skill-create"&&!I.skillCreateEnabled)){if(K==="temporary"){F(K),D5();return}if(F(K),Re(""),K==="skill-create"){ne(Di());const ae=a&&X.length===0&&ue.length>0?a:"";rl(ue),ee([]),ae&&(ze.current="",o(""),il(ae))}}}})]});return l.jsxs("section",{className:"main-shell",children:[l.jsx(fV,{appName:n,onAppChange:A_,agentLabel:I0,agentsSource:Ft,localApps:e,currentRuntime:O0,runtimeScope:Ve.capabilities.runtimeScope,title:oh?"添加 Agent":lh?"添加 AgentKit 智能体":C0?"智能体":void 0,titleLeading:M.length>0&&!p&&R==="agent"&&!oh&&!lh&&!In&&!x0&&!C0&&Ls===null&&n?l.jsx("button",{ref:xt,type:"button",className:"agent-info-trigger","aria-label":"查看 Agent 信息",title:"Agent 信息","aria-expanded":Xe,onClick:()=>ft(!0),children:l.jsx(wc,{})}):void 0,crumbs:In?[{label:"技能中心"},{label:"AgentKit Skill 空间"}]:x0||lh||oh||!Ls?void 0:Ls==="menu"?[{label:wye,onClick:()=>{ve(null),wr(null),zn(!0)}},{label:"从 0 快速创建"}]:[{label:"从 0 快速创建",onClick:()=>nh(!0)},{label:vye[Ls]}],rightContent:l.jsxs(l.Fragment,{children:[Ve.role==="admin"&&l.jsx(w0e,{}),l.jsx(Dye,{tasks:si?Qe:[],onCancel:pn})]})}),l.jsxs("main",{className:`main${p?" is-sandbox-session":""}`,children:[Tt&&l.jsx("div",{className:"error",children:Tt}),En&&l.jsxs("div",{className:"session-loading",children:[l.jsx(Rt,{className:"icon spin"})," 加载会话…"]}),C0?l.jsx(_he,{agents:V5,drafts:h_,agentOrder:p_,selectedAgentId:n,agentInfo:me,agentInfoAgentId:n,loadingAgentInfo:te,canCreate:si,canUpdate:si||N_,loadingAgents:g5,agentsError:y5,deploymentTasks:Qe,focusedDeploymentTaskId:E5,focusedAgentId:x5,onRetryAgents:()=>void E_(),onAgentOrderChange:k5,onDeleteAgents:N5,onDeleteDrafts:_5,onSelectAgent:A_,onCreateAgent:()=>{if(!si){Re("当前账号没有添加 Agent 的权限。");return}Vn(!1),zn(!0),ve(null),wr(null),ri(null),Os(""),us.current=null,Ai(""),Ci(""),Re("")},onUpdateAgent:K=>{if(!N_&&!si){Re("当前账号没有管理 Agent 的权限。");return}if(!(Yr!=null&&Yr.runtimeId)){Re("仅支持更新已部署的云端智能体。");return}Vn(!1),wr(K);const ae=`runtime-${Yr.runtimeId}`;Os(ae),us.current=h_.find(ge=>ge.id===ae)??null,Ai(""),Ci(""),ri({runtimeId:Yr.runtimeId,name:Yr.name,region:Yr.region??"cn-beijing",currentVersion:Yr.currentVersion}),ve("custom"),Re("")},onEditDraft:K=>{Vn(!1),wr(K.draft),Os(K.id),us.current=K,ri(K.deploymentTarget??null),Ai(""),Ci(""),ve("custom"),Re("")}}):oh?l.jsx(q4,{title:"您想以哪种方式添加 Agent 来运行?",sub:"选择最适合你的方式,下一步即可开始",cards:[{key:"scratch",icon:Tye,title:"从 0 快速创建",desc:"用智能 / 自定义 / 模板 / 工作流的方式从零创建一个 Agent。",onClick:()=>{zn(!1),wr(null),ve("menu")}},{key:"package",icon:vH,title:"从代码包添加和部署",desc:"上传 Agent 项目压缩包,查看代码并直接部署到 AgentKit Runtime。",onClick:()=>{zn(!1),wr(null),ve("package")}}]}):x0?l.jsx(Vz,{userId:Z,appId:n,agentInfo:me,capabilitiesLoading:te,agentLabel:I0,onOpenSession:j5}):lh?l.jsx(fre,{onAdded:K=>{al(ps()),sn(!1),r(K)},onCancel:()=>sn(!1)}):In?l.jsx(dre,{}):Ls!==null&&!Mn?l.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:12,height:"100%",padding:24,textAlign:"center",color:"var(--text-secondary, #6b7280)"},children:[l.jsx("div",{style:{fontSize:18,fontWeight:600},children:"需要配置火山引擎 AK/SK"}),l.jsxs("div",{style:{maxWidth:420,lineHeight:1.6},children:["智能体工作台需要 Volcengine 凭据才能使用。请在运行环境中设置"," ",l.jsx("code",{children:"VOLCENGINE_ACCESS_KEY"})," 与"," ",l.jsx("code",{children:"VOLCENGINE_SECRET_KEY"})," 后重试。"]})]}):Ls==="menu"?l.jsx(Mme,{onSelect:K=>{wr(null),ri(null),Ai(""),Ci(""),Os(K==="custom"?`draft-${Date.now().toString(36)}`:""),us.current=null,ve(K)},onImport:K=>{wr(K),ri(null),Ai(""),Ci(""),Os(`draft-${Date.now().toString(36)}`),us.current=null,ve("custom")}}):Ls==="intelligent"?l.jsx(ige,{userId:Z,onBack:()=>ve("menu"),onCreate:sh,onAgentAdded:S0,onDeploymentTaskChange:rn}):Ls==="custom"?l.jsx(qge,{initialDraft:p5??void 0,onBack:()=>ve("menu"),onCreate:sh,onAgentAdded:S0,features:ut,onDeploymentTaskChange:rn,deploymentTarget:ol??void 0,onDraftChange:(K,ae)=>{Lr&&(ae?v5(Lr,K,ol??void 0):b_(Lr))},onDiscard:Lr?()=>{b_(Lr),Os(""),us.current=null,wr(null),ri(null),Ai(""),Ci(n),ve(null),zn(!1),Vn(!0),Re("")}:void 0,onDeploymentStarted:S5,onDeploymentComplete:T5},Lr||"custom"):Ls==="template"?l.jsx(Zge,{onBack:()=>ve("menu"),onCreate:sh}):Ls==="workflow"?l.jsx(a0e,{onBack:()=>ve("menu"),onCreate:sh}):Ls==="package"?l.jsx(d0e,{onBack:()=>{ve(null),zn(!0)},onAgentAdded:S0,onDeploymentTaskChange:rn}):M.length===0&&W?l.jsx(V0e,{initialJob:W}):M.length===0?l.jsxs("div",{className:"welcome",children:[l.jsx(ta,{as:"h1",className:"welcome-title",duration:4.8,spread:22,children:p?"让灵感在临时空间里自由生长":R==="skill-create"?"想创建一个什么 Skill?":fe}),$]}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:`transcript${qa?" is-streaming":""}`,ref:ou,onScroll:A5,onWheel:C5,onTouchMove:I5,children:M.map((K,ae)=>{var mn,Ii,Oi,ii,jn;const ge=ae===M.length-1;if(K.role==="user"){const ds=K.blocks.map(er=>er.kind==="text"?er.text:"").join(""),ai=K.blocks.flatMap(er=>er.kind==="attachment"?er.files:[]),Ri=K.blocks.find(er=>er.kind==="invocation");return l.jsxs($t.div,{className:"turn turn--user",initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[(Ri==null?void 0:Ri.kind)==="invocation"&&l.jsx(Vv,{value:Ri.value}),ai.length>0&&l.jsx(Yv,{appName:n,items:ai}),ds&&l.jsx("div",{className:"bubble",children:l.jsx(jf,{text:ds})}),l.jsxs("div",{className:"turn-actions turn-actions--right",children:[((mn=K.meta)==null?void 0:mn.ts)&&l.jsx("span",{className:"meta-text",children:h5(K.meta.ts)}),l.jsx(_C,{text:ds})]})]},ae)}const Me=((Ii=K.meta)==null?void 0:Ii.author)??"",Se=Me&&Hn?ex(Hn,Me):void 0,je=!!(Me&&Za.length>0&&!Za.includes(Me)),Ge=(Se==null?void 0:Se.name)||Me,De=(Se==null?void 0:Se.description)||(je?"正在执行主 Agent 移交的任务。":"");if(K.blocks.length>0&&K.blocks.every(ds=>ds.kind==="agent-transfer"))return null;const At=K.blocks.length===0,Ze=((ii=(Oi=K.meta)==null?void 0:Oi.feedback)==null?void 0:ii.rating)??null,ht=((jn=K.meta)==null?void 0:jn.eventId)??"",an=kt.has(ht),Wr=!!(O0&&ht&&vC(K));return l.jsxs($t.div,{className:`turn turn--assistant${je?" turn--subagent":""}`,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[je&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"subagent-run-label",children:[l.jsxs("span",{className:"subagent-run-handoff",children:[l.jsx(bH,{}),l.jsx("span",{children:"智能体移交"})]}),l.jsx("span",{className:"subagent-run-title",children:Ge})]}),l.jsx("p",{className:"subagent-run-description",title:De,children:De})]}),At?ge&&Kr?l.jsx(W4,{}):null:l.jsxs(l.Fragment,{children:[l.jsx(Wv,{appName:n,blocks:K.blocks,streaming:ge&&(Kr||Rr),onStreamFrame:ge?O5:void 0,onAction:H5,onAuth:z5}),!(ge&&Kr)&&!Oye(K)&&l.jsx("div",{className:"turn-empty",children:"本次没有返回可显示的内容。"}),!(ge&&Kr)&&!Rye(K)&&l.jsxs("div",{className:"turn-meta",children:[l.jsxs("div",{className:"turn-actions",children:[Wr&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:`icon-btn feedback-btn${Ze==="good"?" feedback-btn--good":""}`,"aria-label":"赞","aria-pressed":Ze==="good","aria-busy":an,title:Ze==="good"?"取消点赞":"赞",disabled:an,onClick:()=>void T_(K,Ze==="good"?null:"good"),children:l.jsx(tye,{className:"icon",filled:Ze==="good"})}),l.jsx("button",{type:"button",className:`icon-btn feedback-btn${Ze==="bad"?" feedback-btn--bad":""}`,"aria-label":"踩","aria-pressed":Ze==="bad","aria-busy":an,title:Ze==="bad"?"取消点踩":"踩",disabled:an,onClick:()=>void T_(K,Ze==="bad"?null:"bad"),children:l.jsx(nye,{className:"icon",filled:Ze==="bad"})})]}),!p&&l.jsx("button",{className:"icon-btn",title:"Tracing 火焰图",onClick:()=>bn(!0),children:l.jsx(Aye,{})}),l.jsx(_C,{text:vC(K)})]}),K.meta&&l.jsx("span",{className:"meta-text",children:Cye(K.meta)})]})]})]},ae)})}),!p&&l.jsx(LM,{appName:n,info:me,loading:te,activeAgent:Xa,seenAgents:Qa,execPath:Si,capabilities:Ee,capabilityLoading:Ke,capabilityMutating:Ue,builtinTools:it,onAddCapability:v_,onRemoveCapability:K=>void __(K)}),l.jsx("div",{className:"conversation-composer-slot",children:$})]})]})]})})(),Bt&&a&&l.jsx(aye,{appName:n,sessionId:a,onClose:()=>bn(!1)}),Xe&&M.length>0&&l.jsx(IV,{appName:n,info:me,loading:te,activeAgent:Xa,seenAgents:Qa,execPath:Si,capabilities:Ee,capabilityLoading:Ke,capabilityMutating:Ue,builtinTools:it,onAddCapability:v_,onRemoveCapability:$=>void __($),onClose:vt,returnFocusRef:xt}),l.jsx(J0e,{open:b,state:k,error:C,onCancel:P5,onConfirm:()=>void B5()}),l.jsx(cye,{open:fn,checking:J,error:Le,onLogin:()=>void R5()}),w5&&l.jsx("div",{className:"confirm-scrim",onClick:()=>nh(!1),children:l.jsxs("div",{className:"confirm-box",onClick:$=>$.stopPropagation(),children:[l.jsx("div",{className:"confirm-title",children:"返回创建首页?"}),l.jsx("div",{className:"confirm-text",children:"返回后当前填写的内容将会丢失,确定要返回吗?"}),l.jsxs("div",{className:"confirm-actions",children:[l.jsx("button",{className:"confirm-btn",onClick:()=>nh(!1),children:"取消"}),l.jsx("button",{className:"confirm-btn confirm-btn--danger",onClick:()=>{wr(null),ve("menu"),nh(!1)},children:"确定返回"})]})]})})]})}(()=>{if(!(window.opener&&window.opener!==window&&/[?&](code|state|error)=/.test(window.location.search)))return!1;try{window.opener.postMessage({veadkOAuth:!0,url:window.location.href},window.location.origin)}catch{}return window.close(),!0})()||Ib.createRoot(document.getElementById("root")).render(l.jsx(dt.StrictMode,{children:l.jsx(CF,{reducedMotion:"user",children:l.jsx(lH,{maskOpacity:.9,children:l.jsx(Fye,{})})})}));export{w as A,Fg as B,ts as C,Vye as D,ud as E,Uo as F,v3 as G,$ye as R,yr as V,dt as a,Nc as b,bT as c,Kye as d,Xw as e,PW as f,Zd as g,_t as h,eX as i,oX as j,FW as k,mf as l,oQ as m,Hq as n,zq as o,mQ as p,jX as q,DX as r,L3 as s,l as t,qe as u,Dt as v,yt as w,zye as x,Zq as y,Ss as z}; +`)),m("copied")}catch{m("error")}},U=()=>{var j;h(!1),m("idle"),c(""),d(x.current||((j=N[0])==null?void 0:j.version)||""),s("confirm")};return l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",className:`studio-update-trigger is-${r}`,title:r==="submitting"?"正在更新 Studio":r==="published"?"Studio 已更新":`更新 Studio 至 ${t.latestVersion}`,onClick:()=>{var j;r==="published"?window.location.reload():(r==="submitting"||r==="error"||(d(((j=N[0])==null?void 0:j.version)||t.latestVersion),s("confirm")),a(!0))},children:[l.jsx(fC,{className:"studio-update-icon"}),r==="submitting"?l.jsx(ta,{as:"span",children:"正在更新"}):r==="published"?l.jsx("span",{children:"刷新使用新版"}):r==="error"?l.jsx("span",{children:"更新失败"}):l.jsx("span",{children:"有新版更新"})]}),i&&r!=="idle"&&l.jsx("div",{className:"confirm-scrim",role:"presentation",children:l.jsxs("section",{className:"confirm-box studio-update-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"studio-update-title",children:[l.jsx("div",{className:"studio-update-dialog-mark",children:l.jsx(fC,{})}),l.jsx("div",{id:"studio-update-title",className:"confirm-title",children:r==="error"?"Studio 更新失败":r==="submitting"?"正在更新 Studio":r==="published"?"Studio 更新完成":"发现新版本"}),r==="error"?l.jsxs("div",{className:"studio-update-error-panel",children:[l.jsx("p",{className:"confirm-text studio-update-error",children:o}),l.jsxs("dl",{className:"studio-update-error-meta",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"失败阶段"}),l.jsx("dd",{children:p0e[t.errorStage]||t.errorStage||"未知阶段"})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"错误 ID"}),l.jsx("dd",{children:t.errorId||"未生成"})]})]}),l.jsx(hC,{lines:O,phase:"error",copyState:p,onCopy:()=>void D()}),t.consoleUrl&&l.jsxs("a",{className:"studio-update-console-link",href:t.consoleUrl,target:"_blank",rel:"noreferrer",children:["前往 VeFaaS 控制台查看 Function 日志",l.jsx("span",{"aria-hidden":!0,children:"↗"})]})]}):r==="submitting"||r==="published"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"studio-update-progress-summary",children:[l.jsxs("div",{children:[l.jsx("span",{children:"目标版本"}),l.jsx("strong",{children:x.current||C})]}),l.jsxs("div",{children:[l.jsx("span",{children:r==="published"?"更新状态":"已用时"}),l.jsx("strong",{children:r==="published"?"已完成":m0e(y)})]})]}),l.jsx("ol",{className:"studio-update-progress","aria-label":"Studio 更新进度",children:dC.map((j,T)=>{const L=dC.findIndex(I=>I.id===t.progressStage),R=r==="published"||Tvoid D()}),l.jsx("p",{className:"studio-update-progress-note",children:"发布阶段会短暂中断连接;关闭此窗口不会停止更新,可随时点击右上角按钮重新查看。"})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"confirm-text",children:"更新会重启 Studio 服务,预计约 3–5 分钟完成更新与发布。期间正在进行的对话、 流式响应或部署任务可能中断,登录态不会受到影响。"}),l.jsxs("div",{className:"studio-update-field",ref:g,children:[l.jsx("span",{children:"选择版本"}),l.jsxs("button",{type:"button",className:"studio-update-version-trigger","aria-label":"选择版本","aria-haspopup":"listbox","aria-expanded":f,onClick:()=>h(j=>!j),onKeyDown:j=>{(j.key==="ArrowDown"||j.key==="ArrowUp")&&(j.preventDefault(),h(!0))},children:[l.jsx("span",{children:C}),l.jsx(b0e,{})]}),f&&l.jsx("div",{className:"studio-update-version-menu",role:"listbox","aria-label":"选择版本",children:N.map(j=>{const T=j.version===C;return l.jsxs("button",{type:"button",role:"option","aria-selected":T,className:`studio-update-version-option${T?" is-selected":""}`,onClick:()=>{d(j.version),h(!1)},children:[l.jsx("span",{children:j.version}),T&&l.jsx(E0e,{})]},j.version)})})]}),l.jsxs("dl",{className:"studio-update-versions",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"当前版本"}),l.jsx("dd",{children:t.currentVersion})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"目标版本"}),l.jsx("dd",{children:C})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"Commit"}),l.jsx("dd",{children:((S==null?void 0:S.gitSha)||t.latestGitSha).slice(0,8)})]})]}),l.jsxs("section",{className:"studio-update-changelog","aria-labelledby":"studio-update-changelog-title",children:[l.jsx("div",{id:"studio-update-changelog-title",children:"更新内容"}),S!=null&&S.changelog.length?l.jsx("ul",{children:S.changelog.map(j=>l.jsx("li",{children:j},j))}):l.jsx("p",{children:"暂无更新说明"})]})]}),l.jsxs("div",{className:"confirm-actions",children:[l.jsx("button",{type:"button",className:"confirm-btn",onClick:()=>{a(!1),h(!1),r==="confirm"&&(s("idle"),c(""))},children:r==="submitting"?"后台运行":r==="confirm"?"取消":"关闭"}),r==="confirm"&&l.jsx("button",{type:"button",className:"confirm-btn studio-update-confirm",onClick:()=>void A(),children:"立即更新"}),r==="error"&&l.jsx("button",{type:"button",className:"confirm-btn studio-update-confirm",onClick:U,children:"重新尝试"})]})]})})]})}const w0e="/web/skill-creator";class c_ extends Error{constructor(n,r){super(n);M_(this,"status");this.name="SkillCreatorApiError",this.status=r}}function tl(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} 格式错误`);return e}function Zt(e,...t){for(const n of t){const r=e[n];if(typeof r=="string"&&r)return r}}function o5(e,...t){for(const n of t){const r=e[n];if(typeof r=="number"&&Number.isFinite(r))return r}}async function qf(e,t){return fetch(xi(`${w0e}${e}`),{...t,headers:Ig({Accept:"application/json",...t!=null&&t.body?{"Content-Type":"application/json"}:{},...t==null?void 0:t.headers})})}async function u_(e,t){if((e.headers.get("content-type")??"").includes("application/json")){const s=tl(await e.json(),"错误响应");return Zt(s,"detail","message","error")??t}return(await e.text()).trim()||t}async function d_(e,t){if(!e.ok)throw new c_(await u_(e,t),e.status);if(!(e.headers.get("content-type")??"").includes("application/json"))throw new Error(`${t}:服务端返回了非 JSON 响应`);return e.json()}function v0e(e){if(e==="queued")return"queued";if(e==="running")return"running";if(e==="succeeded")return"succeeded";if(e==="failed")return"failed";throw new Error(`未知的 Skill 生成状态:${String(e)}`)}function _0e(e){if(e==="provisioning"||e==="generating"||e==="validating"||e==="packaging"||e==="completed"||e==="failed")return e;throw new Error(`未知的 Skill 生成阶段:${String(e)}`)}function k0e(e){return Array.isArray(e)?e.map((t,n)=>{const r=tl(t,`文件 ${n+1}`),s=Zt(r,"path");if(!s)throw new Error(`文件 ${n+1} 缺少 path`);const i=o5(r,"size");if(i===void 0)throw new Error(`文件 ${n+1} 缺少 size`);return{path:s,size:i}}):[]}function N0e(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t=e,n=Array.isArray(t.errors)?t.errors.map(String):[],r=Array.isArray(t.warnings)?t.warnings.map(String):[];return{valid:typeof t.valid=="boolean"?t.valid:n.length===0,errors:n,warnings:r}}function S0e(e){if(e===void 0)return[];if(!Array.isArray(e))throw new Error("Skill 生成活动记录格式错误");return e.map((t,n)=>{const r=tl(t,`活动 ${n+1}`),s=Zt(r,"id"),i=Zt(r,"kind"),a=Zt(r,"status");if(!s||!i||!["status","thinking","tool","message"].includes(i))throw new Error(`活动 ${n+1} 格式错误`);if(a!=="running"&&a!=="done")throw new Error(`活动 ${n+1} 状态错误`);if(i==="tool"){const c=Zt(r,"name");if(!c)throw new Error(`活动 ${n+1} 缺少工具名称`);return{id:s,kind:i,name:c,args:r.input,response:r.output,status:a}}const o=Zt(r,"text");if(!o)throw new Error(`活动 ${n+1} 缺少文本`);return{id:s,kind:i,text:o,status:a}})}function T0e(e,t){const n=tl(e,`候选方案 ${t+1}`),r=Zt(n,"id","candidate_id","candidateId"),s=Zt(n,"model","model_id","modelId");if(!r||!s)throw new Error(`候选方案 ${t+1} 缺少 id 或 model`);return{id:r,model:s,modelLabel:Zt(n,"modelLabel","model_label")??s,status:v0e(n.status),stage:_0e(n.stage),name:Zt(n,"name","skill_name","skillName"),description:Zt(n,"description"),skillMd:Zt(n,"skillMd","skill_md"),files:k0e(n.files),activities:S0e(n.activities),validation:N0e(n.validation),durationMs:o5(n,"elapsedMs","elapsed_ms"),error:Zt(n,"error","error_message","errorMessage"),published:n.published===!0,skillId:Zt(n,"skill_id","skillId"),version:Zt(n,"version")}}function QE(e,t=""){const n=tl(e,"Skill 创建任务"),r=Zt(n,"id","job_id","jobId");if(!r)throw new Error("Skill 创建任务缺少 id");const s=Array.isArray(n.candidates)?n.candidates.map(T0e):[],i=Zt(n,"status")??"running";if(i!=="provisioning"&&i!=="running"&&i!=="completed")throw new Error(`未知的 Skill 任务状态:${i}`);return{id:r,prompt:Zt(n,"prompt")??t,status:i,candidates:s}}async function A0e(e,t){const n=await qf("/jobs",{method:"POST",body:JSON.stringify({prompt:e})});if(!n.ok)throw new c_(await u_(n,"创建 Skill 任务失败"),n.status);const r=n.headers.get("content-type")??"";if(r.includes("application/json")){const u=QE(await n.json(),e);return t==null||t(u),u}if(!r.includes("application/x-ndjson")||!n.body)throw new Error("创建 Skill 任务失败:服务端返回了非流式响应");const s=n.body.getReader(),i=new TextDecoder;let a="",o;const c=u=>{if(!u.trim())return;const d=tl(JSON.parse(u),"Skill 创建进度");if(d.type==="error")throw new Error(Zt(d,"error")??"创建 Skill 任务失败");if(d.type!=="progress"&&d.type!=="complete")throw new Error("未知的 Skill 创建进度事件");o=QE(d.job,e),t==null||t(o)};for(;;){const{done:u,value:d}=await s.read();a+=i.decode(d,{stream:!u});const f=a.split(` +`);if(a=f.pop()??"",f.forEach(c),u)break}if(c(a),!o)throw new Error("创建 Skill 任务失败:服务端未返回任务");return o}async function C0e(e){const t=await qf(`/jobs/${encodeURIComponent(e)}`);return QE(await d_(t,"读取 Skill 任务失败"))}async function I0e(e){const t=await qf(`/jobs/${encodeURIComponent(e)}`,{method:"DELETE"});await d_(t,"清理 Skill 任务失败")}async function O0e(e,t){var o;const n=await qf(`/jobs/${encodeURIComponent(e)}/candidates/${encodeURIComponent(t)}/download`);if(!n.ok)throw new Error(await u_(n,"下载 Skill 失败"));const s=((o=(n.headers.get("content-disposition")??"").match(/filename="([^"]+)"/))==null?void 0:o[1])??"skill.zip",i=URL.createObjectURL(await n.blob()),a=document.createElement("a");a.href=i,a.download=s,a.click(),URL.revokeObjectURL(i)}async function R0e(e,t,n){const r=await qf(`/jobs/${encodeURIComponent(e)}/candidates/${encodeURIComponent(t)}/publish`,{method:"POST",body:JSON.stringify(n)}),s=tl(await d_(r,"添加到 AgentKit 失败"),"发布结果"),i=Zt(s,"skill_id","skillId","id");if(!i)throw new Error("发布结果缺少 skill_id");return{skillId:i,name:Zt(s,"name"),version:Zt(s,"version"),skillSpaceIds:Array.isArray(s.skillSpaceIds)?s.skillSpaceIds.map(String):Array.isArray(s.skill_space_ids)?s.skill_space_ids.map(String):[],message:Zt(s,"message")}}const L0e=()=>{};function M0e(e){if(e.kind==="message")return{kind:"text",text:e.text};if(e.kind==="thinking")return{kind:"thinking",text:e.text,done:e.status==="done"};if(e.kind==="tool")return{kind:"tool",name:e.name,args:e.args,response:e.response,done:e.status==="done"};throw new Error("不支持的 Skill 对话活动")}function j0e({activities:e}){const t=w.useMemo(()=>e.filter(n=>n.kind!=="status").map(M0e),[e]);return t.length===0?null:l.jsx("div",{className:"skill-conversation","aria-label":"Skill 生成对话","aria-live":"polite",children:l.jsx(Yv,{blocks:t,onAction:L0e})})}const pC={provisioning:"正在准备 Sandbox",generating:"正在生成 Skill",validating:"正在校验结构",packaging:"正在打包",completed:"生成完成",failed:"生成失败"},mC=12e4;function D0e({status:e}){return e==="succeeded"?l.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[l.jsx("circle",{cx:"10",cy:"10",r:"7"}),l.jsx("path",{d:"m6.7 10.1 2.1 2.2 4.6-4.8"})]}):e==="failed"?l.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[l.jsx("circle",{cx:"10",cy:"10",r:"7"}),l.jsx("path",{d:"M10 6.2v4.5M10 13.6h.01"})]}):l.jsxs("svg",{className:"skill-candidate__spinner",viewBox:"0 0 20 20","aria-hidden":"true",children:[l.jsx("circle",{cx:"10",cy:"10",r:"7"}),l.jsx("path",{d:"M10 3a7 7 0 0 1 7 7"})]})}function P0e(){return l.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[l.jsx("path",{d:"M4.2 3.5h7.1l4.5 4.6v8.4H4.2z"}),l.jsx("path",{d:"M11.3 3.5v4.6h4.5M7 11h6M7 13.8h4.2"})]})}function B0e(){return l.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:l.jsx("path",{d:"m9 5-5 5 5 5M4.5 10H16"})})}function F0e({candidate:e}){var c,u;const[t,n]=w.useState("SKILL.md"),r=e.files.find(d=>d.path.endsWith("SKILL.md")),s=e.skillMd&&!r?[{path:"SKILL.md",size:new Blob([e.skillMd]).size},...e.files]:e.files,i=s.find(d=>d.path===t)??s[0],a=(c=e.skillMd)==null?void 0:c.slice(0,mC),o=(((u=e.skillMd)==null?void 0:u.length)??0)>mC;return s.length===0?null:l.jsxs("div",{className:"skill-files",children:[l.jsx("div",{className:"skill-files__tabs",role:"tablist","aria-label":`${e.name??"Skill"} 文件`,children:s.map(d=>l.jsx("button",{type:"button",role:"tab","aria-selected":(i==null?void 0:i.path)===d.path,className:(i==null?void 0:i.path)===d.path?"is-active":"",onClick:()=>n(d.path),children:d.path},d.path))}),e.skillMd&&(i!=null&&i.path.endsWith("SKILL.md"))?l.jsxs(l.Fragment,{children:[l.jsx("pre",{className:"skill-files__content",children:l.jsx("code",{children:a})}),o?l.jsx("p",{className:"skill-files__truncated",children:"预览内容较长,完整文件请下载 ZIP 查看。"}):null]}):l.jsx("div",{className:"skill-files__unavailable",children:i?`${i.path} · ${i.size.toLocaleString()} bytes`:"文件内容将在下载包中提供"})]})}function U0e({label:e,jobId:t,candidate:n,selected:r,publishing:s,publishDisabled:i,publishError:a,onSelect:o,onPublish:c}){const[u,d]=w.useState("conversation"),[f,h]=w.useState(!1),[p,m]=w.useState(!1),[y,E]=w.useState(""),[g,x]=w.useState(""),[b,_]=w.useState(""),[k,N]=w.useState(""),C=w.useRef(null),S=w.useRef(null),A=n.status==="queued"||n.status==="running",O=n.status==="succeeded",D=n.validation;return l.jsxs("article",{className:`skill-candidate skill-candidate--${n.status}${r?" is-selected":""}`,"aria-label":`${e} ${n.model}`,children:[l.jsxs("header",{className:"skill-candidate__header",children:[l.jsx("h2",{children:n.model}),r?l.jsx("span",{className:"skill-candidate__selected",children:"已选方案"}):null]}),u==="conversation"?l.jsxs("div",{className:"skill-candidate__view skill-candidate__view--conversation",children:[l.jsxs("div",{className:"skill-candidate__status","aria-live":"polite",children:[l.jsx("span",{className:"skill-candidate__status-icon",children:l.jsx(D0e,{status:n.status})}),A?l.jsx(ta,{duration:2.2,spread:16,children:pC[n.stage]}):l.jsx("span",{children:pC[n.stage]}),n.durationMs!==void 0&&O?l.jsxs("span",{className:"skill-candidate__duration",children:[(n.durationMs/1e3).toFixed(1)," 秒"]}):null]}),l.jsx(j0e,{activities:n.activities}),n.error?l.jsx("div",{className:"skill-candidate__error",children:n.error}):null,O?l.jsx("div",{className:"skill-candidate__view-actions",children:l.jsxs("button",{ref:C,type:"button",className:"skill-action skill-action--preview",onClick:()=>{d("preview"),requestAnimationFrame(()=>{var U;return(U=S.current)==null?void 0:U.focus()})},children:[l.jsx(P0e,{}),"查看 Skill"]})}):null]}):l.jsxs("div",{className:"skill-candidate__view skill-candidate__view--preview",children:[l.jsx("div",{className:"skill-candidate__preview-nav",children:l.jsxs("button",{ref:S,type:"button",className:"skill-candidate__back",onClick:()=>{d("conversation"),requestAnimationFrame(()=>{var U;return(U=C.current)==null?void 0:U.focus()})},children:[l.jsx(B0e,{}),"返回对话"]})}),l.jsxs("div",{className:"skill-candidate__result",children:[l.jsxs("div",{className:"skill-candidate__summary",children:[l.jsxs("div",{children:[l.jsx("span",{children:"Skill"}),l.jsx("strong",{children:n.name??"未命名 Skill"})]}),l.jsxs("div",{children:[l.jsx("span",{children:"文件"}),l.jsx("strong",{children:n.files.length})]}),l.jsxs("div",{children:[l.jsx("span",{children:"校验"}),l.jsx("strong",{className:(D==null?void 0:D.valid)===!1?"is-invalid":"is-valid",children:(D==null?void 0:D.valid)===!1?"未通过":"已通过"})]})]}),n.description?l.jsx("p",{className:"skill-candidate__description",children:n.description}):null,D&&(D.errors.length>0||D.warnings.length>0)?l.jsxs("details",{className:"skill-validation",children:[l.jsx("summary",{children:"查看校验详情"}),[...D.errors,...D.warnings].map((U,X)=>l.jsx("div",{children:U},`${U}-${X}`))]}):null,l.jsx(F0e,{candidate:n}),l.jsxs("div",{className:"skill-candidate__actions",children:[l.jsx("button",{type:"button",className:"skill-action skill-action--select","aria-pressed":r,onClick:o,children:r?"已采用此方案":"采用此方案"}),l.jsx("button",{type:"button",className:"skill-action",disabled:p,onClick:()=>{m(!0),E(""),O0e(t,n.id).catch(U=>{E(U instanceof Error?U.message:String(U))}).finally(()=>m(!1))},children:p?"正在下载…":"下载 ZIP"}),l.jsx("button",{type:"button",className:"skill-action",disabled:!r||s||i||n.published,title:r?void 0:"请先采用此方案",onClick:()=>h(U=>!U),children:n.published?"已添加到 AgentKit":s?"正在添加…":"添加到 AgentKit"})]}),y?l.jsx("div",{className:"skill-candidate__error",children:y}):null,f&&r&&!n.published?l.jsxs("form",{className:"skill-publish-form",onSubmit:U=>{U.preventDefault();const X=g.split(",").map(M=>M.trim()).filter(Boolean);c({skillSpaceIds:X,...b.trim()?{projectName:b.trim()}:{},...k.trim()?{skillId:k.trim()}:{}})},children:[l.jsxs("label",{children:[l.jsx("span",{children:"SkillSpace ID(可选)"}),l.jsx("input",{value:g,onChange:U=>x(U.target.value),placeholder:"多个 ID 用英文逗号分隔"})]}),l.jsxs("div",{className:"skill-publish-form__optional",children:[l.jsxs("label",{children:[l.jsx("span",{children:"项目名称(可选)"}),l.jsx("input",{value:b,onChange:U=>_(U.target.value)})]}),l.jsxs("label",{children:[l.jsx("span",{children:"已有 Skill ID(可选)"}),l.jsx("input",{value:k,onChange:U=>N(U.target.value)})]})]}),l.jsx("button",{type:"submit",className:"skill-action skill-action--select",disabled:s,children:s?"正在添加…":"确认添加"})]}):null,a?l.jsx("div",{className:"skill-candidate__error",children:a}):null]})]})]})}const gC=new Set(["completed"]),ap=1100,$0e=3e4;function H0e(e,t){return{id:`pending-${t}`,model:e,modelLabel:e,status:"queued",stage:"provisioning",files:[],activities:[{id:"provisioning",kind:"status",text:"正在拉起 Sandbox",status:"running"}]}}function z0e({initialJob:e}){const[t,n]=w.useState(e),[r,s]=w.useState(""),[i,a]=w.useState(!1),[o,c]=w.useState(),[u,d]=w.useState(),[f,h]=w.useState(()=>new Set),[p,m]=w.useState({});w.useEffect(()=>{n(e),s(""),a(!1)},[e]),w.useEffect(()=>{if(gC.has(e.status)||e.id.startsWith("pending-"))return;let g=!1,x;const b=Date.now()+$0e,_=async()=>{try{const k=await C0e(e.id);g||(n({...k,prompt:k.prompt||e.prompt}),s(""),gC.has(k.status)||(x=window.setTimeout(_,ap)))}catch(k){if(!g){const N=k instanceof c_?k:void 0;if((N==null?void 0:N.status)===404&&Date.now(){g=!0,x!==void 0&&window.clearTimeout(x)}},[e.id,e.status]);const y=Wv.map((g,x)=>t.candidates.find(b=>b.model===g)??t.candidates[x]??H0e(g,x));async function E(g,x){d(g.id),m(b=>({...b,[g.id]:""}));try{await R0e(t.id,g.id,x),h(b=>new Set(b).add(g.id))}catch(b){m(_=>({..._,[g.id]:b instanceof Error?b.message:String(b)}))}finally{d(void 0)}}return l.jsxs("section",{className:"skill-workspace",children:[l.jsx("header",{className:"skill-workspace__intro",children:l.jsx("h1",{children:"正在把需求变成可运行的 Skill"})}),r?l.jsxs("div",{className:"skill-workspace__poll-error",role:"alert",children:["状态刷新失败:",r,"。",i?"":"页面会继续重试。"]}):null,l.jsx("div",{className:"skill-workspace__grid",children:y.map((g,x)=>{const _=f.has(g.id)||g.published?{...g,published:!0}:g;return l.jsx(U0e,{label:`方案 ${x===0?"A":"B"}`,jobId:t.id,candidate:_,selected:o===g.id,publishing:u===g.id,publishDisabled:u!==void 0&&u!==g.id,publishError:p[g.id],onSelect:()=>c(g.id),onPublish:k=>void E(g,k)},`${g.model}-${g.id}`)})})]})}const vb="/web/sandbox/sessions",V0e=33e4,K0e=6e5,Y0e=15e3;function _b(e){const t=Ig(e);return t.set("Accept","application/json"),t}async function kb(e,t){let n={};try{n=await e.json()}catch{return new Error(`${t}(HTTP ${e.status})`)}const r=n.detail,s=r&&typeof r=="object"&&"message"in r?r.message:r??n.message;return new Error(typeof s=="string"&&s?s:t)}async function W0e(e,t){if(!e.body)throw new Error("沙箱对话服务未返回内容。");const n=e.body.getReader(),r=new TextDecoder;let s="",i="";const a=[],o=new Map;function c(){t==null||t(a.map(h=>({...h})))}function u(h){i+=h;const p=a[a.length-1];(p==null?void 0:p.kind)==="text"?p.text+=h:a.push({kind:"text",text:h}),c()}function d(h){if(typeof h.id!="string"||h.kind!=="thinking"&&h.kind!=="tool"||h.status!=="running"&&h.status!=="done")return;const p=h.status==="done";let m;if(h.kind==="thinking"){if(typeof h.text!="string"||!h.text)return;m={kind:"thinking",text:h.text,done:p}}else{if(typeof h.name!="string"||!h.name)return;m={kind:"tool",name:h.name,args:h.args,response:h.response,done:p}}const y=o.get(h.id);y===void 0?(o.set(h.id,a.length),a.push(m)):a[y]=m,c()}function f(h){let p="message";const m=[];for(const E of h.split(/\r?\n/))E.startsWith("event:")&&(p=E.slice(6).trim()),E.startsWith("data:")&&m.push(E.slice(5).trimStart());if(m.length===0)return;let y;try{y=JSON.parse(m.join(` +`))}catch{throw new Error("沙箱对话服务返回了无法解析的响应。")}if(p==="error")throw new Error(typeof y.message=="string"&&y.message?y.message:"沙箱对话失败,请稍后重试。");p==="activity"&&d(y),p==="delta"&&typeof y.text=="string"&&u(y.text),p==="done"&&!i&&typeof y.text=="string"&&u(y.text)}for(;;){const{done:h,value:p}=await n.read();s+=r.decode(p,{stream:!h});const m=s.split(/\r?\n\r?\n/);if(s=m.pop()??"",m.forEach(f),h)break}if(s.trim()&&f(s),a.length===0)throw new Error("沙箱未返回有效回复,请重试。");return{text:i,blocks:a}}const Nb={async startSession(e={}){const t=await fetch(xi(vb),{method:"POST",headers:_b({"Content-Type":"application/json"}),signal:Gs(e.signal,V0e)});if(!t.ok)throw await kb(t,"无法启动 AgentKit 沙箱,请稍后重试。");const n=await t.json();if(!n.sessionId||n.status!=="ready")throw new Error("AgentKit 沙箱返回了无效的会话信息。");return{id:n.sessionId,toolName:"codex",createdAt:new Date().toISOString()}},async sendMessage(e,t={}){if(!e.sessionId||!e.text.trim())throw new Error("内置智能体会话缺少有效的消息内容。");const n=await fetch(xi(`${vb}/${encodeURIComponent(e.sessionId)}/messages`),{method:"POST",headers:_b({Accept:"text/event-stream","Content-Type":"application/json"}),body:JSON.stringify({message:e.text}),signal:Gs(t.signal,K0e)});if(!n.ok)throw await kb(n,"沙箱对话失败,请稍后重试。");return W0e(n,t.onBlocks)},async closeSession(e,t={}){if(!e)return;const n=await fetch(xi(`${vb}/${encodeURIComponent(e)}`),{method:"DELETE",headers:_b(),signal:Gs(t.signal,Y0e)});if(!n.ok&&n.status!==404)throw await kb(n,"无法清理 AgentKit 沙箱会话。")}},G0e=1e4;async function l5(e){const t=await fetch(xi(e),{headers:Ig({Accept:"application/json"}),signal:Gs(void 0,G0e)});if(!t.ok)throw new Error(`读取会话模式能力失败(HTTP ${t.status})`);const n=await t.json();if(typeof n.enabled!="boolean")throw new Error("会话模式能力响应格式错误");return{enabled:n.enabled,reason:typeof n.reason=="string"?n.reason:void 0}}async function q0e(){return l5("/web/sandbox/capabilities")}async function X0e(){return l5("/web/skill-creator/capabilities")}function Q0e(e){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[l.jsx("path",{d:"M12 3.5c.35 3.05 1.62 5.32 4.9 6.1-3.28.78-4.55 3.05-4.9 6.1-.35-3.05-1.62-5.32-4.9-6.1 3.28-.78 4.55-3.05 4.9-6.1Z"}),l.jsx("path",{d:"M18.5 14.5c.18 1.55.84 2.7 2.5 3.1-1.66.4-2.32 1.55-2.5 3.1-.18-1.55-.84-2.7-2.5-3.1 1.66-.4 2.32-1.55 2.5-3.1Z"}),l.jsx("path",{d:"M5.3 14.2c.14 1.15.62 2 1.85 2.3-1.23.3-1.71 1.15-1.85 2.3-.14-1.15-.62-2-1.85-2.3 1.23-.3 1.71-1.15 1.85-2.3Z"})]})}function Z0e({open:e,state:t,error:n,onCancel:r,onConfirm:s}){const i=w.useRef(null),a=w.useRef(null);if(w.useEffect(()=>{var f;if(!e)return;const u=document.body.style.overflow;document.body.style.overflow="hidden",(f=a.current)==null||f.focus();const d=h=>{var E;if(h.key==="Escape"){h.preventDefault(),r();return}if(h.key!=="Tab")return;const p=(E=i.current)==null?void 0:E.querySelectorAll("button:not(:disabled)");if(!(p!=null&&p.length))return;const m=p[0],y=p[p.length-1];h.shiftKey&&document.activeElement===m?(h.preventDefault(),y.focus()):!h.shiftKey&&document.activeElement===y&&(h.preventDefault(),m.focus())};return window.addEventListener("keydown",d),()=>{document.body.style.overflow=u,window.removeEventListener("keydown",d)}},[r,e]),!e)return null;const o=t==="loading",c=o?"正在初始化沙箱":t==="error"?"启动失败":"启用 Codex 智能体";return Ss.createPortal(l.jsx("div",{className:"sandbox-dialog-backdrop",onMouseDown:u=>{u.target===u.currentTarget&&!o&&r()},children:l.jsxs("section",{ref:i,className:"sandbox-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"sandbox-dialog-title","aria-describedby":"sandbox-dialog-description",children:[l.jsxs("div",{className:"sandbox-dialog-visual","aria-hidden":"true",children:[l.jsx("span",{className:"sandbox-dialog-orbit"}),l.jsx("span",{className:"sandbox-dialog-icon",children:o?l.jsx("span",{className:"sandbox-spinner"}):l.jsx(Q0e,{})})]}),l.jsxs("div",{className:"sandbox-dialog-copy",children:[l.jsx("h2",{id:"sandbox-dialog-title",children:c}),t==="error"?l.jsx("p",{id:"sandbox-dialog-description",className:"sandbox-dialog-error",role:"alert",children:n||"AgentKit 沙箱初始化失败,请稍后重新尝试。"}):o?l.jsx("p",{id:"sandbox-dialog-description","aria-live":"polite",children:"正在寻找可用工具并创建内置智能体会话,通常需要一点时间。"}):l.jsx("p",{id:"sandbox-dialog-description",children:"将启动 AgentKit 沙箱与 Codex 智能体,本次对话不会被持久化保存。"})]}),l.jsxs("footer",{className:"sandbox-dialog-actions",children:[l.jsx("button",{ref:a,type:"button",onClick:r,children:o?"取消启动":"取消"}),!o&&l.jsx("button",{type:"button",className:"is-primary",onClick:s,children:t==="error"?"重新尝试":"确认开启"})]})]})}),document.body)}function J0e({onExit:e}){return l.jsxs("div",{className:"sandbox-session-warning",role:"status",children:[l.jsx("span",{className:"sandbox-session-warning-dot","aria-hidden":"true"}),l.jsx("span",{className:"sandbox-session-warning-copy",children:"当前为 Codex 智能体会话,退出后对话内容消失"}),l.jsx("button",{type:"button",onClick:e,children:"退出内置智能体"})]})}function eye({filled:e=!1,...t}){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[l.jsx("rect",{x:"3.5",y:"9.3",width:"4.5",height:"10.2",rx:"1.5"}),l.jsx("path",{d:"M8 10.2 11.3 4.8c.5-.8 1.7-.45 1.7.5v3.8h4.2a2.1 2.1 0 0 1 2.04 2.6l-1.4 5.75A2.1 2.1 0 0 1 15.8 19H8"})]})}function tye({filled:e=!1,...t}){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[l.jsx("rect",{x:"3.5",y:"4.5",width:"4.5",height:"10.2",rx:"1.5"}),l.jsx("path",{d:"M8 13.8 11.3 19.2c.5.8 1.7.45 1.7-.5v-3.8h4.2a2.1 2.1 0 0 0 2.04-2.6l-1.4-5.75A2.1 2.1 0 0 0 15.8 5H8"})]})}const yC=["#6366f1","#0ea5e9","#10b981","#f59e0b","#f43f5e","#a855f7","#14b8a6","#f472b6"];function Sb(e){let t=0;for(let n=0;n>>0;return yC[t%yC.length]}function nye(e){const t=new Map;e.forEach(u=>t.set(u.span_id,u));const n=new Map,r=[];for(const u of e)u.parent_span_id!=null&&t.has(u.parent_span_id)?(n.get(u.parent_span_id)??n.set(u.parent_span_id,[]).get(u.parent_span_id)).push(u):r.push(u);const s=(u,d)=>u.start_time-d.start_time,i=(u,d)=>({span:u,depth:d,children:(n.get(u.span_id)??[]).sort(s).map(f=>i(f,d+1))}),a=r.sort(s).map(u=>i(u,0)),o=e.length?Math.min(...e.map(u=>u.start_time)):0,c=e.length?Math.max(...e.map(u=>u.end_time)):1;return{rootNodes:a,min:o,total:c-o||1}}function rye(e,t){const n=[],r=s=>{n.push(s),t.has(s.span.span_id)||s.children.forEach(r)};return e.forEach(r),n}function bC(e){const t=e/1e6;return t>=1e3?`${(t/1e3).toFixed(2)} s`:`${t.toFixed(t<10?2:1)} ms`}const sye=e=>e.replace(/^(gen_ai|a2ui|adk)\./,"");function EC(e){return Object.entries(e.attributes).filter(([,t])=>t!=null&&typeof t!="object").map(([t,n])=>{const r=String(n);return{key:sye(t),value:r,long:r.length>80||r.includes(` +`)}}).sort((t,n)=>Number(t.long)-Number(n.long))}function iye({appName:e,sessionId:t,onClose:n}){const[r,s]=w.useState(null),[i,a]=w.useState(""),[o,c]=w.useState(new Set),[u,d]=w.useState(null);w.useEffect(()=>{s(null),a(""),WL(e,t).then(x=>{s(x),d(x.length?x.reduce((b,_)=>b.start_time<=_.start_time?b:_).span_id:null)}).catch(x=>a(String(x)))},[e,t]);const{rootNodes:f,min:h,total:p}=w.useMemo(()=>nye(r??[]),[r]),m=w.useMemo(()=>rye(f,o),[f,o]),y=(r==null?void 0:r.find(x=>x.span_id===u))??null,E=p/1e6,g=x=>c(b=>{const _=new Set(b);return _.has(x)?_.delete(x):_.add(x),_});return l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"drawer-scrim",onClick:n}),l.jsxs("aside",{className:"drawer drawer--trace",children:[l.jsxs("header",{className:"drawer-head",children:[l.jsxs("div",{children:[l.jsx("div",{className:"drawer-title",children:"调用链路观测"}),l.jsx("div",{className:"drawer-sub",children:r?`${r.length} 个调用 · ${E.toFixed(1)} ms`:"加载中"})]}),l.jsx("button",{className:"drawer-close",onClick:n,"aria-label":"关闭",children:l.jsx(zr,{className:"icon"})})]}),r==null&&!i&&l.jsxs("div",{className:"drawer-loading",children:[l.jsx(Rt,{className:"icon spin"})," 加载调用链路…"]}),i&&l.jsx("div",{className:"error",children:i}),r&&r.length===0&&l.jsx("div",{className:"drawer-empty",children:"该会话暂无调用链路(可能尚未产生调用)。"}),m.length>0&&l.jsxs("div",{className:"trace-split",children:[l.jsx("div",{className:"trace-tree scroll",children:m.map(x=>{const b=x.span,_=(b.start_time-h)/p*100,k=Math.max((b.end_time-b.start_time)/p*100,.6),N=x.children.length>0;return l.jsxs("button",{className:`trace-row ${u===b.span_id?"active":""}`,onClick:()=>d(b.span_id),children:[l.jsxs("span",{className:"trace-label",style:{paddingLeft:x.depth*14},children:[l.jsx("span",{className:`trace-caret ${N?"":"hidden"} ${o.has(b.span_id)?"":"open"}`,onClick:C=>{C.stopPropagation(),N&&g(b.span_id)},children:l.jsx(ws,{className:"chev"})}),l.jsx("span",{className:"trace-dot",style:{background:Sb(b.name)}}),l.jsx("span",{className:"trace-name",title:b.name,children:b.name})]}),l.jsx("span",{className:"trace-dur",children:bC(b.end_time-b.start_time)}),l.jsx("span",{className:"trace-track",children:l.jsx("span",{className:"trace-bar",style:{left:`${_}%`,width:`${k}%`,background:Sb(b.name)}})})]},b.span_id)})}),l.jsx("div",{className:"trace-detail scroll",children:y?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"td-title",children:y.name}),l.jsxs("div",{className:"td-dur",children:[l.jsx("span",{className:"td-dot",style:{background:Sb(y.name)}}),bC(y.end_time-y.start_time)]}),l.jsx("div",{className:"td-section",children:"属性"}),l.jsx("div",{className:"td-props",children:EC(y).filter(x=>!x.long).map(x=>l.jsxs("div",{className:"td-prop",children:[l.jsx("span",{className:"td-key",children:x.key}),l.jsx("span",{className:"td-val",children:x.value})]},x.key))}),EC(y).filter(x=>x.long).map(x=>l.jsxs("div",{className:"td-block",children:[l.jsx("div",{className:"td-section",children:x.key}),l.jsx("pre",{className:"td-pre",children:x.value})]},x.key))]}):l.jsx("div",{className:"drawer-empty",children:"选择左侧的一个调用查看详情"})})]})]})]})}function aye(e){return e.toLowerCase()==="github"?l.jsx(CH,{className:"icon"}):l.jsx(jH,{className:"icon"})}function oye({branding:e,onUsername:t}){const[n,r]=w.useState(null),[s,i]=w.useState(""),[a,o]=w.useState(0),[c,u]=w.useState(""),d=w.useRef(null);w.useEffect(()=>{let m=!0;return r(null),i(""),jL().then(y=>{m&&r(y)}).catch(y=>{m&&i(y instanceof Error?y.message:String(y))}),()=>{m=!1}},[a]);const f=n!==null&&n.length===0;w.useEffect(()=>{var m;f&&((m=d.current)==null||m.focus())},[f]);const h=tz.test(c),p=()=>{h&&t(c)};return l.jsxs("div",{className:"login",children:[l.jsx("header",{className:"login-top",children:l.jsxs("span",{className:"login-brand",children:[l.jsx("img",{className:"login-brand-logo",src:e.logoUrl||Hw,width:20,height:20,alt:"","aria-hidden":!0}),e.title]})}),l.jsx("main",{className:"login-main",children:l.jsxs("div",{className:"login-card",children:[l.jsx(ta,{as:"h1",className:"login-title",duration:4.8,spread:22,children:e.title}),s?l.jsxs("div",{className:"login-provider-error",role:"alert",children:[l.jsx("p",{children:s}),l.jsx("button",{type:"button",onClick:()=>o(m=>m+1),children:"重试"})]}):n===null?null:n.length>0?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"login-sub",children:"登录以继续使用"}),l.jsx("div",{className:"login-providers",children:n.map(m=>l.jsxs("button",{className:"login-btn",onClick:()=>rz(m.loginUrl),children:[aye(m.id),l.jsxs("span",{children:["使用 ",m.label," 登录"]})]},m.id))})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"login-sub",children:"输入一个用户名即可开始"}),l.jsxs("form",{className:"login-name",onSubmit:m=>{m.preventDefault(),p()},children:[l.jsx("input",{ref:d,className:"login-name-input",value:c,onChange:m=>u(m.target.value),placeholder:"用户名(字母 + 数字,最多 16 位)",maxLength:16}),l.jsx("button",{type:"submit",className:"login-name-go",disabled:!h,"aria-label":"进入",children:l.jsx(id,{className:"icon"})})]}),l.jsx("p",{className:"login-hint","aria-live":"polite",children:c&&!h?"只能包含大小写字母和数字,最多 16 位。":""})]}),l.jsx("p",{className:"login-powered",children:"火山引擎 AgentKit 提供企业级 Agent 解决方案"}),l.jsxs("p",{className:"login-legal",children:["继续即表示你已阅读并同意 AgentKit"," ",l.jsx("a",{href:"https://docs.volcengine.com/docs/86681/1925174?lang=zh",target:"_blank",rel:"noreferrer",children:"产品和服务条款"})]})]})}),l.jsx("footer",{className:"login-footer",children:"© 2026 VeADK. All rights reserved."})]})}function lye({open:e,checking:t,error:n,onLogin:r}){const s=w.useRef(null);return w.useEffect(()=>{var a;if(!e)return;const i=document.body.style.overflow;return document.body.style.overflow="hidden",(a=s.current)==null||a.focus(),()=>{document.body.style.overflow=i}},[e]),e?Ss.createPortal(l.jsx("div",{className:"auth-expired-backdrop",children:l.jsxs("section",{className:"auth-expired-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":"auth-expired-title","aria-describedby":"auth-expired-description",children:[l.jsx("div",{className:"auth-expired-mark","aria-hidden":"true",children:l.jsx(Ag,{})}),l.jsxs("div",{className:"auth-expired-copy",children:[l.jsx("h2",{id:"auth-expired-title",children:"登录状态已过期"}),l.jsx("p",{id:"auth-expired-description",children:"当前编辑内容会保留。重新登录后,刚才的操作将自动继续。"}),n&&l.jsx("p",{className:"auth-expired-error",role:"alert",children:n})]}),l.jsx("footer",{className:"auth-expired-actions",children:l.jsx("button",{ref:s,type:"button",onClick:r,disabled:t,children:t?"等待登录完成…":"重新登录"})})]})}),document.body):null}function cye({node:e,ctx:t}){const n=e.variant??"default";return l.jsx("button",{type:"button",className:`a2ui-button a2ui-button--${n}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component,onClick:()=>t.dispatchAction(e.action,e),children:t.render(e.child)})}el("Button",cye);function uye({node:e,ctx:t}){return l.jsx("div",{className:"a2ui-card","data-a2ui-id":e.id,"data-a2ui-component":e.component,children:t.render(e.child)})}el("Card",uye);const dye={start:"flex-start",center:"center",end:"flex-end",spaceBetween:"space-between",spaceAround:"space-around",spaceEvenly:"space-evenly",stretch:"stretch"},fye={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch"};function c5(e){return dye[e]??"flex-start"}function u5(e){return fye[e]??"stretch"}function hye({node:e,ctx:t}){const n=e.children??[];return l.jsx("div",{className:"a2ui-column","data-a2ui-id":e.id,"data-a2ui-component":e.component,style:{display:"flex",flexDirection:"column",justifyContent:c5(e.justify),alignItems:u5(e.align)},children:n.map(r=>t.render(r))})}el("Column",hye);function pye({node:e}){const t=e.axis==="vertical";return l.jsx("div",{className:`a2ui-divider ${t?"a2ui-divider--v":"a2ui-divider--h"}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component})}el("Divider",pye);const mye={send:"✈️",check:"✅",close:"✖️",star:"⭐",favorite:"❤️",info:"ℹ️",help:"❓",error:"⛔",calendarToday:"📅",event:"📅",schedule:"🕒",locationOn:"📍",accountCircle:"👤",mail:"✉️",call:"📞",home:"🏠",settings:"⚙️",search:"🔍"};function gye({node:e}){const t=e.name??"";return l.jsx("span",{className:"a2ui-icon",title:t,"aria-label":t,"data-a2ui-id":e.id,"data-a2ui-component":e.component,children:mye[t]??"•"})}el("Icon",gye);function yye({node:e,ctx:t}){const n=e.children??[];return l.jsx("div",{className:"a2ui-row","data-a2ui-id":e.id,"data-a2ui-component":e.component,style:{display:"flex",flexDirection:"row",justifyContent:c5(e.justify),alignItems:u5(e.align??"center")},children:n.map(r=>t.render(r))})}el("Row",yye);const bye=new Set(["h1","h2","h3","h4","h5"]);function Eye({node:e,ctx:t}){const n=e.variant??"body",r=t.resolveString(e.text),s=bye.has(n)?n:"p";return l.jsx(s,{className:`a2ui-text a2ui-text--${n}`,"data-a2ui-id":e.id,"data-a2ui-component":e.component,children:r})}el("Text",Eye);const xye="创建 Agent",wye={intelligent:"智能模式",custom:"自定义",template:"从模板新建",workflow:"工作流",package:"代码包部署"},vl={app:"veadk.appName",view:"veadk.view",session:"veadk.sessionId"},vye=new Set,_ye=[];function Di(){return{skills:[]}}function po(e){return`veadk.agentDrafts.${encodeURIComponent(e)}`}function Tb(e){return`${po(e)}.active`}function ZE(e){return`veadk.agentOrder.${encodeURIComponent(e)}`}function kye(e){if(!e)return[];try{const t=JSON.parse(localStorage.getItem(po(e))||"[]");return Array.isArray(t)?t:[]}catch{return[]}}function Nye(e){if(!e)return[];try{const t=JSON.parse(localStorage.getItem(ZE(e))||"[]");return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function JE(e,t){if(e.name===t||e.id===t)return e;for(const n of e.children){const r=JE(n,t);if(r)return r}}function d5(e){const t=[];for(const n of e.children)n.mentionable&&(t.push({name:n.name,description:n.description,type:n.type,path:n.path}),t.push(...d5(n)));return t}function xC(){const e=typeof localStorage<"u"?localStorage.getItem(vl.view):null;return e==="menu"||e==="intelligent"||e==="custom"||e==="template"||e==="workflow"?e:null}function Sye({className:e}){return l.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("ellipse",{cx:"12",cy:"12",rx:"6.6",ry:"8.2"}),l.jsx("path",{d:"M12 8.2l1.05 2.75 2.75 1.05-2.75 1.05L12 15.8l-1.05-2.75L8.2 12l2.75-1.05z",fill:"currentColor",stroke:"none"})]})}function Tye(){return l.jsxs("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":!0,children:[l.jsx("rect",{x:"3",y:"4",width:"14",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none"}),l.jsx("rect",{x:"6",y:"10.4",width:"13",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none",opacity:"0.7"}),l.jsx("rect",{x:"9",y:"16.8",width:"9",height:"3.2",rx:"1.2",fill:"currentColor",stroke:"none",opacity:"0.45"})]})}function f5(e){return e?new Date(e*1e3).toLocaleString("zh-CN",{timeZone:"Asia/Shanghai",hour12:!1,month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):""}function Aye(e){if(!e)return"";const t=[];return e.ts&&t.push(f5(e.ts)),e.tokens!=null&&t.push(`${e.tokens.toLocaleString()} tokens`),t.join(" · ")}function wC(e){return e.blocks.map(t=>t.kind==="text"?t.text:"").join("").trim()}const Cye="send_a2ui_json_to_client";function Iye(e){return e.blocks.some(t=>t.kind==="text"?t.text.trim().length>0:t.kind==="attachment"?t.files.length>0:t.kind==="tool"?!(t.name===Cye&&t.done):t.kind==="agent-transfer"?!1:t.kind==="a2ui"?B4(t.messages).some(n=>n.components[n.rootId]):t.kind==="auth")}function Oye(e){return e.blocks.some(t=>t.kind==="auth"&&!t.done)}function Rye(e){return new Promise((t,n)=>{let r="";try{r=new URL(e,window.location.href).protocol}catch{}if(r!=="http:"&&r!=="https:"){n(new Error("授权链接不是 http/https 地址,已阻止打开。"));return}const s=window.open(e,"veadk_oauth","width=520,height=720");if(!s){n(new Error("弹窗被拦截,请允许弹窗后重试。"));return}let i=!1;const a=()=>{clearInterval(u),window.removeEventListener("message",c)},o=d=>{if(!i){i=!0,a();try{s.close()}catch{}t(d)}},c=d=>{if(d.origin!==window.location.origin)return;const f=d.data;f&&f.veadkOAuth&&typeof f.url=="string"&&o(f.url)};window.addEventListener("message",c);const u=setInterval(()=>{if(!i){if(s.closed){a();const d=window.prompt("授权完成后,请粘贴回调页面(浏览器地址栏)的完整 URL:");d&&d.trim()?(i=!0,t(d.trim())):n(new Error("授权已取消。"));return}try{const d=s.location.href;d&&d!=="about:blank"&&new URL(d).origin===window.location.origin&&/[?&](code|state|error)=/.test(d)&&o(d)}catch{}}},500)})}function Lye(e,t){const n=JSON.parse(JSON.stringify(e??{})),r=n.exchangedAuthCredential??n.exchanged_auth_credential??{},s=r.oauth2??{};return s.authResponseUri=t,s.auth_response_uri=t,r.oauth2=s,n.exchangedAuthCredential=r,n}function vC({text:e}){const[t,n]=w.useState(!1);return l.jsx("button",{className:"icon-btn",title:t?"已复制":"复制",disabled:!e,onClick:async()=>{if(e)try{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)}catch{}},children:t?l.jsx(Js,{className:"icon"}):l.jsx(Aw,{className:"icon"})})}function Mye(e){return e==="cn-beijing"?"华北 2(北京)":e==="cn-shanghai"?"华东 2(上海)":e||"未指定"}function jye({tasks:e,onCancel:t}){const[n,r]=w.useState(!1),[s,i]=w.useState(null),a=e.filter(f=>f.status==="running").length,o=e[0],c=a>0?"running":(o==null?void 0:o.status)??"idle",u=a>0?`${a} 个部署任务进行中`:(o==null?void 0:o.status)==="success"?"最近部署已完成":(o==null?void 0:o.status)==="error"?"最近部署失败":(o==null?void 0:o.status)==="cancelled"?"最近部署已取消":"部署任务",d=f=>{i(f.id),t(f).finally(()=>i(null))};return l.jsxs("div",{className:"global-deploy-center",children:[l.jsxs("button",{type:"button",className:`global-deploy-task is-${c}`,"aria-expanded":n,"aria-haspopup":"dialog",onClick:()=>r(f=>!f),children:[c==="running"?l.jsx(Rt,{className:"global-deploy-task-icon spin"}):c==="success"?l.jsx(vL,{className:"global-deploy-task-icon"}):c==="error"?l.jsx(Ag,{className:"global-deploy-task-icon"}):c==="cancelled"?l.jsx($1,{className:"global-deploy-task-icon"}):l.jsx(MH,{className:"global-deploy-task-icon"}),l.jsx("span",{className:"global-deploy-task-detail",children:u}),l.jsx(Sw,{className:`global-deploy-task-chevron${n?" is-open":""}`})]}),n&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"global-deploy-task-scrim","aria-label":"关闭部署任务",onClick:()=>r(!1)}),l.jsxs("section",{className:"global-deploy-popover",role:"dialog","aria-label":"部署任务",children:[l.jsxs("header",{className:"global-deploy-popover-head",children:[l.jsx("span",{children:"部署任务"}),l.jsx("span",{children:e.length})]}),l.jsx("div",{className:"global-deploy-list",children:e.length===0?l.jsx("div",{className:"global-deploy-empty",children:"暂无部署任务"}):e.map(f=>{const h=`${f.label}${f.status==="running"&&typeof f.pct=="number"?` ${Math.round(f.pct)}%`:""}`;return l.jsxs("article",{className:`global-deploy-item is-${f.status}`,children:[l.jsxs("div",{className:"global-deploy-item-head",children:[l.jsx("span",{className:"global-deploy-runtime-name",children:f.runtimeName}),l.jsx("span",{className:"global-deploy-status",children:h})]}),l.jsxs("dl",{className:"global-deploy-meta",children:[l.jsxs("div",{children:[l.jsx("dt",{children:"Runtime 名称"}),l.jsx("dd",{children:f.runtimeName})]}),l.jsxs("div",{children:[l.jsx("dt",{children:"部署地域"}),l.jsx("dd",{children:Mye(f.region)})]}),f.runtimeId&&l.jsxs("div",{children:[l.jsx("dt",{children:"Runtime ID"}),l.jsx("dd",{children:f.runtimeId})]})]}),f.message&&f.status==="error"?l.jsx(eg,{className:"global-deploy-error",message:f.message,onRetry:f.retry}):f.message?l.jsx("p",{className:"global-deploy-message",children:f.message}):null,f.status==="running"&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"global-deploy-progress","aria-hidden":!0,children:l.jsx("span",{style:{width:`${Math.max(6,Math.min(100,f.pct??6))}%`}})}),l.jsx("div",{className:"global-deploy-item-actions",children:l.jsx("button",{type:"button",disabled:s===f.id,onClick:()=>d(f),children:s===f.id?"取消中…":"取消部署"})})]})]},f.id)})})]})]})]})}const _C=["今天想做点什么?","有什么可以帮你的?","需要我帮你查点什么吗?","有问题尽管问我","嗨,我们开始吧","开始一段新对话吧","今天想先解决哪件事?","把你的想法告诉我吧","我们从哪里开始?","有什么任务交给我?","准备好一起推进了吗?","说说你现在最关心的问题","今天也一起把事情做好","我在,随时可以开始"],kC=()=>_C[Math.floor(Math.random()*_C.length)];function Ab(e){var t;for(const n of e)(t=n.previewUrl)!=null&&t.startsWith("blob:")&&URL.revokeObjectURL(n.previewUrl)}function Dye(){return`draft-${Date.now()}-${Math.random().toString(36).slice(2)}`}function Pye(e){var n;if(e.type)return e.type;const t=(n=e.name.split(".").pop())==null?void 0:n.toLowerCase();return t==="md"||t==="markdown"?"text/markdown":t==="txt"?"text/plain":"application/octet-stream"}function Bye(){const[e,t]=w.useState([]),[n,r]=w.useState(""),[s,i]=w.useState([]),[a,o]=w.useState(""),c=w.useRef(null),[u,d]=w.useState(!1),[f,h]=w.useState([]),[p,m]=w.useState(null),[y,E]=w.useState([]),[g,x]=w.useState(!1),[b,_]=w.useState(!1),[k,N]=w.useState("confirm"),[C,S]=w.useState(""),A=w.useRef(null),O=w.useRef(null),[D,U]=w.useState({}),X=a?D[a]??[]:f,M=p?y:X,j=($,K)=>U(ae=>({...ae,[$]:typeof K=="function"?K(ae[$]??[]):K})),[T,L]=w.useState(""),[R,F]=w.useState("agent"),[I,V]=w.useState({}),[W,P]=w.useState(null),[ie,G]=w.useState(!1),re=w.useRef(0),[ue,ee]=w.useState([]),[le,ne]=w.useState(Di),[me,ye]=w.useState(null),[te,de]=w.useState(!1),[Ee,Te]=w.useState(null),[Ke,Ne]=w.useState(!1),[it,He]=w.useState([]),[Ue,Et]=w.useState(!1),rt=w.useRef(new Set),[St,ct]=w.useState(()=>new Set),[B,Q]=w.useState(()=>new Set),oe=w.useRef(new Map),be=w.useRef(new Map),Oe=($,K)=>ct(ae=>{const ge=new Set(ae);return K?ge.add($):ge.delete($),ge}),Ye=$=>{const K=be.current.get($);K!==void 0&&window.clearTimeout(K),be.current.delete($),Q(ae=>new Set(ae).add($))},tt=$=>{const K=be.current.get($);K!==void 0&&window.clearTimeout(K);const ae=window.setTimeout(()=>{be.current.delete($),Q(ge=>{const Me=new Set(ge);return Me.delete($),Me})},2400);be.current.set($,ae)},ze=w.useRef(""),[Tt,Re]=w.useState(""),[kt,Pt]=w.useState(()=>new Set),[Bt,bn]=w.useState(!1),[Xe,ft]=w.useState(!1),xt=w.useRef(null),vt=w.useCallback(()=>ft(!1),[]),[fe,$e]=w.useState(kC),[nt,qt]=w.useState(null),[fn,Lt]=w.useState(!1),[J,he]=w.useState(!1),[Le,Be]=w.useState(""),ot=w.useRef(!1),[It,st]=w.useState(null),[Z,we]=w.useState(""),[_e,We]=w.useState(),[Ve,Je]=w.useState(null),[ut,Vt]=w.useState({newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,addAgentkit:!0}),[Ft,hn]=w.useState("cloud"),[Tn,Kt]=w.useState(Wd),[os,Er]=w.useState(""),[Xn,Or]=w.useState("chat"),[Qn,ar]=w.useState(!1),[An,Xt]=w.useState(!1),[En,Un]=w.useState(!1),[or,nn]=w.useState({}),[ls,Zn]=w.useState({}),[$n,Jn]=w.useState({}),Is=St.has(a),Rr=B.has(a),xr=Is||u,cs=!!a&&Ke,Kr=p?g:xr,Ga=Kr||!p&&Rr,qa=or[a]??"",Xa=ls[a]??vye,Si=$n[a]??_ye,Hn=me==null?void 0:me.graph,Qa=[me==null?void 0:me.name,Hn==null?void 0:Hn.name,Hn==null?void 0:Hn.id].filter($=>!!$),Ti=le.targetAgent&&Hn?JE(Hn,le.targetAgent.name):Hn,Xf=(Ti==null?void 0:Ti.skills)??(le.targetAgent?[]:(me==null?void 0:me.skills)??[]),Qf=Hn?d5(Hn):[];function nl($){Ab($);for(const K of $)K.status==="uploading"?rt.current.add(K.id):K.uri&&kp(n,K.uri).catch(ae=>Re(String(ae)))}function rl(){re.current+=1;const $=W;P(null),G(!1),$&&!$.id.startsWith("pending-")&&I0e($.id).catch(K=>{Re(K instanceof Error?K.message:String(K))})}async function sl($){try{await Y1(n,Z,$),await K1(n,Z,$),i(K=>K.filter(ae=>ae.id!==$)),U(K=>{const{[$]:ae,...ge}=K;return ge})}catch(K){Re(String(K))}}function Zf($){const K=ue.find(Me=>Me.id===$);if(!K)return;const ae=ue.filter(Me=>Me.id!==$);Ab([K]),K.status==="uploading"&&rt.current.add($),ee(ae),ae.length===0&&!T.trim()&&!!a&&M.length===0?(ze.current="",o(""),sl(a)):K.uri&&kp(n,K.uri).catch(Me=>Re(String(Me)))}const q=($,K)=>{var Se,je,Ge,De,At;const ae=K.author&&K.author!=="user"?K.author:void 0;ae&&(nn(Ze=>({...Ze,[$]:ae})),Zn(Ze=>({...Ze,[$]:new Set(Ze[$]??[]).add(ae)})),Jn(Ze=>{var ht;return(ht=Ze[$])!=null&&ht.length?Ze:{...Ze,[$]:[ae]}}));const ge=((Se=K.actions)==null?void 0:Se.transferToAgent)??((je=K.actions)==null?void 0:je.transfer_to_agent);ge&&Jn(Ze=>{const ht=Ze[$]??[];return ht[ht.length-1]===ge?Ze:{...Ze,[$]:[...ht,ge]}}),(((Ge=K.actions)==null?void 0:Ge.endOfAgent)??((De=K.actions)==null?void 0:De.end_of_agent)??((At=K.actions)==null?void 0:At.escalate))&&Jn(Ze=>{const ht=Ze[$]??[];return ht.length<=1?Ze:{...Ze,[$]:ht.slice(0,-1)}})},[pe,ve]=w.useState(xC),[Qe,Mt]=w.useState([]),rn=w.useCallback($=>{Mt(K=>{const ae=K.findIndex(Me=>Me.id===$.id);if(ae===-1)return[$,...K];const ge=[...K];return ge[ae]={...ge[ae],...$},ge})},[]),pn=w.useCallback(async $=>{try{await rM($.id),Mt(K=>K.map(ae=>ae.id===$.id?{...ae,status:"cancelled",label:"已取消",message:"部署已取消,相关 Runtime 资源已请求销毁。"}:ae))}catch(K){const ae=K instanceof Error?K.message:String(K);Mt(ge=>ge.map(Me=>Me.id===$.id?{...Me,message:`取消失败:${ae}`}:Me))}},[]),[Mn,Cn]=w.useState(!0),[In,Ct]=w.useState(!1),[lr,sn]=w.useState(!1),[iu,zn]=w.useState(!1),[h5,wr]=w.useState(null),[f_,Za]=w.useState([]),[h_,Jf]=w.useState([]),[Lr,Os]=w.useState(""),us=w.useRef(null),[E0,Rs]=w.useState(!1),[p5,Vn]=w.useState(!1),x0=w.useRef(null),[w0,il]=w.useState(()=>{const $=ps();return Yc($),$}),[m5,p_]=w.useState(!1),[g5,v0]=w.useState(""),[m_,eh]=w.useState(null),[y5,g_]=w.useState({}),[al,ri]=w.useState(null),[b5,Ai]=w.useState(""),[E5,Ci]=w.useState(""),[x5,th]=w.useState(!1),_0=w.useRef(!1),nh=w.useRef(!1),w5=w.useCallback(($,K,ae)=>{!$||!Z||Za(ge=>{const Se=[{id:$,draft:K,updatedAt:Date.now(),deploymentTarget:ae},...ge.filter(je=>je.id!==$)];return localStorage.setItem(po(Z),JSON.stringify(Se)),Se})},[Z]),k0=w.useCallback($=>{!$||!Z||Za(K=>{const ae=K.filter(ge=>ge.id!==$);return localStorage.setItem(po(Z),JSON.stringify(ae)),ae})},[Z]),v5=w.useCallback($=>{if(!Z||$.length===0)return;const K=new Set($.map(ae=>ae.id));Za(ae=>{const ge=ae.filter(Me=>!K.has(Me.id));return localStorage.setItem(po(Z),JSON.stringify(ge)),ge}),K.has(Lr)&&(Os(""),wr(null),ri(null),us.current=null,localStorage.removeItem(Tb(Z)))},[Lr,Z]),y_=w.useCallback($=>{if(!$||!Z)return;const K=us.current;Za(ae=>{const ge=ae.filter(Se=>Se.id!==$),Me=(K==null?void 0:K.id)===$?[K,...ge]:ge;return localStorage.setItem(po(Z),JSON.stringify(Me)),Me})},[Z]);w.useEffect(()=>{if(!Z){Za([]),Jf([]),Os(""),us.current=null;return}const $=kye(Z);Za($),Jf(Nye(Z));const K=localStorage.getItem(Tb(Z))||"",ae=$.find(ge=>ge.id===K);us.current=ae??null,pe==="custom"&&ae&&(Os(ae.id),wr(ae.draft),ri(ae.deploymentTarget??null))},[Z]),w.useEffect(()=>{if(!Z)return;const $=Tb(Z);pe==="custom"&&Lr?localStorage.setItem($,Lr):localStorage.removeItem($)},[pe,Lr,Z]);const _5=w.useCallback($=>{if(!Z)return;const K=[...new Set($.filter(Boolean))];Jf(K),localStorage.setItem(ZE(Z),JSON.stringify(K))},[Z]),k5=w.useCallback(async $=>{const K=$.filter(Se=>!!Se.runtimeId&&Se.canDelete===!0);if(K.length===0)return;const ae=new Set,ge=new Set,Me=[];for(const Se of K)try{await uM(Se.runtimeId,Se.region??"cn-beijing"),Sm(Se.runtimeId),ae.add(Se.runtimeId),ge.add(Se.id)}catch(je){const Ge=je instanceof Error?je.message:String(je);Me.push(`${Se.label}: ${Ge}`)}if(ae.size>0&&(il(ps()),eh(Se=>{if(!Se)return Se;const je=new Set(Se);for(const Ge of ae)je.delete(Ge);return je}),g_(Se=>Object.fromEntries(Object.entries(Se).filter(([je])=>!ae.has(je)))),Jf(Se=>{const je=Se.filter(Ge=>!ge.has(Ge));return Z&&localStorage.setItem(ZE(Z),JSON.stringify(je)),je}),Za(Se=>{const je=Se.filter(Ge=>{var De;return!((De=Ge.deploymentTarget)!=null&&De.runtimeId)||!ae.has(Ge.deploymentTarget.runtimeId)});return Z&&localStorage.setItem(po(Z),JSON.stringify(je)),je}),K.some(Se=>Se.id===n)&&(ze.current="",o(""),r(""))),Me.length>0){const Se=Me.slice(0,3).join(";"),je=Me.length>3?`;另有 ${Me.length-3} 个失败`:"";throw new Error(`${Me.length} 个 Agent 删除失败:${Se}${je}`)}},[n,Z]),b_=w.useCallback(async()=>{p_(!0),v0("");try{const $=[];let K="";do{const ge=await ld({scope:"mine",region:"all",pageSize:100,nextToken:K});$.push(...ge.runtimes),K=ge.nextToken}while(K&&$.length<2e3);eh(new Set($.map(ge=>ge.runtimeId))),g_(Object.fromEntries($.map(ge=>[ge.runtimeId,{canDelete:ge.canDelete}])));const ae=[];for(const ge of $)try{await Nm(ge.runtimeId,ge.name,ge.region,ge.currentVersion)}catch{ae.push(ge.name)}il(ps()),ae.length>0&&v0(`${ae.length} 个 Runtime 暂时无法读取,请稍后重试。`)}catch($){v0($ instanceof Error?$.message:String($))}finally{p_(!1)}},[]);function rh($){console.log("create agent draft:",$),ve(null),ll()}function N0($,K){console.log("Agent added, navigating to:",$,K),il(ps()),eh(null),k0(Lr),Os(""),us.current=null,ri(null),Ai(""),Ci($),ve(null),Vn(!0),r($)}const N5=w.useCallback($=>{ve(null),zn(!1),Vn(!0),Ci(""),Ai($.id),Re("")},[]),S5=w.useCallback(async $=>{if(!$.runtimeId)throw new Error("部署完成,但未返回 Runtime ID。");const K=(al==null?void 0:al.region)??"cn-beijing",ae=await Nm($.runtimeId,$.agentName,$.region??K,$.version);il(ps()),eh(ge=>{const Me=new Set(ge??[]);return Me.add($.runtimeId),Me}),ri(null),k0(Lr),Os(""),us.current=null,Ai(""),Ci(ae),ve(null),Vn(!0),r(ae)},[Lr,k0,al]),au=w.useRef(null),ol=w.useRef(!0),aa=w.useRef(!1),Ja=w.useRef(null),E_=w.useRef({key:"",turnCount:0}),S0=(p==null?void 0:p.id)??a;w.useLayoutEffect(()=>{const $=au.current,K=E_.current,ae=K.key!==S0,ge=!ae&&M.length>K.turnCount;if(E_.current={key:S0,turnCount:M.length},!$||M.length===0||!ae&&!ge)return;ol.current=!0,aa.current=!1,Ja.current!==null&&(window.clearTimeout(Ja.current),Ja.current=null);const Me=window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(ae||Me){$.scrollTop=$.scrollHeight;return}aa.current=!0,$.scrollTo({top:$.scrollHeight,behavior:"smooth"}),Ja.current=window.setTimeout(()=>{aa.current=!1,Ja.current=null},450)},[S0,M.length]),w.useLayoutEffect(()=>{const $=au.current;!$||!ol.current||aa.current||($.scrollTop=$.scrollHeight)},[Kr,M]),w.useEffect(()=>()=>{Ja.current!==null&&window.clearTimeout(Ja.current)},[]);const T5=w.useCallback(()=>{const $=au.current;!$||aa.current||(ol.current=$.scrollHeight-$.scrollTop-$.clientHeight<32)},[]),A5=w.useCallback($=>{$.deltaY<0&&(aa.current=!1,ol.current=!1)},[]),C5=w.useCallback(()=>{aa.current=!1,ol.current=!1},[]),I5=w.useCallback(()=>{const $=au.current;!$||!ol.current||aa.current||($.scrollTop=$.scrollHeight)},[]),T0=w.useCallback(()=>{st(null),z1().then($=>{we($.userId),We($.info),Xt(!!$.local),qt($.status)}).catch($=>{st($ instanceof Error?$.message:String($))})},[]);w.useEffect(()=>{T0()},[T0]),w.useEffect(()=>{const $=()=>{Be(""),Lt(!0)};return window.addEventListener(V1,$),dz()&&$(),()=>window.removeEventListener(V1,$)},[]);const O5=w.useCallback(async()=>{if(ot.current)return;ot.current=!0;const $=sz();if(!$){ot.current=!1,Be("登录窗口被浏览器拦截,请允许弹出窗口后重试。");return}he(!0),Be("");try{for(;;){await new Promise(K=>window.setTimeout(K,1e3));try{const K=await z1();if(K.status==="authenticated"){we(K.userId),We(K.info),Xt(!!K.local),qt(K.status),Lt(!1),fz(),$.close();return}}catch{}if($.closed){Be("登录窗口已关闭,请重新登录以继续当前操作。");return}}}finally{ot.current=!1,he(!1)}},[]);w.useEffect(()=>{An&&Z&&fS(Z)},[An,Z]),w.useEffect(()=>{if(nt!=="authenticated"||!Z){V({});return}let $=!1;return Promise.allSettled([q0e(),X0e()]).then(([K,ae])=>{$||V({temporaryEnabled:K.status==="fulfilled"&&K.value.enabled,skillCreateEnabled:ae.status==="fulfilled"&&ae.value.enabled})}),()=>{$=!0}},[nt,Z]),w.useEffect(()=>{if(nt!=="authenticated"||!Z){Je(null);return}let $=!1;return Je(null),aM().then(K=>{$||Je(K)}).catch(K=>{console.warn("[app] /web/access failed; using ordinary-user access:",K),$||Je(iM)}),()=>{$=!0}},[nt,Z]),w.useEffect(()=>{sM().then($=>{Vt($.features),hn($.agentsSource),Kt($.branding),Er($.version),Or($.defaultView),ar(!0)})},[]),w.useEffect(()=>{!Ve||!Qn||nh.current||(nh.current=!0,Xn==="addAgent"&&Ve.capabilities.createAgents&&(ve(null),Ct(!1),Rs(!1),Vn(!1),sn(!1),zn(!0)))},[Ve,Xn,Qn]),w.useEffect(()=>{Ve&&(Ve.capabilities.createAgents||(ve(null),wr(null),sn(!1),zn(!1),Mt([])),Ve.capabilities.manageAgents||Vn(!1))},[Ve]),w.useEffect(()=>{document.title=Tn.title;let $=document.querySelector('link[rel~="icon"]');$||($=document.createElement("link"),$.rel="icon",document.head.appendChild($)),$.removeAttribute("type"),$.href=Tn.logoUrl||Hw},[Tn]),w.useEffect(()=>{fetch("/web/runtime-config",{signal:AbortSignal.timeout(1e4)}).then($=>$.ok?$.json():null).then($=>{$&&Cn(!!$.credentials)}).catch($=>{console.warn("[app] /web/runtime-config probe failed; workbench stays hidden:",$)})},[]);function R5($){fS($),_0.current=!0,nh.current=!1,Je(null),ve(null),wr(null),Ct(!1),sn(!1),zn(!1),Rs(!1),Vn(!1),ll(),we($),We({name:$}),Xt(!0),qt("authenticated")}function L5(){nh.current=!1,Je(null),An?(nz(),we(""),We(void 0),qt("unauthenticated")):az()}w.useEffect(()=>{nt!=="unauthenticated"&&HL().then($=>{if(t($),Ft==="cloud"){r("");return}const K=localStorage.getItem(vl.app),ae=w0.flatMap(Se=>Se.apps.map(je=>Bo(Se.id,je))),ge=K&&($.includes(K)||ae.includes(K)),Me=["web_search_agent","web_demo"].find(Se=>$.includes(Se))??$.find(Se=>!/^\d/.test(Se))??$[0];r(ge?K:Me||"")}).catch($=>Re(String($)))},[nt,Ft]),w.useEffect(()=>{n&&localStorage.setItem(vl.app,n)},[n]),w.useEffect(()=>{let $=!1;if(Te(null),He([]),!n||!Z||!a){Ne(!1);return}return Ne(!0),GL(n,Z,a).then(K=>{$||(Te(K),qL(n).then(ae=>{$||He(ae)}).catch(()=>{$||He([])}))}).catch(()=>{$||Te(null)}).finally(()=>{$||Ne(!1)}),()=>{$=!0}},[n,Z,a]),w.useEffect(()=>{let $=!1;if(ye(null),ne(Di()),!n){de(!1);return}return de(!0),Fw(n).then(K=>{$||ye(K)}).catch(()=>{$||ye(null)}).finally(()=>{$||de(!1)}),()=>{$=!0}},[n]),w.useEffect(()=>{Ve&&localStorage.setItem(vl.view,Ve.capabilities.createAgents?pe??"chat":"chat")},[Ve,pe]),w.useEffect(()=>{localStorage.setItem(vl.session,a),ze.current=a},[a]),w.useEffect(()=>()=>oe.current.forEach($=>$.abort()),[]),w.useEffect(()=>()=>be.current.forEach($=>{window.clearTimeout($)}),[]),w.useEffect(()=>()=>{var $,K;($=A.current)==null||$.abort(),(K=O.current)==null||K.abort()},[]),w.useEffect(()=>{!n||!Z||(async()=>{const $=await sh(n);if(!_0.current){_0.current=!0;const K=localStorage.getItem(vl.session)||"";if(xC()===null&&K&&$.some(ae=>ae.id===K)){ih(K);return}}ll()})()},[n,Z]),w.useEffect(()=>{const $=x0.current;$&&$.app===n&&(x0.current=null,ih($.sid))},[n]);function M5($,K){Rs(!1),$===n?ih(K):(x0.current={app:$,sid:K},r($))}async function sh($){try{const K=await Dw($,Z),ae=await Promise.all(K.map(ge=>{var Me;return(Me=ge.events)!=null&&Me.length?Promise.resolve(ge):_m($,Z,ge.id)}));return i(ae),ae}catch(K){return Re(String(K)),[]}}function j5(){p||(Re(""),S(""),N("confirm"),_(!0))}function D5(){var $;($=A.current)==null||$.abort(),A.current=null,_(!1),N("confirm"),S(""),!p&&R==="temporary"&&F("agent")}async function P5(){var K;(K=A.current)==null||K.abort();const $=new AbortController;A.current=$,N("loading"),S("");try{const ae=await Nb.startSession({signal:$.signal});if(A.current!==$)return;ze.current="",o(""),h([]),L(""),ne(Di()),F("temporary"),rl(),G(!1),nl(ue),ee([]),E([]),m(ae),ve(null),Ct(!1),sn(!1),zn(!1),Rs(!1),Vn(!1),_(!1),N("confirm")}catch(ae){if((ae==null?void 0:ae.name)==="AbortError"||A.current!==$)return;S(ae instanceof Error?ae.message:String(ae)),N("error")}finally{A.current===$&&(A.current=null)}}function eo(){var K;(K=O.current)==null||K.abort(),O.current=null,x(!1),E([]),L(""),Re(""),F("agent");const $=p;m(null),$&&Nb.closeSession($.id).catch(ae=>Re(String(ae)))}async function B5($){var Me;const K=p;if(!K||g||!$.trim())return;Re("");const ae=new AbortController;(Me=O.current)==null||Me.abort(),O.current=ae;const ge=[{role:"user",blocks:[{kind:"text",text:$}],meta:{ts:Date.now()/1e3}},{role:"assistant",blocks:[]}];E(Se=>[...Se,...ge]),x(!0);try{const Se=await Nb.sendMessage({sessionId:K.id,text:$},{signal:ae.signal,onBlocks:je=>{O.current===ae&&E(Ge=>{const De=Ge.slice(),At=De[De.length-1];return(At==null?void 0:At.role)==="assistant"&&(De[De.length-1]={...At,blocks:je}),De})}});if(O.current!==ae)return;E(je=>{const Ge=je.slice(),De=Ge[Ge.length-1];return(De==null?void 0:De.role)==="assistant"&&(Ge[Ge.length-1]={...De,blocks:Se.blocks,meta:{ts:Date.now()/1e3}}),Ge})}catch(Se){if((Se==null?void 0:Se.name)==="AbortError"||O.current!==ae)return;E(je=>je.slice(0,-2)),L($),Re(`内置智能体发送失败:${Se instanceof Error?Se.message:String(Se)}`)}finally{O.current===ae&&(O.current=null,x(!1))}}function ll(){eo(),Re(""),ft(!1),$e(kC()),F("agent"),rl(),G(!1);const $=a&&X.length===0&&ue.length>0?a:"";ze.current="",o(""),Te(null),He([]),d(!1),h([]),ne(Di()),nl(ue),ee([]),$&&sl($)}async function F5($){var K;try{(K=oe.current.get($))==null||K.abort(),await Y1(n,Z,$),await K1(n,Z,$);const ae=be.current.get($);ae!==void 0&&window.clearTimeout(ae),be.current.delete($),Q(ge=>{if(!ge.has($))return ge;const Me=new Set(ge);return Me.delete($),Me}),U(ge=>{const{[$]:Me,...Se}=ge;return Se}),$===a&&ll(),await sh(n)}catch(ae){Re(String(ae))}}async function ih($){if(p&&eo(),$!==a&&(ze.current=$,Re(""),d(!1),h([]),F("agent"),rl(),ne(Di()),Te(null),He([]),o($),D[$]===void 0)){Un(!0);try{const K=await _m(n,Z,$);j($,Iz(K.events??[],K.state))}catch(K){Re(String(K))}finally{Un(!1)}}}async function x_($=!0){if(a)return a;c.current||(c.current=vm(n,Z));const K=c.current;try{const ae=await K;$&&o(ae);const ge=Date.now()/1e3,Me={id:ae,lastUpdateTime:ge,events:[]};return i(Se=>[Me,...Se.filter(je=>je.id!==ae)]),ae}finally{c.current===K&&(c.current=null)}}async function w_($){if(!n||!Z||!a||!Ee)return!1;Et(!0),Re("");try{const K=await QL(n,Z,a,$,Ee.revision);return Te(K),!0}catch(K){return Re(String(K)),!1}finally{Et(!1)}}async function v_($){if(!(!n||!Z||!a||!Ee)){Et(!0),Re("");try{const K=await ZL(n,Z,a,$,Ee.revision);Te(K)}catch(K){Re(String(K))}finally{Et(!1)}}}async function U5($){Re("");let K;try{K=await x_()}catch(ge){Re(String(ge));return}const ae=Array.from($).map(ge=>({file:ge,attachment:{id:Dye(),mimeType:Pye(ge),name:ge.name,sizeBytes:ge.size,status:"uploading"}}));ee(ge=>[...ge,...ae.map(Me=>Me.attachment)]),await Promise.all(ae.map(async({file:ge,attachment:Me})=>{try{const Se=await VL(n,Z,K,ge);if(rt.current.delete(Me.id)){Se.uri&&await kp(n,Se.uri);return}ee(je=>je.map(Ge=>Ge.id===Me.id?Se:Ge))}catch(Se){if(rt.current.delete(Me.id))return;const je=Se instanceof Error?Se.message:String(Se);ee(Ge=>Ge.map(De=>De.id===Me.id?{...De,status:"error",error:je}:De)),Re(je)}}))}async function __($,K=[],ae=Di()){if(!$.trim()&&K.length===0||xr||cs||!n||!Z)return;Re("");const ge=[];(ae.skills.length>0||ae.targetAgent)&&ge.push({kind:"invocation",value:ae}),K.length&&ge.push({kind:"attachment",files:K.map(De=>({id:De.id,mimeType:De.mimeType,data:De.data,uri:De.uri,name:De.name,sizeBytes:De.sizeBytes}))}),$.trim()&&ge.push({kind:"text",text:$});const Me=[{role:"user",blocks:ge,meta:{ts:Date.now()/1e3}},{role:"assistant",blocks:[]}],Se=!a;Se&&(h(Me),d(!0));let je;try{je=await x_(!Se)}catch(De){Se&&(h([]),d(!1),L($),ne(ae)),Re(String(De));return}j(je,De=>Se?Me:[...De,...Me]),Se&&(ze.current=je,o(je),h([]),d(!1));const Ge=new AbortController;oe.current.set(je,Ge),Oe(je,!0),Ye(je),ze.current=je,nn(De=>({...De,[je]:""})),Zn(De=>({...De,[je]:new Set})),Jn(De=>({...De,[je]:[]}));try{let De=zs(),At="",Ze=0,ht=Date.now()/1e3,an="",Wr="";for await(const mn of Yd({appName:n,userId:Z,sessionId:je,text:$,attachments:K,invocation:ae,signal:Ge.signal,sessionCapabilities:Ee!==null})){if(Ge.signal.aborted)break;const Ii=mn.error??mn.errorMessage??mn.error_message;if(typeof Ii=="string"&&Ii){ze.current===je&&Re(Ii);break}q(je,mn);const Oi=mn.author&&mn.author!=="user"?mn.author:"";Oi&&Oi!==At&&(At=Oi,De=zs()),De=Ec(De,mn);const ii=mn.usageMetadata??mn.usage_metadata;ii!=null&&ii.totalTokenCount&&(Ze=ii.totalTokenCount),mn.timestamp&&(ht=mn.timestamp),mn.id&&(an=mn.id);const jn=mn.invocationId??mn.invocation_id;jn&&(Wr=jn);const ds=De.blocks,ai={author:At||void 0,tokens:Ze||void 0,ts:ht,eventId:an||void 0,invocationId:Wr||void 0};j(je,Ri=>{var Li;const er=Ri.slice(),oa=er[er.length-1];return(oa==null?void 0:oa.role)==="assistant"&&(!((Li=oa.meta)!=null&&Li.author)||oa.meta.author===At)?er[er.length-1]={...oa,blocks:ds,meta:ai}:er.push({role:"assistant",blocks:ds,meta:ai}),er})}sh(n)}catch(De){(De==null?void 0:De.name)!=="AbortError"&&!Ge.signal.aborted&&ze.current===je&&Re(String(De))}finally{oe.current.get(je)===Ge&&oe.current.delete(je),Oe(je,!1),tt(je),nn(De=>({...De,[je]:""})),Jn(De=>({...De,[je]:[]}))}}function $5($,K){var Me,Se;const ae=((Me=$==null?void 0:$.event)==null?void 0:Me.name)??K.id,ge=((Se=$==null?void 0:$.event)==null?void 0:Se.context)??{};__(`[ui-action] ${ae}: ${JSON.stringify(ge)}`)}async function H5($){var De,At,Ze;if(!$.authUri)throw new Error("事件中没有授权地址。");if(!n||!Z||!a)throw new Error("会话尚未就绪。");const K=a,ae=await Rye($.authUri),ge=Lye($.authConfig,ae),Me=ht=>ht.map(an=>an.kind==="auth"&&!an.done?{...an,done:!0}:an);j(K,ht=>{const an=ht.slice(),Wr=an[an.length-1];return(Wr==null?void 0:Wr.role)==="assistant"&&(an[an.length-1]={...Wr,blocks:Me(Wr.blocks)}),an});const Se=M[M.length-1],je=Me(Se&&Se.role==="assistant"?Se.blocks:[]),Ge=new AbortController;oe.current.set(K,Ge),Oe(K,!0),Ye(K);try{let ht=zs(),an=((De=Se==null?void 0:Se.meta)==null?void 0:De.author)??"",Wr=je,mn=0,Ii=Date.now()/1e3,Oi=((At=Se==null?void 0:Se.meta)==null?void 0:At.eventId)??"",ii=((Ze=Se==null?void 0:Se.meta)==null?void 0:Ze.invocationId)??"";for await(const jn of Yd({appName:n,userId:Z,sessionId:a,text:"",functionResponses:[{id:$.callId,name:"adk_request_credential",response:ge}],signal:Ge.signal,sessionCapabilities:Ee!==null})){if(Ge.signal.aborted)break;q(K,jn);const ds=jn.author&&jn.author!=="user"?jn.author:"";ds&&ds!==an&&(an=ds,Wr=[],ht=zs()),ht=Ec(ht,jn);const ai=jn.usageMetadata??jn.usage_metadata;ai!=null&&ai.totalTokenCount&&(mn=ai.totalTokenCount),jn.timestamp&&(Ii=jn.timestamp),jn.id&&(Oi=jn.id);const Ri=jn.invocationId??jn.invocation_id;Ri&&(ii=Ri);const er=[...Wr,...ht.blocks];j(K,oa=>{var C_,I_,O_,R_,L_;const Li=oa.slice(),Kn=Li[Li.length-1],A_={author:an||((C_=Kn==null?void 0:Kn.meta)==null?void 0:C_.author),tokens:mn||((I_=Kn==null?void 0:Kn.meta)==null?void 0:I_.tokens),ts:Ii,eventId:Oi||((O_=Kn==null?void 0:Kn.meta)==null?void 0:O_.eventId),invocationId:ii||((R_=Kn==null?void 0:Kn.meta)==null?void 0:R_.invocationId)};return(Kn==null?void 0:Kn.role)==="assistant"&&(!((L_=Kn.meta)!=null&&L_.author)||Kn.meta.author===an)?Li[Li.length-1]={...Kn,blocks:er,meta:A_}:Li.push({role:"assistant",blocks:er,meta:A_}),Li})}sh(n)}catch(ht){(ht==null?void 0:ht.name)!=="AbortError"&&!Ge.signal.aborted&&ze.current===K&&Re(String(ht))}finally{oe.current.get(K)===Ge&&oe.current.delete(K),Oe(K,!1),tt(K),nn(ht=>({...ht,[K]:""})),Jn(ht=>({...ht,[K]:[]}))}}if(It)return l.jsxs("div",{className:"boot boot-error",children:[l.jsx("p",{children:It}),l.jsx("button",{type:"button",onClick:T0,children:"重试"})]});if(nt===null)return l.jsx("div",{className:"boot"});if(nt==="unauthenticated")return l.jsx(oye,{branding:Tn,onUsername:R5});if(!Ve)return l.jsx("div",{className:"boot"});const si=Ve.capabilities.createAgents,k_=Ve.capabilities.manageAgents,Ls=si?pe:null,ah=si&&iu,oh=si&&lr,A0=p5,N_=xM(e,w0),ou=N_.filter($=>$.runtimeId&&(m_===null||m_.has($.runtimeId))).map($=>{var K;return{...$,canDelete:$.runtimeId?((K=y5[$.runtimeId])==null?void 0:K.canDelete)===!0:!1}}),z5=(()=>{if(ou.length===0)return ou;const $=new Map(h_.map((K,ae)=>[K,ae]));return[...ou].sort((K,ae)=>{const ge=$.get(K.id),Me=$.get(ae.id);return ge!=null&&Me!=null?ge-Me:ge!=null?-1:Me!=null?1:ou.indexOf(K)-ou.indexOf(ae)})})(),C0=$=>{var K;return((K=N_.find(ae=>ae.id===$))==null?void 0:K.label)??$},Yr=w0.find($=>$.runtimeId&&$.apps.some(K=>Bo($.id,K)===n)),I0=Yr&&Yr.runtimeId?{runtimeId:Yr.runtimeId,name:Yr.name,region:Yr.region??"cn-beijing"}:void 0,S_=async($,K)=>{var je,Ge;const ae=(je=$.meta)==null?void 0:je.eventId,ge=a;if(!ae||!ge||!I0)return;const Me=(Ge=$.meta)==null?void 0:Ge.feedback,Se={...Me,rating:K,syncStatus:"syncing",updatedAt:Date.now()/1e3};j(ge,De=>De.map(At=>{var Ze;return((Ze=At.meta)==null?void 0:Ze.eventId)===ae?{...At,meta:{...At.meta,feedback:Se}}:At})),Pt(De=>new Set(De).add(ae));try{const De=await zL({appName:n,userId:Z,sessionId:ge,eventId:ae,rating:K});j(ge,At=>At.map(Ze=>{var ht;return((ht=Ze.meta)==null?void 0:ht.eventId)===ae?{...Ze,meta:{...Ze.meta,feedback:De}}:Ze})),i(At=>At.map(Ze=>Ze.id===ge?{...Ze,state:{...Ze.state??{},[`veadk_feedback:${ae}`]:De}}:Ze))}catch(De){j(ge,At=>At.map(Ze=>{var ht;return((ht=Ze.meta)==null?void 0:ht.eventId)===ae?{...Ze,meta:{...Ze.meta,feedback:Me}}:Ze})),ze.current===ge&&Re(De instanceof Error?De.message:String(De))}finally{Pt(De=>{const At=new Set(De);return At.delete(ae),At})}},T_=$=>{il(ps()),ze.current="",o(""),r($)};return l.jsxs("div",{className:"layout",children:[l.jsx(Xz,{branding:Tn,access:Ve,features:ut,sessions:s,currentSessionId:a,streamingSids:St,onNewChat:()=>{ve(null),Ct(!1),sn(!1),zn(!1),Rs(!1),Vn(!1),ll()},onSearch:()=>{p&&eo(),ve(null),Ct(!1),sn(!1),zn(!1),Vn(!1),Rs(!0),Re("")},onQuickCreate:()=>{if(!si){Re("当前账号没有添加 Agent 的权限。");return}p&&eo(),ze.current="",o(""),Ct(!1),sn(!1),Rs(!1),Vn(!1),ve(null),wr(null),zn(!0),Re("")},onSkillCenter:()=>{p&&eo(),ve(null),sn(!1),zn(!1),Rs(!1),Vn(!1),Ct(!0),Re("")},onAddAgent:()=>{if(!si){Re("当前账号没有添加 Agent 的权限。");return}p&&eo(),ze.current="",ve(null),Ct(!1),Rs(!1),Vn(!1),o(""),zn(!1),sn(!0),Re("")},onManageAgents:()=>{p&&eo(),ze.current="",o(""),ve(null),Ct(!1),sn(!1),zn(!1),Rs(!1),Vn(!0),Re(""),b_()},onPickSession:$=>{ve(null),Ct(!1),sn(!1),zn(!1),Rs(!1),Vn(!1),Re(""),ih($)},onDeleteSession:F5,userInfo:_e,version:os,onLogout:L5}),(()=>{const $=l.jsxs("div",{className:`composer-slot${p?" sandbox-composer-wrap":""}`,children:[p&&l.jsx(J0e,{onExit:ll}),l.jsx(fpe,{sessionId:p?p.id:a,sessionInitializing:!p&&u,appName:n,agentName:p?"AgentKit 沙箱":n?C0(n):"Agent",value:T,onChange:L,onSubmit:()=>{if(!p&&R==="skill-create"){const Me=T.trim();if(!Me||ie)return;const Se={id:`pending-${Date.now()}`,prompt:Me,status:"provisioning",candidates:Wv.map((Ge,De)=>({id:`pending-${De}`,model:Ge,modelLabel:Ge,status:"queued",stage:"provisioning",files:[],activities:[{id:"provisioning",kind:"status",text:"正在拉起 Sandbox",status:"running"}]}))};G(!0);const je=++re.current;Re(""),P(Se),L(""),A0e(Me,Ge=>{re.current===je&&P(Ge)}).then(Ge=>{re.current===je&&P(Ge)}).catch(Ge=>{re.current===je&&(P(null),L(Me),Re(Ge instanceof Error?Ge.message:String(Ge)))}).finally(()=>{re.current===je&&G(!1)});return}const K=T;if(L(""),p){B5(K);return}const ae=ue,ge=le;ee([]),ne(Di()),__(K,ae,ge),Ab(ae)},disabled:p?!1:!Z||R==="temporary"||R==="agent"&&!n,busy:p?g:R==="skill-create"?ie:xr,showMeta:M.length>0&&!p,attachments:p?[]:ue,skills:p?[]:Xf,agents:p?[]:Qf,invocation:p?Di():le,capabilitiesLoading:!p&&te,allowAttachments:!p,onInvocationChange:ne,onAddFiles:U5,onRemoveAttachment:Zf,newChatMode:p?"agent":R,newChatLayout:!p&&M.length===0&&W===null,showModeSelector:!p&&M.length===0&&W===null,temporaryEnabled:I.temporaryEnabled,skillCreateEnabled:I.skillCreateEnabled,onModeChange:K=>{if(!(K==="temporary"&&!I.temporaryEnabled||K==="skill-create"&&!I.skillCreateEnabled)){if(K==="temporary"){F(K),j5();return}if(F(K),Re(""),K==="skill-create"){ne(Di());const ae=a&&X.length===0&&ue.length>0?a:"";nl(ue),ee([]),ae&&(ze.current="",o(""),sl(ae))}}}})]});return l.jsxs("section",{className:"main-shell",children:[l.jsx(dV,{appName:n,onAppChange:T_,agentLabel:C0,agentsSource:Ft,localApps:e,currentRuntime:I0,runtimeScope:Ve.capabilities.runtimeScope,title:ah?"添加 Agent":oh?"添加 AgentKit 智能体":A0?"智能体":void 0,titleLeading:M.length>0&&!p&&R==="agent"&&!ah&&!oh&&!In&&!E0&&!A0&&Ls===null&&n?l.jsx("button",{ref:xt,type:"button",className:"agent-info-trigger","aria-label":"查看 Agent 信息",title:"Agent 信息","aria-expanded":Xe,onClick:()=>ft(!0),children:l.jsx(xc,{})}):void 0,crumbs:In?[{label:"技能中心"},{label:"AgentKit Skill 空间"}]:E0||oh||ah||!Ls?void 0:Ls==="menu"?[{label:xye,onClick:()=>{ve(null),wr(null),zn(!0)}},{label:"从 0 快速创建"}]:[{label:"从 0 快速创建",onClick:()=>th(!0)},{label:wye[Ls]}],rightContent:l.jsxs(l.Fragment,{children:[Ve.role==="admin"&&l.jsx(x0e,{}),l.jsx(jye,{tasks:si?Qe:[],onCancel:pn})]})}),l.jsxs("main",{className:`main${p?" is-sandbox-session":""}`,children:[Tt&&l.jsx("div",{className:"error",children:Tt}),En&&l.jsxs("div",{className:"session-loading",children:[l.jsx(Rt,{className:"icon spin"})," 加载会话…"]}),A0?l.jsx(vhe,{agents:z5,drafts:f_,agentOrder:h_,selectedAgentId:n,agentInfo:me,agentInfoAgentId:n,loadingAgentInfo:te,canCreate:si,canUpdate:si||k_,loadingAgents:m5,agentsError:g5,deploymentTasks:Qe,focusedDeploymentTaskId:b5,focusedAgentId:E5,onRetryAgents:()=>void b_(),onAgentOrderChange:_5,onDeleteAgents:k5,onDeleteDrafts:v5,onSelectAgent:T_,onCreateAgent:()=>{if(!si){Re("当前账号没有添加 Agent 的权限。");return}Vn(!1),zn(!0),ve(null),wr(null),ri(null),Os(""),us.current=null,Ai(""),Ci(""),Re("")},onUpdateAgent:K=>{if(!k_&&!si){Re("当前账号没有管理 Agent 的权限。");return}if(!(Yr!=null&&Yr.runtimeId)){Re("仅支持更新已部署的云端智能体。");return}Vn(!1),wr(K);const ae=`runtime-${Yr.runtimeId}`;Os(ae),us.current=f_.find(ge=>ge.id===ae)??null,Ai(""),Ci(""),ri({runtimeId:Yr.runtimeId,name:Yr.name,region:Yr.region??"cn-beijing",currentVersion:Yr.currentVersion}),ve("custom"),Re("")},onEditDraft:K=>{Vn(!1),wr(K.draft),Os(K.id),us.current=K,ri(K.deploymentTarget??null),Ai(""),Ci(""),ve("custom"),Re("")}}):ah?l.jsx(G4,{title:"您想以哪种方式添加 Agent 来运行?",sub:"选择最适合你的方式,下一步即可开始",cards:[{key:"scratch",icon:Sye,title:"从 0 快速创建",desc:"用智能 / 自定义 / 模板 / 工作流的方式从零创建一个 Agent。",onClick:()=>{zn(!1),wr(null),ve("menu")}},{key:"package",icon:wH,title:"从代码包添加和部署",desc:"上传 Agent 项目压缩包,查看代码并直接部署到 AgentKit Runtime。",onClick:()=>{zn(!1),wr(null),ve("package")}}]}):E0?l.jsx(zz,{userId:Z,appId:n,agentInfo:me,capabilitiesLoading:te,agentLabel:C0,onOpenSession:M5}):oh?l.jsx(dre,{onAdded:K=>{il(ps()),sn(!1),r(K)},onCancel:()=>sn(!1)}):In?l.jsx(ure,{}):Ls!==null&&!Mn?l.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:12,height:"100%",padding:24,textAlign:"center",color:"var(--text-secondary, #6b7280)"},children:[l.jsx("div",{style:{fontSize:18,fontWeight:600},children:"需要配置火山引擎 AK/SK"}),l.jsxs("div",{style:{maxWidth:420,lineHeight:1.6},children:["智能体工作台需要 Volcengine 凭据才能使用。请在运行环境中设置"," ",l.jsx("code",{children:"VOLCENGINE_ACCESS_KEY"})," 与"," ",l.jsx("code",{children:"VOLCENGINE_SECRET_KEY"})," 后重试。"]})]}):Ls==="menu"?l.jsx(Lme,{onSelect:K=>{wr(null),ri(null),Ai(""),Ci(""),Os(K==="custom"?`draft-${Date.now().toString(36)}`:""),us.current=null,ve(K)},onImport:K=>{wr(K),ri(null),Ai(""),Ci(""),Os(`draft-${Date.now().toString(36)}`),us.current=null,ve("custom")}}):Ls==="intelligent"?l.jsx(sge,{userId:Z,onBack:()=>ve("menu"),onCreate:rh,onAgentAdded:N0,onDeploymentTaskChange:rn}):Ls==="custom"?l.jsx(Gge,{initialDraft:h5??void 0,onBack:()=>ve("menu"),onCreate:rh,onAgentAdded:N0,features:ut,onDeploymentTaskChange:rn,deploymentTarget:al??void 0,onDraftChange:(K,ae)=>{Lr&&(ae?w5(Lr,K,al??void 0):y_(Lr))},onDiscard:Lr?()=>{y_(Lr),Os(""),us.current=null,wr(null),ri(null),Ai(""),Ci(n),ve(null),zn(!1),Vn(!0),Re("")}:void 0,onDeploymentStarted:N5,onDeploymentComplete:S5},Lr||"custom"):Ls==="template"?l.jsx(Qge,{onBack:()=>ve("menu"),onCreate:rh}):Ls==="workflow"?l.jsx(i0e,{onBack:()=>ve("menu"),onCreate:rh}):Ls==="package"?l.jsx(u0e,{onBack:()=>{ve(null),zn(!0)},onAgentAdded:N0,onDeploymentTaskChange:rn}):M.length===0&&W?l.jsx(z0e,{initialJob:W}):M.length===0?l.jsxs("div",{className:"welcome",children:[l.jsx(ta,{as:"h1",className:"welcome-title",duration:4.8,spread:22,children:p?"让灵感在临时空间里自由生长":R==="skill-create"?"想创建一个什么 Skill?":fe}),$]}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:`transcript${Ga?" is-streaming":""}`,ref:au,onScroll:T5,onWheel:A5,onTouchMove:C5,children:M.map((K,ae)=>{var mn,Ii,Oi,ii,jn;const ge=ae===M.length-1;if(K.role==="user"){const ds=K.blocks.map(er=>er.kind==="text"?er.text:"").join(""),ai=K.blocks.flatMap(er=>er.kind==="attachment"?er.files:[]),Ri=K.blocks.find(er=>er.kind==="invocation");return l.jsxs($t.div,{className:"turn turn--user",initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[(Ri==null?void 0:Ri.kind)==="invocation"&&l.jsx(zv,{value:Ri.value}),ai.length>0&&l.jsx(Kv,{appName:n,items:ai}),ds&&l.jsx("div",{className:"bubble",children:l.jsx(Mf,{text:ds})}),l.jsxs("div",{className:"turn-actions turn-actions--right",children:[((mn=K.meta)==null?void 0:mn.ts)&&l.jsx("span",{className:"meta-text",children:f5(K.meta.ts)}),l.jsx(vC,{text:ds})]})]},ae)}const Me=((Ii=K.meta)==null?void 0:Ii.author)??"",Se=Me&&Hn?JE(Hn,Me):void 0,je=!!(Me&&Qa.length>0&&!Qa.includes(Me)),Ge=(Se==null?void 0:Se.name)||Me,De=(Se==null?void 0:Se.description)||(je?"正在执行主 Agent 移交的任务。":"");if(K.blocks.length>0&&K.blocks.every(ds=>ds.kind==="agent-transfer"))return null;const At=K.blocks.length===0,Ze=((ii=(Oi=K.meta)==null?void 0:Oi.feedback)==null?void 0:ii.rating)??null,ht=((jn=K.meta)==null?void 0:jn.eventId)??"",an=kt.has(ht),Wr=!!(I0&&ht&&wC(K));return l.jsxs($t.div,{className:`turn turn--assistant${je?" turn--subagent":""}`,initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[je&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"subagent-run-label",children:[l.jsxs("span",{className:"subagent-run-handoff",children:[l.jsx(yH,{}),l.jsx("span",{children:"智能体移交"})]}),l.jsx("span",{className:"subagent-run-title",children:Ge})]}),l.jsx("p",{className:"subagent-run-description",title:De,children:De})]}),At?ge&&Kr?l.jsx(Y4,{}):null:l.jsxs(l.Fragment,{children:[l.jsx(Yv,{appName:n,blocks:K.blocks,streaming:ge&&(Kr||Rr),onStreamFrame:ge?I5:void 0,onAction:$5,onAuth:H5}),!(ge&&Kr)&&!Iye(K)&&l.jsx("div",{className:"turn-empty",children:"本次没有返回可显示的内容。"}),!(ge&&Kr)&&!Oye(K)&&l.jsxs("div",{className:"turn-meta",children:[l.jsxs("div",{className:"turn-actions",children:[Wr&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:`icon-btn feedback-btn${Ze==="good"?" feedback-btn--good":""}`,"aria-label":"赞","aria-pressed":Ze==="good","aria-busy":an,title:Ze==="good"?"取消点赞":"赞",disabled:an,onClick:()=>void S_(K,Ze==="good"?null:"good"),children:l.jsx(eye,{className:"icon",filled:Ze==="good"})}),l.jsx("button",{type:"button",className:`icon-btn feedback-btn${Ze==="bad"?" feedback-btn--bad":""}`,"aria-label":"踩","aria-pressed":Ze==="bad","aria-busy":an,title:Ze==="bad"?"取消点踩":"踩",disabled:an,onClick:()=>void S_(K,Ze==="bad"?null:"bad"),children:l.jsx(tye,{className:"icon",filled:Ze==="bad"})})]}),!p&&l.jsx("button",{className:"icon-btn",title:"Tracing 火焰图",onClick:()=>bn(!0),children:l.jsx(Tye,{})}),l.jsx(vC,{text:wC(K)})]}),K.meta&&l.jsx("span",{className:"meta-text",children:Aye(K.meta)})]})]})]},ae)})}),!p&&l.jsx(RM,{appName:n,info:me,loading:te,activeAgent:qa,seenAgents:Xa,execPath:Si,capabilities:Ee,capabilityLoading:Ke,capabilityMutating:Ue,builtinTools:it,onAddCapability:w_,onRemoveCapability:K=>void v_(K)}),l.jsx("div",{className:"conversation-composer-slot",children:$})]})]})]})})(),Bt&&a&&l.jsx(iye,{appName:n,sessionId:a,onClose:()=>bn(!1)}),Xe&&M.length>0&&l.jsx(CV,{appName:n,info:me,loading:te,activeAgent:qa,seenAgents:Xa,execPath:Si,capabilities:Ee,capabilityLoading:Ke,capabilityMutating:Ue,builtinTools:it,onAddCapability:w_,onRemoveCapability:$=>void v_($),onClose:vt,returnFocusRef:xt}),l.jsx(Z0e,{open:b,state:k,error:C,onCancel:D5,onConfirm:()=>void P5()}),l.jsx(lye,{open:fn,checking:J,error:Le,onLogin:()=>void O5()}),x5&&l.jsx("div",{className:"confirm-scrim",onClick:()=>th(!1),children:l.jsxs("div",{className:"confirm-box",onClick:$=>$.stopPropagation(),children:[l.jsx("div",{className:"confirm-title",children:"返回创建首页?"}),l.jsx("div",{className:"confirm-text",children:"返回后当前填写的内容将会丢失,确定要返回吗?"}),l.jsxs("div",{className:"confirm-actions",children:[l.jsx("button",{className:"confirm-btn",onClick:()=>th(!1),children:"取消"}),l.jsx("button",{className:"confirm-btn confirm-btn--danger",onClick:()=>{wr(null),ve("menu"),th(!1)},children:"确定返回"})]})]})})]})}(()=>{if(!(window.opener&&window.opener!==window&&/[?&](code|state|error)=/.test(window.location.search)))return!1;try{window.opener.postMessage({veadkOAuth:!0,url:window.location.href},window.location.origin)}catch{}return window.close(),!0})()||Cb.createRoot(document.getElementById("root")).render(l.jsx(dt.StrictMode,{children:l.jsx(AF,{reducedMotion:"user",children:l.jsx(oH,{maskOpacity:.9,children:l.jsx(Bye,{})})})}));export{w as A,Bg as B,ts as C,zye as D,cd as E,Fo as F,w3 as G,Uye as R,yr as V,dt as a,kc as b,yT as c,Vye as d,qw as e,DW as f,Qd as g,_t as h,Jq as i,aX as j,BW as k,pf as l,aQ as m,$q as n,Hq as o,pQ as p,MX as q,jX as r,R3 as s,l as t,qe as u,Dt as v,yt as w,Hye as x,Qq as y,Ss as z}; diff --git a/veadk/webui/index.html b/veadk/webui/index.html index 32342d0d..e0e685bb 100644 --- a/veadk/webui/index.html +++ b/veadk/webui/index.html @@ -5,7 +5,7 @@ VeADK Studio - + From 09adb94ef7be08b760bf899805a15c7c1215db8e Mon Sep 17 00:00:00 2001 From: richarddancin Date: Tue, 28 Jul 2026 18:29:46 +0800 Subject: [PATCH 3/5] fix(studio): fallback skillspace detail lookup --- ...enerated_agent_backend_codegen_extended.py | 53 +++++++++++++++++++ veadk/cli/cli_frontend.py | 49 +++++++++++++---- veadk/cli/generated_agent_skills.py | 2 + 3 files changed, 93 insertions(+), 11 deletions(-) diff --git a/tests/cli/test_generated_agent_backend_codegen_extended.py b/tests/cli/test_generated_agent_backend_codegen_extended.py index 806a3bf4..9c7ad6f3 100644 --- a/tests/cli/test_generated_agent_backend_codegen_extended.py +++ b/tests/cli/test_generated_agent_backend_codegen_extended.py @@ -411,6 +411,59 @@ async def resolve(space_id: str, skill_id: str, version: str | None) -> str: assert [file.path for file in project.files] == ["skills/shared-skill/SKILL.md"] +@pytest.mark.asyncio +async def test_skillspace_materialization_passes_names_to_resolver() -> None: + skill = SelectedSkill( + source="skillspace", + folder="display-skill", + name="Display Skill", + skillSpaceId="space-1", + skillSpaceName="Demo Space", + skillSpaceRegion="cn-shanghai", + skillId="skill-1", + version="v1", + ) + draft = AgentDraft(name="root", selectedSkills=[skill]) + project = GeneratedProject(name="root", files=[]) + call: dict[str, object] = {} + + async def resolve( + space_id: str, + skill_id: str, + version: str | None, + region: str | None, + *, + skill_space_name: str | None = None, + skill_name: str | None = None, + ) -> str: + call.update( + { + "space_id": space_id, + "skill_id": skill_id, + "version": version, + "region": region, + "skill_space_name": skill_space_name, + "skill_name": skill_name, + } + ) + return "---\nname: display-skill\ndescription: Shared.\n---\n" + + await materialize_selected_skills( + draft, + project, + resolve_skillspace_detail=resolve, + ) + + assert call == { + "space_id": "space-1", + "skill_id": "skill-1", + "version": "v1", + "region": "cn-shanghai", + "skill_space_name": "Demo Space", + "skill_name": "Display Skill", + } + + @pytest.mark.asyncio async def test_skillspace_materialization_normalizes_legacy_frontmatter() -> None: skill = SelectedSkill( diff --git a/veadk/cli/cli_frontend.py b/veadk/cli/cli_frontend.py index a4ed3623..bee381e9 100644 --- a/veadk/cli/cli_frontend.py +++ b/veadk/cli/cli_frontend.py @@ -1686,23 +1686,50 @@ async def _resolve_skillspace_skill_md( skill_id: str, version: str | None, region: str | None = None, + *, + skill_space_name: str | None = None, + skill_name: str | None = None, ) -> str: - from agentkit.sdk.skills.types import GetSkillVersionRequest + from agentkit.sdk.skills.types import ( + GetSkillInfoRequest, + GetSkillVersionRequest, + ) + client = _skills_client(region or "cn-beijing") try: - client = _skills_client(region or "cn-beijing") resp = client.get_skill_version( GetSkillVersionRequest(id=skill_id, skill_version=version) ) - except HTTPException: - raise - except Exception as e: - logger.error( - f"GetSkillVersion({skill_id}@{version}) error for region " - f"{region or 'cn-beijing'}: {e}", - exc_info=True, - ) - raise HTTPException(status_code=502, detail=f"SkillSpaces API error: {e}") + except Exception as version_error: + if skill_space_name and skill_name: + try: + resp = client.get_skill_info( + GetSkillInfoRequest( + SkillName=skill_name, + SkillSpaceName=skill_space_name, + SkillSpaceId=space_id, + ) + ) + except Exception: + logger.error( + f"GetSkillVersion({skill_id}@{version}) error for region " + f"{region or 'cn-beijing'}: {version_error}", + exc_info=True, + ) + raise HTTPException( + status_code=502, + detail=f"SkillSpaces API error: {version_error}", + ) from version_error + else: + logger.error( + f"GetSkillVersion({skill_id}@{version}) error for region " + f"{region or 'cn-beijing'}: {version_error}", + exc_info=True, + ) + raise HTTPException( + status_code=502, + detail=f"SkillSpaces API error: {version_error}", + ) from version_error return await asyncio.to_thread( _skill_md_from_version_response, space_id=space_id, diff --git a/veadk/cli/generated_agent_skills.py b/veadk/cli/generated_agent_skills.py index a23b3f3b..29e64b91 100644 --- a/veadk/cli/generated_agent_skills.py +++ b/veadk/cli/generated_agent_skills.py @@ -126,6 +126,8 @@ async def _materialize_skillspace_skill( skill.skillId, skill.version or None, skill.skillSpaceRegion or None, + skill_space_name=skill.skillSpaceName or None, + skill_name=skill.name or None, ) except TypeError: skill_md = await resolver( From 421c0ecc0f18c2c4c6f28c857e13de8e1128cfec Mon Sep 17 00:00:00 2001 From: richarddancin Date: Tue, 28 Jul 2026 18:39:33 +0800 Subject: [PATCH 4/5] fix(studio): remove strict skill metadata validation --- ...enerated_agent_backend_codegen_extended.py | 5 +++-- veadk/cli/generated_agent_skills.py | 22 ++++--------------- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/tests/cli/test_generated_agent_backend_codegen_extended.py b/tests/cli/test_generated_agent_backend_codegen_extended.py index 9c7ad6f3..e8cd9b21 100644 --- a/tests/cli/test_generated_agent_backend_codegen_extended.py +++ b/tests/cli/test_generated_agent_backend_codegen_extended.py @@ -509,8 +509,8 @@ def _skill_zip(files: dict[str, str]) -> bytes: return output.getvalue() -def test_skillhub_zip_accepts_safe_files_and_rejects_path_escape() -> None: - skill_md = "---\nname: demo-skill\ndescription: Demo.\n---\n" +def test_skillhub_zip_accepts_safe_files_without_metadata_validation() -> None: + skill_md = "---\nname: clawhub/534422530/89d9f5\n---\n" files = _files_from_zip( _skill_zip({"SKILL.md": skill_md, "scripts/run.py": "print('ok')\n"}), "demo-skill", @@ -520,6 +520,7 @@ def test_skillhub_zip_accepts_safe_files_and_rejects_path_escape() -> None: "skills/demo-skill/SKILL.md", "skills/demo-skill/scripts/run.py", ] + assert files[0].content == skill_md with pytest.raises(DebugPolicyError, match="Illegal skill file path"): _files_from_zip( diff --git a/veadk/cli/generated_agent_skills.py b/veadk/cli/generated_agent_skills.py index 29e64b91..5a399808 100644 --- a/veadk/cli/generated_agent_skills.py +++ b/veadk/cli/generated_agent_skills.py @@ -135,7 +135,6 @@ async def _materialize_skillspace_skill( skill.skillId, skill.version or None, ) - _validate_skill_md(skill_md, f"SkillSpace skill {skill.skillId}") skill_md = _normalize_skill_md_frontmatter( skill_md, f"SkillSpace skill {skill.skillId}" ) @@ -188,7 +187,6 @@ def _files_from_zip(content: bytes, folder: str, label: str) -> list[GeneratedFi files.append(GeneratedFile(path=target, content=text)) if skill_md_content is None: raise DebugPolicyError(f"{label} is missing SKILL.md") - _validate_skill_md(skill_md_content, label) return files @@ -256,21 +254,6 @@ def _normalize_relative_path(path: str) -> str: return normalized -def _validate_skill_md(text: str, where: str) -> str: - meta, _ = _parse_skill_md(text, where) - name = str(meta.get("name") or "").strip() - description = str(meta.get("description") or "").strip() - if not name: - raise DebugPolicyError(f"{where} SKILL.md is missing name") - if len(name) > 64 or not re.fullmatch(r"[a-z0-9-]+", name): - raise DebugPolicyError(f"{where} SKILL.md name is invalid") - if not description: - raise DebugPolicyError(f"{where} SKILL.md is missing description") - if len(description) > 1024 or re.search(r"<[^>]+>", description): - raise DebugPolicyError(f"{where} SKILL.md description is invalid") - return name - - def _parse_skill_md(text: str, where: str) -> tuple[dict[str, object], str]: lines = (text or "").replace("\r\n", "\n").replace("\r", "\n").split("\n") if not lines or lines[0].strip() != "---": @@ -314,6 +297,9 @@ def _parse_legacy_frontmatter_lines(lines: list[str]) -> dict[str, object]: def _normalize_skill_md_frontmatter(text: str, where: str) -> str: - meta, body = _parse_skill_md(text, where) + try: + meta, body = _parse_skill_md(text, where) + except DebugPolicyError: + return text header = yaml.safe_dump(meta, allow_unicode=True, sort_keys=False).strip() return f"---\n{header}\n---\n{body}" From 7f418da9d42d5cb36f3fd371ba02ea6e69994d32 Mon Sep 17 00:00:00 2001 From: richarddancin Date: Tue, 28 Jul 2026 18:59:44 +0800 Subject: [PATCH 5/5] fix(studio): align skill folders with metadata names --- ...enerated_agent_backend_codegen_extended.py | 43 ++++++++++++ veadk/cli/generated_agent_skills.py | 65 +++++++++++++++++-- 2 files changed, 103 insertions(+), 5 deletions(-) diff --git a/tests/cli/test_generated_agent_backend_codegen_extended.py b/tests/cli/test_generated_agent_backend_codegen_extended.py index e8cd9b21..a3d4b590 100644 --- a/tests/cli/test_generated_agent_backend_codegen_extended.py +++ b/tests/cli/test_generated_agent_backend_codegen_extended.py @@ -464,6 +464,49 @@ async def resolve( } +@pytest.mark.asyncio +async def test_skillspace_materialization_aligns_folder_with_skill_md_name() -> None: + skill = SelectedSkill( + source="skillspace", + folder="intelligent-diagnosis-report", + name="intelligent-diagnosis-report", + skillSpaceId="space-1", + skillSpaceName="Demo Space", + skillId="skill-1", + version="v1", + ) + draft = AgentDraft(name="car", selectedSkills=[skill]) + project = generate_project_from_draft(draft) + + async def resolve( + space_id: str, + skill_id: str, + version: str | None, + region: str | None = None, + **_: object, + ) -> str: + del space_id, skill_id, version, region + return "---\nname: domain-test-skill\ndescription: Shared.\n---\n" + + await materialize_selected_skills( + draft, + project, + resolve_skillspace_detail=resolve, + ) + + files = _file_map(project) + agent_py = files["agents/car/agent.py"] + assert ( + 'load_skill_from_dir(_Path(__file__).parent.parent.parent / "skills" / ' + '"domain-test-skill")' + ) in agent_py + assert "'folder': 'domain-test-skill'" in agent_py + assert ' / "skills" / "intelligent-diagnosis-report")' not in agent_py + assert files["skills/domain-test-skill/SKILL.md"].startswith( + "---\nname: domain-test-skill\n" + ) + + @pytest.mark.asyncio async def test_skillspace_materialization_normalizes_legacy_frontmatter() -> None: skill = SelectedSkill( diff --git a/veadk/cli/generated_agent_skills.py b/veadk/cli/generated_agent_skills.py index 5a399808..f237e64f 100644 --- a/veadk/cli/generated_agent_skills.py +++ b/veadk/cli/generated_agent_skills.py @@ -53,6 +53,7 @@ async def materialize_selected_skills( ) -> None: existing = {file.path for file in project.files} for skill in _collect_selected_skills(draft): + original_folder = skill.folder if skill.source == "skillhub": files = await _download_skillhub_skill(skill) elif skill.source == "skillspace": @@ -63,6 +64,12 @@ async def materialize_selected_skills( ) else: files = _materialize_local_skill(skill) + if ( + skill.source != "local" + and original_folder + and original_folder != skill.folder + ): + _replace_project_skill_folder(project, original_folder, skill.folder) _append_skill_files(project, existing, files) @@ -110,7 +117,9 @@ async def _download_skillhub_skill(skill: SelectedSkill) -> list[GeneratedFile]: if len(content) > MAX_SKILL_TOTAL_BYTES: raise DebugPolicyError("Skill Hub zip is too large") folder = _safe_folder(skill.folder or slug.rsplit("/", 1)[-1] or "skill") - return _files_from_zip(content, folder, f"Skill Hub skill {slug}") + files = _files_from_zip(content, folder, f"Skill Hub skill {slug}") + skill.folder = _folder_from_generated_files(files) or folder + return files async def _materialize_skillspace_skill( @@ -138,6 +147,8 @@ async def _materialize_skillspace_skill( skill_md = _normalize_skill_md_frontmatter( skill_md, f"SkillSpace skill {skill.skillId}" ) + folder = _skill_md_folder_name(skill_md) or folder + skill.folder = folder return [GeneratedFile(path=f"skills/{folder}/SKILL.md", content=skill_md)] @@ -165,7 +176,7 @@ def _materialize_local_skill(skill: SelectedSkill) -> list[GeneratedFile]: def _files_from_zip(content: bytes, folder: str, label: str) -> list[GeneratedFile]: - files: list[GeneratedFile] = [] + extracted: list[tuple[str, str]] = [] total = 0 with zipfile.ZipFile(io.BytesIO(content)) as archive: infos = [info for info in archive.infolist() if not info.is_dir()] @@ -179,15 +190,18 @@ def _files_from_zip(content: bytes, folder: str, label: str) -> list[GeneratedFi if total > MAX_SKILL_TOTAL_BYTES: raise DebugPolicyError(f"{label} is too large") rel = _normalize_relative_path(info.filename) - target = f"skills/{folder}/{rel}" with archive.open(info) as fh: text = _decode_skill_file(fh.read(), f"{label} file {info.filename}") if _SKILL_MD_RE.search(rel): skill_md_content = text - files.append(GeneratedFile(path=target, content=text)) + extracted.append((rel, text)) if skill_md_content is None: raise DebugPolicyError(f"{label} is missing SKILL.md") - return files + folder = _skill_md_folder_name(skill_md_content) or folder + return [ + GeneratedFile(path=f"skills/{folder}/{rel}", content=text) + for rel, text in extracted + ] def _decode_skill_file(content: bytes, label: str) -> str: @@ -254,6 +268,47 @@ def _normalize_relative_path(path: str) -> str: return normalized +def _skill_md_folder_name(text: str) -> str | None: + try: + meta, _ = _parse_skill_md(text, "SKILL.md") + except DebugPolicyError: + return None + name = str(meta.get("name") or "").strip() + if _FOLDER_RE.fullmatch(name) and name not in {".", ".."}: + return name + return None + + +def _folder_from_generated_files(files: list[GeneratedFile]) -> str | None: + for file in files: + parts = PurePosixPath(file.path).parts + if len(parts) >= 3 and parts[0] == "skills": + return parts[1] + return None + + +def _py_string(value: str) -> str: + escaped = ( + (value or "").replace("\\", "\\\\").replace('"', '\\"').replace("\n", "\\n") + ) + return f'"{escaped}"' + + +def _replace_project_skill_folder( + project: GeneratedProject, old_folder: str, new_folder: str +) -> None: + old_loader = f'/ "skills" / {_py_string(old_folder)}' + new_loader = f'/ "skills" / {_py_string(new_folder)}' + old_draft_folder = f"'folder': '{old_folder}'" + new_draft_folder = f"'folder': '{new_folder}'" + for file in project.files: + if not file.path.endswith("/agent.py"): + continue + file.content = file.content.replace(old_loader, new_loader).replace( + old_draft_folder, new_draft_folder + ) + + def _parse_skill_md(text: str, where: str) -> tuple[dict[str, object], str]: lines = (text or "").replace("\r\n", "\n").replace("\r", "\n").split("\n") if not lines or lines[0].strip() != "---":