diff --git a/frontend/README.md b/frontend/README.md index 8244e1218..2c3cf2fd3 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -206,7 +206,12 @@ server that `veadk frontend` launches — no separate backend. input. Changing an authenticated MCP URL requires the user to enter a replacement Token, explicitly confirm reuse of the previous credential, or mark the new endpoint as unauthenticated; - Studio never silently replays a credential to a different endpoint. Long descriptions and prompts + Studio never silently replays a credential to a different endpoint. Feishu + App ID and App Secret are restored from the selected Runtime into the masked + update form and remain in the signed-in user's browser draft so a resumed + draft shows the same editable values. Disabling Feishu during an update + removes both Runtime variables; leaving it enabled preserves or replaces + them with the submitted values. Long descriptions and prompts scroll within bounded editors, while the sidebar stays pinned to the viewport. On narrow desktop windows, the structure, configuration, and debug panels stack vertically instead of squeezing the form. The deployment page diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index d5ecd890d..5b0e525c7 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -2083,6 +2083,7 @@ export default function App() { etag?: string; editMode?: "source-preserving" | "regenerate"; configuredMcpEnvKeys?: string[]; + configuredRuntimeEnvKeys?: string[]; } | null>(null); const [newRuntimeRegion, setNewRuntimeRegion] = useState( defaultCloudRegion(cloudProvider), @@ -6966,6 +6967,10 @@ export default function App() { const runtimeModel = modelConfigurationFromRuntime( runtimeAgent.model, ); + const feishuConfigured = + runtimeDraft.deployment?.feishuEnabled === true || + (runtimeEnv.has("FEISHU_APP_ID") && + runtimeEnv.has("FEISHU_APP_SECRET")); const hydratedDraft = hydrateA2aRegistryFromRuntime( hydrateRuntimeModelSelection( { @@ -6981,6 +6986,7 @@ export default function App() { ...(runtimeDraft.deployment ?? { feishuEnabled: false, }), + feishuEnabled: feishuConfigured, network: capability.runtime.network, envValues: runtimeEnvValues, }, @@ -7037,6 +7043,8 @@ export default function App() { ? "source-preserving" : "regenerate", configuredMcpEnvKeys: configuredMcpEnvKeys(classifiedDraft), + configuredRuntimeEnvKeys: + capability.runtime.configuredEnvKeys, }); setCreateView("custom"); setError(""); diff --git a/frontend/src/create/CustomCreate.tsx b/frontend/src/create/CustomCreate.tsx index d84a42abd..6590a1ffb 100644 --- a/frontend/src/create/CustomCreate.tsx +++ b/frontend/src/create/CustomCreate.tsx @@ -3593,6 +3593,7 @@ interface CustomCreateProps extends CreateModeProps { etag?: string; editMode?: "source-preserving" | "regenerate"; configuredMcpEnvKeys?: string[]; + configuredRuntimeEnvKeys?: string[]; }; /** Region selected before entering the create flow. */ initialDeployRegion?: string; @@ -4652,10 +4653,15 @@ export function CustomCreate({ ? mcpCredentialReuseValues(draft) : undefined, removeRuntimeEnvKeys: deploymentTarget - ? removedConfiguredMcpEnvKeys( - deploymentTarget.configuredMcpEnvKeys ?? [], - draft, - ) + ? [ + ...removedConfiguredMcpEnvKeys( + deploymentTarget.configuredMcpEnvKeys ?? [], + draft, + ), + ...(!draft.deployment?.feishuEnabled + ? ["FEISHU_APP_ID", "FEISHU_APP_SECRET"] + : []), + ] : undefined, description: draft.description, harnessSidecar: draft.harnessSidecar, @@ -6056,7 +6062,10 @@ export function CustomCreate({ onDeploymentStarted={onDeploymentStarted} onDeploymentComplete={onDeploymentComplete} feishuEnabled={!!draft.deployment?.feishuEnabled} - onFeishuEnabledChange={(feishuEnabled) => { + configuredRuntimeEnvKeys={ + deploymentTarget?.configuredRuntimeEnvKeys + } + onFeishuEnabledChange={async (feishuEnabled) => { const nextDraft: AgentDraft = { ...draft, deployment: { @@ -6064,7 +6073,11 @@ export function CustomCreate({ feishuEnabled, }, }; + const generated = await generateAgentProject( + codegenDraft(nextDraft), + ); setDraft(nextDraft); + setProject(generated); }} deploymentEnv={deploymentEnv.specs} requiredSecretEnv={customModelCredentials} diff --git a/frontend/src/create/agentDraftStorage.ts b/frontend/src/create/agentDraftStorage.ts index a30d1afe7..e6d65263d 100644 --- a/frontend/src/create/agentDraftStorage.ts +++ b/frontend/src/create/agentDraftStorage.ts @@ -20,6 +20,7 @@ export interface WorkspaceAgentDraft { etag?: string; editMode?: "source-preserving" | "regenerate"; configuredMcpEnvKeys?: string[]; + configuredRuntimeEnvKeys?: string[]; }; } diff --git a/frontend/src/create/veadkCatalog.ts b/frontend/src/create/veadkCatalog.ts index 15e74fb73..47637ab74 100644 --- a/frontend/src/create/veadkCatalog.ts +++ b/frontend/src/create/veadkCatalog.ts @@ -132,6 +132,7 @@ export const FEISHU_ENV: EnvVar[] = [ required: true, placeholder: "输入 App Secret", comment: "飞书应用 App Secret", + secret: true, }, ]; diff --git a/frontend/src/ui/ProjectPreview.tsx b/frontend/src/ui/ProjectPreview.tsx index 5163685f2..a69f53ba5 100644 --- a/frontend/src/ui/ProjectPreview.tsx +++ b/frontend/src/ui/ProjectPreview.tsx @@ -64,7 +64,6 @@ import { } from "../create/veadkCatalog"; import { firstInvalidRuntimeEnv, - firstMissingRuntimeEnv, missingRuntimeEnvs, runtimeEnvDisplayRows, runtimeEnvJsonError, @@ -695,6 +694,8 @@ export interface ProjectPreviewProps { feishuEnabled?: boolean; /** Update the Feishu channel selection from the deploy page. */ onFeishuEnabledChange?: (enabled: boolean) => void | Promise; + /** Runtime keys whose values remain configured but are not returned to the browser. */ + configuredRuntimeEnvKeys?: readonly string[]; /** Environment variables required by the selected memory/knowledge backends. */ deploymentEnv?: RuntimeEnvSpec[]; /** Required deployment secrets kept only in this mounted publish page. */ @@ -840,6 +841,7 @@ export function ProjectPreview({ onDeploymentTaskChange, feishuEnabled = false, onFeishuEnabledChange, + configuredRuntimeEnvKeys = [], deploymentEnv = [], requiredSecretEnv = [], requiredSecretEnvValues, @@ -864,6 +866,10 @@ export function ProjectPreview({ }: ProjectPreviewProps) { const editable = typeof onChange === "function"; const isRuntimeUpdate = Boolean(deploymentRuntimeId); + const configuredRuntimeEnvKeySet = useMemo( + () => new Set(configuredRuntimeEnvKeys), + [configuredRuntimeEnvKeys], + ); const inMemorySession = usesInMemorySession(agentDraft); const runtimeNameSource = agentName?.trim() || agentDraft?.name || project.name; @@ -1505,9 +1511,10 @@ export function ProjectPreview({ return; } if (feishuEnabled) { - const missingFeishuEnv = firstMissingRuntimeEnv( - FEISHU_ENV, - deploymentEnvValues, + const missingFeishuEnv = FEISHU_ENV.find( + (env) => + !String(deploymentEnvValues[env.key] ?? "").trim() && + !configuredRuntimeEnvKeySet.has(env.key), ); if (missingFeishuEnv) { const env = FEISHU_ENV.find((item) => item.key === missingFeishuEnv.key); @@ -2628,7 +2635,11 @@ export function ProjectPreview({ env.key.includes("SECRET") ? "password" : "text" } value={deploymentEnvValues[env.key] ?? ""} - placeholder={env.placeholder} + placeholder={ + configuredRuntimeEnvKeySet.has(env.key) + ? "已配置,留空沿用" + : env.placeholder + } tabIndex={feishuEnabled ? 0 : -1} disabled={ !feishuEnabled || diff --git a/frontend/tests/agentDraftStorage.test.mjs b/frontend/tests/agentDraftStorage.test.mjs index 1539a72d3..240961b04 100644 --- a/frontend/tests/agentDraftStorage.test.mjs +++ b/frontend/tests/agentDraftStorage.test.mjs @@ -56,7 +56,7 @@ function memoryStorage(initial = {}) { }; } -test("keeps MCP credentials ephemeral while preserving non-MCP deployment values", () => { +test("keeps MCP credentials ephemeral while preserving deployment values", () => { const sourceDraft = draft({ mcpTools: [{ name: "root", transport: "http", authToken: "root-secret" }], deployment: { feishuEnabled: true, envValues: { FEISHU_APP_SECRET: "secret" } }, @@ -108,6 +108,139 @@ test("keeps MCP credentials ephemeral while preserving non-MCP deployment values ); }); +test("persists every editable draft property including Feishu credentials", () => { + const storage = memoryStorage(); + const completeDraft = draft({ + description: "complete description", + instruction: "complete instruction", + dynamicAgentDelegation: true, + agentType: "llm", + cloudProvider: "byteplus", + maxIterations: 7, + a2aUrl: "https://agent.example.com", + model: "legacy-model", + modelSource: "custom", + modelName: "custom-model", + modelProvider: "openai", + modelApiBase: "https://model.example.com/v1", + tools: ["legacy-tool"], + skills: ["legacy-skill"], + memory: { shortTerm: true, longTerm: true }, + knowledgebase: true, + tracing: true, + builtinTools: ["web_search"], + customTools: [{ name: "lookup", description: "lookup records" }], + mcpTools: [ + { + name: "orders", + transport: "http", + url: "https://mcp.example.com/mcp", + authTokenEnv: "MCP_ORDERS_TOKEN", + credentialConfigured: true, + credentialSourceUrl: "https://mcp.example.com/mcp", + credentialSourceAuthTokenEnv: "MCP_ORDERS_TOKEN", + }, + ], + a2aRegistry: { + enabled: true, + registrySpaceId: "space-1", + registryTopK: "5", + registryRegion: "ap-southeast-1", + registryEndpoint: "https://registry.example.com", + }, + shortTermBackend: "redis", + longTermBackend: "viking", + longTermMemoryIndex: "memory-index", + autoSaveSession: true, + knowledgebaseBackend: "viking", + knowledgebaseIndex: "knowledge-index", + tracingExporters: ["tls"], + selectedSkills: [ + { + source: "runtime", + folder: "ops", + name: "ops", + description: "operations", + }, + ], + cloudEnvironment: { + environmentId: "environment-1", + environmentVersionId: "version-2", + cliTools: ["lark-cli"], + dockerfile: "RUN echo ready", + }, + harnessSidecar: { + enabled: true, + profile: "default", + componentOverrides: { + context_engine: true, + compressor: false, + verifier: true, + long_run_control: false, + mcp_resilience: true, + }, + catalogVersion: "catalog-1", + planHash: "sha256:plan", + }, + deployment: { + feishuEnabled: true, + runtimeName: "runtime-name", + runtimeNameCustomized: true, + network: { + mode: "both", + vpcId: "vpc-1", + subnetIds: "subnet-1,subnet-2", + enableSharedInternetAccess: true, + }, + modelApiKeyId: "key-id", + modelApiKeyName: "key-name", + envValues: { + FEISHU_APP_ID: "cli_test", + FEISHU_APP_SECRET: "persisted-feishu-secret", + CUSTOM_SETTING: "custom-value", + }, + }, + }); + + writeWorkspaceDrafts(storage, "complete-builder", [ + { + id: "complete-draft", + updatedAt: 123, + creationMode: "quick", + deploymentTarget: { + runtimeId: "runtime-1", + name: "runtime-name", + region: "ap-southeast-1", + appName: "complete_app", + currentVersion: 3, + etag: "etag-1", + editMode: "source-preserving", + configuredMcpEnvKeys: ["MCP_ORDERS_TOKEN"], + configuredRuntimeEnvKeys: ["OPAQUE_RUNTIME_SECRET"], + }, + draft: completeDraft, + }, + ]); + + const [loaded] = loadWorkspaceDrafts(storage, "complete-builder"); + assert.equal(loaded.creationMode, "quick"); + assert.deepEqual(loaded.deploymentTarget, { + runtimeId: "runtime-1", + name: "runtime-name", + region: "ap-southeast-1", + appName: "complete_app", + currentVersion: 3, + etag: "etag-1", + editMode: "source-preserving", + configuredMcpEnvKeys: ["MCP_ORDERS_TOKEN"], + configuredRuntimeEnvKeys: ["OPAQUE_RUNTIME_SECRET"], + }); + const expectedDraft = structuredClone(completeDraft); + delete expectedDraft.mcpTools[0].credentialSourceUrl; + delete expectedDraft.mcpTools[0].credentialSourceAuthTokenEnv; + assert.deepEqual(loaded.draft, expectedDraft); +}); + test("writes a versioned user-scoped payload without transient MCP values", () => { const storage = memoryStorage(); writeWorkspaceDrafts(storage, "alice@example.com", [ diff --git a/frontend/tests/agentWorkspace.test.mjs b/frontend/tests/agentWorkspace.test.mjs index 208ef8411..99bd0a504 100644 --- a/frontend/tests/agentWorkspace.test.mjs +++ b/frontend/tests/agentWorkspace.test.mjs @@ -734,6 +734,10 @@ test("runtime updates use the Agent selected in management instead of the active /capability\.runtime\.envs[\s\S]*?filter\(\(\{ key \}\) => !isRuntimeModelSelectionEnv\(key\)\)[\s\S]*?\.map/, ); assert.match(handler, /envValues:\s*runtimeEnvValues/); + assert.match( + handler, + /runtimeEnv\.has\("FEISHU_APP_ID"\)[\s\S]*?runtimeEnv\.has\("FEISHU_APP_SECRET"\)/, + ); assert.doesNotMatch(handler, /draftEnvValues|selectedAgentUpdateDraft\?\.draft/); assert.match(handler, /hydrateRuntimeModelSelection\(/); assert.match( @@ -743,6 +747,10 @@ test("runtime updates use the Agent selected in management instead of the active assert.match(handler, /network:\s*capability\.runtime\.network/); assert.match(handler, /etag:\s*capability\.etag/); assert.match(handler, /editMode:\s*capability\.editMode/); + assert.match( + handler, + /configuredRuntimeEnvKeys:\s*capability\.runtime\.configuredEnvKeys/, + ); assert.match( handler, /setRuntimeUpdateTarget\(\{[\s\S]*?runtimeId:\s*capability\.runtime\.runtimeId,[\s\S]*?currentVersion:\s*capability\.runtime\.currentVersion,[\s\S]*?etag:\s*capability\.etag/, diff --git a/frontend/tests/deploymentEnv.test.mjs b/frontend/tests/deploymentEnv.test.mjs index 2de10d189..ffe7fc8e6 100644 --- a/frontend/tests/deploymentEnv.test.mjs +++ b/frontend/tests/deploymentEnv.test.mjs @@ -790,12 +790,11 @@ test("shows configured database and Feishu values in the runtime env summary", ( ]); }); -test("keeps the generated project stable when only deployment channel settings change", () => { +test("regenerates the project when deployment channel settings change", () => { assert.match( customCreateSource, - /onFeishuEnabledChange=\{\(feishuEnabled\) => \{[\s\S]*?setDraft\(nextDraft\);/, + /onFeishuEnabledChange=\{async \(feishuEnabled\) => \{[\s\S]*?generateAgentProject\([\s\S]*?codegenDraft\(nextDraft\)[\s\S]*?setDraft\(nextDraft\);[\s\S]*?setProject\(generated\);/, ); - assert.doesNotMatch(customCreateSource, /buildPreviewProject/); assert.match( customCreateSource, /const releaseDraft = releaseVariant[\s\S]*?releaseDraftFromDebugVariant\(providerDraft, releaseVariant\)[\s\S]*?generateAgentProject\(codegenDraft\(releaseDraft\)\)/, @@ -804,6 +803,25 @@ test("keeps the generated project stable when only deployment channel settings c assert.match(projectPreviewSource, /deploying \|\| feishuUpdating/); }); +test("restores Feishu credentials into Runtime updates and reuses opaque values", () => { + assert.match( + projectPreviewSource, + /value=\{deploymentEnvValues\[env\.key\] \?\? ""\}/, + ); + assert.match( + projectPreviewSource, + /configuredRuntimeEnvKeySet\.has\(env\.key\)[\s\S]*?已配置,留空沿用/, + ); + assert.match( + customCreateSource, + /deploymentEnvValues=\{\{[\s\S]*?\.\.\.providerDraft\.deployment\?\.envValues/, + ); + assert.match( + customCreateSource, + /removedConfiguredMcpEnvKeys\([\s\S]*?FEISHU_APP_ID[\s\S]*?FEISHU_APP_SECRET/, + ); +}); + test("normalizes generated project drafts to the selected cloud provider", () => { assert.match(customCreateSource, /function draftForCloudProvider/); assert.match( diff --git a/frontend/tests/runtimeAgentIdentity.test.mjs b/frontend/tests/runtimeAgentIdentity.test.mjs index f9d6572fd..aacf30c5e 100644 --- a/frontend/tests/runtimeAgentIdentity.test.mjs +++ b/frontend/tests/runtimeAgentIdentity.test.mjs @@ -277,7 +277,7 @@ test("quick Runtime recovery restores every field shown by the three-step editor longTermMemoryIndex: "memory-index-1", autoSaveSession: true, deployment: { - feishuEnabled: false, + feishuEnabled: true, runtimeName: "research-assistant-runtime", runtimeNameCustomized: true, network: { @@ -288,7 +288,11 @@ test("quick Runtime recovery restores every field shown by the three-step editor }, modelApiKeyId: "api-key-1", modelApiKeyName: "Production Ark key", - envValues: { REPORT_FORMAT: "markdown" }, + envValues: { + REPORT_FORMAT: "markdown", + FEISHU_APP_ID: "cli_test", + FEISHU_APP_SECRET: "feishu-secret", + }, }, }, }, @@ -345,7 +349,7 @@ test("quick Runtime recovery restores every field shown by the three-step editor longTermMemoryIndex: "memory-index-1", autoSaveSession: true, deployment: { - feishuEnabled: false, + feishuEnabled: true, runtimeName: "research-assistant-runtime", runtimeNameCustomized: true, network: { @@ -356,7 +360,11 @@ test("quick Runtime recovery restores every field shown by the three-step editor }, modelApiKeyId: "api-key-1", modelApiKeyName: "Production Ark key", - envValues: { REPORT_FORMAT: "markdown" }, + envValues: { + REPORT_FORMAT: "markdown", + FEISHU_APP_ID: "cli_test", + FEISHU_APP_SECRET: "feishu-secret", + }, }, }, ); diff --git a/tests/cli/test_runtime_update_recovery.py b/tests/cli/test_runtime_update_recovery.py index ed5ee0cc5..4151a3008 100644 --- a/tests/cli/test_runtime_update_recovery.py +++ b/tests/cli/test_runtime_update_recovery.py @@ -31,6 +31,8 @@ def test_runtime_environment_exposes_only_allowlisted_public_values() -> None: ("MODEL_AGENT_API_BASE", "https://model.example.com/v1"), ("MODEL_AGENT_API_KEY_ID", "key-id"), ("MODEL_AGENT_API_KEY_NAME", "key-name"), + ("FEISHU_APP_ID", "cli_public_app_id"), + ("FEISHU_APP_SECRET", "feishu-secret"), ("MODEL_AGENT_API_KEY", "model-secret"), ("MCP_API_KEY", "mcp-secret"), ( @@ -51,6 +53,8 @@ def test_runtime_environment_exposes_only_allowlisted_public_values() -> None: }, {"key": "MODEL_AGENT_API_KEY_ID", "value": "key-id"}, {"key": "MODEL_AGENT_API_KEY_NAME", "value": "key-name"}, + {"key": "FEISHU_APP_ID", "value": "cli_public_app_id"}, + {"key": "FEISHU_APP_SECRET", "value": "feishu-secret"}, ) assert set(view.configured_env_keys) == { "MODEL_AGENT_API_KEY", @@ -59,6 +63,7 @@ def test_runtime_environment_exposes_only_allowlisted_public_values() -> None: "CUSTOM_TOKEN", "ARBITRARY_PUBLIC_LOOKING_VALUE", } + assert {"key": "FEISHU_APP_SECRET", "value": "feishu-secret"} in (view.public_envs) serialized = json.dumps(view.as_payload()) for protected in ( "model-secret", diff --git a/tests/cli/test_studio_rbac.py b/tests/cli/test_studio_rbac.py index bc5bee607..7da6a3297 100644 --- a/tests/cli/test_studio_rbac.py +++ b/tests/cli/test_studio_rbac.py @@ -5119,6 +5119,8 @@ def test_update_deployment_reuses_owned_runtime_and_returns_new_version( SimpleNamespace(key="MODEL_AGENT_API_KEY", value="old-raw-model-key"), SimpleNamespace(key="MODEL_AGENT_API_KEY_ID", value="old-key-id"), SimpleNamespace(key="MODEL_AGENT_API_KEY_NAME", value="old-key-name"), + SimpleNamespace(key="FEISHU_APP_ID", value="cli_existing"), + SimpleNamespace(key="FEISHU_APP_SECRET", value="existing-feishu-secret"), SimpleNamespace(key="VEADK_DISABLE_EXPIRE_AT", value="true"), SimpleNamespace(key="HARNESS_SIDECAR_ENABLED", value="true"), SimpleNamespace(key="HARNESS_SIDECAR_EXPECTED_PLAN_HASH", value="sha256:old"), @@ -5260,12 +5262,53 @@ async def _mark_validated_oauth_token(request: Request, call_next): ) assert capability.status_code == 200 assert capability.json()["canUpdate"] is True + assert {"key": "FEISHU_APP_ID", "value": "cli_existing"} in ( + capability.json()["runtime"]["envs"] + ) + assert { + "key": "FEISHU_APP_SECRET", + "value": "existing-feishu-secret", + } in capability.json()["runtime"]["envs"] + assert ( + "FEISHU_APP_SECRET" not in capability.json()["runtime"]["configuredEnvKeys"] + ) recovered_mcp = capability.json()["agent"]["draft"]["mcpTools"][0] assert recovered_mcp["authToken"] == "preserved-secret" assert recovered_mcp["authTokenEnv"] == ("MCP_UPDATED_AGENT_ORDERS_AUTH_TOKEN") remove_mcp_credential = ( provider == "volcengine" and has_resource_tags and evaluation_error is None ) + replace_feishu_credentials = ( + provider == "volcengine" + and not has_resource_tags + and evaluation_error is None + ) + remove_feishu_credentials = ( + provider == "byteplus" and has_resource_tags and evaluation_error is None + ) + remove_runtime_env_keys = ( + ["MCP_UPDATED_AGENT_ORDERS_AUTH_TOKEN"] if remove_mcp_credential else [] + ) + if remove_feishu_credentials: + remove_runtime_env_keys.extend(["FEISHU_APP_ID", "FEISHU_APP_SECRET"]) + requested_envs = [ + {"key": "REPLACED_ENV", "value": "new-value"}, + {"key": "MODEL_AGENT_API_KEY_ID", "value": "new-key-id"}, + { + "key": "MODEL_AGENT_API_KEY_NAME", + "value": "new-key-name", + }, + ] + if replace_feishu_credentials: + requested_envs.extend( + [ + {"key": "FEISHU_APP_ID", "value": "cli_replaced"}, + { + "key": "FEISHU_APP_SECRET", + "value": "replaced-feishu-secret", + }, + ] + ) with client.stream( "POST", "/web/deploy-agentkit", @@ -5277,22 +5320,12 @@ async def _mark_validated_oauth_token(request: Request, call_next): "appName": "updated-agent", "updateEtag": capability.json()["etag"], "baseRuntimeVersion": capability.json()["runtime"]["currentVersion"], - "removeRuntimeEnvKeys": ( - ["MCP_UPDATED_AGENT_ORDERS_AUTH_TOKEN"] - if remove_mcp_credential - else [] - ), + "removeRuntimeEnvKeys": remove_runtime_env_keys, "files": [{"path": "app.py", "content": "app = object()\n"}], "config": {"region": region, "projectName": "default"}, "authentication": {"type": "api_key"}, - "envs": [ - {"key": "REPLACED_ENV", "value": "new-value"}, - {"key": "MODEL_AGENT_API_KEY_ID", "value": "new-key-id"}, - { - "key": "MODEL_AGENT_API_KEY_NAME", - "value": "new-key-name", - }, - ], + "im": {"feishu": {"enabled": not remove_feishu_credentials}}, + "envs": requested_envs, "resources": { "tos": {"mode": "create", "bucket": "request-bucket"}, "cr": { @@ -5374,6 +5407,15 @@ async def _mark_validated_oauth_token(request: Request, call_next): assert cloud["runtime_envs"]["MODEL_AGENT_API_KEY_ID"] == "new-key-id" assert cloud["runtime_envs"]["MODEL_AGENT_API_KEY_NAME"] == "new-key-name" assert cloud["runtime_envs"]["MODEL_AGENT_API_KEY"] == "new-raw-model-key" + if remove_feishu_credentials: + assert "FEISHU_APP_ID" not in cloud["runtime_envs"] + assert "FEISHU_APP_SECRET" not in cloud["runtime_envs"] + elif replace_feishu_credentials: + assert cloud["runtime_envs"]["FEISHU_APP_ID"] == "cli_replaced" + assert cloud["runtime_envs"]["FEISHU_APP_SECRET"] == ("replaced-feishu-secret") + else: + assert cloud["runtime_envs"]["FEISHU_APP_ID"] == "cli_existing" + assert cloud["runtime_envs"]["FEISHU_APP_SECRET"] == ("existing-feishu-secret") assert "old-key-name" not in cloud["runtime_envs"].values() assert "old-key-id" not in cloud["runtime_envs"].values() assert "old-raw-model-key" not in cloud["runtime_envs"].values() diff --git a/veadk/cli/cli_frontend.py b/veadk/cli/cli_frontend.py index fb108fdb2..bcce05cbc 100644 --- a/veadk/cli/cli_frontend.py +++ b/veadk/cli/cli_frontend.py @@ -6041,6 +6041,9 @@ def _update_identity(value: Any) -> tuple[Any, ...]: allowed_remove_runtime_env_keys = set( mcp_auth_environment_keys(published_draft) ) + allowed_remove_runtime_env_keys.update( + {"FEISHU_APP_ID", "FEISHU_APP_SECRET"} + ) if not requested_remove_runtime_env_keys.issubset( allowed_remove_runtime_env_keys ): @@ -6393,6 +6396,17 @@ def _update_identity(value: Any) -> tuple[Any, ...]: raw_feishu_config if isinstance(raw_feishu_config, dict) else {} ) feishu_enabled = bool(feishu_config.get("enabled")) + existing_runtime_envs = { + str(getattr(item, "key", "") or "").strip(): str( + getattr(item, "value", "") or "" + ) + for item in ( + getattr(existing_runtime, "envs", None) or [] + if existing_runtime is not None + else [] + ) + if str(getattr(item, "key", "") or "").strip() + } extra_runtime_envs = { key: value for key, value in requested_runtime_envs.items() @@ -6401,11 +6415,13 @@ def _update_identity(value: Any) -> tuple[Any, ...]: feishu_app_id = ( requested_runtime_envs.get("FEISHU_APP_ID", "").strip() or requested_runtime_envs.get("TOOL_FEISHU_CHANNEL_APP_ID", "").strip() + or existing_runtime_envs.get("FEISHU_APP_ID", "").strip() or os.getenv("FEISHU_APP_ID", "").strip() ) feishu_app_secret = ( requested_runtime_envs.get("FEISHU_APP_SECRET", "").strip() or requested_runtime_envs.get("TOOL_FEISHU_CHANNEL_APP_SECRET", "").strip() + or existing_runtime_envs.get("FEISHU_APP_SECRET", "").strip() or os.getenv("FEISHU_APP_SECRET", "").strip() ) if feishu_enabled and (not feishu_app_id or not feishu_app_secret): @@ -10910,7 +10926,7 @@ def _recover_legacy_runtime_agent( raise LegacyRecoveryError("legacy_snapshot_identity_missing") return draft, source_identity, pinned_image - def _configured_mcp_environment_keys( + def _configured_editable_environment_keys( runtime: Any, draft: Mapping[str, Any], region: str, @@ -10938,7 +10954,8 @@ def _configured_mcp_environment_keys( ) except LegacyRecoveryError: pass - return [key for key in references if key in configured] + editable_keys = [*references, "FEISHU_APP_SECRET"] + return [key for key in editable_keys if key in configured] def _runtime_update_result( runtime: Any, @@ -11335,15 +11352,21 @@ async def _runtime_update_capability_details( warnings=("未生成可发布更新,线上版本不会被覆盖。",), agent=recovery.agent, ) - configured_env_keys = ( - list(mcp_auth_environment_keys(recovery.agent.get("draft") or {})) - if recovery.source == "legacy-runtime" - else _configured_mcp_environment_keys( - runtime, - recovery.agent.get("draft") or {}, - region, - ) + recovered_draft = recovery.agent.get("draft") or {} + configured_env_keys = _configured_editable_environment_keys( + runtime, + recovered_draft, + region, ) + if recovery.source == "legacy-runtime": + configured_env_keys = list( + dict.fromkeys( + [ + *mcp_auth_environment_keys(recovered_draft), + *configured_env_keys, + ] + ) + ) runtime_payload = { **runtime_payload, "configuredEnvKeys": configured_env_keys, diff --git a/veadk/cli/runtime_update_recovery.py b/veadk/cli/runtime_update_recovery.py index fa9701241..88b2b6ecd 100644 --- a/veadk/cli/runtime_update_recovery.py +++ b/veadk/cli/runtime_update_recovery.py @@ -70,6 +70,8 @@ "MODEL_AGENT_API_BASE", "MODEL_AGENT_API_KEY_ID", "MODEL_AGENT_API_KEY_NAME", + "FEISHU_APP_ID", + "FEISHU_APP_SECRET", } ) _URL_RUNTIME_ENV_KEYS = frozenset({"MODEL_AGENT_API_BASE"}) @@ -147,12 +149,14 @@ def _safe_public_environment_value(key: str, value: str) -> bool: def sanitize_runtime_environment( envs: Iterable[tuple[str, str]], ) -> RuntimeEnvironmentView: - """Return only explicitly public values and opaque configured-key state. + """Return explicitly editable values and opaque configured-key state. Runtime environment variables are not public merely because their names do not contain ``SECRET`` or ``TOKEN``. In particular, ``MCP_SERVERS_JSON`` can embed arbitrary authentication headers. The allowlist is intentionally - limited to model-selection fields that the update UI must restore. + limited to fields that the update UI must restore. Feishu credentials are + editable deployment inputs, so both the App ID and App Secret are restored + from the selected Runtime. """ public_envs: list[dict[str, str]] = [] diff --git a/veadk/webui/assets/app/index-Cp46ADZF.js b/veadk/webui/assets/app/index-lW9MHLGw.js similarity index 70% rename from veadk/webui/assets/app/index-Cp46ADZF.js rename to veadk/webui/assets/app/index-lW9MHLGw.js index 11e95abd9..5aea7341f 100644 --- a/veadk/webui/assets/app/index-Cp46ADZF.js +++ b/veadk/webui/assets/app/index-lW9MHLGw.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/visualizations/mermaid/mermaid.core-u1Q_qVDs.js","assets/chunks/purify.es-BnINGy_Y.js","assets/chunks/MarkdownPromptEditor-BrM0rJhH.js","assets/styles/MarkdownPromptEditor-ZH9qtki0.css"])))=>i.map(i=>d[i]); -var hke=Object.defineProperty;var vF=e=>{throw TypeError(e)};var pke=(e,t,n)=>t in e?hke(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var kr=(e,t,n)=>pke(e,typeof t!="symbol"?t+"":t,n),wF=(e,t,n)=>t.has(e)||vF("Cannot "+n);var qa=(e,t,n)=>(wF(e,t,"read from private field"),n?n.call(e):t.get(e)),SF=(e,t,n)=>t.has(e)?vF("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),hI=(e,t,n,r)=>(wF(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);function mke(e,t){for(var n=0;nr[i]})}}}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 i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var op=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function N1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Vte={exports:{}},tN={};/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/visualizations/mermaid/mermaid.core-DGeIIfkU.js","assets/chunks/purify.es-BnINGy_Y.js","assets/chunks/MarkdownPromptEditor-4yLlDmfn.js","assets/styles/MarkdownPromptEditor-ZH9qtki0.css"])))=>i.map(i=>d[i]); +var fke=Object.defineProperty;var vF=e=>{throw TypeError(e)};var hke=(e,t,n)=>t in e?fke(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Er=(e,t,n)=>hke(e,typeof t!="symbol"?t+"":t,n),wF=(e,t,n)=>t.has(e)||vF("Cannot "+n);var za=(e,t,n)=>(wF(e,t,"read from private field"),n?n.call(e):t.get(e)),SF=(e,t,n)=>t.has(e)?vF("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),hI=(e,t,n,r)=>(wF(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);function pke(e,t){for(var n=0;nr[i]})}}}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 i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var op=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function N1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Vte={exports:{}},tN={};/** * @license React * react-jsx-runtime.production.js * @@ -7,7 +7,7 @@ var hke=Object.defineProperty;var vF=e=>{throw TypeError(e)};var pke=(e,t,n)=>t * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var gke=Symbol.for("react.transitional.element"),bke=Symbol.for("react.fragment");function Hte(e,t,n){var r=null;if(n!==void 0&&(r=""+n),t.key!==void 0&&(r=""+t.key),"key"in t){n={};for(var i in t)i!=="key"&&(n[i]=t[i])}else n=t;return t=n.ref,{$$typeof:gke,type:e,key:r,ref:t!==void 0?t:null,props:n}}tN.Fragment=bke;tN.jsx=Hte;tN.jsxs=Hte;Vte.exports=tN;var o=Vte.exports,qte={exports:{}},zn={};/** + */var mke=Symbol.for("react.transitional.element"),gke=Symbol.for("react.fragment");function Hte(e,t,n){var r=null;if(n!==void 0&&(r=""+n),t.key!==void 0&&(r=""+t.key),"key"in t){n={};for(var i in t)i!=="key"&&(n[i]=t[i])}else n=t;return t=n.ref,{$$typeof:mke,type:e,key:r,ref:t!==void 0?t:null,props:n}}tN.Fragment=gke;tN.jsx=Hte;tN.jsxs=Hte;Vte.exports=tN;var o=Vte.exports,qte={exports:{}},zn={};/** * @license React * react.production.js * @@ -15,7 +15,7 @@ var hke=Object.defineProperty;var vF=e=>{throw TypeError(e)};var pke=(e,t,n)=>t * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var b$=Symbol.for("react.transitional.element"),yke=Symbol.for("react.portal"),Oke=Symbol.for("react.fragment"),xke=Symbol.for("react.strict_mode"),vke=Symbol.for("react.profiler"),wke=Symbol.for("react.consumer"),Ske=Symbol.for("react.context"),Eke=Symbol.for("react.forward_ref"),kke=Symbol.for("react.suspense"),_ke=Symbol.for("react.memo"),Xte=Symbol.for("react.lazy"),Tke=Symbol.for("react.activity"),EF=Symbol.iterator;function Cke(e){return e===null||typeof e!="object"?null:(e=EF&&e[EF]||e["@@iterator"],typeof e=="function"?e:null)}var Gte={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Wte=Object.assign,Yte={};function j1(e,t,n){this.props=e,this.context=t,this.refs=Yte,this.updater=n||Gte}j1.prototype.isReactComponent={};j1.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};j1.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Zte(){}Zte.prototype=j1.prototype;function y$(e,t,n){this.props=e,this.context=t,this.refs=Yte,this.updater=n||Gte}var O$=y$.prototype=new Zte;O$.constructor=y$;Wte(O$,j1.prototype);O$.isPureReactComponent=!0;var kF=Array.isArray;function w3(){}var Bi={H:null,A:null,T:null,S:null},Kte=Object.prototype.hasOwnProperty;function x$(e,t,n){var r=n.ref;return{$$typeof:b$,type:e,key:t,ref:r!==void 0?r:null,props:n}}function Ake(e,t){return x$(e.type,t,e.props)}function v$(e){return typeof e=="object"&&e!==null&&e.$$typeof===b$}function Nke(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var _F=/\/+/g;function pI(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Nke(""+e.key):t.toString(36)}function jke(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(w3,w3):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function ub(e,t,n,r,i){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(s){case"bigint":case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case b$:case yke:a=!0;break;case Xte:return a=e._init,ub(a(e._payload),t,n,r,i)}}if(a)return i=i(e),a=r===""?"."+pI(e,0):r,kF(i)?(n="",a!=null&&(n=a.replace(_F,"$&/")+"/"),ub(i,t,n,"",function(u){return u})):i!=null&&(v$(i)&&(i=Ake(i,n+(i.key==null||e&&e.key===i.key?"":(""+i.key).replace(_F,"$&/")+"/")+a)),t.push(i)),1;a=0;var l=r===""?".":r+":";if(kF(e))for(var c=0;c{throw TypeError(e)};var pke=(e,t,n)=>t * * 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(N,D){var Q=N.length;N.push(D);e:for(;0>>1,$=N[F];if(0>>1;Fi(B,Q))V<$&&0>i(Z,B)?(N[F]=Z,N[V]=Q,F=V):(N[F]=B,N[z]=Q,F=z);else if(V<$&&0>i(Z,Q))N[F]=Z,N[V]=Q,F=V;else break e}}return D}function i(N,D){var Q=N.sortIndex-D.sortIndex;return Q!==0?Q:N.id-D.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var c=[],u=[],d=1,f=null,h=3,m=!1,g=!1,b=!1,y=!1,O=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;function w(N){for(var D=n(u);D!==null;){if(D.callback===null)r(u);else if(D.startTime<=N)r(u),D.sortIndex=D.expirationTime,t(c,D);else break;D=n(u)}}function S(N){if(b=!1,w(N),!g)if(n(c)!==null)g=!0,E||(E=!0,j());else{var D=n(u);D!==null&&M(S,D.startTime-N)}}var E=!1,k=-1,_=5,C=-1;function T(){return y?!0:!(e.unstable_now()-C<_)}function A(){if(y=!1,E){var N=e.unstable_now();C=N;var D=!0;try{e:{g=!1,b&&(b=!1,v(k),k=-1),m=!0;var Q=h;try{t:{for(w(N),f=n(c);f!==null&&!(f.expirationTime>N&&T());){var F=f.callback;if(typeof F=="function"){f.callback=null,h=f.priorityLevel;var $=F(f.expirationTime<=N);if(N=e.unstable_now(),typeof $=="function"){f.callback=$,w(N),D=!0;break t}f===n(c)&&r(c),w(N)}else r(c);f=n(c)}if(f!==null)D=!0;else{var H=n(u);H!==null&&M(S,H.startTime-N),D=!1}}break e}finally{f=null,h=Q,m=!1}D=void 0}}finally{D?j():E=!1}}}var j;if(typeof x=="function")j=function(){x(A)};else if(typeof MessageChannel<"u"){var L=new MessageChannel,I=L.port2;L.port1.onmessage=A,j=function(){I.postMessage(null)}}else j=function(){O(A,0)};function M(N,D){k=O(function(){N(e.unstable_now())},D)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(N){N.callback=null},e.unstable_forceFrameRate=function(N){0>N||125F?(N.sortIndex=Q,t(u,N),n(c)===null&&N===n(u)&&(b?(v(k),k=-1):b=!0,M(S,Q-F))):(N.sortIndex=$,t(c,N),g||m||(g=!0,E||(E=!0,j()))),N},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(N){var D=h;return function(){var Q=h;h=D;try{return N.apply(this,arguments)}finally{h=Q}}}})(tne);ene.exports=tne;var Dke=ene.exports,nne={exports:{}},ko={};/** + */(function(e){function t(N,D){var Q=N.length;N.push(D);e:for(;0>>1,L=N[F];if(0>>1;Fi(B,Q))Vi(W,B)?(N[F]=W,N[V]=Q,F=V):(N[F]=B,N[z]=Q,F=z);else if(Vi(W,Q))N[F]=W,N[V]=Q,F=V;else break e}}return D}function i(N,D){var Q=N.sortIndex-D.sortIndex;return Q!==0?Q:N.id-D.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var c=[],u=[],d=1,f=null,h=3,m=!1,g=!1,b=!1,y=!1,O=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;function w(N){for(var D=n(u);D!==null;){if(D.callback===null)r(u);else if(D.startTime<=N)r(u),D.sortIndex=D.expirationTime,t(c,D);else break;D=n(u)}}function S(N){if(b=!1,w(N),!g)if(n(c)!==null)g=!0,E||(E=!0,j());else{var D=n(u);D!==null&&$(S,D.startTime-N)}}var E=!1,k=-1,_=5,T=-1;function C(){return y?!0:!(e.unstable_now()-T<_)}function A(){if(y=!1,E){var N=e.unstable_now();T=N;var D=!0;try{e:{g=!1,b&&(b=!1,v(k),k=-1),m=!0;var Q=h;try{t:{for(w(N),f=n(c);f!==null&&!(f.expirationTime>N&&C());){var F=f.callback;if(typeof F=="function"){f.callback=null,h=f.priorityLevel;var L=F(f.expirationTime<=N);if(N=e.unstable_now(),typeof L=="function"){f.callback=L,w(N),D=!0;break t}f===n(c)&&r(c),w(N)}else r(c);f=n(c)}if(f!==null)D=!0;else{var H=n(u);H!==null&&$(S,H.startTime-N),D=!1}}break e}finally{f=null,h=Q,m=!1}D=void 0}}finally{D?j():E=!1}}}var j;if(typeof x=="function")j=function(){x(A)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,I=M.port2;M.port1.onmessage=A,j=function(){I.postMessage(null)}}else j=function(){O(A,0)};function $(N,D){k=O(function(){N(e.unstable_now())},D)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(N){N.callback=null},e.unstable_forceFrameRate=function(N){0>N||125F?(N.sortIndex=Q,t(u,N),n(c)===null&&N===n(u)&&(b?(v(k),k=-1):b=!0,$(S,Q-F))):(N.sortIndex=L,t(c,N),g||m||(g=!0,E||(E=!0,j()))),N},e.unstable_shouldYield=C,e.unstable_wrapCallback=function(N){var D=h;return function(){var Q=h;h=D;try{return N.apply(this,arguments)}finally{h=Q}}}})(tne);ene.exports=tne;var Ike=ene.exports,nne={exports:{}},Co={};/** * @license React * react-dom.production.js * @@ -31,7 +31,7 @@ var hke=Object.defineProperty;var vF=e=>{throw TypeError(e)};var pke=(e,t,n)=>t * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Pke=p;function rne(e){var t="https://react.dev/errors/"+e;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ine)}catch(e){console.error(e)}}ine(),nne.exports=ko;var Cr=nne.exports;/** + */var Dke=p;function rne(e){var t="https://react.dev/errors/"+e;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ine)}catch(e){console.error(e)}}ine(),nne.exports=Co;var Tr=nne.exports;/** * @license React * react-dom-client.production.js * @@ -39,15 +39,15 @@ var hke=Object.defineProperty;var vF=e=>{throw TypeError(e)};var pke=(e,t,n)=>t * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var na=Dke,sne=p,$ke=Cr;function at(e){var t="https://react.dev/errors/"+e;if(1Cb||(e.current=C3[Cb],C3[Cb]=null,Cb--)}function Ci(e,t){Cb++,C3[Cb]=e.current,e.current=t}var od=xd(null),ew=xd(null),Op=xd(null),RT=xd(null);function IT(e,t){switch(Ci(Op,t),Ci(ew,e),Ci(od,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Pz(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Pz(t),e=jie(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}ya(od),Ci(od,e)}function Ly(){ya(od),ya(ew),ya(Op)}function A3(e){e.memoizedState!==null&&Ci(RT,e);var t=od.current,n=jie(t,e.type);t!==n&&(Ci(ew,e),Ci(od,n))}function DT(e){ew.current===e&&(ya(od),ya(ew)),RT.current===e&&(ya(RT),dw._currentValue=pg)}var mI,NF;function Mm(e){if(mI===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);mI=t&&t[1]||"",NF=-1Cb||(e.current=C3[Cb],C3[Cb]=null,Cb--)}function ji(e,t){Cb++,C3[Cb]=e.current,e.current=t}var cd=wd(null),nw=wd(null),Op=wd(null),IT=wd(null);function DT(e,t){switch(ji(Op,t),ji(nw,e),ji(cd,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Pz(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Pz(t),e=jie(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}ga(cd),ji(cd,e)}function Ly(){ga(cd),ga(nw),ga(Op)}function A3(e){e.memoizedState!==null&&ji(IT,e);var t=cd.current,n=jie(t,e.type);t!==n&&(ji(nw,e),ji(cd,n))}function PT(e){nw.current===e&&(ga(cd),ga(nw)),IT.current===e&&(ga(IT),hw._currentValue=pg)}var mI,NF;function Mm(e){if(mI===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);mI=t&&t[1]||"",NF=-1)":-1i||c[r]!==u[i]){var d=` -`+c[r].replace(" at new "," at ");return e.displayName&&d.includes("")&&(d=d.replace("",e.displayName)),d}while(1<=r&&0<=i);break}}}finally{gI=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Mm(n):""}function zke(e,t){switch(e.tag){case 26:case 27:case 5:return Mm(e.type);case 16:return Mm("Lazy");case 13:return e.child!==t&&t!==null?Mm("Suspense Fallback"):Mm("Suspense");case 19:return Mm("SuspenseList");case 0:case 15:return bI(e.type,!1);case 11:return bI(e.type.render,!1);case 1:return bI(e.type,!0);case 31:return Mm("Activity");default:return""}}function jF(e){try{var t="",n=null;do t+=zke(e,n),n=e,e=e.return;while(e);return t}catch(r){return` +`+c[r].replace(" at new "," at ");return e.displayName&&d.includes("")&&(d=d.replace("",e.displayName)),d}while(1<=r&&0<=i);break}}}finally{gI=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Mm(n):""}function Fke(e,t){switch(e.tag){case 26:case 27:case 5:return Mm(e.type);case 16:return Mm("Lazy");case 13:return e.child!==t&&t!==null?Mm("Suspense Fallback"):Mm("Suspense");case 19:return Mm("SuspenseList");case 0:case 15:return bI(e.type,!1);case 11:return bI(e.type.render,!1);case 1:return bI(e.type,!0);case 31:return Mm("Activity");default:return""}}function jF(e){try{var t="",n=null;do t+=Fke(e,n),n=e,e=e.return;while(e);return t}catch(r){return` Error generating stack: `+r.message+` -`+r.stack}}var N3=Object.prototype.hasOwnProperty,E$=na.unstable_scheduleCallback,yI=na.unstable_cancelCallback,Vke=na.unstable_shouldYield,Hke=na.unstable_requestPaint,jl=na.unstable_now,qke=na.unstable_getCurrentPriorityLevel,fne=na.unstable_ImmediatePriority,hne=na.unstable_UserBlockingPriority,PT=na.unstable_NormalPriority,Xke=na.unstable_LowPriority,pne=na.unstable_IdlePriority,Gke=na.log,Wke=na.unstable_setDisableYieldValue,AS=null,Rl=null;function lp(e){if(typeof Gke=="function"&&Wke(e),Rl&&typeof Rl.setStrictMode=="function")try{Rl.setStrictMode(AS,e)}catch{}}var Il=Math.clz32?Math.clz32:Kke,Yke=Math.log,Zke=Math.LN2;function Kke(e){return e>>>=0,e===0?32:31-(Yke(e)/Zke|0)|0}var wk=256,Sk=262144,Ek=4194304;function Lm(e){var t=e&42;if(t!==0)return t;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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function iN(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,s=e.suspendedLanes,a=e.pingedLanes;e=e.warmLanes;var l=r&134217727;return l!==0?(r=l&~s,r!==0?i=Lm(r):(a&=l,a!==0?i=Lm(a):n||(n=l&~e,n!==0&&(i=Lm(n))))):(l=r&~s,l!==0?i=Lm(l):a!==0?i=Lm(a):n||(n=r&~e,n!==0&&(i=Lm(n)))),i===0?0:t!==0&&t!==i&&!(t&s)&&(s=i&-i,n=t&-t,s>=n||s===32&&(n&4194048)!==0)?t:i}function NS(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Jke(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function mne(){var e=Ek;return Ek<<=1,!(Ek&62914560)&&(Ek=4194304),e}function OI(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function jS(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function e2e(e,t,n,r,i,s){var a=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var l=e.entanglements,c=e.expirationTimes,u=e.hiddenUpdates;for(n=a&~n;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var a2e=/[\n"\\]/g;function vc(e){return e.replace(a2e,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function I3(e,t,n,r,i,s,a,l){e.name="",a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"?e.type=a:e.removeAttribute("type"),t!=null?a==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+gc(t)):e.value!==""+gc(t)&&(e.value=""+gc(t)):a!=="submit"&&a!=="reset"||e.removeAttribute("value"),t!=null?D3(e,a,gc(t)):n!=null?D3(e,a,gc(n)):r!=null&&e.removeAttribute("value"),i==null&&s!=null&&(e.defaultChecked=!!s),i!=null&&(e.checked=i&&typeof i!="function"&&typeof i!="symbol"),l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"?e.name=""+gc(l):e.removeAttribute("name")}function Ene(e,t,n,r,i,s,a,l){if(s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(e.type=s),t!=null||n!=null){if(!(s!=="submit"&&s!=="reset"||t!=null)){R3(e);return}n=n!=null?""+gc(n):"",t=t!=null?""+gc(t):n,l||t===e.value||(e.value=t),e.defaultValue=t}r=r??i,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=l?e.checked:!!r,e.defaultChecked=!!r,a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"&&(e.name=a),R3(e)}function D3(e,t,n){t==="number"&&MT(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function iy(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),M3=!1;if(Hf)try{var HO={};Object.defineProperty(HO,"passive",{get:function(){M3=!0}}),window.addEventListener("test",HO,HO),window.removeEventListener("test",HO,HO)}catch{M3=!1}var cp=null,N$=null,v_=null;function Ane(){if(v_)return v_;var e,t=N$,n=t.length,r,i="value"in cp?cp.value:cp.textContent,s=i.length;for(e=0;e=sv),FF=" ",zF=!1;function jne(e,t){switch(e){case"keyup":return D2e.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Rne(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var jb=!1;function M2e(e,t){switch(e){case"compositionend":return Rne(t);case"keypress":return t.which!==32?null:(zF=!0,FF);case"textInput":return e=t.data,e===FF&&zF?null:e;default:return null}}function L2e(e,t){if(jb)return e==="compositionend"||!R$&&jne(e,t)?(e=Ane(),v_=N$=cp=null,jb=!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=GF(n)}}function Mne(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Mne(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Lne(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=MT(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=MT(e.document)}return t}function I$(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")}var H2e=Hf&&"documentMode"in document&&11>=document.documentMode,Rb=null,L3=null,ov=null,$3=!1;function YF(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;$3||Rb==null||Rb!==MT(r)||(r=Rb,"selectionStart"in r&&I$(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}),ov&&rw(ov,r)||(ov=r,r=eC(L3,"onSelect"),0>=a,i-=a,Ku=1<<32-Il(t)+i|n<_?(C=k,k=null):C=k.sibling;var T=h(O,k,x[_],w);if(T===null){k===null&&(k=C);break}e&&k&&T.alternate===null&&t(O,k),v=s(T,v,_),E===null?S=T:E.sibling=T,E=T,k=C}if(_===x.length)return n(O,k),Tr&&df(O,_),S;if(k===null){for(;__?(C=k,k=null):C=k.sibling;var A=h(O,k,T.value,w);if(A===null){k===null&&(k=C);break}e&&k&&A.alternate===null&&t(O,k),v=s(A,v,_),E===null?S=A:E.sibling=A,E=A,k=C}if(T.done)return n(O,k),Tr&&df(O,_),S;if(k===null){for(;!T.done;_++,T=x.next())T=f(O,T.value,w),T!==null&&(v=s(T,v,_),E===null?S=T:E.sibling=T,E=T);return Tr&&df(O,_),S}for(k=r(k);!T.done;_++,T=x.next())T=m(k,O,_,T.value,w),T!==null&&(e&&T.alternate!==null&&k.delete(T.key===null?_:T.key),v=s(T,v,_),E===null?S=T:E.sibling=T,E=T);return e&&k.forEach(function(j){return t(O,j)}),Tr&&df(O,_),S}function y(O,v,x,w){if(typeof x=="object"&&x!==null&&x.type===Tb&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case vk:e:{for(var S=x.key;v!==null;){if(v.key===S){if(S=x.type,S===Tb){if(v.tag===7){n(O,v.sibling),w=i(v,x.props.children),w.return=O,O=w;break e}}else if(v.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Gh&&$m(S)===v.type){n(O,v.sibling),w=i(v,x.props),XO(w,x),w.return=O,O=w;break e}n(O,v);break}else t(O,v);v=v.sibling}x.type===Tb?(w=mg(x.props.children,O.mode,w,x.key),w.return=O,O=w):(w=S_(x.type,x.key,x.props,null,O.mode,w),XO(w,x),w.return=O,O=w)}return a(O);case Ix:e:{for(S=x.key;v!==null;){if(v.key===S)if(v.tag===4&&v.stateNode.containerInfo===x.containerInfo&&v.stateNode.implementation===x.implementation){n(O,v.sibling),w=i(v,x.children||[]),w.return=O,O=w;break e}else{n(O,v);break}else t(O,v);v=v.sibling}w=CI(x,O.mode,w),w.return=O,O=w}return a(O);case Gh:return x=$m(x),y(O,v,x,w)}if(Dx(x))return g(O,v,x,w);if(VO(x)){if(S=VO(x),typeof S!="function")throw Error(at(150));return x=S.call(x),b(O,v,x,w)}if(typeof x.then=="function")return y(O,v,Ck(x),w);if(x.$$typeof===wf)return y(O,v,Tk(O,x),w);Ak(O,x)}return typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint"?(x=""+x,v!==null&&v.tag===6?(n(O,v.sibling),w=i(v,x),w.return=O,O=w):(n(O,v),w=TI(x,O.mode,w),w.return=O,O=w),a(O)):n(O,v)}return function(O,v,x,w){try{aw=0;var S=y(O,v,x,w);return oy=null,S}catch(k){if(k===P1||k===uN)throw k;var E=_l(29,k,null,O.mode);return E.lanes=w,E.return=O,E}finally{}}}var jg=Kne(!0),Jne=Kne(!1),Wh=!1;function F$(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function H3(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function vp(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function wp(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ur&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=$T(e),Vne(e,null,n),t}return cN(e,r,t,n),$T(e)}function cv(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,bne(e,n)}}function NI(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var a={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};s===null?i=s=a:s=s.next=a,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var q3=!1;function uv(){if(q3){var e=ay;if(e!==null)throw e}}function dv(e,t,n,r){q3=!1;var i=e.updateQueue;Wh=!1;var s=i.firstBaseUpdate,a=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,u=c.next;c.next=null,a===null?s=u:a.next=u,a=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==a&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(s!==null){var f=i.baseState;a=0,d=u=c=null,l=s;do{var h=l.lane&-536870913,m=h!==l.lane;if(m?(wr&h)===h:(r&h)===h){h!==0&&h===Qy&&(q3=!0),d!==null&&(d=d.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});e:{var g=e,b=l;h=t;var y=n;switch(b.tag){case 1:if(g=b.payload,typeof g=="function"){f=g.call(y,f,h);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=b.payload,h=typeof g=="function"?g.call(y,f,h):g,h==null)break e;f=Ui({},f,h);break e;case 2:Wh=!0}}h=l.callback,h!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[h]:m.push(h))}else m={lane:h,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=m,c=f):d=d.next=m,a|=h;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;m=l,l=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(!0);d===null&&(c=f),i.baseState=c,i.firstBaseUpdate=u,i.lastBaseUpdate=d,s===null&&(i.shared.lanes=0),$p|=a,e.lanes=a,e.memoizedState=f}}function ere(e,t){if(typeof e!="function")throw Error(at(191,e));e.call(t)}function tre(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;es?s:8;var a=_n.T,l={};_n.T=l,t8(e,!1,t,n);try{var c=i(),u=_n.S;if(u!==null&&u(l,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=e_e(c,r);fv(e,t,d,Dl(e))}else fv(e,t,r,Dl(e))}catch(f){fv(e,t,{then:function(){},status:"rejected",reason:f},Dl())}finally{Fr.p=s,a!==null&&l.types!==null&&(a.types=l.types),_n.T=a}}function a_e(){}function Z3(e,t,n,r){if(e.tag!==5)throw Error(at(476));var i=_re(e).queue;kre(e,i,t,pg,n===null?a_e:function(){return Tre(e),n(r)})}function _re(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:pg,baseState:pg,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xf,lastRenderedState:pg},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xf,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Tre(e){var t=_re(e);t.next===null&&(t=e.alternate.memoizedState),fv(e,t.next.queue,{},Dl())}function e8(){return Ma(dw)}function Cre(){return Cs().memoizedState}function Are(){return Cs().memoizedState}function o_e(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Dl();e=vp(n);var r=wp(t,e,n);r!==null&&(Yo(r,t,n),cv(r,t,n)),t={cache:B$()},e.payload=t;return}t=t.return}}function l_e(e,t,n){var r=Dl();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},pN(e)?jre(t,n):(n=P$(e,t,n,r),n!==null&&(Yo(n,e,r),Rre(n,t,r)))}function Nre(e,t,n){var r=Dl();fv(e,t,n,r)}function fv(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(pN(e))jre(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var a=t.lastRenderedState,l=s(a,n);if(i.hasEagerState=!0,i.eagerState=l,Bl(l,a))return cN(e,t,i,0),vi===null&&lN(),!1}catch{}finally{}if(n=P$(e,t,i,r),n!==null)return Yo(n,e,r),Rre(n,t,r),!0}return!1}function t8(e,t,n,r){if(r={lane:2,revertLane:u8(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},pN(e)){if(t)throw Error(at(479))}else t=P$(e,n,r,2),t!==null&&Yo(t,e,2)}function pN(e){var t=e.alternate;return e===Hn||t!==null&&t===Hn}function jre(e,t){ly=VT=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Rre(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,bne(e,n)}}var lw={readContext:Ma,use:fN,useCallback:us,useContext:us,useEffect:us,useImperativeHandle:us,useLayoutEffect:us,useInsertionEffect:us,useMemo:us,useReducer:us,useRef:us,useState:us,useDebugValue:us,useDeferredValue:us,useTransition:us,useSyncExternalStore:us,useId:us,useHostTransitionStatus:us,useFormState:us,useActionState:us,useOptimistic:us,useMemoCache:us,useCacheRefresh:us};lw.useEffectEvent=us;var Ire={readContext:Ma,use:fN,useCallback:function(e,t){return co().memoizedState=[e,t===void 0?null:t],e},useContext:Ma,useEffect:dz,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,__(4194308,4,xre.bind(null,t,e),n)},useLayoutEffect:function(e,t){return __(4194308,4,e,t)},useInsertionEffect:function(e,t){__(4,2,e,t)},useMemo:function(e,t){var n=co();t=t===void 0?null:t;var r=e();if(Rg){lp(!0);try{e()}finally{lp(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=co();if(n!==void 0){var i=n(t);if(Rg){lp(!0);try{n(t)}finally{lp(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=l_e.bind(null,Hn,e),[r.memoizedState,e]},useRef:function(e){var t=co();return e={current:e},t.memoizedState=e},useState:function(e){e=W3(e);var t=e.queue,n=Nre.bind(null,Hn,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:K$,useDeferredValue:function(e,t){var n=co();return J$(n,e,t)},useTransition:function(){var e=W3(!1);return e=kre.bind(null,Hn,e.queue,!0,!1),co().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Hn,i=co();if(Tr){if(n===void 0)throw Error(at(407));n=n()}else{if(n=t(),vi===null)throw Error(at(349));wr&127||are(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,dz(lre.bind(null,r,s,e),[e]),r.flags|=2048,Fy(9,{destroy:void 0},ore.bind(null,r,s,n,t),null),n},useId:function(){var e=co(),t=vi.identifierPrefix;if(Tr){var n=Ju,r=Ku;n=(r&~(1<<32-Il(r)-1)).toString(32)+n,t="_"+t+"R_"+n,n=HT++,0<\/script>",s=s.removeChild(s.firstChild);break;case"select":s=typeof r.is=="string"?a.createElement("select",{is:r.is}):a.createElement("select"),r.multiple?s.multiple=!0:r.size&&(s.size=r.size);break;default:s=typeof r.is=="string"?a.createElement(i,{is:r.is}):a.createElement(i)}}s[Ia]=t,s[Jo]=r;e:for(a=t.child;a!==null;){if(a.tag===5||a.tag===6)s.appendChild(a.stateNode);else if(a.tag!==4&&a.tag!==27&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break e;for(;a.sibling===null;){if(a.return===null||a.return===t)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}t.stateNode=s;e:switch($a(s,i,r),i){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&qd(t)}}return Ii(t),$I(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&qd(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(at(166));if(e=Op.current,F0(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=Da,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[Ia]=t,e=!!(e.nodeValue===n||r!==null&&r.suppressHydrationWarning===!0||Nie(e.nodeValue,n)),e||Mp(t,!0)}else e=tC(e).createTextNode(r),e[Ia]=t,t.stateNode=e}return Ii(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=F0(t),n!==null){if(e===null){if(!r)throw Error(at(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(at(557));e[Ia]=t}else Ag(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ii(t),e=!1}else n=AI(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(El(t),t):(El(t),null);if(t.flags&128)throw Error(at(558))}return Ii(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=F0(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(at(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(at(317));i[Ia]=t}else Ag(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Ii(t),i=!1}else i=AI(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(El(t),t):(El(t),null)}return El(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),s=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(s=r.memoizedState.cachePool.pool),s!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Nk(t,t.updateQueue),Ii(t),null);case 4:return Ly(),e===null&&d8(t.stateNode.containerInfo),Ii(t),null;case 10:return Nf(t.type),Ii(t),null;case 19:if(ya(ks),r=t.memoizedState,r===null)return Ii(t),null;if(i=(t.flags&128)!==0,s=r.rendering,s===null)if(i)GO(r,!1);else{if(fs!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=zT(e),s!==null){for(t.flags|=128,GO(r,!1),e=s.updateQueue,t.updateQueue=e,Nk(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Hne(n,e),n=n.sibling;return Ci(ks,ks.current&1|2),Tr&&df(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&jl()>WT&&(t.flags|=128,i=!0,GO(r,!1),t.lanes=4194304)}else{if(!i)if(e=zT(s),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Nk(t,e),GO(r,!0),r.tail===null&&r.tailMode==="hidden"&&!s.alternate&&!Tr)return Ii(t),null}else 2*jl()-r.renderingStartTime>WT&&n!==536870912&&(t.flags|=128,i=!0,GO(r,!1),t.lanes=4194304);r.isBackwards?(s.sibling=t.child,t.child=s):(e=r.last,e!==null?e.sibling=s:t.child=s,r.last=s)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=jl(),e.sibling=null,n=ks.current,Ci(ks,i?n&1|2:n&1),Tr&&df(t,r.treeForkCount),e):(Ii(t),null);case 22:case 23:return El(t),z$(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Ii(t),t.subtreeFlags&6&&(t.flags|=8192)):Ii(t),n=t.updateQueue,n!==null&&Nk(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&ya(gg),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Nf(Us),Ii(t),null;case 25:return null;case 30:return null}throw Error(at(156,t.tag))}function h_e(e,t){switch($$(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Nf(Us),Ly(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return DT(t),null;case 31:if(t.memoizedState!==null){if(El(t),t.alternate===null)throw Error(at(340));Ag()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(El(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(at(340));Ag()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ya(ks),null;case 4:return Ly(),null;case 10:return Nf(t.type),null;case 22:case 23:return El(t),z$(),e!==null&&ya(gg),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Nf(Us),null;case 25:return null;default:return null}}function Hre(e,t){switch($$(t),t.tag){case 3:Nf(Us),Ly();break;case 26:case 27:case 5:DT(t);break;case 4:Ly();break;case 31:t.memoizedState!==null&&El(t);break;case 13:El(t);break;case 19:ya(ks);break;case 10:Nf(t.type);break;case 22:case 23:El(t),z$(),e!==null&&ya(gg);break;case 24:Nf(Us)}}function MS(e,t){try{var n=t.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var s=n.create,a=n.inst;r=s(),a.destroy=r}n=n.next}while(n!==i)}}catch(l){ai(t,t.return,l)}}function Lp(e,t,n){try{var r=t.updateQueue,i=r!==null?r.lastEffect:null;if(i!==null){var s=i.next;r=s;do{if((r.tag&e)===e){var a=r.inst,l=a.destroy;if(l!==void 0){a.destroy=void 0,i=t;var c=n,u=l;try{u()}catch(d){ai(i,c,d)}}}r=r.next}while(r!==s)}}catch(d){ai(t,t.return,d)}}function qre(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{tre(t,n)}catch(r){ai(e,e.return,r)}}}function Xre(e,t,n){n.props=Ig(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(r){ai(e,t,r)}}function hv(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n=="function"?e.refCleanup=n(r):n.current=r}}catch(i){ai(e,t,i)}}function ed(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r=="function")try{r()}catch(i){ai(e,t,i)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(i){ai(e,t,i)}else n.current=null}function Gre(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&r.focus();break e;case"img":n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(i){ai(e,e.return,i)}}function BI(e,t,n){try{var r=e.stateNode;P_e(r,e.type,n,t),r[Jo]=t}catch(i){ai(e,e.return,i)}}function Wre(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&om(e.type)||e.tag===4}function QI(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Wre(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.tag===27&&om(e.type)||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 nM(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Sf));else if(r!==4&&(r===27&&om(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(nM(e,t,n),e=e.sibling;e!==null;)nM(e,t,n),e=e.sibling}function GT(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&&(r===27&&om(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(GT(e,t,n),e=e.sibling;e!==null;)GT(e,t,n),e=e.sibling}function Yre(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);$a(t,r,n),t[Ia]=e,t[Jo]=n}catch(s){ai(e,e.return,s)}}var bf=!1,Qs=!1,UI=!1,Ez=typeof WeakSet=="function"?WeakSet:Set,ca=null;function p_e(e,t){if(e=e.containerInfo,cM=sC,e=Lne(e),I$(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 i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var a=0,l=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(l=a+i),f!==s||r!==0&&f.nodeType!==3||(c=a+r),f.nodeType===3&&(a+=f.nodeValue.length),(m=f.firstChild)!==null;)h=f,f=m;for(;;){if(f===e)break t;if(h===n&&++u===i&&(l=a),h===s&&++d===r&&(c=a),(m=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=m}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(uM={focusedElem:e,selectionRange:n},sC=!1,ca=t;ca!==null;)if(t=ca,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ca=e;else for(;ca!==null;){switch(t=ca,s=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n title"))),$a(s,r,n),s[Ia]=e,fa(s),r=s;break e;case"link":var a=Vz("link","href",i).get(r+(n.href||""));if(a){for(var l=0;ly&&(a=y,y=b,b=a);var O=WF(l,b),v=WF(l,y);if(O&&v&&(m.rangeCount!==1||m.anchorNode!==O.node||m.anchorOffset!==O.offset||m.focusNode!==v.node||m.focusOffset!==v.offset)){var x=f.createRange();x.setStart(O.node,O.offset),m.removeAllRanges(),b>y?(m.addRange(x),m.extend(v.node,v.offset)):(x.setEnd(v.node,v.offset),m.addRange(x))}}}}for(f=[],m=l;m=m.parentNode;)m.nodeType===1&&f.push({element:m,left:m.scrollLeft,top:m.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;ln?32:n,_n.T=null,n=sM,sM=null;var s=Ep,a=jf;if(ea=0,Vy=Ep=null,jf=0,Ur&6)throw Error(at(331));var l=Ur;if(Ur|=4,oie(s.current),iie(s,s.current,a,n),Ur=l,LS(0,!1),Rl&&typeof Rl.onPostCommitFiberRoot=="function")try{Rl.onPostCommitFiberRoot(AS,s)}catch{}return!0}finally{Fr.p=i,_n.T=r,wie(e,t)}}function Cz(e,t,n){t=wc(n,t),t=J3(e.stateNode,t,2),e=wp(e,t,2),e!==null&&(jS(e,2),vd(e))}function ai(e,t,n){if(e.tag===3)Cz(e,e,n);else for(;t!==null;){if(t.tag===3){Cz(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Sp===null||!Sp.has(r))){e=wc(n,e),n=$re(2),r=wp(t,n,2),r!==null&&(Bre(n,r,t,e),jS(r,2),vd(r));break}}t=t.return}}function zI(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new b_e;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(o8=!0,i.add(n),e=w_e.bind(null,e,t,n),t.then(e,e))}function w_e(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,vi===e&&(wr&n)===n&&(fs===4||fs===3&&(wr&62914560)===wr&&300>jl()-mN?!(Ur&2)&&Hy(e,0):l8|=n,zy===wr&&(zy=0)),vd(e)}function Eie(e,t){t===0&&(t=mne()),e=o0(e,t),e!==null&&(jS(e,t),vd(e))}function S_e(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Eie(e,n)}function E_e(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(at(314))}r!==null&&r.delete(t),Eie(e,n)}function k_e(e,t){return E$(e,t)}var KT=null,fb=null,oM=!1,JT=!1,VI=!1,fp=0;function vd(e){e!==fb&&e.next===null&&(fb===null?KT=fb=e:fb=fb.next=e),JT=!0,oM||(oM=!0,T_e())}function LS(e,t){if(!VI&&JT){VI=!0;do for(var n=!1,r=KT;r!==null;){if(e!==0){var i=r.pendingLanes;if(i===0)var s=0;else{var a=r.suspendedLanes,l=r.pingedLanes;s=(1<<31-Il(42|e)+1)-1,s&=i&~(a&~l),s=s&201326741?s&201326741|1:s?s|2:0}s!==0&&(n=!0,Az(r,s))}else s=wr,s=iN(r,r===vi?s:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(s&3)||NS(r,s)||(n=!0,Az(r,s));r=r.next}while(n);VI=!1}}function __e(){kie()}function kie(){JT=oM=!1;var e=0;fp!==0&&L_e()&&(e=fp);for(var t=jl(),n=null,r=KT;r!==null;){var i=r.next,s=_ie(r,t);s===0?(r.next=null,n===null?KT=i:n.next=i,i===null&&(fb=n)):(n=r,(e!==0||s&3)&&(JT=!0)),r=i}ea!==0&&ea!==5||LS(e),fp!==0&&(fp=0)}function _ie(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes&-62914561;0l)break;var d=c.transferSize,f=c.initiatorType;d&&Dz(f)&&(c=c.responseEnd,a+=d*(c"u"?null:document;function Pie(e,t,n){var r=L1;if(r&&typeof t=="string"&&t){var i=vc(t);i='link[rel="'+e+'"][href="'+i+'"]',typeof n=="string"&&(i+='[crossorigin="'+n+'"]'),Uz.has(i)||(Uz.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement("link"),$a(t,"link",e),fa(t),r.head.appendChild(t)))}}function q_e(e){dh.D(e),Pie("dns-prefetch",e,null)}function X_e(e,t){dh.C(e,t),Pie("preconnect",e,t)}function G_e(e,t,n){dh.L(e,t,n);var r=L1;if(r&&e&&t){var i='link[rel="preload"][as="'+vc(t)+'"]';t==="image"&&n&&n.imageSrcSet?(i+='[imagesrcset="'+vc(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(i+='[imagesizes="'+vc(n.imageSizes)+'"]')):i+='[href="'+vc(e)+'"]';var s=i;switch(t){case"style":s=qy(e);break;case"script":s=$1(e)}Mc.has(s)||(e=Ui({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Mc.set(s,e),r.querySelector(i)!==null||t==="style"&&r.querySelector($S(s))||t==="script"&&r.querySelector(BS(s))||(t=r.createElement("link"),$a(t,"link",e),fa(t),r.head.appendChild(t)))}}function W_e(e,t){dh.m(e,t);var n=L1;if(n&&e){var r=t&&typeof t.as=="string"?t.as:"script",i='link[rel="modulepreload"][as="'+vc(r)+'"][href="'+vc(e)+'"]',s=i;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=$1(e)}if(!Mc.has(s)&&(e=Ui({rel:"modulepreload",href:e},t),Mc.set(s,e),n.querySelector(i)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(BS(s)))return}r=n.createElement("link"),$a(r,"link",e),fa(r),n.head.appendChild(r)}}}function Y_e(e,t,n){dh.S(e,t,n);var r=L1;if(r&&e){var i=ry(r).hoistableStyles,s=qy(e);t=t||"default";var a=i.get(s);if(!a){var l={loading:0,preload:null};if(a=r.querySelector($S(s)))l.loading=5;else{e=Ui({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Mc.get(s))&&f8(e,n);var c=a=r.createElement("link");fa(c),$a(c,"link",e),c._p=new Promise(function(u,d){c.onload=u,c.onerror=d}),c.addEventListener("load",function(){l.loading|=1}),c.addEventListener("error",function(){l.loading|=2}),l.loading|=4,N_(a,t,r)}a={type:"stylesheet",instance:a,count:1,state:l},i.set(s,a)}}}function Z_e(e,t){dh.X(e,t);var n=L1;if(n&&e){var r=ry(n).hoistableScripts,i=$1(e),s=r.get(i);s||(s=n.querySelector(BS(i)),s||(e=Ui({src:e,async:!0},t),(t=Mc.get(i))&&h8(e,t),s=n.createElement("script"),fa(s),$a(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},r.set(i,s))}}function K_e(e,t){dh.M(e,t);var n=L1;if(n&&e){var r=ry(n).hoistableScripts,i=$1(e),s=r.get(i);s||(s=n.querySelector(BS(i)),s||(e=Ui({src:e,async:!0,type:"module"},t),(t=Mc.get(i))&&h8(e,t),s=n.createElement("script"),fa(s),$a(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},r.set(i,s))}}function Fz(e,t,n,r){var i=(i=Op.current)?nC(i):null;if(!i)throw Error(at(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=qy(n.href),n=ry(i).hoistableStyles,r=n.get(t),r||(r={type:"style",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=qy(n.href);var s=ry(i).hoistableStyles,a=s.get(e);if(a||(i=i.ownerDocument||i,a={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},s.set(e,a),(s=i.querySelector($S(e)))&&!s._p&&(a.instance=s,a.state.loading=5),Mc.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Mc.set(e,n),s||J_e(i,e,n,a.state))),t&&r===null)throw Error(at(528,""));return a}if(t&&r!==null)throw Error(at(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=$1(n),n=ry(i).hoistableScripts,r=n.get(t),r||(r={type:"script",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(at(444,e))}}function qy(e){return'href="'+vc(e)+'"'}function $S(e){return'link[rel="stylesheet"]['+e+"]"}function Mie(e){return Ui({},e,{"data-precedence":e.precedence,precedence:null})}function J_e(e,t,n,r){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=e.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),$a(t,"link",n),fa(t),e.head.appendChild(t))}function $1(e){return'[src="'+vc(e)+'"]'}function BS(e){return"script[async]"+e}function zz(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+vc(n.href)+'"]');if(r)return t.instance=r,fa(r),r;var i=Ui({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),fa(r),$a(r,"style",i),N_(r,n.precedence,e),t.instance=r;case"stylesheet":i=qy(n.href);var s=e.querySelector($S(i));if(s)return t.state.loading|=4,t.instance=s,fa(s),s;r=Mie(n),(i=Mc.get(i))&&f8(r,i),s=(e.ownerDocument||e).createElement("link"),fa(s);var a=s;return a._p=new Promise(function(l,c){a.onload=l,a.onerror=c}),$a(s,"link",r),t.state.loading|=4,N_(s,n.precedence,e),t.instance=s;case"script":return s=$1(n.src),(i=e.querySelector(BS(s)))?(t.instance=i,fa(i),i):(r=n,(i=Mc.get(s))&&(r=Ui({},n),h8(r,i)),e=e.ownerDocument||e,i=e.createElement("script"),fa(i),$a(i,"link",r),e.head.appendChild(i),t.instance=i);case"void":return null;default:throw Error(at(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,N_(r,n.precedence,e));return t.instance}function N_(e,t,n){for(var r=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),i=r.length?r[r.length-1]:null,s=i,a=0;a title"):null)}function eTe(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Lie(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function tTe(e,t,n,r){if(n.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var i=qy(r.href),s=t.querySelector($S(i));if(s){t=s._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=rC.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=s,fa(s);return}s=t.ownerDocument||t,r=Mie(r),(i=Mc.get(i))&&f8(r,i),s=s.createElement("link"),fa(s);var a=s;a._p=new Promise(function(l,c){a.onload=l,a.onerror=c}),$a(s,"link",r),n.instance=s}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=rC.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var YI=0;function nTe(e,t){return e.stylesheets&&e.count===0&&R_(e,e.stylesheets),0YI?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function rC(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)R_(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var iC=null;function R_(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,iC=new Map,t.forEach(rTe,e),iC=null,rC.call(e))}function rTe(e,t){if(!(t.state.loading&4)){var n=iC.get(e);if(n)var r=n.get(null);else{n=new Map,iC.set(e,n);for(var i=e.querySelectorAll("link[data-precedence],style[data-precedence]"),s=0;s"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Hie)}catch(e){console.error(e)}}Hie(),Jte.exports=nN;var dTe=Jte.exports;const fTe=N1(dTe),y8=p.createContext({});function xN(e){const t=p.useRef(null);return t.current===null&&(t.current=e()),t.current}const vN=p.createContext(null),pw=p.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class hTe extends p.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 pTe({children:e,isPresent:t}){const n=p.useId(),r=p.useRef(null),i=p.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=p.useContext(pw);return p.useInsertionEffect(()=>{const{width:a,height:l,top:c,left:u}=i.current;if(t||!r.current||!a||!l)return;r.current.dataset.motionPopId=n;const d=document.createElement("style");return s&&(d.nonce=s),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` +`+r.stack}}var N3=Object.prototype.hasOwnProperty,E$=ea.unstable_scheduleCallback,yI=ea.unstable_cancelCallback,zke=ea.unstable_shouldYield,Vke=ea.unstable_requestPaint,jl=ea.unstable_now,Hke=ea.unstable_getCurrentPriorityLevel,fne=ea.unstable_ImmediatePriority,hne=ea.unstable_UserBlockingPriority,MT=ea.unstable_NormalPriority,qke=ea.unstable_LowPriority,pne=ea.unstable_IdlePriority,Xke=ea.log,Gke=ea.unstable_setDisableYieldValue,jS=null,Rl=null;function lp(e){if(typeof Xke=="function"&&Gke(e),Rl&&typeof Rl.setStrictMode=="function")try{Rl.setStrictMode(jS,e)}catch{}}var Il=Math.clz32?Math.clz32:Zke,Wke=Math.log,Yke=Math.LN2;function Zke(e){return e>>>=0,e===0?32:31-(Wke(e)/Yke|0)|0}var Ek=256,kk=262144,_k=4194304;function Lm(e){var t=e&42;if(t!==0)return t;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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function iN(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,s=e.suspendedLanes,a=e.pingedLanes;e=e.warmLanes;var l=r&134217727;return l!==0?(r=l&~s,r!==0?i=Lm(r):(a&=l,a!==0?i=Lm(a):n||(n=l&~e,n!==0&&(i=Lm(n))))):(l=r&~s,l!==0?i=Lm(l):a!==0?i=Lm(a):n||(n=r&~e,n!==0&&(i=Lm(n)))),i===0?0:t!==0&&t!==i&&!(t&s)&&(s=i&-i,n=t&-t,s>=n||s===32&&(n&4194048)!==0)?t:i}function RS(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Kke(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function mne(){var e=_k;return _k<<=1,!(_k&62914560)&&(_k=4194304),e}function OI(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function IS(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Jke(e,t,n,r,i,s){var a=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var l=e.entanglements,c=e.expirationTimes,u=e.hiddenUpdates;for(n=a&~n;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var s2e=/[\n"\\]/g;function wc(e){return e.replace(s2e,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function I3(e,t,n,r,i,s,a,l){e.name="",a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"?e.type=a:e.removeAttribute("type"),t!=null?a==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+bc(t)):e.value!==""+bc(t)&&(e.value=""+bc(t)):a!=="submit"&&a!=="reset"||e.removeAttribute("value"),t!=null?D3(e,a,bc(t)):n!=null?D3(e,a,bc(n)):r!=null&&e.removeAttribute("value"),i==null&&s!=null&&(e.defaultChecked=!!s),i!=null&&(e.checked=i&&typeof i!="function"&&typeof i!="symbol"),l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"?e.name=""+bc(l):e.removeAttribute("name")}function Ene(e,t,n,r,i,s,a,l){if(s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(e.type=s),t!=null||n!=null){if(!(s!=="submit"&&s!=="reset"||t!=null)){R3(e);return}n=n!=null?""+bc(n):"",t=t!=null?""+bc(t):n,l||t===e.value||(e.value=t),e.defaultValue=t}r=r??i,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=l?e.checked:!!r,e.defaultChecked=!!r,a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"&&(e.name=a),R3(e)}function D3(e,t,n){t==="number"&<(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function iy(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),M3=!1;if(Hf)try{var HO={};Object.defineProperty(HO,"passive",{get:function(){M3=!0}}),window.addEventListener("test",HO,HO),window.removeEventListener("test",HO,HO)}catch{M3=!1}var cp=null,N$=null,S_=null;function Ane(){if(S_)return S_;var e,t=N$,n=t.length,r,i="value"in cp?cp.value:cp.textContent,s=i.length;for(e=0;e=av),FF=" ",zF=!1;function jne(e,t){switch(e){case"keyup":return I2e.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Rne(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var jb=!1;function P2e(e,t){switch(e){case"compositionend":return Rne(t);case"keypress":return t.which!==32?null:(zF=!0,FF);case"textInput":return e=t.data,e===FF&&zF?null:e;default:return null}}function M2e(e,t){if(jb)return e==="compositionend"||!R$&&jne(e,t)?(e=Ane(),S_=N$=cp=null,jb=!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=GF(n)}}function Mne(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Mne(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Lne(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=LT(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=LT(e.document)}return t}function I$(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")}var V2e=Hf&&"documentMode"in document&&11>=document.documentMode,Rb=null,L3=null,lv=null,$3=!1;function YF(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;$3||Rb==null||Rb!==LT(r)||(r=Rb,"selectionStart"in r&&I$(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}),lv&&sw(lv,r)||(lv=r,r=tC(L3,"onSelect"),0>=a,i-=a,ed=1<<32-Il(t)+i|n<_?(T=k,k=null):T=k.sibling;var C=h(O,k,x[_],w);if(C===null){k===null&&(k=T);break}e&&k&&C.alternate===null&&t(O,k),v=s(C,v,_),E===null?S=C:E.sibling=C,E=C,k=T}if(_===x.length)return n(O,k),_r&&df(O,_),S;if(k===null){for(;__?(T=k,k=null):T=k.sibling;var A=h(O,k,C.value,w);if(A===null){k===null&&(k=T);break}e&&k&&A.alternate===null&&t(O,k),v=s(A,v,_),E===null?S=A:E.sibling=A,E=A,k=T}if(C.done)return n(O,k),_r&&df(O,_),S;if(k===null){for(;!C.done;_++,C=x.next())C=f(O,C.value,w),C!==null&&(v=s(C,v,_),E===null?S=C:E.sibling=C,E=C);return _r&&df(O,_),S}for(k=r(k);!C.done;_++,C=x.next())C=m(k,O,_,C.value,w),C!==null&&(e&&C.alternate!==null&&k.delete(C.key===null?_:C.key),v=s(C,v,_),E===null?S=C:E.sibling=C,E=C);return e&&k.forEach(function(j){return t(O,j)}),_r&&df(O,_),S}function y(O,v,x,w){if(typeof x=="object"&&x!==null&&x.type===Tb&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case Sk:e:{for(var S=x.key;v!==null;){if(v.key===S){if(S=x.type,S===Tb){if(v.tag===7){n(O,v.sibling),w=i(v,x.props.children),w.return=O,O=w;break e}}else if(v.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Gh&&$m(S)===v.type){n(O,v.sibling),w=i(v,x.props),XO(w,x),w.return=O,O=w;break e}n(O,v);break}else t(O,v);v=v.sibling}x.type===Tb?(w=mg(x.props.children,O.mode,w,x.key),w.return=O,O=w):(w=k_(x.type,x.key,x.props,null,O.mode,w),XO(w,x),w.return=O,O=w)}return a(O);case Ix:e:{for(S=x.key;v!==null;){if(v.key===S)if(v.tag===4&&v.stateNode.containerInfo===x.containerInfo&&v.stateNode.implementation===x.implementation){n(O,v.sibling),w=i(v,x.children||[]),w.return=O,O=w;break e}else{n(O,v);break}else t(O,v);v=v.sibling}w=CI(x,O.mode,w),w.return=O,O=w}return a(O);case Gh:return x=$m(x),y(O,v,x,w)}if(Dx(x))return g(O,v,x,w);if(VO(x)){if(S=VO(x),typeof S!="function")throw Error(ct(150));return x=S.call(x),b(O,v,x,w)}if(typeof x.then=="function")return y(O,v,Nk(x),w);if(x.$$typeof===wf)return y(O,v,Ak(O,x),w);jk(O,x)}return typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint"?(x=""+x,v!==null&&v.tag===6?(n(O,v.sibling),w=i(v,x),w.return=O,O=w):(n(O,v),w=TI(x,O.mode,w),w.return=O,O=w),a(O)):n(O,v)}return function(O,v,x,w){try{lw=0;var S=y(O,v,x,w);return oy=null,S}catch(k){if(k===P1||k===uN)throw k;var E=_l(29,k,null,O.mode);return E.lanes=w,E.return=O,E}finally{}}}var jg=Kne(!0),Jne=Kne(!1),Wh=!1;function F$(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function H3(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function vp(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function wp(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Fr&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=BT(e),Vne(e,null,n),t}return cN(e,r,t,n),BT(e)}function uv(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,bne(e,n)}}function NI(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var a={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};s===null?i=s=a:s=s.next=a,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var q3=!1;function dv(){if(q3){var e=ay;if(e!==null)throw e}}function fv(e,t,n,r){q3=!1;var i=e.updateQueue;Wh=!1;var s=i.firstBaseUpdate,a=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,u=c.next;c.next=null,a===null?s=u:a.next=u,a=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==a&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(s!==null){var f=i.baseState;a=0,d=u=c=null,l=s;do{var h=l.lane&-536870913,m=h!==l.lane;if(m?(vr&h)===h:(r&h)===h){h!==0&&h===Qy&&(q3=!0),d!==null&&(d=d.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});e:{var g=e,b=l;h=t;var y=n;switch(b.tag){case 1:if(g=b.payload,typeof g=="function"){f=g.call(y,f,h);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=b.payload,h=typeof g=="function"?g.call(y,f,h):g,h==null)break e;f=Fi({},f,h);break e;case 2:Wh=!0}}h=l.callback,h!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[h]:m.push(h))}else m={lane:h,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=m,c=f):d=d.next=m,a|=h;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;m=l,l=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(!0);d===null&&(c=f),i.baseState=c,i.firstBaseUpdate=u,i.lastBaseUpdate=d,s===null&&(i.shared.lanes=0),$p|=a,e.lanes=a,e.memoizedState=f}}function ere(e,t){if(typeof e!="function")throw Error(ct(191,e));e.call(t)}function tre(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;es?s:8;var a=_n.T,l={};_n.T=l,t8(e,!1,t,n);try{var c=i(),u=_n.S;if(u!==null&&u(l,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=J2e(c,r);hv(e,t,d,Dl(e))}else hv(e,t,r,Dl(e))}catch(f){hv(e,t,{then:function(){},status:"rejected",reason:f},Dl())}finally{zr.p=s,a!==null&&l.types!==null&&(a.types=l.types),_n.T=a}}function s_e(){}function Z3(e,t,n,r){if(e.tag!==5)throw Error(ct(476));var i=_re(e).queue;kre(e,i,t,pg,n===null?s_e:function(){return Tre(e),n(r)})}function _re(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:pg,baseState:pg,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xf,lastRenderedState:pg},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xf,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Tre(e){var t=_re(e);t.next===null&&(t=e.alternate.memoizedState),hv(e,t.next.queue,{},Dl())}function e8(){return Pa(hw)}function Cre(){return Cs().memoizedState}function Are(){return Cs().memoizedState}function a_e(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Dl();e=vp(n);var r=wp(t,e,n);r!==null&&(Wo(r,t,n),uv(r,t,n)),t={cache:B$()},e.payload=t;return}t=t.return}}function o_e(e,t,n){var r=Dl();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},pN(e)?jre(t,n):(n=P$(e,t,n,r),n!==null&&(Wo(n,e,r),Rre(n,t,r)))}function Nre(e,t,n){var r=Dl();hv(e,t,n,r)}function hv(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(pN(e))jre(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var a=t.lastRenderedState,l=s(a,n);if(i.hasEagerState=!0,i.eagerState=l,Bl(l,a))return cN(e,t,i,0),Si===null&&lN(),!1}catch{}finally{}if(n=P$(e,t,i,r),n!==null)return Wo(n,e,r),Rre(n,t,r),!0}return!1}function t8(e,t,n,r){if(r={lane:2,revertLane:u8(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},pN(e)){if(t)throw Error(ct(479))}else t=P$(e,n,r,2),t!==null&&Wo(t,e,2)}function pN(e){var t=e.alternate;return e===Hn||t!==null&&t===Hn}function jre(e,t){ly=HT=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Rre(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,bne(e,n)}}var uw={readContext:Pa,use:fN,useCallback:ds,useContext:ds,useEffect:ds,useImperativeHandle:ds,useLayoutEffect:ds,useInsertionEffect:ds,useMemo:ds,useReducer:ds,useRef:ds,useState:ds,useDebugValue:ds,useDeferredValue:ds,useTransition:ds,useSyncExternalStore:ds,useId:ds,useHostTransitionStatus:ds,useFormState:ds,useActionState:ds,useOptimistic:ds,useMemoCache:ds,useCacheRefresh:ds};uw.useEffectEvent=ds;var Ire={readContext:Pa,use:fN,useCallback:function(e,t){return ho().memoizedState=[e,t===void 0?null:t],e},useContext:Pa,useEffect:dz,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,C_(4194308,4,xre.bind(null,t,e),n)},useLayoutEffect:function(e,t){return C_(4194308,4,e,t)},useInsertionEffect:function(e,t){C_(4,2,e,t)},useMemo:function(e,t){var n=ho();t=t===void 0?null:t;var r=e();if(Rg){lp(!0);try{e()}finally{lp(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=ho();if(n!==void 0){var i=n(t);if(Rg){lp(!0);try{n(t)}finally{lp(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=o_e.bind(null,Hn,e),[r.memoizedState,e]},useRef:function(e){var t=ho();return e={current:e},t.memoizedState=e},useState:function(e){e=W3(e);var t=e.queue,n=Nre.bind(null,Hn,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:K$,useDeferredValue:function(e,t){var n=ho();return J$(n,e,t)},useTransition:function(){var e=W3(!1);return e=kre.bind(null,Hn,e.queue,!0,!1),ho().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Hn,i=ho();if(_r){if(n===void 0)throw Error(ct(407));n=n()}else{if(n=t(),Si===null)throw Error(ct(349));vr&127||are(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,dz(lre.bind(null,r,s,e),[e]),r.flags|=2048,Fy(9,{destroy:void 0},ore.bind(null,r,s,n,t),null),n},useId:function(){var e=ho(),t=Si.identifierPrefix;if(_r){var n=td,r=ed;n=(r&~(1<<32-Il(r)-1)).toString(32)+n,t="_"+t+"R_"+n,n=qT++,0<\/script>",s=s.removeChild(s.firstChild);break;case"select":s=typeof r.is=="string"?a.createElement("select",{is:r.is}):a.createElement("select"),r.multiple?s.multiple=!0:r.size&&(s.size=r.size);break;default:s=typeof r.is=="string"?a.createElement(i,{is:r.is}):a.createElement(i)}}s[Ra]=t,s[Ko]=r;e:for(a=t.child;a!==null;){if(a.tag===5||a.tag===6)s.appendChild(a.stateNode);else if(a.tag!==4&&a.tag!==27&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break e;for(;a.sibling===null;){if(a.return===null||a.return===t)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}t.stateNode=s;e:switch(La(s,i,r),i){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&qd(t)}}return Di(t),$I(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&qd(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(ct(166));if(e=Op.current,F0(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=Ia,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[Ra]=t,e=!!(e.nodeValue===n||r!==null&&r.suppressHydrationWarning===!0||Nie(e.nodeValue,n)),e||Mp(t,!0)}else e=nC(e).createTextNode(r),e[Ra]=t,t.stateNode=e}return Di(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=F0(t),n!==null){if(e===null){if(!r)throw Error(ct(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ct(557));e[Ra]=t}else Ag(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Di(t),e=!1}else n=AI(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(El(t),t):(El(t),null);if(t.flags&128)throw Error(ct(558))}return Di(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=F0(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(ct(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(ct(317));i[Ra]=t}else Ag(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Di(t),i=!1}else i=AI(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(El(t),t):(El(t),null)}return El(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),s=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(s=r.memoizedState.cachePool.pool),s!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Rk(t,t.updateQueue),Di(t),null);case 4:return Ly(),e===null&&d8(t.stateNode.containerInfo),Di(t),null;case 10:return Nf(t.type),Di(t),null;case 19:if(ga(ks),r=t.memoizedState,r===null)return Di(t),null;if(i=(t.flags&128)!==0,s=r.rendering,s===null)if(i)GO(r,!1);else{if(hs!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=VT(e),s!==null){for(t.flags|=128,GO(r,!1),e=s.updateQueue,t.updateQueue=e,Rk(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Hne(n,e),n=n.sibling;return ji(ks,ks.current&1|2),_r&&df(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&jl()>YT&&(t.flags|=128,i=!0,GO(r,!1),t.lanes=4194304)}else{if(!i)if(e=VT(s),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Rk(t,e),GO(r,!0),r.tail===null&&r.tailMode==="hidden"&&!s.alternate&&!_r)return Di(t),null}else 2*jl()-r.renderingStartTime>YT&&n!==536870912&&(t.flags|=128,i=!0,GO(r,!1),t.lanes=4194304);r.isBackwards?(s.sibling=t.child,t.child=s):(e=r.last,e!==null?e.sibling=s:t.child=s,r.last=s)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=jl(),e.sibling=null,n=ks.current,ji(ks,i?n&1|2:n&1),_r&&df(t,r.treeForkCount),e):(Di(t),null);case 22:case 23:return El(t),z$(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Di(t),t.subtreeFlags&6&&(t.flags|=8192)):Di(t),n=t.updateQueue,n!==null&&Rk(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&ga(gg),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Nf($s),Di(t),null;case 25:return null;case 30:return null}throw Error(ct(156,t.tag))}function f_e(e,t){switch($$(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Nf($s),Ly(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return PT(t),null;case 31:if(t.memoizedState!==null){if(El(t),t.alternate===null)throw Error(ct(340));Ag()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(El(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ct(340));Ag()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ga(ks),null;case 4:return Ly(),null;case 10:return Nf(t.type),null;case 22:case 23:return El(t),z$(),e!==null&&ga(gg),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Nf($s),null;case 25:return null;default:return null}}function Hre(e,t){switch($$(t),t.tag){case 3:Nf($s),Ly();break;case 26:case 27:case 5:PT(t);break;case 4:Ly();break;case 31:t.memoizedState!==null&&El(t);break;case 13:El(t);break;case 19:ga(ks);break;case 10:Nf(t.type);break;case 22:case 23:El(t),z$(),e!==null&&ga(gg);break;case 24:Nf($s)}}function $S(e,t){try{var n=t.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var s=n.create,a=n.inst;r=s(),a.destroy=r}n=n.next}while(n!==i)}}catch(l){ci(t,t.return,l)}}function Lp(e,t,n){try{var r=t.updateQueue,i=r!==null?r.lastEffect:null;if(i!==null){var s=i.next;r=s;do{if((r.tag&e)===e){var a=r.inst,l=a.destroy;if(l!==void 0){a.destroy=void 0,i=t;var c=n,u=l;try{u()}catch(d){ci(i,c,d)}}}r=r.next}while(r!==s)}}catch(d){ci(t,t.return,d)}}function qre(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{tre(t,n)}catch(r){ci(e,e.return,r)}}}function Xre(e,t,n){n.props=Ig(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(r){ci(e,t,r)}}function pv(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n=="function"?e.refCleanup=n(r):n.current=r}}catch(i){ci(e,t,i)}}function nd(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r=="function")try{r()}catch(i){ci(e,t,i)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(i){ci(e,t,i)}else n.current=null}function Gre(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&r.focus();break e;case"img":n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(i){ci(e,e.return,i)}}function BI(e,t,n){try{var r=e.stateNode;D_e(r,e.type,n,t),r[Ko]=t}catch(i){ci(e,e.return,i)}}function Wre(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&om(e.type)||e.tag===4}function QI(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Wre(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.tag===27&&om(e.type)||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 nM(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Sf));else if(r!==4&&(r===27&&om(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(nM(e,t,n),e=e.sibling;e!==null;)nM(e,t,n),e=e.sibling}function WT(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&&(r===27&&om(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(WT(e,t,n),e=e.sibling;e!==null;)WT(e,t,n),e=e.sibling}function Yre(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);La(t,r,n),t[Ra]=e,t[Ko]=n}catch(s){ci(e,e.return,s)}}var bf=!1,Ls=!1,UI=!1,Ez=typeof WeakSet=="function"?WeakSet:Set,oa=null;function h_e(e,t){if(e=e.containerInfo,cM=aC,e=Lne(e),I$(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 i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var a=0,l=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(l=a+i),f!==s||r!==0&&f.nodeType!==3||(c=a+r),f.nodeType===3&&(a+=f.nodeValue.length),(m=f.firstChild)!==null;)h=f,f=m;for(;;){if(f===e)break t;if(h===n&&++u===i&&(l=a),h===s&&++d===r&&(c=a),(m=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=m}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(uM={focusedElem:e,selectionRange:n},aC=!1,oa=t;oa!==null;)if(t=oa,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,oa=e;else for(;oa!==null;){switch(t=oa,s=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n title"))),La(s,r,n),s[Ra]=e,ua(s),r=s;break e;case"link":var a=Vz("link","href",i).get(r+(n.href||""));if(a){for(var l=0;ly&&(a=y,y=b,b=a);var O=WF(l,b),v=WF(l,y);if(O&&v&&(m.rangeCount!==1||m.anchorNode!==O.node||m.anchorOffset!==O.offset||m.focusNode!==v.node||m.focusOffset!==v.offset)){var x=f.createRange();x.setStart(O.node,O.offset),m.removeAllRanges(),b>y?(m.addRange(x),m.extend(v.node,v.offset)):(x.setEnd(v.node,v.offset),m.addRange(x))}}}}for(f=[],m=l;m=m.parentNode;)m.nodeType===1&&f.push({element:m,left:m.scrollLeft,top:m.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;ln?32:n,_n.T=null,n=sM,sM=null;var s=Ep,a=jf;if(Ks=0,Vy=Ep=null,jf=0,Fr&6)throw Error(ct(331));var l=Fr;if(Fr|=4,oie(s.current),iie(s,s.current,a,n),Fr=l,BS(0,!1),Rl&&typeof Rl.onPostCommitFiberRoot=="function")try{Rl.onPostCommitFiberRoot(jS,s)}catch{}return!0}finally{zr.p=i,_n.T=r,wie(e,t)}}function Cz(e,t,n){t=Sc(n,t),t=J3(e.stateNode,t,2),e=wp(e,t,2),e!==null&&(IS(e,2),Sd(e))}function ci(e,t,n){if(e.tag===3)Cz(e,e,n);else for(;t!==null;){if(t.tag===3){Cz(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Sp===null||!Sp.has(r))){e=Sc(n,e),n=$re(2),r=wp(t,n,2),r!==null&&(Bre(n,r,t,e),IS(r,2),Sd(r));break}}t=t.return}}function zI(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new g_e;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(o8=!0,i.add(n),e=v_e.bind(null,e,t,n),t.then(e,e))}function v_e(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Si===e&&(vr&n)===n&&(hs===4||hs===3&&(vr&62914560)===vr&&300>jl()-mN?!(Fr&2)&&Hy(e,0):l8|=n,zy===vr&&(zy=0)),Sd(e)}function Eie(e,t){t===0&&(t=mne()),e=o0(e,t),e!==null&&(IS(e,t),Sd(e))}function w_e(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Eie(e,n)}function S_e(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(ct(314))}r!==null&&r.delete(t),Eie(e,n)}function E_e(e,t){return E$(e,t)}var JT=null,fb=null,oM=!1,eC=!1,VI=!1,fp=0;function Sd(e){e!==fb&&e.next===null&&(fb===null?JT=fb=e:fb=fb.next=e),eC=!0,oM||(oM=!0,__e())}function BS(e,t){if(!VI&&eC){VI=!0;do for(var n=!1,r=JT;r!==null;){if(e!==0){var i=r.pendingLanes;if(i===0)var s=0;else{var a=r.suspendedLanes,l=r.pingedLanes;s=(1<<31-Il(42|e)+1)-1,s&=i&~(a&~l),s=s&201326741?s&201326741|1:s?s|2:0}s!==0&&(n=!0,Az(r,s))}else s=vr,s=iN(r,r===Si?s:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(s&3)||RS(r,s)||(n=!0,Az(r,s));r=r.next}while(n);VI=!1}}function k_e(){kie()}function kie(){eC=oM=!1;var e=0;fp!==0&&M_e()&&(e=fp);for(var t=jl(),n=null,r=JT;r!==null;){var i=r.next,s=_ie(r,t);s===0?(r.next=null,n===null?JT=i:n.next=i,i===null&&(fb=n)):(n=r,(e!==0||s&3)&&(eC=!0)),r=i}Ks!==0&&Ks!==5||BS(e),fp!==0&&(fp=0)}function _ie(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes&-62914561;0l)break;var d=c.transferSize,f=c.initiatorType;d&&Dz(f)&&(c=c.responseEnd,a+=d*(c"u"?null:document;function Pie(e,t,n){var r=L1;if(r&&typeof t=="string"&&t){var i=wc(t);i='link[rel="'+e+'"][href="'+i+'"]',typeof n=="string"&&(i+='[crossorigin="'+n+'"]'),Uz.has(i)||(Uz.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement("link"),La(t,"link",e),ua(t),r.head.appendChild(t)))}}function H_e(e){dh.D(e),Pie("dns-prefetch",e,null)}function q_e(e,t){dh.C(e,t),Pie("preconnect",e,t)}function X_e(e,t,n){dh.L(e,t,n);var r=L1;if(r&&e&&t){var i='link[rel="preload"][as="'+wc(t)+'"]';t==="image"&&n&&n.imageSrcSet?(i+='[imagesrcset="'+wc(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(i+='[imagesizes="'+wc(n.imageSizes)+'"]')):i+='[href="'+wc(e)+'"]';var s=i;switch(t){case"style":s=qy(e);break;case"script":s=$1(e)}Lc.has(s)||(e=Fi({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Lc.set(s,e),r.querySelector(i)!==null||t==="style"&&r.querySelector(QS(s))||t==="script"&&r.querySelector(US(s))||(t=r.createElement("link"),La(t,"link",e),ua(t),r.head.appendChild(t)))}}function G_e(e,t){dh.m(e,t);var n=L1;if(n&&e){var r=t&&typeof t.as=="string"?t.as:"script",i='link[rel="modulepreload"][as="'+wc(r)+'"][href="'+wc(e)+'"]',s=i;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=$1(e)}if(!Lc.has(s)&&(e=Fi({rel:"modulepreload",href:e},t),Lc.set(s,e),n.querySelector(i)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(US(s)))return}r=n.createElement("link"),La(r,"link",e),ua(r),n.head.appendChild(r)}}}function W_e(e,t,n){dh.S(e,t,n);var r=L1;if(r&&e){var i=ry(r).hoistableStyles,s=qy(e);t=t||"default";var a=i.get(s);if(!a){var l={loading:0,preload:null};if(a=r.querySelector(QS(s)))l.loading=5;else{e=Fi({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Lc.get(s))&&f8(e,n);var c=a=r.createElement("link");ua(c),La(c,"link",e),c._p=new Promise(function(u,d){c.onload=u,c.onerror=d}),c.addEventListener("load",function(){l.loading|=1}),c.addEventListener("error",function(){l.loading|=2}),l.loading|=4,R_(a,t,r)}a={type:"stylesheet",instance:a,count:1,state:l},i.set(s,a)}}}function Y_e(e,t){dh.X(e,t);var n=L1;if(n&&e){var r=ry(n).hoistableScripts,i=$1(e),s=r.get(i);s||(s=n.querySelector(US(i)),s||(e=Fi({src:e,async:!0},t),(t=Lc.get(i))&&h8(e,t),s=n.createElement("script"),ua(s),La(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},r.set(i,s))}}function Z_e(e,t){dh.M(e,t);var n=L1;if(n&&e){var r=ry(n).hoistableScripts,i=$1(e),s=r.get(i);s||(s=n.querySelector(US(i)),s||(e=Fi({src:e,async:!0,type:"module"},t),(t=Lc.get(i))&&h8(e,t),s=n.createElement("script"),ua(s),La(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},r.set(i,s))}}function Fz(e,t,n,r){var i=(i=Op.current)?rC(i):null;if(!i)throw Error(ct(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=qy(n.href),n=ry(i).hoistableStyles,r=n.get(t),r||(r={type:"style",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=qy(n.href);var s=ry(i).hoistableStyles,a=s.get(e);if(a||(i=i.ownerDocument||i,a={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},s.set(e,a),(s=i.querySelector(QS(e)))&&!s._p&&(a.instance=s,a.state.loading=5),Lc.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Lc.set(e,n),s||K_e(i,e,n,a.state))),t&&r===null)throw Error(ct(528,""));return a}if(t&&r!==null)throw Error(ct(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=$1(n),n=ry(i).hoistableScripts,r=n.get(t),r||(r={type:"script",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(ct(444,e))}}function qy(e){return'href="'+wc(e)+'"'}function QS(e){return'link[rel="stylesheet"]['+e+"]"}function Mie(e){return Fi({},e,{"data-precedence":e.precedence,precedence:null})}function K_e(e,t,n,r){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=e.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),La(t,"link",n),ua(t),e.head.appendChild(t))}function $1(e){return'[src="'+wc(e)+'"]'}function US(e){return"script[async]"+e}function zz(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+wc(n.href)+'"]');if(r)return t.instance=r,ua(r),r;var i=Fi({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),ua(r),La(r,"style",i),R_(r,n.precedence,e),t.instance=r;case"stylesheet":i=qy(n.href);var s=e.querySelector(QS(i));if(s)return t.state.loading|=4,t.instance=s,ua(s),s;r=Mie(n),(i=Lc.get(i))&&f8(r,i),s=(e.ownerDocument||e).createElement("link"),ua(s);var a=s;return a._p=new Promise(function(l,c){a.onload=l,a.onerror=c}),La(s,"link",r),t.state.loading|=4,R_(s,n.precedence,e),t.instance=s;case"script":return s=$1(n.src),(i=e.querySelector(US(s)))?(t.instance=i,ua(i),i):(r=n,(i=Lc.get(s))&&(r=Fi({},n),h8(r,i)),e=e.ownerDocument||e,i=e.createElement("script"),ua(i),La(i,"link",r),e.head.appendChild(i),t.instance=i);case"void":return null;default:throw Error(ct(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,R_(r,n.precedence,e));return t.instance}function R_(e,t,n){for(var r=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),i=r.length?r[r.length-1]:null,s=i,a=0;a title"):null)}function J_e(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Lie(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function eTe(e,t,n,r){if(n.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&!(n.state.loading&4)){if(n.instance===null){var i=qy(r.href),s=t.querySelector(QS(i));if(s){t=s._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=iC.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=s,ua(s);return}s=t.ownerDocument||t,r=Mie(r),(i=Lc.get(i))&&f8(r,i),s=s.createElement("link"),ua(s);var a=s;a._p=new Promise(function(l,c){a.onload=l,a.onerror=c}),La(s,"link",r),n.instance=s}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=iC.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var YI=0;function tTe(e,t){return e.stylesheets&&e.count===0&&D_(e,e.stylesheets),0YI?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function iC(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)D_(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var sC=null;function D_(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,sC=new Map,t.forEach(nTe,e),sC=null,iC.call(e))}function nTe(e,t){if(!(t.state.loading&4)){var n=sC.get(e);if(n)var r=n.get(null);else{n=new Map,sC.set(e,n);for(var i=e.querySelectorAll("link[data-precedence],style[data-precedence]"),s=0;s"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Hie)}catch(e){console.error(e)}}Hie(),Jte.exports=nN;var uTe=Jte.exports;const dTe=N1(uTe),y8=p.createContext({});function xN(e){const t=p.useRef(null);return t.current===null&&(t.current=e()),t.current}const vN=p.createContext(null),gw=p.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class fTe extends p.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 hTe({children:e,isPresent:t}){const n=p.useId(),r=p.useRef(null),i=p.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=p.useContext(gw);return p.useInsertionEffect(()=>{const{width:a,height:l,top:c,left:u}=i.current;if(t||!r.current||!a||!l)return;r.current.dataset.motionPopId=n;const d=document.createElement("style");return s&&(d.nonce=s),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` [data-motion-pop-id="${n}"] { position: absolute !important; width: ${a}px !important; @@ -55,375 +55,375 @@ Error generating stack: `+r.message+` top: ${c}px !important; left: ${u}px !important; } - `),()=>{document.head.removeChild(d)}},[t]),o.jsx(hTe,{isPresent:t,childRef:r,sizeRef:i,children:p.cloneElement(e,{ref:r})})}const mTe=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:s,mode:a})=>{const l=xN(gTe),c=p.useId(),u=p.useCallback(f=>{l.set(f,!0);for(const h of l.values())if(!h)return;r&&r()},[l,r]),d=p.useMemo(()=>({id:c,initial:t,isPresent:n,custom:i,onExitComplete:u,register:f=>(l.set(f,!1),()=>l.delete(f))}),s?[Math.random(),u]:[n,u]);return p.useMemo(()=>{l.forEach((f,h)=>l.set(h,!1))},[n]),p.useEffect(()=>{!n&&!l.size&&r&&r()},[n]),a==="popLayout"&&(e=o.jsx(pTe,{isPresent:n,children:e})),o.jsx(vN.Provider,{value:d,children:e})};function gTe(){return new Map}function qie(e=!0){const t=p.useContext(vN);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:i}=t,s=p.useId();p.useEffect(()=>{e&&i(s)},[e]);const a=p.useCallback(()=>e&&r&&r(s),[s,r,e]);return!n&&r?[!1,a]:[!0]}const Mk=e=>e.key||"";function Kz(e){const t=[];return p.Children.forEach(e,n=>{p.isValidElement(n)&&t.push(n)}),t}const O8=typeof window<"u",Xie=O8?p.useLayoutEffect:p.useEffect,hu=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:s="sync",propagate:a=!1})=>{const[l,c]=qie(a),u=p.useMemo(()=>Kz(e),[e]),d=a&&!l?[]:u.map(Mk),f=p.useRef(!0),h=p.useRef(u),m=xN(()=>new Map),[g,b]=p.useState(u),[y,O]=p.useState(u);Xie(()=>{f.current=!1,h.current=u;for(let w=0;w{const S=Mk(w),E=a&&!l?!1:u===y||d.includes(S),k=()=>{if(m.has(S))m.set(S,!0);else return;let _=!0;m.forEach(C=>{C||(_=!1)}),_&&(x==null||x(),O(h.current),a&&(c==null||c()),r&&r())};return o.jsx(mTe,{isPresent:E,initial:!f.current||n?void 0:!1,custom:E?void 0:t,presenceAffectsLayout:i,mode:s,onExitComplete:E?void 0:k,children:w},S)})})},Pl=e=>e;let Gie=Pl;const bTe={useManualTiming:!1};function yTe(e){let t=new Set,n=new Set,r=!1,i=!1;const s=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function l(u){s.has(u)&&(c.schedule(u),e()),u(a)}const c={schedule:(u,d=!1,f=!1)=>{const m=f&&r?t:n;return d&&s.add(u),m.has(u)||m.add(u),u},cancel:u=>{n.delete(u),s.delete(u)},process:u=>{if(a=u,r){i=!0;return}r=!0,[t,n]=[n,t],t.forEach(l),t.clear(),r=!1,i&&(i=!1,c.process(u))}};return c}const Lk=["read","resolveKeyframes","update","preRender","render","postRender"],OTe=40;function Wie(e,t){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>n=!0,a=Lk.reduce((O,v)=>(O[v]=yTe(s),O),{}),{read:l,resolveKeyframes:c,update:u,preRender:d,render:f,postRender:h}=a,m=()=>{const O=performance.now();n=!1,i.delta=r?1e3/60:Math.max(Math.min(O-i.timestamp,OTe),1),i.timestamp=O,i.isProcessing=!0,l.process(i),c.process(i),u.process(i),d.process(i),f.process(i),h.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(m))},g=()=>{n=!0,r=!0,i.isProcessing||e(m)};return{schedule:Lk.reduce((O,v)=>{const x=a[v];return O[v]=(w,S=!1,E=!1)=>(n||g(),x.schedule(w,S,E)),O},{}),cancel:O=>{for(let v=0;vJz[e].some(n=>!!t[n])};function xTe(e){for(const t in e)Gy[t]={...Gy[t],...e[t]}}const vTe=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 oC(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||vTe.has(e)}let Zie=e=>!oC(e);function Kie(e){e&&(Zie=t=>t.startsWith("on")?!oC(t):e(t))}try{Kie(require("@emotion/is-prop-valid").default)}catch{}function wTe(e,t,n){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||(Zie(i)||n===!0&&oC(i)||!t&&!oC(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}function STe({children:e,isValidProp:t,...n}){t&&Kie(t),n={...p.useContext(pw),...n},n.isStatic=xN(()=>n.isStatic);const r=p.useMemo(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion]);return o.jsx(pw.Provider,{value:r,children:e})}function ETe(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...r)=>e(...r);return new Proxy(n,{get:(r,i)=>i==="create"?e:(t.has(i)||t.set(i,e(i)),t.get(i))})}const wN=p.createContext({});function mw(e){return typeof e=="string"||Array.isArray(e)}function SN(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const x8=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],v8=["initial",...x8];function EN(e){return SN(e.animate)||v8.some(t=>mw(e[t]))}function Jie(e){return!!(EN(e)||e.variants)}function kTe(e,t){if(EN(e)){const{initial:n,animate:r}=e;return{initial:n===!1||mw(n)?n:void 0,animate:mw(r)?r:void 0}}return e.inherit!==!1?t:{}}function _Te(e){const{initial:t,animate:n}=kTe(e,p.useContext(wN));return p.useMemo(()=>({initial:t,animate:n}),[eV(t),eV(n)])}function eV(e){return Array.isArray(e)?e.join(" "):e}const TTe=Symbol.for("motionComponentSymbol");function Bb(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function CTe(e,t,n){return p.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):Bb(n)&&(n.current=r))},[t])}const w8=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),ATe="framerAppearId",ese="data-"+w8(ATe),{schedule:S8}=Wie(queueMicrotask,!1),tse=p.createContext({});function NTe(e,t,n,r,i){var s,a;const{visualElement:l}=p.useContext(wN),c=p.useContext(Yie),u=p.useContext(vN),d=p.useContext(pw).reducedMotion,f=p.useRef(null);r=r||c.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:l,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:d}));const h=f.current,m=p.useContext(tse);h&&!h.projection&&i&&(h.type==="html"||h.type==="svg")&&jTe(f.current,n,i,m);const g=p.useRef(!1);p.useInsertionEffect(()=>{h&&g.current&&h.update(n,u)});const b=n[ese],y=p.useRef(!!b&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,b))&&((a=window.MotionHasOptimisedAnimation)===null||a===void 0?void 0:a.call(window,b)));return Xie(()=>{h&&(g.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),S8.render(h.render),y.current&&h.animationState&&h.animationState.animateChanges())}),p.useEffect(()=>{h&&(!y.current&&h.animationState&&h.animationState.animateChanges(),y.current&&(queueMicrotask(()=>{var O;(O=window.MotionHandoffMarkAsComplete)===null||O===void 0||O.call(window,b)}),y.current=!1))}),h}function jTe(e,t,n,r){const{layoutId:i,layout:s,drag:a,dragConstraints:l,layoutScroll:c,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:nse(e.parent)),e.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!a||l&&Bb(l),visualElement:e,animationType:typeof s=="string"?s:"both",initialPromotionConfig:r,layoutScroll:c,layoutRoot:u})}function nse(e){if(e)return e.options.allowProjection!==!1?e.projection:nse(e.parent)}function RTe({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:i}){var s,a;e&&xTe(e);function l(u,d){let f;const h={...p.useContext(pw),...u,layoutId:ITe(u)},{isStatic:m}=h,g=_Te(u),b=r(u,m);if(!m&&O8){DTe();const y=PTe(h);f=y.MeasureLayout,g.visualElement=NTe(i,b,h,t,y.ProjectionNode)}return o.jsxs(wN.Provider,{value:g,children:[f&&g.visualElement?o.jsx(f,{visualElement:g.visualElement,...h}):null,n(i,u,CTe(b,g.visualElement,d),b,m,g.visualElement)]})}l.displayName=`motion.${typeof i=="string"?i:`create(${(a=(s=i.displayName)!==null&&s!==void 0?s:i.name)!==null&&a!==void 0?a:""})`}`;const c=p.forwardRef(l);return c[TTe]=i,c}function ITe({layoutId:e}){const t=p.useContext(y8).id;return t&&e!==void 0?t+"-"+e:e}function DTe(e,t){p.useContext(Yie).strict}function PTe(e){const{drag:t,layout:n}=Gy;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 MTe=["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 E8(e){return typeof e!="string"||e.includes("-")?!1:!!(MTe.indexOf(e)>-1||/[A-Z]/u.test(e))}function tV(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function k8(e,t,n,r){if(typeof t=="function"){const[i,s]=tV(r);t=t(n!==void 0?n:e.custom,i,s)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,s]=tV(r);t=t(n!==void 0?n:e.custom,i,s)}return t}const yM=e=>Array.isArray(e),LTe=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),$Te=e=>yM(e)?e[e.length-1]||0:e,Ya=e=>!!(e&&e.getVelocity);function D_(e){const t=Ya(e)?e.get():e;return LTe(t)?t.toValue():t}function BTe({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},r,i,s){const a={latestValues:QTe(r,i,s,e),renderState:t()};return n&&(a.onMount=l=>n({props:r,current:l,...a}),a.onUpdate=l=>n(l)),a}const rse=e=>(t,n)=>{const r=p.useContext(wN),i=p.useContext(vN),s=()=>BTe(e,t,r,i);return n?s():xN(s)};function QTe(e,t,n,r){const i={},s=r(e,{});for(const h in s)i[h]=D_(s[h]);let{initial:a,animate:l}=e;const c=EN(e),u=Jie(e);t&&u&&!c&&e.inherit!==!1&&(a===void 0&&(a=t.initial),l===void 0&&(l=t.animate));let d=n?n.initial===!1:!1;d=d||a===!1;const f=d?l:a;if(f&&typeof f!="boolean"&&!SN(f)){const h=Array.isArray(f)?f:[f];for(let m=0;mt=>typeof t=="string"&&t.startsWith(e),sse=ise("--"),UTe=ise("var(--"),_8=e=>UTe(e)?FTe.test(e.split("/*")[0].trim()):!1,FTe=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,ase=(e,t)=>t&&typeof e=="number"?t.transform(e):e,Yf=(e,t,n)=>n>t?t:ntypeof e=="number",parse:parseFloat,transform:e=>e},gw={...Q1,transform:e=>Yf(0,1,e)},$k={...Q1,default:1},QS=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Vh=QS("deg"),ld=QS("%"),Sn=QS("px"),zTe=QS("vh"),VTe=QS("vw"),nV={...ld,parse:e=>ld.parse(e)/100,transform:e=>ld.transform(e*100)},HTe={borderWidth:Sn,borderTopWidth:Sn,borderRightWidth:Sn,borderBottomWidth:Sn,borderLeftWidth:Sn,borderRadius:Sn,radius:Sn,borderTopLeftRadius:Sn,borderTopRightRadius:Sn,borderBottomRightRadius:Sn,borderBottomLeftRadius:Sn,width:Sn,maxWidth:Sn,height:Sn,maxHeight:Sn,top:Sn,right:Sn,bottom:Sn,left:Sn,padding:Sn,paddingTop:Sn,paddingRight:Sn,paddingBottom:Sn,paddingLeft:Sn,margin:Sn,marginTop:Sn,marginRight:Sn,marginBottom:Sn,marginLeft:Sn,backgroundPositionX:Sn,backgroundPositionY:Sn},qTe={rotate:Vh,rotateX:Vh,rotateY:Vh,rotateZ:Vh,scale:$k,scaleX:$k,scaleY:$k,scaleZ:$k,skew:Vh,skewX:Vh,skewY:Vh,distance:Sn,translateX:Sn,translateY:Sn,translateZ:Sn,x:Sn,y:Sn,z:Sn,perspective:Sn,transformPerspective:Sn,opacity:gw,originX:nV,originY:nV,originZ:Sn},rV={...Q1,transform:Math.round},T8={...HTe,...qTe,zIndex:rV,size:Sn,fillOpacity:gw,strokeOpacity:gw,numOctaves:rV},XTe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},GTe=B1.length;function WTe(e,t,n){let r="",i=!0;for(let s=0;s({style:{},transform:{},transformOrigin:{},vars:{}}),ose=()=>({...N8(),attrs:{}}),j8=e=>typeof e=="string"&&e.toLowerCase()==="svg";function lse(e,{style:t,vars:n},r,i){Object.assign(e.style,t,i&&i.getProjectionStyles(r));for(const s in n)e.style.setProperty(s,n[s])}const cse=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 use(e,t,n,r){lse(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(cse.has(i)?i:w8(i),t.attrs[i])}const lC={};function eCe(e){Object.assign(lC,e)}function dse(e,{layout:t,layoutId:n}){return c0.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!lC[e]||e==="opacity")}function R8(e,t,n){var r;const{style:i}=e,s={};for(const a in i)(Ya(i[a])||t.style&&Ya(t.style[a])||dse(a,e)||((r=n==null?void 0:n.getValue(a))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(s[a]=i[a]);return s}function fse(e,t,n){const r=R8(e,t,n);for(const i in e)if(Ya(e[i])||Ya(t[i])){const s=B1.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[s]=e[i]}return r}function tCe(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 sV=["x","y","width","height","cx","cy","r"],nCe={useVisualState:rse({scrapeMotionValuesFromProps:fse,createRenderState:ose,onUpdate:({props:e,prevProps:t,current:n,renderState:r,latestValues:i})=>{if(!n)return;let s=!!e.drag;if(!s){for(const l in i)if(c0.has(l)){s=!0;break}}if(!s)return;let a=!t;if(t)for(let l=0;l{tCe(n,r),Qi.render(()=>{A8(r,i,j8(n.tagName),e.transformTemplate),use(n,r)})})}})},rCe={useVisualState:rse({scrapeMotionValuesFromProps:R8,createRenderState:N8})};function hse(e,t,n){for(const r in t)!Ya(t[r])&&!dse(r,n)&&(e[r]=t[r])}function iCe({transformTemplate:e},t){return p.useMemo(()=>{const n=N8();return C8(n,t,e),Object.assign({},n.vars,n.style)},[t])}function sCe(e,t){const n=e.style||{},r={};return hse(r,n,e),Object.assign(r,iCe(e,t)),r}function aCe(e,t){const n={},r=sCe(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 oCe(e,t,n,r){const i=p.useMemo(()=>{const s=ose();return A8(s,t,j8(r),e.transformTemplate),{...s.attrs,style:{...s.style}}},[t]);if(e.style){const s={};hse(s,e.style,e),i.style={...s,...i.style}}return i}function lCe(e=!1){return(n,r,i,{latestValues:s},a)=>{const c=(E8(n)?oCe:aCe)(r,s,a,n),u=wTe(r,typeof n=="string",e),d=n!==p.Fragment?{...u,...c,ref:i}:{},{children:f}=r,h=p.useMemo(()=>Ya(f)?f.get():f,[f]);return p.createElement(n,{...d,children:h})}}function cCe(e,t){return function(r,{forwardMotionProps:i}={forwardMotionProps:!1}){const a={...E8(r)?nCe:rCe,preloadedFeatures:e,useRender:lCe(i),createVisualElement:t,Component:r};return RTe(a)}}function pse(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r(P_===void 0&&cd.set(Ca.isProcessing||bTe.useManualTiming?Ca.timestamp:performance.now()),P_),set:e=>{P_=e,queueMicrotask(uCe)}};function D8(e,t){e.indexOf(t)===-1&&e.push(t)}function P8(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class M8{constructor(){this.subscriptions=[]}add(t){return D8(this.subscriptions,t),()=>P8(this.subscriptions,t)}notify(t,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,r);else for(let s=0;s!isNaN(parseFloat(e));class fCe{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,i=!0)=>{const s=cd.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&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=cd.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=dCe(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 M8);const r=this.events[t].add(n);return t==="change"?()=>{r(),Qi.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=cd.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>aV)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,aV);return gse(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 bw(e,t){return new fCe(e,t)}function hCe(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,bw(n))}function pCe(e,t){const n=kN(e,t);let{transitionEnd:r={},transition:i={},...s}=n||{};s={...s,...r};for(const a in s){const l=$Te(s[a]);hCe(e,a,l)}}function mCe(e){return!!(Ya(e)&&e.add)}function OM(e,t){const n=e.getValue("willChange");if(mCe(n))return n.add(t)}function bse(e){return e.props[ese]}function L8(e){let t;return()=>(t===void 0&&(t=e()),t)}const gCe=L8(()=>window.ScrollTimeline!==void 0);class bCe{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(gCe()&&i.attachTimeline)return i.attachTimeline(t);if(typeof n=="function")return n(i)});return()=>{r.forEach((i,s)=>{i&&i(),this.animations[s].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 yCe extends bCe{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}const Rf=e=>e*1e3,If=e=>e/1e3;function $8(e){return typeof e=="function"}function oV(e,t){e.timeline=t,e.onfinish=null}const B8=e=>Array.isArray(e)&&typeof e[0]=="number",OCe={linearEasing:void 0};function xCe(e,t){const n=L8(e);return()=>{var r;return(r=OCe[t])!==null&&r!==void 0?r:n()}}const cC=xCe(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Wy=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},yse=(e,t,n=10)=>{let r="";const i=Math.max(Math.round(t/n),2);for(let s=0;s`cubic-bezier(${e}, ${t}, ${n}, ${r})`,xM={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:$x([0,.65,.55,1]),circOut:$x([.55,0,1,.45]),backIn:$x([.31,.01,.66,-.59]),backOut:$x([.33,1.53,.69,.99])};function xse(e,t){if(e)return typeof e=="function"&&cC()?yse(e,t):B8(e)?$x(e):Array.isArray(e)?e.map(n=>xse(n,t)||xM.easeOut):xM[e]}const vse=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,vCe=1e-7,wCe=12;function SCe(e,t,n,r,i){let s,a,l=0;do a=t+(n-t)/2,s=vse(a,r,i)-e,s>0?n=a:t=a;while(Math.abs(s)>vCe&&++lSCe(s,0,1,e,n);return s=>s===0||s===1?s:vse(i(s),t,r)}const wse=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Sse=e=>t=>1-e(1-t),Ese=US(.33,1.53,.69,.99),Q8=Sse(Ese),kse=wse(Q8),_se=e=>(e*=2)<1?.5*Q8(e):.5*(2-Math.pow(2,-10*(e-1))),U8=e=>1-Math.sin(Math.acos(e)),Tse=Sse(U8),Cse=wse(U8),Ase=e=>/^0[^.\s]+$/u.test(e);function ECe(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Ase(e):!0}const yv=e=>Math.round(e*1e5)/1e5,F8=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function kCe(e){return e==null}const _Ce=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,z8=(e,t)=>n=>!!(typeof n=="string"&&_Ce.test(n)&&n.startsWith(e)||t&&!kCe(n)&&Object.prototype.hasOwnProperty.call(n,t)),Nse=(e,t,n)=>r=>{if(typeof r!="string")return r;const[i,s,a,l]=r.match(F8);return{[e]:parseFloat(i),[t]:parseFloat(s),[n]:parseFloat(a),alpha:l!==void 0?parseFloat(l):1}},TCe=e=>Yf(0,255,e),KI={...Q1,transform:e=>Math.round(TCe(e))},rg={test:z8("rgb","red"),parse:Nse("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+KI.transform(e)+", "+KI.transform(t)+", "+KI.transform(n)+", "+yv(gw.transform(r))+")"};function CCe(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const vM={test:z8("#"),parse:CCe,transform:rg.transform},Qb={test:z8("hsl","hue"),parse:Nse("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+ld.transform(yv(t))+", "+ld.transform(yv(n))+", "+yv(gw.transform(r))+")"},Xa={test:e=>rg.test(e)||vM.test(e)||Qb.test(e),parse:e=>rg.test(e)?rg.parse(e):Qb.test(e)?Qb.parse(e):vM.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?rg.transform(e):Qb.transform(e)},ACe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function NCe(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(F8))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(ACe))===null||n===void 0?void 0:n.length)||0)>0}const jse="number",Rse="color",jCe="var",RCe="var(",lV="${}",ICe=/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 yw(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[];let s=0;const l=t.replace(ICe,c=>(Xa.test(c)?(r.color.push(s),i.push(Rse),n.push(Xa.parse(c))):c.startsWith(RCe)?(r.var.push(s),i.push(jCe),n.push(c)):(r.number.push(s),i.push(jse),n.push(parseFloat(c))),++s,lV)).split(lV);return{values:n,split:l,indexes:r,types:i}}function Ise(e){return yw(e).values}function Dse(e){const{split:t,types:n}=yw(e),r=t.length;return i=>{let s="";for(let a=0;atypeof e=="number"?0:e;function PCe(e){const t=Ise(e);return Dse(e)(t.map(DCe))}const Qp={test:NCe,parse:Ise,createTransformer:Dse,getAnimatableNone:PCe},MCe=new Set(["brightness","contrast","saturate","opacity"]);function LCe(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(F8)||[];if(!r)return e;const i=n.replace(r,"");let s=MCe.has(t)?1:0;return r!==n&&(s*=100),t+"("+s+i+")"}const $Ce=/\b([a-z-]*)\(.*?\)/gu,wM={...Qp,getAnimatableNone:e=>{const t=e.match($Ce);return t?t.map(LCe).join(" "):e}},BCe={...T8,color:Xa,backgroundColor:Xa,outlineColor:Xa,fill:Xa,stroke:Xa,borderColor:Xa,borderTopColor:Xa,borderRightColor:Xa,borderBottomColor:Xa,borderLeftColor:Xa,filter:wM,WebkitFilter:wM},V8=e=>BCe[e];function Pse(e,t){let n=V8(e);return n!==wM&&(n=Qp),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const QCe=new Set(["auto","none","0"]);function UCe(e,t,n){let r=0,i;for(;re===Q1||e===Sn,uV=(e,t)=>parseFloat(e.split(", ")[t]),dV=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/u);if(i)return uV(i[1],t);{const s=r.match(/^matrix\((.+)\)$/u);return s?uV(s[1],e):0}},FCe=new Set(["x","y","z"]),zCe=B1.filter(e=>!FCe.has(e));function VCe(e){const t=[];return zCe.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const Yy={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:dV(4,13),y:dV(5,14)};Yy.translateX=Yy.x;Yy.translateY=Yy.y;const Og=new Set;let SM=!1,EM=!1;function Mse(){if(EM){const e=Array.from(Og).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const i=VCe(r);i.length&&(n.set(r,i),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const i=n.get(r);i&&i.forEach(([s,a])=>{var l;(l=r.getValue(s))===null||l===void 0||l.set(a)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}EM=!1,SM=!1,Og.forEach(e=>e.complete()),Og.clear()}function Lse(){Og.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(EM=!0)})}function HCe(){Lse(),Mse()}class H8{constructor(t,n,r,i,s,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=i,this.element=s,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Og.add(this),SM||(SM=!0,Qi.read(Lse),Qi.resolveKeyframes(Mse))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:i}=this;for(let s=0;s/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),qCe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function XCe(e){const t=qCe.exec(e);if(!t)return[,];const[,n,r,i]=t;return[`--${n??r}`,i]}function Bse(e,t,n=1){const[r,i]=XCe(e);if(!r)return;const s=window.getComputedStyle(t).getPropertyValue(r);if(s){const a=s.trim();return $se(a)?parseFloat(a):a}return _8(i)?Bse(i,t,n+1):i}const Qse=e=>t=>t.test(e),GCe={test:e=>e==="auto",parse:e=>e},Use=[Q1,Sn,ld,Vh,VTe,zTe,GCe],fV=e=>Use.find(Qse(e));class Fse extends H8{constructor(t,n,r,i,s){super(t,n,r,i,s,!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 hV=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Qp.test(e)||e==="0")&&!e.startsWith("url("));function WCe(e){const t=e[0];if(e.length===1)return!0;for(let n=0;ne!==null;function _N(e,{repeat:t,repeatType:n="loop"},r){const i=e.filter(ZCe),s=t&&n!=="loop"&&t%2===1?0:i.length-1;return!s||r===void 0?i[s]:r}const KCe=40;class zse{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:i=0,repeatDelay:s=0,repeatType:a="loop",...l}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=cd.now(),this.options={autoplay:t,delay:n,type:r,repeat:i,repeatDelay:s,repeatType:a,...l},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>KCe?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&HCe(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=cd.now(),this.hasAttemptedResolve=!0;const{name:r,type:i,velocity:s,delay:a,onComplete:l,onUpdate:c,isGenerator:u}=this.options;if(!u&&!YCe(t,r,i,s))if(a)this.options.duration=0;else{c&&c(_N(t,this.options,n)),l&&l(),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 kM=2e4;function Vse(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=kM?1/0:t}const is=(e,t,n)=>e+(t-e)*n;function JI(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 JCe({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,s=0,a=0;if(!t)i=s=a=n;else{const l=n<.5?n*(1+t):n+t-n*t,c=2*n-l;i=JI(c,l,e+1/3),s=JI(c,l,e),a=JI(c,l,e-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(a*255),alpha:r}}function uC(e,t){return n=>n>0?t:e}const e5=(e,t,n)=>{const r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},eAe=[vM,rg,Qb],tAe=e=>eAe.find(t=>t.test(e));function pV(e){const t=tAe(e);if(!t)return!1;let n=t.parse(e);return t===Qb&&(n=JCe(n)),n}const mV=(e,t)=>{const n=pV(e),r=pV(t);if(!n||!r)return uC(e,t);const i={...n};return s=>(i.red=e5(n.red,r.red,s),i.green=e5(n.green,r.green,s),i.blue=e5(n.blue,r.blue,s),i.alpha=is(n.alpha,r.alpha,s),rg.transform(i))},nAe=(e,t)=>n=>t(e(n)),FS=(...e)=>e.reduce(nAe),_M=new Set(["none","hidden"]);function rAe(e,t){return _M.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function iAe(e,t){return n=>is(e,t,n)}function q8(e){return typeof e=="number"?iAe:typeof e=="string"?_8(e)?uC:Xa.test(e)?mV:oAe:Array.isArray(e)?Hse:typeof e=="object"?Xa.test(e)?mV:sAe:uC}function Hse(e,t){const n=[...e],r=n.length,i=e.map((s,a)=>q8(s)(s,t[a]));return s=>{for(let a=0;a{for(const s in r)n[s]=r[s](i);return n}}function aAe(e,t){var n;const r=[],i={color:0,var:0,number:0};for(let s=0;s{const n=Qp.createTransformer(t),r=yw(e),i=yw(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?_M.has(e)&&!i.values.length||_M.has(t)&&!r.values.length?rAe(e,t):FS(Hse(aAe(r,i),i.values),n):uC(e,t)};function qse(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?is(e,t,n):q8(e)(e,t)}const lAe=5;function Xse(e,t,n){const r=Math.max(t-lAe,0);return gse(n-e(r),t-r)}const ds={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},t5=.001;function cAe({duration:e=ds.duration,bounce:t=ds.bounce,velocity:n=ds.velocity,mass:r=ds.mass}){let i,s,a=1-t;a=Yf(ds.minDamping,ds.maxDamping,a),e=Yf(ds.minDuration,ds.maxDuration,If(e)),a<1?(i=u=>{const d=u*a,f=d*e,h=d-n,m=TM(u,a),g=Math.exp(-f);return t5-h/m*g},s=u=>{const f=u*a*e,h=f*n+n,m=Math.pow(a,2)*Math.pow(u,2)*e,g=Math.exp(-f),b=TM(Math.pow(u,2),a);return(-i(u)+t5>0?-1:1)*((h-m)*g)/b}):(i=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-t5+d*f},s=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const l=5/e,c=dAe(i,s,l);if(e=Rf(e),isNaN(c))return{stiffness:ds.stiffness,damping:ds.damping,duration:e};{const u=Math.pow(c,2)*r;return{stiffness:u,damping:a*2*Math.sqrt(r*u),duration:e}}}const uAe=12;function dAe(e,t,n){let r=n;for(let i=1;ie[n]!==void 0)}function pAe(e){let t={velocity:ds.velocity,stiffness:ds.stiffness,damping:ds.damping,mass:ds.mass,isResolvedFromDuration:!1,...e};if(!gV(e,hAe)&&gV(e,fAe))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,s=2*Yf(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:ds.mass,stiffness:i,damping:s}}else{const n=cAe(e);t={...t,...n,mass:ds.mass},t.isResolvedFromDuration=!0}return t}function Gse(e=ds.visualDuration,t=ds.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:i}=n;const s=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],l={done:!1,value:s},{stiffness:c,damping:u,mass:d,duration:f,velocity:h,isResolvedFromDuration:m}=pAe({...n,velocity:-If(n.velocity||0)}),g=h||0,b=u/(2*Math.sqrt(c*d)),y=a-s,O=If(Math.sqrt(c/d)),v=Math.abs(y)<5;r||(r=v?ds.restSpeed.granular:ds.restSpeed.default),i||(i=v?ds.restDelta.granular:ds.restDelta.default);let x;if(b<1){const S=TM(O,b);x=E=>{const k=Math.exp(-b*O*E);return a-k*((g+b*O*y)/S*Math.sin(S*E)+y*Math.cos(S*E))}}else if(b===1)x=S=>a-Math.exp(-O*S)*(y+(g+O*y)*S);else{const S=O*Math.sqrt(b*b-1);x=E=>{const k=Math.exp(-b*O*E),_=Math.min(S*E,300);return a-k*((g+b*O*y)*Math.sinh(_)+S*y*Math.cosh(_))/S}}const w={calculatedDuration:m&&f||null,next:S=>{const E=x(S);if(m)l.done=S>=f;else{let k=0;b<1&&(k=S===0?Rf(g):Xse(x,S,E));const _=Math.abs(k)<=r,C=Math.abs(a-E)<=i;l.done=_&&C}return l.value=l.done?a:E,l},toString:()=>{const S=Math.min(Vse(w),kM),E=yse(k=>w.next(S*k).value,S,30);return S+"ms "+E}};return w}function bV({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:a,min:l,max:c,restDelta:u=.5,restSpeed:d}){const f=e[0],h={done:!1,value:f},m=_=>l!==void 0&&_c,g=_=>l===void 0?c:c===void 0||Math.abs(l-_)-b*Math.exp(-_/r),x=_=>O+v(_),w=_=>{const C=v(_),T=x(_);h.done=Math.abs(C)<=u,h.value=h.done?O:T};let S,E;const k=_=>{m(h.value)&&(S=_,E=Gse({keyframes:[h.value,g(h.value)],velocity:Xse(x,_,h.value),damping:i,stiffness:s,restDelta:u,restSpeed:d}))};return k(0),{calculatedDuration:null,next:_=>{let C=!1;return!E&&S===void 0&&(C=!0,w(_),k(_)),S!==void 0&&_>=S?E.next(_-S):(!C&&w(_),h)}}}const mAe=US(.42,0,1,1),gAe=US(0,0,.58,1),Wse=US(.42,0,.58,1),bAe=e=>Array.isArray(e)&&typeof e[0]!="number",yAe={linear:Pl,easeIn:mAe,easeInOut:Wse,easeOut:gAe,circIn:U8,circInOut:Cse,circOut:Tse,backIn:Q8,backInOut:kse,backOut:Ese,anticipate:_se},yV=e=>{if(B8(e)){Gie(e.length===4);const[t,n,r,i]=e;return US(t,n,r,i)}else if(typeof e=="string")return yAe[e];return e};function OAe(e,t,n){const r=[],i=n||qse,s=e.length-1;for(let a=0;at[0];if(s===2&&t[0]===t[1])return()=>t[1];const a=e[0]===e[1];e[0]>e[s-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=OAe(t,r,i),c=l.length,u=d=>{if(a&&d1)for(;fu(Yf(e[0],e[s-1],d)):u}function vAe(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=Wy(0,t,r);e.push(is(n,1,i))}}function wAe(e){const t=[0];return vAe(t,e.length-1),t}function SAe(e,t){return e.map(n=>n*t)}function EAe(e,t){return e.map(()=>t||Wse).splice(0,e.length-1)}function dC({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=bAe(r)?r.map(yV):yV(r),s={done:!1,value:t[0]},a=SAe(n&&n.length===t.length?n:wAe(t),e),l=xAe(a,t,{ease:Array.isArray(i)?i:EAe(t,i)});return{calculatedDuration:e,next:c=>(s.value=l(c),s.done=c>=e,s)}}const kAe=e=>{const t=({timestamp:n})=>e(n);return{start:()=>Qi.update(t,!0),stop:()=>Bp(t),now:()=>Ca.isProcessing?Ca.timestamp:cd.now()}},_Ae={decay:bV,inertia:bV,tween:dC,keyframes:dC,spring:Gse},TAe=e=>e/100;class X8 extends zse{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:i,keyframes:s}=this.options,a=(i==null?void 0:i.KeyframeResolver)||H8,l=(c,u)=>this.onKeyframesResolved(c,u);this.resolver=new a(s,l,n,r,i),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:i=0,repeatType:s,velocity:a=0}=this.options,l=$8(n)?n:_Ae[n]||dC;let c,u;l!==dC&&typeof t[0]!="number"&&(c=FS(TAe,qse(t[0],t[1])),t=[0,100]);const d=l({...this.options,keyframes:t});s==="mirror"&&(u=l({...this.options,keyframes:[...t].reverse(),velocity:-a})),d.calculatedDuration===null&&(d.calculatedDuration=Vse(d));const{calculatedDuration:f}=d,h=f+i,m=h*(r+1)-i;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:c,calculatedDuration:f,resolvedDuration:h,totalDuration:m}}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:_}=this.options;return{done:!0,value:_[_.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:a,mapPercentToKeyframes:l,keyframes:c,calculatedDuration:u,totalDuration:d,resolvedDuration:f}=r;if(this.startTime===null)return s.next(0);const{delay:h,repeat:m,repeatType:g,repeatDelay:b,onUpdate:y}=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 O=this.currentTime-h*(this.speed>=0?1:-1),v=this.speed>=0?O<0:O>d;this.currentTime=Math.max(O,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let x=this.currentTime,w=s;if(m){const _=Math.min(this.currentTime,d)/f;let C=Math.floor(_),T=_%1;!T&&_>=1&&(T=1),T===1&&C--,C=Math.min(C,m+1),!!(C%2)&&(g==="reverse"?(T=1-T,b&&(T-=b/f)):g==="mirror"&&(w=a)),x=Yf(0,1,T)*f}const S=v?{done:!1,value:c[0]}:w.next(x);l&&(S.value=l(S.value));let{done:E}=S;!v&&u!==null&&(E=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const k=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&E);return k&&i!==void 0&&(S.value=_N(c,this.options,i)),y&&y(S.value),k&&this.finish(),S}get duration(){const{resolved:t}=this;return t?If(t.calculatedDuration):0}get time(){return If(this.currentTime)}set time(t){t=Rf(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=If(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=kAe,onPlay:n,startTime:r}=this.options;this.driver||(this.driver=t(s=>this.tick(s))),n&&n();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):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 CAe=new Set(["opacity","clipPath","filter","transform"]);function AAe(e,t,n,{delay:r=0,duration:i=300,repeat:s=0,repeatType:a="loop",ease:l="easeInOut",times:c}={}){const u={[t]:n};c&&(u.offset=c);const d=xse(l,i);return Array.isArray(d)&&(u.easing=d),e.animate(u,{delay:r,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:a==="reverse"?"alternate":"normal"})}const NAe=L8(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),fC=10,jAe=2e4;function RAe(e){return $8(e.type)||e.type==="spring"||!Ose(e.ease)}function IAe(e,t){const n=new X8({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:e[0]};const i=[];let s=0;for(;!r.done&&sthis.onKeyframesResolved(a,l),n,r,i),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:r=300,times:i,ease:s,type:a,motionValue:l,name:c,startTime:u}=this.options;if(!l.owner||!l.owner.current)return!1;if(typeof s=="string"&&cC()&&DAe(s)&&(s=Yse[s]),RAe(this.options)){const{onComplete:f,onUpdate:h,motionValue:m,element:g,...b}=this.options,y=IAe(t,b);t=y.keyframes,t.length===1&&(t[1]=t[0]),r=y.duration,i=y.times,s=y.ease,a="keyframes"}const d=AAe(l.owner.current,c,t,{...this.options,duration:r,times:i,ease:s});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(oV(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:f}=this.options;l.set(_N(t,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:r,times:i,type:a,ease:s,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return If(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return If(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=Rf(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 Pl;const{animation:r}=n;oV(r,t)}return Pl}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:i,type:s,ease:a,times:l}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:d,onComplete:f,element:h,...m}=this.options,g=new X8({...m,keyframes:r,duration:i,type:s,ease:a,times:l,isGenerator:!0}),b=Rf(this.time);u.setWithVelocity(g.sample(b-fC).value,g.sample(b).value,fC)}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:i,repeatType:s,damping:a,type:l}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=n.owner.getProps();return NAe()&&r&&CAe.has(r)&&!c&&!u&&!i&&s!=="mirror"&&a!==0&&l!=="inertia"}}const PAe={type:"spring",stiffness:500,damping:25,restSpeed:10},MAe=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),LAe={type:"keyframes",duration:.8},$Ae={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},BAe=(e,{keyframes:t})=>t.length>2?LAe:c0.has(e)?e.startsWith("scale")?MAe(t[1]):PAe:$Ae;function QAe({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:s,repeatType:a,repeatDelay:l,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const G8=(e,t,n,r={},i,s)=>a=>{const l=I8(r,e)||{},c=l.delay||r.delay||0;let{elapsed:u=0}=r;u=u-Rf(c);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-u,onUpdate:h=>{t.set(h),l.onUpdate&&l.onUpdate(h)},onComplete:()=>{a(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:s?void 0:i};QAe(l)||(d={...d,...BAe(e,d)}),d.duration&&(d.duration=Rf(d.duration)),d.repeatDelay&&(d.repeatDelay=Rf(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&&!s&&t.get()!==void 0){const h=_N(d.keyframes,l);if(h!==void 0)return Qi.update(()=>{d.onUpdate(h),d.onComplete()}),new yCe([])}return!s&&OV.supports(d)?new OV(d):new X8(d)};function UAe({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function Zse(e,t,{delay:n=0,transitionOverride:r,type:i}={}){var s;let{transition:a=e.getDefaultTransition(),transitionEnd:l,...c}=t;r&&(a=r);const u=[],d=i&&e.animationState&&e.animationState.getState()[i];for(const f in c){const h=e.getValue(f,(s=e.latestValues[f])!==null&&s!==void 0?s:null),m=c[f];if(m===void 0||d&&UAe(d,f))continue;const g={delay:n,...I8(a||{},f)};let b=!1;if(window.MotionHandoffAnimation){const O=bse(e);if(O){const v=window.MotionHandoffAnimation(O,f,Qi);v!==null&&(g.startTime=v,b=!0)}}OM(e,f),h.start(G8(f,h,m,e.shouldReduceMotion&&mse.has(f)?{type:!1}:g,e,b));const y=h.animation;y&&u.push(y)}return l&&Promise.all(u).then(()=>{Qi.update(()=>{l&&pCe(e,l)})}),u}function CM(e,t,n={}){var r;const i=kN(e,t,n.type==="exit"?(r=e.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:s=e.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(s=n.transitionOverride);const a=i?()=>Promise.all(Zse(e,i,n)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=s;return FAe(e,t,d+u,f,h,n)}:()=>Promise.resolve(),{when:c}=s;if(c){const[u,d]=c==="beforeChildren"?[a,l]:[l,a];return u().then(()=>d())}else return Promise.all([a(),l(n.delay)])}function FAe(e,t,n=0,r=0,i=1,s){const a=[],l=(e.variantChildren.size-1)*r,c=i===1?(u=0)=>u*r:(u=0)=>l-u*r;return Array.from(e.variantChildren).sort(zAe).forEach((u,d)=>{u.notify("AnimationStart",t),a.push(CM(u,t,{...s,delay:n+c(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function zAe(e,t){return e.sortNodePosition(t)}function VAe(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(s=>CM(e,s,n));r=Promise.all(i)}else if(typeof t=="string")r=CM(e,t,n);else{const i=typeof t=="function"?kN(e,t,n.custom):t;r=Promise.all(Zse(e,i,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const HAe=v8.length;function Kse(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?Kse(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})=>VAe(e,n,r)))}function WAe(e){let t=GAe(e),n=xV(),r=!0;const i=c=>(u,d)=>{var f;const h=kN(e,d,c==="exit"?(f=e.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(h){const{transition:m,transitionEnd:g,...b}=h;u={...u,...b,...g}}return u};function s(c){t=c(e)}function a(c){const{props:u}=e,d=Kse(e.parent)||{},f=[],h=new Set;let m={},g=1/0;for(let y=0;yg&&w,C=!1;const T=Array.isArray(x)?x:[x];let A=T.reduce(i(O),{});S===!1&&(A={});const{prevResolvedValues:j={}}=v,L={...j,...A},I=D=>{_=!0,h.has(D)&&(C=!0,h.delete(D)),v.needsAnimating[D]=!0;const Q=e.getValue(D);Q&&(Q.liveStyle=!1)};for(const D in L){const Q=A[D],F=j[D];if(m.hasOwnProperty(D))continue;let $=!1;yM(Q)&&yM(F)?$=!pse(Q,F):$=Q!==F,$?Q!=null?I(D):h.add(D):Q!==void 0&&h.has(D)?I(D):v.protectedKeys[D]=!0}v.prevProp=x,v.prevResolvedValues=A,v.isActive&&(m={...m,...A}),r&&e.blockInitialAnimation&&(_=!1),_&&(!(E&&k)||C)&&f.push(...T.map(D=>({animation:D,options:{type:O}})))}if(h.size){const y={};h.forEach(O=>{const v=e.getBaseTarget(O),x=e.getValue(O);x&&(x.liveStyle=!0),y[O]=v??null}),f.push({animation:y})}let b=!!f.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(b=!1),r=!1,b?t(f):Promise.resolve()}function l(c,u){var d;if(n[c].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var m;return(m=h.animationState)===null||m===void 0?void 0:m.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:l,setAnimateFunction:s,getState:()=>n,reset:()=>{n=xV(),r=!0}}}function YAe(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!pse(t,e):!1}function Em(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function xV(){return{animate:Em(!0),whileInView:Em(),whileHover:Em(),whileTap:Em(),whileDrag:Em(),whileFocus:Em(),exit:Em()}}class lm{constructor(t){this.isMounted=!1,this.node=t}update(){}}class ZAe extends lm{constructor(t){super(t),t.animationState||(t.animationState=WAe(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();SN(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 KAe=0;class JAe extends lm{constructor(){super(...arguments),this.id=KAe++}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 i=this.node.animationState.setActive("exit",!t);n&&!t&&i.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const eNe={animation:{Feature:ZAe},exit:{Feature:JAe}},tu={x:!1,y:!1};function Jse(){return tu.x||tu.y}function tNe(e){return e==="x"||e==="y"?tu[e]?null:(tu[e]=!0,()=>{tu[e]=!1}):tu.x||tu.y?null:(tu.x=tu.y=!0,()=>{tu.x=tu.y=!1})}const W8=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function Ow(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function zS(e){return{point:{x:e.pageX,y:e.pageY}}}const nNe=e=>t=>W8(t)&&e(t,zS(t));function Ov(e,t,n,r){return Ow(e,t,nNe(n),r)}const vV=(e,t)=>Math.abs(e-t);function rNe(e,t){const n=vV(e.x,t.x),r=vV(e.y,t.y);return Math.sqrt(n**2+r**2)}class eae{constructor(t,n,{transformPagePoint:r,contextWindow:i,dragSnapToOrigin:s=!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=r5(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,m=rNe(f.offset,{x:0,y:0})>=3;if(!h&&!m)return;const{point:g}=f,{timestamp:b}=Ca;this.history.push({...g,timestamp:b});const{onStart:y,onMove:O}=this.handlers;h||(y&&y(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),O&&O(this.lastMoveEvent,f)},this.handlePointerMove=(f,h)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=n5(h,this.transformPagePoint),Qi.update(this.updatePoint,!0)},this.handlePointerUp=(f,h)=>{this.end();const{onEnd:m,onSessionEnd:g,resumeAnimation:b}=this.handlers;if(this.dragSnapToOrigin&&b&&b(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const y=r5(f.type==="pointercancel"?this.lastMoveEventInfo:n5(h,this.transformPagePoint),this.history);this.startEvent&&m&&m(f,y),g&&g(f,y)},!W8(t))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=r,this.contextWindow=i||window;const a=zS(t),l=n5(a,this.transformPagePoint),{point:c}=l,{timestamp:u}=Ca;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,r5(l,this.history)),this.removeListeners=FS(Ov(this.contextWindow,"pointermove",this.handlePointerMove),Ov(this.contextWindow,"pointerup",this.handlePointerUp),Ov(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Bp(this.updatePoint)}}function n5(e,t){return t?{point:t(e.point)}:e}function wV(e,t){return{x:e.x-t.x,y:e.y-t.y}}function r5({point:e},t){return{point:e,delta:wV(e,tae(t)),offset:wV(e,iNe(t)),velocity:sNe(t,.1)}}function iNe(e){return e[0]}function tae(e){return e[e.length-1]}function sNe(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=tae(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Rf(t)));)n--;if(!r)return{x:0,y:0};const s=If(i.timestamp-r.timestamp);if(s===0)return{x:0,y:0};const a={x:(i.x-r.x)/s,y:(i.y-r.y)/s};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}const nae=1e-4,aNe=1-nae,oNe=1+nae,rae=.01,lNe=0-rae,cNe=0+rae;function Ul(e){return e.max-e.min}function uNe(e,t,n){return Math.abs(e-t)<=n}function SV(e,t,n,r=.5){e.origin=r,e.originPoint=is(t.min,t.max,e.origin),e.scale=Ul(n)/Ul(t),e.translate=is(n.min,n.max,e.origin)-e.originPoint,(e.scale>=aNe&&e.scale<=oNe||isNaN(e.scale))&&(e.scale=1),(e.translate>=lNe&&e.translate<=cNe||isNaN(e.translate))&&(e.translate=0)}function xv(e,t,n,r){SV(e.x,t.x,n.x,r?r.originX:void 0),SV(e.y,t.y,n.y,r?r.originY:void 0)}function EV(e,t,n){e.min=n.min+t.min,e.max=e.min+Ul(t)}function dNe(e,t,n){EV(e.x,t.x,n.x),EV(e.y,t.y,n.y)}function kV(e,t,n){e.min=t.min-n.min,e.max=e.min+Ul(t)}function vv(e,t,n){kV(e.x,t.x,n.x),kV(e.y,t.y,n.y)}function fNe(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?is(n,e,r.max):Math.min(e,n)),e}function _V(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 hNe(e,{top:t,left:n,bottom:r,right:i}){return{x:_V(e.x,n,i),y:_V(e.y,t,r)}}function TV(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=Wy(t.min,t.max-r,e.min):r>i&&(n=Wy(e.min,e.max-i,t.min)),Yf(0,1,n)}function gNe(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 AM=.35;function bNe(e=AM){return e===!1?e=0:e===!0&&(e=AM),{x:CV(e,"left","right"),y:CV(e,"top","bottom")}}function CV(e,t,n){return{min:AV(e,t),max:AV(e,n)}}function AV(e,t){return typeof e=="number"?e:e[t]||0}const NV=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ub=()=>({x:NV(),y:NV()}),jV=()=>({min:0,max:0}),vs=()=>({x:jV(),y:jV()});function hc(e){return[e("x"),e("y")]}function iae({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function yNe({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function ONe(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 i5(e){return e===void 0||e===1}function NM({scale:e,scaleX:t,scaleY:n}){return!i5(e)||!i5(t)||!i5(n)}function Qm(e){return NM(e)||sae(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function sae(e){return RV(e.x)||RV(e.y)}function RV(e){return e&&e!=="0%"}function hC(e,t,n){const r=e-n,i=t*r;return n+i}function IV(e,t,n,r,i){return i!==void 0&&(e=hC(e,i,r)),hC(e,n,r)+t}function jM(e,t=0,n=1,r,i){e.min=IV(e.min,t,n,r,i),e.max=IV(e.max,t,n,r,i)}function aae(e,{x:t,y:n}){jM(e.x,t.translate,t.scale,t.originPoint),jM(e.y,n.translate,n.scale,n.originPoint)}const DV=.999999999999,PV=1.0000000000001;function xNe(e,t,n,r=!1){const i=n.length;if(!i)return;t.x=t.y=1;let s,a;for(let l=0;lDV&&(t.x=1),t.yDV&&(t.y=1)}function Fb(e,t){e.min=e.min+t,e.max=e.max+t}function MV(e,t,n,r,i=.5){const s=is(e.min,e.max,i);jM(e,t,n,s,r)}function zb(e,t){MV(e.x,t.x,t.scaleX,t.scale,t.originX),MV(e.y,t.y,t.scaleY,t.scale,t.originY)}function oae(e,t){return iae(ONe(e.getBoundingClientRect(),t))}function vNe(e,t,n){const r=oae(e,n),{scroll:i}=t;return i&&(Fb(r.x,i.offset.x),Fb(r.y,i.offset.y)),r}const lae=({current:e})=>e?e.ownerDocument.defaultView:null,wNe=new WeakMap;class SNe{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=vs(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=d=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(zS(d).point)},s=(d,f)=>{const{drag:h,dragPropagation:m,onDragStart:g}=this.getProps();if(h&&!m&&(this.openDragLock&&this.openDragLock(),this.openDragLock=tNe(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),hc(y=>{let O=this.getAxisMotionValue(y).get()||0;if(ld.test(O)){const{projection:v}=this.visualElement;if(v&&v.layout){const x=v.layout.layoutBox[y];x&&(O=Ul(x)*(parseFloat(O)/100))}}this.originPoint[y]=O}),g&&Qi.postRender(()=>g(d,f)),OM(this.visualElement,"transform");const{animationState:b}=this.visualElement;b&&b.setActive("whileDrag",!0)},a=(d,f)=>{const{dragPropagation:h,dragDirectionLock:m,onDirectionLock:g,onDrag:b}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:y}=f;if(m&&this.currentDirection===null){this.currentDirection=ENe(y),this.currentDirection!==null&&g&&g(this.currentDirection);return}this.updateAxis("x",f.point,y),this.updateAxis("y",f.point,y),this.visualElement.render(),b&&b(d,f)},l=(d,f)=>this.stop(d,f),c=()=>hc(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 eae(t,{onSessionStart:i,onStart:s,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:lae(this.visualElement)})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:s}=this.getProps();s&&Qi.postRender(()=>s(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:i}=this.getProps();if(!r||!Bk(t,i,this.currentDirection))return;const s=this.getAxisMotionValue(t);let a=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(a=fNe(a,this.constraints[t],this.elastic[t])),s.set(a)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:r}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,s=this.constraints;n&&Bb(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&i?this.constraints=hNe(i.layoutBox,n):this.constraints=!1,this.elastic=bNe(r),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&hc(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=gNe(i.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Bb(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=vNe(r,i.root,this.visualElement.getTransformPagePoint());let a=pNe(i.layout.layoutBox,s);if(n){const l=n(yNe(a));this.hasMutatedConstraints=!!l,l&&(a=iae(l))}return a}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:s,dragSnapToOrigin:a,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=hc(d=>{if(!Bk(d,n,this.currentDirection))return;let f=c&&c[d]||{};a&&(f={min:0,max:0});const h=i?200:1e6,m=i?40:1e7,g={type:"inertia",velocity:r?t[d]:0,bounceStiffness:h,bounceDamping:m,timeConstant:750,restDelta:1,restSpeed:10,...s,...f};return this.startAxisValueAnimation(d,g)});return Promise.all(u).then(l)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return OM(this.visualElement,t),r.start(G8(t,r,0,n,this.visualElement,!1))}stopAnimation(){hc(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){hc(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(),i=r[n];return i||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){hc(n=>{const{drag:r}=this.getProps();if(!Bk(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(n);if(i&&i.layout){const{min:a,max:l}=i.layout.layoutBox[n];s.set(t[n]-is(a,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Bb(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};hc(a=>{const l=this.getAxisMotionValue(a);if(l&&this.constraints!==!1){const c=l.get();i[a]=mNe({min:c,max:c},this.constraints[a])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),hc(a=>{if(!Bk(a,t,null))return;const l=this.getAxisMotionValue(a),{min:c,max:u}=this.constraints[a];l.set(is(c,u,i[a]))})}addListeners(){if(!this.visualElement.current)return;wNe.set(this.visualElement,this);const t=this.visualElement.current,n=Ov(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();Bb(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Qi.read(r);const a=Ow(window,"resize",()=>this.scalePositionWithinConstraints()),l=i.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(hc(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(),s(),l&&l()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:a=AM,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:s,dragElastic:a,dragMomentum:l}}}function Bk(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function ENe(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class kNe extends lm{constructor(t){super(t),this.removeGroupControls=Pl,this.removeListeners=Pl,this.controls=new SNe(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Pl}unmount(){this.removeGroupControls(),this.removeListeners()}}const LV=e=>(t,n)=>{e&&Qi.postRender(()=>e(t,n))};class _Ne extends lm{constructor(){super(...arguments),this.removePointerDownListener=Pl}onPointerDown(t){this.session=new eae(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:lae(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:LV(t),onStart:LV(n),onMove:r,onEnd:(s,a)=>{delete this.session,i&&Qi.postRender(()=>i(s,a))}}}mount(){this.removePointerDownListener=Ov(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 M_={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function $V(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const ZO={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Sn.test(e))e=parseFloat(e);else return e;const n=$V(e,t.target.x),r=$V(e,t.target.y);return`${n}% ${r}%`}},TNe={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=Qp.parse(e);if(i.length>5)return r;const s=Qp.createTransformer(e),a=typeof i[0]!="number"?1:0,l=n.x.scale*t.x,c=n.y.scale*t.y;i[0+a]/=l,i[1+a]/=c;const u=is(l,c,.5);return typeof i[2+a]=="number"&&(i[2+a]/=u),typeof i[3+a]=="number"&&(i[3+a]/=u),s(i)}};class CNe extends p.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:s}=t;eCe(ANe),s&&(n.group&&n.group.add(s),r&&r.register&&i&&r.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),M_.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:i,isPresent:s}=this.props,a=r.projection;return a&&(a.isPresent=s,i||t.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==s&&(s?a.promote():a.relegate()||Qi.postRender(()=>{const l=a.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),S8.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=t;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function cae(e){const[t,n]=qie(),r=p.useContext(y8);return o.jsx(CNe,{...e,layoutGroup:r,switchLayoutGroup:p.useContext(tse),isPresent:t,safeToRemove:n})}const ANe={borderRadius:{...ZO,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ZO,borderTopRightRadius:ZO,borderBottomLeftRadius:ZO,borderBottomRightRadius:ZO,boxShadow:TNe};function NNe(e,t,n){const r=Ya(e)?e:bw(e);return r.start(G8("",r,t,n)),r.animation}function jNe(e){return e instanceof SVGElement&&e.tagName!=="svg"}const RNe=(e,t)=>e.depth-t.depth;class INe{constructor(){this.children=[],this.isDirty=!1}add(t){D8(this.children,t),this.isDirty=!0}remove(t){P8(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(RNe),this.isDirty=!1,this.children.forEach(t)}}function DNe(e,t){const n=cd.now(),r=({timestamp:i})=>{const s=i-n;s>=t&&(Bp(r),e(s-t))};return Qi.read(r,!0),()=>Bp(r)}const uae=["TopLeft","TopRight","BottomLeft","BottomRight"],PNe=uae.length,BV=e=>typeof e=="string"?parseFloat(e):e,QV=e=>typeof e=="number"||Sn.test(e);function MNe(e,t,n,r,i,s){i?(e.opacity=is(0,n.opacity!==void 0?n.opacity:1,LNe(r)),e.opacityExit=is(t.opacity!==void 0?t.opacity:1,0,$Ne(r))):s&&(e.opacity=is(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let a=0;art?1:n(Wy(e,t,r))}function FV(e,t){e.min=t.min,e.max=t.max}function dc(e,t){FV(e.x,t.x),FV(e.y,t.y)}function zV(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function VV(e,t,n,r,i){return e-=t,e=hC(e,1/n,r),i!==void 0&&(e=hC(e,1/i,r)),e}function BNe(e,t=0,n=1,r=.5,i,s=e,a=e){if(ld.test(t)&&(t=parseFloat(t),t=is(a.min,a.max,t/100)-a.min),typeof t!="number")return;let l=is(s.min,s.max,r);e===s&&(l-=t),e.min=VV(e.min,t,n,l,i),e.max=VV(e.max,t,n,l,i)}function HV(e,t,[n,r,i],s,a){BNe(e,t[n],t[r],t[i],t.scale,s,a)}const QNe=["x","scaleX","originX"],UNe=["y","scaleY","originY"];function qV(e,t,n,r){HV(e.x,t,QNe,n?n.x:void 0,r?r.x:void 0),HV(e.y,t,UNe,n?n.y:void 0,r?r.y:void 0)}function XV(e){return e.translate===0&&e.scale===1}function fae(e){return XV(e.x)&&XV(e.y)}function GV(e,t){return e.min===t.min&&e.max===t.max}function FNe(e,t){return GV(e.x,t.x)&&GV(e.y,t.y)}function WV(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function hae(e,t){return WV(e.x,t.x)&&WV(e.y,t.y)}function YV(e){return Ul(e.x)/Ul(e.y)}function ZV(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class zNe{constructor(){this.members=[]}add(t){D8(this.members,t),t.scheduleRender()}remove(t){if(P8(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(i=>t===i);if(n===0)return!1;let r;for(let i=n;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){r=s;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:i}=t.options;i===!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 VNe(e,t,n){let r="";const i=e.x.translate/t.x,s=e.y.translate/t.y,a=(n==null?void 0:n.z)||0;if((i||s||a)&&(r=`translate3d(${i}px, ${s}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:m,skewY:g}=n;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),f&&(r+=`rotateX(${f}deg) `),h&&(r+=`rotateY(${h}deg) `),m&&(r+=`skewX(${m}deg) `),g&&(r+=`skewY(${g}deg) `)}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(r+=`scale(${l}, ${c})`),r||"none"}const Um={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Bx=typeof window<"u"&&window.MotionDebug!==void 0,s5=["","X","Y","Z"],HNe={visibility:"hidden"},KV=1e3;let qNe=0;function a5(e,t,n,r){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function pae(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=bse(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:s}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Qi,!(i||s))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&pae(r)}function mae({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(a={},l=t==null?void 0:t()){this.id=qNe++,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,Bx&&(Um.totalNodes=Um.resolvedTargetDeltas=Um.recalculatedProjection=0),this.nodes.forEach(WNe),this.nodes.forEach(eje),this.nodes.forEach(tje),this.nodes.forEach(YNe),Bx&&window.MotionDebug.record(Um)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;cthis.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=DNe(h,250),M_.hasAnimatedSinceResize&&(M_.hasAnimatedSinceResize=!1,this.nodes.forEach(eH))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:m,layout:g})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const b=this.options.transition||d.getDefaultTransition()||aje,{onLayoutAnimationStart:y,onLayoutAnimationComplete:O}=d.getProps(),v=!this.targetLayout||!hae(this.targetLayout,g)||m,x=!h&&m;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||x||h&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,x);const w={...I8(b,"layout"),onPlay:y,onComplete:O};(d.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w)}else h||eH(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=g})}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,Bp(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(nje),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&&pae(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 S=w/1e3;tH(f.x,a.x,S),tH(f.y,a.y,S),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(vv(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),ije(this.relativeTarget,this.relativeTargetOrigin,h,S),x&&FNe(this.relativeTarget,x)&&(this.isProjectionDirty=!1),x||(x=vs()),dc(x,this.relativeTarget)),b&&(this.animationValues=d,MNe(d,u,this.latestValues,S,v,O)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},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&&(Bp(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Qi.update(()=>{M_.hasAnimatedSinceResize=!0,this.currentAnimation=NNe(0,KV,{...a,onUpdate:l=>{this.mixTargetDelta(l),a.onUpdate&&a.onUpdate(l)},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(KV),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:d}=a;if(!(!l||!c||!u)){if(this!==a&&this.layout&&u&&gae(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||vs();const f=Ul(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+f;const h=Ul(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+h}dc(l,c),zb(l,d),xv(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(a,l){this.sharedNodes.has(a)||this.sharedNodes.set(a,new zNe),this.sharedNodes.get(a).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(l):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:l}=this.options;return l?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:l}=this.options;return l?(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:l,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),a&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let l=!1;const{latestValues:c}=a;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&a5("z",a,u,this.animationValues);for(let d=0;d{var l;return(l=a.currentAnimation)===null||l===void 0?void 0:l.stop()}),this.root.nodes.forEach(JV),this.root.sharedNodes.clear()}}}function XNe(e){e.updateLayout()}function GNe(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:i}=e.layout,{animationType:s}=e.options,a=n.source!==e.layout.source;s==="size"?hc(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],m=Ul(h);h.min=r[f].min,h.max=h.min+m}):gae(s,n.layoutBox,r)&&hc(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],m=Ul(r[f]);h.max=h.min+m,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+m)});const l=Ub();xv(l,r,n.layoutBox);const c=Ub();a?xv(c,e.applyTransform(i,!0),n.measuredBox):xv(c,r,n.layoutBox);const u=!fae(l);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:m}=f;if(h&&m){const g=vs();vv(g,n.layoutBox,h.layoutBox);const b=vs();vv(b,r,m.layoutBox),hae(g,b)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=b,e.relativeTargetOrigin=g,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:c,layoutDelta:l,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function WNe(e){Bx&&Um.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 YNe(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function ZNe(e){e.clearSnapshot()}function JV(e){e.clearMeasurements()}function KNe(e){e.isLayoutDirty=!1}function JNe(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function eH(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function eje(e){e.resolveTargetDelta()}function tje(e){e.calcProjection()}function nje(e){e.resetSkewAndRotation()}function rje(e){e.removeLeadSnapshot()}function tH(e,t,n){e.translate=is(t.translate,0,n),e.scale=is(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function nH(e,t,n,r){e.min=is(t.min,n.min,r),e.max=is(t.max,n.max,r)}function ije(e,t,n,r){nH(e.x,t.x,n.x,r),nH(e.y,t.y,n.y,r)}function sje(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const aje={duration:.45,ease:[.4,0,.1,1]},rH=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),iH=rH("applewebkit/")&&!rH("chrome/")?Math.round:Pl;function sH(e){e.min=iH(e.min),e.max=iH(e.max)}function oje(e){sH(e.x),sH(e.y)}function gae(e,t,n){return e==="position"||e==="preserve-aspect"&&!uNe(YV(t),YV(n),.2)}function lje(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const cje=mae({attachResizeListener:(e,t)=>Ow(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),o5={current:void 0},bae=mae({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!o5.current){const e=new cje({});e.mount(window),e.setOptions({layoutScroll:!0}),o5.current=e}return o5.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),uje={pan:{Feature:_Ne},drag:{Feature:kNe,ProjectionNode:bae,MeasureLayout:cae}};function dje(e,t,n){var r;if(e instanceof Element)return[e];if(typeof e=="string"){let i=document;const s=(r=void 0)!==null&&r!==void 0?r:i.querySelectorAll(e);return s?Array.from(s):[]}return Array.from(e)}function yae(e,t){const n=dje(e),r=new AbortController,i={passive:!0,...t,signal:r.signal};return[n,i,()=>r.abort()]}function aH(e){return t=>{t.pointerType==="touch"||Jse()||e(t)}}function fje(e,t,n={}){const[r,i,s]=yae(e,n),a=aH(l=>{const{target:c}=l,u=t(l);if(typeof u!="function"||!c)return;const d=aH(f=>{u(f),c.removeEventListener("pointerleave",d)});c.addEventListener("pointerleave",d,i)});return r.forEach(l=>{l.addEventListener("pointerenter",a,i)}),s}function oH(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,s=r[i];s&&Qi.postRender(()=>s(t,zS(t)))}class hje extends lm{mount(){const{current:t}=this.node;t&&(this.unmount=fje(t,n=>(oH(this.node,n,"Start"),r=>oH(this.node,r,"End"))))}unmount(){}}class pje extends lm{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=FS(Ow(this.node.current,"focus",()=>this.onFocus()),Ow(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const Oae=(e,t)=>t?e===t?!0:Oae(e,t.parentElement):!1,mje=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function gje(e){return mje.has(e.tagName)||e.tabIndex!==-1}const Qx=new WeakSet;function lH(e){return t=>{t.key==="Enter"&&e(t)}}function l5(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const bje=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=lH(()=>{if(Qx.has(n))return;l5(n,"down");const i=lH(()=>{l5(n,"up")}),s=()=>l5(n,"cancel");n.addEventListener("keyup",i,t),n.addEventListener("blur",s,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function cH(e){return W8(e)&&!Jse()}function yje(e,t,n={}){const[r,i,s]=yae(e,n),a=l=>{const c=l.currentTarget;if(!cH(l)||Qx.has(c))return;Qx.add(c);const u=t(l),d=(m,g)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),!(!cH(m)||!Qx.has(c))&&(Qx.delete(c),typeof u=="function"&&u(m,{success:g}))},f=m=>{d(m,n.useGlobalTarget||Oae(c,m.target))},h=m=>{d(m,!1)};window.addEventListener("pointerup",f,i),window.addEventListener("pointercancel",h,i)};return r.forEach(l=>{!gje(l)&&l.getAttribute("tabindex")===null&&(l.tabIndex=0),(n.useGlobalTarget?window:l).addEventListener("pointerdown",a,i),l.addEventListener("focus",u=>bje(u,i),i)}),s}function uH(e,t,n){const{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),s=r[i];s&&Qi.postRender(()=>s(t,zS(t)))}class Oje extends lm{mount(){const{current:t}=this.node;t&&(this.unmount=yje(t,n=>(uH(this.node,n,"Start"),(r,{success:i})=>uH(this.node,r,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const RM=new WeakMap,c5=new WeakMap,xje=e=>{const t=RM.get(e.target);t&&t(e)},vje=e=>{e.forEach(xje)};function wje({root:e,...t}){const n=e||document;c5.has(n)||c5.set(n,{});const r=c5.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(vje,{root:e,...t})),r[i]}function Sje(e,t,n){const r=wje(t);return RM.set(e,n),r.observe(e),()=>{RM.delete(e),r.unobserve(e)}}const Eje={some:0,all:1};class kje extends lm{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:s}=t,a={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:Eje[i]},l=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,s&&!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 Sje(this.node.current,a,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(_je(t,n))&&this.startObserver()}unmount(){}}function _je({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const Tje={inView:{Feature:kje},tap:{Feature:Oje},focus:{Feature:pje},hover:{Feature:hje}},Cje={layout:{ProjectionNode:bae,MeasureLayout:cae}},pC={current:null},Y8={current:!1};function xae(){if(Y8.current=!0,!!O8)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>pC.current=e.matches;e.addListener(t),t()}else pC.current=!1}const Aje=[...Use,Xa,Qp],Nje=e=>Aje.find(Qse(e)),dH=new WeakMap;function jje(e,t,n){for(const r in t){const i=t[r],s=n[r];if(Ya(i))e.addValue(r,i);else if(Ya(s))e.addValue(r,bw(i,{owner:e}));else if(s!==i)if(e.hasValue(r)){const a=e.getValue(r);a.liveStyle===!0?a.jump(i):a.hasAnimated||a.set(i)}else{const a=e.getStaticValue(r);e.addValue(r,bw(a!==void 0?a:i,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const fH=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Rje{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:i,blockInitialAnimation:s,visualState:a},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=H8,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 m=cd.now();this.renderScheduledAtthis.bindToMotionValue(r,n)),Y8.current||xae(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:pC.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){dH.delete(this.current),this.projection&&this.projection.unmount(),Bp(this.notifyUpdate),Bp(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=c0.has(t),i=n.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&Qi.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),s=n.on("renderRequest",this.scheduleRender);let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{i(),s(),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 Gy){const n=Gy[t];if(!n)continue;const{isEnabled:r,Feature:i}=n;if(!this.features[t]&&i&&r(this.props)&&(this.features[t]=new i(this)),this.features[t]){const s=this.features[t];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):vs()}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=bw(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){var r;let i=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 i!=null&&(typeof i=="string"&&($se(i)||Ase(i))?i=parseFloat(i):!Nje(i)&&Qp.test(n)&&(i=Pse(t,n)),this.setBaseTarget(t,Ya(i)?i.get():i)),Ya(i)?i.get():i}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props;let i;if(typeof r=="string"||typeof r=="object"){const a=k8(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);a&&(i=a[t])}if(r&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,t);return s!==void 0&&!Ya(s)?s:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new M8),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class vae extends Rje{constructor(){super(...arguments),this.KeyframeResolver=Fse}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;Ya(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function Ije(e){return window.getComputedStyle(e)}class Dje extends vae{constructor(){super(...arguments),this.type="html",this.renderInstance=lse}readValueFromInstance(t,n){if(c0.has(n)){const r=V8(n);return r&&r.default||0}else{const r=Ije(t),i=(sse(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return oae(t,n)}build(t,n,r){C8(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return R8(t,n,r)}}class Pje extends vae{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=vs}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(c0.has(n)){const r=V8(n);return r&&r.default||0}return n=cse.has(n)?n:w8(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return fse(t,n,r)}build(t,n,r){A8(t,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,n,r,i){use(t,n,r,i)}mount(t){this.isSVGTag=j8(t.tagName),super.mount(t)}}const Mje=(e,t)=>E8(e)?new Pje(t):new Dje(t,{allowProjection:e!==p.Fragment}),Lje=cCe({...eNe,...Tje,...uje,...Cje},Mje),oi=ETe(Lje);function Z8(){!Y8.current&&xae();const[e]=p.useState(pC.current);return e}function Ks(){return Ks=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u"||/ServerSideRendering/.test(navigator&&navigator.userAgent)?p.useEffect:p.useLayoutEffect;function hb(e,t,n){var r=p.useRef(t);r.current=t,p.useEffect(function(){function i(s){r.current(s)}return e&&window.addEventListener(e,i,n),function(){e&&window.removeEventListener(e,i)}},[e])}var $je=["container"];function Bje(e){var t=e.container,n=t===void 0?document.body:t,r=TN(e,$je);return Cr.createPortal(Zn.createElement("div",Ks({},r)),n)}function Qje(e){return Zn.createElement("svg",Ks({width:"44",height:"44",viewBox:"0 0 768 768"},e),Zn.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 Uje(e){return Zn.createElement("svg",Ks({width:"44",height:"44",viewBox:"0 0 768 768"},e),Zn.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 Fje(e){return Zn.createElement("svg",Ks({width:"44",height:"44",viewBox:"0 0 768 768"},e),Zn.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function zje(){return p.useEffect(function(){var e=document.body.style,t=e.overflow;return e.overflow="hidden",function(){e.overflow=t}},[]),null}function pH(e){var t=e.touches[0],n=t.clientX,r=t.clientY;if(e.touches.length>=2){var i=e.touches[1],s=i.clientX,a=i.clientY;return[(n+s)/2,(r+a)/2,Math.sqrt(Math.pow(s-n,2)+Math.pow(a-r,2))]}return[n,r,0]}var Yh=function(e,t,n,r){var i,s=n*t,a=(s-r)/2,l=e;return s<=r?(i=1,l=0):e>0&&a-e<=0?(i=2,l=a):e<0&&a+e<=0&&(i=3,l=-a),[i,l]};function u5(e,t,n,r,i,s,a,l,c,u){a===void 0&&(a=innerWidth/2),l===void 0&&(l=innerHeight/2),c===void 0&&(c=0),u===void 0&&(u=0);var d=Yh(e,s,n,innerWidth)[0],f=Yh(t,s,r,innerHeight),h=innerWidth/2,m=innerHeight/2;return{x:a-s/i*(a-(h+e))-h+(r/n>=3&&n*s===innerWidth?0:d?c/2:c),y:l-s/i*(l-(m+t))-m+(f[0]?u/2:u),lastCX:a,lastCY:l}}function PM(e,t,n){var r=e%180!=0;return r?[n,t,r]:[t,n,r]}function d5(e,t,n){var r=PM(n,innerWidth,innerHeight),i=r[0],s=r[1],a=0,l=i,c=s,u=e/t*s,d=t/e*i;return e=s?l=u:e>=i&&ti/s?c=d:t/e>=3&&!r[2]?a=((c=d)-s)/2:l=u,{width:l,height:c,x:0,y:a,pause:!0}}function Uk(e,t){var n=t.leading,r=n!==void 0&&n,i=t.maxWait,s=t.wait,a=s===void 0?i||0:s,l=p.useRef(e);l.current=e;var c=p.useRef(0),u=p.useRef(),d=function(){return u.current&&clearTimeout(u.current)},f=p.useCallback(function(){var h=[].slice.call(arguments),m=Date.now();function g(){c.current=m,d(),l.current.apply(null,h)}var b=c.current,y=m-b;if(b===0&&(r&&g(),c.current=m),i!==void 0){if(y>i)return void g()}else y=1&&s&&s())};d()}function d(){c=requestAnimationFrame(u)}}var Hje={T:0,L:0,W:0,H:0,FIT:void 0},Sae=function(){var e=p.useRef(!1);return p.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),e},qje=["className"];function Xje(e){var t=e.className,n=t===void 0?"":t,r=TN(e,qje);return Zn.createElement("div",Ks({className:"PhotoView__Spinner "+n},r),Zn.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},Zn.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"}),Zn.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}var Gje=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function Wje(e){var t=e.src,n=e.loaded,r=e.broken,i=e.className,s=e.onPhotoLoad,a=e.loadingElement,l=e.brokenElement,c=TN(e,Gje),u=Sae();return t&&!r?Zn.createElement(Zn.Fragment,null,Zn.createElement("img",Ks({className:"PhotoView__Photo"+(i?" "+i:""),src:t,onLoad:function(d){var f=d.target;u.current&&s({loaded:!0,naturalWidth:f.naturalWidth,naturalHeight:f.naturalHeight})},onError:function(){u.current&&s({broken:!0})},draggable:!1,alt:""},c)),!n&&(a?Zn.createElement("span",{className:"PhotoView__icon"},a):Zn.createElement(Xje,{className:"PhotoView__icon"}))):l?Zn.createElement("span",{className:"PhotoView__icon"},typeof l=="function"?l({src:t}):l):null}var Yje={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 Zje(e){var t=e.item,n=t.src,r=t.render,i=t.width,s=i===void 0?0:i,a=t.height,l=a===void 0?0:a,c=t.originRef,u=e.visible,d=e.speed,f=e.easing,h=e.wrapClassName,m=e.className,g=e.style,b=e.loadingElement,y=e.brokenElement,O=e.onPhotoTap,v=e.onMaskTap,x=e.onReachMove,w=e.onReachUp,S=e.onPhotoResize,E=e.isActive,k=e.expose,_=mC(Yje),C=_[0],T=_[1],A=p.useRef(0),j=Sae(),L=C.naturalWidth,I=L===void 0?s:L,M=C.naturalHeight,N=M===void 0?l:M,D=C.width,Q=D===void 0?s:D,F=C.height,$=F===void 0?l:F,H=C.loaded,z=H===void 0?!n:H,B=C.broken,V=C.x,Z=C.y,ce=C.touched,be=C.stopRaf,ie=C.maskTouched,q=C.rotate,X=C.scale,K=C.CX,de=C.CY,xe=C.lastX,Me=C.lastY,Ae=C.lastCX,He=C.lastCY,et=C.lastScale,Te=C.touchTime,Re=C.touchLength,he=C.pause,me=C.reach,Se=xg({onScale:function(ye){return ke(Qk(ye))},onRotate:function(ye){q!==ye&&(k({rotate:ye}),T(Ks({rotate:ye},d5(I,N,ye))))}});function ke(ye,Ue,it){X!==ye&&(k({scale:ye}),T(Ks({scale:ye},u5(V,Z,Q,$,X,ye,Ue,it),ye<=1&&{x:0,y:0})))}var nt=Uk(function(ye,Ue,it){if(it===void 0&&(it=0),(ce||ie)&&E){var we=PM(q,Q,$),Fe=we[0],dt=we[1];if(it===0&&A.current===0){var Tt=Math.abs(ye-K)<=20,Pt=Math.abs(Ue-de)<=20;if(Tt&&Pt)return void T({lastCX:ye,lastCY:Ue});A.current=Tt?Ue>de?3:2:1}var nn,ln=ye-Ae,le=Ue-He;if(it===0){var Wt=Yh(ln+xe,X,Fe,innerWidth)[0],Le=Yh(le+Me,X,dt,innerHeight);nn=function(Ce,bt,Ut,lt){return bt&&Ce===1||lt==="x"?"x":Ut&&Ce>1||lt==="y"?"y":void 0}(A.current,Wt,Le[0],me),nn!==void 0&&x(nn,ye,Ue,X)}if(nn==="x"||ie)return void T({reach:"x"});var Rt=Qk(X+(it-Re)/100/2*X,I/Q,.2);k({scale:Rt}),T(Ks({touchLength:it,reach:nn,scale:Rt},u5(V,Z,Q,$,X,Rt,ye,Ue,ln,le)))}},{maxWait:8});function Qe(ye){return!be&&!ce&&(j.current&&T(Ks({},ye,{pause:u})),j.current)}var re,ue,Pe,Ge,W,_e,rt,Ve,We=(W=function(ye){return Qe({x:ye})},_e=function(ye){return Qe({y:ye})},rt=function(ye){return j.current&&(k({scale:ye}),T({scale:ye})),!ce&&j.current},Ve=xg({X:function(ye){return W(ye)},Y:function(ye){return _e(ye)},S:function(ye){return rt(ye)}}),function(ye,Ue,it,we,Fe,dt,Tt,Pt,nn,ln,le){var Wt=PM(ln,Fe,dt),Le=Wt[0],Rt=Wt[1],Ce=Yh(ye,Pt,Le,innerWidth),bt=Ce[0],Ut=Ce[1],lt=Yh(Ue,Pt,Rt,innerHeight),sn=lt[0],yr=lt[1],sr=Date.now()-le;if(sr>=200||Pt!==Tt||Math.abs(nn-Tt)>1){var ze=u5(ye,Ue,Fe,dt,Tt,Pt),tt=ze.x,en=ze.y,rn=bt?Ut:tt!==ye?tt:null,rr=sn?yr:en!==Ue?en:null;return rn!==null&&Gm(ye,rn,Ve.X),rr!==null&&Gm(Ue,rr,Ve.Y),void(Pt!==Tt&&Gm(Tt,Pt,Ve.S))}var dr=(ye-it)/sr,Rn=(Ue-we)/sr,ar=Math.sqrt(Math.pow(dr,2)+Math.pow(Rn,2)),Vr=!1,Hr=!1;(function(Zr,Lr){var ir,Kr=Zr,Jr=0,qr=0,es=function(ei){ir||(ir=ei);var ra=ei-ir,ms=Math.sign(Zr),gi=-.001*ms,gs=Math.sign(-Kr)*Math.pow(Kr,2)*2e-4,Ni=Kr*ra+(gi+gs)*Math.pow(ra,2)/2;Jr+=Ni,ir=ei,ms*(Kr+=(gi+gs)*ra)<=0?Xr():Lr(Jr)?li():Xr()};function li(){qr=requestAnimationFrame(es)}function Xr(){cancelAnimationFrame(qr)}li()})(ar,function(Zr){var Lr=ye+Zr*(dr/ar),ir=Ue+Zr*(Rn/ar),Kr=Yh(Lr,Tt,Le,innerWidth),Jr=Kr[0],qr=Kr[1],es=Yh(ir,Tt,Rt,innerHeight),li=es[0],Xr=es[1];if(Jr&&!Vr&&(Vr=!0,bt?Gm(Lr,qr,Ve.X):mH(qr,Lr+(Lr-qr),Ve.X)),li&&!Hr&&(Hr=!0,sn?Gm(ir,Xr,Ve.Y):mH(Xr,ir+(ir-Xr),Ve.Y)),Vr&&Hr)return!1;var ei=Vr||Ve.X(qr),ra=Hr||Ve.Y(Xr);return ei&&ra})}),ot=(re=O,ue=function(ye,Ue){me||ke(X!==1?1:Math.max(2,I/Q),ye,Ue)},Pe=p.useRef(0),Ge=Uk(function(){Pe.current=0,re.apply(void 0,[].slice.call(arguments))},{wait:300}),function(){var ye=[].slice.call(arguments);Pe.current+=1,Ge.apply(void 0,ye),Pe.current>=2&&(Ge.cancel(),Pe.current=0,ue.apply(void 0,ye))});function St(ye,Ue){if(A.current=0,(ce||ie)&&E){T({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});var it=Qk(X,I/Q);if(We(V,Z,xe,Me,Q,$,X,it,et,q,Te),w(ye,Ue),K===ye&&de===Ue){if(ce)return void ot(ye,Ue);ie&&v(ye,Ue)}}}function Vt(ye,Ue,it){it===void 0&&(it=0),T({touched:!0,CX:ye,CY:Ue,lastCX:ye,lastCY:Ue,lastX:V,lastY:Z,lastScale:X,touchLength:it,touchTime:Date.now()})}function _t(ye){T({maskTouched:!0,CX:ye.clientX,CY:ye.clientY,lastX:V,lastY:Z})}hb(tf?void 0:"mousemove",function(ye){ye.preventDefault(),nt(ye.clientX,ye.clientY)}),hb(tf?void 0:"mouseup",function(ye){St(ye.clientX,ye.clientY)}),hb(tf?"touchmove":void 0,function(ye){ye.preventDefault();var Ue=pH(ye);nt.apply(void 0,Ue)},{passive:!1}),hb(tf?"touchend":void 0,function(ye){var Ue=ye.changedTouches[0];St(Ue.clientX,Ue.clientY)},{passive:!1}),hb("resize",Uk(function(){z&&!ce&&(T(d5(I,N,q)),S())},{maxWait:8})),DM(function(){E&&k(Ks({scale:X,rotate:q},Se))},[E]);var Ne=function(ye,Ue,it,we,Fe,dt,Tt,Pt,nn,ln){var le=function(tt,en,rn,rr,dr){var Rn=p.useRef(!1),ar=mC({lead:!0,scale:rn}),Vr=ar[0],Hr=Vr.lead,Zr=Vr.scale,Lr=ar[1],ir=Uk(function(Kr){try{return dr(!0),Lr({lead:!1,scale:Kr}),Promise.resolve()}catch(Jr){return Promise.reject(Jr)}},{wait:rr});return DM(function(){Rn.current?(dr(!1),Lr({lead:!0}),ir(rn)):Rn.current=!0},[rn]),Hr?[tt*Zr,en*Zr,rn/Zr]:[tt*rn,en*rn,1]}(dt,Tt,Pt,nn,ln),Wt=le[0],Le=le[1],Rt=le[2],Ce=function(tt,en,rn,rr,dr){var Rn=p.useState(Hje),ar=Rn[0],Vr=Rn[1],Hr=p.useState(0),Zr=Hr[0],Lr=Hr[1],ir=p.useRef(),Kr=xg({OK:function(){return tt&&Lr(4)}});function Jr(qr){dr(!1),Lr(qr)}return p.useEffect(function(){if(ir.current||(ir.current=Date.now()),rn){if(function(qr,es){var li=qr&&qr.current;if(li&&li.nodeType===1){var Xr=li.getBoundingClientRect();es({T:Xr.top,L:Xr.left,W:Xr.width,H:Xr.height,FIT:li.tagName==="IMG"?getComputedStyle(li).objectFit:void 0})}}(en,Vr),tt)return Date.now()-ir.current<250?(Lr(1),requestAnimationFrame(function(){Lr(2),requestAnimationFrame(function(){return Jr(3)})}),void setTimeout(Kr.OK,rr)):void Lr(4);Jr(5)}},[tt,rn]),[Zr,ar]}(ye,Ue,it,nn,ln),bt=Ce[0],Ut=Ce[1],lt=Ut.W,sn=Ut.FIT,yr=innerWidth/2,sr=innerHeight/2,ze=bt<3||bt>4;return[ze?lt?Ut.L:yr:we+(yr-dt*Pt/2),ze?lt?Ut.T:sr:Fe+(sr-Tt*Pt/2),Wt,ze&&sn?Wt*(Ut.H/lt):Le,bt===0?Rt:ze?lt/(dt*Pt)||.01:Rt,ze?sn?1:0:1,bt,sn]}(u,c,z,V,Z,Q,$,X,d,function(ye){return T({pause:ye})}),$e=Ne[4],mt=Ne[6],Ht="transform "+d+"ms "+f,qe={className:m,onMouseDown:tf?void 0:function(ye){ye.stopPropagation(),ye.button===0&&Vt(ye.clientX,ye.clientY,0)},onTouchStart:tf?function(ye){ye.stopPropagation(),Vt.apply(void 0,pH(ye))}:void 0,onWheel:function(ye){if(!me){var Ue=Qk(X-ye.deltaY/100/2,I/Q);T({stopRaf:!0}),ke(Ue,ye.clientX,ye.clientY)}},style:{width:Ne[2]+"px",height:Ne[3]+"px",opacity:Ne[5],objectFit:mt===4?void 0:Ne[7],transform:q?"rotate("+q+"deg)":void 0,transition:mt>2?Ht+", opacity "+d+"ms ease, height "+(mt<4?d/2:mt>4?d:0)+"ms "+f:void 0}};return Zn.createElement("div",{className:"PhotoView__PhotoWrap"+(h?" "+h:""),style:g,onMouseDown:!tf&&E?_t:void 0,onTouchStart:tf&&E?function(ye){return _t(ye.touches[0])}:void 0},Zn.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:"matrix("+$e+", 0, 0, "+$e+", "+Ne[0]+", "+Ne[1]+")",transition:ce||he?void 0:Ht,willChange:E?"transform":void 0}},n?Zn.createElement(Wje,Ks({src:n,loaded:z,broken:B},qe,{onPhotoLoad:function(ye){T(Ks({},ye,ye.loaded&&d5(ye.naturalWidth||0,ye.naturalHeight||0,q)))},loadingElement:b,brokenElement:y})):r&&r({attrs:qe,scale:$e,rotate:q})))}var gH={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 Kje(e){var t=e.loop,n=t===void 0?3:t,r=e.speed,i=e.easing,s=e.photoClosable,a=e.maskClosable,l=a===void 0||a,c=e.maskOpacity,u=c===void 0?1:c,d=e.pullClosable,f=d===void 0||d,h=e.bannerVisible,m=h===void 0||h,g=e.overlayRender,b=e.toolbarRender,y=e.className,O=e.maskClassName,v=e.photoClassName,x=e.photoWrapClassName,w=e.loadingElement,S=e.brokenElement,E=e.images,k=e.index,_=k===void 0?0:k,C=e.onIndexChange,T=e.visible,A=e.onClose,j=e.afterClose,L=e.portalContainer,I=mC(gH),M=I[0],N=I[1],D=p.useState(0),Q=D[0],F=D[1],$=M.x,H=M.touched,z=M.pause,B=M.lastCX,V=M.lastCY,Z=M.bg,ce=Z===void 0?u:Z,be=M.lastBg,ie=M.overlay,q=M.minimal,X=M.scale,K=M.rotate,de=M.onScale,xe=M.onRotate,Me=e.hasOwnProperty("index"),Ae=Me?_:Q,He=Me?C:F,et=p.useRef(Ae),Te=E.length,Re=E[Ae],he=typeof n=="boolean"?n:Te>n,me=function($e,mt){var Ht=p.useReducer(function(it){return!it},!1)[1],qe=p.useRef(0),ye=function(it){var we=p.useRef(it);function Fe(dt){we.current=dt}return p.useMemo(function(){(function(dt){$e?(dt($e),qe.current=1):qe.current=2})(Fe)},[it]),[we.current,Fe]}($e),Ue=ye[1];return[ye[0],qe.current,function(){Ht(),qe.current===2&&(Ue(!1),mt&&mt()),qe.current=0}]}(T,j),Se=me[0],ke=me[1],nt=me[2];DM(function(){if(Se)return N({pause:!0,x:Ae*-(innerWidth+V0)}),void(et.current=Ae);N(gH)},[Se]);var Qe=xg({close:function($e){xe&&xe(0),N({overlay:!0,lastBg:ce}),A($e)},changeIndex:function($e,mt){mt===void 0&&(mt=!1);var Ht=he?et.current+($e-Ae):$e,qe=Te-1,ye=IM(Ht,0,qe),Ue=he?Ht:ye,it=innerWidth+V0;N({touched:!1,lastCX:void 0,lastCY:void 0,x:-it*Ue,pause:mt}),et.current=Ue,He&&He(he?$e<0?qe:$e>qe?0:$e:ye)}}),re=Qe.close,ue=Qe.changeIndex;function Pe($e){return $e?re():N({overlay:!ie})}function Ge(){N({x:-(innerWidth+V0)*Ae,lastCX:void 0,lastCY:void 0,pause:!0}),et.current=Ae}function W($e,mt,Ht,qe){$e==="x"?function(ye){if(B!==void 0){var Ue=ye-B,it=Ue;!he&&(Ae===0&&Ue>0||Ae===Te-1&&Ue<0)&&(it=Ue/2),N({touched:!0,lastCX:B,x:-(innerWidth+V0)*et.current+it,pause:!1})}else N({touched:!0,lastCX:ye,x:$,pause:!1})}(mt):$e==="y"&&function(ye,Ue){if(V!==void 0){var it=u===null?null:IM(u,.01,u-Math.abs(ye-V)/100/4);N({touched:!0,lastCY:V,bg:Ue===1?it:u,minimal:Ue===1})}else N({touched:!0,lastCY:ye,bg:ce,minimal:!0})}(Ht,qe)}function _e($e,mt){var Ht=$e-(B??$e),qe=mt-(V??mt),ye=!1;if(Ht<-40)ue(Ae+1);else if(Ht>40)ue(Ae-1);else{var Ue=-(innerWidth+V0)*et.current;Math.abs(qe)>100&&q&&f&&(ye=!0,re()),N({touched:!1,x:Ue,lastCX:void 0,lastCY:void 0,bg:u,overlay:!!ye||ie})}}hb("keydown",function($e){if(T)switch($e.key){case"ArrowLeft":ue(Ae-1,!0);break;case"ArrowRight":ue(Ae+1,!0);break;case"Escape":re()}});var rt=function($e,mt,Ht){return p.useMemo(function(){var qe=$e.length;return Ht?$e.concat($e).concat($e).slice(qe+mt-1,qe+mt+2):$e.slice(Math.max(mt-1,0),Math.min(mt+2,qe+1))},[$e,mt,Ht])}(E,Ae,he);if(!Se)return null;var Ve=ie&&!ke,We=T?ce:be,ot=de&&xe&&{images:E,index:Ae,visible:T,onClose:re,onIndexChange:ue,overlayVisible:Ve,overlay:Re&&Re.overlay,scale:X,rotate:K,onScale:de,onRotate:xe},St=r?r(ke):400,Vt=i?i(ke):hH,_t=r?r(3):600,Ne=i?i(3):hH;return Zn.createElement(Bje,{className:"PhotoView-Portal"+(Ve?"":" PhotoView-Slider__clean")+(T?"":" PhotoView-Slider__willClose")+(y?" "+y:""),role:"dialog",onClick:function($e){return $e.stopPropagation()},container:L},T&&Zn.createElement(zje,null),Zn.createElement("div",{className:"PhotoView-Slider__Backdrop"+(O?" "+O:"")+(ke===1?" PhotoView-Slider__fadeIn":ke===2?" PhotoView-Slider__fadeOut":""),style:{background:We?"rgba(0, 0, 0, "+We+")":void 0,transitionTimingFunction:Vt,transitionDuration:(H?0:St)+"ms",animationDuration:St+"ms"},onAnimationEnd:nt}),m&&Zn.createElement("div",{className:"PhotoView-Slider__BannerWrap"},Zn.createElement("div",{className:"PhotoView-Slider__Counter"},Ae+1," / ",Te),Zn.createElement("div",{className:"PhotoView-Slider__BannerRight"},b&&ot&&b(ot),Zn.createElement(Qje,{className:"PhotoView-Slider__toolbarIcon",onClick:re}))),rt.map(function($e,mt){var Ht=he||Ae!==0?et.current-1+mt:Ae+mt;return Zn.createElement(Zje,{key:he?$e.key+"/"+$e.src+"/"+Ht:$e.key,item:$e,speed:St,easing:Vt,visible:T,onReachMove:W,onReachUp:_e,onPhotoTap:function(){return Pe(s)},onMaskTap:function(){return Pe(l)},wrapClassName:x,className:v,style:{left:(innerWidth+V0)*Ht+"px",transform:"translate3d("+$+"px, 0px, 0)",transition:H||z?void 0:"transform "+_t+"ms "+Ne},loadingElement:w,brokenElement:S,onPhotoResize:Ge,isActive:et.current===Ht,expose:N})}),!tf&&m&&Zn.createElement(Zn.Fragment,null,(he||Ae!==0)&&Zn.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:function(){return ue(Ae-1,!0)}},Zn.createElement(Uje,null)),(he||Ae+1-1){var O=u.slice();return O.splice(y,1,b),void l({images:O})}l(function(v){return{images:v.images.concat(b)}})},remove:function(b){l(function(y){var O=y.images.filter(function(v){return v.key!==b});return{images:O,index:Math.min(O.length-1,f)}})},show:function(b){var y=u.findIndex(function(O){return O.key===b});l({visible:!0,index:y}),r&&r(!0,y,a)}}),m=xg({close:function(){l({visible:!1}),r&&r(!1,f,a)},changeIndex:function(b){l({index:b}),n&&n(b,a)}}),g=p.useMemo(function(){return Ks({},a,h)},[a,h]);return Zn.createElement(wae.Provider,{value:g},t,Zn.createElement(Kje,Ks({images:u,visible:d,index:f,onIndexChange:m.changeIndex,onClose:m.close},i)))}var Eae=function(e){var t,n,r=e.src,i=e.render,s=e.overlay,a=e.width,l=e.height,c=e.triggers,u=c===void 0?["onClick"]:c,d=e.children,f=p.useContext(wae),h=(t=function(){return f.nextId()},(n=p.useRef({sign:!1,fn:void 0}).current).sign||(n.sign=!0,n.fn=t()),n.fn),m=p.useRef(null);p.useImperativeHandle(d==null?void 0:d.ref,function(){return m.current}),p.useEffect(function(){return function(){f.remove(h)}},[]);var g=xg({render:function(y){return i&&i(y)},show:function(y,O){f.show(h),function(v,x){if(d){var w=d.props[v];w&&w(x)}}(y,O)}}),b=p.useMemo(function(){var y={};return u.forEach(function(O){y[O]=g.show.bind(null,O)}),y},[]);return p.useEffect(function(){f.update({key:h,src:r,originRef:m,render:g.render,overlay:s,width:a,height:l})},[r]),d?p.Children.only(p.cloneElement(d,Ks({},b,{ref:m}))):null};const nRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M5.293 12.707a1 1 0 0 1 0-1.414l5-5a1 1 0 1 1 1.414 1.414L8.414 11H18a1 1 0 1 1 0 2H8.414l3.293 3.293a1 1 0 0 1-1.414 1.414l-5-5Z",clipRule:"evenodd"})}),rRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M18.707 12.707a1 1 0 0 0 0-1.414l-5-5a1 1 0 1 0-1.414 1.414L15.586 11H6a1 1 0 1 0 0 2h9.586l-3.293 3.293a1 1 0 0 0 1.414 1.414l5-5Z",clipRule:"evenodd"})}),iRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M4.47192 2.5C5.02421 2.5 5.47192 2.94772 5.47192 3.5V5.07196C7.17065 3.47759 9.45675 2.5 11.9719 2.5C17.2186 2.5 21.4719 6.75329 21.4719 12C21.4719 17.2467 17.2186 21.5 11.9719 21.5C7.10262 21.5 3.0902 17.8375 2.53692 13.1164C2.47264 12.5679 2.8652 12.0711 3.41373 12.0068C3.96226 11.9425 4.45904 12.3351 4.52333 12.8836C4.95991 16.6089 8.12901 19.5 11.9719 19.5C16.1141 19.5 19.4719 16.1421 19.4719 12C19.4719 7.85786 16.1141 4.5 11.9719 4.5C9.75153 4.5 7.75552 5.46469 6.38146 7H9.00003C9.55232 7 10 7.44772 10 8C10 8.55228 9.55232 9 9.00003 9H4.47192C3.93256 9 3.49293 8.57299 3.47265 8.03859C3.47175 8.01771 3.47151 7.99677 3.47192 7.9758V3.5C3.47192 2.94772 3.91964 2.5 4.47192 2.5Z",fill:"currentColor"})}),CN=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M2.55823 12C2.55823 6.75329 6.81152 2.5 12.0582 2.5C14.5734 2.5 16.8595 3.47759 18.5582 5.07197V3.5C18.5582 2.94772 19.0059 2.5 19.5582 2.5C20.1105 2.5 20.5582 2.94772 20.5582 3.5V7.97591C20.5586 7.99622 20.5584 8.01651 20.5576 8.03674C20.5382 8.572 20.0982 9 19.5582 9H15.0582C14.5059 9 14.0582 8.55228 14.0582 8C14.0582 7.44772 14.5059 7 15.0582 7H17.6487C16.2746 5.46469 14.2786 4.5 12.0582 4.5C7.91609 4.5 4.55823 7.85786 4.55823 12C4.55823 16.1421 7.91609 19.5 12.0582 19.5C15.9011 19.5 19.0702 16.6089 19.5068 12.8836C19.5711 12.3351 20.0679 11.9425 20.6164 12.0068C21.165 12.0711 21.5575 12.5679 21.4932 13.1164C20.94 17.8375 16.9275 21.5 12.0582 21.5C6.81152 21.5 2.55823 17.2467 2.55823 12Z",fill:"currentColor"})}),Fk=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M16.243 6.757a1 1 0 0 1 1 1v7.072a1 1 0 0 1-2 0v-4.657L8.464 16.95a1 1 0 0 1-1.414-1.414l6.778-6.779H9.172a1 1 0 0 1 0-2h7.07Z",clipRule:"evenodd"})}),sRe=e=>o.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:[o.jsx("path",{d:"M10.663 6.3872C10.8152 6.29068 11 6.40984 11 6.59007V8C11 8.55229 11.4477 9 12 9C12.5523 9 13 8.55229 13 8V6.59007C13 6.40984 13.1848 6.29068 13.337 6.3872C14.036 6.83047 14.5 7.61105 14.5 8.5C14.5 9.53284 13.8737 10.4194 12.9801 10.8006C12.9932 10.865 13 10.9317 13 11V13C13 13.5523 12.5523 14 12 14C11.4477 14 11 13.5523 11 13V11C11 10.9317 11.0068 10.865 11.0199 10.8006C10.1263 10.4194 9.5 9.53284 9.5 8.5C9.5 7.61105 9.96397 6.83047 10.663 6.3872Z",fill:"currentColor"}),o.jsx("path",{d:"M17.9754 4.01031C17.8588 4.00078 17.6965 4.00001 17.4 4.00001H9.8C8.94342 4.00001 8.36113 4.00078 7.91104 4.03756C7.47262 4.07338 7.24842 4.1383 7.09202 4.21799C6.7157 4.40974 6.40973 4.7157 6.21799 5.09202C6.1383 5.24842 6.07337 5.47263 6.03755 5.91104C6.00078 6.36113 6 6.94343 6 7.80001V16.1707C6.31278 16.0602 6.64937 16 7 16H18L18 4.60001C18 4.30348 17.9992 4.14122 17.9897 4.02464C17.9893 4.02 17.9889 4.0156 17.9886 4.01145C17.9844 4.01107 17.98 4.01069 17.9754 4.01031ZM17.657 18H7C6.44772 18 6 18.4477 6 19C6 19.5523 6.44772 20 7 20H17.657C17.5343 19.3301 17.5343 18.6699 17.657 18ZM4 19L4 7.75871C3.99999 6.95374 3.99998 6.28937 4.04419 5.74818C4.09012 5.18608 4.18868 4.66938 4.43597 4.18404C4.81947 3.43139 5.43139 2.81947 6.18404 2.43598C6.66937 2.18869 7.18608 2.09012 7.74818 2.0442C8.28937 1.99998 8.95373 1.99999 9.7587 2L17.4319 2C17.6843 1.99997 17.9301 1.99994 18.1382 2.01695C18.3668 2.03563 18.6366 2.07969 18.908 2.21799C19.2843 2.40974 19.5903 2.7157 19.782 3.09203C19.9203 3.36345 19.9644 3.63318 19.9831 3.86178C20.0001 4.06994 20 4.31574 20 4.56812L20 17C20 17.1325 19.9736 17.2638 19.9225 17.386C19.4458 18.5253 19.4458 19.4747 19.9225 20.614C20.0517 20.9227 20.0179 21.2755 19.8325 21.5541C19.6471 21.8326 19.3346 22 19 22H7C5.34315 22 4 20.6569 4 19Z",fill:"currentColor"})]}),Zy=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M18.063 5.674a1 1 0 0 1 .263 1.39l-7.5 11a1 1 0 0 1-1.533.143l-4.5-4.5a1 1 0 1 1 1.414-1.414l3.647 3.647 6.82-10.003a1 1 0 0 1 1.39-.263Z",clipRule:"evenodd"})}),kae=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4ZM2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12ZM16.0755 7.93219C16.5272 8.25003 16.6356 8.87383 16.3178 9.32549L11.5678 16.0755C11.3931 16.3237 11.1152 16.4792 10.8123 16.4981C10.5093 16.517 10.2142 16.3973 10.0101 16.1727L7.51006 13.4227C7.13855 13.014 7.16867 12.3816 7.57733 12.0101C7.98598 11.6386 8.61843 11.6687 8.98994 12.0773L10.6504 13.9039L14.6822 8.17451C15 7.72284 15.6238 7.61436 16.0755 7.93219Z",fill:"currentColor"})}),aRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 16 9",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.292893 0.292893C0.683418 -0.0976311 1.31658 -0.0976311 1.70711 0.292893L8 6.58579L14.2929 0.292894C14.6834 -0.0976305 15.3166 -0.0976304 15.7071 0.292894C16.0976 0.683418 16.0976 1.31658 15.7071 1.70711L8.70711 8.70711C8.31658 9.09763 7.68342 9.09763 7.29289 8.70711L0.292893 1.70711C-0.0976311 1.31658 -0.0976311 0.683417 0.292893 0.292893Z"})}),oRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M15.707 4.293a1 1 0 0 1 0 1.414L9.414 12l6.293 6.293a1 1 0 0 1-1.414 1.414l-7-7a1 1 0 0 1 0-1.414l7-7a1 1 0 0 1 1.414 0Z",clipRule:"evenodd"})}),lRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M8.293 4.293a1 1 0 0 1 1.414 0l7 7a1 1 0 0 1 0 1.414l-7 7a1 1 0 0 1-1.414-1.414L14.586 12 8.293 5.707a1 1 0 0 1 0-1.414Z",clipRule:"evenodd"})}),K8=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4ZM2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12ZM12 6C12.5523 6 13 6.44772 13 7V12C13 12.2652 12.8946 12.5196 12.7071 12.7071L10.2071 15.2071C9.81658 15.5976 9.18342 15.5976 8.79289 15.2071C8.40237 14.8166 8.40237 14.1834 8.79289 13.7929L11 11.5858V7C11 6.44772 11.4477 6 12 6Z",fill:"currentColor"})}),cRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M12.659 9.753a1 1 0 0 1-1.318 0l-4-3.5A1 1 0 1 1 8.66 4.747L12 7.671l3.341-2.924a1 1 0 1 1 1.318 1.506l-4 3.5Zm-4.002 9.501a1 1 0 1 1-1.314-1.508l4-3.485a1 1 0 0 1 1.314 0l4 3.485a1 1 0 1 1-1.314 1.508L12 16.34l-3.343 2.913Z"})}),J8=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z",fill:"currentColor"})}),uRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M10.556 4a1 1 0 0 0-.97.751l-.292 1.14h5.421l-.293-1.14A1 1 0 0 0 13.453 4h-2.897Zm6.224 1.892-.421-1.639A3 3 0 0 0 13.453 2h-2.897A3 3 0 0 0 7.65 4.253l-.421 1.639H4a1 1 0 1 0 0 2h.1l1.215 11.425A3 3 0 0 0 8.3 22h7.4a3 3 0 0 0 2.984-2.683l1.214-11.425H20a1 1 0 1 0 0-2h-3.22Zm1.108 2H6.112l1.192 11.214A1 1 0 0 0 8.3 20h7.4a1 1 0 0 0 .995-.894l1.192-11.214ZM10 10a1 1 0 0 1 1 1v5a1 1 0 1 1-2 0v-5a1 1 0 0 1 1-1Zm4 0a1 1 0 0 1 1 1v5a1 1 0 1 1-2 0v-5a1 1 0 0 1 1-1Z",clipRule:"evenodd"})}),dRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M3 12a2 2 0 1 1 4 0 2 2 0 0 1-4 0Zm7 0a2 2 0 1 1 4 0 2 2 0 0 1-4 0Zm7 0a2 2 0 1 1 4 0 2 2 0 0 1-4 0Z"})}),fRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 10 16",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.34151 0.747423C4.71854 0.417526 5.28149 0.417526 5.65852 0.747423L9.65852 4.24742C10.0742 4.61111 10.1163 5.24287 9.75259 5.6585C9.38891 6.07414 8.75715 6.11626 8.34151 5.75258L5.00001 2.82877L1.65852 5.75258C1.24288 6.11626 0.61112 6.07414 0.247438 5.6585C-0.116244 5.24287 -0.0741267 4.61111 0.34151 4.24742L4.34151 0.747423ZM0.246065 10.3578C0.608879 9.94139 1.24055 9.89795 1.65695 10.2608L5.00001 13.1737L8.34308 10.2608C8.75948 9.89795 9.39115 9.94139 9.75396 10.3578C10.1168 10.7742 10.0733 11.4058 9.65695 11.7687L5.65695 15.2539C5.28043 15.582 4.7196 15.582 4.34308 15.2539L0.343082 11.7687C-0.0733128 11.4058 -0.116749 10.7742 0.246065 10.3578Z"})}),hRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M16.793 2.793a3.121 3.121 0 1 1 4.414 4.414l-8.5 8.5A1 1 0 0 1 12 16H9a1 1 0 0 1-1-1v-3a1 1 0 0 1 .293-.707l8.5-8.5Zm3 1.414a1.121 1.121 0 0 0-1.586 0L10 12.414V14h1.586l8.207-8.207a1.121 1.121 0 0 0 0-1.586ZM6 5a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-4a1 1 0 1 1 2 0v4a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h4a1 1 0 1 1 0 2H6Z",clipRule:"evenodd"})}),pRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M12 7a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 1 1-2 0V8h-3a1 1 0 0 1-1-1Zm-5 5a1 1 0 0 1 1 1v3h3a1 1 0 1 1 0 2H7a1 1 0 0 1-1-1v-4a1 1 0 0 1 1-1Z",clipRule:"evenodd"})}),mRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8-10C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2Zm4.465 6.763a1 1 0 0 0-1.228-1.228l-5.5 1.5a1 1 0 0 0-.702.702l-1.5 5.5a1 1 0 0 0 1.228 1.228l5.5-1.5a1 1 0 0 0 .702-.702l1.5-5.5Zm-6.54 5.312.89-3.26 3.26-.89-.89 3.26-3.26.89Z",clipRule:"evenodd"})}),gRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M14.4472 7.10558C14.9412 7.35257 15.1414 7.95324 14.8944 8.44722L10.8944 16.4472C10.6474 16.9412 10.0468 17.1414 9.55279 16.8944C9.05881 16.6474 8.85858 16.0468 9.10557 15.5528L13.1056 7.55279C13.3526 7.05881 13.9532 6.85859 14.4472 7.10558ZM6.6 7.20001C7.04183 7.53138 7.13137 8.15818 6.8 8.60001L4.25 12L6.8 15.4C7.13137 15.8418 7.04183 16.4686 6.6 16.8C6.15817 17.1314 5.53137 17.0418 5.2 16.6L2.2 12.6C1.93333 12.2444 1.93333 11.7556 2.2 11.4L5.2 7.40001C5.53137 6.95818 6.15817 6.86863 6.6 7.20001ZM17.4 7.20001C17.8418 6.86863 18.4686 6.95818 18.8 7.40001L21.8 11.4C22.0667 11.7556 22.0667 12.2444 21.8 12.6L18.8 16.6C18.4686 17.0418 17.8418 17.1314 17.4 16.8C16.9582 16.4686 16.8686 15.8418 17.2 15.4L19.75 12L17.2 8.60001C16.8686 8.15818 16.9582 7.53138 17.4 7.20001Z",fill:"currentColor"})}),_ae=e=>o.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:[o.jsx("path",{d:"M13 12a1 1 0 1 0-2 0v4a1 1 0 1 0 2 0v-4Zm-1-2.5A1.25 1.25 0 1 0 12 7a1.25 1.25 0 0 0 0 2.5Z"}),o.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Z",clipRule:"evenodd"})]}),bRe=e=>o.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:[o.jsx("path",{d:"M7.79289 9.04289C8.18342 8.65237 8.81658 8.65237 9.20711 9.04289L11.4571 11.2929C11.8476 11.6834 11.8476 12.3166 11.4571 12.7071L9.20711 14.9571C8.81658 15.3476 8.18342 15.3476 7.79289 14.9571C7.40237 14.5666 7.40237 13.9334 7.79289 13.5429L9.33579 12L7.79289 10.4571C7.40237 10.0666 7.40237 9.43342 7.79289 9.04289ZM12.25 14.25C12.25 13.6977 12.6977 13.25 13.25 13.25H15.5C16.0523 13.25 16.5 13.6977 16.5 14.25C16.5 14.8023 16.0523 15.25 15.5 15.25H13.25C12.6977 15.25 12.25 14.8023 12.25 14.25Z",fill:"currentColor"}),o.jsx("path",{d:"M2 8C2 5.79086 3.79086 4 6 4C6.55228 4 7 4.44772 7 5C7 5.55228 6.55228 6 6 6C4.89543 6 4 6.89543 4 8V16C4 17.1046 4.89543 18 6 18C6.55228 18 7 18.4477 7 19C7 19.5523 6.55228 20 6 20C3.79086 20 2 18.2091 2 16V8ZM17 5C17 4.44772 17.4477 4 18 4C20.2091 4 22 5.79086 22 8V16C22 18.2091 20.2091 20 18 20C17.4477 20 17 19.5523 17 19C17 18.4477 17.4477 18 18 18C19.1046 18 20 17.1046 20 16V8C20 6.89543 19.1046 6 18 6C17.4477 6 17 5.55228 17 5Z",fill:"currentColor"})]}),yRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M6 12C6 11.4477 6.44772 11 7 11H17C17.5523 11 18 11.4477 18 12C18 12.5523 17.5523 13 17 13H7C6.44772 13 6 12.5523 6 12Z",fill:"currentColor"})}),ORe=e=>o.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:[o.jsx("path",{d:"M12.75 9.50001C12.75 9.08579 13.0858 8.75001 13.5 8.75001H14.5C14.9142 8.75001 15.25 9.08579 15.25 9.50001V14.5C15.25 14.9142 14.9142 15.25 14.5 15.25H13.5C13.0858 15.25 12.75 14.9142 12.75 14.5V9.50001Z",fill:"currentColor"}),o.jsx("path",{d:"M9.50001 8.75001C9.08579 8.75001 8.75001 9.08579 8.75001 9.50001V14.5C8.75001 14.9142 9.08579 15.25 9.50001 15.25H10.5C10.9142 15.25 11.25 14.9142 11.25 14.5V9.50001C11.25 9.08579 10.9142 8.75001 10.5 8.75001H9.50001Z",fill:"currentColor"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.97144 12C1.97144 6.46138 6.46138 1.97144 12 1.97144C17.5386 1.97144 22.0286 6.46138 22.0286 12C22.0286 17.5386 17.5386 22.0286 12 22.0286C6.46138 22.0286 1.97144 17.5386 1.97144 12ZM12 4.02858C7.59751 4.02858 4.02858 7.59751 4.02858 12C4.02858 16.4025 7.59751 19.9714 12 19.9714C16.4025 19.9714 19.9714 16.4025 19.9714 12C19.9714 7.59751 16.4025 4.02858 12 4.02858Z",fill:"currentColor"})]}),bH=e=>o.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:[o.jsx("path",{d:"M9.5 9.33165V14.6683C9.5 15.4595 10.3752 15.9373 11.0408 15.5095L15.1915 12.8412C15.8038 12.4475 15.8038 11.5524 15.1915 11.1588L11.0408 8.49047C10.3752 8.06265 9.5 8.54049 9.5 9.33165Z",fill:"currentColor"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12Z",fill:"currentColor"})]}),xRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M8 16.7229V7.27711C8 6.29075 9.08894 5.69298 9.9211 6.22254L17.3428 10.9454C18.1147 11.4366 18.1147 12.5634 17.3428 13.0546L9.92109 17.7775C9.08894 18.3071 8 17.7093 8 16.7229Z",fill:"currentColor"})}),Tae=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M12 5a1 1 0 0 1 1 1v5h5a1 1 0 1 1 0 2h-5v5a1 1 0 1 1-2 0v-5H6a1 1 0 1 1 0-2h5V6a1 1 0 0 1 1-1Z",clipRule:"evenodd"})}),Cae=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M12 3C12.5523 3 13 3.44772 13 4L13 11H20C20.5523 11 21 11.4477 21 12C21 12.5523 20.5523 13 20 13L13 13L13 20C13 20.5523 12.5523 21 12 21C11.4477 21 11 20.5523 11 20L11 13L4 13C3.44772 13 3 12.5523 3 12C3 11.4477 3.44772 11 4 11L11 11L11 4C11 3.44772 11.4477 3 12 3Z",fill:"currentColor"})}),vRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M12 6C12.5523 6 13 6.44772 13 7V11H17C17.5523 11 18 11.4477 18 12C18 12.5523 17.5523 13 17 13H13V17C13 17.5523 12.5523 18 12 18C11.4477 18 11 17.5523 11 17V13H7C6.44772 13 6 12.5523 6 12C6 11.4477 6.44772 11 7 11H11V7C11 6.44772 11.4477 6 12 6Z",fill:"currentColor"})}),wRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.875 4.5C7.35418 4.5 4.5 7.35418 4.5 10.875C4.5 14.3958 7.35418 17.25 10.875 17.25C14.3958 17.25 17.25 14.3958 17.25 10.875C17.25 7.35418 14.3958 4.5 10.875 4.5ZM2.5 10.875C2.5 6.24962 6.24962 2.5 10.875 2.5C15.5004 2.5 19.25 6.24962 19.25 10.875C19.25 12.8273 18.582 14.6236 17.462 16.0478L21.2071 19.7929C21.5976 20.1834 21.5976 20.8166 21.2071 21.2071C20.8166 21.5976 20.1834 21.5976 19.7929 21.2071L16.0478 17.462C14.6236 18.582 12.8273 19.25 10.875 19.25C6.24962 19.25 2.5 15.5004 2.5 10.875Z",fill:"currentColor"})}),SRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M11.2929 3.29289C11.6834 2.90237 12.3166 2.90237 12.7071 3.29289L16.7071 7.29289C17.0976 7.68342 17.0976 8.31658 16.7071 8.70711C16.3166 9.09763 15.6834 9.09763 15.2929 8.70711L13 6.41421V15C13 15.5523 12.5523 16 12 16C11.4477 16 11 15.5523 11 15V6.41421L8.70711 8.70711C8.31658 9.09763 7.68342 9.09763 7.29289 8.70711C6.90237 8.31658 6.90237 7.68342 7.29289 7.29289L11.2929 3.29289ZM4 14C4.55229 14 5 14.4477 5 15V15.2C5 16.0566 5.00078 16.6389 5.03755 17.089C5.07337 17.5274 5.1383 17.7516 5.21799 17.908C5.40973 18.2843 5.7157 18.5903 6.09202 18.782C6.24842 18.8617 6.47262 18.9266 6.91104 18.9624C7.36113 18.9992 7.94342 19 8.8 19H15.2C16.0566 19 16.6389 18.9992 17.089 18.9624C17.5274 18.9266 17.7516 18.8617 17.908 18.782C18.2843 18.5903 18.5903 18.2843 18.782 17.908C18.8617 17.7516 18.9266 17.5274 18.9624 17.089C18.9992 16.6389 19 16.0566 19 15.2V15C19 14.4477 19.4477 14 20 14C20.5523 14 21 14.4477 21 15V15.2413C21 16.0463 21 16.7106 20.9558 17.2518C20.9099 17.8139 20.8113 18.3306 20.564 18.816C20.1805 19.5686 19.5686 20.1805 18.816 20.564C18.3306 20.8113 17.8139 20.9099 17.2518 20.9558C16.7106 21 16.0463 21 15.2413 21H8.75868C7.95372 21 7.28936 21 6.74817 20.9558C6.18608 20.9099 5.66937 20.8113 5.18404 20.564C4.43139 20.1805 3.81947 19.5686 3.43597 18.816C3.18868 18.3306 3.09012 17.8139 3.04419 17.2518C2.99998 16.7106 2.99999 16.0463 3 15.2413L3 15C3 14.4477 3.44772 14 4 14Z",fill:"currentColor"})}),ERe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M6 8C6 6.89543 6.89543 6 8 6H16C17.1046 6 18 6.89543 18 8V16C18 17.1046 17.1046 18 16 18H8C6.89543 18 6 17.1046 6 16V8Z",fill:"currentColor"})}),kRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M14.5 4a5.5 5.5 0 0 0-5.078 7.616 1 1 0 0 1-.216 1.092l-4.749 4.75a1.475 1.475 0 0 0 2.086 2.085l4.749-4.749a1 1 0 0 1 1.092-.216A5.5 5.5 0 0 0 20 9.414l-1.293 1.293a3.828 3.828 0 1 1-5.414-5.414L14.585 4H14.5ZM7 9.5a7.5 7.5 0 0 1 9.969-7.084 1 1 0 0 1 .378 1.651l-2.64 2.64a1.829 1.829 0 0 0 2.586 2.586l2.64-2.64a1 1 0 0 1 1.651.378 7.5 7.5 0 0 1-9.328 9.627l-4.299 4.3a3.475 3.475 0 0 1-4.914-4.915l4.299-4.299A7.497 7.497 0 0 1 7 9.5Z"})}),L_=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M8.99805 16.796C8.99805 15.4164 7.87961 14.2979 6.5 14.2979C5.12039 14.2979 4.00195 15.4164 4.00195 16.796C4.00196 18.1756 5.1204 19.294 6.5 19.294C7.8796 19.294 8.99804 18.1756 8.99805 16.796ZM19.748 15.0479C19.748 14.7729 19.525 14.5499 19.25 14.5499H15.75C15.475 14.5499 15.252 14.7729 15.252 15.0479V18.5479C15.252 18.823 15.475 19.046 15.75 19.046H19.25C19.525 19.046 19.748 18.823 19.748 18.5479V15.0479ZM10.0469 3.45125C11.077 2.15921 13.0849 2.20276 14.0498 3.58113L16.4189 6.96492L16.5205 7.12215C17.5046 8.76341 16.3301 10.9023 14.3691 10.9024H9.63086C7.60676 10.9023 6.42029 8.62316 7.58105 6.96492L9.9502 3.58113L10.0469 3.45125ZM12.4082 4.73055C12.2223 4.46497 11.842 4.44826 11.6318 4.68074L11.5918 4.73055L9.22266 8.11433C8.99176 8.44435 9.22808 8.89744 9.63086 8.89754H14.3691C14.7468 8.89745 14.9774 8.49957 14.8145 8.17781L14.7773 8.11433L12.4082 4.73055ZM11.002 16.796C11.0019 19.2824 8.98638 21.2979 6.5 21.2979C4.01362 21.2979 1.99806 19.2824 1.99805 16.796C1.99805 14.3096 4.01361 12.294 6.5 12.294C8.98639 12.294 11.002 14.3096 11.002 16.796ZM21.752 18.5479C21.752 19.9297 20.6318 21.0499 19.25 21.0499H15.75C14.3682 21.0499 13.248 19.9297 13.248 18.5479V15.0479C13.2481 13.6662 14.3682 12.546 15.75 12.546H19.25C20.6318 12.546 21.7519 13.6662 21.752 15.0479V18.5479Z",fill:"currentColor"})}),_Re=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.5555 4C10.099 4 9.70052 4.30906 9.58693 4.75114L9.29382 5.8919H14.715L14.4219 4.75114C14.3083 4.30906 13.9098 4 13.4533 4H10.5555ZM16.7799 5.8919L16.3589 4.25342C16.0182 2.92719 14.8226 2 13.4533 2H10.5555C9.18616 2 7.99062 2.92719 7.64985 4.25342L7.22886 5.8919H4C3.44772 5.8919 3 6.33961 3 6.8919C3 7.44418 3.44772 7.8919 4 7.8919H4.10069L5.31544 19.3172C5.47763 20.8427 6.76455 22 8.29863 22H15.7014C17.2354 22 18.5224 20.8427 18.6846 19.3172L19.8993 7.8919H20C20.5523 7.8919 21 7.44418 21 6.8919C21 6.33961 20.5523 5.8919 20 5.8919H16.7799ZM17.888 7.8919H6.11196L7.30423 19.1057C7.3583 19.6142 7.78727 20 8.29863 20H15.7014C16.2127 20 16.6417 19.6142 16.6958 19.1057L17.888 7.8919ZM10 10C10.5523 10 11 10.4477 11 11V16C11 16.5523 10.5523 17 10 17C9.44772 17 9 16.5523 9 16V11C9 10.4477 9.44772 10 10 10ZM14 10C14.5523 10 15 10.4477 15 11V16C15 16.5523 14.5523 17 14 17C13.4477 17 13 16.5523 13 16V11C13 10.4477 13.4477 10 14 10Z"})}),TRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M7.5 5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5ZM3 7.5a4.5 4.5 0 1 1 9 0 4.5 4.5 0 0 1-9 0ZM17 6a2 2 0 1 0 0 4 2 2 0 0 0 0-4Zm-4 2a4 4 0 1 1 8 0 4 4 0 0 1-8 0Zm-8.96 8.247C3.137 17.048 2.5 18.271 2.5 20a1 1 0 1 1-2 0c0-2.271.862-4.049 2.21-5.248C4.042 13.57 5.788 13 7.5 13s3.459.57 4.79 1.752c1.348 1.2 2.21 2.977 2.21 5.248a1 1 0 1 1-2 0c0-1.729-.638-2.952-1.54-3.753C10.042 15.43 8.788 15 7.5 15s-2.541.43-3.46 1.247Zm15.757-.607c-1.009-.638-2.338-.807-3.526-.472a1 1 0 0 1-.542-1.925c1.695-.478 3.616-.255 5.136.706 1.558.984 2.635 2.707 2.635 5.051a1 1 0 1 1-2 0c0-1.665-.732-2.746-1.703-3.36Z",clipRule:"evenodd"})}),Aae=e=>o.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:[o.jsx("path",{d:"M10.42 2.006a4 4 0 0 1 3.159 0c.674.29 1.188.822 1.667 1.456.474.627 1 1.473 1.653 2.523l3.542 5.696c.72 1.16 1.3 2.09 1.682 2.854.384.766.654 1.517.59 2.292a4 4 0 0 1-1.604 2.886c-.625.463-1.405.63-2.258.709-.85.078-1.945.078-3.311.078H8.46c-1.366 0-2.46 0-3.31-.078-.854-.078-1.634-.246-2.26-.71a4 4 0 0 1-1.603-2.885c-.064-.775.206-1.526.59-2.292.383-.764.961-1.694 1.682-2.854l3.542-5.696c.653-1.05 1.18-1.896 1.653-2.523.48-.634.993-1.166 1.667-1.456Zm2.37 1.838a2 2 0 0 0-1.58 0c-.192.083-.448.28-.86.825-.413.544-.891 1.312-1.577 2.415l-3.488 5.61c-.755 1.214-1.283 2.066-1.62 2.737-.34.678-.402 1.02-.385 1.232a2 2 0 0 0 .802 1.443c.171.127.494.255 1.25.324.748.069 1.75.07 3.18.07h6.976c1.43 0 2.432-.001 3.18-.07.756-.069 1.079-.197 1.25-.324a2 2 0 0 0 .802-1.443c.017-.212-.045-.554-.385-1.232-.337-.671-.865-1.523-1.62-2.737l-3.488-5.61c-.686-1.103-1.164-1.87-1.576-2.415-.413-.546-.67-.742-.861-.825"}),o.jsx("path",{d:"M12 7.5a1 1 0 0 1 1 1v3a1 1 0 1 1-2 0v-3a1 1 0 0 1 1-1M10.851 15a1.15 1.15 0 1 1 2.3 0 1.15 1.15 0 0 1-2.3 0"})]}),e9=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M5.636 5.636a1 1 0 0 1 1.414 0l4.95 4.95 4.95-4.95a1 1 0 0 1 1.414 1.414L13.414 12l4.95 4.95a1 1 0 0 1-1.414 1.414L12 13.414l-4.95 4.95a1 1 0 0 1-1.414-1.414l4.95-4.95-4.95-4.95a1 1 0 0 1 0-1.414Z",clipRule:"evenodd"})});/** + `),()=>{document.head.removeChild(d)}},[t]),o.jsx(fTe,{isPresent:t,childRef:r,sizeRef:i,children:p.cloneElement(e,{ref:r})})}const pTe=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:s,mode:a})=>{const l=xN(mTe),c=p.useId(),u=p.useCallback(f=>{l.set(f,!0);for(const h of l.values())if(!h)return;r&&r()},[l,r]),d=p.useMemo(()=>({id:c,initial:t,isPresent:n,custom:i,onExitComplete:u,register:f=>(l.set(f,!1),()=>l.delete(f))}),s?[Math.random(),u]:[n,u]);return p.useMemo(()=>{l.forEach((f,h)=>l.set(h,!1))},[n]),p.useEffect(()=>{!n&&!l.size&&r&&r()},[n]),a==="popLayout"&&(e=o.jsx(hTe,{isPresent:n,children:e})),o.jsx(vN.Provider,{value:d,children:e})};function mTe(){return new Map}function qie(e=!0){const t=p.useContext(vN);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:i}=t,s=p.useId();p.useEffect(()=>{e&&i(s)},[e]);const a=p.useCallback(()=>e&&r&&r(s),[s,r,e]);return!n&&r?[!1,a]:[!0]}const $k=e=>e.key||"";function Kz(e){const t=[];return p.Children.forEach(e,n=>{p.isValidElement(n)&&t.push(n)}),t}const O8=typeof window<"u",Xie=O8?p.useLayoutEffect:p.useEffect,mu=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:s="sync",propagate:a=!1})=>{const[l,c]=qie(a),u=p.useMemo(()=>Kz(e),[e]),d=a&&!l?[]:u.map($k),f=p.useRef(!0),h=p.useRef(u),m=xN(()=>new Map),[g,b]=p.useState(u),[y,O]=p.useState(u);Xie(()=>{f.current=!1,h.current=u;for(let w=0;w{const S=$k(w),E=a&&!l?!1:u===y||d.includes(S),k=()=>{if(m.has(S))m.set(S,!0);else return;let _=!0;m.forEach(T=>{T||(_=!1)}),_&&(x==null||x(),O(h.current),a&&(c==null||c()),r&&r())};return o.jsx(pTe,{isPresent:E,initial:!f.current||n?void 0:!1,custom:E?void 0:t,presenceAffectsLayout:i,mode:s,onExitComplete:E?void 0:k,children:w},S)})})},Pl=e=>e;let Gie=Pl;const gTe={useManualTiming:!1};function bTe(e){let t=new Set,n=new Set,r=!1,i=!1;const s=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function l(u){s.has(u)&&(c.schedule(u),e()),u(a)}const c={schedule:(u,d=!1,f=!1)=>{const m=f&&r?t:n;return d&&s.add(u),m.has(u)||m.add(u),u},cancel:u=>{n.delete(u),s.delete(u)},process:u=>{if(a=u,r){i=!0;return}r=!0,[t,n]=[n,t],t.forEach(l),t.clear(),r=!1,i&&(i=!1,c.process(u))}};return c}const Bk=["read","resolveKeyframes","update","preRender","render","postRender"],yTe=40;function Wie(e,t){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>n=!0,a=Bk.reduce((O,v)=>(O[v]=bTe(s),O),{}),{read:l,resolveKeyframes:c,update:u,preRender:d,render:f,postRender:h}=a,m=()=>{const O=performance.now();n=!1,i.delta=r?1e3/60:Math.max(Math.min(O-i.timestamp,yTe),1),i.timestamp=O,i.isProcessing=!0,l.process(i),c.process(i),u.process(i),d.process(i),f.process(i),h.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(m))},g=()=>{n=!0,r=!0,i.isProcessing||e(m)};return{schedule:Bk.reduce((O,v)=>{const x=a[v];return O[v]=(w,S=!1,E=!1)=>(n||g(),x.schedule(w,S,E)),O},{}),cancel:O=>{for(let v=0;vJz[e].some(n=>!!t[n])};function OTe(e){for(const t in e)Gy[t]={...Gy[t],...e[t]}}const xTe=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 lC(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||xTe.has(e)}let Zie=e=>!lC(e);function Kie(e){e&&(Zie=t=>t.startsWith("on")?!lC(t):e(t))}try{Kie(require("@emotion/is-prop-valid").default)}catch{}function vTe(e,t,n){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||(Zie(i)||n===!0&&lC(i)||!t&&!lC(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}function wTe({children:e,isValidProp:t,...n}){t&&Kie(t),n={...p.useContext(gw),...n},n.isStatic=xN(()=>n.isStatic);const r=p.useMemo(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion]);return o.jsx(gw.Provider,{value:r,children:e})}function STe(e){if(typeof Proxy>"u")return e;const t=new Map,n=(...r)=>e(...r);return new Proxy(n,{get:(r,i)=>i==="create"?e:(t.has(i)||t.set(i,e(i)),t.get(i))})}const wN=p.createContext({});function bw(e){return typeof e=="string"||Array.isArray(e)}function SN(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const x8=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],v8=["initial",...x8];function EN(e){return SN(e.animate)||v8.some(t=>bw(e[t]))}function Jie(e){return!!(EN(e)||e.variants)}function ETe(e,t){if(EN(e)){const{initial:n,animate:r}=e;return{initial:n===!1||bw(n)?n:void 0,animate:bw(r)?r:void 0}}return e.inherit!==!1?t:{}}function kTe(e){const{initial:t,animate:n}=ETe(e,p.useContext(wN));return p.useMemo(()=>({initial:t,animate:n}),[eV(t),eV(n)])}function eV(e){return Array.isArray(e)?e.join(" "):e}const _Te=Symbol.for("motionComponentSymbol");function Bb(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function TTe(e,t,n){return p.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):Bb(n)&&(n.current=r))},[t])}const w8=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),CTe="framerAppearId",ese="data-"+w8(CTe),{schedule:S8}=Wie(queueMicrotask,!1),tse=p.createContext({});function ATe(e,t,n,r,i){var s,a;const{visualElement:l}=p.useContext(wN),c=p.useContext(Yie),u=p.useContext(vN),d=p.useContext(gw).reducedMotion,f=p.useRef(null);r=r||c.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:l,props:n,presenceContext:u,blockInitialAnimation:u?u.initial===!1:!1,reducedMotionConfig:d}));const h=f.current,m=p.useContext(tse);h&&!h.projection&&i&&(h.type==="html"||h.type==="svg")&&NTe(f.current,n,i,m);const g=p.useRef(!1);p.useInsertionEffect(()=>{h&&g.current&&h.update(n,u)});const b=n[ese],y=p.useRef(!!b&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,b))&&((a=window.MotionHasOptimisedAnimation)===null||a===void 0?void 0:a.call(window,b)));return Xie(()=>{h&&(g.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),S8.render(h.render),y.current&&h.animationState&&h.animationState.animateChanges())}),p.useEffect(()=>{h&&(!y.current&&h.animationState&&h.animationState.animateChanges(),y.current&&(queueMicrotask(()=>{var O;(O=window.MotionHandoffMarkAsComplete)===null||O===void 0||O.call(window,b)}),y.current=!1))}),h}function NTe(e,t,n,r){const{layoutId:i,layout:s,drag:a,dragConstraints:l,layoutScroll:c,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:nse(e.parent)),e.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!a||l&&Bb(l),visualElement:e,animationType:typeof s=="string"?s:"both",initialPromotionConfig:r,layoutScroll:c,layoutRoot:u})}function nse(e){if(e)return e.options.allowProjection!==!1?e.projection:nse(e.parent)}function jTe({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:i}){var s,a;e&&OTe(e);function l(u,d){let f;const h={...p.useContext(gw),...u,layoutId:RTe(u)},{isStatic:m}=h,g=kTe(u),b=r(u,m);if(!m&&O8){ITe();const y=DTe(h);f=y.MeasureLayout,g.visualElement=ATe(i,b,h,t,y.ProjectionNode)}return o.jsxs(wN.Provider,{value:g,children:[f&&g.visualElement?o.jsx(f,{visualElement:g.visualElement,...h}):null,n(i,u,TTe(b,g.visualElement,d),b,m,g.visualElement)]})}l.displayName=`motion.${typeof i=="string"?i:`create(${(a=(s=i.displayName)!==null&&s!==void 0?s:i.name)!==null&&a!==void 0?a:""})`}`;const c=p.forwardRef(l);return c[_Te]=i,c}function RTe({layoutId:e}){const t=p.useContext(y8).id;return t&&e!==void 0?t+"-"+e:e}function ITe(e,t){p.useContext(Yie).strict}function DTe(e){const{drag:t,layout:n}=Gy;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 PTe=["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 E8(e){return typeof e!="string"||e.includes("-")?!1:!!(PTe.indexOf(e)>-1||/[A-Z]/u.test(e))}function tV(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function k8(e,t,n,r){if(typeof t=="function"){const[i,s]=tV(r);t=t(n!==void 0?n:e.custom,i,s)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,s]=tV(r);t=t(n!==void 0?n:e.custom,i,s)}return t}const yM=e=>Array.isArray(e),MTe=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),LTe=e=>yM(e)?e[e.length-1]||0:e,Xa=e=>!!(e&&e.getVelocity);function M_(e){const t=Xa(e)?e.get():e;return MTe(t)?t.toValue():t}function $Te({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},r,i,s){const a={latestValues:BTe(r,i,s,e),renderState:t()};return n&&(a.onMount=l=>n({props:r,current:l,...a}),a.onUpdate=l=>n(l)),a}const rse=e=>(t,n)=>{const r=p.useContext(wN),i=p.useContext(vN),s=()=>$Te(e,t,r,i);return n?s():xN(s)};function BTe(e,t,n,r){const i={},s=r(e,{});for(const h in s)i[h]=M_(s[h]);let{initial:a,animate:l}=e;const c=EN(e),u=Jie(e);t&&u&&!c&&e.inherit!==!1&&(a===void 0&&(a=t.initial),l===void 0&&(l=t.animate));let d=n?n.initial===!1:!1;d=d||a===!1;const f=d?l:a;if(f&&typeof f!="boolean"&&!SN(f)){const h=Array.isArray(f)?f:[f];for(let m=0;mt=>typeof t=="string"&&t.startsWith(e),sse=ise("--"),QTe=ise("var(--"),_8=e=>QTe(e)?UTe.test(e.split("/*")[0].trim()):!1,UTe=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,ase=(e,t)=>t&&typeof e=="number"?t.transform(e):e,Yf=(e,t,n)=>n>t?t:ntypeof e=="number",parse:parseFloat,transform:e=>e},yw={...Q1,transform:e=>Yf(0,1,e)},Qk={...Q1,default:1},FS=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Vh=FS("deg"),ud=FS("%"),Sn=FS("px"),FTe=FS("vh"),zTe=FS("vw"),nV={...ud,parse:e=>ud.parse(e)/100,transform:e=>ud.transform(e*100)},VTe={borderWidth:Sn,borderTopWidth:Sn,borderRightWidth:Sn,borderBottomWidth:Sn,borderLeftWidth:Sn,borderRadius:Sn,radius:Sn,borderTopLeftRadius:Sn,borderTopRightRadius:Sn,borderBottomRightRadius:Sn,borderBottomLeftRadius:Sn,width:Sn,maxWidth:Sn,height:Sn,maxHeight:Sn,top:Sn,right:Sn,bottom:Sn,left:Sn,padding:Sn,paddingTop:Sn,paddingRight:Sn,paddingBottom:Sn,paddingLeft:Sn,margin:Sn,marginTop:Sn,marginRight:Sn,marginBottom:Sn,marginLeft:Sn,backgroundPositionX:Sn,backgroundPositionY:Sn},HTe={rotate:Vh,rotateX:Vh,rotateY:Vh,rotateZ:Vh,scale:Qk,scaleX:Qk,scaleY:Qk,scaleZ:Qk,skew:Vh,skewX:Vh,skewY:Vh,distance:Sn,translateX:Sn,translateY:Sn,translateZ:Sn,x:Sn,y:Sn,z:Sn,perspective:Sn,transformPerspective:Sn,opacity:yw,originX:nV,originY:nV,originZ:Sn},rV={...Q1,transform:Math.round},T8={...VTe,...HTe,zIndex:rV,size:Sn,fillOpacity:yw,strokeOpacity:yw,numOctaves:rV},qTe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},XTe=B1.length;function GTe(e,t,n){let r="",i=!0;for(let s=0;s({style:{},transform:{},transformOrigin:{},vars:{}}),ose=()=>({...N8(),attrs:{}}),j8=e=>typeof e=="string"&&e.toLowerCase()==="svg";function lse(e,{style:t,vars:n},r,i){Object.assign(e.style,t,i&&i.getProjectionStyles(r));for(const s in n)e.style.setProperty(s,n[s])}const cse=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 use(e,t,n,r){lse(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(cse.has(i)?i:w8(i),t.attrs[i])}const cC={};function JTe(e){Object.assign(cC,e)}function dse(e,{layout:t,layoutId:n}){return c0.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!cC[e]||e==="opacity")}function R8(e,t,n){var r;const{style:i}=e,s={};for(const a in i)(Xa(i[a])||t.style&&Xa(t.style[a])||dse(a,e)||((r=n==null?void 0:n.getValue(a))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(s[a]=i[a]);return s}function fse(e,t,n){const r=R8(e,t,n);for(const i in e)if(Xa(e[i])||Xa(t[i])){const s=B1.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[s]=e[i]}return r}function eCe(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 sV=["x","y","width","height","cx","cy","r"],tCe={useVisualState:rse({scrapeMotionValuesFromProps:fse,createRenderState:ose,onUpdate:({props:e,prevProps:t,current:n,renderState:r,latestValues:i})=>{if(!n)return;let s=!!e.drag;if(!s){for(const l in i)if(c0.has(l)){s=!0;break}}if(!s)return;let a=!t;if(t)for(let l=0;l{eCe(n,r),Ui.render(()=>{A8(r,i,j8(n.tagName),e.transformTemplate),use(n,r)})})}})},nCe={useVisualState:rse({scrapeMotionValuesFromProps:R8,createRenderState:N8})};function hse(e,t,n){for(const r in t)!Xa(t[r])&&!dse(r,n)&&(e[r]=t[r])}function rCe({transformTemplate:e},t){return p.useMemo(()=>{const n=N8();return C8(n,t,e),Object.assign({},n.vars,n.style)},[t])}function iCe(e,t){const n=e.style||{},r={};return hse(r,n,e),Object.assign(r,rCe(e,t)),r}function sCe(e,t){const n={},r=iCe(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 aCe(e,t,n,r){const i=p.useMemo(()=>{const s=ose();return A8(s,t,j8(r),e.transformTemplate),{...s.attrs,style:{...s.style}}},[t]);if(e.style){const s={};hse(s,e.style,e),i.style={...s,...i.style}}return i}function oCe(e=!1){return(n,r,i,{latestValues:s},a)=>{const c=(E8(n)?aCe:sCe)(r,s,a,n),u=vTe(r,typeof n=="string",e),d=n!==p.Fragment?{...u,...c,ref:i}:{},{children:f}=r,h=p.useMemo(()=>Xa(f)?f.get():f,[f]);return p.createElement(n,{...d,children:h})}}function lCe(e,t){return function(r,{forwardMotionProps:i}={forwardMotionProps:!1}){const a={...E8(r)?tCe:nCe,preloadedFeatures:e,useRender:oCe(i),createVisualElement:t,Component:r};return jTe(a)}}function pse(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r(L_===void 0&&dd.set(Ta.isProcessing||gTe.useManualTiming?Ta.timestamp:performance.now()),L_),set:e=>{L_=e,queueMicrotask(cCe)}};function D8(e,t){e.indexOf(t)===-1&&e.push(t)}function P8(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class M8{constructor(){this.subscriptions=[]}add(t){return D8(this.subscriptions,t),()=>P8(this.subscriptions,t)}notify(t,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,r);else for(let s=0;s!isNaN(parseFloat(e));class dCe{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,i=!0)=>{const s=dd.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),i&&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=dd.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=uCe(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 M8);const r=this.events[t].add(n);return t==="change"?()=>{r(),Ui.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=dd.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>aV)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,aV);return gse(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 Ow(e,t){return new dCe(e,t)}function fCe(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Ow(n))}function hCe(e,t){const n=kN(e,t);let{transitionEnd:r={},transition:i={},...s}=n||{};s={...s,...r};for(const a in s){const l=LTe(s[a]);fCe(e,a,l)}}function pCe(e){return!!(Xa(e)&&e.add)}function OM(e,t){const n=e.getValue("willChange");if(pCe(n))return n.add(t)}function bse(e){return e.props[ese]}function L8(e){let t;return()=>(t===void 0&&(t=e()),t)}const mCe=L8(()=>window.ScrollTimeline!==void 0);class gCe{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(mCe()&&i.attachTimeline)return i.attachTimeline(t);if(typeof n=="function")return n(i)});return()=>{r.forEach((i,s)=>{i&&i(),this.animations[s].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 bCe extends gCe{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}const Rf=e=>e*1e3,If=e=>e/1e3;function $8(e){return typeof e=="function"}function oV(e,t){e.timeline=t,e.onfinish=null}const B8=e=>Array.isArray(e)&&typeof e[0]=="number",yCe={linearEasing:void 0};function OCe(e,t){const n=L8(e);return()=>{var r;return(r=yCe[t])!==null&&r!==void 0?r:n()}}const uC=OCe(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Wy=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},yse=(e,t,n=10)=>{let r="";const i=Math.max(Math.round(t/n),2);for(let s=0;s`cubic-bezier(${e}, ${t}, ${n}, ${r})`,xM={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:$x([0,.65,.55,1]),circOut:$x([.55,0,1,.45]),backIn:$x([.31,.01,.66,-.59]),backOut:$x([.33,1.53,.69,.99])};function xse(e,t){if(e)return typeof e=="function"&&uC()?yse(e,t):B8(e)?$x(e):Array.isArray(e)?e.map(n=>xse(n,t)||xM.easeOut):xM[e]}const vse=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,xCe=1e-7,vCe=12;function wCe(e,t,n,r,i){let s,a,l=0;do a=t+(n-t)/2,s=vse(a,r,i)-e,s>0?n=a:t=a;while(Math.abs(s)>xCe&&++lwCe(s,0,1,e,n);return s=>s===0||s===1?s:vse(i(s),t,r)}const wse=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Sse=e=>t=>1-e(1-t),Ese=zS(.33,1.53,.69,.99),Q8=Sse(Ese),kse=wse(Q8),_se=e=>(e*=2)<1?.5*Q8(e):.5*(2-Math.pow(2,-10*(e-1))),U8=e=>1-Math.sin(Math.acos(e)),Tse=Sse(U8),Cse=wse(U8),Ase=e=>/^0[^.\s]+$/u.test(e);function SCe(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Ase(e):!0}const Ov=e=>Math.round(e*1e5)/1e5,F8=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function ECe(e){return e==null}const kCe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,z8=(e,t)=>n=>!!(typeof n=="string"&&kCe.test(n)&&n.startsWith(e)||t&&!ECe(n)&&Object.prototype.hasOwnProperty.call(n,t)),Nse=(e,t,n)=>r=>{if(typeof r!="string")return r;const[i,s,a,l]=r.match(F8);return{[e]:parseFloat(i),[t]:parseFloat(s),[n]:parseFloat(a),alpha:l!==void 0?parseFloat(l):1}},_Ce=e=>Yf(0,255,e),KI={...Q1,transform:e=>Math.round(_Ce(e))},rg={test:z8("rgb","red"),parse:Nse("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+KI.transform(e)+", "+KI.transform(t)+", "+KI.transform(n)+", "+Ov(yw.transform(r))+")"};function TCe(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const vM={test:z8("#"),parse:TCe,transform:rg.transform},Qb={test:z8("hsl","hue"),parse:Nse("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+ud.transform(Ov(t))+", "+ud.transform(Ov(n))+", "+Ov(yw.transform(r))+")"},Va={test:e=>rg.test(e)||vM.test(e)||Qb.test(e),parse:e=>rg.test(e)?rg.parse(e):Qb.test(e)?Qb.parse(e):vM.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?rg.transform(e):Qb.transform(e)},CCe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function ACe(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(F8))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(CCe))===null||n===void 0?void 0:n.length)||0)>0}const jse="number",Rse="color",NCe="var",jCe="var(",lV="${}",RCe=/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 xw(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[];let s=0;const l=t.replace(RCe,c=>(Va.test(c)?(r.color.push(s),i.push(Rse),n.push(Va.parse(c))):c.startsWith(jCe)?(r.var.push(s),i.push(NCe),n.push(c)):(r.number.push(s),i.push(jse),n.push(parseFloat(c))),++s,lV)).split(lV);return{values:n,split:l,indexes:r,types:i}}function Ise(e){return xw(e).values}function Dse(e){const{split:t,types:n}=xw(e),r=t.length;return i=>{let s="";for(let a=0;atypeof e=="number"?0:e;function DCe(e){const t=Ise(e);return Dse(e)(t.map(ICe))}const Qp={test:ACe,parse:Ise,createTransformer:Dse,getAnimatableNone:DCe},PCe=new Set(["brightness","contrast","saturate","opacity"]);function MCe(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(F8)||[];if(!r)return e;const i=n.replace(r,"");let s=PCe.has(t)?1:0;return r!==n&&(s*=100),t+"("+s+i+")"}const LCe=/\b([a-z-]*)\(.*?\)/gu,wM={...Qp,getAnimatableNone:e=>{const t=e.match(LCe);return t?t.map(MCe).join(" "):e}},$Ce={...T8,color:Va,backgroundColor:Va,outlineColor:Va,fill:Va,stroke:Va,borderColor:Va,borderTopColor:Va,borderRightColor:Va,borderBottomColor:Va,borderLeftColor:Va,filter:wM,WebkitFilter:wM},V8=e=>$Ce[e];function Pse(e,t){let n=V8(e);return n!==wM&&(n=Qp),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const BCe=new Set(["auto","none","0"]);function QCe(e,t,n){let r=0,i;for(;re===Q1||e===Sn,uV=(e,t)=>parseFloat(e.split(", ")[t]),dV=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/u);if(i)return uV(i[1],t);{const s=r.match(/^matrix\((.+)\)$/u);return s?uV(s[1],e):0}},UCe=new Set(["x","y","z"]),FCe=B1.filter(e=>!UCe.has(e));function zCe(e){const t=[];return FCe.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const Yy={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:dV(4,13),y:dV(5,14)};Yy.translateX=Yy.x;Yy.translateY=Yy.y;const Og=new Set;let SM=!1,EM=!1;function Mse(){if(EM){const e=Array.from(Og).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const i=zCe(r);i.length&&(n.set(r,i),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const i=n.get(r);i&&i.forEach(([s,a])=>{var l;(l=r.getValue(s))===null||l===void 0||l.set(a)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}EM=!1,SM=!1,Og.forEach(e=>e.complete()),Og.clear()}function Lse(){Og.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(EM=!0)})}function VCe(){Lse(),Mse()}class H8{constructor(t,n,r,i,s,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=i,this.element=s,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Og.add(this),SM||(SM=!0,Ui.read(Lse),Ui.resolveKeyframes(Mse))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:i}=this;for(let s=0;s/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),HCe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function qCe(e){const t=HCe.exec(e);if(!t)return[,];const[,n,r,i]=t;return[`--${n??r}`,i]}function Bse(e,t,n=1){const[r,i]=qCe(e);if(!r)return;const s=window.getComputedStyle(t).getPropertyValue(r);if(s){const a=s.trim();return $se(a)?parseFloat(a):a}return _8(i)?Bse(i,t,n+1):i}const Qse=e=>t=>t.test(e),XCe={test:e=>e==="auto",parse:e=>e},Use=[Q1,Sn,ud,Vh,zTe,FTe,XCe],fV=e=>Use.find(Qse(e));class Fse extends H8{constructor(t,n,r,i,s){super(t,n,r,i,s,!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 hV=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Qp.test(e)||e==="0")&&!e.startsWith("url("));function GCe(e){const t=e[0];if(e.length===1)return!0;for(let n=0;ne!==null;function _N(e,{repeat:t,repeatType:n="loop"},r){const i=e.filter(YCe),s=t&&n!=="loop"&&t%2===1?0:i.length-1;return!s||r===void 0?i[s]:r}const ZCe=40;class zse{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:i=0,repeatDelay:s=0,repeatType:a="loop",...l}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=dd.now(),this.options={autoplay:t,delay:n,type:r,repeat:i,repeatDelay:s,repeatType:a,...l},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>ZCe?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&VCe(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=dd.now(),this.hasAttemptedResolve=!0;const{name:r,type:i,velocity:s,delay:a,onComplete:l,onUpdate:c,isGenerator:u}=this.options;if(!u&&!WCe(t,r,i,s))if(a)this.options.duration=0;else{c&&c(_N(t,this.options,n)),l&&l(),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 kM=2e4;function Vse(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=kM?1/0:t}const is=(e,t,n)=>e+(t-e)*n;function JI(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 KCe({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,s=0,a=0;if(!t)i=s=a=n;else{const l=n<.5?n*(1+t):n+t-n*t,c=2*n-l;i=JI(c,l,e+1/3),s=JI(c,l,e),a=JI(c,l,e-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(a*255),alpha:r}}function dC(e,t){return n=>n>0?t:e}const e5=(e,t,n)=>{const r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},JCe=[vM,rg,Qb],eAe=e=>JCe.find(t=>t.test(e));function pV(e){const t=eAe(e);if(!t)return!1;let n=t.parse(e);return t===Qb&&(n=KCe(n)),n}const mV=(e,t)=>{const n=pV(e),r=pV(t);if(!n||!r)return dC(e,t);const i={...n};return s=>(i.red=e5(n.red,r.red,s),i.green=e5(n.green,r.green,s),i.blue=e5(n.blue,r.blue,s),i.alpha=is(n.alpha,r.alpha,s),rg.transform(i))},tAe=(e,t)=>n=>t(e(n)),VS=(...e)=>e.reduce(tAe),_M=new Set(["none","hidden"]);function nAe(e,t){return _M.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function rAe(e,t){return n=>is(e,t,n)}function q8(e){return typeof e=="number"?rAe:typeof e=="string"?_8(e)?dC:Va.test(e)?mV:aAe:Array.isArray(e)?Hse:typeof e=="object"?Va.test(e)?mV:iAe:dC}function Hse(e,t){const n=[...e],r=n.length,i=e.map((s,a)=>q8(s)(s,t[a]));return s=>{for(let a=0;a{for(const s in r)n[s]=r[s](i);return n}}function sAe(e,t){var n;const r=[],i={color:0,var:0,number:0};for(let s=0;s{const n=Qp.createTransformer(t),r=xw(e),i=xw(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?_M.has(e)&&!i.values.length||_M.has(t)&&!r.values.length?nAe(e,t):VS(Hse(sAe(r,i),i.values),n):dC(e,t)};function qse(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?is(e,t,n):q8(e)(e,t)}const oAe=5;function Xse(e,t,n){const r=Math.max(t-oAe,0);return gse(n-e(r),t-r)}const fs={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},t5=.001;function lAe({duration:e=fs.duration,bounce:t=fs.bounce,velocity:n=fs.velocity,mass:r=fs.mass}){let i,s,a=1-t;a=Yf(fs.minDamping,fs.maxDamping,a),e=Yf(fs.minDuration,fs.maxDuration,If(e)),a<1?(i=u=>{const d=u*a,f=d*e,h=d-n,m=TM(u,a),g=Math.exp(-f);return t5-h/m*g},s=u=>{const f=u*a*e,h=f*n+n,m=Math.pow(a,2)*Math.pow(u,2)*e,g=Math.exp(-f),b=TM(Math.pow(u,2),a);return(-i(u)+t5>0?-1:1)*((h-m)*g)/b}):(i=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-t5+d*f},s=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const l=5/e,c=uAe(i,s,l);if(e=Rf(e),isNaN(c))return{stiffness:fs.stiffness,damping:fs.damping,duration:e};{const u=Math.pow(c,2)*r;return{stiffness:u,damping:a*2*Math.sqrt(r*u),duration:e}}}const cAe=12;function uAe(e,t,n){let r=n;for(let i=1;ie[n]!==void 0)}function hAe(e){let t={velocity:fs.velocity,stiffness:fs.stiffness,damping:fs.damping,mass:fs.mass,isResolvedFromDuration:!1,...e};if(!gV(e,fAe)&&gV(e,dAe))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,s=2*Yf(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:fs.mass,stiffness:i,damping:s}}else{const n=lAe(e);t={...t,...n,mass:fs.mass},t.isResolvedFromDuration=!0}return t}function Gse(e=fs.visualDuration,t=fs.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:i}=n;const s=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],l={done:!1,value:s},{stiffness:c,damping:u,mass:d,duration:f,velocity:h,isResolvedFromDuration:m}=hAe({...n,velocity:-If(n.velocity||0)}),g=h||0,b=u/(2*Math.sqrt(c*d)),y=a-s,O=If(Math.sqrt(c/d)),v=Math.abs(y)<5;r||(r=v?fs.restSpeed.granular:fs.restSpeed.default),i||(i=v?fs.restDelta.granular:fs.restDelta.default);let x;if(b<1){const S=TM(O,b);x=E=>{const k=Math.exp(-b*O*E);return a-k*((g+b*O*y)/S*Math.sin(S*E)+y*Math.cos(S*E))}}else if(b===1)x=S=>a-Math.exp(-O*S)*(y+(g+O*y)*S);else{const S=O*Math.sqrt(b*b-1);x=E=>{const k=Math.exp(-b*O*E),_=Math.min(S*E,300);return a-k*((g+b*O*y)*Math.sinh(_)+S*y*Math.cosh(_))/S}}const w={calculatedDuration:m&&f||null,next:S=>{const E=x(S);if(m)l.done=S>=f;else{let k=0;b<1&&(k=S===0?Rf(g):Xse(x,S,E));const _=Math.abs(k)<=r,T=Math.abs(a-E)<=i;l.done=_&&T}return l.value=l.done?a:E,l},toString:()=>{const S=Math.min(Vse(w),kM),E=yse(k=>w.next(S*k).value,S,30);return S+"ms "+E}};return w}function bV({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:a,min:l,max:c,restDelta:u=.5,restSpeed:d}){const f=e[0],h={done:!1,value:f},m=_=>l!==void 0&&_c,g=_=>l===void 0?c:c===void 0||Math.abs(l-_)-b*Math.exp(-_/r),x=_=>O+v(_),w=_=>{const T=v(_),C=x(_);h.done=Math.abs(T)<=u,h.value=h.done?O:C};let S,E;const k=_=>{m(h.value)&&(S=_,E=Gse({keyframes:[h.value,g(h.value)],velocity:Xse(x,_,h.value),damping:i,stiffness:s,restDelta:u,restSpeed:d}))};return k(0),{calculatedDuration:null,next:_=>{let T=!1;return!E&&S===void 0&&(T=!0,w(_),k(_)),S!==void 0&&_>=S?E.next(_-S):(!T&&w(_),h)}}}const pAe=zS(.42,0,1,1),mAe=zS(0,0,.58,1),Wse=zS(.42,0,.58,1),gAe=e=>Array.isArray(e)&&typeof e[0]!="number",bAe={linear:Pl,easeIn:pAe,easeInOut:Wse,easeOut:mAe,circIn:U8,circInOut:Cse,circOut:Tse,backIn:Q8,backInOut:kse,backOut:Ese,anticipate:_se},yV=e=>{if(B8(e)){Gie(e.length===4);const[t,n,r,i]=e;return zS(t,n,r,i)}else if(typeof e=="string")return bAe[e];return e};function yAe(e,t,n){const r=[],i=n||qse,s=e.length-1;for(let a=0;at[0];if(s===2&&t[0]===t[1])return()=>t[1];const a=e[0]===e[1];e[0]>e[s-1]&&(e=[...e].reverse(),t=[...t].reverse());const l=yAe(t,r,i),c=l.length,u=d=>{if(a&&d1)for(;fu(Yf(e[0],e[s-1],d)):u}function xAe(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=Wy(0,t,r);e.push(is(n,1,i))}}function vAe(e){const t=[0];return xAe(t,e.length-1),t}function wAe(e,t){return e.map(n=>n*t)}function SAe(e,t){return e.map(()=>t||Wse).splice(0,e.length-1)}function fC({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=gAe(r)?r.map(yV):yV(r),s={done:!1,value:t[0]},a=wAe(n&&n.length===t.length?n:vAe(t),e),l=OAe(a,t,{ease:Array.isArray(i)?i:SAe(t,i)});return{calculatedDuration:e,next:c=>(s.value=l(c),s.done=c>=e,s)}}const EAe=e=>{const t=({timestamp:n})=>e(n);return{start:()=>Ui.update(t,!0),stop:()=>Bp(t),now:()=>Ta.isProcessing?Ta.timestamp:dd.now()}},kAe={decay:bV,inertia:bV,tween:fC,keyframes:fC,spring:Gse},_Ae=e=>e/100;class X8 extends zse{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:i,keyframes:s}=this.options,a=(i==null?void 0:i.KeyframeResolver)||H8,l=(c,u)=>this.onKeyframesResolved(c,u);this.resolver=new a(s,l,n,r,i),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:i=0,repeatType:s,velocity:a=0}=this.options,l=$8(n)?n:kAe[n]||fC;let c,u;l!==fC&&typeof t[0]!="number"&&(c=VS(_Ae,qse(t[0],t[1])),t=[0,100]);const d=l({...this.options,keyframes:t});s==="mirror"&&(u=l({...this.options,keyframes:[...t].reverse(),velocity:-a})),d.calculatedDuration===null&&(d.calculatedDuration=Vse(d));const{calculatedDuration:f}=d,h=f+i,m=h*(r+1)-i;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:c,calculatedDuration:f,resolvedDuration:h,totalDuration:m}}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:_}=this.options;return{done:!0,value:_[_.length-1]}}const{finalKeyframe:i,generator:s,mirroredGenerator:a,mapPercentToKeyframes:l,keyframes:c,calculatedDuration:u,totalDuration:d,resolvedDuration:f}=r;if(this.startTime===null)return s.next(0);const{delay:h,repeat:m,repeatType:g,repeatDelay:b,onUpdate:y}=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 O=this.currentTime-h*(this.speed>=0?1:-1),v=this.speed>=0?O<0:O>d;this.currentTime=Math.max(O,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let x=this.currentTime,w=s;if(m){const _=Math.min(this.currentTime,d)/f;let T=Math.floor(_),C=_%1;!C&&_>=1&&(C=1),C===1&&T--,T=Math.min(T,m+1),!!(T%2)&&(g==="reverse"?(C=1-C,b&&(C-=b/f)):g==="mirror"&&(w=a)),x=Yf(0,1,C)*f}const S=v?{done:!1,value:c[0]}:w.next(x);l&&(S.value=l(S.value));let{done:E}=S;!v&&u!==null&&(E=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const k=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&E);return k&&i!==void 0&&(S.value=_N(c,this.options,i)),y&&y(S.value),k&&this.finish(),S}get duration(){const{resolved:t}=this;return t?If(t.calculatedDuration):0}get time(){return If(this.currentTime)}set time(t){t=Rf(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=If(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=EAe,onPlay:n,startTime:r}=this.options;this.driver||(this.driver=t(s=>this.tick(s))),n&&n();const i=this.driver.now();this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=i):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 TAe=new Set(["opacity","clipPath","filter","transform"]);function CAe(e,t,n,{delay:r=0,duration:i=300,repeat:s=0,repeatType:a="loop",ease:l="easeInOut",times:c}={}){const u={[t]:n};c&&(u.offset=c);const d=xse(l,i);return Array.isArray(d)&&(u.easing=d),e.animate(u,{delay:r,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:a==="reverse"?"alternate":"normal"})}const AAe=L8(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),hC=10,NAe=2e4;function jAe(e){return $8(e.type)||e.type==="spring"||!Ose(e.ease)}function RAe(e,t){const n=new X8({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:e[0]};const i=[];let s=0;for(;!r.done&&sthis.onKeyframesResolved(a,l),n,r,i),this.resolver.scheduleResolve()}initPlayback(t,n){let{duration:r=300,times:i,ease:s,type:a,motionValue:l,name:c,startTime:u}=this.options;if(!l.owner||!l.owner.current)return!1;if(typeof s=="string"&&uC()&&IAe(s)&&(s=Yse[s]),jAe(this.options)){const{onComplete:f,onUpdate:h,motionValue:m,element:g,...b}=this.options,y=RAe(t,b);t=y.keyframes,t.length===1&&(t[1]=t[0]),r=y.duration,i=y.times,s=y.ease,a="keyframes"}const d=CAe(l.owner.current,c,t,{...this.options,duration:r,times:i,ease:s});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(oV(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:f}=this.options;l.set(_N(t,this.options,n)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:d,duration:r,times:i,type:a,ease:s,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:n}=t;return If(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return If(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=Rf(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 Pl;const{animation:r}=n;oV(r,t)}return Pl}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:i,type:s,ease:a,times:l}=t;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:u,onUpdate:d,onComplete:f,element:h,...m}=this.options,g=new X8({...m,keyframes:r,duration:i,type:s,ease:a,times:l,isGenerator:!0}),b=Rf(this.time);u.setWithVelocity(g.sample(b-hC).value,g.sample(b).value,hC)}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:i,repeatType:s,damping:a,type:l}=t;if(!n||!n.owner||!(n.owner.current instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=n.owner.getProps();return AAe()&&r&&TAe.has(r)&&!c&&!u&&!i&&s!=="mirror"&&a!==0&&l!=="inertia"}}const DAe={type:"spring",stiffness:500,damping:25,restSpeed:10},PAe=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),MAe={type:"keyframes",duration:.8},LAe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},$Ae=(e,{keyframes:t})=>t.length>2?MAe:c0.has(e)?e.startsWith("scale")?PAe(t[1]):DAe:LAe;function BAe({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:s,repeatType:a,repeatDelay:l,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const G8=(e,t,n,r={},i,s)=>a=>{const l=I8(r,e)||{},c=l.delay||r.delay||0;let{elapsed:u=0}=r;u=u-Rf(c);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...l,delay:-u,onUpdate:h=>{t.set(h),l.onUpdate&&l.onUpdate(h)},onComplete:()=>{a(),l.onComplete&&l.onComplete()},name:e,motionValue:t,element:s?void 0:i};BAe(l)||(d={...d,...$Ae(e,d)}),d.duration&&(d.duration=Rf(d.duration)),d.repeatDelay&&(d.repeatDelay=Rf(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&&!s&&t.get()!==void 0){const h=_N(d.keyframes,l);if(h!==void 0)return Ui.update(()=>{d.onUpdate(h),d.onComplete()}),new bCe([])}return!s&&OV.supports(d)?new OV(d):new X8(d)};function QAe({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function Zse(e,t,{delay:n=0,transitionOverride:r,type:i}={}){var s;let{transition:a=e.getDefaultTransition(),transitionEnd:l,...c}=t;r&&(a=r);const u=[],d=i&&e.animationState&&e.animationState.getState()[i];for(const f in c){const h=e.getValue(f,(s=e.latestValues[f])!==null&&s!==void 0?s:null),m=c[f];if(m===void 0||d&&QAe(d,f))continue;const g={delay:n,...I8(a||{},f)};let b=!1;if(window.MotionHandoffAnimation){const O=bse(e);if(O){const v=window.MotionHandoffAnimation(O,f,Ui);v!==null&&(g.startTime=v,b=!0)}}OM(e,f),h.start(G8(f,h,m,e.shouldReduceMotion&&mse.has(f)?{type:!1}:g,e,b));const y=h.animation;y&&u.push(y)}return l&&Promise.all(u).then(()=>{Ui.update(()=>{l&&hCe(e,l)})}),u}function CM(e,t,n={}){var r;const i=kN(e,t,n.type==="exit"?(r=e.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:s=e.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(s=n.transitionOverride);const a=i?()=>Promise.all(Zse(e,i,n)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=s;return UAe(e,t,d+u,f,h,n)}:()=>Promise.resolve(),{when:c}=s;if(c){const[u,d]=c==="beforeChildren"?[a,l]:[l,a];return u().then(()=>d())}else return Promise.all([a(),l(n.delay)])}function UAe(e,t,n=0,r=0,i=1,s){const a=[],l=(e.variantChildren.size-1)*r,c=i===1?(u=0)=>u*r:(u=0)=>l-u*r;return Array.from(e.variantChildren).sort(FAe).forEach((u,d)=>{u.notify("AnimationStart",t),a.push(CM(u,t,{...s,delay:n+c(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function FAe(e,t){return e.sortNodePosition(t)}function zAe(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(s=>CM(e,s,n));r=Promise.all(i)}else if(typeof t=="string")r=CM(e,t,n);else{const i=typeof t=="function"?kN(e,t,n.custom):t;r=Promise.all(Zse(e,i,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const VAe=v8.length;function Kse(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?Kse(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})=>zAe(e,n,r)))}function GAe(e){let t=XAe(e),n=xV(),r=!0;const i=c=>(u,d)=>{var f;const h=kN(e,d,c==="exit"?(f=e.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(h){const{transition:m,transitionEnd:g,...b}=h;u={...u,...b,...g}}return u};function s(c){t=c(e)}function a(c){const{props:u}=e,d=Kse(e.parent)||{},f=[],h=new Set;let m={},g=1/0;for(let y=0;yg&&w,T=!1;const C=Array.isArray(x)?x:[x];let A=C.reduce(i(O),{});S===!1&&(A={});const{prevResolvedValues:j={}}=v,M={...j,...A},I=D=>{_=!0,h.has(D)&&(T=!0,h.delete(D)),v.needsAnimating[D]=!0;const Q=e.getValue(D);Q&&(Q.liveStyle=!1)};for(const D in M){const Q=A[D],F=j[D];if(m.hasOwnProperty(D))continue;let L=!1;yM(Q)&&yM(F)?L=!pse(Q,F):L=Q!==F,L?Q!=null?I(D):h.add(D):Q!==void 0&&h.has(D)?I(D):v.protectedKeys[D]=!0}v.prevProp=x,v.prevResolvedValues=A,v.isActive&&(m={...m,...A}),r&&e.blockInitialAnimation&&(_=!1),_&&(!(E&&k)||T)&&f.push(...C.map(D=>({animation:D,options:{type:O}})))}if(h.size){const y={};h.forEach(O=>{const v=e.getBaseTarget(O),x=e.getValue(O);x&&(x.liveStyle=!0),y[O]=v??null}),f.push({animation:y})}let b=!!f.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(b=!1),r=!1,b?t(f):Promise.resolve()}function l(c,u){var d;if(n[c].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var m;return(m=h.animationState)===null||m===void 0?void 0:m.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:l,setAnimateFunction:s,getState:()=>n,reset:()=>{n=xV(),r=!0}}}function WAe(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!pse(t,e):!1}function Em(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function xV(){return{animate:Em(!0),whileInView:Em(),whileHover:Em(),whileTap:Em(),whileDrag:Em(),whileFocus:Em(),exit:Em()}}class lm{constructor(t){this.isMounted=!1,this.node=t}update(){}}class YAe extends lm{constructor(t){super(t),t.animationState||(t.animationState=GAe(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();SN(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 ZAe=0;class KAe extends lm{constructor(){super(...arguments),this.id=ZAe++}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 i=this.node.animationState.setActive("exit",!t);n&&!t&&i.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const JAe={animation:{Feature:YAe},exit:{Feature:KAe}},ru={x:!1,y:!1};function Jse(){return ru.x||ru.y}function eNe(e){return e==="x"||e==="y"?ru[e]?null:(ru[e]=!0,()=>{ru[e]=!1}):ru.x||ru.y?null:(ru.x=ru.y=!0,()=>{ru.x=ru.y=!1})}const W8=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function vw(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function HS(e){return{point:{x:e.pageX,y:e.pageY}}}const tNe=e=>t=>W8(t)&&e(t,HS(t));function xv(e,t,n,r){return vw(e,t,tNe(n),r)}const vV=(e,t)=>Math.abs(e-t);function nNe(e,t){const n=vV(e.x,t.x),r=vV(e.y,t.y);return Math.sqrt(n**2+r**2)}class eae{constructor(t,n,{transformPagePoint:r,contextWindow:i,dragSnapToOrigin:s=!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=r5(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,m=nNe(f.offset,{x:0,y:0})>=3;if(!h&&!m)return;const{point:g}=f,{timestamp:b}=Ta;this.history.push({...g,timestamp:b});const{onStart:y,onMove:O}=this.handlers;h||(y&&y(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),O&&O(this.lastMoveEvent,f)},this.handlePointerMove=(f,h)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=n5(h,this.transformPagePoint),Ui.update(this.updatePoint,!0)},this.handlePointerUp=(f,h)=>{this.end();const{onEnd:m,onSessionEnd:g,resumeAnimation:b}=this.handlers;if(this.dragSnapToOrigin&&b&&b(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const y=r5(f.type==="pointercancel"?this.lastMoveEventInfo:n5(h,this.transformPagePoint),this.history);this.startEvent&&m&&m(f,y),g&&g(f,y)},!W8(t))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=r,this.contextWindow=i||window;const a=HS(t),l=n5(a,this.transformPagePoint),{point:c}=l,{timestamp:u}=Ta;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,r5(l,this.history)),this.removeListeners=VS(xv(this.contextWindow,"pointermove",this.handlePointerMove),xv(this.contextWindow,"pointerup",this.handlePointerUp),xv(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Bp(this.updatePoint)}}function n5(e,t){return t?{point:t(e.point)}:e}function wV(e,t){return{x:e.x-t.x,y:e.y-t.y}}function r5({point:e},t){return{point:e,delta:wV(e,tae(t)),offset:wV(e,rNe(t)),velocity:iNe(t,.1)}}function rNe(e){return e[0]}function tae(e){return e[e.length-1]}function iNe(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=tae(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Rf(t)));)n--;if(!r)return{x:0,y:0};const s=If(i.timestamp-r.timestamp);if(s===0)return{x:0,y:0};const a={x:(i.x-r.x)/s,y:(i.y-r.y)/s};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}const nae=1e-4,sNe=1-nae,aNe=1+nae,rae=.01,oNe=0-rae,lNe=0+rae;function Ul(e){return e.max-e.min}function cNe(e,t,n){return Math.abs(e-t)<=n}function SV(e,t,n,r=.5){e.origin=r,e.originPoint=is(t.min,t.max,e.origin),e.scale=Ul(n)/Ul(t),e.translate=is(n.min,n.max,e.origin)-e.originPoint,(e.scale>=sNe&&e.scale<=aNe||isNaN(e.scale))&&(e.scale=1),(e.translate>=oNe&&e.translate<=lNe||isNaN(e.translate))&&(e.translate=0)}function vv(e,t,n,r){SV(e.x,t.x,n.x,r?r.originX:void 0),SV(e.y,t.y,n.y,r?r.originY:void 0)}function EV(e,t,n){e.min=n.min+t.min,e.max=e.min+Ul(t)}function uNe(e,t,n){EV(e.x,t.x,n.x),EV(e.y,t.y,n.y)}function kV(e,t,n){e.min=t.min-n.min,e.max=e.min+Ul(t)}function wv(e,t,n){kV(e.x,t.x,n.x),kV(e.y,t.y,n.y)}function dNe(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?is(n,e,r.max):Math.min(e,n)),e}function _V(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 fNe(e,{top:t,left:n,bottom:r,right:i}){return{x:_V(e.x,n,i),y:_V(e.y,t,r)}}function TV(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=Wy(t.min,t.max-r,e.min):r>i&&(n=Wy(e.min,e.max-i,t.min)),Yf(0,1,n)}function mNe(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 AM=.35;function gNe(e=AM){return e===!1?e=0:e===!0&&(e=AM),{x:CV(e,"left","right"),y:CV(e,"top","bottom")}}function CV(e,t,n){return{min:AV(e,t),max:AV(e,n)}}function AV(e,t){return typeof e=="number"?e:e[t]||0}const NV=()=>({translate:0,scale:1,origin:0,originPoint:0}),Ub=()=>({x:NV(),y:NV()}),jV=()=>({min:0,max:0}),vs=()=>({x:jV(),y:jV()});function pc(e){return[e("x"),e("y")]}function iae({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function bNe({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function yNe(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 i5(e){return e===void 0||e===1}function NM({scale:e,scaleX:t,scaleY:n}){return!i5(e)||!i5(t)||!i5(n)}function Qm(e){return NM(e)||sae(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function sae(e){return RV(e.x)||RV(e.y)}function RV(e){return e&&e!=="0%"}function pC(e,t,n){const r=e-n,i=t*r;return n+i}function IV(e,t,n,r,i){return i!==void 0&&(e=pC(e,i,r)),pC(e,n,r)+t}function jM(e,t=0,n=1,r,i){e.min=IV(e.min,t,n,r,i),e.max=IV(e.max,t,n,r,i)}function aae(e,{x:t,y:n}){jM(e.x,t.translate,t.scale,t.originPoint),jM(e.y,n.translate,n.scale,n.originPoint)}const DV=.999999999999,PV=1.0000000000001;function ONe(e,t,n,r=!1){const i=n.length;if(!i)return;t.x=t.y=1;let s,a;for(let l=0;lDV&&(t.x=1),t.yDV&&(t.y=1)}function Fb(e,t){e.min=e.min+t,e.max=e.max+t}function MV(e,t,n,r,i=.5){const s=is(e.min,e.max,i);jM(e,t,n,s,r)}function zb(e,t){MV(e.x,t.x,t.scaleX,t.scale,t.originX),MV(e.y,t.y,t.scaleY,t.scale,t.originY)}function oae(e,t){return iae(yNe(e.getBoundingClientRect(),t))}function xNe(e,t,n){const r=oae(e,n),{scroll:i}=t;return i&&(Fb(r.x,i.offset.x),Fb(r.y,i.offset.y)),r}const lae=({current:e})=>e?e.ownerDocument.defaultView:null,vNe=new WeakMap;class wNe{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=vs(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=d=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(HS(d).point)},s=(d,f)=>{const{drag:h,dragPropagation:m,onDragStart:g}=this.getProps();if(h&&!m&&(this.openDragLock&&this.openDragLock(),this.openDragLock=eNe(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),pc(y=>{let O=this.getAxisMotionValue(y).get()||0;if(ud.test(O)){const{projection:v}=this.visualElement;if(v&&v.layout){const x=v.layout.layoutBox[y];x&&(O=Ul(x)*(parseFloat(O)/100))}}this.originPoint[y]=O}),g&&Ui.postRender(()=>g(d,f)),OM(this.visualElement,"transform");const{animationState:b}=this.visualElement;b&&b.setActive("whileDrag",!0)},a=(d,f)=>{const{dragPropagation:h,dragDirectionLock:m,onDirectionLock:g,onDrag:b}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:y}=f;if(m&&this.currentDirection===null){this.currentDirection=SNe(y),this.currentDirection!==null&&g&&g(this.currentDirection);return}this.updateAxis("x",f.point,y),this.updateAxis("y",f.point,y),this.visualElement.render(),b&&b(d,f)},l=(d,f)=>this.stop(d,f),c=()=>pc(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 eae(t,{onSessionStart:i,onStart:s,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:lae(this.visualElement)})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:s}=this.getProps();s&&Ui.postRender(()=>s(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:i}=this.getProps();if(!r||!Uk(t,i,this.currentDirection))return;const s=this.getAxisMotionValue(t);let a=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(a=dNe(a,this.constraints[t],this.elastic[t])),s.set(a)}resolveConstraints(){var t;const{dragConstraints:n,dragElastic:r}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(t=this.visualElement.projection)===null||t===void 0?void 0:t.layout,s=this.constraints;n&&Bb(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&i?this.constraints=fNe(i.layoutBox,n):this.constraints=!1,this.elastic=gNe(r),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&pc(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=mNe(i.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!Bb(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=xNe(r,i.root,this.visualElement.getTransformPagePoint());let a=hNe(i.layout.layoutBox,s);if(n){const l=n(bNe(a));this.hasMutatedConstraints=!!l,l&&(a=iae(l))}return a}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:s,dragSnapToOrigin:a,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=pc(d=>{if(!Uk(d,n,this.currentDirection))return;let f=c&&c[d]||{};a&&(f={min:0,max:0});const h=i?200:1e6,m=i?40:1e7,g={type:"inertia",velocity:r?t[d]:0,bounceStiffness:h,bounceDamping:m,timeConstant:750,restDelta:1,restSpeed:10,...s,...f};return this.startAxisValueAnimation(d,g)});return Promise.all(u).then(l)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return OM(this.visualElement,t),r.start(G8(t,r,0,n,this.visualElement,!1))}stopAnimation(){pc(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){pc(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(),i=r[n];return i||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){pc(n=>{const{drag:r}=this.getProps();if(!Uk(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(n);if(i&&i.layout){const{min:a,max:l}=i.layout.layoutBox[n];s.set(t[n]-is(a,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Bb(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};pc(a=>{const l=this.getAxisMotionValue(a);if(l&&this.constraints!==!1){const c=l.get();i[a]=pNe({min:c,max:c},this.constraints[a])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),pc(a=>{if(!Uk(a,t,null))return;const l=this.getAxisMotionValue(a),{min:c,max:u}=this.constraints[a];l.set(is(c,u,i[a]))})}addListeners(){if(!this.visualElement.current)return;vNe.set(this.visualElement,this);const t=this.visualElement.current,n=xv(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();Bb(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Ui.read(r);const a=vw(window,"resize",()=>this.scalePositionWithinConstraints()),l=i.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(pc(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(),s(),l&&l()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:a=AM,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:s,dragElastic:a,dragMomentum:l}}}function Uk(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function SNe(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class ENe extends lm{constructor(t){super(t),this.removeGroupControls=Pl,this.removeListeners=Pl,this.controls=new wNe(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Pl}unmount(){this.removeGroupControls(),this.removeListeners()}}const LV=e=>(t,n)=>{e&&Ui.postRender(()=>e(t,n))};class kNe extends lm{constructor(){super(...arguments),this.removePointerDownListener=Pl}onPointerDown(t){this.session=new eae(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:lae(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:LV(t),onStart:LV(n),onMove:r,onEnd:(s,a)=>{delete this.session,i&&Ui.postRender(()=>i(s,a))}}}mount(){this.removePointerDownListener=xv(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 $_={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function $V(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const ZO={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Sn.test(e))e=parseFloat(e);else return e;const n=$V(e,t.target.x),r=$V(e,t.target.y);return`${n}% ${r}%`}},_Ne={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=Qp.parse(e);if(i.length>5)return r;const s=Qp.createTransformer(e),a=typeof i[0]!="number"?1:0,l=n.x.scale*t.x,c=n.y.scale*t.y;i[0+a]/=l,i[1+a]/=c;const u=is(l,c,.5);return typeof i[2+a]=="number"&&(i[2+a]/=u),typeof i[3+a]=="number"&&(i[3+a]/=u),s(i)}};class TNe extends p.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:s}=t;JTe(CNe),s&&(n.group&&n.group.add(s),r&&r.register&&i&&r.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),$_.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:i,isPresent:s}=this.props,a=r.projection;return a&&(a.isPresent=s,i||t.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==s&&(s?a.promote():a.relegate()||Ui.postRender(()=>{const l=a.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),S8.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=t;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function cae(e){const[t,n]=qie(),r=p.useContext(y8);return o.jsx(TNe,{...e,layoutGroup:r,switchLayoutGroup:p.useContext(tse),isPresent:t,safeToRemove:n})}const CNe={borderRadius:{...ZO,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ZO,borderTopRightRadius:ZO,borderBottomLeftRadius:ZO,borderBottomRightRadius:ZO,boxShadow:_Ne};function ANe(e,t,n){const r=Xa(e)?e:Ow(e);return r.start(G8("",r,t,n)),r.animation}function NNe(e){return e instanceof SVGElement&&e.tagName!=="svg"}const jNe=(e,t)=>e.depth-t.depth;class RNe{constructor(){this.children=[],this.isDirty=!1}add(t){D8(this.children,t),this.isDirty=!0}remove(t){P8(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(jNe),this.isDirty=!1,this.children.forEach(t)}}function INe(e,t){const n=dd.now(),r=({timestamp:i})=>{const s=i-n;s>=t&&(Bp(r),e(s-t))};return Ui.read(r,!0),()=>Bp(r)}const uae=["TopLeft","TopRight","BottomLeft","BottomRight"],DNe=uae.length,BV=e=>typeof e=="string"?parseFloat(e):e,QV=e=>typeof e=="number"||Sn.test(e);function PNe(e,t,n,r,i,s){i?(e.opacity=is(0,n.opacity!==void 0?n.opacity:1,MNe(r)),e.opacityExit=is(t.opacity!==void 0?t.opacity:1,0,LNe(r))):s&&(e.opacity=is(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let a=0;art?1:n(Wy(e,t,r))}function FV(e,t){e.min=t.min,e.max=t.max}function fc(e,t){FV(e.x,t.x),FV(e.y,t.y)}function zV(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function VV(e,t,n,r,i){return e-=t,e=pC(e,1/n,r),i!==void 0&&(e=pC(e,1/i,r)),e}function $Ne(e,t=0,n=1,r=.5,i,s=e,a=e){if(ud.test(t)&&(t=parseFloat(t),t=is(a.min,a.max,t/100)-a.min),typeof t!="number")return;let l=is(s.min,s.max,r);e===s&&(l-=t),e.min=VV(e.min,t,n,l,i),e.max=VV(e.max,t,n,l,i)}function HV(e,t,[n,r,i],s,a){$Ne(e,t[n],t[r],t[i],t.scale,s,a)}const BNe=["x","scaleX","originX"],QNe=["y","scaleY","originY"];function qV(e,t,n,r){HV(e.x,t,BNe,n?n.x:void 0,r?r.x:void 0),HV(e.y,t,QNe,n?n.y:void 0,r?r.y:void 0)}function XV(e){return e.translate===0&&e.scale===1}function fae(e){return XV(e.x)&&XV(e.y)}function GV(e,t){return e.min===t.min&&e.max===t.max}function UNe(e,t){return GV(e.x,t.x)&&GV(e.y,t.y)}function WV(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function hae(e,t){return WV(e.x,t.x)&&WV(e.y,t.y)}function YV(e){return Ul(e.x)/Ul(e.y)}function ZV(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class FNe{constructor(){this.members=[]}add(t){D8(this.members,t),t.scheduleRender()}remove(t){if(P8(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(i=>t===i);if(n===0)return!1;let r;for(let i=n;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){r=s;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:i}=t.options;i===!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 zNe(e,t,n){let r="";const i=e.x.translate/t.x,s=e.y.translate/t.y,a=(n==null?void 0:n.z)||0;if((i||s||a)&&(r=`translate3d(${i}px, ${s}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:m,skewY:g}=n;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),f&&(r+=`rotateX(${f}deg) `),h&&(r+=`rotateY(${h}deg) `),m&&(r+=`skewX(${m}deg) `),g&&(r+=`skewY(${g}deg) `)}const l=e.x.scale*t.x,c=e.y.scale*t.y;return(l!==1||c!==1)&&(r+=`scale(${l}, ${c})`),r||"none"}const Um={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Bx=typeof window<"u"&&window.MotionDebug!==void 0,s5=["","X","Y","Z"],VNe={visibility:"hidden"},KV=1e3;let HNe=0;function a5(e,t,n,r){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function pae(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=bse(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:s}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Ui,!(i||s))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&pae(r)}function mae({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(a={},l=t==null?void 0:t()){this.id=HNe++,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,Bx&&(Um.totalNodes=Um.resolvedTargetDeltas=Um.recalculatedProjection=0),this.nodes.forEach(GNe),this.nodes.forEach(JNe),this.nodes.forEach(eje),this.nodes.forEach(WNe),Bx&&window.MotionDebug.record(Um)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;cthis.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=INe(h,250),$_.hasAnimatedSinceResize&&($_.hasAnimatedSinceResize=!1,this.nodes.forEach(eH))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:m,layout:g})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const b=this.options.transition||d.getDefaultTransition()||sje,{onLayoutAnimationStart:y,onLayoutAnimationComplete:O}=d.getProps(),v=!this.targetLayout||!hae(this.targetLayout,g)||m,x=!h&&m;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||x||h&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,x);const w={...I8(b,"layout"),onPlay:y,onComplete:O};(d.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w)}else h||eH(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=g})}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,Bp(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(tje),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&&pae(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 S=w/1e3;tH(f.x,a.x,S),tH(f.y,a.y,S),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(wv(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),rje(this.relativeTarget,this.relativeTargetOrigin,h,S),x&&UNe(this.relativeTarget,x)&&(this.isProjectionDirty=!1),x||(x=vs()),fc(x,this.relativeTarget)),b&&(this.animationValues=d,PNe(d,u,this.latestValues,S,v,O)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},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&&(Bp(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Ui.update(()=>{$_.hasAnimatedSinceResize=!0,this.currentAnimation=ANe(0,KV,{...a,onUpdate:l=>{this.mixTargetDelta(l),a.onUpdate&&a.onUpdate(l)},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(KV),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:d}=a;if(!(!l||!c||!u)){if(this!==a&&this.layout&&u&&gae(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||vs();const f=Ul(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+f;const h=Ul(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+h}fc(l,c),zb(l,d),vv(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(a,l){this.sharedNodes.has(a)||this.sharedNodes.set(a,new FNe),this.sharedNodes.get(a).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(l):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:l}=this.options;return l?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:l}=this.options;return l?(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:l,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),a&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let l=!1;const{latestValues:c}=a;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&a5("z",a,u,this.animationValues);for(let d=0;d{var l;return(l=a.currentAnimation)===null||l===void 0?void 0:l.stop()}),this.root.nodes.forEach(JV),this.root.sharedNodes.clear()}}}function qNe(e){e.updateLayout()}function XNe(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:i}=e.layout,{animationType:s}=e.options,a=n.source!==e.layout.source;s==="size"?pc(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],m=Ul(h);h.min=r[f].min,h.max=h.min+m}):gae(s,n.layoutBox,r)&&pc(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],m=Ul(r[f]);h.max=h.min+m,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+m)});const l=Ub();vv(l,r,n.layoutBox);const c=Ub();a?vv(c,e.applyTransform(i,!0),n.measuredBox):vv(c,r,n.layoutBox);const u=!fae(l);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:m}=f;if(h&&m){const g=vs();wv(g,n.layoutBox,h.layoutBox);const b=vs();wv(b,r,m.layoutBox),hae(g,b)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=b,e.relativeTargetOrigin=g,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:c,layoutDelta:l,hasLayoutChanged:u,hasRelativeTargetChanged:d})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function GNe(e){Bx&&Um.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 WNe(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function YNe(e){e.clearSnapshot()}function JV(e){e.clearMeasurements()}function ZNe(e){e.isLayoutDirty=!1}function KNe(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function eH(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function JNe(e){e.resolveTargetDelta()}function eje(e){e.calcProjection()}function tje(e){e.resetSkewAndRotation()}function nje(e){e.removeLeadSnapshot()}function tH(e,t,n){e.translate=is(t.translate,0,n),e.scale=is(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function nH(e,t,n,r){e.min=is(t.min,n.min,r),e.max=is(t.max,n.max,r)}function rje(e,t,n,r){nH(e.x,t.x,n.x,r),nH(e.y,t.y,n.y,r)}function ije(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const sje={duration:.45,ease:[.4,0,.1,1]},rH=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),iH=rH("applewebkit/")&&!rH("chrome/")?Math.round:Pl;function sH(e){e.min=iH(e.min),e.max=iH(e.max)}function aje(e){sH(e.x),sH(e.y)}function gae(e,t,n){return e==="position"||e==="preserve-aspect"&&!cNe(YV(t),YV(n),.2)}function oje(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const lje=mae({attachResizeListener:(e,t)=>vw(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),o5={current:void 0},bae=mae({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!o5.current){const e=new lje({});e.mount(window),e.setOptions({layoutScroll:!0}),o5.current=e}return o5.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),cje={pan:{Feature:kNe},drag:{Feature:ENe,ProjectionNode:bae,MeasureLayout:cae}};function uje(e,t,n){var r;if(e instanceof Element)return[e];if(typeof e=="string"){let i=document;const s=(r=void 0)!==null&&r!==void 0?r:i.querySelectorAll(e);return s?Array.from(s):[]}return Array.from(e)}function yae(e,t){const n=uje(e),r=new AbortController,i={passive:!0,...t,signal:r.signal};return[n,i,()=>r.abort()]}function aH(e){return t=>{t.pointerType==="touch"||Jse()||e(t)}}function dje(e,t,n={}){const[r,i,s]=yae(e,n),a=aH(l=>{const{target:c}=l,u=t(l);if(typeof u!="function"||!c)return;const d=aH(f=>{u(f),c.removeEventListener("pointerleave",d)});c.addEventListener("pointerleave",d,i)});return r.forEach(l=>{l.addEventListener("pointerenter",a,i)}),s}function oH(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,s=r[i];s&&Ui.postRender(()=>s(t,HS(t)))}class fje extends lm{mount(){const{current:t}=this.node;t&&(this.unmount=dje(t,n=>(oH(this.node,n,"Start"),r=>oH(this.node,r,"End"))))}unmount(){}}class hje extends lm{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=VS(vw(this.node.current,"focus",()=>this.onFocus()),vw(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const Oae=(e,t)=>t?e===t?!0:Oae(e,t.parentElement):!1,pje=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function mje(e){return pje.has(e.tagName)||e.tabIndex!==-1}const Qx=new WeakSet;function lH(e){return t=>{t.key==="Enter"&&e(t)}}function l5(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const gje=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=lH(()=>{if(Qx.has(n))return;l5(n,"down");const i=lH(()=>{l5(n,"up")}),s=()=>l5(n,"cancel");n.addEventListener("keyup",i,t),n.addEventListener("blur",s,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function cH(e){return W8(e)&&!Jse()}function bje(e,t,n={}){const[r,i,s]=yae(e,n),a=l=>{const c=l.currentTarget;if(!cH(l)||Qx.has(c))return;Qx.add(c);const u=t(l),d=(m,g)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),!(!cH(m)||!Qx.has(c))&&(Qx.delete(c),typeof u=="function"&&u(m,{success:g}))},f=m=>{d(m,n.useGlobalTarget||Oae(c,m.target))},h=m=>{d(m,!1)};window.addEventListener("pointerup",f,i),window.addEventListener("pointercancel",h,i)};return r.forEach(l=>{!mje(l)&&l.getAttribute("tabindex")===null&&(l.tabIndex=0),(n.useGlobalTarget?window:l).addEventListener("pointerdown",a,i),l.addEventListener("focus",u=>gje(u,i),i)}),s}function uH(e,t,n){const{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),s=r[i];s&&Ui.postRender(()=>s(t,HS(t)))}class yje extends lm{mount(){const{current:t}=this.node;t&&(this.unmount=bje(t,n=>(uH(this.node,n,"Start"),(r,{success:i})=>uH(this.node,r,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const RM=new WeakMap,c5=new WeakMap,Oje=e=>{const t=RM.get(e.target);t&&t(e)},xje=e=>{e.forEach(Oje)};function vje({root:e,...t}){const n=e||document;c5.has(n)||c5.set(n,{});const r=c5.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(xje,{root:e,...t})),r[i]}function wje(e,t,n){const r=vje(t);return RM.set(e,n),r.observe(e),()=>{RM.delete(e),r.unobserve(e)}}const Sje={some:0,all:1};class Eje extends lm{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:s}=t,a={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:Sje[i]},l=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,s&&!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 wje(this.node.current,a,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(kje(t,n))&&this.startObserver()}unmount(){}}function kje({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const _je={inView:{Feature:Eje},tap:{Feature:yje},focus:{Feature:hje},hover:{Feature:fje}},Tje={layout:{ProjectionNode:bae,MeasureLayout:cae}},mC={current:null},Y8={current:!1};function xae(){if(Y8.current=!0,!!O8)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>mC.current=e.matches;e.addListener(t),t()}else mC.current=!1}const Cje=[...Use,Va,Qp],Aje=e=>Cje.find(Qse(e)),dH=new WeakMap;function Nje(e,t,n){for(const r in t){const i=t[r],s=n[r];if(Xa(i))e.addValue(r,i);else if(Xa(s))e.addValue(r,Ow(i,{owner:e}));else if(s!==i)if(e.hasValue(r)){const a=e.getValue(r);a.liveStyle===!0?a.jump(i):a.hasAnimated||a.set(i)}else{const a=e.getStaticValue(r);e.addValue(r,Ow(a!==void 0?a:i,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const fH=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class jje{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:i,blockInitialAnimation:s,visualState:a},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=H8,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 m=dd.now();this.renderScheduledAtthis.bindToMotionValue(r,n)),Y8.current||xae(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:mC.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){dH.delete(this.current),this.projection&&this.projection.unmount(),Bp(this.notifyUpdate),Bp(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=c0.has(t),i=n.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&Ui.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),s=n.on("renderRequest",this.scheduleRender);let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{i(),s(),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 Gy){const n=Gy[t];if(!n)continue;const{isEnabled:r,Feature:i}=n;if(!this.features[t]&&i&&r(this.props)&&(this.features[t]=new i(this)),this.features[t]){const s=this.features[t];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):vs()}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=Ow(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){var r;let i=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 i!=null&&(typeof i=="string"&&($se(i)||Ase(i))?i=parseFloat(i):!Aje(i)&&Qp.test(n)&&(i=Pse(t,n)),this.setBaseTarget(t,Xa(i)?i.get():i)),Xa(i)?i.get():i}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props;let i;if(typeof r=="string"||typeof r=="object"){const a=k8(this.props,r,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);a&&(i=a[t])}if(r&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,t);return s!==void 0&&!Xa(s)?s:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new M8),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class vae extends jje{constructor(){super(...arguments),this.KeyframeResolver=Fse}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;Xa(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function Rje(e){return window.getComputedStyle(e)}class Ije extends vae{constructor(){super(...arguments),this.type="html",this.renderInstance=lse}readValueFromInstance(t,n){if(c0.has(n)){const r=V8(n);return r&&r.default||0}else{const r=Rje(t),i=(sse(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return oae(t,n)}build(t,n,r){C8(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return R8(t,n,r)}}class Dje extends vae{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=vs}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(c0.has(n)){const r=V8(n);return r&&r.default||0}return n=cse.has(n)?n:w8(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return fse(t,n,r)}build(t,n,r){A8(t,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,n,r,i){use(t,n,r,i)}mount(t){this.isSVGTag=j8(t.tagName),super.mount(t)}}const Pje=(e,t)=>E8(e)?new Dje(t):new Ije(t,{allowProjection:e!==p.Fragment}),Mje=lCe({...JAe,..._je,...cje,...Tje},Pje),ui=STe(Mje);function Z8(){!Y8.current&&xae();const[e]=p.useState(mC.current);return e}function Ys(){return Ys=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u"||/ServerSideRendering/.test(navigator&&navigator.userAgent)?p.useEffect:p.useLayoutEffect;function hb(e,t,n){var r=p.useRef(t);r.current=t,p.useEffect(function(){function i(s){r.current(s)}return e&&window.addEventListener(e,i,n),function(){e&&window.removeEventListener(e,i)}},[e])}var Lje=["container"];function $je(e){var t=e.container,n=t===void 0?document.body:t,r=TN(e,Lje);return Tr.createPortal(Wn.createElement("div",Ys({},r)),n)}function Bje(e){return Wn.createElement("svg",Ys({width:"44",height:"44",viewBox:"0 0 768 768"},e),Wn.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 Qje(e){return Wn.createElement("svg",Ys({width:"44",height:"44",viewBox:"0 0 768 768"},e),Wn.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 Uje(e){return Wn.createElement("svg",Ys({width:"44",height:"44",viewBox:"0 0 768 768"},e),Wn.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function Fje(){return p.useEffect(function(){var e=document.body.style,t=e.overflow;return e.overflow="hidden",function(){e.overflow=t}},[]),null}function pH(e){var t=e.touches[0],n=t.clientX,r=t.clientY;if(e.touches.length>=2){var i=e.touches[1],s=i.clientX,a=i.clientY;return[(n+s)/2,(r+a)/2,Math.sqrt(Math.pow(s-n,2)+Math.pow(a-r,2))]}return[n,r,0]}var Yh=function(e,t,n,r){var i,s=n*t,a=(s-r)/2,l=e;return s<=r?(i=1,l=0):e>0&&a-e<=0?(i=2,l=a):e<0&&a+e<=0&&(i=3,l=-a),[i,l]};function u5(e,t,n,r,i,s,a,l,c,u){a===void 0&&(a=innerWidth/2),l===void 0&&(l=innerHeight/2),c===void 0&&(c=0),u===void 0&&(u=0);var d=Yh(e,s,n,innerWidth)[0],f=Yh(t,s,r,innerHeight),h=innerWidth/2,m=innerHeight/2;return{x:a-s/i*(a-(h+e))-h+(r/n>=3&&n*s===innerWidth?0:d?c/2:c),y:l-s/i*(l-(m+t))-m+(f[0]?u/2:u),lastCX:a,lastCY:l}}function PM(e,t,n){var r=e%180!=0;return r?[n,t,r]:[t,n,r]}function d5(e,t,n){var r=PM(n,innerWidth,innerHeight),i=r[0],s=r[1],a=0,l=i,c=s,u=e/t*s,d=t/e*i;return e=s?l=u:e>=i&&ti/s?c=d:t/e>=3&&!r[2]?a=((c=d)-s)/2:l=u,{width:l,height:c,x:0,y:a,pause:!0}}function zk(e,t){var n=t.leading,r=n!==void 0&&n,i=t.maxWait,s=t.wait,a=s===void 0?i||0:s,l=p.useRef(e);l.current=e;var c=p.useRef(0),u=p.useRef(),d=function(){return u.current&&clearTimeout(u.current)},f=p.useCallback(function(){var h=[].slice.call(arguments),m=Date.now();function g(){c.current=m,d(),l.current.apply(null,h)}var b=c.current,y=m-b;if(b===0&&(r&&g(),c.current=m),i!==void 0){if(y>i)return void g()}else y=1&&s&&s())};d()}function d(){c=requestAnimationFrame(u)}}var Vje={T:0,L:0,W:0,H:0,FIT:void 0},Sae=function(){var e=p.useRef(!1);return p.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),e},Hje=["className"];function qje(e){var t=e.className,n=t===void 0?"":t,r=TN(e,Hje);return Wn.createElement("div",Ys({className:"PhotoView__Spinner "+n},r),Wn.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},Wn.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"}),Wn.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}var Xje=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function Gje(e){var t=e.src,n=e.loaded,r=e.broken,i=e.className,s=e.onPhotoLoad,a=e.loadingElement,l=e.brokenElement,c=TN(e,Xje),u=Sae();return t&&!r?Wn.createElement(Wn.Fragment,null,Wn.createElement("img",Ys({className:"PhotoView__Photo"+(i?" "+i:""),src:t,onLoad:function(d){var f=d.target;u.current&&s({loaded:!0,naturalWidth:f.naturalWidth,naturalHeight:f.naturalHeight})},onError:function(){u.current&&s({broken:!0})},draggable:!1,alt:""},c)),!n&&(a?Wn.createElement("span",{className:"PhotoView__icon"},a):Wn.createElement(qje,{className:"PhotoView__icon"}))):l?Wn.createElement("span",{className:"PhotoView__icon"},typeof l=="function"?l({src:t}):l):null}var Wje={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 Yje(e){var t=e.item,n=t.src,r=t.render,i=t.width,s=i===void 0?0:i,a=t.height,l=a===void 0?0:a,c=t.originRef,u=e.visible,d=e.speed,f=e.easing,h=e.wrapClassName,m=e.className,g=e.style,b=e.loadingElement,y=e.brokenElement,O=e.onPhotoTap,v=e.onMaskTap,x=e.onReachMove,w=e.onReachUp,S=e.onPhotoResize,E=e.isActive,k=e.expose,_=gC(Wje),T=_[0],C=_[1],A=p.useRef(0),j=Sae(),M=T.naturalWidth,I=M===void 0?s:M,$=T.naturalHeight,N=$===void 0?l:$,D=T.width,Q=D===void 0?s:D,F=T.height,L=F===void 0?l:F,H=T.loaded,z=H===void 0?!n:H,B=T.broken,V=T.x,W=T.y,le=T.touched,be=T.stopRaf,re=T.maskTouched,q=T.rotate,G=T.scale,J=T.CX,de=T.CY,ve=T.lastX,Pe=T.lastY,Ae=T.lastCX,Ue=T.lastCY,Ke=T.lastScale,Ce=T.touchTime,Le=T.touchLength,pe=T.pause,me=T.reach,we=xg({onScale:function(ye){return Ee(Fk(ye))},onRotate:function(ye){q!==ye&&(k({rotate:ye}),C(Ys({rotate:ye},d5(I,N,ye))))}});function Ee(ye,Qe,rt){G!==ye&&(k({scale:ye}),C(Ys({scale:ye},u5(V,W,Q,L,G,ye,Qe,rt),ye<=1&&{x:0,y:0})))}var st=zk(function(ye,Qe,rt){if(rt===void 0&&(rt=0),(le||re)&&E){var Se=PM(q,Q,L),ze=Se[0],ht=Se[1];if(rt===0&&A.current===0){var _t=Math.abs(ye-J)<=20,Nt=Math.abs(Qe-de)<=20;if(_t&&Nt)return void C({lastCX:ye,lastCY:Qe});A.current=_t?Qe>de?3:2:1}var rn,an=ye-Ae,oe=Qe-Ue;if(rt===0){var Zt=Yh(an+ve,G,ze,innerWidth)[0],Fe=Yh(oe+Pe,G,ht,innerHeight);rn=function(Te,bt,Vt,lt){return bt&&Te===1||lt==="x"?"x":Vt&&Te>1||lt==="y"?"y":void 0}(A.current,Zt,Fe[0],me),rn!==void 0&&x(rn,ye,Qe,G)}if(rn==="x"||re)return void C({reach:"x"});var Rt=Fk(G+(rt-Le)/100/2*G,I/Q,.2);k({scale:Rt}),C(Ys({touchLength:rt,reach:rn,scale:Rt},u5(V,W,Q,L,G,Rt,ye,Qe,an,oe)))}},{maxWait:8});function $e(ye){return!be&&!le&&(j.current&&C(Ys({},ye,{pause:u})),j.current)}var ie,ce,Ie,We,K,_e,Be,He,Ye=(K=function(ye){return $e({x:ye})},_e=function(ye){return $e({y:ye})},Be=function(ye){return j.current&&(k({scale:ye}),C({scale:ye})),!le&&j.current},He=xg({X:function(ye){return K(ye)},Y:function(ye){return _e(ye)},S:function(ye){return Be(ye)}}),function(ye,Qe,rt,Se,ze,ht,_t,Nt,rn,an,oe){var Zt=PM(an,ze,ht),Fe=Zt[0],Rt=Zt[1],Te=Yh(ye,Nt,Fe,innerWidth),bt=Te[0],Vt=Te[1],lt=Yh(Qe,Nt,Rt,innerHeight),sn=lt[0],yr=lt[1],ur=Date.now()-oe;if(ur>=200||Nt!==_t||Math.abs(rn-_t)>1){var qe=u5(ye,Qe,ze,ht,_t,Nt),et=qe.x,Yt=qe.y,en=bt?Vt:et!==ye?et:null,dr=sn?yr:Yt!==Qe?Yt:null;return en!==null&&Gm(ye,en,He.X),dr!==null&&Gm(Qe,dr,He.Y),void(Nt!==_t&&Gm(_t,Nt,He.S))}var Cr=(ye-rt)/ur,Rn=(Qe-Se)/ur,Yn=Math.sqrt(Math.pow(Cr,2)+Math.pow(Rn,2)),Lr=!1,Hr=!1;(function(Zr,qr){var Zn,Xr=Zr,Kr=0,Gr=0,es=function(ti){Zn||(Zn=ti);var ta=ti-Zn,gs=Math.sign(Zr),di=-.001*gs,bs=Math.sign(-Xr)*Math.pow(Xr,2)*2e-4,ts=Xr*ta+(di+bs)*Math.pow(ta,2)/2;Kr+=ts,Zn=ti,gs*(Xr+=(di+bs)*ta)<=0?ei():qr(Kr)?Jr():ei()};function Jr(){Gr=requestAnimationFrame(es)}function ei(){cancelAnimationFrame(Gr)}Jr()})(Yn,function(Zr){var qr=ye+Zr*(Cr/Yn),Zn=Qe+Zr*(Rn/Yn),Xr=Yh(qr,_t,Fe,innerWidth),Kr=Xr[0],Gr=Xr[1],es=Yh(Zn,_t,Rt,innerHeight),Jr=es[0],ei=es[1];if(Kr&&!Lr&&(Lr=!0,bt?Gm(qr,Gr,He.X):mH(Gr,qr+(qr-Gr),He.X)),Jr&&!Hr&&(Hr=!0,sn?Gm(Zn,ei,He.Y):mH(ei,Zn+(Zn-ei),He.Y)),Lr&&Hr)return!1;var ti=Lr||He.X(Gr),ta=Hr||He.Y(ei);return ti&&ta})}),ot=(ie=O,ce=function(ye,Qe){me||Ee(G!==1?1:Math.max(2,I/Q),ye,Qe)},Ie=p.useRef(0),We=zk(function(){Ie.current=0,ie.apply(void 0,[].slice.call(arguments))},{wait:300}),function(){var ye=[].slice.call(arguments);Ie.current+=1,We.apply(void 0,ye),Ie.current>=2&&(We.cancel(),Ie.current=0,ce.apply(void 0,ye))});function Tt(ye,Qe){if(A.current=0,(le||re)&&E){C({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});var rt=Fk(G,I/Q);if(Ye(V,W,ve,Pe,Q,L,G,rt,Ke,q,Ce),w(ye,Qe),J===ye&&de===Qe){if(le)return void ot(ye,Qe);re&&v(ye,Qe)}}}function Ft(ye,Qe,rt){rt===void 0&&(rt=0),C({touched:!0,CX:ye,CY:Qe,lastCX:ye,lastCY:Qe,lastX:V,lastY:W,lastScale:G,touchLength:rt,touchTime:Date.now()})}function At(ye){C({maskTouched:!0,CX:ye.clientX,CY:ye.clientY,lastX:V,lastY:W})}hb(tf?void 0:"mousemove",function(ye){ye.preventDefault(),st(ye.clientX,ye.clientY)}),hb(tf?void 0:"mouseup",function(ye){Tt(ye.clientX,ye.clientY)}),hb(tf?"touchmove":void 0,function(ye){ye.preventDefault();var Qe=pH(ye);st.apply(void 0,Qe)},{passive:!1}),hb(tf?"touchend":void 0,function(ye){var Qe=ye.changedTouches[0];Tt(Qe.clientX,Qe.clientY)},{passive:!1}),hb("resize",zk(function(){z&&!le&&(C(d5(I,N,q)),S())},{maxWait:8})),DM(function(){E&&k(Ys({scale:G,rotate:q},we))},[E]);var Ge=function(ye,Qe,rt,Se,ze,ht,_t,Nt,rn,an){var oe=function(et,Yt,en,dr,Cr){var Rn=p.useRef(!1),Yn=gC({lead:!0,scale:en}),Lr=Yn[0],Hr=Lr.lead,Zr=Lr.scale,qr=Yn[1],Zn=zk(function(Xr){try{return Cr(!0),qr({lead:!1,scale:Xr}),Promise.resolve()}catch(Kr){return Promise.reject(Kr)}},{wait:dr});return DM(function(){Rn.current?(Cr(!1),qr({lead:!0}),Zn(en)):Rn.current=!0},[en]),Hr?[et*Zr,Yt*Zr,en/Zr]:[et*en,Yt*en,1]}(ht,_t,Nt,rn,an),Zt=oe[0],Fe=oe[1],Rt=oe[2],Te=function(et,Yt,en,dr,Cr){var Rn=p.useState(Vje),Yn=Rn[0],Lr=Rn[1],Hr=p.useState(0),Zr=Hr[0],qr=Hr[1],Zn=p.useRef(),Xr=xg({OK:function(){return et&&qr(4)}});function Kr(Gr){Cr(!1),qr(Gr)}return p.useEffect(function(){if(Zn.current||(Zn.current=Date.now()),en){if(function(Gr,es){var Jr=Gr&&Gr.current;if(Jr&&Jr.nodeType===1){var ei=Jr.getBoundingClientRect();es({T:ei.top,L:ei.left,W:ei.width,H:ei.height,FIT:Jr.tagName==="IMG"?getComputedStyle(Jr).objectFit:void 0})}}(Yt,Lr),et)return Date.now()-Zn.current<250?(qr(1),requestAnimationFrame(function(){qr(2),requestAnimationFrame(function(){return Kr(3)})}),void setTimeout(Xr.OK,dr)):void qr(4);Kr(5)}},[et,en]),[Zr,Yn]}(ye,Qe,rt,rn,an),bt=Te[0],Vt=Te[1],lt=Vt.W,sn=Vt.FIT,yr=innerWidth/2,ur=innerHeight/2,qe=bt<3||bt>4;return[qe?lt?Vt.L:yr:Se+(yr-ht*Nt/2),qe?lt?Vt.T:ur:ze+(ur-_t*Nt/2),Zt,qe&&sn?Zt*(Vt.H/lt):Fe,bt===0?Rt:qe?lt/(ht*Nt)||.01:Rt,qe?sn?1:0:1,bt,sn]}(u,c,z,V,W,Q,L,G,d,function(ye){return C({pause:ye})}),Je=Ge[4],it=Ge[6],Et="transform "+d+"ms "+f,Ve={className:m,onMouseDown:tf?void 0:function(ye){ye.stopPropagation(),ye.button===0&&Ft(ye.clientX,ye.clientY,0)},onTouchStart:tf?function(ye){ye.stopPropagation(),Ft.apply(void 0,pH(ye))}:void 0,onWheel:function(ye){if(!me){var Qe=Fk(G-ye.deltaY/100/2,I/Q);C({stopRaf:!0}),Ee(Qe,ye.clientX,ye.clientY)}},style:{width:Ge[2]+"px",height:Ge[3]+"px",opacity:Ge[5],objectFit:it===4?void 0:Ge[7],transform:q?"rotate("+q+"deg)":void 0,transition:it>2?Et+", opacity "+d+"ms ease, height "+(it<4?d/2:it>4?d:0)+"ms "+f:void 0}};return Wn.createElement("div",{className:"PhotoView__PhotoWrap"+(h?" "+h:""),style:g,onMouseDown:!tf&&E?At:void 0,onTouchStart:tf&&E?function(ye){return At(ye.touches[0])}:void 0},Wn.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:"matrix("+Je+", 0, 0, "+Je+", "+Ge[0]+", "+Ge[1]+")",transition:le||pe?void 0:Et,willChange:E?"transform":void 0}},n?Wn.createElement(Gje,Ys({src:n,loaded:z,broken:B},Ve,{onPhotoLoad:function(ye){C(Ys({},ye,ye.loaded&&d5(ye.naturalWidth||0,ye.naturalHeight||0,q)))},loadingElement:b,brokenElement:y})):r&&r({attrs:Ve,scale:Je,rotate:q})))}var gH={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 Zje(e){var t=e.loop,n=t===void 0?3:t,r=e.speed,i=e.easing,s=e.photoClosable,a=e.maskClosable,l=a===void 0||a,c=e.maskOpacity,u=c===void 0?1:c,d=e.pullClosable,f=d===void 0||d,h=e.bannerVisible,m=h===void 0||h,g=e.overlayRender,b=e.toolbarRender,y=e.className,O=e.maskClassName,v=e.photoClassName,x=e.photoWrapClassName,w=e.loadingElement,S=e.brokenElement,E=e.images,k=e.index,_=k===void 0?0:k,T=e.onIndexChange,C=e.visible,A=e.onClose,j=e.afterClose,M=e.portalContainer,I=gC(gH),$=I[0],N=I[1],D=p.useState(0),Q=D[0],F=D[1],L=$.x,H=$.touched,z=$.pause,B=$.lastCX,V=$.lastCY,W=$.bg,le=W===void 0?u:W,be=$.lastBg,re=$.overlay,q=$.minimal,G=$.scale,J=$.rotate,de=$.onScale,ve=$.onRotate,Pe=e.hasOwnProperty("index"),Ae=Pe?_:Q,Ue=Pe?T:F,Ke=p.useRef(Ae),Ce=E.length,Le=E[Ae],pe=typeof n=="boolean"?n:Ce>n,me=function(Je,it){var Et=p.useReducer(function(rt){return!rt},!1)[1],Ve=p.useRef(0),ye=function(rt){var Se=p.useRef(rt);function ze(ht){Se.current=ht}return p.useMemo(function(){(function(ht){Je?(ht(Je),Ve.current=1):Ve.current=2})(ze)},[rt]),[Se.current,ze]}(Je),Qe=ye[1];return[ye[0],Ve.current,function(){Et(),Ve.current===2&&(Qe(!1),it&&it()),Ve.current=0}]}(C,j),we=me[0],Ee=me[1],st=me[2];DM(function(){if(we)return N({pause:!0,x:Ae*-(innerWidth+V0)}),void(Ke.current=Ae);N(gH)},[we]);var $e=xg({close:function(Je){ve&&ve(0),N({overlay:!0,lastBg:le}),A(Je)},changeIndex:function(Je,it){it===void 0&&(it=!1);var Et=pe?Ke.current+(Je-Ae):Je,Ve=Ce-1,ye=IM(Et,0,Ve),Qe=pe?Et:ye,rt=innerWidth+V0;N({touched:!1,lastCX:void 0,lastCY:void 0,x:-rt*Qe,pause:it}),Ke.current=Qe,Ue&&Ue(pe?Je<0?Ve:Je>Ve?0:Je:ye)}}),ie=$e.close,ce=$e.changeIndex;function Ie(Je){return Je?ie():N({overlay:!re})}function We(){N({x:-(innerWidth+V0)*Ae,lastCX:void 0,lastCY:void 0,pause:!0}),Ke.current=Ae}function K(Je,it,Et,Ve){Je==="x"?function(ye){if(B!==void 0){var Qe=ye-B,rt=Qe;!pe&&(Ae===0&&Qe>0||Ae===Ce-1&&Qe<0)&&(rt=Qe/2),N({touched:!0,lastCX:B,x:-(innerWidth+V0)*Ke.current+rt,pause:!1})}else N({touched:!0,lastCX:ye,x:L,pause:!1})}(it):Je==="y"&&function(ye,Qe){if(V!==void 0){var rt=u===null?null:IM(u,.01,u-Math.abs(ye-V)/100/4);N({touched:!0,lastCY:V,bg:Qe===1?rt:u,minimal:Qe===1})}else N({touched:!0,lastCY:ye,bg:le,minimal:!0})}(Et,Ve)}function _e(Je,it){var Et=Je-(B??Je),Ve=it-(V??it),ye=!1;if(Et<-40)ce(Ae+1);else if(Et>40)ce(Ae-1);else{var Qe=-(innerWidth+V0)*Ke.current;Math.abs(Ve)>100&&q&&f&&(ye=!0,ie()),N({touched:!1,x:Qe,lastCX:void 0,lastCY:void 0,bg:u,overlay:!!ye||re})}}hb("keydown",function(Je){if(C)switch(Je.key){case"ArrowLeft":ce(Ae-1,!0);break;case"ArrowRight":ce(Ae+1,!0);break;case"Escape":ie()}});var Be=function(Je,it,Et){return p.useMemo(function(){var Ve=Je.length;return Et?Je.concat(Je).concat(Je).slice(Ve+it-1,Ve+it+2):Je.slice(Math.max(it-1,0),Math.min(it+2,Ve+1))},[Je,it,Et])}(E,Ae,pe);if(!we)return null;var He=re&&!Ee,Ye=C?le:be,ot=de&&ve&&{images:E,index:Ae,visible:C,onClose:ie,onIndexChange:ce,overlayVisible:He,overlay:Le&&Le.overlay,scale:G,rotate:J,onScale:de,onRotate:ve},Tt=r?r(Ee):400,Ft=i?i(Ee):hH,At=r?r(3):600,Ge=i?i(3):hH;return Wn.createElement($je,{className:"PhotoView-Portal"+(He?"":" PhotoView-Slider__clean")+(C?"":" PhotoView-Slider__willClose")+(y?" "+y:""),role:"dialog",onClick:function(Je){return Je.stopPropagation()},container:M},C&&Wn.createElement(Fje,null),Wn.createElement("div",{className:"PhotoView-Slider__Backdrop"+(O?" "+O:"")+(Ee===1?" PhotoView-Slider__fadeIn":Ee===2?" PhotoView-Slider__fadeOut":""),style:{background:Ye?"rgba(0, 0, 0, "+Ye+")":void 0,transitionTimingFunction:Ft,transitionDuration:(H?0:Tt)+"ms",animationDuration:Tt+"ms"},onAnimationEnd:st}),m&&Wn.createElement("div",{className:"PhotoView-Slider__BannerWrap"},Wn.createElement("div",{className:"PhotoView-Slider__Counter"},Ae+1," / ",Ce),Wn.createElement("div",{className:"PhotoView-Slider__BannerRight"},b&&ot&&b(ot),Wn.createElement(Bje,{className:"PhotoView-Slider__toolbarIcon",onClick:ie}))),Be.map(function(Je,it){var Et=pe||Ae!==0?Ke.current-1+it:Ae+it;return Wn.createElement(Yje,{key:pe?Je.key+"/"+Je.src+"/"+Et:Je.key,item:Je,speed:Tt,easing:Ft,visible:C,onReachMove:K,onReachUp:_e,onPhotoTap:function(){return Ie(s)},onMaskTap:function(){return Ie(l)},wrapClassName:x,className:v,style:{left:(innerWidth+V0)*Et+"px",transform:"translate3d("+L+"px, 0px, 0)",transition:H||z?void 0:"transform "+At+"ms "+Ge},loadingElement:w,brokenElement:S,onPhotoResize:We,isActive:Ke.current===Et,expose:N})}),!tf&&m&&Wn.createElement(Wn.Fragment,null,(pe||Ae!==0)&&Wn.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:function(){return ce(Ae-1,!0)}},Wn.createElement(Qje,null)),(pe||Ae+1-1){var O=u.slice();return O.splice(y,1,b),void l({images:O})}l(function(v){return{images:v.images.concat(b)}})},remove:function(b){l(function(y){var O=y.images.filter(function(v){return v.key!==b});return{images:O,index:Math.min(O.length-1,f)}})},show:function(b){var y=u.findIndex(function(O){return O.key===b});l({visible:!0,index:y}),r&&r(!0,y,a)}}),m=xg({close:function(){l({visible:!1}),r&&r(!1,f,a)},changeIndex:function(b){l({index:b}),n&&n(b,a)}}),g=p.useMemo(function(){return Ys({},a,h)},[a,h]);return Wn.createElement(wae.Provider,{value:g},t,Wn.createElement(Zje,Ys({images:u,visible:d,index:f,onIndexChange:m.changeIndex,onClose:m.close},i)))}var Eae=function(e){var t,n,r=e.src,i=e.render,s=e.overlay,a=e.width,l=e.height,c=e.triggers,u=c===void 0?["onClick"]:c,d=e.children,f=p.useContext(wae),h=(t=function(){return f.nextId()},(n=p.useRef({sign:!1,fn:void 0}).current).sign||(n.sign=!0,n.fn=t()),n.fn),m=p.useRef(null);p.useImperativeHandle(d==null?void 0:d.ref,function(){return m.current}),p.useEffect(function(){return function(){f.remove(h)}},[]);var g=xg({render:function(y){return i&&i(y)},show:function(y,O){f.show(h),function(v,x){if(d){var w=d.props[v];w&&w(x)}}(y,O)}}),b=p.useMemo(function(){var y={};return u.forEach(function(O){y[O]=g.show.bind(null,O)}),y},[]);return p.useEffect(function(){f.update({key:h,src:r,originRef:m,render:g.render,overlay:s,width:a,height:l})},[r]),d?p.Children.only(p.cloneElement(d,Ys({},b,{ref:m}))):null};const tRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M5.293 12.707a1 1 0 0 1 0-1.414l5-5a1 1 0 1 1 1.414 1.414L8.414 11H18a1 1 0 1 1 0 2H8.414l3.293 3.293a1 1 0 0 1-1.414 1.414l-5-5Z",clipRule:"evenodd"})}),nRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M18.707 12.707a1 1 0 0 0 0-1.414l-5-5a1 1 0 1 0-1.414 1.414L15.586 11H6a1 1 0 1 0 0 2h9.586l-3.293 3.293a1 1 0 0 0 1.414 1.414l5-5Z",clipRule:"evenodd"})}),rRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M4.47192 2.5C5.02421 2.5 5.47192 2.94772 5.47192 3.5V5.07196C7.17065 3.47759 9.45675 2.5 11.9719 2.5C17.2186 2.5 21.4719 6.75329 21.4719 12C21.4719 17.2467 17.2186 21.5 11.9719 21.5C7.10262 21.5 3.0902 17.8375 2.53692 13.1164C2.47264 12.5679 2.8652 12.0711 3.41373 12.0068C3.96226 11.9425 4.45904 12.3351 4.52333 12.8836C4.95991 16.6089 8.12901 19.5 11.9719 19.5C16.1141 19.5 19.4719 16.1421 19.4719 12C19.4719 7.85786 16.1141 4.5 11.9719 4.5C9.75153 4.5 7.75552 5.46469 6.38146 7H9.00003C9.55232 7 10 7.44772 10 8C10 8.55228 9.55232 9 9.00003 9H4.47192C3.93256 9 3.49293 8.57299 3.47265 8.03859C3.47175 8.01771 3.47151 7.99677 3.47192 7.9758V3.5C3.47192 2.94772 3.91964 2.5 4.47192 2.5Z",fill:"currentColor"})}),CN=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M2.55823 12C2.55823 6.75329 6.81152 2.5 12.0582 2.5C14.5734 2.5 16.8595 3.47759 18.5582 5.07197V3.5C18.5582 2.94772 19.0059 2.5 19.5582 2.5C20.1105 2.5 20.5582 2.94772 20.5582 3.5V7.97591C20.5586 7.99622 20.5584 8.01651 20.5576 8.03674C20.5382 8.572 20.0982 9 19.5582 9H15.0582C14.5059 9 14.0582 8.55228 14.0582 8C14.0582 7.44772 14.5059 7 15.0582 7H17.6487C16.2746 5.46469 14.2786 4.5 12.0582 4.5C7.91609 4.5 4.55823 7.85786 4.55823 12C4.55823 16.1421 7.91609 19.5 12.0582 19.5C15.9011 19.5 19.0702 16.6089 19.5068 12.8836C19.5711 12.3351 20.0679 11.9425 20.6164 12.0068C21.165 12.0711 21.5575 12.5679 21.4932 13.1164C20.94 17.8375 16.9275 21.5 12.0582 21.5C6.81152 21.5 2.55823 17.2467 2.55823 12Z",fill:"currentColor"})}),Vk=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M16.243 6.757a1 1 0 0 1 1 1v7.072a1 1 0 0 1-2 0v-4.657L8.464 16.95a1 1 0 0 1-1.414-1.414l6.778-6.779H9.172a1 1 0 0 1 0-2h7.07Z",clipRule:"evenodd"})}),iRe=e=>o.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:[o.jsx("path",{d:"M10.663 6.3872C10.8152 6.29068 11 6.40984 11 6.59007V8C11 8.55229 11.4477 9 12 9C12.5523 9 13 8.55229 13 8V6.59007C13 6.40984 13.1848 6.29068 13.337 6.3872C14.036 6.83047 14.5 7.61105 14.5 8.5C14.5 9.53284 13.8737 10.4194 12.9801 10.8006C12.9932 10.865 13 10.9317 13 11V13C13 13.5523 12.5523 14 12 14C11.4477 14 11 13.5523 11 13V11C11 10.9317 11.0068 10.865 11.0199 10.8006C10.1263 10.4194 9.5 9.53284 9.5 8.5C9.5 7.61105 9.96397 6.83047 10.663 6.3872Z",fill:"currentColor"}),o.jsx("path",{d:"M17.9754 4.01031C17.8588 4.00078 17.6965 4.00001 17.4 4.00001H9.8C8.94342 4.00001 8.36113 4.00078 7.91104 4.03756C7.47262 4.07338 7.24842 4.1383 7.09202 4.21799C6.7157 4.40974 6.40973 4.7157 6.21799 5.09202C6.1383 5.24842 6.07337 5.47263 6.03755 5.91104C6.00078 6.36113 6 6.94343 6 7.80001V16.1707C6.31278 16.0602 6.64937 16 7 16H18L18 4.60001C18 4.30348 17.9992 4.14122 17.9897 4.02464C17.9893 4.02 17.9889 4.0156 17.9886 4.01145C17.9844 4.01107 17.98 4.01069 17.9754 4.01031ZM17.657 18H7C6.44772 18 6 18.4477 6 19C6 19.5523 6.44772 20 7 20H17.657C17.5343 19.3301 17.5343 18.6699 17.657 18ZM4 19L4 7.75871C3.99999 6.95374 3.99998 6.28937 4.04419 5.74818C4.09012 5.18608 4.18868 4.66938 4.43597 4.18404C4.81947 3.43139 5.43139 2.81947 6.18404 2.43598C6.66937 2.18869 7.18608 2.09012 7.74818 2.0442C8.28937 1.99998 8.95373 1.99999 9.7587 2L17.4319 2C17.6843 1.99997 17.9301 1.99994 18.1382 2.01695C18.3668 2.03563 18.6366 2.07969 18.908 2.21799C19.2843 2.40974 19.5903 2.7157 19.782 3.09203C19.9203 3.36345 19.9644 3.63318 19.9831 3.86178C20.0001 4.06994 20 4.31574 20 4.56812L20 17C20 17.1325 19.9736 17.2638 19.9225 17.386C19.4458 18.5253 19.4458 19.4747 19.9225 20.614C20.0517 20.9227 20.0179 21.2755 19.8325 21.5541C19.6471 21.8326 19.3346 22 19 22H7C5.34315 22 4 20.6569 4 19Z",fill:"currentColor"})]}),Zy=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M18.063 5.674a1 1 0 0 1 .263 1.39l-7.5 11a1 1 0 0 1-1.533.143l-4.5-4.5a1 1 0 1 1 1.414-1.414l3.647 3.647 6.82-10.003a1 1 0 0 1 1.39-.263Z",clipRule:"evenodd"})}),kae=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4ZM2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12ZM16.0755 7.93219C16.5272 8.25003 16.6356 8.87383 16.3178 9.32549L11.5678 16.0755C11.3931 16.3237 11.1152 16.4792 10.8123 16.4981C10.5093 16.517 10.2142 16.3973 10.0101 16.1727L7.51006 13.4227C7.13855 13.014 7.16867 12.3816 7.57733 12.0101C7.98598 11.6386 8.61843 11.6687 8.98994 12.0773L10.6504 13.9039L14.6822 8.17451C15 7.72284 15.6238 7.61436 16.0755 7.93219Z",fill:"currentColor"})}),sRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 16 9",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.292893 0.292893C0.683418 -0.0976311 1.31658 -0.0976311 1.70711 0.292893L8 6.58579L14.2929 0.292894C14.6834 -0.0976305 15.3166 -0.0976304 15.7071 0.292894C16.0976 0.683418 16.0976 1.31658 15.7071 1.70711L8.70711 8.70711C8.31658 9.09763 7.68342 9.09763 7.29289 8.70711L0.292893 1.70711C-0.0976311 1.31658 -0.0976311 0.683417 0.292893 0.292893Z"})}),aRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M15.707 4.293a1 1 0 0 1 0 1.414L9.414 12l6.293 6.293a1 1 0 0 1-1.414 1.414l-7-7a1 1 0 0 1 0-1.414l7-7a1 1 0 0 1 1.414 0Z",clipRule:"evenodd"})}),oRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M8.293 4.293a1 1 0 0 1 1.414 0l7 7a1 1 0 0 1 0 1.414l-7 7a1 1 0 0 1-1.414-1.414L14.586 12 8.293 5.707a1 1 0 0 1 0-1.414Z",clipRule:"evenodd"})}),K8=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4ZM2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12ZM12 6C12.5523 6 13 6.44772 13 7V12C13 12.2652 12.8946 12.5196 12.7071 12.7071L10.2071 15.2071C9.81658 15.5976 9.18342 15.5976 8.79289 15.2071C8.40237 14.8166 8.40237 14.1834 8.79289 13.7929L11 11.5858V7C11 6.44772 11.4477 6 12 6Z",fill:"currentColor"})}),lRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M12.659 9.753a1 1 0 0 1-1.318 0l-4-3.5A1 1 0 1 1 8.66 4.747L12 7.671l3.341-2.924a1 1 0 1 1 1.318 1.506l-4 3.5Zm-4.002 9.501a1 1 0 1 1-1.314-1.508l4-3.485a1 1 0 0 1 1.314 0l4 3.485a1 1 0 1 1-1.314 1.508L12 16.34l-3.343 2.913Z"})}),J8=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M12.7587 2H16.2413C17.0463 1.99999 17.7106 1.99998 18.2518 2.04419C18.8139 2.09012 19.3306 2.18868 19.816 2.43597C20.5686 2.81947 21.1805 3.43139 21.564 4.18404C21.8113 4.66937 21.9099 5.18608 21.9558 5.74817C22 6.28936 22 6.95372 22 7.75868V11.2413C22 12.0463 22 12.7106 21.9558 13.2518C21.9099 13.8139 21.8113 14.3306 21.564 14.816C21.1805 15.5686 20.5686 16.1805 19.816 16.564C19.3306 16.8113 18.8139 16.9099 18.2518 16.9558C17.8906 16.9853 17.4745 16.9951 16.9984 16.9984C16.9951 17.4745 16.9853 17.8906 16.9558 18.2518C16.9099 18.8139 16.8113 19.3306 16.564 19.816C16.1805 20.5686 15.5686 21.1805 14.816 21.564C14.3306 21.8113 13.8139 21.9099 13.2518 21.9558C12.7106 22 12.0463 22 11.2413 22H7.75868C6.95372 22 6.28936 22 5.74818 21.9558C5.18608 21.9099 4.66937 21.8113 4.18404 21.564C3.43139 21.1805 2.81947 20.5686 2.43597 19.816C2.18868 19.3306 2.09012 18.8139 2.04419 18.2518C1.99998 17.7106 1.99999 17.0463 2 16.2413V12.7587C1.99999 11.9537 1.99998 11.2894 2.04419 10.7482C2.09012 10.1861 2.18868 9.66937 2.43597 9.18404C2.81947 8.43139 3.43139 7.81947 4.18404 7.43598C4.66937 7.18868 5.18608 7.09012 5.74817 7.04419C6.10939 7.01468 6.52548 7.00487 7.00162 7.00162C7.00487 6.52548 7.01468 6.10939 7.04419 5.74817C7.09012 5.18608 7.18868 4.66937 7.43598 4.18404C7.81947 3.43139 8.43139 2.81947 9.18404 2.43597C9.66937 2.18868 10.1861 2.09012 10.7482 2.04419C11.2894 1.99998 11.9537 1.99999 12.7587 2ZM9.00176 7L11.2413 7C12.0463 6.99999 12.7106 6.99998 13.2518 7.04419C13.8139 7.09012 14.3306 7.18868 14.816 7.43598C15.5686 7.81947 16.1805 8.43139 16.564 9.18404C16.8113 9.66937 16.9099 10.1861 16.9558 10.7482C17 11.2894 17 11.9537 17 12.7587V14.9982C17.4455 14.9951 17.7954 14.9864 18.089 14.9624C18.5274 14.9266 18.7516 14.8617 18.908 14.782C19.2843 14.5903 19.5903 14.2843 19.782 13.908C19.8617 13.7516 19.9266 13.5274 19.9624 13.089C19.9992 12.6389 20 12.0566 20 11.2V7.8C20 6.94342 19.9992 6.36113 19.9624 5.91104C19.9266 5.47262 19.8617 5.24842 19.782 5.09202C19.5903 4.7157 19.2843 4.40973 18.908 4.21799C18.7516 4.1383 18.5274 4.07337 18.089 4.03755C17.6389 4.00078 17.0566 4 16.2 4H12.8C11.9434 4 11.3611 4.00078 10.911 4.03755C10.4726 4.07337 10.2484 4.1383 10.092 4.21799C9.7157 4.40973 9.40973 4.7157 9.21799 5.09202C9.1383 5.24842 9.07337 5.47262 9.03755 5.91104C9.01357 6.20463 9.00489 6.55447 9.00176 7ZM5.91104 9.03755C5.47262 9.07337 5.24842 9.1383 5.09202 9.21799C4.7157 9.40973 4.40973 9.7157 4.21799 10.092C4.1383 10.2484 4.07337 10.4726 4.03755 10.911C4.00078 11.3611 4 11.9434 4 12.8V16.2C4 17.0566 4.00078 17.6389 4.03755 18.089C4.07337 18.5274 4.1383 18.7516 4.21799 18.908C4.40973 19.2843 4.7157 19.5903 5.09202 19.782C5.24842 19.8617 5.47262 19.9266 5.91104 19.9624C6.36113 19.9992 6.94342 20 7.8 20H11.2C12.0566 20 12.6389 19.9992 13.089 19.9624C13.5274 19.9266 13.7516 19.8617 13.908 19.782C14.2843 19.5903 14.5903 19.2843 14.782 18.908C14.8617 18.7516 14.9266 18.5274 14.9624 18.089C14.9992 17.6389 15 17.0566 15 16.2V12.8C15 11.9434 14.9992 11.3611 14.9624 10.911C14.9266 10.4726 14.8617 10.2484 14.782 10.092C14.5903 9.7157 14.2843 9.40973 13.908 9.21799C13.7516 9.1383 13.5274 9.07337 13.089 9.03755C12.6389 9.00078 12.0566 9 11.2 9H7.8C6.94342 9 6.36113 9.00078 5.91104 9.03755Z",fill:"currentColor"})}),cRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M10.556 4a1 1 0 0 0-.97.751l-.292 1.14h5.421l-.293-1.14A1 1 0 0 0 13.453 4h-2.897Zm6.224 1.892-.421-1.639A3 3 0 0 0 13.453 2h-2.897A3 3 0 0 0 7.65 4.253l-.421 1.639H4a1 1 0 1 0 0 2h.1l1.215 11.425A3 3 0 0 0 8.3 22h7.4a3 3 0 0 0 2.984-2.683l1.214-11.425H20a1 1 0 1 0 0-2h-3.22Zm1.108 2H6.112l1.192 11.214A1 1 0 0 0 8.3 20h7.4a1 1 0 0 0 .995-.894l1.192-11.214ZM10 10a1 1 0 0 1 1 1v5a1 1 0 1 1-2 0v-5a1 1 0 0 1 1-1Zm4 0a1 1 0 0 1 1 1v5a1 1 0 1 1-2 0v-5a1 1 0 0 1 1-1Z",clipRule:"evenodd"})}),uRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M3 12a2 2 0 1 1 4 0 2 2 0 0 1-4 0Zm7 0a2 2 0 1 1 4 0 2 2 0 0 1-4 0Zm7 0a2 2 0 1 1 4 0 2 2 0 0 1-4 0Z"})}),dRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 10 16",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.34151 0.747423C4.71854 0.417526 5.28149 0.417526 5.65852 0.747423L9.65852 4.24742C10.0742 4.61111 10.1163 5.24287 9.75259 5.6585C9.38891 6.07414 8.75715 6.11626 8.34151 5.75258L5.00001 2.82877L1.65852 5.75258C1.24288 6.11626 0.61112 6.07414 0.247438 5.6585C-0.116244 5.24287 -0.0741267 4.61111 0.34151 4.24742L4.34151 0.747423ZM0.246065 10.3578C0.608879 9.94139 1.24055 9.89795 1.65695 10.2608L5.00001 13.1737L8.34308 10.2608C8.75948 9.89795 9.39115 9.94139 9.75396 10.3578C10.1168 10.7742 10.0733 11.4058 9.65695 11.7687L5.65695 15.2539C5.28043 15.582 4.7196 15.582 4.34308 15.2539L0.343082 11.7687C-0.0733128 11.4058 -0.116749 10.7742 0.246065 10.3578Z"})}),fRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M16.793 2.793a3.121 3.121 0 1 1 4.414 4.414l-8.5 8.5A1 1 0 0 1 12 16H9a1 1 0 0 1-1-1v-3a1 1 0 0 1 .293-.707l8.5-8.5Zm3 1.414a1.121 1.121 0 0 0-1.586 0L10 12.414V14h1.586l8.207-8.207a1.121 1.121 0 0 0 0-1.586ZM6 5a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-4a1 1 0 1 1 2 0v4a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h4a1 1 0 1 1 0 2H6Z",clipRule:"evenodd"})}),hRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M12 7a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 1 1-2 0V8h-3a1 1 0 0 1-1-1Zm-5 5a1 1 0 0 1 1 1v3h3a1 1 0 1 1 0 2H7a1 1 0 0 1-1-1v-4a1 1 0 0 1 1-1Z",clipRule:"evenodd"})}),pRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm8-10C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2Zm4.465 6.763a1 1 0 0 0-1.228-1.228l-5.5 1.5a1 1 0 0 0-.702.702l-1.5 5.5a1 1 0 0 0 1.228 1.228l5.5-1.5a1 1 0 0 0 .702-.702l1.5-5.5Zm-6.54 5.312.89-3.26 3.26-.89-.89 3.26-3.26.89Z",clipRule:"evenodd"})}),mRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M14.4472 7.10558C14.9412 7.35257 15.1414 7.95324 14.8944 8.44722L10.8944 16.4472C10.6474 16.9412 10.0468 17.1414 9.55279 16.8944C9.05881 16.6474 8.85858 16.0468 9.10557 15.5528L13.1056 7.55279C13.3526 7.05881 13.9532 6.85859 14.4472 7.10558ZM6.6 7.20001C7.04183 7.53138 7.13137 8.15818 6.8 8.60001L4.25 12L6.8 15.4C7.13137 15.8418 7.04183 16.4686 6.6 16.8C6.15817 17.1314 5.53137 17.0418 5.2 16.6L2.2 12.6C1.93333 12.2444 1.93333 11.7556 2.2 11.4L5.2 7.40001C5.53137 6.95818 6.15817 6.86863 6.6 7.20001ZM17.4 7.20001C17.8418 6.86863 18.4686 6.95818 18.8 7.40001L21.8 11.4C22.0667 11.7556 22.0667 12.2444 21.8 12.6L18.8 16.6C18.4686 17.0418 17.8418 17.1314 17.4 16.8C16.9582 16.4686 16.8686 15.8418 17.2 15.4L19.75 12L17.2 8.60001C16.8686 8.15818 16.9582 7.53138 17.4 7.20001Z",fill:"currentColor"})}),_ae=e=>o.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:[o.jsx("path",{d:"M13 12a1 1 0 1 0-2 0v4a1 1 0 1 0 2 0v-4Zm-1-2.5A1.25 1.25 0 1 0 12 7a1.25 1.25 0 0 0 0 2.5Z"}),o.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Z",clipRule:"evenodd"})]}),gRe=e=>o.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:[o.jsx("path",{d:"M7.79289 9.04289C8.18342 8.65237 8.81658 8.65237 9.20711 9.04289L11.4571 11.2929C11.8476 11.6834 11.8476 12.3166 11.4571 12.7071L9.20711 14.9571C8.81658 15.3476 8.18342 15.3476 7.79289 14.9571C7.40237 14.5666 7.40237 13.9334 7.79289 13.5429L9.33579 12L7.79289 10.4571C7.40237 10.0666 7.40237 9.43342 7.79289 9.04289ZM12.25 14.25C12.25 13.6977 12.6977 13.25 13.25 13.25H15.5C16.0523 13.25 16.5 13.6977 16.5 14.25C16.5 14.8023 16.0523 15.25 15.5 15.25H13.25C12.6977 15.25 12.25 14.8023 12.25 14.25Z",fill:"currentColor"}),o.jsx("path",{d:"M2 8C2 5.79086 3.79086 4 6 4C6.55228 4 7 4.44772 7 5C7 5.55228 6.55228 6 6 6C4.89543 6 4 6.89543 4 8V16C4 17.1046 4.89543 18 6 18C6.55228 18 7 18.4477 7 19C7 19.5523 6.55228 20 6 20C3.79086 20 2 18.2091 2 16V8ZM17 5C17 4.44772 17.4477 4 18 4C20.2091 4 22 5.79086 22 8V16C22 18.2091 20.2091 20 18 20C17.4477 20 17 19.5523 17 19C17 18.4477 17.4477 18 18 18C19.1046 18 20 17.1046 20 16V8C20 6.89543 19.1046 6 18 6C17.4477 6 17 5.55228 17 5Z",fill:"currentColor"})]}),bRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M6 12C6 11.4477 6.44772 11 7 11H17C17.5523 11 18 11.4477 18 12C18 12.5523 17.5523 13 17 13H7C6.44772 13 6 12.5523 6 12Z",fill:"currentColor"})}),yRe=e=>o.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:[o.jsx("path",{d:"M12.75 9.50001C12.75 9.08579 13.0858 8.75001 13.5 8.75001H14.5C14.9142 8.75001 15.25 9.08579 15.25 9.50001V14.5C15.25 14.9142 14.9142 15.25 14.5 15.25H13.5C13.0858 15.25 12.75 14.9142 12.75 14.5V9.50001Z",fill:"currentColor"}),o.jsx("path",{d:"M9.50001 8.75001C9.08579 8.75001 8.75001 9.08579 8.75001 9.50001V14.5C8.75001 14.9142 9.08579 15.25 9.50001 15.25H10.5C10.9142 15.25 11.25 14.9142 11.25 14.5V9.50001C11.25 9.08579 10.9142 8.75001 10.5 8.75001H9.50001Z",fill:"currentColor"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.97144 12C1.97144 6.46138 6.46138 1.97144 12 1.97144C17.5386 1.97144 22.0286 6.46138 22.0286 12C22.0286 17.5386 17.5386 22.0286 12 22.0286C6.46138 22.0286 1.97144 17.5386 1.97144 12ZM12 4.02858C7.59751 4.02858 4.02858 7.59751 4.02858 12C4.02858 16.4025 7.59751 19.9714 12 19.9714C16.4025 19.9714 19.9714 16.4025 19.9714 12C19.9714 7.59751 16.4025 4.02858 12 4.02858Z",fill:"currentColor"})]}),bH=e=>o.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:[o.jsx("path",{d:"M9.5 9.33165V14.6683C9.5 15.4595 10.3752 15.9373 11.0408 15.5095L15.1915 12.8412C15.8038 12.4475 15.8038 11.5524 15.1915 11.1588L11.0408 8.49047C10.3752 8.06265 9.5 8.54049 9.5 9.33165Z",fill:"currentColor"}),o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM4 12C4 7.58172 7.58172 4 12 4C16.4183 4 20 7.58172 20 12C20 16.4183 16.4183 20 12 20C7.58172 20 4 16.4183 4 12Z",fill:"currentColor"})]}),ORe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M8 16.7229V7.27711C8 6.29075 9.08894 5.69298 9.9211 6.22254L17.3428 10.9454C18.1147 11.4366 18.1147 12.5634 17.3428 13.0546L9.92109 17.7775C9.08894 18.3071 8 17.7093 8 16.7229Z",fill:"currentColor"})}),Tae=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M12 5a1 1 0 0 1 1 1v5h5a1 1 0 1 1 0 2h-5v5a1 1 0 1 1-2 0v-5H6a1 1 0 1 1 0-2h5V6a1 1 0 0 1 1-1Z",clipRule:"evenodd"})}),Cae=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M12 3C12.5523 3 13 3.44772 13 4L13 11H20C20.5523 11 21 11.4477 21 12C21 12.5523 20.5523 13 20 13L13 13L13 20C13 20.5523 12.5523 21 12 21C11.4477 21 11 20.5523 11 20L11 13L4 13C3.44772 13 3 12.5523 3 12C3 11.4477 3.44772 11 4 11L11 11L11 4C11 3.44772 11.4477 3 12 3Z",fill:"currentColor"})}),xRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M12 6C12.5523 6 13 6.44772 13 7V11H17C17.5523 11 18 11.4477 18 12C18 12.5523 17.5523 13 17 13H13V17C13 17.5523 12.5523 18 12 18C11.4477 18 11 17.5523 11 17V13H7C6.44772 13 6 12.5523 6 12C6 11.4477 6.44772 11 7 11H11V7C11 6.44772 11.4477 6 12 6Z",fill:"currentColor"})}),vRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.875 4.5C7.35418 4.5 4.5 7.35418 4.5 10.875C4.5 14.3958 7.35418 17.25 10.875 17.25C14.3958 17.25 17.25 14.3958 17.25 10.875C17.25 7.35418 14.3958 4.5 10.875 4.5ZM2.5 10.875C2.5 6.24962 6.24962 2.5 10.875 2.5C15.5004 2.5 19.25 6.24962 19.25 10.875C19.25 12.8273 18.582 14.6236 17.462 16.0478L21.2071 19.7929C21.5976 20.1834 21.5976 20.8166 21.2071 21.2071C20.8166 21.5976 20.1834 21.5976 19.7929 21.2071L16.0478 17.462C14.6236 18.582 12.8273 19.25 10.875 19.25C6.24962 19.25 2.5 15.5004 2.5 10.875Z",fill:"currentColor"})}),wRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M11.2929 3.29289C11.6834 2.90237 12.3166 2.90237 12.7071 3.29289L16.7071 7.29289C17.0976 7.68342 17.0976 8.31658 16.7071 8.70711C16.3166 9.09763 15.6834 9.09763 15.2929 8.70711L13 6.41421V15C13 15.5523 12.5523 16 12 16C11.4477 16 11 15.5523 11 15V6.41421L8.70711 8.70711C8.31658 9.09763 7.68342 9.09763 7.29289 8.70711C6.90237 8.31658 6.90237 7.68342 7.29289 7.29289L11.2929 3.29289ZM4 14C4.55229 14 5 14.4477 5 15V15.2C5 16.0566 5.00078 16.6389 5.03755 17.089C5.07337 17.5274 5.1383 17.7516 5.21799 17.908C5.40973 18.2843 5.7157 18.5903 6.09202 18.782C6.24842 18.8617 6.47262 18.9266 6.91104 18.9624C7.36113 18.9992 7.94342 19 8.8 19H15.2C16.0566 19 16.6389 18.9992 17.089 18.9624C17.5274 18.9266 17.7516 18.8617 17.908 18.782C18.2843 18.5903 18.5903 18.2843 18.782 17.908C18.8617 17.7516 18.9266 17.5274 18.9624 17.089C18.9992 16.6389 19 16.0566 19 15.2V15C19 14.4477 19.4477 14 20 14C20.5523 14 21 14.4477 21 15V15.2413C21 16.0463 21 16.7106 20.9558 17.2518C20.9099 17.8139 20.8113 18.3306 20.564 18.816C20.1805 19.5686 19.5686 20.1805 18.816 20.564C18.3306 20.8113 17.8139 20.9099 17.2518 20.9558C16.7106 21 16.0463 21 15.2413 21H8.75868C7.95372 21 7.28936 21 6.74817 20.9558C6.18608 20.9099 5.66937 20.8113 5.18404 20.564C4.43139 20.1805 3.81947 19.5686 3.43597 18.816C3.18868 18.3306 3.09012 17.8139 3.04419 17.2518C2.99998 16.7106 2.99999 16.0463 3 15.2413L3 15C3 14.4477 3.44772 14 4 14Z",fill:"currentColor"})}),SRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M6 8C6 6.89543 6.89543 6 8 6H16C17.1046 6 18 6.89543 18 8V16C18 17.1046 17.1046 18 16 18H8C6.89543 18 6 17.1046 6 16V8Z",fill:"currentColor"})}),ERe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M14.5 4a5.5 5.5 0 0 0-5.078 7.616 1 1 0 0 1-.216 1.092l-4.749 4.75a1.475 1.475 0 0 0 2.086 2.085l4.749-4.749a1 1 0 0 1 1.092-.216A5.5 5.5 0 0 0 20 9.414l-1.293 1.293a3.828 3.828 0 1 1-5.414-5.414L14.585 4H14.5ZM7 9.5a7.5 7.5 0 0 1 9.969-7.084 1 1 0 0 1 .378 1.651l-2.64 2.64a1.829 1.829 0 0 0 2.586 2.586l2.64-2.64a1 1 0 0 1 1.651.378 7.5 7.5 0 0 1-9.328 9.627l-4.299 4.3a3.475 3.475 0 0 1-4.914-4.915l4.299-4.299A7.497 7.497 0 0 1 7 9.5Z"})}),B_=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M8.99805 16.796C8.99805 15.4164 7.87961 14.2979 6.5 14.2979C5.12039 14.2979 4.00195 15.4164 4.00195 16.796C4.00196 18.1756 5.1204 19.294 6.5 19.294C7.8796 19.294 8.99804 18.1756 8.99805 16.796ZM19.748 15.0479C19.748 14.7729 19.525 14.5499 19.25 14.5499H15.75C15.475 14.5499 15.252 14.7729 15.252 15.0479V18.5479C15.252 18.823 15.475 19.046 15.75 19.046H19.25C19.525 19.046 19.748 18.823 19.748 18.5479V15.0479ZM10.0469 3.45125C11.077 2.15921 13.0849 2.20276 14.0498 3.58113L16.4189 6.96492L16.5205 7.12215C17.5046 8.76341 16.3301 10.9023 14.3691 10.9024H9.63086C7.60676 10.9023 6.42029 8.62316 7.58105 6.96492L9.9502 3.58113L10.0469 3.45125ZM12.4082 4.73055C12.2223 4.46497 11.842 4.44826 11.6318 4.68074L11.5918 4.73055L9.22266 8.11433C8.99176 8.44435 9.22808 8.89744 9.63086 8.89754H14.3691C14.7468 8.89745 14.9774 8.49957 14.8145 8.17781L14.7773 8.11433L12.4082 4.73055ZM11.002 16.796C11.0019 19.2824 8.98638 21.2979 6.5 21.2979C4.01362 21.2979 1.99806 19.2824 1.99805 16.796C1.99805 14.3096 4.01361 12.294 6.5 12.294C8.98639 12.294 11.002 14.3096 11.002 16.796ZM21.752 18.5479C21.752 19.9297 20.6318 21.0499 19.25 21.0499H15.75C14.3682 21.0499 13.248 19.9297 13.248 18.5479V15.0479C13.2481 13.6662 14.3682 12.546 15.75 12.546H19.25C20.6318 12.546 21.7519 13.6662 21.752 15.0479V18.5479Z",fill:"currentColor"})}),kRe=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.5555 4C10.099 4 9.70052 4.30906 9.58693 4.75114L9.29382 5.8919H14.715L14.4219 4.75114C14.3083 4.30906 13.9098 4 13.4533 4H10.5555ZM16.7799 5.8919L16.3589 4.25342C16.0182 2.92719 14.8226 2 13.4533 2H10.5555C9.18616 2 7.99062 2.92719 7.64985 4.25342L7.22886 5.8919H4C3.44772 5.8919 3 6.33961 3 6.8919C3 7.44418 3.44772 7.8919 4 7.8919H4.10069L5.31544 19.3172C5.47763 20.8427 6.76455 22 8.29863 22H15.7014C17.2354 22 18.5224 20.8427 18.6846 19.3172L19.8993 7.8919H20C20.5523 7.8919 21 7.44418 21 6.8919C21 6.33961 20.5523 5.8919 20 5.8919H16.7799ZM17.888 7.8919H6.11196L7.30423 19.1057C7.3583 19.6142 7.78727 20 8.29863 20H15.7014C16.2127 20 16.6417 19.6142 16.6958 19.1057L17.888 7.8919ZM10 10C10.5523 10 11 10.4477 11 11V16C11 16.5523 10.5523 17 10 17C9.44772 17 9 16.5523 9 16V11C9 10.4477 9.44772 10 10 10ZM14 10C14.5523 10 15 10.4477 15 11V16C15 16.5523 14.5523 17 14 17C13.4477 17 13 16.5523 13 16V11C13 10.4477 13.4477 10 14 10Z"})}),_Re=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M7.5 5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5ZM3 7.5a4.5 4.5 0 1 1 9 0 4.5 4.5 0 0 1-9 0ZM17 6a2 2 0 1 0 0 4 2 2 0 0 0 0-4Zm-4 2a4 4 0 1 1 8 0 4 4 0 0 1-8 0Zm-8.96 8.247C3.137 17.048 2.5 18.271 2.5 20a1 1 0 1 1-2 0c0-2.271.862-4.049 2.21-5.248C4.042 13.57 5.788 13 7.5 13s3.459.57 4.79 1.752c1.348 1.2 2.21 2.977 2.21 5.248a1 1 0 1 1-2 0c0-1.729-.638-2.952-1.54-3.753C10.042 15.43 8.788 15 7.5 15s-2.541.43-3.46 1.247Zm15.757-.607c-1.009-.638-2.338-.807-3.526-.472a1 1 0 0 1-.542-1.925c1.695-.478 3.616-.255 5.136.706 1.558.984 2.635 2.707 2.635 5.051a1 1 0 1 1-2 0c0-1.665-.732-2.746-1.703-3.36Z",clipRule:"evenodd"})}),Aae=e=>o.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:[o.jsx("path",{d:"M10.42 2.006a4 4 0 0 1 3.159 0c.674.29 1.188.822 1.667 1.456.474.627 1 1.473 1.653 2.523l3.542 5.696c.72 1.16 1.3 2.09 1.682 2.854.384.766.654 1.517.59 2.292a4 4 0 0 1-1.604 2.886c-.625.463-1.405.63-2.258.709-.85.078-1.945.078-3.311.078H8.46c-1.366 0-2.46 0-3.31-.078-.854-.078-1.634-.246-2.26-.71a4 4 0 0 1-1.603-2.885c-.064-.775.206-1.526.59-2.292.383-.764.961-1.694 1.682-2.854l3.542-5.696c.653-1.05 1.18-1.896 1.653-2.523.48-.634.993-1.166 1.667-1.456Zm2.37 1.838a2 2 0 0 0-1.58 0c-.192.083-.448.28-.86.825-.413.544-.891 1.312-1.577 2.415l-3.488 5.61c-.755 1.214-1.283 2.066-1.62 2.737-.34.678-.402 1.02-.385 1.232a2 2 0 0 0 .802 1.443c.171.127.494.255 1.25.324.748.069 1.75.07 3.18.07h6.976c1.43 0 2.432-.001 3.18-.07.756-.069 1.079-.197 1.25-.324a2 2 0 0 0 .802-1.443c.017-.212-.045-.554-.385-1.232-.337-.671-.865-1.523-1.62-2.737l-3.488-5.61c-.686-1.103-1.164-1.87-1.576-2.415-.413-.546-.67-.742-.861-.825"}),o.jsx("path",{d:"M12 7.5a1 1 0 0 1 1 1v3a1 1 0 1 1-2 0v-3a1 1 0 0 1 1-1M10.851 15a1.15 1.15 0 1 1 2.3 0 1.15 1.15 0 0 1-2.3 0"})]}),e9=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{fillRule:"evenodd",d:"M5.636 5.636a1 1 0 0 1 1.414 0l4.95 4.95 4.95-4.95a1 1 0 0 1 1.414 1.414L13.414 12l4.95 4.95a1 1 0 0 1-1.414 1.414L12 13.414l-4.95 4.95a1 1 0 0 1-1.414-1.414l4.95-4.95-4.95-4.95a1 1 0 0 1 0-1.414Z",clipRule:"evenodd"})});/** * @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 CRe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Nae=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/** + */const TRe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Nae=(...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 ARe={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 CRe={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 NRe=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:a,...l},c)=>p.createElement("svg",{ref:c,...ARe,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Nae("lucide",i),...l},[...a.map(([u,d])=>p.createElement(u,d)),...Array.isArray(s)?s:[s]]));/** + */const ARe=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:a,...l},c)=>p.createElement("svg",{ref:c,...CRe,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Nae("lucide",i),...l},[...a.map(([u,d])=>p.createElement(u,d)),...Array.isArray(s)?s:[s]]));/** * @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 Yt=(e,t)=>{const n=p.forwardRef(({className:r,...i},s)=>p.createElement(NRe,{ref:s,iconNode:t,className:Nae(`lucide-${CRe(e)}`,r),...i}));return n.displayName=`${e}`,n};/** + */const Gt=(e,t)=>{const n=p.forwardRef(({className:r,...i},s)=>p.createElement(ARe,{ref:s,iconNode:t,className:Nae(`lucide-${TRe(e)}`,r),...i}));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 jae=Yt("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** + */const jae=Gt("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 jRe=Yt("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 NRe=Gt("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 wv=Yt("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** + */const Sv=Gt("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 RRe=Yt("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** + */const jRe=Gt("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 Rae=Yt("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 Rae=Gt("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 Iae=Yt("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 Iae=Gt("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 IRe=Yt("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/** + */const RRe=Gt("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/** * @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 DRe=Yt("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 IRe=Gt("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 Eu=Yt("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + */const _u=Gt("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** * @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 PRe=Yt("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + */const DRe=Gt("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 MRe=Yt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** + */const PRe=Gt("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. * See the LICENSE file in the root directory of this source tree. - */const VS=Yt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + */const qS=Gt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @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 Dae=Yt("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 Dae=Gt("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 LRe=Yt("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + */const MRe=Gt("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 MM=Yt("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 MM=Gt("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 $Re=Yt("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** + */const LRe=Gt("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @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 BRe=Yt("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 $Re=Gt("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 AN=Yt("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 AN=Gt("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 QRe=Yt("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/** + */const BRe=Gt("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 URe=Yt("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 QRe=Gt("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 $_=Yt("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 Q_=Gt("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 NN=Yt("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 NN=Gt("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 yH=Yt("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 yH=Gt("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 Dg=Yt("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 Dg=Gt("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 FRe=Yt("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 URe=Gt("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 zRe=Yt("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 FRe=Gt("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 VRe=Yt("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 zRe=Gt("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 t9=Yt("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 t9=Gt("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 HRe=Yt("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 VRe=Gt("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 OH=Yt("FileUp",[["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 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]]);/** + */const OH=Gt("FileUp",[["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 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]]);/** * @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 Pae=Yt("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 Pae=Gt("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 qRe=Yt("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 HRe=Gt("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 XRe=Yt("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 qRe=Gt("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 n9=Yt("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 n9=Gt("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 GRe=Yt("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 XRe=Gt("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 WRe=Yt("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 GRe=Gt("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 YRe=Yt("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 WRe=Gt("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 jN=Yt("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 jN=Gt("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 r9=Yt("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 r9=Gt("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 wd=Yt("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 Ed=Gt("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 Mae=Yt("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 Mae=Gt("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 ZRe=Yt("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 YRe=Gt("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 lr=Yt("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** + */const or=Gt("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** * @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 KRe=Yt("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 ZRe=Gt("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 JRe=Yt("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 KRe=Gt("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 uy=Yt("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 uy=Gt("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 eIe=Yt("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** + */const JRe=Gt("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** * @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 Lae=Yt("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 Lae=Gt("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 tIe=Yt("MonitorPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);/** + */const eIe=Gt("MonitorPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);/** * @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 nIe=Yt("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 tIe=Gt("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 rIe=Yt("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** + */const nIe=Gt("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. * See the LICENSE file in the root directory of this source tree. - */const yo=Yt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + */const vo=Gt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** * @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 $ae=Yt("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 $ae=Gt("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 Bae=Yt("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 Bae=Gt("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 iIe=Yt("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 rIe=Gt("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 gC=Yt("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + */const bC=Gt("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 sIe=Yt("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 iIe=Gt("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 xH=Yt("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 xH=Gt("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 aIe=Yt("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/** + */const sIe=Gt("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/** * @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 xw=Yt("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 ww=Gt("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 oIe=Yt("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 aIe=Gt("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. * See the LICENSE file in the root directory of this source tree. - */const Up=Yt("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + */const Up=Gt("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** * @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 lIe=Yt("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 oIe=Gt("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 cIe=Yt("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 lIe=Gt("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 Oa=Yt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),vH="veadk_auth_qs",uIe=new Set(["view","source","sessionId","artifactSha256","validationReportSha256","projectId","versionId"]);let KO=null;function dIe(){if(KO!==null)return KO;const e=new URLSearchParams(window.location.search),t=new URLSearchParams,n=new URLSearchParams,r=e.get("view")==="runtime-deploy"&&e.get("source")==="intelligent-development";e.forEach((s,a)=>{(r&&uIe.has(a)?n:t).append(a,s)});const i=t.toString();if(i?(sessionStorage.setItem(vH,i),KO=i):KO=sessionStorage.getItem(vH)??"",i){const s=n.toString();window.history.replaceState(null,"",window.location.pathname+(s?`?${s}`:"")+window.location.hash)}return KO}function xo(e){const t=dIe();if(!t)return e;const n=new URL(e,window.location.origin);return new URLSearchParams(t).forEach((r,i)=>{n.searchParams.has(i)||n.searchParams.set(i,r)}),/^https?:\/\//i.test(e)?n.toString():n.pathname+n.search+n.hash}const _o=3e4,Zi=12e4,i9=1e4;function nl(e,t=_o){if(t<=0)return e??void 0;const n=AbortSignal.timeout(t);return e?AbortSignal.any([e,n]):n}const bC="veadk_local_user",yC="veadk_local_user_tab",fIe="X-VeADK-OAuth-Refresh-Retry",hIe=[50,250],pIe=/^[A-Za-z0-9]{1,16}$/;function Qae(){try{const e=sessionStorage.getItem(yC);if(e)return e;const t=localStorage.getItem(bC);return t&&sessionStorage.setItem(yC,t),t}catch{try{return localStorage.getItem(bC)}catch{return null}}}function wH(e){try{sessionStorage.setItem(yC,e)}catch{}try{localStorage.setItem(bC,e)}catch{}}function mIe(){try{sessionStorage.removeItem(yC)}catch{}try{localStorage.removeItem(bC)}catch{}}function fh(e){const t=new Headers(e),n=Qae();return n&&t.set("X-VeADK-Local-User",n),t}async function Uae(){let e;try{e=await fetch("/web/auth-config",{headers:{Accept:"application/json"},signal:nl(void 0,i9)})}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 gIe(e){const t=window.location.pathname+window.location.search+window.location.hash,n=e.includes("?")?"&":"?";window.location.assign(`${e}${n}redirect=${encodeURIComponent(t)}`)}function bIe(){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 yIe(){const[e,t]=await Promise.all([LM(),Uae()]);return e.status==="unauthenticated"&&t.length>0}function OIe(){window.location.assign("/oauth2/logout")}async function xIe(){for(let e=0;;e+=1){let t;try{t=await fetch("/oauth2/userinfo",{headers:{Accept:"application/json"},signal:nl(void 0,i9)})}catch(r){throw console.warn("[identity] /oauth2/userinfo is unreachable:",r),new Error("无法连接身份服务,请检查网络后重试。")}const n=hIe[e];if(t.status!==401||t.headers.get(fIe)!=="1"||n===void 0)return t;await new Promise(r=>window.setTimeout(r,n))}}async function LM(){const e=await xIe();if(e.ok){let n;try{n=await e.json()}catch(i){throw console.warn("[identity] /oauth2/userinfo returned a non-JSON response:",i),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=Qae();return t?{status:"authenticated",userId:t,info:{name:t},local:!0}:{status:"unauthenticated",userId:"",local:!0}}function vIe(e){if(!e)return"";for(const t of[e.name,e.preferred_username,e.username,e.email])if(typeof t=="string"&&t.trim())return t.trim();return""}function wIe(e){const t=e==null?void 0:e.picture;return typeof t=="string"?t.trim():""}const $M="veadk:authentication-required";let Sv=null,Ux=null;function SIe(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 EIe(e){Sv||(Sv=new Promise(n=>{Ux=n}),window.dispatchEvent(new Event($M)));const t=Sv;return e?e.aborted?Promise.reject(e.reason??new Error("Request aborted")):new Promise((n,r)=>{const i=()=>r(e.reason??new Error("Request aborted"));e.addEventListener("abort",i,{once:!0}),t.then(()=>{e.removeEventListener("abort",i),n()},s=>{e.removeEventListener("abort",i),r(s)})}):t}function kIe(){return Sv!==null}function _Ie(){Ux==null||Ux(),Ux=null,Sv=null}async function RN(e,t){var r;const n=await e.text().catch(()=>"");try{return JSON.parse(n)}catch{const i=((r=e.headers.get("content-type"))==null?void 0:r.split(";",1)[0])||"Content-Type 缺失",s=n.trim().slice(0,2e3),a=s?` -响应:${s}`:"";throw new Error(`${t}:服务端返回非 JSON 响应(HTTP ${e.status},${i})${a}`)}}const TIe=/\brun_sse\s*failed\s*:\s*404\b/i,CIe=/session not found/i,AIe=/(?:^|[::\s])not found\s*$/i,NIe=/Expecting (?:'[^']+'|\w+)(?: delimiter)?: line \d+ column \d+ \(char \d+\)/i,jIe=/Unknown or expired collection_id\s+'[^']+'\.\s*Call collect_resources first\./i,RIe="提示:会话已不存在。使用 in-memory 或 SQLite 短期记忆时,多实例、进程重启或滚动发布都可能导致会话丢失;建议改用基于数据库的持久化短期记忆存储。",IIe="提示:该 Runtime 未提供会话能力运行接口,可能是 Runtime 版本与当前 Studio 不兼容。",DIe="提示:模型生成的工具参数格式不完整,请重新发送一次。",PIe="提示:本次资源清单已失效,请重新发送任务;系统会重新收集资源后再创建 Agent。",MIe="提示:请检查共享公网出口等网络配置,然后重试。",SH="原始响应:";function JO(e,t){return e.includes(t)?e:`${e} + */const ba=Gt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),vH="veadk_auth_qs",cIe=new Set(["view","source","sessionId","artifactSha256","validationReportSha256","projectId","versionId"]);let KO=null;function uIe(){if(KO!==null)return KO;const e=new URLSearchParams(window.location.search),t=new URLSearchParams,n=new URLSearchParams,r=e.get("view")==="runtime-deploy"&&e.get("source")==="intelligent-development";e.forEach((s,a)=>{(r&&cIe.has(a)?n:t).append(a,s)});const i=t.toString();if(i?(sessionStorage.setItem(vH,i),KO=i):KO=sessionStorage.getItem(vH)??"",i){const s=n.toString();window.history.replaceState(null,"",window.location.pathname+(s?`?${s}`:"")+window.location.hash)}return KO}function So(e){const t=uIe();if(!t)return e;const n=new URL(e,window.location.origin);return new URLSearchParams(t).forEach((r,i)=>{n.searchParams.has(i)||n.searchParams.set(i,r)}),/^https?:\/\//i.test(e)?n.toString():n.pathname+n.search+n.hash}const Ao=3e4,Zi=12e4,i9=1e4;function tl(e,t=Ao){if(t<=0)return e??void 0;const n=AbortSignal.timeout(t);return e?AbortSignal.any([e,n]):n}const yC="veadk_local_user",OC="veadk_local_user_tab",dIe="X-VeADK-OAuth-Refresh-Retry",fIe=[50,250],hIe=/^[A-Za-z0-9]{1,16}$/;function Qae(){try{const e=sessionStorage.getItem(OC);if(e)return e;const t=localStorage.getItem(yC);return t&&sessionStorage.setItem(OC,t),t}catch{try{return localStorage.getItem(yC)}catch{return null}}}function wH(e){try{sessionStorage.setItem(OC,e)}catch{}try{localStorage.setItem(yC,e)}catch{}}function pIe(){try{sessionStorage.removeItem(OC)}catch{}try{localStorage.removeItem(yC)}catch{}}function fh(e){const t=new Headers(e),n=Qae();return n&&t.set("X-VeADK-Local-User",n),t}async function Uae(){let e;try{e=await fetch("/web/auth-config",{headers:{Accept:"application/json"},signal:tl(void 0,i9)})}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 mIe(e){const t=window.location.pathname+window.location.search+window.location.hash,n=e.includes("?")?"&":"?";window.location.assign(`${e}${n}redirect=${encodeURIComponent(t)}`)}function gIe(){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 bIe(){const[e,t]=await Promise.all([LM(),Uae()]);return e.status==="unauthenticated"&&t.length>0}function yIe(){window.location.assign("/oauth2/logout")}async function OIe(){for(let e=0;;e+=1){let t;try{t=await fetch("/oauth2/userinfo",{headers:{Accept:"application/json"},signal:tl(void 0,i9)})}catch(r){throw console.warn("[identity] /oauth2/userinfo is unreachable:",r),new Error("无法连接身份服务,请检查网络后重试。")}const n=fIe[e];if(t.status!==401||t.headers.get(dIe)!=="1"||n===void 0)return t;await new Promise(r=>window.setTimeout(r,n))}}async function LM(){const e=await OIe();if(e.ok){let n;try{n=await e.json()}catch(i){throw console.warn("[identity] /oauth2/userinfo returned a non-JSON response:",i),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=Qae();return t?{status:"authenticated",userId:t,info:{name:t},local:!0}:{status:"unauthenticated",userId:"",local:!0}}function xIe(e){if(!e)return"";for(const t of[e.name,e.preferred_username,e.username,e.email])if(typeof t=="string"&&t.trim())return t.trim();return""}function vIe(e){const t=e==null?void 0:e.picture;return typeof t=="string"?t.trim():""}const $M="veadk:authentication-required";let Ev=null,Ux=null;function wIe(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 SIe(e){Ev||(Ev=new Promise(n=>{Ux=n}),window.dispatchEvent(new Event($M)));const t=Ev;return e?e.aborted?Promise.reject(e.reason??new Error("Request aborted")):new Promise((n,r)=>{const i=()=>r(e.reason??new Error("Request aborted"));e.addEventListener("abort",i,{once:!0}),t.then(()=>{e.removeEventListener("abort",i),n()},s=>{e.removeEventListener("abort",i),r(s)})}):t}function EIe(){return Ev!==null}function kIe(){Ux==null||Ux(),Ux=null,Ev=null}async function RN(e,t){var r;const n=await e.text().catch(()=>"");try{return JSON.parse(n)}catch{const i=((r=e.headers.get("content-type"))==null?void 0:r.split(";",1)[0])||"Content-Type 缺失",s=n.trim().slice(0,2e3),a=s?` +响应:${s}`:"";throw new Error(`${t}:服务端返回非 JSON 响应(HTTP ${e.status},${i})${a}`)}}const _Ie=/\brun_sse\s*failed\s*:\s*404\b/i,TIe=/session not found/i,CIe=/(?:^|[::\s])not found\s*$/i,AIe=/Expecting (?:'[^']+'|\w+)(?: delimiter)?: line \d+ column \d+ \(char \d+\)/i,NIe=/Unknown or expired collection_id\s+'[^']+'\.\s*Call collect_resources first\./i,jIe="提示:会话已不存在。使用 in-memory 或 SQLite 短期记忆时,多实例、进程重启或滚动发布都可能导致会话丢失;建议改用基于数据库的持久化短期记忆存储。",RIe="提示:该 Runtime 未提供会话能力运行接口,可能是 Runtime 版本与当前 Studio 不兼容。",IIe="提示:模型生成的工具参数格式不完整,请重新发送一次。",DIe="提示:本次资源清单已失效,请重新发送任务;系统会重新收集资源后再创建 Agent。",PIe="提示:请检查共享公网出口等网络配置,然后重试。",SH="原始响应:";function JO(e,t){return e.includes(t)?e:`${e} -${t}`}function ff(e){const t=String(e);let n=t.includes(SH)?t:`${SH}${t}`;if(NIe.test(t))n=JO(n,DIe);else{if(jIe.test(t))return JO(n,PIe);TIe.test(t)&&(CIe.test(t)?n=JO(n,RIe):AIe.test(t)&&(n=JO(n,IIe)))}return JO(n,MIe)}async function*IN(e){if(!e.body)throw new Error("Response has no body");const t=e.body.getReader(),n=new TextDecoder;let r="";const i=a=>a.length>500?`${a.slice(0,500)}…(已截断,共 ${a.length} 个字符)`:a,s=(a,l=!1)=>{const c=a.split(/\r?\n/).filter(u=>u.startsWith("data:")).map(u=>u.slice(5).trimStart()).join(` -`);if(!(!c||c==="[DONE]"||c==="ping"))try{return JSON.parse(c)}catch{const u=i(c);throw l?new Error(`Stream ended with an incomplete SSE event. 原始 data:${u}`):new Error(`Failed to parse SSE event JSON. 原始 data:${u}`)}};try{for(;;){const{done:a,value:l}=await t.read();if(a)break;r+=n.decode(l,{stream:!0});let c=r.match(/\r?\n\r?\n/);for(;(c==null?void 0:c.index)!==void 0;){const u=r.slice(0,c.index);r=r.slice(c.index+c[0].length);const d=s(u);d!==void 0&&(yield d),c=r.match(/\r?\n\r?\n/)}}if(r+=n.decode(),r.trim()){const a=s(r,!0);a!==void 0&&(yield a)}}finally{try{await t.cancel()}catch{}finally{t.releaseLock()}}}const LIe="X-Studio-FaaS-Instance",$Ie="X-Studio-FaaS-Request-Id";function BIe(e,t,n){var s,a;const r=((s=e.headers.get(LIe))==null?void 0:s.trim())??"";if(!t||!n||!r)return null;const i=((a=e.headers.get($Ie))==null?void 0:a.trim())??"";return{runtimeId:t,region:n,instanceName:r,...i?{requestId:i}:{}}}function EH(e,t,n,r){const i=e==="byteplus"?"https://console.byteplus.com":"https://console.volcengine.com",s=new URLSearchParams({projectName:"default",runtimeId:n,instanceName:r});return`${i}/agentkit/region:agentkit+${encodeURIComponent(t)}/runtime?${s}`}function QIe(e){return/\b(?:ERROR|FATAL|CRITICAL)\b/i.test(e)?"error":/\bWARN(?:ING)?\b/i.test(e)?"warning":/\bDEBUG\b/i.test(e)?"debug":/\bINFO\b/i.test(e)?"info":"default"}function UIe(e){if(!e||typeof e!="object")return!1;const t=e;return t.type==="done"?!0:t.type==="context"?typeof t.instanceName=="string"&&typeof t.consoleUrl=="string":t.type==="logs"?typeof t.text=="string"&&typeof t.updatedAt=="number":t.type==="error"?typeof t.message=="string"&&(t.detail===void 0||typeof t.detail=="string")&&(t.statusCode===void 0||typeof t.statusCode=="string")&&(t.errorCode===void 0||typeof t.errorCode=="string")&&(t.requestId===void 0||typeof t.requestId=="string")&&(t.responseBody===void 0||typeof t.responseBody=="string"):!1}function Fae(e){var r;const t=[e.message],n=[e.statusCode?`HTTP 状态码:${e.statusCode}`:"",e.errorCode?`错误码:${e.errorCode}`:"",e.requestId?`Request ID:${e.requestId}`:""].filter(Boolean);return n.length>0&&t.push(n.join(` +${t}`}function ff(e){const t=String(e);let n=t.includes(SH)?t:`${SH}${t}`;if(AIe.test(t))n=JO(n,IIe);else{if(NIe.test(t))return JO(n,DIe);_Ie.test(t)&&(TIe.test(t)?n=JO(n,jIe):CIe.test(t)&&(n=JO(n,RIe)))}return JO(n,PIe)}async function*IN(e){if(!e.body)throw new Error("Response has no body");const t=e.body.getReader(),n=new TextDecoder;let r="";const i=a=>a.length>500?`${a.slice(0,500)}…(已截断,共 ${a.length} 个字符)`:a,s=(a,l=!1)=>{const c=a.split(/\r?\n/).filter(u=>u.startsWith("data:")).map(u=>u.slice(5).trimStart()).join(` +`);if(!(!c||c==="[DONE]"||c==="ping"))try{return JSON.parse(c)}catch{const u=i(c);throw l?new Error(`Stream ended with an incomplete SSE event. 原始 data:${u}`):new Error(`Failed to parse SSE event JSON. 原始 data:${u}`)}};try{for(;;){const{done:a,value:l}=await t.read();if(a)break;r+=n.decode(l,{stream:!0});let c=r.match(/\r?\n\r?\n/);for(;(c==null?void 0:c.index)!==void 0;){const u=r.slice(0,c.index);r=r.slice(c.index+c[0].length);const d=s(u);d!==void 0&&(yield d),c=r.match(/\r?\n\r?\n/)}}if(r+=n.decode(),r.trim()){const a=s(r,!0);a!==void 0&&(yield a)}}finally{try{await t.cancel()}catch{}finally{t.releaseLock()}}}const MIe="X-Studio-FaaS-Instance",LIe="X-Studio-FaaS-Request-Id";function $Ie(e,t,n){var s,a;const r=((s=e.headers.get(MIe))==null?void 0:s.trim())??"";if(!t||!n||!r)return null;const i=((a=e.headers.get(LIe))==null?void 0:a.trim())??"";return{runtimeId:t,region:n,instanceName:r,...i?{requestId:i}:{}}}function EH(e,t,n,r){const i=e==="byteplus"?"https://console.byteplus.com":"https://console.volcengine.com",s=new URLSearchParams({projectName:"default",runtimeId:n,instanceName:r});return`${i}/agentkit/region:agentkit+${encodeURIComponent(t)}/runtime?${s}`}function BIe(e){return/\b(?:ERROR|FATAL|CRITICAL)\b/i.test(e)?"error":/\bWARN(?:ING)?\b/i.test(e)?"warning":/\bDEBUG\b/i.test(e)?"debug":/\bINFO\b/i.test(e)?"info":"default"}function QIe(e){if(!e||typeof e!="object")return!1;const t=e;return t.type==="done"?!0:t.type==="context"?typeof t.instanceName=="string"&&typeof t.consoleUrl=="string":t.type==="logs"?typeof t.text=="string"&&typeof t.updatedAt=="number":t.type==="error"?typeof t.message=="string"&&(t.detail===void 0||typeof t.detail=="string")&&(t.statusCode===void 0||typeof t.statusCode=="string")&&(t.errorCode===void 0||typeof t.errorCode=="string")&&(t.requestId===void 0||typeof t.requestId=="string")&&(t.responseBody===void 0||typeof t.responseBody=="string"):!1}function Fae(e){var r;const t=[e.message],n=[e.statusCode?`HTTP 状态码:${e.statusCode}`:"",e.errorCode?`错误码:${e.errorCode}`:"",e.requestId?`Request ID:${e.requestId}`:""].filter(Boolean);return n.length>0&&t.push(n.join(` `)),e.detail&&e.detail!==e.message&&t.push(e.detail),e.responseBody&&!((r=e.detail)!=null&&r.includes(e.responseBody))&&t.push(`云端响应正文: ${e.responseBody}`),t.join(` -`)}async function FIe(e){const t=`HTTP ${e.status}${e.statusText?` ${e.statusText}`:""}`,n=await e.text();if(!n)return t;try{const r=JSON.parse(n);if(typeof r.detail=="string"&&r.detail)return`${t} +`)}async function UIe(e){const t=`HTTP ${e.status}${e.statusText?` ${e.statusText}`:""}`,n=await e.text();if(!n)return t;try{const r=JSON.parse(n);if(typeof r.detail=="string"&&r.detail)return`${t} ${r.detail}`;if(r.detail&&typeof r.detail=="object"){const i=r.detail;if(typeof i.message=="string")return Fae({message:i.message,...typeof i.detail=="string"?{detail:i.detail}:{},...typeof i.statusCode=="string"?{statusCode:i.statusCode}:{},...typeof i.errorCode=="string"?{errorCode:i.errorCode}:{},...typeof i.requestId=="string"?{requestId:i.requestId}:{},...typeof i.responseBody=="string"?{responseBody:i.responseBody}:{}})}return`${t} ${JSON.stringify(r,null,2)}`}catch{return`${t} -${n}`}}async function*zIe({runtimeId:e,region:t,instanceName:n,sessionId:r,follow:i=!0,signal:s}){const a=new URLSearchParams({region:t,follow:String(i)});n&&a.set("instance_name",n),r&&a.set("session_id",r);const l=await fetch(xo(`/web/runtime-logs/${encodeURIComponent(e)}/stream?${a.toString()}`),{headers:fh({Accept:"text/event-stream"}),cache:"no-store",signal:s});if(!l.ok)throw new Error(`读取实例日志失败:${await FIe(l)}`);for await(const c of IN(l)){if(!UIe(c))throw new Error("读取实例日志失败:服务返回格式无效");yield c}}const VIe=255,HIe=/[\p{L}\p{M}\p{N}\p{P}\p{Zs}]/u;function qIe(e){const t=e.normalize("NFKC").replace(/\s+/gu," ").trim(),n=new TextEncoder;let r=0,i="";for(const s of t){if(!HIe.test(s))continue;const a=n.encode(s).byteLength;if(r+a>VIe)break;i+=s,r+=a}return i.replace(/ +/g," ").trimEnd()}const BM="ap-southeast-1",s9="cn-beijing",XIe="https://ark.ap-southeast.bytepluses.com/api/v3",GIe="https://ark.cn-beijing.volces.com/api/v3/",WIe="https://console.byteplus.com/ark/region:ark+ap-southeast-1/openManagement",YIe="https://console.volcengine.com/ark/region:ark+cn-beijing/openManagement",ZIe="dola-seed-2-1-turbo-260628",KIe="doubao-seed-2-1-pro-260628",JIe="skylark-embedding-vision-250615",e5e="doubao-embedding-vision-250615",t5e="seed-2-0-lite-260228",n5e="doubao-seed-2-0-lite-260428",r5e="dola-seedream-5-0-pro-260628",i5e="doubao-seedream-5-0-260128",s5e="seededit-3-0-i2i-250628",a5e="doubao-seededit-3-0-i2i-250628",o5e="dreamina-seedance-2-0-260128",l5e="doubao-seedance-2-0-260128",zae=[{value:"cn-beijing",label:"华北 2(北京)"},{value:"cn-shanghai",label:"华东 2(上海)"}],Vae=[{value:BM,label:BM}];function Sd(e){return e==="byteplus"?Vae:zae}function Yr(e){var t;return((t=Sd(e)[0])==null?void 0:t.value)||s9}const c5e=new Set(["cn-beijing","cn-shanghai","ap-southeast-1"]);function HS(e){return typeof e=="string"&&c5e.has(e)}function Zf(e,t){var r;return((r=(t?Sd(t):[...zae,...Vae]).find(i=>i.value===e))==null?void 0:r.label)||e||"-"}function Kf(e){return e==="byteplus"?ZIe:KIe}function el(e){return e==="byteplus"?XIe:GIe}function u5e(e){return e==="byteplus"?WIe:YIe}function d5e(e){return e==="byteplus"?JIe:e5e}function f5e(e){return e==="byteplus"?t5e:n5e}function h5e(e){return e==="byteplus"?r5e:i5e}function p5e(e){return e==="byteplus"?s5e:a5e}function m5e(e){return e==="byteplus"?o5e:l5e}const a9="veadk.messageFeedback.v1";function o9(e,t,n,r){return[e,t,n,r].join(":")}function l9(){if(typeof window>"u")return{};try{const e=JSON.parse(localStorage.getItem(a9)??"{}");return e&&typeof e=="object"?e:{}}catch{return{}}}function g5e(e,t,n){if(typeof window>"u")return;const r=l9();r[e]={...r[e]??{},[`veadk_feedback:${t}`]:n},localStorage.setItem(a9,JSON.stringify(r))}function Hae(e){if(typeof window>"u")return;const t=o9(e.runtimeId,e.appName,e.userId,e.sessionId),n=l9(),r=n[t];if(r){for(const i of e.eventIds)delete r[`veadk_feedback:${i}`];Object.keys(r).length===0?delete n[t]:n[t]=r,localStorage.setItem(a9,JSON.stringify(n))}}const B_="",c9=new Map;function qae(e,t){c9.set(e,t)}function Xae(){c9.clear()}function Vl(e){const t=c9.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 wt(e,t={},n={},r=_o){const i=nl(t.signal,r),s=!!n.runtimeId&&String(t.method??"GET").toUpperCase()==="DELETE",a={...t,...s?{method:"POST"}:{},headers:fh(t.headers)},l=()=>{const d={...a,signal:i};if(n.runtimeId){const f=new URLSearchParams;n.region&&f.set("_runtime_region",n.region),n.retryProbe&&f.set("probe_retry","connect"),s&&f.set("_method","DELETE");const h=f.toString()?`${e.includes("?")?"&":"?"}${f.toString()}`:"";return fetch(xo(`${B_}/web/runtime-proxy/${n.runtimeId}${e}${h}`),d)}if(n.base){const f=new Headers(d.headers);return f.set("X-AgentKit-Base",n.base),n.apiKey&&f.set("X-AgentKit-Key",n.apiKey),fetch(xo(`${B_}/agentkit-proxy${e}`),{...d,headers:f})}return fetch(xo(`${B_}${e}`),d)},c=async d=>{if(SIe(d))return!0;if(d.status!==401)return!1;try{return await yIe()}catch{return!1}};let u=await l();for(;await c(u);)await EIe(i),u=await l();return u}function In(e,t={},n=_o){return wt(e,t,{},n)}function b5e(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("."):"",i=String(t.msg??"");return r?`${r}: ${i}`:i}return String(t)}).filter(Boolean).join(` -`):e&&typeof e=="object"?JSON.stringify(e):""}async function Zt(e,t){const n=`${t}(HTTP ${e.status})`,r=await e.text().catch(()=>"");if(!r)return n;try{const i=JSON.parse(r),s=b5e(i.detail??i.error);return s?`${n} +${n}`}}async function*FIe({runtimeId:e,region:t,instanceName:n,sessionId:r,follow:i=!0,signal:s}){const a=new URLSearchParams({region:t,follow:String(i)});n&&a.set("instance_name",n),r&&a.set("session_id",r);const l=await fetch(So(`/web/runtime-logs/${encodeURIComponent(e)}/stream?${a.toString()}`),{headers:fh({Accept:"text/event-stream"}),cache:"no-store",signal:s});if(!l.ok)throw new Error(`读取实例日志失败:${await UIe(l)}`);for await(const c of IN(l)){if(!QIe(c))throw new Error("读取实例日志失败:服务返回格式无效");yield c}}const zIe=255,VIe=/[\p{L}\p{M}\p{N}\p{P}\p{Zs}]/u;function HIe(e){const t=e.normalize("NFKC").replace(/\s+/gu," ").trim(),n=new TextEncoder;let r=0,i="";for(const s of t){if(!VIe.test(s))continue;const a=n.encode(s).byteLength;if(r+a>zIe)break;i+=s,r+=a}return i.replace(/ +/g," ").trimEnd()}const BM="ap-southeast-1",s9="cn-beijing",qIe="https://ark.ap-southeast.bytepluses.com/api/v3",XIe="https://ark.cn-beijing.volces.com/api/v3/",GIe="https://console.byteplus.com/ark/region:ark+ap-southeast-1/openManagement",WIe="https://console.volcengine.com/ark/region:ark+cn-beijing/openManagement",YIe="dola-seed-2-1-turbo-260628",ZIe="doubao-seed-2-1-pro-260628",KIe="skylark-embedding-vision-250615",JIe="doubao-embedding-vision-250615",e5e="seed-2-0-lite-260228",t5e="doubao-seed-2-0-lite-260428",n5e="dola-seedream-5-0-pro-260628",r5e="doubao-seedream-5-0-260128",i5e="seededit-3-0-i2i-250628",s5e="doubao-seededit-3-0-i2i-250628",a5e="dreamina-seedance-2-0-260128",o5e="doubao-seedance-2-0-260128",zae=[{value:"cn-beijing",label:"华北 2(北京)"},{value:"cn-shanghai",label:"华东 2(上海)"}],Vae=[{value:BM,label:BM}];function kd(e){return e==="byteplus"?Vae:zae}function Yr(e){var t;return((t=kd(e)[0])==null?void 0:t.value)||s9}const l5e=new Set(["cn-beijing","cn-shanghai","ap-southeast-1"]);function XS(e){return typeof e=="string"&&l5e.has(e)}function Zf(e,t){var r;return((r=(t?kd(t):[...zae,...Vae]).find(i=>i.value===e))==null?void 0:r.label)||e||"-"}function Kf(e){return e==="byteplus"?YIe:ZIe}function Jo(e){return e==="byteplus"?qIe:XIe}function c5e(e){return e==="byteplus"?GIe:WIe}function u5e(e){return e==="byteplus"?KIe:JIe}function d5e(e){return e==="byteplus"?e5e:t5e}function f5e(e){return e==="byteplus"?n5e:r5e}function h5e(e){return e==="byteplus"?i5e:s5e}function p5e(e){return e==="byteplus"?a5e:o5e}const a9="veadk.messageFeedback.v1";function o9(e,t,n,r){return[e,t,n,r].join(":")}function l9(){if(typeof window>"u")return{};try{const e=JSON.parse(localStorage.getItem(a9)??"{}");return e&&typeof e=="object"?e:{}}catch{return{}}}function m5e(e,t,n){if(typeof window>"u")return;const r=l9();r[e]={...r[e]??{},[`veadk_feedback:${t}`]:n},localStorage.setItem(a9,JSON.stringify(r))}function Hae(e){if(typeof window>"u")return;const t=o9(e.runtimeId,e.appName,e.userId,e.sessionId),n=l9(),r=n[t];if(r){for(const i of e.eventIds)delete r[`veadk_feedback:${i}`];Object.keys(r).length===0?delete n[t]:n[t]=r,localStorage.setItem(a9,JSON.stringify(n))}}const U_="",c9=new Map;function qae(e,t){c9.set(e,t)}function Xae(){c9.clear()}function Vl(e){const t=c9.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 St(e,t={},n={},r=Ao){const i=tl(t.signal,r),s=!!n.runtimeId&&String(t.method??"GET").toUpperCase()==="DELETE",a={...t,...s?{method:"POST"}:{},headers:fh(t.headers)},l=()=>{const d={...a,signal:i};if(n.runtimeId){const f=new URLSearchParams;n.region&&f.set("_runtime_region",n.region),n.retryProbe&&f.set("probe_retry","connect"),s&&f.set("_method","DELETE");const h=f.toString()?`${e.includes("?")?"&":"?"}${f.toString()}`:"";return fetch(So(`${U_}/web/runtime-proxy/${n.runtimeId}${e}${h}`),d)}if(n.base){const f=new Headers(d.headers);return f.set("X-AgentKit-Base",n.base),n.apiKey&&f.set("X-AgentKit-Key",n.apiKey),fetch(So(`${U_}/agentkit-proxy${e}`),{...d,headers:f})}return fetch(So(`${U_}${e}`),d)},c=async d=>{if(wIe(d))return!0;if(d.status!==401)return!1;try{return await bIe()}catch{return!1}};let u=await l();for(;await c(u);)await SIe(i),u=await l();return u}function Dn(e,t={},n=Ao){return St(e,t,{},n)}function g5e(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("."):"",i=String(t.msg??"");return r?`${r}: ${i}`:i}return String(t)}).filter(Boolean).join(` +`):e&&typeof e=="object"?JSON.stringify(e):""}async function Wt(e,t){const n=`${t}(HTTP ${e.status})`,r=await e.text().catch(()=>"");if(!r)return n;try{const i=JSON.parse(r),s=g5e(i.detail??i.error);return s?`${n} ${s} 原始响应: ${r}`:`${n} 原始响应: ${r}`}catch{return`${n} 原始响应: -${r}`}}async function u9(e,t=!1){const n=await wt(`/web/model-api-keys${t?"?refresh=true":""}`,{signal:e,cache:"no-store"});if(!n.ok)throw new Error(await Zt(n,"加载 Ark API Key 失败"));return await n.json()}async function Gae(e,t){const n=await wt(`/web/model-api-keys/${encodeURIComponent(e)}/value`,{method:"POST",signal:t,cache:"no-store"});if(!n.ok)throw new Error(await Zt(n,"加载 Ark API Key 失败"));return await n.json()}async function U1(e){const t=new URLSearchParams;e!=null&&e.apiKeyId&&t.set("apiKeyId",e.apiKeyId),e!=null&&e.refresh&&t.set("refresh","true");const n=t.toString(),r=await wt(`/web/model-options${n?`?${n}`:""}`,{signal:e==null?void 0:e.signal,cache:"no-store"});if(!r.ok)throw new Error(await Zt(r,"加载模型列表失败"));return await r.json()}async function Wae(){const e=await wt("/list-apps");if(!e.ok)throw new Error(`list-apps failed: ${e.status}`);return e.json()}class F1 extends Error{constructor(){super("当前账号无权访问该 Runtime,请刷新列表或重新登录后重试。"),this.name="RuntimeAccessDeniedError"}}class Es extends Error{constructor(t,n=!1,r=!1){super(t),this.unsupported=n,this.retryable=r,this.name="RuntimeProbeError"}}const Yae="Runtime 已部署成功,但当前 Studio 无法访问私网 Runtime。请使用已绑定相同 VPC 的 Studio 访问,或改用公网 / 公网+VPC 部署。",Zae="Runtime 已部署成功,但 Studio 暂时无法连接服务。网关域名可能仍在生效,或当前网络/DNS 无法访问该 Runtime,请稍后在智能体管理页重试连接。",kH=["cn-beijing","cn-shanghai"],y5e=3e4,z1=5*60*1e3,Kae=60*1e3;let vw="volcengine";const dy=new Map,Fm=new Map,zm=new Map,su=new Map,yi=new Map;function d9(e,t,n){return`${t}:${e}:${n??""}`}function Jae(e){e!==vw&&yi.clear(),vw=e}function qS(e){const t=(e||"").trim();if(vw==="byteplus")return[t&&!t.startsWith("cn-")?t:BM];const n=t&&!t.startsWith("ap-")?t:s9;return kH.includes(n)?[n,...kH.filter(r=>r!==n)]:[n]}function DN(e){const t=(e||"").trim();return t?[t]:qS()}function u0(...e){return e.map(t=>String(t??"")).join("")}function cm(e,t,n){const r=e.get(t);return r!=null&&r.value&&Date.now()-r.updatedAt<=n?r.value:null}function f9(e,t,n){return e.set(t,{value:n,updatedAt:Date.now()}),n}function zk(e,t){return t?t.aborted?Promise.reject(new DOMException("The operation was aborted.","AbortError")):new Promise((n,r)=>{const i=()=>{r(new DOMException("The operation was aborted.","AbortError"))};t.addEventListener("abort",i,{once:!0}),e.then(s=>{t.removeEventListener("abort",i),n(s)},s=>{t.removeEventListener("abort",i),r(s)})}):e}async function eoe(e){try{const t=await e.clone().json();return typeof t.detail=="string"?t.detail:""}catch{return""}}async function XS(e,t,n,r,i=_o){const s=await wt("/list-apps",{signal:r},n??{base:e,apiKey:t},i),a=n!=null&&n.runtimeId?await eoe(s):"";if(n!=null&&n.runtimeId&&a==="runtime_access_denied")throw new F1;if(n!=null&&n.runtimeId&&a==="runtime_private_endpoint_unreachable")throw new Es(Yae);if(n!=null&&n.runtimeId&&["runtime_proxy_connect_error","runtime_proxy_timeout","runtime_json_connect_error","runtime_json_timeout"].includes(a))throw new Es(Zae,!1,!0);if(n!=null&&n.runtimeId&&s.status===404)throw new Es("该 Runtime 的 Agent Server 未提供连接接口,请确认 Runtime 已就绪且版本兼容。",!0,!0);if(n!=null&&n.runtimeId&&(s.status===401||s.status===403))throw new Es("Runtime 服务拒绝了连接请求,请检查 Runtime 的鉴权配置。");if(!s.ok)throw new Error(await Zt(s,"读取 Agent 列表失败"));let l;try{l=await s.json()}catch{throw new Es("Runtime /list-apps 返回了无法解析的 JSON 响应。")}if(!Array.isArray(l)||l.some(u=>typeof u!="string"||!u.trim()))throw new Es("Runtime /list-apps 返回格式无效,应为非空字符串数组。");const c=l.map(u=>u.trim());return n!=null&&n.runtimeId&&dy.set(d9(n.runtimeId,n.region??"",n.runtimeVersion),{apps:c,expiresAt:Date.now()+y5e}),c}async function toe(e,t){const{app:n,ep:r}=Vl(e),i=await wt(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"},r);if(!i.ok){const a=`创建会话失败 (${i.status})`,l=await Zt(i,"创建会话失败");throw new Error(l===a?a:`${a}:${l}`)}return(await i.json()).id}async function h9(e,t){const{app:n,ep:r}=Vl(e),i=await wt(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{},r);if(!i.ok)throw new Error(`list sessions failed: ${i.status}`);return i.json()}async function PN(e,t,n){const{app:r,ep:i}=Vl(e),s=await wt(`/apps/${r}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}`,{},i);if(!s.ok){const l=await Zt(s,"读取会话失败");throw new Error(`get session failed: ${s.status}:${l}`)}const a=await s.json();if(i.runtimeId){const l=o9(i.runtimeId,r,t,n);a.state={...l9()[l]??{},...a.state??{}}}return a}async function noe(e){const{app:t,ep:n}=Vl(e.appName);if(!n.runtimeId)throw new Error("只有连接到 AgentKit Runtime 的会话支持反馈回流");if(!n.region)throw new Error("Runtime 缺少地域信息,无法提交反馈");const r=await wt("/web/evaluation/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:n.runtimeId,region:n.region,appName:t,userId:e.userId,sessionId:e.sessionId,eventId:e.eventId,rating:e.rating,comment:e.comment??""})},{},Zi);if(!r.ok)throw new Error(await Zt(r,"提交反馈失败"));const i=await r.json(),s=o9(n.runtimeId,t,e.userId,e.sessionId);return g5e(s,e.eventId,i),i}async function MN(e,t={}){const n=u0(e.runtimeId,e.region||"cn-beijing",e.appName,e.pageSize??100),r=cm(su,n,Kae);if(!t.force&&r)return r;const i=su.get(n);if(!t.force&&(i!=null&&i.promise))return i.promise;let s=null;const a=(async()=>{for(const l of DN(e.region)){const c=new URLSearchParams({runtimeId:e.runtimeId,region:l,appName:e.appName,page_size:String(e.pageSize??100)}),u=await wt(`/web/evaluation/feedback-cases?${c.toString()}`);if(u.ok)return f9(su,n,await u.json());s=new Error(await Zt(u,"读取评测集失败"))}throw s??new Error("读取评测集失败")})();su.set(n,{...i,promise:a,updatedAt:(i==null?void 0:i.updatedAt)??0});try{return await a}finally{const l=su.get(n);(l==null?void 0:l.promise)===a&&su.set(n,{value:l.value,updatedAt:l.updatedAt})}}async function QM(e){let t=null;for(const n of DN(e.region)){const r=new URLSearchParams({runtimeId:e.runtimeId,region:n,appName:e.appName,userId:e.userId}),i=await wt(`/web/evaluation/statuses?${r.toString()}`);if(i.ok)return i.json();t=new Error(await Zt(i,"读取自动评测状态失败"))}throw t??new Error("读取自动评测状态失败")}async function roe(e){let t=null;for(const n of DN(e.region)){const r=new URLSearchParams({runtimeId:e.runtimeId,region:n,appName:e.appName}),i=await wt(`/web/evaluation/optimizations?${r.toString()}`);if(i.ok)return i.json();t=new Error(await Zt(i,"读取优化项失败"))}throw t??new Error("读取优化项失败")}function ioe(e){return cm(su,u0(e.runtimeId,e.region||"cn-beijing",e.appName,e.pageSize??100),Kae)}function O5e(e){MN(e).catch(()=>{})}function soe(e){MN(e,{force:!0}).catch(()=>{})}function aoe(e,t){return["good","bad"].map(n=>{const r=e.find(i=>i.kind===n);return{kind:n,evaluationSetId:(r==null?void 0:r.evaluationSetId)??null,evaluationSetName:(r==null?void 0:r.evaluationSetName)??null,workspaceId:(r==null?void 0:r.workspaceId)??null,itemCount:t.filter(i=>i.kind===n).length}})}function Q_(e){const t=e.comment??"",n=e.rating==="bad"&&!!t.trim();for(const[r,i]of su.entries()){const s=i.value;if(!s||s.runtimeId!==e.runtimeId||s.agentName!==e.appName)continue;const a=s.items.filter(c=>c.sessionId!==e.sessionId||c.messageId!==e.messageId),l=e.rating?[{id:`local:${e.runtimeId}:${e.sessionId}:${e.messageId}`,itemKey:`local:${e.messageId}`,kind:e.rating,input:e.input,output:e.output,referenceOutput:e.referenceOutput??e.output,comment:t,agentName:e.appName,sessionId:e.sessionId,messageId:e.messageId,runtimeId:e.runtimeId,invocationId:e.invocationId??"",userId:e.userId,createdAt:e.createdAt??new Date().toISOString(),evaluationSetId:"",evaluationSetName:"",workspaceId:"",source:"user",score:n?0:null,reason:n?t:""},...a]:a;su.set(r,{value:{...s,sets:aoe(s.sets,l),items:l},updatedAt:Date.now(),promise:i.promise})}}async function ooe(e){let t=null;for(const n of DN(e.region)){const r=await wt("/web/evaluation/feedback-cases/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e.runtimeId,region:n,appName:e.appName,itemIds:e.itemIds})},{},Zi);if(r.ok){const i=await r.json(),s=new Set(e.itemIds);for(const[a,l]of su.entries()){const c=l.value;if(!c||c.runtimeId!==e.runtimeId||c.agentName!==e.appName)continue;const u=c.items.filter(d=>!s.has(d.id));su.set(a,{value:{...c,sets:aoe(c.sets,u),items:u},updatedAt:Date.now()})}return i}t=new Error(await Zt(r,"删除评测案例失败"))}throw t??new Error("删除评测案例失败")}async function UM(e,t,n){const{app:r,ep:i}=Vl(e),s=await wt(`/apps/${r}/users/${encodeURIComponent(t)}/sessions/${n}`,{method:"DELETE"},i);if(!s.ok&&s.status!==404)throw new Error(`delete session failed: ${s.status}`)}function x5e(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"="),r=window.atob(n),i=new Uint8Array(r.length);for(let s=0;sURL.revokeObjectURL(l),0)}async function loe(e,t,n,r,i){const{app:s,ep:a}=Vl(e),l=i==null?"":`?version=${encodeURIComponent(i)}`,c=`/apps/${encodeURIComponent(s)}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}/artifacts/${encodeURIComponent(r)}${l}`,u=await wt(c,{},a,Zi);if(!u.ok)throw new Error(await Zt(u,"下载文件失败"));const d=await u.json(),f=d.inlineData??d.inline_data;if(!(f!=null&&f.data))throw new Error("文件内容不可用");const h=x5e(f.data),m=h.buffer.slice(h.byteOffset,h.byteOffset+h.byteLength);return{blob:new Blob([m],{type:f.mimeType??f.mime_type??"application/octet-stream"}),downloadName:f.displayName??f.display_name??r}}async function m9(e,t,n,r,i){const{blob:s}=await loe(e,t,n,r,i);return URL.createObjectURL(s)}async function v5e(e){const t=await wt("/web/media/capabilities");if(!t.ok)throw new Error(await Zt(t,"media capabilities failed"));return t.json()}async function coe(e,t,n,r){const{app:i}=Vl(e),s=new FormData;s.set("app_name",i),s.set("user_id",t),s.set("session_id",n),s.set("file",r);const a=await wt("/web/media",{method:"POST",body:s},{},Zi);if(!a.ok)throw new Error(await Zt(a,"文件上传失败"));return{...await a.json(),status:"ready"}}async function FM(e,t,n){const{app:r}=Vl(e),i=`/web/media/${encodeURIComponent(r)}/${encodeURIComponent(t)}/${encodeURIComponent(n)}/delete`,s=await wt(i,{method:"POST"});if(!s.ok&&s.status!==404)throw new Error(await Zt(s,"media cleanup failed"))}function uoe(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,i)=>![1,3,5].includes(i)).join("/")}`}catch{return}}async function U_(e,t){const n=uoe(t);if(!n)throw new Error("Invalid VeADK media URI");const r=await wt(`${n}/delete`,{method:"POST"});if(!r.ok&&r.status!==404)throw new Error(await Zt(r,"media cleanup failed"))}function doe(e,t){if(t.startsWith("data:")||t.startsWith("blob:")||/^https?:/.test(t))return t;const n=uoe(t);if(!n)return t;const r=`${n}/content`;return xo(`${B_}${r}`)}async function OC(e,t,n){const{app:r,ep:i}=Vl(e);let s;if(i.runtimeId){const c=new URLSearchParams({runtimeId:i.runtimeId,sessionId:t,region:i.region??"cn-beijing"});if(n&&c.set("endTimeMs",String(Math.round(n))),s=await wt(`/web/runtime-trace?${c.toString()}`),s.status===404)throw new Error("该 Agent 暂未开启链路观测,请到控制台打开后使用。")}else s=await wt(`/dev/apps/${encodeURIComponent(r)}/debug/trace/session/${encodeURIComponent(t)}`,{},i);if(!s.ok)throw new Error(await Zt(s,"加载调用链路失败"));const a=s.headers.get("content-type")??"";if(!a.includes("application/json")){const c=a.split(";",1)[0]||"Content-Type 缺失";throw new Error(`trace failed: 服务端返回了非 JSON 响应(${c}),请检查 Studio API 代理配置`)}const l=await s.json();if(!Array.isArray(l))throw new Error("trace failed: 返回格式无效");return l}async function zM(e){const t=await wt("/web/issue-feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(await Zt(t,"问题反馈上报失败"));if((await t.json()).submitted!==!0)throw new Error("问题反馈上报失败:服务端未确认提交结果");return{submitted:!0}}async function foe(e,t,n=!0){const r=await wt(`/web/agent-info/${e}`,{},t);if(!r.ok)throw new Error(`agent-info failed: ${r.status}`);const i=await r.json();if(n&&!i.draft)try{const s=await wt(`/web/agent-draft/${e}`,{},t);if(s.ok){const a=await s.json();i.draft=a.draft}}catch{}return{appName:e,name:i.name??e,description:i.description??"",type:i.type,model:i.model??"",tools:i.tools??[],skillsPreviewSupported:Array.isArray(i.skills),skills:i.skills??[],subAgents:i.subAgents??[],components:i.components??[],searchSources:i.searchSources??[],graph:i.graph,draft:i.draft}}async function VM(e){const{app:t,ep:n}=Vl(e);return foe(t,n,!1)}async function w5e(e,t,n){let r=null;for(const i of qS(t)){const s={runtimeId:e,region:i};try{const a=d9(e,i),l=dy.get(a);l&&l.expiresAt<=Date.now()&&dy.delete(a);const c=dy.get(a),u=n||(c==null?void 0:c.apps[0])||(await XS("","",s))[0];if(!u)throw new Error("该 Runtime 未提供可预览的 Agent。");return foe(u,s)}catch(a){if(a instanceof F1||a instanceof Es&&!a.unsupported)throw a;r=a instanceof Error?a:new Error(String(a))}}throw r??new Error("该 Runtime 未提供可预览的 Agent。")}async function g9(e,t,n={},r={}){const i=typeof n=="string"?n:void 0,s=typeof n=="string"?r:n,a=u0(e,t||"cn-beijing",i??""),l=cm(Fm,a,z1);if(!s.force&&l)return l;const c=Fm.get(a);if(!s.force&&(c!=null&&c.promise))return c.promise;const u=w5e(e,t,i).then(d=>f9(Fm,a,d));Fm.set(a,{...c,promise:u,updatedAt:(c==null?void 0:c.updatedAt)??0});try{return await u}finally{const d=Fm.get(a);(d==null?void 0:d.promise)===u&&Fm.set(a,{value:d.value,updatedAt:d.updatedAt})}}function hoe(e,t,n=""){return cm(Fm,u0(e,t||"cn-beijing",n),z1)}function poe(e,t,n=""){g9(e,t,n).catch(()=>{})}async function moe(e,t,n,r){const{app:i,ep:s}=Vl(e),a=new URLSearchParams({source:t,app_name:i,q:n,user_id:r}),l=await wt(`/web/search?${a.toString()}`,{},s);if(!l.ok)throw new Error(await Zt(l,"Agent 检索失败"));return l.json()}async function goe(e,t){const{app:n}=Vl(e),r=await wt(`/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()}const boe=ff("HTTP 200,SSE 响应体为空。"),F_=ff("HTTP 200,SSE 响应中没有可展示的模型回复。"),S5e=3e4,Ky=ff("30 秒内未收到首个 SSE 事件。");function yoe(e){if(e!=null&&e.aborted)return{signal:e,clearDeadline:()=>{},cleanup:()=>{},timedOut:()=>!1};const t=new AbortController;let n=!1,r=!1;const i=()=>{r||(r=!0,clearTimeout(a))},s=()=>{t.signal.aborted||t.abort((e==null?void 0:e.reason)??new DOMException("Aborted","AbortError"))},a=setTimeout(()=>{r||t.signal.aborted||(n=!0,r=!0,t.abort(new Error(Ky)))},S5e);return e==null||e.addEventListener("abort",s,{once:!0}),{signal:t.signal,clearDeadline:i,cleanup:()=>{i(),e==null||e.removeEventListener("abort",s)},timedOut:()=>n}}async function*HM({appName:e,userId:t,sessionId:n,text:r,attachments:i=[],invocation:s,platformTools:a,environmentMounts:l,environmentMount:c,functionResponses:u=[],signal:d,onRuntimeContext:f}){const{app:h,ep:m}=Vl(e),g=i.flatMap(S=>S.status&&S.status!=="ready"?[]:S.uri?[{fileData:{mimeType:S.mimeType,fileUri:S.uri,displayName:S.name},partMetadata:{veadkMedia:{id:S.id,uri:S.uri,name:S.name,mimeType:S.mimeType,sizeBytes:S.sizeBytes}}}]:S.data?[{inlineData:{mimeType:S.mimeType,data:S.data,displayName:S.name}}]:[]),b=s&&(s.skills.length>0||s.targetAgent)?s:void 0,y=[...g,...u.map(S=>({functionResponse:{id:S.id,name:S.name,response:S.response}})),...r.trim()?[{text:r}]:[]];if(b&&y.length>0){const S=y[0],E=S.partMetadata;y[0]={...S,partMetadata:{...E,veadkInvocation:b}}}let O;const v=yoe(d);try{O=await wt("/run_sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({app_name:h,user_id:t,session_id:n,new_message:{role:"user",parts:y},streaming:!0,...a!==void 0?{platform_tools:[...a]}:{},...l!==void 0?{environment_mounts:[...l]}:c?{environment_mount:c}:{},custom_metadata:b?{veadkInvocation:b}:void 0}),signal:v.signal},m,0)}catch(S){throw v.cleanup(),v.timedOut()?new Error(Ky):d!=null&&d.aborted||(S==null?void 0:S.name)==="AbortError"?S:new Error(ff(S))}const x=BIe(O,m.runtimeId??"",m.region??"");if(x&&(f==null||f(x)),!O.ok){v.cleanup();const S=await Zt(O,"运行会话失败");throw new Error(ff(`run_sse failed: ${O.status}:${S}`))}let w=!1;try{for await(const S of IN(O)){w=!0,v.clearDeadline();const E=S;typeof E.error=="string"&&(E.error=ff(E.error)),typeof E.errorMessage=="string"&&(E.errorMessage=ff(E.errorMessage)),typeof E.error_message=="string"&&(E.error_message=ff(E.error_message)),yield E}}catch(S){throw v.timedOut()?new Error(Ky):d!=null&&d.aborted||(S==null?void 0:S.name)==="AbortError"?S:new Error(ff(S))}finally{v.cleanup()}if(!w)throw new Error(boe)}async function LN(e,t){const n=new URLSearchParams({name:e,region:t}),r=await wt(`/web/runtime-name-availability?${n.toString()}`,{cache:"no-store"});if(!r.ok)throw new Error(await Zt(r,"检查 Runtime 名称失败"));const i=await r.json();if(typeof i.available!="boolean")throw new Error("检查 Runtime 名称失败:服务返回格式错误");return{available:i.available}}async function Ooe(e,t){const n=new URLSearchParams({kind:e.kind,region:e.region});e.registry&&n.set("registry",e.registry),e.namespace&&n.set("namespace",e.namespace),e.workspaceId&&n.set("workspaceId",e.workspaceId),e.search&&n.set("search",e.search),e.pageNumber&&n.set("pageNumber",String(e.pageNumber)),e.pageSize&&n.set("pageSize",String(e.pageSize));const r=await wt(`/web/deployment-resources?${n.toString()}`,{signal:t});if(!r.ok)throw new Error(await Zt(r,"加载云资源失败"));const i=await r.json();if(typeof i.serviceRegion!="string"||!Array.isArray(i.items)||typeof i.pageNumber!="number"||typeof i.pageSize!="number"||typeof i.totalCount!="number"||typeof i.hasMore!="boolean")throw new Error("云资源列表响应格式无效");const s=i.items.map(a=>{if(!a||typeof a!="object"||typeof a.id!="string"||typeof a.name!="string"||typeof a.region!="string"||typeof a.status!="string")throw new Error("云资源列表响应格式无效");return a});return{serviceRegion:i.serviceRegion,items:s,pageNumber:i.pageNumber,pageSize:i.pageSize,totalCount:i.totalCount,hasMore:i.hasMore}}function b9(e){const t=new Set,n=[];for(const r of e.split(/[,,\n\r]+/)){const i=r.trim();!i||t.has(i)||(t.add(i),n.push(i))}return n}async function xoe(e,t=typeof navigator>"u"?void 0:navigator.clipboard){if(!(t!=null&&t.writeText))throw new Error("当前浏览器不支持写入剪贴板。");try{await t.writeText(e)}catch{throw new Error("无法写入剪贴板,请检查剪贴板权限。")}}const _H={codex:0,codex_snapshot:1,deepseek_harness:2,deepseek_harness_snapshot:3,openclaw:4,openclaw_snapshot:5,hermes:6,hermes_snapshot:7,dev:8};async function voe(e){var i;const t=await wt("/web/system-info",{signal:e});if(!t.ok)throw new Error(await Zt(t,"加载系统信息失败"));const n=await t.json();if(typeof((i=n.storage)==null?void 0:i.tosAddress)!="string"||!Array.isArray(n.sandboxTools))throw new Error("系统信息响应格式无效");const r=n.sandboxTools.map(s=>{if(!s||typeof s!="object"||typeof s.kind!="string"||typeof s.label!="string"||typeof s.toolId!="string"||typeof s.snapshot!="boolean"||typeof s.needsModelEnvUpdate!="boolean"||typeof s.canUpdateModelEnv!="boolean"||typeof s.modelEnvError!="string"||typeof s.modelEnvErrorCode!="string")throw new Error("系统信息响应格式无效");return s}).sort((s,a)=>(_H[s.kind]??Number.MAX_SAFE_INTEGER)-(_H[a.kind]??Number.MAX_SAFE_INTEGER));return{storage:{tosAddress:n.storage.tosAddress},sandboxTools:r}}const woe=new Set(["preparing","queued","building","scanning","available","failed"]);function y9(e){if(e===null)return null;if(!e||typeof e!="object")throw new Error("环境构建响应格式无效");const t=e;if(typeof t.versionId!="string"||!woe.has(t.status)||typeof t.image!="string"||typeof t.error!="string"||typeof t.createdAt!="string"||typeof t.updatedAt!="string"||t.resources!==null&&typeof t.resources!="object")throw new Error("环境构建响应格式无效");const n=Array.isArray(t.steps)?t.steps.map(r=>{if(!r||typeof r!="object"||typeof r.key!="string"||typeof r.label!="string"||!["pending","running","succeeded","failed"].includes(r.status)||r.startedAt!==null&&typeof r.startedAt!="string"||r.finishedAt!==null&&typeof r.finishedAt!="string")throw new Error("环境构建步骤响应格式无效");return r}):[];return{...t,toolId:typeof t.toolId=="string"?t.toolId:"",toolStatus:["creating","ready","failed"].includes(t.toolStatus)?t.toolStatus:"",runId:typeof t.runId=="string"?t.runId:"",currentStep:typeof t.currentStep=="string"?t.currentStep:"",sourceCommitSha:typeof t.sourceCommitSha=="string"?t.sourceCommitSha:"",steps:n,progressError:typeof t.progressError=="string"?t.progressError:"",logTail:typeof t.logTail=="string"?t.logTail:"",logTruncated:t.logTruncated===!0,logUpdatedAt:typeof t.logUpdatedAt=="string"?t.logUpdatedAt:null,logError:typeof t.logError=="string"?t.logError:""}}function E5e(e){if(!e||typeof e!="object")throw new Error("环境 Manifest 响应格式无效");const t=e;if(t.apiVersion!=="agentkit.studio/v1alpha1"||t.kind!=="Environment"||!t.metadata||typeof t.metadata.id!="string"||typeof t.metadata.name!="string"||typeof t.metadata.version!="string"||typeof t.metadata.description!="string"||!t.spec||typeof t.spec.image!="string"||!["ubuntu","aio-sandbox"].includes(t.spec.baseEnvironment)||typeof t.spec.baseImage!="string"||!["ubuntu-22.04","ubuntu-24.04"].includes(t.spec.operatingSystem)||!["python-3.10","python-3.12"].includes(t.spec.language)||t.spec.executionRuntime!=="veadk"||!Array.isArray(t.spec.packages)||!t.spec.packages.every(n=>typeof n=="string")||!Array.isArray(t.spec.capabilities)||!t.spec.capabilities.every(n=>typeof n=="string")||!Array.isArray(t.spec.skills)||!t.status||!woe.has(t.status.phase)||typeof t.status.createdAt!="string"||typeof t.status.updatedAt!="string")throw new Error("环境 Manifest 响应格式无效");return t}function Soe(e){if(e==null)return;if(!e||typeof e!="object")throw new Error("环境镜像仓库响应格式无效");const t=e;if(typeof t.region!="string"||typeof t.registry!="string"||typeof t.namespace!="string"||typeof t.repository!="string")throw new Error("环境镜像仓库响应格式无效");return t}function k5e(e){if(e==null)return;if(!e||typeof e!="object")throw new Error("环境代码仓库响应格式无效");const t=e;if(typeof t.repositoryUrl!="string"||t.ref!==void 0&&typeof t.ref!="string"||typeof t.dockerfilePath!="string")throw new Error("环境代码仓库响应格式无效");return t}function _5e(e){const t=Soe(e);if(!t)return;const n=e;if(typeof n.reference!="string")throw new Error("环境镜像来源响应格式无效");return{...t,reference:n.reference}}function O9(e){if(!e||typeof e!="object")throw new Error("环境响应格式无效");const t=e;if(typeof t.id!="string"||typeof t.name!="string"||typeof t.description!="string"||t.baseEnvironment!==void 0&&t.baseEnvironment!=="ubuntu"&&t.baseEnvironment!=="aio-sandbox"||t.operatingSystem!=="ubuntu-22.04"&&t.operatingSystem!=="ubuntu-24.04"||t.language!=="python-3.10"&&t.language!=="python-3.12"||!Array.isArray(t.optionIds)||!t.optionIds.every(n=>typeof n=="string")||t.selectedSkills!==void 0&&!Array.isArray(t.selectedSkills)||typeof t.dockerfile!="string"||typeof t.createdAt!="string"||typeof t.updatedAt!="string")throw new Error("环境响应格式无效");return{...t,baseEnvironment:t.baseEnvironment==="aio-sandbox"?"aio-sandbox":"ubuntu",selectedSkills:t.selectedSkills??[],gitSource:k5e(t.gitSource),containerRepository:Soe(t.containerRepository),imageSource:_5e(t.imageSource),latestVersion:y9(t.latestVersion)}}function Eoe(e){if(!e||typeof e!="object")throw new Error("工作区响应格式无效");const t=e;if(typeof t.id!="string"||typeof t.name!="string"||typeof t.description!="string"||!Array.isArray(t.environmentIds)||!t.environmentIds.every(n=>typeof n=="string")||typeof t.createdAt!="string"||typeof t.updatedAt!="string")throw new Error("工作区响应格式无效");return t}async function x9(e){const t=await wt("/web/workspaces",{signal:e});if(!t.ok)throw new Error(await Zt(t,"加载工作区失败"));const n=await t.json();if(!Array.isArray(n.items))throw new Error("工作区列表响应格式无效");return n.items.map(Eoe)}async function koe(e,t,n,r){const i=await wt(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(n),signal:r});if(!i.ok)throw new Error(await Zt(i,"保存工作区失败"));return Eoe(await i.json())}function _oe(e,t){return koe("/web/workspaces","POST",e,t)}function Toe(e,t,n){return koe(`/web/workspaces/${encodeURIComponent(e)}`,"PATCH",t,n)}async function Coe(e,t){const n=await wt(`/web/workspaces/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});if(!n.ok)throw new Error(await Zt(n,"删除工作区失败"))}async function GS(e){const t=await wt("/web/environments",{signal:e});if(!t.ok)throw new Error(await Zt(t,"加载环境失败"));const n=await t.json();if(!Array.isArray(n.items))throw new Error("环境列表响应格式无效");return n.items.map(O9)}async function Aoe(e,t){const n=await wt("/web/environment-repositories/inspect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});if(!n.ok)throw new Error(await Zt(n,"探查代码仓库失败"));const r=await n.json();if(typeof r.repositoryUrl!="string"||typeof r.ref!="string"||typeof r.commitSha!="string"||!Array.isArray(r.dockerfiles)||!r.dockerfiles.every(i=>typeof i=="string"))throw new Error("代码仓库探查响应格式无效");return r}async function Noe(e,t){const n=await wt(`/web/environments/${encodeURIComponent(e)}/share-code`,{method:"POST",signal:t});if(!n.ok)throw new Error(await Zt(n,"导出环境分享码失败"));const r=await n.json();if(typeof r.shareCode!="string"||typeof r.name!="string")throw new Error("环境分享码响应格式无效");return r}async function joe(e,t){const n=await wt("/web/environment-share-codes/inspect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({shareCodes:e}),signal:t});if(!n.ok)throw new Error(await Zt(n,"检测环境分享码失败"));const r=await n.json();if(!Array.isArray(r.items))throw new Error("环境分享码检测响应格式无效");return r.items.map(i=>{if(!i||typeof i!="object")throw new Error("环境分享码检测响应格式无效");const s=i,a=s.status==="valid"||s.valid===!0?"valid":s.status==="invalid"||s.valid===!1?"invalid":null;if(!Number.isInteger(s.index)||a===null||s.name!==void 0&&typeof s.name!="string"||s.error!==void 0&&typeof s.error!="string")throw new Error("环境分享码检测响应格式无效");return{index:s.index,status:a,name:s.name??"",error:s.error??""}})}async function Roe(e,t){const n=await wt("/web/environment-share-codes/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({shareCodes:e}),signal:t});if(!n.ok)throw new Error(await Zt(n,"导入环境分享码失败"));const r=await n.json();if(!Array.isArray(r.items))throw new Error("环境分享码导入响应格式无效");return r.items.map(i=>{if(!i||typeof i!="object")throw new Error("环境分享码导入响应格式无效");const s=i;if(!Number.isInteger(s.index)||!(s.status==="created"||s.status==="duplicate"||s.status==="failed")||s.name!==void 0&&typeof s.name!="string"||s.error!==void 0&&typeof s.error!="string")throw new Error("环境分享码导入响应格式无效");return{index:s.index,status:s.status,name:s.name??"",environment:s.environment===void 0||s.environment===null?void 0:O9(s.environment),error:s.error??""}})}async function Ioe(e,t,n,r){const i=await wt(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(n),signal:r});if(!i.ok)throw new Error(await Zt(i,"保存环境失败"));return O9(await i.json())}function Doe(e,t){return Ioe("/web/environments","POST",e,t)}function Poe(e,t,n){return Ioe(`/web/environments/${encodeURIComponent(e)}`,"PATCH",t,n)}async function Moe(e,t){const n=await wt(`/web/environments/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});if(!n.ok)throw new Error(await Zt(n,"删除环境失败"))}async function qM(e,t){const n=await wt(`/web/environments/${encodeURIComponent(e)}/build`,{method:"POST",signal:t});if(!n.ok)throw new Error(await Zt(n,"启动环境构建失败"));const r=y9(await n.json());if(!r)throw new Error("环境构建响应格式无效");return r}async function Loe(e,t,n={}){const r=n.includeLogs?"?includeLogs=true":"",i=await wt(`/web/environments/${encodeURIComponent(e)}/builds/${encodeURIComponent(t)}${r}`,{signal:n.signal});if(!i.ok)throw new Error(await Zt(i,"读取环境构建详情失败"));const s=y9(await i.json());if(!s)throw new Error("环境构建响应格式无效");return s}async function $oe(e,t,n){const r=await wt(`/web/environments/${encodeURIComponent(e)}/builds/${encodeURIComponent(t)}/manifest`,{signal:n});if(!r.ok)throw new Error(await Zt(r,"读取环境 Manifest 失败"));return E5e(await r.json())}function TH(e){if(!e||typeof e!="object")throw new Error("环境资源响应格式无效");const t=e;if(t.source!=="provided"&&t.source!=="managed"||typeof t.consoleUrl!="string")throw new Error("环境资源响应格式无效");return t}async function Boe(e){const t=await wt("/web/environment-resources",{signal:e});if(!t.ok)throw new Error(await Zt(t,"加载环境构建资源失败"));const n=await t.json();if(n.provider!=="volcengine"&&n.provider!=="byteplus"||typeof n.region!="string")throw new Error("环境资源响应格式无效");return{provider:n.provider,region:n.region,codePipeline:TH(n.codePipeline),containerRegistry:TH(n.containerRegistry)}}async function Qoe(e,t){const n=await wt(`/web/system-info/sandbox-tools/${encodeURIComponent(e)}/model-env`,{method:"POST",signal:t});if(!n.ok)throw new Error(await Zt(n,"更新 Codex Sandbox 失败"));const r=await n.json();if(r.kind!=="codex"&&r.kind!=="codex_snapshot"||typeof r.toolId!="string"||typeof r.updated!="boolean")throw new Error("Codex Sandbox 更新响应格式无效");return r}async function $N(e){const t=await wt("/web/identity/user-pools",{signal:e});if(!t.ok)throw new Error(await Zt(t,"加载用户池失败"));const n=await t.json();if(!Array.isArray(n.items))throw new Error("用户池列表响应格式无效");return n.items.map(r=>{if(!r||typeof r!="object"||typeof r.uid!="string"||typeof r.name!="string"||typeof r.domain!="string"||typeof r.region!="string"||typeof r.isCurrent!="boolean")throw new Error("用户池列表响应格式无效");return r})}const Ev=new Map;function T5e(e){if(typeof e=="string")return e?{message:e}:null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=typeof t.message=="string"?t.message:typeof t.error=="string"?t.error:"";return n?{message:n,phase:typeof t.phase=="string"?t.phase:void 0,runtimeId:typeof t.runtimeId=="string"?t.runtimeId:void 0,logPath:typeof t.logPath=="string"?t.logPath:void 0}:null}class kv extends Error{constructor(t){super(t.message),this.detail=t,this.name="GithubCicdPipelineError"}}async function hh(e){const t=await e.text().catch(()=>"");if(t)try{const n=JSON.parse(t),r=T5e(n.detail??n.error);if(r)return new kv(r)}catch{return new kv({message:t})}return new kv({message:`同步 GitHub 代码失败 (${e.status})`})}async function Uoe(e){const t=await wt("/web/github-delivery/source-sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.project,githubUrl:e.githubUrl,githubToken:e.githubToken,baseBranch:e.baseBranch,region:e.region,cloudProvider:e.cloudProvider})},{},0);if(!t.ok)throw await hh(t);return t.json()}async function Foe(e){const t=await wt("/web/github-delivery/cicd-pipeline",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({githubUrl:e.githubUrl,githubToken:e.githubToken,baseBranch:e.baseBranch,runtimeName:e.runtimeName,runtimeId:e.runtimeId,region:e.region,cloudProvider:e.cloudProvider,projectPath:e.projectPath??".",volcengineAccessKey:e.volcengineAccessKey,volcengineSecretKey:e.volcengineSecretKey,volcengineSessionToken:e.volcengineSessionToken??""})},{},0);if(!t.ok)throw await hh(t);return t.json()}async function zoe(e){const t=await wt("/web/github-delivery/init-main",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.project,githubUrl:e.githubUrl,githubToken:e.githubToken,baseBranch:e.baseBranch,runtimeName:e.runtimeName,runtimeId:e.runtimeId,region:e.region,cloudProvider:e.cloudProvider,projectPath:e.projectPath??".",volcengineAccessKey:e.volcengineAccessKey,volcengineSecretKey:e.volcengineSecretKey,volcengineSessionToken:e.volcengineSessionToken??""})},{},0);if(!t.ok)throw await hh(t);return t.json()}async function C5e(e){const t=await wt("/web/github-delivery/source-sync/cicd",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pipelineId:e.pipelineId,runtimeName:e.runtimeName,runtimeId:e.runtimeId,region:e.region,cloudProvider:e.cloudProvider,projectPath:e.projectPath??".",volcengineAccessKey:e.volcengineAccessKey,volcengineSecretKey:e.volcengineSecretKey,volcengineSessionToken:e.volcengineSessionToken??""})},{},0);if(!t.ok)throw await hh(t);return t.json()}async function Voe(e){const t=await wt(`/web/github-cicd/runtime-binding?runtimeId=${encodeURIComponent(e)}`);if(!t.ok)throw await hh(t);const n=await t.json();return n.pipelineId?n:null}async function z_(e){const t=await wt(`/web/github-delivery/versions?runtimeId=${encodeURIComponent(e)}`);if(!t.ok)throw await hh(t);return t.json()}async function Hoe(e){const t=await wt("/web/github-delivery/rollback-pr",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw await hh(t);return t.json()}async function v9(e){const t=await wt("/web/github-cicd/runtime-binding",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw await hh(t);return t.json()}async function qoe(e){const t=await wt("/web/github-cicd/runtime-sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e.runtimeId,project:e.project})},{},0);if(!t.ok)throw await hh(t);return t.json()}async function V1(e,t,n,r){var f,h,m,g,b;const i=r==null?void 0:r.taskId,s=i?new AbortController:void 0;i&&s&&Ev.set(i,s);const a=()=>{i&&Ev.get(i)===s&&Ev.delete(i)};let l;try{const y=!!(r!=null&&r.migrationTaskId);(f=r==null?void 0:r.onStage)==null||f.call(r,{level:"info",phase:"upload",message:y?"正在校验迁移产物":"正在上传代码包",pct:0}),l=await wt("/web/deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},signal:s==null?void 0:s.signal,body:JSON.stringify({name:e,files:y?[]:t,config:n,taskId:i,migrationTaskId:r==null?void 0:r.migrationTaskId,runtimeId:r==null?void 0:r.runtimeId,runtimeName:r==null?void 0:r.runtimeName,appName:r==null?void 0:r.appName,editMode:r==null?void 0:r.editMode,draft:r==null?void 0:r.draft,updateEtag:r==null?void 0:r.updateEtag,baseRuntimeVersion:r==null?void 0:r.baseRuntimeVersion,removeRuntimeEnvKeys:r==null?void 0:r.removeRuntimeEnvKeys,mcpSecretValues:r==null?void 0:r.mcpSecretValues,mcpCredentialReuses:r==null?void 0:r.mcpCredentialReuses,sessionStorage:r==null?void 0:r.sessionStorage,minInstance:r==null?void 0:r.minInstance,maxInstance:r==null?void 0:r.maxInstance,createEvaluationSets:r==null?void 0:r.createEvaluationSets,description:qIe((r==null?void 0:r.description)??""),authentication:r==null?void 0:r.authentication,im:r==null?void 0:r.im,envs:r==null?void 0:r.envs,resources:r==null?void 0:r.resources,source:(r==null?void 0:r.source)??(r!=null&&r.migrationTaskId?{kind:"migration",migrationId:r.migrationTaskId}:{kind:"inlineFiles"}),harnessSidecar:r==null?void 0:r.harnessSidecar,environment:r==null?void 0:r.environment})},{},0),(h=r==null?void 0:r.onStage)==null||h.call(r,{level:"success",phase:"upload",message:y?"迁移产物校验完成":"代码包上传完成",pct:100})}catch(y){throw a(),y}if(!l.ok){const y=await Zt(l,"部署失败");throw a(),new Error(y)}let c=null;try{for await(const y of IN(l)){const O=y;if(O&&O.done){c=O;break}O&&O.message&&((m=r==null?void 0:r.onStage)==null||m.call(r,O))}}catch(y){throw a(),y}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 连接信息");const u=(g=c.runtimeName)!=null&&g.trim()?c.agentName:e,d=((b=c.runtimeName)==null?void 0:b.trim())||c.agentName;return{apikey:c.apikey??"",url:c.url??"",agentName:u,runtimeName:d,runtimeId:c.runtimeId,consoleUrl:c.consoleUrl,region:c.region,version:c.version,warnings:c.warnings,feishuChannel:c.feishuChannel}}async function Xoe(e){var n;const t=await wt("/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=Ev.get(e))==null||n.abort(),Ev.delete(e)}async function A5e(e=s9){const t=await wt(`/web/my-runtimes?region=${encodeURIComponent(e)}`);if(!t.ok)throw new Error(`加载失败 (${t.status})`);return(await t.json()).runtimes??[]}const ww={title:"AgentKit Studio",logoUrl:""},XM={enabled:!1},f5={studio:!1,version:"",provider:"volcengine",branding:ww,features:{newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,agentUsage:!1,addAgentkit:!0,generatedAgentTestRun:!0},defaultView:"chat",agentsSource:"local",telemetry:XM};function N5e(e){if(!e||typeof e!="object")return XM;const t=e;if(t.enabled!==!0||!t.studio||typeof t.studio!="object")return XM;const n=t.studio;return{enabled:!0,studio:{deployId:typeof n.deployId=="string"?n.deployId:"",userPoolId:typeof n.userPoolId=="string"?n.userPoolId:"",applicationId:typeof n.applicationId=="string"?n.applicationId:"",functionId:typeof n.functionId=="string"?n.functionId:"",region:typeof n.region=="string"?n.region:"",project:typeof n.project=="string"?n.project:"",version:typeof n.version=="string"?n.version:"",accountId:typeof n.accountId=="string"?n.accountId:"",accountIdResolutionError:typeof n.accountIdResolutionError=="string"?n.accountIdResolutionError:""}}}async function Goe(){var e,t;try{const n=await wt("/web/ui-config");if(!n.ok)return f5;const r=await n.json(),i=typeof((e=r.branding)==null?void 0:e.logoUrl)=="string"?r.branding.logoUrl:ww.logoUrl,s=r.provider==="byteplus"?"byteplus":"volcengine";return Jae(s),{studio:r.studio??!1,version:typeof r.version=="string"?r.version:"",provider:s,branding:{title:typeof((t=r.branding)==null?void 0:t.title)=="string"?r.branding.title:ww.title,logoUrl:i?xo(i):""},features:{...f5.features,...r.features??{}},defaultView:r.defaultView??"chat",agentsSource:r.agentsSource==="cloud"?"cloud":"local",telemetry:N5e(r.telemetry)}}catch{return f5}}const Woe={role:"user",telemetry:{userId:"",accountId:""},capabilities:{createAgents:!1,manageAgents:!1,runtimeScope:"mine"}};async function Yoe(){var n,r,i,s;const e=await wt("/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.telemetry)==null?void 0:n.userId)!="string"||t.telemetry.accountId!==void 0&&typeof t.telemetry.accountId!="string"||typeof((r=t.capabilities)==null?void 0:r.createAgents)!="boolean"||typeof((i=t.capabilities)==null?void 0:i.manageAgents)!="boolean"||!["all","mine"].includes((s=t.capabilities)==null?void 0:s.runtimeScope))throw new Error("权限服务返回了无法解析的响应");return t}async function Zoe(e,t){const n=new URLSearchParams;e&&n.set("targetVersion",e),t&&n.set("startedAt",String(t));const r=n.size?`?${n.toString()}`:"",i=await wt(`/web/studio-update${r}`);if(!i.ok)throw new Error(`检查 Studio 更新失败 (${i.status})`);return await i.json()}async function Koe(){const e=await wt("/web/studio-update/permissions");if(!e.ok){let t="";try{const n=await e.json();t=typeof n.detail=="string"?n.detail:""}catch{t=""}throw new Error(t||`Studio 更新权限预检失败 (${e.status})`)}return await e.json()}async function Joe(e){const t=await wt("/web/studio-update",{method:"POST",headers:{"Content-Type":"application/json","X-VeADK-Studio-Update":"1"},body:JSON.stringify({version:e})},{},Zi);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 ele({runtimeId:e,region:t,appName:n,page:r=1,pageSize:i=20,signal:s}){const a=new URLSearchParams({runtimeId:e,region:t,appName:n,page:String(r),pageSize:String(i)}),l=await wt(`/web/agent-usage?${a.toString()}`,{signal:s});if(!l.ok)throw new Error(await Zt(l,"加载 Agent 用量失败"));const c=l.headers.get("content-type")||"未提供",u=c.toLowerCase();if(!u.includes("application/json")&&!u.includes("+json"))throw new Error(`加载 Agent 用量失败:服务端返回非 JSON 响应(HTTP ${l.status},Content-Type: ${c})。请确认当前服务以 Studio 模式启动,并检查代理或网关配置。`);try{return await l.json()}catch{throw new Error(`加载 Agent 用量失败:服务端返回了无法解析的 JSON(HTTP ${l.status},Content-Type: ${c})。请稍后重试;若问题持续,请检查代理或网关配置。`)}}function ph(e=""){return`/web/cronjobs${e?`/${encodeURIComponent(e)}`:""}`}async function GM(e){const t=await wt(ph(),{signal:e});if(!t.ok)throw new Error(await Zt(t,"加载定时任务失败"));const n=await t.json();return Array.isArray(n)?n:n.items??[]}async function j5e(e,t){const n=await wt(ph(e),{signal:t});if(!n.ok)throw new Error(await Zt(n,"加载定时任务详情失败"));return await n.json()}async function tle(e){const t=await wt(ph(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(await Zt(t,"创建定时任务失败"));return await t.json()}async function nle(e,t){const n=await wt(`${ph(e)}/update`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(await Zt(n,"更新定时任务失败"));return await n.json()}async function rle(e,t){const n=t?"enable":"disable",r=await wt(`${ph(e)}/${n}`,{method:"POST"});if(!r.ok)throw new Error(await Zt(r,t?"启用定时任务失败":"暂停定时任务失败"));return await r.json()}async function ile(e){const t=await wt(`${ph(e)}/run`,{method:"POST"});if(!t.ok)throw new Error(await Zt(t,"立即执行定时任务失败"));return await t.json()}async function WM(e,t){const n=await wt(`${ph(e)}/runs`,{signal:t});if(!n.ok)throw new Error(await Zt(n,"加载执行历史失败"));const r=await n.json();return Array.isArray(r)?r:r.items??[]}async function sle(e,t){const n=await wt(`${ph(e)}/runs/${encodeURIComponent(t)}/cancel`,{method:"POST"});if(!n.ok)throw new Error(await Zt(n,"终止执行失败"));return await n.json()}async function ale(e){const t=await wt(ph(e),{method:"DELETE"});if(!t.ok)throw new Error(await Zt(t,"删除定时任务失败"))}class w9 extends Error{constructor(t,n){super(t),this.status=n,this.name="RuntimeListError"}}async function H1(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 wt(`/web/runtimes?${t.toString()}`,{signal:e.signal});if(!n.ok){const i=await Zt(n,"加载 Runtime 失败");throw new w9(i,n.status)}const r=await n.json();return{runtimes:r.runtimes??[],nextToken:r.nextToken??""}}async function Jy(e,t,n={}){if(n.preferCached){const r=d9(e,t,n.currentVersion),i=dy.get(r);if(i&&i.expiresAt>Date.now())return[...i.apps];i&&dy.delete(r)}try{const r={runtimeId:e,region:t,runtimeVersion:n.currentVersion};return n.retryProbe&&(r.retryProbe=!0),await XS("","",r,n.signal,n.timeoutMs)}catch(r){if(r instanceof F1||r instanceof Es||r instanceof Error)throw r;return null}}async function ole(e,t){const n=new URLSearchParams({region:t}),r=await wt(`/web/runtime-tool-channel/${encodeURIComponent(e)}/capabilities?${n.toString()}`);if(!r.ok)throw new Es(await Zt(r,"读取本地工具失败"),!1,!0);return await r.json()}async function lle(e,t){const n=new URLSearchParams({region:t}),r=await wt(`/web/runtime-route-channel/${encodeURIComponent(e)}/connect?${n.toString()}`,{method:"POST"});if(!r.ok)throw new Es(await Zt(r,"连接 Studio 动态路由失败"),!1,!0);return await r.json()}async function cle(e,t,n={}){const r={runtimeId:e,region:t};n.retryProbe&&(r.retryProbe=!0);const i=await wt("/.well-known/agent-card.json",{},r),s=await eoe(i);if(s==="runtime_access_denied")throw new F1;if(s==="runtime_private_endpoint_unreachable")throw new Es(Yae);if(["runtime_proxy_connect_error","runtime_proxy_timeout"].includes(s))throw new Es(Zae);if(i.status===404)return null;if(i.status===401||i.status===403)throw new Es("Runtime 服务拒绝了 A2A 探测请求,请检查 Runtime 的鉴权配置。");if(!i.ok)throw new Error(await Zt(i,"读取 A2A Agent Card 失败"));const a=await i.json().catch(()=>null),l=typeof(a==null?void 0:a.url)=="string"?a.url.trim():"";return l?{name:typeof(a==null?void 0:a.name)=="string"?a.name:"",description:typeof(a==null?void 0:a.description)=="string"?a.description:"",endpoint:l}:null}async function ule(e,t){const n=new URLSearchParams({runtimeId:e,region:t}),r=await wt(`/web/runtime-api-key/reveal?${n.toString()}`,{method:"POST",cache:"no-store"});if(!r.ok)throw new Error(await Zt(r,"读取 Runtime API Key 失败"));const i=await r.json();if(typeof i.apiKey!="string"||!i.apiKey)throw new Error("Runtime 未返回可用的 API Key");return i.apiKey}async function dle(e,t){const n=await wt("/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})`)}}function V_({runtimeId:e,region:t,appName:n,currentVersion:r}){return u0(vw,t,e,r??"",(n==null?void 0:n.trim())??"")}async function R5e({runtimeId:e,region:t,appName:n,currentVersion:r,force:i=!1}){const s=new URLSearchParams({runtimeId:e,region:t});n&&s.set("appName",n),r!=null&&s.set("currentVersion",String(r)),i&&s.set("refresh","true");const a=await wt(`/web/runtime-update-capability?${s.toString()}`);if(!a.ok)throw new Error(await I5e(a));return await a.json()}function BN({runtimeId:e,region:t,appName:n,currentVersion:r,signal:i,force:s=!1}){var u,d;const a={runtimeId:e,region:t,appName:n,currentVersion:r},l=V_(a);if(s&&yi.delete(l),!s){const f=cm(yi,l,z1);if(f)return zk(Promise.resolve(f),i);const h=(u=yi.get(l))==null?void 0:u.promise;if(h)return zk(h,i);if(n){const m=V_({...a,appName:""}),g=(d=yi.get(m))==null?void 0:d.promise;if(g){let b;return b=g.then(y=>{var v,x,w,S,E;if(y.recoveryStatus==="preparing")return((v=yi.get(l))==null?void 0:v.promise)===b&&yi.delete(l),y;const O=((w=(x=y.agent)==null?void 0:x.appName)==null?void 0:w.trim())??"";return O&&O!==n.trim()?(((S=yi.get(l))==null?void 0:S.promise)===b&&yi.delete(l),BN(a)):(((E=yi.get(l))==null?void 0:E.promise)===b&&yi.set(l,{value:y,updatedAt:Date.now()}),y)},y=>{var O;throw((O=yi.get(l))==null?void 0:O.promise)===b&&yi.delete(l),y}),yi.set(l,{promise:b,updatedAt:0}),zk(b,i)}}}let c;return c=R5e({...a,force:s}).then(f=>{var h,m,g,b,y;if(f.recoveryStatus==="preparing")return((h=yi.get(l))==null?void 0:h.promise)===c&&yi.delete(l),f;if(((m=yi.get(l))==null?void 0:m.promise)===c){yi.set(l,{value:f,updatedAt:Date.now()});const O=new Set(["",((b=(g=f.agent)==null?void 0:g.appName)==null?void 0:b.trim())??""]);for(const v of O){const x=V_({...a,appName:v});x!==l&&!((y=yi.get(x))!=null&&y.promise)&&yi.set(x,{value:f,updatedAt:Date.now()})}}return f},f=>{var h;throw((h=yi.get(l))==null?void 0:h.promise)===c&&yi.delete(l),f}),yi.set(l,{promise:c,updatedAt:0}),zk(c,i)}function YM({runtimeId:e,region:t,appName:n,currentVersion:r}){return cm(yi,V_({runtimeId:e,region:t,appName:n,currentVersion:r}),z1)}function ZM(e){return BN(e).then(()=>{},()=>{})}function KM(e,t){if(!e){yi.clear();return}for(const n of yi.keys()){const[r,i,s]=n.split("");r===vw&&s===e&&(!t||i===t)&&yi.delete(n)}}async function I5e(e){const t=await e.json().catch(()=>null),n=typeof(t==null?void 0:t.detail)=="string"?t.detail:"";return e.status===403?"当前账号没有管理该 Runtime 的权限。":e.status===404?n==="runtime_not_found"?"该 Runtime 不存在或已被删除。":"当前账号无法访问该 Runtime。":`检查 Runtime 更新能力失败(HTTP ${e.status}),请稍后重试。`}async function D5e(e,t){let n=null;for(const r of qS(t)){const i=await wt(`/web/runtime-detail?runtimeId=${encodeURIComponent(e)}®ion=${encodeURIComponent(r)}`);if(i.ok)return i.json();n=new Error(await Zt(i,"加载 Runtime 详情失败"))}throw n??new Error("加载 Runtime 详情失败")}async function S9(e,t="cn-beijing",n={}){const r=u0(e,t||"cn-beijing"),i=cm(zm,r,z1);if(!n.force&&i)return i;const s=zm.get(r);if(!n.force&&(s!=null&&s.promise))return s.promise;const a=D5e(e,t).then(l=>f9(zm,r,l));zm.set(r,{...s,promise:a,updatedAt:(s==null?void 0:s.updatedAt)??0});try{return await a}finally{const l=zm.get(r);(l==null?void 0:l.promise)===a&&zm.set(r,{value:l.value,updatedAt:l.updatedAt})}}function fle(e,t="cn-beijing"){return cm(zm,u0(e,t||"cn-beijing"),z1)}function hle(e,t="cn-beijing"){S9(e,t).catch(()=>{})}async function xC(e){const t=await wt("/web/generated-agent-projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e})});if(!t.ok)throw new Error(await Zt(t,"生成项目失败"));return t.json()}const P5e=19e4;async function ple(e){const t=await wt("/web/generated-agent-drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({requirement:e})},{},P5e);if(!t.ok)throw new Error(await Zt(t,"生成 Agent 配置失败"));return RN(t,"生成 Agent 配置失败")}async function mle(e,t){const n=await wt("/web/generated-agent-test-runs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,runtimeId:t==null?void 0:t.runtimeId,runtimeRegion:t==null?void 0:t.region})});if(!n.ok)throw new Error(await Zt(n,"创建调试运行失败"));return RN(n,"创建调试运行失败")}async function gle(e,t){const n=await wt(`/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 Zt(n,"创建调试会话失败"));return(await RN(n,"创建调试会话失败")).id}async function ble(e,t){const n=await wt(`/web/generated-agent-test-runs/${encodeURIComponent(e)}/trace/session/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(await Zt(n,"加载调试调用链路失败"));const r=await RN(n,"加载调试调用链路失败");if(!Array.isArray(r))throw new Error("加载调试调用链路失败:返回格式无效");return r}async function*yle({runId:e,userId:t,sessionId:n,text:r,signal:i}){const s=r.trim()?[{text:r}]:[],a=yoe(i);let l;try{l=await wt(`/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:s},streaming:!0}),signal:a.signal},{},0)}catch(c){throw a.cleanup(),a.timedOut()?new Error(Ky):c}if(!l.ok)throw a.cleanup(),new Error(await Zt(l,"调试运行失败"));try{for await(const c of IN(l))a.clearDeadline(),yield c}catch(c){throw a.timedOut()?new Error(Ky):c}finally{a.cleanup()}}async function pb(e){const t=await wt(`/web/generated-agent-test-runs/${e}`,{method:"DELETE"});if(!t.ok&&t.status!==404)throw new Error(await Zt(t,"清理调试运行失败"))}const M5e=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_SITE_BRANDING:ww,DEFAULT_STUDIO_ACCESS:Woe,GithubCicdPipelineError:kv,RUN_SSE_EMPTY_RESPONSE_ERROR:boe,RUN_SSE_FIRST_EVENT_TIMEOUT_ERROR:Ky,RUN_SSE_INCOMPLETE_RESPONSE_ERROR:F_,RuntimeAccessDeniedError:F1,RuntimeListError:w9,RuntimeProbeError:Es,attachGithubDeliveryCicdToSourceSync:C5e,bindGithubCicdRuntime:v9,buildEnvironment:qM,cancelAgentkitDeployment:Xoe,cancelCronJobRun:sle,checkRuntimeNameAvailability:LN,clearMessageFeedbackCache:Hae,clearRemoteApps:Xae,componentSearch:moe,createCronJob:tle,createEnvironment:Doe,createGeneratedAgentTestRun:mle,createGeneratedAgentTestSession:gle,createGithubCicdPipeline:Uoe,createGithubDeliveryCicdPipeline:Foe,createGithubDeliveryRollbackPr:Hoe,createSession:toe,createWorkspace:_oe,deleteAgentFeedbackCases:ooe,deleteCronJob:ale,deleteEnvironment:Moe,deleteGeneratedAgentTestRun:pb,deleteMedia:U_,deleteRuntime:dle,deleteSession:UM,deleteSessionMedia:FM,deleteWorkspace:Coe,deployAgentkitProject:V1,downloadArtifact:p9,ensureRuntimeRouteChannel:lle,exportEnvironmentShareCode:Noe,fetchRemoteApps:XS,generateAgentDraftFromRequirement:ple,generateAgentProject:xC,getAgentFeedbackCases:MN,getAgentInfo:VM,getAgentOptimizations:roe,getAgentUsage:ele,getAutomaticEvaluationStatuses:QM,getCachedAgentFeedbackCases:ioe,getCachedRuntimeAgentInfo:hoe,getCachedRuntimeDetail:fle,getCachedRuntimeUpdateCapability:YM,getCronJob:j5e,getEnvironmentBuild:Loe,getEnvironmentManifest:$oe,getEnvironmentResources:Boe,getGeneratedAgentTestTrace:ble,getGithubCicdRuntimeBinding:Voe,getGithubDeliveryVersions:z_,getMediaCapabilities:v5e,getMyRuntimes:A5e,getRuntimeAgentInfo:g9,getRuntimeDetail:S9,getRuntimeStudioToolCapabilities:ole,getRuntimeUpdateCapability:BN,getRuntimes:H1,getSession:PN,getSessionTrace:OC,getStudioAccess:Yoe,getStudioUpdatePermissions:Koe,getStudioUpdateStatus:Zoe,getSystemInfo:voe,getUiConfig:Goe,httpErrorMessage:Zt,importEnvironmentShareCodes:Roe,initializeGithubDeliveryMain:zoe,inspectEnvironmentRepository:Aoe,inspectEnvironmentShareCodes:joe,invalidateRuntimeUpdateCapabilityCache:KM,listApps:Wae,listCronJobRuns:WM,listCronJobs:GM,listDeploymentResources:Ooe,listEnvironments:GS,listIdentityUserPools:$N,listModelApiKeys:u9,listModelOptions:U1,listSessions:h9,listWorkspaces:x9,mediaContentUrl:doe,parseEnvironmentShareCodes:b9,prefetchAgentFeedbackCases:O5e,prefetchRuntimeAgentInfo:poe,prefetchRuntimeDetail:hle,prefetchRuntimeUpdateCapability:ZM,previewArtifact:m9,probeRuntimeA2a:cle,probeRuntimeApps:Jy,refreshAgentFeedbackCases:soe,registerRemoteApp:qae,revealModelApiKey:Gae,revealRuntimeApiKey:ule,runCronJobNow:ile,runGeneratedAgentTestSSE:yle,runSSE:HM,runtimeRegionCandidates:qS,setClientCloudProvider:Jae,setCronJobEnabled:rle,startStudioUpdate:Joe,studioFetch:In,submitIssueFeedback:zM,submitMessageFeedback:noe,syncGithubCicdRuntime:qoe,updateCodexSandboxToolModelEnv:Qoe,updateCronJob:nle,updateEnvironment:Poe,updateWorkspace:Toe,uploadMedia:coe,upsertCachedAgentFeedbackCase:Q_,webSearch:goe,writeEnvironmentShareCode:xoe},Symbol.toStringTag,{value:"Module"})),CH=Object.freeze({totalTokenCount:0,promptTokenCount:0,candidatesTokenCount:0,thoughtsTokenCount:0,cachedContentTokenCount:0}),H_=Object.freeze({modelName:"",current:CH,cumulative:CH}),L5e={totalTokenCount:"total_token_count",promptTokenCount:"prompt_token_count",candidatesTokenCount:"candidates_token_count",thoughtsTokenCount:"thoughts_token_count",cachedContentTokenCount:"cached_content_token_count"},$5e=24,B5e=64,Q5e=16;function Vk(e){var l,c;const t=e.trim();if(!t)return 0;const n=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/gu,r=((l=t.match(n))==null?void 0:l.length)??0,i=t.replace(n," "),s=(i.match(/[A-Za-z0-9_]+/g)??[]).reduce((u,d)=>u+Math.max(1,Math.ceil(d.length/4)),0),a=((c=i.match(/[^\sA-Za-z0-9_]/g))==null?void 0:c.length)??0;return r+s+a}function U5e(e){var l,c,u;const t=((l=e.instruction)==null?void 0:l.trim())??"",n=((c=e.tools)==null?void 0:c.filter(d=>d.trim()))??[],r=((u=e.skills)==null?void 0:u.filter(d=>d.name.trim()))??[],i=Vk(t),s=n.reduce((d,f)=>d+B5e+Vk(f),0),a=r.reduce((d,f)=>d+Q5e+Vk(f.name)+Vk(f.description??""),0);return $5e+i+s+a}function F5e({usage:e,contextWindow:t,estimatedSystemTokens:n}){const r=Math.max(1,Math.round(t)),i=Math.max(0,e.current.promptTokenCount),s=Math.max(i,e.current.totalTokenCount),a=Math.min(r,i>0?Math.min(i,Math.max(0,n??0)):Math.max(0,n??0)),l=Math.max(0,i-a),c=i>0?Math.max(0,s-i):Math.max(0,s),u=i>0?s:a+c;return{systemTokens:a,inputTokens:l,outputTokens:c,remainingTokens:Math.max(0,r-u),usedTokens:u,contextWindow:r}}function z5e(e){const t=[{kind:"system",tokens:e.systemTokens},{kind:"input",tokens:e.inputTokens},{kind:"output",tokens:e.outputTokens},{kind:"remaining",tokens:e.remainingTokens}],n=e.contextWindow/100;let r=0;const i=t.map(s=>{const a=r;return r+=s.tokens,{...s,start:a,end:r}});return Array.from({length:100},(s,a)=>{const l=a*n,c=l+n,u=i.flatMap(d=>{const f=Math.max(0,Math.min(c,d.end)-Math.max(l,d.start));return f>0?[{kind:d.kind,share:f/n}]:[]});return{index:a,slices:u}})}function ex(e,t){const n=e,r=n[t]??n[L5e[t]];return typeof r=="number"&&Number.isFinite(r)&&r>0?Math.round(r):0}function V5e(e){const t=ex(e,"promptTokenCount"),n=ex(e,"candidatesTokenCount"),r=ex(e,"thoughtsTokenCount");return{totalTokenCount:ex(e,"totalTokenCount")||t+n+r,promptTokenCount:t,candidatesTokenCount:n,thoughtsTokenCount:r,cachedContentTokenCount:ex(e,"cachedContentTokenCount")}}function H5e(e,t){return{totalTokenCount:e.totalTokenCount+t.totalTokenCount,promptTokenCount:e.promptTokenCount+t.promptTokenCount,candidatesTokenCount:e.candidatesTokenCount+t.candidatesTokenCount,thoughtsTokenCount:e.thoughtsTokenCount+t.thoughtsTokenCount,cachedContentTokenCount:e.cachedContentTokenCount+t.cachedContentTokenCount}}function Ole(e,t){if(!t)return e;const n=typeof t.modelVersion=="string"?t.modelVersion.trim():"",r=typeof t.model_version=="string"?t.model_version.trim():"",i=n||r||e.modelName,s=t.usageMetadata??t.usage_metadata;if(!s)return i===e.modelName?e:{...e,modelName:i};const a=V5e(s);return a.totalTokenCount===0?i===e.modelName?e:{...e,modelName:i}:{modelName:i,current:a,cumulative:H5e(e.cumulative,a)}}function AH(e){return e.reduce((t,n)=>Ole(t,n),H_)}function NH(e){return e.blocks.flatMap(t=>t.kind==="tool"?[{name:t.name,args:t.args,response:t.response,done:t.done}]:[])}function q5e(e){const t=e.attributes;return String(t["invocation.id"]??t["gen_ai.invocation.id"]??t["gcp.vertex.agent.invocation_id"]??"")}function X5e(e,t){if(!t)return e;const n=new Set(e.filter(i=>q5e(i)===t).map(i=>i.trace_id)),r=e.filter(i=>n.has(i.trace_id));return r.length>0?r:e}function Pg(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function hp(e){return typeof e=="string"?e:""}function xle(e,t){return e==="pending"||e==="running"||e==="completed"||e==="failed"?e:t}function G5e(e){let t=e;if(typeof t=="string")try{t=JSON.parse(t)}catch{return{}}const n=Pg(t)??{};return Pg(n.result)??n}function W5e(e){var n;const t=(n=Pg(e))==null?void 0:n.branches;return Array.isArray(t)?t.map(r=>{var i;return hp((i=Pg(r))==null?void 0:i.label)}):[]}function vle(e,t,n){const r=W5e(e),i=G5e(t),s=Array.isArray(i.branches)?i.branches:[],a=n==="running"?"running":"pending";return{branches:[0,1].map(c=>{const u=Pg(s[c])??{};return{label:hp(u.label)||r[c]||`方向 ${c+1}`,content:hp(u.content),status:xle(u.status,a),error:hp(u.error)}})}}function Y5e(e){const t=Pg(e),n=Pg(t==null?void 0:t.veadkStudioToolProgress);return!n||n.toolName!=="branch_compare"||typeof n.branchIndex!="number"||n.branchIndex<0||n.branchIndex>1?null:{toolName:"branch_compare",requestId:hp(n.requestId),branchIndex:n.branchIndex,label:hp(n.label),delta:hp(n.delta),status:xle(n.status,"running"),error:hp(n.error)||void 0}}function Z5e(e,t,n){return{branches:vle(e,t,"running").branches.map((s,a)=>a===n.branchIndex?{...s,label:n.label||s.label,content:s.content+n.delta,status:n.status,error:n.error??s.error}:s)}}const K5e="send_a2ui_json_to_client",J5e="validated_a2ui_json",JM="adk_request_credential",jH="transfer_to_agent";function eDe(e){var r,i,s,a;const t=e,n=((r=t==null?void 0:t.exchangedAuthCredential)==null?void 0:r.oauth2)??((i=t==null?void 0:t.exchanged_auth_credential)==null?void 0:i.oauth2)??((s=t==null?void 0:t.rawAuthCredential)==null?void 0:s.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 kf(){return{blocks:[],liveStart:0}}const RH=e=>e.functionCall??e.function_call,e4=e=>e.functionResponse??e.function_response;function tDe(e){if(!e||typeof e!="object")return"";const t=e,n=t.agentName??t.agent_name;return typeof n=="string"?n:""}function nDe(e){return e.replace(/-/g,"+").replace(/_/g,"/")}function wle(e){const t=[];for(const[n,r]of e.entries()){const i=r.partMetadata??r.part_metadata,s=i==null?void 0:i.veadkTransport;if((s==null?void 0:s.hidden)===!0)continue;const a=i==null?void 0:i.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 l=r.inlineData??r.inline_data;if(l&&l.data){t.push({id:`inline-${n}-${l.displayName??l.display_name??"media"}`,mimeType:l.mimeType??l.mime_type,data:nDe(l.data),name:l.displayName??l.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 t4(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 rDe=new Set(["llm","sequential","parallel","loop","a2a"]);function iDe(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 i=r,s=Array.isArray(i.skills)?i.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 l=i.targetAgent;if(l&&typeof l=="object"){const c=l,u=c.type;typeof c.name=="string"&&typeof u=="string"&&rDe.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(s.length>0||a)return{skills:s,targetAgent:a}}}function sDe(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 aDe(e,t){if(!t.length)return;const n=e[e.length-1];if((n==null?void 0:n.kind)==="artifact"){for(const r of t)n.files.some(i=>i.filename===r.filename&&i.version===r.version)||n.files.push(r);return}e.push({kind:"artifact",files:t})}function IH(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 Hk(e){for(const t of e)t.kind==="thinking"&&(t.done=!0)}function vC(e,t){var c,u,d,f,h,m;const n=e.blocks.map(g=>({...g}));let r=e.liveStart;const i=((c=t.content)==null?void 0:c.parts)??[],s=i.flatMap(g=>{const b=Y5e(g.partMetadata??g.part_metadata);return b?[b]:[]});if(s.length>0){for(const g of s)for(let b=n.length-1;b>=0;b-=1){const y=n[b];if(!(y.kind!=="tool"||y.done||y.name!==g.toolName||g.requestId&&y.callId&&y.callId!==g.requestId)){y.response=Z5e(y.args,y.response,g),y.status="running";break}}return{blocks:n,liveStart:r}}const a=i.some(g=>RH(g)||e4(g));if(t.partial&&!a){for(const g of i){const b=t4(g);typeof b=="string"&&b&&IH(n,g.thought?"thinking":"text",b)}return{blocks:n,liveStart:r}}n.length=r;for(const g of i){const b=RH(g),y=e4(g),O=wle([g]),v=t4(g);if(typeof v=="string"&&v)IH(n,g.thought?"thinking":"text",v);else if(O.length)Hk(n),sDe(n,O);else if(b)if(Hk(n),b.name===jH){const x=tDe(b.args)||((u=t.actions)==null?void 0:u.transferToAgent)||((d=t.actions)==null?void 0:d.transfer_to_agent)||"未知 Agent";n.push({kind:"agent-transfer",agentName:x,done:!1})}else if(b.name===JM){const x=b.args??{},w=x.authConfig??x.auth_config??x,E=String(x.functionCallId??x.function_call_id??"").replace(/^_adk_toolset_auth_/,"")||void 0;n.push({kind:"auth",callId:b.id??"",label:E,authUri:eDe(w),authConfig:w,done:!1})}else n.push({kind:"tool",name:b.name??"",callId:b.id,args:b.args,done:!1});else if(y){if(Hk(n),y.name===jH)for(let x=n.length-1;x>=0;x--){const w=n[x];if(w.kind==="agent-transfer"&&!w.done){w.done=!0;break}}if(y.name===JM)for(let x=n.length-1;x>=0;x--){const w=n[x];if(w.kind==="auth"&&!w.done){w.done=!0;break}}for(let x=n.length-1;x>=0;x--){const w=n[x];if(w.kind==="tool"&&!w.done&&w.name===y.name&&(!y.id||!w.callId||w.callId===y.id)){w.done=!0,w.response=y.response;break}}if(y.name===K5e){const x=((f=y.response)==null?void 0:f[J5e])??[];if(x.length){const w=n[n.length-1];w&&w.kind==="a2ui"?w.messages.push(...x):n.push({kind:"a2ui",messages:x})}}}}const l=((h=t.actions)==null?void 0:h.artifactDelta)??((m=t.actions)==null?void 0:m.artifact_delta);return l&&aDe(n,Object.entries(l).map(([g,b])=>({filename:g,version:b}))),Hk(n),r=n.length,{blocks:n,liveStart:r}}function oDe(e,t={}){var i,s;const n=[];let r=kf();for(const a of e)if(a.author==="user"){const c=((i=a.content)==null?void 0:i.parts)??[];if(c.some(m=>{var g;return((g=e4(m))==null?void 0:g.name)===JM})){for(let m=n.length-1;m>=0;m--)if(n[m].role==="assistant"){for(let g=n[m].blocks.length-1;g>=0;g--){const b=n[m].blocks[g];if(b.kind==="auth"){b.done=!0;break}}break}}const u=c.map(t4).filter(m=>!!m).join(""),d=wle(c),f=iDe(c);if(!u&&!d.length&&!f){r=kf();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=kf()}else{const c=a.author??"";let u=n[n.length-1];(!u||u.role!=="assistant"||c&&((s=u.meta)==null?void 0:s.author)!==c)&&(u={role:"assistant",blocks:[],meta:{author:c||void 0}},n.push(u),r=kf()),r=vC(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 l=a.meta,c=l==null?void 0:l.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"||(l.feedback=u)}return n}function QN(e){var t,n;for(const r of e??[])if(r.author==="user"||((t=r.content)==null?void 0:t.role)==="user"){const i=(((n=r.content)==null?void 0:n.parts)??[]).map(s=>s.text).find(Boolean);if(i)return i}return"新会话"}function Sle(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t{const t=p.Children.toArray(e),n=[];let r="";const i=()=>{r!==""&&(n.push(r),r="")};for(const s of t)if(!(s==null||typeof s=="boolean")){if(typeof s=="string"||typeof s=="number"){r+=String(s);continue}i(),n.push(s)}return i(),n},E9=e=>{const t=lDe(e),n=p.Children.count(t);return p.Children.map(t,r=>{if(typeof r=="string"&&r.trim())return n<=1?r:o.jsx("span",{children:r});if(p.isValidElement(r)){const i=r,{children:s,...a}=i.props;return s!=null?p.cloneElement(i,a,E9(s)):i}return r})},cDe="_Badge_1viyg_1",uDe={Badge:cDe},ta=({children:e,className:t,variant:n="soft",color:r="secondary",size:i="sm",pill:s,...a})=>o.jsx("div",{className:ur(uDe.Badge,t),"data-color":r,"data-size":i,"data-pill":s?"":void 0,"data-variant":n,...a,children:E9(e)});var dDe=typeof op=="object"&&op&&op.Object===Object&&op,fDe=typeof self=="object"&&self&&self.Object===Object&&self;dDe||fDe||Function("return this")();var hDe=typeof window<"u"?p.useLayoutEffect:p.useEffect;function pDe(){const e=p.useRef(!1);return p.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),p.useCallback(()=>e.current,[])}var DH={width:void 0,height:void 0};function Ele(e){const{ref:t,box:n="content-box"}=e,[{width:r,height:i},s]=p.useState(DH),a=pDe(),l=p.useRef({...DH}),c=p.useRef(void 0);return c.current=e.onResize,p.useEffect(()=>{if(!t.current||typeof window>"u"||!("ResizeObserver"in window))return;const u=new ResizeObserver(([d])=>{const f=n==="border-box"?"borderBoxSize":n==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",h=PH(d,f,"inlineSize"),m=PH(d,f,"blockSize");if(l.current.width!==h||l.current.height!==m){const b={width:h,height:m};l.current.width=h,l.current.height=m,c.current?c.current(b):a()&&s(b)}});return u.observe(t.current,{box:n}),()=>{u.disconnect()}},[n,t,a]),{width:r,height:i}}function PH(e,t,n){return e[t]?Array.isArray(e[t])?e[t][0][n]:e[t][n]:t==="contentBoxSize"?e.contentRect[n==="inlineSize"?"width":"height"]:void 0}function k9(e,t){const n=p.useRef(e);hDe(()=>{n.current=e},[e]),p.useEffect(()=>{if(!t&&t!==0)return;const r=setTimeout(()=>{n.current()},t);return()=>{clearTimeout(r)}},[t])}const mDe={DEV:!1,MODE:"production"},fy=typeof import.meta<"u"?mDe:void 0,gDe=!!(fy!=null&&fy.DEV),bDe=typeof navigator<"u"&&/(jsdom|happy-dom)/i.test(navigator.userAgent)||typeof globalThis.happyDOM=="object",kle=(fy==null?void 0:fy.MODE)==="test"||bDe,yDe=typeof window<"u",_le=typeof document<"u",ODe=yDe&&_le,_9=e=>{const t=e.currentTarget;if(!(t instanceof HTMLElement))return;const n=t.offsetWidth;let r=.985;n<=80?r=.96:n<=150?r=.97:n<=220?r=.98:n>600&&(r=.995),t.style.setProperty("--scale",r.toString())},wC=(e,t)=>{const n=()=>{const a=setTimeout(e);return()=>{clearTimeout(a)}};if(!ODe||typeof window.requestAnimationFrame!="function"||_le&&document.visibilityState==="hidden")return n();let i=2,s=window.requestAnimationFrame(function a(){i-=1,i===0?e():s=window.requestAnimationFrame(a)});return()=>{typeof window.cancelAnimationFrame=="function"&&window.cancelAnimationFrame(s)}},d0=e=>Object.keys(e).reduce((n,r)=>{const i=e[r];if(i||i===0){const s=r.startsWith("--")?"":"--",a=typeof i=="number"?`${i}px`:i;n[`${s}${r}`]=a}return n},{}),h5=e=>typeof e=="number"?`${e}deg`:e,p5=e=>String(e),qk=e=>`${e}ms`,m5=({x:e,y:t,scale:n,rotate:r,skewX:i,skewY:s}={})=>{const a=[e==null?null:`translateX(${e}px)`,t==null?null:`translateY(${t}px)`,n==null?null:`scale(${n})`,r==null?null:`rotate(${h5(r)})`,i==null?null:`skewX(${h5(i)})`,s==null?null:`skewY(${h5(s)})`].filter(Boolean);return a.length?a.join(" "):"none"},g5=({blur:e}={})=>{const t=[e==null?null:`blur(${e}px)`].filter(Boolean);return t.length?t.join(" "):"none"},Df=e=>{e.preventDefault()},Tle=e=>e.querySelectorAll('a[href], input:not([disabled]):not([type="hidden"]), textarea:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex^="-"]), [contenteditable]'),xDe="_LoadingIndicator_7yl6f_1",vDe={LoadingIndicator:xDe},WS=({className:e,size:t,strokeWidth:n,style:r,...i})=>o.jsx("div",{...i,className:ur(vDe.LoadingIndicator,e),style:r||d0({"indicator-size":t,"indicator-stroke":n})});var wDe=Object.defineProperty,T9=(e,t)=>wDe(e,"name",{value:t,configurable:!0});function n4(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}T9(n4,"setRef");function Cle(...e){return t=>{let n=!1;const r=e.map(i=>{const s=n4(i,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;iSDe(e,"name",{value:t,configurable:!0});function Jf(e){const t=p.forwardRef((n,r)=>{let{children:i,...s}=n,a=null,l=!1;const c=[];r4(i)&&typeof Xk=="function"&&(i=Xk(i._payload)),p.Children.forEach(i,h=>{var m;if(Dle(h)){l=!0;const g=h;let b="child"in g.props?g.props.child:g.props.children;r4(b)&&typeof Xk=="function"&&(b=Xk(b._payload)),a=EDe(g,b),c.push((m=a==null?void 0:a.props)==null?void 0:m.children)}else c.push(h)}),a?a=p.cloneElement(a,void 0,c):!l&&p.Children.count(i)===1&&p.isValidElement(i)&&(a=i);const u=a?Ile(a):void 0,d=zr(r,u);if(!a){if(i||i===0)throw new Error(l?TDe(e):_De(e));return i}const f=Rle(s,a.props??{});return a.type!==p.Fragment&&(f.ref=r?d:u),p.cloneElement(a,f)});return t.displayName=`${e}.Slot`,t}ku(Jf,"createSlot");var Ale=Jf("Slot"),Nle=Symbol.for("radix.slottable");function jle(e){const t=ku(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=Nle,t}ku(jle,"createSlottable");var EDe=ku((e,t)=>{if("child"in e.props){const n=e.props.child;return p.isValidElement(n)?p.cloneElement(n,void 0,e.props.children(n.props.children)):null}return p.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function Rle(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...l)=>{const c=s(...l);return i(...l),c}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}ku(Rle,"mergeProps");function Ile(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}ku(Ile,"getElementRef");function Dle(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Nle}ku(Dle,"isSlottable");var kDe=Symbol.for("react.lazy");function r4(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===kDe&&"_payload"in e&&Ple(e._payload)}ku(r4,"isLazyComponent");function Ple(e){return typeof e=="object"&&e!==null&&"then"in e}ku(Ple,"isPromiseLike");var _De=ku(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),TDe=ku(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Xk=r0[" use ".trim().toString()],CDe=Object.defineProperty,ADe=(e,t)=>CDe(e,"name",{value:t,configurable:!0}),NDe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],pi=NDe.reduce((e,t)=>{const n=Jf(`Primitive.${t}`),r=p.forwardRef((i,s)=>{const{asChild:a,...l}=i,c=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function C9(e,t){e&&Cr.flushSync(()=>e.dispatchEvent(t))}ADe(C9,"dispatchDiscreteCustomEvent");var jDe=Object.defineProperty,RDe=(e,t)=>jDe(e,"name",{value:t,configurable:!0}),IDe=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),DDe=p.forwardRef(RDe(function(t,n){return o.jsx(pi.span,{...t,ref:n,style:{...IDe,...t.style}})},"VisuallyHidden")),PDe=DDe,MDe=Object.defineProperty,Ec=(e,t)=>MDe(e,"name",{value:t,configurable:!0});function LDe(e,t){const n=p.createContext(t);n.displayName=e+"Context";const r=Ec(s=>{const{children:a,...l}=s,c=p.useMemo(()=>l,Object.values(l));return o.jsx(n.Provider,{value:c,children:a})},"Provider");r.displayName=e+"Provider";function i(s,a={}){const{optional:l=!1}=a,c=p.useContext(n);if(c)return c;if(t!==void 0)return t;if(!l)throw new Error(`\`${s}\` must be used within \`${e}\``)}return Ec(i,"useContext"),[r,i]}Ec(LDe,"createContext");function rl(e,t=[]){let n=[];function r(s,a){const l=p.createContext(a);l.displayName=s+"Context";const c=n.length;n=[...n,a];const u=Ec(f=>{var O;const{scope:h,children:m,...g}=f,b=((O=h==null?void 0:h[e])==null?void 0:O[c])||l,y=p.useMemo(()=>g,Object.values(g));return o.jsx(b.Provider,{value:y,children:m})},"Provider");u.displayName=s+"Provider";function d(f,h,m={}){var O;const{optional:g=!1}=m,b=((O=h==null?void 0:h[e])==null?void 0:O[c])||l,y=p.useContext(b);if(y)return y;if(a!==void 0)return a;if(!g)throw new Error(`\`${f}\` must be used within \`${s}\``)}return Ec(d,"useContext"),[u,d]}Ec(r,"createContext");const i=Ec(()=>{const s=n.map(a=>p.createContext(a));return Ec(function(l){const c=(l==null?void 0:l[e])||s;return p.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])},"useScope")},"createScope");return i.scopeName=e,[r,Mle(i,...t)]}Ec(rl,"createContextScope");function Mle(...e){const t=e[0];if(e.length===1)return t;const n=Ec(()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return Ec(function(s){const a=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}Ec(Mle,"composeContextScopes");var $De=Object.defineProperty,ha=(e,t)=>$De(e,"name",{value:t,configurable:!0});function A9(e){const t=e+"CollectionProvider",[n,r]=rl(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=ha(b=>{const{scope:y,children:O}=b,v=p.useRef(null),x=p.useRef(new Map).current;return o.jsx(i,{scope:y,itemMap:x,collectionRef:v,children:O})},"CollectionProvider");a.displayName=t;const l=e+"CollectionSlot",c=Jf(l),u=p.forwardRef((b,y)=>{const{scope:O,children:v}=b,x=s(l,O),w=zr(y,x.collectionRef);return o.jsx(c,{ref:w,children:v})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=Jf(d),m=p.forwardRef((b,y)=>{const{scope:O,children:v,...x}=b,w=p.useRef(null),S=zr(y,w),E=s(d,O);return p.useEffect(()=>(E.itemMap.set(w,{ref:w,...x}),()=>void E.itemMap.delete(w))),o.jsx(h,{[f]:"",ref:S,children:v})});m.displayName=d;function g(b){const y=s(e+"CollectionConsumer",b);return p.useCallback(()=>{const v=y.collectionRef.current;if(!v)return[];const x=Array.from(v.querySelectorAll(`[${f}]`));return Array.from(y.itemMap.values()).sort((E,k)=>x.indexOf(E.ref.current)-x.indexOf(k.ref.current))},[y.collectionRef,y.itemMap])}return ha(g,"useCollection"),[{Provider:a,Slot:u,ItemSlot:m},g,r]}ha(A9,"createCollection");var MH=new WeakMap,Ls,Sl,b5=(Sl=class extends Map{constructor(n){super(n);SF(this,Ls);hI(this,Ls,[...super.keys()]),MH.set(this,!0)}set(n,r){return MH.get(this)&&(this.has(n)?qa(this,Ls)[qa(this,Ls).indexOf(n)]=n:qa(this,Ls).push(n)),super.set(n,r),this}insert(n,r,i){const s=this.has(r),a=qa(this,Ls).length,l=N9(n);let c=l>=0?l:a+l;const u=c<0||c>=a?-1:c;if(u===this.size||s&&u===this.size-1||u===-1)return this.set(r,i),this;const d=this.size+(s?0:1);l<0&&c++;const f=[...qa(this,Ls)];let h,m=!1;for(let g=c;g=this.size&&(s=this.size-1),this.at(s)}keyFrom(n,r){const i=this.indexOf(n);if(i===-1)return;let s=i+r;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.keyAt(s)}find(n,r){let i=0;for(const s of this){if(Reflect.apply(n,r,[s,i,this]))return s;i++}}findIndex(n,r){let i=0;for(const s of this){if(Reflect.apply(n,r,[s,i,this]))return i;i++}return-1}filter(n,r){const i=[];let s=0;for(const a of this)Reflect.apply(n,r,[a,s,this])&&i.push(a),s++;return new Sl(i)}map(n,r){const i=[];let s=0;for(const a of this)i.push([a[0],Reflect.apply(n,r,[a,s,this])]),s++;return new Sl(i)}reduce(...n){const[r,i]=n;let s=0,a=i??this.at(0);for(const l of this)s===0&&n.length===1?a=l:a=Reflect.apply(r,this,[a,l,s,this]),s++;return a}reduceRight(...n){const[r,i]=n;let s=i??this.at(-1);for(let a=this.size-1;a>=0;a--){const l=this.at(a);a===this.size-1&&n.length===1?s=l:s=Reflect.apply(r,this,[s,l,a,this])}return s}toSorted(n){const r=[...this.entries()].sort(n);return new Sl(r)}toReversed(){const n=new Sl;for(let r=this.size-1;r>=0;r--){const i=this.keyAt(r),s=this.get(i);n.set(i,s)}return n}toSpliced(...n){const r=[...this.entries()];return r.splice(...n),new Sl(r)}slice(n,r){const i=new Sl;let s=this.size-1;if(n===void 0)return i;n<0&&(n=n+this.size),r!==void 0&&r>0&&(s=r-1);for(let a=n;a<=s;a++){const l=this.keyAt(a),c=this.get(l);i.set(l,c)}return i}every(n,r){let i=0;for(const s of this){if(!Reflect.apply(n,r,[s,i,this]))return!1;i++}return!0}some(n,r){let i=0;for(const s of this){if(Reflect.apply(n,r,[s,i,this]))return!0;i++}return!1}},Ls=new WeakMap,ha(Sl,"OrderedDict"),Sl);function q_(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=Lle(e,t);return n===-1?void 0:e[n]}ha(q_,"at");function Lle(e,t){const n=e.length,r=N9(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}ha(Lle,"toSafeIndex");function N9(e){return e!==e||e===0?0:Math.trunc(e)}ha(N9,"toSafeInteger");function BDe(e){const t=e+"CollectionProvider",[n,r]=rl(t),[i,s]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new b5,setItemMap:ha(()=>{},"setItemMap")}),a=ha(({state:x,...w})=>x?o.jsx(c,{...w,state:x}):o.jsx(l,{...w}),"CollectionProvider");a.displayName=t;const l=ha(x=>{const w=y();return o.jsx(c,{...x,state:w})},"CollectionInit");l.displayName=t+"Init";const c=ha(x=>{const{scope:w,children:S,state:E}=x,k=p.useRef(null),[_,C]=p.useState(null),T=zr(k,C),[A,j]=E;return p.useEffect(()=>{if(!_)return;const L=Qle(()=>{});return L.observe(_,{childList:!0,subtree:!0}),()=>{L.disconnect()}},[_]),o.jsx(i,{scope:w,itemMap:A,setItemMap:j,collectionRef:T,collectionRefObject:k,collectionElement:_,children:S})},"CollectionProviderImpl");c.displayName=t+"Impl";const u=e+"CollectionSlot",d=Jf(u),f=p.forwardRef((x,w)=>{const{scope:S,children:E}=x,k=s(u,S),_=zr(w,k.collectionRef);return o.jsx(d,{ref:_,children:E})});f.displayName=u;const h=e+"CollectionItemSlot",m="data-radix-collection-item",g=Jf(h),b=p.forwardRef((x,w)=>{const{scope:S,children:E,...k}=x,_=p.useRef(null),[C,T]=p.useState(null),A=zr(w,_,T),j=s(h,S),{setItemMap:L}=j,I=p.useRef(k);$le(I.current,k)||(I.current=k);const M=I.current;return p.useEffect(()=>{const N=M;return L(D=>C?D.has(C)?D.set(C,{...N,element:C}).toSorted(i4):(D.set(C,{...N,element:C}),D.toSorted(i4)):D),()=>{L(D=>!C||!D.has(C)?D:(D.delete(C),new b5(D)))}},[C,M,L]),o.jsx(g,{[m]:"",ref:A,children:E})});b.displayName=h;function y(){return p.useState(new b5)}ha(y,"useInitCollection");function O(x){const{itemMap:w}=s(e+"CollectionConsumer",x);return w}return ha(O,"useCollection"),[{Provider:a,Slot:f,ItemSlot:b},{createCollectionScope:r,useCollection:O,useInitCollection:y}]}ha(BDe,"createCollection");function $le(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(t,i)||e[i]!==t[i])return!1;return!0}ha($le,"shallowEqual");function Ble(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}ha(Ble,"isElementPreceding");function i4(e,t){return!e[1].element||!t[1].element?0:Ble(e[1].element,t[1].element)?-1:1}ha(i4,"sortByDocumentPosition");function Qle(e){return new MutationObserver(n=>{for(const r of n)if(r.type==="childList"){e();return}})}ha(Qle,"getChildListObserver");var QDe=Object.defineProperty,q1=(e,t)=>QDe(e,"name",{value:t,configurable:!0}),Ule=!!(typeof window<"u"&&window.document&&window.document.createElement);function mn(e,t,{checkForDefaultPrevented:n=!0}={}){return q1(function(i){if(e==null||e(i),n===!1||!i||!i.defaultPrevented)return t==null?void 0:t(i)},"handleEvent")}q1(mn,"composeEventHandlers");function UDe(e){var t;if(!Ule)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}q1(UDe,"getOwnerWindow");function s4(e){if(!Ule)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}q1(s4,"getOwnerDocument");function Fle(e,t=!1){const{activeElement:n}=s4(e);if(!(n!=null&&n.nodeName))return null;if(zle(n)&&n.contentDocument)return Fle(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const i=s4(n).getElementById(r);if(i)return i}}return n}q1(Fle,"getActiveElement");function zle(e){return e.tagName==="IFRAME"}q1(zle,"isFrame");var Ic=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},FDe=Object.defineProperty,zDe=(e,t)=>FDe(e,"name",{value:t,configurable:!0}),LH=r0[" useEffectEvent ".trim().toString()],$H=r0[" useInsertionEffect ".trim().toString()];function Vle(e){if(typeof LH=="function")return LH(e);const t=p.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof $H=="function"?$H(()=>{t.current=e}):Ic(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}zDe(Vle,"useEffectEvent");var VDe=Object.defineProperty,YS=(e,t)=>VDe(e,"name",{value:t,configurable:!0}),HDe=r0[" useInsertionEffect ".trim().toString()]||Ic;function Bc({prop:e,defaultProp:t,onChange:n=YS(()=>{},"onChange"),caller:r}){const[i,s,a]=Hle({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:i,u=p.useCallback(d=>{var f;if(l){const h=qle(d)?d(e):d;h!==e&&((f=a.current)==null||f.call(a,h))}else s(d)},[l,e,s,a]);return[c,u]}YS(Bc,"useControllableState");function Hle({defaultProp:e,onChange:t}){const[n,r]=p.useState(e),i=p.useRef(n),s=p.useRef(t);return HDe(()=>{s.current=t},[t]),p.useEffect(()=>{var a;i.current!==n&&((a=s.current)==null||a.call(s,n),i.current=n)},[n,i]),[n,r,s]}YS(Hle,"useUncontrolledState");function qle(e){return typeof e=="function"}YS(qle,"isFunction");var BH=Symbol("RADIX:SYNC_STATE");function qDe(e,t,n,r){const{prop:i,defaultProp:s,onChange:a,caller:l}=t,c=i!==void 0,u=Vle(a),d=[{...n,state:s}];r&&d.push(r);const[f,h]=p.useReducer((y,O)=>{if(O.type===BH)return{...y,state:O.state};const v=e(y,O);return c&&!Object.is(v.state,y.state)&&u(v.state),v},...d),m=f.state,g=p.useRef(m);p.useEffect(()=>{g.current!==m&&(g.current=m,c||u(m))},[m,g,c]);const b=p.useMemo(()=>i!==void 0?{...f,state:i}:f,[f,i]);return p.useEffect(()=>{c&&!Object.is(i,f.state)&&h({type:BH,state:i})},[i,f.state,c]),[b,h]}YS(qDe,"useControllableStateReducer");var XDe=Object.defineProperty,eh=(e,t)=>XDe(e,"name",{value:t,configurable:!0});function Xle(e,t){return p.useReducer((n,r)=>t[n][r]??n,e)}eh(Xle,"useStateMachine");var Ed=eh(e=>{const{present:t,children:n}=e,r=Gle(t),i=typeof n=="function"?n({present:r.isPresent}):p.Children.only(n),s=Wle(r.ref,Yle(i));return typeof n=="function"||r.isPresent?p.cloneElement(i,{ref:s}):null},"Presence");function Gle(e){const[t,n]=p.useState(),r=p.useRef(null),i=p.useRef(e),s=p.useRef("none"),a=p.useRef(void 0),l=e?"mounted":"unmounted",[c,u]=Xle(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{c==="mounted"?(s.current=a.current??mb(r.current),a.current=void 0):s.current="none"},[c]),Ic(()=>{const d=r.current,f=i.current;if(f!==e){const m=s.current,g=mb(d);e?(a.current=g,u("MOUNT")):g==="none"||(d==null?void 0:d.display)==="none"?u("UNMOUNT"):u(f&&m!==g?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,u]),Ic(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,h=eh(g=>{const y=mb(r.current).includes(CSS.escape(g.animationName));if(g.target===t&&y&&(u("ANIMATION_END"),!i.current)){const O=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=O)})}},"handleAnimationEnd"),m=eh(g=>{g.target===t&&(s.current=mb(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:p.useCallback(d=>{if(d){const f=getComputedStyle(d);r.current=f,a.current=mb(f)}else r.current=null;n(d)},[])}}eh(Gle,"usePresence");function a4(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}eh(a4,"setRef");function Wle(...e){const t=p.useRef(e);return t.current=e,p.useCallback(n=>{const r=t.current;let i=!1;const s=r.map(a=>{const l=a4(a,n);return!i&&typeof l=="function"&&(i=!0),l});if(i)return()=>{for(let a=0;aGDe(e,"name",{value:t,configurable:!0}),YDe=r0[" useId ".trim().toString()]||(()=>{}),ZDe=0;function Fp(e){const[t,n]=p.useState(YDe());return Ic(()=>{e||n(r=>r??String(ZDe++))},[e]),e||(t?`radix-${t}`:"")}WDe(Fp,"useId");var KDe=Object.defineProperty,JDe=(e,t)=>KDe(e,"name",{value:t,configurable:!0}),ePe=p.createContext(void 0);function ZS(e){const t=p.useContext(ePe);return e||t||"ltr"}JDe(ZS,"useDirection");var tPe=Object.defineProperty,nPe=(e,t)=>tPe(e,"name",{value:t,configurable:!0});function yu(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}nPe(yu,"useCallbackRef");var rPe=Object.defineProperty,da=(e,t)=>rPe(e,"name",{value:t,configurable:!0}),o4="dismissableLayer.update",iPe="dismissableLayer.pointerDownOutside",sPe="dismissableLayer.focusOutside",QH,Zle=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),j9=p.forwardRef(da(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:l,onInteractOutside:c,onDismiss:u,...d}=t,f=p.useContext(Zle),[h,m]=p.useState(null),g=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=p.useState({}),y=zr(n,m),O=Array.from(f.layers),[v]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),x=v?O.indexOf(v):-1,w=h?O.indexOf(h):-1,S=f.layersWithOutsidePointerEventsDisabled.size>0,E=w>=x,k=p.useRef(!1),_=Kle(j=>{a==null||a(j),c==null||c(j),j.defaultPrevented||u==null||u()},{ownerDocument:g,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:k,dismissableSurfaces:f.dismissableSurfaces,shouldHandlePointerDownOutside:p.useCallback(j=>{if(!(j instanceof Node))return!1;const L=[...f.branches].some(I=>I.contains(j));return E&&!L},[f.branches,E])}),C=Jle(j=>{if(i&&k.current)return;const L=j.target;[...f.branches].some(M=>M.contains(L))||(l==null||l(j),c==null||c(j),j.defaultPrevented||u==null||u())},g),T=h?w===O.length-1:!1,A=yu(j=>{j.key==="Escape"&&(s==null||s(j),!j.defaultPrevented&&u&&(j.preventDefault(),u()))});return p.useEffect(()=>{if(T)return g.addEventListener("keydown",A,{capture:!0}),()=>g.removeEventListener("keydown",A,{capture:!0})},[g,T,A]),p.useEffect(()=>{if(h)return r&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(QH=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(h)),f.layers.add(h),l4(),()=>{r&&(f.layersWithOutsidePointerEventsDisabled.delete(h),f.layersWithOutsidePointerEventsDisabled.size===0&&(g.body.style.pointerEvents=QH))}},[h,g,r,f]),p.useEffect(()=>()=>{h&&(f.layers.delete(h),f.layersWithOutsidePointerEventsDisabled.delete(h),l4())},[h,f]),p.useEffect(()=>{const j=da(()=>b({}),"handleUpdate");return document.addEventListener(o4,j),()=>document.removeEventListener(o4,j)},[]),o.jsx(pi.div,{...d,ref:y,style:{pointerEvents:S?E?"auto":"none":void 0,...t.style},onFocusCapture:mn(t.onFocusCapture,C.onFocusCapture),onBlurCapture:mn(t.onBlurCapture,C.onBlurCapture),onPointerDownCapture:mn(t.onPointerDownCapture,_.onPointerDownCapture)})},"DismissableLayer"));function aPe(){const e=p.useContext(Zle),[t,n]=p.useState(null);return p.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}da(aPe,"useDismissableLayerSurface");var oPe=da(()=>!0,"IS_TRUE");function Kle(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:s,shouldHandlePointerDownOutside:a=oPe}=t,l=yu(e),c=p.useRef(!1),u=p.useRef(!1),d=p.useRef(new Map),f=p.useRef(()=>{});return p.useEffect(()=>{function h(){u.current=!1,i.current=!1,d.current.clear()}da(h,"resetOutsideInteraction");function m(){return Array.from(d.current.values()).some(Boolean)}da(m,"isOutsideInteractionIntercepted");function g(x){if(!u.current)return;const w=x.target;w instanceof Node&&[...s].some(E=>E.contains(w))||d.current.set(x.type,!0),x.type==="click"&&window.setTimeout(()=>{u.current&&f.current()},0)}da(g,"handleInteractionCapture");function b(x){u.current&&d.current.set(x.type,!1)}da(b,"handleInteractionBubble");const y=da(x=>{if(x.target&&!c.current){let w=function(){n.removeEventListener("click",f.current);const E=m();h(),E||R9(iPe,l,S,{discrete:!0})};if(da(w,"handleAndDispatchPointerDownOutsideEvent"),!a(x.target)){n.removeEventListener("click",f.current),h(),c.current=!1;return}const S={originalEvent:x};u.current=!0,i.current=r&&x.button===0,d.current.clear(),!r||x.button!==0?w():(n.removeEventListener("click",f.current),f.current=w,n.addEventListener("click",f.current,{once:!0}))}else n.removeEventListener("click",f.current),h();c.current=!1},"handlePointerDown"),O=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const x of O)n.addEventListener(x,g,!0),n.addEventListener(x,b);const v=window.setTimeout(()=>{n.addEventListener("pointerdown",y)},0);return()=>{window.clearTimeout(v),n.removeEventListener("pointerdown",y),n.removeEventListener("click",f.current);for(const x of O)n.removeEventListener(x,g,!0),n.removeEventListener(x,b)}},[n,l,r,i,s,a]),{onPointerDownCapture:da(()=>c.current=!0,"onPointerDownCapture")}}da(Kle,"usePointerDownOutside");function Jle(e,t=globalThis==null?void 0:globalThis.document){const n=yu(e),r=p.useRef(!1);return p.useEffect(()=>{const i=da(s=>{s.target&&!r.current&&R9(sPe,n,{originalEvent:s},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:da(()=>r.current=!0,"onFocusCapture"),onBlurCapture:da(()=>r.current=!1,"onBlurCapture")}}da(Jle,"useFocusOutside");function l4(){const e=new CustomEvent(o4);document.dispatchEvent(e)}da(l4,"dispatchUpdate");function R9(e,t,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?C9(i,s):i.dispatchEvent(s)}da(R9,"handleAndDispatchCustomEvent");var lPe=Object.defineProperty,Oo=(e,t)=>lPe(e,"name",{value:t,configurable:!0}),y5="focusScope.autoFocusOnMount",O5="focusScope.autoFocusOnUnmount",UH={bubbles:!1,cancelable:!0},ece=p.forwardRef(Oo(function(t,n){const{loop:r=!1,trapped:i=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...l}=t,[c,u]=p.useState(null),d=yu(s),f=yu(a),h=p.useRef(null),m=zr(n,u),g=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(i){let y=function(w){if(g.paused||!c)return;const S=w.target;c.contains(S)?h.current=S:lf(h.current,{select:!0})},O=function(w){if(g.paused||!c)return;const S=w.relatedTarget;S!==null&&(c.contains(S)||lf(h.current,{select:!0}))},v=function(w){if(document.activeElement===document.body)for(const E of w)E.removedNodes.length>0&&lf(c)};Oo(y,"handleFocusIn"),Oo(O,"handleFocusOut"),Oo(v,"handleMutations"),document.addEventListener("focusin",y),document.addEventListener("focusout",O);const x=new MutationObserver(v);return c&&x.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",O),x.disconnect()}}},[i,c,g.paused]),p.useEffect(()=>{if(c){FH.add(g);const y=document.activeElement;if(!c.contains(y)){const v=new CustomEvent(y5,UH);c.addEventListener(y5,d),c.dispatchEvent(v),v.defaultPrevented||(tce(ace(I9(c)),{select:!0}),document.activeElement===y&&lf(c))}return()=>{c.removeEventListener(y5,d),setTimeout(()=>{const v=new CustomEvent(O5,UH);c.addEventListener(O5,f),c.dispatchEvent(v),v.defaultPrevented||lf(y??document.body,{select:!0}),c.removeEventListener(O5,f),FH.remove(g)},0)}}},[c,d,f,g]);const b=p.useCallback(y=>{if(!r&&!i||g.paused)return;const O=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,v=document.activeElement;if(O&&v){const x=y.currentTarget,[w,S]=nce(x);w&&S?!y.shiftKey&&v===S?(y.preventDefault(),r&&lf(w,{select:!0})):y.shiftKey&&v===w&&(y.preventDefault(),r&&lf(S,{select:!0})):v===x&&y.preventDefault()}},[r,i,g.paused]);return o.jsx(pi.div,{tabIndex:-1,...l,ref:m,onKeyDown:b})},"FocusScope"));function tce(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(lf(r,{select:t}),document.activeElement!==n)return}Oo(tce,"focusFirst");function nce(e){const t=I9(e),n=c4(t,e),r=c4(t.reverse(),e);return[n,r]}Oo(nce,"getTabbableEdges");function I9(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:Oo(r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}Oo(I9,"getTabbableCandidates");function c4(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):rce(r,{upTo:t})))return r}Oo(c4,"findVisible");function rce(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}Oo(rce,"isHidden");function ice(e){return e instanceof HTMLInputElement&&"select"in e}Oo(ice,"isSelectableInput");function lf(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ice(e)&&t&&e.select()}}Oo(lf,"focus");var FH=sce();function sce(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=u4(e,t),e.unshift(t)},remove(t){var n;e=u4(e,t),(n=e[0])==null||n.resume()}}}Oo(sce,"createFocusScopesStack");function u4(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}Oo(u4,"arrayRemove");function ace(e){return e.filter(t=>t.tagName!=="A")}Oo(ace,"removeLinks");var cPe=Object.defineProperty,uPe=(e,t)=>cPe(e,"name",{value:t,configurable:!0}),D9=p.forwardRef(uPe(function(t,n){var c;const{container:r,...i}=t,[s,a]=p.useState(!1);Ic(()=>a(!0),[]);const l=r||s&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return l?Cr.createPortal(o.jsx(pi.div,{...i,ref:n}),l):null},"Portal")),dPe=Object.defineProperty,P9=(e,t)=>dPe(e,"name",{value:t,configurable:!0}),Gk=0,$u=null;function fPe(e){return UN(),e.children}P9(fPe,"FocusGuards");function UN(){p.useEffect(()=>{$u||($u={start:d4(),end:d4()});const{start:e,end:t}=$u;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Gk++,()=>{Gk===1&&($u==null||$u.start.remove(),$u==null||$u.end.remove(),$u=null),Gk=Math.max(0,Gk-1)}},[])}P9(UN,"useFocusGuards");function d4(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}P9(d4,"createFocusGuard");var Gu=function(){return Gu=Object.assign||function(t){for(var n,r=1,i=arguments.length;r"u")return APe;var t=NPe(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},RPe=uce(),hy="data-scroll-locked",IPe=function(e,t,n,r){var i=e.left,s=e.top,a=e.right,l=e.gap;return n===void 0&&(n="margin"),` - .`.concat(pPe,` { +${r}`}}async function u9(e,t=!1){const n=await St(`/web/model-api-keys${t?"?refresh=true":""}`,{signal:e,cache:"no-store"});if(!n.ok)throw new Error(await Wt(n,"加载 Ark API Key 失败"));return await n.json()}async function Gae(e,t){const n=await St(`/web/model-api-keys/${encodeURIComponent(e)}/value`,{method:"POST",signal:t,cache:"no-store"});if(!n.ok)throw new Error(await Wt(n,"加载 Ark API Key 失败"));return await n.json()}async function U1(e){const t=new URLSearchParams;e!=null&&e.apiKeyId&&t.set("apiKeyId",e.apiKeyId),e!=null&&e.refresh&&t.set("refresh","true");const n=t.toString(),r=await St(`/web/model-options${n?`?${n}`:""}`,{signal:e==null?void 0:e.signal,cache:"no-store"});if(!r.ok)throw new Error(await Wt(r,"加载模型列表失败"));return await r.json()}async function Wae(){const e=await St("/list-apps");if(!e.ok)throw new Error(`list-apps failed: ${e.status}`);return e.json()}class F1 extends Error{constructor(){super("当前账号无权访问该 Runtime,请刷新列表或重新登录后重试。"),this.name="RuntimeAccessDeniedError"}}class Es extends Error{constructor(t,n=!1,r=!1){super(t),this.unsupported=n,this.retryable=r,this.name="RuntimeProbeError"}}const Yae="Runtime 已部署成功,但当前 Studio 无法访问私网 Runtime。请使用已绑定相同 VPC 的 Studio 访问,或改用公网 / 公网+VPC 部署。",Zae="Runtime 已部署成功,但 Studio 暂时无法连接服务。网关域名可能仍在生效,或当前网络/DNS 无法访问该 Runtime,请稍后在智能体管理页重试连接。",kH=["cn-beijing","cn-shanghai"],b5e=3e4,z1=5*60*1e3,Kae=60*1e3;let Sw="volcengine";const dy=new Map,Fm=new Map,zm=new Map,ou=new Map,xi=new Map;function d9(e,t,n){return`${t}:${e}:${n??""}`}function Jae(e){e!==Sw&&xi.clear(),Sw=e}function GS(e){const t=(e||"").trim();if(Sw==="byteplus")return[t&&!t.startsWith("cn-")?t:BM];const n=t&&!t.startsWith("ap-")?t:s9;return kH.includes(n)?[n,...kH.filter(r=>r!==n)]:[n]}function DN(e){const t=(e||"").trim();return t?[t]:GS()}function u0(...e){return e.map(t=>String(t??"")).join("")}function cm(e,t,n){const r=e.get(t);return r!=null&&r.value&&Date.now()-r.updatedAt<=n?r.value:null}function f9(e,t,n){return e.set(t,{value:n,updatedAt:Date.now()}),n}function Hk(e,t){return t?t.aborted?Promise.reject(new DOMException("The operation was aborted.","AbortError")):new Promise((n,r)=>{const i=()=>{r(new DOMException("The operation was aborted.","AbortError"))};t.addEventListener("abort",i,{once:!0}),e.then(s=>{t.removeEventListener("abort",i),n(s)},s=>{t.removeEventListener("abort",i),r(s)})}):e}async function eoe(e){try{const t=await e.clone().json();return typeof t.detail=="string"?t.detail:""}catch{return""}}async function WS(e,t,n,r,i=Ao){const s=await St("/list-apps",{signal:r},n??{base:e,apiKey:t},i),a=n!=null&&n.runtimeId?await eoe(s):"";if(n!=null&&n.runtimeId&&a==="runtime_access_denied")throw new F1;if(n!=null&&n.runtimeId&&a==="runtime_private_endpoint_unreachable")throw new Es(Yae);if(n!=null&&n.runtimeId&&["runtime_proxy_connect_error","runtime_proxy_timeout","runtime_json_connect_error","runtime_json_timeout"].includes(a))throw new Es(Zae,!1,!0);if(n!=null&&n.runtimeId&&s.status===404)throw new Es("该 Runtime 的 Agent Server 未提供连接接口,请确认 Runtime 已就绪且版本兼容。",!0,!0);if(n!=null&&n.runtimeId&&(s.status===401||s.status===403))throw new Es("Runtime 服务拒绝了连接请求,请检查 Runtime 的鉴权配置。");if(!s.ok)throw new Error(await Wt(s,"读取 Agent 列表失败"));let l;try{l=await s.json()}catch{throw new Es("Runtime /list-apps 返回了无法解析的 JSON 响应。")}if(!Array.isArray(l)||l.some(u=>typeof u!="string"||!u.trim()))throw new Es("Runtime /list-apps 返回格式无效,应为非空字符串数组。");const c=l.map(u=>u.trim());return n!=null&&n.runtimeId&&dy.set(d9(n.runtimeId,n.region??"",n.runtimeVersion),{apps:c,expiresAt:Date.now()+b5e}),c}async function toe(e,t){const{app:n,ep:r}=Vl(e),i=await St(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"},r);if(!i.ok){const a=`创建会话失败 (${i.status})`,l=await Wt(i,"创建会话失败");throw new Error(l===a?a:`${a}:${l}`)}return(await i.json()).id}async function h9(e,t){const{app:n,ep:r}=Vl(e),i=await St(`/apps/${n}/users/${encodeURIComponent(t)}/sessions`,{},r);if(!i.ok)throw new Error(`list sessions failed: ${i.status}`);return i.json()}async function PN(e,t,n){const{app:r,ep:i}=Vl(e),s=await St(`/apps/${r}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}`,{},i);if(!s.ok){const l=await Wt(s,"读取会话失败");throw new Error(`get session failed: ${s.status}:${l}`)}const a=await s.json();if(i.runtimeId){const l=o9(i.runtimeId,r,t,n);a.state={...l9()[l]??{},...a.state??{}}}return a}async function noe(e){const{app:t,ep:n}=Vl(e.appName);if(!n.runtimeId)throw new Error("只有连接到 AgentKit Runtime 的会话支持反馈回流");if(!n.region)throw new Error("Runtime 缺少地域信息,无法提交反馈");const r=await St("/web/evaluation/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:n.runtimeId,region:n.region,appName:t,userId:e.userId,sessionId:e.sessionId,eventId:e.eventId,rating:e.rating,comment:e.comment??""})},{},Zi);if(!r.ok)throw new Error(await Wt(r,"提交反馈失败"));const i=await r.json(),s=o9(n.runtimeId,t,e.userId,e.sessionId);return m5e(s,e.eventId,i),i}async function MN(e,t={}){const n=u0(e.runtimeId,e.region||"cn-beijing",e.appName,e.pageSize??100),r=cm(ou,n,Kae);if(!t.force&&r)return r;const i=ou.get(n);if(!t.force&&(i!=null&&i.promise))return i.promise;let s=null;const a=(async()=>{for(const l of DN(e.region)){const c=new URLSearchParams({runtimeId:e.runtimeId,region:l,appName:e.appName,page_size:String(e.pageSize??100)}),u=await St(`/web/evaluation/feedback-cases?${c.toString()}`);if(u.ok)return f9(ou,n,await u.json());s=new Error(await Wt(u,"读取评测集失败"))}throw s??new Error("读取评测集失败")})();ou.set(n,{...i,promise:a,updatedAt:(i==null?void 0:i.updatedAt)??0});try{return await a}finally{const l=ou.get(n);(l==null?void 0:l.promise)===a&&ou.set(n,{value:l.value,updatedAt:l.updatedAt})}}async function QM(e){let t=null;for(const n of DN(e.region)){const r=new URLSearchParams({runtimeId:e.runtimeId,region:n,appName:e.appName,userId:e.userId}),i=await St(`/web/evaluation/statuses?${r.toString()}`);if(i.ok)return i.json();t=new Error(await Wt(i,"读取自动评测状态失败"))}throw t??new Error("读取自动评测状态失败")}async function roe(e){let t=null;for(const n of DN(e.region)){const r=new URLSearchParams({runtimeId:e.runtimeId,region:n,appName:e.appName}),i=await St(`/web/evaluation/optimizations?${r.toString()}`);if(i.ok)return i.json();t=new Error(await Wt(i,"读取优化项失败"))}throw t??new Error("读取优化项失败")}function ioe(e){return cm(ou,u0(e.runtimeId,e.region||"cn-beijing",e.appName,e.pageSize??100),Kae)}function y5e(e){MN(e).catch(()=>{})}function soe(e){MN(e,{force:!0}).catch(()=>{})}function aoe(e,t){return["good","bad"].map(n=>{const r=e.find(i=>i.kind===n);return{kind:n,evaluationSetId:(r==null?void 0:r.evaluationSetId)??null,evaluationSetName:(r==null?void 0:r.evaluationSetName)??null,workspaceId:(r==null?void 0:r.workspaceId)??null,itemCount:t.filter(i=>i.kind===n).length}})}function F_(e){const t=e.comment??"",n=e.rating==="bad"&&!!t.trim();for(const[r,i]of ou.entries()){const s=i.value;if(!s||s.runtimeId!==e.runtimeId||s.agentName!==e.appName)continue;const a=s.items.filter(c=>c.sessionId!==e.sessionId||c.messageId!==e.messageId),l=e.rating?[{id:`local:${e.runtimeId}:${e.sessionId}:${e.messageId}`,itemKey:`local:${e.messageId}`,kind:e.rating,input:e.input,output:e.output,referenceOutput:e.referenceOutput??e.output,comment:t,agentName:e.appName,sessionId:e.sessionId,messageId:e.messageId,runtimeId:e.runtimeId,invocationId:e.invocationId??"",userId:e.userId,createdAt:e.createdAt??new Date().toISOString(),evaluationSetId:"",evaluationSetName:"",workspaceId:"",source:"user",score:n?0:null,reason:n?t:""},...a]:a;ou.set(r,{value:{...s,sets:aoe(s.sets,l),items:l},updatedAt:Date.now(),promise:i.promise})}}async function ooe(e){let t=null;for(const n of DN(e.region)){const r=await St("/web/evaluation/feedback-cases/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e.runtimeId,region:n,appName:e.appName,itemIds:e.itemIds})},{},Zi);if(r.ok){const i=await r.json(),s=new Set(e.itemIds);for(const[a,l]of ou.entries()){const c=l.value;if(!c||c.runtimeId!==e.runtimeId||c.agentName!==e.appName)continue;const u=c.items.filter(d=>!s.has(d.id));ou.set(a,{value:{...c,sets:aoe(c.sets,u),items:u},updatedAt:Date.now()})}return i}t=new Error(await Wt(r,"删除评测案例失败"))}throw t??new Error("删除评测案例失败")}async function UM(e,t,n){const{app:r,ep:i}=Vl(e),s=await St(`/apps/${r}/users/${encodeURIComponent(t)}/sessions/${n}`,{method:"DELETE"},i);if(!s.ok&&s.status!==404)throw new Error(`delete session failed: ${s.status}`)}function O5e(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"="),r=window.atob(n),i=new Uint8Array(r.length);for(let s=0;sURL.revokeObjectURL(l),0)}async function loe(e,t,n,r,i){const{app:s,ep:a}=Vl(e),l=i==null?"":`?version=${encodeURIComponent(i)}`,c=`/apps/${encodeURIComponent(s)}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}/artifacts/${encodeURIComponent(r)}${l}`,u=await St(c,{},a,Zi);if(!u.ok)throw new Error(await Wt(u,"下载文件失败"));const d=await u.json(),f=d.inlineData??d.inline_data;if(!(f!=null&&f.data))throw new Error("文件内容不可用");const h=O5e(f.data),m=h.buffer.slice(h.byteOffset,h.byteOffset+h.byteLength);return{blob:new Blob([m],{type:f.mimeType??f.mime_type??"application/octet-stream"}),downloadName:f.displayName??f.display_name??r}}async function m9(e,t,n,r,i){const{blob:s}=await loe(e,t,n,r,i);return URL.createObjectURL(s)}async function x5e(e){const t=await St("/web/media/capabilities");if(!t.ok)throw new Error(await Wt(t,"media capabilities failed"));return t.json()}async function coe(e,t,n,r){const{app:i}=Vl(e),s=new FormData;s.set("app_name",i),s.set("user_id",t),s.set("session_id",n),s.set("file",r);const a=await St("/web/media",{method:"POST",body:s},{},Zi);if(!a.ok)throw new Error(await Wt(a,"文件上传失败"));return{...await a.json(),status:"ready"}}async function FM(e,t,n){const{app:r}=Vl(e),i=`/web/media/${encodeURIComponent(r)}/${encodeURIComponent(t)}/${encodeURIComponent(n)}/delete`,s=await St(i,{method:"POST"});if(!s.ok&&s.status!==404)throw new Error(await Wt(s,"media cleanup failed"))}function uoe(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,i)=>![1,3,5].includes(i)).join("/")}`}catch{return}}async function z_(e,t){const n=uoe(t);if(!n)throw new Error("Invalid VeADK media URI");const r=await St(`${n}/delete`,{method:"POST"});if(!r.ok&&r.status!==404)throw new Error(await Wt(r,"media cleanup failed"))}function doe(e,t){if(t.startsWith("data:")||t.startsWith("blob:")||/^https?:/.test(t))return t;const n=uoe(t);if(!n)return t;const r=`${n}/content`;return So(`${U_}${r}`)}async function xC(e,t,n){const{app:r,ep:i}=Vl(e);let s;if(i.runtimeId){const c=new URLSearchParams({runtimeId:i.runtimeId,sessionId:t,region:i.region??"cn-beijing"});if(n&&c.set("endTimeMs",String(Math.round(n))),s=await St(`/web/runtime-trace?${c.toString()}`),s.status===404)throw new Error("该 Agent 暂未开启链路观测,请到控制台打开后使用。")}else s=await St(`/dev/apps/${encodeURIComponent(r)}/debug/trace/session/${encodeURIComponent(t)}`,{},i);if(!s.ok)throw new Error(await Wt(s,"加载调用链路失败"));const a=s.headers.get("content-type")??"";if(!a.includes("application/json")){const c=a.split(";",1)[0]||"Content-Type 缺失";throw new Error(`trace failed: 服务端返回了非 JSON 响应(${c}),请检查 Studio API 代理配置`)}const l=await s.json();if(!Array.isArray(l))throw new Error("trace failed: 返回格式无效");return l}async function zM(e){const t=await St("/web/issue-feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(await Wt(t,"问题反馈上报失败"));if((await t.json()).submitted!==!0)throw new Error("问题反馈上报失败:服务端未确认提交结果");return{submitted:!0}}async function foe(e,t,n=!0){const r=await St(`/web/agent-info/${e}`,{},t);if(!r.ok)throw new Error(`agent-info failed: ${r.status}`);const i=await r.json();if(n&&!i.draft)try{const s=await St(`/web/agent-draft/${e}`,{},t);if(s.ok){const a=await s.json();i.draft=a.draft}}catch{}return{appName:e,name:i.name??e,description:i.description??"",type:i.type,model:i.model??"",tools:i.tools??[],skillsPreviewSupported:Array.isArray(i.skills),skills:i.skills??[],subAgents:i.subAgents??[],components:i.components??[],searchSources:i.searchSources??[],graph:i.graph,draft:i.draft}}async function VM(e){const{app:t,ep:n}=Vl(e);return foe(t,n,!1)}async function v5e(e,t,n){let r=null;for(const i of GS(t)){const s={runtimeId:e,region:i};try{const a=d9(e,i),l=dy.get(a);l&&l.expiresAt<=Date.now()&&dy.delete(a);const c=dy.get(a),u=n||(c==null?void 0:c.apps[0])||(await WS("","",s))[0];if(!u)throw new Error("该 Runtime 未提供可预览的 Agent。");return foe(u,s)}catch(a){if(a instanceof F1||a instanceof Es&&!a.unsupported)throw a;r=a instanceof Error?a:new Error(String(a))}}throw r??new Error("该 Runtime 未提供可预览的 Agent。")}async function g9(e,t,n={},r={}){const i=typeof n=="string"?n:void 0,s=typeof n=="string"?r:n,a=u0(e,t||"cn-beijing",i??""),l=cm(Fm,a,z1);if(!s.force&&l)return l;const c=Fm.get(a);if(!s.force&&(c!=null&&c.promise))return c.promise;const u=v5e(e,t,i).then(d=>f9(Fm,a,d));Fm.set(a,{...c,promise:u,updatedAt:(c==null?void 0:c.updatedAt)??0});try{return await u}finally{const d=Fm.get(a);(d==null?void 0:d.promise)===u&&Fm.set(a,{value:d.value,updatedAt:d.updatedAt})}}function hoe(e,t,n=""){return cm(Fm,u0(e,t||"cn-beijing",n),z1)}function poe(e,t,n=""){g9(e,t,n).catch(()=>{})}async function moe(e,t,n,r){const{app:i,ep:s}=Vl(e),a=new URLSearchParams({source:t,app_name:i,q:n,user_id:r}),l=await St(`/web/search?${a.toString()}`,{},s);if(!l.ok)throw new Error(await Wt(l,"Agent 检索失败"));return l.json()}async function goe(e,t){const{app:n}=Vl(e),r=await St(`/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()}const boe=ff("HTTP 200,SSE 响应体为空。"),V_=ff("HTTP 200,SSE 响应中没有可展示的模型回复。"),w5e=3e4,Ky=ff("30 秒内未收到首个 SSE 事件。");function yoe(e){if(e!=null&&e.aborted)return{signal:e,clearDeadline:()=>{},cleanup:()=>{},timedOut:()=>!1};const t=new AbortController;let n=!1,r=!1;const i=()=>{r||(r=!0,clearTimeout(a))},s=()=>{t.signal.aborted||t.abort((e==null?void 0:e.reason)??new DOMException("Aborted","AbortError"))},a=setTimeout(()=>{r||t.signal.aborted||(n=!0,r=!0,t.abort(new Error(Ky)))},w5e);return e==null||e.addEventListener("abort",s,{once:!0}),{signal:t.signal,clearDeadline:i,cleanup:()=>{i(),e==null||e.removeEventListener("abort",s)},timedOut:()=>n}}async function*HM({appName:e,userId:t,sessionId:n,text:r,attachments:i=[],invocation:s,platformTools:a,environmentMounts:l,environmentMount:c,functionResponses:u=[],signal:d,onRuntimeContext:f}){const{app:h,ep:m}=Vl(e),g=i.flatMap(S=>S.status&&S.status!=="ready"?[]:S.uri?[{fileData:{mimeType:S.mimeType,fileUri:S.uri,displayName:S.name},partMetadata:{veadkMedia:{id:S.id,uri:S.uri,name:S.name,mimeType:S.mimeType,sizeBytes:S.sizeBytes}}}]:S.data?[{inlineData:{mimeType:S.mimeType,data:S.data,displayName:S.name}}]:[]),b=s&&(s.skills.length>0||s.targetAgent)?s:void 0,y=[...g,...u.map(S=>({functionResponse:{id:S.id,name:S.name,response:S.response}})),...r.trim()?[{text:r}]:[]];if(b&&y.length>0){const S=y[0],E=S.partMetadata;y[0]={...S,partMetadata:{...E,veadkInvocation:b}}}let O;const v=yoe(d);try{O=await St("/run_sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({app_name:h,user_id:t,session_id:n,new_message:{role:"user",parts:y},streaming:!0,...a!==void 0?{platform_tools:[...a]}:{},...l!==void 0?{environment_mounts:[...l]}:c?{environment_mount:c}:{},custom_metadata:b?{veadkInvocation:b}:void 0}),signal:v.signal},m,0)}catch(S){throw v.cleanup(),v.timedOut()?new Error(Ky):d!=null&&d.aborted||(S==null?void 0:S.name)==="AbortError"?S:new Error(ff(S))}const x=$Ie(O,m.runtimeId??"",m.region??"");if(x&&(f==null||f(x)),!O.ok){v.cleanup();const S=await Wt(O,"运行会话失败");throw new Error(ff(`run_sse failed: ${O.status}:${S}`))}let w=!1;try{for await(const S of IN(O)){w=!0,v.clearDeadline();const E=S;typeof E.error=="string"&&(E.error=ff(E.error)),typeof E.errorMessage=="string"&&(E.errorMessage=ff(E.errorMessage)),typeof E.error_message=="string"&&(E.error_message=ff(E.error_message)),yield E}}catch(S){throw v.timedOut()?new Error(Ky):d!=null&&d.aborted||(S==null?void 0:S.name)==="AbortError"?S:new Error(ff(S))}finally{v.cleanup()}if(!w)throw new Error(boe)}async function LN(e,t){const n=new URLSearchParams({name:e,region:t}),r=await St(`/web/runtime-name-availability?${n.toString()}`,{cache:"no-store"});if(!r.ok)throw new Error(await Wt(r,"检查 Runtime 名称失败"));const i=await r.json();if(typeof i.available!="boolean")throw new Error("检查 Runtime 名称失败:服务返回格式错误");return{available:i.available}}async function Ooe(e,t){const n=new URLSearchParams({kind:e.kind,region:e.region});e.registry&&n.set("registry",e.registry),e.namespace&&n.set("namespace",e.namespace),e.workspaceId&&n.set("workspaceId",e.workspaceId),e.search&&n.set("search",e.search),e.pageNumber&&n.set("pageNumber",String(e.pageNumber)),e.pageSize&&n.set("pageSize",String(e.pageSize));const r=await St(`/web/deployment-resources?${n.toString()}`,{signal:t});if(!r.ok)throw new Error(await Wt(r,"加载云资源失败"));const i=await r.json();if(typeof i.serviceRegion!="string"||!Array.isArray(i.items)||typeof i.pageNumber!="number"||typeof i.pageSize!="number"||typeof i.totalCount!="number"||typeof i.hasMore!="boolean")throw new Error("云资源列表响应格式无效");const s=i.items.map(a=>{if(!a||typeof a!="object"||typeof a.id!="string"||typeof a.name!="string"||typeof a.region!="string"||typeof a.status!="string")throw new Error("云资源列表响应格式无效");return a});return{serviceRegion:i.serviceRegion,items:s,pageNumber:i.pageNumber,pageSize:i.pageSize,totalCount:i.totalCount,hasMore:i.hasMore}}function b9(e){const t=new Set,n=[];for(const r of e.split(/[,,\n\r]+/)){const i=r.trim();!i||t.has(i)||(t.add(i),n.push(i))}return n}async function xoe(e,t=typeof navigator>"u"?void 0:navigator.clipboard){if(!(t!=null&&t.writeText))throw new Error("当前浏览器不支持写入剪贴板。");try{await t.writeText(e)}catch{throw new Error("无法写入剪贴板,请检查剪贴板权限。")}}const _H={codex:0,codex_snapshot:1,deepseek_harness:2,deepseek_harness_snapshot:3,openclaw:4,openclaw_snapshot:5,hermes:6,hermes_snapshot:7,dev:8};async function voe(e){var i;const t=await St("/web/system-info",{signal:e});if(!t.ok)throw new Error(await Wt(t,"加载系统信息失败"));const n=await t.json();if(typeof((i=n.storage)==null?void 0:i.tosAddress)!="string"||!Array.isArray(n.sandboxTools))throw new Error("系统信息响应格式无效");const r=n.sandboxTools.map(s=>{if(!s||typeof s!="object"||typeof s.kind!="string"||typeof s.label!="string"||typeof s.toolId!="string"||typeof s.snapshot!="boolean"||typeof s.needsModelEnvUpdate!="boolean"||typeof s.canUpdateModelEnv!="boolean"||typeof s.modelEnvError!="string"||typeof s.modelEnvErrorCode!="string")throw new Error("系统信息响应格式无效");return s}).sort((s,a)=>(_H[s.kind]??Number.MAX_SAFE_INTEGER)-(_H[a.kind]??Number.MAX_SAFE_INTEGER));return{storage:{tosAddress:n.storage.tosAddress},sandboxTools:r}}const woe=new Set(["preparing","queued","building","scanning","available","failed"]);function y9(e){if(e===null)return null;if(!e||typeof e!="object")throw new Error("环境构建响应格式无效");const t=e;if(typeof t.versionId!="string"||!woe.has(t.status)||typeof t.image!="string"||typeof t.error!="string"||typeof t.createdAt!="string"||typeof t.updatedAt!="string"||t.resources!==null&&typeof t.resources!="object")throw new Error("环境构建响应格式无效");const n=Array.isArray(t.steps)?t.steps.map(r=>{if(!r||typeof r!="object"||typeof r.key!="string"||typeof r.label!="string"||!["pending","running","succeeded","failed"].includes(r.status)||r.startedAt!==null&&typeof r.startedAt!="string"||r.finishedAt!==null&&typeof r.finishedAt!="string")throw new Error("环境构建步骤响应格式无效");return r}):[];return{...t,toolId:typeof t.toolId=="string"?t.toolId:"",toolStatus:["creating","ready","failed"].includes(t.toolStatus)?t.toolStatus:"",runId:typeof t.runId=="string"?t.runId:"",currentStep:typeof t.currentStep=="string"?t.currentStep:"",sourceCommitSha:typeof t.sourceCommitSha=="string"?t.sourceCommitSha:"",steps:n,progressError:typeof t.progressError=="string"?t.progressError:"",logTail:typeof t.logTail=="string"?t.logTail:"",logTruncated:t.logTruncated===!0,logUpdatedAt:typeof t.logUpdatedAt=="string"?t.logUpdatedAt:null,logError:typeof t.logError=="string"?t.logError:""}}function S5e(e){if(!e||typeof e!="object")throw new Error("环境 Manifest 响应格式无效");const t=e;if(t.apiVersion!=="agentkit.studio/v1alpha1"||t.kind!=="Environment"||!t.metadata||typeof t.metadata.id!="string"||typeof t.metadata.name!="string"||typeof t.metadata.version!="string"||typeof t.metadata.description!="string"||!t.spec||typeof t.spec.image!="string"||!["ubuntu","aio-sandbox"].includes(t.spec.baseEnvironment)||typeof t.spec.baseImage!="string"||!["ubuntu-22.04","ubuntu-24.04"].includes(t.spec.operatingSystem)||!["python-3.10","python-3.12"].includes(t.spec.language)||t.spec.executionRuntime!=="veadk"||!Array.isArray(t.spec.packages)||!t.spec.packages.every(n=>typeof n=="string")||!Array.isArray(t.spec.capabilities)||!t.spec.capabilities.every(n=>typeof n=="string")||!Array.isArray(t.spec.skills)||!t.status||!woe.has(t.status.phase)||typeof t.status.createdAt!="string"||typeof t.status.updatedAt!="string")throw new Error("环境 Manifest 响应格式无效");return t}function Soe(e){if(e==null)return;if(!e||typeof e!="object")throw new Error("环境镜像仓库响应格式无效");const t=e;if(typeof t.region!="string"||typeof t.registry!="string"||typeof t.namespace!="string"||typeof t.repository!="string")throw new Error("环境镜像仓库响应格式无效");return t}function E5e(e){if(e==null)return;if(!e||typeof e!="object")throw new Error("环境代码仓库响应格式无效");const t=e;if(typeof t.repositoryUrl!="string"||t.ref!==void 0&&typeof t.ref!="string"||typeof t.dockerfilePath!="string")throw new Error("环境代码仓库响应格式无效");return t}function k5e(e){const t=Soe(e);if(!t)return;const n=e;if(typeof n.reference!="string")throw new Error("环境镜像来源响应格式无效");return{...t,reference:n.reference}}function O9(e){if(!e||typeof e!="object")throw new Error("环境响应格式无效");const t=e;if(typeof t.id!="string"||typeof t.name!="string"||typeof t.description!="string"||t.baseEnvironment!==void 0&&t.baseEnvironment!=="ubuntu"&&t.baseEnvironment!=="aio-sandbox"||t.operatingSystem!=="ubuntu-22.04"&&t.operatingSystem!=="ubuntu-24.04"||t.language!=="python-3.10"&&t.language!=="python-3.12"||!Array.isArray(t.optionIds)||!t.optionIds.every(n=>typeof n=="string")||t.selectedSkills!==void 0&&!Array.isArray(t.selectedSkills)||typeof t.dockerfile!="string"||typeof t.createdAt!="string"||typeof t.updatedAt!="string")throw new Error("环境响应格式无效");return{...t,baseEnvironment:t.baseEnvironment==="aio-sandbox"?"aio-sandbox":"ubuntu",selectedSkills:t.selectedSkills??[],gitSource:E5e(t.gitSource),containerRepository:Soe(t.containerRepository),imageSource:k5e(t.imageSource),latestVersion:y9(t.latestVersion)}}function Eoe(e){if(!e||typeof e!="object")throw new Error("工作区响应格式无效");const t=e;if(typeof t.id!="string"||typeof t.name!="string"||typeof t.description!="string"||!Array.isArray(t.environmentIds)||!t.environmentIds.every(n=>typeof n=="string")||typeof t.createdAt!="string"||typeof t.updatedAt!="string")throw new Error("工作区响应格式无效");return t}async function x9(e){const t=await St("/web/workspaces",{signal:e});if(!t.ok)throw new Error(await Wt(t,"加载工作区失败"));const n=await t.json();if(!Array.isArray(n.items))throw new Error("工作区列表响应格式无效");return n.items.map(Eoe)}async function koe(e,t,n,r){const i=await St(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(n),signal:r});if(!i.ok)throw new Error(await Wt(i,"保存工作区失败"));return Eoe(await i.json())}function _oe(e,t){return koe("/web/workspaces","POST",e,t)}function Toe(e,t,n){return koe(`/web/workspaces/${encodeURIComponent(e)}`,"PATCH",t,n)}async function Coe(e,t){const n=await St(`/web/workspaces/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});if(!n.ok)throw new Error(await Wt(n,"删除工作区失败"))}async function YS(e){const t=await St("/web/environments",{signal:e});if(!t.ok)throw new Error(await Wt(t,"加载环境失败"));const n=await t.json();if(!Array.isArray(n.items))throw new Error("环境列表响应格式无效");return n.items.map(O9)}async function Aoe(e,t){const n=await St("/web/environment-repositories/inspect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});if(!n.ok)throw new Error(await Wt(n,"探查代码仓库失败"));const r=await n.json();if(typeof r.repositoryUrl!="string"||typeof r.ref!="string"||typeof r.commitSha!="string"||!Array.isArray(r.dockerfiles)||!r.dockerfiles.every(i=>typeof i=="string"))throw new Error("代码仓库探查响应格式无效");return r}async function Noe(e,t){const n=await St(`/web/environments/${encodeURIComponent(e)}/share-code`,{method:"POST",signal:t});if(!n.ok)throw new Error(await Wt(n,"导出环境分享码失败"));const r=await n.json();if(typeof r.shareCode!="string"||typeof r.name!="string")throw new Error("环境分享码响应格式无效");return r}async function joe(e,t){const n=await St("/web/environment-share-codes/inspect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({shareCodes:e}),signal:t});if(!n.ok)throw new Error(await Wt(n,"检测环境分享码失败"));const r=await n.json();if(!Array.isArray(r.items))throw new Error("环境分享码检测响应格式无效");return r.items.map(i=>{if(!i||typeof i!="object")throw new Error("环境分享码检测响应格式无效");const s=i,a=s.status==="valid"||s.valid===!0?"valid":s.status==="invalid"||s.valid===!1?"invalid":null;if(!Number.isInteger(s.index)||a===null||s.name!==void 0&&typeof s.name!="string"||s.error!==void 0&&typeof s.error!="string")throw new Error("环境分享码检测响应格式无效");return{index:s.index,status:a,name:s.name??"",error:s.error??""}})}async function Roe(e,t){const n=await St("/web/environment-share-codes/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({shareCodes:e}),signal:t});if(!n.ok)throw new Error(await Wt(n,"导入环境分享码失败"));const r=await n.json();if(!Array.isArray(r.items))throw new Error("环境分享码导入响应格式无效");return r.items.map(i=>{if(!i||typeof i!="object")throw new Error("环境分享码导入响应格式无效");const s=i;if(!Number.isInteger(s.index)||!(s.status==="created"||s.status==="duplicate"||s.status==="failed")||s.name!==void 0&&typeof s.name!="string"||s.error!==void 0&&typeof s.error!="string")throw new Error("环境分享码导入响应格式无效");return{index:s.index,status:s.status,name:s.name??"",environment:s.environment===void 0||s.environment===null?void 0:O9(s.environment),error:s.error??""}})}async function Ioe(e,t,n,r){const i=await St(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(n),signal:r});if(!i.ok)throw new Error(await Wt(i,"保存环境失败"));return O9(await i.json())}function Doe(e,t){return Ioe("/web/environments","POST",e,t)}function Poe(e,t,n){return Ioe(`/web/environments/${encodeURIComponent(e)}`,"PATCH",t,n)}async function Moe(e,t){const n=await St(`/web/environments/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});if(!n.ok)throw new Error(await Wt(n,"删除环境失败"))}async function qM(e,t){const n=await St(`/web/environments/${encodeURIComponent(e)}/build`,{method:"POST",signal:t});if(!n.ok)throw new Error(await Wt(n,"启动环境构建失败"));const r=y9(await n.json());if(!r)throw new Error("环境构建响应格式无效");return r}async function Loe(e,t,n={}){const r=n.includeLogs?"?includeLogs=true":"",i=await St(`/web/environments/${encodeURIComponent(e)}/builds/${encodeURIComponent(t)}${r}`,{signal:n.signal});if(!i.ok)throw new Error(await Wt(i,"读取环境构建详情失败"));const s=y9(await i.json());if(!s)throw new Error("环境构建响应格式无效");return s}async function $oe(e,t,n){const r=await St(`/web/environments/${encodeURIComponent(e)}/builds/${encodeURIComponent(t)}/manifest`,{signal:n});if(!r.ok)throw new Error(await Wt(r,"读取环境 Manifest 失败"));return S5e(await r.json())}function TH(e){if(!e||typeof e!="object")throw new Error("环境资源响应格式无效");const t=e;if(t.source!=="provided"&&t.source!=="managed"||typeof t.consoleUrl!="string")throw new Error("环境资源响应格式无效");return t}async function Boe(e){const t=await St("/web/environment-resources",{signal:e});if(!t.ok)throw new Error(await Wt(t,"加载环境构建资源失败"));const n=await t.json();if(n.provider!=="volcengine"&&n.provider!=="byteplus"||typeof n.region!="string")throw new Error("环境资源响应格式无效");return{provider:n.provider,region:n.region,codePipeline:TH(n.codePipeline),containerRegistry:TH(n.containerRegistry)}}async function Qoe(e,t){const n=await St(`/web/system-info/sandbox-tools/${encodeURIComponent(e)}/model-env`,{method:"POST",signal:t});if(!n.ok)throw new Error(await Wt(n,"更新 Codex Sandbox 失败"));const r=await n.json();if(r.kind!=="codex"&&r.kind!=="codex_snapshot"||typeof r.toolId!="string"||typeof r.updated!="boolean")throw new Error("Codex Sandbox 更新响应格式无效");return r}async function $N(e){const t=await St("/web/identity/user-pools",{signal:e});if(!t.ok)throw new Error(await Wt(t,"加载用户池失败"));const n=await t.json();if(!Array.isArray(n.items))throw new Error("用户池列表响应格式无效");return n.items.map(r=>{if(!r||typeof r!="object"||typeof r.uid!="string"||typeof r.name!="string"||typeof r.domain!="string"||typeof r.region!="string"||typeof r.isCurrent!="boolean")throw new Error("用户池列表响应格式无效");return r})}const kv=new Map;function _5e(e){if(typeof e=="string")return e?{message:e}:null;if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e,n=typeof t.message=="string"?t.message:typeof t.error=="string"?t.error:"";return n?{message:n,phase:typeof t.phase=="string"?t.phase:void 0,runtimeId:typeof t.runtimeId=="string"?t.runtimeId:void 0,logPath:typeof t.logPath=="string"?t.logPath:void 0}:null}class _v extends Error{constructor(t){super(t.message),this.detail=t,this.name="GithubCicdPipelineError"}}async function hh(e){const t=await e.text().catch(()=>"");if(t)try{const n=JSON.parse(t),r=_5e(n.detail??n.error);if(r)return new _v(r)}catch{return new _v({message:t})}return new _v({message:`同步 GitHub 代码失败 (${e.status})`})}async function Uoe(e){const t=await St("/web/github-delivery/source-sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.project,githubUrl:e.githubUrl,githubToken:e.githubToken,baseBranch:e.baseBranch,region:e.region,cloudProvider:e.cloudProvider})},{},0);if(!t.ok)throw await hh(t);return t.json()}async function Foe(e){const t=await St("/web/github-delivery/cicd-pipeline",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({githubUrl:e.githubUrl,githubToken:e.githubToken,baseBranch:e.baseBranch,runtimeName:e.runtimeName,runtimeId:e.runtimeId,region:e.region,cloudProvider:e.cloudProvider,projectPath:e.projectPath??".",volcengineAccessKey:e.volcengineAccessKey,volcengineSecretKey:e.volcengineSecretKey,volcengineSessionToken:e.volcengineSessionToken??""})},{},0);if(!t.ok)throw await hh(t);return t.json()}async function zoe(e){const t=await St("/web/github-delivery/init-main",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.project,githubUrl:e.githubUrl,githubToken:e.githubToken,baseBranch:e.baseBranch,runtimeName:e.runtimeName,runtimeId:e.runtimeId,region:e.region,cloudProvider:e.cloudProvider,projectPath:e.projectPath??".",volcengineAccessKey:e.volcengineAccessKey,volcengineSecretKey:e.volcengineSecretKey,volcengineSessionToken:e.volcengineSessionToken??""})},{},0);if(!t.ok)throw await hh(t);return t.json()}async function T5e(e){const t=await St("/web/github-delivery/source-sync/cicd",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pipelineId:e.pipelineId,runtimeName:e.runtimeName,runtimeId:e.runtimeId,region:e.region,cloudProvider:e.cloudProvider,projectPath:e.projectPath??".",volcengineAccessKey:e.volcengineAccessKey,volcengineSecretKey:e.volcengineSecretKey,volcengineSessionToken:e.volcengineSessionToken??""})},{},0);if(!t.ok)throw await hh(t);return t.json()}async function Voe(e){const t=await St(`/web/github-cicd/runtime-binding?runtimeId=${encodeURIComponent(e)}`);if(!t.ok)throw await hh(t);const n=await t.json();return n.pipelineId?n:null}async function H_(e){const t=await St(`/web/github-delivery/versions?runtimeId=${encodeURIComponent(e)}`);if(!t.ok)throw await hh(t);return t.json()}async function Hoe(e){const t=await St("/web/github-delivery/rollback-pr",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw await hh(t);return t.json()}async function v9(e){const t=await St("/web/github-cicd/runtime-binding",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw await hh(t);return t.json()}async function qoe(e){const t=await St("/web/github-cicd/runtime-sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runtimeId:e.runtimeId,project:e.project})},{},0);if(!t.ok)throw await hh(t);return t.json()}async function V1(e,t,n,r){var f,h,m,g,b;const i=r==null?void 0:r.taskId,s=i?new AbortController:void 0;i&&s&&kv.set(i,s);const a=()=>{i&&kv.get(i)===s&&kv.delete(i)};let l;try{const y=!!(r!=null&&r.migrationTaskId);(f=r==null?void 0:r.onStage)==null||f.call(r,{level:"info",phase:"upload",message:y?"正在校验迁移产物":"正在上传代码包",pct:0}),l=await St("/web/deploy-agentkit",{method:"POST",headers:{"Content-Type":"application/json"},signal:s==null?void 0:s.signal,body:JSON.stringify({name:e,files:y?[]:t,config:n,taskId:i,migrationTaskId:r==null?void 0:r.migrationTaskId,runtimeId:r==null?void 0:r.runtimeId,runtimeName:r==null?void 0:r.runtimeName,appName:r==null?void 0:r.appName,editMode:r==null?void 0:r.editMode,draft:r==null?void 0:r.draft,updateEtag:r==null?void 0:r.updateEtag,baseRuntimeVersion:r==null?void 0:r.baseRuntimeVersion,removeRuntimeEnvKeys:r==null?void 0:r.removeRuntimeEnvKeys,mcpSecretValues:r==null?void 0:r.mcpSecretValues,mcpCredentialReuses:r==null?void 0:r.mcpCredentialReuses,sessionStorage:r==null?void 0:r.sessionStorage,minInstance:r==null?void 0:r.minInstance,maxInstance:r==null?void 0:r.maxInstance,createEvaluationSets:r==null?void 0:r.createEvaluationSets,description:HIe((r==null?void 0:r.description)??""),authentication:r==null?void 0:r.authentication,im:r==null?void 0:r.im,envs:r==null?void 0:r.envs,resources:r==null?void 0:r.resources,source:(r==null?void 0:r.source)??(r!=null&&r.migrationTaskId?{kind:"migration",migrationId:r.migrationTaskId}:{kind:"inlineFiles"}),harnessSidecar:r==null?void 0:r.harnessSidecar,environment:r==null?void 0:r.environment})},{},0),(h=r==null?void 0:r.onStage)==null||h.call(r,{level:"success",phase:"upload",message:y?"迁移产物校验完成":"代码包上传完成",pct:100})}catch(y){throw a(),y}if(!l.ok){const y=await Wt(l,"部署失败");throw a(),new Error(y)}let c=null;try{for await(const y of IN(l)){const O=y;if(O&&O.done){c=O;break}O&&O.message&&((m=r==null?void 0:r.onStage)==null||m.call(r,O))}}catch(y){throw a(),y}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 连接信息");const u=(g=c.runtimeName)!=null&&g.trim()?c.agentName:e,d=((b=c.runtimeName)==null?void 0:b.trim())||c.agentName;return{apikey:c.apikey??"",url:c.url??"",agentName:u,runtimeName:d,runtimeId:c.runtimeId,consoleUrl:c.consoleUrl,region:c.region,version:c.version,warnings:c.warnings,feishuChannel:c.feishuChannel}}async function Xoe(e){var n;const t=await St("/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=kv.get(e))==null||n.abort(),kv.delete(e)}async function C5e(e=s9){const t=await St(`/web/my-runtimes?region=${encodeURIComponent(e)}`);if(!t.ok)throw new Error(`加载失败 (${t.status})`);return(await t.json()).runtimes??[]}const Ew={title:"AgentKit Studio",logoUrl:""},XM={enabled:!1},f5={studio:!1,version:"",provider:"volcengine",branding:Ew,features:{newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,agentUsage:!1,addAgentkit:!0,generatedAgentTestRun:!0},defaultView:"chat",agentsSource:"local",telemetry:XM};function A5e(e){if(!e||typeof e!="object")return XM;const t=e;if(t.enabled!==!0||!t.studio||typeof t.studio!="object")return XM;const n=t.studio;return{enabled:!0,studio:{deployId:typeof n.deployId=="string"?n.deployId:"",userPoolId:typeof n.userPoolId=="string"?n.userPoolId:"",applicationId:typeof n.applicationId=="string"?n.applicationId:"",functionId:typeof n.functionId=="string"?n.functionId:"",region:typeof n.region=="string"?n.region:"",project:typeof n.project=="string"?n.project:"",version:typeof n.version=="string"?n.version:"",accountId:typeof n.accountId=="string"?n.accountId:"",accountIdResolutionError:typeof n.accountIdResolutionError=="string"?n.accountIdResolutionError:""}}}async function Goe(){var e,t;try{const n=await St("/web/ui-config");if(!n.ok)return f5;const r=await n.json(),i=typeof((e=r.branding)==null?void 0:e.logoUrl)=="string"?r.branding.logoUrl:Ew.logoUrl,s=r.provider==="byteplus"?"byteplus":"volcengine";return Jae(s),{studio:r.studio??!1,version:typeof r.version=="string"?r.version:"",provider:s,branding:{title:typeof((t=r.branding)==null?void 0:t.title)=="string"?r.branding.title:Ew.title,logoUrl:i?So(i):""},features:{...f5.features,...r.features??{}},defaultView:r.defaultView??"chat",agentsSource:r.agentsSource==="cloud"?"cloud":"local",telemetry:A5e(r.telemetry)}}catch{return f5}}const Woe={role:"user",telemetry:{userId:"",accountId:""},capabilities:{createAgents:!1,manageAgents:!1,runtimeScope:"mine"}};async function Yoe(){var n,r,i,s;const e=await St("/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.telemetry)==null?void 0:n.userId)!="string"||t.telemetry.accountId!==void 0&&typeof t.telemetry.accountId!="string"||typeof((r=t.capabilities)==null?void 0:r.createAgents)!="boolean"||typeof((i=t.capabilities)==null?void 0:i.manageAgents)!="boolean"||!["all","mine"].includes((s=t.capabilities)==null?void 0:s.runtimeScope))throw new Error("权限服务返回了无法解析的响应");return t}async function Zoe(e,t){const n=new URLSearchParams;e&&n.set("targetVersion",e),t&&n.set("startedAt",String(t));const r=n.size?`?${n.toString()}`:"",i=await St(`/web/studio-update${r}`);if(!i.ok)throw new Error(`检查 Studio 更新失败 (${i.status})`);return await i.json()}async function Koe(){const e=await St("/web/studio-update/permissions");if(!e.ok){let t="";try{const n=await e.json();t=typeof n.detail=="string"?n.detail:""}catch{t=""}throw new Error(t||`Studio 更新权限预检失败 (${e.status})`)}return await e.json()}async function Joe(e){const t=await St("/web/studio-update",{method:"POST",headers:{"Content-Type":"application/json","X-VeADK-Studio-Update":"1"},body:JSON.stringify({version:e})},{},Zi);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 ele({runtimeId:e,region:t,appName:n,page:r=1,pageSize:i=20,signal:s}){const a=new URLSearchParams({runtimeId:e,region:t,appName:n,page:String(r),pageSize:String(i)}),l=await St(`/web/agent-usage?${a.toString()}`,{signal:s});if(!l.ok)throw new Error(await Wt(l,"加载 Agent 用量失败"));const c=l.headers.get("content-type")||"未提供",u=c.toLowerCase();if(!u.includes("application/json")&&!u.includes("+json"))throw new Error(`加载 Agent 用量失败:服务端返回非 JSON 响应(HTTP ${l.status},Content-Type: ${c})。请确认当前服务以 Studio 模式启动,并检查代理或网关配置。`);try{return await l.json()}catch{throw new Error(`加载 Agent 用量失败:服务端返回了无法解析的 JSON(HTTP ${l.status},Content-Type: ${c})。请稍后重试;若问题持续,请检查代理或网关配置。`)}}function ph(e=""){return`/web/cronjobs${e?`/${encodeURIComponent(e)}`:""}`}async function GM(e){const t=await St(ph(),{signal:e});if(!t.ok)throw new Error(await Wt(t,"加载定时任务失败"));const n=await t.json();return Array.isArray(n)?n:n.items??[]}async function N5e(e,t){const n=await St(ph(e),{signal:t});if(!n.ok)throw new Error(await Wt(n,"加载定时任务详情失败"));return await n.json()}async function tle(e){const t=await St(ph(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(await Wt(t,"创建定时任务失败"));return await t.json()}async function nle(e,t){const n=await St(`${ph(e)}/update`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(await Wt(n,"更新定时任务失败"));return await n.json()}async function rle(e,t){const n=t?"enable":"disable",r=await St(`${ph(e)}/${n}`,{method:"POST"});if(!r.ok)throw new Error(await Wt(r,t?"启用定时任务失败":"暂停定时任务失败"));return await r.json()}async function ile(e){const t=await St(`${ph(e)}/run`,{method:"POST"});if(!t.ok)throw new Error(await Wt(t,"立即执行定时任务失败"));return await t.json()}async function WM(e,t){const n=await St(`${ph(e)}/runs`,{signal:t});if(!n.ok)throw new Error(await Wt(n,"加载执行历史失败"));const r=await n.json();return Array.isArray(r)?r:r.items??[]}async function sle(e,t){const n=await St(`${ph(e)}/runs/${encodeURIComponent(t)}/cancel`,{method:"POST"});if(!n.ok)throw new Error(await Wt(n,"终止执行失败"));return await n.json()}async function ale(e){const t=await St(ph(e),{method:"DELETE"});if(!t.ok)throw new Error(await Wt(t,"删除定时任务失败"))}class w9 extends Error{constructor(t,n){super(t),this.status=n,this.name="RuntimeListError"}}async function H1(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 St(`/web/runtimes?${t.toString()}`,{signal:e.signal});if(!n.ok){const i=await Wt(n,"加载 Runtime 失败");throw new w9(i,n.status)}const r=await n.json();return{runtimes:r.runtimes??[],nextToken:r.nextToken??""}}async function Jy(e,t,n={}){if(n.preferCached){const r=d9(e,t,n.currentVersion),i=dy.get(r);if(i&&i.expiresAt>Date.now())return[...i.apps];i&&dy.delete(r)}try{const r={runtimeId:e,region:t,runtimeVersion:n.currentVersion};return n.retryProbe&&(r.retryProbe=!0),await WS("","",r,n.signal,n.timeoutMs)}catch(r){if(r instanceof F1||r instanceof Es||r instanceof Error)throw r;return null}}async function ole(e,t){const n=new URLSearchParams({region:t}),r=await St(`/web/runtime-tool-channel/${encodeURIComponent(e)}/capabilities?${n.toString()}`);if(!r.ok)throw new Es(await Wt(r,"读取本地工具失败"),!1,!0);return await r.json()}async function lle(e,t){const n=new URLSearchParams({region:t}),r=await St(`/web/runtime-route-channel/${encodeURIComponent(e)}/connect?${n.toString()}`,{method:"POST"});if(!r.ok)throw new Es(await Wt(r,"连接 Studio 动态路由失败"),!1,!0);return await r.json()}async function cle(e,t,n={}){const r={runtimeId:e,region:t};n.retryProbe&&(r.retryProbe=!0);const i=await St("/.well-known/agent-card.json",{},r),s=await eoe(i);if(s==="runtime_access_denied")throw new F1;if(s==="runtime_private_endpoint_unreachable")throw new Es(Yae);if(["runtime_proxy_connect_error","runtime_proxy_timeout"].includes(s))throw new Es(Zae);if(i.status===404)return null;if(i.status===401||i.status===403)throw new Es("Runtime 服务拒绝了 A2A 探测请求,请检查 Runtime 的鉴权配置。");if(!i.ok)throw new Error(await Wt(i,"读取 A2A Agent Card 失败"));const a=await i.json().catch(()=>null),l=typeof(a==null?void 0:a.url)=="string"?a.url.trim():"";return l?{name:typeof(a==null?void 0:a.name)=="string"?a.name:"",description:typeof(a==null?void 0:a.description)=="string"?a.description:"",endpoint:l}:null}async function ule(e,t){const n=new URLSearchParams({runtimeId:e,region:t}),r=await St(`/web/runtime-api-key/reveal?${n.toString()}`,{method:"POST",cache:"no-store"});if(!r.ok)throw new Error(await Wt(r,"读取 Runtime API Key 失败"));const i=await r.json();if(typeof i.apiKey!="string"||!i.apiKey)throw new Error("Runtime 未返回可用的 API Key");return i.apiKey}async function dle(e,t){const n=await St("/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})`)}}function q_({runtimeId:e,region:t,appName:n,currentVersion:r}){return u0(Sw,t,e,r??"",(n==null?void 0:n.trim())??"")}async function j5e({runtimeId:e,region:t,appName:n,currentVersion:r,force:i=!1}){const s=new URLSearchParams({runtimeId:e,region:t});n&&s.set("appName",n),r!=null&&s.set("currentVersion",String(r)),i&&s.set("refresh","true");const a=await St(`/web/runtime-update-capability?${s.toString()}`);if(!a.ok)throw new Error(await R5e(a));return await a.json()}function BN({runtimeId:e,region:t,appName:n,currentVersion:r,signal:i,force:s=!1}){var u,d;const a={runtimeId:e,region:t,appName:n,currentVersion:r},l=q_(a);if(s&&xi.delete(l),!s){const f=cm(xi,l,z1);if(f)return Hk(Promise.resolve(f),i);const h=(u=xi.get(l))==null?void 0:u.promise;if(h)return Hk(h,i);if(n){const m=q_({...a,appName:""}),g=(d=xi.get(m))==null?void 0:d.promise;if(g){let b;return b=g.then(y=>{var v,x,w,S,E;if(y.recoveryStatus==="preparing")return((v=xi.get(l))==null?void 0:v.promise)===b&&xi.delete(l),y;const O=((w=(x=y.agent)==null?void 0:x.appName)==null?void 0:w.trim())??"";return O&&O!==n.trim()?(((S=xi.get(l))==null?void 0:S.promise)===b&&xi.delete(l),BN(a)):(((E=xi.get(l))==null?void 0:E.promise)===b&&xi.set(l,{value:y,updatedAt:Date.now()}),y)},y=>{var O;throw((O=xi.get(l))==null?void 0:O.promise)===b&&xi.delete(l),y}),xi.set(l,{promise:b,updatedAt:0}),Hk(b,i)}}}let c;return c=j5e({...a,force:s}).then(f=>{var h,m,g,b,y;if(f.recoveryStatus==="preparing")return((h=xi.get(l))==null?void 0:h.promise)===c&&xi.delete(l),f;if(((m=xi.get(l))==null?void 0:m.promise)===c){xi.set(l,{value:f,updatedAt:Date.now()});const O=new Set(["",((b=(g=f.agent)==null?void 0:g.appName)==null?void 0:b.trim())??""]);for(const v of O){const x=q_({...a,appName:v});x!==l&&!((y=xi.get(x))!=null&&y.promise)&&xi.set(x,{value:f,updatedAt:Date.now()})}}return f},f=>{var h;throw((h=xi.get(l))==null?void 0:h.promise)===c&&xi.delete(l),f}),xi.set(l,{promise:c,updatedAt:0}),Hk(c,i)}function YM({runtimeId:e,region:t,appName:n,currentVersion:r}){return cm(xi,q_({runtimeId:e,region:t,appName:n,currentVersion:r}),z1)}function ZM(e){return BN(e).then(()=>{},()=>{})}function KM(e,t){if(!e){xi.clear();return}for(const n of xi.keys()){const[r,i,s]=n.split("");r===Sw&&s===e&&(!t||i===t)&&xi.delete(n)}}async function R5e(e){const t=await e.json().catch(()=>null),n=typeof(t==null?void 0:t.detail)=="string"?t.detail:"";return e.status===403?"当前账号没有管理该 Runtime 的权限。":e.status===404?n==="runtime_not_found"?"该 Runtime 不存在或已被删除。":"当前账号无法访问该 Runtime。":`检查 Runtime 更新能力失败(HTTP ${e.status}),请稍后重试。`}async function I5e(e,t){let n=null;for(const r of GS(t)){const i=await St(`/web/runtime-detail?runtimeId=${encodeURIComponent(e)}®ion=${encodeURIComponent(r)}`);if(i.ok)return i.json();n=new Error(await Wt(i,"加载 Runtime 详情失败"))}throw n??new Error("加载 Runtime 详情失败")}async function S9(e,t="cn-beijing",n={}){const r=u0(e,t||"cn-beijing"),i=cm(zm,r,z1);if(!n.force&&i)return i;const s=zm.get(r);if(!n.force&&(s!=null&&s.promise))return s.promise;const a=I5e(e,t).then(l=>f9(zm,r,l));zm.set(r,{...s,promise:a,updatedAt:(s==null?void 0:s.updatedAt)??0});try{return await a}finally{const l=zm.get(r);(l==null?void 0:l.promise)===a&&zm.set(r,{value:l.value,updatedAt:l.updatedAt})}}function fle(e,t="cn-beijing"){return cm(zm,u0(e,t||"cn-beijing"),z1)}function hle(e,t="cn-beijing"){S9(e,t).catch(()=>{})}async function Tv(e){const t=await St("/web/generated-agent-projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e})});if(!t.ok)throw new Error(await Wt(t,"生成项目失败"));return t.json()}const D5e=19e4;async function ple(e){const t=await St("/web/generated-agent-drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({requirement:e})},{},D5e);if(!t.ok)throw new Error(await Wt(t,"生成 Agent 配置失败"));return RN(t,"生成 Agent 配置失败")}async function mle(e,t){const n=await St("/web/generated-agent-test-runs",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({draft:e,runtimeId:t==null?void 0:t.runtimeId,runtimeRegion:t==null?void 0:t.region})});if(!n.ok)throw new Error(await Wt(n,"创建调试运行失败"));return RN(n,"创建调试运行失败")}async function gle(e,t){const n=await St(`/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 Wt(n,"创建调试会话失败"));return(await RN(n,"创建调试会话失败")).id}async function ble(e,t){const n=await St(`/web/generated-agent-test-runs/${encodeURIComponent(e)}/trace/session/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(await Wt(n,"加载调试调用链路失败"));const r=await RN(n,"加载调试调用链路失败");if(!Array.isArray(r))throw new Error("加载调试调用链路失败:返回格式无效");return r}async function*yle({runId:e,userId:t,sessionId:n,text:r,signal:i}){const s=r.trim()?[{text:r}]:[],a=yoe(i);let l;try{l=await St(`/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:s},streaming:!0}),signal:a.signal},{},0)}catch(c){throw a.cleanup(),a.timedOut()?new Error(Ky):c}if(!l.ok)throw a.cleanup(),new Error(await Wt(l,"调试运行失败"));try{for await(const c of IN(l))a.clearDeadline(),yield c}catch(c){throw a.timedOut()?new Error(Ky):c}finally{a.cleanup()}}async function pb(e){const t=await St(`/web/generated-agent-test-runs/${e}`,{method:"DELETE"});if(!t.ok&&t.status!==404)throw new Error(await Wt(t,"清理调试运行失败"))}const P5e=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_SITE_BRANDING:Ew,DEFAULT_STUDIO_ACCESS:Woe,GithubCicdPipelineError:_v,RUN_SSE_EMPTY_RESPONSE_ERROR:boe,RUN_SSE_FIRST_EVENT_TIMEOUT_ERROR:Ky,RUN_SSE_INCOMPLETE_RESPONSE_ERROR:V_,RuntimeAccessDeniedError:F1,RuntimeListError:w9,RuntimeProbeError:Es,attachGithubDeliveryCicdToSourceSync:T5e,bindGithubCicdRuntime:v9,buildEnvironment:qM,cancelAgentkitDeployment:Xoe,cancelCronJobRun:sle,checkRuntimeNameAvailability:LN,clearMessageFeedbackCache:Hae,clearRemoteApps:Xae,componentSearch:moe,createCronJob:tle,createEnvironment:Doe,createGeneratedAgentTestRun:mle,createGeneratedAgentTestSession:gle,createGithubCicdPipeline:Uoe,createGithubDeliveryCicdPipeline:Foe,createGithubDeliveryRollbackPr:Hoe,createSession:toe,createWorkspace:_oe,deleteAgentFeedbackCases:ooe,deleteCronJob:ale,deleteEnvironment:Moe,deleteGeneratedAgentTestRun:pb,deleteMedia:z_,deleteRuntime:dle,deleteSession:UM,deleteSessionMedia:FM,deleteWorkspace:Coe,deployAgentkitProject:V1,downloadArtifact:p9,ensureRuntimeRouteChannel:lle,exportEnvironmentShareCode:Noe,fetchRemoteApps:WS,generateAgentDraftFromRequirement:ple,generateAgentProject:Tv,getAgentFeedbackCases:MN,getAgentInfo:VM,getAgentOptimizations:roe,getAgentUsage:ele,getAutomaticEvaluationStatuses:QM,getCachedAgentFeedbackCases:ioe,getCachedRuntimeAgentInfo:hoe,getCachedRuntimeDetail:fle,getCachedRuntimeUpdateCapability:YM,getCronJob:N5e,getEnvironmentBuild:Loe,getEnvironmentManifest:$oe,getEnvironmentResources:Boe,getGeneratedAgentTestTrace:ble,getGithubCicdRuntimeBinding:Voe,getGithubDeliveryVersions:H_,getMediaCapabilities:x5e,getMyRuntimes:C5e,getRuntimeAgentInfo:g9,getRuntimeDetail:S9,getRuntimeStudioToolCapabilities:ole,getRuntimeUpdateCapability:BN,getRuntimes:H1,getSession:PN,getSessionTrace:xC,getStudioAccess:Yoe,getStudioUpdatePermissions:Koe,getStudioUpdateStatus:Zoe,getSystemInfo:voe,getUiConfig:Goe,httpErrorMessage:Wt,importEnvironmentShareCodes:Roe,initializeGithubDeliveryMain:zoe,inspectEnvironmentRepository:Aoe,inspectEnvironmentShareCodes:joe,invalidateRuntimeUpdateCapabilityCache:KM,listApps:Wae,listCronJobRuns:WM,listCronJobs:GM,listDeploymentResources:Ooe,listEnvironments:YS,listIdentityUserPools:$N,listModelApiKeys:u9,listModelOptions:U1,listSessions:h9,listWorkspaces:x9,mediaContentUrl:doe,parseEnvironmentShareCodes:b9,prefetchAgentFeedbackCases:y5e,prefetchRuntimeAgentInfo:poe,prefetchRuntimeDetail:hle,prefetchRuntimeUpdateCapability:ZM,previewArtifact:m9,probeRuntimeA2a:cle,probeRuntimeApps:Jy,refreshAgentFeedbackCases:soe,registerRemoteApp:qae,revealModelApiKey:Gae,revealRuntimeApiKey:ule,runCronJobNow:ile,runGeneratedAgentTestSSE:yle,runSSE:HM,runtimeRegionCandidates:GS,setClientCloudProvider:Jae,setCronJobEnabled:rle,startStudioUpdate:Joe,studioFetch:Dn,submitIssueFeedback:zM,submitMessageFeedback:noe,syncGithubCicdRuntime:qoe,updateCodexSandboxToolModelEnv:Qoe,updateCronJob:nle,updateEnvironment:Poe,updateWorkspace:Toe,uploadMedia:coe,upsertCachedAgentFeedbackCase:F_,webSearch:goe,writeEnvironmentShareCode:xoe},Symbol.toStringTag,{value:"Module"})),CH=Object.freeze({totalTokenCount:0,promptTokenCount:0,candidatesTokenCount:0,thoughtsTokenCount:0,cachedContentTokenCount:0}),X_=Object.freeze({modelName:"",current:CH,cumulative:CH}),M5e={totalTokenCount:"total_token_count",promptTokenCount:"prompt_token_count",candidatesTokenCount:"candidates_token_count",thoughtsTokenCount:"thoughts_token_count",cachedContentTokenCount:"cached_content_token_count"},L5e=24,$5e=64,B5e=16;function qk(e){var l,c;const t=e.trim();if(!t)return 0;const n=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/gu,r=((l=t.match(n))==null?void 0:l.length)??0,i=t.replace(n," "),s=(i.match(/[A-Za-z0-9_]+/g)??[]).reduce((u,d)=>u+Math.max(1,Math.ceil(d.length/4)),0),a=((c=i.match(/[^\sA-Za-z0-9_]/g))==null?void 0:c.length)??0;return r+s+a}function Q5e(e){var l,c,u;const t=((l=e.instruction)==null?void 0:l.trim())??"",n=((c=e.tools)==null?void 0:c.filter(d=>d.trim()))??[],r=((u=e.skills)==null?void 0:u.filter(d=>d.name.trim()))??[],i=qk(t),s=n.reduce((d,f)=>d+$5e+qk(f),0),a=r.reduce((d,f)=>d+B5e+qk(f.name)+qk(f.description??""),0);return L5e+i+s+a}function U5e({usage:e,contextWindow:t,estimatedSystemTokens:n}){const r=Math.max(1,Math.round(t)),i=Math.max(0,e.current.promptTokenCount),s=Math.max(i,e.current.totalTokenCount),a=Math.min(r,i>0?Math.min(i,Math.max(0,n??0)):Math.max(0,n??0)),l=Math.max(0,i-a),c=i>0?Math.max(0,s-i):Math.max(0,s),u=i>0?s:a+c;return{systemTokens:a,inputTokens:l,outputTokens:c,remainingTokens:Math.max(0,r-u),usedTokens:u,contextWindow:r}}function F5e(e){const t=[{kind:"system",tokens:e.systemTokens},{kind:"input",tokens:e.inputTokens},{kind:"output",tokens:e.outputTokens},{kind:"remaining",tokens:e.remainingTokens}],n=e.contextWindow/100;let r=0;const i=t.map(s=>{const a=r;return r+=s.tokens,{...s,start:a,end:r}});return Array.from({length:100},(s,a)=>{const l=a*n,c=l+n,u=i.flatMap(d=>{const f=Math.max(0,Math.min(c,d.end)-Math.max(l,d.start));return f>0?[{kind:d.kind,share:f/n}]:[]});return{index:a,slices:u}})}function ex(e,t){const n=e,r=n[t]??n[M5e[t]];return typeof r=="number"&&Number.isFinite(r)&&r>0?Math.round(r):0}function z5e(e){const t=ex(e,"promptTokenCount"),n=ex(e,"candidatesTokenCount"),r=ex(e,"thoughtsTokenCount");return{totalTokenCount:ex(e,"totalTokenCount")||t+n+r,promptTokenCount:t,candidatesTokenCount:n,thoughtsTokenCount:r,cachedContentTokenCount:ex(e,"cachedContentTokenCount")}}function V5e(e,t){return{totalTokenCount:e.totalTokenCount+t.totalTokenCount,promptTokenCount:e.promptTokenCount+t.promptTokenCount,candidatesTokenCount:e.candidatesTokenCount+t.candidatesTokenCount,thoughtsTokenCount:e.thoughtsTokenCount+t.thoughtsTokenCount,cachedContentTokenCount:e.cachedContentTokenCount+t.cachedContentTokenCount}}function Ole(e,t){if(!t)return e;const n=typeof t.modelVersion=="string"?t.modelVersion.trim():"",r=typeof t.model_version=="string"?t.model_version.trim():"",i=n||r||e.modelName,s=t.usageMetadata??t.usage_metadata;if(!s)return i===e.modelName?e:{...e,modelName:i};const a=z5e(s);return a.totalTokenCount===0?i===e.modelName?e:{...e,modelName:i}:{modelName:i,current:a,cumulative:V5e(e.cumulative,a)}}function AH(e){return e.reduce((t,n)=>Ole(t,n),X_)}function NH(e){return e.blocks.flatMap(t=>t.kind==="tool"?[{name:t.name,args:t.args,response:t.response,done:t.done}]:[])}function H5e(e){const t=e.attributes;return String(t["invocation.id"]??t["gen_ai.invocation.id"]??t["gcp.vertex.agent.invocation_id"]??"")}function q5e(e,t){if(!t)return e;const n=new Set(e.filter(i=>H5e(i)===t).map(i=>i.trace_id)),r=e.filter(i=>n.has(i.trace_id));return r.length>0?r:e}function Pg(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function hp(e){return typeof e=="string"?e:""}function xle(e,t){return e==="pending"||e==="running"||e==="completed"||e==="failed"?e:t}function X5e(e){let t=e;if(typeof t=="string")try{t=JSON.parse(t)}catch{return{}}const n=Pg(t)??{};return Pg(n.result)??n}function G5e(e){var n;const t=(n=Pg(e))==null?void 0:n.branches;return Array.isArray(t)?t.map(r=>{var i;return hp((i=Pg(r))==null?void 0:i.label)}):[]}function vle(e,t,n){const r=G5e(e),i=X5e(t),s=Array.isArray(i.branches)?i.branches:[],a=n==="running"?"running":"pending";return{branches:[0,1].map(c=>{const u=Pg(s[c])??{};return{label:hp(u.label)||r[c]||`方向 ${c+1}`,content:hp(u.content),status:xle(u.status,a),error:hp(u.error)}})}}function W5e(e){const t=Pg(e),n=Pg(t==null?void 0:t.veadkStudioToolProgress);return!n||n.toolName!=="branch_compare"||typeof n.branchIndex!="number"||n.branchIndex<0||n.branchIndex>1?null:{toolName:"branch_compare",requestId:hp(n.requestId),branchIndex:n.branchIndex,label:hp(n.label),delta:hp(n.delta),status:xle(n.status,"running"),error:hp(n.error)||void 0}}function Y5e(e,t,n){return{branches:vle(e,t,"running").branches.map((s,a)=>a===n.branchIndex?{...s,label:n.label||s.label,content:s.content+n.delta,status:n.status,error:n.error??s.error}:s)}}const Z5e="send_a2ui_json_to_client",K5e="validated_a2ui_json",JM="adk_request_credential",jH="transfer_to_agent";function J5e(e){var r,i,s,a;const t=e,n=((r=t==null?void 0:t.exchangedAuthCredential)==null?void 0:r.oauth2)??((i=t==null?void 0:t.exchanged_auth_credential)==null?void 0:i.oauth2)??((s=t==null?void 0:t.rawAuthCredential)==null?void 0:s.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 kf(){return{blocks:[],liveStart:0}}const RH=e=>e.functionCall??e.function_call,e4=e=>e.functionResponse??e.function_response;function eDe(e){if(!e||typeof e!="object")return"";const t=e,n=t.agentName??t.agent_name;return typeof n=="string"?n:""}function tDe(e){return e.replace(/-/g,"+").replace(/_/g,"/")}function wle(e){const t=[];for(const[n,r]of e.entries()){const i=r.partMetadata??r.part_metadata,s=i==null?void 0:i.veadkTransport;if((s==null?void 0:s.hidden)===!0)continue;const a=i==null?void 0:i.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 l=r.inlineData??r.inline_data;if(l&&l.data){t.push({id:`inline-${n}-${l.displayName??l.display_name??"media"}`,mimeType:l.mimeType??l.mime_type,data:tDe(l.data),name:l.displayName??l.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 t4(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 nDe=new Set(["llm","sequential","parallel","loop","a2a"]);function rDe(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 i=r,s=Array.isArray(i.skills)?i.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 l=i.targetAgent;if(l&&typeof l=="object"){const c=l,u=c.type;typeof c.name=="string"&&typeof u=="string"&&nDe.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(s.length>0||a)return{skills:s,targetAgent:a}}}function iDe(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 sDe(e,t){if(!t.length)return;const n=e[e.length-1];if((n==null?void 0:n.kind)==="artifact"){for(const r of t)n.files.some(i=>i.filename===r.filename&&i.version===r.version)||n.files.push(r);return}e.push({kind:"artifact",files:t})}function IH(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 Xk(e){for(const t of e)t.kind==="thinking"&&(t.done=!0)}function vC(e,t){var c,u,d,f,h,m;const n=e.blocks.map(g=>({...g}));let r=e.liveStart;const i=((c=t.content)==null?void 0:c.parts)??[],s=i.flatMap(g=>{const b=W5e(g.partMetadata??g.part_metadata);return b?[b]:[]});if(s.length>0){for(const g of s)for(let b=n.length-1;b>=0;b-=1){const y=n[b];if(!(y.kind!=="tool"||y.done||y.name!==g.toolName||g.requestId&&y.callId&&y.callId!==g.requestId)){y.response=Y5e(y.args,y.response,g),y.status="running";break}}return{blocks:n,liveStart:r}}const a=i.some(g=>RH(g)||e4(g));if(t.partial&&!a){for(const g of i){const b=t4(g);typeof b=="string"&&b&&IH(n,g.thought?"thinking":"text",b)}return{blocks:n,liveStart:r}}n.length=r;for(const g of i){const b=RH(g),y=e4(g),O=wle([g]),v=t4(g);if(typeof v=="string"&&v)IH(n,g.thought?"thinking":"text",v);else if(O.length)Xk(n),iDe(n,O);else if(b)if(Xk(n),b.name===jH){const x=eDe(b.args)||((u=t.actions)==null?void 0:u.transferToAgent)||((d=t.actions)==null?void 0:d.transfer_to_agent)||"未知 Agent";n.push({kind:"agent-transfer",agentName:x,done:!1})}else if(b.name===JM){const x=b.args??{},w=x.authConfig??x.auth_config??x,E=String(x.functionCallId??x.function_call_id??"").replace(/^_adk_toolset_auth_/,"")||void 0;n.push({kind:"auth",callId:b.id??"",label:E,authUri:J5e(w),authConfig:w,done:!1})}else n.push({kind:"tool",name:b.name??"",callId:b.id,args:b.args,done:!1});else if(y){if(Xk(n),y.name===jH)for(let x=n.length-1;x>=0;x--){const w=n[x];if(w.kind==="agent-transfer"&&!w.done){w.done=!0;break}}if(y.name===JM)for(let x=n.length-1;x>=0;x--){const w=n[x];if(w.kind==="auth"&&!w.done){w.done=!0;break}}for(let x=n.length-1;x>=0;x--){const w=n[x];if(w.kind==="tool"&&!w.done&&w.name===y.name&&(!y.id||!w.callId||w.callId===y.id)){w.done=!0,w.response=y.response;break}}if(y.name===Z5e){const x=((f=y.response)==null?void 0:f[K5e])??[];if(x.length){const w=n[n.length-1];w&&w.kind==="a2ui"?w.messages.push(...x):n.push({kind:"a2ui",messages:x})}}}}const l=((h=t.actions)==null?void 0:h.artifactDelta)??((m=t.actions)==null?void 0:m.artifact_delta);return l&&sDe(n,Object.entries(l).map(([g,b])=>({filename:g,version:b}))),Xk(n),r=n.length,{blocks:n,liveStart:r}}function aDe(e,t={}){var i,s;const n=[];let r=kf();for(const a of e)if(a.author==="user"){const c=((i=a.content)==null?void 0:i.parts)??[];if(c.some(m=>{var g;return((g=e4(m))==null?void 0:g.name)===JM})){for(let m=n.length-1;m>=0;m--)if(n[m].role==="assistant"){for(let g=n[m].blocks.length-1;g>=0;g--){const b=n[m].blocks[g];if(b.kind==="auth"){b.done=!0;break}}break}}const u=c.map(t4).filter(m=>!!m).join(""),d=wle(c),f=rDe(c);if(!u&&!d.length&&!f){r=kf();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=kf()}else{const c=a.author??"";let u=n[n.length-1];(!u||u.role!=="assistant"||c&&((s=u.meta)==null?void 0:s.author)!==c)&&(u={role:"assistant",blocks:[],meta:{author:c||void 0}},n.push(u),r=kf()),r=vC(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 l=a.meta,c=l==null?void 0:l.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"||(l.feedback=u)}return n}function QN(e){var t,n;for(const r of e??[])if(r.author==="user"||((t=r.content)==null?void 0:t.role)==="user"){const i=(((n=r.content)==null?void 0:n.parts)??[]).map(s=>s.text).find(Boolean);if(i)return i}return"新会话"}function Sle(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t{const t=p.Children.toArray(e),n=[];let r="";const i=()=>{r!==""&&(n.push(r),r="")};for(const s of t)if(!(s==null||typeof s=="boolean")){if(typeof s=="string"||typeof s=="number"){r+=String(s);continue}i(),n.push(s)}return i(),n},E9=e=>{const t=oDe(e),n=p.Children.count(t);return p.Children.map(t,r=>{if(typeof r=="string"&&r.trim())return n<=1?r:o.jsx("span",{children:r});if(p.isValidElement(r)){const i=r,{children:s,...a}=i.props;return s!=null?p.cloneElement(i,a,E9(s)):i}return r})},lDe="_Badge_1viyg_1",cDe={Badge:lDe},Js=({children:e,className:t,variant:n="soft",color:r="secondary",size:i="sm",pill:s,...a})=>o.jsx("div",{className:cr(cDe.Badge,t),"data-color":r,"data-size":i,"data-pill":s?"":void 0,"data-variant":n,...a,children:E9(e)});var uDe=typeof op=="object"&&op&&op.Object===Object&&op,dDe=typeof self=="object"&&self&&self.Object===Object&&self;uDe||dDe||Function("return this")();var fDe=typeof window<"u"?p.useLayoutEffect:p.useEffect;function hDe(){const e=p.useRef(!1);return p.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),p.useCallback(()=>e.current,[])}var DH={width:void 0,height:void 0};function Ele(e){const{ref:t,box:n="content-box"}=e,[{width:r,height:i},s]=p.useState(DH),a=hDe(),l=p.useRef({...DH}),c=p.useRef(void 0);return c.current=e.onResize,p.useEffect(()=>{if(!t.current||typeof window>"u"||!("ResizeObserver"in window))return;const u=new ResizeObserver(([d])=>{const f=n==="border-box"?"borderBoxSize":n==="device-pixel-content-box"?"devicePixelContentBoxSize":"contentBoxSize",h=PH(d,f,"inlineSize"),m=PH(d,f,"blockSize");if(l.current.width!==h||l.current.height!==m){const b={width:h,height:m};l.current.width=h,l.current.height=m,c.current?c.current(b):a()&&s(b)}});return u.observe(t.current,{box:n}),()=>{u.disconnect()}},[n,t,a]),{width:r,height:i}}function PH(e,t,n){return e[t]?Array.isArray(e[t])?e[t][0][n]:e[t][n]:t==="contentBoxSize"?e.contentRect[n==="inlineSize"?"width":"height"]:void 0}function k9(e,t){const n=p.useRef(e);fDe(()=>{n.current=e},[e]),p.useEffect(()=>{if(!t&&t!==0)return;const r=setTimeout(()=>{n.current()},t);return()=>{clearTimeout(r)}},[t])}const pDe={DEV:!1,MODE:"production"},fy=typeof import.meta<"u"?pDe:void 0,mDe=!!(fy!=null&&fy.DEV),gDe=typeof navigator<"u"&&/(jsdom|happy-dom)/i.test(navigator.userAgent)||typeof globalThis.happyDOM=="object",kle=(fy==null?void 0:fy.MODE)==="test"||gDe,bDe=typeof window<"u",_le=typeof document<"u",yDe=bDe&&_le,_9=e=>{const t=e.currentTarget;if(!(t instanceof HTMLElement))return;const n=t.offsetWidth;let r=.985;n<=80?r=.96:n<=150?r=.97:n<=220?r=.98:n>600&&(r=.995),t.style.setProperty("--scale",r.toString())},wC=(e,t)=>{const n=()=>{const a=setTimeout(e);return()=>{clearTimeout(a)}};if(!yDe||typeof window.requestAnimationFrame!="function"||_le&&document.visibilityState==="hidden")return n();let i=2,s=window.requestAnimationFrame(function a(){i-=1,i===0?e():s=window.requestAnimationFrame(a)});return()=>{typeof window.cancelAnimationFrame=="function"&&window.cancelAnimationFrame(s)}},d0=e=>Object.keys(e).reduce((n,r)=>{const i=e[r];if(i||i===0){const s=r.startsWith("--")?"":"--",a=typeof i=="number"?`${i}px`:i;n[`${s}${r}`]=a}return n},{}),h5=e=>typeof e=="number"?`${e}deg`:e,p5=e=>String(e),Gk=e=>`${e}ms`,m5=({x:e,y:t,scale:n,rotate:r,skewX:i,skewY:s}={})=>{const a=[e==null?null:`translateX(${e}px)`,t==null?null:`translateY(${t}px)`,n==null?null:`scale(${n})`,r==null?null:`rotate(${h5(r)})`,i==null?null:`skewX(${h5(i)})`,s==null?null:`skewY(${h5(s)})`].filter(Boolean);return a.length?a.join(" "):"none"},g5=({blur:e}={})=>{const t=[e==null?null:`blur(${e}px)`].filter(Boolean);return t.length?t.join(" "):"none"},Df=e=>{e.preventDefault()},Tle=e=>e.querySelectorAll('a[href], input:not([disabled]):not([type="hidden"]), textarea:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex^="-"]), [contenteditable]'),ODe="_LoadingIndicator_7yl6f_1",xDe={LoadingIndicator:ODe},ZS=({className:e,size:t,strokeWidth:n,style:r,...i})=>o.jsx("div",{...i,className:cr(xDe.LoadingIndicator,e),style:r||d0({"indicator-size":t,"indicator-stroke":n})});var vDe=Object.defineProperty,T9=(e,t)=>vDe(e,"name",{value:t,configurable:!0});function n4(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}T9(n4,"setRef");function Cle(...e){return t=>{let n=!1;const r=e.map(i=>{const s=n4(i,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;iwDe(e,"name",{value:t,configurable:!0});function Jf(e){const t=p.forwardRef((n,r)=>{let{children:i,...s}=n,a=null,l=!1;const c=[];r4(i)&&typeof Wk=="function"&&(i=Wk(i._payload)),p.Children.forEach(i,h=>{var m;if(Dle(h)){l=!0;const g=h;let b="child"in g.props?g.props.child:g.props.children;r4(b)&&typeof Wk=="function"&&(b=Wk(b._payload)),a=SDe(g,b),c.push((m=a==null?void 0:a.props)==null?void 0:m.children)}else c.push(h)}),a?a=p.cloneElement(a,void 0,c):!l&&p.Children.count(i)===1&&p.isValidElement(i)&&(a=i);const u=a?Ile(a):void 0,d=Vr(r,u);if(!a){if(i||i===0)throw new Error(l?_De(e):kDe(e));return i}const f=Rle(s,a.props??{});return a.type!==p.Fragment&&(f.ref=r?d:u),p.cloneElement(a,f)});return t.displayName=`${e}.Slot`,t}Tu(Jf,"createSlot");var Ale=Jf("Slot"),Nle=Symbol.for("radix.slottable");function jle(e){const t=Tu(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=Nle,t}Tu(jle,"createSlottable");var SDe=Tu((e,t)=>{if("child"in e.props){const n=e.props.child;return p.isValidElement(n)?p.cloneElement(n,void 0,e.props.children(n.props.children)):null}return p.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function Rle(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...l)=>{const c=s(...l);return i(...l),c}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}Tu(Rle,"mergeProps");function Ile(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Tu(Ile,"getElementRef");function Dle(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Nle}Tu(Dle,"isSlottable");var EDe=Symbol.for("react.lazy");function r4(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===EDe&&"_payload"in e&&Ple(e._payload)}Tu(r4,"isLazyComponent");function Ple(e){return typeof e=="object"&&e!==null&&"then"in e}Tu(Ple,"isPromiseLike");var kDe=Tu(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),_De=Tu(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Wk=r0[" use ".trim().toString()],TDe=Object.defineProperty,CDe=(e,t)=>TDe(e,"name",{value:t,configurable:!0}),ADe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],bi=ADe.reduce((e,t)=>{const n=Jf(`Primitive.${t}`),r=p.forwardRef((i,s)=>{const{asChild:a,...l}=i,c=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function C9(e,t){e&&Tr.flushSync(()=>e.dispatchEvent(t))}CDe(C9,"dispatchDiscreteCustomEvent");var NDe=Object.defineProperty,jDe=(e,t)=>NDe(e,"name",{value:t,configurable:!0}),RDe=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),IDe=p.forwardRef(jDe(function(t,n){return o.jsx(bi.span,{...t,ref:n,style:{...RDe,...t.style}})},"VisuallyHidden")),DDe=IDe,PDe=Object.defineProperty,kc=(e,t)=>PDe(e,"name",{value:t,configurable:!0});function MDe(e,t){const n=p.createContext(t);n.displayName=e+"Context";const r=kc(s=>{const{children:a,...l}=s,c=p.useMemo(()=>l,Object.values(l));return o.jsx(n.Provider,{value:c,children:a})},"Provider");r.displayName=e+"Provider";function i(s,a={}){const{optional:l=!1}=a,c=p.useContext(n);if(c)return c;if(t!==void 0)return t;if(!l)throw new Error(`\`${s}\` must be used within \`${e}\``)}return kc(i,"useContext"),[r,i]}kc(MDe,"createContext");function nl(e,t=[]){let n=[];function r(s,a){const l=p.createContext(a);l.displayName=s+"Context";const c=n.length;n=[...n,a];const u=kc(f=>{var O;const{scope:h,children:m,...g}=f,b=((O=h==null?void 0:h[e])==null?void 0:O[c])||l,y=p.useMemo(()=>g,Object.values(g));return o.jsx(b.Provider,{value:y,children:m})},"Provider");u.displayName=s+"Provider";function d(f,h,m={}){var O;const{optional:g=!1}=m,b=((O=h==null?void 0:h[e])==null?void 0:O[c])||l,y=p.useContext(b);if(y)return y;if(a!==void 0)return a;if(!g)throw new Error(`\`${f}\` must be used within \`${s}\``)}return kc(d,"useContext"),[u,d]}kc(r,"createContext");const i=kc(()=>{const s=n.map(a=>p.createContext(a));return kc(function(l){const c=(l==null?void 0:l[e])||s;return p.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])},"useScope")},"createScope");return i.scopeName=e,[r,Mle(i,...t)]}kc(nl,"createContextScope");function Mle(...e){const t=e[0];if(e.length===1)return t;const n=kc(()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return kc(function(s){const a=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}kc(Mle,"composeContextScopes");var LDe=Object.defineProperty,da=(e,t)=>LDe(e,"name",{value:t,configurable:!0});function A9(e){const t=e+"CollectionProvider",[n,r]=nl(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=da(b=>{const{scope:y,children:O}=b,v=p.useRef(null),x=p.useRef(new Map).current;return o.jsx(i,{scope:y,itemMap:x,collectionRef:v,children:O})},"CollectionProvider");a.displayName=t;const l=e+"CollectionSlot",c=Jf(l),u=p.forwardRef((b,y)=>{const{scope:O,children:v}=b,x=s(l,O),w=Vr(y,x.collectionRef);return o.jsx(c,{ref:w,children:v})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=Jf(d),m=p.forwardRef((b,y)=>{const{scope:O,children:v,...x}=b,w=p.useRef(null),S=Vr(y,w),E=s(d,O);return p.useEffect(()=>(E.itemMap.set(w,{ref:w,...x}),()=>void E.itemMap.delete(w))),o.jsx(h,{[f]:"",ref:S,children:v})});m.displayName=d;function g(b){const y=s(e+"CollectionConsumer",b);return p.useCallback(()=>{const v=y.collectionRef.current;if(!v)return[];const x=Array.from(v.querySelectorAll(`[${f}]`));return Array.from(y.itemMap.values()).sort((E,k)=>x.indexOf(E.ref.current)-x.indexOf(k.ref.current))},[y.collectionRef,y.itemMap])}return da(g,"useCollection"),[{Provider:a,Slot:u,ItemSlot:m},g,r]}da(A9,"createCollection");var MH=new WeakMap,Ds,Sl,b5=(Sl=class extends Map{constructor(n){super(n);SF(this,Ds);hI(this,Ds,[...super.keys()]),MH.set(this,!0)}set(n,r){return MH.get(this)&&(this.has(n)?za(this,Ds)[za(this,Ds).indexOf(n)]=n:za(this,Ds).push(n)),super.set(n,r),this}insert(n,r,i){const s=this.has(r),a=za(this,Ds).length,l=N9(n);let c=l>=0?l:a+l;const u=c<0||c>=a?-1:c;if(u===this.size||s&&u===this.size-1||u===-1)return this.set(r,i),this;const d=this.size+(s?0:1);l<0&&c++;const f=[...za(this,Ds)];let h,m=!1;for(let g=c;g=this.size&&(s=this.size-1),this.at(s)}keyFrom(n,r){const i=this.indexOf(n);if(i===-1)return;let s=i+r;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.keyAt(s)}find(n,r){let i=0;for(const s of this){if(Reflect.apply(n,r,[s,i,this]))return s;i++}}findIndex(n,r){let i=0;for(const s of this){if(Reflect.apply(n,r,[s,i,this]))return i;i++}return-1}filter(n,r){const i=[];let s=0;for(const a of this)Reflect.apply(n,r,[a,s,this])&&i.push(a),s++;return new Sl(i)}map(n,r){const i=[];let s=0;for(const a of this)i.push([a[0],Reflect.apply(n,r,[a,s,this])]),s++;return new Sl(i)}reduce(...n){const[r,i]=n;let s=0,a=i??this.at(0);for(const l of this)s===0&&n.length===1?a=l:a=Reflect.apply(r,this,[a,l,s,this]),s++;return a}reduceRight(...n){const[r,i]=n;let s=i??this.at(-1);for(let a=this.size-1;a>=0;a--){const l=this.at(a);a===this.size-1&&n.length===1?s=l:s=Reflect.apply(r,this,[s,l,a,this])}return s}toSorted(n){const r=[...this.entries()].sort(n);return new Sl(r)}toReversed(){const n=new Sl;for(let r=this.size-1;r>=0;r--){const i=this.keyAt(r),s=this.get(i);n.set(i,s)}return n}toSpliced(...n){const r=[...this.entries()];return r.splice(...n),new Sl(r)}slice(n,r){const i=new Sl;let s=this.size-1;if(n===void 0)return i;n<0&&(n=n+this.size),r!==void 0&&r>0&&(s=r-1);for(let a=n;a<=s;a++){const l=this.keyAt(a),c=this.get(l);i.set(l,c)}return i}every(n,r){let i=0;for(const s of this){if(!Reflect.apply(n,r,[s,i,this]))return!1;i++}return!0}some(n,r){let i=0;for(const s of this){if(Reflect.apply(n,r,[s,i,this]))return!0;i++}return!1}},Ds=new WeakMap,da(Sl,"OrderedDict"),Sl);function G_(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=Lle(e,t);return n===-1?void 0:e[n]}da(G_,"at");function Lle(e,t){const n=e.length,r=N9(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}da(Lle,"toSafeIndex");function N9(e){return e!==e||e===0?0:Math.trunc(e)}da(N9,"toSafeInteger");function $De(e){const t=e+"CollectionProvider",[n,r]=nl(t),[i,s]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new b5,setItemMap:da(()=>{},"setItemMap")}),a=da(({state:x,...w})=>x?o.jsx(c,{...w,state:x}):o.jsx(l,{...w}),"CollectionProvider");a.displayName=t;const l=da(x=>{const w=y();return o.jsx(c,{...x,state:w})},"CollectionInit");l.displayName=t+"Init";const c=da(x=>{const{scope:w,children:S,state:E}=x,k=p.useRef(null),[_,T]=p.useState(null),C=Vr(k,T),[A,j]=E;return p.useEffect(()=>{if(!_)return;const M=Qle(()=>{});return M.observe(_,{childList:!0,subtree:!0}),()=>{M.disconnect()}},[_]),o.jsx(i,{scope:w,itemMap:A,setItemMap:j,collectionRef:C,collectionRefObject:k,collectionElement:_,children:S})},"CollectionProviderImpl");c.displayName=t+"Impl";const u=e+"CollectionSlot",d=Jf(u),f=p.forwardRef((x,w)=>{const{scope:S,children:E}=x,k=s(u,S),_=Vr(w,k.collectionRef);return o.jsx(d,{ref:_,children:E})});f.displayName=u;const h=e+"CollectionItemSlot",m="data-radix-collection-item",g=Jf(h),b=p.forwardRef((x,w)=>{const{scope:S,children:E,...k}=x,_=p.useRef(null),[T,C]=p.useState(null),A=Vr(w,_,C),j=s(h,S),{setItemMap:M}=j,I=p.useRef(k);$le(I.current,k)||(I.current=k);const $=I.current;return p.useEffect(()=>{const N=$;return M(D=>T?D.has(T)?D.set(T,{...N,element:T}).toSorted(i4):(D.set(T,{...N,element:T}),D.toSorted(i4)):D),()=>{M(D=>!T||!D.has(T)?D:(D.delete(T),new b5(D)))}},[T,$,M]),o.jsx(g,{[m]:"",ref:A,children:E})});b.displayName=h;function y(){return p.useState(new b5)}da(y,"useInitCollection");function O(x){const{itemMap:w}=s(e+"CollectionConsumer",x);return w}return da(O,"useCollection"),[{Provider:a,Slot:f,ItemSlot:b},{createCollectionScope:r,useCollection:O,useInitCollection:y}]}da($De,"createCollection");function $le(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(t,i)||e[i]!==t[i])return!1;return!0}da($le,"shallowEqual");function Ble(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}da(Ble,"isElementPreceding");function i4(e,t){return!e[1].element||!t[1].element?0:Ble(e[1].element,t[1].element)?-1:1}da(i4,"sortByDocumentPosition");function Qle(e){return new MutationObserver(n=>{for(const r of n)if(r.type==="childList"){e();return}})}da(Qle,"getChildListObserver");var BDe=Object.defineProperty,q1=(e,t)=>BDe(e,"name",{value:t,configurable:!0}),Ule=!!(typeof window<"u"&&window.document&&window.document.createElement);function fn(e,t,{checkForDefaultPrevented:n=!0}={}){return q1(function(i){if(e==null||e(i),n===!1||!i||!i.defaultPrevented)return t==null?void 0:t(i)},"handleEvent")}q1(fn,"composeEventHandlers");function QDe(e){var t;if(!Ule)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}q1(QDe,"getOwnerWindow");function s4(e){if(!Ule)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}q1(s4,"getOwnerDocument");function Fle(e,t=!1){const{activeElement:n}=s4(e);if(!(n!=null&&n.nodeName))return null;if(zle(n)&&n.contentDocument)return Fle(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const i=s4(n).getElementById(r);if(i)return i}}return n}q1(Fle,"getActiveElement");function zle(e){return e.tagName==="IFRAME"}q1(zle,"isFrame");var Dc=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},UDe=Object.defineProperty,FDe=(e,t)=>UDe(e,"name",{value:t,configurable:!0}),LH=r0[" useEffectEvent ".trim().toString()],$H=r0[" useInsertionEffect ".trim().toString()];function Vle(e){if(typeof LH=="function")return LH(e);const t=p.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof $H=="function"?$H(()=>{t.current=e}):Dc(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}FDe(Vle,"useEffectEvent");var zDe=Object.defineProperty,KS=(e,t)=>zDe(e,"name",{value:t,configurable:!0}),VDe=r0[" useInsertionEffect ".trim().toString()]||Dc;function Qc({prop:e,defaultProp:t,onChange:n=KS(()=>{},"onChange"),caller:r}){const[i,s,a]=Hle({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:i,u=p.useCallback(d=>{var f;if(l){const h=qle(d)?d(e):d;h!==e&&((f=a.current)==null||f.call(a,h))}else s(d)},[l,e,s,a]);return[c,u]}KS(Qc,"useControllableState");function Hle({defaultProp:e,onChange:t}){const[n,r]=p.useState(e),i=p.useRef(n),s=p.useRef(t);return VDe(()=>{s.current=t},[t]),p.useEffect(()=>{var a;i.current!==n&&((a=s.current)==null||a.call(s,n),i.current=n)},[n,i]),[n,r,s]}KS(Hle,"useUncontrolledState");function qle(e){return typeof e=="function"}KS(qle,"isFunction");var BH=Symbol("RADIX:SYNC_STATE");function HDe(e,t,n,r){const{prop:i,defaultProp:s,onChange:a,caller:l}=t,c=i!==void 0,u=Vle(a),d=[{...n,state:s}];r&&d.push(r);const[f,h]=p.useReducer((y,O)=>{if(O.type===BH)return{...y,state:O.state};const v=e(y,O);return c&&!Object.is(v.state,y.state)&&u(v.state),v},...d),m=f.state,g=p.useRef(m);p.useEffect(()=>{g.current!==m&&(g.current=m,c||u(m))},[m,g,c]);const b=p.useMemo(()=>i!==void 0?{...f,state:i}:f,[f,i]);return p.useEffect(()=>{c&&!Object.is(i,f.state)&&h({type:BH,state:i})},[i,f.state,c]),[b,h]}KS(HDe,"useControllableStateReducer");var qDe=Object.defineProperty,eh=(e,t)=>qDe(e,"name",{value:t,configurable:!0});function Xle(e,t){return p.useReducer((n,r)=>t[n][r]??n,e)}eh(Xle,"useStateMachine");var _d=eh(e=>{const{present:t,children:n}=e,r=Gle(t),i=typeof n=="function"?n({present:r.isPresent}):p.Children.only(n),s=Wle(r.ref,Yle(i));return typeof n=="function"||r.isPresent?p.cloneElement(i,{ref:s}):null},"Presence");function Gle(e){const[t,n]=p.useState(),r=p.useRef(null),i=p.useRef(e),s=p.useRef("none"),a=p.useRef(void 0),l=e?"mounted":"unmounted",[c,u]=Xle(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{c==="mounted"?(s.current=a.current??mb(r.current),a.current=void 0):s.current="none"},[c]),Dc(()=>{const d=r.current,f=i.current;if(f!==e){const m=s.current,g=mb(d);e?(a.current=g,u("MOUNT")):g==="none"||(d==null?void 0:d.display)==="none"?u("UNMOUNT"):u(f&&m!==g?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,u]),Dc(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,h=eh(g=>{const y=mb(r.current).includes(CSS.escape(g.animationName));if(g.target===t&&y&&(u("ANIMATION_END"),!i.current)){const O=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=O)})}},"handleAnimationEnd"),m=eh(g=>{g.target===t&&(s.current=mb(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:p.useCallback(d=>{if(d){const f=getComputedStyle(d);r.current=f,a.current=mb(f)}else r.current=null;n(d)},[])}}eh(Gle,"usePresence");function a4(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}eh(a4,"setRef");function Wle(...e){const t=p.useRef(e);return t.current=e,p.useCallback(n=>{const r=t.current;let i=!1;const s=r.map(a=>{const l=a4(a,n);return!i&&typeof l=="function"&&(i=!0),l});if(i)return()=>{for(let a=0;aXDe(e,"name",{value:t,configurable:!0}),WDe=r0[" useId ".trim().toString()]||(()=>{}),YDe=0;function Fp(e){const[t,n]=p.useState(WDe());return Dc(()=>{e||n(r=>r??String(YDe++))},[e]),e||(t?`radix-${t}`:"")}GDe(Fp,"useId");var ZDe=Object.defineProperty,KDe=(e,t)=>ZDe(e,"name",{value:t,configurable:!0}),JDe=p.createContext(void 0);function JS(e){const t=p.useContext(JDe);return e||t||"ltr"}KDe(JS,"useDirection");var ePe=Object.defineProperty,tPe=(e,t)=>ePe(e,"name",{value:t,configurable:!0});function xu(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}tPe(xu,"useCallbackRef");var nPe=Object.defineProperty,ca=(e,t)=>nPe(e,"name",{value:t,configurable:!0}),o4="dismissableLayer.update",rPe="dismissableLayer.pointerDownOutside",iPe="dismissableLayer.focusOutside",QH,Zle=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),j9=p.forwardRef(ca(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:l,onInteractOutside:c,onDismiss:u,...d}=t,f=p.useContext(Zle),[h,m]=p.useState(null),g=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=p.useState({}),y=Vr(n,m),O=Array.from(f.layers),[v]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),x=v?O.indexOf(v):-1,w=h?O.indexOf(h):-1,S=f.layersWithOutsidePointerEventsDisabled.size>0,E=w>=x,k=p.useRef(!1),_=Kle(j=>{a==null||a(j),c==null||c(j),j.defaultPrevented||u==null||u()},{ownerDocument:g,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:k,dismissableSurfaces:f.dismissableSurfaces,shouldHandlePointerDownOutside:p.useCallback(j=>{if(!(j instanceof Node))return!1;const M=[...f.branches].some(I=>I.contains(j));return E&&!M},[f.branches,E])}),T=Jle(j=>{if(i&&k.current)return;const M=j.target;[...f.branches].some($=>$.contains(M))||(l==null||l(j),c==null||c(j),j.defaultPrevented||u==null||u())},g),C=h?w===O.length-1:!1,A=xu(j=>{j.key==="Escape"&&(s==null||s(j),!j.defaultPrevented&&u&&(j.preventDefault(),u()))});return p.useEffect(()=>{if(C)return g.addEventListener("keydown",A,{capture:!0}),()=>g.removeEventListener("keydown",A,{capture:!0})},[g,C,A]),p.useEffect(()=>{if(h)return r&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(QH=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(h)),f.layers.add(h),l4(),()=>{r&&(f.layersWithOutsidePointerEventsDisabled.delete(h),f.layersWithOutsidePointerEventsDisabled.size===0&&(g.body.style.pointerEvents=QH))}},[h,g,r,f]),p.useEffect(()=>()=>{h&&(f.layers.delete(h),f.layersWithOutsidePointerEventsDisabled.delete(h),l4())},[h,f]),p.useEffect(()=>{const j=ca(()=>b({}),"handleUpdate");return document.addEventListener(o4,j),()=>document.removeEventListener(o4,j)},[]),o.jsx(bi.div,{...d,ref:y,style:{pointerEvents:S?E?"auto":"none":void 0,...t.style},onFocusCapture:fn(t.onFocusCapture,T.onFocusCapture),onBlurCapture:fn(t.onBlurCapture,T.onBlurCapture),onPointerDownCapture:fn(t.onPointerDownCapture,_.onPointerDownCapture)})},"DismissableLayer"));function sPe(){const e=p.useContext(Zle),[t,n]=p.useState(null);return p.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}ca(sPe,"useDismissableLayerSurface");var aPe=ca(()=>!0,"IS_TRUE");function Kle(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:s,shouldHandlePointerDownOutside:a=aPe}=t,l=xu(e),c=p.useRef(!1),u=p.useRef(!1),d=p.useRef(new Map),f=p.useRef(()=>{});return p.useEffect(()=>{function h(){u.current=!1,i.current=!1,d.current.clear()}ca(h,"resetOutsideInteraction");function m(){return Array.from(d.current.values()).some(Boolean)}ca(m,"isOutsideInteractionIntercepted");function g(x){if(!u.current)return;const w=x.target;w instanceof Node&&[...s].some(E=>E.contains(w))||d.current.set(x.type,!0),x.type==="click"&&window.setTimeout(()=>{u.current&&f.current()},0)}ca(g,"handleInteractionCapture");function b(x){u.current&&d.current.set(x.type,!1)}ca(b,"handleInteractionBubble");const y=ca(x=>{if(x.target&&!c.current){let w=function(){n.removeEventListener("click",f.current);const E=m();h(),E||R9(rPe,l,S,{discrete:!0})};if(ca(w,"handleAndDispatchPointerDownOutsideEvent"),!a(x.target)){n.removeEventListener("click",f.current),h(),c.current=!1;return}const S={originalEvent:x};u.current=!0,i.current=r&&x.button===0,d.current.clear(),!r||x.button!==0?w():(n.removeEventListener("click",f.current),f.current=w,n.addEventListener("click",f.current,{once:!0}))}else n.removeEventListener("click",f.current),h();c.current=!1},"handlePointerDown"),O=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const x of O)n.addEventListener(x,g,!0),n.addEventListener(x,b);const v=window.setTimeout(()=>{n.addEventListener("pointerdown",y)},0);return()=>{window.clearTimeout(v),n.removeEventListener("pointerdown",y),n.removeEventListener("click",f.current);for(const x of O)n.removeEventListener(x,g,!0),n.removeEventListener(x,b)}},[n,l,r,i,s,a]),{onPointerDownCapture:ca(()=>c.current=!0,"onPointerDownCapture")}}ca(Kle,"usePointerDownOutside");function Jle(e,t=globalThis==null?void 0:globalThis.document){const n=xu(e),r=p.useRef(!1);return p.useEffect(()=>{const i=ca(s=>{s.target&&!r.current&&R9(iPe,n,{originalEvent:s},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:ca(()=>r.current=!0,"onFocusCapture"),onBlurCapture:ca(()=>r.current=!1,"onBlurCapture")}}ca(Jle,"useFocusOutside");function l4(){const e=new CustomEvent(o4);document.dispatchEvent(e)}ca(l4,"dispatchUpdate");function R9(e,t,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?C9(i,s):i.dispatchEvent(s)}ca(R9,"handleAndDispatchCustomEvent");var oPe=Object.defineProperty,wo=(e,t)=>oPe(e,"name",{value:t,configurable:!0}),y5="focusScope.autoFocusOnMount",O5="focusScope.autoFocusOnUnmount",UH={bubbles:!1,cancelable:!0},ece=p.forwardRef(wo(function(t,n){const{loop:r=!1,trapped:i=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...l}=t,[c,u]=p.useState(null),d=xu(s),f=xu(a),h=p.useRef(null),m=Vr(n,u),g=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(i){let y=function(w){if(g.paused||!c)return;const S=w.target;c.contains(S)?h.current=S:lf(h.current,{select:!0})},O=function(w){if(g.paused||!c)return;const S=w.relatedTarget;S!==null&&(c.contains(S)||lf(h.current,{select:!0}))},v=function(w){if(document.activeElement===document.body)for(const E of w)E.removedNodes.length>0&&lf(c)};wo(y,"handleFocusIn"),wo(O,"handleFocusOut"),wo(v,"handleMutations"),document.addEventListener("focusin",y),document.addEventListener("focusout",O);const x=new MutationObserver(v);return c&&x.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",O),x.disconnect()}}},[i,c,g.paused]),p.useEffect(()=>{if(c){FH.add(g);const y=document.activeElement;if(!c.contains(y)){const v=new CustomEvent(y5,UH);c.addEventListener(y5,d),c.dispatchEvent(v),v.defaultPrevented||(tce(ace(I9(c)),{select:!0}),document.activeElement===y&&lf(c))}return()=>{c.removeEventListener(y5,d),setTimeout(()=>{const v=new CustomEvent(O5,UH);c.addEventListener(O5,f),c.dispatchEvent(v),v.defaultPrevented||lf(y??document.body,{select:!0}),c.removeEventListener(O5,f),FH.remove(g)},0)}}},[c,d,f,g]);const b=p.useCallback(y=>{if(!r&&!i||g.paused)return;const O=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,v=document.activeElement;if(O&&v){const x=y.currentTarget,[w,S]=nce(x);w&&S?!y.shiftKey&&v===S?(y.preventDefault(),r&&lf(w,{select:!0})):y.shiftKey&&v===w&&(y.preventDefault(),r&&lf(S,{select:!0})):v===x&&y.preventDefault()}},[r,i,g.paused]);return o.jsx(bi.div,{tabIndex:-1,...l,ref:m,onKeyDown:b})},"FocusScope"));function tce(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(lf(r,{select:t}),document.activeElement!==n)return}wo(tce,"focusFirst");function nce(e){const t=I9(e),n=c4(t,e),r=c4(t.reverse(),e);return[n,r]}wo(nce,"getTabbableEdges");function I9(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:wo(r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}wo(I9,"getTabbableCandidates");function c4(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):rce(r,{upTo:t})))return r}wo(c4,"findVisible");function rce(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}wo(rce,"isHidden");function ice(e){return e instanceof HTMLInputElement&&"select"in e}wo(ice,"isSelectableInput");function lf(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&ice(e)&&t&&e.select()}}wo(lf,"focus");var FH=sce();function sce(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=u4(e,t),e.unshift(t)},remove(t){var n;e=u4(e,t),(n=e[0])==null||n.resume()}}}wo(sce,"createFocusScopesStack");function u4(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}wo(u4,"arrayRemove");function ace(e){return e.filter(t=>t.tagName!=="A")}wo(ace,"removeLinks");var lPe=Object.defineProperty,cPe=(e,t)=>lPe(e,"name",{value:t,configurable:!0}),D9=p.forwardRef(cPe(function(t,n){var c;const{container:r,...i}=t,[s,a]=p.useState(!1);Dc(()=>a(!0),[]);const l=r||s&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return l?Tr.createPortal(o.jsx(bi.div,{...i,ref:n}),l):null},"Portal")),uPe=Object.defineProperty,P9=(e,t)=>uPe(e,"name",{value:t,configurable:!0}),Yk=0,Qu=null;function dPe(e){return UN(),e.children}P9(dPe,"FocusGuards");function UN(){p.useEffect(()=>{Qu||(Qu={start:d4(),end:d4()});const{start:e,end:t}=Qu;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Yk++,()=>{Yk===1&&(Qu==null||Qu.start.remove(),Qu==null||Qu.end.remove(),Qu=null),Yk=Math.max(0,Yk-1)}},[])}P9(UN,"useFocusGuards");function d4(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}P9(d4,"createFocusGuard");var Yu=function(){return Yu=Object.assign||function(t){for(var n,r=1,i=arguments.length;r"u")return CPe;var t=APe(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},jPe=uce(),hy="data-scroll-locked",RPe=function(e,t,n,r){var i=e.left,s=e.top,a=e.right,l=e.gap;return n===void 0&&(n="margin"),` + .`.concat(hPe,` { overflow: hidden `).concat(r,`; padding-right: `).concat(l,"px ").concat(r,`; } @@ -440,29 +440,29 @@ ${r}`}}async function u9(e,t=!1){const n=await wt(`/web/model-api-keys${t?"?refr `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),` } - .`).concat(X_,` { + .`).concat(W_,` { right: `).concat(l,"px ").concat(r,`; } - .`).concat(G_,` { + .`).concat(Y_,` { margin-right: `).concat(l,"px ").concat(r,`; } - .`).concat(X_," .").concat(X_,` { + .`).concat(W_," .").concat(W_,` { right: 0 `).concat(r,`; } - .`).concat(G_," .").concat(G_,` { + .`).concat(Y_," .").concat(Y_,` { margin-right: 0 `).concat(r,`; } body[`).concat(hy,`] { - `).concat(mPe,": ").concat(l,`px; + `).concat(pPe,": ").concat(l,`px; } -`)},VH=function(){var e=parseInt(document.body.getAttribute(hy)||"0",10);return isFinite(e)?e:0},DPe=function(){p.useEffect(function(){return document.body.setAttribute(hy,(VH()+1).toString()),function(){var e=VH()-1;e<=0?document.body.removeAttribute(hy):document.body.setAttribute(hy,e.toString())}},[])},PPe=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;DPe();var s=p.useMemo(function(){return jPe(i)},[i]);return p.createElement(RPe,{styles:IPe(s,!t,i,n?"":"!important")})},f4=!1;if(typeof window<"u")try{var Wk=Object.defineProperty({},"passive",{get:function(){return f4=!0,!0}});window.addEventListener("test",Wk,Wk),window.removeEventListener("test",Wk,Wk)}catch{f4=!1}var H0=f4?{passive:!1}:!1,MPe=function(e){return e.tagName==="TEXTAREA"},dce=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!MPe(e)&&n[t]==="visible")},LPe=function(e){return dce(e,"overflowY")},$Pe=function(e){return dce(e,"overflowX")},HH=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=fce(e,r);if(i){var s=hce(e,r),a=s[1],l=s[2];if(a>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},BPe=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},QPe=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},fce=function(e,t){return e==="v"?LPe(t):$Pe(t)},hce=function(e,t){return e==="v"?BPe(t):QPe(t)},UPe=function(e,t){return e==="h"&&t==="rtl"?-1:1},FPe=function(e,t,n,r,i){var s=UPe(e,window.getComputedStyle(t).direction),a=s*r,l=n.target,c=t.contains(l),u=!1,d=a>0,f=0,h=0;do{if(!l)break;var m=hce(e,l),g=m[0],b=m[1],y=m[2],O=b-y-s*g;(g||O)&&fce(e,l)&&(f+=O,h+=g);var v=l.parentNode;l=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&Math.abs(f)<1||!d&&Math.abs(h)<1)&&(u=!0),u},Yk=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},qH=function(e){return[e.deltaX,e.deltaY]},XH=function(e){return e&&"current"in e?e.current:e},zPe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},VPe=function(e){return` +`)},VH=function(){var e=parseInt(document.body.getAttribute(hy)||"0",10);return isFinite(e)?e:0},IPe=function(){p.useEffect(function(){return document.body.setAttribute(hy,(VH()+1).toString()),function(){var e=VH()-1;e<=0?document.body.removeAttribute(hy):document.body.setAttribute(hy,e.toString())}},[])},DPe=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;IPe();var s=p.useMemo(function(){return NPe(i)},[i]);return p.createElement(jPe,{styles:RPe(s,!t,i,n?"":"!important")})},f4=!1;if(typeof window<"u")try{var Zk=Object.defineProperty({},"passive",{get:function(){return f4=!0,!0}});window.addEventListener("test",Zk,Zk),window.removeEventListener("test",Zk,Zk)}catch{f4=!1}var H0=f4?{passive:!1}:!1,PPe=function(e){return e.tagName==="TEXTAREA"},dce=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!PPe(e)&&n[t]==="visible")},MPe=function(e){return dce(e,"overflowY")},LPe=function(e){return dce(e,"overflowX")},HH=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=fce(e,r);if(i){var s=hce(e,r),a=s[1],l=s[2];if(a>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},$Pe=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},BPe=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},fce=function(e,t){return e==="v"?MPe(t):LPe(t)},hce=function(e,t){return e==="v"?$Pe(t):BPe(t)},QPe=function(e,t){return e==="h"&&t==="rtl"?-1:1},UPe=function(e,t,n,r,i){var s=QPe(e,window.getComputedStyle(t).direction),a=s*r,l=n.target,c=t.contains(l),u=!1,d=a>0,f=0,h=0;do{if(!l)break;var m=hce(e,l),g=m[0],b=m[1],y=m[2],O=b-y-s*g;(g||O)&&fce(e,l)&&(f+=O,h+=g);var v=l.parentNode;l=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&Math.abs(f)<1||!d&&Math.abs(h)<1)&&(u=!0),u},Kk=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},qH=function(e){return[e.deltaX,e.deltaY]},XH=function(e){return e&&"current"in e?e.current:e},FPe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},zPe=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},HPe=0,q0=[];function qPe(e){var t=p.useRef([]),n=p.useRef([0,0]),r=p.useRef(),i=p.useState(HPe++)[0],s=p.useState(uce)[0],a=p.useRef(e);p.useEffect(function(){a.current=e},[e]),p.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var b=hPe([e.lockRef.current],(e.shards||[]).map(XH),!0).filter(Boolean);return b.forEach(function(y){return y.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),b.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var l=p.useCallback(function(b,y){if("touches"in b&&b.touches.length===2||b.type==="wheel"&&b.ctrlKey)return!a.current.allowPinchZoom;var O=Yk(b),v=n.current,x="deltaX"in b?b.deltaX:v[0]-O[0],w="deltaY"in b?b.deltaY:v[1]-O[1],S,E=b.target,k=Math.abs(x)>Math.abs(w)?"h":"v";if("touches"in b&&k==="h"&&E.type==="range")return!1;var _=window.getSelection(),C=_&&_.anchorNode,T=C?C===E||C.contains(E):!1;if(T)return!1;var A=HH(k,E);if(!A)return!0;if(A?S=k:(S=k==="v"?"h":"v",A=HH(k,E)),!A)return!1;if(!r.current&&"changedTouches"in b&&(x||w)&&(r.current=S),!S)return!0;var j=r.current||S;return FPe(j,y,b,j==="h"?x:w)},[]),c=p.useCallback(function(b){var y=b;if(!(!q0.length||q0[q0.length-1]!==s)){var O="deltaY"in y?qH(y):Yk(y),v=t.current.filter(function(S){return S.name===y.type&&(S.target===y.target||y.target===S.shadowParent)&&zPe(S.delta,O)})[0];if(v&&v.should){y.cancelable&&y.preventDefault();return}if(!v){var x=(a.current.shards||[]).map(XH).filter(Boolean).filter(function(S){return S.contains(y.target)}),w=x.length>0?l(y,x[0]):!a.current.noIsolation;w&&y.cancelable&&y.preventDefault()}}},[]),u=p.useCallback(function(b,y,O,v){var x={name:b,delta:y,target:O,should:v,shadowParent:XPe(O)};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(w){return w!==x})},1)},[]),d=p.useCallback(function(b){n.current=Yk(b),r.current=void 0},[]),f=p.useCallback(function(b){u(b.type,qH(b),b.target,l(b,e.lockRef.current))},[]),h=p.useCallback(function(b){u(b.type,Yk(b),b.target,l(b,e.lockRef.current))},[]);p.useEffect(function(){return q0.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,H0),document.addEventListener("touchmove",c,H0),document.addEventListener("touchstart",d,H0),function(){q0=q0.filter(function(b){return b!==s}),document.removeEventListener("wheel",c,H0),document.removeEventListener("touchmove",c,H0),document.removeEventListener("touchstart",d,H0)}},[]);var m=e.removeScrollBar,g=e.inert;return p.createElement(p.Fragment,null,g?p.createElement(s,{styles:VPe(i)}):null,m?p.createElement(PPe,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function XPe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const GPe=wPe(cce,qPe);var M9=p.forwardRef(function(e,t){return p.createElement(FN,Gu({},e,{ref:t,sideCar:GPe}))});M9.classNames=FN.classNames;var WPe=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},X0=new WeakMap,Zk=new WeakMap,Kk={},S5=0,pce=function(e){return e&&(e.host||pce(e.parentNode))},YPe=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=pce(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},ZPe=function(e,t,n,r){var i=YPe(t,Array.isArray(e)?e:[e]);Kk[n]||(Kk[n]=new WeakMap);var s=Kk[n],a=[],l=new Set,c=new Set(i),u=function(f){!f||l.has(f)||(l.add(f),u(f.parentNode))};i.forEach(u);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(h){if(l.has(h))d(h);else try{var m=h.getAttribute(r),g=m!==null&&m!=="false",b=(X0.get(h)||0)+1,y=(s.get(h)||0)+1;X0.set(h,b),s.set(h,y),a.push(h),b===1&&g&&Zk.set(h,!0),y===1&&h.setAttribute(n,"true"),g||h.setAttribute(r,"true")}catch(O){console.error("aria-hidden: cannot operate on ",h,O)}})};return d(t),l.clear(),S5++,function(){a.forEach(function(f){var h=X0.get(f)-1,m=s.get(f)-1;X0.set(f,h),s.set(f,m),h||(Zk.has(f)||f.removeAttribute(r),Zk.delete(f)),m||f.removeAttribute(n)}),S5--,S5||(X0=new WeakMap,X0=new WeakMap,Zk=new WeakMap,Kk={})}},mce=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=WPe(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),ZPe(r,i,n,"aria-hidden")):function(){return null}},KPe=Object.defineProperty,JPe=(e,t)=>KPe(e,"name",{value:t,configurable:!0});function KS(e){const[t,n]=p.useState(void 0);return Ic(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let a,l;if("borderBoxSize"in s){const c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;a=u.inlineSize,l=u.blockSize}else a=e.offsetWidth,l=e.offsetHeight;n({width:a,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}JPe(KS,"useSize");var e3e=Object.defineProperty,th=(e,t)=>e3e(e,"name",{value:t,configurable:!0}),L9="Checkbox",[t3e,aMt]=rl(L9),[n3e,$9]=t3e(L9);function gce(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:s,form:a,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[h,m]=Bc({prop:n,defaultProp:i??!1,onChange:c,caller:L9}),[g,b]=p.useState(null),[y,O]=p.useState(null),v=p.useRef(!1),[x,w]=p.useReducer(k=>k+1,0),S=g?!!a||!!g.closest("form"):!0,E={checked:h,disabled:s,setChecked:m,control:g,setControl:b,name:l,form:a,value:d,hasConsumerStoppedPropagationRef:v,userInteractionCount:x,onUserInteraction:w,required:u,defaultChecked:Pf(i)?!1:i,isFormControl:S,bubbleInput:y,setBubbleInput:O};return o.jsx(n3e,{scope:t,...E,children:bce(f)?f(E):r})}th(gce,"CheckboxProvider");var r3e="CheckboxTrigger",i3e=p.forwardRef(th(function({__scopeCheckbox:t,onKeyDown:n,onClick:r,...i},s){const{control:a,value:l,disabled:c,checked:u,required:d,setControl:f,setChecked:h,hasConsumerStoppedPropagationRef:m,onUserInteraction:g,isFormControl:b,bubbleInput:y}=$9(r3e,t),O=zr(s,f),v=p.useRef(u);return p.useEffect(()=>{const x=a==null?void 0:a.form;if(x){const w=th(()=>h(v.current),"reset");return x.addEventListener("reset",w),()=>x.removeEventListener("reset",w)}},[a,h]),o.jsx(pi.button,{type:"button",role:"checkbox","aria-checked":Pf(u)?"mixed":u,"aria-required":d,"data-state":B9(u),"data-disabled":c?"":void 0,disabled:c,value:l,...i,ref:O,onKeyDown:mn(n,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:mn(r,x=>{g(),h(w=>Pf(w)?!0:!w),y&&b&&(m.current=x.isPropagationStopped(),m.current||x.stopPropagation())})})},"CheckboxTrigger")),s3e=p.forwardRef(th(function(t,n){const{__scopeCheckbox:r,name:i,checked:s,defaultChecked:a,required:l,disabled:c,value:u,onCheckedChange:d,form:f,...h}=t;return o.jsx(gce,{__scopeCheckbox:r,checked:s,defaultChecked:a,disabled:c,required:l,onCheckedChange:d,name:i,form:f,value:u,internal_do_not_use_render:({isFormControl:m})=>o.jsxs(o.Fragment,{children:[o.jsx(i3e,{...h,ref:n,__scopeCheckbox:r}),m&&o.jsx(c3e,{__scopeCheckbox:r})]})})},"Checkbox")),a3e="CheckboxIndicator",o3e=p.forwardRef(th(function(t,n){const{__scopeCheckbox:r,forceMount:i,...s}=t,a=$9(a3e,r);return o.jsx(Ed,{present:i||Pf(a.checked)||a.checked===!0,children:o.jsx(pi.span,{"data-state":B9(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:n,style:{pointerEvents:"none",...t.style}})})},"CheckboxIndicator")),l3e="CheckboxBubbleInput",c3e=p.forwardRef(th(function({__scopeCheckbox:t,onClick:n,...r},i){const{control:s,hasConsumerStoppedPropagationRef:a,userInteractionCount:l,checked:c,defaultChecked:u,required:d,disabled:f,name:h,value:m,form:g,bubbleInput:b,setBubbleInput:y}=$9(l3e,t),O=zr(i,y),v=KS(s),x=p.useRef(!1),w=p.useRef(c),S=p.useRef(l);p.useEffect(()=>{const k=b;if(!k)return;const _=window.HTMLInputElement.prototype,T=Object.getOwnPropertyDescriptor(_,"checked").set,A=l!==S.current;S.current=l;const j=w.current!==c;w.current=c;const L=!(A&&a.current);if(j&&T){x.current=!A;const I=new Event("click",{bubbles:L});k.indeterminate=Pf(c),T.call(k,Pf(c)?!1:c),k.dispatchEvent(I),x.current=!1}},[b,c,a,l]);const E=p.useRef(Pf(c)?!1:c);return o.jsx(pi.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??E.current,required:d,disabled:f,name:h,value:m,form:g,...r,tabIndex:-1,ref:O,onClick:mn(n,k=>{x.current&&k.stopPropagation()}),style:{...r.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function bce(e){return typeof e=="function"}th(bce,"isFunction");function Pf(e){return e==="indeterminate"}th(Pf,"isIndeterminate");function B9(e){return Pf(e)?"indeterminate":e?"checked":"unchecked"}th(B9,"getState");const u3e=["top","right","bottom","left"],zp=Math.min,Mf=Math.max,SC=Math.round,Jk=Math.floor,Lf=e=>({x:e,y:e}),d3e={left:"right",right:"left",bottom:"top",top:"bottom"};function yce(e,t,n){return Mf(e,zp(t,n))}function nh(e,t){return typeof e=="function"?e(t):e}function Vp(e){return e.split("-")[0]}function X1(e){return e.split("-")[1]}function Q9(e){return e==="x"?"y":"x"}function U9(e){return e==="y"?"height":"width"}function td(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function F9(e){return Q9(td(e))}function f3e(e,t,n){n===void 0&&(n=!1);const r=X1(e),i=F9(e),s=U9(i);let a=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=EC(a)),[a,EC(a)]}function h3e(e){const t=EC(e);return[h4(e),t,h4(t)]}function h4(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const GH=["left","right"],WH=["right","left"],p3e=["top","bottom"],m3e=["bottom","top"];function g3e(e,t,n){switch(e){case"top":case"bottom":return n?t?WH:GH:t?GH:WH;case"left":case"right":return t?p3e:m3e;default:return[]}}function b3e(e,t,n,r){const i=X1(e);let s=g3e(Vp(e),n==="start",r);return i&&(s=s.map(a=>a+"-"+i),t&&(s=s.concat(s.map(h4)))),s}function EC(e){const t=Vp(e);return d3e[t]+e.slice(t.length)}function y3e(e){var t,n,r,i;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(i=e.left)!=null?i:0}}function Oce(e){return typeof e!="number"?y3e(e):{top:e,right:e,bottom:e,left:e}}function kC(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function YH(e,t,n){let{reference:r,floating:i}=e;const s=td(t),a=F9(t),l=U9(a),c=Vp(t),u=s==="y",d=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,h=r[l]/2-i[l]/2;let m;switch(c){case"top":m={x:d,y:r.y-i.height};break;case"bottom":m={x:d,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:f};break;case"left":m={x:r.x-i.width,y:f};break;default:m={x:r.x,y:r.y}}const g=X1(t);return g&&(m[a]+=h*(g==="end"?1:-1)*(n&&u?-1:1)),m}async function O3e(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:a,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:h=!1,padding:m=0}=nh(t,e),g=Oce(m),y=l[h?f==="floating"?"reference":"floating":f],O=kC(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),v=f==="floating"?{x:r,y:i,width:a.floating.width,height:a.floating.height}:a.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),w=await(s.isElement==null?void 0:s.isElement(x))&&await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1},S=kC(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:x,strategy:c}):v);return{top:(O.top-S.top+g.top)/w.y,bottom:(S.bottom-O.bottom+g.bottom)/w.y,left:(O.left-S.left+g.left)/w.x,right:(S.right-O.right+g.right)/w.x}}const x3e=50,v3e=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:O3e},c=await(a.isRTL==null?void 0:a.isRTL(t));let u=await a.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:f}=YH(u,r,c),h=r,m=0;const g={};for(let b=0;b({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:a,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=nh(e,t)||{};if(u==null)return{};const f=Oce(d),h={x:n,y:r},m=F9(i),g=U9(m),b=await a.getDimensions(u),y=m==="y",O=y?"top":"left",v=y?"bottom":"right",x=y?"clientHeight":"clientWidth",w=s.reference[g]+s.reference[m]-h[m]-s.floating[g],S=h[m]-s.reference[m],E=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let k=E?E[x]:0;(!k||!await(a.isElement==null?void 0:a.isElement(E)))&&(k=l.floating[x]||s.floating[g]);const _=w/2-S/2,C=k/2-b[g]/2-1,T=zp(f[O],C),A=zp(f[v],C),j=k-b[g]-A,L=k/2-b[g]/2+_,I=yce(T,L,j),M=!c.arrow&&X1(i)!=null&&L!==I&&s.reference[g]/2-(LI<=0)){var A,j;const I=(((A=s.flip)==null?void 0:A.index)||0)+1,M=k[I];if(M&&(!(f==="alignment"?v!==td(M):!1)||T.every(Q=>td(Q.placement)===v?Q.overflows[0]>0:!0)))return{data:{index:I,overflows:T},reset:{placement:M}};let N=(j=T.filter(D=>D.overflows[0]<=0).sort((D,Q)=>D.overflows[1]-Q.overflows[1])[0])==null?void 0:j.placement;if(!N)switch(m){case"bestFit":{var L;const D=(L=T.filter(Q=>{if(E){const F=td(Q.placement);return F===v||F==="y"}return!0}).map(Q=>[Q.placement,Q.overflows.filter(F=>F>0).reduce((F,$)=>F+$,0)]).sort((Q,F)=>Q[1]-F[1])[0])==null?void 0:L[0];D&&(N=D);break}case"initialPlacement":N=l;break}if(i!==N)return{reset:{placement:N}}}return{}}}};function ZH(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function KH(e){return u3e.some(t=>e[t]>=0)}const E3e=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=nh(e,t);switch(i){case"referenceHidden":{const a=await r.detectOverflow(t,{...s,elementContext:"reference"}),l=ZH(a,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:KH(l)}}}case"escaped":{const a=await r.detectOverflow(t,{...s,altBoundary:!0}),l=ZH(a,n.floating);return{data:{escapedOffsets:l,escaped:KH(l)}}}default:return{}}}}},xce=new Set(["left","top"]);async function k3e(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),a=Vp(n),l=X1(n),c=td(n)==="y",u=xce.has(a)?-1:1,d=s&&c?-1:1,f=nh(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof g=="number"&&(m=l==="end"?g*-1:g),c?{x:m*d,y:h*u}:{x:h*u,y:m*d}}const _3e=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:a,middlewareData:l}=t,c=await k3e(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:a}}}}},T3e=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:c={fn:v=>{let{x,y:w}=v;return{x,y:w}}},...u}=nh(e,t),d={x:n,y:r},f=await s.detectOverflow(t,u),h=td(i),m=Q9(h);let g=d[m],b=d[h];const y=(v,x)=>yce(x+f[v==="y"?"top":"left"],x,x-f[v==="y"?"bottom":"right"]);a&&(g=y(m,g)),l&&(b=y(h,b));const O=c.fn({...t,[m]:g,[h]:b});return{...O,data:{x:O.x-n,y:O.y-r,enabled:{[m]:a,[h]:l}}}}}},C3e=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:i,y:s,placement:a,rects:l,middlewareData:c}=t,{offset:u=0,mainAxis:d=!0,crossAxis:f=!0}=nh(e,t),h={x:i,y:s},m=td(a),g=Q9(m);let b=h[g],y=h[m];const O=nh(u,t),v=typeof O=="number"?{mainAxis:O,crossAxis:0}:{mainAxis:(n=O.mainAxis)!=null?n:0,crossAxis:(r=O.crossAxis)!=null?r:0};if(d){const S=g==="y"?"height":"width",E=l.reference[g]-l.floating[S]+v.mainAxis,k=l.reference[g]+l.reference[S]-v.mainAxis;bk&&(b=k)}if(f){var x,w;const S=g==="y"?"width":"height",E=xce.has(Vp(a)),k=l.reference[m]-l.floating[S]+(E&&((x=c.offset)==null?void 0:x[m])||0)+(E?0:v.crossAxis),_=l.reference[m]+l.reference[S]+(E?0:((w=c.offset)==null?void 0:w[m])||0)-(E?v.crossAxis:0);y_&&(y=_)}return{[g]:b,[m]:y}}}},A3e=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:i,elements:s}=t,{apply:a=()=>{},...l}=nh(e,t),c=await i.detectOverflow(t,l),u=Vp(n),d=X1(n),f=td(n)==="y",{width:h,height:m}=r.floating;let g,b;u==="top"||u==="bottom"?(g=u,b=d===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(b=u,g=d==="end"?"top":"bottom");const y=m-c.top-c.bottom,O=h-c.left-c.right,v=zp(m-c[g],y),x=zp(h-c[b],O),w=t.middlewareData.shift,S=!w;let E=v,k=x;w!=null&&w.enabled.x&&(k=O),w!=null&&w.enabled.y&&(E=y),S&&!d&&(f?k=h-2*Mf(c.left,c.right):E=m-2*Mf(c.top,c.bottom)),await a({...t,availableWidth:k,availableHeight:E});const _=await i.getDimensions(s.floating);return h!==_.width||m!==_.height?{reset:{rects:!0}}:{}}}};function zN(){return typeof window<"u"}function G1(e){return vce(e)?(e.nodeName||"").toLowerCase():"#document"}function Ka(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function mh(e){var t;return(t=(vce(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function vce(e){return zN()?e instanceof Node||e instanceof Ka(e).Node:!1}function md(e){return zN()?e instanceof Element||e instanceof Ka(e).Element:!1}function kd(e){return zN()?e instanceof HTMLElement||e instanceof Ka(e).HTMLElement:!1}function JH(e){return!zN()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ka(e).ShadowRoot}function VN(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=gd(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function N3e(e){return/^(table|td|th)$/.test(G1(e))}function HN(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const j3e=/transform|translate|scale|rotate|perspective|filter/,R3e=/paint|layout|strict|content/,km=e=>!!e&&e!=="none";let E5;function z9(e){const t=md(e)?gd(e):e;return km(t.transform)||km(t.translate)||km(t.scale)||km(t.rotate)||km(t.perspective)||!V9()&&(km(t.backdropFilter)||km(t.filter))||j3e.test(t.willChange||"")||R3e.test(t.contain||"")}function I3e(e){let t=Mg(e);for(;kd(t)&&!Sw(t);){if(z9(t))return t;if(HN(t))return null;t=Mg(t)}return null}function V9(){return E5==null&&(E5=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),E5}function Sw(e){return/^(html|body|#document)$/.test(G1(e))}function gd(e){return Ka(e).getComputedStyle(e)}function qN(e){return md(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Mg(e){if(G1(e)==="html")return e;const t=e.assignedSlot||e.parentNode||JH(e)&&e.host||mh(e);return JH(t)?t.host:t}function wce(e){const t=Mg(e);return Sw(t)?(e.ownerDocument||e).body:kd(t)&&VN(t)?t:wce(t)}function Ew(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=wce(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),a=Ka(i);if(s){const l=p4(a);return t.concat(a,a.visualViewport||[],VN(i)?i:[],l&&n?Ew(l):[])}else return t.concat(i,Ew(i,[],n))}function p4(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Sce(e){const t=gd(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=kd(e),s=i?e.offsetWidth:n,a=i?e.offsetHeight:r,l=SC(n)!==s||SC(r)!==a;return l&&(n=s,r=a),{width:n,height:r,$:l}}function H9(e){return md(e)?e:e.contextElement}function py(e){const t=H9(e);if(!kd(t))return Lf(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=Sce(t);let a=(s?SC(n.width):n.width)/r,l=(s?SC(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const D3e=Lf(0);function Ece(e){const t=Ka(e);return!V9()||!t.visualViewport?D3e:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function P3e(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Ka(e)}function Lg(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=H9(e);let a=Lf(1);t&&(r?md(r)&&(a=py(r)):a=py(e));const l=P3e(s,n,r)?Ece(s):Lf(0);let c=(i.left+l.x)/a.x,u=(i.top+l.y)/a.y,d=i.width/a.x,f=i.height/a.y;if(s&&r){const h=Ka(s),m=md(r)?Ka(r):r;let g=h,b=p4(g);for(;b&&m!==g;){const y=py(b),O=b.getBoundingClientRect(),v=gd(b),x=O.left+(b.clientLeft+parseFloat(v.paddingLeft))*y.x,w=O.top+(b.clientTop+parseFloat(v.paddingTop))*y.y;c*=y.x,u*=y.y,d*=y.x,f*=y.y,c+=x,u+=w,g=Ka(b),b=p4(g)}}return kC({width:d,height:f,x:c,y:u})}function XN(e,t){const n=qN(e).scrollLeft;return t?t.left+n:Lg(mh(e)).left+n}function kce(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-XN(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function M3e(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",a=mh(r),l=t?HN(t.floating):!1;if(r===a||l&&s)return n;let c={scrollLeft:0,scrollTop:0},u=Lf(1);const d=Lf(0),f=kd(r);if((f||!s)&&((G1(r)!=="body"||VN(a))&&(c=qN(r)),f)){const m=Lg(r);u=py(r),d.x=m.x+r.clientLeft,d.y=m.y+r.clientTop}const h=a&&!f&&!s?kce(a,c):Lf(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+h.x,y:n.y*u.y-c.scrollTop*u.y+d.y+h.y}}function L3e(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function $3e(e){const t=qN(e),n=e.ownerDocument.body,r=Mf(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Mf(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-t.scrollLeft+XN(e);const a=-t.scrollTop;return gd(n).direction==="rtl"&&(s+=Mf(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:s,y:a}}const B3e=25;function Q3e(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",i=Ka(e),s=mh(e),a=i.visualViewport;let l=s.clientWidth,c=s.clientHeight,u=0,d=0;if(a){const h=!V9()||t==="fixed";r?h||(u=-a.offsetLeft,d=-a.offsetTop):(l=a.width,c=a.height,h&&(u=a.offsetLeft,d=a.offsetTop))}if(XN(s)<=0){const h=s.ownerDocument,m=h.body,g=getComputedStyle(m),b=h.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,y=Math.abs(s.clientWidth-m.clientWidth-b),O=getComputedStyle(s).scrollbarGutter==="stable both-edges"?y/2:y;O<=B3e&&(l-=O)}return{width:l,height:c,x:u,y:d}}function U3e(e,t){const n=Lg(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=py(e),a=e.clientWidth*s.x,l=e.clientHeight*s.y,c=i*s.x,u=r*s.y;return{width:a,height:l,x:c,y:u}}function eq(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=Q3e(e,n,t);else if(t==="document")r=$3e(mh(e));else if(md(t))r=U3e(t,n);else{const i=Ece(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return kC(r)}function F3e(e,t){const n=t.get(e);if(n)return n;let r=Ew(e,[],!1).filter(l=>md(l)&&G1(l)!=="body"),i=null;const s=gd(e).position==="fixed";let a=s?Mg(e):e;for(;md(a)&&!Sw(a);){const l=gd(a),c=z9(a),u=i?i.position:s?"fixed":"";!c&&(u==="fixed"||u==="absolute"&&l.position==="static")?r=r.filter(f=>f!==a):i=l,a=Mg(a)}return t.set(e,r),r}function z3e(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const a=[...n==="clippingAncestors"?HN(t)?[]:F3e(t,this._c):[].concat(n),r],l=eq(t,a[0],i);let c=l.top,u=l.right,d=l.bottom,f=l.left;for(let h=1;h{l(!1,1e-7)},1e3)}k=!1}try{r=new IntersectionObserver(_,{...E,root:s.ownerDocument})}catch{r=new IntersectionObserver(_,E)}r.observe(e)}const c=Ka(e),u=()=>l(n);return c.addEventListener("resize",u),l(!0),()=>{c.removeEventListener("resize",u),a()}}function Y3e(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=H9(e),d=i||s?[...u?Ew(u):[],...t?Ew(t):[]]:[];d.forEach(O=>{i&&O.addEventListener("scroll",n),s&&O.addEventListener("resize",n)});const f=u&&l?W3e(u,n,s):null;let h=-1,m=null;a&&(m=new ResizeObserver(O=>{let[v]=O;v&&v.target===u&&m&&t&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var x;(x=m)==null||x.observe(t)})),n()}),u&&!c&&m.observe(u),t&&m.observe(t));let g,b=c?Lg(e):null;c&&y();function y(){const O=Lg(e);b&&!Tce(b,O)&&n(),b=O,g=requestAnimationFrame(y)}return n(),()=>{var O;d.forEach(v=>{i&&v.removeEventListener("scroll",n),s&&v.removeEventListener("resize",n)}),f==null||f(),(O=m)==null||O.disconnect(),m=null,c&&cancelAnimationFrame(g)}}const Z3e=_3e,K3e=T3e,J3e=S3e,eMe=A3e,tMe=E3e,nq=w3e,nMe=C3e,rMe=(e,t,n)=>{const r=new Map,i=n??{},s={...G3e,...i.platform,_c:r};return v3e(e,t,{...i,platform:s})};var iMe=typeof document<"u",sMe=function(){},W_=iMe?p.useLayoutEffect:sMe;function _C(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!_C(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!_C(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Cce(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function rq(e,t){const n=Cce(e);return Math.round(t*n)/n}function _5(e){const t=p.useRef(e);return W_(()=>{t.current=e}),t}function aMe(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:a}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,m]=p.useState(r);_C(h,r)||m(r);const[g,b]=p.useState(null),[y,O]=p.useState(null),v=p.useCallback(Q=>{Q!==E.current&&(E.current=Q,b(Q))},[]),x=p.useCallback(Q=>{Q!==k.current&&(k.current=Q,O(Q))},[]),w=s||g,S=a||y,E=p.useRef(null),k=p.useRef(null),_=p.useRef(d),C=c!=null,T=_5(c),A=_5(i),j=_5(u),L=p.useCallback(()=>{if(!E.current||!k.current)return;const Q={placement:t,strategy:n,middleware:h};A.current&&(Q.platform=A.current),rMe(E.current,k.current,Q).then(F=>{const $={...F,isPositioned:j.current!==!1};I.current&&!_C(_.current,$)&&(_.current=$,Cr.flushSync(()=>{f($)}))})},[h,t,n,A,j]);W_(()=>{u===!1&&_.current.isPositioned&&(_.current.isPositioned=!1,f(Q=>({...Q,isPositioned:!1})))},[u]);const I=p.useRef(!1);W_(()=>(I.current=!0,()=>{I.current=!1}),[]),W_(()=>{if(w&&(E.current=w),S&&(k.current=S),w&&S){if(T.current)return T.current(w,S,L);L()}},[w,S,L,T,C]);const M=p.useMemo(()=>({reference:E,floating:k,setReference:v,setFloating:x}),[v,x]),N=p.useMemo(()=>({reference:w,floating:S}),[w,S]),D=p.useMemo(()=>{const Q={position:n,left:0,top:0};if(!N.floating)return Q;const F=rq(N.floating,d.x),$=rq(N.floating,d.y);return l?{...Q,transform:"translate("+F+"px, "+$+"px)",...Cce(N.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:$}},[n,l,N.floating,d.x,d.y]);return p.useMemo(()=>({...d,update:L,refs:M,elements:N,floatingStyles:D}),[d,L,M,N,D])}const oMe=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?nq({element:r.current,padding:i}).fn(n):{}:r?nq({element:r,padding:i}).fn(n):{}}}},lMe=(e,t)=>{const n=Z3e(e);return{name:n.name,fn:n.fn,options:[e,t]}},cMe=(e,t)=>{const n=K3e(e);return{name:n.name,fn:n.fn,options:[e,t]}},uMe=(e,t)=>({fn:nMe(e).fn,options:[e,t]}),dMe=(e,t)=>{const n=J3e(e);return{name:n.name,fn:n.fn,options:[e,t]}},fMe=(e,t)=>{const n=eMe(e);return{name:n.name,fn:n.fn,options:[e,t]}},hMe=(e,t)=>{const n=tMe(e);return{name:n.name,fn:n.fn,options:[e,t]}},pMe=(e,t)=>{const n=oMe(e);return{name:n.name,fn:n.fn,options:[e,t]}};var mMe=Object.defineProperty,Cp=(e,t)=>mMe(e,"name",{value:t,configurable:!0}),Ace="Popper",[Nce,W1]=rl(Ace),[gMe,jce]=Nce(Ace),bMe=Cp(e=>{const{__scopePopper:t,children:n}=e,[r,i]=p.useState(null),[s,a]=p.useState(void 0);return o.jsx(gMe,{scope:t,anchor:r,onAnchorChange:i,placementState:s,setPlacementState:a,children:n})},"Popper"),yMe="PopperAnchor",OMe=p.forwardRef(Cp(function(t,n){const{__scopePopper:r,virtualRef:i,...s}=t,a=jce(yMe,r),l=p.useRef(null),c=a.onAnchorChange,u=p.useCallback(b=>{l.current=b,b&&c(b)},[c]),d=zr(n,u),f=p.useRef(null);p.useEffect(()=>{if(!i)return;const b=f.current;f.current=i.current,b!==f.current&&c(f.current)});const h=a.placementState&&GN(a.placementState),m=h==null?void 0:h[0],g=h==null?void 0:h[1];return i?null:o.jsx(pi.div,{"data-radix-popper-side":m,"data-radix-popper-align":g,...s,ref:d})},"PopperAnchor")),Rce="PopperContent",[xMe,oMt]=Nce(Rce),vMe=p.forwardRef(Cp(function(t,n){var q,X,K,de,xe,Me,Ae;const{__scopePopper:r,side:i="bottom",sideOffset:s=0,align:a="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:g="optimized",onPlaced:b,...y}=t,O=jce(Rce,r),[v,x]=p.useState(null),w=zr(n,x),[S,E]=p.useState(null),k=KS(S),_=(k==null?void 0:k.width)??0,C=(k==null?void 0:k.height)??0,T=i+(a!=="center"?"-"+a:""),A=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},j=Array.isArray(d)?d:[d],L=j.length>0,I={padding:A,boundary:j.filter(Ice),altBoundary:L},{refs:M,floatingStyles:N,placement:D,isPositioned:Q,middlewareData:F}=aMe({strategy:"fixed",placement:T,whileElementsMounted:Cp((...He)=>Y3e(...He,{animationFrame:g==="always"}),"whileElementsMounted"),elements:{reference:O.anchor},middleware:[lMe({mainAxis:s+C,alignmentAxis:l}),u&&cMe({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?uMe():void 0,...I}),u&&dMe({...I}),fMe({...I,apply:Cp(({elements:He,rects:et,availableWidth:Te,availableHeight:Re})=>{const{width:he,height:me}=et.reference,Se=He.floating.style;Se.setProperty("--radix-popper-available-width",`${Te}px`),Se.setProperty("--radix-popper-available-height",`${Re}px`),Se.setProperty("--radix-popper-anchor-width",`${he}px`),Se.setProperty("--radix-popper-anchor-height",`${me}px`)},"apply")}),S&&pMe({element:S,padding:c}),wMe({arrowWidth:_,arrowHeight:C}),m&&hMe({strategy:"referenceHidden",...I,boundary:L?I.boundary:void 0})]}),$=O.setPlacementState;Ic(()=>($(D),()=>{$(void 0)}),[D,$]);const[H,z]=GN(D),B=yu(b);Ic(()=>{Q&&(B==null||B())},[Q,B]);const V=(q=F.arrow)==null?void 0:q.x,Z=(X=F.arrow)==null?void 0:X.y,ce=((K=F.arrow)==null?void 0:K.centerOffset)!==0,[be,ie]=p.useState();return Ic(()=>{v&&ie(window.getComputedStyle(v).zIndex)},[v]),o.jsx("div",{ref:M.setFloating,"data-radix-popper-content-wrapper":"",style:{...N,transform:Q?N.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:be,"--radix-popper-transform-origin":[(de=F.transformOrigin)==null?void 0:de.x,(xe=F.transformOrigin)==null?void 0:xe.y].join(" "),...((Me=F.hide)==null?void 0:Me.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:o.jsx(xMe,{scope:r,placedSide:H,placedAlign:z,onArrowChange:E,arrowX:V,arrowY:Z,shouldHideArrow:ce,children:o.jsx(pi.div,{"data-side":H,"data-align":z,...y,ref:w,style:{...y.style,animation:Q?(Ae=y.style)==null?void 0:Ae.animation:"none"}})})})},"PopperContent"));function Ice(e){return e!==null}Cp(Ice,"isNotNull");var wMe=Cp(e=>({name:"transformOrigin",options:e,fn(t){var y,O,v;const{placement:n,rects:r,middlewareData:i}=t,a=((y=i.arrow)==null?void 0:y.centerOffset)!==0,l=a?0:e.arrowWidth,c=a?0:e.arrowHeight,[u,d]=GN(n),f={start:"0%",center:"50%",end:"100%"}[d],h=(((O=i.arrow)==null?void 0:O.x)??0)+l/2,m=(((v=i.arrow)==null?void 0:v.y)??0)+c/2;let g="",b="";return u==="bottom"?(g=a?f:`${h}px`,b=`${-c}px`):u==="top"?(g=a?f:`${h}px`,b=`${r.floating.height+c}px`):u==="right"?(g=`${-c}px`,b=a?f:`${m}px`):u==="left"&&(g=`${r.floating.width+c}px`,b=a?f:`${m}px`),{data:{x:g,y:b}}}}),"transformOrigin");function GN(e){const[t,n="center"]=e.split("-");return[t,n]}Cp(GN,"getSideAndAlignFromPlacement");var WN=bMe,q9=OMe,X9=vMe,SMe=Object.defineProperty,G9=(e,t)=>SMe(e,"name",{value:t,configurable:!0}),T5=!1;function Dce(){const[e,t]=p.useState(T5);return p.useEffect(()=>{T5||(T5=!0,t(!0))},[]),e}G9(Dce,"useIsHydrated");var Pce=r0[" useSyncExternalStore ".trim().toString()];function Mce(){return()=>{}}G9(Mce,"subscribe");function Lce(){return Pce(Mce,()=>!0,()=>!1)}G9(Lce,"useIsHydratedModern");var EMe=typeof Pce=="function"?Lce:Dce,kMe=Object.defineProperty,f0=(e,t)=>kMe(e,"name",{value:t,configurable:!0}),C5="rovingFocusGroup.onEntryFocus",_Me={bubbles:!1,cancelable:!0},YN="RovingFocusGroup",[m4,$ce,TMe]=A9(YN),[CMe,Y1]=rl(YN,[TMe]),[AMe,NMe]=CMe(YN),jMe=p.forwardRef(f0(function(t,n){return o.jsx(m4.Provider,{scope:t.__scopeRovingFocusGroup,children:o.jsx(m4.Slot,{scope:t.__scopeRovingFocusGroup,children:o.jsx(RMe,{...t,ref:n})})})},"RovingFocusGroup")),RMe=p.forwardRef(f0(function(t,n){const{__scopeRovingFocusGroup:r,orientation:i,loop:s=!1,dir:a,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...h}=t,m=p.useRef(null),g=zr(n,m),b=ZS(a),[y,O]=Bc({prop:l,defaultProp:c??null,onChange:u,caller:YN}),[v,x]=p.useState(!1),w=yu(d),S=$ce(r),E=p.useRef(!1),[k,_]=p.useState(0);return p.useEffect(()=>{const C=m.current;if(C)return C.addEventListener(C5,w),()=>C.removeEventListener(C5,w)},[w]),o.jsx(AMe,{scope:r,orientation:i,dir:b,loop:s,currentTabStopId:y,onItemFocus:p.useCallback(C=>O(C),[O]),onItemShiftTab:p.useCallback(()=>x(!0),[]),onFocusableItemAdd:p.useCallback(()=>_(C=>C+1),[]),onFocusableItemRemove:p.useCallback(()=>_(C=>C-1),[]),children:o.jsx(pi.div,{tabIndex:v||k===0?-1:0,"data-orientation":i,...h,ref:g,style:{outline:"none",...t.style},onMouseDown:mn(t.onMouseDown,()=>{E.current=!0}),onFocus:mn(t.onFocus,C=>{const T=!E.current;if(C.target===C.currentTarget&&T&&!v){const A=new CustomEvent(C5,_Me);if(C.currentTarget.dispatchEvent(A),!A.defaultPrevented){const j=S().filter(D=>D.focusable),L=j.find(D=>D.active),I=j.find(D=>D.id===y),N=[L,I,...j].filter(Boolean).map(D=>D.ref.current);W9(N,f)}}E.current=!1}),onBlur:mn(t.onBlur,()=>x(!1))})})},"RovingFocusGroupImpl")),IMe="RovingFocusGroupItem",DMe=p.forwardRef(f0(function(t,n){const{__scopeRovingFocusGroup:r,focusable:i=!0,active:s=!1,tabStopId:a,children:l,...c}=t,u=Fp(),d=a||u,f=NMe(IMe,r),h=f.currentTabStopId===d,m=$ce(r),{onFocusableItemAdd:g,onFocusableItemRemove:b,currentTabStopId:y}=f,O=EMe();return Ic(()=>{if(!(!O||!i))return g(),()=>b()},[O,i,g,b]),p.useEffect(()=>{if(!(O||!i))return g(),()=>b()},[O,i,g,b]),o.jsx(m4.ItemSlot,{scope:r,id:d,focusable:i,active:s,children:o.jsx(pi.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...c,ref:n,onMouseDown:mn(t.onMouseDown,v=>{i?f.onItemFocus(d):v.preventDefault()}),onFocus:mn(t.onFocus,()=>f.onItemFocus(d)),onKeyDown:mn(t.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){f.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const x=Qce(v,f.orientation,f.dir);if(x!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let S=m().filter(E=>E.focusable).map(E=>E.ref.current);if(x==="last")S.reverse();else if(x==="prev"||x==="next"){x==="prev"&&S.reverse();const E=S.indexOf(v.currentTarget);S=f.loop?Uce(S,E+1):S.slice(E+1)}setTimeout(()=>W9(S))}}),children:typeof l=="function"?l({isCurrentTabStop:h,hasTabStop:y!=null}):l})})},"RovingFocusGroupItem")),PMe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Bce(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}f0(Bce,"getDirectionAwareKey");function Qce(e,t,n){const r=Bce(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return PMe[r]}f0(Qce,"getFocusIntent");function W9(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}f0(W9,"focusFirst");function Uce(e,t){return e.map((n,r)=>e[(t+r)%e.length])}f0(Uce,"wrapArray");var Y9=jMe,Z9=DMe,MMe=Object.defineProperty,Ir=(e,t)=>MMe(e,"name",{value:t,configurable:!0}),g4=["Enter"," "],LMe=["ArrowDown","PageUp","Home"],Fce=["ArrowUp","PageDown","End"],$Me=[...LMe,...Fce],BMe={ltr:[...g4,"ArrowRight"],rtl:[...g4,"ArrowLeft"]},QMe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ZN="Menu",[kw,UMe,FMe]=A9(ZN),[h0,zce]=rl(ZN,[FMe,W1,Y1]),KN=W1(),Vce=Y1(),[Hce,um]=h0(ZN),[zMe,JS]=h0(ZN),VMe=Ir(e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:s,modal:a=!0}=e,l=KN(t),[c,u]=p.useState(null),d=p.useRef(!1),f=yu(s),h=ZS(i);return p.useEffect(()=>{const m=Ir(()=>{d.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},"handleKeyDown"),g=Ir(()=>d.current=!1,"handlePointer");return document.addEventListener("keydown",m,{capture:!0}),()=>{document.removeEventListener("keydown",m,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),p.useEffect(()=>{if(!n)return;const m=Ir(()=>f(!1),"handleBlur");return window.addEventListener("blur",m),()=>window.removeEventListener("blur",m)},[n,f]),o.jsx(WN,{...l,children:o.jsx(Hce,{scope:t,open:n,onOpenChange:f,content:c,onContentChange:u,children:o.jsx(zMe,{scope:t,onClose:p.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:h,modal:a,children:r})})})},"Menu"),qce=p.forwardRef(Ir(function(t,n){const{__scopeMenu:r,...i}=t,s=KN(r);return o.jsx(q9,{...s,...i,ref:n})},"MenuAnchor")),Xce="MenuPortal",[HMe,Gce]=h0(Xce,{forceMount:void 0}),qMe=Ir(e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,s=um(Xce,t);return o.jsx(HMe,{scope:t,forceMount:n,children:o.jsx(Ed,{present:n||s.open,children:o.jsx(D9,{asChild:!0,container:i,children:r})})})},"MenuPortal"),pu="MenuContent",[XMe,K9]=h0(pu),GMe=p.forwardRef(Ir(function(t,n){const r=Gce(pu,t.__scopeMenu),{forceMount:i=r.forceMount,...s}=t,a=um(pu,t.__scopeMenu),l=JS(pu,t.__scopeMenu);return o.jsx(kw.Provider,{scope:t.__scopeMenu,children:o.jsx(Ed,{present:i||a.open,children:o.jsx(kw.Slot,{scope:t.__scopeMenu,children:l.modal?o.jsx(WMe,{...s,ref:n}):o.jsx(YMe,{...s,ref:n})})})})},"MenuContent")),WMe=p.forwardRef(Ir(function(t,n){const r=um(pu,t.__scopeMenu),i=p.useRef(null),s=zr(n,i);return p.useEffect(()=>{const a=i.current;if(a)return mce(a)},[]),o.jsx(J9,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:mn(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentModal")),YMe=p.forwardRef(Ir(function(t,n){const r=um(pu,t.__scopeMenu);return o.jsx(J9,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentNonModal")),ZMe=Jf("MenuContent.ScrollLock"),J9=p.forwardRef(Ir(function(t,n){const{__scopeMenu:r,loop:i=!1,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEntryFocus:u,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:g,disableOutsideScroll:b,...y}=t,O=um(pu,r),v=JS(pu,r),x=KN(r),w=Vce(r),S=UMe(r),[E,k]=p.useState(null),_=p.useRef(null),C=zr(n,_,O.onContentChange),T=p.useRef(0),A=p.useRef(""),j=p.useRef(0),L=p.useRef(null),I=p.useRef("right"),M=p.useRef(0),N=b?M9:p.Fragment,D=b?{as:ZMe,allowPinchZoom:!0}:void 0,Q=Ir($=>{var ie,q;const H=A.current+$,z=S().filter(X=>!X.disabled),B=document.activeElement,V=(ie=z.find(X=>X.ref.current===B))==null?void 0:ie.textValue,Z=z.map(X=>X.textValue),ce=nue(Z,H,V),be=(q=z.find(X=>X.textValue===ce))==null?void 0:q.ref.current;Ir(function X(K){A.current=K,window.clearTimeout(T.current),K!==""&&(T.current=window.setTimeout(()=>X(""),1e3))},"updateSearch")(H),be&&setTimeout(()=>be.focus())},"handleTypeaheadSearch");p.useEffect(()=>()=>window.clearTimeout(T.current),[]),UN();const F=p.useCallback($=>{var z,B;return I.current===((z=L.current)==null?void 0:z.side)&&iue($,(B=L.current)==null?void 0:B.area)},[]);return o.jsx(XMe,{scope:r,searchRef:A,onItemEnter:p.useCallback($=>{F($)&&$.preventDefault()},[F]),onItemLeave:p.useCallback($=>{var H;F($)||((H=_.current)==null||H.focus(),k(null))},[F]),onTriggerLeave:p.useCallback($=>{F($)&&$.preventDefault()},[F]),pointerGraceTimerRef:j,onPointerGraceIntentChange:p.useCallback($=>{L.current=$},[]),children:o.jsx(N,{...D,children:o.jsx(ece,{asChild:!0,trapped:s,onMountAutoFocus:mn(a,$=>{var H;$.preventDefault(),(H=_.current)==null||H.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:o.jsx(j9,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:g,children:o.jsx(Y9,{asChild:!0,...w,dir:v.dir,orientation:"vertical",loop:i,currentTabStopId:E,onCurrentTabStopIdChange:k,onEntryFocus:mn(u,$=>{v.isUsingKeyboardRef.current||$.preventDefault()}),preventScrollOnEntryFocus:!0,children:o.jsx(X9,{role:"menu","aria-orientation":"vertical","data-state":t7(O.open),"data-radix-menu-content":"",dir:v.dir,...x,...y,ref:C,style:{outline:"none",...y.style},onKeyDown:mn(y.onKeyDown,$=>{const z=$.target.closest("[data-radix-menu-content]")===$.currentTarget,B=$.ctrlKey||$.altKey||$.metaKey,V=$.key.length===1;z&&($.key==="Tab"&&$.preventDefault(),!B&&V&&Q($.key));const Z=_.current;if($.target!==Z||!$Me.includes($.key))return;$.preventDefault();const be=S().filter(ie=>!ie.disabled).map(ie=>ie.ref.current);Fce.includes($.key)&&be.reverse(),eue(be)}),onBlur:mn(t.onBlur,$=>{$.currentTarget.contains($.target)||(window.clearTimeout(T.current),A.current="")}),onPointerMove:mn(t.onPointerMove,e1($=>{const H=$.target,z=M.current!==$.clientX;if($.currentTarget.contains(H)&&z){const B=$.clientX>M.current?"right":"left";I.current=B,M.current=$.clientX}}))})})})})})})},"MenuContentImpl")),KMe=p.forwardRef(Ir(function(t,n){const{__scopeMenu:r,...i}=t;return o.jsx(pi.div,{role:"group",...i,ref:n})},"MenuGroup")),b4="MenuItem",iq="menu.itemSelect",e7=p.forwardRef(Ir(function(t,n){const{disabled:r=!1,onSelect:i,...s}=t,a=p.useRef(null),l=JS(b4,t.__scopeMenu),c=K9(b4,t.__scopeMenu),u=zr(n,a),d=p.useRef(!1),f=Ir(()=>{const h=a.current;if(!r&&h){const m=new CustomEvent(iq,{bubbles:!0,cancelable:!0});h.addEventListener(iq,g=>i==null?void 0:i(g),{once:!0}),C9(h,m),m.defaultPrevented?d.current=!1:l.onClose()}},"handleSelect");return o.jsx(Wce,{...s,ref:u,disabled:r,onClick:mn(t.onClick,f),onPointerDown:h=>{var m;(m=t.onPointerDown)==null||m.call(t,h),d.current=!0},onPointerUp:mn(t.onPointerUp,h=>{var m;d.current||(m=h.currentTarget)==null||m.click()}),onKeyDown:mn(t.onKeyDown,h=>{r||h.target!==h.currentTarget||c.searchRef.current!==""&&h.key===" "||g4.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})},"MenuItem")),Wce=p.forwardRef(Ir(function(t,n){const{__scopeMenu:r,disabled:i=!1,textValue:s,...a}=t,l=K9(b4,r),c=Vce(r),u=p.useRef(null),d=zr(n,u),[f,h]=p.useState(!1),[m,g]=p.useState("");return p.useEffect(()=>{const b=u.current;b&&g((b.textContent??"").trim())},[a.children]),o.jsx(kw.ItemSlot,{scope:r,disabled:i,textValue:s??m,children:o.jsx(Z9,{asChild:!0,...c,focusable:!i,children:o.jsx(pi.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":i||void 0,"data-disabled":i?"":void 0,...a,ref:d,onPointerMove:mn(t.onPointerMove,e1(b=>{i?l.onItemLeave(b):(l.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:mn(t.onPointerLeave,e1(b=>l.onItemLeave(b))),onFocus:mn(t.onFocus,()=>h(!0)),onBlur:mn(t.onBlur,()=>h(!1))})})})},"MenuItemImpl")),JMe=p.forwardRef(Ir(function(t,n){const{checked:r=!1,onCheckedChange:i,...s}=t;return o.jsx(Zce,{scope:t.__scopeMenu,checked:r,children:o.jsx(e7,{role:"menuitemcheckbox","aria-checked":_w(r)?"mixed":r,...s,ref:n,"data-state":JN(r),onSelect:mn(s.onSelect,()=>i==null?void 0:i(_w(r)?!0:!r),{checkForDefaultPrevented:!1})})})},"MenuCheckboxItem")),e4e="MenuRadioGroup",[t4e,n4e]=h0(e4e,{value:void 0,onValueChange:Ir(()=>{},"onValueChange")}),r4e=p.forwardRef(Ir(function(t,n){const{value:r,onValueChange:i,...s}=t,a=yu(i);return o.jsx(t4e,{scope:t.__scopeMenu,value:r,onValueChange:a,children:o.jsx(KMe,{...s,ref:n})})},"MenuRadioGroup")),i4e="MenuRadioItem",s4e=p.forwardRef(Ir(function(t,n){const{value:r,...i}=t,s=n4e(i4e,t.__scopeMenu),a=r===s.value;return o.jsx(Zce,{scope:t.__scopeMenu,checked:a,children:o.jsx(e7,{role:"menuitemradio","aria-checked":a,...i,ref:n,"data-state":JN(a),onSelect:mn(i.onSelect,()=>{var l;return(l=s.onValueChange)==null?void 0:l.call(s,r)},{checkForDefaultPrevented:!1})})})},"MenuRadioItem")),Yce="MenuItemIndicator",[Zce,a4e]=h0(Yce,{checked:!1}),o4e=p.forwardRef(Ir(function(t,n){const{__scopeMenu:r,forceMount:i,...s}=t,a=a4e(Yce,r);return o.jsx(Ed,{present:i||_w(a.checked)||a.checked===!0,children:o.jsx(pi.span,{...s,ref:n,"data-state":JN(a.checked)})})},"MenuItemIndicator")),l4e=p.forwardRef(Ir(function(t,n){const{__scopeMenu:r,...i}=t;return o.jsx(pi.div,{role:"separator","aria-orientation":"horizontal",...i,ref:n})},"MenuSeparator")),Kce="MenuSub",[c4e,Jce]=h0(Kce),u4e=Ir(e=>{const{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,s=um(Kce,t),a=KN(t),[l,c]=p.useState(null),[u,d]=p.useState(null),f=yu(i);return p.useEffect(()=>(s.open===!1&&f(!1),()=>f(!1)),[s.open,f]),o.jsx(WN,{...a,children:o.jsx(Hce,{scope:t,open:r,onOpenChange:f,content:u,onContentChange:d,children:o.jsx(c4e,{scope:t,contentId:Fp(),triggerId:Fp(),trigger:l,onTriggerChange:c,children:n})})})},"MenuSub"),e2="MenuSubTrigger",d4e=p.forwardRef(Ir(function(t,n){const r=um(e2,t.__scopeMenu),i=JS(e2,t.__scopeMenu),s=Jce(e2,t.__scopeMenu),a=K9(e2,t.__scopeMenu),l=p.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:u}=a,d={__scopeMenu:t.__scopeMenu},f=p.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);p.useEffect(()=>f,[f]),p.useEffect(()=>{const m=c.current;return()=>{window.clearTimeout(m),u(null)}},[c,u]);const h=zr(n,s.onTriggerChange);return o.jsx(qce,{asChild:!0,...d,children:o.jsx(Wce,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?s.contentId:void 0,"data-state":t7(r.open),...t,ref:h,onClick:m=>{var g;(g=t.onClick)==null||g.call(t,m),!(t.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:mn(t.onPointerMove,e1(m=>{a.onItemEnter(m),!m.defaultPrevented&&!t.disabled&&!r.open&&!l.current&&(a.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{r.onOpenChange(!0),f()},100))})),onPointerLeave:mn(t.onPointerLeave,e1(m=>{var b,y;f();const g=(b=r.content)==null?void 0:b.getBoundingClientRect();if(g){const O=(y=r.content)==null?void 0:y.dataset.side,v=O==="right",x=v?-5:5,w=g[v?"left":"right"],S=g[v?"right":"left"];a.onPointerGraceIntentChange({area:[{x:m.clientX+x,y:m.clientY},{x:w,y:g.top},{x:S,y:g.top},{x:S,y:g.bottom},{x:w,y:g.bottom}],side:O}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(m),m.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:mn(t.onKeyDown,m=>{var b;t.disabled||m.target!==m.currentTarget||a.searchRef.current!==""&&m.key===" "||BMe[i.dir].includes(m.key)&&(r.onOpenChange(!0),(b=r.content)==null||b.focus(),m.preventDefault())})})})},"MenuSubTrigger")),f4e="MenuSubContent",h4e=p.forwardRef(Ir(function(t,n){const r=Gce(pu,t.__scopeMenu),{forceMount:i=r.forceMount,align:s="start",...a}=t,l=um(pu,t.__scopeMenu),c=JS(pu,t.__scopeMenu),u=Jce(f4e,t.__scopeMenu),d=p.useRef(null),f=zr(n,d);return o.jsx(kw.Provider,{scope:t.__scopeMenu,children:o.jsx(Ed,{present:i||l.open,children:o.jsx(kw.Slot,{scope:t.__scopeMenu,children:o.jsx(J9,{id:u.contentId,"aria-labelledby":u.triggerId,...a,ref:f,align:s,side:c.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:h=>{var m;c.isUsingKeyboardRef.current&&((m=d.current)==null||m.focus()),h.preventDefault()},onCloseAutoFocus:h=>h.preventDefault(),onFocusOutside:mn(t.onFocusOutside,h=>{h.target!==u.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:mn(t.onEscapeKeyDown,h=>{c.onClose(),h.preventDefault()}),onKeyDown:mn(t.onKeyDown,h=>{var b;const m=h.currentTarget.contains(h.target),g=QMe[c.dir].includes(h.key);m&&g&&(l.onOpenChange(!1),(b=u.trigger)==null||b.focus(),h.preventDefault())})})})})})},"MenuSubContent"));function t7(e){return e?"open":"closed"}Ir(t7,"getOpenState");function _w(e){return e==="indeterminate"}Ir(_w,"isIndeterminate");function JN(e){return _w(e)?"indeterminate":e?"checked":"unchecked"}Ir(JN,"getCheckedState");function eue(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}Ir(eue,"focusFirst");function tue(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Ir(tue,"wrapArray");function nue(e,t,n){const i=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=tue(e,Math.max(s,0));i.length===1&&(a=a.filter(u=>u!==n));const c=a.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return c!==n?c:void 0}Ir(nue,"getNextMatch");function rue(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,a=t.length-1;sr!=h>r&&n<(f-u)*(r-d)/(h-d)+u&&(i=!i)}return i}Ir(rue,"isPointInPolygon");function iue(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return rue(n,t)}Ir(iue,"isPointerInGraceArea");function e1(e){return t=>t.pointerType==="mouse"?e(t):void 0}Ir(e1,"whenMouse");var p4e=VMe,m4e=qce,g4e=qMe,b4e=GMe,y4e=e7,O4e=JMe,x4e=r4e,v4e=s4e,w4e=o4e,S4e=l4e,E4e=u4e,k4e=d4e,_4e=h4e,T4e=Object.defineProperty,Hl=(e,t)=>T4e(e,"name",{value:t,configurable:!0}),n7="DropdownMenu",[C4e,lMt]=rl(n7,[zce]),ql=zce(),[A4e,sue]=C4e(n7),N4e=Hl(e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:s,onOpenChange:a,modal:l=!0}=e,c=ql(t),u=p.useRef(null),[d,f]=Bc({prop:i,defaultProp:s??!1,onChange:a,caller:n7});return o.jsx(A4e,{scope:t,triggerId:Fp(),triggerRef:u,contentId:Fp(),open:d,onOpenChange:f,onOpenToggle:p.useCallback(()=>f(h=>!h),[f]),modal:l,children:o.jsx(p4e,{...c,open:d,onOpenChange:f,dir:r,modal:l,children:n})})},"DropdownMenu"),j4e="DropdownMenuTrigger",R4e=p.forwardRef(Hl(function(t,n){const{__scopeDropdownMenu:r,disabled:i=!1,...s}=t,a=sue(j4e,r),l=ql(r),c=zr(n,a.triggerRef);return o.jsx(m4e,{asChild:!0,...l,children:o.jsx(pi.button,{type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?"open":"closed","data-disabled":i?"":void 0,disabled:i,...s,ref:c,onPointerDown:mn(t.onPointerDown,u=>{!i&&u.button===0&&u.ctrlKey===!1&&(a.onOpenToggle(),a.open||u.preventDefault())}),onKeyDown:mn(t.onKeyDown,u=>{i||(["Enter"," "].includes(u.key)&&a.onOpenToggle(),u.key==="ArrowDown"&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(u.key)&&u.preventDefault())})})})},"DropdownMenuTrigger")),I4e=Hl(e=>{const{__scopeDropdownMenu:t,...n}=e,r=ql(t);return o.jsx(g4e,{...r,...n})},"DropdownMenuPortal"),D4e="DropdownMenuContent",P4e=p.forwardRef(Hl(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=sue(D4e,r),a=ql(r),l=p.useRef(!1);return o.jsx(b4e,{id:s.contentId,"aria-labelledby":s.triggerId,...a,...i,ref:n,onCloseAutoFocus:mn(t.onCloseAutoFocus,c=>{var u;l.current||(u=s.triggerRef.current)==null||u.focus(),l.current=!1,c.preventDefault()}),onInteractOutside:mn(t.onInteractOutside,c=>{const u=c.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0,f=u.button===2||d;(!s.modal||f)&&(l.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuContent")),M4e=p.forwardRef(Hl(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=ql(r);return o.jsx(y4e,{...s,...i,ref:n})},"DropdownMenuItem")),L4e=p.forwardRef(Hl(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=ql(r);return o.jsx(O4e,{...s,...i,ref:n})},"DropdownMenuCheckboxItem")),$4e=p.forwardRef(Hl(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=ql(r);return o.jsx(x4e,{...s,...i,ref:n})},"DropdownMenuRadioGroup")),B4e=p.forwardRef(Hl(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=ql(r);return o.jsx(v4e,{...s,...i,ref:n})},"DropdownMenuRadioItem")),Q4e=p.forwardRef(Hl(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=ql(r);return o.jsx(w4e,{...s,...i,ref:n})},"DropdownMenuItemIndicator")),U4e=p.forwardRef(Hl(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=ql(r);return o.jsx(S4e,{...s,...i,ref:n})},"DropdownMenuSeparator")),F4e=Hl(e=>{const{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:s}=e,a=ql(t),[l,c]=Bc({prop:r,defaultProp:s??!1,onChange:i,caller:"DropdownMenuSub"});return o.jsx(E4e,{...a,open:l,onOpenChange:c,children:n})},"DropdownMenuSub"),z4e=p.forwardRef(Hl(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=ql(r);return o.jsx(k4e,{...s,...i,ref:n})},"DropdownMenuSubTrigger")),V4e=p.forwardRef(Hl(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=ql(r);return o.jsx(_4e,{...s,...i,ref:n,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuSubContent")),H4e=N4e,q4e=R4e,aue=I4e,X4e=P4e,oue=M4e,G4e=L4e,W4e=$4e,Y4e=B4e,lue=Q4e,Z4e=U4e,K4e=F4e,J4e=z4e,eLe=V4e,tLe=Object.defineProperty,dm=(e,t)=>tLe(e,"name",{value:t,configurable:!0}),r7="Popover",[cue,cMt]=rl(r7,[W1]),i7=W1(),[nLe,Z1]=cue(r7),rLe=dm(e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:a=!1}=e,l=i7(t),c=p.useRef(null),[u,d]=p.useState(!1),[f,h]=Bc({prop:r,defaultProp:i??!1,onChange:s,caller:r7});return o.jsx(WN,{...l,children:o.jsx(nLe,{scope:t,contentId:Fp(),triggerRef:c,open:f,onOpenChange:h,onOpenToggle:p.useCallback(()=>h(m=>!m),[h]),hasCustomAnchor:u,onCustomAnchorAdd:p.useCallback(()=>d(!0),[]),onCustomAnchorRemove:p.useCallback(()=>d(!1),[]),modal:a,children:n})})},"Popover"),iLe="PopoverTrigger",sLe=p.forwardRef(dm(function(t,n){const{__scopePopover:r,...i}=t,s=Z1(iLe,r),a=i7(r),l=zr(n,s.triggerRef),c=o.jsx(pi.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s7(s.open),...i,ref:l,onClick:mn(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?c:o.jsx(q9,{asChild:!0,...a,children:c})},"PopoverTrigger")),uue="PopoverPortal",[aLe,oLe]=cue(uue,{forceMount:void 0}),lLe=dm(e=>{const{__scopePopover:t,forceMount:n,children:r,container:i}=e,s=Z1(uue,t);return o.jsx(aLe,{scope:t,forceMount:n,children:o.jsx(Ed,{present:n||s.open,children:o.jsx(D9,{asChild:!0,container:i,children:r})})})},"PopoverPortal"),Tw="PopoverContent",cLe=p.forwardRef(dm(function(t,n){const r=oLe(Tw,t.__scopePopover),{forceMount:i=r.forceMount,...s}=t,a=Z1(Tw,t.__scopePopover);return o.jsx(Ed,{present:i||a.open,children:a.modal?o.jsx(dLe,{...s,ref:n}):o.jsx(fLe,{...s,ref:n})})},"PopoverContent")),uLe=Jf("PopoverContent.RemoveScroll"),dLe=p.forwardRef(dm(function(t,n){const r=Z1(Tw,t.__scopePopover),i=p.useRef(null),s=zr(n,i),a=p.useRef(!1);return p.useEffect(()=>{const l=i.current;if(l)return mce(l)},[]),o.jsx(M9,{as:uLe,allowPinchZoom:!0,children:o.jsx(due,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:mn(t.onCloseAutoFocus,l=>{var c;l.preventDefault(),a.current||(c=r.triggerRef.current)==null||c.focus()}),onPointerDownOutside:mn(t.onPointerDownOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;a.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:mn(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})},"PopoverContentModal")),fLe=p.forwardRef(dm(function(t,n){const r=Z1(Tw,t.__scopePopover),i=p.useRef(!1),s=p.useRef(!1);return o.jsx(due,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var l,c;(l=t.onCloseAutoFocus)==null||l.call(t,a),a.defaultPrevented||(i.current||(c=r.triggerRef.current)==null||c.focus(),a.preventDefault()),i.current=!1,s.current=!1},onInteractOutside:a=>{var u,d;(u=t.onInteractOutside)==null||u.call(t,a),a.defaultPrevented||(i.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=a.target;((d=r.triggerRef.current)==null?void 0:d.contains(l))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})},"PopoverContentNonModal")),due=p.forwardRef(dm(function(t,n){const{__scopePopover:r,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,...h}=t,m=Z1(Tw,r),g=i7(r);return UN(),o.jsx(ece,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:s,onUnmountAutoFocus:a,children:o.jsx(j9,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:f,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onDismiss:()=>m.onOpenChange(!1),deferPointerDownOutside:!0,children:o.jsx(X9,{"data-state":s7(m.open),role:"dialog",id:m.contentId,...g,...h,ref:n,style:{...h.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})},"PopoverContentImpl"));function s7(e){return e?"open":"closed"}dm(s7,"getState");var fue=rLe,hue=sLe,pue=lLe,mue=cLe,hLe=Object.defineProperty,Ja=(e,t)=>hLe(e,"name",{value:t,configurable:!0}),gue="Radio",[pLe,bue]=rl(gue),[mLe,ej]=pLe(gue);function yue(e){const{__scopeRadio:t,checked:n=!1,children:r,disabled:i,form:s,name:a,onCheck:l,required:c,value:u="on",internal_do_not_use_render:d}=e,[f,h]=p.useState(null),[m,g]=p.useState(null),b=p.useRef(!1),[y,O]=p.useReducer(w=>w+1,0),v=f?!!s||!!f.closest("form"):!0,x={checked:n,disabled:i,required:c,name:a,form:s,value:u,control:f,setControl:h,hasConsumerStoppedPropagationRef:b,userInteractionCount:y,onUserInteraction:O,isFormControl:v,bubbleInput:m,setBubbleInput:g,onCheck:Ja(()=>l==null?void 0:l(),"onCheck")};return o.jsx(mLe,{scope:t,...x,children:Oue(d)?d(x):r})}Ja(yue,"RadioProvider");var gLe="RadioTrigger",bLe=p.forwardRef(Ja(function({__scopeRadio:t,onClick:n,...r},i){const{checked:s,disabled:a,value:l,setControl:c,onCheck:u,hasConsumerStoppedPropagationRef:d,onUserInteraction:f,isFormControl:h,bubbleInput:m}=ej(gLe,t),g=zr(i,c);return o.jsx(pi.button,{type:"button",role:"radio","aria-checked":s,"data-state":a7(s),"data-disabled":a?"":void 0,disabled:a,value:l,...r,ref:g,onClick:mn(n,b=>{s||(f(),u()),m&&h&&(d.current=b.isPropagationStopped(),d.current||b.stopPropagation())})})},"RadioTrigger")),yLe="RadioIndicator",OLe=p.forwardRef(Ja(function(t,n){const{__scopeRadio:r,forceMount:i,...s}=t,a=ej(yLe,r);return o.jsx(Ed,{present:i||a.checked,children:o.jsx(pi.span,{"data-state":a7(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:n})})},"RadioIndicator")),xLe="RadioBubbleInput",vLe=p.forwardRef(Ja(function({__scopeRadio:t,onClick:n,...r},i){const{control:s,checked:a,required:l,disabled:c,name:u,value:d,form:f,bubbleInput:h,setBubbleInput:m,hasConsumerStoppedPropagationRef:g,userInteractionCount:b}=ej(xLe,t),y=zr(i,m),O=KS(s),v=p.useRef(!1),x=p.useRef(a),w=p.useRef(b);p.useEffect(()=>{const E=h;if(!E)return;const k=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(k,"checked").set,T=b!==w.current;w.current=b;const A=x.current!==a;x.current=a;const j=!(T&&g.current);if(A&&C){v.current=!T;const L=new Event("click",{bubbles:j});C.call(E,a),E.dispatchEvent(L),v.current=!1}},[h,a,g,b]);const S=p.useRef(a);return o.jsx(pi.input,{type:"radio","aria-hidden":!0,defaultChecked:S.current,required:l,disabled:c,name:u,value:d,form:f,...r,tabIndex:-1,ref:y,onClick:mn(n,E=>{v.current&&E.stopPropagation()}),style:{...r.style,...O,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"RadioBubbleInput"));function Oue(e){return typeof e=="function"}Ja(Oue,"isFunction");function a7(e){return e?"checked":"unchecked"}Ja(a7,"getState");var wLe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],o7="RadioGroup",[SLe,uMt]=rl(o7,[Y1,bue]),xue=Y1(),tj=bue(),[ELe,kLe]=SLe(o7),_Le=p.forwardRef(Ja(function(t,n){const{__scopeRadioGroup:r,name:i,form:s,defaultValue:a,value:l,required:c=!1,disabled:u=!1,orientation:d,dir:f,loop:h=!0,onValueChange:m,...g}=t,b=xue(r),y=ZS(f),[O,v]=Bc({prop:l,defaultProp:a??null,onChange:m,caller:o7}),[x,w]=p.useState(null),S=zr(n,w),E=p.useRef(O);return p.useEffect(()=>{const k=s?x==null?void 0:x.ownerDocument.getElementById(s):x==null?void 0:x.closest("form");if(k instanceof HTMLFormElement){const _=Ja(()=>v(E.current),"reset");return k.addEventListener("reset",_),()=>k.removeEventListener("reset",_)}},[x,s,v]),o.jsx(ELe,{scope:r,name:i,form:s,required:c,disabled:u,value:O,onValueChange:v,children:o.jsx(Y9,{asChild:!0,...b,orientation:d,dir:y,loop:h,children:o.jsx(pi.div,{role:"radiogroup","aria-required":c,"aria-orientation":d,"data-disabled":u?"":void 0,dir:y,...g,ref:S})})})},"RadioGroup")),TLe="RadioGroupItemProvider",CLe="RadioGroupItemTrigger";function vue(e){const{__scopeRadioGroup:t,value:n,disabled:r,children:i,internal_do_not_use_render:s}=e,a=kLe(TLe,t),l=tj(t),c=a.disabled||r;return o.jsx(yue,{...l,checked:a.value===n,disabled:c,required:a.required,name:a.name,form:a.form,value:n,onCheck:()=>a.onValueChange(n),internal_do_not_use_render:s,children:i})}Ja(vue,"RadioGroupItemProvider");var ALe=p.forwardRef(Ja(function(t,n){const{__scopeRadioGroup:r,...i}=t,s=xue(r),a=tj(r),{checked:l,disabled:c}=ej(CLe,a.__scopeRadio),u=p.useRef(null),d=zr(n,u),f=p.useRef(!1);return p.useEffect(()=>{const h=Ja(g=>{wLe.includes(g.key)&&(f.current=!0)},"handleKeyDown"),m=Ja(()=>f.current=!1,"handleKeyUp");return document.addEventListener("keydown",h),document.addEventListener("keyup",m),()=>{document.removeEventListener("keydown",h),document.removeEventListener("keyup",m)}},[]),o.jsx(Z9,{asChild:!0,...s,focusable:!c,active:l,children:o.jsx(bLe,{...a,...i,ref:d,onKeyDown:mn(i.onKeyDown,h=>{h.key==="Enter"&&h.preventDefault()}),onFocus:mn(i.onFocus,()=>{var h;f.current&&((h=u.current)==null||h.click())})})})},"RadioGroupItemTrigger")),NLe=p.forwardRef(Ja(function(t,n){const{__scopeRadioGroup:r,value:i,disabled:s,...a}=t;return o.jsx(vue,{__scopeRadioGroup:r,value:i,disabled:s,internal_do_not_use_render:({isFormControl:l})=>o.jsxs(o.Fragment,{children:[o.jsx(ALe,{...a,ref:n,__scopeRadioGroup:r}),l&&o.jsx(jLe,{__scopeRadioGroup:r})]})})},"RadioGroupItem")),jLe=p.forwardRef(Ja(function(t,n){const{__scopeRadioGroup:r,...i}=t,s=tj(r);return o.jsx(vLe,{...s,...i,ref:n})},"RadioGroupItemBubbleInput")),RLe=p.forwardRef(Ja(function(t,n){const{__scopeRadioGroup:r,...i}=t,s=tj(r);return o.jsx(OLe,{...s,...i,ref:n})},"RadioGroupIndicator")),ILe=Object.defineProperty,Hp=(e,t)=>ILe(e,"name",{value:t,configurable:!0}),l7="Switch",[DLe,dMt]=rl(l7),[PLe,c7]=DLe(l7);function wue(e){const{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:s,form:a,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[h,m]=Bc({prop:n,defaultProp:i??!1,onChange:c,caller:l7}),[g,b]=p.useState(null),[y,O]=p.useState(null),v=p.useRef(!1),[x,w]=p.useReducer(k=>k+1,0),S=g?!!a||!!g.closest("form"):!0,E={checked:h,setChecked:m,disabled:s,control:g,setControl:b,name:l,form:a,value:d,hasConsumerStoppedPropagationRef:v,userInteractionCount:x,onUserInteraction:w,required:u,defaultChecked:i,isFormControl:S,bubbleInput:y,setBubbleInput:O};return o.jsx(PLe,{scope:t,...E,children:Sue(f)?f(E):r})}Hp(wue,"SwitchProvider");var MLe="SwitchTrigger",LLe=p.forwardRef(Hp(function({__scopeSwitch:t,onClick:n,...r},i){const{control:s,form:a,value:l,disabled:c,checked:u,required:d,setControl:f,setChecked:h,hasConsumerStoppedPropagationRef:m,onUserInteraction:g,isFormControl:b,bubbleInput:y}=c7(MLe,t),O=zr(i,f),v=p.useRef(u);return p.useEffect(()=>{const x=a?s==null?void 0:s.ownerDocument.getElementById(a):s==null?void 0:s.form;if(x instanceof HTMLFormElement){const w=Hp(()=>h(v.current),"reset");return x.addEventListener("reset",w),()=>x.removeEventListener("reset",w)}},[s,a,h]),o.jsx(pi.button,{type:"button",role:"switch","aria-checked":u,"aria-required":d,"data-state":u7(u),"data-disabled":c?"":void 0,disabled:c,value:l,...r,ref:O,onClick:mn(n,x=>{g(),h(w=>!w),y&&b&&(m.current=x.isPropagationStopped(),m.current||x.stopPropagation())})})},"SwitchTrigger")),$Le=p.forwardRef(Hp(function(t,n){const{__scopeSwitch:r,name:i,checked:s,defaultChecked:a,required:l,disabled:c,value:u,onCheckedChange:d,form:f,...h}=t;return o.jsx(wue,{__scopeSwitch:r,checked:s,defaultChecked:a,disabled:c,required:l,onCheckedChange:d,name:i,form:f,value:u,internal_do_not_use_render:({isFormControl:m})=>o.jsxs(o.Fragment,{children:[o.jsx(LLe,{...h,ref:n,__scopeSwitch:r}),m&&o.jsx(FLe,{__scopeSwitch:r})]})})},"Switch")),BLe="SwitchThumb",QLe=p.forwardRef(Hp(function(t,n){const{__scopeSwitch:r,...i}=t,s=c7(BLe,r);return o.jsx(pi.span,{"data-state":u7(s.checked),"data-disabled":s.disabled?"":void 0,...i,ref:n})},"SwitchThumb")),ULe="SwitchBubbleInput",FLe=p.forwardRef(Hp(function({__scopeSwitch:t,onClick:n,...r},i){const{control:s,hasConsumerStoppedPropagationRef:a,userInteractionCount:l,checked:c,defaultChecked:u,required:d,disabled:f,name:h,value:m,form:g,bubbleInput:b,setBubbleInput:y}=c7(ULe,t),O=zr(i,y),v=KS(s),x=p.useRef(!1),w=p.useRef(c),S=p.useRef(l);p.useEffect(()=>{const k=b;if(!k)return;const _=window.HTMLInputElement.prototype,T=Object.getOwnPropertyDescriptor(_,"checked").set,A=l!==S.current;S.current=l;const j=w.current!==c;w.current=c;const L=!(A&&a.current);if(j&&T){x.current=!A;const I=new Event("click",{bubbles:L});T.call(k,c),k.dispatchEvent(I),x.current=!1}},[b,c,a,l]);const E=p.useRef(c);return o.jsx(pi.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??E.current,required:d,disabled:f,name:h,value:m,form:g,...r,tabIndex:-1,ref:O,onClick:mn(n,k=>{x.current&&k.stopPropagation()}),style:{...r.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function Sue(e){return typeof e=="function"}Hp(Sue,"isFunction");function u7(e){return e?"checked":"unchecked"}Hp(u7,"getState");var zLe=Object.defineProperty,VLe=(e,t)=>zLe(e,"name",{value:t,configurable:!0}),HLe="Toggle",qLe=p.forwardRef(VLe(function(t,n){const{pressed:r,defaultPressed:i,onPressedChange:s,...a}=t,[l,c]=Bc({prop:r,onChange:s,defaultProp:i??!1,caller:HLe});return o.jsx(pi.button,{type:"button","aria-pressed":l,"data-state":l?"on":"off","data-disabled":t.disabled?"":void 0,...a,ref:n,onClick:mn(t.onClick,()=>{t.disabled||c(!l)})})},"Toggle")),XLe=Object.defineProperty,qp=(e,t)=>XLe(e,"name",{value:t,configurable:!0}),K1="ToggleGroup",[Eue,fMt]=rl(K1,[Y1]),kue=Y1(),GLe=p.forwardRef(qp(function(t,n){const{type:r,...i}=t;if(r==="single"){const s=i;return o.jsx(WLe,{role:"radiogroup",...s,ref:n})}if(r==="multiple"){const s=i;return o.jsx(YLe,{role:"toolbar",...s,ref:n})}throw new Error(`Missing prop \`type\` expected on \`${K1}\``)},"ToggleGroup")),[_ue,Tue]=Eue(K1),WLe=p.forwardRef(qp(function(t,n){const{value:r,defaultValue:i,onValueChange:s=qp(()=>{},"onValueChange"),...a}=t,[l,c]=Bc({prop:r,defaultProp:i??"",onChange:s,caller:K1});return o.jsx(_ue,{scope:t.__scopeToggleGroup,type:"single",value:p.useMemo(()=>l?[l]:[],[l]),onItemActivate:c,onItemDeactivate:p.useCallback(()=>c(""),[c]),children:o.jsx(Cue,{...a,ref:n})})},"ToggleGroupImplSingle")),YLe=p.forwardRef(qp(function(t,n){const{value:r,defaultValue:i,onValueChange:s=qp(()=>{},"onValueChange"),...a}=t,[l,c]=Bc({prop:r,defaultProp:i??[],onChange:s,caller:K1}),u=p.useCallback(f=>c((h=[])=>[...h,f]),[c]),d=p.useCallback(f=>c((h=[])=>h.filter(m=>m!==f)),[c]);return o.jsx(_ue,{scope:t.__scopeToggleGroup,type:"multiple",value:l,onItemActivate:u,onItemDeactivate:d,children:o.jsx(Cue,{...a,ref:n})})},"ToggleGroupImplMultiple")),[ZLe,KLe]=Eue(K1),Cue=p.forwardRef(qp(function(t,n){const{__scopeToggleGroup:r,disabled:i=!1,rovingFocus:s=!0,orientation:a,dir:l,loop:c=!0,...u}=t,d=kue(r),f=ZS(l),h={dir:f,...u};return o.jsx(ZLe,{scope:r,rovingFocus:s,disabled:i,children:s?o.jsx(Y9,{asChild:!0,...d,orientation:a,dir:f,loop:c,children:o.jsx(pi.div,{...h,ref:n})}):o.jsx(pi.div,{...h,ref:n})})},"ToggleGroupImpl")),y4="ToggleGroupItem",JLe=p.forwardRef(qp(function(t,n){const r=Tue(y4,t.__scopeToggleGroup),i=KLe(y4,t.__scopeToggleGroup),s=kue(t.__scopeToggleGroup),a=r.value.includes(t.value),l=i.disabled||t.disabled,c={...t,pressed:a,disabled:l},u=p.useRef(null);return i.rovingFocus?o.jsx(Z9,{asChild:!0,...s,focusable:!l,active:a,ref:u,children:o.jsx(sq,{...c,ref:n})}):o.jsx(sq,{...c,ref:n})},"ToggleGroupItem")),sq=p.forwardRef(qp(function(t,n){const{__scopeToggleGroup:r,value:i,...s}=t,a=Tue(y4,r),l={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},c=a.type==="single"?l:void 0;return o.jsx(qLe,{...c,...s,ref:n,onPressedChange:u=>{u?a.onItemActivate(i):a.onItemDeactivate(i)}})},"ToggleGroupItemImpl")),e6e=Object.defineProperty,ga=(e,t)=>e6e(e,"name",{value:t,configurable:!0}),[d7,hMt]=rl("Tooltip",[W1]),f7=W1(),t6e="TooltipProvider",n6e=700,O4="tooltip.open",[r6e,h7]=d7(t6e),i6e=ga(e=>{const{__scopeTooltip:t,delayDuration:n=n6e,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=e,a=p.useRef(!0),l=p.useRef(!1),c=p.useRef(0);return p.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),o.jsx(r6e,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:p.useCallback(()=>{r<=0||(window.clearTimeout(c.current),a.current=!1)},[r]),onClose:p.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.current=!0,r))},[r]),isPointerInTransitRef:l,onPointerInTransitChange:p.useCallback(u=>{l.current=u},[]),disableHoverableContent:i,children:s})},"TooltipProvider"),x4="Tooltip",[s6e,eE]=d7(x4),a6e=ga(e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:a,delayDuration:l}=e,c=h7(x4,e.__scopeTooltip),u=f7(t),[d,f]=p.useState(null),[h,m]=p.useState(void 0),g=Fp(),b=p.useRef(0),y=a??c.disableHoverableContent,O=l??c.delayDuration,v=p.useRef(!1),[x,w]=Bc({prop:r,defaultProp:i??!1,onChange:ga(T=>{T?(c.onOpen(),document.dispatchEvent(new CustomEvent(O4))):c.onClose(),s==null||s(T)},"onChange"),caller:x4}),S=p.useMemo(()=>x?v.current?"delayed-open":"instant-open":"closed",[x]),E=p.useCallback(()=>{window.clearTimeout(b.current),b.current=0,v.current=!1,w(!0)},[w]),k=p.useCallback(()=>{window.clearTimeout(b.current),b.current=0,w(!1)},[w]),_=p.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{v.current=!0,w(!0),b.current=0},O)},[O,w]);p.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]);const C=h??g;return o.jsx(WN,{...u,children:o.jsx(s6e,{scope:t,contentId:C,setContentId:m,open:x,stateAttribute:S,trigger:d,onTriggerChange:f,onTriggerEnter:p.useCallback(()=>{c.isOpenDelayedRef.current?_():E()},[c.isOpenDelayedRef,_,E]),onTriggerLeave:p.useCallback(()=>{y?k():(window.clearTimeout(b.current),b.current=0)},[k,y]),onOpen:E,onClose:k,disableHoverableContent:y,children:n})})},"Tooltip"),aq="TooltipTrigger",o6e=p.forwardRef(ga(function(t,n){const{__scopeTooltip:r,...i}=t,s=eE(aq,r),a=h7(aq,r),l=f7(r),c=p.useRef(null),u=zr(n,c,s.onTriggerChange),d=p.useRef(!1),f=p.useRef(!1),h=p.useCallback(()=>d.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),o.jsx(q9,{asChild:!0,...l,children:o.jsx(pi.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...i,ref:u,onPointerMove:mn(t.onPointerMove,m=>{m.pointerType!=="touch"&&!f.current&&!a.isPointerInTransitRef.current&&(s.onTriggerEnter(),f.current=!0)}),onPointerLeave:mn(t.onPointerLeave,()=>{s.onTriggerLeave(),f.current=!1}),onPointerDown:mn(t.onPointerDown,()=>{s.open&&s.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:mn(t.onFocus,()=>{d.current||s.onOpen()}),onBlur:mn(t.onBlur,s.onClose),onClick:mn(t.onClick,s.onClose)})})},"TooltipTrigger")),Aue="TooltipPortal",[l6e,c6e]=d7(Aue,{forceMount:void 0}),u6e=ga(e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,s=eE(Aue,t);return o.jsx(l6e,{scope:t,forceMount:n,children:o.jsx(Ed,{present:n||s.open,children:o.jsx(D9,{asChild:!0,container:i,children:r})})})},"TooltipPortal"),Cw="TooltipContent",d6e=p.forwardRef(ga(function(t,n){const r=c6e(Cw,t.__scopeTooltip),{forceMount:i=r.forceMount,side:s="top",...a}=t,l=eE(Cw,t.__scopeTooltip);return o.jsx(Ed,{present:i||l.open,children:l.disableHoverableContent?o.jsx(Nue,{side:s,...a,ref:n}):o.jsx(f6e,{side:s,...a,ref:n})})},"TooltipContent")),f6e=p.forwardRef(ga(function(t,n){const r=eE(Cw,t.__scopeTooltip),i=h7(Cw,t.__scopeTooltip),s=p.useRef(null),a=zr(n,s),[l,c]=p.useState(null),{trigger:u,onClose:d}=r,f=s.current,{onPointerInTransitChange:h}=i,m=p.useCallback(()=>{c(null),h(!1)},[h]),g=p.useCallback((b,y)=>{const O=b.currentTarget,v={x:b.clientX,y:b.clientY},x=jue(v,O.getBoundingClientRect()),w=Rue(v,x),S=Iue(y.getBoundingClientRect()),E=Pue([...w,...S]);c(E),h(!0)},[h]);return p.useEffect(()=>()=>m(),[m]),p.useEffect(()=>{if(u&&f){const b=ga(O=>g(O,f),"handleTriggerLeave"),y=ga(O=>g(O,u),"handleContentLeave");return u.addEventListener("pointerleave",b),f.addEventListener("pointerleave",y),()=>{u.removeEventListener("pointerleave",b),f.removeEventListener("pointerleave",y)}}},[u,f,g,m]),p.useEffect(()=>{if(l){const b=ga(y=>{const O=y.target,v={x:y.clientX,y:y.clientY},x=(u==null?void 0:u.contains(O))||(f==null?void 0:f.contains(O)),w=!Due(v,l);x?m():w&&(m(),d())},"handleTrackPointerGrace");return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[u,f,l,d,m]),o.jsx(Nue,{...t,ref:a})},"TooltipContentHoverable")),h6e=jle("TooltipContent"),Nue=p.forwardRef(ga(function(t,n){const{__scopeTooltip:r,children:i,"aria-label":s,id:a,onEscapeKeyDown:l,onPointerDownOutside:c,...u}=t,d=eE(Cw,r),f=f7(r),{onClose:h}=d;p.useEffect(()=>(document.addEventListener(O4,h),()=>document.removeEventListener(O4,h)),[h]),p.useEffect(()=>{if(d.trigger){const g=ga(b=>{b.target instanceof Node&&b.target.contains(d.trigger)&&h()},"handleScroll");return window.addEventListener("scroll",g,{capture:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})}},[d.trigger,h]);const{setContentId:m}=d;return Ic(()=>(m(a),()=>{m(void 0)}),[a,m]),o.jsx(j9,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:g=>g.preventDefault(),onDismiss:h,children:o.jsxs(X9,{"data-state":d.stateAttribute,role:s?void 0:"tooltip",id:s?void 0:d.contentId,...f,...u,ref:n,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[o.jsx(h6e,{children:i}),s?o.jsx(PDe,{id:d.contentId,role:"tooltip",children:s}):null]})})},"TooltipContentImpl"));function jue(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}ga(jue,"getExitSideFromRect");function Rue(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}ga(Rue,"getPaddedExitPoints");function Iue(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}ga(Iue,"getPointsFromRect");function Due(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,a=t.length-1;sr!=h>r&&n<(f-u)*(r-d)/(h-d)+u&&(i=!i)}return i}ga(Due,"isPointInPolygon");function Pue(e){const t=e.slice();return t.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),Mue(t)}ga(Pue,"getHull");function Mue(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r=2;){const s=t[t.length-1],a=t[t.length-2];if((s.x-a.x)*(i.y-a.y)>=(s.y-a.y)*(i.x-a.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const s=n[n.length-1],a=n[n.length-2];if((s.x-a.x)*(i.y-a.y)>=(s.y-a.y)*(i.x-a.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}ga(Mue,"getHullPresorted");var p6e=i6e,m6e=a6e,Lue=o6e,g6e=u6e,b6e=d6e;const y6e=()=>{var e;return typeof ClipboardItem<"u"&&!!((e=navigator.clipboard)!=null&&e.write)};function O6e(e){const{"text/plain":t,...n}=e;return new ClipboardItem({...n,...t?{"text/plain":new Blob([t],{type:"text/plain"})}:null})}async function x6e(e,t=document.body){if(typeof e=="string")return oq(e,t);try{return y6e()?(await navigator.clipboard.write([O6e(e)]),!0):e["text/plain"]?oq(e["text/plain"],t):!1}catch{return!1}}async function oq(e,t=document.body){if(navigator.clipboard)try{return await navigator.clipboard.writeText(e),!0}catch{}const n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.opacity="0",t.appendChild(n),n.focus(),n.select();let r=!1;try{r=document.execCommand("copy")}catch{}return t.removeChild(n),r}function Xp(e){const t=p.useRef(e);return t.current=e,t}let t1=[],t2=!1;const lq=e=>{var t,n;if(e.key==="Escape"){const[r]=t1;r&&(e.preventDefault(),(n=(t=r.callback).current)==null||n.call(t))}},$ue=()=>{t1.length>0&&!t2?(document.body.addEventListener("keydown",lq),t2=!0):t1.length===0&&t2&&(document.body.removeEventListener("keydown",lq),t2=!1)},v6e=e=>{t1.unshift(e),$ue()},w6e=({id:e})=>{t1=t1.filter(t=>t.id!==e),$ue()},tE=(e,t)=>{const n=p.useId(),r=Xp(t);p.useEffect(()=>{if(!e)return;const i={id:n,callback:r};return v6e(i),()=>w6e(i)},[n,e,r])},S6e="_Tooltip_16g2y_1",E6e="_TriggerDecorator_16g2y_73",Bue={Tooltip:S6e,TriggerDecorator:E6e},vo=e=>{const{ref:t,children:n,content:r,forceOpen:i=r===null?!1:void 0,maxWidth:s=300,openDelay:a=150,interactive:l=!1,compact:c=!1,preventUnintentionalClickToClose:u,align:d,alignOffset:f=0,side:h,sideOffset:m=5,gutterSize:g="md",contentClassName:b,onPointerDown:y,onClick:O,...v}=e,[x,w]=p.useState(!1),[S,E]=p.useState(!1);k9(()=>E(!1),S?400:null);const k=i??x,_=T=>{typeof i!="boolean"&&(w(T),u&&E(T))},C=T=>{u&&S&&(T.preventDefault(),T.stopPropagation())};return o.jsxs(Que,{open:k,delayDuration:a,onOpenChange:_,disableHoverableContent:!l,children:[o.jsx(Lue,{asChild:!0,children:o.jsx(Ale,{...v,ref:t,onPointerDown:T=>{C(T),y==null||y(T)},onClick:T=>{C(T),O==null||O(T)},children:n})}),o.jsx(Uue,{maxWidth:s,compact:c,align:d,alignOffset:f,side:h,sideOffset:m,gutterSize:g,className:b,children:r})]})},Que=({children:e,open:t,onOpenChange:n,...r})=>(tE(t,()=>{n(!1)}),o.jsx(p6e,{children:o.jsx(m6e,{open:t,onOpenChange:n,...r,children:e})})),Uue=({children:e,maxWidth:t=300,compact:n=!1,clickable:r=void 0,alignOffset:i=0,sideOffset:s=5,gutterSize:a="md",className:l,style:c,...u})=>o.jsx(g6e,{children:o.jsx(b6e,{...u,className:ur(Bue.Tooltip,l),"data-compact":n,"data-clickable":r,"data-gutter-size":a,alignOffset:i,sideOffset:s,collisionPadding:15,hideWhenDetached:!0,style:{...c,maxWidth:t},onEscapeKeyDown:Df,children:e})}),k6e=({children:e,asChild:t=!0,...n})=>o.jsx(Lue,{asChild:t,...n,children:e}),_6e=e=>{const{children:t,className:n,focusable:r=!0,ref:i,...s}=e,a=typeof t=="string";return o.jsx(Ale,{ref:i,...s,className:ur(Bue.TriggerDecorator,n),tabIndex:r?0:void 0,children:a?o.jsx("span",{children:t}):t})};vo.Root=Que;vo.Content=Uue;vo.Trigger=k6e;vo.TriggerDecorator=_6e;const T6e=50,cq=48;function C6e(e){return(e.events??[]).flatMap(t=>{var i,s;const r=(((i=t.content)==null?void 0:i.parts)??[]).map(a=>typeof a.text=="string"?a.text:"").filter(Boolean).join("");return r?[{text:r,role:t.author??((s=t.content)==null?void 0:s.role)??"",ts:t.timestamp}]:[]})}function A6e(e){var t,n;for(const r of e.events??[])if(r.author==="user"||((t=r.content)==null?void 0:t.role)==="user"){const i=(((n=r.content)==null?void 0:n.parts)??[]).map(s=>s.text).find(Boolean);if(i)return i}return"未命名会话"}function N6e(e,t,n){const r=Math.max(0,t-cq),i=Math.min(e.length,t+n+cq);return(r>0?"…":"")+e.slice(r,i).trim()+(i{var c;if((c=l.events)!=null&&c.length)return l;try{return await PN(t,e,l.id)}catch{return l}})),a=[];for(const l of s)for(const{text:c,role:u,ts:d}of C6e(l)){const f=c.toLowerCase().indexOf(r);if(f!==-1){a.push({type:"session",appId:t,sessionId:l.id,title:A6e(l),snippet:N6e(c,f,r.length),role:u,ts:d??l.lastUpdateTime});break}}return a.sort((l,c)=>(c.ts??0)-(l.ts??0)),a.slice(0,T6e)}async function R6e(e,t){if(!e||!t.trim())return{results:[]};let n;try{n=await goe(e,t.trim())}catch(a){const l=String(a);return{results:[],note:l.includes("404")?"网络搜索接口未就绪(后端未启用 /web/search)。":`网络搜索失败:${l}`}}const{mounted:r,results:i,error:s}=n;return r?s?{results:[],note:s}:{results:i.map((a,l)=>({type:"web",index:l,title:a.title,url:a.url,siteName:a.siteName,summary:a.summary}))}:{results:[],note:"当前 Agent 未挂载 web_search 工具。"}}async function I6e(e,t,n,r){if(!t||!r.trim())return{results:[]};const i=await moe(t,e,r.trim(),n);if(!i.mounted)return{results:[],note:e==="knowledge"?"该 Agent 未挂载知识库。":"该 Agent 未挂载长期记忆。"};if(i.error)return{results:[],note:i.error};const s=i.sourceName??(e==="knowledge"?"知识库":"长期记忆");return{results:i.results.map((a,l)=>e==="knowledge"?{type:"knowledge",index:l,content:a.content,sourceName:s,sourceType:i.sourceType}:{type:"memory",index:l,content:a.content,sourceName:s,sourceType:i.sourceType,author:a.author,ts:a.timestamp})}}async function D6e(e,t,n){return e==="session"?{results:await j6e(n.userId,n.appId,t)}:e==="web"?R6e(n.appId,t):I6e(e,n.appId,n.userId,t)}function Fue({mirrored:e=!1}){return o.jsxs("g",{opacity:"0.5",transform:e?"translate(20 0) scale(-1 1)":void 0,children:[o.jsx("path",{className:"sidebar-panel-glyph__divider",d:"M5.938 6.833c.11 0 .249.102.249.292v6.042c0 .19-.14.291-.249.291s-.248-.101-.248-.291V7.125c0-.19.139-.292.248-.292Z",strokeWidth:"1.167"}),o.jsx("path",{className:"sidebar-panel-glyph__frame",d:"M14.5 3.75h-9a3 3 0 0 0-3 3v6.857a3 3 0 0 0 3 3h9a3 3 0 0 0 3-3V6.75a3 3 0 0 0-3-3Z",strokeWidth:"1.667",strokeLinecap:"round",strokeLinejoin:"round"})]})}function P6e(e){return o.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",...e,children:o.jsx(Fue,{})})}function M6e(e){return o.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",...e,children:o.jsx(Fue,{mirrored:!0})})}function L6e(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M12 8.333c.368 0 .667.299.667.667v2h2a.667.667 0 0 1 0 1.333h-2v2a.667.667 0 0 1-1.334 0v-2h-2a.667.667 0 0 1 0-1.333h2V9c0-.368.299-.667.667-.667ZM7.667 1c3.49 0 6.383 2.554 6.913 5.896a.667.667 0 0 1-1.317.208 5.667 5.667 0 1 0-9.708 4.424.67.67 0 0 1 .07.12.667.667 0 0 1-.13.834l-.95.853 4.788-.002a.667.667 0 0 1 0 1.334l-5.657.002c-.917 0-1.35-1.131-.67-1.744l1.163-1.045A6.97 6.97 0 0 1 .667 8c0-3.866 3.134-7 7-7Z",fill:"currentColor"})})}function $6e(e){return o.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.333",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"7.333",cy:"7.333",r:"5.333"}),o.jsx("path",{d:"m11.133 11.133 2.867 2.867"})]})}function B6e(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M8 0.667c4.05 0 7.334 3.283 7.334 7.333 0 4.05-3.284 7.334-7.334 7.334S0.667 12.05 0.667 8 3.95 0.667 8 0.667Zm0 1.333a6 6 0 1 0 0 12A6 6 0 0 0 8 2ZM6.167 6c.368 0 .667.299.667.667v2a.667.667 0 0 1-1.334 0v-2c0-.368.299-.667.667-.667Zm3.666 0c.368 0 .667.299.667.667v2a.667.667 0 0 1-1.333 0v-2c0-.368.298-.667.666-.667Z",fill:"currentColor"})})}function zue(e){return o.jsxs("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M7.58 2.6a.667.667 0 0 0-.667-.667h-.666a.667.667 0 0 0-.667.667v10.667c0 .368.299.666.667.666h.666a.667.667 0 0 0 .667-.666V2.6Zm1.333 10.667A2 2 0 0 1 6.913 15.267h-.666a2 2 0 0 1-2-2V2.6a2 2 0 0 1 2-2h.666a2 2 0 0 1 2 2v10.667Z",fill:"currentColor"}),o.jsx("path",{d:"M11.88 5.045a.667.667 0 0 0-.801-.514l-.653.136a.667.667 0 0 0-.504.786l1.85 8.092c.081.358.44.589.8.514l.653-.137a.667.667 0 0 0 .504-.786L11.88 5.045Zm3.155 7.82a2 2 0 0 1-1.512 2.358l-.653.136a2 2 0 0 1-2.403-1.541L8.617 5.726a2 2 0 0 1 1.513-2.358l.652-.136a2 2 0 0 1 2.404 1.541l1.849 8.092Z",fill:"currentColor"}),o.jsx("path",{d:"M4.247 2.6a.667.667 0 0 0-.667-.667h-.667a.667.667 0 0 0-.666.667v10.667c0 .368.298.666.666.666h.667a.667.667 0 0 0 .667-.666V2.6ZM5.58 13.267a2 2 0 0 1-2 2h-.667a2 2 0 0 1-2-2V2.6a2 2 0 0 1 2-2h.667a2 2 0 0 1 2 2v10.667Z",fill:"currentColor"})]})}function Q6e({className:e="icon"}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M16.4 10.7a5.7 5.7 0 1 1-1.67-4.03"}),o.jsx("path",{d:"M15.25 15.25 19.6 19.6"})]})}function U6e({open:e}){return o.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:o.jsx("path",{d:"m3.25 4.75 2.75 2.5 2.75-2.5"})})}function F6e({active:e=!1,onClick:t}){return o.jsxs("button",{className:`new-chat${e?" is-active":""}`,onClick:t,"aria-label":"搜索","aria-current":e?"page":void 0,title:"搜索",children:[o.jsx($6e,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"搜索"})]})}function z6e(e,t,n){const r=!!e,i=new Set((t==null?void 0:t.searchSources)??[]),s=a=>r?n?"正在检测 Agent 能力":`当前 Agent 未挂载${a}`:"请选择 Agent";return[{id:"session",label:"会话",ready:r,unavailableLabel:"请选择 Agent"},{id:"web",label:"网络",ready:r&&i.has("web"),description:"通过 web_search 工具检索",unavailableLabel:s(" web_search 工具")},{id:"knowledge",label:"知识库",ready:r&&i.has("knowledge"),unavailableLabel:s("知识库")},{id:"memory",label:"长期记忆",ready:r&&i.has("memory"),unavailableLabel:s("长期记忆")}]}function TC(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 uq(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 V6e({userId:e,appId:t,agentInfo:n,capabilitiesLoading:r,agentLabel:i,onOpenSession:s}){var M,N;const[a,l]=p.useState("session"),[c,u]=p.useState(""),[d,f]=p.useState([]),[h,m]=p.useState(),[g,b]=p.useState(!1),[y,O]=p.useState(!1),[v,x]=p.useState(!1),w=p.useRef(0),S=p.useRef(null),E=z6e(t,n,r),k=E.find(D=>D.id===a),_=a==="knowledge"?(M=n==null?void 0:n.components)==null?void 0:M.find(D=>D.source==="knowledgebase"||D.kind==="knowledgebase"):a==="memory"?(N=n==null?void 0:n.components)==null?void 0:N.find(D=>D.source==="long_term_memory"||D.kind==="memory"):void 0;p.useEffect(()=>{w.current+=1,l("session"),f([]),m(void 0),O(!1),b(!1),x(!1)},[t]),p.useEffect(()=>{if(!v)return;function D(Q){var F;(F=S.current)!=null&&F.contains(Q.target)||x(!1)}return document.addEventListener("pointerdown",D),()=>document.removeEventListener("pointerdown",D)},[v]);async function C(D,Q){var z;const F=D.trim();if(!F||!((z=E.find(B=>B.id===Q))!=null&&z.ready))return;const $=++w.current;b(!0),O(!0);let H;try{H=await D6e(Q,F,{userId:e,appId:t})}catch(B){const V=B instanceof Error?B.message:String(B);H={results:[],note:`搜索失败:${V}`}}$===w.current&&(f(H.results),m(H.note),b(!1))}function T(D){w.current+=1,u(D),f([]),m(void 0),O(!1),b(!1)}function A(D){w.current+=1,l(D),x(!1),f([]),m(void 0),O(!1),b(!1)}const j=!!(k!=null&&k.ready),L=t?a==="web"?"在网络中检索":a==="knowledge"?`在 ${(_==null?void 0:_.name)??"当前 Agent 的知识库"} 中检索`:a==="memory"?`在 ${(_==null?void 0:_.name)??"当前用户的长期记忆"} 中检索`:"在当前 Agent 的会话中检索":"请先选择 Agent",I=_!=null&&_.backend?TC(_.backend):"";return o.jsxs("div",{className:"search",children:[o.jsxs("div",{className:"search-box",children:[o.jsxs("div",{className:"search-source-picker-wrap",ref:S,children:[o.jsxs("button",{className:"search-source-picker",type:"button","aria-label":`搜索类型:${(k==null?void 0:k.label)??"未选择"}`,"aria-haspopup":"listbox","aria-expanded":v,onClick:()=>x(D=>!D),children:[o.jsx("span",{children:(k==null?void 0:k.label)??"搜索类型"}),I&&o.jsx("small",{children:I}),o.jsx(U6e,{open:v})]}),v&&o.jsx("div",{className:"search-source-menu",role:"listbox","aria-label":"选择搜索类型",children:E.map(D=>{var $,H;const Q=D.id==="knowledge"?($=n==null?void 0:n.components)==null?void 0:$.find(z=>z.source==="knowledgebase"||z.kind==="knowledgebase"):D.id==="memory"?(H=n==null?void 0:n.components)==null?void 0:H.find(z=>z.source==="long_term_memory"||z.kind==="memory"):void 0,F=Q?[Q.name,Q.backend?TC(Q.backend):""].filter(Boolean).join(" · "):D.ready?D.description:D.unavailableLabel;return o.jsxs("button",{type:"button",role:"option","aria-selected":a===D.id,disabled:!D.ready,onClick:()=>A(D.id),children:[o.jsx("span",{children:D.label}),F&&o.jsx("small",{children:F})]},D.id)})})]}),o.jsx("span",{className:"search-box-divider","aria-hidden":!0}),o.jsx("input",{className:"search-input",value:c,onChange:D=>T(D.target.value),onKeyDown:D=>{D.key==="Enter"&&(D.preventDefault(),C(c,a))},placeholder:L,disabled:!j,autoFocus:!0}),o.jsx("button",{className:"search-go",onClick:()=>void C(c,a),disabled:!c.trim()||g,"aria-label":"搜索",children:g?o.jsx(lr,{className:"icon spin"}):o.jsx(Q6e,{className:"icon"})})]}),o.jsx("div",{className:"search-results",children:j?y?g?null:h?o.jsx("div",{className:"search-empty",children:h}):d.length===0&&y?o.jsxs("div",{className:"search-empty",children:["未找到匹配「",c.trim(),"」的结果。"]}):d.map((D,Q)=>o.jsx(H6e,{result:D,agentLabel:i,onOpen:s},Q)):o.jsx("div",{className:"search-empty",children:a==="web"?"输入关键词后回车或点击按钮,通过 web_search 工具检索。":a==="knowledge"?"输入问题,检索当前 Agent 挂载的知识库。":a==="memory"?"输入线索,检索当前用户跨会话保存的长期记忆。":"输入关键词后回车或点击按钮,搜索当前 Agent 的会话。"}):o.jsx("div",{className:"search-empty",children:t?r?"正在读取当前 Agent 的检索能力…":(k==null?void 0:k.unavailableLabel)??"当前 Agent 未挂载该数据源":"选择一个 Agent 后,即可检索会话、网络及其挂载的数据源。"})})]})}function H6e({result:e,agentLabel:t,onOpen:n}){switch(e.type){case"session":return o.jsxs("button",{className:"search-result",onClick:()=>n(e.appId,e.sessionId),children:[o.jsx(Lae,{className:"search-result-icon"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsx("span",{className:"search-result-title",children:e.title}),o.jsxs("span",{className:"search-result-meta",children:[t(e.appId),e.ts?` · ${uq(e.ts)}`:""]})]}),o.jsx("div",{className:"search-result-snippet",children:e.snippet})]})]});case"web":return o.jsxs("a",{className:"search-result",href:e.url||void 0,target:"_blank",rel:"noreferrer noopener",children:[o.jsx(jN,{className:"search-result-icon"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsx("span",{className:"search-result-title",children:e.title||e.url}),o.jsxs("span",{className:"search-result-meta",children:[e.siteName,e.url&&o.jsx(Dg,{className:"search-result-ext"})]})]}),e.summary&&o.jsx("div",{className:"search-result-snippet",children:e.summary})]})]});case"knowledge":return o.jsxs("div",{className:"search-result search-result-static",children:[o.jsx(dq,{source:"knowledge"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsxs("span",{className:"search-result-title",children:["知识片段 ",e.index+1]}),o.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${TC(e.sourceType)}`:""]})]}),o.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});case"memory":return o.jsxs("div",{className:"search-result search-result-static",children:[o.jsx(dq,{source:"memory"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsxs("span",{className:"search-result-title",children:["记忆片段 ",e.index+1]}),o.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${TC(e.sourceType)}`:"",e.ts?` · ${uq(e.ts)}`:""]})]}),o.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});default:return null}}function dq({source:e,className:t="search-result-icon"}){return e==="knowledge"?o.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[o.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"}),o.jsx("path",{d:"M8.25 9h7.5M8.25 12.25h6"})]}):o.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[o.jsx("path",{d:"M12 4.5a7.5 7.5 0 1 0 7.5 7.5"}),o.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"})]})}function q6e({filled:e=!1,...t}){return o.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:[o.jsx("rect",{x:"3.5",y:"9.3",width:"4.5",height:"10.2",rx:"1.5"}),o.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 X6e({filled:e=!1,...t}){return o.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:[o.jsx("rect",{x:"3.5",y:"4.5",width:"4.5",height:"10.2",rx:"1.5"}),o.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"})]})}function Vue(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M5.25 4.25h9.5a2.5 2.5 0 0 1 2.5 2.5v3.5"}),o.jsx("path",{d:"M13.25 17.75h-8a2.5 2.5 0 0 1-2.5-2.5v-8a3 3 0 0 1 3-3"}),o.jsx("path",{d:"M7 8.25h5.5M7 11.75h3.25"}),o.jsx("path",{d:"m13.35 16.65.42-2.16 4.76-4.76a1.35 1.35 0 0 1 1.91 1.91l-4.76 4.76-2.33.25Z"}),o.jsx("path",{d:"m17.65 10.6 1.9 1.9"})]})}const nj="/assets/media/logo-DCsNZy-k.svg",p7="data:image/svg+xml,%3csvg%20width='28'%20height='23'%20viewBox='0%200%2028%2023'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M17.1957%209.44218C17.0253%209.58161%2016.7774%209.47317%2016.7774%209.24079V8.01696V0.611967C16.7774%200.395085%2016.514%200.271152%2016.3591%200.410576L6.04172%209.16334C5.87132%209.30276%205.62345%209.19432%205.62345%208.96194V2.98218C5.62345%202.81178%205.48403%202.67235%205.31362%202.67235H0.309832C0.139424%202.67235%200%202.81178%200%202.98218V21.7115C0%2021.9284%200.263357%2022.0524%200.418273%2021.9129L10.7202%2013.1602C10.8906%2013.0207%2011.1385%2013.1292%2011.1385%2013.3616V22.0059C11.1385%2022.2228%2011.4018%2022.3467%2011.5567%2022.2073L21.8586%2013.4545C22.0291%2013.3151%2022.2769%2013.4235%2022.2769%2013.6559V19.6357C22.2769%2019.8061%2022.4163%2019.9455%2022.5868%2019.9455H27.5905C27.7609%2019.9455%2027.9004%2019.8061%2027.9004%2019.6357V0.890816C27.9004%200.673934%2027.637%200.550001%2027.4821%200.689425L17.1957%209.44218Z'%20fill='%230066FC'/%3e%3c/svg%3e",fq="(max-width: 860px)";function hq({title:e}){const t=p.useRef(null),[n,r]=p.useState({left:!1,right:!1}),i=()=>{const s=t.current;if(!s)return;const a={left:s.scrollLeft>1,right:s.scrollLeft+s.clientWidthl.left===a.left&&l.right===a.right?l:a)};return p.useLayoutEffect(()=>{const s=t.current;if(!s)return;i();const a=new ResizeObserver(i);return a.observe(s),s.firstElementChild&&a.observe(s.firstElementChild),()=>a.disconnect()},[e]),o.jsx("span",{ref:t,className:`history-title${n.left?" has-left-fade":""}${n.right?" has-right-fade":""}`,onScroll:i,onPointerEnter:i,children:o.jsx("span",{className:"history-title-text",children:e})})}function G6e(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"7",cy:"7",r:"2.25"}),o.jsx("circle",{cx:"17",cy:"7",r:"2.25"}),o.jsx("circle",{cx:"7",cy:"17",r:"2.25"}),o.jsx("circle",{cx:"17",cy:"17",r:"2.25"})]})}function W6e(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 Y6e={admin:"管理员",developer:"开发者",user:"普通用户"};function Z6e({activePage:e,access:t,userInfo:n,onAgentKitCli:r,onDeveloperResources:i,onSystemInfo:s,onIssueFeedback:a,onLogout:l}){const[c,u]=p.useState(!1),[d,f]=p.useState("");if(!n)return null;const h=vIe(n)||"用户",m=typeof n.email=="string"?n.email.trim():"",g=W6e(h),b=wIe(n),y=b===d?"":b;return o.jsxs("div",{className:"sidebar-user",children:[o.jsxs("div",{className:"sidebar-user-row",children:[o.jsxs("button",{type:"button",className:"sidebar-user-btn",onClick:()=>u(O=>!O),title:h,children:[o.jsx("span",{className:`account-avatar${y?" has-image":""}`,style:g,"aria-hidden":"true",children:y?o.jsx("img",{className:"account-avatar-image",src:y,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>f(y)}):null}),o.jsx("span",{className:"sidebar-user-identity",children:o.jsx("span",{className:"sidebar-user-name",children:h})})]}),o.jsxs("div",{className:"sidebar-user-shortcuts","aria-label":"快捷入口",children:[o.jsx(vo,{compact:!0,content:"体验 AgentKit CLI",children:o.jsx("button",{type:"button",className:"sidebar-user-shortcut",onClick:r,"aria-label":"体验 AgentKit CLI",children:o.jsx(bRe,{className:"icon"})})}),o.jsx(vo,{compact:!0,content:"开发者资源",children:o.jsx("button",{type:"button",className:`sidebar-user-shortcut${e==="developer-resources"?" is-active":""}`,onClick:i,"aria-label":"开发者资源","aria-current":e==="developer-resources"?"page":void 0,children:o.jsx(sRe,{className:"icon"})})})]})]}),c&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>u(!1)}),o.jsxs("div",{className:"account-pop sidebar-user-pop",children:[o.jsxs("div",{className:"account-head",children:[o.jsx("span",{className:`account-avatar account-avatar--lg${y?" has-image":""}`,style:g,"aria-hidden":"true",children:y?o.jsx("img",{className:"account-avatar-image",src:y,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>f(y)}):null}),o.jsxs("div",{className:"account-id",children:[o.jsxs("div",{className:"account-name-row",children:[o.jsx("div",{className:"account-name",children:h}),o.jsx(ta,{color:"secondary",size:"sm",variant:"soft",pill:!0,children:Y6e[t.role]})]}),m&&m!==h&&o.jsx("div",{className:"account-sub",children:m})]})]}),o.jsxs("button",{type:"button",className:"account-action",onClick:()=>{u(!1),s()},children:[o.jsx(wd,{className:"icon"})," 系统信息"]}),o.jsxs("button",{type:"button",className:"account-action",onClick:()=>{u(!1),a()},children:[o.jsx(Vue,{className:"icon"})," 问题反馈"]}),o.jsxs("button",{type:"button",className:"account-action",onClick:()=>{u(!1),l()},children:[o.jsx(JRe,{className:"icon"})," 退出登录"]})]})]})]})}function K6e({branding:e,cloudProvider:t,sessions:n,currentSessionId:r,activePage:i,features:s,access:a,streamingSids:l,evaluatingSids:c,sandboxHistory:u,onNewChat:d,onSearch:f,onQuickCreate:h,onLibrary:m,onAddAgent:g,onMyAgents:b,onWorkspace:y,onApplications:O,onCronJobs:v,onAgentKitCli:x,onDeveloperResources:w,onSystemInfo:S,onIssueFeedback:E,onPickSession:k,onDeleteSession:_,userInfo:C,onLogout:T}){const A=$=>(s==null?void 0:s[$])!==!1,[j,L]=p.useState(null),I=p.useRef(typeof window<"u"&&window.matchMedia(fq).matches),[M,N]=p.useState(I.current),D=n.map($=>({id:$.id,title:QN($.events),createdAt:($.lastUpdateTime??0)*1e3})).sort(($,H)=>H.createdAt-$.createdAt),Q=()=>{I.current=!1,N($=>!$),L(null)};p.useEffect(()=>{const $=window.matchMedia(fq),H=z=>{z.matches?N(B=>B||(I.current=!0,!0)):I.current&&(I.current=!1,N(!1))};return $.addEventListener("change",H),()=>$.removeEventListener("change",H)},[]);const F=t==="byteplus"?p7:nj;return o.jsxs("aside",{className:`sidebar ${M?"is-collapsed":""}`,children:[o.jsxs("div",{className:"sidebar-top",children:[o.jsxs("div",{className:"sidebar-brand-row",children:[o.jsxs("button",{type:"button",className:"brand",onClick:d,"aria-label":"返回首页",title:"返回首页",children:[o.jsx("img",{className:"brand-logo",src:e.logoUrl||F,width:20,height:20,alt:"","aria-hidden":!0}),o.jsx("span",{className:"brand-title",children:e.title})]}),o.jsx("button",{type:"button",className:"sidebar-collapse-toggle",onClick:Q,"aria-label":M?"展开侧边栏":"收起侧边栏",title:M?"展开侧边栏":"收起侧边栏",children:M?o.jsx(M6e,{className:"icon"}):o.jsx(P6e,{className:"icon"})})]}),o.jsxs("nav",{className:"sidebar-nav","aria-label":"主导航",children:[A("newChat")&&o.jsxs("button",{className:`new-chat new-chat--conversation${i==="new-chat"?" is-active":""}`,onClick:d,"aria-label":"新会话","aria-current":i==="new-chat"?"page":void 0,title:"新会话",children:[o.jsx(L6e,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"新会话"})]}),A("search")&&o.jsx(F6e,{active:i==="search",onClick:f}),o.jsxs("button",{className:`new-chat new-chat--agents${i==="agents"?" is-active":""}`,onClick:b,"aria-label":"智能体","aria-current":i==="agents"?"page":void 0,title:"智能体",children:[o.jsx(B6e,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"智能体"})]}),o.jsxs("button",{className:`new-chat new-chat--workspaces${i==="workspaces"?" is-active":""}`,onClick:y,"aria-label":"工作区","aria-current":i==="workspaces"?"page":void 0,title:"工作区",children:[o.jsx(IRe,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"工作区"})]}),o.jsxs("button",{className:`new-chat new-chat--library${i==="library"?" is-active":""}`,onClick:m,"aria-label":"资源库","aria-current":i==="library"?"page":void 0,title:"资源库",children:[o.jsx(zue,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"资源库"})]}),o.jsxs("button",{className:`new-chat new-chat--cronjobs${i==="cronjobs"?" is-active":""}`,onClick:v,"aria-label":"定时任务","aria-current":i==="cronjobs"?"page":void 0,title:"定时任务",children:[o.jsx(K8,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"定时任务"})]}),o.jsxs("button",{className:`new-chat new-chat--applications${i==="applications"?" is-active":""}`,onClick:O,"aria-label":"自动化","aria-current":i==="applications"?"page":void 0,title:"自动化",children:[o.jsx(G6e,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"自动化"})]})]})]}),A("history")&&o.jsxs("div",{className:"sidebar-history",children:[o.jsxs("div",{className:"history-head",children:[o.jsx("span",{children:"历史会话"}),A("newChat")&&o.jsx("button",{type:"button",className:"history-new-chat",onClick:(u==null?void 0:u.onNew)??d,disabled:u==null?void 0:u.newDisabled,"aria-label":"新建会话",title:"新建会话",children:o.jsx(yo,{className:"icon"})})]}),o.jsx("div",{className:"history-list",children:u?o.jsxs(o.Fragment,{children:[u.loading&&u.threads.length===0?o.jsx("div",{className:"history-empty",role:"status",children:"正在加载历史会话…"}):null,u.error?o.jsx("div",{className:"history-error",role:"alert",children:u.error}):null,!u.loading&&!u.error&&u.threads.length===0?o.jsx("div",{className:"history-empty",children:"暂无会话"}):null,u.threads.map($=>{const H=$.id===u.currentThreadId,z=$.name||$.preview||`Thread ${$.id.slice(0,8)}`,B=$.id===u.busyThreadId;return o.jsxs("div",{className:`history-item ${H?"active":""}`,children:[o.jsxs("button",{type:"button",className:"history-item-btn",onClick:()=>u.onSelect($.id),"aria-current":H?"page":void 0,title:z,disabled:B,children:[o.jsx(hq,{title:z}),H?o.jsx("span",{className:"history-current-badge",children:"当前"}):null]}),o.jsx("button",{type:"button",className:"history-more","aria-label":`管理历史会话:${z}`,title:"更多",disabled:B,onClick:()=>L(V=>V===$.id?null:$.id),children:o.jsx(yH,{className:"icon"})}),j===$.id?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>L(null)}),o.jsx("div",{className:"history-menu",children:o.jsxs("button",{type:"button",className:"menu-item menu-item--danger",onClick:()=>{L(null),u.onDelete($)},children:[o.jsx(Up,{className:"icon"})," 删除"]})})]}):null]},$.id)}),u.hasMore?o.jsx("button",{type:"button",className:"history-load-more",disabled:u.loading,onClick:u.onLoadMore,children:u.loading?"加载中…":"加载更多"}):null]}):o.jsxs(o.Fragment,{children:[D.length===0?o.jsx("div",{className:"history-empty",children:"暂无会话"}):null,D.map($=>{const H=$.id===r,z=(l==null?void 0:l.has($.id))===!0,B=!z&&(c==null?void 0:c.has($.id))===!0;return o.jsxs("div",{className:`history-item ${H?"active":""}`,children:[o.jsxs("button",{className:"history-item-btn",onClick:()=>k($.id),"aria-current":H?"page":void 0,title:$.title,children:[o.jsx(hq,{title:$.title}),B&&o.jsxs("span",{className:"history-evaluating-status",title:"正在自动评测",children:[o.jsx("span",{className:"history-evaluating","aria-hidden":"true"}),"评测中"]})]}),o.jsxs("div",{className:"history-action-slot",children:[z?o.jsx(WS,{className:"history-streaming-indicator",size:12,role:"status","aria-label":"正在生成"}):null,o.jsx("button",{type:"button",className:"history-more","aria-label":`管理历史会话:${$.title}`,title:"更多",onClick:()=>L(V=>V===$.id?null:$.id),children:o.jsx(yH,{className:"icon"})})]}),j===$.id&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>L(null)}),o.jsx("div",{className:"history-menu",children:o.jsxs("button",{type:"button",className:"menu-item menu-item--danger",onClick:()=>{L(null),_($.id)},children:[o.jsx(Up,{className:"icon"})," 删除"]})})]})]},$.id)})]})})]}),o.jsx("div",{className:"sidebar-footer",children:o.jsx(Z6e,{activePage:i,access:a,userInfo:C,onAgentKitCli:x,onDeveloperResources:w,onSystemInfo:S,onIssueFeedback:E,onLogout:T})})]})}function qs(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{}};function rj(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Y_.prototype=rj.prototype={constructor:Y_,on:function(e,t){var n=this._,r=e$e(e+"",n),i,s=-1,a=r.length;if(arguments.length<2){for(;++s0)for(var n=new Array(i),r=0,i,s;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),mq.hasOwnProperty(t)?{space:mq[t],local:e}:e}function n$e(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===v4&&t.documentElement.namespaceURI===v4?t.createElement(e):t.createElementNS(n,e)}}function r$e(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Hue(e){var t=ij(e);return(t.local?r$e:n$e)(t)}function i$e(){}function m7(e){return e==null?i$e:function(){return this.querySelector(e)}}function s$e(e){typeof e!="function"&&(e=m7(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=x&&(x=v+1);!(S=y[x])&&++x=0;)(a=r[i])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function N$e(e){e||(e=j$e);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,r=n.length,i=new Array(r),s=0;st?1:e>=t?0:NaN}function R$e(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function I$e(){return Array.from(this)}function D$e(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?H$e:typeof t=="function"?X$e:q$e)(e,t,n??"")):n1(this.node(),e)}function n1(e,t){return e.style.getPropertyValue(t)||Yue(e).getComputedStyle(e,null).getPropertyValue(t)}function W$e(e){return function(){delete this[e]}}function Y$e(e,t){return function(){this[e]=t}}function Z$e(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function K$e(e,t){return arguments.length>1?this.each((t==null?W$e:typeof t=="function"?Z$e:Y$e)(e,t)):this.node()[e]}function Zue(e){return e.trim().split(/^|\s+/)}function g7(e){return e.classList||new Kue(e)}function Kue(e){this._node=e,this._names=Zue(e.getAttribute("class")||"")}Kue.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 Jue(e,t){for(var n=g7(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function _8e(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,s;n()=>e;function w4(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:s,x:a,y:l,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:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}w4.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function M8e(e){return!e.ctrlKey&&!e.button}function L8e(){return this.parentNode}function $8e(e,t){return t??{x:e.x,y:e.y}}function B8e(){return navigator.maxTouchPoints||"ontouchstart"in this}function sde(){var e=M8e,t=L8e,n=$8e,r=B8e,i={},s=rj("start","drag","end"),a=0,l,c,u,d,f=0;function h(w){w.on("mousedown.drag",m).filter(r).on("touchstart.drag",y).on("touchmove.drag",O,P8e).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(w,S){if(!(d||!e.call(this,w,S))){var E=x(this,t.call(this,w,S),w,S,"mouse");E&&(Tl(w.view).on("mousemove.drag",g,Aw).on("mouseup.drag",b,Aw),rde(w.view),A5(w),u=!1,l=w.clientX,c=w.clientY,E("start",w))}}function g(w){if(my(w),!u){var S=w.clientX-l,E=w.clientY-c;u=S*S+E*E>f}i.mouse("drag",w)}function b(w){Tl(w.view).on("mousemove.drag mouseup.drag",null),ide(w.view,u),my(w),i.mouse("end",w)}function y(w,S){if(e.call(this,w,S)){var E=w.changedTouches,k=t.call(this,w,S),_=E.length,C,T;for(C=0;C<_;++C)(T=x(this,k,w,S,E[C].identifier,E[C]))&&(A5(w),T("start",w,E[C]))}}function O(w){var S=w.changedTouches,E=S.length,k,_;for(k=0;k>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?r2(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?r2(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=U8e.exec(e))?new Ho(t[1],t[2],t[3],1):(t=F8e.exec(e))?new Ho(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=z8e.exec(e))?r2(t[1],t[2],t[3],t[4]):(t=V8e.exec(e))?r2(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=H8e.exec(e))?wq(t[1],t[2]/100,t[3]/100,1):(t=q8e.exec(e))?wq(t[1],t[2]/100,t[3]/100,t[4]):gq.hasOwnProperty(e)?Oq(gq[e]):e==="transparent"?new Ho(NaN,NaN,NaN,0):null}function Oq(e){return new Ho(e>>16&255,e>>8&255,e&255,1)}function r2(e,t,n,r){return r<=0&&(e=t=n=NaN),new Ho(e,t,n,r)}function W8e(e){return e instanceof rE||(e=$g(e)),e?(e=e.rgb(),new Ho(e.r,e.g,e.b,e.opacity)):new Ho}function S4(e,t,n,r){return arguments.length===1?W8e(e):new Ho(e,t,n,r??1)}function Ho(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}b7(Ho,S4,ade(rE,{brighter(e){return e=e==null?AC:Math.pow(AC,e),new Ho(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Nw:Math.pow(Nw,e),new Ho(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ho(vg(this.r),vg(this.g),vg(this.b),NC(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:xq,formatHex:xq,formatHex8:Y8e,formatRgb:vq,toString:vq}));function xq(){return`#${ig(this.r)}${ig(this.g)}${ig(this.b)}`}function Y8e(){return`#${ig(this.r)}${ig(this.g)}${ig(this.b)}${ig((isNaN(this.opacity)?1:this.opacity)*255)}`}function vq(){const e=NC(this.opacity);return`${e===1?"rgb(":"rgba("}${vg(this.r)}, ${vg(this.g)}, ${vg(this.b)}${e===1?")":`, ${e})`}`}function NC(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function vg(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ig(e){return e=vg(e),(e<16?"0":"")+e.toString(16)}function wq(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ou(e,t,n,r)}function ode(e){if(e instanceof ou)return new ou(e.h,e.s,e.l,e.opacity);if(e instanceof rE||(e=$g(e)),!e)return new ou;if(e instanceof ou)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),s=Math.max(t,n,r),a=NaN,l=s-i,c=(s+i)/2;return l?(t===s?a=(n-r)/l+(n0&&c<1?0:a,new ou(a,l,c,e.opacity)}function Z8e(e,t,n,r){return arguments.length===1?ode(e):new ou(e,t,n,r??1)}function ou(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}b7(ou,Z8e,ade(rE,{brighter(e){return e=e==null?AC:Math.pow(AC,e),new ou(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Nw:Math.pow(Nw,e),new ou(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,i=2*n-r;return new Ho(N5(e>=240?e-240:e+120,i,r),N5(e,i,r),N5(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new ou(Sq(this.h),i2(this.s),i2(this.l),NC(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=NC(this.opacity);return`${e===1?"hsl(":"hsla("}${Sq(this.h)}, ${i2(this.s)*100}%, ${i2(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Sq(e){return e=(e||0)%360,e<0?e+360:e}function i2(e){return Math.max(0,Math.min(1,e||0))}function N5(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 sj=e=>()=>e;function lde(e,t){return function(n){return e+n*t}}function K8e(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 pMt(e,t){var n=t-e;return n?lde(e,n>180||n<-180?n-360*Math.round(n/360):n):sj(isNaN(e)?t:e)}function J8e(e){return(e=+e)==1?cde:function(t,n){return n-t?K8e(t,n,e):sj(isNaN(t)?n:t)}}function cde(e,t){var n=t-e;return n?lde(e,n):sj(isNaN(e)?t:e)}const jC=function e(t){var n=J8e(t);function r(i,s){var a=n((i=S4(i)).r,(s=S4(s)).r),l=n(i.g,s.g),c=n(i.b,s.b),u=cde(i.opacity,s.opacity);return function(d){return i.r=a(d),i.g=l(d),i.b=c(d),i.opacity=u(d),i+""}}return r.gamma=e,r}(1);function e9e(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(s){for(i=0;in&&(s=t.slice(n,s),l[a]?l[a]+=s:l[++a]=s),(r=r[0])===(i=i[0])?l[a]?l[a]+=i:l[++a]=i:(l[++a]=null,c.push({i:a,x:Hu(r,i)})),n=j5.lastIndex;return n180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(i(f)+"rotate(",null,r)-2,x:Hu(u,d)})):d&&f.push(i(f)+"rotate("+d+r)}function l(u,d,f,h){u!==d?h.push({i:f.push(i(f)+"skewX(",null,r)-2,x:Hu(u,d)}):d&&f.push(i(f)+"skewX("+d+r)}function c(u,d,f,h,m,g){if(u!==f||d!==h){var b=m.push(i(m)+"scale(",null,",",null,")");g.push({i:b-4,x:Hu(u,f)},{i:b-2,x:Hu(d,h)})}else(f!==1||h!==1)&&m.push(i(m)+"scale("+f+","+h+")")}return function(u,d){var f=[],h=[];return u=e(u),d=e(d),s(u.translateX,u.translateY,d.translateX,d.translateY,f,h),a(u.rotate,d.rotate,f,h),l(u.skewX,d.skewX,f,h),c(u.scaleX,u.scaleY,d.scaleX,d.scaleY,f,h),u=d=null,function(m){for(var g=-1,b=h.length,y;++g=0&&e._call.call(void 0,t),e=e._next;--r1}function _q(){Bg=(IC=Rw.now())+aj,r1=Fx=0;try{m9e()}finally{r1=0,b9e(),Bg=0}}function g9e(){var e=Rw.now(),t=e-IC;t>hde&&(aj-=t,IC=e)}function b9e(){for(var e,t=RC,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:RC=n);zx=e,_4(r)}function _4(e){if(!r1){Fx&&(Fx=clearTimeout(Fx));var t=e-Bg;t>24?(e<1/0&&(Fx=setTimeout(_q,e-Rw.now()-aj)),tx&&(tx=clearInterval(tx))):(tx||(IC=Rw.now(),tx=setInterval(g9e,hde)),r1=1,pde(_q))}}function Tq(e,t,n){var r=new DC;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var y9e=rj("start","end","cancel","interrupt"),O9e=[],gde=0,Cq=1,T4=2,K_=3,Aq=4,C4=5,J_=6;function oj(e,t,n,r,i,s){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;x9e(e,n,{name:t,index:r,group:i,on:y9e,tween:O9e,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:gde})}function O7(e,t){var n=_u(e,t);if(n.state>gde)throw new Error("too late; already scheduled");return n}function _d(e,t){var n=_u(e,t);if(n.state>K_)throw new Error("too late; already running");return n}function _u(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function x9e(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=mde(s,0,n.time);function s(u){n.state=Cq,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var d,f,h,m;if(n.state!==Cq)return c();for(d in r)if(m=r[d],m.name===n.name){if(m.state===K_)return Tq(a);m.state===Aq?(m.state=J_,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete r[d]):+dT4&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function Y9e(e,t,n){var r,i,s=W9e(t)?O7:_d;return function(){var a=s(this,e),l=a.on;l!==r&&(i=(r=l).copy()).on(t,n),a.on=i}}function Z9e(e,t){var n=this._id;return arguments.length<2?_u(this.node(),n).on.on(e):this.each(Y9e(n,e,t))}function K9e(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function J9e(){return this.on("end.remove",K9e(this._id))}function e7e(e){var t=this._name,n=this._id;typeof e!="function"&&(e=m7(e));for(var r=this._groups,i=r.length,s=new Array(i),a=0;a()=>e;function k7e(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){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:i}})}function _f(e,t,n){this.k=e,this.x=t,this.y=n}_f.prototype={constructor:_f,scale:function(e){return e===1?this:new _f(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new _f(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 lj=new _f(1,0,0);xde.prototype=_f.prototype;function xde(e){for(;!e.__zoom;)if(!(e=e.parentNode))return lj;return e.__zoom}function R5(e){e.stopImmediatePropagation()}function nx(e){e.preventDefault(),e.stopImmediatePropagation()}function _7e(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function T7e(){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 Nq(){return this.__zoom||lj}function C7e(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function A7e(){return navigator.maxTouchPoints||"ontouchstart"in this}function N7e(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}function vde(){var e=_7e,t=T7e,n=N7e,r=C7e,i=A7e,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Z_,u=rj("start","zoom","end"),d,f,h,m=500,g=150,b=0,y=10;function O(I){I.property("__zoom",Nq).on("wheel.zoom",_,{passive:!1}).on("mousedown.zoom",C).on("dblclick.zoom",T).filter(i).on("touchstart.zoom",A).on("touchmove.zoom",j).on("touchend.zoom touchcancel.zoom",L).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}O.transform=function(I,M,N,D){var Q=I.selection?I.selection():I;Q.property("__zoom",Nq),I!==Q?S(I,M,N,D):Q.interrupt().each(function(){E(this,arguments).event(D).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},O.scaleBy=function(I,M,N,D){O.scaleTo(I,function(){var Q=this.__zoom.k,F=typeof M=="function"?M.apply(this,arguments):M;return Q*F},N,D)},O.scaleTo=function(I,M,N,D){O.transform(I,function(){var Q=t.apply(this,arguments),F=this.__zoom,$=N==null?w(Q):typeof N=="function"?N.apply(this,arguments):N,H=F.invert($),z=typeof M=="function"?M.apply(this,arguments):M;return n(x(v(F,z),$,H),Q,a)},N,D)},O.translateBy=function(I,M,N,D){O.transform(I,function(){return n(this.__zoom.translate(typeof M=="function"?M.apply(this,arguments):M,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),a)},null,D)},O.translateTo=function(I,M,N,D,Q){O.transform(I,function(){var F=t.apply(this,arguments),$=this.__zoom,H=D==null?w(F):typeof D=="function"?D.apply(this,arguments):D;return n(lj.translate(H[0],H[1]).scale($.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof N=="function"?-N.apply(this,arguments):-N),F,a)},D,Q)};function v(I,M){return M=Math.max(s[0],Math.min(s[1],M)),M===I.k?I:new _f(M,I.x,I.y)}function x(I,M,N){var D=M[0]-N[0]*I.k,Q=M[1]-N[1]*I.k;return D===I.x&&Q===I.y?I:new _f(I.k,D,Q)}function w(I){return[(+I[0][0]+ +I[1][0])/2,(+I[0][1]+ +I[1][1])/2]}function S(I,M,N,D){I.on("start.zoom",function(){E(this,arguments).event(D).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(D).end()}).tween("zoom",function(){var Q=this,F=arguments,$=E(Q,F).event(D),H=t.apply(Q,F),z=N==null?w(H):typeof N=="function"?N.apply(Q,F):N,B=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),V=Q.__zoom,Z=typeof M=="function"?M.apply(Q,F):M,ce=c(V.invert(z).concat(B/V.k),Z.invert(z).concat(B/Z.k));return function(be){if(be===1)be=Z;else{var ie=ce(be),q=B/ie[2];be=new _f(q,z[0]-ie[0]*q,z[1]-ie[1]*q)}$.zoom(null,be)}})}function E(I,M,N){return!N&&I.__zooming||new k(I,M)}function k(I,M){this.that=I,this.args=M,this.active=0,this.sourceEvent=null,this.extent=t.apply(I,M),this.taps=0}k.prototype={event:function(I){return I&&(this.sourceEvent=I),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(I,M){return this.mouse&&I!=="mouse"&&(this.mouse[1]=M.invert(this.mouse[0])),this.touch0&&I!=="touch"&&(this.touch0[1]=M.invert(this.touch0[0])),this.touch1&&I!=="touch"&&(this.touch1[1]=M.invert(this.touch1[0])),this.that.__zoom=M,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(I){var M=Tl(this.that).datum();u.call(I,this.that,new k7e(I,{sourceEvent:this.sourceEvent,target:O,transform:this.that.__zoom,dispatch:u}),M)}};function _(I,...M){if(!e.apply(this,arguments))return;var N=E(this,M).event(I),D=this.__zoom,Q=Math.max(s[0],Math.min(s[1],D.k*Math.pow(2,r.apply(this,arguments)))),F=iu(I);if(N.wheel)(N.mouse[0][0]!==F[0]||N.mouse[0][1]!==F[1])&&(N.mouse[1]=D.invert(N.mouse[0]=F)),clearTimeout(N.wheel);else{if(D.k===Q)return;N.mouse=[F,D.invert(F)],eT(this),N.start()}nx(I),N.wheel=setTimeout($,g),N.zoom("mouse",n(x(v(D,Q),N.mouse[0],N.mouse[1]),N.extent,a));function $(){N.wheel=null,N.end()}}function C(I,...M){if(h||!e.apply(this,arguments))return;var N=I.currentTarget,D=E(this,M,!0).event(I),Q=Tl(I.view).on("mousemove.zoom",z,!0).on("mouseup.zoom",B,!0),F=iu(I,N),$=I.clientX,H=I.clientY;rde(I.view),R5(I),D.mouse=[F,this.__zoom.invert(F)],eT(this),D.start();function z(V){if(nx(V),!D.moved){var Z=V.clientX-$,ce=V.clientY-H;D.moved=Z*Z+ce*ce>b}D.event(V).zoom("mouse",n(x(D.that.__zoom,D.mouse[0]=iu(V,N),D.mouse[1]),D.extent,a))}function B(V){Q.on("mousemove.zoom mouseup.zoom",null),ide(V.view,D.moved),nx(V),D.event(V).end()}}function T(I,...M){if(e.apply(this,arguments)){var N=this.__zoom,D=iu(I.changedTouches?I.changedTouches[0]:I,this),Q=N.invert(D),F=N.k*(I.shiftKey?.5:2),$=n(x(v(N,F),D,Q),t.apply(this,M),a);nx(I),l>0?Tl(this).transition().duration(l).call(S,$,D,I):Tl(this).call(O.transform,$,D,I)}}function A(I,...M){if(e.apply(this,arguments)){var N=I.touches,D=N.length,Q=E(this,M,I.changedTouches.length===D).event(I),F,$,H,z;for(R5(I),$=0;$`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.`},Iw=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],wde=["Enter"," ","Escape"],Sde={"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 i1;(function(e){e.Strict="strict",e.Loose="loose"})(i1||(i1={}));var wg;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(wg||(wg={}));var Dw;(function(e){e.Partial="partial",e.Full="full"})(Dw||(Dw={}));const Ede={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var ip;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ip||(ip={}));var Pw;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Pw||(Pw={}));var zt;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(zt||(zt={}));const jq={[zt.Left]:zt.Right,[zt.Right]:zt.Left,[zt.Top]:zt.Bottom,[zt.Bottom]:zt.Top};function kde(e){return e===null?null:e?"valid":"invalid"}const _de=e=>"id"in e&&"source"in e&&"target"in e,j7e=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),v7=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),iE=(e,t=[0,0])=>{const{width:n,height:r}=gh(e),i=e.origin??t,s=n*i[0],a=r*i[1];return{x:e.position.x-s,y:e.position.y-a}},R7e=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,i)=>{const s=typeof i=="string";let a=!t.nodeLookup&&!s?i:void 0;t.nodeLookup&&(a=s?t.nodeLookup.get(i):v7(i)?i:t.nodeLookup.get(i.id));const l=a?PC(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return cj(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return uj(n)},sE=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(i=>{(t.filter===void 0||t.filter(i))&&(n=cj(n,PC(i)),r=!0)}),r?uj(n):{x:0,y:0,width:0,height:0}},w7=(e,t,[n,r,i]=[0,0,1],s=!1,a=!1)=>{const l={...J1(t,[n,r,i]),width:t.width/i,height:t.height/i},c=[];for(const u of e.values()){const{measured:d,selectable:f=!0,hidden:h=!1}=u;if(a&&!f||h)continue;const m=d.width??u.width??u.initialWidth??null,g=d.height??u.height??u.initialHeight??null,b=Mw(l,a1(u)),y=(m??0)*(g??0),O=s&&b>0;(!u.internals.handleBounds||O||b>=y||u.dragging)&&c.push(u)}return c},I7e=(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 D7e(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(i=>i.id)):null;return e.forEach(i=>{i.measured.width&&i.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!i.hidden)&&(!r||r.has(i.id))&&n.set(i.id,i)}),n}async function P7e({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:s},a){if(e.size===0)return!0;const l=D7e(e,a),c=sE(l),u=E7(c,t,n,(a==null?void 0:a.minZoom)??i,(a==null?void 0:a.maxZoom)??s,(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 Tde({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:s}){const a=n.get(e),l=a.parentId?n.get(a.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},d=a.origin??r;let f=a.extent||i;if(a.extent==="parent"&&!a.expandParent)if(!l)s==null||s("005",Ou.error005());else{const m=l.measured.width,g=l.measured.height;m&&g&&(f=[[c,u],[c+m,u+g]])}else l&&Ug(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=Ug(f)?Qg(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(s==null||s("015",Ou.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 M7e({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){const s=new Set(e.map(h=>h.id)),a=[];for(const h of n){if(h.deletable===!1)continue;const m=s.has(h.id),g=!m&&h.parentId&&a.find(b=>b.id===h.parentId);(m||g)&&a.push(h)}const l=new Set(t.map(h=>h.id)),c=r.filter(h=>h.deletable!==!1),d=I7e(a,c);for(const h of c)l.has(h.id)&&!d.find(g=>g.id===h.id)&&d.push(h);if(!i)return{edges:d,nodes:a};const f=await i({nodes:a,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:a}:{edges:[],nodes:[]}:f}const s1=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Qg=(e={x:0,y:0},t,n)=>({x:s1(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:s1(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function Cde(e,t,n){const{width:r,height:i}=gh(n),{x:s,y:a}=n.internals.positionAbsolute;return Qg(e,[[s,a],[s+r,a+i]],t)}const Rq=(e,t,n)=>en?-s1(Math.abs(e-n),1,t)/t:0,S7=(e,t,n=15,r=40)=>{const i=Rq(e.x,r,t.width-r)*n,s=Rq(e.y,r,t.height-r)*n;return[i,s]},cj=(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)}),A4=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),uj=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),a1=(e,t=[0,0])=>{var i,s;const{x:n,y:r}=v7(e)?e.internals.positionAbsolute:iE(e,t);return{x:n,y:r,width:((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0,height:((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0}},PC=(e,t=[0,0])=>{var i,s;const{x:n,y:r}=v7(e)?e.internals.positionAbsolute:iE(e,t);return{x:n,y:r,x2:n+(((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0),y2:r+(((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0)}},Ade=(e,t)=>uj(cj(A4(e),A4(t))),Mw=(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)},Iq=e=>cu(e.width)&&cu(e.height)&&cu(e.x)&&cu(e.y),cu=e=>!isNaN(e)&&isFinite(e),Nde=(e,t)=>(n,r)=>{},aE=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),J1=({x:e,y:t},[n,r,i],s=!1,a=[1,1])=>{const l={x:(e-n)/i,y:(t-r)/i};return s?aE(l,a):l},o1=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function G0(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 L7e(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=G0(e,n),i=G0(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e=="object"){const r=G0(e.top??e.y??0,n),i=G0(e.bottom??e.y??0,n),s=G0(e.left??e.x??0,t),a=G0(e.right??e.x??0,t);return{top:r,right:a,bottom:i,left:s,x:s+a,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function $7e(e,t,n,r,i,s){const{x:a,y:l}=o1(e,[t,n,r]),{x:c,y:u}=o1({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=i-c,f=s-u;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(d),bottom:Math.floor(f)}}const E7=(e,t,n,r,i,s)=>{const a=L7e(s,t,n),l=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(l,c),d=s1(u,r,i),f=e.x+e.width/2,h=e.y+e.height/2,m=t/2-f*d,g=n/2-h*d,b=$7e(e,m,g,d,t,n),y={left:Math.min(b.left-a.left,0),top:Math.min(b.top-a.top,0),right:Math.min(b.right-a.right,0),bottom:Math.min(b.bottom-a.bottom,0)};return{x:m-y.left+y.right,y:g-y.top+y.bottom,zoom:d}},Lw=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Ug(e){return e!=null&&e!=="parent"}function gh(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 k7(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 jde(e,t={width:0,height:0},n,r,i){const s={...e},a=r.get(n);if(a){const l=a.origin||i;s.x+=a.internals.positionAbsolute.x-(t.width??0)*l[0],s.y+=a.internals.positionAbsolute.y-(t.height??0)*l[1]}return s}function Dq(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function B7e(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}function Q7e(e){return{...Sde,...e||{}}}function Tv(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){const{x:s,y:a}=uu(e),l=J1({x:s-((i==null?void 0:i.left)??0),y:a-((i==null?void 0:i.top)??0)},r),{x:c,y:u}=n?aE(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const _7=e=>({width:e.offsetWidth,height:e.offsetHeight}),Rde=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},U7e=["INPUT","SELECT","TEXTAREA"];function Ide(e){var r,i;const t=((i=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:i[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:U7e.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Dde=e=>"clientX"in e,uu=(e,t)=>{var s,a;const n=Dde(e),r=n?e.clientX:(s=e.touches)==null?void 0:s[0].clientX,i=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},Pq=(e,t,n,r,i)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(a=>{const l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:i,position:a.getAttribute("data-handlepos"),x:(l.left-n.left)/r,y:(l.top-n.top)/r,..._7(a)}})};function Pde({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:s,targetControlX:a,targetControlY:l}){const c=e*.125+i*.375+a*.375+n*.125,u=t*.125+s*.375+l*.375+r*.125,d=Math.abs(c-e),f=Math.abs(u-t);return[c,u,d,f]}function o2(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Mq({pos:e,x1:t,y1:n,x2:r,y2:i,c:s}){switch(e){case zt.Left:return[t-o2(t-r,s),n];case zt.Right:return[t+o2(r-t,s),n];case zt.Top:return[t,n-o2(n-i,s)];case zt.Bottom:return[t,n+o2(i-n,s)]}}function Mde({sourceX:e,sourceY:t,sourcePosition:n=zt.Bottom,targetX:r,targetY:i,targetPosition:s=zt.Top,curvature:a=.25}){const[l,c]=Mq({pos:n,x1:e,y1:t,x2:r,y2:i,c:a}),[u,d]=Mq({pos:s,x1:r,y1:i,x2:e,y2:t,c:a}),[f,h,m,g]=Pde({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${l},${c} ${u},${d} ${r},${i}`,f,h,m,g]}function Lde({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,s=n0}const V7e=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,H7e=(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)),q7e=(e,t,n={})=>{var s;if(!e.source||!e.target)return(s=n.onError)==null||s.call(n,"006",Ou.error006()),t;const r=n.getEdgeId||V7e;let i;return _de(e)?i={...e}:i={...e,id:r(e)},H7e(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function $de({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,s,a,l]=Lde({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,s,a,l]}const Lq={[zt.Left]:{x:-1,y:0},[zt.Right]:{x:1,y:0},[zt.Top]:{x:0,y:-1},[zt.Bottom]:{x:0,y:1}},X7e=({source:e,sourcePosition:t=zt.Bottom,target:n})=>t===zt.Left||t===zt.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function G7e({source:e,sourcePosition:t=zt.Bottom,target:n,targetPosition:r=zt.Top,center:i,offset:s,stepPosition:a}){const l=Lq[t],c=Lq[r],u={x:e.x+l.x*s,y:e.y+l.y*s},d={x:n.x+c.x*s,y:n.y+c.y*s},f=X7e({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",m=f[h];let g=[],b,y;const O={x:0,y:0},v={x:0,y:0},[,,x,w]=Lde({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[h]*c[h]===-1){h==="x"?(b=i.x??u.x+(d.x-u.x)*a,y=i.y??(u.y+d.y)/2):(b=i.x??(u.x+d.x)/2,y=i.y??u.y+(d.y-u.y)*a);const _=[{x:b,y:u.y},{x:b,y:d.y}],C=[{x:u.x,y},{x:d.x,y}];l[h]===m?g=h==="x"?_:C:g=h==="x"?C:_}else{const _=[{x:u.x,y:d.y}],C=[{x:d.x,y:u.y}];if(h==="x"?g=l.x===m?C:_:g=l.y===m?_:C,t===r){const I=Math.abs(e[h]-n[h]);if(I<=s){const M=Math.min(s-1,s-I);l[h]===m?O[h]=(u[h]>e[h]?-1:1)*M:v[h]=(d[h]>n[h]?-1:1)*M}}if(t!==r){const I=h==="x"?"y":"x",M=l[h]===c[I],N=u[I]>d[I],D=u[I]=L?(b=(T.x+A.x)/2,y=g[0].y):(b=g[0].x,y=(T.y+A.y)/2)}const S={x:u.x+O.x,y:u.y+O.y},E={x:d.x+v.x,y:d.y+v.y};return[[e,...S.x!==g[0].x||S.y!==g[0].y?[S]:[],...g,...E.x!==g[g.length-1].x||E.y!==g[g.length-1].y?[E]:[],n],b,y,x,w]}function W7e(e,t,n,r){const i=Math.min($q(e,t)/2,$q(t,n)/2,r),{x:s,y:a}=t;if(e.x===s&&s===n.x||e.y===a&&a===n.y)return`L${s} ${a}`;if(e.y===a){const u=e.xn.id===t):e[0])||null}function N4(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function Z7e(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){const s=new Set;return e.reduce((a,l)=>([l.markerStart||r,l.markerEnd||i].forEach(c=>{if(c&&typeof c=="object"){const u=N4(c,t);s.has(u)||(a.push({id:u,color:c.color||n,...c}),s.add(u))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}const Bde=1e3,K7e=10,T7={nodeOrigin:[0,0],nodeExtent:Iw,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},J7e={...T7,checkEquality:!0};function C7(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function eBe(e,t,n){const r=C7(T7,n);for(const i of e.values())if(i.parentId)N7(i,e,t,r);else{const s=iE(i,r.nodeOrigin),a=Ug(i.extent)?i.extent:r.nodeExtent,l=Qg(s,a,gh(i));i.internals.positionAbsolute=l}}function tBe(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const i of e.handles){const s={id:i.id,width:i.width??1,height:i.height??1,nodeId:e.id,x:i.x,y:i.y,position:i.position,type:i.type};i.type==="source"?n.push(s):i.type==="target"&&r.push(s)}return{source:n,target:r}}function A7(e){return e==="manual"}function j4(e,t,n,r={}){var d,f;const i=C7(J7e,r),s={i:0},a=new Map(t),l=i!=null&&i.elevateNodesOnSelect&&!A7(i.zIndexMode)?Bde:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const h of e){let m=a.get(h.id);if(i.checkEquality&&h===(m==null?void 0:m.internals.userNode))t.set(h.id,m);else{const g=iE(h,i.nodeOrigin),b=Ug(h.extent)?h.extent:i.nodeExtent,y=Qg(g,b,gh(h));m={...i.defaults,...h,measured:{width:(d=h.measured)==null?void 0:d.width,height:(f=h.measured)==null?void 0:f.height},internals:{positionAbsolute:y,handleBounds:tBe(h,m),z:Qde(h,l,i.zIndexMode),userNode:h}},t.set(h.id,m)}(m.measured===void 0||m.measured.width===void 0||m.measured.height===void 0)&&!m.hidden&&(c=!1),h.parentId&&N7(m,t,n,r,s),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function nBe(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 N7(e,t,n,r,i){const{elevateNodesOnSelect:s,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=C7(T7,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}nBe(e,n),i&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++i.i,d.internals.z=d.internals.z+i.i*K7e),i&&d.internals.rootParentIndex!==void 0&&(i.i=d.internals.rootParentIndex);const f=s&&!A7(c)?Bde:0,{x:h,y:m,z:g}=rBe(e,d,a,l,f,c),{positionAbsolute:b}=e.internals,y=h!==b.x||m!==b.y;(y||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:y?{x:h,y:m}:b,z:g}})}function Qde(e,t,n){const r=cu(e.zIndex)?e.zIndex:0;return A7(n)?r:r+(e.selected?t:0)}function rBe(e,t,n,r,i,s){const{x:a,y:l}=t.internals.positionAbsolute,c=gh(e),u=iE(e,n),d=Ug(e.extent)?Qg(u,e.extent,c):u;let f=Qg({x:a+d.x,y:l+d.y},r,c);e.extent==="parent"&&(f=Cde(f,c,t));const h=Qde(e,i,s),m=t.internals.z??0;return{x:f.x,y:f.y,z:m>=h?m+1:h}}function j7(e,t,n,r=[0,0]){var a;const i=[],s=new Map;for(const l of e){const c=t.get(l.parentId);if(!c)continue;const u=((a=s.get(l.parentId))==null?void 0:a.expandedRect)??a1(c),d=Ade(u,l.rect);s.set(l.parentId,{expandedRect:d,parent:c})}return s.size>0&&s.forEach(({expandedRect:l,parent:c},u)=>{var x;const d=c.internals.positionAbsolute,f=gh(c),h=c.origin??r,m=l.x0||g>0||O||v)&&(i.push({id:u,type:"position",position:{x:c.position.x-m+O,y:c.position.y-g+v}}),(x=n.get(u))==null||x.forEach(w=>{e.some(S=>S.id===w.id)||i.push({id:w.id,type:"position",position:{x:w.position.x+m,y:w.position.y+g}})})),(f.width0){const m=j7(h,t,n,i);u.push(...m)}return{changes:u,updatedInternals:c}}async function sBe({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:s}){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],[i,s]],r);return!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2])}function Fq(e,t,n,r,i,s){let a=i;const l=r.get(a)||new Map;r.set(a,l.set(n,t)),a=`${i}-${e}`;const c=r.get(a)||new Map;if(r.set(a,c.set(n,t)),s){a=`${i}-${e}-${s}`;const u=r.get(a)||new Map;r.set(a,u.set(n,t))}}function Ude(e,t,n){e.clear(),t.clear();for(const r of n){const{source:i,target:s,sourceHandle:a=null,targetHandle:l=null}=r,c={edgeId:r.id,source:i,target:s,sourceHandle:a,targetHandle:l},u=`${i}-${a}--${s}-${l}`,d=`${s}-${l}--${i}-${a}`;Fq("source",c,d,e,i,a),Fq("target",c,u,e,s,l),t.set(r.id,r)}}function Fde(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Fde(n,t):!1}function zq(e,t,n){var i;let r=e;do{if((i=r==null?void 0:r.matches)!=null&&i.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function aBe(e,t,n,r){const i=new Map;for(const[s,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!Fde(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){const l=e.get(s);l&&i.set(s,{id:s,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return i}function I5({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var a,l,c;const i=[];for(const[u,d]of t){const f=(a=n.get(u))==null?void 0:a.internals.userNode;f&&i.push({...f,position:d.position,dragging:r})}if(!e)return[i[0],i];const s=(l=n.get(e))==null?void 0:l.internals.userNode;return[s?{...s,position:((c=t.get(e))==null?void 0:c.position)||s.position,dragging:r}:i[0],i]}function oBe({dragItems:e,snapGrid:t,x:n,y:r}){const i=e.values().next().value;if(!i)return null;const s={x:n-i.distance.x,y:r-i.distance.y},a=aE(s,t);return{x:a.x-s.x,y:a.y-s.y}}function lBe({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let s={x:null,y:null},a=0,l=new Map,c=!1,u={x:0,y:0},d=null,f=!1,h=null,m=!1,g=!1,b=null;function y({noDragClassName:v,handleSelector:x,domNode:w,isSelectable:S,nodeId:E,nodeClickDistance:k=0}){h=Tl(w);function _({x:j,y:L}){const{nodeLookup:I,nodeExtent:M,snapGrid:N,snapToGrid:D,nodeOrigin:Q,onNodeDrag:F,onSelectionDrag:$,onError:H,updateNodePositions:z}=t();s={x:j,y:L};let B=!1;const V=l.size>1,Z=V&&M?A4(sE(l)):null,ce=V&&D?oBe({dragItems:l,snapGrid:N,x:j,y:L}):null;for(const[be,ie]of l){if(!I.has(be))continue;let q={x:j-ie.distance.x,y:L-ie.distance.y};D&&(q=ce?{x:Math.round(q.x+ce.x),y:Math.round(q.y+ce.y)}:aE(q,N));let X=null;if(V&&M&&!ie.extent&&Z){const{positionAbsolute:xe}=ie.internals,Me=xe.x-Z.x+M[0][0],Ae=xe.x+ie.measured.width-Z.x2+M[1][0],He=xe.y-Z.y+M[0][1],et=xe.y+ie.measured.height-Z.y2+M[1][1];X=[[Me,He],[Ae,et]]}const{position:K,positionAbsolute:de}=Tde({nodeId:be,nextPosition:q,nodeLookup:I,nodeExtent:X||M,nodeOrigin:Q,onError:H});B=B||ie.position.x!==K.x||ie.position.y!==K.y,ie.position=K,ie.internals.positionAbsolute=de}if(g=g||B,!!B&&(z(l,!0),b&&(r||F||!E&&$))){const[be,ie]=I5({nodeId:E,dragItems:l,nodeLookup:I});r==null||r(b,l,be,ie),F==null||F(b,be,ie),E||$==null||$(b,ie)}}async function C(){if(!d)return;const{transform:j,panBy:L,autoPanSpeed:I,autoPanOnNodeDrag:M}=t();if(!M){c=!1,cancelAnimationFrame(a);return}const[N,D]=S7(u,d,I);(N!==0||D!==0)&&(s.x=(s.x??0)-N/j[2],s.y=(s.y??0)-D/j[2],await L({x:N,y:D})&&_(s)),a=requestAnimationFrame(C)}function T(j){var V;const{nodeLookup:L,multiSelectionActive:I,nodesDraggable:M,transform:N,snapGrid:D,snapToGrid:Q,selectNodesOnDrag:F,onNodeDragStart:$,onSelectionDragStart:H,unselectNodesAndEdges:z}=t();f=!0,(!F||!S)&&!I&&E&&((V=L.get(E))!=null&&V.selected||z()),S&&F&&E&&(e==null||e(E));const B=Tv(j.sourceEvent,{transform:N,snapGrid:D,snapToGrid:Q,containerBounds:d});if(s=B,l=aBe(L,M,B,E),l.size>0&&(n||$||!E&&H)){const[Z,ce]=I5({nodeId:E,dragItems:l,nodeLookup:L});n==null||n(j.sourceEvent,l,Z,ce),$==null||$(j.sourceEvent,Z,ce),E||H==null||H(j.sourceEvent,ce)}}const A=sde().clickDistance(k).on("start",j=>{const{domNode:L,nodeDragThreshold:I,transform:M,snapGrid:N,snapToGrid:D}=t();d=(L==null?void 0:L.getBoundingClientRect())||null,m=!1,g=!1,b=j.sourceEvent,I===0&&T(j),s=Tv(j.sourceEvent,{transform:M,snapGrid:N,snapToGrid:D,containerBounds:d}),u=uu(j.sourceEvent,d)}).on("drag",j=>{const{autoPanOnNodeDrag:L,transform:I,snapGrid:M,snapToGrid:N,nodeDragThreshold:D,nodeLookup:Q}=t(),F=Tv(j.sourceEvent,{transform:I,snapGrid:M,snapToGrid:N,containerBounds:d});if(b=j.sourceEvent,(j.sourceEvent.type==="touchmove"&&j.sourceEvent.touches.length>1||E&&!Q.has(E))&&(m=!0),!m){if(!c&&L&&f&&(c=!0,C()),!f){const $=uu(j.sourceEvent,d),H=$.x-u.x,z=$.y-u.y;Math.sqrt(H*H+z*z)>D&&T(j)}(s.x!==F.xSnapped||s.y!==F.ySnapped)&&l&&f&&(u=uu(j.sourceEvent,d),_(F))}}).on("end",j=>{if(!f||m){m&&l.size>0&&t().updateNodePositions(l,!1);return}if(c=!1,f=!1,cancelAnimationFrame(a),l.size>0){const{nodeLookup:L,updateNodePositions:I,onNodeDragStop:M,onSelectionDragStop:N}=t();if(g&&(I(l,!1),g=!1),i||M||!E&&N){const[D,Q]=I5({nodeId:E,dragItems:l,nodeLookup:L,dragging:!1});i==null||i(j.sourceEvent,l,D,Q),M==null||M(j.sourceEvent,D,Q),E||N==null||N(j.sourceEvent,Q)}}}).filter(j=>{const L=j.target;return!j.button&&(!v||!zq(L,`.${v}`,w))&&(!x||zq(L,x,w))});h.call(A)}function O(){h==null||h.on(".drag",null)}return{update:y,destroy:O}}function cBe(e,t,n){const r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())Mw(i,a1(s))>0&&r.push(s);return r}const uBe=250;function dBe(e,t,n,r){var l,c;let i=[],s=1/0;const a=cBe(e,n,t+uBe);for(const u of a){const d=[...((l=u.internals.handleBounds)==null?void 0:l.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:m}=Fg(u,f,f.position,!0),g=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(m-e.y,2));g>t||(g1){const u=r.type==="source"?"target":"source";return i.find(d=>d.type===u)??i[0]}return i[0]}function zde(e,t,n,r,i,s=!1){var u,d,f;const a=r.get(e);if(!a)return null;const l=i==="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?l==null?void 0:l.find(h=>h.id===n):l==null?void 0:l[0])??null;return c&&s?{...c,...Fg(a,c,c.position,!0)}:c}function Vde(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function fBe(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Hde=()=>!0;function hBe(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:s,isTarget:a,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:m,onConnectStart:g,onConnect:b,onConnectEnd:y,isValidConnection:O=Hde,onReconnectEnd:v,updateConnection:x,getTransform:w,getFromHandle:S,autoPanSpeed:E,dragThreshold:k=1,handleDomNode:_}){const C=Rde(e.target);let T=0,A;const{x:j,y:L}=uu(e),I=Vde(s,_),M=l==null?void 0:l.getBoundingClientRect();let N=!1;if(!M||!I)return;const D=zde(i,I,r,c,t);if(!D)return;let Q=uu(e,M),F=!1,$=null,H=!1,z=null;function B(){if(!d||!M)return;const[K,de]=S7(Q,M,E);h({x:K,y:de}),T=requestAnimationFrame(B)}const V={...D,nodeId:i,type:I,position:D.position},Z=c.get(i);let be={inProgress:!0,isValid:null,from:Fg(Z,V,zt.Left,!0),fromHandle:V,fromPosition:V.position,fromNode:Z,to:Q,toHandle:null,toPosition:jq[V.position],toNode:null,pointer:Q};function ie(){N=!0,x(be),g==null||g(e,{nodeId:i,handleId:r,handleType:I})}k===0&&ie();function q(K){if(!N){const{x:et,y:Te}=uu(K),Re=et-j,he=Te-L;if(!(Re*Re+he*he>k*k))return;ie()}if(!S()||!V){X(K);return}const de=w();Q=uu(K,M),A=dBe(J1(Q,de,!1,[1,1]),n,c,V),F||(B(),F=!0);const xe=qde(K,{handle:A,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:a?"target":"source",isValidConnection:O,doc:C,lib:u,flowId:f,nodeLookup:c});z=xe.handleDomNode,$=xe.connection,H=fBe(!!A,xe.isValid);const Me=c.get(i),Ae=Me?Fg(Me,V,zt.Left,!0):be.from,He={...be,from:Ae,isValid:H,to:xe.toHandle&&H?o1({x:xe.toHandle.x,y:xe.toHandle.y},de):Q,toHandle:xe.toHandle,toPosition:H&&xe.toHandle?xe.toHandle.position:jq[V.position],toNode:xe.toHandle?c.get(xe.toHandle.nodeId):null,pointer:Q};x(He),be=He}function X(K){if(!("touches"in K&&K.touches.length>0)){if(N){(A||z)&&$&&H&&(b==null||b($));const{inProgress:de,...xe}=be,Me={...xe,toPosition:be.toHandle?be.toPosition:null};y==null||y(K,Me),s&&(v==null||v(K,Me))}m(),cancelAnimationFrame(T),F=!1,H=!1,$=null,z=null,C.removeEventListener("mousemove",q),C.removeEventListener("mouseup",X),C.removeEventListener("touchmove",q),C.removeEventListener("touchend",X)}}C.addEventListener("mousemove",q),C.addEventListener("mouseup",X),C.addEventListener("touchmove",q),C.addEventListener("touchend",X)}function qde(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:s,doc:a,lib:l,flowId:c,isValidConnection:u=Hde,nodeLookup:d}){const f=s==="target",h=t?a.querySelector(`.${l}-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:m,y:g}=uu(e),b=a.elementFromPoint(m,g),y=b!=null&&b.classList.contains(`${l}-flow__handle`)?b:h,O={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const v=Vde(void 0,y),x=y.getAttribute("data-nodeid"),w=y.getAttribute("data-handleid"),S=y.classList.contains("connectable"),E=y.classList.contains("connectableend");if(!x||!v)return O;const k={source:f?x:r,sourceHandle:f?w:i,target:f?r:x,targetHandle:f?i:w};O.connection=k;const C=S&&E&&(n===i1.Strict?f&&v==="source"||!f&&v==="target":x!==r||w!==i);O.isValid=C&&u(k),O.toHandle=zde(x,v,w,d,n,!0)}return O}const R4={onPointerDown:hBe,isValid:qde};function pBe({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const i=Tl(e);function s({translateExtent:l,width:c,height:u,zoomStep:d=1,pannable:f=!0,zoomable:h=!0,inversePan:m=!1}){const g=x=>{if(x.sourceEvent.type!=="wheel"||!t)return;const w=n(),S=x.sourceEvent.ctrlKey&&Lw()?10:1,E=-x.sourceEvent.deltaY*(x.sourceEvent.deltaMode===1?.05:x.sourceEvent.deltaMode?1:.002)*d,k=w[2]*Math.pow(2,E*S);t.scaleTo(k)};let b=[0,0];const y=x=>{(x.sourceEvent.type==="mousedown"||x.sourceEvent.type==="touchstart")&&(b=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY])},O=x=>{const w=n();if(x.sourceEvent.type!=="mousemove"&&x.sourceEvent.type!=="touchmove"||!t)return;const S=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY],E=[S[0]-b[0],S[1]-b[1]];b=S;const k=r()*Math.max(w[2],Math.log(w[2]))*(m?-1:1),_={x:w[0]-E[0]*k,y:w[1]-E[1]*k},C=[[0,0],[c,u]];t.setViewportConstrained({x:_.x,y:_.y,zoom:w[2]},C,l)},v=vde().on("start",y).on("zoom",f?O:null).on("zoom.wheel",h?g:null);i.call(v,{})}function a(){i.on("zoom",null)}return{update:s,destroy:a,pointer:iu}}const dj=e=>({x:e.x,y:e.y,zoom:e.k}),D5=({x:e,y:t,zoom:n})=>lj.translate(e,t).scale(n),Vb=(e,t)=>e.target.closest(`.${t}`),Xde=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),mBe=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,P5=(e,t=0,n=mBe,r=()=>{})=>{const i=typeof t=="number"&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on("end",r):e},Gde=e=>{const t=e.ctrlKey&&Lw()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function gBe({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:s,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(Vb(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&a){const y=iu(d),O=Gde(d),v=f*Math.pow(2,O);r.scaleTo(n,v,y,d);return}const h=d.deltaMode===1?20:1;let m=i===wg.Vertical?0:d.deltaX*h,g=i===wg.Horizontal?0:d.deltaY*h;!Lw()&&d.shiftKey&&i!==wg.Vertical&&(m=d.deltaY*h,g=0),r.translateBy(n,-(m/f)*s,-(g/f)*s,{internal:!0});const b=dj(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,b),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(d,b))}}function bBe({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){const s=r.type==="wheel",a=!t&&s&&!r.ctrlKey,l=Vb(r,e);if(r.ctrlKey&&s&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,i)}}function yBe({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var s,a,l;if((s=r.sourceEvent)!=null&&s.internal)return;const i=dj(r.transform);e.mouseButton=((a=r.sourceEvent)==null?void 0:a.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=i,((l=r.sourceEvent)==null?void 0:l.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,i))}}function OBe({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return s=>{var a,l;e.usedRightMouseButton=!!(n&&Xde(t,e.mouseButton??0)),(a=s.sourceEvent)!=null&&a.sync||r([s.transform.x,s.transform.y,s.transform.k]),i&&!((l=s.sourceEvent)!=null&&l.internal)&&(i==null||i(s.sourceEvent,dj(s.transform)))}}function xBe({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:s}){return a=>{var l;if(!((l=a.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,s&&Xde(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&s(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){const c=dj(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i==null||i(a.sourceEvent,c)},n?150:0)}}}function vBe({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:d}){return f=>{var y;const h=e||t,m=n&&f.ctrlKey,g=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(Vb(f,`${u}-flow__node`)||Vb(f,`${u}-flow__edge`)))return!0;if(!r&&!h&&!i&&!s&&!n||a||d&&!g||Vb(f,l)&&g||Vb(f,c)&&(!g||i&&g&&!e)||!n&&f.ctrlKey&&g)return!1;if(!n&&f.type==="touchstart"&&((y=f.touches)==null?void 0:y.length)>1)return f.preventDefault(),!1;if(!h&&!i&&!m&&g||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const b=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||g)&&b}}function wBe({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:s,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),f=vde().scaleExtent([t,n]).translateExtent(r),h=Tl(e).call(f);v({x:i.x,y:i.y,zoom:s1(i.zoom,t,n)},[[0,0],[d.width,d.height]],r);const m=h.on("wheel.zoom"),g=h.on("dblclick.zoom");f.wheelDelta(Gde);async function b(A,j){return h?new Promise(L=>{f==null||f.interpolate((j==null?void 0:j.interpolate)==="linear"?_v:Z_).transform(P5(h,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>L(!0)),A)}):!1}function y({noWheelClassName:A,noPanClassName:j,onPaneContextMenu:L,userSelectionActive:I,panOnScroll:M,panOnDrag:N,panOnScrollMode:D,panOnScrollSpeed:Q,preventScrolling:F,zoomOnPinch:$,zoomOnScroll:H,zoomOnDoubleClick:z,zoomActivationKeyPressed:B,lib:V,onTransformChange:Z,connectionInProgress:ce,paneClickDistance:be,selectionOnDrag:ie}){I&&!u.isZoomingOrPanning&&O();const q=M&&!B&&!I;f.clickDistance(ie?1/0:!cu(be)||be<0?0:be);const X=q?gBe({zoomPanValues:u,noWheelClassName:A,d3Selection:h,d3Zoom:f,panOnScrollMode:D,panOnScrollSpeed:Q,zoomOnPinch:$,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:l}):bBe({noWheelClassName:A,preventScrolling:F,d3ZoomHandler:m});h.on("wheel.zoom",X,{passive:!1});const K=yBe({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});f.on("start",K);const de=OBe({zoomPanValues:u,panOnDrag:N,onPaneContextMenu:!!L,onPanZoom:s,onTransformChange:Z});f.on("zoom",de);const xe=xBe({zoomPanValues:u,panOnDrag:N,panOnScroll:M,onPaneContextMenu:L,onPanZoomEnd:l,onDraggingChange:c});f.on("end",xe);const Me=vBe({zoomActivationKeyPressed:B,panOnDrag:N,zoomOnScroll:H,panOnScroll:M,zoomOnDoubleClick:z,zoomOnPinch:$,userSelectionActive:I,noPanClassName:j,noWheelClassName:A,lib:V,connectionInProgress:ce});f.filter(Me),z?h.on("dblclick.zoom",g):h.on("dblclick.zoom",null)}function O(){f.on("zoom",null)}async function v(A,j,L){const I=D5(A),M=f==null?void 0:f.constrain()(I,j,L);return M&&await b(M),M}async function x(A,j){const L=D5(A);return await b(L,j),L}function w(A){if(h){const j=D5(A),L=h.property("__zoom");(L.k!==A.zoom||L.x!==A.x||L.y!==A.y)&&(f==null||f.transform(h,j,null,{sync:!0}))}}function S(){const A=h?xde(h.node()):{x:0,y:0,k:1};return{x:A.x,y:A.y,zoom:A.k}}async function E(A,j){return h?new Promise(L=>{f==null||f.interpolate((j==null?void 0:j.interpolate)==="linear"?_v:Z_).scaleTo(P5(h,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>L(!0)),A)}):!1}async function k(A,j){return h?new Promise(L=>{f==null||f.interpolate((j==null?void 0:j.interpolate)==="linear"?_v:Z_).scaleBy(P5(h,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>L(!0)),A)}):!1}function _(A){f==null||f.scaleExtent(A)}function C(A){f==null||f.translateExtent(A)}function T(A){const j=!cu(A)||A<0?0:A;f==null||f.clickDistance(j)}return{update:y,destroy:O,setViewport:x,setViewportConstrained:v,getViewport:S,scaleTo:E,scaleBy:k,setScaleExtent:_,setTranslateExtent:C,syncViewport:w,setClickDistance:T}}var l1;(function(e){e.Line="line",e.Handle="handle"})(l1||(l1={}));function SBe({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:s}){const a=e-t,l=n-r,c=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&i&&(c[0]=c[0]*-1),l&&s&&(c[1]=c[1]*-1),c}function Vq(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),i=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:i}}function Lh(e,t){return Math.max(0,t-e)}function $h(e,t){return Math.max(0,e-t)}function l2(e,t,n){return Math.max(0,t-e,e-n)}function Hq(e,t){return e?!t:t}function EBe(e,t,n,r,i,s,a,l){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:f}=t,h=d&&f,{xSnapped:m,ySnapped:g}=n,{minWidth:b,maxWidth:y,minHeight:O,maxHeight:v}=r,{x,y:w,width:S,height:E,aspectRatio:k}=e;let _=Math.floor(d?m-e.pointerX:0),C=Math.floor(f?g-e.pointerY:0);const T=S+(c?-_:_),A=E+(u?-C:C),j=-s[0]*S,L=-s[1]*E;let I=l2(T,b,y),M=l2(A,O,v);if(a){let Q=0,F=0;c&&_<0?Q=Lh(x+_+j,a[0][0]):!c&&_>0&&(Q=$h(x+T+j,a[1][0])),u&&C<0?F=Lh(w+C+L,a[0][1]):!u&&C>0&&(F=$h(w+A+L,a[1][1])),I=Math.max(I,Q),M=Math.max(M,F)}if(l){let Q=0,F=0;c&&_>0?Q=$h(x+_,l[0][0]):!c&&_<0&&(Q=Lh(x+T,l[1][0])),u&&C>0?F=$h(w+C,l[0][1]):!u&&C<0&&(F=Lh(w+A,l[1][1])),I=Math.max(I,Q),M=Math.max(M,F)}if(i){if(d){const Q=l2(T/k,O,v)*k;if(I=Math.max(I,Q),a){let F=0;!c&&!u||c&&!u&&h?F=$h(w+L+T/k,a[1][1])*k:F=Lh(w+L+(c?_:-_)/k,a[0][1])*k,I=Math.max(I,F)}if(l){let F=0;!c&&!u||c&&!u&&h?F=Lh(w+T/k,l[1][1])*k:F=$h(w+(c?_:-_)/k,l[0][1])*k,I=Math.max(I,F)}}if(f){const Q=l2(A*k,b,y)/k;if(M=Math.max(M,Q),a){let F=0;!c&&!u||u&&!c&&h?F=$h(x+A*k+j,a[1][0])/k:F=Lh(x+(u?C:-C)*k+j,a[0][0])/k,M=Math.max(M,F)}if(l){let F=0;!c&&!u||u&&!c&&h?F=Lh(x+A*k,l[1][0])/k:F=$h(x+(u?C:-C)*k,l[0][0])/k,M=Math.max(M,F)}}}C=C+(C<0?M:-M),_=_+(_<0?I:-I),i&&(h?T>A*k?C=(Hq(c,u)?-_:_)/k:_=(Hq(c,u)?-C:C)*k:d?(C=_/k,u=c):(_=C*k,c=u));const N=c?x+_:x,D=u?w+C:w;return{width:S+(c?-_:_),height:E+(u?-C:C),x:s[0]*_*(c?-1:1)+N,y:s[1]*C*(u?-1:1)+D}}const Wde={width:0,height:0,x:0,y:0},kBe={...Wde,pointerX:0,pointerY:0,aspectRatio:1};function _Be(e,t,n){const r=t.position.x+e.position.x,i=t.position.y+e.position.y,s=e.measured.width??0,a=e.measured.height??0,l=n[0]*s,c=n[1]*a;return[[r-l,i-c],[r+s-l,i+a-c]]}function TBe({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){const s=Tl(e);let a={controlDirection:Vq("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:u,boundaries:d,keepAspectRatio:f,resizeDirection:h,onResizeStart:m,onResize:g,onResizeEnd:b,shouldResize:y}){let O={...Wde},v={...kBe};a={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:Vq(u)};let x,w=null,S=[],E,k,_,C=!1;const T=sde().on("start",A=>{const{nodeLookup:j,transform:L,snapGrid:I,snapToGrid:M,nodeOrigin:N,paneDomNode:D}=n();if(x=j.get(t),!x)return;w=(D==null?void 0:D.getBoundingClientRect())??null;const{xSnapped:Q,ySnapped:F}=Tv(A.sourceEvent,{transform:L,snapGrid:I,snapToGrid:M,containerBounds:w});O={width:x.measured.width??0,height:x.measured.height??0,x:x.position.x??0,y:x.position.y??0},v={...O,pointerX:Q,pointerY:F,aspectRatio:O.width/O.height},E=void 0,k=Ug(x.extent)?x.extent:void 0,x.parentId&&(x.extent==="parent"||x.expandParent)&&(E=j.get(x.parentId)),E&&x.extent==="parent"&&(k=[[0,0],[E.measured.width,E.measured.height]]),S=[],_=void 0;for(const[$,H]of j)if(H.parentId===t&&(S.push({id:$,position:{...H.position},extent:H.extent}),H.extent==="parent"||H.expandParent)){const z=_Be(H,x,H.origin??N);_?_=[[Math.min(z[0][0],_[0][0]),Math.min(z[0][1],_[0][1])],[Math.max(z[1][0],_[1][0]),Math.max(z[1][1],_[1][1])]]:_=z}m==null||m(A,{...O})}).on("drag",A=>{const{transform:j,snapGrid:L,snapToGrid:I,nodeOrigin:M}=n(),N=Tv(A.sourceEvent,{transform:j,snapGrid:L,snapToGrid:I,containerBounds:w}),D=[];if(!x)return;const{x:Q,y:F,width:$,height:H}=O,z={},B=x.origin??M,{width:V,height:Z,x:ce,y:be}=EBe(v,a.controlDirection,N,a.boundaries,a.keepAspectRatio,B,k,_),ie=V!==$,q=Z!==H,X=ce!==Q&&ie,K=be!==F&&q;if(!X&&!K&&!ie&&!q)return;if((X||K||B[0]===1||B[1]===1)&&(z.x=X?ce:O.x,z.y=K?be:O.y,O.x=z.x,O.y=z.y,S.length>0)){const Ae=ce-Q,He=be-F;for(const et of S)et.position={x:et.position.x-Ae+B[0]*(V-$),y:et.position.y-He+B[1]*(Z-H)},D.push(et)}if((ie||q)&&(z.width=ie&&(!a.resizeDirection||a.resizeDirection==="horizontal")?V:O.width,z.height=q&&(!a.resizeDirection||a.resizeDirection==="vertical")?Z:O.height,O.width=z.width,O.height=z.height),E&&x.expandParent){const Ae=B[0]*(z.width??0);z.x&&z.x{C&&(b==null||b(A,{...O}),i==null||i({...O}),C=!1)});s.call(T)}function c(){s.on(".drag",null)}return{update:l,destroy:c}}var Yde={exports:{}},Zde={},Kde={exports:{}},Jde={};/** +`)},VPe=0,q0=[];function HPe(e){var t=p.useRef([]),n=p.useRef([0,0]),r=p.useRef(),i=p.useState(VPe++)[0],s=p.useState(uce)[0],a=p.useRef(e);p.useEffect(function(){a.current=e},[e]),p.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var b=fPe([e.lockRef.current],(e.shards||[]).map(XH),!0).filter(Boolean);return b.forEach(function(y){return y.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),b.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var l=p.useCallback(function(b,y){if("touches"in b&&b.touches.length===2||b.type==="wheel"&&b.ctrlKey)return!a.current.allowPinchZoom;var O=Kk(b),v=n.current,x="deltaX"in b?b.deltaX:v[0]-O[0],w="deltaY"in b?b.deltaY:v[1]-O[1],S,E=b.target,k=Math.abs(x)>Math.abs(w)?"h":"v";if("touches"in b&&k==="h"&&E.type==="range")return!1;var _=window.getSelection(),T=_&&_.anchorNode,C=T?T===E||T.contains(E):!1;if(C)return!1;var A=HH(k,E);if(!A)return!0;if(A?S=k:(S=k==="v"?"h":"v",A=HH(k,E)),!A)return!1;if(!r.current&&"changedTouches"in b&&(x||w)&&(r.current=S),!S)return!0;var j=r.current||S;return UPe(j,y,b,j==="h"?x:w)},[]),c=p.useCallback(function(b){var y=b;if(!(!q0.length||q0[q0.length-1]!==s)){var O="deltaY"in y?qH(y):Kk(y),v=t.current.filter(function(S){return S.name===y.type&&(S.target===y.target||y.target===S.shadowParent)&&FPe(S.delta,O)})[0];if(v&&v.should){y.cancelable&&y.preventDefault();return}if(!v){var x=(a.current.shards||[]).map(XH).filter(Boolean).filter(function(S){return S.contains(y.target)}),w=x.length>0?l(y,x[0]):!a.current.noIsolation;w&&y.cancelable&&y.preventDefault()}}},[]),u=p.useCallback(function(b,y,O,v){var x={name:b,delta:y,target:O,should:v,shadowParent:qPe(O)};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(w){return w!==x})},1)},[]),d=p.useCallback(function(b){n.current=Kk(b),r.current=void 0},[]),f=p.useCallback(function(b){u(b.type,qH(b),b.target,l(b,e.lockRef.current))},[]),h=p.useCallback(function(b){u(b.type,Kk(b),b.target,l(b,e.lockRef.current))},[]);p.useEffect(function(){return q0.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,H0),document.addEventListener("touchmove",c,H0),document.addEventListener("touchstart",d,H0),function(){q0=q0.filter(function(b){return b!==s}),document.removeEventListener("wheel",c,H0),document.removeEventListener("touchmove",c,H0),document.removeEventListener("touchstart",d,H0)}},[]);var m=e.removeScrollBar,g=e.inert;return p.createElement(p.Fragment,null,g?p.createElement(s,{styles:zPe(i)}):null,m?p.createElement(DPe,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function qPe(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const XPe=vPe(cce,HPe);var M9=p.forwardRef(function(e,t){return p.createElement(FN,Yu({},e,{ref:t,sideCar:XPe}))});M9.classNames=FN.classNames;var GPe=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},X0=new WeakMap,Jk=new WeakMap,e2={},S5=0,pce=function(e){return e&&(e.host||pce(e.parentNode))},WPe=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=pce(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},YPe=function(e,t,n,r){var i=WPe(t,Array.isArray(e)?e:[e]);e2[n]||(e2[n]=new WeakMap);var s=e2[n],a=[],l=new Set,c=new Set(i),u=function(f){!f||l.has(f)||(l.add(f),u(f.parentNode))};i.forEach(u);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(h){if(l.has(h))d(h);else try{var m=h.getAttribute(r),g=m!==null&&m!=="false",b=(X0.get(h)||0)+1,y=(s.get(h)||0)+1;X0.set(h,b),s.set(h,y),a.push(h),b===1&&g&&Jk.set(h,!0),y===1&&h.setAttribute(n,"true"),g||h.setAttribute(r,"true")}catch(O){console.error("aria-hidden: cannot operate on ",h,O)}})};return d(t),l.clear(),S5++,function(){a.forEach(function(f){var h=X0.get(f)-1,m=s.get(f)-1;X0.set(f,h),s.set(f,m),h||(Jk.has(f)||f.removeAttribute(r),Jk.delete(f)),m||f.removeAttribute(n)}),S5--,S5||(X0=new WeakMap,X0=new WeakMap,Jk=new WeakMap,e2={})}},mce=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=GPe(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),YPe(r,i,n,"aria-hidden")):function(){return null}},ZPe=Object.defineProperty,KPe=(e,t)=>ZPe(e,"name",{value:t,configurable:!0});function eE(e){const[t,n]=p.useState(void 0);return Dc(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let a,l;if("borderBoxSize"in s){const c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;a=u.inlineSize,l=u.blockSize}else a=e.offsetWidth,l=e.offsetHeight;n({width:a,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}KPe(eE,"useSize");var JPe=Object.defineProperty,th=(e,t)=>JPe(e,"name",{value:t,configurable:!0}),L9="Checkbox",[e3e,aMt]=nl(L9),[t3e,$9]=e3e(L9);function gce(e){const{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:s,form:a,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[h,m]=Qc({prop:n,defaultProp:i??!1,onChange:c,caller:L9}),[g,b]=p.useState(null),[y,O]=p.useState(null),v=p.useRef(!1),[x,w]=p.useReducer(k=>k+1,0),S=g?!!a||!!g.closest("form"):!0,E={checked:h,disabled:s,setChecked:m,control:g,setControl:b,name:l,form:a,value:d,hasConsumerStoppedPropagationRef:v,userInteractionCount:x,onUserInteraction:w,required:u,defaultChecked:Pf(i)?!1:i,isFormControl:S,bubbleInput:y,setBubbleInput:O};return o.jsx(t3e,{scope:t,...E,children:bce(f)?f(E):r})}th(gce,"CheckboxProvider");var n3e="CheckboxTrigger",r3e=p.forwardRef(th(function({__scopeCheckbox:t,onKeyDown:n,onClick:r,...i},s){const{control:a,value:l,disabled:c,checked:u,required:d,setControl:f,setChecked:h,hasConsumerStoppedPropagationRef:m,onUserInteraction:g,isFormControl:b,bubbleInput:y}=$9(n3e,t),O=Vr(s,f),v=p.useRef(u);return p.useEffect(()=>{const x=a==null?void 0:a.form;if(x){const w=th(()=>h(v.current),"reset");return x.addEventListener("reset",w),()=>x.removeEventListener("reset",w)}},[a,h]),o.jsx(bi.button,{type:"button",role:"checkbox","aria-checked":Pf(u)?"mixed":u,"aria-required":d,"data-state":B9(u),"data-disabled":c?"":void 0,disabled:c,value:l,...i,ref:O,onKeyDown:fn(n,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:fn(r,x=>{g(),h(w=>Pf(w)?!0:!w),y&&b&&(m.current=x.isPropagationStopped(),m.current||x.stopPropagation())})})},"CheckboxTrigger")),i3e=p.forwardRef(th(function(t,n){const{__scopeCheckbox:r,name:i,checked:s,defaultChecked:a,required:l,disabled:c,value:u,onCheckedChange:d,form:f,...h}=t;return o.jsx(gce,{__scopeCheckbox:r,checked:s,defaultChecked:a,disabled:c,required:l,onCheckedChange:d,name:i,form:f,value:u,internal_do_not_use_render:({isFormControl:m})=>o.jsxs(o.Fragment,{children:[o.jsx(r3e,{...h,ref:n,__scopeCheckbox:r}),m&&o.jsx(l3e,{__scopeCheckbox:r})]})})},"Checkbox")),s3e="CheckboxIndicator",a3e=p.forwardRef(th(function(t,n){const{__scopeCheckbox:r,forceMount:i,...s}=t,a=$9(s3e,r);return o.jsx(_d,{present:i||Pf(a.checked)||a.checked===!0,children:o.jsx(bi.span,{"data-state":B9(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:n,style:{pointerEvents:"none",...t.style}})})},"CheckboxIndicator")),o3e="CheckboxBubbleInput",l3e=p.forwardRef(th(function({__scopeCheckbox:t,onClick:n,...r},i){const{control:s,hasConsumerStoppedPropagationRef:a,userInteractionCount:l,checked:c,defaultChecked:u,required:d,disabled:f,name:h,value:m,form:g,bubbleInput:b,setBubbleInput:y}=$9(o3e,t),O=Vr(i,y),v=eE(s),x=p.useRef(!1),w=p.useRef(c),S=p.useRef(l);p.useEffect(()=>{const k=b;if(!k)return;const _=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(_,"checked").set,A=l!==S.current;S.current=l;const j=w.current!==c;w.current=c;const M=!(A&&a.current);if(j&&C){x.current=!A;const I=new Event("click",{bubbles:M});k.indeterminate=Pf(c),C.call(k,Pf(c)?!1:c),k.dispatchEvent(I),x.current=!1}},[b,c,a,l]);const E=p.useRef(Pf(c)?!1:c);return o.jsx(bi.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??E.current,required:d,disabled:f,name:h,value:m,form:g,...r,tabIndex:-1,ref:O,onClick:fn(n,k=>{x.current&&k.stopPropagation()}),style:{...r.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function bce(e){return typeof e=="function"}th(bce,"isFunction");function Pf(e){return e==="indeterminate"}th(Pf,"isIndeterminate");function B9(e){return Pf(e)?"indeterminate":e?"checked":"unchecked"}th(B9,"getState");const c3e=["top","right","bottom","left"],zp=Math.min,Mf=Math.max,SC=Math.round,t2=Math.floor,Lf=e=>({x:e,y:e}),u3e={left:"right",right:"left",bottom:"top",top:"bottom"};function yce(e,t,n){return Mf(e,zp(t,n))}function nh(e,t){return typeof e=="function"?e(t):e}function Vp(e){return e.split("-")[0]}function X1(e){return e.split("-")[1]}function Q9(e){return e==="x"?"y":"x"}function U9(e){return e==="y"?"height":"width"}function rd(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function F9(e){return Q9(rd(e))}function d3e(e,t,n){n===void 0&&(n=!1);const r=X1(e),i=F9(e),s=U9(i);let a=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=EC(a)),[a,EC(a)]}function f3e(e){const t=EC(e);return[h4(e),t,h4(t)]}function h4(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const GH=["left","right"],WH=["right","left"],h3e=["top","bottom"],p3e=["bottom","top"];function m3e(e,t,n){switch(e){case"top":case"bottom":return n?t?WH:GH:t?GH:WH;case"left":case"right":return t?h3e:p3e;default:return[]}}function g3e(e,t,n,r){const i=X1(e);let s=m3e(Vp(e),n==="start",r);return i&&(s=s.map(a=>a+"-"+i),t&&(s=s.concat(s.map(h4)))),s}function EC(e){const t=Vp(e);return u3e[t]+e.slice(t.length)}function b3e(e){var t,n,r,i;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(i=e.left)!=null?i:0}}function Oce(e){return typeof e!="number"?b3e(e):{top:e,right:e,bottom:e,left:e}}function kC(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function YH(e,t,n){let{reference:r,floating:i}=e;const s=rd(t),a=F9(t),l=U9(a),c=Vp(t),u=s==="y",d=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,h=r[l]/2-i[l]/2;let m;switch(c){case"top":m={x:d,y:r.y-i.height};break;case"bottom":m={x:d,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:f};break;case"left":m={x:r.x-i.width,y:f};break;default:m={x:r.x,y:r.y}}const g=X1(t);return g&&(m[a]+=h*(g==="end"?1:-1)*(n&&u?-1:1)),m}async function y3e(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:a,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:h=!1,padding:m=0}=nh(t,e),g=Oce(m),y=l[h?f==="floating"?"reference":"floating":f],O=kC(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),v=f==="floating"?{x:r,y:i,width:a.floating.width,height:a.floating.height}:a.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),w=await(s.isElement==null?void 0:s.isElement(x))&&await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1},S=kC(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:x,strategy:c}):v);return{top:(O.top-S.top+g.top)/w.y,bottom:(S.bottom-O.bottom+g.bottom)/w.y,left:(O.left-S.left+g.left)/w.x,right:(S.right-O.right+g.right)/w.x}}const O3e=50,x3e=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:y3e},c=await(a.isRTL==null?void 0:a.isRTL(t));let u=await a.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:f}=YH(u,r,c),h=r,m=0;const g={};for(let b=0;b({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:a,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=nh(e,t)||{};if(u==null)return{};const f=Oce(d),h={x:n,y:r},m=F9(i),g=U9(m),b=await a.getDimensions(u),y=m==="y",O=y?"top":"left",v=y?"bottom":"right",x=y?"clientHeight":"clientWidth",w=s.reference[g]+s.reference[m]-h[m]-s.floating[g],S=h[m]-s.reference[m],E=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let k=E?E[x]:0;(!k||!await(a.isElement==null?void 0:a.isElement(E)))&&(k=l.floating[x]||s.floating[g]);const _=w/2-S/2,T=k/2-b[g]/2-1,C=zp(f[O],T),A=zp(f[v],T),j=k-b[g]-A,M=k/2-b[g]/2+_,I=yce(C,M,j),$=!c.arrow&&X1(i)!=null&&M!==I&&s.reference[g]/2-(MI<=0)){var A,j;const I=(((A=s.flip)==null?void 0:A.index)||0)+1,$=k[I];if($&&(!(f==="alignment"?v!==rd($):!1)||C.every(Q=>rd(Q.placement)===v?Q.overflows[0]>0:!0)))return{data:{index:I,overflows:C},reset:{placement:$}};let N=(j=C.filter(D=>D.overflows[0]<=0).sort((D,Q)=>D.overflows[1]-Q.overflows[1])[0])==null?void 0:j.placement;if(!N)switch(m){case"bestFit":{var M;const D=(M=C.filter(Q=>{if(E){const F=rd(Q.placement);return F===v||F==="y"}return!0}).map(Q=>[Q.placement,Q.overflows.filter(F=>F>0).reduce((F,L)=>F+L,0)]).sort((Q,F)=>Q[1]-F[1])[0])==null?void 0:M[0];D&&(N=D);break}case"initialPlacement":N=l;break}if(i!==N)return{reset:{placement:N}}}return{}}}};function ZH(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function KH(e){return c3e.some(t=>e[t]>=0)}const S3e=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=nh(e,t);switch(i){case"referenceHidden":{const a=await r.detectOverflow(t,{...s,elementContext:"reference"}),l=ZH(a,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:KH(l)}}}case"escaped":{const a=await r.detectOverflow(t,{...s,altBoundary:!0}),l=ZH(a,n.floating);return{data:{escapedOffsets:l,escaped:KH(l)}}}default:return{}}}}},xce=new Set(["left","top"]);async function E3e(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),a=Vp(n),l=X1(n),c=rd(n)==="y",u=xce.has(a)?-1:1,d=s&&c?-1:1,f=nh(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof g=="number"&&(m=l==="end"?g*-1:g),c?{x:m*d,y:h*u}:{x:h*u,y:m*d}}const k3e=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:a,middlewareData:l}=t,c=await E3e(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:a}}}}},_3e=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:c={fn:v=>{let{x,y:w}=v;return{x,y:w}}},...u}=nh(e,t),d={x:n,y:r},f=await s.detectOverflow(t,u),h=rd(i),m=Q9(h);let g=d[m],b=d[h];const y=(v,x)=>yce(x+f[v==="y"?"top":"left"],x,x-f[v==="y"?"bottom":"right"]);a&&(g=y(m,g)),l&&(b=y(h,b));const O=c.fn({...t,[m]:g,[h]:b});return{...O,data:{x:O.x-n,y:O.y-r,enabled:{[m]:a,[h]:l}}}}}},T3e=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:i,y:s,placement:a,rects:l,middlewareData:c}=t,{offset:u=0,mainAxis:d=!0,crossAxis:f=!0}=nh(e,t),h={x:i,y:s},m=rd(a),g=Q9(m);let b=h[g],y=h[m];const O=nh(u,t),v=typeof O=="number"?{mainAxis:O,crossAxis:0}:{mainAxis:(n=O.mainAxis)!=null?n:0,crossAxis:(r=O.crossAxis)!=null?r:0};if(d){const S=g==="y"?"height":"width",E=l.reference[g]-l.floating[S]+v.mainAxis,k=l.reference[g]+l.reference[S]-v.mainAxis;bk&&(b=k)}if(f){var x,w;const S=g==="y"?"width":"height",E=xce.has(Vp(a)),k=l.reference[m]-l.floating[S]+(E&&((x=c.offset)==null?void 0:x[m])||0)+(E?0:v.crossAxis),_=l.reference[m]+l.reference[S]+(E?0:((w=c.offset)==null?void 0:w[m])||0)-(E?v.crossAxis:0);y_&&(y=_)}return{[g]:b,[m]:y}}}},C3e=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:i,elements:s}=t,{apply:a=()=>{},...l}=nh(e,t),c=await i.detectOverflow(t,l),u=Vp(n),d=X1(n),f=rd(n)==="y",{width:h,height:m}=r.floating;let g,b;u==="top"||u==="bottom"?(g=u,b=d===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(b=u,g=d==="end"?"top":"bottom");const y=m-c.top-c.bottom,O=h-c.left-c.right,v=zp(m-c[g],y),x=zp(h-c[b],O),w=t.middlewareData.shift,S=!w;let E=v,k=x;w!=null&&w.enabled.x&&(k=O),w!=null&&w.enabled.y&&(E=y),S&&!d&&(f?k=h-2*Mf(c.left,c.right):E=m-2*Mf(c.top,c.bottom)),await a({...t,availableWidth:k,availableHeight:E});const _=await i.getDimensions(s.floating);return h!==_.width||m!==_.height?{reset:{rects:!0}}:{}}}};function zN(){return typeof window<"u"}function G1(e){return vce(e)?(e.nodeName||"").toLowerCase():"#document"}function Wa(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function mh(e){var t;return(t=(vce(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function vce(e){return zN()?e instanceof Node||e instanceof Wa(e).Node:!1}function bd(e){return zN()?e instanceof Element||e instanceof Wa(e).Element:!1}function Td(e){return zN()?e instanceof HTMLElement||e instanceof Wa(e).HTMLElement:!1}function JH(e){return!zN()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Wa(e).ShadowRoot}function VN(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=yd(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function A3e(e){return/^(table|td|th)$/.test(G1(e))}function HN(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const N3e=/transform|translate|scale|rotate|perspective|filter/,j3e=/paint|layout|strict|content/,km=e=>!!e&&e!=="none";let E5;function z9(e){const t=bd(e)?yd(e):e;return km(t.transform)||km(t.translate)||km(t.scale)||km(t.rotate)||km(t.perspective)||!V9()&&(km(t.backdropFilter)||km(t.filter))||N3e.test(t.willChange||"")||j3e.test(t.contain||"")}function R3e(e){let t=Mg(e);for(;Td(t)&&!kw(t);){if(z9(t))return t;if(HN(t))return null;t=Mg(t)}return null}function V9(){return E5==null&&(E5=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),E5}function kw(e){return/^(html|body|#document)$/.test(G1(e))}function yd(e){return Wa(e).getComputedStyle(e)}function qN(e){return bd(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Mg(e){if(G1(e)==="html")return e;const t=e.assignedSlot||e.parentNode||JH(e)&&e.host||mh(e);return JH(t)?t.host:t}function wce(e){const t=Mg(e);return kw(t)?(e.ownerDocument||e).body:Td(t)&&VN(t)?t:wce(t)}function _w(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=wce(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),a=Wa(i);if(s){const l=p4(a);return t.concat(a,a.visualViewport||[],VN(i)?i:[],l&&n?_w(l):[])}else return t.concat(i,_w(i,[],n))}function p4(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Sce(e){const t=yd(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Td(e),s=i?e.offsetWidth:n,a=i?e.offsetHeight:r,l=SC(n)!==s||SC(r)!==a;return l&&(n=s,r=a),{width:n,height:r,$:l}}function H9(e){return bd(e)?e:e.contextElement}function py(e){const t=H9(e);if(!Td(t))return Lf(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=Sce(t);let a=(s?SC(n.width):n.width)/r,l=(s?SC(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const I3e=Lf(0);function Ece(e){const t=Wa(e);return!V9()||!t.visualViewport?I3e:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function D3e(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Wa(e)}function Lg(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=H9(e);let a=Lf(1);t&&(r?bd(r)&&(a=py(r)):a=py(e));const l=D3e(s,n,r)?Ece(s):Lf(0);let c=(i.left+l.x)/a.x,u=(i.top+l.y)/a.y,d=i.width/a.x,f=i.height/a.y;if(s&&r){const h=Wa(s),m=bd(r)?Wa(r):r;let g=h,b=p4(g);for(;b&&m!==g;){const y=py(b),O=b.getBoundingClientRect(),v=yd(b),x=O.left+(b.clientLeft+parseFloat(v.paddingLeft))*y.x,w=O.top+(b.clientTop+parseFloat(v.paddingTop))*y.y;c*=y.x,u*=y.y,d*=y.x,f*=y.y,c+=x,u+=w,g=Wa(b),b=p4(g)}}return kC({width:d,height:f,x:c,y:u})}function XN(e,t){const n=qN(e).scrollLeft;return t?t.left+n:Lg(mh(e)).left+n}function kce(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-XN(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function P3e(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",a=mh(r),l=t?HN(t.floating):!1;if(r===a||l&&s)return n;let c={scrollLeft:0,scrollTop:0},u=Lf(1);const d=Lf(0),f=Td(r);if((f||!s)&&((G1(r)!=="body"||VN(a))&&(c=qN(r)),f)){const m=Lg(r);u=py(r),d.x=m.x+r.clientLeft,d.y=m.y+r.clientTop}const h=a&&!f&&!s?kce(a,c):Lf(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+h.x,y:n.y*u.y-c.scrollTop*u.y+d.y+h.y}}function M3e(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function L3e(e){const t=qN(e),n=e.ownerDocument.body,r=Mf(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Mf(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-t.scrollLeft+XN(e);const a=-t.scrollTop;return yd(n).direction==="rtl"&&(s+=Mf(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:s,y:a}}const $3e=25;function B3e(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",i=Wa(e),s=mh(e),a=i.visualViewport;let l=s.clientWidth,c=s.clientHeight,u=0,d=0;if(a){const h=!V9()||t==="fixed";r?h||(u=-a.offsetLeft,d=-a.offsetTop):(l=a.width,c=a.height,h&&(u=a.offsetLeft,d=a.offsetTop))}if(XN(s)<=0){const h=s.ownerDocument,m=h.body,g=getComputedStyle(m),b=h.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,y=Math.abs(s.clientWidth-m.clientWidth-b),O=getComputedStyle(s).scrollbarGutter==="stable both-edges"?y/2:y;O<=$3e&&(l-=O)}return{width:l,height:c,x:u,y:d}}function Q3e(e,t){const n=Lg(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=py(e),a=e.clientWidth*s.x,l=e.clientHeight*s.y,c=i*s.x,u=r*s.y;return{width:a,height:l,x:c,y:u}}function eq(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=B3e(e,n,t);else if(t==="document")r=L3e(mh(e));else if(bd(t))r=Q3e(t,n);else{const i=Ece(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return kC(r)}function U3e(e,t){const n=t.get(e);if(n)return n;let r=_w(e,[],!1).filter(l=>bd(l)&&G1(l)!=="body"),i=null;const s=yd(e).position==="fixed";let a=s?Mg(e):e;for(;bd(a)&&!kw(a);){const l=yd(a),c=z9(a),u=i?i.position:s?"fixed":"";!c&&(u==="fixed"||u==="absolute"&&l.position==="static")?r=r.filter(f=>f!==a):i=l,a=Mg(a)}return t.set(e,r),r}function F3e(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const a=[...n==="clippingAncestors"?HN(t)?[]:U3e(t,this._c):[].concat(n),r],l=eq(t,a[0],i);let c=l.top,u=l.right,d=l.bottom,f=l.left;for(let h=1;h{l(!1,1e-7)},1e3)}k=!1}try{r=new IntersectionObserver(_,{...E,root:s.ownerDocument})}catch{r=new IntersectionObserver(_,E)}r.observe(e)}const c=Wa(e),u=()=>l(n);return c.addEventListener("resize",u),l(!0),()=>{c.removeEventListener("resize",u),a()}}function W3e(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=H9(e),d=i||s?[...u?_w(u):[],...t?_w(t):[]]:[];d.forEach(O=>{i&&O.addEventListener("scroll",n),s&&O.addEventListener("resize",n)});const f=u&&l?G3e(u,n,s):null;let h=-1,m=null;a&&(m=new ResizeObserver(O=>{let[v]=O;v&&v.target===u&&m&&t&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var x;(x=m)==null||x.observe(t)})),n()}),u&&!c&&m.observe(u),t&&m.observe(t));let g,b=c?Lg(e):null;c&&y();function y(){const O=Lg(e);b&&!Tce(b,O)&&n(),b=O,g=requestAnimationFrame(y)}return n(),()=>{var O;d.forEach(v=>{i&&v.removeEventListener("scroll",n),s&&v.removeEventListener("resize",n)}),f==null||f(),(O=m)==null||O.disconnect(),m=null,c&&cancelAnimationFrame(g)}}const Y3e=k3e,Z3e=_3e,K3e=w3e,J3e=C3e,eMe=S3e,nq=v3e,tMe=T3e,nMe=(e,t,n)=>{const r=new Map,i=n??{},s={...X3e,...i.platform,_c:r};return x3e(e,t,{...i,platform:s})};var rMe=typeof document<"u",iMe=function(){},Z_=rMe?p.useLayoutEffect:iMe;function _C(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!_C(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!_C(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Cce(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function rq(e,t){const n=Cce(e);return Math.round(t*n)/n}function _5(e){const t=p.useRef(e);return Z_(()=>{t.current=e}),t}function sMe(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:a}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,m]=p.useState(r);_C(h,r)||m(r);const[g,b]=p.useState(null),[y,O]=p.useState(null),v=p.useCallback(Q=>{Q!==E.current&&(E.current=Q,b(Q))},[]),x=p.useCallback(Q=>{Q!==k.current&&(k.current=Q,O(Q))},[]),w=s||g,S=a||y,E=p.useRef(null),k=p.useRef(null),_=p.useRef(d),T=c!=null,C=_5(c),A=_5(i),j=_5(u),M=p.useCallback(()=>{if(!E.current||!k.current)return;const Q={placement:t,strategy:n,middleware:h};A.current&&(Q.platform=A.current),nMe(E.current,k.current,Q).then(F=>{const L={...F,isPositioned:j.current!==!1};I.current&&!_C(_.current,L)&&(_.current=L,Tr.flushSync(()=>{f(L)}))})},[h,t,n,A,j]);Z_(()=>{u===!1&&_.current.isPositioned&&(_.current.isPositioned=!1,f(Q=>({...Q,isPositioned:!1})))},[u]);const I=p.useRef(!1);Z_(()=>(I.current=!0,()=>{I.current=!1}),[]),Z_(()=>{if(w&&(E.current=w),S&&(k.current=S),w&&S){if(C.current)return C.current(w,S,M);M()}},[w,S,M,C,T]);const $=p.useMemo(()=>({reference:E,floating:k,setReference:v,setFloating:x}),[v,x]),N=p.useMemo(()=>({reference:w,floating:S}),[w,S]),D=p.useMemo(()=>{const Q={position:n,left:0,top:0};if(!N.floating)return Q;const F=rq(N.floating,d.x),L=rq(N.floating,d.y);return l?{...Q,transform:"translate("+F+"px, "+L+"px)",...Cce(N.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:L}},[n,l,N.floating,d.x,d.y]);return p.useMemo(()=>({...d,update:M,refs:$,elements:N,floatingStyles:D}),[d,M,$,N,D])}const aMe=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?nq({element:r.current,padding:i}).fn(n):{}:r?nq({element:r,padding:i}).fn(n):{}}}},oMe=(e,t)=>{const n=Y3e(e);return{name:n.name,fn:n.fn,options:[e,t]}},lMe=(e,t)=>{const n=Z3e(e);return{name:n.name,fn:n.fn,options:[e,t]}},cMe=(e,t)=>({fn:tMe(e).fn,options:[e,t]}),uMe=(e,t)=>{const n=K3e(e);return{name:n.name,fn:n.fn,options:[e,t]}},dMe=(e,t)=>{const n=J3e(e);return{name:n.name,fn:n.fn,options:[e,t]}},fMe=(e,t)=>{const n=eMe(e);return{name:n.name,fn:n.fn,options:[e,t]}},hMe=(e,t)=>{const n=aMe(e);return{name:n.name,fn:n.fn,options:[e,t]}};var pMe=Object.defineProperty,Cp=(e,t)=>pMe(e,"name",{value:t,configurable:!0}),Ace="Popper",[Nce,W1]=nl(Ace),[mMe,jce]=Nce(Ace),gMe=Cp(e=>{const{__scopePopper:t,children:n}=e,[r,i]=p.useState(null),[s,a]=p.useState(void 0);return o.jsx(mMe,{scope:t,anchor:r,onAnchorChange:i,placementState:s,setPlacementState:a,children:n})},"Popper"),bMe="PopperAnchor",yMe=p.forwardRef(Cp(function(t,n){const{__scopePopper:r,virtualRef:i,...s}=t,a=jce(bMe,r),l=p.useRef(null),c=a.onAnchorChange,u=p.useCallback(b=>{l.current=b,b&&c(b)},[c]),d=Vr(n,u),f=p.useRef(null);p.useEffect(()=>{if(!i)return;const b=f.current;f.current=i.current,b!==f.current&&c(f.current)});const h=a.placementState&&GN(a.placementState),m=h==null?void 0:h[0],g=h==null?void 0:h[1];return i?null:o.jsx(bi.div,{"data-radix-popper-side":m,"data-radix-popper-align":g,...s,ref:d})},"PopperAnchor")),Rce="PopperContent",[OMe,oMt]=Nce(Rce),xMe=p.forwardRef(Cp(function(t,n){var q,G,J,de,ve,Pe,Ae;const{__scopePopper:r,side:i="bottom",sideOffset:s=0,align:a="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:u=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:g="optimized",onPlaced:b,...y}=t,O=jce(Rce,r),[v,x]=p.useState(null),w=Vr(n,x),[S,E]=p.useState(null),k=eE(S),_=(k==null?void 0:k.width)??0,T=(k==null?void 0:k.height)??0,C=i+(a!=="center"?"-"+a:""),A=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},j=Array.isArray(d)?d:[d],M=j.length>0,I={padding:A,boundary:j.filter(Ice),altBoundary:M},{refs:$,floatingStyles:N,placement:D,isPositioned:Q,middlewareData:F}=sMe({strategy:"fixed",placement:C,whileElementsMounted:Cp((...Ue)=>W3e(...Ue,{animationFrame:g==="always"}),"whileElementsMounted"),elements:{reference:O.anchor},middleware:[oMe({mainAxis:s+T,alignmentAxis:l}),u&&lMe({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?cMe():void 0,...I}),u&&uMe({...I}),dMe({...I,apply:Cp(({elements:Ue,rects:Ke,availableWidth:Ce,availableHeight:Le})=>{const{width:pe,height:me}=Ke.reference,we=Ue.floating.style;we.setProperty("--radix-popper-available-width",`${Ce}px`),we.setProperty("--radix-popper-available-height",`${Le}px`),we.setProperty("--radix-popper-anchor-width",`${pe}px`),we.setProperty("--radix-popper-anchor-height",`${me}px`)},"apply")}),S&&hMe({element:S,padding:c}),vMe({arrowWidth:_,arrowHeight:T}),m&&fMe({strategy:"referenceHidden",...I,boundary:M?I.boundary:void 0})]}),L=O.setPlacementState;Dc(()=>(L(D),()=>{L(void 0)}),[D,L]);const[H,z]=GN(D),B=xu(b);Dc(()=>{Q&&(B==null||B())},[Q,B]);const V=(q=F.arrow)==null?void 0:q.x,W=(G=F.arrow)==null?void 0:G.y,le=((J=F.arrow)==null?void 0:J.centerOffset)!==0,[be,re]=p.useState();return Dc(()=>{v&&re(window.getComputedStyle(v).zIndex)},[v]),o.jsx("div",{ref:$.setFloating,"data-radix-popper-content-wrapper":"",style:{...N,transform:Q?N.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:be,"--radix-popper-transform-origin":[(de=F.transformOrigin)==null?void 0:de.x,(ve=F.transformOrigin)==null?void 0:ve.y].join(" "),...((Pe=F.hide)==null?void 0:Pe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:o.jsx(OMe,{scope:r,placedSide:H,placedAlign:z,onArrowChange:E,arrowX:V,arrowY:W,shouldHideArrow:le,children:o.jsx(bi.div,{"data-side":H,"data-align":z,...y,ref:w,style:{...y.style,animation:Q?(Ae=y.style)==null?void 0:Ae.animation:"none"}})})})},"PopperContent"));function Ice(e){return e!==null}Cp(Ice,"isNotNull");var vMe=Cp(e=>({name:"transformOrigin",options:e,fn(t){var y,O,v;const{placement:n,rects:r,middlewareData:i}=t,a=((y=i.arrow)==null?void 0:y.centerOffset)!==0,l=a?0:e.arrowWidth,c=a?0:e.arrowHeight,[u,d]=GN(n),f={start:"0%",center:"50%",end:"100%"}[d],h=(((O=i.arrow)==null?void 0:O.x)??0)+l/2,m=(((v=i.arrow)==null?void 0:v.y)??0)+c/2;let g="",b="";return u==="bottom"?(g=a?f:`${h}px`,b=`${-c}px`):u==="top"?(g=a?f:`${h}px`,b=`${r.floating.height+c}px`):u==="right"?(g=`${-c}px`,b=a?f:`${m}px`):u==="left"&&(g=`${r.floating.width+c}px`,b=a?f:`${m}px`),{data:{x:g,y:b}}}}),"transformOrigin");function GN(e){const[t,n="center"]=e.split("-");return[t,n]}Cp(GN,"getSideAndAlignFromPlacement");var WN=gMe,q9=yMe,X9=xMe,wMe=Object.defineProperty,G9=(e,t)=>wMe(e,"name",{value:t,configurable:!0}),T5=!1;function Dce(){const[e,t]=p.useState(T5);return p.useEffect(()=>{T5||(T5=!0,t(!0))},[]),e}G9(Dce,"useIsHydrated");var Pce=r0[" useSyncExternalStore ".trim().toString()];function Mce(){return()=>{}}G9(Mce,"subscribe");function Lce(){return Pce(Mce,()=>!0,()=>!1)}G9(Lce,"useIsHydratedModern");var SMe=typeof Pce=="function"?Lce:Dce,EMe=Object.defineProperty,f0=(e,t)=>EMe(e,"name",{value:t,configurable:!0}),C5="rovingFocusGroup.onEntryFocus",kMe={bubbles:!1,cancelable:!0},YN="RovingFocusGroup",[m4,$ce,_Me]=A9(YN),[TMe,Y1]=nl(YN,[_Me]),[CMe,AMe]=TMe(YN),NMe=p.forwardRef(f0(function(t,n){return o.jsx(m4.Provider,{scope:t.__scopeRovingFocusGroup,children:o.jsx(m4.Slot,{scope:t.__scopeRovingFocusGroup,children:o.jsx(jMe,{...t,ref:n})})})},"RovingFocusGroup")),jMe=p.forwardRef(f0(function(t,n){const{__scopeRovingFocusGroup:r,orientation:i,loop:s=!1,dir:a,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...h}=t,m=p.useRef(null),g=Vr(n,m),b=JS(a),[y,O]=Qc({prop:l,defaultProp:c??null,onChange:u,caller:YN}),[v,x]=p.useState(!1),w=xu(d),S=$ce(r),E=p.useRef(!1),[k,_]=p.useState(0);return p.useEffect(()=>{const T=m.current;if(T)return T.addEventListener(C5,w),()=>T.removeEventListener(C5,w)},[w]),o.jsx(CMe,{scope:r,orientation:i,dir:b,loop:s,currentTabStopId:y,onItemFocus:p.useCallback(T=>O(T),[O]),onItemShiftTab:p.useCallback(()=>x(!0),[]),onFocusableItemAdd:p.useCallback(()=>_(T=>T+1),[]),onFocusableItemRemove:p.useCallback(()=>_(T=>T-1),[]),children:o.jsx(bi.div,{tabIndex:v||k===0?-1:0,"data-orientation":i,...h,ref:g,style:{outline:"none",...t.style},onMouseDown:fn(t.onMouseDown,()=>{E.current=!0}),onFocus:fn(t.onFocus,T=>{const C=!E.current;if(T.target===T.currentTarget&&C&&!v){const A=new CustomEvent(C5,kMe);if(T.currentTarget.dispatchEvent(A),!A.defaultPrevented){const j=S().filter(D=>D.focusable),M=j.find(D=>D.active),I=j.find(D=>D.id===y),N=[M,I,...j].filter(Boolean).map(D=>D.ref.current);W9(N,f)}}E.current=!1}),onBlur:fn(t.onBlur,()=>x(!1))})})},"RovingFocusGroupImpl")),RMe="RovingFocusGroupItem",IMe=p.forwardRef(f0(function(t,n){const{__scopeRovingFocusGroup:r,focusable:i=!0,active:s=!1,tabStopId:a,children:l,...c}=t,u=Fp(),d=a||u,f=AMe(RMe,r),h=f.currentTabStopId===d,m=$ce(r),{onFocusableItemAdd:g,onFocusableItemRemove:b,currentTabStopId:y}=f,O=SMe();return Dc(()=>{if(!(!O||!i))return g(),()=>b()},[O,i,g,b]),p.useEffect(()=>{if(!(O||!i))return g(),()=>b()},[O,i,g,b]),o.jsx(m4.ItemSlot,{scope:r,id:d,focusable:i,active:s,children:o.jsx(bi.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...c,ref:n,onMouseDown:fn(t.onMouseDown,v=>{i?f.onItemFocus(d):v.preventDefault()}),onFocus:fn(t.onFocus,()=>f.onItemFocus(d)),onKeyDown:fn(t.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){f.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const x=Qce(v,f.orientation,f.dir);if(x!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let S=m().filter(E=>E.focusable).map(E=>E.ref.current);if(x==="last")S.reverse();else if(x==="prev"||x==="next"){x==="prev"&&S.reverse();const E=S.indexOf(v.currentTarget);S=f.loop?Uce(S,E+1):S.slice(E+1)}setTimeout(()=>W9(S))}}),children:typeof l=="function"?l({isCurrentTabStop:h,hasTabStop:y!=null}):l})})},"RovingFocusGroupItem")),DMe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Bce(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}f0(Bce,"getDirectionAwareKey");function Qce(e,t,n){const r=Bce(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return DMe[r]}f0(Qce,"getFocusIntent");function W9(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}f0(W9,"focusFirst");function Uce(e,t){return e.map((n,r)=>e[(t+r)%e.length])}f0(Uce,"wrapArray");var Y9=NMe,Z9=IMe,PMe=Object.defineProperty,Pr=(e,t)=>PMe(e,"name",{value:t,configurable:!0}),g4=["Enter"," "],MMe=["ArrowDown","PageUp","Home"],Fce=["ArrowUp","PageDown","End"],LMe=[...MMe,...Fce],$Me={ltr:[...g4,"ArrowRight"],rtl:[...g4,"ArrowLeft"]},BMe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ZN="Menu",[Tw,QMe,UMe]=A9(ZN),[h0,zce]=nl(ZN,[UMe,W1,Y1]),KN=W1(),Vce=Y1(),[Hce,um]=h0(ZN),[FMe,tE]=h0(ZN),zMe=Pr(e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:s,modal:a=!0}=e,l=KN(t),[c,u]=p.useState(null),d=p.useRef(!1),f=xu(s),h=JS(i);return p.useEffect(()=>{const m=Pr(()=>{d.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},"handleKeyDown"),g=Pr(()=>d.current=!1,"handlePointer");return document.addEventListener("keydown",m,{capture:!0}),()=>{document.removeEventListener("keydown",m,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),p.useEffect(()=>{if(!n)return;const m=Pr(()=>f(!1),"handleBlur");return window.addEventListener("blur",m),()=>window.removeEventListener("blur",m)},[n,f]),o.jsx(WN,{...l,children:o.jsx(Hce,{scope:t,open:n,onOpenChange:f,content:c,onContentChange:u,children:o.jsx(FMe,{scope:t,onClose:p.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:h,modal:a,children:r})})})},"Menu"),qce=p.forwardRef(Pr(function(t,n){const{__scopeMenu:r,...i}=t,s=KN(r);return o.jsx(q9,{...s,...i,ref:n})},"MenuAnchor")),Xce="MenuPortal",[VMe,Gce]=h0(Xce,{forceMount:void 0}),HMe=Pr(e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,s=um(Xce,t);return o.jsx(VMe,{scope:t,forceMount:n,children:o.jsx(_d,{present:n||s.open,children:o.jsx(D9,{asChild:!0,container:i,children:r})})})},"MenuPortal"),gu="MenuContent",[qMe,K9]=h0(gu),XMe=p.forwardRef(Pr(function(t,n){const r=Gce(gu,t.__scopeMenu),{forceMount:i=r.forceMount,...s}=t,a=um(gu,t.__scopeMenu),l=tE(gu,t.__scopeMenu);return o.jsx(Tw.Provider,{scope:t.__scopeMenu,children:o.jsx(_d,{present:i||a.open,children:o.jsx(Tw.Slot,{scope:t.__scopeMenu,children:l.modal?o.jsx(GMe,{...s,ref:n}):o.jsx(WMe,{...s,ref:n})})})})},"MenuContent")),GMe=p.forwardRef(Pr(function(t,n){const r=um(gu,t.__scopeMenu),i=p.useRef(null),s=Vr(n,i);return p.useEffect(()=>{const a=i.current;if(a)return mce(a)},[]),o.jsx(J9,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:fn(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentModal")),WMe=p.forwardRef(Pr(function(t,n){const r=um(gu,t.__scopeMenu);return o.jsx(J9,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentNonModal")),YMe=Jf("MenuContent.ScrollLock"),J9=p.forwardRef(Pr(function(t,n){const{__scopeMenu:r,loop:i=!1,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:l,disableOutsidePointerEvents:c,onEntryFocus:u,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:g,disableOutsideScroll:b,...y}=t,O=um(gu,r),v=tE(gu,r),x=KN(r),w=Vce(r),S=QMe(r),[E,k]=p.useState(null),_=p.useRef(null),T=Vr(n,_,O.onContentChange),C=p.useRef(0),A=p.useRef(""),j=p.useRef(0),M=p.useRef(null),I=p.useRef("right"),$=p.useRef(0),N=b?M9:p.Fragment,D=b?{as:YMe,allowPinchZoom:!0}:void 0,Q=Pr(L=>{var re,q;const H=A.current+L,z=S().filter(G=>!G.disabled),B=document.activeElement,V=(re=z.find(G=>G.ref.current===B))==null?void 0:re.textValue,W=z.map(G=>G.textValue),le=nue(W,H,V),be=(q=z.find(G=>G.textValue===le))==null?void 0:q.ref.current;Pr(function G(J){A.current=J,window.clearTimeout(C.current),J!==""&&(C.current=window.setTimeout(()=>G(""),1e3))},"updateSearch")(H),be&&setTimeout(()=>be.focus())},"handleTypeaheadSearch");p.useEffect(()=>()=>window.clearTimeout(C.current),[]),UN();const F=p.useCallback(L=>{var z,B;return I.current===((z=M.current)==null?void 0:z.side)&&iue(L,(B=M.current)==null?void 0:B.area)},[]);return o.jsx(qMe,{scope:r,searchRef:A,onItemEnter:p.useCallback(L=>{F(L)&&L.preventDefault()},[F]),onItemLeave:p.useCallback(L=>{var H;F(L)||((H=_.current)==null||H.focus(),k(null))},[F]),onTriggerLeave:p.useCallback(L=>{F(L)&&L.preventDefault()},[F]),pointerGraceTimerRef:j,onPointerGraceIntentChange:p.useCallback(L=>{M.current=L},[]),children:o.jsx(N,{...D,children:o.jsx(ece,{asChild:!0,trapped:s,onMountAutoFocus:fn(a,L=>{var H;L.preventDefault(),(H=_.current)==null||H.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:o.jsx(j9,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:d,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:g,children:o.jsx(Y9,{asChild:!0,...w,dir:v.dir,orientation:"vertical",loop:i,currentTabStopId:E,onCurrentTabStopIdChange:k,onEntryFocus:fn(u,L=>{v.isUsingKeyboardRef.current||L.preventDefault()}),preventScrollOnEntryFocus:!0,children:o.jsx(X9,{role:"menu","aria-orientation":"vertical","data-state":t7(O.open),"data-radix-menu-content":"",dir:v.dir,...x,...y,ref:T,style:{outline:"none",...y.style},onKeyDown:fn(y.onKeyDown,L=>{const z=L.target.closest("[data-radix-menu-content]")===L.currentTarget,B=L.ctrlKey||L.altKey||L.metaKey,V=L.key.length===1;z&&(L.key==="Tab"&&L.preventDefault(),!B&&V&&Q(L.key));const W=_.current;if(L.target!==W||!LMe.includes(L.key))return;L.preventDefault();const be=S().filter(re=>!re.disabled).map(re=>re.ref.current);Fce.includes(L.key)&&be.reverse(),eue(be)}),onBlur:fn(t.onBlur,L=>{L.currentTarget.contains(L.target)||(window.clearTimeout(C.current),A.current="")}),onPointerMove:fn(t.onPointerMove,e1(L=>{const H=L.target,z=$.current!==L.clientX;if(L.currentTarget.contains(H)&&z){const B=L.clientX>$.current?"right":"left";I.current=B,$.current=L.clientX}}))})})})})})})},"MenuContentImpl")),ZMe=p.forwardRef(Pr(function(t,n){const{__scopeMenu:r,...i}=t;return o.jsx(bi.div,{role:"group",...i,ref:n})},"MenuGroup")),b4="MenuItem",iq="menu.itemSelect",e7=p.forwardRef(Pr(function(t,n){const{disabled:r=!1,onSelect:i,...s}=t,a=p.useRef(null),l=tE(b4,t.__scopeMenu),c=K9(b4,t.__scopeMenu),u=Vr(n,a),d=p.useRef(!1),f=Pr(()=>{const h=a.current;if(!r&&h){const m=new CustomEvent(iq,{bubbles:!0,cancelable:!0});h.addEventListener(iq,g=>i==null?void 0:i(g),{once:!0}),C9(h,m),m.defaultPrevented?d.current=!1:l.onClose()}},"handleSelect");return o.jsx(Wce,{...s,ref:u,disabled:r,onClick:fn(t.onClick,f),onPointerDown:h=>{var m;(m=t.onPointerDown)==null||m.call(t,h),d.current=!0},onPointerUp:fn(t.onPointerUp,h=>{var m;d.current||(m=h.currentTarget)==null||m.click()}),onKeyDown:fn(t.onKeyDown,h=>{r||h.target!==h.currentTarget||c.searchRef.current!==""&&h.key===" "||g4.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})},"MenuItem")),Wce=p.forwardRef(Pr(function(t,n){const{__scopeMenu:r,disabled:i=!1,textValue:s,...a}=t,l=K9(b4,r),c=Vce(r),u=p.useRef(null),d=Vr(n,u),[f,h]=p.useState(!1),[m,g]=p.useState("");return p.useEffect(()=>{const b=u.current;b&&g((b.textContent??"").trim())},[a.children]),o.jsx(Tw.ItemSlot,{scope:r,disabled:i,textValue:s??m,children:o.jsx(Z9,{asChild:!0,...c,focusable:!i,children:o.jsx(bi.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":i||void 0,"data-disabled":i?"":void 0,...a,ref:d,onPointerMove:fn(t.onPointerMove,e1(b=>{i?l.onItemLeave(b):(l.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:fn(t.onPointerLeave,e1(b=>l.onItemLeave(b))),onFocus:fn(t.onFocus,()=>h(!0)),onBlur:fn(t.onBlur,()=>h(!1))})})})},"MenuItemImpl")),KMe=p.forwardRef(Pr(function(t,n){const{checked:r=!1,onCheckedChange:i,...s}=t;return o.jsx(Zce,{scope:t.__scopeMenu,checked:r,children:o.jsx(e7,{role:"menuitemcheckbox","aria-checked":Cw(r)?"mixed":r,...s,ref:n,"data-state":JN(r),onSelect:fn(s.onSelect,()=>i==null?void 0:i(Cw(r)?!0:!r),{checkForDefaultPrevented:!1})})})},"MenuCheckboxItem")),JMe="MenuRadioGroup",[e4e,t4e]=h0(JMe,{value:void 0,onValueChange:Pr(()=>{},"onValueChange")}),n4e=p.forwardRef(Pr(function(t,n){const{value:r,onValueChange:i,...s}=t,a=xu(i);return o.jsx(e4e,{scope:t.__scopeMenu,value:r,onValueChange:a,children:o.jsx(ZMe,{...s,ref:n})})},"MenuRadioGroup")),r4e="MenuRadioItem",i4e=p.forwardRef(Pr(function(t,n){const{value:r,...i}=t,s=t4e(r4e,t.__scopeMenu),a=r===s.value;return o.jsx(Zce,{scope:t.__scopeMenu,checked:a,children:o.jsx(e7,{role:"menuitemradio","aria-checked":a,...i,ref:n,"data-state":JN(a),onSelect:fn(i.onSelect,()=>{var l;return(l=s.onValueChange)==null?void 0:l.call(s,r)},{checkForDefaultPrevented:!1})})})},"MenuRadioItem")),Yce="MenuItemIndicator",[Zce,s4e]=h0(Yce,{checked:!1}),a4e=p.forwardRef(Pr(function(t,n){const{__scopeMenu:r,forceMount:i,...s}=t,a=s4e(Yce,r);return o.jsx(_d,{present:i||Cw(a.checked)||a.checked===!0,children:o.jsx(bi.span,{...s,ref:n,"data-state":JN(a.checked)})})},"MenuItemIndicator")),o4e=p.forwardRef(Pr(function(t,n){const{__scopeMenu:r,...i}=t;return o.jsx(bi.div,{role:"separator","aria-orientation":"horizontal",...i,ref:n})},"MenuSeparator")),Kce="MenuSub",[l4e,Jce]=h0(Kce),c4e=Pr(e=>{const{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,s=um(Kce,t),a=KN(t),[l,c]=p.useState(null),[u,d]=p.useState(null),f=xu(i);return p.useEffect(()=>(s.open===!1&&f(!1),()=>f(!1)),[s.open,f]),o.jsx(WN,{...a,children:o.jsx(Hce,{scope:t,open:r,onOpenChange:f,content:u,onContentChange:d,children:o.jsx(l4e,{scope:t,contentId:Fp(),triggerId:Fp(),trigger:l,onTriggerChange:c,children:n})})})},"MenuSub"),n2="MenuSubTrigger",u4e=p.forwardRef(Pr(function(t,n){const r=um(n2,t.__scopeMenu),i=tE(n2,t.__scopeMenu),s=Jce(n2,t.__scopeMenu),a=K9(n2,t.__scopeMenu),l=p.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:u}=a,d={__scopeMenu:t.__scopeMenu},f=p.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);p.useEffect(()=>f,[f]),p.useEffect(()=>{const m=c.current;return()=>{window.clearTimeout(m),u(null)}},[c,u]);const h=Vr(n,s.onTriggerChange);return o.jsx(qce,{asChild:!0,...d,children:o.jsx(Wce,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?s.contentId:void 0,"data-state":t7(r.open),...t,ref:h,onClick:m=>{var g;(g=t.onClick)==null||g.call(t,m),!(t.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:fn(t.onPointerMove,e1(m=>{a.onItemEnter(m),!m.defaultPrevented&&!t.disabled&&!r.open&&!l.current&&(a.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{r.onOpenChange(!0),f()},100))})),onPointerLeave:fn(t.onPointerLeave,e1(m=>{var b,y;f();const g=(b=r.content)==null?void 0:b.getBoundingClientRect();if(g){const O=(y=r.content)==null?void 0:y.dataset.side,v=O==="right",x=v?-5:5,w=g[v?"left":"right"],S=g[v?"right":"left"];a.onPointerGraceIntentChange({area:[{x:m.clientX+x,y:m.clientY},{x:w,y:g.top},{x:S,y:g.top},{x:S,y:g.bottom},{x:w,y:g.bottom}],side:O}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(m),m.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:fn(t.onKeyDown,m=>{var b;t.disabled||m.target!==m.currentTarget||a.searchRef.current!==""&&m.key===" "||$Me[i.dir].includes(m.key)&&(r.onOpenChange(!0),(b=r.content)==null||b.focus(),m.preventDefault())})})})},"MenuSubTrigger")),d4e="MenuSubContent",f4e=p.forwardRef(Pr(function(t,n){const r=Gce(gu,t.__scopeMenu),{forceMount:i=r.forceMount,align:s="start",...a}=t,l=um(gu,t.__scopeMenu),c=tE(gu,t.__scopeMenu),u=Jce(d4e,t.__scopeMenu),d=p.useRef(null),f=Vr(n,d);return o.jsx(Tw.Provider,{scope:t.__scopeMenu,children:o.jsx(_d,{present:i||l.open,children:o.jsx(Tw.Slot,{scope:t.__scopeMenu,children:o.jsx(J9,{id:u.contentId,"aria-labelledby":u.triggerId,...a,ref:f,align:s,side:c.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:h=>{var m;c.isUsingKeyboardRef.current&&((m=d.current)==null||m.focus()),h.preventDefault()},onCloseAutoFocus:h=>h.preventDefault(),onFocusOutside:fn(t.onFocusOutside,h=>{h.target!==u.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:fn(t.onEscapeKeyDown,h=>{c.onClose(),h.preventDefault()}),onKeyDown:fn(t.onKeyDown,h=>{var b;const m=h.currentTarget.contains(h.target),g=BMe[c.dir].includes(h.key);m&&g&&(l.onOpenChange(!1),(b=u.trigger)==null||b.focus(),h.preventDefault())})})})})})},"MenuSubContent"));function t7(e){return e?"open":"closed"}Pr(t7,"getOpenState");function Cw(e){return e==="indeterminate"}Pr(Cw,"isIndeterminate");function JN(e){return Cw(e)?"indeterminate":e?"checked":"unchecked"}Pr(JN,"getCheckedState");function eue(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}Pr(eue,"focusFirst");function tue(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Pr(tue,"wrapArray");function nue(e,t,n){const i=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=tue(e,Math.max(s,0));i.length===1&&(a=a.filter(u=>u!==n));const c=a.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return c!==n?c:void 0}Pr(nue,"getNextMatch");function rue(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,a=t.length-1;sr!=h>r&&n<(f-u)*(r-d)/(h-d)+u&&(i=!i)}return i}Pr(rue,"isPointInPolygon");function iue(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return rue(n,t)}Pr(iue,"isPointerInGraceArea");function e1(e){return t=>t.pointerType==="mouse"?e(t):void 0}Pr(e1,"whenMouse");var h4e=zMe,p4e=qce,m4e=HMe,g4e=XMe,b4e=e7,y4e=KMe,O4e=n4e,x4e=i4e,v4e=a4e,w4e=o4e,S4e=c4e,E4e=u4e,k4e=f4e,_4e=Object.defineProperty,Hl=(e,t)=>_4e(e,"name",{value:t,configurable:!0}),n7="DropdownMenu",[T4e,lMt]=nl(n7,[zce]),ql=zce(),[C4e,sue]=T4e(n7),A4e=Hl(e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:s,onOpenChange:a,modal:l=!0}=e,c=ql(t),u=p.useRef(null),[d,f]=Qc({prop:i,defaultProp:s??!1,onChange:a,caller:n7});return o.jsx(C4e,{scope:t,triggerId:Fp(),triggerRef:u,contentId:Fp(),open:d,onOpenChange:f,onOpenToggle:p.useCallback(()=>f(h=>!h),[f]),modal:l,children:o.jsx(h4e,{...c,open:d,onOpenChange:f,dir:r,modal:l,children:n})})},"DropdownMenu"),N4e="DropdownMenuTrigger",j4e=p.forwardRef(Hl(function(t,n){const{__scopeDropdownMenu:r,disabled:i=!1,...s}=t,a=sue(N4e,r),l=ql(r),c=Vr(n,a.triggerRef);return o.jsx(p4e,{asChild:!0,...l,children:o.jsx(bi.button,{type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?"open":"closed","data-disabled":i?"":void 0,disabled:i,...s,ref:c,onPointerDown:fn(t.onPointerDown,u=>{!i&&u.button===0&&u.ctrlKey===!1&&(a.onOpenToggle(),a.open||u.preventDefault())}),onKeyDown:fn(t.onKeyDown,u=>{i||(["Enter"," "].includes(u.key)&&a.onOpenToggle(),u.key==="ArrowDown"&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(u.key)&&u.preventDefault())})})})},"DropdownMenuTrigger")),R4e=Hl(e=>{const{__scopeDropdownMenu:t,...n}=e,r=ql(t);return o.jsx(m4e,{...r,...n})},"DropdownMenuPortal"),I4e="DropdownMenuContent",D4e=p.forwardRef(Hl(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=sue(I4e,r),a=ql(r),l=p.useRef(!1);return o.jsx(g4e,{id:s.contentId,"aria-labelledby":s.triggerId,...a,...i,ref:n,onCloseAutoFocus:fn(t.onCloseAutoFocus,c=>{var u;l.current||(u=s.triggerRef.current)==null||u.focus(),l.current=!1,c.preventDefault()}),onInteractOutside:fn(t.onInteractOutside,c=>{const u=c.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0,f=u.button===2||d;(!s.modal||f)&&(l.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuContent")),P4e=p.forwardRef(Hl(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=ql(r);return o.jsx(b4e,{...s,...i,ref:n})},"DropdownMenuItem")),M4e=p.forwardRef(Hl(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=ql(r);return o.jsx(y4e,{...s,...i,ref:n})},"DropdownMenuCheckboxItem")),L4e=p.forwardRef(Hl(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=ql(r);return o.jsx(O4e,{...s,...i,ref:n})},"DropdownMenuRadioGroup")),$4e=p.forwardRef(Hl(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=ql(r);return o.jsx(x4e,{...s,...i,ref:n})},"DropdownMenuRadioItem")),B4e=p.forwardRef(Hl(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=ql(r);return o.jsx(v4e,{...s,...i,ref:n})},"DropdownMenuItemIndicator")),Q4e=p.forwardRef(Hl(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=ql(r);return o.jsx(w4e,{...s,...i,ref:n})},"DropdownMenuSeparator")),U4e=Hl(e=>{const{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:s}=e,a=ql(t),[l,c]=Qc({prop:r,defaultProp:s??!1,onChange:i,caller:"DropdownMenuSub"});return o.jsx(S4e,{...a,open:l,onOpenChange:c,children:n})},"DropdownMenuSub"),F4e=p.forwardRef(Hl(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=ql(r);return o.jsx(E4e,{...s,...i,ref:n})},"DropdownMenuSubTrigger")),z4e=p.forwardRef(Hl(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=ql(r);return o.jsx(k4e,{...s,...i,ref:n,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuSubContent")),V4e=A4e,H4e=j4e,aue=R4e,q4e=D4e,oue=P4e,X4e=M4e,G4e=L4e,W4e=$4e,lue=B4e,Y4e=Q4e,Z4e=U4e,K4e=F4e,J4e=z4e,eLe=Object.defineProperty,dm=(e,t)=>eLe(e,"name",{value:t,configurable:!0}),r7="Popover",[cue,cMt]=nl(r7,[W1]),i7=W1(),[tLe,Z1]=cue(r7),nLe=dm(e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:a=!1}=e,l=i7(t),c=p.useRef(null),[u,d]=p.useState(!1),[f,h]=Qc({prop:r,defaultProp:i??!1,onChange:s,caller:r7});return o.jsx(WN,{...l,children:o.jsx(tLe,{scope:t,contentId:Fp(),triggerRef:c,open:f,onOpenChange:h,onOpenToggle:p.useCallback(()=>h(m=>!m),[h]),hasCustomAnchor:u,onCustomAnchorAdd:p.useCallback(()=>d(!0),[]),onCustomAnchorRemove:p.useCallback(()=>d(!1),[]),modal:a,children:n})})},"Popover"),rLe="PopoverTrigger",iLe=p.forwardRef(dm(function(t,n){const{__scopePopover:r,...i}=t,s=Z1(rLe,r),a=i7(r),l=Vr(n,s.triggerRef),c=o.jsx(bi.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s7(s.open),...i,ref:l,onClick:fn(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?c:o.jsx(q9,{asChild:!0,...a,children:c})},"PopoverTrigger")),uue="PopoverPortal",[sLe,aLe]=cue(uue,{forceMount:void 0}),oLe=dm(e=>{const{__scopePopover:t,forceMount:n,children:r,container:i}=e,s=Z1(uue,t);return o.jsx(sLe,{scope:t,forceMount:n,children:o.jsx(_d,{present:n||s.open,children:o.jsx(D9,{asChild:!0,container:i,children:r})})})},"PopoverPortal"),Aw="PopoverContent",lLe=p.forwardRef(dm(function(t,n){const r=aLe(Aw,t.__scopePopover),{forceMount:i=r.forceMount,...s}=t,a=Z1(Aw,t.__scopePopover);return o.jsx(_d,{present:i||a.open,children:a.modal?o.jsx(uLe,{...s,ref:n}):o.jsx(dLe,{...s,ref:n})})},"PopoverContent")),cLe=Jf("PopoverContent.RemoveScroll"),uLe=p.forwardRef(dm(function(t,n){const r=Z1(Aw,t.__scopePopover),i=p.useRef(null),s=Vr(n,i),a=p.useRef(!1);return p.useEffect(()=>{const l=i.current;if(l)return mce(l)},[]),o.jsx(M9,{as:cLe,allowPinchZoom:!0,children:o.jsx(due,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:fn(t.onCloseAutoFocus,l=>{var c;l.preventDefault(),a.current||(c=r.triggerRef.current)==null||c.focus()}),onPointerDownOutside:fn(t.onPointerDownOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;a.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:fn(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})},"PopoverContentModal")),dLe=p.forwardRef(dm(function(t,n){const r=Z1(Aw,t.__scopePopover),i=p.useRef(!1),s=p.useRef(!1);return o.jsx(due,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var l,c;(l=t.onCloseAutoFocus)==null||l.call(t,a),a.defaultPrevented||(i.current||(c=r.triggerRef.current)==null||c.focus(),a.preventDefault()),i.current=!1,s.current=!1},onInteractOutside:a=>{var u,d;(u=t.onInteractOutside)==null||u.call(t,a),a.defaultPrevented||(i.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const l=a.target;((d=r.triggerRef.current)==null?void 0:d.contains(l))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})},"PopoverContentNonModal")),due=p.forwardRef(dm(function(t,n){const{__scopePopover:r,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,...h}=t,m=Z1(Aw,r),g=i7(r);return UN(),o.jsx(ece,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:s,onUnmountAutoFocus:a,children:o.jsx(j9,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:f,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onDismiss:()=>m.onOpenChange(!1),deferPointerDownOutside:!0,children:o.jsx(X9,{"data-state":s7(m.open),role:"dialog",id:m.contentId,...g,...h,ref:n,style:{...h.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})},"PopoverContentImpl"));function s7(e){return e?"open":"closed"}dm(s7,"getState");var fue=nLe,hue=iLe,pue=oLe,mue=lLe,fLe=Object.defineProperty,Ya=(e,t)=>fLe(e,"name",{value:t,configurable:!0}),gue="Radio",[hLe,bue]=nl(gue),[pLe,ej]=hLe(gue);function yue(e){const{__scopeRadio:t,checked:n=!1,children:r,disabled:i,form:s,name:a,onCheck:l,required:c,value:u="on",internal_do_not_use_render:d}=e,[f,h]=p.useState(null),[m,g]=p.useState(null),b=p.useRef(!1),[y,O]=p.useReducer(w=>w+1,0),v=f?!!s||!!f.closest("form"):!0,x={checked:n,disabled:i,required:c,name:a,form:s,value:u,control:f,setControl:h,hasConsumerStoppedPropagationRef:b,userInteractionCount:y,onUserInteraction:O,isFormControl:v,bubbleInput:m,setBubbleInput:g,onCheck:Ya(()=>l==null?void 0:l(),"onCheck")};return o.jsx(pLe,{scope:t,...x,children:Oue(d)?d(x):r})}Ya(yue,"RadioProvider");var mLe="RadioTrigger",gLe=p.forwardRef(Ya(function({__scopeRadio:t,onClick:n,...r},i){const{checked:s,disabled:a,value:l,setControl:c,onCheck:u,hasConsumerStoppedPropagationRef:d,onUserInteraction:f,isFormControl:h,bubbleInput:m}=ej(mLe,t),g=Vr(i,c);return o.jsx(bi.button,{type:"button",role:"radio","aria-checked":s,"data-state":a7(s),"data-disabled":a?"":void 0,disabled:a,value:l,...r,ref:g,onClick:fn(n,b=>{s||(f(),u()),m&&h&&(d.current=b.isPropagationStopped(),d.current||b.stopPropagation())})})},"RadioTrigger")),bLe="RadioIndicator",yLe=p.forwardRef(Ya(function(t,n){const{__scopeRadio:r,forceMount:i,...s}=t,a=ej(bLe,r);return o.jsx(_d,{present:i||a.checked,children:o.jsx(bi.span,{"data-state":a7(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:n})})},"RadioIndicator")),OLe="RadioBubbleInput",xLe=p.forwardRef(Ya(function({__scopeRadio:t,onClick:n,...r},i){const{control:s,checked:a,required:l,disabled:c,name:u,value:d,form:f,bubbleInput:h,setBubbleInput:m,hasConsumerStoppedPropagationRef:g,userInteractionCount:b}=ej(OLe,t),y=Vr(i,m),O=eE(s),v=p.useRef(!1),x=p.useRef(a),w=p.useRef(b);p.useEffect(()=>{const E=h;if(!E)return;const k=window.HTMLInputElement.prototype,T=Object.getOwnPropertyDescriptor(k,"checked").set,C=b!==w.current;w.current=b;const A=x.current!==a;x.current=a;const j=!(C&&g.current);if(A&&T){v.current=!C;const M=new Event("click",{bubbles:j});T.call(E,a),E.dispatchEvent(M),v.current=!1}},[h,a,g,b]);const S=p.useRef(a);return o.jsx(bi.input,{type:"radio","aria-hidden":!0,defaultChecked:S.current,required:l,disabled:c,name:u,value:d,form:f,...r,tabIndex:-1,ref:y,onClick:fn(n,E=>{v.current&&E.stopPropagation()}),style:{...r.style,...O,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"RadioBubbleInput"));function Oue(e){return typeof e=="function"}Ya(Oue,"isFunction");function a7(e){return e?"checked":"unchecked"}Ya(a7,"getState");var vLe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],o7="RadioGroup",[wLe,uMt]=nl(o7,[Y1,bue]),xue=Y1(),tj=bue(),[SLe,ELe]=wLe(o7),kLe=p.forwardRef(Ya(function(t,n){const{__scopeRadioGroup:r,name:i,form:s,defaultValue:a,value:l,required:c=!1,disabled:u=!1,orientation:d,dir:f,loop:h=!0,onValueChange:m,...g}=t,b=xue(r),y=JS(f),[O,v]=Qc({prop:l,defaultProp:a??null,onChange:m,caller:o7}),[x,w]=p.useState(null),S=Vr(n,w),E=p.useRef(O);return p.useEffect(()=>{const k=s?x==null?void 0:x.ownerDocument.getElementById(s):x==null?void 0:x.closest("form");if(k instanceof HTMLFormElement){const _=Ya(()=>v(E.current),"reset");return k.addEventListener("reset",_),()=>k.removeEventListener("reset",_)}},[x,s,v]),o.jsx(SLe,{scope:r,name:i,form:s,required:c,disabled:u,value:O,onValueChange:v,children:o.jsx(Y9,{asChild:!0,...b,orientation:d,dir:y,loop:h,children:o.jsx(bi.div,{role:"radiogroup","aria-required":c,"aria-orientation":d,"data-disabled":u?"":void 0,dir:y,...g,ref:S})})})},"RadioGroup")),_Le="RadioGroupItemProvider",TLe="RadioGroupItemTrigger";function vue(e){const{__scopeRadioGroup:t,value:n,disabled:r,children:i,internal_do_not_use_render:s}=e,a=ELe(_Le,t),l=tj(t),c=a.disabled||r;return o.jsx(yue,{...l,checked:a.value===n,disabled:c,required:a.required,name:a.name,form:a.form,value:n,onCheck:()=>a.onValueChange(n),internal_do_not_use_render:s,children:i})}Ya(vue,"RadioGroupItemProvider");var CLe=p.forwardRef(Ya(function(t,n){const{__scopeRadioGroup:r,...i}=t,s=xue(r),a=tj(r),{checked:l,disabled:c}=ej(TLe,a.__scopeRadio),u=p.useRef(null),d=Vr(n,u),f=p.useRef(!1);return p.useEffect(()=>{const h=Ya(g=>{vLe.includes(g.key)&&(f.current=!0)},"handleKeyDown"),m=Ya(()=>f.current=!1,"handleKeyUp");return document.addEventListener("keydown",h),document.addEventListener("keyup",m),()=>{document.removeEventListener("keydown",h),document.removeEventListener("keyup",m)}},[]),o.jsx(Z9,{asChild:!0,...s,focusable:!c,active:l,children:o.jsx(gLe,{...a,...i,ref:d,onKeyDown:fn(i.onKeyDown,h=>{h.key==="Enter"&&h.preventDefault()}),onFocus:fn(i.onFocus,()=>{var h;f.current&&((h=u.current)==null||h.click())})})})},"RadioGroupItemTrigger")),ALe=p.forwardRef(Ya(function(t,n){const{__scopeRadioGroup:r,value:i,disabled:s,...a}=t;return o.jsx(vue,{__scopeRadioGroup:r,value:i,disabled:s,internal_do_not_use_render:({isFormControl:l})=>o.jsxs(o.Fragment,{children:[o.jsx(CLe,{...a,ref:n,__scopeRadioGroup:r}),l&&o.jsx(NLe,{__scopeRadioGroup:r})]})})},"RadioGroupItem")),NLe=p.forwardRef(Ya(function(t,n){const{__scopeRadioGroup:r,...i}=t,s=tj(r);return o.jsx(xLe,{...s,...i,ref:n})},"RadioGroupItemBubbleInput")),jLe=p.forwardRef(Ya(function(t,n){const{__scopeRadioGroup:r,...i}=t,s=tj(r);return o.jsx(yLe,{...s,...i,ref:n})},"RadioGroupIndicator")),RLe=Object.defineProperty,Hp=(e,t)=>RLe(e,"name",{value:t,configurable:!0}),l7="Switch",[ILe,dMt]=nl(l7),[DLe,c7]=ILe(l7);function wue(e){const{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:s,form:a,name:l,onCheckedChange:c,required:u,value:d="on",internal_do_not_use_render:f}=e,[h,m]=Qc({prop:n,defaultProp:i??!1,onChange:c,caller:l7}),[g,b]=p.useState(null),[y,O]=p.useState(null),v=p.useRef(!1),[x,w]=p.useReducer(k=>k+1,0),S=g?!!a||!!g.closest("form"):!0,E={checked:h,setChecked:m,disabled:s,control:g,setControl:b,name:l,form:a,value:d,hasConsumerStoppedPropagationRef:v,userInteractionCount:x,onUserInteraction:w,required:u,defaultChecked:i,isFormControl:S,bubbleInput:y,setBubbleInput:O};return o.jsx(DLe,{scope:t,...E,children:Sue(f)?f(E):r})}Hp(wue,"SwitchProvider");var PLe="SwitchTrigger",MLe=p.forwardRef(Hp(function({__scopeSwitch:t,onClick:n,...r},i){const{control:s,form:a,value:l,disabled:c,checked:u,required:d,setControl:f,setChecked:h,hasConsumerStoppedPropagationRef:m,onUserInteraction:g,isFormControl:b,bubbleInput:y}=c7(PLe,t),O=Vr(i,f),v=p.useRef(u);return p.useEffect(()=>{const x=a?s==null?void 0:s.ownerDocument.getElementById(a):s==null?void 0:s.form;if(x instanceof HTMLFormElement){const w=Hp(()=>h(v.current),"reset");return x.addEventListener("reset",w),()=>x.removeEventListener("reset",w)}},[s,a,h]),o.jsx(bi.button,{type:"button",role:"switch","aria-checked":u,"aria-required":d,"data-state":u7(u),"data-disabled":c?"":void 0,disabled:c,value:l,...r,ref:O,onClick:fn(n,x=>{g(),h(w=>!w),y&&b&&(m.current=x.isPropagationStopped(),m.current||x.stopPropagation())})})},"SwitchTrigger")),LLe=p.forwardRef(Hp(function(t,n){const{__scopeSwitch:r,name:i,checked:s,defaultChecked:a,required:l,disabled:c,value:u,onCheckedChange:d,form:f,...h}=t;return o.jsx(wue,{__scopeSwitch:r,checked:s,defaultChecked:a,disabled:c,required:l,onCheckedChange:d,name:i,form:f,value:u,internal_do_not_use_render:({isFormControl:m})=>o.jsxs(o.Fragment,{children:[o.jsx(MLe,{...h,ref:n,__scopeSwitch:r}),m&&o.jsx(ULe,{__scopeSwitch:r})]})})},"Switch")),$Le="SwitchThumb",BLe=p.forwardRef(Hp(function(t,n){const{__scopeSwitch:r,...i}=t,s=c7($Le,r);return o.jsx(bi.span,{"data-state":u7(s.checked),"data-disabled":s.disabled?"":void 0,...i,ref:n})},"SwitchThumb")),QLe="SwitchBubbleInput",ULe=p.forwardRef(Hp(function({__scopeSwitch:t,onClick:n,...r},i){const{control:s,hasConsumerStoppedPropagationRef:a,userInteractionCount:l,checked:c,defaultChecked:u,required:d,disabled:f,name:h,value:m,form:g,bubbleInput:b,setBubbleInput:y}=c7(QLe,t),O=Vr(i,y),v=eE(s),x=p.useRef(!1),w=p.useRef(c),S=p.useRef(l);p.useEffect(()=>{const k=b;if(!k)return;const _=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(_,"checked").set,A=l!==S.current;S.current=l;const j=w.current!==c;w.current=c;const M=!(A&&a.current);if(j&&C){x.current=!A;const I=new Event("click",{bubbles:M});C.call(k,c),k.dispatchEvent(I),x.current=!1}},[b,c,a,l]);const E=p.useRef(c);return o.jsx(bi.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??E.current,required:d,disabled:f,name:h,value:m,form:g,...r,tabIndex:-1,ref:O,onClick:fn(n,k=>{x.current&&k.stopPropagation()}),style:{...r.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function Sue(e){return typeof e=="function"}Hp(Sue,"isFunction");function u7(e){return e?"checked":"unchecked"}Hp(u7,"getState");var FLe=Object.defineProperty,zLe=(e,t)=>FLe(e,"name",{value:t,configurable:!0}),VLe="Toggle",HLe=p.forwardRef(zLe(function(t,n){const{pressed:r,defaultPressed:i,onPressedChange:s,...a}=t,[l,c]=Qc({prop:r,onChange:s,defaultProp:i??!1,caller:VLe});return o.jsx(bi.button,{type:"button","aria-pressed":l,"data-state":l?"on":"off","data-disabled":t.disabled?"":void 0,...a,ref:n,onClick:fn(t.onClick,()=>{t.disabled||c(!l)})})},"Toggle")),qLe=Object.defineProperty,qp=(e,t)=>qLe(e,"name",{value:t,configurable:!0}),K1="ToggleGroup",[Eue,fMt]=nl(K1,[Y1]),kue=Y1(),XLe=p.forwardRef(qp(function(t,n){const{type:r,...i}=t;if(r==="single"){const s=i;return o.jsx(GLe,{role:"radiogroup",...s,ref:n})}if(r==="multiple"){const s=i;return o.jsx(WLe,{role:"toolbar",...s,ref:n})}throw new Error(`Missing prop \`type\` expected on \`${K1}\``)},"ToggleGroup")),[_ue,Tue]=Eue(K1),GLe=p.forwardRef(qp(function(t,n){const{value:r,defaultValue:i,onValueChange:s=qp(()=>{},"onValueChange"),...a}=t,[l,c]=Qc({prop:r,defaultProp:i??"",onChange:s,caller:K1});return o.jsx(_ue,{scope:t.__scopeToggleGroup,type:"single",value:p.useMemo(()=>l?[l]:[],[l]),onItemActivate:c,onItemDeactivate:p.useCallback(()=>c(""),[c]),children:o.jsx(Cue,{...a,ref:n})})},"ToggleGroupImplSingle")),WLe=p.forwardRef(qp(function(t,n){const{value:r,defaultValue:i,onValueChange:s=qp(()=>{},"onValueChange"),...a}=t,[l,c]=Qc({prop:r,defaultProp:i??[],onChange:s,caller:K1}),u=p.useCallback(f=>c((h=[])=>[...h,f]),[c]),d=p.useCallback(f=>c((h=[])=>h.filter(m=>m!==f)),[c]);return o.jsx(_ue,{scope:t.__scopeToggleGroup,type:"multiple",value:l,onItemActivate:u,onItemDeactivate:d,children:o.jsx(Cue,{...a,ref:n})})},"ToggleGroupImplMultiple")),[YLe,ZLe]=Eue(K1),Cue=p.forwardRef(qp(function(t,n){const{__scopeToggleGroup:r,disabled:i=!1,rovingFocus:s=!0,orientation:a,dir:l,loop:c=!0,...u}=t,d=kue(r),f=JS(l),h={dir:f,...u};return o.jsx(YLe,{scope:r,rovingFocus:s,disabled:i,children:s?o.jsx(Y9,{asChild:!0,...d,orientation:a,dir:f,loop:c,children:o.jsx(bi.div,{...h,ref:n})}):o.jsx(bi.div,{...h,ref:n})})},"ToggleGroupImpl")),y4="ToggleGroupItem",KLe=p.forwardRef(qp(function(t,n){const r=Tue(y4,t.__scopeToggleGroup),i=ZLe(y4,t.__scopeToggleGroup),s=kue(t.__scopeToggleGroup),a=r.value.includes(t.value),l=i.disabled||t.disabled,c={...t,pressed:a,disabled:l},u=p.useRef(null);return i.rovingFocus?o.jsx(Z9,{asChild:!0,...s,focusable:!l,active:a,ref:u,children:o.jsx(sq,{...c,ref:n})}):o.jsx(sq,{...c,ref:n})},"ToggleGroupItem")),sq=p.forwardRef(qp(function(t,n){const{__scopeToggleGroup:r,value:i,...s}=t,a=Tue(y4,r),l={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},c=a.type==="single"?l:void 0;return o.jsx(HLe,{...c,...s,ref:n,onPressedChange:u=>{u?a.onItemActivate(i):a.onItemDeactivate(i)}})},"ToggleGroupItemImpl")),JLe=Object.defineProperty,pa=(e,t)=>JLe(e,"name",{value:t,configurable:!0}),[d7,hMt]=nl("Tooltip",[W1]),f7=W1(),e6e="TooltipProvider",t6e=700,O4="tooltip.open",[n6e,h7]=d7(e6e),r6e=pa(e=>{const{__scopeTooltip:t,delayDuration:n=t6e,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=e,a=p.useRef(!0),l=p.useRef(!1),c=p.useRef(0);return p.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),o.jsx(n6e,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:p.useCallback(()=>{r<=0||(window.clearTimeout(c.current),a.current=!1)},[r]),onClose:p.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.current=!0,r))},[r]),isPointerInTransitRef:l,onPointerInTransitChange:p.useCallback(u=>{l.current=u},[]),disableHoverableContent:i,children:s})},"TooltipProvider"),x4="Tooltip",[i6e,nE]=d7(x4),s6e=pa(e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:a,delayDuration:l}=e,c=h7(x4,e.__scopeTooltip),u=f7(t),[d,f]=p.useState(null),[h,m]=p.useState(void 0),g=Fp(),b=p.useRef(0),y=a??c.disableHoverableContent,O=l??c.delayDuration,v=p.useRef(!1),[x,w]=Qc({prop:r,defaultProp:i??!1,onChange:pa(C=>{C?(c.onOpen(),document.dispatchEvent(new CustomEvent(O4))):c.onClose(),s==null||s(C)},"onChange"),caller:x4}),S=p.useMemo(()=>x?v.current?"delayed-open":"instant-open":"closed",[x]),E=p.useCallback(()=>{window.clearTimeout(b.current),b.current=0,v.current=!1,w(!0)},[w]),k=p.useCallback(()=>{window.clearTimeout(b.current),b.current=0,w(!1)},[w]),_=p.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{v.current=!0,w(!0),b.current=0},O)},[O,w]);p.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]);const T=h??g;return o.jsx(WN,{...u,children:o.jsx(i6e,{scope:t,contentId:T,setContentId:m,open:x,stateAttribute:S,trigger:d,onTriggerChange:f,onTriggerEnter:p.useCallback(()=>{c.isOpenDelayedRef.current?_():E()},[c.isOpenDelayedRef,_,E]),onTriggerLeave:p.useCallback(()=>{y?k():(window.clearTimeout(b.current),b.current=0)},[k,y]),onOpen:E,onClose:k,disableHoverableContent:y,children:n})})},"Tooltip"),aq="TooltipTrigger",a6e=p.forwardRef(pa(function(t,n){const{__scopeTooltip:r,...i}=t,s=nE(aq,r),a=h7(aq,r),l=f7(r),c=p.useRef(null),u=Vr(n,c,s.onTriggerChange),d=p.useRef(!1),f=p.useRef(!1),h=p.useCallback(()=>d.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),o.jsx(q9,{asChild:!0,...l,children:o.jsx(bi.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...i,ref:u,onPointerMove:fn(t.onPointerMove,m=>{m.pointerType!=="touch"&&!f.current&&!a.isPointerInTransitRef.current&&(s.onTriggerEnter(),f.current=!0)}),onPointerLeave:fn(t.onPointerLeave,()=>{s.onTriggerLeave(),f.current=!1}),onPointerDown:fn(t.onPointerDown,()=>{s.open&&s.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:fn(t.onFocus,()=>{d.current||s.onOpen()}),onBlur:fn(t.onBlur,s.onClose),onClick:fn(t.onClick,s.onClose)})})},"TooltipTrigger")),Aue="TooltipPortal",[o6e,l6e]=d7(Aue,{forceMount:void 0}),c6e=pa(e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,s=nE(Aue,t);return o.jsx(o6e,{scope:t,forceMount:n,children:o.jsx(_d,{present:n||s.open,children:o.jsx(D9,{asChild:!0,container:i,children:r})})})},"TooltipPortal"),Nw="TooltipContent",u6e=p.forwardRef(pa(function(t,n){const r=l6e(Nw,t.__scopeTooltip),{forceMount:i=r.forceMount,side:s="top",...a}=t,l=nE(Nw,t.__scopeTooltip);return o.jsx(_d,{present:i||l.open,children:l.disableHoverableContent?o.jsx(Nue,{side:s,...a,ref:n}):o.jsx(d6e,{side:s,...a,ref:n})})},"TooltipContent")),d6e=p.forwardRef(pa(function(t,n){const r=nE(Nw,t.__scopeTooltip),i=h7(Nw,t.__scopeTooltip),s=p.useRef(null),a=Vr(n,s),[l,c]=p.useState(null),{trigger:u,onClose:d}=r,f=s.current,{onPointerInTransitChange:h}=i,m=p.useCallback(()=>{c(null),h(!1)},[h]),g=p.useCallback((b,y)=>{const O=b.currentTarget,v={x:b.clientX,y:b.clientY},x=jue(v,O.getBoundingClientRect()),w=Rue(v,x),S=Iue(y.getBoundingClientRect()),E=Pue([...w,...S]);c(E),h(!0)},[h]);return p.useEffect(()=>()=>m(),[m]),p.useEffect(()=>{if(u&&f){const b=pa(O=>g(O,f),"handleTriggerLeave"),y=pa(O=>g(O,u),"handleContentLeave");return u.addEventListener("pointerleave",b),f.addEventListener("pointerleave",y),()=>{u.removeEventListener("pointerleave",b),f.removeEventListener("pointerleave",y)}}},[u,f,g,m]),p.useEffect(()=>{if(l){const b=pa(y=>{const O=y.target,v={x:y.clientX,y:y.clientY},x=(u==null?void 0:u.contains(O))||(f==null?void 0:f.contains(O)),w=!Due(v,l);x?m():w&&(m(),d())},"handleTrackPointerGrace");return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[u,f,l,d,m]),o.jsx(Nue,{...t,ref:a})},"TooltipContentHoverable")),f6e=jle("TooltipContent"),Nue=p.forwardRef(pa(function(t,n){const{__scopeTooltip:r,children:i,"aria-label":s,id:a,onEscapeKeyDown:l,onPointerDownOutside:c,...u}=t,d=nE(Nw,r),f=f7(r),{onClose:h}=d;p.useEffect(()=>(document.addEventListener(O4,h),()=>document.removeEventListener(O4,h)),[h]),p.useEffect(()=>{if(d.trigger){const g=pa(b=>{b.target instanceof Node&&b.target.contains(d.trigger)&&h()},"handleScroll");return window.addEventListener("scroll",g,{capture:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})}},[d.trigger,h]);const{setContentId:m}=d;return Dc(()=>(m(a),()=>{m(void 0)}),[a,m]),o.jsx(j9,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:g=>g.preventDefault(),onDismiss:h,children:o.jsxs(X9,{"data-state":d.stateAttribute,role:s?void 0:"tooltip",id:s?void 0:d.contentId,...f,...u,ref:n,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[o.jsx(f6e,{children:i}),s?o.jsx(DDe,{id:d.contentId,role:"tooltip",children:s}):null]})})},"TooltipContentImpl"));function jue(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}pa(jue,"getExitSideFromRect");function Rue(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}pa(Rue,"getPaddedExitPoints");function Iue(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}pa(Iue,"getPointsFromRect");function Due(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,a=t.length-1;sr!=h>r&&n<(f-u)*(r-d)/(h-d)+u&&(i=!i)}return i}pa(Due,"isPointInPolygon");function Pue(e){const t=e.slice();return t.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),Mue(t)}pa(Pue,"getHull");function Mue(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r=2;){const s=t[t.length-1],a=t[t.length-2];if((s.x-a.x)*(i.y-a.y)>=(s.y-a.y)*(i.x-a.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const s=n[n.length-1],a=n[n.length-2];if((s.x-a.x)*(i.y-a.y)>=(s.y-a.y)*(i.x-a.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}pa(Mue,"getHullPresorted");var h6e=r6e,p6e=s6e,Lue=a6e,m6e=c6e,g6e=u6e;const b6e=()=>{var e;return typeof ClipboardItem<"u"&&!!((e=navigator.clipboard)!=null&&e.write)};function y6e(e){const{"text/plain":t,...n}=e;return new ClipboardItem({...n,...t?{"text/plain":new Blob([t],{type:"text/plain"})}:null})}async function O6e(e,t=document.body){if(typeof e=="string")return oq(e,t);try{return b6e()?(await navigator.clipboard.write([y6e(e)]),!0):e["text/plain"]?oq(e["text/plain"],t):!1}catch{return!1}}async function oq(e,t=document.body){if(navigator.clipboard)try{return await navigator.clipboard.writeText(e),!0}catch{}const n=document.createElement("textarea");n.value=e,n.style.position="fixed",n.style.top="0",n.style.left="0",n.style.opacity="0",t.appendChild(n),n.focus(),n.select();let r=!1;try{r=document.execCommand("copy")}catch{}return t.removeChild(n),r}function Xp(e){const t=p.useRef(e);return t.current=e,t}let t1=[],r2=!1;const lq=e=>{var t,n;if(e.key==="Escape"){const[r]=t1;r&&(e.preventDefault(),(n=(t=r.callback).current)==null||n.call(t))}},$ue=()=>{t1.length>0&&!r2?(document.body.addEventListener("keydown",lq),r2=!0):t1.length===0&&r2&&(document.body.removeEventListener("keydown",lq),r2=!1)},x6e=e=>{t1.unshift(e),$ue()},v6e=({id:e})=>{t1=t1.filter(t=>t.id!==e),$ue()},rE=(e,t)=>{const n=p.useId(),r=Xp(t);p.useEffect(()=>{if(!e)return;const i={id:n,callback:r};return x6e(i),()=>v6e(i)},[n,e,r])},w6e="_Tooltip_16g2y_1",S6e="_TriggerDecorator_16g2y_73",Bue={Tooltip:w6e,TriggerDecorator:S6e},Eo=e=>{const{ref:t,children:n,content:r,forceOpen:i=r===null?!1:void 0,maxWidth:s=300,openDelay:a=150,interactive:l=!1,compact:c=!1,preventUnintentionalClickToClose:u,align:d,alignOffset:f=0,side:h,sideOffset:m=5,gutterSize:g="md",contentClassName:b,onPointerDown:y,onClick:O,...v}=e,[x,w]=p.useState(!1),[S,E]=p.useState(!1);k9(()=>E(!1),S?400:null);const k=i??x,_=C=>{typeof i!="boolean"&&(w(C),u&&E(C))},T=C=>{u&&S&&(C.preventDefault(),C.stopPropagation())};return o.jsxs(Que,{open:k,delayDuration:a,onOpenChange:_,disableHoverableContent:!l,children:[o.jsx(Lue,{asChild:!0,children:o.jsx(Ale,{...v,ref:t,onPointerDown:C=>{T(C),y==null||y(C)},onClick:C=>{T(C),O==null||O(C)},children:n})}),o.jsx(Uue,{maxWidth:s,compact:c,align:d,alignOffset:f,side:h,sideOffset:m,gutterSize:g,className:b,children:r})]})},Que=({children:e,open:t,onOpenChange:n,...r})=>(rE(t,()=>{n(!1)}),o.jsx(h6e,{children:o.jsx(p6e,{open:t,onOpenChange:n,...r,children:e})})),Uue=({children:e,maxWidth:t=300,compact:n=!1,clickable:r=void 0,alignOffset:i=0,sideOffset:s=5,gutterSize:a="md",className:l,style:c,...u})=>o.jsx(m6e,{children:o.jsx(g6e,{...u,className:cr(Bue.Tooltip,l),"data-compact":n,"data-clickable":r,"data-gutter-size":a,alignOffset:i,sideOffset:s,collisionPadding:15,hideWhenDetached:!0,style:{...c,maxWidth:t},onEscapeKeyDown:Df,children:e})}),E6e=({children:e,asChild:t=!0,...n})=>o.jsx(Lue,{asChild:t,...n,children:e}),k6e=e=>{const{children:t,className:n,focusable:r=!0,ref:i,...s}=e,a=typeof t=="string";return o.jsx(Ale,{ref:i,...s,className:cr(Bue.TriggerDecorator,n),tabIndex:r?0:void 0,children:a?o.jsx("span",{children:t}):t})};Eo.Root=Que;Eo.Content=Uue;Eo.Trigger=E6e;Eo.TriggerDecorator=k6e;const _6e=50,cq=48;function T6e(e){return(e.events??[]).flatMap(t=>{var i,s;const r=(((i=t.content)==null?void 0:i.parts)??[]).map(a=>typeof a.text=="string"?a.text:"").filter(Boolean).join("");return r?[{text:r,role:t.author??((s=t.content)==null?void 0:s.role)??"",ts:t.timestamp}]:[]})}function C6e(e){var t,n;for(const r of e.events??[])if(r.author==="user"||((t=r.content)==null?void 0:t.role)==="user"){const i=(((n=r.content)==null?void 0:n.parts)??[]).map(s=>s.text).find(Boolean);if(i)return i}return"未命名会话"}function A6e(e,t,n){const r=Math.max(0,t-cq),i=Math.min(e.length,t+n+cq);return(r>0?"…":"")+e.slice(r,i).trim()+(i{var c;if((c=l.events)!=null&&c.length)return l;try{return await PN(t,e,l.id)}catch{return l}})),a=[];for(const l of s)for(const{text:c,role:u,ts:d}of T6e(l)){const f=c.toLowerCase().indexOf(r);if(f!==-1){a.push({type:"session",appId:t,sessionId:l.id,title:C6e(l),snippet:A6e(c,f,r.length),role:u,ts:d??l.lastUpdateTime});break}}return a.sort((l,c)=>(c.ts??0)-(l.ts??0)),a.slice(0,_6e)}async function j6e(e,t){if(!e||!t.trim())return{results:[]};let n;try{n=await goe(e,t.trim())}catch(a){const l=String(a);return{results:[],note:l.includes("404")?"网络搜索接口未就绪(后端未启用 /web/search)。":`网络搜索失败:${l}`}}const{mounted:r,results:i,error:s}=n;return r?s?{results:[],note:s}:{results:i.map((a,l)=>({type:"web",index:l,title:a.title,url:a.url,siteName:a.siteName,summary:a.summary}))}:{results:[],note:"当前 Agent 未挂载 web_search 工具。"}}async function R6e(e,t,n,r){if(!t||!r.trim())return{results:[]};const i=await moe(t,e,r.trim(),n);if(!i.mounted)return{results:[],note:e==="knowledge"?"该 Agent 未挂载知识库。":"该 Agent 未挂载长期记忆。"};if(i.error)return{results:[],note:i.error};const s=i.sourceName??(e==="knowledge"?"知识库":"长期记忆");return{results:i.results.map((a,l)=>e==="knowledge"?{type:"knowledge",index:l,content:a.content,sourceName:s,sourceType:i.sourceType}:{type:"memory",index:l,content:a.content,sourceName:s,sourceType:i.sourceType,author:a.author,ts:a.timestamp})}}async function I6e(e,t,n){return e==="session"?{results:await N6e(n.userId,n.appId,t)}:e==="web"?j6e(n.appId,t):R6e(e,n.appId,n.userId,t)}function Fue({mirrored:e=!1}){return o.jsxs("g",{opacity:"0.5",transform:e?"translate(20 0) scale(-1 1)":void 0,children:[o.jsx("path",{className:"sidebar-panel-glyph__divider",d:"M5.938 6.833c.11 0 .249.102.249.292v6.042c0 .19-.14.291-.249.291s-.248-.101-.248-.291V7.125c0-.19.139-.292.248-.292Z",strokeWidth:"1.167"}),o.jsx("path",{className:"sidebar-panel-glyph__frame",d:"M14.5 3.75h-9a3 3 0 0 0-3 3v6.857a3 3 0 0 0 3 3h9a3 3 0 0 0 3-3V6.75a3 3 0 0 0-3-3Z",strokeWidth:"1.667",strokeLinecap:"round",strokeLinejoin:"round"})]})}function D6e(e){return o.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",...e,children:o.jsx(Fue,{})})}function P6e(e){return o.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",...e,children:o.jsx(Fue,{mirrored:!0})})}function M6e(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M12 8.333c.368 0 .667.299.667.667v2h2a.667.667 0 0 1 0 1.333h-2v2a.667.667 0 0 1-1.334 0v-2h-2a.667.667 0 0 1 0-1.333h2V9c0-.368.299-.667.667-.667ZM7.667 1c3.49 0 6.383 2.554 6.913 5.896a.667.667 0 0 1-1.317.208 5.667 5.667 0 1 0-9.708 4.424.67.67 0 0 1 .07.12.667.667 0 0 1-.13.834l-.95.853 4.788-.002a.667.667 0 0 1 0 1.334l-5.657.002c-.917 0-1.35-1.131-.67-1.744l1.163-1.045A6.97 6.97 0 0 1 .667 8c0-3.866 3.134-7 7-7Z",fill:"currentColor"})})}function L6e(e){return o.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.333",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"7.333",cy:"7.333",r:"5.333"}),o.jsx("path",{d:"m11.133 11.133 2.867 2.867"})]})}function $6e(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M8 0.667c4.05 0 7.334 3.283 7.334 7.333 0 4.05-3.284 7.334-7.334 7.334S0.667 12.05 0.667 8 3.95 0.667 8 0.667Zm0 1.333a6 6 0 1 0 0 12A6 6 0 0 0 8 2ZM6.167 6c.368 0 .667.299.667.667v2a.667.667 0 0 1-1.334 0v-2c0-.368.299-.667.667-.667Zm3.666 0c.368 0 .667.299.667.667v2a.667.667 0 0 1-1.333 0v-2c0-.368.298-.667.666-.667Z",fill:"currentColor"})})}function zue(e){return o.jsxs("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M7.58 2.6a.667.667 0 0 0-.667-.667h-.666a.667.667 0 0 0-.667.667v10.667c0 .368.299.666.667.666h.666a.667.667 0 0 0 .667-.666V2.6Zm1.333 10.667A2 2 0 0 1 6.913 15.267h-.666a2 2 0 0 1-2-2V2.6a2 2 0 0 1 2-2h.666a2 2 0 0 1 2 2v10.667Z",fill:"currentColor"}),o.jsx("path",{d:"M11.88 5.045a.667.667 0 0 0-.801-.514l-.653.136a.667.667 0 0 0-.504.786l1.85 8.092c.081.358.44.589.8.514l.653-.137a.667.667 0 0 0 .504-.786L11.88 5.045Zm3.155 7.82a2 2 0 0 1-1.512 2.358l-.653.136a2 2 0 0 1-2.403-1.541L8.617 5.726a2 2 0 0 1 1.513-2.358l.652-.136a2 2 0 0 1 2.404 1.541l1.849 8.092Z",fill:"currentColor"}),o.jsx("path",{d:"M4.247 2.6a.667.667 0 0 0-.667-.667h-.667a.667.667 0 0 0-.666.667v10.667c0 .368.298.666.666.666h.667a.667.667 0 0 0 .667-.666V2.6ZM5.58 13.267a2 2 0 0 1-2 2h-.667a2 2 0 0 1-2-2V2.6a2 2 0 0 1 2-2h.667a2 2 0 0 1 2 2v10.667Z",fill:"currentColor"})]})}function B6e({className:e="icon"}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M16.4 10.7a5.7 5.7 0 1 1-1.67-4.03"}),o.jsx("path",{d:"M15.25 15.25 19.6 19.6"})]})}function Q6e({open:e}){return o.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:o.jsx("path",{d:"m3.25 4.75 2.75 2.5 2.75-2.5"})})}function U6e({active:e=!1,onClick:t}){return o.jsxs("button",{className:`new-chat${e?" is-active":""}`,onClick:t,"aria-label":"搜索","aria-current":e?"page":void 0,title:"搜索",children:[o.jsx(L6e,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"搜索"})]})}function F6e(e,t,n){const r=!!e,i=new Set((t==null?void 0:t.searchSources)??[]),s=a=>r?n?"正在检测 Agent 能力":`当前 Agent 未挂载${a}`:"请选择 Agent";return[{id:"session",label:"会话",ready:r,unavailableLabel:"请选择 Agent"},{id:"web",label:"网络",ready:r&&i.has("web"),description:"通过 web_search 工具检索",unavailableLabel:s(" web_search 工具")},{id:"knowledge",label:"知识库",ready:r&&i.has("knowledge"),unavailableLabel:s("知识库")},{id:"memory",label:"长期记忆",ready:r&&i.has("memory"),unavailableLabel:s("长期记忆")}]}function TC(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 uq(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 z6e({userId:e,appId:t,agentInfo:n,capabilitiesLoading:r,agentLabel:i,onOpenSession:s}){var $,N;const[a,l]=p.useState("session"),[c,u]=p.useState(""),[d,f]=p.useState([]),[h,m]=p.useState(),[g,b]=p.useState(!1),[y,O]=p.useState(!1),[v,x]=p.useState(!1),w=p.useRef(0),S=p.useRef(null),E=F6e(t,n,r),k=E.find(D=>D.id===a),_=a==="knowledge"?($=n==null?void 0:n.components)==null?void 0:$.find(D=>D.source==="knowledgebase"||D.kind==="knowledgebase"):a==="memory"?(N=n==null?void 0:n.components)==null?void 0:N.find(D=>D.source==="long_term_memory"||D.kind==="memory"):void 0;p.useEffect(()=>{w.current+=1,l("session"),f([]),m(void 0),O(!1),b(!1),x(!1)},[t]),p.useEffect(()=>{if(!v)return;function D(Q){var F;(F=S.current)!=null&&F.contains(Q.target)||x(!1)}return document.addEventListener("pointerdown",D),()=>document.removeEventListener("pointerdown",D)},[v]);async function T(D,Q){var z;const F=D.trim();if(!F||!((z=E.find(B=>B.id===Q))!=null&&z.ready))return;const L=++w.current;b(!0),O(!0);let H;try{H=await I6e(Q,F,{userId:e,appId:t})}catch(B){const V=B instanceof Error?B.message:String(B);H={results:[],note:`搜索失败:${V}`}}L===w.current&&(f(H.results),m(H.note),b(!1))}function C(D){w.current+=1,u(D),f([]),m(void 0),O(!1),b(!1)}function A(D){w.current+=1,l(D),x(!1),f([]),m(void 0),O(!1),b(!1)}const j=!!(k!=null&&k.ready),M=t?a==="web"?"在网络中检索":a==="knowledge"?`在 ${(_==null?void 0:_.name)??"当前 Agent 的知识库"} 中检索`:a==="memory"?`在 ${(_==null?void 0:_.name)??"当前用户的长期记忆"} 中检索`:"在当前 Agent 的会话中检索":"请先选择 Agent",I=_!=null&&_.backend?TC(_.backend):"";return o.jsxs("div",{className:"search",children:[o.jsxs("div",{className:"search-box",children:[o.jsxs("div",{className:"search-source-picker-wrap",ref:S,children:[o.jsxs("button",{className:"search-source-picker",type:"button","aria-label":`搜索类型:${(k==null?void 0:k.label)??"未选择"}`,"aria-haspopup":"listbox","aria-expanded":v,onClick:()=>x(D=>!D),children:[o.jsx("span",{children:(k==null?void 0:k.label)??"搜索类型"}),I&&o.jsx("small",{children:I}),o.jsx(Q6e,{open:v})]}),v&&o.jsx("div",{className:"search-source-menu",role:"listbox","aria-label":"选择搜索类型",children:E.map(D=>{var L,H;const Q=D.id==="knowledge"?(L=n==null?void 0:n.components)==null?void 0:L.find(z=>z.source==="knowledgebase"||z.kind==="knowledgebase"):D.id==="memory"?(H=n==null?void 0:n.components)==null?void 0:H.find(z=>z.source==="long_term_memory"||z.kind==="memory"):void 0,F=Q?[Q.name,Q.backend?TC(Q.backend):""].filter(Boolean).join(" · "):D.ready?D.description:D.unavailableLabel;return o.jsxs("button",{type:"button",role:"option","aria-selected":a===D.id,disabled:!D.ready,onClick:()=>A(D.id),children:[o.jsx("span",{children:D.label}),F&&o.jsx("small",{children:F})]},D.id)})})]}),o.jsx("span",{className:"search-box-divider","aria-hidden":!0}),o.jsx("input",{className:"search-input",value:c,onChange:D=>C(D.target.value),onKeyDown:D=>{D.key==="Enter"&&(D.preventDefault(),T(c,a))},placeholder:M,disabled:!j,autoFocus:!0}),o.jsx("button",{className:"search-go",onClick:()=>void T(c,a),disabled:!c.trim()||g,"aria-label":"搜索",children:g?o.jsx(or,{className:"icon spin"}):o.jsx(B6e,{className:"icon"})})]}),o.jsx("div",{className:"search-results",children:j?y?g?null:h?o.jsx("div",{className:"search-empty",children:h}):d.length===0&&y?o.jsxs("div",{className:"search-empty",children:["未找到匹配「",c.trim(),"」的结果。"]}):d.map((D,Q)=>o.jsx(V6e,{result:D,agentLabel:i,onOpen:s},Q)):o.jsx("div",{className:"search-empty",children:a==="web"?"输入关键词后回车或点击按钮,通过 web_search 工具检索。":a==="knowledge"?"输入问题,检索当前 Agent 挂载的知识库。":a==="memory"?"输入线索,检索当前用户跨会话保存的长期记忆。":"输入关键词后回车或点击按钮,搜索当前 Agent 的会话。"}):o.jsx("div",{className:"search-empty",children:t?r?"正在读取当前 Agent 的检索能力…":(k==null?void 0:k.unavailableLabel)??"当前 Agent 未挂载该数据源":"选择一个 Agent 后,即可检索会话、网络及其挂载的数据源。"})})]})}function V6e({result:e,agentLabel:t,onOpen:n}){switch(e.type){case"session":return o.jsxs("button",{className:"search-result",onClick:()=>n(e.appId,e.sessionId),children:[o.jsx(Lae,{className:"search-result-icon"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsx("span",{className:"search-result-title",children:e.title}),o.jsxs("span",{className:"search-result-meta",children:[t(e.appId),e.ts?` · ${uq(e.ts)}`:""]})]}),o.jsx("div",{className:"search-result-snippet",children:e.snippet})]})]});case"web":return o.jsxs("a",{className:"search-result",href:e.url||void 0,target:"_blank",rel:"noreferrer noopener",children:[o.jsx(jN,{className:"search-result-icon"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsx("span",{className:"search-result-title",children:e.title||e.url}),o.jsxs("span",{className:"search-result-meta",children:[e.siteName,e.url&&o.jsx(Dg,{className:"search-result-ext"})]})]}),e.summary&&o.jsx("div",{className:"search-result-snippet",children:e.summary})]})]});case"knowledge":return o.jsxs("div",{className:"search-result search-result-static",children:[o.jsx(dq,{source:"knowledge"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsxs("span",{className:"search-result-title",children:["知识片段 ",e.index+1]}),o.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${TC(e.sourceType)}`:""]})]}),o.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});case"memory":return o.jsxs("div",{className:"search-result search-result-static",children:[o.jsx(dq,{source:"memory"}),o.jsxs("div",{className:"search-result-body",children:[o.jsxs("div",{className:"search-result-head",children:[o.jsxs("span",{className:"search-result-title",children:["记忆片段 ",e.index+1]}),o.jsxs("span",{className:"search-result-meta",children:[e.sourceName,e.sourceType?` · ${TC(e.sourceType)}`:"",e.ts?` · ${uq(e.ts)}`:""]})]}),o.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});default:return null}}function dq({source:e,className:t="search-result-icon"}){return e==="knowledge"?o.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[o.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"}),o.jsx("path",{d:"M8.25 9h7.5M8.25 12.25h6"})]}):o.jsxs("svg",{className:t,viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:[o.jsx("path",{d:"M12 4.5a7.5 7.5 0 1 0 7.5 7.5"}),o.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"})]})}function H6e({filled:e=!1,...t}){return o.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:[o.jsx("rect",{x:"3.5",y:"9.3",width:"4.5",height:"10.2",rx:"1.5"}),o.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 q6e({filled:e=!1,...t}){return o.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:[o.jsx("rect",{x:"3.5",y:"4.5",width:"4.5",height:"10.2",rx:"1.5"}),o.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"})]})}function Vue(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M5.25 4.25h9.5a2.5 2.5 0 0 1 2.5 2.5v3.5"}),o.jsx("path",{d:"M13.25 17.75h-8a2.5 2.5 0 0 1-2.5-2.5v-8a3 3 0 0 1 3-3"}),o.jsx("path",{d:"M7 8.25h5.5M7 11.75h3.25"}),o.jsx("path",{d:"m13.35 16.65.42-2.16 4.76-4.76a1.35 1.35 0 0 1 1.91 1.91l-4.76 4.76-2.33.25Z"}),o.jsx("path",{d:"m17.65 10.6 1.9 1.9"})]})}const nj="/assets/media/logo-DCsNZy-k.svg",p7="data:image/svg+xml,%3csvg%20width='28'%20height='23'%20viewBox='0%200%2028%2023'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M17.1957%209.44218C17.0253%209.58161%2016.7774%209.47317%2016.7774%209.24079V8.01696V0.611967C16.7774%200.395085%2016.514%200.271152%2016.3591%200.410576L6.04172%209.16334C5.87132%209.30276%205.62345%209.19432%205.62345%208.96194V2.98218C5.62345%202.81178%205.48403%202.67235%205.31362%202.67235H0.309832C0.139424%202.67235%200%202.81178%200%202.98218V21.7115C0%2021.9284%200.263357%2022.0524%200.418273%2021.9129L10.7202%2013.1602C10.8906%2013.0207%2011.1385%2013.1292%2011.1385%2013.3616V22.0059C11.1385%2022.2228%2011.4018%2022.3467%2011.5567%2022.2073L21.8586%2013.4545C22.0291%2013.3151%2022.2769%2013.4235%2022.2769%2013.6559V19.6357C22.2769%2019.8061%2022.4163%2019.9455%2022.5868%2019.9455H27.5905C27.7609%2019.9455%2027.9004%2019.8061%2027.9004%2019.6357V0.890816C27.9004%200.673934%2027.637%200.550001%2027.4821%200.689425L17.1957%209.44218Z'%20fill='%230066FC'/%3e%3c/svg%3e",fq="(max-width: 860px)";function hq({title:e}){const t=p.useRef(null),[n,r]=p.useState({left:!1,right:!1}),i=()=>{const s=t.current;if(!s)return;const a={left:s.scrollLeft>1,right:s.scrollLeft+s.clientWidthl.left===a.left&&l.right===a.right?l:a)};return p.useLayoutEffect(()=>{const s=t.current;if(!s)return;i();const a=new ResizeObserver(i);return a.observe(s),s.firstElementChild&&a.observe(s.firstElementChild),()=>a.disconnect()},[e]),o.jsx("span",{ref:t,className:`history-title${n.left?" has-left-fade":""}${n.right?" has-right-fade":""}`,onScroll:i,onPointerEnter:i,children:o.jsx("span",{className:"history-title-text",children:e})})}function X6e(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"7",cy:"7",r:"2.25"}),o.jsx("circle",{cx:"17",cy:"7",r:"2.25"}),o.jsx("circle",{cx:"7",cy:"17",r:"2.25"}),o.jsx("circle",{cx:"17",cy:"17",r:"2.25"})]})}function G6e(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 W6e={admin:"管理员",developer:"开发者",user:"普通用户"};function Y6e({activePage:e,access:t,userInfo:n,onAgentKitCli:r,onDeveloperResources:i,onSystemInfo:s,onIssueFeedback:a,onLogout:l}){const[c,u]=p.useState(!1),[d,f]=p.useState("");if(!n)return null;const h=xIe(n)||"用户",m=typeof n.email=="string"?n.email.trim():"",g=G6e(h),b=vIe(n),y=b===d?"":b;return o.jsxs("div",{className:"sidebar-user",children:[o.jsxs("div",{className:"sidebar-user-row",children:[o.jsxs("button",{type:"button",className:"sidebar-user-btn",onClick:()=>u(O=>!O),title:h,children:[o.jsx("span",{className:`account-avatar${y?" has-image":""}`,style:g,"aria-hidden":"true",children:y?o.jsx("img",{className:"account-avatar-image",src:y,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>f(y)}):null}),o.jsx("span",{className:"sidebar-user-identity",children:o.jsx("span",{className:"sidebar-user-name",children:h})})]}),o.jsxs("div",{className:"sidebar-user-shortcuts","aria-label":"快捷入口",children:[o.jsx(Eo,{compact:!0,content:"体验 AgentKit CLI",children:o.jsx("button",{type:"button",className:"sidebar-user-shortcut",onClick:r,"aria-label":"体验 AgentKit CLI",children:o.jsx(gRe,{className:"icon"})})}),o.jsx(Eo,{compact:!0,content:"开发者资源",children:o.jsx("button",{type:"button",className:`sidebar-user-shortcut${e==="developer-resources"?" is-active":""}`,onClick:i,"aria-label":"开发者资源","aria-current":e==="developer-resources"?"page":void 0,children:o.jsx(iRe,{className:"icon"})})})]})]}),c&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>u(!1)}),o.jsxs("div",{className:"account-pop sidebar-user-pop",children:[o.jsxs("div",{className:"account-head",children:[o.jsx("span",{className:`account-avatar account-avatar--lg${y?" has-image":""}`,style:g,"aria-hidden":"true",children:y?o.jsx("img",{className:"account-avatar-image",src:y,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>f(y)}):null}),o.jsxs("div",{className:"account-id",children:[o.jsxs("div",{className:"account-name-row",children:[o.jsx("div",{className:"account-name",children:h}),o.jsx(Js,{color:"secondary",size:"sm",variant:"soft",pill:!0,children:W6e[t.role]})]}),m&&m!==h&&o.jsx("div",{className:"account-sub",children:m})]})]}),o.jsxs("button",{type:"button",className:"account-action",onClick:()=>{u(!1),s()},children:[o.jsx(Ed,{className:"icon"})," 系统信息"]}),o.jsxs("button",{type:"button",className:"account-action",onClick:()=>{u(!1),a()},children:[o.jsx(Vue,{className:"icon"})," 问题反馈"]}),o.jsxs("button",{type:"button",className:"account-action",onClick:()=>{u(!1),l()},children:[o.jsx(KRe,{className:"icon"})," 退出登录"]})]})]})]})}function Z6e({branding:e,cloudProvider:t,sessions:n,currentSessionId:r,activePage:i,features:s,access:a,streamingSids:l,evaluatingSids:c,sandboxHistory:u,onNewChat:d,onSearch:f,onQuickCreate:h,onLibrary:m,onAddAgent:g,onMyAgents:b,onWorkspace:y,onApplications:O,onCronJobs:v,onAgentKitCli:x,onDeveloperResources:w,onSystemInfo:S,onIssueFeedback:E,onPickSession:k,onDeleteSession:_,userInfo:T,onLogout:C}){const A=L=>(s==null?void 0:s[L])!==!1,[j,M]=p.useState(null),I=p.useRef(typeof window<"u"&&window.matchMedia(fq).matches),[$,N]=p.useState(I.current),D=n.map(L=>({id:L.id,title:QN(L.events),createdAt:(L.lastUpdateTime??0)*1e3})).sort((L,H)=>H.createdAt-L.createdAt),Q=()=>{I.current=!1,N(L=>!L),M(null)};p.useEffect(()=>{const L=window.matchMedia(fq),H=z=>{z.matches?N(B=>B||(I.current=!0,!0)):I.current&&(I.current=!1,N(!1))};return L.addEventListener("change",H),()=>L.removeEventListener("change",H)},[]);const F=t==="byteplus"?p7:nj;return o.jsxs("aside",{className:`sidebar ${$?"is-collapsed":""}`,children:[o.jsxs("div",{className:"sidebar-top",children:[o.jsxs("div",{className:"sidebar-brand-row",children:[o.jsxs("button",{type:"button",className:"brand",onClick:d,"aria-label":"返回首页",title:"返回首页",children:[o.jsx("img",{className:"brand-logo",src:e.logoUrl||F,width:20,height:20,alt:"","aria-hidden":!0}),o.jsx("span",{className:"brand-title",children:e.title})]}),o.jsx("button",{type:"button",className:"sidebar-collapse-toggle",onClick:Q,"aria-label":$?"展开侧边栏":"收起侧边栏",title:$?"展开侧边栏":"收起侧边栏",children:$?o.jsx(P6e,{className:"icon"}):o.jsx(D6e,{className:"icon"})})]}),o.jsxs("nav",{className:"sidebar-nav","aria-label":"主导航",children:[A("newChat")&&o.jsxs("button",{className:`new-chat new-chat--conversation${i==="new-chat"?" is-active":""}`,onClick:d,"aria-label":"新会话","aria-current":i==="new-chat"?"page":void 0,title:"新会话",children:[o.jsx(M6e,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"新会话"})]}),A("search")&&o.jsx(U6e,{active:i==="search",onClick:f}),o.jsxs("button",{className:`new-chat new-chat--agents${i==="agents"?" is-active":""}`,onClick:b,"aria-label":"智能体","aria-current":i==="agents"?"page":void 0,title:"智能体",children:[o.jsx($6e,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"智能体"})]}),o.jsxs("button",{className:`new-chat new-chat--workspaces${i==="workspaces"?" is-active":""}`,onClick:y,"aria-label":"工作区","aria-current":i==="workspaces"?"page":void 0,title:"工作区",children:[o.jsx(RRe,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"工作区"})]}),o.jsxs("button",{className:`new-chat new-chat--library${i==="library"?" is-active":""}`,onClick:m,"aria-label":"资源库","aria-current":i==="library"?"page":void 0,title:"资源库",children:[o.jsx(zue,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"资源库"})]}),o.jsxs("button",{className:`new-chat new-chat--cronjobs${i==="cronjobs"?" is-active":""}`,onClick:v,"aria-label":"定时任务","aria-current":i==="cronjobs"?"page":void 0,title:"定时任务",children:[o.jsx(K8,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"定时任务"})]}),o.jsxs("button",{className:`new-chat new-chat--applications${i==="applications"?" is-active":""}`,onClick:O,"aria-label":"自动化","aria-current":i==="applications"?"page":void 0,title:"自动化",children:[o.jsx(X6e,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"自动化"})]})]})]}),A("history")&&o.jsxs("div",{className:"sidebar-history",children:[o.jsxs("div",{className:"history-head",children:[o.jsx("span",{children:"历史会话"}),A("newChat")&&o.jsx("button",{type:"button",className:"history-new-chat",onClick:(u==null?void 0:u.onNew)??d,disabled:u==null?void 0:u.newDisabled,"aria-label":"新建会话",title:"新建会话",children:o.jsx(vo,{className:"icon"})})]}),o.jsx("div",{className:"history-list",children:u?o.jsxs(o.Fragment,{children:[u.loading&&u.threads.length===0?o.jsx("div",{className:"history-empty",role:"status",children:"正在加载历史会话…"}):null,u.error?o.jsx("div",{className:"history-error",role:"alert",children:u.error}):null,!u.loading&&!u.error&&u.threads.length===0?o.jsx("div",{className:"history-empty",children:"暂无会话"}):null,u.threads.map(L=>{const H=L.id===u.currentThreadId,z=L.name||L.preview||`Thread ${L.id.slice(0,8)}`,B=L.id===u.busyThreadId;return o.jsxs("div",{className:`history-item ${H?"active":""}`,children:[o.jsxs("button",{type:"button",className:"history-item-btn",onClick:()=>u.onSelect(L.id),"aria-current":H?"page":void 0,title:z,disabled:B,children:[o.jsx(hq,{title:z}),H?o.jsx("span",{className:"history-current-badge",children:"当前"}):null]}),o.jsx("button",{type:"button",className:"history-more","aria-label":`管理历史会话:${z}`,title:"更多",disabled:B,onClick:()=>M(V=>V===L.id?null:L.id),children:o.jsx(yH,{className:"icon"})}),j===L.id?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>M(null)}),o.jsx("div",{className:"history-menu",children:o.jsxs("button",{type:"button",className:"menu-item menu-item--danger",onClick:()=>{M(null),u.onDelete(L)},children:[o.jsx(Up,{className:"icon"})," 删除"]})})]}):null]},L.id)}),u.hasMore?o.jsx("button",{type:"button",className:"history-load-more",disabled:u.loading,onClick:u.onLoadMore,children:u.loading?"加载中…":"加载更多"}):null]}):o.jsxs(o.Fragment,{children:[D.length===0?o.jsx("div",{className:"history-empty",children:"暂无会话"}):null,D.map(L=>{const H=L.id===r,z=(l==null?void 0:l.has(L.id))===!0,B=!z&&(c==null?void 0:c.has(L.id))===!0;return o.jsxs("div",{className:`history-item ${H?"active":""}`,children:[o.jsxs("button",{className:"history-item-btn",onClick:()=>k(L.id),"aria-current":H?"page":void 0,title:L.title,children:[o.jsx(hq,{title:L.title}),B&&o.jsxs("span",{className:"history-evaluating-status",title:"正在自动评测",children:[o.jsx("span",{className:"history-evaluating","aria-hidden":"true"}),"评测中"]})]}),o.jsxs("div",{className:"history-action-slot",children:[z?o.jsx(ZS,{className:"history-streaming-indicator",size:12,role:"status","aria-label":"正在生成"}):null,o.jsx("button",{type:"button",className:"history-more","aria-label":`管理历史会话:${L.title}`,title:"更多",onClick:()=>M(V=>V===L.id?null:L.id),children:o.jsx(yH,{className:"icon"})})]}),j===L.id&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>M(null)}),o.jsx("div",{className:"history-menu",children:o.jsxs("button",{type:"button",className:"menu-item menu-item--danger",onClick:()=>{M(null),_(L.id)},children:[o.jsx(Up,{className:"icon"})," 删除"]})})]})]},L.id)})]})})]}),o.jsx("div",{className:"sidebar-footer",children:o.jsx(Y6e,{activePage:i,access:a,userInfo:T,onAgentKitCli:x,onDeveloperResources:w,onSystemInfo:S,onIssueFeedback:E,onLogout:C})})]})}function zs(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{}};function rj(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}K_.prototype=rj.prototype={constructor:K_,on:function(e,t){var n=this._,r=J6e(e+"",n),i,s=-1,a=r.length;if(arguments.length<2){for(;++s0)for(var n=new Array(i),r=0,i,s;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),mq.hasOwnProperty(t)?{space:mq[t],local:e}:e}function t$e(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===v4&&t.documentElement.namespaceURI===v4?t.createElement(e):t.createElementNS(n,e)}}function n$e(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Hue(e){var t=ij(e);return(t.local?n$e:t$e)(t)}function r$e(){}function m7(e){return e==null?r$e:function(){return this.querySelector(e)}}function i$e(e){typeof e!="function"&&(e=m7(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=x&&(x=v+1);!(S=y[x])&&++x=0;)(a=r[i])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function A$e(e){e||(e=N$e);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,r=n.length,i=new Array(r),s=0;st?1:e>=t?0:NaN}function j$e(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function R$e(){return Array.from(this)}function I$e(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?V$e:typeof t=="function"?q$e:H$e)(e,t,n??"")):n1(this.node(),e)}function n1(e,t){return e.style.getPropertyValue(t)||Yue(e).getComputedStyle(e,null).getPropertyValue(t)}function G$e(e){return function(){delete this[e]}}function W$e(e,t){return function(){this[e]=t}}function Y$e(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Z$e(e,t){return arguments.length>1?this.each((t==null?G$e:typeof t=="function"?Y$e:W$e)(e,t)):this.node()[e]}function Zue(e){return e.trim().split(/^|\s+/)}function g7(e){return e.classList||new Kue(e)}function Kue(e){this._node=e,this._names=Zue(e.getAttribute("class")||"")}Kue.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 Jue(e,t){for(var n=g7(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function k8e(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,s;n()=>e;function w4(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:s,x:a,y:l,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:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}w4.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function P8e(e){return!e.ctrlKey&&!e.button}function M8e(){return this.parentNode}function L8e(e,t){return t??{x:e.x,y:e.y}}function $8e(){return navigator.maxTouchPoints||"ontouchstart"in this}function sde(){var e=P8e,t=M8e,n=L8e,r=$8e,i={},s=rj("start","drag","end"),a=0,l,c,u,d,f=0;function h(w){w.on("mousedown.drag",m).filter(r).on("touchstart.drag",y).on("touchmove.drag",O,D8e).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(w,S){if(!(d||!e.call(this,w,S))){var E=x(this,t.call(this,w,S),w,S,"mouse");E&&(Tl(w.view).on("mousemove.drag",g,jw).on("mouseup.drag",b,jw),rde(w.view),A5(w),u=!1,l=w.clientX,c=w.clientY,E("start",w))}}function g(w){if(my(w),!u){var S=w.clientX-l,E=w.clientY-c;u=S*S+E*E>f}i.mouse("drag",w)}function b(w){Tl(w.view).on("mousemove.drag mouseup.drag",null),ide(w.view,u),my(w),i.mouse("end",w)}function y(w,S){if(e.call(this,w,S)){var E=w.changedTouches,k=t.call(this,w,S),_=E.length,T,C;for(T=0;T<_;++T)(C=x(this,k,w,S,E[T].identifier,E[T]))&&(A5(w),C("start",w,E[T]))}}function O(w){var S=w.changedTouches,E=S.length,k,_;for(k=0;k>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?s2(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?s2(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=Q8e.exec(e))?new Vo(t[1],t[2],t[3],1):(t=U8e.exec(e))?new Vo(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=F8e.exec(e))?s2(t[1],t[2],t[3],t[4]):(t=z8e.exec(e))?s2(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=V8e.exec(e))?wq(t[1],t[2]/100,t[3]/100,1):(t=H8e.exec(e))?wq(t[1],t[2]/100,t[3]/100,t[4]):gq.hasOwnProperty(e)?Oq(gq[e]):e==="transparent"?new Vo(NaN,NaN,NaN,0):null}function Oq(e){return new Vo(e>>16&255,e>>8&255,e&255,1)}function s2(e,t,n,r){return r<=0&&(e=t=n=NaN),new Vo(e,t,n,r)}function G8e(e){return e instanceof sE||(e=$g(e)),e?(e=e.rgb(),new Vo(e.r,e.g,e.b,e.opacity)):new Vo}function S4(e,t,n,r){return arguments.length===1?G8e(e):new Vo(e,t,n,r??1)}function Vo(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}b7(Vo,S4,ade(sE,{brighter(e){return e=e==null?AC:Math.pow(AC,e),new Vo(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Rw:Math.pow(Rw,e),new Vo(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Vo(vg(this.r),vg(this.g),vg(this.b),NC(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:xq,formatHex:xq,formatHex8:W8e,formatRgb:vq,toString:vq}));function xq(){return`#${ig(this.r)}${ig(this.g)}${ig(this.b)}`}function W8e(){return`#${ig(this.r)}${ig(this.g)}${ig(this.b)}${ig((isNaN(this.opacity)?1:this.opacity)*255)}`}function vq(){const e=NC(this.opacity);return`${e===1?"rgb(":"rgba("}${vg(this.r)}, ${vg(this.g)}, ${vg(this.b)}${e===1?")":`, ${e})`}`}function NC(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function vg(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ig(e){return e=vg(e),(e<16?"0":"")+e.toString(16)}function wq(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new cu(e,t,n,r)}function ode(e){if(e instanceof cu)return new cu(e.h,e.s,e.l,e.opacity);if(e instanceof sE||(e=$g(e)),!e)return new cu;if(e instanceof cu)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),s=Math.max(t,n,r),a=NaN,l=s-i,c=(s+i)/2;return l?(t===s?a=(n-r)/l+(n0&&c<1?0:a,new cu(a,l,c,e.opacity)}function Y8e(e,t,n,r){return arguments.length===1?ode(e):new cu(e,t,n,r??1)}function cu(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}b7(cu,Y8e,ade(sE,{brighter(e){return e=e==null?AC:Math.pow(AC,e),new cu(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Rw:Math.pow(Rw,e),new cu(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,i=2*n-r;return new Vo(N5(e>=240?e-240:e+120,i,r),N5(e,i,r),N5(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new cu(Sq(this.h),a2(this.s),a2(this.l),NC(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=NC(this.opacity);return`${e===1?"hsl(":"hsla("}${Sq(this.h)}, ${a2(this.s)*100}%, ${a2(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Sq(e){return e=(e||0)%360,e<0?e+360:e}function a2(e){return Math.max(0,Math.min(1,e||0))}function N5(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 sj=e=>()=>e;function lde(e,t){return function(n){return e+n*t}}function Z8e(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 pMt(e,t){var n=t-e;return n?lde(e,n>180||n<-180?n-360*Math.round(n/360):n):sj(isNaN(e)?t:e)}function K8e(e){return(e=+e)==1?cde:function(t,n){return n-t?Z8e(t,n,e):sj(isNaN(t)?n:t)}}function cde(e,t){var n=t-e;return n?lde(e,n):sj(isNaN(e)?t:e)}const jC=function e(t){var n=K8e(t);function r(i,s){var a=n((i=S4(i)).r,(s=S4(s)).r),l=n(i.g,s.g),c=n(i.b,s.b),u=cde(i.opacity,s.opacity);return function(d){return i.r=a(d),i.g=l(d),i.b=c(d),i.opacity=u(d),i+""}}return r.gamma=e,r}(1);function J8e(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(s){for(i=0;in&&(s=t.slice(n,s),l[a]?l[a]+=s:l[++a]=s),(r=r[0])===(i=i[0])?l[a]?l[a]+=i:l[++a]=i:(l[++a]=null,c.push({i:a,x:Xu(r,i)})),n=j5.lastIndex;return n180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(i(f)+"rotate(",null,r)-2,x:Xu(u,d)})):d&&f.push(i(f)+"rotate("+d+r)}function l(u,d,f,h){u!==d?h.push({i:f.push(i(f)+"skewX(",null,r)-2,x:Xu(u,d)}):d&&f.push(i(f)+"skewX("+d+r)}function c(u,d,f,h,m,g){if(u!==f||d!==h){var b=m.push(i(m)+"scale(",null,",",null,")");g.push({i:b-4,x:Xu(u,f)},{i:b-2,x:Xu(d,h)})}else(f!==1||h!==1)&&m.push(i(m)+"scale("+f+","+h+")")}return function(u,d){var f=[],h=[];return u=e(u),d=e(d),s(u.translateX,u.translateY,d.translateX,d.translateY,f,h),a(u.rotate,d.rotate,f,h),l(u.skewX,d.skewX,f,h),c(u.scaleX,u.scaleY,d.scaleX,d.scaleY,f,h),u=d=null,function(m){for(var g=-1,b=h.length,y;++g=0&&e._call.call(void 0,t),e=e._next;--r1}function _q(){Bg=(IC=Dw.now())+aj,r1=Fx=0;try{p9e()}finally{r1=0,g9e(),Bg=0}}function m9e(){var e=Dw.now(),t=e-IC;t>hde&&(aj-=t,IC=e)}function g9e(){for(var e,t=RC,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:RC=n);zx=e,_4(r)}function _4(e){if(!r1){Fx&&(Fx=clearTimeout(Fx));var t=e-Bg;t>24?(e<1/0&&(Fx=setTimeout(_q,e-Dw.now()-aj)),tx&&(tx=clearInterval(tx))):(tx||(IC=Dw.now(),tx=setInterval(m9e,hde)),r1=1,pde(_q))}}function Tq(e,t,n){var r=new DC;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var b9e=rj("start","end","cancel","interrupt"),y9e=[],gde=0,Cq=1,T4=2,eT=3,Aq=4,C4=5,tT=6;function oj(e,t,n,r,i,s){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;O9e(e,n,{name:t,index:r,group:i,on:b9e,tween:y9e,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:gde})}function O7(e,t){var n=Cu(e,t);if(n.state>gde)throw new Error("too late; already scheduled");return n}function Cd(e,t){var n=Cu(e,t);if(n.state>eT)throw new Error("too late; already running");return n}function Cu(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function O9e(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=mde(s,0,n.time);function s(u){n.state=Cq,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var d,f,h,m;if(n.state!==Cq)return c();for(d in r)if(m=r[d],m.name===n.name){if(m.state===eT)return Tq(a);m.state===Aq?(m.state=tT,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete r[d]):+dT4&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function W9e(e,t,n){var r,i,s=G9e(t)?O7:Cd;return function(){var a=s(this,e),l=a.on;l!==r&&(i=(r=l).copy()).on(t,n),a.on=i}}function Y9e(e,t){var n=this._id;return arguments.length<2?Cu(this.node(),n).on.on(e):this.each(W9e(n,e,t))}function Z9e(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function K9e(){return this.on("end.remove",Z9e(this._id))}function J9e(e){var t=this._name,n=this._id;typeof e!="function"&&(e=m7(e));for(var r=this._groups,i=r.length,s=new Array(i),a=0;a()=>e;function E7e(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){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:i}})}function _f(e,t,n){this.k=e,this.x=t,this.y=n}_f.prototype={constructor:_f,scale:function(e){return e===1?this:new _f(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new _f(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 lj=new _f(1,0,0);xde.prototype=_f.prototype;function xde(e){for(;!e.__zoom;)if(!(e=e.parentNode))return lj;return e.__zoom}function R5(e){e.stopImmediatePropagation()}function nx(e){e.preventDefault(),e.stopImmediatePropagation()}function k7e(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function _7e(){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 Nq(){return this.__zoom||lj}function T7e(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function C7e(){return navigator.maxTouchPoints||"ontouchstart"in this}function A7e(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>s?(s+a)/2:Math.min(0,s)||Math.max(0,a))}function vde(){var e=k7e,t=_7e,n=A7e,r=T7e,i=C7e,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=J_,u=rj("start","zoom","end"),d,f,h,m=500,g=150,b=0,y=10;function O(I){I.property("__zoom",Nq).on("wheel.zoom",_,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",C).filter(i).on("touchstart.zoom",A).on("touchmove.zoom",j).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}O.transform=function(I,$,N,D){var Q=I.selection?I.selection():I;Q.property("__zoom",Nq),I!==Q?S(I,$,N,D):Q.interrupt().each(function(){E(this,arguments).event(D).start().zoom(null,typeof $=="function"?$.apply(this,arguments):$).end()})},O.scaleBy=function(I,$,N,D){O.scaleTo(I,function(){var Q=this.__zoom.k,F=typeof $=="function"?$.apply(this,arguments):$;return Q*F},N,D)},O.scaleTo=function(I,$,N,D){O.transform(I,function(){var Q=t.apply(this,arguments),F=this.__zoom,L=N==null?w(Q):typeof N=="function"?N.apply(this,arguments):N,H=F.invert(L),z=typeof $=="function"?$.apply(this,arguments):$;return n(x(v(F,z),L,H),Q,a)},N,D)},O.translateBy=function(I,$,N,D){O.transform(I,function(){return n(this.__zoom.translate(typeof $=="function"?$.apply(this,arguments):$,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),a)},null,D)},O.translateTo=function(I,$,N,D,Q){O.transform(I,function(){var F=t.apply(this,arguments),L=this.__zoom,H=D==null?w(F):typeof D=="function"?D.apply(this,arguments):D;return n(lj.translate(H[0],H[1]).scale(L.k).translate(typeof $=="function"?-$.apply(this,arguments):-$,typeof N=="function"?-N.apply(this,arguments):-N),F,a)},D,Q)};function v(I,$){return $=Math.max(s[0],Math.min(s[1],$)),$===I.k?I:new _f($,I.x,I.y)}function x(I,$,N){var D=$[0]-N[0]*I.k,Q=$[1]-N[1]*I.k;return D===I.x&&Q===I.y?I:new _f(I.k,D,Q)}function w(I){return[(+I[0][0]+ +I[1][0])/2,(+I[0][1]+ +I[1][1])/2]}function S(I,$,N,D){I.on("start.zoom",function(){E(this,arguments).event(D).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(D).end()}).tween("zoom",function(){var Q=this,F=arguments,L=E(Q,F).event(D),H=t.apply(Q,F),z=N==null?w(H):typeof N=="function"?N.apply(Q,F):N,B=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),V=Q.__zoom,W=typeof $=="function"?$.apply(Q,F):$,le=c(V.invert(z).concat(B/V.k),W.invert(z).concat(B/W.k));return function(be){if(be===1)be=W;else{var re=le(be),q=B/re[2];be=new _f(q,z[0]-re[0]*q,z[1]-re[1]*q)}L.zoom(null,be)}})}function E(I,$,N){return!N&&I.__zooming||new k(I,$)}function k(I,$){this.that=I,this.args=$,this.active=0,this.sourceEvent=null,this.extent=t.apply(I,$),this.taps=0}k.prototype={event:function(I){return I&&(this.sourceEvent=I),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(I,$){return this.mouse&&I!=="mouse"&&(this.mouse[1]=$.invert(this.mouse[0])),this.touch0&&I!=="touch"&&(this.touch0[1]=$.invert(this.touch0[0])),this.touch1&&I!=="touch"&&(this.touch1[1]=$.invert(this.touch1[0])),this.that.__zoom=$,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(I){var $=Tl(this.that).datum();u.call(I,this.that,new E7e(I,{sourceEvent:this.sourceEvent,target:O,transform:this.that.__zoom,dispatch:u}),$)}};function _(I,...$){if(!e.apply(this,arguments))return;var N=E(this,$).event(I),D=this.__zoom,Q=Math.max(s[0],Math.min(s[1],D.k*Math.pow(2,r.apply(this,arguments)))),F=au(I);if(N.wheel)(N.mouse[0][0]!==F[0]||N.mouse[0][1]!==F[1])&&(N.mouse[1]=D.invert(N.mouse[0]=F)),clearTimeout(N.wheel);else{if(D.k===Q)return;N.mouse=[F,D.invert(F)],nT(this),N.start()}nx(I),N.wheel=setTimeout(L,g),N.zoom("mouse",n(x(v(D,Q),N.mouse[0],N.mouse[1]),N.extent,a));function L(){N.wheel=null,N.end()}}function T(I,...$){if(h||!e.apply(this,arguments))return;var N=I.currentTarget,D=E(this,$,!0).event(I),Q=Tl(I.view).on("mousemove.zoom",z,!0).on("mouseup.zoom",B,!0),F=au(I,N),L=I.clientX,H=I.clientY;rde(I.view),R5(I),D.mouse=[F,this.__zoom.invert(F)],nT(this),D.start();function z(V){if(nx(V),!D.moved){var W=V.clientX-L,le=V.clientY-H;D.moved=W*W+le*le>b}D.event(V).zoom("mouse",n(x(D.that.__zoom,D.mouse[0]=au(V,N),D.mouse[1]),D.extent,a))}function B(V){Q.on("mousemove.zoom mouseup.zoom",null),ide(V.view,D.moved),nx(V),D.event(V).end()}}function C(I,...$){if(e.apply(this,arguments)){var N=this.__zoom,D=au(I.changedTouches?I.changedTouches[0]:I,this),Q=N.invert(D),F=N.k*(I.shiftKey?.5:2),L=n(x(v(N,F),D,Q),t.apply(this,$),a);nx(I),l>0?Tl(this).transition().duration(l).call(S,L,D,I):Tl(this).call(O.transform,L,D,I)}}function A(I,...$){if(e.apply(this,arguments)){var N=I.touches,D=N.length,Q=E(this,$,I.changedTouches.length===D).event(I),F,L,H,z;for(R5(I),L=0;L`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.`},Pw=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],wde=["Enter"," ","Escape"],Sde={"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 i1;(function(e){e.Strict="strict",e.Loose="loose"})(i1||(i1={}));var wg;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(wg||(wg={}));var Mw;(function(e){e.Partial="partial",e.Full="full"})(Mw||(Mw={}));const Ede={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var ip;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ip||(ip={}));var Lw;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Lw||(Lw={}));var zt;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(zt||(zt={}));const jq={[zt.Left]:zt.Right,[zt.Right]:zt.Left,[zt.Top]:zt.Bottom,[zt.Bottom]:zt.Top};function kde(e){return e===null?null:e?"valid":"invalid"}const _de=e=>"id"in e&&"source"in e&&"target"in e,N7e=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),v7=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),aE=(e,t=[0,0])=>{const{width:n,height:r}=gh(e),i=e.origin??t,s=n*i[0],a=r*i[1];return{x:e.position.x-s,y:e.position.y-a}},j7e=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,i)=>{const s=typeof i=="string";let a=!t.nodeLookup&&!s?i:void 0;t.nodeLookup&&(a=s?t.nodeLookup.get(i):v7(i)?i:t.nodeLookup.get(i.id));const l=a?PC(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return cj(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return uj(n)},oE=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(i=>{(t.filter===void 0||t.filter(i))&&(n=cj(n,PC(i)),r=!0)}),r?uj(n):{x:0,y:0,width:0,height:0}},w7=(e,t,[n,r,i]=[0,0,1],s=!1,a=!1)=>{const l={...J1(t,[n,r,i]),width:t.width/i,height:t.height/i},c=[];for(const u of e.values()){const{measured:d,selectable:f=!0,hidden:h=!1}=u;if(a&&!f||h)continue;const m=d.width??u.width??u.initialWidth??null,g=d.height??u.height??u.initialHeight??null,b=$w(l,a1(u)),y=(m??0)*(g??0),O=s&&b>0;(!u.internals.handleBounds||O||b>=y||u.dragging)&&c.push(u)}return c},R7e=(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 I7e(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(i=>i.id)):null;return e.forEach(i=>{i.measured.width&&i.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!i.hidden)&&(!r||r.has(i.id))&&n.set(i.id,i)}),n}async function D7e({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:s},a){if(e.size===0)return!0;const l=I7e(e,a),c=oE(l),u=E7(c,t,n,(a==null?void 0:a.minZoom)??i,(a==null?void 0:a.maxZoom)??s,(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 Tde({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:s}){const a=n.get(e),l=a.parentId?n.get(a.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},d=a.origin??r;let f=a.extent||i;if(a.extent==="parent"&&!a.expandParent)if(!l)s==null||s("005",vu.error005());else{const m=l.measured.width,g=l.measured.height;m&&g&&(f=[[c,u],[c+m,u+g]])}else l&&Ug(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=Ug(f)?Qg(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(s==null||s("015",vu.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 P7e({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){const s=new Set(e.map(h=>h.id)),a=[];for(const h of n){if(h.deletable===!1)continue;const m=s.has(h.id),g=!m&&h.parentId&&a.find(b=>b.id===h.parentId);(m||g)&&a.push(h)}const l=new Set(t.map(h=>h.id)),c=r.filter(h=>h.deletable!==!1),d=R7e(a,c);for(const h of c)l.has(h.id)&&!d.find(g=>g.id===h.id)&&d.push(h);if(!i)return{edges:d,nodes:a};const f=await i({nodes:a,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:a}:{edges:[],nodes:[]}:f}const s1=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Qg=(e={x:0,y:0},t,n)=>({x:s1(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:s1(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function Cde(e,t,n){const{width:r,height:i}=gh(n),{x:s,y:a}=n.internals.positionAbsolute;return Qg(e,[[s,a],[s+r,a+i]],t)}const Rq=(e,t,n)=>en?-s1(Math.abs(e-n),1,t)/t:0,S7=(e,t,n=15,r=40)=>{const i=Rq(e.x,r,t.width-r)*n,s=Rq(e.y,r,t.height-r)*n;return[i,s]},cj=(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)}),A4=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),uj=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),a1=(e,t=[0,0])=>{var i,s;const{x:n,y:r}=v7(e)?e.internals.positionAbsolute:aE(e,t);return{x:n,y:r,width:((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0,height:((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0}},PC=(e,t=[0,0])=>{var i,s;const{x:n,y:r}=v7(e)?e.internals.positionAbsolute:aE(e,t);return{x:n,y:r,x2:n+(((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0),y2:r+(((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0)}},Ade=(e,t)=>uj(cj(A4(e),A4(t))),$w=(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)},Iq=e=>du(e.width)&&du(e.height)&&du(e.x)&&du(e.y),du=e=>!isNaN(e)&&isFinite(e),Nde=(e,t)=>(n,r)=>{},lE=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),J1=({x:e,y:t},[n,r,i],s=!1,a=[1,1])=>{const l={x:(e-n)/i,y:(t-r)/i};return s?lE(l,a):l},o1=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function G0(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 M7e(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=G0(e,n),i=G0(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e=="object"){const r=G0(e.top??e.y??0,n),i=G0(e.bottom??e.y??0,n),s=G0(e.left??e.x??0,t),a=G0(e.right??e.x??0,t);return{top:r,right:a,bottom:i,left:s,x:s+a,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function L7e(e,t,n,r,i,s){const{x:a,y:l}=o1(e,[t,n,r]),{x:c,y:u}=o1({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=i-c,f=s-u;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(d),bottom:Math.floor(f)}}const E7=(e,t,n,r,i,s)=>{const a=M7e(s,t,n),l=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(l,c),d=s1(u,r,i),f=e.x+e.width/2,h=e.y+e.height/2,m=t/2-f*d,g=n/2-h*d,b=L7e(e,m,g,d,t,n),y={left:Math.min(b.left-a.left,0),top:Math.min(b.top-a.top,0),right:Math.min(b.right-a.right,0),bottom:Math.min(b.bottom-a.bottom,0)};return{x:m-y.left+y.right,y:g-y.top+y.bottom,zoom:d}},Bw=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Ug(e){return e!=null&&e!=="parent"}function gh(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 k7(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 jde(e,t={width:0,height:0},n,r,i){const s={...e},a=r.get(n);if(a){const l=a.origin||i;s.x+=a.internals.positionAbsolute.x-(t.width??0)*l[0],s.y+=a.internals.positionAbsolute.y-(t.height??0)*l[1]}return s}function Dq(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function $7e(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}function B7e(e){return{...Sde,...e||{}}}function Av(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){const{x:s,y:a}=fu(e),l=J1({x:s-((i==null?void 0:i.left)??0),y:a-((i==null?void 0:i.top)??0)},r),{x:c,y:u}=n?lE(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const _7=e=>({width:e.offsetWidth,height:e.offsetHeight}),Rde=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Q7e=["INPUT","SELECT","TEXTAREA"];function Ide(e){var r,i;const t=((i=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:i[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:Q7e.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Dde=e=>"clientX"in e,fu=(e,t)=>{var s,a;const n=Dde(e),r=n?e.clientX:(s=e.touches)==null?void 0:s[0].clientX,i=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},Pq=(e,t,n,r,i)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(a=>{const l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:i,position:a.getAttribute("data-handlepos"),x:(l.left-n.left)/r,y:(l.top-n.top)/r,..._7(a)}})};function Pde({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:s,targetControlX:a,targetControlY:l}){const c=e*.125+i*.375+a*.375+n*.125,u=t*.125+s*.375+l*.375+r*.125,d=Math.abs(c-e),f=Math.abs(u-t);return[c,u,d,f]}function c2(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Mq({pos:e,x1:t,y1:n,x2:r,y2:i,c:s}){switch(e){case zt.Left:return[t-c2(t-r,s),n];case zt.Right:return[t+c2(r-t,s),n];case zt.Top:return[t,n-c2(n-i,s)];case zt.Bottom:return[t,n+c2(i-n,s)]}}function Mde({sourceX:e,sourceY:t,sourcePosition:n=zt.Bottom,targetX:r,targetY:i,targetPosition:s=zt.Top,curvature:a=.25}){const[l,c]=Mq({pos:n,x1:e,y1:t,x2:r,y2:i,c:a}),[u,d]=Mq({pos:s,x1:r,y1:i,x2:e,y2:t,c:a}),[f,h,m,g]=Pde({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${l},${c} ${u},${d} ${r},${i}`,f,h,m,g]}function Lde({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,s=n0}const z7e=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,V7e=(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)),H7e=(e,t,n={})=>{var s;if(!e.source||!e.target)return(s=n.onError)==null||s.call(n,"006",vu.error006()),t;const r=n.getEdgeId||z7e;let i;return _de(e)?i={...e}:i={...e,id:r(e)},V7e(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function $de({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,s,a,l]=Lde({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,s,a,l]}const Lq={[zt.Left]:{x:-1,y:0},[zt.Right]:{x:1,y:0},[zt.Top]:{x:0,y:-1},[zt.Bottom]:{x:0,y:1}},q7e=({source:e,sourcePosition:t=zt.Bottom,target:n})=>t===zt.Left||t===zt.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function X7e({source:e,sourcePosition:t=zt.Bottom,target:n,targetPosition:r=zt.Top,center:i,offset:s,stepPosition:a}){const l=Lq[t],c=Lq[r],u={x:e.x+l.x*s,y:e.y+l.y*s},d={x:n.x+c.x*s,y:n.y+c.y*s},f=q7e({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",m=f[h];let g=[],b,y;const O={x:0,y:0},v={x:0,y:0},[,,x,w]=Lde({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[h]*c[h]===-1){h==="x"?(b=i.x??u.x+(d.x-u.x)*a,y=i.y??(u.y+d.y)/2):(b=i.x??(u.x+d.x)/2,y=i.y??u.y+(d.y-u.y)*a);const _=[{x:b,y:u.y},{x:b,y:d.y}],T=[{x:u.x,y},{x:d.x,y}];l[h]===m?g=h==="x"?_:T:g=h==="x"?T:_}else{const _=[{x:u.x,y:d.y}],T=[{x:d.x,y:u.y}];if(h==="x"?g=l.x===m?T:_:g=l.y===m?_:T,t===r){const I=Math.abs(e[h]-n[h]);if(I<=s){const $=Math.min(s-1,s-I);l[h]===m?O[h]=(u[h]>e[h]?-1:1)*$:v[h]=(d[h]>n[h]?-1:1)*$}}if(t!==r){const I=h==="x"?"y":"x",$=l[h]===c[I],N=u[I]>d[I],D=u[I]=M?(b=(C.x+A.x)/2,y=g[0].y):(b=g[0].x,y=(C.y+A.y)/2)}const S={x:u.x+O.x,y:u.y+O.y},E={x:d.x+v.x,y:d.y+v.y};return[[e,...S.x!==g[0].x||S.y!==g[0].y?[S]:[],...g,...E.x!==g[g.length-1].x||E.y!==g[g.length-1].y?[E]:[],n],b,y,x,w]}function G7e(e,t,n,r){const i=Math.min($q(e,t)/2,$q(t,n)/2,r),{x:s,y:a}=t;if(e.x===s&&s===n.x||e.y===a&&a===n.y)return`L${s} ${a}`;if(e.y===a){const u=e.xn.id===t):e[0])||null}function N4(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function Y7e(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){const s=new Set;return e.reduce((a,l)=>([l.markerStart||r,l.markerEnd||i].forEach(c=>{if(c&&typeof c=="object"){const u=N4(c,t);s.has(u)||(a.push({id:u,color:c.color||n,...c}),s.add(u))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}const Bde=1e3,Z7e=10,T7={nodeOrigin:[0,0],nodeExtent:Pw,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},K7e={...T7,checkEquality:!0};function C7(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function J7e(e,t,n){const r=C7(T7,n);for(const i of e.values())if(i.parentId)N7(i,e,t,r);else{const s=aE(i,r.nodeOrigin),a=Ug(i.extent)?i.extent:r.nodeExtent,l=Qg(s,a,gh(i));i.internals.positionAbsolute=l}}function eBe(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const i of e.handles){const s={id:i.id,width:i.width??1,height:i.height??1,nodeId:e.id,x:i.x,y:i.y,position:i.position,type:i.type};i.type==="source"?n.push(s):i.type==="target"&&r.push(s)}return{source:n,target:r}}function A7(e){return e==="manual"}function j4(e,t,n,r={}){var d,f;const i=C7(K7e,r),s={i:0},a=new Map(t),l=i!=null&&i.elevateNodesOnSelect&&!A7(i.zIndexMode)?Bde:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const h of e){let m=a.get(h.id);if(i.checkEquality&&h===(m==null?void 0:m.internals.userNode))t.set(h.id,m);else{const g=aE(h,i.nodeOrigin),b=Ug(h.extent)?h.extent:i.nodeExtent,y=Qg(g,b,gh(h));m={...i.defaults,...h,measured:{width:(d=h.measured)==null?void 0:d.width,height:(f=h.measured)==null?void 0:f.height},internals:{positionAbsolute:y,handleBounds:eBe(h,m),z:Qde(h,l,i.zIndexMode),userNode:h}},t.set(h.id,m)}(m.measured===void 0||m.measured.width===void 0||m.measured.height===void 0)&&!m.hidden&&(c=!1),h.parentId&&N7(m,t,n,r,s),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function tBe(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 N7(e,t,n,r,i){const{elevateNodesOnSelect:s,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=C7(T7,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}tBe(e,n),i&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++i.i,d.internals.z=d.internals.z+i.i*Z7e),i&&d.internals.rootParentIndex!==void 0&&(i.i=d.internals.rootParentIndex);const f=s&&!A7(c)?Bde:0,{x:h,y:m,z:g}=nBe(e,d,a,l,f,c),{positionAbsolute:b}=e.internals,y=h!==b.x||m!==b.y;(y||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:y?{x:h,y:m}:b,z:g}})}function Qde(e,t,n){const r=du(e.zIndex)?e.zIndex:0;return A7(n)?r:r+(e.selected?t:0)}function nBe(e,t,n,r,i,s){const{x:a,y:l}=t.internals.positionAbsolute,c=gh(e),u=aE(e,n),d=Ug(e.extent)?Qg(u,e.extent,c):u;let f=Qg({x:a+d.x,y:l+d.y},r,c);e.extent==="parent"&&(f=Cde(f,c,t));const h=Qde(e,i,s),m=t.internals.z??0;return{x:f.x,y:f.y,z:m>=h?m+1:h}}function j7(e,t,n,r=[0,0]){var a;const i=[],s=new Map;for(const l of e){const c=t.get(l.parentId);if(!c)continue;const u=((a=s.get(l.parentId))==null?void 0:a.expandedRect)??a1(c),d=Ade(u,l.rect);s.set(l.parentId,{expandedRect:d,parent:c})}return s.size>0&&s.forEach(({expandedRect:l,parent:c},u)=>{var x;const d=c.internals.positionAbsolute,f=gh(c),h=c.origin??r,m=l.x0||g>0||O||v)&&(i.push({id:u,type:"position",position:{x:c.position.x-m+O,y:c.position.y-g+v}}),(x=n.get(u))==null||x.forEach(w=>{e.some(S=>S.id===w.id)||i.push({id:w.id,type:"position",position:{x:w.position.x+m,y:w.position.y+g}})})),(f.width0){const m=j7(h,t,n,i);u.push(...m)}return{changes:u,updatedInternals:c}}async function iBe({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:s}){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],[i,s]],r);return!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2])}function Fq(e,t,n,r,i,s){let a=i;const l=r.get(a)||new Map;r.set(a,l.set(n,t)),a=`${i}-${e}`;const c=r.get(a)||new Map;if(r.set(a,c.set(n,t)),s){a=`${i}-${e}-${s}`;const u=r.get(a)||new Map;r.set(a,u.set(n,t))}}function Ude(e,t,n){e.clear(),t.clear();for(const r of n){const{source:i,target:s,sourceHandle:a=null,targetHandle:l=null}=r,c={edgeId:r.id,source:i,target:s,sourceHandle:a,targetHandle:l},u=`${i}-${a}--${s}-${l}`,d=`${s}-${l}--${i}-${a}`;Fq("source",c,d,e,i,a),Fq("target",c,u,e,s,l),t.set(r.id,r)}}function Fde(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Fde(n,t):!1}function zq(e,t,n){var i;let r=e;do{if((i=r==null?void 0:r.matches)!=null&&i.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function sBe(e,t,n,r){const i=new Map;for(const[s,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!Fde(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){const l=e.get(s);l&&i.set(s,{id:s,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return i}function I5({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var a,l,c;const i=[];for(const[u,d]of t){const f=(a=n.get(u))==null?void 0:a.internals.userNode;f&&i.push({...f,position:d.position,dragging:r})}if(!e)return[i[0],i];const s=(l=n.get(e))==null?void 0:l.internals.userNode;return[s?{...s,position:((c=t.get(e))==null?void 0:c.position)||s.position,dragging:r}:i[0],i]}function aBe({dragItems:e,snapGrid:t,x:n,y:r}){const i=e.values().next().value;if(!i)return null;const s={x:n-i.distance.x,y:r-i.distance.y},a=lE(s,t);return{x:a.x-s.x,y:a.y-s.y}}function oBe({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let s={x:null,y:null},a=0,l=new Map,c=!1,u={x:0,y:0},d=null,f=!1,h=null,m=!1,g=!1,b=null;function y({noDragClassName:v,handleSelector:x,domNode:w,isSelectable:S,nodeId:E,nodeClickDistance:k=0}){h=Tl(w);function _({x:j,y:M}){const{nodeLookup:I,nodeExtent:$,snapGrid:N,snapToGrid:D,nodeOrigin:Q,onNodeDrag:F,onSelectionDrag:L,onError:H,updateNodePositions:z}=t();s={x:j,y:M};let B=!1;const V=l.size>1,W=V&&$?A4(oE(l)):null,le=V&&D?aBe({dragItems:l,snapGrid:N,x:j,y:M}):null;for(const[be,re]of l){if(!I.has(be))continue;let q={x:j-re.distance.x,y:M-re.distance.y};D&&(q=le?{x:Math.round(q.x+le.x),y:Math.round(q.y+le.y)}:lE(q,N));let G=null;if(V&&$&&!re.extent&&W){const{positionAbsolute:ve}=re.internals,Pe=ve.x-W.x+$[0][0],Ae=ve.x+re.measured.width-W.x2+$[1][0],Ue=ve.y-W.y+$[0][1],Ke=ve.y+re.measured.height-W.y2+$[1][1];G=[[Pe,Ue],[Ae,Ke]]}const{position:J,positionAbsolute:de}=Tde({nodeId:be,nextPosition:q,nodeLookup:I,nodeExtent:G||$,nodeOrigin:Q,onError:H});B=B||re.position.x!==J.x||re.position.y!==J.y,re.position=J,re.internals.positionAbsolute=de}if(g=g||B,!!B&&(z(l,!0),b&&(r||F||!E&&L))){const[be,re]=I5({nodeId:E,dragItems:l,nodeLookup:I});r==null||r(b,l,be,re),F==null||F(b,be,re),E||L==null||L(b,re)}}async function T(){if(!d)return;const{transform:j,panBy:M,autoPanSpeed:I,autoPanOnNodeDrag:$}=t();if(!$){c=!1,cancelAnimationFrame(a);return}const[N,D]=S7(u,d,I);(N!==0||D!==0)&&(s.x=(s.x??0)-N/j[2],s.y=(s.y??0)-D/j[2],await M({x:N,y:D})&&_(s)),a=requestAnimationFrame(T)}function C(j){var V;const{nodeLookup:M,multiSelectionActive:I,nodesDraggable:$,transform:N,snapGrid:D,snapToGrid:Q,selectNodesOnDrag:F,onNodeDragStart:L,onSelectionDragStart:H,unselectNodesAndEdges:z}=t();f=!0,(!F||!S)&&!I&&E&&((V=M.get(E))!=null&&V.selected||z()),S&&F&&E&&(e==null||e(E));const B=Av(j.sourceEvent,{transform:N,snapGrid:D,snapToGrid:Q,containerBounds:d});if(s=B,l=sBe(M,$,B,E),l.size>0&&(n||L||!E&&H)){const[W,le]=I5({nodeId:E,dragItems:l,nodeLookup:M});n==null||n(j.sourceEvent,l,W,le),L==null||L(j.sourceEvent,W,le),E||H==null||H(j.sourceEvent,le)}}const A=sde().clickDistance(k).on("start",j=>{const{domNode:M,nodeDragThreshold:I,transform:$,snapGrid:N,snapToGrid:D}=t();d=(M==null?void 0:M.getBoundingClientRect())||null,m=!1,g=!1,b=j.sourceEvent,I===0&&C(j),s=Av(j.sourceEvent,{transform:$,snapGrid:N,snapToGrid:D,containerBounds:d}),u=fu(j.sourceEvent,d)}).on("drag",j=>{const{autoPanOnNodeDrag:M,transform:I,snapGrid:$,snapToGrid:N,nodeDragThreshold:D,nodeLookup:Q}=t(),F=Av(j.sourceEvent,{transform:I,snapGrid:$,snapToGrid:N,containerBounds:d});if(b=j.sourceEvent,(j.sourceEvent.type==="touchmove"&&j.sourceEvent.touches.length>1||E&&!Q.has(E))&&(m=!0),!m){if(!c&&M&&f&&(c=!0,T()),!f){const L=fu(j.sourceEvent,d),H=L.x-u.x,z=L.y-u.y;Math.sqrt(H*H+z*z)>D&&C(j)}(s.x!==F.xSnapped||s.y!==F.ySnapped)&&l&&f&&(u=fu(j.sourceEvent,d),_(F))}}).on("end",j=>{if(!f||m){m&&l.size>0&&t().updateNodePositions(l,!1);return}if(c=!1,f=!1,cancelAnimationFrame(a),l.size>0){const{nodeLookup:M,updateNodePositions:I,onNodeDragStop:$,onSelectionDragStop:N}=t();if(g&&(I(l,!1),g=!1),i||$||!E&&N){const[D,Q]=I5({nodeId:E,dragItems:l,nodeLookup:M,dragging:!1});i==null||i(j.sourceEvent,l,D,Q),$==null||$(j.sourceEvent,D,Q),E||N==null||N(j.sourceEvent,Q)}}}).filter(j=>{const M=j.target;return!j.button&&(!v||!zq(M,`.${v}`,w))&&(!x||zq(M,x,w))});h.call(A)}function O(){h==null||h.on(".drag",null)}return{update:y,destroy:O}}function lBe(e,t,n){const r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())$w(i,a1(s))>0&&r.push(s);return r}const cBe=250;function uBe(e,t,n,r){var l,c;let i=[],s=1/0;const a=lBe(e,n,t+cBe);for(const u of a){const d=[...((l=u.internals.handleBounds)==null?void 0:l.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:m}=Fg(u,f,f.position,!0),g=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(m-e.y,2));g>t||(g1){const u=r.type==="source"?"target":"source";return i.find(d=>d.type===u)??i[0]}return i[0]}function zde(e,t,n,r,i,s=!1){var u,d,f;const a=r.get(e);if(!a)return null;const l=i==="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?l==null?void 0:l.find(h=>h.id===n):l==null?void 0:l[0])??null;return c&&s?{...c,...Fg(a,c,c.position,!0)}:c}function Vde(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function dBe(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Hde=()=>!0;function fBe(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:s,isTarget:a,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:f,panBy:h,cancelConnection:m,onConnectStart:g,onConnect:b,onConnectEnd:y,isValidConnection:O=Hde,onReconnectEnd:v,updateConnection:x,getTransform:w,getFromHandle:S,autoPanSpeed:E,dragThreshold:k=1,handleDomNode:_}){const T=Rde(e.target);let C=0,A;const{x:j,y:M}=fu(e),I=Vde(s,_),$=l==null?void 0:l.getBoundingClientRect();let N=!1;if(!$||!I)return;const D=zde(i,I,r,c,t);if(!D)return;let Q=fu(e,$),F=!1,L=null,H=!1,z=null;function B(){if(!d||!$)return;const[J,de]=S7(Q,$,E);h({x:J,y:de}),C=requestAnimationFrame(B)}const V={...D,nodeId:i,type:I,position:D.position},W=c.get(i);let be={inProgress:!0,isValid:null,from:Fg(W,V,zt.Left,!0),fromHandle:V,fromPosition:V.position,fromNode:W,to:Q,toHandle:null,toPosition:jq[V.position],toNode:null,pointer:Q};function re(){N=!0,x(be),g==null||g(e,{nodeId:i,handleId:r,handleType:I})}k===0&&re();function q(J){if(!N){const{x:Ke,y:Ce}=fu(J),Le=Ke-j,pe=Ce-M;if(!(Le*Le+pe*pe>k*k))return;re()}if(!S()||!V){G(J);return}const de=w();Q=fu(J,$),A=uBe(J1(Q,de,!1,[1,1]),n,c,V),F||(B(),F=!0);const ve=qde(J,{handle:A,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:a?"target":"source",isValidConnection:O,doc:T,lib:u,flowId:f,nodeLookup:c});z=ve.handleDomNode,L=ve.connection,H=dBe(!!A,ve.isValid);const Pe=c.get(i),Ae=Pe?Fg(Pe,V,zt.Left,!0):be.from,Ue={...be,from:Ae,isValid:H,to:ve.toHandle&&H?o1({x:ve.toHandle.x,y:ve.toHandle.y},de):Q,toHandle:ve.toHandle,toPosition:H&&ve.toHandle?ve.toHandle.position:jq[V.position],toNode:ve.toHandle?c.get(ve.toHandle.nodeId):null,pointer:Q};x(Ue),be=Ue}function G(J){if(!("touches"in J&&J.touches.length>0)){if(N){(A||z)&&L&&H&&(b==null||b(L));const{inProgress:de,...ve}=be,Pe={...ve,toPosition:be.toHandle?be.toPosition:null};y==null||y(J,Pe),s&&(v==null||v(J,Pe))}m(),cancelAnimationFrame(C),F=!1,H=!1,L=null,z=null,T.removeEventListener("mousemove",q),T.removeEventListener("mouseup",G),T.removeEventListener("touchmove",q),T.removeEventListener("touchend",G)}}T.addEventListener("mousemove",q),T.addEventListener("mouseup",G),T.addEventListener("touchmove",q),T.addEventListener("touchend",G)}function qde(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:s,doc:a,lib:l,flowId:c,isValidConnection:u=Hde,nodeLookup:d}){const f=s==="target",h=t?a.querySelector(`.${l}-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:m,y:g}=fu(e),b=a.elementFromPoint(m,g),y=b!=null&&b.classList.contains(`${l}-flow__handle`)?b:h,O={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const v=Vde(void 0,y),x=y.getAttribute("data-nodeid"),w=y.getAttribute("data-handleid"),S=y.classList.contains("connectable"),E=y.classList.contains("connectableend");if(!x||!v)return O;const k={source:f?x:r,sourceHandle:f?w:i,target:f?r:x,targetHandle:f?i:w};O.connection=k;const T=S&&E&&(n===i1.Strict?f&&v==="source"||!f&&v==="target":x!==r||w!==i);O.isValid=T&&u(k),O.toHandle=zde(x,v,w,d,n,!0)}return O}const R4={onPointerDown:fBe,isValid:qde};function hBe({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const i=Tl(e);function s({translateExtent:l,width:c,height:u,zoomStep:d=1,pannable:f=!0,zoomable:h=!0,inversePan:m=!1}){const g=x=>{if(x.sourceEvent.type!=="wheel"||!t)return;const w=n(),S=x.sourceEvent.ctrlKey&&Bw()?10:1,E=-x.sourceEvent.deltaY*(x.sourceEvent.deltaMode===1?.05:x.sourceEvent.deltaMode?1:.002)*d,k=w[2]*Math.pow(2,E*S);t.scaleTo(k)};let b=[0,0];const y=x=>{(x.sourceEvent.type==="mousedown"||x.sourceEvent.type==="touchstart")&&(b=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY])},O=x=>{const w=n();if(x.sourceEvent.type!=="mousemove"&&x.sourceEvent.type!=="touchmove"||!t)return;const S=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY],E=[S[0]-b[0],S[1]-b[1]];b=S;const k=r()*Math.max(w[2],Math.log(w[2]))*(m?-1:1),_={x:w[0]-E[0]*k,y:w[1]-E[1]*k},T=[[0,0],[c,u]];t.setViewportConstrained({x:_.x,y:_.y,zoom:w[2]},T,l)},v=vde().on("start",y).on("zoom",f?O:null).on("zoom.wheel",h?g:null);i.call(v,{})}function a(){i.on("zoom",null)}return{update:s,destroy:a,pointer:au}}const dj=e=>({x:e.x,y:e.y,zoom:e.k}),D5=({x:e,y:t,zoom:n})=>lj.translate(e,t).scale(n),Vb=(e,t)=>e.target.closest(`.${t}`),Xde=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),pBe=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,P5=(e,t=0,n=pBe,r=()=>{})=>{const i=typeof t=="number"&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on("end",r):e},Gde=e=>{const t=e.ctrlKey&&Bw()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function mBe({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:s,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(Vb(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&a){const y=au(d),O=Gde(d),v=f*Math.pow(2,O);r.scaleTo(n,v,y,d);return}const h=d.deltaMode===1?20:1;let m=i===wg.Vertical?0:d.deltaX*h,g=i===wg.Horizontal?0:d.deltaY*h;!Bw()&&d.shiftKey&&i!==wg.Vertical&&(m=d.deltaY*h,g=0),r.translateBy(n,-(m/f)*s,-(g/f)*s,{internal:!0});const b=dj(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,b),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(d,b))}}function gBe({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){const s=r.type==="wheel",a=!t&&s&&!r.ctrlKey,l=Vb(r,e);if(r.ctrlKey&&s&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,i)}}function bBe({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var s,a,l;if((s=r.sourceEvent)!=null&&s.internal)return;const i=dj(r.transform);e.mouseButton=((a=r.sourceEvent)==null?void 0:a.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=i,((l=r.sourceEvent)==null?void 0:l.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,i))}}function yBe({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return s=>{var a,l;e.usedRightMouseButton=!!(n&&Xde(t,e.mouseButton??0)),(a=s.sourceEvent)!=null&&a.sync||r([s.transform.x,s.transform.y,s.transform.k]),i&&!((l=s.sourceEvent)!=null&&l.internal)&&(i==null||i(s.sourceEvent,dj(s.transform)))}}function OBe({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:s}){return a=>{var l;if(!((l=a.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,s&&Xde(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&s(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){const c=dj(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i==null||i(a.sourceEvent,c)},n?150:0)}}}function xBe({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:d}){return f=>{var y;const h=e||t,m=n&&f.ctrlKey,g=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(Vb(f,`${u}-flow__node`)||Vb(f,`${u}-flow__edge`)))return!0;if(!r&&!h&&!i&&!s&&!n||a||d&&!g||Vb(f,l)&&g||Vb(f,c)&&(!g||i&&g&&!e)||!n&&f.ctrlKey&&g)return!1;if(!n&&f.type==="touchstart"&&((y=f.touches)==null?void 0:y.length)>1)return f.preventDefault(),!1;if(!h&&!i&&!m&&g||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const b=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||g)&&b}}function vBe({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:s,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),f=vde().scaleExtent([t,n]).translateExtent(r),h=Tl(e).call(f);v({x:i.x,y:i.y,zoom:s1(i.zoom,t,n)},[[0,0],[d.width,d.height]],r);const m=h.on("wheel.zoom"),g=h.on("dblclick.zoom");f.wheelDelta(Gde);async function b(A,j){return h?new Promise(M=>{f==null||f.interpolate((j==null?void 0:j.interpolate)==="linear"?Cv:J_).transform(P5(h,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>M(!0)),A)}):!1}function y({noWheelClassName:A,noPanClassName:j,onPaneContextMenu:M,userSelectionActive:I,panOnScroll:$,panOnDrag:N,panOnScrollMode:D,panOnScrollSpeed:Q,preventScrolling:F,zoomOnPinch:L,zoomOnScroll:H,zoomOnDoubleClick:z,zoomActivationKeyPressed:B,lib:V,onTransformChange:W,connectionInProgress:le,paneClickDistance:be,selectionOnDrag:re}){I&&!u.isZoomingOrPanning&&O();const q=$&&!B&&!I;f.clickDistance(re?1/0:!du(be)||be<0?0:be);const G=q?mBe({zoomPanValues:u,noWheelClassName:A,d3Selection:h,d3Zoom:f,panOnScrollMode:D,panOnScrollSpeed:Q,zoomOnPinch:L,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:l}):gBe({noWheelClassName:A,preventScrolling:F,d3ZoomHandler:m});h.on("wheel.zoom",G,{passive:!1});const J=bBe({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});f.on("start",J);const de=yBe({zoomPanValues:u,panOnDrag:N,onPaneContextMenu:!!M,onPanZoom:s,onTransformChange:W});f.on("zoom",de);const ve=OBe({zoomPanValues:u,panOnDrag:N,panOnScroll:$,onPaneContextMenu:M,onPanZoomEnd:l,onDraggingChange:c});f.on("end",ve);const Pe=xBe({zoomActivationKeyPressed:B,panOnDrag:N,zoomOnScroll:H,panOnScroll:$,zoomOnDoubleClick:z,zoomOnPinch:L,userSelectionActive:I,noPanClassName:j,noWheelClassName:A,lib:V,connectionInProgress:le});f.filter(Pe),z?h.on("dblclick.zoom",g):h.on("dblclick.zoom",null)}function O(){f.on("zoom",null)}async function v(A,j,M){const I=D5(A),$=f==null?void 0:f.constrain()(I,j,M);return $&&await b($),$}async function x(A,j){const M=D5(A);return await b(M,j),M}function w(A){if(h){const j=D5(A),M=h.property("__zoom");(M.k!==A.zoom||M.x!==A.x||M.y!==A.y)&&(f==null||f.transform(h,j,null,{sync:!0}))}}function S(){const A=h?xde(h.node()):{x:0,y:0,k:1};return{x:A.x,y:A.y,zoom:A.k}}async function E(A,j){return h?new Promise(M=>{f==null||f.interpolate((j==null?void 0:j.interpolate)==="linear"?Cv:J_).scaleTo(P5(h,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>M(!0)),A)}):!1}async function k(A,j){return h?new Promise(M=>{f==null||f.interpolate((j==null?void 0:j.interpolate)==="linear"?Cv:J_).scaleBy(P5(h,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>M(!0)),A)}):!1}function _(A){f==null||f.scaleExtent(A)}function T(A){f==null||f.translateExtent(A)}function C(A){const j=!du(A)||A<0?0:A;f==null||f.clickDistance(j)}return{update:y,destroy:O,setViewport:x,setViewportConstrained:v,getViewport:S,scaleTo:E,scaleBy:k,setScaleExtent:_,setTranslateExtent:T,syncViewport:w,setClickDistance:C}}var l1;(function(e){e.Line="line",e.Handle="handle"})(l1||(l1={}));function wBe({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:s}){const a=e-t,l=n-r,c=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&i&&(c[0]=c[0]*-1),l&&s&&(c[1]=c[1]*-1),c}function Vq(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),i=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:i}}function Lh(e,t){return Math.max(0,t-e)}function $h(e,t){return Math.max(0,e-t)}function u2(e,t,n){return Math.max(0,t-e,e-n)}function Hq(e,t){return e?!t:t}function SBe(e,t,n,r,i,s,a,l){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:f}=t,h=d&&f,{xSnapped:m,ySnapped:g}=n,{minWidth:b,maxWidth:y,minHeight:O,maxHeight:v}=r,{x,y:w,width:S,height:E,aspectRatio:k}=e;let _=Math.floor(d?m-e.pointerX:0),T=Math.floor(f?g-e.pointerY:0);const C=S+(c?-_:_),A=E+(u?-T:T),j=-s[0]*S,M=-s[1]*E;let I=u2(C,b,y),$=u2(A,O,v);if(a){let Q=0,F=0;c&&_<0?Q=Lh(x+_+j,a[0][0]):!c&&_>0&&(Q=$h(x+C+j,a[1][0])),u&&T<0?F=Lh(w+T+M,a[0][1]):!u&&T>0&&(F=$h(w+A+M,a[1][1])),I=Math.max(I,Q),$=Math.max($,F)}if(l){let Q=0,F=0;c&&_>0?Q=$h(x+_,l[0][0]):!c&&_<0&&(Q=Lh(x+C,l[1][0])),u&&T>0?F=$h(w+T,l[0][1]):!u&&T<0&&(F=Lh(w+A,l[1][1])),I=Math.max(I,Q),$=Math.max($,F)}if(i){if(d){const Q=u2(C/k,O,v)*k;if(I=Math.max(I,Q),a){let F=0;!c&&!u||c&&!u&&h?F=$h(w+M+C/k,a[1][1])*k:F=Lh(w+M+(c?_:-_)/k,a[0][1])*k,I=Math.max(I,F)}if(l){let F=0;!c&&!u||c&&!u&&h?F=Lh(w+C/k,l[1][1])*k:F=$h(w+(c?_:-_)/k,l[0][1])*k,I=Math.max(I,F)}}if(f){const Q=u2(A*k,b,y)/k;if($=Math.max($,Q),a){let F=0;!c&&!u||u&&!c&&h?F=$h(x+A*k+j,a[1][0])/k:F=Lh(x+(u?T:-T)*k+j,a[0][0])/k,$=Math.max($,F)}if(l){let F=0;!c&&!u||u&&!c&&h?F=Lh(x+A*k,l[1][0])/k:F=$h(x+(u?T:-T)*k,l[0][0])/k,$=Math.max($,F)}}}T=T+(T<0?$:-$),_=_+(_<0?I:-I),i&&(h?C>A*k?T=(Hq(c,u)?-_:_)/k:_=(Hq(c,u)?-T:T)*k:d?(T=_/k,u=c):(_=T*k,c=u));const N=c?x+_:x,D=u?w+T:w;return{width:S+(c?-_:_),height:E+(u?-T:T),x:s[0]*_*(c?-1:1)+N,y:s[1]*T*(u?-1:1)+D}}const Wde={width:0,height:0,x:0,y:0},EBe={...Wde,pointerX:0,pointerY:0,aspectRatio:1};function kBe(e,t,n){const r=t.position.x+e.position.x,i=t.position.y+e.position.y,s=e.measured.width??0,a=e.measured.height??0,l=n[0]*s,c=n[1]*a;return[[r-l,i-c],[r+s-l,i+a-c]]}function _Be({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){const s=Tl(e);let a={controlDirection:Vq("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:u,boundaries:d,keepAspectRatio:f,resizeDirection:h,onResizeStart:m,onResize:g,onResizeEnd:b,shouldResize:y}){let O={...Wde},v={...EBe};a={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:Vq(u)};let x,w=null,S=[],E,k,_,T=!1;const C=sde().on("start",A=>{const{nodeLookup:j,transform:M,snapGrid:I,snapToGrid:$,nodeOrigin:N,paneDomNode:D}=n();if(x=j.get(t),!x)return;w=(D==null?void 0:D.getBoundingClientRect())??null;const{xSnapped:Q,ySnapped:F}=Av(A.sourceEvent,{transform:M,snapGrid:I,snapToGrid:$,containerBounds:w});O={width:x.measured.width??0,height:x.measured.height??0,x:x.position.x??0,y:x.position.y??0},v={...O,pointerX:Q,pointerY:F,aspectRatio:O.width/O.height},E=void 0,k=Ug(x.extent)?x.extent:void 0,x.parentId&&(x.extent==="parent"||x.expandParent)&&(E=j.get(x.parentId)),E&&x.extent==="parent"&&(k=[[0,0],[E.measured.width,E.measured.height]]),S=[],_=void 0;for(const[L,H]of j)if(H.parentId===t&&(S.push({id:L,position:{...H.position},extent:H.extent}),H.extent==="parent"||H.expandParent)){const z=kBe(H,x,H.origin??N);_?_=[[Math.min(z[0][0],_[0][0]),Math.min(z[0][1],_[0][1])],[Math.max(z[1][0],_[1][0]),Math.max(z[1][1],_[1][1])]]:_=z}m==null||m(A,{...O})}).on("drag",A=>{const{transform:j,snapGrid:M,snapToGrid:I,nodeOrigin:$}=n(),N=Av(A.sourceEvent,{transform:j,snapGrid:M,snapToGrid:I,containerBounds:w}),D=[];if(!x)return;const{x:Q,y:F,width:L,height:H}=O,z={},B=x.origin??$,{width:V,height:W,x:le,y:be}=SBe(v,a.controlDirection,N,a.boundaries,a.keepAspectRatio,B,k,_),re=V!==L,q=W!==H,G=le!==Q&&re,J=be!==F&&q;if(!G&&!J&&!re&&!q)return;if((G||J||B[0]===1||B[1]===1)&&(z.x=G?le:O.x,z.y=J?be:O.y,O.x=z.x,O.y=z.y,S.length>0)){const Ae=le-Q,Ue=be-F;for(const Ke of S)Ke.position={x:Ke.position.x-Ae+B[0]*(V-L),y:Ke.position.y-Ue+B[1]*(W-H)},D.push(Ke)}if((re||q)&&(z.width=re&&(!a.resizeDirection||a.resizeDirection==="horizontal")?V:O.width,z.height=q&&(!a.resizeDirection||a.resizeDirection==="vertical")?W:O.height,O.width=z.width,O.height=z.height),E&&x.expandParent){const Ae=B[0]*(z.width??0);z.x&&z.x{T&&(b==null||b(A,{...O}),i==null||i({...O}),T=!1)});s.call(C)}function c(){s.on(".drag",null)}return{update:l,destroy:c}}var Yde={exports:{}},Zde={},Kde={exports:{}},Jde={};/** * @license React * use-sync-external-store-shim.production.js * @@ -470,7 +470,7 @@ ${r}`}}async function u9(e,t=!1){const n=await wt(`/web/model-api-keys${t?"?refr * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var c1=p;function CBe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ABe=typeof Object.is=="function"?Object.is:CBe,NBe=c1.useState,jBe=c1.useEffect,RBe=c1.useLayoutEffect,IBe=c1.useDebugValue;function DBe(e,t){var n=t(),r=NBe({inst:{value:n,getSnapshot:t}}),i=r[0].inst,s=r[1];return RBe(function(){i.value=n,i.getSnapshot=t,M5(i)&&s({inst:i})},[e,n,t]),jBe(function(){return M5(i)&&s({inst:i}),e(function(){M5(i)&&s({inst:i})})},[e]),IBe(n),n}function M5(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!ABe(e,n)}catch{return!0}}function PBe(e,t){return t()}var MBe=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?PBe:DBe;Jde.useSyncExternalStore=c1.useSyncExternalStore!==void 0?c1.useSyncExternalStore:MBe;Kde.exports=Jde;var LBe=Kde.exports;/** + */var c1=p;function TBe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var CBe=typeof Object.is=="function"?Object.is:TBe,ABe=c1.useState,NBe=c1.useEffect,jBe=c1.useLayoutEffect,RBe=c1.useDebugValue;function IBe(e,t){var n=t(),r=ABe({inst:{value:n,getSnapshot:t}}),i=r[0].inst,s=r[1];return jBe(function(){i.value=n,i.getSnapshot=t,M5(i)&&s({inst:i})},[e,n,t]),NBe(function(){return M5(i)&&s({inst:i}),e(function(){M5(i)&&s({inst:i})})},[e]),RBe(n),n}function M5(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!CBe(e,n)}catch{return!0}}function DBe(e,t){return t()}var PBe=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?DBe:IBe;Jde.useSyncExternalStore=c1.useSyncExternalStore!==void 0?c1.useSyncExternalStore:PBe;Kde.exports=Jde;var MBe=Kde.exports;/** * @license React * use-sync-external-store-shim/with-selector.production.js * @@ -478,105 +478,105 @@ ${r}`}}async function u9(e,t=!1){const n=await wt(`/web/model-api-keys${t?"?refr * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var fj=p,$Be=LBe;function BBe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var QBe=typeof Object.is=="function"?Object.is:BBe,UBe=$Be.useSyncExternalStore,FBe=fj.useRef,zBe=fj.useEffect,VBe=fj.useMemo,HBe=fj.useDebugValue;Zde.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var s=FBe(null);if(s.current===null){var a={hasValue:!1,value:null};s.current=a}else a=s.current;s=VBe(function(){function c(m){if(!u){if(u=!0,d=m,m=r(m),i!==void 0&&a.hasValue){var g=a.value;if(i(g,m))return f=g}return f=m}if(g=f,QBe(d,m))return g;var b=r(m);return i!==void 0&&i(g,b)?(d=m,g):(d=m,f=b)}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,i]);var l=UBe(e,s[0],s[1]);return zBe(function(){a.hasValue=!0,a.value=l},[l]),HBe(l),l};Yde.exports=Zde;var qBe=Yde.exports;const XBe=N1(qBe),GBe={},qq=e=>{let t;const n=new Set,r=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const m=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(g=>g(t,m))}},i=()=>t,c={setState:r,getState:i,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(GBe?"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,i,c);return c},WBe=e=>e?qq(e):qq,{useDebugValue:YBe}=Zn,{useSyncExternalStoreWithSelector:ZBe}=XBe,KBe=e=>e;function efe(e,t=KBe,n){const r=ZBe(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return YBe(r),r}const Xq=(e,t)=>{const n=WBe(e),r=(i,s=t)=>efe(n,i,s);return Object.assign(r,n),r},JBe=(e,t)=>e?Xq(e,t):Xq;function Ki(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,i]of e)if(!Object.is(i,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 hj=p.createContext(null),eQe=hj.Provider,tfe=Ou.error001("react");function Sr(e,t){const n=p.useContext(hj);if(n===null)throw new Error(tfe);return efe(n,e,t)}function Ji(){const e=p.useContext(hj);if(e===null)throw new Error(tfe);return p.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Gq={display:"none"},tQe={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},nfe="react-flow__node-desc",rfe="react-flow__edge-desc",nQe="react-flow__aria-live",rQe=e=>e.ariaLiveMessage,iQe=e=>e.ariaLabelConfig;function sQe({rfId:e}){const t=Sr(rQe);return o.jsx("div",{id:`${nQe}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:tQe,children:t})}function aQe({rfId:e,disableKeyboardA11y:t}){const n=Sr(iQe);return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:`${nfe}-${e}`,style:Gq,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),o.jsx("div",{id:`${rfe}-${e}`,style:Gq,children:n["edge.a11yDescription.default"]}),!t&&o.jsx(sQe,{rfId:e})]})}const pj=p.forwardRef(({position:e="top-left",children:t,className:n,style:r,...i},s)=>{const a=`${e}`.split("-");return o.jsx("div",{className:qs(["react-flow__panel",n,...a]),style:r,ref:s,...i,children:t})});pj.displayName="Panel";function oQe({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:o.jsx(pj,{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:o.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const lQe=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}},c2=e=>e.id;function cQe(e,t){return Ki(e.selectedNodes.map(c2),t.selectedNodes.map(c2))&&Ki(e.selectedEdges.map(c2),t.selectedEdges.map(c2))}function uQe({onSelectionChange:e}){const t=Ji(),{selectedNodes:n,selectedEdges:r}=Sr(lQe,cQe);return p.useEffect(()=>{const i={nodes:n,edges:r};e==null||e(i),t.getState().onSelectionChangeHandlers.forEach(s=>s(i))},[n,r,e]),null}const dQe=e=>!!e.onSelectionChangeHandlers;function fQe({onSelectionChange:e}){const t=Sr(dQe);return e||t?o.jsx(uQe,{onSelectionChange:e}):null}const ife=[0,0],hQe={x:0,y:0,zoom:1},pQe=["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"],Wq=[...pQe,"rfId"],mQe=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}),Yq={translateExtent:Iw,nodeOrigin:ife,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function gQe(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:s,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=Sr(mQe,Ki),u=Ji();p.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=Yq,l()}),[]);const d=p.useRef(Yq);return p.useEffect(()=>{for(const f of Wq){const h=e[f],m=d.current[f];h!==m&&(typeof e[f]>"u"||(f==="nodes"?t(h):f==="edges"?n(h):f==="minZoom"?r(h):f==="maxZoom"?i(h):f==="translateExtent"?s(h):f==="nodeExtent"?a(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:Q7e(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},Wq.map(f=>e[f])),null}function Zq(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function bQe(e){var r;const[t,n]=p.useState(e==="system"?null:e);return p.useEffect(()=>{if(e!=="system"){n(e);return}const i=Zq(),s=()=>n(i!=null&&i.matches?"dark":"light");return s(),i==null||i.addEventListener("change",s),()=>{i==null||i.removeEventListener("change",s)}},[e]),t!==null?t:(r=Zq())!=null&&r.matches?"dark":"light"}const Kq=typeof document<"u"?document:null;function $w(e=null,t={target:Kq,actInsideInputWithModifier:!0}){const[n,r]=p.useState(!1),i=p.useRef(!1),s=p.useRef(new Set([])),[a,l]=p.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",` + */var fj=p,LBe=MBe;function $Be(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var BBe=typeof Object.is=="function"?Object.is:$Be,QBe=LBe.useSyncExternalStore,UBe=fj.useRef,FBe=fj.useEffect,zBe=fj.useMemo,VBe=fj.useDebugValue;Zde.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var s=UBe(null);if(s.current===null){var a={hasValue:!1,value:null};s.current=a}else a=s.current;s=zBe(function(){function c(m){if(!u){if(u=!0,d=m,m=r(m),i!==void 0&&a.hasValue){var g=a.value;if(i(g,m))return f=g}return f=m}if(g=f,BBe(d,m))return g;var b=r(m);return i!==void 0&&i(g,b)?(d=m,g):(d=m,f=b)}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,i]);var l=QBe(e,s[0],s[1]);return FBe(function(){a.hasValue=!0,a.value=l},[l]),VBe(l),l};Yde.exports=Zde;var HBe=Yde.exports;const qBe=N1(HBe),XBe={},qq=e=>{let t;const n=new Set,r=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const m=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(g=>g(t,m))}},i=()=>t,c={setState:r,getState:i,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(XBe?"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,i,c);return c},GBe=e=>e?qq(e):qq,{useDebugValue:WBe}=Wn,{useSyncExternalStoreWithSelector:YBe}=qBe,ZBe=e=>e;function efe(e,t=ZBe,n){const r=YBe(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return WBe(r),r}const Xq=(e,t)=>{const n=GBe(e),r=(i,s=t)=>efe(n,i,s);return Object.assign(r,n),r},KBe=(e,t)=>e?Xq(e,t):Xq;function Ki(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,i]of e)if(!Object.is(i,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 hj=p.createContext(null),JBe=hj.Provider,tfe=vu.error001("react");function wr(e,t){const n=p.useContext(hj);if(n===null)throw new Error(tfe);return efe(n,e,t)}function Ji(){const e=p.useContext(hj);if(e===null)throw new Error(tfe);return p.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Gq={display:"none"},eQe={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},nfe="react-flow__node-desc",rfe="react-flow__edge-desc",tQe="react-flow__aria-live",nQe=e=>e.ariaLiveMessage,rQe=e=>e.ariaLabelConfig;function iQe({rfId:e}){const t=wr(nQe);return o.jsx("div",{id:`${tQe}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:eQe,children:t})}function sQe({rfId:e,disableKeyboardA11y:t}){const n=wr(rQe);return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:`${nfe}-${e}`,style:Gq,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),o.jsx("div",{id:`${rfe}-${e}`,style:Gq,children:n["edge.a11yDescription.default"]}),!t&&o.jsx(iQe,{rfId:e})]})}const pj=p.forwardRef(({position:e="top-left",children:t,className:n,style:r,...i},s)=>{const a=`${e}`.split("-");return o.jsx("div",{className:zs(["react-flow__panel",n,...a]),style:r,ref:s,...i,children:t})});pj.displayName="Panel";function aQe({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:o.jsx(pj,{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:o.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const oQe=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}},d2=e=>e.id;function lQe(e,t){return Ki(e.selectedNodes.map(d2),t.selectedNodes.map(d2))&&Ki(e.selectedEdges.map(d2),t.selectedEdges.map(d2))}function cQe({onSelectionChange:e}){const t=Ji(),{selectedNodes:n,selectedEdges:r}=wr(oQe,lQe);return p.useEffect(()=>{const i={nodes:n,edges:r};e==null||e(i),t.getState().onSelectionChangeHandlers.forEach(s=>s(i))},[n,r,e]),null}const uQe=e=>!!e.onSelectionChangeHandlers;function dQe({onSelectionChange:e}){const t=wr(uQe);return e||t?o.jsx(cQe,{onSelectionChange:e}):null}const ife=[0,0],fQe={x:0,y:0,zoom:1},hQe=["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"],Wq=[...hQe,"rfId"],pQe=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}),Yq={translateExtent:Pw,nodeOrigin:ife,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function mQe(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:s,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=wr(pQe,Ki),u=Ji();p.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=Yq,l()}),[]);const d=p.useRef(Yq);return p.useEffect(()=>{for(const f of Wq){const h=e[f],m=d.current[f];h!==m&&(typeof e[f]>"u"||(f==="nodes"?t(h):f==="edges"?n(h):f==="minZoom"?r(h):f==="maxZoom"?i(h):f==="translateExtent"?s(h):f==="nodeExtent"?a(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:B7e(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},Wq.map(f=>e[f])),null}function Zq(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function gQe(e){var r;const[t,n]=p.useState(e==="system"?null:e);return p.useEffect(()=>{if(e!=="system"){n(e);return}const i=Zq(),s=()=>n(i!=null&&i.matches?"dark":"light");return s(),i==null||i.addEventListener("change",s),()=>{i==null||i.removeEventListener("change",s)}},[e]),t!==null?t:(r=Zq())!=null&&r.matches?"dark":"light"}const Kq=typeof document<"u"?document:null;function Qw(e=null,t={target:Kq,actInsideInputWithModifier:!0}){const[n,r]=p.useState(!1),i=p.useRef(!1),s=p.useRef(new Set([])),[a,l]=p.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 p.useEffect(()=>{const c=(t==null?void 0:t.target)??Kq,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=m=>{var y,O;if(i.current=m.ctrlKey||m.metaKey||m.shiftKey||m.altKey,(!i.current||i.current&&!u)&&Ide(m))return!1;const b=eX(m.code,l);if(s.current.add(m[b]),Jq(a,s.current,!1)){const v=((O=(y=m.composedPath)==null?void 0:y.call(m))==null?void 0:O[0])||m.target,x=(v==null?void 0:v.nodeName)==="BUTTON"||(v==null?void 0:v.nodeName)==="A";t.preventDefault!==!1&&(i.current||!x)&&m.preventDefault(),r(!0)}},f=m=>{const g=eX(m.code,l);Jq(a,s.current,!0)?(r(!1),s.current.clear()):s.current.delete(m[g]),m.key==="Meta"&&s.current.clear(),i.current=!1},h=()=>{s.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 Jq(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function eX(e,t){return t.includes(e)?"code":"key"}const yQe=()=>{const e=Ji();return p.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,i,s],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??s},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:i,minZoom:s,maxZoom:a,panZoom:l}=e.getState(),c=E7(t,r,i,s,a,(n==null?void 0:n.padding)??.1);return l?(await l.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:i,snapToGrid:s,domNode:a}=e.getState();if(!a)return t;const{x:l,y:c}=a.getBoundingClientRect(),u={x:t.x-l,y:t.y-c},d=n.snapGrid??i,f=n.snapToGrid??s;return J1(u,r,f,d)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:i,y:s}=r.getBoundingClientRect(),a=o1(t,n);return{x:a.x+i,y:a.y+s}}}),[])};function sfe(e,t){const n=[],r=new Map,i=[];for(const s of e)if(s.type==="add"){i.push(s);continue}else if(s.type==="remove"||s.type==="replace")r.set(s.id,[s]);else{const a=r.get(s.id);a?a.push(s):r.set(s.id,[s])}for(const s of t){const a=r.get(s.id);if(!a){n.push(s);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const l={...s};for(const c of a)OQe(c,l);n.push(l)}return i.length&&i.forEach(s=>{s.index!==void 0?n.splice(s.index,0,{...s.item}):n.push({...s.item})}),n}function OQe(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 afe(e,t){return sfe(e,t)}function ofe(e,t){return sfe(e,t)}function Vm(e,t){return{id:e,type:"select",selected:t}}function Hb(e,t=new Set,n=!1){const r=[];for(const[i,s]of e){const a=t.has(i);!(s.selected===void 0&&!a)&&s.selected!==a&&(n&&(s.selected=a),r.push(Vm(s.id,a)))}return r}function tX({items:e=[],lookup:t}){var i;const n=[],r=new Map(e.map(s=>[s.id,s]));for(const[s,a]of e.entries()){const l=t.get(a.id),c=((i=l==null?void 0:l.internals)==null?void 0:i.userNode)??l;c!==void 0&&c!==a&&n.push({id:a.id,item:a,type:"replace"}),c===void 0&&n.push({item:a,type:"add",index:s})}for(const[s]of t)r.get(s)===void 0&&n.push({id:s,type:"remove"});return n}function nX(e){return{id:e.id,type:"remove"}}const xQe=Nde();function vQe(e,t,n={}){return q7e(e,t,{...n,onError:n.onError??xQe})}const rX=e=>j7e(e),wQe=e=>_de(e);function lfe(e){return p.forwardRef(e)}const SQe=typeof window<"u"?p.useLayoutEffect:p.useEffect;function iX(e){const[t,n]=p.useState(BigInt(0)),[r]=p.useState(()=>EQe(()=>n(i=>i+BigInt(1))));return SQe(()=>{const i=r.get();i.length&&(e(i),r.reset())},[t]),r}function EQe(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const cfe=p.createContext(null);function kQe({children:e}){const t=Ji(),n=p.useCallback(l=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:h,fitViewQueued:m,onNodesChangeMiddlewareMap:g}=t.getState();let b=c;for(const O of l)b=typeof O=="function"?O(b):O;let y=tX({items:b,lookup:h});for(const O of g.values())y=O(y);d&&u(b),y.length>0?f==null||f(y):m&&window.requestAnimationFrame(()=>{const{fitViewQueued:O,nodes:v,setNodes:x}=t.getState();O&&x(v)})},[]),r=iX(n),i=p.useCallback(l=>{const{edges:c=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:h}=t.getState();let m=c;for(const g of l)m=typeof g=="function"?g(m):g;d?u(m):f&&f(tX({items:m,lookup:h}))},[]),s=iX(i),a=p.useMemo(()=>({nodeQueue:r,edgeQueue:s}),[]);return o.jsx(cfe.Provider,{value:a,children:e})}function _Qe(){const e=p.useContext(cfe);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const TQe=e=>!!e.panZoom;function mj(){const e=yQe(),t=Ji(),n=_Qe(),r=Sr(TQe),i=p.useMemo(()=>{const s=f=>t.getState().nodeLookup.get(f),a=f=>{n.nodeQueue.push(f)},l=f=>{n.edgeQueue.push(f)},c=f=>{var O,v;const{nodeLookup:h,nodeOrigin:m}=t.getState(),g=rX(f)?f:h.get(f.id),b=g.parentId?jde(g.position,g.measured,g.parentId,h,m):g.position,y={...g,position:b,width:((O=g.measured)==null?void 0:O.width)??g.width,height:((v=g.measured)==null?void 0:v.height)??g.height};return a1(y)},u=(f,h,m={replace:!1})=>{a(g=>g.map(b=>{if(b.id===f){const y=typeof h=="function"?h(b):h;return m.replace&&rX(y)?y:{...b,...y}}return b}))},d=(f,h,m={replace:!1})=>{l(g=>g.map(b=>{if(b.id===f){const y=typeof h=="function"?h(b):h;return m.replace&&wQe(y)?y:{...b,...y}}return b}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var h;return(h=s(f))==null?void 0:h.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(h=>({...h}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:a,setEdges:l,addNodes:f=>{const h=Array.isArray(f)?f:[f];n.nodeQueue.push(m=>[...m,...h])},addEdges:f=>{const h=Array.isArray(f)?f:[f];n.edgeQueue.push(m=>[...m,...h])},toObject:()=>{const{nodes:f=[],edges:h=[],transform:m}=t.getState(),[g,b,y]=m;return{nodes:f.map(O=>({...O})),edges:h.map(O=>({...O})),viewport:{x:g,y:b,zoom:y}}},deleteElements:async({nodes:f=[],edges:h=[]})=>{const{nodes:m,edges:g,onNodesDelete:b,onEdgesDelete:y,triggerNodeChanges:O,triggerEdgeChanges:v,onDelete:x,onBeforeDelete:w}=t.getState(),{nodes:S,edges:E}=await M7e({nodesToRemove:f,edgesToRemove:h,nodes:m,edges:g,onBeforeDelete:w}),k=E.length>0,_=S.length>0;if(k){const C=E.map(nX);y==null||y(E),v(C)}if(_){const C=S.map(nX);b==null||b(S),O(C)}return(_||k)&&(x==null||x({nodes:S,edges:E})),{deletedNodes:S,deletedEdges:E}},getIntersectingNodes:(f,h=!0,m)=>{const g=Iq(f),b=g?f:c(f),y=m!==void 0;return b?(m||t.getState().nodes).filter(O=>{const v=t.getState().nodeLookup.get(O.id);if(v&&!g&&(O.id===f.id||!v.internals.positionAbsolute))return!1;const x=a1(y?O:v),w=Mw(x,b);return h&&w>0||w>=x.width*x.height||w>=b.width*b.height}):[]},isNodeIntersecting:(f,h,m=!0)=>{const b=Iq(f)?f:c(f);if(!b)return!1;const y=Mw(b,h);return m&&y>0||y>=h.width*h.height||y>=b.width*b.height},updateNode:u,updateNodeData:(f,h,m={replace:!1})=>{u(f,g=>{const b=typeof h=="function"?h(g):h;return m.replace?{...g,data:b}:{...g,data:{...g.data,...b}}},m)},updateEdge:d,updateEdgeData:(f,h,m={replace:!1})=>{d(f,g=>{const b=typeof h=="function"?h(g):h;return m.replace?{...g,data:b}:{...g,data:{...g.data,...b}}},m)},getNodesBounds:f=>{const{nodeLookup:h,nodeOrigin:m}=t.getState();return R7e(f,{nodeLookup:h,nodeOrigin:m})},getHandleConnections:({type:f,id:h,nodeId:m})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${m}-${f}${h?`-${h}`:""}`))==null?void 0:g.values())??[])},getNodeConnections:({type:f,handleId:h,nodeId:m})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${m}${f?h?`-${f}-${h}`:`-${f}`:""}`))==null?void 0:g.values())??[])},fitView:async f=>{const h=t.getState().fitViewResolver??B7e();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:h}),n.nodeQueue.push(m=>[...m]),h.promise}}},[]);return p.useMemo(()=>({...i,...e,viewportInitialized:r}),[r])}const sX=e=>e.selected,CQe=typeof window<"u"?window:void 0;function AQe({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Ji(),{deleteElements:r}=mj(),i=$w(e,{actInsideInputWithModifier:!1}),s=$w(t,{target:CQe});p.useEffect(()=>{if(i){const{edges:a,nodes:l}=n.getState();r({nodes:l.filter(sX),edges:a.filter(sX)}),n.setState({nodesSelectionActive:!1})}},[i]),p.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function NQe(e){const t=Ji();p.useEffect(()=>{const n=()=>{var i,s,a,l;if(!e.current||!(((s=(i=e.current).checkVisibility)==null?void 0:s.call(i))??!0))return!1;const r=_7(e.current);(r.height===0||r.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",Ou.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 gj={position:"absolute",width:"100%",height:"100%",top:0,left:0},jQe=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function RQe({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:s=wg.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:m=!0,children:g,noWheelClassName:b,noPanClassName:y,onViewportChange:O,isControlledViewport:v,paneClickDistance:x,selectionOnDrag:w}){const S=Ji(),E=p.useRef(null),{userSelectionActive:k,lib:_,connectionInProgress:C}=Sr(jQe,Ki),T=$w(h),A=p.useRef();NQe(E);const j=p.useCallback(L=>{O==null||O({x:L[0],y:L[1],zoom:L[2]}),v||S.setState({transform:L})},[O,v]);return p.useEffect(()=>{if(E.current){A.current=wBe({domNode:E.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:N=>S.setState(D=>D.paneDragging===N?D:{paneDragging:N}),onPanZoomStart:(N,D)=>{const{onViewportChangeStart:Q,onMoveStart:F}=S.getState();F==null||F(N,D),Q==null||Q(D)},onPanZoom:(N,D)=>{const{onViewportChange:Q,onMove:F}=S.getState();F==null||F(N,D),Q==null||Q(D)},onPanZoomEnd:(N,D)=>{const{onViewportChangeEnd:Q,onMoveEnd:F}=S.getState();F==null||F(N,D),Q==null||Q(D)}});const{x:L,y:I,zoom:M}=A.current.getViewport();return S.setState({panZoom:A.current,transform:[L,I,M],domNode:E.current.closest(".react-flow")}),()=>{var N;(N=A.current)==null||N.destroy()}}},[]),p.useEffect(()=>{var L;(L=A.current)==null||L.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:s,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:T,preventScrolling:m,noPanClassName:y,userSelectionActive:k,noWheelClassName:b,lib:_,onTransformChange:j,connectionInProgress:C,selectionOnDrag:w,paneClickDistance:x})},[e,t,n,r,i,s,a,l,T,m,y,k,b,_,j,C,w,x]),o.jsx("div",{className:"react-flow__renderer",ref:E,style:gj,children:g})}const IQe=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function DQe(){const{userSelectionActive:e,userSelectionRect:t}=Sr(IQe,Ki);return e&&t?o.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 L5=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},PQe=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function MQe({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Dw.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:s,selectionOnDrag:a,onSelectionStart:l,onSelectionEnd:c,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:h,onPaneMouseMove:m,onPaneMouseLeave:g,children:b}){const y=p.useRef(0),O=Ji(),{userSelectionActive:v,elementsSelectable:x,dragging:w,connectionInProgress:S,panBy:E,autoPanSpeed:k}=Sr(PQe,Ki),_=x&&(e||v),C=p.useRef(null),T=p.useRef(),A=p.useRef(new Set),j=p.useRef(new Set),L=p.useRef(!1),I=p.useRef({x:0,y:0}),M=p.useRef(!1),N=ie=>{if(L.current||S){L.current=!1;return}u==null||u(ie),O.getState().resetSelectedElements(),O.setState({nodesSelectionActive:!1})},D=ie=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){ie.preventDefault();return}d==null||d(ie)},Q=f?ie=>f(ie):void 0,F=ie=>{L.current&&(ie.stopPropagation(),L.current=!1)},$=ie=>{var et,Te;const{domNode:q,transform:X}=O.getState();if(T.current=q==null?void 0:q.getBoundingClientRect(),!T.current)return;const K=ie.target===C.current;if(!K&&!!ie.target.closest(".nokey")||!e||!(a&&K||t)||ie.button!==0||!ie.isPrimary)return;(Te=(et=ie.target)==null?void 0:et.setPointerCapture)==null||Te.call(et,ie.pointerId),L.current=!1;const{x:Me,y:Ae}=uu(ie.nativeEvent,T.current),He=J1({x:Me,y:Ae},X);O.setState({userSelectionRect:{width:0,height:0,startX:He.x,startY:He.y,x:Me,y:Ae}}),K||(ie.stopPropagation(),ie.preventDefault())};function H(ie,q){const{userSelectionRect:X}=O.getState();if(!X)return;const{transform:K,nodeLookup:de,edgeLookup:xe,connectionLookup:Me,triggerNodeChanges:Ae,triggerEdgeChanges:He,defaultEdgeOptions:et}=O.getState(),Te={x:X.startX,y:X.startY},{x:Re,y:he}=o1(Te,K),me={startX:Te.x,startY:Te.y,x:ieQe.id)),j.current=new Set;const nt=(et==null?void 0:et.selectable)??!0;for(const Qe of A.current){const re=Me.get(Qe);if(re)for(const{edgeId:ue}of re.values()){const Pe=xe.get(ue);Pe&&(Pe.selectable??nt)&&j.current.add(ue)}}if(!Dq(Se,A.current)){const Qe=Hb(de,A.current,!0);Ae(Qe)}if(!Dq(ke,j.current)){const Qe=Hb(xe,j.current);He(Qe)}O.setState({userSelectionRect:me,userSelectionActive:!0,nodesSelectionActive:!1})}function z(){if(!i||!T.current)return;const[ie,q]=S7(I.current,T.current,k);E({x:ie,y:q}).then(X=>{if(!L.current||!X){y.current=requestAnimationFrame(z);return}const{x:K,y:de}=I.current;H(K,de),y.current=requestAnimationFrame(z)})}const B=()=>{cancelAnimationFrame(y.current),y.current=0,M.current=!1};p.useEffect(()=>()=>B(),[]);const V=ie=>{const{userSelectionRect:q,transform:X,resetSelectedElements:K}=O.getState();if(!T.current||!q)return;const{x:de,y:xe}=uu(ie.nativeEvent,T.current);I.current={x:de,y:xe};const Me=o1({x:q.startX,y:q.startY},X);if(!L.current){const Ae=t?0:s;if(Math.hypot(de-Me.x,xe-Me.y)<=Ae)return;K(),l==null||l(ie)}L.current=!0,M.current||(z(),M.current=!0),H(de,xe)},Z=ie=>{var q,X;ie.button===0&&((X=(q=ie.target)==null?void 0:q.releasePointerCapture)==null||X.call(q,ie.pointerId),!v&&ie.target===C.current&&O.getState().userSelectionRect&&(N==null||N(ie)),O.setState({userSelectionActive:!1,userSelectionRect:null}),L.current&&(c==null||c(ie),O.setState({nodesSelectionActive:A.current.size>0})),B())},ce=ie=>{var q,X;(X=(q=ie.target)==null?void 0:q.releasePointerCapture)==null||X.call(q,ie.pointerId),B()},be=r===!0||Array.isArray(r)&&r.includes(0);return o.jsxs("div",{className:qs(["react-flow__pane",{draggable:be,dragging:w,selection:e}]),onClick:_?void 0:L5(N,C),onContextMenu:L5(D,C),onWheel:L5(Q,C),onPointerEnter:_?void 0:h,onPointerMove:_?V:m,onPointerUp:_?Z:void 0,onPointerCancel:_?ce:void 0,onPointerDownCapture:_?$:void 0,onClickCapture:_?F:void 0,onPointerLeave:g,ref:C,style:gj,children:[b,o.jsx(DQe,{})]})}function I4({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:s,multiSelectionActive:a,nodeLookup:l,onError:c}=t.getState(),u=l.get(e);if(!u){c==null||c("012",Ou.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(s({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=r==null?void 0:r.current)==null?void 0:d.blur()})):i([e])}function ufe({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:s,nodeClickDistance:a}){const l=Ji(),[c,u]=p.useState(!1),d=p.useRef();return p.useEffect(()=>{d.current=lBe({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{I4({id:f,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),p.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:s,nodeId:i,nodeClickDistance:a}),()=>{var f;(f=d.current)==null||f.destroy()}},[n,r,t,s,e,i,a]),c}const LQe=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function dfe(){const e=Ji();return p.useCallback(n=>{const{nodeExtent:r,snapToGrid:i,snapGrid:s,nodesDraggable:a,onError:l,updateNodePositions:c,nodeLookup:u,nodeOrigin:d}=e.getState(),f=new Map,h=LQe(a),m=i?s[0]:5,g=i?s[1]:5,b=n.direction.x*m*n.factor,y=n.direction.y*g*n.factor;for(const[,O]of u){if(!h(O))continue;let v={x:O.internals.positionAbsolute.x+b,y:O.internals.positionAbsolute.y+y};i&&(v=aE(v,s));const{position:x,positionAbsolute:w}=Tde({nodeId:O.id,nextPosition:v,nodeLookup:u,nodeExtent:r,nodeOrigin:d,onError:l});O.position=x,O.internals.positionAbsolute=w,f.set(O.id,O)}c(f)},[])}const R7=p.createContext(null),$Qe=R7.Provider;R7.Consumer;const ffe=()=>p.useContext(R7),BQe=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),QQe=(e,t,n)=>r=>{const{connectionClickStartHandle:i,connectionMode:s,connection:a}=r,{fromHandle:l,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:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n,connectingTo:d,clickConnecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.id)===t&&(i==null?void 0:i.type)===n,isPossibleEndHandle:s===i1.Strict?(l==null?void 0:l.type)!==n:e!==(l==null?void 0:l.nodeId)||t!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!i,valid:d&&u}};function UQe({type:e="source",position:t=zt.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:s=!0,id:a,onConnect:l,children:c,className:u,onMouseDown:d,onTouchStart:f,...h},m){var M,N;const g=a||null,b=e==="target",y=Ji(),O=ffe(),{connectOnClick:v,noPanClassName:x,rfId:w}=Sr(BQe,Ki),{connectingFrom:S,connectingTo:E,clickConnecting:k,isPossibleEndHandle:_,connectionInProcess:C,clickConnectionInProcess:T,valid:A}=Sr(QQe(O,g,e),Ki);O||(N=(M=y.getState()).onError)==null||N.call(M,"010",Ou.error010());const j=D=>{const{defaultEdgeOptions:Q,onConnect:F,hasDefaultEdges:$}=y.getState(),H={...Q,...D};if($){const{edges:z,setEdges:B,onError:V}=y.getState();B(vQe(H,z,{onError:V}))}F==null||F(H),l==null||l(H)},L=D=>{if(!O)return;const Q=Dde(D.nativeEvent);if(i&&(Q&&D.button===0||!Q)){const F=y.getState();R4.onPointerDown(D.nativeEvent,{handleDomNode:D.currentTarget,autoPanOnConnect:F.autoPanOnConnect,connectionMode:F.connectionMode,connectionRadius:F.connectionRadius,domNode:F.domNode,nodeLookup:F.nodeLookup,lib:F.lib,isTarget:b,handleId:g,nodeId:O,flowId:F.rfId,panBy:F.panBy,cancelConnection:F.cancelConnection,onConnectStart:F.onConnectStart,onConnectEnd:(...$)=>{var H,z;return(z=(H=y.getState()).onConnectEnd)==null?void 0:z.call(H,...$)},updateConnection:F.updateConnection,onConnect:j,isValidConnection:n||((...$)=>{var H,z;return((z=(H=y.getState()).isValidConnection)==null?void 0:z.call(H,...$))??!0}),getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,autoPanSpeed:F.autoPanSpeed,dragThreshold:F.connectionDragThreshold})}Q?d==null||d(D):f==null||f(D)},I=D=>{const{onClickConnectStart:Q,onClickConnectEnd:F,connectionClickStartHandle:$,connectionMode:H,isValidConnection:z,lib:B,rfId:V,nodeLookup:Z,connection:ce}=y.getState();if(!O||!$&&!i)return;if(!$){Q==null||Q(D.nativeEvent,{nodeId:O,handleId:g,handleType:e}),y.setState({connectionClickStartHandle:{nodeId:O,type:e,id:g}});return}const be=Rde(D.target),ie=n||z,{connection:q,isValid:X}=R4.isValid(D.nativeEvent,{handle:{nodeId:O,id:g,type:e},connectionMode:H,fromNodeId:$.nodeId,fromHandleId:$.id||null,fromType:$.type,isValidConnection:ie,flowId:V,doc:be,lib:B,nodeLookup:Z});X&&q&&j(q);const K=structuredClone(ce);delete K.inProgress,K.toPosition=K.toHandle?K.toHandle.position:null,F==null||F(D,K),y.setState({connectionClickStartHandle:null})};return o.jsx("div",{"data-handleid":g,"data-nodeid":O,"data-handlepos":t,"data-id":`${w}-${O}-${g}-${e}`,className:qs(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",x,u,{source:!b,target:b,connectable:r,connectablestart:i,connectableend:s,clickconnecting:k,connectingfrom:S,connectingto:E,valid:A,connectionindicator:r&&(!C||_)&&(C||T?s:i)}]),onMouseDown:L,onTouchStart:L,onClick:v?I:void 0,ref:m,...h,children:c})}const qo=p.memo(lfe(UQe));function FQe({data:e,isConnectable:t,sourcePosition:n=zt.Bottom}){return o.jsxs(o.Fragment,{children:[e==null?void 0:e.label,o.jsx(qo,{type:"source",position:n,isConnectable:t})]})}function zQe({data:e,isConnectable:t,targetPosition:n=zt.Top,sourcePosition:r=zt.Bottom}){return o.jsxs(o.Fragment,{children:[o.jsx(qo,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,o.jsx(qo,{type:"source",position:r,isConnectable:t})]})}function VQe(){return null}function HQe({data:e,isConnectable:t,targetPosition:n=zt.Top}){return o.jsxs(o.Fragment,{children:[o.jsx(qo,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const LC={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},aX={input:FQe,default:zQe,output:HQe,group:VQe};function qQe(e){var t,n,r,i;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??((i=e.style)==null?void 0:i.height)}}const XQe=e=>{const{width:t,height:n,x:r,y:i}=sE(e.nodeLookup,{filter:s=>!!s.selected});return{width:cu(t)?t:null,height:cu(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function GQe({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Ji(),{width:i,height:s,transformString:a,userSelectionActive:l}=Sr(XQe,Ki),c=dfe(),u=p.useRef(null);p.useEffect(()=>{var m;n||(m=u.current)==null||m.focus({preventScroll:!0})},[n]);const d=!l&&i!==null&&s!==null;if(ufe({nodeRef:u,disabled:!d}),!d)return null;const f=e?m=>{const g=r.getState().nodes.filter(b=>b.selected);e(m,g)}:void 0,h=m=>{Object.prototype.hasOwnProperty.call(LC,m.key)&&(m.preventDefault(),c({direction:LC[m.key],factor:m.shiftKey?4:1}))};return o.jsx("div",{className:qs(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:o.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:i,height:s}})})}const oX=typeof window<"u"?window:void 0,WQe=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function hfe({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:d,selectionMode:f,onSelectionStart:h,onSelectionEnd:m,multiSelectionKeyCode:g,panActivationKeyCode:b,zoomActivationKeyCode:y,elementsSelectable:O,zoomOnScroll:v,zoomOnPinch:x,panOnScroll:w,panOnScrollSpeed:S,panOnScrollMode:E,zoomOnDoubleClick:k,panOnDrag:_,autoPanOnSelection:C,defaultViewport:T,translateExtent:A,minZoom:j,maxZoom:L,preventScrolling:I,onSelectionContextMenu:M,noWheelClassName:N,noPanClassName:D,disableKeyboardA11y:Q,onViewportChange:F,isControlledViewport:$}){const{nodesSelectionActive:H,userSelectionActive:z}=Sr(WQe,Ki),B=$w(u,{target:oX}),V=$w(b,{target:oX}),Z=V||_,ce=V||w,be=d&&Z!==!0,ie=B||z||be;return AQe({deleteKeyCode:c,multiSelectionKeyCode:g}),o.jsx(RQe,{onPaneContextMenu:s,elementsSelectable:O,zoomOnScroll:v,zoomOnPinch:x,panOnScroll:ce,panOnScrollSpeed:S,panOnScrollMode:E,zoomOnDoubleClick:k,panOnDrag:!B&&Z,defaultViewport:T,translateExtent:A,minZoom:j,maxZoom:L,zoomActivationKeyCode:y,preventScrolling:I,noWheelClassName:N,noPanClassName:D,onViewportChange:F,isControlledViewport:$,paneClickDistance:l,selectionOnDrag:be,children:o.jsxs(MQe,{onSelectionStart:h,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:a,panOnDrag:Z,autoPanOnSelection:C,isSelecting:!!ie,selectionMode:f,selectionKeyPressed:B,paneClickDistance:l,selectionOnDrag:be,children:[e,H&&o.jsx(GQe,{onSelectionContextMenu:M,noPanClassName:D,disableKeyboardA11y:Q})]})})}hfe.displayName="FlowRenderer";const YQe=p.memo(hfe),ZQe=e=>t=>e?w7(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 KQe(e){return Sr(p.useCallback(ZQe(e),[e]),Ki)}const JQe=e=>e.updateNodeInternals;function eUe(){const e=Sr(JQe),[t]=p.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(i=>{const s=i.target.getAttribute("data-id");r.set(s,{id:s,nodeElement:i.target,force:!0})}),e(r)}));return p.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function tUe({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const i=Ji(),s=p.useRef(null),a=p.useRef(null),l=p.useRef(e.sourcePosition),c=p.useRef(e.targetPosition),u=p.useRef(t),d=n&&!!e.internals.handleBounds;return p.useEffect(()=>{s.current&&!e.hidden&&(!d||a.current!==s.current)&&(a.current&&(r==null||r.unobserve(a.current)),r==null||r.observe(s.current),a.current=s.current)},[d,e.hidden]),p.useEffect(()=>()=>{a.current&&(r==null||r.unobserve(a.current),a.current=null)},[]),p.useEffect(()=>{if(s.current){const f=u.current!==t,h=l.current!==e.sourcePosition,m=c.current!==e.targetPosition;(f||h||m)&&(u.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),s}function nUe({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:s,onDoubleClick:a,nodesDraggable:l,elementsSelectable:c,nodesConnectable:u,nodesFocusable:d,resizeObserver:f,noDragClassName:h,noPanClassName:m,disableKeyboardA11y:g,rfId:b,nodeTypes:y,nodeClickDistance:O,onError:v}){const{node:x,internals:w,isParent:S}=Sr(ie=>{const q=ie.nodeLookup.get(e),X=ie.parentLookup.has(e);return{node:q,internals:q.internals,isParent:X}},Ki);let E=x.type||"default",k=(y==null?void 0:y[E])||aX[E];k===void 0&&(v==null||v("003",Ou.error003(E)),E="default",k=(y==null?void 0:y.default)||aX.default);const _=!!(x.draggable||l&&typeof x.draggable>"u"),C=!!(x.selectable||c&&typeof x.selectable>"u"),T=!!(x.connectable||u&&typeof x.connectable>"u"),A=!!(x.focusable||d&&typeof x.focusable>"u"),j=Ji(),L=k7(x),I=tUe({node:x,nodeType:E,hasDimensions:L,resizeObserver:f}),M=ufe({nodeRef:I,disabled:x.hidden||!_,noDragClassName:h,handleSelector:x.dragHandle,nodeId:e,isSelectable:C,nodeClickDistance:O}),N=dfe();if(x.hidden)return null;const D=gh(x),Q=qQe(x),F=C||_||t||n||r||i,$=n?ie=>n(ie,{...w.userNode}):void 0,H=r?ie=>r(ie,{...w.userNode}):void 0,z=i?ie=>i(ie,{...w.userNode}):void 0,B=s?ie=>s(ie,{...w.userNode}):void 0,V=a?ie=>a(ie,{...w.userNode}):void 0,Z=ie=>{const{selectNodesOnDrag:q,nodeDragThreshold:X}=j.getState();C&&(!q||!_||X>0)&&I4({id:e,store:j,nodeRef:I}),t&&t(ie,{...w.userNode})},ce=ie=>{if(!(Ide(ie.nativeEvent)||g)){if(wde.includes(ie.key)&&C){const q=ie.key==="Escape";I4({id:e,store:j,unselect:q,nodeRef:I})}else if(_&&x.selected&&Object.prototype.hasOwnProperty.call(LC,ie.key)){ie.preventDefault();const{ariaLabelConfig:q}=j.getState();j.setState({ariaLiveMessage:q["node.a11yDescription.ariaLiveMessage"]({direction:ie.key.replace("Arrow","").toLowerCase(),x:~~w.positionAbsolute.x,y:~~w.positionAbsolute.y})}),N({direction:LC[ie.key],factor:ie.shiftKey?4:1})}}},be=()=>{var Me;if(g||!((Me=I.current)!=null&&Me.matches(":focus-visible")))return;const{transform:ie,width:q,height:X,autoPanOnNodeFocus:K,setCenter:de}=j.getState();if(!K)return;w7(new Map([[e,x]]),{x:0,y:0,width:q,height:X},ie,!0).length>0||de(x.position.x+D.width/2,x.position.y+D.height/2,{zoom:ie[2]})};return o.jsx("div",{className:qs(["react-flow__node",`react-flow__node-${E}`,{[m]:_},x.className,{selected:x.selected,selectable:C,parent:S,draggable:_,dragging:M}]),ref:I,style:{zIndex:w.z,transform:`translate(${w.positionAbsolute.x}px,${w.positionAbsolute.y}px)`,pointerEvents:F?"all":"none",visibility:L?"visible":"hidden",...x.style,...Q},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:$,onMouseMove:H,onMouseLeave:z,onContextMenu:B,onClick:Z,onDoubleClick:V,onKeyDown:A?ce:void 0,tabIndex:A?0:void 0,onFocus:A?be:void 0,role:x.ariaRole??(A?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${nfe}-${b}`,"aria-label":x.ariaLabel,...x.domAttributes,children:o.jsx($Qe,{value:e,children:o.jsx(k,{id:e,data:x.data,type:E,positionAbsoluteX:w.positionAbsolute.x,positionAbsoluteY:w.positionAbsolute.y,selected:x.selected??!1,selectable:C,draggable:_,deletable:x.deletable??!0,isConnectable:T,sourcePosition:x.sourcePosition,targetPosition:x.targetPosition,dragging:M,dragHandle:x.dragHandle,zIndex:w.z,parentId:x.parentId,...D})})})}var rUe=p.memo(nUe);const iUe=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function pfe(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:s}=Sr(iUe,Ki),a=KQe(e.onlyRenderVisibleElements),l=eUe();return o.jsx("div",{className:"react-flow__nodes",style:gj,children:a.map(c=>o.jsx(rUe,{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:l,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:s},c))})}pfe.displayName="NodeRenderer";const sUe=p.memo(pfe);function aUe(e){return Sr(p.useCallback(n=>{if(!e)return n.edges.map(i=>i.id);const r=[];if(n.width&&n.height)for(const i of n.edges){const s=n.nodeLookup.get(i.source),a=n.nodeLookup.get(i.target);s&&a&&z7e({sourceNode:s,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(i.id)}return r},[e]),Ki)}const oUe=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return o.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},lUe=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return o.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},lX={[Pw.Arrow]:oUe,[Pw.ArrowClosed]:lUe};function cUe(e){const t=Ji();return p.useMemo(()=>{var i,s;return Object.prototype.hasOwnProperty.call(lX,e)?lX[e]:((s=(i=t.getState()).onError)==null||s.call(i,"009",Ou.error009(e)),null)},[e])}const uUe=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:s="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{const c=cUe(t);return c?o.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:l,refX:"0",refY:"0",children:o.jsx(c,{color:n,strokeWidth:a})}):null},mfe=({defaultColor:e,rfId:t})=>{const n=Sr(s=>s.edges),r=Sr(s=>s.defaultEdgeOptions),i=p.useMemo(()=>Z7e(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return i.length?o.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:o.jsx("defs",{children:i.map(s=>o.jsx(uUe,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};mfe.displayName="MarkerDefinitions";var dUe=p.memo(mfe);function gfe({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:s,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:c,className:u,...d}){const[f,h]=p.useState({x:1,y:0,width:0,height:0}),m=qs(["react-flow__edge-textwrapper",u]),g=p.useRef(null);return p.useEffect(()=>{if(g.current){const b=g.current.getBBox();h({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),n?o.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:m,visibility:f.width?"visible":"hidden",...d,children:[i&&o.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:s,rx:l,ry:l}),o.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:g,style:r,children:n}),c]}):null}gfe.displayName="EdgeText";const fUe=p.memo(gfe);function oE({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:u=20,...d}){return o.jsxs(o.Fragment,{children:[o.jsx("path",{...d,d:e,fill:"none",className:qs(["react-flow__edge-path",d.className])}),u?o.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&cu(t)&&cu(n)?o.jsx(fUe,{x:t,y:n,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function cX({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===zt.Left||e===zt.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function bfe({sourceX:e,sourceY:t,sourcePosition:n=zt.Bottom,targetX:r,targetY:i,targetPosition:s=zt.Top}){const[a,l]=cX({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,u]=cX({pos:s,x1:r,y1:i,x2:e,y2:t}),[d,f,h,m]=Pde({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${r},${i}`,d,f,h,m]}function yfe(e){return p.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:a,targetPosition:l,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:b,markerStart:y,interactionWidth:O})=>{const[v,x,w]=bfe({sourceX:n,sourceY:r,sourcePosition:a,targetX:i,targetY:s,targetPosition:l}),S=e.isInternal?void 0:t;return o.jsx(oE,{id:S,path:v,labelX:x,labelY:w,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:b,markerStart:y,interactionWidth:O})})}const hUe=yfe({isInternal:!1}),Ofe=yfe({isInternal:!0});hUe.displayName="SimpleBezierEdge";Ofe.displayName="SimpleBezierEdgeInternal";function xfe(e){return p.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:m=zt.Bottom,targetPosition:g=zt.Top,markerEnd:b,markerStart:y,pathOptions:O,interactionWidth:v})=>{const[x,w,S]=MC({sourceX:n,sourceY:r,sourcePosition:m,targetX:i,targetY:s,targetPosition:g,borderRadius:O==null?void 0:O.borderRadius,offset:O==null?void 0:O.offset,stepPosition:O==null?void 0:O.stepPosition}),E=e.isInternal?void 0:t;return o.jsx(oE,{id:E,path:x,labelX:w,labelY:S,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:b,markerStart:y,interactionWidth:v})})}const vfe=xfe({isInternal:!1}),wfe=xfe({isInternal:!0});vfe.displayName="SmoothStepEdge";wfe.displayName="SmoothStepEdgeInternal";function Sfe(e){return p.memo(({id:t,...n})=>{var i;const r=e.isInternal?void 0:t;return o.jsx(vfe,{...n,id:r,pathOptions:p.useMemo(()=>{var s;return{borderRadius:0,offset:(s=n.pathOptions)==null?void 0:s.offset}},[(i=n.pathOptions)==null?void 0:i.offset])})})}const pUe=Sfe({isInternal:!1}),Efe=Sfe({isInternal:!0});pUe.displayName="StepEdge";Efe.displayName="StepEdgeInternal";function kfe(e){return p.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:m,markerStart:g,interactionWidth:b})=>{const[y,O,v]=$de({sourceX:n,sourceY:r,targetX:i,targetY:s}),x=e.isInternal?void 0:t;return o.jsx(oE,{id:x,path:y,labelX:O,labelY:v,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:m,markerStart:g,interactionWidth:b})})}const mUe=kfe({isInternal:!1}),_fe=kfe({isInternal:!0});mUe.displayName="StraightEdge";_fe.displayName="StraightEdgeInternal";function Tfe(e){return p.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:a=zt.Bottom,targetPosition:l=zt.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:b,markerStart:y,pathOptions:O,interactionWidth:v})=>{const[x,w,S]=Mde({sourceX:n,sourceY:r,sourcePosition:a,targetX:i,targetY:s,targetPosition:l,curvature:O==null?void 0:O.curvature}),E=e.isInternal?void 0:t;return o.jsx(oE,{id:E,path:x,labelX:w,labelY:S,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:b,markerStart:y,interactionWidth:v})})}const gUe=Tfe({isInternal:!1}),Cfe=Tfe({isInternal:!0});gUe.displayName="BezierEdge";Cfe.displayName="BezierEdgeInternal";const uX={default:Cfe,straight:_fe,step:Efe,smoothstep:wfe,simplebezier:Ofe},dX={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},bUe=(e,t,n)=>n===zt.Left?e-t:n===zt.Right?e+t:e,yUe=(e,t,n)=>n===zt.Top?e-t:n===zt.Bottom?e+t:e,fX="react-flow__edgeupdater";function hX({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:s,onMouseOut:a,type:l}){return o.jsx("circle",{onMouseDown:i,onMouseEnter:s,onMouseOut:a,className:qs([fX,`${fX}-${l}`]),cx:bUe(t,r,e),cy:yUe(n,r,e),r,stroke:"transparent",fill:"transparent"})}function OUe({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:s,targetY:a,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:h,setUpdateHover:m}){const g=Ji(),b=(w,S)=>{if(w.button!==0)return;const{autoPanOnConnect:E,domNode:k,connectionMode:_,connectionRadius:C,lib:T,onConnectStart:A,cancelConnection:j,nodeLookup:L,rfId:I,panBy:M,updateConnection:N}=g.getState(),D=S.type==="target",Q=(H,z)=>{h(!1),f==null||f(H,n,S.type,z)},F=H=>u==null?void 0:u(n,H),$=(H,z)=>{h(!0),d==null||d(w,n,S.type),A==null||A(H,z)};R4.onPointerDown(w.nativeEvent,{autoPanOnConnect:E,connectionMode:_,connectionRadius:C,domNode:k,handleId:S.id,nodeId:S.nodeId,nodeLookup:L,isTarget:D,edgeUpdaterType:S.type,lib:T,flowId:I,cancelConnection:j,panBy:M,isValidConnection:(...H)=>{var z,B;return((B=(z=g.getState()).isValidConnection)==null?void 0:B.call(z,...H))??!0},onConnect:F,onConnectStart:$,onConnectEnd:(...H)=>{var z,B;return(B=(z=g.getState()).onConnectEnd)==null?void 0:B.call(z,...H)},onReconnectEnd:Q,updateConnection:N,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:w.currentTarget})},y=w=>b(w,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),O=w=>b(w,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),v=()=>m(!0),x=()=>m(!1);return o.jsxs(o.Fragment,{children:[(e===!0||e==="source")&&o.jsx(hX,{position:l,centerX:r,centerY:i,radius:t,onMouseDown:y,onMouseEnter:v,onMouseOut:x,type:"source"}),(e===!0||e==="target")&&o.jsx(hX,{position:c,centerX:s,centerY:a,radius:t,onMouseDown:O,onMouseEnter:v,onMouseOut:x,type:"target"})]})}function xUe({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:s,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:m,rfId:g,edgeTypes:b,noPanClassName:y,onError:O,disableKeyboardA11y:v}){let x=Sr(de=>de.edgeLookup.get(e));const w=Sr(de=>de.defaultEdgeOptions);x=w?{...w,...x}:x;let S=x.type||"default",E=(b==null?void 0:b[S])||uX[S];E===void 0&&(O==null||O("011",Ou.error011(S)),S="default",E=(b==null?void 0:b.default)||uX.default);const k=!!(x.focusable||t&&typeof x.focusable>"u"),_=typeof f<"u"&&(x.reconnectable||n&&typeof x.reconnectable>"u"),C=!!(x.selectable||r&&typeof x.selectable>"u"),T=p.useRef(null),[A,j]=p.useState(!1),[L,I]=p.useState(!1),M=Ji(),{zIndex:N,sourceX:D,sourceY:Q,targetX:F,targetY:$,sourcePosition:H,targetPosition:z}=Sr(p.useCallback(de=>{const xe=de.nodeLookup.get(x.source),Me=de.nodeLookup.get(x.target);if(!xe||!Me)return{zIndex:x.zIndex,...dX};const Ae=Y7e({id:e,sourceNode:xe,targetNode:Me,sourceHandle:x.sourceHandle||null,targetHandle:x.targetHandle||null,connectionMode:de.connectionMode,onError:O});return{zIndex:F7e({selected:x.selected,zIndex:x.zIndex,sourceNode:xe,targetNode:Me,elevateOnSelect:de.elevateEdgesOnSelect,zIndexMode:de.zIndexMode}),...Ae||dX}},[x.source,x.target,x.sourceHandle,x.targetHandle,x.selected,x.zIndex]),Ki),B=p.useMemo(()=>x.markerStart?`url('#${N4(x.markerStart,g)}')`:void 0,[x.markerStart,g]),V=p.useMemo(()=>x.markerEnd?`url('#${N4(x.markerEnd,g)}')`:void 0,[x.markerEnd,g]);if(x.hidden||D===null||Q===null||F===null||$===null)return null;const Z=de=>{var He;const{addSelectedEdges:xe,unselectNodesAndEdges:Me,multiSelectionActive:Ae}=M.getState();C&&(M.setState({nodesSelectionActive:!1}),x.selected&&Ae?(Me({nodes:[],edges:[x]}),(He=T.current)==null||He.blur()):xe([e])),i&&i(de,x)},ce=s?de=>{s(de,{...x})}:void 0,be=a?de=>{a(de,{...x})}:void 0,ie=l?de=>{l(de,{...x})}:void 0,q=c?de=>{c(de,{...x})}:void 0,X=u?de=>{u(de,{...x})}:void 0,K=de=>{var xe;if(!v&&wde.includes(de.key)&&C){const{unselectNodesAndEdges:Me,addSelectedEdges:Ae}=M.getState();de.key==="Escape"?((xe=T.current)==null||xe.blur(),Me({edges:[x]})):Ae([e])}};return o.jsx("svg",{style:{zIndex:N},children:o.jsxs("g",{className:qs(["react-flow__edge",`react-flow__edge-${S}`,x.className,y,{selected:x.selected,animated:x.animated,inactive:!C&&!i,updating:A,selectable:C}]),onClick:Z,onDoubleClick:ce,onContextMenu:be,onMouseEnter:ie,onMouseMove:q,onMouseLeave:X,onKeyDown:k?K:void 0,tabIndex:k?0:void 0,role:x.ariaRole??(k?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":x.ariaLabel===null?void 0:x.ariaLabel||`Edge from ${x.source} to ${x.target}`,"aria-describedby":k?`${rfe}-${g}`:void 0,ref:T,...x.domAttributes,children:[!L&&o.jsx(E,{id:e,source:x.source,target:x.target,type:x.type,selected:x.selected,animated:x.animated,selectable:C,deletable:x.deletable??!0,label:x.label,labelStyle:x.labelStyle,labelShowBg:x.labelShowBg,labelBgStyle:x.labelBgStyle,labelBgPadding:x.labelBgPadding,labelBgBorderRadius:x.labelBgBorderRadius,sourceX:D,sourceY:Q,targetX:F,targetY:$,sourcePosition:H,targetPosition:z,data:x.data,style:x.style,sourceHandleId:x.sourceHandle,targetHandleId:x.targetHandle,markerStart:B,markerEnd:V,pathOptions:"pathOptions"in x?x.pathOptions:void 0,interactionWidth:x.interactionWidth}),_&&o.jsx(OUe,{edge:x,isReconnectable:_,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:m,sourceX:D,sourceY:Q,targetX:F,targetY:$,sourcePosition:H,targetPosition:z,setUpdateHover:j,setReconnecting:I})]})})}var vUe=p.memo(xUe);const wUe=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Afe({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:s,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:h,onReconnectStart:m,onReconnectEnd:g,disableKeyboardA11y:b}){const{edgesFocusable:y,edgesReconnectable:O,elementsSelectable:v,onError:x}=Sr(wUe,Ki),w=aUe(t);return o.jsxs("div",{className:"react-flow__edges",children:[o.jsx(dUe,{defaultColor:e,rfId:n}),w.map(S=>o.jsx(vUe,{id:S,edgesFocusable:y,edgesReconnectable:O,elementsSelectable:v,noPanClassName:i,onReconnect:s,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:d,reconnectRadius:f,onDoubleClick:h,onReconnectStart:m,onReconnectEnd:g,rfId:n,onError:x,edgeTypes:r,disableKeyboardA11y:b},S))]})}Afe.displayName="EdgeRenderer";const SUe=p.memo(Afe),EUe=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function kUe({children:e}){const t=Sr(EUe);return o.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function _Ue(e){const t=mj(),n=p.useRef(!1);p.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const TUe=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function CUe(e){const t=Sr(TUe),n=Ji();return p.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function AUe(e){return e.connection.inProgress?{...e.connection,to:J1(e.connection.to,e.transform)}:{...e.connection}}function NUe(e){return AUe}function jUe(e){const t=NUe();return Sr(t,Ki)}const RUe=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function IUe({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:i,width:s,height:a,isValid:l,inProgress:c}=Sr(RUe,Ki);return!(s&&i&&c)?null:o.jsx("svg",{style:e,width:s,height:a,className:"react-flow__connectionline react-flow__container",children:o.jsx("g",{className:qs(["react-flow__connection",kde(l)]),children:o.jsx(Nfe,{style:t,type:n,CustomComponent:r,isValid:l})})})}const Nfe=({style:e,type:t=ip.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:i,from:s,fromNode:a,fromHandle:l,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h,pointer:m}=jUe();if(!i)return;if(n)return o.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:l,fromX:s.x,fromY:s.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:h,connectionStatus:kde(r),toNode:d,toHandle:f,pointer:m});let g="";const b={sourceX:s.x,sourceY:s.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case ip.Bezier:[g]=Mde(b);break;case ip.SimpleBezier:[g]=bfe(b);break;case ip.Step:[g]=MC({...b,borderRadius:0});break;case ip.SmoothStep:[g]=MC(b);break;default:[g]=$de(b)}return o.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};Nfe.displayName="ConnectionLine";const DUe={};function pX(e=DUe){p.useRef(e),Ji(),p.useEffect(()=>{},[e])}function PUe(){Ji(),p.useRef(!1),p.useEffect(()=>{},[])}function jfe({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:s,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:h,onSelectionEnd:m,connectionLineType:g,connectionLineStyle:b,connectionLineComponent:y,connectionLineContainerStyle:O,selectionKeyCode:v,selectionOnDrag:x,selectionMode:w,multiSelectionKeyCode:S,panActivationKeyCode:E,zoomActivationKeyCode:k,deleteKeyCode:_,onlyRenderVisibleElements:C,elementsSelectable:T,defaultViewport:A,translateExtent:j,minZoom:L,maxZoom:I,preventScrolling:M,defaultMarkerColor:N,zoomOnScroll:D,zoomOnPinch:Q,panOnScroll:F,panOnScrollSpeed:$,panOnScrollMode:H,zoomOnDoubleClick:z,panOnDrag:B,autoPanOnSelection:V,onPaneClick:Z,onPaneMouseEnter:ce,onPaneMouseMove:be,onPaneMouseLeave:ie,onPaneScroll:q,onPaneContextMenu:X,paneClickDistance:K,nodeClickDistance:de,onEdgeContextMenu:xe,onEdgeMouseEnter:Me,onEdgeMouseMove:Ae,onEdgeMouseLeave:He,reconnectRadius:et,onReconnect:Te,onReconnectStart:Re,onReconnectEnd:he,noDragClassName:me,noWheelClassName:Se,noPanClassName:ke,disableKeyboardA11y:nt,nodeExtent:Qe,rfId:re,viewport:ue,onViewportChange:Pe}){return pX(e),pX(t),PUe(),_Ue(n),CUe(ue),o.jsx(YQe,{onPaneClick:Z,onPaneMouseEnter:ce,onPaneMouseMove:be,onPaneMouseLeave:ie,onPaneContextMenu:X,onPaneScroll:q,paneClickDistance:K,deleteKeyCode:_,selectionKeyCode:v,selectionOnDrag:x,selectionMode:w,onSelectionStart:h,onSelectionEnd:m,multiSelectionKeyCode:S,panActivationKeyCode:E,zoomActivationKeyCode:k,elementsSelectable:T,zoomOnScroll:D,zoomOnPinch:Q,zoomOnDoubleClick:z,panOnScroll:F,panOnScrollSpeed:$,panOnScrollMode:H,panOnDrag:B,autoPanOnSelection:V,defaultViewport:A,translateExtent:j,minZoom:L,maxZoom:I,onSelectionContextMenu:f,preventScrolling:M,noDragClassName:me,noWheelClassName:Se,noPanClassName:ke,disableKeyboardA11y:nt,onViewportChange:Pe,isControlledViewport:!!ue,children:o.jsxs(kUe,{children:[o.jsx(SUe,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:a,onReconnect:Te,onReconnectStart:Re,onReconnectEnd:he,onlyRenderVisibleElements:C,onEdgeContextMenu:xe,onEdgeMouseEnter:Me,onEdgeMouseMove:Ae,onEdgeMouseLeave:He,reconnectRadius:et,defaultMarkerColor:N,noPanClassName:ke,disableKeyboardA11y:nt,rfId:re}),o.jsx(IUe,{style:b,type:g,component:y,containerStyle:O}),o.jsx("div",{className:"react-flow__edgelabel-renderer"}),o.jsx(sUe,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:s,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:de,onlyRenderVisibleElements:C,noPanClassName:ke,noDragClassName:me,disableKeyboardA11y:nt,nodeExtent:Qe,rfId:re}),o.jsx("div",{className:"react-flow__viewport-portal"})]})})}jfe.displayName="GraphView";const MUe=p.memo(jfe),LUe=Nde(),mX=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:a,fitViewOptions:l,minZoom:c=.5,maxZoom:u=2,nodeOrigin:d,nodeExtent:f,zIndexMode:h="basic"}={})=>{const m=new Map,g=new Map,b=new Map,y=new Map,O=r??t??[],v=n??e??[],x=d??[0,0],w=f??Iw;Ude(b,y,O);const{nodesInitialized:S}=j4(v,m,g,{nodeOrigin:x,nodeExtent:w,zIndexMode:h});let E=[0,0,1];if(a&&i&&s){const k=sE(m,{filter:A=>!!((A.width||A.initialWidth)&&(A.height||A.initialHeight))}),{x:_,y:C,zoom:T}=E7(k,i,s,c,u,(l==null?void 0:l.padding)??.1);E=[_,C,T]}return{rfId:"1",width:i??0,height:s??0,transform:E,nodes:v,nodesInitialized:S,nodeLookup:m,parentLookup:g,edges:O,edgeLookup:y,connectionLookup:b,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:Iw,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:i1.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:x,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:l,fitViewResolver:null,connection:{...Ede},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:LUe,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Sde,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},$Ue=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h})=>JBe((m,g)=>{async function b(){const{nodeLookup:y,panZoom:O,fitViewOptions:v,fitViewResolver:x,width:w,height:S,minZoom:E,maxZoom:k}=g();O&&(await P7e({nodes:y,width:w,height:S,panZoom:O,minZoom:E,maxZoom:k},v),x==null||x.resolve(!0),m({fitViewResolver:null}))}return{...mX({nodes:e,edges:t,width:i,height:s,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,defaultNodes:n,defaultEdges:r,zIndexMode:h}),setNodes:y=>{const{nodeLookup:O,parentLookup:v,nodeOrigin:x,elevateNodesOnSelect:w,fitViewQueued:S,zIndexMode:E,nodesSelectionActive:k}=g(),{nodesInitialized:_,hasSelectedNodes:C}=j4(y,O,v,{nodeOrigin:x,nodeExtent:f,elevateNodesOnSelect:w,checkEquality:!0,zIndexMode:E}),T=k&&C;S&&_?(b(),m({nodes:y,nodesInitialized:_,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:T})):m({nodes:y,nodesInitialized:_,nodesSelectionActive:T})},setEdges:y=>{const{connectionLookup:O,edgeLookup:v}=g();Ude(O,v,y),m({edges:y})},setDefaultNodesAndEdges:(y,O)=>{if(y){const{setNodes:v}=g();v(y),m({hasDefaultNodes:!0})}if(O){const{setEdges:v}=g();v(O),m({hasDefaultEdges:!0})}},updateNodeInternals:y=>{const{triggerNodeChanges:O,nodeLookup:v,parentLookup:x,domNode:w,nodeOrigin:S,nodeExtent:E,debug:k,fitViewQueued:_,zIndexMode:C}=g(),{changes:T,updatedInternals:A}=iBe(y,v,x,w,S,E,C);A&&(eBe(v,x,{nodeOrigin:S,nodeExtent:E,zIndexMode:C}),_?(b(),m({fitViewQueued:!1,fitViewOptions:void 0})):m({}),(T==null?void 0:T.length)>0&&(k&&console.log("React Flow: trigger node changes",T),O==null||O(T)))},updateNodePositions:(y,O=!1)=>{const v=[];let x=[];const{nodeLookup:w,triggerNodeChanges:S,connection:E,updateConnection:k,onNodesChangeMiddlewareMap:_}=g();for(const[C,T]of y){const A=w.get(C),j=!!(A!=null&&A.expandParent&&(A!=null&&A.parentId)&&(T!=null&&T.position)),L={id:C,type:"position",position:j?{x:Math.max(0,T.position.x),y:Math.max(0,T.position.y)}:T.position,dragging:O};if(A&&E.inProgress&&E.fromNode.id===A.id){const I=Fg(A,E.fromHandle,zt.Left,!0);k({...E,from:I})}j&&A.parentId&&v.push({id:C,parentId:A.parentId,rect:{...T.internals.positionAbsolute,width:T.measured.width??0,height:T.measured.height??0}}),x.push(L)}if(v.length>0){const{parentLookup:C,nodeOrigin:T}=g(),A=j7(v,w,C,T);x.push(...A)}for(const C of _.values())x=C(x);S(x)},triggerNodeChanges:y=>{const{onNodesChange:O,setNodes:v,nodes:x,hasDefaultNodes:w,debug:S}=g();if(y!=null&&y.length){if(w){const E=afe(y,x);v(E)}S&&console.log("React Flow: trigger node changes",y),O==null||O(y)}},triggerEdgeChanges:y=>{const{onEdgesChange:O,setEdges:v,edges:x,hasDefaultEdges:w,debug:S}=g();if(y!=null&&y.length){if(w){const E=ofe(y,x);v(E)}S&&console.log("React Flow: trigger edge changes",y),O==null||O(y)}},addSelectedNodes:y=>{const{multiSelectionActive:O,edgeLookup:v,nodeLookup:x,triggerNodeChanges:w,triggerEdgeChanges:S}=g();if(O){const E=y.map(k=>Vm(k,!0));w(E);return}w(Hb(x,new Set([...y]),!0)),S(Hb(v))},addSelectedEdges:y=>{const{multiSelectionActive:O,edgeLookup:v,nodeLookup:x,triggerNodeChanges:w,triggerEdgeChanges:S}=g();if(O){const E=y.map(k=>Vm(k,!0));S(E);return}S(Hb(v,new Set([...y]))),w(Hb(x,new Set,!0))},unselectNodesAndEdges:({nodes:y,edges:O}={})=>{const{edges:v,nodes:x,nodeLookup:w,triggerNodeChanges:S,triggerEdgeChanges:E}=g(),k=y||x,_=O||v,C=[];for(const A of k){if(!A.selected)continue;const j=w.get(A.id);j&&(j.selected=!1),C.push(Vm(A.id,!1))}const T=[];for(const A of _)A.selected&&T.push(Vm(A.id,!1));S(C),E(T)},setMinZoom:y=>{const{panZoom:O,maxZoom:v}=g();O==null||O.setScaleExtent([y,v]),m({minZoom:y})},setMaxZoom:y=>{const{panZoom:O,minZoom:v}=g();O==null||O.setScaleExtent([v,y]),m({maxZoom:y})},setTranslateExtent:y=>{var O;(O=g().panZoom)==null||O.setTranslateExtent(y),m({translateExtent:y})},resetSelectedElements:()=>{const{edges:y,nodes:O,triggerNodeChanges:v,triggerEdgeChanges:x,elementsSelectable:w}=g();if(!w)return;const S=O.reduce((k,_)=>_.selected?[...k,Vm(_.id,!1)]:k,[]),E=y.reduce((k,_)=>_.selected?[...k,Vm(_.id,!1)]:k,[]);v(S),x(E)},setNodeExtent:y=>{const{nodes:O,nodeLookup:v,parentLookup:x,nodeOrigin:w,elevateNodesOnSelect:S,nodeExtent:E,zIndexMode:k}=g();y[0][0]===E[0][0]&&y[0][1]===E[0][1]&&y[1][0]===E[1][0]&&y[1][1]===E[1][1]||(j4(O,v,x,{nodeOrigin:w,nodeExtent:y,elevateNodesOnSelect:S,checkEquality:!1,zIndexMode:k}),m({nodeExtent:y}))},panBy:y=>{const{transform:O,width:v,height:x,panZoom:w,translateExtent:S}=g();return sBe({delta:y,panZoom:w,transform:O,translateExtent:S,width:v,height:x})},setCenter:async(y,O,v)=>{const{width:x,height:w,maxZoom:S,panZoom:E}=g();if(!E)return!1;const k=typeof(v==null?void 0:v.zoom)<"u"?v.zoom:S;return await E.setViewport({x:x/2-y*k,y:w/2-O*k,zoom:k},{duration:v==null?void 0:v.duration,ease:v==null?void 0:v.ease,interpolate:v==null?void 0:v.interpolate}),!0},cancelConnection:()=>{m({connection:{...Ede}})},updateConnection:y=>{m({connection:y})},reset:()=>m({...mX()})}},Object.is);function Rfe({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:s,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:c,fitView:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:m}){const[g]=p.useState(()=>$Ue({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:u,minZoom:a,maxZoom:l,fitViewOptions:c,nodeOrigin:d,nodeExtent:f,zIndexMode:h}));return o.jsx(eQe,{value:g,children:o.jsx(kQe,{children:m})})}function BUe({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:s,height:a,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:m}){return p.useContext(hj)?o.jsx(o.Fragment,{children:e}):o.jsx(Rfe,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:s,initialHeight:a,fitView:l,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:m,children:e})}const QUe={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function UUe({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:s,edgeTypes:a,onNodeClick:l,onEdgeClick:c,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:h,onConnect:m,onConnectStart:g,onConnectEnd:b,onClickConnectStart:y,onClickConnectEnd:O,onNodeMouseEnter:v,onNodeMouseMove:x,onNodeMouseLeave:w,onNodeContextMenu:S,onNodeDoubleClick:E,onNodeDragStart:k,onNodeDrag:_,onNodeDragStop:C,onNodesDelete:T,onEdgesDelete:A,onDelete:j,onSelectionChange:L,onSelectionDragStart:I,onSelectionDrag:M,onSelectionDragStop:N,onSelectionContextMenu:D,onSelectionStart:Q,onSelectionEnd:F,onBeforeDelete:$,connectionMode:H,connectionLineType:z=ip.Bezier,connectionLineStyle:B,connectionLineComponent:V,connectionLineContainerStyle:Z,deleteKeyCode:ce="Backspace",selectionKeyCode:be="Shift",selectionOnDrag:ie=!1,selectionMode:q=Dw.Full,panActivationKeyCode:X="Space",multiSelectionKeyCode:K=Lw()?"Meta":"Control",zoomActivationKeyCode:de=Lw()?"Meta":"Control",snapToGrid:xe,snapGrid:Me,onlyRenderVisibleElements:Ae=!1,selectNodesOnDrag:He,nodesDraggable:et,autoPanOnNodeFocus:Te,nodesConnectable:Re,nodesFocusable:he,nodeOrigin:me=ife,edgesFocusable:Se,edgesReconnectable:ke,elementsSelectable:nt=!0,defaultViewport:Qe=hQe,minZoom:re=.5,maxZoom:ue=2,translateExtent:Pe=Iw,preventScrolling:Ge=!0,nodeExtent:W,defaultMarkerColor:_e="#b1b1b7",zoomOnScroll:rt=!0,zoomOnPinch:Ve=!0,panOnScroll:We=!1,panOnScrollSpeed:ot=.5,panOnScrollMode:St=wg.Free,zoomOnDoubleClick:Vt=!0,panOnDrag:_t=!0,onPaneClick:Ne,onPaneMouseEnter:$e,onPaneMouseMove:mt,onPaneMouseLeave:Ht,onPaneScroll:qe,onPaneContextMenu:ye,paneClickDistance:Ue=1,nodeClickDistance:it=0,children:we,onReconnect:Fe,onReconnectStart:dt,onReconnectEnd:Tt,onEdgeContextMenu:Pt,onEdgeDoubleClick:nn,onEdgeMouseEnter:ln,onEdgeMouseMove:le,onEdgeMouseLeave:Wt,reconnectRadius:Le=10,onNodesChange:Rt,onEdgesChange:Ce,noDragClassName:bt="nodrag",noWheelClassName:Ut="nowheel",noPanClassName:lt="nopan",fitView:sn,fitViewOptions:yr,connectOnClick:sr,attributionPosition:ze,proOptions:tt,defaultEdgeOptions:en,elevateNodesOnSelect:rn=!0,elevateEdgesOnSelect:rr=!1,disableKeyboardA11y:dr=!1,autoPanOnConnect:Rn,autoPanOnNodeDrag:ar,autoPanOnSelection:Vr=!0,autoPanSpeed:Hr,connectionRadius:Zr,isValidConnection:Lr,onError:ir,style:Kr,id:Jr,nodeDragThreshold:qr,connectionDragThreshold:es,viewport:li,onViewportChange:Xr,width:ei,height:ra,colorMode:ms="light",debug:gi,onScroll:gs,ariaLabelConfig:Ni,zIndexMode:xa="basic",...bs},Ar){const Ua=Jr||"1",Fi=bQe(ms),Fa=p.useCallback($n=>{$n.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),gs==null||gs($n)},[gs]);return o.jsx("div",{"data-testid":"rf__wrapper",...bs,onScroll:Fa,style:{...Kr,...QUe},ref:Ar,className:qs(["react-flow",i,Fi]),id:Jr,role:"application",children:o.jsxs(BUe,{nodes:e,edges:t,width:ei,height:ra,fitView:sn,fitViewOptions:yr,minZoom:re,maxZoom:ue,nodeOrigin:me,nodeExtent:W,zIndexMode:xa,children:[o.jsx(gQe,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:m,onConnectStart:g,onConnectEnd:b,onClickConnectStart:y,onClickConnectEnd:O,nodesDraggable:et,autoPanOnNodeFocus:Te,nodesConnectable:Re,nodesFocusable:he,edgesFocusable:Se,edgesReconnectable:ke,elementsSelectable:nt,elevateNodesOnSelect:rn,elevateEdgesOnSelect:rr,minZoom:re,maxZoom:ue,nodeExtent:W,onNodesChange:Rt,onEdgesChange:Ce,snapToGrid:xe,snapGrid:Me,connectionMode:H,translateExtent:Pe,connectOnClick:sr,defaultEdgeOptions:en,fitView:sn,fitViewOptions:yr,onNodesDelete:T,onEdgesDelete:A,onDelete:j,onNodeDragStart:k,onNodeDrag:_,onNodeDragStop:C,onSelectionDrag:M,onSelectionDragStart:I,onSelectionDragStop:N,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:lt,nodeOrigin:me,rfId:Ua,autoPanOnConnect:Rn,autoPanOnNodeDrag:ar,autoPanSpeed:Hr,onError:ir,connectionRadius:Zr,isValidConnection:Lr,selectNodesOnDrag:He,nodeDragThreshold:qr,connectionDragThreshold:es,onBeforeDelete:$,debug:gi,ariaLabelConfig:Ni,zIndexMode:xa}),o.jsx(MUe,{onInit:u,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:x,onNodeMouseLeave:w,onNodeContextMenu:S,onNodeDoubleClick:E,nodeTypes:s,edgeTypes:a,connectionLineType:z,connectionLineStyle:B,connectionLineComponent:V,connectionLineContainerStyle:Z,selectionKeyCode:be,selectionOnDrag:ie,selectionMode:q,deleteKeyCode:ce,multiSelectionKeyCode:K,panActivationKeyCode:X,zoomActivationKeyCode:de,onlyRenderVisibleElements:Ae,defaultViewport:Qe,translateExtent:Pe,minZoom:re,maxZoom:ue,preventScrolling:Ge,zoomOnScroll:rt,zoomOnPinch:Ve,zoomOnDoubleClick:Vt,panOnScroll:We,panOnScrollSpeed:ot,panOnScrollMode:St,panOnDrag:_t,autoPanOnSelection:Vr,onPaneClick:Ne,onPaneMouseEnter:$e,onPaneMouseMove:mt,onPaneMouseLeave:Ht,onPaneScroll:qe,onPaneContextMenu:ye,paneClickDistance:Ue,nodeClickDistance:it,onSelectionContextMenu:D,onSelectionStart:Q,onSelectionEnd:F,onReconnect:Fe,onReconnectStart:dt,onReconnectEnd:Tt,onEdgeContextMenu:Pt,onEdgeDoubleClick:nn,onEdgeMouseEnter:ln,onEdgeMouseMove:le,onEdgeMouseLeave:Wt,reconnectRadius:Le,defaultMarkerColor:_e,noDragClassName:bt,noWheelClassName:Ut,noPanClassName:lt,rfId:Ua,disableKeyboardA11y:dr,nodeExtent:W,viewport:li,onViewportChange:Xr}),o.jsx(fQe,{onSelectionChange:L}),we,o.jsx(oQe,{proOptions:tt,position:ze}),o.jsx(aQe,{rfId:Ua,disableKeyboardA11y:dr})]})})}var FUe=lfe(UUe);const zUe=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function VUe({children:e}){const t=Sr(zUe);return t?Cr.createPortal(e,t):null}function HUe(e){const[t,n]=p.useState(e),r=p.useCallback(i=>n(s=>afe(i,s)),[]);return[t,n,r]}function qUe(e){const[t,n]=p.useState(e),r=p.useCallback(i=>n(s=>ofe(i,s)),[]);return[t,n,r]}const XUe=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||!k7(n.userNode))return!1;return!0};function GUe(e={includeHiddenNodes:!1}){return Sr(XUe(e))}function WUe({dimensions:e,lineWidth:t,variant:n,className:r}){return o.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:qs(["react-flow__background-pattern",n,r])})}function YUe({radius:e,className:t}){return o.jsx("circle",{cx:e,cy:e,r:e,className:qs(["react-flow__background-pattern","dots",t])})}var Ap;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ap||(Ap={}));const ZUe={[Ap.Dots]:1,[Ap.Lines]:1,[Ap.Cross]:6},KUe=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Ife({id:e,variant:t=Ap.Dots,gap:n=20,size:r,lineWidth:i=1,offset:s=0,color:a,bgColor:l,style:c,className:u,patternClassName:d}){const f=p.useRef(null),{transform:h,patternId:m}=Sr(KUe,Ki),g=r||ZUe[t],b=t===Ap.Dots,y=t===Ap.Cross,O=Array.isArray(n)?n:[n,n],v=[O[0]*h[2]||1,O[1]*h[2]||1],x=g*h[2],w=Array.isArray(s)?s:[s,s],S=y?[x,x]:v,E=[w[0]*h[2]||1+S[0]/2,w[1]*h[2]||1+S[1]/2],k=`${m}${e||""}`;return o.jsxs("svg",{className:qs(["react-flow__background",u]),style:{...c,...gj,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:f,"data-testid":"rf__background",children:[o.jsx("pattern",{id:k,x:h[0]%v[0],y:h[1]%v[1],width:v[0],height:v[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${E[0]},-${E[1]})`,children:b?o.jsx(YUe,{radius:x/2,className:d}):o.jsx(WUe,{dimensions:S,lineWidth:i,variant:t,className:d})}),o.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${k})`})]})}Ife.displayName="Background";const JUe=p.memo(Ife);function eFe(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:o.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function tFe(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:o.jsx("path",{d:"M0 0h32v4.2H0z"})})}function nFe(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:o.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 rFe(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.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 iFe(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.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 u2({children:e,className:t,...n}){return o.jsx("button",{type:"button",className:qs(["react-flow__controls-button",t]),...n,children:e})}const sFe=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Dfe({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:s,onZoomOut:a,onFitView:l,onInteractiveChange:c,className:u,children:d,position:f="bottom-left",orientation:h="vertical","aria-label":m}){const g=Ji(),{isInteractive:b,minZoomReached:y,maxZoomReached:O,ariaLabelConfig:v}=Sr(sFe,Ki),{zoomIn:x,zoomOut:w,fitView:S}=mj(),E=()=>{x(),s==null||s()},k=()=>{w(),a==null||a()},_=()=>{S(i),l==null||l()},C=()=>{g.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),c==null||c(!b)},T=h==="horizontal"?"horizontal":"vertical";return o.jsxs(pj,{className:qs(["react-flow__controls",T,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":m??v["controls.ariaLabel"],children:[t&&o.jsxs(o.Fragment,{children:[o.jsx(u2,{onClick:E,className:"react-flow__controls-zoomin",title:v["controls.zoomIn.ariaLabel"],"aria-label":v["controls.zoomIn.ariaLabel"],disabled:O,children:o.jsx(eFe,{})}),o.jsx(u2,{onClick:k,className:"react-flow__controls-zoomout",title:v["controls.zoomOut.ariaLabel"],"aria-label":v["controls.zoomOut.ariaLabel"],disabled:y,children:o.jsx(tFe,{})})]}),n&&o.jsx(u2,{className:"react-flow__controls-fitview",onClick:_,title:v["controls.fitView.ariaLabel"],"aria-label":v["controls.fitView.ariaLabel"],children:o.jsx(nFe,{})}),r&&o.jsx(u2,{className:"react-flow__controls-interactive",onClick:C,title:v["controls.interactive.ariaLabel"],"aria-label":v["controls.interactive.ariaLabel"],children:b?o.jsx(iFe,{}):o.jsx(rFe,{})}),d]})}Dfe.displayName="Controls";const aFe=p.memo(Dfe);function oFe({id:e,x:t,y:n,width:r,height:i,style:s,color:a,strokeColor:l,strokeWidth:c,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:m}){const{background:g,backgroundColor:b}=s||{},y=a||g||b;return o.jsx("rect",{className:qs(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:d,ry:d,width:r,height:i,style:{fill:y,stroke:l,strokeWidth:c},shapeRendering:f,onClick:m?O=>m(O,e):void 0})}const lFe=p.memo(oFe),cFe=e=>e.nodes.map(t=>t.id),$5=e=>e instanceof Function?e:()=>e;function uFe({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:s=lFe,onClick:a}){const l=Sr(cFe,Ki),c=$5(t),u=$5(e),d=$5(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return o.jsx(o.Fragment,{children:l.map(h=>o.jsx(fFe,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:s,onClick:a,shapeRendering:f},h))})}function dFe({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:s,shapeRendering:a,NodeComponent:l,onClick:c}){const{node:u,x:d,y:f,width:h,height:m}=Sr(g=>{const b=g.nodeLookup.get(e);if(!b)return{node:void 0,x:0,y:0,width:0,height:0};const y=b.internals.userNode,{x:O,y:v}=b.internals.positionAbsolute,{width:x,height:w}=gh(y);return{node:y,x:O,y:v,width:x,height:w}},Ki);return!u||u.hidden||!k7(u)?null:o.jsx(l,{x:d,y:f,width:h,height:m,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:i,strokeColor:n(u),strokeWidth:s,shapeRendering:a,onClick:c,id:u.id})}const fFe=p.memo(dFe);var hFe=p.memo(uFe);const pFe=200,mFe=150,gFe=e=>!e.hidden,bFe=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?Ade(sE(e.nodeLookup,{filter:gFe}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},yFe="react-flow__minimap-desc";function Pfe({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i="",nodeBorderRadius:s=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:c,maskColor:u,maskStrokeColor:d,maskStrokeWidth:f,position:h="bottom-right",onClick:m,onNodeClick:g,pannable:b=!1,zoomable:y=!1,ariaLabel:O,inversePan:v,zoomStep:x=1,offsetScale:w=5}){const S=Ji(),E=p.useRef(null),{boundingRect:k,viewBB:_,rfId:C,panZoom:T,translateExtent:A,flowWidth:j,flowHeight:L,ariaLabelConfig:I}=Sr(bFe,Ki),M=(e==null?void 0:e.width)??pFe,N=(e==null?void 0:e.height)??mFe,D=k.width/M,Q=k.height/N,F=Math.max(D,Q),$=F*M,H=F*N,z=w*F,B=k.x-($-k.width)/2-z,V=k.y-(H-k.height)/2-z,Z=$+z*2,ce=H+z*2,be=`${yFe}-${C}`,ie=p.useRef(0),q=p.useRef();ie.current=F,p.useEffect(()=>{if(E.current&&T)return q.current=pBe({domNode:E.current,panZoom:T,getTransform:()=>S.getState().transform,getViewScale:()=>ie.current}),()=>{var xe;(xe=q.current)==null||xe.destroy()}},[T]),p.useEffect(()=>{var xe;(xe=q.current)==null||xe.update({translateExtent:A,width:j,height:L,inversePan:v,pannable:b,zoomStep:x,zoomable:y})},[b,y,v,x,A,j,L]);const X=m?xe=>{var He;const[Me,Ae]=((He=q.current)==null?void 0:He.pointer(xe))||[0,0];m(xe,{x:Me,y:Ae})}:void 0,K=g?p.useCallback((xe,Me)=>{const Ae=S.getState().nodeLookup.get(Me).internals.userNode;g(xe,Ae)},[]):void 0,de=O??I["minimap.ariaLabel"];return o.jsx(pj,{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:qs(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:o.jsxs("svg",{width:M,height:N,viewBox:`${B} ${V} ${Z} ${ce}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":be,ref:E,onClick:X,children:[de&&o.jsx("title",{id:be,children:de}),o.jsx(hFe,{onClick:K,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:i,nodeStrokeWidth:a,nodeComponent:l}),o.jsx("path",{className:"react-flow__minimap-mask",d:`M${B-z},${V-z}h${Z+z*2}v${ce+z*2}h${-Z-z*2}z - M${_.x},${_.y}h${_.width}v${_.height}h${-_.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Pfe.displayName="MiniMap";p.memo(Pfe);const OFe=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,xFe={[l1.Line]:"right",[l1.Handle]:"bottom-right"};function vFe({nodeId:e,position:t,variant:n=l1.Handle,className:r,style:i=void 0,children:s,color:a,minWidth:l=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:h,autoScale:m=!0,shouldResize:g,onResizeStart:b,onResize:y,onResizeEnd:O}){const v=ffe(),x=typeof e=="string"?e:v,w=Ji(),S=p.useRef(null),E=n===l1.Handle,k=Sr(p.useCallback(OFe(E&&m),[E,m]),Ki),_=p.useRef(null),C=t??xFe[n];p.useEffect(()=>{if(!(!S.current||!x))return _.current||(_.current=TBe({domNode:S.current,nodeId:x,getStoreItems:()=>{const{nodeLookup:A,transform:j,snapGrid:L,snapToGrid:I,nodeOrigin:M,domNode:N}=w.getState();return{nodeLookup:A,transform:j,snapGrid:L,snapToGrid:I,nodeOrigin:M,paneDomNode:N}},onChange:(A,j)=>{const{triggerNodeChanges:L,nodeLookup:I,parentLookup:M,nodeOrigin:N}=w.getState(),D=[],Q={x:A.x,y:A.y},F=I.get(x);if(F&&F.expandParent&&F.parentId){const $=F.origin??N,H=A.width??F.measured.width??0,z=A.height??F.measured.height??0,B={id:F.id,parentId:F.parentId,rect:{width:H,height:z,...jde({x:A.x??F.position.x,y:A.y??F.position.y},{width:H,height:z},F.parentId,I,$)}},V=j7([B],I,M,N);D.push(...V),Q.x=A.x?Math.max($[0]*H,A.x):void 0,Q.y=A.y?Math.max($[1]*z,A.y):void 0}if(Q.x!==void 0&&Q.y!==void 0){const $={id:x,type:"position",position:{...Q}};D.push($)}if(A.width!==void 0&&A.height!==void 0){const H={id:x,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:A.width,height:A.height}};D.push(H)}for(const $ of j){const H={...$,type:"position"};D.push(H)}L(D)},onEnd:({width:A,height:j})=>{const L={id:x,type:"dimensions",resizing:!1,dimensions:{width:A,height:j}};w.getState().triggerNodeChanges([L])}})),_.current.update({controlPosition:C,boundaries:{minWidth:l,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:b,onResize:y,onResizeEnd:O,shouldResize:g}),()=>{var A;(A=_.current)==null||A.destroy()}},[C,l,c,u,d,f,b,y,O,g]);const T=C.split("-");return o.jsx("div",{className:qs(["react-flow__resize-control","nodrag",...T,n,r]),ref:S,style:{...i,scale:k,...a&&{[E?"backgroundColor":"borderColor"]:a}},children:s})}p.memo(vFe);var Mfe=Object.defineProperty,wFe=(e,t,n)=>t in e?Mfe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,SFe=(e,t)=>{for(var n in t)Mfe(e,n,{get:t[n],enumerable:!0})},EFe=(e,t,n)=>wFe(e,t+"",n),Lfe={};SFe(Lfe,{Graph:()=>Qc,alg:()=>I7,json:()=>Bfe,version:()=>TFe});var kFe=Object.defineProperty,$fe=(e,t)=>{for(var n in t)kFe(e,n,{get:t[n],enumerable:!0})},Qc=class{constructor(t){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=()=>{},t&&(this._isDirected="directed"in t?t.directed:!0,this._isMultigraph="multigraph"in t?t.multigraph:!1,this._isCompound="compound"in t?t.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return typeof t!="function"?this._defaultNodeLabelFn=()=>t:this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(t=>Object.keys(this._in[t]).length===0)}sinks(){return this.nodes().filter(t=>Object.keys(this._out[t]).length===0)}setNodes(t,n){return t.forEach(r=>{n!==void 0?this.setNode(r,n):this.setNode(r)}),this}setNode(t,n){return t in this._nodes?(arguments.length>1&&(this._nodes[t]=n),this):(this._nodes[t]=arguments.length>1?n:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]="\0",this._children[t]={},this._children["\0"][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return t in this._nodes}removeNode(t){if(t in this._nodes){let n=r=>this.removeEdge(this._edgeObjs[r]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],this.children(t).forEach(r=>{this.setParent(r)}),delete this._children[t]),Object.keys(this._in[t]).forEach(n),delete this._in[t],delete this._preds[t],Object.keys(this._out[t]).forEach(n),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,n){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n===void 0)n="\0";else{n+="";for(let r=n;r!==void 0;r=this.parent(r))if(r===t)throw new Error("Setting "+n+" as parent of "+t+" would create a cycle");this.setNode(n)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=n,this._children[n][t]=!0,this}parent(t){if(this._isCompound){let n=this._parent[t];if(n!=="\0")return n}}children(t="\0"){if(this._isCompound){let n=this._children[t];if(n)return Object.keys(n)}else{if(t==="\0")return this.nodes();if(this.hasNode(t))return[]}return[]}predecessors(t){let n=this._preds[t];if(n)return Object.keys(n)}successors(t){let n=this._sucs[t];if(n)return Object.keys(n)}neighbors(t){let n=this.predecessors(t);if(n){let r=new Set(n);for(let i of this.successors(t))r.add(i);return Array.from(r.values())}}isLeaf(t){let n;return this.isDirected()?n=this.successors(t):n=this.neighbors(t),n.length===0}filterNodes(t){let n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph()),Object.entries(this._nodes).forEach(([s,a])=>{t(s)&&n.setNode(s,a)}),Object.values(this._edgeObjs).forEach(s=>{n.hasNode(s.v)&&n.hasNode(s.w)&&n.setEdge(s,this.edge(s))});let r={},i=s=>{let a=this.parent(s);return!a||n.hasNode(a)?(r[s]=a??void 0,a??void 0):a in r?r[a]:i(a)};return this._isCompound&&n.nodes().forEach(s=>n.setParent(s,i(s))),n}setDefaultEdgeLabel(t){return typeof t!="function"?this._defaultEdgeLabelFn=()=>t:this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(t,n){return t.reduce((r,i)=>(n!==void 0?this.setEdge(r,i,n):this.setEdge(r,i),i)),this}setEdge(t,n,r,i){let s,a,l,c,u=!1;typeof t=="object"&&t!==null&&"v"in t?(s=t.v,a=t.w,l=t.name,arguments.length===2&&(c=n,u=!0)):(s=t,a=n,l=i,arguments.length>2&&(c=r,u=!0)),s=""+s,a=""+a,l!==void 0&&(l=""+l);let d=Vx(this._isDirected,s,a,l);if(d in this._edgeLabels)return u&&(this._edgeLabels[d]=c),this;if(l!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(s),this.setNode(a),this._edgeLabels[d]=u?c:this._defaultEdgeLabelFn(s,a,l);let f=_Fe(this._isDirected,s,a,l);return s=f.v,a=f.w,Object.freeze(f),this._edgeObjs[d]=f,gX(this._preds[a],s),gX(this._sucs[s],a),this._in[a][d]=f,this._out[s][d]=f,this._edgeCount++,this}edge(t,n,r){let i=arguments.length===1?B5(this._isDirected,t):Vx(this._isDirected,t,n,r);return this._edgeLabels[i]}edgeAsObj(t,n,r){let i=arguments.length===1?this.edge(t):this.edge(t,n,r);return typeof i!="object"?{label:i}:i}hasEdge(t,n,r){return(arguments.length===1?B5(this._isDirected,t):Vx(this._isDirected,t,n,r))in this._edgeLabels}removeEdge(t,n,r){let i=arguments.length===1?B5(this._isDirected,t):Vx(this._isDirected,t,n,r),s=this._edgeObjs[i];if(s){let a=s.v,l=s.w;delete this._edgeLabels[i],delete this._edgeObjs[i],bX(this._preds[l],a),bX(this._sucs[a],l),delete this._in[l][i],delete this._out[a][i],this._edgeCount--}return this}inEdges(t,n){return this.isDirected()?this.filterEdges(this._in[t],t,n):this.nodeEdges(t,n)}outEdges(t,n){return this.isDirected()?this.filterEdges(this._out[t],t,n):this.nodeEdges(t,n)}nodeEdges(t,n){if(t in this._nodes)return this.filterEdges({...this._in[t],...this._out[t]},t,n)}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}filterEdges(t,n,r){if(!t)return;let i=Object.values(t);return r?i.filter(s=>s.v===n&&s.w===r||s.v===r&&s.w===n):i}};function gX(e,t){e[t]?e[t]++:e[t]=1}function bX(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function Vx(e,t,n,r){let i=""+t,s=""+n;if(!e&&i>s){let a=i;i=s,s=a}return i+""+s+""+(r===void 0?"\0":r)}function _Fe(e,t,n,r){let i=""+t,s=""+n;if(!e&&i>s){let l=i;i=s,s=l}let a={v:i,w:s};return r&&(a.name=r),a}function B5(e,t){return Vx(e,t.v,t.w,t.name)}var TFe="4.0.1",Bfe={};$fe(Bfe,{read:()=>jFe,write:()=>CFe});function CFe(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:AFe(e),edges:NFe(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function AFe(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function NFe(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 jFe(e){let t=new Qc(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 I7={};$fe(I7,{CycleException:()=>BC,bellmanFord:()=>Qfe,components:()=>DFe,dijkstra:()=>$C,dijkstraAll:()=>LFe,findCycles:()=>$Fe,floydWarshall:()=>QFe,isAcyclic:()=>FFe,postorder:()=>VFe,preorder:()=>HFe,prim:()=>qFe,shortestPaths:()=>XFe,tarjan:()=>Ffe,topsort:()=>zfe});var RFe=()=>1;function Qfe(e,t,n,r){return IFe(e,String(t),n||RFe,r||function(i){return e.outEdges(i)})}function IFe(e,t,n,r){let i={},s,a=0,l=e.nodes(),c=function(f){let h=n(f);i[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 i=this._arr,s=i.length;return n[r]=s,i.push({key:r,priority:t}),this._decrease(s),!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,i=e;n>1,!(t[r].priority1;function $C(e,t,n,r){let i=function(s){return e.outEdges(s)};return MFe(e,String(t),n||PFe,r||i)}function MFe(e,t,n,r){let i={},s=new Ufe,a,l,c=function(u){let d=u.v!==a?u.v:u.w,f=i[d],h=n(u),m=l.distance+h;if(h<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+h);m0&&(a=s.removeMin(),l=i[a],l.distance!==Number.POSITIVE_INFINITY);)r(a).forEach(c);return i}function LFe(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=$C(e,i,t,n),r},{})}function Ffe(e){let t=0,n=[],r={},i=[];function s(a){let l=r[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(c){c in r?r[c].onStack&&(l.lowlink=Math.min(l.lowlink,r[c].index)):(s(c),l.lowlink=Math.min(l.lowlink,r[c].lowlink))}),l.lowlink===l.index){let c=[],u;do u=n.pop(),r[u].onStack=!1,c.push(u);while(a!==u);i.push(c)}}return e.nodes().forEach(function(a){a in r||s(a)}),i}function $Fe(e){return Ffe(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var BFe=()=>1;function QFe(e,t,n){return UFe(e,t||BFe,n||function(r){return e.outEdges(r)})}function UFe(e,t,n){let r={},i=e.nodes();return i.forEach(function(s){r[s]={},r[s][s]={distance:0,predecessor:""},i.forEach(function(a){s!==a&&(r[s][a]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(s).forEach(function(a){let l=a.v===s?a.w:a.v,c=t(a);r[s][l]={distance:c,predecessor:s}})}),i.forEach(function(s){let a=r[s];i.forEach(function(l){let c=r[l];i.forEach(function(u){let d=c[s],f=a[u],h=c[u],m=d.distance+f.distance;m{var c;return(c=e.isDirected()?e.successors(l):e.neighbors(l))!=null?c:[]},a={};return t.forEach(function(l){if(!e.hasNode(l))throw new Error("Graph does not have node: "+l);i=Vfe(e,l,n==="post",a,s,r,i)}),i}function Vfe(e,t,n,r,i,s,a){return t in r||(r[t]=!0,n||(a=s(a,t)),i(t).forEach(function(l){a=Vfe(e,l,n,r,i,s,a)}),n&&(a=s(a,t))),a}function Hfe(e,t,n){return zFe(e,t,n,function(r,i){return r.push(i),r},[])}function VFe(e,t){return Hfe(e,t,"post")}function HFe(e,t){return Hfe(e,t,"pre")}function qFe(e,t){let n=new Qc,r={},i=new Ufe,s;function a(c){let u=c.v===s?c.w:c.v,d=i.priority(u);if(d!==void 0){let f=t(c);f0;){if(s=i.removeMin(),s in r)n.setEdge(s,r[s]);else{if(l)throw new Error("Input graph is not connected: "+e);l=!0}e.nodeEdges(s).forEach(a)}return n}function XFe(e,t,n,r){return GFe(e,t,n,r??(i=>{let s=e.outEdges(i);return s??[]}))}function GFe(e,t,n,r){if(n===void 0)return $C(e,t,n,r);let i=!1,s=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},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function qfe(e){let t=new Qc({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 yX(e,t){let n=e.x,r=e.y,i=t.x-n,s=t.y-r,a=e.width/2,l=e.height/2;if(!i&&!s)throw new Error("Not possible to find intersection inside of the rectangle");let c,u;return Math.abs(s)*a>Math.abs(i)*l?(s<0&&(l=-l),c=l*i/s,u=l):(i<0&&(a=-a),c=a,u=a*s/i),{x:n+c,y:r+u}}function lE(e){let t=Bw(Gfe(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i]||(t[i]=[]),t[i][r.order]=n)}),t}function YFe(e){let t=e.nodes().map(r=>{let i=e.node(r).rank;return i===void 0?Number.MAX_VALUE:i}),n=nd(Math.min,t);e.nodes().forEach(r=>{let i=e.node(r);Object.hasOwn(i,"rank")&&(i.rank-=n)})}function ZFe(e){let t=e.nodes().map(a=>e.node(a).rank).filter(a=>a!==void 0),n=nd(Math.min,t),r=[];e.nodes().forEach(a=>{let l=e.node(a).rank-n;r[l]||(r[l]=[]),r[l].push(a)});let i=0,s=e.graph().nodeRankFactor;Array.from(r).forEach((a,l)=>{a===void 0&&l%s!==0?--i:a!==void 0&&i&&a.forEach(c=>e.node(c).rank+=i)})}function OX(e,t,n,r){let i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),eO(e,"border",i,t)}function KFe(e,t=Xfe){let n=[];for(let r=0;rXfe){let n=KFe(t);return e(...n.map(r=>e(...r)))}else return e(...t)}function Gfe(e){let t=e.nodes().map(n=>{let r=e.node(n).rank;return r===void 0?Number.MIN_VALUE:r});return nd(Math.max,t)}function JFe(e,t){let n={lhs:[],rhs:[]};return e.forEach(r=>{t(r)?n.lhs.push(r):n.rhs.push(r)}),n}function Wfe(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function Yfe(e,t){return t()}var eze=0;function D7(e){let t=++eze;return e+(""+t)}function Bw(e,t,n=1){t==null&&(t=e,e=0);let r=s=>str[t]:n=t,Object.entries(e).reduce((r,[i,s])=>(r[i]=n(s,i),r),{})}function tze(e,t){return e.reduce((n,r,i)=>(n[r]=t[i],n),{})}var yj="\0",nze="3.0.0",rze=class{constructor(){EFe(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return xX(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&xX(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,ize)),n=n._prev;return"["+e.join(", ")+"]"}};function xX(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function ize(e,t){if(e!=="_next"&&e!=="_prev")return t}var sze=rze,aze=()=>1;function oze(e,t){if(e.nodeCount()<=1)return[];let n=cze(e,t||aze);return lze(n.graph,n.buckets,n.zeroIdx).flatMap(r=>e.outEdges(r.v,r.w)||[])}function lze(e,t,n){var r;let i=[],s=t[t.length-1],a=t[0],l;for(;e.nodeCount();){for(;l=a.dequeue();)Q5(e,t,n,l);for(;l=s.dequeue();)Q5(e,t,n,l);if(e.nodeCount()){for(let c=t.length-2;c>0;--c)if(l=(r=t[c])==null?void 0:r.dequeue(),l){i=i.concat(Q5(e,t,n,l,!0)||[]);break}}}return i}function Q5(e,t,n,r,i){let s=[],a=i?s:void 0;return(e.inEdges(r.v)||[]).forEach(l=>{let c=e.edge(l),u=e.node(l.v);i&&s.push({v:l.v,w:l.w}),u.out-=c,D4(t,n,u)}),(e.outEdges(r.v)||[]).forEach(l=>{let c=e.edge(l),u=l.w,d=e.node(u);d.in-=c,D4(t,n,d)}),e.removeNode(r.v),a}function cze(e,t){let n=new Qc,r=0,i=0;e.nodes().forEach(l=>{n.setNode(l,{v:l,in:0,out:0})}),e.edges().forEach(l=>{let c=n.edge(l.v,l.w)||0,u=t(l),d=c+u;n.setEdge(l.v,l.w,d);let f=n.node(l.v),h=n.node(l.w);i=Math.max(i,f.out+=u),r=Math.max(r,h.in+=u)});let s=uze(i+r+3).map(()=>new sze),a=r+1;return n.nodes().forEach(l=>{D4(s,a,n.node(l))}),{graph:n,buckets:s,zeroIdx:a}}function D4(e,t,n){var r,i,s;n.out?n.in?(s=e[n.out-n.in+t])==null||s.enqueue(n):(i=e[e.length-1])==null||i.enqueue(n):(r=e[0])==null||r.enqueue(n)}function uze(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,D7("rev"))});function t(n){return r=>n.edge(r).weight}}function fze(e){let t=[],n={},r={};function i(s){Object.hasOwn(r,s)||(r[s]=!0,n[s]=!0,e.outEdges(s).forEach(a=>{Object.hasOwn(n,a.w)?t.push(a):i(a.w)}),delete n[s])}return e.nodes().forEach(i),t}function hze(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 pze(e){e.graph().dummyChains=[],e.edges().forEach(t=>mze(e,t))}function mze(e,t){let n=t.v,r=e.node(n).rank,i=t.w,s=e.node(i).rank,a=t.name,l=e.edge(t),c=l.labelRank;if(s===r+1)return;e.removeEdge(t);let u,d,f;for(f=0,++r;r{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=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=i,n=e.node(t)})}function P7(e){let t={};function n(r){let i=e.node(r);if(Object.hasOwn(t,r))return i.rank;t[r]=!0;let s=e.outEdges(r),a=s?s.map(c=>c==null?Number.POSITIVE_INFINITY:n(c.w)-e.edge(c).minlen):[],l=nd(Math.min,a);return l===Number.POSITIVE_INFINITY&&(l=0),i.rank=l}e.sources().forEach(n)}function u1(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var Zfe=bze;function bze(e){let t=new Qc({directed:!1}),n=e.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let r=n[0],i=e.nodeCount();t.setNode(r,{});let s,a;for(;yze(t,e){let a=s.v,l=r===a?s.w:a;!e.hasNode(l)&&!u1(t,s)&&(e.setNode(l,{}),e.setEdge(r,l,{}),n(l))})}return e.nodes().forEach(n),e.nodeCount()}function Oze(e,t){return t.edges().reduce((n,r)=>{let i=Number.POSITIVE_INFINITY;return e.hasNode(r.v)!==e.hasNode(r.w)&&(i=u1(t,r)),it.node(r).rank+=n)}var{preorder:vze,postorder:wze}=I7,Sze=p0;p0.initLowLimValues=L7;p0.initCutValues=M7;p0.calcCutValue=Kfe;p0.leaveEdge=ehe;p0.enterEdge=the;p0.exchangeEdges=nhe;function p0(e){e=WFe(e),P7(e);let t=Zfe(e);L7(t),M7(t,e);let n,r;for(;n=ehe(t);)r=the(t,e,n),nhe(t,e,n,r)}function M7(e,t){let n=wze(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(r=>Eze(e,t,r))}function Eze(e,t,n){let r=e.node(n).parent,i=e.edge(n,r);i.cutvalue=Kfe(e,t,n)}function Kfe(e,t,n){let r=e.node(n).parent,i=!0,s=t.edge(n,r),a=0;s||(i=!1,s=t.edge(r,n)),a=s.weight;let l=t.nodeEdges(n);return l&&l.forEach(c=>{let u=c.v===n,d=u?c.w:c.v;if(d!==r){let f=u===i,h=t.edge(c).weight;if(a+=f?h:-h,_ze(e,n,d)){let m=e.edge(n,d).cutvalue;a+=f?-m:m}}}),a}function L7(e,t){arguments.length<2&&(t=e.nodes()[0]),Jfe(e,{},1,t)}function Jfe(e,t,n,r,i){let s=n,a=e.node(r);t[r]=!0;let l=e.neighbors(r);return l&&l.forEach(c=>{Object.hasOwn(t,c)||(n=Jfe(e,t,n,c,r))}),a.low=s,a.lim=n++,i?a.parent=i:delete a.parent,n}function ehe(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function the(e,t,n){let r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);let s=e.node(r),a=e.node(i),l=s,c=!1;return s.lim>a.lim&&(l=a,c=!0),t.edges().filter(u=>c===vX(e,e.node(u.v),l)&&c!==vX(e,e.node(u.w),l)).reduce((u,d)=>u1(t,d)!e.node(i).parent);if(!n)return;let r=vze(e,[n]);r=r.slice(1),r.forEach(i=>{let s=e.node(i).parent,a=t.edge(i,s),l=!1;a||(a=t.edge(s,i),l=!0),t.node(i).rank=t.node(s).rank+(l?a.minlen:-a.minlen)})}function _ze(e,t,n){return e.hasEdge(t,n)}function vX(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var Tze=Cze;function Cze(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":wX(e);break;case"tight-tree":Nze(e);break;case"longest-path":Aze(e);break;case"none":break;default:wX(e)}}var Aze=P7;function Nze(e){P7(e),Zfe(e)}function wX(e){Sze(e)}var jze=Rze;function Rze(e){let t=Dze(e);e.graph().dummyChains.forEach(n=>{let r=e.node(n),i=r.edgeObj,s=Ize(e,t,i.v,i.w),a=s.path,l=s.lca,c=0,u=a[c],d=!0;for(;n!==i.w;){if(r=e.node(n),d){for(;(u=a[c])!==l&&e.node(u).maxRanka||l>t[c].lim));let u=c,d=r;for(;(d=e.parent(d))!==u;)s.push(d);return{path:i.concat(s.reverse()),lca:u}}function Dze(e){let t={},n=0;function r(i){let s=n;e.children(i).forEach(r),t[i]={low:s,lim:n++}}return e.children(yj).forEach(r),t}function Pze(e){let t=eO(e,"root",{},"_root"),n=Mze(e),r=Object.values(n),i=nd(Math.max,r)-1,s=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(l=>e.edge(l).minlen*=s);let a=Lze(e)+1;e.children(yj).forEach(l=>rhe(e,t,s,a,i,n,l)),e.graph().nodeRankFactor=s}function rhe(e,t,n,r,i,s,a){var l;let c=e.children(a);if(!c.length){a!==t&&e.setEdge(t,a,{weight:0,minlen:n});return}let u=OX(e,"_bt"),d=OX(e,"_bb"),f=e.node(a);e.setParent(u,a),f.borderTop=u,e.setParent(d,a),f.borderBottom=d,c.forEach(h=>{var m;rhe(e,t,n,r,i,s,h);let g=e.node(h),b=g.borderTop?g.borderTop:h,y=g.borderBottom?g.borderBottom:h,O=g.borderTop?r:2*r,v=b!==y?1:i-((m=s[a])!=null?m:0)+1;e.setEdge(u,b,{weight:O,minlen:v,nestingEdge:!0}),e.setEdge(y,d,{weight:O,minlen:v,nestingEdge:!0})}),e.parent(a)||e.setEdge(t,u,{weight:0,minlen:i+((l=s[a])!=null?l:0)})}function Mze(e){let t={};function n(r,i){let s=e.children(r);s&&s.length&&s.forEach(a=>n(a,i+1)),t[r]=i}return e.children(yj).forEach(r=>n(r,1)),t}function Lze(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function $ze(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var Bze=Qze;function Qze(e){function t(n){let r=e.children(n),i=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(let s=i.minRank,a=i.maxRank+1;sEX(e.node(t))),e.edges().forEach(t=>EX(e.edge(t)))}function EX(e){let t=e.width;e.width=e.height,e.height=t}function zze(e){e.nodes().forEach(t=>U5(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(U5),Object.hasOwn(r,"y")&&U5(r)})}function U5(e){e.y=-e.y}function Vze(e){e.nodes().forEach(t=>F5(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(F5),Object.hasOwn(r,"x")&&F5(r)})}function F5(e){let t=e.x;e.x=e.y,e.y=t}function Hze(e){let t={},n=e.nodes().filter(l=>!e.children(l).length),r=n.map(l=>e.node(l).rank),i=nd(Math.max,r),s=Bw(i+1).map(()=>[]);function a(l){if(t[l])return;t[l]=!0;let c=e.node(l);s[c.rank].push(l);let u=e.successors(l);u&&u.forEach(a)}return n.sort((l,c)=>e.node(l).rank-e.node(c).rank).forEach(a),s}function qze(e,t){let n=0;for(let r=1;rd)),i=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):[]}),s=1;for(;s{let d=u.pos+s;l[d]+=u.weight;let f=0;for(;d>0;)d%2&&(f+=l[d+1]),d=d-1>>1,l[d]+=u.weight;c+=u.weight*f}),c}function Gze(e,t=[]){return t.map(n=>{let r=e.inEdges(n);if(!r||!r.length)return{v:n};{let i=r.reduce((s,a)=>{let l=e.edge(a),c=e.node(a.v);return{sum:s.sum+l.weight*c.order,weight:s.weight+l.weight}},{sum:0,weight:0});return{v:n,barycenter:i.sum/i.weight,weight:i.weight}}})}function Wze(e,t){let n={};e.forEach((i,s)=>{let a={indegree:0,in:[],out:[],vs:[i.v],i:s};i.barycenter!==void 0&&(a.barycenter=i.barycenter,a.weight=i.weight),n[i.v]=a}),t.edges().forEach(i=>{let s=n[i.v],a=n[i.w];s!==void 0&&a!==void 0&&(a.indegree++,s.out.push(a))});let r=Object.values(n).filter(i=>!i.indegree);return Yze(r)}function Yze(e){let t=[];function n(i){return s=>{s.merged||(s.barycenter===void 0||i.barycenter===void 0||s.barycenter>=i.barycenter)&&Zze(i,s)}}function r(i){return s=>{s.in.push(i),--s.indegree===0&&e.push(s)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(n(i)),i.out.forEach(r(i))}return t.filter(i=>!i.merged).map(i=>QC(i,["vs","i","barycenter","weight"]))}function Zze(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 Kze(e,t){let n=JFe(e,d=>Object.hasOwn(d,"barycenter")),r=n.lhs,i=n.rhs.sort((d,f)=>f.i-d.i),s=[],a=0,l=0,c=0;r.sort(Jze(!!t)),c=kX(s,i,c),r.forEach(d=>{c+=d.vs.length,s.push(d.vs),a+=d.barycenter*d.weight,l+=d.weight,c=kX(s,i,c)});let u={vs:s.flat(1)};return l&&(u.barycenter=a/l,u.weight=l),u}function kX(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 Jze(e){return(t,n)=>t.barycentern.barycenter?1:e?n.i-t.i:t.i-n.i}function she(e,t,n,r){let i=e.children(t),s=e.node(t),a=s?s.borderLeft:void 0,l=s?s.borderRight:void 0,c={};a&&(i=i.filter(h=>h!==a&&h!==l));let u=Gze(e,i);u.forEach(h=>{if(e.children(h.v).length){let m=she(e,h.v,n,r);c[h.v]=m,Object.hasOwn(m,"barycenter")&&tVe(h,m)}});let d=Wze(u,n);eVe(d,c);let f=Kze(d,r);if(a&&l){f.vs=[a,f.vs,l].flat(1);let h=e.predecessors(a);if(h&&h.length){let m=e.node(h[0]),g=e.predecessors(l),b=e.node(g[0]);Object.hasOwn(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+m.order+b.order)/(f.weight+2),f.weight+=2}}return f}function eVe(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(r=>t[r]?t[r].vs:r)})}function tVe(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 nVe(e,t,n,r){r||(r=e.nodes());let i=rVe(e),s=new Qc({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(a=>e.node(a));return r.forEach(a=>{let l=e.node(a),c=e.parent(a);if(l.rank===t||l.minRank<=t&&t<=l.maxRank){s.setNode(a),s.setParent(a,c||i);let u=e[n](a);u&&u.forEach(d=>{let f=d.v===a?d.w:d.v,h=s.edge(f,a),m=h!==void 0?h.weight:0;s.setEdge(f,a,{weight:e.edge(d).weight+m})}),Object.hasOwn(l,"minRank")&&s.setNode(a,{borderLeft:l.borderLeft[t],borderRight:l.borderRight[t]})}}),s}function rVe(e){let t;for(;e.hasNode(t=D7("_root")););return t}function iVe(e,t,n){let r={},i;n.forEach(s=>{let a=e.parent(s),l,c;for(;a;){if(l=e.parent(a),l?(c=r[l],r[l]=a):(c=i,i=a),c&&c!==a){t.setEdge(c,a);return}a=l}})}function ahe(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,ahe);return}let n=Gfe(e),r=_X(e,Bw(1,n+1),"inEdges"),i=_X(e,Bw(n-1,-1,-1),"outEdges"),s=Hze(e);if(TX(e,s),t.disableOptimalOrderHeuristic)return;let a=Number.POSITIVE_INFINITY,l,c=t.constraints||[];for(let u=0,d=0;d<4;++u,++d){sVe(u%2?r:i,u%4>=2,c),s=lE(e);let f=qze(e,s);f{r.has(s)||r.set(s,[]),r.get(s).push(a)};for(let s of e.nodes()){let a=e.node(s);if(typeof a.rank=="number"&&i(a.rank,s),typeof a.minRank=="number"&&typeof a.maxRank=="number")for(let l=a.minRank;l<=a.maxRank;l++)l!==a.rank&&i(l,s)}return t.map(function(s){return nVe(e,s,n,r.get(s)||[])})}function sVe(e,t,n){let r=new Qc;e.forEach(function(i){n.forEach(l=>r.setEdge(l.left,l.right));let s=i.graph().root,a=she(i,s,r,t);a.vs.forEach((l,c)=>i.node(l).order=c),iVe(i,r,a.vs)})}function TX(e,t){Object.values(t).forEach(n=>n.forEach((r,i)=>e.node(r).order=i))}function aVe(e,t){let n={};function r(i,s){let a=0,l=0,c=i.length,u=s[s.length-1];return s.forEach((d,f)=>{let h=lVe(e,d),m=h?e.node(h).order:c;(h||d===u)&&(s.slice(l,f+1).forEach(g=>{let b=e.predecessors(g);b&&b.forEach(y=>{let O=e.node(y),v=O.order;(v{let f=s[d];if(f!==void 0&&e.node(f).dummy){let h=e.predecessors(f);h&&h.forEach(m=>{if(m===void 0)return;let g=e.node(m);g.dummy&&(g.orderu)&&ohe(n,m,f)})}})}function i(s,a){let l=-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 m=h[0];if(m===void 0)return;c=e.node(m).order,r(a,u,f,l,c),u=f,l=c}}r(a,u,a.length,c,s.length)}),a}return t.length&&t.reduce(i),n}function lVe(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(r=>e.node(r).dummy)}}function ohe(e,t,n){if(t>n){let i=t;t=n,n=i}let r=e[t];r||(e[t]=r={}),r[n]=!0}function cVe(e,t,n){if(t>n){let i=t;t=n,n=i}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function uVe(e,t,n,r){let i={},s={},a={};return t.forEach(l=>{l.forEach((c,u)=>{i[c]=c,s[c]=c,a[c]=u})}),t.forEach(l=>{let c=-1;l.forEach(u=>{let d=r(u);if(d&&d.length){let f=d.sort((m,g)=>{let b=a[m],y=a[g];return(b!==void 0?b:0)-(y!==void 0?y:0)}),h=(f.length-1)/2;for(let m=Math.floor(h),g=Math.ceil(h);m<=g;++m){let b=f[m];if(b===void 0)continue;let y=a[b];if(y!==void 0&&s[u]===u&&c{var O;let v=(O=s[y.v])!=null?O:0,x=a.edge(y);return Math.max(b,v+(x!==void 0?x:0))},0):s[m]=0}function d(m){let g=a.outEdges(m),b=Number.POSITIVE_INFINITY;g&&(b=g.reduce((O,v)=>{let x=s[v.w],w=a.edge(v);return Math.min(O,(x!==void 0?x:0)-(w!==void 0?w:0))},Number.POSITIVE_INFINITY));let y=e.node(m);b!==Number.POSITIVE_INFINITY&&y.borderType!==l&&(s[m]=Math.max(s[m]!==void 0?s[m]:0,b))}function f(m){return a.predecessors(m)||[]}function h(m){return a.successors(m)||[]}return c(u,f),c(d,h),Object.keys(r).forEach(m=>{var g;let b=n[m];b!==void 0&&(s[m]=(g=s[b])!=null?g:0)}),s}function fVe(e,t,n,r){let i=new Qc,s=e.graph(),a=bVe(s.nodesep,s.edgesep,r);return t.forEach(l=>{let c;l.forEach(u=>{let d=n[u];if(d!==void 0){if(i.setNode(d),c!==void 0){let f=n[c];if(f!==void 0){let h=i.edge(f,d);i.setEdge(f,d,Math.max(a(e,u,c),h||0))}}c=u}})}),i}function hVe(e,t){return Object.values(t).reduce((n,r)=>{let i=Number.NEGATIVE_INFINITY,s=Number.POSITIVE_INFINITY;Object.entries(r).forEach(([l,c])=>{let u=yVe(e,l)/2;i=Math.max(c+u,i),s=Math.min(c-u,s)});let a=i-s;return a{["l","r"].forEach(a=>{let l=s+a,c=e[l];if(!c||c===t)return;let u=Object.values(c),d=r-nd(Math.min,u);a!=="l"&&(d=i-nd(Math.max,u)),d&&(e[l]=bj(c,f=>f+d))})})}function mVe(e,t=void 0){let n=e.ul;return n?bj(n,(r,i)=>{var s,a;if(t){let c=t.toLowerCase(),u=e[c];if(u&&u[i]!==void 0)return u[i]}let l=Object.values(e).map(c=>{let u=c[i];return u!==void 0?u:0}).sort((c,u)=>c-u);return(((s=l[1])!=null?s:0)+((a=l[2])!=null?a:0))/2}):{}}function gVe(e){let t=lE(e),n=Object.assign(aVe(e,t),oVe(e,t)),r={},i;["u","d"].forEach(a=>{i=a==="u"?t:Object.values(t).reverse(),["l","r"].forEach(l=>{l==="r"&&(i=i.map(d=>Object.values(d).reverse()));let c=uVe(e,i,n,d=>(a==="u"?e.predecessors(d):e.successors(d))||[]),u=dVe(e,i,c.root,c.align,l==="r");l==="r"&&(u=bj(u,d=>-d)),r[a+l]=u})});let s=hVe(e,r);return pVe(r,s),mVe(r,e.graph().align)}function bVe(e,t,n){return(r,i,s)=>{let a=r.node(i),l=r.node(s),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+=(l.dummy?t:e)/2,c+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":u=l.width/2;break;case"r":u=-l.width/2;break}return u&&(c+=n?u:-u),c}}function yVe(e,t){return e.node(t).width}function OVe(e){e=qfe(e),xVe(e),Object.entries(gVe(e)).forEach(([t,n])=>e.node(t).x=n)}function xVe(e){let t=lE(e),n=e.graph(),r=n.ranksep,i=n.rankalign,s=0;t.forEach(a=>{let l=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);i==="top"?u.y=s+u.height/2:i==="bottom"?u.y=s+l-u.height/2:u.y=s+l/2}),s+=l+r})}function vVe(e,t={}){let n=t.debugTiming?Wfe:Yfe;return n("layout",()=>{let r=n(" buildLayoutGraph",()=>jVe(e));return n(" runLayout",()=>wVe(r,n,t)),n(" updateInputGraph",()=>SVe(e,r)),r})}function wVe(e,t,n){t(" makeSpaceForEdgeLabels",()=>RVe(e)),t(" removeSelfEdges",()=>UVe(e)),t(" acyclic",()=>dze(e)),t(" nestingGraph.run",()=>Pze(e)),t(" rank",()=>Tze(qfe(e))),t(" injectEdgeLabelProxies",()=>IVe(e)),t(" removeEmptyRanks",()=>ZFe(e)),t(" nestingGraph.cleanup",()=>$ze(e)),t(" normalizeRanks",()=>YFe(e)),t(" assignRankMinMax",()=>DVe(e)),t(" removeEdgeLabelProxies",()=>PVe(e)),t(" normalize.run",()=>pze(e)),t(" parentDummyChains",()=>jze(e)),t(" addBorderSegments",()=>Bze(e)),t(" order",()=>ahe(e,n)),t(" insertSelfEdges",()=>FVe(e)),t(" adjustCoordinateSystem",()=>Uze(e)),t(" position",()=>OVe(e)),t(" positionSelfEdges",()=>zVe(e)),t(" removeBorderNodes",()=>QVe(e)),t(" normalize.undo",()=>gze(e)),t(" fixupEdgeLabelCoords",()=>$Ve(e)),t(" undoCoordinateSystem",()=>Fze(e)),t(" translateGraph",()=>MVe(e)),t(" assignNodeIntersects",()=>LVe(e)),t(" reversePoints",()=>BVe(e)),t(" acyclic.undo",()=>hze(e))}function SVe(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.order=i.order,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,"x")&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var EVe=["nodesep","edgesep","ranksep","marginx","marginy"],kVe={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},_Ve=["acyclicer","ranker","rankdir","align","rankalign"],TVe=["width","height","rank"],CX={width:0,height:0},CVe=["minlen","weight","width","height","labeloffset"],AVe={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},NVe=["labelpos"];function jVe(e){let t=new Qc({multigraph:!0,compound:!0}),n=V5(e.graph());return t.setGraph(Object.assign({},kVe,z5(n,EVe),QC(n,_Ve))),e.nodes().forEach(r=>{let i=V5(e.node(r)),s=z5(i,TVe);Object.keys(CX).forEach(l=>{s[l]===void 0&&(s[l]=CX[l])}),t.setNode(r,s);let a=e.parent(r);a!==void 0&&t.setParent(r,a)}),e.edges().forEach(r=>{let i=V5(e.edge(r));t.setEdge(r,Object.assign({},AVe,z5(i,CVe),QC(i,NVe)))}),t}function RVe(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 IVe(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let r=e.node(t.v),i={rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t};eO(e,"edge-proxy",i,"_ep")}})}function DVe(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 PVe(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 MVe(e){let t=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,i=0,s=e.graph(),a=s.marginx||0,l=s.marginy||0;function c(u){let d=u.x,f=u.y,h=u.width,m=u.height;t=Math.min(t,d-h/2),n=Math.max(n,d+h/2),r=Math.min(r,f-m/2),i=Math.max(i,f+m/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-=l,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)}),s.width=n-t+a,s.height=i-r+l}function LVe(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),s,a;n.points?(s=n.points[0],a=n.points[n.points.length-1]):(n.points=[],s=i,a=r),n.points.unshift(yX(r,s)),n.points.push(yX(i,a))})}function $Ve(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 BVe(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function QVe(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),s=e.node(n.borderLeft[n.borderLeft.length-1]),a=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(a.x-s.x),n.height=Math.abs(i.y-r.y),n.x=s.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function UVe(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 FVe(e){lE(e).forEach(t=>{let n=0;t.forEach((r,i)=>{let s=e.node(r);s.order=i+n,(s.selfEdges||[]).forEach(a=>{eO(e,"selfedge",{width:a.label.width,height:a.label.height,rank:s.rank,order:i+ ++n,e:a.e,label:a.label},"_se")}),delete s.selfEdges})})}function zVe(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="selfedge"){let r=n,i=e.node(r.e.v),s=i.x+i.width/2,a=i.y,l=n.x-s,c=i.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:s+2*l/3,y:a-c},{x:s+5*l/6,y:a-c},{x:s+l,y:a},{x:s+5*l/6,y:a+c},{x:s+2*l/3,y:a+c}],r.label.x=n.x,r.label.y=n.y}})}function z5(e,t){return bj(QC(e,t),Number)}function V5(e){let t={};return e&&Object.entries(e).forEach(([n,r])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=r}),t}function VVe(e){let t=lE(e),n=new Qc({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,i)=>{let s="layer"+i;n.setNode(s,{rank:"same"}),r.reduce((a,l)=>(n.setEdge(a,l,{style:"invis"}),l))}),n}var HVe={graphlib:Lfe,version:nze,layout:vVe,debug:VVe,util:{time:Wfe,notime:Yfe}},AX=HVe;/*! For license information please see dagre.esm.js.LEGAL.txt */const Hx={llm:{label:"智能体",description:"理解任务并直接完成一个具体工作",icon:Iae},sequential:{label:"分步协作",description:"内部步骤按照顺序依次执行",icon:ZRe},parallel:{label:"同时处理",description:"内部步骤同时工作,完成后统一汇总",icon:jRe},loop:{label:"循环执行",description:"重复执行内部步骤,直到满足停止条件",icon:Bae},a2a:{label:"远程智能体",description:"调用已经存在的远程 Agent",icon:jN}},P4=220,M4=88,NX=96,jX=34,Cv=64,H5=310,qb=24,lhe=56,L4=40,RX=40,qVe=18,XVe=58,GVe=!1,WVe=e=>e==="sequential"||e==="parallel"||e==="loop";function $4(e,t){const n=e.agentType??"llm";return WVe(n)||n==="llm"&&(t.length===0||e.subAgents.length>0)}function B4(e,t=[],n="horizontal",r=!1){const i=e.agentType??"llm";if(!$4(e,t))return{width:P4,height:M4};if(r&&e.subAgents.length===0)return{width:H5,height:Cv};const s=e.subAgents.map((f,h)=>B4(f,[...t,h],n,r)),a=s.length?Math.max(...s.map(f=>f.width)):0,l=s.length?Math.max(...s.map(f=>f.height)):0,c=s.length&&i!=="parallel"?lhe:qb,u=n==="horizontal"?i!=="parallel":i==="parallel",d=s.length?i==="parallel"?qVe+RX:i==="loop"?XVe:0:RX;return u?{width:Math.max(H5,s.reduce((f,h)=>f+h.width,0)+L4*Math.max(0,s.length-1)+c*2),height:Cv+qb+l+d+qb}:{width:Math.max(H5,a+qb*2),height:Cv+c+s.reduce((f,h)=>f+h.height,0)+L4*Math.max(0,s.length-1)+d+c}}function rx(e){return e.length===0?"agent-root":`agent-${e.join("-")}`}function YVe(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function IX(e){const t=n=>[n.agentType??"llm",n.subAgents.map(t)];return JSON.stringify(t(e))}function ix(e,t,n,r){const i=(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:Pw.ArrowClosed,width:16,height:16,color:i},style:{stroke:i,strokeWidth:1.5},labelStyle:{fill:"hsl(215 14% 42%)",fontSize:10,fontWeight:600},labelBgStyle:{fill:"hsl(var(--background))",fillOpacity:.92}}}function DX(e,t,n=!1){const r=[{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}],i=[];function s(d,f,h,m,g){const b=d.agentType??"llm",y=rx(f);return $4(d,f)?(a(d,f,h,m,g),y):(r.push({id:y,type:"agent",parentId:h,extent:"parent",position:m,data:{kind:"agent",path:f,agent:d,title:b==="a2a"?"远程智能体":d.name.trim()||(f.length===0?"主 Agent":"未命名步骤"),pattern:b,description:d.description.trim()||Hx[b].description,childCount:d.subAgents.length,containedIn:g}}),y)}function a(d,f,h,m={x:0,y:0},g){const b=d.agentType??"sequential",y=rx(f),O=B4(d,f,t,n);r.push({id:y,type:"group",parentId:h,extent:h?"parent":void 0,position:m,style:{width:O.width,height:O.height},data:{kind:"agent",path:f,agent:d,title:d.name.trim()||(f.length===0?"主 Agent":Hx[b].label),pattern:b,description:d.description.trim()||Hx[b].description,childCount:d.subAgents.length,containedIn:g,layoutWidth:O.width,layoutHeight:O.height,compactEmptyGroup:n&&d.subAgents.length===0}});const v=d.subAgents.map((k,_)=>B4(k,[...f,_],t,n)),x=v.length&&b!=="parallel"?lhe:qb,w=t==="horizontal"?b!=="parallel":b==="parallel";let S=x;const E=d.subAgents.map((k,_)=>{const C=v[_],T=w?{x:S,y:Cv+qb}:{x:(O.width-C.width)/2,y:Cv+S};return S+=(w?C.width:C.height)+L4,s(k,[...f,_],y,T,b)});if(b==="sequential"||b==="loop"){for(let k=0;k1&&i.push(ix(E[E.length-1],E[0],"继续循环",{loop:!0,tone:"loop"}))}return y}const l=(d,f)=>{const h=d.agentType??"llm",m=rx(f);if($4(d,f))return a(d,f),[m];if(r.push({id:m,type:"agent",position:{x:0,y:0},data:{kind:"agent",path:f,agent:d,title:h==="a2a"?"远程智能体":d.name.trim()||(f.length===0?"主 Agent":"未命名步骤"),pattern:h,description:d.description.trim()||Hx[h].description,childCount:d.subAgents.length}}),d.subAgents.length===0)return[m];const g=[];return d.subAgents.forEach((b,y)=>{const O=[...f,y],v=rx(O);i.push(ix(m,v,"调用",{insert:{parentPath:f,index:y}})),g.push(...l(b,O))}),g},c=rx([]),u=l(e,[]);return i.push(ix("terminal-input",c)),u.forEach(d=>i.push(ix(d,"terminal-output"))),ZVe(r,i,t)}function ZVe(e,t,n){const r=new AX.graphlib.Graph().setDefaultEdgeLabel(()=>({}));r.setGraph({rankdir:n==="vertical"?"TB":"LR",ranksep:50,nodesep:34,edgesep:14,marginx:24,marginy:24});const i=new Set(e.filter(s=>!s.parentId).map(s=>s.id));return e.filter(s=>!s.parentId).forEach(s=>{const a=s.data.kind==="terminal";r.setNode(s.id,{width:a?NX:s.data.layoutWidth??P4,height:a?jX:s.data.layoutHeight??M4})}),t.filter(s=>i.has(s.source)&&i.has(s.target)).forEach(s=>r.setEdge(s.source,s.target)),AX.layout(r),{nodes:e.map(s=>{if(s.parentId)return s;const a=r.node(s.id),l=s.data.kind==="terminal",c=l?NX:s.data.layoutWidth??P4,u=l?jX:s.data.layoutHeight??M4;return{...s,position:{x:a.x-c/2,y:a.y-u/2}}}),edges:t}}const Oj=p.createContext(null),xj=p.createContext("horizontal");function KVe({id:e,sourceX:t,sourceY:n,targetX:r,targetY:i,sourcePosition:s,targetPosition:a,markerEnd:l,style:c,label:u,data:d}){const f=p.useContext(Oj),[h,m]=p.useState(!1),[g,b,y]=MC({sourceX:t,sourceY:n,targetX:r,targetY:i,sourcePosition:s,targetPosition:a,offset:d!=null&&d.loop?28:20});return o.jsxs(o.Fragment,{children:[o.jsx(oE,{id:e,path:g,markerEnd:l,style:c}),f&&(d==null?void 0:d.insert)&&o.jsx("path",{d:g,className:"abc-edge-hover-path",onPointerEnter:()=>m(!0),onPointerLeave:()=>m(!1)}),(u||f&&(d==null?void 0:d.insert))&&o.jsx(VUe,{children:o.jsxs("div",{className:`abc-edge-tools${f&&(d!=null&&d.insert)?" can-insert":""}${h?" is-visible":""}`,style:{transform:`translate(-50%, -50%) translate(${b}px, ${y}px)`},onPointerEnter:()=>m(!0),onPointerLeave:()=>m(!1),children:[u&&o.jsx("span",{className:"abc-edge-label",children:u}),f&&(d==null?void 0:d.insert)&&o.jsx("button",{type:"button",className:"abc-edge-add nodrag nopan","aria-label":"在这里插入步骤",title:"在这里插入步骤",onClick:O=>{O.stopPropagation(),f==null||f.onInsert(d.insert.parentPath,d.insert.index)},children:o.jsx(yo,{})})]})})]})}function JVe({data:e,selected:t}){const n=p.useContext(Oj),r=p.useContext(xj),i=r==="vertical"?zt.Top:zt.Left,s=r==="vertical"?zt.Bottom:zt.Right,a=r==="vertical"?zt.Right:zt.Bottom,l=e.pattern??"llm",c=Hx[l],u=c.icon;return o.jsxs("div",{className:`abc-node is-${l}${e.containedIn?` is-contained-in-${e.containedIn}`:""}${t?" is-selected":""}`,children:[o.jsx(qo,{type:"target",position:i,className:"abc-handle"}),l!=="llm"&&o.jsx("span",{className:"abc-node-icon",children:o.jsx(u,{})}),o.jsxs("span",{className:"abc-node-copy",children:[o.jsx("span",{className:"abc-node-meta",children:o.jsx("span",{children:c.label})}),o.jsx("strong",{children:e.title}),o.jsx("small",{children:e.description})]}),n&&e.path!==void 0&&e.path.length>0&&o.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:o.jsx(Up,{})}),o.jsx(qo,{type:"source",position:s,className:"abc-handle"}),e.containedIn==="loop"&&o.jsxs(o.Fragment,{children:[o.jsx(qo,{id:"loop-target",type:"target",position:a,className:"abc-handle abc-loop-handle"}),o.jsx(qo,{id:"loop-source",type:"source",position:a,className:"abc-handle abc-loop-handle"})]})]})}function eHe({data:e,selected:t}){const n=p.useContext(Oj),r=p.useContext(xj),i=r==="vertical"?zt.Top:zt.Left,s=r==="vertical"?zt.Bottom:zt.Right,a=r==="vertical"?zt.Right:zt.Bottom,l=e.pattern??"sequential",c=e.childCount??0,u=l==="llm"?"添加子 Agent":l==="parallel"?"添加一个同时处理的步骤":l==="loop"?"添加循环步骤":"添加下一个步骤";return o.jsxs("div",{className:`abc-group is-${l}${e.compactEmptyGroup?" is-compact-empty":""}${t?" is-selected":""}`,children:[o.jsx(qo,{type:"target",position:i,className:"abc-handle"}),o.jsx("header",{className:"abc-group-head",children:o.jsxs("span",{children:[o.jsx("strong",{title:e.title,children:e.title}),o.jsx("small",{children:e.description})]})}),n&&e.path!==void 0&&c>0&&l!=="parallel"&&o.jsxs("div",{className:"abc-group-boundary-actions",children:[o.jsx("button",{type:"button",className:"abc-group-boundary-add is-start nodrag nopan","aria-label":"添加到最前",title:"添加到最前",onClick:d=>{d.stopPropagation(),n.onInsert(e.path,0)},children:o.jsx(yo,{})}),o.jsx("button",{type:"button",className:"abc-group-boundary-add is-end nodrag nopan","aria-label":"添加到最后",title:"添加到最后",onClick:d=>{d.stopPropagation(),n.onAdd(e.path)},children:o.jsx(yo,{})})]}),n&&e.path!==void 0&&c>0&&l==="parallel"&&o.jsxs("button",{type:"button",className:"abc-group-add abc-group-add-bottom nodrag nopan",onClick:d=>{d.stopPropagation(),n.onAdd(e.path)},children:[o.jsx(yo,{}),o.jsx("span",{children:u})]}),n&&e.path!==void 0&&c===0&&o.jsxs("button",{type:"button",className:"abc-group-add abc-group-add-empty nodrag nopan",onClick:d=>{d.stopPropagation(),n.onAdd(e.path)},children:[o.jsx(yo,{}),o.jsx("span",{children:u})]}),n&&e.path!==void 0&&e.path.length>0&&o.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:o.jsx(Up,{})}),o.jsx(qo,{type:"source",position:s,className:"abc-handle"}),e.containedIn==="loop"&&o.jsxs(o.Fragment,{children:[o.jsx(qo,{id:"loop-target",type:"target",position:a,className:"abc-handle abc-loop-handle"}),o.jsx(qo,{id:"loop-source",type:"source",position:a,className:"abc-handle abc-loop-handle"})]})]})}function tHe({data:e}){const t=p.useContext(xj);return o.jsxs("div",{className:"abc-terminal",children:[o.jsx(qo,{type:"target",position:t==="vertical"?zt.Top:zt.Left,className:"abc-handle"}),o.jsx("span",{children:e.title}),o.jsx(qo,{type:"source",position:t==="vertical"?zt.Bottom:zt.Right,className:"abc-handle"})]})}const nHe={agent:JVe,group:eHe,terminal:tHe},rHe={insertStep:KVe};function iHe({draft:e,selectedPath:t,onSelect:n,onAdd:r,onInsert:i,onDelete:s,readOnly:a=!1,interactivePreview:l=!1,direction:c="horizontal"}){const u=p.useMemo(()=>DX(e,c,a),[]),[d,f,h]=HUe(u.nodes),[m,g,b]=qUe(u.edges),y=GUe(),O=p.useRef(`${c}:${a?"readonly":"editable"}:${IX(e)}`),v=p.useRef(null),{fitView:x}=mj(),w=p.useMemo(()=>DX(e,c,a),[c,e,a]),[S,E]=p.useState(()=>window.matchMedia("(max-width: 860px)").matches),k=p.useMemo(()=>a?{padding:.16,minZoom:.05,maxZoom:.9}:S?{padding:.08,minZoom:.35,maxZoom:.9}:{padding:.14,minZoom:.42,maxZoom:1.1},[S,a]),_=p.useCallback((T=0)=>{window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{const A=v.current;if(A&&(A.clientWidth===0||A.clientHeight===0)&&T<8){_(T+1);return}x(k)})})},[k,x]);p.useEffect(()=>{const T=window.matchMedia("(max-width: 860px)"),A=j=>E(j.matches);return T.addEventListener("change",A),()=>T.removeEventListener("change",A)},[]),p.useEffect(()=>{const T=`${c}:${a?"readonly":"editable"}:${IX(e)}`,A=T!==O.current;O.current=T,g(w.edges),f(j=>{const L=new Map(j.map(I=>[I.id,I]));return w.nodes.map(I=>{const M=L.get(I.id);return{...I,measured:!A&&M&&M.type===I.type?M.measured:void 0,position:!A&&M?M.position:I.position,selected:I.data.kind==="agent"&&!!I.data.path&&YVe(I.data.path,t)}})}),A&&_()},[w,e,_,t,g,f]),p.useEffect(()=>{_()},[S,_]),p.useEffect(()=>{y&&_()},[w,_,y]),p.useEffect(()=>{if(!a||!v.current)return;const T=new ResizeObserver(()=>_());return T.observe(v.current),_(),()=>T.disconnect()},[_,a]);const C=p.useMemo(()=>a?null:{onAdd:r,onInsert:i,onDelete:s},[r,s,i,a]);return o.jsx(xj.Provider,{value:c,children:o.jsx(Oj.Provider,{value:C,children:o.jsx("section",{className:`abc-root is-${c}${a?" is-readonly":""}`,"aria-label":a?"只读 Agent 执行画布":"Agent 执行画布",children:o.jsx("div",{ref:v,className:"abc-canvas",children:o.jsxs(FUe,{nodes:d,edges:m,nodeTypes:nHe,edgeTypes:rHe,onNodesChange:h,onEdgesChange:b,onNodeClick:(T,A)=>{!a&&A.data.kind==="agent"&&A.data.path&&n(A.data.path)},nodesDraggable:!a,nodesConnectable:!1,nodesFocusable:!a,elementsSelectable:!a,edgesFocusable:!1,edgesReconnectable:!1,panOnDrag:!a||l,zoomOnDoubleClick:l,zoomOnPinch:!a||l,zoomOnScroll:!a||l,fitView:!0,fitViewOptions:k,onInit:()=>_(),minZoom:a?.05:.35,maxZoom:1.6,proOptions:{hideAttribution:!0},children:[o.jsx(JUe,{gap:20,size:1.2,color:"hsl(34 20% 82%)"}),(!a||l)&&o.jsx(aFe,{showInteractive:!1}),GVe]})})})})})}function Qw(e){return o.jsx(Rfe,{children:o.jsx(iHe,{...e})})}const sHe="https://ark.cn-beijing.volces.com/api/v3/",tT=[{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:sHe}],UC=[],FC={label:"控制台",url:"https://console.volcengine.com/vikingdb/openviking"},aHe={label:"文档",url:"https://github.com/volcengine/OpenViking/blob/main/docs/zh/api/05-sessions.md"},che="https://api.vikingdb.cn-beijing.volces.com/openviking",oHe=`{ +`)),d=u.reduce((f,h)=>f.concat(...h),[]);return[u,d]}return[[],[]]},[e]);return p.useEffect(()=>{const c=(t==null?void 0:t.target)??Kq,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=m=>{var y,O;if(i.current=m.ctrlKey||m.metaKey||m.shiftKey||m.altKey,(!i.current||i.current&&!u)&&Ide(m))return!1;const b=eX(m.code,l);if(s.current.add(m[b]),Jq(a,s.current,!1)){const v=((O=(y=m.composedPath)==null?void 0:y.call(m))==null?void 0:O[0])||m.target,x=(v==null?void 0:v.nodeName)==="BUTTON"||(v==null?void 0:v.nodeName)==="A";t.preventDefault!==!1&&(i.current||!x)&&m.preventDefault(),r(!0)}},f=m=>{const g=eX(m.code,l);Jq(a,s.current,!0)?(r(!1),s.current.clear()):s.current.delete(m[g]),m.key==="Meta"&&s.current.clear(),i.current=!1},h=()=>{s.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 Jq(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function eX(e,t){return t.includes(e)?"code":"key"}const bQe=()=>{const e=Ji();return p.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,i,s],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??s},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:i,minZoom:s,maxZoom:a,panZoom:l}=e.getState(),c=E7(t,r,i,s,a,(n==null?void 0:n.padding)??.1);return l?(await l.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:i,snapToGrid:s,domNode:a}=e.getState();if(!a)return t;const{x:l,y:c}=a.getBoundingClientRect(),u={x:t.x-l,y:t.y-c},d=n.snapGrid??i,f=n.snapToGrid??s;return J1(u,r,f,d)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:i,y:s}=r.getBoundingClientRect(),a=o1(t,n);return{x:a.x+i,y:a.y+s}}}),[])};function sfe(e,t){const n=[],r=new Map,i=[];for(const s of e)if(s.type==="add"){i.push(s);continue}else if(s.type==="remove"||s.type==="replace")r.set(s.id,[s]);else{const a=r.get(s.id);a?a.push(s):r.set(s.id,[s])}for(const s of t){const a=r.get(s.id);if(!a){n.push(s);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const l={...s};for(const c of a)yQe(c,l);n.push(l)}return i.length&&i.forEach(s=>{s.index!==void 0?n.splice(s.index,0,{...s.item}):n.push({...s.item})}),n}function yQe(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 afe(e,t){return sfe(e,t)}function ofe(e,t){return sfe(e,t)}function Vm(e,t){return{id:e,type:"select",selected:t}}function Hb(e,t=new Set,n=!1){const r=[];for(const[i,s]of e){const a=t.has(i);!(s.selected===void 0&&!a)&&s.selected!==a&&(n&&(s.selected=a),r.push(Vm(s.id,a)))}return r}function tX({items:e=[],lookup:t}){var i;const n=[],r=new Map(e.map(s=>[s.id,s]));for(const[s,a]of e.entries()){const l=t.get(a.id),c=((i=l==null?void 0:l.internals)==null?void 0:i.userNode)??l;c!==void 0&&c!==a&&n.push({id:a.id,item:a,type:"replace"}),c===void 0&&n.push({item:a,type:"add",index:s})}for(const[s]of t)r.get(s)===void 0&&n.push({id:s,type:"remove"});return n}function nX(e){return{id:e.id,type:"remove"}}const OQe=Nde();function xQe(e,t,n={}){return H7e(e,t,{...n,onError:n.onError??OQe})}const rX=e=>N7e(e),vQe=e=>_de(e);function lfe(e){return p.forwardRef(e)}const wQe=typeof window<"u"?p.useLayoutEffect:p.useEffect;function iX(e){const[t,n]=p.useState(BigInt(0)),[r]=p.useState(()=>SQe(()=>n(i=>i+BigInt(1))));return wQe(()=>{const i=r.get();i.length&&(e(i),r.reset())},[t]),r}function SQe(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const cfe=p.createContext(null);function EQe({children:e}){const t=Ji(),n=p.useCallback(l=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:h,fitViewQueued:m,onNodesChangeMiddlewareMap:g}=t.getState();let b=c;for(const O of l)b=typeof O=="function"?O(b):O;let y=tX({items:b,lookup:h});for(const O of g.values())y=O(y);d&&u(b),y.length>0?f==null||f(y):m&&window.requestAnimationFrame(()=>{const{fitViewQueued:O,nodes:v,setNodes:x}=t.getState();O&&x(v)})},[]),r=iX(n),i=p.useCallback(l=>{const{edges:c=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:h}=t.getState();let m=c;for(const g of l)m=typeof g=="function"?g(m):g;d?u(m):f&&f(tX({items:m,lookup:h}))},[]),s=iX(i),a=p.useMemo(()=>({nodeQueue:r,edgeQueue:s}),[]);return o.jsx(cfe.Provider,{value:a,children:e})}function kQe(){const e=p.useContext(cfe);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const _Qe=e=>!!e.panZoom;function mj(){const e=bQe(),t=Ji(),n=kQe(),r=wr(_Qe),i=p.useMemo(()=>{const s=f=>t.getState().nodeLookup.get(f),a=f=>{n.nodeQueue.push(f)},l=f=>{n.edgeQueue.push(f)},c=f=>{var O,v;const{nodeLookup:h,nodeOrigin:m}=t.getState(),g=rX(f)?f:h.get(f.id),b=g.parentId?jde(g.position,g.measured,g.parentId,h,m):g.position,y={...g,position:b,width:((O=g.measured)==null?void 0:O.width)??g.width,height:((v=g.measured)==null?void 0:v.height)??g.height};return a1(y)},u=(f,h,m={replace:!1})=>{a(g=>g.map(b=>{if(b.id===f){const y=typeof h=="function"?h(b):h;return m.replace&&rX(y)?y:{...b,...y}}return b}))},d=(f,h,m={replace:!1})=>{l(g=>g.map(b=>{if(b.id===f){const y=typeof h=="function"?h(b):h;return m.replace&&vQe(y)?y:{...b,...y}}return b}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var h;return(h=s(f))==null?void 0:h.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(h=>({...h}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:a,setEdges:l,addNodes:f=>{const h=Array.isArray(f)?f:[f];n.nodeQueue.push(m=>[...m,...h])},addEdges:f=>{const h=Array.isArray(f)?f:[f];n.edgeQueue.push(m=>[...m,...h])},toObject:()=>{const{nodes:f=[],edges:h=[],transform:m}=t.getState(),[g,b,y]=m;return{nodes:f.map(O=>({...O})),edges:h.map(O=>({...O})),viewport:{x:g,y:b,zoom:y}}},deleteElements:async({nodes:f=[],edges:h=[]})=>{const{nodes:m,edges:g,onNodesDelete:b,onEdgesDelete:y,triggerNodeChanges:O,triggerEdgeChanges:v,onDelete:x,onBeforeDelete:w}=t.getState(),{nodes:S,edges:E}=await P7e({nodesToRemove:f,edgesToRemove:h,nodes:m,edges:g,onBeforeDelete:w}),k=E.length>0,_=S.length>0;if(k){const T=E.map(nX);y==null||y(E),v(T)}if(_){const T=S.map(nX);b==null||b(S),O(T)}return(_||k)&&(x==null||x({nodes:S,edges:E})),{deletedNodes:S,deletedEdges:E}},getIntersectingNodes:(f,h=!0,m)=>{const g=Iq(f),b=g?f:c(f),y=m!==void 0;return b?(m||t.getState().nodes).filter(O=>{const v=t.getState().nodeLookup.get(O.id);if(v&&!g&&(O.id===f.id||!v.internals.positionAbsolute))return!1;const x=a1(y?O:v),w=$w(x,b);return h&&w>0||w>=x.width*x.height||w>=b.width*b.height}):[]},isNodeIntersecting:(f,h,m=!0)=>{const b=Iq(f)?f:c(f);if(!b)return!1;const y=$w(b,h);return m&&y>0||y>=h.width*h.height||y>=b.width*b.height},updateNode:u,updateNodeData:(f,h,m={replace:!1})=>{u(f,g=>{const b=typeof h=="function"?h(g):h;return m.replace?{...g,data:b}:{...g,data:{...g.data,...b}}},m)},updateEdge:d,updateEdgeData:(f,h,m={replace:!1})=>{d(f,g=>{const b=typeof h=="function"?h(g):h;return m.replace?{...g,data:b}:{...g,data:{...g.data,...b}}},m)},getNodesBounds:f=>{const{nodeLookup:h,nodeOrigin:m}=t.getState();return j7e(f,{nodeLookup:h,nodeOrigin:m})},getHandleConnections:({type:f,id:h,nodeId:m})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${m}-${f}${h?`-${h}`:""}`))==null?void 0:g.values())??[])},getNodeConnections:({type:f,handleId:h,nodeId:m})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${m}${f?h?`-${f}-${h}`:`-${f}`:""}`))==null?void 0:g.values())??[])},fitView:async f=>{const h=t.getState().fitViewResolver??$7e();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:h}),n.nodeQueue.push(m=>[...m]),h.promise}}},[]);return p.useMemo(()=>({...i,...e,viewportInitialized:r}),[r])}const sX=e=>e.selected,TQe=typeof window<"u"?window:void 0;function CQe({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Ji(),{deleteElements:r}=mj(),i=Qw(e,{actInsideInputWithModifier:!1}),s=Qw(t,{target:TQe});p.useEffect(()=>{if(i){const{edges:a,nodes:l}=n.getState();r({nodes:l.filter(sX),edges:a.filter(sX)}),n.setState({nodesSelectionActive:!1})}},[i]),p.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function AQe(e){const t=Ji();p.useEffect(()=>{const n=()=>{var i,s,a,l;if(!e.current||!(((s=(i=e.current).checkVisibility)==null?void 0:s.call(i))??!0))return!1;const r=_7(e.current);(r.height===0||r.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",vu.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 gj={position:"absolute",width:"100%",height:"100%",top:0,left:0},NQe=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function jQe({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:s=wg.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:m=!0,children:g,noWheelClassName:b,noPanClassName:y,onViewportChange:O,isControlledViewport:v,paneClickDistance:x,selectionOnDrag:w}){const S=Ji(),E=p.useRef(null),{userSelectionActive:k,lib:_,connectionInProgress:T}=wr(NQe,Ki),C=Qw(h),A=p.useRef();AQe(E);const j=p.useCallback(M=>{O==null||O({x:M[0],y:M[1],zoom:M[2]}),v||S.setState({transform:M})},[O,v]);return p.useEffect(()=>{if(E.current){A.current=vBe({domNode:E.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:N=>S.setState(D=>D.paneDragging===N?D:{paneDragging:N}),onPanZoomStart:(N,D)=>{const{onViewportChangeStart:Q,onMoveStart:F}=S.getState();F==null||F(N,D),Q==null||Q(D)},onPanZoom:(N,D)=>{const{onViewportChange:Q,onMove:F}=S.getState();F==null||F(N,D),Q==null||Q(D)},onPanZoomEnd:(N,D)=>{const{onViewportChangeEnd:Q,onMoveEnd:F}=S.getState();F==null||F(N,D),Q==null||Q(D)}});const{x:M,y:I,zoom:$}=A.current.getViewport();return S.setState({panZoom:A.current,transform:[M,I,$],domNode:E.current.closest(".react-flow")}),()=>{var N;(N=A.current)==null||N.destroy()}}},[]),p.useEffect(()=>{var M;(M=A.current)==null||M.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:s,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:C,preventScrolling:m,noPanClassName:y,userSelectionActive:k,noWheelClassName:b,lib:_,onTransformChange:j,connectionInProgress:T,selectionOnDrag:w,paneClickDistance:x})},[e,t,n,r,i,s,a,l,C,m,y,k,b,_,j,T,w,x]),o.jsx("div",{className:"react-flow__renderer",ref:E,style:gj,children:g})}const RQe=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function IQe(){const{userSelectionActive:e,userSelectionRect:t}=wr(RQe,Ki);return e&&t?o.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 L5=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},DQe=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function PQe({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Mw.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:s,selectionOnDrag:a,onSelectionStart:l,onSelectionEnd:c,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:h,onPaneMouseMove:m,onPaneMouseLeave:g,children:b}){const y=p.useRef(0),O=Ji(),{userSelectionActive:v,elementsSelectable:x,dragging:w,connectionInProgress:S,panBy:E,autoPanSpeed:k}=wr(DQe,Ki),_=x&&(e||v),T=p.useRef(null),C=p.useRef(),A=p.useRef(new Set),j=p.useRef(new Set),M=p.useRef(!1),I=p.useRef({x:0,y:0}),$=p.useRef(!1),N=re=>{if(M.current||S){M.current=!1;return}u==null||u(re),O.getState().resetSelectedElements(),O.setState({nodesSelectionActive:!1})},D=re=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){re.preventDefault();return}d==null||d(re)},Q=f?re=>f(re):void 0,F=re=>{M.current&&(re.stopPropagation(),M.current=!1)},L=re=>{var Ke,Ce;const{domNode:q,transform:G}=O.getState();if(C.current=q==null?void 0:q.getBoundingClientRect(),!C.current)return;const J=re.target===T.current;if(!J&&!!re.target.closest(".nokey")||!e||!(a&&J||t)||re.button!==0||!re.isPrimary)return;(Ce=(Ke=re.target)==null?void 0:Ke.setPointerCapture)==null||Ce.call(Ke,re.pointerId),M.current=!1;const{x:Pe,y:Ae}=fu(re.nativeEvent,C.current),Ue=J1({x:Pe,y:Ae},G);O.setState({userSelectionRect:{width:0,height:0,startX:Ue.x,startY:Ue.y,x:Pe,y:Ae}}),J||(re.stopPropagation(),re.preventDefault())};function H(re,q){const{userSelectionRect:G}=O.getState();if(!G)return;const{transform:J,nodeLookup:de,edgeLookup:ve,connectionLookup:Pe,triggerNodeChanges:Ae,triggerEdgeChanges:Ue,defaultEdgeOptions:Ke}=O.getState(),Ce={x:G.startX,y:G.startY},{x:Le,y:pe}=o1(Ce,J),me={startX:Ce.x,startY:Ce.y,x:re$e.id)),j.current=new Set;const st=(Ke==null?void 0:Ke.selectable)??!0;for(const $e of A.current){const ie=Pe.get($e);if(ie)for(const{edgeId:ce}of ie.values()){const Ie=ve.get(ce);Ie&&(Ie.selectable??st)&&j.current.add(ce)}}if(!Dq(we,A.current)){const $e=Hb(de,A.current,!0);Ae($e)}if(!Dq(Ee,j.current)){const $e=Hb(ve,j.current);Ue($e)}O.setState({userSelectionRect:me,userSelectionActive:!0,nodesSelectionActive:!1})}function z(){if(!i||!C.current)return;const[re,q]=S7(I.current,C.current,k);E({x:re,y:q}).then(G=>{if(!M.current||!G){y.current=requestAnimationFrame(z);return}const{x:J,y:de}=I.current;H(J,de),y.current=requestAnimationFrame(z)})}const B=()=>{cancelAnimationFrame(y.current),y.current=0,$.current=!1};p.useEffect(()=>()=>B(),[]);const V=re=>{const{userSelectionRect:q,transform:G,resetSelectedElements:J}=O.getState();if(!C.current||!q)return;const{x:de,y:ve}=fu(re.nativeEvent,C.current);I.current={x:de,y:ve};const Pe=o1({x:q.startX,y:q.startY},G);if(!M.current){const Ae=t?0:s;if(Math.hypot(de-Pe.x,ve-Pe.y)<=Ae)return;J(),l==null||l(re)}M.current=!0,$.current||(z(),$.current=!0),H(de,ve)},W=re=>{var q,G;re.button===0&&((G=(q=re.target)==null?void 0:q.releasePointerCapture)==null||G.call(q,re.pointerId),!v&&re.target===T.current&&O.getState().userSelectionRect&&(N==null||N(re)),O.setState({userSelectionActive:!1,userSelectionRect:null}),M.current&&(c==null||c(re),O.setState({nodesSelectionActive:A.current.size>0})),B())},le=re=>{var q,G;(G=(q=re.target)==null?void 0:q.releasePointerCapture)==null||G.call(q,re.pointerId),B()},be=r===!0||Array.isArray(r)&&r.includes(0);return o.jsxs("div",{className:zs(["react-flow__pane",{draggable:be,dragging:w,selection:e}]),onClick:_?void 0:L5(N,T),onContextMenu:L5(D,T),onWheel:L5(Q,T),onPointerEnter:_?void 0:h,onPointerMove:_?V:m,onPointerUp:_?W:void 0,onPointerCancel:_?le:void 0,onPointerDownCapture:_?L:void 0,onClickCapture:_?F:void 0,onPointerLeave:g,ref:T,style:gj,children:[b,o.jsx(IQe,{})]})}function I4({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:s,multiSelectionActive:a,nodeLookup:l,onError:c}=t.getState(),u=l.get(e);if(!u){c==null||c("012",vu.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(s({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=r==null?void 0:r.current)==null?void 0:d.blur()})):i([e])}function ufe({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:s,nodeClickDistance:a}){const l=Ji(),[c,u]=p.useState(!1),d=p.useRef();return p.useEffect(()=>{d.current=oBe({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{I4({id:f,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),p.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:s,nodeId:i,nodeClickDistance:a}),()=>{var f;(f=d.current)==null||f.destroy()}},[n,r,t,s,e,i,a]),c}const MQe=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function dfe(){const e=Ji();return p.useCallback(n=>{const{nodeExtent:r,snapToGrid:i,snapGrid:s,nodesDraggable:a,onError:l,updateNodePositions:c,nodeLookup:u,nodeOrigin:d}=e.getState(),f=new Map,h=MQe(a),m=i?s[0]:5,g=i?s[1]:5,b=n.direction.x*m*n.factor,y=n.direction.y*g*n.factor;for(const[,O]of u){if(!h(O))continue;let v={x:O.internals.positionAbsolute.x+b,y:O.internals.positionAbsolute.y+y};i&&(v=lE(v,s));const{position:x,positionAbsolute:w}=Tde({nodeId:O.id,nextPosition:v,nodeLookup:u,nodeExtent:r,nodeOrigin:d,onError:l});O.position=x,O.internals.positionAbsolute=w,f.set(O.id,O)}c(f)},[])}const R7=p.createContext(null),LQe=R7.Provider;R7.Consumer;const ffe=()=>p.useContext(R7),$Qe=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),BQe=(e,t,n)=>r=>{const{connectionClickStartHandle:i,connectionMode:s,connection:a}=r,{fromHandle:l,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:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n,connectingTo:d,clickConnecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.id)===t&&(i==null?void 0:i.type)===n,isPossibleEndHandle:s===i1.Strict?(l==null?void 0:l.type)!==n:e!==(l==null?void 0:l.nodeId)||t!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!i,valid:d&&u}};function QQe({type:e="source",position:t=zt.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:s=!0,id:a,onConnect:l,children:c,className:u,onMouseDown:d,onTouchStart:f,...h},m){var $,N;const g=a||null,b=e==="target",y=Ji(),O=ffe(),{connectOnClick:v,noPanClassName:x,rfId:w}=wr($Qe,Ki),{connectingFrom:S,connectingTo:E,clickConnecting:k,isPossibleEndHandle:_,connectionInProcess:T,clickConnectionInProcess:C,valid:A}=wr(BQe(O,g,e),Ki);O||(N=($=y.getState()).onError)==null||N.call($,"010",vu.error010());const j=D=>{const{defaultEdgeOptions:Q,onConnect:F,hasDefaultEdges:L}=y.getState(),H={...Q,...D};if(L){const{edges:z,setEdges:B,onError:V}=y.getState();B(xQe(H,z,{onError:V}))}F==null||F(H),l==null||l(H)},M=D=>{if(!O)return;const Q=Dde(D.nativeEvent);if(i&&(Q&&D.button===0||!Q)){const F=y.getState();R4.onPointerDown(D.nativeEvent,{handleDomNode:D.currentTarget,autoPanOnConnect:F.autoPanOnConnect,connectionMode:F.connectionMode,connectionRadius:F.connectionRadius,domNode:F.domNode,nodeLookup:F.nodeLookup,lib:F.lib,isTarget:b,handleId:g,nodeId:O,flowId:F.rfId,panBy:F.panBy,cancelConnection:F.cancelConnection,onConnectStart:F.onConnectStart,onConnectEnd:(...L)=>{var H,z;return(z=(H=y.getState()).onConnectEnd)==null?void 0:z.call(H,...L)},updateConnection:F.updateConnection,onConnect:j,isValidConnection:n||((...L)=>{var H,z;return((z=(H=y.getState()).isValidConnection)==null?void 0:z.call(H,...L))??!0}),getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,autoPanSpeed:F.autoPanSpeed,dragThreshold:F.connectionDragThreshold})}Q?d==null||d(D):f==null||f(D)},I=D=>{const{onClickConnectStart:Q,onClickConnectEnd:F,connectionClickStartHandle:L,connectionMode:H,isValidConnection:z,lib:B,rfId:V,nodeLookup:W,connection:le}=y.getState();if(!O||!L&&!i)return;if(!L){Q==null||Q(D.nativeEvent,{nodeId:O,handleId:g,handleType:e}),y.setState({connectionClickStartHandle:{nodeId:O,type:e,id:g}});return}const be=Rde(D.target),re=n||z,{connection:q,isValid:G}=R4.isValid(D.nativeEvent,{handle:{nodeId:O,id:g,type:e},connectionMode:H,fromNodeId:L.nodeId,fromHandleId:L.id||null,fromType:L.type,isValidConnection:re,flowId:V,doc:be,lib:B,nodeLookup:W});G&&q&&j(q);const J=structuredClone(le);delete J.inProgress,J.toPosition=J.toHandle?J.toHandle.position:null,F==null||F(D,J),y.setState({connectionClickStartHandle:null})};return o.jsx("div",{"data-handleid":g,"data-nodeid":O,"data-handlepos":t,"data-id":`${w}-${O}-${g}-${e}`,className:zs(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",x,u,{source:!b,target:b,connectable:r,connectablestart:i,connectableend:s,clickconnecting:k,connectingfrom:S,connectingto:E,valid:A,connectionindicator:r&&(!T||_)&&(T||C?s:i)}]),onMouseDown:M,onTouchStart:M,onClick:v?I:void 0,ref:m,...h,children:c})}const Ho=p.memo(lfe(QQe));function UQe({data:e,isConnectable:t,sourcePosition:n=zt.Bottom}){return o.jsxs(o.Fragment,{children:[e==null?void 0:e.label,o.jsx(Ho,{type:"source",position:n,isConnectable:t})]})}function FQe({data:e,isConnectable:t,targetPosition:n=zt.Top,sourcePosition:r=zt.Bottom}){return o.jsxs(o.Fragment,{children:[o.jsx(Ho,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,o.jsx(Ho,{type:"source",position:r,isConnectable:t})]})}function zQe(){return null}function VQe({data:e,isConnectable:t,targetPosition:n=zt.Top}){return o.jsxs(o.Fragment,{children:[o.jsx(Ho,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const LC={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},aX={input:UQe,default:FQe,output:VQe,group:zQe};function HQe(e){var t,n,r,i;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??((i=e.style)==null?void 0:i.height)}}const qQe=e=>{const{width:t,height:n,x:r,y:i}=oE(e.nodeLookup,{filter:s=>!!s.selected});return{width:du(t)?t:null,height:du(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function XQe({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Ji(),{width:i,height:s,transformString:a,userSelectionActive:l}=wr(qQe,Ki),c=dfe(),u=p.useRef(null);p.useEffect(()=>{var m;n||(m=u.current)==null||m.focus({preventScroll:!0})},[n]);const d=!l&&i!==null&&s!==null;if(ufe({nodeRef:u,disabled:!d}),!d)return null;const f=e?m=>{const g=r.getState().nodes.filter(b=>b.selected);e(m,g)}:void 0,h=m=>{Object.prototype.hasOwnProperty.call(LC,m.key)&&(m.preventDefault(),c({direction:LC[m.key],factor:m.shiftKey?4:1}))};return o.jsx("div",{className:zs(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:o.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:i,height:s}})})}const oX=typeof window<"u"?window:void 0,GQe=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function hfe({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:d,selectionMode:f,onSelectionStart:h,onSelectionEnd:m,multiSelectionKeyCode:g,panActivationKeyCode:b,zoomActivationKeyCode:y,elementsSelectable:O,zoomOnScroll:v,zoomOnPinch:x,panOnScroll:w,panOnScrollSpeed:S,panOnScrollMode:E,zoomOnDoubleClick:k,panOnDrag:_,autoPanOnSelection:T,defaultViewport:C,translateExtent:A,minZoom:j,maxZoom:M,preventScrolling:I,onSelectionContextMenu:$,noWheelClassName:N,noPanClassName:D,disableKeyboardA11y:Q,onViewportChange:F,isControlledViewport:L}){const{nodesSelectionActive:H,userSelectionActive:z}=wr(GQe,Ki),B=Qw(u,{target:oX}),V=Qw(b,{target:oX}),W=V||_,le=V||w,be=d&&W!==!0,re=B||z||be;return CQe({deleteKeyCode:c,multiSelectionKeyCode:g}),o.jsx(jQe,{onPaneContextMenu:s,elementsSelectable:O,zoomOnScroll:v,zoomOnPinch:x,panOnScroll:le,panOnScrollSpeed:S,panOnScrollMode:E,zoomOnDoubleClick:k,panOnDrag:!B&&W,defaultViewport:C,translateExtent:A,minZoom:j,maxZoom:M,zoomActivationKeyCode:y,preventScrolling:I,noWheelClassName:N,noPanClassName:D,onViewportChange:F,isControlledViewport:L,paneClickDistance:l,selectionOnDrag:be,children:o.jsxs(PQe,{onSelectionStart:h,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:a,panOnDrag:W,autoPanOnSelection:T,isSelecting:!!re,selectionMode:f,selectionKeyPressed:B,paneClickDistance:l,selectionOnDrag:be,children:[e,H&&o.jsx(XQe,{onSelectionContextMenu:$,noPanClassName:D,disableKeyboardA11y:Q})]})})}hfe.displayName="FlowRenderer";const WQe=p.memo(hfe),YQe=e=>t=>e?w7(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 ZQe(e){return wr(p.useCallback(YQe(e),[e]),Ki)}const KQe=e=>e.updateNodeInternals;function JQe(){const e=wr(KQe),[t]=p.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(i=>{const s=i.target.getAttribute("data-id");r.set(s,{id:s,nodeElement:i.target,force:!0})}),e(r)}));return p.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function eUe({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const i=Ji(),s=p.useRef(null),a=p.useRef(null),l=p.useRef(e.sourcePosition),c=p.useRef(e.targetPosition),u=p.useRef(t),d=n&&!!e.internals.handleBounds;return p.useEffect(()=>{s.current&&!e.hidden&&(!d||a.current!==s.current)&&(a.current&&(r==null||r.unobserve(a.current)),r==null||r.observe(s.current),a.current=s.current)},[d,e.hidden]),p.useEffect(()=>()=>{a.current&&(r==null||r.unobserve(a.current),a.current=null)},[]),p.useEffect(()=>{if(s.current){const f=u.current!==t,h=l.current!==e.sourcePosition,m=c.current!==e.targetPosition;(f||h||m)&&(u.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),s}function tUe({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:s,onDoubleClick:a,nodesDraggable:l,elementsSelectable:c,nodesConnectable:u,nodesFocusable:d,resizeObserver:f,noDragClassName:h,noPanClassName:m,disableKeyboardA11y:g,rfId:b,nodeTypes:y,nodeClickDistance:O,onError:v}){const{node:x,internals:w,isParent:S}=wr(re=>{const q=re.nodeLookup.get(e),G=re.parentLookup.has(e);return{node:q,internals:q.internals,isParent:G}},Ki);let E=x.type||"default",k=(y==null?void 0:y[E])||aX[E];k===void 0&&(v==null||v("003",vu.error003(E)),E="default",k=(y==null?void 0:y.default)||aX.default);const _=!!(x.draggable||l&&typeof x.draggable>"u"),T=!!(x.selectable||c&&typeof x.selectable>"u"),C=!!(x.connectable||u&&typeof x.connectable>"u"),A=!!(x.focusable||d&&typeof x.focusable>"u"),j=Ji(),M=k7(x),I=eUe({node:x,nodeType:E,hasDimensions:M,resizeObserver:f}),$=ufe({nodeRef:I,disabled:x.hidden||!_,noDragClassName:h,handleSelector:x.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:O}),N=dfe();if(x.hidden)return null;const D=gh(x),Q=HQe(x),F=T||_||t||n||r||i,L=n?re=>n(re,{...w.userNode}):void 0,H=r?re=>r(re,{...w.userNode}):void 0,z=i?re=>i(re,{...w.userNode}):void 0,B=s?re=>s(re,{...w.userNode}):void 0,V=a?re=>a(re,{...w.userNode}):void 0,W=re=>{const{selectNodesOnDrag:q,nodeDragThreshold:G}=j.getState();T&&(!q||!_||G>0)&&I4({id:e,store:j,nodeRef:I}),t&&t(re,{...w.userNode})},le=re=>{if(!(Ide(re.nativeEvent)||g)){if(wde.includes(re.key)&&T){const q=re.key==="Escape";I4({id:e,store:j,unselect:q,nodeRef:I})}else if(_&&x.selected&&Object.prototype.hasOwnProperty.call(LC,re.key)){re.preventDefault();const{ariaLabelConfig:q}=j.getState();j.setState({ariaLiveMessage:q["node.a11yDescription.ariaLiveMessage"]({direction:re.key.replace("Arrow","").toLowerCase(),x:~~w.positionAbsolute.x,y:~~w.positionAbsolute.y})}),N({direction:LC[re.key],factor:re.shiftKey?4:1})}}},be=()=>{var Pe;if(g||!((Pe=I.current)!=null&&Pe.matches(":focus-visible")))return;const{transform:re,width:q,height:G,autoPanOnNodeFocus:J,setCenter:de}=j.getState();if(!J)return;w7(new Map([[e,x]]),{x:0,y:0,width:q,height:G},re,!0).length>0||de(x.position.x+D.width/2,x.position.y+D.height/2,{zoom:re[2]})};return o.jsx("div",{className:zs(["react-flow__node",`react-flow__node-${E}`,{[m]:_},x.className,{selected:x.selected,selectable:T,parent:S,draggable:_,dragging:$}]),ref:I,style:{zIndex:w.z,transform:`translate(${w.positionAbsolute.x}px,${w.positionAbsolute.y}px)`,pointerEvents:F?"all":"none",visibility:M?"visible":"hidden",...x.style,...Q},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:L,onMouseMove:H,onMouseLeave:z,onContextMenu:B,onClick:W,onDoubleClick:V,onKeyDown:A?le:void 0,tabIndex:A?0:void 0,onFocus:A?be:void 0,role:x.ariaRole??(A?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${nfe}-${b}`,"aria-label":x.ariaLabel,...x.domAttributes,children:o.jsx(LQe,{value:e,children:o.jsx(k,{id:e,data:x.data,type:E,positionAbsoluteX:w.positionAbsolute.x,positionAbsoluteY:w.positionAbsolute.y,selected:x.selected??!1,selectable:T,draggable:_,deletable:x.deletable??!0,isConnectable:C,sourcePosition:x.sourcePosition,targetPosition:x.targetPosition,dragging:$,dragHandle:x.dragHandle,zIndex:w.z,parentId:x.parentId,...D})})})}var nUe=p.memo(tUe);const rUe=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function pfe(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:s}=wr(rUe,Ki),a=ZQe(e.onlyRenderVisibleElements),l=JQe();return o.jsx("div",{className:"react-flow__nodes",style:gj,children:a.map(c=>o.jsx(nUe,{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:l,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:s},c))})}pfe.displayName="NodeRenderer";const iUe=p.memo(pfe);function sUe(e){return wr(p.useCallback(n=>{if(!e)return n.edges.map(i=>i.id);const r=[];if(n.width&&n.height)for(const i of n.edges){const s=n.nodeLookup.get(i.source),a=n.nodeLookup.get(i.target);s&&a&&F7e({sourceNode:s,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(i.id)}return r},[e]),Ki)}const aUe=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return o.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},oUe=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return o.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},lX={[Lw.Arrow]:aUe,[Lw.ArrowClosed]:oUe};function lUe(e){const t=Ji();return p.useMemo(()=>{var i,s;return Object.prototype.hasOwnProperty.call(lX,e)?lX[e]:((s=(i=t.getState()).onError)==null||s.call(i,"009",vu.error009(e)),null)},[e])}const cUe=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:s="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{const c=lUe(t);return c?o.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:l,refX:"0",refY:"0",children:o.jsx(c,{color:n,strokeWidth:a})}):null},mfe=({defaultColor:e,rfId:t})=>{const n=wr(s=>s.edges),r=wr(s=>s.defaultEdgeOptions),i=p.useMemo(()=>Y7e(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return i.length?o.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:o.jsx("defs",{children:i.map(s=>o.jsx(cUe,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};mfe.displayName="MarkerDefinitions";var uUe=p.memo(mfe);function gfe({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:s,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:c,className:u,...d}){const[f,h]=p.useState({x:1,y:0,width:0,height:0}),m=zs(["react-flow__edge-textwrapper",u]),g=p.useRef(null);return p.useEffect(()=>{if(g.current){const b=g.current.getBBox();h({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),n?o.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:m,visibility:f.width?"visible":"hidden",...d,children:[i&&o.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:s,rx:l,ry:l}),o.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:g,style:r,children:n}),c]}):null}gfe.displayName="EdgeText";const dUe=p.memo(gfe);function cE({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:u=20,...d}){return o.jsxs(o.Fragment,{children:[o.jsx("path",{...d,d:e,fill:"none",className:zs(["react-flow__edge-path",d.className])}),u?o.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&du(t)&&du(n)?o.jsx(dUe,{x:t,y:n,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function cX({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===zt.Left||e===zt.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function bfe({sourceX:e,sourceY:t,sourcePosition:n=zt.Bottom,targetX:r,targetY:i,targetPosition:s=zt.Top}){const[a,l]=cX({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,u]=cX({pos:s,x1:r,y1:i,x2:e,y2:t}),[d,f,h,m]=Pde({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${r},${i}`,d,f,h,m]}function yfe(e){return p.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:a,targetPosition:l,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:b,markerStart:y,interactionWidth:O})=>{const[v,x,w]=bfe({sourceX:n,sourceY:r,sourcePosition:a,targetX:i,targetY:s,targetPosition:l}),S=e.isInternal?void 0:t;return o.jsx(cE,{id:S,path:v,labelX:x,labelY:w,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:b,markerStart:y,interactionWidth:O})})}const fUe=yfe({isInternal:!1}),Ofe=yfe({isInternal:!0});fUe.displayName="SimpleBezierEdge";Ofe.displayName="SimpleBezierEdgeInternal";function xfe(e){return p.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:m=zt.Bottom,targetPosition:g=zt.Top,markerEnd:b,markerStart:y,pathOptions:O,interactionWidth:v})=>{const[x,w,S]=MC({sourceX:n,sourceY:r,sourcePosition:m,targetX:i,targetY:s,targetPosition:g,borderRadius:O==null?void 0:O.borderRadius,offset:O==null?void 0:O.offset,stepPosition:O==null?void 0:O.stepPosition}),E=e.isInternal?void 0:t;return o.jsx(cE,{id:E,path:x,labelX:w,labelY:S,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:b,markerStart:y,interactionWidth:v})})}const vfe=xfe({isInternal:!1}),wfe=xfe({isInternal:!0});vfe.displayName="SmoothStepEdge";wfe.displayName="SmoothStepEdgeInternal";function Sfe(e){return p.memo(({id:t,...n})=>{var i;const r=e.isInternal?void 0:t;return o.jsx(vfe,{...n,id:r,pathOptions:p.useMemo(()=>{var s;return{borderRadius:0,offset:(s=n.pathOptions)==null?void 0:s.offset}},[(i=n.pathOptions)==null?void 0:i.offset])})})}const hUe=Sfe({isInternal:!1}),Efe=Sfe({isInternal:!0});hUe.displayName="StepEdge";Efe.displayName="StepEdgeInternal";function kfe(e){return p.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:m,markerStart:g,interactionWidth:b})=>{const[y,O,v]=$de({sourceX:n,sourceY:r,targetX:i,targetY:s}),x=e.isInternal?void 0:t;return o.jsx(cE,{id:x,path:y,labelX:O,labelY:v,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:m,markerStart:g,interactionWidth:b})})}const pUe=kfe({isInternal:!1}),_fe=kfe({isInternal:!0});pUe.displayName="StraightEdge";_fe.displayName="StraightEdgeInternal";function Tfe(e){return p.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:a=zt.Bottom,targetPosition:l=zt.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:b,markerStart:y,pathOptions:O,interactionWidth:v})=>{const[x,w,S]=Mde({sourceX:n,sourceY:r,sourcePosition:a,targetX:i,targetY:s,targetPosition:l,curvature:O==null?void 0:O.curvature}),E=e.isInternal?void 0:t;return o.jsx(cE,{id:E,path:x,labelX:w,labelY:S,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:m,style:g,markerEnd:b,markerStart:y,interactionWidth:v})})}const mUe=Tfe({isInternal:!1}),Cfe=Tfe({isInternal:!0});mUe.displayName="BezierEdge";Cfe.displayName="BezierEdgeInternal";const uX={default:Cfe,straight:_fe,step:Efe,smoothstep:wfe,simplebezier:Ofe},dX={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},gUe=(e,t,n)=>n===zt.Left?e-t:n===zt.Right?e+t:e,bUe=(e,t,n)=>n===zt.Top?e-t:n===zt.Bottom?e+t:e,fX="react-flow__edgeupdater";function hX({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:s,onMouseOut:a,type:l}){return o.jsx("circle",{onMouseDown:i,onMouseEnter:s,onMouseOut:a,className:zs([fX,`${fX}-${l}`]),cx:gUe(t,r,e),cy:bUe(n,r,e),r,stroke:"transparent",fill:"transparent"})}function yUe({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:s,targetY:a,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:h,setUpdateHover:m}){const g=Ji(),b=(w,S)=>{if(w.button!==0)return;const{autoPanOnConnect:E,domNode:k,connectionMode:_,connectionRadius:T,lib:C,onConnectStart:A,cancelConnection:j,nodeLookup:M,rfId:I,panBy:$,updateConnection:N}=g.getState(),D=S.type==="target",Q=(H,z)=>{h(!1),f==null||f(H,n,S.type,z)},F=H=>u==null?void 0:u(n,H),L=(H,z)=>{h(!0),d==null||d(w,n,S.type),A==null||A(H,z)};R4.onPointerDown(w.nativeEvent,{autoPanOnConnect:E,connectionMode:_,connectionRadius:T,domNode:k,handleId:S.id,nodeId:S.nodeId,nodeLookup:M,isTarget:D,edgeUpdaterType:S.type,lib:C,flowId:I,cancelConnection:j,panBy:$,isValidConnection:(...H)=>{var z,B;return((B=(z=g.getState()).isValidConnection)==null?void 0:B.call(z,...H))??!0},onConnect:F,onConnectStart:L,onConnectEnd:(...H)=>{var z,B;return(B=(z=g.getState()).onConnectEnd)==null?void 0:B.call(z,...H)},onReconnectEnd:Q,updateConnection:N,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:w.currentTarget})},y=w=>b(w,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),O=w=>b(w,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),v=()=>m(!0),x=()=>m(!1);return o.jsxs(o.Fragment,{children:[(e===!0||e==="source")&&o.jsx(hX,{position:l,centerX:r,centerY:i,radius:t,onMouseDown:y,onMouseEnter:v,onMouseOut:x,type:"source"}),(e===!0||e==="target")&&o.jsx(hX,{position:c,centerX:s,centerY:a,radius:t,onMouseDown:O,onMouseEnter:v,onMouseOut:x,type:"target"})]})}function OUe({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:s,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:m,rfId:g,edgeTypes:b,noPanClassName:y,onError:O,disableKeyboardA11y:v}){let x=wr(de=>de.edgeLookup.get(e));const w=wr(de=>de.defaultEdgeOptions);x=w?{...w,...x}:x;let S=x.type||"default",E=(b==null?void 0:b[S])||uX[S];E===void 0&&(O==null||O("011",vu.error011(S)),S="default",E=(b==null?void 0:b.default)||uX.default);const k=!!(x.focusable||t&&typeof x.focusable>"u"),_=typeof f<"u"&&(x.reconnectable||n&&typeof x.reconnectable>"u"),T=!!(x.selectable||r&&typeof x.selectable>"u"),C=p.useRef(null),[A,j]=p.useState(!1),[M,I]=p.useState(!1),$=Ji(),{zIndex:N,sourceX:D,sourceY:Q,targetX:F,targetY:L,sourcePosition:H,targetPosition:z}=wr(p.useCallback(de=>{const ve=de.nodeLookup.get(x.source),Pe=de.nodeLookup.get(x.target);if(!ve||!Pe)return{zIndex:x.zIndex,...dX};const Ae=W7e({id:e,sourceNode:ve,targetNode:Pe,sourceHandle:x.sourceHandle||null,targetHandle:x.targetHandle||null,connectionMode:de.connectionMode,onError:O});return{zIndex:U7e({selected:x.selected,zIndex:x.zIndex,sourceNode:ve,targetNode:Pe,elevateOnSelect:de.elevateEdgesOnSelect,zIndexMode:de.zIndexMode}),...Ae||dX}},[x.source,x.target,x.sourceHandle,x.targetHandle,x.selected,x.zIndex]),Ki),B=p.useMemo(()=>x.markerStart?`url('#${N4(x.markerStart,g)}')`:void 0,[x.markerStart,g]),V=p.useMemo(()=>x.markerEnd?`url('#${N4(x.markerEnd,g)}')`:void 0,[x.markerEnd,g]);if(x.hidden||D===null||Q===null||F===null||L===null)return null;const W=de=>{var Ue;const{addSelectedEdges:ve,unselectNodesAndEdges:Pe,multiSelectionActive:Ae}=$.getState();T&&($.setState({nodesSelectionActive:!1}),x.selected&&Ae?(Pe({nodes:[],edges:[x]}),(Ue=C.current)==null||Ue.blur()):ve([e])),i&&i(de,x)},le=s?de=>{s(de,{...x})}:void 0,be=a?de=>{a(de,{...x})}:void 0,re=l?de=>{l(de,{...x})}:void 0,q=c?de=>{c(de,{...x})}:void 0,G=u?de=>{u(de,{...x})}:void 0,J=de=>{var ve;if(!v&&wde.includes(de.key)&&T){const{unselectNodesAndEdges:Pe,addSelectedEdges:Ae}=$.getState();de.key==="Escape"?((ve=C.current)==null||ve.blur(),Pe({edges:[x]})):Ae([e])}};return o.jsx("svg",{style:{zIndex:N},children:o.jsxs("g",{className:zs(["react-flow__edge",`react-flow__edge-${S}`,x.className,y,{selected:x.selected,animated:x.animated,inactive:!T&&!i,updating:A,selectable:T}]),onClick:W,onDoubleClick:le,onContextMenu:be,onMouseEnter:re,onMouseMove:q,onMouseLeave:G,onKeyDown:k?J:void 0,tabIndex:k?0:void 0,role:x.ariaRole??(k?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":x.ariaLabel===null?void 0:x.ariaLabel||`Edge from ${x.source} to ${x.target}`,"aria-describedby":k?`${rfe}-${g}`:void 0,ref:C,...x.domAttributes,children:[!M&&o.jsx(E,{id:e,source:x.source,target:x.target,type:x.type,selected:x.selected,animated:x.animated,selectable:T,deletable:x.deletable??!0,label:x.label,labelStyle:x.labelStyle,labelShowBg:x.labelShowBg,labelBgStyle:x.labelBgStyle,labelBgPadding:x.labelBgPadding,labelBgBorderRadius:x.labelBgBorderRadius,sourceX:D,sourceY:Q,targetX:F,targetY:L,sourcePosition:H,targetPosition:z,data:x.data,style:x.style,sourceHandleId:x.sourceHandle,targetHandleId:x.targetHandle,markerStart:B,markerEnd:V,pathOptions:"pathOptions"in x?x.pathOptions:void 0,interactionWidth:x.interactionWidth}),_&&o.jsx(yUe,{edge:x,isReconnectable:_,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:m,sourceX:D,sourceY:Q,targetX:F,targetY:L,sourcePosition:H,targetPosition:z,setUpdateHover:j,setReconnecting:I})]})})}var xUe=p.memo(OUe);const vUe=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Afe({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:s,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:h,onReconnectStart:m,onReconnectEnd:g,disableKeyboardA11y:b}){const{edgesFocusable:y,edgesReconnectable:O,elementsSelectable:v,onError:x}=wr(vUe,Ki),w=sUe(t);return o.jsxs("div",{className:"react-flow__edges",children:[o.jsx(uUe,{defaultColor:e,rfId:n}),w.map(S=>o.jsx(xUe,{id:S,edgesFocusable:y,edgesReconnectable:O,elementsSelectable:v,noPanClassName:i,onReconnect:s,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:d,reconnectRadius:f,onDoubleClick:h,onReconnectStart:m,onReconnectEnd:g,rfId:n,onError:x,edgeTypes:r,disableKeyboardA11y:b},S))]})}Afe.displayName="EdgeRenderer";const wUe=p.memo(Afe),SUe=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function EUe({children:e}){const t=wr(SUe);return o.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function kUe(e){const t=mj(),n=p.useRef(!1);p.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const _Ue=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function TUe(e){const t=wr(_Ue),n=Ji();return p.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function CUe(e){return e.connection.inProgress?{...e.connection,to:J1(e.connection.to,e.transform)}:{...e.connection}}function AUe(e){return CUe}function NUe(e){const t=AUe();return wr(t,Ki)}const jUe=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function RUe({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:i,width:s,height:a,isValid:l,inProgress:c}=wr(jUe,Ki);return!(s&&i&&c)?null:o.jsx("svg",{style:e,width:s,height:a,className:"react-flow__connectionline react-flow__container",children:o.jsx("g",{className:zs(["react-flow__connection",kde(l)]),children:o.jsx(Nfe,{style:t,type:n,CustomComponent:r,isValid:l})})})}const Nfe=({style:e,type:t=ip.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:i,from:s,fromNode:a,fromHandle:l,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h,pointer:m}=NUe();if(!i)return;if(n)return o.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:l,fromX:s.x,fromY:s.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:h,connectionStatus:kde(r),toNode:d,toHandle:f,pointer:m});let g="";const b={sourceX:s.x,sourceY:s.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case ip.Bezier:[g]=Mde(b);break;case ip.SimpleBezier:[g]=bfe(b);break;case ip.Step:[g]=MC({...b,borderRadius:0});break;case ip.SmoothStep:[g]=MC(b);break;default:[g]=$de(b)}return o.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};Nfe.displayName="ConnectionLine";const IUe={};function pX(e=IUe){p.useRef(e),Ji(),p.useEffect(()=>{},[e])}function DUe(){Ji(),p.useRef(!1),p.useEffect(()=>{},[])}function jfe({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:s,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:h,onSelectionEnd:m,connectionLineType:g,connectionLineStyle:b,connectionLineComponent:y,connectionLineContainerStyle:O,selectionKeyCode:v,selectionOnDrag:x,selectionMode:w,multiSelectionKeyCode:S,panActivationKeyCode:E,zoomActivationKeyCode:k,deleteKeyCode:_,onlyRenderVisibleElements:T,elementsSelectable:C,defaultViewport:A,translateExtent:j,minZoom:M,maxZoom:I,preventScrolling:$,defaultMarkerColor:N,zoomOnScroll:D,zoomOnPinch:Q,panOnScroll:F,panOnScrollSpeed:L,panOnScrollMode:H,zoomOnDoubleClick:z,panOnDrag:B,autoPanOnSelection:V,onPaneClick:W,onPaneMouseEnter:le,onPaneMouseMove:be,onPaneMouseLeave:re,onPaneScroll:q,onPaneContextMenu:G,paneClickDistance:J,nodeClickDistance:de,onEdgeContextMenu:ve,onEdgeMouseEnter:Pe,onEdgeMouseMove:Ae,onEdgeMouseLeave:Ue,reconnectRadius:Ke,onReconnect:Ce,onReconnectStart:Le,onReconnectEnd:pe,noDragClassName:me,noWheelClassName:we,noPanClassName:Ee,disableKeyboardA11y:st,nodeExtent:$e,rfId:ie,viewport:ce,onViewportChange:Ie}){return pX(e),pX(t),DUe(),kUe(n),TUe(ce),o.jsx(WQe,{onPaneClick:W,onPaneMouseEnter:le,onPaneMouseMove:be,onPaneMouseLeave:re,onPaneContextMenu:G,onPaneScroll:q,paneClickDistance:J,deleteKeyCode:_,selectionKeyCode:v,selectionOnDrag:x,selectionMode:w,onSelectionStart:h,onSelectionEnd:m,multiSelectionKeyCode:S,panActivationKeyCode:E,zoomActivationKeyCode:k,elementsSelectable:C,zoomOnScroll:D,zoomOnPinch:Q,zoomOnDoubleClick:z,panOnScroll:F,panOnScrollSpeed:L,panOnScrollMode:H,panOnDrag:B,autoPanOnSelection:V,defaultViewport:A,translateExtent:j,minZoom:M,maxZoom:I,onSelectionContextMenu:f,preventScrolling:$,noDragClassName:me,noWheelClassName:we,noPanClassName:Ee,disableKeyboardA11y:st,onViewportChange:Ie,isControlledViewport:!!ce,children:o.jsxs(EUe,{children:[o.jsx(wUe,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:a,onReconnect:Ce,onReconnectStart:Le,onReconnectEnd:pe,onlyRenderVisibleElements:T,onEdgeContextMenu:ve,onEdgeMouseEnter:Pe,onEdgeMouseMove:Ae,onEdgeMouseLeave:Ue,reconnectRadius:Ke,defaultMarkerColor:N,noPanClassName:Ee,disableKeyboardA11y:st,rfId:ie}),o.jsx(RUe,{style:b,type:g,component:y,containerStyle:O}),o.jsx("div",{className:"react-flow__edgelabel-renderer"}),o.jsx(iUe,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:s,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:de,onlyRenderVisibleElements:T,noPanClassName:Ee,noDragClassName:me,disableKeyboardA11y:st,nodeExtent:$e,rfId:ie}),o.jsx("div",{className:"react-flow__viewport-portal"})]})})}jfe.displayName="GraphView";const PUe=p.memo(jfe),MUe=Nde(),mX=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:a,fitViewOptions:l,minZoom:c=.5,maxZoom:u=2,nodeOrigin:d,nodeExtent:f,zIndexMode:h="basic"}={})=>{const m=new Map,g=new Map,b=new Map,y=new Map,O=r??t??[],v=n??e??[],x=d??[0,0],w=f??Pw;Ude(b,y,O);const{nodesInitialized:S}=j4(v,m,g,{nodeOrigin:x,nodeExtent:w,zIndexMode:h});let E=[0,0,1];if(a&&i&&s){const k=oE(m,{filter:A=>!!((A.width||A.initialWidth)&&(A.height||A.initialHeight))}),{x:_,y:T,zoom:C}=E7(k,i,s,c,u,(l==null?void 0:l.padding)??.1);E=[_,T,C]}return{rfId:"1",width:i??0,height:s??0,transform:E,nodes:v,nodesInitialized:S,nodeLookup:m,parentLookup:g,edges:O,edgeLookup:y,connectionLookup:b,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:Pw,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:i1.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:x,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:l,fitViewResolver:null,connection:{...Ede},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:MUe,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Sde,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},LUe=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h})=>KBe((m,g)=>{async function b(){const{nodeLookup:y,panZoom:O,fitViewOptions:v,fitViewResolver:x,width:w,height:S,minZoom:E,maxZoom:k}=g();O&&(await D7e({nodes:y,width:w,height:S,panZoom:O,minZoom:E,maxZoom:k},v),x==null||x.resolve(!0),m({fitViewResolver:null}))}return{...mX({nodes:e,edges:t,width:i,height:s,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,defaultNodes:n,defaultEdges:r,zIndexMode:h}),setNodes:y=>{const{nodeLookup:O,parentLookup:v,nodeOrigin:x,elevateNodesOnSelect:w,fitViewQueued:S,zIndexMode:E,nodesSelectionActive:k}=g(),{nodesInitialized:_,hasSelectedNodes:T}=j4(y,O,v,{nodeOrigin:x,nodeExtent:f,elevateNodesOnSelect:w,checkEquality:!0,zIndexMode:E}),C=k&&T;S&&_?(b(),m({nodes:y,nodesInitialized:_,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:C})):m({nodes:y,nodesInitialized:_,nodesSelectionActive:C})},setEdges:y=>{const{connectionLookup:O,edgeLookup:v}=g();Ude(O,v,y),m({edges:y})},setDefaultNodesAndEdges:(y,O)=>{if(y){const{setNodes:v}=g();v(y),m({hasDefaultNodes:!0})}if(O){const{setEdges:v}=g();v(O),m({hasDefaultEdges:!0})}},updateNodeInternals:y=>{const{triggerNodeChanges:O,nodeLookup:v,parentLookup:x,domNode:w,nodeOrigin:S,nodeExtent:E,debug:k,fitViewQueued:_,zIndexMode:T}=g(),{changes:C,updatedInternals:A}=rBe(y,v,x,w,S,E,T);A&&(J7e(v,x,{nodeOrigin:S,nodeExtent:E,zIndexMode:T}),_?(b(),m({fitViewQueued:!1,fitViewOptions:void 0})):m({}),(C==null?void 0:C.length)>0&&(k&&console.log("React Flow: trigger node changes",C),O==null||O(C)))},updateNodePositions:(y,O=!1)=>{const v=[];let x=[];const{nodeLookup:w,triggerNodeChanges:S,connection:E,updateConnection:k,onNodesChangeMiddlewareMap:_}=g();for(const[T,C]of y){const A=w.get(T),j=!!(A!=null&&A.expandParent&&(A!=null&&A.parentId)&&(C!=null&&C.position)),M={id:T,type:"position",position:j?{x:Math.max(0,C.position.x),y:Math.max(0,C.position.y)}:C.position,dragging:O};if(A&&E.inProgress&&E.fromNode.id===A.id){const I=Fg(A,E.fromHandle,zt.Left,!0);k({...E,from:I})}j&&A.parentId&&v.push({id:T,parentId:A.parentId,rect:{...C.internals.positionAbsolute,width:C.measured.width??0,height:C.measured.height??0}}),x.push(M)}if(v.length>0){const{parentLookup:T,nodeOrigin:C}=g(),A=j7(v,w,T,C);x.push(...A)}for(const T of _.values())x=T(x);S(x)},triggerNodeChanges:y=>{const{onNodesChange:O,setNodes:v,nodes:x,hasDefaultNodes:w,debug:S}=g();if(y!=null&&y.length){if(w){const E=afe(y,x);v(E)}S&&console.log("React Flow: trigger node changes",y),O==null||O(y)}},triggerEdgeChanges:y=>{const{onEdgesChange:O,setEdges:v,edges:x,hasDefaultEdges:w,debug:S}=g();if(y!=null&&y.length){if(w){const E=ofe(y,x);v(E)}S&&console.log("React Flow: trigger edge changes",y),O==null||O(y)}},addSelectedNodes:y=>{const{multiSelectionActive:O,edgeLookup:v,nodeLookup:x,triggerNodeChanges:w,triggerEdgeChanges:S}=g();if(O){const E=y.map(k=>Vm(k,!0));w(E);return}w(Hb(x,new Set([...y]),!0)),S(Hb(v))},addSelectedEdges:y=>{const{multiSelectionActive:O,edgeLookup:v,nodeLookup:x,triggerNodeChanges:w,triggerEdgeChanges:S}=g();if(O){const E=y.map(k=>Vm(k,!0));S(E);return}S(Hb(v,new Set([...y]))),w(Hb(x,new Set,!0))},unselectNodesAndEdges:({nodes:y,edges:O}={})=>{const{edges:v,nodes:x,nodeLookup:w,triggerNodeChanges:S,triggerEdgeChanges:E}=g(),k=y||x,_=O||v,T=[];for(const A of k){if(!A.selected)continue;const j=w.get(A.id);j&&(j.selected=!1),T.push(Vm(A.id,!1))}const C=[];for(const A of _)A.selected&&C.push(Vm(A.id,!1));S(T),E(C)},setMinZoom:y=>{const{panZoom:O,maxZoom:v}=g();O==null||O.setScaleExtent([y,v]),m({minZoom:y})},setMaxZoom:y=>{const{panZoom:O,minZoom:v}=g();O==null||O.setScaleExtent([v,y]),m({maxZoom:y})},setTranslateExtent:y=>{var O;(O=g().panZoom)==null||O.setTranslateExtent(y),m({translateExtent:y})},resetSelectedElements:()=>{const{edges:y,nodes:O,triggerNodeChanges:v,triggerEdgeChanges:x,elementsSelectable:w}=g();if(!w)return;const S=O.reduce((k,_)=>_.selected?[...k,Vm(_.id,!1)]:k,[]),E=y.reduce((k,_)=>_.selected?[...k,Vm(_.id,!1)]:k,[]);v(S),x(E)},setNodeExtent:y=>{const{nodes:O,nodeLookup:v,parentLookup:x,nodeOrigin:w,elevateNodesOnSelect:S,nodeExtent:E,zIndexMode:k}=g();y[0][0]===E[0][0]&&y[0][1]===E[0][1]&&y[1][0]===E[1][0]&&y[1][1]===E[1][1]||(j4(O,v,x,{nodeOrigin:w,nodeExtent:y,elevateNodesOnSelect:S,checkEquality:!1,zIndexMode:k}),m({nodeExtent:y}))},panBy:y=>{const{transform:O,width:v,height:x,panZoom:w,translateExtent:S}=g();return iBe({delta:y,panZoom:w,transform:O,translateExtent:S,width:v,height:x})},setCenter:async(y,O,v)=>{const{width:x,height:w,maxZoom:S,panZoom:E}=g();if(!E)return!1;const k=typeof(v==null?void 0:v.zoom)<"u"?v.zoom:S;return await E.setViewport({x:x/2-y*k,y:w/2-O*k,zoom:k},{duration:v==null?void 0:v.duration,ease:v==null?void 0:v.ease,interpolate:v==null?void 0:v.interpolate}),!0},cancelConnection:()=>{m({connection:{...Ede}})},updateConnection:y=>{m({connection:y})},reset:()=>m({...mX()})}},Object.is);function Rfe({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:s,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:c,fitView:u,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:m}){const[g]=p.useState(()=>LUe({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:u,minZoom:a,maxZoom:l,fitViewOptions:c,nodeOrigin:d,nodeExtent:f,zIndexMode:h}));return o.jsx(JBe,{value:g,children:o.jsx(EQe,{children:m})})}function $Ue({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:s,height:a,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:m}){return p.useContext(hj)?o.jsx(o.Fragment,{children:e}):o.jsx(Rfe,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:s,initialHeight:a,fitView:l,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:h,zIndexMode:m,children:e})}const BUe={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function QUe({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:s,edgeTypes:a,onNodeClick:l,onEdgeClick:c,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:h,onConnect:m,onConnectStart:g,onConnectEnd:b,onClickConnectStart:y,onClickConnectEnd:O,onNodeMouseEnter:v,onNodeMouseMove:x,onNodeMouseLeave:w,onNodeContextMenu:S,onNodeDoubleClick:E,onNodeDragStart:k,onNodeDrag:_,onNodeDragStop:T,onNodesDelete:C,onEdgesDelete:A,onDelete:j,onSelectionChange:M,onSelectionDragStart:I,onSelectionDrag:$,onSelectionDragStop:N,onSelectionContextMenu:D,onSelectionStart:Q,onSelectionEnd:F,onBeforeDelete:L,connectionMode:H,connectionLineType:z=ip.Bezier,connectionLineStyle:B,connectionLineComponent:V,connectionLineContainerStyle:W,deleteKeyCode:le="Backspace",selectionKeyCode:be="Shift",selectionOnDrag:re=!1,selectionMode:q=Mw.Full,panActivationKeyCode:G="Space",multiSelectionKeyCode:J=Bw()?"Meta":"Control",zoomActivationKeyCode:de=Bw()?"Meta":"Control",snapToGrid:ve,snapGrid:Pe,onlyRenderVisibleElements:Ae=!1,selectNodesOnDrag:Ue,nodesDraggable:Ke,autoPanOnNodeFocus:Ce,nodesConnectable:Le,nodesFocusable:pe,nodeOrigin:me=ife,edgesFocusable:we,edgesReconnectable:Ee,elementsSelectable:st=!0,defaultViewport:$e=fQe,minZoom:ie=.5,maxZoom:ce=2,translateExtent:Ie=Pw,preventScrolling:We=!0,nodeExtent:K,defaultMarkerColor:_e="#b1b1b7",zoomOnScroll:Be=!0,zoomOnPinch:He=!0,panOnScroll:Ye=!1,panOnScrollSpeed:ot=.5,panOnScrollMode:Tt=wg.Free,zoomOnDoubleClick:Ft=!0,panOnDrag:At=!0,onPaneClick:Ge,onPaneMouseEnter:Je,onPaneMouseMove:it,onPaneMouseLeave:Et,onPaneScroll:Ve,onPaneContextMenu:ye,paneClickDistance:Qe=1,nodeClickDistance:rt=0,children:Se,onReconnect:ze,onReconnectStart:ht,onReconnectEnd:_t,onEdgeContextMenu:Nt,onEdgeDoubleClick:rn,onEdgeMouseEnter:an,onEdgeMouseMove:oe,onEdgeMouseLeave:Zt,reconnectRadius:Fe=10,onNodesChange:Rt,onEdgesChange:Te,noDragClassName:bt="nodrag",noWheelClassName:Vt="nowheel",noPanClassName:lt="nopan",fitView:sn,fitViewOptions:yr,connectOnClick:ur,attributionPosition:qe,proOptions:et,defaultEdgeOptions:Yt,elevateNodesOnSelect:en=!0,elevateEdgesOnSelect:dr=!1,disableKeyboardA11y:Cr=!1,autoPanOnConnect:Rn,autoPanOnNodeDrag:Yn,autoPanOnSelection:Lr=!0,autoPanSpeed:Hr,connectionRadius:Zr,isValidConnection:qr,onError:Zn,style:Xr,id:Kr,nodeDragThreshold:Gr,connectionDragThreshold:es,viewport:Jr,onViewportChange:ei,width:ti,height:ta,colorMode:gs="light",debug:di,onScroll:bs,ariaLabelConfig:ts,zIndexMode:Qa="basic",...ss},ya){const Oa=Kr||"1",Bn=gQe(gs),no=p.useCallback(ni=>{ni.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),bs==null||bs(ni)},[bs]);return o.jsx("div",{"data-testid":"rf__wrapper",...ss,onScroll:no,style:{...Xr,...BUe},ref:ya,className:zs(["react-flow",i,Bn]),id:Kr,role:"application",children:o.jsxs($Ue,{nodes:e,edges:t,width:ti,height:ta,fitView:sn,fitViewOptions:yr,minZoom:ie,maxZoom:ce,nodeOrigin:me,nodeExtent:K,zIndexMode:Qa,children:[o.jsx(mQe,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:m,onConnectStart:g,onConnectEnd:b,onClickConnectStart:y,onClickConnectEnd:O,nodesDraggable:Ke,autoPanOnNodeFocus:Ce,nodesConnectable:Le,nodesFocusable:pe,edgesFocusable:we,edgesReconnectable:Ee,elementsSelectable:st,elevateNodesOnSelect:en,elevateEdgesOnSelect:dr,minZoom:ie,maxZoom:ce,nodeExtent:K,onNodesChange:Rt,onEdgesChange:Te,snapToGrid:ve,snapGrid:Pe,connectionMode:H,translateExtent:Ie,connectOnClick:ur,defaultEdgeOptions:Yt,fitView:sn,fitViewOptions:yr,onNodesDelete:C,onEdgesDelete:A,onDelete:j,onNodeDragStart:k,onNodeDrag:_,onNodeDragStop:T,onSelectionDrag:$,onSelectionDragStart:I,onSelectionDragStop:N,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:lt,nodeOrigin:me,rfId:Oa,autoPanOnConnect:Rn,autoPanOnNodeDrag:Yn,autoPanSpeed:Hr,onError:Zn,connectionRadius:Zr,isValidConnection:qr,selectNodesOnDrag:Ue,nodeDragThreshold:Gr,connectionDragThreshold:es,onBeforeDelete:L,debug:di,ariaLabelConfig:ts,zIndexMode:Qa}),o.jsx(PUe,{onInit:u,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:x,onNodeMouseLeave:w,onNodeContextMenu:S,onNodeDoubleClick:E,nodeTypes:s,edgeTypes:a,connectionLineType:z,connectionLineStyle:B,connectionLineComponent:V,connectionLineContainerStyle:W,selectionKeyCode:be,selectionOnDrag:re,selectionMode:q,deleteKeyCode:le,multiSelectionKeyCode:J,panActivationKeyCode:G,zoomActivationKeyCode:de,onlyRenderVisibleElements:Ae,defaultViewport:$e,translateExtent:Ie,minZoom:ie,maxZoom:ce,preventScrolling:We,zoomOnScroll:Be,zoomOnPinch:He,zoomOnDoubleClick:Ft,panOnScroll:Ye,panOnScrollSpeed:ot,panOnScrollMode:Tt,panOnDrag:At,autoPanOnSelection:Lr,onPaneClick:Ge,onPaneMouseEnter:Je,onPaneMouseMove:it,onPaneMouseLeave:Et,onPaneScroll:Ve,onPaneContextMenu:ye,paneClickDistance:Qe,nodeClickDistance:rt,onSelectionContextMenu:D,onSelectionStart:Q,onSelectionEnd:F,onReconnect:ze,onReconnectStart:ht,onReconnectEnd:_t,onEdgeContextMenu:Nt,onEdgeDoubleClick:rn,onEdgeMouseEnter:an,onEdgeMouseMove:oe,onEdgeMouseLeave:Zt,reconnectRadius:Fe,defaultMarkerColor:_e,noDragClassName:bt,noWheelClassName:Vt,noPanClassName:lt,rfId:Oa,disableKeyboardA11y:Cr,nodeExtent:K,viewport:Jr,onViewportChange:ei}),o.jsx(dQe,{onSelectionChange:M}),Se,o.jsx(aQe,{proOptions:et,position:qe}),o.jsx(sQe,{rfId:Oa,disableKeyboardA11y:Cr})]})})}var UUe=lfe(QUe);const FUe=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function zUe({children:e}){const t=wr(FUe);return t?Tr.createPortal(e,t):null}function VUe(e){const[t,n]=p.useState(e),r=p.useCallback(i=>n(s=>afe(i,s)),[]);return[t,n,r]}function HUe(e){const[t,n]=p.useState(e),r=p.useCallback(i=>n(s=>ofe(i,s)),[]);return[t,n,r]}const qUe=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||!k7(n.userNode))return!1;return!0};function XUe(e={includeHiddenNodes:!1}){return wr(qUe(e))}function GUe({dimensions:e,lineWidth:t,variant:n,className:r}){return o.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:zs(["react-flow__background-pattern",n,r])})}function WUe({radius:e,className:t}){return o.jsx("circle",{cx:e,cy:e,r:e,className:zs(["react-flow__background-pattern","dots",t])})}var Ap;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ap||(Ap={}));const YUe={[Ap.Dots]:1,[Ap.Lines]:1,[Ap.Cross]:6},ZUe=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Ife({id:e,variant:t=Ap.Dots,gap:n=20,size:r,lineWidth:i=1,offset:s=0,color:a,bgColor:l,style:c,className:u,patternClassName:d}){const f=p.useRef(null),{transform:h,patternId:m}=wr(ZUe,Ki),g=r||YUe[t],b=t===Ap.Dots,y=t===Ap.Cross,O=Array.isArray(n)?n:[n,n],v=[O[0]*h[2]||1,O[1]*h[2]||1],x=g*h[2],w=Array.isArray(s)?s:[s,s],S=y?[x,x]:v,E=[w[0]*h[2]||1+S[0]/2,w[1]*h[2]||1+S[1]/2],k=`${m}${e||""}`;return o.jsxs("svg",{className:zs(["react-flow__background",u]),style:{...c,...gj,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:f,"data-testid":"rf__background",children:[o.jsx("pattern",{id:k,x:h[0]%v[0],y:h[1]%v[1],width:v[0],height:v[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${E[0]},-${E[1]})`,children:b?o.jsx(WUe,{radius:x/2,className:d}):o.jsx(GUe,{dimensions:S,lineWidth:i,variant:t,className:d})}),o.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${k})`})]})}Ife.displayName="Background";const KUe=p.memo(Ife);function JUe(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:o.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function eFe(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:o.jsx("path",{d:"M0 0h32v4.2H0z"})})}function tFe(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:o.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 nFe(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.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 rFe(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.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 f2({children:e,className:t,...n}){return o.jsx("button",{type:"button",className:zs(["react-flow__controls-button",t]),...n,children:e})}const iFe=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Dfe({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:s,onZoomOut:a,onFitView:l,onInteractiveChange:c,className:u,children:d,position:f="bottom-left",orientation:h="vertical","aria-label":m}){const g=Ji(),{isInteractive:b,minZoomReached:y,maxZoomReached:O,ariaLabelConfig:v}=wr(iFe,Ki),{zoomIn:x,zoomOut:w,fitView:S}=mj(),E=()=>{x(),s==null||s()},k=()=>{w(),a==null||a()},_=()=>{S(i),l==null||l()},T=()=>{g.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),c==null||c(!b)},C=h==="horizontal"?"horizontal":"vertical";return o.jsxs(pj,{className:zs(["react-flow__controls",C,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":m??v["controls.ariaLabel"],children:[t&&o.jsxs(o.Fragment,{children:[o.jsx(f2,{onClick:E,className:"react-flow__controls-zoomin",title:v["controls.zoomIn.ariaLabel"],"aria-label":v["controls.zoomIn.ariaLabel"],disabled:O,children:o.jsx(JUe,{})}),o.jsx(f2,{onClick:k,className:"react-flow__controls-zoomout",title:v["controls.zoomOut.ariaLabel"],"aria-label":v["controls.zoomOut.ariaLabel"],disabled:y,children:o.jsx(eFe,{})})]}),n&&o.jsx(f2,{className:"react-flow__controls-fitview",onClick:_,title:v["controls.fitView.ariaLabel"],"aria-label":v["controls.fitView.ariaLabel"],children:o.jsx(tFe,{})}),r&&o.jsx(f2,{className:"react-flow__controls-interactive",onClick:T,title:v["controls.interactive.ariaLabel"],"aria-label":v["controls.interactive.ariaLabel"],children:b?o.jsx(rFe,{}):o.jsx(nFe,{})}),d]})}Dfe.displayName="Controls";const sFe=p.memo(Dfe);function aFe({id:e,x:t,y:n,width:r,height:i,style:s,color:a,strokeColor:l,strokeWidth:c,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:m}){const{background:g,backgroundColor:b}=s||{},y=a||g||b;return o.jsx("rect",{className:zs(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:d,ry:d,width:r,height:i,style:{fill:y,stroke:l,strokeWidth:c},shapeRendering:f,onClick:m?O=>m(O,e):void 0})}const oFe=p.memo(aFe),lFe=e=>e.nodes.map(t=>t.id),$5=e=>e instanceof Function?e:()=>e;function cFe({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:s=oFe,onClick:a}){const l=wr(lFe,Ki),c=$5(t),u=$5(e),d=$5(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return o.jsx(o.Fragment,{children:l.map(h=>o.jsx(dFe,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:s,onClick:a,shapeRendering:f},h))})}function uFe({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:s,shapeRendering:a,NodeComponent:l,onClick:c}){const{node:u,x:d,y:f,width:h,height:m}=wr(g=>{const b=g.nodeLookup.get(e);if(!b)return{node:void 0,x:0,y:0,width:0,height:0};const y=b.internals.userNode,{x:O,y:v}=b.internals.positionAbsolute,{width:x,height:w}=gh(y);return{node:y,x:O,y:v,width:x,height:w}},Ki);return!u||u.hidden||!k7(u)?null:o.jsx(l,{x:d,y:f,width:h,height:m,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:i,strokeColor:n(u),strokeWidth:s,shapeRendering:a,onClick:c,id:u.id})}const dFe=p.memo(uFe);var fFe=p.memo(cFe);const hFe=200,pFe=150,mFe=e=>!e.hidden,gFe=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?Ade(oE(e.nodeLookup,{filter:mFe}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},bFe="react-flow__minimap-desc";function Pfe({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i="",nodeBorderRadius:s=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:c,maskColor:u,maskStrokeColor:d,maskStrokeWidth:f,position:h="bottom-right",onClick:m,onNodeClick:g,pannable:b=!1,zoomable:y=!1,ariaLabel:O,inversePan:v,zoomStep:x=1,offsetScale:w=5}){const S=Ji(),E=p.useRef(null),{boundingRect:k,viewBB:_,rfId:T,panZoom:C,translateExtent:A,flowWidth:j,flowHeight:M,ariaLabelConfig:I}=wr(gFe,Ki),$=(e==null?void 0:e.width)??hFe,N=(e==null?void 0:e.height)??pFe,D=k.width/$,Q=k.height/N,F=Math.max(D,Q),L=F*$,H=F*N,z=w*F,B=k.x-(L-k.width)/2-z,V=k.y-(H-k.height)/2-z,W=L+z*2,le=H+z*2,be=`${bFe}-${T}`,re=p.useRef(0),q=p.useRef();re.current=F,p.useEffect(()=>{if(E.current&&C)return q.current=hBe({domNode:E.current,panZoom:C,getTransform:()=>S.getState().transform,getViewScale:()=>re.current}),()=>{var ve;(ve=q.current)==null||ve.destroy()}},[C]),p.useEffect(()=>{var ve;(ve=q.current)==null||ve.update({translateExtent:A,width:j,height:M,inversePan:v,pannable:b,zoomStep:x,zoomable:y})},[b,y,v,x,A,j,M]);const G=m?ve=>{var Ue;const[Pe,Ae]=((Ue=q.current)==null?void 0:Ue.pointer(ve))||[0,0];m(ve,{x:Pe,y:Ae})}:void 0,J=g?p.useCallback((ve,Pe)=>{const Ae=S.getState().nodeLookup.get(Pe).internals.userNode;g(ve,Ae)},[]):void 0,de=O??I["minimap.ariaLabel"];return o.jsx(pj,{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:zs(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:o.jsxs("svg",{width:$,height:N,viewBox:`${B} ${V} ${W} ${le}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":be,ref:E,onClick:G,children:[de&&o.jsx("title",{id:be,children:de}),o.jsx(fFe,{onClick:J,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:i,nodeStrokeWidth:a,nodeComponent:l}),o.jsx("path",{className:"react-flow__minimap-mask",d:`M${B-z},${V-z}h${W+z*2}v${le+z*2}h${-W-z*2}z + M${_.x},${_.y}h${_.width}v${_.height}h${-_.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Pfe.displayName="MiniMap";p.memo(Pfe);const yFe=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,OFe={[l1.Line]:"right",[l1.Handle]:"bottom-right"};function xFe({nodeId:e,position:t,variant:n=l1.Handle,className:r,style:i=void 0,children:s,color:a,minWidth:l=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:h,autoScale:m=!0,shouldResize:g,onResizeStart:b,onResize:y,onResizeEnd:O}){const v=ffe(),x=typeof e=="string"?e:v,w=Ji(),S=p.useRef(null),E=n===l1.Handle,k=wr(p.useCallback(yFe(E&&m),[E,m]),Ki),_=p.useRef(null),T=t??OFe[n];p.useEffect(()=>{if(!(!S.current||!x))return _.current||(_.current=_Be({domNode:S.current,nodeId:x,getStoreItems:()=>{const{nodeLookup:A,transform:j,snapGrid:M,snapToGrid:I,nodeOrigin:$,domNode:N}=w.getState();return{nodeLookup:A,transform:j,snapGrid:M,snapToGrid:I,nodeOrigin:$,paneDomNode:N}},onChange:(A,j)=>{const{triggerNodeChanges:M,nodeLookup:I,parentLookup:$,nodeOrigin:N}=w.getState(),D=[],Q={x:A.x,y:A.y},F=I.get(x);if(F&&F.expandParent&&F.parentId){const L=F.origin??N,H=A.width??F.measured.width??0,z=A.height??F.measured.height??0,B={id:F.id,parentId:F.parentId,rect:{width:H,height:z,...jde({x:A.x??F.position.x,y:A.y??F.position.y},{width:H,height:z},F.parentId,I,L)}},V=j7([B],I,$,N);D.push(...V),Q.x=A.x?Math.max(L[0]*H,A.x):void 0,Q.y=A.y?Math.max(L[1]*z,A.y):void 0}if(Q.x!==void 0&&Q.y!==void 0){const L={id:x,type:"position",position:{...Q}};D.push(L)}if(A.width!==void 0&&A.height!==void 0){const H={id:x,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:A.width,height:A.height}};D.push(H)}for(const L of j){const H={...L,type:"position"};D.push(H)}M(D)},onEnd:({width:A,height:j})=>{const M={id:x,type:"dimensions",resizing:!1,dimensions:{width:A,height:j}};w.getState().triggerNodeChanges([M])}})),_.current.update({controlPosition:T,boundaries:{minWidth:l,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:b,onResize:y,onResizeEnd:O,shouldResize:g}),()=>{var A;(A=_.current)==null||A.destroy()}},[T,l,c,u,d,f,b,y,O,g]);const C=T.split("-");return o.jsx("div",{className:zs(["react-flow__resize-control","nodrag",...C,n,r]),ref:S,style:{...i,scale:k,...a&&{[E?"backgroundColor":"borderColor"]:a}},children:s})}p.memo(xFe);var Mfe=Object.defineProperty,vFe=(e,t,n)=>t in e?Mfe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wFe=(e,t)=>{for(var n in t)Mfe(e,n,{get:t[n],enumerable:!0})},SFe=(e,t,n)=>vFe(e,t+"",n),Lfe={};wFe(Lfe,{Graph:()=>Uc,alg:()=>I7,json:()=>Bfe,version:()=>_Fe});var EFe=Object.defineProperty,$fe=(e,t)=>{for(var n in t)EFe(e,n,{get:t[n],enumerable:!0})},Uc=class{constructor(t){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=()=>{},t&&(this._isDirected="directed"in t?t.directed:!0,this._isMultigraph="multigraph"in t?t.multigraph:!1,this._isCompound="compound"in t?t.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return typeof t!="function"?this._defaultNodeLabelFn=()=>t:this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(t=>Object.keys(this._in[t]).length===0)}sinks(){return this.nodes().filter(t=>Object.keys(this._out[t]).length===0)}setNodes(t,n){return t.forEach(r=>{n!==void 0?this.setNode(r,n):this.setNode(r)}),this}setNode(t,n){return t in this._nodes?(arguments.length>1&&(this._nodes[t]=n),this):(this._nodes[t]=arguments.length>1?n:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]="\0",this._children[t]={},this._children["\0"][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return t in this._nodes}removeNode(t){if(t in this._nodes){let n=r=>this.removeEdge(this._edgeObjs[r]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],this.children(t).forEach(r=>{this.setParent(r)}),delete this._children[t]),Object.keys(this._in[t]).forEach(n),delete this._in[t],delete this._preds[t],Object.keys(this._out[t]).forEach(n),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,n){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n===void 0)n="\0";else{n+="";for(let r=n;r!==void 0;r=this.parent(r))if(r===t)throw new Error("Setting "+n+" as parent of "+t+" would create a cycle");this.setNode(n)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=n,this._children[n][t]=!0,this}parent(t){if(this._isCompound){let n=this._parent[t];if(n!=="\0")return n}}children(t="\0"){if(this._isCompound){let n=this._children[t];if(n)return Object.keys(n)}else{if(t==="\0")return this.nodes();if(this.hasNode(t))return[]}return[]}predecessors(t){let n=this._preds[t];if(n)return Object.keys(n)}successors(t){let n=this._sucs[t];if(n)return Object.keys(n)}neighbors(t){let n=this.predecessors(t);if(n){let r=new Set(n);for(let i of this.successors(t))r.add(i);return Array.from(r.values())}}isLeaf(t){let n;return this.isDirected()?n=this.successors(t):n=this.neighbors(t),n.length===0}filterNodes(t){let n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph()),Object.entries(this._nodes).forEach(([s,a])=>{t(s)&&n.setNode(s,a)}),Object.values(this._edgeObjs).forEach(s=>{n.hasNode(s.v)&&n.hasNode(s.w)&&n.setEdge(s,this.edge(s))});let r={},i=s=>{let a=this.parent(s);return!a||n.hasNode(a)?(r[s]=a??void 0,a??void 0):a in r?r[a]:i(a)};return this._isCompound&&n.nodes().forEach(s=>n.setParent(s,i(s))),n}setDefaultEdgeLabel(t){return typeof t!="function"?this._defaultEdgeLabelFn=()=>t:this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(t,n){return t.reduce((r,i)=>(n!==void 0?this.setEdge(r,i,n):this.setEdge(r,i),i)),this}setEdge(t,n,r,i){let s,a,l,c,u=!1;typeof t=="object"&&t!==null&&"v"in t?(s=t.v,a=t.w,l=t.name,arguments.length===2&&(c=n,u=!0)):(s=t,a=n,l=i,arguments.length>2&&(c=r,u=!0)),s=""+s,a=""+a,l!==void 0&&(l=""+l);let d=Vx(this._isDirected,s,a,l);if(d in this._edgeLabels)return u&&(this._edgeLabels[d]=c),this;if(l!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(s),this.setNode(a),this._edgeLabels[d]=u?c:this._defaultEdgeLabelFn(s,a,l);let f=kFe(this._isDirected,s,a,l);return s=f.v,a=f.w,Object.freeze(f),this._edgeObjs[d]=f,gX(this._preds[a],s),gX(this._sucs[s],a),this._in[a][d]=f,this._out[s][d]=f,this._edgeCount++,this}edge(t,n,r){let i=arguments.length===1?B5(this._isDirected,t):Vx(this._isDirected,t,n,r);return this._edgeLabels[i]}edgeAsObj(t,n,r){let i=arguments.length===1?this.edge(t):this.edge(t,n,r);return typeof i!="object"?{label:i}:i}hasEdge(t,n,r){return(arguments.length===1?B5(this._isDirected,t):Vx(this._isDirected,t,n,r))in this._edgeLabels}removeEdge(t,n,r){let i=arguments.length===1?B5(this._isDirected,t):Vx(this._isDirected,t,n,r),s=this._edgeObjs[i];if(s){let a=s.v,l=s.w;delete this._edgeLabels[i],delete this._edgeObjs[i],bX(this._preds[l],a),bX(this._sucs[a],l),delete this._in[l][i],delete this._out[a][i],this._edgeCount--}return this}inEdges(t,n){return this.isDirected()?this.filterEdges(this._in[t],t,n):this.nodeEdges(t,n)}outEdges(t,n){return this.isDirected()?this.filterEdges(this._out[t],t,n):this.nodeEdges(t,n)}nodeEdges(t,n){if(t in this._nodes)return this.filterEdges({...this._in[t],...this._out[t]},t,n)}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}filterEdges(t,n,r){if(!t)return;let i=Object.values(t);return r?i.filter(s=>s.v===n&&s.w===r||s.v===r&&s.w===n):i}};function gX(e,t){e[t]?e[t]++:e[t]=1}function bX(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function Vx(e,t,n,r){let i=""+t,s=""+n;if(!e&&i>s){let a=i;i=s,s=a}return i+""+s+""+(r===void 0?"\0":r)}function kFe(e,t,n,r){let i=""+t,s=""+n;if(!e&&i>s){let l=i;i=s,s=l}let a={v:i,w:s};return r&&(a.name=r),a}function B5(e,t){return Vx(e,t.v,t.w,t.name)}var _Fe="4.0.1",Bfe={};$fe(Bfe,{read:()=>NFe,write:()=>TFe});function TFe(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:CFe(e),edges:AFe(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function CFe(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function AFe(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 NFe(e){let t=new Uc(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 I7={};$fe(I7,{CycleException:()=>BC,bellmanFord:()=>Qfe,components:()=>IFe,dijkstra:()=>$C,dijkstraAll:()=>MFe,findCycles:()=>LFe,floydWarshall:()=>BFe,isAcyclic:()=>UFe,postorder:()=>zFe,preorder:()=>VFe,prim:()=>HFe,shortestPaths:()=>qFe,tarjan:()=>Ffe,topsort:()=>zfe});var jFe=()=>1;function Qfe(e,t,n,r){return RFe(e,String(t),n||jFe,r||function(i){return e.outEdges(i)})}function RFe(e,t,n,r){let i={},s,a=0,l=e.nodes(),c=function(f){let h=n(f);i[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 i=this._arr,s=i.length;return n[r]=s,i.push({key:r,priority:t}),this._decrease(s),!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,i=e;n>1,!(t[r].priority1;function $C(e,t,n,r){let i=function(s){return e.outEdges(s)};return PFe(e,String(t),n||DFe,r||i)}function PFe(e,t,n,r){let i={},s=new Ufe,a,l,c=function(u){let d=u.v!==a?u.v:u.w,f=i[d],h=n(u),m=l.distance+h;if(h<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+h);m0&&(a=s.removeMin(),l=i[a],l.distance!==Number.POSITIVE_INFINITY);)r(a).forEach(c);return i}function MFe(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=$C(e,i,t,n),r},{})}function Ffe(e){let t=0,n=[],r={},i=[];function s(a){let l=r[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(c){c in r?r[c].onStack&&(l.lowlink=Math.min(l.lowlink,r[c].index)):(s(c),l.lowlink=Math.min(l.lowlink,r[c].lowlink))}),l.lowlink===l.index){let c=[],u;do u=n.pop(),r[u].onStack=!1,c.push(u);while(a!==u);i.push(c)}}return e.nodes().forEach(function(a){a in r||s(a)}),i}function LFe(e){return Ffe(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var $Fe=()=>1;function BFe(e,t,n){return QFe(e,t||$Fe,n||function(r){return e.outEdges(r)})}function QFe(e,t,n){let r={},i=e.nodes();return i.forEach(function(s){r[s]={},r[s][s]={distance:0,predecessor:""},i.forEach(function(a){s!==a&&(r[s][a]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(s).forEach(function(a){let l=a.v===s?a.w:a.v,c=t(a);r[s][l]={distance:c,predecessor:s}})}),i.forEach(function(s){let a=r[s];i.forEach(function(l){let c=r[l];i.forEach(function(u){let d=c[s],f=a[u],h=c[u],m=d.distance+f.distance;m{var c;return(c=e.isDirected()?e.successors(l):e.neighbors(l))!=null?c:[]},a={};return t.forEach(function(l){if(!e.hasNode(l))throw new Error("Graph does not have node: "+l);i=Vfe(e,l,n==="post",a,s,r,i)}),i}function Vfe(e,t,n,r,i,s,a){return t in r||(r[t]=!0,n||(a=s(a,t)),i(t).forEach(function(l){a=Vfe(e,l,n,r,i,s,a)}),n&&(a=s(a,t))),a}function Hfe(e,t,n){return FFe(e,t,n,function(r,i){return r.push(i),r},[])}function zFe(e,t){return Hfe(e,t,"post")}function VFe(e,t){return Hfe(e,t,"pre")}function HFe(e,t){let n=new Uc,r={},i=new Ufe,s;function a(c){let u=c.v===s?c.w:c.v,d=i.priority(u);if(d!==void 0){let f=t(c);f0;){if(s=i.removeMin(),s in r)n.setEdge(s,r[s]);else{if(l)throw new Error("Input graph is not connected: "+e);l=!0}e.nodeEdges(s).forEach(a)}return n}function qFe(e,t,n,r){return XFe(e,t,n,r??(i=>{let s=e.outEdges(i);return s??[]}))}function XFe(e,t,n,r){if(n===void 0)return $C(e,t,n,r);let i=!1,s=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},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function qfe(e){let t=new Uc({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 yX(e,t){let n=e.x,r=e.y,i=t.x-n,s=t.y-r,a=e.width/2,l=e.height/2;if(!i&&!s)throw new Error("Not possible to find intersection inside of the rectangle");let c,u;return Math.abs(s)*a>Math.abs(i)*l?(s<0&&(l=-l),c=l*i/s,u=l):(i<0&&(a=-a),c=a,u=a*s/i),{x:n+c,y:r+u}}function uE(e){let t=Uw(Gfe(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i]||(t[i]=[]),t[i][r.order]=n)}),t}function WFe(e){let t=e.nodes().map(r=>{let i=e.node(r).rank;return i===void 0?Number.MAX_VALUE:i}),n=id(Math.min,t);e.nodes().forEach(r=>{let i=e.node(r);Object.hasOwn(i,"rank")&&(i.rank-=n)})}function YFe(e){let t=e.nodes().map(a=>e.node(a).rank).filter(a=>a!==void 0),n=id(Math.min,t),r=[];e.nodes().forEach(a=>{let l=e.node(a).rank-n;r[l]||(r[l]=[]),r[l].push(a)});let i=0,s=e.graph().nodeRankFactor;Array.from(r).forEach((a,l)=>{a===void 0&&l%s!==0?--i:a!==void 0&&i&&a.forEach(c=>e.node(c).rank+=i)})}function OX(e,t,n,r){let i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),eO(e,"border",i,t)}function ZFe(e,t=Xfe){let n=[];for(let r=0;rXfe){let n=ZFe(t);return e(...n.map(r=>e(...r)))}else return e(...t)}function Gfe(e){let t=e.nodes().map(n=>{let r=e.node(n).rank;return r===void 0?Number.MIN_VALUE:r});return id(Math.max,t)}function KFe(e,t){let n={lhs:[],rhs:[]};return e.forEach(r=>{t(r)?n.lhs.push(r):n.rhs.push(r)}),n}function Wfe(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function Yfe(e,t){return t()}var JFe=0;function D7(e){let t=++JFe;return e+(""+t)}function Uw(e,t,n=1){t==null&&(t=e,e=0);let r=s=>str[t]:n=t,Object.entries(e).reduce((r,[i,s])=>(r[i]=n(s,i),r),{})}function eze(e,t){return e.reduce((n,r,i)=>(n[r]=t[i],n),{})}var yj="\0",tze="3.0.0",nze=class{constructor(){SFe(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return xX(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&xX(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,rze)),n=n._prev;return"["+e.join(", ")+"]"}};function xX(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function rze(e,t){if(e!=="_next"&&e!=="_prev")return t}var ize=nze,sze=()=>1;function aze(e,t){if(e.nodeCount()<=1)return[];let n=lze(e,t||sze);return oze(n.graph,n.buckets,n.zeroIdx).flatMap(r=>e.outEdges(r.v,r.w)||[])}function oze(e,t,n){var r;let i=[],s=t[t.length-1],a=t[0],l;for(;e.nodeCount();){for(;l=a.dequeue();)Q5(e,t,n,l);for(;l=s.dequeue();)Q5(e,t,n,l);if(e.nodeCount()){for(let c=t.length-2;c>0;--c)if(l=(r=t[c])==null?void 0:r.dequeue(),l){i=i.concat(Q5(e,t,n,l,!0)||[]);break}}}return i}function Q5(e,t,n,r,i){let s=[],a=i?s:void 0;return(e.inEdges(r.v)||[]).forEach(l=>{let c=e.edge(l),u=e.node(l.v);i&&s.push({v:l.v,w:l.w}),u.out-=c,D4(t,n,u)}),(e.outEdges(r.v)||[]).forEach(l=>{let c=e.edge(l),u=l.w,d=e.node(u);d.in-=c,D4(t,n,d)}),e.removeNode(r.v),a}function lze(e,t){let n=new Uc,r=0,i=0;e.nodes().forEach(l=>{n.setNode(l,{v:l,in:0,out:0})}),e.edges().forEach(l=>{let c=n.edge(l.v,l.w)||0,u=t(l),d=c+u;n.setEdge(l.v,l.w,d);let f=n.node(l.v),h=n.node(l.w);i=Math.max(i,f.out+=u),r=Math.max(r,h.in+=u)});let s=cze(i+r+3).map(()=>new ize),a=r+1;return n.nodes().forEach(l=>{D4(s,a,n.node(l))}),{graph:n,buckets:s,zeroIdx:a}}function D4(e,t,n){var r,i,s;n.out?n.in?(s=e[n.out-n.in+t])==null||s.enqueue(n):(i=e[e.length-1])==null||i.enqueue(n):(r=e[0])==null||r.enqueue(n)}function cze(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,D7("rev"))});function t(n){return r=>n.edge(r).weight}}function dze(e){let t=[],n={},r={};function i(s){Object.hasOwn(r,s)||(r[s]=!0,n[s]=!0,e.outEdges(s).forEach(a=>{Object.hasOwn(n,a.w)?t.push(a):i(a.w)}),delete n[s])}return e.nodes().forEach(i),t}function fze(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 hze(e){e.graph().dummyChains=[],e.edges().forEach(t=>pze(e,t))}function pze(e,t){let n=t.v,r=e.node(n).rank,i=t.w,s=e.node(i).rank,a=t.name,l=e.edge(t),c=l.labelRank;if(s===r+1)return;e.removeEdge(t);let u,d,f;for(f=0,++r;r{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=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=i,n=e.node(t)})}function P7(e){let t={};function n(r){let i=e.node(r);if(Object.hasOwn(t,r))return i.rank;t[r]=!0;let s=e.outEdges(r),a=s?s.map(c=>c==null?Number.POSITIVE_INFINITY:n(c.w)-e.edge(c).minlen):[],l=id(Math.min,a);return l===Number.POSITIVE_INFINITY&&(l=0),i.rank=l}e.sources().forEach(n)}function u1(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var Zfe=gze;function gze(e){let t=new Uc({directed:!1}),n=e.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let r=n[0],i=e.nodeCount();t.setNode(r,{});let s,a;for(;bze(t,e){let a=s.v,l=r===a?s.w:a;!e.hasNode(l)&&!u1(t,s)&&(e.setNode(l,{}),e.setEdge(r,l,{}),n(l))})}return e.nodes().forEach(n),e.nodeCount()}function yze(e,t){return t.edges().reduce((n,r)=>{let i=Number.POSITIVE_INFINITY;return e.hasNode(r.v)!==e.hasNode(r.w)&&(i=u1(t,r)),it.node(r).rank+=n)}var{preorder:xze,postorder:vze}=I7,wze=p0;p0.initLowLimValues=L7;p0.initCutValues=M7;p0.calcCutValue=Kfe;p0.leaveEdge=ehe;p0.enterEdge=the;p0.exchangeEdges=nhe;function p0(e){e=GFe(e),P7(e);let t=Zfe(e);L7(t),M7(t,e);let n,r;for(;n=ehe(t);)r=the(t,e,n),nhe(t,e,n,r)}function M7(e,t){let n=vze(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(r=>Sze(e,t,r))}function Sze(e,t,n){let r=e.node(n).parent,i=e.edge(n,r);i.cutvalue=Kfe(e,t,n)}function Kfe(e,t,n){let r=e.node(n).parent,i=!0,s=t.edge(n,r),a=0;s||(i=!1,s=t.edge(r,n)),a=s.weight;let l=t.nodeEdges(n);return l&&l.forEach(c=>{let u=c.v===n,d=u?c.w:c.v;if(d!==r){let f=u===i,h=t.edge(c).weight;if(a+=f?h:-h,kze(e,n,d)){let m=e.edge(n,d).cutvalue;a+=f?-m:m}}}),a}function L7(e,t){arguments.length<2&&(t=e.nodes()[0]),Jfe(e,{},1,t)}function Jfe(e,t,n,r,i){let s=n,a=e.node(r);t[r]=!0;let l=e.neighbors(r);return l&&l.forEach(c=>{Object.hasOwn(t,c)||(n=Jfe(e,t,n,c,r))}),a.low=s,a.lim=n++,i?a.parent=i:delete a.parent,n}function ehe(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function the(e,t,n){let r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);let s=e.node(r),a=e.node(i),l=s,c=!1;return s.lim>a.lim&&(l=a,c=!0),t.edges().filter(u=>c===vX(e,e.node(u.v),l)&&c!==vX(e,e.node(u.w),l)).reduce((u,d)=>u1(t,d)!e.node(i).parent);if(!n)return;let r=xze(e,[n]);r=r.slice(1),r.forEach(i=>{let s=e.node(i).parent,a=t.edge(i,s),l=!1;a||(a=t.edge(s,i),l=!0),t.node(i).rank=t.node(s).rank+(l?a.minlen:-a.minlen)})}function kze(e,t,n){return e.hasEdge(t,n)}function vX(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var _ze=Tze;function Tze(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":wX(e);break;case"tight-tree":Aze(e);break;case"longest-path":Cze(e);break;case"none":break;default:wX(e)}}var Cze=P7;function Aze(e){P7(e),Zfe(e)}function wX(e){wze(e)}var Nze=jze;function jze(e){let t=Ize(e);e.graph().dummyChains.forEach(n=>{let r=e.node(n),i=r.edgeObj,s=Rze(e,t,i.v,i.w),a=s.path,l=s.lca,c=0,u=a[c],d=!0;for(;n!==i.w;){if(r=e.node(n),d){for(;(u=a[c])!==l&&e.node(u).maxRanka||l>t[c].lim));let u=c,d=r;for(;(d=e.parent(d))!==u;)s.push(d);return{path:i.concat(s.reverse()),lca:u}}function Ize(e){let t={},n=0;function r(i){let s=n;e.children(i).forEach(r),t[i]={low:s,lim:n++}}return e.children(yj).forEach(r),t}function Dze(e){let t=eO(e,"root",{},"_root"),n=Pze(e),r=Object.values(n),i=id(Math.max,r)-1,s=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(l=>e.edge(l).minlen*=s);let a=Mze(e)+1;e.children(yj).forEach(l=>rhe(e,t,s,a,i,n,l)),e.graph().nodeRankFactor=s}function rhe(e,t,n,r,i,s,a){var l;let c=e.children(a);if(!c.length){a!==t&&e.setEdge(t,a,{weight:0,minlen:n});return}let u=OX(e,"_bt"),d=OX(e,"_bb"),f=e.node(a);e.setParent(u,a),f.borderTop=u,e.setParent(d,a),f.borderBottom=d,c.forEach(h=>{var m;rhe(e,t,n,r,i,s,h);let g=e.node(h),b=g.borderTop?g.borderTop:h,y=g.borderBottom?g.borderBottom:h,O=g.borderTop?r:2*r,v=b!==y?1:i-((m=s[a])!=null?m:0)+1;e.setEdge(u,b,{weight:O,minlen:v,nestingEdge:!0}),e.setEdge(y,d,{weight:O,minlen:v,nestingEdge:!0})}),e.parent(a)||e.setEdge(t,u,{weight:0,minlen:i+((l=s[a])!=null?l:0)})}function Pze(e){let t={};function n(r,i){let s=e.children(r);s&&s.length&&s.forEach(a=>n(a,i+1)),t[r]=i}return e.children(yj).forEach(r=>n(r,1)),t}function Mze(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function Lze(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var $ze=Bze;function Bze(e){function t(n){let r=e.children(n),i=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(let s=i.minRank,a=i.maxRank+1;sEX(e.node(t))),e.edges().forEach(t=>EX(e.edge(t)))}function EX(e){let t=e.width;e.width=e.height,e.height=t}function Fze(e){e.nodes().forEach(t=>U5(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(U5),Object.hasOwn(r,"y")&&U5(r)})}function U5(e){e.y=-e.y}function zze(e){e.nodes().forEach(t=>F5(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(F5),Object.hasOwn(r,"x")&&F5(r)})}function F5(e){let t=e.x;e.x=e.y,e.y=t}function Vze(e){let t={},n=e.nodes().filter(l=>!e.children(l).length),r=n.map(l=>e.node(l).rank),i=id(Math.max,r),s=Uw(i+1).map(()=>[]);function a(l){if(t[l])return;t[l]=!0;let c=e.node(l);s[c.rank].push(l);let u=e.successors(l);u&&u.forEach(a)}return n.sort((l,c)=>e.node(l).rank-e.node(c).rank).forEach(a),s}function Hze(e,t){let n=0;for(let r=1;rd)),i=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):[]}),s=1;for(;s{let d=u.pos+s;l[d]+=u.weight;let f=0;for(;d>0;)d%2&&(f+=l[d+1]),d=d-1>>1,l[d]+=u.weight;c+=u.weight*f}),c}function Xze(e,t=[]){return t.map(n=>{let r=e.inEdges(n);if(!r||!r.length)return{v:n};{let i=r.reduce((s,a)=>{let l=e.edge(a),c=e.node(a.v);return{sum:s.sum+l.weight*c.order,weight:s.weight+l.weight}},{sum:0,weight:0});return{v:n,barycenter:i.sum/i.weight,weight:i.weight}}})}function Gze(e,t){let n={};e.forEach((i,s)=>{let a={indegree:0,in:[],out:[],vs:[i.v],i:s};i.barycenter!==void 0&&(a.barycenter=i.barycenter,a.weight=i.weight),n[i.v]=a}),t.edges().forEach(i=>{let s=n[i.v],a=n[i.w];s!==void 0&&a!==void 0&&(a.indegree++,s.out.push(a))});let r=Object.values(n).filter(i=>!i.indegree);return Wze(r)}function Wze(e){let t=[];function n(i){return s=>{s.merged||(s.barycenter===void 0||i.barycenter===void 0||s.barycenter>=i.barycenter)&&Yze(i,s)}}function r(i){return s=>{s.in.push(i),--s.indegree===0&&e.push(s)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(n(i)),i.out.forEach(r(i))}return t.filter(i=>!i.merged).map(i=>QC(i,["vs","i","barycenter","weight"]))}function Yze(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 Zze(e,t){let n=KFe(e,d=>Object.hasOwn(d,"barycenter")),r=n.lhs,i=n.rhs.sort((d,f)=>f.i-d.i),s=[],a=0,l=0,c=0;r.sort(Kze(!!t)),c=kX(s,i,c),r.forEach(d=>{c+=d.vs.length,s.push(d.vs),a+=d.barycenter*d.weight,l+=d.weight,c=kX(s,i,c)});let u={vs:s.flat(1)};return l&&(u.barycenter=a/l,u.weight=l),u}function kX(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 Kze(e){return(t,n)=>t.barycentern.barycenter?1:e?n.i-t.i:t.i-n.i}function she(e,t,n,r){let i=e.children(t),s=e.node(t),a=s?s.borderLeft:void 0,l=s?s.borderRight:void 0,c={};a&&(i=i.filter(h=>h!==a&&h!==l));let u=Xze(e,i);u.forEach(h=>{if(e.children(h.v).length){let m=she(e,h.v,n,r);c[h.v]=m,Object.hasOwn(m,"barycenter")&&eVe(h,m)}});let d=Gze(u,n);Jze(d,c);let f=Zze(d,r);if(a&&l){f.vs=[a,f.vs,l].flat(1);let h=e.predecessors(a);if(h&&h.length){let m=e.node(h[0]),g=e.predecessors(l),b=e.node(g[0]);Object.hasOwn(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+m.order+b.order)/(f.weight+2),f.weight+=2}}return f}function Jze(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(r=>t[r]?t[r].vs:r)})}function eVe(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 tVe(e,t,n,r){r||(r=e.nodes());let i=nVe(e),s=new Uc({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(a=>e.node(a));return r.forEach(a=>{let l=e.node(a),c=e.parent(a);if(l.rank===t||l.minRank<=t&&t<=l.maxRank){s.setNode(a),s.setParent(a,c||i);let u=e[n](a);u&&u.forEach(d=>{let f=d.v===a?d.w:d.v,h=s.edge(f,a),m=h!==void 0?h.weight:0;s.setEdge(f,a,{weight:e.edge(d).weight+m})}),Object.hasOwn(l,"minRank")&&s.setNode(a,{borderLeft:l.borderLeft[t],borderRight:l.borderRight[t]})}}),s}function nVe(e){let t;for(;e.hasNode(t=D7("_root")););return t}function rVe(e,t,n){let r={},i;n.forEach(s=>{let a=e.parent(s),l,c;for(;a;){if(l=e.parent(a),l?(c=r[l],r[l]=a):(c=i,i=a),c&&c!==a){t.setEdge(c,a);return}a=l}})}function ahe(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,ahe);return}let n=Gfe(e),r=_X(e,Uw(1,n+1),"inEdges"),i=_X(e,Uw(n-1,-1,-1),"outEdges"),s=Vze(e);if(TX(e,s),t.disableOptimalOrderHeuristic)return;let a=Number.POSITIVE_INFINITY,l,c=t.constraints||[];for(let u=0,d=0;d<4;++u,++d){iVe(u%2?r:i,u%4>=2,c),s=uE(e);let f=Hze(e,s);f{r.has(s)||r.set(s,[]),r.get(s).push(a)};for(let s of e.nodes()){let a=e.node(s);if(typeof a.rank=="number"&&i(a.rank,s),typeof a.minRank=="number"&&typeof a.maxRank=="number")for(let l=a.minRank;l<=a.maxRank;l++)l!==a.rank&&i(l,s)}return t.map(function(s){return tVe(e,s,n,r.get(s)||[])})}function iVe(e,t,n){let r=new Uc;e.forEach(function(i){n.forEach(l=>r.setEdge(l.left,l.right));let s=i.graph().root,a=she(i,s,r,t);a.vs.forEach((l,c)=>i.node(l).order=c),rVe(i,r,a.vs)})}function TX(e,t){Object.values(t).forEach(n=>n.forEach((r,i)=>e.node(r).order=i))}function sVe(e,t){let n={};function r(i,s){let a=0,l=0,c=i.length,u=s[s.length-1];return s.forEach((d,f)=>{let h=oVe(e,d),m=h?e.node(h).order:c;(h||d===u)&&(s.slice(l,f+1).forEach(g=>{let b=e.predecessors(g);b&&b.forEach(y=>{let O=e.node(y),v=O.order;(v{let f=s[d];if(f!==void 0&&e.node(f).dummy){let h=e.predecessors(f);h&&h.forEach(m=>{if(m===void 0)return;let g=e.node(m);g.dummy&&(g.orderu)&&ohe(n,m,f)})}})}function i(s,a){let l=-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 m=h[0];if(m===void 0)return;c=e.node(m).order,r(a,u,f,l,c),u=f,l=c}}r(a,u,a.length,c,s.length)}),a}return t.length&&t.reduce(i),n}function oVe(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(r=>e.node(r).dummy)}}function ohe(e,t,n){if(t>n){let i=t;t=n,n=i}let r=e[t];r||(e[t]=r={}),r[n]=!0}function lVe(e,t,n){if(t>n){let i=t;t=n,n=i}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function cVe(e,t,n,r){let i={},s={},a={};return t.forEach(l=>{l.forEach((c,u)=>{i[c]=c,s[c]=c,a[c]=u})}),t.forEach(l=>{let c=-1;l.forEach(u=>{let d=r(u);if(d&&d.length){let f=d.sort((m,g)=>{let b=a[m],y=a[g];return(b!==void 0?b:0)-(y!==void 0?y:0)}),h=(f.length-1)/2;for(let m=Math.floor(h),g=Math.ceil(h);m<=g;++m){let b=f[m];if(b===void 0)continue;let y=a[b];if(y!==void 0&&s[u]===u&&c{var O;let v=(O=s[y.v])!=null?O:0,x=a.edge(y);return Math.max(b,v+(x!==void 0?x:0))},0):s[m]=0}function d(m){let g=a.outEdges(m),b=Number.POSITIVE_INFINITY;g&&(b=g.reduce((O,v)=>{let x=s[v.w],w=a.edge(v);return Math.min(O,(x!==void 0?x:0)-(w!==void 0?w:0))},Number.POSITIVE_INFINITY));let y=e.node(m);b!==Number.POSITIVE_INFINITY&&y.borderType!==l&&(s[m]=Math.max(s[m]!==void 0?s[m]:0,b))}function f(m){return a.predecessors(m)||[]}function h(m){return a.successors(m)||[]}return c(u,f),c(d,h),Object.keys(r).forEach(m=>{var g;let b=n[m];b!==void 0&&(s[m]=(g=s[b])!=null?g:0)}),s}function dVe(e,t,n,r){let i=new Uc,s=e.graph(),a=gVe(s.nodesep,s.edgesep,r);return t.forEach(l=>{let c;l.forEach(u=>{let d=n[u];if(d!==void 0){if(i.setNode(d),c!==void 0){let f=n[c];if(f!==void 0){let h=i.edge(f,d);i.setEdge(f,d,Math.max(a(e,u,c),h||0))}}c=u}})}),i}function fVe(e,t){return Object.values(t).reduce((n,r)=>{let i=Number.NEGATIVE_INFINITY,s=Number.POSITIVE_INFINITY;Object.entries(r).forEach(([l,c])=>{let u=bVe(e,l)/2;i=Math.max(c+u,i),s=Math.min(c-u,s)});let a=i-s;return a{["l","r"].forEach(a=>{let l=s+a,c=e[l];if(!c||c===t)return;let u=Object.values(c),d=r-id(Math.min,u);a!=="l"&&(d=i-id(Math.max,u)),d&&(e[l]=bj(c,f=>f+d))})})}function pVe(e,t=void 0){let n=e.ul;return n?bj(n,(r,i)=>{var s,a;if(t){let c=t.toLowerCase(),u=e[c];if(u&&u[i]!==void 0)return u[i]}let l=Object.values(e).map(c=>{let u=c[i];return u!==void 0?u:0}).sort((c,u)=>c-u);return(((s=l[1])!=null?s:0)+((a=l[2])!=null?a:0))/2}):{}}function mVe(e){let t=uE(e),n=Object.assign(sVe(e,t),aVe(e,t)),r={},i;["u","d"].forEach(a=>{i=a==="u"?t:Object.values(t).reverse(),["l","r"].forEach(l=>{l==="r"&&(i=i.map(d=>Object.values(d).reverse()));let c=cVe(e,i,n,d=>(a==="u"?e.predecessors(d):e.successors(d))||[]),u=uVe(e,i,c.root,c.align,l==="r");l==="r"&&(u=bj(u,d=>-d)),r[a+l]=u})});let s=fVe(e,r);return hVe(r,s),pVe(r,e.graph().align)}function gVe(e,t,n){return(r,i,s)=>{let a=r.node(i),l=r.node(s),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+=(l.dummy?t:e)/2,c+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":u=l.width/2;break;case"r":u=-l.width/2;break}return u&&(c+=n?u:-u),c}}function bVe(e,t){return e.node(t).width}function yVe(e){e=qfe(e),OVe(e),Object.entries(mVe(e)).forEach(([t,n])=>e.node(t).x=n)}function OVe(e){let t=uE(e),n=e.graph(),r=n.ranksep,i=n.rankalign,s=0;t.forEach(a=>{let l=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);i==="top"?u.y=s+u.height/2:i==="bottom"?u.y=s+l-u.height/2:u.y=s+l/2}),s+=l+r})}function xVe(e,t={}){let n=t.debugTiming?Wfe:Yfe;return n("layout",()=>{let r=n(" buildLayoutGraph",()=>NVe(e));return n(" runLayout",()=>vVe(r,n,t)),n(" updateInputGraph",()=>wVe(e,r)),r})}function vVe(e,t,n){t(" makeSpaceForEdgeLabels",()=>jVe(e)),t(" removeSelfEdges",()=>QVe(e)),t(" acyclic",()=>uze(e)),t(" nestingGraph.run",()=>Dze(e)),t(" rank",()=>_ze(qfe(e))),t(" injectEdgeLabelProxies",()=>RVe(e)),t(" removeEmptyRanks",()=>YFe(e)),t(" nestingGraph.cleanup",()=>Lze(e)),t(" normalizeRanks",()=>WFe(e)),t(" assignRankMinMax",()=>IVe(e)),t(" removeEdgeLabelProxies",()=>DVe(e)),t(" normalize.run",()=>hze(e)),t(" parentDummyChains",()=>Nze(e)),t(" addBorderSegments",()=>$ze(e)),t(" order",()=>ahe(e,n)),t(" insertSelfEdges",()=>UVe(e)),t(" adjustCoordinateSystem",()=>Qze(e)),t(" position",()=>yVe(e)),t(" positionSelfEdges",()=>FVe(e)),t(" removeBorderNodes",()=>BVe(e)),t(" normalize.undo",()=>mze(e)),t(" fixupEdgeLabelCoords",()=>LVe(e)),t(" undoCoordinateSystem",()=>Uze(e)),t(" translateGraph",()=>PVe(e)),t(" assignNodeIntersects",()=>MVe(e)),t(" reversePoints",()=>$Ve(e)),t(" acyclic.undo",()=>fze(e))}function wVe(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.order=i.order,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,"x")&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var SVe=["nodesep","edgesep","ranksep","marginx","marginy"],EVe={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},kVe=["acyclicer","ranker","rankdir","align","rankalign"],_Ve=["width","height","rank"],CX={width:0,height:0},TVe=["minlen","weight","width","height","labeloffset"],CVe={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},AVe=["labelpos"];function NVe(e){let t=new Uc({multigraph:!0,compound:!0}),n=V5(e.graph());return t.setGraph(Object.assign({},EVe,z5(n,SVe),QC(n,kVe))),e.nodes().forEach(r=>{let i=V5(e.node(r)),s=z5(i,_Ve);Object.keys(CX).forEach(l=>{s[l]===void 0&&(s[l]=CX[l])}),t.setNode(r,s);let a=e.parent(r);a!==void 0&&t.setParent(r,a)}),e.edges().forEach(r=>{let i=V5(e.edge(r));t.setEdge(r,Object.assign({},CVe,z5(i,TVe),QC(i,AVe)))}),t}function jVe(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 RVe(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let r=e.node(t.v),i={rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t};eO(e,"edge-proxy",i,"_ep")}})}function IVe(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 DVe(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 PVe(e){let t=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,i=0,s=e.graph(),a=s.marginx||0,l=s.marginy||0;function c(u){let d=u.x,f=u.y,h=u.width,m=u.height;t=Math.min(t,d-h/2),n=Math.max(n,d+h/2),r=Math.min(r,f-m/2),i=Math.max(i,f+m/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-=l,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)}),s.width=n-t+a,s.height=i-r+l}function MVe(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),s,a;n.points?(s=n.points[0],a=n.points[n.points.length-1]):(n.points=[],s=i,a=r),n.points.unshift(yX(r,s)),n.points.push(yX(i,a))})}function LVe(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 $Ve(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function BVe(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),s=e.node(n.borderLeft[n.borderLeft.length-1]),a=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(a.x-s.x),n.height=Math.abs(i.y-r.y),n.x=s.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function QVe(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 UVe(e){uE(e).forEach(t=>{let n=0;t.forEach((r,i)=>{let s=e.node(r);s.order=i+n,(s.selfEdges||[]).forEach(a=>{eO(e,"selfedge",{width:a.label.width,height:a.label.height,rank:s.rank,order:i+ ++n,e:a.e,label:a.label},"_se")}),delete s.selfEdges})})}function FVe(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="selfedge"){let r=n,i=e.node(r.e.v),s=i.x+i.width/2,a=i.y,l=n.x-s,c=i.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:s+2*l/3,y:a-c},{x:s+5*l/6,y:a-c},{x:s+l,y:a},{x:s+5*l/6,y:a+c},{x:s+2*l/3,y:a+c}],r.label.x=n.x,r.label.y=n.y}})}function z5(e,t){return bj(QC(e,t),Number)}function V5(e){let t={};return e&&Object.entries(e).forEach(([n,r])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=r}),t}function zVe(e){let t=uE(e),n=new Uc({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,i)=>{let s="layer"+i;n.setNode(s,{rank:"same"}),r.reduce((a,l)=>(n.setEdge(a,l,{style:"invis"}),l))}),n}var VVe={graphlib:Lfe,version:tze,layout:xVe,debug:zVe,util:{time:Wfe,notime:Yfe}},AX=VVe;/*! For license information please see dagre.esm.js.LEGAL.txt */const Hx={llm:{label:"智能体",description:"理解任务并直接完成一个具体工作",icon:Iae},sequential:{label:"分步协作",description:"内部步骤按照顺序依次执行",icon:YRe},parallel:{label:"同时处理",description:"内部步骤同时工作,完成后统一汇总",icon:NRe},loop:{label:"循环执行",description:"重复执行内部步骤,直到满足停止条件",icon:Bae},a2a:{label:"远程智能体",description:"调用已经存在的远程 Agent",icon:jN}},P4=220,M4=88,NX=96,jX=34,Nv=64,H5=310,qb=24,lhe=56,L4=40,RX=40,HVe=18,qVe=58,XVe=!1,GVe=e=>e==="sequential"||e==="parallel"||e==="loop";function $4(e,t){const n=e.agentType??"llm";return GVe(n)||n==="llm"&&(t.length===0||e.subAgents.length>0)}function B4(e,t=[],n="horizontal",r=!1){const i=e.agentType??"llm";if(!$4(e,t))return{width:P4,height:M4};if(r&&e.subAgents.length===0)return{width:H5,height:Nv};const s=e.subAgents.map((f,h)=>B4(f,[...t,h],n,r)),a=s.length?Math.max(...s.map(f=>f.width)):0,l=s.length?Math.max(...s.map(f=>f.height)):0,c=s.length&&i!=="parallel"?lhe:qb,u=n==="horizontal"?i!=="parallel":i==="parallel",d=s.length?i==="parallel"?HVe+RX:i==="loop"?qVe:0:RX;return u?{width:Math.max(H5,s.reduce((f,h)=>f+h.width,0)+L4*Math.max(0,s.length-1)+c*2),height:Nv+qb+l+d+qb}:{width:Math.max(H5,a+qb*2),height:Nv+c+s.reduce((f,h)=>f+h.height,0)+L4*Math.max(0,s.length-1)+d+c}}function rx(e){return e.length===0?"agent-root":`agent-${e.join("-")}`}function WVe(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function IX(e){const t=n=>[n.agentType??"llm",n.subAgents.map(t)];return JSON.stringify(t(e))}function ix(e,t,n,r){const i=(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:Lw.ArrowClosed,width:16,height:16,color:i},style:{stroke:i,strokeWidth:1.5},labelStyle:{fill:"hsl(215 14% 42%)",fontSize:10,fontWeight:600},labelBgStyle:{fill:"hsl(var(--background))",fillOpacity:.92}}}function DX(e,t,n=!1){const r=[{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}],i=[];function s(d,f,h,m,g){const b=d.agentType??"llm",y=rx(f);return $4(d,f)?(a(d,f,h,m,g),y):(r.push({id:y,type:"agent",parentId:h,extent:"parent",position:m,data:{kind:"agent",path:f,agent:d,title:b==="a2a"?"远程智能体":d.name.trim()||(f.length===0?"主 Agent":"未命名步骤"),pattern:b,description:d.description.trim()||Hx[b].description,childCount:d.subAgents.length,containedIn:g}}),y)}function a(d,f,h,m={x:0,y:0},g){const b=d.agentType??"sequential",y=rx(f),O=B4(d,f,t,n);r.push({id:y,type:"group",parentId:h,extent:h?"parent":void 0,position:m,style:{width:O.width,height:O.height},data:{kind:"agent",path:f,agent:d,title:d.name.trim()||(f.length===0?"主 Agent":Hx[b].label),pattern:b,description:d.description.trim()||Hx[b].description,childCount:d.subAgents.length,containedIn:g,layoutWidth:O.width,layoutHeight:O.height,compactEmptyGroup:n&&d.subAgents.length===0}});const v=d.subAgents.map((k,_)=>B4(k,[...f,_],t,n)),x=v.length&&b!=="parallel"?lhe:qb,w=t==="horizontal"?b!=="parallel":b==="parallel";let S=x;const E=d.subAgents.map((k,_)=>{const T=v[_],C=w?{x:S,y:Nv+qb}:{x:(O.width-T.width)/2,y:Nv+S};return S+=(w?T.width:T.height)+L4,s(k,[...f,_],y,C,b)});if(b==="sequential"||b==="loop"){for(let k=0;k1&&i.push(ix(E[E.length-1],E[0],"继续循环",{loop:!0,tone:"loop"}))}return y}const l=(d,f)=>{const h=d.agentType??"llm",m=rx(f);if($4(d,f))return a(d,f),[m];if(r.push({id:m,type:"agent",position:{x:0,y:0},data:{kind:"agent",path:f,agent:d,title:h==="a2a"?"远程智能体":d.name.trim()||(f.length===0?"主 Agent":"未命名步骤"),pattern:h,description:d.description.trim()||Hx[h].description,childCount:d.subAgents.length}}),d.subAgents.length===0)return[m];const g=[];return d.subAgents.forEach((b,y)=>{const O=[...f,y],v=rx(O);i.push(ix(m,v,"调用",{insert:{parentPath:f,index:y}})),g.push(...l(b,O))}),g},c=rx([]),u=l(e,[]);return i.push(ix("terminal-input",c)),u.forEach(d=>i.push(ix(d,"terminal-output"))),YVe(r,i,t)}function YVe(e,t,n){const r=new AX.graphlib.Graph().setDefaultEdgeLabel(()=>({}));r.setGraph({rankdir:n==="vertical"?"TB":"LR",ranksep:50,nodesep:34,edgesep:14,marginx:24,marginy:24});const i=new Set(e.filter(s=>!s.parentId).map(s=>s.id));return e.filter(s=>!s.parentId).forEach(s=>{const a=s.data.kind==="terminal";r.setNode(s.id,{width:a?NX:s.data.layoutWidth??P4,height:a?jX:s.data.layoutHeight??M4})}),t.filter(s=>i.has(s.source)&&i.has(s.target)).forEach(s=>r.setEdge(s.source,s.target)),AX.layout(r),{nodes:e.map(s=>{if(s.parentId)return s;const a=r.node(s.id),l=s.data.kind==="terminal",c=l?NX:s.data.layoutWidth??P4,u=l?jX:s.data.layoutHeight??M4;return{...s,position:{x:a.x-c/2,y:a.y-u/2}}}),edges:t}}const Oj=p.createContext(null),xj=p.createContext("horizontal");function ZVe({id:e,sourceX:t,sourceY:n,targetX:r,targetY:i,sourcePosition:s,targetPosition:a,markerEnd:l,style:c,label:u,data:d}){const f=p.useContext(Oj),[h,m]=p.useState(!1),[g,b,y]=MC({sourceX:t,sourceY:n,targetX:r,targetY:i,sourcePosition:s,targetPosition:a,offset:d!=null&&d.loop?28:20});return o.jsxs(o.Fragment,{children:[o.jsx(cE,{id:e,path:g,markerEnd:l,style:c}),f&&(d==null?void 0:d.insert)&&o.jsx("path",{d:g,className:"abc-edge-hover-path",onPointerEnter:()=>m(!0),onPointerLeave:()=>m(!1)}),(u||f&&(d==null?void 0:d.insert))&&o.jsx(zUe,{children:o.jsxs("div",{className:`abc-edge-tools${f&&(d!=null&&d.insert)?" can-insert":""}${h?" is-visible":""}`,style:{transform:`translate(-50%, -50%) translate(${b}px, ${y}px)`},onPointerEnter:()=>m(!0),onPointerLeave:()=>m(!1),children:[u&&o.jsx("span",{className:"abc-edge-label",children:u}),f&&(d==null?void 0:d.insert)&&o.jsx("button",{type:"button",className:"abc-edge-add nodrag nopan","aria-label":"在这里插入步骤",title:"在这里插入步骤",onClick:O=>{O.stopPropagation(),f==null||f.onInsert(d.insert.parentPath,d.insert.index)},children:o.jsx(vo,{})})]})})]})}function KVe({data:e,selected:t}){const n=p.useContext(Oj),r=p.useContext(xj),i=r==="vertical"?zt.Top:zt.Left,s=r==="vertical"?zt.Bottom:zt.Right,a=r==="vertical"?zt.Right:zt.Bottom,l=e.pattern??"llm",c=Hx[l],u=c.icon;return o.jsxs("div",{className:`abc-node is-${l}${e.containedIn?` is-contained-in-${e.containedIn}`:""}${t?" is-selected":""}`,children:[o.jsx(Ho,{type:"target",position:i,className:"abc-handle"}),l!=="llm"&&o.jsx("span",{className:"abc-node-icon",children:o.jsx(u,{})}),o.jsxs("span",{className:"abc-node-copy",children:[o.jsx("span",{className:"abc-node-meta",children:o.jsx("span",{children:c.label})}),o.jsx("strong",{children:e.title}),o.jsx("small",{children:e.description})]}),n&&e.path!==void 0&&e.path.length>0&&o.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:o.jsx(Up,{})}),o.jsx(Ho,{type:"source",position:s,className:"abc-handle"}),e.containedIn==="loop"&&o.jsxs(o.Fragment,{children:[o.jsx(Ho,{id:"loop-target",type:"target",position:a,className:"abc-handle abc-loop-handle"}),o.jsx(Ho,{id:"loop-source",type:"source",position:a,className:"abc-handle abc-loop-handle"})]})]})}function JVe({data:e,selected:t}){const n=p.useContext(Oj),r=p.useContext(xj),i=r==="vertical"?zt.Top:zt.Left,s=r==="vertical"?zt.Bottom:zt.Right,a=r==="vertical"?zt.Right:zt.Bottom,l=e.pattern??"sequential",c=e.childCount??0,u=l==="llm"?"添加子 Agent":l==="parallel"?"添加一个同时处理的步骤":l==="loop"?"添加循环步骤":"添加下一个步骤";return o.jsxs("div",{className:`abc-group is-${l}${e.compactEmptyGroup?" is-compact-empty":""}${t?" is-selected":""}`,children:[o.jsx(Ho,{type:"target",position:i,className:"abc-handle"}),o.jsx("header",{className:"abc-group-head",children:o.jsxs("span",{children:[o.jsx("strong",{title:e.title,children:e.title}),o.jsx("small",{children:e.description})]})}),n&&e.path!==void 0&&c>0&&l!=="parallel"&&o.jsxs("div",{className:"abc-group-boundary-actions",children:[o.jsx("button",{type:"button",className:"abc-group-boundary-add is-start nodrag nopan","aria-label":"添加到最前",title:"添加到最前",onClick:d=>{d.stopPropagation(),n.onInsert(e.path,0)},children:o.jsx(vo,{})}),o.jsx("button",{type:"button",className:"abc-group-boundary-add is-end nodrag nopan","aria-label":"添加到最后",title:"添加到最后",onClick:d=>{d.stopPropagation(),n.onAdd(e.path)},children:o.jsx(vo,{})})]}),n&&e.path!==void 0&&c>0&&l==="parallel"&&o.jsxs("button",{type:"button",className:"abc-group-add abc-group-add-bottom nodrag nopan",onClick:d=>{d.stopPropagation(),n.onAdd(e.path)},children:[o.jsx(vo,{}),o.jsx("span",{children:u})]}),n&&e.path!==void 0&&c===0&&o.jsxs("button",{type:"button",className:"abc-group-add abc-group-add-empty nodrag nopan",onClick:d=>{d.stopPropagation(),n.onAdd(e.path)},children:[o.jsx(vo,{}),o.jsx("span",{children:u})]}),n&&e.path!==void 0&&e.path.length>0&&o.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:o.jsx(Up,{})}),o.jsx(Ho,{type:"source",position:s,className:"abc-handle"}),e.containedIn==="loop"&&o.jsxs(o.Fragment,{children:[o.jsx(Ho,{id:"loop-target",type:"target",position:a,className:"abc-handle abc-loop-handle"}),o.jsx(Ho,{id:"loop-source",type:"source",position:a,className:"abc-handle abc-loop-handle"})]})]})}function eHe({data:e}){const t=p.useContext(xj);return o.jsxs("div",{className:"abc-terminal",children:[o.jsx(Ho,{type:"target",position:t==="vertical"?zt.Top:zt.Left,className:"abc-handle"}),o.jsx("span",{children:e.title}),o.jsx(Ho,{type:"source",position:t==="vertical"?zt.Bottom:zt.Right,className:"abc-handle"})]})}const tHe={agent:KVe,group:JVe,terminal:eHe},nHe={insertStep:ZVe};function rHe({draft:e,selectedPath:t,onSelect:n,onAdd:r,onInsert:i,onDelete:s,readOnly:a=!1,interactivePreview:l=!1,direction:c="horizontal"}){const u=p.useMemo(()=>DX(e,c,a),[]),[d,f,h]=VUe(u.nodes),[m,g,b]=HUe(u.edges),y=XUe(),O=p.useRef(`${c}:${a?"readonly":"editable"}:${IX(e)}`),v=p.useRef(null),{fitView:x}=mj(),w=p.useMemo(()=>DX(e,c,a),[c,e,a]),[S,E]=p.useState(()=>window.matchMedia("(max-width: 860px)").matches),k=p.useMemo(()=>a?{padding:.16,minZoom:.05,maxZoom:.9}:S?{padding:.08,minZoom:.35,maxZoom:.9}:{padding:.14,minZoom:.42,maxZoom:1.1},[S,a]),_=p.useCallback((C=0)=>{window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{const A=v.current;if(A&&(A.clientWidth===0||A.clientHeight===0)&&C<8){_(C+1);return}x(k)})})},[k,x]);p.useEffect(()=>{const C=window.matchMedia("(max-width: 860px)"),A=j=>E(j.matches);return C.addEventListener("change",A),()=>C.removeEventListener("change",A)},[]),p.useEffect(()=>{const C=`${c}:${a?"readonly":"editable"}:${IX(e)}`,A=C!==O.current;O.current=C,g(w.edges),f(j=>{const M=new Map(j.map(I=>[I.id,I]));return w.nodes.map(I=>{const $=M.get(I.id);return{...I,measured:!A&&$&&$.type===I.type?$.measured:void 0,position:!A&&$?$.position:I.position,selected:I.data.kind==="agent"&&!!I.data.path&&WVe(I.data.path,t)}})}),A&&_()},[w,e,_,t,g,f]),p.useEffect(()=>{_()},[S,_]),p.useEffect(()=>{y&&_()},[w,_,y]),p.useEffect(()=>{if(!a||!v.current)return;const C=new ResizeObserver(()=>_());return C.observe(v.current),_(),()=>C.disconnect()},[_,a]);const T=p.useMemo(()=>a?null:{onAdd:r,onInsert:i,onDelete:s},[r,s,i,a]);return o.jsx(xj.Provider,{value:c,children:o.jsx(Oj.Provider,{value:T,children:o.jsx("section",{className:`abc-root is-${c}${a?" is-readonly":""}`,"aria-label":a?"只读 Agent 执行画布":"Agent 执行画布",children:o.jsx("div",{ref:v,className:"abc-canvas",children:o.jsxs(UUe,{nodes:d,edges:m,nodeTypes:tHe,edgeTypes:nHe,onNodesChange:h,onEdgesChange:b,onNodeClick:(C,A)=>{!a&&A.data.kind==="agent"&&A.data.path&&n(A.data.path)},nodesDraggable:!a,nodesConnectable:!1,nodesFocusable:!a,elementsSelectable:!a,edgesFocusable:!1,edgesReconnectable:!1,panOnDrag:!a||l,zoomOnDoubleClick:l,zoomOnPinch:!a||l,zoomOnScroll:!a||l,fitView:!0,fitViewOptions:k,onInit:()=>_(),minZoom:a?.05:.35,maxZoom:1.6,proOptions:{hideAttribution:!0},children:[o.jsx(KUe,{gap:20,size:1.2,color:"hsl(34 20% 82%)"}),(!a||l)&&o.jsx(sFe,{showInteractive:!1}),XVe]})})})})})}function Fw(e){return o.jsx(Rfe,{children:o.jsx(rHe,{...e})})}const iHe="https://ark.cn-beijing.volces.com/api/v3/",rT=[{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:iHe}],UC=[],FC={label:"控制台",url:"https://console.volcengine.com/vikingdb/openviking"},sHe={label:"文档",url:"https://github.com/volcengine/OpenViking/blob/main/docs/zh/api/05-sessions.md"},che="https://api.vikingdb.cn-beijing.volces.com/openviking",aHe=`{ "self": {"enabled": true}, "peer": {"enabled": true}, "working_memory": {"enabled": true}, "memory_types": null -}`,lHe=[{key:"DATABASE_VIKING_PROJECT",required:!1,placeholder:"default"},{key:"DATABASE_VIKING_REGION",required:!1},{key:"DATABASE_VIKING_COLLECTION_KIND",required:!1},{key:"DATABASE_VIKING_RESOURCE_ID",required:!1}],cHe=[{key:"DATABASE_VIKINGMEM_PROJECT",required:!1,placeholder:"default",comment:"VikingDB 记忆库项目",hidden:!0},{key:"DATABASE_VIKING_REGION",required:!1,comment:"VikingDB 记忆库地域",hidden:!0},{key:"DATABASE_VIKINGMEM_MEMORY_TYPE",required:!1,placeholder:"sys_event_v1,sys_profile_v1",comment:"记忆类型",hidden:!0}],gb=[{key:"FEISHU_APP_ID",required:!0,placeholder:"cli_xxx",comment:"飞书应用 App ID"},{key:"FEISHU_APP_SECRET",required:!0,placeholder:"输入 App Secret",comment:"飞书应用 App Secret"}],by={topK:"3",region:"cn-beijing",endpoint:"https://open.volcengineapi.com/"};function vj(e){if(e==="byteplus"){const t="ap-southeast-1";return{topK:by.topK,region:t,endpoint:`https://agentkit.${t}.byteplusapi.com/`}}return by}const uhe=[{key:"REGISTRY_SPACE_ID",required:!0,placeholder:"请选择智能体中心",comment:"AgentKit 智能体中心"},{key:"REGISTRY_TOP_K",required:!1,placeholder:by.topK,comment:"召回 Agent 数量"},{key:"REGISTRY_REGION",required:!1,placeholder:by.region,comment:"AgentKit 智能体中心地域"},{key:"REGISTRY_ENDPOINT",required:!1,placeholder:by.endpoint,comment:"AgentKit 智能体中心 OpenAPI 地址"}],tO=[{id:"web_search",label:"联网搜索",desc:"火山引擎 Web Search,获取实时信息。",importLine:"from veadk.tools.builtin_tools.web_search import web_search",toolNames:["web_search"],env:UC},{id:"parallel_web_search",label:"并行联网搜索",desc:"并行发起多条搜索查询,更快汇总。",importLine:"from veadk.tools.builtin_tools.parallel_web_search import parallel_web_search",toolNames:["parallel_web_search"],env:UC},{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"}]}],uHe=new Set(["web_scraper","text_to_speech","vesearch"]),dHe=new Set(["web_search","parallel_web_search"]),fHe=tO.filter(e=>!uHe.has(e.id));function dhe(e="volcengine"){const t=e==="byteplus"?dHe:new Set;return fHe.filter(n=>!t.has(n.id))}const yy=[{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}]}],Q4=[{id:"local",label:"本地向量库",desc:"进程内 llama-index 向量库。",env:tT,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},...tT],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},...tT],pipExtra:"extensions",needsEmbedding:!0},{id:"viking",label:"VikingDB Memory",desc:"VikingDB 记忆库(支持用户画像)。",env:cHe},{id:"openviking",label:"OpenViking Memory",desc:"OpenViking 长期记忆,按用户维度保存和检索偏好、事件与实体。",env:[{key:"DATABASE_OPENVIKING_URL",required:!0,placeholder:che,comment:"OpenViking 服务地址",link:FC},{key:"DATABASE_OPENVIKING_API_KEY",required:!0,comment:"OpenViking API Key",link:FC},{key:"DATABASE_OPENVIKING_USER_ID",required:!1,placeholder:"default",comment:"记忆归属 ID",help:"对应 viking://user/<此值>/peers/<请求用户>/memories 中的 user 段;用于隔离 Agent、租户或业务场景,默认 default。"},{key:"DATABASE_OPENVIKING_MEMORY_POLICY",required:!1,placeholder:oHe,comment:"记忆策略",multiline:!0,format:"json",help:"记忆的抽取策略和隔离策略,不填写时使用官方默认策略。",link:aHe}]},{id:"mem0",label:"Mem0",desc:"Mem0 托管记忆服务。",env:[{key:"DATABASE_MEM0_API_KEY",required:!0},{key:"DATABASE_MEM0_BASE_URL",required:!1}],pipExtra:"database"}],Np="viking",U4=[{id:"viking",label:"VikingDB Knowledge",desc:"VikingDB 知识库。",env:lHe},{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},...tT],pipExtra:"extensions",needsEmbedding:!0},{id:"context_search",label:"Context Search",desc:"火山 Context Search 引擎(无需向量化)。",env:[...UC,{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ID",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ENDPOINT",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_APIKEY",required:!0}]},{id:"openviking",label:"OpenViking Knowledge",desc:"OpenViking 资源目录知识库,无需向量化模型配置。",env:[{key:"DATABASE_OPENVIKING_URL",required:!0,placeholder:che,comment:"OpenViking 服务地址",link:FC},{key:"DATABASE_OPENVIKING_API_KEY",required:!0,comment:"OpenViking API Key",link:FC},{key:"DATABASE_OPENVIKING_USER_ID",required:!1,placeholder:"default",comment:"知识库归属 ID",help:"未配置资源目录时用于默认路径 viking://user/<此值>/resources/<知识库索引>/,默认 default。"},{key:"DATABASE_OPENVIKING_TARGET_URI",required:!1,placeholder:"viking://user/default/resources//",comment:"知识库资源目录",help:"留空时由 KnowledgeBase index 自动生成;填写后直接检索该 OpenViking 资源目录,优先级最高。"}]}],hHe=[{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:[...UC,{key:"OBSERVABILITY_OPENTELEMETRY_TLS_SERVICE_NAME",required:!1,comment:"TLS topic_id,留空自动创建"}]}],pHe="一个基于 VeADK 构建的智能助手,理解用户意图并调用合适的工具完成任务。",mHe=`你是一个专业、可靠的智能助手。 +}`,oHe=[{key:"DATABASE_VIKING_PROJECT",required:!1,placeholder:"default"},{key:"DATABASE_VIKING_REGION",required:!1},{key:"DATABASE_VIKING_COLLECTION_KIND",required:!1},{key:"DATABASE_VIKING_RESOURCE_ID",required:!1}],lHe=[{key:"DATABASE_VIKINGMEM_PROJECT",required:!1,placeholder:"default",comment:"VikingDB 记忆库项目",hidden:!0},{key:"DATABASE_VIKING_REGION",required:!1,comment:"VikingDB 记忆库地域",hidden:!0},{key:"DATABASE_VIKINGMEM_MEMORY_TYPE",required:!1,placeholder:"sys_event_v1,sys_profile_v1",comment:"记忆类型",hidden:!0}],gb=[{key:"FEISHU_APP_ID",required:!0,placeholder:"cli_xxx",comment:"飞书应用 App ID"},{key:"FEISHU_APP_SECRET",required:!0,placeholder:"输入 App Secret",comment:"飞书应用 App Secret",secret:!0}],by={topK:"3",region:"cn-beijing",endpoint:"https://open.volcengineapi.com/"};function vj(e){if(e==="byteplus"){const t="ap-southeast-1";return{topK:by.topK,region:t,endpoint:`https://agentkit.${t}.byteplusapi.com/`}}return by}const uhe=[{key:"REGISTRY_SPACE_ID",required:!0,placeholder:"请选择智能体中心",comment:"AgentKit 智能体中心"},{key:"REGISTRY_TOP_K",required:!1,placeholder:by.topK,comment:"召回 Agent 数量"},{key:"REGISTRY_REGION",required:!1,placeholder:by.region,comment:"AgentKit 智能体中心地域"},{key:"REGISTRY_ENDPOINT",required:!1,placeholder:by.endpoint,comment:"AgentKit 智能体中心 OpenAPI 地址"}],tO=[{id:"web_search",label:"联网搜索",desc:"火山引擎 Web Search,获取实时信息。",importLine:"from veadk.tools.builtin_tools.web_search import web_search",toolNames:["web_search"],env:UC},{id:"parallel_web_search",label:"并行联网搜索",desc:"并行发起多条搜索查询,更快汇总。",importLine:"from veadk.tools.builtin_tools.parallel_web_search import parallel_web_search",toolNames:["parallel_web_search"],env:UC},{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"}]}],cHe=new Set(["web_scraper","text_to_speech","vesearch"]),uHe=new Set(["web_search","parallel_web_search"]),dHe=tO.filter(e=>!cHe.has(e.id));function dhe(e="volcengine"){const t=e==="byteplus"?uHe:new Set;return dHe.filter(n=>!t.has(n.id))}const yy=[{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}]}],Q4=[{id:"local",label:"本地向量库",desc:"进程内 llama-index 向量库。",env:rT,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},...rT],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},...rT],pipExtra:"extensions",needsEmbedding:!0},{id:"viking",label:"VikingDB Memory",desc:"VikingDB 记忆库(支持用户画像)。",env:lHe},{id:"openviking",label:"OpenViking Memory",desc:"OpenViking 长期记忆,按用户维度保存和检索偏好、事件与实体。",env:[{key:"DATABASE_OPENVIKING_URL",required:!0,placeholder:che,comment:"OpenViking 服务地址",link:FC},{key:"DATABASE_OPENVIKING_API_KEY",required:!0,comment:"OpenViking API Key",link:FC},{key:"DATABASE_OPENVIKING_USER_ID",required:!1,placeholder:"default",comment:"记忆归属 ID",help:"对应 viking://user/<此值>/peers/<请求用户>/memories 中的 user 段;用于隔离 Agent、租户或业务场景,默认 default。"},{key:"DATABASE_OPENVIKING_MEMORY_POLICY",required:!1,placeholder:aHe,comment:"记忆策略",multiline:!0,format:"json",help:"记忆的抽取策略和隔离策略,不填写时使用官方默认策略。",link:sHe}]},{id:"mem0",label:"Mem0",desc:"Mem0 托管记忆服务。",env:[{key:"DATABASE_MEM0_API_KEY",required:!0},{key:"DATABASE_MEM0_BASE_URL",required:!1}],pipExtra:"database"}],Np="viking",U4=[{id:"viking",label:"VikingDB Knowledge",desc:"VikingDB 知识库。",env:oHe},{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},...rT],pipExtra:"extensions",needsEmbedding:!0},{id:"context_search",label:"Context Search",desc:"火山 Context Search 引擎(无需向量化)。",env:[...UC,{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ID",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_ENDPOINT",required:!0},{key:"DATABASE_CONTEXT_SEARCH_ENGINE_APIKEY",required:!0}]},{id:"openviking",label:"OpenViking Knowledge",desc:"OpenViking 资源目录知识库,无需向量化模型配置。",env:[{key:"DATABASE_OPENVIKING_URL",required:!0,placeholder:che,comment:"OpenViking 服务地址",link:FC},{key:"DATABASE_OPENVIKING_API_KEY",required:!0,comment:"OpenViking API Key",link:FC},{key:"DATABASE_OPENVIKING_USER_ID",required:!1,placeholder:"default",comment:"知识库归属 ID",help:"未配置资源目录时用于默认路径 viking://user/<此值>/resources/<知识库索引>/,默认 default。"},{key:"DATABASE_OPENVIKING_TARGET_URI",required:!1,placeholder:"viking://user/default/resources//",comment:"知识库资源目录",help:"留空时由 KnowledgeBase index 自动生成;填写后直接检索该 OpenViking 资源目录,优先级最高。"}]}],fHe=[{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:[...UC,{key:"OBSERVABILITY_OPENTELEMETRY_TLS_SERVICE_NAME",required:!1,comment:"TLS topic_id,留空自动创建"}]}],hHe="一个基于 VeADK 构建的智能助手,理解用户意图并调用合适的工具完成任务。",pHe=`你是一个专业、可靠的智能助手。 你的目标是准确理解用户的需求,并给出条理清晰、简洁有用的回答。 约束: - 信息不足时主动提问澄清,不要臆造事实。 - 需要时合理调用可用的工具,并说明关键结论。 -- 保持礼貌、专业的语气。`;function Ml(e="volcengine"){return{name:"",description:pHe,instruction:mHe,dynamicAgentDelegation:!1,agentType:"llm",cloudProvider:e,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:Kf(e),modelSource:"ark",modelProvider:"",modelApiBase:"",shortTermBackend:"local",longTermBackend:"local",longTermMemoryIndex:"",autoSaveSession:!1,knowledgebaseBackend:Np,knowledgebaseIndex:"",tracingExporters:[],selectedSkills:[],cloudEnvironment:{environmentId:"",environmentVersionId:""},deployment:{feishuEnabled:!1,modelApiKeyId:"",modelApiKeyName:""}}}const $7=[{id:"context_engine",displayName:"上下文治理",description:"治理上下文组装、任务锚定和上下文预算。"},{id:"compressor",displayName:"上下文与结果压缩",description:"压缩长上下文和大型工具结果,降低 Token 成本。"},{id:"verifier",displayName:"回答校验与修复",description:"校验证据和回答,在失败时执行修复或告警。"},{id:"long_run_control",displayName:"Goal任务控制",description:"管理 Goal 任务的进度、续跑和结束条件。"},{id:"mcp_resilience",displayName:"MCP 稳定性治理",description:"治理连接、超时、空结果、大返回和调用预算;默认包含 SQL 只读保护。"}],gHe=[{id:"quality",displayName:"提升回答质量",componentIds:["context_engine","verifier"]},{id:"cost",displayName:"降低运行成本",componentIds:["compressor"]},{id:"stability",displayName:"增强运行稳定性",componentIds:["long_run_control","mcp_resilience"]}],nO=$7.map(e=>e.id),bHe="BytePlus 账号暂不支持 Harness Sidecar 优化项。请保持优化项为空后继续部署,普通 BytePlus 智能体不受影响。";function yHe(e){return e==="byteplus"?bHe:null}const fhe=["context_engine","compressor","verifier","long_run_control"],OHe=new Set(["1","true","yes","on"]),B7=[{id:"default",displayName:"自定义",description:"按需选择组件,不勾选时不启动 Sidecar。",defaultComponents:[],autoAddedComponents:[]},{id:"ops",displayName:"运维场景",description:"适用于运维诊断、数据库、日志和监控 MCP。",defaultComponents:["context_engine","verifier","long_run_control","mcp_resilience"],autoAddedComponents:["sql_readonly"]}];function Av(e){var t;return((t=$7.find(n=>n.id===e))==null?void 0:t.displayName)??e}function hhe(e){var t;return((t=B7.find(n=>n.id===e))==null?void 0:t.displayName)??e}function Q7(e){const t=B7.find(n=>n.id===e);return t?[...t.defaultComponents]:[]}function sg(e,t="default"){const n=new Set(e);return{enabled:n.size>0,profile:t,componentOverrides:Object.fromEntries(nO.map(i=>[i,n.has(i)]))}}function U7(e){if(!e)return;const t=e.profile==="ops"?"ops":"default",n=t==="ops"?Q7(t):nO.filter(r=>{var i;return((i=e.componentOverrides)==null?void 0:i[r])===!0});return{...sg(n,t),...e.catalogVersion?{catalogVersion:e.catalogVersion}:{},...e.planHash?{planHash:e.planHash}:{}}}function q5(e){return OHe.has((e==null?void 0:e.trim().toLowerCase())??"")}function xHe(e){if(!e)return null;try{const t=JSON.parse(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:null}catch{return null}}function vHe(e){var a;const t=new Map((e==null?void 0:e.map(({key:l,value:c})=>[l,c]))??[]),n=t.get("HARNESS_SIDECAR_ENABLED");if(n===void 0)return null;const r=((a=t.get("HARNESS_PROFILE"))==null?void 0:a.trim())==="ops"?"ops":"default";if(!q5(n))return sg([],r);const i=xHe(t.get("HARNESS_SIDECAR_COMPONENT_OVERRIDES"));if(i){const l={...sg(nO.filter(c=>i[c]===!0),r),enabled:!0};return r==="ops"?U7(l)??l:l}if(r==="ops")return sg(Q7(r),r);const s=[...q5(t.get("HARNESS_MODEL_PROXY_ENABLED"))?fhe:[],...q5(t.get("HARNESS_MCP_GATEWAY_ENABLED"))?["mcp_resilience"]:[]];return{...sg(s,r),enabled:!0}}function wHe(e,t){return{...e,modelName:t.modelName||e.modelName,description:t.description,instruction:t.instruction}}function SHe(e){var t;return((t=e.harnessSidecar)==null?void 0:t.profile)??"default"}function zC(e){var n;const t=(n=e.harnessSidecar)==null?void 0:n.componentOverrides;return t?nO.filter(r=>t[r]):[]}function EHe(e){const t=new Set(zC(e));return fhe.filter(n=>t.has(n))}function kHe(e,t){const n=r=>({...r,mcpTools:(r.mcpTools??[]).map(i=>{var a,l;const s=!!(i.authTokenEnv&&(t.has(i.authTokenEnv)||i.authToken));return{...i,credentialConfigured:s,...s?{credentialSourceUrl:((a=i.url)==null?void 0:a.trim())??"",credentialSourceAuthTokenEnv:((l=i.authTokenEnv)==null?void 0:l.trim())??""}:{}}}),subAgents:r.subAgents.map(n),...r.workflow?{workflow:{...r.workflow,nodes:r.workflow.nodes.map(i=>({...i,agent:n(i.agent)}))}}:{}});return n(e)}function m0(e){const t=(e==null?void 0:e.trim())??"",n=t.indexOf("/");return n<=0||n===t.length-1?{modelName:t,modelProvider:""}:{modelName:t.slice(n+1),modelProvider:t.slice(0,n)}}function F7(e){return m0(e).modelName}function phe(e,t,n,r=!1){var c,u,d,f;const i=m0((t==null?void 0:t.model)||(n==null?void 0:n.model)),s=(t==null?void 0:t.children)??[],a=t==null?void 0:t.type,l=e.agentType==="a2a"&&((c=e.a2aRegistry)!=null&&c.enabled)&&a==="llm"?"a2a":a??e.agentType;return{...e,name:((u=t==null?void 0:t.name)==null?void 0:u.trim())||((d=n==null?void 0:n.name)==null?void 0:d.trim())||e.name,description:(t==null?void 0:t.description)??e.description,instruction:r?e.instruction:(t==null?void 0:t.instruction)??e.instruction,agentType:l,modelName:i.modelName||e.modelName,modelProvider:i.modelProvider||e.modelProvider,skills:((f=t==null?void 0:t.skills)==null?void 0:f.map(h=>h.name))??e.skills,subAgents:e.subAgents.map((h,m)=>phe(h,s[m],void 0,r))}}function _He(e,t){const n=new Map(t.map(({key:a,value:l})=>[a,l]));if(!["REGISTRY_SPACE_ID","REGISTRY_TOP_K","REGISTRY_REGION","REGISTRY_ENDPOINT"].some(a=>n.has(a)))return e;const i=(a,l)=>n.has(a)?n.get(a)??"":l??"",s=a=>{var l;return{...a,...(l=a.a2aRegistry)!=null&&l.enabled?{a2aRegistry:{...a.a2aRegistry,registrySpaceId:i("REGISTRY_SPACE_ID",a.a2aRegistry.registrySpaceId),registryTopK:i("REGISTRY_TOP_K",a.a2aRegistry.registryTopK),registryRegion:i("REGISTRY_REGION",a.a2aRegistry.registryRegion),registryEndpoint:i("REGISTRY_ENDPOINT",a.a2aRegistry.registryEndpoint)}}:{},subAgents:a.subAgents.map(s)}};return s(e)}function F4(e,t){var c,u,d;const n=e.cloudProvider??t,r=Ml(n),i=e.deployment,s=i==null?void 0:i.network,a=e.cloudEnvironment,l=e.a2aRegistry;return{...r,...e,name:e.name??r.name,description:e.description??r.description,instruction:e.instruction??r.instruction,agentType:e.agentType??r.agentType,cloudProvider:n,maxIterations:e.maxIterations??r.maxIterations,a2aUrl:e.a2aUrl??r.a2aUrl,model:e.model??void 0,modelSource:e.modelSource==="ark"||e.modelSource==="custom"?e.modelSource:void 0,modelName:e.modelName??r.modelName,modelProvider:e.modelProvider??r.modelProvider,modelApiBase:e.modelApiBase??r.modelApiBase,memory:{shortTerm:((c=e.memory)==null?void 0:c.shortTerm)??r.memory.shortTerm,longTerm:((u=e.memory)==null?void 0:u.longTerm)??r.memory.longTerm},tools:[...e.tools??[]],skills:[...e.skills??[]],knowledgebase:e.knowledgebase??r.knowledgebase,tracing:e.tracing??r.tracing,harnessSidecar:U7(e.harnessSidecar),subAgents:(e.subAgents??[]).map(f=>F4(f,n)),builtinTools:[...e.builtinTools??[]],customTools:[...e.customTools??[]],mcpTools:[...e.mcpTools??[]],a2aRegistry:{...r.a2aRegistry,...l??{},enabled:(l==null?void 0:l.enabled)??!1,registrySpaceId:(l==null?void 0:l.registrySpaceId)??"",registryTopK:(l==null?void 0:l.registryTopK)??"",registryRegion:(l==null?void 0:l.registryRegion)??"",registryEndpoint:(l==null?void 0:l.registryEndpoint)??""},shortTermBackend:e.shortTermBackend??r.shortTermBackend,longTermBackend:e.longTermBackend??r.longTermBackend,longTermMemoryIndex:e.longTermMemoryIndex??r.longTermMemoryIndex,autoSaveSession:e.autoSaveSession??r.autoSaveSession,knowledgebaseBackend:e.knowledgebaseBackend??r.knowledgebaseBackend,knowledgebaseIndex:e.knowledgebaseIndex??r.knowledgebaseIndex,tracingExporters:[...e.tracingExporters??[]],selectedSkills:[...e.selectedSkills??[]],cloudEnvironment:{...r.cloudEnvironment,...a??{},cliTools:[...(a==null?void 0:a.cliTools)??[]],dockerfile:typeof(a==null?void 0:a.dockerfile)=="string"?a.dockerfile:void 0},deployment:{...r.deployment,...i??{},feishuEnabled:(i==null?void 0:i.feishuEnabled)??!1,runtimeName:(i==null?void 0:i.runtimeName)??void 0,runtimeNameCustomized:(i==null?void 0:i.runtimeNameCustomized)??((d=r.deployment)==null?void 0:d.runtimeNameCustomized),network:s?{...s,vpcId:s.vpcId??"",subnetIds:s.subnetIds??"",enableSharedInternetAccess:s.enableSharedInternetAccess??!1}:void 0,modelApiKeyId:(i==null?void 0:i.modelApiKeyId)??"",modelApiKeyName:(i==null?void 0:i.modelApiKeyName)??"",envValues:(i==null?void 0:i.envValues)??void 0},...e.workflow?{workflow:{...e.workflow,nodes:e.workflow.nodes.map(f=>({...f,agent:F4(f.agent,n)}))}}:{}}}const PX="动态子智能体协作规则:",THe=["collect_resources","create_agents","handoff_to"];function CHe(e){return e.replace(/\\([\\`*_[\]{}()<>#+\-.!|])/g,"$1")}function AHe(e){const t=[];let n=0;for(;n{const a=t[s+1]??e.length,l=CHe(e.slice(i,a));return THe.every(c=>l.includes(c))});return r===void 0?e:e.slice(0,r).trimEnd()}function NHe(e){const t=n=>({...n,instruction:n.dynamicAgentDelegation===!0?AHe(n.instruction):n.instruction,subAgents:n.subAgents.map(t),...n.workflow?{workflow:{...n.workflow,nodes:n.workflow.nodes.map(r=>({...r,agent:t(r.agent)}))}}:{}});return t(e)}function mhe(e,t){var l,c;const n=Ml(t),r=[...e.tools??[]],i=tO.filter(u=>u.toolNames.some(d=>r.includes(d))),s=new Set(i.flatMap(u=>u.toolNames)),a=m0(e.model);return{...n,modelSource:void 0,name:((l=e.name)==null?void 0:l.trim())??"",description:e.description??"",instruction:e.instruction||n.instruction,agentType:e.type??"llm",modelName:a.modelName,modelProvider:a.modelProvider,tools:r.filter(u=>!s.has(u)),builtinTools:i.map(u=>u.id),skills:((c=e.skills)==null?void 0:c.map(u=>u.name))??[],subAgents:(e.children??[]).map(u=>mhe(u,t))}}function z7(e,t,n=[]){var l,c,u,d;const r=((l=e.draft)==null?void 0:l.cloudProvider)??t,i=m0(e.model),s=e.draft?F4(e.draft,r):e.graph?mhe(e.graph,r):{...Ml(r),modelSource:void 0,name:((c=e.name)==null?void 0:c.trim())||e.appName.trim(),description:e.description??"",instruction:e.instruction||Ml(r).instruction,agentType:e.type??"llm",modelName:i.modelName,modelProvider:i.modelProvider,tools:[...e.tools??[]],skills:((u=e.skills)==null?void 0:u.map(f=>f.name))??[]},a=e.draft&&s.dynamicAgentDelegation===!0?NHe(s):s;return kHe(phe(a,e.graph,{name:((d=e.name)==null?void 0:d.trim())||e.appName.trim(),model:e.model},!!e.draft),new Set(n))}function jHe(e,t){const n=r=>{var s;const i=((s=r.modelName)==null?void 0:s.trim())??"";return{...r,modelSource:r.agentType==="llm"||!r.agentType?t.has(i)?"ark":"custom":r.modelSource,subAgents:r.subAgents.map(n),...r.workflow?{workflow:{...r.workflow,nodes:r.workflow.nodes.map(a=>({...a,agent:n(a.agent)}))}}:{}}};return n(e)}function MX({className:e="icon"}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M4.5 6.7h4.2M12.3 6.7h7.2"}),o.jsx("path",{d:"M4.5 12h8.2M16.3 12h3.2"}),o.jsx("path",{d:"M4.5 17.3h2.7M10.8 17.3h8.7"}),o.jsx("circle",{cx:"10.5",cy:"6.7",r:"1.8",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"14.5",cy:"12",r:"1.8",fill:"currentColor",stroke:"none"}),o.jsx("circle",{cx:"9",cy:"17.3",r:"1.8",fill:"currentColor",stroke:"none"})]})}const RHe={coding:"智能编程",get_city_weather:"城市天气查询",get_location_weather:"位置天气查询",web_fetch:"网页内容获取"};function ghe(e){const t=tO.find(n=>n.id===e||n.toolNames.includes(e));return RHe[e]??(t==null?void 0:t.label)??e}function IHe(){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m7 7 10 10M17 7 7 17",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function DHe(){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[o.jsx("circle",{cx:"10.8",cy:"10.8",r:"5.8",stroke:"currentColor",strokeWidth:"1.7"}),o.jsx("path",{d:"m15.2 15.2 4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function PHe({agentName:e,tools:t,selectedIds:n,loading:r,disabled:i,unavailableReason:s,onChange:a,onClose:l}){const[c,u]=p.useState(""),d=p.useMemo(()=>new Set(n),[n]),f=p.useRef(`studio-tool-${Math.random().toString(36).slice(2)}`),h=p.useMemo(()=>{const g=c.trim().toLowerCase();return g?t.filter(b=>`${b.name} ${b.id} ${b.description}`.toLowerCase().includes(g)):t},[c,t]);p.useEffect(()=>{const g=document.body.style.overflow;document.body.style.overflow="hidden";const b=y=>{y.key==="Escape"&&l()};return document.addEventListener("keydown",b),()=>{document.removeEventListener("keydown",b),document.body.style.overflow=g}},[l]);const m=g=>{const b=new Set(d);b.has(g)?b.delete(g):b.add(g),a([...b])};return Cr.createPortal(o.jsxs("div",{className:"studio-tool-dialog-layer",children:[o.jsx("button",{type:"button",className:"studio-tool-dialog-scrim","aria-label":"关闭弹窗",onClick:l}),o.jsxs("section",{className:"studio-tool-dialog",role:"dialog","aria-modal":"true","aria-labelledby":f.current,children:[o.jsxs("header",{className:"studio-tool-dialog-head",children:[o.jsx("span",{className:"studio-tool-dialog-mark",children:o.jsx(MX,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:f.current,children:"添加 Studio 工具"}),o.jsxs("p",{children:["由 Studio BFF 为 ",e," 的当前会话执行,Runtime 无需预装"]})]}),o.jsx("button",{type:"button",className:"studio-tool-dialog-close","aria-label":"关闭添加 Studio 工具",onClick:l,children:o.jsx(IHe,{})})]}),o.jsxs("div",{className:"studio-tool-dialog-body",children:[o.jsxs("label",{className:"studio-tool-search",children:[o.jsx(DHe,{}),o.jsx("input",{value:c,"aria-label":"搜索 Studio 工具",placeholder:"搜索中文名称或工具标识",autoFocus:!0,onChange:g=>u(g.target.value)})]}),o.jsx("div",{className:"studio-tool-picker",role:"list","aria-label":"可用 Studio 工具",children:r?o.jsx("div",{className:"studio-tool-empty",children:"正在读取 Studio 工具…"}):s?o.jsx("div",{className:"studio-tool-empty",children:s}):h.length===0?o.jsx("div",{className:"studio-tool-empty",children:"没有匹配的 Studio 工具"}):h.map(g=>{const b=d.has(g.id);return o.jsxs("article",{className:"studio-tool-option",role:"listitem",children:[o.jsx("span",{className:"studio-tool-option-icon",children:o.jsx(MX,{})}),o.jsxs("span",{className:"studio-tool-option-copy",children:[o.jsx("strong",{children:g.name||ghe(g.id)}),o.jsx("code",{children:g.id}),o.jsx("span",{children:g.description})]}),o.jsx("button",{type:"button",disabled:i,"aria-pressed":b,onClick:()=>m(g.id),children:b?"移除":"添加"})]},g.id)})})]})]})]}),document.body)}function En({as:e="span",className:t="",duration:n=4,spread:r=20,children:i,style:s,...a}){const l=Math.min(Math.max(r,5),45);return o.jsx(e,{className:`text-shimmer${t?` ${t}`:""}`,style:{...s,backgroundImage:`linear-gradient(to right, hsl(var(--muted-foreground)) ${50-l}%, hsl(var(--foreground)) 50%, hsl(var(--muted-foreground)) ${50+l}%)`,animationDuration:`${n}s`},...a,children:i})}const VC=[{id:"ubuntu-22.04",label:"Ubuntu 22.04",image:"ubuntu:22.04"},{id:"ubuntu-24.04",label:"Ubuntu 24.04",image:"ubuntu:24.04"}],bhe=[{id:"aio-sandbox",label:"AIO Sandbox",description:"内置 Sandbox Shell 能力 · Ubuntu 22.04"},{id:"ubuntu",label:"Ubuntu",description:"标准 Linux 基础镜像"}],MHe="agentkit-cli-2107625663-cn-beijing.cr.volces.com/agentkit/agent-native-requirements-aio:0.2.1-20260831",yhe=[{id:"python-3.10",label:"Python 3.10"},{id:"python-3.12",label:"Python 3.12"}],LHe={"python-3.10":"3.10.18","python-3.12":"3.12.11"},V7=[{id:"tools",label:"工具",description:"常用 CLI 与内容处理工具",options:[{id:"lark-cli",label:"lark-cli",description:"飞书开放平台命令行工具",installer:"pip",packageName:"lark-cli"},{id:"pandoc",label:"pandoc",description:"文档格式转换工具",installer:"apt",packageName:"pandoc"},{id:"opencli",label:"opencli",description:"将网站与桌面应用转换为命令行工具",installer:"npm",packageName:"@jackwener/opencli@1.8.7"}]},{id:"productivity",label:"效率",description:"加速依赖安装、检索和协作",options:[{id:"uv",label:"uv",description:"快速 Python 包与项目管理器",installer:"pip",packageName:"uv"},{id:"ripgrep",label:"ripgrep",description:"高性能文本检索工具",installer:"apt",packageName:"ripgrep"},{id:"jq",label:"jq",description:"JSON 查询与转换工具",installer:"apt",packageName:"jq"},{id:"github-cli",label:"GitHub CLI",description:"在终端中管理 GitHub 工作流",installer:"apt",packageName:"gh"}]},{id:"browser",label:"浏览器自动化",description:"网页操作、测试与内容采集",options:[{id:"playwright",label:"Playwright",description:"浏览器自动化与端到端测试",installer:"pip",packageName:"playwright"},{id:"chromium",label:"Chromium",description:"无头浏览器运行时",installer:"apt",packageName:"chromium"}]},{id:"system",label:"系统与媒体",description:"基础开发、网络和媒体处理能力",options:[{id:"git",label:"Git",description:"代码版本管理",installer:"apt",packageName:"git"},{id:"curl",label:"curl",description:"网络请求与文件下载",installer:"apt",packageName:"curl"},{id:"ffmpeg",label:"FFmpeg",description:"音视频转码与处理",installer:"apt",packageName:"ffmpeg"},{id:"imagemagick",label:"ImageMagick",description:"图片转换与批处理",installer:"apt",packageName:"imagemagick"}]}],$He=V7.flatMap(e=>e.options),BHe=["build-essential","curl","libbz2-dev","libffi-dev","libgdbm-dev","liblzma-dev","libncursesw5-dev","libreadline-dev","libsqlite3-dev","libssl-dev","tk-dev","uuid-dev","zlib1g-dev"],QHe=["xvfb","fonts-noto-color-emoji","fonts-unifont","libfontconfig1","libfreetype6","xfonts-cyrillic","xfonts-scalable","fonts-liberation","fonts-ipafont-gothic","fonts-wqy-zenhei","fonts-tlwg-loma-otf","fonts-freefont-ttf"],UHe={"ubuntu-22.04":["libasound2","libatk-bridge2.0-0","libatk1.0-0","libatspi2.0-0","libcairo2","libcups2","libdbus-1-3","libdrm2","libgbm1","libglib2.0-0","libnspr4","libnss3","libpango-1.0-0","libwayland-client0","libx11-6","libxcb1","libxcomposite1","libxdamage1","libxext6","libxfixes3","libxkbcommon0","libxrandr2"],"ubuntu-24.04":["libasound2t64","libatk-bridge2.0-0t64","libatk1.0-0t64","libatspi2.0-0t64","libcairo2","libcups2t64","libdbus-1-3","libdrm2","libgbm1","libglib2.0-0t64","libnspr4","libnss3","libpango-1.0-0","libx11-6","libxcb1","libxcomposite1","libxdamage1","libxext6","libxfixes3","libxkbcommon0","libxrandr2"]};function sx(e,t){for(const n of t)e.includes(n)||e.push(n)}function FHe(e,t,n,r,i){const s=["ca-certificates"];i||sx(s,r?[`python${n}`,`python${n}-venv`]:BHe);for(const a of t)a.id==="playwright"||a.id==="chromium"||(a.installer==="apt"&&sx(s,[a.packageName]),a.id==="opencli"&&sx(s,["curl","xz-utils"]));return e.optionIds.some(a=>a==="playwright"||a==="chromium")&&(sx(s,QHe),sx(s,UHe[e.operatingSystem])),s}const X5={name:"",description:"",baseEnvironment:"aio-sandbox",operatingSystem:"ubuntu-22.04",language:"python-3.12",optionIds:["lark-cli","pandoc","opencli","uv","ripgrep","jq","git","curl"],selectedSkills:[]};function $f(e){var t;return((t=yhe.find(n=>n.id===e))==null?void 0:t.label)??e}function z4(e){var t;return((t=VC.find(n=>n.id===e))==null?void 0:t.label)??e}function zHe(e){var t;return((t=bhe.find(n=>n.id===e))==null?void 0:t.label)??e}function VHe(e){var n;const t=((n=e.match(/^\s*FROM\s+(.+)$/im))==null?void 0:n[1])??"";return{baseEnvironment:/aio\.sandbox/i.test(e)?"aio-sandbox":"ubuntu",operatingSystem:/ubuntu:24\.04/i.test(t)?"ubuntu-24.04":"ubuntu-22.04"}}function H7(e){const t=$He.filter(h=>e.optionIds.includes(h.id)),n=e.baseEnvironment==="aio-sandbox",r=n?"python-3.12":e.language,i=r.replace("python-",""),s=LHe[r],a=VC.find(h=>h.id===e.operatingSystem)??VC[0],l=e.operatingSystem==="ubuntu-22.04"&&i==="3.10"||e.operatingSystem==="ubuntu-24.04"&&i==="3.12",c=FHe(e,t,i,l,n),u=n?[`ARG AIO_BASE_IMAGE=${MHe}`,"ARG AIO_BASE_PLATFORM=linux/amd64","",`# Base environment: AIO Sandbox (${a.label})`,"FROM --platform=${AIO_BASE_PLATFORM} ${AIO_BASE_IMAGE}"]:[`# Operating system: ${a.label}`,`FROM ${a.image}`];u.push("","ARG DEBIAN_FRONTEND=noninteractive","ARG APT_MIRROR_URL=http://archive.ubuntu.com/ubuntu","ARG PIP_INDEX_URL=https://pypi.org/simple","ARG PYTHON_SOURCE_BASE_URL=https://www.python.org/ftp/python","ARG PLAYWRIGHT_DOWNLOAD_HOST=https://cdn.playwright.dev","ARG PIP_DEFAULT_TIMEOUT=300","ARG PIP_RETRIES=10","","# Install all system dependencies in one transaction from the provider-local mirror.","RUN set -eux; \\",' mirror="${APT_MIRROR_URL%/}"; \\'," for source_file in /etc/apt/sources.list /etc/apt/sources.list.d/*.sources; do \\",' [ -f "$source_file" ] || continue; \\',' sed -i -E "s#https?://(archive|security).ubuntu.com/ubuntu/?#${mirror}#g" "$source_file"; \\'," done; \\",` printf 'Acquire::Retries "5";\\nAcquire::ForceIPv4 "true";\\nAcquire::http::Timeout "60";\\nAcquire::https::Timeout "60";\\n' > /etc/apt/apt.conf.d/80-veadk-network; \\`," apt-get update; \\"," apt-get install -y --no-install-recommends \\",...c.map(h=>" "+h+" \\")," ; rm -rf /var/lib/apt/lists/*","","ENV PYTHONDONTWRITEBYTECODE=1 \\"," PYTHONUNBUFFERED=1 \\"," PIP_NO_CACHE_DIR=1","",`# Python ${i}`),n?u.push("# Keep Studio dependencies isolated from AIO's system interpreter.","RUN /opt/python3.12/bin/python -m venv /opt/veadk-environment/.venv","","ENV VIRTUAL_ENV=/opt/veadk-environment/.venv \\"," BASH_VENV_PATH=/opt/veadk-environment/.venv \\",' PATH="/opt/veadk-environment/.venv/bin:$PATH"'):l?u.push(`RUN python${i} -m venv /opt/venv`):u.push(`RUN curl --retry 5 --retry-all-errors --connect-timeout 30 -fsSL "\${PYTHON_SOURCE_BASE_URL}/${s}/Python-${s}.tgz" -o /tmp/python.tgz \\`," && mkdir -p /tmp/python-source \\"," && tar -xzf /tmp/python.tgz --strip-components=1 -C /tmp/python-source \\"," && cd /tmp/python-source \\"," && ./configure --prefix=/opt/python --with-ensurepip=install \\",' && make -j"$(nproc)" \\'," && make install \\",` && /opt/python/bin/python${i} -m venv /opt/venv \\`," && rm -rf /tmp/python-source /tmp/python.tgz"),n||u.push("",'ENV PATH="/opt/venv/bin:$PATH"');const d=new Set(e.optionIds);(d.has("playwright")||d.has("chromium"))&&u.push("","ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright \\"," PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT=300000"),u.push("","WORKDIR /workspace","","# VeADK: Agent 开发与运行框架","RUN python -m pip install --upgrade veadk-python");let f=!1;for(const h of t)u.push("",`# ${h.label}: ${h.description}`),h.id==="opencli"?u.push('RUN node_arch="$(dpkg --print-architecture)" \\',' && case "$node_arch" in amd64) node_arch=x64 ;; arm64) node_arch=arm64 ;; *) echo "Unsupported architecture: $node_arch" >&2; exit 1 ;; esac \\',' && curl --retry 5 --connect-timeout 30 -fsSL "https://nodejs.org/dist/v22.18.0/node-v22.18.0-linux-${node_arch}.tar.xz" -o /tmp/node.tar.xz \\'," && tar -xJf /tmp/node.tar.xz -C /usr/local --strip-components=1 \\",` && npm install --global ${h.packageName} \\`," && npm cache clean --force \\"," && rm -f /tmp/node.tar.xz"):h.id==="playwright"||h.id==="chromium"?f||(u.push("RUN python -m pip install --upgrade playwright"),u.push("RUN python -m playwright install chromium"),f=!0):h.installer!=="apt"&&u.push(`RUN python -m pip install --upgrade ${h.packageName}`);return n?u.push("","# Keep AIO's inherited /opt/gem/run.sh startup chain and shell API.","EXPOSE 8080"):u.push("",'CMD ["/bin/bash"]'),u.join(` -`)}function HHe(){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m7 7 10 10M17 7 7 17",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function qHe(){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[o.jsx("circle",{cx:"10.8",cy:"10.8",r:"5.8",stroke:"currentColor",strokeWidth:"1.7"}),o.jsx("path",{d:"m15.2 15.2 4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function V4(){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[o.jsx("path",{d:"M5 7.25A2.25 2.25 0 0 1 7.25 5h9.5A2.25 2.25 0 0 1 19 7.25v9.5A2.25 2.25 0 0 1 16.75 19h-9.5A2.25 2.25 0 0 1 5 16.75v-9.5Z",stroke:"currentColor",strokeWidth:"1.6"}),o.jsx("path",{d:"M8.5 9.25 11 12l-2.5 2.75M12.75 14.75h2.75",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ohe(){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[o.jsx("path",{d:"M4.75 7.25A2.25 2.25 0 0 1 7 5h3l1.5 2h5.5a2.25 2.25 0 0 1 2.25 2.25v7.5A2.25 2.25 0 0 1 17 19H7a2.25 2.25 0 0 1-2.25-2.25v-9.5Z",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),o.jsx("path",{d:"M8 11.25h8M8 14.75h5.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})]})}function XHe(){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"M12 6.5v11M6.5 12h11",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function LX(){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m7 7 10 10M17 7 7 17",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function $X(){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m3.5 8.25 2.75 2.75 6.25-6.25",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}function mc(e){return`${e.environment_id}\0${e.environment_version_id}`}function Nv(e){return e.latestVersion?{environment_id:e.id,environment_version_id:e.latestVersion.versionId}:null}function nT(e,t){return e.environmentIds.flatMap(n=>{const r=t.get(n),i=r?Nv(r):null;return i?[i]:[]})}function GHe({environments:e,workspaces:t,value:n,selectedWorkspaceIds:r,loading:i,error:s,onConfirm:a,onClose:l}){const[c,u]=p.useState(""),d=p.useId(),f=p.useMemo(()=>new Map(e.map(k=>[k.id,k])),[e]),[h,m]=p.useState(()=>new Set(r)),[g,b]=p.useState(()=>{const k=new Set(t.filter(_=>r.includes(_.id)).flatMap(_=>_.environmentIds));return new Set(n.filter(_=>!k.has(_.environment_id)).map(mc))}),y=p.useMemo(()=>new Set(t.filter(k=>h.has(k.id)).flatMap(k=>k.environmentIds)),[h,t]),O=p.useMemo(()=>{const k=new Set(g);for(const _ of t)if(h.has(_.id))for(const C of nT(_,f))k.add(mc(C));return k},[g,h,f,t]),v=p.useMemo(()=>{const k=c.trim().toLocaleLowerCase();return k?e.filter(_=>`${_.name} ${_.description} ${$f(_.language)}`.toLocaleLowerCase().includes(k)):e},[e,c]),x=p.useMemo(()=>{const k=c.trim().toLocaleLowerCase();return k?t.filter(_=>{const C=_.environmentIds.map(T=>{var A;return((A=f.get(T))==null?void 0:A.name)??""}).join(" ");return`${_.name} ${_.description} ${C}`.toLocaleLowerCase().includes(k)}):t},[f,c,t]);p.useEffect(()=>{const k=document.body.style.overflow,_=C=>{C.key==="Escape"&&l()};return document.body.style.overflow="hidden",document.addEventListener("keydown",_),()=>{document.body.style.overflow=k,document.removeEventListener("keydown",_)}},[l]);const w=k=>{const _=Nv(k);if(!_)return;const C=mc(_);y.has(k.id)||b(T=>{const A=new Set(T);return A.has(C)?A.delete(C):A.add(C),A})},S=k=>{const _=nT(k,f);_.length!==0&&(m(C=>{const T=new Set(C);return T.has(k.id)?T.delete(k.id):T.add(k.id),T}),b(C=>{const T=new Set(C);for(const A of _)T.delete(mc(A));return T}))},E=()=>{a(e.flatMap(k=>{const _=Nv(k);return _&&O.has(mc(_))?[_]:[]}),[...h]),l()};return Cr.createPortal(o.jsxs("div",{className:"studio-tool-dialog-layer",children:[o.jsx("button",{type:"button",className:"studio-tool-dialog-scrim","aria-label":"关闭环境弹窗",onClick:l}),o.jsxs("section",{className:"studio-tool-dialog session-environment-dialog",role:"dialog","aria-modal":"true","aria-labelledby":d,children:[o.jsxs("header",{className:"studio-tool-dialog-head",children:[o.jsx("span",{className:"studio-tool-dialog-mark",children:o.jsx(V4,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:d,children:"添加环境"}),o.jsx("p",{children:"选择当前会话允许 Agent 使用的 Sandbox 环境"})]}),o.jsx("button",{type:"button",className:"studio-tool-dialog-close","aria-label":"关闭添加环境",onClick:l,children:o.jsx(HHe,{})})]}),o.jsxs("div",{className:"studio-tool-dialog-body",children:[o.jsxs("label",{className:"studio-tool-search",children:[o.jsx(qHe,{}),o.jsx("input",{value:c,"aria-label":"搜索环境",placeholder:"搜索环境名称或能力",autoFocus:!0,onChange:k=>u(k.target.value)})]}),o.jsx("div",{className:"studio-tool-picker session-environment-picker",role:"group","aria-label":"可用环境与工作区",children:i?o.jsx("div",{className:"studio-tool-empty",children:"正在读取可用环境…"}):s?o.jsx("div",{className:"studio-tool-empty",children:s}):v.length===0&&x.length===0?o.jsx("div",{className:"studio-tool-empty",children:"没有匹配的环境或工作区"}):o.jsxs(o.Fragment,{children:[x.length>0&&o.jsxs("section",{className:"session-environment-picker__group","aria-labelledby":`${d}-workspaces`,children:[o.jsx("h3",{id:`${d}-workspaces`,children:"工作区"}),x.map(k=>{const _=nT(k,f),C=h.has(k.id),T=_.length===0;return o.jsxs("label",{className:`studio-tool-option session-environment-option is-workspace${C?" is-selected":""}${T?" is-disabled":""}`,children:[o.jsx("span",{className:"studio-tool-option-icon",children:o.jsx(Ohe,{})}),o.jsxs("span",{className:"studio-tool-option-copy",children:[o.jsx("strong",{children:k.name}),o.jsx("span",{children:k.description||"复用工作区中的全部可用环境"}),o.jsxs("small",{children:[_.length," 个可用环境"]})]}),o.jsx("input",{type:"checkbox",checked:C,disabled:T,"aria-label":`选择工作区 ${k.name}`,onChange:()=>S(k)}),o.jsx("span",{className:"session-environment-check","aria-hidden":"true",children:o.jsx($X,{})})]},k.id)})]}),v.length>0&&o.jsxs("section",{className:"session-environment-picker__group","aria-labelledby":`${d}-environments`,children:[o.jsx("h3",{id:`${d}-environments`,children:"环境"}),v.map(k=>{const _=Nv(k);if(!_)return null;const C=t.filter(j=>h.has(j.id)&&j.environmentIds.includes(k.id)),T=C.length>0,A=O.has(mc(_));return o.jsxs("label",{className:`studio-tool-option session-environment-option${A?" is-selected":""}${T?" is-covered":""}`,children:[o.jsx("span",{className:"studio-tool-option-icon",children:o.jsx(V4,{})}),o.jsxs("span",{className:"studio-tool-option-copy",children:[o.jsx("strong",{children:k.name}),o.jsx("span",{children:T?`已由工作区 ${C.map(j=>j.name).join("、")} 包含`:k.description||$f(k.language)}),o.jsxs("small",{children:[$f(k.language)," · ",_.environment_version_id]})]}),o.jsx("input",{type:"checkbox",checked:A,disabled:T,"aria-label":`选择环境 ${k.name}`,onChange:()=>w(k)}),o.jsx("span",{className:"session-environment-check","aria-hidden":"true",children:o.jsx($X,{})})]},mc(_))})]})]})})]}),o.jsxs("footer",{className:"session-environment-dialog__footer",children:[o.jsxs("span",{children:["已选择 ",h.size," 个工作区,覆盖 ",O.size," 个环境"]}),o.jsxs("div",{children:[o.jsx("button",{type:"button",onClick:l,children:"取消"}),o.jsx("button",{type:"button",className:"is-primary",disabled:i||!!s,onClick:E,children:"确认添加"})]})]})]})]}),document.body)}function WHe({environments:e,workspaces:t,value:n,selectedWorkspaceIds:r,loading:i,disabled:s=!1,error:a="",onChange:l}){const[c,u]=p.useState(!1),d=p.useRef(null),f=p.useMemo(()=>new Map(e.flatMap(O=>{const v=Nv(O);return v?[[mc(v),O]]:[]})),[e]),h=p.useMemo(()=>new Map(e.map(O=>[O.id,O])),[e]),m=t.filter(O=>r.includes(O.id)),g=new Set(m.flatMap(O=>O.environmentIds)),b=n.filter(O=>!g.has(O.environment_id)),y=()=>{u(!1),requestAnimationFrame(()=>{var O;return(O=d.current)==null?void 0:O.focus()})};return o.jsxs("div",{className:"session-environment-select",children:[n.length>0&&o.jsxs("div",{className:"session-environment-list",role:"list","aria-label":"已挂载环境",children:[m.map(O=>{const v=new Set(nT(O,h).map(x=>x.environment_id));return o.jsxs("div",{className:"session-environment-item is-workspace",role:"listitem",children:[o.jsx("span",{className:"session-environment-item__icon",children:o.jsx(Ohe,{})}),o.jsxs("span",{className:"session-environment-item__copy",children:[o.jsx("strong",{children:O.name}),o.jsxs("small",{children:[v.size," 个环境"]})]}),l&&o.jsx("button",{type:"button",className:"topo-remove-capability","aria-label":`移除工作区 ${O.name}`,title:"移除",disabled:s,onClick:()=>{const x=r.filter(S=>S!==O.id),w=new Set(t.filter(S=>x.includes(S.id)).flatMap(S=>S.environmentIds));l(n.filter(S=>!v.has(S.environment_id)||w.has(S.environment_id)),x)},children:o.jsx(LX,{})})]},`workspace:${O.id}`)}),b.map(O=>{const v=f.get(mc(O));return o.jsxs("div",{className:"session-environment-item",role:"listitem",children:[o.jsx("span",{className:"session-environment-item__icon",children:o.jsx(V4,{})}),o.jsxs("span",{className:"session-environment-item__copy",children:[o.jsx("strong",{children:(v==null?void 0:v.name)??O.environment_id}),o.jsx("small",{children:v?$f(v.language):O.environment_version_id})]}),l&&o.jsx("button",{type:"button",className:"topo-remove-capability","aria-label":`移除环境 ${(v==null?void 0:v.name)??O.environment_id}`,title:"移除",disabled:s,onClick:()=>l(n.filter(x=>mc(x)!==mc(O)),[...r]),children:o.jsx(LX,{})})]},mc(O))})]}),l&&o.jsxs("button",{ref:d,type:"button",className:"topo-capability-add-slot","aria-label":"添加环境",disabled:s||i||!!a||e.length===0,onClick:()=>u(!0),children:[o.jsx(XHe,{}),o.jsx("span",{children:n.length>0?"添加更多环境":"为当前 Session 添加环境"})]}),(i||a||e.length===0)&&o.jsx("p",{className:a?"is-error":void 0,role:a?"alert":void 0,children:i?"正在加载可用环境…":a||"暂无可用的 AIO Sandbox 环境。"}),c&&o.jsx(GHe,{environments:e,workspaces:t,value:n,selectedWorkspaceIds:r,loading:i,error:a,onConfirm:(O,v)=>l==null?void 0:l(O,v),onClose:y})]})}function xhe(e){return 1+e.children.reduce((t,n)=>t+xhe(n),0)}function vhe(e){return e.id||e.name}function YHe(e,t){const n=vhe(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 whe(e,t=!0){return{...e,id:vhe(e),name:YHe(e,t),children:e.children.map(n=>whe(n,!1))}}function She(e){const t=Ml(),n=m0(e.model);return{...t,name:e.name,description:e.description,instruction:e.instruction||t.instruction,agentType:e.type,modelName:n.modelName,modelProvider:n.modelProvider,tools:e.tools??[],skills:(e.skills??[]).map(r=>r.name),subAgents:e.children.map(She)}}function ZHe(e){return[...new Set(e.map(t=>t.trim()).filter(Boolean))]}function KHe(e){return[...new Map(e.filter(t=>t.name.trim()).map(t=>[t.name.trim(),{...t,name:t.name.trim()}])).values()]}function d2({title:e,count:t}){return o.jsxs("div",{className:"topo-module-title",children:[o.jsx("span",{className:"topo-module-label",title:e,children:e}),t!==void 0&&o.jsx("span",{className:"topo-section-count","aria-label":`${t} 项`,children:t})]})}function JHe({appName:e,info:t,loading:n,variant:r="rail",studioTools:i=[],selectedStudioToolIds:s=[],managedStudioToolIds:a=[],studioToolsLoading:l=!1,studioToolsDisabled:c=!1,studioToolsUnavailableReason:u="",onStudioToolsChange:d,environments:f=[],workspaces:h=[],selectedEnvironments:m=[],selectedEnvironmentWorkspaceIds:g=[],environmentsLoading:b=!1,environmentsDisabled:y=!1,environmentsError:O="",onEnvironmentsChange:v}){const[x,w]=p.useState(null),[S,E]=p.useState(!1),k=p.useRef(null),_=()=>{E(!1),window.requestAnimationFrame(()=>{var H;return(H=k.current)==null?void 0:H.focus()})};if(p.useEffect(()=>{if(!S)return;const H=document.body.style.overflow,z=B=>{B.key==="Escape"&&_()};return document.body.style.overflow="hidden",document.addEventListener("keydown",z),()=>{document.body.style.overflow=H,document.removeEventListener("keydown",z)}},[S]),n&&!t)return o.jsx("aside",{className:`topo is-loading${r==="drawer"?" is-drawer":""}`,"aria-label":"Agent 信息","aria-live":"polite",children:o.jsx(En,{as:"span",className:"topo-loading-label",duration:2.2,children:"正在读取 Agent 信息…"})});if(!t)return null;const C=F7(t.model),T=whe(t.graph??{id:t.name,name:t.name,description:t.description,type:t.type??"llm",model:C,tools:t.tools,skills:t.skills,path:[t.name],mentionable:!1,children:[]}),A=ZHe(t.tools).map(H=>({id:`base:tool:${H}`,name:H,label:ghe(H),custom:!1,removable:!1})),j=new Set(A.map(H=>H.name)),L=new Set(s),I=new Set(a),M=i.filter(H=>L.has(H.id)&&!j.has(H.id)).map(H=>({id:`studio:tool:${H.id}`,name:H.id,label:H.name,custom:!0,removable:!I.has(H.id)})),N=[...A,...M],D=KHe(t.skills),Q=!!d,F=She(T),$=H=>o.jsx(Qw,{draft:F,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0},H);return o.jsxs(o.Fragment,{children:[o.jsxs("aside",{className:`topo${r==="drawer"?" is-drawer":""}`,"aria-label":"Agent 信息与拓扑",children:[o.jsxs("section",{className:"topo-agent-card","aria-label":"Agent 信息",children:[o.jsxs("div",{className:"topo-agent-heading",children:[o.jsx("h2",{title:t.name,children:t.name||"未命名 Agent"}),C&&o.jsx("span",{title:C,children:C})]}),t.description&&o.jsx("p",{className:"topo-description",title:t.description,children:t.description})]}),o.jsxs("div",{className:"topo-module-stack",children:[o.jsxs("section",{className:"topo-module-card topo-tools-card","aria-label":"工具",children:[o.jsx(d2,{title:"工具",count:N.length}),o.jsx("div",{className:"topo-module-scroll topo-tools-scroll",role:"region","aria-label":"工具列表",tabIndex:0,children:N.length>0?o.jsx("div",{className:"topo-tool-list",children:N.map(H=>o.jsxs("div",{className:"topo-tool",title:H.name,children:[o.jsxs("span",{className:"topo-capability-title",children:[o.jsxs("span",{className:"topo-capability-copy",children:[o.jsx("span",{className:"topo-capability-name",children:H.label}),o.jsx("code",{children:H.name})]}),H.custom&&o.jsx("span",{className:"topo-custom-badge",children:"Studio Tool"})]}),H.custom&&H.removable&&o.jsx("button",{type:"button",className:"topo-remove-capability","aria-label":`移除工具 ${H.name}`,title:"移除",disabled:c,onClick:()=>d==null?void 0:d(s.filter(z=>z!==H.name)),children:"×"})]},H.id))}):o.jsx("div",{className:"topo-empty",children:"未配置"})}),Q&&o.jsx("div",{className:"topo-capability-add-dock",children:o.jsxs("button",{type:"button",className:"topo-capability-add-slot","aria-label":"添加 Studio 工具",disabled:c,onClick:()=>w("tool"),children:[o.jsx("span",{"aria-hidden":"true",children:"+"}),o.jsx("span",{children:"在此对话中添加 Studio 工具"})]})})]}),o.jsxs("section",{className:"topo-module-card topo-skills-card","aria-label":"技能",children:[o.jsx(d2,{title:"技能",count:t.skillsPreviewSupported?D.length:void 0}),o.jsx("div",{className:"topo-module-scroll topo-skills-scroll",role:"region","aria-label":"技能列表",tabIndex:0,children:t.skillsPreviewSupported?D.length>0?o.jsx("div",{className:"topo-skill-list",children:D.map(H=>o.jsxs("div",{className:"topo-skill",title:H.description||H.name,children:[o.jsx("div",{className:"topo-skill-title",children:o.jsx("span",{className:"topo-skill-name",children:H.name})}),H.description&&o.jsx("span",{className:"topo-skill-description",children:H.description})]},`${H.name}:${H.description}`))}):o.jsx("div",{className:"topo-empty",children:"未配置"}):o.jsx("div",{className:"topo-empty",children:"暂不支持预览"})})]}),(v||m.length>0)&&o.jsxs("section",{className:"topo-module-card topo-environment-card","aria-label":"会话环境",children:[o.jsx(d2,{title:"环境",count:m.length}),o.jsx(WHe,{environments:f,workspaces:h,value:m,selectedWorkspaceIds:g,loading:b,disabled:y,error:O,onChange:v})]}),o.jsxs("section",{className:"topo-module-card topo-topology","aria-label":"Agent 画布",children:[o.jsxs("div",{className:"topo-canvas-heading",children:[o.jsx(d2,{title:"结构拓扑",count:xhe(T)}),o.jsx("button",{ref:k,type:"button",className:"topo-canvas-expand","aria-label":"全屏查看 Agent 画布",title:"全屏查看",onClick:()=>E(!0),children:o.jsx(uy,{"aria-hidden":"true"})})]}),o.jsx("div",{className:"topo-canvas-preview",role:"region","aria-label":"Agent 执行画布",children:$(`conversation-canvas:${e}`)})]})]}),x==="tool"&&d&&o.jsx(PHe,{agentName:t.name,tools:i.filter(H=>!j.has(H.id)&&!I.has(H.id)),selectedIds:s,loading:l,disabled:c,unavailableReason:u,onChange:d,onClose:()=>w(null)})]}),S&&Cr.createPortal(o.jsxs("section",{className:"topo-canvas-dialog",role:"dialog","aria-modal":"true","aria-label":"全屏 Agent 执行画布",children:[o.jsxs("header",{className:"topo-canvas-dialog-header",children:[o.jsxs("div",{children:[o.jsx("strong",{children:"Agent 执行画布"}),o.jsx("span",{children:t.name})]}),o.jsx("button",{type:"button","aria-label":"关闭全屏画布",title:"关闭",onClick:_,autoFocus:!0,children:o.jsx(Oa,{"aria-hidden":"true"})})]}),o.jsx("div",{className:"topo-canvas-dialog-body",children:$(`conversation-canvas-fullscreen:${e}`)})]}),document.body)]})}const cE={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};function BX(e){return o.jsxs("svg",{...cE,...e,children:[o.jsx("rect",{x:"3.75",y:"5.25",width:"16.5",height:"13.5",rx:"2"}),o.jsx("path",{d:"m10.25 9 4.8 3-4.8 3V9Z"})]})}function eqe(e){return o.jsxs("svg",{...cE,...e,children:[o.jsx("path",{d:"M12 3.75v10.5M8.4 10.8 12 14.4l3.6-3.6"}),o.jsx("path",{d:"M5 17.25v2h14v-2"})]})}function tqe(e){return o.jsxs("svg",{...cE,...e,children:[o.jsx("path",{d:"M8.75 8.75 6.9 10.6a3.4 3.4 0 0 0 4.8 4.8l1.85-1.85"}),o.jsx("path",{d:"m15.25 15.25 1.85-1.85a3.4 3.4 0 0 0-4.8-4.8l-1.85 1.85"}),o.jsx("path",{d:"m9.4 14.6 5.2-5.2"})]})}function nqe(e){return o.jsxs("svg",{...cE,...e,children:[o.jsx("path",{d:"M5 19h3.2L18.6 8.6a1.7 1.7 0 0 0 0-2.4l-.8-.8a1.7 1.7 0 0 0-2.4 0L5 15.8V19Z"}),o.jsx("path",{d:"m13.9 6.9 3.2 3.2M5 15.8 8.2 19"})]})}function Ehe(e){return o.jsx("svg",{...cE,...e,children:o.jsx("path",{d:"m6.5 6.5 11 11M17.5 6.5l-11 11"})})}const rqe=180,QX=500,UX=10,FX=32;function iqe(e){return Array.from(new Set(e.split(/[,,]/).map(t=>t.trim()).filter(Boolean)))}function sqe({artifact:e,busy:t,error:n,onClose:r,onSave:i}){const[s,a]=p.useState(e.name),[l,c]=p.useState(e.description??""),[u,d]=p.useState((e.tags??[]).join(",")),[f,h]=p.useState(""),m=p.useId(),g=p.useId(),b=p.useRef(null),y=p.useRef(null),O=p.useRef(t),v=p.useRef(r);p.useEffect(()=>{O.current=t,v.current=r},[t,r]),p.useEffect(()=>{var _,C;const S=document.body.style.overflow,E=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(_=y.current)==null||_.focus(),(C=y.current)==null||C.select();const k=T=>{if(T.key==="Escape"&&!O.current){T.preventDefault(),v.current();return}if(T.key!=="Tab")return;const A=b.current;if(!A)return;const j=Array.from(A.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(M=>M.getClientRects().length>0);if(j.length===0){T.preventDefault();return}const L=j[0],I=j[j.length-1];T.shiftKey&&document.activeElement===L?(T.preventDefault(),I.focus()):!T.shiftKey&&document.activeElement===I&&(T.preventDefault(),L.focus())};return window.addEventListener("keydown",k),()=>{window.removeEventListener("keydown",k),document.body.style.overflow=S,E!=null&&E.isConnected&&E.focus()}},[]);const x=S=>{var _;S.preventDefault();const E=s.trim(),k=iqe(u);if(!E){h("请输入产物名称"),(_=y.current)==null||_.focus();return}if(k.length>UX){h(`标签最多 ${UX} 个`);return}if(k.some(C=>C.length>FX)){h(`单个标签不能超过 ${FX} 个字符`);return}h(""),i({name:E,description:l.trim(),tags:k})},w=f||n;return Cr.createPortal(o.jsx("div",{className:"artifact-edit-backdrop",onMouseDown:S=>{S.target===S.currentTarget&&!t&&r()},children:o.jsxs("section",{ref:b,className:"artifact-edit-dialog",role:"dialog","aria-modal":"true","aria-labelledby":m,"aria-describedby":g,"aria-busy":t||void 0,children:[o.jsxs("header",{className:"artifact-edit-dialog__header",children:[o.jsxs("div",{children:[o.jsx("h2",{id:m,children:"编辑产物信息"}),o.jsx("p",{id:g,children:"内容文件不会被修改"})]}),o.jsx("button",{type:"button",onClick:r,disabled:t,"aria-label":"关闭编辑框",children:o.jsx(Ehe,{})})]}),o.jsxs("form",{onSubmit:x,children:[o.jsxs("div",{className:"artifact-edit-dialog__body",children:[o.jsxs("label",{className:"artifact-edit-field",children:[o.jsx("span",{children:"名称"}),o.jsx("input",{ref:y,value:s,maxLength:rqe,disabled:t,"aria-invalid":!!w||void 0,onChange:S=>{a(S.target.value),h("")}})]}),o.jsxs("label",{className:"artifact-edit-field",children:[o.jsx("span",{children:"描述"}),o.jsx("textarea",{value:l,maxLength:QX,disabled:t,rows:4,placeholder:"补充用途、版本或使用说明",onChange:S=>c(S.target.value)}),o.jsxs("small",{children:[l.length,"/",QX]})]}),o.jsxs("label",{className:"artifact-edit-field",children:[o.jsx("span",{children:"标签"}),o.jsx("input",{value:u,disabled:t,placeholder:"使用逗号分隔,最多 10 个",onChange:S=>{d(S.target.value),h("")}})]}),w?o.jsx("div",{className:"artifact-edit-error",role:"alert",children:w}):null]}),o.jsxs("footer",{className:"artifact-edit-dialog__actions",children:[o.jsx("button",{type:"button",onClick:r,disabled:t,children:"取消"}),o.jsx("button",{type:"submit",className:"is-primary",disabled:t,children:t?"保存中":"保存"})]})]})]})}),document.body)}const aqe=p.createContext(null);function khe(){const e=p.useContext(aqe);return(e==null?void 0:e.linkComponent)??"a"}function uE(e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}const oqe=()=>kle,zX=(e,t=!1,n="TransitionGroup")=>{const r=[];return p.Children.forEach(e,i=>{if(i&&typeof i=="object"&&"key"in i&&i.key)r.push(i);else if(t)throw new Error(`Child elements of <${n} /> must include a \`key\``)}),r},W0=()=>{},Y0=e=>{const t=p.useRef(e);return t.current=e,p.useCallback(n=>t.current(n),[])};function lqe(e,t,n,r){const i=e.reduce((c,u)=>({...c,[u.key]:1}),{}),s=t.reduce((c,u)=>({...c,[u.component.key]:1}),{}),a=e.filter(c=>!s[c.key]).map(n),l=t.map(c=>({...c,component:e.find(({key:u})=>u===c.component.key)||c.component,shouldRender:!!i[c.component.key]}));return r==="append"?l.concat(a):a.concat(l)}function cqe(e,t,n){if((kle||gDe)&&t&&n>1)throw new Error(`Cannot use forwardRef with multiple children in <${e} />`)}const uqe="_TransitionGroupChild_1hv1z_1",dqe={TransitionGroupChild:uqe},_he={enter:!1,enterActive:!1,exit:!1,exitActive:!1,interrupted:!1},fqe=e=>({..._he,enter:!e}),hqe=(e,t)=>{switch(t.type){case"enter-before":return{enter:!0,enterActive:!1,exit:!1,exitActive:!1,interrupted:e.interrupted||e.exit};case"enter-active":return{enter:!0,enterActive:!0,exit:!1,exitActive:!1,interrupted:!1};case"exit-before":return{enter:!1,enterActive:!1,exit:!0,exitActive:!1,interrupted:e.interrupted||e.enter};case"exit-active":return{enter:!1,enterActive:!1,exit:!0,exitActive:!0,interrupted:!1};case"done":default:return _he}},pqe=({ref:e,as:t,children:n,className:r,transitionId:i,style:s,preventMountTransition:a,shouldRender:l,enterDuration:c,exitDuration:u,removeChild:d,onEnter:f,onEnterActive:h,onEnterComplete:m,onExit:g,onExitActive:b,onExitComplete:y})=>{const[O,v]=p.useReducer(hqe,fqe(a||!1)),x=p.useRef(!1),w=p.useRef(null),S=p.useRef(c);S.current=c;const E=p.useRef(u);E.current=u;const k=p.useRef(null),_=p.useCallback(C=>{const T=w.current;if(!(!T||C===k.current))switch(k.current=C,C){case"enter":f(T);break;case"enter-active":h(T);break;case"enter-complete":m(T);break;case"exit":g(T);break;case"exit-active":b(T);break;case"exit-complete":y(T);break}},[f,h,m,g,b,y]);return Zn.useLayoutEffect(()=>{if(!l){let A;v({type:"exit-before"}),_("exit");const j=wC(()=>{v({type:"exit-active"}),_("exit-active"),A=window.setTimeout(()=>{_("exit-complete"),d()},E.current)});return()=>{j(),A!==void 0&&clearTimeout(A)}}if(a&&!x.current){x.current=!0;return}let C;v({type:"enter-before"}),_("enter");const T=wC(()=>{v({type:"enter-active"}),_("enter-active"),C=window.setTimeout(()=>{v({type:"done"}),_("enter-complete")},S.current)});return()=>{T(),C!==void 0&&clearTimeout(C)}},[l,a,d,_]),p.useEffect(()=>()=>{x.current=!1},[]),o.jsx(t,{ref:uE([w,e]),className:ur(r,dqe.TransitionGroupChild),"data-transition-id":i,style:s,"data-entering":O.enter?"":void 0,"data-entering-active":O.enterActive?"":void 0,"data-exiting":O.exit?"":void 0,"data-exiting-active":O.exitActive?"":void 0,"data-interrupted":O.interrupted?"":void 0,children:n})},mqe=e=>{const{enterMountDelay:t,preventMountTransition:n}=e,r=!n&&t!=null?t:null,[i,s]=p.useState(r==null);return k9(()=>s(!0),i?null:r),i?o.jsx(pqe,{...e}):null},rO=e=>{const{ref:t,as:n="span",children:r,className:i,transitionId:s,style:a,enterDuration:l=0,exitDuration:c=0,preventInitialTransition:u=!0,enterMountDelay:d,insertMethod:f="append",disableAnimations:h=oqe()}=e,m=Y0(e.onEnter??W0),g=Y0(e.onEnterActive??W0),b=Y0(e.onEnterComplete??W0),y=Y0(e.onExit??W0),O=Y0(e.onExitActive??W0),v=Y0(e.onExitComplete??W0);p.Children.forEach(r,E=>{if(E&&!E.key)throw new Error("Child elements of must include a `key`")});const x=p.useCallback(E=>({component:E,shouldRender:!0,removeChild:()=>{S(k=>k.filter(_=>E.key!==_.component.key))},onEnter:m,onEnterActive:g,onEnterComplete:b,onExit:y,onExitActive:O,onExitComplete:v}),[m,g,b,y,O,v]),[w,S]=p.useState(()=>zX(r).map(E=>({...x(E),preventMountTransition:u})));return p.useLayoutEffect(()=>{S(E=>{const k=zX(r);return lqe(k,E,x,f)})},[r,f,x]),cqe("TransitionGroup",t,p.Children.count(r)),h?o.jsx(o.Fragment,{children:p.Children.map(r,E=>o.jsx(n,{ref:t,className:i,style:a,"data-transition-id":s,children:E}))}):o.jsx(o.Fragment,{children:w.map(({component:E,...k})=>o.jsx(mqe,{...k,as:n,className:i,transitionId:s,enterDuration:l,exitDuration:c,enterMountDelay:d,style:a,ref:t,children:E},E.key))})},gqe="_Button_1864l_1",bqe="_ButtonInner_1864l_4",yqe="_ButtonLoader_1864l_749",G5={Button:gqe,ButtonInner:bqe,ButtonLoader:yqe},Nt=e=>{const{type:t="button",color:n="primary",variant:r="solid",pill:i=!0,uniform:s=!1,size:a="md",iconSize:l,gutterSize:c,loading:u,selected:d,block:f,opticallyAlign:h,children:m,className:g,onClick:b,disabled:y,disabledTone:O,inert:v=u,...x}=e,w=y||v,S=p.useCallback(E=>{y||b==null||b(E)},[b,y]);return o.jsxs("button",{type:t,className:ur(G5.Button,g),"data-color":n,"data-variant":r,"data-pill":i?"":void 0,"data-uniform":s?"":void 0,"data-size":a,"data-gutter-size":c,"data-icon-size":l,"data-loading":u?"":void 0,"data-selected":d?"":void 0,"data-block":f?"":void 0,"data-optically-align":h,onPointerEnter:_9,disabled:w,"aria-disabled":w,tabIndex:w?-1:void 0,"data-disabled":y?"":void 0,"data-disabled-tone":y?O:void 0,onClick:S,...x,children:[o.jsx(rO,{className:G5.ButtonLoader,enterDuration:250,exitDuration:150,children:u&&o.jsx(WS,{},"loader")}),o.jsx("span",{className:G5.ButtonInner,children:E9(m)})]})},Oqe="_TransitionItem_1o7b1_1",xqe={TransitionItem:Oqe},vqe=e=>{const{as:t="span",className:n,children:r,preventInitialTransition:i,insertMethod:s,transitionClassName:a,transitionPosition:l="absolute"}=e,{enterTotalDuration:c,exitTotalDuration:u,variables:d}=_qe(e);return o.jsx(t,{className:ur("block",l==="absolute"&&"relative",n),"data-transition-position":l,style:d,children:o.jsx(rO,{as:t,className:ur(xqe.TransitionItem,a),enterDuration:c,exitDuration:u,insertMethod:s,preventInitialTransition:i,children:r})})},wqe=400,Sqe=500,Eqe=200,kqe=300;function _qe({initial:e,enter:t,exit:n,forceCompositeLayer:r}){const i=m5(e),s=m5(t),a=m5(n),l=[i,a,s].some(b=>b!=="none"),c=(t==null?void 0:t.duration)??(l?Sqe:wqe),u=(t==null?void 0:t.timingFunction)??(l?"var(--cubic-enter)":"ease"),d=(n==null?void 0:n.duration)??(l?kqe:Eqe),f=(n==null?void 0:n.timingFunction)??(l?"var(--cubic-exit)":"ease"),h=d0({"tg-will-change":r?"transform, opacity":"auto","tg-enter-opacity":p5((t==null?void 0:t.opacity)??1),"tg-enter-transform":s,"tg-enter-filter":g5(t),"tg-enter-duration":qk(c),"tg-enter-delay":qk((t==null?void 0:t.delay)??0),"tg-enter-timing-function":u,"tg-exit-opacity":p5((n==null?void 0:n.opacity)??0),"tg-exit-transform":a,"tg-exit-filter":g5(n),"tg-exit-duration":qk(d),"tg-exit-delay":qk((n==null?void 0:n.delay)??0),"tg-exit-timing-function":f,"tg-initial-opacity":p5((e==null?void 0:e.opacity)??(n==null?void 0:n.opacity)??0),"tg-initial-transform":i==="none"?a:i,"tg-initial-filter":g5(e??n??{})}),m=((t==null?void 0:t.delay)??0)+c,g=((n==null?void 0:n.delay)??0)+d;return{enterTotalDuration:m,exitTotalDuration:g,variables:h}}const q7=({children:e,copyValue:t,onClick:n,...r})=>{const[i,s]=p.useState(!1),a=p.useRef(null),l=c=>{i||(s(!0),n==null||n(c),x6e(typeof t=="function"?t():t),a.current=window.setTimeout(()=>{s(!1)},1300))};return p.useEffect(()=>()=>{a.current&&clearTimeout(a.current)},[]),o.jsxs(Nt,{...r,onClick:l,children:[o.jsx(vqe,{className:"w-[var(--button-icon-size)] h-[var(--button-icon-size)]",initial:{scale:.6},enter:{scale:1,delay:150,duration:300},exit:{scale:.6,duration:150},forceCompositeLayer:!0,children:i?o.jsx(Zy,{},"copied-icon"):o.jsx(J8,{},"copy-icon")}),typeof e=="function"?e({copied:i}):e]})},Tqe="_Menu_1t4b0_1",Cqe="_MenuList_1t4b0_3",Aqe="_MenuItemContent_1t4b0_53",Nqe="_MenuItem_1t4b0_53",jqe="_ItemActions_1t4b0_98",Rqe="_PressableInner_1t4b0_117",Iqe="_Separator_1t4b0_135",Dqe="_SubMenuItem_1t4b0_139",Pqe="_SubTriggerIcon_1t4b0_141",Mqe="_RadioItem_1t4b0_151",Lqe="_RadioIndicatorActive_1t4b0_158",$qe="_RadioIndicator_1t4b0_158",Bqe="_CheckboxItem_1t4b0_249",Qqe="_CheckboxIndicator_1t4b0_256",Uqe="_CheckboxCircle_1t4b0_269",$i={Menu:Tqe,MenuList:Cqe,MenuItemContent:Aqe,MenuItem:Nqe,ItemActions:jqe,PressableInner:Rqe,Separator:Iqe,SubMenuItem:Dqe,SubTriggerIcon:Pqe,RadioItem:Mqe,RadioIndicatorActive:Lqe,RadioIndicator:$qe,CheckboxItem:Bqe,CheckboxIndicator:Qqe,CheckboxCircle:Uqe},The=p.createContext(null),dE=()=>{const e=p.useContext(The);if(!e)throw new Error("Menu components must be wrapped in ");return e},La=({children:e,forceOpen:t,onOpen:n,onClose:r,modal:i=!1})=>{const[s,a]=p.useState(!1),l=t??s,c=Xp(n),u=Xp(r),d=p.useCallback(h=>{var m,g;a(h),h?(m=c.current)==null||m.call(c):(g=u.current)==null||g.call(u)},[c,u]);tE(s,()=>{d(!1)});const f=p.useMemo(()=>({open:l,setOpen:d}),[l,d]);return o.jsx(The.Provider,{value:f,children:o.jsx(H4e,{open:l,onOpenChange:d,modal:i,children:e})})},Fqe=({className:e,children:t,disabled:n,onSelect:r,onClick:i})=>{const{open:s}=dE(),a=l=>{s||l.preventDefault()};return r?o.jsx(oue,{className:ur($i.MenuItem,e),onSelect:r,onClick:i,disabled:n,onPointerMove:a,onPointerLeave:a,children:o.jsx("div",{className:$i.PressableInner,children:t})}):o.jsx("div",{className:ur($i.MenuItemContent,e),children:t})},zqe=({className:e,children:t})=>o.jsx("div",{className:ur($i.ItemActions,e),children:t}),Vqe=({children:e,onClick:t})=>{const{setOpen:n}=dE();return o.jsx(Nt,{className:"rounded-sm",color:"secondary",size:"xs",uniform:!0,iconSize:"sm",variant:"ghost",onClick:r=>{r.stopPropagation(),n(!1),t(r)},children:e})},Hqe=e=>{const{className:t,children:n,href:r,to:i,disabled:s,as:a,...l}=e,{open:c}=dE(),u=r||i,d=u?/^https?:\/\//.test(u):!0,f=khe(),h=a||(d?"a":f),m=b=>{c||b.preventDefault()},g=d?{target:"_blank",rel:"noopener noreferrer",href:r??i}:{href:r,to:i};return o.jsx(oue,{asChild:!0,className:ur($i.MenuItem,t),disabled:s,onPointerMove:d?void 0:m,onPointerLeave:d?void 0:m,children:o.jsx(h,{...g,...l,children:o.jsx("span",{className:$i.PressableInner,children:n})})})},qqe=({className:e})=>o.jsx(Z4e,{className:ur($i.Separator,e),role:"separator"}),Xqe=({children:e,side:t,sideOffset:n=5,align:r,alignOffset:i,width:s,minWidth:a,maxHeight:l})=>{const{open:c}=dE();return o.jsx(aue,{forceMount:!0,children:o.jsx(rO,{className:$i.Menu,enterDuration:350,exitDuration:200,disableAnimations:!0,children:c&&o.jsx(X4e,{forceMount:!0,className:$i.MenuList,side:t,sideOffset:n,align:r,alignOffset:i??(r==="center"?0:-5),avoidCollisions:!0,collisionPadding:{bottom:30,top:30,left:12,right:12},onEscapeKeyDown:Df,style:d0({"menu-width":s,"menu-min-width":a,"menu-max-height":l}),children:e},"dropdown")})})},Gqe=({children:e,disabled:t})=>o.jsx(q4e,{asChild:!0,disabled:t,children:e}),Che=p.createContext(null),Ahe=()=>{const e=p.useContext(Che);if(!e)throw new Error("Submenu components must be wrapped in ");return e},Wqe=({children:e,forceOpen:t,onOpen:n,onClose:r})=>{const[i,s]=p.useState(!1),a=p.useRef(null),l=t??i,c=Xp(n),u=Xp(r),d=p.useCallback(h=>{var m,g;s(h),h?(m=c.current)==null||m.call(c):(g=u.current)==null||g.call(u)},[c,u]);tE(i,()=>{var h;d(!1),(h=a.current)==null||h.focus()});const f=p.useMemo(()=>({open:l,setOpen:d,triggerRef:a}),[l,d]);return o.jsx(Che.Provider,{value:f,children:o.jsx(K4e,{open:l,onOpenChange:d,children:e})})},Yqe=({className:e,children:t,disabled:n})=>{const{open:r}=dE(),{triggerRef:i}=Ahe(),s=a=>{r||a.preventDefault()};return o.jsx(J4e,{ref:i,className:ur($i.MenuItem,$i.SubMenuItem,e),disabled:n,onPointerMove:s,onPointerLeave:s,children:o.jsxs("div",{className:$i.PressableInner,children:[t,o.jsx(lRe,{width:"16",height:"16",className:$i.SubTriggerIcon})]})})},Zqe=({children:e,sideOffset:t=4,alignOffset:n=-6,width:r="auto",minWidth:i="auto",maxHeight:s})=>{const{open:a}=Ahe();return o.jsx(aue,{forceMount:!0,children:o.jsx(rO,{className:$i.Menu,enterDuration:350,exitDuration:200,disableAnimations:!0,children:a&&o.jsx(eLe,{className:$i.MenuList,sideOffset:t,alignOffset:n,avoidCollisions:!0,collisionPadding:{bottom:30,top:30,left:12,right:12},onEscapeKeyDown:Df,style:d0({"menu-width":r,"menu-min-width":i,"menu-max-height":s}),children:e},"submenu")})})},Kqe=({children:e,value:t,onChange:n,indicatorPosition:r="end",...i})=>o.jsx(W4e,{...i,value:t,onValueChange:s=>n(s),"data-indicator-position":r,children:e}),Jqe=({className:e,children:t,...n})=>o.jsx(Y4e,{className:ur($i.MenuItem,$i.RadioItem,e),...n,children:o.jsxs("div",{className:$i.PressableInner,children:[o.jsx("div",{className:$i.RadioIndicator,children:o.jsx(lue,{className:$i.RadioIndicatorActive})}),t]})}),eXe=({className:e,children:t,indicatorPosition:n="end",indicatorVariant:r="solid",...i})=>o.jsx(G4e,{className:ur($i.MenuItem,$i.CheckboxItem,e),...i,"data-indicator-position":n,"data-indicator-variant":r,children:o.jsxs("div",{className:$i.PressableInner,children:[o.jsx("div",{className:$i.CheckboxIndicator,children:o.jsx(lue,{children:r==="ghost"?o.jsx(Zy,{className:"size-4"}):o.jsx("div",{className:$i.CheckboxCircle,children:o.jsx(Zy,{className:"size-4"})})})}),t]})});La.Content=Xqe;La.Item=Fqe;La.ItemActions=zqe;La.ItemAction=Vqe;La.Link=Hqe;La.Separator=qqe;La.Trigger=Gqe;La.Sub=Wqe;La.SubTrigger=Yqe;La.SubContent=Zqe;La.CheckboxItem=eXe;La.RadioGroup=Kqe;La.RadioItem=Jqe;function Nhe({label:e,menuLabel:t,items:n,placement:r="bottom-end"}){return o.jsxs(La,{children:[o.jsx(La.Trigger,{children:o.jsx(Nt,{type:"button",color:"secondary",variant:"ghost",size:"md",iconSize:"sm",uniform:!0,"aria-label":e,title:e,disabled:n.length===0,children:o.jsx(dRe,{"aria-hidden":"true"})})}),o.jsxs(La.Content,{side:r==="top-end"?"top":"bottom",align:"end",minWidth:148,children:[o.jsx("span",{className:"sr-only",children:t}),n.map(i=>o.jsx(La.Item,{disabled:i.disabled,onSelect:i.onSelect,children:o.jsx("span",{title:i.title,children:i.label})},i.label))]})]})}const tXe="_Alert_1tr02_1",nXe="_Content_1tr02_145",rXe="_Indicator_1tr02_156",iXe="_Message_1tr02_159",sXe="_Title_1tr02_162",aXe="_Description_1tr02_168",oXe="_Actions_1tr02_173",_m={Alert:tXe,Content:nXe,Indicator:rXe,Message:iXe,Title:sXe,Description:aXe,Actions:oXe},zg=({color:e="primary",variant:t="outline",title:n,description:r,actions:i,actionsPlacement:s,indicator:a,className:l,actionsClassName:c,ref:u,...d})=>{const f=p.useRef(null),h=p.useRef(null),[m,g]=p.useState("end"),{width:b}=Ele({ref:f});return p.useEffect(()=>{var O;const y=((O=h.current)==null?void 0:O.clientWidth)??0;if(y&&b){const v=y>b/3?"bottom":"end";g(v)}},[b]),o.jsxs("div",{ref:uE([u,f]),className:ur(_m.Alert,l),"data-variant":t,"data-color":e,role:e==="danger"?"alert":void 0,"data-actions-placement":s??m,...d,children:[a===!1?null:o.jsx("div",{className:_m.Indicator,children:a??o.jsx(lXe,{color:e})}),o.jsxs("div",{className:_m.Content,children:[o.jsxs("div",{className:_m.Message,children:[n&&o.jsx("div",{className:_m.Title,children:n}),r&&o.jsx("div",{className:_m.Description,children:r})]}),i&&o.jsx("div",{className:ur(_m.Actions,c),ref:h,children:i})]})]})},lXe=({color:e})=>{switch(e){case"warning":case"caution":case"danger":return o.jsx(Aae,{});case"success":return o.jsx(kae,{});default:return o.jsx(_ae,{})}};function zl({title:e,description:t,error:n,confirmLabel:r,cancelLabel:i="取消",closeLabel:s="关闭确认框",variant:a="warning",busy:l=!1,onCancel:c,onConfirm:u}){const d=p.useId(),f=p.useId(),h=p.useRef(null),m=p.useRef(l),g=p.useRef(c);return p.useEffect(()=>{m.current=l,g.current=c},[l,c]),p.useEffect(()=>{var v;const b=document.body.style.overflow,y=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(v=h.current)==null||v.focus();const O=x=>{x.key==="Escape"&&!m.current&&g.current()};return window.addEventListener("keydown",O),()=>{document.body.style.overflow=b,window.removeEventListener("keydown",O),y!=null&&y.isConnected&&y.focus()}},[]),Cr.createPortal(o.jsx("div",{className:"studio-confirm-backdrop",onMouseDown:b=>{b.target===b.currentTarget&&!l&&c()},children:o.jsxs("section",{className:`studio-confirm-dialog studio-confirm-dialog--${a}`,role:"alertdialog","aria-modal":"true","aria-labelledby":d,"aria-describedby":f,"aria-busy":l||void 0,children:[o.jsxs("header",{className:"studio-confirm-head",children:[o.jsxs("div",{className:"studio-confirm-title-wrap",children:[o.jsx("span",{className:"studio-confirm-title-icon","aria-hidden":"true",children:o.jsx(Aae,{})}),o.jsx("h2",{id:d,children:e})]}),o.jsx(Nt,{type:"button",className:"studio-confirm-close",color:"secondary",variant:"ghost",size:"lg",uniform:!0,pill:!1,onClick:c,disabled:l,"aria-label":s,children:o.jsx(e9,{})})]}),o.jsxs("div",{className:"studio-confirm-body",children:[o.jsx("p",{id:f,children:t}),n?o.jsx(zg,{className:"studio-confirm-error",color:"danger",variant:"soft",description:n}):null]}),o.jsxs("footer",{className:"studio-confirm-actions",children:[o.jsx(Nt,{ref:h,type:"button",color:"secondary",variant:"ghost",size:"lg",pill:!1,onClick:c,disabled:l,children:i}),o.jsx(Nt,{type:"button",className:"studio-confirm-primary",color:a==="danger"?"danger":"primary",size:"lg",pill:!1,loading:l,onClick:u,disabled:l,children:r})]})]})}),document.body)}const cXe="_Container_1a6nz_1",uXe="_Input_1a6nz_229",VX={Container:cXe,Input:uXe},Li=e=>{const t=p.useRef(null),r=`search-ui-input-${p.useId()}`,{id:i,name:s,type:a="text",variant:l="outline",size:c="md",gutterSize:u,className:d,autoComplete:f,disabled:h=!1,readOnly:m=!1,invalid:g=!1,allowAutofillExtensions:b=a==="password"||!!s||!!f&&f!=="off",onFocus:y,onBlur:O,onAnimationStart:v,onAutofill:x,autoSelect:w,startAdornment:S,endAdornment:E,pill:k,opticallyAlign:_,ref:C,...T}=e,A=M=>{const N=t.current;if(!M.target||!(M.target instanceof Element)||!N||N.contains(M.target)||M.target.closest("button, [type='button'], [role='button'], [role='menuitem']"))return;M.preventDefault(),document.activeElement!==N&&N.focus();const{left:D,top:Q}=N.getBoundingClientRect(),{clientX:F,clientY:$}=M,H=${var M;w&&((M=t.current)==null||M.select())},[w]);const I=M=>{v==null||v(M),M.animationName==="native-autofill-in"&&(x==null||x())};return o.jsxs("div",{className:ur(VX.Container,d),"data-variant":l,"data-size":c,"data-gutter-size":u,"data-focused":j,"data-disabled":h?"":void 0,"data-readonly":m?"":void 0,"data-invalid":g?"":void 0,"data-pill":k?"":void 0,"data-optically-align":_,"data-has-start-adornment":S?"":void 0,"data-has-end-adornment":E?"":void 0,onMouseDown:A,children:[S,o.jsx("input",{...T,ref:uE([C,t]),id:i||(b?void 0:r),className:VX.Input,type:a,name:s,autoComplete:f,readOnly:m,disabled:h,onFocus:M=>{L(!0),y==null||y(M)},onBlur:M=>{L(!1),O==null||O(M)},onAnimationStart:I,"data-lpignore":b?void 0:!0,"data-1p-ignore":b?void 0:!0}),E]})},dXe="_SelectControl_1tyi7_1",fXe="_Clear_1tyi7_436",hXe="_DropdownIcon_1tyi7_437",pXe="_TriggerText_1tyi7_468",mXe="_IndicatorWrapper_1tyi7_476",gXe="_StartIcon_1tyi7_482",bXe="_DropdownIconChevron_1tyi7_534",yXe="_LoadingIndicator_1tyi7_537",hf={SelectControl:dXe,Clear:fXe,DropdownIcon:hXe,TriggerText:pXe,IndicatorWrapper:mXe,StartIcon:gXe,DropdownIconChevron:bXe,LoadingIndicator:yXe},OXe=({ref:e,onPointerDown:t,onKeyDown:n,onPointerEnter:r,onInteract:i,invalid:s,disabled:a,children:l,className:c,variant:u="outline",size:d="md",block:f,opticallyAlign:h,pill:m=!0,loading:g,onClearClick:b,selected:y=!1,StartIcon:O,dropdownIconType:v="dropdown",...x})=>{const w=p.useRef(null),E=!!b&&y&&!g&&!a,k=v&&v!=="none"&&!g,_=E||g||k,C=!g&&!a,T=j=>{var L;switch(j.key){case"ArrowDown":case"ArrowUp":case" ":j.stopPropagation(),j.preventDefault(),i?i():(L=w.current)==null||L.dispatchEvent(new PointerEvent("pointerdown",{bubbles:!0,cancelable:!0,pointerType:"mouse"}));break;case"Enter":break;default:n==null||n(j)}},A=j=>{var L;j.button!==2&&(j.stopPropagation(),i?(j.preventDefault(),i()):(t==null||t(j),(L=x.onClick)==null||L.call(x,j)))};return o.jsxs("span",{ref:uE([w,e]),className:ur(hf.SelectControl,c),role:"button",tabIndex:a?-1:0,onPointerEnter:j=>{_9(j),r==null||r(j)},onPointerDown:C?A:void 0,onKeyDown:C?T:void 0,"data-variant":u,"data-block":f?"":void 0,"data-pill":m?"":void 0,"data-size":d,"data-optically-align":h,"aria-busy":g?"true":void 0,"data-selected":y,"data-loading":g?"":void 0,"data-invalid":s?"":void 0,"data-disabled":a?"":void 0,"aria-disabled":a,...x,onClick:void 0,children:[O&&o.jsx(O,{className:hf.StartIcon}),o.jsx("span",{className:hf.TriggerText,children:l}),_&&o.jsxs("div",{className:hf.IndicatorWrapper,children:[E&&o.jsx(Nt,{"aria-label":"Clear current value",className:hf.Clear,onPointerDown:j=>{j.stopPropagation()},onClick:j=>{j.stopPropagation(),j.preventDefault(),b()},color:"secondary",variant:k?"ghost":"solid",size:"3xs",uniform:!0,pill:m,"data-only-child":k?void 0:"",children:o.jsx(e9,{})}),g&&o.jsx(WS,{className:hf.LoadingIndicator}),k&&o.jsx(xXe,{iconType:v})]})]})},xXe=({iconType:e})=>e==="chevronDown"?o.jsx(aRe,{className:ur(hf.DropdownIcon,hf.DropdownIconChevron)}):o.jsx(fRe,{className:hf.DropdownIcon}),vXe="_Menu_n4tw6_3",wXe="_MenuList_n4tw6_5",SXe="_MenuInner_n4tw6_50",EXe="_OptionsList_n4tw6_64",kXe="_Option_n4tw6_64",_Xe="_PressableInner_n4tw6_111",TXe="_OptionInner_n4tw6_113",CXe="_OptionCheck_n4tw6_118",AXe="_OptionIndicatorSlot_n4tw6_123",NXe="_OptionGroupHeading_n4tw6_128",jXe="_OptionHardLimitHeading_n4tw6_140",RXe="_OptionsLimit_n4tw6_147",IXe="_Action_n4tw6_152",DXe="_ActionInner_n4tw6_218",PXe="_ActionsContainer_n4tw6_224",MXe="_Search_n4tw6_244",LXe="_SearchEmpty_n4tw6_247",Ti={Menu:vXe,MenuList:wXe,MenuInner:SXe,OptionsList:EXe,Option:kXe,PressableInner:_Xe,OptionInner:TXe,OptionCheck:CXe,OptionIndicatorSlot:AXe,OptionGroupHeading:NXe,OptionHardLimitHeading:jXe,OptionsLimit:RXe,Action:IXe,ActionInner:DXe,ActionsContainer:PXe,Search:MXe,SearchEmpty:LXe},jhe=p.createContext(null),fm=()=>{const e=p.use(jhe);if(!e)throw new Error("Select components must be wrapped in ");return e},LXe=({label:e})=>o.jsx(o.Fragment,{children:e}),$Xe=({label:e})=>o.jsx(o.Fragment,{children:e}),BXe=({values:e,selectedAll:t})=>{const n=t?"All selected":e.length===0?"Select...":e.length===1?e[0].label:`${e.length} selected`;return o.jsx(o.Fragment,{children:n})},qo=e=>{const{id:t,required:n,value:r,name:i,multiple:s,variant:a="outline",size:l="md",dropdownIconType:c="dropdown",loading:u=!1,clearable:d=!1,disabled:f=!1,placeholder:h="Select...",loadingPlaceholder:m="Loading...",pill:g=!0,listWidth:b,options:y,actions:O=[],side:v="bottom",avoidCollisions:x=!0,onChange:w,optionClassName:S,OptionView:E=LXe,TriggerStartIcon:k,triggerClassName:_,opticallyAlign:T,TriggerView:C,searchPlaceholder:A="",searchPredicate:j=ZXe,searchEmptyMessage:M="No results found.",listMaxWidth:I="auto"}=e,$=e.block??a!=="ghost",N=e.align??($?"center":"start"),D=e.alignOffset??(N==="center"?0:-5),Q=e.listMinWidth??($?"auto":300),F=Xp((G,J)=>{if(s){if(!G.value){w([]);return}if(J){const de=r.filter(Pe=>Pe!==G.value),ve=H4(y,de);w(ve)}else{const de=H4(y,r);w(de.concat(G))}}else w(G)}),L=p.useRef(j);L.current=j;const H=p.useMemo(()=>O,[O.length]),z=p.useRef(O);z.current=O;const B=p.useCallback(G=>{var J;(J=z.current.find(de=>de.id===G))==null||J.onSelect(G)},[]),V=p.useMemo(()=>X7(y)?y.reduce((G,J)=>G+J.options.length,0):y.length,[y]),le=`select-trigger-${p.useId()}`,be=V>15,re=p.useMemo(()=>s?{multiple:!0,value:r,TriggerView:C??BXe}:{multiple:!1,value:r,TriggerView:C??$Xe},[s,r,C]),q=p.useMemo(()=>({...re,triggerId:le,id:t,name:i,required:n,options:y,placeholder:h,loadingPlaceholder:m,loading:u,clearable:d,variant:a,pill:g,size:l,dropdownIconType:c,block:$,align:N,alignOffset:D,side:v,avoidCollisions:x,listWidth:b,listMinWidth:Q,listMaxWidth:I,searchPlaceholder:A,searchEmptyMessage:M,TriggerStartIcon:k,triggerClassName:_,opticallyAlign:T,optionClassName:S,OptionView:E,actions:H,onActionSelect:B,onSelectRef:F,searchPredicateRef:L,searchable:be,disabled:f}),[re,le,t,n,i,y,h,m,u,d,a,g,l,c,$,N,D,v,x,b,Q,I,A,M,k,_,T,S,E,H,B,F,be,f]);return o.jsx(jhe.Provider,{value:q,children:o.jsx(UXe,{})})},QXe=e=>{const{triggerId:t,id:n,required:r,value:i,multiple:s,options:a,loading:l,disabled:c,clearable:u,name:d,variant:f,pill:h,size:m,dropdownIconType:g,placeholder:b,loadingPlaceholder:y,block:O,opticallyAlign:v,triggerClassName:x,TriggerStartIcon:w,TriggerView:S,onSelectRef:E}=fm(),{onOpenChange:k,..._}=e,T=s?i[0]:i,C=l?y:b,A=p.useMemo(()=>JXe(a,T)||{value:"",label:C},[T,a,C]),j=s?i.length>0:!!i,M=l||!j,I=p.useMemo(()=>Lhe(),[]),$=p.useMemo(()=>{if(!s)return{values:[],selectedAll:!1};const Q=H4(a,i),F=a.flatMap(L=>"options"in L?L.options:L);return{values:Q.length?Q:[{value:"",label:C}],selectedAll:F.length<=i.length}},[s,a,i,C]),N=Q=>{const F=Q.key;if(!s&&$he(F)){const L=I(F);Q.stopPropagation();const H=Bhe(a,L,T);H&&E.current(H)}},D=()=>{E.current({value:"",label:""}),k==null||k(!1)};return o.jsxs(yXe,{id:t,className:x,selected:!M,variant:f,pill:h,block:O,size:m,disabled:c,loading:l,StartIcon:w,opticallyAlign:v,dropdownIconType:g,onClearClick:u?D:void 0,onInteract:k,onKeyDown:N,..._,children:[s?o.jsx(S,{...$}):o.jsx(S,{...A}),(d||n)&&o.jsx("input",{id:n,name:d,value:T,tabIndex:-1,onFocus:()=>{var Q;(Q=document.getElementById(t))==null||Q.focus()},onChange:()=>{},required:r,className:"sr-only w-full h-0 left-0 bottom-0 pointer-events-none","aria-hidden":"true"})]})},UXe=()=>{const{triggerId:e,loading:t,side:n,align:r,alignOffset:i,avoidCollisions:s,listWidth:a,listMinWidth:l,listMaxWidth:c}=fm(),[u,d]=p.useState(!1),f=p.useRef(null),h=m=>{const g=m===void 0?!u:m;d(g),g||setTimeout(()=>{var y;if(!f.current)return;const b=document.activeElement;b&&!f.current.contains(b)||(y=document.getElementById(e))==null||y.focus()})};return rE(u,()=>{h(!1)}),o.jsxs(fue,{open:u,onOpenChange:m=>{t&&m||h(m)},modal:!1,children:[o.jsx(hue,{asChild:!0,children:o.jsx(QXe,{onOpenChange:h})}),o.jsx(pue,{forceMount:!0,children:o.jsx(rO,{className:Ni.Menu,enterDuration:350,exitDuration:200,disableAnimations:!0,children:u&&o.jsx(mue,{ref:f,forceMount:!0,className:Ni.MenuList,side:n,sideOffset:5,align:r,alignOffset:i,avoidCollisions:s,collisionPadding:{bottom:30,top:30},onOpenAutoFocus:Df,onCloseAutoFocus:Df,onEscapeKeyDown:Df,style:d0({"select-list-width":a,"select-list-min-width":l,"select-list-max-width":c}),children:o.jsx(FXe,{onOpenChange:h})},"dropdown")})})]})},Rhe=p.createContext(null),iO=()=>{const e=p.use(Rhe);if(!e)throw new Error("CustomSelectMenu components must be wrapped in ");return e},FXe=({onOpenChange:e})=>{const{multiple:t,value:n,options:r,searchable:i,searchPredicateRef:s}=fm(),a=p.useRef(()=>e(!1)),l=p.useRef(null),c=p.useRef(null),u=p.useRef(null),[d,f]=p.useState(""),[h,m]=p.useState(()=>{var T;return((t?n[0]:n)||((T=p2(r))==null?void 0:T.value))??""}),g=p.useMemo(()=>Lhe(),[]),y=`select-list-${p.useId()}`,O=p.useRef(t?"":n),v=p.useMemo(()=>d.trim().toLocaleLowerCase(),[d]),x=p.useMemo(()=>KXe(r,v,s.current),[r,v,s]),w=p.useMemo(()=>p2(x),[x]),S=p.useRef(!1),E=_=>{const T=_.key,C=t?n[0]:n,A=h||(w==null?void 0:w.value)||C,j=document.activeElement===u.current,M=l.current;if(!M)return;const I=()=>{const D=new PointerEvent("pointerup",{bubbles:!0,cancelable:!0,pointerType:"mouse"}),Q=cf(h,M);Q==null||Q.dispatchEvent(D)},$=(D,Q)=>{m(D),Q.scrollIntoView({block:"nearest"})},N=()=>{const D=t?n[0]:n;if(D){const F=cf(D,M);if(F){$(D,F);return}}const Q=p2(r);if(Q){const F=cf(Q.value,M);F&&$(Q.value,F)}};switch(T){case"ArrowDown":{if(_.preventDefault(),!h||!cf(h,M)){N();return}const D=eGe(h,M),Q=D==null?void 0:D.getAttribute("data-option-id");D&&Q&&$(Q,D);return}case"ArrowUp":{if(_.preventDefault(),!h||!cf(h,M)){N();return}const D=tGe(A,M),Q=D==null?void 0:D.getAttribute("data-option-id");D&&Q&&$(Q,D);return}case"Enter":_.preventDefault(),I();return;case" ":if(v&&j)return;_.preventDefault(),I();return}if($he(T)){if(j)return;const D=g(T);_.stopPropagation();const Q=Bhe(r,D,h);if(Q){const F=cf(Q.value,M);F&&(m(Q.value),F.scrollIntoView({block:"nearest"}))}}},k=p.useMemo(()=>({valueRef:O,listId:y,highlightedValue:h,setHighlightedValue:m,requestCloseRef:a,searchTerm:d,setSearchTerm:f,searchInputRef:u,listRef:c}),[y,h,m,d,f]);return p.useEffect(()=>{wC(()=>{if(!l.current)return;const T=cf(h,l.current);T==null||T.scrollIntoView({block:"center"})});const _=u.current||l.current;return _==null||_.focus({preventScroll:!0}),()=>{S.current=!1}},[]),p.useLayoutEffect(()=>{if(!S.current){S.current=!0;return}if(!c.current)return;c.current.scrollTop=0;const _=p2(x);_&&m(_.value)},[x]),o.jsx(Rhe,{value:k,children:o.jsxs("div",{id:y,className:Ni.MenuInner,onKeyDown:E,ref:l,tabIndex:0,children:[i&&o.jsx(zXe,{value:d,onChange:f}),o.jsx(VXe,{filteredOptions:x}),o.jsx(WXe,{})]})})},zXe=({value:e,onChange:t})=>{const{searchPlaceholder:n}=fm(),{listId:r,searchInputRef:i}=iO(),s=a=>{t(a.target.value)};return o.jsx("div",{className:Ni.Search,children:o.jsx($i,{startAdornment:o.jsx(vRe,{width:16,height:16,className:"fill-secondary"}),ref:i,value:e,placeholder:n,onChange:s,autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-controls":r,"aria-expanded":!0})})},pE=e=>"options"in e,X7=e=>e[0]&&pE(e[0]),Oy=300,VXe=({filteredOptions:e})=>{const{searchEmptyMessage:t}=fm(),{listRef:n}=iO();if(!e.length)return typeof t=="string"?o.jsx("p",{className:Ni.SearchEmpty,"data-text-only":!0,children:t}):o.jsx("div",{className:Ni.SearchEmpty,children:t});const r=X7(e),i=!r&&e.length>Oy,s=r?e.map(a=>o.jsx(qXe,{...a},a.label)):e.slice(0,Oy).map(a=>o.jsx(Dhe,{...a},a.value));return o.jsxs("div",{className:Ni.OptionsList,ref:n,children:[s,i&&o.jsx(Ihe,{numHidden:e.length-Oy})]})},HXe={limit:100,label:"Show all"},qXe=({label:e,options:t,optionsLimit:n=HXe})=>{const r=p.useId(),{searchTerm:i,setHighlightedValue:s}=iO(),[a,l]=p.useState(!1),c=n.limit{l(!0),s(t[n.limit].value)};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:Ni.OptionGroupHeading,children:[o.jsx("div",{className:Ni.OptionIndicatorSlot}),e]}),d.map(h=>o.jsx(Dhe,{...h},h.value)),c&&o.jsx(XXe,{value:`group-limit-${r}`,label:n.label,onPointerUp:f}),u&&o.jsx(Ihe,{numHidden:t.length-Oy})]})},Ihe=({numHidden:e})=>o.jsxs("div",{className:Ni.OptionHardLimitHeading,children:[o.jsx("div",{className:Ni.OptionIndicatorSlot}),`…and ${e.toLocaleString()} more options. Use search to refine results further.`]}),XXe=({value:e,label:t,onPointerUp:n})=>{const{highlightedValue:r,setHighlightedValue:i}=iO(),s=e===r,a=()=>{s||i(e)},l=()=>{i(c=>c!==e?c:"")};return o.jsx("div",{className:cr(Ni.Option,Ni.OptionsLimit),"data-option-id":e,"data-highlight":s?"":void 0,role:"option","aria-selected":s,onPointerUp:n,onPointerMove:a,onPointerLeave:l,children:o.jsxs("div",{className:cr(Ni.PressableInner,Ni.OptionInner),children:[o.jsx("div",{className:Ni.OptionIndicatorSlot}),t]})})},GXe="data-option-id",Dhe=e=>{const{optionClassName:t,OptionView:n,value:r,multiple:i,onSelectRef:s}=fm(),{valueRef:a,requestCloseRef:l,highlightedValue:c,setHighlightedValue:u}=iO(),{value:d,disabled:f,tooltip:h}=e,m=a.current,g=i?r.includes(d):d===m,b=d===c,y=()=>{var x;i?s.current(e,g):(s.current(e),(x=l.current)==null||x.call(l))},O=()=>{b||u(d)},v=()=>{u(x=>x!==d?x:"")};return o.jsx("div",{className:cr(Ni.Option,t),"data-highlight":b?"":void 0,role:"option","aria-selected":b,"data-selected":g?"":void 0,[GXe]:d,onPointerUp:f?void 0:y,onPointerMove:f?void 0:O,onPointerLeave:f?void 0:v,"aria-disabled":f,"data-disabled":f?"":void 0,children:o.jsxs("div",{className:Ni.PressableInner,children:[o.jsxs("div",{className:Ni.OptionInner,children:[o.jsx("div",{className:Ni.OptionIndicatorSlot,children:g&&o.jsx(Zy,{className:Ni.OptionCheck})}),o.jsx(n,{...e}),h&&o.jsx(Eo,{content:h.content,maxWidth:h.maxWidth,side:"right",children:o.jsx(_ae,{})})]}),e.description&&o.jsxs("div",{className:Ni.OptionInner,children:[o.jsx("div",{className:Ni.OptionIndicatorSlot}),e.description]})]})})},WXe=()=>{const{actions:e}=fm();return e.length===0?null:o.jsx("div",{className:Ni.ActionsContainer,children:e.map(t=>o.jsx(YXe,{...t},t.id))})},YXe=({id:e,label:t,Icon:n,className:r})=>{const{onActionSelect:i}=fm(),{requestCloseRef:s}=iO(),a=c=>{switch(c.key){case"Tab":break;case"Enter":case" ":c.stopPropagation(),l();break;default:c.stopPropagation()}},l=()=>{var c;i(e),(c=s.current)==null||c.call(s)};return o.jsx("div",{className:Ni.Action,onPointerUp:l,onKeyDown:a,tabIndex:0,children:o.jsxs("div",{className:cr(Ni.ActionInner,r),children:[n&&o.jsx(n,{role:"presentation"}),t]})})},ZXe=(e,t)=>e.label.toLowerCase().includes(t),KXe=(e,t,n)=>{const r=t.trim().toLocaleLowerCase();if(!r)return e;const i=s=>n(s,r);return X7(e)?e.reduce((s,a)=>{const l=a.options.filter(i);return l.length&&s.push({...a,options:l}),s},[]):e.reduce((s,a)=>(i(a)&&s.push(a),s),[])},p2=e=>{if(!e.length)return;let t;for(const n of e)if(pE(n)){const r=n.options.find(i=>!i.disabled);if(r){t=r;break}}else if(!n.disabled){t=n;break}return t},JXe=(e,t)=>{let n;for(const r of e)if(pE(r)){const i=r.options.find(s=>s.value===t);if(i){n=i;break}}else if(r.value===t){n=r;break}return n},H4=(e,t)=>{let n=[];const r=new Set(t);for(const i of e)if(pE(i)){const s=i.options.filter(a=>r.has(a.value));n=n.concat(s)}else r.has(i.value)&&n.push(i);return n},Phe=40,cf=(e,t)=>t.querySelector(`[data-option-id="${e}"]`),Mhe=e=>e.matches("[data-option-id]:not([data-disabled])"),eGe=(e,t)=>{const n=cf(e,t);let r=n==null?void 0:n.nextElementSibling,i=0;for(;r&&i{const n=cf(e,t);let r=n==null?void 0:n.previousElementSibling,i=0;for(;r&&i{let e="",t;return n=>(n=n.toLowerCase(),e+=n,t&&clearTimeout(t),t=setTimeout(()=>{e=""},500),n.repeat(e.length)===e?n:e)},$he=e=>/^[a-zA-Z0-9]$/.test(e),Bhe=(e,t,n)=>{if(!e.length)return;let r,i,s=!n;const a=({disabled:l,label:c,value:u})=>u===n?(s=!0,!1):!l&&c.toLowerCase().startsWith(t);for(const l of e)if(pE(l)){for(const c of l.options)if(a(c))if(s){i=c;break}else r=r||c}else if(a(l))if(s){i=l;break}else r=r||l;return i||r};function Vs(...e){return e.filter(Boolean).join(" ")}const HX=[["14 90% 62%","28 96% 80%","3 44% 24%"],["198 72% 56%","217 88% 79%","189 42% 24%"],["263 66% 63%","291 72% 81%","242 39% 25%"],["146 49% 52%","169 66% 78%","158 38% 23%"],["334 72% 63%","15 87% 80%","350 41% 25%"]];function nGe(e){let t=2166136261;for(const a of e)t^=a.charCodeAt(0),t=Math.imul(t,16777619);const n=t>>>0,[r,i,s]=HX[n%HX.length];return{"--resource-identity-accent":r,"--resource-identity-glow":i,"--resource-identity-shadow":s,"--resource-identity-x":`${20+(n>>>7)%61}%`,"--resource-identity-y":`${18+(n>>>15)%57}%`}}function d1({seed:e,className:t}){return o.jsx("span",{className:Vs("resource-card__identity-mark",t),style:nGe(e),"aria-hidden":"true"})}function rGe(e){return o.jsx("svg",{viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",...e,children:o.jsxs("g",{transform:"translate(0.875 0.875)",children:[o.jsx("path",{d:"M5.869 10.719a4.849 4.849 0 1 0 0-9.698 4.849 4.849 0 0 0 0 9.698Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"m11.229 11.229-1.021-1.021",stroke:"currentColor",strokeWidth:"0.984375",strokeLinecap:"round",strokeLinejoin:"round"})]})})}function ih({className:e,...t}){return o.jsx("section",{className:Vs("resource-page",e),...t})}function sO({title:e,description:t,className:n}){return o.jsxs("header",{className:Vs("resource-page__header",n),children:[o.jsx("h1",{children:e}),t?o.jsx("p",{children:t}):null]})}function iGe({className:e,...t}){return o.jsx("div",{className:Vs("resource-detail",e),...t})}function sGe({className:e,...t}){return o.jsx("header",{className:Vs("resource-detail__header",e),...t})}function aGe({title:e,description:t,identitySeed:n,meta:r,backLabel:i,onBack:s}){const a=i??"返回";return o.jsxs("div",{className:"resource-detail__heading",children:[s?o.jsx("button",{type:"button",className:"resource-detail__back",onClick:s,"aria-label":a,title:a,children:o.jsx(PRe,{"aria-hidden":"true"})}):null,o.jsxs("div",{className:"resource-detail__heading-copy",children:[o.jsxs("div",{className:"resource-detail__title-row",children:[o.jsx("span",{className:"resource-detail__identity",children:o.jsx(d1,{seed:n})}),o.jsx("h1",{children:e}),r?o.jsx("div",{className:"resource-detail__meta",children:r}):null]}),t?o.jsx("p",{children:t}):null]})]})}function oGe({className:e,...t}){return o.jsx("div",{className:Vs("resource-detail__actions",e),...t})}function lGe({className:e,...t}){return o.jsx("div",{className:Vs("resource-detail__body",e),...t})}function mE({title:e,description:t,identitySeed:n,meta:r,backLabel:i,onBack:s,actions:a,className:l,actionsClassName:c,bodyClassName:u,sections:d,activeSectionKey:f,navigationLabel:h="详情导航",onSectionChange:m,children:g}){var O;const b=!!(d!=null&&d.length),y=(O=d==null?void 0:d.find(v=>v.key===f))==null?void 0:O.content;return o.jsxs(iGe,{className:l,children:[o.jsxs(sGe,{children:[o.jsx(aGe,{title:e,description:t,identitySeed:n,meta:r,backLabel:i,onBack:s}),a?o.jsx(oGe,{className:c,children:a}):null]}),o.jsx(lGe,{className:Vs(b&&"is-split",u),children:b?o.jsxs(o.Fragment,{children:[o.jsx("nav",{className:"resource-detail__navigation","aria-label":h,children:d==null?void 0:d.map(v=>o.jsx(It,{type:"button",color:"secondary",variant:v.key===f?"soft":"ghost",size:"lg",pill:!1,block:!0,"aria-current":v.key===f?"page":void 0,disabled:v.disabled,onClick:()=>m==null?void 0:m(v.key),children:o.jsx("span",{className:"resource-detail__navigation-label",children:v.label})},v.key))}),o.jsx("div",{className:"resource-detail__content",children:y})]}):g})]})}function G7({className:e,...t}){return o.jsx("dl",{className:Vs("resource-detail__summary",e),...t})}function Qhe({title:e,description:t,actions:n,className:r}){return o.jsxs("header",{className:Vs("resource-detail__section-header",r),children:[o.jsxs("div",{children:[o.jsx("h2",{children:e}),t?o.jsx("p",{children:t}):null]}),n]})}function cGe({rows:e,rowKey:t,rowLabel:n,columns:r,searchValue:i,onSearchChange:s,searchPlaceholder:a,searchLabel:l,primaryAction:c,rowActions:u,scrollRef:d,onScroll:f,busy:h,footer:m,emptyLabel:g="暂无数据"}){const b=!!u;return o.jsxs("div",{className:"resource-data-table",children:[o.jsxs("div",{className:"resource-data-table__toolbar",children:[o.jsx("div",{className:"resource-data-table__search",children:o.jsx($i,{type:"search",value:i,onChange:y=>s(y.target.value),placeholder:a,"aria-label":l})}),c?o.jsx(It,{type:"button",color:"primary",disabled:c.disabled,title:c.title,onClick:c.onClick,children:c.label}):null]}),o.jsxs("div",{ref:d,className:"resource-data-table__frame","aria-busy":h||void 0,onScroll:f,children:[o.jsxs("table",{className:"resource-data-table__table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[r.map(y=>o.jsx("th",{scope:"col",className:y.className,children:y.header},y.key)),b?o.jsx("th",{scope:"col",className:"resource-data-table__actions-heading",children:o.jsx("span",{className:"sr-only",children:"操作"})}):null]})}),o.jsx("tbody",{children:e.length===0?o.jsx("tr",{children:o.jsx("td",{className:"resource-data-table__empty",colSpan:r.length+(b?1:0),children:g})}):e.map(y=>{const O=t(y),v=(n==null?void 0:n(y))??O;return o.jsxs("tr",{children:[r.map(x=>o.jsx("td",{className:x.className,children:x.render(y)},x.key)),u?o.jsx("td",{className:"resource-data-table__actions",children:o.jsx(Nhe,{label:`更多操作 ${v}`,menuLabel:`${v} 操作`,items:u(y)})}):null]},O)})})]}),m]})]})}function g0({className:e,...t}){return o.jsx("div",{className:Vs("resource-toolbar",e),...t})}function gE({items:e,value:t,onChange:n,ariaLabel:r,idPrefix:i,className:s}){const a=c=>{c.disabled||n(c.id)},l=(c,u)=>{var g;if(!["ArrowLeft","ArrowRight","Home","End"].includes(c.key))return;c.preventDefault();const d=e.filter(b=>!b.disabled),f=d.findIndex(b=>b.id===u.id),h=c.key==="Home"?0:c.key==="End"?d.length-1:(f+(c.key==="ArrowRight"?1:-1)+d.length)%d.length,m=d[h];m&&(n(m.id),(g=document.getElementById(`${i}-${m.id}-tab`))==null||g.focus())};return o.jsx("nav",{className:Vs("resource-tabs",s),"aria-label":r,role:"tablist",children:e.map(c=>o.jsx("button",{type:"button",id:`${i}-${c.id}-tab`,className:t===c.id?"is-active":void 0,role:"tab","aria-selected":t===c.id,"aria-controls":c.panelId,tabIndex:t===c.id?0:-1,disabled:c.disabled,onClick:()=>a(c),onKeyDown:u=>l(u,c),children:c.label},c.id))})}function Gp({className:e,...t}){return o.jsxs("label",{className:Vs("resource-search",e),children:[o.jsx(rGe,{}),o.jsx("input",{type:"search",...t})]})}const uGe=150,dGe=200;function qX(e){e.dispatchEvent(new PointerEvent("pointerdown",{bubbles:!0,cancelable:!0,pointerType:"mouse",button:0}))}function HC({id:e,ariaLabel:t,value:n,options:r,onChange:i,className:s,disabled:a=!1}){const l=p.useRef(null),c=p.useRef(null),u=p.useRef(null),d=p.useRef(!1),f=p.useCallback(()=>{c.current!==null&&(window.clearTimeout(c.current),c.current=null)},[]),h=p.useCallback(()=>{u.current!==null&&(window.clearTimeout(u.current),u.current=null)},[]),m=p.useCallback(()=>{var O;return((O=l.current)==null?void 0:O.querySelector(".resource-filter-select__trigger"))??null},[]),g=p.useCallback(()=>{h();const O=m();d.current&&(O==null?void 0:O.getAttribute("data-state"))==="open"&&qX(O),d.current=!1},[h,m]),b=p.useCallback(()=>{d.current&&(h(),u.current=window.setTimeout(g,dGe))},[h,g]),y=p.useCallback(O=>{var w;if(a||!window.matchMedia("(hover: hover) and (pointer: fine)").matches)return;h();const v=m();if(!v||v.getAttribute("data-state")==="open")return;const x=document.activeElement;x instanceof HTMLElement&&x!==v&&!((w=l.current)!=null&&w.contains(x))&&x.matches("input, textarea, [contenteditable='true']")||(f(),c.current=window.setTimeout(()=>{const S=m();!S||S.getAttribute("data-state")==="open"||(d.current=!0,qX(S))},uGe))},[h,f,a,m]);return p.useEffect(()=>{const O=v=>{var k;if(!d.current)return;const x=m();if(!x||x.getAttribute("data-state")!=="open"){d.current=!1,h();return}const w=v.target;if(!(w instanceof Node))return;const S=x.getAttribute("aria-controls"),E=S?document.getElementById(S):null;if((k=l.current)!=null&&k.contains(w)||E!=null&&E.contains(w)){h();return}b()};return document.addEventListener("pointermove",O,{passive:!0}),()=>{document.removeEventListener("pointermove",O),f(),h()}},[h,f,m,b]),o.jsxs("div",{ref:l,className:Vs("resource-filter-select",s),onMouseEnter:y,onMouseLeave:()=>{f(),b()},children:[o.jsx("label",{className:"sr-only",htmlFor:e,children:t}),o.jsx(qo,{id:e,value:n,options:r,size:"md",variant:"ghost",pill:!1,block:!1,align:"end",listMinWidth:160,disabled:a,triggerClassName:"resource-filter-select__trigger",onChange:O=>i(O.value)})]})}const b0=p.forwardRef(function({className:t,...n},r){return o.jsx("section",{ref:r,className:Vs("resource-results",t),...n})});function Od(){return o.jsxs("div",{className:"resource-loading-state",role:"status","aria-live":"polite","aria-busy":"true",children:[o.jsx(ZS,{size:20}),o.jsx(En,{as:"span",duration:2.4,children:"资源加载中,请稍候"})]})}function aO({className:e,...t}){return o.jsx("div",{className:Vs("resource-grid",e),...t})}function W7({className:e,footer:t,actions:n,activateLabel:r,onActivate:i,children:s,...a}){return o.jsxs("article",{className:Vs("resource-card",i&&"is-interactive",e),...a,children:[i&&r?o.jsx("button",{type:"button",className:"resource-card__target","aria-label":r,title:r,onClick:i}):null,o.jsx("div",{className:"resource-card__content",children:s}),t||n?o.jsxs("footer",{className:"resource-card__footer",children:[t,n?o.jsx("div",{className:"resource-card__actions",children:n}):null]}):null]})}function q4({className:e,iconOnly:t=!1,tone:n="secondary",...r}){return o.jsx("button",{type:"button",className:Vs("resource-card__action",`is-${n}`,t&&"is-icon-only",e),...r})}function X4({label:e,icon:t="arrow",tone:n="primary",className:r,children:i,title:s,...a}){const l=t==="play"?o.jsx(ORe,{}):t==="plus"?o.jsx(Cae,{}):o.jsx(nRe,{});return o.jsx(q4,{className:r,iconOnly:!0,tone:n,"aria-label":e,title:s??e,...a,children:i??l})}function Y7({leading:e,title:t,titleText:n,subtitle:r,status:i}){return o.jsxs("div",{className:"resource-card__header",children:[o.jsxs("div",{className:"resource-card__identity",children:[e,o.jsxs("div",{className:"resource-card__title-copy",children:[o.jsx("h3",{title:n,children:t}),r]})]}),i]})}function Z7({children:e,title:t}){return o.jsx("p",{className:"resource-card__description",title:t,children:e})}function Uhe({items:e,className:t}){return o.jsx("dl",{className:Vs("resource-card__metadata",t),children:e.map((n,r)=>o.jsxs("div",{className:n.className,children:[o.jsx("dt",{className:n.hideLabel?"sr-only":void 0,children:n.label}),o.jsx("dd",{title:n.title,children:n.value})]},`${String(n.label)}:${r}`))})}function Vg({className:e,icon:t,children:n,...r}){return o.jsxs("button",{type:"button",className:Vs("resource-create-card",e),...r,children:[o.jsx("span",{className:"resource-create-card__icon","aria-hidden":"true",children:t}),o.jsx("span",{children:n})]})}const fGe=new Set(["avif","bmp","gif","heic","jpeg","jpg","png","svg","tif","tiff","webp"]),hGe=new Set(["avi","m4v","mkv","mov","mp4","mpeg","mpg","webm"]),pGe=new Set(["csv","htm","html","json","md","pdf","svg","txt","xml","yaml","yml"]);function Fhe(e){const t=e.lastIndexOf(".");return t<0?"":e.slice(t+1).toLocaleLowerCase()}function qC(e,t){if(!Number.isFinite(e))return t;const n=e;return n>1e10?n:n*1e3}function mGe(e){var t,n;return((t=e.actions)==null?void 0:t.artifactDelta)??((n=e.actions)==null?void 0:n.artifact_delta)}function gGe(e){return`${e.replace(/\.pptx$/i,"")}.preview.webp`}function bGe(e){var t;return(((t=e.content)==null?void 0:t.parts)??[]).map(n=>n.functionResponse??n.function_response).filter(n=>!!n)}function yGe(e){if(!e)return{};const t=e.result;return t&&typeof t=="object"&&!Array.isArray(t)?t:e}function XX(e,t,n){var r;if(/\.[A-Za-z0-9]{2,8}$/.test(e))return e;try{const i=new URL(t).pathname.split("/").filter(Boolean),a=((r=(i[i.length-1]??"").match(/\.[A-Za-z0-9]{2,8}$/))==null?void 0:r[0])??"";if(a)return`${e}${a}`}catch{}return`${e}.${n==="image"?"png":"mp4"}`}function OGe(e,t){const n=yGe(t),r=e==="image_generate"||e.endsWith("_image_generate"),i=["video_generate","video_task_query"].some(u=>e===u||e.endsWith(`_${u}`));if(!r&&!i)return[];const s=r?"image":"video",a=[],l=n.success_list;if(Array.isArray(l)){for(const u of l)if(!(!u||typeof u!="object"||Array.isArray(u)))for(const[d,f]of Object.entries(u))typeof f=="string"&&f.startsWith("https://")&&a.push({name:XX(d,f,s),url:f,type:s})}const c=n.video_url;if(i&&typeof c=="string"&&c.startsWith("https://")){const u=typeof n.task_id=="string"?n.task_id:void 0;a.push({name:XX(u||"generated-video",c,s),url:c,type:s,taskId:u})}return a}function GX(e,t){return new Date(qC(e,t)||Date.now()).toISOString()}function xGe(e){var r;const t=[],n=new Set;for(const i of e)for(const s of i.sessions){const a=qC(s.lastUpdateTime,Date.now()),l=QN(s.events);for(const c of s.events??[])for(const u of bGe(c)){const d=(u==null?void 0:u.name)??"";for(const f of OGe(d,u==null?void 0:u.response)){const h=`${s.id}:${c.id??""}:${d}:${f.url}`;n.has(h)||(n.add(h),t.push({sourceUrl:f.url,name:f.name,mimeType:f.type==="image"?"image/png":"video/mp4",appName:i.appName,agentId:i.agentId,agentName:((r=i.agentName)==null?void 0:r.trim())||i.appName,sessionId:s.id,sessionTitle:l,sessionUpdatedAt:GX(s.lastUpdateTime,a),createdAt:GX(c.timestamp,a),origin:{runtimeId:i.runtimeId,region:i.region,eventId:c.id,invocationId:c.invocationId??c.invocation_id,toolName:d,taskId:f.taskId}}))}}}return t}function zhe(e){const t=Fhe(e);return fGe.has(t)?"image":hGe.has(t)?"video":"document"}function vGe(e){const t=zhe(e);return t==="image"?"image":t==="video"?"video":pGe.has(Fhe(e))?"frame":"unavailable"}function wGe(e){var n;const t=[];for(const r of e)for(const i of r.sessions){const s=qC(i.lastUpdateTime,0),a=new Map;for(const l of i.events??[]){const c=mGe(l);if(!c)continue;const u=qC(l.timestamp,s);for(const[d,f]of Object.entries(c)){if(!d||!Number.isFinite(f))continue;const h=a.get(d);(!h||f>=h.version)&&a.set(d,{filename:d,version:f,createdAt:u})}}for(const l of a.values()){if(/\.preview\.webp$/i.test(l.filename))continue;const c=a.get(gGe(l.filename)),u=c??l,d=c?"image":vGe(l.filename);t.push({id:`${r.appName}:${i.id}:${l.filename}:${l.version}`,appName:r.appName,agentId:r.agentId,sessionId:i.id,sessionTitle:QN(i.events),agentName:((n=r.agentName)==null?void 0:n.trim())||r.appName,sessionUpdatedAt:s,name:l.filename,version:l.version,type:zhe(l.filename),createdAt:l.createdAt||s,origin:{runtimeId:r.runtimeId,region:r.region},preview:{filename:u.filename,version:u.version,mode:d}})}}return t.sort((r,i)=>i.createdAt-r.createdAt||r.name.localeCompare(i.name,"zh-CN"))}function Vhe(e){if(!e)return"时间未知";const t=new Date(e);if(Number.isNaN(t.getTime()))return"时间未知";const n=new Date;return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()?new Intl.DateTimeFormat("zh-CN",{hour:"2-digit",minute:"2-digit",hour12:!1}).format(t):new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(t)}function Hhe(e){return!e||e<=0?"":e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(e<10*1024*1024?1:0)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}const W5=40,SGe=[{id:"document",label:"文档"},{id:"image",label:"图片"},{id:"video",label:"视频"}],EGe=[{value:"all",label:"全部类型"},...SGe.map(({id:e,label:t})=>({value:e,label:t}))],kGe={document:"文档",image:"图片",video:"视频"};function m2(e){return e instanceof Error?e.message:String(e)}function qhe({artifact:e,large:t=!1}){return o.jsx("div",{className:`library-artifact-preview library-artifact-preview--${e.type}${t?" is-large":""}`,children:e.thumbnailUrl?o.jsxs(o.Fragment,{children:[o.jsx("img",{className:"library-artifact-preview-media",src:e.thumbnailUrl,alt:"",loading:"lazy"}),e.type==="video"?o.jsx("span",{className:"artifact-video-play is-overlay","aria-hidden":"true",children:o.jsx(BX,{})}):null]}):e.type==="document"?o.jsxs("div",{className:"artifact-document-sheet","aria-hidden":"true",children:[o.jsx("span",{className:"is-title"}),o.jsx("span",{}),o.jsx("span",{}),o.jsx("span",{className:"is-short"})]}):e.type==="image"?o.jsxs("div",{className:"artifact-image-scene","aria-hidden":"true",children:[o.jsx("span",{className:"artifact-image-sun"}),o.jsx("span",{className:"artifact-image-plane artifact-image-plane--back"}),o.jsx("span",{className:"artifact-image-plane artifact-image-plane--front"})]}):o.jsxs("div",{className:"artifact-video-frame","aria-hidden":"true",children:[o.jsx("span",{className:"artifact-video-orbit"}),o.jsx("span",{className:"artifact-video-node artifact-video-node--one"}),o.jsx("span",{className:"artifact-video-node artifact-video-node--two"}),o.jsx("span",{className:"artifact-video-play",children:o.jsx(BX,{})})]})})}function _Ge({artifact:e,pendingAction:t,disabled:n,onPreview:r,onDownload:i,onEdit:s,onDelete:a,onOpenSource:l}){const c=t===`download:${e.id}`;return o.jsxs("tr",{className:"library-artifact-row",children:[o.jsx("td",{className:"library-artifact-file",children:o.jsxs("button",{type:"button",className:"library-artifact-preview-trigger","aria-label":`预览 ${e.name}`,disabled:n||!!t,onClick:()=>r(e),children:[o.jsx("div",{className:"library-artifact-thumbnail",children:o.jsx(qhe,{artifact:e})}),o.jsxs("div",{className:"library-artifact-row-title",children:[o.jsx("span",{className:"library-artifact-row-name",title:e.name,children:e.name}),o.jsx("span",{className:"library-artifact-row-size",children:Hhe(e.sizeBytes)||"—"})]})]})}),o.jsx("td",{className:"library-artifact-source-cell",children:l?o.jsxs("button",{type:"button",className:"library-artifact-source-link",title:`${e.agentName} / ${e.sessionTitle}`,onClick:()=>l(e),children:[o.jsx("span",{children:e.agentName}),o.jsx("span",{"aria-hidden":"true",children:"/"}),o.jsx("span",{children:e.sessionTitle})]}):o.jsxs("span",{title:`${e.agentName} / ${e.sessionTitle}`,children:[e.agentName," / ",e.sessionTitle]})}),o.jsx("td",{className:"library-artifact-time",children:Vhe(e.updatedAt??e.createdAt)}),o.jsx("td",{className:"library-artifact-actions-cell",children:o.jsx("div",{className:"library-artifact-actions",children:o.jsx(Nhe,{label:`更多操作 ${e.name}`,menuLabel:`${e.name} 操作`,placement:"bottom-end",items:[{label:c?"下载中":"下载",onSelect:()=>i(e),disabled:n||!!t},...s?[{label:"编辑信息",onSelect:()=>s(e),disabled:n||!!t||e.canManage===!1}]:[],...a?[{label:"删除产物",onSelect:()=>a(e),disabled:n||!!t||e.canManage===!1,danger:!0}]:[]]})})})]})}function TGe({sources:e=[],items:t,userId:n="",active:r=!0,activationRevision:i=0,loading:s=!1,error:a="",onRetry:l,onEdit:c,onDelete:u,onDownload:d,onOpenSource:f,region:h,toolbarLeading:m,toolbarFilters:g}){var Ie,We;const[b,y]=p.useState("all"),[O,v]=p.useState(""),[x,w]=p.useState(null),[S,E]=p.useState(""),[k,_]=p.useState(""),[T,C]=p.useState(""),[A,j]=p.useState(""),[M,I]=p.useState({}),[$,N]=p.useState(()=>new Set),[D,Q]=p.useState(null),[F,L]=p.useState(!1),[H,z]=p.useState(""),[B,V]=p.useState(null),[W,le]=p.useState(!1),[be,re]=p.useState(W5),q=p.useRef(null),G=p.useRef(null),J=p.useRef(0),de=p.useRef(null),ve=p.useRef(null),Pe=p.useRef(!1),Ae=p.useCallback(()=>{J.current+=1,w(null),E(""),_("")},[]),Ue=p.useMemo(()=>t?[...t]:wGe(e),[t,e]),Ke=p.useMemo(()=>Ue.filter(K=>!$.has(K.id)).map(K=>M[K.id]??K),[Ue,M,$]);p.useEffect(()=>()=>{J.current+=1},[]),p.useEffect(()=>()=>{S&&URL.revokeObjectURL(S)},[S]),p.useEffect(()=>{var He;if(!x)return;const K=document.activeElement,_e=document.body.style.overflow;document.body.style.overflow="hidden",(He=q.current)==null||He.focus();const Be=Ye=>{if(Ye.key==="Escape"){Ye.preventDefault(),Ae();return}if(Ye.key!=="Tab")return;const ot=G.current;if(!ot)return;const Tt=Array.from(ot.querySelectorAll('button:not([disabled]), video[controls], iframe, [tabindex]:not([tabindex="-1"])')).filter(Ge=>Ge.getClientRects().length>0);if(Tt.length===0){Ye.preventDefault();return}const Ft=Tt[0],At=Tt[Tt.length-1];Ye.shiftKey&&document.activeElement===Ft?(Ye.preventDefault(),At.focus()):!Ye.shiftKey&&document.activeElement===At&&(Ye.preventDefault(),Ft.focus())};return document.addEventListener("keydown",Be),()=>{document.removeEventListener("keydown",Be),document.body.style.overflow=_e,K!=null&&K.isConnected&&K.focus()}},[Ae,x]);const Ce=async K=>{const _e=J.current+1;if(J.current=_e,C(""),E(""),w(K),K.preview.mode!=="unavailable"){if(K.contentUrl){E(K.contentUrl);return}_(`preview:${K.id}`);try{const Be=await m9(K.appName,n,K.sessionId,K.preview.filename,K.preview.version);if(J.current!==_e){URL.revokeObjectURL(Be);return}E(Be)}catch(Be){J.current===_e&&C(`无法预览“${K.name}”:${m2(Be)}`)}finally{J.current===_e&&_("")}}},Le=async K=>{C(""),_(`download:${K.id}`);try{d?await d(K):await p9(K.appName,n,K.sessionId,K.name,K.version),j(`已开始下载 ${K.name}`)}catch(_e){C(`无法下载“${K.name}”:${m2(_e)}`)}finally{_("")}},pe=async K=>{if(!(!D||!c)){L(!0),z("");try{const Be=await c(D,K)??{...D,...K,updatedAt:Date.now()};I(He=>({...He,[D.id]:Be})),j(`已更新 ${Be.name}`),Q(null)}catch(_e){z(m2(_e))}finally{L(!1)}}},me=async()=>{if(!(!B||!u)){le(!0),C("");try{await u(B),N(K=>new Set([...K,B.id])),j(`已删除 ${B.name}`),(x==null?void 0:x.id)===B.id&&Ae(),V(null)}catch(K){C(`无法删除“${B.name}”:${m2(K)}`),V(null)}finally{le(!1)}}},we=p.useMemo(()=>{const K=O.trim().toLocaleLowerCase();return Ke.filter(_e=>{var Be;return(Be=_e.origin)!=null&&Be.region&&_e.origin.region!==h||b!=="all"&&_e.type!==b?!1:K?[_e.name,_e.sessionTitle,_e.agentName].some(He=>He.toLocaleLowerCase().includes(K)):!0})},[b,Ke,O,h]),Ee=p.useMemo(()=>we.slice(0,be),[we,be]),st=be{Pe.current||(Pe.current=!0,re(K=>K+W5))},[]);p.useEffect(()=>{re(W5)},[i,b,O,we.length]),p.useEffect(()=>{Pe.current=!1},[be]),p.useEffect(()=>{const K=ve.current,_e=de.current;if(!r||!K||!_e||!st)return;const Be=new IntersectionObserver(([He])=>{He.isIntersecting&&$e()},{root:_e,rootMargin:"240px 0px",threshold:.01});return Be.observe(K),()=>Be.disconnect()},[r,st,$e,be]);const ie=()=>{const K=de.current;!r||!K||!st||K.scrollHeight-K.scrollTop-K.clientHeight<=240&&$e()},ce=!!O.trim()||b!=="all"||Ke.some(K=>{var _e;return((_e=K.origin)==null?void 0:_e.region)&&K.origin.region!==h});return o.jsxs("div",{className:"artifact-library-page resource-collection",children:[o.jsxs(g0,{className:"artifact-library-toolbar library-resource-toolbar",children:[m,o.jsxs("div",{className:"resource-toolbar__actions",children:[o.jsx(HC,{id:"artifact-type-filter",ariaLabel:"产物类型",value:b,options:EGe,onChange:y}),g,o.jsx(Gp,{"aria-label":"搜索产物",value:O,onChange:K=>v(K.target.value),placeholder:"搜索产物或会话"})]})]}),a&&Ke.length>0?o.jsxs("div",{className:"artifact-library-banner",role:"alert",children:[o.jsx("span",{children:a}),l?o.jsx("button",{type:"button",onClick:l,children:"重试"}):null]}):null,T?o.jsxs("div",{className:"artifact-library-banner",role:"alert",children:[o.jsx("span",{children:T}),o.jsx("button",{type:"button",onClick:()=>C(""),children:"关闭"})]}):null,o.jsx(b0,{ref:de,className:"artifact-library-results","aria-label":"产物列表",onScroll:ie,children:o.jsxs("div",{className:"artifact-library-panel",children:[s&&Ke.length===0?o.jsx(Od,{}):a&&Ke.length===0?o.jsxs("div",{className:"artifact-library-empty is-error",role:"alert",children:[o.jsx("p",{children:"产物加载失败"}),o.jsx("span",{children:a}),l?o.jsx("button",{type:"button",onClick:l,children:"重新加载"}):null]}):we.length===0?o.jsxs("div",{className:"artifact-library-empty",children:[o.jsx("p",{children:ce?"没有找到匹配的产物":"您还没有任何产物"}),o.jsx("span",{children:ce?"请尝试搜索其他名称或切换类型":"聊天中生成的产物会自动显示在这里"})]}):o.jsx("div",{className:"artifact-library-list",children:o.jsxs("table",{className:"artifact-library-table",children:[o.jsxs("colgroup",{children:[o.jsx("col",{className:"artifact-library-table__file-column"}),o.jsx("col",{className:"artifact-library-table__source-column"}),o.jsx("col",{className:"artifact-library-table__time-column"}),o.jsx("col",{className:"artifact-library-table__actions-column"})]}),o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{scope:"col",children:"名称"}),o.jsx("th",{scope:"col",children:"来源"}),o.jsx("th",{scope:"col",children:"修改时间"}),o.jsx("th",{scope:"col",className:"artifact-library-table__actions-heading",children:"操作"})]})}),o.jsx("tbody",{children:Ee.map(K=>o.jsx(_Ge,{artifact:K,pendingAction:k,disabled:!n&&!t,onPreview:_e=>void Ce(_e),onDownload:_e=>void Le(_e),onEdit:c?_e=>{z(""),Q(_e)}:void 0,onDelete:u?V:void 0,onOpenSource:f},K.id))})]})}),st?o.jsx("div",{ref:ve,className:"artifact-library-load-more",role:"status","aria-live":"polite",children:o.jsx(En,{as:"span",duration:2.4,children:"正在加载更多产物"})}):null]})}),o.jsx("p",{className:"artifact-library-status","aria-live":"polite",children:A}),x?o.jsxs("div",{className:"artifact-library-preview-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"artifact-library-preview-title",children:[o.jsx("button",{type:"button",className:"artifact-library-preview-backdrop","aria-label":"关闭预览",onClick:Ae}),o.jsxs("div",{ref:G,className:"artifact-library-preview-panel",children:[o.jsxs("header",{children:[o.jsxs("div",{children:[o.jsx("h2",{id:"artifact-library-preview-title",children:x.name}),o.jsxs("p",{children:[kGe[x.type]," / 版本 ",x.version]})]}),o.jsx("button",{ref:q,type:"button","aria-label":"关闭预览",onClick:Ae,children:o.jsx(Ehe,{})})]}),o.jsxs("div",{className:"artifact-library-preview-content",children:[o.jsx("div",{className:"artifact-library-preview-canvas",children:k===`preview:${x.id}`?o.jsx(En,{as:"span",duration:2.4,children:"正在加载预览"}):S&&x.preview.mode==="image"?o.jsx("img",{src:S,alt:`${x.name} 预览`}):S&&x.preview.mode==="video"?o.jsx("video",{src:S,controls:!0,"aria-label":`${x.name} 预览`}):S&&x.preview.mode==="frame"?o.jsx("iframe",{src:S,title:`${x.name} 预览`}):o.jsxs("div",{className:"artifact-library-preview-unavailable",children:[o.jsx(qhe,{artifact:x,large:!0}),o.jsx("p",{children:T?"预览加载失败,请稍后重试或下载查看":"当前格式暂不支持在线预览,请下载查看"})]})}),o.jsxs("aside",{className:"artifact-library-preview-details","aria-label":"产物来源",children:[x.description?o.jsx("p",{className:"artifact-library-preview-description",children:x.description}):null,o.jsxs("dl",{children:[o.jsxs("div",{children:[o.jsx("dt",{children:"Agent"}),o.jsx("dd",{title:x.agentName,children:x.agentName})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"会话"}),o.jsx("dd",{title:x.sessionTitle,children:x.sessionTitle})]}),(Ie=x.origin)!=null&&Ie.toolName?o.jsxs("div",{children:[o.jsx("dt",{children:"生成工具"}),o.jsx("dd",{children:x.origin.toolName})]}):null,o.jsxs("div",{children:[o.jsx("dt",{children:"生成时间"}),o.jsx("dd",{children:Vhe(x.createdAt)})]}),x.sizeBytes?o.jsxs("div",{children:[o.jsx("dt",{children:"文件大小"}),o.jsx("dd",{children:Hhe(x.sizeBytes)})]}):null]}),(We=x.tags)!=null&&We.length?o.jsx("div",{className:"artifact-library-preview-tags","aria-label":"标签",children:x.tags.map(K=>o.jsx("span",{children:K},K))}):null]})]}),o.jsxs("footer",{children:[o.jsxs("div",{className:"artifact-library-preview-footer-start",children:[f?o.jsxs("button",{type:"button",className:"is-secondary",onClick:()=>{const K=x;Ae(),f(K)},children:[o.jsx(eqe,{}),"查看会话"]}):null,c?o.jsxs("button",{type:"button",className:"is-secondary",disabled:x.canManage===!1,onClick:()=>{const K=x;Ae(),z(""),Q(K)},children:[o.jsx(tqe,{}),"编辑信息"]}):null]}),o.jsxs("button",{type:"button",disabled:k.startsWith("download:")||!n&&!t,onClick:()=>void Le(x),children:[o.jsx(JHe,{}),"下载"]})]})]})]}):null,D?o.jsx(iqe,{artifact:D,busy:F,error:H,onClose:()=>{F||Q(null)},onSave:K=>void pe(K)}):null,B?o.jsx(zl,{title:"删除产物?",description:`“${B.name}”将从产物库永久删除,聊天记录不会受到影响。`,confirmLabel:W?"删除中":"删除",closeLabel:"关闭删除确认框",variant:"danger",busy:W,onCancel:()=>{W||V(null)},onConfirm:()=>void me()}):null]})}function CGe(e,t){if(e&&typeof e=="object"&&"detail"in e){const n=e.detail;if(typeof n=="string"&&n.trim())return n}return t}async function bE(e,t){if(e.ok)return e;let n;try{n=await e.json()}catch{n=void 0}throw new Error(CGe(n,`${t}(${e.status})`))}function Y5(e){if(typeof e=="number")return e;if(typeof e!="string")return 0;const t=Date.parse(e);return Number.isFinite(t)?t:0}function Xhe(e){const t=e;return{...t,createdAt:Y5(t.createdAt),updatedAt:Y5(t.updatedAt),sessionUpdatedAt:Y5(t.sessionUpdatedAt)}}async function Ghe(e){const t=await e.json();return Array.isArray(t.items)?t.items.map(Xhe):[]}async function AGe(){const e=await bE(await Dn("/web/artifacts"),"读取产物库失败");return Ghe(e)}async function NGe(e){if(e.length===0)return AGe();const t=await bE(await Dn("/web/artifacts/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({candidates:e})},24e4),"同步聊天产物失败");return Ghe(t)}async function jGe(e,t){const n=await bE(await Dn(`/web/artifacts/${encodeURIComponent(e.id)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),"更新产物失败");return Xhe(await n.json())}async function RGe(e){await bE(await Dn(`/web/artifacts/${encodeURIComponent(e.id)}`,{method:"DELETE"}),"删除产物失败")}async function IGe(e){const n=await(await bE(await Dn(`/web/artifacts/${encodeURIComponent(e.id)}/content?download=true`,{},24e4),"下载产物失败")).blob(),r=URL.createObjectURL(n),i=document.createElement("a");i.href=r,i.download=e.name,document.body.appendChild(i),i.click(),i.remove(),window.setTimeout(()=>URL.revokeObjectURL(r),0)}const Whe="KNOWLEDGE_PROVIDER_ASSOCIATION_INVALID";class wj extends Error{constructor(n,r,i={}){super(n);Er(this,"status");Er(this,"errorCode");Er(this,"requestId");Er(this,"diagnostics");Er(this,"detail");Er(this,"payload");Er(this,"rawBody");this.name="KnowledgeRequestError",this.status=r;const s=typeof i=="string"?{errorCode:i}:i;this.errorCode=s.errorCode||"",this.requestId=s.requestId||"",this.diagnostics=s.diagnostics,this.detail=s.detail,this.payload=s.payload,this.rawBody=s.rawBody||""}}class Yhe extends Error{constructor(n){super(n.map(({region:r,error:i})=>`${r}: ${i.message||"读取知识库失败"}`).join(` +`));Er(this,"failures");this.name="KnowledgeRegionAggregateError",this.failures=n}}const DGe=new Set(["ak","apikey","sk","accesskey","accesskeyid","authorization","authkey","clientsecret","cookie","credential","credentials","password","passwd","privatekey","secret","secretaccesskey","secretkey","securitytoken","sessiontoken","setcookie","token"]),PGe=6,WX=50,Zhe=4e3;function MGe(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function LGe(e){const t=MGe(e);return DGe.has(t)||t.endsWith("password")||t.endsWith("secret")||t.endsWith("token")||t.endsWith("credential")}function $Ge(e){return/<\s*(?:!doctype|html|head|body|script|style)\b/i.test(e)}function qx(e){return $Ge(e)?"[HTML 内容已隐藏]":e.replace(/\bBearer\s+[^\s,;]+/gi,"Bearer [已脱敏]").replace(/\b(?:set-)?cookie\s*:\s*[^\r\n]*/gi,"cookie: [已脱敏]").replace(/\bAKLT[A-Za-z0-9_-]{6,}\b/g,"[已脱敏]").replace(/((?:access[_-]?key(?:[_-]?id)?|secret(?:[_-]?(?:access)?[_-]?key)?|session[_-]?token|security[_-]?token|client[_-]?secret|api[_-]?key|authorization|cookie|[a-z0-9_-]*(?:password|secret|token)|credential|ak|sk)\s*[:=]\s*)(?:"[^"]*"|'[^']*'|[^\s,;&]+)/gi,"$1[已脱敏]").replace(/([?&](?:access[_-]?key|api[_-]?key|client[_-]?secret|security[_-]?token|session[_-]?token|secret|token|password|authorization|cookie|credential)=)[^&#\s]+/gi,"$1[已脱敏]")}function G4(e,t=0,n=new WeakSet){if(e===null||typeof e=="number"||typeof e=="boolean")return e;if(typeof e=="string")return qx(e).slice(0,Zhe);if(typeof e!="object")return;if(t>=PGe)return"[内容过深,已截断]";if(n.has(e))return"[循环引用]";if(n.add(e),Array.isArray(e))return e.slice(0,WX).map(i=>G4(i,t+1,n));const r={};return Object.entries(e).slice(0,WX).forEach(([i,s])=>{r[i]=LGe(i)?"[已脱敏]":G4(s,t+1,n)}),r}function YX(e){if(e===void 0)return"";const t=G4(e);if(typeof t=="string")return t;if(t===void 0)return"";try{return JSON.stringify(t).slice(0,Zhe)}catch{return"[诊断信息无法显示]"}}function Ha(e,t){if(e instanceof Yhe)return e.failures.map(({region:a,error:l})=>`${a} +${Ha(l,t)}`).join(` `);if(!(e instanceof wj))return(e instanceof Error?qx(e.message):"")||t;const n=qx(e.message)||t,r=[Number.isFinite(e.status)?`状态码:${e.status}`:"",e.errorCode?`错误码:${qx(e.errorCode)}`:"",e.requestId?`请求 ID:${qx(e.requestId)}`:""].filter(Boolean).join(" · "),i=YX(e.diagnostics),s=YX(e.detail);return[n,r,i?`诊断:${i}`:"",s&&s!==n?`详情:${s}`:""].filter(Boolean).join(` -`)}function rT(...e){for(const t of e)if(typeof t=="string"&&t.trim())return t.trim();return""}function QGe(e){return Array.isArray(e)?e.map(t=>{const n=Lc(t),r=rT(n.msg,n.message);if(!r)return"";const i=Array.isArray(n.loc)?n.loc.filter(s=>typeof s=="string"||typeof s=="number").map(String).join("."):"";return i?`${i}: ${r}`:r}).filter(Boolean).join("; "):""}function UGe(e,t=!0){const n=Lc(e),r=Object.prototype.hasOwnProperty.call(n,"detail")?n.detail:typeof e=="string"?e:void 0,i=Lc(r);return{message:typeof r=="string"?t?r.trim():"":rT(i.message,n.message,QGe(r)),errorCode:rT(i.errorCode,n.errorCode),requestId:rT(i.requestId,i.request_id,i.RequestId,n.requestId,n.request_id),diagnostics:i.diagnostics??n.diagnostics,detail:r,payload:e}}function Lc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function _r(e){return typeof e=="string"?e:""}function Uw(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function K7(e){const t=Lc(e);return{id:_r(t.id),name:_r(t.name),description:_r(t.description),providerType:_r(t.providerType),providerKnowledgeId:_r(t.providerKnowledgeId),projectName:_r(t.projectName),region:_r(t.region),status:_r(t.status),createdAt:_r(t.createdAt),updatedAt:_r(t.updatedAt),ownerId:_r(t.ownerId),ownerLabel:_r(t.ownerLabel),canManage:t.canManage===!0}}function gE(e){const t=Lc(e);return{id:_r(t.id),name:_r(t.name),type:_r(t.type),sizeBytes:Uw(t.sizeBytes,0),status:_r(t.status),url:_r(t.url),tosPath:_r(t.tosPath),metadata:Lc(t.metadata),createdAt:_r(t.createdAt),updatedAt:_r(t.updatedAt),sourceMarkdown:_r(t.sourceMarkdown)}}function FGe(e){const t=Lc(e),n=t.attachment,r=Lc(n);return{id:_r(t.id),title:_r(t.title),content:_r(t.content),attachmentUrl:_r(t.attachmentUrl)||_r(r.url)||_r(r.previewUrl),attachmentType:_r(t.attachmentType)||_r(r.type)||_r(r.mimeType),attachment:n,tableFields:t.tableFields}}async function Tu(e,t={},n=_o){var f;const r=fh(t.headers);r.set("accept","application/json"),t.body&&!(t.body instanceof FormData)&&r.set("content-type","application/json");const i=await fetch(e,{...t,headers:r,signal:nl(t.signal,n)});if(i.ok)return i.status===204?void 0:i.json();const s=await i.text();let a=s,l=!1;if(s)try{a=JSON.parse(s),l=!0}catch{}const c=((f=i.headers.get("content-type"))==null?void 0:f.toLowerCase())||"",u=UGe(a,l||c.startsWith("text/plain")),d=i.status===401?"请先登录后再访问知识库":i.status===403?"你没有权限操作这个知识库":i.status===404?"知识库或知识内容不存在":i.status===409?"知识库当前状态不允许执行此操作":`知识库请求失败 (${i.status})`;throw new wj(u.message||d,i.status,{errorCode:u.errorCode,requestId:u.requestId,diagnostics:u.diagnostics,detail:u.detail,payload:u.payload,rawBody:s})}function y0(e){const t=new URLSearchParams;e.trim()&&t.set("region",e.trim());const n=t.toString();return n?`?${n}`:""}async function zGe(e){var i;const t=new URLSearchParams({region:e.region,pageSize:String(e.pageSize??30)});(i=e.projectName)!=null&&i.trim()&&t.set("projectName",e.projectName.trim()),e.nextToken&&t.set("nextToken",e.nextToken);const n=await Tu(`/web/knowledge-bases?${t.toString()}`,{signal:e.signal}),r=Lc(n);return{items:Array.isArray(r.items)?r.items.map(K7):[],nextToken:_r(r.nextToken)}}function VGe(e){return`${e.region}\0${e.id}`}async function HGe(e){var l;const t=[...new Set(e.regions.map(c=>c.trim()).filter(Boolean))],n=e.nextTokens?t.filter(c=>{var u;return!!((u=e.nextTokens)!=null&&u[c])}):t;if(n.length===0)return{items:[],nextTokens:{},failures:[]};const r=await Promise.allSettled(n.map(async c=>{var u;return{region:c,page:await zGe({region:c,projectName:e.projectName,nextToken:(u=e.nextTokens)==null?void 0:u[c],pageSize:e.pageSize,signal:e.signal})}}));if((l=e.signal)!=null&&l.aborted)throw new DOMException("Aborted","AbortError");const i=[],s={},a=new Map;if(r.forEach((c,u)=>{var f;const d=n[u];if(c.status==="rejected"){const h=(f=e.nextTokens)==null?void 0:f[d];h&&(s[d]=h),i.push({region:d,error:c.reason instanceof Error?c.reason:new Error("读取知识库失败")});return}c.value.page.nextToken&&(s[d]=c.value.page.nextToken),c.value.page.items.forEach(h=>{const m=h.region?h:{...h,region:d};a.set(VGe(m),m)})}),i.length===n.length)throw new Yhe(i);return{items:[...a.values()],nextTokens:s,failures:i}}function qGe(e){return Tu("/web/knowledge-bases",{method:"POST",body:JSON.stringify(e)},Zi).then(K7)}function XGe(e,t,n){return Tu(`/web/knowledge-bases/${encodeURIComponent(e)}${y0(t)}`,{method:"PATCH",body:JSON.stringify(n)}).then(K7)}function GGe(e,t){return Tu(`/web/knowledge-bases/${encodeURIComponent(e)}${y0(t)}`,{method:"DELETE"},Zi)}async function WGe(e,t){var s;const n=new URLSearchParams({region:t.region,offset:String(t.offset??0),limit:String(t.limit??30)});(s=t.documentType)!=null&&s.trim()&&n.set("documentType",t.documentType.trim());const r=await Tu(`/web/knowledge-bases/${encodeURIComponent(e)}/documents?${n.toString()}`,{signal:t.signal}),i=Lc(r);return{items:Array.isArray(i.items)?i.items.map(gE):[],offset:Uw(i.offset,0),limit:Uw(i.limit,t.limit??30),hasMore:i.hasMore===!0}}async function YGe(e,t,n){const r=new URLSearchParams({region:n.region,offset:String(n.offset??0),limit:String(n.limit??20)}),i=await Tu(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/${encodeURIComponent(t)}/preview?${r.toString()}`,{signal:n.signal}),s=Lc(i);return{document:gE(s.document),chunks:Array.isArray(s.chunks)?s.chunks.map(FGe):[],sourceMarkdown:_r(s.sourceMarkdown),offset:Uw(s.offset,0),limit:Uw(s.limit,n.limit??20),hasMore:s.hasMore===!0}}function ZGe(e,t,n){return Tu(`/web/knowledge-bases/${encodeURIComponent(e)}/documents${y0(t)}`,{method:"POST",body:JSON.stringify(n)},Zi).then(gE)}async function KGe(e,t,n){const r=await Tu(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/web-preview${y0(t)}`,{method:"POST",body:JSON.stringify({sourceType:"url",url:n.url})},Zi),i=Lc(r);return{name:_r(i.name),url:_r(i.url),sourceMarkdown:_r(i.sourceMarkdown)}}function JGe(e,t,n){var i,s;const r=new FormData;return r.set("file",n.file),(i=n.name)!=null&&i.trim()&&r.set("name",n.name.trim()),(s=n.documentType)!=null&&s.trim()&&r.set("documentType",n.documentType.trim()),n.metadata&&r.set("metadata",JSON.stringify(n.metadata)),Tu(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/upload${y0(t)}`,{method:"POST",body:r},Zi).then(gE)}function eWe(e,t,n,r){return Tu(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/${encodeURIComponent(t)}${y0(n)}`,{method:"PATCH",body:JSON.stringify(r)}).then(gE)}function tWe(e,t,n){return Tu(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/${encodeURIComponent(t)}${y0(n)}`,{method:"DELETE"},Zi)}function bE({className:e="",title:t,status:n,description:r,metadata:i,detailAction:s,action:a,auxiliaryAction:l}){return o.jsxs(W7,{className:`library-resource-card ${e}`.trim(),activateLabel:`${s.label} ${t}`,onActivate:s.disabled?void 0:s.onClick,footer:o.jsx(Uhe,{items:i.map(c=>({label:c.label,value:c.value,title:c.title,hideLabel:!0}))}),actions:o.jsxs(o.Fragment,{children:[l?o.jsx(X4,{className:"library-resource-card__auxiliary-action",label:`${l.label} ${t}`,tone:"secondary",disabled:l.disabled,title:l.title??l.label,onClick:l.onClick,children:l.icon}):null,a?o.jsx(X4,{label:`${a.label} ${t}`,icon:a.icon,disabled:a.disabled,title:a.title,onClick:a.onClick}):null]}),children:[o.jsx(Y7,{leading:o.jsx(d1,{seed:t}),title:t,titleText:t,status:n}),o.jsx(Z7,{title:r,children:r})]})}function gMt(){}function ZX(e){const t=[],n=String(e||"");let r=n.indexOf(","),i=0,s=!1;for(;!s;){r===-1&&(r=n.length,s=!0);const a=n.slice(i,r).trim();(a||!s)&&t.push(a),i=r+1,r=n.indexOf(",",i)}return t}function Khe(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const nWe=/[$_\p{ID_Start}]/u,rWe=/[$_\u{200C}\u{200D}\p{ID_Continue}]/u,iWe=/[-$_\u{200C}\u{200D}\p{ID_Continue}]/u,sWe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,aWe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Jhe={};function bMt(e){return e?nWe.test(String.fromCodePoint(e)):!1}function yMt(e,t){const r=(t||Jhe).jsx?iWe:rWe;return e?r.test(String.fromCodePoint(e)):!1}function KX(e,t){return(Jhe.jsx?aWe:sWe).test(e)}const oWe=/[ \t\n\f\r]/g;function lWe(e){return typeof e=="object"?e.type==="text"?JX(e.value):!1:JX(e)}function JX(e){return e.replace(oWe,"")===""}let yE=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};yE.prototype.normal={};yE.prototype.property={};yE.prototype.space=void 0;function epe(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new yE(n,r,t)}function Fw(e){return e.toLowerCase()}class il{constructor(t,n){this.attribute=n,this.property=t}}il.prototype.attribute="";il.prototype.booleanish=!1;il.prototype.boolean=!1;il.prototype.commaOrSpaceSeparated=!1;il.prototype.commaSeparated=!1;il.prototype.defined=!1;il.prototype.mustUseProperty=!1;il.prototype.number=!1;il.prototype.overloadedBoolean=!1;il.prototype.property="";il.prototype.spaceSeparated=!1;il.prototype.space=void 0;let cWe=0;const Yn=O0(),$s=O0(),W4=O0(),xt=O0(),ki=O0(),xy=O0(),yl=O0();function O0(){return 2**++cWe}const Y4=Object.freeze(Object.defineProperty({__proto__:null,boolean:Yn,booleanish:$s,commaOrSpaceSeparated:yl,commaSeparated:xy,number:xt,overloadedBoolean:W4,spaceSeparated:ki},Symbol.toStringTag,{value:"Module"})),Z5=Object.keys(Y4);class J7 extends il{constructor(t,n,r,i){let s=-1;if(super(t,n),eG(this,"space",i),typeof r=="number")for(;++s4&&n.slice(0,4)==="data"&&pWe.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(tG,gWe);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!tG.test(s)){let a=s.replace(hWe,mWe);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=J7}return new i(r,t)}function mWe(e){return"-"+e.toLowerCase()}function gWe(e){return e.charAt(1).toUpperCase()}const OE=epe([tpe,uWe,ipe,spe,ape],"html"),hm=epe([tpe,dWe,ipe,spe,ape],"svg");function nG(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function ope(e){return e.join(" ").trim()}var eB={},rG=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,bWe=/\n/g,yWe=/^\s*/,OWe=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,xWe=/^:\s*/,vWe=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,wWe=/^[;\s]*/,SWe=/^\s+|\s+$/g,EWe=` -`,iG="/",sG="*",Wm="",kWe="comment",_We="declaration";function TWe(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 i(g){var b=g.match(bWe);b&&(n+=b.length);var y=g.lastIndexOf(EWe);r=~y?g.length-y:r+g.length}function s(){var g={line:n,column:r};return function(b){return b.position=new a(g),u(),b}}function a(g){this.start=g,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function l(g){var b=new Error(t.source+":"+n+":"+r+": "+g);if(b.reason=g,b.filename=t.source,b.line=n,b.column=r,b.source=e,!t.silent)throw b}function c(g){var b=g.exec(e);if(b){var y=b[0];return i(y),e=e.slice(y.length),b}}function u(){c(yWe)}function d(g){var b;for(g=g||[];b=f();)b!==!1&&g.push(b);return g}function f(){var g=s();if(!(iG!=e.charAt(0)||sG!=e.charAt(1))){for(var b=2;Wm!=e.charAt(b)&&(sG!=e.charAt(b)||iG!=e.charAt(b+1));)++b;if(b+=2,Wm===e.charAt(b-1))return l("End of comment missing");var y=e.slice(2,b-2);return r+=2,i(y),e=e.slice(b),r+=2,g({type:kWe,comment:y})}}function h(){var g=s(),b=c(OWe);if(b){if(f(),!c(xWe))return l("property missing ':'");var y=c(vWe),O=g({type:_We,property:aG(b[0].replace(rG,Wm)),value:y?aG(y[0].replace(rG,Wm)):Wm});return c(wWe),O}}function m(){var g=[];d(g);for(var b;b=h();)b!==!1&&(g.push(b),d(g));return g}return u(),m()}function aG(e){return e?e.replace(SWe,Wm):Wm}var CWe=TWe,AWe=op&&op.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(eB,"__esModule",{value:!0});eB.default=jWe;const NWe=AWe(CWe);function jWe(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,NWe.default)(e),i=typeof t=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:a,value:l}=s;i?t(a,l,s):l&&(n=n||{},n[a]=l)}),n}var Ej={};Object.defineProperty(Ej,"__esModule",{value:!0});Ej.camelCase=void 0;var RWe=/^--[a-zA-Z0-9_-]+$/,IWe=/-([a-z])/g,DWe=/^[^-]+$/,PWe=/^-(webkit|moz|ms|o|khtml)-/,MWe=/^-(ms)-/,LWe=function(e){return!e||DWe.test(e)||RWe.test(e)},$We=function(e,t){return t.toUpperCase()},oG=function(e,t){return"".concat(t,"-")},BWe=function(e,t){return t===void 0&&(t={}),LWe(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(MWe,oG):e=e.replace(PWe,oG),e.replace(IWe,$We))};Ej.camelCase=BWe;var QWe=op&&op.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},UWe=QWe(eB),FWe=Ej;function Z4(e,t){var n={};return!e||typeof e!="string"||(0,UWe.default)(e,function(r,i){r&&i&&(n[(0,FWe.camelCase)(r,t)]=i)}),n}Z4.default=Z4;var zWe=Z4;const VWe=N1(zWe),kj=lpe("end"),Td=lpe("start");function lpe(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 HWe(e){const t=Td(e),n=kj(e);if(t&&n)return{start:t,end:n}}function jv(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?lG(e.position):"start"in e||"end"in e?lG(e):"line"in e||"column"in e?K4(e):""}function K4(e){return cG(e&&e.line)+":"+cG(e&&e.column)}function lG(e){return K4(e&&e.start)+"-"+K4(e&&e.end)}function cG(e){return e&&typeof e=="number"?e:1}class no extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},a=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(a=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?s.ruleId=r:(s.source=r.slice(0,c),s.ruleId=r.slice(c+1))}if(!s.place&&s.ancestors&&s.ancestors){const c=s.ancestors[s.ancestors.length-1];c&&(s.place=c.position)}const l=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=jv(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=a&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}no.prototype.file="";no.prototype.name="";no.prototype.reason="";no.prototype.message="";no.prototype.stack="";no.prototype.column=void 0;no.prototype.line=void 0;no.prototype.ancestors=void 0;no.prototype.cause=void 0;no.prototype.fatal=void 0;no.prototype.place=void 0;no.prototype.ruleId=void 0;no.prototype.source=void 0;const tB={}.hasOwnProperty,qWe=new Map,XWe=/[A-Z]/g,GWe=new Set(["table","tbody","thead","tfoot","tr"]),WWe=new Set(["td","th"]),cpe="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function YWe(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=iYe(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=rYe(n,t.jsx,t.jsxs)}const i={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"?hm:OE,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=upe(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function upe(e,t,n){if(t.type==="element")return ZWe(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return KWe(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return eYe(e,t,n);if(t.type==="mdxjsEsm")return JWe(e,t);if(t.type==="root")return tYe(e,t,n);if(t.type==="text")return nYe(e,t)}function ZWe(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=hm,e.schema=i),e.ancestors.push(t);const s=fpe(e,t.tagName,!1),a=sYe(e,t);let l=rB(e,t);return GWe.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!lWe(c):!0})),dpe(e,a,s,t),nB(a,l),e.ancestors.pop(),e.schema=r,e.create(t,s,a,n)}function KWe(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)}zw(e,t.position)}function JWe(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);zw(e,t.position)}function eYe(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=hm,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:fpe(e,t.name,!0),a=aYe(e,t),l=rB(e,t);return dpe(e,a,s,t),nB(a,l),e.ancestors.pop(),e.schema=r,e.create(t,s,a,n)}function tYe(e,t,n){const r={};return nB(r,rB(e,t)),e.create(t,e.Fragment,r,n)}function nYe(e,t){return t.value}function dpe(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function nB(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function rYe(e,t,n){return r;function r(i,s,a,l){const u=Array.isArray(a.children)?n:t;return l?u(s,a,l):u(s,a)}}function iYe(e,t){return n;function n(r,i,s,a){const l=Array.isArray(s.children),c=Td(r);return t(i,s,a,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function sYe(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&tB.call(t.properties,i)){const s=oYe(e,i,t.properties[i]);if(s){const[a,l]=s;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&WWe.has(t.tagName)?r=l:n[a]=l}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function aYe(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const a=s.expression;a.type;const l=a.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else zw(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,s=e.evaluater.evaluateExpression(l.expression)}else zw(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function rB(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:qWe;for(;++ri?0:i+t:t=t>i?i: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);s0?(Ll(e,e.length,0,t),e):t}const fG={}.hasOwnProperty;function ppe(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 mu(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const mo=pm(/[A-Za-z]/),Za=pm(/[\dA-Za-z]/),gYe=pm(/[#-'*+\--9=?A-Z^-~]/);function XC(e){return e!==null&&(e<32||e===127)}const J4=pm(/\d/),bYe=pm(/[\dA-Fa-f]/),yYe=pm(/[!-/:-@[-`{-~]/);function vn(e){return e!==null&&e<-2}function wi(e){return e!==null&&(e<0||e===32)}function br(e){return e===-2||e===-1||e===32}const _j=pm(new RegExp("\\p{P}|\\p{S}","u")),Hg=pm(/\s/);function pm(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function lO(e){const t=[];let n=-1,r=0,i=0;for(;++n55295&&s<57344){const l=e.charCodeAt(n+1);s<56320&&l>56319&&l<57344?(a=String.fromCharCode(s,l),i=1):a="�"}else a=String.fromCharCode(s);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Rr(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return a;function a(c){return br(c)?(e.enter(n),l(c)):t(c)}function l(c){return br(c)&&s++a))return;const k=t.events.length;let _=k,C,T;for(;_--;)if(t.events[_][0]==="exit"&&t.events[_][1].type==="chunkFlow"){if(C){T=t.events[_][1].end;break}C=!0}for(O(r),E=k;Ex;){const S=n[w];t.containerState=S[1],S[0].exit.call(t,e)}n.length=x}function v(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function SYe(e,t,n){return Rr(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function f1(e){if(e===null||wi(e)||Hg(e))return 1;if(_j(e))return 2}function Tj(e,t,n){const r=[];let i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[r][1].end},h={...e[n][1].start};pG(f,-c),pG(h,c),a={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},s={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},e[r][1].end={...a.start},e[n][1].start={...l.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Oc(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Oc(u,[["enter",i,t],["enter",a,t],["exit",a,t],["enter",s,t]]),u=Oc(u,Tj(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Oc(u,[["exit",s,t],["enter",l,t],["exit",l,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=Oc(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Ll(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n0&&br(E)?Rr(e,v,"linePrefix",s+1)(E):v(E)}function v(E){return E===null||vn(E)?e.check(mG,b,w)(E):(e.enter("codeFlowValue"),x(E))}function x(E){return E===null||vn(E)?(e.exit("codeFlowValue"),v(E)):(e.consume(E),x)}function w(E){return e.exit("codeFenced"),t(E)}function S(E,k,_){let C=0;return T;function T(M){return E.enter("lineEnding"),E.consume(M),E.exit("lineEnding"),A}function A(M){return E.enter("codeFencedFence"),br(M)?Rr(E,j,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):j(M)}function j(M){return M===l?(E.enter("codeFencedFenceSequence"),L(M)):_(M)}function L(M){return M===l?(C++,E.consume(M),L):C>=a?(E.exit("codeFencedFenceSequence"),br(M)?Rr(E,I,"whitespace")(M):I(M)):_(M)}function I(M){return M===null||vn(M)?(E.exit("codeFencedFence"),k(M)):_(M)}}}function PYe(e,t,n){const r=this;return i;function i(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s)}function s(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const J5={name:"codeIndented",tokenize:LYe},MYe={partial:!0,tokenize:$Ye};function LYe(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),Rr(e,s,"linePrefix",5)(u)}function s(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):vn(u)?e.attempt(MYe,a,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||vn(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function $Ye(e,t,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):vn(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):Rr(e,s,"linePrefix",5)(a)}function s(a){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):vn(a)?i(a):n(a)}}const BYe={name:"codeText",previous:UYe,resolve:QYe,tokenize:FYe};function QYe(e){let t=e.length-4,n=3,r,i;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 i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&ax(this.left,r),s.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),ax(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),ax(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 xpe(e,t,n,r,i,s,a,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(O){return O===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(O),e.exit(s),h):O===null||O===32||O===41||XC(O)?n(O):(e.enter(r),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),b(O))}function h(O){return O===62?(e.enter(s),e.consume(O),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),m(O))}function m(O){return O===62?(e.exit("chunkString"),e.exit(l),h(O)):O===null||O===60||vn(O)?n(O):(e.consume(O),O===92?g:m)}function g(O){return O===60||O===62||O===92?(e.consume(O),m):m(O)}function b(O){return!d&&(O===null||O===41||wi(O))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(r),t(O)):d999||m===null||m===91||m===93&&!c||m===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(m):m===93?(e.exit(s),e.enter(i),e.consume(m),e.exit(i),e.exit(r),t):vn(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(m))}function f(m){return m===null||m===91||m===93||vn(m)||l++>999?(e.exit("chunkString"),d(m)):(e.consume(m),c||(c=!br(m)),m===92?h:f)}function h(m){return m===91||m===92||m===93?(e.consume(m),l++,f):f(m)}}function wpe(e,t,n,r,i,s){let a;return l;function l(h){return h===34||h===39||h===40?(e.enter(r),e.enter(i),e.consume(h),e.exit(i),a=h===40?41:h,c):n(h)}function c(h){return h===a?(e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):(e.enter(s),u(h))}function u(h){return h===a?(e.exit(s),c(a)):h===null?n(h):vn(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),Rr(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===a||h===null||vn(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 Rv(e,t){let n;return r;function r(i){return vn(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):br(i)?Rr(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const YYe={name:"definition",tokenize:KYe},ZYe={partial:!0,tokenize:JYe};function KYe(e,t,n){const r=this;let i;return s;function s(m){return e.enter("definition"),a(m)}function a(m){return vpe.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function l(m){return i=mu(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),c):n(m)}function c(m){return wi(m)?Rv(e,u)(m):u(m)}function u(m){return xpe(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function d(m){return e.attempt(ZYe,f,f)(m)}function f(m){return br(m)?Rr(e,h,"whitespace")(m):h(m)}function h(m){return m===null||vn(m)?(e.exit("definition"),r.parser.defined.push(i),t(m)):n(m)}}function JYe(e,t,n){return r;function r(l){return wi(l)?Rv(e,i)(l):n(l)}function i(l){return wpe(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return br(l)?Rr(e,a,"whitespace")(l):a(l)}function a(l){return l===null||vn(l)?t(l):n(l)}}const eZe={name:"hardBreakEscape",tokenize:tZe};function tZe(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return vn(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const nZe={name:"headingAtx",resolve:rZe,tokenize:iZe};function rZe(e,t){let n=e.length-2,r=3,i,s;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&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Ll(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function iZe(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),s(d)}function s(d){return e.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&r++<6?(e.consume(d),a):d===null||wi(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||vn(d)?(e.exit("atxHeading"),t(d)):br(d)?Rr(e,l,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||wi(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const sZe=["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"],bG=["pre","script","style","textarea"],aZe={concrete:!0,name:"htmlFlow",resolveTo:cZe,tokenize:uZe},oZe={partial:!0,tokenize:fZe},lZe={partial:!0,tokenize:dZe};function cZe(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 uZe(e,t,n){const r=this;let i,s,a,l,c;return u;function u(B){return d(B)}function d(B){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(B),f}function f(B){return B===33?(e.consume(B),h):B===47?(e.consume(B),s=!0,b):B===63?(e.consume(B),i=3,r.interrupt?t:$):mo(B)?(e.consume(B),a=String.fromCharCode(B),y):n(B)}function h(B){return B===45?(e.consume(B),i=2,m):B===91?(e.consume(B),i=5,l=0,g):mo(B)?(e.consume(B),i=4,r.interrupt?t:$):n(B)}function m(B){return B===45?(e.consume(B),r.interrupt?t:$):n(B)}function g(B){const V="CDATA[";return B===V.charCodeAt(l++)?(e.consume(B),l===V.length?r.interrupt?t:j:g):n(B)}function b(B){return mo(B)?(e.consume(B),a=String.fromCharCode(B),y):n(B)}function y(B){if(B===null||B===47||B===62||wi(B)){const V=B===47,Z=a.toLowerCase();return!V&&!s&&bG.includes(Z)?(i=1,r.interrupt?t(B):j(B)):sZe.includes(a.toLowerCase())?(i=6,V?(e.consume(B),O):r.interrupt?t(B):j(B)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(B):s?v(B):x(B))}return B===45||Za(B)?(e.consume(B),a+=String.fromCharCode(B),y):n(B)}function O(B){return B===62?(e.consume(B),r.interrupt?t:j):n(B)}function v(B){return br(B)?(e.consume(B),v):T(B)}function x(B){return B===47?(e.consume(B),T):B===58||B===95||mo(B)?(e.consume(B),w):br(B)?(e.consume(B),x):T(B)}function w(B){return B===45||B===46||B===58||B===95||Za(B)?(e.consume(B),w):S(B)}function S(B){return B===61?(e.consume(B),E):br(B)?(e.consume(B),S):x(B)}function E(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(e.consume(B),c=B,k):br(B)?(e.consume(B),E):_(B)}function k(B){return B===c?(e.consume(B),c=null,C):B===null||vn(B)?n(B):(e.consume(B),k)}function _(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||wi(B)?S(B):(e.consume(B),_)}function C(B){return B===47||B===62||br(B)?x(B):n(B)}function T(B){return B===62?(e.consume(B),A):n(B)}function A(B){return B===null||vn(B)?j(B):br(B)?(e.consume(B),A):n(B)}function j(B){return B===45&&i===2?(e.consume(B),N):B===60&&i===1?(e.consume(B),D):B===62&&i===4?(e.consume(B),H):B===63&&i===3?(e.consume(B),$):B===93&&i===5?(e.consume(B),F):vn(B)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(oZe,z,L)(B)):B===null||vn(B)?(e.exit("htmlFlowData"),L(B)):(e.consume(B),j)}function L(B){return e.check(lZe,I,z)(B)}function I(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),M}function M(B){return B===null||vn(B)?L(B):(e.enter("htmlFlowData"),j(B))}function N(B){return B===45?(e.consume(B),$):j(B)}function D(B){return B===47?(e.consume(B),a="",Q):j(B)}function Q(B){if(B===62){const V=a.toLowerCase();return bG.includes(V)?(e.consume(B),H):j(B)}return mo(B)&&a.length<8?(e.consume(B),a+=String.fromCharCode(B),Q):j(B)}function F(B){return B===93?(e.consume(B),$):j(B)}function $(B){return B===62?(e.consume(B),H):B===45&&i===2?(e.consume(B),$):j(B)}function H(B){return B===null||vn(B)?(e.exit("htmlFlowData"),z(B)):(e.consume(B),H)}function z(B){return e.exit("htmlFlow"),t(B)}}function dZe(e,t,n){const r=this;return i;function i(a){return vn(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):n(a)}function s(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function fZe(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(xE,t,n)}}const hZe={name:"htmlText",tokenize:pZe};function pZe(e,t,n){const r=this;let i,s,a;return l;function l($){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume($),c}function c($){return $===33?(e.consume($),u):$===47?(e.consume($),S):$===63?(e.consume($),x):mo($)?(e.consume($),_):n($)}function u($){return $===45?(e.consume($),d):$===91?(e.consume($),s=0,g):mo($)?(e.consume($),v):n($)}function d($){return $===45?(e.consume($),m):n($)}function f($){return $===null?n($):$===45?(e.consume($),h):vn($)?(a=f,D($)):(e.consume($),f)}function h($){return $===45?(e.consume($),m):f($)}function m($){return $===62?N($):$===45?h($):f($)}function g($){const H="CDATA[";return $===H.charCodeAt(s++)?(e.consume($),s===H.length?b:g):n($)}function b($){return $===null?n($):$===93?(e.consume($),y):vn($)?(a=b,D($)):(e.consume($),b)}function y($){return $===93?(e.consume($),O):b($)}function O($){return $===62?N($):$===93?(e.consume($),O):b($)}function v($){return $===null||$===62?N($):vn($)?(a=v,D($)):(e.consume($),v)}function x($){return $===null?n($):$===63?(e.consume($),w):vn($)?(a=x,D($)):(e.consume($),x)}function w($){return $===62?N($):x($)}function S($){return mo($)?(e.consume($),E):n($)}function E($){return $===45||Za($)?(e.consume($),E):k($)}function k($){return vn($)?(a=k,D($)):br($)?(e.consume($),k):N($)}function _($){return $===45||Za($)?(e.consume($),_):$===47||$===62||wi($)?C($):n($)}function C($){return $===47?(e.consume($),N):$===58||$===95||mo($)?(e.consume($),T):vn($)?(a=C,D($)):br($)?(e.consume($),C):N($)}function T($){return $===45||$===46||$===58||$===95||Za($)?(e.consume($),T):A($)}function A($){return $===61?(e.consume($),j):vn($)?(a=A,D($)):br($)?(e.consume($),A):C($)}function j($){return $===null||$===60||$===61||$===62||$===96?n($):$===34||$===39?(e.consume($),i=$,L):vn($)?(a=j,D($)):br($)?(e.consume($),j):(e.consume($),I)}function L($){return $===i?(e.consume($),i=void 0,M):$===null?n($):vn($)?(a=L,D($)):(e.consume($),L)}function I($){return $===null||$===34||$===39||$===60||$===61||$===96?n($):$===47||$===62||wi($)?C($):(e.consume($),I)}function M($){return $===47||$===62||wi($)?C($):n($)}function N($){return $===62?(e.consume($),e.exit("htmlTextData"),e.exit("htmlText"),t):n($)}function D($){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume($),e.exit("lineEnding"),Q}function Q($){return br($)?Rr(e,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):F($)}function F($){return e.enter("htmlTextData"),a($)}}const aB={name:"labelEnd",resolveAll:yZe,resolveTo:OZe,tokenize:xZe},mZe={tokenize:vZe},gZe={tokenize:wZe},bZe={tokenize:SZe};function yZe(e){let t=-1;const n=[];for(;++t=3&&(u===null||vn(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===i?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),br(u)?Rr(e,l,"whitespace")(u):l(u))}}const Mo={continuation:{tokenize:IZe},exit:PZe,name:"list",tokenize:RZe},NZe={partial:!0,tokenize:MZe},jZe={partial:!0,tokenize:DZe};function RZe(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return l;function l(m){const g=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:J4(m)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(iT,n,u)(m):u(m);if(!r.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(m)}return n(m)}function c(m){return J4(m)&&++a<10?(e.consume(m),c):(!r.interrupt||a<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),u(m)):n(m)}function u(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,e.check(xE,r.interrupt?n:d,e.attempt(NZe,h,f))}function d(m){return r.containerState.initialBlankLine=!0,s++,h(m)}function f(m){return br(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),h):n(m)}function h(m){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function IZe(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(xE,i,s);function i(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Rr(e,t,"listItemIndent",r.containerState.size+1)(l)}function s(l){return r.containerState.furtherBlankLines||!br(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(jZe,t,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Rr(e,e.attempt(Mo,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function DZe(e,t,n){const r=this;return Rr(e,i,"listItemIndent",r.containerState.size+1);function i(s){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(s):n(s)}}function PZe(e){e.exit(this.containerState.type)}function MZe(e,t,n){const r=this;return Rr(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const a=r.events[r.events.length-1];return!br(s)&&a&&a[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const yG={name:"setextUnderline",resolveTo:LZe,tokenize:$Ze};function LZe(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",a,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function $Ze(e,t,n){const r=this;let i;return s;function s(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"),i=u,a(u)):n(u)}function a(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===i?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),br(u)?Rr(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||vn(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const BZe={tokenize:QZe};function QZe(e){const t=this,n=e.attempt(xE,r,e.attempt(this.parser.constructs.flowInitial,i,Rr(e,e.attempt(this.parser.constructs.flow,i,e.attempt(HYe,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const UZe={resolveAll:Epe()},FZe=Spe("string"),zZe=Spe("text");function Spe(e){return{resolveAll:Epe(e==="text"?VZe:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,a,l);return a;function a(d){return u(d)?s(d):l(d)}function l(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"),s(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const f=i[d];let h=-1;if(f)for(;++h-1){const l=a[0];typeof l=="string"?a[0]=l.slice(r):a.shift()}s>0&&a.push(e[i].slice(0,s))}return a}function rKe(e,t){let n=-1;const r=[];let i;for(;++n{const n=$c(t),r=sT(n.msg,n.message);if(!r)return"";const i=Array.isArray(n.loc)?n.loc.filter(s=>typeof s=="string"||typeof s=="number").map(String).join("."):"";return i?`${i}: ${r}`:r}).filter(Boolean).join("; "):""}function QGe(e,t=!0){const n=$c(e),r=Object.prototype.hasOwnProperty.call(n,"detail")?n.detail:typeof e=="string"?e:void 0,i=$c(r);return{message:typeof r=="string"?t?r.trim():"":sT(i.message,n.message,BGe(r)),errorCode:sT(i.errorCode,n.errorCode),requestId:sT(i.requestId,i.request_id,i.RequestId,n.requestId,n.request_id),diagnostics:i.diagnostics??n.diagnostics,detail:r,payload:e}}function $c(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function kr(e){return typeof e=="string"?e:""}function zw(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function K7(e){const t=$c(e);return{id:kr(t.id),name:kr(t.name),description:kr(t.description),providerType:kr(t.providerType),providerKnowledgeId:kr(t.providerKnowledgeId),projectName:kr(t.projectName),region:kr(t.region),status:kr(t.status),createdAt:kr(t.createdAt),updatedAt:kr(t.updatedAt),ownerId:kr(t.ownerId),ownerLabel:kr(t.ownerLabel),canManage:t.canManage===!0}}function yE(e){const t=$c(e);return{id:kr(t.id),name:kr(t.name),type:kr(t.type),sizeBytes:zw(t.sizeBytes,0),status:kr(t.status),url:kr(t.url),tosPath:kr(t.tosPath),metadata:$c(t.metadata),createdAt:kr(t.createdAt),updatedAt:kr(t.updatedAt),sourceMarkdown:kr(t.sourceMarkdown)}}function UGe(e){const t=$c(e),n=t.attachment,r=$c(n);return{id:kr(t.id),title:kr(t.title),content:kr(t.content),attachmentUrl:kr(t.attachmentUrl)||kr(r.url)||kr(r.previewUrl),attachmentType:kr(t.attachmentType)||kr(r.type)||kr(r.mimeType),attachment:n,tableFields:t.tableFields}}async function Au(e,t={},n=Ao){var f;const r=fh(t.headers);r.set("accept","application/json"),t.body&&!(t.body instanceof FormData)&&r.set("content-type","application/json");const i=await fetch(e,{...t,headers:r,signal:tl(t.signal,n)});if(i.ok)return i.status===204?void 0:i.json();const s=await i.text();let a=s,l=!1;if(s)try{a=JSON.parse(s),l=!0}catch{}const c=((f=i.headers.get("content-type"))==null?void 0:f.toLowerCase())||"",u=QGe(a,l||c.startsWith("text/plain")),d=i.status===401?"请先登录后再访问知识库":i.status===403?"你没有权限操作这个知识库":i.status===404?"知识库或知识内容不存在":i.status===409?"知识库当前状态不允许执行此操作":`知识库请求失败 (${i.status})`;throw new wj(u.message||d,i.status,{errorCode:u.errorCode,requestId:u.requestId,diagnostics:u.diagnostics,detail:u.detail,payload:u.payload,rawBody:s})}function y0(e){const t=new URLSearchParams;e.trim()&&t.set("region",e.trim());const n=t.toString();return n?`?${n}`:""}async function FGe(e){var i;const t=new URLSearchParams({region:e.region,pageSize:String(e.pageSize??30)});(i=e.projectName)!=null&&i.trim()&&t.set("projectName",e.projectName.trim()),e.nextToken&&t.set("nextToken",e.nextToken);const n=await Au(`/web/knowledge-bases?${t.toString()}`,{signal:e.signal}),r=$c(n);return{items:Array.isArray(r.items)?r.items.map(K7):[],nextToken:kr(r.nextToken)}}function zGe(e){return`${e.region}\0${e.id}`}async function VGe(e){var l;const t=[...new Set(e.regions.map(c=>c.trim()).filter(Boolean))],n=e.nextTokens?t.filter(c=>{var u;return!!((u=e.nextTokens)!=null&&u[c])}):t;if(n.length===0)return{items:[],nextTokens:{},failures:[]};const r=await Promise.allSettled(n.map(async c=>{var u;return{region:c,page:await FGe({region:c,projectName:e.projectName,nextToken:(u=e.nextTokens)==null?void 0:u[c],pageSize:e.pageSize,signal:e.signal})}}));if((l=e.signal)!=null&&l.aborted)throw new DOMException("Aborted","AbortError");const i=[],s={},a=new Map;if(r.forEach((c,u)=>{var f;const d=n[u];if(c.status==="rejected"){const h=(f=e.nextTokens)==null?void 0:f[d];h&&(s[d]=h),i.push({region:d,error:c.reason instanceof Error?c.reason:new Error("读取知识库失败")});return}c.value.page.nextToken&&(s[d]=c.value.page.nextToken),c.value.page.items.forEach(h=>{const m=h.region?h:{...h,region:d};a.set(zGe(m),m)})}),i.length===n.length)throw new Yhe(i);return{items:[...a.values()],nextTokens:s,failures:i}}function HGe(e){return Au("/web/knowledge-bases",{method:"POST",body:JSON.stringify(e)},Zi).then(K7)}function qGe(e,t,n){return Au(`/web/knowledge-bases/${encodeURIComponent(e)}${y0(t)}`,{method:"PATCH",body:JSON.stringify(n)}).then(K7)}function XGe(e,t){return Au(`/web/knowledge-bases/${encodeURIComponent(e)}${y0(t)}`,{method:"DELETE"},Zi)}async function GGe(e,t){var s;const n=new URLSearchParams({region:t.region,offset:String(t.offset??0),limit:String(t.limit??30)});(s=t.documentType)!=null&&s.trim()&&n.set("documentType",t.documentType.trim());const r=await Au(`/web/knowledge-bases/${encodeURIComponent(e)}/documents?${n.toString()}`,{signal:t.signal}),i=$c(r);return{items:Array.isArray(i.items)?i.items.map(yE):[],offset:zw(i.offset,0),limit:zw(i.limit,t.limit??30),hasMore:i.hasMore===!0}}async function WGe(e,t,n){const r=new URLSearchParams({region:n.region,offset:String(n.offset??0),limit:String(n.limit??20)}),i=await Au(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/${encodeURIComponent(t)}/preview?${r.toString()}`,{signal:n.signal}),s=$c(i);return{document:yE(s.document),chunks:Array.isArray(s.chunks)?s.chunks.map(UGe):[],sourceMarkdown:kr(s.sourceMarkdown),offset:zw(s.offset,0),limit:zw(s.limit,n.limit??20),hasMore:s.hasMore===!0}}function YGe(e,t,n){return Au(`/web/knowledge-bases/${encodeURIComponent(e)}/documents${y0(t)}`,{method:"POST",body:JSON.stringify(n)},Zi).then(yE)}async function ZGe(e,t,n){const r=await Au(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/web-preview${y0(t)}`,{method:"POST",body:JSON.stringify({sourceType:"url",url:n.url})},Zi),i=$c(r);return{name:kr(i.name),url:kr(i.url),sourceMarkdown:kr(i.sourceMarkdown)}}function KGe(e,t,n){var i,s;const r=new FormData;return r.set("file",n.file),(i=n.name)!=null&&i.trim()&&r.set("name",n.name.trim()),(s=n.documentType)!=null&&s.trim()&&r.set("documentType",n.documentType.trim()),n.metadata&&r.set("metadata",JSON.stringify(n.metadata)),Au(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/upload${y0(t)}`,{method:"POST",body:r},Zi).then(yE)}function JGe(e,t,n,r){return Au(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/${encodeURIComponent(t)}${y0(n)}`,{method:"PATCH",body:JSON.stringify(r)}).then(yE)}function eWe(e,t,n){return Au(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/${encodeURIComponent(t)}${y0(n)}`,{method:"DELETE"},Zi)}function OE({className:e="",title:t,status:n,description:r,metadata:i,detailAction:s,action:a,auxiliaryAction:l}){return o.jsxs(W7,{className:`library-resource-card ${e}`.trim(),activateLabel:`${s.label} ${t}`,onActivate:s.disabled?void 0:s.onClick,footer:o.jsx(Uhe,{items:i.map(c=>({label:c.label,value:c.value,title:c.title,hideLabel:!0}))}),actions:o.jsxs(o.Fragment,{children:[l?o.jsx(X4,{className:"library-resource-card__auxiliary-action",label:`${l.label} ${t}`,tone:"secondary",disabled:l.disabled,title:l.title??l.label,onClick:l.onClick,children:l.icon}):null,a?o.jsx(X4,{label:`${a.label} ${t}`,icon:a.icon,disabled:a.disabled,title:a.title,onClick:a.onClick}):null]}),children:[o.jsx(Y7,{leading:o.jsx(d1,{seed:t}),title:t,titleText:t,status:n}),o.jsx(Z7,{title:r,children:r})]})}function gMt(){}function ZX(e){const t=[],n=String(e||"");let r=n.indexOf(","),i=0,s=!1;for(;!s;){r===-1&&(r=n.length,s=!0);const a=n.slice(i,r).trim();(a||!s)&&t.push(a),i=r+1,r=n.indexOf(",",i)}return t}function Khe(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const tWe=/[$_\p{ID_Start}]/u,nWe=/[$_\u{200C}\u{200D}\p{ID_Continue}]/u,rWe=/[-$_\u{200C}\u{200D}\p{ID_Continue}]/u,iWe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,sWe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Jhe={};function bMt(e){return e?tWe.test(String.fromCodePoint(e)):!1}function yMt(e,t){const r=(t||Jhe).jsx?rWe:nWe;return e?r.test(String.fromCodePoint(e)):!1}function KX(e,t){return(Jhe.jsx?sWe:iWe).test(e)}const aWe=/[ \t\n\f\r]/g;function oWe(e){return typeof e=="object"?e.type==="text"?JX(e.value):!1:JX(e)}function JX(e){return e.replace(aWe,"")===""}let xE=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};xE.prototype.normal={};xE.prototype.property={};xE.prototype.space=void 0;function epe(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new xE(n,r,t)}function Vw(e){return e.toLowerCase()}class rl{constructor(t,n){this.attribute=n,this.property=t}}rl.prototype.attribute="";rl.prototype.booleanish=!1;rl.prototype.boolean=!1;rl.prototype.commaOrSpaceSeparated=!1;rl.prototype.commaSeparated=!1;rl.prototype.defined=!1;rl.prototype.mustUseProperty=!1;rl.prototype.number=!1;rl.prototype.overloadedBoolean=!1;rl.prototype.property="";rl.prototype.spaceSeparated=!1;rl.prototype.space=void 0;let lWe=0;const Gn=O0(),Ps=O0(),W4=O0(),xt=O0(),Ci=O0(),xy=O0(),yl=O0();function O0(){return 2**++lWe}const Y4=Object.freeze(Object.defineProperty({__proto__:null,boolean:Gn,booleanish:Ps,commaOrSpaceSeparated:yl,commaSeparated:xy,number:xt,overloadedBoolean:W4,spaceSeparated:Ci},Symbol.toStringTag,{value:"Module"})),Z5=Object.keys(Y4);class J7 extends rl{constructor(t,n,r,i){let s=-1;if(super(t,n),eG(this,"space",i),typeof r=="number")for(;++s4&&n.slice(0,4)==="data"&&hWe.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(tG,mWe);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!tG.test(s)){let a=s.replace(fWe,pWe);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=J7}return new i(r,t)}function pWe(e){return"-"+e.toLowerCase()}function mWe(e){return e.charAt(1).toUpperCase()}const vE=epe([tpe,cWe,ipe,spe,ape],"html"),hm=epe([tpe,uWe,ipe,spe,ape],"svg");function nG(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function ope(e){return e.join(" ").trim()}var eB={},rG=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,gWe=/\n/g,bWe=/^\s*/,yWe=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,OWe=/^:\s*/,xWe=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,vWe=/^[;\s]*/,wWe=/^\s+|\s+$/g,SWe=` +`,iG="/",sG="*",Wm="",EWe="comment",kWe="declaration";function _We(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 i(g){var b=g.match(gWe);b&&(n+=b.length);var y=g.lastIndexOf(SWe);r=~y?g.length-y:r+g.length}function s(){var g={line:n,column:r};return function(b){return b.position=new a(g),u(),b}}function a(g){this.start=g,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function l(g){var b=new Error(t.source+":"+n+":"+r+": "+g);if(b.reason=g,b.filename=t.source,b.line=n,b.column=r,b.source=e,!t.silent)throw b}function c(g){var b=g.exec(e);if(b){var y=b[0];return i(y),e=e.slice(y.length),b}}function u(){c(bWe)}function d(g){var b;for(g=g||[];b=f();)b!==!1&&g.push(b);return g}function f(){var g=s();if(!(iG!=e.charAt(0)||sG!=e.charAt(1))){for(var b=2;Wm!=e.charAt(b)&&(sG!=e.charAt(b)||iG!=e.charAt(b+1));)++b;if(b+=2,Wm===e.charAt(b-1))return l("End of comment missing");var y=e.slice(2,b-2);return r+=2,i(y),e=e.slice(b),r+=2,g({type:EWe,comment:y})}}function h(){var g=s(),b=c(yWe);if(b){if(f(),!c(OWe))return l("property missing ':'");var y=c(xWe),O=g({type:kWe,property:aG(b[0].replace(rG,Wm)),value:y?aG(y[0].replace(rG,Wm)):Wm});return c(vWe),O}}function m(){var g=[];d(g);for(var b;b=h();)b!==!1&&(g.push(b),d(g));return g}return u(),m()}function aG(e){return e?e.replace(wWe,Wm):Wm}var TWe=_We,CWe=op&&op.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(eB,"__esModule",{value:!0});eB.default=NWe;const AWe=CWe(TWe);function NWe(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,AWe.default)(e),i=typeof t=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:a,value:l}=s;i?t(a,l,s):l&&(n=n||{},n[a]=l)}),n}var Ej={};Object.defineProperty(Ej,"__esModule",{value:!0});Ej.camelCase=void 0;var jWe=/^--[a-zA-Z0-9_-]+$/,RWe=/-([a-z])/g,IWe=/^[^-]+$/,DWe=/^-(webkit|moz|ms|o|khtml)-/,PWe=/^-(ms)-/,MWe=function(e){return!e||IWe.test(e)||jWe.test(e)},LWe=function(e,t){return t.toUpperCase()},oG=function(e,t){return"".concat(t,"-")},$We=function(e,t){return t===void 0&&(t={}),MWe(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(PWe,oG):e=e.replace(DWe,oG),e.replace(RWe,LWe))};Ej.camelCase=$We;var BWe=op&&op.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},QWe=BWe(eB),UWe=Ej;function Z4(e,t){var n={};return!e||typeof e!="string"||(0,QWe.default)(e,function(r,i){r&&i&&(n[(0,UWe.camelCase)(r,t)]=i)}),n}Z4.default=Z4;var FWe=Z4;const zWe=N1(FWe),kj=lpe("end"),Ad=lpe("start");function lpe(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 VWe(e){const t=Ad(e),n=kj(e);if(t&&n)return{start:t,end:n}}function Iv(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?lG(e.position):"start"in e||"end"in e?lG(e):"line"in e||"column"in e?K4(e):""}function K4(e){return cG(e&&e.line)+":"+cG(e&&e.column)}function lG(e){return K4(e&&e.start)+"-"+K4(e&&e.end)}function cG(e){return e&&typeof e=="number"?e:1}class Ja extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},a=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(a=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?s.ruleId=r:(s.source=r.slice(0,c),s.ruleId=r.slice(c+1))}if(!s.place&&s.ancestors&&s.ancestors){const c=s.ancestors[s.ancestors.length-1];c&&(s.place=c.position)}const l=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=Iv(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=a&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ja.prototype.file="";Ja.prototype.name="";Ja.prototype.reason="";Ja.prototype.message="";Ja.prototype.stack="";Ja.prototype.column=void 0;Ja.prototype.line=void 0;Ja.prototype.ancestors=void 0;Ja.prototype.cause=void 0;Ja.prototype.fatal=void 0;Ja.prototype.place=void 0;Ja.prototype.ruleId=void 0;Ja.prototype.source=void 0;const tB={}.hasOwnProperty,HWe=new Map,qWe=/[A-Z]/g,XWe=new Set(["table","tbody","thead","tfoot","tr"]),GWe=new Set(["td","th"]),cpe="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function WWe(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=rYe(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=nYe(n,t.jsx,t.jsxs)}const i={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"?hm:vE,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=upe(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function upe(e,t,n){if(t.type==="element")return YWe(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return ZWe(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return JWe(e,t,n);if(t.type==="mdxjsEsm")return KWe(e,t);if(t.type==="root")return eYe(e,t,n);if(t.type==="text")return tYe(e,t)}function YWe(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=hm,e.schema=i),e.ancestors.push(t);const s=fpe(e,t.tagName,!1),a=iYe(e,t);let l=rB(e,t);return XWe.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!oWe(c):!0})),dpe(e,a,s,t),nB(a,l),e.ancestors.pop(),e.schema=r,e.create(t,s,a,n)}function ZWe(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)}Hw(e,t.position)}function KWe(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Hw(e,t.position)}function JWe(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=hm,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:fpe(e,t.name,!0),a=sYe(e,t),l=rB(e,t);return dpe(e,a,s,t),nB(a,l),e.ancestors.pop(),e.schema=r,e.create(t,s,a,n)}function eYe(e,t,n){const r={};return nB(r,rB(e,t)),e.create(t,e.Fragment,r,n)}function tYe(e,t){return t.value}function dpe(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function nB(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function nYe(e,t,n){return r;function r(i,s,a,l){const u=Array.isArray(a.children)?n:t;return l?u(s,a,l):u(s,a)}}function rYe(e,t){return n;function n(r,i,s,a){const l=Array.isArray(s.children),c=Ad(r);return t(i,s,a,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function iYe(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&tB.call(t.properties,i)){const s=aYe(e,i,t.properties[i]);if(s){const[a,l]=s;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&GWe.has(t.tagName)?r=l:n[a]=l}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function sYe(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const a=s.expression;a.type;const l=a.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else Hw(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,s=e.evaluater.evaluateExpression(l.expression)}else Hw(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function rB(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:HWe;for(;++ri?0:i+t:t=t>i?i: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);s0?(Ll(e,e.length,0,t),e):t}const fG={}.hasOwnProperty;function ppe(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 bu(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const yo=pm(/[A-Za-z]/),Ga=pm(/[\dA-Za-z]/),mYe=pm(/[#-'*+\--9=?A-Z^-~]/);function XC(e){return e!==null&&(e<32||e===127)}const J4=pm(/\d/),gYe=pm(/[\dA-Fa-f]/),bYe=pm(/[!-/:-@[-`{-~]/);function On(e){return e!==null&&e<-2}function Ei(e){return e!==null&&(e<0||e===32)}function br(e){return e===-2||e===-1||e===32}const _j=pm(new RegExp("\\p{P}|\\p{S}","u")),Hg=pm(/\s/);function pm(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function lO(e){const t=[];let n=-1,r=0,i=0;for(;++n55295&&s<57344){const l=e.charCodeAt(n+1);s<56320&&l>56319&&l<57344?(a=String.fromCharCode(s,l),i=1):a="�"}else a=String.fromCharCode(s);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Dr(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return a;function a(c){return br(c)?(e.enter(n),l(c)):t(c)}function l(c){return br(c)&&s++a))return;const k=t.events.length;let _=k,T,C;for(;_--;)if(t.events[_][0]==="exit"&&t.events[_][1].type==="chunkFlow"){if(T){C=t.events[_][1].end;break}T=!0}for(O(r),E=k;Ex;){const S=n[w];t.containerState=S[1],S[0].exit.call(t,e)}n.length=x}function v(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function wYe(e,t,n){return Dr(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function f1(e){if(e===null||Ei(e)||Hg(e))return 1;if(_j(e))return 2}function Tj(e,t,n){const r=[];let i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[r][1].end},h={...e[n][1].start};pG(f,-c),pG(h,c),a={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},s={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},e[r][1].end={...a.start},e[n][1].start={...l.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=xc(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=xc(u,[["enter",i,t],["enter",a,t],["exit",a,t],["enter",s,t]]),u=xc(u,Tj(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=xc(u,[["exit",s,t],["enter",l,t],["exit",l,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=xc(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Ll(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n0&&br(E)?Dr(e,v,"linePrefix",s+1)(E):v(E)}function v(E){return E===null||On(E)?e.check(mG,b,w)(E):(e.enter("codeFlowValue"),x(E))}function x(E){return E===null||On(E)?(e.exit("codeFlowValue"),v(E)):(e.consume(E),x)}function w(E){return e.exit("codeFenced"),t(E)}function S(E,k,_){let T=0;return C;function C($){return E.enter("lineEnding"),E.consume($),E.exit("lineEnding"),A}function A($){return E.enter("codeFencedFence"),br($)?Dr(E,j,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):j($)}function j($){return $===l?(E.enter("codeFencedFenceSequence"),M($)):_($)}function M($){return $===l?(T++,E.consume($),M):T>=a?(E.exit("codeFencedFenceSequence"),br($)?Dr(E,I,"whitespace")($):I($)):_($)}function I($){return $===null||On($)?(E.exit("codeFencedFence"),k($)):_($)}}}function DYe(e,t,n){const r=this;return i;function i(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s)}function s(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const J5={name:"codeIndented",tokenize:MYe},PYe={partial:!0,tokenize:LYe};function MYe(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),Dr(e,s,"linePrefix",5)(u)}function s(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):On(u)?e.attempt(PYe,a,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||On(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function LYe(e,t,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):On(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):Dr(e,s,"linePrefix",5)(a)}function s(a){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):On(a)?i(a):n(a)}}const $Ye={name:"codeText",previous:QYe,resolve:BYe,tokenize:UYe};function BYe(e){let t=e.length-4,n=3,r,i;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 i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&ax(this.left,r),s.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),ax(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),ax(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 xpe(e,t,n,r,i,s,a,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(O){return O===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(O),e.exit(s),h):O===null||O===32||O===41||XC(O)?n(O):(e.enter(r),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),b(O))}function h(O){return O===62?(e.enter(s),e.consume(O),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),m(O))}function m(O){return O===62?(e.exit("chunkString"),e.exit(l),h(O)):O===null||O===60||On(O)?n(O):(e.consume(O),O===92?g:m)}function g(O){return O===60||O===62||O===92?(e.consume(O),m):m(O)}function b(O){return!d&&(O===null||O===41||Ei(O))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(r),t(O)):d999||m===null||m===91||m===93&&!c||m===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(m):m===93?(e.exit(s),e.enter(i),e.consume(m),e.exit(i),e.exit(r),t):On(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(m))}function f(m){return m===null||m===91||m===93||On(m)||l++>999?(e.exit("chunkString"),d(m)):(e.consume(m),c||(c=!br(m)),m===92?h:f)}function h(m){return m===91||m===92||m===93?(e.consume(m),l++,f):f(m)}}function wpe(e,t,n,r,i,s){let a;return l;function l(h){return h===34||h===39||h===40?(e.enter(r),e.enter(i),e.consume(h),e.exit(i),a=h===40?41:h,c):n(h)}function c(h){return h===a?(e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):(e.enter(s),u(h))}function u(h){return h===a?(e.exit(s),c(a)):h===null?n(h):On(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),Dr(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===a||h===null||On(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 Dv(e,t){let n;return r;function r(i){return On(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):br(i)?Dr(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const WYe={name:"definition",tokenize:ZYe},YYe={partial:!0,tokenize:KYe};function ZYe(e,t,n){const r=this;let i;return s;function s(m){return e.enter("definition"),a(m)}function a(m){return vpe.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function l(m){return i=bu(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),c):n(m)}function c(m){return Ei(m)?Dv(e,u)(m):u(m)}function u(m){return xpe(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function d(m){return e.attempt(YYe,f,f)(m)}function f(m){return br(m)?Dr(e,h,"whitespace")(m):h(m)}function h(m){return m===null||On(m)?(e.exit("definition"),r.parser.defined.push(i),t(m)):n(m)}}function KYe(e,t,n){return r;function r(l){return Ei(l)?Dv(e,i)(l):n(l)}function i(l){return wpe(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return br(l)?Dr(e,a,"whitespace")(l):a(l)}function a(l){return l===null||On(l)?t(l):n(l)}}const JYe={name:"hardBreakEscape",tokenize:eZe};function eZe(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return On(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const tZe={name:"headingAtx",resolve:nZe,tokenize:rZe};function nZe(e,t){let n=e.length-2,r=3,i,s;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&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Ll(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function rZe(e,t,n){let r=0;return i;function i(d){return e.enter("atxHeading"),s(d)}function s(d){return e.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&r++<6?(e.consume(d),a):d===null||Ei(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||On(d)?(e.exit("atxHeading"),t(d)):br(d)?Dr(e,l,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||Ei(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const iZe=["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"],bG=["pre","script","style","textarea"],sZe={concrete:!0,name:"htmlFlow",resolveTo:lZe,tokenize:cZe},aZe={partial:!0,tokenize:dZe},oZe={partial:!0,tokenize:uZe};function lZe(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 cZe(e,t,n){const r=this;let i,s,a,l,c;return u;function u(B){return d(B)}function d(B){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(B),f}function f(B){return B===33?(e.consume(B),h):B===47?(e.consume(B),s=!0,b):B===63?(e.consume(B),i=3,r.interrupt?t:L):yo(B)?(e.consume(B),a=String.fromCharCode(B),y):n(B)}function h(B){return B===45?(e.consume(B),i=2,m):B===91?(e.consume(B),i=5,l=0,g):yo(B)?(e.consume(B),i=4,r.interrupt?t:L):n(B)}function m(B){return B===45?(e.consume(B),r.interrupt?t:L):n(B)}function g(B){const V="CDATA[";return B===V.charCodeAt(l++)?(e.consume(B),l===V.length?r.interrupt?t:j:g):n(B)}function b(B){return yo(B)?(e.consume(B),a=String.fromCharCode(B),y):n(B)}function y(B){if(B===null||B===47||B===62||Ei(B)){const V=B===47,W=a.toLowerCase();return!V&&!s&&bG.includes(W)?(i=1,r.interrupt?t(B):j(B)):iZe.includes(a.toLowerCase())?(i=6,V?(e.consume(B),O):r.interrupt?t(B):j(B)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(B):s?v(B):x(B))}return B===45||Ga(B)?(e.consume(B),a+=String.fromCharCode(B),y):n(B)}function O(B){return B===62?(e.consume(B),r.interrupt?t:j):n(B)}function v(B){return br(B)?(e.consume(B),v):C(B)}function x(B){return B===47?(e.consume(B),C):B===58||B===95||yo(B)?(e.consume(B),w):br(B)?(e.consume(B),x):C(B)}function w(B){return B===45||B===46||B===58||B===95||Ga(B)?(e.consume(B),w):S(B)}function S(B){return B===61?(e.consume(B),E):br(B)?(e.consume(B),S):x(B)}function E(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(e.consume(B),c=B,k):br(B)?(e.consume(B),E):_(B)}function k(B){return B===c?(e.consume(B),c=null,T):B===null||On(B)?n(B):(e.consume(B),k)}function _(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||Ei(B)?S(B):(e.consume(B),_)}function T(B){return B===47||B===62||br(B)?x(B):n(B)}function C(B){return B===62?(e.consume(B),A):n(B)}function A(B){return B===null||On(B)?j(B):br(B)?(e.consume(B),A):n(B)}function j(B){return B===45&&i===2?(e.consume(B),N):B===60&&i===1?(e.consume(B),D):B===62&&i===4?(e.consume(B),H):B===63&&i===3?(e.consume(B),L):B===93&&i===5?(e.consume(B),F):On(B)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(aZe,z,M)(B)):B===null||On(B)?(e.exit("htmlFlowData"),M(B)):(e.consume(B),j)}function M(B){return e.check(oZe,I,z)(B)}function I(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),$}function $(B){return B===null||On(B)?M(B):(e.enter("htmlFlowData"),j(B))}function N(B){return B===45?(e.consume(B),L):j(B)}function D(B){return B===47?(e.consume(B),a="",Q):j(B)}function Q(B){if(B===62){const V=a.toLowerCase();return bG.includes(V)?(e.consume(B),H):j(B)}return yo(B)&&a.length<8?(e.consume(B),a+=String.fromCharCode(B),Q):j(B)}function F(B){return B===93?(e.consume(B),L):j(B)}function L(B){return B===62?(e.consume(B),H):B===45&&i===2?(e.consume(B),L):j(B)}function H(B){return B===null||On(B)?(e.exit("htmlFlowData"),z(B)):(e.consume(B),H)}function z(B){return e.exit("htmlFlow"),t(B)}}function uZe(e,t,n){const r=this;return i;function i(a){return On(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):n(a)}function s(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function dZe(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(wE,t,n)}}const fZe={name:"htmlText",tokenize:hZe};function hZe(e,t,n){const r=this;let i,s,a;return l;function l(L){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(L),c}function c(L){return L===33?(e.consume(L),u):L===47?(e.consume(L),S):L===63?(e.consume(L),x):yo(L)?(e.consume(L),_):n(L)}function u(L){return L===45?(e.consume(L),d):L===91?(e.consume(L),s=0,g):yo(L)?(e.consume(L),v):n(L)}function d(L){return L===45?(e.consume(L),m):n(L)}function f(L){return L===null?n(L):L===45?(e.consume(L),h):On(L)?(a=f,D(L)):(e.consume(L),f)}function h(L){return L===45?(e.consume(L),m):f(L)}function m(L){return L===62?N(L):L===45?h(L):f(L)}function g(L){const H="CDATA[";return L===H.charCodeAt(s++)?(e.consume(L),s===H.length?b:g):n(L)}function b(L){return L===null?n(L):L===93?(e.consume(L),y):On(L)?(a=b,D(L)):(e.consume(L),b)}function y(L){return L===93?(e.consume(L),O):b(L)}function O(L){return L===62?N(L):L===93?(e.consume(L),O):b(L)}function v(L){return L===null||L===62?N(L):On(L)?(a=v,D(L)):(e.consume(L),v)}function x(L){return L===null?n(L):L===63?(e.consume(L),w):On(L)?(a=x,D(L)):(e.consume(L),x)}function w(L){return L===62?N(L):x(L)}function S(L){return yo(L)?(e.consume(L),E):n(L)}function E(L){return L===45||Ga(L)?(e.consume(L),E):k(L)}function k(L){return On(L)?(a=k,D(L)):br(L)?(e.consume(L),k):N(L)}function _(L){return L===45||Ga(L)?(e.consume(L),_):L===47||L===62||Ei(L)?T(L):n(L)}function T(L){return L===47?(e.consume(L),N):L===58||L===95||yo(L)?(e.consume(L),C):On(L)?(a=T,D(L)):br(L)?(e.consume(L),T):N(L)}function C(L){return L===45||L===46||L===58||L===95||Ga(L)?(e.consume(L),C):A(L)}function A(L){return L===61?(e.consume(L),j):On(L)?(a=A,D(L)):br(L)?(e.consume(L),A):T(L)}function j(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(e.consume(L),i=L,M):On(L)?(a=j,D(L)):br(L)?(e.consume(L),j):(e.consume(L),I)}function M(L){return L===i?(e.consume(L),i=void 0,$):L===null?n(L):On(L)?(a=M,D(L)):(e.consume(L),M)}function I(L){return L===null||L===34||L===39||L===60||L===61||L===96?n(L):L===47||L===62||Ei(L)?T(L):(e.consume(L),I)}function $(L){return L===47||L===62||Ei(L)?T(L):n(L)}function N(L){return L===62?(e.consume(L),e.exit("htmlTextData"),e.exit("htmlText"),t):n(L)}function D(L){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),Q}function Q(L){return br(L)?Dr(e,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):F(L)}function F(L){return e.enter("htmlTextData"),a(L)}}const aB={name:"labelEnd",resolveAll:bZe,resolveTo:yZe,tokenize:OZe},pZe={tokenize:xZe},mZe={tokenize:vZe},gZe={tokenize:wZe};function bZe(e){let t=-1;const n=[];for(;++t=3&&(u===null||On(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===i?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),br(u)?Dr(e,l,"whitespace")(u):l(u))}}const Po={continuation:{tokenize:RZe},exit:DZe,name:"list",tokenize:jZe},AZe={partial:!0,tokenize:PZe},NZe={partial:!0,tokenize:IZe};function jZe(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return l;function l(m){const g=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:J4(m)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(aT,n,u)(m):u(m);if(!r.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(m)}return n(m)}function c(m){return J4(m)&&++a<10?(e.consume(m),c):(!r.interrupt||a<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(e.exit("listItemValue"),u(m)):n(m)}function u(m){return e.enter("listItemMarker"),e.consume(m),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,e.check(wE,r.interrupt?n:d,e.attempt(AZe,h,f))}function d(m){return r.containerState.initialBlankLine=!0,s++,h(m)}function f(m){return br(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),h):n(m)}function h(m){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function RZe(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(wE,i,s);function i(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Dr(e,t,"listItemIndent",r.containerState.size+1)(l)}function s(l){return r.containerState.furtherBlankLines||!br(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(NZe,t,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Dr(e,e.attempt(Po,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function IZe(e,t,n){const r=this;return Dr(e,i,"listItemIndent",r.containerState.size+1);function i(s){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(s):n(s)}}function DZe(e){e.exit(this.containerState.type)}function PZe(e,t,n){const r=this;return Dr(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const a=r.events[r.events.length-1];return!br(s)&&a&&a[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const yG={name:"setextUnderline",resolveTo:MZe,tokenize:LZe};function MZe(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",a,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function LZe(e,t,n){const r=this;let i;return s;function s(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"),i=u,a(u)):n(u)}function a(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===i?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),br(u)?Dr(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||On(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const $Ze={tokenize:BZe};function BZe(e){const t=this,n=e.attempt(wE,r,e.attempt(this.parser.constructs.flowInitial,i,Dr(e,e.attempt(this.parser.constructs.flow,i,e.attempt(VYe,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const QZe={resolveAll:Epe()},UZe=Spe("string"),FZe=Spe("text");function Spe(e){return{resolveAll:Epe(e==="text"?zZe:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,a,l);return a;function a(d){return u(d)?s(d):l(d)}function l(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"),s(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const f=i[d];let h=-1;if(f)for(;++h-1){const l=a[0];typeof l=="string"?a[0]=l.slice(r):a.shift()}s>0&&a.push(e[i].slice(0,s))}return a}function nKe(e,t){let n=-1;const r=[];let i;for(;++n0){const _e=Pe.tokenStack[Pe.tokenStack.length-1];(_e[1]||xG).call(Pe,void 0,_e[0])}for(ue.position={start:Bh(re.length>0?re[0][1].start:{line:1,column:1,offset:0}),end:Bh(re.length>0?re[re.length-2][1].end:{line:1,column:1,offset:0})},W=-1;++W0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function bKe(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function yKe(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function OKe(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=lO(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let a,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=s+1,l+=1,e.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(l>1?"-"+l:""),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 xKe(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 vKe(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Tpe(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 i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=r:i.push({type:"text",value:r}),i}function wKe(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Tpe(e,t);const i={src:lO(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function SKe(e,t){const n={src:lO(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 EKe(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 kKe(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Tpe(e,t);const i={href:lO(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function _Ke(e,t){const n={href:lO(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 TKe(e,t,n){const r=e.all(t),i=n?CKe(n):Cpe(t),s={},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:[]}),s.className=["task-list-item"]}let l=-1;for(;++l0){const _e=Ie.tokenStack[Ie.tokenStack.length-1];(_e[1]||xG).call(Ie,void 0,_e[0])}for(ce.position={start:Bh(ie.length>0?ie[0][1].start:{line:1,column:1,offset:0}),end:Bh(ie.length>0?ie[ie.length-2][1].end:{line:1,column:1,offset:0})},K=-1;++K0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function gKe(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function bKe(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function yKe(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=lO(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let a,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=s+1,l+=1,e.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(l>1?"-"+l:""),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 OKe(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 xKe(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Tpe(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 i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=r:i.push({type:"text",value:r}),i}function vKe(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Tpe(e,t);const i={src:lO(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function wKe(e,t){const n={src:lO(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 SKe(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 EKe(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Tpe(e,t);const i={href:lO(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function kKe(e,t){const n={href:lO(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 _Ke(e,t,n){const r=e.all(t),i=n?TKe(n):Cpe(t),s={},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:[]}),s.className=["task-list-item"]}let l=-1;for(;++l1}function AKe(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=Td(t.children[1]),c=kj(t.children[t.children.length-1]);l&&c&&(a.position={start:l,end:c}),i.push(a)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function DKe(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,l=a?a.length:t.children.length;let c=-1;const u=[];for(;++c0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(SG(t.slice(i),i>0,!1)),s.join("")}function SG(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===vG||s===wG;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===vG||s===wG;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function LKe(e,t){const n={type:"text",value:MKe(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function $Ke(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const BKe={blockquote:pKe,break:mKe,code:gKe,delete:bKe,emphasis:yKe,footnoteReference:OKe,heading:xKe,html:vKe,imageReference:wKe,image:SKe,inlineCode:EKe,linkReference:kKe,link:_Ke,listItem:TKe,list:AKe,paragraph:NKe,root:jKe,strong:RKe,table:IKe,tableCell:PKe,tableRow:DKe,text:LKe,thematicBreak:$Ke,toml:p2,yaml:p2,definition:p2,footnoteDefinition:p2};function p2(){}const Ape=-1,Cj=0,Iv=1,GC=2,oB=3,lB=4,cB=5,uB=6,Npe=7,jpe=8,QKe=typeof self=="object"?self:globalThis,EG=(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 QKe[e](t)},UKe=(e,t)=>{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,a]=t[i];switch(s){case Cj:case Ape:return n(a,i);case Iv:{const l=n([],i);for(const c of a)l.push(r(c));return l}case GC:{const l=n({},i);for(const[c,u]of a)l[r(c)]=r(u);return l}case oB:return n(new Date(a),i);case lB:{const{source:l,flags:c}=a;return n(new RegExp(l,c),i)}case cB:{const l=n(new Map,i);for(const[c,u]of a)l.set(r(c),r(u));return l}case uB:{const l=n(new Set,i);for(const c of a)l.add(r(c));return l}case Npe:{const{name:l,message:c}=a;return n(EG(l,c),i)}case jpe:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:l}=new Uint8Array(a);return n(new DataView(l),a)}}return n(EG(s,a),i)};return r},kG=e=>UKe(new Map,e)(0),Z0="",{toString:FKe}={},{keys:zKe}=Object,ox=e=>{const t=typeof e;if(t!=="object"||!e)return[Cj,t];const n=FKe.call(e).slice(8,-1);switch(n){case"Array":return[Iv,Z0];case"Object":return[GC,Z0];case"Date":return[oB,Z0];case"RegExp":return[lB,Z0];case"Map":return[cB,Z0];case"Set":return[uB,Z0];case"DataView":return[Iv,n]}return n.includes("Array")?[Iv,n]:n.includes("Error")?[Npe,n]:[GC,n]},m2=([e,t])=>e===Cj&&(t==="function"||t==="symbol"),VKe=(e,t,n,r)=>{const i=(a,l)=>{const c=r.push(a)-1;return n.set(l,c),c},s=a=>{if(n.has(a))return n.get(a);let[l,c]=ox(a);switch(l){case Cj:{let d=a;switch(c){case"bigint":l=jpe,d=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return i([Ape],a)}return i([l,d],a)}case Iv:{if(c){let h=a;return c==="DataView"?h=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(h=new Uint8Array(a)),i([c,[...h]],a)}const d=[],f=i([l,d],a);for(const h of a)d.push(s(h));return f}case GC:{if(c)switch(c){case"BigInt":return i([c,a.toString()],a);case"Boolean":case"Number":case"String":return i([c,a.valueOf()],a)}if(t&&"toJSON"in a)return s(a.toJSON());const d=[],f=i([l,d],a);for(const h of zKe(a))(e||!m2(ox(a[h])))&&d.push([s(h),s(a[h])]);return f}case oB:return i([l,a.toISOString()],a);case lB:{const{source:d,flags:f}=a;return i([l,{source:d,flags:f}],a)}case cB:{const d=[],f=i([l,d],a);for(const[h,m]of a)(e||!(m2(ox(h))||m2(ox(m))))&&d.push([s(h),s(m)]);return f}case uB:{const d=[],f=i([l,d],a);for(const h of a)(e||!m2(ox(h)))&&d.push(s(h));return f}}const{message:u}=a;return i([l,{name:c,message:u}],a)};return s},_G=(e,{json:t,lossy:n}={})=>{const r=[];return VKe(!(t||n),!!t,new Map,r)(e),r},h1=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?kG(_G(e,t)):structuredClone(e):(e,t)=>kG(_G(e,t));function HKe(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 qKe(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function XKe(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||HKe,r=e.options.footnoteBackLabel||qKe,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c0&&g.push({type:"text",value:" "});let v=typeof n=="string"?n:n(c,m);typeof v=="string"&&(v={type:"text",value:v}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(m>1?"-"+m:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,m),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const y=d[d.length-1];if(y&&y.type==="element"&&y.tagName==="p"){const v=y.children[y.children.length-1];v&&v.type==="text"?v.value+=" ":y.children.push({type:"text",value:" "}),y.children.push(...g)}else d.push(...g);const O={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(d,!0)};e.patch(u,O),l.push(O)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...h1(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` +`});const u={type:"element",tagName:"li",properties:s,children:a};return e.patch(t,u),e.applyData(t,u)}function TKe(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r1}function CKe(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=Ad(t.children[1]),c=kj(t.children[t.children.length-1]);l&&c&&(a.position={start:l,end:c}),i.push(a)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function IKe(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,l=a?a.length:t.children.length;let c=-1;const u=[];for(;++c0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(SG(t.slice(i),i>0,!1)),s.join("")}function SG(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===vG||s===wG;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===vG||s===wG;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function MKe(e,t){const n={type:"text",value:PKe(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function LKe(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const $Ke={blockquote:hKe,break:pKe,code:mKe,delete:gKe,emphasis:bKe,footnoteReference:yKe,heading:OKe,html:xKe,imageReference:vKe,image:wKe,inlineCode:SKe,linkReference:EKe,link:kKe,listItem:_Ke,list:CKe,paragraph:AKe,root:NKe,strong:jKe,table:RKe,tableCell:DKe,tableRow:IKe,text:MKe,thematicBreak:LKe,toml:g2,yaml:g2,definition:g2,footnoteDefinition:g2};function g2(){}const Ape=-1,Cj=0,Pv=1,GC=2,oB=3,lB=4,cB=5,uB=6,Npe=7,jpe=8,BKe=typeof self=="object"?self:globalThis,EG=(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 BKe[e](t)},QKe=(e,t)=>{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,a]=t[i];switch(s){case Cj:case Ape:return n(a,i);case Pv:{const l=n([],i);for(const c of a)l.push(r(c));return l}case GC:{const l=n({},i);for(const[c,u]of a)l[r(c)]=r(u);return l}case oB:return n(new Date(a),i);case lB:{const{source:l,flags:c}=a;return n(new RegExp(l,c),i)}case cB:{const l=n(new Map,i);for(const[c,u]of a)l.set(r(c),r(u));return l}case uB:{const l=n(new Set,i);for(const c of a)l.add(r(c));return l}case Npe:{const{name:l,message:c}=a;return n(EG(l,c),i)}case jpe:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:l}=new Uint8Array(a);return n(new DataView(l),a)}}return n(EG(s,a),i)};return r},kG=e=>QKe(new Map,e)(0),Z0="",{toString:UKe}={},{keys:FKe}=Object,ox=e=>{const t=typeof e;if(t!=="object"||!e)return[Cj,t];const n=UKe.call(e).slice(8,-1);switch(n){case"Array":return[Pv,Z0];case"Object":return[GC,Z0];case"Date":return[oB,Z0];case"RegExp":return[lB,Z0];case"Map":return[cB,Z0];case"Set":return[uB,Z0];case"DataView":return[Pv,n]}return n.includes("Array")?[Pv,n]:n.includes("Error")?[Npe,n]:[GC,n]},b2=([e,t])=>e===Cj&&(t==="function"||t==="symbol"),zKe=(e,t,n,r)=>{const i=(a,l)=>{const c=r.push(a)-1;return n.set(l,c),c},s=a=>{if(n.has(a))return n.get(a);let[l,c]=ox(a);switch(l){case Cj:{let d=a;switch(c){case"bigint":l=jpe,d=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return i([Ape],a)}return i([l,d],a)}case Pv:{if(c){let h=a;return c==="DataView"?h=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(h=new Uint8Array(a)),i([c,[...h]],a)}const d=[],f=i([l,d],a);for(const h of a)d.push(s(h));return f}case GC:{if(c)switch(c){case"BigInt":return i([c,a.toString()],a);case"Boolean":case"Number":case"String":return i([c,a.valueOf()],a)}if(t&&"toJSON"in a)return s(a.toJSON());const d=[],f=i([l,d],a);for(const h of FKe(a))(e||!b2(ox(a[h])))&&d.push([s(h),s(a[h])]);return f}case oB:return i([l,a.toISOString()],a);case lB:{const{source:d,flags:f}=a;return i([l,{source:d,flags:f}],a)}case cB:{const d=[],f=i([l,d],a);for(const[h,m]of a)(e||!(b2(ox(h))||b2(ox(m))))&&d.push([s(h),s(m)]);return f}case uB:{const d=[],f=i([l,d],a);for(const h of a)(e||!b2(ox(h)))&&d.push(s(h));return f}}const{message:u}=a;return i([l,{name:c,message:u}],a)};return s},_G=(e,{json:t,lossy:n}={})=>{const r=[];return zKe(!(t||n),!!t,new Map,r)(e),r},h1=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?kG(_G(e,t)):structuredClone(e):(e,t)=>kG(_G(e,t));function VKe(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 HKe(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function qKe(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||VKe,r=e.options.footnoteBackLabel||HKe,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c0&&g.push({type:"text",value:" "});let v=typeof n=="string"?n:n(c,m);typeof v=="string"&&(v={type:"text",value:v}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(m>1?"-"+m:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,m),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const y=d[d.length-1];if(y&&y.type==="element"&&y.tagName==="p"){const v=y.children[y.children.length-1];v&&v.type==="text"?v.value+=" ":y.children.push({type:"text",value:" "}),y.children.push(...g)}else d.push(...g);const O={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(d,!0)};e.patch(u,O),l.push(O)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...h1(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` `},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:` -`}]}}const vE=function(e){if(e==null)return ZKe;if(typeof e=="function")return Aj(e);if(typeof e=="object")return Array.isArray(e)?GKe(e):WKe(e);if(typeof e=="string")return YKe(e);throw new Error("Expected function, string, or object as test")};function GKe(e){const t=[];let n=-1;for(;++n":""))+")"})}return h;function h(){let m=Rpe,g,b,y;if((!t||s(c,u,d[d.length-1]||void 0))&&(m=tJe(n(c,d)),m[0]===tL))return m;if("children"in c&&c.children){const O=c;if(O.children&&m[0]!==eJe)for(b=(r?O.children.length:-1)+a,y=d.concat(O);b>-1&&b":""))+")"})}return h;function h(){let m=Rpe,g,b,y;if((!t||s(c,u,d[d.length-1]||void 0))&&(m=eJe(n(c,d)),m[0]===tL))return m;if("children"in c&&c.children){const O=c;if(O.children&&m[0]!==JKe)for(b=(r?O.children.length:-1)+a,y=d.concat(O);b>-1&&b0&&n.push({type:"text",value:` -`}),n}function TG(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function CG(e,t){const n=rJe(e,t),r=n.one(e,void 0),i=XKe(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:` -`},i),s}function lJe(e,t){return e&&"run"in e?async function(n,r){const i=CG(n,{file:r,...t});await e.run(i,r)}:function(n,r){return CG(n,{file:r,...e||t})}}function AG(e){if(e)throw e}var sT=Object.prototype.hasOwnProperty,Dpe=Object.prototype.toString,NG=Object.defineProperty,jG=Object.getOwnPropertyDescriptor,RG=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Dpe.call(t)==="[object Array]"},IG=function(t){if(!t||Dpe.call(t)!=="[object Object]")return!1;var n=sT.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&sT.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||sT.call(t,i)},DG=function(t,n){NG&&n.name==="__proto__"?NG(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},PG=function(t,n){if(n==="__proto__")if(sT.call(t,n)){if(jG)return jG(t,n).value}else return;return t[n]},cJe=function e(){var t,n,r,i,s,a,l=arguments[0],c=1,u=arguments.length,d=!1;for(typeof l=="boolean"&&(d=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});ca.length;let c;l&&a.push(i);try{c=e.apply(this,a)}catch(u){const d=u;if(l&&n)throw d;return i(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(s,i):c instanceof Error?i(c):s(c))}function i(a,...l){n||(n=!0,t(a,...l))}function s(a){i(null,a)}}const Vu={basename:fJe,dirname:hJe,extname:pJe,join:mJe,sep:"/"};function fJe(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');SE(e);let n=0,r=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,l=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else a<0&&(s=!0,a=i+1),l>-1&&(e.codePointAt(i)===t.codePointAt(l--)?l<0&&(r=i):(l=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function hJe(e){if(SE(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 pJe(e){SE(e);let t=e.length,n=-1,r=0,i=-1,s=0,a;for(;t--;){const l=e.codePointAt(t);if(l===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),l===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function mJe(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function bJe(e,t){let n="",r=0,i=-1,s=0,a=-1,l,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("/")),i=a,s=0;continue}}else if(n.length>0){n="",r=0,i=a,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),r=a-i-1;i=a,s=0}else l===46&&s>-1?s++:s=-1}return n}function SE(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const yJe={cwd:OJe};function OJe(){return"/"}function iL(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function xJe(e){if(typeof e=="string")e=new URL(e);else if(!iL(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 vJe(e)}function vJe(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[m,...g]=d;const b=r[h][1];rL(b)&&rL(m)&&(m=tD(!0,b,m)),r[h]=[u,m,...g]}}}}const kJe=new dB().freeze();function sD(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function aD(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function oD(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 LG(e){if(!rL(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function $G(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function g2(e){return _Je(e)?e:new Ppe(e)}function _Je(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function TJe(e){return typeof e=="string"||CJe(e)}function CJe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const AJe="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",BG=[],QG={allowDangerousHtml:!0},NJe=/^(https?|ircs?|mailto|xmpp)$/i,jJe=[{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 RJe(e){const t=IJe(e),n=DJe(e);return PJe(t.runSync(t.parse(n),n),e)}function IJe(e){const t=e.rehypePlugins||BG,n=e.remarkPlugins||BG,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...QG}:QG;return kJe().use(hKe).use(n).use(lJe,r).use(t)}function DJe(e){const t=e.children||"",n=new Ppe;return typeof t=="string"&&(n.value=t),n}function PJe(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||MJe;for(const d of jJe)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+AJe+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),wE(e,u),YWe(e,{Fragment:o.Fragment,components:i,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.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 m;for(m in K5)if(Object.hasOwn(K5,m)&&Object.hasOwn(d.properties,m)){const g=d.properties[m],b=K5[m];(b===null||b.includes(d.tagName))&&(d.properties[m]=c(String(g||""),m,d))}}if(d.type==="element"){let m=n?!n.includes(d.tagName):s?s.includes(d.tagName):!1;if(!m&&r&&typeof f=="number"&&(m=!r(d,f,h)),m&&h&&typeof f=="number")return l&&d.children?h.children.splice(f,1,...d.children):h.children.splice(f,1),f}}}function MJe(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||NJe.test(e.slice(0,t))?e:""}function UG(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function LJe(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function $Je(e,t,n){const i=vE((n||{}).ignore||[]),s=BJe(t);let a=-1;for(;++a0?{type:"text",value:E}:void 0),E===!1?h.lastIndex=w+1:(g!==w&&v.push({type:"text",value:u.value.slice(g,w)}),Array.isArray(E)?v.push(...E):E&&v.push(E),g=w+x[0].length,O=!0),!h.global)break;x=h.exec(u.value)}return O?(g?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=UG(e,"(");let s=UG(e,")");for(;r!==-1&&i>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}function Mpe(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Hg(n)||_j(n))&&(!t||n!==47)}Lpe.peek=cet;function eet(){this.buffer()}function tet(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function net(){this.buffer()}function ret(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function iet(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=mu(this.sliceSerialize(e)).toLowerCase(),n.label=t}function set(e){this.exit(e)}function aet(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=mu(this.sliceSerialize(e)).toLowerCase(),n.label=t}function oet(e){this.exit(e)}function cet(){return"["}function Lpe(e,t,n,r){const i=n.createTracker(r);let s=i.move("[^");const a=n.enter("footnoteReference"),l=n.enter("reference");return s+=i.move(n.safe(n.associationId(e),{after:"]",before:s})),l(),a(),s+=i.move("]"),s}function uet(){return{enter:{gfmFootnoteCallString:eet,gfmFootnoteCall:tet,gfmFootnoteDefinitionLabelString:net,gfmFootnoteDefinition:ret},exit:{gfmFootnoteCallString:iet,gfmFootnoteCall:set,gfmFootnoteDefinitionLabelString:aet,gfmFootnoteDefinition:oet}}}function det(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Lpe},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,s,a){const l=s.createTracker(a);let c=l.move("[^");const u=s.enter("footnoteDefinition"),d=s.enter("label");return c+=l.move(s.safe(s.associationId(r),{before:c,after:"]"})),d(),c+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),c+=l.move((t?` -`:" ")+s.indentLines(s.containerFlow(r,l.current()),t?$pe:fet))),u(),c}}function fet(e,t,n){return t===0?e:$pe(e,t,n)}function $pe(e,t,n){return(n?"":" ")+e}const het=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Bpe.peek=yet;function pet(){return{canContainEols:["delete"],enter:{strikethrough:get},exit:{strikethrough:bet}}}function met(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:het}],handlers:{delete:Bpe}}}function get(e){this.enter({type:"delete",children:[]},e)}function bet(e){this.exit(e)}function Bpe(e,t,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let a=i.move("~~");return a+=n.containerPhrasing(e,{...i.current(),before:a,after:"~"}),a+=i.move("~~"),s(),a}function yet(){return"~"}function Oet(e){return e.length}function xet(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||Oet,s=[],a=[],l=[],c=[];let u=0,d=-1;for(;++du&&(u=e[d].length);++Oc[O])&&(c[O]=x)}b.push(v)}a[d]=b,l[d]=y}let f=-1;if(typeof r=="object"&&"length"in r)for(;++fc[f]&&(c[f]=v),m[f]=v),h[f]=x}a.splice(1,0,h),l.splice(1,0,m),d=-1;const g=[];for(;++d "),s.shift(2);const a=n.indentLines(n.containerFlow(e,s.current()),Eet);return i(),a}function Eet(e,t,n){return">"+(n?"":" ")+e}function ket(e,t){return VG(e,t.inConstruct,!0)&&!VG(e,t.notInConstruct,!1)}function VG(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++ra&&(a=s):s=1,i=r+t.length,r=n.indexOf(t,i);return a}function Tet(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 Cet(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 Aet(e,t,n,r){const i=Cet(n),s=e.value||"",a=i==="`"?"GraveAccent":"Tilde";if(Tet(e,n)){const f=n.enter("codeIndented"),h=n.indentLines(s,Net);return f(),h}const l=n.createTracker(r),c=i.repeat(Math.max(_et(s,i)+1,3)),u=n.enter("codeFenced");let d=l.move(c);if(e.lang){const f=n.enter(`codeFencedLang${a}`);d+=l.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...l.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${a}`);d+=l.move(" "),d+=l.move(n.safe(e.meta,{before:d,after:` +`}),n}function TG(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function CG(e,t){const n=nJe(e,t),r=n.one(e,void 0),i=qKe(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:` +`},i),s}function oJe(e,t){return e&&"run"in e?async function(n,r){const i=CG(n,{file:r,...t});await e.run(i,r)}:function(n,r){return CG(n,{file:r,...e||t})}}function AG(e){if(e)throw e}var oT=Object.prototype.hasOwnProperty,Dpe=Object.prototype.toString,NG=Object.defineProperty,jG=Object.getOwnPropertyDescriptor,RG=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Dpe.call(t)==="[object Array]"},IG=function(t){if(!t||Dpe.call(t)!=="[object Object]")return!1;var n=oT.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&oT.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||oT.call(t,i)},DG=function(t,n){NG&&n.name==="__proto__"?NG(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},PG=function(t,n){if(n==="__proto__")if(oT.call(t,n)){if(jG)return jG(t,n).value}else return;return t[n]},lJe=function e(){var t,n,r,i,s,a,l=arguments[0],c=1,u=arguments.length,d=!1;for(typeof l=="boolean"&&(d=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});ca.length;let c;l&&a.push(i);try{c=e.apply(this,a)}catch(u){const d=u;if(l&&n)throw d;return i(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(s,i):c instanceof Error?i(c):s(c))}function i(a,...l){n||(n=!0,t(a,...l))}function s(a){i(null,a)}}const qu={basename:dJe,dirname:fJe,extname:hJe,join:pJe,sep:"/"};function dJe(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');kE(e);let n=0,r=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,l=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else a<0&&(s=!0,a=i+1),l>-1&&(e.codePointAt(i)===t.codePointAt(l--)?l<0&&(r=i):(l=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function fJe(e){if(kE(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 hJe(e){kE(e);let t=e.length,n=-1,r=0,i=-1,s=0,a;for(;t--;){const l=e.codePointAt(t);if(l===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),l===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function pJe(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function gJe(e,t){let n="",r=0,i=-1,s=0,a=-1,l,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("/")),i=a,s=0;continue}}else if(n.length>0){n="",r=0,i=a,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,a):n=e.slice(i+1,a),r=a-i-1;i=a,s=0}else l===46&&s>-1?s++:s=-1}return n}function kE(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const bJe={cwd:yJe};function yJe(){return"/"}function iL(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function OJe(e){if(typeof e=="string")e=new URL(e);else if(!iL(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 xJe(e)}function xJe(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[m,...g]=d;const b=r[h][1];rL(b)&&rL(m)&&(m=tD(!0,b,m)),r[h]=[u,m,...g]}}}}const EJe=new dB().freeze();function sD(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function aD(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function oD(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 LG(e){if(!rL(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function $G(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function y2(e){return kJe(e)?e:new Ppe(e)}function kJe(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function _Je(e){return typeof e=="string"||TJe(e)}function TJe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const CJe="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",BG=[],QG={allowDangerousHtml:!0},AJe=/^(https?|ircs?|mailto|xmpp)$/i,NJe=[{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 jJe(e){const t=RJe(e),n=IJe(e);return DJe(t.runSync(t.parse(n),n),e)}function RJe(e){const t=e.rehypePlugins||BG,n=e.remarkPlugins||BG,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...QG}:QG;return EJe().use(fKe).use(n).use(oJe,r).use(t)}function IJe(e){const t=e.children||"",n=new Ppe;return typeof t=="string"&&(n.value=t),n}function DJe(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||PJe;for(const d of NJe)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+CJe+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),EE(e,u),WWe(e,{Fragment:o.Fragment,components:i,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.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 m;for(m in K5)if(Object.hasOwn(K5,m)&&Object.hasOwn(d.properties,m)){const g=d.properties[m],b=K5[m];(b===null||b.includes(d.tagName))&&(d.properties[m]=c(String(g||""),m,d))}}if(d.type==="element"){let m=n?!n.includes(d.tagName):s?s.includes(d.tagName):!1;if(!m&&r&&typeof f=="number"&&(m=!r(d,f,h)),m&&h&&typeof f=="number")return l&&d.children?h.children.splice(f,1,...d.children):h.children.splice(f,1),f}}}function PJe(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||AJe.test(e.slice(0,t))?e:""}function UG(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function MJe(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function LJe(e,t,n){const i=SE((n||{}).ignore||[]),s=$Je(t);let a=-1;for(;++a0?{type:"text",value:E}:void 0),E===!1?h.lastIndex=w+1:(g!==w&&v.push({type:"text",value:u.value.slice(g,w)}),Array.isArray(E)?v.push(...E):E&&v.push(E),g=w+x[0].length,O=!0),!h.global)break;x=h.exec(u.value)}return O?(g?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=UG(e,"(");let s=UG(e,")");for(;r!==-1&&i>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}function Mpe(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Hg(n)||_j(n))&&(!t||n!==47)}Lpe.peek=oet;function JJe(){this.buffer()}function eet(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function tet(){this.buffer()}function net(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function ret(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=bu(this.sliceSerialize(e)).toLowerCase(),n.label=t}function iet(e){this.exit(e)}function set(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=bu(this.sliceSerialize(e)).toLowerCase(),n.label=t}function aet(e){this.exit(e)}function oet(){return"["}function Lpe(e,t,n,r){const i=n.createTracker(r);let s=i.move("[^");const a=n.enter("footnoteReference"),l=n.enter("reference");return s+=i.move(n.safe(n.associationId(e),{after:"]",before:s})),l(),a(),s+=i.move("]"),s}function cet(){return{enter:{gfmFootnoteCallString:JJe,gfmFootnoteCall:eet,gfmFootnoteDefinitionLabelString:tet,gfmFootnoteDefinition:net},exit:{gfmFootnoteCallString:ret,gfmFootnoteCall:iet,gfmFootnoteDefinitionLabelString:set,gfmFootnoteDefinition:aet}}}function uet(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Lpe},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,s,a){const l=s.createTracker(a);let c=l.move("[^");const u=s.enter("footnoteDefinition"),d=s.enter("label");return c+=l.move(s.safe(s.associationId(r),{before:c,after:"]"})),d(),c+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),c+=l.move((t?` +`:" ")+s.indentLines(s.containerFlow(r,l.current()),t?$pe:det))),u(),c}}function det(e,t,n){return t===0?e:$pe(e,t,n)}function $pe(e,t,n){return(n?"":" ")+e}const fet=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Bpe.peek=bet;function het(){return{canContainEols:["delete"],enter:{strikethrough:met},exit:{strikethrough:get}}}function pet(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:fet}],handlers:{delete:Bpe}}}function met(e){this.enter({type:"delete",children:[]},e)}function get(e){this.exit(e)}function Bpe(e,t,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let a=i.move("~~");return a+=n.containerPhrasing(e,{...i.current(),before:a,after:"~"}),a+=i.move("~~"),s(),a}function bet(){return"~"}function yet(e){return e.length}function Oet(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||yet,s=[],a=[],l=[],c=[];let u=0,d=-1;for(;++du&&(u=e[d].length);++Oc[O])&&(c[O]=x)}b.push(v)}a[d]=b,l[d]=y}let f=-1;if(typeof r=="object"&&"length"in r)for(;++fc[f]&&(c[f]=v),m[f]=v),h[f]=x}a.splice(1,0,h),l.splice(1,0,m),d=-1;const g=[];for(;++d "),s.shift(2);const a=n.indentLines(n.containerFlow(e,s.current()),wet);return i(),a}function wet(e,t,n){return">"+(n?"":" ")+e}function Eet(e,t){return VG(e,t.inConstruct,!0)&&!VG(e,t.notInConstruct,!1)}function VG(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++ra&&(a=s):s=1,i=r+t.length,r=n.indexOf(t,i);return a}function _et(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 Tet(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 Cet(e,t,n,r){const i=Tet(n),s=e.value||"",a=i==="`"?"GraveAccent":"Tilde";if(_et(e,n)){const f=n.enter("codeIndented"),h=n.indentLines(s,Aet);return f(),h}const l=n.createTracker(r),c=i.repeat(Math.max(ket(s,i)+1,3)),u=n.enter("codeFenced");let d=l.move(c);if(e.lang){const f=n.enter(`codeFencedLang${a}`);d+=l.move(n.safe(e.lang,{before:d,after:" ",encode:["`"],...l.current()})),f()}if(e.lang&&e.meta){const f=n.enter(`codeFencedMeta${a}`);d+=l.move(" "),d+=l.move(n.safe(e.meta,{before:d,after:` `,encode:["`"],...l.current()})),f()}return d+=l.move(` `),s&&(d+=l.move(s+` -`)),d+=l.move(c),u(),d}function Net(e,t,n){return(n?"":" ")+e}function fB(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 jet(e,t,n,r){const i=fB(n),s=i==='"'?"Quote":"Apostrophe",a=n.enter("definition");let l=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("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":` -`,...c.current()}))),l(),e.title&&(l=n.enter(`title${s}`),u+=c.move(" "+i),u+=c.move(n.safe(e.title,{before:u,after:i,...c.current()})),u+=c.move(i),l()),a(),u}function Ret(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 Vw(e){return"&#x"+e.toString(16).toUpperCase()+";"}function WC(e,t,n){const r=f1(e),i=f1(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Upe.peek=Iet;function Upe(e,t,n,r){const i=Ret(n),s=n.enter("emphasis"),a=n.createTracker(r),l=a.move(i);let c=a.move(n.containerPhrasing(e,{after:i,before:l,...a.current()}));const u=c.charCodeAt(0),d=WC(r.before.charCodeAt(r.before.length-1),u,i);d.inside&&(c=Vw(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=WC(r.after.charCodeAt(0),f,i);h.inside&&(c=c.slice(0,-1)+Vw(f));const m=a.move(i);return s(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+m}function Iet(e,t,n){return n.options.emphasis||"*"}function Det(e,t){let n=!1;return wE(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,tL}),!!((!e.depth||e.depth<3)&&iB(e)&&(t.options.setext||n))}function Pet(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(Det(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),h=n.containerPhrasing(e,{...s.current(),before:` +`)),d+=l.move(c),u(),d}function Aet(e,t,n){return(n?"":" ")+e}function fB(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 Net(e,t,n,r){const i=fB(n),s=i==='"'?"Quote":"Apostrophe",a=n.enter("definition");let l=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("]: "),l(),!e.url||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":` +`,...c.current()}))),l(),e.title&&(l=n.enter(`title${s}`),u+=c.move(" "+i),u+=c.move(n.safe(e.title,{before:u,after:i,...c.current()})),u+=c.move(i),l()),a(),u}function jet(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 qw(e){return"&#x"+e.toString(16).toUpperCase()+";"}function WC(e,t,n){const r=f1(e),i=f1(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Upe.peek=Ret;function Upe(e,t,n,r){const i=jet(n),s=n.enter("emphasis"),a=n.createTracker(r),l=a.move(i);let c=a.move(n.containerPhrasing(e,{after:i,before:l,...a.current()}));const u=c.charCodeAt(0),d=WC(r.before.charCodeAt(r.before.length-1),u,i);d.inside&&(c=qw(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=WC(r.after.charCodeAt(0),f,i);h.inside&&(c=c.slice(0,-1)+qw(f));const m=a.move(i);return s(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+m}function Ret(e,t,n){return n.options.emphasis||"*"}function Iet(e,t){let n=!1;return EE(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,tL}),!!((!e.depth||e.depth<3)&&iB(e)&&(t.options.setext||n))}function Det(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(Iet(e,n)){const d=n.enter("headingSetext"),f=n.enter("phrasing"),h=n.containerPhrasing(e,{...s.current(),before:` `,after:` `});return f(),d(),h+` `+(i===1?"=":"-").repeat(h.length-(Math.max(h.lastIndexOf("\r"),h.lastIndexOf(` `))+1))}const a="#".repeat(i),l=n.enter("headingAtx"),c=n.enter("phrasing");s.move(a+" ");let u=n.containerPhrasing(e,{before:"# ",after:` -`,...s.current()});return/^[\t ]/.test(u)&&(u=Vw(u.charCodeAt(0))+u.slice(1)),u=u?a+" "+u:a,n.options.closeAtx&&(u+=" "+a),c(),l(),u}Fpe.peek=Met;function Fpe(e){return e.value||""}function Met(){return"<"}zpe.peek=Let;function zpe(e,t,n,r){const i=fB(n),s=i==='"'?"Quote":"Apostrophe",a=n.enter("image");let l=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("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),l(),e.title&&(l=n.enter(`title${s}`),u+=c.move(" "+i),u+=c.move(n.safe(e.title,{before:u,after:i,...c.current()})),u+=c.move(i),l()),u+=c.move(")"),a(),u}function Let(){return"!"}Vpe.peek=$et;function Vpe(e,t,n,r){const i=e.referenceType,s=n.enter("imageReference");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("![");const u=n.safe(e.alt,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return a(),n.stack=d,s(),i==="full"||!u||u!==f?c+=l.move(f+"]"):i==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function $et(){return"!"}Hpe.peek=Bet;function Hpe(e,t,n){let r=e.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s\u007F]/.test(e.url))}Xpe.peek=Qet;function Xpe(e,t,n,r){const i=fB(n),s=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let l,c;if(qpe(e,n)){const d=n.stack;n.stack=[],l=n.enter("autolink");let f=a.move("<");return f+=a.move(n.containerPhrasing(e,{before:f,after:">",...a.current()})),f+=a.move(">"),l(),n.stack=d,f}l=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${s}`),u+=a.move(" "+i),u+=a.move(n.safe(e.title,{before:u,after:i,...a.current()})),u+=a.move(i),c()),u+=a.move(")"),l(),u}function Qet(e,t,n){return qpe(e,n)?"<":"["}Gpe.peek=Uet;function Gpe(e,t,n,r){const i=e.referenceType,s=n.enter("linkReference");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return a(),n.stack=d,s(),i==="full"||!u||u!==f?c+=l.move(f+"]"):i==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function Uet(){return"["}function hB(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 Fet(e){const t=hB(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 zet(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 Wpe(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 Vet(e,t,n,r){const i=n.enter("list"),s=n.bulletCurrent;let a=e.ordered?zet(n):hB(n);const l=e.ordered?a==="."?")":".":Fet(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),Wpe(n)===a&&d){let f=-1;for(;++f-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let a=s.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const l=n.createTracker(r);l.move(s+" ".repeat(a-s.length)),l.shift(a);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,l.current()),d);return c(),u;function d(f,h,m){return h?(m?"":" ".repeat(a))+f:(m?s:s+" ".repeat(a-s.length))+f}}function Xet(e,t,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),a=n.containerPhrasing(e,r);return s(),i(),a}const Get=vE(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Wet(e,t,n,r){return(e.children.some(function(a){return Get(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function Yet(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Ype.peek=Zet;function Ype(e,t,n,r){const i=Yet(n),s=n.enter("strong"),a=n.createTracker(r),l=a.move(i+i);let c=a.move(n.containerPhrasing(e,{after:i,before:l,...a.current()}));const u=c.charCodeAt(0),d=WC(r.before.charCodeAt(r.before.length-1),u,i);d.inside&&(c=Vw(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=WC(r.after.charCodeAt(0),f,i);h.inside&&(c=c.slice(0,-1)+Vw(f));const m=a.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+m}function Zet(e,t,n){return n.options.strong||"*"}function Ket(e,t,n,r){return n.safe(e.value,r)}function Jet(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 ett(e,t,n){const r=(Wpe(n)+(n.options.ruleSpaces?" ":"")).repeat(Jet(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Zpe={blockquote:wet,break:HG,code:Aet,definition:jet,emphasis:Upe,hardBreak:HG,heading:Pet,html:Fpe,image:zpe,imageReference:Vpe,inlineCode:Hpe,link:Xpe,linkReference:Gpe,list:Vet,listItem:qet,paragraph:Xet,root:Wet,strong:Ype,text:Ket,thematicBreak:ett};function ttt(){return{enter:{table:ntt,tableData:qG,tableHeader:qG,tableRow:itt},exit:{codeText:stt,table:rtt,tableData:dD,tableHeader:dD,tableRow:dD}}}function ntt(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 rtt(e){this.exit(e),this.data.inTable=void 0}function itt(e){this.enter({type:"tableRow",children:[]},e)}function dD(e){this.exit(e)}function qG(e){this.enter({type:"tableCell",children:[]},e)}function stt(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,att));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function att(e,t){return t==="|"?t:e}function ott(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` +`,...s.current()});return/^[\t ]/.test(u)&&(u=qw(u.charCodeAt(0))+u.slice(1)),u=u?a+" "+u:a,n.options.closeAtx&&(u+=" "+a),c(),l(),u}Fpe.peek=Pet;function Fpe(e){return e.value||""}function Pet(){return"<"}zpe.peek=Met;function zpe(e,t,n,r){const i=fB(n),s=i==='"'?"Quote":"Apostrophe",a=n.enter("image");let l=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("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=c.move("<"),u+=c.move(n.safe(e.url,{before:u,after:">",...c.current()})),u+=c.move(">")):(l=n.enter("destinationRaw"),u+=c.move(n.safe(e.url,{before:u,after:e.title?" ":")",...c.current()}))),l(),e.title&&(l=n.enter(`title${s}`),u+=c.move(" "+i),u+=c.move(n.safe(e.title,{before:u,after:i,...c.current()})),u+=c.move(i),l()),u+=c.move(")"),a(),u}function Met(){return"!"}Vpe.peek=Let;function Vpe(e,t,n,r){const i=e.referenceType,s=n.enter("imageReference");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("![");const u=n.safe(e.alt,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return a(),n.stack=d,s(),i==="full"||!u||u!==f?c+=l.move(f+"]"):i==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function Let(){return"!"}Hpe.peek=$et;function Hpe(e,t,n){let r=e.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s\u007F]/.test(e.url))}Xpe.peek=Bet;function Xpe(e,t,n,r){const i=fB(n),s=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let l,c;if(qpe(e,n)){const d=n.stack;n.stack=[],l=n.enter("autolink");let f=a.move("<");return f+=a.move(n.containerPhrasing(e,{before:f,after:">",...a.current()})),f+=a.move(">"),l(),n.stack=d,f}l=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${s}`),u+=a.move(" "+i),u+=a.move(n.safe(e.title,{before:u,after:i,...a.current()})),u+=a.move(i),c()),u+=a.move(")"),l(),u}function Bet(e,t,n){return qpe(e,n)?"<":"["}Gpe.peek=Qet;function Gpe(e,t,n,r){const i=e.referenceType,s=n.enter("linkReference");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("[");const u=n.containerPhrasing(e,{before:c,after:"]",...l.current()});c+=l.move(u+"]["),a();const d=n.stack;n.stack=[],a=n.enter("reference");const f=n.safe(n.associationId(e),{before:c,after:"]",...l.current()});return a(),n.stack=d,s(),i==="full"||!u||u!==f?c+=l.move(f+"]"):i==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function Qet(){return"["}function hB(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 Uet(e){const t=hB(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 Fet(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 Wpe(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 zet(e,t,n,r){const i=n.enter("list"),s=n.bulletCurrent;let a=e.ordered?Fet(n):hB(n);const l=e.ordered?a==="."?")":".":Uet(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),Wpe(n)===a&&d){let f=-1;for(;++f-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+s);let a=s.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const l=n.createTracker(r);l.move(s+" ".repeat(a-s.length)),l.shift(a);const c=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,l.current()),d);return c(),u;function d(f,h,m){return h?(m?"":" ".repeat(a))+f:(m?s:s+" ".repeat(a-s.length))+f}}function qet(e,t,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),a=n.containerPhrasing(e,r);return s(),i(),a}const Xet=SE(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Get(e,t,n,r){return(e.children.some(function(a){return Xet(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function Wet(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Ype.peek=Yet;function Ype(e,t,n,r){const i=Wet(n),s=n.enter("strong"),a=n.createTracker(r),l=a.move(i+i);let c=a.move(n.containerPhrasing(e,{after:i,before:l,...a.current()}));const u=c.charCodeAt(0),d=WC(r.before.charCodeAt(r.before.length-1),u,i);d.inside&&(c=qw(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=WC(r.after.charCodeAt(0),f,i);h.inside&&(c=c.slice(0,-1)+qw(f));const m=a.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+m}function Yet(e,t,n){return n.options.strong||"*"}function Zet(e,t,n,r){return n.safe(e.value,r)}function Ket(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 Jet(e,t,n){const r=(Wpe(n)+(n.options.ruleSpaces?" ":"")).repeat(Ket(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Zpe={blockquote:vet,break:HG,code:Cet,definition:Net,emphasis:Upe,hardBreak:HG,heading:Det,html:Fpe,image:zpe,imageReference:Vpe,inlineCode:Hpe,link:Xpe,linkReference:Gpe,list:zet,listItem:Het,paragraph:qet,root:Get,strong:Ype,text:Zet,thematicBreak:Jet};function ett(){return{enter:{table:ttt,tableData:qG,tableHeader:qG,tableRow:rtt},exit:{codeText:itt,table:ntt,tableData:dD,tableHeader:dD,tableRow:dD}}}function ttt(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 ntt(e){this.exit(e),this.data.inTable=void 0}function rtt(e){this.enter({type:"tableRow",children:[]},e)}function dD(e){this.exit(e)}function qG(e){this.enter({type:"tableCell",children:[]},e)}function itt(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,stt));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function stt(e,t){return t==="|"?t:e}function att(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=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:l}};function a(m,g,b,y){return u(d(m,b,y),m.align)}function l(m,g,b,y){const O=f(m,b,y),v=u([O]);return v.slice(0,v.indexOf(` -`))}function c(m,g,b,y){const O=b.enter("tableCell"),v=b.enter("phrasing"),x=b.containerPhrasing(m,{...y,before:s,after:s});return v(),O(),x}function u(m,g){return xet(m,{align:g,alignDelimiters:r,padding:n,stringLength:i})}function d(m,g,b){const y=m.children;let O=-1;const v=[],x=g.enter("table");for(;++O0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const ktt={tokenize:Itt,partial:!0};function _tt(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Ntt,continuation:{tokenize:jtt},exit:Rtt}},text:{91:{name:"gfmFootnoteCall",tokenize:Att},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Ttt,resolveTo:Ctt}}}}function Ttt(e,t,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;i--;){const c=r.events[i][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 l;function l(c){if(!a||!a._balanced)return n(c);const u=mu(r.sliceSerialize({start:a.end,end:r.now()}));return u.codePointAt(0)!==94||!s.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function Ctt(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)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},l=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",a,t],["exit",a,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...l),e}function Att(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,a;return l;function l(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(s>999||f===93&&!a||f===null||f===91||wi(f))return n(f);if(f===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return i.includes(mu(r.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return wi(f)||(a=!0),s++,e.consume(f),f===92?d:u}function d(f){return f===91||f===92||f===93?(e.consume(f),s++,u):u(f)}}function Ntt(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,a=0,l;return c;function c(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(g)}function d(g){if(a>999||g===93&&!l||g===null||g===91||wi(g))return n(g);if(g===93){e.exit("chunkString");const b=e.exit("gfmFootnoteDefinitionLabelString");return s=mu(r.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return wi(g)||(l=!0),a++,e.consume(g),g===92?f:d}function f(g){return g===91||g===92||g===93?(e.consume(g),a++,d):d(g)}function h(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),i.includes(s)||i.push(s),Rr(e,m,"gfmFootnoteDefinitionWhitespace")):n(g)}function m(g){return t(g)}}function jtt(e,t,n){return e.check(xE,t,e.attempt(ktt,t,n))}function Rtt(e){e.exit("gfmFootnoteDefinition")}function Itt(e,t,n){const r=this;return Rr(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(s):n(s)}}function Dtt(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(a,l){let c=-1;for(;++c1?c(g):(a.consume(g),f++,m);if(f<2&&!n)return c(g);const y=a.exit("strikethroughSequenceTemporary"),O=f1(g);return y._open=!O||O===2&&!!b,y._close=!b||b===2&&!!O,l(g)}}}class Ptt{constructor(){this.map=[]}add(t,n,r){Mtt(this,t,n,r)}consume(t){if(this.map.sort(function(s,a){return s[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 i=r.pop();for(;i;){for(const s of i)t.push(s);i=r.pop()}this.map.length=0}}function Mtt(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i-1;){const I=r.events[A][1].type;if(I==="lineEnding"||I==="linePrefix")A--;else break}const j=A>-1?r.events[A][1].type:null,L=j==="tableHead"||j==="tableRow"?E:c;return L===E&&r.parser.lazy[r.now().line]?n(T):L(T)}function c(T){return e.enter("tableHead"),e.enter("tableRow"),u(T)}function u(T){return T===124||(a=!0,s+=1),d(T)}function d(T){return T===null?n(T):vn(T)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),m):n(T):br(T)?Rr(e,d,"whitespace")(T):(s+=1,a&&(a=!1,i+=1),T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),a=!0,d):(e.enter("data"),f(T)))}function f(T){return T===null||T===124||wi(T)?(e.exit("data"),d(T)):(e.consume(T),T===92?h:f)}function h(T){return T===92||T===124?(e.consume(T),f):f(T)}function m(T){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(T):(e.enter("tableDelimiterRow"),a=!1,br(T)?Rr(e,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):g(T))}function g(T){return T===45||T===58?y(T):T===124?(a=!0,e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),b):S(T)}function b(T){return br(T)?Rr(e,y,"whitespace")(T):y(T)}function y(T){return T===58?(s+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),O):T===45?(s+=1,O(T)):T===null||vn(T)?w(T):S(T)}function O(T){return T===45?(e.enter("tableDelimiterFiller"),v(T)):S(T)}function v(T){return T===45?(e.consume(T),v):T===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),x):(e.exit("tableDelimiterFiller"),x(T))}function x(T){return br(T)?Rr(e,w,"whitespace")(T):w(T)}function w(T){return T===124?g(T):T===null||vn(T)?!a||i!==s?S(T):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(T)):S(T)}function S(T){return n(T)}function E(T){return e.enter("tableRow"),k(T)}function k(T){return T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),k):T===null||vn(T)?(e.exit("tableRow"),t(T)):br(T)?Rr(e,k,"whitespace")(T):(e.enter("data"),_(T))}function _(T){return T===null||T===124||wi(T)?(e.exit("data"),k(T)):(e.consume(T),T===92?C:_)}function C(T){return T===92||T===124?(e.consume(T),_):_(T)}}function Qtt(e,t){let n=-1,r=!0,i=0,s=[0,0,0,0],a=[0,0,0,0],l=!1,c=0,u,d,f;const h=new Ptt;for(;++nn[2]+1){const g=n[2]+1,b=n[3]-n[2]-1;e.add(g,b,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return i!==void 0&&(s.end=Object.assign({},bb(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function GG(e,t,n,r,i){const s=[],a=bb(t.events,n);i&&(i.end=Object.assign({},a),s.push(["exit",i,t])),r.end=Object.assign({},a),s.push(["exit",r,t]),e.add(n+1,0,s)}function bb(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const Utt={name:"tasklistCheck",tokenize:ztt};function Ftt(){return{text:{91:Utt}}}function ztt(e,t,n){const r=this;return i;function i(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),s)}function s(c){return wi(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"),l):n(c)}function l(c){return vn(c)?t(c):br(c)?e.check({tokenize:Vtt},t,n)(c):n(c)}}function Vtt(e,t,n){return Rr(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function Htt(e){return ppe([gtt(),_tt(),Dtt(e),$tt(),Ftt()])}const qtt={};function Xtt(e){const t=this,n=e||qtt,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(Htt(n)),s.push(ftt()),a.push(htt(n))}const WG=function(e,t,n){const r=vE(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 ome(e,t,n){return e.type==="element"?tnt(e,t,n):e.type==="text"?n.whitespace==="normal"?lme(e,n):nnt(e):[]}function tnt(e,t,n){const r=cme(e,n),i=e.children||[];let s=-1,a=[];if(Jtt(e))return a;let l,c;for(aL(e)||JG(e)&&WG(t,e,JG)?c=` -`:Ktt(e)?(l=2,c=2):ame(e)&&(l=1,c=1);++s]+>")+")",l={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(i)+e.IDENT_RE,relevance:0},m=t.optional(i)+e.IDENT_RE+"\\s*\\(",g=["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"],b=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],y=["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"],O=["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"],w={type:b,keyword:g,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:y},S={className:"function.dispatch",relevance:0,keywords:{_hint:O},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},E=[S,f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],k={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:w,contains:E.concat([{begin:/\(/,end:/\)/,keywords:w,contains:E.concat(["self"]),relevance:0}]),relevance:0},_={className:"function",begin:"("+a+"[\\*&\\s]+)+"+m,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:w,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:w,relevance:0},{begin:m,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:w,illegal:"",keywords:w,contains:["self",l]},{begin:e.IDENT_RE+"::",keywords:w},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function cnt(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=lnt(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 gB(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 i={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},s=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"})]}},l={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,i]};i.contains.push(l);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"],m=e.SHEBANG({binary:`(${h.join("|")})`,relevance:10}),g={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},b=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],y=["true","false"],O={match:/(\/[a-z._-]+)+/},v=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],x=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],w=["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"],S=["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:b,literal:y,built_in:[...v,...x,"set","shopt",...w,...S]},contains:[m,e.SHEBANG(),g,f,s,a,O,l,c,u,d,n]}}function unt(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",a="("+r+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",l={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(i)+e.IDENT_RE,relevance:0},m=t.optional(i)+e.IDENT_RE+"\\s*\\(",y={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"},O=[f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],v={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:y,contains:O.concat([{begin:/\(/,end:/\)/,keywords:y,contains:O.concat(["self"]),relevance:0}]),relevance:0},x={begin:"("+a+"[\\*&\\s]+)+"+m,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:y,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:y,relevance:0},{begin:m,returnBegin:!0,contains:[e.inherit(h,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:y,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:y,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C",aliases:["h"],keywords:y,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:f,strings:u,keywords:y}}}function dnt(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",a="(?!struct)("+r+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",l={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(i)+e.IDENT_RE,relevance:0},m=t.optional(i)+e.IDENT_RE+"\\s*\\(",g=["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"],b=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],y=["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"],O=["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"],w={type:b,keyword:g,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:y},S={className:"function.dispatch",relevance:0,keywords:{_hint:O},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},E=[S,f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],k={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:w,contains:E.concat([{begin:/\(/,end:/\)/,keywords:w,contains:E.concat(["self"]),relevance:0}]),relevance:0},_={className:"function",begin:"("+a+"[\\*&\\s]+)+"+m,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:w,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:w,relevance:0},{begin:m,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:w,illegal:"",keywords:w,contains:["self",l]},{begin:e.IDENT_RE+"::",keywords:w},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function fnt(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"],i=["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"],s=["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:i.concat(s),built_in:t,literal:r},l=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},m=e.inherit(h,{illegal:/\n/}),g={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,m]},b={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]},y=e.inherit(b,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},m]});h.contains=[b,g,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.C_BLOCK_COMMENT_MODE],m.contains=[y,g,f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const O={variants:[u,b,g,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},v={begin:"<",end:">",contains:[{beginKeywords:"in out"},l]},x=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",w={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"}},O,c,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},l,v,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[l,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[l,v,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:"("+x+"\\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,v],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,relevance:0,contains:[O,c,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},w]}}const hnt=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_-]*/}}),pnt=["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"],mnt=["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"],gnt=[...pnt,...mnt],bnt=["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(),ynt=["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(),Ont=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),xnt=["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 vnt(e){const t=e.regex,n=hnt(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",s=/@-?\w[\w]*(-\w+)*/,a="[a-zA-Z-][a-zA-Z0-9_-]*",l=[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:":("+ynt.join("|")+")"},{begin:":(:)?("+Ont.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+xnt.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...l,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...l,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:s},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:bnt.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...l,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+gnt.join("|")+")\\b"}]}}function wnt(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 Snt(e){const s={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:s,illegal:"dme(e,t,n-1))}function knt(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+dme("(?:<"+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,eW,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},eW,u]}}const tW="[A-Za-z$_][0-9A-Za-z$_]*",_nt=["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"],Tnt=["true","false","null","undefined","NaN","Infinity"],fme=["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"],hme=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],pme=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Cnt=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Ant=[].concat(pme,fme,hme);function mme(e){const t=e.regex,n=(Q,{after:F})=>{const $="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Q,F)=>{const $=Q[0].length+Q.index,H=Q.input[$];if(H==="<"||H===","){F.ignoreMatch();return}H===">"&&(n(Q,{after:$})||F.ignoreMatch());let z;const B=Q.input.substring($);if(z=B.match(/^\s*=/)){F.ignoreMatch();return}if((z=B.match(/^\s+extends\s+/))&&z.index===0){F.ignoreMatch();return}}},l={$pattern:tW,keyword:_nt,literal:Tnt,built_in:Ant,"variable.language":Cnt},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:l,contains:[]},m={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},g={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},b={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},y={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},v={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]},x=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,m,g,b,y,{match:/\$\d+/},f];h.contains=x.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(x)});const w=[].concat(v,h.contains),S=w.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(w)}]),E={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:S},k={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"}}]},_={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:{_:[...fme,...hme]}},C={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[E],illegal:/%/},A={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function j(Q){return t.concat("(?!",Q.join("|"),")")}const L={match:t.concat(/\b/,j([...pme,"super","import"].map(Q=>`${Q}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},I={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},M={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},E]},N="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",D={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(N)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[E]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:S,CLASS_REFERENCE:_},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),C,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,m,g,b,y,v,{match:/\$\d+/},f,_,{scope:"attr",match:r+t.lookahead(":"),relevance:0},D,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[v,e.REGEXP_MODE,{className:"function",begin:N,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:S}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:s},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},T,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[E,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},I,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[E]},L,A,k,M,{match:/\$[(.]/}]}}function gme(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],i={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,i,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var Ob="[0-9](_*[0-9])*",x2=`\\.(${Ob})`,v2="[0-9a-fA-F](_*[0-9a-fA-F])*",Nnt={className:"number",variants:[{begin:`(\\b(${Ob})((${x2})|\\.)?|(${x2}))[eE][+-]?(${Ob})[fFdD]?\\b`},{begin:`\\b(${Ob})((${x2})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${x2})[fFdD]?\\b`},{begin:`\\b(${Ob})[fFdD]\\b`},{begin:`\\b0[xX]((${v2})\\.?|(${v2})?\\.(${v2}))[pP][+-]?(${Ob})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${v2})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function jnt(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+"@"},i={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},s={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},a={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[s,i]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,s,i]}]};i.contains.push(a);const l={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=Nnt,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,l,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,l,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},l,c]},a,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:` -`},u]}}const Rnt=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_-]*/}}),Int=["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"],Dnt=["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"],Pnt=[...Int,...Dnt],Mnt=["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(),bme=["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(),yme=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Lnt=["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(),$nt=bme.concat(yme).sort().reverse();function Bnt(e){const t=Rnt(e),n=$nt,r="and or not only",i="[\\w-]+",s="("+i+"|@\\{"+i+"\\})",a=[],l=[],c=function(x){return{className:"string",begin:"~?"+x+".*?"+x}},u=function(x,w,S){return{className:x,begin:w,relevance:S}},d={$pattern:/[a-z-]+/,keyword:r,attribute:Mnt.join(" ")},f={begin:"\\(",end:"\\)",contains:l,keywords:d,relevance:0};l.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","@@?"+i,10),u("variable","@\\{"+i+"\\}"),u("built_in","~?`[^`]*?`"),{className:"attribute",begin:i+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);const h=l.concat({begin:/\{/,end:/\}/,contains:a}),m={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(l)},g={begin:s+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Lnt.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:l}}]},b={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:l,relevance:0}},y={className:"variable",variants:[{begin:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:h}},O={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:s,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,m,u("keyword","all\\b"),u("variable","@\\{"+i+"\\}"),{begin:"\\b("+Pnt.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,u("selector-tag",s,0),u("selector-id","#"+s),u("selector-class","\\."+s,0),u("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+bme.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+yme.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:h},{begin:"!important"},t.FUNCTION_DISPATCH]},v={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[O]};return a.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,b,y,v,g,O,m,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:a}}function Qnt(e){const t="\\[=*\\[",n="\\]=*\\]",r={begin:t,end:n,contains:["self"]},i=[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:i.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:i}].concat(i)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[r],relevance:5}])}}function Ome(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},i={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}]},s={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}]},l=/[A-Za-z][A-Za-z0-9+.-]*/,c={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,l,/:\/\/.*?\)/),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 m=[n,c];return[u,d,f,h].forEach(O=>{O.contains=O.contains.concat(m)}),m=m.concat(u,d),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:m},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:m}]}]},n,s,u,d,{className:"quote",begin:"^>\\s+",contains:m,end:"$"},i,r,c,a,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function Unt(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_]*/,l={"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:l,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 Fnt(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}/,i={$pattern:/[\w.]+/,keyword:n.join(" ")},s={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:i},a={begin:/->\{/,end:/\}/},l={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:[l]},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,s,c],f=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],h=(b,y,O="\\1")=>{const v=O==="\\1"?O:t.concat(O,y);return t.concat(t.concat("(?:",b,")"),y,/(?:\\.|[^\\\/])*?/,v,/(?:\\.|[^\\\/])*?/,O,r)},m=(b,y,O)=>t.concat(t.concat("(?:",b,")"),y,/(?:\\.|[^\\\/])*?/,O,r),g=[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:m("(?:m|qr)?",/\//,/\//)},{begin:m("m|qr",t.either(...f,{capture:!0}),/\1/)},{begin:m("m|qr",/\(/,/\)/)},{begin:m("m|qr",/\[/,/\]/)},{begin:m("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,l]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,l,u]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return s.contains=g,a.contains=g,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:g}}function znt(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),i=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),s=t.concat(/[A-Z]+/,n),a={scope:"variable",match:"\\$+"+r},l={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":(I,M)=>{M.data._beginMatch=I[1]||I[2]},"on:end":(I,M)=>{M.data._beginMatch!==I[1]&&M.ignoreMatch()}},h=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),m=`[ -]`,g={scope:"string",variants:[d,u,f,h]},b={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},y=["false","null","true"],O=["__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"],v=["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"],w={keyword:O,literal:(I=>{const M=[];return I.forEach(N=>{M.push(N),N.toLowerCase()===N?M.push(N.toUpperCase()):M.push(N.toLowerCase())}),M})(y),built_in:v},S=I=>I.map(M=>M.replace(/\|\d+$/,"")),E={variants:[{match:[/new/,t.concat(m,"+"),t.concat("(?!",S(v).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},k=t.concat(r,"\\b(?!\\()"),_={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),k],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,t.concat(/::/,t.lookahead(/(?!class\b)/)),k],scope:{1:"title.class",3:"variable.constant"}},{match:[i,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},C={scope:"attr",match:t.concat(r,t.lookahead(":"),t.lookahead(/(?!::)/))},T={relevance:0,begin:/\(/,end:/\)/,keywords:w,contains:[C,a,_,e.C_BLOCK_COMMENT_MODE,g,b,E]},A={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",S(O).join("\\b|"),"|",S(v).join("\\b|"),"\\b)"),r,t.concat(m,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[T]};T.contains.push(A);const j=[C,_,e.C_BLOCK_COMMENT_MODE,g,b,E],L={begin:t.concat(/#\[\s*\\?/,t.either(i,s)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:y,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:y,keyword:["new","array"]},contains:["self",...j]},...j,{scope:"meta",variants:[{match:i},{match:s}]}]};return{case_insensitive:!1,keywords:w,contains:[L,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}]}},l,{scope:"variable.language",match:/\$this\b/},a,A,_,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},E,{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:w,contains:["self",L,a,_,e.C_BLOCK_COMMENT_MODE,g,b]}]},{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]},g,b]}}function Vnt(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 Hnt(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function vme(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"],l={$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:l,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])*",m=`(\\b(${h}))?\\.(${h})|\\b(${h})\\.`,g=`\\b|${r.join("|")}`,b={className:"number",relevance:0,variants:[{begin:`(\\b(${h})|(${m}))[eE][+-]?(${h})[jJ]?(?=${g})`},{begin:`(${m})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${g})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${g})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${g})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${g})`},{begin:`\\b(${h})[jJ](?=${g})`}]},y={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:l,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},O={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:["self",c,b,f,e.HASH_COMMENT_MODE]}]};return u.contains=[f,b,c],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:l,illegal:/(<\/|\?)|=>/,contains:[c,b,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},f,y,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[O]},{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:[b,O,f]}]}}function qnt(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function Xnt(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]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,s=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:[i,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[s,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:s},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function Gnt(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]+/),i=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"]},l={className:"doctag",begin:"@[A-Za-z]+"},c={begin:"#<",end:">"},u=[e.COMMENT("#","$",{contains:[l]}),e.COMMENT("^=begin","^=end",{contains:[l],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",m="[0-9](_?[0-9])*",g={className:"number",relevance:0,variants:[{begin:`\\b(${h})(\\.(${m}))?([eE][+-]?(${m})|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"}]},b={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:a}]},E=[f,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:a},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:a},{relevance:0,match:[i,/\.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:[b]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[f,{begin:n}],relevance:0},g,{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=E,b.contains=E;const T=[{begin:/^\s*=>/,starts:{end:"$",contains:E}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:a,contains:E}}];return u.unshift(c),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:a,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(T).concat(u).concat(E)}}function Wnt(e){const t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),i=t.concat(n,e.IDENT_RE),s={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,t.lookahead(/\s*\(/))},a="([ui](8|16|32|64|128|size)|f(32|64))?",l=["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:l,literal:c,built_in:u},illegal:""},s]}}const Ynt=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_-]*/}}),Znt=["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"],Knt=["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"],Jnt=[...Znt,...Knt],ert=["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(),trt=["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(),nrt=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),rrt=["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 irt(e){const t=Ynt(e),n=nrt,r=trt,i="@[a-z-]+",s="and or not only",l={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("+Jnt.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},l,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+rrt.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,l,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:i,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:ert.join(" ")},contains:[{begin:i,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},l,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function srt(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function art(e){const t=e.regex,n=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},s=["true","false","unknown"],a=["double precision","large object","with timezone","without timezone"],l=["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"],m=d,g=[...u,...c].filter(S=>!d.includes(S)),b={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},y={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},O={match:t.concat(/\b/,t.either(...m),/\s*\(/),relevance:0,keywords:{built_in:m}};function v(S){return t.concat(/\b/,t.either(...S.map(E=>E.replace(/\s+/,"\\s+"))),/\b/)}const x={scope:"keyword",match:v(h),relevance:0};function w(S,{exceptions:E,when:k}={}){const _=k;return E=E||[],S.map(C=>C.match(/\|\d+$/)||E.includes(C)?C:_(C)?`${C}|0`:C)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:w(g,{when:S=>S.length<3}),literal:s,type:l,built_in:f},contains:[{scope:"type",match:v(a)},x,O,b,r,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,y]}}function wme(e){return e?typeof e=="string"?e:e.source:null}function lx(e){return ci("(?=",e,")")}function ci(...e){return e.map(n=>wme(n)).join("")}function ort(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function uo(...e){return"("+(ort(e).capture?"":"?:")+e.map(r=>wme(r)).join("|")+")"}const bB=e=>ci(/\b/,e,/\w$/.test(e)?/\b/:/\B/),lrt=["Protocol","Type"].map(bB),nW=["init","self"].map(bB),crt=["Any","Self"],fD=["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"],rW=["false","nil","true"],urt=["assignment","associativity","higherThan","left","lowerThan","none","right"],drt=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],iW=["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"],Sme=uo(/[/=\-+!*%<>&|^~?]/,/[\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]/),Eme=uo(Sme,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),hD=ci(Sme,Eme,"*"),kme=uo(/[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]/),YC=uo(kme,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Fu=ci(kme,YC,"*"),w2=ci(/[A-Z]/,YC,"*"),frt=["attached","autoclosure",ci(/convention\(/,uo("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",ci(/objc\(/,Fu,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],hrt=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function prt(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],i={match:[/\./,uo(...lrt,...nW)],className:{2:"keyword"}},s={match:ci(/\./,uo(...fD)),relevance:0},a=fD.filter(He=>typeof He=="string").concat(["_|0"]),l=fD.filter(He=>typeof He!="string").concat(crt).map(bB),c={variants:[{className:"keyword",match:uo(...l,...nW)}]},u={$pattern:uo(/\b\w+/,/#\w+/),keyword:a.concat(drt),literal:rW},d=[i,s,c],f={match:ci(/\./,uo(...iW)),relevance:0},h={className:"built_in",match:ci(/\b/,uo(...iW),/(?=\()/)},m=[f,h],g={match:/->/,relevance:0},b={className:"operator",relevance:0,variants:[{match:hD},{match:`\\.(\\.|${Eme})+`}]},y=[g,b],O="([0-9]_*)+",v="([0-9a-fA-F]_*)+",x={className:"number",relevance:0,variants:[{match:`\\b(${O})(\\.(${O}))?([eE][+-]?(${O}))?\\b`},{match:`\\b0x(${v})(\\.(${v}))?([pP][+-]?(${O}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},w=(He="")=>({className:"subst",variants:[{match:ci(/\\/,He,/[0\\tnr"']/)},{match:ci(/\\/,He,/u\{[0-9a-fA-F]{1,8}\}/)}]}),S=(He="")=>({className:"subst",match:ci(/\\/,He,/[\t ]*(?:[\r\n]|\r\n)/)}),E=(He="")=>({className:"subst",label:"interpol",begin:ci(/\\/,He,/\(/),end:/\)/}),k=(He="")=>({begin:ci(He,/"""/),end:ci(/"""/,He),contains:[w(He),S(He),E(He)]}),_=(He="")=>({begin:ci(He,/"/),end:ci(/"/,He),contains:[w(He),E(He)]}),C={className:"string",variants:[k(),k("#"),k("##"),k("###"),_(),_("#"),_("##"),_("###")]},T=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],A={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:T},j=He=>{const et=ci(He,/\//),Te=ci(/\//,He);return{begin:et,end:Te,contains:[...T,{scope:"comment",begin:`#(?!.*${Te})`,end:/$/}]}},L={scope:"regexp",variants:[j("###"),j("##"),j("#"),A]},I={match:ci(/`/,Fu,/`/)},M={className:"variable",match:/\$\d+/},N={className:"variable",match:`\\$${YC}+`},D=[I,M,N],Q={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:hrt,contains:[...y,x,C]}]}},F={scope:"keyword",match:ci(/@/,uo(...frt),lx(uo(/\(/,/\s+/)))},$={scope:"meta",match:ci(/@/,Fu)},H=[Q,F,$],z={match:lx(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:ci(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,YC,"+")},{className:"type",match:w2,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:ci(/\s+&\s+/,lx(w2)),relevance:0}]},B={begin://,keywords:u,contains:[...r,...d,...H,g,z]};z.contains.push(B);const V={match:ci(Fu,/\s*:/),keywords:"_|0",relevance:0},Z={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",V,...r,L,...d,...m,...y,x,C,...D,...H,z]},ce={begin://,keywords:"repeat each",contains:[...r,z]},be={begin:uo(lx(ci(Fu,/\s*:/)),lx(ci(Fu,/\s+/,Fu,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Fu}]},ie={begin:/\(/,end:/\)/,keywords:u,contains:[be,...r,...d,...y,x,C,...H,z,Z],endsParent:!0,illegal:/["']/},q={match:[/(func|macro)/,/\s+/,uo(I.match,Fu,hD)],className:{1:"keyword",3:"title.function"},contains:[ce,ie,t],illegal:[/\[/,/%/]},X={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[ce,ie,t],illegal:/\[|%/},K={match:[/operator/,/\s+/,hD],className:{1:"keyword",3:"title"}},de={begin:[/precedencegroup/,/\s+/,w2],className:{1:"keyword",3:"title"},contains:[z],keywords:[...urt,...rW],end:/}/},xe={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Me={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},Ae={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,Fu,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:u,contains:[ce,...d,{begin:/:/,end:/\{/,keywords:u,contains:[{scope:"title.class.inherited",match:w2},...d],relevance:0}]};for(const He of C.variants){const et=He.contains.find(Re=>Re.label==="interpol");et.keywords=u;const Te=[...d,...m,...y,x,C,...D];et.contains=[...Te,{begin:/\(/,end:/\)/,contains:["self",...Te]}]}return{name:"Swift",keywords:u,contains:[...r,q,X,xe,Me,Ae,K,de,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},L,...d,...m,...y,x,C,...D,...H,z,Z]}}const ZC="[A-Za-z$_][0-9A-Za-z$_]*",_me=["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"],Tme=["true","false","null","undefined","NaN","Infinity"],Cme=["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"],Ame=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Nme=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],jme=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Rme=[].concat(Nme,Cme,Ame);function mrt(e){const t=e.regex,n=(Q,{after:F})=>{const $="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Q,F)=>{const $=Q[0].length+Q.index,H=Q.input[$];if(H==="<"||H===","){F.ignoreMatch();return}H===">"&&(n(Q,{after:$})||F.ignoreMatch());let z;const B=Q.input.substring($);if(z=B.match(/^\s*=/)){F.ignoreMatch();return}if((z=B.match(/^\s+extends\s+/))&&z.index===0){F.ignoreMatch();return}}},l={$pattern:ZC,keyword:_me,literal:Tme,built_in:Rme,"variable.language":jme},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:l,contains:[]},m={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},g={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},b={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},y={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},v={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]},x=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,m,g,b,y,{match:/\$\d+/},f];h.contains=x.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(x)});const w=[].concat(v,h.contains),S=w.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(w)}]),E={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:S},k={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"}}]},_={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:{_:[...Cme,...Ame]}},C={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[E],illegal:/%/},A={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function j(Q){return t.concat("(?!",Q.join("|"),")")}const L={match:t.concat(/\b/,j([...Nme,"super","import"].map(Q=>`${Q}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},I={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},M={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},E]},N="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",D={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(N)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[E]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:S,CLASS_REFERENCE:_},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),C,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,m,g,b,y,v,{match:/\$\d+/},f,_,{scope:"attr",match:r+t.lookahead(":"),relevance:0},D,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[v,e.REGEXP_MODE,{className:"function",begin:N,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:S}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:s},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},T,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[E,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},I,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[E]},L,A,k,M,{match:/\$[(.]/}]}}function Ime(e){const t=e.regex,n=mrt(e),r=ZC,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],s={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},a={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[n.exports.CLASS_REFERENCE]},l={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},c=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],u={$pattern:ZC,keyword:_me.concat(c),literal:Tme,built_in:Rme.concat(i),"variable.language":jme},d={className:"meta",begin:"@"+r},f=(b,y,O)=>{const v=b.contains.findIndex(x=>x.label===y);if(v===-1)throw new Error("can not find mode to replace");b.contains.splice(v,1,O)};Object.assign(n.keywords,u),n.exports.PARAMS_CONTAINS.push(d);const h=n.contains.find(b=>b.scope==="attr"),m=Object.assign({},h,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,h,m]),n.contains=n.contains.concat([d,s,a,m]),f(n,"shebang",e.SHEBANG()),f(n,"use_strict",l);const g=n.contains.find(b=>b.label==="func.def");return g.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function grt(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,s=/\d{4}-\d{1,2}-\d{1,2}/,a=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,l=/\d{1,2}(:\d{1,2}){1,2}/,c={className:"literal",variants:[{begin:t.concat(/# */,t.either(s,i),/ *#/)},{begin:t.concat(/# */,l,/ *#/)},{begin:t.concat(/# */,a,/ *#/)},{begin:t.concat(/# */,t.either(s,i),/ +/,t.either(a,l),/ *#/)}]},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 brt(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"],i={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},s={className:"variable",begin:/\$[\w_]+/},a={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},l={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"}},s,a,i,e.QUOTE_STRING_MODE,c,u,l]}}function yrt(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,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},s={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},a=e.inherit(s,{begin:/\(/,end:/\)/}),l=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:[s,c,l,a,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[s,a,c,l]}]}]},e.COMMENT(//,{relevance:10}),{begin://,relevance:10},i,{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 Dme(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]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},s={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,i]},l=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"},m={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},g={begin:/\{/,end:/\}/,contains:[m],illegal:"\\n",relevance:0},b={begin:"\\[",end:"\\]",contains:[m],illegal:"\\n",relevance:0},y=[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},g,b,s,a],O=[...y];return O.pop(),O.push(l),m.contains=O,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:y}}const Ort={arduino:cnt,bash:gB,c:unt,cpp:dnt,csharp:fnt,css:vnt,diff:wnt,go:Snt,graphql:Ent,ini:ume,java:knt,javascript:mme,json:gme,kotlin:jnt,less:Bnt,lua:Qnt,makefile:Ome,markdown:xme,objectivec:Unt,perl:Fnt,php:znt,"php-template":Vnt,plaintext:Hnt,python:vme,"python-repl":qnt,r:Xnt,ruby:Gnt,rust:Wnt,scss:irt,shell:srt,sql:art,swift:prt,typescript:Ime,vbnet:grt,wasm:brt,xml:yrt,yaml:Dme};function Pme(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)&&Pme(n)}),e}let sW=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function Mme(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function pp(e,...t){const n=Object.create(null);for(const r in e)n[r]=e[r];return t.forEach(function(r){for(const i in r)n[i]=r[i]}),n}const xrt="",aW=e=>!!e.scope,vrt=(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,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return`${t}${e}`};class wrt{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=Mme(t)}openNode(t){if(!aW(t))return;const n=vrt(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){aW(t)&&(this.buffer+=xrt)}value(){return this.buffer}span(t){this.buffer+=``}}const oW=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class yB{constructor(){this.rootNode=oW(),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=oW({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=>{yB._collapse(n)}))}}class Srt extends yB{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 wrt(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Hw(e){return e?typeof e=="string"?e:e.source:null}function Lme(e){return v0("(?=",e,")")}function Ert(e){return v0("(?:",e,")*")}function krt(e){return v0("(?:",e,")?")}function v0(...e){return e.map(n=>Hw(n)).join("")}function _rt(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function OB(...e){return"("+(_rt(e).capture?"":"?:")+e.map(r=>Hw(r)).join("|")+")"}function $me(e){return new RegExp(e.toString()+"|").exec("").length-1}function Trt(e,t){const n=e&&e.exec(t);return n&&n.index===0}const Crt=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function xB(e,{joinWith:t}){let n=0;return e.map(r=>{n+=1;const i=n;let s=Hw(r),a="";for(;s.length>0;){const l=Crt.exec(s);if(!l){a+=s;break}a+=s.substring(0,l.index),s=s.substring(l.index+l[0].length),l[0][0]==="\\"&&l[1]?a+="\\"+String(Number(l[1])+i):(a+=l[0],l[0]==="("&&n++)}return a}).map(r=>`(${r})`).join(t)}const Art=/\b\B/,Bme="[a-zA-Z]\\w*",vB="[a-zA-Z_]\\w*",Qme="\\b\\d+(\\.\\d+)?",Ume="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Fme="\\b(0b[01]+)",Nrt="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",jrt=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=v0(t,/.*\b/,e.binary,/\b.*/)),pp({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},e)},qw={begin:"\\\\[\\s\\S]",relevance:0},Rrt={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[qw]},Irt={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[qw]},Drt={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/},Nj=function(e,t,n={}){const r=pp({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 i=OB("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:v0(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},Prt=Nj("//","$"),Mrt=Nj("/\\*","\\*/"),Lrt=Nj("#","$"),$rt={scope:"number",begin:Qme,relevance:0},Brt={scope:"number",begin:Ume,relevance:0},Qrt={scope:"number",begin:Fme,relevance:0},Urt={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[qw,{begin:/\[/,end:/\]/,relevance:0,contains:[qw]}]},Frt={scope:"title",begin:Bme,relevance:0},zrt={scope:"title",begin:vB,relevance:0},Vrt={begin:"\\.\\s*"+vB,relevance:0},Hrt=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 S2=Object.freeze({__proto__:null,APOS_STRING_MODE:Rrt,BACKSLASH_ESCAPE:qw,BINARY_NUMBER_MODE:Qrt,BINARY_NUMBER_RE:Fme,COMMENT:Nj,C_BLOCK_COMMENT_MODE:Mrt,C_LINE_COMMENT_MODE:Prt,C_NUMBER_MODE:Brt,C_NUMBER_RE:Ume,END_SAME_AS_BEGIN:Hrt,HASH_COMMENT_MODE:Lrt,IDENT_RE:Bme,MATCH_NOTHING_RE:Art,METHOD_GUARD:Vrt,NUMBER_MODE:$rt,NUMBER_RE:Qme,PHRASAL_WORDS_MODE:Drt,QUOTE_STRING_MODE:Irt,REGEXP_MODE:Urt,RE_STARTERS_RE:Nrt,SHEBANG:jrt,TITLE_MODE:Frt,UNDERSCORE_IDENT_RE:vB,UNDERSCORE_TITLE_MODE:zrt});function qrt(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function Xrt(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function Grt(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=qrt,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function Wrt(e,t){Array.isArray(e.illegal)&&(e.illegal=OB(...e.illegal))}function Yrt(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 Zrt(e,t){e.relevance===void 0&&(e.relevance=1)}const Krt=(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=v0(n.beforeMatch,Lme(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},Jrt=["of","and","for","in","not","or","if","then","parent","list","value"],eit="keyword";function zme(e,t,n=eit){const r=Object.create(null);return typeof e=="string"?i(n,e.split(" ")):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(s){Object.assign(r,zme(e[s],t,s))}),r;function i(s,a){t&&(a=a.map(l=>l.toLowerCase())),a.forEach(function(l){const c=l.split("|");r[c[0]]=[s,tit(c[0],c[1])]})}}function tit(e,t){return t?Number(t):nit(e)?0:1}function nit(e){return Jrt.includes(e.toLowerCase())}const lW={},Sg=e=>{console.error(e)},cW=(e,...t)=>{console.log(`WARN: ${e}`,...t)},K0=(e,t)=>{lW[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),lW[`${e}/${t}`]=!0)},KC=new Error;function Vme(e,t,{key:n}){let r=0;const i=e[n],s={},a={};for(let l=1;l<=t.length;l++)a[l+r]=i[l],s[l+r]=!0,r+=$me(t[l-1]);e[n]=a,e[n]._emit=s,e[n]._multi=!0}function rit(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw Sg("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),KC;if(typeof e.beginScope!="object"||e.beginScope===null)throw Sg("beginScope must be object"),KC;Vme(e,e.begin,{key:"beginScope"}),e.begin=xB(e.begin,{joinWith:""})}}function iit(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw Sg("skip, excludeEnd, returnEnd not compatible with endScope: {}"),KC;if(typeof e.endScope!="object"||e.endScope===null)throw Sg("endScope must be object"),KC;Vme(e,e.end,{key:"endScope"}),e.end=xB(e.end,{joinWith:""})}}function sit(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function ait(e){sit(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),rit(e),iit(e)}function oit(e){function t(a,l){return new RegExp(Hw(a),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(l?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(l,c){c.position=this.position++,this.matchIndexes[this.matchAt]=c,this.regexes.push([c,l]),this.matchAt+=$me(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const l=this.regexes.map(c=>c[1]);this.matcherRe=t(xB(l,{joinWith:"|"}),!0),this.lastIndex=0}exec(l){this.matcherRe.lastIndex=this.lastIndex;const c=this.matcherRe.exec(l);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(l){if(this.multiRegexes[l])return this.multiRegexes[l];const c=new n;return this.rules.slice(l).forEach(([u,d])=>c.addRule(u,d)),c.compile(),this.multiRegexes[l]=c,c}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(l,c){this.rules.push([l,c]),c.type==="begin"&&this.count++}exec(l){const c=this.getMatcher(this.regexIndex);c.lastIndex=this.lastIndex;let u=c.exec(l);if(this.resumingScanAtSamePosition()&&!(u&&u.index===this.lastIndex)){const d=this.getMatcher(0);d.lastIndex=this.lastIndex+1,u=d.exec(l)}return u&&(this.regexIndex+=u.position+1,this.regexIndex===this.count&&this.considerAll()),u}}function i(a){const l=new r;return a.contains.forEach(c=>l.addRule(c.begin,{rule:c,type:"begin"})),a.terminatorEnd&&l.addRule(a.terminatorEnd,{type:"end"}),a.illegal&&l.addRule(a.illegal,{type:"illegal"}),l}function s(a,l){const c=a;if(a.isCompiled)return c;[Xrt,Yrt,ait,Krt].forEach(d=>d(a,l)),e.compilerExtensions.forEach(d=>d(a,l)),a.__beforeBegin=null,[Grt,Wrt,Zrt].forEach(d=>d(a,l)),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=zme(a.keywords,e.case_insensitive)),c.keywordPatternRe=t(u,!0),l&&(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=Hw(c.end)||"",a.endsWithParent&&l.terminatorEnd&&(c.terminatorEnd+=(a.end?"|":"")+l.terminatorEnd)),a.illegal&&(c.illegalRe=t(a.illegal)),a.contains||(a.contains=[]),a.contains=[].concat(...a.contains.map(function(d){return lit(d==="self"?a:d)})),a.contains.forEach(function(d){s(d,c)}),a.starts&&s(a.starts,l),c.matcher=i(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=pp(e.classNameAliases||{}),s(e)}function Hme(e){return e?e.endsWithParent||Hme(e.starts):!1}function lit(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return pp(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:Hme(e)?pp(e,{starts:e.starts?pp(e.starts):null}):Object.isFrozen(e)?pp(e):e}var cit="11.11.1";class uit extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}}const pD=Mme,uW=pp,dW=Symbol("nomatch"),dit=7,qme=function(e){const t=Object.create(null),n=Object.create(null),r=[];let i=!0;const s="Could not find the language '{}', did you forget to load/include a language module?",a={disableAutodetect:!0,name:"Plain text",contains:[]};let l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:Srt};function c(N){return l.noHighlightRe.test(N)}function u(N){let D=N.className+" ";D+=N.parentNode?N.parentNode.className:"";const Q=l.languageDetectRe.exec(D);if(Q){const F=_(Q[1]);return F||(cW(s.replace("{}",Q[1])),cW("Falling back to no-highlight mode for this block.",N)),F?Q[1]:"no-highlight"}return D.split(/\s+/).find(F=>c(F)||_(F))}function d(N,D,Q){let F="",$="";typeof D=="object"?(F=N,Q=D.ignoreIllegals,$=D.language):(K0("10.7.0","highlight(lang, code, ...args) has been deprecated."),K0("10.7.0",`Please use highlight(code, options) instead. -https://github.com/highlightjs/highlight.js/issues/2277`),$=N,F=D),Q===void 0&&(Q=!0);const H={code:F,language:$};I("before:highlight",H);const z=H.result?H.result:f(H.language,H.code,Q);return z.code=H.code,I("after:highlight",z),z}function f(N,D,Q,F){const $=Object.create(null);function H(re,ue){return re.keywords[ue]}function z(){if(!Te.keywords){he.addText(me);return}let re=0;Te.keywordPatternRe.lastIndex=0;let ue=Te.keywordPatternRe.exec(me),Pe="";for(;ue;){Pe+=me.substring(re,ue.index);const Ge=Ae.case_insensitive?ue[0].toLowerCase():ue[0],W=H(Te,Ge);if(W){const[_e,rt]=W;if(he.addText(Pe),Pe="",$[Ge]=($[Ge]||0)+1,$[Ge]<=dit&&(Se+=rt),_e.startsWith("_"))Pe+=ue[0];else{const Ve=Ae.classNameAliases[_e]||_e;Z(ue[0],Ve)}}else Pe+=ue[0];re=Te.keywordPatternRe.lastIndex,ue=Te.keywordPatternRe.exec(me)}Pe+=me.substring(re),he.addText(Pe)}function B(){if(me==="")return;let re=null;if(typeof Te.subLanguage=="string"){if(!t[Te.subLanguage]){he.addText(me);return}re=f(Te.subLanguage,me,!0,Re[Te.subLanguage]),Re[Te.subLanguage]=re._top}else re=m(me,Te.subLanguage.length?Te.subLanguage:null);Te.relevance>0&&(Se+=re.relevance),he.__addSublanguage(re._emitter,re.language)}function V(){Te.subLanguage!=null?B():z(),me=""}function Z(re,ue){re!==""&&(he.startScope(ue),he.addText(re),he.endScope())}function ce(re,ue){let Pe=1;const Ge=ue.length-1;for(;Pe<=Ge;){if(!re._emit[Pe]){Pe++;continue}const W=Ae.classNameAliases[re[Pe]]||re[Pe],_e=ue[Pe];W?Z(_e,W):(me=_e,z(),me=""),Pe++}}function be(re,ue){return re.scope&&typeof re.scope=="string"&&he.openNode(Ae.classNameAliases[re.scope]||re.scope),re.beginScope&&(re.beginScope._wrap?(Z(me,Ae.classNameAliases[re.beginScope._wrap]||re.beginScope._wrap),me=""):re.beginScope._multi&&(ce(re.beginScope,ue),me="")),Te=Object.create(re,{parent:{value:Te}}),Te}function ie(re,ue,Pe){let Ge=Trt(re.endRe,Pe);if(Ge){if(re["on:end"]){const W=new sW(re);re["on:end"](ue,W),W.isMatchIgnored&&(Ge=!1)}if(Ge){for(;re.endsParent&&re.parent;)re=re.parent;return re}}if(re.endsWithParent)return ie(re.parent,ue,Pe)}function q(re){return Te.matcher.regexIndex===0?(me+=re[0],1):(Qe=!0,0)}function X(re){const ue=re[0],Pe=re.rule,Ge=new sW(Pe),W=[Pe.__beforeBegin,Pe["on:begin"]];for(const _e of W)if(_e&&(_e(re,Ge),Ge.isMatchIgnored))return q(ue);return Pe.skip?me+=ue:(Pe.excludeBegin&&(me+=ue),V(),!Pe.returnBegin&&!Pe.excludeBegin&&(me=ue)),be(Pe,re),Pe.returnBegin?0:ue.length}function K(re){const ue=re[0],Pe=D.substring(re.index),Ge=ie(Te,re,Pe);if(!Ge)return dW;const W=Te;Te.endScope&&Te.endScope._wrap?(V(),Z(ue,Te.endScope._wrap)):Te.endScope&&Te.endScope._multi?(V(),ce(Te.endScope,re)):W.skip?me+=ue:(W.returnEnd||W.excludeEnd||(me+=ue),V(),W.excludeEnd&&(me=ue));do Te.scope&&he.closeNode(),!Te.skip&&!Te.subLanguage&&(Se+=Te.relevance),Te=Te.parent;while(Te!==Ge.parent);return Ge.starts&&be(Ge.starts,re),W.returnEnd?0:ue.length}function de(){const re=[];for(let ue=Te;ue!==Ae;ue=ue.parent)ue.scope&&re.unshift(ue.scope);re.forEach(ue=>he.openNode(ue))}let xe={};function Me(re,ue){const Pe=ue&&ue[0];if(me+=re,Pe==null)return V(),0;if(xe.type==="begin"&&ue.type==="end"&&xe.index===ue.index&&Pe===""){if(me+=D.slice(ue.index,ue.index+1),!i){const Ge=new Error(`0 width match regex (${N})`);throw Ge.languageName=N,Ge.badRule=xe.rule,Ge}return 1}if(xe=ue,ue.type==="begin")return X(ue);if(ue.type==="illegal"&&!Q){const Ge=new Error('Illegal lexeme "'+Pe+'" for mode "'+(Te.scope||"")+'"');throw Ge.mode=Te,Ge}else if(ue.type==="end"){const Ge=K(ue);if(Ge!==dW)return Ge}if(ue.type==="illegal"&&Pe==="")return me+=` -`,1;if(nt>1e5&&nt>ue.index*3)throw new Error("potential infinite loop, way more iterations than matches");return me+=Pe,Pe.length}const Ae=_(N);if(!Ae)throw Sg(s.replace("{}",N)),new Error('Unknown language: "'+N+'"');const He=oit(Ae);let et="",Te=F||He;const Re={},he=new l.__emitter(l);de();let me="",Se=0,ke=0,nt=0,Qe=!1;try{if(Ae.__emitTokens)Ae.__emitTokens(D,he);else{for(Te.matcher.considerAll();;){nt++,Qe?Qe=!1:Te.matcher.considerAll(),Te.matcher.lastIndex=ke;const re=Te.matcher.exec(D);if(!re)break;const ue=D.substring(ke,re.index),Pe=Me(ue,re);ke=re.index+Pe}Me(D.substring(ke))}return he.finalize(),et=he.toHTML(),{language:N,value:et,relevance:Se,illegal:!1,_emitter:he,_top:Te}}catch(re){if(re.message&&re.message.includes("Illegal"))return{language:N,value:pD(D),illegal:!0,relevance:0,_illegalBy:{message:re.message,index:ke,context:D.slice(ke-100,ke+100),mode:re.mode,resultSoFar:et},_emitter:he};if(i)return{language:N,value:pD(D),illegal:!1,relevance:0,errorRaised:re,_emitter:he,_top:Te};throw re}}function h(N){const D={value:pD(N),illegal:!1,relevance:0,_top:a,_emitter:new l.__emitter(l)};return D._emitter.addText(N),D}function m(N,D){D=D||l.languages||Object.keys(t);const Q=h(N),F=D.filter(_).filter(T).map(V=>f(V,N,!1));F.unshift(Q);const $=F.sort((V,Z)=>{if(V.relevance!==Z.relevance)return Z.relevance-V.relevance;if(V.language&&Z.language){if(_(V.language).supersetOf===Z.language)return 1;if(_(Z.language).supersetOf===V.language)return-1}return 0}),[H,z]=$,B=H;return B.secondBest=z,B}function g(N,D,Q){const F=D&&n[D]||Q;N.classList.add("hljs"),N.classList.add(`language-${F}`)}function b(N){let D=null;const Q=u(N);if(c(Q))return;if(I("before:highlightElement",{el:N,language:Q}),N.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",N);return}if(N.children.length>0&&(l.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(N)),l.throwUnescapedHTML))throw new uit("One of your code blocks includes unescaped HTML.",N.innerHTML);D=N;const F=D.textContent,$=Q?d(F,{language:Q,ignoreIllegals:!0}):m(F);N.innerHTML=$.value,N.dataset.highlighted="yes",g(N,Q,$.language),N.result={language:$.language,re:$.relevance,relevance:$.relevance},$.secondBest&&(N.secondBest={language:$.secondBest.language,relevance:$.secondBest.relevance}),I("after:highlightElement",{el:N,result:$,text:F})}function y(N){l=uW(l,N)}const O=()=>{w(),K0("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function v(){w(),K0("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let x=!1;function w(){function N(){w()}if(document.readyState==="loading"){x||window.addEventListener("DOMContentLoaded",N,!1),x=!0;return}document.querySelectorAll(l.cssSelector).forEach(b)}function S(N,D){let Q=null;try{Q=D(e)}catch(F){if(Sg("Language definition for '{}' could not be registered.".replace("{}",N)),i)Sg(F);else throw F;Q=a}Q.name||(Q.name=N),t[N]=Q,Q.rawDefinition=D.bind(null,e),Q.aliases&&C(Q.aliases,{languageName:N})}function E(N){delete t[N];for(const D of Object.keys(n))n[D]===N&&delete n[D]}function k(){return Object.keys(t)}function _(N){return N=(N||"").toLowerCase(),t[N]||t[n[N]]}function C(N,{languageName:D}){typeof N=="string"&&(N=[N]),N.forEach(Q=>{n[Q.toLowerCase()]=D})}function T(N){const D=_(N);return D&&!D.disableAutodetect}function A(N){N["before:highlightBlock"]&&!N["before:highlightElement"]&&(N["before:highlightElement"]=D=>{N["before:highlightBlock"](Object.assign({block:D.el},D))}),N["after:highlightBlock"]&&!N["after:highlightElement"]&&(N["after:highlightElement"]=D=>{N["after:highlightBlock"](Object.assign({block:D.el},D))})}function j(N){A(N),r.push(N)}function L(N){const D=r.indexOf(N);D!==-1&&r.splice(D,1)}function I(N,D){const Q=N;r.forEach(function(F){F[Q]&&F[Q](D)})}function M(N){return K0("10.7.0","highlightBlock will be removed entirely in v12.0"),K0("10.7.0","Please use highlightElement now."),b(N)}Object.assign(e,{highlight:d,highlightAuto:m,highlightAll:w,highlightElement:b,highlightBlock:M,configure:y,initHighlighting:O,initHighlightingOnLoad:v,registerLanguage:S,unregisterLanguage:E,listLanguages:k,getLanguage:_,registerAliases:C,autoDetection:T,inherit:uW,addPlugin:j,removePlugin:L}),e.debugMode=function(){i=!1},e.safeMode=function(){i=!0},e.versionString=cit,e.regex={concat:v0,lookahead:Lme,either:OB,optional:krt,anyNumberOfTimes:Ert};for(const N in S2)typeof S2[N]=="object"&&Pme(S2[N]);return Object.assign(e,S2),e},p1=qme({});p1.newInstance=()=>qme({});var fit=p1;p1.HighlightJS=p1;p1.default=p1;const eo=N1(fit),fW={},hit="hljs-";function pit(e){const t=eo.newInstance();return e&&s(e),{highlight:n,highlightAuto:r,listLanguages:i,register:s,registerAlias:a,registered:l};function n(c,u,d){const f=d||fW,h=typeof f.prefix=="string"?f.prefix:hit;if(!t.getLanguage(c))throw new Error("Unknown language: `"+c+"` is not registered");t.configure({__emitter:mit,classPrefix:h});const m=t.highlight(u,{ignoreIllegals:!0,language:c});if(m.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:m.errorRaised});const g=m._emitter.root,b=g.data;return b.language=m.language,b.relevance=m.relevance,g}function r(c,u){const f=(u||fW).subset||i();let h=-1,m=0,g;for(;++hm&&(m=y.data.relevance,g=y)}return g||{type:"root",children:[],data:{language:void 0,relevance:m}}}function i(){return t.listLanguages()}function s(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 l(c){return!!t.getLanguage(c)}}class mit{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],i=t.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):r.children.push(...i)}openNode(t){const n=this,r=t.split(".").map(function(a,l){return l?a+"_".repeat(l):n.options.classPrefix+a}),i=this.stack[this.stack.length-1],s={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(s),this.stack.push(s)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const git={};function hW(e){const t=e||git,n=t.aliases,r=t.detect||!1,i=t.languages||Ort,s=t.plainText,a=t.prefix,l=t.subset;let c="hljs";const u=pit(i);if(n&&u.registerAlias(n),a){const d=a.indexOf("-");c=d===-1?a:a.slice(0,d)}return function(d,f){wE(d,"element",function(h,m,g){if(h.tagName!=="code"||!g||g.type!=="element"||g.tagName!=="pre")return;const b=bit(h);if(b===!1||!b&&!r||b&&s&&s.includes(b))return;Array.isArray(h.properties.className)||(h.properties.className=[]),h.properties.className.includes(c)||h.properties.className.unshift(c);const y=ent(h,{whitespace:"pre"});let O;try{O=b?u.highlight(b,y,{prefix:a}):u.highlightAuto(y,{prefix:a,subset:l})}catch(v){const x=v;if(b&&/Unknown language/.test(x.message)){f.message("Cannot highlight as `"+b+"`, it’s not registered",{ancestors:[g,h],cause:x,place:h.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw x}!b&&O.data&&O.data.language&&h.properties.className.push("language-"+O.data.language),O.children.length>0&&(h.children=O.children)})}}function bit(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let r;for(;++n-1&&s<=t.length){let a=0;for(;;){let l=n[a];if(l===void 0){const c=gW(t,n[a-1]);l=c===-1?t.length+1:c+1,n[a]=l}if(l>s)return{line:a+1,column:s-(a>0?n[a-1]:0)+1,offset:s};a++}}}function i(s){if(s&&typeof s.line=="number"&&typeof s.column=="number"&&!Number.isNaN(s.line)&&!Number.isNaN(s.column)){for(;n.length1?n[s.line-2]:0)+s.column-1;if(a=55296&&e<=57343}function zit(e){return e>=56320&&e<=57343}function Vit(e,t){return(e-55296)*1024+9216+t}function Kme(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function Jme(e){return e>=64976&&e<=65007||Fit.has(e)}var Ke;(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"})(Ke||(Ke={}));const Hit=65536;class qit{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=Hit,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:i,offset:s}=this,a=i+n,l=s+n;return{code:t,startLine:r,endLine:r,startCol:a,endCol:a,startOffset:l,endOffset:l}}_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(zit(n))return this.pos++,this._addGap(),Vit(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,te.EOF;return this._err(Ke.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,te.EOF;const r=this.html.charCodeAt(n);return r===te.CARRIAGE_RETURN?te.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,te.EOF;let t=this.html.charCodeAt(this.pos);return t===te.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,te.LINE_FEED):t===te.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,Zme(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===te.LINE_FEED||t===te.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){Kme(t)?this._err(Ke.controlCharacterInInputStream):Jme(t)&&this._err(Ke.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 Xit=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))),Git=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 Wit(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=Git.get(e))!==null&&t!==void 0?t:e}var pa;(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"})(pa||(pa={}));const Yit=32;var mp;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(mp||(mp={}));function lL(e){return e>=pa.ZERO&&e<=pa.NINE}function Zit(e){return e>=pa.UPPER_A&&e<=pa.UPPER_F||e>=pa.LOWER_A&&e<=pa.LOWER_F}function Kit(e){return e>=pa.UPPER_A&&e<=pa.UPPER_Z||e>=pa.LOWER_A&&e<=pa.LOWER_Z||lL(e)}function Jit(e){return e===pa.EQUALS||Kit(e)}var sa;(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"})(sa||(sa={}));var yf;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(yf||(yf={}));class est{constructor(t,n,r){this.decodeTree=t,this.emitCodePoint=n,this.errors=r,this.state=sa.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=yf.Strict}startEntity(t){this.decodeMode=t,this.state=sa.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case sa.EntityStart:return t.charCodeAt(n)===pa.NUM?(this.state=sa.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=sa.NamedEntity,this.stateNamedEntity(t,n));case sa.NumericStart:return this.stateNumericStart(t,n);case sa.NumericDecimal:return this.stateNumericDecimal(t,n);case sa.NumericHex:return this.stateNumericHex(t,n);case sa.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|Yit)===pa.LOWER_X?(this.state=sa.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=sa.NumericDecimal,this.stateNumericDecimal(t,n))}addToNumericResult(t,n,r,i){if(n!==r){const s=r-n;this.result=this.result*Math.pow(i,s)+Number.parseInt(t.substr(n,s),i),this.consumed+=s}}stateNumericHex(t,n){const r=n;for(;n>14;for(;n>14,s!==0){if(a===pa.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==yf.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;const{result:n,decodeTree:r}=this,i=(r[n]&mp.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,i,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,r){const{decodeTree:i}=this;return this.emitCodePoint(n===1?i[t]&~mp.VALUE_LENGTH:i[t+1],r),n===3&&this.emitCodePoint(i[t+2],r),r}end(){var t;switch(this.state){case sa.NamedEntity:return this.result!==0&&(this.decodeMode!==yf.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case sa.NumericDecimal:return this.emitNumericEntity(0,2);case sa.NumericHex:return this.emitNumericEntity(0,3);case sa.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case sa.EntityStart:return 0}}}function tst(e,t,n,r){const i=(t&mp.BRANCH_LENGTH)>>7,s=t&mp.JUMP_TABLE;if(i===0)return s!==0&&r===s?n:-1;if(s){const c=r-s;return c<0||c>=i?-1:e[n+c]-1}let a=n,l=a+i-1;for(;a<=l;){const c=a+l>>>1,u=e[c];if(ur)l=c-1;else return e[c+i]}return-1}var ht;(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/"})(ht||(ht={}));var Eg;(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"})(Eg||(Eg={}));var xc;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(xc||(xc={}));var je;(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"})(je||(je={}));var R;(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"})(R||(R={}));const nst=new Map([[je.A,R.A],[je.ADDRESS,R.ADDRESS],[je.ANNOTATION_XML,R.ANNOTATION_XML],[je.APPLET,R.APPLET],[je.AREA,R.AREA],[je.ARTICLE,R.ARTICLE],[je.ASIDE,R.ASIDE],[je.B,R.B],[je.BASE,R.BASE],[je.BASEFONT,R.BASEFONT],[je.BGSOUND,R.BGSOUND],[je.BIG,R.BIG],[je.BLOCKQUOTE,R.BLOCKQUOTE],[je.BODY,R.BODY],[je.BR,R.BR],[je.BUTTON,R.BUTTON],[je.CAPTION,R.CAPTION],[je.CENTER,R.CENTER],[je.CODE,R.CODE],[je.COL,R.COL],[je.COLGROUP,R.COLGROUP],[je.DD,R.DD],[je.DESC,R.DESC],[je.DETAILS,R.DETAILS],[je.DIALOG,R.DIALOG],[je.DIR,R.DIR],[je.DIV,R.DIV],[je.DL,R.DL],[je.DT,R.DT],[je.EM,R.EM],[je.EMBED,R.EMBED],[je.FIELDSET,R.FIELDSET],[je.FIGCAPTION,R.FIGCAPTION],[je.FIGURE,R.FIGURE],[je.FONT,R.FONT],[je.FOOTER,R.FOOTER],[je.FOREIGN_OBJECT,R.FOREIGN_OBJECT],[je.FORM,R.FORM],[je.FRAME,R.FRAME],[je.FRAMESET,R.FRAMESET],[je.H1,R.H1],[je.H2,R.H2],[je.H3,R.H3],[je.H4,R.H4],[je.H5,R.H5],[je.H6,R.H6],[je.HEAD,R.HEAD],[je.HEADER,R.HEADER],[je.HGROUP,R.HGROUP],[je.HR,R.HR],[je.HTML,R.HTML],[je.I,R.I],[je.IMG,R.IMG],[je.IMAGE,R.IMAGE],[je.INPUT,R.INPUT],[je.IFRAME,R.IFRAME],[je.KEYGEN,R.KEYGEN],[je.LABEL,R.LABEL],[je.LI,R.LI],[je.LINK,R.LINK],[je.LISTING,R.LISTING],[je.MAIN,R.MAIN],[je.MALIGNMARK,R.MALIGNMARK],[je.MARQUEE,R.MARQUEE],[je.MATH,R.MATH],[je.MENU,R.MENU],[je.META,R.META],[je.MGLYPH,R.MGLYPH],[je.MI,R.MI],[je.MO,R.MO],[je.MN,R.MN],[je.MS,R.MS],[je.MTEXT,R.MTEXT],[je.NAV,R.NAV],[je.NOBR,R.NOBR],[je.NOFRAMES,R.NOFRAMES],[je.NOEMBED,R.NOEMBED],[je.NOSCRIPT,R.NOSCRIPT],[je.OBJECT,R.OBJECT],[je.OL,R.OL],[je.OPTGROUP,R.OPTGROUP],[je.OPTION,R.OPTION],[je.P,R.P],[je.PARAM,R.PARAM],[je.PLAINTEXT,R.PLAINTEXT],[je.PRE,R.PRE],[je.RB,R.RB],[je.RP,R.RP],[je.RT,R.RT],[je.RTC,R.RTC],[je.RUBY,R.RUBY],[je.S,R.S],[je.SCRIPT,R.SCRIPT],[je.SEARCH,R.SEARCH],[je.SECTION,R.SECTION],[je.SELECT,R.SELECT],[je.SOURCE,R.SOURCE],[je.SMALL,R.SMALL],[je.SPAN,R.SPAN],[je.STRIKE,R.STRIKE],[je.STRONG,R.STRONG],[je.STYLE,R.STYLE],[je.SUB,R.SUB],[je.SUMMARY,R.SUMMARY],[je.SUP,R.SUP],[je.TABLE,R.TABLE],[je.TBODY,R.TBODY],[je.TEMPLATE,R.TEMPLATE],[je.TEXTAREA,R.TEXTAREA],[je.TFOOT,R.TFOOT],[je.TD,R.TD],[je.TH,R.TH],[je.THEAD,R.THEAD],[je.TITLE,R.TITLE],[je.TR,R.TR],[je.TRACK,R.TRACK],[je.TT,R.TT],[je.U,R.U],[je.UL,R.UL],[je.SVG,R.SVG],[je.VAR,R.VAR],[je.WBR,R.WBR],[je.XMP,R.XMP]]);function uO(e){var t;return(t=nst.get(e))!==null&&t!==void 0?t:R.UNKNOWN}const gt=R,rst={[ht.HTML]:new Set([gt.ADDRESS,gt.APPLET,gt.AREA,gt.ARTICLE,gt.ASIDE,gt.BASE,gt.BASEFONT,gt.BGSOUND,gt.BLOCKQUOTE,gt.BODY,gt.BR,gt.BUTTON,gt.CAPTION,gt.CENTER,gt.COL,gt.COLGROUP,gt.DD,gt.DETAILS,gt.DIR,gt.DIV,gt.DL,gt.DT,gt.EMBED,gt.FIELDSET,gt.FIGCAPTION,gt.FIGURE,gt.FOOTER,gt.FORM,gt.FRAME,gt.FRAMESET,gt.H1,gt.H2,gt.H3,gt.H4,gt.H5,gt.H6,gt.HEAD,gt.HEADER,gt.HGROUP,gt.HR,gt.HTML,gt.IFRAME,gt.IMG,gt.INPUT,gt.LI,gt.LINK,gt.LISTING,gt.MAIN,gt.MARQUEE,gt.MENU,gt.META,gt.NAV,gt.NOEMBED,gt.NOFRAMES,gt.NOSCRIPT,gt.OBJECT,gt.OL,gt.P,gt.PARAM,gt.PLAINTEXT,gt.PRE,gt.SCRIPT,gt.SECTION,gt.SELECT,gt.SOURCE,gt.STYLE,gt.SUMMARY,gt.TABLE,gt.TBODY,gt.TD,gt.TEMPLATE,gt.TEXTAREA,gt.TFOOT,gt.TH,gt.THEAD,gt.TITLE,gt.TR,gt.TRACK,gt.UL,gt.WBR,gt.XMP]),[ht.MATHML]:new Set([gt.MI,gt.MO,gt.MN,gt.MS,gt.MTEXT,gt.ANNOTATION_XML]),[ht.SVG]:new Set([gt.TITLE,gt.FOREIGN_OBJECT,gt.DESC]),[ht.XLINK]:new Set,[ht.XML]:new Set,[ht.XMLNS]:new Set},cL=new Set([gt.H1,gt.H2,gt.H3,gt.H4,gt.H5,gt.H6]);je.STYLE,je.SCRIPT,je.XMP,je.IFRAME,je.NOEMBED,je.NOFRAMES,je.PLAINTEXT;var ae;(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"})(ae||(ae={}));const _s={DATA:ae.DATA,RCDATA:ae.RCDATA,RAWTEXT:ae.RAWTEXT,SCRIPT_DATA:ae.SCRIPT_DATA,PLAINTEXT:ae.PLAINTEXT,CDATA_SECTION:ae.CDATA_SECTION};function ist(e){return e>=te.DIGIT_0&&e<=te.DIGIT_9}function Xx(e){return e>=te.LATIN_CAPITAL_A&&e<=te.LATIN_CAPITAL_Z}function sst(e){return e>=te.LATIN_SMALL_A&&e<=te.LATIN_SMALL_Z}function Hh(e){return sst(e)||Xx(e)}function yW(e){return Hh(e)||ist(e)}function E2(e){return e+32}function tge(e){return e===te.SPACE||e===te.LINE_FEED||e===te.TABULATION||e===te.FORM_FEED}function OW(e){return tge(e)||e===te.SOLIDUS||e===te.GREATER_THAN_SIGN}function ast(e){return e===te.NULL?Ke.nullCharacterReference:e>1114111?Ke.characterReferenceOutsideUnicodeRange:Zme(e)?Ke.surrogateCharacterReference:Jme(e)?Ke.noncharacterCharacterReference:Kme(e)||e===te.CARRIAGE_RETURN?Ke.controlCharacterReference:null}class ost{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=ae.DATA,this.returnState=ae.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new qit(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new est(Xit,(r,i)=>{this.preprocessor.pos=this.entityStartPos+i-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(Ke.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(Ke.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const i=ast(r);i&&this._err(i,1)}}:void 0)}_err(t,n=0){var r,i;(i=(r=this.handler).onParseError)===null||i===void 0||i.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(Ke.endTagWithAttributes),t.selfClosing&&this._err(Ke.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 or.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case or.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case or.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:or.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=tge(t)?or.WHITESPACE_CHARACTER:t===te.NULL?or.NULL_CHARACTER:or.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(or.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=ae.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?yf.Attribute:yf.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===ae.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===ae.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===ae.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case ae.DATA:{this._stateData(t);break}case ae.RCDATA:{this._stateRcdata(t);break}case ae.RAWTEXT:{this._stateRawtext(t);break}case ae.SCRIPT_DATA:{this._stateScriptData(t);break}case ae.PLAINTEXT:{this._statePlaintext(t);break}case ae.TAG_OPEN:{this._stateTagOpen(t);break}case ae.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case ae.TAG_NAME:{this._stateTagName(t);break}case ae.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case ae.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case ae.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case ae.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case ae.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case ae.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case ae.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case ae.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case ae.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case ae.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case ae.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case ae.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case ae.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case ae.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case ae.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case ae.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case ae.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case ae.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case ae.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case ae.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case ae.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case ae.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case ae.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case ae.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case ae.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case ae.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case ae.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case ae.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case ae.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case ae.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case ae.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case ae.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case ae.BOGUS_COMMENT:{this._stateBogusComment(t);break}case ae.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case ae.COMMENT_START:{this._stateCommentStart(t);break}case ae.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case ae.COMMENT:{this._stateComment(t);break}case ae.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case ae.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case ae.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case ae.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case ae.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case ae.COMMENT_END:{this._stateCommentEnd(t);break}case ae.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case ae.DOCTYPE:{this._stateDoctype(t);break}case ae.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case ae.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case ae.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case ae.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case ae.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case ae.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case ae.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case ae.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case ae.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case ae.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case ae.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case ae.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case ae.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case ae.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case ae.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case ae.CDATA_SECTION:{this._stateCdataSection(t);break}case ae.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case ae.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case ae.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case ae.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case te.LESS_THAN_SIGN:{this.state=ae.TAG_OPEN;break}case te.AMPERSAND:{this._startCharacterReference();break}case te.NULL:{this._err(Ke.unexpectedNullCharacter),this._emitCodePoint(t);break}case te.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case te.AMPERSAND:{this._startCharacterReference();break}case te.LESS_THAN_SIGN:{this.state=ae.RCDATA_LESS_THAN_SIGN;break}case te.NULL:{this._err(Ke.unexpectedNullCharacter),this._emitChars(qi);break}case te.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case te.LESS_THAN_SIGN:{this.state=ae.RAWTEXT_LESS_THAN_SIGN;break}case te.NULL:{this._err(Ke.unexpectedNullCharacter),this._emitChars(qi);break}case te.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case te.LESS_THAN_SIGN:{this.state=ae.SCRIPT_DATA_LESS_THAN_SIGN;break}case te.NULL:{this._err(Ke.unexpectedNullCharacter),this._emitChars(qi);break}case te.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case te.NULL:{this._err(Ke.unexpectedNullCharacter),this._emitChars(qi);break}case te.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(Hh(t))this._createStartTagToken(),this.state=ae.TAG_NAME,this._stateTagName(t);else switch(t){case te.EXCLAMATION_MARK:{this.state=ae.MARKUP_DECLARATION_OPEN;break}case te.SOLIDUS:{this.state=ae.END_TAG_OPEN;break}case te.QUESTION_MARK:{this._err(Ke.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=ae.BOGUS_COMMENT,this._stateBogusComment(t);break}case te.EOF:{this._err(Ke.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(Ke.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=ae.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(Hh(t))this._createEndTagToken(),this.state=ae.TAG_NAME,this._stateTagName(t);else switch(t){case te.GREATER_THAN_SIGN:{this._err(Ke.missingEndTagName),this.state=ae.DATA;break}case te.EOF:{this._err(Ke.eofBeforeTagName),this._emitChars("");break}case te.NULL:{this._err(Ke.unexpectedNullCharacter),this.state=ae.SCRIPT_DATA_ESCAPED,this._emitChars(qi);break}case te.EOF:{this._err(Ke.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=ae.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===te.SOLIDUS?this.state=ae.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:Hh(t)?(this._emitChars("<"),this.state=ae.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=ae.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){Hh(t)?(this.state=ae.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("");break}case te.NULL:{this._err(Ke.unexpectedNullCharacter),this.state=ae.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(qi);break}case te.EOF:{this._err(Ke.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=ae.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===te.SOLIDUS?(this.state=ae.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=ae.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(Po.SCRIPT,!1)&&OW(this.preprocessor.peek(Po.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 i=this._indexOf(t)+1;this.items.splice(i,0,n),this.tagIDs.splice(i,0,r),this.stackTop++,i===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,i===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])!==ht.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(fst,ht.HTML)}clearBackToTableBodyContext(){this.clearBackTo(dst,ht.HTML)}clearBackToTableRowContext(){this.clearBackTo(ust,ht.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]===R.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]===R.HTML}hasInDynamicScope(t,n){for(let r=this.stackTop;r>=0;r--){const i=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case ht.HTML:{if(i===t)return!0;if(n.has(i))return!1;break}case ht.SVG:{if(wW.has(i))return!1;break}case ht.MATHML:{if(vW.has(i))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,JC)}hasInListItemScope(t){return this.hasInDynamicScope(t,lst)}hasInButtonScope(t){return this.hasInDynamicScope(t,cst)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const n=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case ht.HTML:{if(cL.has(n))return!0;if(JC.has(n))return!1;break}case ht.SVG:{if(wW.has(n))return!1;break}case ht.MATHML:{if(vW.has(n))return!1;break}}}return!0}hasInTableScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===ht.HTML)switch(this.tagIDs[n]){case t:return!0;case R.TABLE:case R.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===ht.HTML)switch(this.tagIDs[t]){case R.TBODY:case R.THEAD:case R.TFOOT:return!0;case R.TABLE:case R.HTML:return!1}return!0}hasInSelectScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===ht.HTML)switch(this.tagIDs[n]){case t:return!0;case R.OPTION:case R.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&nge.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&xW.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&xW.has(this.currentTagId);)this.pop()}}const mD=3;var qu;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(qu||(qu={}));const SW={type:qu.Marker};class mst{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){const r=[],i=n.length,s=this.treeAdapter.getTagName(t),a=this.treeAdapter.getNamespaceURI(t);for(let l=0;l[a.name,a.value]));let s=0;for(let a=0;ai.get(c.name)===c.value)&&(s+=1,s>=mD&&this.entries.splice(l.idx,1))}}insertMarker(){this.entries.unshift(SW)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:qu.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:qu.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(SW);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(r=>r.type===qu.Marker||this.treeAdapter.getTagName(r.element)===t);return n&&n.type===qu.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===qu.Element&&n.element===t)}}const qh={createDocument(){return{nodeName:"#document",mode:xc.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 i=e.childNodes.find(s=>s.nodeName==="#documentType");if(i)i.name=t,i.publicId=n,i.systemId=r;else{const s={nodeName:"#documentType",name:t,publicId:n,systemId:r,parentNode:null};qh.appendChild(e,s)}},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(qh.isTextNode(n)){n.value+=t;return}}qh.appendChild(e,qh.createTextNode(t))},insertTextBefore(e,t,n){const r=e.childNodes[e.childNodes.indexOf(n)-1];r&&qh.isTextNode(r)?r.value+=t:qh.insertBefore(e,qh.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(r=>r.name));for(let r=0;re.startsWith(n))}function vst(e){return e.name===rge&&e.publicId===null&&(e.systemId===null||e.systemId===gst)}function wst(e){if(e.name!==rge)return xc.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===bst)return xc.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),Ost.has(n))return xc.QUIRKS;let r=t===null?yst:ige;if(EW(n,r))return xc.QUIRKS;if(r=t===null?sge:xst,EW(n,r))return xc.LIMITED_QUIRKS}return xc.NO_QUIRKS}const kW={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},Sst="definitionurl",Est="definitionURL",kst=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])),_st=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:ht.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:ht.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:ht.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:ht.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:ht.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:ht.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:ht.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:ht.XML}],["xml:space",{prefix:"xml",name:"space",namespace:ht.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:ht.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:ht.XMLNS}]]),Tst=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])),Cst=new Set([R.B,R.BIG,R.BLOCKQUOTE,R.BODY,R.BR,R.CENTER,R.CODE,R.DD,R.DIV,R.DL,R.DT,R.EM,R.EMBED,R.H1,R.H2,R.H3,R.H4,R.H5,R.H6,R.HEAD,R.HR,R.I,R.IMG,R.LI,R.LISTING,R.MENU,R.META,R.NOBR,R.OL,R.P,R.PRE,R.RUBY,R.S,R.SMALL,R.SPAN,R.STRONG,R.STRIKE,R.SUB,R.SUP,R.TABLE,R.TT,R.U,R.UL,R.VAR]);function Ast(e){const t=e.tagID;return t===R.FONT&&e.attrs.some(({name:r})=>r===Eg.COLOR||r===Eg.SIZE||r===Eg.FACE)||Cst.has(t)}function age(e){for(let t=0;t0&&this._setContextModes(t,n)}onItemPop(t,n){var r,i;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(i=(r=this.treeAdapter).onItemPop)===null||i===void 0||i.call(r,t,this.openElements.current),n){let s,a;this.openElements.stackTop===0&&this.fragmentContext?(s=this.fragmentContext,a=this.fragmentContextID):{current:s,currentTagId:a}=this.openElements,this._setContextModes(s,a)}}_setContextModes(t,n){const r=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===ht.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&t!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,t)}_switchToTextParsing(t,n){this._insertElement(t,ht.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=fe.TEXT}switchToPlaintextParsing(){this.insertionMode=fe.TEXT,this.originalInsertionMode=fe.IN_BODY,this.tokenizer.state=_s.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)===je.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==ht.HTML))switch(this.fragmentContextID){case R.TITLE:case R.TEXTAREA:{this.tokenizer.state=_s.RCDATA;break}case R.STYLE:case R.XMP:case R.IFRAME:case R.NOEMBED:case R.NOFRAMES:case R.NOSCRIPT:{this.tokenizer.state=_s.RAWTEXT;break}case R.SCRIPT:{this.tokenizer.state=_s.SCRIPT_DATA;break}case R.PLAINTEXT:{this.tokenizer.state=_s.PLAINTEXT;break}}}_setDocumentType(t){const n=t.name||"",r=t.publicId||"",i=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,r,i),t.location){const a=this.treeAdapter.getChildNodes(this.document).find(l=>this.treeAdapter.isDocumentTypeNode(l));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,ht.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,n)}_insertTemplate(t){const n=this.treeAdapter.createElement(t.tagName,ht.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(je.HTML,ht.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,R.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 i=this.treeAdapter.getChildNodes(n),s=r?i.lastIndexOf(r):i.length,a=i[s-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,i=this.treeAdapter.getTagName(t),s=n.type===or.END_TAG&&i===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,s)}}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===R.SVG&&this.treeAdapter.getTagName(n)===je.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===ht.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===R.MGLYPH||t.tagID===R.MALIGNMARK)&&r!==void 0&&!this._isIntegrationPoint(r,n,ht.HTML)}_processToken(t){switch(t.type){case or.CHARACTER:{this.onCharacter(t);break}case or.NULL_CHARACTER:{this.onNullCharacter(t);break}case or.COMMENT:{this.onComment(t);break}case or.DOCTYPE:{this.onDoctype(t);break}case or.START_TAG:{this._processStartTag(t);break}case or.END_TAG:{this.onEndTag(t);break}case or.EOF:{this.onEof(t);break}case or.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,r){const i=this.treeAdapter.getNamespaceURI(n),s=this.treeAdapter.getAttrList(n);return Ist(t,i,s,r)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(i=>i.type===qu.Marker||this.openElements.contains(i.element)),r=n===-1?t-1:n-1;for(let i=r;i>=0;i--){const s=this.activeFormattingElements.entries[i];this._insertElement(s.token,this.treeAdapter.getNamespaceURI(s.element)),s.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=fe.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(R.P),this.openElements.popUntilTagNamePopped(R.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case R.TR:{this.insertionMode=fe.IN_ROW;return}case R.TBODY:case R.THEAD:case R.TFOOT:{this.insertionMode=fe.IN_TABLE_BODY;return}case R.CAPTION:{this.insertionMode=fe.IN_CAPTION;return}case R.COLGROUP:{this.insertionMode=fe.IN_COLUMN_GROUP;return}case R.TABLE:{this.insertionMode=fe.IN_TABLE;return}case R.BODY:{this.insertionMode=fe.IN_BODY;return}case R.FRAMESET:{this.insertionMode=fe.IN_FRAMESET;return}case R.SELECT:{this._resetInsertionModeForSelect(t);return}case R.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case R.HTML:{this.insertionMode=this.headElement?fe.AFTER_HEAD:fe.BEFORE_HEAD;return}case R.TD:case R.TH:{if(t>0){this.insertionMode=fe.IN_CELL;return}break}case R.HEAD:{if(t>0){this.insertionMode=fe.IN_HEAD;return}break}}this.insertionMode=fe.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let n=t-1;n>0;n--){const r=this.openElements.tagIDs[n];if(r===R.TEMPLATE)break;if(r===R.TABLE){this.insertionMode=fe.IN_SELECT_IN_TABLE;return}}this.insertionMode=fe.IN_SELECT}_isElementCausesFosterParenting(t){return lge.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 R.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===ht.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case R.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 rst[r].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){hot(this,t);return}switch(this.insertionMode){case fe.INITIAL:{cx(this,t);break}case fe.BEFORE_HTML:{Dv(this,t);break}case fe.BEFORE_HEAD:{Pv(this,t);break}case fe.IN_HEAD:{Mv(this,t);break}case fe.IN_HEAD_NO_SCRIPT:{Lv(this,t);break}case fe.AFTER_HEAD:{$v(this,t);break}case fe.IN_BODY:case fe.IN_CAPTION:case fe.IN_CELL:case fe.IN_TEMPLATE:{uge(this,t);break}case fe.TEXT:case fe.IN_SELECT:case fe.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case fe.IN_TABLE:case fe.IN_TABLE_BODY:case fe.IN_ROW:{gD(this,t);break}case fe.IN_TABLE_TEXT:{gge(this,t);break}case fe.IN_COLUMN_GROUP:{eA(this,t);break}case fe.AFTER_BODY:{tA(this,t);break}case fe.AFTER_AFTER_BODY:{oT(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){fot(this,t);return}switch(this.insertionMode){case fe.INITIAL:{cx(this,t);break}case fe.BEFORE_HTML:{Dv(this,t);break}case fe.BEFORE_HEAD:{Pv(this,t);break}case fe.IN_HEAD:{Mv(this,t);break}case fe.IN_HEAD_NO_SCRIPT:{Lv(this,t);break}case fe.AFTER_HEAD:{$v(this,t);break}case fe.TEXT:{this._insertCharacters(t);break}case fe.IN_TABLE:case fe.IN_TABLE_BODY:case fe.IN_ROW:{gD(this,t);break}case fe.IN_COLUMN_GROUP:{eA(this,t);break}case fe.AFTER_BODY:{tA(this,t);break}case fe.AFTER_AFTER_BODY:{oT(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){uL(this,t);return}switch(this.insertionMode){case fe.INITIAL:case fe.BEFORE_HTML:case fe.BEFORE_HEAD:case fe.IN_HEAD:case fe.IN_HEAD_NO_SCRIPT:case fe.AFTER_HEAD:case fe.IN_BODY:case fe.IN_TABLE:case fe.IN_CAPTION:case fe.IN_COLUMN_GROUP:case fe.IN_TABLE_BODY:case fe.IN_ROW:case fe.IN_CELL:case fe.IN_SELECT:case fe.IN_SELECT_IN_TABLE:case fe.IN_TEMPLATE:case fe.IN_FRAMESET:case fe.AFTER_FRAMESET:{uL(this,t);break}case fe.IN_TABLE_TEXT:{ux(this,t);break}case fe.AFTER_BODY:{Vst(this,t);break}case fe.AFTER_AFTER_BODY:case fe.AFTER_AFTER_FRAMESET:{Hst(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case fe.INITIAL:{qst(this,t);break}case fe.BEFORE_HEAD:case fe.IN_HEAD:case fe.IN_HEAD_NO_SCRIPT:case fe.AFTER_HEAD:{this._err(t,Ke.misplacedDoctype);break}case fe.IN_TABLE_TEXT:{ux(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,Ke.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?pot(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case fe.INITIAL:{cx(this,t);break}case fe.BEFORE_HTML:{Xst(this,t);break}case fe.BEFORE_HEAD:{Wst(this,t);break}case fe.IN_HEAD:{Cu(this,t);break}case fe.IN_HEAD_NO_SCRIPT:{Kst(this,t);break}case fe.AFTER_HEAD:{eat(this,t);break}case fe.IN_BODY:{ro(this,t);break}case fe.IN_TABLE:{m1(this,t);break}case fe.IN_TABLE_TEXT:{ux(this,t);break}case fe.IN_CAPTION:{Yat(this,t);break}case fe.IN_COLUMN_GROUP:{TB(this,t);break}case fe.IN_TABLE_BODY:{Ij(this,t);break}case fe.IN_ROW:{Dj(this,t);break}case fe.IN_CELL:{Jat(this,t);break}case fe.IN_SELECT:{Oge(this,t);break}case fe.IN_SELECT_IN_TABLE:{tot(this,t);break}case fe.IN_TEMPLATE:{rot(this,t);break}case fe.AFTER_BODY:{sot(this,t);break}case fe.IN_FRAMESET:{aot(this,t);break}case fe.AFTER_FRAMESET:{lot(this,t);break}case fe.AFTER_AFTER_BODY:{uot(this,t);break}case fe.AFTER_AFTER_FRAMESET:{dot(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?mot(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case fe.INITIAL:{cx(this,t);break}case fe.BEFORE_HTML:{Gst(this,t);break}case fe.BEFORE_HEAD:{Yst(this,t);break}case fe.IN_HEAD:{Zst(this,t);break}case fe.IN_HEAD_NO_SCRIPT:{Jst(this,t);break}case fe.AFTER_HEAD:{tat(this,t);break}case fe.IN_BODY:{Rj(this,t);break}case fe.TEXT:{Qat(this,t);break}case fe.IN_TABLE:{Xw(this,t);break}case fe.IN_TABLE_TEXT:{ux(this,t);break}case fe.IN_CAPTION:{Zat(this,t);break}case fe.IN_COLUMN_GROUP:{Kat(this,t);break}case fe.IN_TABLE_BODY:{dL(this,t);break}case fe.IN_ROW:{yge(this,t);break}case fe.IN_CELL:{eot(this,t);break}case fe.IN_SELECT:{xge(this,t);break}case fe.IN_SELECT_IN_TABLE:{not(this,t);break}case fe.IN_TEMPLATE:{iot(this,t);break}case fe.AFTER_BODY:{wge(this,t);break}case fe.IN_FRAMESET:{oot(this,t);break}case fe.AFTER_FRAMESET:{cot(this,t);break}case fe.AFTER_AFTER_BODY:{oT(this,t);break}}}onEof(t){switch(this.insertionMode){case fe.INITIAL:{cx(this,t);break}case fe.BEFORE_HTML:{Dv(this,t);break}case fe.BEFORE_HEAD:{Pv(this,t);break}case fe.IN_HEAD:{Mv(this,t);break}case fe.IN_HEAD_NO_SCRIPT:{Lv(this,t);break}case fe.AFTER_HEAD:{$v(this,t);break}case fe.IN_BODY:case fe.IN_TABLE:case fe.IN_CAPTION:case fe.IN_COLUMN_GROUP:case fe.IN_TABLE_BODY:case fe.IN_ROW:case fe.IN_CELL:case fe.IN_SELECT:case fe.IN_SELECT_IN_TABLE:{pge(this,t);break}case fe.TEXT:{Uat(this,t);break}case fe.IN_TABLE_TEXT:{ux(this,t);break}case fe.IN_TEMPLATE:{vge(this,t);break}case fe.AFTER_BODY:case fe.IN_FRAMESET:case fe.AFTER_FRAMESET:case fe.AFTER_AFTER_BODY:case fe.AFTER_AFTER_FRAMESET:{_B(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===te.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 fe.IN_HEAD:case fe.IN_HEAD_NO_SCRIPT:case fe.AFTER_HEAD:case fe.TEXT:case fe.IN_COLUMN_GROUP:case fe.IN_SELECT:case fe.IN_SELECT_IN_TABLE:case fe.IN_FRAMESET:case fe.AFTER_FRAMESET:{this._insertCharacters(t);break}case fe.IN_BODY:case fe.IN_CAPTION:case fe.IN_CELL:case fe.IN_TEMPLATE:case fe.AFTER_BODY:case fe.AFTER_AFTER_BODY:case fe.AFTER_AFTER_FRAMESET:{cge(this,t);break}case fe.IN_TABLE:case fe.IN_TABLE_BODY:case fe.IN_ROW:{gD(this,t);break}case fe.IN_TABLE_TEXT:{mge(this,t);break}}}};function $st(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):hge(e,t),n}function Bst(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){const i=e.openElements.items[r];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[r])&&(n=i)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function Qst(e,t,n){let r=t,i=e.openElements.getCommonAncestor(t);for(let s=0,a=i;a!==n;s++,a=i){i=e.openElements.getCommonAncestor(a);const l=e.activeFormattingElements.getElementEntry(a),c=l&&s>=Mst;!l||c?(c&&e.activeFormattingElements.removeEntry(l),e.openElements.remove(a)):(a=Ust(e,l),r===t&&(e.activeFormattingElements.bookmark=l),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(a,r),r=a)}return r}function Ust(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 Fst(e,t,n){const r=e.treeAdapter.getTagName(t),i=uO(r);if(e._isElementCausesFosterParenting(i))e._fosterParentElement(n);else{const s=e.treeAdapter.getNamespaceURI(t);i===R.TEMPLATE&&s===ht.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function zst(e,t,n){const r=e.treeAdapter.getNamespaceURI(n.element),{token:i}=n,s=e.treeAdapter.createElement(i.tagName,r,i.attrs);e._adoptNodes(t,s),e.treeAdapter.appendChild(t,s),e.activeFormattingElements.insertElementAfterBookmark(s,i),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,s,i.tagID)}function kB(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],i=e.treeAdapter.getNodeSourceCodeLocation(r);if(i&&!i.endTag&&(e._setEndLocation(r,t),e.openElements.stackTop>=1)){const s=e.openElements.items[1],a=e.treeAdapter.getNodeSourceCodeLocation(s);a&&!a.endTag&&e._setEndLocation(s,t)}}}}function qst(e,t){e._setDocumentType(t);const n=t.forceQuirks?xc.QUIRKS:wst(t);vst(t)||e._err(t,Ke.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=fe.BEFORE_HTML}function cx(e,t){e._err(t,Ke.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,xc.QUIRKS),e.insertionMode=fe.BEFORE_HTML,e._processToken(t)}function Xst(e,t){t.tagID===R.HTML?(e._insertElement(t,ht.HTML),e.insertionMode=fe.BEFORE_HEAD):Dv(e,t)}function Gst(e,t){const n=t.tagID;(n===R.HTML||n===R.HEAD||n===R.BODY||n===R.BR)&&Dv(e,t)}function Dv(e,t){e._insertFakeRootElement(),e.insertionMode=fe.BEFORE_HEAD,e._processToken(t)}function Wst(e,t){switch(t.tagID){case R.HTML:{ro(e,t);break}case R.HEAD:{e._insertElement(t,ht.HTML),e.headElement=e.openElements.current,e.insertionMode=fe.IN_HEAD;break}default:Pv(e,t)}}function Yst(e,t){const n=t.tagID;n===R.HEAD||n===R.BODY||n===R.HTML||n===R.BR?Pv(e,t):e._err(t,Ke.endTagWithoutMatchingOpenElement)}function Pv(e,t){e._insertFakeElement(je.HEAD,R.HEAD),e.headElement=e.openElements.current,e.insertionMode=fe.IN_HEAD,e._processToken(t)}function Cu(e,t){switch(t.tagID){case R.HTML:{ro(e,t);break}case R.BASE:case R.BASEFONT:case R.BGSOUND:case R.LINK:case R.META:{e._appendElement(t,ht.HTML),t.ackSelfClosing=!0;break}case R.TITLE:{e._switchToTextParsing(t,_s.RCDATA);break}case R.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,_s.RAWTEXT):(e._insertElement(t,ht.HTML),e.insertionMode=fe.IN_HEAD_NO_SCRIPT);break}case R.NOFRAMES:case R.STYLE:{e._switchToTextParsing(t,_s.RAWTEXT);break}case R.SCRIPT:{e._switchToTextParsing(t,_s.SCRIPT_DATA);break}case R.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=fe.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(fe.IN_TEMPLATE);break}case R.HEAD:{e._err(t,Ke.misplacedStartTagForHeadElement);break}default:Mv(e,t)}}function Zst(e,t){switch(t.tagID){case R.HEAD:{e.openElements.pop(),e.insertionMode=fe.AFTER_HEAD;break}case R.BODY:case R.BR:case R.HTML:{Mv(e,t);break}case R.TEMPLATE:{w0(e,t);break}default:e._err(t,Ke.endTagWithoutMatchingOpenElement)}}function w0(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==R.TEMPLATE&&e._err(t,Ke.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(R.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,Ke.endTagWithoutMatchingOpenElement)}function Mv(e,t){e.openElements.pop(),e.insertionMode=fe.AFTER_HEAD,e._processToken(t)}function Kst(e,t){switch(t.tagID){case R.HTML:{ro(e,t);break}case R.BASEFONT:case R.BGSOUND:case R.HEAD:case R.LINK:case R.META:case R.NOFRAMES:case R.STYLE:{Cu(e,t);break}case R.NOSCRIPT:{e._err(t,Ke.nestedNoscriptInHead);break}default:Lv(e,t)}}function Jst(e,t){switch(t.tagID){case R.NOSCRIPT:{e.openElements.pop(),e.insertionMode=fe.IN_HEAD;break}case R.BR:{Lv(e,t);break}default:e._err(t,Ke.endTagWithoutMatchingOpenElement)}}function Lv(e,t){const n=t.type===or.EOF?Ke.openElementsLeftAfterEof:Ke.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=fe.IN_HEAD,e._processToken(t)}function eat(e,t){switch(t.tagID){case R.HTML:{ro(e,t);break}case R.BODY:{e._insertElement(t,ht.HTML),e.framesetOk=!1,e.insertionMode=fe.IN_BODY;break}case R.FRAMESET:{e._insertElement(t,ht.HTML),e.insertionMode=fe.IN_FRAMESET;break}case R.BASE:case R.BASEFONT:case R.BGSOUND:case R.LINK:case R.META:case R.NOFRAMES:case R.SCRIPT:case R.STYLE:case R.TEMPLATE:case R.TITLE:{e._err(t,Ke.abandonedHeadElementChild),e.openElements.push(e.headElement,R.HEAD),Cu(e,t),e.openElements.remove(e.headElement);break}case R.HEAD:{e._err(t,Ke.misplacedStartTagForHeadElement);break}default:$v(e,t)}}function tat(e,t){switch(t.tagID){case R.BODY:case R.HTML:case R.BR:{$v(e,t);break}case R.TEMPLATE:{w0(e,t);break}default:e._err(t,Ke.endTagWithoutMatchingOpenElement)}}function $v(e,t){e._insertFakeElement(je.BODY,R.BODY),e.insertionMode=fe.IN_BODY,jj(e,t)}function jj(e,t){switch(t.type){case or.CHARACTER:{uge(e,t);break}case or.WHITESPACE_CHARACTER:{cge(e,t);break}case or.COMMENT:{uL(e,t);break}case or.START_TAG:{ro(e,t);break}case or.END_TAG:{Rj(e,t);break}case or.EOF:{pge(e,t);break}}}function cge(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function uge(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function nat(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function rat(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function iat(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,ht.HTML),e.insertionMode=fe.IN_FRAMESET)}function sat(e,t){e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._insertElement(t,ht.HTML)}function aat(e,t){e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&cL.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,ht.HTML)}function oat(e,t){e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._insertElement(t,ht.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function lat(e,t){const n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._insertElement(t,ht.HTML),n||(e.formElement=e.openElements.current))}function cat(e,t){e.framesetOk=!1;const n=t.tagID;for(let r=e.openElements.stackTop;r>=0;r--){const i=e.openElements.tagIDs[r];if(n===R.LI&&i===R.LI||(n===R.DD||n===R.DT)&&(i===R.DD||i===R.DT)){e.openElements.generateImpliedEndTagsWithExclusion(i),e.openElements.popUntilTagNamePopped(i);break}if(i!==R.ADDRESS&&i!==R.DIV&&i!==R.P&&e._isSpecialElement(e.openElements.items[r],i))break}e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._insertElement(t,ht.HTML)}function uat(e,t){e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._insertElement(t,ht.HTML),e.tokenizer.state=_s.PLAINTEXT}function dat(e,t){e.openElements.hasInScope(R.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(R.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,ht.HTML),e.framesetOk=!1}function fat(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(je.A);n&&(kB(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,ht.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function hat(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ht.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function pat(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(R.NOBR)&&(kB(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,ht.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function mat(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ht.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function gat(e,t){e.treeAdapter.getDocumentMode(e.document)!==xc.QUIRKS&&e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._insertElement(t,ht.HTML),e.framesetOk=!1,e.insertionMode=fe.IN_TABLE}function dge(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,ht.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function fge(e){const t=ege(e,Eg.TYPE);return t!=null&&t.toLowerCase()===Dst}function bat(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,ht.HTML),fge(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function yat(e,t){e._appendElement(t,ht.HTML),t.ackSelfClosing=!0}function Oat(e,t){e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._appendElement(t,ht.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function xat(e,t){t.tagName=je.IMG,t.tagID=R.IMG,dge(e,t)}function vat(e,t){e._insertElement(t,ht.HTML),e.skipNextNewLine=!0,e.tokenizer.state=_s.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=fe.TEXT}function wat(e,t){e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,_s.RAWTEXT)}function Sat(e,t){e.framesetOk=!1,e._switchToTextParsing(t,_s.RAWTEXT)}function CW(e,t){e._switchToTextParsing(t,_s.RAWTEXT)}function Eat(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ht.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===fe.IN_TABLE||e.insertionMode===fe.IN_CAPTION||e.insertionMode===fe.IN_TABLE_BODY||e.insertionMode===fe.IN_ROW||e.insertionMode===fe.IN_CELL?fe.IN_SELECT_IN_TABLE:fe.IN_SELECT}function kat(e,t){e.openElements.currentTagId===R.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,ht.HTML)}function _at(e,t){e.openElements.hasInScope(R.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,ht.HTML)}function Tat(e,t){e.openElements.hasInScope(R.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(R.RTC),e._insertElement(t,ht.HTML)}function Cat(e,t){e._reconstructActiveFormattingElements(),age(t),EB(t),t.selfClosing?e._appendElement(t,ht.MATHML):e._insertElement(t,ht.MATHML),t.ackSelfClosing=!0}function Aat(e,t){e._reconstructActiveFormattingElements(),oge(t),EB(t),t.selfClosing?e._appendElement(t,ht.SVG):e._insertElement(t,ht.SVG),t.ackSelfClosing=!0}function AW(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,ht.HTML)}function ro(e,t){switch(t.tagID){case R.I:case R.S:case R.B:case R.U:case R.EM:case R.TT:case R.BIG:case R.CODE:case R.FONT:case R.SMALL:case R.STRIKE:case R.STRONG:{hat(e,t);break}case R.A:{fat(e,t);break}case R.H1:case R.H2:case R.H3:case R.H4:case R.H5:case R.H6:{aat(e,t);break}case R.P:case R.DL:case R.OL:case R.UL:case R.DIV:case R.DIR:case R.NAV:case R.MAIN:case R.MENU:case R.ASIDE:case R.CENTER:case R.FIGURE:case R.FOOTER:case R.HEADER:case R.HGROUP:case R.DIALOG:case R.DETAILS:case R.ADDRESS:case R.ARTICLE:case R.SEARCH:case R.SECTION:case R.SUMMARY:case R.FIELDSET:case R.BLOCKQUOTE:case R.FIGCAPTION:{sat(e,t);break}case R.LI:case R.DD:case R.DT:{cat(e,t);break}case R.BR:case R.IMG:case R.WBR:case R.AREA:case R.EMBED:case R.KEYGEN:{dge(e,t);break}case R.HR:{Oat(e,t);break}case R.RB:case R.RTC:{_at(e,t);break}case R.RT:case R.RP:{Tat(e,t);break}case R.PRE:case R.LISTING:{oat(e,t);break}case R.XMP:{wat(e,t);break}case R.SVG:{Aat(e,t);break}case R.HTML:{nat(e,t);break}case R.BASE:case R.LINK:case R.META:case R.STYLE:case R.TITLE:case R.SCRIPT:case R.BGSOUND:case R.BASEFONT:case R.TEMPLATE:{Cu(e,t);break}case R.BODY:{rat(e,t);break}case R.FORM:{lat(e,t);break}case R.NOBR:{pat(e,t);break}case R.MATH:{Cat(e,t);break}case R.TABLE:{gat(e,t);break}case R.INPUT:{bat(e,t);break}case R.PARAM:case R.TRACK:case R.SOURCE:{yat(e,t);break}case R.IMAGE:{xat(e,t);break}case R.BUTTON:{dat(e,t);break}case R.APPLET:case R.OBJECT:case R.MARQUEE:{mat(e,t);break}case R.IFRAME:{Sat(e,t);break}case R.SELECT:{Eat(e,t);break}case R.OPTION:case R.OPTGROUP:{kat(e,t);break}case R.NOEMBED:case R.NOFRAMES:{CW(e,t);break}case R.FRAMESET:{iat(e,t);break}case R.TEXTAREA:{vat(e,t);break}case R.NOSCRIPT:{e.options.scriptingEnabled?CW(e,t):AW(e,t);break}case R.PLAINTEXT:{uat(e,t);break}case R.COL:case R.TH:case R.TD:case R.TR:case R.HEAD:case R.FRAME:case R.TBODY:case R.TFOOT:case R.THEAD:case R.CAPTION:case R.COLGROUP:break;default:AW(e,t)}}function Nat(e,t){if(e.openElements.hasInScope(R.BODY)&&(e.insertionMode=fe.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function jat(e,t){e.openElements.hasInScope(R.BODY)&&(e.insertionMode=fe.AFTER_BODY,wge(e,t))}function Rat(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function Iat(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(R.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(R.FORM):n&&e.openElements.remove(n))}function Dat(e){e.openElements.hasInButtonScope(R.P)||e._insertFakeElement(je.P,R.P),e._closePElement()}function Pat(e){e.openElements.hasInListItemScope(R.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(R.LI),e.openElements.popUntilTagNamePopped(R.LI))}function Mat(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function Lat(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function $at(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function Bat(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(je.BR,R.BR),e.openElements.pop(),e.framesetOk=!1}function hge(e,t){const n=t.tagName,r=t.tagID;for(let i=e.openElements.stackTop;i>0;i--){const s=e.openElements.items[i],a=e.openElements.tagIDs[i];if(r===a&&(r!==R.UNKNOWN||e.treeAdapter.getTagName(s)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=i&&e.openElements.shortenToLength(i);break}if(e._isSpecialElement(s,a))break}}function Rj(e,t){switch(t.tagID){case R.A:case R.B:case R.I:case R.S:case R.U:case R.EM:case R.TT:case R.BIG:case R.CODE:case R.FONT:case R.NOBR:case R.SMALL:case R.STRIKE:case R.STRONG:{kB(e,t);break}case R.P:{Dat(e);break}case R.DL:case R.UL:case R.OL:case R.DIR:case R.DIV:case R.NAV:case R.PRE:case R.MAIN:case R.MENU:case R.ASIDE:case R.BUTTON:case R.CENTER:case R.FIGURE:case R.FOOTER:case R.HEADER:case R.HGROUP:case R.DIALOG:case R.ADDRESS:case R.ARTICLE:case R.DETAILS:case R.SEARCH:case R.SECTION:case R.SUMMARY:case R.LISTING:case R.FIELDSET:case R.BLOCKQUOTE:case R.FIGCAPTION:{Rat(e,t);break}case R.LI:{Pat(e);break}case R.DD:case R.DT:{Mat(e,t);break}case R.H1:case R.H2:case R.H3:case R.H4:case R.H5:case R.H6:{Lat(e);break}case R.BR:{Bat(e);break}case R.BODY:{Nat(e,t);break}case R.HTML:{jat(e,t);break}case R.FORM:{Iat(e);break}case R.APPLET:case R.OBJECT:case R.MARQUEE:{$at(e,t);break}case R.TEMPLATE:{w0(e,t);break}default:hge(e,t)}}function pge(e,t){e.tmplInsertionModeStack.length>0?vge(e,t):_B(e,t)}function Qat(e,t){var n;t.tagID===R.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function Uat(e,t){e._err(t,Ke.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function gD(e,t){if(e.openElements.currentTagId!==void 0&&lge.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=fe.IN_TABLE_TEXT,t.type){case or.CHARACTER:{gge(e,t);break}case or.WHITESPACE_CHARACTER:{mge(e,t);break}}else EE(e,t)}function Fat(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,ht.HTML),e.insertionMode=fe.IN_CAPTION}function zat(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,ht.HTML),e.insertionMode=fe.IN_COLUMN_GROUP}function Vat(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(je.COLGROUP,R.COLGROUP),e.insertionMode=fe.IN_COLUMN_GROUP,TB(e,t)}function Hat(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,ht.HTML),e.insertionMode=fe.IN_TABLE_BODY}function qat(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(je.TBODY,R.TBODY),e.insertionMode=fe.IN_TABLE_BODY,Ij(e,t)}function Xat(e,t){e.openElements.hasInTableScope(R.TABLE)&&(e.openElements.popUntilTagNamePopped(R.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function Gat(e,t){fge(t)?e._appendElement(t,ht.HTML):EE(e,t),t.ackSelfClosing=!0}function Wat(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,ht.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function m1(e,t){switch(t.tagID){case R.TD:case R.TH:case R.TR:{qat(e,t);break}case R.STYLE:case R.SCRIPT:case R.TEMPLATE:{Cu(e,t);break}case R.COL:{Vat(e,t);break}case R.FORM:{Wat(e,t);break}case R.TABLE:{Xat(e,t);break}case R.TBODY:case R.TFOOT:case R.THEAD:{Hat(e,t);break}case R.INPUT:{Gat(e,t);break}case R.CAPTION:{Fat(e,t);break}case R.COLGROUP:{zat(e,t);break}default:EE(e,t)}}function Xw(e,t){switch(t.tagID){case R.TABLE:{e.openElements.hasInTableScope(R.TABLE)&&(e.openElements.popUntilTagNamePopped(R.TABLE),e._resetInsertionMode());break}case R.TEMPLATE:{w0(e,t);break}case R.BODY:case R.CAPTION:case R.COL:case R.COLGROUP:case R.HTML:case R.TBODY:case R.TD:case R.TFOOT:case R.TH:case R.THEAD:case R.TR:break;default:EE(e,t)}}function EE(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,jj(e,t),e.fosterParentingEnabled=n}function mge(e,t){e.pendingCharacterTokens.push(t)}function gge(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function ux(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n0&&e.openElements.currentTagId===R.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===R.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===R.OPTGROUP&&e.openElements.pop();break}case R.OPTION:{e.openElements.currentTagId===R.OPTION&&e.openElements.pop();break}case R.SELECT:{e.openElements.hasInSelectScope(R.SELECT)&&(e.openElements.popUntilTagNamePopped(R.SELECT),e._resetInsertionMode());break}case R.TEMPLATE:{w0(e,t);break}}}function tot(e,t){const n=t.tagID;n===R.CAPTION||n===R.TABLE||n===R.TBODY||n===R.TFOOT||n===R.THEAD||n===R.TR||n===R.TD||n===R.TH?(e.openElements.popUntilTagNamePopped(R.SELECT),e._resetInsertionMode(),e._processStartTag(t)):Oge(e,t)}function not(e,t){const n=t.tagID;n===R.CAPTION||n===R.TABLE||n===R.TBODY||n===R.TFOOT||n===R.THEAD||n===R.TR||n===R.TD||n===R.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(R.SELECT),e._resetInsertionMode(),e.onEndTag(t)):xge(e,t)}function rot(e,t){switch(t.tagID){case R.BASE:case R.BASEFONT:case R.BGSOUND:case R.LINK:case R.META:case R.NOFRAMES:case R.SCRIPT:case R.STYLE:case R.TEMPLATE:case R.TITLE:{Cu(e,t);break}case R.CAPTION:case R.COLGROUP:case R.TBODY:case R.TFOOT:case R.THEAD:{e.tmplInsertionModeStack[0]=fe.IN_TABLE,e.insertionMode=fe.IN_TABLE,m1(e,t);break}case R.COL:{e.tmplInsertionModeStack[0]=fe.IN_COLUMN_GROUP,e.insertionMode=fe.IN_COLUMN_GROUP,TB(e,t);break}case R.TR:{e.tmplInsertionModeStack[0]=fe.IN_TABLE_BODY,e.insertionMode=fe.IN_TABLE_BODY,Ij(e,t);break}case R.TD:case R.TH:{e.tmplInsertionModeStack[0]=fe.IN_ROW,e.insertionMode=fe.IN_ROW,Dj(e,t);break}default:e.tmplInsertionModeStack[0]=fe.IN_BODY,e.insertionMode=fe.IN_BODY,ro(e,t)}}function iot(e,t){t.tagID===R.TEMPLATE&&w0(e,t)}function vge(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(R.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):_B(e,t)}function sot(e,t){t.tagID===R.HTML?ro(e,t):tA(e,t)}function wge(e,t){var n;if(t.tagID===R.HTML){if(e.fragmentContext||(e.insertionMode=fe.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===R.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 tA(e,t)}function tA(e,t){e.insertionMode=fe.IN_BODY,jj(e,t)}function aot(e,t){switch(t.tagID){case R.HTML:{ro(e,t);break}case R.FRAMESET:{e._insertElement(t,ht.HTML);break}case R.FRAME:{e._appendElement(t,ht.HTML),t.ackSelfClosing=!0;break}case R.NOFRAMES:{Cu(e,t);break}}}function oot(e,t){t.tagID===R.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==R.FRAMESET&&(e.insertionMode=fe.AFTER_FRAMESET))}function lot(e,t){switch(t.tagID){case R.HTML:{ro(e,t);break}case R.NOFRAMES:{Cu(e,t);break}}}function cot(e,t){t.tagID===R.HTML&&(e.insertionMode=fe.AFTER_AFTER_FRAMESET)}function uot(e,t){t.tagID===R.HTML?ro(e,t):oT(e,t)}function oT(e,t){e.insertionMode=fe.IN_BODY,jj(e,t)}function dot(e,t){switch(t.tagID){case R.HTML:{ro(e,t);break}case R.NOFRAMES:{Cu(e,t);break}}}function fot(e,t){t.chars=qi,e._insertCharacters(t)}function hot(e,t){e._insertCharacters(t),e.framesetOk=!1}function Sge(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==ht.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function pot(e,t){if(Ast(t))Sge(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===ht.MATHML?age(t):r===ht.SVG&&(Nst(t),oge(t)),EB(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function mot(e,t){if(t.tagID===R.P||t.tagID===R.BR){Sge(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)===ht.HTML){e._endTagOutsideForeignContent(t);break}const i=e.treeAdapter.getTagName(r);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}je.AREA,je.BASE,je.BASEFONT,je.BGSOUND,je.BR,je.COL,je.EMBED,je.FRAME,je.HR,je.IMG,je.INPUT,je.KEYGEN,je.LINK,je.META,je.PARAM,je.SOURCE,je.TRACK,je.WBR;const got=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,bot=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),NW={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function Ege(e,t){const n=Tot(e),r=Qpe("type",{handlers:{root:yot,element:Oot,text:xot,comment:_ge,doctype:vot,raw:Sot},unknown:Eot}),i={parser:n?new TW(NW):TW.getFragmentParser(void 0,NW),handle(l){r(l,i)},stitches:!1,options:t||{}};r(e,i),dO(i,Td());const s=n?i.parser.document:i.parser.getFragment(),a=Cit(s,{file:i.options.file});return i.stitches&&wE(a,"comment",function(l,c,u){const d=l;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 kge(e,t){let n=-1;if(e)for(;++n4&&(t.parser.tokenizer.state=0);const n={type:or.CHARACTER,chars:e.value,location:kE(e)};dO(t,Td(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function vot(e,t){const n={type:or.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:kE(e)};dO(t,Td(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function wot(e,t){t.stitches=!0;const n=Cot(e);if("children"in e&&"children"in n){const r=Ege({type:"root",children:e.children},t.options);n.children=r.children}_ge({type:"comment",value:{stitch:n}},t)}function _ge(e,t){const n=e.value,r={type:or.COMMENT,data:n,location:kE(e)};dO(t,Td(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function Sot(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,Tge(t,Td(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(got,"<$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 Eot(e,t){const n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))wot(n,t);else{let r="";throw bot.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 dO(e,t){Tge(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=_s.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 Tge(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 kot(e,t){const n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===_s.PLAINTEXT)return;dO(t,Td(e));const r=t.parser.openElements.current;let i="namespaceURI"in r?r.namespaceURI:ag.html;i===ag.html&&n==="svg"&&(i=ag.svg);const s=Iit({...e,children:[]},{space:i===ag.svg?"svg":"html"}),a={type:or.START_TAG,tagName:n,tagID:uO(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in s?s.attrs:[],location:kE(e)};t.parser.currentToken=a,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function _ot(e,t){const n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&Uit.includes(n)||t.parser.tokenizer.state===_s.PLAINTEXT)return;dO(t,kj(e));const r={type:or.END_TAG,tagName:n,tagID:uO(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:kE(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===_s.RCDATA||t.parser.tokenizer.state===_s.RAWTEXT||t.parser.tokenizer.state===_s.SCRIPT_DATA)&&(t.parser.tokenizer.state=_s.DATA)}function Tot(e){const t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function kE(e){const t=Td(e)||{line:void 0,column:void 0,offset:void 0},n=kj(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 Cot(e){return"children"in e?h1({...e,children:[]}):h1(e)}function Aot(e){return function(t,n){return Ege(t,{...e,file:n})}}const Not="modulepreload",jot=function(e){return"/"+e},jW={},dd=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=Promise.allSettled(n.map(c=>{if(c=jot(c),c in jW)return;jW[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":Not,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((h,m)=>{f.addEventListener("load",h),f.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return i.then(a=>{for(const l of a||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})};var Rot=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,Iot=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,Dot=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,bD={Space_Separator:Rot,ID_Start:Iot,ID_Continue:Dot},ws={isSpaceSeparator(e){return typeof e=="string"&&bD.Space_Separator.test(e)},isIdStartChar(e){return typeof e=="string"&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="$"||e==="_"||bD.ID_Start.test(e))},isIdContinueChar(e){return typeof e=="string"&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||e==="$"||e==="_"||e==="‌"||e==="‍"||bD.ID_Continue.test(e))},isDigit(e){return typeof e=="string"&&/[0-9]/.test(e)},isHexDigit(e){return typeof e=="string"&&/[0-9A-Fa-f]/.test(e)}};let fL,go,Of,nA,Wp,gu,aa,CB,Bv;var Pot=function(t,n){fL=String(t),go="start",Of=[],nA=0,Wp=1,gu=0,aa=void 0,CB=void 0,Bv=void 0;do aa=Mot(),Bot[go]();while(aa.type!=="eof");return typeof n=="function"?hL({"":Bv},"",n):Bv};function hL(e,t,n){const r=e[t];if(r!=null&&typeof r=="object")if(Array.isArray(r))for(let i=0;i0;){const n=Bf();if(!ws.isHexDigit(n))throw Pi(ut());e+=ut()}return String.fromCodePoint(parseInt(e,16))}const Bot={start(){if(aa.type==="eof")throw Am();yD()},beforePropertyName(){switch(aa.type){case"identifier":case"string":CB=aa.value,go="afterPropertyName";return;case"punctuator":k2();return;case"eof":throw Am()}},afterPropertyName(){if(aa.type==="eof")throw Am();go="beforePropertyValue"},beforePropertyValue(){if(aa.type==="eof")throw Am();yD()},beforeArrayValue(){if(aa.type==="eof")throw Am();if(aa.type==="punctuator"&&aa.value==="]"){k2();return}yD()},afterPropertyValue(){if(aa.type==="eof")throw Am();switch(aa.value){case",":go="beforePropertyName";return;case"}":k2()}},afterArrayValue(){if(aa.type==="eof")throw Am();switch(aa.value){case",":go="beforeArrayValue";return;case"]":k2()}},end(){}};function yD(){let e;switch(aa.type){case"punctuator":switch(aa.value){case"{":e={};break;case"[":e=[];break}break;case"null":case"boolean":case"numeric":case"string":e=aa.value;break}if(Bv===void 0)Bv=e;else{const t=Of[Of.length-1];Array.isArray(t)?t.push(e):Object.defineProperty(t,CB,{value:e,writable:!0,enumerable:!0,configurable:!0})}if(e!==null&&typeof e=="object")Of.push(e),Array.isArray(e)?go="beforeArrayValue":go="beforePropertyName";else{const t=Of[Of.length-1];t==null?go="end":Array.isArray(t)?go="afterArrayValue":go="afterPropertyValue"}}function k2(){Of.pop();const e=Of[Of.length-1];e==null?go="end":Array.isArray(e)?go="afterArrayValue":go="afterPropertyValue"}function Pi(e){return rA(e===void 0?`JSON5: invalid end of input at ${Wp}:${gu}`:`JSON5: invalid character '${Age(e)}' at ${Wp}:${gu}`)}function Am(){return rA(`JSON5: invalid end of input at ${Wp}:${gu}`)}function RW(){return gu-=5,rA(`JSON5: invalid identifier character at ${Wp}:${gu}`)}function Qot(e){console.warn(`JSON5: '${Age(e)}' in strings is not valid ECMAScript; consider escaping`)}function Age(e){const t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){const n=e.charCodeAt(0).toString(16);return"\\x"+("00"+n).substring(n.length)}return e}function rA(e){const t=new SyntaxError(e);return t.lineNumber=Wp,t.columnNumber=gu,t}var Uot=function(t,n,r){const i=[];let s="",a,l,c="",u;if(n!=null&&typeof n=="object"&&!Array.isArray(n)&&(r=n.space,u=n.quote,n=n.replacer),typeof n=="function")l=n;else if(Array.isArray(n)){a=[];for(const b of n){let y;typeof b=="string"?y=b:(typeof b=="number"||b instanceof String||b instanceof Number)&&(y=String(b)),y!==void 0&&a.indexOf(y)<0&&a.push(y)}}return r instanceof Number?r=Number(r):r instanceof String&&(r=String(r)),typeof r=="number"?r>0&&(r=Math.min(10,Math.floor(r)),c=" ".substr(0,r)):typeof r=="string"&&(c=r.substr(0,10)),d("",{"":t});function d(b,y){let O=y[b];switch(O!=null&&(typeof O.toJSON5=="function"?O=O.toJSON5(b):typeof O.toJSON=="function"&&(O=O.toJSON(b))),l&&(O=l.call(y,b,O)),O instanceof Number?O=Number(O):O instanceof String?O=String(O):O instanceof Boolean&&(O=O.valueOf()),O){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof O=="string")return f(O);if(typeof O=="number")return String(O);if(typeof O=="object")return Array.isArray(O)?g(O):h(O)}function f(b){const y={"'":.1,'"':.2},O={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};let v="";for(let w=0;wy[w]=0)throw TypeError("Converting circular structure to JSON5");i.push(b);let y=s;s=s+c;let O=a||Object.keys(b),v=[];for(const w of O){const S=d(w,b);if(S!==void 0){let E=m(w)+":";c!==""&&(E+=" "),E+=S,v.push(E)}}let x;if(v.length===0)x="{}";else{let w;if(c==="")w=v.join(","),x="{"+w+"}";else{let S=`, +`))}function c(m,g,b,y){const O=b.enter("tableCell"),v=b.enter("phrasing"),x=b.containerPhrasing(m,{...y,before:s,after:s});return v(),O(),x}function u(m,g){return Oet(m,{align:g,alignDelimiters:r,padding:n,stringLength:i})}function d(m,g,b){const y=m.children;let O=-1;const v=[],x=g.enter("table");for(;++O0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const Ett={tokenize:Rtt,partial:!0};function ktt(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Att,continuation:{tokenize:Ntt},exit:jtt}},text:{91:{name:"gfmFootnoteCall",tokenize:Ctt},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:_tt,resolveTo:Ttt}}}}function _tt(e,t,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;i--;){const c=r.events[i][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 l;function l(c){if(!a||!a._balanced)return n(c);const u=bu(r.sliceSerialize({start:a.end,end:r.now()}));return u.codePointAt(0)!==94||!s.includes(u.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function Ttt(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)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},l=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",a,t],["exit",a,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...l),e}function Ctt(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,a;return l;function l(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(s>999||f===93&&!a||f===null||f===91||Ei(f))return n(f);if(f===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return i.includes(bu(r.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return Ei(f)||(a=!0),s++,e.consume(f),f===92?d:u}function d(f){return f===91||f===92||f===93?(e.consume(f),s++,u):u(f)}}function Att(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,a=0,l;return c;function c(g){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(g){return g===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(g)}function d(g){if(a>999||g===93&&!l||g===null||g===91||Ei(g))return n(g);if(g===93){e.exit("chunkString");const b=e.exit("gfmFootnoteDefinitionLabelString");return s=bu(r.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return Ei(g)||(l=!0),a++,e.consume(g),g===92?f:d}function f(g){return g===91||g===92||g===93?(e.consume(g),a++,d):d(g)}function h(g){return g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),i.includes(s)||i.push(s),Dr(e,m,"gfmFootnoteDefinitionWhitespace")):n(g)}function m(g){return t(g)}}function Ntt(e,t,n){return e.check(wE,t,e.attempt(Ett,t,n))}function jtt(e){e.exit("gfmFootnoteDefinition")}function Rtt(e,t,n){const r=this;return Dr(e,i,"gfmFootnoteDefinitionIndent",5);function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(s):n(s)}}function Itt(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(a,l){let c=-1;for(;++c1?c(g):(a.consume(g),f++,m);if(f<2&&!n)return c(g);const y=a.exit("strikethroughSequenceTemporary"),O=f1(g);return y._open=!O||O===2&&!!b,y._close=!b||b===2&&!!O,l(g)}}}class Dtt{constructor(){this.map=[]}add(t,n,r){Ptt(this,t,n,r)}consume(t){if(this.map.sort(function(s,a){return s[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 i=r.pop();for(;i;){for(const s of i)t.push(s);i=r.pop()}this.map.length=0}}function Ptt(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i-1;){const I=r.events[A][1].type;if(I==="lineEnding"||I==="linePrefix")A--;else break}const j=A>-1?r.events[A][1].type:null,M=j==="tableHead"||j==="tableRow"?E:c;return M===E&&r.parser.lazy[r.now().line]?n(C):M(C)}function c(C){return e.enter("tableHead"),e.enter("tableRow"),u(C)}function u(C){return C===124||(a=!0,s+=1),d(C)}function d(C){return C===null?n(C):On(C)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),m):n(C):br(C)?Dr(e,d,"whitespace")(C):(s+=1,a&&(a=!1,i+=1),C===124?(e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),a=!0,d):(e.enter("data"),f(C)))}function f(C){return C===null||C===124||Ei(C)?(e.exit("data"),d(C)):(e.consume(C),C===92?h:f)}function h(C){return C===92||C===124?(e.consume(C),f):f(C)}function m(C){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(C):(e.enter("tableDelimiterRow"),a=!1,br(C)?Dr(e,g,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):g(C))}function g(C){return C===45||C===58?y(C):C===124?(a=!0,e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),b):S(C)}function b(C){return br(C)?Dr(e,y,"whitespace")(C):y(C)}function y(C){return C===58?(s+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(C),e.exit("tableDelimiterMarker"),O):C===45?(s+=1,O(C)):C===null||On(C)?w(C):S(C)}function O(C){return C===45?(e.enter("tableDelimiterFiller"),v(C)):S(C)}function v(C){return C===45?(e.consume(C),v):C===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(C),e.exit("tableDelimiterMarker"),x):(e.exit("tableDelimiterFiller"),x(C))}function x(C){return br(C)?Dr(e,w,"whitespace")(C):w(C)}function w(C){return C===124?g(C):C===null||On(C)?!a||i!==s?S(C):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(C)):S(C)}function S(C){return n(C)}function E(C){return e.enter("tableRow"),k(C)}function k(C){return C===124?(e.enter("tableCellDivider"),e.consume(C),e.exit("tableCellDivider"),k):C===null||On(C)?(e.exit("tableRow"),t(C)):br(C)?Dr(e,k,"whitespace")(C):(e.enter("data"),_(C))}function _(C){return C===null||C===124||Ei(C)?(e.exit("data"),k(C)):(e.consume(C),C===92?T:_)}function T(C){return C===92||C===124?(e.consume(C),_):_(C)}}function Btt(e,t){let n=-1,r=!0,i=0,s=[0,0,0,0],a=[0,0,0,0],l=!1,c=0,u,d,f;const h=new Dtt;for(;++nn[2]+1){const g=n[2]+1,b=n[3]-n[2]-1;e.add(g,b,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return i!==void 0&&(s.end=Object.assign({},bb(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function GG(e,t,n,r,i){const s=[],a=bb(t.events,n);i&&(i.end=Object.assign({},a),s.push(["exit",i,t])),r.end=Object.assign({},a),s.push(["exit",r,t]),e.add(n+1,0,s)}function bb(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const Qtt={name:"tasklistCheck",tokenize:Ftt};function Utt(){return{text:{91:Qtt}}}function Ftt(e,t,n){const r=this;return i;function i(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),s)}function s(c){return Ei(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"),l):n(c)}function l(c){return On(c)?t(c):br(c)?e.check({tokenize:ztt},t,n)(c):n(c)}}function ztt(e,t,n){return Dr(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function Vtt(e){return ppe([mtt(),ktt(),Itt(e),Ltt(),Utt()])}const Htt={};function qtt(e){const t=this,n=e||Htt,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(Vtt(n)),s.push(dtt()),a.push(ftt(n))}const WG=function(e,t,n){const r=SE(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 ome(e,t,n){return e.type==="element"?ent(e,t,n):e.type==="text"?n.whitespace==="normal"?lme(e,n):tnt(e):[]}function ent(e,t,n){const r=cme(e,n),i=e.children||[];let s=-1,a=[];if(Ktt(e))return a;let l,c;for(aL(e)||JG(e)&&WG(t,e,JG)?c=` +`:Ztt(e)?(l=2,c=2):ame(e)&&(l=1,c=1);++s]+>")+")",l={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(i)+e.IDENT_RE,relevance:0},m=t.optional(i)+e.IDENT_RE+"\\s*\\(",g=["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"],b=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],y=["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"],O=["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"],w={type:b,keyword:g,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:y},S={className:"function.dispatch",relevance:0,keywords:{_hint:O},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},E=[S,f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],k={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:w,contains:E.concat([{begin:/\(/,end:/\)/,keywords:w,contains:E.concat(["self"]),relevance:0}]),relevance:0},_={className:"function",begin:"("+a+"[\\*&\\s]+)+"+m,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:w,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:w,relevance:0},{begin:m,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:w,illegal:"",keywords:w,contains:["self",l]},{begin:e.IDENT_RE+"::",keywords:w},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function lnt(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=ont(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 gB(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 i={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},s=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"})]}},l={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,i]};i.contains.push(l);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"],m=e.SHEBANG({binary:`(${h.join("|")})`,relevance:10}),g={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},b=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],y=["true","false"],O={match:/(\/[a-z._-]+)+/},v=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],x=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],w=["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"],S=["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:b,literal:y,built_in:[...v,...x,"set","shopt",...w,...S]},contains:[m,e.SHEBANG(),g,f,s,a,O,l,c,u,d,n]}}function cnt(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",a="("+r+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",l={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(i)+e.IDENT_RE,relevance:0},m=t.optional(i)+e.IDENT_RE+"\\s*\\(",y={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"},O=[f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],v={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:y,contains:O.concat([{begin:/\(/,end:/\)/,keywords:y,contains:O.concat(["self"]),relevance:0}]),relevance:0},x={begin:"("+a+"[\\*&\\s]+)+"+m,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:y,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:y,relevance:0},{begin:m,returnBegin:!0,contains:[e.inherit(h,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:y,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:y,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C",aliases:["h"],keywords:y,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:f,strings:u,keywords:y}}}function unt(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",a="(?!struct)("+r+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",l={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(i)+e.IDENT_RE,relevance:0},m=t.optional(i)+e.IDENT_RE+"\\s*\\(",g=["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"],b=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],y=["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"],O=["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"],w={type:b,keyword:g,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:y},S={className:"function.dispatch",relevance:0,keywords:{_hint:O},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},E=[S,f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],k={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:w,contains:E.concat([{begin:/\(/,end:/\)/,keywords:w,contains:E.concat(["self"]),relevance:0}]),relevance:0},_={className:"function",begin:"("+a+"[\\*&\\s]+)+"+m,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:w,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:w,relevance:0},{begin:m,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:w,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,d,l]}]},l,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:w,illegal:"",keywords:w,contains:["self",l]},{begin:e.IDENT_RE+"::",keywords:w},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function dnt(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"],i=["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"],s=["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:i.concat(s),built_in:t,literal:r},l=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},m=e.inherit(h,{illegal:/\n/}),g={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,m]},b={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]},y=e.inherit(b,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},m]});h.contains=[b,g,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.C_BLOCK_COMMENT_MODE],m.contains=[y,g,f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const O={variants:[u,b,g,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},v={begin:"<",end:">",contains:[{beginKeywords:"in out"},l]},x=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",w={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"}},O,c,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},l,v,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[l,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[l,v,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:"("+x+"\\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,v],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,relevance:0,contains:[O,c,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},w]}}const fnt=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_-]*/}}),hnt=["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"],pnt=["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"],mnt=[...hnt,...pnt],gnt=["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(),bnt=["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(),ynt=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Ont=["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 xnt(e){const t=e.regex,n=fnt(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",s=/@-?\w[\w]*(-\w+)*/,a="[a-zA-Z-][a-zA-Z0-9_-]*",l=[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:":("+bnt.join("|")+")"},{begin:":(:)?("+ynt.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Ont.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...l,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...l,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:s},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:gnt.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...l,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+mnt.join("|")+")\\b"}]}}function vnt(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 wnt(e){const s={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:s,illegal:"dme(e,t,n-1))}function Ent(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+dme("(?:<"+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,eW,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},eW,u]}}const tW="[A-Za-z$_][0-9A-Za-z$_]*",knt=["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"],_nt=["true","false","null","undefined","NaN","Infinity"],fme=["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"],hme=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],pme=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Tnt=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Cnt=[].concat(pme,fme,hme);function mme(e){const t=e.regex,n=(Q,{after:F})=>{const L="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Q,F)=>{const L=Q[0].length+Q.index,H=Q.input[L];if(H==="<"||H===","){F.ignoreMatch();return}H===">"&&(n(Q,{after:L})||F.ignoreMatch());let z;const B=Q.input.substring(L);if(z=B.match(/^\s*=/)){F.ignoreMatch();return}if((z=B.match(/^\s+extends\s+/))&&z.index===0){F.ignoreMatch();return}}},l={$pattern:tW,keyword:knt,literal:_nt,built_in:Cnt,"variable.language":Tnt},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:l,contains:[]},m={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},g={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},b={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},y={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},v={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]},x=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,m,g,b,y,{match:/\$\d+/},f];h.contains=x.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(x)});const w=[].concat(v,h.contains),S=w.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(w)}]),E={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:S},k={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"}}]},_={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:{_:[...fme,...hme]}},T={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},C={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[E],illegal:/%/},A={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function j(Q){return t.concat("(?!",Q.join("|"),")")}const M={match:t.concat(/\b/,j([...pme,"super","import"].map(Q=>`${Q}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},I={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},$={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},E]},N="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",D={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(N)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[E]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:S,CLASS_REFERENCE:_},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),T,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,m,g,b,y,v,{match:/\$\d+/},f,_,{scope:"attr",match:r+t.lookahead(":"),relevance:0},D,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[v,e.REGEXP_MODE,{className:"function",begin:N,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:S}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:s},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},C,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[E,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},I,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[E]},M,A,k,$,{match:/\$[(.]/}]}}function gme(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],i={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,i,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var Ob="[0-9](_*[0-9])*",w2=`\\.(${Ob})`,S2="[0-9a-fA-F](_*[0-9a-fA-F])*",Ant={className:"number",variants:[{begin:`(\\b(${Ob})((${w2})|\\.)?|(${w2}))[eE][+-]?(${Ob})[fFdD]?\\b`},{begin:`\\b(${Ob})((${w2})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${w2})[fFdD]?\\b`},{begin:`\\b(${Ob})[fFdD]\\b`},{begin:`\\b0[xX]((${S2})\\.?|(${S2})?\\.(${S2}))[pP][+-]?(${Ob})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${S2})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function Nnt(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+"@"},i={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},s={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},a={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[s,i]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,s,i]}]};i.contains.push(a);const l={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=Ant,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,l,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,l,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},l,c]},a,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:` +`},u]}}const jnt=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_-]*/}}),Rnt=["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"],Int=["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"],Dnt=[...Rnt,...Int],Pnt=["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(),bme=["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(),yme=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Mnt=["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(),Lnt=bme.concat(yme).sort().reverse();function $nt(e){const t=jnt(e),n=Lnt,r="and or not only",i="[\\w-]+",s="("+i+"|@\\{"+i+"\\})",a=[],l=[],c=function(x){return{className:"string",begin:"~?"+x+".*?"+x}},u=function(x,w,S){return{className:x,begin:w,relevance:S}},d={$pattern:/[a-z-]+/,keyword:r,attribute:Pnt.join(" ")},f={begin:"\\(",end:"\\)",contains:l,keywords:d,relevance:0};l.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","@@?"+i,10),u("variable","@\\{"+i+"\\}"),u("built_in","~?`[^`]*?`"),{className:"attribute",begin:i+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);const h=l.concat({begin:/\{/,end:/\}/,contains:a}),m={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(l)},g={begin:s+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Mnt.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:l}}]},b={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:l,relevance:0}},y={className:"variable",variants:[{begin:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:h}},O={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:s,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,m,u("keyword","all\\b"),u("variable","@\\{"+i+"\\}"),{begin:"\\b("+Dnt.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,u("selector-tag",s,0),u("selector-id","#"+s),u("selector-class","\\."+s,0),u("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+bme.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+yme.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:h},{begin:"!important"},t.FUNCTION_DISPATCH]},v={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[O]};return a.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,b,y,v,g,O,m,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:a}}function Bnt(e){const t="\\[=*\\[",n="\\]=*\\]",r={begin:t,end:n,contains:["self"]},i=[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:i.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:i}].concat(i)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[r],relevance:5}])}}function Ome(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},i={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}]},s={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}]},l=/[A-Za-z][A-Za-z0-9+.-]*/,c={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,l,/:\/\/.*?\)/),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 m=[n,c];return[u,d,f,h].forEach(O=>{O.contains=O.contains.concat(m)}),m=m.concat(u,d),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:m},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:m}]}]},n,s,u,d,{className:"quote",begin:"^>\\s+",contains:m,end:"$"},i,r,c,a,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function Qnt(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_]*/,l={"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:l,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 Unt(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}/,i={$pattern:/[\w.]+/,keyword:n.join(" ")},s={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:i},a={begin:/->\{/,end:/\}/},l={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:[l]},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,s,c],f=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],h=(b,y,O="\\1")=>{const v=O==="\\1"?O:t.concat(O,y);return t.concat(t.concat("(?:",b,")"),y,/(?:\\.|[^\\\/])*?/,v,/(?:\\.|[^\\\/])*?/,O,r)},m=(b,y,O)=>t.concat(t.concat("(?:",b,")"),y,/(?:\\.|[^\\\/])*?/,O,r),g=[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:m("(?:m|qr)?",/\//,/\//)},{begin:m("m|qr",t.either(...f,{capture:!0}),/\1/)},{begin:m("m|qr",/\(/,/\)/)},{begin:m("m|qr",/\[/,/\]/)},{begin:m("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,l]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,l,u]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return s.contains=g,a.contains=g,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:g}}function Fnt(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),i=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),s=t.concat(/[A-Z]+/,n),a={scope:"variable",match:"\\$+"+r},l={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":(I,$)=>{$.data._beginMatch=I[1]||I[2]},"on:end":(I,$)=>{$.data._beginMatch!==I[1]&&$.ignoreMatch()}},h=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),m=`[ +]`,g={scope:"string",variants:[d,u,f,h]},b={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},y=["false","null","true"],O=["__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"],v=["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"],w={keyword:O,literal:(I=>{const $=[];return I.forEach(N=>{$.push(N),N.toLowerCase()===N?$.push(N.toUpperCase()):$.push(N.toLowerCase())}),$})(y),built_in:v},S=I=>I.map($=>$.replace(/\|\d+$/,"")),E={variants:[{match:[/new/,t.concat(m,"+"),t.concat("(?!",S(v).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},k=t.concat(r,"\\b(?!\\()"),_={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),k],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,t.concat(/::/,t.lookahead(/(?!class\b)/)),k],scope:{1:"title.class",3:"variable.constant"}},{match:[i,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},T={scope:"attr",match:t.concat(r,t.lookahead(":"),t.lookahead(/(?!::)/))},C={relevance:0,begin:/\(/,end:/\)/,keywords:w,contains:[T,a,_,e.C_BLOCK_COMMENT_MODE,g,b,E]},A={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",S(O).join("\\b|"),"|",S(v).join("\\b|"),"\\b)"),r,t.concat(m,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[C]};C.contains.push(A);const j=[T,_,e.C_BLOCK_COMMENT_MODE,g,b,E],M={begin:t.concat(/#\[\s*\\?/,t.either(i,s)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:y,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:y,keyword:["new","array"]},contains:["self",...j]},...j,{scope:"meta",variants:[{match:i},{match:s}]}]};return{case_insensitive:!1,keywords:w,contains:[M,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}]}},l,{scope:"variable.language",match:/\$this\b/},a,A,_,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},E,{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:w,contains:["self",M,a,_,e.C_BLOCK_COMMENT_MODE,g,b]}]},{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]},g,b]}}function znt(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 Vnt(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function vme(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"],l={$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:l,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])*",m=`(\\b(${h}))?\\.(${h})|\\b(${h})\\.`,g=`\\b|${r.join("|")}`,b={className:"number",relevance:0,variants:[{begin:`(\\b(${h})|(${m}))[eE][+-]?(${h})[jJ]?(?=${g})`},{begin:`(${m})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${g})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${g})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${g})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${g})`},{begin:`\\b(${h})[jJ](?=${g})`}]},y={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:l,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},O={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:["self",c,b,f,e.HASH_COMMENT_MODE]}]};return u.contains=[f,b,c],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:l,illegal:/(<\/|\?)|=>/,contains:[c,b,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},f,y,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[O]},{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:[b,O,f]}]}}function Hnt(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function qnt(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]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,s=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:[i,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[s,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:s},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function Xnt(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]+/),i=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"]},l={className:"doctag",begin:"@[A-Za-z]+"},c={begin:"#<",end:">"},u=[e.COMMENT("#","$",{contains:[l]}),e.COMMENT("^=begin","^=end",{contains:[l],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",m="[0-9](_?[0-9])*",g={className:"number",relevance:0,variants:[{begin:`\\b(${h})(\\.(${m}))?([eE][+-]?(${m})|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"}]},b={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:a}]},E=[f,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:a},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:a},{relevance:0,match:[i,/\.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:[b]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[f,{begin:n}],relevance:0},g,{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=E,b.contains=E;const C=[{begin:/^\s*=>/,starts:{end:"$",contains:E}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:a,contains:E}}];return u.unshift(c),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:a,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(C).concat(u).concat(E)}}function Gnt(e){const t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),i=t.concat(n,e.IDENT_RE),s={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,t.lookahead(/\s*\(/))},a="([ui](8|16|32|64|128|size)|f(32|64))?",l=["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:l,literal:c,built_in:u},illegal:""},s]}}const Wnt=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_-]*/}}),Ynt=["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"],Znt=["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"],Knt=[...Ynt,...Znt],Jnt=["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(),ert=["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(),trt=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),nrt=["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 rrt(e){const t=Wnt(e),n=trt,r=ert,i="@[a-z-]+",s="and or not only",l={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("+Knt.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},l,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+nrt.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,l,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:i,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:Jnt.join(" ")},contains:[{begin:i,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},l,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function irt(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function srt(e){const t=e.regex,n=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},s=["true","false","unknown"],a=["double precision","large object","with timezone","without timezone"],l=["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"],m=d,g=[...u,...c].filter(S=>!d.includes(S)),b={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},y={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},O={match:t.concat(/\b/,t.either(...m),/\s*\(/),relevance:0,keywords:{built_in:m}};function v(S){return t.concat(/\b/,t.either(...S.map(E=>E.replace(/\s+/,"\\s+"))),/\b/)}const x={scope:"keyword",match:v(h),relevance:0};function w(S,{exceptions:E,when:k}={}){const _=k;return E=E||[],S.map(T=>T.match(/\|\d+$/)||E.includes(T)?T:_(T)?`${T}|0`:T)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:w(g,{when:S=>S.length<3}),literal:s,type:l,built_in:f},contains:[{scope:"type",match:v(a)},x,O,b,r,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,y]}}function wme(e){return e?typeof e=="string"?e:e.source:null}function lx(e){return fi("(?=",e,")")}function fi(...e){return e.map(n=>wme(n)).join("")}function art(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function po(...e){return"("+(art(e).capture?"":"?:")+e.map(r=>wme(r)).join("|")+")"}const bB=e=>fi(/\b/,e,/\w$/.test(e)?/\b/:/\B/),ort=["Protocol","Type"].map(bB),nW=["init","self"].map(bB),lrt=["Any","Self"],fD=["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"],rW=["false","nil","true"],crt=["assignment","associativity","higherThan","left","lowerThan","none","right"],urt=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],iW=["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"],Sme=po(/[/=\-+!*%<>&|^~?]/,/[\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]/),Eme=po(Sme,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),hD=fi(Sme,Eme,"*"),kme=po(/[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]/),YC=po(kme,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Vu=fi(kme,YC,"*"),E2=fi(/[A-Z]/,YC,"*"),drt=["attached","autoclosure",fi(/convention\(/,po("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",fi(/objc\(/,Vu,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],frt=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function hrt(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],i={match:[/\./,po(...ort,...nW)],className:{2:"keyword"}},s={match:fi(/\./,po(...fD)),relevance:0},a=fD.filter(Ue=>typeof Ue=="string").concat(["_|0"]),l=fD.filter(Ue=>typeof Ue!="string").concat(lrt).map(bB),c={variants:[{className:"keyword",match:po(...l,...nW)}]},u={$pattern:po(/\b\w+/,/#\w+/),keyword:a.concat(urt),literal:rW},d=[i,s,c],f={match:fi(/\./,po(...iW)),relevance:0},h={className:"built_in",match:fi(/\b/,po(...iW),/(?=\()/)},m=[f,h],g={match:/->/,relevance:0},b={className:"operator",relevance:0,variants:[{match:hD},{match:`\\.(\\.|${Eme})+`}]},y=[g,b],O="([0-9]_*)+",v="([0-9a-fA-F]_*)+",x={className:"number",relevance:0,variants:[{match:`\\b(${O})(\\.(${O}))?([eE][+-]?(${O}))?\\b`},{match:`\\b0x(${v})(\\.(${v}))?([pP][+-]?(${O}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},w=(Ue="")=>({className:"subst",variants:[{match:fi(/\\/,Ue,/[0\\tnr"']/)},{match:fi(/\\/,Ue,/u\{[0-9a-fA-F]{1,8}\}/)}]}),S=(Ue="")=>({className:"subst",match:fi(/\\/,Ue,/[\t ]*(?:[\r\n]|\r\n)/)}),E=(Ue="")=>({className:"subst",label:"interpol",begin:fi(/\\/,Ue,/\(/),end:/\)/}),k=(Ue="")=>({begin:fi(Ue,/"""/),end:fi(/"""/,Ue),contains:[w(Ue),S(Ue),E(Ue)]}),_=(Ue="")=>({begin:fi(Ue,/"/),end:fi(/"/,Ue),contains:[w(Ue),E(Ue)]}),T={className:"string",variants:[k(),k("#"),k("##"),k("###"),_(),_("#"),_("##"),_("###")]},C=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],A={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:C},j=Ue=>{const Ke=fi(Ue,/\//),Ce=fi(/\//,Ue);return{begin:Ke,end:Ce,contains:[...C,{scope:"comment",begin:`#(?!.*${Ce})`,end:/$/}]}},M={scope:"regexp",variants:[j("###"),j("##"),j("#"),A]},I={match:fi(/`/,Vu,/`/)},$={className:"variable",match:/\$\d+/},N={className:"variable",match:`\\$${YC}+`},D=[I,$,N],Q={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:frt,contains:[...y,x,T]}]}},F={scope:"keyword",match:fi(/@/,po(...drt),lx(po(/\(/,/\s+/)))},L={scope:"meta",match:fi(/@/,Vu)},H=[Q,F,L],z={match:lx(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:fi(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,YC,"+")},{className:"type",match:E2,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:fi(/\s+&\s+/,lx(E2)),relevance:0}]},B={begin://,keywords:u,contains:[...r,...d,...H,g,z]};z.contains.push(B);const V={match:fi(Vu,/\s*:/),keywords:"_|0",relevance:0},W={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",V,...r,M,...d,...m,...y,x,T,...D,...H,z]},le={begin://,keywords:"repeat each",contains:[...r,z]},be={begin:po(lx(fi(Vu,/\s*:/)),lx(fi(Vu,/\s+/,Vu,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Vu}]},re={begin:/\(/,end:/\)/,keywords:u,contains:[be,...r,...d,...y,x,T,...H,z,W],endsParent:!0,illegal:/["']/},q={match:[/(func|macro)/,/\s+/,po(I.match,Vu,hD)],className:{1:"keyword",3:"title.function"},contains:[le,re,t],illegal:[/\[/,/%/]},G={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[le,re,t],illegal:/\[|%/},J={match:[/operator/,/\s+/,hD],className:{1:"keyword",3:"title"}},de={begin:[/precedencegroup/,/\s+/,E2],className:{1:"keyword",3:"title"},contains:[z],keywords:[...crt,...rW],end:/}/},ve={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Pe={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},Ae={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,Vu,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:u,contains:[le,...d,{begin:/:/,end:/\{/,keywords:u,contains:[{scope:"title.class.inherited",match:E2},...d],relevance:0}]};for(const Ue of T.variants){const Ke=Ue.contains.find(Le=>Le.label==="interpol");Ke.keywords=u;const Ce=[...d,...m,...y,x,T,...D];Ke.contains=[...Ce,{begin:/\(/,end:/\)/,contains:["self",...Ce]}]}return{name:"Swift",keywords:u,contains:[...r,q,G,ve,Pe,Ae,J,de,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},M,...d,...m,...y,x,T,...D,...H,z,W]}}const ZC="[A-Za-z$_][0-9A-Za-z$_]*",_me=["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"],Tme=["true","false","null","undefined","NaN","Infinity"],Cme=["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"],Ame=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Nme=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],jme=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Rme=[].concat(Nme,Cme,Ame);function prt(e){const t=e.regex,n=(Q,{after:F})=>{const L="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(Q,F)=>{const L=Q[0].length+Q.index,H=Q.input[L];if(H==="<"||H===","){F.ignoreMatch();return}H===">"&&(n(Q,{after:L})||F.ignoreMatch());let z;const B=Q.input.substring(L);if(z=B.match(/^\s*=/)){F.ignoreMatch();return}if((z=B.match(/^\s+extends\s+/))&&z.index===0){F.ignoreMatch();return}}},l={$pattern:ZC,keyword:_me,literal:Tme,built_in:Rme,"variable.language":jme},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:l,contains:[]},m={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},g={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},b={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},y={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},v={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]},x=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,m,g,b,y,{match:/\$\d+/},f];h.contains=x.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(x)});const w=[].concat(v,h.contains),S=w.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(w)}]),E={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:S},k={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"}}]},_={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:{_:[...Cme,...Ame]}},T={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},C={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[E],illegal:/%/},A={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function j(Q){return t.concat("(?!",Q.join("|"),")")}const M={match:t.concat(/\b/,j([...Nme,"super","import"].map(Q=>`${Q}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},I={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},$={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},E]},N="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",D={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(N)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[E]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:S,CLASS_REFERENCE:_},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),T,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,m,g,b,y,v,{match:/\$\d+/},f,_,{scope:"attr",match:r+t.lookahead(":"),relevance:0},D,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[v,e.REGEXP_MODE,{className:"function",begin:N,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:S}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:s},{begin:a.begin,"on:begin":a.isTrulyOpeningTag,end:a.end}],subLanguage:"xml",contains:[{begin:a.begin,end:a.end,skip:!0,contains:["self"]}]}]},C,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[E,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},I,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[E]},M,A,k,$,{match:/\$[(.]/}]}}function Ime(e){const t=e.regex,n=prt(e),r=ZC,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],s={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},a={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[n.exports.CLASS_REFERENCE]},l={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},c=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],u={$pattern:ZC,keyword:_me.concat(c),literal:Tme,built_in:Rme.concat(i),"variable.language":jme},d={className:"meta",begin:"@"+r},f=(b,y,O)=>{const v=b.contains.findIndex(x=>x.label===y);if(v===-1)throw new Error("can not find mode to replace");b.contains.splice(v,1,O)};Object.assign(n.keywords,u),n.exports.PARAMS_CONTAINS.push(d);const h=n.contains.find(b=>b.scope==="attr"),m=Object.assign({},h,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,h,m]),n.contains=n.contains.concat([d,s,a,m]),f(n,"shebang",e.SHEBANG()),f(n,"use_strict",l);const g=n.contains.find(b=>b.label==="func.def");return g.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function mrt(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,s=/\d{4}-\d{1,2}-\d{1,2}/,a=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,l=/\d{1,2}(:\d{1,2}){1,2}/,c={className:"literal",variants:[{begin:t.concat(/# */,t.either(s,i),/ *#/)},{begin:t.concat(/# */,l,/ *#/)},{begin:t.concat(/# */,a,/ *#/)},{begin:t.concat(/# */,t.either(s,i),/ +/,t.either(a,l),/ *#/)}]},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 grt(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"],i={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},s={className:"variable",begin:/\$[\w_]+/},a={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},l={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"}},s,a,i,e.QUOTE_STRING_MODE,c,u,l]}}function brt(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,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},s={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},a=e.inherit(s,{begin:/\(/,end:/\)/}),l=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:[s,c,l,a,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[s,a,c,l]}]}]},e.COMMENT(//,{relevance:10}),{begin://,relevance:10},i,{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 Dme(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]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},s={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,i]},l=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"},m={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},g={begin:/\{/,end:/\}/,contains:[m],illegal:"\\n",relevance:0},b={begin:"\\[",end:"\\]",contains:[m],illegal:"\\n",relevance:0},y=[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},g,b,s,a],O=[...y];return O.pop(),O.push(l),m.contains=O,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:y}}const yrt={arduino:lnt,bash:gB,c:cnt,cpp:unt,csharp:dnt,css:xnt,diff:vnt,go:wnt,graphql:Snt,ini:ume,java:Ent,javascript:mme,json:gme,kotlin:Nnt,less:$nt,lua:Bnt,makefile:Ome,markdown:xme,objectivec:Qnt,perl:Unt,php:Fnt,"php-template":znt,plaintext:Vnt,python:vme,"python-repl":Hnt,r:qnt,ruby:Xnt,rust:Gnt,scss:rrt,shell:irt,sql:srt,swift:hrt,typescript:Ime,vbnet:mrt,wasm:grt,xml:brt,yaml:Dme};function Pme(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)&&Pme(n)}),e}let sW=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function Mme(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function pp(e,...t){const n=Object.create(null);for(const r in e)n[r]=e[r];return t.forEach(function(r){for(const i in r)n[i]=r[i]}),n}const Ort="",aW=e=>!!e.scope,xrt=(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,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return`${t}${e}`};class vrt{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=Mme(t)}openNode(t){if(!aW(t))return;const n=xrt(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){aW(t)&&(this.buffer+=Ort)}value(){return this.buffer}span(t){this.buffer+=``}}const oW=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class yB{constructor(){this.rootNode=oW(),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=oW({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=>{yB._collapse(n)}))}}class wrt extends yB{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 vrt(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Xw(e){return e?typeof e=="string"?e:e.source:null}function Lme(e){return v0("(?=",e,")")}function Srt(e){return v0("(?:",e,")*")}function Ert(e){return v0("(?:",e,")?")}function v0(...e){return e.map(n=>Xw(n)).join("")}function krt(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function OB(...e){return"("+(krt(e).capture?"":"?:")+e.map(r=>Xw(r)).join("|")+")"}function $me(e){return new RegExp(e.toString()+"|").exec("").length-1}function _rt(e,t){const n=e&&e.exec(t);return n&&n.index===0}const Trt=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function xB(e,{joinWith:t}){let n=0;return e.map(r=>{n+=1;const i=n;let s=Xw(r),a="";for(;s.length>0;){const l=Trt.exec(s);if(!l){a+=s;break}a+=s.substring(0,l.index),s=s.substring(l.index+l[0].length),l[0][0]==="\\"&&l[1]?a+="\\"+String(Number(l[1])+i):(a+=l[0],l[0]==="("&&n++)}return a}).map(r=>`(${r})`).join(t)}const Crt=/\b\B/,Bme="[a-zA-Z]\\w*",vB="[a-zA-Z_]\\w*",Qme="\\b\\d+(\\.\\d+)?",Ume="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",Fme="\\b(0b[01]+)",Art="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",Nrt=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=v0(t,/.*\b/,e.binary,/\b.*/)),pp({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},e)},Gw={begin:"\\\\[\\s\\S]",relevance:0},jrt={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Gw]},Rrt={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Gw]},Irt={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/},Nj=function(e,t,n={}){const r=pp({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 i=OB("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:v0(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},Drt=Nj("//","$"),Prt=Nj("/\\*","\\*/"),Mrt=Nj("#","$"),Lrt={scope:"number",begin:Qme,relevance:0},$rt={scope:"number",begin:Ume,relevance:0},Brt={scope:"number",begin:Fme,relevance:0},Qrt={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Gw,{begin:/\[/,end:/\]/,relevance:0,contains:[Gw]}]},Urt={scope:"title",begin:Bme,relevance:0},Frt={scope:"title",begin:vB,relevance:0},zrt={begin:"\\.\\s*"+vB,relevance:0},Vrt=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 k2=Object.freeze({__proto__:null,APOS_STRING_MODE:jrt,BACKSLASH_ESCAPE:Gw,BINARY_NUMBER_MODE:Brt,BINARY_NUMBER_RE:Fme,COMMENT:Nj,C_BLOCK_COMMENT_MODE:Prt,C_LINE_COMMENT_MODE:Drt,C_NUMBER_MODE:$rt,C_NUMBER_RE:Ume,END_SAME_AS_BEGIN:Vrt,HASH_COMMENT_MODE:Mrt,IDENT_RE:Bme,MATCH_NOTHING_RE:Crt,METHOD_GUARD:zrt,NUMBER_MODE:Lrt,NUMBER_RE:Qme,PHRASAL_WORDS_MODE:Irt,QUOTE_STRING_MODE:Rrt,REGEXP_MODE:Qrt,RE_STARTERS_RE:Art,SHEBANG:Nrt,TITLE_MODE:Urt,UNDERSCORE_IDENT_RE:vB,UNDERSCORE_TITLE_MODE:Frt});function Hrt(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function qrt(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function Xrt(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=Hrt,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function Grt(e,t){Array.isArray(e.illegal)&&(e.illegal=OB(...e.illegal))}function Wrt(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 Yrt(e,t){e.relevance===void 0&&(e.relevance=1)}const Zrt=(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=v0(n.beforeMatch,Lme(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},Krt=["of","and","for","in","not","or","if","then","parent","list","value"],Jrt="keyword";function zme(e,t,n=Jrt){const r=Object.create(null);return typeof e=="string"?i(n,e.split(" ")):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(s){Object.assign(r,zme(e[s],t,s))}),r;function i(s,a){t&&(a=a.map(l=>l.toLowerCase())),a.forEach(function(l){const c=l.split("|");r[c[0]]=[s,eit(c[0],c[1])]})}}function eit(e,t){return t?Number(t):tit(e)?0:1}function tit(e){return Krt.includes(e.toLowerCase())}const lW={},Sg=e=>{console.error(e)},cW=(e,...t)=>{console.log(`WARN: ${e}`,...t)},K0=(e,t)=>{lW[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),lW[`${e}/${t}`]=!0)},KC=new Error;function Vme(e,t,{key:n}){let r=0;const i=e[n],s={},a={};for(let l=1;l<=t.length;l++)a[l+r]=i[l],s[l+r]=!0,r+=$me(t[l-1]);e[n]=a,e[n]._emit=s,e[n]._multi=!0}function nit(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw Sg("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),KC;if(typeof e.beginScope!="object"||e.beginScope===null)throw Sg("beginScope must be object"),KC;Vme(e,e.begin,{key:"beginScope"}),e.begin=xB(e.begin,{joinWith:""})}}function rit(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw Sg("skip, excludeEnd, returnEnd not compatible with endScope: {}"),KC;if(typeof e.endScope!="object"||e.endScope===null)throw Sg("endScope must be object"),KC;Vme(e,e.end,{key:"endScope"}),e.end=xB(e.end,{joinWith:""})}}function iit(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function sit(e){iit(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),nit(e),rit(e)}function ait(e){function t(a,l){return new RegExp(Xw(a),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(l?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(l,c){c.position=this.position++,this.matchIndexes[this.matchAt]=c,this.regexes.push([c,l]),this.matchAt+=$me(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const l=this.regexes.map(c=>c[1]);this.matcherRe=t(xB(l,{joinWith:"|"}),!0),this.lastIndex=0}exec(l){this.matcherRe.lastIndex=this.lastIndex;const c=this.matcherRe.exec(l);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(l){if(this.multiRegexes[l])return this.multiRegexes[l];const c=new n;return this.rules.slice(l).forEach(([u,d])=>c.addRule(u,d)),c.compile(),this.multiRegexes[l]=c,c}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(l,c){this.rules.push([l,c]),c.type==="begin"&&this.count++}exec(l){const c=this.getMatcher(this.regexIndex);c.lastIndex=this.lastIndex;let u=c.exec(l);if(this.resumingScanAtSamePosition()&&!(u&&u.index===this.lastIndex)){const d=this.getMatcher(0);d.lastIndex=this.lastIndex+1,u=d.exec(l)}return u&&(this.regexIndex+=u.position+1,this.regexIndex===this.count&&this.considerAll()),u}}function i(a){const l=new r;return a.contains.forEach(c=>l.addRule(c.begin,{rule:c,type:"begin"})),a.terminatorEnd&&l.addRule(a.terminatorEnd,{type:"end"}),a.illegal&&l.addRule(a.illegal,{type:"illegal"}),l}function s(a,l){const c=a;if(a.isCompiled)return c;[qrt,Wrt,sit,Zrt].forEach(d=>d(a,l)),e.compilerExtensions.forEach(d=>d(a,l)),a.__beforeBegin=null,[Xrt,Grt,Yrt].forEach(d=>d(a,l)),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=zme(a.keywords,e.case_insensitive)),c.keywordPatternRe=t(u,!0),l&&(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=Xw(c.end)||"",a.endsWithParent&&l.terminatorEnd&&(c.terminatorEnd+=(a.end?"|":"")+l.terminatorEnd)),a.illegal&&(c.illegalRe=t(a.illegal)),a.contains||(a.contains=[]),a.contains=[].concat(...a.contains.map(function(d){return oit(d==="self"?a:d)})),a.contains.forEach(function(d){s(d,c)}),a.starts&&s(a.starts,l),c.matcher=i(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=pp(e.classNameAliases||{}),s(e)}function Hme(e){return e?e.endsWithParent||Hme(e.starts):!1}function oit(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return pp(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:Hme(e)?pp(e,{starts:e.starts?pp(e.starts):null}):Object.isFrozen(e)?pp(e):e}var lit="11.11.1";class cit extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}}const pD=Mme,uW=pp,dW=Symbol("nomatch"),uit=7,qme=function(e){const t=Object.create(null),n=Object.create(null),r=[];let i=!0;const s="Could not find the language '{}', did you forget to load/include a language module?",a={disableAutodetect:!0,name:"Plain text",contains:[]};let l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:wrt};function c(N){return l.noHighlightRe.test(N)}function u(N){let D=N.className+" ";D+=N.parentNode?N.parentNode.className:"";const Q=l.languageDetectRe.exec(D);if(Q){const F=_(Q[1]);return F||(cW(s.replace("{}",Q[1])),cW("Falling back to no-highlight mode for this block.",N)),F?Q[1]:"no-highlight"}return D.split(/\s+/).find(F=>c(F)||_(F))}function d(N,D,Q){let F="",L="";typeof D=="object"?(F=N,Q=D.ignoreIllegals,L=D.language):(K0("10.7.0","highlight(lang, code, ...args) has been deprecated."),K0("10.7.0",`Please use highlight(code, options) instead. +https://github.com/highlightjs/highlight.js/issues/2277`),L=N,F=D),Q===void 0&&(Q=!0);const H={code:F,language:L};I("before:highlight",H);const z=H.result?H.result:f(H.language,H.code,Q);return z.code=H.code,I("after:highlight",z),z}function f(N,D,Q,F){const L=Object.create(null);function H(ie,ce){return ie.keywords[ce]}function z(){if(!Ce.keywords){pe.addText(me);return}let ie=0;Ce.keywordPatternRe.lastIndex=0;let ce=Ce.keywordPatternRe.exec(me),Ie="";for(;ce;){Ie+=me.substring(ie,ce.index);const We=Ae.case_insensitive?ce[0].toLowerCase():ce[0],K=H(Ce,We);if(K){const[_e,Be]=K;if(pe.addText(Ie),Ie="",L[We]=(L[We]||0)+1,L[We]<=uit&&(we+=Be),_e.startsWith("_"))Ie+=ce[0];else{const He=Ae.classNameAliases[_e]||_e;W(ce[0],He)}}else Ie+=ce[0];ie=Ce.keywordPatternRe.lastIndex,ce=Ce.keywordPatternRe.exec(me)}Ie+=me.substring(ie),pe.addText(Ie)}function B(){if(me==="")return;let ie=null;if(typeof Ce.subLanguage=="string"){if(!t[Ce.subLanguage]){pe.addText(me);return}ie=f(Ce.subLanguage,me,!0,Le[Ce.subLanguage]),Le[Ce.subLanguage]=ie._top}else ie=m(me,Ce.subLanguage.length?Ce.subLanguage:null);Ce.relevance>0&&(we+=ie.relevance),pe.__addSublanguage(ie._emitter,ie.language)}function V(){Ce.subLanguage!=null?B():z(),me=""}function W(ie,ce){ie!==""&&(pe.startScope(ce),pe.addText(ie),pe.endScope())}function le(ie,ce){let Ie=1;const We=ce.length-1;for(;Ie<=We;){if(!ie._emit[Ie]){Ie++;continue}const K=Ae.classNameAliases[ie[Ie]]||ie[Ie],_e=ce[Ie];K?W(_e,K):(me=_e,z(),me=""),Ie++}}function be(ie,ce){return ie.scope&&typeof ie.scope=="string"&&pe.openNode(Ae.classNameAliases[ie.scope]||ie.scope),ie.beginScope&&(ie.beginScope._wrap?(W(me,Ae.classNameAliases[ie.beginScope._wrap]||ie.beginScope._wrap),me=""):ie.beginScope._multi&&(le(ie.beginScope,ce),me="")),Ce=Object.create(ie,{parent:{value:Ce}}),Ce}function re(ie,ce,Ie){let We=_rt(ie.endRe,Ie);if(We){if(ie["on:end"]){const K=new sW(ie);ie["on:end"](ce,K),K.isMatchIgnored&&(We=!1)}if(We){for(;ie.endsParent&&ie.parent;)ie=ie.parent;return ie}}if(ie.endsWithParent)return re(ie.parent,ce,Ie)}function q(ie){return Ce.matcher.regexIndex===0?(me+=ie[0],1):($e=!0,0)}function G(ie){const ce=ie[0],Ie=ie.rule,We=new sW(Ie),K=[Ie.__beforeBegin,Ie["on:begin"]];for(const _e of K)if(_e&&(_e(ie,We),We.isMatchIgnored))return q(ce);return Ie.skip?me+=ce:(Ie.excludeBegin&&(me+=ce),V(),!Ie.returnBegin&&!Ie.excludeBegin&&(me=ce)),be(Ie,ie),Ie.returnBegin?0:ce.length}function J(ie){const ce=ie[0],Ie=D.substring(ie.index),We=re(Ce,ie,Ie);if(!We)return dW;const K=Ce;Ce.endScope&&Ce.endScope._wrap?(V(),W(ce,Ce.endScope._wrap)):Ce.endScope&&Ce.endScope._multi?(V(),le(Ce.endScope,ie)):K.skip?me+=ce:(K.returnEnd||K.excludeEnd||(me+=ce),V(),K.excludeEnd&&(me=ce));do Ce.scope&&pe.closeNode(),!Ce.skip&&!Ce.subLanguage&&(we+=Ce.relevance),Ce=Ce.parent;while(Ce!==We.parent);return We.starts&&be(We.starts,ie),K.returnEnd?0:ce.length}function de(){const ie=[];for(let ce=Ce;ce!==Ae;ce=ce.parent)ce.scope&&ie.unshift(ce.scope);ie.forEach(ce=>pe.openNode(ce))}let ve={};function Pe(ie,ce){const Ie=ce&&ce[0];if(me+=ie,Ie==null)return V(),0;if(ve.type==="begin"&&ce.type==="end"&&ve.index===ce.index&&Ie===""){if(me+=D.slice(ce.index,ce.index+1),!i){const We=new Error(`0 width match regex (${N})`);throw We.languageName=N,We.badRule=ve.rule,We}return 1}if(ve=ce,ce.type==="begin")return G(ce);if(ce.type==="illegal"&&!Q){const We=new Error('Illegal lexeme "'+Ie+'" for mode "'+(Ce.scope||"")+'"');throw We.mode=Ce,We}else if(ce.type==="end"){const We=J(ce);if(We!==dW)return We}if(ce.type==="illegal"&&Ie==="")return me+=` +`,1;if(st>1e5&&st>ce.index*3)throw new Error("potential infinite loop, way more iterations than matches");return me+=Ie,Ie.length}const Ae=_(N);if(!Ae)throw Sg(s.replace("{}",N)),new Error('Unknown language: "'+N+'"');const Ue=ait(Ae);let Ke="",Ce=F||Ue;const Le={},pe=new l.__emitter(l);de();let me="",we=0,Ee=0,st=0,$e=!1;try{if(Ae.__emitTokens)Ae.__emitTokens(D,pe);else{for(Ce.matcher.considerAll();;){st++,$e?$e=!1:Ce.matcher.considerAll(),Ce.matcher.lastIndex=Ee;const ie=Ce.matcher.exec(D);if(!ie)break;const ce=D.substring(Ee,ie.index),Ie=Pe(ce,ie);Ee=ie.index+Ie}Pe(D.substring(Ee))}return pe.finalize(),Ke=pe.toHTML(),{language:N,value:Ke,relevance:we,illegal:!1,_emitter:pe,_top:Ce}}catch(ie){if(ie.message&&ie.message.includes("Illegal"))return{language:N,value:pD(D),illegal:!0,relevance:0,_illegalBy:{message:ie.message,index:Ee,context:D.slice(Ee-100,Ee+100),mode:ie.mode,resultSoFar:Ke},_emitter:pe};if(i)return{language:N,value:pD(D),illegal:!1,relevance:0,errorRaised:ie,_emitter:pe,_top:Ce};throw ie}}function h(N){const D={value:pD(N),illegal:!1,relevance:0,_top:a,_emitter:new l.__emitter(l)};return D._emitter.addText(N),D}function m(N,D){D=D||l.languages||Object.keys(t);const Q=h(N),F=D.filter(_).filter(C).map(V=>f(V,N,!1));F.unshift(Q);const L=F.sort((V,W)=>{if(V.relevance!==W.relevance)return W.relevance-V.relevance;if(V.language&&W.language){if(_(V.language).supersetOf===W.language)return 1;if(_(W.language).supersetOf===V.language)return-1}return 0}),[H,z]=L,B=H;return B.secondBest=z,B}function g(N,D,Q){const F=D&&n[D]||Q;N.classList.add("hljs"),N.classList.add(`language-${F}`)}function b(N){let D=null;const Q=u(N);if(c(Q))return;if(I("before:highlightElement",{el:N,language:Q}),N.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",N);return}if(N.children.length>0&&(l.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(N)),l.throwUnescapedHTML))throw new cit("One of your code blocks includes unescaped HTML.",N.innerHTML);D=N;const F=D.textContent,L=Q?d(F,{language:Q,ignoreIllegals:!0}):m(F);N.innerHTML=L.value,N.dataset.highlighted="yes",g(N,Q,L.language),N.result={language:L.language,re:L.relevance,relevance:L.relevance},L.secondBest&&(N.secondBest={language:L.secondBest.language,relevance:L.secondBest.relevance}),I("after:highlightElement",{el:N,result:L,text:F})}function y(N){l=uW(l,N)}const O=()=>{w(),K0("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function v(){w(),K0("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let x=!1;function w(){function N(){w()}if(document.readyState==="loading"){x||window.addEventListener("DOMContentLoaded",N,!1),x=!0;return}document.querySelectorAll(l.cssSelector).forEach(b)}function S(N,D){let Q=null;try{Q=D(e)}catch(F){if(Sg("Language definition for '{}' could not be registered.".replace("{}",N)),i)Sg(F);else throw F;Q=a}Q.name||(Q.name=N),t[N]=Q,Q.rawDefinition=D.bind(null,e),Q.aliases&&T(Q.aliases,{languageName:N})}function E(N){delete t[N];for(const D of Object.keys(n))n[D]===N&&delete n[D]}function k(){return Object.keys(t)}function _(N){return N=(N||"").toLowerCase(),t[N]||t[n[N]]}function T(N,{languageName:D}){typeof N=="string"&&(N=[N]),N.forEach(Q=>{n[Q.toLowerCase()]=D})}function C(N){const D=_(N);return D&&!D.disableAutodetect}function A(N){N["before:highlightBlock"]&&!N["before:highlightElement"]&&(N["before:highlightElement"]=D=>{N["before:highlightBlock"](Object.assign({block:D.el},D))}),N["after:highlightBlock"]&&!N["after:highlightElement"]&&(N["after:highlightElement"]=D=>{N["after:highlightBlock"](Object.assign({block:D.el},D))})}function j(N){A(N),r.push(N)}function M(N){const D=r.indexOf(N);D!==-1&&r.splice(D,1)}function I(N,D){const Q=N;r.forEach(function(F){F[Q]&&F[Q](D)})}function $(N){return K0("10.7.0","highlightBlock will be removed entirely in v12.0"),K0("10.7.0","Please use highlightElement now."),b(N)}Object.assign(e,{highlight:d,highlightAuto:m,highlightAll:w,highlightElement:b,highlightBlock:$,configure:y,initHighlighting:O,initHighlightingOnLoad:v,registerLanguage:S,unregisterLanguage:E,listLanguages:k,getLanguage:_,registerAliases:T,autoDetection:C,inherit:uW,addPlugin:j,removePlugin:M}),e.debugMode=function(){i=!1},e.safeMode=function(){i=!0},e.versionString=lit,e.regex={concat:v0,lookahead:Lme,either:OB,optional:Ert,anyNumberOfTimes:Srt};for(const N in k2)typeof k2[N]=="object"&&Pme(k2[N]);return Object.assign(e,k2),e},p1=qme({});p1.newInstance=()=>qme({});var dit=p1;p1.HighlightJS=p1;p1.default=p1;const Za=N1(dit),fW={},fit="hljs-";function hit(e){const t=Za.newInstance();return e&&s(e),{highlight:n,highlightAuto:r,listLanguages:i,register:s,registerAlias:a,registered:l};function n(c,u,d){const f=d||fW,h=typeof f.prefix=="string"?f.prefix:fit;if(!t.getLanguage(c))throw new Error("Unknown language: `"+c+"` is not registered");t.configure({__emitter:pit,classPrefix:h});const m=t.highlight(u,{ignoreIllegals:!0,language:c});if(m.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:m.errorRaised});const g=m._emitter.root,b=g.data;return b.language=m.language,b.relevance=m.relevance,g}function r(c,u){const f=(u||fW).subset||i();let h=-1,m=0,g;for(;++hm&&(m=y.data.relevance,g=y)}return g||{type:"root",children:[],data:{language:void 0,relevance:m}}}function i(){return t.listLanguages()}function s(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 l(c){return!!t.getLanguage(c)}}class pit{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],i=t.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):r.children.push(...i)}openNode(t){const n=this,r=t.split(".").map(function(a,l){return l?a+"_".repeat(l):n.options.classPrefix+a}),i=this.stack[this.stack.length-1],s={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(s),this.stack.push(s)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const mit={};function hW(e){const t=e||mit,n=t.aliases,r=t.detect||!1,i=t.languages||yrt,s=t.plainText,a=t.prefix,l=t.subset;let c="hljs";const u=hit(i);if(n&&u.registerAlias(n),a){const d=a.indexOf("-");c=d===-1?a:a.slice(0,d)}return function(d,f){EE(d,"element",function(h,m,g){if(h.tagName!=="code"||!g||g.type!=="element"||g.tagName!=="pre")return;const b=git(h);if(b===!1||!b&&!r||b&&s&&s.includes(b))return;Array.isArray(h.properties.className)||(h.properties.className=[]),h.properties.className.includes(c)||h.properties.className.unshift(c);const y=Jtt(h,{whitespace:"pre"});let O;try{O=b?u.highlight(b,y,{prefix:a}):u.highlightAuto(y,{prefix:a,subset:l})}catch(v){const x=v;if(b&&/Unknown language/.test(x.message)){f.message("Cannot highlight as `"+b+"`, it’s not registered",{ancestors:[g,h],cause:x,place:h.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw x}!b&&O.data&&O.data.language&&h.properties.className.push("language-"+O.data.language),O.children.length>0&&(h.children=O.children)})}}function git(e){const t=e.properties.className;let n=-1;if(!Array.isArray(t))return;let r;for(;++n-1&&s<=t.length){let a=0;for(;;){let l=n[a];if(l===void 0){const c=gW(t,n[a-1]);l=c===-1?t.length+1:c+1,n[a]=l}if(l>s)return{line:a+1,column:s-(a>0?n[a-1]:0)+1,offset:s};a++}}}function i(s){if(s&&typeof s.line=="number"&&typeof s.column=="number"&&!Number.isNaN(s.line)&&!Number.isNaN(s.column)){for(;n.length1?n[s.line-2]:0)+s.column-1;if(a=55296&&e<=57343}function Fit(e){return e>=56320&&e<=57343}function zit(e,t){return(e-55296)*1024+9216+t}function Kme(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function Jme(e){return e>=64976&&e<=65007||Uit.has(e)}var Ze;(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"})(Ze||(Ze={}));const Vit=65536;class Hit{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=Vit,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:i,offset:s}=this,a=i+n,l=s+n;return{code:t,startLine:r,endLine:r,startCol:a,endCol:a,startOffset:l,endOffset:l}}_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(Fit(n))return this.pos++,this._addGap(),zit(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,te.EOF;return this._err(Ze.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,te.EOF;const r=this.html.charCodeAt(n);return r===te.CARRIAGE_RETURN?te.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,te.EOF;let t=this.html.charCodeAt(this.pos);return t===te.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,te.LINE_FEED):t===te.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,Zme(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===te.LINE_FEED||t===te.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){Kme(t)?this._err(Ze.controlCharacterInInputStream):Jme(t)&&this._err(Ze.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 qit=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))),Xit=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 Git(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=Xit.get(e))!==null&&t!==void 0?t:e}var fa;(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"})(fa||(fa={}));const Wit=32;var mp;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(mp||(mp={}));function lL(e){return e>=fa.ZERO&&e<=fa.NINE}function Yit(e){return e>=fa.UPPER_A&&e<=fa.UPPER_F||e>=fa.LOWER_A&&e<=fa.LOWER_F}function Zit(e){return e>=fa.UPPER_A&&e<=fa.UPPER_Z||e>=fa.LOWER_A&&e<=fa.LOWER_Z||lL(e)}function Kit(e){return e===fa.EQUALS||Zit(e)}var ra;(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"})(ra||(ra={}));var yf;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(yf||(yf={}));class Jit{constructor(t,n,r){this.decodeTree=t,this.emitCodePoint=n,this.errors=r,this.state=ra.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=yf.Strict}startEntity(t){this.decodeMode=t,this.state=ra.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case ra.EntityStart:return t.charCodeAt(n)===fa.NUM?(this.state=ra.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=ra.NamedEntity,this.stateNamedEntity(t,n));case ra.NumericStart:return this.stateNumericStart(t,n);case ra.NumericDecimal:return this.stateNumericDecimal(t,n);case ra.NumericHex:return this.stateNumericHex(t,n);case ra.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|Wit)===fa.LOWER_X?(this.state=ra.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=ra.NumericDecimal,this.stateNumericDecimal(t,n))}addToNumericResult(t,n,r,i){if(n!==r){const s=r-n;this.result=this.result*Math.pow(i,s)+Number.parseInt(t.substr(n,s),i),this.consumed+=s}}stateNumericHex(t,n){const r=n;for(;n>14;for(;n>14,s!==0){if(a===fa.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==yf.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;const{result:n,decodeTree:r}=this,i=(r[n]&mp.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,i,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,r){const{decodeTree:i}=this;return this.emitCodePoint(n===1?i[t]&~mp.VALUE_LENGTH:i[t+1],r),n===3&&this.emitCodePoint(i[t+2],r),r}end(){var t;switch(this.state){case ra.NamedEntity:return this.result!==0&&(this.decodeMode!==yf.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case ra.NumericDecimal:return this.emitNumericEntity(0,2);case ra.NumericHex:return this.emitNumericEntity(0,3);case ra.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case ra.EntityStart:return 0}}}function est(e,t,n,r){const i=(t&mp.BRANCH_LENGTH)>>7,s=t&mp.JUMP_TABLE;if(i===0)return s!==0&&r===s?n:-1;if(s){const c=r-s;return c<0||c>=i?-1:e[n+c]-1}let a=n,l=a+i-1;for(;a<=l;){const c=a+l>>>1,u=e[c];if(ur)l=c-1;else return e[c+i]}return-1}var pt;(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/"})(pt||(pt={}));var Eg;(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"})(Eg||(Eg={}));var vc;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(vc||(vc={}));var je;(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"})(je||(je={}));var R;(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"})(R||(R={}));const tst=new Map([[je.A,R.A],[je.ADDRESS,R.ADDRESS],[je.ANNOTATION_XML,R.ANNOTATION_XML],[je.APPLET,R.APPLET],[je.AREA,R.AREA],[je.ARTICLE,R.ARTICLE],[je.ASIDE,R.ASIDE],[je.B,R.B],[je.BASE,R.BASE],[je.BASEFONT,R.BASEFONT],[je.BGSOUND,R.BGSOUND],[je.BIG,R.BIG],[je.BLOCKQUOTE,R.BLOCKQUOTE],[je.BODY,R.BODY],[je.BR,R.BR],[je.BUTTON,R.BUTTON],[je.CAPTION,R.CAPTION],[je.CENTER,R.CENTER],[je.CODE,R.CODE],[je.COL,R.COL],[je.COLGROUP,R.COLGROUP],[je.DD,R.DD],[je.DESC,R.DESC],[je.DETAILS,R.DETAILS],[je.DIALOG,R.DIALOG],[je.DIR,R.DIR],[je.DIV,R.DIV],[je.DL,R.DL],[je.DT,R.DT],[je.EM,R.EM],[je.EMBED,R.EMBED],[je.FIELDSET,R.FIELDSET],[je.FIGCAPTION,R.FIGCAPTION],[je.FIGURE,R.FIGURE],[je.FONT,R.FONT],[je.FOOTER,R.FOOTER],[je.FOREIGN_OBJECT,R.FOREIGN_OBJECT],[je.FORM,R.FORM],[je.FRAME,R.FRAME],[je.FRAMESET,R.FRAMESET],[je.H1,R.H1],[je.H2,R.H2],[je.H3,R.H3],[je.H4,R.H4],[je.H5,R.H5],[je.H6,R.H6],[je.HEAD,R.HEAD],[je.HEADER,R.HEADER],[je.HGROUP,R.HGROUP],[je.HR,R.HR],[je.HTML,R.HTML],[je.I,R.I],[je.IMG,R.IMG],[je.IMAGE,R.IMAGE],[je.INPUT,R.INPUT],[je.IFRAME,R.IFRAME],[je.KEYGEN,R.KEYGEN],[je.LABEL,R.LABEL],[je.LI,R.LI],[je.LINK,R.LINK],[je.LISTING,R.LISTING],[je.MAIN,R.MAIN],[je.MALIGNMARK,R.MALIGNMARK],[je.MARQUEE,R.MARQUEE],[je.MATH,R.MATH],[je.MENU,R.MENU],[je.META,R.META],[je.MGLYPH,R.MGLYPH],[je.MI,R.MI],[je.MO,R.MO],[je.MN,R.MN],[je.MS,R.MS],[je.MTEXT,R.MTEXT],[je.NAV,R.NAV],[je.NOBR,R.NOBR],[je.NOFRAMES,R.NOFRAMES],[je.NOEMBED,R.NOEMBED],[je.NOSCRIPT,R.NOSCRIPT],[je.OBJECT,R.OBJECT],[je.OL,R.OL],[je.OPTGROUP,R.OPTGROUP],[je.OPTION,R.OPTION],[je.P,R.P],[je.PARAM,R.PARAM],[je.PLAINTEXT,R.PLAINTEXT],[je.PRE,R.PRE],[je.RB,R.RB],[je.RP,R.RP],[je.RT,R.RT],[je.RTC,R.RTC],[je.RUBY,R.RUBY],[je.S,R.S],[je.SCRIPT,R.SCRIPT],[je.SEARCH,R.SEARCH],[je.SECTION,R.SECTION],[je.SELECT,R.SELECT],[je.SOURCE,R.SOURCE],[je.SMALL,R.SMALL],[je.SPAN,R.SPAN],[je.STRIKE,R.STRIKE],[je.STRONG,R.STRONG],[je.STYLE,R.STYLE],[je.SUB,R.SUB],[je.SUMMARY,R.SUMMARY],[je.SUP,R.SUP],[je.TABLE,R.TABLE],[je.TBODY,R.TBODY],[je.TEMPLATE,R.TEMPLATE],[je.TEXTAREA,R.TEXTAREA],[je.TFOOT,R.TFOOT],[je.TD,R.TD],[je.TH,R.TH],[je.THEAD,R.THEAD],[je.TITLE,R.TITLE],[je.TR,R.TR],[je.TRACK,R.TRACK],[je.TT,R.TT],[je.U,R.U],[je.UL,R.UL],[je.SVG,R.SVG],[je.VAR,R.VAR],[je.WBR,R.WBR],[je.XMP,R.XMP]]);function uO(e){var t;return(t=tst.get(e))!==null&&t!==void 0?t:R.UNKNOWN}const gt=R,nst={[pt.HTML]:new Set([gt.ADDRESS,gt.APPLET,gt.AREA,gt.ARTICLE,gt.ASIDE,gt.BASE,gt.BASEFONT,gt.BGSOUND,gt.BLOCKQUOTE,gt.BODY,gt.BR,gt.BUTTON,gt.CAPTION,gt.CENTER,gt.COL,gt.COLGROUP,gt.DD,gt.DETAILS,gt.DIR,gt.DIV,gt.DL,gt.DT,gt.EMBED,gt.FIELDSET,gt.FIGCAPTION,gt.FIGURE,gt.FOOTER,gt.FORM,gt.FRAME,gt.FRAMESET,gt.H1,gt.H2,gt.H3,gt.H4,gt.H5,gt.H6,gt.HEAD,gt.HEADER,gt.HGROUP,gt.HR,gt.HTML,gt.IFRAME,gt.IMG,gt.INPUT,gt.LI,gt.LINK,gt.LISTING,gt.MAIN,gt.MARQUEE,gt.MENU,gt.META,gt.NAV,gt.NOEMBED,gt.NOFRAMES,gt.NOSCRIPT,gt.OBJECT,gt.OL,gt.P,gt.PARAM,gt.PLAINTEXT,gt.PRE,gt.SCRIPT,gt.SECTION,gt.SELECT,gt.SOURCE,gt.STYLE,gt.SUMMARY,gt.TABLE,gt.TBODY,gt.TD,gt.TEMPLATE,gt.TEXTAREA,gt.TFOOT,gt.TH,gt.THEAD,gt.TITLE,gt.TR,gt.TRACK,gt.UL,gt.WBR,gt.XMP]),[pt.MATHML]:new Set([gt.MI,gt.MO,gt.MN,gt.MS,gt.MTEXT,gt.ANNOTATION_XML]),[pt.SVG]:new Set([gt.TITLE,gt.FOREIGN_OBJECT,gt.DESC]),[pt.XLINK]:new Set,[pt.XML]:new Set,[pt.XMLNS]:new Set},cL=new Set([gt.H1,gt.H2,gt.H3,gt.H4,gt.H5,gt.H6]);je.STYLE,je.SCRIPT,je.XMP,je.IFRAME,je.NOEMBED,je.NOFRAMES,je.PLAINTEXT;var ae;(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"})(ae||(ae={}));const _s={DATA:ae.DATA,RCDATA:ae.RCDATA,RAWTEXT:ae.RAWTEXT,SCRIPT_DATA:ae.SCRIPT_DATA,PLAINTEXT:ae.PLAINTEXT,CDATA_SECTION:ae.CDATA_SECTION};function rst(e){return e>=te.DIGIT_0&&e<=te.DIGIT_9}function Xx(e){return e>=te.LATIN_CAPITAL_A&&e<=te.LATIN_CAPITAL_Z}function ist(e){return e>=te.LATIN_SMALL_A&&e<=te.LATIN_SMALL_Z}function Hh(e){return ist(e)||Xx(e)}function yW(e){return Hh(e)||rst(e)}function _2(e){return e+32}function tge(e){return e===te.SPACE||e===te.LINE_FEED||e===te.TABULATION||e===te.FORM_FEED}function OW(e){return tge(e)||e===te.SOLIDUS||e===te.GREATER_THAN_SIGN}function sst(e){return e===te.NULL?Ze.nullCharacterReference:e>1114111?Ze.characterReferenceOutsideUnicodeRange:Zme(e)?Ze.surrogateCharacterReference:Jme(e)?Ze.noncharacterCharacterReference:Kme(e)||e===te.CARRIAGE_RETURN?Ze.controlCharacterReference:null}class ast{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=ae.DATA,this.returnState=ae.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new Hit(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new Jit(qit,(r,i)=>{this.preprocessor.pos=this.entityStartPos+i-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(Ze.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(Ze.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const i=sst(r);i&&this._err(i,1)}}:void 0)}_err(t,n=0){var r,i;(i=(r=this.handler).onParseError)===null||i===void 0||i.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(Ze.endTagWithAttributes),t.selfClosing&&this._err(Ze.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 ar.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case ar.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case ar.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:ar.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=tge(t)?ar.WHITESPACE_CHARACTER:t===te.NULL?ar.NULL_CHARACTER:ar.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(ar.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=ae.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?yf.Attribute:yf.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===ae.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===ae.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===ae.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case ae.DATA:{this._stateData(t);break}case ae.RCDATA:{this._stateRcdata(t);break}case ae.RAWTEXT:{this._stateRawtext(t);break}case ae.SCRIPT_DATA:{this._stateScriptData(t);break}case ae.PLAINTEXT:{this._statePlaintext(t);break}case ae.TAG_OPEN:{this._stateTagOpen(t);break}case ae.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case ae.TAG_NAME:{this._stateTagName(t);break}case ae.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case ae.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case ae.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case ae.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case ae.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case ae.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case ae.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case ae.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case ae.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case ae.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case ae.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case ae.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case ae.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case ae.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case ae.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case ae.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case ae.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case ae.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case ae.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case ae.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case ae.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case ae.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case ae.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case ae.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case ae.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case ae.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case ae.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case ae.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case ae.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case ae.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case ae.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case ae.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case ae.BOGUS_COMMENT:{this._stateBogusComment(t);break}case ae.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case ae.COMMENT_START:{this._stateCommentStart(t);break}case ae.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case ae.COMMENT:{this._stateComment(t);break}case ae.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case ae.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case ae.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case ae.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case ae.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case ae.COMMENT_END:{this._stateCommentEnd(t);break}case ae.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case ae.DOCTYPE:{this._stateDoctype(t);break}case ae.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case ae.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case ae.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case ae.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case ae.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case ae.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case ae.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case ae.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case ae.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case ae.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case ae.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case ae.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case ae.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case ae.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case ae.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case ae.CDATA_SECTION:{this._stateCdataSection(t);break}case ae.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case ae.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case ae.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case ae.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case te.LESS_THAN_SIGN:{this.state=ae.TAG_OPEN;break}case te.AMPERSAND:{this._startCharacterReference();break}case te.NULL:{this._err(Ze.unexpectedNullCharacter),this._emitCodePoint(t);break}case te.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case te.AMPERSAND:{this._startCharacterReference();break}case te.LESS_THAN_SIGN:{this.state=ae.RCDATA_LESS_THAN_SIGN;break}case te.NULL:{this._err(Ze.unexpectedNullCharacter),this._emitChars(qi);break}case te.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case te.LESS_THAN_SIGN:{this.state=ae.RAWTEXT_LESS_THAN_SIGN;break}case te.NULL:{this._err(Ze.unexpectedNullCharacter),this._emitChars(qi);break}case te.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case te.LESS_THAN_SIGN:{this.state=ae.SCRIPT_DATA_LESS_THAN_SIGN;break}case te.NULL:{this._err(Ze.unexpectedNullCharacter),this._emitChars(qi);break}case te.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case te.NULL:{this._err(Ze.unexpectedNullCharacter),this._emitChars(qi);break}case te.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(Hh(t))this._createStartTagToken(),this.state=ae.TAG_NAME,this._stateTagName(t);else switch(t){case te.EXCLAMATION_MARK:{this.state=ae.MARKUP_DECLARATION_OPEN;break}case te.SOLIDUS:{this.state=ae.END_TAG_OPEN;break}case te.QUESTION_MARK:{this._err(Ze.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=ae.BOGUS_COMMENT,this._stateBogusComment(t);break}case te.EOF:{this._err(Ze.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(Ze.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=ae.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(Hh(t))this._createEndTagToken(),this.state=ae.TAG_NAME,this._stateTagName(t);else switch(t){case te.GREATER_THAN_SIGN:{this._err(Ze.missingEndTagName),this.state=ae.DATA;break}case te.EOF:{this._err(Ze.eofBeforeTagName),this._emitChars("");break}case te.NULL:{this._err(Ze.unexpectedNullCharacter),this.state=ae.SCRIPT_DATA_ESCAPED,this._emitChars(qi);break}case te.EOF:{this._err(Ze.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=ae.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===te.SOLIDUS?this.state=ae.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:Hh(t)?(this._emitChars("<"),this.state=ae.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=ae.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){Hh(t)?(this.state=ae.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("");break}case te.NULL:{this._err(Ze.unexpectedNullCharacter),this.state=ae.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(qi);break}case te.EOF:{this._err(Ze.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=ae.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===te.SOLIDUS?(this.state=ae.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=ae.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(Do.SCRIPT,!1)&&OW(this.preprocessor.peek(Do.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 i=this._indexOf(t)+1;this.items.splice(i,0,n),this.tagIDs.splice(i,0,r),this.stackTop++,i===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,i===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])!==pt.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(dst,pt.HTML)}clearBackToTableBodyContext(){this.clearBackTo(ust,pt.HTML)}clearBackToTableRowContext(){this.clearBackTo(cst,pt.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]===R.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]===R.HTML}hasInDynamicScope(t,n){for(let r=this.stackTop;r>=0;r--){const i=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case pt.HTML:{if(i===t)return!0;if(n.has(i))return!1;break}case pt.SVG:{if(wW.has(i))return!1;break}case pt.MATHML:{if(vW.has(i))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,JC)}hasInListItemScope(t){return this.hasInDynamicScope(t,ost)}hasInButtonScope(t){return this.hasInDynamicScope(t,lst)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const n=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case pt.HTML:{if(cL.has(n))return!0;if(JC.has(n))return!1;break}case pt.SVG:{if(wW.has(n))return!1;break}case pt.MATHML:{if(vW.has(n))return!1;break}}}return!0}hasInTableScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===pt.HTML)switch(this.tagIDs[n]){case t:return!0;case R.TABLE:case R.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===pt.HTML)switch(this.tagIDs[t]){case R.TBODY:case R.THEAD:case R.TFOOT:return!0;case R.TABLE:case R.HTML:return!1}return!0}hasInSelectScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===pt.HTML)switch(this.tagIDs[n]){case t:return!0;case R.OPTION:case R.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&nge.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&xW.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&xW.has(this.currentTagId);)this.pop()}}const mD=3;var Gu;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(Gu||(Gu={}));const SW={type:Gu.Marker};class pst{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){const r=[],i=n.length,s=this.treeAdapter.getTagName(t),a=this.treeAdapter.getNamespaceURI(t);for(let l=0;l[a.name,a.value]));let s=0;for(let a=0;ai.get(c.name)===c.value)&&(s+=1,s>=mD&&this.entries.splice(l.idx,1))}}insertMarker(){this.entries.unshift(SW)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:Gu.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:Gu.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(SW);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(r=>r.type===Gu.Marker||this.treeAdapter.getTagName(r.element)===t);return n&&n.type===Gu.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===Gu.Element&&n.element===t)}}const qh={createDocument(){return{nodeName:"#document",mode:vc.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 i=e.childNodes.find(s=>s.nodeName==="#documentType");if(i)i.name=t,i.publicId=n,i.systemId=r;else{const s={nodeName:"#documentType",name:t,publicId:n,systemId:r,parentNode:null};qh.appendChild(e,s)}},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(qh.isTextNode(n)){n.value+=t;return}}qh.appendChild(e,qh.createTextNode(t))},insertTextBefore(e,t,n){const r=e.childNodes[e.childNodes.indexOf(n)-1];r&&qh.isTextNode(r)?r.value+=t:qh.insertBefore(e,qh.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(r=>r.name));for(let r=0;re.startsWith(n))}function xst(e){return e.name===rge&&e.publicId===null&&(e.systemId===null||e.systemId===mst)}function vst(e){if(e.name!==rge)return vc.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===gst)return vc.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),yst.has(n))return vc.QUIRKS;let r=t===null?bst:ige;if(EW(n,r))return vc.QUIRKS;if(r=t===null?sge:Ost,EW(n,r))return vc.LIMITED_QUIRKS}return vc.NO_QUIRKS}const kW={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},wst="definitionurl",Sst="definitionURL",Est=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])),kst=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:pt.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:pt.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:pt.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:pt.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:pt.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:pt.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:pt.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:pt.XML}],["xml:space",{prefix:"xml",name:"space",namespace:pt.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:pt.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:pt.XMLNS}]]),_st=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])),Tst=new Set([R.B,R.BIG,R.BLOCKQUOTE,R.BODY,R.BR,R.CENTER,R.CODE,R.DD,R.DIV,R.DL,R.DT,R.EM,R.EMBED,R.H1,R.H2,R.H3,R.H4,R.H5,R.H6,R.HEAD,R.HR,R.I,R.IMG,R.LI,R.LISTING,R.MENU,R.META,R.NOBR,R.OL,R.P,R.PRE,R.RUBY,R.S,R.SMALL,R.SPAN,R.STRONG,R.STRIKE,R.SUB,R.SUP,R.TABLE,R.TT,R.U,R.UL,R.VAR]);function Cst(e){const t=e.tagID;return t===R.FONT&&e.attrs.some(({name:r})=>r===Eg.COLOR||r===Eg.SIZE||r===Eg.FACE)||Tst.has(t)}function age(e){for(let t=0;t0&&this._setContextModes(t,n)}onItemPop(t,n){var r,i;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(i=(r=this.treeAdapter).onItemPop)===null||i===void 0||i.call(r,t,this.openElements.current),n){let s,a;this.openElements.stackTop===0&&this.fragmentContext?(s=this.fragmentContext,a=this.fragmentContextID):{current:s,currentTagId:a}=this.openElements,this._setContextModes(s,a)}}_setContextModes(t,n){const r=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===pt.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&t!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,t)}_switchToTextParsing(t,n){this._insertElement(t,pt.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=fe.TEXT}switchToPlaintextParsing(){this.insertionMode=fe.TEXT,this.originalInsertionMode=fe.IN_BODY,this.tokenizer.state=_s.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)===je.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==pt.HTML))switch(this.fragmentContextID){case R.TITLE:case R.TEXTAREA:{this.tokenizer.state=_s.RCDATA;break}case R.STYLE:case R.XMP:case R.IFRAME:case R.NOEMBED:case R.NOFRAMES:case R.NOSCRIPT:{this.tokenizer.state=_s.RAWTEXT;break}case R.SCRIPT:{this.tokenizer.state=_s.SCRIPT_DATA;break}case R.PLAINTEXT:{this.tokenizer.state=_s.PLAINTEXT;break}}}_setDocumentType(t){const n=t.name||"",r=t.publicId||"",i=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,r,i),t.location){const a=this.treeAdapter.getChildNodes(this.document).find(l=>this.treeAdapter.isDocumentTypeNode(l));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,pt.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,n)}_insertTemplate(t){const n=this.treeAdapter.createElement(t.tagName,pt.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(je.HTML,pt.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,R.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 i=this.treeAdapter.getChildNodes(n),s=r?i.lastIndexOf(r):i.length,a=i[s-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,i=this.treeAdapter.getTagName(t),s=n.type===ar.END_TAG&&i===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,s)}}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===R.SVG&&this.treeAdapter.getTagName(n)===je.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===pt.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===R.MGLYPH||t.tagID===R.MALIGNMARK)&&r!==void 0&&!this._isIntegrationPoint(r,n,pt.HTML)}_processToken(t){switch(t.type){case ar.CHARACTER:{this.onCharacter(t);break}case ar.NULL_CHARACTER:{this.onNullCharacter(t);break}case ar.COMMENT:{this.onComment(t);break}case ar.DOCTYPE:{this.onDoctype(t);break}case ar.START_TAG:{this._processStartTag(t);break}case ar.END_TAG:{this.onEndTag(t);break}case ar.EOF:{this.onEof(t);break}case ar.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,r){const i=this.treeAdapter.getNamespaceURI(n),s=this.treeAdapter.getAttrList(n);return Rst(t,i,s,r)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(i=>i.type===Gu.Marker||this.openElements.contains(i.element)),r=n===-1?t-1:n-1;for(let i=r;i>=0;i--){const s=this.activeFormattingElements.entries[i];this._insertElement(s.token,this.treeAdapter.getNamespaceURI(s.element)),s.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=fe.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(R.P),this.openElements.popUntilTagNamePopped(R.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case R.TR:{this.insertionMode=fe.IN_ROW;return}case R.TBODY:case R.THEAD:case R.TFOOT:{this.insertionMode=fe.IN_TABLE_BODY;return}case R.CAPTION:{this.insertionMode=fe.IN_CAPTION;return}case R.COLGROUP:{this.insertionMode=fe.IN_COLUMN_GROUP;return}case R.TABLE:{this.insertionMode=fe.IN_TABLE;return}case R.BODY:{this.insertionMode=fe.IN_BODY;return}case R.FRAMESET:{this.insertionMode=fe.IN_FRAMESET;return}case R.SELECT:{this._resetInsertionModeForSelect(t);return}case R.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case R.HTML:{this.insertionMode=this.headElement?fe.AFTER_HEAD:fe.BEFORE_HEAD;return}case R.TD:case R.TH:{if(t>0){this.insertionMode=fe.IN_CELL;return}break}case R.HEAD:{if(t>0){this.insertionMode=fe.IN_HEAD;return}break}}this.insertionMode=fe.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let n=t-1;n>0;n--){const r=this.openElements.tagIDs[n];if(r===R.TEMPLATE)break;if(r===R.TABLE){this.insertionMode=fe.IN_SELECT_IN_TABLE;return}}this.insertionMode=fe.IN_SELECT}_isElementCausesFosterParenting(t){return lge.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 R.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===pt.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case R.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 nst[r].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){fot(this,t);return}switch(this.insertionMode){case fe.INITIAL:{cx(this,t);break}case fe.BEFORE_HTML:{Mv(this,t);break}case fe.BEFORE_HEAD:{Lv(this,t);break}case fe.IN_HEAD:{$v(this,t);break}case fe.IN_HEAD_NO_SCRIPT:{Bv(this,t);break}case fe.AFTER_HEAD:{Qv(this,t);break}case fe.IN_BODY:case fe.IN_CAPTION:case fe.IN_CELL:case fe.IN_TEMPLATE:{uge(this,t);break}case fe.TEXT:case fe.IN_SELECT:case fe.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case fe.IN_TABLE:case fe.IN_TABLE_BODY:case fe.IN_ROW:{gD(this,t);break}case fe.IN_TABLE_TEXT:{gge(this,t);break}case fe.IN_COLUMN_GROUP:{eA(this,t);break}case fe.AFTER_BODY:{tA(this,t);break}case fe.AFTER_AFTER_BODY:{cT(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){dot(this,t);return}switch(this.insertionMode){case fe.INITIAL:{cx(this,t);break}case fe.BEFORE_HTML:{Mv(this,t);break}case fe.BEFORE_HEAD:{Lv(this,t);break}case fe.IN_HEAD:{$v(this,t);break}case fe.IN_HEAD_NO_SCRIPT:{Bv(this,t);break}case fe.AFTER_HEAD:{Qv(this,t);break}case fe.TEXT:{this._insertCharacters(t);break}case fe.IN_TABLE:case fe.IN_TABLE_BODY:case fe.IN_ROW:{gD(this,t);break}case fe.IN_COLUMN_GROUP:{eA(this,t);break}case fe.AFTER_BODY:{tA(this,t);break}case fe.AFTER_AFTER_BODY:{cT(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){uL(this,t);return}switch(this.insertionMode){case fe.INITIAL:case fe.BEFORE_HTML:case fe.BEFORE_HEAD:case fe.IN_HEAD:case fe.IN_HEAD_NO_SCRIPT:case fe.AFTER_HEAD:case fe.IN_BODY:case fe.IN_TABLE:case fe.IN_CAPTION:case fe.IN_COLUMN_GROUP:case fe.IN_TABLE_BODY:case fe.IN_ROW:case fe.IN_CELL:case fe.IN_SELECT:case fe.IN_SELECT_IN_TABLE:case fe.IN_TEMPLATE:case fe.IN_FRAMESET:case fe.AFTER_FRAMESET:{uL(this,t);break}case fe.IN_TABLE_TEXT:{ux(this,t);break}case fe.AFTER_BODY:{zst(this,t);break}case fe.AFTER_AFTER_BODY:case fe.AFTER_AFTER_FRAMESET:{Vst(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case fe.INITIAL:{Hst(this,t);break}case fe.BEFORE_HEAD:case fe.IN_HEAD:case fe.IN_HEAD_NO_SCRIPT:case fe.AFTER_HEAD:{this._err(t,Ze.misplacedDoctype);break}case fe.IN_TABLE_TEXT:{ux(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,Ze.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?hot(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case fe.INITIAL:{cx(this,t);break}case fe.BEFORE_HTML:{qst(this,t);break}case fe.BEFORE_HEAD:{Gst(this,t);break}case fe.IN_HEAD:{Nu(this,t);break}case fe.IN_HEAD_NO_SCRIPT:{Zst(this,t);break}case fe.AFTER_HEAD:{Jst(this,t);break}case fe.IN_BODY:{eo(this,t);break}case fe.IN_TABLE:{m1(this,t);break}case fe.IN_TABLE_TEXT:{ux(this,t);break}case fe.IN_CAPTION:{Wat(this,t);break}case fe.IN_COLUMN_GROUP:{TB(this,t);break}case fe.IN_TABLE_BODY:{Ij(this,t);break}case fe.IN_ROW:{Dj(this,t);break}case fe.IN_CELL:{Kat(this,t);break}case fe.IN_SELECT:{Oge(this,t);break}case fe.IN_SELECT_IN_TABLE:{eot(this,t);break}case fe.IN_TEMPLATE:{not(this,t);break}case fe.AFTER_BODY:{iot(this,t);break}case fe.IN_FRAMESET:{sot(this,t);break}case fe.AFTER_FRAMESET:{oot(this,t);break}case fe.AFTER_AFTER_BODY:{cot(this,t);break}case fe.AFTER_AFTER_FRAMESET:{uot(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?pot(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case fe.INITIAL:{cx(this,t);break}case fe.BEFORE_HTML:{Xst(this,t);break}case fe.BEFORE_HEAD:{Wst(this,t);break}case fe.IN_HEAD:{Yst(this,t);break}case fe.IN_HEAD_NO_SCRIPT:{Kst(this,t);break}case fe.AFTER_HEAD:{eat(this,t);break}case fe.IN_BODY:{Rj(this,t);break}case fe.TEXT:{Bat(this,t);break}case fe.IN_TABLE:{Ww(this,t);break}case fe.IN_TABLE_TEXT:{ux(this,t);break}case fe.IN_CAPTION:{Yat(this,t);break}case fe.IN_COLUMN_GROUP:{Zat(this,t);break}case fe.IN_TABLE_BODY:{dL(this,t);break}case fe.IN_ROW:{yge(this,t);break}case fe.IN_CELL:{Jat(this,t);break}case fe.IN_SELECT:{xge(this,t);break}case fe.IN_SELECT_IN_TABLE:{tot(this,t);break}case fe.IN_TEMPLATE:{rot(this,t);break}case fe.AFTER_BODY:{wge(this,t);break}case fe.IN_FRAMESET:{aot(this,t);break}case fe.AFTER_FRAMESET:{lot(this,t);break}case fe.AFTER_AFTER_BODY:{cT(this,t);break}}}onEof(t){switch(this.insertionMode){case fe.INITIAL:{cx(this,t);break}case fe.BEFORE_HTML:{Mv(this,t);break}case fe.BEFORE_HEAD:{Lv(this,t);break}case fe.IN_HEAD:{$v(this,t);break}case fe.IN_HEAD_NO_SCRIPT:{Bv(this,t);break}case fe.AFTER_HEAD:{Qv(this,t);break}case fe.IN_BODY:case fe.IN_TABLE:case fe.IN_CAPTION:case fe.IN_COLUMN_GROUP:case fe.IN_TABLE_BODY:case fe.IN_ROW:case fe.IN_CELL:case fe.IN_SELECT:case fe.IN_SELECT_IN_TABLE:{pge(this,t);break}case fe.TEXT:{Qat(this,t);break}case fe.IN_TABLE_TEXT:{ux(this,t);break}case fe.IN_TEMPLATE:{vge(this,t);break}case fe.AFTER_BODY:case fe.IN_FRAMESET:case fe.AFTER_FRAMESET:case fe.AFTER_AFTER_BODY:case fe.AFTER_AFTER_FRAMESET:{_B(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===te.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 fe.IN_HEAD:case fe.IN_HEAD_NO_SCRIPT:case fe.AFTER_HEAD:case fe.TEXT:case fe.IN_COLUMN_GROUP:case fe.IN_SELECT:case fe.IN_SELECT_IN_TABLE:case fe.IN_FRAMESET:case fe.AFTER_FRAMESET:{this._insertCharacters(t);break}case fe.IN_BODY:case fe.IN_CAPTION:case fe.IN_CELL:case fe.IN_TEMPLATE:case fe.AFTER_BODY:case fe.AFTER_AFTER_BODY:case fe.AFTER_AFTER_FRAMESET:{cge(this,t);break}case fe.IN_TABLE:case fe.IN_TABLE_BODY:case fe.IN_ROW:{gD(this,t);break}case fe.IN_TABLE_TEXT:{mge(this,t);break}}}};function Lst(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):hge(e,t),n}function $st(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){const i=e.openElements.items[r];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[r])&&(n=i)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function Bst(e,t,n){let r=t,i=e.openElements.getCommonAncestor(t);for(let s=0,a=i;a!==n;s++,a=i){i=e.openElements.getCommonAncestor(a);const l=e.activeFormattingElements.getElementEntry(a),c=l&&s>=Pst;!l||c?(c&&e.activeFormattingElements.removeEntry(l),e.openElements.remove(a)):(a=Qst(e,l),r===t&&(e.activeFormattingElements.bookmark=l),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(a,r),r=a)}return r}function Qst(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 Ust(e,t,n){const r=e.treeAdapter.getTagName(t),i=uO(r);if(e._isElementCausesFosterParenting(i))e._fosterParentElement(n);else{const s=e.treeAdapter.getNamespaceURI(t);i===R.TEMPLATE&&s===pt.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function Fst(e,t,n){const r=e.treeAdapter.getNamespaceURI(n.element),{token:i}=n,s=e.treeAdapter.createElement(i.tagName,r,i.attrs);e._adoptNodes(t,s),e.treeAdapter.appendChild(t,s),e.activeFormattingElements.insertElementAfterBookmark(s,i),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,s,i.tagID)}function kB(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],i=e.treeAdapter.getNodeSourceCodeLocation(r);if(i&&!i.endTag&&(e._setEndLocation(r,t),e.openElements.stackTop>=1)){const s=e.openElements.items[1],a=e.treeAdapter.getNodeSourceCodeLocation(s);a&&!a.endTag&&e._setEndLocation(s,t)}}}}function Hst(e,t){e._setDocumentType(t);const n=t.forceQuirks?vc.QUIRKS:vst(t);xst(t)||e._err(t,Ze.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=fe.BEFORE_HTML}function cx(e,t){e._err(t,Ze.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,vc.QUIRKS),e.insertionMode=fe.BEFORE_HTML,e._processToken(t)}function qst(e,t){t.tagID===R.HTML?(e._insertElement(t,pt.HTML),e.insertionMode=fe.BEFORE_HEAD):Mv(e,t)}function Xst(e,t){const n=t.tagID;(n===R.HTML||n===R.HEAD||n===R.BODY||n===R.BR)&&Mv(e,t)}function Mv(e,t){e._insertFakeRootElement(),e.insertionMode=fe.BEFORE_HEAD,e._processToken(t)}function Gst(e,t){switch(t.tagID){case R.HTML:{eo(e,t);break}case R.HEAD:{e._insertElement(t,pt.HTML),e.headElement=e.openElements.current,e.insertionMode=fe.IN_HEAD;break}default:Lv(e,t)}}function Wst(e,t){const n=t.tagID;n===R.HEAD||n===R.BODY||n===R.HTML||n===R.BR?Lv(e,t):e._err(t,Ze.endTagWithoutMatchingOpenElement)}function Lv(e,t){e._insertFakeElement(je.HEAD,R.HEAD),e.headElement=e.openElements.current,e.insertionMode=fe.IN_HEAD,e._processToken(t)}function Nu(e,t){switch(t.tagID){case R.HTML:{eo(e,t);break}case R.BASE:case R.BASEFONT:case R.BGSOUND:case R.LINK:case R.META:{e._appendElement(t,pt.HTML),t.ackSelfClosing=!0;break}case R.TITLE:{e._switchToTextParsing(t,_s.RCDATA);break}case R.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,_s.RAWTEXT):(e._insertElement(t,pt.HTML),e.insertionMode=fe.IN_HEAD_NO_SCRIPT);break}case R.NOFRAMES:case R.STYLE:{e._switchToTextParsing(t,_s.RAWTEXT);break}case R.SCRIPT:{e._switchToTextParsing(t,_s.SCRIPT_DATA);break}case R.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=fe.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(fe.IN_TEMPLATE);break}case R.HEAD:{e._err(t,Ze.misplacedStartTagForHeadElement);break}default:$v(e,t)}}function Yst(e,t){switch(t.tagID){case R.HEAD:{e.openElements.pop(),e.insertionMode=fe.AFTER_HEAD;break}case R.BODY:case R.BR:case R.HTML:{$v(e,t);break}case R.TEMPLATE:{w0(e,t);break}default:e._err(t,Ze.endTagWithoutMatchingOpenElement)}}function w0(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==R.TEMPLATE&&e._err(t,Ze.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(R.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,Ze.endTagWithoutMatchingOpenElement)}function $v(e,t){e.openElements.pop(),e.insertionMode=fe.AFTER_HEAD,e._processToken(t)}function Zst(e,t){switch(t.tagID){case R.HTML:{eo(e,t);break}case R.BASEFONT:case R.BGSOUND:case R.HEAD:case R.LINK:case R.META:case R.NOFRAMES:case R.STYLE:{Nu(e,t);break}case R.NOSCRIPT:{e._err(t,Ze.nestedNoscriptInHead);break}default:Bv(e,t)}}function Kst(e,t){switch(t.tagID){case R.NOSCRIPT:{e.openElements.pop(),e.insertionMode=fe.IN_HEAD;break}case R.BR:{Bv(e,t);break}default:e._err(t,Ze.endTagWithoutMatchingOpenElement)}}function Bv(e,t){const n=t.type===ar.EOF?Ze.openElementsLeftAfterEof:Ze.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=fe.IN_HEAD,e._processToken(t)}function Jst(e,t){switch(t.tagID){case R.HTML:{eo(e,t);break}case R.BODY:{e._insertElement(t,pt.HTML),e.framesetOk=!1,e.insertionMode=fe.IN_BODY;break}case R.FRAMESET:{e._insertElement(t,pt.HTML),e.insertionMode=fe.IN_FRAMESET;break}case R.BASE:case R.BASEFONT:case R.BGSOUND:case R.LINK:case R.META:case R.NOFRAMES:case R.SCRIPT:case R.STYLE:case R.TEMPLATE:case R.TITLE:{e._err(t,Ze.abandonedHeadElementChild),e.openElements.push(e.headElement,R.HEAD),Nu(e,t),e.openElements.remove(e.headElement);break}case R.HEAD:{e._err(t,Ze.misplacedStartTagForHeadElement);break}default:Qv(e,t)}}function eat(e,t){switch(t.tagID){case R.BODY:case R.HTML:case R.BR:{Qv(e,t);break}case R.TEMPLATE:{w0(e,t);break}default:e._err(t,Ze.endTagWithoutMatchingOpenElement)}}function Qv(e,t){e._insertFakeElement(je.BODY,R.BODY),e.insertionMode=fe.IN_BODY,jj(e,t)}function jj(e,t){switch(t.type){case ar.CHARACTER:{uge(e,t);break}case ar.WHITESPACE_CHARACTER:{cge(e,t);break}case ar.COMMENT:{uL(e,t);break}case ar.START_TAG:{eo(e,t);break}case ar.END_TAG:{Rj(e,t);break}case ar.EOF:{pge(e,t);break}}}function cge(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function uge(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function tat(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function nat(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function rat(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,pt.HTML),e.insertionMode=fe.IN_FRAMESET)}function iat(e,t){e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._insertElement(t,pt.HTML)}function sat(e,t){e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&cL.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,pt.HTML)}function aat(e,t){e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._insertElement(t,pt.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function oat(e,t){const n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._insertElement(t,pt.HTML),n||(e.formElement=e.openElements.current))}function lat(e,t){e.framesetOk=!1;const n=t.tagID;for(let r=e.openElements.stackTop;r>=0;r--){const i=e.openElements.tagIDs[r];if(n===R.LI&&i===R.LI||(n===R.DD||n===R.DT)&&(i===R.DD||i===R.DT)){e.openElements.generateImpliedEndTagsWithExclusion(i),e.openElements.popUntilTagNamePopped(i);break}if(i!==R.ADDRESS&&i!==R.DIV&&i!==R.P&&e._isSpecialElement(e.openElements.items[r],i))break}e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._insertElement(t,pt.HTML)}function cat(e,t){e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._insertElement(t,pt.HTML),e.tokenizer.state=_s.PLAINTEXT}function uat(e,t){e.openElements.hasInScope(R.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(R.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,pt.HTML),e.framesetOk=!1}function dat(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(je.A);n&&(kB(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,pt.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function fat(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,pt.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function hat(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(R.NOBR)&&(kB(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,pt.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function pat(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,pt.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function mat(e,t){e.treeAdapter.getDocumentMode(e.document)!==vc.QUIRKS&&e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._insertElement(t,pt.HTML),e.framesetOk=!1,e.insertionMode=fe.IN_TABLE}function dge(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,pt.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function fge(e){const t=ege(e,Eg.TYPE);return t!=null&&t.toLowerCase()===Ist}function gat(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,pt.HTML),fge(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function bat(e,t){e._appendElement(t,pt.HTML),t.ackSelfClosing=!0}function yat(e,t){e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._appendElement(t,pt.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function Oat(e,t){t.tagName=je.IMG,t.tagID=R.IMG,dge(e,t)}function xat(e,t){e._insertElement(t,pt.HTML),e.skipNextNewLine=!0,e.tokenizer.state=_s.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=fe.TEXT}function vat(e,t){e.openElements.hasInButtonScope(R.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,_s.RAWTEXT)}function wat(e,t){e.framesetOk=!1,e._switchToTextParsing(t,_s.RAWTEXT)}function CW(e,t){e._switchToTextParsing(t,_s.RAWTEXT)}function Sat(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,pt.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===fe.IN_TABLE||e.insertionMode===fe.IN_CAPTION||e.insertionMode===fe.IN_TABLE_BODY||e.insertionMode===fe.IN_ROW||e.insertionMode===fe.IN_CELL?fe.IN_SELECT_IN_TABLE:fe.IN_SELECT}function Eat(e,t){e.openElements.currentTagId===R.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,pt.HTML)}function kat(e,t){e.openElements.hasInScope(R.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,pt.HTML)}function _at(e,t){e.openElements.hasInScope(R.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(R.RTC),e._insertElement(t,pt.HTML)}function Tat(e,t){e._reconstructActiveFormattingElements(),age(t),EB(t),t.selfClosing?e._appendElement(t,pt.MATHML):e._insertElement(t,pt.MATHML),t.ackSelfClosing=!0}function Cat(e,t){e._reconstructActiveFormattingElements(),oge(t),EB(t),t.selfClosing?e._appendElement(t,pt.SVG):e._insertElement(t,pt.SVG),t.ackSelfClosing=!0}function AW(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,pt.HTML)}function eo(e,t){switch(t.tagID){case R.I:case R.S:case R.B:case R.U:case R.EM:case R.TT:case R.BIG:case R.CODE:case R.FONT:case R.SMALL:case R.STRIKE:case R.STRONG:{fat(e,t);break}case R.A:{dat(e,t);break}case R.H1:case R.H2:case R.H3:case R.H4:case R.H5:case R.H6:{sat(e,t);break}case R.P:case R.DL:case R.OL:case R.UL:case R.DIV:case R.DIR:case R.NAV:case R.MAIN:case R.MENU:case R.ASIDE:case R.CENTER:case R.FIGURE:case R.FOOTER:case R.HEADER:case R.HGROUP:case R.DIALOG:case R.DETAILS:case R.ADDRESS:case R.ARTICLE:case R.SEARCH:case R.SECTION:case R.SUMMARY:case R.FIELDSET:case R.BLOCKQUOTE:case R.FIGCAPTION:{iat(e,t);break}case R.LI:case R.DD:case R.DT:{lat(e,t);break}case R.BR:case R.IMG:case R.WBR:case R.AREA:case R.EMBED:case R.KEYGEN:{dge(e,t);break}case R.HR:{yat(e,t);break}case R.RB:case R.RTC:{kat(e,t);break}case R.RT:case R.RP:{_at(e,t);break}case R.PRE:case R.LISTING:{aat(e,t);break}case R.XMP:{vat(e,t);break}case R.SVG:{Cat(e,t);break}case R.HTML:{tat(e,t);break}case R.BASE:case R.LINK:case R.META:case R.STYLE:case R.TITLE:case R.SCRIPT:case R.BGSOUND:case R.BASEFONT:case R.TEMPLATE:{Nu(e,t);break}case R.BODY:{nat(e,t);break}case R.FORM:{oat(e,t);break}case R.NOBR:{hat(e,t);break}case R.MATH:{Tat(e,t);break}case R.TABLE:{mat(e,t);break}case R.INPUT:{gat(e,t);break}case R.PARAM:case R.TRACK:case R.SOURCE:{bat(e,t);break}case R.IMAGE:{Oat(e,t);break}case R.BUTTON:{uat(e,t);break}case R.APPLET:case R.OBJECT:case R.MARQUEE:{pat(e,t);break}case R.IFRAME:{wat(e,t);break}case R.SELECT:{Sat(e,t);break}case R.OPTION:case R.OPTGROUP:{Eat(e,t);break}case R.NOEMBED:case R.NOFRAMES:{CW(e,t);break}case R.FRAMESET:{rat(e,t);break}case R.TEXTAREA:{xat(e,t);break}case R.NOSCRIPT:{e.options.scriptingEnabled?CW(e,t):AW(e,t);break}case R.PLAINTEXT:{cat(e,t);break}case R.COL:case R.TH:case R.TD:case R.TR:case R.HEAD:case R.FRAME:case R.TBODY:case R.TFOOT:case R.THEAD:case R.CAPTION:case R.COLGROUP:break;default:AW(e,t)}}function Aat(e,t){if(e.openElements.hasInScope(R.BODY)&&(e.insertionMode=fe.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function Nat(e,t){e.openElements.hasInScope(R.BODY)&&(e.insertionMode=fe.AFTER_BODY,wge(e,t))}function jat(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function Rat(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(R.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(R.FORM):n&&e.openElements.remove(n))}function Iat(e){e.openElements.hasInButtonScope(R.P)||e._insertFakeElement(je.P,R.P),e._closePElement()}function Dat(e){e.openElements.hasInListItemScope(R.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(R.LI),e.openElements.popUntilTagNamePopped(R.LI))}function Pat(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function Mat(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function Lat(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function $at(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(je.BR,R.BR),e.openElements.pop(),e.framesetOk=!1}function hge(e,t){const n=t.tagName,r=t.tagID;for(let i=e.openElements.stackTop;i>0;i--){const s=e.openElements.items[i],a=e.openElements.tagIDs[i];if(r===a&&(r!==R.UNKNOWN||e.treeAdapter.getTagName(s)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=i&&e.openElements.shortenToLength(i);break}if(e._isSpecialElement(s,a))break}}function Rj(e,t){switch(t.tagID){case R.A:case R.B:case R.I:case R.S:case R.U:case R.EM:case R.TT:case R.BIG:case R.CODE:case R.FONT:case R.NOBR:case R.SMALL:case R.STRIKE:case R.STRONG:{kB(e,t);break}case R.P:{Iat(e);break}case R.DL:case R.UL:case R.OL:case R.DIR:case R.DIV:case R.NAV:case R.PRE:case R.MAIN:case R.MENU:case R.ASIDE:case R.BUTTON:case R.CENTER:case R.FIGURE:case R.FOOTER:case R.HEADER:case R.HGROUP:case R.DIALOG:case R.ADDRESS:case R.ARTICLE:case R.DETAILS:case R.SEARCH:case R.SECTION:case R.SUMMARY:case R.LISTING:case R.FIELDSET:case R.BLOCKQUOTE:case R.FIGCAPTION:{jat(e,t);break}case R.LI:{Dat(e);break}case R.DD:case R.DT:{Pat(e,t);break}case R.H1:case R.H2:case R.H3:case R.H4:case R.H5:case R.H6:{Mat(e);break}case R.BR:{$at(e);break}case R.BODY:{Aat(e,t);break}case R.HTML:{Nat(e,t);break}case R.FORM:{Rat(e);break}case R.APPLET:case R.OBJECT:case R.MARQUEE:{Lat(e,t);break}case R.TEMPLATE:{w0(e,t);break}default:hge(e,t)}}function pge(e,t){e.tmplInsertionModeStack.length>0?vge(e,t):_B(e,t)}function Bat(e,t){var n;t.tagID===R.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function Qat(e,t){e._err(t,Ze.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function gD(e,t){if(e.openElements.currentTagId!==void 0&&lge.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=fe.IN_TABLE_TEXT,t.type){case ar.CHARACTER:{gge(e,t);break}case ar.WHITESPACE_CHARACTER:{mge(e,t);break}}else _E(e,t)}function Uat(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,pt.HTML),e.insertionMode=fe.IN_CAPTION}function Fat(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,pt.HTML),e.insertionMode=fe.IN_COLUMN_GROUP}function zat(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(je.COLGROUP,R.COLGROUP),e.insertionMode=fe.IN_COLUMN_GROUP,TB(e,t)}function Vat(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,pt.HTML),e.insertionMode=fe.IN_TABLE_BODY}function Hat(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(je.TBODY,R.TBODY),e.insertionMode=fe.IN_TABLE_BODY,Ij(e,t)}function qat(e,t){e.openElements.hasInTableScope(R.TABLE)&&(e.openElements.popUntilTagNamePopped(R.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function Xat(e,t){fge(t)?e._appendElement(t,pt.HTML):_E(e,t),t.ackSelfClosing=!0}function Gat(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,pt.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function m1(e,t){switch(t.tagID){case R.TD:case R.TH:case R.TR:{Hat(e,t);break}case R.STYLE:case R.SCRIPT:case R.TEMPLATE:{Nu(e,t);break}case R.COL:{zat(e,t);break}case R.FORM:{Gat(e,t);break}case R.TABLE:{qat(e,t);break}case R.TBODY:case R.TFOOT:case R.THEAD:{Vat(e,t);break}case R.INPUT:{Xat(e,t);break}case R.CAPTION:{Uat(e,t);break}case R.COLGROUP:{Fat(e,t);break}default:_E(e,t)}}function Ww(e,t){switch(t.tagID){case R.TABLE:{e.openElements.hasInTableScope(R.TABLE)&&(e.openElements.popUntilTagNamePopped(R.TABLE),e._resetInsertionMode());break}case R.TEMPLATE:{w0(e,t);break}case R.BODY:case R.CAPTION:case R.COL:case R.COLGROUP:case R.HTML:case R.TBODY:case R.TD:case R.TFOOT:case R.TH:case R.THEAD:case R.TR:break;default:_E(e,t)}}function _E(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,jj(e,t),e.fosterParentingEnabled=n}function mge(e,t){e.pendingCharacterTokens.push(t)}function gge(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function ux(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n0&&e.openElements.currentTagId===R.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===R.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===R.OPTGROUP&&e.openElements.pop();break}case R.OPTION:{e.openElements.currentTagId===R.OPTION&&e.openElements.pop();break}case R.SELECT:{e.openElements.hasInSelectScope(R.SELECT)&&(e.openElements.popUntilTagNamePopped(R.SELECT),e._resetInsertionMode());break}case R.TEMPLATE:{w0(e,t);break}}}function eot(e,t){const n=t.tagID;n===R.CAPTION||n===R.TABLE||n===R.TBODY||n===R.TFOOT||n===R.THEAD||n===R.TR||n===R.TD||n===R.TH?(e.openElements.popUntilTagNamePopped(R.SELECT),e._resetInsertionMode(),e._processStartTag(t)):Oge(e,t)}function tot(e,t){const n=t.tagID;n===R.CAPTION||n===R.TABLE||n===R.TBODY||n===R.TFOOT||n===R.THEAD||n===R.TR||n===R.TD||n===R.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(R.SELECT),e._resetInsertionMode(),e.onEndTag(t)):xge(e,t)}function not(e,t){switch(t.tagID){case R.BASE:case R.BASEFONT:case R.BGSOUND:case R.LINK:case R.META:case R.NOFRAMES:case R.SCRIPT:case R.STYLE:case R.TEMPLATE:case R.TITLE:{Nu(e,t);break}case R.CAPTION:case R.COLGROUP:case R.TBODY:case R.TFOOT:case R.THEAD:{e.tmplInsertionModeStack[0]=fe.IN_TABLE,e.insertionMode=fe.IN_TABLE,m1(e,t);break}case R.COL:{e.tmplInsertionModeStack[0]=fe.IN_COLUMN_GROUP,e.insertionMode=fe.IN_COLUMN_GROUP,TB(e,t);break}case R.TR:{e.tmplInsertionModeStack[0]=fe.IN_TABLE_BODY,e.insertionMode=fe.IN_TABLE_BODY,Ij(e,t);break}case R.TD:case R.TH:{e.tmplInsertionModeStack[0]=fe.IN_ROW,e.insertionMode=fe.IN_ROW,Dj(e,t);break}default:e.tmplInsertionModeStack[0]=fe.IN_BODY,e.insertionMode=fe.IN_BODY,eo(e,t)}}function rot(e,t){t.tagID===R.TEMPLATE&&w0(e,t)}function vge(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(R.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):_B(e,t)}function iot(e,t){t.tagID===R.HTML?eo(e,t):tA(e,t)}function wge(e,t){var n;if(t.tagID===R.HTML){if(e.fragmentContext||(e.insertionMode=fe.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===R.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 tA(e,t)}function tA(e,t){e.insertionMode=fe.IN_BODY,jj(e,t)}function sot(e,t){switch(t.tagID){case R.HTML:{eo(e,t);break}case R.FRAMESET:{e._insertElement(t,pt.HTML);break}case R.FRAME:{e._appendElement(t,pt.HTML),t.ackSelfClosing=!0;break}case R.NOFRAMES:{Nu(e,t);break}}}function aot(e,t){t.tagID===R.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==R.FRAMESET&&(e.insertionMode=fe.AFTER_FRAMESET))}function oot(e,t){switch(t.tagID){case R.HTML:{eo(e,t);break}case R.NOFRAMES:{Nu(e,t);break}}}function lot(e,t){t.tagID===R.HTML&&(e.insertionMode=fe.AFTER_AFTER_FRAMESET)}function cot(e,t){t.tagID===R.HTML?eo(e,t):cT(e,t)}function cT(e,t){e.insertionMode=fe.IN_BODY,jj(e,t)}function uot(e,t){switch(t.tagID){case R.HTML:{eo(e,t);break}case R.NOFRAMES:{Nu(e,t);break}}}function dot(e,t){t.chars=qi,e._insertCharacters(t)}function fot(e,t){e._insertCharacters(t),e.framesetOk=!1}function Sge(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==pt.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function hot(e,t){if(Cst(t))Sge(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===pt.MATHML?age(t):r===pt.SVG&&(Ast(t),oge(t)),EB(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function pot(e,t){if(t.tagID===R.P||t.tagID===R.BR){Sge(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)===pt.HTML){e._endTagOutsideForeignContent(t);break}const i=e.treeAdapter.getTagName(r);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}je.AREA,je.BASE,je.BASEFONT,je.BGSOUND,je.BR,je.COL,je.EMBED,je.FRAME,je.HR,je.IMG,je.INPUT,je.KEYGEN,je.LINK,je.META,je.PARAM,je.SOURCE,je.TRACK,je.WBR;const mot=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,got=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),NW={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function Ege(e,t){const n=_ot(e),r=Qpe("type",{handlers:{root:bot,element:yot,text:Oot,comment:_ge,doctype:xot,raw:wot},unknown:Sot}),i={parser:n?new TW(NW):TW.getFragmentParser(void 0,NW),handle(l){r(l,i)},stitches:!1,options:t||{}};r(e,i),dO(i,Ad());const s=n?i.parser.document:i.parser.getFragment(),a=Tit(s,{file:i.options.file});return i.stitches&&EE(a,"comment",function(l,c,u){const d=l;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 kge(e,t){let n=-1;if(e)for(;++n4&&(t.parser.tokenizer.state=0);const n={type:ar.CHARACTER,chars:e.value,location:TE(e)};dO(t,Ad(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function xot(e,t){const n={type:ar.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:TE(e)};dO(t,Ad(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function vot(e,t){t.stitches=!0;const n=Tot(e);if("children"in e&&"children"in n){const r=Ege({type:"root",children:e.children},t.options);n.children=r.children}_ge({type:"comment",value:{stitch:n}},t)}function _ge(e,t){const n=e.value,r={type:ar.COMMENT,data:n,location:TE(e)};dO(t,Ad(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function wot(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,Tge(t,Ad(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(mot,"<$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 Sot(e,t){const n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))vot(n,t);else{let r="";throw got.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 dO(e,t){Tge(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=_s.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 Tge(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 Eot(e,t){const n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===_s.PLAINTEXT)return;dO(t,Ad(e));const r=t.parser.openElements.current;let i="namespaceURI"in r?r.namespaceURI:ag.html;i===ag.html&&n==="svg"&&(i=ag.svg);const s=Rit({...e,children:[]},{space:i===ag.svg?"svg":"html"}),a={type:ar.START_TAG,tagName:n,tagID:uO(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in s?s.attrs:[],location:TE(e)};t.parser.currentToken=a,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function kot(e,t){const n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&Qit.includes(n)||t.parser.tokenizer.state===_s.PLAINTEXT)return;dO(t,kj(e));const r={type:ar.END_TAG,tagName:n,tagID:uO(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:TE(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===_s.RCDATA||t.parser.tokenizer.state===_s.RAWTEXT||t.parser.tokenizer.state===_s.SCRIPT_DATA)&&(t.parser.tokenizer.state=_s.DATA)}function _ot(e){const t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function TE(e){const t=Ad(e)||{line:void 0,column:void 0,offset:void 0},n=kj(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 Tot(e){return"children"in e?h1({...e,children:[]}):h1(e)}function Cot(e){return function(t,n){return Ege(t,{...e,file:n})}}const Aot="modulepreload",Not=function(e){return"/"+e},jW={},hd=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=Promise.allSettled(n.map(c=>{if(c=Not(c),c in jW)return;jW[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":Aot,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((h,m)=>{f.addEventListener("load",h),f.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return i.then(a=>{for(const l of a||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})};var jot=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,Rot=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,Iot=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,bD={Space_Separator:jot,ID_Start:Rot,ID_Continue:Iot},ws={isSpaceSeparator(e){return typeof e=="string"&&bD.Space_Separator.test(e)},isIdStartChar(e){return typeof e=="string"&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="$"||e==="_"||bD.ID_Start.test(e))},isIdContinueChar(e){return typeof e=="string"&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||e==="$"||e==="_"||e==="‌"||e==="‍"||bD.ID_Continue.test(e))},isDigit(e){return typeof e=="string"&&/[0-9]/.test(e)},isHexDigit(e){return typeof e=="string"&&/[0-9A-Fa-f]/.test(e)}};let fL,Oo,Of,nA,Wp,yu,ia,CB,Uv;var Dot=function(t,n){fL=String(t),Oo="start",Of=[],nA=0,Wp=1,yu=0,ia=void 0,CB=void 0,Uv=void 0;do ia=Pot(),$ot[Oo]();while(ia.type!=="eof");return typeof n=="function"?hL({"":Uv},"",n):Uv};function hL(e,t,n){const r=e[t];if(r!=null&&typeof r=="object")if(Array.isArray(r))for(let i=0;i0;){const n=Bf();if(!ws.isHexDigit(n))throw Mi(dt());e+=dt()}return String.fromCodePoint(parseInt(e,16))}const $ot={start(){if(ia.type==="eof")throw Am();yD()},beforePropertyName(){switch(ia.type){case"identifier":case"string":CB=ia.value,Oo="afterPropertyName";return;case"punctuator":T2();return;case"eof":throw Am()}},afterPropertyName(){if(ia.type==="eof")throw Am();Oo="beforePropertyValue"},beforePropertyValue(){if(ia.type==="eof")throw Am();yD()},beforeArrayValue(){if(ia.type==="eof")throw Am();if(ia.type==="punctuator"&&ia.value==="]"){T2();return}yD()},afterPropertyValue(){if(ia.type==="eof")throw Am();switch(ia.value){case",":Oo="beforePropertyName";return;case"}":T2()}},afterArrayValue(){if(ia.type==="eof")throw Am();switch(ia.value){case",":Oo="beforeArrayValue";return;case"]":T2()}},end(){}};function yD(){let e;switch(ia.type){case"punctuator":switch(ia.value){case"{":e={};break;case"[":e=[];break}break;case"null":case"boolean":case"numeric":case"string":e=ia.value;break}if(Uv===void 0)Uv=e;else{const t=Of[Of.length-1];Array.isArray(t)?t.push(e):Object.defineProperty(t,CB,{value:e,writable:!0,enumerable:!0,configurable:!0})}if(e!==null&&typeof e=="object")Of.push(e),Array.isArray(e)?Oo="beforeArrayValue":Oo="beforePropertyName";else{const t=Of[Of.length-1];t==null?Oo="end":Array.isArray(t)?Oo="afterArrayValue":Oo="afterPropertyValue"}}function T2(){Of.pop();const e=Of[Of.length-1];e==null?Oo="end":Array.isArray(e)?Oo="afterArrayValue":Oo="afterPropertyValue"}function Mi(e){return rA(e===void 0?`JSON5: invalid end of input at ${Wp}:${yu}`:`JSON5: invalid character '${Age(e)}' at ${Wp}:${yu}`)}function Am(){return rA(`JSON5: invalid end of input at ${Wp}:${yu}`)}function RW(){return yu-=5,rA(`JSON5: invalid identifier character at ${Wp}:${yu}`)}function Bot(e){console.warn(`JSON5: '${Age(e)}' in strings is not valid ECMAScript; consider escaping`)}function Age(e){const t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){const n=e.charCodeAt(0).toString(16);return"\\x"+("00"+n).substring(n.length)}return e}function rA(e){const t=new SyntaxError(e);return t.lineNumber=Wp,t.columnNumber=yu,t}var Qot=function(t,n,r){const i=[];let s="",a,l,c="",u;if(n!=null&&typeof n=="object"&&!Array.isArray(n)&&(r=n.space,u=n.quote,n=n.replacer),typeof n=="function")l=n;else if(Array.isArray(n)){a=[];for(const b of n){let y;typeof b=="string"?y=b:(typeof b=="number"||b instanceof String||b instanceof Number)&&(y=String(b)),y!==void 0&&a.indexOf(y)<0&&a.push(y)}}return r instanceof Number?r=Number(r):r instanceof String&&(r=String(r)),typeof r=="number"?r>0&&(r=Math.min(10,Math.floor(r)),c=" ".substr(0,r)):typeof r=="string"&&(c=r.substr(0,10)),d("",{"":t});function d(b,y){let O=y[b];switch(O!=null&&(typeof O.toJSON5=="function"?O=O.toJSON5(b):typeof O.toJSON=="function"&&(O=O.toJSON(b))),l&&(O=l.call(y,b,O)),O instanceof Number?O=Number(O):O instanceof String?O=String(O):O instanceof Boolean&&(O=O.valueOf()),O){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof O=="string")return f(O);if(typeof O=="number")return String(O);if(typeof O=="object")return Array.isArray(O)?g(O):h(O)}function f(b){const y={"'":.1,'"':.2},O={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};let v="";for(let w=0;wy[w]=0)throw TypeError("Converting circular structure to JSON5");i.push(b);let y=s;s=s+c;let O=a||Object.keys(b),v=[];for(const w of O){const S=d(w,b);if(S!==void 0){let E=m(w)+":";c!==""&&(E+=" "),E+=S,v.push(E)}}let x;if(v.length===0)x="{}";else{let w;if(c==="")w=v.join(","),x="{"+w+"}";else{let S=`, `+s;w=v.join(S),x=`{ `+s+w+`, `+y+"}"}}return i.pop(),s=y,x}function m(b){if(b.length===0)return f(b);const y=String.fromCodePoint(b.codePointAt(0));if(!ws.isIdStartChar(y))return f(b);for(let O=y.length;O=0)throw TypeError("Converting circular structure to JSON5");i.push(b);let y=s;s=s+c;let O=[];for(let x=0;x30)throw new Error("ECharts option nesting is too deep");if(typeof e=="number"&&!Number.isFinite(e))throw new Error("ECharts option contains a non-finite number");if(typeof e=="string"&&Hot.test(e.trim()))throw new Error("ECharts option contains an external resource");if(Array.isArray(e)){for(const n of e)iA(n,t+1);return}if(Wx(e))for(const[n,r]of Object.entries(e)){if(Vot.has(n))throw new Error("ECharts option contains an unsafe key");iA(r,t+1)}}function qot(e){var r;const t=e.trim(),n=t.match(/^(?:(?:const|let|var)\s+)?option\s*=\s*([\s\S]*?)\s*;?$/);return((r=n==null?void 0:n[1])==null?void 0:r.trim())||t}function Xot(e,t){let n=1,r="",i=!1,s=!1,a=!1;for(let l=t+1;lr+2)throw new Error("Invalid ECharts gradient argument count");const i=n.slice(0,r).map(Got),s=n[r],a=n[r+1]??!1;if(!Array.isArray(s)||typeof a!="boolean")throw new Error("Invalid ECharts gradient data");return e==="linear"?{type:e,x:i[0],y:i[1],x2:i[2],y2:i[3],colorStops:s,global:a}:{type:e,x:i[0],y:i[1],r:i[2],colorStops:s,global:a}}function Yot(e,t){const n=/^(?:new\s+)?echarts\.graphic\.(LinearGradient|RadialGradient)\s*\(/;let r="",i=!1,s=!1,a=!1;for(let l=t;lzot)throw new Error("ECharts option is too large");const n=Zot(qot(e));let r;try{r=Nge.parse(n)}catch(a){throw/\bfunction\s*\(|=>/.test(n)?new Error("ECharts function callbacks are not supported"):a}if(!Wx(r))throw new Error("ECharts option must be a data object");iA(r);const i={...r};i.aria={...Wx(i.aria)?i.aria:{},enabled:!0};const s=i.tooltip;return Wx(s)?i.tooltip={...s,renderMode:"richText"}:Array.isArray(s)&&(i.tooltip=s.map(a=>Wx(a)?{...a,renderMode:"richText"}:a)),t&&(i.animation=!1),i}let OD;function Jot(){return OD??(OD=dd(()=>import("../visualizations/echarts/index-CGT341lL.js"),[]).catch(e=>{throw OD=void 0,e})),OD}function elt({source:e}){const t=p.useRef(null),[n,r]=p.useState(!1),[i,s]=p.useState("");return p.useEffect(()=>{let a=!1,l,c,u;r(!1);try{u=Kot(e,window.matchMedia("(prefers-reduced-motion: reduce)").matches),s("")}catch{s("ECharts 配置不是有效且安全的数据对象,请切换到代码检查内容。");return}return Jot().then(d=>{const f=t.current;a||!f||(l=d.init(f,void 0,{renderer:"svg"}),l.setOption(u,{notMerge:!0}),typeof ResizeObserver<"u"&&(c=new ResizeObserver(()=>l==null?void 0:l.resize()),c.observe(f)),r(!0))}).catch(()=>{l==null||l.dispose(),l=void 0,a||s("图表暂时无法渲染,请切换到代码检查内容。")}),()=>{a=!0,c==null||c.disconnect(),l==null||l.dispose()}},[e]),o.jsxs("div",{className:`echarts-diagram${i?" echarts-diagram--error":""}`,role:"img","aria-label":"ECharts 图表预览","aria-busy":!n&&!i,children:[o.jsx("div",{ref:t,className:"echarts-diagram__canvas",hidden:!!i}),!n&&!i?o.jsx("div",{className:"echarts-diagram__state","aria-live":"polite",children:o.jsx(En,{duration:2.2,spread:15,children:"正在渲染图表…"})}):null,i?o.jsx("p",{className:"echarts-diagram__error",role:"alert",children:i}):null]})}const tlt=p.memo(elt);let IW,DW=Promise.resolve(),nlt=0;function rlt(){return IW??(IW=dd(async()=>{const{default:e}=await import("../visualizations/mermaid/mermaid.core-u1Q_qVDs.js").then(t=>t.ay);return{default:e}},__vite__mapDeps([0,1])).then(({default:e})=>(e.initialize({startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,theme:"neutral"}),e))),IW}function ilt(e){const t=DW.then(async()=>{const n=await rlt(),r=`mermaid-diagram-${nlt+=1}`;return n.render(r,e)});return DW=t.then(()=>{},()=>{}),t}function slt({source:e}){const t=p.useRef(null),[n,r]=p.useState(null),[i,s]=p.useState(!1);return p.useEffect(()=>{let a=!1;return r(null),s(!1),ilt(e).then(l=>{a||r(l)}).catch(()=>{a||s(!0)}),()=>{a=!0}},[e]),p.useEffect(()=>{!(n!=null&&n.bindFunctions)||!t.current||n.bindFunctions(t.current)},[n]),i?o.jsx("div",{className:"mermaid-diagram mermaid-diagram--error",children:o.jsx("p",{className:"mermaid-diagram__error",role:"alert",children:"图表暂时无法渲染,请切换到代码查看 Mermaid 内容。"})}):n?o.jsx("div",{ref:t,className:"mermaid-diagram",role:"img","aria-label":"Mermaid 图表预览",dangerouslySetInnerHTML:{__html:n.svg}}):o.jsx("div",{className:"mermaid-diagram mermaid-diagram--loading","aria-live":"polite",children:o.jsx(En,{duration:2.2,spread:15,children:"正在渲染图表…"})})}const alt=p.memo(slt),olt="_SegmentedControl_1sl7d_1",llt="_SegmentedControlOption_1sl7d_140",clt="_SegmentedControlThumb_1sl7d_219",mL={SegmentedControl:olt,SegmentedControlOption:llt,SegmentedControlThumb:clt},Fs=({value:e,onChange:t,children:n,block:r,pill:i=!0,size:s="md",gutterSize:a,className:l,onClick:c,...u})=>{const d=p.useRef(null),f=p.useRef(null),h=p.useCallback(g=>{const b=d.current,y=f.current;if(!b||!y)return;const O=b==null?void 0:b.querySelector('[data-state="on"]');if(!O)return;const v=b.clientWidth;let x=Math.floor(O.clientWidth);const w=O.offsetLeft;if(v-(x+w)<2&&(x=x-1),y.style.width=`${Math.floor(x)}px`,y.style.transform=`translateX(${w}px)`,b.scrollWidth>v){const S=v*.15,E=b.scrollLeft,k=O.offsetLeft,_=k+x;(kE+v-S)&&g&&O.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"})}},[]);Ele({ref:d,onResize:()=>{const g=f.current;if(!g)return;const b=g.style.transition;g.style.transition="",h(!1),g.style.transition=b}}),p.useLayoutEffect(()=>{const g=d.current,b=f.current;!g||!b||(h(!!b.style.transition),b.style.transition||wC(()=>{b.style.transition="width 300ms var(--cubic-enter), transform 300ms var(--cubic-enter)"}))},[h,e,s,a,i]);const m=g=>{g&&t&&t(g)};return o.jsxs(GLe,{ref:d,className:ur(mL.SegmentedControl,l),type:"single",value:e,loop:!1,onValueChange:m,onClick:c,"data-block":r?"":void 0,"data-pill":i?"":void 0,"data-size":s,"data-gutter-size":a,...u,children:[o.jsx("div",{className:mL.SegmentedControlThumb,ref:f}),n]})},ult=({children:e,...t})=>o.jsx(JLe,{className:mL.SegmentedControlOption,...t,onPointerEnter:_9,children:o.jsx("span",{className:"relative",children:e})});Fs.Option=ult;function dlt({children:e,label:t,language:n,source:r,streaming:i=!1}){const[s,a]=p.useState("preview"),l=i?"code":s;return o.jsxs("section",{className:"visualization-card","aria-label":`${t} 图表`,children:[o.jsx("div",{className:"visualization-card__toolbar",children:o.jsxs(Fs,{className:"visualization-card__tabs",value:l,size:"sm",gutterSize:"sm",pill:!1,"aria-label":`${t} 显示方式`,onChange:c=>{i||a(c)},children:[o.jsx(Fs.Option,{value:"preview",disabled:i,children:"预览"}),o.jsx(Fs.Option,{value:"code",children:"代码"})]})}),o.jsx("div",{className:"visualization-card__body",children:l==="code"?o.jsx("pre",{className:"visualization-card__code",children:o.jsx("code",{className:`language-${n}`,children:r})}):e})]})}const flt=p.memo(dlt);function hlt(e){const t=e==null?void 0:e.trim().toLowerCase();if(t==="mermaid")return"mermaid";if(t==="echart"||t==="echarts")return"echarts"}const jge=[".mp4",".webm",".mov",".m4v",".ogg",".avi"];function gL(e){return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(gL).join(""):p.isValidElement(e)?gL(e.props.children):""}function plt(e){var r;const t=p.Children.toArray(e)[0];if(!p.isValidElement(t))return;const n=(r=t.props.className)==null?void 0:r.split(/\s+/).find(i=>i.startsWith("language-"));return hlt(n==null?void 0:n.slice(9))}function Rge(e){if(!e)return!1;try{const t=e.toLowerCase();return jge.some(n=>t.includes(n))}catch{return!1}}function mlt(e){var r;const t=(r=e==null?void 0:e.properties)==null?void 0:r.href;if(!t)return!1;if(Rge(t))return!0;const n=e==null?void 0:e.children;if(n&&Array.isArray(n)){const i=n.map(s=>(s==null?void 0:s.value)||"").join("").toLowerCase();return jge.some(s=>i.includes(s))}return!1}function glt({text:e,className:t,allowRawHtml:n=!0,streaming:r=!1}){const[i,s]=p.useState(null),a=(u,d)=>{if(u.src)return u.src;if(d){const f=m=>{var g;if(!m)return null;if(m.type==="source"&&((g=m.properties)!=null&&g.src))return m.properties.src;if(m.children)for(const b of m.children){const y=f(b);if(y)return y}return null},h=f({children:d});if(h)return h}return""},l=u=>{try{const f=new URL(u).pathname.split("/");return f[f.length-1]||"video.mp4"}catch{return"video.mp4"}},c=u=>u?Array.isArray(u)?u.map(d=>(d==null?void 0:d.value)||"").join("")||"video":(u==null?void 0:u.value)||"video":"video";return o.jsxs("div",{className:t?`md ${t}`:"md",children:[o.jsx(RJe,{remarkPlugins:[Xtt],rehypePlugins:n?[Aot,hW]:[hW],components:{pre:({node:u,children:d,...f})=>{const h=plt(d);if(h==="mermaid"||h==="echarts"){const m=gL(d).replace(/\n$/,"");return o.jsx(flt,{label:h==="mermaid"?"Mermaid":"ECharts",language:h,source:m,streaming:r,children:h==="mermaid"?o.jsx(alt,{source:m}):o.jsx(tlt,{source:m})})}return o.jsx("pre",{...f,children:d})},a:({node:u,...d})=>{const f=d.href;if(f&&(Rge(f)||mlt(u))){const h=f,m=c(u==null?void 0:u.children);return o.jsxs("div",{className:"video-container",children:[o.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":`点击播放视频: ${m}`,onClick:()=>s({src:h,title:m}),children:[o.jsx("video",{src:h,playsInline:!0,className:"video-thumbnail",preload:"metadata"}),o.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:o.jsx(uy,{})})]}),o.jsx("div",{className:"video-caption",children:o.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",className:"video-link-text",children:m})})]})}return o.jsx("a",{...d,target:"_blank",rel:"noopener noreferrer"})},img:({node:u,src:d,alt:f,...h})=>{const m=o.jsx("img",{...h,src:d,alt:f??"",loading:"lazy"});return d?o.jsx(Eae,{src:d,children:o.jsxs("button",{type:"button",className:"image-preview-trigger","aria-label":`放大预览:${f||"图片"}`,children:[m,o.jsx("span",{className:"image-preview-hint","aria-hidden":"true",children:o.jsx(uy,{})})]})}):m},video:({node:u,src:d,children:f,...h})=>{const m=a({src:d},f);return m?o.jsx("div",{className:"video-container",children:o.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":"点击放大视频",onClick:()=>s({src:m}),children:[o.jsx("video",{src:m,...h,playsInline:!0,className:"video-thumbnail",children:f}),o.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:o.jsx(uy,{})})]})}):o.jsx("video",{src:d,controls:!0,playsInline:!0,className:"video-inline",...h,children:f})}},children:e}),i&&o.jsx("div",{className:"video-viewer-backdrop",role:"dialog","aria-modal":"true","aria-label":"视频预览",onClick:()=>s(null),children:o.jsxs("div",{className:"video-viewer",onClick:u=>u.stopPropagation(),children:[o.jsxs("div",{className:"video-viewer-header",children:[o.jsx("div",{className:"video-viewer-title",children:i.title||l(i.src)}),o.jsxs("nav",{className:"video-viewer-nav",children:[o.jsx("a",{href:i.src,download:i.title||l(i.src),"aria-label":"下载视频",title:"下载视频",className:"video-viewer-download",children:o.jsx(NN,{})}),o.jsx("button",{type:"button",className:"video-viewer-close","aria-label":"关闭",onClick:()=>s(null),children:o.jsx(Oa,{})})]})]}),o.jsx("div",{className:"video-viewer-body",children:o.jsx("video",{src:i.src,controls:!0,autoPlay:!0,playsInline:!0,className:"video-fullscreen"})})]})})]})}const xu=p.memo(glt),blt="未知来源",ylt="未知创建者";function Qv(e){return(e==null?void 0:e.trim())||blt}function Ige(e){return(e==null?void 0:e.trim())||ylt}function Olt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M5 5.5A2.5 2.5 0 0 1 7.5 3H19v16H7.5A2.5 2.5 0 0 0 5 21.5v-16Z"}),o.jsx("path",{d:"M5 18.5A2.5 2.5 0 0 1 7.5 16H19"}),o.jsx("path",{d:"M9 7h6M9 10h4"})]})}function xlt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M6 3h8l4 4v14H6V3Z"}),o.jsx("path",{d:"M14 3v5h5M9 12h6M9 16h6"})]})}function vlt(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m7 7 10 10M17 7 7 17"})})}function wlt(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"M12 5v14M5 12h14"})})}function _E({title:e,children:t,onClose:n,busy:r=!1,className:i=""}){const s=p.useId(),a=p.useRef(null),l=p.useRef(null),c=p.useRef(r),u=p.useRef(n);return p.useEffect(()=>{c.current=r,u.current=n},[r,n]),p.useEffect(()=>{var m;const d=document.activeElement instanceof HTMLElement?document.activeElement:null,f=document.body.style.overflow;document.body.style.overflow="hidden",(m=a.current)==null||m.focus();const h=g=>{if(g.key==="Escape"&&!c.current){u.current();return}if(g.key!=="Tab")return;const b=l.current;if(!b)return;const y=Array.from(b.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), a[href], audio[controls], video[controls], iframe, [tabindex]:not([tabindex="-1"])')).filter(x=>x.getClientRects().length>0);if(y.length===0){g.preventDefault();return}const O=y[0],v=y[y.length-1];g.shiftKey&&(document.activeElement===O||!b.contains(document.activeElement))?(g.preventDefault(),v.focus()):!g.shiftKey&&(document.activeElement===v||!b.contains(document.activeElement))&&(g.preventDefault(),O.focus())};return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h),document.body.style.overflow=f,d!=null&&d.isConnected&&d.focus()}},[]),Cr.createPortal(o.jsx("div",{className:"knowledge-dialog-backdrop",onMouseDown:d=>{d.target===d.currentTarget&&!r&&n()},children:o.jsxs("section",{ref:l,className:`knowledge-dialog${i?` ${i}`:""}`,role:"dialog","aria-modal":"true","aria-labelledby":s,"aria-busy":r||void 0,children:[o.jsxs("header",{className:"knowledge-dialog__header",children:[o.jsx("h2",{id:s,children:e}),o.jsx("button",{ref:a,type:"button",onClick:n,disabled:r,"aria-label":"关闭",children:o.jsx(vlt,{})})]}),t]})}),document.body)}function Gw({message:e}){return e?o.jsx("div",{className:"knowledge-form-error",role:"alert",children:e}):null}function bL(e){return e instanceof DOMException&&e.name==="AbortError"}function Slt(e){if(!e)return"";const t=Date.parse(e);return Number.isFinite(t)?new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(t):e}const Dge=[".jpg",".jpeg",".png"].join(","),Elt=new Set(Dge.split(",")),Pge=[".pdf",".pptx",".docx",".xlsx",".txt"].join(","),klt=new Set(Pge.split(",")),_lt=200*1024*1024;function yL(e){const t=e.lastIndexOf(".");return t<0?"":e.slice(t).toLocaleLowerCase()}function Tlt(e,t){return e.size>_lt?"单个文件不能超过 200 MB":t==="image"?Elt.has(yL(e.name))?"":"请选择 PNG、JPG 或 JPEG 图片":klt.has(yL(e.name))?"":"请选择 PDF、PPTX、DOCX、XLSX 或 TXT 文件"}function AB(e){return e<=0?"-":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function OL(e){var i;const t=e.type.trim().replace(/^\./,"");if(t)return t.toUpperCase();const n=e.name.trim(),r=n.includes(".")?(i=n.split(".").pop())==null?void 0:i.trim():"";return r?r.toUpperCase():"-"}function Clt({region:e,onClose:t,onCreated:n}){const[r,i]=p.useState(""),[s,a]=p.useState(""),[l,c]=p.useState(!1),[u,d]=p.useState(!1),[f,h]=p.useState(""),m=r.trim(),g=!!(m&&!/^[A-Za-z][A-Za-z0-9_]{0,47}$/.test(m)),b=async y=>{if(y.preventDefault(),c(!0),!m||g)return;d(!0),h("");const O={name:m,description:s.trim()||void 0,region:e};try{n(await qGe(O))}catch(v){h(Ga(v,"创建知识库失败"))}finally{d(!1)}};return o.jsx(_E,{title:"新建知识库",onClose:t,busy:u,children:o.jsxs("form",{onSubmit:y=>void b(y),children:[o.jsxs("div",{className:"knowledge-dialog__body",children:[o.jsxs("label",{children:[o.jsx("span",{children:"名称"}),o.jsx("input",{autoFocus:!0,value:r,maxLength:48,"aria-invalid":l&&g||void 0,"aria-describedby":"knowledge-name-help",onBlur:()=>c(!0),onChange:y=>i(y.target.value)})]}),o.jsx("p",{id:"knowledge-name-help",className:`knowledge-dialog__note${l&&g?" is-error":""}`,role:l&&g?"alert":void 0,children:l&&g?"名称必须以字母开头,且只能包含字母、数字和下划线。":"以字母开头,仅支持字母、数字和下划线,最多 48 个字符。"}),o.jsxs("label",{children:[o.jsx("span",{children:"描述(可选)"}),o.jsx("textarea",{value:s,maxLength:80,onChange:y=>a(y.target.value)})]}),o.jsx(Gw,{message:f})]}),o.jsxs("footer",{className:"knowledge-dialog__actions",children:[o.jsx("button",{type:"button",onClick:t,disabled:u,children:"取消"}),o.jsx("button",{type:"submit",className:"is-primary",disabled:u||!m||g,children:u?"创建中":"创建"})]})]})})}function Alt({item:e,onClose:t,onUpdated:n}){const[r,i]=p.useState(e.description),[s,a]=p.useState(!1),[l,c]=p.useState(""),u=async d=>{d.preventDefault(),a(!0),c("");try{n(await XGe(e.id,e.region,{description:r.trim()}))}catch(f){c(Ga(f,"更新知识库失败"))}finally{a(!1)}};return o.jsx(_E,{title:"编辑知识库",onClose:t,busy:s,children:o.jsxs("form",{onSubmit:d=>void u(d),children:[o.jsxs("div",{className:"knowledge-dialog__body",children:[o.jsxs("label",{children:[o.jsx("span",{children:"名称"}),o.jsx("input",{value:e.name,disabled:!0})]}),o.jsxs("label",{children:[o.jsx("span",{children:"描述"}),o.jsx("textarea",{autoFocus:!0,value:r,maxLength:80,onChange:d=>i(d.target.value)})]}),o.jsx("p",{className:"knowledge-dialog__note",children:"AgentKit 当前仅支持更新知识库描述。"}),o.jsx(Gw,{message:l})]}),o.jsxs("footer",{className:"knowledge-dialog__actions",children:[o.jsx("button",{type:"button",onClick:t,disabled:s,children:"取消"}),o.jsx("button",{type:"submit",className:"is-primary",disabled:s,children:s?"保存中":"保存"})]})]})})}function Mge(e){if(!e.trim())return{};const t=JSON.parse(e);if(!t||Array.isArray(t)||typeof t!="object")throw new Error("Metadata 必须是 JSON 对象");return t}function Nlt({base:e,onClose:t,onCreated:n,onAssociationInvalid:r}){const[i,s]=p.useState("document"),[a,l]=p.useState(""),[c,u]=p.useState(""),[d,f]=p.useState(""),[h,m]=p.useState(null),[g,b]=p.useState(!1),[y,O]=p.useState("{}"),[v,x]=p.useState(""),[w,S]=p.useState(""),[E,k]=p.useState(null),_=p.useRef(null),C=p.useRef(null),T=p.useRef(null),A=p.useRef(0),j=!!v;p.useEffect(()=>{var D;E&&!j&&((D=T.current)==null||D.focus())},[j,E]);const L=D=>{j||D===i||(s(D),m(null),f(""),l(""),u(""),S(""),k(null),b(!1),A.current=0,_.current&&(_.current.value=""))},I=D=>{if(!D||i==="web")return;const Q=Tlt(D,i);if(Q){m(null),l(""),u(""),S(Q);return}m(D),S(""),l(D.name.replace(/\.[^.]+$/,"")),u(yL(D.name).slice(1))},M=async D=>{if(D.preventDefault(),i==="web"?!d.trim():!h)return;let Q;try{Q=Mge(y)}catch(F){S(Ga(F,"Metadata 格式错误"));return}x(i==="web"?E?"save":"preview":"upload"),S("");try{if(i==="web")if(E){const F={sourceType:"url",metadata:E.metadata,url:E.preview.url,sourceTitle:E.preview.name,sourceMarkdown:E.preview.sourceMarkdown};await ZGe(e.id,e.region,F),n()}else{const F=await KGe(e.id,e.region,{url:d.trim()});if(!F.sourceMarkdown.trim())throw new Error("网页没有可预览的 Markdown 内容");k({preview:F,metadata:Q})}else h&&(await JGe(e.id,e.region,{file:h,name:a.trim()||void 0,documentType:c.trim()||void 0,metadata:Q}),n())}catch(F){F instanceof wj&&F.errorCode===Whe?r(F):S(Ga(F,i==="web"?E?"添加网页失败":"生成网页预览失败":"上传文件失败"))}finally{x("")}},N=()=>{j||(k(null),S(""),requestAnimationFrame(()=>{var D;return(D=C.current)==null?void 0:D.focus()}))};return o.jsx(_E,{title:E?"预览网页内容":"添加数据",onClose:t,busy:j,className:E?"knowledge-dialog--preview knowledge-dialog--web-confirm":"",children:o.jsx("form",{onSubmit:D=>void M(D),children:E?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"knowledge-preview knowledge-web-preview",children:[o.jsxs("div",{className:"knowledge-preview__meta",children:[o.jsx("strong",{title:E.preview.name,children:E.preview.name}),o.jsx("a",{href:E.preview.url,target:"_blank",rel:"noopener noreferrer",children:"打开原网页"})]}),o.jsx("div",{className:"knowledge-preview__body","aria-live":"polite",children:o.jsx("div",{className:"knowledge-preview__markdown-shell",children:o.jsx(xu,{text:E.preview.sourceMarkdown,allowRawHtml:!1,className:"knowledge-preview__markdown"})})}),w?o.jsx("div",{className:"knowledge-web-preview__error",children:o.jsx(Gw,{message:w})}):null]}),o.jsxs("footer",{className:"knowledge-dialog__actions",children:[o.jsx("button",{type:"button",className:"is-back",onClick:N,disabled:j,children:"返回修改"}),o.jsx("button",{type:"button",onClick:t,disabled:j,children:"取消"}),o.jsx("button",{ref:T,type:"submit",className:"is-primary",disabled:j,children:v==="save"?"添加中":"确认添加"})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"knowledge-dialog__body",children:[o.jsx("div",{className:"knowledge-source-tabs",role:"tablist","aria-label":"知识来源",children:[["image","图片"],["document","文档文件"],["web","在线网页"]].map(([D,Q])=>o.jsx("button",{type:"button",role:"tab",id:`knowledge-source-${D}-tab`,"aria-controls":`knowledge-source-${D}-panel`,"aria-selected":i===D,tabIndex:i===D?0:-1,className:i===D?"is-active":"",disabled:j,onClick:()=>L(D),onKeyDown:F=>{const $=["image","document","web"];if(!["ArrowLeft","ArrowRight","Home","End"].includes(F.key))return;F.preventDefault();const H=$.indexOf(D),z=F.key==="Home"?$[0]:F.key==="End"?$[$.length-1]:$[(H+(F.key==="ArrowRight"?1:-1)+$.length)%$.length];L(z),requestAnimationFrame(()=>{var B;return(B=document.getElementById(`knowledge-source-${z}-tab`))==null?void 0:B.focus()})},children:Q},D))}),o.jsx("div",{id:`knowledge-source-${i}-panel`,className:"knowledge-source-panel",role:"tabpanel","aria-labelledby":`knowledge-source-${i}-tab`,children:i==="web"?o.jsxs(o.Fragment,{children:[o.jsxs("label",{children:[o.jsx("span",{children:"网页 URL"}),o.jsx("input",{ref:C,autoFocus:!0,type:"url",value:d,disabled:j,onChange:D=>{f(D.target.value),S("")},placeholder:"https://example.com/article"})]}),o.jsx("div",{className:"knowledge-upload-status",role:"status","aria-live":"polite",children:v==="preview"?o.jsx(En,{children:"正在抓取网页并生成 Markdown 预览"}):null})]}):o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:_,className:"knowledge-upload-input",type:"file","aria-label":"选择知识文件",accept:i==="image"?Dge:Pge,disabled:j,onChange:D=>{var Q;I(((Q=D.currentTarget.files)==null?void 0:Q[0])??null),D.currentTarget.value=""}}),o.jsxs("button",{type:"button",className:`knowledge-upload-dropzone${g?" is-dragging":""}${h?" is-ready":""}`,disabled:j,onClick:()=>{var D;return(D=_.current)==null?void 0:D.click()},onDragEnter:D=>{D.preventDefault(),!j&&(A.current+=1,b(!0))},onDragOver:D=>{D.preventDefault(),j||(D.dataTransfer.dropEffect="copy")},onDragLeave:D=>{D.preventDefault(),A.current=Math.max(0,A.current-1),A.current===0&&b(!1)},onDrop:D=>{var Q;D.preventDefault(),A.current=0,b(!1),j||I(((Q=D.dataTransfer.files)==null?void 0:Q[0])??null)},children:[o.jsx("strong",{children:h?h.name:"选择文件或拖拽到这里"}),o.jsx("span",{children:h?`${AB(h.size)} · 点击可重新选择`:i==="image"?"支持 PNG、JPG 和 JPEG,单个文件不超过 200 MB":"支持 PDF、PPTX、DOCX、XLSX 和 TXT,单个文件不超过 200 MB"})]}),o.jsx("div",{className:"knowledge-upload-status",role:"status","aria-live":"polite",children:j?o.jsx(En,{children:"正在上传文件并添加到知识库"}):null})]})}),i!=="web"?o.jsxs("div",{className:"knowledge-dialog__fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:"名称(可选)"}),o.jsx("input",{value:a,disabled:j,maxLength:256,onChange:D=>l(D.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"类型(可选)"}),o.jsx("input",{value:c,disabled:j,maxLength:64,onChange:D=>u(D.target.value),placeholder:"pdf、docx、png"})]})]}):null,o.jsxs("label",{children:[o.jsx("span",{children:"Metadata(JSON)"}),o.jsx("textarea",{className:"is-code",value:y,disabled:j,onChange:D=>O(D.target.value),spellCheck:!1})]}),o.jsx(Gw,{message:w})]}),o.jsxs("footer",{className:"knowledge-dialog__actions",children:[o.jsx("button",{type:"button",onClick:t,disabled:j,children:"取消"}),o.jsx("button",{type:"submit",className:"is-primary",disabled:j||(i==="web"?!d.trim():!h),children:j?i==="web"?"生成中":"上传中":i==="web"?"生成预览":"上传文件"})]})]})})})}function jlt({base:e,item:t,onClose:n,onUpdated:r}){const[i,s]=p.useState(()=>JSON.stringify(t.metadata??{},null,2)),[a,l]=p.useState(!1),[c,u]=p.useState(""),d=async f=>{f.preventDefault();let h;try{h=Mge(i)}catch(m){u(Ga(m,"Metadata 格式错误"));return}l(!0),u("");try{r(await eWe(e.id,t.id,e.region,{metadata:h}))}catch(m){u(Ga(m,"更新知识失败"))}finally{l(!1)}};return o.jsx(_E,{title:"编辑知识 Metadata",onClose:n,busy:a,children:o.jsxs("form",{onSubmit:f=>void d(f),children:[o.jsxs("div",{className:"knowledge-dialog__body",children:[o.jsxs("label",{children:[o.jsx("span",{children:"知识"}),o.jsx("input",{value:t.name||t.id,disabled:!0})]}),o.jsxs("label",{children:[o.jsx("span",{children:"Metadata(JSON)"}),o.jsx("textarea",{autoFocus:!0,className:"is-code knowledge-metadata-editor",value:i,onChange:f=>s(f.target.value),spellCheck:!1})]}),o.jsx(Gw,{message:c})]}),o.jsxs("footer",{className:"knowledge-dialog__actions",children:[o.jsx("button",{type:"button",onClick:n,disabled:a,children:"取消"}),o.jsx("button",{type:"submit",className:"is-primary",disabled:a,children:a?"保存中":"保存"})]})]})})}const Lge=new Set(["avif","bmp","gif","jpeg","jpg","png","svg","webp"]),$ge=new Set(["aac","flac","m4a","mp3","ogg","wav","webm"]),Bge=new Set(["m4v","mov","mp4","mpeg","mpg","ogg","webm"]),Rlt=new Set(["pdf"]),Ilt=new Set(["doc","docx","ppt","pptx","xls","xlsx"]),Dlt=new Set(["creating","indexing","pending","processing","queued","submitted"]),Plt=new Set(["error","failed","unavailable"]);function PW(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function _2(e){if(e==null||e==="")return"-";if(["string","number","boolean"].includes(typeof e))return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function Mlt(e){if(Array.isArray(e)){if(e.length===0)return null;const r=e.map(PW);if(r.some(i=>Object.keys(i).length>0)){const i=[...new Set(r.flatMap(s=>Object.keys(s)))];return{columns:i,rows:r.map(s=>i.map(a=>_2(s[a])))}}return{columns:["值"],rows:e.map(i=>[_2(i)])}}const t=PW(e),n=Object.entries(t);if(n.length===0)return null;if(n.every(([,r])=>Array.isArray(r))){const r=n.map(([s])=>s),i=Math.max(...n.map(([,s])=>s.length));return{columns:r,rows:Array.from({length:i},(s,a)=>n.map(([,l])=>_2(l[a])))}}return{columns:["字段","值"],rows:n.map(([r,i])=>[r,_2(i)])}}function Qge(e){const t=e.trim();if(!t||t.startsWith("//"))return"";if(t.startsWith("/"))return t;try{const n=new URL(t);return["http:","https:"].includes(n.protocol)?n.href:""}catch{return""}}function Llt(e){const t=Qge(e);return t.startsWith("http://")||t.startsWith("https://")?t:""}function $lt(e){var i;const t=e.attachmentType.trim().toLocaleLowerCase();if(t==="image"||t==="doc-image"||t.startsWith("image/"))return"image";if(t==="audio"||t.startsWith("audio/"))return"audio";if(t==="video"||t.startsWith("video/"))return"video";if(t==="pdf"||t==="application/pdf")return"pdf";const n=e.attachmentUrl.split(/[?#]/,1)[0],r=n.includes(".")?((i=n.split(".").pop())==null?void 0:i.toLocaleLowerCase())??"":"";return Lge.has(r)?"image":$ge.has(r)?"audio":Bge.has(r)?"video":Rlt.has(r)?"pdf":t||r?"file":"none"}function Blt(e){const t=e.status.trim().toLocaleLowerCase();if(Dlt.has(t))return{title:"数据正在处理中",detail:"知识库完成解析后即可预览,请稍后重新加载。"};if(Plt.has(t))return{title:"数据解析失败",detail:"请检查源文件或网页地址后重新添加,也可以重新加载最新状态。"};const n=OL(e).toLocaleLowerCase();return n==="pdf"||Ilt.has(n)?{title:"暂时没有可预览的解析内容",detail:"此类文件会在知识库完成解析后显示文本、表格或页面图片。"}:Lge.has(n)||$ge.has(n)||Bge.has(n)?{title:"暂时没有可预览的媒体内容",detail:"知识库尚未返回可访问的媒体预览,请稍后重新加载。"}:{title:"暂无可预览的数据内容",detail:"知识库尚未返回解析结果,请稍后重新加载。"}}function Qlt({chunk:e}){const[t,n]=p.useState(!1),r=Qge(e.attachmentUrl),i=$lt(e);return!r||i==="none"?null:t?o.jsx("div",{className:"knowledge-preview__attachment-error",children:"附件无法预览,请稍后重试。"}):i==="image"?o.jsx("img",{className:"knowledge-preview__image",src:r,alt:e.title||"知识数据图片",loading:"lazy",onError:()=>n(!0)}):i==="audio"?o.jsx("audio",{className:"knowledge-preview__audio",src:r,controls:!0,preload:"metadata",onError:()=>n(!0),children:"当前浏览器不支持音频预览。"}):i==="video"?o.jsx("video",{className:"knowledge-preview__video",src:r,controls:!0,playsInline:!0,preload:"metadata",onError:()=>n(!0),children:"当前浏览器不支持视频预览。"}):i==="pdf"?o.jsxs("div",{className:"knowledge-preview__pdf",children:[o.jsx("iframe",{src:r,title:e.title?`${e.title} PDF 预览`:"PDF 预览",sandbox:"",referrerPolicy:"no-referrer",onError:()=>n(!0)}),o.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",children:"无法显示时,在新窗口打开 PDF"})]}):o.jsxs("div",{className:"knowledge-preview__file-fallback",children:[o.jsx("p",{children:"当前格式暂不支持直接在线预览,已优先显示解析后的内容。"}),o.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",children:"打开原文件"})]})}function Ult({base:e,item:t,onClose:n}){const[r,i]=p.useState([]),[s,a]=p.useState(t),[l,c]=p.useState(""),[u,d]=p.useState(!0),[f,h]=p.useState(!1),[m,g]=p.useState(!1),[b,y]=p.useState(""),O=p.useRef(0),v=p.useRef(null),x=p.useCallback(async(k=0)=>{var T;(T=v.current)==null||T.abort();const _=new AbortController;v.current=_;const C=O.current+1;O.current=C,k>0?h(!0):d(!0),y(""),k===0&&(i([]),g(!1));try{const A=await YGe(e.id,t.id,{region:e.region,offset:k,signal:_.signal});if(O.current!==C)return;a(A.document.id?A.document:t),c(A.sourceMarkdown||A.document.sourceMarkdown),i(j=>k>0?[...j,...A.chunks]:A.chunks),g(A.hasMore)}catch(A){!bL(A)&&O.current===C&&y(Ga(A,"加载数据预览失败"))}finally{O.current===C&&(d(!1),h(!1))}},[e.id,e.region,t]);p.useEffect(()=>(x(),()=>{var k;(k=v.current)==null||k.abort(),O.current+=1}),[x]);const w=Llt(s.url||t.url),S=Blt(s),E=s.metadata._veadk_content_format==="markdown";return o.jsx(_E,{title:s.name||t.name||t.id,onClose:n,className:"knowledge-dialog--preview",children:o.jsxs("div",{className:"knowledge-preview",children:[s.sizeBytes>0||w?o.jsxs("div",{className:"knowledge-preview__meta",children:[s.sizeBytes>0?o.jsx("span",{children:AB(s.sizeBytes)}):null,w?o.jsx("a",{href:w,target:"_blank",rel:"noopener noreferrer",children:"打开原网页"}):null]}):null,o.jsx("div",{className:"knowledge-preview__body","aria-live":"polite",children:l?o.jsx("div",{className:"knowledge-preview__markdown-shell",children:o.jsx(xu,{text:l,allowRawHtml:!1,className:"knowledge-preview__markdown"})}):u?o.jsx("div",{className:"knowledge-preview__state",role:"status",children:o.jsx(En,{as:"span",duration:2.4,children:"正在加载数据预览"})}):b&&r.length===0?o.jsxs("div",{className:"knowledge-preview__state is-error",role:"alert",children:[o.jsx("p",{children:b}),o.jsx("button",{type:"button",onClick:()=>void x(),children:"重试"})]}):r.length===0?o.jsxs("div",{className:"knowledge-preview__state",children:[o.jsx("p",{children:S.title}),o.jsx("span",{children:w?"您可以打开原网页查看来源内容。":S.detail}),o.jsx("button",{type:"button",onClick:()=>void x(),children:"重新加载"})]}):o.jsxs("div",{className:"knowledge-preview__chunks",children:[r.map((k,_)=>{const C=Mlt(k.tableFields),T=k.id||`${_}:${k.title}`;return o.jsxs("article",{className:"knowledge-preview__chunk",children:[o.jsx("header",{children:o.jsx("h3",{children:k.title||`片段 ${_+1}`})}),k.content?E?o.jsx(xu,{text:k.content,allowRawHtml:!1,className:"knowledge-preview__markdown"}):o.jsx("p",{className:"knowledge-preview__content",children:k.content}):null,C?o.jsx("div",{className:"knowledge-preview__table-wrap",children:o.jsxs("table",{children:[o.jsx("thead",{children:o.jsx("tr",{children:C.columns.map((A,j)=>o.jsx("th",{scope:"col",children:A},`${A}:${j}`))})}),o.jsx("tbody",{children:C.rows.map((A,j)=>o.jsx("tr",{children:A.map((L,I)=>o.jsx("td",{children:L},I))},j))})]})}):null,o.jsx(Qlt,{chunk:k})]},T)}),b?o.jsx("div",{className:"knowledge-preview__more-error",role:"alert",children:b}):null,m?o.jsx("button",{type:"button",className:"knowledge-preview__load-more",disabled:f,onClick:()=>void x(r.length),children:f?o.jsx(En,{as:"span",duration:2.4,children:"正在加载更多"}):"加载更多"}):null]})})]})})}function Flt({cloudProvider:e,region:t,active:n=!0,activationRevision:r=0,onDetailChange:i,toolbarLeading:s,toolbarFilters:a}){const[l,c]=p.useState([]),[u,d]=p.useState({}),[f,h]=p.useState([]),[m,g]=p.useState(""),[b,y]=p.useState("overview"),[O,v]=p.useState(""),[x,w]=p.useState(""),[S,E]=p.useState(!0),[k,_]=p.useState(!1),[C,T]=p.useState(""),[A,j]=p.useState([]),[L,I]=p.useState(!1),[M,N]=p.useState(""),[D,Q]=p.useState(""),[F,$]=p.useState(""),[H,z]=p.useState(!1),[B,V]=p.useState(!1),[Z,ce]=p.useState(!1),[be,ie]=p.useState(null),[q,X]=p.useState(null),[K,de]=p.useState(null),[xe,Me]=p.useState(null),[Ae,He]=p.useState(null),[et,Te]=p.useState(!1),Re=p.useRef(0),he=p.useRef(0),me=p.useRef([]),Se=p.useRef(!1),ke=p.useRef(!1),nt=p.useRef(null),Qe=p.useRef(null),re=p.useRef({}),ue=p.useRef(!1),Pe=p.useRef(null),Ge=p.useRef(null),W=p.useRef(null),_e=p.useRef(null),rt=p.useMemo(()=>[t],[t]),Ve=p.useCallback(we=>`${we.region}\0${we.id}`,[]),We=l.find(we=>Ve(we)===m)??null,ot=!!(We&&F===Ve(We));p.useEffect(()=>{i==null||i(!!We)},[i,We]),p.useEffect(()=>{y("overview"),w("")},[m]);const St=p.useMemo(()=>{const we=O.trim().toLocaleLowerCase();return we?l.filter(Fe=>[Fe.name,Fe.description,Fe.ownerLabel,Fe.providerKnowledgeId].some(dt=>dt.toLocaleLowerCase().includes(we))):l},[l,O]),Vt=p.useMemo(()=>{const we=x.trim().toLocaleLowerCase();return we?A.filter(Fe=>[Fe.name,Fe.id,OL(Fe)].some(dt=>dt.toLocaleLowerCase().includes(we))):A},[x,A]);p.useEffect(()=>{X(null)},[We==null?void 0:We.id,We==null?void 0:We.region]);const _t=p.useCallback(async(we=!1)=>{var Tt;if(we&&(ue.current||Object.keys(re.current).length===0))return;(Tt=nt.current)==null||Tt.abort();const Fe=new AbortController;nt.current=Fe;const dt=Re.current+1;Re.current=dt,ue.current=!0,we?_(!0):E(!0),T(""),we||h([]);try{const Pt=await HGe({regions:rt,nextTokens:we?re.current:void 0,signal:Fe.signal});if(Re.current!==dt)return;c(ln=>we?[...ln,...Pt.items.filter(le=>!ln.some(Wt=>Ve(Wt)===Ve(le)))]:Pt.items),re.current=Pt.nextTokens,d(Pt.nextTokens);const nn=Pt.failures.map(({region:ln,error:le})=>`${Zf(ln,e)}:${Ga(le,"加载失败")}`);h(ln=>we?[...new Set([...ln,...nn])]:nn),we||g(ln=>Pt.items.some(le=>Ve(le)===ln)?ln:"")}catch(Pt){if(bL(Pt))return;Re.current===dt&&(we?h(nn=>[...new Set([...nn,Ga(Pt,"加载更多知识库失败")])]):T(Ga(Pt,"加载知识库失败")))}finally{Re.current===dt&&(ue.current=!1,E(!1),_(!1))}},[Ve,e,rt]),Ne=p.useCallback(async(we,Fe=!1)=>{var Pt;if(Fe&&Se.current)return;(Pt=Qe.current)==null||Pt.abort();const dt=new AbortController;Qe.current=dt;const Tt=he.current+1;he.current=Tt,Fe||(me.current=[],ke.current=!1,j([]),z(!1),Q("")),Se.current=!0,I(!0),Fe?Q(""):N("");try{const nn=await WGe(we.id,{region:we.region,offset:Fe?me.current.length:0,signal:dt.signal});if(he.current!==Tt)return;$(Le=>Le===Ve(we)?"":Le);const ln=me.current,le=Fe?[...ln,...nn.items.filter(Le=>!Le.id||!ln.some(Rt=>Rt.id===Le.id))]:nn.items,Wt=nn.hasMore&&(!Fe||le.length>ln.length);me.current=le,ke.current=Wt,j(le),z(Wt)}catch(nn){if(bL(nn))return;he.current===Tt&&(nn instanceof wj&&nn.errorCode===Whe&&($(Ve(we)),ie(le=>le&&Ve(le)===Ve(we)?null:le)),Fe?Q(Ga(nn,"加载更多数据失败")):N(Ga(nn,"加载数据失败")))}finally{he.current===Tt&&(Se.current=!1,I(!1))}},[Ve]);p.useEffect(()=>{var we;(we=nt.current)==null||we.abort(),Re.current+=1,ue.current=!1,re.current={},c([]),d({}),h([]),g(""),$(""),T(""),E(!0)},[e]),p.useEffect(()=>{if(n)return _t(),()=>{var we;(we=nt.current)==null||we.abort(),Re.current+=1,ue.current=!1}},[n,r,_t]),p.useEffect(()=>{var we,Fe;if(!n){(we=Qe.current)==null||we.abort(),he.current+=1,Se.current=!1;return}if(!We){(Fe=Qe.current)==null||Fe.abort(),he.current+=1,me.current=[],Se.current=!1,ke.current=!1,j([]),z(!1),Q("");return}return Ne(We),()=>{var dt;(dt=Qe.current)==null||dt.abort(),he.current+=1,Se.current=!1}},[n,r,We==null?void 0:We.id,We==null?void 0:We.region]);const $e=n&&!We&&!O.trim()&&!S&&!k&&!C&&Object.keys(u).length>0;p.useEffect(()=>{const we=Ge.current,Fe=Pe.current;if(!we||!Fe||!$e)return;const dt=new IntersectionObserver(([Tt])=>{Tt.isIntersecting&&_t(!0)},{root:Fe,rootMargin:"240px 0px",threshold:.01});return dt.observe(we),()=>dt.disconnect()},[$e,_t]);const mt=()=>{const we=Pe.current;!we||!$e||we.scrollHeight-we.scrollTop-we.clientHeight<=240&&_t(!0)},Ht=!!(We&&A.length>0&&H&&!L&&!D);p.useEffect(()=>{const we=_e.current,Fe=W.current;if(!We||!we||!Fe||!Ht)return;const dt=new IntersectionObserver(([Tt])=>{Tt.isIntersecting&&Ne(We,!0)},{root:W.current,rootMargin:"240px 0px",threshold:.01});return dt.observe(we),()=>dt.disconnect()},[Ht,Ne,We==null?void 0:We.id,We==null?void 0:We.region]);const qe=()=>{const we=W.current;if(!We||!we||!ke.current||Se.current||D)return;const{scrollHeight:Fe,scrollTop:dt,clientHeight:Tt}=we;Fe-dt-Tt<=240&&Ne(We,!0)},ye=we=>{c(Fe=>Fe.map(dt=>Ve(dt)===Ve(we)?we:dt))},Ue=async()=>{if(xe){Te(!0);try{await GGe(xe.id,xe.region),c(we=>we.filter(Fe=>Ve(Fe)!==Ve(xe))),$(we=>we===Ve(xe)?"":we),m===Ve(xe)&&g(""),Me(null)}catch(we){T(Ga(we,"删除知识库失败")),Me(null)}finally{Te(!1)}}},it=async()=>{if(!(!We||!Ae)){Te(!0);try{await tWe(We.id,Ae.id,We.region);const we=me.current.filter(Fe=>Fe.id!==Ae.id);me.current=we,j(we),He(null)}catch(we){N(Ga(we,"删除知识失败")),He(null)}finally{Te(!1)}}};return o.jsxs("section",{className:`knowledge-library${We?" is-detail":" resource-collection"}`,"aria-label":"知识库",children:[We?o.jsx(hE,{className:"knowledge-library__detail",title:We.name,description:We.description||"暂无描述",identitySeed:We.name,backLabel:"返回知识库列表",onBack:()=>g(""),sections:[{key:"overview",label:"概览",content:o.jsx("section",{className:"knowledge-overview",children:o.jsxs(G7,{className:"knowledge-overview__summary",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"Provider"}),o.jsx("dd",{children:We.providerType||"-"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"Knowledge ID"}),o.jsx("dd",{className:"knowledge-keyboard-reveal",tabIndex:0,title:We.providerKnowledgeId,children:We.providerKnowledgeId||"-"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"项目"}),o.jsx("dd",{children:We.projectName||"default"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"创建者"}),o.jsx("dd",{children:Qv(We.ownerLabel)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"更新时间"}),o.jsx("dd",{children:Slt(We.updatedAt)||"-"})]})]})})},{key:"data",label:"数据",content:o.jsx("section",{className:"knowledge-documents",children:o.jsx("div",{className:`knowledge-documents__body${A.length>0?" is-table":""}`,"aria-live":"polite",children:L&&A.length===0?o.jsx(bd,{}):M&&A.length===0?o.jsxs("div",{className:"knowledge-library__state is-error",role:"alert",children:[o.jsx("p",{children:M}),ot&&We.canManage?o.jsx("button",{type:"button",onClick:()=>Me(We),children:"删除失效关联"}):o.jsx("button",{type:"button",onClick:()=>void Ne(We),children:"重试"})]}):A.length===0?o.jsxs("div",{className:"knowledge-library__state",children:[o.jsx(xlt,{}),o.jsx("p",{children:"这个知识库还没有数据"}),We.canManage&&o.jsx("button",{type:"button",onClick:()=>ie(We),children:"添加第一项数据"})]}):o.jsx(uGe,{rows:Vt,rowKey:we=>we.id,rowLabel:we=>we.name||we.id,columns:[{key:"name",header:"名称",className:"is-primary-column",render:we=>o.jsx("span",{title:we.name||we.id,children:we.name||we.id})},{key:"format",header:"格式",className:"is-compact-column",render:we=>OL(we)},{key:"size",header:"大小",className:"is-compact-column",render:we=>AB(we.sizeBytes)}],searchValue:x,onSearchChange:w,searchPlaceholder:"搜索数据",searchLabel:"搜索知识库数据",primaryAction:We.canManage?{label:ot?"关联已失效":"添加数据",disabled:ot,title:ot?"底层 Provider 知识库已不存在":void 0,onClick:()=>ie(We)}:void 0,rowActions:we=>[{label:"预览",onSelect:()=>X(we)},...We.canManage?[{label:"编辑",onSelect:()=>de(we)},{label:"删除",onSelect:()=>He(we),danger:!0}]:[]],scrollRef:W,onScroll:qe,busy:L,emptyLabel:"没有匹配的数据",footer:L?o.jsxs("div",{className:"knowledge-document-pagination",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载更多数据"})]}):D?o.jsxs("div",{className:"knowledge-document-pagination is-error",role:"alert",children:[o.jsx("span",{children:D}),o.jsx("button",{type:"button",onClick:()=>void Ne(We,!0),children:"重试加载"})]}):H?o.jsx("div",{ref:_e,className:"knowledge-document-pagination",role:"status","aria-live":"polite",children:"继续下滑加载更多"}):null})})})}],activeSectionKey:b,navigationLabel:"知识库详情",onSectionChange:y,actions:We.canManage?o.jsxs(o.Fragment,{children:[o.jsx(Nt,{type:"button",color:"danger",variant:"soft",size:"lg",pill:!1,onClick:()=>Me(We),children:"删除"}),o.jsx(Nt,{type:"button",color:"primary",size:"lg",pill:!1,onClick:()=>ce(!0),children:"编辑"})]}):void 0}):o.jsxs(o.Fragment,{children:[o.jsxs(g0,{className:"knowledge-library__toolbar library-resource-toolbar",children:[s,o.jsxs("div",{className:"resource-toolbar__actions",children:[a,o.jsx(Gp,{value:O,onChange:we=>v(we.target.value),placeholder:"搜索知识库","aria-label":"搜索知识库"})]})]}),o.jsxs(b0,{ref:Pe,"aria-live":"polite",onScroll:mt,children:[f.length>0&&!S&&o.jsxs("div",{className:"knowledge-region-warning",role:"status",children:[o.jsx("span",{children:"部分知识库暂时无法加载,已展示其余可用内容。"}),o.jsx("button",{type:"button",onClick:()=>void _t(),children:"重试"})]}),S&&l.length===0?o.jsx(bd,{}):C?o.jsxs("div",{className:"knowledge-library__state is-error",role:"alert",children:[o.jsx("p",{children:C}),o.jsx("button",{type:"button",onClick:()=>void _t(),children:"重试"})]}):St.length===0&&O.trim()?o.jsxs("div",{className:"knowledge-library__state",children:[o.jsx(Olt,{}),o.jsx("p",{children:"没有匹配的知识库"})]}):o.jsxs(aO,{children:[O.trim()?null:o.jsx(Vg,{"aria-label":"新建知识库",icon:o.jsx(wlt,{}),onClick:()=>V(!0),children:"新建知识库"}),St.map(we=>o.jsx(bE,{className:"knowledge-card",title:we.name,description:we.description||"暂无描述",metadata:[{label:"创建者",value:Qv(we.ownerLabel),title:Qv(we.ownerLabel)},{label:"项目",value:we.projectName||"default",title:we.projectName||"default"}],action:{label:F===Ve(we)?"关联已失效":"添加数据",icon:"plus",disabled:!we.canManage||F===Ve(we),title:we.canManage?F===Ve(we)?"底层 Provider 知识库已不存在":void 0:"您没有管理此知识库的权限",onClick:()=>ie(we)},detailAction:{label:"查看详情",onClick:()=>g(Ve(we))}},Ve(we)))]}),$e||k?o.jsx("div",{ref:Ge,className:"my-agent-load-more",role:"status","aria-live":"polite",children:k?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载更多知识库"})]}):$e?o.jsx("span",{children:"继续下滑加载更多"}):null}):null]})]}),B&&o.jsx(Clt,{region:t,onClose:()=>V(!1),onCreated:we=>{c(Fe=>[we,...Fe]),g(Ve(we)),V(!1)}}),We&&Z&&o.jsx(Alt,{item:We,onClose:()=>ce(!1),onUpdated:we=>{ye(we),ce(!1)}}),We&&q&&o.jsx(Ult,{base:We,item:q,onClose:()=>X(null)}),be&&o.jsx(Nlt,{base:be,onClose:()=>ie(null),onAssociationInvalid:we=>{$(Ve(be)),We&&Ve(We)===Ve(be)&&N(Ga(we,"知识库关联已失效")),ie(null)},onCreated:()=>{We&&Ve(We)===Ve(be)&&Ne(We),ie(null)}}),We&&K&&o.jsx(jlt,{base:We,item:K,onClose:()=>de(null),onUpdated:we=>{const Fe=me.current.map(dt=>dt.id===we.id?we:dt);me.current=Fe,j(Fe),de(null)}}),xe&&o.jsx(zl,{title:"删除知识库?",description:`将删除 ${xe.name} 的 AgentKit 关联;如果它由 Studio 创建,也会同时删除 Provider 资源。此操作无法撤销。`,confirmLabel:et?"删除中":"删除",variant:"danger",busy:et,onCancel:()=>Me(null),onConfirm:()=>void Ue()}),Ae&&o.jsx(zl,{title:"删除知识?",description:`将从 Provider 知识库中删除 ${Ae.name||Ae.id},此操作无法撤销。`,confirmLabel:et?"删除中":"删除",variant:"danger",busy:et,onCancel:()=>He(null),onConfirm:()=>void it()})]})}const zlt="_EmptyMessage_1r5gu_1",Vlt="_IconBadge_1r5gu_16",Hlt="_Title_1r5gu_54",qlt="_Description_1r5gu_69",Xlt="_ActionRow_1r5gu_77",TE={EmptyMessage:zlt,IconBadge:Vlt,Title:Hlt,Description:qlt,ActionRow:Xlt},xn=({children:e,className:t,fill:n="static"})=>o.jsx("div",{className:ur(TE.EmptyMessage,t),"data-fill":n,children:e}),Glt=({size:e="md",color:t="secondary",children:n,className:r})=>o.jsx("div",{className:ur(TE.IconBadge,r),"data-size":e,"data-color":t,children:n}),Wlt=({children:e,className:t,color:n="secondary"})=>o.jsx("div",{className:ur(TE.Title,t),"data-color":n,children:e}),Ylt=({children:e,className:t})=>o.jsx("div",{className:ur(TE.Description,t),children:e}),Zlt=({children:e,className:t})=>o.jsx("div",{className:ur(TE.ActionRow,t),children:e});xn.Icon=Glt;xn.Title=Wlt;xn.Description=Ylt;xn.ActionRow=Zlt;const Klt="/web/skill-management";class Jlt extends Error{constructor(t,n,r="SKILL_MANAGEMENT_ERROR",i="",s,a=""){super(t),this.status=n,this.code=r,this.statusText=i,this.originalError=s,this.rawResponse=a,this.name="SkillManagementApiError"}}async function yh(e,t={},n=_o){return fetch(xo(`${Klt}${e}`),{...t,headers:fh(t.headers),signal:nl(t.signal,n)})}async function Uge(e,t){let n=t,r="SKILL_MANAGEMENT_ERROR",i;const s=await e.text().catch(()=>"");try{const a=JSON.parse(s);typeof a.detail=="string"?n=a.detail:a.detail&&(n=a.detail.message||t,r=a.detail.code||r,i=a.detail.originalError)}catch{s.trim()&&(n=`${t}:${s.trim()}`)}return new Jlt(n,e.status,r,e.statusText,i,s)}async function Oh(e,t){if(!e.ok)throw await Uge(e,t);return e.json()}async function ect(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),Oh(await yh(`/spaces?${t}`,{signal:e.signal}),"读取 Skill 空间失败")}async function tct(e){return Oh(await yh("/spaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),"创建 Skill 空间失败")}async function nct(e){return Oh(await yh(`/spaces/${encodeURIComponent(e.spaceId)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.name,description:e.description,region:e.region})}),"更新 Skill 空间失败")}async function rct(e){const t=new URLSearchParams({region:e.region});await Oh(await yh(`/spaces/${encodeURIComponent(e.spaceId)}?${t}`,{method:"DELETE"}),"删除 Skill 空间失败")}async function ict(e){const t=new URLSearchParams({region:e.region});return e.project&&t.set("project",e.project),Oh(await yh(`/spaces/${encodeURIComponent(e.spaceId)}/skills?${t}`,{method:"POST",headers:{"Content-Type":"application/zip"},body:e.file},Zi),"上传 Skill 失败")}async function sct(e){return Oh(await yh("/validate",{method:"POST",headers:{"Content-Type":"application/zip"},body:e},Zi),"校验 Skill 失败")}async function act(e){const t=new URLSearchParams({region:e.region});await Oh(await yh(`/spaces/${encodeURIComponent(e.spaceId)}/skills/${encodeURIComponent(e.skillId)}?${t}`,{method:"DELETE"}),"删除 Skill 失败")}async function oct(e){const t=new URLSearchParams({region:e.region});e.version&&t.set("version",e.version),e.skillSpaceName&&t.set("skill_space_name",e.skillSpaceName),e.skillName&&t.set("skill_name",e.skillName);const n=await Oh(await yh(`/spaces/${encodeURIComponent(e.spaceId)}/skills/${encodeURIComponent(e.skillId)}/files?${t}`),"读取 Skill 文件失败");return Array.isArray(n.files)?n.files:[]}async function lct(e){var l;const t=new URLSearchParams({region:e.region});e.version&&t.set("version",e.version),e.skillSpaceName&&t.set("skill_space_name",e.skillSpaceName),e.skillName&&t.set("skill_name",e.skillName);const n=await yh(`/spaces/${encodeURIComponent(e.spaceId)}/skills/${encodeURIComponent(e.skillId)}/archive?${t}`,{},Zi);n.ok||await Oh(n,"下载 Skill 失败");const i=((l=(n.headers.get("content-disposition")||"").match(/filename="([^"]+)"/))==null?void 0:l[1])||`${e.fallbackName}.zip`,s=URL.createObjectURL(await n.blob()),a=document.createElement("a");a.href=s,a.download=i,a.click(),URL.revokeObjectURL(s)}async function Pj(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:nl(void 0,_o)});if(!t.ok)throw await Uge(t,"AgentKit Skills 请求失败");return t.json()}async function Fge(){return(await Pj("/web/skill-spaces")).items||[]}async function zge(e,t){const n=t?`?region=${encodeURIComponent(t)}`:"";return(await Pj(`/web/skill-spaces/${encodeURIComponent(e)}/skills${n}`)).items||[]}async function cct(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),Pj(`/web/skill-spaces/${encodeURIComponent(e)}/skills?${n.toString()}`)}async function uct(e,t,n,r,i,s,a){const l=[];n&&l.push(`version=${encodeURIComponent(n)}`),r&&l.push(`region=${encodeURIComponent(r)}`),i&&l.push(`project=${encodeURIComponent(i)}`),s&&l.push(`skill_name=${encodeURIComponent(s)}`),a&&l.push(`skill_space_name=${encodeURIComponent(a)}`);const c=l.length>0?`?${l.join("&")}`:"";return Pj(`/web/skill-spaces/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}${c}`)}function dct(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 fct(e,t,n="volcengine"){return n==="byteplus"?"":`https://console.volcengine.com/agentkit/${(t||"cn-beijing")==="cn-beijing"?"cn":"cn-shanghai"}/skillspace/detail/${encodeURIComponent(e)}`}const hct="/web/skill-workbench";class xL extends Error{constructor(t,n,r="SKILL_WORKBENCH_ERROR",i=!1,s="",a,l=""){super(t),this.status=n,this.code=r,this.retryable=i,this.statusText=s,this.originalError=a,this.rawResponse=l,this.name="SkillWorkbenchApiError"}}function Dc(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t}格式错误。`);return e}function MW(e,t){if(e!=null){if(typeof e!="string"||!e.trim()||e.trim().length>256)throw new Error(`${t}格式错误。`);return e.trim()}}function pct(e){if(e!=null){if(e==="pending"||e==="ready"||e==="failed"||e==="unknown")return e;throw new Error("Skill 恢复点状态格式错误。")}}async function yd(e,t={},n=_o){return fetch(xo(`${hct}${e}`),{...t,headers:fh(t.headers),signal:nl(t.signal,n)})}async function NB(e,t){var r;const n=await e.text().catch(()=>"");try{const i=Dc(JSON.parse(n),"错误响应"),s=i.detail&&typeof i.detail=="object"?Dc(i.detail,"错误详情"):i;return new xL(typeof s.message=="string"?s.message:t,e.status,typeof s.code=="string"?s.code:"SKILL_WORKBENCH_ERROR",s.retryable===!0,e.statusText,s.originalError&&typeof s.originalError=="object"?s.originalError:void 0,n)}catch{const i=((r=e.headers.get("content-type"))==null?void 0:r.split(";",1)[0])||"Content-Type 缺失";return new xL(`${t}(HTTP ${e.status},Content-Type: ${i})。请检查代理或网关配置。`,e.status,"SKILL_WORKBENCH_ERROR",!1,e.statusText,void 0,n)}}async function Yp(e,t){if(!e.ok)throw await NB(e,t);const n=e.headers.get("content-type")??"";if(!n.includes("application/json")){const r=n.split(";",1)[0]||"Content-Type 缺失";throw new Error(`${t}:服务端返回非 JSON 响应(HTTP ${e.status},Content-Type: ${r}),请检查代理或网关配置。`)}return e.json()}function mct(e){return Array.isArray(e)?e.map(t=>{const n=Dc(t,"Skill 会话活动"),r=n.kind,i=n.status;if(typeof n.id!="string"||!["status","thinking","message","tool"].includes(String(r))||!["running","done"].includes(String(i)))throw new Error("Skill 会话活动格式错误。");if(r==="tool"){if(typeof n.name!="string")throw new Error("Skill 工具活动格式错误。");return{id:n.id,kind:r,status:i,name:n.name,...n.input!==void 0?{args:n.input}:{},...n.output!==void 0?{response:n.output}:{}}}if(typeof n.text!="string")throw new Error("Skill 文本活动格式错误。");return{id:n.id,kind:r,status:i,text:n.text}}):[]}function gct(e){if(e==null)return;const t=Dc(e,"Skill 发布结果");if(typeof t.revision!="number"||typeof t.skillId!="string"||typeof t.version!="string"||!Array.isArray(t.skillSpaceIds)||!t.skillSpaceIds.every(n=>typeof n=="string")||t.disposition!=="create-new"&&t.disposition!=="update-source"||!HS(t.region)||typeof t.projectName!="string")throw new Error("Skill 发布结果格式错误。");return{revision:t.revision,skillId:t.skillId,version:t.version,skillSpaceIds:t.skillSpaceIds,disposition:t.disposition,region:t.region,projectName:t.projectName}}function Ww(e){const t=Dc(e,"Skill 会话");if(typeof t.jobId!="string"||t.operation!=="create"&&t.operation!=="optimize"||typeof t.intent!="string"||typeof t.revision!="number"||typeof t.state!="string")throw new Error("Skill 会话格式错误。");const n=Array.isArray(t.files)?t.files.flatMap(l=>{const c=Dc(l,"Skill 文件");return typeof c.path=="string"&&typeof c.size=="number"?[{path:c.path,size:c.size}]:[]}):[];if(!["running","ready","failed","cancelled","expired","published"].includes(t.state))throw new Error("Skill 会话状态无法识别。");const i=MW(t.toolId,"Tool ID"),s=MW(t.sessionId,"Session ID"),a=pct(t.recoveryStatus);return{jobId:t.jobId,operation:t.operation,intent:t.intent,...typeof t.model=="string"?{model:t.model}:{},...typeof t.style=="string"?{style:t.style}:{},...typeof t.requestedName=="string"?{requestedName:t.requestedName}:{},revision:t.revision,...i?{toolId:i}:{},...s?{sessionId:s}:{},...typeof t.sessionTtlSeconds=="number"?{sessionTtlSeconds:t.sessionTtlSeconds}:{},...typeof t.expiresAt=="string"?{expiresAt:t.expiresAt}:{},...typeof t.recoveryAvailable=="boolean"?{recoveryAvailable:t.recoveryAvailable}:{},...a?{recoveryStatus:a}:{},...typeof t.recoveredFromSnapshot=="boolean"?{recoveredFromSnapshot:t.recoveredFromSnapshot}:{},state:t.state,stage:typeof t.stage=="string"?t.stage:"generating",activities:mct(t.activities),files:n,...t.source&&typeof t.source=="object"?{source:t.source}:{},...typeof t.name=="string"?{name:t.name}:{},...typeof t.description=="string"?{description:t.description}:{},...typeof t.skillMd=="string"?{skillMd:t.skillMd}:{},...typeof t.error=="string"?{error:t.error}:{},...t.validation&&typeof t.validation=="object"?{validation:t.validation}:{},...t.publication?{publication:gct(t.publication)}:{}}}async function Mj(e){const t=Dc(await Yp(await yd("/capabilities",{signal:e}),"读取 Skill 工作台能力失败"),"Skill 工作台能力");return{enabled:t.enabled===!0,reason:typeof t.reason=="string"?t.reason:"",operations:Array.isArray(t.operations)?t.operations.filter(n=>n==="create"||n==="optimize"):[],models:Array.isArray(t.models)?t.models.flatMap(n=>{if(!n||typeof n!="object")return[];const r=n;return typeof r.id=="string"&&typeof r.label=="string"?[{id:r.id,label:r.label}]:[]}):[],styles:t.styles&&typeof t.styles=="object"&&!Array.isArray(t.styles)?Object.fromEntries(Object.entries(t.styles).filter(n=>typeof n[1]=="string")):{},...typeof t.maxUploadBytes=="number"?{maxUploadBytes:t.maxUploadBytes}:{}}}async function bct(e){if(e.file){const n=new URLSearchParams({operation:"optimize",intent:e.intent});e.jobId&&n.set("job_id",e.jobId),e.model&&n.set("model",e.model),e.style&&n.set("style",e.style),e.name&&n.set("name",e.name);const r=await yd(`/tasks/from-upload?${n}`,{method:"POST",body:e.file,headers:{"Content-Type":"application/zip"},signal:e.signal},Zi);return Ww(await Yp(r,"开始优化 Skill 失败"))}const t=await yd("/tasks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operation:e.operation,intent:e.intent,...e.model?{model:e.model}:{},...e.style?{style:e.style}:{},...e.name?{name:e.name}:{},...e.jobId?{jobId:e.jobId}:{},...e.source?{source:{kind:"skill-center",skillId:e.source.skillId,skillName:e.source.name,version:e.source.version,region:e.source.region,projectName:e.source.projectName,skillSpaceId:e.source.skillSpaceId,skillSpaceName:e.source.skillSpaceName}}:{}}),signal:e.signal},Zi);return Ww(await Yp(t,"开始 Skill 会话失败"))}async function yct(e,t){return Ww(await Yp(await yd(`/tasks/${encodeURIComponent(e)}`,{signal:t}),"读取 Skill 会话失败"))}async function xD(e,t,n){const r=new URLSearchParams;r.set("expected_revision",String(t));const i=Dc(await Yp(await yd(`/tasks/${encodeURIComponent(e)}/artifact?${r.toString()}`,{signal:n}),"读取 Skill 产物失败"),"Skill 产物");if(i.jobId!==e||i.revision!==t||!Number.isSafeInteger(i.revision)||i.revision<1||typeof i.sha256!="string"||!/^[0-9a-f]{64}$/.test(i.sha256)||typeof i.name!="string"||typeof i.description!="string"||!Array.isArray(i.files))throw new Error("Skill 产物格式错误。");const s=i.files.map(a=>{const l=Dc(a,"Skill 产物文件");if(typeof l.path!="string"||typeof l.size!="number"||typeof l.content!="string")throw new Error("Skill 产物文件格式错误。");return{path:l.path,size:l.size,content:l.content}});return{jobId:i.jobId,revision:i.revision,sha256:i.sha256,name:i.name,description:i.description,files:s}}async function vD(e){const t=await yd(`/tasks/${encodeURIComponent(e.jobId)}/refinements`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({intent:e.intent,expectedRevision:e.expectedRevision})},Zi);return Ww(await Yp(t,"继续调整 Skill 失败"))}async function Oct(e){const t=await yd(`/tasks/${encodeURIComponent(e.jobId)}/stop`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expectedRevision:e.expectedRevision})});return Ww(await Yp(t,"停止当前 Skill 任务失败"))}async function xct(e){const t=await yd(`/tasks/${encodeURIComponent(e.jobId)}/publish-stream`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/x-ndjson"},body:JSON.stringify({disposition:e.disposition,expectedRevision:e.expectedRevision,expectedArtifactSha256:e.expectedArtifactSha256,skillSpaceIds:e.skillSpaceIds??[],projectName:e.projectName,region:e.region}),signal:e.signal},0);if(!t.ok)throw await NB(t,"发布 Skill 失败");if(!(t.headers.get("content-type")??"").includes("application/x-ndjson"))throw new Error("发布 Skill 失败:服务端返回了非 NDJSON 响应。");if(!t.body)throw new Error("发布 Skill 失败:服务端没有返回进度流。");const r=new Set(["preparing","uploading","registering","activating","publishing"]);let i=null,s="";const a=new TextDecoder,l=t.body.getReader(),c=u=>{var h;if(!u.trim())return;const d=Dc(JSON.parse(u),"发布进度");if(d.type==="progress"){if(typeof d.phase!="string"||!r.has(d.phase)||typeof d.message!="string")throw new Error("发布进度格式错误。");(h=e.onProgress)==null||h.call(e,{phase:d.phase,message:d.message});return}if(d.type==="error"){const m=Dc(d.error,"发布错误");throw new xL(typeof m.message=="string"?m.message:"发布 Skill 失败",500,typeof m.code=="string"?m.code:"SKILL_PUBLISH_FAILED",m.retryable===!0,"",m.originalError&&typeof m.originalError=="object"?m.originalError:void 0,JSON.stringify(d.error))}if(d.type!=="complete")throw new Error("未知的发布进度事件。");const f=Dc(d.result,"发布结果");if(typeof f.skillId!="string"||typeof f.version!="string"||!Array.isArray(f.skillSpaceIds)||!f.skillSpaceIds.every(m=>typeof m=="string")||f.disposition!=="create-new"&&f.disposition!=="update-source"||!HS(f.region)||typeof f.projectName!="string")throw new Error("发布结果格式错误。");i={skillId:f.skillId,version:f.version,skillSpaceIds:f.skillSpaceIds,disposition:f.disposition,region:f.region,projectName:f.projectName}};for(;;){const{value:u,done:d}=await l.read();s+=a.decode(u,{stream:!d});const f=s.split(` -`);if(s=f.pop()??"",f.forEach(c),d)break}if(c(s),!i)throw new Error("发布进度流提前结束,无法确认发布结果。请刷新技能中心确认状态。");return i}async function vct(e){await Yp(await yd(`/tasks/${encodeURIComponent(e)}`,{method:"DELETE"}),"删除 Skill 会话失败")}async function wct(e,t,n){var c;const r=new URLSearchParams;r.set("expected_revision",String(t)),r.set("expected_sha256",n);const i=await yd(`/tasks/${encodeURIComponent(e)}/download?${r.toString()}`,{},Zi);if(!i.ok)throw await NB(i,"下载 Skill 失败");const a=((c=(i.headers.get("content-disposition")??"").match(/filename="([^"]+)"/))==null?void 0:c[1])??"skill.zip",l=URL.createObjectURL(await i.blob());try{const u=document.createElement("a");u.href=l,u.download=a,u.click()}finally{URL.revokeObjectURL(l)}}const Sct={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 Ect(e,t){if(!t||t==="/")return e;const n=t.replace(/^\//,"").split("/").map(i=>i.replace(/~1/g,"/").replace(/~0/g,"~"));let r=e;for(const i of n){if(r==null||typeof r!="object")return;r=r[i]}return r}function kct(e){return typeof e=="object"&&e!==null&&typeof e.path=="string"}function _ct(e){return typeof e=="object"&&e!==null&&typeof e.call=="string"}function jB(e,t){if(kct(e))return Ect(t,e.path);if(_ct(e)){const n=Sct[e.call],r={};for(const[i,s]of Object.entries(e.args??{}))r[i]=jB(s,t);return n?n(r):`[unknown fn: ${e.call}]`}return e}function Tct(e,t){const n=jB(e,t);return n==null?"":typeof n=="string"?n:String(n)}const Vge=new Map;function S0(e,t){Vge.set(e,t)}function Cct(e){return Vge.get(e)}function Act(e,t,n){const r=t.replace(/^\//,"").split("/").map(s=>s.replace(/~1/g,"/").replace(/~0/g,"~"));let i=e;for(let s=0;sjB(r,e.dataModel),resolveString:r=>Tct(r,e.dataModel),dispatchAction:t,render:r=>{if(!r)return null;const i=e.components[r];if(!i)return null;const s=Cct(i.component)??Nct;return o.jsx(s,{node:i,ctx:n},r)}};return o.jsx("div",{className:"a2ui-surface","data-a2ui-surface":e.surfaceId,children:n.render(e.rootId)})}function qge(e){const t=p.useRef(null),n=p.useRef(!0),r=28,i=p.useCallback(()=>{const s=t.current;s&&(n.current=s.scrollHeight-s.scrollTop-s.clientHeight{const s=t.current;s&&n.current&&(s.scrollTop=s.scrollHeight)},[e]),{ref:t,onScroll:i}}function Lj({value:e,skillPrefix:t="/",onRemoveSkill:n,onRemoveAgent:r}){return e.skills.length===0&&!e.targetAgent?null:o.jsxs("div",{className:"invocation-chips","aria-label":"本轮调用上下文",children:[e.skills.map(i=>o.jsxs("span",{className:"invocation-chip invocation-chip--skill",title:i.description,children:[o.jsx(xw,{"aria-hidden":!0}),o.jsxs("span",{children:[t,i.name]}),n?o.jsx("button",{type:"button",onClick:()=>n(i.name),"aria-label":`移除技能 ${i.name}`,children:o.jsx(Oa,{})}):null]},i.name)),e.targetAgent?o.jsxs("span",{className:"invocation-chip invocation-chip--agent",title:e.targetAgent.description,children:[o.jsx(Rae,{"aria-hidden":!0}),o.jsx("span",{children:e.targetAgent.name}),r?o.jsx("button",{type:"button",onClick:r,"aria-label":`移除 Agent ${e.targetAgent.name}`,children:o.jsx(Oa,{})}):null]}):null]})}function RB(e=""){return e.startsWith("image/")?"image":e.startsWith("video/")?"video":e==="application/pdf"?"pdf":e==="text/markdown"?"markdown":"text"}function Xge(e){var n,r,i,s;const t=RB(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"?((s=(i=e.mimeType)==null?void 0:i.split("/")[1])==null?void 0:s.toUpperCase())??"IMAGE":"TXT"}function Gge(e){return e?e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:""}function Wge(e,t){return e.previewUrl?e.previewUrl:e.data?`data:${e.mimeType??"application/octet-stream"};base64,${e.data}`:e.uri?doe(t,e.uri):""}function Rct({kind:e}){return e==="image"?o.jsx(r9,{}):e==="video"?o.jsx(Pae,{}):e==="pdf"?o.jsx(HRe,{}):o.jsx(t9,{})}function $j({appName:e,items:t,compact:n=!1,onRemove:r}){const[i,s]=p.useState(null);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`media-grid${n?" media-grid--compact":""}`,children:t.map(a=>{const l=RB(a.mimeType),c=Wge(a,e),u=a.status==="uploading"||a.status==="error"||!c,d=o.jsxs("button",{type:"button",className:"media-card-main",disabled:u,onClick:l==="image"?void 0:()=>s(a),"aria-label":`预览 ${a.name??"附件"}`,children:[l==="image"&&c?o.jsx("img",{className:"media-card-image",src:c,alt:a.name??"图片",loading:"lazy"}):l==="video"&&c?o.jsxs("div",{className:"media-card-video-container",children:[o.jsx("video",{className:"media-card-video",src:c,muted:!0,playsInline:!0,preload:"metadata","aria-hidden":"true"}),o.jsx("span",{className:"media-card-video-play",children:o.jsx(rIe,{})})]}):o.jsx("span",{className:"media-card-icon",children:o.jsx(Rct,{kind:l})}),o.jsxs("span",{className:"media-card-copy",children:[o.jsx("span",{className:"media-card-name",children:a.name??"附件"}),o.jsxs("span",{className:"media-card-meta",children:[o.jsx("span",{className:"media-card-type",children:Xge(a)}),a.status==="uploading"?o.jsxs(o.Fragment,{children:[o.jsx(lr,{className:"media-card-spinner"})," 上传中"]}):a.status==="error"?a.error??"上传失败":Gge(a.sizeBytes)]})]}),!n&&a.status!=="uploading"&&a.status!=="error"?o.jsx(uy,{className:"media-card-open"}):null]});return o.jsxs(oi.div,{className:`media-card media-card--${l}${a.status==="error"?" media-card--error":""}`,layout:!0,initial:{opacity:0,scale:.985,y:4},animate:{opacity:1,scale:1,y:0},children:[l==="image"&&!u?o.jsx(Eae,{src:c,children:d}):d,r?o.jsx("button",{type:"button",className:"media-card-remove","aria-label":`移除 ${a.name??"附件"}`,onClick:()=>r(a.id),children:o.jsx(Oa,{})}):null]},a.id)})}),o.jsx(hu,{children:i?o.jsx(Ict,{appName:e,item:i,onClose:()=>s(null)}):null})]})}function Ict({appName:e,item:t,onClose:n}){const r=p.useMemo(()=>Wge(t,e),[e,t]),i=RB(t.mimeType),[s,a]=p.useState(""),[l,c]=p.useState(i==="text"||i==="markdown"),[u,d]=p.useState("");return p.useEffect(()=>{const f=h=>{h.key==="Escape"&&n()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[n]),p.useEffect(()=>{if(i!=="text"&&i!=="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()},[i,r]),o.jsx(oi.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:o.jsxs(oi.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:[o.jsxs("header",{className:"media-viewer-header",children:[o.jsxs("div",{children:[o.jsx("strong",{children:t.name??"附件"}),o.jsxs("span",{children:[Xge(t),t.sizeBytes?` · ${Gge(t.sizeBytes)}`:""]})]}),o.jsxs("nav",{children:[o.jsx("a",{href:r,download:t.name,"aria-label":"下载",children:o.jsx(NN,{})}),o.jsx("button",{type:"button",onClick:n,"aria-label":"关闭",children:o.jsx(Oa,{})})]})]}),o.jsxs("div",{className:`media-viewer-body media-viewer-body--${i}`,children:[i==="image"?o.jsx("img",{src:r,alt:t.name??"图片"}):null,i==="video"?o.jsx("div",{className:"media-viewer-video-wrapper",children:o.jsx("video",{src:r,controls:!0,autoPlay:!0,playsInline:!0,preload:"auto",className:"media-viewer-video"})}):null,i==="pdf"?o.jsx("iframe",{src:r,title:t.name??"PDF"}):null,l?o.jsxs("div",{className:"media-viewer-loading",children:[o.jsx(lr,{})," 正在读取文档…"]}):null,!l&&u?o.jsxs("div",{className:"media-viewer-loading",children:["文档加载失败:",u]}):null,!l&&i==="markdown"?o.jsx("div",{className:"media-document",children:o.jsx(xu,{text:s})}):null,!l&&i==="text"?o.jsx("pre",{className:"media-document media-document--plain",children:s}):null]})]})})}function Dct(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"10.25",cy:"10.25",r:"6.25"}),o.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 Pct(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.25",y:"5.25",width:"15.5",height:"13.5",rx:"2.25"}),o.jsx("circle",{cx:"8.1",cy:"9.3",r:"1.35"}),o.jsx("path",{d:"m4.7 16.5 3.65-3.7 2.45 2.25 2.2-2.2 4.35 4.1"}),o.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 IB(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{className:"video-generate-icon__body",d:"M3.25 9h17.5v7.35a2.4 2.4 0 0 1-2.4 2.4H5.65a2.4 2.4 0 0 1-2.4-2.4V9Z"}),o.jsxs("g",{className:"video-generate-icon__clapper",children:[o.jsx("path",{d:"M3.25 9V7.65a2.4 2.4 0 0 1 2.4-2.4h12.7a2.4 2.4 0 0 1 2.4 2.4V9H3.25Z"}),o.jsx("path",{d:"M6.75 5.25 9.3 9M12 5.25 14.55 9M17.25 5.25 19.8 9"})]}),o.jsx("path",{d:"m10.25 11.45 4 2.55-4 2.55v-5.1Z"})]})}function Mct(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M4.25 5.25h15.5v10.5H4.25zM8.25 19.75h7.5M12 15.75v4"}),o.jsx("path",{d:"m7.25 12.75 2.35-2.4 2.15 1.65 3.4-3.6 1.6 1.55"}),o.jsx("circle",{cx:"7.25",cy:"8.4",r:".7",fill:"currentColor",stroke:"none"})]})}function Lct(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.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"}),o.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"}),o.jsx("path",{d:"M8.2 12.25h.01M8.2 16.8h.01"})]})}function $ct(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M4.25 4.25h4.5v15.5h-4.5zM8.75 5.75h5v14h-5zM13.75 4.25h4.1v10.25h-4.1z"}),o.jsx("path",{d:"M5.75 7h1.5M10.25 8.25h2M10.25 11h2M15.15 7h1.3"}),o.jsx("circle",{cx:"17.45",cy:"17.35",r:"2.45"}),o.jsx("path",{d:"m19.25 19.15 1.55 1.55"})]})}function Bct(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.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"}),o.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"}),o.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 Qct(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"m4.2 8.4 1.15 10.2h13.3L19.8 8.4"}),o.jsx("path",{d:"M4.2 8.4h15.6L17.9 5H6.1L4.2 8.4Z"}),o.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"}),o.jsx("path",{d:"m8.2 15.1 1.45 1.35 1.45-1.35M13.55 16.45h2.35"})]})}function Uct(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"6",cy:"6.25",r:"2.25"}),o.jsx("circle",{cx:"18",cy:"6.25",r:"2.25"}),o.jsx("circle",{cx:"12",cy:"17.75",r:"2.25"}),o.jsx("path",{d:"m7.7 7.75 2.7 7.55M16.3 7.75l-2.7 7.55M8.25 6.25h7.5"})]})}function LW(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"9",cy:"8",r:"3"}),o.jsx("path",{d:"M3.75 18.75c.45-3.05 2.2-4.65 5.25-4.65s4.8 1.6 5.25 4.65"}),o.jsx("path",{d:"M17.75 4.25v5.5M15 7h5.5M16 13.25h4.25M18.125 11.125v4.25"})]})}function Fct(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"4",y:"4.25",width:"16",height:"5",rx:"1.5"}),o.jsx("rect",{x:"4",y:"14.75",width:"16",height:"5",rx:"1.5"}),o.jsx("path",{d:"M7.25 6.75h.01M7.25 17.25h.01M10 6.75h6.5M10 17.25h6.5"})]})}function zct(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M6 3.75h8l4 4v12.5H6V3.75Z"}),o.jsx("path",{d:"M14 3.75v4h4M8.75 11h6.5M8.75 14.25h6.5M8.75 17.5h4"})]})}function Vct(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.75",y:"4.5",width:"16.5",height:"15",rx:"2.5"}),o.jsx("path",{d:"m7.5 9 2.75 2.5L7.5 14M12.5 14h4"}),o.jsx("path",{d:"M3.75 7.5h16.5",opacity:".62"})]})}function DB(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m6 3.25 4.5 4.75L6 12.75"})})}function Hct({definition:e,label:t,done:n,open:r,onToggle:i}){const s=e.icon,a=t??(n?e.doneLabel:e.runningLabel);return o.jsxs("button",{type:"button",className:`builtin-tool-head${n?" is-done":" is-running"}`,"data-tool-tone":e.tone,onClick:i,"aria-expanded":r,children:[o.jsx("span",{className:"builtin-tool-icon","aria-hidden":"true",children:o.jsx(s,{})}),n?o.jsx("span",{className:"builtin-tool-label",children:a}):o.jsx(En,{className:"builtin-tool-label",duration:2.4,spread:18,"aria-live":"polite",children:a}),o.jsx(DB,{className:`builtin-tool-chevron${r?" is-open":""}`})]})}function $l(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function yn(e){return typeof e=="string"?e:""}function $W(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function kc(e){return Array.isArray(e)?e:[]}function vL(e){let t=e;if(typeof t=="string")try{t=JSON.parse(t)}catch{return{}}const n=$l(t)??{};return $l(n.result)??n}function Bj(e){if(typeof e=="string")try{return Bj(JSON.parse(e))}catch{return e}const t=$l(e);if(!t)return"";const n=$l(t.result);return yn(t.error)||yn(t.message)||yn(n==null?void 0:n.error)||yn(n==null?void 0:n.message)}function qct(e){if(e.kind==="tool")return"tool";if(e.kind==="knowledge_base")return"knowledge_base";const t=$l(e.metadata),n=yn(t==null?void 0:t.source_type).toLowerCase(),r=yn(e.source).toLowerCase();return n==="skillhub"||r.startsWith("skill_hub:")?"skill_hub":"skill_space"}function Xct(e){return e==="veadk_builtin_tools"?"工具":e==="agentkit_knowledge"?"AgentKit 知识库":e.startsWith("skill_hub:")?`Skill Hub ${e.slice(10)}`:e.startsWith("skill_space:")?`AgentKit 技能中心 ${e.slice(12)}`:e||"未知来源"}function Gct(e){return e==="veadk_builtin_tools"?"tool":e==="agentkit_knowledge"?"knowledge_base":e.startsWith("skill_hub:")?"skill_hub":"skill_space"}function Wct(e){const t=vL(e),n=$l(t.capabilities)??{},r=kc(t.resources).flatMap(s=>{const a=$l(s);if(!a)return[];const l=a.kind==="tool"?"tool":a.kind==="knowledge_base"?"knowledge_base":"skill";return[{ref:yn(a.ref),kind:l,category:qct(a),name:yn(a.name)||yn(a.ref)||"未命名资源",description:yn(a.description),source:yn(a.source),version:yn(a.version)}]}),i=kc(t.sources).flatMap(s=>{const a=$l(s);if(!a)return[];const l=yn(a.source),c=yn(a.status),u=c==="error"?"error":c==="skipped"?"skipped":"ok";return[{source:l,category:Gct(l),label:Xct(l),status:u,count:$W(a.count),message:yn(a.message),searchKeywords:kc(a.search_keywords).map(yn).filter(Boolean)}]});return{collectionId:yn(t.collection_id),capabilities:{googleAdkVersion:yn(n.google_adk_version),agentTypes:kc(n.agent_types).map(yn).filter(Boolean),maxOrchestrationDepth:$W(n.max_orchestration_depth)},resources:r,sources:i,counts:{all:r.length,skill_hub:r.filter(s=>s.category==="skill_hub").length,skill_space:r.filter(s=>s.category==="skill_space").length,knowledge_base:r.filter(s=>s.category==="knowledge_base").length,tool:r.filter(s=>s.category==="tool").length}}}function Yct(e,t){return{resources:e.resources.filter(n=>n.category===t),sources:e.sources.filter(n=>n.category===t)}}function Yge(e,t){const n=vL(e),r=vL(t),i=new Map(kc(r.results).flatMap(u=>{const d=$l(u),f=yn(d==null?void 0:d.name);return d&&f?[[f,d]]:[]})),s=kc(n.agents).flatMap(u=>{const d=$l(u),f=yn(d==null?void 0:d.name);return d&&f?[d]:[]}),a=new Set(s.map(u=>yn(u.name))),l=[...i.entries()].filter(([u])=>!a.has(u)).map(([u])=>({name:u})),c=[...s,...l].map(u=>{const d=yn(u.name),f=kc(u.nodes).flatMap(E=>{const k=$l(E);return k?[k]:[]}),h=yn(u.root_node),m=f.find(E=>yn(E.id)===h),g=f.filter(E=>yn(E.id)!==h).map(E=>({id:yn(E.id)||"未命名 Agent",type:yn(E.type)||"llm",description:yn(E.description)})),b=i.get(d),y=yn(b==null?void 0:b.status),O=y==="failed"?"failed":y==="completed"?"completed":"running",v=BW(b==null?void 0:b.resources),x=v.length>0?v:BW(f.flatMap(E=>kc(E.resources))),w=QW(b==null?void 0:b.python_tools),S=w.length>0?w:QW(f.flatMap(E=>kc(E.python_tools)));return{name:d,description:yn(b==null?void 0:b.description)||yn(m==null?void 0:m.description)||yn(u.task),task:yn(u.task),rootType:yn(b==null?void 0:b.root_type)||yn(m==null?void 0:m.type)||"llm",nodeCount:f.length,subAgentCount:g.length,resourceCount:x.length,pythonToolCount:S.length,skills:x.filter(E=>E.kind==="skill"),knowledgeBases:x.filter(E=>E.kind==="knowledge_base"),builtinTools:x.filter(E=>E.kind==="tool"),pythonTools:S,subAgents:g,status:O,output:yn(b==null?void 0:b.output),error:yn(b==null?void 0:b.error)}});return{collectionId:yn(r.collection_id)||yn(n.collection_id),agents:c,completedCount:c.filter(u=>u.status==="completed").length,failedCount:c.filter(u=>u.status==="failed").length,runningCount:c.filter(u=>u.status==="running").length}}function Zct(e,t){return!!Bj(t)||Yge(e,t).failedCount>0}function BW(e){const t=new Set;return kc(e).flatMap(n=>{const r=$l(n),i=yn(r?r.ref:n);if(!i||t.has(i))return[];t.add(i);const s=yn(r==null?void 0:r.kind),a=s==="tool"||i.startsWith("veadk_tool:")?"tool":s==="knowledge_base"||i.startsWith("agentkit_kb:")?"knowledge_base":"skill",l=i.split(":");return[{ref:i,kind:a,name:yn(r==null?void 0:r.name)||l[l.length-1]||i,description:yn(r==null?void 0:r.description),version:yn(r==null?void 0:r.version),source:yn(r==null?void 0:r.source)}]})}function QW(e){const t=new Set;return kc(e).flatMap(n=>{const r=$l(n),i=yn(r==null?void 0:r.name),s=yn(r==null?void 0:r.code),a=`${i}\0${s}`;return!r||!i||t.has(a)?[]:(t.add(a),[{name:i,description:yn(r.description),code:s,entrypoint:yn(r.entrypoint)||i,dependencies:kc(r.dependencies).map(yn).filter(Boolean)}])})}function Kct({branch:e}){return o.jsxs("div",{className:`branch-compare__body${e.status==="running"?" is-streaming":""}`,"aria-live":"polite",children:[e.content?o.jsx(xu,{text:e.content,streaming:e.status==="running"}):null,e.status==="running"?o.jsx("span",{className:"branch-compare__caret","aria-hidden":"true"}):null,e.error?o.jsx("p",{className:"branch-compare__error",children:e.error}):null]})}function Jct({args:e,response:t,status:n,onBranchSelect:r}){const i=p.useMemo(()=>vle(e,t,n),[e,t,n]),[s,a]=p.useState(0);return o.jsxs("section",{className:"branch-compare","aria-label":"分支对比",children:[o.jsx("div",{className:"branch-compare__tabs",role:"tablist","aria-label":"选择方向",children:i.branches.map((l,c)=>o.jsx("button",{className:`branch-compare__tab${s===c?" is-active":""}`,type:"button",role:"tab","aria-selected":s===c,"aria-controls":`branch-compare-panel-${c}`,onClick:()=>a(c),children:o.jsx(ta,{color:"info",size:"sm",variant:"soft",children:l.label})},`${l.label}:${c}`))}),o.jsx("div",{className:"branch-compare__branches",children:i.branches.map((l,c)=>o.jsxs("article",{className:`branch-compare__branch${s===c?" is-active":""}`,id:`branch-compare-panel-${c}`,role:"tabpanel",children:[o.jsx("header",{className:"branch-compare__head",children:o.jsx(ta,{color:"info",size:"sm",variant:"soft",children:l.label})}),o.jsx(Kct,{branch:l}),o.jsx("footer",{className:"branch-compare__footer",children:o.jsx(Nt,{type:"button",color:"info",variant:"ghost",size:"sm",pill:!1,disabled:l.status!=="completed",onClick:()=>r==null?void 0:r(l),children:"继续这个方向"})})]},`${l.label}:${c}`))})]})}function Zge({controlled:e,default:t,name:n,state:r="value"}){const{current:i}=p.useRef(e!==void 0),[s,a]=p.useState(t),l=i?e:s,c=p.useCallback(u=>{i||a(u)},[]);return[l,c]}const PB={...r0},UW={};function qg(e,t){const n=p.useRef(UW);return n.current===UW&&(n.current=e(t)),n}const wD=PB.useInsertionEffect,eut=wD&&wD!==PB.useLayoutEffect?wD:e=>e();function ja(e){const t=qg(tut).current;return t.next=e,eut(t.effect),t.trampoline}function tut(){const e={next:void 0,callback:nut,trampoline:(...t)=>{var n;return(n=e.callback)==null?void 0:n.call(e,...t)},effect:()=>{e.callback=e.next}};return e}function nut(){}const rut=()=>{},Zo=typeof document<"u"?p.useLayoutEffect:rut,Kge=p.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function iut(){return p.useContext(Kge)}function sut(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,s=ja(i),[,a]=p.useState(!1),l=qg(out).current,c=qg(aut).current,u=p.useRef(0),d=p.useRef(!0),f=p.useRef([]),h=p.useRef(null),m=ja(()=>{d.current||(d.current=!0,a(S=>!S))}),g=ja((S,E)=>{c.set(S,E),m()}),b=ja(S=>{c.delete(S),m()}),y=ja(S=>{const E=new Map;return n.current.length=0,r&&(r.current.length=0),S.forEach(k=>{var _,C;E.set(k.element,{...k.registration.metadata??{},index:k.index}),n.current[k.index]=k.element,r&&(r.current[k.index]=k.registration.label!==void 0?k.registration.label:((C=(_=k.registration.textRef)==null?void 0:_.current)==null?void 0:C.textContent)??k.element.textContent)}),u.current=n.current.length,E});function O(S){var _;if((_=h.current)==null||_.disconnect(),h.current=null,typeof MutationObserver!="function"||S.length<2)return;const E=new MutationObserver(C=>{if(!uut(C))return;let T=null;for(const A of S)if(A.isConnected){if(T&&Jge(T,A)>0){E.disconnect(),m();return}T=A}});h.current=E;const k=new Set;for(let C=1;CE.observe(C,{childList:!0}))}const v=ja(()=>{const[S,E]=lut(c),k=y(S);O(E),f.current=S,d.current=!1,l.forEach(_=>_(k)),s(k)});Zo(()=>(d.current||y(f.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,y]),Zo(()=>{d.current&&v()}),Zo(()=>()=>{var S;(S=h.current)==null||S.disconnect(),d.current=!0},[]);const x=ja(S=>(l.add(S),()=>{l.delete(S)})),w=p.useMemo(()=>({register:g,unregister:b,subscribeMapChange:x,nextIndexRef:u}),[g,b,x,u]);return o.jsx(Kge.Provider,{value:w,children:t})}function aut(){return new Map}function out(){return new Set}function lut(e){const t=new Set,n=[],r=[];e.forEach((s,a)=>{if(!a.isConnected)return;const l=s.index,c={index:l??-1,element:a,registration:s};l===null?r.push(c):l>=0&&(t.add(l),n.push(c))});let i=0;return r.sort((s,a)=>Jge(s.element,a.element)),r.forEach(s=>{for(;t.has(i);)i+=1;s.index=i,n.push(s),i+=1}),t.size>0&&n.sort((s,a)=>s.index-a.index),[n,r.map(s=>s.element)]}function cut(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function uut(e){for(const t of e)for(let n=0;ns.searchParams.append("args[]",a)),`${t} error #${r}; visit ${s} for the full message.`}}const CE=dut("https://base-ui.com/production-error","Base UI"),e0e=p.createContext(void 0);function t0e(){const e=p.useContext(e0e);if(e===void 0)throw new Error(CE(10));return e}function sA(e,t,n,r){const i=qg(n0e).current;return hut(i,e,t,n,r)&&r0e(i,[e,t,n,r]),i.callback}function fut(e){const t=qg(n0e).current;return put(t,e)&&r0e(t,e),t.callback}function n0e(){return{callback:null,cleanup:null,refs:[]}}function hut(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function put(e,t){return e.refs.length!==t.length||e.refs.some((n,r)=>n!==t[r])}function r0e(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const r=Array(t.length).fill(null);for(let i=0;i{for(let i=0;i=e}function FW(e){if(!p.isValidElement(e))return null;const t=e,n=t.props;return(gut(19)?n==null?void 0:n.ref:t.ref)??null}function wL(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}const but=Object.freeze([]),Gb=Object.freeze({});function yut(e,t){const n={};for(const r in e){const i=e[r];if(t!=null&&t.hasOwnProperty(r)){const s=t[r](i);s!=null&&Object.assign(n,s);continue}i===!0?n[`data-${r.toLowerCase()}`]="":i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function Out(e,t){return typeof e=="function"?e(t):e}function i0e(e,t){return typeof e=="function"?e(t):e}const MB={};function LB(e,t,n,r,i){if(!n&&!r&&!e)return aA(t);let s=aA(e);return t&&(s=lT(s,t)),n&&(s=lT(s,n)),r&&(s=lT(s,r)),s}function xut(e){if(e.length===0)return MB;if(e.length===1)return aA(e[0]);let t=aA(e[0]);for(let n=1;n=65&&i<=90&&(typeof t=="function"||typeof t>"u")}function $B(e){return typeof e=="function"}function a0e(e,t){return $B(e)?e(t):e??MB}function Sut(e,t){return t?e?(...n)=>{const r=n[0];if(c0e(r)){const s=r;oA(s);const a=t(...n);return s.baseUIHandlerPrevented||e==null||e(...n),a}const i=t(...n);return e==null||e(...n),i}:o0e(t):e}function o0e(e){return e&&((...t)=>{const n=t[0];return c0e(n)&&oA(n),e(...t)})}function oA(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function l0e(e,t){return t?e?t+" "+e:t:e}function c0e(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function AE(e,t,n={}){const r=t.render,i=Eut(t,n);if(n.enabled===!1)return null;const s=n.state??Gb;return Tut(e,r,i,s)}function Eut(e,t={}){const{className:n,style:r,render:i}=e,{state:s=Gb,ref:a,props:l,stateAttributesMapping:c,enabled:u=!0}=t,d=u?Out(n,s):void 0,f=u?i0e(r,s):void 0,h=u?yut(s,c):Gb,m=u&&l?kut(l):void 0,g=u?wL(h,m)??{}:Gb;return typeof document<"u"&&(u?Array.isArray(a)?g.ref=fut([g.ref,FW(i),...a]):g.ref=sA(g.ref,FW(i),a):sA(null,null)),u?(d!==void 0&&(g.className=l0e(g.className,d)),f!==void 0&&(g.style=wL(g.style,f)),g):Gb}function kut(e){return Array.isArray(e)?xut(e):LB(void 0,e)}const _ut=Symbol.for("react.lazy");function Tut(e,t,n,r){if(t){if(typeof t=="function")return t(n,r);const i=LB(n,t.props);i.ref=n.ref;let s=t;return(s==null?void 0:s.$$typeof)===_ut&&(s=p.Children.toArray(t)[0]),p.cloneElement(s,i)}if(e&&typeof e=="string")return Cut(e,n);throw new Error(CE(8))}function Cut(e,t){return e==="button"?p.createElement("button",{type:"button",...t,key:t.key}):e==="img"?p.createElement("img",{alt:"",...t,key:t.key}):p.createElement(e,t)}const Aut={value:()=>null},u0e=p.forwardRef(function(t,n){const{render:r,className:i,disabled:s=!1,hiddenUntilFound:a,keepMounted:l,loopFocus:c,onValueChange:u,multiple:d=!1,orientation:f="vertical",value:h,defaultValue:m,style:g,...b}=t,y=p.useMemo(()=>{if(h===void 0)return m??[]},[h,m]),O=p.useRef([]),[v,x]=Zge({controlled:h,default:y,name:"Accordion",state:"value"}),w=ja((_,C,T)=>{if(d)if(C){const A=v.slice();if(A.push(_),u==null||u(A,T),T.isCanceled)return;x(A)}else{const A=v.filter(j=>j!==_);if(u==null||u(A,T),T.isCanceled)return;x(A)}else{const A=v[0]===_?[]:[_];if(u==null||u(A,T),T.isCanceled)return;x(A)}}),S=p.useMemo(()=>({value:v,disabled:s,orientation:f}),[v,s,f]),E=p.useMemo(()=>({disabled:s,handleValueChange:w,hiddenUntilFound:a??!1,keepMounted:l??!1,state:S,value:v}),[s,w,a,l,S,v]),k=AE("div",t,{state:S,ref:n,props:b,stateAttributesMapping:Aut});return o.jsx(e0e.Provider,{value:E,children:o.jsx(sut,{elementsRef:O,children:k})})});let zW=0;function Nut(e,t="mui"){const[n,r]=p.useState(e),i=e||n;return p.useEffect(()=>{n==null&&(zW+=1,r(`${t}-${zW}`))},[n,t]),i}const VW=PB.useId;function jut(e,t){if(VW!==void 0){const n=VW();return`${t}-${n}`}return Nut(e,t)}function SL(e){return jut(e,"base-ui")}const Rut="none",Iut="trigger-press";function d0e(e,t,n,r){let i=!1,s=!1;const a=Gb;return{reason:e,event:t??new Event("base-ui"),cancel(){i=!0},allowPropagation(){s=!0},get isCanceled(){return i},get isPropagationAllowed(){return s},trigger:n,...a}}function Dut(e){p.useEffect(e,but)}const T2=null;let Put=class{constructor(){kr(this,"callbacks",[]);kr(this,"callbacksCount",0);kr(this,"nextId",1);kr(this,"startId",1);kr(this,"isScheduled",!1);kr(this,"tick",t=>{var i;this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let s=0;s=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}},C2=new Put;class kl{constructor(){kr(this,"currentId",T2);kr(this,"cancel",()=>{this.currentId!==T2&&(C2.cancel(this.currentId),this.currentId=T2)});kr(this,"disposeEffect",()=>this.cancel)}static create(){return new kl}static request(t){return C2.request(t)}static cancel(t){return C2.cancel(t)}request(t){this.cancel(),this.currentId=C2.request(()=>{this.currentId=T2,t()})}}function Mut(){const e=qg(kl.create).current;return Dut(e.disposeEffect),e}function Lut(e,t=!1,n=!1){const[r,i]=p.useState(e&&t?"idle":void 0),[s,a]=p.useState(e);return e&&!s&&(a(!0),i("starting")),!e&&s&&r!=="ending"&&!n&&i("ending"),!e&&!s&&r==="ending"&&i(void 0),Zo(()=>{if(!e&&s&&r!=="ending"&&n){const l=kl.request(()=>{i("ending")});return()=>{kl.cancel(l)}}},[e,s,r,n]),Zo(()=>{if(!e||t)return;const l=kl.request(()=>{i(void 0)});return()=>{kl.cancel(l)}},[t,e]),Zo(()=>{if(!e||!t)return;e&&s&&r!=="idle"&&i("starting");const l=kl.request(()=>{i("idle")});return()=>{kl.cancel(l)}},[t,e,s,r]),{mounted:s,setMounted:a,transitionStatus:r}}function $ut(e){const{open:t,defaultOpen:n,onOpenChange:r,disabled:i}=e,[s,a]=Zge({controlled:t,default:n,name:"Collapsible",state:"open"}),{mounted:l,setMounted:c,transitionStatus:u}=Lut(s,!0,!0),d=SL(),[f,h]=p.useState(),m=f===null?void 0:f??d,g=ja(b=>{const y=!s,O=d0e(Iut,b.nativeEvent);r(y,O),!O.isCanceled&&a(y)});return p.useMemo(()=>({defaultPanelId:d,disabled:i,handleTrigger:g,mounted:l,open:s,panelId:m,setMounted:c,setOpen:a,setPanelIdState:h,transitionStatus:u}),[d,i,g,l,s,m,c,a,h,u])}const f0e=p.createContext(void 0);function h0e(){const e=p.useContext(f0e);if(e===void 0)throw new Error(CE(15));return e}function But(e={}){const{guess:t,label:n,metadata:r,textRef:i,index:s}=e,{register:a,unregister:l,subscribeMapChange:c,nextIndexRef:u}=iut(),d=p.useRef(-1),[f,h]=p.useState(s==null&&t?()=>{if(d.current===-1){const y=u.current;u.current+=1,d.current=y}return d.current}:-1),m=s??f,g=p.useRef(null),b=p.useCallback(y=>{const O=g.current;O&&l(O),g.current=y,y&&a(y,{metadata:r??null,index:s??null,label:n,textRef:i})},[s,a,l,r,n,i]);return Zo(()=>{if(s==null)return c(y=>{var v;const O=g.current?(v=y.get(g.current))==null?void 0:v.index:null;O!=null&&h(O)})},[s,c]),{ref:b,index:m}}const p0e=p.createContext(void 0);function BB(){const e=p.useContext(p0e);if(e===void 0)throw new Error(CE(9));return e}let HW=function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e}({});const Qut={"data-starting-style":""},Uut={"data-ending-style":""},Fut={transitionStatus(e){return e==="starting"?Qut:e==="ending"?Uut:null}};let QB=function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=HW.startingStyle]="startingStyle",e[e.endingStyle=HW.endingStyle]="endingStyle",e}({}),zut=function(e){return e.panelOpen="data-panel-open",e}({});const Vut={[QB.open]:""},Hut={[QB.closed]:""},qut={open(e){return e?{[zut.panelOpen]:""}:null}},Xut={open(e){return e?Vut:Hut}};let Gut=function(e){return e.index="data-index",e.disabled="data-disabled",e.open="data-open",e}({});const UB={...Xut,index:e=>({[Gut.index]:String(e)}),...Fut,value:()=>null},m0e=p.forwardRef(function(t,n){const{className:r,disabled:i=!1,onOpenChange:s,render:a,value:l,style:c,...u}=t,{ref:d,index:f}=But(),h=sA(n,d),{disabled:m,handleValueChange:g,state:b,value:y}=t0e(),O=SL(),v=l??O,x=i||m,w=y.indexOf(v)!==-1,S=ja((N,D)=>{s==null||s(N,D),!D.isCanceled&&g(v,N,D)}),E=$ut({open:w,onOpenChange:S,disabled:x}),k=p.useMemo(()=>({open:E.open,disabled:E.disabled,transitionStatus:E.transitionStatus}),[E.open,E.disabled,E.transitionStatus]),_=p.useMemo(()=>({...E,onOpenChange:S,state:k}),[E,k,S]),C=p.useMemo(()=>({...b,hidden:!w&&!E.mounted,index:f,disabled:x,open:w}),[E.mounted,x,f,w,b]),T=SL(),[A,j]=p.useState(),L=A===null?void 0:A??T,I=p.useMemo(()=>({defaultTriggerId:T,open:w,state:C,setTriggerId:j,triggerId:L}),[T,w,C,j,L]),M=AE("div",t,{state:C,ref:h,props:u,stateAttributesMapping:UB});return o.jsx(f0e.Provider,{value:_,children:o.jsx(p0e.Provider,{value:I,children:M})})}),g0e=p.forwardRef(function(t,n){const{render:r,className:i,style:s,...a}=t,{state:l}=BB();return AE("h3",t,{state:l,ref:n,props:a,stateAttributesMapping:UB})}),Wut=p.createContext(void 0);function Yut(e=!1){const t=p.useContext(Wut);if(t===void 0&&!e)throw new Error(CE(16));return t}function Zut(e){const{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:s}=e,a=r&&t!==!1,l=r&&t===!1;return{props:p.useMemo(()=>{const u={onKeyDown(d){n&&t&&d.key!=="Tab"&&d.preventDefault()}};return r||(u.tabIndex=i,!s&&n&&(u.tabIndex=t?i:-1)),(s&&(t||a)||!s&&n)&&(u["aria-disabled"]=n),s&&(!t||l)&&(u.disabled=n),u},[r,n,t,a,l,s,i])}}function SD(e,t,{detail:n=0}={}){e.dispatchEvent(new(Ka(e)).PointerEvent("click",{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function Kut(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:s}=e,a=p.useRef(null),l=Yut(!0),c=s??l!==void 0,{props:u}=Zut({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),d=p.useCallback(()=>{const m=a.current;ED(m)&&c&&t&&u.disabled===void 0&&m.disabled&&(m.disabled=!1)},[t,u.disabled,c]);Zo(d,[d]);const f=p.useCallback((m={})=>{const{onClick:g,onMouseDown:b,onKeyUp:y,onKeyDown:O,onPointerDown:v,...x}=m;return LB({onClick(w){if(t){w.preventDefault();return}g==null||g(w)},onMouseDown(w){t||b==null||b(w)},onKeyDown(w){if(t||(oA(w),O==null||O(w),w.baseUIHandlerPrevented))return;const S=w.target===w.currentTarget,E=w.currentTarget,k=ED(E),_=!i&&Jut(E),C=S&&(i?k:!_),T=w.key==="Enter",A=w.key===" ",j=E.getAttribute("role"),L=(j==null?void 0:j.startsWith("menuitem"))||j==="option"||j==="gridcell";if(S&&c&&A){if(w.defaultPrevented&&L)return;w.preventDefault(),(!i||k)&&(w.preventBaseUIHandler(),SD(E,w));return}if(!C||i||!A&&!T){S&&_&&A&&w.preventDefault();return}w.defaultPrevented||(w.preventDefault(),T&&(w.preventBaseUIHandler(),SD(E,w)))},onKeyUp(w){if(!t){if(oA(w),y==null||y(w),w.target===w.currentTarget&&i&&c&&ED(w.currentTarget)&&w.key===" "){w.preventDefault();return}w.baseUIHandlerPrevented||w.target===w.currentTarget&&!i&&!c&&!w.defaultPrevented&&w.key===" "&&(w.preventBaseUIHandler(),SD(w.currentTarget,w))}},onPointerDown(w){if(t){w.preventDefault();return}v==null||v(w)}},i?{type:"button"}:{role:"button"},u,x)},[t,u,c,i]),h=ja(m=>{a.current=m,d()});return{getButtonProps:f,buttonRef:h}}function ED(e){return kd(e)&&e.tagName==="BUTTON"}function Jut(e){return kd(e)&&e.tagName==="A"&&!!e.href}const b0e=p.forwardRef(function(t,n){const{disabled:r,className:i,id:s,render:a,nativeButton:l=!0,style:c,...u}=t,{panelId:d,open:f,handleTrigger:h,disabled:m}=h0e(),g=r||m,{getButtonProps:b,buttonRef:y}=Kut({disabled:g,focusableWhenDisabled:!0,native:l}),{defaultTriggerId:O,state:v,setTriggerId:x}=BB(),w=s||void 0,S=w??O;return Zo(()=>(x(_=>w??(_===null?void 0:_)),()=>{x(_=>_===w?null:_)}),[w,x]),AE("button",t,{state:v,ref:[n,y],props:[{"aria-controls":f?d:void 0,"aria-expanded":f,id:S,onClick:h},u,b],stateAttributesMapping:qut})});function edt(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function tdt(e){const t=qg(ndt,e).current;return t.next=e,Zo(t.effect),t}function ndt(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function rdt(e){return e==null?e:"current"in e?e.current:e}function y0e(e,t=!1){const n=Mut();return ja((r,i=null)=>{n.cancel();const s=rdt(e);if(s==null)return;const a=s,l=()=>{Cr.flushSync(r)};if(typeof a.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){r();return}function c(){Promise.all(a.getAnimations().map(u=>u.finished)).then(()=>{i!=null&&i.aborted||l()},()=>{if(i!=null&&i.aborted)return;if(a.getAnimations().some(d=>d.pending||d.playState!=="finished")){c();return}l()})}if(t){const u="data-starting-style";if(!a.hasAttribute(u)){n.request(c);return}const d=new MutationObserver(()=>{a.hasAttribute(u)||(d.disconnect(),c())});d.observe(a,{attributes:!0,attributeFilter:[u]}),i==null||i.addEventListener("abort",()=>d.disconnect(),{once:!0});return}n.request(c)})}function idt(e){const{enabled:t=!0,open:n,ref:r,onComplete:i}=e,s=ja(i),a=y0e(r,n);p.useEffect(()=>{if(!t)return;const l=new AbortController;return a(s,l.signal),()=>{l.abort()}},[t,n,s,a])}const dx={height:void 0,width:void 0};function sdt(e){const{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:i,mounted:s,onOpenChange:a,open:l,setMounted:c,setOpen:u,transitionStatus:d}=e,f=p.useRef(null),h=p.useRef(null),[m,g]=p.useState(dx),b=p.useRef(dx),y=p.useRef(!1),O=p.useRef(l),v=p.useRef(!1),[x,w]=p.useState(!1),S=p.useRef(null),E=sA(t,f),k=tdt(l),_=y0e(f),C=!l&&!s,T=x?"idle":d,A=l&&(O.current||v.current),j=!l&&s&&h.current==="css-animation"&&m.height===void 0&&m.width===void 0?b.current:m,L=n&&C&&h.current!=="css-animation",I=ja((F,$=!0)=>{$&&(b.current=F),g(F)}),M=ja(()=>{var F;(F=S.current)==null||F.call(S),S.current=null}),N=ja(F=>{M(),S.current=()=>{S.current=null,F()}}),D=ja(()=>{l&&s&&h.current==="css-animation"&&(v.current=!0)});Zo(()=>{!x||d==="starting"||w(!1)},[x,d]),p.useEffect(()=>()=>{D(),M()},[D,M]),Zo(()=>{const F=f.current;if(!F)return;!l&&S.current&&M();const $=adt(F,A);if(h.current=$,l&&d==="idle"&&O.current&&$==="css-animation"){b.current=J0(F);return}if(l&&d==="starting"){const B=y.current;if(y.current=!1,$==="none"){I(J0(F)),w(!0);return}if($==="css-transition"){const ce=odt(F);if(I(J0(F)),!B)return ce;const be=A2(F,"transition-duration","0s");return N(be),w(!0),ce}I(J0(F));const V=A2(F,"animation-name","none");if(!B){V();return}const Z=A2(F,"animation-duration","0s");V(),N(Z),w(!0);return}if(!l&&s&&(d==="idle"||d==="starting")){if(O.current=!1,v.current=!1,$==="none"){I(dx,!1),c(!1);return}I(J0(F));return}if(d!=="ending")return;if($==="none"){c(!1);return}const H=J0(F);if(!(H.height>0||H.width>0)){c(!1);return}I(H),$==="css-animation"&&A2(F,"animation-name","none")()},[s,l,M,I,c,N,A,d]),idt({enabled:l&&s&&T==="idle",open:!0,ref:f,onComplete(){l&&I(dx,!1)}}),p.useEffect(()=>{if(l||!s||T!=="ending"||!f.current)return;const $=new AbortController;let H=-1;function z(){k.current||(c(!1),I(dx,!1))}return H=kl.request(()=>{_(z,$.signal)}),()=>{kl.cancel(H),$.abort()}},[k,s,l,T,_,I,c]),Zo(()=>{const F=f.current;!F||!n||!C||F.setAttribute("hidden","until-found")},[C,n]),p.useEffect(function(){const $=f.current;if(!$)return;function H(z){const B=d0e(Rut,z);a(!0,B),!B.isCanceled&&(y.current=!0,u(!0))}return edt($,"beforematch",H)},[a,u]);const Q=i||n||s||l;return{height:j.height,props:{...L?{[QB.startingStyle]:""}:void 0,hidden:C,id:r},ref:E,shouldPreventOpenAnimation:A,shouldRender:Q,transitionStatus:T,width:j.width}}function J0(e){return{height:e.scrollHeight,width:e.scrollWidth}}function adt(e,t){const n=Ka(e).getComputedStyle(e),r=(n.animationName.split(",").map(s=>s.trim()).some(s=>s!==""&&s!=="none")||t)&&qW(n.animationDuration),i=qW(n.transitionDuration);return r&&i||i?"css-transition":r?"css-animation":"none"}function qW(e){return e.split(",").map(t=>t.trim()).some(t=>t!==""&&Number.parseFloat(t)>0)}function A2(e,t,n){const r=e.style.getPropertyValue(t),i=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{if(r===""){e.style.removeProperty(t);return}e.style.setProperty(t,r,i)}}function odt(e){const t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(i=>{e.style.setProperty(i,"initial","important")});function n(){Object.entries(t).forEach(([i,s])=>{if(s===""){e.style.removeProperty(i);return}e.style.setProperty(i,s)})}const r=kl.request(n);return()=>{kl.cancel(r),n()}}let XW=function(e){return e.accordionPanelHeight="--accordion-panel-height",e.accordionPanelWidth="--accordion-panel-width",e}({});const O0e=p.forwardRef(function(t,n){const{className:r,hiddenUntilFound:i,keepMounted:s,id:a,render:l,style:c,...u}=t,{hiddenUntilFound:d,keepMounted:f}=t0e(),{defaultPanelId:h,mounted:m,onOpenChange:g,open:b,setMounted:y,setOpen:O,setPanelIdState:v,transitionStatus:x}=h0e(),w=i??d,S=s??f,E=a||void 0,k=a??h;Zo(()=>(v($=>E??($===null?void 0:$)),()=>{v($=>$===E?null:$)}),[E,v]);const{height:_,props:C,ref:T,shouldPreventOpenAnimation:A,shouldRender:j,transitionStatus:L,width:I}=sdt({externalRef:n,hiddenUntilFound:w,id:k,keepMounted:S,mounted:m,onOpenChange:g,open:b,setMounted:y,setOpen:O,transitionStatus:x}),{state:M,triggerId:N}=BB(),D={...M,transitionStatus:L},Q=i0e(c,D),F=AE("div",{...t,style:void 0},{state:D,ref:T,props:[C,{"aria-labelledby":N,role:"region",style:{[XW.accordionPanelHeight]:_===void 0?"auto":`${_}px`,[XW.accordionPanelWidth]:I===void 0?"auto":`${I}px`}},u,Q?{style:Q}:void 0,A?{style:{animationName:"none"}}:void 0],stateAttributesMapping:UB});return j?F:null}),ldt=(e,t)=>{const n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=cdt(r,n.getBoundingClientRect()),s=udt(r,i),a=ddt(t.getBoundingClientRect());return hdt([...s,...a])};function cdt(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function udt(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function ddt(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function fdt(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,a=t.length-1;sr!=h>r&&n<(f-u)*(r-d)/(h-d)+u&&(i=!i)}return i}function hdt(e){const t=e.slice();return t.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),pdt(t)}function pdt(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r=2;){const s=t[t.length-1],a=t[t.length-2];if((s.x-a.x)*(i.y-a.y)>=(s.y-a.y)*(i.x-a.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const s=n[n.length-1],a=n[n.length-2];if((s.x-a.x)*(i.y-a.y)>=(s.y-a.y)*(i.x-a.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}const mdt="_Transition_1wdpp_1",gdt="_Popover_1wdpp_3",x0e={Transition:mdt,Popover:gdt},v0e=p.createContext(null),Qj=()=>{const e=p.use(v0e);if(!e)throw new Error("Popover components must be wrapped in ");return e},jp=({open:e,onOpenChange:t,showOnHover:n=!1,hoverOpenDelay:r=150,children:i})=>{const[s,a]=p.useState(!1),[l,c]=p.useState(!1),u=p.useRef(null),d=p.useRef(null),f=p.useRef(void 0),h=p.useRef(!1),m=p.useRef(!1),g=e??s,[b,y]=p.useState(!1);k9(()=>y(!1),b?500:null);const O=Xp(t),v=Xp(k=>{var _,C;clearTimeout(f.current),g!==k&&(k||(c(!1),n&&h.current&&((_=u.current)==null||_.focus()),h.current=!1),(C=O.current)==null||C.call(O,k),a(k),n&&y(k))}),x=p.useCallback(k=>{v.current(k)},[v]),w=p.useCallback(()=>{f.current=setTimeout(()=>x(!0),r)},[x,r]),S=p.useCallback(()=>{clearTimeout(f.current)},[]);p.useEffect(()=>()=>{clearTimeout(f.current)},[]);const E=p.useMemo(()=>({open:g,setOpen:x,shake:l,setShake:c,showOnHover:n,temporarilyPreventClickToClose:b,onTriggerEnter:w,onTriggerLeave:S,isPointerInTransitRef:m,triggerRef:u,contentRef:d,hoverOpenFocusedWithTab:h}),[g,x,l,c,n,b,h,m,w,S]);return o.jsx(v0e,{value:E,children:o.jsx(fue,{open:g,onOpenChange:x,modal:!1,children:i})})},bdt=({children:e,onPointerDown:t,onClick:n})=>{const{setOpen:r,showOnHover:i,temporarilyPreventClickToClose:s,onTriggerEnter:a,onTriggerLeave:l,isPointerInTransitRef:c,triggerRef:u,contentRef:d}=Qj(),f=p.useRef(!1),h=b=>{!(b.currentTarget.nodeName.toLocaleLowerCase()==="a")&&s&&(b.preventDefault(),b.stopPropagation())},m=b=>{b.pointerType!=="touch"&&!f.current&&!c.current&&(a(),f.current=!0)},g=()=>{f.current&&(l(),f.current=!1)};return o.jsx(hue,{asChild:!0,ref:u,onPointerDown:b=>{h(b),t==null||t(b)},onClick:b=>{h(b),n==null||n(b)},onPointerMove:i?m:void 0,onPointerLeave:i?g:void 0,onFocus:i?()=>r(!0):void 0,onBlur:i?()=>{setTimeout(()=>{var b;(b=d.current)!=null&&b.contains(document.activeElement)||r(!1)},50)}:void 0,children:e})},w0e=({children:e,avoidCollisions:t,width:n,minWidth:r,maxWidth:i,side:s,sideOffset:a=8,align:l,alignOffset:c,translucent:u,className:d,autoFocus:f=!0})=>{const{showOnHover:h,shake:m,contentRef:g}=Qj(),b=y=>{const O=g.current;if(O&&y.target===O&&y.key==="Tab"&&y.shiftKey){y.preventDefault(),y.stopPropagation();const v=Tle(O),x=v[v.length-1];x==null||x.focus()}};return p.useEffect(()=>{const y=g.current;!y||!f||y!=null&&y.contains(document.activeElement)||h||y.focus({preventScroll:!0})},[g,h,f]),o.jsx(mue,{forceMount:!0,ref:g,className:ur(x0e.Popover,d),style:d0({"popover-width":n,"popover-min-width":r,"popover-max-width":i}),onCloseAutoFocus:h?Df:void 0,"data-animate":m?"shake":void 0,"data-translucent":u?"true":void 0,side:s,sideOffset:a,align:l,alignOffset:c??(l==="center"?0:-5),avoidCollisions:t??!0,hideWhenDetached:!0,collisionPadding:20,onOpenAutoFocus:Df,onEscapeKeyDown:Df,onKeyDown:b,children:e})},ydt=e=>{const{setOpen:t,triggerRef:n,contentRef:r,isPointerInTransitRef:i,hoverOpenFocusedWithTab:s}=Qj(),[a,l]=p.useState(null),c=p.useCallback(()=>{l(null),i.current=!1},[i]),u=p.useCallback((d,f)=>{const h=ldt(d,f);l(h),i.current=!0},[i]);return p.useEffect(()=>()=>c(),[c]),p.useEffect(()=>{const d=n.current,f=r.current;if(!d||!f)return;const h=g=>u(g,f),m=g=>u(g,d);return d.addEventListener("pointerleave",h),f.addEventListener("pointerleave",m),()=>{d.removeEventListener("pointerleave",h),f.removeEventListener("pointerleave",m)}},[r,n,u,c]),p.useEffect(()=>{if(!a)return;const d=f=>{const h=n.current,m=r.current,g=f.target,b={x:f.clientX,y:f.clientY},y=(h==null?void 0:h.contains(g))||(m==null?void 0:m.contains(g)),O=!fdt(b,a),v=g.hasAttribute("aria-haspopup");y?c():(O||v)&&(c(),t(!1))};return document.addEventListener("pointermove",d),()=>document.removeEventListener("pointermove",d)},[a,t,c,n,r]),p.useEffect(()=>{const d=f=>{if(r.current&&f.key==="Tab"&&!f.shiftKey){const[h]=Tle(r.current);h&&(f.preventDefault(),h.focus(),s.current=!0,document.removeEventListener("keydown",d))}};return document.addEventListener("keydown",d),()=>{document.removeEventListener("keydown",d)}},[r,s]),o.jsx(w0e,{...e})},Odt=e=>{const{open:t,showOnHover:n,setOpen:r}=Qj();return tE(t,()=>{r(!1)}),o.jsx(pue,{forceMount:!0,children:o.jsx(rO,{enterDuration:600,exitDuration:300,className:x0e.Transition,disableAnimations:!0,children:t&&(n?o.jsx(ydt,{...e},"popover-hover"):o.jsx(w0e,{...e},"popover"))})})};jp.Trigger=bdt;jp.Content=Odt;const xdt=[{value:"skill_hub",label:"Skill Hub"},{value:"skill_space",label:"AgentKit 技能中心"},{value:"knowledge_base",label:"知识库"},{value:"tool",label:"工具"}],S0e={llm:"LLM Agent",sequential:"顺序 Agent",parallel:"并行 Agent",loop:"循环 Agent",workflow:"Workflow"};function E0e(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m4 6 4 4 4-4"})})}function k0e({label:e}){return o.jsx("div",{className:"create-agent-card__loading",role:"status","aria-label":e,children:[0,1,2].map(t=>o.jsxs("div",{className:"create-agent-card__skeleton-row","aria-hidden":"true",children:[o.jsx("span",{}),o.jsx("span",{})]},t))})}function vdt(e){return e.kind==="tool"?"内置工具":e.kind==="knowledge_base"?"知识库":e.source.startsWith("skill_hub:")?"Skill Hub":e.source.startsWith("skill_space:")?"AgentKit 技能中心":"Skill"}function kD({label:e,resources:t}){return t.length===0?null:o.jsxs("section",{className:"create-agent-card__popover-section",children:[o.jsx("h4",{children:e}),o.jsx("div",{className:"create-agent-card__popover-list",children:t.map(n=>o.jsxs("div",{className:"create-agent-card__popover-item",children:[o.jsxs("div",{className:"create-agent-card__popover-item-heading",children:[o.jsx("strong",{children:n.name}),o.jsx(ta,{color:"secondary",size:"sm",variant:"soft",children:vdt(n)})]}),n.description?o.jsx("p",{children:n.description}):null]},n.ref))})]})}function wdt({tools:e}){return e.length===0?null:o.jsxs("section",{className:"create-agent-card__popover-section",children:[o.jsx("h4",{children:"自写工具"}),o.jsx(u0e,{children:e.map((t,n)=>o.jsxs(m0e,{className:"create-agent-card__python-tool",value:`${t.name}:${n}`,children:[o.jsx(g0e,{className:"create-agent-card__python-tool-header",children:o.jsxs(b0e,{className:"create-agent-card__python-tool-trigger",children:[o.jsxs("span",{children:[o.jsx("strong",{children:t.name}),t.description?o.jsx("small",{children:t.description}):null]}),o.jsxs("span",{className:"create-agent-card__python-tool-meta",children:[o.jsx(ta,{color:"secondary",size:"sm",variant:"soft",children:"自写工具"}),o.jsx(E0e,{className:"create-agent-card__python-tool-chevron"})]})]})}),o.jsxs(O0e,{className:"create-agent-card__python-tool-panel",children:[t.dependencies.length>0?o.jsxs("div",{className:"create-agent-card__python-tool-dependencies",children:["依赖:",t.dependencies.join(", ")]}):null,o.jsx("pre",{tabIndex:0,"aria-label":`${t.name} 完整代码`,children:o.jsx("code",{children:t.code})})]})]},`${t.name}:${n}`))})]})}function Sdt({agents:e}){return e.length===0?null:o.jsxs("section",{className:"create-agent-card__popover-section",children:[o.jsx("h4",{children:"Sub Agent"}),o.jsx("div",{className:"create-agent-card__popover-list",children:e.map(t=>o.jsxs("div",{className:"create-agent-card__popover-item",children:[o.jsxs("div",{className:"create-agent-card__popover-item-heading",children:[o.jsx("strong",{children:t.id}),o.jsx(ta,{color:"secondary",size:"sm",variant:"soft",children:S0e[t.type]??t.type})]}),t.description?o.jsx("p",{children:t.description}):null]},t.id))})]})}function N2({label:e,count:t,icon:n,children:r}){const i=o.jsxs("button",{className:"create-agent-card__resource-metric",type:"button",disabled:t===0,"aria-label":`${e} ${t} 项`,children:[n,o.jsx("span",{children:t})]});return t===0?i:o.jsxs(jp,{showOnHover:!0,hoverOpenDelay:120,children:[o.jsx(jp.Trigger,{children:i}),o.jsx(jp.Content,{side:"top",align:"start",minWidth:"auto",maxWidth:360,className:"create-agent-card__resource-popover",children:r})]})}function Edt({response:e,status:t}){const n=p.useMemo(()=>Wct(e),[e]),r=p.useMemo(()=>xdt.map(a=>{const l=Yct(n,a.value);return{...a,...l,searchKeywords:[...new Set(l.sources.flatMap(c=>c.searchKeywords))]}}),[n]),i=t==="failed",s=i?Bj(e):"";return o.jsx("section",{className:"create-agent-tool-card","aria-label":"召回资源信息",children:t==="running"?o.jsx(k0e,{label:"正在检索资源"}):i?o.jsxs("div",{className:"create-agent-card__message is-error",role:"alert",children:[o.jsx("span",{className:"create-agent-card__message-title",children:"资源检索未完成"}),o.jsx("span",{children:s||"请检查资源服务配置后重试。"})]}):o.jsx(u0e,{className:"create-agent-card__accordion",children:r.map(a=>o.jsxs(m0e,{className:"create-agent-card__accordion-item",value:a.value,children:[o.jsx(g0e,{className:"create-agent-card__accordion-header",children:o.jsxs(b0e,{className:"create-agent-card__accordion-trigger",children:[o.jsx("span",{children:a.label}),o.jsxs("span",{className:"create-agent-card__accordion-meta",children:[o.jsx(ta,{color:"secondary",size:"sm",variant:"soft",children:a.sources.length===0?a.value==="skill_hub"?"未检索":"未配置":a.resources.length}),o.jsx(E0e,{className:"create-agent-card__accordion-chevron"})]})]})}),o.jsx(O0e,{className:"create-agent-card__accordion-content",children:o.jsxs("div",{className:"create-agent-card__accordion-scroll",role:"region","aria-label":`${a.label}资源列表`,tabIndex:0,children:[a.value==="skill_hub"&&a.searchKeywords.length>0?o.jsxs("div",{className:"create-agent-card__search-keywords",children:[o.jsx("span",{children:"检索关键词"}),o.jsx("span",{children:a.searchKeywords.join("、")})]}):null,a.resources.length>0?o.jsx("div",{className:"create-agent-card__resource-list",children:a.resources.map(l=>o.jsx("div",{className:"create-agent-card__resource",children:o.jsxs("div",{className:"create-agent-card__resource-main",children:[o.jsxs("div",{className:"create-agent-card__resource-title",children:[o.jsx("span",{className:"create-agent-card__resource-name",children:l.name}),l.version?o.jsx(ta,{className:"create-agent-card__resource-version",color:"secondary",size:"sm",variant:"soft",children:l.version}):null]}),l.description?o.jsx("p",{children:l.description}):null]})},l.ref))}):o.jsxs("div",{className:"create-agent-card__empty-category",children:[o.jsx("p",{children:a.sources.length===0?a.value==="skill_hub"?"未提供检索关键词,本次未检索 Skill Hub。":`未配置 ${a.label},本次未检索该来源。`:"本次检索未返回该类别的资源。"}),a.sources.filter(l=>l.message).map(l=>o.jsx("p",{className:"create-agent-card__raw-source-error",children:l.message},l.source))]})]})})]},a.value))},n.collectionId||"collected-resources")})}function kdt({args:e,response:t,status:n}){const r=p.useMemo(()=>Yge(e,t),[e,t]),i=n==="failed"?Bj(t):"";return o.jsxs("section",{className:"create-agent-tool-card is-agent-results","aria-label":"创建 Agent 结果",children:[i?o.jsxs("div",{className:"create-agent-card__message is-error",role:"alert",children:[o.jsx("span",{className:"create-agent-card__message-title",children:"Agent 创建未完成"}),o.jsx("span",{children:i})]}):null,r.agents.length>0?o.jsx("div",{className:"create-agent-card__agent-grid",children:r.agents.map(s=>{const a=n==="failed"?"failed":s.status,l=s.error||a==="failed"&&i,c=s.builtinTools.length+s.pythonTools.length;return o.jsxs(W7,{className:`create-agent-card__agent-card${l?" is-error":""}`,children:[o.jsx(Y7,{leading:o.jsx(d1,{seed:s.name}),title:s.name,titleText:s.name,status:o.jsx(ta,{color:"secondary",size:"sm",variant:"soft",children:S0e[s.rootType]??s.rootType})}),s.description?o.jsx(Z7,{children:s.description}):null,l?o.jsx("div",{className:"create-agent-card__agent-result is-error",role:"alert",children:l}):null,o.jsxs("div",{className:"create-agent-card__agent-resources","aria-label":`${s.name} 具备的资源`,children:[o.jsx(N2,{label:"Skill",count:s.skills.length,icon:o.jsx(L_,{"aria-hidden":"true"}),children:o.jsx(kD,{label:"Skill",resources:s.skills})}),o.jsx(N2,{label:"知识库",count:s.knowledgeBases.length,icon:o.jsx(zue,{"aria-hidden":"true"}),children:o.jsx(kD,{label:"知识库",resources:s.knowledgeBases})}),o.jsxs(N2,{label:"工具",count:c,icon:o.jsx(kRe,{"aria-hidden":"true"}),children:[o.jsx(kD,{label:"内置工具",resources:s.builtinTools}),o.jsx(wdt,{tools:s.pythonTools})]}),o.jsx(N2,{label:"Sub Agent",count:s.subAgentCount,icon:o.jsx(TRe,{"aria-hidden":"true"}),children:o.jsx(Sdt,{agents:s.subAgents})})]})]},s.name)})}):n==="running"?o.jsx(k0e,{label:"正在创建 Agent"}):o.jsxs("div",{className:"create-agent-card__message",children:[o.jsx("span",{className:"create-agent-card__message-title",children:"没有可展示的 Agent"}),o.jsx("span",{children:"工具返回中未包含 Agent 配置或执行结果。"})]})]})}const _dt={web_search:{name:"web_search",runningLabel:"正在进行网络搜索",doneLabel:"已完成网络搜索",tone:"search",icon:Dct},run_code:{name:"run_code",runningLabel:"正在 AgentKit 沙箱中执行代码",doneLabel:"已在 AgentKit 沙箱中完成代码执行",tone:"sandbox",icon:Qct},list_envs:{name:"list_envs",runningLabel:"正在查看可用环境",doneLabel:"已读取可用环境",tone:"resources",icon:Fct},get_env_manifest:{name:"get_env_manifest",runningLabel:"正在读取环境 Manifest",doneLabel:"已读取环境 Manifest",tone:"knowledge",icon:zct},execute_in_sandbox:{name:"execute_in_sandbox",runningLabel:"正在环境中执行命令",doneLabel:"已在环境中完成命令执行",tone:"sandbox",icon:Vct},image_generate:{name:"image_generate",runningLabel:"正在生成图片",doneLabel:"已完成图片生成",tone:"image",icon:Pct},video_generate:{name:"video_generate",runningLabel:"正在生成视频",doneLabel:"已完成视频生成",tone:"video",icon:IB},ppt_generate:{name:"ppt_generate",runningLabel:"正在生成 PPT",doneLabel:"已完成 PPT 生成",tone:"presentation",icon:Mct},load_memory:{name:"load_memory",runningLabel:"正在检索长期记忆",doneLabel:"已完成记忆检索",tone:"memory",icon:Lct},load_knowledgebase:{name:"load_knowledgebase",runningLabel:"正在检索知识库",doneLabel:"已完成知识库检索",tone:"knowledge",icon:$ct},load_skill:{name:"load_skill",runningLabel:"正在加载技能",doneLabel:"已加载技能",tone:"skill",icon:Bct},collect_resources:{name:"collect_resources",runningLabel:"正在收集可用资源",doneLabel:"已完成资源收集",failedLabel:"资源收集失败",tone:"resources",icon:Uct,detailRenderer:Edt},create_agents:{name:"create_agents",runningLabel:"正在创建并运行 Agent",doneLabel:"已完成 Agent 创建",failedLabel:"Agent 创建失败",tone:"agent",icon:LW,detailRenderer:kdt},branch_compare:{name:"branch_compare",runningLabel:"",doneLabel:"",failedLabel:"",tone:"search",icon:LW,detailRenderer:Jct,hideHeader:!0}};function Tdt(e){return _dt[e]}function _0e(e){return o.jsx("svg",{viewBox:"0 0 111 117",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M0 5.6016C7.82288e-05 0.621244 6.02226 -1.87314 9.54395 1.64847L40.1289 32.2334L68.5732 3.7891C69.5834 2.77903 70.9533 2.21099 72.3818 2.21097H82.7031C82.7917 2.20658 82.8806 2.20414 82.9697 2.20414H104.775C109.574 2.20427 111.977 8.00691 108.584 11.4004L64.916 55.0664C64.3075 55.8528 63.9436 56.7647 63.8242 57.6993C63.7142 56.4884 63.1964 55.3069 62.2695 54.3799L45.4082 37.5186H45.4072L40.124 32.2354L17.832 54.5284C16.7671 55.5933 16.2416 56.993 16.2549 58.3887C16.2417 59.7843 16.7672 61.1842 17.832 62.2491L39.9287 84.3467L9.54395 114.733C6.0223 118.255 0.000223474 115.761 0 110.78V5.6016ZM63.8018 58.8702C63.8962 59.9086 64.2936 60.9229 64.9961 61.7735L108.591 105.368C111.984 108.762 109.58 114.564 104.781 114.564H94.4336C94.3543 114.568 94.274 114.569 94.1934 114.569H72.3877C70.9592 114.569 69.5892 114.002 68.5791 112.992L39.9336 84.3467L58.4531 65.8282L58.4453 65.8203L62.2695 61.9981C63.1476 61.12 63.6567 60.0136 63.8018 58.8702Z",fill:"currentColor"})})}function Cdt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M6 3h8l4 4v14H6Z"}),o.jsx("path",{d:"M14 3v5h5"}),o.jsx("path",{d:"m10 12-2 2 2 2M14 12l2 2-2 2"})]})}function Adt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M12 3 19 6v5c0 4.6-2.8 7.8-7 10-4.2-2.2-7-5.4-7-10V6l7-3Z"}),o.jsx("path",{d:"m9 12 2 2 4-4"})]})}function Ndt(e,t){const n=new Map(e.map(a=>[a.path,a.content])),r=new Map(t.map(a=>[a.path,a.content])),i=new Set([...n.keys(),...r.keys()]),s=[];for(const a of[...i].sort((l,c)=>l.localeCompare(c))){const l=n.get(a),c=r.get(a);l!==c&&s.push({path:a,status:l===void 0?"added":c===void 0?"deleted":"modified",before:l??"",after:c??""})}return s}function jdt(e){return e==="added"?"新增":e==="deleted"?"删除":"修改"}function mm(e){return{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e}}function T0e(e){return o.jsx("svg",{...mm(e),children:o.jsx("path",{d:"m9 7-5 5 5 5M15 7l5 5-5 5M13.5 4l-3 16"})})}function _D(e){return o.jsx("svg",{...mm(e),children:o.jsx("path",{d:"M6.5 3.75h7l4 4V20.25h-11zM13.5 3.75v4h4M9 12h6M9 15.5h4.5"})})}function Rdt(e){return o.jsx("svg",{...mm(e),children:o.jsx("path",{d:"M3.75 7.25h6l1.75 2h8.75v9.25H3.75zM3.75 7.25V5.5h5l1.5 1.75"})})}function Idt(e){return o.jsx("svg",{...mm(e),children:o.jsx("path",{d:"m9 5 7 7-7 7"})})}function C0e(e){return o.jsx("svg",{...mm(e),children:o.jsx("path",{d:"m6.5 6.5 11 11M17.5 6.5l-11 11"})})}function Ddt(e){return o.jsxs("svg",{...mm(e),children:[o.jsx("circle",{cx:"12",cy:"12",r:"3.25"}),o.jsx("path",{d:"M12 2.75v2M12 19.25v2M2.75 12h2M19.25 12h2M5.45 5.45l1.4 1.4M17.15 17.15l1.4 1.4M18.55 5.45l-1.4 1.4M6.85 17.15l-1.4 1.4"})]})}function Pdt(e){return o.jsx("svg",{...mm(e),children:o.jsx("path",{d:"M19.25 15.25A8 8 0 0 1 8.75 4.75a8 8 0 1 0 10.5 10.5Z"})})}function Mdt(e){return o.jsxs("svg",{...mm(e),children:[o.jsx("path",{d:"M19.25 8.25V4.5l-1.8 1.8a7.5 7.5 0 1 0 1.8 7.65"}),o.jsx("path",{d:"M19.25 4.5H15.5"})]})}const Ldt=p.lazy(()=>dd(()=>Promise.resolve().then(()=>rve),void 0)),$dt=p.lazy(()=>dd(()=>import("../chunks/CodeDiffEditor-B-C-CiRH.js"),[])),A0e="veadk-code-workspace-theme";function Bdt(e){const t={name:"",children:new Map};for(const n of e){const r=n.path.split("/").filter(Boolean);let i=t;r.forEach((s,a)=>{let l=i.children.get(s);l||(l={name:s,children:new Map},i.children.set(s,l)),a===r.length-1&&(l.path=n.path),i=l})}return t}function Qdt(e,t=!1){return[...e.children.values()].sort((n,r)=>{const i=n.children.size>0&&n.path===void 0,s=r.children.size>0&&r.path===void 0;return i!==s?t?i?1:-1:i?-1:1:n.name.localeCompare(r.name)})}function Udt(){if(typeof window>"u")return"light";try{return window.localStorage.getItem(A0e)==="dark"?"dark":"light"}catch{return"light"}}function Fdt(e){return e===""?0:e.split(` -`).length}function Yw({project:e,open:t,onClose:n,onChange:r,readOnly:i=!1,comparison:s}){var j;const a=p.useId(),l=p.useRef(null),c=p.useRef(null),u=p.useRef(n),[d,f]=p.useState(Udt),h=p.useMemo(()=>s?Ndt(s.baseProject.files,e.files):[],[s,e.files]),m=p.useMemo(()=>s?h.map(L=>({path:L.path,content:L.status==="deleted"?L.before:L.after})):e.files,[h,s,e.files]),g=p.useMemo(()=>new Map(h.map(L=>[L.path,L.status])),[h]),[b,y]=p.useState(((j=m[0])==null?void 0:j.path)??null),[O,v]=p.useState(new Set),x=p.useMemo(()=>Bdt(m),[m]),w=m.find(L=>L.path===b)??null,S=h.find(L=>L.path===b)??null;if(u.current=n,p.useEffect(()=>{try{window.localStorage.setItem(A0e,d)}catch{}},[d]),p.useEffect(()=>{var N;if(!t)return;const L=document.body.style.overflow,I=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(N=c.current)==null||N.focus();const M=D=>{if(D.key==="Escape"){D.preventDefault(),u.current();return}if(D.key!=="Tab"||!l.current)return;const Q=[...l.current.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')].filter(H=>H.offsetParent!==null);if(Q.length===0)return;const F=Q[0],$=Q[Q.length-1];D.shiftKey&&document.activeElement===F?(D.preventDefault(),$.focus()):!D.shiftKey&&document.activeElement===$&&(D.preventDefault(),F.focus())};return window.addEventListener("keydown",M),()=>{document.body.style.overflow=L,window.removeEventListener("keydown",M),I!=null&&I.isConnected&&I.focus()}},[t]),p.useEffect(()=>{w||m.length===0||y(m[0].path)},[m,w]),!t)return null;function E(L){v(I=>{const M=new Set(I);return M.has(L)?M.delete(L):M.add(L),M})}function k(L){return L?o.jsx("span",{className:`code-browser-change is-${L}`,children:jdt(L)}):null}function _(L,I,M){return Qdt(L,I===0).map(N=>{const D=M?`${M}/${N.name}`:N.name;if(!(N.children.size>0&&N.path===void 0)&&N.path){const $=g.get(N.path);return o.jsxs("button",{type:"button",className:`code-browser-file${b===N.path?" is-active":""}`,style:{paddingLeft:`${12+I*16}px`},onClick:()=>y(N.path??null),title:N.path,"aria-pressed":b===N.path,children:[o.jsx(_D,{}),o.jsx("span",{children:N.name}),k($)]},D)}const F=O.has(D);return o.jsxs("div",{children:[o.jsxs("button",{type:"button",className:"code-browser-folder",style:{paddingLeft:`${10+I*16}px`},onClick:()=>E(D),"aria-expanded":!F,children:[o.jsx(Idt,{className:F?"":"is-open"}),o.jsx(Rdt,{}),o.jsx("span",{children:N.name})]}),!F&&_(N,I+1,D)]},D)})}function C(L){!w||s||r({...e,files:e.files.map(I=>I.path===w.path?{...I,content:L}:I)})}const T=d==="light"?"dark":"light",A=s?"两个版本的源码没有差异":"从左侧选择文件以查看代码";return Cr.createPortal(o.jsx("div",{className:"code-browser-backdrop",onMouseDown:L=>{L.target===L.currentTarget&&n()},children:o.jsxs("section",{ref:l,className:`code-browser-dialog is-${d}`,role:"dialog","aria-modal":"true","aria-labelledby":a,children:[o.jsxs("header",{className:"code-browser-head",children:[o.jsxs("div",{className:"code-browser-title-wrap",children:[o.jsx("span",{className:"code-browser-title-icon",children:o.jsx(T0e,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:a,children:s?"版本对比":"源码工作区"}),o.jsx("p",{title:e.name,children:e.name||"Agent 项目"})]})]}),o.jsxs("div",{className:"code-browser-head-actions",children:[o.jsx("button",{type:"button",className:"code-browser-icon-button",onClick:()=>f(T),"aria-label":"切换源码主题",title:`切换为${T==="dark"?"深色":"浅色"}主题`,children:d==="light"?o.jsx(Pdt,{}):o.jsx(Ddt,{})}),o.jsx("button",{ref:c,type:"button",className:"code-browser-icon-button",onClick:n,"aria-label":"关闭源码工作区",title:"关闭",children:o.jsx(C0e,{})})]})]}),o.jsxs("div",{className:"code-browser-workspace",children:[o.jsxs("aside",{className:"code-browser-sidebar","aria-label":s?"变更文件":"项目文件",children:[o.jsxs("div",{className:"code-browser-sidebar-head",children:[o.jsx("span",{children:s?"变更":"文件"}),o.jsx("span",{children:m.length})]}),o.jsx("div",{className:"code-browser-tree",children:m.length>0?_(x,0,""):o.jsx("div",{className:"code-browser-empty",children:A})})]}),o.jsxs("main",{className:"code-browser-main",children:[o.jsx("div",{className:"code-browser-tabs",role:"tablist","aria-label":"打开的文件",children:w?o.jsxs("div",{className:"code-browser-tab",role:"tab","aria-selected":"true",children:[o.jsx(_D,{}),o.jsx("span",{children:w.path.split("/").pop()}),k(S==null?void 0:S.status)]}):null}),o.jsxs("div",{className:"code-browser-path",children:[o.jsx(_D,{}),o.jsx("span",{children:(w==null?void 0:w.path)??"未选择文件"})]}),s?o.jsxs("div",{className:"code-browser-diff-labels","aria-label":"对比方向",children:[o.jsx("span",{children:s.baseLabel??"优化前"}),o.jsx("span",{children:s.targetLabel??"优化后"})]}):null,o.jsx("div",{className:"code-browser-editor",children:w?o.jsx(p.Suspense,{fallback:o.jsx("div",{className:"code-browser-empty",children:"正在加载编辑器…"}),children:S?o.jsx($dt,{before:S.before,after:S.after,path:S.path,theme:d}):o.jsx(Ldt,{value:w.content,path:w.path,onChange:C,readOnly:i,theme:d})}):o.jsx("div",{className:"code-browser-empty",children:A})}),o.jsxs("footer",{className:"code-browser-statusbar",children:[o.jsx("span",{children:s?`${h.length} 个文件有变更`:`${e.files.length} 个文件`}),o.jsx("span",{children:w?`${Fdt(w.content)} 行 · UTF-8`:"UTF-8"})]})]})]})]})}),document.body)}function zdt({project:e,onChange:t,className:n="",label:r="查看源码"}){const[i,s]=p.useState(!1);return o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:`code-browser-trigger ${n}`.trim(),onClick:()=>s(!0),"aria-label":"查看和编辑项目源码",title:r,children:[o.jsx(T0e,{}),o.jsx("span",{children:r})]}),o.jsx(Yw,{project:e,open:i,onClose:()=>s(!1),onChange:t})]})}const N0e="send_a2ui_json_to_client",Vdt=28,Hdt=3e3;function qdt(e,t,n){let r=t;for(let i=0;i65535?2:1}return r}function Xdt(e){return e<=4?1:Math.min(18,Math.max(2,Math.ceil(e/6)))}function j0e(e,t,n,r){const[i,s]=p.useState(()=>t?"":e),a=p.useRef(i),l=p.useRef(e),c=p.useRef(null),u=p.useRef(0),d=p.useRef(n);return l.current=e,d.current=n,p.useEffect(()=>{const f=a.current,h=window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(!t||h||!e.startsWith(f)){c.current!==null&&window.cancelAnimationFrame(c.current),c.current=null,f!==e&&(a.current=e,s(e));return}if(f===e||c.current!==null)return;const m=g=>{const b=l.current,y=a.current;if(!b.startsWith(y)){a.current=b,s(b),c.current=null;return}if(g-u.current{var f;(f=d.current)==null||f.call(d)},[i]),p.useEffect(()=>{i===e&&(r==null||r())},[i,r,e]),p.useEffect(()=>()=>{c.current!==null&&(window.cancelAnimationFrame(c.current),c.current=null)},[]),i}function Gdt(){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:o.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 Wdt(){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"m4.5 7 1.8 1.8L9.5 5.5"}),o.jsx("path",{d:"M12 7h7.5"}),o.jsx("path",{d:"m4.5 13 1.8 1.8 3.2-3.3"}),o.jsx("path",{d:"M12 13h7.5"}),o.jsx("path",{d:"M5 19h4"}),o.jsx("path",{d:"M12 19h7.5"})]})}function Ydt(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 R0e({text:e,done:t,answerStarted:n=!1,streaming:r=!1,onStreamFrame:i}){const[s,a]=p.useState(!(t||n)),l=p.useRef(!1);p.useEffect(()=>{l.current||a(!(t||n))},[n,t]);const c=()=>{l.current=!0,a(m=>!m)},u=e.replace(/^\s+/,""),d=j0e(u,!t||r,i),{ref:f,onScroll:h}=qge(d);return o.jsxs("div",{className:"block-thinking",children:[o.jsxs("button",{className:"think-head",onClick:c,type:"button",children:[o.jsx("span",{className:"think-icon","aria-hidden":"true",children:o.jsx(_0e,{className:`thinking-logo ${t?"":"is-active"}`})}),t?o.jsx("span",{className:"think-label think-label--done",children:"已完成思考"}):o.jsx(En,{className:"think-label",duration:2.4,spread:18,children:"思考中"}),o.jsx(VS,{className:`chev ${s?"open":""}`})]}),o.jsx("div",{className:`think-collapse ${s&&d?"open":""}`,children:o.jsx("div",{className:"think-collapse-inner",children:o.jsx("div",{className:"think-body scroll",ref:f,onScroll:h,children:d})})})]})}function Zdt({text:e}){return o.jsx("div",{className:"block-progress",role:"status","aria-live":"polite","aria-atomic":"true",children:o.jsxs("div",{className:"think-head progress-head",children:[o.jsx("span",{className:"think-icon","aria-hidden":"true",children:o.jsx(_0e,{className:"thinking-logo is-active"})}),o.jsx(En,{className:"think-label",duration:2.4,spread:18,children:e})]})})}function Kdt({value:e,onResolve:t,onResolveComparison:n,onDownload:r,onDeploy:i}){const[s,a]=p.useState(e.files?e:null),[l,c]=p.useState(!1),[u,d]=p.useState(!1),[f,h]=p.useState(null),[m,g]=p.useState(null),[b,y]=p.useState(""),[O,v]=p.useState(null),x=new Date(e.validatedAt),w=e.validatedAt?Number.isNaN(x.getTime())?e.validatedAt:x.toLocaleString("zh-CN",{hour12:!1}):"刚刚";p.useEffect(()=>{if(!O)return;const T=window.setTimeout(()=>v(null),Hdt);return()=>window.clearTimeout(T)},[O]);async function S(){if(s)return s;if(!t)throw new Error("暂时无法读取生成的源码,请稍后重试。");const T=await t(e);return a(T),T}async function E(){g("source"),y(""),v(null);try{await S(),c(!0)}catch(T){y(T instanceof Error?T.message:String(T))}finally{g(null)}}async function k(){if(r){g("download"),y(""),v(null);try{await r(e),v({message:"已开始下载"})}catch(T){y(T instanceof Error?T.message:String(T))}finally{g(null)}}}async function _(){if(n){g("compare"),y(""),v(null);try{const T=f??await n(e);h(T),d(!0)}catch(T){y(T instanceof Error?T.message:String(T))}finally{g(null)}}}async function C(){g("deploy"),y(""),v(null);try{i==null||i(await S())}catch(T){y(T instanceof Error?T.message:String(T))}finally{g(null)}}return o.jsxs(o.Fragment,{children:[o.jsxs("section",{className:`delivery-card${e.verified?" is-verified":" is-unverified"}`,"aria-label":e.verified?"已验证交付物":"生成的 Agent 源码",children:[o.jsxs("header",{className:"delivery-card-header",children:[o.jsx("span",{className:"delivery-card-icon",children:e.verified?o.jsx(Adt,{}):o.jsx(Cdt,{})}),o.jsxs("div",{children:[o.jsx("strong",{children:e.verified?"已验证交付物":"生成的 Agent 源码"}),o.jsx("span",{children:e.agentName})]})]}),o.jsxs("dl",{className:"delivery-card-grid",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"入口"}),o.jsx("dd",{children:o.jsx("code",{children:e.entryPoint})})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"文件数"}),o.jsx("dd",{children:e.fileCount})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"大小"}),o.jsxs("dd",{children:[(e.artifactSize/1024).toFixed(1)," KiB"]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:e.verified?"验证时间":"生成时间"}),o.jsx("dd",{children:w})]})]}),o.jsxs("p",{className:"delivery-card-gates",children:[e.verified?`${e.gateSummary.length} 项检查通过`:"源码已准备好,可部署"," ·"," ",o.jsx("code",{children:e.artifactSha256.slice(0,12)})]}),e.verified?null:o.jsx("p",{className:"delivery-card-guidance",children:"源码已准备好,可查看、下载或部署;部署前请确认 Runtime 配置。"}),o.jsxs("div",{className:"delivery-card-actions",children:[o.jsxs("button",{type:"button",className:"delivery-card-secondary",onClick:()=>void E(),disabled:!t||m!==null,children:[m==="source"?o.jsx(lr,{className:"spin","aria-hidden":"true"}):null,"查看源码"]}),e.projectId&&e.versionId&&e.parentVersionId?o.jsxs("button",{type:"button",className:"delivery-card-secondary",onClick:()=>void _(),disabled:!n||m!==null,children:[m==="compare"?o.jsx(lr,{className:"spin","aria-hidden":"true"}):null,m==="compare"?"正在准备…":"查看本次变更"]}):null,o.jsxs("button",{type:"button",className:"delivery-card-secondary",onClick:()=>void k(),disabled:!r||m!==null,"aria-busy":m==="download",children:[m==="download"?o.jsx(lr,{className:"spin","aria-hidden":"true"}):null,m==="download"?"正在准备…":"下载源码"]}),o.jsxs("button",{type:"button",onClick:()=>void C(),disabled:!e.deployable||!i||!t||m!==null,title:e.deployable?void 0:"源码尚未准备好",children:[m==="deploy"?o.jsx(lr,{className:"spin","aria-hidden":"true"}):null,"手动部署到 Runtime"]})]}),b?o.jsx("p",{className:"delivery-card-error",role:"alert",children:b}):null,O?o.jsx("p",{className:"delivery-card-status",role:"status","aria-live":"polite",children:O.message}):null]}),o.jsx(Yw,{project:{name:e.agentName,files:(s==null?void 0:s.files)??[]},open:l,onClose:()=>c(!1),onChange:()=>{},readOnly:!0}),o.jsx(Yw,{project:{name:(f==null?void 0:f.target.agentName)??e.agentName,files:(f==null?void 0:f.target.files)??[]},comparison:f?{baseProject:{name:f.base.agentName,files:f.base.files??[]},baseLabel:"优化前",targetLabel:"优化后"}:void 0,open:u,onClose:()=>d(!1),onChange:()=>{},readOnly:!0})]})}function I0e(){return o.jsx(R0e,{text:"",done:!1})}const Jdt=p.memo(function({text:t,streaming:n,onStreamFrame:r,onStreamComplete:i}){const s=j0e(t,n,r,i);return s?o.jsx("div",{className:"bubble",children:o.jsx(xu,{text:s,streaming:n})}):null}),eft={pending:"待处理",in_progress:"进行中",completed:"已完成",failed:"未完成"};function tft({title:e,summary:t,items:n,done:r}){const[i,s]=p.useState(!r),a=p.useRef(!1);p.useEffect(()=>{a.current||s(!r)},[r]);const l=()=>{a.current=!0,s(c=>!c)};return o.jsxs("div",{className:"block-plan",children:[o.jsxs("button",{className:"plan-head",type:"button",onClick:l,"aria-expanded":n.length>0?i:void 0,disabled:n.length===0,children:[o.jsx("span",{className:"plan-icon","aria-hidden":"true",children:o.jsx(Wdt,{})}),r?o.jsx("span",{className:"plan-title",children:e}):o.jsx(En,{className:"plan-title",duration:2.2,spread:15,children:e}),t?o.jsx("span",{className:"plan-summary",children:t}):null,n.length>0?o.jsx(DB,{className:`plan-chevron${i?" is-open":""}`}):null]}),o.jsx("div",{className:`think-collapse ${i&&n.length>0?"open":""}`,children:o.jsx("div",{className:"think-collapse-inner",children:n.length>0?o.jsx("ol",{className:"plan-items",children:n.map((c,u)=>o.jsxs("li",{"data-status":c.status,children:[o.jsx("span",{className:"plan-item-marker","aria-hidden":"true"}),o.jsx("span",{className:"plan-item-text",children:c.text}),o.jsx("small",{children:eft[c.status]})]},`${u}:${c.text}`))}):null})})]})}function nft(e){if(!e||typeof e!="object")return[];const t=e,n=t.result;let r=[];if(Array.isArray(t.studio_artifacts))r=t.studio_artifacts;else if(n&&typeof n=="object"){const i=n.studio_artifacts;Array.isArray(i)&&(r=i)}return r.flatMap(i=>{if(!i||typeof i!="object")return[];const s=i;return typeof s.name=="string"&&typeof s.contentUrl=="string"?[{name:s.name,contentUrl:s.contentUrl}]:[]})}function rft({name:e,args:t,response:n,done:r,status:i,defaultOpen:s=!1,retrying:a=!1,onBranchSelect:l}){const u=e==="create_agents"&&r&&Zct(t,n)?"failed":i??(r?"completed":"running"),d=e==="create_agents"&&u==="failed"&&a,f=Tdt(e),h=f==null?void 0:f.detailRenderer,m=(f==null?void 0:f.hideHeader)===!0,g=m||s||!!h,[b,y]=p.useState(g),O=p.useRef(!1);p.useEffect(()=>{!O.current&&g&&y(!0)},[g]);const v=()=>{O.current=!0,y(k=>!k)},x=e===N0e?"渲染 UI":e,w=nft(n),S=n==null?null:typeof n=="string"?n:JSON.stringify(n,null,2),E=S&&S.length>2e3?S.slice(0,2e3)+` -…(已截断)`:S;return o.jsxs(oi.div,{className:`block-tool${f?" block-tool--builtin":""}`,"data-status":u,initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[f&&!m?o.jsx(Hct,{definition:f,label:d?"Agent 正在调整":u==="failed"?f.failedLabel:Ydt(e,t),done:r,open:b,onToggle:v}):f?null:o.jsxs("button",{className:"tool-head tool-head--generic",onClick:v,type:"button","aria-expanded":b,children:[o.jsx("span",{className:"tool-icon tool-icon--generic","aria-hidden":"true",children:o.jsx(Gdt,{})}),r?o.jsx("span",{className:"tool-name",children:x}):o.jsx(En,{className:"tool-name",duration:2.2,spread:15,children:x}),o.jsx(DB,{className:`tool-chevron${b?" is-open":""}`})]}),o.jsx("div",{className:`${m?"":"think-collapse "}${b?"open":""}`,children:o.jsx("div",{className:"think-collapse-inner",children:h?o.jsx(h,{args:t,response:n,status:u,onBranchSelect:l}):o.jsxs("div",{className:"tool-detail",children:[t!=null&&o.jsxs("div",{className:"tool-section",children:[o.jsx("div",{className:"tool-section-label",children:"参数"}),o.jsx("pre",{className:"tool-args",children:JSON.stringify(t,null,2)})]}),E!=null&&o.jsxs("div",{className:"tool-section",children:[o.jsx("div",{className:"tool-section-label",children:"返回"}),o.jsx("pre",{className:"tool-args tool-result",children:E})]}),w.length>0&&o.jsxs("div",{className:"tool-section",children:[o.jsx("div",{className:"tool-section-label",children:"产物"}),o.jsx("div",{className:"studio-tool-artifacts",children:w.map(k=>o.jsxs("a",{href:k.contentUrl,download:k.name,children:["下载 ",k.name]},`${k.contentUrl}:${k.name}`))})]})]})})})]})}function ift({block:e,onDownload:t,onPreview:n}){const[r,i]=p.useState(""),[s,a]=p.useState(""),[l,c]=p.useState(null);p.useEffect(()=>()=>{l&&URL.revokeObjectURL(l.url)},[l]);const u=()=>c(null),d=async(m,g)=>{if(t){i(`download:${m}`),a("");try{await t(m,g)}catch(b){a(b instanceof Error?b.message:String(b))}finally{i("")}}},f=async(m,g,b)=>{if(n){i(`preview:${b}`),a("");try{const y=await n(m,g);c({name:b,url:y})}catch(y){a(y instanceof Error?y.message:String(y))}finally{i("")}}},h=e.files.filter(m=>!m.filename.endsWith(".preview.webp"));return o.jsxs("div",{className:"artifact-list",children:[h.map(m=>{const g=`${m.filename.replace(/\.pptx$/i,"")}.preview.webp`,b=e.files.find(y=>y.filename===g);return o.jsxs("div",{className:"artifact-card",children:[o.jsx("span",{className:"artifact-card__icon","aria-hidden":"true",children:o.jsx(t9,{})}),o.jsxs("span",{className:"artifact-card__copy",children:[o.jsx("span",{className:"artifact-card__name",children:m.filename}),o.jsx("span",{className:"artifact-card__hint",children:"PowerPoint 演示文稿"})]}),o.jsxs("span",{className:"artifact-card__actions",children:[b&&o.jsxs("button",{className:"artifact-card__action",type:"button",disabled:!n||r!=="",onClick:()=>void f(b.filename,b.version,m.filename),children:[r===`preview:${m.filename}`?o.jsx(lr,{className:"spin"}):o.jsx(FRe,{}),"预览"]}),o.jsxs("button",{className:"artifact-card__action artifact-card__action--primary",type:"button",disabled:!t||r!=="",onClick:()=>void d(m.filename,m.version),children:[r===`download:${m.filename}`?o.jsx(lr,{className:"spin"}):o.jsx(NN,{}),"下载"]})]})]},`${m.filename}:${m.version}`)}),s&&o.jsx("div",{className:"artifact-card__error",children:s}),l&&o.jsxs("div",{className:"artifact-preview",role:"dialog","aria-modal":"true","aria-label":`${l.name} 预览`,children:[o.jsx("button",{className:"artifact-preview__backdrop",type:"button","aria-label":"关闭预览",onClick:u}),o.jsxs("div",{className:"artifact-preview__panel",children:[o.jsxs("div",{className:"artifact-preview__header",children:[o.jsx("span",{children:l.name}),o.jsx("button",{type:"button","aria-label":"关闭预览",onClick:u,children:o.jsx(Oa,{})})]}),o.jsx("div",{className:"artifact-preview__canvas",children:o.jsx("img",{src:l.url,alt:`${l.name} 幻灯片预览`})})]})]})]})}function sft({block:e,onAuth:t}){const[n,r]=p.useState(e.done?"done":"idle"),[i,s]=p.useState(""),a=e.label||"MCP 工具集",l=(()=>{try{return e.authUri?new URL(e.authUri).host:""}catch{return""}})(),c=async()=>{if(t){s(""),r("authorizing");try{await t(e),r("done")}catch(d){s(d instanceof Error?d.message:String(d)),r("idle")}}};return e.done||n==="done"?o.jsxs(oi.div,{className:"auth-card-collapsed",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},children:[o.jsx(xH,{className:"auth-card-icon auth-card-icon--done"}),o.jsxs("span",{children:["已授权 · ",a]})]}):o.jsxs(oi.div,{className:"auth-card",initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[o.jsxs("div",{className:"auth-card-head",children:[o.jsx(xH,{className:"auth-card-icon"}),o.jsxs("span",{className:"auth-card-title",children:[a," 需要授权"]})]}),o.jsxs("p",{className:"auth-card-desc",children:["工具集 ",o.jsx("code",{className:"auth-card-code",children:a})," 使用 OAuth 保护, 需登录授权后方可调用。",l&&o.jsxs(o.Fragment,{children:[" ","将跳转至 ",o.jsx("code",{className:"auth-card-code",children:l})," 完成登录,"]}),"授权完成后对话自动继续。"]}),o.jsx("button",{className:"auth-card-btn",onClick:c,disabled:n==="authorizing"||!e.authUri,children:n==="authorizing"?o.jsxs(o.Fragment,{children:[o.jsx(lr,{className:"cw-i spin"})," 等待授权…"]}):o.jsx(o.Fragment,{children:"去授权"})}),!e.authUri&&o.jsx("div",{className:"auth-card-err",children:"未在事件中找到授权地址。"}),i&&o.jsx("div",{className:"auth-card-err",children:i})]})}function Uj({blocks:e,appName:t="",streaming:n=!1,onStreamFrame:r,onStreamComplete:i,onAction:s,onAuth:a,onArtifactDownload:l,onArtifactPreview:c,onResolveDelivery:u,onResolveDeliveryComparison:d,onDownloadDelivery:f,onDeployDelivery:h,onBranchSelect:m}){const g=e.reduce((b,y,O)=>y.kind==="text"?O:b,-1);return o.jsx(o.Fragment,{children:e.map((b,y)=>{switch(b.kind){case"progress":return o.jsx(Zdt,{text:b.text},"build-progress");case"thinking":{const O=e.slice(y+1).some(v=>v.kind==="text"&&!!v.text.trim());return o.jsx(R0e,{text:b.text,done:b.done,answerStarted:O,streaming:n,onStreamFrame:r},y)}case"text":{const O=b.text.replace(/^\s+/,"");return O?o.jsx(Jdt,{text:O,streaming:n,onStreamFrame:r,onStreamComplete:y===g?i:void 0},y):null}case"plan":return o.jsx(tft,{title:b.title,summary:b.summary,items:b.items,done:b.done},y);case"attachment":return o.jsx($j,{appName:t,items:b.files},y);case"artifact":return o.jsx(ift,{block:b,onDownload:l,onPreview:c},y);case"delivery":return o.jsx(Kdt,{value:b.value,onResolve:u,onResolveComparison:d,onDownload:f,onDeploy:h},y);case"invocation":return o.jsx(Lj,{value:b.value},y);case"tool":{if(b.name===N0e&&b.done)return null;const O=b.name==="create_agents"&&e.slice(y+1).some(v=>v.kind==="tool"&&v.name==="create_agents");return o.jsx(rft,{name:b.name,args:b.args,response:b.response,done:b.done,status:b.status,defaultOpen:b.defaultOpen,retrying:b.name==="create_agents"&&(n||O),onBranchSelect:m},y)}case"agent-transfer":return null;case"auth":return o.jsx(sft,{block:b,onAuth:a},y);case"a2ui":return Hge(b.messages).filter(O=>O.components[O.rootId]).map(O=>o.jsx(oi.div,{initial:{opacity:0,y:8,scale:.985},animate:{opacity:1,y:0,scale:1},transition:{type:"spring",stiffness:380,damping:30},children:o.jsx(jct,{surface:O,onAction:s})},`${y}-${O.surfaceId}`));default:return null}})})}const aft=()=>{};function oft(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 lft({activities:e}){const t=p.useMemo(()=>e.filter(n=>n.kind!=="status").map(oft),[e]);return t.length===0?null:o.jsx("div",{className:"skill-conversation","aria-label":"Skill 生成对话","aria-live":"polite",children:o.jsx(Uj,{blocks:t,onAction:aft})})}function GW(){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m7 9 5 5 5-5",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})})}function cT({label:e,value:t,options:n,onChange:r,disabled:i=!1,allowCustom:s=!1,required:a=!1,placeholder:l="请选择",error:c}){const u=p.useId(),d=p.useId(),f=p.useId(),h=p.useRef(null),m=p.useRef(null),g=p.useRef(null),b=p.useRef(null),y=p.useRef([]),O=n.findIndex(L=>L.value===t),v=t.trim().toLocaleLowerCase(),x=s&&v?n.filter(L=>L.value.toLocaleLowerCase().includes(v)||L.label.toLocaleLowerCase().includes(v)):n,[w,S]=p.useState(!1),[E,k]=p.useState(Math.max(0,O)),_=O>=0?n[O]:void 0,C=i||!s&&n.length===0,T=(L=!1)=>{S(!1),L&&window.requestAnimationFrame(()=>{var I,M;return s?(I=g.current)==null?void 0:I.focus():(M=m.current)==null?void 0:M.focus()})},A=L=>{C||x.length!==0&&(k(Math.min(Math.max(L,0),x.length-1)),S(!0))};p.useEffect(()=>{if(!w)return;const L=b.current,I=s?void 0:window.requestAnimationFrame(()=>{var Q;(Q=y.current[E])==null||Q.focus()}),M=Q=>{if(!L)return;const F=L.scrollTop<=0,$=L.scrollTop+L.clientHeight>=L.scrollHeight-1;(L.scrollHeight<=L.clientHeight||Q.deltaY<0&&F||Q.deltaY>0&&$)&&Q.preventDefault(),Q.stopPropagation()},N=Q=>{var F;Q.target instanceof Node&&!((F=h.current)!=null&&F.contains(Q.target))&&T()},D=Q=>{Q.key==="Escape"&&T(!0)};return L==null||L.addEventListener("wheel",M,{passive:!1}),window.addEventListener("pointerdown",N),window.addEventListener("keydown",D),()=>{I!==void 0&&window.cancelAnimationFrame(I),L==null||L.removeEventListener("wheel",M),window.removeEventListener("pointerdown",N),window.removeEventListener("keydown",D)}},[E,s,w]);const j=L=>{var M;if(x.length===0)return;const I=(L+x.length)%x.length;k(I),(M=y.current[I])==null||M.focus()};return o.jsxs("div",{ref:h,className:`skill-config-select${w?" is-open":""}`,onBlur:L=>{var I;(!L.relatedTarget||!((I=h.current)!=null&&I.contains(L.relatedTarget)))&&T()},children:[o.jsxs("span",{id:d,className:"skill-config-select__label",children:[e,a?o.jsx("span",{className:"skill-required-mark","aria-hidden":"true",children:"*"}):null]}),s?o.jsxs("div",{className:`skill-config-select__trigger is-editable${i?" is-disabled":""}`,"aria-expanded":w,children:[o.jsx("input",{ref:g,value:t,disabled:i,role:"combobox","aria-autocomplete":"list","aria-expanded":w,"aria-controls":w?u:void 0,"aria-labelledby":d,"aria-required":a,"aria-invalid":!!c,"aria-describedby":c?f:void 0,placeholder:l,onChange:L=>{r(L.target.value),k(0),n.length>0&&S(!0)},onClick:()=>{!w&&x.length>0&&A(0)},onKeyDown:L=>{var I,M;if(!(L.nativeEvent.isComposing||L.keyCode===229))if(L.key==="ArrowDown")L.preventDefault(),w?(I=y.current[E])==null||I.focus():A(0);else if(L.key==="ArrowUp")L.preventDefault(),w?(M=y.current[x.length-1])==null||M.focus():A(x.length-1);else if(L.key==="Enter"&&w){L.preventDefault();const N=x[E];N&&r(N.value),T()}else L.key==="Escape"&&(L.preventDefault(),T())}}),o.jsx("button",{type:"button",className:"skill-config-select__toggle",disabled:i||n.length===0,"aria-label":w?"收起模型选项":"展开模型选项",onClick:()=>{w?T():A(0)},children:o.jsx(GW,{})})]}):o.jsxs("button",{ref:m,type:"button",className:"skill-config-select__trigger",disabled:C,"aria-haspopup":"listbox","aria-expanded":w,"aria-controls":w?u:void 0,"aria-labelledby":d,"aria-required":a,onClick:()=>{w?T():A(O>=0?O:0)},onKeyDown:L=>{L.key==="ArrowDown"?(L.preventDefault(),A(O>=0?O:0)):L.key==="ArrowUp"&&(L.preventDefault(),A(O>=0?O:n.length-1))},children:[o.jsx("span",{className:_?void 0:"is-placeholder",title:_==null?void 0:_.label,children:(_==null?void 0:_.label)||(n.length===0?"暂无可用选项":l)}),o.jsx(GW,{})]}),w?o.jsxs("div",{ref:b,id:u,className:"skill-config-select__menu",role:"listbox","aria-labelledby":d,children:[x.length===0?o.jsx("div",{className:"skill-config-select__empty",role:"status",children:"没有匹配项,可直接使用当前模型 ID"}):null,x.map((L,I)=>{const M=L.value===t;return o.jsx("button",{ref:N=>{y.current[I]=N},type:"button",role:"option","aria-selected":M,tabIndex:I===E?0:-1,className:`skill-config-select__option${M?" is-selected":""}`,title:L.label,onFocus:()=>k(I),onClick:()=>{r(L.value),T(!0)},onKeyDown:N=>{N.key==="Enter"||N.key===" "?(N.preventDefault(),r(L.value),T(!0)):N.key==="ArrowDown"?(N.preventDefault(),j(I+1)):N.key==="ArrowUp"?(N.preventDefault(),j(I-1)):N.key==="Home"?(N.preventDefault(),j(0)):N.key==="End"&&(N.preventDefault(),j(n.length-1))},children:L.label},L.value)})]}):null,c?o.jsx("span",{id:f,className:"skill-config-select__error",role:"alert",children:c}):null]})}function ua(e,t){return e instanceof Error?e:typeof e=="string"&&e.trim()?new Error(e.trim()):new Error(t)}function zo({error:e}){var i,s,a,l,c;const t=e,n=(s=(i=t.originalError)==null?void 0:i.message)==null?void 0:s.trim(),r=[typeof t.status=="number"?`HTTP ${t.status}${t.statusText?` ${t.statusText}`:""}`:"",t.code?`错误码:${t.code}`:"",(a=t.originalError)!=null&&a.type?`错误类型:${t.originalError.type}`:"",(l=t.originalError)!=null&&l.repr&&t.originalError.repr!==n?`异常表示:${t.originalError.repr}`:"",(c=t.rawResponse)!=null&&c.trim()?`服务端原始响应: +`+y+"]"}return i.pop(),s=y,v}};const Uot={parse:Dot,stringify:Qot};var Nge=Uot;const Fot=2e5,zot=new Set(["__proto__","constructor","prototype"]),Vot=/^(?:https?:|data:|blob:|file:|javascript:|image:\/\/)/i;function Wx(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function iA(e,t=0){if(t>30)throw new Error("ECharts option nesting is too deep");if(typeof e=="number"&&!Number.isFinite(e))throw new Error("ECharts option contains a non-finite number");if(typeof e=="string"&&Vot.test(e.trim()))throw new Error("ECharts option contains an external resource");if(Array.isArray(e)){for(const n of e)iA(n,t+1);return}if(Wx(e))for(const[n,r]of Object.entries(e)){if(zot.has(n))throw new Error("ECharts option contains an unsafe key");iA(r,t+1)}}function Hot(e){var r;const t=e.trim(),n=t.match(/^(?:(?:const|let|var)\s+)?option\s*=\s*([\s\S]*?)\s*;?$/);return((r=n==null?void 0:n[1])==null?void 0:r.trim())||t}function qot(e,t){let n=1,r="",i=!1,s=!1,a=!1;for(let l=t+1;lr+2)throw new Error("Invalid ECharts gradient argument count");const i=n.slice(0,r).map(Xot),s=n[r],a=n[r+1]??!1;if(!Array.isArray(s)||typeof a!="boolean")throw new Error("Invalid ECharts gradient data");return e==="linear"?{type:e,x:i[0],y:i[1],x2:i[2],y2:i[3],colorStops:s,global:a}:{type:e,x:i[0],y:i[1],r:i[2],colorStops:s,global:a}}function Wot(e,t){const n=/^(?:new\s+)?echarts\.graphic\.(LinearGradient|RadialGradient)\s*\(/;let r="",i=!1,s=!1,a=!1;for(let l=t;lFot)throw new Error("ECharts option is too large");const n=Yot(Hot(e));let r;try{r=Nge.parse(n)}catch(a){throw/\bfunction\s*\(|=>/.test(n)?new Error("ECharts function callbacks are not supported"):a}if(!Wx(r))throw new Error("ECharts option must be a data object");iA(r);const i={...r};i.aria={...Wx(i.aria)?i.aria:{},enabled:!0};const s=i.tooltip;return Wx(s)?i.tooltip={...s,renderMode:"richText"}:Array.isArray(s)&&(i.tooltip=s.map(a=>Wx(a)?{...a,renderMode:"richText"}:a)),t&&(i.animation=!1),i}let OD;function Kot(){return OD??(OD=hd(()=>import("../visualizations/echarts/index-CGT341lL.js"),[]).catch(e=>{throw OD=void 0,e})),OD}function Jot({source:e}){const t=p.useRef(null),[n,r]=p.useState(!1),[i,s]=p.useState("");return p.useEffect(()=>{let a=!1,l,c,u;r(!1);try{u=Zot(e,window.matchMedia("(prefers-reduced-motion: reduce)").matches),s("")}catch{s("ECharts 配置不是有效且安全的数据对象,请切换到代码检查内容。");return}return Kot().then(d=>{const f=t.current;a||!f||(l=d.init(f,void 0,{renderer:"svg"}),l.setOption(u,{notMerge:!0}),typeof ResizeObserver<"u"&&(c=new ResizeObserver(()=>l==null?void 0:l.resize()),c.observe(f)),r(!0))}).catch(()=>{l==null||l.dispose(),l=void 0,a||s("图表暂时无法渲染,请切换到代码检查内容。")}),()=>{a=!0,c==null||c.disconnect(),l==null||l.dispose()}},[e]),o.jsxs("div",{className:`echarts-diagram${i?" echarts-diagram--error":""}`,role:"img","aria-label":"ECharts 图表预览","aria-busy":!n&&!i,children:[o.jsx("div",{ref:t,className:"echarts-diagram__canvas",hidden:!!i}),!n&&!i?o.jsx("div",{className:"echarts-diagram__state","aria-live":"polite",children:o.jsx(En,{duration:2.2,spread:15,children:"正在渲染图表…"})}):null,i?o.jsx("p",{className:"echarts-diagram__error",role:"alert",children:i}):null]})}const elt=p.memo(Jot);let IW,DW=Promise.resolve(),tlt=0;function nlt(){return IW??(IW=hd(async()=>{const{default:e}=await import("../visualizations/mermaid/mermaid.core-DGeIIfkU.js").then(t=>t.ay);return{default:e}},__vite__mapDeps([0,1])).then(({default:e})=>(e.initialize({startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,theme:"neutral"}),e))),IW}function rlt(e){const t=DW.then(async()=>{const n=await nlt(),r=`mermaid-diagram-${tlt+=1}`;return n.render(r,e)});return DW=t.then(()=>{},()=>{}),t}function ilt({source:e}){const t=p.useRef(null),[n,r]=p.useState(null),[i,s]=p.useState(!1);return p.useEffect(()=>{let a=!1;return r(null),s(!1),rlt(e).then(l=>{a||r(l)}).catch(()=>{a||s(!0)}),()=>{a=!0}},[e]),p.useEffect(()=>{!(n!=null&&n.bindFunctions)||!t.current||n.bindFunctions(t.current)},[n]),i?o.jsx("div",{className:"mermaid-diagram mermaid-diagram--error",children:o.jsx("p",{className:"mermaid-diagram__error",role:"alert",children:"图表暂时无法渲染,请切换到代码查看 Mermaid 内容。"})}):n?o.jsx("div",{ref:t,className:"mermaid-diagram",role:"img","aria-label":"Mermaid 图表预览",dangerouslySetInnerHTML:{__html:n.svg}}):o.jsx("div",{className:"mermaid-diagram mermaid-diagram--loading","aria-live":"polite",children:o.jsx(En,{duration:2.2,spread:15,children:"正在渲染图表…"})})}const slt=p.memo(ilt),alt="_SegmentedControl_1sl7d_1",olt="_SegmentedControlOption_1sl7d_140",llt="_SegmentedControlThumb_1sl7d_219",mL={SegmentedControl:alt,SegmentedControlOption:olt,SegmentedControlThumb:llt},Bs=({value:e,onChange:t,children:n,block:r,pill:i=!0,size:s="md",gutterSize:a,className:l,onClick:c,...u})=>{const d=p.useRef(null),f=p.useRef(null),h=p.useCallback(g=>{const b=d.current,y=f.current;if(!b||!y)return;const O=b==null?void 0:b.querySelector('[data-state="on"]');if(!O)return;const v=b.clientWidth;let x=Math.floor(O.clientWidth);const w=O.offsetLeft;if(v-(x+w)<2&&(x=x-1),y.style.width=`${Math.floor(x)}px`,y.style.transform=`translateX(${w}px)`,b.scrollWidth>v){const S=v*.15,E=b.scrollLeft,k=O.offsetLeft,_=k+x;(kE+v-S)&&g&&O.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"})}},[]);Ele({ref:d,onResize:()=>{const g=f.current;if(!g)return;const b=g.style.transition;g.style.transition="",h(!1),g.style.transition=b}}),p.useLayoutEffect(()=>{const g=d.current,b=f.current;!g||!b||(h(!!b.style.transition),b.style.transition||wC(()=>{b.style.transition="width 300ms var(--cubic-enter), transform 300ms var(--cubic-enter)"}))},[h,e,s,a,i]);const m=g=>{g&&t&&t(g)};return o.jsxs(XLe,{ref:d,className:cr(mL.SegmentedControl,l),type:"single",value:e,loop:!1,onValueChange:m,onClick:c,"data-block":r?"":void 0,"data-pill":i?"":void 0,"data-size":s,"data-gutter-size":a,...u,children:[o.jsx("div",{className:mL.SegmentedControlThumb,ref:f}),n]})},clt=({children:e,...t})=>o.jsx(KLe,{className:mL.SegmentedControlOption,...t,onPointerEnter:_9,children:o.jsx("span",{className:"relative",children:e})});Bs.Option=clt;function ult({children:e,label:t,language:n,source:r,streaming:i=!1}){const[s,a]=p.useState("preview"),l=i?"code":s;return o.jsxs("section",{className:"visualization-card","aria-label":`${t} 图表`,children:[o.jsx("div",{className:"visualization-card__toolbar",children:o.jsxs(Bs,{className:"visualization-card__tabs",value:l,size:"sm",gutterSize:"sm",pill:!1,"aria-label":`${t} 显示方式`,onChange:c=>{i||a(c)},children:[o.jsx(Bs.Option,{value:"preview",disabled:i,children:"预览"}),o.jsx(Bs.Option,{value:"code",children:"代码"})]})}),o.jsx("div",{className:"visualization-card__body",children:l==="code"?o.jsx("pre",{className:"visualization-card__code",children:o.jsx("code",{className:`language-${n}`,children:r})}):e})]})}const dlt=p.memo(ult);function flt(e){const t=e==null?void 0:e.trim().toLowerCase();if(t==="mermaid")return"mermaid";if(t==="echart"||t==="echarts")return"echarts"}const jge=[".mp4",".webm",".mov",".m4v",".ogg",".avi"];function gL(e){return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(gL).join(""):p.isValidElement(e)?gL(e.props.children):""}function hlt(e){var r;const t=p.Children.toArray(e)[0];if(!p.isValidElement(t))return;const n=(r=t.props.className)==null?void 0:r.split(/\s+/).find(i=>i.startsWith("language-"));return flt(n==null?void 0:n.slice(9))}function Rge(e){if(!e)return!1;try{const t=e.toLowerCase();return jge.some(n=>t.includes(n))}catch{return!1}}function plt(e){var r;const t=(r=e==null?void 0:e.properties)==null?void 0:r.href;if(!t)return!1;if(Rge(t))return!0;const n=e==null?void 0:e.children;if(n&&Array.isArray(n)){const i=n.map(s=>(s==null?void 0:s.value)||"").join("").toLowerCase();return jge.some(s=>i.includes(s))}return!1}function mlt({text:e,className:t,allowRawHtml:n=!0,streaming:r=!1}){const[i,s]=p.useState(null),a=(u,d)=>{if(u.src)return u.src;if(d){const f=m=>{var g;if(!m)return null;if(m.type==="source"&&((g=m.properties)!=null&&g.src))return m.properties.src;if(m.children)for(const b of m.children){const y=f(b);if(y)return y}return null},h=f({children:d});if(h)return h}return""},l=u=>{try{const f=new URL(u).pathname.split("/");return f[f.length-1]||"video.mp4"}catch{return"video.mp4"}},c=u=>u?Array.isArray(u)?u.map(d=>(d==null?void 0:d.value)||"").join("")||"video":(u==null?void 0:u.value)||"video":"video";return o.jsxs("div",{className:t?`md ${t}`:"md",children:[o.jsx(jJe,{remarkPlugins:[qtt],rehypePlugins:n?[Cot,hW]:[hW],components:{pre:({node:u,children:d,...f})=>{const h=hlt(d);if(h==="mermaid"||h==="echarts"){const m=gL(d).replace(/\n$/,"");return o.jsx(dlt,{label:h==="mermaid"?"Mermaid":"ECharts",language:h,source:m,streaming:r,children:h==="mermaid"?o.jsx(slt,{source:m}):o.jsx(elt,{source:m})})}return o.jsx("pre",{...f,children:d})},a:({node:u,...d})=>{const f=d.href;if(f&&(Rge(f)||plt(u))){const h=f,m=c(u==null?void 0:u.children);return o.jsxs("div",{className:"video-container",children:[o.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":`点击播放视频: ${m}`,onClick:()=>s({src:h,title:m}),children:[o.jsx("video",{src:h,playsInline:!0,className:"video-thumbnail",preload:"metadata"}),o.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:o.jsx(uy,{})})]}),o.jsx("div",{className:"video-caption",children:o.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",className:"video-link-text",children:m})})]})}return o.jsx("a",{...d,target:"_blank",rel:"noopener noreferrer"})},img:({node:u,src:d,alt:f,...h})=>{const m=o.jsx("img",{...h,src:d,alt:f??"",loading:"lazy"});return d?o.jsx(Eae,{src:d,children:o.jsxs("button",{type:"button",className:"image-preview-trigger","aria-label":`放大预览:${f||"图片"}`,children:[m,o.jsx("span",{className:"image-preview-hint","aria-hidden":"true",children:o.jsx(uy,{})})]})}):m},video:({node:u,src:d,children:f,...h})=>{const m=a({src:d},f);return m?o.jsx("div",{className:"video-container",children:o.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":"点击放大视频",onClick:()=>s({src:m}),children:[o.jsx("video",{src:m,...h,playsInline:!0,className:"video-thumbnail",children:f}),o.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:o.jsx(uy,{})})]})}):o.jsx("video",{src:d,controls:!0,playsInline:!0,className:"video-inline",...h,children:f})}},children:e}),i&&o.jsx("div",{className:"video-viewer-backdrop",role:"dialog","aria-modal":"true","aria-label":"视频预览",onClick:()=>s(null),children:o.jsxs("div",{className:"video-viewer",onClick:u=>u.stopPropagation(),children:[o.jsxs("div",{className:"video-viewer-header",children:[o.jsx("div",{className:"video-viewer-title",children:i.title||l(i.src)}),o.jsxs("nav",{className:"video-viewer-nav",children:[o.jsx("a",{href:i.src,download:i.title||l(i.src),"aria-label":"下载视频",title:"下载视频",className:"video-viewer-download",children:o.jsx(NN,{})}),o.jsx("button",{type:"button",className:"video-viewer-close","aria-label":"关闭",onClick:()=>s(null),children:o.jsx(ba,{})})]})]}),o.jsx("div",{className:"video-viewer-body",children:o.jsx("video",{src:i.src,controls:!0,autoPlay:!0,playsInline:!0,className:"video-fullscreen"})})]})})]})}const wu=p.memo(mlt),glt="未知来源",blt="未知创建者";function Fv(e){return(e==null?void 0:e.trim())||glt}function Ige(e){return(e==null?void 0:e.trim())||blt}function ylt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M5 5.5A2.5 2.5 0 0 1 7.5 3H19v16H7.5A2.5 2.5 0 0 0 5 21.5v-16Z"}),o.jsx("path",{d:"M5 18.5A2.5 2.5 0 0 1 7.5 16H19"}),o.jsx("path",{d:"M9 7h6M9 10h4"})]})}function Olt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M6 3h8l4 4v14H6V3Z"}),o.jsx("path",{d:"M14 3v5h5M9 12h6M9 16h6"})]})}function xlt(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m7 7 10 10M17 7 7 17"})})}function vlt(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"M12 5v14M5 12h14"})})}function CE({title:e,children:t,onClose:n,busy:r=!1,className:i=""}){const s=p.useId(),a=p.useRef(null),l=p.useRef(null),c=p.useRef(r),u=p.useRef(n);return p.useEffect(()=>{c.current=r,u.current=n},[r,n]),p.useEffect(()=>{var m;const d=document.activeElement instanceof HTMLElement?document.activeElement:null,f=document.body.style.overflow;document.body.style.overflow="hidden",(m=a.current)==null||m.focus();const h=g=>{if(g.key==="Escape"&&!c.current){u.current();return}if(g.key!=="Tab")return;const b=l.current;if(!b)return;const y=Array.from(b.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), a[href], audio[controls], video[controls], iframe, [tabindex]:not([tabindex="-1"])')).filter(x=>x.getClientRects().length>0);if(y.length===0){g.preventDefault();return}const O=y[0],v=y[y.length-1];g.shiftKey&&(document.activeElement===O||!b.contains(document.activeElement))?(g.preventDefault(),v.focus()):!g.shiftKey&&(document.activeElement===v||!b.contains(document.activeElement))&&(g.preventDefault(),O.focus())};return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h),document.body.style.overflow=f,d!=null&&d.isConnected&&d.focus()}},[]),Tr.createPortal(o.jsx("div",{className:"knowledge-dialog-backdrop",onMouseDown:d=>{d.target===d.currentTarget&&!r&&n()},children:o.jsxs("section",{ref:l,className:`knowledge-dialog${i?` ${i}`:""}`,role:"dialog","aria-modal":"true","aria-labelledby":s,"aria-busy":r||void 0,children:[o.jsxs("header",{className:"knowledge-dialog__header",children:[o.jsx("h2",{id:s,children:e}),o.jsx("button",{ref:a,type:"button",onClick:n,disabled:r,"aria-label":"关闭",children:o.jsx(xlt,{})})]}),t]})}),document.body)}function Yw({message:e}){return e?o.jsx("div",{className:"knowledge-form-error",role:"alert",children:e}):null}function bL(e){return e instanceof DOMException&&e.name==="AbortError"}function wlt(e){if(!e)return"";const t=Date.parse(e);return Number.isFinite(t)?new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(t):e}const Dge=[".jpg",".jpeg",".png"].join(","),Slt=new Set(Dge.split(",")),Pge=[".pdf",".pptx",".docx",".xlsx",".txt"].join(","),Elt=new Set(Pge.split(",")),klt=200*1024*1024;function yL(e){const t=e.lastIndexOf(".");return t<0?"":e.slice(t).toLocaleLowerCase()}function _lt(e,t){return e.size>klt?"单个文件不能超过 200 MB":t==="image"?Slt.has(yL(e.name))?"":"请选择 PNG、JPG 或 JPEG 图片":Elt.has(yL(e.name))?"":"请选择 PDF、PPTX、DOCX、XLSX 或 TXT 文件"}function AB(e){return e<=0?"-":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function OL(e){var i;const t=e.type.trim().replace(/^\./,"");if(t)return t.toUpperCase();const n=e.name.trim(),r=n.includes(".")?(i=n.split(".").pop())==null?void 0:i.trim():"";return r?r.toUpperCase():"-"}function Tlt({region:e,onClose:t,onCreated:n}){const[r,i]=p.useState(""),[s,a]=p.useState(""),[l,c]=p.useState(!1),[u,d]=p.useState(!1),[f,h]=p.useState(""),m=r.trim(),g=!!(m&&!/^[A-Za-z][A-Za-z0-9_]{0,47}$/.test(m)),b=async y=>{if(y.preventDefault(),c(!0),!m||g)return;d(!0),h("");const O={name:m,description:s.trim()||void 0,region:e};try{n(await HGe(O))}catch(v){h(Ha(v,"创建知识库失败"))}finally{d(!1)}};return o.jsx(CE,{title:"新建知识库",onClose:t,busy:u,children:o.jsxs("form",{onSubmit:y=>void b(y),children:[o.jsxs("div",{className:"knowledge-dialog__body",children:[o.jsxs("label",{children:[o.jsx("span",{children:"名称"}),o.jsx("input",{autoFocus:!0,value:r,maxLength:48,"aria-invalid":l&&g||void 0,"aria-describedby":"knowledge-name-help",onBlur:()=>c(!0),onChange:y=>i(y.target.value)})]}),o.jsx("p",{id:"knowledge-name-help",className:`knowledge-dialog__note${l&&g?" is-error":""}`,role:l&&g?"alert":void 0,children:l&&g?"名称必须以字母开头,且只能包含字母、数字和下划线。":"以字母开头,仅支持字母、数字和下划线,最多 48 个字符。"}),o.jsxs("label",{children:[o.jsx("span",{children:"描述(可选)"}),o.jsx("textarea",{value:s,maxLength:80,onChange:y=>a(y.target.value)})]}),o.jsx(Yw,{message:f})]}),o.jsxs("footer",{className:"knowledge-dialog__actions",children:[o.jsx("button",{type:"button",onClick:t,disabled:u,children:"取消"}),o.jsx("button",{type:"submit",className:"is-primary",disabled:u||!m||g,children:u?"创建中":"创建"})]})]})})}function Clt({item:e,onClose:t,onUpdated:n}){const[r,i]=p.useState(e.description),[s,a]=p.useState(!1),[l,c]=p.useState(""),u=async d=>{d.preventDefault(),a(!0),c("");try{n(await qGe(e.id,e.region,{description:r.trim()}))}catch(f){c(Ha(f,"更新知识库失败"))}finally{a(!1)}};return o.jsx(CE,{title:"编辑知识库",onClose:t,busy:s,children:o.jsxs("form",{onSubmit:d=>void u(d),children:[o.jsxs("div",{className:"knowledge-dialog__body",children:[o.jsxs("label",{children:[o.jsx("span",{children:"名称"}),o.jsx("input",{value:e.name,disabled:!0})]}),o.jsxs("label",{children:[o.jsx("span",{children:"描述"}),o.jsx("textarea",{autoFocus:!0,value:r,maxLength:80,onChange:d=>i(d.target.value)})]}),o.jsx("p",{className:"knowledge-dialog__note",children:"AgentKit 当前仅支持更新知识库描述。"}),o.jsx(Yw,{message:l})]}),o.jsxs("footer",{className:"knowledge-dialog__actions",children:[o.jsx("button",{type:"button",onClick:t,disabled:s,children:"取消"}),o.jsx("button",{type:"submit",className:"is-primary",disabled:s,children:s?"保存中":"保存"})]})]})})}function Mge(e){if(!e.trim())return{};const t=JSON.parse(e);if(!t||Array.isArray(t)||typeof t!="object")throw new Error("Metadata 必须是 JSON 对象");return t}function Alt({base:e,onClose:t,onCreated:n,onAssociationInvalid:r}){const[i,s]=p.useState("document"),[a,l]=p.useState(""),[c,u]=p.useState(""),[d,f]=p.useState(""),[h,m]=p.useState(null),[g,b]=p.useState(!1),[y,O]=p.useState("{}"),[v,x]=p.useState(""),[w,S]=p.useState(""),[E,k]=p.useState(null),_=p.useRef(null),T=p.useRef(null),C=p.useRef(null),A=p.useRef(0),j=!!v;p.useEffect(()=>{var D;E&&!j&&((D=C.current)==null||D.focus())},[j,E]);const M=D=>{j||D===i||(s(D),m(null),f(""),l(""),u(""),S(""),k(null),b(!1),A.current=0,_.current&&(_.current.value=""))},I=D=>{if(!D||i==="web")return;const Q=_lt(D,i);if(Q){m(null),l(""),u(""),S(Q);return}m(D),S(""),l(D.name.replace(/\.[^.]+$/,"")),u(yL(D.name).slice(1))},$=async D=>{if(D.preventDefault(),i==="web"?!d.trim():!h)return;let Q;try{Q=Mge(y)}catch(F){S(Ha(F,"Metadata 格式错误"));return}x(i==="web"?E?"save":"preview":"upload"),S("");try{if(i==="web")if(E){const F={sourceType:"url",metadata:E.metadata,url:E.preview.url,sourceTitle:E.preview.name,sourceMarkdown:E.preview.sourceMarkdown};await YGe(e.id,e.region,F),n()}else{const F=await ZGe(e.id,e.region,{url:d.trim()});if(!F.sourceMarkdown.trim())throw new Error("网页没有可预览的 Markdown 内容");k({preview:F,metadata:Q})}else h&&(await KGe(e.id,e.region,{file:h,name:a.trim()||void 0,documentType:c.trim()||void 0,metadata:Q}),n())}catch(F){F instanceof wj&&F.errorCode===Whe?r(F):S(Ha(F,i==="web"?E?"添加网页失败":"生成网页预览失败":"上传文件失败"))}finally{x("")}},N=()=>{j||(k(null),S(""),requestAnimationFrame(()=>{var D;return(D=T.current)==null?void 0:D.focus()}))};return o.jsx(CE,{title:E?"预览网页内容":"添加数据",onClose:t,busy:j,className:E?"knowledge-dialog--preview knowledge-dialog--web-confirm":"",children:o.jsx("form",{onSubmit:D=>void $(D),children:E?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"knowledge-preview knowledge-web-preview",children:[o.jsxs("div",{className:"knowledge-preview__meta",children:[o.jsx("strong",{title:E.preview.name,children:E.preview.name}),o.jsx("a",{href:E.preview.url,target:"_blank",rel:"noopener noreferrer",children:"打开原网页"})]}),o.jsx("div",{className:"knowledge-preview__body","aria-live":"polite",children:o.jsx("div",{className:"knowledge-preview__markdown-shell",children:o.jsx(wu,{text:E.preview.sourceMarkdown,allowRawHtml:!1,className:"knowledge-preview__markdown"})})}),w?o.jsx("div",{className:"knowledge-web-preview__error",children:o.jsx(Yw,{message:w})}):null]}),o.jsxs("footer",{className:"knowledge-dialog__actions",children:[o.jsx("button",{type:"button",className:"is-back",onClick:N,disabled:j,children:"返回修改"}),o.jsx("button",{type:"button",onClick:t,disabled:j,children:"取消"}),o.jsx("button",{ref:C,type:"submit",className:"is-primary",disabled:j,children:v==="save"?"添加中":"确认添加"})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"knowledge-dialog__body",children:[o.jsx("div",{className:"knowledge-source-tabs",role:"tablist","aria-label":"知识来源",children:[["image","图片"],["document","文档文件"],["web","在线网页"]].map(([D,Q])=>o.jsx("button",{type:"button",role:"tab",id:`knowledge-source-${D}-tab`,"aria-controls":`knowledge-source-${D}-panel`,"aria-selected":i===D,tabIndex:i===D?0:-1,className:i===D?"is-active":"",disabled:j,onClick:()=>M(D),onKeyDown:F=>{const L=["image","document","web"];if(!["ArrowLeft","ArrowRight","Home","End"].includes(F.key))return;F.preventDefault();const H=L.indexOf(D),z=F.key==="Home"?L[0]:F.key==="End"?L[L.length-1]:L[(H+(F.key==="ArrowRight"?1:-1)+L.length)%L.length];M(z),requestAnimationFrame(()=>{var B;return(B=document.getElementById(`knowledge-source-${z}-tab`))==null?void 0:B.focus()})},children:Q},D))}),o.jsx("div",{id:`knowledge-source-${i}-panel`,className:"knowledge-source-panel",role:"tabpanel","aria-labelledby":`knowledge-source-${i}-tab`,children:i==="web"?o.jsxs(o.Fragment,{children:[o.jsxs("label",{children:[o.jsx("span",{children:"网页 URL"}),o.jsx("input",{ref:T,autoFocus:!0,type:"url",value:d,disabled:j,onChange:D=>{f(D.target.value),S("")},placeholder:"https://example.com/article"})]}),o.jsx("div",{className:"knowledge-upload-status",role:"status","aria-live":"polite",children:v==="preview"?o.jsx(En,{children:"正在抓取网页并生成 Markdown 预览"}):null})]}):o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:_,className:"knowledge-upload-input",type:"file","aria-label":"选择知识文件",accept:i==="image"?Dge:Pge,disabled:j,onChange:D=>{var Q;I(((Q=D.currentTarget.files)==null?void 0:Q[0])??null),D.currentTarget.value=""}}),o.jsxs("button",{type:"button",className:`knowledge-upload-dropzone${g?" is-dragging":""}${h?" is-ready":""}`,disabled:j,onClick:()=>{var D;return(D=_.current)==null?void 0:D.click()},onDragEnter:D=>{D.preventDefault(),!j&&(A.current+=1,b(!0))},onDragOver:D=>{D.preventDefault(),j||(D.dataTransfer.dropEffect="copy")},onDragLeave:D=>{D.preventDefault(),A.current=Math.max(0,A.current-1),A.current===0&&b(!1)},onDrop:D=>{var Q;D.preventDefault(),A.current=0,b(!1),j||I(((Q=D.dataTransfer.files)==null?void 0:Q[0])??null)},children:[o.jsx("strong",{children:h?h.name:"选择文件或拖拽到这里"}),o.jsx("span",{children:h?`${AB(h.size)} · 点击可重新选择`:i==="image"?"支持 PNG、JPG 和 JPEG,单个文件不超过 200 MB":"支持 PDF、PPTX、DOCX、XLSX 和 TXT,单个文件不超过 200 MB"})]}),o.jsx("div",{className:"knowledge-upload-status",role:"status","aria-live":"polite",children:j?o.jsx(En,{children:"正在上传文件并添加到知识库"}):null})]})}),i!=="web"?o.jsxs("div",{className:"knowledge-dialog__fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:"名称(可选)"}),o.jsx("input",{value:a,disabled:j,maxLength:256,onChange:D=>l(D.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"类型(可选)"}),o.jsx("input",{value:c,disabled:j,maxLength:64,onChange:D=>u(D.target.value),placeholder:"pdf、docx、png"})]})]}):null,o.jsxs("label",{children:[o.jsx("span",{children:"Metadata(JSON)"}),o.jsx("textarea",{className:"is-code",value:y,disabled:j,onChange:D=>O(D.target.value),spellCheck:!1})]}),o.jsx(Yw,{message:w})]}),o.jsxs("footer",{className:"knowledge-dialog__actions",children:[o.jsx("button",{type:"button",onClick:t,disabled:j,children:"取消"}),o.jsx("button",{type:"submit",className:"is-primary",disabled:j||(i==="web"?!d.trim():!h),children:j?i==="web"?"生成中":"上传中":i==="web"?"生成预览":"上传文件"})]})]})})})}function Nlt({base:e,item:t,onClose:n,onUpdated:r}){const[i,s]=p.useState(()=>JSON.stringify(t.metadata??{},null,2)),[a,l]=p.useState(!1),[c,u]=p.useState(""),d=async f=>{f.preventDefault();let h;try{h=Mge(i)}catch(m){u(Ha(m,"Metadata 格式错误"));return}l(!0),u("");try{r(await JGe(e.id,t.id,e.region,{metadata:h}))}catch(m){u(Ha(m,"更新知识失败"))}finally{l(!1)}};return o.jsx(CE,{title:"编辑知识 Metadata",onClose:n,busy:a,children:o.jsxs("form",{onSubmit:f=>void d(f),children:[o.jsxs("div",{className:"knowledge-dialog__body",children:[o.jsxs("label",{children:[o.jsx("span",{children:"知识"}),o.jsx("input",{value:t.name||t.id,disabled:!0})]}),o.jsxs("label",{children:[o.jsx("span",{children:"Metadata(JSON)"}),o.jsx("textarea",{autoFocus:!0,className:"is-code knowledge-metadata-editor",value:i,onChange:f=>s(f.target.value),spellCheck:!1})]}),o.jsx(Yw,{message:c})]}),o.jsxs("footer",{className:"knowledge-dialog__actions",children:[o.jsx("button",{type:"button",onClick:n,disabled:a,children:"取消"}),o.jsx("button",{type:"submit",className:"is-primary",disabled:a,children:a?"保存中":"保存"})]})]})})}const Lge=new Set(["avif","bmp","gif","jpeg","jpg","png","svg","webp"]),$ge=new Set(["aac","flac","m4a","mp3","ogg","wav","webm"]),Bge=new Set(["m4v","mov","mp4","mpeg","mpg","ogg","webm"]),jlt=new Set(["pdf"]),Rlt=new Set(["doc","docx","ppt","pptx","xls","xlsx"]),Ilt=new Set(["creating","indexing","pending","processing","queued","submitted"]),Dlt=new Set(["error","failed","unavailable"]);function PW(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function C2(e){if(e==null||e==="")return"-";if(["string","number","boolean"].includes(typeof e))return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function Plt(e){if(Array.isArray(e)){if(e.length===0)return null;const r=e.map(PW);if(r.some(i=>Object.keys(i).length>0)){const i=[...new Set(r.flatMap(s=>Object.keys(s)))];return{columns:i,rows:r.map(s=>i.map(a=>C2(s[a])))}}return{columns:["值"],rows:e.map(i=>[C2(i)])}}const t=PW(e),n=Object.entries(t);if(n.length===0)return null;if(n.every(([,r])=>Array.isArray(r))){const r=n.map(([s])=>s),i=Math.max(...n.map(([,s])=>s.length));return{columns:r,rows:Array.from({length:i},(s,a)=>n.map(([,l])=>C2(l[a])))}}return{columns:["字段","值"],rows:n.map(([r,i])=>[r,C2(i)])}}function Qge(e){const t=e.trim();if(!t||t.startsWith("//"))return"";if(t.startsWith("/"))return t;try{const n=new URL(t);return["http:","https:"].includes(n.protocol)?n.href:""}catch{return""}}function Mlt(e){const t=Qge(e);return t.startsWith("http://")||t.startsWith("https://")?t:""}function Llt(e){var i;const t=e.attachmentType.trim().toLocaleLowerCase();if(t==="image"||t==="doc-image"||t.startsWith("image/"))return"image";if(t==="audio"||t.startsWith("audio/"))return"audio";if(t==="video"||t.startsWith("video/"))return"video";if(t==="pdf"||t==="application/pdf")return"pdf";const n=e.attachmentUrl.split(/[?#]/,1)[0],r=n.includes(".")?((i=n.split(".").pop())==null?void 0:i.toLocaleLowerCase())??"":"";return Lge.has(r)?"image":$ge.has(r)?"audio":Bge.has(r)?"video":jlt.has(r)?"pdf":t||r?"file":"none"}function $lt(e){const t=e.status.trim().toLocaleLowerCase();if(Ilt.has(t))return{title:"数据正在处理中",detail:"知识库完成解析后即可预览,请稍后重新加载。"};if(Dlt.has(t))return{title:"数据解析失败",detail:"请检查源文件或网页地址后重新添加,也可以重新加载最新状态。"};const n=OL(e).toLocaleLowerCase();return n==="pdf"||Rlt.has(n)?{title:"暂时没有可预览的解析内容",detail:"此类文件会在知识库完成解析后显示文本、表格或页面图片。"}:Lge.has(n)||$ge.has(n)||Bge.has(n)?{title:"暂时没有可预览的媒体内容",detail:"知识库尚未返回可访问的媒体预览,请稍后重新加载。"}:{title:"暂无可预览的数据内容",detail:"知识库尚未返回解析结果,请稍后重新加载。"}}function Blt({chunk:e}){const[t,n]=p.useState(!1),r=Qge(e.attachmentUrl),i=Llt(e);return!r||i==="none"?null:t?o.jsx("div",{className:"knowledge-preview__attachment-error",children:"附件无法预览,请稍后重试。"}):i==="image"?o.jsx("img",{className:"knowledge-preview__image",src:r,alt:e.title||"知识数据图片",loading:"lazy",onError:()=>n(!0)}):i==="audio"?o.jsx("audio",{className:"knowledge-preview__audio",src:r,controls:!0,preload:"metadata",onError:()=>n(!0),children:"当前浏览器不支持音频预览。"}):i==="video"?o.jsx("video",{className:"knowledge-preview__video",src:r,controls:!0,playsInline:!0,preload:"metadata",onError:()=>n(!0),children:"当前浏览器不支持视频预览。"}):i==="pdf"?o.jsxs("div",{className:"knowledge-preview__pdf",children:[o.jsx("iframe",{src:r,title:e.title?`${e.title} PDF 预览`:"PDF 预览",sandbox:"",referrerPolicy:"no-referrer",onError:()=>n(!0)}),o.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",children:"无法显示时,在新窗口打开 PDF"})]}):o.jsxs("div",{className:"knowledge-preview__file-fallback",children:[o.jsx("p",{children:"当前格式暂不支持直接在线预览,已优先显示解析后的内容。"}),o.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",children:"打开原文件"})]})}function Qlt({base:e,item:t,onClose:n}){const[r,i]=p.useState([]),[s,a]=p.useState(t),[l,c]=p.useState(""),[u,d]=p.useState(!0),[f,h]=p.useState(!1),[m,g]=p.useState(!1),[b,y]=p.useState(""),O=p.useRef(0),v=p.useRef(null),x=p.useCallback(async(k=0)=>{var C;(C=v.current)==null||C.abort();const _=new AbortController;v.current=_;const T=O.current+1;O.current=T,k>0?h(!0):d(!0),y(""),k===0&&(i([]),g(!1));try{const A=await WGe(e.id,t.id,{region:e.region,offset:k,signal:_.signal});if(O.current!==T)return;a(A.document.id?A.document:t),c(A.sourceMarkdown||A.document.sourceMarkdown),i(j=>k>0?[...j,...A.chunks]:A.chunks),g(A.hasMore)}catch(A){!bL(A)&&O.current===T&&y(Ha(A,"加载数据预览失败"))}finally{O.current===T&&(d(!1),h(!1))}},[e.id,e.region,t]);p.useEffect(()=>(x(),()=>{var k;(k=v.current)==null||k.abort(),O.current+=1}),[x]);const w=Mlt(s.url||t.url),S=$lt(s),E=s.metadata._veadk_content_format==="markdown";return o.jsx(CE,{title:s.name||t.name||t.id,onClose:n,className:"knowledge-dialog--preview",children:o.jsxs("div",{className:"knowledge-preview",children:[s.sizeBytes>0||w?o.jsxs("div",{className:"knowledge-preview__meta",children:[s.sizeBytes>0?o.jsx("span",{children:AB(s.sizeBytes)}):null,w?o.jsx("a",{href:w,target:"_blank",rel:"noopener noreferrer",children:"打开原网页"}):null]}):null,o.jsx("div",{className:"knowledge-preview__body","aria-live":"polite",children:l?o.jsx("div",{className:"knowledge-preview__markdown-shell",children:o.jsx(wu,{text:l,allowRawHtml:!1,className:"knowledge-preview__markdown"})}):u?o.jsx("div",{className:"knowledge-preview__state",role:"status",children:o.jsx(En,{as:"span",duration:2.4,children:"正在加载数据预览"})}):b&&r.length===0?o.jsxs("div",{className:"knowledge-preview__state is-error",role:"alert",children:[o.jsx("p",{children:b}),o.jsx("button",{type:"button",onClick:()=>void x(),children:"重试"})]}):r.length===0?o.jsxs("div",{className:"knowledge-preview__state",children:[o.jsx("p",{children:S.title}),o.jsx("span",{children:w?"您可以打开原网页查看来源内容。":S.detail}),o.jsx("button",{type:"button",onClick:()=>void x(),children:"重新加载"})]}):o.jsxs("div",{className:"knowledge-preview__chunks",children:[r.map((k,_)=>{const T=Plt(k.tableFields),C=k.id||`${_}:${k.title}`;return o.jsxs("article",{className:"knowledge-preview__chunk",children:[o.jsx("header",{children:o.jsx("h3",{children:k.title||`片段 ${_+1}`})}),k.content?E?o.jsx(wu,{text:k.content,allowRawHtml:!1,className:"knowledge-preview__markdown"}):o.jsx("p",{className:"knowledge-preview__content",children:k.content}):null,T?o.jsx("div",{className:"knowledge-preview__table-wrap",children:o.jsxs("table",{children:[o.jsx("thead",{children:o.jsx("tr",{children:T.columns.map((A,j)=>o.jsx("th",{scope:"col",children:A},`${A}:${j}`))})}),o.jsx("tbody",{children:T.rows.map((A,j)=>o.jsx("tr",{children:A.map((M,I)=>o.jsx("td",{children:M},I))},j))})]})}):null,o.jsx(Blt,{chunk:k})]},C)}),b?o.jsx("div",{className:"knowledge-preview__more-error",role:"alert",children:b}):null,m?o.jsx("button",{type:"button",className:"knowledge-preview__load-more",disabled:f,onClick:()=>void x(r.length),children:f?o.jsx(En,{as:"span",duration:2.4,children:"正在加载更多"}):"加载更多"}):null]})})]})})}function Ult({cloudProvider:e,region:t,active:n=!0,activationRevision:r=0,onDetailChange:i,toolbarLeading:s,toolbarFilters:a}){const[l,c]=p.useState([]),[u,d]=p.useState({}),[f,h]=p.useState([]),[m,g]=p.useState(""),[b,y]=p.useState("overview"),[O,v]=p.useState(""),[x,w]=p.useState(""),[S,E]=p.useState(!0),[k,_]=p.useState(!1),[T,C]=p.useState(""),[A,j]=p.useState([]),[M,I]=p.useState(!1),[$,N]=p.useState(""),[D,Q]=p.useState(""),[F,L]=p.useState(""),[H,z]=p.useState(!1),[B,V]=p.useState(!1),[W,le]=p.useState(!1),[be,re]=p.useState(null),[q,G]=p.useState(null),[J,de]=p.useState(null),[ve,Pe]=p.useState(null),[Ae,Ue]=p.useState(null),[Ke,Ce]=p.useState(!1),Le=p.useRef(0),pe=p.useRef(0),me=p.useRef([]),we=p.useRef(!1),Ee=p.useRef(!1),st=p.useRef(null),$e=p.useRef(null),ie=p.useRef({}),ce=p.useRef(!1),Ie=p.useRef(null),We=p.useRef(null),K=p.useRef(null),_e=p.useRef(null),Be=p.useMemo(()=>[t],[t]),He=p.useCallback(Se=>`${Se.region}\0${Se.id}`,[]),Ye=l.find(Se=>He(Se)===m)??null,ot=!!(Ye&&F===He(Ye));p.useEffect(()=>{i==null||i(!!Ye)},[i,Ye]),p.useEffect(()=>{y("overview"),w("")},[m]);const Tt=p.useMemo(()=>{const Se=O.trim().toLocaleLowerCase();return Se?l.filter(ze=>[ze.name,ze.description,ze.ownerLabel,ze.providerKnowledgeId].some(ht=>ht.toLocaleLowerCase().includes(Se))):l},[l,O]),Ft=p.useMemo(()=>{const Se=x.trim().toLocaleLowerCase();return Se?A.filter(ze=>[ze.name,ze.id,OL(ze)].some(ht=>ht.toLocaleLowerCase().includes(Se))):A},[x,A]);p.useEffect(()=>{G(null)},[Ye==null?void 0:Ye.id,Ye==null?void 0:Ye.region]);const At=p.useCallback(async(Se=!1)=>{var _t;if(Se&&(ce.current||Object.keys(ie.current).length===0))return;(_t=st.current)==null||_t.abort();const ze=new AbortController;st.current=ze;const ht=Le.current+1;Le.current=ht,ce.current=!0,Se?_(!0):E(!0),C(""),Se||h([]);try{const Nt=await VGe({regions:Be,nextTokens:Se?ie.current:void 0,signal:ze.signal});if(Le.current!==ht)return;c(an=>Se?[...an,...Nt.items.filter(oe=>!an.some(Zt=>He(Zt)===He(oe)))]:Nt.items),ie.current=Nt.nextTokens,d(Nt.nextTokens);const rn=Nt.failures.map(({region:an,error:oe})=>`${Zf(an,e)}:${Ha(oe,"加载失败")}`);h(an=>Se?[...new Set([...an,...rn])]:rn),Se||g(an=>Nt.items.some(oe=>He(oe)===an)?an:"")}catch(Nt){if(bL(Nt))return;Le.current===ht&&(Se?h(rn=>[...new Set([...rn,Ha(Nt,"加载更多知识库失败")])]):C(Ha(Nt,"加载知识库失败")))}finally{Le.current===ht&&(ce.current=!1,E(!1),_(!1))}},[He,e,Be]),Ge=p.useCallback(async(Se,ze=!1)=>{var Nt;if(ze&&we.current)return;(Nt=$e.current)==null||Nt.abort();const ht=new AbortController;$e.current=ht;const _t=pe.current+1;pe.current=_t,ze||(me.current=[],Ee.current=!1,j([]),z(!1),Q("")),we.current=!0,I(!0),ze?Q(""):N("");try{const rn=await GGe(Se.id,{region:Se.region,offset:ze?me.current.length:0,signal:ht.signal});if(pe.current!==_t)return;L(Fe=>Fe===He(Se)?"":Fe);const an=me.current,oe=ze?[...an,...rn.items.filter(Fe=>!Fe.id||!an.some(Rt=>Rt.id===Fe.id))]:rn.items,Zt=rn.hasMore&&(!ze||oe.length>an.length);me.current=oe,Ee.current=Zt,j(oe),z(Zt)}catch(rn){if(bL(rn))return;pe.current===_t&&(rn instanceof wj&&rn.errorCode===Whe&&(L(He(Se)),re(oe=>oe&&He(oe)===He(Se)?null:oe)),ze?Q(Ha(rn,"加载更多数据失败")):N(Ha(rn,"加载数据失败")))}finally{pe.current===_t&&(we.current=!1,I(!1))}},[He]);p.useEffect(()=>{var Se;(Se=st.current)==null||Se.abort(),Le.current+=1,ce.current=!1,ie.current={},c([]),d({}),h([]),g(""),L(""),C(""),E(!0)},[e]),p.useEffect(()=>{if(n)return At(),()=>{var Se;(Se=st.current)==null||Se.abort(),Le.current+=1,ce.current=!1}},[n,r,At]),p.useEffect(()=>{var Se,ze;if(!n){(Se=$e.current)==null||Se.abort(),pe.current+=1,we.current=!1;return}if(!Ye){(ze=$e.current)==null||ze.abort(),pe.current+=1,me.current=[],we.current=!1,Ee.current=!1,j([]),z(!1),Q("");return}return Ge(Ye),()=>{var ht;(ht=$e.current)==null||ht.abort(),pe.current+=1,we.current=!1}},[n,r,Ye==null?void 0:Ye.id,Ye==null?void 0:Ye.region]);const Je=n&&!Ye&&!O.trim()&&!S&&!k&&!T&&Object.keys(u).length>0;p.useEffect(()=>{const Se=We.current,ze=Ie.current;if(!Se||!ze||!Je)return;const ht=new IntersectionObserver(([_t])=>{_t.isIntersecting&&At(!0)},{root:ze,rootMargin:"240px 0px",threshold:.01});return ht.observe(Se),()=>ht.disconnect()},[Je,At]);const it=()=>{const Se=Ie.current;!Se||!Je||Se.scrollHeight-Se.scrollTop-Se.clientHeight<=240&&At(!0)},Et=!!(Ye&&A.length>0&&H&&!M&&!D);p.useEffect(()=>{const Se=_e.current,ze=K.current;if(!Ye||!Se||!ze||!Et)return;const ht=new IntersectionObserver(([_t])=>{_t.isIntersecting&&Ge(Ye,!0)},{root:K.current,rootMargin:"240px 0px",threshold:.01});return ht.observe(Se),()=>ht.disconnect()},[Et,Ge,Ye==null?void 0:Ye.id,Ye==null?void 0:Ye.region]);const Ve=()=>{const Se=K.current;if(!Ye||!Se||!Ee.current||we.current||D)return;const{scrollHeight:ze,scrollTop:ht,clientHeight:_t}=Se;ze-ht-_t<=240&&Ge(Ye,!0)},ye=Se=>{c(ze=>ze.map(ht=>He(ht)===He(Se)?Se:ht))},Qe=async()=>{if(ve){Ce(!0);try{await XGe(ve.id,ve.region),c(Se=>Se.filter(ze=>He(ze)!==He(ve))),L(Se=>Se===He(ve)?"":Se),m===He(ve)&&g(""),Pe(null)}catch(Se){C(Ha(Se,"删除知识库失败")),Pe(null)}finally{Ce(!1)}}},rt=async()=>{if(!(!Ye||!Ae)){Ce(!0);try{await eWe(Ye.id,Ae.id,Ye.region);const Se=me.current.filter(ze=>ze.id!==Ae.id);me.current=Se,j(Se),Ue(null)}catch(Se){N(Ha(Se,"删除知识失败")),Ue(null)}finally{Ce(!1)}}};return o.jsxs("section",{className:`knowledge-library${Ye?" is-detail":" resource-collection"}`,"aria-label":"知识库",children:[Ye?o.jsx(mE,{className:"knowledge-library__detail",title:Ye.name,description:Ye.description||"暂无描述",identitySeed:Ye.name,backLabel:"返回知识库列表",onBack:()=>g(""),sections:[{key:"overview",label:"概览",content:o.jsx("section",{className:"knowledge-overview",children:o.jsxs(G7,{className:"knowledge-overview__summary",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"Provider"}),o.jsx("dd",{children:Ye.providerType||"-"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"Knowledge ID"}),o.jsx("dd",{className:"knowledge-keyboard-reveal",tabIndex:0,title:Ye.providerKnowledgeId,children:Ye.providerKnowledgeId||"-"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"项目"}),o.jsx("dd",{children:Ye.projectName||"default"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"创建者"}),o.jsx("dd",{children:Fv(Ye.ownerLabel)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"更新时间"}),o.jsx("dd",{children:wlt(Ye.updatedAt)||"-"})]})]})})},{key:"data",label:"数据",content:o.jsx("section",{className:"knowledge-documents",children:o.jsx("div",{className:`knowledge-documents__body${A.length>0?" is-table":""}`,"aria-live":"polite",children:M&&A.length===0?o.jsx(Od,{}):$&&A.length===0?o.jsxs("div",{className:"knowledge-library__state is-error",role:"alert",children:[o.jsx("p",{children:$}),ot&&Ye.canManage?o.jsx("button",{type:"button",onClick:()=>Pe(Ye),children:"删除失效关联"}):o.jsx("button",{type:"button",onClick:()=>void Ge(Ye),children:"重试"})]}):A.length===0?o.jsxs("div",{className:"knowledge-library__state",children:[o.jsx(Olt,{}),o.jsx("p",{children:"这个知识库还没有数据"}),Ye.canManage&&o.jsx("button",{type:"button",onClick:()=>re(Ye),children:"添加第一项数据"})]}):o.jsx(cGe,{rows:Ft,rowKey:Se=>Se.id,rowLabel:Se=>Se.name||Se.id,columns:[{key:"name",header:"名称",className:"is-primary-column",render:Se=>o.jsx("span",{title:Se.name||Se.id,children:Se.name||Se.id})},{key:"format",header:"格式",className:"is-compact-column",render:Se=>OL(Se)},{key:"size",header:"大小",className:"is-compact-column",render:Se=>AB(Se.sizeBytes)}],searchValue:x,onSearchChange:w,searchPlaceholder:"搜索数据",searchLabel:"搜索知识库数据",primaryAction:Ye.canManage?{label:ot?"关联已失效":"添加数据",disabled:ot,title:ot?"底层 Provider 知识库已不存在":void 0,onClick:()=>re(Ye)}:void 0,rowActions:Se=>[{label:"预览",onSelect:()=>G(Se)},...Ye.canManage?[{label:"编辑",onSelect:()=>de(Se)},{label:"删除",onSelect:()=>Ue(Se),danger:!0}]:[]],scrollRef:K,onScroll:Ve,busy:M,emptyLabel:"没有匹配的数据",footer:M?o.jsxs("div",{className:"knowledge-document-pagination",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载更多数据"})]}):D?o.jsxs("div",{className:"knowledge-document-pagination is-error",role:"alert",children:[o.jsx("span",{children:D}),o.jsx("button",{type:"button",onClick:()=>void Ge(Ye,!0),children:"重试加载"})]}):H?o.jsx("div",{ref:_e,className:"knowledge-document-pagination",role:"status","aria-live":"polite",children:"继续下滑加载更多"}):null})})})}],activeSectionKey:b,navigationLabel:"知识库详情",onSectionChange:y,actions:Ye.canManage?o.jsxs(o.Fragment,{children:[o.jsx(It,{type:"button",color:"danger",variant:"soft",size:"lg",pill:!1,onClick:()=>Pe(Ye),children:"删除"}),o.jsx(It,{type:"button",color:"primary",size:"lg",pill:!1,onClick:()=>le(!0),children:"编辑"})]}):void 0}):o.jsxs(o.Fragment,{children:[o.jsxs(g0,{className:"knowledge-library__toolbar library-resource-toolbar",children:[s,o.jsxs("div",{className:"resource-toolbar__actions",children:[a,o.jsx(Gp,{value:O,onChange:Se=>v(Se.target.value),placeholder:"搜索知识库","aria-label":"搜索知识库"})]})]}),o.jsxs(b0,{ref:Ie,"aria-live":"polite",onScroll:it,children:[f.length>0&&!S&&o.jsxs("div",{className:"knowledge-region-warning",role:"status",children:[o.jsx("span",{children:"部分知识库暂时无法加载,已展示其余可用内容。"}),o.jsx("button",{type:"button",onClick:()=>void At(),children:"重试"})]}),S&&l.length===0?o.jsx(Od,{}):T?o.jsxs("div",{className:"knowledge-library__state is-error",role:"alert",children:[o.jsx("p",{children:T}),o.jsx("button",{type:"button",onClick:()=>void At(),children:"重试"})]}):Tt.length===0&&O.trim()?o.jsxs("div",{className:"knowledge-library__state",children:[o.jsx(ylt,{}),o.jsx("p",{children:"没有匹配的知识库"})]}):o.jsxs(aO,{children:[O.trim()?null:o.jsx(Vg,{"aria-label":"新建知识库",icon:o.jsx(vlt,{}),onClick:()=>V(!0),children:"新建知识库"}),Tt.map(Se=>o.jsx(OE,{className:"knowledge-card",title:Se.name,description:Se.description||"暂无描述",metadata:[{label:"创建者",value:Fv(Se.ownerLabel),title:Fv(Se.ownerLabel)},{label:"项目",value:Se.projectName||"default",title:Se.projectName||"default"}],action:{label:F===He(Se)?"关联已失效":"添加数据",icon:"plus",disabled:!Se.canManage||F===He(Se),title:Se.canManage?F===He(Se)?"底层 Provider 知识库已不存在":void 0:"您没有管理此知识库的权限",onClick:()=>re(Se)},detailAction:{label:"查看详情",onClick:()=>g(He(Se))}},He(Se)))]}),Je||k?o.jsx("div",{ref:We,className:"my-agent-load-more",role:"status","aria-live":"polite",children:k?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载更多知识库"})]}):Je?o.jsx("span",{children:"继续下滑加载更多"}):null}):null]})]}),B&&o.jsx(Tlt,{region:t,onClose:()=>V(!1),onCreated:Se=>{c(ze=>[Se,...ze]),g(He(Se)),V(!1)}}),Ye&&W&&o.jsx(Clt,{item:Ye,onClose:()=>le(!1),onUpdated:Se=>{ye(Se),le(!1)}}),Ye&&q&&o.jsx(Qlt,{base:Ye,item:q,onClose:()=>G(null)}),be&&o.jsx(Alt,{base:be,onClose:()=>re(null),onAssociationInvalid:Se=>{L(He(be)),Ye&&He(Ye)===He(be)&&N(Ha(Se,"知识库关联已失效")),re(null)},onCreated:()=>{Ye&&He(Ye)===He(be)&&Ge(Ye),re(null)}}),Ye&&J&&o.jsx(Nlt,{base:Ye,item:J,onClose:()=>de(null),onUpdated:Se=>{const ze=me.current.map(ht=>ht.id===Se.id?Se:ht);me.current=ze,j(ze),de(null)}}),ve&&o.jsx(zl,{title:"删除知识库?",description:`将删除 ${ve.name} 的 AgentKit 关联;如果它由 Studio 创建,也会同时删除 Provider 资源。此操作无法撤销。`,confirmLabel:Ke?"删除中":"删除",variant:"danger",busy:Ke,onCancel:()=>Pe(null),onConfirm:()=>void Qe()}),Ae&&o.jsx(zl,{title:"删除知识?",description:`将从 Provider 知识库中删除 ${Ae.name||Ae.id},此操作无法撤销。`,confirmLabel:Ke?"删除中":"删除",variant:"danger",busy:Ke,onCancel:()=>Ue(null),onConfirm:()=>void rt()})]})}const Flt="_EmptyMessage_1r5gu_1",zlt="_IconBadge_1r5gu_16",Vlt="_Title_1r5gu_54",Hlt="_Description_1r5gu_69",qlt="_ActionRow_1r5gu_77",AE={EmptyMessage:Flt,IconBadge:zlt,Title:Vlt,Description:Hlt,ActionRow:qlt},yn=({children:e,className:t,fill:n="static"})=>o.jsx("div",{className:cr(AE.EmptyMessage,t),"data-fill":n,children:e}),Xlt=({size:e="md",color:t="secondary",children:n,className:r})=>o.jsx("div",{className:cr(AE.IconBadge,r),"data-size":e,"data-color":t,children:n}),Glt=({children:e,className:t,color:n="secondary"})=>o.jsx("div",{className:cr(AE.Title,t),"data-color":n,children:e}),Wlt=({children:e,className:t})=>o.jsx("div",{className:cr(AE.Description,t),children:e}),Ylt=({children:e,className:t})=>o.jsx("div",{className:cr(AE.ActionRow,t),children:e});yn.Icon=Xlt;yn.Title=Glt;yn.Description=Wlt;yn.ActionRow=Ylt;const Zlt="/web/skill-management";class Klt extends Error{constructor(t,n,r="SKILL_MANAGEMENT_ERROR",i="",s,a=""){super(t),this.status=n,this.code=r,this.statusText=i,this.originalError=s,this.rawResponse=a,this.name="SkillManagementApiError"}}async function yh(e,t={},n=Ao){return fetch(So(`${Zlt}${e}`),{...t,headers:fh(t.headers),signal:tl(t.signal,n)})}async function Uge(e,t){let n=t,r="SKILL_MANAGEMENT_ERROR",i;const s=await e.text().catch(()=>"");try{const a=JSON.parse(s);typeof a.detail=="string"?n=a.detail:a.detail&&(n=a.detail.message||t,r=a.detail.code||r,i=a.detail.originalError)}catch{s.trim()&&(n=`${t}:${s.trim()}`)}return new Klt(n,e.status,r,e.statusText,i,s)}async function Oh(e,t){if(!e.ok)throw await Uge(e,t);return e.json()}async function Jlt(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),Oh(await yh(`/spaces?${t}`,{signal:e.signal}),"读取 Skill 空间失败")}async function ect(e){return Oh(await yh("/spaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),"创建 Skill 空间失败")}async function tct(e){return Oh(await yh(`/spaces/${encodeURIComponent(e.spaceId)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.name,description:e.description,region:e.region})}),"更新 Skill 空间失败")}async function nct(e){const t=new URLSearchParams({region:e.region});await Oh(await yh(`/spaces/${encodeURIComponent(e.spaceId)}?${t}`,{method:"DELETE"}),"删除 Skill 空间失败")}async function rct(e){const t=new URLSearchParams({region:e.region});return e.project&&t.set("project",e.project),Oh(await yh(`/spaces/${encodeURIComponent(e.spaceId)}/skills?${t}`,{method:"POST",headers:{"Content-Type":"application/zip"},body:e.file},Zi),"上传 Skill 失败")}async function ict(e){return Oh(await yh("/validate",{method:"POST",headers:{"Content-Type":"application/zip"},body:e},Zi),"校验 Skill 失败")}async function sct(e){const t=new URLSearchParams({region:e.region});await Oh(await yh(`/spaces/${encodeURIComponent(e.spaceId)}/skills/${encodeURIComponent(e.skillId)}?${t}`,{method:"DELETE"}),"删除 Skill 失败")}async function act(e){const t=new URLSearchParams({region:e.region});e.version&&t.set("version",e.version),e.skillSpaceName&&t.set("skill_space_name",e.skillSpaceName),e.skillName&&t.set("skill_name",e.skillName);const n=await Oh(await yh(`/spaces/${encodeURIComponent(e.spaceId)}/skills/${encodeURIComponent(e.skillId)}/files?${t}`),"读取 Skill 文件失败");return Array.isArray(n.files)?n.files:[]}async function oct(e){var l;const t=new URLSearchParams({region:e.region});e.version&&t.set("version",e.version),e.skillSpaceName&&t.set("skill_space_name",e.skillSpaceName),e.skillName&&t.set("skill_name",e.skillName);const n=await yh(`/spaces/${encodeURIComponent(e.spaceId)}/skills/${encodeURIComponent(e.skillId)}/archive?${t}`,{},Zi);n.ok||await Oh(n,"下载 Skill 失败");const i=((l=(n.headers.get("content-disposition")||"").match(/filename="([^"]+)"/))==null?void 0:l[1])||`${e.fallbackName}.zip`,s=URL.createObjectURL(await n.blob()),a=document.createElement("a");a.href=s,a.download=i,a.click(),URL.revokeObjectURL(s)}async function Pj(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:tl(void 0,Ao)});if(!t.ok)throw await Uge(t,"AgentKit Skills 请求失败");return t.json()}async function Fge(){return(await Pj("/web/skill-spaces")).items||[]}async function zge(e,t){const n=t?`?region=${encodeURIComponent(t)}`:"";return(await Pj(`/web/skill-spaces/${encodeURIComponent(e)}/skills${n}`)).items||[]}async function lct(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),Pj(`/web/skill-spaces/${encodeURIComponent(e)}/skills?${n.toString()}`)}async function cct(e,t,n,r,i,s,a){const l=[];n&&l.push(`version=${encodeURIComponent(n)}`),r&&l.push(`region=${encodeURIComponent(r)}`),i&&l.push(`project=${encodeURIComponent(i)}`),s&&l.push(`skill_name=${encodeURIComponent(s)}`),a&&l.push(`skill_space_name=${encodeURIComponent(a)}`);const c=l.length>0?`?${l.join("&")}`:"";return Pj(`/web/skill-spaces/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}${c}`)}function uct(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 dct(e,t,n="volcengine"){return n==="byteplus"?"":`https://console.volcengine.com/agentkit/${(t||"cn-beijing")==="cn-beijing"?"cn":"cn-shanghai"}/skillspace/detail/${encodeURIComponent(e)}`}const fct="/web/skill-workbench";class xL extends Error{constructor(t,n,r="SKILL_WORKBENCH_ERROR",i=!1,s="",a,l=""){super(t),this.status=n,this.code=r,this.retryable=i,this.statusText=s,this.originalError=a,this.rawResponse=l,this.name="SkillWorkbenchApiError"}}function Pc(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t}格式错误。`);return e}function MW(e,t){if(e!=null){if(typeof e!="string"||!e.trim()||e.trim().length>256)throw new Error(`${t}格式错误。`);return e.trim()}}function hct(e){if(e!=null){if(e==="pending"||e==="ready"||e==="failed"||e==="unknown")return e;throw new Error("Skill 恢复点状态格式错误。")}}async function xd(e,t={},n=Ao){return fetch(So(`${fct}${e}`),{...t,headers:fh(t.headers),signal:tl(t.signal,n)})}async function NB(e,t){var r;const n=await e.text().catch(()=>"");try{const i=Pc(JSON.parse(n),"错误响应"),s=i.detail&&typeof i.detail=="object"?Pc(i.detail,"错误详情"):i;return new xL(typeof s.message=="string"?s.message:t,e.status,typeof s.code=="string"?s.code:"SKILL_WORKBENCH_ERROR",s.retryable===!0,e.statusText,s.originalError&&typeof s.originalError=="object"?s.originalError:void 0,n)}catch{const i=((r=e.headers.get("content-type"))==null?void 0:r.split(";",1)[0])||"Content-Type 缺失";return new xL(`${t}(HTTP ${e.status},Content-Type: ${i})。请检查代理或网关配置。`,e.status,"SKILL_WORKBENCH_ERROR",!1,e.statusText,void 0,n)}}async function Yp(e,t){if(!e.ok)throw await NB(e,t);const n=e.headers.get("content-type")??"";if(!n.includes("application/json")){const r=n.split(";",1)[0]||"Content-Type 缺失";throw new Error(`${t}:服务端返回非 JSON 响应(HTTP ${e.status},Content-Type: ${r}),请检查代理或网关配置。`)}return e.json()}function pct(e){return Array.isArray(e)?e.map(t=>{const n=Pc(t,"Skill 会话活动"),r=n.kind,i=n.status;if(typeof n.id!="string"||!["status","thinking","message","tool"].includes(String(r))||!["running","done"].includes(String(i)))throw new Error("Skill 会话活动格式错误。");if(r==="tool"){if(typeof n.name!="string")throw new Error("Skill 工具活动格式错误。");return{id:n.id,kind:r,status:i,name:n.name,...n.input!==void 0?{args:n.input}:{},...n.output!==void 0?{response:n.output}:{}}}if(typeof n.text!="string")throw new Error("Skill 文本活动格式错误。");return{id:n.id,kind:r,status:i,text:n.text}}):[]}function mct(e){if(e==null)return;const t=Pc(e,"Skill 发布结果");if(typeof t.revision!="number"||typeof t.skillId!="string"||typeof t.version!="string"||!Array.isArray(t.skillSpaceIds)||!t.skillSpaceIds.every(n=>typeof n=="string")||t.disposition!=="create-new"&&t.disposition!=="update-source"||!XS(t.region)||typeof t.projectName!="string")throw new Error("Skill 发布结果格式错误。");return{revision:t.revision,skillId:t.skillId,version:t.version,skillSpaceIds:t.skillSpaceIds,disposition:t.disposition,region:t.region,projectName:t.projectName}}function Zw(e){const t=Pc(e,"Skill 会话");if(typeof t.jobId!="string"||t.operation!=="create"&&t.operation!=="optimize"||typeof t.intent!="string"||typeof t.revision!="number"||typeof t.state!="string")throw new Error("Skill 会话格式错误。");const n=Array.isArray(t.files)?t.files.flatMap(l=>{const c=Pc(l,"Skill 文件");return typeof c.path=="string"&&typeof c.size=="number"?[{path:c.path,size:c.size}]:[]}):[];if(!["running","ready","failed","cancelled","expired","published"].includes(t.state))throw new Error("Skill 会话状态无法识别。");const i=MW(t.toolId,"Tool ID"),s=MW(t.sessionId,"Session ID"),a=hct(t.recoveryStatus);return{jobId:t.jobId,operation:t.operation,intent:t.intent,...typeof t.model=="string"?{model:t.model}:{},...typeof t.style=="string"?{style:t.style}:{},...typeof t.requestedName=="string"?{requestedName:t.requestedName}:{},revision:t.revision,...i?{toolId:i}:{},...s?{sessionId:s}:{},...typeof t.sessionTtlSeconds=="number"?{sessionTtlSeconds:t.sessionTtlSeconds}:{},...typeof t.expiresAt=="string"?{expiresAt:t.expiresAt}:{},...typeof t.recoveryAvailable=="boolean"?{recoveryAvailable:t.recoveryAvailable}:{},...a?{recoveryStatus:a}:{},...typeof t.recoveredFromSnapshot=="boolean"?{recoveredFromSnapshot:t.recoveredFromSnapshot}:{},state:t.state,stage:typeof t.stage=="string"?t.stage:"generating",activities:pct(t.activities),files:n,...t.source&&typeof t.source=="object"?{source:t.source}:{},...typeof t.name=="string"?{name:t.name}:{},...typeof t.description=="string"?{description:t.description}:{},...typeof t.skillMd=="string"?{skillMd:t.skillMd}:{},...typeof t.error=="string"?{error:t.error}:{},...t.validation&&typeof t.validation=="object"?{validation:t.validation}:{},...t.publication?{publication:mct(t.publication)}:{}}}async function Mj(e){const t=Pc(await Yp(await xd("/capabilities",{signal:e}),"读取 Skill 工作台能力失败"),"Skill 工作台能力");return{enabled:t.enabled===!0,reason:typeof t.reason=="string"?t.reason:"",operations:Array.isArray(t.operations)?t.operations.filter(n=>n==="create"||n==="optimize"):[],models:Array.isArray(t.models)?t.models.flatMap(n=>{if(!n||typeof n!="object")return[];const r=n;return typeof r.id=="string"&&typeof r.label=="string"?[{id:r.id,label:r.label}]:[]}):[],styles:t.styles&&typeof t.styles=="object"&&!Array.isArray(t.styles)?Object.fromEntries(Object.entries(t.styles).filter(n=>typeof n[1]=="string")):{},...typeof t.maxUploadBytes=="number"?{maxUploadBytes:t.maxUploadBytes}:{}}}async function gct(e){if(e.file){const n=new URLSearchParams({operation:"optimize",intent:e.intent});e.jobId&&n.set("job_id",e.jobId),e.model&&n.set("model",e.model),e.style&&n.set("style",e.style),e.name&&n.set("name",e.name);const r=await xd(`/tasks/from-upload?${n}`,{method:"POST",body:e.file,headers:{"Content-Type":"application/zip"},signal:e.signal},Zi);return Zw(await Yp(r,"开始优化 Skill 失败"))}const t=await xd("/tasks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operation:e.operation,intent:e.intent,...e.model?{model:e.model}:{},...e.style?{style:e.style}:{},...e.name?{name:e.name}:{},...e.jobId?{jobId:e.jobId}:{},...e.source?{source:{kind:"skill-center",skillId:e.source.skillId,skillName:e.source.name,version:e.source.version,region:e.source.region,projectName:e.source.projectName,skillSpaceId:e.source.skillSpaceId,skillSpaceName:e.source.skillSpaceName}}:{}}),signal:e.signal},Zi);return Zw(await Yp(t,"开始 Skill 会话失败"))}async function bct(e,t){return Zw(await Yp(await xd(`/tasks/${encodeURIComponent(e)}`,{signal:t}),"读取 Skill 会话失败"))}async function xD(e,t,n){const r=new URLSearchParams;r.set("expected_revision",String(t));const i=Pc(await Yp(await xd(`/tasks/${encodeURIComponent(e)}/artifact?${r.toString()}`,{signal:n}),"读取 Skill 产物失败"),"Skill 产物");if(i.jobId!==e||i.revision!==t||!Number.isSafeInteger(i.revision)||i.revision<1||typeof i.sha256!="string"||!/^[0-9a-f]{64}$/.test(i.sha256)||typeof i.name!="string"||typeof i.description!="string"||!Array.isArray(i.files))throw new Error("Skill 产物格式错误。");const s=i.files.map(a=>{const l=Pc(a,"Skill 产物文件");if(typeof l.path!="string"||typeof l.size!="number"||typeof l.content!="string")throw new Error("Skill 产物文件格式错误。");return{path:l.path,size:l.size,content:l.content}});return{jobId:i.jobId,revision:i.revision,sha256:i.sha256,name:i.name,description:i.description,files:s}}async function vD(e){const t=await xd(`/tasks/${encodeURIComponent(e.jobId)}/refinements`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({intent:e.intent,expectedRevision:e.expectedRevision})},Zi);return Zw(await Yp(t,"继续调整 Skill 失败"))}async function yct(e){const t=await xd(`/tasks/${encodeURIComponent(e.jobId)}/stop`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expectedRevision:e.expectedRevision})});return Zw(await Yp(t,"停止当前 Skill 任务失败"))}async function Oct(e){const t=await xd(`/tasks/${encodeURIComponent(e.jobId)}/publish-stream`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/x-ndjson"},body:JSON.stringify({disposition:e.disposition,expectedRevision:e.expectedRevision,expectedArtifactSha256:e.expectedArtifactSha256,skillSpaceIds:e.skillSpaceIds??[],projectName:e.projectName,region:e.region}),signal:e.signal},0);if(!t.ok)throw await NB(t,"发布 Skill 失败");if(!(t.headers.get("content-type")??"").includes("application/x-ndjson"))throw new Error("发布 Skill 失败:服务端返回了非 NDJSON 响应。");if(!t.body)throw new Error("发布 Skill 失败:服务端没有返回进度流。");const r=new Set(["preparing","uploading","registering","activating","publishing"]);let i=null,s="";const a=new TextDecoder,l=t.body.getReader(),c=u=>{var h;if(!u.trim())return;const d=Pc(JSON.parse(u),"发布进度");if(d.type==="progress"){if(typeof d.phase!="string"||!r.has(d.phase)||typeof d.message!="string")throw new Error("发布进度格式错误。");(h=e.onProgress)==null||h.call(e,{phase:d.phase,message:d.message});return}if(d.type==="error"){const m=Pc(d.error,"发布错误");throw new xL(typeof m.message=="string"?m.message:"发布 Skill 失败",500,typeof m.code=="string"?m.code:"SKILL_PUBLISH_FAILED",m.retryable===!0,"",m.originalError&&typeof m.originalError=="object"?m.originalError:void 0,JSON.stringify(d.error))}if(d.type!=="complete")throw new Error("未知的发布进度事件。");const f=Pc(d.result,"发布结果");if(typeof f.skillId!="string"||typeof f.version!="string"||!Array.isArray(f.skillSpaceIds)||!f.skillSpaceIds.every(m=>typeof m=="string")||f.disposition!=="create-new"&&f.disposition!=="update-source"||!XS(f.region)||typeof f.projectName!="string")throw new Error("发布结果格式错误。");i={skillId:f.skillId,version:f.version,skillSpaceIds:f.skillSpaceIds,disposition:f.disposition,region:f.region,projectName:f.projectName}};for(;;){const{value:u,done:d}=await l.read();s+=a.decode(u,{stream:!d});const f=s.split(` +`);if(s=f.pop()??"",f.forEach(c),d)break}if(c(s),!i)throw new Error("发布进度流提前结束,无法确认发布结果。请刷新技能中心确认状态。");return i}async function xct(e){await Yp(await xd(`/tasks/${encodeURIComponent(e)}`,{method:"DELETE"}),"删除 Skill 会话失败")}async function vct(e,t,n){var c;const r=new URLSearchParams;r.set("expected_revision",String(t)),r.set("expected_sha256",n);const i=await xd(`/tasks/${encodeURIComponent(e)}/download?${r.toString()}`,{},Zi);if(!i.ok)throw await NB(i,"下载 Skill 失败");const a=((c=(i.headers.get("content-disposition")??"").match(/filename="([^"]+)"/))==null?void 0:c[1])??"skill.zip",l=URL.createObjectURL(await i.blob());try{const u=document.createElement("a");u.href=l,u.download=a,u.click()}finally{URL.revokeObjectURL(l)}}const wct={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 Sct(e,t){if(!t||t==="/")return e;const n=t.replace(/^\//,"").split("/").map(i=>i.replace(/~1/g,"/").replace(/~0/g,"~"));let r=e;for(const i of n){if(r==null||typeof r!="object")return;r=r[i]}return r}function Ect(e){return typeof e=="object"&&e!==null&&typeof e.path=="string"}function kct(e){return typeof e=="object"&&e!==null&&typeof e.call=="string"}function jB(e,t){if(Ect(e))return Sct(t,e.path);if(kct(e)){const n=wct[e.call],r={};for(const[i,s]of Object.entries(e.args??{}))r[i]=jB(s,t);return n?n(r):`[unknown fn: ${e.call}]`}return e}function _ct(e,t){const n=jB(e,t);return n==null?"":typeof n=="string"?n:String(n)}const Vge=new Map;function S0(e,t){Vge.set(e,t)}function Tct(e){return Vge.get(e)}function Cct(e,t,n){const r=t.replace(/^\//,"").split("/").map(s=>s.replace(/~1/g,"/").replace(/~0/g,"~"));let i=e;for(let s=0;sjB(r,e.dataModel),resolveString:r=>_ct(r,e.dataModel),dispatchAction:t,render:r=>{if(!r)return null;const i=e.components[r];if(!i)return null;const s=Tct(i.component)??Act;return o.jsx(s,{node:i,ctx:n},r)}};return o.jsx("div",{className:"a2ui-surface","data-a2ui-surface":e.surfaceId,children:n.render(e.rootId)})}function qge(e){const t=p.useRef(null),n=p.useRef(!0),r=28,i=p.useCallback(()=>{const s=t.current;s&&(n.current=s.scrollHeight-s.scrollTop-s.clientHeight{const s=t.current;s&&n.current&&(s.scrollTop=s.scrollHeight)},[e]),{ref:t,onScroll:i}}function Lj({value:e,skillPrefix:t="/",onRemoveSkill:n,onRemoveAgent:r}){return e.skills.length===0&&!e.targetAgent?null:o.jsxs("div",{className:"invocation-chips","aria-label":"本轮调用上下文",children:[e.skills.map(i=>o.jsxs("span",{className:"invocation-chip invocation-chip--skill",title:i.description,children:[o.jsx(ww,{"aria-hidden":!0}),o.jsxs("span",{children:[t,i.name]}),n?o.jsx("button",{type:"button",onClick:()=>n(i.name),"aria-label":`移除技能 ${i.name}`,children:o.jsx(ba,{})}):null]},i.name)),e.targetAgent?o.jsxs("span",{className:"invocation-chip invocation-chip--agent",title:e.targetAgent.description,children:[o.jsx(Rae,{"aria-hidden":!0}),o.jsx("span",{children:e.targetAgent.name}),r?o.jsx("button",{type:"button",onClick:r,"aria-label":`移除 Agent ${e.targetAgent.name}`,children:o.jsx(ba,{})}):null]}):null]})}function RB(e=""){return e.startsWith("image/")?"image":e.startsWith("video/")?"video":e==="application/pdf"?"pdf":e==="text/markdown"?"markdown":"text"}function Xge(e){var n,r,i,s;const t=RB(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"?((s=(i=e.mimeType)==null?void 0:i.split("/")[1])==null?void 0:s.toUpperCase())??"IMAGE":"TXT"}function Gge(e){return e?e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:""}function Wge(e,t){return e.previewUrl?e.previewUrl:e.data?`data:${e.mimeType??"application/octet-stream"};base64,${e.data}`:e.uri?doe(t,e.uri):""}function jct({kind:e}){return e==="image"?o.jsx(r9,{}):e==="video"?o.jsx(Pae,{}):e==="pdf"?o.jsx(VRe,{}):o.jsx(t9,{})}function $j({appName:e,items:t,compact:n=!1,onRemove:r}){const[i,s]=p.useState(null);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`media-grid${n?" media-grid--compact":""}`,children:t.map(a=>{const l=RB(a.mimeType),c=Wge(a,e),u=a.status==="uploading"||a.status==="error"||!c,d=o.jsxs("button",{type:"button",className:"media-card-main",disabled:u,onClick:l==="image"?void 0:()=>s(a),"aria-label":`预览 ${a.name??"附件"}`,children:[l==="image"&&c?o.jsx("img",{className:"media-card-image",src:c,alt:a.name??"图片",loading:"lazy"}):l==="video"&&c?o.jsxs("div",{className:"media-card-video-container",children:[o.jsx("video",{className:"media-card-video",src:c,muted:!0,playsInline:!0,preload:"metadata","aria-hidden":"true"}),o.jsx("span",{className:"media-card-video-play",children:o.jsx(nIe,{})})]}):o.jsx("span",{className:"media-card-icon",children:o.jsx(jct,{kind:l})}),o.jsxs("span",{className:"media-card-copy",children:[o.jsx("span",{className:"media-card-name",children:a.name??"附件"}),o.jsxs("span",{className:"media-card-meta",children:[o.jsx("span",{className:"media-card-type",children:Xge(a)}),a.status==="uploading"?o.jsxs(o.Fragment,{children:[o.jsx(or,{className:"media-card-spinner"})," 上传中"]}):a.status==="error"?a.error??"上传失败":Gge(a.sizeBytes)]})]}),!n&&a.status!=="uploading"&&a.status!=="error"?o.jsx(uy,{className:"media-card-open"}):null]});return o.jsxs(ui.div,{className:`media-card media-card--${l}${a.status==="error"?" media-card--error":""}`,layout:!0,initial:{opacity:0,scale:.985,y:4},animate:{opacity:1,scale:1,y:0},children:[l==="image"&&!u?o.jsx(Eae,{src:c,children:d}):d,r?o.jsx("button",{type:"button",className:"media-card-remove","aria-label":`移除 ${a.name??"附件"}`,onClick:()=>r(a.id),children:o.jsx(ba,{})}):null]},a.id)})}),o.jsx(mu,{children:i?o.jsx(Rct,{appName:e,item:i,onClose:()=>s(null)}):null})]})}function Rct({appName:e,item:t,onClose:n}){const r=p.useMemo(()=>Wge(t,e),[e,t]),i=RB(t.mimeType),[s,a]=p.useState(""),[l,c]=p.useState(i==="text"||i==="markdown"),[u,d]=p.useState("");return p.useEffect(()=>{const f=h=>{h.key==="Escape"&&n()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[n]),p.useEffect(()=>{if(i!=="text"&&i!=="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()},[i,r]),o.jsx(ui.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:o.jsxs(ui.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:[o.jsxs("header",{className:"media-viewer-header",children:[o.jsxs("div",{children:[o.jsx("strong",{children:t.name??"附件"}),o.jsxs("span",{children:[Xge(t),t.sizeBytes?` · ${Gge(t.sizeBytes)}`:""]})]}),o.jsxs("nav",{children:[o.jsx("a",{href:r,download:t.name,"aria-label":"下载",children:o.jsx(NN,{})}),o.jsx("button",{type:"button",onClick:n,"aria-label":"关闭",children:o.jsx(ba,{})})]})]}),o.jsxs("div",{className:`media-viewer-body media-viewer-body--${i}`,children:[i==="image"?o.jsx("img",{src:r,alt:t.name??"图片"}):null,i==="video"?o.jsx("div",{className:"media-viewer-video-wrapper",children:o.jsx("video",{src:r,controls:!0,autoPlay:!0,playsInline:!0,preload:"auto",className:"media-viewer-video"})}):null,i==="pdf"?o.jsx("iframe",{src:r,title:t.name??"PDF"}):null,l?o.jsxs("div",{className:"media-viewer-loading",children:[o.jsx(or,{})," 正在读取文档…"]}):null,!l&&u?o.jsxs("div",{className:"media-viewer-loading",children:["文档加载失败:",u]}):null,!l&&i==="markdown"?o.jsx("div",{className:"media-document",children:o.jsx(wu,{text:s})}):null,!l&&i==="text"?o.jsx("pre",{className:"media-document media-document--plain",children:s}):null]})]})})}function Ict(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"10.25",cy:"10.25",r:"6.25"}),o.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 Dct(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.25",y:"5.25",width:"15.5",height:"13.5",rx:"2.25"}),o.jsx("circle",{cx:"8.1",cy:"9.3",r:"1.35"}),o.jsx("path",{d:"m4.7 16.5 3.65-3.7 2.45 2.25 2.2-2.2 4.35 4.1"}),o.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 IB(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{className:"video-generate-icon__body",d:"M3.25 9h17.5v7.35a2.4 2.4 0 0 1-2.4 2.4H5.65a2.4 2.4 0 0 1-2.4-2.4V9Z"}),o.jsxs("g",{className:"video-generate-icon__clapper",children:[o.jsx("path",{d:"M3.25 9V7.65a2.4 2.4 0 0 1 2.4-2.4h12.7a2.4 2.4 0 0 1 2.4 2.4V9H3.25Z"}),o.jsx("path",{d:"M6.75 5.25 9.3 9M12 5.25 14.55 9M17.25 5.25 19.8 9"})]}),o.jsx("path",{d:"m10.25 11.45 4 2.55-4 2.55v-5.1Z"})]})}function Pct(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M4.25 5.25h15.5v10.5H4.25zM8.25 19.75h7.5M12 15.75v4"}),o.jsx("path",{d:"m7.25 12.75 2.35-2.4 2.15 1.65 3.4-3.6 1.6 1.55"}),o.jsx("circle",{cx:"7.25",cy:"8.4",r:".7",fill:"currentColor",stroke:"none"})]})}function Mct(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.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"}),o.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"}),o.jsx("path",{d:"M8.2 12.25h.01M8.2 16.8h.01"})]})}function Lct(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M4.25 4.25h4.5v15.5h-4.5zM8.75 5.75h5v14h-5zM13.75 4.25h4.1v10.25h-4.1z"}),o.jsx("path",{d:"M5.75 7h1.5M10.25 8.25h2M10.25 11h2M15.15 7h1.3"}),o.jsx("circle",{cx:"17.45",cy:"17.35",r:"2.45"}),o.jsx("path",{d:"m19.25 19.15 1.55 1.55"})]})}function $ct(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.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"}),o.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"}),o.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 Bct(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"m4.2 8.4 1.15 10.2h13.3L19.8 8.4"}),o.jsx("path",{d:"M4.2 8.4h15.6L17.9 5H6.1L4.2 8.4Z"}),o.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"}),o.jsx("path",{d:"m8.2 15.1 1.45 1.35 1.45-1.35M13.55 16.45h2.35"})]})}function Qct(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"6",cy:"6.25",r:"2.25"}),o.jsx("circle",{cx:"18",cy:"6.25",r:"2.25"}),o.jsx("circle",{cx:"12",cy:"17.75",r:"2.25"}),o.jsx("path",{d:"m7.7 7.75 2.7 7.55M16.3 7.75l-2.7 7.55M8.25 6.25h7.5"})]})}function LW(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"9",cy:"8",r:"3"}),o.jsx("path",{d:"M3.75 18.75c.45-3.05 2.2-4.65 5.25-4.65s4.8 1.6 5.25 4.65"}),o.jsx("path",{d:"M17.75 4.25v5.5M15 7h5.5M16 13.25h4.25M18.125 11.125v4.25"})]})}function Uct(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"4",y:"4.25",width:"16",height:"5",rx:"1.5"}),o.jsx("rect",{x:"4",y:"14.75",width:"16",height:"5",rx:"1.5"}),o.jsx("path",{d:"M7.25 6.75h.01M7.25 17.25h.01M10 6.75h6.5M10 17.25h6.5"})]})}function Fct(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M6 3.75h8l4 4v12.5H6V3.75Z"}),o.jsx("path",{d:"M14 3.75v4h4M8.75 11h6.5M8.75 14.25h6.5M8.75 17.5h4"})]})}function zct(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.75",y:"4.5",width:"16.5",height:"15",rx:"2.5"}),o.jsx("path",{d:"m7.5 9 2.75 2.5L7.5 14M12.5 14h4"}),o.jsx("path",{d:"M3.75 7.5h16.5",opacity:".62"})]})}function DB(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m6 3.25 4.5 4.75L6 12.75"})})}function Vct({definition:e,label:t,done:n,open:r,onToggle:i}){const s=e.icon,a=t??(n?e.doneLabel:e.runningLabel);return o.jsxs("button",{type:"button",className:`builtin-tool-head${n?" is-done":" is-running"}`,"data-tool-tone":e.tone,onClick:i,"aria-expanded":r,children:[o.jsx("span",{className:"builtin-tool-icon","aria-hidden":"true",children:o.jsx(s,{})}),n?o.jsx("span",{className:"builtin-tool-label",children:a}):o.jsx(En,{className:"builtin-tool-label",duration:2.4,spread:18,"aria-live":"polite",children:a}),o.jsx(DB,{className:`builtin-tool-chevron${r?" is-open":""}`})]})}function $l(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function gn(e){return typeof e=="string"?e:""}function $W(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function _c(e){return Array.isArray(e)?e:[]}function vL(e){let t=e;if(typeof t=="string")try{t=JSON.parse(t)}catch{return{}}const n=$l(t)??{};return $l(n.result)??n}function Bj(e){if(typeof e=="string")try{return Bj(JSON.parse(e))}catch{return e}const t=$l(e);if(!t)return"";const n=$l(t.result);return gn(t.error)||gn(t.message)||gn(n==null?void 0:n.error)||gn(n==null?void 0:n.message)}function Hct(e){if(e.kind==="tool")return"tool";if(e.kind==="knowledge_base")return"knowledge_base";const t=$l(e.metadata),n=gn(t==null?void 0:t.source_type).toLowerCase(),r=gn(e.source).toLowerCase();return n==="skillhub"||r.startsWith("skill_hub:")?"skill_hub":"skill_space"}function qct(e){return e==="veadk_builtin_tools"?"工具":e==="agentkit_knowledge"?"AgentKit 知识库":e.startsWith("skill_hub:")?`Skill Hub ${e.slice(10)}`:e.startsWith("skill_space:")?`AgentKit 技能中心 ${e.slice(12)}`:e||"未知来源"}function Xct(e){return e==="veadk_builtin_tools"?"tool":e==="agentkit_knowledge"?"knowledge_base":e.startsWith("skill_hub:")?"skill_hub":"skill_space"}function Gct(e){const t=vL(e),n=$l(t.capabilities)??{},r=_c(t.resources).flatMap(s=>{const a=$l(s);if(!a)return[];const l=a.kind==="tool"?"tool":a.kind==="knowledge_base"?"knowledge_base":"skill";return[{ref:gn(a.ref),kind:l,category:Hct(a),name:gn(a.name)||gn(a.ref)||"未命名资源",description:gn(a.description),source:gn(a.source),version:gn(a.version)}]}),i=_c(t.sources).flatMap(s=>{const a=$l(s);if(!a)return[];const l=gn(a.source),c=gn(a.status),u=c==="error"?"error":c==="skipped"?"skipped":"ok";return[{source:l,category:Xct(l),label:qct(l),status:u,count:$W(a.count),message:gn(a.message),searchKeywords:_c(a.search_keywords).map(gn).filter(Boolean)}]});return{collectionId:gn(t.collection_id),capabilities:{googleAdkVersion:gn(n.google_adk_version),agentTypes:_c(n.agent_types).map(gn).filter(Boolean),maxOrchestrationDepth:$W(n.max_orchestration_depth)},resources:r,sources:i,counts:{all:r.length,skill_hub:r.filter(s=>s.category==="skill_hub").length,skill_space:r.filter(s=>s.category==="skill_space").length,knowledge_base:r.filter(s=>s.category==="knowledge_base").length,tool:r.filter(s=>s.category==="tool").length}}}function Wct(e,t){return{resources:e.resources.filter(n=>n.category===t),sources:e.sources.filter(n=>n.category===t)}}function Yge(e,t){const n=vL(e),r=vL(t),i=new Map(_c(r.results).flatMap(u=>{const d=$l(u),f=gn(d==null?void 0:d.name);return d&&f?[[f,d]]:[]})),s=_c(n.agents).flatMap(u=>{const d=$l(u),f=gn(d==null?void 0:d.name);return d&&f?[d]:[]}),a=new Set(s.map(u=>gn(u.name))),l=[...i.entries()].filter(([u])=>!a.has(u)).map(([u])=>({name:u})),c=[...s,...l].map(u=>{const d=gn(u.name),f=_c(u.nodes).flatMap(E=>{const k=$l(E);return k?[k]:[]}),h=gn(u.root_node),m=f.find(E=>gn(E.id)===h),g=f.filter(E=>gn(E.id)!==h).map(E=>({id:gn(E.id)||"未命名 Agent",type:gn(E.type)||"llm",description:gn(E.description)})),b=i.get(d),y=gn(b==null?void 0:b.status),O=y==="failed"?"failed":y==="completed"?"completed":"running",v=BW(b==null?void 0:b.resources),x=v.length>0?v:BW(f.flatMap(E=>_c(E.resources))),w=QW(b==null?void 0:b.python_tools),S=w.length>0?w:QW(f.flatMap(E=>_c(E.python_tools)));return{name:d,description:gn(b==null?void 0:b.description)||gn(m==null?void 0:m.description)||gn(u.task),task:gn(u.task),rootType:gn(b==null?void 0:b.root_type)||gn(m==null?void 0:m.type)||"llm",nodeCount:f.length,subAgentCount:g.length,resourceCount:x.length,pythonToolCount:S.length,skills:x.filter(E=>E.kind==="skill"),knowledgeBases:x.filter(E=>E.kind==="knowledge_base"),builtinTools:x.filter(E=>E.kind==="tool"),pythonTools:S,subAgents:g,status:O,output:gn(b==null?void 0:b.output),error:gn(b==null?void 0:b.error)}});return{collectionId:gn(r.collection_id)||gn(n.collection_id),agents:c,completedCount:c.filter(u=>u.status==="completed").length,failedCount:c.filter(u=>u.status==="failed").length,runningCount:c.filter(u=>u.status==="running").length}}function Yct(e,t){return!!Bj(t)||Yge(e,t).failedCount>0}function BW(e){const t=new Set;return _c(e).flatMap(n=>{const r=$l(n),i=gn(r?r.ref:n);if(!i||t.has(i))return[];t.add(i);const s=gn(r==null?void 0:r.kind),a=s==="tool"||i.startsWith("veadk_tool:")?"tool":s==="knowledge_base"||i.startsWith("agentkit_kb:")?"knowledge_base":"skill",l=i.split(":");return[{ref:i,kind:a,name:gn(r==null?void 0:r.name)||l[l.length-1]||i,description:gn(r==null?void 0:r.description),version:gn(r==null?void 0:r.version),source:gn(r==null?void 0:r.source)}]})}function QW(e){const t=new Set;return _c(e).flatMap(n=>{const r=$l(n),i=gn(r==null?void 0:r.name),s=gn(r==null?void 0:r.code),a=`${i}\0${s}`;return!r||!i||t.has(a)?[]:(t.add(a),[{name:i,description:gn(r.description),code:s,entrypoint:gn(r.entrypoint)||i,dependencies:_c(r.dependencies).map(gn).filter(Boolean)}])})}function Zct({branch:e}){return o.jsxs("div",{className:`branch-compare__body${e.status==="running"?" is-streaming":""}`,"aria-live":"polite",children:[e.content?o.jsx(wu,{text:e.content,streaming:e.status==="running"}):null,e.status==="running"?o.jsx("span",{className:"branch-compare__caret","aria-hidden":"true"}):null,e.error?o.jsx("p",{className:"branch-compare__error",children:e.error}):null]})}function Kct({args:e,response:t,status:n,onBranchSelect:r}){const i=p.useMemo(()=>vle(e,t,n),[e,t,n]),[s,a]=p.useState(0);return o.jsxs("section",{className:"branch-compare","aria-label":"分支对比",children:[o.jsx("div",{className:"branch-compare__tabs",role:"tablist","aria-label":"选择方向",children:i.branches.map((l,c)=>o.jsx("button",{className:`branch-compare__tab${s===c?" is-active":""}`,type:"button",role:"tab","aria-selected":s===c,"aria-controls":`branch-compare-panel-${c}`,onClick:()=>a(c),children:o.jsx(Js,{color:"info",size:"sm",variant:"soft",children:l.label})},`${l.label}:${c}`))}),o.jsx("div",{className:"branch-compare__branches",children:i.branches.map((l,c)=>o.jsxs("article",{className:`branch-compare__branch${s===c?" is-active":""}`,id:`branch-compare-panel-${c}`,role:"tabpanel",children:[o.jsx("header",{className:"branch-compare__head",children:o.jsx(Js,{color:"info",size:"sm",variant:"soft",children:l.label})}),o.jsx(Zct,{branch:l}),o.jsx("footer",{className:"branch-compare__footer",children:o.jsx(It,{type:"button",color:"info",variant:"ghost",size:"sm",pill:!1,disabled:l.status!=="completed",onClick:()=>r==null?void 0:r(l),children:"继续这个方向"})})]},`${l.label}:${c}`))})]})}function Zge({controlled:e,default:t,name:n,state:r="value"}){const{current:i}=p.useRef(e!==void 0),[s,a]=p.useState(t),l=i?e:s,c=p.useCallback(u=>{i||a(u)},[]);return[l,c]}const PB={...r0},UW={};function qg(e,t){const n=p.useRef(UW);return n.current===UW&&(n.current=e(t)),n}const wD=PB.useInsertionEffect,Jct=wD&&wD!==PB.useLayoutEffect?wD:e=>e();function Na(e){const t=qg(eut).current;return t.next=e,Jct(t.effect),t.trampoline}function eut(){const e={next:void 0,callback:tut,trampoline:(...t)=>{var n;return(n=e.callback)==null?void 0:n.call(e,...t)},effect:()=>{e.callback=e.next}};return e}function tut(){}const nut=()=>{},Yo=typeof document<"u"?p.useLayoutEffect:nut,Kge=p.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function rut(){return p.useContext(Kge)}function iut(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,s=Na(i),[,a]=p.useState(!1),l=qg(aut).current,c=qg(sut).current,u=p.useRef(0),d=p.useRef(!0),f=p.useRef([]),h=p.useRef(null),m=Na(()=>{d.current||(d.current=!0,a(S=>!S))}),g=Na((S,E)=>{c.set(S,E),m()}),b=Na(S=>{c.delete(S),m()}),y=Na(S=>{const E=new Map;return n.current.length=0,r&&(r.current.length=0),S.forEach(k=>{var _,T;E.set(k.element,{...k.registration.metadata??{},index:k.index}),n.current[k.index]=k.element,r&&(r.current[k.index]=k.registration.label!==void 0?k.registration.label:((T=(_=k.registration.textRef)==null?void 0:_.current)==null?void 0:T.textContent)??k.element.textContent)}),u.current=n.current.length,E});function O(S){var _;if((_=h.current)==null||_.disconnect(),h.current=null,typeof MutationObserver!="function"||S.length<2)return;const E=new MutationObserver(T=>{if(!cut(T))return;let C=null;for(const A of S)if(A.isConnected){if(C&&Jge(C,A)>0){E.disconnect(),m();return}C=A}});h.current=E;const k=new Set;for(let T=1;TE.observe(T,{childList:!0}))}const v=Na(()=>{const[S,E]=out(c),k=y(S);O(E),f.current=S,d.current=!1,l.forEach(_=>_(k)),s(k)});Yo(()=>(d.current||y(f.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,y]),Yo(()=>{d.current&&v()}),Yo(()=>()=>{var S;(S=h.current)==null||S.disconnect(),d.current=!0},[]);const x=Na(S=>(l.add(S),()=>{l.delete(S)})),w=p.useMemo(()=>({register:g,unregister:b,subscribeMapChange:x,nextIndexRef:u}),[g,b,x,u]);return o.jsx(Kge.Provider,{value:w,children:t})}function sut(){return new Map}function aut(){return new Set}function out(e){const t=new Set,n=[],r=[];e.forEach((s,a)=>{if(!a.isConnected)return;const l=s.index,c={index:l??-1,element:a,registration:s};l===null?r.push(c):l>=0&&(t.add(l),n.push(c))});let i=0;return r.sort((s,a)=>Jge(s.element,a.element)),r.forEach(s=>{for(;t.has(i);)i+=1;s.index=i,n.push(s),i+=1}),t.size>0&&n.sort((s,a)=>s.index-a.index),[n,r.map(s=>s.element)]}function lut(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function cut(e){for(const t of e)for(let n=0;ns.searchParams.append("args[]",a)),`${t} error #${r}; visit ${s} for the full message.`}}const NE=uut("https://base-ui.com/production-error","Base UI"),e0e=p.createContext(void 0);function t0e(){const e=p.useContext(e0e);if(e===void 0)throw new Error(NE(10));return e}function sA(e,t,n,r){const i=qg(n0e).current;return fut(i,e,t,n,r)&&r0e(i,[e,t,n,r]),i.callback}function dut(e){const t=qg(n0e).current;return hut(t,e)&&r0e(t,e),t.callback}function n0e(){return{callback:null,cleanup:null,refs:[]}}function fut(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function hut(e,t){return e.refs.length!==t.length||e.refs.some((n,r)=>n!==t[r])}function r0e(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const r=Array(t.length).fill(null);for(let i=0;i{for(let i=0;i=e}function FW(e){if(!p.isValidElement(e))return null;const t=e,n=t.props;return(mut(19)?n==null?void 0:n.ref:t.ref)??null}function wL(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}const gut=Object.freeze([]),Gb=Object.freeze({});function but(e,t){const n={};for(const r in e){const i=e[r];if(t!=null&&t.hasOwnProperty(r)){const s=t[r](i);s!=null&&Object.assign(n,s);continue}i===!0?n[`data-${r.toLowerCase()}`]="":i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function yut(e,t){return typeof e=="function"?e(t):e}function i0e(e,t){return typeof e=="function"?e(t):e}const MB={};function LB(e,t,n,r,i){if(!n&&!r&&!e)return aA(t);let s=aA(e);return t&&(s=uT(s,t)),n&&(s=uT(s,n)),r&&(s=uT(s,r)),s}function Out(e){if(e.length===0)return MB;if(e.length===1)return aA(e[0]);let t=aA(e[0]);for(let n=1;n=65&&i<=90&&(typeof t=="function"||typeof t>"u")}function $B(e){return typeof e=="function"}function a0e(e,t){return $B(e)?e(t):e??MB}function wut(e,t){return t?e?(...n)=>{const r=n[0];if(c0e(r)){const s=r;oA(s);const a=t(...n);return s.baseUIHandlerPrevented||e==null||e(...n),a}const i=t(...n);return e==null||e(...n),i}:o0e(t):e}function o0e(e){return e&&((...t)=>{const n=t[0];return c0e(n)&&oA(n),e(...t)})}function oA(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function l0e(e,t){return t?e?t+" "+e:t:e}function c0e(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function jE(e,t,n={}){const r=t.render,i=Sut(t,n);if(n.enabled===!1)return null;const s=n.state??Gb;return _ut(e,r,i,s)}function Sut(e,t={}){const{className:n,style:r,render:i}=e,{state:s=Gb,ref:a,props:l,stateAttributesMapping:c,enabled:u=!0}=t,d=u?yut(n,s):void 0,f=u?i0e(r,s):void 0,h=u?but(s,c):Gb,m=u&&l?Eut(l):void 0,g=u?wL(h,m)??{}:Gb;return typeof document<"u"&&(u?Array.isArray(a)?g.ref=dut([g.ref,FW(i),...a]):g.ref=sA(g.ref,FW(i),a):sA(null,null)),u?(d!==void 0&&(g.className=l0e(g.className,d)),f!==void 0&&(g.style=wL(g.style,f)),g):Gb}function Eut(e){return Array.isArray(e)?Out(e):LB(void 0,e)}const kut=Symbol.for("react.lazy");function _ut(e,t,n,r){if(t){if(typeof t=="function")return t(n,r);const i=LB(n,t.props);i.ref=n.ref;let s=t;return(s==null?void 0:s.$$typeof)===kut&&(s=p.Children.toArray(t)[0]),p.cloneElement(s,i)}if(e&&typeof e=="string")return Tut(e,n);throw new Error(NE(8))}function Tut(e,t){return e==="button"?p.createElement("button",{type:"button",...t,key:t.key}):e==="img"?p.createElement("img",{alt:"",...t,key:t.key}):p.createElement(e,t)}const Cut={value:()=>null},u0e=p.forwardRef(function(t,n){const{render:r,className:i,disabled:s=!1,hiddenUntilFound:a,keepMounted:l,loopFocus:c,onValueChange:u,multiple:d=!1,orientation:f="vertical",value:h,defaultValue:m,style:g,...b}=t,y=p.useMemo(()=>{if(h===void 0)return m??[]},[h,m]),O=p.useRef([]),[v,x]=Zge({controlled:h,default:y,name:"Accordion",state:"value"}),w=Na((_,T,C)=>{if(d)if(T){const A=v.slice();if(A.push(_),u==null||u(A,C),C.isCanceled)return;x(A)}else{const A=v.filter(j=>j!==_);if(u==null||u(A,C),C.isCanceled)return;x(A)}else{const A=v[0]===_?[]:[_];if(u==null||u(A,C),C.isCanceled)return;x(A)}}),S=p.useMemo(()=>({value:v,disabled:s,orientation:f}),[v,s,f]),E=p.useMemo(()=>({disabled:s,handleValueChange:w,hiddenUntilFound:a??!1,keepMounted:l??!1,state:S,value:v}),[s,w,a,l,S,v]),k=jE("div",t,{state:S,ref:n,props:b,stateAttributesMapping:Cut});return o.jsx(e0e.Provider,{value:E,children:o.jsx(iut,{elementsRef:O,children:k})})});let zW=0;function Aut(e,t="mui"){const[n,r]=p.useState(e),i=e||n;return p.useEffect(()=>{n==null&&(zW+=1,r(`${t}-${zW}`))},[n,t]),i}const VW=PB.useId;function Nut(e,t){if(VW!==void 0){const n=VW();return`${t}-${n}`}return Aut(e,t)}function SL(e){return Nut(e,"base-ui")}const jut="none",Rut="trigger-press";function d0e(e,t,n,r){let i=!1,s=!1;const a=Gb;return{reason:e,event:t??new Event("base-ui"),cancel(){i=!0},allowPropagation(){s=!0},get isCanceled(){return i},get isPropagationAllowed(){return s},trigger:n,...a}}function Iut(e){p.useEffect(e,gut)}const A2=null;let Dut=class{constructor(){Er(this,"callbacks",[]);Er(this,"callbacksCount",0);Er(this,"nextId",1);Er(this,"startId",1);Er(this,"isScheduled",!1);Er(this,"tick",t=>{var i;this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let s=0;s=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}},N2=new Dut;class kl{constructor(){Er(this,"currentId",A2);Er(this,"cancel",()=>{this.currentId!==A2&&(N2.cancel(this.currentId),this.currentId=A2)});Er(this,"disposeEffect",()=>this.cancel)}static create(){return new kl}static request(t){return N2.request(t)}static cancel(t){return N2.cancel(t)}request(t){this.cancel(),this.currentId=N2.request(()=>{this.currentId=A2,t()})}}function Put(){const e=qg(kl.create).current;return Iut(e.disposeEffect),e}function Mut(e,t=!1,n=!1){const[r,i]=p.useState(e&&t?"idle":void 0),[s,a]=p.useState(e);return e&&!s&&(a(!0),i("starting")),!e&&s&&r!=="ending"&&!n&&i("ending"),!e&&!s&&r==="ending"&&i(void 0),Yo(()=>{if(!e&&s&&r!=="ending"&&n){const l=kl.request(()=>{i("ending")});return()=>{kl.cancel(l)}}},[e,s,r,n]),Yo(()=>{if(!e||t)return;const l=kl.request(()=>{i(void 0)});return()=>{kl.cancel(l)}},[t,e]),Yo(()=>{if(!e||!t)return;e&&s&&r!=="idle"&&i("starting");const l=kl.request(()=>{i("idle")});return()=>{kl.cancel(l)}},[t,e,s,r]),{mounted:s,setMounted:a,transitionStatus:r}}function Lut(e){const{open:t,defaultOpen:n,onOpenChange:r,disabled:i}=e,[s,a]=Zge({controlled:t,default:n,name:"Collapsible",state:"open"}),{mounted:l,setMounted:c,transitionStatus:u}=Mut(s,!0,!0),d=SL(),[f,h]=p.useState(),m=f===null?void 0:f??d,g=Na(b=>{const y=!s,O=d0e(Rut,b.nativeEvent);r(y,O),!O.isCanceled&&a(y)});return p.useMemo(()=>({defaultPanelId:d,disabled:i,handleTrigger:g,mounted:l,open:s,panelId:m,setMounted:c,setOpen:a,setPanelIdState:h,transitionStatus:u}),[d,i,g,l,s,m,c,a,h,u])}const f0e=p.createContext(void 0);function h0e(){const e=p.useContext(f0e);if(e===void 0)throw new Error(NE(15));return e}function $ut(e={}){const{guess:t,label:n,metadata:r,textRef:i,index:s}=e,{register:a,unregister:l,subscribeMapChange:c,nextIndexRef:u}=rut(),d=p.useRef(-1),[f,h]=p.useState(s==null&&t?()=>{if(d.current===-1){const y=u.current;u.current+=1,d.current=y}return d.current}:-1),m=s??f,g=p.useRef(null),b=p.useCallback(y=>{const O=g.current;O&&l(O),g.current=y,y&&a(y,{metadata:r??null,index:s??null,label:n,textRef:i})},[s,a,l,r,n,i]);return Yo(()=>{if(s==null)return c(y=>{var v;const O=g.current?(v=y.get(g.current))==null?void 0:v.index:null;O!=null&&h(O)})},[s,c]),{ref:b,index:m}}const p0e=p.createContext(void 0);function BB(){const e=p.useContext(p0e);if(e===void 0)throw new Error(NE(9));return e}let HW=function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e}({});const But={"data-starting-style":""},Qut={"data-ending-style":""},Uut={transitionStatus(e){return e==="starting"?But:e==="ending"?Qut:null}};let QB=function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=HW.startingStyle]="startingStyle",e[e.endingStyle=HW.endingStyle]="endingStyle",e}({}),Fut=function(e){return e.panelOpen="data-panel-open",e}({});const zut={[QB.open]:""},Vut={[QB.closed]:""},Hut={open(e){return e?{[Fut.panelOpen]:""}:null}},qut={open(e){return e?zut:Vut}};let Xut=function(e){return e.index="data-index",e.disabled="data-disabled",e.open="data-open",e}({});const UB={...qut,index:e=>({[Xut.index]:String(e)}),...Uut,value:()=>null},m0e=p.forwardRef(function(t,n){const{className:r,disabled:i=!1,onOpenChange:s,render:a,value:l,style:c,...u}=t,{ref:d,index:f}=$ut(),h=sA(n,d),{disabled:m,handleValueChange:g,state:b,value:y}=t0e(),O=SL(),v=l??O,x=i||m,w=y.indexOf(v)!==-1,S=Na((N,D)=>{s==null||s(N,D),!D.isCanceled&&g(v,N,D)}),E=Lut({open:w,onOpenChange:S,disabled:x}),k=p.useMemo(()=>({open:E.open,disabled:E.disabled,transitionStatus:E.transitionStatus}),[E.open,E.disabled,E.transitionStatus]),_=p.useMemo(()=>({...E,onOpenChange:S,state:k}),[E,k,S]),T=p.useMemo(()=>({...b,hidden:!w&&!E.mounted,index:f,disabled:x,open:w}),[E.mounted,x,f,w,b]),C=SL(),[A,j]=p.useState(),M=A===null?void 0:A??C,I=p.useMemo(()=>({defaultTriggerId:C,open:w,state:T,setTriggerId:j,triggerId:M}),[C,w,T,j,M]),$=jE("div",t,{state:T,ref:h,props:u,stateAttributesMapping:UB});return o.jsx(f0e.Provider,{value:_,children:o.jsx(p0e.Provider,{value:I,children:$})})}),g0e=p.forwardRef(function(t,n){const{render:r,className:i,style:s,...a}=t,{state:l}=BB();return jE("h3",t,{state:l,ref:n,props:a,stateAttributesMapping:UB})}),Gut=p.createContext(void 0);function Wut(e=!1){const t=p.useContext(Gut);if(t===void 0&&!e)throw new Error(NE(16));return t}function Yut(e){const{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:s}=e,a=r&&t!==!1,l=r&&t===!1;return{props:p.useMemo(()=>{const u={onKeyDown(d){n&&t&&d.key!=="Tab"&&d.preventDefault()}};return r||(u.tabIndex=i,!s&&n&&(u.tabIndex=t?i:-1)),(s&&(t||a)||!s&&n)&&(u["aria-disabled"]=n),s&&(!t||l)&&(u.disabled=n),u},[r,n,t,a,l,s,i])}}function SD(e,t,{detail:n=0}={}){e.dispatchEvent(new(Wa(e)).PointerEvent("click",{bubbles:!0,cancelable:!0,composed:!0,detail:n,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function Zut(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:s}=e,a=p.useRef(null),l=Wut(!0),c=s??l!==void 0,{props:u}=Yut({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),d=p.useCallback(()=>{const m=a.current;ED(m)&&c&&t&&u.disabled===void 0&&m.disabled&&(m.disabled=!1)},[t,u.disabled,c]);Yo(d,[d]);const f=p.useCallback((m={})=>{const{onClick:g,onMouseDown:b,onKeyUp:y,onKeyDown:O,onPointerDown:v,...x}=m;return LB({onClick(w){if(t){w.preventDefault();return}g==null||g(w)},onMouseDown(w){t||b==null||b(w)},onKeyDown(w){if(t||(oA(w),O==null||O(w),w.baseUIHandlerPrevented))return;const S=w.target===w.currentTarget,E=w.currentTarget,k=ED(E),_=!i&&Kut(E),T=S&&(i?k:!_),C=w.key==="Enter",A=w.key===" ",j=E.getAttribute("role"),M=(j==null?void 0:j.startsWith("menuitem"))||j==="option"||j==="gridcell";if(S&&c&&A){if(w.defaultPrevented&&M)return;w.preventDefault(),(!i||k)&&(w.preventBaseUIHandler(),SD(E,w));return}if(!T||i||!A&&!C){S&&_&&A&&w.preventDefault();return}w.defaultPrevented||(w.preventDefault(),C&&(w.preventBaseUIHandler(),SD(E,w)))},onKeyUp(w){if(!t){if(oA(w),y==null||y(w),w.target===w.currentTarget&&i&&c&&ED(w.currentTarget)&&w.key===" "){w.preventDefault();return}w.baseUIHandlerPrevented||w.target===w.currentTarget&&!i&&!c&&!w.defaultPrevented&&w.key===" "&&(w.preventBaseUIHandler(),SD(w.currentTarget,w))}},onPointerDown(w){if(t){w.preventDefault();return}v==null||v(w)}},i?{type:"button"}:{role:"button"},u,x)},[t,u,c,i]),h=Na(m=>{a.current=m,d()});return{getButtonProps:f,buttonRef:h}}function ED(e){return Td(e)&&e.tagName==="BUTTON"}function Kut(e){return Td(e)&&e.tagName==="A"&&!!e.href}const b0e=p.forwardRef(function(t,n){const{disabled:r,className:i,id:s,render:a,nativeButton:l=!0,style:c,...u}=t,{panelId:d,open:f,handleTrigger:h,disabled:m}=h0e(),g=r||m,{getButtonProps:b,buttonRef:y}=Zut({disabled:g,focusableWhenDisabled:!0,native:l}),{defaultTriggerId:O,state:v,setTriggerId:x}=BB(),w=s||void 0,S=w??O;return Yo(()=>(x(_=>w??(_===null?void 0:_)),()=>{x(_=>_===w?null:_)}),[w,x]),jE("button",t,{state:v,ref:[n,y],props:[{"aria-controls":f?d:void 0,"aria-expanded":f,id:S,onClick:h},u,b],stateAttributesMapping:Hut})});function Jut(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function edt(e){const t=qg(tdt,e).current;return t.next=e,Yo(t.effect),t}function tdt(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function ndt(e){return e==null?e:"current"in e?e.current:e}function y0e(e,t=!1){const n=Put();return Na((r,i=null)=>{n.cancel();const s=ndt(e);if(s==null)return;const a=s,l=()=>{Tr.flushSync(r)};if(typeof a.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){r();return}function c(){Promise.all(a.getAnimations().map(u=>u.finished)).then(()=>{i!=null&&i.aborted||l()},()=>{if(i!=null&&i.aborted)return;if(a.getAnimations().some(d=>d.pending||d.playState!=="finished")){c();return}l()})}if(t){const u="data-starting-style";if(!a.hasAttribute(u)){n.request(c);return}const d=new MutationObserver(()=>{a.hasAttribute(u)||(d.disconnect(),c())});d.observe(a,{attributes:!0,attributeFilter:[u]}),i==null||i.addEventListener("abort",()=>d.disconnect(),{once:!0});return}n.request(c)})}function rdt(e){const{enabled:t=!0,open:n,ref:r,onComplete:i}=e,s=Na(i),a=y0e(r,n);p.useEffect(()=>{if(!t)return;const l=new AbortController;return a(s,l.signal),()=>{l.abort()}},[t,n,s,a])}const dx={height:void 0,width:void 0};function idt(e){const{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:i,mounted:s,onOpenChange:a,open:l,setMounted:c,setOpen:u,transitionStatus:d}=e,f=p.useRef(null),h=p.useRef(null),[m,g]=p.useState(dx),b=p.useRef(dx),y=p.useRef(!1),O=p.useRef(l),v=p.useRef(!1),[x,w]=p.useState(!1),S=p.useRef(null),E=sA(t,f),k=edt(l),_=y0e(f),T=!l&&!s,C=x?"idle":d,A=l&&(O.current||v.current),j=!l&&s&&h.current==="css-animation"&&m.height===void 0&&m.width===void 0?b.current:m,M=n&&T&&h.current!=="css-animation",I=Na((F,L=!0)=>{L&&(b.current=F),g(F)}),$=Na(()=>{var F;(F=S.current)==null||F.call(S),S.current=null}),N=Na(F=>{$(),S.current=()=>{S.current=null,F()}}),D=Na(()=>{l&&s&&h.current==="css-animation"&&(v.current=!0)});Yo(()=>{!x||d==="starting"||w(!1)},[x,d]),p.useEffect(()=>()=>{D(),$()},[D,$]),Yo(()=>{const F=f.current;if(!F)return;!l&&S.current&&$();const L=sdt(F,A);if(h.current=L,l&&d==="idle"&&O.current&&L==="css-animation"){b.current=J0(F);return}if(l&&d==="starting"){const B=y.current;if(y.current=!1,L==="none"){I(J0(F)),w(!0);return}if(L==="css-transition"){const le=adt(F);if(I(J0(F)),!B)return le;const be=j2(F,"transition-duration","0s");return N(be),w(!0),le}I(J0(F));const V=j2(F,"animation-name","none");if(!B){V();return}const W=j2(F,"animation-duration","0s");V(),N(W),w(!0);return}if(!l&&s&&(d==="idle"||d==="starting")){if(O.current=!1,v.current=!1,L==="none"){I(dx,!1),c(!1);return}I(J0(F));return}if(d!=="ending")return;if(L==="none"){c(!1);return}const H=J0(F);if(!(H.height>0||H.width>0)){c(!1);return}I(H),L==="css-animation"&&j2(F,"animation-name","none")()},[s,l,$,I,c,N,A,d]),rdt({enabled:l&&s&&C==="idle",open:!0,ref:f,onComplete(){l&&I(dx,!1)}}),p.useEffect(()=>{if(l||!s||C!=="ending"||!f.current)return;const L=new AbortController;let H=-1;function z(){k.current||(c(!1),I(dx,!1))}return H=kl.request(()=>{_(z,L.signal)}),()=>{kl.cancel(H),L.abort()}},[k,s,l,C,_,I,c]),Yo(()=>{const F=f.current;!F||!n||!T||F.setAttribute("hidden","until-found")},[T,n]),p.useEffect(function(){const L=f.current;if(!L)return;function H(z){const B=d0e(jut,z);a(!0,B),!B.isCanceled&&(y.current=!0,u(!0))}return Jut(L,"beforematch",H)},[a,u]);const Q=i||n||s||l;return{height:j.height,props:{...M?{[QB.startingStyle]:""}:void 0,hidden:T,id:r},ref:E,shouldPreventOpenAnimation:A,shouldRender:Q,transitionStatus:C,width:j.width}}function J0(e){return{height:e.scrollHeight,width:e.scrollWidth}}function sdt(e,t){const n=Wa(e).getComputedStyle(e),r=(n.animationName.split(",").map(s=>s.trim()).some(s=>s!==""&&s!=="none")||t)&&qW(n.animationDuration),i=qW(n.transitionDuration);return r&&i||i?"css-transition":r?"css-animation":"none"}function qW(e){return e.split(",").map(t=>t.trim()).some(t=>t!==""&&Number.parseFloat(t)>0)}function j2(e,t,n){const r=e.style.getPropertyValue(t),i=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{if(r===""){e.style.removeProperty(t);return}e.style.setProperty(t,r,i)}}function adt(e){const t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(i=>{e.style.setProperty(i,"initial","important")});function n(){Object.entries(t).forEach(([i,s])=>{if(s===""){e.style.removeProperty(i);return}e.style.setProperty(i,s)})}const r=kl.request(n);return()=>{kl.cancel(r),n()}}let XW=function(e){return e.accordionPanelHeight="--accordion-panel-height",e.accordionPanelWidth="--accordion-panel-width",e}({});const O0e=p.forwardRef(function(t,n){const{className:r,hiddenUntilFound:i,keepMounted:s,id:a,render:l,style:c,...u}=t,{hiddenUntilFound:d,keepMounted:f}=t0e(),{defaultPanelId:h,mounted:m,onOpenChange:g,open:b,setMounted:y,setOpen:O,setPanelIdState:v,transitionStatus:x}=h0e(),w=i??d,S=s??f,E=a||void 0,k=a??h;Yo(()=>(v(L=>E??(L===null?void 0:L)),()=>{v(L=>L===E?null:L)}),[E,v]);const{height:_,props:T,ref:C,shouldPreventOpenAnimation:A,shouldRender:j,transitionStatus:M,width:I}=idt({externalRef:n,hiddenUntilFound:w,id:k,keepMounted:S,mounted:m,onOpenChange:g,open:b,setMounted:y,setOpen:O,transitionStatus:x}),{state:$,triggerId:N}=BB(),D={...$,transitionStatus:M},Q=i0e(c,D),F=jE("div",{...t,style:void 0},{state:D,ref:C,props:[T,{"aria-labelledby":N,role:"region",style:{[XW.accordionPanelHeight]:_===void 0?"auto":`${_}px`,[XW.accordionPanelWidth]:I===void 0?"auto":`${I}px`}},u,Q?{style:Q}:void 0,A?{style:{animationName:"none"}}:void 0],stateAttributesMapping:UB});return j?F:null}),odt=(e,t)=>{const n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=ldt(r,n.getBoundingClientRect()),s=cdt(r,i),a=udt(t.getBoundingClientRect());return fdt([...s,...a])};function ldt(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function cdt(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function udt(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function ddt(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,a=t.length-1;sr!=h>r&&n<(f-u)*(r-d)/(h-d)+u&&(i=!i)}return i}function fdt(e){const t=e.slice();return t.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),hdt(t)}function hdt(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r=2;){const s=t[t.length-1],a=t[t.length-2];if((s.x-a.x)*(i.y-a.y)>=(s.y-a.y)*(i.x-a.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const s=n[n.length-1],a=n[n.length-2];if((s.x-a.x)*(i.y-a.y)>=(s.y-a.y)*(i.x-a.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}const pdt="_Transition_1wdpp_1",mdt="_Popover_1wdpp_3",x0e={Transition:pdt,Popover:mdt},v0e=p.createContext(null),Qj=()=>{const e=p.use(v0e);if(!e)throw new Error("Popover components must be wrapped in ");return e},jp=({open:e,onOpenChange:t,showOnHover:n=!1,hoverOpenDelay:r=150,children:i})=>{const[s,a]=p.useState(!1),[l,c]=p.useState(!1),u=p.useRef(null),d=p.useRef(null),f=p.useRef(void 0),h=p.useRef(!1),m=p.useRef(!1),g=e??s,[b,y]=p.useState(!1);k9(()=>y(!1),b?500:null);const O=Xp(t),v=Xp(k=>{var _,T;clearTimeout(f.current),g!==k&&(k||(c(!1),n&&h.current&&((_=u.current)==null||_.focus()),h.current=!1),(T=O.current)==null||T.call(O,k),a(k),n&&y(k))}),x=p.useCallback(k=>{v.current(k)},[v]),w=p.useCallback(()=>{f.current=setTimeout(()=>x(!0),r)},[x,r]),S=p.useCallback(()=>{clearTimeout(f.current)},[]);p.useEffect(()=>()=>{clearTimeout(f.current)},[]);const E=p.useMemo(()=>({open:g,setOpen:x,shake:l,setShake:c,showOnHover:n,temporarilyPreventClickToClose:b,onTriggerEnter:w,onTriggerLeave:S,isPointerInTransitRef:m,triggerRef:u,contentRef:d,hoverOpenFocusedWithTab:h}),[g,x,l,c,n,b,h,m,w,S]);return o.jsx(v0e,{value:E,children:o.jsx(fue,{open:g,onOpenChange:x,modal:!1,children:i})})},gdt=({children:e,onPointerDown:t,onClick:n})=>{const{setOpen:r,showOnHover:i,temporarilyPreventClickToClose:s,onTriggerEnter:a,onTriggerLeave:l,isPointerInTransitRef:c,triggerRef:u,contentRef:d}=Qj(),f=p.useRef(!1),h=b=>{!(b.currentTarget.nodeName.toLocaleLowerCase()==="a")&&s&&(b.preventDefault(),b.stopPropagation())},m=b=>{b.pointerType!=="touch"&&!f.current&&!c.current&&(a(),f.current=!0)},g=()=>{f.current&&(l(),f.current=!1)};return o.jsx(hue,{asChild:!0,ref:u,onPointerDown:b=>{h(b),t==null||t(b)},onClick:b=>{h(b),n==null||n(b)},onPointerMove:i?m:void 0,onPointerLeave:i?g:void 0,onFocus:i?()=>r(!0):void 0,onBlur:i?()=>{setTimeout(()=>{var b;(b=d.current)!=null&&b.contains(document.activeElement)||r(!1)},50)}:void 0,children:e})},w0e=({children:e,avoidCollisions:t,width:n,minWidth:r,maxWidth:i,side:s,sideOffset:a=8,align:l,alignOffset:c,translucent:u,className:d,autoFocus:f=!0})=>{const{showOnHover:h,shake:m,contentRef:g}=Qj(),b=y=>{const O=g.current;if(O&&y.target===O&&y.key==="Tab"&&y.shiftKey){y.preventDefault(),y.stopPropagation();const v=Tle(O),x=v[v.length-1];x==null||x.focus()}};return p.useEffect(()=>{const y=g.current;!y||!f||y!=null&&y.contains(document.activeElement)||h||y.focus({preventScroll:!0})},[g,h,f]),o.jsx(mue,{forceMount:!0,ref:g,className:cr(x0e.Popover,d),style:d0({"popover-width":n,"popover-min-width":r,"popover-max-width":i}),onCloseAutoFocus:h?Df:void 0,"data-animate":m?"shake":void 0,"data-translucent":u?"true":void 0,side:s,sideOffset:a,align:l,alignOffset:c??(l==="center"?0:-5),avoidCollisions:t??!0,hideWhenDetached:!0,collisionPadding:20,onOpenAutoFocus:Df,onEscapeKeyDown:Df,onKeyDown:b,children:e})},bdt=e=>{const{setOpen:t,triggerRef:n,contentRef:r,isPointerInTransitRef:i,hoverOpenFocusedWithTab:s}=Qj(),[a,l]=p.useState(null),c=p.useCallback(()=>{l(null),i.current=!1},[i]),u=p.useCallback((d,f)=>{const h=odt(d,f);l(h),i.current=!0},[i]);return p.useEffect(()=>()=>c(),[c]),p.useEffect(()=>{const d=n.current,f=r.current;if(!d||!f)return;const h=g=>u(g,f),m=g=>u(g,d);return d.addEventListener("pointerleave",h),f.addEventListener("pointerleave",m),()=>{d.removeEventListener("pointerleave",h),f.removeEventListener("pointerleave",m)}},[r,n,u,c]),p.useEffect(()=>{if(!a)return;const d=f=>{const h=n.current,m=r.current,g=f.target,b={x:f.clientX,y:f.clientY},y=(h==null?void 0:h.contains(g))||(m==null?void 0:m.contains(g)),O=!ddt(b,a),v=g.hasAttribute("aria-haspopup");y?c():(O||v)&&(c(),t(!1))};return document.addEventListener("pointermove",d),()=>document.removeEventListener("pointermove",d)},[a,t,c,n,r]),p.useEffect(()=>{const d=f=>{if(r.current&&f.key==="Tab"&&!f.shiftKey){const[h]=Tle(r.current);h&&(f.preventDefault(),h.focus(),s.current=!0,document.removeEventListener("keydown",d))}};return document.addEventListener("keydown",d),()=>{document.removeEventListener("keydown",d)}},[r,s]),o.jsx(w0e,{...e})},ydt=e=>{const{open:t,showOnHover:n,setOpen:r}=Qj();return rE(t,()=>{r(!1)}),o.jsx(pue,{forceMount:!0,children:o.jsx(rO,{enterDuration:600,exitDuration:300,className:x0e.Transition,disableAnimations:!0,children:t&&(n?o.jsx(bdt,{...e},"popover-hover"):o.jsx(w0e,{...e},"popover"))})})};jp.Trigger=gdt;jp.Content=ydt;const Odt=[{value:"skill_hub",label:"Skill Hub"},{value:"skill_space",label:"AgentKit 技能中心"},{value:"knowledge_base",label:"知识库"},{value:"tool",label:"工具"}],S0e={llm:"LLM Agent",sequential:"顺序 Agent",parallel:"并行 Agent",loop:"循环 Agent",workflow:"Workflow"};function E0e(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m4 6 4 4 4-4"})})}function k0e({label:e}){return o.jsx("div",{className:"create-agent-card__loading",role:"status","aria-label":e,children:[0,1,2].map(t=>o.jsxs("div",{className:"create-agent-card__skeleton-row","aria-hidden":"true",children:[o.jsx("span",{}),o.jsx("span",{})]},t))})}function xdt(e){return e.kind==="tool"?"内置工具":e.kind==="knowledge_base"?"知识库":e.source.startsWith("skill_hub:")?"Skill Hub":e.source.startsWith("skill_space:")?"AgentKit 技能中心":"Skill"}function kD({label:e,resources:t}){return t.length===0?null:o.jsxs("section",{className:"create-agent-card__popover-section",children:[o.jsx("h4",{children:e}),o.jsx("div",{className:"create-agent-card__popover-list",children:t.map(n=>o.jsxs("div",{className:"create-agent-card__popover-item",children:[o.jsxs("div",{className:"create-agent-card__popover-item-heading",children:[o.jsx("strong",{children:n.name}),o.jsx(Js,{color:"secondary",size:"sm",variant:"soft",children:xdt(n)})]}),n.description?o.jsx("p",{children:n.description}):null]},n.ref))})]})}function vdt({tools:e}){return e.length===0?null:o.jsxs("section",{className:"create-agent-card__popover-section",children:[o.jsx("h4",{children:"自写工具"}),o.jsx(u0e,{children:e.map((t,n)=>o.jsxs(m0e,{className:"create-agent-card__python-tool",value:`${t.name}:${n}`,children:[o.jsx(g0e,{className:"create-agent-card__python-tool-header",children:o.jsxs(b0e,{className:"create-agent-card__python-tool-trigger",children:[o.jsxs("span",{children:[o.jsx("strong",{children:t.name}),t.description?o.jsx("small",{children:t.description}):null]}),o.jsxs("span",{className:"create-agent-card__python-tool-meta",children:[o.jsx(Js,{color:"secondary",size:"sm",variant:"soft",children:"自写工具"}),o.jsx(E0e,{className:"create-agent-card__python-tool-chevron"})]})]})}),o.jsxs(O0e,{className:"create-agent-card__python-tool-panel",children:[t.dependencies.length>0?o.jsxs("div",{className:"create-agent-card__python-tool-dependencies",children:["依赖:",t.dependencies.join(", ")]}):null,o.jsx("pre",{tabIndex:0,"aria-label":`${t.name} 完整代码`,children:o.jsx("code",{children:t.code})})]})]},`${t.name}:${n}`))})]})}function wdt({agents:e}){return e.length===0?null:o.jsxs("section",{className:"create-agent-card__popover-section",children:[o.jsx("h4",{children:"Sub Agent"}),o.jsx("div",{className:"create-agent-card__popover-list",children:e.map(t=>o.jsxs("div",{className:"create-agent-card__popover-item",children:[o.jsxs("div",{className:"create-agent-card__popover-item-heading",children:[o.jsx("strong",{children:t.id}),o.jsx(Js,{color:"secondary",size:"sm",variant:"soft",children:S0e[t.type]??t.type})]}),t.description?o.jsx("p",{children:t.description}):null]},t.id))})]})}function R2({label:e,count:t,icon:n,children:r}){const i=o.jsxs("button",{className:"create-agent-card__resource-metric",type:"button",disabled:t===0,"aria-label":`${e} ${t} 项`,children:[n,o.jsx("span",{children:t})]});return t===0?i:o.jsxs(jp,{showOnHover:!0,hoverOpenDelay:120,children:[o.jsx(jp.Trigger,{children:i}),o.jsx(jp.Content,{side:"top",align:"start",minWidth:"auto",maxWidth:360,className:"create-agent-card__resource-popover",children:r})]})}function Sdt({response:e,status:t}){const n=p.useMemo(()=>Gct(e),[e]),r=p.useMemo(()=>Odt.map(a=>{const l=Wct(n,a.value);return{...a,...l,searchKeywords:[...new Set(l.sources.flatMap(c=>c.searchKeywords))]}}),[n]),i=t==="failed",s=i?Bj(e):"";return o.jsx("section",{className:"create-agent-tool-card","aria-label":"召回资源信息",children:t==="running"?o.jsx(k0e,{label:"正在检索资源"}):i?o.jsxs("div",{className:"create-agent-card__message is-error",role:"alert",children:[o.jsx("span",{className:"create-agent-card__message-title",children:"资源检索未完成"}),o.jsx("span",{children:s||"请检查资源服务配置后重试。"})]}):o.jsx(u0e,{className:"create-agent-card__accordion",children:r.map(a=>o.jsxs(m0e,{className:"create-agent-card__accordion-item",value:a.value,children:[o.jsx(g0e,{className:"create-agent-card__accordion-header",children:o.jsxs(b0e,{className:"create-agent-card__accordion-trigger",children:[o.jsx("span",{children:a.label}),o.jsxs("span",{className:"create-agent-card__accordion-meta",children:[o.jsx(Js,{color:"secondary",size:"sm",variant:"soft",children:a.sources.length===0?a.value==="skill_hub"?"未检索":"未配置":a.resources.length}),o.jsx(E0e,{className:"create-agent-card__accordion-chevron"})]})]})}),o.jsx(O0e,{className:"create-agent-card__accordion-content",children:o.jsxs("div",{className:"create-agent-card__accordion-scroll",role:"region","aria-label":`${a.label}资源列表`,tabIndex:0,children:[a.value==="skill_hub"&&a.searchKeywords.length>0?o.jsxs("div",{className:"create-agent-card__search-keywords",children:[o.jsx("span",{children:"检索关键词"}),o.jsx("span",{children:a.searchKeywords.join("、")})]}):null,a.resources.length>0?o.jsx("div",{className:"create-agent-card__resource-list",children:a.resources.map(l=>o.jsx("div",{className:"create-agent-card__resource",children:o.jsxs("div",{className:"create-agent-card__resource-main",children:[o.jsxs("div",{className:"create-agent-card__resource-title",children:[o.jsx("span",{className:"create-agent-card__resource-name",children:l.name}),l.version?o.jsx(Js,{className:"create-agent-card__resource-version",color:"secondary",size:"sm",variant:"soft",children:l.version}):null]}),l.description?o.jsx("p",{children:l.description}):null]})},l.ref))}):o.jsxs("div",{className:"create-agent-card__empty-category",children:[o.jsx("p",{children:a.sources.length===0?a.value==="skill_hub"?"未提供检索关键词,本次未检索 Skill Hub。":`未配置 ${a.label},本次未检索该来源。`:"本次检索未返回该类别的资源。"}),a.sources.filter(l=>l.message).map(l=>o.jsx("p",{className:"create-agent-card__raw-source-error",children:l.message},l.source))]})]})})]},a.value))},n.collectionId||"collected-resources")})}function Edt({args:e,response:t,status:n}){const r=p.useMemo(()=>Yge(e,t),[e,t]),i=n==="failed"?Bj(t):"";return o.jsxs("section",{className:"create-agent-tool-card is-agent-results","aria-label":"创建 Agent 结果",children:[i?o.jsxs("div",{className:"create-agent-card__message is-error",role:"alert",children:[o.jsx("span",{className:"create-agent-card__message-title",children:"Agent 创建未完成"}),o.jsx("span",{children:i})]}):null,r.agents.length>0?o.jsx("div",{className:"create-agent-card__agent-grid",children:r.agents.map(s=>{const a=n==="failed"?"failed":s.status,l=s.error||a==="failed"&&i,c=s.builtinTools.length+s.pythonTools.length;return o.jsxs(W7,{className:`create-agent-card__agent-card${l?" is-error":""}`,children:[o.jsx(Y7,{leading:o.jsx(d1,{seed:s.name}),title:s.name,titleText:s.name,status:o.jsx(Js,{color:"secondary",size:"sm",variant:"soft",children:S0e[s.rootType]??s.rootType})}),s.description?o.jsx(Z7,{children:s.description}):null,l?o.jsx("div",{className:"create-agent-card__agent-result is-error",role:"alert",children:l}):null,o.jsxs("div",{className:"create-agent-card__agent-resources","aria-label":`${s.name} 具备的资源`,children:[o.jsx(R2,{label:"Skill",count:s.skills.length,icon:o.jsx(B_,{"aria-hidden":"true"}),children:o.jsx(kD,{label:"Skill",resources:s.skills})}),o.jsx(R2,{label:"知识库",count:s.knowledgeBases.length,icon:o.jsx(zue,{"aria-hidden":"true"}),children:o.jsx(kD,{label:"知识库",resources:s.knowledgeBases})}),o.jsxs(R2,{label:"工具",count:c,icon:o.jsx(ERe,{"aria-hidden":"true"}),children:[o.jsx(kD,{label:"内置工具",resources:s.builtinTools}),o.jsx(vdt,{tools:s.pythonTools})]}),o.jsx(R2,{label:"Sub Agent",count:s.subAgentCount,icon:o.jsx(_Re,{"aria-hidden":"true"}),children:o.jsx(wdt,{agents:s.subAgents})})]})]},s.name)})}):n==="running"?o.jsx(k0e,{label:"正在创建 Agent"}):o.jsxs("div",{className:"create-agent-card__message",children:[o.jsx("span",{className:"create-agent-card__message-title",children:"没有可展示的 Agent"}),o.jsx("span",{children:"工具返回中未包含 Agent 配置或执行结果。"})]})]})}const kdt={web_search:{name:"web_search",runningLabel:"正在进行网络搜索",doneLabel:"已完成网络搜索",tone:"search",icon:Ict},run_code:{name:"run_code",runningLabel:"正在 AgentKit 沙箱中执行代码",doneLabel:"已在 AgentKit 沙箱中完成代码执行",tone:"sandbox",icon:Bct},list_envs:{name:"list_envs",runningLabel:"正在查看可用环境",doneLabel:"已读取可用环境",tone:"resources",icon:Uct},get_env_manifest:{name:"get_env_manifest",runningLabel:"正在读取环境 Manifest",doneLabel:"已读取环境 Manifest",tone:"knowledge",icon:Fct},execute_in_sandbox:{name:"execute_in_sandbox",runningLabel:"正在环境中执行命令",doneLabel:"已在环境中完成命令执行",tone:"sandbox",icon:zct},image_generate:{name:"image_generate",runningLabel:"正在生成图片",doneLabel:"已完成图片生成",tone:"image",icon:Dct},video_generate:{name:"video_generate",runningLabel:"正在生成视频",doneLabel:"已完成视频生成",tone:"video",icon:IB},ppt_generate:{name:"ppt_generate",runningLabel:"正在生成 PPT",doneLabel:"已完成 PPT 生成",tone:"presentation",icon:Pct},load_memory:{name:"load_memory",runningLabel:"正在检索长期记忆",doneLabel:"已完成记忆检索",tone:"memory",icon:Mct},load_knowledgebase:{name:"load_knowledgebase",runningLabel:"正在检索知识库",doneLabel:"已完成知识库检索",tone:"knowledge",icon:Lct},load_skill:{name:"load_skill",runningLabel:"正在加载技能",doneLabel:"已加载技能",tone:"skill",icon:$ct},collect_resources:{name:"collect_resources",runningLabel:"正在收集可用资源",doneLabel:"已完成资源收集",failedLabel:"资源收集失败",tone:"resources",icon:Qct,detailRenderer:Sdt},create_agents:{name:"create_agents",runningLabel:"正在创建并运行 Agent",doneLabel:"已完成 Agent 创建",failedLabel:"Agent 创建失败",tone:"agent",icon:LW,detailRenderer:Edt},branch_compare:{name:"branch_compare",runningLabel:"",doneLabel:"",failedLabel:"",tone:"search",icon:LW,detailRenderer:Kct,hideHeader:!0}};function _dt(e){return kdt[e]}function _0e(e){return o.jsx("svg",{viewBox:"0 0 111 117",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M0 5.6016C7.82288e-05 0.621244 6.02226 -1.87314 9.54395 1.64847L40.1289 32.2334L68.5732 3.7891C69.5834 2.77903 70.9533 2.21099 72.3818 2.21097H82.7031C82.7917 2.20658 82.8806 2.20414 82.9697 2.20414H104.775C109.574 2.20427 111.977 8.00691 108.584 11.4004L64.916 55.0664C64.3075 55.8528 63.9436 56.7647 63.8242 57.6993C63.7142 56.4884 63.1964 55.3069 62.2695 54.3799L45.4082 37.5186H45.4072L40.124 32.2354L17.832 54.5284C16.7671 55.5933 16.2416 56.993 16.2549 58.3887C16.2417 59.7843 16.7672 61.1842 17.832 62.2491L39.9287 84.3467L9.54395 114.733C6.0223 118.255 0.000223474 115.761 0 110.78V5.6016ZM63.8018 58.8702C63.8962 59.9086 64.2936 60.9229 64.9961 61.7735L108.591 105.368C111.984 108.762 109.58 114.564 104.781 114.564H94.4336C94.3543 114.568 94.274 114.569 94.1934 114.569H72.3877C70.9592 114.569 69.5892 114.002 68.5791 112.992L39.9336 84.3467L58.4531 65.8282L58.4453 65.8203L62.2695 61.9981C63.1476 61.12 63.6567 60.0136 63.8018 58.8702Z",fill:"currentColor"})})}function Tdt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M6 3h8l4 4v14H6Z"}),o.jsx("path",{d:"M14 3v5h5"}),o.jsx("path",{d:"m10 12-2 2 2 2M14 12l2 2-2 2"})]})}function Cdt(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M12 3 19 6v5c0 4.6-2.8 7.8-7 10-4.2-2.2-7-5.4-7-10V6l7-3Z"}),o.jsx("path",{d:"m9 12 2 2 4-4"})]})}function Adt(e,t){const n=new Map(e.map(a=>[a.path,a.content])),r=new Map(t.map(a=>[a.path,a.content])),i=new Set([...n.keys(),...r.keys()]),s=[];for(const a of[...i].sort((l,c)=>l.localeCompare(c))){const l=n.get(a),c=r.get(a);l!==c&&s.push({path:a,status:l===void 0?"added":c===void 0?"deleted":"modified",before:l??"",after:c??""})}return s}function Ndt(e){return e==="added"?"新增":e==="deleted"?"删除":"修改"}function mm(e){return{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e}}function T0e(e){return o.jsx("svg",{...mm(e),children:o.jsx("path",{d:"m9 7-5 5 5 5M15 7l5 5-5 5M13.5 4l-3 16"})})}function _D(e){return o.jsx("svg",{...mm(e),children:o.jsx("path",{d:"M6.5 3.75h7l4 4V20.25h-11zM13.5 3.75v4h4M9 12h6M9 15.5h4.5"})})}function jdt(e){return o.jsx("svg",{...mm(e),children:o.jsx("path",{d:"M3.75 7.25h6l1.75 2h8.75v9.25H3.75zM3.75 7.25V5.5h5l1.5 1.75"})})}function Rdt(e){return o.jsx("svg",{...mm(e),children:o.jsx("path",{d:"m9 5 7 7-7 7"})})}function C0e(e){return o.jsx("svg",{...mm(e),children:o.jsx("path",{d:"m6.5 6.5 11 11M17.5 6.5l-11 11"})})}function Idt(e){return o.jsxs("svg",{...mm(e),children:[o.jsx("circle",{cx:"12",cy:"12",r:"3.25"}),o.jsx("path",{d:"M12 2.75v2M12 19.25v2M2.75 12h2M19.25 12h2M5.45 5.45l1.4 1.4M17.15 17.15l1.4 1.4M18.55 5.45l-1.4 1.4M6.85 17.15l-1.4 1.4"})]})}function Ddt(e){return o.jsx("svg",{...mm(e),children:o.jsx("path",{d:"M19.25 15.25A8 8 0 0 1 8.75 4.75a8 8 0 1 0 10.5 10.5Z"})})}function Pdt(e){return o.jsxs("svg",{...mm(e),children:[o.jsx("path",{d:"M19.25 8.25V4.5l-1.8 1.8a7.5 7.5 0 1 0 1.8 7.65"}),o.jsx("path",{d:"M19.25 4.5H15.5"})]})}const Mdt=p.lazy(()=>hd(()=>Promise.resolve().then(()=>rve),void 0)),Ldt=p.lazy(()=>hd(()=>import("../chunks/CodeDiffEditor-CyInNOY9.js"),[])),A0e="veadk-code-workspace-theme";function $dt(e){const t={name:"",children:new Map};for(const n of e){const r=n.path.split("/").filter(Boolean);let i=t;r.forEach((s,a)=>{let l=i.children.get(s);l||(l={name:s,children:new Map},i.children.set(s,l)),a===r.length-1&&(l.path=n.path),i=l})}return t}function Bdt(e,t=!1){return[...e.children.values()].sort((n,r)=>{const i=n.children.size>0&&n.path===void 0,s=r.children.size>0&&r.path===void 0;return i!==s?t?i?1:-1:i?-1:1:n.name.localeCompare(r.name)})}function Qdt(){if(typeof window>"u")return"light";try{return window.localStorage.getItem(A0e)==="dark"?"dark":"light"}catch{return"light"}}function Udt(e){return e===""?0:e.split(` +`).length}function Kw({project:e,open:t,onClose:n,onChange:r,readOnly:i=!1,comparison:s}){var j;const a=p.useId(),l=p.useRef(null),c=p.useRef(null),u=p.useRef(n),[d,f]=p.useState(Qdt),h=p.useMemo(()=>s?Adt(s.baseProject.files,e.files):[],[s,e.files]),m=p.useMemo(()=>s?h.map(M=>({path:M.path,content:M.status==="deleted"?M.before:M.after})):e.files,[h,s,e.files]),g=p.useMemo(()=>new Map(h.map(M=>[M.path,M.status])),[h]),[b,y]=p.useState(((j=m[0])==null?void 0:j.path)??null),[O,v]=p.useState(new Set),x=p.useMemo(()=>$dt(m),[m]),w=m.find(M=>M.path===b)??null,S=h.find(M=>M.path===b)??null;if(u.current=n,p.useEffect(()=>{try{window.localStorage.setItem(A0e,d)}catch{}},[d]),p.useEffect(()=>{var N;if(!t)return;const M=document.body.style.overflow,I=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(N=c.current)==null||N.focus();const $=D=>{if(D.key==="Escape"){D.preventDefault(),u.current();return}if(D.key!=="Tab"||!l.current)return;const Q=[...l.current.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')].filter(H=>H.offsetParent!==null);if(Q.length===0)return;const F=Q[0],L=Q[Q.length-1];D.shiftKey&&document.activeElement===F?(D.preventDefault(),L.focus()):!D.shiftKey&&document.activeElement===L&&(D.preventDefault(),F.focus())};return window.addEventListener("keydown",$),()=>{document.body.style.overflow=M,window.removeEventListener("keydown",$),I!=null&&I.isConnected&&I.focus()}},[t]),p.useEffect(()=>{w||m.length===0||y(m[0].path)},[m,w]),!t)return null;function E(M){v(I=>{const $=new Set(I);return $.has(M)?$.delete(M):$.add(M),$})}function k(M){return M?o.jsx("span",{className:`code-browser-change is-${M}`,children:Ndt(M)}):null}function _(M,I,$){return Bdt(M,I===0).map(N=>{const D=$?`${$}/${N.name}`:N.name;if(!(N.children.size>0&&N.path===void 0)&&N.path){const L=g.get(N.path);return o.jsxs("button",{type:"button",className:`code-browser-file${b===N.path?" is-active":""}`,style:{paddingLeft:`${12+I*16}px`},onClick:()=>y(N.path??null),title:N.path,"aria-pressed":b===N.path,children:[o.jsx(_D,{}),o.jsx("span",{children:N.name}),k(L)]},D)}const F=O.has(D);return o.jsxs("div",{children:[o.jsxs("button",{type:"button",className:"code-browser-folder",style:{paddingLeft:`${10+I*16}px`},onClick:()=>E(D),"aria-expanded":!F,children:[o.jsx(Rdt,{className:F?"":"is-open"}),o.jsx(jdt,{}),o.jsx("span",{children:N.name})]}),!F&&_(N,I+1,D)]},D)})}function T(M){!w||s||r({...e,files:e.files.map(I=>I.path===w.path?{...I,content:M}:I)})}const C=d==="light"?"dark":"light",A=s?"两个版本的源码没有差异":"从左侧选择文件以查看代码";return Tr.createPortal(o.jsx("div",{className:"code-browser-backdrop",onMouseDown:M=>{M.target===M.currentTarget&&n()},children:o.jsxs("section",{ref:l,className:`code-browser-dialog is-${d}`,role:"dialog","aria-modal":"true","aria-labelledby":a,children:[o.jsxs("header",{className:"code-browser-head",children:[o.jsxs("div",{className:"code-browser-title-wrap",children:[o.jsx("span",{className:"code-browser-title-icon",children:o.jsx(T0e,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:a,children:s?"版本对比":"源码工作区"}),o.jsx("p",{title:e.name,children:e.name||"Agent 项目"})]})]}),o.jsxs("div",{className:"code-browser-head-actions",children:[o.jsx("button",{type:"button",className:"code-browser-icon-button",onClick:()=>f(C),"aria-label":"切换源码主题",title:`切换为${C==="dark"?"深色":"浅色"}主题`,children:d==="light"?o.jsx(Ddt,{}):o.jsx(Idt,{})}),o.jsx("button",{ref:c,type:"button",className:"code-browser-icon-button",onClick:n,"aria-label":"关闭源码工作区",title:"关闭",children:o.jsx(C0e,{})})]})]}),o.jsxs("div",{className:"code-browser-workspace",children:[o.jsxs("aside",{className:"code-browser-sidebar","aria-label":s?"变更文件":"项目文件",children:[o.jsxs("div",{className:"code-browser-sidebar-head",children:[o.jsx("span",{children:s?"变更":"文件"}),o.jsx("span",{children:m.length})]}),o.jsx("div",{className:"code-browser-tree",children:m.length>0?_(x,0,""):o.jsx("div",{className:"code-browser-empty",children:A})})]}),o.jsxs("main",{className:"code-browser-main",children:[o.jsx("div",{className:"code-browser-tabs",role:"tablist","aria-label":"打开的文件",children:w?o.jsxs("div",{className:"code-browser-tab",role:"tab","aria-selected":"true",children:[o.jsx(_D,{}),o.jsx("span",{children:w.path.split("/").pop()}),k(S==null?void 0:S.status)]}):null}),o.jsxs("div",{className:"code-browser-path",children:[o.jsx(_D,{}),o.jsx("span",{children:(w==null?void 0:w.path)??"未选择文件"})]}),s?o.jsxs("div",{className:"code-browser-diff-labels","aria-label":"对比方向",children:[o.jsx("span",{children:s.baseLabel??"优化前"}),o.jsx("span",{children:s.targetLabel??"优化后"})]}):null,o.jsx("div",{className:"code-browser-editor",children:w?o.jsx(p.Suspense,{fallback:o.jsx("div",{className:"code-browser-empty",children:"正在加载编辑器…"}),children:S?o.jsx(Ldt,{before:S.before,after:S.after,path:S.path,theme:d}):o.jsx(Mdt,{value:w.content,path:w.path,onChange:T,readOnly:i,theme:d})}):o.jsx("div",{className:"code-browser-empty",children:A})}),o.jsxs("footer",{className:"code-browser-statusbar",children:[o.jsx("span",{children:s?`${h.length} 个文件有变更`:`${e.files.length} 个文件`}),o.jsx("span",{children:w?`${Udt(w.content)} 行 · UTF-8`:"UTF-8"})]})]})]})]})}),document.body)}function Fdt({project:e,onChange:t,className:n="",label:r="查看源码"}){const[i,s]=p.useState(!1);return o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:`code-browser-trigger ${n}`.trim(),onClick:()=>s(!0),"aria-label":"查看和编辑项目源码",title:r,children:[o.jsx(T0e,{}),o.jsx("span",{children:r})]}),o.jsx(Kw,{project:e,open:i,onClose:()=>s(!1),onChange:t})]})}const N0e="send_a2ui_json_to_client",zdt=28,Vdt=3e3;function Hdt(e,t,n){let r=t;for(let i=0;i65535?2:1}return r}function qdt(e){return e<=4?1:Math.min(18,Math.max(2,Math.ceil(e/6)))}function j0e(e,t,n,r){const[i,s]=p.useState(()=>t?"":e),a=p.useRef(i),l=p.useRef(e),c=p.useRef(null),u=p.useRef(0),d=p.useRef(n);return l.current=e,d.current=n,p.useEffect(()=>{const f=a.current,h=window.matchMedia("(prefers-reduced-motion: reduce)").matches;if(!t||h||!e.startsWith(f)){c.current!==null&&window.cancelAnimationFrame(c.current),c.current=null,f!==e&&(a.current=e,s(e));return}if(f===e||c.current!==null)return;const m=g=>{const b=l.current,y=a.current;if(!b.startsWith(y)){a.current=b,s(b),c.current=null;return}if(g-u.current{var f;(f=d.current)==null||f.call(d)},[i]),p.useEffect(()=>{i===e&&(r==null||r())},[i,r,e]),p.useEffect(()=>()=>{c.current!==null&&(window.cancelAnimationFrame(c.current),c.current=null)},[]),i}function Xdt(){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:o.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 Gdt(){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"m4.5 7 1.8 1.8L9.5 5.5"}),o.jsx("path",{d:"M12 7h7.5"}),o.jsx("path",{d:"m4.5 13 1.8 1.8 3.2-3.3"}),o.jsx("path",{d:"M12 13h7.5"}),o.jsx("path",{d:"M5 19h4"}),o.jsx("path",{d:"M12 19h7.5"})]})}function Wdt(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 R0e({text:e,done:t,answerStarted:n=!1,streaming:r=!1,onStreamFrame:i}){const[s,a]=p.useState(!(t||n)),l=p.useRef(!1);p.useEffect(()=>{l.current||a(!(t||n))},[n,t]);const c=()=>{l.current=!0,a(m=>!m)},u=e.replace(/^\s+/,""),d=j0e(u,!t||r,i),{ref:f,onScroll:h}=qge(d);return o.jsxs("div",{className:"block-thinking",children:[o.jsxs("button",{className:"think-head",onClick:c,type:"button",children:[o.jsx("span",{className:"think-icon","aria-hidden":"true",children:o.jsx(_0e,{className:`thinking-logo ${t?"":"is-active"}`})}),t?o.jsx("span",{className:"think-label think-label--done",children:"已完成思考"}):o.jsx(En,{className:"think-label",duration:2.4,spread:18,children:"思考中"}),o.jsx(qS,{className:`chev ${s?"open":""}`})]}),o.jsx("div",{className:`think-collapse ${s&&d?"open":""}`,children:o.jsx("div",{className:"think-collapse-inner",children:o.jsx("div",{className:"think-body scroll",ref:f,onScroll:h,children:d})})})]})}function Ydt({text:e}){return o.jsx("div",{className:"block-progress",role:"status","aria-live":"polite","aria-atomic":"true",children:o.jsxs("div",{className:"think-head progress-head",children:[o.jsx("span",{className:"think-icon","aria-hidden":"true",children:o.jsx(_0e,{className:"thinking-logo is-active"})}),o.jsx(En,{className:"think-label",duration:2.4,spread:18,children:e})]})})}function Zdt({value:e,onResolve:t,onResolveComparison:n,onDownload:r,onDeploy:i}){const[s,a]=p.useState(e.files?e:null),[l,c]=p.useState(!1),[u,d]=p.useState(!1),[f,h]=p.useState(null),[m,g]=p.useState(null),[b,y]=p.useState(""),[O,v]=p.useState(null),x=new Date(e.validatedAt),w=e.validatedAt?Number.isNaN(x.getTime())?e.validatedAt:x.toLocaleString("zh-CN",{hour12:!1}):"刚刚";p.useEffect(()=>{if(!O)return;const C=window.setTimeout(()=>v(null),Vdt);return()=>window.clearTimeout(C)},[O]);async function S(){if(s)return s;if(!t)throw new Error("暂时无法读取生成的源码,请稍后重试。");const C=await t(e);return a(C),C}async function E(){g("source"),y(""),v(null);try{await S(),c(!0)}catch(C){y(C instanceof Error?C.message:String(C))}finally{g(null)}}async function k(){if(r){g("download"),y(""),v(null);try{await r(e),v({message:"已开始下载"})}catch(C){y(C instanceof Error?C.message:String(C))}finally{g(null)}}}async function _(){if(n){g("compare"),y(""),v(null);try{const C=f??await n(e);h(C),d(!0)}catch(C){y(C instanceof Error?C.message:String(C))}finally{g(null)}}}async function T(){g("deploy"),y(""),v(null);try{i==null||i(await S())}catch(C){y(C instanceof Error?C.message:String(C))}finally{g(null)}}return o.jsxs(o.Fragment,{children:[o.jsxs("section",{className:`delivery-card${e.verified?" is-verified":" is-unverified"}`,"aria-label":e.verified?"已验证交付物":"生成的 Agent 源码",children:[o.jsxs("header",{className:"delivery-card-header",children:[o.jsx("span",{className:"delivery-card-icon",children:e.verified?o.jsx(Cdt,{}):o.jsx(Tdt,{})}),o.jsxs("div",{children:[o.jsx("strong",{children:e.verified?"已验证交付物":"生成的 Agent 源码"}),o.jsx("span",{children:e.agentName})]})]}),o.jsxs("dl",{className:"delivery-card-grid",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"入口"}),o.jsx("dd",{children:o.jsx("code",{children:e.entryPoint})})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"文件数"}),o.jsx("dd",{children:e.fileCount})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"大小"}),o.jsxs("dd",{children:[(e.artifactSize/1024).toFixed(1)," KiB"]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:e.verified?"验证时间":"生成时间"}),o.jsx("dd",{children:w})]})]}),o.jsxs("p",{className:"delivery-card-gates",children:[e.verified?`${e.gateSummary.length} 项检查通过`:"源码已准备好,可部署"," ·"," ",o.jsx("code",{children:e.artifactSha256.slice(0,12)})]}),e.verified?null:o.jsx("p",{className:"delivery-card-guidance",children:"源码已准备好,可查看、下载或部署;部署前请确认 Runtime 配置。"}),o.jsxs("div",{className:"delivery-card-actions",children:[o.jsxs("button",{type:"button",className:"delivery-card-secondary",onClick:()=>void E(),disabled:!t||m!==null,children:[m==="source"?o.jsx(or,{className:"spin","aria-hidden":"true"}):null,"查看源码"]}),e.projectId&&e.versionId&&e.parentVersionId?o.jsxs("button",{type:"button",className:"delivery-card-secondary",onClick:()=>void _(),disabled:!n||m!==null,children:[m==="compare"?o.jsx(or,{className:"spin","aria-hidden":"true"}):null,m==="compare"?"正在准备…":"查看本次变更"]}):null,o.jsxs("button",{type:"button",className:"delivery-card-secondary",onClick:()=>void k(),disabled:!r||m!==null,"aria-busy":m==="download",children:[m==="download"?o.jsx(or,{className:"spin","aria-hidden":"true"}):null,m==="download"?"正在准备…":"下载源码"]}),o.jsxs("button",{type:"button",onClick:()=>void T(),disabled:!e.deployable||!i||!t||m!==null,title:e.deployable?void 0:"源码尚未准备好",children:[m==="deploy"?o.jsx(or,{className:"spin","aria-hidden":"true"}):null,"手动部署到 Runtime"]})]}),b?o.jsx("p",{className:"delivery-card-error",role:"alert",children:b}):null,O?o.jsx("p",{className:"delivery-card-status",role:"status","aria-live":"polite",children:O.message}):null]}),o.jsx(Kw,{project:{name:e.agentName,files:(s==null?void 0:s.files)??[]},open:l,onClose:()=>c(!1),onChange:()=>{},readOnly:!0}),o.jsx(Kw,{project:{name:(f==null?void 0:f.target.agentName)??e.agentName,files:(f==null?void 0:f.target.files)??[]},comparison:f?{baseProject:{name:f.base.agentName,files:f.base.files??[]},baseLabel:"优化前",targetLabel:"优化后"}:void 0,open:u,onClose:()=>d(!1),onChange:()=>{},readOnly:!0})]})}function I0e(){return o.jsx(R0e,{text:"",done:!1})}const Kdt=p.memo(function({text:t,streaming:n,onStreamFrame:r,onStreamComplete:i}){const s=j0e(t,n,r,i);return s?o.jsx("div",{className:"bubble",children:o.jsx(wu,{text:s,streaming:n})}):null}),Jdt={pending:"待处理",in_progress:"进行中",completed:"已完成",failed:"未完成"};function eft({title:e,summary:t,items:n,done:r}){const[i,s]=p.useState(!r),a=p.useRef(!1);p.useEffect(()=>{a.current||s(!r)},[r]);const l=()=>{a.current=!0,s(c=>!c)};return o.jsxs("div",{className:"block-plan",children:[o.jsxs("button",{className:"plan-head",type:"button",onClick:l,"aria-expanded":n.length>0?i:void 0,disabled:n.length===0,children:[o.jsx("span",{className:"plan-icon","aria-hidden":"true",children:o.jsx(Gdt,{})}),r?o.jsx("span",{className:"plan-title",children:e}):o.jsx(En,{className:"plan-title",duration:2.2,spread:15,children:e}),t?o.jsx("span",{className:"plan-summary",children:t}):null,n.length>0?o.jsx(DB,{className:`plan-chevron${i?" is-open":""}`}):null]}),o.jsx("div",{className:`think-collapse ${i&&n.length>0?"open":""}`,children:o.jsx("div",{className:"think-collapse-inner",children:n.length>0?o.jsx("ol",{className:"plan-items",children:n.map((c,u)=>o.jsxs("li",{"data-status":c.status,children:[o.jsx("span",{className:"plan-item-marker","aria-hidden":"true"}),o.jsx("span",{className:"plan-item-text",children:c.text}),o.jsx("small",{children:Jdt[c.status]})]},`${u}:${c.text}`))}):null})})]})}function tft(e){if(!e||typeof e!="object")return[];const t=e,n=t.result;let r=[];if(Array.isArray(t.studio_artifacts))r=t.studio_artifacts;else if(n&&typeof n=="object"){const i=n.studio_artifacts;Array.isArray(i)&&(r=i)}return r.flatMap(i=>{if(!i||typeof i!="object")return[];const s=i;return typeof s.name=="string"&&typeof s.contentUrl=="string"?[{name:s.name,contentUrl:s.contentUrl}]:[]})}function nft({name:e,args:t,response:n,done:r,status:i,defaultOpen:s=!1,retrying:a=!1,onBranchSelect:l}){const u=e==="create_agents"&&r&&Yct(t,n)?"failed":i??(r?"completed":"running"),d=e==="create_agents"&&u==="failed"&&a,f=_dt(e),h=f==null?void 0:f.detailRenderer,m=(f==null?void 0:f.hideHeader)===!0,g=m||s||!!h,[b,y]=p.useState(g),O=p.useRef(!1);p.useEffect(()=>{!O.current&&g&&y(!0)},[g]);const v=()=>{O.current=!0,y(k=>!k)},x=e===N0e?"渲染 UI":e,w=tft(n),S=n==null?null:typeof n=="string"?n:JSON.stringify(n,null,2),E=S&&S.length>2e3?S.slice(0,2e3)+` +…(已截断)`:S;return o.jsxs(ui.div,{className:`block-tool${f?" block-tool--builtin":""}`,"data-status":u,initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[f&&!m?o.jsx(Vct,{definition:f,label:d?"Agent 正在调整":u==="failed"?f.failedLabel:Wdt(e,t),done:r,open:b,onToggle:v}):f?null:o.jsxs("button",{className:"tool-head tool-head--generic",onClick:v,type:"button","aria-expanded":b,children:[o.jsx("span",{className:"tool-icon tool-icon--generic","aria-hidden":"true",children:o.jsx(Xdt,{})}),r?o.jsx("span",{className:"tool-name",children:x}):o.jsx(En,{className:"tool-name",duration:2.2,spread:15,children:x}),o.jsx(DB,{className:`tool-chevron${b?" is-open":""}`})]}),o.jsx("div",{className:`${m?"":"think-collapse "}${b?"open":""}`,children:o.jsx("div",{className:"think-collapse-inner",children:h?o.jsx(h,{args:t,response:n,status:u,onBranchSelect:l}):o.jsxs("div",{className:"tool-detail",children:[t!=null&&o.jsxs("div",{className:"tool-section",children:[o.jsx("div",{className:"tool-section-label",children:"参数"}),o.jsx("pre",{className:"tool-args",children:JSON.stringify(t,null,2)})]}),E!=null&&o.jsxs("div",{className:"tool-section",children:[o.jsx("div",{className:"tool-section-label",children:"返回"}),o.jsx("pre",{className:"tool-args tool-result",children:E})]}),w.length>0&&o.jsxs("div",{className:"tool-section",children:[o.jsx("div",{className:"tool-section-label",children:"产物"}),o.jsx("div",{className:"studio-tool-artifacts",children:w.map(k=>o.jsxs("a",{href:k.contentUrl,download:k.name,children:["下载 ",k.name]},`${k.contentUrl}:${k.name}`))})]})]})})})]})}function rft({block:e,onDownload:t,onPreview:n}){const[r,i]=p.useState(""),[s,a]=p.useState(""),[l,c]=p.useState(null);p.useEffect(()=>()=>{l&&URL.revokeObjectURL(l.url)},[l]);const u=()=>c(null),d=async(m,g)=>{if(t){i(`download:${m}`),a("");try{await t(m,g)}catch(b){a(b instanceof Error?b.message:String(b))}finally{i("")}}},f=async(m,g,b)=>{if(n){i(`preview:${b}`),a("");try{const y=await n(m,g);c({name:b,url:y})}catch(y){a(y instanceof Error?y.message:String(y))}finally{i("")}}},h=e.files.filter(m=>!m.filename.endsWith(".preview.webp"));return o.jsxs("div",{className:"artifact-list",children:[h.map(m=>{const g=`${m.filename.replace(/\.pptx$/i,"")}.preview.webp`,b=e.files.find(y=>y.filename===g);return o.jsxs("div",{className:"artifact-card",children:[o.jsx("span",{className:"artifact-card__icon","aria-hidden":"true",children:o.jsx(t9,{})}),o.jsxs("span",{className:"artifact-card__copy",children:[o.jsx("span",{className:"artifact-card__name",children:m.filename}),o.jsx("span",{className:"artifact-card__hint",children:"PowerPoint 演示文稿"})]}),o.jsxs("span",{className:"artifact-card__actions",children:[b&&o.jsxs("button",{className:"artifact-card__action",type:"button",disabled:!n||r!=="",onClick:()=>void f(b.filename,b.version,m.filename),children:[r===`preview:${m.filename}`?o.jsx(or,{className:"spin"}):o.jsx(URe,{}),"预览"]}),o.jsxs("button",{className:"artifact-card__action artifact-card__action--primary",type:"button",disabled:!t||r!=="",onClick:()=>void d(m.filename,m.version),children:[r===`download:${m.filename}`?o.jsx(or,{className:"spin"}):o.jsx(NN,{}),"下载"]})]})]},`${m.filename}:${m.version}`)}),s&&o.jsx("div",{className:"artifact-card__error",children:s}),l&&o.jsxs("div",{className:"artifact-preview",role:"dialog","aria-modal":"true","aria-label":`${l.name} 预览`,children:[o.jsx("button",{className:"artifact-preview__backdrop",type:"button","aria-label":"关闭预览",onClick:u}),o.jsxs("div",{className:"artifact-preview__panel",children:[o.jsxs("div",{className:"artifact-preview__header",children:[o.jsx("span",{children:l.name}),o.jsx("button",{type:"button","aria-label":"关闭预览",onClick:u,children:o.jsx(ba,{})})]}),o.jsx("div",{className:"artifact-preview__canvas",children:o.jsx("img",{src:l.url,alt:`${l.name} 幻灯片预览`})})]})]})]})}function ift({block:e,onAuth:t}){const[n,r]=p.useState(e.done?"done":"idle"),[i,s]=p.useState(""),a=e.label||"MCP 工具集",l=(()=>{try{return e.authUri?new URL(e.authUri).host:""}catch{return""}})(),c=async()=>{if(t){s(""),r("authorizing");try{await t(e),r("done")}catch(d){s(d instanceof Error?d.message:String(d)),r("idle")}}};return e.done||n==="done"?o.jsxs(ui.div,{className:"auth-card-collapsed",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},children:[o.jsx(xH,{className:"auth-card-icon auth-card-icon--done"}),o.jsxs("span",{children:["已授权 · ",a]})]}):o.jsxs(ui.div,{className:"auth-card",initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[o.jsxs("div",{className:"auth-card-head",children:[o.jsx(xH,{className:"auth-card-icon"}),o.jsxs("span",{className:"auth-card-title",children:[a," 需要授权"]})]}),o.jsxs("p",{className:"auth-card-desc",children:["工具集 ",o.jsx("code",{className:"auth-card-code",children:a})," 使用 OAuth 保护, 需登录授权后方可调用。",l&&o.jsxs(o.Fragment,{children:[" ","将跳转至 ",o.jsx("code",{className:"auth-card-code",children:l})," 完成登录,"]}),"授权完成后对话自动继续。"]}),o.jsx("button",{className:"auth-card-btn",onClick:c,disabled:n==="authorizing"||!e.authUri,children:n==="authorizing"?o.jsxs(o.Fragment,{children:[o.jsx(or,{className:"cw-i spin"})," 等待授权…"]}):o.jsx(o.Fragment,{children:"去授权"})}),!e.authUri&&o.jsx("div",{className:"auth-card-err",children:"未在事件中找到授权地址。"}),i&&o.jsx("div",{className:"auth-card-err",children:i})]})}function Uj({blocks:e,appName:t="",streaming:n=!1,onStreamFrame:r,onStreamComplete:i,onAction:s,onAuth:a,onArtifactDownload:l,onArtifactPreview:c,onResolveDelivery:u,onResolveDeliveryComparison:d,onDownloadDelivery:f,onDeployDelivery:h,onBranchSelect:m}){const g=e.reduce((b,y,O)=>y.kind==="text"?O:b,-1);return o.jsx(o.Fragment,{children:e.map((b,y)=>{switch(b.kind){case"progress":return o.jsx(Ydt,{text:b.text},"build-progress");case"thinking":{const O=e.slice(y+1).some(v=>v.kind==="text"&&!!v.text.trim());return o.jsx(R0e,{text:b.text,done:b.done,answerStarted:O,streaming:n,onStreamFrame:r},y)}case"text":{const O=b.text.replace(/^\s+/,"");return O?o.jsx(Kdt,{text:O,streaming:n,onStreamFrame:r,onStreamComplete:y===g?i:void 0},y):null}case"plan":return o.jsx(eft,{title:b.title,summary:b.summary,items:b.items,done:b.done},y);case"attachment":return o.jsx($j,{appName:t,items:b.files},y);case"artifact":return o.jsx(rft,{block:b,onDownload:l,onPreview:c},y);case"delivery":return o.jsx(Zdt,{value:b.value,onResolve:u,onResolveComparison:d,onDownload:f,onDeploy:h},y);case"invocation":return o.jsx(Lj,{value:b.value},y);case"tool":{if(b.name===N0e&&b.done)return null;const O=b.name==="create_agents"&&e.slice(y+1).some(v=>v.kind==="tool"&&v.name==="create_agents");return o.jsx(nft,{name:b.name,args:b.args,response:b.response,done:b.done,status:b.status,defaultOpen:b.defaultOpen,retrying:b.name==="create_agents"&&(n||O),onBranchSelect:m},y)}case"agent-transfer":return null;case"auth":return o.jsx(ift,{block:b,onAuth:a},y);case"a2ui":return Hge(b.messages).filter(O=>O.components[O.rootId]).map(O=>o.jsx(ui.div,{initial:{opacity:0,y:8,scale:.985},animate:{opacity:1,y:0,scale:1},transition:{type:"spring",stiffness:380,damping:30},children:o.jsx(Nct,{surface:O,onAction:s})},`${y}-${O.surfaceId}`));default:return null}})})}const sft=()=>{};function aft(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 oft({activities:e}){const t=p.useMemo(()=>e.filter(n=>n.kind!=="status").map(aft),[e]);return t.length===0?null:o.jsx("div",{className:"skill-conversation","aria-label":"Skill 生成对话","aria-live":"polite",children:o.jsx(Uj,{blocks:t,onAction:sft})})}function GW(){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m7 9 5 5 5-5",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})})}function dT({label:e,value:t,options:n,onChange:r,disabled:i=!1,allowCustom:s=!1,required:a=!1,placeholder:l="请选择",error:c}){const u=p.useId(),d=p.useId(),f=p.useId(),h=p.useRef(null),m=p.useRef(null),g=p.useRef(null),b=p.useRef(null),y=p.useRef([]),O=n.findIndex(M=>M.value===t),v=t.trim().toLocaleLowerCase(),x=s&&v?n.filter(M=>M.value.toLocaleLowerCase().includes(v)||M.label.toLocaleLowerCase().includes(v)):n,[w,S]=p.useState(!1),[E,k]=p.useState(Math.max(0,O)),_=O>=0?n[O]:void 0,T=i||!s&&n.length===0,C=(M=!1)=>{S(!1),M&&window.requestAnimationFrame(()=>{var I,$;return s?(I=g.current)==null?void 0:I.focus():($=m.current)==null?void 0:$.focus()})},A=M=>{T||x.length!==0&&(k(Math.min(Math.max(M,0),x.length-1)),S(!0))};p.useEffect(()=>{if(!w)return;const M=b.current,I=s?void 0:window.requestAnimationFrame(()=>{var Q;(Q=y.current[E])==null||Q.focus()}),$=Q=>{if(!M)return;const F=M.scrollTop<=0,L=M.scrollTop+M.clientHeight>=M.scrollHeight-1;(M.scrollHeight<=M.clientHeight||Q.deltaY<0&&F||Q.deltaY>0&&L)&&Q.preventDefault(),Q.stopPropagation()},N=Q=>{var F;Q.target instanceof Node&&!((F=h.current)!=null&&F.contains(Q.target))&&C()},D=Q=>{Q.key==="Escape"&&C(!0)};return M==null||M.addEventListener("wheel",$,{passive:!1}),window.addEventListener("pointerdown",N),window.addEventListener("keydown",D),()=>{I!==void 0&&window.cancelAnimationFrame(I),M==null||M.removeEventListener("wheel",$),window.removeEventListener("pointerdown",N),window.removeEventListener("keydown",D)}},[E,s,w]);const j=M=>{var $;if(x.length===0)return;const I=(M+x.length)%x.length;k(I),($=y.current[I])==null||$.focus()};return o.jsxs("div",{ref:h,className:`skill-config-select${w?" is-open":""}`,onBlur:M=>{var I;(!M.relatedTarget||!((I=h.current)!=null&&I.contains(M.relatedTarget)))&&C()},children:[o.jsxs("span",{id:d,className:"skill-config-select__label",children:[e,a?o.jsx("span",{className:"skill-required-mark","aria-hidden":"true",children:"*"}):null]}),s?o.jsxs("div",{className:`skill-config-select__trigger is-editable${i?" is-disabled":""}`,"aria-expanded":w,children:[o.jsx("input",{ref:g,value:t,disabled:i,role:"combobox","aria-autocomplete":"list","aria-expanded":w,"aria-controls":w?u:void 0,"aria-labelledby":d,"aria-required":a,"aria-invalid":!!c,"aria-describedby":c?f:void 0,placeholder:l,onChange:M=>{r(M.target.value),k(0),n.length>0&&S(!0)},onClick:()=>{!w&&x.length>0&&A(0)},onKeyDown:M=>{var I,$;if(!(M.nativeEvent.isComposing||M.keyCode===229))if(M.key==="ArrowDown")M.preventDefault(),w?(I=y.current[E])==null||I.focus():A(0);else if(M.key==="ArrowUp")M.preventDefault(),w?($=y.current[x.length-1])==null||$.focus():A(x.length-1);else if(M.key==="Enter"&&w){M.preventDefault();const N=x[E];N&&r(N.value),C()}else M.key==="Escape"&&(M.preventDefault(),C())}}),o.jsx("button",{type:"button",className:"skill-config-select__toggle",disabled:i||n.length===0,"aria-label":w?"收起模型选项":"展开模型选项",onClick:()=>{w?C():A(0)},children:o.jsx(GW,{})})]}):o.jsxs("button",{ref:m,type:"button",className:"skill-config-select__trigger",disabled:T,"aria-haspopup":"listbox","aria-expanded":w,"aria-controls":w?u:void 0,"aria-labelledby":d,"aria-required":a,onClick:()=>{w?C():A(O>=0?O:0)},onKeyDown:M=>{M.key==="ArrowDown"?(M.preventDefault(),A(O>=0?O:0)):M.key==="ArrowUp"&&(M.preventDefault(),A(O>=0?O:n.length-1))},children:[o.jsx("span",{className:_?void 0:"is-placeholder",title:_==null?void 0:_.label,children:(_==null?void 0:_.label)||(n.length===0?"暂无可用选项":l)}),o.jsx(GW,{})]}),w?o.jsxs("div",{ref:b,id:u,className:"skill-config-select__menu",role:"listbox","aria-labelledby":d,children:[x.length===0?o.jsx("div",{className:"skill-config-select__empty",role:"status",children:"没有匹配项,可直接使用当前模型 ID"}):null,x.map((M,I)=>{const $=M.value===t;return o.jsx("button",{ref:N=>{y.current[I]=N},type:"button",role:"option","aria-selected":$,tabIndex:I===E?0:-1,className:`skill-config-select__option${$?" is-selected":""}`,title:M.label,onFocus:()=>k(I),onClick:()=>{r(M.value),C(!0)},onKeyDown:N=>{N.key==="Enter"||N.key===" "?(N.preventDefault(),r(M.value),C(!0)):N.key==="ArrowDown"?(N.preventDefault(),j(I+1)):N.key==="ArrowUp"?(N.preventDefault(),j(I-1)):N.key==="Home"?(N.preventDefault(),j(0)):N.key==="End"&&(N.preventDefault(),j(n.length-1))},children:M.label},M.value)})]}):null,c?o.jsx("span",{id:f,className:"skill-config-select__error",role:"alert",children:c}):null]})}function la(e,t){return e instanceof Error?e:typeof e=="string"&&e.trim()?new Error(e.trim()):new Error(t)}function Fo({error:e}){var i,s,a,l,c;const t=e,n=(s=(i=t.originalError)==null?void 0:i.message)==null?void 0:s.trim(),r=[typeof t.status=="number"?`HTTP ${t.status}${t.statusText?` ${t.statusText}`:""}`:"",t.code?`错误码:${t.code}`:"",(a=t.originalError)!=null&&a.type?`错误类型:${t.originalError.type}`:"",(l=t.originalError)!=null&&l.repr&&t.originalError.repr!==n?`异常表示:${t.originalError.repr}`:"",(c=t.rawResponse)!=null&&c.trim()?`服务端原始响应: ${t.rawResponse.trim()}`:""].filter(Boolean);return o.jsxs("div",{className:"skill-error-details",children:[o.jsx("div",{className:"skill-error-details__summary",children:e.message}),n?o.jsxs("div",{className:"skill-error-details__original",children:["原始错误:",n]}):null,r.length>0?o.jsxs("details",{children:[o.jsx("summary",{children:"详细信息"}),o.jsx("pre",{children:r.join(` -`)})]}):null]})}const FB=Symbol.for("yaml.alias"),EL=Symbol.for("yaml.document"),Rp=Symbol.for("yaml.map"),D0e=Symbol.for("yaml.pair"),Od=Symbol.for("yaml.scalar"),fO=Symbol.for("yaml.seq"),$c=Symbol.for("yaml.node.type"),hO=e=>!!e&&typeof e=="object"&&e[$c]===FB,NE=e=>!!e&&typeof e=="object"&&e[$c]===EL,jE=e=>!!e&&typeof e=="object"&&e[$c]===Rp,Ns=e=>!!e&&typeof e=="object"&&e[$c]===D0e,Ai=e=>!!e&&typeof e=="object"&&e[$c]===Od,RE=e=>!!e&&typeof e=="object"&&e[$c]===fO;function Ts(e){if(e&&typeof e=="object")switch(e[$c]){case Rp:case fO:return!0}return!1}function As(e){if(e&&typeof e=="object")switch(e[$c]){case FB:case Rp:case Od:case fO:return!0}return!1}const P0e=e=>(Ai(e)||Ts(e))&&!!e.anchor,Hm=Symbol("break visit"),cft=Symbol("skip children"),Uv=Symbol("remove node");function pO(e,t){const n=uft(t);NE(e)?Wb(null,e.contents,n,Object.freeze([e]))===Uv&&(e.contents=null):Wb(null,e,n,Object.freeze([]))}pO.BREAK=Hm;pO.SKIP=cft;pO.REMOVE=Uv;function Wb(e,t,n,r){const i=dft(e,t,n,r);if(As(i)||Ns(i))return fft(e,r,i),Wb(e,i,n,r);if(typeof i!="symbol"){if(Ts(t)){r=Object.freeze(r.concat(t));for(let s=0;se.replace(/[!,[\]{}]/g,t=>hft[t]);class ho{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},ho.defaultYaml,t),this.tags=Object.assign({},ho.defaultTags,n)}clone(){const t=new ho(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new ho(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:ho.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},ho.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:ho.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},ho.defaultTags),this.atNextDocument=!1);const r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;const[s,a]=r;return this.tags[s]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;const[s]=r;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{const a=/^\d+\.\d+$/.test(s);return n(6,`Unsupported YAML version ${s}`,a),!1}}default:return n(0,`Unknown directive ${i}`,!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,i]=t.match(/^(.*!)([^!]*)$/s);i||n(`The ${t} tag has no suffix`);const s=this.tags[r];if(s)try{return s+decodeURIComponent(i)}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+pft(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 i;if(t&&r.length>0&&As(t.contents)){const s={};pO(t.contents,(a,l)=>{As(l)&&l.tag&&(s[l.tag]=!0)}),i=Object.keys(s)}else i=[];for(const[s,a]of r)s==="!!"&&a==="tag:yaml.org,2002:"||(!t||i.some(l=>l.startsWith(a)))&&n.push(`%TAG ${s} ${a}`);return n.join(` -`)}}ho.defaultYaml={explicit:!1,version:"1.2"};ho.defaultTags={"!!":"tag:yaml.org,2002:"};function M0e(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 L0e(e){const t=new Set;return pO(e,{Value(n,r){r.anchor&&t.add(r.anchor)}}),t}function $0e(e,t){for(let n=1;;++n){const r=`${e}${n}`;if(!t.has(r))return r}}function mft(e,t){const n=[],r=new Map;let i=null;return{onAnchor:s=>{n.push(s),i??(i=L0e(e));const a=$0e(t,i);return i.add(a),a},setAnchors:()=>{for(const s of n){const a=r.get(s);if(typeof a=="object"&&a.anchor&&(Ai(a.node)||Ts(a.node)))a.node.anchor=a.anchor;else{const l=new Error("Failed to resolve repeated object (this should not happen)");throw l.source=s,l}}},sourceObjects:r}}function Yb(e,t,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,s=r.length;iPc(r,String(i),n));if(e&&typeof e.toJSON=="function"){if(!n||!P0e(e))return e.toJSON(t,n);const r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=s=>{r.res=s,delete n.onCreate};const i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e=="bigint"&&!(n!=null&&n.keep)?Number(e):e}class zB{constructor(t){Object.defineProperty(this,$c,{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:i,reviver:s}={}){if(!NE(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},l=Pc(this,"",a);if(typeof i=="function")for(const{count:c,res:u}of a.anchors.values())i(u,c);return typeof s=="function"?Yb(s,{"":l},"",l):l}}let VB=class extends zB{constructor(t){super(FB),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=[],pO(t,{Node:(s,a)=>{(hO(a)||P0e(a))&&r.push(a)}}),n&&(n.aliasResolveCache=r));let i;for(const s of r){if(s===this)break;s.anchor===this.source&&(i=s)}return i}toJSON(t,n){if(!n)return{source:this.source};const{anchors:r,doc:i,maxAliasCount:s}=n,a=this.resolve(i,n);if(!a){const c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let l=r.get(a);if(l||(Pc(a,null,n),l=r.get(a)),(l==null?void 0:l.res)===void 0){const c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(s>=0&&(l.count+=1,l.aliasCount===0&&(l.aliasCount=uT(i,a,r)),l.count*l.aliasCount>s)){const c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return l.res}toString(t,n,r){const i=`*${this.source}`;if(t){if(M0e(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){const s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(t.implicitKey)return`${i} `}return i}};function uT(e,t,n){if(hO(t)){const r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(Ts(t)){let r=0;for(const i of t.items){const s=uT(e,i,n);s>r&&(r=s)}return r}else if(Ns(t)){const r=uT(e,t.key,n),i=uT(e,t.value,n);return Math.max(r,i)}return 1}const B0e=e=>!e||typeof e!="function"&&typeof e!="object";class Fn extends zB{constructor(t){super(Od),this.value=t}toJSON(t,n){return n!=null&&n.keep?this.value:Pc(this.value,t,n)}toString(){return String(this.value)}}Fn.BLOCK_FOLDED="BLOCK_FOLDED";Fn.BLOCK_LITERAL="BLOCK_LITERAL";Fn.PLAIN="PLAIN";Fn.QUOTE_DOUBLE="QUOTE_DOUBLE";Fn.QUOTE_SINGLE="QUOTE_SINGLE";const gft="tag:yaml.org,2002:";function bft(e,t,n){if(t){const r=n.filter(s=>s.tag===t),i=r.find(s=>!s.format)??r[0];if(!i)throw new Error(`Tag ${t} not found`);return i}return n.find(r=>{var i;return((i=r.identify)==null?void 0:i.call(r,e))&&!r.format})}function Zw(e,t,n){var f,h,m;if(NE(e)&&(e=e.contents),As(e))return e;if(Ns(e)){const g=(h=(f=n.schema[Rp]).createNode)==null?void 0:h.call(f,n.schema,null,n);return g.items.push(e),g}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());const{aliasDuplicateObjects:r,onAnchor:i,onTagObj:s,schema:a,sourceObjects:l}=n;let c;if(r&&e&&typeof e=="object"){if(c=l.get(e),c)return c.anchor??(c.anchor=i(e)),new VB(c.anchor);c={anchor:null,node:null},l.set(e,c)}t!=null&&t.startsWith("!!")&&(t=gft+t.slice(2));let u=bft(e,t,a.tags);if(!u){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const g=new Fn(e);return c&&(c.node=g),g}u=e instanceof Map?a[Rp]:Symbol.iterator in Object(e)?a[fO]:a[Rp]}s&&(s(u),delete n.onTagObj);const d=u!=null&&u.createNode?u.createNode(n.schema,e,n):typeof((m=u==null?void 0:u.nodeClass)==null?void 0:m.from)=="function"?u.nodeClass.from(n.schema,e,n):new Fn(e);return t?d.tag=t:u.default||(d.tag=u.tag),c&&(c.node=d),d}function lA(e,t,n){let r=n;for(let i=t.length-1;i>=0;--i){const s=t[i];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){const a=[];a[s]=r,r=a}else r=new Map([[s,r]])}return Zw(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 Yx=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done;class Q0e extends zB{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=>As(r)||Ns(r)?r.clone(t):r),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(Yx(t))this.add(n);else{const[r,...i]=t,s=this.get(r,!0);if(Ts(s))s.addIn(i,n);else if(s===void 0&&this.schema)this.set(r,lA(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(t){const[n,...r]=t;if(r.length===0)return this.delete(n);const i=this.get(n,!0);if(Ts(i))return i.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(t,n){const[r,...i]=t,s=this.get(r,!0);return i.length===0?!n&&Ai(s)?s.value:s:Ts(s)?s.getIn(i,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!Ns(n))return!1;const r=n.value;return r==null||t&&Ai(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 i=this.get(n,!0);return Ts(i)?i.hasIn(r):!1}setIn(t,n){const[r,...i]=t;if(i.length===0)this.set(r,n);else{const s=this.get(r,!0);if(Ts(s))s.setIn(i,n);else if(s===void 0&&this.schema)this.set(r,lA(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}}const yft=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Tf(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const og=(e,t,n)=>e.endsWith(` +`)})]}):null]})}const FB=Symbol.for("yaml.alias"),EL=Symbol.for("yaml.document"),Rp=Symbol.for("yaml.map"),D0e=Symbol.for("yaml.pair"),vd=Symbol.for("yaml.scalar"),fO=Symbol.for("yaml.seq"),Bc=Symbol.for("yaml.node.type"),hO=e=>!!e&&typeof e=="object"&&e[Bc]===FB,RE=e=>!!e&&typeof e=="object"&&e[Bc]===EL,IE=e=>!!e&&typeof e=="object"&&e[Bc]===Rp,Ns=e=>!!e&&typeof e=="object"&&e[Bc]===D0e,Ri=e=>!!e&&typeof e=="object"&&e[Bc]===vd,DE=e=>!!e&&typeof e=="object"&&e[Bc]===fO;function Ts(e){if(e&&typeof e=="object")switch(e[Bc]){case Rp:case fO:return!0}return!1}function As(e){if(e&&typeof e=="object")switch(e[Bc]){case FB:case Rp:case vd:case fO:return!0}return!1}const P0e=e=>(Ri(e)||Ts(e))&&!!e.anchor,Hm=Symbol("break visit"),lft=Symbol("skip children"),zv=Symbol("remove node");function pO(e,t){const n=cft(t);RE(e)?Wb(null,e.contents,n,Object.freeze([e]))===zv&&(e.contents=null):Wb(null,e,n,Object.freeze([]))}pO.BREAK=Hm;pO.SKIP=lft;pO.REMOVE=zv;function Wb(e,t,n,r){const i=uft(e,t,n,r);if(As(i)||Ns(i))return dft(e,r,i),Wb(e,i,n,r);if(typeof i!="symbol"){if(Ts(t)){r=Object.freeze(r.concat(t));for(let s=0;se.replace(/[!,[\]{}]/g,t=>fft[t]);class go{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},go.defaultYaml,t),this.tags=Object.assign({},go.defaultTags,n)}clone(){const t=new go(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new go(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:go.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},go.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:go.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},go.defaultTags),this.atNextDocument=!1);const r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;const[s,a]=r;return this.tags[s]=a,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;const[s]=r;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{const a=/^\d+\.\d+$/.test(s);return n(6,`Unsupported YAML version ${s}`,a),!1}}default:return n(0,`Unknown directive ${i}`,!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,i]=t.match(/^(.*!)([^!]*)$/s);i||n(`The ${t} tag has no suffix`);const s=this.tags[r];if(s)try{return s+decodeURIComponent(i)}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+hft(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 i;if(t&&r.length>0&&As(t.contents)){const s={};pO(t.contents,(a,l)=>{As(l)&&l.tag&&(s[l.tag]=!0)}),i=Object.keys(s)}else i=[];for(const[s,a]of r)s==="!!"&&a==="tag:yaml.org,2002:"||(!t||i.some(l=>l.startsWith(a)))&&n.push(`%TAG ${s} ${a}`);return n.join(` +`)}}go.defaultYaml={explicit:!1,version:"1.2"};go.defaultTags={"!!":"tag:yaml.org,2002:"};function M0e(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 L0e(e){const t=new Set;return pO(e,{Value(n,r){r.anchor&&t.add(r.anchor)}}),t}function $0e(e,t){for(let n=1;;++n){const r=`${e}${n}`;if(!t.has(r))return r}}function pft(e,t){const n=[],r=new Map;let i=null;return{onAnchor:s=>{n.push(s),i??(i=L0e(e));const a=$0e(t,i);return i.add(a),a},setAnchors:()=>{for(const s of n){const a=r.get(s);if(typeof a=="object"&&a.anchor&&(Ri(a.node)||Ts(a.node)))a.node.anchor=a.anchor;else{const l=new Error("Failed to resolve repeated object (this should not happen)");throw l.source=s,l}}},sourceObjects:r}}function Yb(e,t,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,s=r.length;iMc(r,String(i),n));if(e&&typeof e.toJSON=="function"){if(!n||!P0e(e))return e.toJSON(t,n);const r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=s=>{r.res=s,delete n.onCreate};const i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e=="bigint"&&!(n!=null&&n.keep)?Number(e):e}class zB{constructor(t){Object.defineProperty(this,Bc,{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:i,reviver:s}={}){if(!RE(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},l=Mc(this,"",a);if(typeof i=="function")for(const{count:c,res:u}of a.anchors.values())i(u,c);return typeof s=="function"?Yb(s,{"":l},"",l):l}}let VB=class extends zB{constructor(t){super(FB),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=[],pO(t,{Node:(s,a)=>{(hO(a)||P0e(a))&&r.push(a)}}),n&&(n.aliasResolveCache=r));let i;for(const s of r){if(s===this)break;s.anchor===this.source&&(i=s)}return i}toJSON(t,n){if(!n)return{source:this.source};const{anchors:r,doc:i,maxAliasCount:s}=n,a=this.resolve(i,n);if(!a){const c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let l=r.get(a);if(l||(Mc(a,null,n),l=r.get(a)),(l==null?void 0:l.res)===void 0){const c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(s>=0&&(l.count+=1,l.aliasCount===0&&(l.aliasCount=fT(i,a,r)),l.count*l.aliasCount>s)){const c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return l.res}toString(t,n,r){const i=`*${this.source}`;if(t){if(M0e(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){const s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(t.implicitKey)return`${i} `}return i}};function fT(e,t,n){if(hO(t)){const r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(Ts(t)){let r=0;for(const i of t.items){const s=fT(e,i,n);s>r&&(r=s)}return r}else if(Ns(t)){const r=fT(e,t.key,n),i=fT(e,t.value,n);return Math.max(r,i)}return 1}const B0e=e=>!e||typeof e!="function"&&typeof e!="object";class Fn extends zB{constructor(t){super(vd),this.value=t}toJSON(t,n){return n!=null&&n.keep?this.value:Mc(this.value,t,n)}toString(){return String(this.value)}}Fn.BLOCK_FOLDED="BLOCK_FOLDED";Fn.BLOCK_LITERAL="BLOCK_LITERAL";Fn.PLAIN="PLAIN";Fn.QUOTE_DOUBLE="QUOTE_DOUBLE";Fn.QUOTE_SINGLE="QUOTE_SINGLE";const mft="tag:yaml.org,2002:";function gft(e,t,n){if(t){const r=n.filter(s=>s.tag===t),i=r.find(s=>!s.format)??r[0];if(!i)throw new Error(`Tag ${t} not found`);return i}return n.find(r=>{var i;return((i=r.identify)==null?void 0:i.call(r,e))&&!r.format})}function Jw(e,t,n){var f,h,m;if(RE(e)&&(e=e.contents),As(e))return e;if(Ns(e)){const g=(h=(f=n.schema[Rp]).createNode)==null?void 0:h.call(f,n.schema,null,n);return g.items.push(e),g}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());const{aliasDuplicateObjects:r,onAnchor:i,onTagObj:s,schema:a,sourceObjects:l}=n;let c;if(r&&e&&typeof e=="object"){if(c=l.get(e),c)return c.anchor??(c.anchor=i(e)),new VB(c.anchor);c={anchor:null,node:null},l.set(e,c)}t!=null&&t.startsWith("!!")&&(t=mft+t.slice(2));let u=gft(e,t,a.tags);if(!u){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const g=new Fn(e);return c&&(c.node=g),g}u=e instanceof Map?a[Rp]:Symbol.iterator in Object(e)?a[fO]:a[Rp]}s&&(s(u),delete n.onTagObj);const d=u!=null&&u.createNode?u.createNode(n.schema,e,n):typeof((m=u==null?void 0:u.nodeClass)==null?void 0:m.from)=="function"?u.nodeClass.from(n.schema,e,n):new Fn(e);return t?d.tag=t:u.default||(d.tag=u.tag),c&&(c.node=d),d}function lA(e,t,n){let r=n;for(let i=t.length-1;i>=0;--i){const s=t[i];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){const a=[];a[s]=r,r=a}else r=new Map([[s,r]])}return Jw(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 Yx=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done;class Q0e extends zB{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=>As(r)||Ns(r)?r.clone(t):r),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(Yx(t))this.add(n);else{const[r,...i]=t,s=this.get(r,!0);if(Ts(s))s.addIn(i,n);else if(s===void 0&&this.schema)this.set(r,lA(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(t){const[n,...r]=t;if(r.length===0)return this.delete(n);const i=this.get(n,!0);if(Ts(i))return i.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(t,n){const[r,...i]=t,s=this.get(r,!0);return i.length===0?!n&&Ri(s)?s.value:s:Ts(s)?s.getIn(i,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!Ns(n))return!1;const r=n.value;return r==null||t&&Ri(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 i=this.get(n,!0);return Ts(i)?i.hasIn(r):!1}setIn(t,n){const[r,...i]=t;if(i.length===0)this.set(r,n);else{const s=this.get(r,!0);if(Ts(s))s.setIn(i,n);else if(s===void 0&&this.schema)this.set(r,lA(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}}const bft=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Tf(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const og=(e,t,n)=>e.endsWith(` `)?Tf(n,t):n.includes(` `)?` -`+Tf(n,t):(e.endsWith(" ")?"":" ")+n,U0e="flow",kL="block",dT="quoted";function Fj(e,t,n="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:s=20,onFold:a,onOverflow:l}={}){if(!i||i<0)return e;ii-Math.max(2,s)?u.push(0):f=i-r);let h,m,g=!1,b=-1,y=-1,O=-1;n===kL&&(b=WW(e,b,t.length),b!==-1&&(f=b+c));for(let x;x=e[b+=1];){if(n===dT&&x==="\\"){switch(y=b,e[b+1]){case"x":b+=3;break;case"u":b+=5;break;case"U":b+=9;break;default:b+=1}O=b}if(x===` +`+Tf(n,t):(e.endsWith(" ")?"":" ")+n,U0e="flow",kL="block",hT="quoted";function Fj(e,t,n="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:s=20,onFold:a,onOverflow:l}={}){if(!i||i<0)return e;ii-Math.max(2,s)?u.push(0):f=i-r);let h,m,g=!1,b=-1,y=-1,O=-1;n===kL&&(b=WW(e,b,t.length),b!==-1&&(f=b+c));for(let x;x=e[b+=1];){if(n===hT&&x==="\\"){switch(y=b,e[b+1]){case"x":b+=3;break;case"u":b+=5;break;case"U":b+=9;break;default:b+=1}O=b}if(x===` `)n===kL&&(b=WW(e,b,t.length)),f=b+t.length+c,h=void 0;else{if(x===" "&&m&&m!==" "&&m!==` `&&m!==" "){const w=e[b+1];w&&w!==" "&&w!==` -`&&w!==" "&&(h=b)}if(b>=f)if(h)u.push(h),f=h+c,h=void 0;else if(n===dT){for(;m===" "||m===" ";)m=x,x=e[b+=1],g=!0;const w=b>O+1?b-2:y-1;if(d[w])return e;u.push(w),d[w]=!0,f=w+c,h=void 0}else g=!0}m=x}if(g&&l&&l(),u.length===0)return e;a&&a();let v=e.slice(0,u[0]);for(let x=0;x=f)if(h)u.push(h),f=h+c,h=void 0;else if(n===hT){for(;m===" "||m===" ";)m=x,x=e[b+=1],g=!0;const w=b>O+1?b-2:y-1;if(d[w])return e;u.push(w),d[w]=!0,f=w+c,h=void 0}else g=!0}m=x}if(g&&l&&l(),u.length===0)return e;a&&a();let v=e.slice(0,u[0]);for(let x=0;x({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Vj=e=>/^(%|---|\.\.\.)/m.test(e);function Oft(e,t,n){if(!t||t<0)return!1;const r=t-n,i=e.length;if(i<=r)return!1;for(let s=0,a=0;sr)return!0;if(a=s+1,i-a<=r)return!1}return!0}function Fv(e,t){const n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;const{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,s=t.indent||(Vj(e)?" ":"");let a="",l=0;for(let c=0,u=n[c];u;u=n[++c])if(u===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(a+=n.slice(l,c)+"\\ ",c+=1,l=c,u="\\"),u==="\\")switch(n[c+1]){case"u":{a+=n.slice(l,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,l=c+1}break;case"n":if(r||n[c+2]==='"'||n.length({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Vj=e=>/^(%|---|\.\.\.)/m.test(e);function yft(e,t,n){if(!t||t<0)return!1;const r=t-n,i=e.length;if(i<=r)return!1;for(let s=0,a=0;sr)return!0;if(a=s+1,i-a<=r)return!1}return!0}function Vv(e,t){const n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;const{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,s=t.indent||(Vj(e)?" ":"");let a="",l=0;for(let c=0,u=n[c];u;u=n[++c])if(u===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(a+=n.slice(l,c)+"\\ ",c+=1,l=c,u="\\"),u==="\\")switch(n[c+1]){case"u":{a+=n.slice(l,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,l=c+1}break;case"n":if(r||n[c+2]==='"'||n.length `;let f,h;for(h=n.length;h>0;--h){const S=n[h-1];if(S!==` `&&S!==" "&&S!==" ")break}let m=n.substring(h);const g=m.indexOf(` @@ -585,47 +585,47 @@ ${n}`)+"'";return t.implicitKey?r:Fj(r,n,U0e,zj(t,!1))}function Zb(e,t){const{si `)O=y;else break}let v=n.substring(0,O{E=!0});const _=Fj(`${v}${S}${m}`,u,kL,k);if(!E)return`>${w} ${u}${_}`}return n=n.replace(/\n+/g,`$&${u}`),`|${w} -${u}${v}${n}${m}`}function xft(e,t,n,r){const{type:i,value:s}=e,{actualString:a,implicitKey:l,indent:c,indentStep:u,inFlow:d}=t;if(l&&s.includes(` +${u}${v}${n}${m}`}function Oft(e,t,n,r){const{type:i,value:s}=e,{actualString:a,implicitKey:l,indent:c,indentStep:u,inFlow:d}=t;if(l&&s.includes(` `)||d&&/[[\]{},]/.test(s))return Zb(s,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return l||d||!s.includes(` -`)?Zb(s,t):fT(e,t,n,r);if(!l&&!d&&i!==Fn.PLAIN&&s.includes(` -`))return fT(e,t,n,r);if(Vj(s)){if(c==="")return t.forceBlockIndent=!0,fT(e,t,n,r);if(l&&c===u)return Zb(s,t)}const f=s.replace(/\n+/g,`$& -${c}`);if(a){const h=b=>{var y;return b.default&&b.tag!=="tag:yaml.org,2002:str"&&((y=b.test)==null?void 0:y.test(f))},{compat:m,tags:g}=t.doc.schema;if(g.some(h)||m!=null&&m.some(h))return Zb(s,t)}return l?f:Fj(f,c,U0e,zj(t,!1))}function HB(e,t,n,r){const{implicitKey:i,inFlow:s}=t,a=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)});let{type:l}=e;l!==Fn.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(l=Fn.QUOTE_DOUBLE);const c=d=>{switch(d){case Fn.BLOCK_FOLDED:case Fn.BLOCK_LITERAL:return i||s?Zb(a.value,t):fT(a,t,n,r);case Fn.QUOTE_DOUBLE:return Fv(a.value,t);case Fn.QUOTE_SINGLE:return _L(a.value,t);case Fn.PLAIN:return xft(a,t,n,r);default:return null}};let u=c(l);if(u===null){const{defaultKeyType:d,defaultStringType:f}=t.options,h=i&&d||f;if(u=c(h),u===null)throw new Error(`Unsupported default string type ${h}`)}return u}function F0e(e,t){const n=Object.assign({blockQuote:!0,commentString:yft,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 vft(e,t){var i;if(t.tag){const s=e.filter(a=>a.tag===t.tag);if(s.length>0)return s.find(a=>a.format===t.format)??s[0]}let n,r;if(Ai(t)){r=t.value;let s=e.filter(a=>{var l;return(l=a.identify)==null?void 0:l.call(a,r)});if(s.length>1){const a=s.filter(l=>l.test);a.length>0&&(s=a)}n=s.find(a=>a.format===t.format)??s.find(a=>!a.format)}else r=t,n=e.find(s=>s.nodeClass&&r instanceof s.nodeClass);if(!n){const s=((i=r==null?void 0:r.constructor)==null?void 0:i.name)??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${s} value`)}return n}function wft(e,t,{anchors:n,doc:r}){if(!r.directives)return"";const i=[],s=(Ai(e)||Ts(e))&&e.anchor;s&&M0e(s)&&(n.add(s),i.push(`&${s}`));const a=e.tag??(t.default?null:t.tag);return a&&i.push(r.directives.tagString(a)),i.join(" ")}function g1(e,t,n,r){var c;if(Ns(e))return e.toString(t,n,r);if(hO(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 i;const s=As(e)?e:t.doc.createNode(e,{onTagObj:u=>i=u});i??(i=vft(t.doc.schema.tags,s));const a=wft(s,i,t);a.length>0&&(t.indentAtStart=(t.indentAtStart??0)+a.length+1);const l=typeof i.stringify=="function"?i.stringify(s,t,n,r):Ai(s)?HB(s,t,n,r):s.toString(t,n,r);return a?Ai(s)||l[0]==="{"||l[0]==="["?`${a} ${l}`:`${a} -${t.indent}${l}`:l}function Sft({key:e,value:t},n,r,i){const{allNullValues:s,doc:a,indent:l,indentStep:c,options:{commentString:u,indentSeq:d,simpleKeys:f}}=n;let h=As(e)&&e.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(Ts(e)||!As(e)&&typeof e=="object"){const k="With simple keys, collection cannot be used as a key value";throw new Error(k)}}let m=!f&&(!e||h&&t==null&&!n.inFlow||Ts(e)||(Ai(e)?e.type===Fn.BLOCK_FOLDED||e.type===Fn.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!m&&(f||!s),indent:l+c});let g=!1,b=!1,y=g1(e,n,()=>g=!0,()=>b=!0);if(!m&&!n.inFlow&&y.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");m=!0}if(n.inFlow){if(s||t==null)return g&&r&&r(),y===""?"?":m?`? ${y}`:y}else if(s&&!f||t==null&&m)return y=`? ${y}`,h&&!g?y+=og(y,n.indent,u(h)):b&&i&&i(),y;g&&(h=null),m?(h&&(y+=og(y,n.indent,u(h))),y=`? ${y} -${l}:`):(y=`${y}:`,h&&(y+=og(y,n.indent,u(h))));let O,v,x;As(t)?(O=!!t.spaceBefore,v=t.commentBefore,x=t.comment):(O=!1,v=null,x=null,t&&typeof t=="object"&&(t=a.createNode(t))),n.implicitKey=!1,!m&&!h&&Ai(t)&&(n.indentAtStart=y.length+1),b=!1,!d&&c.length>=2&&!n.inFlow&&!m&&RE(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let w=!1;const S=g1(t,n,()=>w=!0,()=>b=!0);let E=" ";if(h||O||v){if(E=O?` +`)?Zb(s,t):pT(e,t,n,r);if(!l&&!d&&i!==Fn.PLAIN&&s.includes(` +`))return pT(e,t,n,r);if(Vj(s)){if(c==="")return t.forceBlockIndent=!0,pT(e,t,n,r);if(l&&c===u)return Zb(s,t)}const f=s.replace(/\n+/g,`$& +${c}`);if(a){const h=b=>{var y;return b.default&&b.tag!=="tag:yaml.org,2002:str"&&((y=b.test)==null?void 0:y.test(f))},{compat:m,tags:g}=t.doc.schema;if(g.some(h)||m!=null&&m.some(h))return Zb(s,t)}return l?f:Fj(f,c,U0e,zj(t,!1))}function HB(e,t,n,r){const{implicitKey:i,inFlow:s}=t,a=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)});let{type:l}=e;l!==Fn.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(l=Fn.QUOTE_DOUBLE);const c=d=>{switch(d){case Fn.BLOCK_FOLDED:case Fn.BLOCK_LITERAL:return i||s?Zb(a.value,t):pT(a,t,n,r);case Fn.QUOTE_DOUBLE:return Vv(a.value,t);case Fn.QUOTE_SINGLE:return _L(a.value,t);case Fn.PLAIN:return Oft(a,t,n,r);default:return null}};let u=c(l);if(u===null){const{defaultKeyType:d,defaultStringType:f}=t.options,h=i&&d||f;if(u=c(h),u===null)throw new Error(`Unsupported default string type ${h}`)}return u}function F0e(e,t){const n=Object.assign({blockQuote:!0,commentString:bft,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 xft(e,t){var i;if(t.tag){const s=e.filter(a=>a.tag===t.tag);if(s.length>0)return s.find(a=>a.format===t.format)??s[0]}let n,r;if(Ri(t)){r=t.value;let s=e.filter(a=>{var l;return(l=a.identify)==null?void 0:l.call(a,r)});if(s.length>1){const a=s.filter(l=>l.test);a.length>0&&(s=a)}n=s.find(a=>a.format===t.format)??s.find(a=>!a.format)}else r=t,n=e.find(s=>s.nodeClass&&r instanceof s.nodeClass);if(!n){const s=((i=r==null?void 0:r.constructor)==null?void 0:i.name)??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${s} value`)}return n}function vft(e,t,{anchors:n,doc:r}){if(!r.directives)return"";const i=[],s=(Ri(e)||Ts(e))&&e.anchor;s&&M0e(s)&&(n.add(s),i.push(`&${s}`));const a=e.tag??(t.default?null:t.tag);return a&&i.push(r.directives.tagString(a)),i.join(" ")}function g1(e,t,n,r){var c;if(Ns(e))return e.toString(t,n,r);if(hO(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 i;const s=As(e)?e:t.doc.createNode(e,{onTagObj:u=>i=u});i??(i=xft(t.doc.schema.tags,s));const a=vft(s,i,t);a.length>0&&(t.indentAtStart=(t.indentAtStart??0)+a.length+1);const l=typeof i.stringify=="function"?i.stringify(s,t,n,r):Ri(s)?HB(s,t,n,r):s.toString(t,n,r);return a?Ri(s)||l[0]==="{"||l[0]==="["?`${a} ${l}`:`${a} +${t.indent}${l}`:l}function wft({key:e,value:t},n,r,i){const{allNullValues:s,doc:a,indent:l,indentStep:c,options:{commentString:u,indentSeq:d,simpleKeys:f}}=n;let h=As(e)&&e.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(Ts(e)||!As(e)&&typeof e=="object"){const k="With simple keys, collection cannot be used as a key value";throw new Error(k)}}let m=!f&&(!e||h&&t==null&&!n.inFlow||Ts(e)||(Ri(e)?e.type===Fn.BLOCK_FOLDED||e.type===Fn.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!m&&(f||!s),indent:l+c});let g=!1,b=!1,y=g1(e,n,()=>g=!0,()=>b=!0);if(!m&&!n.inFlow&&y.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");m=!0}if(n.inFlow){if(s||t==null)return g&&r&&r(),y===""?"?":m?`? ${y}`:y}else if(s&&!f||t==null&&m)return y=`? ${y}`,h&&!g?y+=og(y,n.indent,u(h)):b&&i&&i(),y;g&&(h=null),m?(h&&(y+=og(y,n.indent,u(h))),y=`? ${y} +${l}:`):(y=`${y}:`,h&&(y+=og(y,n.indent,u(h))));let O,v,x;As(t)?(O=!!t.spaceBefore,v=t.commentBefore,x=t.comment):(O=!1,v=null,x=null,t&&typeof t=="object"&&(t=a.createNode(t))),n.implicitKey=!1,!m&&!h&&Ri(t)&&(n.indentAtStart=y.length+1),b=!1,!d&&c.length>=2&&!n.inFlow&&!m&&DE(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let w=!1;const S=g1(t,n,()=>w=!0,()=>b=!0);let E=" ";if(h||O||v){if(E=O?` `:"",v){const k=u(v);E+=` ${Tf(k,n.indent)}`}S===""&&!n.inFlow?E===` `&&x&&(E=` `):E+=` ${n.indent}`}else if(!m&&Ts(t)){const k=S[0],_=S.indexOf(` -`),C=_!==-1,T=n.inFlow??t.flow??t.items.length===0;if(C||!T){let A=!1;if(C&&(k==="&"||k==="!")){let j=S.indexOf(" ");k==="&"&&j!==-1&&j<_&&S[j+1]==="!"&&(j=S.indexOf(" ",j+1)),(j===-1||_e===j2||typeof e=="symbol"&&e.description===j2,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Fn(Symbol(j2)),{addToJSMap:V0e}),stringify:()=>j2},Eft=(e,t)=>(Qf.identify(t)||Ai(t)&&(!t.type||t.type===Fn.PLAIN)&&Qf.identify(t.value))&&(e==null?void 0:e.doc.schema.tags.some(n=>n.tag===Qf.tag&&n.default));function V0e(e,t,n){const r=H0e(e,n);if(RE(r))for(const i of r.items)TD(e,t,i);else if(Array.isArray(r))for(const i of r)TD(e,t,i);else TD(e,t,r)}function TD(e,t,n){const r=H0e(e,n);if(!jE(r))throw new Error("Merge sources must be maps or map aliases");const i=r.toJSON(null,e,Map);for(const[s,a]of i)t instanceof Map?t.has(s)||t.set(s,a):t instanceof Set?t.add(s):Object.prototype.hasOwnProperty.call(t,s)||Object.defineProperty(t,s,{value:a,writable:!0,enumerable:!0,configurable:!0});return t}function H0e(e,t){return e&&hO(t)?t.resolve(e.doc,e):t}function q0e(e,t,{key:n,value:r}){if(As(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(Eft(e,n))V0e(e,t,r);else{const i=Pc(n,"",e);if(t instanceof Map)t.set(i,Pc(r,i,e));else if(t instanceof Set)t.add(i);else{const s=kft(n,i,e),a=Pc(r,s,e);s in t?Object.defineProperty(t,s,{value:a,writable:!0,enumerable:!0,configurable:!0}):t[s]=a}}return t}function kft(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(As(e)&&(n!=null&&n.doc)){const r=F0e(n.doc,{});r.anchors=new Set;for(const s of n.anchors.keys())r.anchors.add(s.anchor);r.inFlow=!0,r.inStringifyKey=!0;const i=e.toString(r);if(!n.mapKeyWarned){let s=JSON.stringify(i);s.length>40&&(s=s.substring(0,36)+'..."'),z0e(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(t)}function qB(e,t,n){const r=Zw(e,void 0,n),i=Zw(t,void 0,n);return new wo(r,i)}class wo{constructor(t,n=null){Object.defineProperty(this,$c,{value:D0e}),this.key=t,this.value=n}clone(t){let{key:n,value:r}=this;return As(n)&&(n=n.clone(t)),As(r)&&(r=r.clone(t)),new wo(n,r)}toJSON(t,n){const r=n!=null&&n.mapAsMap?new Map:{};return q0e(n,r,this)}toString(t,n,r){return t!=null&&t.doc?Sft(this,t,n,r):JSON.stringify(this)}}function X0e(e,t,n){return(t.inFlow??e.flow?Tft:_ft)(e,t,n)}function _ft({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:s,onChompKeep:a,onComment:l}){const{indent:c,options:{commentString:u}}=n,d=Object.assign({},n,{indent:s,type:null});let f=!1;const h=[];for(let g=0;gy=null,()=>f=!0);y&&(O+=og(O,s,u(y))),f&&y&&(f=!1),h.push(r+O)}let m;if(h.length===0)m=i.start+i.end;else{m=h[0];for(let g=1;ge===I2||typeof e=="symbol"&&e.description===I2,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Fn(Symbol(I2)),{addToJSMap:V0e}),stringify:()=>I2},Sft=(e,t)=>(Qf.identify(t)||Ri(t)&&(!t.type||t.type===Fn.PLAIN)&&Qf.identify(t.value))&&(e==null?void 0:e.doc.schema.tags.some(n=>n.tag===Qf.tag&&n.default));function V0e(e,t,n){const r=H0e(e,n);if(DE(r))for(const i of r.items)TD(e,t,i);else if(Array.isArray(r))for(const i of r)TD(e,t,i);else TD(e,t,r)}function TD(e,t,n){const r=H0e(e,n);if(!IE(r))throw new Error("Merge sources must be maps or map aliases");const i=r.toJSON(null,e,Map);for(const[s,a]of i)t instanceof Map?t.has(s)||t.set(s,a):t instanceof Set?t.add(s):Object.prototype.hasOwnProperty.call(t,s)||Object.defineProperty(t,s,{value:a,writable:!0,enumerable:!0,configurable:!0});return t}function H0e(e,t){return e&&hO(t)?t.resolve(e.doc,e):t}function q0e(e,t,{key:n,value:r}){if(As(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(Sft(e,n))V0e(e,t,r);else{const i=Mc(n,"",e);if(t instanceof Map)t.set(i,Mc(r,i,e));else if(t instanceof Set)t.add(i);else{const s=Eft(n,i,e),a=Mc(r,s,e);s in t?Object.defineProperty(t,s,{value:a,writable:!0,enumerable:!0,configurable:!0}):t[s]=a}}return t}function Eft(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(As(e)&&(n!=null&&n.doc)){const r=F0e(n.doc,{});r.anchors=new Set;for(const s of n.anchors.keys())r.anchors.add(s.anchor);r.inFlow=!0,r.inStringifyKey=!0;const i=e.toString(r);if(!n.mapKeyWarned){let s=JSON.stringify(i);s.length>40&&(s=s.substring(0,36)+'..."'),z0e(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(t)}function qB(e,t,n){const r=Jw(e,void 0,n),i=Jw(t,void 0,n);return new ko(r,i)}class ko{constructor(t,n=null){Object.defineProperty(this,Bc,{value:D0e}),this.key=t,this.value=n}clone(t){let{key:n,value:r}=this;return As(n)&&(n=n.clone(t)),As(r)&&(r=r.clone(t)),new ko(n,r)}toJSON(t,n){const r=n!=null&&n.mapAsMap?new Map:{};return q0e(n,r,this)}toString(t,n,r){return t!=null&&t.doc?wft(this,t,n,r):JSON.stringify(this)}}function X0e(e,t,n){return(t.inFlow??e.flow?_ft:kft)(e,t,n)}function kft({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:s,onChompKeep:a,onComment:l}){const{indent:c,options:{commentString:u}}=n,d=Object.assign({},n,{indent:s,type:null});let f=!1;const h=[];for(let g=0;gy=null,()=>f=!0);y&&(O+=og(O,s,u(y))),f&&y&&(f=!1),h.push(r+O)}let m;if(h.length===0)m=i.start+i.end;else{m=h[0];for(let g=1;gy=null);u||(u=f.length>d||O.includes(` +`+Tf(u(e),c),l&&l()):f&&a&&a(),m}function _ft({items:e},t,{flowChars:n,itemIndent:r}){const{indent:i,indentStep:s,flowCollectionPadding:a,options:{commentString:l}}=t;r+=s;const c=Object.assign({},t,{indent:r,inFlow:!0,type:null});let u=!1,d=0;const f=[];for(let g=0;gy=null);u||(u=f.length>d||O.includes(` `)),g0&&(u||(u=f.reduce((v,x)=>v+x.length+2,2)+(O.length+2)>t.options.lineWidth)),u&&(O+=",")),y&&(O+=og(O,r,l(y))),f.push(O),d=f.length}const{start:h,end:m}=n;if(f.length===0)return h+m;if(!u){const g=f.reduce((b,y)=>b+y.length+2,2);u=t.options.lineWidth>0&&g>t.options.lineWidth}if(u){let g=h;for(const b of f)g+=b?` ${s}${i}${b}`:` `;return`${g} -${i}${m}`}else return`${h}${a}${f.join(" ")}${a}${m}`}function cA({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){const s=Tf(t(r),e);n.push(s.trimStart())}}function lg(e,t){const n=Ai(t)?t.value:t;for(const r of e)if(Ns(r)&&(r.key===t||r.key===n||Ai(r.key)&&r.key.value===n))return r}class _c extends Q0e{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Rp,t),this.items=[]}static from(t,n,r){const{keepUndefined:i,replacer:s}=r,a=new this(t),l=(c,u)=>{if(typeof s=="function")u=s.call(n,c,u);else if(Array.isArray(s)&&!s.includes(c))return;(u!==void 0||i)&&a.items.push(qB(c,u,r))};if(n instanceof Map)for(const[c,u]of n)l(c,u);else if(n&&typeof n=="object")for(const c of Object.keys(n))l(c,n[c]);return typeof t.sortMapEntries=="function"&&a.items.sort(t.sortMapEntries),a}add(t,n){var a;let r;Ns(t)?r=t:!t||typeof t!="object"||!("key"in t)?r=new wo(t,t==null?void 0:t.value):r=new wo(t.key,t.value);const i=lg(this.items,r.key),s=(a=this.schema)==null?void 0:a.sortMapEntries;if(i){if(!n)throw new Error(`Key ${r.key} already set`);Ai(i.value)&&B0e(r.value)?i.value.value=r.value:i.value=r.value}else if(s){const l=this.items.findIndex(c=>s(r,c)<0);l===-1?this.items.push(r):this.items.splice(l,0,r)}else this.items.push(r)}delete(t){const n=lg(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){const r=lg(this.items,t),i=r==null?void 0:r.value;return(!n&&Ai(i)?i.value:i)??void 0}has(t){return!!lg(this.items,t)}set(t,n){this.add(new wo(t,n),!0)}toJSON(t,n,r){const i=r?new r:n!=null&&n.mapAsMap?new Map:{};n!=null&&n.onCreate&&n.onCreate(i);for(const s of this.items)q0e(n,i,s);return i}toString(t,n,r){if(!t)return JSON.stringify(this);for(const i of this.items)if(!Ns(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),X0e(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:r,onComment:n})}}const mO={collection:"map",default:!0,nodeClass:_c,tag:"tag:yaml.org,2002:map",resolve(e,t){return jE(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>_c.from(e,t,n)};class Xg extends Q0e{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(fO,t),this.items=[]}add(t){this.items.push(t)}delete(t){const n=R2(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){const r=R2(t);if(typeof r!="number")return;const i=this.items[r];return!n&&Ai(i)?i.value:i}has(t){const n=R2(t);return typeof n=="number"&&n=0?t:null}const gO={collection:"seq",default:!0,nodeClass:Xg,tag:"tag:yaml.org,2002:seq",resolve(e,t){return RE(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>Xg.from(e,t,n)},Hj={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),HB(e,t,n,r)}},qj={identify:e=>e==null,createNode:()=>new Fn(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Fn(null),stringify:({source:e},t)=>typeof e=="string"&&qj.test.test(e)?e:t.options.nullStr},XB={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Fn(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&XB.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 Au({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r=="bigint")return String(r);const i=typeof r=="number"?r:Number(r);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let s=Object.is(r,-0)?"-0":JSON.stringify(r);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(s)&&!s.includes("e")){let a=s.indexOf(".");a<0&&(a=s.length,s+=".");let l=t-(s.length-a-1);for(;l-- >0;)s+="0"}return s}const G0e={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:Au},W0e={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():Au(e)}},Y0e={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 Fn(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:Au},Xj=e=>typeof e=="bigint"||Number.isInteger(e),GB=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function Z0e(e,t,n){const{value:r}=e;return Xj(r)&&r>=0?n+r.toString(t):Au(e)}const K0e={identify:e=>Xj(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>GB(e,2,8,n),stringify:e=>Z0e(e,8,"0o")},J0e={identify:Xj,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>GB(e,0,10,n),stringify:Au},ebe={identify:e=>Xj(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>GB(e,2,16,n),stringify:e=>Z0e(e,16,"0x")},Cft=[mO,gO,Hj,qj,XB,K0e,J0e,ebe,G0e,W0e,Y0e];function YW(e){return typeof e=="bigint"||Number.isInteger(e)}const I2=({value:e})=>JSON.stringify(e),Aft=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:I2},{identify:e=>e==null,createNode:()=>new Fn(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:I2},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:I2},{identify:YW,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})=>YW(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:I2}],Nft={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},jft=[mO,gO].concat(Aft,Nft),WB={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 i=0;i1&&t("Each pair must have its own sequence indicator");const i=r.items[0]||new wo(new Fn(null));if(r.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${r.commentBefore} +${i}${m}`}else return`${h}${a}${f.join(" ")}${a}${m}`}function cA({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){const s=Tf(t(r),e);n.push(s.trimStart())}}function lg(e,t){const n=Ri(t)?t.value:t;for(const r of e)if(Ns(r)&&(r.key===t||r.key===n||Ri(r.key)&&r.key.value===n))return r}class Tc extends Q0e{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Rp,t),this.items=[]}static from(t,n,r){const{keepUndefined:i,replacer:s}=r,a=new this(t),l=(c,u)=>{if(typeof s=="function")u=s.call(n,c,u);else if(Array.isArray(s)&&!s.includes(c))return;(u!==void 0||i)&&a.items.push(qB(c,u,r))};if(n instanceof Map)for(const[c,u]of n)l(c,u);else if(n&&typeof n=="object")for(const c of Object.keys(n))l(c,n[c]);return typeof t.sortMapEntries=="function"&&a.items.sort(t.sortMapEntries),a}add(t,n){var a;let r;Ns(t)?r=t:!t||typeof t!="object"||!("key"in t)?r=new ko(t,t==null?void 0:t.value):r=new ko(t.key,t.value);const i=lg(this.items,r.key),s=(a=this.schema)==null?void 0:a.sortMapEntries;if(i){if(!n)throw new Error(`Key ${r.key} already set`);Ri(i.value)&&B0e(r.value)?i.value.value=r.value:i.value=r.value}else if(s){const l=this.items.findIndex(c=>s(r,c)<0);l===-1?this.items.push(r):this.items.splice(l,0,r)}else this.items.push(r)}delete(t){const n=lg(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){const r=lg(this.items,t),i=r==null?void 0:r.value;return(!n&&Ri(i)?i.value:i)??void 0}has(t){return!!lg(this.items,t)}set(t,n){this.add(new ko(t,n),!0)}toJSON(t,n,r){const i=r?new r:n!=null&&n.mapAsMap?new Map:{};n!=null&&n.onCreate&&n.onCreate(i);for(const s of this.items)q0e(n,i,s);return i}toString(t,n,r){if(!t)return JSON.stringify(this);for(const i of this.items)if(!Ns(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),X0e(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:r,onComment:n})}}const mO={collection:"map",default:!0,nodeClass:Tc,tag:"tag:yaml.org,2002:map",resolve(e,t){return IE(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>Tc.from(e,t,n)};class Xg extends Q0e{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(fO,t),this.items=[]}add(t){this.items.push(t)}delete(t){const n=D2(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){const r=D2(t);if(typeof r!="number")return;const i=this.items[r];return!n&&Ri(i)?i.value:i}has(t){const n=D2(t);return typeof n=="number"&&n=0?t:null}const gO={collection:"seq",default:!0,nodeClass:Xg,tag:"tag:yaml.org,2002:seq",resolve(e,t){return DE(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>Xg.from(e,t,n)},Hj={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),HB(e,t,n,r)}},qj={identify:e=>e==null,createNode:()=>new Fn(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Fn(null),stringify:({source:e},t)=>typeof e=="string"&&qj.test.test(e)?e:t.options.nullStr},XB={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Fn(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&XB.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 ju({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r=="bigint")return String(r);const i=typeof r=="number"?r:Number(r);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let s=Object.is(r,-0)?"-0":JSON.stringify(r);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(s)&&!s.includes("e")){let a=s.indexOf(".");a<0&&(a=s.length,s+=".");let l=t-(s.length-a-1);for(;l-- >0;)s+="0"}return s}const G0e={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:ju},W0e={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():ju(e)}},Y0e={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 Fn(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:ju},Xj=e=>typeof e=="bigint"||Number.isInteger(e),GB=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function Z0e(e,t,n){const{value:r}=e;return Xj(r)&&r>=0?n+r.toString(t):ju(e)}const K0e={identify:e=>Xj(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>GB(e,2,8,n),stringify:e=>Z0e(e,8,"0o")},J0e={identify:Xj,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>GB(e,0,10,n),stringify:ju},ebe={identify:e=>Xj(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>GB(e,2,16,n),stringify:e=>Z0e(e,16,"0x")},Tft=[mO,gO,Hj,qj,XB,K0e,J0e,ebe,G0e,W0e,Y0e];function YW(e){return typeof e=="bigint"||Number.isInteger(e)}const P2=({value:e})=>JSON.stringify(e),Cft=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:P2},{identify:e=>e==null,createNode:()=>new Fn(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:P2},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:P2},{identify:YW,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})=>YW(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:P2}],Aft={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},Nft=[mO,gO].concat(Cft,Aft),WB={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 i=0;i1&&t("Each pair must have its own sequence indicator");const i=r.items[0]||new ko(new Fn(null));if(r.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${r.commentBefore} ${i.key.commentBefore}`:r.commentBefore),r.comment){const s=i.value??i.key;s.comment=s.comment?`${r.comment} -${s.comment}`:r.comment}r=i}e.items[n]=Ns(r)?r:new wo(r)}}else t("Expected a sequence for this tag");return e}function nbe(e,t,n){const{replacer:r}=n,i=new Xg(e);i.tag="tag:yaml.org,2002:pairs";let s=0;if(t&&Symbol.iterator in Object(t))for(let a of t){typeof r=="function"&&(a=r.call(t,String(s++),a));let l,c;if(Array.isArray(a))if(a.length===2)l=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)l=u[0],c=a[l];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else l=a;i.items.push(qB(l,c,n))}return i}const YB={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:tbe,createNode:nbe};class vy extends Xg{constructor(){super(),this.add=_c.prototype.add.bind(this),this.delete=_c.prototype.delete.bind(this),this.get=_c.prototype.get.bind(this),this.has=_c.prototype.has.bind(this),this.set=_c.prototype.set.bind(this),this.tag=vy.tag}toJSON(t,n){if(!n)return super.toJSON(t);const r=new Map;n!=null&&n.onCreate&&n.onCreate(r);for(const i of this.items){let s,a;if(Ns(i)?(s=Pc(i.key,"",n),a=Pc(i.value,s,n)):s=Pc(i,"",n),r.has(s))throw new Error("Ordered maps must not include duplicate keys");r.set(s,a)}return r}static from(t,n,r){const i=nbe(t,n,r),s=new this;return s.items=i.items,s}}vy.tag="tag:yaml.org,2002:omap";const ZB={collection:"seq",identify:e=>e instanceof Map,nodeClass:vy,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const n=tbe(e,t),r=[];for(const{key:i}of n.items)Ai(i)&&(r.includes(i.value)?t(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new vy,n)},createNode:(e,t,n)=>vy.from(e,t,n)};function rbe({value:e,source:t},n){return t&&(e?ibe:sbe).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}const ibe={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 Fn(!0),stringify:rbe},sbe={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 Fn(!1),stringify:rbe},Rft={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:Au},Ift={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():Au(e)}},Dft={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 Fn(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:Au},IE=e=>typeof e=="bigint"||Number.isInteger(e);function Gj(e,t,n,{intAsBigInt:r}){const i=e[0];if((i==="-"||i==="+")&&(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 i==="-"?BigInt(-1)*a:a}const s=parseInt(e,n);return i==="-"?-1*s:s}function KB(e,t,n){const{value:r}=e;if(IE(r)){const i=r.toString(t);return r<0?"-"+n+i.substr(1):n+i}return Au(e)}const Pft={identify:IE,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Gj(e,2,2,n),stringify:e=>KB(e,2,"0b")},Mft={identify:IE,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Gj(e,1,8,n),stringify:e=>KB(e,8,"0")},Lft={identify:IE,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Gj(e,0,10,n),stringify:Au},$ft={identify:IE,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Gj(e,2,16,n),stringify:e=>KB(e,16,"0x")};class wy extends _c{constructor(t){super(t),this.tag=wy.tag}add(t){let n;Ns(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new wo(t.key,null):n=new wo(t,null),lg(this.items,n.key)||this.items.push(n)}get(t,n){const r=lg(this.items,t);return!n&&Ns(r)?Ai(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=lg(this.items,t);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new wo(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:i}=r,s=new this(t);if(n&&Symbol.iterator in Object(n))for(let a of n)typeof i=="function"&&(a=i.call(n,a,a)),s.items.push(qB(a,null,r));return s}}wy.tag="tag:yaml.org,2002:set";const JB={collection:"map",identify:e=>e instanceof Set,nodeClass:wy,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>wy.from(e,t,n),resolve(e,t){if(jE(e)){if(e.hasAllNullValues(!0))return Object.assign(new wy,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function eQ(e,t){const n=e[0],r=n==="-"||n==="+"?e.substring(1):e,i=a=>t?BigInt(a):Number(a),s=r.replace(/_/g,"").split(":").reduce((a,l)=>a*i(60)+i(l),i(0));return n==="-"?i(-1)*s:s}function abe(e){let{value:t}=e,n=a=>a;if(typeof t=="bigint")n=a=>BigInt(a);else if(isNaN(t)||!isFinite(t))return Au(e);let r="";t<0&&(r="-",t*=n(-1));const i=n(60),s=[t%i];return t<60?s.unshift(0):(t=(t-s[0])/i,s.unshift(t%i),t>=60&&(t=(t-s[0])/i,s.unshift(t))),r+s.map(a=>String(a).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const obe={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})=>eQ(e,n),stringify:abe},lbe={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=>eQ(e,!1),stringify:abe},Wj={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(Wj.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,n,r,i,s,a,l]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0;let u=Date.UTC(n,r-1,i,s||0,a||0,l||0,c);const d=t[8];if(d&&d!=="Z"){let f=eQ(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$/,""))??""},ZW=[mO,gO,Hj,qj,ibe,sbe,Pft,Mft,Lft,$ft,Rft,Ift,Dft,WB,Qf,ZB,YB,JB,obe,lbe,Wj],KW=new Map([["core",Cft],["failsafe",[mO,gO,Hj]],["json",jft],["yaml11",ZW],["yaml-1.1",ZW]]),JW={binary:WB,bool:XB,float:Y0e,floatExp:W0e,floatNaN:G0e,floatTime:lbe,int:J0e,intHex:ebe,intOct:K0e,intTime:obe,map:mO,merge:Qf,null:qj,omap:ZB,pairs:YB,seq:gO,set:JB,timestamp:Wj},Bft={"tag:yaml.org,2002:binary":WB,"tag:yaml.org,2002:merge":Qf,"tag:yaml.org,2002:omap":ZB,"tag:yaml.org,2002:pairs":YB,"tag:yaml.org,2002:set":JB,"tag:yaml.org,2002:timestamp":Wj};function CD(e,t,n){const r=KW.get(t);if(r&&!e)return n&&!r.includes(Qf)?r.concat(Qf):r.slice();let i=r;if(!i)if(Array.isArray(e))i=[];else{const s=Array.from(KW.keys()).filter(a=>a!=="yaml11").map(a=>JSON.stringify(a)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${s} or define customTags array`)}if(Array.isArray(e))for(const s of e)i=i.concat(s);else typeof e=="function"&&(i=e(i.slice()));return n&&(i=i.concat(Qf)),i.reduce((s,a)=>{const l=typeof a=="string"?JW[a]:a;if(!l){const c=JSON.stringify(a),u=Object.keys(JW).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${u}`)}return s.includes(l)||s.push(l),s},[])}const Qft=(e,t)=>e.keyt.key?1:0;let Uft=class cbe{constructor({compat:t,customTags:n,merge:r,resolveKnownTags:i,schema:s,sortMapEntries:a,toStringDefaults:l}){this.compat=Array.isArray(t)?CD(t,"compat"):t?CD(null,t):null,this.name=typeof s=="string"&&s||"core",this.knownTags=i?Bft:{},this.tags=CD(n,this.name,r),this.toStringOptions=l??null,Object.defineProperty(this,Rp,{value:mO}),Object.defineProperty(this,Od,{value:Hj}),Object.defineProperty(this,fO,{value:gO}),this.sortMapEntries=typeof a=="function"?a:a===!0?Qft:null}clone(){const t=Object.create(cbe.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function Fft(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 i=F0e(e,t),{commentString:s}=i.options;if(e.commentBefore){n.length!==1&&n.unshift("");const u=s(e.commentBefore);n.unshift(Tf(u,""))}let a=!1,l=null;if(e.contents){if(As(e.contents)){if(e.contents.spaceBefore&&r&&n.push(""),e.contents.commentBefore){const f=s(e.contents.commentBefore);n.push(Tf(f,""))}i.forceBlockIndent=!!e.comment,l=e.contents.comment}const u=l?void 0:()=>a=!0;let d=g1(e.contents,i,()=>l=null,u);l&&(d+=og(d,"",s(l))),(d[0]==="|"||d[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${d}`:n.push(d)}else n.push(g1(e.contents,i));if((c=e.directives)!=null&&c.docEnd)if(e.comment){const u=s(e.comment);u.includes(` +${s.comment}`:r.comment}r=i}e.items[n]=Ns(r)?r:new ko(r)}}else t("Expected a sequence for this tag");return e}function nbe(e,t,n){const{replacer:r}=n,i=new Xg(e);i.tag="tag:yaml.org,2002:pairs";let s=0;if(t&&Symbol.iterator in Object(t))for(let a of t){typeof r=="function"&&(a=r.call(t,String(s++),a));let l,c;if(Array.isArray(a))if(a.length===2)l=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)l=u[0],c=a[l];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else l=a;i.items.push(qB(l,c,n))}return i}const YB={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:tbe,createNode:nbe};class vy extends Xg{constructor(){super(),this.add=Tc.prototype.add.bind(this),this.delete=Tc.prototype.delete.bind(this),this.get=Tc.prototype.get.bind(this),this.has=Tc.prototype.has.bind(this),this.set=Tc.prototype.set.bind(this),this.tag=vy.tag}toJSON(t,n){if(!n)return super.toJSON(t);const r=new Map;n!=null&&n.onCreate&&n.onCreate(r);for(const i of this.items){let s,a;if(Ns(i)?(s=Mc(i.key,"",n),a=Mc(i.value,s,n)):s=Mc(i,"",n),r.has(s))throw new Error("Ordered maps must not include duplicate keys");r.set(s,a)}return r}static from(t,n,r){const i=nbe(t,n,r),s=new this;return s.items=i.items,s}}vy.tag="tag:yaml.org,2002:omap";const ZB={collection:"seq",identify:e=>e instanceof Map,nodeClass:vy,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const n=tbe(e,t),r=[];for(const{key:i}of n.items)Ri(i)&&(r.includes(i.value)?t(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new vy,n)},createNode:(e,t,n)=>vy.from(e,t,n)};function rbe({value:e,source:t},n){return t&&(e?ibe:sbe).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}const ibe={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 Fn(!0),stringify:rbe},sbe={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 Fn(!1),stringify:rbe},jft={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:ju},Rft={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():ju(e)}},Ift={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 Fn(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:ju},PE=e=>typeof e=="bigint"||Number.isInteger(e);function Gj(e,t,n,{intAsBigInt:r}){const i=e[0];if((i==="-"||i==="+")&&(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 i==="-"?BigInt(-1)*a:a}const s=parseInt(e,n);return i==="-"?-1*s:s}function KB(e,t,n){const{value:r}=e;if(PE(r)){const i=r.toString(t);return r<0?"-"+n+i.substr(1):n+i}return ju(e)}const Dft={identify:PE,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Gj(e,2,2,n),stringify:e=>KB(e,2,"0b")},Pft={identify:PE,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Gj(e,1,8,n),stringify:e=>KB(e,8,"0")},Mft={identify:PE,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Gj(e,0,10,n),stringify:ju},Lft={identify:PE,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Gj(e,2,16,n),stringify:e=>KB(e,16,"0x")};class wy extends Tc{constructor(t){super(t),this.tag=wy.tag}add(t){let n;Ns(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new ko(t.key,null):n=new ko(t,null),lg(this.items,n.key)||this.items.push(n)}get(t,n){const r=lg(this.items,t);return!n&&Ns(r)?Ri(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=lg(this.items,t);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new ko(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:i}=r,s=new this(t);if(n&&Symbol.iterator in Object(n))for(let a of n)typeof i=="function"&&(a=i.call(n,a,a)),s.items.push(qB(a,null,r));return s}}wy.tag="tag:yaml.org,2002:set";const JB={collection:"map",identify:e=>e instanceof Set,nodeClass:wy,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>wy.from(e,t,n),resolve(e,t){if(IE(e)){if(e.hasAllNullValues(!0))return Object.assign(new wy,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function eQ(e,t){const n=e[0],r=n==="-"||n==="+"?e.substring(1):e,i=a=>t?BigInt(a):Number(a),s=r.replace(/_/g,"").split(":").reduce((a,l)=>a*i(60)+i(l),i(0));return n==="-"?i(-1)*s:s}function abe(e){let{value:t}=e,n=a=>a;if(typeof t=="bigint")n=a=>BigInt(a);else if(isNaN(t)||!isFinite(t))return ju(e);let r="";t<0&&(r="-",t*=n(-1));const i=n(60),s=[t%i];return t<60?s.unshift(0):(t=(t-s[0])/i,s.unshift(t%i),t>=60&&(t=(t-s[0])/i,s.unshift(t))),r+s.map(a=>String(a).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const obe={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})=>eQ(e,n),stringify:abe},lbe={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=>eQ(e,!1),stringify:abe},Wj={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(Wj.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,n,r,i,s,a,l]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0;let u=Date.UTC(n,r-1,i,s||0,a||0,l||0,c);const d=t[8];if(d&&d!=="Z"){let f=eQ(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$/,""))??""},ZW=[mO,gO,Hj,qj,ibe,sbe,Dft,Pft,Mft,Lft,jft,Rft,Ift,WB,Qf,ZB,YB,JB,obe,lbe,Wj],KW=new Map([["core",Tft],["failsafe",[mO,gO,Hj]],["json",Nft],["yaml11",ZW],["yaml-1.1",ZW]]),JW={binary:WB,bool:XB,float:Y0e,floatExp:W0e,floatNaN:G0e,floatTime:lbe,int:J0e,intHex:ebe,intOct:K0e,intTime:obe,map:mO,merge:Qf,null:qj,omap:ZB,pairs:YB,seq:gO,set:JB,timestamp:Wj},$ft={"tag:yaml.org,2002:binary":WB,"tag:yaml.org,2002:merge":Qf,"tag:yaml.org,2002:omap":ZB,"tag:yaml.org,2002:pairs":YB,"tag:yaml.org,2002:set":JB,"tag:yaml.org,2002:timestamp":Wj};function CD(e,t,n){const r=KW.get(t);if(r&&!e)return n&&!r.includes(Qf)?r.concat(Qf):r.slice();let i=r;if(!i)if(Array.isArray(e))i=[];else{const s=Array.from(KW.keys()).filter(a=>a!=="yaml11").map(a=>JSON.stringify(a)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${s} or define customTags array`)}if(Array.isArray(e))for(const s of e)i=i.concat(s);else typeof e=="function"&&(i=e(i.slice()));return n&&(i=i.concat(Qf)),i.reduce((s,a)=>{const l=typeof a=="string"?JW[a]:a;if(!l){const c=JSON.stringify(a),u=Object.keys(JW).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${u}`)}return s.includes(l)||s.push(l),s},[])}const Bft=(e,t)=>e.keyt.key?1:0;let Qft=class cbe{constructor({compat:t,customTags:n,merge:r,resolveKnownTags:i,schema:s,sortMapEntries:a,toStringDefaults:l}){this.compat=Array.isArray(t)?CD(t,"compat"):t?CD(null,t):null,this.name=typeof s=="string"&&s||"core",this.knownTags=i?$ft:{},this.tags=CD(n,this.name,r),this.toStringOptions=l??null,Object.defineProperty(this,Rp,{value:mO}),Object.defineProperty(this,vd,{value:Hj}),Object.defineProperty(this,fO,{value:gO}),this.sortMapEntries=typeof a=="function"?a:a===!0?Bft:null}clone(){const t=Object.create(cbe.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function Uft(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 i=F0e(e,t),{commentString:s}=i.options;if(e.commentBefore){n.length!==1&&n.unshift("");const u=s(e.commentBefore);n.unshift(Tf(u,""))}let a=!1,l=null;if(e.contents){if(As(e.contents)){if(e.contents.spaceBefore&&r&&n.push(""),e.contents.commentBefore){const f=s(e.contents.commentBefore);n.push(Tf(f,""))}i.forceBlockIndent=!!e.comment,l=e.contents.comment}const u=l?void 0:()=>a=!0;let d=g1(e.contents,i,()=>l=null,u);l&&(d+=og(d,"",s(l))),(d[0]==="|"||d[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${d}`:n.push(d)}else n.push(g1(e.contents,i));if((c=e.directives)!=null&&c.docEnd)if(e.comment){const u=s(e.comment);u.includes(` `)?(n.push("..."),n.push(Tf(u,""))):n.push(`... ${u}`)}else n.push("...");else{let u=e.comment;u&&a&&(u=u.replace(/^\n+/,"")),u&&((!a||l)&&n[n.length-1]!==""&&n.push(""),n.push(Tf(s(u),"")))}return n.join(` `)+` -`}class DE{constructor(t,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,$c,{value:EL});let i=null;typeof n=="function"||Array.isArray(n)?i=n:r===void 0&&n&&(r=n,n=void 0);const s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=s;let{version:a}=s;r!=null&&r._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new ho({version:a}),this.setSchema(a,r),this.contents=t===void 0?null:this.createNode(t,i,r)}clone(){const t=Object.create(DE.prototype,{[$c]:{value:EL}});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=As(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){eb(this.contents)&&this.contents.add(t)}addIn(t,n){eb(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){const r=L0e(this);t.anchor=!n||r.has(n)?$0e(n||"a",r):n}return new VB(t.anchor)}createNode(t,n,r){let i;if(typeof n=="function")t=n.call({"":t},"",t),i=n;else if(Array.isArray(n)){const y=v=>typeof v=="number"||v instanceof String||v instanceof Number,O=n.filter(y).map(String);O.length>0&&(n=n.concat(O)),i=n}else r===void 0&&n&&(r=n,n=void 0);const{aliasDuplicateObjects:s,anchorPrefix:a,flow:l,keepUndefined:c,onTagObj:u,tag:d}=r??{},{onAnchor:f,setAnchors:h,sourceObjects:m}=mft(this,a||"a"),g={aliasDuplicateObjects:s??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:u,replacer:i,schema:this.schema,sourceObjects:m},b=Zw(t,d,g);return l&&Ts(b)&&(b.flow=!0),h(),b}createPair(t,n,r={}){const i=this.createNode(t,null,r),s=this.createNode(n,null,r);return new wo(i,s)}delete(t){return eb(this.contents)?this.contents.delete(t):!1}deleteIn(t){return Yx(t)?this.contents==null?!1:(this.contents=null,!0):eb(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return Ts(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return Yx(t)?!n&&Ai(this.contents)?this.contents.value:this.contents:Ts(this.contents)?this.contents.getIn(t,n):void 0}has(t){return Ts(this.contents)?this.contents.has(t):!1}hasIn(t){return Yx(t)?this.contents!==void 0:Ts(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=lA(this.schema,[t],n):eb(this.contents)&&this.contents.set(t,n)}setIn(t,n){Yx(t)?this.contents=n:this.contents==null?this.contents=lA(this.schema,Array.from(t),n):eb(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 ho({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 ho({version:t}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{const i=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new Uft(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:i,onAnchor:s,reviver:a}={}){const l={anchors:new Map,doc:this,keep:!t,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=Pc(this.contents,n??"",l);if(typeof s=="function")for(const{count:u,res:d}of l.anchors.values())s(d,u);return typeof a=="function"?Yb(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 Fft(this,t)}}function eb(e){if(Ts(e))return!0;throw new Error("Expected a YAML collection as document contents")}class ube extends Error{constructor(t,n,r,i){super(),this.name=t,this.code=r,this.message=i,this.pos=n}}class Zx extends ube{constructor(t,n,r){super("YAMLParseError",t,n,r)}}class zft extends ube{constructor(t,n,r){super("YAMLWarning",t,n,r)}}const eY=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(l=>t.linePos(l));const{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let s=i-1,a=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,"");if(s>=60&&a.length>80){const l=Math.min(s-39,a.length-79);a="…"+a.substring(l),s-=l-1}if(a.length>80&&(a=a.substring(0,79)+"…"),r>1&&/^ *$/.test(a.substring(0,s))){let l=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);l.length>80&&(l=l.substring(0,79)+`… +`}class ME{constructor(t,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Bc,{value:EL});let i=null;typeof n=="function"||Array.isArray(n)?i=n:r===void 0&&n&&(r=n,n=void 0);const s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=s;let{version:a}=s;r!=null&&r._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new go({version:a}),this.setSchema(a,r),this.contents=t===void 0?null:this.createNode(t,i,r)}clone(){const t=Object.create(ME.prototype,{[Bc]:{value:EL}});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=As(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){eb(this.contents)&&this.contents.add(t)}addIn(t,n){eb(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){const r=L0e(this);t.anchor=!n||r.has(n)?$0e(n||"a",r):n}return new VB(t.anchor)}createNode(t,n,r){let i;if(typeof n=="function")t=n.call({"":t},"",t),i=n;else if(Array.isArray(n)){const y=v=>typeof v=="number"||v instanceof String||v instanceof Number,O=n.filter(y).map(String);O.length>0&&(n=n.concat(O)),i=n}else r===void 0&&n&&(r=n,n=void 0);const{aliasDuplicateObjects:s,anchorPrefix:a,flow:l,keepUndefined:c,onTagObj:u,tag:d}=r??{},{onAnchor:f,setAnchors:h,sourceObjects:m}=pft(this,a||"a"),g={aliasDuplicateObjects:s??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:u,replacer:i,schema:this.schema,sourceObjects:m},b=Jw(t,d,g);return l&&Ts(b)&&(b.flow=!0),h(),b}createPair(t,n,r={}){const i=this.createNode(t,null,r),s=this.createNode(n,null,r);return new ko(i,s)}delete(t){return eb(this.contents)?this.contents.delete(t):!1}deleteIn(t){return Yx(t)?this.contents==null?!1:(this.contents=null,!0):eb(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return Ts(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return Yx(t)?!n&&Ri(this.contents)?this.contents.value:this.contents:Ts(this.contents)?this.contents.getIn(t,n):void 0}has(t){return Ts(this.contents)?this.contents.has(t):!1}hasIn(t){return Yx(t)?this.contents!==void 0:Ts(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=lA(this.schema,[t],n):eb(this.contents)&&this.contents.set(t,n)}setIn(t,n){Yx(t)?this.contents=n:this.contents==null?this.contents=lA(this.schema,Array.from(t),n):eb(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 go({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 go({version:t}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{const i=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new Qft(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:i,onAnchor:s,reviver:a}={}){const l={anchors:new Map,doc:this,keep:!t,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=Mc(this.contents,n??"",l);if(typeof s=="function")for(const{count:u,res:d}of l.anchors.values())s(d,u);return typeof a=="function"?Yb(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 Uft(this,t)}}function eb(e){if(Ts(e))return!0;throw new Error("Expected a YAML collection as document contents")}class ube extends Error{constructor(t,n,r,i){super(),this.name=t,this.code=r,this.message=i,this.pos=n}}class Zx extends ube{constructor(t,n,r){super("YAMLParseError",t,n,r)}}class Fft extends ube{constructor(t,n,r){super("YAMLWarning",t,n,r)}}const eY=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(l=>t.linePos(l));const{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let s=i-1,a=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,"");if(s>=60&&a.length>80){const l=Math.min(s-39,a.length-79);a="…"+a.substring(l),s-=l-1}if(a.length>80&&(a=a.substring(0,79)+"…"),r>1&&/^ *$/.test(a.substring(0,s))){let l=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);l.length>80&&(l=l.substring(0,79)+`… `),a=l+a}if(/[^ ]/.test(a)){let l=1;const c=n.linePos[1];(c==null?void 0:c.line)===r&&c.col>i&&(l=Math.max(1,Math.min(c.col-i,80-s)));const u=" ".repeat(s)+"^".repeat(l);n.message+=`: ${a} ${u} -`}};function b1(e,{flow:t,indicator:n,next:r,offset:i,onError:s,parentIndent:a,startOnNewline:l}){let c=!1,u=l,d=l,f="",h="",m=!1,g=!1,b=null,y=null,O=null,v=null,x=null,w=null,S=null;for(const _ of e)switch(g&&(_.type!=="space"&&_.type!=="newline"&&_.type!=="comma"&&s(_.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),b&&(u&&_.type!=="comment"&&_.type!=="newline"&&s(b,"TAB_AS_INDENT","Tabs are not allowed as indentation"),b=null),_.type){case"space":!t&&(n!=="doc-start"||(r==null?void 0:r.type)!=="flow-collection")&&_.source.includes(" ")&&(b=_),d=!0;break;case"comment":{d||s(_,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const C=_.source.substring(1)||" ";f?f+=h+C:f=C,h="",u=!1;break}case"newline":u?f?f+=_.source:(!w||n!=="seq-item-ind")&&(c=!0):h+=_.source,u=!0,m=!0,(y||O)&&(v=_),d=!0;break;case"anchor":y&&s(_,"MULTIPLE_ANCHORS","A node can have at most one anchor"),_.source.endsWith(":")&&s(_.offset+_.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),y=_,S??(S=_.offset),u=!1,d=!1,g=!0;break;case"tag":{O&&s(_,"MULTIPLE_TAGS","A node can have at most one tag"),O=_,S??(S=_.offset),u=!1,d=!1,g=!0;break}case n:(y||O)&&s(_,"BAD_PROP_ORDER",`Anchors and tags must be after the ${_.source} indicator`),w&&s(_,"UNEXPECTED_TOKEN",`Unexpected ${_.source} in ${t??"collection"}`),w=_,u=n==="seq-item-ind"||n==="explicit-key-ind",d=!1;break;case"comma":if(t){x&&s(_,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),x=_,u=!1,d=!1;break}default:s(_,"UNEXPECTED_TOKEN",`Unexpected ${_.type} token`),u=!1,d=!1}const E=e[e.length-1],k=E?E.offset+E.source.length:i;return g&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&s(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),b&&(u&&b.indent<=a||(r==null?void 0:r.type)==="block-map"||(r==null?void 0:r.type)==="block-seq")&&s(b,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:x,found:w,spaceBefore:c,comment:f,hasNewline:m,anchor:y,tag:O,newlineAfterProp:v,end:k,start:S??k}}function Kw(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(Kw(t.key)||Kw(t.value))return!0}return!1;default:return!0}}function CL(e,t,n){if((t==null?void 0:t.type)==="flow-collection"){const r=t.end[0];r.indent===e&&(r.source==="]"||r.source==="}")&&Kw(t)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function dbe(e,t,n){const{uniqueKeys:r}=e.options;if(r===!1)return!1;const i=typeof r=="function"?r:(s,a)=>s===a||Ai(s)&&Ai(a)&&s.value===a.value;return t.some(s=>i(s.key,n))}const tY="All mapping items must start at the same column";function Vft({composeNode:e,composeEmptyNode:t},n,r,i,s){var d;const a=(s==null?void 0:s.nodeClass)??_c,l=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:m,sep:g,value:b}=f,y=b1(h,{indicator:"explicit-key-ind",next:m??(g==null?void 0:g[0]),offset:c,onError:i,parentIndent:r.indent,startOnNewline:!0}),O=!y.found;if(O){if(m&&(m.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in m&&m.indent!==r.indent&&i(c,"BAD_INDENT",tY)),!y.anchor&&!y.tag&&!g){u=y.end,y.comment&&(l.comment?l.comment+=` -`+y.comment:l.comment=y.comment);continue}(y.newlineAfterProp||Kw(m))&&i(m??h[h.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else((d=y.found)==null?void 0:d.indent)!==r.indent&&i(c,"BAD_INDENT",tY);n.atKey=!0;const v=y.end,x=m?e(n,m,y,i):t(n,v,h,null,y,i);n.schema.compat&&CL(r.indent,m,i),n.atKey=!1,dbe(n,l.items,x)&&i(v,"DUPLICATE_KEY","Map keys must be unique");const w=b1(g??[],{indicator:"map-value-ind",next:b,offset:x.range[2],onError:i,parentIndent:r.indent,startOnNewline:!m||m.type==="block-scalar"});if(c=w.end,w.found){O&&((b==null?void 0:b.type)==="block-map"&&!w.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&y.starte&&(e.type==="block-map"||e.type==="block-seq");function qft({composeNode:e,composeEmptyNode:t},n,r,i,s){var y;const a=r.start.source==="{",l=a?"flow map":"flow sequence",c=(s==null?void 0:s.nodeClass)??(a?_c:Xg),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 O=0;O0){const O=PE(g,b,n.options.strict,i);O.comment&&(u.comment?u.comment+=` -`+O.comment:u.comment=O.comment),u.range=[r.offset,b,O.offset]}else u.range=[r.offset,b,b];return u}function jD(e,t,n,r,i,s){const a=n.type==="block-map"?Vft(e,t,n,r,s):n.type==="block-seq"?Hft(e,t,n,r,s):qft(e,t,n,r,s),l=a.constructor;return i==="!"||i===l.tagName?(a.tag=l.tagName,a):(i&&(a.tag=i),a)}function Xft(e,t,n,r,i){var h;const s=r.tag,a=s?t.directives.tagName(s.source,m=>i(s,"TAG_RESOLVE_FAILED",m)):null;if(n.type==="block-seq"){const{anchor:m,newlineAfterProp:g}=r,b=m&&s?m.offset>s.offset?m:s:m??s;b&&(!g||g.offsetm.tag===a&&m.collection===l);if(!c){const m=t.schema.knownTags[a];if((m==null?void 0:m.collection)===l)t.schema.tags.push(Object.assign({},m,{default:!1})),c=m;else return m?i(s,"BAD_COLLECTION_TYPE",`${m.tag} used for ${l} collection, but expects ${m.collection??"scalar"}`,!0):i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),jD(e,t,n,i,a)}const u=jD(e,t,n,i,a,c),d=((h=c.resolve)==null?void 0:h.call(c,u,m=>i(s,"TAG_RESOLVE_FAILED",m),t.options))??u,f=As(d)?d:new Fn(d);return f.range=u.range,f.tag=a,c!=null&&c.format&&(f.format=c.format),f}function Gft(e,t,n){const r=t.offset,i=Wft(t,e.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};const s=i.mode===">"?Fn.BLOCK_FOLDED:Fn.BLOCK_LITERAL,a=t.source?Yft(t.source):[];let l=a.length;for(let b=a.length-1;b>=0;--b){const y=a[b][1];if(y===""||y==="\r")l=b;else break}if(l===0){const b=i.chomp==="+"&&a.length>0?` +`}};function b1(e,{flow:t,indicator:n,next:r,offset:i,onError:s,parentIndent:a,startOnNewline:l}){let c=!1,u=l,d=l,f="",h="",m=!1,g=!1,b=null,y=null,O=null,v=null,x=null,w=null,S=null;for(const _ of e)switch(g&&(_.type!=="space"&&_.type!=="newline"&&_.type!=="comma"&&s(_.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),b&&(u&&_.type!=="comment"&&_.type!=="newline"&&s(b,"TAB_AS_INDENT","Tabs are not allowed as indentation"),b=null),_.type){case"space":!t&&(n!=="doc-start"||(r==null?void 0:r.type)!=="flow-collection")&&_.source.includes(" ")&&(b=_),d=!0;break;case"comment":{d||s(_,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const T=_.source.substring(1)||" ";f?f+=h+T:f=T,h="",u=!1;break}case"newline":u?f?f+=_.source:(!w||n!=="seq-item-ind")&&(c=!0):h+=_.source,u=!0,m=!0,(y||O)&&(v=_),d=!0;break;case"anchor":y&&s(_,"MULTIPLE_ANCHORS","A node can have at most one anchor"),_.source.endsWith(":")&&s(_.offset+_.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),y=_,S??(S=_.offset),u=!1,d=!1,g=!0;break;case"tag":{O&&s(_,"MULTIPLE_TAGS","A node can have at most one tag"),O=_,S??(S=_.offset),u=!1,d=!1,g=!0;break}case n:(y||O)&&s(_,"BAD_PROP_ORDER",`Anchors and tags must be after the ${_.source} indicator`),w&&s(_,"UNEXPECTED_TOKEN",`Unexpected ${_.source} in ${t??"collection"}`),w=_,u=n==="seq-item-ind"||n==="explicit-key-ind",d=!1;break;case"comma":if(t){x&&s(_,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),x=_,u=!1,d=!1;break}default:s(_,"UNEXPECTED_TOKEN",`Unexpected ${_.type} token`),u=!1,d=!1}const E=e[e.length-1],k=E?E.offset+E.source.length:i;return g&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&s(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),b&&(u&&b.indent<=a||(r==null?void 0:r.type)==="block-map"||(r==null?void 0:r.type)==="block-seq")&&s(b,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:x,found:w,spaceBefore:c,comment:f,hasNewline:m,anchor:y,tag:O,newlineAfterProp:v,end:k,start:S??k}}function eS(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(eS(t.key)||eS(t.value))return!0}return!1;default:return!0}}function CL(e,t,n){if((t==null?void 0:t.type)==="flow-collection"){const r=t.end[0];r.indent===e&&(r.source==="]"||r.source==="}")&&eS(t)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function dbe(e,t,n){const{uniqueKeys:r}=e.options;if(r===!1)return!1;const i=typeof r=="function"?r:(s,a)=>s===a||Ri(s)&&Ri(a)&&s.value===a.value;return t.some(s=>i(s.key,n))}const tY="All mapping items must start at the same column";function zft({composeNode:e,composeEmptyNode:t},n,r,i,s){var d;const a=(s==null?void 0:s.nodeClass)??Tc,l=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:m,sep:g,value:b}=f,y=b1(h,{indicator:"explicit-key-ind",next:m??(g==null?void 0:g[0]),offset:c,onError:i,parentIndent:r.indent,startOnNewline:!0}),O=!y.found;if(O){if(m&&(m.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in m&&m.indent!==r.indent&&i(c,"BAD_INDENT",tY)),!y.anchor&&!y.tag&&!g){u=y.end,y.comment&&(l.comment?l.comment+=` +`+y.comment:l.comment=y.comment);continue}(y.newlineAfterProp||eS(m))&&i(m??h[h.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else((d=y.found)==null?void 0:d.indent)!==r.indent&&i(c,"BAD_INDENT",tY);n.atKey=!0;const v=y.end,x=m?e(n,m,y,i):t(n,v,h,null,y,i);n.schema.compat&&CL(r.indent,m,i),n.atKey=!1,dbe(n,l.items,x)&&i(v,"DUPLICATE_KEY","Map keys must be unique");const w=b1(g??[],{indicator:"map-value-ind",next:b,offset:x.range[2],onError:i,parentIndent:r.indent,startOnNewline:!m||m.type==="block-scalar"});if(c=w.end,w.found){O&&((b==null?void 0:b.type)==="block-map"&&!w.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&y.starte&&(e.type==="block-map"||e.type==="block-seq");function Hft({composeNode:e,composeEmptyNode:t},n,r,i,s){var y;const a=r.start.source==="{",l=a?"flow map":"flow sequence",c=(s==null?void 0:s.nodeClass)??(a?Tc:Xg),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 O=0;O0){const O=LE(g,b,n.options.strict,i);O.comment&&(u.comment?u.comment+=` +`+O.comment:u.comment=O.comment),u.range=[r.offset,b,O.offset]}else u.range=[r.offset,b,b];return u}function jD(e,t,n,r,i,s){const a=n.type==="block-map"?zft(e,t,n,r,s):n.type==="block-seq"?Vft(e,t,n,r,s):Hft(e,t,n,r,s),l=a.constructor;return i==="!"||i===l.tagName?(a.tag=l.tagName,a):(i&&(a.tag=i),a)}function qft(e,t,n,r,i){var h;const s=r.tag,a=s?t.directives.tagName(s.source,m=>i(s,"TAG_RESOLVE_FAILED",m)):null;if(n.type==="block-seq"){const{anchor:m,newlineAfterProp:g}=r,b=m&&s?m.offset>s.offset?m:s:m??s;b&&(!g||g.offsetm.tag===a&&m.collection===l);if(!c){const m=t.schema.knownTags[a];if((m==null?void 0:m.collection)===l)t.schema.tags.push(Object.assign({},m,{default:!1})),c=m;else return m?i(s,"BAD_COLLECTION_TYPE",`${m.tag} used for ${l} collection, but expects ${m.collection??"scalar"}`,!0):i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),jD(e,t,n,i,a)}const u=jD(e,t,n,i,a,c),d=((h=c.resolve)==null?void 0:h.call(c,u,m=>i(s,"TAG_RESOLVE_FAILED",m),t.options))??u,f=As(d)?d:new Fn(d);return f.range=u.range,f.tag=a,c!=null&&c.format&&(f.format=c.format),f}function Xft(e,t,n){const r=t.offset,i=Gft(t,e.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};const s=i.mode===">"?Fn.BLOCK_FOLDED:Fn.BLOCK_LITERAL,a=t.source?Wft(t.source):[];let l=a.length;for(let b=a.length-1;b>=0;--b){const y=a[b][1];if(y===""||y==="\r")l=b;else break}if(l===0){const b=i.chomp==="+"&&a.length>0?` `.repeat(Math.max(1,a.length-1)):"";let y=r+i.length;return t.source&&(y+=t.source.length),{value:b,type:s,comment:i.comment,range:[r,y,y]}}let c=t.indent+i.indent,u=t.offset+i.length,d=0;for(let b=0;bc&&(c=y.length);else{y.length=l;--b)a[b][0].length>c&&(l=b+1);let f="",h="",m=!1;for(let b=0;bc||O[0]===" "?(h===" "?h=` @@ -640,66 +640,66 @@ ${u} `+a[b][0].slice(c);f[f.length-1]!==` `&&(f+=` `);break;default:f+=` -`}const g=r+i.length+t.source.length;return{value:f,type:s,comment:i.comment,range:[r,g,g]}}function Wft({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:i}=t[0],s=i[0];let a=0,l="",c=-1;for(let h=1;hn(r+h,m,g);switch(i){case"scalar":l=Fn.PLAIN,c=Kft(s,u);break;case"single-quoted-scalar":l=Fn.QUOTE_SINGLE,c=Jft(s,u);break;case"double-quoted-scalar":l=Fn.QUOTE_DOUBLE,c=eht(s,u);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[r,r+s.length,r+s.length]}}const d=r+s.length,f=PE(a,d,t,n);return{value:c,type:l,comment:f.comment,range:[r,d,f.offset]}}function Kft(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}`),fbe(e)}function Jft(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),fbe(e.slice(1,-1)).replace(/''/g,"'")}function fbe(e){let t,n;try{t=new RegExp(`(.*?)(?n(r+h,m,g);switch(i){case"scalar":l=Fn.PLAIN,c=Zft(s,u);break;case"single-quoted-scalar":l=Fn.QUOTE_SINGLE,c=Kft(s,u);break;case"double-quoted-scalar":l=Fn.QUOTE_DOUBLE,c=Jft(s,u);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[r,r+s.length,r+s.length]}}const d=r+s.length,f=LE(a,d,t,n);return{value:c,type:l,comment:f.comment,range:[r,d,f.offset]}}function Zft(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}`),fbe(e)}function Kft(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),fbe(e.slice(1,-1)).replace(/''/g,"'")}function fbe(e){let t,n;try{t=new RegExp(`(.*?)(?s?e.slice(s,r+1):i)}else n+=i}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function tht(e,t){let n="",r=e[t+1];for(;(r===" "||r===" "||r===` +`)&&(n+=r>s?e.slice(s,r+1):i)}else n+=i}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function eht(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 nht={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function rht(e,t,n,r){const i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{const l=e.substr(t-2,n+2);return r(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${l}`),l}}function hbe(e,t,n,r){const{value:i,type:s,comment:a,range:l}=t.type==="block-scalar"?Gft(e,t,r):Zft(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[Od]:c?u=iht(e.schema,i,c,n,r):t.type==="scalar"?u=sht(e,i,t,r):u=e.schema[Od];let d;try{const f=u.resolve(i,h=>r(n??t,"TAG_RESOLVE_FAILED",h),e.options);d=Ai(f)?f:new Fn(f)}catch(f){const h=f instanceof Error?f.message:String(f);r(n??t,"TAG_RESOLVE_FAILED",h),d=new Fn(i)}return d.range=l,d.source=i,s&&(d.type=s),c&&(d.tag=c),u.format&&(d.format=u.format),a&&(d.comment=a),d}function iht(e,t,n,r,i){var l;if(n==="!")return e[Od];const s=[];for(const c of e.tags)if(!c.collection&&c.tag===n)if(c.default&&c.test)s.push(c);else return c;for(const c of s)if((l=c.test)!=null&&l.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):(i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[Od])}function sht({atKey:e,directives:t,schema:n},r,i,s){const a=n.tags.find(l=>{var c;return(l.default===!0||e&&l.default==="key")&&((c=l.test)==null?void 0:c.test(r))})||n[Od];if(n.compat){const l=n.compat.find(c=>{var u;return c.default&&((u=c.test)==null?void 0:u.test(r))})??n[Od];if(a.tag!==l.tag){const c=t.tagString(a.tag),u=t.tagString(l.tag),d=`Value may be parsed as either ${c} or ${u}`;s(i,"TAG_RESOLVE_FAILED",d,!0)}}return a}function aht(e,t,n){if(t){n??(n=t.length);for(let r=n-1;r>=0;--r){let i=t[r];switch(i.type){case"space":case"comment":case"newline":e-=i.source.length;continue}for(i=t[++r];(i==null?void 0:i.type)==="space";)e+=i.source.length,i=t[++r];break}}return e}const oht={composeNode:pbe,composeEmptyNode:tQ};function pbe(e,t,n,r){const i=e.atKey,{spaceBefore:s,comment:a,anchor:l,tag:c}=n;let u,d=!0;switch(t.type){case"alias":u=lht(e,t,r),(l||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=hbe(e,t,c,r),l&&(u.anchor=l.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=Xft(oht,e,t,n,r),l&&(u.anchor=l.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=tQ(e,t.offset,void 0,null,n,r)),l&&u.anchor===""&&r(l,"BAD_ALIAS","Anchor cannot be an empty string"),i&&e.options.stringKeys&&(!Ai(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"),s&&(u.spaceBefore=!0),a&&(t.type==="scalar"&&t.source===""?u.comment=a:u.commentBefore=a),e.options.keepSourceTokens&&d&&(u.srcToken=t),u}function tQ(e,t,n,r,{spaceBefore:i,comment:s,anchor:a,tag:l,end:c},u){const d={type:"scalar",offset:aht(t,n,r),indent:-1,source:""},f=hbe(e,d,l,u);return a&&(f.anchor=a.source.substring(1),f.anchor===""&&u(a,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(f.spaceBefore=!0),s&&(f.comment=s,f.range[2]=c),f}function lht({options:e},{offset:t,source:n,end:r},i){const s=new VB(n.substring(1));s.source===""&&i(t,"BAD_ALIAS","Alias cannot be an empty string"),s.source.endsWith(":")&&i(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const a=t+n.length,l=PE(r,a,e.strict,i);return s.range=[t,a,l.offset],l.comment&&(s.comment=l.comment),s}function cht(e,t,{offset:n,start:r,value:i,end:s},a){const l=Object.assign({_directives:t},e),c=new DE(void 0,l),u={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=b1(r,{indicator:"doc-start",next:i??(s==null?void 0:s[0]),offset:n,onError:a,parentIndent:0,startOnNewline:!0});d.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!d.hasNewline&&a(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?pbe(u,i,d,a):tQ(u,d.end,r,null,d,a);const f=c.contents.range[2],h=PE(s,f,!1,a);return h.comment&&(c.comment=h.comment),c.range=[n,f,h.offset],c}function fx(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 nY(e){var i;let t="",n=!1,r=!1;for(let s=0;sr(n,"TAG_RESOLVE_FAILED",f)):null;let u;e.options.stringKeys&&e.atKey?u=e.schema[vd]:c?u=rht(e.schema,i,c,n,r):t.type==="scalar"?u=iht(e,i,t,r):u=e.schema[vd];let d;try{const f=u.resolve(i,h=>r(n??t,"TAG_RESOLVE_FAILED",h),e.options);d=Ri(f)?f:new Fn(f)}catch(f){const h=f instanceof Error?f.message:String(f);r(n??t,"TAG_RESOLVE_FAILED",h),d=new Fn(i)}return d.range=l,d.source=i,s&&(d.type=s),c&&(d.tag=c),u.format&&(d.format=u.format),a&&(d.comment=a),d}function rht(e,t,n,r,i){var l;if(n==="!")return e[vd];const s=[];for(const c of e.tags)if(!c.collection&&c.tag===n)if(c.default&&c.test)s.push(c);else return c;for(const c of s)if((l=c.test)!=null&&l.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):(i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[vd])}function iht({atKey:e,directives:t,schema:n},r,i,s){const a=n.tags.find(l=>{var c;return(l.default===!0||e&&l.default==="key")&&((c=l.test)==null?void 0:c.test(r))})||n[vd];if(n.compat){const l=n.compat.find(c=>{var u;return c.default&&((u=c.test)==null?void 0:u.test(r))})??n[vd];if(a.tag!==l.tag){const c=t.tagString(a.tag),u=t.tagString(l.tag),d=`Value may be parsed as either ${c} or ${u}`;s(i,"TAG_RESOLVE_FAILED",d,!0)}}return a}function sht(e,t,n){if(t){n??(n=t.length);for(let r=n-1;r>=0;--r){let i=t[r];switch(i.type){case"space":case"comment":case"newline":e-=i.source.length;continue}for(i=t[++r];(i==null?void 0:i.type)==="space";)e+=i.source.length,i=t[++r];break}}return e}const aht={composeNode:pbe,composeEmptyNode:tQ};function pbe(e,t,n,r){const i=e.atKey,{spaceBefore:s,comment:a,anchor:l,tag:c}=n;let u,d=!0;switch(t.type){case"alias":u=oht(e,t,r),(l||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=hbe(e,t,c,r),l&&(u.anchor=l.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=qft(aht,e,t,n,r),l&&(u.anchor=l.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=tQ(e,t.offset,void 0,null,n,r)),l&&u.anchor===""&&r(l,"BAD_ALIAS","Anchor cannot be an empty string"),i&&e.options.stringKeys&&(!Ri(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"),s&&(u.spaceBefore=!0),a&&(t.type==="scalar"&&t.source===""?u.comment=a:u.commentBefore=a),e.options.keepSourceTokens&&d&&(u.srcToken=t),u}function tQ(e,t,n,r,{spaceBefore:i,comment:s,anchor:a,tag:l,end:c},u){const d={type:"scalar",offset:sht(t,n,r),indent:-1,source:""},f=hbe(e,d,l,u);return a&&(f.anchor=a.source.substring(1),f.anchor===""&&u(a,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(f.spaceBefore=!0),s&&(f.comment=s,f.range[2]=c),f}function oht({options:e},{offset:t,source:n,end:r},i){const s=new VB(n.substring(1));s.source===""&&i(t,"BAD_ALIAS","Alias cannot be an empty string"),s.source.endsWith(":")&&i(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const a=t+n.length,l=LE(r,a,e.strict,i);return s.range=[t,a,l.offset],l.comment&&(s.comment=l.comment),s}function lht(e,t,{offset:n,start:r,value:i,end:s},a){const l=Object.assign({_directives:t},e),c=new ME(void 0,l),u={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=b1(r,{indicator:"doc-start",next:i??(s==null?void 0:s[0]),offset:n,onError:a,parentIndent:0,startOnNewline:!0});d.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!d.hasNewline&&a(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?pbe(u,i,d,a):tQ(u,d.end,r,null,d,a);const f=c.contents.range[2],h=LE(s,f,!1,a);return h.comment&&(c.comment=h.comment),c.range=[n,f,h.offset],c}function fx(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 nY(e){var i;let t="",n=!1,r=!1;for(let s=0;s{const a=fx(n);s?this.warnings.push(new zft(a,r,i)):this.errors.push(new Zx(a,r,i))},this.directives=new ho({version:t.version||"1.2"}),this.options=t}decorate(t,n){const{comment:r,afterEmptyLine:i}=nY(this.prelude);if(r){const s=t.contents;if(n)t.comment=t.comment?`${t.comment} +`)+(a.substring(1)||" "),n=!0,r=!1;break;case"%":((i=e[s+1])==null?void 0:i[0])!=="#"&&(s+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}let cht=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,r,i,s)=>{const a=fx(n);s?this.warnings.push(new Fft(a,r,i)):this.errors.push(new Zx(a,r,i))},this.directives=new go({version:t.version||"1.2"}),this.options=t}decorate(t,n){const{comment:r,afterEmptyLine:i}=nY(this.prelude);if(r){const s=t.contents;if(n)t.comment=t.comment?`${t.comment} ${r}`:r;else if(i||t.directives.docStart||!s)t.commentBefore=r;else if(Ts(s)&&!s.flow&&s.items.length>0){let a=s.items[0];Ns(a)&&(a=a.key);const l=a.commentBefore;a.commentBefore=l?`${r} ${l}`:r}else{const a=s.commentBefore;s.commentBefore=a?`${r} -${a}`:r}}if(n){for(let s=0;s{const s=fx(t);s[0]+=n,this.onError(s,"BAD_DIRECTIVE",r,i)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{const n=cht(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 Zx(fx(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 Zx(fx(t),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;const n=PE(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 Zx(fx(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),i=new DE(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,n,n],this.decorate(i,!1),yield i}}};const mbe="\uFEFF",gbe="",bbe="",AL="";function dht(e){switch(e){case mbe:return"byte-order-mark";case gbe:return"doc-mode";case bbe:return"flow-error-end";case AL:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` +${a}`:r}}if(n){for(let s=0;s{const s=fx(t);s[0]+=n,this.onError(s,"BAD_DIRECTIVE",r,i)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{const n=lht(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 Zx(fx(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 Zx(fx(t),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;const n=LE(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 Zx(fx(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),i=new ME(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,n,n],this.decorate(i,!1),yield i}}};const mbe="\uFEFF",gbe="",bbe="",AL="";function uht(e){switch(e){case mbe:return"byte-order-mark";case gbe:return"doc-mode";case bbe:return"flow-error-end";case AL: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 Zc(e){switch(e){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}const rY=new Set("0123456789ABCDEFabcdef"),fht=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),D2=new Set(",[]{}"),hht=new Set(` ,[]{} -\r `),RD=e=>!e||hht.has(e);class pht{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===` +`: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 Jc(e){switch(e){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}const rY=new Set("0123456789ABCDEFabcdef"),dht=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),M2=new Set(",[]{}"),fht=new Set(` ,[]{} +\r `),RD=e=>!e||fht.has(e);class hht{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 i=this.buffer[r+t+1];if(i===` `||!i&&!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==="...")&&Zc(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&tthis.indentValue&&!Zc(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===":")&&Zc(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(RD),"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 i=this.getLine();if(i===null)return this.setNext("flow");if((r!==-1&&r=this.indentNext||!n&&!this.atEnd?t+r:-1}if(n==="-"||n==="."){const r=this.buffer.substr(t,3);if((r==="---"||r==="...")&&Jc(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&tthis.indentValue&&!Jc(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===":")&&Jc(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(RD),"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 i=this.getLine();if(i===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=>Zc(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,r;e:for(let s=this.pos;r=this.buffer[s];++s)switch(r){case" ":n+=1;break;case` +`,s)}i!==-1&&(n=i-(r[i-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){const n=this.buffer[++t];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>Jc(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,r;e:for(let s=this.pos;r=this.buffer[s];++s)switch(r){case" ":n+=1;break;case` `:t=s,n=0;break;case"\r":{const a=this.buffer[s+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 s=this.continueScalar(t+1);if(s===-1)break;t=this.buffer.indexOf(` `,s)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let i=t+1;for(r=this.buffer[i];r===" ";)r=this.buffer[++i];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===` `;)r=this.buffer[++i];t=i-1}else if(!this.blockScalarKeep)do{let s=t-1,a=this.buffer[s];a==="\r"&&(a=this.buffer[--s]);const l=s;for(;a===" ";)a=this.buffer[--s];if(a===` -`&&s>=this.pos&&s+1+n>l)t=s;else break}while(!0);return yield AL,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const t=this.flowLevel>0;let n=this.pos-1,r=this.pos-1,i;for(;i=this.buffer[++r];)if(i===":"){const s=this.buffer[r+1];if(Zc(s)||t&&D2.has(s))break;n=r}else if(Zc(i)){let s=this.buffer[r+1];if(i==="\r"&&(s===` +`&&s>=this.pos&&s+1+n>l)t=s;else break}while(!0);return yield AL,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const t=this.flowLevel>0;let n=this.pos-1,r=this.pos-1,i;for(;i=this.buffer[++r];)if(i===":"){const s=this.buffer[r+1];if(Jc(s)||t&&M2.has(s))break;n=r}else if(Jc(i)){let s=this.buffer[r+1];if(i==="\r"&&(s===` `?(r+=1,i=` -`,s=this.buffer[r+1]):n=r),s==="#"||t&&D2.has(s))break;if(i===` -`){const a=this.continueScalar(r+1);if(a===-1)break;r=Math.max(r,a-2)}}else{if(t&&D2.has(i))break;n=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield AL,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(RD),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{const n=this.flowLevel>0,r=this.charAt(1);if(Zc(r)||n&&D2.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(;!Zc(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(fht.has(n))n=this.buffer[++t];else if(n==="%"&&rY.has(this.buffer[t+1])&&rY.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===` +`,s=this.buffer[r+1]):n=r),s==="#"||t&&M2.has(s))break;if(i===` +`){const a=this.continueScalar(r+1);if(a===-1)break;r=Math.max(r,a-2)}}else{if(t&&M2.has(i))break;n=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield AL,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(RD),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{const n=this.flowLevel>0,r=this.charAt(1);if(Jc(r)||n&&M2.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(;!Jc(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(dht.has(n))n=this.buffer[++t];else if(n==="%"&&rY.has(this.buffer[t+1])&&rY.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 i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(t){let n=this.pos,r=this.buffer[n];for(;!t(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}}class mht{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[s]=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 uA(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"&&sY(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{const i=r.items[r.items.length-1];if(i.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=n;else{Object.assign(i,{key:n,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{const i=r.items[r.items.length-1];i.value?r.items.push({start:[],value:n}):i.value=n;break}case"flow-collection":{const i=r.items[r.items.length-1];!i||i.value?r.items.push({start:[],key:n,sep:[]}):i.sep?i.value=n:Object.assign(i,{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 i=n.items[n.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&iY(i.start)===-1&&(n.indent===0||i.start.every(s=>s.type!=="comment"||s.indent0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(t){let n=this.pos,r=this.buffer[n];for(;!t(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}}class pht{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[s]=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 uA(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"&&sY(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{const i=r.items[r.items.length-1];if(i.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=n;else{Object.assign(i,{key:n,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{const i=r.items[r.items.length-1];i.value?r.items.push({start:[],value:n}):i.value=n;break}case"flow-collection":{const i=r.items[r.items.length-1];!i||i.value?r.items.push({start:[],key:n,sep:[]}):i.sep?i.value=n:Object.assign(i,{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 i=n.items[n.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&iY(i.start)===-1&&(n.indent===0||i.start.every(s=>s.type!=="comment"||s.indent=t.indent){const i=!this.onKeyLine&&this.indent===t.indent,s=i&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind";let a=[];if(s&&n.sep&&!n.value){const l=[];for(let c=0;ct.indent&&(l.length=0);break;default:l.length=0}}l.length>=2&&(a=n.sep.splice(l[1]))}switch(this.type){case"anchor":case"tag":s||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):s||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(Zh(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(ybe(n.key)&&!Zh(n.sep,"newline")){const l=tb(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:l,key:c,sep:u}]})}else a.length>0?n.sep=n.sep.concat(a,this.sourceToken):n.sep.push(this.sourceToken);else if(Zh(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const l=tb(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:l,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||s?t.items.push({start:a,key:null,sep:[this.sourceToken]}):Zh(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 l=this.flowScalar(this.type);s||n.value?(t.items.push({start:a,key:l,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(l):(Object.assign(n,{key:l,sep:[]}),this.onKeyLine=!0);return}default:{const l=this.startBlockValue(t);if(l){if(l.type==="block-seq"){if(!n.explicitKey&&n.sep&&!Zh(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 i&&t.items.push({start:a});this.stack.push(l);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 i="end"in n.value?n.value.end:void 0,s=Array.isArray(i)?i[i.length-1]:void 0;(s==null?void 0:s.type)==="comment"?i==null||i.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 i=t.items[t.items.length-2],s=(r=i==null?void 0:i.value)==null?void 0:r.end;if(Array.isArray(s)){uA(s,n.start),s.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||Zh(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){const i=this.startBlockValue(t);if(i){this.stack.push(i);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 i=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{key:i,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 i=P2(r),s=tb(i);sY(t);const a=t.end.splice(1,t.end.length);a.push(this.sourceToken);const l={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:s,key:t,sep:a}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=l}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 i="end"in n.value?n.value.end:void 0,s=Array.isArray(i)?i[i.length-1]:void 0;(s==null?void 0:s.type)==="comment"?i==null||i.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 i=t.items[t.items.length-2],s=(r=i==null?void 0:i.value)==null?void 0:r.end;if(Array.isArray(s)){uA(s,n.start),s.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=t.indent){const i=!this.onKeyLine&&this.indent===t.indent,s=i&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind";let a=[];if(s&&n.sep&&!n.value){const l=[];for(let c=0;ct.indent&&(l.length=0);break;default:l.length=0}}l.length>=2&&(a=n.sep.splice(l[1]))}switch(this.type){case"anchor":case"tag":s||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):s||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(Zh(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(ybe(n.key)&&!Zh(n.sep,"newline")){const l=tb(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:l,key:c,sep:u}]})}else a.length>0?n.sep=n.sep.concat(a,this.sourceToken):n.sep.push(this.sourceToken);else if(Zh(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const l=tb(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:l,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||s?t.items.push({start:a,key:null,sep:[this.sourceToken]}):Zh(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 l=this.flowScalar(this.type);s||n.value?(t.items.push({start:a,key:l,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(l):(Object.assign(n,{key:l,sep:[]}),this.onKeyLine=!0);return}default:{const l=this.startBlockValue(t);if(l){if(l.type==="block-seq"){if(!n.explicitKey&&n.sep&&!Zh(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 i&&t.items.push({start:a});this.stack.push(l);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 i="end"in n.value?n.value.end:void 0,s=Array.isArray(i)?i[i.length-1]:void 0;(s==null?void 0:s.type)==="comment"?i==null||i.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 i=t.items[t.items.length-2],s=(r=i==null?void 0:i.value)==null?void 0:r.end;if(Array.isArray(s)){uA(s,n.start),s.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||Zh(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){const i=this.startBlockValue(t);if(i){this.stack.push(i);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 i=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{key:i,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 i=L2(r),s=tb(i);sY(t);const a=t.end.splice(1,t.end.length);a.push(this.sourceToken);const l={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:s,key:t,sep:a}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=l}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=P2(t),r=tb(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=P2(t),r=tb(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 bht(e){const t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new mht||null,prettyErrors:t}}function Obe(e,t={}){const{lineCounter:n,prettyErrors:r}=bht(t),i=new ght(n==null?void 0:n.addNewLine),s=new uht(t);let a=null;for(const l of s.compose(i.parse(e),!0,e.length))if(!a)a=l;else if(a.options.logLevel!=="silent"){a.errors.push(new Zx(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(a.errors.forEach(eY(e,n)),a.warnings.forEach(eY(e,n))),a}function yht(e,t,n){let r;const i=Obe(e,n);if(!i)return null;if(i.warnings.forEach(s=>z0e(i.options.logLevel,s)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function nQ(e,t,n){let r=null;if(typeof t=="function"||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n=="string"&&(n=n.length),typeof n=="number"){const i=Math.round(n);n=i<1?void 0:i>8?{indent:8}:{indent:i}}if(e===void 0){const{keepUndefined:i}=n??t??{};if(!i)return}return NE(e)&&!r?e.toString(n):new DE(e,r,n).toString(n)}const xbe=1024;let Oht=0,Tc=class{constructor(t,n){this.from=t,this.to=n}};class Nn{constructor(t={}){this.id=Oht++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=t.combine||null}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof t!="function"&&(t=Hs.match(t)),n=>{let r=t(n);return r===void 0?null:[this,r]}}}Nn.closedBy=new Nn({deserialize:e=>e.split(" ")});Nn.openedBy=new Nn({deserialize:e=>e.split(" ")});Nn.group=new Nn({deserialize:e=>e.split(" ")});Nn.isolate=new Nn({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});Nn.contextHash=new Nn({perNode:!0});Nn.lookAhead=new Nn({perNode:!0});Nn.mounted=new Nn({perNode:!0});class Sy{constructor(t,n,r,i=!1){this.tree=t,this.overlay=n,this.parser=r,this.bracketed=i}static get(t){return t&&t.props&&t.props[Nn.mounted.id]}}const xht=Object.create(null);class Hs{constructor(t,n,r,i=0){this.name=t,this.props=n,this.id=r,this.flags=i}static define(t){let n=t.props&&t.props.length?Object.create(null):xht,r=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new Hs(t.name||"",n,t.id,r);if(t.props){for(let s of t.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[s[0].id]=s[1]}}return i}prop(t){return this.props[t.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(t){if(typeof t=="string"){if(this.name==t)return!0;let n=this.prop(Nn.group);return n?n.indexOf(t)>-1:!1}return this.id==t}static match(t){let n=Object.create(null);for(let r in t)for(let i of r.split(" "))n[i]=t[r];return r=>{for(let i=r.prop(Nn.group),s=-1;s<(i?i.length:0);s++){let a=n[s<0?r.name:i[s]];if(a)return a}}}}Hs.none=new Hs("",Object.create(null),0,8);class bO{constructor(t){this.types=t;for(let n=0;n0;for(let c=this.cursor(a|Qr.IncludeAnonymous);;){let u=!1;if(c.from<=s&&c.to>=i&&(!l&&c.type.isAnonymous||n(c)!==!1)){if(c.firstChild())continue;u=!0}for(;u&&r&&(l||!c.type.isAnonymous)&&r(c),!c.nextSibling();){if(!c.parent())return;u=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let n in this.props)t.push([+n,this.props[n]]);return t}balance(t={}){return this.children.length<=8?this:sQ(Hs.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new cr(this.type,n,r,i,this.propValues),t.makeTree||((n,r,i)=>new cr(Hs.none,n,r,i)))}static build(t){return Eht(t)}}cr.empty=new cr(Hs.none,[],[],0);class rQ{constructor(t,n){this.buffer=t,this.index=n}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 rQ(this.buffer,this.index)}}class Zp{constructor(t,n,r){this.buffer=t,this.length=n,this.set=r}get type(){return Hs.none}toString(){let t=[];for(let n=0;n0));c=a[c+3]);return l}slice(t,n,r){let i=this.buffer,s=new Uint16Array(n-t),a=0;for(let l=t,c=0;l=t&&nt;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function Jw(e,t,n,r){for(var i;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to0?l.length:-1;t!=u;t+=n){let d=l[t],f=c[t]+a.from,h;if(!(!(s&Qr.EnterBracketed&&d instanceof cr&&(h=Sy.get(d))&&!h.overlay&&h.bracketed&&r>=f&&r<=f+d.length)&&!vbe(i,r,f,f+d.length))){if(d instanceof Zp){if(s&Qr.ExcludeBuffers)continue;let m=d.findChild(0,d.buffer.length,n,r-f,i);if(m>-1)return new rd(new vht(a,d,t,f),null,m)}else if(s&Qr.IncludeAnonymous||!d.type.isAnonymous||iQ(d)){let m;if(!(s&Qr.IgnoreMounts)&&(m=Sy.get(d))&&!m.overlay)return new to(m.tree,f,t,a);let g=new to(d,f,t,a);return s&Qr.IncludeAnonymous||!g.type.isAnonymous?g:g.nextChild(n<0?d.children.length-1:0,n,r,i,s)}}}if(s&Qr.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?t=a.index+n:t=n<0?-1:a._parent._tree.children.length,a=a._parent,!a))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(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}prop(t){return this._tree.prop(t)}enter(t,n,r=0){let i;if(!(r&Qr.IgnoreOverlays)&&(i=Sy.get(this._tree))&&i.overlay){let s=t-this.from,a=r&Qr.EnterBracketed&&i.bracketed;for(let{from:l,to:c}of i.overlay)if((n>0||a?l<=s:l=s:c>s))return new to(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,n,r)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}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 oY(e,t,n,r){let i=e.cursor(),s=[];if(!i.firstChild())return s;if(n!=null){for(let a=!1;!a;)if(a=i.type.is(n),!i.nextSibling())return s}for(;;){if(r!=null&&i.type.is(r))return s;if(i.type.is(t)&&s.push(i.node),!i.nextSibling())return r==null?s:[]}}function NL(e,t,n=t.length-1){for(let r=e;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}class vht{constructor(t,n,r,i){this.parent=t,this.buffer=n,this.index=r,this.start=i}}class rd extends wbe{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(t,n,r){super(),this.context=t,this._parent=n,this.index=r,this.type=t.buffer.set.types[t.buffer.buffer[r]]}child(t,n,r){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],t,n-this.context.start,r);return s<0?null:new rd(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}prop(t){return this.type.prop(t)}enter(t,n,r=0){if(r&Qr.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return s<0?null:new rd(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,n=t.buffer[this.index+3];return n<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new rd(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new rd(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],n=[],{buffer:r}=this.context,i=this.index+4,s=r.buffer[this.index+3];if(s>i){let a=r.buffer[this.index+1];t.push(r.slice(i,s,a)),n.push(0)}return new cr(this.type,t,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Sbe(e){if(!e.length)return null;let t=0,n=e[0];for(let s=1;sn.from||a.to=t){let l=new to(a.tree,a.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(Jw(l,t,n,!1))}}return i?Sbe(i):r}class dA{get name(){return this.type.name}constructor(t,n=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=n&~Qr.EnterBracketed,t instanceof to)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let r=t._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,n){this.index=t;let{start:r,buffer:i}=this.buffer;return this.type=n||i.set.types[i.buffer[t]],this.from=r+i.buffer[t+1],this.to=r+i.buffer[t+2],!0}yield(t){return t?t instanceof to?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,n,r,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],t,n-this.buffer.start,r);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(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,n,r=this.mode){return this.buffer?r&Qr.ExcludeBuffers?!1:this.enterChild(1,t,n):this.yield(this._tree.enter(t,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Qr.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&Qr.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(t<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(n.findChild(i,this.index,-1,0,4))}else{let i=n.buffer[this.index+3];if(i<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(i)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let n,r,{buffer:i}=this;if(i){if(t>0){if(this.index-1)for(let s=n+t,a=t<0?-1:r._tree.children.length;s!=a;s+=t){let l=r._tree.children[s];if(this.mode&Qr.IncludeAnonymous||l instanceof Zp||!l.type.isAnonymous||iQ(l))return!1}return!0}move(t,n){if(n&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,n=0){for(;(this.from==this.to||(n<1?this.from>=t:this.from>t)||(n>-1?this.to<=t:this.to=0;){for(let a=t;a;a=a._parent)if(a.index==i){if(i==this.index)return a;n=a,r=s+1;break e}i=this.stack[--s]}for(let i=r;i=0;s--){if(s<0)return NL(this._tree,t,i);let a=r[n.buffer[this.stack[s]]];if(!a.isAnonymous){if(t[i]&&t[i]!=a.name)return!1;i--}}return!0}}function iQ(e){return e.children.some(t=>t instanceof Zp||!t.type.isAnonymous||iQ(t))}function Eht(e){var t;let{buffer:n,nodeSet:r,maxBufferLength:i=xbe,reused:s=[],minRepeatType:a=r.types.length}=e,l=Array.isArray(n)?new rQ(n,n.length):n,c=r.types,u=0,d=0;function f(S,E,k,_,C,T){let{id:A,start:j,end:L,size:I}=l,M=d,N=u;if(I<0)if(l.next(),I==-1){let H=s[A];k.push(H),_.push(j-S);return}else if(I==-3){u=A;return}else if(I==-4){d=A;return}else throw new RangeError(`Unrecognized record size: ${I}`);let D=c[A],Q,F,$=j-S;if(L-j<=i&&(F=y(l.pos-E,C))){let H=new Uint16Array(F.size-F.skip),z=l.pos-F.size,B=H.length;for(;l.pos>z;)B=O(F.start,H,B);Q=new Zp(H,L-F.start,r),$=F.start-S}else{let H=l.pos-I;l.next();let z=[],B=[],V=A>=a?A:-1,Z=0,ce=L;for(;l.pos>H;)V>=0&&l.id==V&&l.size>=0?(l.end<=ce-i&&(g(z,B,j,Z,l.end,ce,V,M,N),Z=z.length,ce=l.end),l.next()):T>2500?h(j,H,z,B):f(j,H,z,B,V,T+1);if(V>=0&&Z>0&&Z-1&&Z>0){let be=m(D,N);Q=sQ(D,z,B,0,z.length,0,L-j,be,be)}else Q=b(D,z,B,L-j,M-L,N)}k.push(Q),_.push($)}function h(S,E,k,_){let C=[],T=0,A=-1;for(;l.pos>E;){let{id:j,start:L,end:I,size:M}=l;if(M>4)l.next();else{if(A>-1&&L=0;I-=3)j[M++]=C[I],j[M++]=C[I+1]-L,j[M++]=C[I+2]-L,j[M++]=M;k.push(new Zp(j,C[2]-L,r)),_.push(L-S)}}function m(S,E){return(k,_,C)=>{let T=0,A=k.length-1,j,L;if(A>=0&&(j=k[A])instanceof cr){if(!A&&j.type==S&&j.length==C)return j;(L=j.prop(Nn.lookAhead))&&(T=_[A]+j.length+L)}return b(S,k,_,C,T,E)}}function g(S,E,k,_,C,T,A,j,L){let I=[],M=[];for(;S.length>_;)I.push(S.pop()),M.push(E.pop()+k-C);S.push(b(r.types[A],I,M,T-C,j-T,L)),E.push(C-k)}function b(S,E,k,_,C,T,A){if(T){let j=[Nn.contextHash,T];A=A?[j].concat(A):[j]}if(C>25){let j=[Nn.lookAhead,C];A=A?[j].concat(A):[j]}return new cr(S,E,k,_,A)}function y(S,E){let k=l.fork(),_=0,C=0,T=0,A=k.end-i,j={size:0,start:0,skip:0};e:for(let L=k.pos-S;k.pos>L;){let I=k.size;if(k.id==E&&I>=0){j.size=_,j.start=C,j.skip=T,T+=4,_+=4,k.next();continue}let M=k.pos-I;if(I<0||M=a?4:0,D=k.start;for(k.next();k.pos>M;){if(k.size<0)if(k.size==-3||k.size==-4)N+=4;else break e;else k.id>=a&&(N+=4);k.next()}C=D,_+=I,T+=N}return(E<0||_==S)&&(j.size=_,j.start=C,j.skip=T),j.size>4?j:void 0}function O(S,E,k){let{id:_,start:C,end:T,size:A}=l;if(l.next(),A>=0&&_4){let L=l.pos-(A-4);for(;l.pos>L;)k=O(S,E,k)}E[--k]=j,E[--k]=T-S,E[--k]=C-S,E[--k]=_}else A==-3?u=_:A==-4&&(d=_);return k}let v=[],x=[];for(;l.pos>0;)f(e.start||0,e.bufferStart||0,v,x,-1,0);let w=(t=e.length)!==null&&t!==void 0?t:v.length?x[0]+v[0].length:0;return new cr(c[e.topID],v.reverse(),x.reverse(),w)}const lY=new WeakMap;function hT(e,t){if(!e.isAnonymous||t instanceof Zp||t.type!=e)return 1;let n=lY.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof cr)){n=1;break}n+=hT(e,r)}lY.set(t,n)}return n}function sQ(e,t,n,r,i,s,a,l,c){let u=0;for(let g=r;g=d)break;E+=k}if(x==w+1){if(E>d){let k=g[w];m(k.children,k.positions,0,k.children.length,b[w]+v);continue}f.push(g[w])}else{let k=b[x-1]+g[x-1].length-S;f.push(sQ(e,g,b,w,x,S,k,null,c))}h.push(S+v-s)}}return m(t,n,r,i,0),(l||c)(f,h,a)}class aQ{constructor(){this.map=new WeakMap}setBuffer(t,n,r){let i=this.map.get(t);i||this.map.set(t,i=new Map),i.set(n,r)}getBuffer(t,n){let r=this.map.get(t);return r&&r.get(n)}set(t,n){t instanceof rd?this.setBuffer(t.context.buffer,t.index,n):t instanceof to&&this.map.set(t.tree,n)}get(t){return t instanceof rd?this.getBuffer(t.context.buffer,t.index):t instanceof to?this.map.get(t.tree):void 0}cursorSet(t,n){t.buffer?this.setBuffer(t.buffer.buffer,t.index,n):this.map.set(t.tree,n)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class Uf{constructor(t,n,r,i,s=!1,a=!1){this.from=t,this.to=n,this.tree=r,this.offset=i,this.open=(s?1:0)|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,n=[],r=!1){let i=[new Uf(0,t.length,t,0,!1,r)];for(let s of n)s.to>t.length&&i.push(s);return i}static applyChanges(t,n,r=128){if(!n.length)return t;let i=[],s=1,a=t.length?t[0]:null;for(let l=0,c=0,u=0;;l++){let d=l=r)for(;a&&a.from=h.from||f<=h.to||u){let m=Math.max(h.from,c)-u,g=Math.min(h.to,f)-u;h=m>=g?null:new Uf(m,g,h.tree,h.offset+u,l>0,!!d)}if(h&&i.push(h),a.to>f)break;a=snew Tc(i.from,i.to)):[new Tc(0,0)]:[new Tc(0,t.length)],this.createParse(t,n||[],r)}parse(t,n,r){let i=this.startParse(t,n,r);for(;;){let s=i.advance();if(s)return s}}}class kht{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,n){return this.string.slice(t,n)}}function Ebe(e){return(t,n,r,i)=>new Tht(t,e,n,r,i)}class cY{constructor(t,n,r,i,s,a){this.parser=t,this.parse=n,this.overlay=r,this.bracketed=i,this.target=s,this.from=a}}function uY(e){if(!e.length||e.some(t=>t.from>=t.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(e))}class _ht{constructor(t,n,r,i,s,a,l,c){this.parser=t,this.predicate=n,this.mounts=r,this.index=i,this.start=s,this.bracketed=a,this.target=l,this.prev=c,this.depth=0,this.ranges=[]}}const jL=new Nn({perNode:!0});class Tht{constructor(t,n,r,i,s){this.nest=n,this.input=r,this.fragments=i,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let r=this.baseParse.advance();if(!r)return null;if(this.baseParse=null,this.baseTree=r,this.startInner(),this.stoppedAt!=null)for(let i of this.inner)i.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let r=this.baseTree;return this.stoppedAt!=null&&(r=new cr(r.type,r.children,r.positions,r.length,r.propValues.concat([[jL,this.stoppedAt]]))),r}let t=this.inner[this.innerDone],n=t.parse.advance();if(n){this.innerDone++;let r=Object.assign(Object.create(null),t.target.props);r[Nn.mounted.id]=new Sy(n,t.overlay,t.parser,t.bracketed),t.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let n=this.innerDone;n=this.stoppedAt)l=!1;else if(t.hasNode(i)){if(n){let u=n.mounts.find(d=>d.frag.from<=i.from&&d.frag.to>=i.to&&d.mount.overlay);if(u)for(let d of u.mount.overlay){let f=d.from+u.pos,h=d.to+u.pos;f>=i.from&&h<=i.to&&!n.ranges.some(m=>m.fromf)&&n.ranges.push({from:f,to:h})}}l=!1}else if(r&&(a=Cht(r.ranges,i.from,i.to)))l=a!=2;else if(!i.type.isAnonymous&&(s=this.nest(i,this.input))&&(i.fromnew Tc(f.from-i.from,f.to-i.from)):null,!!s.bracketed,i.tree,d.length?d[0].from:i.from)),s.overlay?d.length&&(r={ranges:d,depth:0,prev:r}):l=!1}}else if(n&&(c=n.predicate(i))&&(c===!0&&(c=new Tc(i.from,i.to)),c.from=0&&n.ranges[u].to==c.from?n.ranges[u]={from:n.ranges[u].from,to:c.to}:n.ranges.push(c)}if(l&&i.firstChild())n&&n.depth++,r&&r.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(n&&!--n.depth){let u=hY(this.ranges,n.ranges);u.length&&(uY(u),this.inner.splice(n.index,0,new cY(n.parser,n.parser.startParse(this.input,pY(n.mounts,u),u),n.ranges.map(d=>new Tc(d.from-n.start,d.to-n.start)),n.bracketed,n.target,u[0].from))),n=n.prev}r&&!--r.depth&&(r=r.prev)}}}}function Cht(e,t,n){for(let r of e){if(r.from>=n)break;if(r.to>t)return r.from<=t&&r.to>=n?2:1}return 0}function dY(e,t,n,r,i,s){if(t=t&&n.enter(r,1,Qr.IgnoreOverlays|Qr.ExcludeBuffers)))if(n.to<=t)n.next(!1)||(this.done=!0);else break}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let n=this.cursor.tree;;){if(n==t.tree)return!0;if(n.children.length&&n.positions[0]==0&&n.children[0]instanceof cr)n=n.children[0];else break}return!1}}let Nht=class{constructor(t){var n;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let r=this.curFrag=t[0];this.curTo=(n=r.tree.prop(jL))!==null&&n!==void 0?n:r.to,this.inner=new fY(r.tree,-r.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let n=this.curFrag=this.fragments[this.fragI];this.curTo=(t=n.tree.prop(jL))!==null&&t!==void 0?t:n.to,this.inner=new fY(n.tree,-n.offset)}}findMounts(t,n){var r;let i=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let s=this.inner.cursor.node;s;s=s.parent){let a=(r=s.tree)===null||r===void 0?void 0:r.prop(Nn.mounted);if(a&&a.parser==n)for(let l=this.fragI;l=s.to)break;c.tree==this.curFrag.tree&&i.push({frag:c,pos:s.from-c.offset,mount:a})}}}return i}};function hY(e,t){let n=null,r=t;for(let i=1,s=0;i=l)break;c.to<=a||(n||(r=n=t.slice()),c.froml&&n.splice(s+1,0,new Tc(l,c.to))):c.to>l?n[s--]=new Tc(l,c.to):n.splice(s--,1))}}return r}function jht(e,t,n,r){let i=0,s=0,a=!1,l=!1,c=-1e9,u=[];for(;;){let d=i==e.length?1e9:a?e[i].to:e[i].from,f=s==t.length?1e9:l?t[s].to:t[s].from;if(a!=l){let h=Math.max(c,n),m=Math.min(d,f,r);hnew Tc(h.from+r,h.to+r)),f=jht(t,d,c,u);for(let h=0,m=c;;h++){let g=h==f.length,b=g?u:f[h].from;if(b>m&&n.push(new Uf(m,b,i.tree,-a,s.from>=m||s.openStart,s.to<=b||s.openEnd)),g)break;m=f[h].to}}else n.push(new Uf(c,u,i.tree,-a,s.from>=a||s.openStart,s.to<=l||s.openEnd))}return n}let RL=[],kbe=[];(()=>{let e="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(t=>t?parseInt(t,36):1);for(let t=0,n=0;t>1;if(e=kbe[r])t=r+1;else return!0;if(t==n)return!1}}function mY(e){return e>=127462&&e<=127487}const gY=8205;function Iht(e,t,n=!0,r=!0){return(n?_be:Dht)(e,t,r)}function _be(e,t,n){if(t==e.length)return t;t&&Tbe(e.charCodeAt(t))&&Cbe(e.charCodeAt(t-1))&&t--;let r=ID(e,t);for(t+=bY(r);t=0&&mY(ID(e,a));)s++,a-=2;if(s%2==0)break;t+=2}else break}return t}function Dht(e,t,n){for(;t>1;){let r=_be(e,t-2,n);if(r=56320&&e<57344}function Cbe(e){return e>=55296&&e<56320}function bY(e){return e<65536?1:2}let Br=class Abe{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,n,r){[t,n]=y1(this,t,n);let i=[];return this.decompose(0,t,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(n,this.length,i,1),Wu.from(i,this.length-(n-t)+r.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,n=this.length){[t,n]=y1(this,t,n);let r=[];return this.decompose(t,n,r,0),Wu.from(r,n-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let n=this.scanIdentical(t,1),r=this.length-this.scanIdentical(t,-1),i=new zv(this),s=new zv(t);for(let a=n,l=n;;){if(i.next(a),s.next(a),a=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(l+=i.value.length,i.done||l>=r)return!0}}iter(t=1){return new zv(this,t)}iterRange(t,n=this.length){return new Nbe(this,t,n)}iterLines(t,n){let r;if(t==null)r=this.iter();else{n==null&&(n=this.lines+1);let i=this.line(t).from;r=this.iterRange(i,Math.max(i,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new jbe(r)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(t.length==0)throw new RangeError("A document must have at least one line");return t.length==1&&!t[0]?Abe.empty:t.length<=32?new Ss(t):Wu.from(Ss.split(t,[]))}};class Ss extends Br{constructor(t,n=Pht(t)){super(),this.text=t,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(t,n,r,i){for(let s=0;;s++){let a=this.text[s],l=i+a.length;if((n?r:l)>=t)return new Mht(i,l,r,a);i=l+1,r++}}decompose(t,n,r,i){let s=t<=0&&n>=this.length?this:new Ss(yY(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let a=r.pop(),l=pT(s.text,a.text.slice(),0,s.length);if(l.length<=32)r.push(new Ss(l,a.length+s.length));else{let c=l.length>>1;r.push(new Ss(l.slice(0,c)),new Ss(l.slice(c)))}}else r.push(s)}replace(t,n,r){if(!(r instanceof Ss))return super.replace(t,n,r);[t,n]=y1(this,t,n);let i=pT(this.text,pT(r.text,yY(this.text,0,t)),n),s=this.length+r.length-(n-t);return i.length<=32?new Ss(i,s):Wu.from(Ss.split(i,[]),s)}sliceString(t,n=this.length,r=` -`){[t,n]=y1(this,t,n);let i="";for(let s=0,a=0;s<=n&&at&&a&&(i+=r),ts&&(i+=l.slice(Math.max(0,t-s),n-s)),s=c+1}return i}flatten(t){for(let n of this.text)t.push(n)}scanIdentical(){return 0}static split(t,n){let r=[],i=-1;for(let s of t)r.push(s),i+=s.length+1,r.length==32&&(n.push(new Ss(r,i)),r=[],i=-1);return i>-1&&n.push(new Ss(r,i)),n}}class Wu extends Br{constructor(t,n){super(),this.children=t,this.length=n,this.lines=0;for(let r of t)this.lines+=r.lines}lineInner(t,n,r,i){for(let s=0;;s++){let a=this.children[s],l=i+a.length,c=r+a.lines-1;if((n?c:l)>=t)return a.lineInner(t,n,r,i);i=l+1,r=c+1}}decompose(t,n,r,i){for(let s=0,a=0;a<=n&&s=a){let u=i&((a<=t?1:0)|(c>=n?2:0));a>=t&&c<=n&&!u?r.push(l):l.decompose(t-a,n-a,r,u)}a=c+1}}replace(t,n,r){if([t,n]=y1(this,t,n),r.lines=s&&n<=l){let c=a.replace(t-s,n-s,r),u=this.lines-a.lines+c.lines;if(c.lines>4&&c.lines>u>>6){let d=this.children.slice();return d[i]=c,new Wu(d,this.length-(n-t)+r.length)}return super.replace(s,l,c)}s=l+1}return super.replace(t,n,r)}sliceString(t,n=this.length,r=` -`){[t,n]=y1(this,t,n);let i="";for(let s=0,a=0;st&&s&&(i+=r),ta&&(i+=l.sliceString(t-a,n-a,r)),a=c+1}return i}flatten(t){for(let n of this.children)n.flatten(t)}scanIdentical(t,n){if(!(t instanceof Wu))return 0;let r=0,[i,s,a,l]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;i+=n,s+=n){if(i==a||s==l)return r;let c=this.children[i],u=t.children[s];if(c!=u)return r+c.scanIdentical(u,n);r+=c.length+1}}static from(t,n=t.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let m of t)r+=m.lines;if(r<32){let m=[];for(let g of t)g.flatten(m);return new Ss(m,n)}let i=Math.max(32,r>>5),s=i<<1,a=i>>1,l=[],c=0,u=-1,d=[];function f(m){let g;if(m.lines>s&&m instanceof Wu)for(let b of m.children)f(b);else m.lines>a&&(c>a||!c)?(h(),l.push(m)):m instanceof Ss&&c&&(g=d[d.length-1])instanceof Ss&&m.lines+g.lines<=32?(c+=m.lines,u+=m.length+1,d[d.length-1]=new Ss(g.text.concat(m.text),g.length+1+m.length)):(c+m.lines>i&&h(),c+=m.lines,u+=m.length+1,d.push(m))}function h(){c!=0&&(l.push(d.length==1?d[0]:Wu.from(d,u)),u=-1,c=d.length=0)}for(let m of t)f(m);return h(),l.length==1?l[0]:new Wu(l,n)}}Br.empty=new Ss([""],0);function Pht(e){let t=-1;for(let n of e)t+=n.length+1;return t}function pT(e,t,n=0,r=1e9){for(let i=0,s=0,a=!0;s=n&&(c>r&&(l=l.slice(0,r-i)),i0?1:(t instanceof Ss?t.text.length:t.children.length)<<1]}nextInner(t,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],s=this.offsets[r],a=s>>1,l=i instanceof Ss?i.text.length:i.children.length;if(a==(n>0?l:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(n>0?0:1)){if(this.offsets[r]+=n,t==0)return this.lineBreak=!0,this.value=` -`,this;t--}else if(i instanceof Ss){let c=i.text[a+(n<0?-1:0)];if(this.offsets[r]+=n,c.length>Math.max(0,t))return this.value=t==0?c:n>0?c.slice(t):c.slice(0,c.length-t),this;t-=c.length}else{let c=i.children[a+(n<0?-1:0)];t>c.length?(t-=c.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(c),this.offsets.push(n>0?1:(c instanceof Ss?c.text.length:c.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class Nbe{constructor(t,n,r){this.value="",this.done=!1,this.cursor=new zv(t,n>r?-1:1),this.pos=n>r?t.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(t,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;t>r&&(t=r),r-=t;let{value:i}=this.cursor.next(t);return this.pos+=(i.length+t)*n,this.value=i.length<=r?i:n<0?i.slice(i.length-r):i.slice(0,r),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class jbe{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:n,lineBreak:r,value:i}=this.inner.next(t);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Br.prototype[Symbol.iterator]=function(){return this.iter()},zv.prototype[Symbol.iterator]=Nbe.prototype[Symbol.iterator]=jbe.prototype[Symbol.iterator]=function(){return this});let Mht=class{constructor(t,n,r,i){this.from=t,this.to=n,this.number=r,this.text=i}get length(){return this.to-this.from}};function y1(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function ba(e,t,n=!0,r=!0){return Iht(e,t,n,r)}function Lht(e){return e>=56320&&e<57344}function $ht(e){return e>=55296&&e<56320}function Uo(e,t){let n=e.charCodeAt(t);if(!$ht(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return Lht(r)?(n-55296<<10)+(r-56320)+65536:n}function oQ(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function Yu(e){return e<65536?1:2}const IL=/\r\n?|\n/;var Pa=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(Pa||(Pa={}));class fd{constructor(t){this.sections=t}get length(){let t=0;for(let n=0;nt)return s+(t-i);s+=l}else{if(r!=Pa.Simple&&u>=t&&(r==Pa.TrackDel&&it||r==Pa.TrackBefore&&it))return null;if(u>t||u==t&&n<0&&!l)return t==i||n<0?s:s+c;s+=c}i=u}if(t>i)throw new RangeError(`Position ${t} is out of range for changeset of length ${i}`);return s}touchesRange(t,n=t){for(let r=0,i=0;r=0&&i<=n&&l>=t)return in?"cover":!0;i=l}return!1}toString(){let t="";for(let n=0;n=0?":"+i:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new fd(t)}static create(t){return new fd(t)}}class Js extends fd{constructor(t,n){super(t),this.inserted=n}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return DL(this,(n,r,i,s,a)=>t=t.replace(i,i+(r-n),a),!1),t}mapDesc(t,n=!1){return PL(this,t,n,!0)}invert(t){let n=this.sections.slice(),r=[];for(let i=0,s=0;i=0){n[i]=l,n[i+1]=a;let c=i>>1;for(;r.length0&&gp(r,n,s.text),s.forward(d),l+=d}let u=t[a++];for(;l>1].toJSON()))}return t}static of(t,n,r){let i=[],s=[],a=0,l=null;function c(d=!1){if(!d&&!i.length)return;ah||f<0||h>n)throw new RangeError(`Invalid change range ${f} to ${h} (in doc of length ${n})`);let g=m?typeof m=="string"?Br.of(m.split(r||IL)):m:Br.empty,b=g.length;if(f==h&&b==0)return;fa&&Wa(i,f-a,-1),Wa(i,h-f,b),gp(s,i,g),a=h}}return u(t),c(!l),l}static empty(t){return new Js(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let i=0;il&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)n.push(s[0],0);else{for(;r.length=0&&n<=0&&n==e[i+1]?e[i]+=t:i>=0&&t==0&&e[i]==0?e[i+1]+=n:r?(e[i]+=t,e[i+1]+=n):e.push(t,n)}function gp(e,t,n){if(n.length==0)return;let r=t.length-2>>1;if(r>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)l=e.sections[a++],c=e.sections[a++];t(i,u,s,d,f),i=u,s=d}}}function PL(e,t,n,r=!1){let i=[],s=r?[]:null,a=new eS(e),l=new eS(t);for(let c=-1;;){if(a.done&&l.len||l.done&&a.len)throw new Error("Mismatched change set lengths");if(a.ins==-1&&l.ins==-1){let u=Math.min(a.len,l.len);Wa(i,u,-1),a.forward(u),l.forward(u)}else if(l.ins>=0&&(a.ins<0||c==a.i||a.off==0&&(l.len=0&&c=0){let u=0,d=a.len;for(;d;)if(l.ins==-1){let f=Math.min(d,l.len);u+=f,d-=f,l.forward(f)}else if(l.ins==0&&l.lenc||a.ins>=0&&a.len>c)&&(l||r.length>u),s.forward2(c),a.forward(c)}}}}class eS{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i>1;return n>=t.length?Br.empty:t[n]}textBit(t){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!t?Br.empty:n[r].slice(this.off,t==null?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){this.ins==-1?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}class sp{constructor(t,n,r,i){this.from=t,this.to=n,this.flags=r,this.goalColumn=i}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 t=this.flags&7;return t==7?null:t}map(t,n=-1){let r,i;return this.empty?r=i=t.mapPos(this.from,n):(r=t.mapPos(this.from,1),i=t.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new sp(r,i,this.flags,this.goalColumn)}extend(t,n=t,r=0){if(t<=this.anchor&&n>=this.anchor)return Je.range(t,n,void 0,void 0,r);let i=Math.abs(t-this.anchor)>Math.abs(n-this.anchor)?t:n;return Je.range(this.anchor,i,void 0,void 0,r)}eq(t,n=!1){return this.anchor==t.anchor&&this.head==t.head&&this.goalColumn==t.goalColumn&&(!n||!this.empty||this.assoc==t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Je.range(t.anchor,t.head)}static create(t,n,r,i){return new sp(t,n,r,i)}}class Je{constructor(t,n){this.ranges=t,this.mainIndex=n}map(t,n=-1){return t.empty?this:Je.create(this.ranges.map(r=>r.map(t,n)),this.mainIndex)}eq(t,n=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let r=0;rt.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!="number"||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Je(t.ranges.map(n=>sp.fromJSON(n)),t.main)}static single(t,n=t){return new Je([Je.range(t,n)],0)}static create(t,n=0){if(t.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,i=0;ii.from-s.from),n=t.indexOf(r);for(let i=1;is.head?Je.range(c,l):Je.range(l,c))}}return new Je(t,n)}}function Ibe(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let lQ=0;class Qt{constructor(t,n,r,i,s){this.combine=t,this.compareInput=n,this.compare=r,this.isStatic=i,this.id=lQ++,this.default=t([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(t={}){return new Qt(t.combine||(n=>n),t.compareInput||((n,r)=>n===r),t.compare||(t.combine?(n,r)=>n===r:cQ),!!t.static,t.enables)}of(t){return new mT([],this,0,t)}compute(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new mT(t,this,1,n)}computeN(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new mT(t,this,2,n)}from(t,n){return n||(n=r=>r),this.compute([t],r=>n(r.field(t)))}}function cQ(e,t){return e==t||e.length==t.length&&e.every((n,r)=>n===t[r])}class mT{constructor(t,n,r,i){this.dependencies=t,this.facet=n,this.type=r,this.value=i,this.id=lQ++}dynamicSlot(t){var n;let r=this.value,i=this.facet.compareInput,s=this.id,a=t[s]>>1,l=this.type==2,c=!1,u=!1,d=[];for(let f of this.dependencies)f=="doc"?c=!0:f=="selection"?u=!0:((n=t[f.id])!==null&&n!==void 0?n:1)&1||d.push(t[f.id]);return{create(f){return f.values[a]=r(f),1},update(f,h){if(c&&h.docChanged||u&&(h.docChanged||h.selection)||ML(f,d)){let m=r(f);if(l?!OY(m,f.values[a],i):!i(m,f.values[a]))return f.values[a]=m,1}return 0},reconfigure:(f,h)=>{let m,g=h.config.address[s];if(g!=null){let b=hA(h,g);if(this.dependencies.every(y=>y instanceof Qt?h.facet(y)===f.facet(y):y instanceof Qa?h.field(y,!1)==f.field(y,!1):!0)||(l?OY(m=r(f),b,i):i(m=r(f),b)))return f.values[a]=b,0}else m=r(f);return f.values[a]=m,1}}}get extension(){return this}}function OY(e,t,n){if(e.length!=t.length)return!1;for(let r=0;re[c.id]),i=n.map(c=>c.type),s=r.filter(c=>!(c&1)),a=e[t.id]>>1;function l(c){let u=[];for(let d=0;dr===i),t);return t.provide&&(n.provides=t.provide(n)),n}create(t){let n=t.facet(L2).find(r=>r.field==this);return((n==null?void 0:n.create)||this.createF)(t)}slot(t){let n=t[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,i)=>{let s=r.values[n],a=this.updateF(s,i);return this.compareF(s,a)?0:(r.values[n]=a,1)},reconfigure:(r,i)=>{let s=r.facet(L2),a=i.facet(L2),l;return(l=s.find(c=>c.field==this))&&l!=a.find(c=>c.field==this)?(r.values[n]=l.create(r),1):i.config.address[this.id]!=null?(r.values[n]=i.field(this),0):(r.values[n]=this.create(r),1)}}}init(t){return[this,L2.of({field:this,create:t})]}get extension(){return this}}const Ym={lowest:4,low:3,default:2,high:1,highest:0};function hx(e){return t=>new Dbe(t,e)}const xh={highest:hx(Ym.highest),high:hx(Ym.high),default:hx(Ym.default),low:hx(Ym.low),lowest:hx(Ym.lowest)};class Dbe{constructor(t,n){this.inner=t,this.prec=n}get extension(){return this}}class Zj{of(t){return new LL(this,t)}reconfigure(t){return Zj.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class LL{constructor(t,n){this.compartment=t,this.inner=n}get extension(){return this}}class fA{constructor(t,n,r,i,s,a){for(this.base=t,this.compartments=n,this.dynamicSlots=r,this.address=i,this.staticValues=s,this.facets=a,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(t,n,r){let i=[],s=Object.create(null),a=new Map;for(let h of Qht(t,n,a))h instanceof Qa?i.push(h):(s[h.facet.id]||(s[h.facet.id]=[])).push(h);let l=Object.create(null),c=[],u=[];for(let h of i)l[h.id]=u.length<<1,u.push(m=>h.slot(m));let d=r==null?void 0:r.config.facets;for(let h in s){let m=s[h],g=m[0].facet,b=d&&d[h]||[];if(m.every(y=>y.type==0))if(l[g.id]=c.length<<1|1,cQ(b,m))c.push(r.facet(g));else{let y=g.combine(m.map(O=>O.value));c.push(r&&g.compare(y,r.facet(g))?r.facet(g):y)}else{for(let y of m)y.type==0?(l[y.id]=c.length<<1|1,c.push(y.value)):(l[y.id]=u.length<<1,u.push(O=>y.dynamicSlot(O)));l[g.id]=u.length<<1,u.push(y=>Bht(y,g,m))}}let f=u.map(h=>h(l));return new fA(t,a,f,l,c,s)}}function Qht(e,t,n){let r=[[],[],[],[],[]],i=new Map;function s(a,l){let c=i.get(a);if(c!=null){if(c<=l)return;let u=r[c].indexOf(a);u>-1&&r[c].splice(u,1),a instanceof LL&&n.delete(a.compartment)}if(i.set(a,l),Array.isArray(a))for(let u of a)s(u,l);else if(a instanceof LL){if(n.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let u=t.get(a.compartment)||a.inner;n.set(a.compartment,u),s(u,l)}else if(a instanceof Dbe)s(a.inner,a.prec);else if(a instanceof Qa)r[l].push(a),a.provides&&s(a.provides,l);else if(a instanceof mT)r[l].push(a),a.facet.extensions&&s(a.facet.extensions,Ym.default);else{let u=a.extension;if(!u)throw new Error(`Unrecognized extension value in extension set (${a}).`);if(u==a)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(u,l)}}return s(e,Ym.default),r.reduce((a,l)=>a.concat(l))}function Vv(e,t){if(t&1)return 2;let n=t>>1,r=e.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;e.status[n]=4;let i=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|i}function hA(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}const Pbe=Qt.define(),$L=Qt.define({combine:e=>e.some(t=>t),static:!0}),Mbe=Qt.define({combine:e=>e.length?e[0]:void 0,static:!0}),Lbe=Qt.define(),$be=Qt.define(),Bbe=Qt.define(),Qbe=Qt.define({combine:e=>e.length?e[0]:!1});class Ad{constructor(t,n){this.type=t,this.value=n}static define(){return new Uht}}class Uht{of(t){return new Ad(this,t)}}class Fht{constructor(t){this.map=t}of(t){return new jn(this,t)}}class jn{constructor(t,n){this.type=t,this.value=n}map(t){let n=this.type.map(this.value,t);return n===void 0?void 0:n==this.value?this:new jn(this.type,n)}is(t){return this.type==t}static define(t={}){return new Fht(t.map||(n=>n))}static mapEffects(t,n){if(!t.length)return t;let r=[];for(let i of t){let s=i.map(n);s&&r.push(s)}return r}}jn.reconfigure=jn.define();jn.appendConfig=jn.define();class Vs{constructor(t,n,r,i,s,a){this.startState=t,this.changes=n,this.selection=r,this.effects=i,this.annotations=s,this.scrollIntoView=a,this._doc=null,this._state=null,r&&Ibe(r,n.newLength),s.some(l=>l.type==Vs.time)||(this.annotations=s.concat(Vs.time.of(Date.now())))}static create(t,n,r,i,s,a){return new Vs(t,n,r,i,s,a)}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(t){for(let n of this.annotations)if(n.type==t)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let n=this.annotation(Vs.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]=="."))}}Vs.time=Ad.define();Vs.userEvent=Ad.define();Vs.addToHistory=Ad.define();Vs.remote=Ad.define();function zht(e,t){let n=[];for(let r=0,i=0;;){let s,a;if(r=e[r]))s=e[r++],a=e[r++];else if(i=0;i--){let s=r[i](e);s instanceof Vs?e=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Vs?e=s[0]:e=Fbe(t,Ey(s),!1)}return e}function Hht(e){let t=e.startState,n=t.facet(Bbe),r=e;for(let i=n.length-1;i>=0;i--){let s=n[i](e);s&&Object.keys(s).length&&(r=Ube(r,BL(t,s,e.changes.newLength),!0))}return r==e?e:Vs.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}const qht=[];function Ey(e){return e==null?qht:Array.isArray(e)?e:[e]}var Yi=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(Yi||(Yi={}));const Xht=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let QL;try{QL=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Ght(e){if(QL)return QL.test(e);for(let t=0;t"€"&&(n.toUpperCase()!=n.toLowerCase()||Xht.test(n)))return!0}return!1}function Wht(e){return t=>{if(!/\S/.test(t))return Yi.Space;if(Ght(t))return Yi.Word;for(let n=0;n-1)return Yi.Word;return Yi.Other}}class vr{constructor(t,n,r,i,s,a){this.config=t,this.doc=n,this.selection=r,this.values=i,this.status=t.statusTemplate.slice(),this.computeSlot=s,a&&(a._state=this);for(let l=0;li.set(u,c)),n=null),i.set(l.value.compartment,l.value.extension)):l.is(jn.reconfigure)?(n=null,r=l.value):l.is(jn.appendConfig)&&(n=null,r=Ey(r).concat(l.value));let s;n?s=t.startState.values.slice():(n=fA.resolve(r,i,this),s=new vr(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(c,u)=>u.reconfigure(c,this),null).values);let a=t.startState.facet($L)?t.newSelection:t.newSelection.asSingle();new vr(n,t.newDoc,a,s,(l,c)=>c.update(l,t),t)}replaceSelection(t){return typeof t=="string"&&(t=this.toText(t)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:t},range:Je.cursor(n.from+t.length)}))}changeByRange(t){let n=this.selection,r=t(n.ranges[0]),i=this.changes(r.changes),s=[r.range],a=Ey(r.effects);for(let l=1;la.spec.fromJSON(l,c)))}}return vr.create({doc:t.doc,selection:Je.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(t={}){let n=fA.resolve(t.extensions||[],new Map),r=t.doc instanceof Br?t.doc:Br.of((t.doc||"").split(n.staticFacet(vr.lineSeparator)||IL)),i=t.selection?t.selection instanceof Je?t.selection:Je.single(t.selection.anchor,t.selection.head):Je.single(0);return Ibe(i,r.length),n.staticFacet($L)||(i=i.asSingle()),new vr(n,r,i,n.dynamicSlots.map(()=>null),(s,a)=>a.create(s),null)}get tabSize(){return this.facet(vr.tabSize)}get lineBreak(){return this.facet(vr.lineSeparator)||` -`}get readOnly(){return this.facet(Qbe)}phrase(t,...n){for(let r of this.facet(vr.phrases))if(Object.prototype.hasOwnProperty.call(r,t)){t=r[t];break}return n.length&&(t=t.replace(/\$(\$|\d*)/g,(r,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>n.length?r:n[s-1]})),t}languageDataAt(t,n,r=-1){let i=[];for(let s of this.facet(Pbe))for(let a of s(this,n,r))Object.prototype.hasOwnProperty.call(a,t)&&i.push(a[t]);return i}charCategorizer(t){let n=this.languageDataAt("wordChars",t);return Wht(n.length?n[0]:"")}wordAt(t){let{text:n,from:r,length:i}=this.doc.lineAt(t),s=this.charCategorizer(t),a=t-r,l=t-r;for(;a>0;){let c=ba(n,a,!1);if(s(n.slice(c,a))!=Yi.Word)break;a=c}for(;le.length?e[0]:4});vr.lineSeparator=Mbe;vr.readOnly=Qbe;vr.phrases=Qt.define({compare(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length==r.length&&n.every(i=>e[i]==t[i])}});vr.languageData=Pbe;vr.changeFilter=Lbe;vr.transactionFilter=$be;vr.transactionExtender=Bbe;Zj.reconfigure=jn.define();function Nd(e,t,n={}){let r={};for(let i of e)for(let s of Object.keys(i)){let a=i[s],l=r[s];if(l===void 0)r[s]=a;else if(!(l===a||a===void 0))if(Object.hasOwnProperty.call(n,s))r[s]=n[s](l,a);else throw new Error("Config merge conflict for field "+s)}for(let i in t)r[i]===void 0&&(r[i]=t[i]);return r}class Kp{eq(t){return this==t}range(t,n=t){return tS.create(t,n,this)}}Kp.prototype.startSide=Kp.prototype.endSide=0;Kp.prototype.point=!1;Kp.prototype.mapMode=Pa.TrackDel;function uQ(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}class tS{constructor(t,n,r){this.from=t,this.to=n,this.value=r}static create(t,n,r){return new tS(t,n,r)}}function UL(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class dQ{constructor(t,n,r,i){this.from=t,this.to=n,this.value=r,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(t,n,r,i=0){let s=r?this.to:this.from;for(let a=i,l=s.length;;){if(a==l)return a;let c=a+l>>1,u=s[c]-t||(r?this.value[c].endSide:this.value[c].startSide)-n;if(c==a)return u>=0?a:l;u>=0?l=c:a=c+1}}between(t,n,r,i){for(let s=this.findIndex(n,-1e9,!0),a=this.findIndex(r,1e9,!1,s);sm||h==m&&u.startSide>0&&u.endSide<=0)continue;(m-h||u.endSide-u.startSide)<0||(a<0&&(a=h),u.point&&(l=Math.max(l,m-h)),r.push(u),i.push(h-a),s.push(m-a))}return{mapped:r.length?new dQ(i,s,r,l):null,pos:a}}}class gr{constructor(t,n,r,i){this.chunkPos=t,this.chunk=n,this.nextLayer=r,this.maxPoint=i}static create(t,n,r,i){return new gr(t,n,r,i)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let n of this.chunk)t+=n.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:n=[],sort:r=!1,filterFrom:i=0,filterTo:s=this.length}=t,a=t.filter;if(n.length==0&&!a)return this;if(r&&(n=n.slice().sort(UL)),this.isEmpty)return n.length?gr.of(n):this;let l=new zbe(this,null,-1).goto(0),c=0,u=[],d=new sh;for(;l.value||c=0){let f=n[c++];d.addInner(f.from,f.to,f.value)||u.push(f)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||sl.to||s=s&&t<=s+a.length&&a.between(s,t-s,n-s,r)===!1)return}this.nextLayer.between(t,n,r)}}iter(t=0){return nS.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,n=0){return nS.from(t).goto(n)}static compare(t,n,r,i,s=-1){let a=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),l=n.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),c=xY(a,l,r),u=new px(a,c,s),d=new px(l,c,s);r.iterGaps((f,h,m)=>vY(u,f,d,h,m,i)),r.empty&&r.length==0&&vY(u,0,d,0,0,i)}static eq(t,n,r=0,i){i==null&&(i=999999999);let s=t.filter(d=>!d.isEmpty&&n.indexOf(d)<0),a=n.filter(d=>!d.isEmpty&&t.indexOf(d)<0);if(s.length!=a.length)return!1;if(!s.length)return!0;let l=xY(s,a),c=new px(s,l,0).goto(r),u=new px(a,l,0).goto(r);for(;;){if(c.to!=u.to||!FL(c.active,u.active)||c.point&&(!u.point||!uQ(c.point,u.point)))return!1;if(c.to>i)return!0;c.next(),u.next()}}static spans(t,n,r,i,s=-1){let a=new px(t,null,s).goto(n),l=n,c=a.openStart;for(;;){let u=Math.min(a.to,r);if(a.point){let d=a.activeForPoint(a.to),f=a.pointFroml&&(i.span(l,u,a.active,c),c=a.openEnd(u));if(a.to>r)return c+(a.point&&a.to>r?1:0);l=a.to,a.next()}}static of(t,n=!1){let r=new sh;for(let i of t instanceof tS?[t]:n?Yht(t):t)r.add(i.from,i.to,i.value);return r.finish()}static join(t){if(!t.length)return gr.empty;let n=t[t.length-1];for(let r=t.length-2;r>=0;r--)for(let i=t[r];i!=gr.empty;i=i.nextLayer)n=new gr(i.chunkPos,i.chunk,n,Math.max(i.maxPoint,n.maxPoint));return n}}gr.empty=new gr([],[],null,-1);function Yht(e){if(e.length>1)for(let t=e[0],n=1;n0)return e.slice().sort(UL);t=r}return e}gr.empty.nextLayer=gr.empty;class sh{finishChunk(t){this.chunks.push(new dQ(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,n,r){this.addInner(t,n,r)||(this.nextLayer||(this.nextLayer=new sh)).add(t,n,r)}addInner(t,n,r){let i=t-this.lastTo||r.startSide-this.last.endSide;if(i<=0&&(t-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return i<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=t,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-t)),!0)}addChunk(t,n){if((t-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(t);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+t,this.lastTo=n.to[r]+t,!0}finish(){return this.finishInner(gr.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let n=gr.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,n}}function xY(e,t,n){let r=new Map;for(let s of e)for(let a=0;a=this.minPoint)break}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=r&&i.push(new zbe(a,n,r,s));return i.length==1?i[0]:new nS(i)}get startSide(){return this.value?this.value.startSide:0}goto(t,n=-1e9){for(let r of this.heap)r.goto(t,n);for(let r=this.heap.length>>1;r>=0;r--)DD(this.heap,r);return this.next(),this}forward(t,n){for(let r of this.heap)r.forward(t,n);for(let r=this.heap.length>>1;r>=0;r--)DD(this.heap,r);(this.to-t||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),DD(this.heap,0)}}}function DD(e,t){for(let n=e[t];;){let r=(t<<1)+1;if(r>=e.length)break;let i=e[r];if(r+1=0&&(i=e[r+1],r++),n.compare(i)<0)break;e[r]=n,e[t]=i,t=r}}class px{constructor(t,n,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=nS.from(t,n,r)}goto(t,n=-1e9){return this.cursor.goto(t,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=n,this.openStart=-1,this.next(),this}forward(t,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(t,n)}removeActive(t){$2(this.active,t),$2(this.activeTo,t),$2(this.activeRank,t),this.minActive=wY(this.active,this.activeTo)}addActive(t){let n=0,{value:r,to:i,rank:s}=this.cursor;for(;n0;)n++;B2(this.active,n,r),B2(this.activeTo,n,i),B2(this.activeRank,n,s),t&&B2(t,n,this.cursor.from),this.minActive=wY(this.active,this.activeTo)}next(){let t=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>t){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),r&&$2(r,i)}else if(this.cursor.value)if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from=0&&r[i]=0&&!(this.activeRank[r]t||this.activeTo[r]==t&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(t){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>t;r--)n++;return n}}function vY(e,t,n,r,i,s){e.goto(t),n.goto(r);let a=r+i,l=r,c=r-t,u=!!s.boundChange;for(let d=!1;;){let f=e.to+c-n.to,h=f||e.endSide-n.endSide,m=h<0?e.to+c:n.to,g=Math.min(m,a);if(e.point||n.point?(e.point&&n.point&&uQ(e.point,n.point)&&FL(e.activeForPoint(e.to),n.activeForPoint(n.to))||s.comparePoint(l,g,e.point,n.point),d=!1):(d&&s.boundChange(l),g>l&&!FL(e.active,n.active)&&s.compareRange(l,g,e.active,n.active),u&&ga)break;l=m,h<=0&&e.next(),h>=0&&n.next()}}function FL(e,t){if(e.length!=t.length)return!1;for(let n=0;n=t;r--)e[r+1]=e[r];e[t]=n}function wY(e,t){let n=-1,r=1e9;for(let i=0;i=t)return i;if(i==e.length)break;s+=e.charCodeAt(i)==9?n-s%n:1,i=ba(e,i)}return r===!0?-1:e.length}const VL="ͼ",SY=typeof Symbol>"u"?"__"+VL:Symbol.for(VL),HL=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),EY=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Jp{constructor(t,n){this.rules=[];let{finish:r}=n||{};function i(a){return/^@/.test(a)?[a]:a.split(/,\s*/)}function s(a,l,c,u){let d=[],f=/^@(\w+)\b/.exec(a[0]),h=f&&f[1]=="keyframes";if(f&&l==null)return c.push(a[0]+";");for(let m in l){let g=l[m];if(/&/.test(m))s(m.split(/,\s*/).map(b=>a.map(y=>b.replace(/&/,y))).reduce((b,y)=>b.concat(y)),g,c);else if(g&&typeof g=="object"){if(!f)throw new RangeError("The value of a property ("+m+") should be a primitive value.");s(i(m),g,d,h)}else g!=null&&d.push(m.replace(/_.*/,"").replace(/[A-Z]/g,b=>"-"+b.toLowerCase())+": "+g+";")}(d.length||h)&&c.push((r&&!f&&!u?a.map(r):a).join(", ")+" {"+d.join(" ")+"}")}for(let a in t)s(i(a),t[a],this.rules)}getRules(){return this.rules.join(` -`)}static newName(){let t=EY[SY]||1;return EY[SY]=t+1,VL+t.toString(36)}static mount(t,n,r){let i=t[HL],s=r&&r.nonce;i?s&&i.setNonce(s):i=new Zht(t,s),i.mount(Array.isArray(n)?n:[n],t)}}let kY=new Map;class Zht{constructor(t,n){let r=t.ownerDocument||t,i=r.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let s=kY.get(r);if(s)return t[HL]=s;this.sheet=new i.CSSStyleSheet,kY.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],t[HL]=this}mount(t,n){let r=this.sheet,i=0,s=0;for(let a=0;a-1&&(this.modules.splice(c,1),s--,c=-1),c==-1){if(this.modules.splice(s++,0,l),r)for(let u=0;u",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Kht=typeof navigator<"u"&&/Mac/.test(navigator.platform),Jht=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ra=0;Ra<10;Ra++)em[48+Ra]=em[96+Ra]=String(Ra);for(var Ra=1;Ra<=24;Ra++)em[Ra+111]="F"+Ra;for(var Ra=65;Ra<=90;Ra++)em[Ra]=String.fromCharCode(Ra+32),rS[Ra]=String.fromCharCode(Ra);for(var PD in em)rS.hasOwnProperty(PD)||(rS[PD]=em[PD]);function ept(e){var t=Kht&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Jht&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?rS:em)[e.keyCode]||e.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function fi(){var e=arguments[0];typeof e=="string"&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];typeof i=="string"?e.setAttribute(r,i):i!=null&&(e[r]=i)}t++}for(;t2);var $t={mac:CY||/Mac/.test(po.platform),windows:/Win/.test(po.platform),linux:/Linux|X11/.test(po.platform),ie:Kj,ie_version:Hbe?qL.documentMode||6:GL?+GL[1]:XL?+XL[1]:0,gecko:_Y,gecko_version:_Y?+(/Firefox\/(\d+)/.exec(po.userAgent)||[0,0])[1]:0,chrome:!!MD,chrome_version:MD?+MD[1]:0,ios:CY,android:/Android\b/.test(po.userAgent),webkit:TY,webkit_version:TY?+(/\bAppleWebKit\/(\d+)/.exec(po.userAgent)||[0,0])[1]:0,safari:WL,safari_version:WL?+(/\bVersion\/(\d+(\.\d+)?)/.exec(po.userAgent)||[0,0])[1]:0,tabSize:qL.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function fQ(e,t){for(let n in e)n=="class"&&t.class?t.class+=" "+e.class:n=="style"&&t.style?t.style+=";"+e.style:t[n]=e[n];return t}const pA=Object.create(null);function hQ(e,t,n){if(e==t)return!0;e||(e=pA),t||(t=pA);let r=Object.keys(e),i=Object.keys(t);if(r.length-0!=i.length-0)return!1;for(let s of r)if(s!=n&&(i.indexOf(s)==-1||e[s]!==t[s]))return!1;return!0}function tpt(e,t){for(let n=e.attributes.length-1;n>=0;n--){let r=e.attributes[n].name;t[r]==null&&e.removeAttribute(r)}for(let n in t){let r=t[n];n=="style"?e.style.cssText=r:e.getAttribute(n)!=r&&e.setAttribute(n,r)}}function AY(e,t,n){let r=!1;if(t)for(let i in t)n&&i in n||(r=!0,i=="style"?e.style.cssText="":e.removeAttribute(i));if(n)for(let i in n)t&&t[i]==n[i]||(r=!0,i=="style"?e.style.cssText=n[i]:e.setAttribute(i,n[i]));return r}function npt(e){let t=Object.create(null);for(let n=0;n0?3e8:-4e8:n>0?1e8:-1e8,new Gg(t,n,n,r,t.widget||null,!1)}static replace(t){let n=!!t.block,r,i;if(t.isBlockGap)r=-5e8,i=4e8;else{let{start:s,end:a}=qbe(t,n);r=(s?n?-3e8:-1:5e8)-1,i=(a?n?2e8:1:-6e8)+1}return new Gg(t,r,i,n,t.widget||null,!0)}static line(t){return new LE(t)}static set(t,n=!1){return gr.of(t,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}dn.none=gr.empty;class ME extends dn{constructor(t){let{start:n,end:r}=qbe(t);super(n?-1:5e8,r?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?fQ(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||pA}eq(t){return this==t||t instanceof ME&&this.tagName==t.tagName&&hQ(this.attrs,t.attrs)}range(t,n=t){if(t>=n)throw new RangeError("Mark decorations may not be empty");return super.range(t,n)}}ME.prototype.point=!1;class LE extends dn{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof LE&&this.spec.class==t.spec.class&&hQ(this.spec.attributes,t.spec.attributes)}range(t,n=t){if(n!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,n)}}LE.prototype.mapMode=Pa.TrackBefore;LE.prototype.point=!0;class Gg extends dn{constructor(t,n,r,i,s,a){super(n,r,s,t),this.block=i,this.isReplace=a,this.mapMode=i?n<=0?Pa.TrackBefore:Pa.TrackAfter:Pa.TrackDel}get type(){return this.startSide!=this.endSide?Ba.WidgetRange:this.startSide<=0?Ba.WidgetBefore:Ba.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof Gg&&rpt(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(t,n=t){if(this.isReplace&&(t>n||t==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,n)}}Gg.prototype.point=!0;function qbe(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return n==null&&(n=e.inclusive),r==null&&(r=e.inclusive),{start:n??t,end:r??t}}function rpt(e,t){return e==t||!!(e&&t&&e.compare(t))}function ky(e,t,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=e?n[i]=Math.max(n[i],t):n.push(e,t)}class iS extends Kp{constructor(t,n,r){super(),this.tagName=t,this.attributes=n,this.rank=r}eq(t){return t==this||t instanceof iS&&this.tagName==t.tagName&&hQ(this.attributes,t.attributes)}static create(t){return new iS(t.tagName,t.attributes||pA,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(t,n=!1){return gr.of(t,n)}}iS.prototype.startSide=iS.prototype.endSide=-1;function sS(e){let t;return e.nodeType==11?t=e.getSelection?e:e.ownerDocument:t=e,t.getSelection()}function YL(e,t){return t?e==t||e.contains(t.nodeType!=1?t.parentNode:t):!1}function Hv(e,t){if(!t.anchorNode)return!1;try{return YL(e,t.anchorNode)}catch{return!1}}function qv(e){return e.nodeType==3?oS(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function Xv(e,t,n,r){return n?NY(e,t,n,r,-1)||NY(e,t,n,r,1):!1}function tm(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function mA(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function NY(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:ah(e))){if(e.nodeName=="DIV")return!1;let s=e.parentNode;if(!s||s.nodeType!=1)return!1;t=tm(e)+(i<0?0:1),e=s}else if(e.nodeType==1){if(e=e.childNodes[t+(i<0?-1:0)],e.nodeType==1&&e.contentEditable=="false")return!1;t=i<0?ah(e):0}else return!1}}function ah(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function aS(e,t){let{left:n,right:r}=e;if(n==r)return e;let i=t?n:r;return{left:i,right:i,top:e.top,bottom:e.bottom}}function ipt(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function Xbe(e,t){let n=t.width/e.offsetWidth,r=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(t.height-e.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function spt(e,t,n,r,i,s,a,l){let c=e.ownerDocument,u=c.defaultView||window;for(let d=e,f=!1;d&&!f;)if(d.nodeType==1){let h,m=d==c.body,g=1,b=1;if(m)h=ipt(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(d).position)&&(f=!0),d.scrollHeight<=d.clientHeight&&d.scrollWidth<=d.clientWidth){d=d.assignedSlot||d.parentNode;continue}let v=d.getBoundingClientRect();({scaleX:g,scaleY:b}=Xbe(d,v)),h={left:v.left,right:v.left+d.clientWidth*g,top:v.top,bottom:v.top+d.clientHeight*b}}let y=0,O=0;if(i=="nearest")t.top0&&t.bottom>h.bottom+O&&(O=t.bottom-h.bottom+a)):t.bottom>h.bottom-a&&(O=t.bottom-h.bottom+a,n<0&&t.top-O0&&t.right>h.right+y&&(y=t.right-h.right+s)):t.right>h.right-s&&(y=t.right-h.right+s,n<0&&t.lefth.bottom||t.lefth.right)&&(t={left:Math.max(t.left,h.left),right:Math.min(t.right,h.right),top:Math.max(t.top,h.top),bottom:Math.min(t.bottom,h.bottom)}),d=d.assignedSlot||d.parentNode}else if(d.nodeType==11)d=d.host;else break}function Gbe(e,t=!0){let n=e.ownerDocument,r=null,i=null;for(let s=e.parentNode;s&&!(s==n.body||(!t||r)&&i);)if(s.nodeType==1)!i&&s.scrollHeight>s.clientHeight&&(i=s),t&&!r&&s.scrollWidth>s.clientWidth&&(r=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:r,y:i}}class apt{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:n,focusNode:r}=t;this.set(n,Math.min(t.anchorOffset,n?ah(n):0),r,Math.min(t.focusOffset,r?ah(r):0))}set(t,n,r,i){this.anchorNode=t,this.anchorOffset=n,this.focusNode=r,this.focusOffset=i}}let qm=null;$t.safari&&$t.safari_version>=26&&(qm=!1);function Wbe(e){if(e.setActive)return e.setActive();if(qm)return e.focus(qm);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(qm==null?{get preventScroll(){return qm={preventScroll:!0},!0}}:void 0),!qm){qm=!1;for(let n=0;nMath.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4):e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function Zbe(e,t){for(let n=e,r=t;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=ah(n)}else if(n.parentNode&&!mA(n))r=tm(n),n=n.parentNode;else return null}}function Kbe(e,t){for(let n=e,r=t;;){if(n.nodeType==3&&r=n){if(l.level==r)return a;(s<0||(i!=0?i<0?l.fromn:t[s].level>l.level))&&(s=a)}}if(s<0)throw new RangeError("Index out of range");return s}}function tye(e,t){if(e.length!=t.length)return!1;for(let n=0;n=0;b-=3)if(Bu[b+1]==-m){let y=Bu[b+2],O=y&2?i:y&4?y&1?s:i:0;O&&(Oi[f]=Oi[Bu[b]]=O),l=b;break}}else{if(Bu.length==189)break;Bu[l++]=f,Bu[l++]=h,Bu[l++]=c}else if((g=Oi[f])==2||g==1){let b=g==i;c=b?0:1;for(let y=l-3;y>=0;y-=3){let O=Bu[y+2];if(O&2)break;if(b)Bu[y+2]|=2;else{if(O&4)break;Bu[y+2]|=4}}}}}function ppt(e,t,n,r){for(let i=0,s=r;i<=n.length;i++){let a=i?n[i-1].to:e,l=ic;)g==y&&(g=n[--b].from,y=b?n[b-1].to:e),Oi[--g]=m;c=d}else s=u,c++}}}function KL(e,t,n,r,i,s,a){let l=r%2?2:1;if(r%2==i%2)for(let c=t,u=0;cc&&a.push(new id(c,b.from,m));let y=b.direction==Wg!=!(m%2);JL(e,y?r+1:r,i,b.inner,b.from,b.to,a),c=b.to}g=b.to}else{if(g==n||(d?Oi[g]!=l:Oi[g]==l))break;g++}h?KL(e,c,g,r+1,i,h,a):ct;){let d=!0,f=!1;if(!u||c>s[u-1].to){let b=Oi[c-1];b!=l&&(d=!1,f=b==16)}let h=!d&&l==1?[]:null,m=d?r:r+1,g=c;e:for(;;)if(u&&g==s[u-1].to){if(f)break e;let b=s[--u];if(!d)for(let y=b.from,O=u;;){if(y==t)break e;if(O&&s[O-1].to==y)y=s[--O].from;else{if(Oi[y-1]==l)break e;break}}if(h)h.push(b);else{b.toOi.length;)Oi[Oi.length]=256;let r=[],i=t==Wg?0:1;return JL(e,i,i,n,0,e.length,r),r}function nye(e){return[new id(0,e,0)]}let rye="";function gpt(e,t,n,r,i){var s;let a=r.head-e.from,l=id.find(t,a,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),c=t[l],u=c.side(i,n);if(a==u){let h=l+=i?1:-1;if(h<0||h>=t.length)return null;c=t[l=h],a=c.side(!i,n),u=c.side(i,n)}let d=ba(e.text,a,c.forward(i,n));(dc.to)&&(d=u),rye=e.text.slice(Math.min(a,d),Math.max(a,d));let f=l==(i?t.length-1:0)?null:t[l+(i?1:-1)];return f&&d==u&&f.level+(i?0:1)e.some(t=>t)}),dye=Qt.define({combine:e=>e.some(t=>t)}),fye=Qt.define();class Ty{constructor(t,n,r,i,s,a=!1){this.range=t,this.y=n,this.x=r,this.yMargin=i,this.xMargin=s,this.isSnapshot=a}map(t){return t.empty?this:new Ty(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new Ty(Je.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Q2=jn.define({map:(e,t)=>e.map(t)}),hye=jn.define();function Go(e,t,n){let r=e.facet(oye);r.length?r[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+":",t):console.error(t))}const xf=Qt.define({combine:e=>e.length?e[0]:!0});let ypt=0;const Kb=Qt.define({combine(e){return e.filter((t,n)=>{for(let r=0;r{let c=[];return a&&c.push(Jj.of(u=>{let d=u.plugin(l);return d?a(d):dn.none})),s&&c.push(s(l)),c})}static fromClass(t,n){return ps.define((r,i)=>new t(r,i),n)}}class LD{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(t){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(Go(n.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(t,this.spec.arg)}catch(n){Go(t.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){Go(t.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const pye=Qt.define(),bQ=Qt.define(),Jj=Qt.define(),mye=Qt.define(),yQ=Qt.define(),$E=Qt.define(),gye=Qt.define();function RY(e,t){let n=e.state.facet(gye);if(!n.length)return n;let r=n.map(s=>s instanceof Function?s(e):s),i=[];return gr.spans(r,t.from,t.to,{point(){},span(s,a,l,c){let u=s-t.from,d=a-t.from,f=i;for(let h=l.length-1;h>=0;h--,c--){let m=l[h].spec.bidiIsolate,g;if(m==null&&(m=bpt(t.text,u,d)),c>0&&f.length&&(g=f[f.length-1]).to==u&&g.direction==m)g.to=d,f=g.inner;else{let b={from:u,to:d,direction:m,inner:[]};f.push(b),f=b.inner}}}}),i}const bye=Qt.define();function OQ(e){let t=0,n=0,r=0,i=0;for(let s of e.state.facet(bye)){let a=s(e);a&&(a.left!=null&&(t=Math.max(t,a.left)),a.right!=null&&(n=Math.max(n,a.right)),a.top!=null&&(r=Math.max(r,a.top)),a.bottom!=null&&(i=Math.max(i,a.bottom)))}return{left:t,right:n,top:r,bottom:i}}const Kx=Qt.define();class Cc{constructor(t,n,r,i){this.fromA=t,this.toA=n,this.fromB=r,this.toB=i}join(t){return new Cc(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let n=t.length,r=this;for(;n>0;n--){let i=t[n-1];if(!(i.fromA>r.toA)){if(i.toAi.push(new Cc(s,a,l,c))),this.changedRanges=i}static create(t,n,r){return new gA(t,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const Opt=[];class hs{constructor(t,n,r=0){this.dom=t,this.length=n,this.flags=r,this.parent=null,t.cmTile=this}get breakAfter(){return this.flags&1}get children(){return Opt}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(t){if(this.flags|=2,this.flags&4){this.flags&=-5;let n=this.domAttrs;n&&tpt(this.dom,n)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(t){this.dom=t,t.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t,n=this.posAtStart){let r=n;for(let i of this.children){if(i==t)return r;r+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}covers(t){return!0}coordsIn(t,n,r){return null}domPosFor(t,n){let r=tm(this.dom),i=this.length?t>0:n>0;return new du(this.parent.dom,r+(i?1:0),t==0||t==this.length)}markDirty(t){this.flags&=-3,t&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let t=this;t;t=t.parent)if(t instanceof tR)return t;return null}static get(t){return t.cmTile}}class eR extends hs{constructor(t){super(t,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(t){this.children.push(t),t.parent=this}sync(t){if(this.flags&2)return;super.sync(t);let n=this.dom,r=null,i,s=(t==null?void 0:t.node)==n?t:null,a=0;for(let l of this.children){if(l.sync(t),a+=l.length+l.breakAfter,i=r?r.nextSibling:n.firstChild,s&&i!=l.dom&&(s.written=!0),l.dom.parentNode==n)for(;i&&i!=l.dom;)i=IY(i);else n.insertBefore(l.dom,i);r=l.dom}for(i=r?r.nextSibling:n.firstChild,s&&i&&(s.written=!0);i;)i=IY(i);this.length=a}}function IY(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class tR extends eR{constructor(t,n){super(n),this.view=t}owns(t){for(;t;t=t.parent)if(t==this)return!0;return!1}isBlock(){return!0}nearest(t){for(;;){if(!t)return null;let n=hs.get(t);if(n&&this.owns(n))return n;t=t.parentNode}}blockTiles(t){for(let n=[],r=this,i=0,s=0;;)if(i==r.children.length){if(!n.length)return;r=r.parent,r.breakAfter&&s++,i=n.pop()}else{let a=r.children[i++];if(a instanceof Ff)n.push(i),r=a,i=0;else{let l=s+a.length,c=t(a,s);if(c!==void 0)return c;s=l+a.breakAfter}}}resolveBlock(t,n){let r,i=-1,s,a=-1;if(this.blockTiles((l,c)=>{let u=c+l.length;if(t>=c&&t<=u){if(l.isWidget()&&n>=-1&&n<=1){if(l.flags&32)return!0;l.flags&16&&(r=void 0)}(ct||t==c&&(n>1?l.length:l.covers(-1)))&&(!s||!l.isWidget()&&s.isWidget())&&(s=l,a=t-c)}}),!r&&!s)throw new Error("No tile at position "+t);return r&&n<0||!s?{tile:r,offset:i}:{tile:s,offset:a}}}class Ff extends eR{constructor(t,n){super(t),this.wrapper=n}isBlock(){return!0}covers(t){return this.children.length?t<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(t,n){let r=new Ff(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}}class O1 extends eR{constructor(t,n){super(t),this.attrs=n}isLine(){return!0}static start(t,n,r){let i=new O1(n||document.createElement("div"),t);return(!n||!r)&&(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(t,n,r){let i=null,s=-1,a=null,l=-1;function c(d,f){for(let h=0,m=0;h=f&&(g.isComposite()?c(g,f-m):(!a||a.isHidden&&(n>0&&!(a.flags&32)||r&&vpt(a,g)))&&(b>f||g.flags&32)?(a=g,l=f-m):(mi&&(t=i);let s=t,a=t,l=0;t==0&&n<0||t==i&&n>=0?$t.chrome||$t.gecko||(t?(s--,l=1):a=0)?0:c.length-1];return $t.safari&&!l&&u.width==0&&(u=Array.prototype.find.call(c,d=>d.width)||u),r==null?u:aS(u,(l?l>0:n<0)==r)}static of(t,n){let r=new cg(n||document.createTextNode(t),t);return n||(r.flags|=2),r}}class Yg extends hs{constructor(t,n,r,i){super(t,n,i),this.widget=r}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(t){return this.flags&48?!1:(this.flags&(t<0?64:128))>0}coordsIn(t,n){return this.coordsInWidget(t,n,!1)}coordsInWidget(t,n,r){let i=this.widget.coordsAt(this.dom,t,n);if(i)return i;if(r)return aS(this.dom.getBoundingClientRect(),this.length?t==0:n<=0);{let s=this.dom.getClientRects(),a=null;if(!s.length)return null;let l=this.flags&16?!0:this.flags&32?!1:t>0;for(let c=l?s.length-1:0;a=s[c],!(t>0?c==0:c==s.length-1||a.top0==r)}}class wpt{constructor(t){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=t}advance(t,n,r){let{tile:i,index:s,beforeBreak:a,parents:l}=this;for(;t||n>0;)if(i.isComposite())if(a){if(!t)break;r&&r.break(),t--,a=!1}else if(s==i.children.length){if(!t&&!l.length)break;r&&r.leave(i),a=!!i.breakAfter,{tile:i,index:s}=l.pop(),s++}else{let c=i.children[s],u=c.breakAfter;(n>0?c.length<=t:c.length=0;l--){let c=n.marks[l],u=i.lastChild;if(u instanceof Vo&&u.mark.eq(c.mark))u.dom!=c.dom&&u.setDOM($D(c.dom)),i=u;else{if(this.cache.reused.get(c)){let f=hs.get(c.dom);f&&f.setDOM($D(c.dom))}let d=Vo.of(c.mark,c.dom);i.append(d),i=d}this.cache.reused.set(c,2)}let s=hs.get(t.text);s&&this.cache.reused.set(s,2);let a=new cg(t.text,t.text.nodeValue);a.flags|=8,this.pos=t.range.toB,i.append(a)}addInlineWidget(t,n,r){let i=this.afterWidget&&t.flags&48&&(this.afterWidget.flags&48)==(t.flags&48);i||this.flushBuffer();let s=this.ensureMarks(n,r);!i&&!(t.flags&16)&&s.append(this.getBuffer(1)),s.append(t),this.pos+=t.length,this.afterWidget=t}addMark(t,n,r){this.flushBuffer(),this.ensureMarks(n,r).append(t),this.pos+=t.length,this.afterWidget=null}addBlockWidget(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}continueWidget(t){let n=this.afterWidget||this.lastBlock;n.length+=t,this.pos+=t}addLineStart(t,n){var r;t||(t=yye);let i=O1.start(t,n||((r=this.cache.find(O1))===null||r===void 0?void 0:r.dom),!!n);this.getBlockPos().append(this.lastBlock=this.curLine=i)}addLine(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(t){this.blockPosCovered()||this.addLineStart(t)}ensureLine(t){this.curLine||this.addLineStart(t)}ensureMarks(t,n){var r;let i=this.curLine;for(let s=t.length-1;s>=0;s--){let a=t[s],l;if(n>0&&(l=i.lastChild)&&l instanceof Vo&&l.mark.eq(a))i=l,n--;else{let c=Vo.of(a,(r=this.cache.find(Vo,u=>u.mark.eq(a)))===null||r===void 0?void 0:r.dom);i.append(c),i=c,n=0}}return i}endLine(){if(this.curLine){this.flushBuffer();let t=this.curLine.lastChild;(!t||!DY(this.curLine,!1)||t.dom.nodeName!="BR"&&t.isWidget()&&!($t.ios&&DY(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(BD,0,32)||new Yg(BD.toDOM(),0,BD,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let t=this.wrappers.length-1;t>=0;t--)this.wrappers[t].to=this.pos){let n=t.rank*102+t.value.rank,r=new Spt(t.from,t.to,t.value,n),i=this.wrappers.length;for(;i>0&&(this.wrappers[i-1].rank-r.rank||this.wrappers[i-1].to-r.to)<0;)i--;this.wrappers.splice(i,0,r)}this.wrapperPos=this.pos}getBlockPos(){var t;this.updateBlockWrappers();let n=this.root;for(let r of this.wrappers){let i=n.lastChild;if(r.froma.wrapper.eq(r.wrapper)))===null||t===void 0?void 0:t.dom);n.append(s),n=s}}return n}blockPosCovered(){let t=this.lastBlock;return t!=null&&!t.breakAfter&&(!t.isWidget()||(t.flags&160)>0)}getBuffer(t){let n=2|(t<0?16:32),r=this.cache.find(bA,void 0,1);return r&&(r.flags=n),r||new bA(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class kpt{constructor(t){this.skipCount=0,this.text="",this.textOff=0,this.cursor=t.iter()}skip(t){this.textOff+t<=this.text.length?this.textOff+=t:(this.skipCount+=t-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(t){if(this.textOff==this.text.length){let{value:i,lineBreak:s,done:a}=this.cursor.next(this.skipCount);if(this.skipCount=0,a)throw new Error("Ran out of text content when drawing inline views");this.text=i;let l=this.textOff=Math.min(t,i.length);return s?null:i.slice(0,l)}let n=Math.min(this.text.length,this.textOff+t),r=this.text.slice(this.textOff,n);return this.textOff=n,r}}const yA=[Yg,O1,cg,Vo,bA,Ff,tR];for(let e=0;e[]),this.index=yA.map(()=>0),this.reused=new Map}add(t){let n=t.constructor.bucket,r=this.buckets[n];r.length<6?r.push(t):r[this.index[n]=(this.index[n]+1)%6]=t}find(t,n,r=2){let i=t.bucket,s=this.buckets[i],a=this.index[i];for(let l=0;l{if(this.cache.add(a),a.isComposite())return!1},enter:a=>this.cache.add(a),leave:()=>{},break:()=>{}}}run(t,n){let r=n&&this.getCompositionContext(n.text);for(let i=0,s=0,a=0;;){let l=ai){let u=c-i;this.preserve(u,!a,!l),i=c,s+=u}if(!l)break;n&&l.fromA<=n.range.fromA&&l.toA>=n.range.toA?(this.forward(l.fromA,n.range.fromA,n.range.fromA{if(a.isWidget())if(this.openWidget)this.builder.continueWidget(c-l);else{let u=c>0||l{a.isLine()?this.builder.addLineStart(a.attrs,this.cache.maybeReuse(a)):(this.cache.add(a),a instanceof Vo&&i.unshift(a.mark)),this.openWidget=!1},leave:a=>{a.isLine()?i.length&&(i.length=s=0):a instanceof Vo&&(i.shift(),s=Math.min(s,i.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(t)}emit(t,n){let r=null,i=this.builder,s=-1,a=gr.spans(this.decorations,t,n,{point:(l,c,u,d,f,h)=>{if(u instanceof Gg){if(this.disallowBlockEffectsFor[h]){if(u.block)throw new RangeError("Block decorations may not be specified via plugins");if(c>this.view.state.doc.lineAt(l).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(s=d.length,f>d.length)i.continueWidget(c-l);else{let m=u.widget||(u.block?x1.block:x1.inline),g=Cpt(u),b=this.cache.findWidget(m,c-l,g)||Yg.of(m,this.view,c-l,g);u.block?(u.startSide>0&&i.addLineStartIfNotCovered(r),i.addBlockWidget(b)):(i.ensureLine(r),i.addInlineWidget(b,d,f))}r=null}else r=Apt(r,u);c>l&&this.text.skip(c-l)},span:(l,c,u,d)=>{for(let f=l;f-1&&(this.openWidget=a>s),this.openWidget||i.addLineStartIfNotCovered(r),this.openMarks=a}forward(t,n,r=1){n-t<=10?this.old.advance(n-t,r,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(n-t-10,-1),this.old.advance(5,r,this.reuseWalker))}getCompositionContext(t){let n=[],r=null;for(let i=t.parentNode;;i=i.parentNode){let s=hs.get(i);if(i==this.view.contentDOM)break;s instanceof Vo?n.push(s):s!=null&&s.isLine()?r=s:s instanceof Ff||(i.nodeName=="DIV"&&!r&&i!=this.view.contentDOM?r=new O1(i,yye):r||n.push(Vo.of(new ME({tagName:i.nodeName.toLowerCase(),attributes:npt(i)}),i)))}return{line:r,marks:n}}}function DY(e,t){let n=r=>{for(let i of r.children)if((t?i.isText():i.length)||n(i))return!0;return!1};return n(e)}function Cpt(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;return e.block&&(t|=256),t}const yye={class:"cm-line"};function Apt(e,t){let n=t.spec.attributes,r=t.spec.class;return!n&&!r||(e||(e={class:"cm-line"}),n&&fQ(n,e),r&&(e.class+=" "+r)),e}function Npt(e){let t=[];for(let n=e.parents.length;n>1;n--){let r=n==e.parents.length?e.tile:e.parents[n].tile;r instanceof Vo&&t.push(r.mark)}return t}function $D(e){let t=hs.get(e);return t&&t.setDOM(e.cloneNode()),e}class x1 extends Nu{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}x1.inline=new x1("span");x1.block=new x1("div");const BD=new class extends Nu{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class PY{constructor(t){this.view=t,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=dn.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new tR(t,t.contentDOM),this.updateInner([new Cc(0,0,0,t.state.doc.length)],null)}update(t){var n;let r=t.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:d,toA:f})=>fthis.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(t);let i=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?i=this.domChanged.newSel.head:!Bpt(t.changes,this.hasComposition)&&!t.selectionSet&&(i=t.state.selection.main.head));let s=i>-1?Rpt(this.view,t.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:d,to:f}=this.hasComposition;r=new Cc(d,f,t.changes.mapPos(d,-1),t.changes.mapPos(f,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,($t.ie||$t.chrome)&&!s&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,l=this.blockWrappers;this.updateDeco();let c=Ppt(a,this.decorations,t.changes);c.length&&(r=Cc.extendWithRanges(r,c));let u=Lpt(l,this.blockWrappers,t.changes);return u.length&&(r=Cc.extendWithRanges(r,u)),s&&!r.some(d=>d.fromA<=s.range.fromA&&d.toA>=s.range.toA)&&(r=s.range.addToSet(r.slice())),this.tile.flags&2&&r.length==0?!1:(this.updateInner(r,s),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,n){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(n||t.length){let a=this.tile,l=new Tpt(this.view,a,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&hs.get(n.text)&&l.cache.reused.set(hs.get(n.text),2),this.tile=l.run(t,n),t6(a,l.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let s=$t.chrome||$t.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(s),s&&(s.written||r.selectionRange.focusNode!=s.node||!this.tile.dom.contains(s.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let i=[];if(this.view.viewport.from||this.view.viewport.to-1)&&Hv(r,this.view.observer.selectionRange)&&!(i&&r.contains(i));if(!(s||n||a))return;let l=this.forceSelection;this.forceSelection=!1;let c=this.view.state.selection.main,u,d;if(c.empty?d=u=this.inlineDOMNearPos(c.anchor,c.assoc||1):(d=this.inlineDOMNearPos(c.head,c.head==c.from?1:-1),u=this.inlineDOMNearPos(c.anchor,c.anchor==c.from?1:-1)),$t.gecko&&c.empty&&!this.hasComposition&&jpt(u)){let h=document.createTextNode("");this.view.observer.ignore(()=>u.node.insertBefore(h,u.node.childNodes[u.offset]||null)),u=d=new du(h,0),l=!0}let f=this.view.observer.selectionRange;(l||!f.focusNode||(!Xv(u.node,u.offset,f.anchorNode,f.anchorOffset)||!Xv(d.node,d.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,c))&&(this.view.observer.ignore(()=>{$t.android&&$t.chrome&&r.contains(f.focusNode)&&$pt(f.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let h=sS(this.view.root);if(h)if(c.empty){if($t.gecko){let m=Ipt(u.node,u.offset);if(m&&m!=3){let g=(m==1?Zbe:Kbe)(u.node,u.offset);g&&(u=new du(g.node,g.offset))}}h.collapse(u.node,u.offset),c.bidiLevel!=null&&h.caretBidiLevel!==void 0&&(h.caretBidiLevel=c.bidiLevel)}else if(h.extend){h.collapse(u.node,u.offset);try{h.extend(d.node,d.offset)}catch{}}else{let m=document.createRange();c.anchor>c.head&&([u,d]=[d,u]),m.setEnd(d.node,d.offset),m.setStart(u.node,u.offset),h.removeAllRanges(),h.addRange(m)}a&&this.view.root.activeElement==r&&(r.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(u,d)),this.impreciseAnchor=u.precise?null:new du(f.anchorNode,f.anchorOffset),this.impreciseHead=d.precise?null:new du(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(t,n){return this.hasComposition&&n.empty&&Xv(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,n=t.state.selection.main,r=sS(t.root),{anchorNode:i,anchorOffset:s}=t.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let a=this.lineAt(n.head,n.assoc);if(!a)return;let l=a.posAtStart;if(n.head==l||n.head==l+a.length)return;let c=this.coordsAt(n.head,-1),u=this.coordsAt(n.head,1);if(!c||!u||c.bottom>u.top)return;let d=this.domAtPos(n.head+n.assoc,n.assoc);r.collapse(d.node,d.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let f=t.observer.selectionRange;t.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=n.from&&r.collapse(i,s)}posFromDOM(t,n){let r=this.tile.nearest(t);if(!r)return this.tile.dom.compareDocumentPosition(t)&2?0:this.view.state.doc.length;let i=r.posAtStart;if(r.isComposite()){let s;if(t==r.dom)s=r.dom.childNodes[n];else{let a=ah(t)==0?0:n==0?-1:1;for(;;){let l=t.parentNode;if(l==r.dom)break;a==0&&l.firstChild!=l.lastChild&&(t==l.firstChild?a=-1:a=1),t=l}a<0?s=t:s=t.nextSibling}if(s==r.dom.firstChild)return i;for(;s&&!hs.get(s);)s=s.nextSibling;if(!s)return i+r.length;for(let a=0,l=i;;a++){let c=r.children[a];if(c.dom==s)return l;l+=c.length+c.breakAfter}}else return r.isText()?t==r.dom?i+n:i+(n?r.length:0):i}domAtPos(t,n){let{tile:r,offset:i}=this.tile.resolveBlock(t,n);return r.isWidget()?r.domPosFor(i,n):r.domIn(i,n)}inlineDOMNearPos(t,n){let r,i=-1,s=!1,a,l=-1,c=!1;return this.tile.blockTiles((u,d)=>{if(u.isWidget()){if(u.flags&32&&d>=t)return!0;u.flags&16&&(s=!0)}else{let f=d+u.length;if(d<=t&&(r=u,i=t-d,s=f=t&&!a&&(a=u,l=t-d,c=d>t),d>t&&a)return!0}}),!r&&!a?this.domAtPos(t,n):(s&&a?r=null:c&&r&&(a=null),r&&n<0||!a?r.domIn(i,n):a.domIn(l,n))}coordsAt(t,n,r){let{tile:i,offset:s}=this.tile.resolveBlock(t,n);return i.isWidget()?i.widget instanceof QD?null:i.coordsInWidget(s,n,!0):i.coordsIn(s,n,r)}lineAt(t,n){let{tile:r}=this.tile.resolveBlock(t,n);return r.isLine()?r:null}coordsForChar(t){let{tile:n,offset:r}=this.tile.resolveBlock(t,1);if(!n.isLine())return null;function i(s,a){if(s.isComposite())for(let l of s.children){if(l.length>=a){let c=i(l,a);if(c)return c}if(a-=l.length,a<0)break}else if(s.isText()&&aMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,c=this.view.textDirection==xi.LTR,u=0,d=(f,h,m)=>{for(let g=0;gi);g++){let b=f.children[g],y=h+b.length,O=b.dom.getBoundingClientRect(),{height:v}=O;if(m&&!g&&(u+=O.top-m.top),b instanceof Ff)y>r&&d(b,h,O);else if(h>=r&&(u>0&&n.push(-u),n.push(v+u),u=0,a)){let x=b.dom.lastChild,w=x?qv(x):[];if(w.length){let S=w[w.length-1],E=c?S.right-O.left:O.right-S.left;E>l&&(l=E,this.minWidth=s,this.minWidthFrom=h,this.minWidthTo=y)}}m&&g==f.children.length-1&&(u+=m.bottom-O.bottom),h=y+b.breakAfter}};return d(this.tile,0,null),n}textDirectionAt(t){let{tile:n}=this.tile.resolveBlock(t,1);return getComputedStyle(n.dom).direction=="rtl"?xi.RTL:xi.LTR}measureTextSize(){let t=this.tile.blockTiles(a=>{if(a.isLine()&&a.children.length&&a.length<=20){let l=0,c;for(let u of a.children){if(!u.isText()||/[^ -~]/.test(u.text))return;let d=qv(u.dom);if(d.length!=1)return;l+=d[0].width,c=d[0].height}if(l)return{lineHeight:a.dom.getBoundingClientRect().height,charWidth:l/a.length,textHeight:c}}});if(t)return t;let n=document.createElement("div"),r,i,s;return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(n);let a=qv(n.firstChild)[0];r=n.getBoundingClientRect().height,i=a&&a.width?a.width/27:7,s=a&&a.height?a.height:r,n.remove()}),{lineHeight:r,charWidth:i,textHeight:s}}computeBlockGapDeco(){let t=[],n=this.view.viewState;for(let r=0,i=0;;i++){let s=i==n.viewports.length?null:n.viewports[i],a=s?s.from-1:this.view.state.doc.length;if(a>r){let l=(n.lineBlockAt(a).bottom-n.lineBlockAt(r).top)/this.view.scaleY;t.push(dn.replace({widget:new QD(l),block:!0,inclusive:!0,isBlockGap:!0}).range(r,a))}if(!s)break;r=s.to+1}return dn.set(t)}updateDeco(){let t=1,n=this.view.state.facet(Jj).map(s=>(this.dynamicDecorationMap[t++]=typeof s=="function")?s(this.view):s),r=!1,i=this.view.state.facet(yQ).map((s,a)=>{let l=typeof s=="function";return l&&(r=!0),l?s(this.view):s});for(i.length&&(this.dynamicDecorationMap[t++]=r,n.push(gr.join(i))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];ttypeof s=="function"?s(this.view):s)}scrollIntoView(t){if(t.isSnapshot){let u=this.view.viewState.lineBlockAt(t.range.head);this.view.scrollDOM.scrollTop=u.top-t.yMargin,this.view.scrollDOM.scrollLeft=t.xMargin;return}for(let u of this.view.state.facet(fye))try{if(u(this.view,t.range,t))return!0}catch(d){Go(this.view.state,d,"scroll handler")}let{range:n}=t,r=this.coordsAt(n.head,n.assoc||(n.head>n.anchor?-1:1)),i;if(!r)return;!n.empty&&(i=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,i.left),top:Math.min(r.top,i.top),right:Math.max(r.right,i.right),bottom:Math.max(r.bottom,i.bottom)});let s=OQ(this.view),a={left:r.left-s.left,top:r.top-s.top,right:r.right+s.right,bottom:r.bottom+s.bottom},{offsetWidth:l,offsetHeight:c}=this.view.scrollDOM;if(spt(this.view.scrollDOM,a,n.head1&&(r.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||r.bottomr.isWidget()||r.children.some(n);return n(this.tile.resolveBlock(t,1).tile)}destroy(){t6(this.tile)}}function t6(e,t){let n=t==null?void 0:t.get(e);if(n!=1){n==null&&e.destroy();for(let r of e.children)t6(r,t)}}function jpt(e){return e.node.nodeType==1&&e.node.firstChild&&(e.offset==0||e.node.childNodes[e.offset-1].contentEditable=="false")&&(e.offset==e.node.childNodes.length||e.node.childNodes[e.offset].contentEditable=="false")}function Oye(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=Zbe(n.focusNode,n.focusOffset),i=Kbe(n.focusNode,n.focusOffset),s=r||i;if(i&&r&&i.node!=r.node){let l=hs.get(i.node);if(!l||l.isText()&&l.text!=i.node.nodeValue)s=i;else if(e.docView.lastCompositionAfterCursor){let c=hs.get(r.node);!c||c.isText()&&c.text!=r.node.nodeValue||(s=i)}}if(e.docView.lastCompositionAfterCursor=s!=r,!s)return null;let a=t-s.offset;return{from:a,to:a+s.node.nodeValue.length,node:s.node}}function Rpt(e,t,n){let r=Oye(e,n);if(!r)return null;let{node:i,from:s,to:a}=r,l=i.nodeValue;if(/[\n\r]/.test(l)||e.state.doc.sliceString(r.from,r.to)!=l)return null;let c=t.invertedDesc;return{range:new Cc(c.mapPos(s),c.mapPos(a),s,a),text:i}}function Ipt(e,t){return e.nodeType!=1?0:(t&&e.childNodes[t-1].contentEditable=="false"?1:0)|(t{rt.from&&(n=!0)}),n}class QD extends Nu{constructor(t){super(),this.height=t}toDOM(){let t=document.createElement("div");return t.className="cm-gap",this.updateDOM(t),t}eq(t){return t.height==this.height}updateDOM(t){return t.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function Qpt(e,t,n=1){let r=e.charCategorizer(t),i=e.doc.lineAt(t),s=t-i.from;if(i.length==0)return Je.cursor(t);s==0?n=1:s==i.length&&(n=-1);let a=s,l=s;n<0?a=ba(i.text,s,!1):l=ba(i.text,s);let c=r(i.text.slice(a,l));for(;a>0;){let u=ba(i.text,a,!1);if(r(i.text.slice(u,a))!=c)break;a=u}for(;le.defaultLineHeight*1.5){let l=e.viewState.heightOracle.textHeight,c=Math.floor((i-n.top-(e.defaultLineHeight-l)*.5)/l);s+=c*e.viewState.heightOracle.lineLength}let a=e.state.sliceDoc(n.from,n.to);return n.from+zL(a,s,e.state.tabSize)}function n6(e,t,n){let r=e.lineBlockAt(t);if(Array.isArray(r.type)){let i;for(let s of r.type){if(s.from>t)break;if(!(s.tot)return s;(!i||s.type==Ba.Text&&(i.type!=s.type||(n<0?s.fromt)))&&(i=s)}}return i||r}return r}function Fpt(e,t,n,r){let i=n6(e,t.head,t.assoc||-1),s=!r||i.type!=Ba.Text||!(e.lineWrapping||i.widgetLineBreaks)?null:e.coordsAtPos(t.assoc<0&&t.head>i.from?t.head-1:t.head);if(s){let a=e.dom.getBoundingClientRect(),l=e.textDirectionAt(i.from),c=e.posAtCoords({x:n==(l==xi.LTR)?a.right-1:a.left+1,y:(s.top+s.bottom)/2});if(c!=null)return Je.cursor(c,n?-1:1)}return Je.cursor(n?i.to:i.from,n?-1:1)}function MY(e,t,n,r){let i=e.state.doc.lineAt(t.head),s=e.bidiSpans(i),a=e.textDirectionAt(i.from);for(let l=t,c=null;;){let u=gpt(i,s,a,l,n),d=rye;if(!u){if(i.number==(n?e.state.doc.lines:1))return l;d=` -`,i=e.state.doc.line(i.number+(n?1:-1)),s=e.bidiSpans(i),u=e.visualLineSide(i,!n)}if(c){if(!c(d))return l}else{if(!r)return u;c=r(d)}l=u}}function zpt(e,t,n){let r=e.state.charCategorizer(t),i=r(n);return s=>{let a=r(s);return i==Yi.Space&&(i=a),i==a}}function Vpt(e,t,n,r){let i=t.head,s=n?1:-1;if(i==(n?e.state.doc.length:0))return Je.cursor(i,t.assoc);let a=t.goalColumn,l,c=e.contentDOM.getBoundingClientRect(),u=e.coordsAtPos(i,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),d=e.documentTop;if(u)a==null&&(a=u.left-c.left),l=s<0?u.top:u.bottom;else{let g=e.viewState.lineBlockAt(i);a==null&&(a=Math.min(c.right-c.left,e.defaultCharacterWidth*(i-g.from))),l=(s<0?g.top:g.bottom)+d}let f=c.left+a,h=e.viewState.heightOracle.textHeight>>1,m=r??h;for(let g=0;;g+=h){let b=l+(m+g)*s,y=r6(e,{x:f,y:b},!1,s);if(n?b>c.bottom:bl:v{if(t>s&&ti(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:Je.cursor(r,re.viewState.docHeight)return new Zu(e.state.doc.length,-1);if(u=e.elementAtHeight(c),r==null)break;if(u.type==Ba.Text){if(r<0?u.toe.viewport.to)break;let h=e.docView.coordsAt(r<0?u.from:u.to,r>0?-1:1);if(h&&(r<0?h.top<=c+s:h.bottom>=c+s))break}let f=e.viewState.heightOracle.textHeight/2;c=r>0?u.bottom+f:u.top-f}if(e.viewport.from>=u.to||e.viewport.to<=u.from){if(n)return null;if(u.type==Ba.Text){let f=Upt(e,i,u,a,l);return new Zu(f,f==u.from?1:-1)}}if(u.type!=Ba.Text)return c<(u.top+u.bottom)/2?new Zu(u.from,1):new Zu(u.to,-1);let d=e.docView.lineAt(u.from,2);return(!d||d.length!=u.length)&&(d=e.docView.lineAt(u.from,-2)),new Hpt(e,a,l,e.textDirectionAt(u.from)).scanTile(d,u.from)}class Hpt{constructor(t,n,r,i){this.view=t,this.x=n,this.y=r,this.baseDir=i,this.line=null,this.spans=null}bidiSpansAt(t){return(!this.line||this.line.from>t||this.line.to1||r.length&&(r[0].level!=this.baseDir||r[0].to+i.from>1;t:if(a.has(b)){let O=i+Math.floor(Math.random()*g);for(let v=0;v1)){if(v.bottomthis.y)(!u||u.top>v.top)&&(u=v),x=-1;else{let w=v.left>this.x?this.x-v.left:v.right(g+g+b)/3)return this.y=c.bottom-1,this.scan(t,n,!0);if(u&&u.top<(g+b+b)/3)return this.y=u.top+1,this.scan(t,n,!0)}let m=(l?this.dirAt(t[d],1):this.baseDir)==xi.LTR;return{i:d,after:this.x>(h.left+h.right)/2==m}}scanText(t,n){let r=[];for(let s=0;s{let a=r[s]-n,l=r[s+1]-n;return oS(t.dom,a,l).getClientRects()});return i.after?new Zu(r[i.i+1],-1):new Zu(r[i.i],1)}scanTile(t,n){if(!t.length)return new Zu(n,1);if(t.children.length==1){let l=t.children[0];if(l.isText())return this.scanText(l,n);if(l.isComposite())return this.scanTile(l,n)}let r=[n];for(let l=0,c=n;l{let c=t.children[l];return c.flags&48?null:(c.dom.nodeType==1?c.dom:oS(c.dom,0,c.length)).getClientRects()}),s=t.children[i.i],a=r[i.i];return s.isText()?this.scanText(s,a):s.isComposite()?this.scanTile(s,a):i.after?new Zu(r[i.i+1],-1):new Zu(a,1)}}const xb="￿";class qpt{constructor(t,n){this.points=t,this.view=n,this.text="",this.lineSeparator=n.state.facet(vr.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=xb}readRange(t,n){if(!t)return this;let r=t.parentNode;for(let i=t;;){this.findPointBefore(r,i);let s=this.text.length;this.readNode(i);let a=hs.get(i),l=i.nextSibling;if(l==n){a!=null&&a.breakAfter&&!l&&r!=this.view.contentDOM&&this.lineBreak();break}let c=hs.get(l);(a&&c?a.breakAfter:(a?a.breakAfter:mA(i))||mA(l)&&(i.nodeName!="BR"||a!=null&&a.isWidget())&&this.text.length>s)&&!Gpt(l,n)&&this.lineBreak(),i=l}return this.findPointBefore(r,n),this}readTextNode(t){let n=t.nodeValue;for(let r of this.points)r.node==t&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,a=1,l;if(this.lineSeparator?(s=n.indexOf(this.lineSeparator,r),a=this.lineSeparator.length):(l=i.exec(n))&&(s=l.index,a=l[0].length),this.append(n.slice(r,s<0?n.length:s)),s<0)break;if(this.lineBreak(),a>1)for(let c of this.points)c.node==t&&c.pos>this.text.length&&(c.pos-=a-1);r=s+a}}readNode(t){let n=hs.get(t),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(t,r.length);for(let i=r.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.value)}else t.nodeType==3?this.readTextNode(t):t.nodeName=="BR"?t.nextSibling&&this.lineBreak():t.nodeType==1&&this.readRange(t.firstChild,null)}findPointBefore(t,n){for(let r of this.points)r.node==t&&t.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(t,n){for(let r of this.points)(t.nodeType==3?r.node==t:t.contains(r.node))&&(r.pos=this.text.length+(Xpt(t,r.node,r.offset)?n:0))}}function Xpt(e,t,n){for(;;){if(!t||n-1;let{impreciseHead:s,impreciseAnchor:a}=t.docView,l=t.state.selection;if(t.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=vye(t.docView.tile,n,r,0))){let c=s||a?[]:Zpt(t),u=new qpt(c,t);u.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=u.text,this.newSel=Kpt(c,this.bounds.from)}else{let c=t.observer.selectionRange,u=s&&s.node==c.focusNode&&s.offset==c.focusOffset||!YL(t.contentDOM,c.focusNode)?l.main.head:t.docView.posFromDOM(c.focusNode,c.focusOffset),d=a&&a.node==c.anchorNode&&a.offset==c.anchorOffset||!YL(t.contentDOM,c.anchorNode)?l.main.anchor:t.docView.posFromDOM(c.anchorNode,c.anchorOffset),f=t.viewport;if(($t.ios||$t.chrome)&&u!=d&&Math.min(u,d)<=l.main.from&&Math.max(u,d)>=l.main.to&&(f.from>0||f.to-1&&l.ranges.length>1)this.newSel=l.replaceRange(Je.range(d,u));else if(t.lineWrapping&&d==u&&!(l.main.empty&&l.main.head==u)&&t.inputState.lastTouchTime>Date.now()-100){let h=t.coordsAtPos(u,-1),m=0;h&&(m=t.inputState.lastTouchY<=h.bottom?-1:1),this.newSel=Je.create([Je.cursor(u,m)])}else this.newSel=Je.single(d,u)}}}function vye(e,t,n,r){if(e.isComposite()){let i=-1,s=-1,a=-1,l=-1;for(let c=0,u=r,d=r;cn)return vye(f,t,n,u);if(h>=t&&i==-1&&(i=c,s=u),u>n&&f.dom.parentNode==e.dom){a=c,l=d;break}d=h,u=h+f.breakAfter}return{from:s,to:l<0?r+e.length:l,startDOM:(i?e.children[i-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:a=0?e.children[a].dom:null}}else return e.isText()?{from:r,to:r+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function wye(e,t){let n,{newSel:r}=t,{state:i}=e,s=i.selection.main,a=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:l,to:c}=t.bounds,u=s.from,d=null;(a===8||$t.android&&t.text.length=l&&s.to<=c&&(t.typeOver||f!=t.text)&&f.slice(0,s.from-l)==t.text.slice(0,s.from-l)&&f.slice(s.to-l)==t.text.slice(h=t.text.length-(f.length-(s.to-l)))?n={from:s.from,to:s.to,insert:Br.of(t.text.slice(s.from-l,h).split(xb))}:(m=Sye(f,t.text,u-l,d))&&($t.chrome&&a==13&&m.toB==m.from+2&&t.text.slice(m.from,m.toB)==xb+xb&&m.toB--,n={from:l+m.from,to:l+m.toA,insert:Br.of(t.text.slice(m.from,m.toB).split(xb))})}else r&&(!e.hasFocus&&i.facet(xf)||OA(r,s))&&(r=null);if(!n&&!r)return!1;if(($t.mac||$t.android)&&n&&n.from==n.to&&n.from==s.head-1&&/^\. ?$/.test(n.insert.toString())&&e.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=Je.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:Br.of([n.insert.toString().replace("."," ")])}):i.doc.lineAt(s.from).toDate.now()-50?n={from:s.from,to:s.to,insert:i.toText(e.inputState.insertingText)}:$t.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==` - `&&e.lineWrapping&&(r&&(r=Je.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:Br.of([" "])}),n)return xQ(e,n,r,a);if(r&&!OA(r,s)){let l=!1,c="select";return e.inputState.lastSelectionTime>Date.now()-50&&(e.inputState.lastSelectionOrigin=="select"&&(l=!0),c=e.inputState.lastSelectionOrigin,c=="select.pointer"&&(r=xye(i.facet($E).map(u=>u(e)),r))),e.dispatch({selection:r,scrollIntoView:l,userEvent:c}),!0}else return!1}function xQ(e,t,n,r=-1){if($t.ios&&e.inputState.flushIOSKey(t))return!0;let i=e.state.selection.main;if($t.android&&(t.to==i.to&&(t.from==i.from||t.from==i.from-1&&e.state.sliceDoc(t.from,i.from)==" ")&&t.insert.length==1&&t.insert.lines==2&&_y(e.contentDOM,"Enter",13)||(t.from==i.from-1&&t.to==i.to&&t.insert.length==0||r==8&&t.insert.lengthi.head)&&_y(e.contentDOM,"Backspace",8)||t.from==i.from&&t.to==i.to+1&&t.insert.length==0&&_y(e.contentDOM,"Delete",46)))return!0;let s=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let a,l=()=>a||(a=Ypt(e,t,n));return e.state.facet(lye).some(c=>c(e,t.from,t.to,s,l))||e.dispatch(l()),!0}function Ypt(e,t,n){let r,i=e.state,s=i.selection.main,a=-1;if(t.from==t.to&&t.froms.to){let c=t.fromf(e)),u,c);t.from==d&&(a=d)}if(a>-1)r={changes:t,selection:Je.cursor(t.from+t.insert.length,-1)};else if(t.from>=s.from&&t.to<=s.to&&t.to-t.from>=(s.to-s.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let c=s.fromt.to?i.sliceDoc(t.to,s.to):"";r=i.replaceSelection(e.state.toText(c+t.insert.sliceString(0,void 0,e.state.lineBreak)+u))}else{let c=i.changes(t),u=n&&n.main.to<=c.newLength?n.main:void 0;if(i.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=s.to+10&&t.to>=s.to-10){let d=e.state.sliceDoc(t.from,t.to),f,h=n&&Oye(e,n.main.head);if(h){let g=t.insert.length-(t.to-t.from);f={from:h.from,to:h.to-g}}else f=e.state.doc.lineAt(s.head);let m=s.to-t.to;r=i.changeByRange(g=>{if(g.from==s.from&&g.to==s.to)return{changes:c,range:u||g.map(c)};let b=g.to-m,y=b-d.length;if(e.state.sliceDoc(y,b)!=d||b>=f.from&&y<=f.to)return{range:g};let O=i.changes({from:y,to:b,insert:t.insert}),v=g.to-s.to;return{changes:O,range:u?Je.range(Math.max(0,u.anchor+v),Math.max(0,u.head+v)):g.map(O)}})}else r={changes:c,selection:u&&i.selection.replaceRange(u)}}let l="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,l+=".compose",e.inputState.compositionFirstChange&&(l+=".start",e.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:l,scrollIntoView:!0})}function Sye(e,t,n,r){let i=Math.min(e.length,t.length),s=0;for(;s0&&l>0&&e.charCodeAt(a-1)==t.charCodeAt(l-1);)a--,l--;if(r=="end"){let c=Math.max(0,s-Math.min(a,l));n-=a+c-s}if(a=a?s-n:0;s-=c,l=s+(l-a),a=s}else if(l=l?s-n:0;s-=c,a=s+(a-l),l=s}return{from:s,toA:a,toB:l}}function Zpt(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}=e.observer.selectionRange;return n&&(t.push(new LY(n,r)),(i!=n||s!=r)&&t.push(new LY(i,s))),t}function Kpt(e,t){if(e.length==0)return null;let n=e[0].pos,r=e.length==2?e[1].pos:n;return n>-1&&r>-1?Je.single(n+t,r+t):null}function OA(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class Jpt{setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}constructor(t){this.view=t,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=t.hasFocus,$t.safari&&t.contentDOM.addEventListener("input",()=>null),$t.gecko&&mmt(t.contentDOM.ownerDocument)}handleEvent(t){!lmt(this.view,t)||this.ignoreDuringComposition(t)||t.type=="keydown"&&this.keydown(t)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(t.type,t)):this.runHandlers(t.type,t))}runHandlers(t,n){let r=this.handlers[t];if(r){for(let i of r.observers)i(this.view,n);for(let i of r.handlers){if(n.defaultPrevented)break;if(i(this.view,n)){n.preventDefault();break}}}}ensureHandlers(t){let n=tmt(t),r=this.handlers,i=this.view.contentDOM;for(let s in n)if(s!="scroll"){let a=!n[s].handlers.length,l=r[s];l&&a!=!l.handlers.length&&(i.removeEventListener(s,this.handleEvent),l=null),l||i.addEventListener(s,this.handleEvent,{passive:a})}for(let s in r)s!="scroll"&&!n[s]&&i.removeEventListener(s,this.handleEvent);this.handlers=n}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&t.keyCode!=27&&kye.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),$t.android&&$t.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;if($t.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&(Eye.some(n=>n.keyCode==t.keyCode)&&!t.ctrlKey||nmt.indexOf(t.key)>-1&&t.ctrlKey)){let n={ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey,shiftKey:t.shiftKey};return n.shiftKey&&$t.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&emt(this.view.win)&&(n.shiftKey=!1),this.pendingIOSKey={key:t.key,keyCode:t.keyCode,mods:n},setTimeout(()=>this.flushIOSKey(),250),!0}return t.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(t){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&t&&t.from0?!0:$t.safari&&!$t.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.view.observer.update(t),this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function emt(e){return e.visualViewport?e.visualViewport.height*e.visualViewport.scale/e.document.documentElement.clientHeight<.85:!1}function $Y(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(i){Go(n.state,i)}}}function tmt(e){let t=Object.create(null);function n(r){return t[r]||(t[r]={observers:[],handlers:[]})}for(let r of e){let i=r.spec,s=i&&i.plugin.domEventHandlers,a=i&&i.plugin.domEventObservers;if(s)for(let l in s){let c=s[l];c&&n(l).handlers.push($Y(r.value,c))}if(a)for(let l in a){let c=a[l];c&&n(l).observers.push($Y(r.value,c))}}for(let r in wu)n(r).handlers.push(wu[r]);for(let r in Eo)n(r).observers.push(Eo[r]);return t}const Eye=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],nmt="dthko",kye=[16,17,18,20,91,92,224,225],U2=6;function F2(e){return Math.max(0,e)*.7+8}function rmt(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}class imt{constructor(t,n,r,i){this.view=t,this.startEvent=n,this.style=r,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=Gbe(t.contentDOM),this.atoms=t.state.facet($E).map(a=>a(t));let s=t.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=t.state.facet(vr.allowMultipleSelections)&&smt(t,n),this.dragging=omt(t,n)&&Cye(n)==1?null:!1}start(t){this.dragging===!1&&this.select(t)}move(t){if(t.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&rmt(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let n=0,r=0,i=0,s=0,a=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:l}=this.scrollParents.y.getBoundingClientRect());let c=OQ(this.view);t.clientX-c.left<=i+U2?n=-F2(i-t.clientX):t.clientX+c.right>=a-U2&&(n=F2(t.clientX-a)),t.clientY-c.top<=s+U2?r=-F2(s-t.clientY):t.clientY+c.bottom>=l-U2&&(r=F2(t.clientY-l)),this.setScrollSpeed(n,r)}up(t){this.dragging==null&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,n){this.scrollSpeed={x:t,y:n},t||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:t,y:n}=this.scrollSpeed;t&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=t,t=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(t||n)&&this.view.win.scrollBy(t,n),this.dragging===!1&&this.select(this.lastEvent)}select(t){let{view:n}=this,r=xye(this.atoms,this.style.get(t,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(t)&&setTimeout(()=>this.select(this.lastEvent),20)}}function smt(e,t){let n=e.state.facet(iye);return n.length?n[0](t):$t.mac?t.metaKey:t.ctrlKey}function amt(e,t){let n=e.state.facet(sye);return n.length?n[0](t):$t.mac?!t.altKey:!t.ctrlKey}function omt(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=sS(e.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let s=0;s=t.clientX&&a.top<=t.clientY&&a.bottom>=t.clientY)return!0}return!1}function lmt(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target,r;n!=e.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=hs.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(t))return!1;return!0}const wu=Object.create(null),Eo=Object.create(null),_ye=$t.ie&&$t.ie_version<15||$t.ios&&$t.webkit_version<604;function cmt(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{e.focus(),n.remove(),Tye(e,n.value)},50)}function nR(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function Tye(e,t){t=nR(e.state,mQ,t);let{state:n}=e,r,i=1,s=n.toText(t),a=s.lines==n.selection.ranges.length;if(i6!=null&&n.selection.ranges.every(c=>c.empty)&&i6==s.toString()){let c=-1;r=n.changeByRange(u=>{let d=n.doc.lineAt(u.from);if(d.from==c)return{range:u};c=d.from;let f=n.toText((a?s.line(i++).text:t)+n.lineBreak);return{changes:{from:d.from,insert:f},range:Je.cursor(u.from+f.length)}})}else a?r=n.changeByRange(c=>{let u=s.line(i++);return{changes:{from:c.from,to:c.to,insert:u.text},range:Je.cursor(c.from+u.length)}}):r=n.replaceSelection(s);e.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Eo.scroll=e=>{let t=e.inputState;t.lastScrollTop=e.scrollDOM.scrollTop,t.lastScrollLeft=e.scrollDOM.scrollLeft,$t.ios&&!t.touchActive&&(t.lastIOSMomentumScroll=Date.now())};Eo.wheel=Eo.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()};wu.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1);Eo.touchstart=(e,t)=>{let n=e.inputState,r=t.targetTouches[0];n.touchActive=!0,n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin("select.pointer")};Eo.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")};Eo.touchend=(e,t)=>{e.inputState.touchActive=!1};wu.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of e.state.facet(aye))if(n=r(e,t),n)break;if(!n&&t.button==0&&(n=dmt(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new imt(e,t,n,r)),r&&e.observer.ignore(()=>{Wbe(e.contentDOM);let s=e.root.activeElement;s&&!s.contains(e.contentDOM)&&s.blur()});let i=e.inputState.mouseSelection;if(i)return i.start(t),i.dragging===!1}else e.inputState.setSelectionOrigin("select.pointer");return!1};function BY(e,t,n,r){if(r==1)return Je.cursor(t,n);if(r==2)return Qpt(e.state,t,n);{let i=e.docView.lineAt(t,n),s=e.state.doc.lineAt(i?i.posAtEnd:t),a=i?i.posAtStart:s.from,l=i?i.posAtEnd:s.to;return lDate.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(UY+1)%3:1}function dmt(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=Cye(t),i=e.state.selection;return{update(s){s.docChanged&&(n.pos=s.changes.mapPos(n.pos),i=i.map(s.changes))},get(s,a,l){let c=e.posAndSideAtCoords({x:s.clientX,y:s.clientY},!1),u,d=BY(e,c.pos,c.assoc,r);if(n.pos!=c.pos&&!a){let f=BY(e,n.pos,n.assoc,r),h=Math.min(f.from,d.from),m=Math.max(f.to,d.to);d=h1&&(u=fmt(i,c.pos))?u:l?i.addRange(d):Je.create([d])}}}function fmt(e,t){for(let n=0;n=t)return Je.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}wu.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let i=e.docView.tile.nearest(t.target);if(i&&i.isWidget()){let s=i.posAtStart,a=s+i.length;(s>=n.to||a<=n.from)&&(n=Je.undirectionalRange(s,a))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",nR(e.state,gQ,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1};wu.dragend=e=>(e.inputState.draggedContent=null,!1);function zY(e,t,n,r){if(n=nR(e.state,mQ,n),!n)return;let i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:s}=e.inputState,a=r&&s&&amt(e,t)?{from:s.from,to:s.to}:null,l={from:i,insert:n},c=e.state.changes(a?[a,l]:l);e.focus(),e.dispatch({changes:c,selection:{anchor:c.mapPos(i,-1),head:c.mapPos(i,1)},userEvent:a?"move.drop":"input.drop"}),e.inputState.draggedContent=null}wu.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,s=()=>{++i==n.length&&zY(e,t,r.filter(a=>a!=null).join(e.state.lineBreak),!1)};for(let a=0;a{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(r[a]=l.result),s()},l.readAsText(n[a])}return!0}else{let r=t.dataTransfer.getData("Text");if(r)return zY(e,t,r,!0),!0}return!1};wu.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=_ye?null:t.clipboardData;return n?(Tye(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(cmt(e),!1)};function hmt(e,t){let n=e.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout(()=>{r.remove(),e.focus()},50)}function pmt(e){let t=[],n=[],r=!1;for(let i of e.selection.ranges)i.empty||(t.push(e.sliceDoc(i.from,i.to)),n.push(i));if(!t.length){let i=-1;for(let{from:s}of e.selection.ranges){let a=e.doc.lineAt(s);a.number>i&&(t.push(a.text),n.push({from:a.from,to:Math.min(e.doc.length,a.to+1)})),i=a.number}r=!0}return{text:nR(e,gQ,t.join(e.lineBreak)),ranges:n,linewise:r}}let i6=null;wu.copy=wu.cut=(e,t)=>{if(!Hv(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:i}=pmt(e.state);if(!n&&!i)return!1;i6=i?n:null,t.type=="cut"&&!e.state.readOnly&&e.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=_ye?null:t.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(hmt(e,n),!1)};const Aye=Ad.define();function Nye(e,t){let n=[];for(let r of e.facet(cye)){let i=r(e,t);i&&n.push(i)}return n.length?e.update({effects:n,annotations:Aye.of(!0)}):null}function jye(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=Nye(e.state,t);n?e.dispatch(n):e.update([])}},10)}Eo.focus=e=>{e.inputState.lastFocusTime=Date.now(),!e.scrollDOM.scrollTop&&(e.inputState.lastScrollTop||e.inputState.lastScrollLeft)&&(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),jye(e)};Eo.blur=e=>{e.observer.clearSelectionRange(),jye(e)};Eo.compositionstart=Eo.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange==null&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))};Eo.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,$t.chrome&&$t.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))};Eo.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()};wu.beforeinput=(e,t)=>{var n,r;if((t.inputType=="insertText"||t.inputType=="insertCompositionText")&&(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),t.inputType=="insertReplacementText"&&e.observer.editContext){let s=(n=t.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),a=t.getTargetRanges();if(s&&a.length){let l=a[0],c=e.posAtDOM(l.startContainer,l.startOffset),u=e.posAtDOM(l.endContainer,l.endOffset);return xQ(e,{from:c,to:u,insert:e.state.toText(s)},null),!0}}let i;if($t.chrome&&$t.android&&(i=Eye.find(s=>s.inputType==t.inputType))&&(e.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let s=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>s+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return $t.ios&&t.inputType=="deleteContentForward"&&e.observer.flushSoon(),$t.safari&&t.inputType=="insertText"&&e.inputState.composing>=0&&setTimeout(()=>Eo.compositionend(e,t),20),!1};const VY=new Set;function mmt(e){VY.has(e)||(VY.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}const HY=["pre-wrap","normal","pre-line","break-spaces"];let v1=!1;function qY(){v1=!1}class gmt{constructor(t){this.lineWrapping=t,this.doc=Br.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(t,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-t-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return HY.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let n=!1;for(let r=0;r-1,c=Math.abs(n-this.lineHeight)>.3||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=n,this.charWidth=r,this.textHeight=i,this.lineLength=s,c){this.heightSamples={};for(let u=0;u0}set outdated(t){this.flags=(t?2:0)|this.flags&-3}setHeight(t){this.height!=t&&(Math.abs(this.height-t)>gT&&(v1=!0),this.height=t)}replace(t,n,r){return So.of(r)}decomposeLeft(t,n){n.push(this)}decomposeRight(t,n){n.push(this)}applyChanges(t,n,r,i){let s=this,a=r.doc;for(let l=i.length-1;l>=0;l--){let{fromA:c,toA:u,fromB:d,toB:f}=i[l],h=s.lineAt(c,_i.ByPosNoHeight,r.setDoc(n),0,0),m=h.to>=u?h:s.lineAt(u,_i.ByPosNoHeight,r,0,0);for(f+=m.to-u,u=m.to;l>0&&h.from<=i[l-1].toA;)c=i[l-1].fromA,d=i[l-1].fromB,l--,cs*2){let l=t[n-1];l.break?t.splice(--n,1,l.left,null,l.right):t.splice(--n,1,l.left,l.right),r+=1+l.break,i-=l.size}else if(s>i*2){let l=t[r];l.break?t.splice(r,1,l.left,null,l.right):t.splice(r,1,l.left,l.right),r+=2+l.break,s-=l.size}else break;else if(i=s&&a(this.lineAt(0,_i.ByPos,r,i,s))}setMeasuredHeight(t){let n=t.heights[t.index++];n<0?(this.spaceAbove=-n,n=t.heights[t.index++]):this.spaceAbove=0,this.setHeight(n)}updateHeight(t,n=0,r=!1,i){return i&&i.from<=n&&i.more&&this.setMeasuredHeight(i),this.outdated=!1,this}toString(){return`block(${this.length})`}}class vl extends Rye{constructor(t,n,r){super(t,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(t,n){return new lu(n,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,n,r){let i=r[0];return r.length==1&&(i instanceof vl||i instanceof Na&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof Na?i=new vl(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):So.of(r)}updateHeight(t,n=0,r=!1,i){return i&&i.from<=n&&i.more?this.setMeasuredHeight(i):(r||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Na extends So{constructor(t){super(t,0)}heightMetrics(t,n){let r=t.doc.lineAt(n).number,i=t.doc.lineAt(n+this.length).number,s=i-r+1,a,l=0;if(t.lineWrapping){let c=Math.min(this.height,t.lineHeight*s);a=c/s,this.length>s+1&&(l=(this.height-c)/(this.length-s-1))}else a=this.height/s;return{firstLine:r,lastLine:i,perLine:a,perChar:l}}blockAt(t,n,r,i){let{firstLine:s,lastLine:a,perLine:l,perChar:c}=this.heightMetrics(n,i);if(n.lineWrapping){let u=i+(t0){let s=r[r.length-1];s instanceof Na?r[r.length-1]=new Na(s.length+i):r.push(null,new Na(i-1))}if(t>0){let s=r[0];s instanceof Na?r[0]=new Na(t+s.length):r.unshift(new Na(t-1),null)}return So.of(r)}decomposeLeft(t,n){n.push(new Na(t-1),null)}decomposeRight(t,n){n.push(null,new Na(this.length-t-1))}updateHeight(t,n=0,r=!1,i){let s=n+this.length;if(i&&i.from<=n+this.length&&i.more){let a=[],l=Math.max(n,i.from),c=-1;for(i.from>n&&a.push(new Na(i.from-n-1).updateHeight(t,n));l<=s&&i.more;){let d=t.doc.lineAt(l).length;a.length&&a.push(null);let f=i.heights[i.index++],h=0;f<0&&(h=-f,f=i.heights[i.index++]),c==-1?c=f:Math.abs(f-c)>=gT&&(c=-2);let m=new vl(d,f,h);m.outdated=!1,a.push(m),l+=d+1}l<=s&&a.push(null,new Na(s-l).updateHeight(t,l));let u=So.of(a);return(c<0||Math.abs(u.height-this.height)>=gT||Math.abs(c-this.heightMetrics(t,n).perLine)>=gT)&&(v1=!0),xA(this,u)}else(r||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Omt extends So{constructor(t,n,r){super(t.length+n+r.length,t.height+r.height,n|(t.outdated||r.outdated?2:0)),this.left=t,this.right=r,this.size=t.size+r.size}get break(){return this.flags&1}blockAt(t,n,r,i){let s=r+this.left.height;return tl))return u;let d=n==_i.ByPosNoHeight?_i.ByPosNoHeight:_i.ByPos;return c?u.join(this.right.lineAt(l,d,r,a,l)):this.left.lineAt(l,d,r,i,s).join(u)}forEachLine(t,n,r,i,s,a){let l=i+this.left.height,c=s+this.left.length+this.break;if(this.break)t=c&&this.right.forEachLine(t,n,r,l,c,a);else{let u=this.lineAt(c,_i.ByPos,r,i,s);t=t&&u.from<=n&&a(u),n>u.to&&this.right.forEachLine(u.to+1,n,r,l,c,a)}}replace(t,n,r){let i=this.left.length+this.break;if(nthis.left.length)return this.balanced(this.left,this.right.replace(t-i,n-i,r));let s=[];t>0&&this.decomposeLeft(t,s);let a=s.length;for(let l of r)s.push(l);if(t>0&&XY(s,a-1),n=r&&n.push(null)),t>r&&this.right.decomposeLeft(t-r,n)}decomposeRight(t,n){let r=this.left.length,i=r+this.break;if(t>=i)return this.right.decomposeRight(t-i,n);t2*n.size||n.size>2*t.size?So.of(this.break?[t,null,n]:[t,n]):(this.left=xA(this.left,t),this.right=xA(this.right,n),this.setHeight(t.height+n.height),this.outdated=t.outdated||n.outdated,this.size=t.size+n.size,this.length=t.length+this.break+n.length,this)}updateHeight(t,n=0,r=!1,i){let{left:s,right:a}=this,l=n+s.length+this.break,c=null;return i&&i.from<=n+s.length&&i.more?c=s=s.updateHeight(t,n,r,i):s.updateHeight(t,n,r),i&&i.from<=l+a.length&&i.more?c=a=a.updateHeight(t,l,r,i):a.updateHeight(t,l,r),c?this.balanced(s,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function XY(e,t){let n,r;e[t]==null&&(n=e[t-1])instanceof Na&&(r=e[t+1])instanceof Na&&e.splice(t-1,3,new Na(n.length+1+r.length))}const xmt=5;class vQ{constructor(t,n){this.pos=t,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof vl?i.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new vl(r-this.pos,-1,0)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(t,n,r){if(t=xmt)&&this.addLineDeco(i,s,a)}else n>t&&this.span(t,n);this.lineEnd>-1&&this.lineEnd-1)return;let{from:t,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=n,this.writtenTot&&this.nodes.push(new vl(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,n){let r=new Na(n-t);return this.oracle.doc.lineAt(t).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof vl)return t;let n=new vl(0,-1,0);return this.nodes.push(n),n}addBlock(t){this.enterLine();let n=t.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,n&&n.endSide>0&&(this.covering=t)}addLineDeco(t,n,r){let i=this.ensureLine();i.length+=r,i.collapsed+=r,i.widgetHeight=Math.max(i.widgetHeight,t),i.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(t){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof vl)&&!this.isCovered?this.nodes.push(new vl(0,-1,0)):(this.writtenTod.clientHeight||d.scrollWidth>d.clientWidth)&&f.overflow!="visible"){let h=d.getBoundingClientRect();s=Math.max(s,h.left),a=Math.min(a,h.right),l=Math.max(l,h.top),c=Math.min(u==e.parentNode?i.innerHeight:c,h.bottom)}u=f.position=="absolute"||f.position=="fixed"?d.offsetParent:d.parentNode}else if(u.nodeType==11)u=u.host;else break;return{left:s-n.left,right:Math.max(s,a)-n.left,top:l-(n.top+t),bottom:Math.max(l,c)-(n.top+t)}}function Emt(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left0&&t.top0}function kmt(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class FD{constructor(t,n,r,i){this.from=t,this.to=n,this.size=r,this.displaySize=i}static same(t,n){if(t.length!=n.length)return!1;for(let r=0;rtypeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new gmt(r),this.stateDeco=YY(n),this.heightMap=So.empty().applyChanges(this.stateDeco,Br.empty,this.heightOracle.setDoc(n.doc),[new Cc(0,0,0,n.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=dn.set(this.lineGaps.map(i=>i.draw(this,!1))),this.scrollParent=t.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let i=r?n.head:n.anchor;if(!t.some(({from:s,to:a})=>i>=s&&i<=a)){let{from:s,to:a}=this.lineBlockAt(i);t.push(new z2(s,a))}}return this.viewports=t.sort((r,i)=>r.from-i.from),this.updateScaler()}updateScaler(){let t=this.scaler;return this.scaler=this.heightMap.height<=7e6?WY:new wQ(this.heightOracle,this.heightMap,this.viewports),t.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,t=>{this.viewportLines.push(Jx(t,this.scaler))})}update(t,n=null){this.state=t.state;let r=this.stateDeco;this.stateDeco=YY(this.state);let i=t.changedRanges,s=Cc.extendWithRanges(i,vmt(r,this.stateDeco,t?t.changes:Js.empty(this.state.doc.length))),a=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);qY(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=a||v1)&&(t.flags|=2),l?(this.scrollAnchorPos=t.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let c=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(n&&(n.range.headc.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,n));let u=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,t.flags|=this.updateForViewport(),(u||!t.changes.empty||t.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(t.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&(t.selectionSet||t.focusChanged)&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(dye)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:t}=this,n=t.contentDOM,r=window.getComputedStyle(n),i=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?xi.RTL:xi.LTR;let a=this.heightOracle.mustRefreshForWrapping(s)||this.mustMeasureContent==="refresh",l=n.getBoundingClientRect(),c=a||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let u=0,d=0;if(l.width&&l.height){let{scaleX:S,scaleY:E}=Xbe(n,l);(S>.005&&Math.abs(this.scaleX-S)>.005||E>.005&&Math.abs(this.scaleY-E)>.005)&&(this.scaleX=S,this.scaleY=E,u|=16,a=c=!0)}let f=(parseInt(r.paddingTop)||0)*this.scaleY,h=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=h)&&(this.paddingTop=f,this.paddingBottom=h,u|=18),this.editorWidth!=t.scrollDOM.clientWidth&&(i.lineWrapping&&(c=!0),this.editorWidth=t.scrollDOM.clientWidth,u|=16);let m=Gbe(this.view.contentDOM,!1).y;m!=this.scrollParent&&(this.scrollParent=m,this.scrollAnchorHeight=-1,this.scrollOffset=0);let g=this.getScrollOffset();this.scrollOffset!=g&&(this.scrollAnchorHeight=-1,this.scrollOffset=g),this.scrolledToBottom=Ybe(this.scrollParent||t.win);let b=(this.printing?kmt:Smt)(n,this.paddingTop),y=b.top-this.pixelViewport.top,O=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let v=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(v!=this.inView&&(this.inView=v,v&&(c=!0)),!this.inView&&!this.scrollTarget&&!Emt(t.dom))return 0;let x=l.width;if((this.contentDOMWidth!=x||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=t.scrollDOM.clientHeight,u|=16),c){let S=t.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(S)&&(a=!0),a||i.lineWrapping&&Math.abs(x-this.contentDOMWidth)>i.charWidth){let{lineHeight:E,charWidth:k,textHeight:_}=t.docView.measureTextSize();a=E>0&&i.refresh(s,E,k,_,Math.max(5,x/k),S),a&&(t.docView.minWidth=0,u|=16)}y>0&&O>0?d=Math.max(y,O):y<0&&O<0&&(d=Math.min(y,O)),qY();for(let E of this.viewports){let k=E.from==this.viewport.from?S:t.docView.measureVisibleLineHeights(E);this.heightMap=(a?So.empty().applyChanges(this.stateDeco,Br.empty,this.heightOracle,[new Cc(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(i,0,a,new bmt(E.from,k))}v1&&(u|=2)}let w=!this.viewportIsAppropriate(this.viewport,d)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return w&&(u&2&&(u|=this.updateScaler()),this.viewport=this.getViewport(d,this.scrollTarget),u|=this.updateForViewport()),(u&2||w)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,t)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),u}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,n){let r=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),i=this.heightMap,s=this.heightOracle,{visibleTop:a,visibleBottom:l}=this,c=new z2(i.lineAt(a-r*1e3,_i.ByHeight,s,0,0).from,i.lineAt(l+(1-r)*1e3,_i.ByHeight,s,0,0).to);if(n){let{head:u}=n.range;if(uc.to){let d=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=i.lineAt(u,_i.ByPos,s,0,0),h;n.y=="center"?h=(f.top+f.bottom)/2-d/2:n.y=="start"||n.y=="nearest"&&u=l+Math.max(10,Math.min(r,250)))&&i>a-2*1e3&&s>1,a=i<<1;if(this.defaultTextDirection!=xi.LTR&&!r)return[];let l=[],c=(d,f,h,m)=>{if(f-dd&&OO.from>=h.from&&O.to<=h.to&&Math.abs(O.from-d)O.fromv));if(!y){if(fx.from<=f&&x.to>=f)){let x=n.moveToLineBoundary(Je.cursor(f),!1,!0).head;x>d&&(f=x)}let O=this.gapSize(h,d,f,m),v=r||O<2e6?O:2e6;y=new FD(d,f,O,v)}l.push(y)},u=d=>{if(d.length2e6)for(let E of t)E.from>=d.from&&E.fromd.from&&c(d.from,m,d,f),gn.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(t){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];gr.spans(n,this.viewport.from,this.viewport.to,{span(s,a){r.push({from:s,to:a})},point(){}},20);let i=0;if(r.length!=this.visibleRanges.length)i=12;else for(let s=0;s=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(n=>n.from<=t&&n.to>=t)||Jx(this.heightMap.lineAt(t,_i.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return t>=this.viewportLines[0].top&&t<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=t&&n.bottom>=t)||Jx(this.heightMap.lineAt(this.scaler.fromDOM(t),_i.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(t){let n=this.lineBlockAtHeight(t+8);return n.from>=this.viewport.from||this.viewportLines[0].top-t>200?n:this.viewportLines[0]}elementAtHeight(t){return Jx(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class z2{constructor(t,n){this.from=t,this.to=n}}function Tmt(e,t,n){let r=[],i=e,s=0;return gr.spans(n,e,t,{span(){},point(a,l){a>i&&(r.push({from:i,to:a}),s+=a-i),i=l}},20),i=1)return t[t.length-1].to;let r=Math.floor(e*n);for(let i=0;;i++){let{from:s,to:a}=t[i],l=a-s;if(r<=l)return s+r;r-=l}}function H2(e,t){let n=0;for(let{from:r,to:i}of e.ranges){if(t<=i){n+=t-r;break}n+=i-r}return n/e.total}function Cmt(e,t){for(let n of e)if(t(n))return n}const WY={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function YY(e){let t=e.facet(Jj).filter(r=>typeof r!="function"),n=e.facet(yQ).filter(r=>typeof r!="function");return n.length&&t.push(gr.join(n)),t}class wQ{constructor(t,n,r){let i=0,s=0,a=0;this.viewports=r.map(({from:l,to:c})=>{let u=n.lineAt(l,_i.ByPos,t,0,0).top,d=n.lineAt(c,_i.ByPos,t,0,0).bottom;return i+=d-u,{from:l,to:c,top:u,bottom:d,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(n.height-i);for(let l of this.viewports)l.domTop=a+(l.top-s)*this.scale,a=l.domBottom=l.domTop+(l.bottom-l.top),s=l.bottom}toDOM(t){for(let n=0,r=0,i=0;;n++){let s=nn.from==t.viewports[r].from&&n.to==t.viewports[r].to):!1}}function Jx(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new lu(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(i=>Jx(i,t)):e._content)}const q2=Qt.define({combine:e=>e.join(" ")}),s6=Qt.define({combine:e=>e.indexOf(!0)>-1}),a6=Jp.newName(),Iye=Jp.newName(),Dye=Jp.newName(),Pye={"&light":"."+Iye,"&dark":"."+Dye};function o6(e,t,n){return new Jp(t,{finish(r){return/&/.test(r)?r.replace(/&\w*/,i=>{if(i=="&")return e;if(!n||!n[i])throw new RangeError(`Unsupported selector: ${i}`);return n[i]}):e+" "+r}})}const Amt=o6("."+a6,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{userSelect:"none",position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Pye),Nmt={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},zD=$t.ie&&$t.ie_version<=11;class jmt{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new apt,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);($t.ie&&$t.ie_version<=11||$t.ios&&t.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&$t.android&&t.constructor.EDIT_CONTEXT!==!1&&!($t.chrome&&$t.chrome_version<126)&&(this.editContext=new Imt(t),t.state.facet(xf)&&(t.contentDOM.editContext=this.editContext.editContext)),zD&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(t){(t.type=="change"||!t.type)&&!t.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((n,r)=>n!=t[r]))){this.gapIntersection.disconnect();for(let n of t)this.gapIntersection.observe(n);this.gaps=t}}onSelectionChange(t){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,i=this.selectionRange;if(r.state.facet(xf)?r.root.activeElement!=this.dom:!Hv(this.dom,i))return;let s=i.anchorNode&&r.docView.tile.nearest(i.anchorNode);if(s&&s.isWidget()&&s.widget.ignoreEvent(t)){n||(this.selectionChanged=!1);return}($t.ie&&$t.ie_version<=11||$t.android&&$t.chrome)&&!r.state.selection.main.empty&&i.focusNode&&Xv(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,n=sS(t.root);if(!n)return!1;let r=$t.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&Rmt(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let i=Hv(this.dom,r);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&_y(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||t=="Enter")&&(this.delayedAndroidKey={key:t,keyCode:n,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let n=-1,r=-1,i=!1;for(let s of t){let a=this.readMutation(s);a&&(a.typeOver&&(i=!0),n==-1?{from:n,to:r}=a:(n=Math.min(a.from,n),r=Math.max(a.to,r)))}return{from:n,to:r,typeOver:i}}readChange(){let{from:t,to:n,typeOver:r}=this.processRecords(),i=this.selectionChanged&&Hv(this.dom,this.selectionRange);if(t<0&&!i)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new Wpt(this.view,t,n,r);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,i=wye(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!OA(this.view.state.selection,n.newSel.main))&&this.view.update([]),i}readMutation(t){let n=this.view.docView.tile.nearest(t.target);if(!n||n.isWidget())return null;if(n.markDirty(t.type=="attributes"),t.type=="childList"){let r=ZY(n,t.previousSibling||t.target.previousSibling,-1),i=ZY(n,t.nextSibling||t.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:i?n.posBefore(i):n.posAtEnd,typeOver:!1}}else return t.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}update(t){this.editContext&&(this.editContext.update(t),t.startState.facet(xf)!=t.state.facet(xf)&&(t.view.contentDOM.editContext=t.state.facet(xf)?this.editContext.editContext:null))}destroy(){var t,n,r;this.stop(),(t=this.intersection)===null||t===void 0||t.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function ZY(e,t,n){for(;t;){let r=hs.get(t);if(r&&r.parent==e)return r;let i=t.parentNode;t=i!=e.dom?i:n>0?t.nextSibling:t.previousSibling}return null}function KY(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,s=t.endOffset,a=e.docView.domAtPos(e.state.selection.main.anchor,1);return Xv(a.node,a.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function Rmt(e,t){if(t.getComposedRanges){let i=t.getComposedRanges(e.root)[0];if(i)return KY(e,i)}let n=null;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",r,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",r,!0),n?KY(e,n):null}class Imt{constructor(t){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(t.state);let n=this.editContext=new window.EditContext({text:t.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,t.state.selection.main.anchor))),selectionEnd:this.toContextPos(t.state.selection.main.head)});this.handlers.textupdate=r=>{let i=t.state.selection.main,{anchor:s,head:a}=i,l=this.toEditorPos(r.updateRangeStart),c=this.toEditorPos(r.updateRangeEnd);t.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:l,drifted:!1});let u=c-l>r.text.length;l==this.from&&sthis.to&&(c=s);let d=Sye(t.state.sliceDoc(l,c),r.text,(u?i.from:i.to)-l,u?"end":null);if(!d){let h=Je.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));OA(h,i)||t.dispatch({selection:h,userEvent:"select"});return}let f={from:d.from+l,to:d.toA+l,insert:Br.of(r.text.slice(d.from,d.toB).split(` -`))};if(($t.mac||$t.android)&&f.from==a-1&&/^\. ?$/.test(r.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:c,insert:Br.of([r.text.replace("."," ")])}),this.pendingContextChange=f,!t.state.readOnly){let h=this.to-this.from+(f.to-f.from+f.insert.length);xQ(t,f,Je.single(this.toEditorPos(r.selectionStart,h),this.toEditorPos(r.selectionEnd,h)))}this.pendingContextChange&&(this.revertPending(t.state),this.setSelection(t.state)),f.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let i=[],s=null;for(let a=this.toEditorPos(r.rangeStart),l=this.toEditorPos(r.rangeEnd);a{let i=[];for(let s of r.getTextFormats()){let a=s.underlineStyle,l=s.underlineThickness;if(!/none/i.test(a)&&!/none/i.test(l)){let c=this.toEditorPos(s.rangeStart),u=this.toEditorPos(s.rangeEnd);if(c{t.inputState.composing<0&&(t.inputState.composing=0,t.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(t.inputState.composing=-1,t.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(t.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{let i=sS(r.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let n=0,r=!1,i=this.pendingContextChange;return t.changes.iterChanges((s,a,l,c,u)=>{if(r)return;let d=u.length-(a-s);if(i&&a>=i.to)if(i.from==s&&i.to==a&&i.insert.eq(u)){i=this.pendingContextChange=null,n+=d,this.to+=d;return}else i=null,this.revertPending(t.state);if(s+=n,a+=n,a<=this.from)this.from+=d,this.to+=d;else if(sthis.to||this.to-this.from+u.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(a),u.toString()),this.to+=d}n+=d}),i&&!r&&this.revertPending(t.state),!r}update(t){let n=this.pendingContextChange,r=t.startState.selection.main;this.composing&&(this.composing.drifted||!t.changes.touchesRange(r.from,r.to)&&t.transactions.some(i=>!i.isUserEvent("input.type")&&i.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=t.changes.mapPos(this.composing.editorBase)):!this.applyEdits(t)||!this.rangeIsValid(t.state)?(this.pendingContextChange=null,this.reset(t.state)):(t.docChanged||t.selectionSet||n)&&this.setSelection(t.state),(t.geometryChanged||t.docChanged||t.selectionSet)&&t.view.requestMeasure(this.measureReq)}resetRange(t){let{head:n}=t.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(t.doc.length,n+1e4)}reset(t){this.resetRange(t),this.editContext.updateText(0,this.editContext.text.length,t.doc.sliceString(this.from,this.to)),this.setSelection(t)}revertPending(t){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),t.doc.sliceString(n.from,n.to))}setSelection(t){let{main:n}=t.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),i=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(r,i)}rangeIsValid(t){let{head:n}=t.selection.main;return!(this.from>0&&n-this.from<500||this.to1e4*3)}toEditorPos(t,n=this.to-this.from){t=Math.min(t,n);let r=this.composing;return r&&r.drifted?r.editorBase+(t-r.contextBase):t+this.from}toContextPos(t){let n=this.composing;return n&&n.drifted?n.contextBase+(t-n.editorBase):t-this.from}destroy(){for(let t in this.handlers)this.editContext.removeEventListener(t,this.handlers[t])}}class Ct{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch:r}=t;this.dispatchTransactions=t.dispatchTransactions||r&&(i=>i.forEach(s=>r(s,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=t.root||opt(t.parent)||document,this.viewState=new GY(this,t.state||vr.create(t)),t.scrollTo&&t.scrollTo.is(Q2)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Kb).map(i=>new LD(i));for(let i of this.plugins)i.update(this);this.observer=new jmt(this),this.inputState=new Jpt(this),this.inputState.ensureHandlers(this.plugins),this.docView=new PY(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...t){let n=t.length==1&&t[0]instanceof Vs?t:t.length==1&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(n,this)}update(t){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,i,s=this.state;for(let h of t){if(h.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=h.state}if(this.destroyed){this.viewState.state=s;return}let a=this.hasFocus,l=0,c=null;t.some(h=>h.annotation(Aye))?(this.inputState.notifiedFocused=a,l=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,c=Nye(s,a),c||(l=1));let u=this.observer.delayedAndroidKey,d=null;if(u?(this.observer.clearDelayedAndroidKey(),d=this.observer.readChange(),(d&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(d=null)):this.observer.clear(),s.facet(vr.phrases)!=this.state.facet(vr.phrases))return this.setState(s);i=gA.create(this,s,t),i.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let h of t){if(f&&(f=f.map(h.changes)),h.scrollIntoView){let{main:m}=h.state.selection,{x:g,y:b}=this.state.facet(Ct.cursorScrollMargin);f=new Ty(m.empty?m:Je.cursor(m.head,m.head>m.anchor?-1:1),"nearest","nearest",b,g)}for(let m of h.effects)m.is(Q2)&&(f=m.value.clip(this.state))}this.viewState.update(i,f),this.bidiCache=vA.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(Kx)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some(h=>h.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(q2)!=i.state.facet(q2)&&(this.viewState.mustMeasureContent=!0),(n||r||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!i.empty)for(let h of this.state.facet(e6))try{h(i)}catch(m){Go(this.state,m,"update listener")}(c||d)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),d&&!wye(this,d)&&u.force&&_y(this.contentDOM,u.key,u.keyCode)})}setState(t){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=t;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new GY(this,t),this.plugins=t.facet(Kb).map(r=>new LD(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new PY(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(t){let n=t.startState.facet(Kb),r=t.state.facet(Kb);if(n!=r){let i=[];for(let s of r){let a=n.indexOf(s);if(a<0)i.push(new LD(s));else{let l=this.plugins[a];l.mustUpdate=t,i.push(l)}}for(let s of this.plugins)s.mustUpdate!=t&&s.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=t;for(let i=0;i-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,t&&this.observer.forceFlush();let n=null,r=this.viewState.scrollParent,i=this.viewState.getScrollOffset(),{scrollAnchorPos:s,scrollAnchorHeight:a}=this.viewState;Math.abs(i-this.viewState.scrollOffset)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(a<0)if(Ybe(r||this.win))s=-1,a=this.viewState.heightMap.height;else{let m=this.viewState.scrollAnchorAt(i);s=m.from,a=m.top}this.updateState=1;let c=this.viewState.measure();if(!c&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let u=[];c&4||([this.measureRequests,u]=[u,this.measureRequests]);let d=u.map(m=>{try{return m.read(this)}catch(g){return Go(this.state,g),JY}}),f=gA.create(this,this.state,[]),h=!1;f.flags|=c,n?n.flags|=c:n=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),h=this.docView.update(f),h&&this.docViewUpdate());for(let m=0;m1||g<-1)&&!($t.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(r==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){i=i+g,r?r.scrollTop+=g:this.win.scrollBy(0,g),a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let l of this.state.facet(e6))l(n)}get themeClasses(){return a6+" "+(this.state.facet(s6)?Dye:Iye)+" "+this.state.facet(q2)}updateAttrs(){let t=eZ(this,pye,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(xf)?"true":"false",class:"cm-content",style:`${$t.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),eZ(this,bQ,n);let r=this.observer.ignore(()=>{let i=AY(this.contentDOM,this.contentAttrs,n),s=AY(this.dom,this.editorAttrs,t);return i||s});return this.editorAttrs=t,this.contentAttrs=n,r}showAnnouncements(t){let n=!0;for(let r of t)for(let i of r.effects)if(i.is(Ct.announce)){n&&(this.announceDOM.textContent=""),n=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(Kx);let t=this.state.facet(Ct.cspNonce);Jp.mount(this.root,this.styleModules.concat(Amt).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(t.key!=null){for(let n=0;nr.plugin==t)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,n,r){return UD(this,t,MY(this,t,n,r))}moveByGroup(t,n){return UD(this,t,MY(this,t,n,r=>zpt(this,t.head,r)))}visualLineSide(t,n){let r=this.bidiSpans(t),i=this.textDirectionAt(t.from),s=r[n?r.length-1:0];return Je.cursor(s.side(n,i)+t.from,s.forward(!n,i)?1:-1)}moveToLineBoundary(t,n,r=!0){return Fpt(this,t,n,r)}moveVertically(t,n,r){return UD(this,t,Vpt(this,t,n,r))}domAtPos(t,n=1){return this.docView.domAtPos(t,n)}posAtDOM(t,n=0){return this.docView.posFromDOM(t,n)}posAtCoords(t,n=!0){this.readMeasured();let r=r6(this,t,n);return r&&r.pos}posAndSideAtCoords(t,n=!0){return this.readMeasured(),r6(this,t,n)}coordsAtPos(t,n=1){this.readMeasured();let r=this.state.doc.lineAt(t),i=this.bidiSpans(r),s=i[id.find(i,t-r.from,-1,n)];return this.docView.coordsAt(t,n,s.dir==xi.RTL)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(uye)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Dmt)return nye(t.length);let n=this.textDirectionAt(t.from),r;for(let s of this.bidiCache)if(s.from==t.from&&s.dir==n&&(s.fresh||tye(s.isolates,r=RY(this,t))))return s.order;r||(r=RY(this,t));let i=mpt(t.text,n,r);return this.bidiCache.push(new vA(t.from,t.to,n,r,!0,i)),i}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||$t.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Wbe(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((t.nodeType==9?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,n={}){var r,i,s,a;return Q2.of(new Ty(typeof t=="number"?Je.cursor(t):t,(r=n.y)!==null&&r!==void 0?r:"nearest",(i=n.x)!==null&&i!==void 0?i:"nearest",(s=n.yMargin)!==null&&s!==void 0?s:5,(a=n.xMargin)!==null&&a!==void 0?a:5))}scrollSnapshot(){let{scrollTop:t,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(t);return Q2.of(new Ty(Je.cursor(r.from),"start","start",r.top-t,n,!0))}setTabFocusMode(t){t==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof t=="boolean"?this.inputState.tabFocusMode=t?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+t)}static domEventHandlers(t){return ps.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return ps.define(()=>({}),{eventObservers:t})}static theme(t,n){let r=Jp.newName(),i=[q2.of(r),Kx.of(o6(`.${r}`,t))];return n&&n.dark&&i.push(s6.of(!0)),i}static baseTheme(t){return xh.lowest(Kx.of(o6("."+a6,t,Pye)))}static findFromDOM(t){var n;let r=t.querySelector(".cm-content"),i=r&&hs.get(r)||hs.get(t);return((n=i==null?void 0:i.root)===null||n===void 0?void 0:n.view)||null}}Ct.styleModule=Kx;Ct.inputHandler=lye;Ct.clipboardInputFilter=mQ;Ct.clipboardOutputFilter=gQ;Ct.scrollHandler=fye;Ct.focusChangeEffect=cye;Ct.perLineTextDirection=uye;Ct.exceptionSink=oye;Ct.updateListener=e6;Ct.editable=xf;Ct.mouseSelectionStyle=aye;Ct.dragMovesSelection=sye;Ct.clickAddsSelectionRange=iye;Ct.decorations=Jj;Ct.blockWrappers=mye;Ct.outerDecorations=yQ;Ct.atomicRanges=$E;Ct.bidiIsolatedRanges=gye;Ct.cursorScrollMargin=Qt.define({combine:e=>{let t=5,n=5;for(let r of e)typeof r=="number"?t=n=r:{x:t,y:n}=r;return{x:t,y:n}}});Ct.scrollMargins=bye;Ct.darkTheme=s6;Ct.cspNonce=Qt.define({combine:e=>e.length?e[0]:""});Ct.contentAttributes=bQ;Ct.editorAttributes=pye;Ct.lineWrapping=Ct.contentAttributes.of({class:"cm-lineWrapping"});Ct.announce=jn.define();const Dmt=4096,JY={};class vA{constructor(t,n,r,i,s,a){this.from=t,this.to=n,this.dir=r,this.isolates=i,this.fresh=s,this.order=a}static update(t,n){if(n.empty&&!t.some(s=>s.fresh))return t;let r=[],i=t.length?t[t.length-1].dir:xi.LTR;for(let s=Math.max(0,t.length-10);s=0;i--){let s=r[i],a=typeof s=="function"?s(e):s;a&&fQ(a,n)}return n}const Pmt=$t.mac?"mac":$t.windows?"win":$t.linux?"linux":"key";function Mmt(e,t){const n=e.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let i,s,a,l;for(let c=0;cr.concat(i),[]))),n}function $mt(e,t,n){return Lye(Mye(e.state),t,e,n)}let ap=null;const Bmt=4e3;function Qmt(e,t=Pmt){let n=Object.create(null),r=Object.create(null),i=(a,l)=>{let c=r[a];if(c==null)r[a]=l;else if(c!=l)throw new Error("Key binding "+a+" is used both as a regular binding and as a multi-stroke prefix")},s=(a,l,c,u,d)=>{var f,h;let m=n[a]||(n[a]=Object.create(null)),g=l.split(/ (?!$)/).map(O=>Mmt(O,t));for(let O=1;O{let w=ap={view:x,prefix:v,scope:a};return setTimeout(()=>{ap==w&&(ap=null)},Bmt),!0}]})}let b=g.join(" ");i(b,!1);let y=m[b]||(m[b]={preventDefault:!1,stopPropagation:!1,run:((h=(f=m._any)===null||f===void 0?void 0:f.run)===null||h===void 0?void 0:h.slice())||[]});c&&y.run.push(c),u&&(y.preventDefault=!0),d&&(y.stopPropagation=!0)};for(let a of e){let l=a.scope?a.scope.split(" "):["editor"];if(a.any)for(let u of l){let d=n[u]||(n[u]=Object.create(null));d._any||(d._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=a;for(let h in d)d[h].run.push(m=>f(m,l6))}let c=a[t]||a.key;if(c)for(let u of l)s(u,c,a.run,a.preventDefault,a.stopPropagation),a.shift&&s(u,"Shift-"+c,a.shift,a.preventDefault,a.stopPropagation)}return n}let l6=null;function Lye(e,t,n,r){l6=t;let i=ept(t),s=Uo(i,0),a=Yu(s)==i.length&&i!=" ",l="",c=!1,u=!1,d=!1;ap&&ap.view==n&&ap.scope==r&&(l=ap.prefix+" ",kye.indexOf(t.keyCode)<0&&(u=!0,ap=null));let f=new Set,h=y=>{if(y){for(let O of y.run)if(!f.has(O)&&(f.add(O),O(n)))return y.stopPropagation&&(d=!0),!0;y.preventDefault&&(y.stopPropagation&&(d=!0),u=!0)}return!1},m=e[r],g,b;return m&&(h(m[l+X2(i,t,!a)])?c=!0:a&&(t.altKey||t.metaKey||t.ctrlKey)&&!($t.windows&&t.ctrlKey&&t.altKey)&&!($t.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(g=em[t.keyCode])&&g!=i?(h(m[l+X2(g,t,!0)])||t.shiftKey&&(b=rS[t.keyCode])!=i&&b!=g&&h(m[l+X2(b,t,!1)]))&&(c=!0):a&&t.shiftKey&&h(m[l+X2(i,t,!0)])&&(c=!0),!c&&h(m._any)&&(c=!0)),u&&(c=!0),c&&d&&t.stopPropagation(),l6=null,c}class kg{constructor(t,n,r,i,s){this.className=t,this.left=n,this.top=r,this.width=i,this.height=s}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,n){return n.className!=this.className?!1:(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",this.width!=null&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,n,r){if(r.empty){let i=t.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let s=$ye(t);return[new kg(n,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return Umt(t,n,r)}}function $ye(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==xi.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function nZ(e,t,n,r){let i=e.coordsAtPos(t,n*2);if(!i)return r;let s=e.dom.getBoundingClientRect(),a=(i.top+i.bottom)/2,l=e.posAtCoords({x:s.left+1,y:a}),c=e.posAtCoords({x:s.right-1,y:a});return l==null||c==null?r:{from:Math.max(r.from,Math.min(l,c)),to:Math.min(r.to,Math.max(l,c))}}function Umt(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let r=Math.max(n.from,e.viewport.from),i=Math.min(n.to,e.viewport.to),s=e.textDirection==xi.LTR,a=e.contentDOM,l=a.getBoundingClientRect(),c=$ye(e),u=a.querySelector(".cm-line"),d=u&&window.getComputedStyle(u),f=l.left+(d?parseInt(d.paddingLeft)+Math.min(0,parseInt(d.textIndent)):0),h=l.right-(d?parseInt(d.paddingRight):0),m=n6(e,r,1),g=n6(e,i,-1),b=m.type==Ba.Text?m:null,y=g.type==Ba.Text?g:null;if(b&&(e.lineWrapping||m.widgetLineBreaks)&&(b=nZ(e,r,1,b)),y&&(e.lineWrapping||g.widgetLineBreaks)&&(y=nZ(e,i,-1,y)),b&&y&&b.from==y.from&&b.to==y.to)return v(x(n.from,n.to,b));{let S=b?x(n.from,null,b):w(m,!1),E=y?x(null,n.to,y):w(g,!0),k=[];return(b||m).to<(y||g).from-(b&&y?1:0)||m.widgetLineBreaks>1&&S.bottom+e.defaultLineHeight/2j&&I.from=N)break;$>M&&A(Math.max(F,M),S==null&&F<=j,Math.min($,N),E==null&&$>=L,Q.dir)}if(M=D.to+1,M>=N)break}return T.length==0&&A(j,S==null,L,E==null,e.textDirection),{top:_,bottom:C,horizontal:T}}function w(S,E){let k=l.top+(E?S.top:S.bottom);return{top:k,bottom:k,horizontal:[]}}}function Fmt(e,t){return e.constructor==t.constructor&&e.eq(t)}class zmt{constructor(t,n){this.view=t,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,t)}update(t){t.startState.facet(bT)!=t.state.facet(bT)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq))}docViewUpdate(t){this.layer.updateOnDocViewUpdate!==!1&&t.requestMeasure(this.measureReq)}setOrder(t){let n=0,r=t.facet(bT);for(;n!Fmt(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let i of t)i.update&&n&&i.constructor&&this.drawn[r].constructor&&i.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(i.draw(),n);for(;n;){let i=n.nextSibling;n.remove(),n=i}this.drawn=t,$t.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const bT=Qt.define();function Bye(e){return[ps.define(t=>new zmt(t,e)),bT.of(e)]}const w1=Qt.define({combine(e){return Nd(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(t,n)=>Math.min(t,n),drawRangeCursor:(t,n)=>t||n})}});function Vmt(e={}){return[w1.of(e),Hmt,qmt,Xmt,dye.of(!0)]}function Qye(e){return e.startState.facet(w1)!=e.state.facet(w1)}const Hmt=Bye({above:!0,markers(e){let{state:t}=e,n=t.facet(w1),r=[];for(let i of t.selection.ranges){let s=i==t.selection.main;if(i.empty||n.drawRangeCursor&&!(s&&$t.ios&&n.iosSelectionHandles)){let a=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=i.empty?i:Je.cursor(i.head,i.assoc);for(let c of kg.forRange(e,a,l))r.push(c)}}return r},update(e,t){e.transactions.some(r=>r.selection)&&(t.style.animationName=t.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=Qye(e);return n&&rZ(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){rZ(t.state,e)},class:"cm-cursorLayer"});function rZ(e,t){t.style.animationDuration=e.facet(w1).cursorBlinkRate+"ms"}const qmt=Bye({above:!1,markers(e){let t=[],{main:n,ranges:r}=e.state.selection;for(let i of r)if(!i.empty)for(let s of kg.forRange(e,"cm-selectionBackground",i))t.push(s);if($t.ios&&!n.empty&&e.state.facet(w1).iosSelectionHandles){for(let i of kg.forRange(e,"cm-selectionHandle cm-selectionHandle-start",Je.cursor(n.from,1)))t.push(i);for(let i of kg.forRange(e,"cm-selectionHandle cm-selectionHandle-end",Je.cursor(n.to,1)))t.push(i)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||Qye(e)},class:"cm-selectionLayer"}),Xmt=xh.highest(Ct.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),Uye=jn.define({map(e,t){return e==null?null:t.mapPos(e)}}),ev=Qa.define({create(){return null},update(e,t){return e!=null&&(e=t.changes.mapPos(e)),t.effects.reduce((n,r)=>r.is(Uye)?r.value:n,e)}}),Gmt=ps.fromClass(class{constructor(e){this.view=e,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(e){var t;let n=e.state.field(ev);n==null?this.cursor!=null&&((t=this.cursor)===null||t===void 0||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(e.startState.field(ev)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(ev),n=t!=null&&e.coordsAtPos(t);if(!n)return null;let r=e.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+e.scrollDOM.scrollLeft*e.scaleX,top:n.top-r.top+e.scrollDOM.scrollTop*e.scaleY,height:n.bottom-n.top}}drawCursor(e){if(this.cursor){let{scaleX:t,scaleY:n}=this.view;e?(this.cursor.style.left=e.left/t+"px",this.cursor.style.top=e.top/n+"px",this.cursor.style.height=e.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(e){this.view.state.field(ev)!=e&&this.view.dispatch({effects:Uye.of(e)})}},{eventObservers:{dragover(e){this.setDropPos(this.view.posAtCoords({x:e.clientX,y:e.clientY}))},dragleave(e){(e.target==this.view.contentDOM||!this.view.contentDOM.contains(e.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Wmt(){return[ev,Gmt]}function iZ(e,t,n,r,i){t.lastIndex=0;for(let s=e.iterRange(n,r),a=n,l;!s.next().done;a+=s.value.length)if(!s.lineBreak)for(;l=t.exec(s.value);)i(a+l.index,l)}function Ymt(e,t){let n=e.visibleRanges;if(n.length==1&&n[0].from==e.viewport.from&&n[0].to==e.viewport.to)return n;let r=[];for(let{from:i,to:s}of n)i=Math.max(e.state.doc.lineAt(i).from,i-t),s=Math.min(e.state.doc.lineAt(s).to,s+t),r.length&&r[r.length-1].to>=i?r[r.length-1].to=s:r.push({from:i,to:s});return r}class Zmt{constructor(t){const{regexp:n,decoration:r,decorate:i,boundary:s,maxLength:a=1e3}=t;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,i)this.addMatch=(l,c,u,d)=>i(d,u,u+l[0].length,l,c);else if(typeof r=="function")this.addMatch=(l,c,u,d)=>{let f=r(l,c,u);f&&d(u,u+l[0].length,f)};else if(r)this.addMatch=(l,c,u,d)=>d(u,u+l[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=a}createDeco(t){let n=new sh,r=n.add.bind(n);for(let{from:i,to:s}of Ymt(t,this.maxLength))iZ(t.state.doc,this.regexp,i,s,(a,l)=>this.addMatch(l,t,a,r));return n.finish()}updateDeco(t,n){let r=1e9,i=-1;return t.docChanged&&t.changes.iterChanges((s,a,l,c)=>{c>=t.view.viewport.from&&l<=t.view.viewport.to&&(r=Math.min(l,r),i=Math.max(c,i))}),t.viewportMoved||i-r>1e3?this.createDeco(t.view):i>-1?this.updateRange(t.view,n.map(t.changes),r,i):n}updateRange(t,n,r,i){for(let s of t.visibleRanges){let a=Math.max(s.from,r),l=Math.min(s.to,i);if(l>=a){let c=t.state.doc.lineAt(a),u=c.toc.from;a--)if(this.boundary.test(c.text[a-1-c.from])){d=a;break}for(;lh.push(O.range(b,y));if(c==u)for(this.regexp.lastIndex=d-c.from;(m=this.regexp.exec(c.text))&&m.indexthis.addMatch(y,t,b,g));n=n.update({filterFrom:d,filterTo:f,filter:(b,y)=>bf,add:h})}}return n}}const c6=/x/.unicode!=null?"gu":"g",Kmt=new RegExp(`[\0-\b ---Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,c6),Jmt={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let VD=null;function egt(){var e;if(VD==null&&typeof document<"u"&&document.body){let t=document.body.style;VD=((e=t.tabSize)!==null&&e!==void 0?e:t.MozTabSize)!=null}return VD||!1}const yT=Qt.define({combine(e){let t=Nd(e,{render:null,specialChars:Kmt,addSpecialChars:null});return(t.replaceTabs=!egt())&&(t.specialChars=new RegExp(" |"+t.specialChars.source,c6)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,c6)),t}});function tgt(e={}){return[yT.of(e),ngt()]}let sZ=null;function ngt(){return sZ||(sZ=ps.fromClass(class{constructor(e){this.view=e,this.decorations=dn.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(yT)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new Zmt({regexp:e.specialChars,decoration:(t,n,r)=>{let{doc:i}=n.state,s=Uo(t[0],0);if(s==9){let a=i.lineAt(r),l=n.state.tabSize,c=vu(a.text,l,r-a.from);return dn.replace({widget:new agt((l-c%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=dn.replace({widget:new sgt(e,s)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(yT);e.startState.facet(yT)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view)):this.decorations=this.decorator.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}))}const rgt="•";function igt(e){return e>=32?rgt:e==10?"␤":String.fromCharCode(9216+e)}class sgt extends Nu{constructor(t,n){super(),this.options=t,this.code=n}eq(t){return t.code==this.code}toDOM(t){let n=igt(this.code),r=t.state.phrase("Control character")+" "+(Jmt[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,n);if(i)return i;let s=document.createElement("span");return s.textContent=n,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class agt extends Nu{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent=" ",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}function ogt(){return cgt}const lgt=dn.line({class:"cm-activeLine"}),cgt=ps.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let r of e.state.selection.ranges){let i=e.lineBlockAt(r.head);i.from>t&&(n.push(lgt.range(i.from)),t=i.from)}return dn.set(n)}},{decorations:e=>e.decorations});class ugt extends Nu{constructor(t){super(),this.content=t}toDOM(t){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(t):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(t){let n=t.firstChild?qv(t.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(t.parentNode),i=aS(n[0],r.direction!="rtl"),s=parseInt(r.lineHeight);return i.bottom-i.top>s*1.5?{left:i.left,right:i.right,top:i.top,bottom:i.top+s}:i}ignoreEvent(){return!1}}function dgt(e){let t=ps.fromClass(class{constructor(n){this.view=n,this.placeholder=e?dn.set([dn.widget({widget:new ugt(e),side:1}).range(0)]):dn.none}get decorations(){return this.view.state.doc.length?dn.none:this.placeholder}},{decorations:n=>n.decorations});return typeof e=="string"?[t,Ct.contentAttributes.of({"aria-placeholder":e})]:t}const u6=2e3;function fgt(e,t,n){let r=Math.min(t.line,n.line),i=Math.max(t.line,n.line),s=[];if(t.off>u6||n.off>u6||t.col<0||n.col<0){let a=Math.min(t.off,n.off),l=Math.max(t.off,n.off);for(let c=r;c<=i;c++){let u=e.doc.line(c);u.length<=l&&s.push(Je.range(u.from+a,u.to+l))}}else{let a=Math.min(t.col,n.col),l=Math.max(t.col,n.col);for(let c=r;c<=i;c++){let u=e.doc.line(c),d=zL(u.text,a,e.tabSize,!0);if(d<0)s.push(Je.cursor(u.to));else{let f=zL(u.text,l,e.tabSize);s.push(Je.range(u.from+d,u.from+f))}}}return s}function hgt(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}function aZ(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1),r=e.state.doc.lineAt(n),i=n-r.from,s=i>u6?-1:i==r.length?hgt(e,t.clientX):vu(r.text,e.state.tabSize,n-r.from);return{line:r.number,col:s,off:i}}function pgt(e,t){let n=aZ(e,t),r=e.state.selection;return n?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(n.line).from),a=i.state.doc.lineAt(s);n={line:a.number,col:n.col,off:Math.min(n.off,a.length)},r=r.map(i.changes)}},get(i,s,a){let l=aZ(e,i);if(!l)return r;let c=fgt(e.state,n,l);return c.length?a?Je.create(c.concat(r.ranges)):Je.create(c):r}}:null}function mgt(e){let t=n=>n.altKey&&n.button==0;return Ct.mouseSelectionStyle.of((n,r)=>t(r)?pgt(n,r):null)}const ggt={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},bgt={style:"cursor: crosshair"};function ygt(e={}){let[t,n]=ggt[e.key||"Alt"],r=ps.fromClass(class{constructor(i){this.view=i,this.isDown=!1}set(i){this.isDown!=i&&(this.isDown=i,this.view.update([]))}},{eventObservers:{keydown(i){this.set(i.keyCode==t||n(i))},keyup(i){(i.keyCode==t||!n(i))&&this.set(!1)},mousemove(i){this.set(n(i))}}});return[r,Ct.contentAttributes.of(i=>{var s;return!((s=i.plugin(r))===null||s===void 0)&&s.isDown?bgt:null})]}const G2="-10000px";class Fye{constructor(t,n,r,i){this.facet=n,this.createTooltipView=r,this.removeTooltipView=i,this.input=t.state.facet(n),this.tooltips=this.input.filter(a=>a);let s=null;this.tooltipViews=this.tooltips.map(a=>s=r(a,s))}update(t,n){var r;let i=t.state.facet(this.facet),s=i.filter(c=>c);if(i===this.input){for(let c of this.tooltipViews)c.update&&c.update(t);return!1}let a=[],l=n?[]:null;for(let c=0;cn[u]=c),n.length=l.length),this.input=i,this.tooltips=s,this.tooltipViews=a,!0}}function Ogt(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const HD=Qt.define({combine:e=>{var t,n,r;return{position:$t.ios?"absolute":((t=e.find(i=>i.position))===null||t===void 0?void 0:t.position)||"fixed",parent:((n=e.find(i=>i.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=e.find(i=>i.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||Ogt}}}),oZ=new WeakMap,SQ=ps.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(HD);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Fye(e,EQ,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,r=e.state.facet(HD);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),r=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",n.dom.appendChild(i)}return n.dom.style.position=this.position,n.dom.style.top=G2,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(e=r.destroy)===null||e===void 0||e.call(r);this.parent&&this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if($t.safari){let a=s.getBoundingClientRect();n=Math.abs(a.top+1e4)>1||Math.abs(a.left)>1}else n=!!s.offsetParent&&s.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(e=s.width/this.parent.offsetWidth,t=s.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=OQ(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((s,a)=>{let l=this.manager.tooltipViews[a];return l.getCoords?l.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(HD).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:n,space:r,scaleX:i,scaleY:s}=e,a=[];for(let l=0;l=Math.min(n.bottom,r.bottom)||f.rightMath.min(n.right,r.right)+.1)){d.style.top=G2;continue}let m=c.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,g=m?7:0,b=h.right-h.left,y=(t=oZ.get(u))!==null&&t!==void 0?t:h.bottom-h.top,O=u.offset||vgt,v=this.view.textDirection==xi.LTR,x=h.width>r.right-r.left?v?r.left:r.right-h.width:v?Math.max(r.left,Math.min(f.left-(m?14:0)+O.x,r.right-b)):Math.min(Math.max(r.left,f.left-b+(m?14:0)-O.x),r.right-b),w=this.above[l];!c.strictSide&&(w?f.top-y-g-O.yr.bottom)&&w==r.bottom-f.bottom>f.top-r.top&&(w=this.above[l]=!w);let S=(w?f.top-r.top:r.bottom-f.bottom)-g;if(Sx&&_.topE&&(E=w?_.top-y-2-g:_.bottom+g+2);if(this.position=="absolute"?(d.style.top=(E-e.parent.top)/s+"px",lZ(d,(x-e.parent.left)/i)):(d.style.top=E/s+"px",lZ(d,x/i)),m){let _=f.left+(v?O.x:-O.x)-(x+14-7);m.style.left=_/i+"px"}u.overlap!==!0&&a.push({left:x,top:E,right:k,bottom:E+y}),d.classList.toggle("cm-tooltip-above",w),d.classList.toggle("cm-tooltip-below",!w),u.positioned&&u.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=G2}},{eventObservers:{scroll(){this.maybeMeasure()}}});function lZ(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const xgt=Ct.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),vgt={x:0,y:0},EQ=Qt.define({enables:[SQ,xgt]}),wA=Qt.define({combine:e=>e.reduce((t,n)=>t.concat(n),[])});class rR{static create(t){return new rR(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Fye(t,wA,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(t,n){let r=t.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(t){for(let n of this.manager.tooltipViews)n.mount&&n.mount(t);this.mounted=!0}positioned(t){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(t)}update(t){this.manager.update(t)}destroy(){var t;for(let n of this.manager.tooltipViews)(t=n.destroy)===null||t===void 0||t.call(n)}passProp(t){let n;for(let r of this.manager.tooltipViews){let i=r[t];if(i!==void 0){if(n===void 0)n=i;else if(n!==i)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const wgt=EQ.compute([wA],e=>{let t=e.facet(wA);return t.length===0?null:{pos:Math.min(...t.map(n=>n.pos)),end:Math.max(...t.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:rR.create,above:t[0].above,arrow:t.some(n=>n.arrow)}}),zye=Qt.define();class Sgt{constructor(t,n,r,i,s,a){this.view=t,this.source=n,this.field=r,this.locked=i,this.setHover=s,this.hoverTime=a,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(t){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let t=Date.now()-this.lastMove.time;ta.bottom||n.xa.right+t.defaultCharacterWidth)return;let l=t.bidiSpans(t.state.doc.lineAt(i)).find(u=>u.from<=i&&u.to>=i),c=l&&l.dir==xi.RTL?-1:1;s=n.x{if(l&&!(Array.isArray(l)&&!l.length)){let c=Array.isArray(l)?l:[l];i&&this.locked.set(c,i),t.dispatch({effects:this.setHover.of(c)})}};if(s&&"then"in s){let l=this.pending={pos:n};s.then(c=>{this.pending==l&&(this.pending=null,a(c))},c=>Go(t.state,c,"hover tooltip"))}else a(s)}get tooltip(){let t=this.view.plugin(SQ),n=t?t.manager.tooltips.findIndex(r=>r.create==rR.create):-1;return n>-1?t.manager.tooltipViews[n]:null}mousemove(t){var n,r;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:s}=this;if(i.length&&!this.locked.has(i)&&s&&!Egt(s.dom,t)||this.pending){let{pos:a}=i[0]||this.pending,l=(r=(n=i[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:a;(a==l?this.view.posAtCoords(this.lastMove)!=a:!kgt(this.view,a,l,t.clientX,t.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length&&!this.locked.has(n)){let{tooltip:r}=this;r&&r.dom.contains(t.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(t){let n=r=>{t.removeEventListener("mouseleave",n);let{active:i}=this;i.length&&!this.locked.has(i)&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};t.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const W2=4;function Egt(e,t){let{left:n,right:r,top:i,bottom:s}=e.getBoundingClientRect(),a;if(a=e.querySelector(".cm-tooltip-arrow")){let l=a.getBoundingClientRect();i=Math.min(l.top,i),s=Math.max(l.bottom,s)}return t.clientX>=n-W2&&t.clientX<=r+W2&&t.clientY>=i-W2&&t.clientY<=s+W2}function kgt(e,t,n,r,i,s){let a=e.scrollDOM.getBoundingClientRect(),l=e.documentTop+e.documentPadding.top+e.contentHeight;if(a.left>r||a.righti||Math.min(a.bottom,l)=t&&c<=n}function _gt(e,t={}){let n=jn.define(),r=new WeakMap,i=Qa.define({create(){return[]},update(a,l){let c=r.get(a);if(a.length&&(t.hideOnChange&&(l.docChanged||l.selection)?a=[]:c&&c(l)?a=[]:t.hideOn&&(a=a.filter(u=>!t.hideOn(l,u)))),l.docChanged&&a.length){let u=[];for(let d of a){let f=l.changes.mapPos(d.pos,-1,Pa.TrackDel);if(f!=null){let h=Object.assign(Object.create(null),d);h.pos=f,h.end!=null&&(h.end=l.changes.mapPos(h.end)),u.push(h)}}a=u}for(let u of l.effects)u.is(n)&&(a=u.value,c=void 0),(u.is(Cgt)&&!u.value||u.value==i)&&(a=[]);return a.length&&c&&r.set(a,c),a},provide:a=>wA.from(a)});const s=ps.define(a=>new Sgt(a,e,i,r,n,t.hoverTime||300));return{active:i,extension:[i,s,zye.of(s),wgt]}}function Tgt(e,t,n,r={}){var i;let s=e.state.facet(zye).map(a=>e.plugin(a)).filter(a=>!!a);if(r.tooltip&&r.tooltip.active){let a=s.find(l=>l.field==r.tooltip.active);a&&(s=[a])}for(let a of s)a.activateHover(e,t,n,(i=r.until)!==null&&i!==void 0?i:()=>!1)}function Vye(e,t){let n=e.plugin(SQ);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}const Cgt=jn.define(),cZ=Qt.define({combine(e){let t,n;for(let r of e)t=t||r.topContainer,n=n||r.bottomContainer;return{topContainer:t,bottomContainer:n}}});function kQ(e,t){let n=e.plugin(Hye),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}const Hye=ps.fromClass(class{constructor(e){this.input=e.state.facet(lS),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(e));let t=e.state.facet(cZ);this.top=new Y2(e,!0,t.topContainer),this.bottom=new Y2(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(e){let t=e.state.facet(cZ);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new Y2(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new Y2(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(lS);if(n!=this.input){let r=n.filter(c=>c),i=[],s=[],a=[],l=[];for(let c of r){let u=this.specs.indexOf(c),d;u<0?(d=c(e.view),l.push(d)):(d=this.panels[u],d.update&&d.update(e)),i.push(d),(d.top?s:a).push(d)}this.specs=r,this.panels=i,this.top.sync(s),this.bottom.sync(a);for(let c of l)c.dom.classList.add("cm-panel"),c.mount&&c.mount()}else for(let r of this.panels)r.update&&r.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>Ct.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class Y2{constructor(t,n,r){this.view=t,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(t){for(let n of this.panels)n.destroy&&t.indexOf(n)<0&&n.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let t=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;t!=n.dom;)t=uZ(t);t=t.nextSibling}else this.dom.insertBefore(n.dom,t);for(;t;)t=uZ(t)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let t of this.classes.split(" "))t&&this.container.classList.remove(t);for(let t of(this.classes=this.view.themeClasses).split(" "))t&&this.container.classList.add(t)}}}function uZ(e){let t=e.nextSibling;return e.remove(),t}const lS=Qt.define({enables:Hye});function Agt(e,t){let n,r=new Promise(a=>n=a),i=a=>Ngt(a,t,n);e.state.field(qD,!1)?e.dispatch({effects:qye.of(i)}):e.dispatch({effects:jn.appendConfig.of(qD.init(()=>[i]))});let s=Xye.of(i);return{close:s,result:r.then(a=>((e.win.queueMicrotask||(c=>e.win.setTimeout(c,10)))(()=>{e.state.field(qD).indexOf(i)>-1&&e.dispatch({effects:s})}),a))}}const qD=Qa.define({create(){return[]},update(e,t){for(let n of t.effects)n.is(qye)?e=[n.value].concat(e):n.is(Xye)&&(e=e.filter(r=>r!=n.value));return e},provide:e=>lS.computeN([e],t=>t.field(e))}),qye=jn.define(),Xye=jn.define();function Ngt(e,t,n){let r=t.content?t.content(e,()=>a(null)):null;if(!r){if(r=fi("form"),t.input){let l=fi("input",t.input);/^(text|password|number|email|tel|url)$/.test(l.type)&&l.classList.add("cm-textfield"),l.name||(l.name="input"),r.appendChild(fi("label",(t.label||"")+": ",l))}else r.appendChild(document.createTextNode(t.label||""));r.appendChild(document.createTextNode(" ")),r.appendChild(fi("button",{class:"cm-button",type:"submit"},t.submitLabel||"OK"))}let i=r.nodeName=="FORM"?[r]:r.querySelectorAll("form");for(let l=0;l{u.keyCode==27?(u.preventDefault(),a(null)):u.keyCode==13&&(u.preventDefault(),a(c))}),c.addEventListener("submit",u=>{u.preventDefault(),a(c)})}let s=fi("div",r,fi("button",{onclick:()=>a(null),"aria-label":e.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));t.class&&(s.className=t.class),s.classList.add("cm-dialog");function a(l){s.contains(s.ownerDocument.activeElement)&&e.focus(),n(l)}return{dom:s,top:t.top,mount:()=>{if(t.focus){let l;typeof t.focus=="string"?l=r.querySelector(t.focus):l=r.querySelector("input")||r.querySelector("button"),l&&"select"in l?l.select():l&&"focus"in l&&l.focus()}}}}class oh extends Kp{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}oh.prototype.elementClass="";oh.prototype.toDOM=void 0;oh.prototype.mapMode=Pa.TrackBefore;oh.prototype.startSide=oh.prototype.endSide=-1;oh.prototype.point=!0;const OT=Qt.define(),jgt=Qt.define(),Rgt={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>gr.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Wv=Qt.define();function Igt(e){return[Gye(),Wv.of({...Rgt,...e})]}const dZ=Qt.define({combine:e=>e.some(t=>t)});function Gye(e){return[Dgt]}const Dgt=ps.fromClass(class{constructor(e){this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(Wv).map(t=>new hZ(e,t)),this.fixed=!e.state.facet(dZ);for(let t of this.gutters)t.config.side=="after"?this.getDOMAfter().appendChild(t.dom):this.dom.appendChild(t.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,r=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(e.geometryChanged){let t=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=t,this.domAfter&&(this.domAfter.style.minHeight=t)}this.view.state.facet(dZ)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=gr.iter(this.view.state.facet(OT),this.view.viewport.from),r=[],i=this.gutters.map(s=>new Pgt(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(s.type)){let a=!0;for(let l of s.type)if(l.type==Ba.Text&&a){d6(n,r,l.from);for(let c of i)c.line(this.view,l,r);a=!1}else if(l.widget)for(let c of i)c.widget(this.view,l)}else if(s.type==Ba.Text){d6(n,r,s.from);for(let a of i)a.line(this.view,s,r)}else if(s.widget)for(let a of i)a.widget(this.view,s);for(let s of i)s.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let t=e.startState.facet(Wv),n=e.state.facet(Wv),r=e.docChanged||e.heightChanged||e.viewportChanged||!gr.eq(e.startState.facet(OT),e.state.facet(OT),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let i of this.gutters)i.update(e)&&(r=!0);else{r=!0;let i=[];for(let s of n){let a=t.indexOf(s);a<0?i.push(new hZ(this.view,s)):(this.gutters[a].update(e),i.push(this.gutters[a]))}for(let s of this.gutters)s.dom.remove(),i.indexOf(s)<0&&s.destroy();for(let s of i)s.config.side=="after"?this.getDOMAfter().appendChild(s.dom):this.dom.appendChild(s.dom);this.gutters=i}return r}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>Ct.scrollMargins.of(t=>{let n=t.plugin(e);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*t.scaleX,i=n.domAfter?n.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==xi.LTR?{left:r,right:i}:{right:r,left:i}})});function fZ(e){return Array.isArray(e)?e:[e]}function d6(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class Pgt{constructor(t,n,r){this.gutter=t,this.height=r,this.i=0,this.cursor=gr.iter(t.markers,n.from)}addElement(t,n,r){let{gutter:i}=this,s=(n.top-this.height)/t.scaleY,a=n.height/t.scaleY;if(this.i==i.elements.length){let l=new Wye(t,a,s,r);i.elements.push(l),i.dom.appendChild(l.dom)}else i.elements[this.i].update(t,a,s,r);this.height=n.bottom,this.i++}line(t,n,r){let i=[];d6(this.cursor,i,n.from),r.length&&(i=i.concat(r));let s=this.gutter.config.lineMarker(t,n,i);s&&i.unshift(s);let a=this.gutter;i.length==0&&!a.config.renderEmptyElements||this.addElement(t,n,i)}widget(t,n){let r=this.gutter.config.widgetMarker(t,n.widget,n),i=r?[r]:null;for(let s of t.state.facet(jgt)){let a=s(t,n.widget,n);a&&(i||(i=[])).push(a)}i&&this.addElement(t,n,i)}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let n=t.elements.pop();t.dom.removeChild(n.dom),n.destroy()}}}class hZ{constructor(t,n){this.view=t,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,i=>{let s=i.target,a;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let c=s.getBoundingClientRect();a=(c.top+c.bottom)/2}else a=i.clientY;let l=t.lineBlockAtHeight(a-t.documentTop);n.domEventHandlers[r](t,l,i)&&i.preventDefault()});this.markers=fZ(n.markers(t)),n.initialSpacer&&(this.spacer=new Wye(t,0,0,[n.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(t){let n=this.markers;if(this.markers=fZ(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let i=this.config.updateSpacer(this.spacer.markers[0],t);i!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[i])}let r=t.view.viewport;return!gr.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(t):!1)}destroy(){for(let t of this.elements)t.destroy()}}class Wye{constructor(t,n,r,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,n,r,i)}update(t,n,r,i){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),Mgt(this.markers,i)||this.setMarkers(t,i)}setMarkers(t,n){let r="cm-gutterElement",i=this.dom.firstChild;for(let s=0,a=0;;){let l=a,c=ss(l,c,u)||a(l,c,u):a}return r}})}});class XD extends oh{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function GD(e,t){return e.state.facet(Jb).formatNumber(t,e.state)}const Bgt=Wv.compute([Jb],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(t){return t.state.facet(Lgt)},lineMarker(t,n,r){return r.some(i=>i.toDOM)?null:new XD(GD(t,t.state.doc.lineAt(n.from).number))},widgetMarker:(t,n,r)=>{for(let i of t.state.facet($gt)){let s=i(t,n,r);if(s)return s}return null},lineMarkerChange:t=>t.startState.facet(Jb)!=t.state.facet(Jb),initialSpacer(t){return new XD(GD(t,pZ(t.state.doc.lines)))},updateSpacer(t,n){let r=GD(n.view,pZ(n.view.state.doc.lines));return r==t.number?t:new XD(r)},domEventHandlers:e.facet(Jb).domEventHandlers,side:"before"}));function Qgt(e={}){return[Jb.of(e),Gye(),Bgt]}function pZ(e){let t=9;for(;t{let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.head).from;i>n&&(n=i,t.push(Ugt.range(i)))}return gr.of(t)});function zgt(){return Fgt}let Vgt=0,Xu=class f6{constructor(t,n,r,i){this.name=t,this.set=n,this.base=r,this.modified=i,this.id=Vgt++}toString(){let{name:t}=this;for(let n of this.modified)n.name&&(t=`${n.name}(${t})`);return t}static define(t,n){let r=typeof t=="string"?t:"?";if(t instanceof f6&&(n=t),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let i=new f6(r,[],null,[]);if(i.set.push(i),n)for(let s of n.set)i.set.push(s);return i}static defineModifier(t){let n=new SA(t);return r=>r.modified.indexOf(n)>-1?r:SA.get(r.base||r,r.modified.concat(n).sort((i,s)=>i.id-s.id))}},Hgt=0;class SA{constructor(t){this.name=t,this.instances=[],this.id=Hgt++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(l=>l.base==t&&qgt(n,l.modified));if(r)return r;let i=[],s=new Xu(t.name,i,t,n);for(let l of n)l.instances.push(s);let a=Xgt(n);for(let l of t.set)if(!l.modified.length)for(let c of a)i.push(SA.get(l,c));return s}}function qgt(e,t){return e.length==t.length&&e.every((n,r)=>n==t[r])}function Xgt(e){let t=[[]];for(let n=0;nr.length-n.length)}function vh(e){let t=Object.create(null);for(let n in e){let r=e[n];Array.isArray(r)||(r=[r]);for(let i of n.split(" "))if(i){let s=[],a=2,l=i;for(let f=0;;){if(l=="..."&&f>0&&f+3==i.length){a=1;break}let h=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!h)throw new RangeError("Invalid path: "+i);if(s.push(h[0]=="*"?"":h[0][0]=='"'?JSON.parse(h[0]):h[0]),f+=h[0].length,f==i.length)break;let m=i[f++];if(f==i.length&&m=="!"){a=0;break}if(m!="/")throw new RangeError("Invalid path: "+i);l=i.slice(f)}let c=s.length-1,u=s[c];if(!u)throw new RangeError("Invalid path: "+i);let d=new cS(r,a,c>0?s.slice(0,c):null);t[u]=d.sort(t[u])}}return Yye.add(t)}const Yye=new Nn({combine(e,t){let n,r,i;for(;e||t;){if(!e||t&&e.depth>=t.depth?(i=t,t=t.next):(i=e,e=e.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let s=new cS(i.tags,i.mode,i.context);n?n.next=s:r=s,n=s}return r}});let cS=class{constructor(t,n,r,i){this.tags=t,this.mode=n,this.context=r,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth{let a=i;for(let l of s)for(let c of l.set){let u=n[c.id];if(u){a=a?a+" "+u:u;break}}return a},scope:r}}function Ggt(e,t){let n=null;for(let r of e){let i=r.style(t);i&&(n=n?n+" "+i:i)}return n}function Wgt(e,t,n,r=0,i=e.length){let s=new Ygt(r,Array.isArray(t)?t:[t],n);s.highlightRange(e.cursor(),r,i,"",s.highlighters),s.flush(i)}class Ygt{constructor(t,n,r){this.at=t,this.highlighters=n,this.span=r,this.class=""}startSpan(t,n){n!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=n)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,n,r,i,s){let{type:a,from:l,to:c}=t;if(l>=r||c<=n)return;a.isTop&&(s=this.highlighters.filter(m=>!m.scope||m.scope(a)));let u=i,d=Zgt(t)||cS.empty,f=Ggt(s,d.tags);if(f&&(u&&(u+=" "),u+=f,d.mode==1&&(i+=(i?" ":"")+f)),this.startSpan(Math.max(n,l),u),d.opaque)return;let h=t.tree&&t.tree.prop(Nn.mounted);if(h&&h.overlay){let m=t.node.enter(h.overlay[0].from+l,1),g=this.highlighters.filter(y=>!y.scope||y.scope(h.tree.type)),b=t.firstChild();for(let y=0,O=l;;y++){let v=y=x||!t.nextSibling())););if(!v||x>r)break;O=v.to+l,O>n&&(this.highlightRange(m.cursor(),Math.max(n,v.from+l),Math.min(r,O),"",g),this.startSpan(Math.min(r,O),u))}b&&t.parent()}else if(t.firstChild()){h&&(i="");do if(!(t.to<=n)){if(t.from>=r)break;this.highlightRange(t,n,r,i,s),this.startSpan(Math.min(r,t.to),u)}while(t.nextSibling());t.parent()}}}function Zgt(e){let t=e.type.prop(Yye);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}const jt=Xu.define,Z2=jt(),Kh=jt(),mZ=jt(Kh),gZ=jt(Kh),Jh=jt(),K2=jt(Jh),WD=jt(Jh),zu=jt(),Nm=jt(zu),Qu=jt(),Uu=jt(),h6=jt(),mx=jt(h6),J2=jt(),Y={comment:Z2,lineComment:jt(Z2),blockComment:jt(Z2),docComment:jt(Z2),name:Kh,variableName:jt(Kh),typeName:mZ,tagName:jt(mZ),propertyName:gZ,attributeName:jt(gZ),className:jt(Kh),labelName:jt(Kh),namespace:jt(Kh),macroName:jt(Kh),literal:Jh,string:K2,docString:jt(K2),character:jt(K2),attributeValue:jt(K2),number:WD,integer:jt(WD),float:jt(WD),bool:jt(Jh),regexp:jt(Jh),escape:jt(Jh),color:jt(Jh),url:jt(Jh),keyword:Qu,self:jt(Qu),null:jt(Qu),atom:jt(Qu),unit:jt(Qu),modifier:jt(Qu),operatorKeyword:jt(Qu),controlKeyword:jt(Qu),definitionKeyword:jt(Qu),moduleKeyword:jt(Qu),operator:Uu,derefOperator:jt(Uu),arithmeticOperator:jt(Uu),logicOperator:jt(Uu),bitwiseOperator:jt(Uu),compareOperator:jt(Uu),updateOperator:jt(Uu),definitionOperator:jt(Uu),typeOperator:jt(Uu),controlOperator:jt(Uu),punctuation:h6,separator:jt(h6),bracket:mx,angleBracket:jt(mx),squareBracket:jt(mx),paren:jt(mx),brace:jt(mx),content:zu,heading:Nm,heading1:jt(Nm),heading2:jt(Nm),heading3:jt(Nm),heading4:jt(Nm),heading5:jt(Nm),heading6:jt(Nm),contentSeparator:jt(zu),list:jt(zu),quote:jt(zu),emphasis:jt(zu),strong:jt(zu),link:jt(zu),monospace:jt(zu),strikethrough:jt(zu),inserted:jt(),deleted:jt(),changed:jt(),invalid:jt(),meta:J2,documentMeta:jt(J2),annotation:jt(J2),processingInstruction:jt(J2),definition:Xu.defineModifier("definition"),constant:Xu.defineModifier("constant"),function:Xu.defineModifier("function"),standard:Xu.defineModifier("standard"),local:Xu.defineModifier("local"),special:Xu.defineModifier("special")};for(let e in Y){let t=Y[e];t instanceof Xu&&(t.name=e)}Zye([{tag:Y.link,class:"tok-link"},{tag:Y.heading,class:"tok-heading"},{tag:Y.emphasis,class:"tok-emphasis"},{tag:Y.strong,class:"tok-strong"},{tag:Y.keyword,class:"tok-keyword"},{tag:Y.atom,class:"tok-atom"},{tag:Y.bool,class:"tok-bool"},{tag:Y.url,class:"tok-url"},{tag:Y.labelName,class:"tok-labelName"},{tag:Y.inserted,class:"tok-inserted"},{tag:Y.deleted,class:"tok-deleted"},{tag:Y.literal,class:"tok-literal"},{tag:Y.string,class:"tok-string"},{tag:Y.number,class:"tok-number"},{tag:[Y.regexp,Y.escape,Y.special(Y.string)],class:"tok-string2"},{tag:Y.variableName,class:"tok-variableName"},{tag:Y.local(Y.variableName),class:"tok-variableName tok-local"},{tag:Y.definition(Y.variableName),class:"tok-variableName tok-definition"},{tag:Y.special(Y.variableName),class:"tok-variableName2"},{tag:Y.definition(Y.propertyName),class:"tok-propertyName tok-definition"},{tag:Y.typeName,class:"tok-typeName"},{tag:Y.namespace,class:"tok-namespace"},{tag:Y.className,class:"tok-className"},{tag:Y.macroName,class:"tok-macroName"},{tag:Y.propertyName,class:"tok-propertyName"},{tag:Y.operator,class:"tok-operator"},{tag:Y.comment,class:"tok-comment"},{tag:Y.meta,class:"tok-meta"},{tag:Y.invalid,class:"tok-invalid"},{tag:Y.punctuation,class:"tok-punctuation"}]);var YD;const bp=new Nn;function iR(e){return Qt.define({combine:e?t=>t.concat(e):void 0})}const _Q=new Nn;class Al{constructor(t,n,r=[],i=""){this.data=t,this.name=i,vr.prototype.hasOwnProperty("tree")||Object.defineProperty(vr.prototype,"tree",{get(){return mi(this)}}),this.parser=n,this.extension=[nm.of(this),vr.languageData.of((s,a,l)=>{let c=bZ(s,a,l),u=c.type.prop(bp);if(!u)return[];let d=s.facet(u),f=c.type.prop(_Q);if(f){let h=c.resolve(a-c.from,l);for(let m of f)if(m.test(h,s)){let g=s.facet(m.facet);return m.type=="replace"?g:g.concat(d)}}return d})].concat(r)}isActiveAt(t,n,r=-1){return bZ(t,n,r).type.prop(bp)==this.data}findRegions(t){let n=t.facet(nm);if((n==null?void 0:n.data)==this.data)return[{from:0,to:t.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],i=(s,a)=>{if(s.prop(bp)==this.data){r.push({from:a,to:a+s.length});return}let l=s.prop(Nn.mounted);if(l){if(l.tree.prop(bp)==this.data){if(l.overlay)for(let c of l.overlay)r.push({from:c.from+a,to:c.to+a});else r.push({from:a,to:a+s.length});return}else if(l.overlay){let c=r.length;if(i(l.tree,l.overlay[0].from+a),r.length>c)return}}for(let c=0;cr.isTop?n:void 0)]}),t.name)}configure(t,n){return new lh(this.data,this.parser.configure(t),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function mi(e){let t=e.field(Al.state,!1);return t?t.tree:cr.empty}class Kgt{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,n){let r=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,n):this.string.slice(t-r,n-r)}}let gx=null;class Zg{constructor(t,n,r=[],i,s,a,l,c){this.parser=t,this.state=n,this.fragments=r,this.tree=i,this.treeLen=s,this.viewport=a,this.skipped=l,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(t,n,r){return new Zg(t,n,[],cr.empty,0,r,[],null)}startParse(){return this.parser.startParse(new Kgt(this.state.doc),this.fragments)}work(t,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=cr.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof t=="number"){let i=Date.now()+t;t=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=t,this.tree=n,this.fragments=this.withoutTempSkipped(Uf.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let n=gx;gx=this;try{return t()}finally{gx=n}}withoutTempSkipped(t){for(let n;n=this.tempSkipped.pop();)t=yZ(t,n.from,n.to);return t}changes(t,n){let{fragments:r,tree:i,treeLen:s,viewport:a,skipped:l}=this;if(this.takeTree(),!t.empty){let c=[];if(t.iterChangedRanges((u,d,f,h)=>c.push({fromA:u,toA:d,fromB:f,toB:h})),r=Uf.applyChanges(r,c),i=cr.empty,s=0,a={from:t.mapPos(a.from,-1),to:t.mapPos(a.to,1)},this.skipped.length){l=[];for(let u of this.skipped){let d=t.mapPos(u.from,1),f=t.mapPos(u.to,-1);dt.from&&(this.fragments=yZ(this.fragments,i,s),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,n){this.skipped.push({from:t,to:n})}static getSkippingParser(t){return new class extends Yj{createParse(n,r,i){let s=i[0].from,a=i[i.length-1].to;return{parsedPos:s,advance(){let c=gx;if(c){for(let u of i)c.tempSkipped.push(u);t&&(c.scheduleOn=c.scheduleOn?Promise.all([c.scheduleOn,t]):t)}return this.parsedPos=a,new cr(Hs.none,[],[],a-s)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let n=this.fragments;return this.treeLen>=t&&n.length&&n[0].from==0&&n[0].to>=t}static get(){return gx}}function yZ(e,t,n){return Uf.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class S1{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(t.changes,t.state),r=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new S1(n)}static init(t){let n=Math.min(3e3,t.doc.length),r=Zg.create(t.facet(nm).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new S1(r)}}Al.state=Qa.define({create:S1.init,update(e,t){for(let n of t.effects)if(n.is(Al.setState))return n.value;return t.startState.facet(nm)!=t.state.facet(nm)?S1.init(t.state):e.apply(t)}});let Kye=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(Kye=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const ZD=typeof navigator<"u"&&(!((YD=navigator.scheduling)===null||YD===void 0)&&YD.isInputPending)?()=>navigator.scheduling.isInputPending():null,Jgt=ps.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let n=this.view.state.field(Al.state).context;(n.updateViewport(t.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:t}=this.view,n=t.field(Al.state);(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))&&(this.working=Kye(this.work))}work(t){this.working=null;let n=Date.now();if(this.chunkEndi+1e3,c=s.context.work(()=>ZD&&ZD()||Date.now()>a,i+(l?0:1e5));this.chunkBudget-=Date.now()-n,(c||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Al.setState.of(new S1(s.context))})),this.chunkBudget>0&&!(c&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(n=>Go(this.view.state,n)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),nm=Qt.define({combine(e){return e.length?e[0]:null},enables:e=>[Al.state,Jgt,Ct.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]});class rm{constructor(t,n=[]){this.language=t,this.support=n,this.extension=[t,n]}}class EA{constructor(t,n,r,i,s,a=void 0){this.name=t,this.alias=n,this.extensions=r,this.filename=i,this.loadFunc=s,this.support=a,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(t=>this.support=t,t=>{throw this.loading=null,t}))}static of(t){let{load:n,support:r}=t;if(!n){if(!r)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");n=()=>Promise.resolve(r)}return new EA(t.name,(t.alias||[]).concat(t.name).map(i=>i.toLowerCase()),t.extensions||[],t.filename,n,r)}static matchFilename(t,n){for(let i of t)if(i.filename&&i.filename.test(n))return i;let r=/\.([^.]+)$/.exec(n);if(r){for(let i of t)if(i.extensions.indexOf(r[1])>-1)return i}return null}static matchLanguageName(t,n,r=!0){n=n.toLowerCase();for(let i of t)if(i.alias.some(s=>s==n))return i;if(r)for(let i of t)for(let s of i.alias){let a=n.indexOf(s);if(a>-1&&(s.length>2||!/\w/.test(n[a-1])&&!/\w/.test(n[a+s.length])))return i}return null}}const e0t=Qt.define(),OO=Qt.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(n=>n!=t[0]))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function Kg(e){let t=e.facet(OO);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function uS(e,t){let n="",r=e.tabSize,i=e.facet(OO)[0];if(i==" "){for(;t>=r;)n+=" ",t-=r;i=" "}for(let s=0;s=t?t0t(e,n,t):null}class sR{constructor(t,n={}){this.state=t,this.options=n,this.unit=Kg(t)}lineAt(t,n=1){let r=this.state.doc.lineAt(t),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=r.from&&i<=r.to?s&&i==t?{text:"",from:t}:(n<0?i-1&&(s+=a-this.countColumn(r,r.search(/\S|$/))),s}countColumn(t,n=t.length){return vu(t,this.state.tabSize,n)}lineIndent(t,n=1){let{text:r,from:i}=this.lineAt(t,n),s=this.options.overrideIndentation;if(s){let a=s(i);if(a>-1)return a}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const wh=new Nn;function t0t(e,t,n){let r=t.resolveStack(n),i=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let s=[];for(let a=i;a&&!(a.fromr.node.to||a.from==r.node.from&&a.type==r.node.type);a=a.parent)s.push(a);for(let a=s.length-1;a>=0;a--)r={node:s[a],next:r}}return Jye(r,e,n)}function Jye(e,t,n){for(let r=e;r;r=r.next){let i=r0t(r.node);if(i)return i(CQ.create(t,n,r))}return 0}function n0t(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function r0t(e){let t=e.type.prop(wh);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(Nn.closedBy))){let i=e.lastChild,s=i&&r.indexOf(i.name)>-1;return a=>e1e(a,!0,1,void 0,s&&!n0t(a)?i.from:void 0)}return e.parent==null?i0t:null}function i0t(){return 0}class CQ extends sR{constructor(t,n,r){super(t.state,t.options),this.base=t,this.pos=n,this.context=r}get node(){return this.context.node}static create(t,n,r){return new CQ(t,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let n=this.state.doc.lineAt(t.from);for(;;){let r=t.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(s0t(r,t))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return Jye(this.context.next,this.base,this.pos)}}function s0t(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function a0t(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let i=e.options.simulateBreak,s=e.state.doc.lineAt(n.from),a=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let l=n.to;;){let c=t.childAfter(l);if(!c||c==r)return null;if(!c.type.isSkipped){if(c.from>=a)return null;let u=/^ */.exec(s.text.slice(n.to-s.from))[0].length;return{from:n.from,to:n.to+u}}l=c.to}}function Cy({closing:e,align:t=!0,units:n=1}){return r=>e1e(r,t,n,e)}function e1e(e,t,n,r,i){let s=e.textAfter,a=s.match(/^\s*/)[0].length,l=r&&s.slice(a,a+r.length)==r||i==e.pos+a,c=t?a0t(e):null;return c?l?e.column(c.from):e.column(c.to):e.baseIndent+(l?0:e.unit*n)}const o0t=e=>e.baseIndent;function Ay({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}const l0t=200;function c0t(){return vr.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:r}=e.newSelection.main,i=n.lineAt(r);if(r>i.from+l0t)return e;let s=n.sliceString(i.from,r);if(!t.some(u=>u.test(s)))return e;let{state:a}=e,l=-1,c=[];for(let{head:u}of a.selection.ranges){let d=a.doc.lineAt(u);if(d.from==l)continue;l=d.from;let f=TQ(a,d.from);if(f==null)continue;let h=/^\s*/.exec(d.text)[0],m=uS(a,f);h!=m&&c.push({from:d.from,to:d.from+h.length,insert:m})}return c.length?[e,{changes:c,sequential:!0}]:e})}const t1e=Qt.define(),Sh=new Nn;function BE(e){let t=e.firstChild,n=e.lastChild;return t&&t.ton)continue;if(s&&l.from=t&&u.to>n&&(s=u)}}return s}function d0t(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function kA(e,t,n){for(let r of e.facet(t1e)){let i=r(e,t,n);if(i)return i}return u0t(e,t,n)}function n1e(e,t){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);return n>=r?void 0:{from:n,to:r}}const aR=jn.define({map:n1e}),QE=jn.define({map:n1e});function r1e(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(r=>r.from<=n&&r.to>=n)||t.push(e.lineBlockAt(n));return t}const Jg=Qa.define({create(){return dn.none},update(e,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges((r,i)=>e=OZ(e,r,i)),e=e.map(t.changes);let n=[];for(let r of t.effects)r.is(aR)&&!f0t(e,r.value.from,r.value.to)?n.push(r.value):r.is(QE)&&(e=e.update({filter:(i,s)=>r.value.from!=i||r.value.to!=s,filterFrom:r.value.from,filterTo:r.value.to}));if(n.length){let{preparePlaceholder:r}=t.state.facet(a1e),i=n.map(s=>(r?dn.replace({widget:new O0t(r(t.state,s))}):xZ).range(s.from,s.to));e=e.update({add:i})}return t.selection&&(e=OZ(e,t.selection.main.head)),e},provide:e=>Ct.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(r,i)=>{n.push(r,i)}),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n{it&&(r=!0)}),r?e.update({filterFrom:t,filterTo:n,filter:(i,s)=>i>=n||s<=t}):e}function _A(e,t,n){var r;let i=null;return(r=e.field(Jg,!1))===null||r===void 0||r.between(t,n,(s,a)=>{(!i||i.from>s)&&(i={from:s,to:a})}),i}function f0t(e,t,n){let r=!1;return e.between(t,t,(i,s)=>{i==t&&s==n&&(r=!0)}),r}function i1e(e,t){return e.field(Jg,!1)?t:t.concat(jn.appendConfig.of(o1e()))}const h0t=e=>{for(let t of r1e(e)){let n=kA(e.state,t.from,t.to);if(n)return e.dispatch({effects:i1e(e.state,[aR.of(n),s1e(e,n)])}),!0}return!1},p0t=e=>{if(!e.state.field(Jg,!1))return!1;let t=[];for(let n of r1e(e)){let r=_A(e.state,n.from,n.to);r&&t.push(QE.of(r),s1e(e,r,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function s1e(e,t,n=!0){let r=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return Ct.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${e.state.phrase("to")} ${i}.`)}const m0t=e=>{let{state:t}=e,n=[];for(let r=0;r{let t=e.state.field(Jg,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(r,i)=>{n.push(QE.of({from:r,to:i}))}),e.dispatch({effects:n}),!0},b0t=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:h0t},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:p0t},{key:"Ctrl-Alt-[",run:m0t},{key:"Ctrl-Alt-]",run:g0t}],y0t={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},a1e=Qt.define({combine(e){return Nd(e,y0t)}});function o1e(e){return[Jg,w0t]}function l1e(e,t){let{state:n}=e,r=n.facet(a1e),i=a=>{let l=e.lineBlockAt(e.posAtDOM(a.target)),c=_A(e.state,l.from,l.to);c&&e.dispatch({effects:QE.of(c)}),a.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(e,i,t);let s=document.createElement("span");return s.textContent=r.placeholderText,s.setAttribute("aria-label",n.phrase("folded code")),s.title=n.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}const xZ=dn.replace({widget:new class extends Nu{toDOM(e){return l1e(e,null)}}});class O0t extends Nu{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return l1e(t,this.value)}}const x0t={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class KD extends oh{constructor(t,n){super(),this.config=t,this.open=n}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=t.state.phrase(this.open?"Fold line":"Unfold line"),n}}function v0t(e={}){let t={...x0t,...e},n=new KD(t,!0),r=new KD(t,!1),i=ps.fromClass(class{constructor(a){this.from=a.viewport.from,this.markers=this.buildMarkers(a)}update(a){(a.docChanged||a.viewportChanged||a.startState.facet(nm)!=a.state.facet(nm)||a.startState.field(Jg,!1)!=a.state.field(Jg,!1)||mi(a.startState)!=mi(a.state)||t.foldingChanged(a))&&(this.markers=this.buildMarkers(a.view))}buildMarkers(a){let l=new sh;for(let c of a.viewportLineBlocks){let u=_A(a.state,c.from,c.to)?r:kA(a.state,c.from,c.to)?n:null;u&&l.add(c.from,c.from,u)}return l.finish()}}),{domEventHandlers:s}=t;return[i,Igt({class:"cm-foldGutter",markers(a){var l;return((l=a.plugin(i))===null||l===void 0?void 0:l.markers)||gr.empty},initialSpacer(){return new KD(t,!1)},domEventHandlers:{...s,click:(a,l,c)=>{if(s.click&&s.click(a,l,c))return!0;let u=_A(a.state,l.from,l.to);if(u)return a.dispatch({effects:QE.of(u)}),!0;let d=kA(a.state,l.from,l.to);return d?(a.dispatch({effects:aR.of(d)}),!0):!1}}}),o1e()]}const w0t=Ct.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class UE{constructor(t,n){this.specs=t;let r;function i(l){let c=Jp.newName();return(r||(r=Object.create(null)))["."+c]=l,c}const s=typeof n.all=="string"?n.all:n.all?i(n.all):void 0,a=n.scope;this.scope=a instanceof Al?l=>l.prop(bp)==a.data:a?l=>l==a:void 0,this.style=Zye(t.map(l=>({tag:l.tag,class:l.class||i(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=r?new Jp(r):null,this.themeType=n.themeType}static define(t,n){return new UE(t,n||{})}}const p6=Qt.define(),c1e=Qt.define({combine(e){return e.length?[e[0]]:null}});function xT(e){let t=e.facet(p6);return t.length?t:e.facet(c1e)}function u1e(e,t){let n=[E0t],r;return e instanceof UE&&(e.module&&n.push(Ct.styleModule.of(e.module)),r=e.themeType),t!=null&&t.fallback?n.push(c1e.of(e)):r?n.push(p6.computeN([Ct.darkTheme],i=>i.facet(Ct.darkTheme)==(r=="dark")?[e]:[])):n.push(p6.of(e)),n}function RMt(e,t,n){let r=xT(e),i=null;if(r){for(let s of r)if(!s.scope||n){let a=s.style(t);a&&(i=i?i+" "+a:a)}}return i}class S0t{constructor(t){this.markCache=Object.create(null),this.tree=mi(t.state),this.decorations=this.buildDeco(t,xT(t.state)),this.decoratedTo=t.viewport.to}update(t){let n=mi(t.state),r=xT(t.state),i=r!=xT(t.startState),{viewport:s}=t.view,a=t.changes.mapPos(this.decoratedTo,1);n.length=s.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=a):(n!=this.tree||t.viewportChanged||i)&&(this.tree=n,this.decorations=this.buildDeco(t.view,r),this.decoratedTo=s.to)}buildDeco(t,n){if(!n||!this.tree.length)return dn.none;let r=new sh;for(let{from:i,to:s}of t.visibleRanges)Wgt(this.tree,n,(a,l,c)=>{r.add(a,l,this.markCache[c]||(this.markCache[c]=dn.mark({class:c})))},i,s);return r.finish()}}const E0t=xh.high(ps.fromClass(S0t,{decorations:e=>e.decorations})),k0t=UE.define([{tag:Y.meta,color:"#404740"},{tag:Y.link,textDecoration:"underline"},{tag:Y.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Y.emphasis,fontStyle:"italic"},{tag:Y.strong,fontWeight:"bold"},{tag:Y.strikethrough,textDecoration:"line-through"},{tag:Y.keyword,color:"#708"},{tag:[Y.atom,Y.bool,Y.url,Y.contentSeparator,Y.labelName],color:"#219"},{tag:[Y.literal,Y.inserted],color:"#164"},{tag:[Y.string,Y.deleted],color:"#a11"},{tag:[Y.regexp,Y.escape,Y.special(Y.string)],color:"#e40"},{tag:Y.definition(Y.variableName),color:"#00f"},{tag:Y.local(Y.variableName),color:"#30a"},{tag:[Y.typeName,Y.namespace],color:"#085"},{tag:Y.className,color:"#167"},{tag:[Y.special(Y.variableName),Y.macroName],color:"#256"},{tag:Y.definition(Y.propertyName),color:"#00c"},{tag:Y.comment,color:"#940"},{tag:Y.invalid,color:"#f00"}]),_0t=Ct.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),d1e=1e4,f1e="()[]{}",h1e=Qt.define({combine(e){return Nd(e,{afterCursor:!0,brackets:f1e,maxScanDistance:d1e,renderMatch:A0t})}}),T0t=dn.mark({class:"cm-matchingBracket"}),C0t=dn.mark({class:"cm-nonmatchingBracket"});function A0t(e){let t=[],n=e.matched?T0t:C0t;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}function vZ(e){let t=[],n=e.facet(h1e);for(let r of e.selection.ranges){if(!r.empty)continue;let i=sd(e,r.head,-1,n)||r.head>0&&sd(e,r.head-1,1,n)||n.afterCursor&&(sd(e,r.head,1,n)||r.heade.decorations}),j0t=[N0t,_0t];function R0t(e={}){return[h1e.of(e),j0t]}const p1e=new Nn;function m6(e,t,n){let r=e.prop(t<0?Nn.openedBy:Nn.closedBy);if(r)return r;if(e.name.length==1){let i=n.indexOf(e.name);if(i>-1&&i%2==(t<0?1:0))return[n[i+t]]}return null}function g6(e){let t=e.type.prop(p1e);return t?t(e.node):e}function sd(e,t,n,r={}){let i=r.maxScanDistance||d1e,s=r.brackets||f1e,a=mi(e),l=a.resolveInner(t,n);for(let c=l;c;c=c.parent){let u=m6(c.type,n,s);if(u&&c.from0?t>=d.from&&td.from&&t<=d.to))return I0t(e,t,n,c,d,u,s)}}return D0t(e,t,n,a,l.type,i,s)}function I0t(e,t,n,r,i,s,a){let l=r.parent,c={from:i.from,to:i.to},u=0,d=l==null?void 0:l.cursor();if(d&&(n<0?d.childBefore(r.from):d.childAfter(r.to)))do if(n<0?d.to<=r.from:d.from>=r.to){if(u==0&&s.indexOf(d.type.name)>-1&&d.from0)return null;let u={from:n<0?t-1:t,to:n>0?t+1:t},d=e.doc.iterRange(t,n>0?e.doc.length:0),f=0;for(let h=0;!d.next().done&&h<=s;){let m=d.value;n<0&&(h+=m.length);let g=t+h*n;for(let b=n>0?0:m.length-1,y=n>0?m.length:-1;b!=y;b+=n){let O=a.indexOf(m[b]);if(!(O<0||r.resolveInner(g+b,1).type!=i))if(O%2==0==n>0)f++;else{if(f==1)return{start:u,end:{from:g+b,to:g+b+1},matched:O>>1==c>>1};f--}}n>0&&(h+=m.length)}return d.done?{start:u,matched:!1}:null}function wZ(e,t,n,r=0,i=0){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));let s=i;for(let a=r;a=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.posn}eatSpace(){let t=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t}skipToEnd(){this.pos=this.string.length}skipTo(t){let n=this.string.indexOf(t,this.pos);if(n>-1)return this.pos=n,!0}backUp(t){this.pos-=t}column(){return this.lastColumnPosr?a.toLowerCase():a,s=this.string.substr(this.pos,t.length);return i(s)==i(t)?(n!==!1&&(this.pos+=t.length),!0):null}else{let i=this.string.slice(this.pos).match(t);return i&&i.index>0?null:(i&&n!==!1&&(this.pos+=i[0].length),i)}}current(){return this.string.slice(this.start,this.pos)}}function P0t(e){return{name:e.name||"",token:e.token,blankLine:e.blankLine||(()=>{}),startState:e.startState||(()=>!0),copyState:e.copyState||M0t,indent:e.indent||(()=>null),languageData:e.languageData||{},tokenTable:e.tokenTable||jQ,mergeTokens:e.mergeTokens!==!1}}function M0t(e){if(typeof e!="object")return e;let t={};for(let n in e){let r=e[n];t[n]=r instanceof Array?r.slice():r}return t}const SZ=new WeakMap;class AQ extends Al{constructor(t){let n=iR(t.languageData),r=P0t(t),i,s=new class extends Yj{createParse(a,l,c){return new $0t(i,a,l,c)}};super(n,s,[],t.name),this.topNode=U0t(n,this),i=this,this.streamParser=r,this.stateAfter=new Nn({perNode:!0}),this.tokenTable=t.tokenTable?new O1e(r.tokenTable):Q0t}static define(t){return new AQ(t)}getIndent(t){let n,{overrideIndentation:r}=t.options;r&&(n=SZ.get(t.state),n!=null&&n1e4)return null;for(;s=r&&n+t.length<=i&&t.prop(e.stateAfter);if(s)return{state:e.streamParser.copyState(s),pos:n+t.length};for(let a=t.children.length-1;a>=0;a--){let l=t.children[a],c=n+t.positions[a],u=l instanceof cr&&c=t.length)return t;!i&&n==0&&t.type==e.topNode&&(i=!0);for(let s=t.children.length-1;s>=0;s--){let a=t.positions[s],l=t.children[s],c;if(an&&NQ(e,s.tree,0-s.offset,n,l),u;if(c&&c.pos<=r&&(u=g1e(e,s.tree,n+s.offset,c.pos+s.offset,!1)))return{state:c.state,tree:u}}return{state:e.streamParser.startState(i?Kg(i):4),tree:cr.empty}}let $0t=class{constructor(t,n,r,i){this.lang=t,this.input=n,this.fragments=r,this.ranges=i,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=i[i.length-1].to;let s=Zg.get(),a=i[0].from,{state:l,tree:c}=L0t(t,r,a,this.to,s==null?void 0:s.state);this.state=l,this.parsedPos=this.chunkStart=a+c.length;for(let u=0;uu.from<=s.viewport.from&&u.to>=s.viewport.from)&&(this.state=this.lang.streamParser.startState(Kg(s.state)),s.skipUntilInView(this.parsedPos,s.viewport.from),this.parsedPos=s.viewport.from),this.moveRangeIndex()}advance(){let t=Zg.get(),n=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),r=Math.min(n,this.chunkStart+512);for(t&&(r=Math.min(r,t.viewport.to));this.parsedPos=n?this.finish():t&&this.parsedPos>=t.viewport.to?(t.skipUntilInView(this.parsedPos,n),this.finish()):null}stopAt(t){this.stoppedAt=t}lineAfter(t){let n=this.input.chunk(t);if(this.input.lineChunks)n==` +`,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=L2(t),r=tb(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=L2(t),r=tb(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 ght(e){const t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new pht||null,prettyErrors:t}}function Obe(e,t={}){const{lineCounter:n,prettyErrors:r}=ght(t),i=new mht(n==null?void 0:n.addNewLine),s=new cht(t);let a=null;for(const l of s.compose(i.parse(e),!0,e.length))if(!a)a=l;else if(a.options.logLevel!=="silent"){a.errors.push(new Zx(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(a.errors.forEach(eY(e,n)),a.warnings.forEach(eY(e,n))),a}function bht(e,t,n){let r;const i=Obe(e,n);if(!i)return null;if(i.warnings.forEach(s=>z0e(i.options.logLevel,s)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function nQ(e,t,n){let r=null;if(typeof t=="function"||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n=="string"&&(n=n.length),typeof n=="number"){const i=Math.round(n);n=i<1?void 0:i>8?{indent:8}:{indent:i}}if(e===void 0){const{keepUndefined:i}=n??t??{};if(!i)return}return RE(e)&&!r?e.toString(n):new ME(e,r,n).toString(n)}const xbe=1024;let yht=0,Cc=class{constructor(t,n){this.from=t,this.to=n}};class An{constructor(t={}){this.id=yht++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=t.combine||null}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof t!="function"&&(t=Fs.match(t)),n=>{let r=t(n);return r===void 0?null:[this,r]}}}An.closedBy=new An({deserialize:e=>e.split(" ")});An.openedBy=new An({deserialize:e=>e.split(" ")});An.group=new An({deserialize:e=>e.split(" ")});An.isolate=new An({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});An.contextHash=new An({perNode:!0});An.lookAhead=new An({perNode:!0});An.mounted=new An({perNode:!0});class Sy{constructor(t,n,r,i=!1){this.tree=t,this.overlay=n,this.parser=r,this.bracketed=i}static get(t){return t&&t.props&&t.props[An.mounted.id]}}const Oht=Object.create(null);class Fs{constructor(t,n,r,i=0){this.name=t,this.props=n,this.id=r,this.flags=i}static define(t){let n=t.props&&t.props.length?Object.create(null):Oht,r=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new Fs(t.name||"",n,t.id,r);if(t.props){for(let s of t.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[s[0].id]=s[1]}}return i}prop(t){return this.props[t.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(t){if(typeof t=="string"){if(this.name==t)return!0;let n=this.prop(An.group);return n?n.indexOf(t)>-1:!1}return this.id==t}static match(t){let n=Object.create(null);for(let r in t)for(let i of r.split(" "))n[i]=t[r];return r=>{for(let i=r.prop(An.group),s=-1;s<(i?i.length:0);s++){let a=n[s<0?r.name:i[s]];if(a)return a}}}}Fs.none=new Fs("",Object.create(null),0,8);class bO{constructor(t){this.types=t;for(let n=0;n0;for(let c=this.cursor(a|Ur.IncludeAnonymous);;){let u=!1;if(c.from<=s&&c.to>=i&&(!l&&c.type.isAnonymous||n(c)!==!1)){if(c.firstChild())continue;u=!0}for(;u&&r&&(l||!c.type.isAnonymous)&&r(c),!c.nextSibling();){if(!c.parent())return;u=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let n in this.props)t.push([+n,this.props[n]]);return t}balance(t={}){return this.children.length<=8?this:sQ(Fs.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new lr(this.type,n,r,i,this.propValues),t.makeTree||((n,r,i)=>new lr(Fs.none,n,r,i)))}static build(t){return Sht(t)}}lr.empty=new lr(Fs.none,[],[],0);class rQ{constructor(t,n){this.buffer=t,this.index=n}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 rQ(this.buffer,this.index)}}class Zp{constructor(t,n,r){this.buffer=t,this.length=n,this.set=r}get type(){return Fs.none}toString(){let t=[];for(let n=0;n0));c=a[c+3]);return l}slice(t,n,r){let i=this.buffer,s=new Uint16Array(n-t),a=0;for(let l=t,c=0;l=t&&nt;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function tS(e,t,n,r){for(var i;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to0?l.length:-1;t!=u;t+=n){let d=l[t],f=c[t]+a.from,h;if(!(!(s&Ur.EnterBracketed&&d instanceof lr&&(h=Sy.get(d))&&!h.overlay&&h.bracketed&&r>=f&&r<=f+d.length)&&!vbe(i,r,f,f+d.length))){if(d instanceof Zp){if(s&Ur.ExcludeBuffers)continue;let m=d.findChild(0,d.buffer.length,n,r-f,i);if(m>-1)return new sd(new xht(a,d,t,f),null,m)}else if(s&Ur.IncludeAnonymous||!d.type.isAnonymous||iQ(d)){let m;if(!(s&Ur.IgnoreMounts)&&(m=Sy.get(d))&&!m.overlay)return new Ka(m.tree,f,t,a);let g=new Ka(d,f,t,a);return s&Ur.IncludeAnonymous||!g.type.isAnonymous?g:g.nextChild(n<0?d.children.length-1:0,n,r,i,s)}}}if(s&Ur.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?t=a.index+n:t=n<0?-1:a._parent._tree.children.length,a=a._parent,!a))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(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}prop(t){return this._tree.prop(t)}enter(t,n,r=0){let i;if(!(r&Ur.IgnoreOverlays)&&(i=Sy.get(this._tree))&&i.overlay){let s=t-this.from,a=r&Ur.EnterBracketed&&i.bracketed;for(let{from:l,to:c}of i.overlay)if((n>0||a?l<=s:l=s:c>s))return new Ka(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,n,r)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}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 oY(e,t,n,r){let i=e.cursor(),s=[];if(!i.firstChild())return s;if(n!=null){for(let a=!1;!a;)if(a=i.type.is(n),!i.nextSibling())return s}for(;;){if(r!=null&&i.type.is(r))return s;if(i.type.is(t)&&s.push(i.node),!i.nextSibling())return r==null?s:[]}}function NL(e,t,n=t.length-1){for(let r=e;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}class xht{constructor(t,n,r,i){this.parent=t,this.buffer=n,this.index=r,this.start=i}}class sd extends wbe{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(t,n,r){super(),this.context=t,this._parent=n,this.index=r,this.type=t.buffer.set.types[t.buffer.buffer[r]]}child(t,n,r){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],t,n-this.context.start,r);return s<0?null:new sd(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}prop(t){return this.type.prop(t)}enter(t,n,r=0){if(r&Ur.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return s<0?null:new sd(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,n=t.buffer[this.index+3];return n<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new sd(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new sd(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],n=[],{buffer:r}=this.context,i=this.index+4,s=r.buffer[this.index+3];if(s>i){let a=r.buffer[this.index+1];t.push(r.slice(i,s,a)),n.push(0)}return new lr(this.type,t,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Sbe(e){if(!e.length)return null;let t=0,n=e[0];for(let s=1;sn.from||a.to=t){let l=new Ka(a.tree,a.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(tS(l,t,n,!1))}}return i?Sbe(i):r}class dA{get name(){return this.type.name}constructor(t,n=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=n&~Ur.EnterBracketed,t instanceof Ka)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let r=t._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,n){this.index=t;let{start:r,buffer:i}=this.buffer;return this.type=n||i.set.types[i.buffer[t]],this.from=r+i.buffer[t+1],this.to=r+i.buffer[t+2],!0}yield(t){return t?t instanceof Ka?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,n,r,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],t,n-this.buffer.start,r);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(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,n,r=this.mode){return this.buffer?r&Ur.ExcludeBuffers?!1:this.enterChild(1,t,n):this.yield(this._tree.enter(t,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ur.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&Ur.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(t<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(n.findChild(i,this.index,-1,0,4))}else{let i=n.buffer[this.index+3];if(i<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(i)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let n,r,{buffer:i}=this;if(i){if(t>0){if(this.index-1)for(let s=n+t,a=t<0?-1:r._tree.children.length;s!=a;s+=t){let l=r._tree.children[s];if(this.mode&Ur.IncludeAnonymous||l instanceof Zp||!l.type.isAnonymous||iQ(l))return!1}return!0}move(t,n){if(n&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,n=0){for(;(this.from==this.to||(n<1?this.from>=t:this.from>t)||(n>-1?this.to<=t:this.to=0;){for(let a=t;a;a=a._parent)if(a.index==i){if(i==this.index)return a;n=a,r=s+1;break e}i=this.stack[--s]}for(let i=r;i=0;s--){if(s<0)return NL(this._tree,t,i);let a=r[n.buffer[this.stack[s]]];if(!a.isAnonymous){if(t[i]&&t[i]!=a.name)return!1;i--}}return!0}}function iQ(e){return e.children.some(t=>t instanceof Zp||!t.type.isAnonymous||iQ(t))}function Sht(e){var t;let{buffer:n,nodeSet:r,maxBufferLength:i=xbe,reused:s=[],minRepeatType:a=r.types.length}=e,l=Array.isArray(n)?new rQ(n,n.length):n,c=r.types,u=0,d=0;function f(S,E,k,_,T,C){let{id:A,start:j,end:M,size:I}=l,$=d,N=u;if(I<0)if(l.next(),I==-1){let H=s[A];k.push(H),_.push(j-S);return}else if(I==-3){u=A;return}else if(I==-4){d=A;return}else throw new RangeError(`Unrecognized record size: ${I}`);let D=c[A],Q,F,L=j-S;if(M-j<=i&&(F=y(l.pos-E,T))){let H=new Uint16Array(F.size-F.skip),z=l.pos-F.size,B=H.length;for(;l.pos>z;)B=O(F.start,H,B);Q=new Zp(H,M-F.start,r),L=F.start-S}else{let H=l.pos-I;l.next();let z=[],B=[],V=A>=a?A:-1,W=0,le=M;for(;l.pos>H;)V>=0&&l.id==V&&l.size>=0?(l.end<=le-i&&(g(z,B,j,W,l.end,le,V,$,N),W=z.length,le=l.end),l.next()):C>2500?h(j,H,z,B):f(j,H,z,B,V,C+1);if(V>=0&&W>0&&W-1&&W>0){let be=m(D,N);Q=sQ(D,z,B,0,z.length,0,M-j,be,be)}else Q=b(D,z,B,M-j,$-M,N)}k.push(Q),_.push(L)}function h(S,E,k,_){let T=[],C=0,A=-1;for(;l.pos>E;){let{id:j,start:M,end:I,size:$}=l;if($>4)l.next();else{if(A>-1&&M=0;I-=3)j[$++]=T[I],j[$++]=T[I+1]-M,j[$++]=T[I+2]-M,j[$++]=$;k.push(new Zp(j,T[2]-M,r)),_.push(M-S)}}function m(S,E){return(k,_,T)=>{let C=0,A=k.length-1,j,M;if(A>=0&&(j=k[A])instanceof lr){if(!A&&j.type==S&&j.length==T)return j;(M=j.prop(An.lookAhead))&&(C=_[A]+j.length+M)}return b(S,k,_,T,C,E)}}function g(S,E,k,_,T,C,A,j,M){let I=[],$=[];for(;S.length>_;)I.push(S.pop()),$.push(E.pop()+k-T);S.push(b(r.types[A],I,$,C-T,j-C,M)),E.push(T-k)}function b(S,E,k,_,T,C,A){if(C){let j=[An.contextHash,C];A=A?[j].concat(A):[j]}if(T>25){let j=[An.lookAhead,T];A=A?[j].concat(A):[j]}return new lr(S,E,k,_,A)}function y(S,E){let k=l.fork(),_=0,T=0,C=0,A=k.end-i,j={size:0,start:0,skip:0};e:for(let M=k.pos-S;k.pos>M;){let I=k.size;if(k.id==E&&I>=0){j.size=_,j.start=T,j.skip=C,C+=4,_+=4,k.next();continue}let $=k.pos-I;if(I<0||$=a?4:0,D=k.start;for(k.next();k.pos>$;){if(k.size<0)if(k.size==-3||k.size==-4)N+=4;else break e;else k.id>=a&&(N+=4);k.next()}T=D,_+=I,C+=N}return(E<0||_==S)&&(j.size=_,j.start=T,j.skip=C),j.size>4?j:void 0}function O(S,E,k){let{id:_,start:T,end:C,size:A}=l;if(l.next(),A>=0&&_4){let M=l.pos-(A-4);for(;l.pos>M;)k=O(S,E,k)}E[--k]=j,E[--k]=C-S,E[--k]=T-S,E[--k]=_}else A==-3?u=_:A==-4&&(d=_);return k}let v=[],x=[];for(;l.pos>0;)f(e.start||0,e.bufferStart||0,v,x,-1,0);let w=(t=e.length)!==null&&t!==void 0?t:v.length?x[0]+v[0].length:0;return new lr(c[e.topID],v.reverse(),x.reverse(),w)}const lY=new WeakMap;function mT(e,t){if(!e.isAnonymous||t instanceof Zp||t.type!=e)return 1;let n=lY.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof lr)){n=1;break}n+=mT(e,r)}lY.set(t,n)}return n}function sQ(e,t,n,r,i,s,a,l,c){let u=0;for(let g=r;g=d)break;E+=k}if(x==w+1){if(E>d){let k=g[w];m(k.children,k.positions,0,k.children.length,b[w]+v);continue}f.push(g[w])}else{let k=b[x-1]+g[x-1].length-S;f.push(sQ(e,g,b,w,x,S,k,null,c))}h.push(S+v-s)}}return m(t,n,r,i,0),(l||c)(f,h,a)}class aQ{constructor(){this.map=new WeakMap}setBuffer(t,n,r){let i=this.map.get(t);i||this.map.set(t,i=new Map),i.set(n,r)}getBuffer(t,n){let r=this.map.get(t);return r&&r.get(n)}set(t,n){t instanceof sd?this.setBuffer(t.context.buffer,t.index,n):t instanceof Ka&&this.map.set(t.tree,n)}get(t){return t instanceof sd?this.getBuffer(t.context.buffer,t.index):t instanceof Ka?this.map.get(t.tree):void 0}cursorSet(t,n){t.buffer?this.setBuffer(t.buffer.buffer,t.index,n):this.map.set(t.tree,n)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class Uf{constructor(t,n,r,i,s=!1,a=!1){this.from=t,this.to=n,this.tree=r,this.offset=i,this.open=(s?1:0)|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,n=[],r=!1){let i=[new Uf(0,t.length,t,0,!1,r)];for(let s of n)s.to>t.length&&i.push(s);return i}static applyChanges(t,n,r=128){if(!n.length)return t;let i=[],s=1,a=t.length?t[0]:null;for(let l=0,c=0,u=0;;l++){let d=l=r)for(;a&&a.from=h.from||f<=h.to||u){let m=Math.max(h.from,c)-u,g=Math.min(h.to,f)-u;h=m>=g?null:new Uf(m,g,h.tree,h.offset+u,l>0,!!d)}if(h&&i.push(h),a.to>f)break;a=snew Cc(i.from,i.to)):[new Cc(0,0)]:[new Cc(0,t.length)],this.createParse(t,n||[],r)}parse(t,n,r){let i=this.startParse(t,n,r);for(;;){let s=i.advance();if(s)return s}}}class Eht{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,n){return this.string.slice(t,n)}}function Ebe(e){return(t,n,r,i)=>new _ht(t,e,n,r,i)}class cY{constructor(t,n,r,i,s,a){this.parser=t,this.parse=n,this.overlay=r,this.bracketed=i,this.target=s,this.from=a}}function uY(e){if(!e.length||e.some(t=>t.from>=t.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(e))}class kht{constructor(t,n,r,i,s,a,l,c){this.parser=t,this.predicate=n,this.mounts=r,this.index=i,this.start=s,this.bracketed=a,this.target=l,this.prev=c,this.depth=0,this.ranges=[]}}const jL=new An({perNode:!0});class _ht{constructor(t,n,r,i,s){this.nest=n,this.input=r,this.fragments=i,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let r=this.baseParse.advance();if(!r)return null;if(this.baseParse=null,this.baseTree=r,this.startInner(),this.stoppedAt!=null)for(let i of this.inner)i.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let r=this.baseTree;return this.stoppedAt!=null&&(r=new lr(r.type,r.children,r.positions,r.length,r.propValues.concat([[jL,this.stoppedAt]]))),r}let t=this.inner[this.innerDone],n=t.parse.advance();if(n){this.innerDone++;let r=Object.assign(Object.create(null),t.target.props);r[An.mounted.id]=new Sy(n,t.overlay,t.parser,t.bracketed),t.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let n=this.innerDone;n=this.stoppedAt)l=!1;else if(t.hasNode(i)){if(n){let u=n.mounts.find(d=>d.frag.from<=i.from&&d.frag.to>=i.to&&d.mount.overlay);if(u)for(let d of u.mount.overlay){let f=d.from+u.pos,h=d.to+u.pos;f>=i.from&&h<=i.to&&!n.ranges.some(m=>m.fromf)&&n.ranges.push({from:f,to:h})}}l=!1}else if(r&&(a=Tht(r.ranges,i.from,i.to)))l=a!=2;else if(!i.type.isAnonymous&&(s=this.nest(i,this.input))&&(i.fromnew Cc(f.from-i.from,f.to-i.from)):null,!!s.bracketed,i.tree,d.length?d[0].from:i.from)),s.overlay?d.length&&(r={ranges:d,depth:0,prev:r}):l=!1}}else if(n&&(c=n.predicate(i))&&(c===!0&&(c=new Cc(i.from,i.to)),c.from=0&&n.ranges[u].to==c.from?n.ranges[u]={from:n.ranges[u].from,to:c.to}:n.ranges.push(c)}if(l&&i.firstChild())n&&n.depth++,r&&r.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(n&&!--n.depth){let u=hY(this.ranges,n.ranges);u.length&&(uY(u),this.inner.splice(n.index,0,new cY(n.parser,n.parser.startParse(this.input,pY(n.mounts,u),u),n.ranges.map(d=>new Cc(d.from-n.start,d.to-n.start)),n.bracketed,n.target,u[0].from))),n=n.prev}r&&!--r.depth&&(r=r.prev)}}}}function Tht(e,t,n){for(let r of e){if(r.from>=n)break;if(r.to>t)return r.from<=t&&r.to>=n?2:1}return 0}function dY(e,t,n,r,i,s){if(t=t&&n.enter(r,1,Ur.IgnoreOverlays|Ur.ExcludeBuffers)))if(n.to<=t)n.next(!1)||(this.done=!0);else break}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let n=this.cursor.tree;;){if(n==t.tree)return!0;if(n.children.length&&n.positions[0]==0&&n.children[0]instanceof lr)n=n.children[0];else break}return!1}}let Aht=class{constructor(t){var n;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let r=this.curFrag=t[0];this.curTo=(n=r.tree.prop(jL))!==null&&n!==void 0?n:r.to,this.inner=new fY(r.tree,-r.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let n=this.curFrag=this.fragments[this.fragI];this.curTo=(t=n.tree.prop(jL))!==null&&t!==void 0?t:n.to,this.inner=new fY(n.tree,-n.offset)}}findMounts(t,n){var r;let i=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let s=this.inner.cursor.node;s;s=s.parent){let a=(r=s.tree)===null||r===void 0?void 0:r.prop(An.mounted);if(a&&a.parser==n)for(let l=this.fragI;l=s.to)break;c.tree==this.curFrag.tree&&i.push({frag:c,pos:s.from-c.offset,mount:a})}}}return i}};function hY(e,t){let n=null,r=t;for(let i=1,s=0;i=l)break;c.to<=a||(n||(r=n=t.slice()),c.froml&&n.splice(s+1,0,new Cc(l,c.to))):c.to>l?n[s--]=new Cc(l,c.to):n.splice(s--,1))}}return r}function Nht(e,t,n,r){let i=0,s=0,a=!1,l=!1,c=-1e9,u=[];for(;;){let d=i==e.length?1e9:a?e[i].to:e[i].from,f=s==t.length?1e9:l?t[s].to:t[s].from;if(a!=l){let h=Math.max(c,n),m=Math.min(d,f,r);hnew Cc(h.from+r,h.to+r)),f=Nht(t,d,c,u);for(let h=0,m=c;;h++){let g=h==f.length,b=g?u:f[h].from;if(b>m&&n.push(new Uf(m,b,i.tree,-a,s.from>=m||s.openStart,s.to<=b||s.openEnd)),g)break;m=f[h].to}}else n.push(new Uf(c,u,i.tree,-a,s.from>=a||s.openStart,s.to<=l||s.openEnd))}return n}let RL=[],kbe=[];(()=>{let e="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(t=>t?parseInt(t,36):1);for(let t=0,n=0;t>1;if(e=kbe[r])t=r+1;else return!0;if(t==n)return!1}}function mY(e){return e>=127462&&e<=127487}const gY=8205;function Rht(e,t,n=!0,r=!0){return(n?_be:Iht)(e,t,r)}function _be(e,t,n){if(t==e.length)return t;t&&Tbe(e.charCodeAt(t))&&Cbe(e.charCodeAt(t-1))&&t--;let r=ID(e,t);for(t+=bY(r);t=0&&mY(ID(e,a));)s++,a-=2;if(s%2==0)break;t+=2}else break}return t}function Iht(e,t,n){for(;t>1;){let r=_be(e,t-2,n);if(r=56320&&e<57344}function Cbe(e){return e>=55296&&e<56320}function bY(e){return e<65536?1:2}let Br=class Abe{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,n,r){[t,n]=y1(this,t,n);let i=[];return this.decompose(0,t,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(n,this.length,i,1),Zu.from(i,this.length-(n-t)+r.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,n=this.length){[t,n]=y1(this,t,n);let r=[];return this.decompose(t,n,r,0),Zu.from(r,n-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let n=this.scanIdentical(t,1),r=this.length-this.scanIdentical(t,-1),i=new Hv(this),s=new Hv(t);for(let a=n,l=n;;){if(i.next(a),s.next(a),a=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(l+=i.value.length,i.done||l>=r)return!0}}iter(t=1){return new Hv(this,t)}iterRange(t,n=this.length){return new Nbe(this,t,n)}iterLines(t,n){let r;if(t==null)r=this.iter();else{n==null&&(n=this.lines+1);let i=this.line(t).from;r=this.iterRange(i,Math.max(i,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new jbe(r)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(t.length==0)throw new RangeError("A document must have at least one line");return t.length==1&&!t[0]?Abe.empty:t.length<=32?new Ss(t):Zu.from(Ss.split(t,[]))}};class Ss extends Br{constructor(t,n=Dht(t)){super(),this.text=t,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(t,n,r,i){for(let s=0;;s++){let a=this.text[s],l=i+a.length;if((n?r:l)>=t)return new Pht(i,l,r,a);i=l+1,r++}}decompose(t,n,r,i){let s=t<=0&&n>=this.length?this:new Ss(yY(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let a=r.pop(),l=gT(s.text,a.text.slice(),0,s.length);if(l.length<=32)r.push(new Ss(l,a.length+s.length));else{let c=l.length>>1;r.push(new Ss(l.slice(0,c)),new Ss(l.slice(c)))}}else r.push(s)}replace(t,n,r){if(!(r instanceof Ss))return super.replace(t,n,r);[t,n]=y1(this,t,n);let i=gT(this.text,gT(r.text,yY(this.text,0,t)),n),s=this.length+r.length-(n-t);return i.length<=32?new Ss(i,s):Zu.from(Ss.split(i,[]),s)}sliceString(t,n=this.length,r=` +`){[t,n]=y1(this,t,n);let i="";for(let s=0,a=0;s<=n&&at&&a&&(i+=r),ts&&(i+=l.slice(Math.max(0,t-s),n-s)),s=c+1}return i}flatten(t){for(let n of this.text)t.push(n)}scanIdentical(){return 0}static split(t,n){let r=[],i=-1;for(let s of t)r.push(s),i+=s.length+1,r.length==32&&(n.push(new Ss(r,i)),r=[],i=-1);return i>-1&&n.push(new Ss(r,i)),n}}class Zu extends Br{constructor(t,n){super(),this.children=t,this.length=n,this.lines=0;for(let r of t)this.lines+=r.lines}lineInner(t,n,r,i){for(let s=0;;s++){let a=this.children[s],l=i+a.length,c=r+a.lines-1;if((n?c:l)>=t)return a.lineInner(t,n,r,i);i=l+1,r=c+1}}decompose(t,n,r,i){for(let s=0,a=0;a<=n&&s=a){let u=i&((a<=t?1:0)|(c>=n?2:0));a>=t&&c<=n&&!u?r.push(l):l.decompose(t-a,n-a,r,u)}a=c+1}}replace(t,n,r){if([t,n]=y1(this,t,n),r.lines=s&&n<=l){let c=a.replace(t-s,n-s,r),u=this.lines-a.lines+c.lines;if(c.lines>4&&c.lines>u>>6){let d=this.children.slice();return d[i]=c,new Zu(d,this.length-(n-t)+r.length)}return super.replace(s,l,c)}s=l+1}return super.replace(t,n,r)}sliceString(t,n=this.length,r=` +`){[t,n]=y1(this,t,n);let i="";for(let s=0,a=0;st&&s&&(i+=r),ta&&(i+=l.sliceString(t-a,n-a,r)),a=c+1}return i}flatten(t){for(let n of this.children)n.flatten(t)}scanIdentical(t,n){if(!(t instanceof Zu))return 0;let r=0,[i,s,a,l]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;i+=n,s+=n){if(i==a||s==l)return r;let c=this.children[i],u=t.children[s];if(c!=u)return r+c.scanIdentical(u,n);r+=c.length+1}}static from(t,n=t.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let m of t)r+=m.lines;if(r<32){let m=[];for(let g of t)g.flatten(m);return new Ss(m,n)}let i=Math.max(32,r>>5),s=i<<1,a=i>>1,l=[],c=0,u=-1,d=[];function f(m){let g;if(m.lines>s&&m instanceof Zu)for(let b of m.children)f(b);else m.lines>a&&(c>a||!c)?(h(),l.push(m)):m instanceof Ss&&c&&(g=d[d.length-1])instanceof Ss&&m.lines+g.lines<=32?(c+=m.lines,u+=m.length+1,d[d.length-1]=new Ss(g.text.concat(m.text),g.length+1+m.length)):(c+m.lines>i&&h(),c+=m.lines,u+=m.length+1,d.push(m))}function h(){c!=0&&(l.push(d.length==1?d[0]:Zu.from(d,u)),u=-1,c=d.length=0)}for(let m of t)f(m);return h(),l.length==1?l[0]:new Zu(l,n)}}Br.empty=new Ss([""],0);function Dht(e){let t=-1;for(let n of e)t+=n.length+1;return t}function gT(e,t,n=0,r=1e9){for(let i=0,s=0,a=!0;s=n&&(c>r&&(l=l.slice(0,r-i)),i0?1:(t instanceof Ss?t.text.length:t.children.length)<<1]}nextInner(t,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],s=this.offsets[r],a=s>>1,l=i instanceof Ss?i.text.length:i.children.length;if(a==(n>0?l:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(n>0?0:1)){if(this.offsets[r]+=n,t==0)return this.lineBreak=!0,this.value=` +`,this;t--}else if(i instanceof Ss){let c=i.text[a+(n<0?-1:0)];if(this.offsets[r]+=n,c.length>Math.max(0,t))return this.value=t==0?c:n>0?c.slice(t):c.slice(0,c.length-t),this;t-=c.length}else{let c=i.children[a+(n<0?-1:0)];t>c.length?(t-=c.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(c),this.offsets.push(n>0?1:(c instanceof Ss?c.text.length:c.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class Nbe{constructor(t,n,r){this.value="",this.done=!1,this.cursor=new Hv(t,n>r?-1:1),this.pos=n>r?t.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(t,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;t>r&&(t=r),r-=t;let{value:i}=this.cursor.next(t);return this.pos+=(i.length+t)*n,this.value=i.length<=r?i:n<0?i.slice(i.length-r):i.slice(0,r),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class jbe{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:n,lineBreak:r,value:i}=this.inner.next(t);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Br.prototype[Symbol.iterator]=function(){return this.iter()},Hv.prototype[Symbol.iterator]=Nbe.prototype[Symbol.iterator]=jbe.prototype[Symbol.iterator]=function(){return this});let Pht=class{constructor(t,n,r,i){this.from=t,this.to=n,this.number=r,this.text=i}get length(){return this.to-this.from}};function y1(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function ma(e,t,n=!0,r=!0){return Rht(e,t,n,r)}function Mht(e){return e>=56320&&e<57344}function Lht(e){return e>=55296&&e<56320}function Qo(e,t){let n=e.charCodeAt(t);if(!Lht(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return Mht(r)?(n-55296<<10)+(r-56320)+65536:n}function oQ(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function Ku(e){return e<65536?1:2}const IL=/\r\n?|\n/;var Da=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(Da||(Da={}));class pd{constructor(t){this.sections=t}get length(){let t=0;for(let n=0;nt)return s+(t-i);s+=l}else{if(r!=Da.Simple&&u>=t&&(r==Da.TrackDel&&it||r==Da.TrackBefore&&it))return null;if(u>t||u==t&&n<0&&!l)return t==i||n<0?s:s+c;s+=c}i=u}if(t>i)throw new RangeError(`Position ${t} is out of range for changeset of length ${i}`);return s}touchesRange(t,n=t){for(let r=0,i=0;r=0&&i<=n&&l>=t)return in?"cover":!0;i=l}return!1}toString(){let t="";for(let n=0;n=0?":"+i:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new pd(t)}static create(t){return new pd(t)}}class Zs extends pd{constructor(t,n){super(t),this.inserted=n}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return DL(this,(n,r,i,s,a)=>t=t.replace(i,i+(r-n),a),!1),t}mapDesc(t,n=!1){return PL(this,t,n,!0)}invert(t){let n=this.sections.slice(),r=[];for(let i=0,s=0;i=0){n[i]=l,n[i+1]=a;let c=i>>1;for(;r.length0&&gp(r,n,s.text),s.forward(d),l+=d}let u=t[a++];for(;l>1].toJSON()))}return t}static of(t,n,r){let i=[],s=[],a=0,l=null;function c(d=!1){if(!d&&!i.length)return;ah||f<0||h>n)throw new RangeError(`Invalid change range ${f} to ${h} (in doc of length ${n})`);let g=m?typeof m=="string"?Br.of(m.split(r||IL)):m:Br.empty,b=g.length;if(f==h&&b==0)return;fa&&qa(i,f-a,-1),qa(i,h-f,b),gp(s,i,g),a=h}}return u(t),c(!l),l}static empty(t){return new Zs(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let i=0;il&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)n.push(s[0],0);else{for(;r.length=0&&n<=0&&n==e[i+1]?e[i]+=t:i>=0&&t==0&&e[i]==0?e[i+1]+=n:r?(e[i]+=t,e[i+1]+=n):e.push(t,n)}function gp(e,t,n){if(n.length==0)return;let r=t.length-2>>1;if(r>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)l=e.sections[a++],c=e.sections[a++];t(i,u,s,d,f),i=u,s=d}}}function PL(e,t,n,r=!1){let i=[],s=r?[]:null,a=new nS(e),l=new nS(t);for(let c=-1;;){if(a.done&&l.len||l.done&&a.len)throw new Error("Mismatched change set lengths");if(a.ins==-1&&l.ins==-1){let u=Math.min(a.len,l.len);qa(i,u,-1),a.forward(u),l.forward(u)}else if(l.ins>=0&&(a.ins<0||c==a.i||a.off==0&&(l.len=0&&c=0){let u=0,d=a.len;for(;d;)if(l.ins==-1){let f=Math.min(d,l.len);u+=f,d-=f,l.forward(f)}else if(l.ins==0&&l.lenc||a.ins>=0&&a.len>c)&&(l||r.length>u),s.forward2(c),a.forward(c)}}}}class nS{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i>1;return n>=t.length?Br.empty:t[n]}textBit(t){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!t?Br.empty:n[r].slice(this.off,t==null?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){this.ins==-1?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}class sp{constructor(t,n,r,i){this.from=t,this.to=n,this.flags=r,this.goalColumn=i}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 t=this.flags&7;return t==7?null:t}map(t,n=-1){let r,i;return this.empty?r=i=t.mapPos(this.from,n):(r=t.mapPos(this.from,1),i=t.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new sp(r,i,this.flags,this.goalColumn)}extend(t,n=t,r=0){if(t<=this.anchor&&n>=this.anchor)return tt.range(t,n,void 0,void 0,r);let i=Math.abs(t-this.anchor)>Math.abs(n-this.anchor)?t:n;return tt.range(this.anchor,i,void 0,void 0,r)}eq(t,n=!1){return this.anchor==t.anchor&&this.head==t.head&&this.goalColumn==t.goalColumn&&(!n||!this.empty||this.assoc==t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return tt.range(t.anchor,t.head)}static create(t,n,r,i){return new sp(t,n,r,i)}}class tt{constructor(t,n){this.ranges=t,this.mainIndex=n}map(t,n=-1){return t.empty?this:tt.create(this.ranges.map(r=>r.map(t,n)),this.mainIndex)}eq(t,n=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let r=0;rt.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!="number"||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new tt(t.ranges.map(n=>sp.fromJSON(n)),t.main)}static single(t,n=t){return new tt([tt.range(t,n)],0)}static create(t,n=0){if(t.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,i=0;ii.from-s.from),n=t.indexOf(r);for(let i=1;is.head?tt.range(c,l):tt.range(l,c))}}return new tt(t,n)}}function Ibe(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let lQ=0;class Qt{constructor(t,n,r,i,s){this.combine=t,this.compareInput=n,this.compare=r,this.isStatic=i,this.id=lQ++,this.default=t([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(t={}){return new Qt(t.combine||(n=>n),t.compareInput||((n,r)=>n===r),t.compare||(t.combine?(n,r)=>n===r:cQ),!!t.static,t.enables)}of(t){return new bT([],this,0,t)}compute(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new bT(t,this,1,n)}computeN(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new bT(t,this,2,n)}from(t,n){return n||(n=r=>r),this.compute([t],r=>n(r.field(t)))}}function cQ(e,t){return e==t||e.length==t.length&&e.every((n,r)=>n===t[r])}class bT{constructor(t,n,r,i){this.dependencies=t,this.facet=n,this.type=r,this.value=i,this.id=lQ++}dynamicSlot(t){var n;let r=this.value,i=this.facet.compareInput,s=this.id,a=t[s]>>1,l=this.type==2,c=!1,u=!1,d=[];for(let f of this.dependencies)f=="doc"?c=!0:f=="selection"?u=!0:((n=t[f.id])!==null&&n!==void 0?n:1)&1||d.push(t[f.id]);return{create(f){return f.values[a]=r(f),1},update(f,h){if(c&&h.docChanged||u&&(h.docChanged||h.selection)||ML(f,d)){let m=r(f);if(l?!OY(m,f.values[a],i):!i(m,f.values[a]))return f.values[a]=m,1}return 0},reconfigure:(f,h)=>{let m,g=h.config.address[s];if(g!=null){let b=hA(h,g);if(this.dependencies.every(y=>y instanceof Qt?h.facet(y)===f.facet(y):y instanceof Ba?h.field(y,!1)==f.field(y,!1):!0)||(l?OY(m=r(f),b,i):i(m=r(f),b)))return f.values[a]=b,0}else m=r(f);return f.values[a]=m,1}}}get extension(){return this}}function OY(e,t,n){if(e.length!=t.length)return!1;for(let r=0;re[c.id]),i=n.map(c=>c.type),s=r.filter(c=>!(c&1)),a=e[t.id]>>1;function l(c){let u=[];for(let d=0;dr===i),t);return t.provide&&(n.provides=t.provide(n)),n}create(t){let n=t.facet(B2).find(r=>r.field==this);return((n==null?void 0:n.create)||this.createF)(t)}slot(t){let n=t[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,i)=>{let s=r.values[n],a=this.updateF(s,i);return this.compareF(s,a)?0:(r.values[n]=a,1)},reconfigure:(r,i)=>{let s=r.facet(B2),a=i.facet(B2),l;return(l=s.find(c=>c.field==this))&&l!=a.find(c=>c.field==this)?(r.values[n]=l.create(r),1):i.config.address[this.id]!=null?(r.values[n]=i.field(this),0):(r.values[n]=this.create(r),1)}}}init(t){return[this,B2.of({field:this,create:t})]}get extension(){return this}}const Ym={lowest:4,low:3,default:2,high:1,highest:0};function hx(e){return t=>new Dbe(t,e)}const xh={highest:hx(Ym.highest),high:hx(Ym.high),default:hx(Ym.default),low:hx(Ym.low),lowest:hx(Ym.lowest)};class Dbe{constructor(t,n){this.inner=t,this.prec=n}get extension(){return this}}class Zj{of(t){return new LL(this,t)}reconfigure(t){return Zj.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class LL{constructor(t,n){this.compartment=t,this.inner=n}get extension(){return this}}class fA{constructor(t,n,r,i,s,a){for(this.base=t,this.compartments=n,this.dynamicSlots=r,this.address=i,this.staticValues=s,this.facets=a,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(t,n,r){let i=[],s=Object.create(null),a=new Map;for(let h of Bht(t,n,a))h instanceof Ba?i.push(h):(s[h.facet.id]||(s[h.facet.id]=[])).push(h);let l=Object.create(null),c=[],u=[];for(let h of i)l[h.id]=u.length<<1,u.push(m=>h.slot(m));let d=r==null?void 0:r.config.facets;for(let h in s){let m=s[h],g=m[0].facet,b=d&&d[h]||[];if(m.every(y=>y.type==0))if(l[g.id]=c.length<<1|1,cQ(b,m))c.push(r.facet(g));else{let y=g.combine(m.map(O=>O.value));c.push(r&&g.compare(y,r.facet(g))?r.facet(g):y)}else{for(let y of m)y.type==0?(l[y.id]=c.length<<1|1,c.push(y.value)):(l[y.id]=u.length<<1,u.push(O=>y.dynamicSlot(O)));l[g.id]=u.length<<1,u.push(y=>$ht(y,g,m))}}let f=u.map(h=>h(l));return new fA(t,a,f,l,c,s)}}function Bht(e,t,n){let r=[[],[],[],[],[]],i=new Map;function s(a,l){let c=i.get(a);if(c!=null){if(c<=l)return;let u=r[c].indexOf(a);u>-1&&r[c].splice(u,1),a instanceof LL&&n.delete(a.compartment)}if(i.set(a,l),Array.isArray(a))for(let u of a)s(u,l);else if(a instanceof LL){if(n.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let u=t.get(a.compartment)||a.inner;n.set(a.compartment,u),s(u,l)}else if(a instanceof Dbe)s(a.inner,a.prec);else if(a instanceof Ba)r[l].push(a),a.provides&&s(a.provides,l);else if(a instanceof bT)r[l].push(a),a.facet.extensions&&s(a.facet.extensions,Ym.default);else{let u=a.extension;if(!u)throw new Error(`Unrecognized extension value in extension set (${a}).`);if(u==a)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(u,l)}}return s(e,Ym.default),r.reduce((a,l)=>a.concat(l))}function qv(e,t){if(t&1)return 2;let n=t>>1,r=e.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;e.status[n]=4;let i=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|i}function hA(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}const Pbe=Qt.define(),$L=Qt.define({combine:e=>e.some(t=>t),static:!0}),Mbe=Qt.define({combine:e=>e.length?e[0]:void 0,static:!0}),Lbe=Qt.define(),$be=Qt.define(),Bbe=Qt.define(),Qbe=Qt.define({combine:e=>e.length?e[0]:!1});class jd{constructor(t,n){this.type=t,this.value=n}static define(){return new Qht}}class Qht{of(t){return new jd(this,t)}}class Uht{constructor(t){this.map=t}of(t){return new jn(this,t)}}class jn{constructor(t,n){this.type=t,this.value=n}map(t){let n=this.type.map(this.value,t);return n===void 0?void 0:n==this.value?this:new jn(this.type,n)}is(t){return this.type==t}static define(t={}){return new Uht(t.map||(n=>n))}static mapEffects(t,n){if(!t.length)return t;let r=[];for(let i of t){let s=i.map(n);s&&r.push(s)}return r}}jn.reconfigure=jn.define();jn.appendConfig=jn.define();class Us{constructor(t,n,r,i,s,a){this.startState=t,this.changes=n,this.selection=r,this.effects=i,this.annotations=s,this.scrollIntoView=a,this._doc=null,this._state=null,r&&Ibe(r,n.newLength),s.some(l=>l.type==Us.time)||(this.annotations=s.concat(Us.time.of(Date.now())))}static create(t,n,r,i,s,a){return new Us(t,n,r,i,s,a)}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(t){for(let n of this.annotations)if(n.type==t)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let n=this.annotation(Us.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]=="."))}}Us.time=jd.define();Us.userEvent=jd.define();Us.addToHistory=jd.define();Us.remote=jd.define();function Fht(e,t){let n=[];for(let r=0,i=0;;){let s,a;if(r=e[r]))s=e[r++],a=e[r++];else if(i=0;i--){let s=r[i](e);s instanceof Us?e=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Us?e=s[0]:e=Fbe(t,Ey(s),!1)}return e}function Vht(e){let t=e.startState,n=t.facet(Bbe),r=e;for(let i=n.length-1;i>=0;i--){let s=n[i](e);s&&Object.keys(s).length&&(r=Ube(r,BL(t,s,e.changes.newLength),!0))}return r==e?e:Us.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}const Hht=[];function Ey(e){return e==null?Hht:Array.isArray(e)?e:[e]}var Yi=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(Yi||(Yi={}));const qht=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let QL;try{QL=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Xht(e){if(QL)return QL.test(e);for(let t=0;t"€"&&(n.toUpperCase()!=n.toLowerCase()||qht.test(n)))return!0}return!1}function Ght(e){return t=>{if(!/\S/.test(t))return Yi.Space;if(Xht(t))return Yi.Word;for(let n=0;n-1)return Yi.Word;return Yi.Other}}class xr{constructor(t,n,r,i,s,a){this.config=t,this.doc=n,this.selection=r,this.values=i,this.status=t.statusTemplate.slice(),this.computeSlot=s,a&&(a._state=this);for(let l=0;li.set(u,c)),n=null),i.set(l.value.compartment,l.value.extension)):l.is(jn.reconfigure)?(n=null,r=l.value):l.is(jn.appendConfig)&&(n=null,r=Ey(r).concat(l.value));let s;n?s=t.startState.values.slice():(n=fA.resolve(r,i,this),s=new xr(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(c,u)=>u.reconfigure(c,this),null).values);let a=t.startState.facet($L)?t.newSelection:t.newSelection.asSingle();new xr(n,t.newDoc,a,s,(l,c)=>c.update(l,t),t)}replaceSelection(t){return typeof t=="string"&&(t=this.toText(t)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:t},range:tt.cursor(n.from+t.length)}))}changeByRange(t){let n=this.selection,r=t(n.ranges[0]),i=this.changes(r.changes),s=[r.range],a=Ey(r.effects);for(let l=1;la.spec.fromJSON(l,c)))}}return xr.create({doc:t.doc,selection:tt.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(t={}){let n=fA.resolve(t.extensions||[],new Map),r=t.doc instanceof Br?t.doc:Br.of((t.doc||"").split(n.staticFacet(xr.lineSeparator)||IL)),i=t.selection?t.selection instanceof tt?t.selection:tt.single(t.selection.anchor,t.selection.head):tt.single(0);return Ibe(i,r.length),n.staticFacet($L)||(i=i.asSingle()),new xr(n,r,i,n.dynamicSlots.map(()=>null),(s,a)=>a.create(s),null)}get tabSize(){return this.facet(xr.tabSize)}get lineBreak(){return this.facet(xr.lineSeparator)||` +`}get readOnly(){return this.facet(Qbe)}phrase(t,...n){for(let r of this.facet(xr.phrases))if(Object.prototype.hasOwnProperty.call(r,t)){t=r[t];break}return n.length&&(t=t.replace(/\$(\$|\d*)/g,(r,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>n.length?r:n[s-1]})),t}languageDataAt(t,n,r=-1){let i=[];for(let s of this.facet(Pbe))for(let a of s(this,n,r))Object.prototype.hasOwnProperty.call(a,t)&&i.push(a[t]);return i}charCategorizer(t){let n=this.languageDataAt("wordChars",t);return Ght(n.length?n[0]:"")}wordAt(t){let{text:n,from:r,length:i}=this.doc.lineAt(t),s=this.charCategorizer(t),a=t-r,l=t-r;for(;a>0;){let c=ma(n,a,!1);if(s(n.slice(c,a))!=Yi.Word)break;a=c}for(;le.length?e[0]:4});xr.lineSeparator=Mbe;xr.readOnly=Qbe;xr.phrases=Qt.define({compare(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length==r.length&&n.every(i=>e[i]==t[i])}});xr.languageData=Pbe;xr.changeFilter=Lbe;xr.transactionFilter=$be;xr.transactionExtender=Bbe;Zj.reconfigure=jn.define();function Rd(e,t,n={}){let r={};for(let i of e)for(let s of Object.keys(i)){let a=i[s],l=r[s];if(l===void 0)r[s]=a;else if(!(l===a||a===void 0))if(Object.hasOwnProperty.call(n,s))r[s]=n[s](l,a);else throw new Error("Config merge conflict for field "+s)}for(let i in t)r[i]===void 0&&(r[i]=t[i]);return r}class Kp{eq(t){return this==t}range(t,n=t){return rS.create(t,n,this)}}Kp.prototype.startSide=Kp.prototype.endSide=0;Kp.prototype.point=!1;Kp.prototype.mapMode=Da.TrackDel;function uQ(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}class rS{constructor(t,n,r){this.from=t,this.to=n,this.value=r}static create(t,n,r){return new rS(t,n,r)}}function UL(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class dQ{constructor(t,n,r,i){this.from=t,this.to=n,this.value=r,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(t,n,r,i=0){let s=r?this.to:this.from;for(let a=i,l=s.length;;){if(a==l)return a;let c=a+l>>1,u=s[c]-t||(r?this.value[c].endSide:this.value[c].startSide)-n;if(c==a)return u>=0?a:l;u>=0?l=c:a=c+1}}between(t,n,r,i){for(let s=this.findIndex(n,-1e9,!0),a=this.findIndex(r,1e9,!1,s);sm||h==m&&u.startSide>0&&u.endSide<=0)continue;(m-h||u.endSide-u.startSide)<0||(a<0&&(a=h),u.point&&(l=Math.max(l,m-h)),r.push(u),i.push(h-a),s.push(m-a))}return{mapped:r.length?new dQ(i,s,r,l):null,pos:a}}}class gr{constructor(t,n,r,i){this.chunkPos=t,this.chunk=n,this.nextLayer=r,this.maxPoint=i}static create(t,n,r,i){return new gr(t,n,r,i)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let n of this.chunk)t+=n.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:n=[],sort:r=!1,filterFrom:i=0,filterTo:s=this.length}=t,a=t.filter;if(n.length==0&&!a)return this;if(r&&(n=n.slice().sort(UL)),this.isEmpty)return n.length?gr.of(n):this;let l=new zbe(this,null,-1).goto(0),c=0,u=[],d=new sh;for(;l.value||c=0){let f=n[c++];d.addInner(f.from,f.to,f.value)||u.push(f)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||sl.to||s=s&&t<=s+a.length&&a.between(s,t-s,n-s,r)===!1)return}this.nextLayer.between(t,n,r)}}iter(t=0){return iS.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,n=0){return iS.from(t).goto(n)}static compare(t,n,r,i,s=-1){let a=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),l=n.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),c=xY(a,l,r),u=new px(a,c,s),d=new px(l,c,s);r.iterGaps((f,h,m)=>vY(u,f,d,h,m,i)),r.empty&&r.length==0&&vY(u,0,d,0,0,i)}static eq(t,n,r=0,i){i==null&&(i=999999999);let s=t.filter(d=>!d.isEmpty&&n.indexOf(d)<0),a=n.filter(d=>!d.isEmpty&&t.indexOf(d)<0);if(s.length!=a.length)return!1;if(!s.length)return!0;let l=xY(s,a),c=new px(s,l,0).goto(r),u=new px(a,l,0).goto(r);for(;;){if(c.to!=u.to||!FL(c.active,u.active)||c.point&&(!u.point||!uQ(c.point,u.point)))return!1;if(c.to>i)return!0;c.next(),u.next()}}static spans(t,n,r,i,s=-1){let a=new px(t,null,s).goto(n),l=n,c=a.openStart;for(;;){let u=Math.min(a.to,r);if(a.point){let d=a.activeForPoint(a.to),f=a.pointFroml&&(i.span(l,u,a.active,c),c=a.openEnd(u));if(a.to>r)return c+(a.point&&a.to>r?1:0);l=a.to,a.next()}}static of(t,n=!1){let r=new sh;for(let i of t instanceof rS?[t]:n?Wht(t):t)r.add(i.from,i.to,i.value);return r.finish()}static join(t){if(!t.length)return gr.empty;let n=t[t.length-1];for(let r=t.length-2;r>=0;r--)for(let i=t[r];i!=gr.empty;i=i.nextLayer)n=new gr(i.chunkPos,i.chunk,n,Math.max(i.maxPoint,n.maxPoint));return n}}gr.empty=new gr([],[],null,-1);function Wht(e){if(e.length>1)for(let t=e[0],n=1;n0)return e.slice().sort(UL);t=r}return e}gr.empty.nextLayer=gr.empty;class sh{finishChunk(t){this.chunks.push(new dQ(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,n,r){this.addInner(t,n,r)||(this.nextLayer||(this.nextLayer=new sh)).add(t,n,r)}addInner(t,n,r){let i=t-this.lastTo||r.startSide-this.last.endSide;if(i<=0&&(t-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return i<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=t,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-t)),!0)}addChunk(t,n){if((t-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(t);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+t,this.lastTo=n.to[r]+t,!0}finish(){return this.finishInner(gr.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let n=gr.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,n}}function xY(e,t,n){let r=new Map;for(let s of e)for(let a=0;a=this.minPoint)break}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=r&&i.push(new zbe(a,n,r,s));return i.length==1?i[0]:new iS(i)}get startSide(){return this.value?this.value.startSide:0}goto(t,n=-1e9){for(let r of this.heap)r.goto(t,n);for(let r=this.heap.length>>1;r>=0;r--)DD(this.heap,r);return this.next(),this}forward(t,n){for(let r of this.heap)r.forward(t,n);for(let r=this.heap.length>>1;r>=0;r--)DD(this.heap,r);(this.to-t||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),DD(this.heap,0)}}}function DD(e,t){for(let n=e[t];;){let r=(t<<1)+1;if(r>=e.length)break;let i=e[r];if(r+1=0&&(i=e[r+1],r++),n.compare(i)<0)break;e[r]=n,e[t]=i,t=r}}class px{constructor(t,n,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=iS.from(t,n,r)}goto(t,n=-1e9){return this.cursor.goto(t,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=n,this.openStart=-1,this.next(),this}forward(t,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(t,n)}removeActive(t){Q2(this.active,t),Q2(this.activeTo,t),Q2(this.activeRank,t),this.minActive=wY(this.active,this.activeTo)}addActive(t){let n=0,{value:r,to:i,rank:s}=this.cursor;for(;n0;)n++;U2(this.active,n,r),U2(this.activeTo,n,i),U2(this.activeRank,n,s),t&&U2(t,n,this.cursor.from),this.minActive=wY(this.active,this.activeTo)}next(){let t=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>t){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),r&&Q2(r,i)}else if(this.cursor.value)if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from=0&&r[i]=0&&!(this.activeRank[r]t||this.activeTo[r]==t&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(t){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>t;r--)n++;return n}}function vY(e,t,n,r,i,s){e.goto(t),n.goto(r);let a=r+i,l=r,c=r-t,u=!!s.boundChange;for(let d=!1;;){let f=e.to+c-n.to,h=f||e.endSide-n.endSide,m=h<0?e.to+c:n.to,g=Math.min(m,a);if(e.point||n.point?(e.point&&n.point&&uQ(e.point,n.point)&&FL(e.activeForPoint(e.to),n.activeForPoint(n.to))||s.comparePoint(l,g,e.point,n.point),d=!1):(d&&s.boundChange(l),g>l&&!FL(e.active,n.active)&&s.compareRange(l,g,e.active,n.active),u&&ga)break;l=m,h<=0&&e.next(),h>=0&&n.next()}}function FL(e,t){if(e.length!=t.length)return!1;for(let n=0;n=t;r--)e[r+1]=e[r];e[t]=n}function wY(e,t){let n=-1,r=1e9;for(let i=0;i=t)return i;if(i==e.length)break;s+=e.charCodeAt(i)==9?n-s%n:1,i=ma(e,i)}return r===!0?-1:e.length}const VL="ͼ",SY=typeof Symbol>"u"?"__"+VL:Symbol.for(VL),HL=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),EY=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Jp{constructor(t,n){this.rules=[];let{finish:r}=n||{};function i(a){return/^@/.test(a)?[a]:a.split(/,\s*/)}function s(a,l,c,u){let d=[],f=/^@(\w+)\b/.exec(a[0]),h=f&&f[1]=="keyframes";if(f&&l==null)return c.push(a[0]+";");for(let m in l){let g=l[m];if(/&/.test(m))s(m.split(/,\s*/).map(b=>a.map(y=>b.replace(/&/,y))).reduce((b,y)=>b.concat(y)),g,c);else if(g&&typeof g=="object"){if(!f)throw new RangeError("The value of a property ("+m+") should be a primitive value.");s(i(m),g,d,h)}else g!=null&&d.push(m.replace(/_.*/,"").replace(/[A-Z]/g,b=>"-"+b.toLowerCase())+": "+g+";")}(d.length||h)&&c.push((r&&!f&&!u?a.map(r):a).join(", ")+" {"+d.join(" ")+"}")}for(let a in t)s(i(a),t[a],this.rules)}getRules(){return this.rules.join(` +`)}static newName(){let t=EY[SY]||1;return EY[SY]=t+1,VL+t.toString(36)}static mount(t,n,r){let i=t[HL],s=r&&r.nonce;i?s&&i.setNonce(s):i=new Yht(t,s),i.mount(Array.isArray(n)?n:[n],t)}}let kY=new Map;class Yht{constructor(t,n){let r=t.ownerDocument||t,i=r.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let s=kY.get(r);if(s)return t[HL]=s;this.sheet=new i.CSSStyleSheet,kY.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],t[HL]=this}mount(t,n){let r=this.sheet,i=0,s=0;for(let a=0;a-1&&(this.modules.splice(c,1),s--,c=-1),c==-1){if(this.modules.splice(s++,0,l),r)for(let u=0;u",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Zht=typeof navigator<"u"&&/Mac/.test(navigator.platform),Kht=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ja=0;ja<10;ja++)em[48+ja]=em[96+ja]=String(ja);for(var ja=1;ja<=24;ja++)em[ja+111]="F"+ja;for(var ja=65;ja<=90;ja++)em[ja]=String.fromCharCode(ja+32),sS[ja]=String.fromCharCode(ja);for(var PD in em)sS.hasOwnProperty(PD)||(sS[PD]=em[PD]);function Jht(e){var t=Zht&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Kht&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?sS:em)[e.keyCode]||e.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function mi(){var e=arguments[0];typeof e=="string"&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];typeof i=="string"?e.setAttribute(r,i):i!=null&&(e[r]=i)}t++}for(;t2);var Bt={mac:CY||/Mac/.test(bo.platform),windows:/Win/.test(bo.platform),linux:/Linux|X11/.test(bo.platform),ie:Kj,ie_version:Hbe?qL.documentMode||6:GL?+GL[1]:XL?+XL[1]:0,gecko:_Y,gecko_version:_Y?+(/Firefox\/(\d+)/.exec(bo.userAgent)||[0,0])[1]:0,chrome:!!MD,chrome_version:MD?+MD[1]:0,ios:CY,android:/Android\b/.test(bo.userAgent),webkit:TY,webkit_version:TY?+(/\bAppleWebKit\/(\d+)/.exec(bo.userAgent)||[0,0])[1]:0,safari:WL,safari_version:WL?+(/\bVersion\/(\d+(\.\d+)?)/.exec(bo.userAgent)||[0,0])[1]:0,tabSize:qL.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function fQ(e,t){for(let n in e)n=="class"&&t.class?t.class+=" "+e.class:n=="style"&&t.style?t.style+=";"+e.style:t[n]=e[n];return t}const pA=Object.create(null);function hQ(e,t,n){if(e==t)return!0;e||(e=pA),t||(t=pA);let r=Object.keys(e),i=Object.keys(t);if(r.length-0!=i.length-0)return!1;for(let s of r)if(s!=n&&(i.indexOf(s)==-1||e[s]!==t[s]))return!1;return!0}function ept(e,t){for(let n=e.attributes.length-1;n>=0;n--){let r=e.attributes[n].name;t[r]==null&&e.removeAttribute(r)}for(let n in t){let r=t[n];n=="style"?e.style.cssText=r:e.getAttribute(n)!=r&&e.setAttribute(n,r)}}function AY(e,t,n){let r=!1;if(t)for(let i in t)n&&i in n||(r=!0,i=="style"?e.style.cssText="":e.removeAttribute(i));if(n)for(let i in n)t&&t[i]==n[i]||(r=!0,i=="style"?e.style.cssText=n[i]:e.setAttribute(i,n[i]));return r}function tpt(e){let t=Object.create(null);for(let n=0;n0?3e8:-4e8:n>0?1e8:-1e8,new Gg(t,n,n,r,t.widget||null,!1)}static replace(t){let n=!!t.block,r,i;if(t.isBlockGap)r=-5e8,i=4e8;else{let{start:s,end:a}=qbe(t,n);r=(s?n?-3e8:-1:5e8)-1,i=(a?n?2e8:1:-6e8)+1}return new Gg(t,r,i,n,t.widget||null,!0)}static line(t){return new BE(t)}static set(t,n=!1){return gr.of(t,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}ln.none=gr.empty;class $E extends ln{constructor(t){let{start:n,end:r}=qbe(t);super(n?-1:5e8,r?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?fQ(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||pA}eq(t){return this==t||t instanceof $E&&this.tagName==t.tagName&&hQ(this.attrs,t.attrs)}range(t,n=t){if(t>=n)throw new RangeError("Mark decorations may not be empty");return super.range(t,n)}}$E.prototype.point=!1;class BE extends ln{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof BE&&this.spec.class==t.spec.class&&hQ(this.spec.attributes,t.spec.attributes)}range(t,n=t){if(n!=t)throw new RangeError("Line decoration ranges must be zero-length");return super.range(t,n)}}BE.prototype.mapMode=Da.TrackBefore;BE.prototype.point=!0;class Gg extends ln{constructor(t,n,r,i,s,a){super(n,r,s,t),this.block=i,this.isReplace=a,this.mapMode=i?n<=0?Da.TrackBefore:Da.TrackAfter:Da.TrackDel}get type(){return this.startSide!=this.endSide?$a.WidgetRange:this.startSide<=0?$a.WidgetBefore:$a.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof Gg&&npt(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(t,n=t){if(this.isReplace&&(t>n||t==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(t,n)}}Gg.prototype.point=!0;function qbe(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return n==null&&(n=e.inclusive),r==null&&(r=e.inclusive),{start:n??t,end:r??t}}function npt(e,t){return e==t||!!(e&&t&&e.compare(t))}function ky(e,t,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=e?n[i]=Math.max(n[i],t):n.push(e,t)}class aS extends Kp{constructor(t,n,r){super(),this.tagName=t,this.attributes=n,this.rank=r}eq(t){return t==this||t instanceof aS&&this.tagName==t.tagName&&hQ(this.attributes,t.attributes)}static create(t){return new aS(t.tagName,t.attributes||pA,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(t,n=!1){return gr.of(t,n)}}aS.prototype.startSide=aS.prototype.endSide=-1;function oS(e){let t;return e.nodeType==11?t=e.getSelection?e:e.ownerDocument:t=e,t.getSelection()}function YL(e,t){return t?e==t||e.contains(t.nodeType!=1?t.parentNode:t):!1}function Xv(e,t){if(!t.anchorNode)return!1;try{return YL(e,t.anchorNode)}catch{return!1}}function Gv(e){return e.nodeType==3?cS(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function Wv(e,t,n,r){return n?NY(e,t,n,r,-1)||NY(e,t,n,r,1):!1}function tm(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function mA(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function NY(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:ah(e))){if(e.nodeName=="DIV")return!1;let s=e.parentNode;if(!s||s.nodeType!=1)return!1;t=tm(e)+(i<0?0:1),e=s}else if(e.nodeType==1){if(e=e.childNodes[t+(i<0?-1:0)],e.nodeType==1&&e.contentEditable=="false")return!1;t=i<0?ah(e):0}else return!1}}function ah(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function lS(e,t){let{left:n,right:r}=e;if(n==r)return e;let i=t?n:r;return{left:i,right:i,top:e.top,bottom:e.bottom}}function rpt(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function Xbe(e,t){let n=t.width/e.offsetWidth,r=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(t.height-e.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function ipt(e,t,n,r,i,s,a,l){let c=e.ownerDocument,u=c.defaultView||window;for(let d=e,f=!1;d&&!f;)if(d.nodeType==1){let h,m=d==c.body,g=1,b=1;if(m)h=rpt(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(d).position)&&(f=!0),d.scrollHeight<=d.clientHeight&&d.scrollWidth<=d.clientWidth){d=d.assignedSlot||d.parentNode;continue}let v=d.getBoundingClientRect();({scaleX:g,scaleY:b}=Xbe(d,v)),h={left:v.left,right:v.left+d.clientWidth*g,top:v.top,bottom:v.top+d.clientHeight*b}}let y=0,O=0;if(i=="nearest")t.top0&&t.bottom>h.bottom+O&&(O=t.bottom-h.bottom+a)):t.bottom>h.bottom-a&&(O=t.bottom-h.bottom+a,n<0&&t.top-O0&&t.right>h.right+y&&(y=t.right-h.right+s)):t.right>h.right-s&&(y=t.right-h.right+s,n<0&&t.lefth.bottom||t.lefth.right)&&(t={left:Math.max(t.left,h.left),right:Math.min(t.right,h.right),top:Math.max(t.top,h.top),bottom:Math.min(t.bottom,h.bottom)}),d=d.assignedSlot||d.parentNode}else if(d.nodeType==11)d=d.host;else break}function Gbe(e,t=!0){let n=e.ownerDocument,r=null,i=null;for(let s=e.parentNode;s&&!(s==n.body||(!t||r)&&i);)if(s.nodeType==1)!i&&s.scrollHeight>s.clientHeight&&(i=s),t&&!r&&s.scrollWidth>s.clientWidth&&(r=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:r,y:i}}class spt{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:n,focusNode:r}=t;this.set(n,Math.min(t.anchorOffset,n?ah(n):0),r,Math.min(t.focusOffset,r?ah(r):0))}set(t,n,r,i){this.anchorNode=t,this.anchorOffset=n,this.focusNode=r,this.focusOffset=i}}let qm=null;Bt.safari&&Bt.safari_version>=26&&(qm=!1);function Wbe(e){if(e.setActive)return e.setActive();if(qm)return e.focus(qm);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(qm==null?{get preventScroll(){return qm={preventScroll:!0},!0}}:void 0),!qm){qm=!1;for(let n=0;nMath.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4):e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function Zbe(e,t){for(let n=e,r=t;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=ah(n)}else if(n.parentNode&&!mA(n))r=tm(n),n=n.parentNode;else return null}}function Kbe(e,t){for(let n=e,r=t;;){if(n.nodeType==3&&r=n){if(l.level==r)return a;(s<0||(i!=0?i<0?l.fromn:t[s].level>l.level))&&(s=a)}}if(s<0)throw new RangeError("Index out of range");return s}}function tye(e,t){if(e.length!=t.length)return!1;for(let n=0;n=0;b-=3)if(Uu[b+1]==-m){let y=Uu[b+2],O=y&2?i:y&4?y&1?s:i:0;O&&(vi[f]=vi[Uu[b]]=O),l=b;break}}else{if(Uu.length==189)break;Uu[l++]=f,Uu[l++]=h,Uu[l++]=c}else if((g=vi[f])==2||g==1){let b=g==i;c=b?0:1;for(let y=l-3;y>=0;y-=3){let O=Uu[y+2];if(O&2)break;if(b)Uu[y+2]|=2;else{if(O&4)break;Uu[y+2]|=4}}}}}function hpt(e,t,n,r){for(let i=0,s=r;i<=n.length;i++){let a=i?n[i-1].to:e,l=ic;)g==y&&(g=n[--b].from,y=b?n[b-1].to:e),vi[--g]=m;c=d}else s=u,c++}}}function KL(e,t,n,r,i,s,a){let l=r%2?2:1;if(r%2==i%2)for(let c=t,u=0;cc&&a.push(new ad(c,b.from,m));let y=b.direction==Wg!=!(m%2);JL(e,y?r+1:r,i,b.inner,b.from,b.to,a),c=b.to}g=b.to}else{if(g==n||(d?vi[g]!=l:vi[g]==l))break;g++}h?KL(e,c,g,r+1,i,h,a):ct;){let d=!0,f=!1;if(!u||c>s[u-1].to){let b=vi[c-1];b!=l&&(d=!1,f=b==16)}let h=!d&&l==1?[]:null,m=d?r:r+1,g=c;e:for(;;)if(u&&g==s[u-1].to){if(f)break e;let b=s[--u];if(!d)for(let y=b.from,O=u;;){if(y==t)break e;if(O&&s[O-1].to==y)y=s[--O].from;else{if(vi[y-1]==l)break e;break}}if(h)h.push(b);else{b.tovi.length;)vi[vi.length]=256;let r=[],i=t==Wg?0:1;return JL(e,i,i,n,0,e.length,r),r}function nye(e){return[new ad(0,e,0)]}let rye="";function mpt(e,t,n,r,i){var s;let a=r.head-e.from,l=ad.find(t,a,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),c=t[l],u=c.side(i,n);if(a==u){let h=l+=i?1:-1;if(h<0||h>=t.length)return null;c=t[l=h],a=c.side(!i,n),u=c.side(i,n)}let d=ma(e.text,a,c.forward(i,n));(dc.to)&&(d=u),rye=e.text.slice(Math.min(a,d),Math.max(a,d));let f=l==(i?t.length-1:0)?null:t[l+(i?1:-1)];return f&&d==u&&f.level+(i?0:1)e.some(t=>t)}),dye=Qt.define({combine:e=>e.some(t=>t)}),fye=Qt.define();class Ty{constructor(t,n,r,i,s,a=!1){this.range=t,this.y=n,this.x=r,this.yMargin=i,this.xMargin=s,this.isSnapshot=a}map(t){return t.empty?this:new Ty(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new Ty(tt.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const F2=jn.define({map:(e,t)=>e.map(t)}),hye=jn.define();function Xo(e,t,n){let r=e.facet(oye);r.length?r[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+":",t):console.error(t))}const xf=Qt.define({combine:e=>e.length?e[0]:!0});let bpt=0;const Kb=Qt.define({combine(e){return e.filter((t,n)=>{for(let r=0;r{let c=[];return a&&c.push(Jj.of(u=>{let d=u.plugin(l);return d?a(d):ln.none})),s&&c.push(s(l)),c})}static fromClass(t,n){return ms.define((r,i)=>new t(r,i),n)}}class LD{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(t){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(Xo(n.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(t,this.spec.arg)}catch(n){Xo(t.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){Xo(t.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const pye=Qt.define(),bQ=Qt.define(),Jj=Qt.define(),mye=Qt.define(),yQ=Qt.define(),QE=Qt.define(),gye=Qt.define();function RY(e,t){let n=e.state.facet(gye);if(!n.length)return n;let r=n.map(s=>s instanceof Function?s(e):s),i=[];return gr.spans(r,t.from,t.to,{point(){},span(s,a,l,c){let u=s-t.from,d=a-t.from,f=i;for(let h=l.length-1;h>=0;h--,c--){let m=l[h].spec.bidiIsolate,g;if(m==null&&(m=gpt(t.text,u,d)),c>0&&f.length&&(g=f[f.length-1]).to==u&&g.direction==m)g.to=d,f=g.inner;else{let b={from:u,to:d,direction:m,inner:[]};f.push(b),f=b.inner}}}}),i}const bye=Qt.define();function OQ(e){let t=0,n=0,r=0,i=0;for(let s of e.state.facet(bye)){let a=s(e);a&&(a.left!=null&&(t=Math.max(t,a.left)),a.right!=null&&(n=Math.max(n,a.right)),a.top!=null&&(r=Math.max(r,a.top)),a.bottom!=null&&(i=Math.max(i,a.bottom)))}return{left:t,right:n,top:r,bottom:i}}const Kx=Qt.define();class Ac{constructor(t,n,r,i){this.fromA=t,this.toA=n,this.fromB=r,this.toB=i}join(t){return new Ac(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let n=t.length,r=this;for(;n>0;n--){let i=t[n-1];if(!(i.fromA>r.toA)){if(i.toAi.push(new Ac(s,a,l,c))),this.changedRanges=i}static create(t,n,r){return new gA(t,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const ypt=[];class ps{constructor(t,n,r=0){this.dom=t,this.length=n,this.flags=r,this.parent=null,t.cmTile=this}get breakAfter(){return this.flags&1}get children(){return ypt}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(t){if(this.flags|=2,this.flags&4){this.flags&=-5;let n=this.domAttrs;n&&ept(this.dom,n)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(t){this.dom=t,t.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t,n=this.posAtStart){let r=n;for(let i of this.children){if(i==t)return r;r+=i.length+i.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(t){return this.posBefore(t)+t.length}covers(t){return!0}coordsIn(t,n,r){return null}domPosFor(t,n){let r=tm(this.dom),i=this.length?t>0:n>0;return new hu(this.parent.dom,r+(i?1:0),t==0||t==this.length)}markDirty(t){this.flags&=-3,t&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let t=this;t;t=t.parent)if(t instanceof tR)return t;return null}static get(t){return t.cmTile}}class eR extends ps{constructor(t){super(t,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(t){this.children.push(t),t.parent=this}sync(t){if(this.flags&2)return;super.sync(t);let n=this.dom,r=null,i,s=(t==null?void 0:t.node)==n?t:null,a=0;for(let l of this.children){if(l.sync(t),a+=l.length+l.breakAfter,i=r?r.nextSibling:n.firstChild,s&&i!=l.dom&&(s.written=!0),l.dom.parentNode==n)for(;i&&i!=l.dom;)i=IY(i);else n.insertBefore(l.dom,i);r=l.dom}for(i=r?r.nextSibling:n.firstChild,s&&i&&(s.written=!0);i;)i=IY(i);this.length=a}}function IY(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class tR extends eR{constructor(t,n){super(n),this.view=t}owns(t){for(;t;t=t.parent)if(t==this)return!0;return!1}isBlock(){return!0}nearest(t){for(;;){if(!t)return null;let n=ps.get(t);if(n&&this.owns(n))return n;t=t.parentNode}}blockTiles(t){for(let n=[],r=this,i=0,s=0;;)if(i==r.children.length){if(!n.length)return;r=r.parent,r.breakAfter&&s++,i=n.pop()}else{let a=r.children[i++];if(a instanceof Ff)n.push(i),r=a,i=0;else{let l=s+a.length,c=t(a,s);if(c!==void 0)return c;s=l+a.breakAfter}}}resolveBlock(t,n){let r,i=-1,s,a=-1;if(this.blockTiles((l,c)=>{let u=c+l.length;if(t>=c&&t<=u){if(l.isWidget()&&n>=-1&&n<=1){if(l.flags&32)return!0;l.flags&16&&(r=void 0)}(ct||t==c&&(n>1?l.length:l.covers(-1)))&&(!s||!l.isWidget()&&s.isWidget())&&(s=l,a=t-c)}}),!r&&!s)throw new Error("No tile at position "+t);return r&&n<0||!s?{tile:r,offset:i}:{tile:s,offset:a}}}class Ff extends eR{constructor(t,n){super(t),this.wrapper=n}isBlock(){return!0}covers(t){return this.children.length?t<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(t,n){let r=new Ff(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}}class O1 extends eR{constructor(t,n){super(t),this.attrs=n}isLine(){return!0}static start(t,n,r){let i=new O1(n||document.createElement("div"),t);return(!n||!r)&&(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(t,n,r){let i=null,s=-1,a=null,l=-1;function c(d,f){for(let h=0,m=0;h=f&&(g.isComposite()?c(g,f-m):(!a||a.isHidden&&(n>0&&!(a.flags&32)||r&&xpt(a,g)))&&(b>f||g.flags&32)?(a=g,l=f-m):(mi&&(t=i);let s=t,a=t,l=0;t==0&&n<0||t==i&&n>=0?Bt.chrome||Bt.gecko||(t?(s--,l=1):a=0)?0:c.length-1];return Bt.safari&&!l&&u.width==0&&(u=Array.prototype.find.call(c,d=>d.width)||u),r==null?u:lS(u,(l?l>0:n<0)==r)}static of(t,n){let r=new cg(n||document.createTextNode(t),t);return n||(r.flags|=2),r}}class Yg extends ps{constructor(t,n,r,i){super(t,n,i),this.widget=r}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(t){return this.flags&48?!1:(this.flags&(t<0?64:128))>0}coordsIn(t,n){return this.coordsInWidget(t,n,!1)}coordsInWidget(t,n,r){let i=this.widget.coordsAt(this.dom,t,n);if(i)return i;if(r)return lS(this.dom.getBoundingClientRect(),this.length?t==0:n<=0);{let s=this.dom.getClientRects(),a=null;if(!s.length)return null;let l=this.flags&16?!0:this.flags&32?!1:t>0;for(let c=l?s.length-1:0;a=s[c],!(t>0?c==0:c==s.length-1||a.top0==r)}}class vpt{constructor(t){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=t}advance(t,n,r){let{tile:i,index:s,beforeBreak:a,parents:l}=this;for(;t||n>0;)if(i.isComposite())if(a){if(!t)break;r&&r.break(),t--,a=!1}else if(s==i.children.length){if(!t&&!l.length)break;r&&r.leave(i),a=!!i.breakAfter,{tile:i,index:s}=l.pop(),s++}else{let c=i.children[s],u=c.breakAfter;(n>0?c.length<=t:c.length=0;l--){let c=n.marks[l],u=i.lastChild;if(u instanceof zo&&u.mark.eq(c.mark))u.dom!=c.dom&&u.setDOM($D(c.dom)),i=u;else{if(this.cache.reused.get(c)){let f=ps.get(c.dom);f&&f.setDOM($D(c.dom))}let d=zo.of(c.mark,c.dom);i.append(d),i=d}this.cache.reused.set(c,2)}let s=ps.get(t.text);s&&this.cache.reused.set(s,2);let a=new cg(t.text,t.text.nodeValue);a.flags|=8,this.pos=t.range.toB,i.append(a)}addInlineWidget(t,n,r){let i=this.afterWidget&&t.flags&48&&(this.afterWidget.flags&48)==(t.flags&48);i||this.flushBuffer();let s=this.ensureMarks(n,r);!i&&!(t.flags&16)&&s.append(this.getBuffer(1)),s.append(t),this.pos+=t.length,this.afterWidget=t}addMark(t,n,r){this.flushBuffer(),this.ensureMarks(n,r).append(t),this.pos+=t.length,this.afterWidget=null}addBlockWidget(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}continueWidget(t){let n=this.afterWidget||this.lastBlock;n.length+=t,this.pos+=t}addLineStart(t,n){var r;t||(t=yye);let i=O1.start(t,n||((r=this.cache.find(O1))===null||r===void 0?void 0:r.dom),!!n);this.getBlockPos().append(this.lastBlock=this.curLine=i)}addLine(t){this.getBlockPos().append(t),this.pos+=t.length,this.lastBlock=t,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(t){this.blockPosCovered()||this.addLineStart(t)}ensureLine(t){this.curLine||this.addLineStart(t)}ensureMarks(t,n){var r;let i=this.curLine;for(let s=t.length-1;s>=0;s--){let a=t[s],l;if(n>0&&(l=i.lastChild)&&l instanceof zo&&l.mark.eq(a))i=l,n--;else{let c=zo.of(a,(r=this.cache.find(zo,u=>u.mark.eq(a)))===null||r===void 0?void 0:r.dom);i.append(c),i=c,n=0}}return i}endLine(){if(this.curLine){this.flushBuffer();let t=this.curLine.lastChild;(!t||!DY(this.curLine,!1)||t.dom.nodeName!="BR"&&t.isWidget()&&!(Bt.ios&&DY(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(BD,0,32)||new Yg(BD.toDOM(),0,BD,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let t=this.wrappers.length-1;t>=0;t--)this.wrappers[t].to=this.pos){let n=t.rank*102+t.value.rank,r=new wpt(t.from,t.to,t.value,n),i=this.wrappers.length;for(;i>0&&(this.wrappers[i-1].rank-r.rank||this.wrappers[i-1].to-r.to)<0;)i--;this.wrappers.splice(i,0,r)}this.wrapperPos=this.pos}getBlockPos(){var t;this.updateBlockWrappers();let n=this.root;for(let r of this.wrappers){let i=n.lastChild;if(r.froma.wrapper.eq(r.wrapper)))===null||t===void 0?void 0:t.dom);n.append(s),n=s}}return n}blockPosCovered(){let t=this.lastBlock;return t!=null&&!t.breakAfter&&(!t.isWidget()||(t.flags&160)>0)}getBuffer(t){let n=2|(t<0?16:32),r=this.cache.find(bA,void 0,1);return r&&(r.flags=n),r||new bA(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class Ept{constructor(t){this.skipCount=0,this.text="",this.textOff=0,this.cursor=t.iter()}skip(t){this.textOff+t<=this.text.length?this.textOff+=t:(this.skipCount+=t-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(t){if(this.textOff==this.text.length){let{value:i,lineBreak:s,done:a}=this.cursor.next(this.skipCount);if(this.skipCount=0,a)throw new Error("Ran out of text content when drawing inline views");this.text=i;let l=this.textOff=Math.min(t,i.length);return s?null:i.slice(0,l)}let n=Math.min(this.text.length,this.textOff+t),r=this.text.slice(this.textOff,n);return this.textOff=n,r}}const yA=[Yg,O1,cg,zo,bA,Ff,tR];for(let e=0;e[]),this.index=yA.map(()=>0),this.reused=new Map}add(t){let n=t.constructor.bucket,r=this.buckets[n];r.length<6?r.push(t):r[this.index[n]=(this.index[n]+1)%6]=t}find(t,n,r=2){let i=t.bucket,s=this.buckets[i],a=this.index[i];for(let l=0;l{if(this.cache.add(a),a.isComposite())return!1},enter:a=>this.cache.add(a),leave:()=>{},break:()=>{}}}run(t,n){let r=n&&this.getCompositionContext(n.text);for(let i=0,s=0,a=0;;){let l=ai){let u=c-i;this.preserve(u,!a,!l),i=c,s+=u}if(!l)break;n&&l.fromA<=n.range.fromA&&l.toA>=n.range.toA?(this.forward(l.fromA,n.range.fromA,n.range.fromA{if(a.isWidget())if(this.openWidget)this.builder.continueWidget(c-l);else{let u=c>0||l{a.isLine()?this.builder.addLineStart(a.attrs,this.cache.maybeReuse(a)):(this.cache.add(a),a instanceof zo&&i.unshift(a.mark)),this.openWidget=!1},leave:a=>{a.isLine()?i.length&&(i.length=s=0):a instanceof zo&&(i.shift(),s=Math.min(s,i.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(t)}emit(t,n){let r=null,i=this.builder,s=-1,a=gr.spans(this.decorations,t,n,{point:(l,c,u,d,f,h)=>{if(u instanceof Gg){if(this.disallowBlockEffectsFor[h]){if(u.block)throw new RangeError("Block decorations may not be specified via plugins");if(c>this.view.state.doc.lineAt(l).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(s=d.length,f>d.length)i.continueWidget(c-l);else{let m=u.widget||(u.block?x1.block:x1.inline),g=Tpt(u),b=this.cache.findWidget(m,c-l,g)||Yg.of(m,this.view,c-l,g);u.block?(u.startSide>0&&i.addLineStartIfNotCovered(r),i.addBlockWidget(b)):(i.ensureLine(r),i.addInlineWidget(b,d,f))}r=null}else r=Cpt(r,u);c>l&&this.text.skip(c-l)},span:(l,c,u,d)=>{for(let f=l;f-1&&(this.openWidget=a>s),this.openWidget||i.addLineStartIfNotCovered(r),this.openMarks=a}forward(t,n,r=1){n-t<=10?this.old.advance(n-t,r,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(n-t-10,-1),this.old.advance(5,r,this.reuseWalker))}getCompositionContext(t){let n=[],r=null;for(let i=t.parentNode;;i=i.parentNode){let s=ps.get(i);if(i==this.view.contentDOM)break;s instanceof zo?n.push(s):s!=null&&s.isLine()?r=s:s instanceof Ff||(i.nodeName=="DIV"&&!r&&i!=this.view.contentDOM?r=new O1(i,yye):r||n.push(zo.of(new $E({tagName:i.nodeName.toLowerCase(),attributes:tpt(i)}),i)))}return{line:r,marks:n}}}function DY(e,t){let n=r=>{for(let i of r.children)if((t?i.isText():i.length)||n(i))return!0;return!1};return n(e)}function Tpt(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;return e.block&&(t|=256),t}const yye={class:"cm-line"};function Cpt(e,t){let n=t.spec.attributes,r=t.spec.class;return!n&&!r||(e||(e={class:"cm-line"}),n&&fQ(n,e),r&&(e.class+=" "+r)),e}function Apt(e){let t=[];for(let n=e.parents.length;n>1;n--){let r=n==e.parents.length?e.tile:e.parents[n].tile;r instanceof zo&&t.push(r.mark)}return t}function $D(e){let t=ps.get(e);return t&&t.setDOM(e.cloneNode()),e}class x1 extends Ru{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}x1.inline=new x1("span");x1.block=new x1("div");const BD=new class extends Ru{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class PY{constructor(t){this.view=t,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=ln.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new tR(t,t.contentDOM),this.updateInner([new Ac(0,0,0,t.state.doc.length)],null)}update(t){var n;let r=t.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:d,toA:f})=>fthis.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(t);let i=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?i=this.domChanged.newSel.head:!$pt(t.changes,this.hasComposition)&&!t.selectionSet&&(i=t.state.selection.main.head));let s=i>-1?jpt(this.view,t.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:d,to:f}=this.hasComposition;r=new Ac(d,f,t.changes.mapPos(d,-1),t.changes.mapPos(f,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(Bt.ie||Bt.chrome)&&!s&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,l=this.blockWrappers;this.updateDeco();let c=Dpt(a,this.decorations,t.changes);c.length&&(r=Ac.extendWithRanges(r,c));let u=Mpt(l,this.blockWrappers,t.changes);return u.length&&(r=Ac.extendWithRanges(r,u)),s&&!r.some(d=>d.fromA<=s.range.fromA&&d.toA>=s.range.toA)&&(r=s.range.addToSet(r.slice())),this.tile.flags&2&&r.length==0?!1:(this.updateInner(r,s),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,n){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(n||t.length){let a=this.tile,l=new _pt(this.view,a,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&ps.get(n.text)&&l.cache.reused.set(ps.get(n.text),2),this.tile=l.run(t,n),t6(a,l.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let s=Bt.chrome||Bt.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(s),s&&(s.written||r.selectionRange.focusNode!=s.node||!this.tile.dom.contains(s.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let i=[];if(this.view.viewport.from||this.view.viewport.to-1)&&Xv(r,this.view.observer.selectionRange)&&!(i&&r.contains(i));if(!(s||n||a))return;let l=this.forceSelection;this.forceSelection=!1;let c=this.view.state.selection.main,u,d;if(c.empty?d=u=this.inlineDOMNearPos(c.anchor,c.assoc||1):(d=this.inlineDOMNearPos(c.head,c.head==c.from?1:-1),u=this.inlineDOMNearPos(c.anchor,c.anchor==c.from?1:-1)),Bt.gecko&&c.empty&&!this.hasComposition&&Npt(u)){let h=document.createTextNode("");this.view.observer.ignore(()=>u.node.insertBefore(h,u.node.childNodes[u.offset]||null)),u=d=new hu(h,0),l=!0}let f=this.view.observer.selectionRange;(l||!f.focusNode||(!Wv(u.node,u.offset,f.anchorNode,f.anchorOffset)||!Wv(d.node,d.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,c))&&(this.view.observer.ignore(()=>{Bt.android&&Bt.chrome&&r.contains(f.focusNode)&&Lpt(f.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let h=oS(this.view.root);if(h)if(c.empty){if(Bt.gecko){let m=Rpt(u.node,u.offset);if(m&&m!=3){let g=(m==1?Zbe:Kbe)(u.node,u.offset);g&&(u=new hu(g.node,g.offset))}}h.collapse(u.node,u.offset),c.bidiLevel!=null&&h.caretBidiLevel!==void 0&&(h.caretBidiLevel=c.bidiLevel)}else if(h.extend){h.collapse(u.node,u.offset);try{h.extend(d.node,d.offset)}catch{}}else{let m=document.createRange();c.anchor>c.head&&([u,d]=[d,u]),m.setEnd(d.node,d.offset),m.setStart(u.node,u.offset),h.removeAllRanges(),h.addRange(m)}a&&this.view.root.activeElement==r&&(r.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(u,d)),this.impreciseAnchor=u.precise?null:new hu(f.anchorNode,f.anchorOffset),this.impreciseHead=d.precise?null:new hu(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(t,n){return this.hasComposition&&n.empty&&Wv(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,n=t.state.selection.main,r=oS(t.root),{anchorNode:i,anchorOffset:s}=t.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let a=this.lineAt(n.head,n.assoc);if(!a)return;let l=a.posAtStart;if(n.head==l||n.head==l+a.length)return;let c=this.coordsAt(n.head,-1),u=this.coordsAt(n.head,1);if(!c||!u||c.bottom>u.top)return;let d=this.domAtPos(n.head+n.assoc,n.assoc);r.collapse(d.node,d.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let f=t.observer.selectionRange;t.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=n.from&&r.collapse(i,s)}posFromDOM(t,n){let r=this.tile.nearest(t);if(!r)return this.tile.dom.compareDocumentPosition(t)&2?0:this.view.state.doc.length;let i=r.posAtStart;if(r.isComposite()){let s;if(t==r.dom)s=r.dom.childNodes[n];else{let a=ah(t)==0?0:n==0?-1:1;for(;;){let l=t.parentNode;if(l==r.dom)break;a==0&&l.firstChild!=l.lastChild&&(t==l.firstChild?a=-1:a=1),t=l}a<0?s=t:s=t.nextSibling}if(s==r.dom.firstChild)return i;for(;s&&!ps.get(s);)s=s.nextSibling;if(!s)return i+r.length;for(let a=0,l=i;;a++){let c=r.children[a];if(c.dom==s)return l;l+=c.length+c.breakAfter}}else return r.isText()?t==r.dom?i+n:i+(n?r.length:0):i}domAtPos(t,n){let{tile:r,offset:i}=this.tile.resolveBlock(t,n);return r.isWidget()?r.domPosFor(i,n):r.domIn(i,n)}inlineDOMNearPos(t,n){let r,i=-1,s=!1,a,l=-1,c=!1;return this.tile.blockTiles((u,d)=>{if(u.isWidget()){if(u.flags&32&&d>=t)return!0;u.flags&16&&(s=!0)}else{let f=d+u.length;if(d<=t&&(r=u,i=t-d,s=f=t&&!a&&(a=u,l=t-d,c=d>t),d>t&&a)return!0}}),!r&&!a?this.domAtPos(t,n):(s&&a?r=null:c&&r&&(a=null),r&&n<0||!a?r.domIn(i,n):a.domIn(l,n))}coordsAt(t,n,r){let{tile:i,offset:s}=this.tile.resolveBlock(t,n);return i.isWidget()?i.widget instanceof QD?null:i.coordsInWidget(s,n,!0):i.coordsIn(s,n,r)}lineAt(t,n){let{tile:r}=this.tile.resolveBlock(t,n);return r.isLine()?r:null}coordsForChar(t){let{tile:n,offset:r}=this.tile.resolveBlock(t,1);if(!n.isLine())return null;function i(s,a){if(s.isComposite())for(let l of s.children){if(l.length>=a){let c=i(l,a);if(c)return c}if(a-=l.length,a<0)break}else if(s.isText()&&aMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,c=this.view.textDirection==wi.LTR,u=0,d=(f,h,m)=>{for(let g=0;gi);g++){let b=f.children[g],y=h+b.length,O=b.dom.getBoundingClientRect(),{height:v}=O;if(m&&!g&&(u+=O.top-m.top),b instanceof Ff)y>r&&d(b,h,O);else if(h>=r&&(u>0&&n.push(-u),n.push(v+u),u=0,a)){let x=b.dom.lastChild,w=x?Gv(x):[];if(w.length){let S=w[w.length-1],E=c?S.right-O.left:O.right-S.left;E>l&&(l=E,this.minWidth=s,this.minWidthFrom=h,this.minWidthTo=y)}}m&&g==f.children.length-1&&(u+=m.bottom-O.bottom),h=y+b.breakAfter}};return d(this.tile,0,null),n}textDirectionAt(t){let{tile:n}=this.tile.resolveBlock(t,1);return getComputedStyle(n.dom).direction=="rtl"?wi.RTL:wi.LTR}measureTextSize(){let t=this.tile.blockTiles(a=>{if(a.isLine()&&a.children.length&&a.length<=20){let l=0,c;for(let u of a.children){if(!u.isText()||/[^ -~]/.test(u.text))return;let d=Gv(u.dom);if(d.length!=1)return;l+=d[0].width,c=d[0].height}if(l)return{lineHeight:a.dom.getBoundingClientRect().height,charWidth:l/a.length,textHeight:c}}});if(t)return t;let n=document.createElement("div"),r,i,s;return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(n);let a=Gv(n.firstChild)[0];r=n.getBoundingClientRect().height,i=a&&a.width?a.width/27:7,s=a&&a.height?a.height:r,n.remove()}),{lineHeight:r,charWidth:i,textHeight:s}}computeBlockGapDeco(){let t=[],n=this.view.viewState;for(let r=0,i=0;;i++){let s=i==n.viewports.length?null:n.viewports[i],a=s?s.from-1:this.view.state.doc.length;if(a>r){let l=(n.lineBlockAt(a).bottom-n.lineBlockAt(r).top)/this.view.scaleY;t.push(ln.replace({widget:new QD(l),block:!0,inclusive:!0,isBlockGap:!0}).range(r,a))}if(!s)break;r=s.to+1}return ln.set(t)}updateDeco(){let t=1,n=this.view.state.facet(Jj).map(s=>(this.dynamicDecorationMap[t++]=typeof s=="function")?s(this.view):s),r=!1,i=this.view.state.facet(yQ).map((s,a)=>{let l=typeof s=="function";return l&&(r=!0),l?s(this.view):s});for(i.length&&(this.dynamicDecorationMap[t++]=r,n.push(gr.join(i))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];ttypeof s=="function"?s(this.view):s)}scrollIntoView(t){if(t.isSnapshot){let u=this.view.viewState.lineBlockAt(t.range.head);this.view.scrollDOM.scrollTop=u.top-t.yMargin,this.view.scrollDOM.scrollLeft=t.xMargin;return}for(let u of this.view.state.facet(fye))try{if(u(this.view,t.range,t))return!0}catch(d){Xo(this.view.state,d,"scroll handler")}let{range:n}=t,r=this.coordsAt(n.head,n.assoc||(n.head>n.anchor?-1:1)),i;if(!r)return;!n.empty&&(i=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,i.left),top:Math.min(r.top,i.top),right:Math.max(r.right,i.right),bottom:Math.max(r.bottom,i.bottom)});let s=OQ(this.view),a={left:r.left-s.left,top:r.top-s.top,right:r.right+s.right,bottom:r.bottom+s.bottom},{offsetWidth:l,offsetHeight:c}=this.view.scrollDOM;if(ipt(this.view.scrollDOM,a,n.head1&&(r.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||r.bottomr.isWidget()||r.children.some(n);return n(this.tile.resolveBlock(t,1).tile)}destroy(){t6(this.tile)}}function t6(e,t){let n=t==null?void 0:t.get(e);if(n!=1){n==null&&e.destroy();for(let r of e.children)t6(r,t)}}function Npt(e){return e.node.nodeType==1&&e.node.firstChild&&(e.offset==0||e.node.childNodes[e.offset-1].contentEditable=="false")&&(e.offset==e.node.childNodes.length||e.node.childNodes[e.offset].contentEditable=="false")}function Oye(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=Zbe(n.focusNode,n.focusOffset),i=Kbe(n.focusNode,n.focusOffset),s=r||i;if(i&&r&&i.node!=r.node){let l=ps.get(i.node);if(!l||l.isText()&&l.text!=i.node.nodeValue)s=i;else if(e.docView.lastCompositionAfterCursor){let c=ps.get(r.node);!c||c.isText()&&c.text!=r.node.nodeValue||(s=i)}}if(e.docView.lastCompositionAfterCursor=s!=r,!s)return null;let a=t-s.offset;return{from:a,to:a+s.node.nodeValue.length,node:s.node}}function jpt(e,t,n){let r=Oye(e,n);if(!r)return null;let{node:i,from:s,to:a}=r,l=i.nodeValue;if(/[\n\r]/.test(l)||e.state.doc.sliceString(r.from,r.to)!=l)return null;let c=t.invertedDesc;return{range:new Ac(c.mapPos(s),c.mapPos(a),s,a),text:i}}function Rpt(e,t){return e.nodeType!=1?0:(t&&e.childNodes[t-1].contentEditable=="false"?1:0)|(t{rt.from&&(n=!0)}),n}class QD extends Ru{constructor(t){super(),this.height=t}toDOM(){let t=document.createElement("div");return t.className="cm-gap",this.updateDOM(t),t}eq(t){return t.height==this.height}updateDOM(t){return t.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function Bpt(e,t,n=1){let r=e.charCategorizer(t),i=e.doc.lineAt(t),s=t-i.from;if(i.length==0)return tt.cursor(t);s==0?n=1:s==i.length&&(n=-1);let a=s,l=s;n<0?a=ma(i.text,s,!1):l=ma(i.text,s);let c=r(i.text.slice(a,l));for(;a>0;){let u=ma(i.text,a,!1);if(r(i.text.slice(u,a))!=c)break;a=u}for(;le.defaultLineHeight*1.5){let l=e.viewState.heightOracle.textHeight,c=Math.floor((i-n.top-(e.defaultLineHeight-l)*.5)/l);s+=c*e.viewState.heightOracle.lineLength}let a=e.state.sliceDoc(n.from,n.to);return n.from+zL(a,s,e.state.tabSize)}function n6(e,t,n){let r=e.lineBlockAt(t);if(Array.isArray(r.type)){let i;for(let s of r.type){if(s.from>t)break;if(!(s.tot)return s;(!i||s.type==$a.Text&&(i.type!=s.type||(n<0?s.fromt)))&&(i=s)}}return i||r}return r}function Upt(e,t,n,r){let i=n6(e,t.head,t.assoc||-1),s=!r||i.type!=$a.Text||!(e.lineWrapping||i.widgetLineBreaks)?null:e.coordsAtPos(t.assoc<0&&t.head>i.from?t.head-1:t.head);if(s){let a=e.dom.getBoundingClientRect(),l=e.textDirectionAt(i.from),c=e.posAtCoords({x:n==(l==wi.LTR)?a.right-1:a.left+1,y:(s.top+s.bottom)/2});if(c!=null)return tt.cursor(c,n?-1:1)}return tt.cursor(n?i.to:i.from,n?-1:1)}function MY(e,t,n,r){let i=e.state.doc.lineAt(t.head),s=e.bidiSpans(i),a=e.textDirectionAt(i.from);for(let l=t,c=null;;){let u=mpt(i,s,a,l,n),d=rye;if(!u){if(i.number==(n?e.state.doc.lines:1))return l;d=` +`,i=e.state.doc.line(i.number+(n?1:-1)),s=e.bidiSpans(i),u=e.visualLineSide(i,!n)}if(c){if(!c(d))return l}else{if(!r)return u;c=r(d)}l=u}}function Fpt(e,t,n){let r=e.state.charCategorizer(t),i=r(n);return s=>{let a=r(s);return i==Yi.Space&&(i=a),i==a}}function zpt(e,t,n,r){let i=t.head,s=n?1:-1;if(i==(n?e.state.doc.length:0))return tt.cursor(i,t.assoc);let a=t.goalColumn,l,c=e.contentDOM.getBoundingClientRect(),u=e.coordsAtPos(i,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),d=e.documentTop;if(u)a==null&&(a=u.left-c.left),l=s<0?u.top:u.bottom;else{let g=e.viewState.lineBlockAt(i);a==null&&(a=Math.min(c.right-c.left,e.defaultCharacterWidth*(i-g.from))),l=(s<0?g.top:g.bottom)+d}let f=c.left+a,h=e.viewState.heightOracle.textHeight>>1,m=r??h;for(let g=0;;g+=h){let b=l+(m+g)*s,y=r6(e,{x:f,y:b},!1,s);if(n?b>c.bottom:bl:v{if(t>s&&ti(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:tt.cursor(r,re.viewState.docHeight)return new Ju(e.state.doc.length,-1);if(u=e.elementAtHeight(c),r==null)break;if(u.type==$a.Text){if(r<0?u.toe.viewport.to)break;let h=e.docView.coordsAt(r<0?u.from:u.to,r>0?-1:1);if(h&&(r<0?h.top<=c+s:h.bottom>=c+s))break}let f=e.viewState.heightOracle.textHeight/2;c=r>0?u.bottom+f:u.top-f}if(e.viewport.from>=u.to||e.viewport.to<=u.from){if(n)return null;if(u.type==$a.Text){let f=Qpt(e,i,u,a,l);return new Ju(f,f==u.from?1:-1)}}if(u.type!=$a.Text)return c<(u.top+u.bottom)/2?new Ju(u.from,1):new Ju(u.to,-1);let d=e.docView.lineAt(u.from,2);return(!d||d.length!=u.length)&&(d=e.docView.lineAt(u.from,-2)),new Vpt(e,a,l,e.textDirectionAt(u.from)).scanTile(d,u.from)}class Vpt{constructor(t,n,r,i){this.view=t,this.x=n,this.y=r,this.baseDir=i,this.line=null,this.spans=null}bidiSpansAt(t){return(!this.line||this.line.from>t||this.line.to1||r.length&&(r[0].level!=this.baseDir||r[0].to+i.from>1;t:if(a.has(b)){let O=i+Math.floor(Math.random()*g);for(let v=0;v1)){if(v.bottomthis.y)(!u||u.top>v.top)&&(u=v),x=-1;else{let w=v.left>this.x?this.x-v.left:v.right(g+g+b)/3)return this.y=c.bottom-1,this.scan(t,n,!0);if(u&&u.top<(g+b+b)/3)return this.y=u.top+1,this.scan(t,n,!0)}let m=(l?this.dirAt(t[d],1):this.baseDir)==wi.LTR;return{i:d,after:this.x>(h.left+h.right)/2==m}}scanText(t,n){let r=[];for(let s=0;s{let a=r[s]-n,l=r[s+1]-n;return cS(t.dom,a,l).getClientRects()});return i.after?new Ju(r[i.i+1],-1):new Ju(r[i.i],1)}scanTile(t,n){if(!t.length)return new Ju(n,1);if(t.children.length==1){let l=t.children[0];if(l.isText())return this.scanText(l,n);if(l.isComposite())return this.scanTile(l,n)}let r=[n];for(let l=0,c=n;l{let c=t.children[l];return c.flags&48?null:(c.dom.nodeType==1?c.dom:cS(c.dom,0,c.length)).getClientRects()}),s=t.children[i.i],a=r[i.i];return s.isText()?this.scanText(s,a):s.isComposite()?this.scanTile(s,a):i.after?new Ju(r[i.i+1],-1):new Ju(a,1)}}const xb="￿";class Hpt{constructor(t,n){this.points=t,this.view=n,this.text="",this.lineSeparator=n.state.facet(xr.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=xb}readRange(t,n){if(!t)return this;let r=t.parentNode;for(let i=t;;){this.findPointBefore(r,i);let s=this.text.length;this.readNode(i);let a=ps.get(i),l=i.nextSibling;if(l==n){a!=null&&a.breakAfter&&!l&&r!=this.view.contentDOM&&this.lineBreak();break}let c=ps.get(l);(a&&c?a.breakAfter:(a?a.breakAfter:mA(i))||mA(l)&&(i.nodeName!="BR"||a!=null&&a.isWidget())&&this.text.length>s)&&!Xpt(l,n)&&this.lineBreak(),i=l}return this.findPointBefore(r,n),this}readTextNode(t){let n=t.nodeValue;for(let r of this.points)r.node==t&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,a=1,l;if(this.lineSeparator?(s=n.indexOf(this.lineSeparator,r),a=this.lineSeparator.length):(l=i.exec(n))&&(s=l.index,a=l[0].length),this.append(n.slice(r,s<0?n.length:s)),s<0)break;if(this.lineBreak(),a>1)for(let c of this.points)c.node==t&&c.pos>this.text.length&&(c.pos-=a-1);r=s+a}}readNode(t){let n=ps.get(t),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(t,r.length);for(let i=r.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.value)}else t.nodeType==3?this.readTextNode(t):t.nodeName=="BR"?t.nextSibling&&this.lineBreak():t.nodeType==1&&this.readRange(t.firstChild,null)}findPointBefore(t,n){for(let r of this.points)r.node==t&&t.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(t,n){for(let r of this.points)(t.nodeType==3?r.node==t:t.contains(r.node))&&(r.pos=this.text.length+(qpt(t,r.node,r.offset)?n:0))}}function qpt(e,t,n){for(;;){if(!t||n-1;let{impreciseHead:s,impreciseAnchor:a}=t.docView,l=t.state.selection;if(t.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=vye(t.docView.tile,n,r,0))){let c=s||a?[]:Ypt(t),u=new Hpt(c,t);u.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=u.text,this.newSel=Zpt(c,this.bounds.from)}else{let c=t.observer.selectionRange,u=s&&s.node==c.focusNode&&s.offset==c.focusOffset||!YL(t.contentDOM,c.focusNode)?l.main.head:t.docView.posFromDOM(c.focusNode,c.focusOffset),d=a&&a.node==c.anchorNode&&a.offset==c.anchorOffset||!YL(t.contentDOM,c.anchorNode)?l.main.anchor:t.docView.posFromDOM(c.anchorNode,c.anchorOffset),f=t.viewport;if((Bt.ios||Bt.chrome)&&u!=d&&Math.min(u,d)<=l.main.from&&Math.max(u,d)>=l.main.to&&(f.from>0||f.to-1&&l.ranges.length>1)this.newSel=l.replaceRange(tt.range(d,u));else if(t.lineWrapping&&d==u&&!(l.main.empty&&l.main.head==u)&&t.inputState.lastTouchTime>Date.now()-100){let h=t.coordsAtPos(u,-1),m=0;h&&(m=t.inputState.lastTouchY<=h.bottom?-1:1),this.newSel=tt.create([tt.cursor(u,m)])}else this.newSel=tt.single(d,u)}}}function vye(e,t,n,r){if(e.isComposite()){let i=-1,s=-1,a=-1,l=-1;for(let c=0,u=r,d=r;cn)return vye(f,t,n,u);if(h>=t&&i==-1&&(i=c,s=u),u>n&&f.dom.parentNode==e.dom){a=c,l=d;break}d=h,u=h+f.breakAfter}return{from:s,to:l<0?r+e.length:l,startDOM:(i?e.children[i-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:a=0?e.children[a].dom:null}}else return e.isText()?{from:r,to:r+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function wye(e,t){let n,{newSel:r}=t,{state:i}=e,s=i.selection.main,a=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:l,to:c}=t.bounds,u=s.from,d=null;(a===8||Bt.android&&t.text.length=l&&s.to<=c&&(t.typeOver||f!=t.text)&&f.slice(0,s.from-l)==t.text.slice(0,s.from-l)&&f.slice(s.to-l)==t.text.slice(h=t.text.length-(f.length-(s.to-l)))?n={from:s.from,to:s.to,insert:Br.of(t.text.slice(s.from-l,h).split(xb))}:(m=Sye(f,t.text,u-l,d))&&(Bt.chrome&&a==13&&m.toB==m.from+2&&t.text.slice(m.from,m.toB)==xb+xb&&m.toB--,n={from:l+m.from,to:l+m.toA,insert:Br.of(t.text.slice(m.from,m.toB).split(xb))})}else r&&(!e.hasFocus&&i.facet(xf)||OA(r,s))&&(r=null);if(!n&&!r)return!1;if((Bt.mac||Bt.android)&&n&&n.from==n.to&&n.from==s.head-1&&/^\. ?$/.test(n.insert.toString())&&e.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=tt.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:Br.of([n.insert.toString().replace("."," ")])}):i.doc.lineAt(s.from).toDate.now()-50?n={from:s.from,to:s.to,insert:i.toText(e.inputState.insertingText)}:Bt.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==` + `&&e.lineWrapping&&(r&&(r=tt.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:Br.of([" "])}),n)return xQ(e,n,r,a);if(r&&!OA(r,s)){let l=!1,c="select";return e.inputState.lastSelectionTime>Date.now()-50&&(e.inputState.lastSelectionOrigin=="select"&&(l=!0),c=e.inputState.lastSelectionOrigin,c=="select.pointer"&&(r=xye(i.facet(QE).map(u=>u(e)),r))),e.dispatch({selection:r,scrollIntoView:l,userEvent:c}),!0}else return!1}function xQ(e,t,n,r=-1){if(Bt.ios&&e.inputState.flushIOSKey(t))return!0;let i=e.state.selection.main;if(Bt.android&&(t.to==i.to&&(t.from==i.from||t.from==i.from-1&&e.state.sliceDoc(t.from,i.from)==" ")&&t.insert.length==1&&t.insert.lines==2&&_y(e.contentDOM,"Enter",13)||(t.from==i.from-1&&t.to==i.to&&t.insert.length==0||r==8&&t.insert.lengthi.head)&&_y(e.contentDOM,"Backspace",8)||t.from==i.from&&t.to==i.to+1&&t.insert.length==0&&_y(e.contentDOM,"Delete",46)))return!0;let s=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let a,l=()=>a||(a=Wpt(e,t,n));return e.state.facet(lye).some(c=>c(e,t.from,t.to,s,l))||e.dispatch(l()),!0}function Wpt(e,t,n){let r,i=e.state,s=i.selection.main,a=-1;if(t.from==t.to&&t.froms.to){let c=t.fromf(e)),u,c);t.from==d&&(a=d)}if(a>-1)r={changes:t,selection:tt.cursor(t.from+t.insert.length,-1)};else if(t.from>=s.from&&t.to<=s.to&&t.to-t.from>=(s.to-s.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let c=s.fromt.to?i.sliceDoc(t.to,s.to):"";r=i.replaceSelection(e.state.toText(c+t.insert.sliceString(0,void 0,e.state.lineBreak)+u))}else{let c=i.changes(t),u=n&&n.main.to<=c.newLength?n.main:void 0;if(i.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=s.to+10&&t.to>=s.to-10){let d=e.state.sliceDoc(t.from,t.to),f,h=n&&Oye(e,n.main.head);if(h){let g=t.insert.length-(t.to-t.from);f={from:h.from,to:h.to-g}}else f=e.state.doc.lineAt(s.head);let m=s.to-t.to;r=i.changeByRange(g=>{if(g.from==s.from&&g.to==s.to)return{changes:c,range:u||g.map(c)};let b=g.to-m,y=b-d.length;if(e.state.sliceDoc(y,b)!=d||b>=f.from&&y<=f.to)return{range:g};let O=i.changes({from:y,to:b,insert:t.insert}),v=g.to-s.to;return{changes:O,range:u?tt.range(Math.max(0,u.anchor+v),Math.max(0,u.head+v)):g.map(O)}})}else r={changes:c,selection:u&&i.selection.replaceRange(u)}}let l="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,l+=".compose",e.inputState.compositionFirstChange&&(l+=".start",e.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:l,scrollIntoView:!0})}function Sye(e,t,n,r){let i=Math.min(e.length,t.length),s=0;for(;s0&&l>0&&e.charCodeAt(a-1)==t.charCodeAt(l-1);)a--,l--;if(r=="end"){let c=Math.max(0,s-Math.min(a,l));n-=a+c-s}if(a=a?s-n:0;s-=c,l=s+(l-a),a=s}else if(l=l?s-n:0;s-=c,a=s+(a-l),l=s}return{from:s,toA:a,toB:l}}function Ypt(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}=e.observer.selectionRange;return n&&(t.push(new LY(n,r)),(i!=n||s!=r)&&t.push(new LY(i,s))),t}function Zpt(e,t){if(e.length==0)return null;let n=e[0].pos,r=e.length==2?e[1].pos:n;return n>-1&&r>-1?tt.single(n+t,r+t):null}function OA(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class Kpt{setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}constructor(t){this.view=t,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=t.hasFocus,Bt.safari&&t.contentDOM.addEventListener("input",()=>null),Bt.gecko&&pmt(t.contentDOM.ownerDocument)}handleEvent(t){!omt(this.view,t)||this.ignoreDuringComposition(t)||t.type=="keydown"&&this.keydown(t)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(t.type,t)):this.runHandlers(t.type,t))}runHandlers(t,n){let r=this.handlers[t];if(r){for(let i of r.observers)i(this.view,n);for(let i of r.handlers){if(n.defaultPrevented)break;if(i(this.view,n)){n.preventDefault();break}}}}ensureHandlers(t){let n=emt(t),r=this.handlers,i=this.view.contentDOM;for(let s in n)if(s!="scroll"){let a=!n[s].handlers.length,l=r[s];l&&a!=!l.handlers.length&&(i.removeEventListener(s,this.handleEvent),l=null),l||i.addEventListener(s,this.handleEvent,{passive:a})}for(let s in r)s!="scroll"&&!n[s]&&i.removeEventListener(s,this.handleEvent);this.handlers=n}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&t.keyCode!=27&&kye.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),Bt.android&&Bt.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;if(Bt.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&(Eye.some(n=>n.keyCode==t.keyCode)&&!t.ctrlKey||tmt.indexOf(t.key)>-1&&t.ctrlKey)){let n={ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey,shiftKey:t.shiftKey};return n.shiftKey&&Bt.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&Jpt(this.view.win)&&(n.shiftKey=!1),this.pendingIOSKey={key:t.key,keyCode:t.keyCode,mods:n},setTimeout(()=>this.flushIOSKey(),250),!0}return t.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(t){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&t&&t.from0?!0:Bt.safari&&!Bt.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.view.observer.update(t),this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Jpt(e){return e.visualViewport?e.visualViewport.height*e.visualViewport.scale/e.document.documentElement.clientHeight<.85:!1}function $Y(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(i){Xo(n.state,i)}}}function emt(e){let t=Object.create(null);function n(r){return t[r]||(t[r]={observers:[],handlers:[]})}for(let r of e){let i=r.spec,s=i&&i.plugin.domEventHandlers,a=i&&i.plugin.domEventObservers;if(s)for(let l in s){let c=s[l];c&&n(l).handlers.push($Y(r.value,c))}if(a)for(let l in a){let c=a[l];c&&n(l).observers.push($Y(r.value,c))}}for(let r in Eu)n(r).handlers.push(Eu[r]);for(let r in To)n(r).observers.push(To[r]);return t}const Eye=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],tmt="dthko",kye=[16,17,18,20,91,92,224,225],z2=6;function V2(e){return Math.max(0,e)*.7+8}function nmt(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}class rmt{constructor(t,n,r,i){this.view=t,this.startEvent=n,this.style=r,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=Gbe(t.contentDOM),this.atoms=t.state.facet(QE).map(a=>a(t));let s=t.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=t.state.facet(xr.allowMultipleSelections)&&imt(t,n),this.dragging=amt(t,n)&&Cye(n)==1?null:!1}start(t){this.dragging===!1&&this.select(t)}move(t){if(t.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&nmt(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let n=0,r=0,i=0,s=0,a=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:l}=this.scrollParents.y.getBoundingClientRect());let c=OQ(this.view);t.clientX-c.left<=i+z2?n=-V2(i-t.clientX):t.clientX+c.right>=a-z2&&(n=V2(t.clientX-a)),t.clientY-c.top<=s+z2?r=-V2(s-t.clientY):t.clientY+c.bottom>=l-z2&&(r=V2(t.clientY-l)),this.setScrollSpeed(n,r)}up(t){this.dragging==null&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,n){this.scrollSpeed={x:t,y:n},t||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:t,y:n}=this.scrollSpeed;t&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=t,t=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(t||n)&&this.view.win.scrollBy(t,n),this.dragging===!1&&this.select(this.lastEvent)}select(t){let{view:n}=this,r=xye(this.atoms,this.style.get(t,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(t)&&setTimeout(()=>this.select(this.lastEvent),20)}}function imt(e,t){let n=e.state.facet(iye);return n.length?n[0](t):Bt.mac?t.metaKey:t.ctrlKey}function smt(e,t){let n=e.state.facet(sye);return n.length?n[0](t):Bt.mac?!t.altKey:!t.ctrlKey}function amt(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=oS(e.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let s=0;s=t.clientX&&a.top<=t.clientY&&a.bottom>=t.clientY)return!0}return!1}function omt(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target,r;n!=e.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=ps.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(t))return!1;return!0}const Eu=Object.create(null),To=Object.create(null),_ye=Bt.ie&&Bt.ie_version<15||Bt.ios&&Bt.webkit_version<604;function lmt(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{e.focus(),n.remove(),Tye(e,n.value)},50)}function nR(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function Tye(e,t){t=nR(e.state,mQ,t);let{state:n}=e,r,i=1,s=n.toText(t),a=s.lines==n.selection.ranges.length;if(i6!=null&&n.selection.ranges.every(c=>c.empty)&&i6==s.toString()){let c=-1;r=n.changeByRange(u=>{let d=n.doc.lineAt(u.from);if(d.from==c)return{range:u};c=d.from;let f=n.toText((a?s.line(i++).text:t)+n.lineBreak);return{changes:{from:d.from,insert:f},range:tt.cursor(u.from+f.length)}})}else a?r=n.changeByRange(c=>{let u=s.line(i++);return{changes:{from:c.from,to:c.to,insert:u.text},range:tt.cursor(c.from+u.length)}}):r=n.replaceSelection(s);e.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}To.scroll=e=>{let t=e.inputState;t.lastScrollTop=e.scrollDOM.scrollTop,t.lastScrollLeft=e.scrollDOM.scrollLeft,Bt.ios&&!t.touchActive&&(t.lastIOSMomentumScroll=Date.now())};To.wheel=To.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()};Eu.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1);To.touchstart=(e,t)=>{let n=e.inputState,r=t.targetTouches[0];n.touchActive=!0,n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin("select.pointer")};To.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")};To.touchend=(e,t)=>{e.inputState.touchActive=!1};Eu.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of e.state.facet(aye))if(n=r(e,t),n)break;if(!n&&t.button==0&&(n=umt(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new rmt(e,t,n,r)),r&&e.observer.ignore(()=>{Wbe(e.contentDOM);let s=e.root.activeElement;s&&!s.contains(e.contentDOM)&&s.blur()});let i=e.inputState.mouseSelection;if(i)return i.start(t),i.dragging===!1}else e.inputState.setSelectionOrigin("select.pointer");return!1};function BY(e,t,n,r){if(r==1)return tt.cursor(t,n);if(r==2)return Bpt(e.state,t,n);{let i=e.docView.lineAt(t,n),s=e.state.doc.lineAt(i?i.posAtEnd:t),a=i?i.posAtStart:s.from,l=i?i.posAtEnd:s.to;return lDate.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(UY+1)%3:1}function umt(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=Cye(t),i=e.state.selection;return{update(s){s.docChanged&&(n.pos=s.changes.mapPos(n.pos),i=i.map(s.changes))},get(s,a,l){let c=e.posAndSideAtCoords({x:s.clientX,y:s.clientY},!1),u,d=BY(e,c.pos,c.assoc,r);if(n.pos!=c.pos&&!a){let f=BY(e,n.pos,n.assoc,r),h=Math.min(f.from,d.from),m=Math.max(f.to,d.to);d=h1&&(u=dmt(i,c.pos))?u:l?i.addRange(d):tt.create([d])}}}function dmt(e,t){for(let n=0;n=t)return tt.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}Eu.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let i=e.docView.tile.nearest(t.target);if(i&&i.isWidget()){let s=i.posAtStart,a=s+i.length;(s>=n.to||a<=n.from)&&(n=tt.undirectionalRange(s,a))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",nR(e.state,gQ,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1};Eu.dragend=e=>(e.inputState.draggedContent=null,!1);function zY(e,t,n,r){if(n=nR(e.state,mQ,n),!n)return;let i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:s}=e.inputState,a=r&&s&&smt(e,t)?{from:s.from,to:s.to}:null,l={from:i,insert:n},c=e.state.changes(a?[a,l]:l);e.focus(),e.dispatch({changes:c,selection:{anchor:c.mapPos(i,-1),head:c.mapPos(i,1)},userEvent:a?"move.drop":"input.drop"}),e.inputState.draggedContent=null}Eu.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,s=()=>{++i==n.length&&zY(e,t,r.filter(a=>a!=null).join(e.state.lineBreak),!1)};for(let a=0;a{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(r[a]=l.result),s()},l.readAsText(n[a])}return!0}else{let r=t.dataTransfer.getData("Text");if(r)return zY(e,t,r,!0),!0}return!1};Eu.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=_ye?null:t.clipboardData;return n?(Tye(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(lmt(e),!1)};function fmt(e,t){let n=e.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout(()=>{r.remove(),e.focus()},50)}function hmt(e){let t=[],n=[],r=!1;for(let i of e.selection.ranges)i.empty||(t.push(e.sliceDoc(i.from,i.to)),n.push(i));if(!t.length){let i=-1;for(let{from:s}of e.selection.ranges){let a=e.doc.lineAt(s);a.number>i&&(t.push(a.text),n.push({from:a.from,to:Math.min(e.doc.length,a.to+1)})),i=a.number}r=!0}return{text:nR(e,gQ,t.join(e.lineBreak)),ranges:n,linewise:r}}let i6=null;Eu.copy=Eu.cut=(e,t)=>{if(!Xv(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:i}=hmt(e.state);if(!n&&!i)return!1;i6=i?n:null,t.type=="cut"&&!e.state.readOnly&&e.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=_ye?null:t.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(fmt(e,n),!1)};const Aye=jd.define();function Nye(e,t){let n=[];for(let r of e.facet(cye)){let i=r(e,t);i&&n.push(i)}return n.length?e.update({effects:n,annotations:Aye.of(!0)}):null}function jye(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=Nye(e.state,t);n?e.dispatch(n):e.update([])}},10)}To.focus=e=>{e.inputState.lastFocusTime=Date.now(),!e.scrollDOM.scrollTop&&(e.inputState.lastScrollTop||e.inputState.lastScrollLeft)&&(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),jye(e)};To.blur=e=>{e.observer.clearSelectionRange(),jye(e)};To.compositionstart=To.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange==null&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))};To.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,Bt.chrome&&Bt.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))};To.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()};Eu.beforeinput=(e,t)=>{var n,r;if((t.inputType=="insertText"||t.inputType=="insertCompositionText")&&(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),t.inputType=="insertReplacementText"&&e.observer.editContext){let s=(n=t.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),a=t.getTargetRanges();if(s&&a.length){let l=a[0],c=e.posAtDOM(l.startContainer,l.startOffset),u=e.posAtDOM(l.endContainer,l.endOffset);return xQ(e,{from:c,to:u,insert:e.state.toText(s)},null),!0}}let i;if(Bt.chrome&&Bt.android&&(i=Eye.find(s=>s.inputType==t.inputType))&&(e.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let s=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>s+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return Bt.ios&&t.inputType=="deleteContentForward"&&e.observer.flushSoon(),Bt.safari&&t.inputType=="insertText"&&e.inputState.composing>=0&&setTimeout(()=>To.compositionend(e,t),20),!1};const VY=new Set;function pmt(e){VY.has(e)||(VY.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}const HY=["pre-wrap","normal","pre-line","break-spaces"];let v1=!1;function qY(){v1=!1}class mmt{constructor(t){this.lineWrapping=t,this.doc=Br.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(t,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-t-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return HY.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let n=!1;for(let r=0;r-1,c=Math.abs(n-this.lineHeight)>.3||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=n,this.charWidth=r,this.textHeight=i,this.lineLength=s,c){this.heightSamples={};for(let u=0;u0}set outdated(t){this.flags=(t?2:0)|this.flags&-3}setHeight(t){this.height!=t&&(Math.abs(this.height-t)>yT&&(v1=!0),this.height=t)}replace(t,n,r){return _o.of(r)}decomposeLeft(t,n){n.push(this)}decomposeRight(t,n){n.push(this)}applyChanges(t,n,r,i){let s=this,a=r.doc;for(let l=i.length-1;l>=0;l--){let{fromA:c,toA:u,fromB:d,toB:f}=i[l],h=s.lineAt(c,Ai.ByPosNoHeight,r.setDoc(n),0,0),m=h.to>=u?h:s.lineAt(u,Ai.ByPosNoHeight,r,0,0);for(f+=m.to-u,u=m.to;l>0&&h.from<=i[l-1].toA;)c=i[l-1].fromA,d=i[l-1].fromB,l--,cs*2){let l=t[n-1];l.break?t.splice(--n,1,l.left,null,l.right):t.splice(--n,1,l.left,l.right),r+=1+l.break,i-=l.size}else if(s>i*2){let l=t[r];l.break?t.splice(r,1,l.left,null,l.right):t.splice(r,1,l.left,l.right),r+=2+l.break,s-=l.size}else break;else if(i=s&&a(this.lineAt(0,Ai.ByPos,r,i,s))}setMeasuredHeight(t){let n=t.heights[t.index++];n<0?(this.spaceAbove=-n,n=t.heights[t.index++]):this.spaceAbove=0,this.setHeight(n)}updateHeight(t,n=0,r=!1,i){return i&&i.from<=n&&i.more&&this.setMeasuredHeight(i),this.outdated=!1,this}toString(){return`block(${this.length})`}}class vl extends Rye{constructor(t,n,r){super(t,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(t,n){return new uu(n,this.length,t+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,n,r){let i=r[0];return r.length==1&&(i instanceof vl||i instanceof Aa&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof Aa?i=new vl(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):_o.of(r)}updateHeight(t,n=0,r=!1,i){return i&&i.from<=n&&i.more?this.setMeasuredHeight(i):(r||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Aa extends _o{constructor(t){super(t,0)}heightMetrics(t,n){let r=t.doc.lineAt(n).number,i=t.doc.lineAt(n+this.length).number,s=i-r+1,a,l=0;if(t.lineWrapping){let c=Math.min(this.height,t.lineHeight*s);a=c/s,this.length>s+1&&(l=(this.height-c)/(this.length-s-1))}else a=this.height/s;return{firstLine:r,lastLine:i,perLine:a,perChar:l}}blockAt(t,n,r,i){let{firstLine:s,lastLine:a,perLine:l,perChar:c}=this.heightMetrics(n,i);if(n.lineWrapping){let u=i+(t0){let s=r[r.length-1];s instanceof Aa?r[r.length-1]=new Aa(s.length+i):r.push(null,new Aa(i-1))}if(t>0){let s=r[0];s instanceof Aa?r[0]=new Aa(t+s.length):r.unshift(new Aa(t-1),null)}return _o.of(r)}decomposeLeft(t,n){n.push(new Aa(t-1),null)}decomposeRight(t,n){n.push(null,new Aa(this.length-t-1))}updateHeight(t,n=0,r=!1,i){let s=n+this.length;if(i&&i.from<=n+this.length&&i.more){let a=[],l=Math.max(n,i.from),c=-1;for(i.from>n&&a.push(new Aa(i.from-n-1).updateHeight(t,n));l<=s&&i.more;){let d=t.doc.lineAt(l).length;a.length&&a.push(null);let f=i.heights[i.index++],h=0;f<0&&(h=-f,f=i.heights[i.index++]),c==-1?c=f:Math.abs(f-c)>=yT&&(c=-2);let m=new vl(d,f,h);m.outdated=!1,a.push(m),l+=d+1}l<=s&&a.push(null,new Aa(s-l).updateHeight(t,l));let u=_o.of(a);return(c<0||Math.abs(u.height-this.height)>=yT||Math.abs(c-this.heightMetrics(t,n).perLine)>=yT)&&(v1=!0),xA(this,u)}else(r||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class ymt extends _o{constructor(t,n,r){super(t.length+n+r.length,t.height+r.height,n|(t.outdated||r.outdated?2:0)),this.left=t,this.right=r,this.size=t.size+r.size}get break(){return this.flags&1}blockAt(t,n,r,i){let s=r+this.left.height;return tl))return u;let d=n==Ai.ByPosNoHeight?Ai.ByPosNoHeight:Ai.ByPos;return c?u.join(this.right.lineAt(l,d,r,a,l)):this.left.lineAt(l,d,r,i,s).join(u)}forEachLine(t,n,r,i,s,a){let l=i+this.left.height,c=s+this.left.length+this.break;if(this.break)t=c&&this.right.forEachLine(t,n,r,l,c,a);else{let u=this.lineAt(c,Ai.ByPos,r,i,s);t=t&&u.from<=n&&a(u),n>u.to&&this.right.forEachLine(u.to+1,n,r,l,c,a)}}replace(t,n,r){let i=this.left.length+this.break;if(nthis.left.length)return this.balanced(this.left,this.right.replace(t-i,n-i,r));let s=[];t>0&&this.decomposeLeft(t,s);let a=s.length;for(let l of r)s.push(l);if(t>0&&XY(s,a-1),n=r&&n.push(null)),t>r&&this.right.decomposeLeft(t-r,n)}decomposeRight(t,n){let r=this.left.length,i=r+this.break;if(t>=i)return this.right.decomposeRight(t-i,n);t2*n.size||n.size>2*t.size?_o.of(this.break?[t,null,n]:[t,n]):(this.left=xA(this.left,t),this.right=xA(this.right,n),this.setHeight(t.height+n.height),this.outdated=t.outdated||n.outdated,this.size=t.size+n.size,this.length=t.length+this.break+n.length,this)}updateHeight(t,n=0,r=!1,i){let{left:s,right:a}=this,l=n+s.length+this.break,c=null;return i&&i.from<=n+s.length&&i.more?c=s=s.updateHeight(t,n,r,i):s.updateHeight(t,n,r),i&&i.from<=l+a.length&&i.more?c=a=a.updateHeight(t,l,r,i):a.updateHeight(t,l,r),c?this.balanced(s,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function XY(e,t){let n,r;e[t]==null&&(n=e[t-1])instanceof Aa&&(r=e[t+1])instanceof Aa&&e.splice(t-1,3,new Aa(n.length+1+r.length))}const Omt=5;class vQ{constructor(t,n){this.pos=t,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof vl?i.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new vl(r-this.pos,-1,0)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(t,n,r){if(t=Omt)&&this.addLineDeco(i,s,a)}else n>t&&this.span(t,n);this.lineEnd>-1&&this.lineEnd-1)return;let{from:t,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=n,this.writtenTot&&this.nodes.push(new vl(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,n){let r=new Aa(n-t);return this.oracle.doc.lineAt(t).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof vl)return t;let n=new vl(0,-1,0);return this.nodes.push(n),n}addBlock(t){this.enterLine();let n=t.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,n&&n.endSide>0&&(this.covering=t)}addLineDeco(t,n,r){let i=this.ensureLine();i.length+=r,i.collapsed+=r,i.widgetHeight=Math.max(i.widgetHeight,t),i.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(t){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof vl)&&!this.isCovered?this.nodes.push(new vl(0,-1,0)):(this.writtenTod.clientHeight||d.scrollWidth>d.clientWidth)&&f.overflow!="visible"){let h=d.getBoundingClientRect();s=Math.max(s,h.left),a=Math.min(a,h.right),l=Math.max(l,h.top),c=Math.min(u==e.parentNode?i.innerHeight:c,h.bottom)}u=f.position=="absolute"||f.position=="fixed"?d.offsetParent:d.parentNode}else if(u.nodeType==11)u=u.host;else break;return{left:s-n.left,right:Math.max(s,a)-n.left,top:l-(n.top+t),bottom:Math.max(l,c)-(n.top+t)}}function Smt(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left0&&t.top0}function Emt(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class FD{constructor(t,n,r,i){this.from=t,this.to=n,this.size=r,this.displaySize=i}static same(t,n){if(t.length!=n.length)return!1;for(let r=0;rtypeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new mmt(r),this.stateDeco=YY(n),this.heightMap=_o.empty().applyChanges(this.stateDeco,Br.empty,this.heightOracle.setDoc(n.doc),[new Ac(0,0,0,n.doc.length)]);for(let i=0;i<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());i++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ln.set(this.lineGaps.map(i=>i.draw(this,!1))),this.scrollParent=t.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let i=r?n.head:n.anchor;if(!t.some(({from:s,to:a})=>i>=s&&i<=a)){let{from:s,to:a}=this.lineBlockAt(i);t.push(new H2(s,a))}}return this.viewports=t.sort((r,i)=>r.from-i.from),this.updateScaler()}updateScaler(){let t=this.scaler;return this.scaler=this.heightMap.height<=7e6?WY:new wQ(this.heightOracle,this.heightMap,this.viewports),t.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,t=>{this.viewportLines.push(Jx(t,this.scaler))})}update(t,n=null){this.state=t.state;let r=this.stateDeco;this.stateDeco=YY(this.state);let i=t.changedRanges,s=Ac.extendWithRanges(i,xmt(r,this.stateDeco,t?t.changes:Zs.empty(this.state.doc.length))),a=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);qY(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=a||v1)&&(t.flags|=2),l?(this.scrollAnchorPos=t.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let c=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(n&&(n.range.headc.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,n));let u=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,t.flags|=this.updateForViewport(),(u||!t.changes.empty||t.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(t.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&(t.selectionSet||t.focusChanged)&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(dye)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:t}=this,n=t.contentDOM,r=window.getComputedStyle(n),i=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?wi.RTL:wi.LTR;let a=this.heightOracle.mustRefreshForWrapping(s)||this.mustMeasureContent==="refresh",l=n.getBoundingClientRect(),c=a||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let u=0,d=0;if(l.width&&l.height){let{scaleX:S,scaleY:E}=Xbe(n,l);(S>.005&&Math.abs(this.scaleX-S)>.005||E>.005&&Math.abs(this.scaleY-E)>.005)&&(this.scaleX=S,this.scaleY=E,u|=16,a=c=!0)}let f=(parseInt(r.paddingTop)||0)*this.scaleY,h=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=h)&&(this.paddingTop=f,this.paddingBottom=h,u|=18),this.editorWidth!=t.scrollDOM.clientWidth&&(i.lineWrapping&&(c=!0),this.editorWidth=t.scrollDOM.clientWidth,u|=16);let m=Gbe(this.view.contentDOM,!1).y;m!=this.scrollParent&&(this.scrollParent=m,this.scrollAnchorHeight=-1,this.scrollOffset=0);let g=this.getScrollOffset();this.scrollOffset!=g&&(this.scrollAnchorHeight=-1,this.scrollOffset=g),this.scrolledToBottom=Ybe(this.scrollParent||t.win);let b=(this.printing?Emt:wmt)(n,this.paddingTop),y=b.top-this.pixelViewport.top,O=b.bottom-this.pixelViewport.bottom;this.pixelViewport=b;let v=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(v!=this.inView&&(this.inView=v,v&&(c=!0)),!this.inView&&!this.scrollTarget&&!Smt(t.dom))return 0;let x=l.width;if((this.contentDOMWidth!=x||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=t.scrollDOM.clientHeight,u|=16),c){let S=t.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(S)&&(a=!0),a||i.lineWrapping&&Math.abs(x-this.contentDOMWidth)>i.charWidth){let{lineHeight:E,charWidth:k,textHeight:_}=t.docView.measureTextSize();a=E>0&&i.refresh(s,E,k,_,Math.max(5,x/k),S),a&&(t.docView.minWidth=0,u|=16)}y>0&&O>0?d=Math.max(y,O):y<0&&O<0&&(d=Math.min(y,O)),qY();for(let E of this.viewports){let k=E.from==this.viewport.from?S:t.docView.measureVisibleLineHeights(E);this.heightMap=(a?_o.empty().applyChanges(this.stateDeco,Br.empty,this.heightOracle,[new Ac(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(i,0,a,new gmt(E.from,k))}v1&&(u|=2)}let w=!this.viewportIsAppropriate(this.viewport,d)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return w&&(u&2&&(u|=this.updateScaler()),this.viewport=this.getViewport(d,this.scrollTarget),u|=this.updateForViewport()),(u&2||w)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,t)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),u}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,n){let r=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),i=this.heightMap,s=this.heightOracle,{visibleTop:a,visibleBottom:l}=this,c=new H2(i.lineAt(a-r*1e3,Ai.ByHeight,s,0,0).from,i.lineAt(l+(1-r)*1e3,Ai.ByHeight,s,0,0).to);if(n){let{head:u}=n.range;if(uc.to){let d=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=i.lineAt(u,Ai.ByPos,s,0,0),h;n.y=="center"?h=(f.top+f.bottom)/2-d/2:n.y=="start"||n.y=="nearest"&&u=l+Math.max(10,Math.min(r,250)))&&i>a-2*1e3&&s>1,a=i<<1;if(this.defaultTextDirection!=wi.LTR&&!r)return[];let l=[],c=(d,f,h,m)=>{if(f-dd&&OO.from>=h.from&&O.to<=h.to&&Math.abs(O.from-d)O.fromv));if(!y){if(fx.from<=f&&x.to>=f)){let x=n.moveToLineBoundary(tt.cursor(f),!1,!0).head;x>d&&(f=x)}let O=this.gapSize(h,d,f,m),v=r||O<2e6?O:2e6;y=new FD(d,f,O,v)}l.push(y)},u=d=>{if(d.length2e6)for(let E of t)E.from>=d.from&&E.fromd.from&&c(d.from,m,d,f),gn.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(t){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];gr.spans(n,this.viewport.from,this.viewport.to,{span(s,a){r.push({from:s,to:a})},point(){}},20);let i=0;if(r.length!=this.visibleRanges.length)i=12;else for(let s=0;s=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(n=>n.from<=t&&n.to>=t)||Jx(this.heightMap.lineAt(t,Ai.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return t>=this.viewportLines[0].top&&t<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=t&&n.bottom>=t)||Jx(this.heightMap.lineAt(this.scaler.fromDOM(t),Ai.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(t){let n=this.lineBlockAtHeight(t+8);return n.from>=this.viewport.from||this.viewportLines[0].top-t>200?n:this.viewportLines[0]}elementAtHeight(t){return Jx(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class H2{constructor(t,n){this.from=t,this.to=n}}function _mt(e,t,n){let r=[],i=e,s=0;return gr.spans(n,e,t,{span(){},point(a,l){a>i&&(r.push({from:i,to:a}),s+=a-i),i=l}},20),i=1)return t[t.length-1].to;let r=Math.floor(e*n);for(let i=0;;i++){let{from:s,to:a}=t[i],l=a-s;if(r<=l)return s+r;r-=l}}function X2(e,t){let n=0;for(let{from:r,to:i}of e.ranges){if(t<=i){n+=t-r;break}n+=i-r}return n/e.total}function Tmt(e,t){for(let n of e)if(t(n))return n}const WY={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function YY(e){let t=e.facet(Jj).filter(r=>typeof r!="function"),n=e.facet(yQ).filter(r=>typeof r!="function");return n.length&&t.push(gr.join(n)),t}class wQ{constructor(t,n,r){let i=0,s=0,a=0;this.viewports=r.map(({from:l,to:c})=>{let u=n.lineAt(l,Ai.ByPos,t,0,0).top,d=n.lineAt(c,Ai.ByPos,t,0,0).bottom;return i+=d-u,{from:l,to:c,top:u,bottom:d,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(n.height-i);for(let l of this.viewports)l.domTop=a+(l.top-s)*this.scale,a=l.domBottom=l.domTop+(l.bottom-l.top),s=l.bottom}toDOM(t){for(let n=0,r=0,i=0;;n++){let s=nn.from==t.viewports[r].from&&n.to==t.viewports[r].to):!1}}function Jx(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new uu(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(i=>Jx(i,t)):e._content)}const G2=Qt.define({combine:e=>e.join(" ")}),s6=Qt.define({combine:e=>e.indexOf(!0)>-1}),a6=Jp.newName(),Iye=Jp.newName(),Dye=Jp.newName(),Pye={"&light":"."+Iye,"&dark":"."+Dye};function o6(e,t,n){return new Jp(t,{finish(r){return/&/.test(r)?r.replace(/&\w*/,i=>{if(i=="&")return e;if(!n||!n[i])throw new RangeError(`Unsupported selector: ${i}`);return n[i]}):e+" "+r}})}const Cmt=o6("."+a6,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{userSelect:"none",position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Pye),Amt={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},zD=Bt.ie&&Bt.ie_version<=11;class Nmt{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new spt,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(Bt.ie&&Bt.ie_version<=11||Bt.ios&&t.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Bt.android&&t.constructor.EDIT_CONTEXT!==!1&&!(Bt.chrome&&Bt.chrome_version<126)&&(this.editContext=new Rmt(t),t.state.facet(xf)&&(t.contentDOM.editContext=this.editContext.editContext)),zD&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers("scroll",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(t){(t.type=="change"||!t.type)&&!t.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((n,r)=>n!=t[r]))){this.gapIntersection.disconnect();for(let n of t)this.gapIntersection.observe(n);this.gaps=t}}onSelectionChange(t){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,i=this.selectionRange;if(r.state.facet(xf)?r.root.activeElement!=this.dom:!Xv(this.dom,i))return;let s=i.anchorNode&&r.docView.tile.nearest(i.anchorNode);if(s&&s.isWidget()&&s.widget.ignoreEvent(t)){n||(this.selectionChanged=!1);return}(Bt.ie&&Bt.ie_version<=11||Bt.android&&Bt.chrome)&&!r.state.selection.main.empty&&i.focusNode&&Wv(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,n=oS(t.root);if(!n)return!1;let r=Bt.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&jmt(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let i=Xv(this.dom,r);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&_y(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||t=="Enter")&&(this.delayedAndroidKey={key:t,keyCode:n,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let n=-1,r=-1,i=!1;for(let s of t){let a=this.readMutation(s);a&&(a.typeOver&&(i=!0),n==-1?{from:n,to:r}=a:(n=Math.min(a.from,n),r=Math.max(a.to,r)))}return{from:n,to:r,typeOver:i}}readChange(){let{from:t,to:n,typeOver:r}=this.processRecords(),i=this.selectionChanged&&Xv(this.dom,this.selectionRange);if(t<0&&!i)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new Gpt(this.view,t,n,r);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,i=wye(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!OA(this.view.state.selection,n.newSel.main))&&this.view.update([]),i}readMutation(t){let n=this.view.docView.tile.nearest(t.target);if(!n||n.isWidget())return null;if(n.markDirty(t.type=="attributes"),t.type=="childList"){let r=ZY(n,t.previousSibling||t.target.previousSibling,-1),i=ZY(n,t.nextSibling||t.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:i?n.posBefore(i):n.posAtEnd,typeOver:!1}}else return t.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}update(t){this.editContext&&(this.editContext.update(t),t.startState.facet(xf)!=t.state.facet(xf)&&(t.view.contentDOM.editContext=t.state.facet(xf)?this.editContext.editContext:null))}destroy(){var t,n,r;this.stop(),(t=this.intersection)===null||t===void 0||t.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function ZY(e,t,n){for(;t;){let r=ps.get(t);if(r&&r.parent==e)return r;let i=t.parentNode;t=i!=e.dom?i:n>0?t.nextSibling:t.previousSibling}return null}function KY(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,s=t.endOffset,a=e.docView.domAtPos(e.state.selection.main.anchor,1);return Wv(a.node,a.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function jmt(e,t){if(t.getComposedRanges){let i=t.getComposedRanges(e.root)[0];if(i)return KY(e,i)}let n=null;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",r,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",r,!0),n?KY(e,n):null}class Rmt{constructor(t){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(t.state);let n=this.editContext=new window.EditContext({text:t.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,t.state.selection.main.anchor))),selectionEnd:this.toContextPos(t.state.selection.main.head)});this.handlers.textupdate=r=>{let i=t.state.selection.main,{anchor:s,head:a}=i,l=this.toEditorPos(r.updateRangeStart),c=this.toEditorPos(r.updateRangeEnd);t.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:l,drifted:!1});let u=c-l>r.text.length;l==this.from&&sthis.to&&(c=s);let d=Sye(t.state.sliceDoc(l,c),r.text,(u?i.from:i.to)-l,u?"end":null);if(!d){let h=tt.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));OA(h,i)||t.dispatch({selection:h,userEvent:"select"});return}let f={from:d.from+l,to:d.toA+l,insert:Br.of(r.text.slice(d.from,d.toB).split(` +`))};if((Bt.mac||Bt.android)&&f.from==a-1&&/^\. ?$/.test(r.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:c,insert:Br.of([r.text.replace("."," ")])}),this.pendingContextChange=f,!t.state.readOnly){let h=this.to-this.from+(f.to-f.from+f.insert.length);xQ(t,f,tt.single(this.toEditorPos(r.selectionStart,h),this.toEditorPos(r.selectionEnd,h)))}this.pendingContextChange&&(this.revertPending(t.state),this.setSelection(t.state)),f.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let i=[],s=null;for(let a=this.toEditorPos(r.rangeStart),l=this.toEditorPos(r.rangeEnd);a{let i=[];for(let s of r.getTextFormats()){let a=s.underlineStyle,l=s.underlineThickness;if(!/none/i.test(a)&&!/none/i.test(l)){let c=this.toEditorPos(s.rangeStart),u=this.toEditorPos(s.rangeEnd);if(c{t.inputState.composing<0&&(t.inputState.composing=0,t.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(t.inputState.composing=-1,t.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(t.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{let i=oS(r.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let n=0,r=!1,i=this.pendingContextChange;return t.changes.iterChanges((s,a,l,c,u)=>{if(r)return;let d=u.length-(a-s);if(i&&a>=i.to)if(i.from==s&&i.to==a&&i.insert.eq(u)){i=this.pendingContextChange=null,n+=d,this.to+=d;return}else i=null,this.revertPending(t.state);if(s+=n,a+=n,a<=this.from)this.from+=d,this.to+=d;else if(sthis.to||this.to-this.from+u.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(a),u.toString()),this.to+=d}n+=d}),i&&!r&&this.revertPending(t.state),!r}update(t){let n=this.pendingContextChange,r=t.startState.selection.main;this.composing&&(this.composing.drifted||!t.changes.touchesRange(r.from,r.to)&&t.transactions.some(i=>!i.isUserEvent("input.type")&&i.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=t.changes.mapPos(this.composing.editorBase)):!this.applyEdits(t)||!this.rangeIsValid(t.state)?(this.pendingContextChange=null,this.reset(t.state)):(t.docChanged||t.selectionSet||n)&&this.setSelection(t.state),(t.geometryChanged||t.docChanged||t.selectionSet)&&t.view.requestMeasure(this.measureReq)}resetRange(t){let{head:n}=t.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(t.doc.length,n+1e4)}reset(t){this.resetRange(t),this.editContext.updateText(0,this.editContext.text.length,t.doc.sliceString(this.from,this.to)),this.setSelection(t)}revertPending(t){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),t.doc.sliceString(n.from,n.to))}setSelection(t){let{main:n}=t.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),i=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(r,i)}rangeIsValid(t){let{head:n}=t.selection.main;return!(this.from>0&&n-this.from<500||this.to1e4*3)}toEditorPos(t,n=this.to-this.from){t=Math.min(t,n);let r=this.composing;return r&&r.drifted?r.editorBase+(t-r.contextBase):t+this.from}toContextPos(t){let n=this.composing;return n&&n.drifted?n.contextBase+(t-n.editorBase):t-this.from}destroy(){for(let t in this.handlers)this.editContext.removeEventListener(t,this.handlers[t])}}class Ct{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch:r}=t;this.dispatchTransactions=t.dispatchTransactions||r&&(i=>i.forEach(s=>r(s,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=t.root||apt(t.parent)||document,this.viewState=new GY(this,t.state||xr.create(t)),t.scrollTo&&t.scrollTo.is(F2)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Kb).map(i=>new LD(i));for(let i of this.plugins)i.update(this);this.observer=new Nmt(this),this.inputState=new Kpt(this),this.inputState.ensureHandlers(this.plugins),this.docView=new PY(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...t){let n=t.length==1&&t[0]instanceof Us?t:t.length==1&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(n,this)}update(t){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,i,s=this.state;for(let h of t){if(h.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=h.state}if(this.destroyed){this.viewState.state=s;return}let a=this.hasFocus,l=0,c=null;t.some(h=>h.annotation(Aye))?(this.inputState.notifiedFocused=a,l=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,c=Nye(s,a),c||(l=1));let u=this.observer.delayedAndroidKey,d=null;if(u?(this.observer.clearDelayedAndroidKey(),d=this.observer.readChange(),(d&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(d=null)):this.observer.clear(),s.facet(xr.phrases)!=this.state.facet(xr.phrases))return this.setState(s);i=gA.create(this,s,t),i.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let h of t){if(f&&(f=f.map(h.changes)),h.scrollIntoView){let{main:m}=h.state.selection,{x:g,y:b}=this.state.facet(Ct.cursorScrollMargin);f=new Ty(m.empty?m:tt.cursor(m.head,m.head>m.anchor?-1:1),"nearest","nearest",b,g)}for(let m of h.effects)m.is(F2)&&(f=m.value.clip(this.state))}this.viewState.update(i,f),this.bidiCache=vA.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(Kx)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some(h=>h.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(G2)!=i.state.facet(G2)&&(this.viewState.mustMeasureContent=!0),(n||r||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!i.empty)for(let h of this.state.facet(e6))try{h(i)}catch(m){Xo(this.state,m,"update listener")}(c||d)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),d&&!wye(this,d)&&u.force&&_y(this.contentDOM,u.key,u.keyCode)})}setState(t){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=t;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new GY(this,t),this.plugins=t.facet(Kb).map(r=>new LD(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new PY(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(t){let n=t.startState.facet(Kb),r=t.state.facet(Kb);if(n!=r){let i=[];for(let s of r){let a=n.indexOf(s);if(a<0)i.push(new LD(s));else{let l=this.plugins[a];l.mustUpdate=t,i.push(l)}}for(let s of this.plugins)s.mustUpdate!=t&&s.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=t;for(let i=0;i-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,t&&this.observer.forceFlush();let n=null,r=this.viewState.scrollParent,i=this.viewState.getScrollOffset(),{scrollAnchorPos:s,scrollAnchorHeight:a}=this.viewState;Math.abs(i-this.viewState.scrollOffset)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(a<0)if(Ybe(r||this.win))s=-1,a=this.viewState.heightMap.height;else{let m=this.viewState.scrollAnchorAt(i);s=m.from,a=m.top}this.updateState=1;let c=this.viewState.measure();if(!c&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let u=[];c&4||([this.measureRequests,u]=[u,this.measureRequests]);let d=u.map(m=>{try{return m.read(this)}catch(g){return Xo(this.state,g),JY}}),f=gA.create(this,this.state,[]),h=!1;f.flags|=c,n?n.flags|=c:n=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),h=this.docView.update(f),h&&this.docViewUpdate());for(let m=0;m1||g<-1)&&!(Bt.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(r==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){i=i+g,r?r.scrollTop+=g:this.win.scrollBy(0,g),a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let l of this.state.facet(e6))l(n)}get themeClasses(){return a6+" "+(this.state.facet(s6)?Dye:Iye)+" "+this.state.facet(G2)}updateAttrs(){let t=eZ(this,pye,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(xf)?"true":"false",class:"cm-content",style:`${Bt.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),eZ(this,bQ,n);let r=this.observer.ignore(()=>{let i=AY(this.contentDOM,this.contentAttrs,n),s=AY(this.dom,this.editorAttrs,t);return i||s});return this.editorAttrs=t,this.contentAttrs=n,r}showAnnouncements(t){let n=!0;for(let r of t)for(let i of r.effects)if(i.is(Ct.announce)){n&&(this.announceDOM.textContent=""),n=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(Kx);let t=this.state.facet(Ct.cspNonce);Jp.mount(this.root,this.styleModules.concat(Cmt).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(t.key!=null){for(let n=0;nr.plugin==t)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,n,r){return UD(this,t,MY(this,t,n,r))}moveByGroup(t,n){return UD(this,t,MY(this,t,n,r=>Fpt(this,t.head,r)))}visualLineSide(t,n){let r=this.bidiSpans(t),i=this.textDirectionAt(t.from),s=r[n?r.length-1:0];return tt.cursor(s.side(n,i)+t.from,s.forward(!n,i)?1:-1)}moveToLineBoundary(t,n,r=!0){return Upt(this,t,n,r)}moveVertically(t,n,r){return UD(this,t,zpt(this,t,n,r))}domAtPos(t,n=1){return this.docView.domAtPos(t,n)}posAtDOM(t,n=0){return this.docView.posFromDOM(t,n)}posAtCoords(t,n=!0){this.readMeasured();let r=r6(this,t,n);return r&&r.pos}posAndSideAtCoords(t,n=!0){return this.readMeasured(),r6(this,t,n)}coordsAtPos(t,n=1){this.readMeasured();let r=this.state.doc.lineAt(t),i=this.bidiSpans(r),s=i[ad.find(i,t-r.from,-1,n)];return this.docView.coordsAt(t,n,s.dir==wi.RTL)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(uye)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>Imt)return nye(t.length);let n=this.textDirectionAt(t.from),r;for(let s of this.bidiCache)if(s.from==t.from&&s.dir==n&&(s.fresh||tye(s.isolates,r=RY(this,t))))return s.order;r||(r=RY(this,t));let i=ppt(t.text,n,r);return this.bidiCache.push(new vA(t.from,t.to,n,r,!0,i)),i}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Bt.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Wbe(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((t.nodeType==9?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,n={}){var r,i,s,a;return F2.of(new Ty(typeof t=="number"?tt.cursor(t):t,(r=n.y)!==null&&r!==void 0?r:"nearest",(i=n.x)!==null&&i!==void 0?i:"nearest",(s=n.yMargin)!==null&&s!==void 0?s:5,(a=n.xMargin)!==null&&a!==void 0?a:5))}scrollSnapshot(){let{scrollTop:t,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(t);return F2.of(new Ty(tt.cursor(r.from),"start","start",r.top-t,n,!0))}setTabFocusMode(t){t==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof t=="boolean"?this.inputState.tabFocusMode=t?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+t)}static domEventHandlers(t){return ms.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return ms.define(()=>({}),{eventObservers:t})}static theme(t,n){let r=Jp.newName(),i=[G2.of(r),Kx.of(o6(`.${r}`,t))];return n&&n.dark&&i.push(s6.of(!0)),i}static baseTheme(t){return xh.lowest(Kx.of(o6("."+a6,t,Pye)))}static findFromDOM(t){var n;let r=t.querySelector(".cm-content"),i=r&&ps.get(r)||ps.get(t);return((n=i==null?void 0:i.root)===null||n===void 0?void 0:n.view)||null}}Ct.styleModule=Kx;Ct.inputHandler=lye;Ct.clipboardInputFilter=mQ;Ct.clipboardOutputFilter=gQ;Ct.scrollHandler=fye;Ct.focusChangeEffect=cye;Ct.perLineTextDirection=uye;Ct.exceptionSink=oye;Ct.updateListener=e6;Ct.editable=xf;Ct.mouseSelectionStyle=aye;Ct.dragMovesSelection=sye;Ct.clickAddsSelectionRange=iye;Ct.decorations=Jj;Ct.blockWrappers=mye;Ct.outerDecorations=yQ;Ct.atomicRanges=QE;Ct.bidiIsolatedRanges=gye;Ct.cursorScrollMargin=Qt.define({combine:e=>{let t=5,n=5;for(let r of e)typeof r=="number"?t=n=r:{x:t,y:n}=r;return{x:t,y:n}}});Ct.scrollMargins=bye;Ct.darkTheme=s6;Ct.cspNonce=Qt.define({combine:e=>e.length?e[0]:""});Ct.contentAttributes=bQ;Ct.editorAttributes=pye;Ct.lineWrapping=Ct.contentAttributes.of({class:"cm-lineWrapping"});Ct.announce=jn.define();const Imt=4096,JY={};class vA{constructor(t,n,r,i,s,a){this.from=t,this.to=n,this.dir=r,this.isolates=i,this.fresh=s,this.order=a}static update(t,n){if(n.empty&&!t.some(s=>s.fresh))return t;let r=[],i=t.length?t[t.length-1].dir:wi.LTR;for(let s=Math.max(0,t.length-10);s=0;i--){let s=r[i],a=typeof s=="function"?s(e):s;a&&fQ(a,n)}return n}const Dmt=Bt.mac?"mac":Bt.windows?"win":Bt.linux?"linux":"key";function Pmt(e,t){const n=e.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let i,s,a,l;for(let c=0;cr.concat(i),[]))),n}function Lmt(e,t,n){return Lye(Mye(e.state),t,e,n)}let ap=null;const $mt=4e3;function Bmt(e,t=Dmt){let n=Object.create(null),r=Object.create(null),i=(a,l)=>{let c=r[a];if(c==null)r[a]=l;else if(c!=l)throw new Error("Key binding "+a+" is used both as a regular binding and as a multi-stroke prefix")},s=(a,l,c,u,d)=>{var f,h;let m=n[a]||(n[a]=Object.create(null)),g=l.split(/ (?!$)/).map(O=>Pmt(O,t));for(let O=1;O{let w=ap={view:x,prefix:v,scope:a};return setTimeout(()=>{ap==w&&(ap=null)},$mt),!0}]})}let b=g.join(" ");i(b,!1);let y=m[b]||(m[b]={preventDefault:!1,stopPropagation:!1,run:((h=(f=m._any)===null||f===void 0?void 0:f.run)===null||h===void 0?void 0:h.slice())||[]});c&&y.run.push(c),u&&(y.preventDefault=!0),d&&(y.stopPropagation=!0)};for(let a of e){let l=a.scope?a.scope.split(" "):["editor"];if(a.any)for(let u of l){let d=n[u]||(n[u]=Object.create(null));d._any||(d._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=a;for(let h in d)d[h].run.push(m=>f(m,l6))}let c=a[t]||a.key;if(c)for(let u of l)s(u,c,a.run,a.preventDefault,a.stopPropagation),a.shift&&s(u,"Shift-"+c,a.shift,a.preventDefault,a.stopPropagation)}return n}let l6=null;function Lye(e,t,n,r){l6=t;let i=Jht(t),s=Qo(i,0),a=Ku(s)==i.length&&i!=" ",l="",c=!1,u=!1,d=!1;ap&&ap.view==n&&ap.scope==r&&(l=ap.prefix+" ",kye.indexOf(t.keyCode)<0&&(u=!0,ap=null));let f=new Set,h=y=>{if(y){for(let O of y.run)if(!f.has(O)&&(f.add(O),O(n)))return y.stopPropagation&&(d=!0),!0;y.preventDefault&&(y.stopPropagation&&(d=!0),u=!0)}return!1},m=e[r],g,b;return m&&(h(m[l+W2(i,t,!a)])?c=!0:a&&(t.altKey||t.metaKey||t.ctrlKey)&&!(Bt.windows&&t.ctrlKey&&t.altKey)&&!(Bt.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(g=em[t.keyCode])&&g!=i?(h(m[l+W2(g,t,!0)])||t.shiftKey&&(b=sS[t.keyCode])!=i&&b!=g&&h(m[l+W2(b,t,!1)]))&&(c=!0):a&&t.shiftKey&&h(m[l+W2(i,t,!0)])&&(c=!0),!c&&h(m._any)&&(c=!0)),u&&(c=!0),c&&d&&t.stopPropagation(),l6=null,c}class kg{constructor(t,n,r,i,s){this.className=t,this.left=n,this.top=r,this.width=i,this.height=s}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,n){return n.className!=this.className?!1:(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",this.width!=null&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,n,r){if(r.empty){let i=t.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let s=$ye(t);return[new kg(n,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return Qmt(t,n,r)}}function $ye(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==wi.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function nZ(e,t,n,r){let i=e.coordsAtPos(t,n*2);if(!i)return r;let s=e.dom.getBoundingClientRect(),a=(i.top+i.bottom)/2,l=e.posAtCoords({x:s.left+1,y:a}),c=e.posAtCoords({x:s.right-1,y:a});return l==null||c==null?r:{from:Math.max(r.from,Math.min(l,c)),to:Math.min(r.to,Math.max(l,c))}}function Qmt(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let r=Math.max(n.from,e.viewport.from),i=Math.min(n.to,e.viewport.to),s=e.textDirection==wi.LTR,a=e.contentDOM,l=a.getBoundingClientRect(),c=$ye(e),u=a.querySelector(".cm-line"),d=u&&window.getComputedStyle(u),f=l.left+(d?parseInt(d.paddingLeft)+Math.min(0,parseInt(d.textIndent)):0),h=l.right-(d?parseInt(d.paddingRight):0),m=n6(e,r,1),g=n6(e,i,-1),b=m.type==$a.Text?m:null,y=g.type==$a.Text?g:null;if(b&&(e.lineWrapping||m.widgetLineBreaks)&&(b=nZ(e,r,1,b)),y&&(e.lineWrapping||g.widgetLineBreaks)&&(y=nZ(e,i,-1,y)),b&&y&&b.from==y.from&&b.to==y.to)return v(x(n.from,n.to,b));{let S=b?x(n.from,null,b):w(m,!1),E=y?x(null,n.to,y):w(g,!0),k=[];return(b||m).to<(y||g).from-(b&&y?1:0)||m.widgetLineBreaks>1&&S.bottom+e.defaultLineHeight/2j&&I.from=N)break;L>$&&A(Math.max(F,$),S==null&&F<=j,Math.min(L,N),E==null&&L>=M,Q.dir)}if($=D.to+1,$>=N)break}return C.length==0&&A(j,S==null,M,E==null,e.textDirection),{top:_,bottom:T,horizontal:C}}function w(S,E){let k=l.top+(E?S.top:S.bottom);return{top:k,bottom:k,horizontal:[]}}}function Umt(e,t){return e.constructor==t.constructor&&e.eq(t)}class Fmt{constructor(t,n){this.view=t,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,t)}update(t){t.startState.facet(OT)!=t.state.facet(OT)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq))}docViewUpdate(t){this.layer.updateOnDocViewUpdate!==!1&&t.requestMeasure(this.measureReq)}setOrder(t){let n=0,r=t.facet(OT);for(;n!Umt(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let i of t)i.update&&n&&i.constructor&&this.drawn[r].constructor&&i.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(i.draw(),n);for(;n;){let i=n.nextSibling;n.remove(),n=i}this.drawn=t,Bt.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const OT=Qt.define();function Bye(e){return[ms.define(t=>new Fmt(t,e)),OT.of(e)]}const w1=Qt.define({combine(e){return Rd(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(t,n)=>Math.min(t,n),drawRangeCursor:(t,n)=>t||n})}});function zmt(e={}){return[w1.of(e),Vmt,Hmt,qmt,dye.of(!0)]}function Qye(e){return e.startState.facet(w1)!=e.state.facet(w1)}const Vmt=Bye({above:!0,markers(e){let{state:t}=e,n=t.facet(w1),r=[];for(let i of t.selection.ranges){let s=i==t.selection.main;if(i.empty||n.drawRangeCursor&&!(s&&Bt.ios&&n.iosSelectionHandles)){let a=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=i.empty?i:tt.cursor(i.head,i.assoc);for(let c of kg.forRange(e,a,l))r.push(c)}}return r},update(e,t){e.transactions.some(r=>r.selection)&&(t.style.animationName=t.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=Qye(e);return n&&rZ(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){rZ(t.state,e)},class:"cm-cursorLayer"});function rZ(e,t){t.style.animationDuration=e.facet(w1).cursorBlinkRate+"ms"}const Hmt=Bye({above:!1,markers(e){let t=[],{main:n,ranges:r}=e.state.selection;for(let i of r)if(!i.empty)for(let s of kg.forRange(e,"cm-selectionBackground",i))t.push(s);if(Bt.ios&&!n.empty&&e.state.facet(w1).iosSelectionHandles){for(let i of kg.forRange(e,"cm-selectionHandle cm-selectionHandle-start",tt.cursor(n.from,1)))t.push(i);for(let i of kg.forRange(e,"cm-selectionHandle cm-selectionHandle-end",tt.cursor(n.to,1)))t.push(i)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||Qye(e)},class:"cm-selectionLayer"}),qmt=xh.highest(Ct.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),Uye=jn.define({map(e,t){return e==null?null:t.mapPos(e)}}),ev=Ba.define({create(){return null},update(e,t){return e!=null&&(e=t.changes.mapPos(e)),t.effects.reduce((n,r)=>r.is(Uye)?r.value:n,e)}}),Xmt=ms.fromClass(class{constructor(e){this.view=e,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(e){var t;let n=e.state.field(ev);n==null?this.cursor!=null&&((t=this.cursor)===null||t===void 0||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(e.startState.field(ev)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(ev),n=t!=null&&e.coordsAtPos(t);if(!n)return null;let r=e.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+e.scrollDOM.scrollLeft*e.scaleX,top:n.top-r.top+e.scrollDOM.scrollTop*e.scaleY,height:n.bottom-n.top}}drawCursor(e){if(this.cursor){let{scaleX:t,scaleY:n}=this.view;e?(this.cursor.style.left=e.left/t+"px",this.cursor.style.top=e.top/n+"px",this.cursor.style.height=e.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(e){this.view.state.field(ev)!=e&&this.view.dispatch({effects:Uye.of(e)})}},{eventObservers:{dragover(e){this.setDropPos(this.view.posAtCoords({x:e.clientX,y:e.clientY}))},dragleave(e){(e.target==this.view.contentDOM||!this.view.contentDOM.contains(e.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Gmt(){return[ev,Xmt]}function iZ(e,t,n,r,i){t.lastIndex=0;for(let s=e.iterRange(n,r),a=n,l;!s.next().done;a+=s.value.length)if(!s.lineBreak)for(;l=t.exec(s.value);)i(a+l.index,l)}function Wmt(e,t){let n=e.visibleRanges;if(n.length==1&&n[0].from==e.viewport.from&&n[0].to==e.viewport.to)return n;let r=[];for(let{from:i,to:s}of n)i=Math.max(e.state.doc.lineAt(i).from,i-t),s=Math.min(e.state.doc.lineAt(s).to,s+t),r.length&&r[r.length-1].to>=i?r[r.length-1].to=s:r.push({from:i,to:s});return r}class Ymt{constructor(t){const{regexp:n,decoration:r,decorate:i,boundary:s,maxLength:a=1e3}=t;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,i)this.addMatch=(l,c,u,d)=>i(d,u,u+l[0].length,l,c);else if(typeof r=="function")this.addMatch=(l,c,u,d)=>{let f=r(l,c,u);f&&d(u,u+l[0].length,f)};else if(r)this.addMatch=(l,c,u,d)=>d(u,u+l[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=a}createDeco(t){let n=new sh,r=n.add.bind(n);for(let{from:i,to:s}of Wmt(t,this.maxLength))iZ(t.state.doc,this.regexp,i,s,(a,l)=>this.addMatch(l,t,a,r));return n.finish()}updateDeco(t,n){let r=1e9,i=-1;return t.docChanged&&t.changes.iterChanges((s,a,l,c)=>{c>=t.view.viewport.from&&l<=t.view.viewport.to&&(r=Math.min(l,r),i=Math.max(c,i))}),t.viewportMoved||i-r>1e3?this.createDeco(t.view):i>-1?this.updateRange(t.view,n.map(t.changes),r,i):n}updateRange(t,n,r,i){for(let s of t.visibleRanges){let a=Math.max(s.from,r),l=Math.min(s.to,i);if(l>=a){let c=t.state.doc.lineAt(a),u=c.toc.from;a--)if(this.boundary.test(c.text[a-1-c.from])){d=a;break}for(;lh.push(O.range(b,y));if(c==u)for(this.regexp.lastIndex=d-c.from;(m=this.regexp.exec(c.text))&&m.indexthis.addMatch(y,t,b,g));n=n.update({filterFrom:d,filterTo:f,filter:(b,y)=>bf,add:h})}}return n}}const c6=/x/.unicode!=null?"gu":"g",Zmt=new RegExp(`[\0-\b +--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,c6),Kmt={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let VD=null;function Jmt(){var e;if(VD==null&&typeof document<"u"&&document.body){let t=document.body.style;VD=((e=t.tabSize)!==null&&e!==void 0?e:t.MozTabSize)!=null}return VD||!1}const xT=Qt.define({combine(e){let t=Rd(e,{render:null,specialChars:Zmt,addSpecialChars:null});return(t.replaceTabs=!Jmt())&&(t.specialChars=new RegExp(" |"+t.specialChars.source,c6)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,c6)),t}});function egt(e={}){return[xT.of(e),tgt()]}let sZ=null;function tgt(){return sZ||(sZ=ms.fromClass(class{constructor(e){this.view=e,this.decorations=ln.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(xT)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new Ymt({regexp:e.specialChars,decoration:(t,n,r)=>{let{doc:i}=n.state,s=Qo(t[0],0);if(s==9){let a=i.lineAt(r),l=n.state.tabSize,c=Su(a.text,l,r-a.from);return ln.replace({widget:new sgt((l-c%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=ln.replace({widget:new igt(e,s)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(xT);e.startState.facet(xT)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view)):this.decorations=this.decorator.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}))}const ngt="•";function rgt(e){return e>=32?ngt:e==10?"␤":String.fromCharCode(9216+e)}class igt extends Ru{constructor(t,n){super(),this.options=t,this.code=n}eq(t){return t.code==this.code}toDOM(t){let n=rgt(this.code),r=t.state.phrase("Control character")+" "+(Kmt[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,n);if(i)return i;let s=document.createElement("span");return s.textContent=n,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class sgt extends Ru{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent=" ",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}function agt(){return lgt}const ogt=ln.line({class:"cm-activeLine"}),lgt=ms.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let r of e.state.selection.ranges){let i=e.lineBlockAt(r.head);i.from>t&&(n.push(ogt.range(i.from)),t=i.from)}return ln.set(n)}},{decorations:e=>e.decorations});class cgt extends Ru{constructor(t){super(),this.content=t}toDOM(t){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(t):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(t){let n=t.firstChild?Gv(t.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(t.parentNode),i=lS(n[0],r.direction!="rtl"),s=parseInt(r.lineHeight);return i.bottom-i.top>s*1.5?{left:i.left,right:i.right,top:i.top,bottom:i.top+s}:i}ignoreEvent(){return!1}}function ugt(e){let t=ms.fromClass(class{constructor(n){this.view=n,this.placeholder=e?ln.set([ln.widget({widget:new cgt(e),side:1}).range(0)]):ln.none}get decorations(){return this.view.state.doc.length?ln.none:this.placeholder}},{decorations:n=>n.decorations});return typeof e=="string"?[t,Ct.contentAttributes.of({"aria-placeholder":e})]:t}const u6=2e3;function dgt(e,t,n){let r=Math.min(t.line,n.line),i=Math.max(t.line,n.line),s=[];if(t.off>u6||n.off>u6||t.col<0||n.col<0){let a=Math.min(t.off,n.off),l=Math.max(t.off,n.off);for(let c=r;c<=i;c++){let u=e.doc.line(c);u.length<=l&&s.push(tt.range(u.from+a,u.to+l))}}else{let a=Math.min(t.col,n.col),l=Math.max(t.col,n.col);for(let c=r;c<=i;c++){let u=e.doc.line(c),d=zL(u.text,a,e.tabSize,!0);if(d<0)s.push(tt.cursor(u.to));else{let f=zL(u.text,l,e.tabSize);s.push(tt.range(u.from+d,u.from+f))}}}return s}function fgt(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}function aZ(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1),r=e.state.doc.lineAt(n),i=n-r.from,s=i>u6?-1:i==r.length?fgt(e,t.clientX):Su(r.text,e.state.tabSize,n-r.from);return{line:r.number,col:s,off:i}}function hgt(e,t){let n=aZ(e,t),r=e.state.selection;return n?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(n.line).from),a=i.state.doc.lineAt(s);n={line:a.number,col:n.col,off:Math.min(n.off,a.length)},r=r.map(i.changes)}},get(i,s,a){let l=aZ(e,i);if(!l)return r;let c=dgt(e.state,n,l);return c.length?a?tt.create(c.concat(r.ranges)):tt.create(c):r}}:null}function pgt(e){let t=n=>n.altKey&&n.button==0;return Ct.mouseSelectionStyle.of((n,r)=>t(r)?hgt(n,r):null)}const mgt={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},ggt={style:"cursor: crosshair"};function bgt(e={}){let[t,n]=mgt[e.key||"Alt"],r=ms.fromClass(class{constructor(i){this.view=i,this.isDown=!1}set(i){this.isDown!=i&&(this.isDown=i,this.view.update([]))}},{eventObservers:{keydown(i){this.set(i.keyCode==t||n(i))},keyup(i){(i.keyCode==t||!n(i))&&this.set(!1)},mousemove(i){this.set(n(i))}}});return[r,Ct.contentAttributes.of(i=>{var s;return!((s=i.plugin(r))===null||s===void 0)&&s.isDown?ggt:null})]}const Y2="-10000px";class Fye{constructor(t,n,r,i){this.facet=n,this.createTooltipView=r,this.removeTooltipView=i,this.input=t.state.facet(n),this.tooltips=this.input.filter(a=>a);let s=null;this.tooltipViews=this.tooltips.map(a=>s=r(a,s))}update(t,n){var r;let i=t.state.facet(this.facet),s=i.filter(c=>c);if(i===this.input){for(let c of this.tooltipViews)c.update&&c.update(t);return!1}let a=[],l=n?[]:null;for(let c=0;cn[u]=c),n.length=l.length),this.input=i,this.tooltips=s,this.tooltipViews=a,!0}}function ygt(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const HD=Qt.define({combine:e=>{var t,n,r;return{position:Bt.ios?"absolute":((t=e.find(i=>i.position))===null||t===void 0?void 0:t.position)||"fixed",parent:((n=e.find(i=>i.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=e.find(i=>i.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||ygt}}}),oZ=new WeakMap,SQ=ms.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(HD);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Fye(e,EQ,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,r=e.state.facet(HD);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),r=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",n.dom.appendChild(i)}return n.dom.style.position=this.position,n.dom.style.top=Y2,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(e=r.destroy)===null||e===void 0||e.call(r);this.parent&&this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(Bt.safari){let a=s.getBoundingClientRect();n=Math.abs(a.top+1e4)>1||Math.abs(a.left)>1}else n=!!s.offsetParent&&s.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(e=s.width/this.parent.offsetWidth,t=s.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=OQ(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((s,a)=>{let l=this.manager.tooltipViews[a];return l.getCoords?l.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(HD).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:n,space:r,scaleX:i,scaleY:s}=e,a=[];for(let l=0;l=Math.min(n.bottom,r.bottom)||f.rightMath.min(n.right,r.right)+.1)){d.style.top=Y2;continue}let m=c.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,g=m?7:0,b=h.right-h.left,y=(t=oZ.get(u))!==null&&t!==void 0?t:h.bottom-h.top,O=u.offset||xgt,v=this.view.textDirection==wi.LTR,x=h.width>r.right-r.left?v?r.left:r.right-h.width:v?Math.max(r.left,Math.min(f.left-(m?14:0)+O.x,r.right-b)):Math.min(Math.max(r.left,f.left-b+(m?14:0)-O.x),r.right-b),w=this.above[l];!c.strictSide&&(w?f.top-y-g-O.yr.bottom)&&w==r.bottom-f.bottom>f.top-r.top&&(w=this.above[l]=!w);let S=(w?f.top-r.top:r.bottom-f.bottom)-g;if(Sx&&_.topE&&(E=w?_.top-y-2-g:_.bottom+g+2);if(this.position=="absolute"?(d.style.top=(E-e.parent.top)/s+"px",lZ(d,(x-e.parent.left)/i)):(d.style.top=E/s+"px",lZ(d,x/i)),m){let _=f.left+(v?O.x:-O.x)-(x+14-7);m.style.left=_/i+"px"}u.overlap!==!0&&a.push({left:x,top:E,right:k,bottom:E+y}),d.classList.toggle("cm-tooltip-above",w),d.classList.toggle("cm-tooltip-below",!w),u.positioned&&u.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=Y2}},{eventObservers:{scroll(){this.maybeMeasure()}}});function lZ(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const Ogt=Ct.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),xgt={x:0,y:0},EQ=Qt.define({enables:[SQ,Ogt]}),wA=Qt.define({combine:e=>e.reduce((t,n)=>t.concat(n),[])});class rR{static create(t){return new rR(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Fye(t,wA,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(t,n){let r=t.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(t){for(let n of this.manager.tooltipViews)n.mount&&n.mount(t);this.mounted=!0}positioned(t){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(t)}update(t){this.manager.update(t)}destroy(){var t;for(let n of this.manager.tooltipViews)(t=n.destroy)===null||t===void 0||t.call(n)}passProp(t){let n;for(let r of this.manager.tooltipViews){let i=r[t];if(i!==void 0){if(n===void 0)n=i;else if(n!==i)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const vgt=EQ.compute([wA],e=>{let t=e.facet(wA);return t.length===0?null:{pos:Math.min(...t.map(n=>n.pos)),end:Math.max(...t.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:rR.create,above:t[0].above,arrow:t.some(n=>n.arrow)}}),zye=Qt.define();class wgt{constructor(t,n,r,i,s,a){this.view=t,this.source=n,this.field=r,this.locked=i,this.setHover=s,this.hoverTime=a,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(t){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let t=Date.now()-this.lastMove.time;ta.bottom||n.xa.right+t.defaultCharacterWidth)return;let l=t.bidiSpans(t.state.doc.lineAt(i)).find(u=>u.from<=i&&u.to>=i),c=l&&l.dir==wi.RTL?-1:1;s=n.x{if(l&&!(Array.isArray(l)&&!l.length)){let c=Array.isArray(l)?l:[l];i&&this.locked.set(c,i),t.dispatch({effects:this.setHover.of(c)})}};if(s&&"then"in s){let l=this.pending={pos:n};s.then(c=>{this.pending==l&&(this.pending=null,a(c))},c=>Xo(t.state,c,"hover tooltip"))}else a(s)}get tooltip(){let t=this.view.plugin(SQ),n=t?t.manager.tooltips.findIndex(r=>r.create==rR.create):-1;return n>-1?t.manager.tooltipViews[n]:null}mousemove(t){var n,r;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:s}=this;if(i.length&&!this.locked.has(i)&&s&&!Sgt(s.dom,t)||this.pending){let{pos:a}=i[0]||this.pending,l=(r=(n=i[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:a;(a==l?this.view.posAtCoords(this.lastMove)!=a:!Egt(this.view,a,l,t.clientX,t.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length&&!this.locked.has(n)){let{tooltip:r}=this;r&&r.dom.contains(t.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(t){let n=r=>{t.removeEventListener("mouseleave",n);let{active:i}=this;i.length&&!this.locked.has(i)&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};t.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Z2=4;function Sgt(e,t){let{left:n,right:r,top:i,bottom:s}=e.getBoundingClientRect(),a;if(a=e.querySelector(".cm-tooltip-arrow")){let l=a.getBoundingClientRect();i=Math.min(l.top,i),s=Math.max(l.bottom,s)}return t.clientX>=n-Z2&&t.clientX<=r+Z2&&t.clientY>=i-Z2&&t.clientY<=s+Z2}function Egt(e,t,n,r,i,s){let a=e.scrollDOM.getBoundingClientRect(),l=e.documentTop+e.documentPadding.top+e.contentHeight;if(a.left>r||a.righti||Math.min(a.bottom,l)=t&&c<=n}function kgt(e,t={}){let n=jn.define(),r=new WeakMap,i=Ba.define({create(){return[]},update(a,l){let c=r.get(a);if(a.length&&(t.hideOnChange&&(l.docChanged||l.selection)?a=[]:c&&c(l)?a=[]:t.hideOn&&(a=a.filter(u=>!t.hideOn(l,u)))),l.docChanged&&a.length){let u=[];for(let d of a){let f=l.changes.mapPos(d.pos,-1,Da.TrackDel);if(f!=null){let h=Object.assign(Object.create(null),d);h.pos=f,h.end!=null&&(h.end=l.changes.mapPos(h.end)),u.push(h)}}a=u}for(let u of l.effects)u.is(n)&&(a=u.value,c=void 0),(u.is(Tgt)&&!u.value||u.value==i)&&(a=[]);return a.length&&c&&r.set(a,c),a},provide:a=>wA.from(a)});const s=ms.define(a=>new wgt(a,e,i,r,n,t.hoverTime||300));return{active:i,extension:[i,s,zye.of(s),vgt]}}function _gt(e,t,n,r={}){var i;let s=e.state.facet(zye).map(a=>e.plugin(a)).filter(a=>!!a);if(r.tooltip&&r.tooltip.active){let a=s.find(l=>l.field==r.tooltip.active);a&&(s=[a])}for(let a of s)a.activateHover(e,t,n,(i=r.until)!==null&&i!==void 0?i:()=>!1)}function Vye(e,t){let n=e.plugin(SQ);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}const Tgt=jn.define(),cZ=Qt.define({combine(e){let t,n;for(let r of e)t=t||r.topContainer,n=n||r.bottomContainer;return{topContainer:t,bottomContainer:n}}});function kQ(e,t){let n=e.plugin(Hye),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}const Hye=ms.fromClass(class{constructor(e){this.input=e.state.facet(uS),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(e));let t=e.state.facet(cZ);this.top=new K2(e,!0,t.topContainer),this.bottom=new K2(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(e){let t=e.state.facet(cZ);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new K2(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new K2(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(uS);if(n!=this.input){let r=n.filter(c=>c),i=[],s=[],a=[],l=[];for(let c of r){let u=this.specs.indexOf(c),d;u<0?(d=c(e.view),l.push(d)):(d=this.panels[u],d.update&&d.update(e)),i.push(d),(d.top?s:a).push(d)}this.specs=r,this.panels=i,this.top.sync(s),this.bottom.sync(a);for(let c of l)c.dom.classList.add("cm-panel"),c.mount&&c.mount()}else for(let r of this.panels)r.update&&r.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>Ct.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class K2{constructor(t,n,r){this.view=t,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(t){for(let n of this.panels)n.destroy&&t.indexOf(n)<0&&n.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let t=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;t!=n.dom;)t=uZ(t);t=t.nextSibling}else this.dom.insertBefore(n.dom,t);for(;t;)t=uZ(t)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let t of this.classes.split(" "))t&&this.container.classList.remove(t);for(let t of(this.classes=this.view.themeClasses).split(" "))t&&this.container.classList.add(t)}}}function uZ(e){let t=e.nextSibling;return e.remove(),t}const uS=Qt.define({enables:Hye});function Cgt(e,t){let n,r=new Promise(a=>n=a),i=a=>Agt(a,t,n);e.state.field(qD,!1)?e.dispatch({effects:qye.of(i)}):e.dispatch({effects:jn.appendConfig.of(qD.init(()=>[i]))});let s=Xye.of(i);return{close:s,result:r.then(a=>((e.win.queueMicrotask||(c=>e.win.setTimeout(c,10)))(()=>{e.state.field(qD).indexOf(i)>-1&&e.dispatch({effects:s})}),a))}}const qD=Ba.define({create(){return[]},update(e,t){for(let n of t.effects)n.is(qye)?e=[n.value].concat(e):n.is(Xye)&&(e=e.filter(r=>r!=n.value));return e},provide:e=>uS.computeN([e],t=>t.field(e))}),qye=jn.define(),Xye=jn.define();function Agt(e,t,n){let r=t.content?t.content(e,()=>a(null)):null;if(!r){if(r=mi("form"),t.input){let l=mi("input",t.input);/^(text|password|number|email|tel|url)$/.test(l.type)&&l.classList.add("cm-textfield"),l.name||(l.name="input"),r.appendChild(mi("label",(t.label||"")+": ",l))}else r.appendChild(document.createTextNode(t.label||""));r.appendChild(document.createTextNode(" ")),r.appendChild(mi("button",{class:"cm-button",type:"submit"},t.submitLabel||"OK"))}let i=r.nodeName=="FORM"?[r]:r.querySelectorAll("form");for(let l=0;l{u.keyCode==27?(u.preventDefault(),a(null)):u.keyCode==13&&(u.preventDefault(),a(c))}),c.addEventListener("submit",u=>{u.preventDefault(),a(c)})}let s=mi("div",r,mi("button",{onclick:()=>a(null),"aria-label":e.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));t.class&&(s.className=t.class),s.classList.add("cm-dialog");function a(l){s.contains(s.ownerDocument.activeElement)&&e.focus(),n(l)}return{dom:s,top:t.top,mount:()=>{if(t.focus){let l;typeof t.focus=="string"?l=r.querySelector(t.focus):l=r.querySelector("input")||r.querySelector("button"),l&&"select"in l?l.select():l&&"focus"in l&&l.focus()}}}}class oh extends Kp{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}oh.prototype.elementClass="";oh.prototype.toDOM=void 0;oh.prototype.mapMode=Da.TrackBefore;oh.prototype.startSide=oh.prototype.endSide=-1;oh.prototype.point=!0;const vT=Qt.define(),Ngt=Qt.define(),jgt={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>gr.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Zv=Qt.define();function Rgt(e){return[Gye(),Zv.of({...jgt,...e})]}const dZ=Qt.define({combine:e=>e.some(t=>t)});function Gye(e){return[Igt]}const Igt=ms.fromClass(class{constructor(e){this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(Zv).map(t=>new hZ(e,t)),this.fixed=!e.state.facet(dZ);for(let t of this.gutters)t.config.side=="after"?this.getDOMAfter().appendChild(t.dom):this.dom.appendChild(t.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,r=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(e.geometryChanged){let t=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=t,this.domAfter&&(this.domAfter.style.minHeight=t)}this.view.state.facet(dZ)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=gr.iter(this.view.state.facet(vT),this.view.viewport.from),r=[],i=this.gutters.map(s=>new Dgt(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(s.type)){let a=!0;for(let l of s.type)if(l.type==$a.Text&&a){d6(n,r,l.from);for(let c of i)c.line(this.view,l,r);a=!1}else if(l.widget)for(let c of i)c.widget(this.view,l)}else if(s.type==$a.Text){d6(n,r,s.from);for(let a of i)a.line(this.view,s,r)}else if(s.widget)for(let a of i)a.widget(this.view,s);for(let s of i)s.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let t=e.startState.facet(Zv),n=e.state.facet(Zv),r=e.docChanged||e.heightChanged||e.viewportChanged||!gr.eq(e.startState.facet(vT),e.state.facet(vT),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let i of this.gutters)i.update(e)&&(r=!0);else{r=!0;let i=[];for(let s of n){let a=t.indexOf(s);a<0?i.push(new hZ(this.view,s)):(this.gutters[a].update(e),i.push(this.gutters[a]))}for(let s of this.gutters)s.dom.remove(),i.indexOf(s)<0&&s.destroy();for(let s of i)s.config.side=="after"?this.getDOMAfter().appendChild(s.dom):this.dom.appendChild(s.dom);this.gutters=i}return r}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>Ct.scrollMargins.of(t=>{let n=t.plugin(e);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*t.scaleX,i=n.domAfter?n.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==wi.LTR?{left:r,right:i}:{right:r,left:i}})});function fZ(e){return Array.isArray(e)?e:[e]}function d6(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class Dgt{constructor(t,n,r){this.gutter=t,this.height=r,this.i=0,this.cursor=gr.iter(t.markers,n.from)}addElement(t,n,r){let{gutter:i}=this,s=(n.top-this.height)/t.scaleY,a=n.height/t.scaleY;if(this.i==i.elements.length){let l=new Wye(t,a,s,r);i.elements.push(l),i.dom.appendChild(l.dom)}else i.elements[this.i].update(t,a,s,r);this.height=n.bottom,this.i++}line(t,n,r){let i=[];d6(this.cursor,i,n.from),r.length&&(i=i.concat(r));let s=this.gutter.config.lineMarker(t,n,i);s&&i.unshift(s);let a=this.gutter;i.length==0&&!a.config.renderEmptyElements||this.addElement(t,n,i)}widget(t,n){let r=this.gutter.config.widgetMarker(t,n.widget,n),i=r?[r]:null;for(let s of t.state.facet(Ngt)){let a=s(t,n.widget,n);a&&(i||(i=[])).push(a)}i&&this.addElement(t,n,i)}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let n=t.elements.pop();t.dom.removeChild(n.dom),n.destroy()}}}class hZ{constructor(t,n){this.view=t,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,i=>{let s=i.target,a;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let c=s.getBoundingClientRect();a=(c.top+c.bottom)/2}else a=i.clientY;let l=t.lineBlockAtHeight(a-t.documentTop);n.domEventHandlers[r](t,l,i)&&i.preventDefault()});this.markers=fZ(n.markers(t)),n.initialSpacer&&(this.spacer=new Wye(t,0,0,[n.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(t){let n=this.markers;if(this.markers=fZ(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let i=this.config.updateSpacer(this.spacer.markers[0],t);i!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[i])}let r=t.view.viewport;return!gr.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(t):!1)}destroy(){for(let t of this.elements)t.destroy()}}class Wye{constructor(t,n,r,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,n,r,i)}update(t,n,r,i){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),Pgt(this.markers,i)||this.setMarkers(t,i)}setMarkers(t,n){let r="cm-gutterElement",i=this.dom.firstChild;for(let s=0,a=0;;){let l=a,c=ss(l,c,u)||a(l,c,u):a}return r}})}});class XD extends oh{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function GD(e,t){return e.state.facet(Jb).formatNumber(t,e.state)}const $gt=Zv.compute([Jb],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(t){return t.state.facet(Mgt)},lineMarker(t,n,r){return r.some(i=>i.toDOM)?null:new XD(GD(t,t.state.doc.lineAt(n.from).number))},widgetMarker:(t,n,r)=>{for(let i of t.state.facet(Lgt)){let s=i(t,n,r);if(s)return s}return null},lineMarkerChange:t=>t.startState.facet(Jb)!=t.state.facet(Jb),initialSpacer(t){return new XD(GD(t,pZ(t.state.doc.lines)))},updateSpacer(t,n){let r=GD(n.view,pZ(n.view.state.doc.lines));return r==t.number?t:new XD(r)},domEventHandlers:e.facet(Jb).domEventHandlers,side:"before"}));function Bgt(e={}){return[Jb.of(e),Gye(),$gt]}function pZ(e){let t=9;for(;t{let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.head).from;i>n&&(n=i,t.push(Qgt.range(i)))}return gr.of(t)});function Fgt(){return Ugt}let zgt=0,Wu=class f6{constructor(t,n,r,i){this.name=t,this.set=n,this.base=r,this.modified=i,this.id=zgt++}toString(){let{name:t}=this;for(let n of this.modified)n.name&&(t=`${n.name}(${t})`);return t}static define(t,n){let r=typeof t=="string"?t:"?";if(t instanceof f6&&(n=t),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let i=new f6(r,[],null,[]);if(i.set.push(i),n)for(let s of n.set)i.set.push(s);return i}static defineModifier(t){let n=new SA(t);return r=>r.modified.indexOf(n)>-1?r:SA.get(r.base||r,r.modified.concat(n).sort((i,s)=>i.id-s.id))}},Vgt=0;class SA{constructor(t){this.name=t,this.instances=[],this.id=Vgt++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(l=>l.base==t&&Hgt(n,l.modified));if(r)return r;let i=[],s=new Wu(t.name,i,t,n);for(let l of n)l.instances.push(s);let a=qgt(n);for(let l of t.set)if(!l.modified.length)for(let c of a)i.push(SA.get(l,c));return s}}function Hgt(e,t){return e.length==t.length&&e.every((n,r)=>n==t[r])}function qgt(e){let t=[[]];for(let n=0;nr.length-n.length)}function vh(e){let t=Object.create(null);for(let n in e){let r=e[n];Array.isArray(r)||(r=[r]);for(let i of n.split(" "))if(i){let s=[],a=2,l=i;for(let f=0;;){if(l=="..."&&f>0&&f+3==i.length){a=1;break}let h=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!h)throw new RangeError("Invalid path: "+i);if(s.push(h[0]=="*"?"":h[0][0]=='"'?JSON.parse(h[0]):h[0]),f+=h[0].length,f==i.length)break;let m=i[f++];if(f==i.length&&m=="!"){a=0;break}if(m!="/")throw new RangeError("Invalid path: "+i);l=i.slice(f)}let c=s.length-1,u=s[c];if(!u)throw new RangeError("Invalid path: "+i);let d=new dS(r,a,c>0?s.slice(0,c):null);t[u]=d.sort(t[u])}}return Yye.add(t)}const Yye=new An({combine(e,t){let n,r,i;for(;e||t;){if(!e||t&&e.depth>=t.depth?(i=t,t=t.next):(i=e,e=e.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let s=new dS(i.tags,i.mode,i.context);n?n.next=s:r=s,n=s}return r}});let dS=class{constructor(t,n,r,i){this.tags=t,this.mode=n,this.context=r,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth{let a=i;for(let l of s)for(let c of l.set){let u=n[c.id];if(u){a=a?a+" "+u:u;break}}return a},scope:r}}function Xgt(e,t){let n=null;for(let r of e){let i=r.style(t);i&&(n=n?n+" "+i:i)}return n}function Ggt(e,t,n,r=0,i=e.length){let s=new Wgt(r,Array.isArray(t)?t:[t],n);s.highlightRange(e.cursor(),r,i,"",s.highlighters),s.flush(i)}class Wgt{constructor(t,n,r){this.at=t,this.highlighters=n,this.span=r,this.class=""}startSpan(t,n){n!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=n)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,n,r,i,s){let{type:a,from:l,to:c}=t;if(l>=r||c<=n)return;a.isTop&&(s=this.highlighters.filter(m=>!m.scope||m.scope(a)));let u=i,d=Ygt(t)||dS.empty,f=Xgt(s,d.tags);if(f&&(u&&(u+=" "),u+=f,d.mode==1&&(i+=(i?" ":"")+f)),this.startSpan(Math.max(n,l),u),d.opaque)return;let h=t.tree&&t.tree.prop(An.mounted);if(h&&h.overlay){let m=t.node.enter(h.overlay[0].from+l,1),g=this.highlighters.filter(y=>!y.scope||y.scope(h.tree.type)),b=t.firstChild();for(let y=0,O=l;;y++){let v=y=x||!t.nextSibling())););if(!v||x>r)break;O=v.to+l,O>n&&(this.highlightRange(m.cursor(),Math.max(n,v.from+l),Math.min(r,O),"",g),this.startSpan(Math.min(r,O),u))}b&&t.parent()}else if(t.firstChild()){h&&(i="");do if(!(t.to<=n)){if(t.from>=r)break;this.highlightRange(t,n,r,i,s),this.startSpan(Math.min(r,t.to),u)}while(t.nextSibling());t.parent()}}}function Ygt(e){let t=e.type.prop(Yye);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}const Dt=Wu.define,J2=Dt(),Kh=Dt(),mZ=Dt(Kh),gZ=Dt(Kh),Jh=Dt(),e_=Dt(Jh),WD=Dt(Jh),Hu=Dt(),Nm=Dt(Hu),Fu=Dt(),zu=Dt(),h6=Dt(),mx=Dt(h6),t_=Dt(),Z={comment:J2,lineComment:Dt(J2),blockComment:Dt(J2),docComment:Dt(J2),name:Kh,variableName:Dt(Kh),typeName:mZ,tagName:Dt(mZ),propertyName:gZ,attributeName:Dt(gZ),className:Dt(Kh),labelName:Dt(Kh),namespace:Dt(Kh),macroName:Dt(Kh),literal:Jh,string:e_,docString:Dt(e_),character:Dt(e_),attributeValue:Dt(e_),number:WD,integer:Dt(WD),float:Dt(WD),bool:Dt(Jh),regexp:Dt(Jh),escape:Dt(Jh),color:Dt(Jh),url:Dt(Jh),keyword:Fu,self:Dt(Fu),null:Dt(Fu),atom:Dt(Fu),unit:Dt(Fu),modifier:Dt(Fu),operatorKeyword:Dt(Fu),controlKeyword:Dt(Fu),definitionKeyword:Dt(Fu),moduleKeyword:Dt(Fu),operator:zu,derefOperator:Dt(zu),arithmeticOperator:Dt(zu),logicOperator:Dt(zu),bitwiseOperator:Dt(zu),compareOperator:Dt(zu),updateOperator:Dt(zu),definitionOperator:Dt(zu),typeOperator:Dt(zu),controlOperator:Dt(zu),punctuation:h6,separator:Dt(h6),bracket:mx,angleBracket:Dt(mx),squareBracket:Dt(mx),paren:Dt(mx),brace:Dt(mx),content:Hu,heading:Nm,heading1:Dt(Nm),heading2:Dt(Nm),heading3:Dt(Nm),heading4:Dt(Nm),heading5:Dt(Nm),heading6:Dt(Nm),contentSeparator:Dt(Hu),list:Dt(Hu),quote:Dt(Hu),emphasis:Dt(Hu),strong:Dt(Hu),link:Dt(Hu),monospace:Dt(Hu),strikethrough:Dt(Hu),inserted:Dt(),deleted:Dt(),changed:Dt(),invalid:Dt(),meta:t_,documentMeta:Dt(t_),annotation:Dt(t_),processingInstruction:Dt(t_),definition:Wu.defineModifier("definition"),constant:Wu.defineModifier("constant"),function:Wu.defineModifier("function"),standard:Wu.defineModifier("standard"),local:Wu.defineModifier("local"),special:Wu.defineModifier("special")};for(let e in Z){let t=Z[e];t instanceof Wu&&(t.name=e)}Zye([{tag:Z.link,class:"tok-link"},{tag:Z.heading,class:"tok-heading"},{tag:Z.emphasis,class:"tok-emphasis"},{tag:Z.strong,class:"tok-strong"},{tag:Z.keyword,class:"tok-keyword"},{tag:Z.atom,class:"tok-atom"},{tag:Z.bool,class:"tok-bool"},{tag:Z.url,class:"tok-url"},{tag:Z.labelName,class:"tok-labelName"},{tag:Z.inserted,class:"tok-inserted"},{tag:Z.deleted,class:"tok-deleted"},{tag:Z.literal,class:"tok-literal"},{tag:Z.string,class:"tok-string"},{tag:Z.number,class:"tok-number"},{tag:[Z.regexp,Z.escape,Z.special(Z.string)],class:"tok-string2"},{tag:Z.variableName,class:"tok-variableName"},{tag:Z.local(Z.variableName),class:"tok-variableName tok-local"},{tag:Z.definition(Z.variableName),class:"tok-variableName tok-definition"},{tag:Z.special(Z.variableName),class:"tok-variableName2"},{tag:Z.definition(Z.propertyName),class:"tok-propertyName tok-definition"},{tag:Z.typeName,class:"tok-typeName"},{tag:Z.namespace,class:"tok-namespace"},{tag:Z.className,class:"tok-className"},{tag:Z.macroName,class:"tok-macroName"},{tag:Z.propertyName,class:"tok-propertyName"},{tag:Z.operator,class:"tok-operator"},{tag:Z.comment,class:"tok-comment"},{tag:Z.meta,class:"tok-meta"},{tag:Z.invalid,class:"tok-invalid"},{tag:Z.punctuation,class:"tok-punctuation"}]);var YD;const bp=new An;function iR(e){return Qt.define({combine:e?t=>t.concat(e):void 0})}const _Q=new An;class Al{constructor(t,n,r=[],i=""){this.data=t,this.name=i,xr.prototype.hasOwnProperty("tree")||Object.defineProperty(xr.prototype,"tree",{get(){return yi(this)}}),this.parser=n,this.extension=[nm.of(this),xr.languageData.of((s,a,l)=>{let c=bZ(s,a,l),u=c.type.prop(bp);if(!u)return[];let d=s.facet(u),f=c.type.prop(_Q);if(f){let h=c.resolve(a-c.from,l);for(let m of f)if(m.test(h,s)){let g=s.facet(m.facet);return m.type=="replace"?g:g.concat(d)}}return d})].concat(r)}isActiveAt(t,n,r=-1){return bZ(t,n,r).type.prop(bp)==this.data}findRegions(t){let n=t.facet(nm);if((n==null?void 0:n.data)==this.data)return[{from:0,to:t.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],i=(s,a)=>{if(s.prop(bp)==this.data){r.push({from:a,to:a+s.length});return}let l=s.prop(An.mounted);if(l){if(l.tree.prop(bp)==this.data){if(l.overlay)for(let c of l.overlay)r.push({from:c.from+a,to:c.to+a});else r.push({from:a,to:a+s.length});return}else if(l.overlay){let c=r.length;if(i(l.tree,l.overlay[0].from+a),r.length>c)return}}for(let c=0;cr.isTop?n:void 0)]}),t.name)}configure(t,n){return new lh(this.data,this.parser.configure(t),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function yi(e){let t=e.field(Al.state,!1);return t?t.tree:lr.empty}class Zgt{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,n){let r=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,n):this.string.slice(t-r,n-r)}}let gx=null;class Zg{constructor(t,n,r=[],i,s,a,l,c){this.parser=t,this.state=n,this.fragments=r,this.tree=i,this.treeLen=s,this.viewport=a,this.skipped=l,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(t,n,r){return new Zg(t,n,[],lr.empty,0,r,[],null)}startParse(){return this.parser.startParse(new Zgt(this.state.doc),this.fragments)}work(t,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=lr.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof t=="number"){let i=Date.now()+t;t=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=t,this.tree=n,this.fragments=this.withoutTempSkipped(Uf.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let n=gx;gx=this;try{return t()}finally{gx=n}}withoutTempSkipped(t){for(let n;n=this.tempSkipped.pop();)t=yZ(t,n.from,n.to);return t}changes(t,n){let{fragments:r,tree:i,treeLen:s,viewport:a,skipped:l}=this;if(this.takeTree(),!t.empty){let c=[];if(t.iterChangedRanges((u,d,f,h)=>c.push({fromA:u,toA:d,fromB:f,toB:h})),r=Uf.applyChanges(r,c),i=lr.empty,s=0,a={from:t.mapPos(a.from,-1),to:t.mapPos(a.to,1)},this.skipped.length){l=[];for(let u of this.skipped){let d=t.mapPos(u.from,1),f=t.mapPos(u.to,-1);dt.from&&(this.fragments=yZ(this.fragments,i,s),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,n){this.skipped.push({from:t,to:n})}static getSkippingParser(t){return new class extends Yj{createParse(n,r,i){let s=i[0].from,a=i[i.length-1].to;return{parsedPos:s,advance(){let c=gx;if(c){for(let u of i)c.tempSkipped.push(u);t&&(c.scheduleOn=c.scheduleOn?Promise.all([c.scheduleOn,t]):t)}return this.parsedPos=a,new lr(Fs.none,[],[],a-s)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let n=this.fragments;return this.treeLen>=t&&n.length&&n[0].from==0&&n[0].to>=t}static get(){return gx}}function yZ(e,t,n){return Uf.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class S1{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(t.changes,t.state),r=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new S1(n)}static init(t){let n=Math.min(3e3,t.doc.length),r=Zg.create(t.facet(nm).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new S1(r)}}Al.state=Ba.define({create:S1.init,update(e,t){for(let n of t.effects)if(n.is(Al.setState))return n.value;return t.startState.facet(nm)!=t.state.facet(nm)?S1.init(t.state):e.apply(t)}});let Kye=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(Kye=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const ZD=typeof navigator<"u"&&(!((YD=navigator.scheduling)===null||YD===void 0)&&YD.isInputPending)?()=>navigator.scheduling.isInputPending():null,Kgt=ms.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let n=this.view.state.field(Al.state).context;(n.updateViewport(t.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:t}=this.view,n=t.field(Al.state);(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))&&(this.working=Kye(this.work))}work(t){this.working=null;let n=Date.now();if(this.chunkEndi+1e3,c=s.context.work(()=>ZD&&ZD()||Date.now()>a,i+(l?0:1e5));this.chunkBudget-=Date.now()-n,(c||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Al.setState.of(new S1(s.context))})),this.chunkBudget>0&&!(c&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(n=>Xo(this.view.state,n)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),nm=Qt.define({combine(e){return e.length?e[0]:null},enables:e=>[Al.state,Kgt,Ct.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]});class rm{constructor(t,n=[]){this.language=t,this.support=n,this.extension=[t,n]}}class EA{constructor(t,n,r,i,s,a=void 0){this.name=t,this.alias=n,this.extensions=r,this.filename=i,this.loadFunc=s,this.support=a,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(t=>this.support=t,t=>{throw this.loading=null,t}))}static of(t){let{load:n,support:r}=t;if(!n){if(!r)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");n=()=>Promise.resolve(r)}return new EA(t.name,(t.alias||[]).concat(t.name).map(i=>i.toLowerCase()),t.extensions||[],t.filename,n,r)}static matchFilename(t,n){for(let i of t)if(i.filename&&i.filename.test(n))return i;let r=/\.([^.]+)$/.exec(n);if(r){for(let i of t)if(i.extensions.indexOf(r[1])>-1)return i}return null}static matchLanguageName(t,n,r=!0){n=n.toLowerCase();for(let i of t)if(i.alias.some(s=>s==n))return i;if(r)for(let i of t)for(let s of i.alias){let a=n.indexOf(s);if(a>-1&&(s.length>2||!/\w/.test(n[a-1])&&!/\w/.test(n[a+s.length])))return i}return null}}const Jgt=Qt.define(),OO=Qt.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(n=>n!=t[0]))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function Kg(e){let t=e.facet(OO);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function fS(e,t){let n="",r=e.tabSize,i=e.facet(OO)[0];if(i==" "){for(;t>=r;)n+=" ",t-=r;i=" "}for(let s=0;s=t?e0t(e,n,t):null}class sR{constructor(t,n={}){this.state=t,this.options=n,this.unit=Kg(t)}lineAt(t,n=1){let r=this.state.doc.lineAt(t),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=r.from&&i<=r.to?s&&i==t?{text:"",from:t}:(n<0?i-1&&(s+=a-this.countColumn(r,r.search(/\S|$/))),s}countColumn(t,n=t.length){return Su(t,this.state.tabSize,n)}lineIndent(t,n=1){let{text:r,from:i}=this.lineAt(t,n),s=this.options.overrideIndentation;if(s){let a=s(i);if(a>-1)return a}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const wh=new An;function e0t(e,t,n){let r=t.resolveStack(n),i=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let s=[];for(let a=i;a&&!(a.fromr.node.to||a.from==r.node.from&&a.type==r.node.type);a=a.parent)s.push(a);for(let a=s.length-1;a>=0;a--)r={node:s[a],next:r}}return Jye(r,e,n)}function Jye(e,t,n){for(let r=e;r;r=r.next){let i=n0t(r.node);if(i)return i(CQ.create(t,n,r))}return 0}function t0t(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function n0t(e){let t=e.type.prop(wh);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(An.closedBy))){let i=e.lastChild,s=i&&r.indexOf(i.name)>-1;return a=>e1e(a,!0,1,void 0,s&&!t0t(a)?i.from:void 0)}return e.parent==null?r0t:null}function r0t(){return 0}class CQ extends sR{constructor(t,n,r){super(t.state,t.options),this.base=t,this.pos=n,this.context=r}get node(){return this.context.node}static create(t,n,r){return new CQ(t,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let n=this.state.doc.lineAt(t.from);for(;;){let r=t.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(i0t(r,t))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return Jye(this.context.next,this.base,this.pos)}}function i0t(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function s0t(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let i=e.options.simulateBreak,s=e.state.doc.lineAt(n.from),a=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let l=n.to;;){let c=t.childAfter(l);if(!c||c==r)return null;if(!c.type.isSkipped){if(c.from>=a)return null;let u=/^ */.exec(s.text.slice(n.to-s.from))[0].length;return{from:n.from,to:n.to+u}}l=c.to}}function Cy({closing:e,align:t=!0,units:n=1}){return r=>e1e(r,t,n,e)}function e1e(e,t,n,r,i){let s=e.textAfter,a=s.match(/^\s*/)[0].length,l=r&&s.slice(a,a+r.length)==r||i==e.pos+a,c=t?s0t(e):null;return c?l?e.column(c.from):e.column(c.to):e.baseIndent+(l?0:e.unit*n)}const a0t=e=>e.baseIndent;function Ay({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}const o0t=200;function l0t(){return xr.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:r}=e.newSelection.main,i=n.lineAt(r);if(r>i.from+o0t)return e;let s=n.sliceString(i.from,r);if(!t.some(u=>u.test(s)))return e;let{state:a}=e,l=-1,c=[];for(let{head:u}of a.selection.ranges){let d=a.doc.lineAt(u);if(d.from==l)continue;l=d.from;let f=TQ(a,d.from);if(f==null)continue;let h=/^\s*/.exec(d.text)[0],m=fS(a,f);h!=m&&c.push({from:d.from,to:d.from+h.length,insert:m})}return c.length?[e,{changes:c,sequential:!0}]:e})}const t1e=Qt.define(),Sh=new An;function UE(e){let t=e.firstChild,n=e.lastChild;return t&&t.ton)continue;if(s&&l.from=t&&u.to>n&&(s=u)}}return s}function u0t(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function kA(e,t,n){for(let r of e.facet(t1e)){let i=r(e,t,n);if(i)return i}return c0t(e,t,n)}function n1e(e,t){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);return n>=r?void 0:{from:n,to:r}}const aR=jn.define({map:n1e}),FE=jn.define({map:n1e});function r1e(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(r=>r.from<=n&&r.to>=n)||t.push(e.lineBlockAt(n));return t}const Jg=Ba.define({create(){return ln.none},update(e,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges((r,i)=>e=OZ(e,r,i)),e=e.map(t.changes);let n=[];for(let r of t.effects)r.is(aR)&&!d0t(e,r.value.from,r.value.to)?n.push(r.value):r.is(FE)&&(e=e.update({filter:(i,s)=>r.value.from!=i||r.value.to!=s,filterFrom:r.value.from,filterTo:r.value.to}));if(n.length){let{preparePlaceholder:r}=t.state.facet(a1e),i=n.map(s=>(r?ln.replace({widget:new y0t(r(t.state,s))}):xZ).range(s.from,s.to));e=e.update({add:i})}return t.selection&&(e=OZ(e,t.selection.main.head)),e},provide:e=>Ct.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(r,i)=>{n.push(r,i)}),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n{it&&(r=!0)}),r?e.update({filterFrom:t,filterTo:n,filter:(i,s)=>i>=n||s<=t}):e}function _A(e,t,n){var r;let i=null;return(r=e.field(Jg,!1))===null||r===void 0||r.between(t,n,(s,a)=>{(!i||i.from>s)&&(i={from:s,to:a})}),i}function d0t(e,t,n){let r=!1;return e.between(t,t,(i,s)=>{i==t&&s==n&&(r=!0)}),r}function i1e(e,t){return e.field(Jg,!1)?t:t.concat(jn.appendConfig.of(o1e()))}const f0t=e=>{for(let t of r1e(e)){let n=kA(e.state,t.from,t.to);if(n)return e.dispatch({effects:i1e(e.state,[aR.of(n),s1e(e,n)])}),!0}return!1},h0t=e=>{if(!e.state.field(Jg,!1))return!1;let t=[];for(let n of r1e(e)){let r=_A(e.state,n.from,n.to);r&&t.push(FE.of(r),s1e(e,r,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function s1e(e,t,n=!0){let r=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return Ct.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${e.state.phrase("to")} ${i}.`)}const p0t=e=>{let{state:t}=e,n=[];for(let r=0;r{let t=e.state.field(Jg,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(r,i)=>{n.push(FE.of({from:r,to:i}))}),e.dispatch({effects:n}),!0},g0t=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:f0t},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:h0t},{key:"Ctrl-Alt-[",run:p0t},{key:"Ctrl-Alt-]",run:m0t}],b0t={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},a1e=Qt.define({combine(e){return Rd(e,b0t)}});function o1e(e){return[Jg,v0t]}function l1e(e,t){let{state:n}=e,r=n.facet(a1e),i=a=>{let l=e.lineBlockAt(e.posAtDOM(a.target)),c=_A(e.state,l.from,l.to);c&&e.dispatch({effects:FE.of(c)}),a.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(e,i,t);let s=document.createElement("span");return s.textContent=r.placeholderText,s.setAttribute("aria-label",n.phrase("folded code")),s.title=n.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}const xZ=ln.replace({widget:new class extends Ru{toDOM(e){return l1e(e,null)}}});class y0t extends Ru{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return l1e(t,this.value)}}const O0t={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class KD extends oh{constructor(t,n){super(),this.config=t,this.open=n}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=t.state.phrase(this.open?"Fold line":"Unfold line"),n}}function x0t(e={}){let t={...O0t,...e},n=new KD(t,!0),r=new KD(t,!1),i=ms.fromClass(class{constructor(a){this.from=a.viewport.from,this.markers=this.buildMarkers(a)}update(a){(a.docChanged||a.viewportChanged||a.startState.facet(nm)!=a.state.facet(nm)||a.startState.field(Jg,!1)!=a.state.field(Jg,!1)||yi(a.startState)!=yi(a.state)||t.foldingChanged(a))&&(this.markers=this.buildMarkers(a.view))}buildMarkers(a){let l=new sh;for(let c of a.viewportLineBlocks){let u=_A(a.state,c.from,c.to)?r:kA(a.state,c.from,c.to)?n:null;u&&l.add(c.from,c.from,u)}return l.finish()}}),{domEventHandlers:s}=t;return[i,Rgt({class:"cm-foldGutter",markers(a){var l;return((l=a.plugin(i))===null||l===void 0?void 0:l.markers)||gr.empty},initialSpacer(){return new KD(t,!1)},domEventHandlers:{...s,click:(a,l,c)=>{if(s.click&&s.click(a,l,c))return!0;let u=_A(a.state,l.from,l.to);if(u)return a.dispatch({effects:FE.of(u)}),!0;let d=kA(a.state,l.from,l.to);return d?(a.dispatch({effects:aR.of(d)}),!0):!1}}}),o1e()]}const v0t=Ct.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class zE{constructor(t,n){this.specs=t;let r;function i(l){let c=Jp.newName();return(r||(r=Object.create(null)))["."+c]=l,c}const s=typeof n.all=="string"?n.all:n.all?i(n.all):void 0,a=n.scope;this.scope=a instanceof Al?l=>l.prop(bp)==a.data:a?l=>l==a:void 0,this.style=Zye(t.map(l=>({tag:l.tag,class:l.class||i(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=r?new Jp(r):null,this.themeType=n.themeType}static define(t,n){return new zE(t,n||{})}}const p6=Qt.define(),c1e=Qt.define({combine(e){return e.length?[e[0]]:null}});function wT(e){let t=e.facet(p6);return t.length?t:e.facet(c1e)}function u1e(e,t){let n=[S0t],r;return e instanceof zE&&(e.module&&n.push(Ct.styleModule.of(e.module)),r=e.themeType),t!=null&&t.fallback?n.push(c1e.of(e)):r?n.push(p6.computeN([Ct.darkTheme],i=>i.facet(Ct.darkTheme)==(r=="dark")?[e]:[])):n.push(p6.of(e)),n}function RMt(e,t,n){let r=wT(e),i=null;if(r){for(let s of r)if(!s.scope||n){let a=s.style(t);a&&(i=i?i+" "+a:a)}}return i}class w0t{constructor(t){this.markCache=Object.create(null),this.tree=yi(t.state),this.decorations=this.buildDeco(t,wT(t.state)),this.decoratedTo=t.viewport.to}update(t){let n=yi(t.state),r=wT(t.state),i=r!=wT(t.startState),{viewport:s}=t.view,a=t.changes.mapPos(this.decoratedTo,1);n.length=s.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=a):(n!=this.tree||t.viewportChanged||i)&&(this.tree=n,this.decorations=this.buildDeco(t.view,r),this.decoratedTo=s.to)}buildDeco(t,n){if(!n||!this.tree.length)return ln.none;let r=new sh;for(let{from:i,to:s}of t.visibleRanges)Ggt(this.tree,n,(a,l,c)=>{r.add(a,l,this.markCache[c]||(this.markCache[c]=ln.mark({class:c})))},i,s);return r.finish()}}const S0t=xh.high(ms.fromClass(w0t,{decorations:e=>e.decorations})),E0t=zE.define([{tag:Z.meta,color:"#404740"},{tag:Z.link,textDecoration:"underline"},{tag:Z.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Z.emphasis,fontStyle:"italic"},{tag:Z.strong,fontWeight:"bold"},{tag:Z.strikethrough,textDecoration:"line-through"},{tag:Z.keyword,color:"#708"},{tag:[Z.atom,Z.bool,Z.url,Z.contentSeparator,Z.labelName],color:"#219"},{tag:[Z.literal,Z.inserted],color:"#164"},{tag:[Z.string,Z.deleted],color:"#a11"},{tag:[Z.regexp,Z.escape,Z.special(Z.string)],color:"#e40"},{tag:Z.definition(Z.variableName),color:"#00f"},{tag:Z.local(Z.variableName),color:"#30a"},{tag:[Z.typeName,Z.namespace],color:"#085"},{tag:Z.className,color:"#167"},{tag:[Z.special(Z.variableName),Z.macroName],color:"#256"},{tag:Z.definition(Z.propertyName),color:"#00c"},{tag:Z.comment,color:"#940"},{tag:Z.invalid,color:"#f00"}]),k0t=Ct.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),d1e=1e4,f1e="()[]{}",h1e=Qt.define({combine(e){return Rd(e,{afterCursor:!0,brackets:f1e,maxScanDistance:d1e,renderMatch:C0t})}}),_0t=ln.mark({class:"cm-matchingBracket"}),T0t=ln.mark({class:"cm-nonmatchingBracket"});function C0t(e){let t=[],n=e.matched?_0t:T0t;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}function vZ(e){let t=[],n=e.facet(h1e);for(let r of e.selection.ranges){if(!r.empty)continue;let i=od(e,r.head,-1,n)||r.head>0&&od(e,r.head-1,1,n)||n.afterCursor&&(od(e,r.head,1,n)||r.heade.decorations}),N0t=[A0t,k0t];function j0t(e={}){return[h1e.of(e),N0t]}const p1e=new An;function m6(e,t,n){let r=e.prop(t<0?An.openedBy:An.closedBy);if(r)return r;if(e.name.length==1){let i=n.indexOf(e.name);if(i>-1&&i%2==(t<0?1:0))return[n[i+t]]}return null}function g6(e){let t=e.type.prop(p1e);return t?t(e.node):e}function od(e,t,n,r={}){let i=r.maxScanDistance||d1e,s=r.brackets||f1e,a=yi(e),l=a.resolveInner(t,n);for(let c=l;c;c=c.parent){let u=m6(c.type,n,s);if(u&&c.from0?t>=d.from&&td.from&&t<=d.to))return R0t(e,t,n,c,d,u,s)}}return I0t(e,t,n,a,l.type,i,s)}function R0t(e,t,n,r,i,s,a){let l=r.parent,c={from:i.from,to:i.to},u=0,d=l==null?void 0:l.cursor();if(d&&(n<0?d.childBefore(r.from):d.childAfter(r.to)))do if(n<0?d.to<=r.from:d.from>=r.to){if(u==0&&s.indexOf(d.type.name)>-1&&d.from0)return null;let u={from:n<0?t-1:t,to:n>0?t+1:t},d=e.doc.iterRange(t,n>0?e.doc.length:0),f=0;for(let h=0;!d.next().done&&h<=s;){let m=d.value;n<0&&(h+=m.length);let g=t+h*n;for(let b=n>0?0:m.length-1,y=n>0?m.length:-1;b!=y;b+=n){let O=a.indexOf(m[b]);if(!(O<0||r.resolveInner(g+b,1).type!=i))if(O%2==0==n>0)f++;else{if(f==1)return{start:u,end:{from:g+b,to:g+b+1},matched:O>>1==c>>1};f--}}n>0&&(h+=m.length)}return d.done?{start:u,matched:!1}:null}function wZ(e,t,n,r=0,i=0){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));let s=i;for(let a=r;a=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.posn}eatSpace(){let t=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t}skipToEnd(){this.pos=this.string.length}skipTo(t){let n=this.string.indexOf(t,this.pos);if(n>-1)return this.pos=n,!0}backUp(t){this.pos-=t}column(){return this.lastColumnPosr?a.toLowerCase():a,s=this.string.substr(this.pos,t.length);return i(s)==i(t)?(n!==!1&&(this.pos+=t.length),!0):null}else{let i=this.string.slice(this.pos).match(t);return i&&i.index>0?null:(i&&n!==!1&&(this.pos+=i[0].length),i)}}current(){return this.string.slice(this.start,this.pos)}}function D0t(e){return{name:e.name||"",token:e.token,blankLine:e.blankLine||(()=>{}),startState:e.startState||(()=>!0),copyState:e.copyState||P0t,indent:e.indent||(()=>null),languageData:e.languageData||{},tokenTable:e.tokenTable||jQ,mergeTokens:e.mergeTokens!==!1}}function P0t(e){if(typeof e!="object")return e;let t={};for(let n in e){let r=e[n];t[n]=r instanceof Array?r.slice():r}return t}const SZ=new WeakMap;class AQ extends Al{constructor(t){let n=iR(t.languageData),r=D0t(t),i,s=new class extends Yj{createParse(a,l,c){return new L0t(i,a,l,c)}};super(n,s,[],t.name),this.topNode=Q0t(n,this),i=this,this.streamParser=r,this.stateAfter=new An({perNode:!0}),this.tokenTable=t.tokenTable?new O1e(r.tokenTable):B0t}static define(t){return new AQ(t)}getIndent(t){let n,{overrideIndentation:r}=t.options;r&&(n=SZ.get(t.state),n!=null&&n1e4)return null;for(;s=r&&n+t.length<=i&&t.prop(e.stateAfter);if(s)return{state:e.streamParser.copyState(s),pos:n+t.length};for(let a=t.children.length-1;a>=0;a--){let l=t.children[a],c=n+t.positions[a],u=l instanceof lr&&c=t.length)return t;!i&&n==0&&t.type==e.topNode&&(i=!0);for(let s=t.children.length-1;s>=0;s--){let a=t.positions[s],l=t.children[s],c;if(an&&NQ(e,s.tree,0-s.offset,n,l),u;if(c&&c.pos<=r&&(u=g1e(e,s.tree,n+s.offset,c.pos+s.offset,!1)))return{state:c.state,tree:u}}return{state:e.streamParser.startState(i?Kg(i):4),tree:lr.empty}}let L0t=class{constructor(t,n,r,i){this.lang=t,this.input=n,this.fragments=r,this.ranges=i,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=i[i.length-1].to;let s=Zg.get(),a=i[0].from,{state:l,tree:c}=M0t(t,r,a,this.to,s==null?void 0:s.state);this.state=l,this.parsedPos=this.chunkStart=a+c.length;for(let u=0;uu.from<=s.viewport.from&&u.to>=s.viewport.from)&&(this.state=this.lang.streamParser.startState(Kg(s.state)),s.skipUntilInView(this.parsedPos,s.viewport.from),this.parsedPos=s.viewport.from),this.moveRangeIndex()}advance(){let t=Zg.get(),n=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),r=Math.min(n,this.chunkStart+512);for(t&&(r=Math.min(r,t.viewport.to));this.parsedPos=n?this.finish():t&&this.parsedPos>=t.viewport.to?(t.skipUntilInView(this.parsedPos,n),this.finish()):null}stopAt(t){this.stoppedAt=t}lineAfter(t){let n=this.input.chunk(t);if(this.input.lineChunks)n==` `&&(n="");else{let r=n.indexOf(` -`);r>-1&&(n=n.slice(0,r))}return t+n.length<=this.to?n:n.slice(0,this.to-t)}nextLine(){let t=this.parsedPos,n=this.lineAfter(t),r=t+n.length;for(let i=this.rangeIndex;;){let s=this.ranges[i].to;if(s>=r||(n=n.slice(0,s-(r-n.length)),i++,i==this.ranges.length))break;let a=this.ranges[i].from,l=this.lineAfter(a);n+=l,r=a+l.length}return{line:n,end:r}}skipGapsTo(t,n,r){for(;;){let i=this.ranges[this.rangeIndex].to,s=t+n;if(r>0?i>s:i>=s)break;let a=this.ranges[++this.rangeIndex].from;n+=a-i}return n}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){i=this.skipGapsTo(n,i,1),n+=i;let l=this.chunk.length;i=this.skipGapsTo(r,i,-1),r+=i,s+=this.chunk.length-l}let a=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&s==4&&a>=0&&this.chunk[a]==t&&this.chunk[a+2]==n?this.chunk[a+2]=r:this.chunk.push(t,n,r,s),i}parseLine(t){let{line:n,end:r}=this.nextLine(),i=0,{streamParser:s}=this.lang,a=new m1e(n,t?t.state.tabSize:4,t?Kg(t.state):2);if(a.eol())s.blankLine(this.state,a.indentUnit);else for(;!a.eol();){let l=b1e(s.token,a,this.state);if(l&&(i=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+a.start,this.parsedPos+a.pos,i)),a.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPost.start)return i}throw new Error("Stream parser failed to advance stream.")}const jQ=Object.create(null),dS=[Hs.none],B0t=new bO(dS),EZ=[],kZ=Object.create(null),y1e=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])y1e[e]=x1e(jQ,t);class O1e{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),y1e)}resolve(t){return t?this.table[t]||(this.table[t]=x1e(this.extra,t)):0}}const Q0t=new O1e(jQ);function JD(e,t){EZ.indexOf(e)>-1||(EZ.push(e),console.warn(t))}function x1e(e,t){let n=[];for(let l of t.split(" ")){let c=[];for(let u of l.split(".")){let d=e[u]||Y[u];d?typeof d=="function"?c.length?c=c.map(d):JD(u,`Modifier ${u} used at start of tag`):c.length?JD(u,`Tag ${u} used as modifier`):c=Array.isArray(d)?d:[d]:JD(u,`Unknown highlighting tag ${u}`)}for(let u of c)n.push(u)}if(!n.length)return 0;let r=t.replace(/ /g,"_"),i=r+" "+n.map(l=>l.id),s=kZ[i];if(s)return s.id;let a=kZ[i]=Hs.define({id:dS.length,name:r,props:[vh({[r]:n})]});return dS.push(a),a.id}function U0t(e,t){let n=Hs.define({id:dS.length,name:"Document",props:[bp.add(()=>e),wh.add(()=>r=>t.getIndent(r))],top:!0});return dS.push(n),n}xi.RTL,xi.LTR;var _Z={};class TA{constructor(t,n,r,i,s,a,l,c,u,d=0,f){this.p=t,this.stack=n,this.state=r,this.reducePos=i,this.pos=s,this.score=a,this.buffer=l,this.bufferBase=c,this.curContext=u,this.lookAhead=d,this.parent=f}toString(){return`[${this.stack.filter((t,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,n,r=0){let i=t.parser.context;return new TA(t,[],n,r,r,0,[],0,i?new TZ(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var n;let r=t>>19,i=t&65535,{parser:s}=this.p,a=this.reducePos=2e3&&!(!((n=this.p.parser.nodeSet.types[i])===null||n===void 0)&&n.isAnonymous)&&(u==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=d):this.p.lastBigReductionSizec;)this.stack.pop();this.reduceContext(i,u)}storeNode(t,n,r,i=4,s=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[a-4]==0&&this.buffer[a-1]>-1){if(n==r)return;if(this.buffer[a-2]>=n){this.buffer[a-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(t,n,r,i);else{let a=this.buffer.length;if(a>0&&(this.buffer[a-4]!=0||this.buffer[a-1]<0)){let l=!1;for(let c=a;c>0&&this.buffer[c-2]>r;c-=4)if(this.buffer[c-1]>=0){l=!0;break}if(l)for(;a>0&&this.buffer[a-2]>r;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,i>4&&(i-=4)}this.buffer[a]=t,this.buffer[a+1]=n,this.buffer[a+2]=r,this.buffer[a+3]=i}}shift(t,n,r,i){if(t&131072)this.pushState(t&65535,this.pos);else if(t&262144)this.pos=i,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,i,4);else{let s=t,{parser:a}=this.p;this.pos=i;let l=a.stateFlag(s,1);!l&&(i>r||n<=a.maxNode)&&(this.reducePos=i),this.pushState(s,l?r:Math.min(r,this.reducePos)),this.shiftContext(n,r),n<=a.maxNode&&this.buffer.push(n,r,i,4)}}apply(t,n,r,i){t&65536?this.reduce(t):this.shift(t,n,r,i)}useNode(t,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=t)&&(this.p.reused.push(t),r++);let i=this.pos;this.reducePos=this.pos=i+t.length,this.pushState(n,i),this.buffer.push(r,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,n=t.buffer.length;for(n&&t.buffer[n-4]==0&&(n-=4);n>0&&t.buffer[n-2]>t.reducePos;)n-=4;let r=t.buffer.slice(n),i=t.bufferBase+n;for(;t&&i==t.bufferBase;)t=t.parent;return new TA(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,t)}recoverByDelete(t,n){let r=t<=this.p.parser.maxNode;r&&this.storeNode(t,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(t){for(let n=new F0t(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,t);if(r==0)return!1;if(!(r&65536))return!0;n.reduce(r)}}recoverByInsert(t){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let i=[];for(let s=0,a;sc&1&&l==a)||i.push(n[s],a)}n=i}let r=[];for(let i=0;i>19,i=n&65535,s=this.stack.length-r*3;if(s<0||t.getGoto(this.stack[s],i,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;n=a}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:t}=this.p,n=[],r=(i,s)=>{if(!n.includes(i))return n.push(i),t.allActions(i,a=>{if(!(a&393216))if(a&65536){let l=(a>>19)-s;if(l>1){let c=a&65535,u=this.stack.length-l*3;if(u>=0&&t.getGoto(this.stack[u],c,!1)>=0)return l<<19|65536|c}}else{let l=r(a,s+1);if(l!=null)return l}})};return r(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:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let n=0;n0&&this.emitLookAhead()}}class TZ{constructor(t,n){this.tracker=t,this.context=n,this.hash=t.strict?t.hash(n):0}}class F0t{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let n=t&65535,r=t>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=i}}class CA{constructor(t,n,r){this.stack=t,this.pos=n,this.index=r,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,n=t.bufferBase+t.buffer.length){return new CA(t,n,n-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.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 CA(this.stack,this.pos,this.index)}}function tv(e,t=Uint16Array){if(typeof e!="string")return e;let n=null;for(let r=0,i=0;r=92&&a--,a>=34&&a--;let c=a-32;if(c>=46&&(c-=46,l=!0),s+=c,l)break;s*=46}n?n[i++]=s:n=new t(s)}return n}class vT{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const CZ=new vT;class z0t{constructor(t,n){this.input=t,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=CZ,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(t,n){let r=this.range,i=this.rangeIndex,s=this.pos+t;for(;sr.to:s>=r.to;){if(i==this.ranges.length-1)return null;let a=this.ranges[++i];s+=a.from-r.to,r=a}return s}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,n.from);return this.end}peek(t){let n=this.chunkOff+t,r,i;if(n>=0&&n=this.chunk2Pos&&rl.to&&(this.chunk2=this.chunk2.slice(0,l.to-r)),i=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),i}acceptToken(t,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,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(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,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(t,n){if(n?(this.token=n,n.start=t,n.lookAhead=t+1,n.value=n.extended=-1):this.token=CZ,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,n-this.chunkPos);if(t>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,n-this.chunk2Pos);if(t>=this.range.from&&n<=this.range.to)return this.input.read(t,n);let r="";for(let i of this.ranges){if(i.from>=n)break;i.to>t&&(r+=this.input.read(Math.max(i.from,t),Math.min(i.to,n)))}return r}}class Ny{constructor(t,n){this.data=t,this.id=n}token(t,n){let{parser:r}=n.p;v1e(this.data,t,n,this.id,r.data,r.tokenPrecTable)}}Ny.prototype.contextual=Ny.prototype.fallback=Ny.prototype.extend=!1;class AA{constructor(t,n,r){this.precTable=n,this.elseToken=r,this.data=typeof t=="string"?tv(t):t}token(t,n){let r=t.pos,i=0;for(;;){let s=t.next<0,a=t.resolveOffset(1,1);if(v1e(this.data,t,n,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(s||i++,a==null)break;t.reset(a,t.token)}i&&(t.reset(r,t.token),t.acceptToken(this.elseToken,i))}}AA.prototype.contextual=Ny.prototype.fallback=Ny.prototype.extend=!1;class js{constructor(t,n={}){this.token=t,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function v1e(e,t,n,r,i,s){let a=0,l=1<0){let g=e[m];if(c.allows(g)&&(t.token.value==-1||t.token.value==g||V0t(g,t.token.value,i,s))){t.acceptToken(g);break}}let d=t.next,f=0,h=e[a+2];if(t.next<0&&h>f&&e[u+h*3-3]==65535){a=e[u+h*3-1];continue e}for(;f>1,g=u+m+(m<<1),b=e[g],y=e[g+1]||65536;if(d=y)f=m+1;else{a=e[g+2],t.advance();continue e}}break}}function AZ(e,t,n){for(let r=t,i;(i=e[r])!=65535;r++)if(i==n)return r-t;return-1}function V0t(e,t,n,r){let i=AZ(n,r,t);return i<0||AZ(n,r,e)t)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(e.length,Math.max(r.from+1,t+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:e.length}}let H0t=class{constructor(t,n){this.fragments=t,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?NZ(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?NZ(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=a,null;if(s instanceof cr){if(a==t){if(a=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(a),this.index.push(0))}else this.index[n]++,this.nextStart=a+s.length}}};class q0t{constructor(t,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(r=>new vT)}getActions(t){let n=0,r=null,{parser:i}=t.p,{tokenizers:s}=i,a=i.stateSlot(t.state,3),l=t.curContext?t.curContext.hash:0,c=0;for(let u=0;uf.end+25&&(c=Math.max(f.lookAhead,c)),f.value!=0)){let h=n;if(f.extended>-1&&(n=this.addActions(t,f.extended,f.end,n)),n=this.addActions(t,f.value,f.end,n),!d.extend&&(r=f,n>h))break}}for(;this.actions.length>n;)this.actions.pop();return c&&t.setLookAhead(c),!r&&t.pos==this.stream.end&&(r=new vT,r.value=t.p.parser.eofTerm,r.start=r.end=t.pos,n=this.addActions(t,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let n=new vT,{pos:r,p:i}=t;return n.start=r,n.end=Math.min(r+1,i.stream.end),n.value=r==i.stream.end?i.parser.eofTerm:0,n}updateCachedToken(t,n,r){let i=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(i,t),r),t.value>-1){let{parser:s}=r.p;for(let a=0;a=0&&r.p.parser.dialect.allows(l>>1)){l&1?t.extended=l>>1:t.value=l>>1;break}}}else t.value=0,t.end=this.stream.clipPos(i+1)}putAction(t,n,r,i){for(let s=0;st.bufferLength*4?new H0t(r,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,n=this.minStackPos,r=this.stacks=[],i,s;if(this.bigReductionCount>300&&t.length==1){let[a]=t;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;an)r.push(l);else{if(this.advanceStack(l,r,t))continue;{i||(i=[],s=[]),i.push(l);let c=this.tokens.getMainToken(l);s.push(c.value,c.end)}}break}}if(!r.length){let a=i&&W0t(i);if(a)return fl&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw fl&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&i){let a=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,s,r);if(a)return fl&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(r.length>a)for(r.sort((l,c)=>c.score-l.score);r.length>a;)r.pop();r.some(l=>l.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let a=0;a500&&u.buffer.length>500)if((l.score-u.score||l.buffer.length-u.buffer.length)>0)r.splice(c--,1);else{r.splice(a--,1);continue e}}}r.length>12&&(r.sort((a,l)=>l.score-a.score),r.splice(12,r.length-12))}this.minStackPos=r[0].pos;for(let a=1;a ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let u=t.curContext&&t.curContext.tracker.strict,d=u?t.curContext.hash:0;for(let f=this.fragments.nodeAt(i);f;){let h=this.parser.nodeSet.types[f.type.id]==f.type?s.getGoto(t.state,f.type.id):-1;if(h>-1&&f.length&&(!u||(f.prop(Nn.contextHash)||0)==d))return t.useNode(f,h),fl&&console.log(a+this.stackID(t)+` (via reuse of ${s.getName(f.type.id)})`),!0;if(!(f instanceof cr)||f.children.length==0||f.positions[0]>0)break;let m=f.children[0];if(m instanceof cr&&f.positions[0]==0)f=m;else break}}let l=s.stateSlot(t.state,4);if(l>0)return t.reduce(l),fl&&console.log(a+this.stackID(t)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let c=this.tokens.getActions(t);for(let u=0;ui?n.push(g):r.push(g)}return!1}advanceFully(t,n){let r=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>r)return jZ(t,n),!0}}runRecovery(t,n,r){let i=null,s=!1;for(let a=0;a ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),fl&&console.log(d+this.stackID(l)+" (restarted)"),this.advanceFully(l,r))))continue;let f=l.split(),h=d;for(let m=0;m<10&&f.forceReduce()&&(fl&&console.log(h+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,r));m++)fl&&(h=this.stackID(f)+" -> ");for(let m of l.recoverByInsert(c))fl&&console.log(d+this.stackID(m)+" (via recover-insert)"),this.advanceFully(m,r);this.stream.end>l.pos?(u==l.pos&&(u++,c=0),l.recoverByDelete(c,u),fl&&console.log(d+this.stackID(l)+` (via recover-delete ${this.parser.getName(c)})`),jZ(l,r)):(!i||i.scoree;class oR{constructor(t){this.start=t.start,this.shift=t.shift||tP,this.reduce=t.reduce||tP,this.reuse=t.reuse||tP,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}}class ch extends Yj{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let n=t.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let l=0;lt.topRules[l][1]),i=[];for(let l=0;l=0)s(d,c,l[u++]);else{let f=l[u+-d];for(let h=-d;h>0;h--)s(l[u++],c,f);u++}}}this.nodeSet=new bO(n.map((l,c)=>Hs.define({name:c>=this.minRepeatTerm?void 0:l,id:c,props:i[c],top:r.indexOf(c)>-1,error:c==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(c)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=xbe;let a=tv(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new Ny(a,l):l),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,n,r){let i=new X0t(this,t,n,r);for(let s of this.wrappers)i=s(i,t,n,r);return i}getGoto(t,n,r=!1){let i=this.goto;if(n>=i[0])return-1;for(let s=i[n+1];;){let a=i[s++],l=a&1,c=i[s++];if(l&&r)return c;for(let u=s+(a>>1);s0}validAction(t,n){return!!this.allActions(t,r=>r==n?!0:null)}allActions(t,n){let r=this.stateSlot(t,4),i=r?n(r):void 0;for(let s=this.stateSlot(t,1);i==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=pf(this.data,s+2);else break;i=n(pf(this.data,s+1))}return i}nextStates(t){let n=[];for(let r=this.stateSlot(t,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=pf(this.data,r+2);else break;if(!(this.data[r+2]&1)){let i=this.data[r+1];n.some((s,a)=>a&1&&s==i)||n.push(this.data[r],i)}}return n}configure(t){let n=Object.assign(Object.create(ch.prototype),this);if(t.props&&(n.nodeSet=this.nodeSet.extend(...t.props)),t.top){let r=this.topRules[t.top];if(!r)throw new RangeError(`Invalid top rule name ${t.top}`);n.top=r}return t.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let i=t.tokenizers.find(s=>s.from==r);return i?i.to:r})),t.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,i)=>{let s=t.specializers.find(l=>l.from==r.external);if(!s)return r;let a=Object.assign(Object.assign({},r),{external:s.to});return n.specializers[i]=RZ(a),a})),t.contextTracker&&(n.context=t.contextTracker),t.dialect&&(n.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(n.strict=t.strict),t.wrap&&(n.wrappers=n.wrappers.concat(t.wrap)),t.bufferLength!=null&&(n.bufferLength=t.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let n=this.dynamicPrecedences;return n==null?0:n[t]||0}parseDialect(t){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(t)for(let s of t.split(" ")){let a=n.indexOf(s);a>=0&&(r[a]=!0)}let i=null;for(let s=0;sr)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.scoree.external(n,r)<<1|t}return e.get}const Y0t=316,Z0t=317,IZ=1,K0t=2,J0t=3,ebt=4,tbt=318,nbt=320,rbt=321,ibt=5,sbt=6,abt=0,b6=[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],w1e=125,obt=59,y6=47,lbt=42,cbt=43,ubt=45,dbt=60,fbt=44,hbt=63,pbt=46,mbt=91,gbt=new oR({start:!1,shift(e,t){return t==ibt||t==sbt||t==nbt?e:t==rbt},strict:!1}),bbt=new js((e,t)=>{let{next:n}=e;(n==w1e||n==-1||t.context)&&e.acceptToken(tbt)},{contextual:!0,fallback:!0}),ybt=new js((e,t)=>{let{next:n}=e,r;b6.indexOf(n)>-1||n==y6&&((r=e.peek(1))==y6||r==lbt)||n!=w1e&&n!=obt&&n!=-1&&!t.context&&e.acceptToken(Y0t)},{contextual:!0}),Obt=new js((e,t)=>{e.next==mbt&&!t.context&&e.acceptToken(Z0t)},{contextual:!0}),xbt=new js((e,t)=>{let{next:n}=e;if(n==cbt||n==ubt){if(e.advance(),n==e.next){e.advance();let r=!t.context&&t.canShift(IZ);e.acceptToken(r?IZ:K0t)}}else n==hbt&&e.peek(1)==pbt&&(e.advance(),e.advance(),(e.next<48||e.next>57)&&e.acceptToken(J0t))},{contextual:!0});function nP(e,t){return e>=65&&e<=90||e>=97&&e<=122||e==95||e>=192||!t&&e>=48&&e<=57}const vbt=new js((e,t)=>{if(e.next!=dbt||!t.dialectEnabled(abt)||(e.advance(),e.next==y6))return;let n=0;for(;b6.indexOf(e.next)>-1;)e.advance(),n++;if(nP(e.next,!0)){for(e.advance(),n++;nP(e.next,!1);)e.advance(),n++;for(;b6.indexOf(e.next)>-1;)e.advance(),n++;if(e.next==fbt)return;for(let r=0;;r++){if(r==7){if(!nP(e.next,!0))return;break}if(e.next!="extends".charCodeAt(r))break;e.advance(),n++}}e.acceptToken(ebt,-n)}),wbt=vh({"get set async static":Y.modifier,"for while do if else switch try catch finally return throw break continue default case defer":Y.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":Y.operatorKeyword,"let var const using function class extends":Y.definitionKeyword,"import export from":Y.moduleKeyword,"with debugger new":Y.keyword,TemplateString:Y.special(Y.string),super:Y.atom,BooleanLiteral:Y.bool,this:Y.self,null:Y.null,Star:Y.modifier,VariableName:Y.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":Y.function(Y.variableName),VariableDefinition:Y.definition(Y.variableName),Label:Y.labelName,PropertyName:Y.propertyName,PrivatePropertyName:Y.special(Y.propertyName),"CallExpression/MemberExpression/PropertyName":Y.function(Y.propertyName),"FunctionDeclaration/VariableDefinition":Y.function(Y.definition(Y.variableName)),"ClassDeclaration/VariableDefinition":Y.definition(Y.className),"NewExpression/VariableName":Y.className,PropertyDefinition:Y.definition(Y.propertyName),PrivatePropertyDefinition:Y.definition(Y.special(Y.propertyName)),UpdateOp:Y.updateOperator,"LineComment Hashbang":Y.lineComment,BlockComment:Y.blockComment,Number:Y.number,String:Y.string,Escape:Y.escape,ArithOp:Y.arithmeticOperator,LogicOp:Y.logicOperator,BitOp:Y.bitwiseOperator,CompareOp:Y.compareOperator,RegExp:Y.regexp,Equals:Y.definitionOperator,Arrow:Y.function(Y.punctuation),": Spread":Y.punctuation,"( )":Y.paren,"[ ]":Y.squareBracket,"{ }":Y.brace,"InterpolationStart InterpolationEnd":Y.special(Y.brace),".":Y.derefOperator,", ;":Y.separator,"@":Y.meta,TypeName:Y.typeName,TypeDefinition:Y.definition(Y.typeName),"type enum interface implements namespace module declare":Y.definitionKeyword,"abstract global Privacy readonly override":Y.modifier,"is keyof unique infer asserts":Y.operatorKeyword,JSXAttributeValue:Y.attributeValue,JSXText:Y.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":Y.angleBracket,"JSXIdentifier JSXNameSpacedName":Y.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":Y.attributeName,"JSXBuiltin/JSXIdentifier":Y.standard(Y.tagName)}),Sbt={__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},Ebt={__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},kbt={__proto__:null,"<":193},_bt=ch.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:gbt,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:[wbt],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:[ybt,Obt,xbt,vbt,2,3,4,5,6,7,8,9,10,11,12,13,14,bbt,new AA("$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 AA("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:e=>Sbt[e]||-1},{term:343,get:e=>Ebt[e]||-1},{term:95,get:e=>kbt[e]||-1}],tokenPrec:15201});class RQ{constructor(t,n,r,i){this.state=t,this.pos=n,this.explicit=r,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(t){let n=mi(this.state).resolveInner(this.pos,-1);for(;n&&t.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(t){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),i=n.text.slice(r-n.from,this.pos-n.from),s=i.search(E1e(t,!1));return s<0?null:{from:r+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(t,n,r){t=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function DZ(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function Tbt(e){let t=Object.create(null),n=Object.create(null);for(let{label:i}of e){t[i[0]]=!0;for(let s=1;stypeof i=="string"?{label:i}:i),[n,r]=t.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:Tbt(t);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:t,validFor:n}:null}}function S1e(e,t){return n=>{for(let r=mi(n.state).resolveInner(n.pos,-1);r;r=r.parent){if(e.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return t(n)}}class PZ{constructor(t,n,r,i){this.completion=t,this.source=n,this.match=r,this.score=i}}function _g(e){return e.selection.main.from}function E1e(e,t){var n;let{source:r}=e,i=t&&r[0]!="^",s=r[r.length-1]!="$";return!i&&!s?e:new RegExp(`${i?"^":""}(?:${r})${s?"$":""}`,(n=e.flags)!==null&&n!==void 0?n:e.ignoreCase?"i":"")}const DQ=Ad.define();function Cbt(e,t,n,r){let{main:i}=e.selection,s=n-i.from,a=r-i.from;return{...e.changeByRange(l=>{if(l!=i&&n!=r&&e.sliceDoc(l.from+s,l.from+a)!=e.sliceDoc(n,r))return{range:l};let c=e.toText(t);return{changes:{from:l.from+s,to:r==i.from?l.to:l.from+a,insert:c},range:Je.cursor(l.from+s+c.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const MZ=new WeakMap;function Abt(e){if(!Array.isArray(e))return e;let t=MZ.get(e);return t||MZ.set(e,t=IQ(e)),t}const NA=jn.define(),fS=jn.define();class Nbt{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n=48&&S<=57||S>=97&&S<=122?2:S>=65&&S<=90?1:0:(E=oQ(S))!=E.toLowerCase()?1:E!=E.toUpperCase()?2:0;(!v||k==1&&y||w==0&&k!=0)&&(n[f]==S||r[f]==S&&(h=!0)?a[f++]=v:a.length&&(O=!1)),w=k,v+=Yu(S)}return f==c&&a[0]==0&&O?this.result(-100+(h?-200:0),a,t):m==c&&g==0?this.ret(-200-t.length+(b==t.length?0:-100),[0,b]):l>-1?this.ret(-700-t.length,[l,l+this.pattern.length]):m==c?this.ret(-900-t.length,[g,b]):f==c?this.result(-100+(h?-200:0)+-700+(O?0:-1100),a,t):n.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,t)}result(t,n,r){let i=[],s=0;for(let a of n){let l=a+(this.astral?Yu(Uo(r,a)):1);s&&i[s-1]==a?i[s-1]=l:(i[s++]=a,i[s++]=l)}return this.ret(t-r.length,i)}}class jbt{constructor(t){this.pattern=t,this.matched=[],this.score=0,this.folded=t.toLowerCase()}match(t){if(t.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Rbt,filterStrict:!1,compareCompletions:(t,n)=>(t.sortText||t.label).localeCompare(n.sortText||n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(t,n)=>t&&n,closeOnBlur:(t,n)=>t&&n,icons:(t,n)=>t&&n,tooltipClass:(t,n)=>r=>LZ(t(r),n(r)),optionClass:(t,n)=>r=>LZ(t(r),n(r)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function LZ(e,t){return e?t?e+" "+t:e:t}function Rbt(e,t,n,r,i,s){let a=e.textDirection==xi.RTL,l=a,c=!1,u="top",d,f,h=t.left-i.left,m=i.right-t.right,g=r.right-r.left,b=r.bottom-r.top;if(l&&h=b||v>t.top?d=n.bottom-t.top:(u="bottom",d=t.bottom-n.top)}let y=(t.bottom-t.top)/s.offsetHeight,O=(t.right-t.left)/s.offsetWidth;return{style:`${u}: ${d/y}px; max-width: ${f/O}px`,class:"cm-completionInfo-"+(c?a?"left-narrow":"right-narrow":l?"left":"right")}}const PQ=jn.define();function Ibt(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),r.setAttribute("aria-hidden","true"),r},position:20}),t.push({render(n,r,i,s){let a=document.createElement("span");a.className="cm-completionLabel";let l=n.displayLabel||n.label,c=0;for(let u=0;uc&&a.appendChild(document.createTextNode(l.slice(c,d)));let h=a.appendChild(document.createElement("span"));h.appendChild(document.createTextNode(l.slice(d,f))),h.className="cm-completionMatchedText",c=f}return cn.position-r.position).map(n=>n.render)}function rP(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let i=Math.floor(t/n);return{from:i*n,to:(i+1)*n}}let r=Math.ceil((e-t)/n);return{from:e-r*n,to:e-(r-1)*n}}class Dbt{constructor(t,n,r){this.view=t,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:c=>this.placeInfo(c),key:this},this.space=null,this.currentClass="";let i=t.state.field(n),{options:s,selected:a}=i.open,l=t.state.facet(ma);this.optionContent=Ibt(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=rP(s.length,a,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",c=>{let{options:u}=t.state.field(n).open;for(let d=c.target,f;d&&d!=this.dom;d=d.parentNode)if(d.nodeName=="LI"&&(f=/-(\d+)$/.exec(d.id))&&+f[1]this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;d!=null&&(t.dispatch({effects:PQ.of(d)}),c.preventDefault())}}),this.dom.addEventListener("focusout",c=>{let u=t.state.field(this.stateField,!1);u&&u.tooltip&&t.state.facet(ma).closeOnBlur&&c.relatedTarget!=t.contentDOM&&t.dispatch({effects:fS.of(null)})}),this.showOptions(s,i.id)}mount(){this.updateSel()}showOptions(t,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(t){var n;let r=t.state.field(this.stateField),i=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),r!=i){let{options:s,selected:a,disabled:l}=r.open;(!i.open||i.open.options!=s)&&(this.range=rP(s.length,a,t.state.facet(ma).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),l!=((n=i.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(t){let n=this.tooltipClass(t);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),n=t.open;(n.selected>-1&&n.selected=this.range.to)&&(this.range=rP(n.options.length,n.selected,this.view.state.facet(ma).maxRenderedOptions),this.showOptions(n.options,t.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:i}=n.options[n.selected],{info:s}=i;if(!s)return;let a=typeof s=="string"?document.createTextNode(s):s(i);if(!a)return;"then"in a?a.then(l=>{l&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(l,i)}).catch(l=>Go(this.view.state,l,"completion info")):(this.addInfoPane(a,i),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(t,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),t.nodeType!=null)r.appendChild(t),this.infoDestroy=null;else{let{dom:i,destroy:s}=t;r.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let n=null;for(let r=this.list.firstChild,i=this.range.from;r;r=r.nextSibling,i++)r.nodeName!="LI"||!r.id?i--:i==t?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&Mbt(this.list,n),n}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),i=t.getBoundingClientRect(),s=this.space;if(!s){let a=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:a.clientWidth,bottom:a.clientHeight}}return i.top>Math.min(s.bottom,n.bottom)-10||i.bottom{a.target==i&&a.preventDefault()});let s=null;for(let a=r.from;ar.from||r.from==0))if(s=h,typeof u!="string"&&u.header)i.appendChild(u.header(u));else{let m=i.appendChild(document.createElement("completion-section"));m.textContent=h}}const d=i.appendChild(document.createElement("li"));d.id=n+"-"+a,d.setAttribute("role","option");let f=this.optionClass(l);f&&(d.className=f);for(let h of this.optionContent){let m=h(l,this.view.state,this.view,c);m&&d.appendChild(m)}}return r.from&&i.classList.add("cm-completionListIncompleteTop"),r.tonew Dbt(n,e,t)}function Mbt(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.height/e.offsetHeight;r.topn.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/i)}function $Z(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function Lbt(e,t){let n=[],r=null,i=null,s=d=>{n.push(d);let{section:f}=d.completion;if(f){r||(r=[]);let h=typeof f=="string"?f:f.name;r.some(m=>m.name==h)||r.push(typeof f=="string"?{name:h}:f)}},a=t.facet(ma);for(let d of e)if(d.hasResult()){let f=d.result.getMatch;if(d.result.filter===!1)for(let h of d.result.options)s(new PZ(h,d.source,f?f(h):[],1e9-n.length));else{let h=t.sliceDoc(d.from,d.to),m,g=a.filterStrict?new jbt(h):new Nbt(h);for(let b of d.result.options)if(m=g.match(b.label)){let y=b.displayLabel?f?f(b,m.matched):[]:m.matched,O=m.score+(b.boost||0);if(s(new PZ(b,d.source,y,O)),typeof b.section=="object"&&b.section.rank==="dynamic"){let{name:v}=b.section;i||(i=Object.create(null)),i[v]=Math.max(O,i[v]||-1e9)}}}}if(r){let d=Object.create(null),f=0,h=(m,g)=>(m.rank==="dynamic"&&g.rank==="dynamic"?i[g.name]-i[m.name]:0)||(typeof m.rank=="number"?m.rank:1e9)-(typeof g.rank=="number"?g.rank:1e9)||(m.nameh.score-f.score||u(f.completion,h.completion))){let f=d.completion;!c||c.label!=f.label||c.detail!=f.detail||c.type!=null&&f.type!=null&&c.type!=f.type||c.apply!=f.apply||c.boost!=f.boost?l.push(d):$Z(d.completion)>$Z(c)&&(l[l.length-1]=d),c=d.completion}return l}class ey{constructor(t,n,r,i,s,a){this.options=t,this.attrs=n,this.tooltip=r,this.timestamp=i,this.selected=s,this.disabled=a}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new ey(this.options,BZ(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,r,i,s,a){if(i&&!a&&t.some(u=>u.isPending))return i.setDisabled();let l=Lbt(t,n);if(!l.length)return i&&t.some(u=>u.isPending)?i.setDisabled():null;let c=n.facet(ma).selectOnOpen?0:-1;if(i&&i.selected!=c&&i.selected!=-1){let u=i.options[i.selected].completion;for(let d=0;dd.hasResult()?Math.min(u,d.from):u,1e8),create:zbt,above:s.aboveCursor},i?i.timestamp:Date.now(),c,!1)}map(t){return new ey(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new ey(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class jA{constructor(t,n,r){this.active=t,this.id=n,this.open=r}static start(){return new jA(Ubt,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(ma),s=(r.override||n.languageDataAt("autocomplete",_g(n)).map(Abt)).map(c=>(this.active.find(d=>d.source==c)||new Ac(c,this.active.some(d=>d.state!=0)?1:0)).update(t,r));s.length==this.active.length&&s.every((c,u)=>c==this.active[u])&&(s=this.active);let a=this.open,l=t.effects.some(c=>c.is(MQ));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||s.some(c=>c.hasResult()&&t.changes.touchesRange(c.from,c.to))||!$bt(s,this.active)||l?a=ey.build(s,n,this.id,a,r,l):a&&a.disabled&&!s.some(c=>c.isPending)&&(a=null),!a&&s.every(c=>!c.isPending)&&s.some(c=>c.hasResult())&&(s=s.map(c=>c.hasResult()?new Ac(c.source,0):c));for(let c of t.effects)c.is(PQ)&&(a=a&&a.setSelected(c.value,this.id));return s==this.active&&a==this.open?this:new jA(s,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Bbt:Qbt}}function $bt(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n-1&&(n["aria-activedescendant"]=e+"-"+t),n}const Ubt=[];function k1e(e,t){if(e.isUserEvent("input.complete")){let r=e.annotation(DQ);if(r&&t.activateOnCompletion(r))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class Ac{constructor(t,n,r=!1){this.source=t,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let r=k1e(t,n),i=this;(r&8||r&16&&this.touches(t))&&(i=new Ac(i.source,0)),r&4&&i.state==0&&(i=new Ac(this.source,1)),i=i.updateFor(t,r);for(let s of t.effects)if(s.is(NA))i=new Ac(i.source,1,s.value);else if(s.is(fS))i=new Ac(i.source,0);else if(s.is(MQ))for(let a of s.value)a.source==i.source&&(i=a);return i}updateFor(t,n){return this.map(t.changes)}map(t){return this}touches(t){return t.changes.touchesRange(_g(t.state))}}class jy extends Ac{constructor(t,n,r,i,s,a){super(t,3,n),this.limit=r,this.result=i,this.from=s,this.to=a}hasResult(){return!0}updateFor(t,n){var r;if(!(n&3))return this.map(t.changes);let i=this.result;i.map&&!t.changes.empty&&(i=i.map(i,t.changes));let s=t.changes.mapPos(this.from),a=t.changes.mapPos(this.to,1),l=_g(t.state);if(l>a||!i||n&2&&(_g(t.startState)==this.from||ln.map(t))}}),Fo=Qa.define({create(){return jA.start()},update(e,t){return e.update(t)},provide:e=>[EQ.from(e,t=>t.tooltip),Ct.contentAttributes.from(e,t=>t.attrs)]});function LQ(e,t){const n=t.completion.apply||t.completion.label;let r=e.state.field(Fo).active.find(i=>i.source==t.source);return r instanceof jy?(typeof n=="string"?e.dispatch({...Cbt(e.state,n,r.from,r.to),annotations:DQ.of(t.completion)}):n(e,t.completion,r.from,r.to),!0):!1}const zbt=Pbt(Fo,LQ);function e_(e,t="option"){return n=>{let r=n.state.field(Fo,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+i*(e?1:-1):e?0:a-1;return l<0?l=t=="page"?0:a-1:l>=a&&(l=t=="page"?a-1:0),n.dispatch({effects:PQ.of(l)}),!0}}const Vbt=e=>{let t=e.state.field(Fo,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestampe.state.field(Fo,!1)?(e.dispatch({effects:NA.of(!0)}),!0):!1,Hbt=e=>{let t=e.state.field(Fo,!1);return!t||!t.active.some(n=>n.state!=0)?!1:(e.dispatch({effects:fS.of(null)}),!0)};class qbt{constructor(t,n){this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const Xbt=50,Gbt=1e3,Wbt=ps.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(Fo).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(Fo),n=e.state.facet(ma);if(!e.selectionSet&&!e.docChanged&&e.startState.field(Fo)==t)return;let r=e.transactions.some(s=>{let a=k1e(s,n);return a&8||(s.selection||s.docChanged)&&!(a&3)});for(let s=0;sXbt&&Date.now()-a.time>Gbt){for(let l of a.context.abortListeners)try{l()}catch(c){Go(this.view.state,c)}a.context.abortListeners=null,this.running.splice(s--,1)}else a.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(s=>s.effects.some(a=>a.is(NA)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(s=>s.isPending&&!this.running.some(a=>a.active.source==s.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let s of e.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(Fo);for(let n of t.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(ma).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=_g(t),r=new RQ(t,n,e.explicit,this.view),i=new qbt(e,r);this.running.push(i),Promise.resolve(e.source(r)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:fS.of(null)}),Go(this.view.state,s)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(ma).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(ma),r=this.view.state.field(Fo);for(let i=0;il.source==s.active.source);if(a&&a.isPending)if(s.done==null){let l=new Ac(s.active.source,0);for(let c of s.updates)l=l.update(c,n);l.isPending||t.push(l)}else this.startQuery(a)}(t.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:MQ.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(Fo,!1);if(t&&t.tooltip&&this.view.state.facet(ma).closeOnBlur){let n=t.open&&Vye(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:fS.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:NA.of(!1)}),20),this.composing=0}}}),Ybt=typeof navigator=="object"&&/Win/.test(navigator.platform),Zbt=xh.highest(Ct.domEventHandlers({keydown(e,t){let n=t.state.field(Fo,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(Ybt&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(a=>a.source==r.source),s=r.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(e.key)>-1&&LQ(t,r),!1}})),_1e=Ct.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class Kbt{constructor(t,n,r,i){this.field=t,this.line=n,this.from=r,this.to=i}}class $Q{constructor(t,n,r){this.field=t,this.from=n,this.to=r}map(t){let n=t.mapPos(this.from,-1,Pa.TrackDel),r=t.mapPos(this.to,1,Pa.TrackDel);return n==null||r==null?null:new $Q(this.field,n,r)}}class BQ{constructor(t,n){this.lines=t,this.fieldPositions=n}instantiate(t,n){let r=[],i=[n],s=t.doc.lineAt(n),a=/^\s*/.exec(s.text)[0];for(let c of this.lines){if(r.length){let u=a,d=/^\t*/.exec(c)[0].length;for(let f=0;fnew $Q(c.field,i[c.line]+c.from,i[c.line]+c.to));return{text:r,ranges:l}}static parse(t){let n=[],r=[],i=[],s;for(let a of t.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(a);){let l=s[1]?+s[1]:null,c=s[2]||s[3]||"",u=-1;l===0&&(l=1e9);let d=c.replace(/\\[{}]/g,f=>f[1]);for(let f=0;f=u&&h.field++}for(let f of i)if(f.line==r.length&&f.from>s.index){let h=s[2]?3+(s[1]||"").length:2;f.from-=h,f.to-=h}i.push(new Kbt(u,r.length,s.index,s.index+d.length)),a=a.slice(0,s.index)+c+a.slice(s.index+s[0].length)}a=a.replace(/\\([{}])/g,(l,c,u)=>{for(let d of i)d.line==r.length&&d.from>u&&(d.from--,d.to--);return c}),r.push(a)}return new BQ(r,i)}}let Jbt=dn.widget({widget:new class extends Nu{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),eyt=dn.mark({class:"cm-snippetField"});class xO{constructor(t,n){this.ranges=t,this.active=n,this.deco=dn.set(t.map(r=>(r.from==r.to?Jbt:eyt).range(r.from,r.to)),!0)}map(t){let n=[];for(let r of this.ranges){let i=r.map(t);if(!i)return null;n.push(i)}return new xO(n,this.active)}selectionInsideField(t){return t.ranges.every(n=>this.ranges.some(r=>r.field==this.active&&r.from<=n.from&&r.to>=n.to))}}const FE=jn.define({map(e,t){return e&&e.map(t)}}),tyt=jn.define(),hS=Qa.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(FE))return n.value;if(n.is(tyt)&&e)return new xO(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>Ct.decorations.from(e,t=>t?t.deco:dn.none)});function QQ(e,t){return Je.create(e.filter(n=>n.field==t).map(n=>Je.range(n.from,n.to)))}function nyt(e){let t=BQ.parse(e);return(n,r,i,s)=>{let{text:a,ranges:l}=t.instantiate(n.state,i),{main:c}=n.state.selection,u={changes:{from:i,to:s==c.from?c.to:s,insert:Br.of(a)},scrollIntoView:!0,annotations:r?[DQ.of(r),Vs.userEvent.of("input.complete")]:void 0};if(l.length&&(u.selection=QQ(l,0)),l.some(d=>d.field>0)){let d=new xO(l,0),f=u.effects=[FE.of(d)];n.state.field(hS,!1)===void 0&&f.push(jn.appendConfig.of([hS,oyt,lyt,_1e]))}n.dispatch(n.state.update(u))}}function T1e(e){return({state:t,dispatch:n})=>{let r=t.field(hS,!1);if(!r||e<0&&r.active==0)return!1;let i=r.active+e,s=e>0&&!r.ranges.some(a=>a.field==i+e);return n(t.update({selection:QQ(r.ranges,i),effects:FE.of(s?null:new xO(r.ranges,i)),scrollIntoView:!0})),!0}}const ryt=({state:e,dispatch:t})=>e.field(hS,!1)?(t(e.update({effects:FE.of(null)})),!0):!1,iyt=T1e(1),syt=T1e(-1),ayt=[{key:"Tab",run:iyt,shift:syt},{key:"Escape",run:ryt}],QZ=Qt.define({combine(e){return e.length?e[0]:ayt}}),oyt=xh.highest(yO.compute([QZ],e=>e.facet(QZ)));function rs(e,t){return{...t,apply:nyt(e)}}const lyt=Ct.domEventHandlers({mousedown(e,t){let n=t.state.field(hS,!1),r;if(!n||(r=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return!1;let i=n.ranges.find(s=>s.from<=r&&s.to>=r);return!i||i.field==n.active?!1:(t.dispatch({selection:QQ(n.ranges,i.field),effects:FE.of(n.ranges.some(s=>s.field>i.field)?new xO(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),pS={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},ug=jn.define({map(e,t){let n=t.mapPos(e,-1,Pa.TrackAfter);return n??void 0}}),UQ=new class extends Kp{};UQ.startSide=1;UQ.endSide=-1;const C1e=Qa.define({create(){return gr.empty},update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of t.effects)n.is(ug)&&(e=e.update({add:[UQ.range(n.value,n.value+1)]}));return e}});function cyt(){return[dyt,C1e]}const sP="()[]{}<>«»»«[]{}";function A1e(e){for(let t=0;t{if((uyt?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||r.length==2&&Yu(Uo(r,0))==1||t!=i.from||n!=i.to)return!1;let s=pyt(e.state,r);return s?(e.dispatch(s),!0):!1}),fyt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=N1e(e,e.selection.main.head).brackets||pS.brackets,i=null,s=e.changeByRange(a=>{if(a.empty){let l=myt(e.doc,a.head);for(let c of r)if(c==l&&lR(e.doc,a.head)==A1e(Uo(c,0)))return{changes:{from:a.head-c.length,to:a.head+c.length},range:Je.cursor(a.head-c.length)}}return{range:i=a}});return i||t(e.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},hyt=[{key:"Backspace",run:fyt}];function pyt(e,t){let n=N1e(e,e.selection.main.head),r=n.brackets||pS.brackets;for(let i of r){let s=A1e(Uo(i,0));if(t==i)return s==i?yyt(e,i,r.indexOf(i+i+i)>-1,n):gyt(e,i,s,n.before||pS.before);if(t==s&&j1e(e,e.selection.main.from))return byt(e,i,s)}return null}function j1e(e,t){let n=!1;return e.field(C1e).between(0,e.doc.length,r=>{r==t&&(n=!0)}),n}function lR(e,t){let n=e.sliceString(t,t+2);return n.slice(0,Yu(Uo(n,0)))}function myt(e,t){let n=e.sliceString(t-2,t);return Yu(Uo(n,0))==n.length?n:n.slice(1)}function gyt(e,t,n,r){let i=null,s=e.changeByRange(a=>{if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:n,from:a.to}],effects:ug.of(a.to+t.length),range:Je.range(a.anchor+t.length,a.head+t.length)};let l=lR(e.doc,a.head);return!l||/\s/.test(l)||r.indexOf(l)>-1?{changes:{insert:t+n,from:a.head},effects:ug.of(a.head+t.length),range:Je.cursor(a.head+t.length)}:{range:i=a}});return i?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function byt(e,t,n){let r=null,i=e.changeByRange(s=>s.empty&&lR(e.doc,s.head)==n?{changes:{from:s.head,to:s.head+n.length,insert:n},range:Je.cursor(s.head+n.length)}:r={range:s});return r?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function yyt(e,t,n,r){let i=r.stringPrefixes||pS.stringPrefixes,s=null,a=e.changeByRange(l=>{if(!l.empty)return{changes:[{insert:t,from:l.from},{insert:t,from:l.to}],effects:ug.of(l.to+t.length),range:Je.range(l.anchor+t.length,l.head+t.length)};let c=l.head,u=lR(e.doc,c),d;if(u==t){if(UZ(e,c))return{changes:{insert:t+t,from:c},effects:ug.of(c+t.length),range:Je.cursor(c+t.length)};if(j1e(e,c)){let h=n&&e.sliceDoc(c,c+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:c,to:c+h.length,insert:h},range:Je.cursor(c+h.length)}}}else{if(n&&e.sliceDoc(c-2*t.length,c)==t+t&&(d=FZ(e,c-2*t.length,i))>-1&&UZ(e,d))return{changes:{insert:t+t+t+t,from:c},effects:ug.of(c+t.length),range:Je.cursor(c+t.length)};if(e.charCategorizer(c)(u)!=Yi.Word&&FZ(e,c,i)>-1&&!Oyt(e,c,t,i))return{changes:{insert:t+t,from:c},effects:ug.of(c+t.length),range:Je.cursor(c+t.length)}}return{range:s=l}});return s?null:e.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function UZ(e,t){let n=mi(e).resolveInner(t+1);return n.parent&&n.from==t}function Oyt(e,t,n,r){let i=mi(e).resolveInner(t,-1),s=r.reduce((a,l)=>Math.max(a,l.length),0);for(let a=0;a<5;a++){let l=e.sliceDoc(i.from,Math.min(i.to,i.from+n.length+s)),c=l.indexOf(n);if(!c||c>-1&&r.indexOf(l.slice(0,c))>-1){let d=i.firstChild;for(;d&&d.from==i.from&&d.to-d.from>n.length+c;){if(e.sliceDoc(d.to-n.length,d.to)==n)return!1;d=d.firstChild}return!0}let u=i.to==t&&i.parent;if(!u)break;i=u}return!1}function FZ(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=Yi.Word)return t;for(let i of n){let s=t-i.length;if(e.sliceDoc(s,t)==i&&r(e.sliceDoc(s-1,s))!=Yi.Word)return s}return-1}function xyt(e={}){return[Zbt,Fo,ma.of(e),Wbt,vyt,_1e]}const R1e=[{key:"Ctrl-Space",run:iP},{mac:"Alt-`",run:iP},{mac:"Alt-i",run:iP},{key:"Escape",run:Hbt},{key:"ArrowDown",run:e_(!0)},{key:"ArrowUp",run:e_(!1)},{key:"PageDown",run:e_(!0,"page")},{key:"PageUp",run:e_(!1,"page")},{key:"Enter",run:Vbt}],vyt=xh.highest(yO.computeN([ma],e=>e.facet(ma).defaultKeymap?[R1e]:[])),I1e=[rs("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),rs("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),rs("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),rs("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),rs("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),rs(`try { +`);r>-1&&(n=n.slice(0,r))}return t+n.length<=this.to?n:n.slice(0,this.to-t)}nextLine(){let t=this.parsedPos,n=this.lineAfter(t),r=t+n.length;for(let i=this.rangeIndex;;){let s=this.ranges[i].to;if(s>=r||(n=n.slice(0,s-(r-n.length)),i++,i==this.ranges.length))break;let a=this.ranges[i].from,l=this.lineAfter(a);n+=l,r=a+l.length}return{line:n,end:r}}skipGapsTo(t,n,r){for(;;){let i=this.ranges[this.rangeIndex].to,s=t+n;if(r>0?i>s:i>=s)break;let a=this.ranges[++this.rangeIndex].from;n+=a-i}return n}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){i=this.skipGapsTo(n,i,1),n+=i;let l=this.chunk.length;i=this.skipGapsTo(r,i,-1),r+=i,s+=this.chunk.length-l}let a=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&s==4&&a>=0&&this.chunk[a]==t&&this.chunk[a+2]==n?this.chunk[a+2]=r:this.chunk.push(t,n,r,s),i}parseLine(t){let{line:n,end:r}=this.nextLine(),i=0,{streamParser:s}=this.lang,a=new m1e(n,t?t.state.tabSize:4,t?Kg(t.state):2);if(a.eol())s.blankLine(this.state,a.indentUnit);else for(;!a.eol();){let l=b1e(s.token,a,this.state);if(l&&(i=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+a.start,this.parsedPos+a.pos,i)),a.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPost.start)return i}throw new Error("Stream parser failed to advance stream.")}const jQ=Object.create(null),hS=[Fs.none],$0t=new bO(hS),EZ=[],kZ=Object.create(null),y1e=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])y1e[e]=x1e(jQ,t);class O1e{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),y1e)}resolve(t){return t?this.table[t]||(this.table[t]=x1e(this.extra,t)):0}}const B0t=new O1e(jQ);function JD(e,t){EZ.indexOf(e)>-1||(EZ.push(e),console.warn(t))}function x1e(e,t){let n=[];for(let l of t.split(" ")){let c=[];for(let u of l.split(".")){let d=e[u]||Z[u];d?typeof d=="function"?c.length?c=c.map(d):JD(u,`Modifier ${u} used at start of tag`):c.length?JD(u,`Tag ${u} used as modifier`):c=Array.isArray(d)?d:[d]:JD(u,`Unknown highlighting tag ${u}`)}for(let u of c)n.push(u)}if(!n.length)return 0;let r=t.replace(/ /g,"_"),i=r+" "+n.map(l=>l.id),s=kZ[i];if(s)return s.id;let a=kZ[i]=Fs.define({id:hS.length,name:r,props:[vh({[r]:n})]});return hS.push(a),a.id}function Q0t(e,t){let n=Fs.define({id:hS.length,name:"Document",props:[bp.add(()=>e),wh.add(()=>r=>t.getIndent(r))],top:!0});return hS.push(n),n}wi.RTL,wi.LTR;var _Z={};class TA{constructor(t,n,r,i,s,a,l,c,u,d=0,f){this.p=t,this.stack=n,this.state=r,this.reducePos=i,this.pos=s,this.score=a,this.buffer=l,this.bufferBase=c,this.curContext=u,this.lookAhead=d,this.parent=f}toString(){return`[${this.stack.filter((t,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(t,n,r=0){let i=t.parser.context;return new TA(t,[],n,r,r,0,[],0,i?new TZ(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var n;let r=t>>19,i=t&65535,{parser:s}=this.p,a=this.reducePos=2e3&&!(!((n=this.p.parser.nodeSet.types[i])===null||n===void 0)&&n.isAnonymous)&&(u==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=d):this.p.lastBigReductionSizec;)this.stack.pop();this.reduceContext(i,u)}storeNode(t,n,r,i=4,s=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[a-4]==0&&this.buffer[a-1]>-1){if(n==r)return;if(this.buffer[a-2]>=n){this.buffer[a-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(t,n,r,i);else{let a=this.buffer.length;if(a>0&&(this.buffer[a-4]!=0||this.buffer[a-1]<0)){let l=!1;for(let c=a;c>0&&this.buffer[c-2]>r;c-=4)if(this.buffer[c-1]>=0){l=!0;break}if(l)for(;a>0&&this.buffer[a-2]>r;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,i>4&&(i-=4)}this.buffer[a]=t,this.buffer[a+1]=n,this.buffer[a+2]=r,this.buffer[a+3]=i}}shift(t,n,r,i){if(t&131072)this.pushState(t&65535,this.pos);else if(t&262144)this.pos=i,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,i,4);else{let s=t,{parser:a}=this.p;this.pos=i;let l=a.stateFlag(s,1);!l&&(i>r||n<=a.maxNode)&&(this.reducePos=i),this.pushState(s,l?r:Math.min(r,this.reducePos)),this.shiftContext(n,r),n<=a.maxNode&&this.buffer.push(n,r,i,4)}}apply(t,n,r,i){t&65536?this.reduce(t):this.shift(t,n,r,i)}useNode(t,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=t)&&(this.p.reused.push(t),r++);let i=this.pos;this.reducePos=this.pos=i+t.length,this.pushState(n,i),this.buffer.push(r,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,n=t.buffer.length;for(n&&t.buffer[n-4]==0&&(n-=4);n>0&&t.buffer[n-2]>t.reducePos;)n-=4;let r=t.buffer.slice(n),i=t.bufferBase+n;for(;t&&i==t.bufferBase;)t=t.parent;return new TA(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,t)}recoverByDelete(t,n){let r=t<=this.p.parser.maxNode;r&&this.storeNode(t,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(t){for(let n=new U0t(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,t);if(r==0)return!1;if(!(r&65536))return!0;n.reduce(r)}}recoverByInsert(t){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let i=[];for(let s=0,a;sc&1&&l==a)||i.push(n[s],a)}n=i}let r=[];for(let i=0;i>19,i=n&65535,s=this.stack.length-r*3;if(s<0||t.getGoto(this.stack[s],i,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;n=a}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:t}=this.p,n=[],r=(i,s)=>{if(!n.includes(i))return n.push(i),t.allActions(i,a=>{if(!(a&393216))if(a&65536){let l=(a>>19)-s;if(l>1){let c=a&65535,u=this.stack.length-l*3;if(u>=0&&t.getGoto(this.stack[u],c,!1)>=0)return l<<19|65536|c}}else{let l=r(a,s+1);if(l!=null)return l}})};return r(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:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let n=0;n0&&this.emitLookAhead()}}class TZ{constructor(t,n){this.tracker=t,this.context=n,this.hash=t.strict?t.hash(n):0}}class U0t{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let n=t&65535,r=t>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=i}}class CA{constructor(t,n,r){this.stack=t,this.pos=n,this.index=r,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,n=t.bufferBase+t.buffer.length){return new CA(t,n,n-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.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 CA(this.stack,this.pos,this.index)}}function tv(e,t=Uint16Array){if(typeof e!="string")return e;let n=null;for(let r=0,i=0;r=92&&a--,a>=34&&a--;let c=a-32;if(c>=46&&(c-=46,l=!0),s+=c,l)break;s*=46}n?n[i++]=s:n=new t(s)}return n}class ST{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const CZ=new ST;class F0t{constructor(t,n){this.input=t,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=CZ,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(t,n){let r=this.range,i=this.rangeIndex,s=this.pos+t;for(;sr.to:s>=r.to;){if(i==this.ranges.length-1)return null;let a=this.ranges[++i];s+=a.from-r.to,r=a}return s}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,n.from);return this.end}peek(t){let n=this.chunkOff+t,r,i;if(n>=0&&n=this.chunk2Pos&&rl.to&&(this.chunk2=this.chunk2.slice(0,l.to-r)),i=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),i}acceptToken(t,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,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(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,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(t,n){if(n?(this.token=n,n.start=t,n.lookAhead=t+1,n.value=n.extended=-1):this.token=CZ,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,n-this.chunkPos);if(t>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,n-this.chunk2Pos);if(t>=this.range.from&&n<=this.range.to)return this.input.read(t,n);let r="";for(let i of this.ranges){if(i.from>=n)break;i.to>t&&(r+=this.input.read(Math.max(i.from,t),Math.min(i.to,n)))}return r}}class Ny{constructor(t,n){this.data=t,this.id=n}token(t,n){let{parser:r}=n.p;v1e(this.data,t,n,this.id,r.data,r.tokenPrecTable)}}Ny.prototype.contextual=Ny.prototype.fallback=Ny.prototype.extend=!1;class AA{constructor(t,n,r){this.precTable=n,this.elseToken=r,this.data=typeof t=="string"?tv(t):t}token(t,n){let r=t.pos,i=0;for(;;){let s=t.next<0,a=t.resolveOffset(1,1);if(v1e(this.data,t,n,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(s||i++,a==null)break;t.reset(a,t.token)}i&&(t.reset(r,t.token),t.acceptToken(this.elseToken,i))}}AA.prototype.contextual=Ny.prototype.fallback=Ny.prototype.extend=!1;class js{constructor(t,n={}){this.token=t,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function v1e(e,t,n,r,i,s){let a=0,l=1<0){let g=e[m];if(c.allows(g)&&(t.token.value==-1||t.token.value==g||z0t(g,t.token.value,i,s))){t.acceptToken(g);break}}let d=t.next,f=0,h=e[a+2];if(t.next<0&&h>f&&e[u+h*3-3]==65535){a=e[u+h*3-1];continue e}for(;f>1,g=u+m+(m<<1),b=e[g],y=e[g+1]||65536;if(d=y)f=m+1;else{a=e[g+2],t.advance();continue e}}break}}function AZ(e,t,n){for(let r=t,i;(i=e[r])!=65535;r++)if(i==n)return r-t;return-1}function z0t(e,t,n,r){let i=AZ(n,r,t);return i<0||AZ(n,r,e)t)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(e.length,Math.max(r.from+1,t+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:e.length}}let V0t=class{constructor(t,n){this.fragments=t,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?NZ(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?NZ(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=a,null;if(s instanceof lr){if(a==t){if(a=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(a),this.index.push(0))}else this.index[n]++,this.nextStart=a+s.length}}};class H0t{constructor(t,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(r=>new ST)}getActions(t){let n=0,r=null,{parser:i}=t.p,{tokenizers:s}=i,a=i.stateSlot(t.state,3),l=t.curContext?t.curContext.hash:0,c=0;for(let u=0;uf.end+25&&(c=Math.max(f.lookAhead,c)),f.value!=0)){let h=n;if(f.extended>-1&&(n=this.addActions(t,f.extended,f.end,n)),n=this.addActions(t,f.value,f.end,n),!d.extend&&(r=f,n>h))break}}for(;this.actions.length>n;)this.actions.pop();return c&&t.setLookAhead(c),!r&&t.pos==this.stream.end&&(r=new ST,r.value=t.p.parser.eofTerm,r.start=r.end=t.pos,n=this.addActions(t,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let n=new ST,{pos:r,p:i}=t;return n.start=r,n.end=Math.min(r+1,i.stream.end),n.value=r==i.stream.end?i.parser.eofTerm:0,n}updateCachedToken(t,n,r){let i=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(i,t),r),t.value>-1){let{parser:s}=r.p;for(let a=0;a=0&&r.p.parser.dialect.allows(l>>1)){l&1?t.extended=l>>1:t.value=l>>1;break}}}else t.value=0,t.end=this.stream.clipPos(i+1)}putAction(t,n,r,i){for(let s=0;st.bufferLength*4?new V0t(r,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,n=this.minStackPos,r=this.stacks=[],i,s;if(this.bigReductionCount>300&&t.length==1){let[a]=t;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;an)r.push(l);else{if(this.advanceStack(l,r,t))continue;{i||(i=[],s=[]),i.push(l);let c=this.tokens.getMainToken(l);s.push(c.value,c.end)}}break}}if(!r.length){let a=i&&G0t(i);if(a)return fl&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw fl&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&i){let a=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,s,r);if(a)return fl&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(r.length>a)for(r.sort((l,c)=>c.score-l.score);r.length>a;)r.pop();r.some(l=>l.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let a=0;a500&&u.buffer.length>500)if((l.score-u.score||l.buffer.length-u.buffer.length)>0)r.splice(c--,1);else{r.splice(a--,1);continue e}}}r.length>12&&(r.sort((a,l)=>l.score-a.score),r.splice(12,r.length-12))}this.minStackPos=r[0].pos;for(let a=1;a ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let u=t.curContext&&t.curContext.tracker.strict,d=u?t.curContext.hash:0;for(let f=this.fragments.nodeAt(i);f;){let h=this.parser.nodeSet.types[f.type.id]==f.type?s.getGoto(t.state,f.type.id):-1;if(h>-1&&f.length&&(!u||(f.prop(An.contextHash)||0)==d))return t.useNode(f,h),fl&&console.log(a+this.stackID(t)+` (via reuse of ${s.getName(f.type.id)})`),!0;if(!(f instanceof lr)||f.children.length==0||f.positions[0]>0)break;let m=f.children[0];if(m instanceof lr&&f.positions[0]==0)f=m;else break}}let l=s.stateSlot(t.state,4);if(l>0)return t.reduce(l),fl&&console.log(a+this.stackID(t)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let c=this.tokens.getActions(t);for(let u=0;ui?n.push(g):r.push(g)}return!1}advanceFully(t,n){let r=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>r)return jZ(t,n),!0}}runRecovery(t,n,r){let i=null,s=!1;for(let a=0;a ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),fl&&console.log(d+this.stackID(l)+" (restarted)"),this.advanceFully(l,r))))continue;let f=l.split(),h=d;for(let m=0;m<10&&f.forceReduce()&&(fl&&console.log(h+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,r));m++)fl&&(h=this.stackID(f)+" -> ");for(let m of l.recoverByInsert(c))fl&&console.log(d+this.stackID(m)+" (via recover-insert)"),this.advanceFully(m,r);this.stream.end>l.pos?(u==l.pos&&(u++,c=0),l.recoverByDelete(c,u),fl&&console.log(d+this.stackID(l)+` (via recover-delete ${this.parser.getName(c)})`),jZ(l,r)):(!i||i.scoree;class oR{constructor(t){this.start=t.start,this.shift=t.shift||tP,this.reduce=t.reduce||tP,this.reuse=t.reuse||tP,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}}class ch extends Yj{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let n=t.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let l=0;lt.topRules[l][1]),i=[];for(let l=0;l=0)s(d,c,l[u++]);else{let f=l[u+-d];for(let h=-d;h>0;h--)s(l[u++],c,f);u++}}}this.nodeSet=new bO(n.map((l,c)=>Fs.define({name:c>=this.minRepeatTerm?void 0:l,id:c,props:i[c],top:r.indexOf(c)>-1,error:c==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(c)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=xbe;let a=tv(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new Ny(a,l):l),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,n,r){let i=new q0t(this,t,n,r);for(let s of this.wrappers)i=s(i,t,n,r);return i}getGoto(t,n,r=!1){let i=this.goto;if(n>=i[0])return-1;for(let s=i[n+1];;){let a=i[s++],l=a&1,c=i[s++];if(l&&r)return c;for(let u=s+(a>>1);s0}validAction(t,n){return!!this.allActions(t,r=>r==n?!0:null)}allActions(t,n){let r=this.stateSlot(t,4),i=r?n(r):void 0;for(let s=this.stateSlot(t,1);i==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=pf(this.data,s+2);else break;i=n(pf(this.data,s+1))}return i}nextStates(t){let n=[];for(let r=this.stateSlot(t,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=pf(this.data,r+2);else break;if(!(this.data[r+2]&1)){let i=this.data[r+1];n.some((s,a)=>a&1&&s==i)||n.push(this.data[r],i)}}return n}configure(t){let n=Object.assign(Object.create(ch.prototype),this);if(t.props&&(n.nodeSet=this.nodeSet.extend(...t.props)),t.top){let r=this.topRules[t.top];if(!r)throw new RangeError(`Invalid top rule name ${t.top}`);n.top=r}return t.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let i=t.tokenizers.find(s=>s.from==r);return i?i.to:r})),t.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,i)=>{let s=t.specializers.find(l=>l.from==r.external);if(!s)return r;let a=Object.assign(Object.assign({},r),{external:s.to});return n.specializers[i]=RZ(a),a})),t.contextTracker&&(n.context=t.contextTracker),t.dialect&&(n.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(n.strict=t.strict),t.wrap&&(n.wrappers=n.wrappers.concat(t.wrap)),t.bufferLength!=null&&(n.bufferLength=t.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let n=this.dynamicPrecedences;return n==null?0:n[t]||0}parseDialect(t){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(t)for(let s of t.split(" ")){let a=n.indexOf(s);a>=0&&(r[a]=!0)}let i=null;for(let s=0;sr)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.scoree.external(n,r)<<1|t}return e.get}const W0t=316,Y0t=317,IZ=1,Z0t=2,K0t=3,J0t=4,ebt=318,tbt=320,nbt=321,rbt=5,ibt=6,sbt=0,b6=[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],w1e=125,abt=59,y6=47,obt=42,lbt=43,cbt=45,ubt=60,dbt=44,fbt=63,hbt=46,pbt=91,mbt=new oR({start:!1,shift(e,t){return t==rbt||t==ibt||t==tbt?e:t==nbt},strict:!1}),gbt=new js((e,t)=>{let{next:n}=e;(n==w1e||n==-1||t.context)&&e.acceptToken(ebt)},{contextual:!0,fallback:!0}),bbt=new js((e,t)=>{let{next:n}=e,r;b6.indexOf(n)>-1||n==y6&&((r=e.peek(1))==y6||r==obt)||n!=w1e&&n!=abt&&n!=-1&&!t.context&&e.acceptToken(W0t)},{contextual:!0}),ybt=new js((e,t)=>{e.next==pbt&&!t.context&&e.acceptToken(Y0t)},{contextual:!0}),Obt=new js((e,t)=>{let{next:n}=e;if(n==lbt||n==cbt){if(e.advance(),n==e.next){e.advance();let r=!t.context&&t.canShift(IZ);e.acceptToken(r?IZ:Z0t)}}else n==fbt&&e.peek(1)==hbt&&(e.advance(),e.advance(),(e.next<48||e.next>57)&&e.acceptToken(K0t))},{contextual:!0});function nP(e,t){return e>=65&&e<=90||e>=97&&e<=122||e==95||e>=192||!t&&e>=48&&e<=57}const xbt=new js((e,t)=>{if(e.next!=ubt||!t.dialectEnabled(sbt)||(e.advance(),e.next==y6))return;let n=0;for(;b6.indexOf(e.next)>-1;)e.advance(),n++;if(nP(e.next,!0)){for(e.advance(),n++;nP(e.next,!1);)e.advance(),n++;for(;b6.indexOf(e.next)>-1;)e.advance(),n++;if(e.next==dbt)return;for(let r=0;;r++){if(r==7){if(!nP(e.next,!0))return;break}if(e.next!="extends".charCodeAt(r))break;e.advance(),n++}}e.acceptToken(J0t,-n)}),vbt=vh({"get set async static":Z.modifier,"for while do if else switch try catch finally return throw break continue default case defer":Z.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":Z.operatorKeyword,"let var const using function class extends":Z.definitionKeyword,"import export from":Z.moduleKeyword,"with debugger new":Z.keyword,TemplateString:Z.special(Z.string),super:Z.atom,BooleanLiteral:Z.bool,this:Z.self,null:Z.null,Star:Z.modifier,VariableName:Z.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":Z.function(Z.variableName),VariableDefinition:Z.definition(Z.variableName),Label:Z.labelName,PropertyName:Z.propertyName,PrivatePropertyName:Z.special(Z.propertyName),"CallExpression/MemberExpression/PropertyName":Z.function(Z.propertyName),"FunctionDeclaration/VariableDefinition":Z.function(Z.definition(Z.variableName)),"ClassDeclaration/VariableDefinition":Z.definition(Z.className),"NewExpression/VariableName":Z.className,PropertyDefinition:Z.definition(Z.propertyName),PrivatePropertyDefinition:Z.definition(Z.special(Z.propertyName)),UpdateOp:Z.updateOperator,"LineComment Hashbang":Z.lineComment,BlockComment:Z.blockComment,Number:Z.number,String:Z.string,Escape:Z.escape,ArithOp:Z.arithmeticOperator,LogicOp:Z.logicOperator,BitOp:Z.bitwiseOperator,CompareOp:Z.compareOperator,RegExp:Z.regexp,Equals:Z.definitionOperator,Arrow:Z.function(Z.punctuation),": Spread":Z.punctuation,"( )":Z.paren,"[ ]":Z.squareBracket,"{ }":Z.brace,"InterpolationStart InterpolationEnd":Z.special(Z.brace),".":Z.derefOperator,", ;":Z.separator,"@":Z.meta,TypeName:Z.typeName,TypeDefinition:Z.definition(Z.typeName),"type enum interface implements namespace module declare":Z.definitionKeyword,"abstract global Privacy readonly override":Z.modifier,"is keyof unique infer asserts":Z.operatorKeyword,JSXAttributeValue:Z.attributeValue,JSXText:Z.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":Z.angleBracket,"JSXIdentifier JSXNameSpacedName":Z.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":Z.attributeName,"JSXBuiltin/JSXIdentifier":Z.standard(Z.tagName)}),wbt={__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},Sbt={__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},Ebt={__proto__:null,"<":193},kbt=ch.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:mbt,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:[vbt],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:[bbt,ybt,Obt,xbt,2,3,4,5,6,7,8,9,10,11,12,13,14,gbt,new AA("$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 AA("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:e=>wbt[e]||-1},{term:343,get:e=>Sbt[e]||-1},{term:95,get:e=>Ebt[e]||-1}],tokenPrec:15201});class RQ{constructor(t,n,r,i){this.state=t,this.pos=n,this.explicit=r,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(t){let n=yi(this.state).resolveInner(this.pos,-1);for(;n&&t.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(t){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),i=n.text.slice(r-n.from,this.pos-n.from),s=i.search(E1e(t,!1));return s<0?null:{from:r+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(t,n,r){t=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function DZ(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function _bt(e){let t=Object.create(null),n=Object.create(null);for(let{label:i}of e){t[i[0]]=!0;for(let s=1;stypeof i=="string"?{label:i}:i),[n,r]=t.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:_bt(t);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:t,validFor:n}:null}}function S1e(e,t){return n=>{for(let r=yi(n.state).resolveInner(n.pos,-1);r;r=r.parent){if(e.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return t(n)}}class PZ{constructor(t,n,r,i){this.completion=t,this.source=n,this.match=r,this.score=i}}function _g(e){return e.selection.main.from}function E1e(e,t){var n;let{source:r}=e,i=t&&r[0]!="^",s=r[r.length-1]!="$";return!i&&!s?e:new RegExp(`${i?"^":""}(?:${r})${s?"$":""}`,(n=e.flags)!==null&&n!==void 0?n:e.ignoreCase?"i":"")}const DQ=jd.define();function Tbt(e,t,n,r){let{main:i}=e.selection,s=n-i.from,a=r-i.from;return{...e.changeByRange(l=>{if(l!=i&&n!=r&&e.sliceDoc(l.from+s,l.from+a)!=e.sliceDoc(n,r))return{range:l};let c=e.toText(t);return{changes:{from:l.from+s,to:r==i.from?l.to:l.from+a,insert:c},range:tt.cursor(l.from+s+c.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const MZ=new WeakMap;function Cbt(e){if(!Array.isArray(e))return e;let t=MZ.get(e);return t||MZ.set(e,t=IQ(e)),t}const NA=jn.define(),pS=jn.define();class Abt{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n=48&&S<=57||S>=97&&S<=122?2:S>=65&&S<=90?1:0:(E=oQ(S))!=E.toLowerCase()?1:E!=E.toUpperCase()?2:0;(!v||k==1&&y||w==0&&k!=0)&&(n[f]==S||r[f]==S&&(h=!0)?a[f++]=v:a.length&&(O=!1)),w=k,v+=Ku(S)}return f==c&&a[0]==0&&O?this.result(-100+(h?-200:0),a,t):m==c&&g==0?this.ret(-200-t.length+(b==t.length?0:-100),[0,b]):l>-1?this.ret(-700-t.length,[l,l+this.pattern.length]):m==c?this.ret(-900-t.length,[g,b]):f==c?this.result(-100+(h?-200:0)+-700+(O?0:-1100),a,t):n.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,t)}result(t,n,r){let i=[],s=0;for(let a of n){let l=a+(this.astral?Ku(Qo(r,a)):1);s&&i[s-1]==a?i[s-1]=l:(i[s++]=a,i[s++]=l)}return this.ret(t-r.length,i)}}class Nbt{constructor(t){this.pattern=t,this.matched=[],this.score=0,this.folded=t.toLowerCase()}match(t){if(t.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:jbt,filterStrict:!1,compareCompletions:(t,n)=>(t.sortText||t.label).localeCompare(n.sortText||n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(t,n)=>t&&n,closeOnBlur:(t,n)=>t&&n,icons:(t,n)=>t&&n,tooltipClass:(t,n)=>r=>LZ(t(r),n(r)),optionClass:(t,n)=>r=>LZ(t(r),n(r)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function LZ(e,t){return e?t?e+" "+t:e:t}function jbt(e,t,n,r,i,s){let a=e.textDirection==wi.RTL,l=a,c=!1,u="top",d,f,h=t.left-i.left,m=i.right-t.right,g=r.right-r.left,b=r.bottom-r.top;if(l&&h=b||v>t.top?d=n.bottom-t.top:(u="bottom",d=t.bottom-n.top)}let y=(t.bottom-t.top)/s.offsetHeight,O=(t.right-t.left)/s.offsetWidth;return{style:`${u}: ${d/y}px; max-width: ${f/O}px`,class:"cm-completionInfo-"+(c?a?"left-narrow":"right-narrow":l?"left":"right")}}const PQ=jn.define();function Rbt(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),r.setAttribute("aria-hidden","true"),r},position:20}),t.push({render(n,r,i,s){let a=document.createElement("span");a.className="cm-completionLabel";let l=n.displayLabel||n.label,c=0;for(let u=0;uc&&a.appendChild(document.createTextNode(l.slice(c,d)));let h=a.appendChild(document.createElement("span"));h.appendChild(document.createTextNode(l.slice(d,f))),h.className="cm-completionMatchedText",c=f}return cn.position-r.position).map(n=>n.render)}function rP(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let i=Math.floor(t/n);return{from:i*n,to:(i+1)*n}}let r=Math.ceil((e-t)/n);return{from:e-r*n,to:e-(r-1)*n}}class Ibt{constructor(t,n,r){this.view=t,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:c=>this.placeInfo(c),key:this},this.space=null,this.currentClass="";let i=t.state.field(n),{options:s,selected:a}=i.open,l=t.state.facet(ha);this.optionContent=Rbt(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=rP(s.length,a,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",c=>{let{options:u}=t.state.field(n).open;for(let d=c.target,f;d&&d!=this.dom;d=d.parentNode)if(d.nodeName=="LI"&&(f=/-(\d+)$/.exec(d.id))&&+f[1]this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;d!=null&&(t.dispatch({effects:PQ.of(d)}),c.preventDefault())}}),this.dom.addEventListener("focusout",c=>{let u=t.state.field(this.stateField,!1);u&&u.tooltip&&t.state.facet(ha).closeOnBlur&&c.relatedTarget!=t.contentDOM&&t.dispatch({effects:pS.of(null)})}),this.showOptions(s,i.id)}mount(){this.updateSel()}showOptions(t,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(t){var n;let r=t.state.field(this.stateField),i=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),r!=i){let{options:s,selected:a,disabled:l}=r.open;(!i.open||i.open.options!=s)&&(this.range=rP(s.length,a,t.state.facet(ha).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),l!=((n=i.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(t){let n=this.tooltipClass(t);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),n=t.open;(n.selected>-1&&n.selected=this.range.to)&&(this.range=rP(n.options.length,n.selected,this.view.state.facet(ha).maxRenderedOptions),this.showOptions(n.options,t.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:i}=n.options[n.selected],{info:s}=i;if(!s)return;let a=typeof s=="string"?document.createTextNode(s):s(i);if(!a)return;"then"in a?a.then(l=>{l&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(l,i)}).catch(l=>Xo(this.view.state,l,"completion info")):(this.addInfoPane(a,i),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(t,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),t.nodeType!=null)r.appendChild(t),this.infoDestroy=null;else{let{dom:i,destroy:s}=t;r.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let n=null;for(let r=this.list.firstChild,i=this.range.from;r;r=r.nextSibling,i++)r.nodeName!="LI"||!r.id?i--:i==t?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&Pbt(this.list,n),n}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),i=t.getBoundingClientRect(),s=this.space;if(!s){let a=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:a.clientWidth,bottom:a.clientHeight}}return i.top>Math.min(s.bottom,n.bottom)-10||i.bottom{a.target==i&&a.preventDefault()});let s=null;for(let a=r.from;ar.from||r.from==0))if(s=h,typeof u!="string"&&u.header)i.appendChild(u.header(u));else{let m=i.appendChild(document.createElement("completion-section"));m.textContent=h}}const d=i.appendChild(document.createElement("li"));d.id=n+"-"+a,d.setAttribute("role","option");let f=this.optionClass(l);f&&(d.className=f);for(let h of this.optionContent){let m=h(l,this.view.state,this.view,c);m&&d.appendChild(m)}}return r.from&&i.classList.add("cm-completionListIncompleteTop"),r.tonew Ibt(n,e,t)}function Pbt(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.height/e.offsetHeight;r.topn.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/i)}function $Z(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function Mbt(e,t){let n=[],r=null,i=null,s=d=>{n.push(d);let{section:f}=d.completion;if(f){r||(r=[]);let h=typeof f=="string"?f:f.name;r.some(m=>m.name==h)||r.push(typeof f=="string"?{name:h}:f)}},a=t.facet(ha);for(let d of e)if(d.hasResult()){let f=d.result.getMatch;if(d.result.filter===!1)for(let h of d.result.options)s(new PZ(h,d.source,f?f(h):[],1e9-n.length));else{let h=t.sliceDoc(d.from,d.to),m,g=a.filterStrict?new Nbt(h):new Abt(h);for(let b of d.result.options)if(m=g.match(b.label)){let y=b.displayLabel?f?f(b,m.matched):[]:m.matched,O=m.score+(b.boost||0);if(s(new PZ(b,d.source,y,O)),typeof b.section=="object"&&b.section.rank==="dynamic"){let{name:v}=b.section;i||(i=Object.create(null)),i[v]=Math.max(O,i[v]||-1e9)}}}}if(r){let d=Object.create(null),f=0,h=(m,g)=>(m.rank==="dynamic"&&g.rank==="dynamic"?i[g.name]-i[m.name]:0)||(typeof m.rank=="number"?m.rank:1e9)-(typeof g.rank=="number"?g.rank:1e9)||(m.nameh.score-f.score||u(f.completion,h.completion))){let f=d.completion;!c||c.label!=f.label||c.detail!=f.detail||c.type!=null&&f.type!=null&&c.type!=f.type||c.apply!=f.apply||c.boost!=f.boost?l.push(d):$Z(d.completion)>$Z(c)&&(l[l.length-1]=d),c=d.completion}return l}class ey{constructor(t,n,r,i,s,a){this.options=t,this.attrs=n,this.tooltip=r,this.timestamp=i,this.selected=s,this.disabled=a}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new ey(this.options,BZ(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,r,i,s,a){if(i&&!a&&t.some(u=>u.isPending))return i.setDisabled();let l=Mbt(t,n);if(!l.length)return i&&t.some(u=>u.isPending)?i.setDisabled():null;let c=n.facet(ha).selectOnOpen?0:-1;if(i&&i.selected!=c&&i.selected!=-1){let u=i.options[i.selected].completion;for(let d=0;dd.hasResult()?Math.min(u,d.from):u,1e8),create:Fbt,above:s.aboveCursor},i?i.timestamp:Date.now(),c,!1)}map(t){return new ey(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new ey(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class jA{constructor(t,n,r){this.active=t,this.id=n,this.open=r}static start(){return new jA(Qbt,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(ha),s=(r.override||n.languageDataAt("autocomplete",_g(n)).map(Cbt)).map(c=>(this.active.find(d=>d.source==c)||new Nc(c,this.active.some(d=>d.state!=0)?1:0)).update(t,r));s.length==this.active.length&&s.every((c,u)=>c==this.active[u])&&(s=this.active);let a=this.open,l=t.effects.some(c=>c.is(MQ));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||s.some(c=>c.hasResult()&&t.changes.touchesRange(c.from,c.to))||!Lbt(s,this.active)||l?a=ey.build(s,n,this.id,a,r,l):a&&a.disabled&&!s.some(c=>c.isPending)&&(a=null),!a&&s.every(c=>!c.isPending)&&s.some(c=>c.hasResult())&&(s=s.map(c=>c.hasResult()?new Nc(c.source,0):c));for(let c of t.effects)c.is(PQ)&&(a=a&&a.setSelected(c.value,this.id));return s==this.active&&a==this.open?this:new jA(s,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?$bt:Bbt}}function Lbt(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n-1&&(n["aria-activedescendant"]=e+"-"+t),n}const Qbt=[];function k1e(e,t){if(e.isUserEvent("input.complete")){let r=e.annotation(DQ);if(r&&t.activateOnCompletion(r))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class Nc{constructor(t,n,r=!1){this.source=t,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let r=k1e(t,n),i=this;(r&8||r&16&&this.touches(t))&&(i=new Nc(i.source,0)),r&4&&i.state==0&&(i=new Nc(this.source,1)),i=i.updateFor(t,r);for(let s of t.effects)if(s.is(NA))i=new Nc(i.source,1,s.value);else if(s.is(pS))i=new Nc(i.source,0);else if(s.is(MQ))for(let a of s.value)a.source==i.source&&(i=a);return i}updateFor(t,n){return this.map(t.changes)}map(t){return this}touches(t){return t.changes.touchesRange(_g(t.state))}}class jy extends Nc{constructor(t,n,r,i,s,a){super(t,3,n),this.limit=r,this.result=i,this.from=s,this.to=a}hasResult(){return!0}updateFor(t,n){var r;if(!(n&3))return this.map(t.changes);let i=this.result;i.map&&!t.changes.empty&&(i=i.map(i,t.changes));let s=t.changes.mapPos(this.from),a=t.changes.mapPos(this.to,1),l=_g(t.state);if(l>a||!i||n&2&&(_g(t.startState)==this.from||ln.map(t))}}),Uo=Ba.define({create(){return jA.start()},update(e,t){return e.update(t)},provide:e=>[EQ.from(e,t=>t.tooltip),Ct.contentAttributes.from(e,t=>t.attrs)]});function LQ(e,t){const n=t.completion.apply||t.completion.label;let r=e.state.field(Uo).active.find(i=>i.source==t.source);return r instanceof jy?(typeof n=="string"?e.dispatch({...Tbt(e.state,n,r.from,r.to),annotations:DQ.of(t.completion)}):n(e,t.completion,r.from,r.to),!0):!1}const Fbt=Dbt(Uo,LQ);function n_(e,t="option"){return n=>{let r=n.state.field(Uo,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+i*(e?1:-1):e?0:a-1;return l<0?l=t=="page"?0:a-1:l>=a&&(l=t=="page"?a-1:0),n.dispatch({effects:PQ.of(l)}),!0}}const zbt=e=>{let t=e.state.field(Uo,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestampe.state.field(Uo,!1)?(e.dispatch({effects:NA.of(!0)}),!0):!1,Vbt=e=>{let t=e.state.field(Uo,!1);return!t||!t.active.some(n=>n.state!=0)?!1:(e.dispatch({effects:pS.of(null)}),!0)};class Hbt{constructor(t,n){this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const qbt=50,Xbt=1e3,Gbt=ms.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(Uo).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(Uo),n=e.state.facet(ha);if(!e.selectionSet&&!e.docChanged&&e.startState.field(Uo)==t)return;let r=e.transactions.some(s=>{let a=k1e(s,n);return a&8||(s.selection||s.docChanged)&&!(a&3)});for(let s=0;sqbt&&Date.now()-a.time>Xbt){for(let l of a.context.abortListeners)try{l()}catch(c){Xo(this.view.state,c)}a.context.abortListeners=null,this.running.splice(s--,1)}else a.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(s=>s.effects.some(a=>a.is(NA)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(s=>s.isPending&&!this.running.some(a=>a.active.source==s.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let s of e.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(Uo);for(let n of t.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(ha).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=_g(t),r=new RQ(t,n,e.explicit,this.view),i=new Hbt(e,r);this.running.push(i),Promise.resolve(e.source(r)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:pS.of(null)}),Xo(this.view.state,s)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(ha).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(ha),r=this.view.state.field(Uo);for(let i=0;il.source==s.active.source);if(a&&a.isPending)if(s.done==null){let l=new Nc(s.active.source,0);for(let c of s.updates)l=l.update(c,n);l.isPending||t.push(l)}else this.startQuery(a)}(t.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:MQ.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(Uo,!1);if(t&&t.tooltip&&this.view.state.facet(ha).closeOnBlur){let n=t.open&&Vye(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:pS.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:NA.of(!1)}),20),this.composing=0}}}),Wbt=typeof navigator=="object"&&/Win/.test(navigator.platform),Ybt=xh.highest(Ct.domEventHandlers({keydown(e,t){let n=t.state.field(Uo,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(Wbt&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(a=>a.source==r.source),s=r.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(e.key)>-1&&LQ(t,r),!1}})),_1e=Ct.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class Zbt{constructor(t,n,r,i){this.field=t,this.line=n,this.from=r,this.to=i}}class $Q{constructor(t,n,r){this.field=t,this.from=n,this.to=r}map(t){let n=t.mapPos(this.from,-1,Da.TrackDel),r=t.mapPos(this.to,1,Da.TrackDel);return n==null||r==null?null:new $Q(this.field,n,r)}}class BQ{constructor(t,n){this.lines=t,this.fieldPositions=n}instantiate(t,n){let r=[],i=[n],s=t.doc.lineAt(n),a=/^\s*/.exec(s.text)[0];for(let c of this.lines){if(r.length){let u=a,d=/^\t*/.exec(c)[0].length;for(let f=0;fnew $Q(c.field,i[c.line]+c.from,i[c.line]+c.to));return{text:r,ranges:l}}static parse(t){let n=[],r=[],i=[],s;for(let a of t.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(a);){let l=s[1]?+s[1]:null,c=s[2]||s[3]||"",u=-1;l===0&&(l=1e9);let d=c.replace(/\\[{}]/g,f=>f[1]);for(let f=0;f=u&&h.field++}for(let f of i)if(f.line==r.length&&f.from>s.index){let h=s[2]?3+(s[1]||"").length:2;f.from-=h,f.to-=h}i.push(new Zbt(u,r.length,s.index,s.index+d.length)),a=a.slice(0,s.index)+c+a.slice(s.index+s[0].length)}a=a.replace(/\\([{}])/g,(l,c,u)=>{for(let d of i)d.line==r.length&&d.from>u&&(d.from--,d.to--);return c}),r.push(a)}return new BQ(r,i)}}let Kbt=ln.widget({widget:new class extends Ru{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),Jbt=ln.mark({class:"cm-snippetField"});class xO{constructor(t,n){this.ranges=t,this.active=n,this.deco=ln.set(t.map(r=>(r.from==r.to?Kbt:Jbt).range(r.from,r.to)),!0)}map(t){let n=[];for(let r of this.ranges){let i=r.map(t);if(!i)return null;n.push(i)}return new xO(n,this.active)}selectionInsideField(t){return t.ranges.every(n=>this.ranges.some(r=>r.field==this.active&&r.from<=n.from&&r.to>=n.to))}}const VE=jn.define({map(e,t){return e&&e.map(t)}}),eyt=jn.define(),mS=Ba.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(VE))return n.value;if(n.is(eyt)&&e)return new xO(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>Ct.decorations.from(e,t=>t?t.deco:ln.none)});function QQ(e,t){return tt.create(e.filter(n=>n.field==t).map(n=>tt.range(n.from,n.to)))}function tyt(e){let t=BQ.parse(e);return(n,r,i,s)=>{let{text:a,ranges:l}=t.instantiate(n.state,i),{main:c}=n.state.selection,u={changes:{from:i,to:s==c.from?c.to:s,insert:Br.of(a)},scrollIntoView:!0,annotations:r?[DQ.of(r),Us.userEvent.of("input.complete")]:void 0};if(l.length&&(u.selection=QQ(l,0)),l.some(d=>d.field>0)){let d=new xO(l,0),f=u.effects=[VE.of(d)];n.state.field(mS,!1)===void 0&&f.push(jn.appendConfig.of([mS,ayt,oyt,_1e]))}n.dispatch(n.state.update(u))}}function T1e(e){return({state:t,dispatch:n})=>{let r=t.field(mS,!1);if(!r||e<0&&r.active==0)return!1;let i=r.active+e,s=e>0&&!r.ranges.some(a=>a.field==i+e);return n(t.update({selection:QQ(r.ranges,i),effects:VE.of(s?null:new xO(r.ranges,i)),scrollIntoView:!0})),!0}}const nyt=({state:e,dispatch:t})=>e.field(mS,!1)?(t(e.update({effects:VE.of(null)})),!0):!1,ryt=T1e(1),iyt=T1e(-1),syt=[{key:"Tab",run:ryt,shift:iyt},{key:"Escape",run:nyt}],QZ=Qt.define({combine(e){return e.length?e[0]:syt}}),ayt=xh.highest(yO.compute([QZ],e=>e.facet(QZ)));function rs(e,t){return{...t,apply:tyt(e)}}const oyt=Ct.domEventHandlers({mousedown(e,t){let n=t.state.field(mS,!1),r;if(!n||(r=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return!1;let i=n.ranges.find(s=>s.from<=r&&s.to>=r);return!i||i.field==n.active?!1:(t.dispatch({selection:QQ(n.ranges,i.field),effects:VE.of(n.ranges.some(s=>s.field>i.field)?new xO(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),gS={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},ug=jn.define({map(e,t){let n=t.mapPos(e,-1,Da.TrackAfter);return n??void 0}}),UQ=new class extends Kp{};UQ.startSide=1;UQ.endSide=-1;const C1e=Ba.define({create(){return gr.empty},update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of t.effects)n.is(ug)&&(e=e.update({add:[UQ.range(n.value,n.value+1)]}));return e}});function lyt(){return[uyt,C1e]}const sP="()[]{}<>«»»«[]{}";function A1e(e){for(let t=0;t{if((cyt?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||r.length==2&&Ku(Qo(r,0))==1||t!=i.from||n!=i.to)return!1;let s=hyt(e.state,r);return s?(e.dispatch(s),!0):!1}),dyt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=N1e(e,e.selection.main.head).brackets||gS.brackets,i=null,s=e.changeByRange(a=>{if(a.empty){let l=pyt(e.doc,a.head);for(let c of r)if(c==l&&lR(e.doc,a.head)==A1e(Qo(c,0)))return{changes:{from:a.head-c.length,to:a.head+c.length},range:tt.cursor(a.head-c.length)}}return{range:i=a}});return i||t(e.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},fyt=[{key:"Backspace",run:dyt}];function hyt(e,t){let n=N1e(e,e.selection.main.head),r=n.brackets||gS.brackets;for(let i of r){let s=A1e(Qo(i,0));if(t==i)return s==i?byt(e,i,r.indexOf(i+i+i)>-1,n):myt(e,i,s,n.before||gS.before);if(t==s&&j1e(e,e.selection.main.from))return gyt(e,i,s)}return null}function j1e(e,t){let n=!1;return e.field(C1e).between(0,e.doc.length,r=>{r==t&&(n=!0)}),n}function lR(e,t){let n=e.sliceString(t,t+2);return n.slice(0,Ku(Qo(n,0)))}function pyt(e,t){let n=e.sliceString(t-2,t);return Ku(Qo(n,0))==n.length?n:n.slice(1)}function myt(e,t,n,r){let i=null,s=e.changeByRange(a=>{if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:n,from:a.to}],effects:ug.of(a.to+t.length),range:tt.range(a.anchor+t.length,a.head+t.length)};let l=lR(e.doc,a.head);return!l||/\s/.test(l)||r.indexOf(l)>-1?{changes:{insert:t+n,from:a.head},effects:ug.of(a.head+t.length),range:tt.cursor(a.head+t.length)}:{range:i=a}});return i?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function gyt(e,t,n){let r=null,i=e.changeByRange(s=>s.empty&&lR(e.doc,s.head)==n?{changes:{from:s.head,to:s.head+n.length,insert:n},range:tt.cursor(s.head+n.length)}:r={range:s});return r?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function byt(e,t,n,r){let i=r.stringPrefixes||gS.stringPrefixes,s=null,a=e.changeByRange(l=>{if(!l.empty)return{changes:[{insert:t,from:l.from},{insert:t,from:l.to}],effects:ug.of(l.to+t.length),range:tt.range(l.anchor+t.length,l.head+t.length)};let c=l.head,u=lR(e.doc,c),d;if(u==t){if(UZ(e,c))return{changes:{insert:t+t,from:c},effects:ug.of(c+t.length),range:tt.cursor(c+t.length)};if(j1e(e,c)){let h=n&&e.sliceDoc(c,c+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:c,to:c+h.length,insert:h},range:tt.cursor(c+h.length)}}}else{if(n&&e.sliceDoc(c-2*t.length,c)==t+t&&(d=FZ(e,c-2*t.length,i))>-1&&UZ(e,d))return{changes:{insert:t+t+t+t,from:c},effects:ug.of(c+t.length),range:tt.cursor(c+t.length)};if(e.charCategorizer(c)(u)!=Yi.Word&&FZ(e,c,i)>-1&&!yyt(e,c,t,i))return{changes:{insert:t+t,from:c},effects:ug.of(c+t.length),range:tt.cursor(c+t.length)}}return{range:s=l}});return s?null:e.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function UZ(e,t){let n=yi(e).resolveInner(t+1);return n.parent&&n.from==t}function yyt(e,t,n,r){let i=yi(e).resolveInner(t,-1),s=r.reduce((a,l)=>Math.max(a,l.length),0);for(let a=0;a<5;a++){let l=e.sliceDoc(i.from,Math.min(i.to,i.from+n.length+s)),c=l.indexOf(n);if(!c||c>-1&&r.indexOf(l.slice(0,c))>-1){let d=i.firstChild;for(;d&&d.from==i.from&&d.to-d.from>n.length+c;){if(e.sliceDoc(d.to-n.length,d.to)==n)return!1;d=d.firstChild}return!0}let u=i.to==t&&i.parent;if(!u)break;i=u}return!1}function FZ(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=Yi.Word)return t;for(let i of n){let s=t-i.length;if(e.sliceDoc(s,t)==i&&r(e.sliceDoc(s-1,s))!=Yi.Word)return s}return-1}function Oyt(e={}){return[Ybt,Uo,ha.of(e),Gbt,xyt,_1e]}const R1e=[{key:"Ctrl-Space",run:iP},{mac:"Alt-`",run:iP},{mac:"Alt-i",run:iP},{key:"Escape",run:Vbt},{key:"ArrowDown",run:n_(!0)},{key:"ArrowUp",run:n_(!1)},{key:"PageDown",run:n_(!0,"page")},{key:"PageUp",run:n_(!1,"page")},{key:"Enter",run:zbt}],xyt=xh.highest(yO.computeN([ha],e=>e.facet(ha).defaultKeymap?[R1e]:[])),I1e=[rs("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),rs("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),rs("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),rs("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),rs("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),rs(`try { \${} } catch (\${error}) { \${} @@ -711,27 +711,27 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus constructor(\${params}) { \${} } -}`,{label:"class",detail:"definition",type:"keyword"}),rs('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),rs('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],wyt=I1e.concat([rs("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),rs("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),rs("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),zZ=new aQ,D1e=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function bx(e){return(t,n)=>{let r=t.node.getChild("VariableDefinition");return r&&n(r,e),!0}}const Syt=["FunctionDeclaration"],Eyt={FunctionDeclaration:bx("function"),ClassDeclaration:bx("class"),ClassExpression:()=>!0,EnumDeclaration:bx("constant"),TypeAliasDeclaration:bx("type"),NamespaceDeclaration:bx("namespace"),VariableDefinition(e,t){e.matchContext(Syt)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function P1e(e,t){let n=zZ.get(t);if(n)return n;let r=[],i=!0;function s(a,l){let c=e.sliceString(a.from,a.to);r.push({label:c,type:l})}return t.cursor(Qr.IncludeAnonymous).iterate(a=>{if(i)i=!1;else if(a.name){let l=Eyt[a.name];if(l&&l(a,s)||D1e.has(a.name))return!1}else if(a.to-a.from>8192){for(let l of P1e(e,a.node))r.push(l);return!1}}),zZ.set(t,r),r}const VZ=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,M1e=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function kyt(e){let t=mi(e.state).resolveInner(e.pos,-1);if(M1e.indexOf(t.name)>-1)return null;let n=t.name=="VariableName"||t.to-t.from<20&&VZ.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let r=[];for(let i=t;i;i=i.parent)D1e.has(i.name)&&(r=r.concat(P1e(e.state.doc,i)));return{options:r,from:n?t.from:e.pos,validFor:VZ}}const hd=lh.define({name:"javascript",parser:_bt.configure({props:[wh.add({IfStatement:Ay({except:/^\s*({|else\b)/}),TryStatement:Ay({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:o0t,SwitchBody:e=>{let t=e.textAfter,n=/^\s*\}/.test(t),r=/^\s*(case|default)\b/.test(t);return e.baseIndent+(n?0:r?1:2)*e.unit},Block:Cy({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":Ay({except:/^\s*{/}),JSXElement(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},JSXEscape(e){let t=/\s*\}/.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"JSXOpenTag JSXSelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),Sh.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":BE,BlockComment(e){return{from:e.from+2,to:e.to-2}},JSXElement(e){let t=e.firstChild;if(!t||t.name=="JSXSelfClosingTag")return null;let n=e.lastChild;return{from:t.to,to:n.type.isError?e.to:n.from}},"JSXSelfClosingTag JSXOpenTag"(e){var t;let n=(t=e.firstChild)===null||t===void 0?void 0:t.nextSibling,r=e.lastChild;return!n||n.type.isError?null:{from:n.to,to:r.type.isError?e.to:r.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),L1e={test:e=>/^JSX/.test(e.name),facet:iR({commentTokens:{block:{open:"{/*",close:"*/}"}}})},$1e=hd.configure({dialect:"ts"},"typescript"),B1e=hd.configure({dialect:"jsx",props:[_Q.add(e=>e.isTop?[L1e]:void 0)]}),Q1e=hd.configure({dialect:"jsx ts",props:[_Q.add(e=>e.isTop?[L1e]:void 0)]},"typescript");let U1e=e=>({label:e,type:"keyword"});const F1e="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(U1e),_yt=F1e.concat(["declare","implements","private","protected","public"].map(U1e));function O6(e={}){let t=e.jsx?e.typescript?Q1e:B1e:e.typescript?$1e:hd,n=e.typescript?wyt.concat(_yt):I1e.concat(F1e);return new rm(t,[hd.data.of({autocomplete:S1e(M1e,IQ(n))}),hd.data.of({autocomplete:kyt}),e.jsx?Ayt:[]])}function Tyt(e){for(;;){if(e.name=="JSXOpenTag"||e.name=="JSXSelfClosingTag"||e.name=="JSXFragmentTag")return e;if(e.name=="JSXEscape"||!e.parent)return null;e=e.parent}}function HZ(e,t,n=e.length){for(let r=t==null?void 0:t.firstChild;r;r=r.nextSibling)if(r.name=="JSXIdentifier"||r.name=="JSXBuiltin"||r.name=="JSXNamespacedName"||r.name=="JSXMemberExpression")return e.sliceString(r.from,Math.min(r.to,n));return""}const Cyt=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Ayt=Ct.inputHandler.of((e,t,n,r,i)=>{if((Cyt?e.composing:e.compositionStarted)||e.state.readOnly||t!=n||r!=">"&&r!="/"||!hd.isActiveAt(e.state,t,-1))return!1;let s=i(),{state:a}=s,l=a.changeByRange(c=>{var u;let{head:d}=c,f=mi(a).resolveInner(d-1,-1),h;if(f.name=="JSXStartTag"&&(f=f.parent),!(a.doc.sliceString(d-1,d)!=r||f.name=="JSXAttributeValue"&&f.to>d)){if(r==">"&&f.name=="JSXFragmentTag")return{range:c,changes:{from:d,insert:""}};if(r=="/"&&f.name=="JSXStartCloseTag"){let m=f.parent,g=m.parent;if(g&&m.from==d-2&&((h=HZ(a.doc,g.firstChild,d))||((u=g.firstChild)===null||u===void 0?void 0:u.name)=="JSXFragmentTag")){let b=`${h}>`;return{range:Je.cursor(d+b.length,-1),changes:{from:d,insert:b}}}}else if(r==">"){let m=Tyt(f);if(m&&m.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(a.doc.sliceString(d,d+2))&&(h=HZ(a.doc,m,d)))return{range:c,changes:{from:d,insert:``}}}}return{range:c}});return l.changes.empty?!1:(e.dispatch([s,a.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),Nyt=vh({String:Y.string,Number:Y.number,"True False":Y.bool,PropertyName:Y.propertyName,Null:Y.null,", :":Y.separator,"[ ]":Y.squareBracket,"{ }":Y.brace}),jyt=ch.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[Nyt],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),Ryt=lh.define({name:"json",parser:jyt.configure({props:[wh.add({Object:Ay({except:/^\s*\}/}),Array:Ay({except:/^\s*\]/})}),Sh.add({"Object Array":BE})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Iyt(){return new rm(Ryt)}class RA{static create(t,n,r,i,s){let a=i+(i<<8)+t+(n<<4)|0;return new RA(t,n,r,a,s,[],[])}constructor(t,n,r,i,s,a,l){this.type=t,this.value=n,this.from=r,this.hash=i,this.end=s,this.children=a,this.positions=l,this.hashProp=[[Nn.contextHash,i]]}addChild(t,n){t.prop(Nn.contextHash)!=this.hash&&(t=new cr(t.type,t.children,t.positions,t.length,this.hashProp)),this.children.push(t),this.positions.push(n)}toTree(t,n=this.end){let r=this.children.length-1;return r>=0&&(n=Math.max(n,this.positions[r]+this.children[r].length+this.from)),new cr(t.types[this.type],this.children,this.positions,n-this.from).balance({makeTree:(i,s,a)=>new cr(Hs.none,i,s,a,this.hashProp)})}}var vt;(function(e){e[e.Document=1]="Document",e[e.CodeBlock=2]="CodeBlock",e[e.FencedCode=3]="FencedCode",e[e.Blockquote=4]="Blockquote",e[e.HorizontalRule=5]="HorizontalRule",e[e.BulletList=6]="BulletList",e[e.OrderedList=7]="OrderedList",e[e.ListItem=8]="ListItem",e[e.ATXHeading1=9]="ATXHeading1",e[e.ATXHeading2=10]="ATXHeading2",e[e.ATXHeading3=11]="ATXHeading3",e[e.ATXHeading4=12]="ATXHeading4",e[e.ATXHeading5=13]="ATXHeading5",e[e.ATXHeading6=14]="ATXHeading6",e[e.SetextHeading1=15]="SetextHeading1",e[e.SetextHeading2=16]="SetextHeading2",e[e.HTMLBlock=17]="HTMLBlock",e[e.LinkReference=18]="LinkReference",e[e.Paragraph=19]="Paragraph",e[e.CommentBlock=20]="CommentBlock",e[e.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",e[e.Escape=22]="Escape",e[e.Entity=23]="Entity",e[e.HardBreak=24]="HardBreak",e[e.Emphasis=25]="Emphasis",e[e.StrongEmphasis=26]="StrongEmphasis",e[e.Link=27]="Link",e[e.Image=28]="Image",e[e.InlineCode=29]="InlineCode",e[e.HTMLTag=30]="HTMLTag",e[e.Comment=31]="Comment",e[e.ProcessingInstruction=32]="ProcessingInstruction",e[e.Autolink=33]="Autolink",e[e.HeaderMark=34]="HeaderMark",e[e.QuoteMark=35]="QuoteMark",e[e.ListMark=36]="ListMark",e[e.LinkMark=37]="LinkMark",e[e.EmphasisMark=38]="EmphasisMark",e[e.CodeMark=39]="CodeMark",e[e.CodeText=40]="CodeText",e[e.CodeInfo=41]="CodeInfo",e[e.LinkTitle=42]="LinkTitle",e[e.LinkLabel=43]="LinkLabel",e[e.URL=44]="URL"})(vt||(vt={}));class Dyt{constructor(t,n){this.start=t,this.content=n,this.marks=[],this.parsers=[]}}class Pyt{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let t=this.skipSpace(this.basePos);this.indent=this.countIndent(t,this.pos,this.indent),this.pos=t,this.next=t==this.text.length?-1:this.text.charCodeAt(t)}skipSpace(t){return Yv(this.text,t)}reset(t){for(this.text=t,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(t){this.basePos=t,this.baseIndent=this.countIndent(t,this.pos,this.indent)}moveBaseColumn(t){this.baseIndent=t,this.basePos=this.findColumn(t)}addMarker(t){this.markers.push(t)}countIndent(t,n=0,r=0){for(let i=n;i=t.stack[n.depth+1].value+n.baseIndent)return!0;if(n.indent>=n.baseIndent+4)return!1;let r=(e.type==vt.OrderedList?VQ:zQ)(n,t,!1);return r>0&&(e.type!=vt.BulletList||FQ(n,t,!1)<0)&&n.text.charCodeAt(n.pos+r-1)==e.value}const z1e={[vt.Blockquote](e,t,n){return n.next!=62?!1:(n.markers.push(jr(vt.QuoteMark,t.lineStart+n.pos,t.lineStart+n.pos+1)),n.moveBase(n.pos+(Uc(n.text.charCodeAt(n.pos+1))?2:1)),e.end=t.lineStart+n.text.length,!0)},[vt.ListItem](e,t,n){return n.indent-1?!1:(n.moveBaseColumn(n.baseIndent+e.value),!0)},[vt.OrderedList]:qZ,[vt.BulletList]:qZ,[vt.Document](){return!0}};function Uc(e){return e==32||e==9||e==10||e==13}function Yv(e,t=0){for(;tn&&Uc(e.charCodeAt(t-1));)t--;return t}function V1e(e){if(e.next!=96&&e.next!=126)return-1;let t=e.pos+1;for(;t-1&&e.depth==t.stack.length&&t.parser.leafBlockParsers.indexOf(K1e.SetextHeading)>-1||r<3?-1:1}function q1e(e,t){for(let n=e.stack.length-1;n>=0;n--)if(e.stack[n].type==t)return!0;return!1}function zQ(e,t,n){return(e.next==45||e.next==43||e.next==42)&&(e.pos==e.text.length-1||Uc(e.text.charCodeAt(e.pos+1)))&&(!n||q1e(t,vt.BulletList)||e.skipSpace(e.pos+2)=48&&i<=57;){r++;if(r==e.text.length)return-1;i=e.text.charCodeAt(r)}return r==e.pos||r>e.pos+9||i!=46&&i!=41||re.pos+1||e.next!=49)?-1:r+1-e.pos}function X1e(e){if(e.next!=35)return-1;let t=e.pos+1;for(;t6?-1:n}function G1e(e){if(e.next!=45&&e.next!=61||e.indent>=e.baseIndent+4)return-1;let t=e.pos+1;for(;t/,Y1e=/\?>/,v6=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/,Y1e=/\?>/,v6=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/i.exec(r);if(s)return e.append(jr(vt.Comment,n,n+1+s[0].length));let a=/^\?[^]*?\?>/.exec(r);if(a)return e.append(jr(vt.ProcessingInstruction,n,n+1+a[0].length));let l=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(r);return l?e.append(jr(vt.HTMLTag,n,n+1+l[0].length)):-1},Emphasis(e,t,n){if(t!=95&&t!=42)return-1;let r=n+1;for(;e.char(r)==t;)r++;let i=e.slice(n-1,n),s=e.slice(r,r+1),a=gS.test(i),l=gS.test(s),c=/\s|^$/.test(i),u=/\s|^$/.test(s),d=!u&&(!l||c||a),f=!c&&(!a||u||l),h=d&&(t==42||!f||a),m=f&&(t==42||!d||l);return e.append(new wl(t==95?rOe:iOe,n,r,(h?1:0)|(m?2:0)))},HardBreak(e,t,n){if(t==92&&e.char(n+1)==10)return e.append(jr(vt.HardBreak,n,n+2));if(t==32){let r=n+1;for(;e.char(r)==32;)r++;if(e.char(r)==10&&r>=n+2)return e.append(jr(vt.HardBreak,n,r+1))}return-1},Link(e,t,n){return t==91?e.append(new wl(Zm,n,n+1,1)):-1},Image(e,t,n){return t==33&&e.char(n+1)==91?e.append(new wl(IA,n,n+2,1)):-1},LinkEnd(e,t,n){if(t!=93)return-1;for(let r=e.parts.length-1;r>=0;r--){let i=e.parts[r];if(i instanceof wl&&(i.type==Zm||i.type==IA)){if(!i.side||e.skipSpace(i.to)==n&&!/[(\[]/.test(e.slice(n+1,n+2)))return e.parts[r]=null,-1;let s=e.takeContent(r),a=e.parts[r]=Uyt(e,s,i.type==Zm?vt.Link:vt.Image,i.from,n+1);if(i.type==Zm)for(let l=0;lt?jr(vt.URL,t+n,s+n):s==e.length?null:!1}}function aOe(e,t,n){let r=e.charCodeAt(t);if(r!=39&&r!=34&&r!=40)return!1;let i=r==40?41:r;for(let s=t+1,a=!1;s=this.end?-1:this.text.charCodeAt(t-this.offset)}get end(){return this.offset+this.text.length}slice(t,n){return this.text.slice(t-this.offset,n-this.offset)}append(t){return this.parts.push(t),t.to}addDelimiter(t,n,r,i,s){return this.append(new wl(t,n,r,(i?1:0)|(s?2:0)))}get hasOpenLink(){for(let t=this.parts.length-1;t>=0;t--){let n=this.parts[t];if(n instanceof wl&&(n.type==Zm||n.type==IA))return!0}return!1}addElement(t){return this.append(t)}resolveMarkers(t){for(let r=t;r=t;c--){let b=this.parts[c];if(b instanceof wl&&b.side&1&&b.type==i.type&&!(s&&(i.side&1||b.side&2)&&(b.to-b.from+a)%3==0&&((b.to-b.from)%3||a%3))){l=b;break}}if(!l)continue;let u=i.type.resolve,d=[],f=l.from,h=i.to;if(s){let b=Math.min(2,l.to-l.from,a);f=l.to-b,h=i.from+b,u=b==1?"Emphasis":"StrongEmphasis"}l.type.mark&&d.push(this.elt(l.type.mark,f,l.to));for(let b=c+1;b=0;n--){let r=this.parts[n];if(r instanceof wl&&r.type==t&&r.side&1)return n}return null}takeContent(t){let n=this.resolveMarkers(t);return this.parts.length=t,n}getDelimiterAt(t){let n=this.parts[t];return n instanceof wl?n:null}skipSpace(t){return Yv(this.text,t-this.offset)+this.offset}elt(t,n,r,i){return typeof t=="string"?jr(this.parser.getNodeType(t),n,r,i):new nOe(t,n)}}HQ.linkStart=Zm;HQ.imageStart=IA;function S6(e,t){if(!t.length)return e;if(!e.length)return t;let n=e.slice(),r=0;for(let i of t){for(;r(t?t-1:0))return!1;if(this.fragmentEnd<0){let s=this.fragment.to;for(;s>0&&this.input.read(s-1,s)!=` -`;)s--;this.fragmentEnd=s?s-1:0}let r=this.cursor;r||(r=this.cursor=this.fragment.tree.cursor(),r.firstChild());let i=t+this.fragment.offset;for(;r.to<=i;)if(!r.parent())return!1;for(;;){if(r.from>=i)return this.fragment.from<=n;if(!r.childAfter(i))return!1}}matches(t){let n=this.cursor.tree;return n&&n.prop(Nn.contextHash)==t}takeNodes(t){let n=this.cursor,r=this.fragment.offset,i=this.fragmentEnd-(this.fragment.openEnd?1:0),s=t.absoluteLineStart,a=s,l=t.block.children.length,c=a,u=l;for(;;){if(n.to-r>i){if(n.type.isAnonymous&&n.firstChild())continue;break}let d=lOe(n.from-r,t.ranges);if(n.to-r<=t.ranges[t.rangeI].to)t.addNode(n.tree,d);else{let f=new cr(t.parser.nodeSet.types[vt.Paragraph],[],[],0,t.block.hashProp);t.reusePlaceholders.set(f,n.tree),t.addNode(f,d)}if(n.type.is("Block")&&(Fyt.indexOf(n.type.id)<0?(a=n.to-r,l=t.block.children.length):(a=c,l=u),c=n.to-r,u=t.block.children.length),!n.nextSibling())break}for(;t.block.children.length>l;)t.block.children.pop(),t.block.positions.pop();return a-s}}function lOe(e,t){let n=e;for(let r=1;rt_[e]),Object.keys(t_).map(e=>K1e[e]),Object.keys(t_),$yt,z1e,Object.keys(oP).map(e=>oP[e]),Object.keys(oP),[]);function qyt(e,t,n){let r=[];for(let i=e.firstChild,s=t;;i=i.nextSibling){let a=i?i.from:n;if(a>s&&r.push({from:s,to:a}),!i)break;s=i.to}return r}function Xyt(e){let{codeParser:t,htmlParser:n}=e;return{wrap:Ebe((i,s)=>{let a=i.type.id;if(t&&(a==vt.CodeBlock||a==vt.FencedCode)){let l="";if(a==vt.FencedCode){let u=i.node.getChild(vt.CodeInfo);u&&(l=s.read(u.from,u.to))}let c=t(l);if(c)return{parser:c,overlay:u=>u.type.id==vt.CodeText,bracketed:a==vt.FencedCode}}else if(n&&(a==vt.HTMLBlock||a==vt.HTMLTag||a==vt.CommentBlock))return{parser:n,overlay:qyt(i.node,i.from,i.to)};return null})}}const Gyt={resolve:"Strikethrough",mark:"StrikethroughMark"},Wyt={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":Y.strikethrough}},{name:"StrikethroughMark",style:Y.processingInstruction}],parseInline:[{name:"Strikethrough",parse(e,t,n){if(t!=126||e.char(n+1)!=126||e.char(n+2)==126)return-1;let r=e.slice(n-1,n),i=e.slice(n+2,n+3),s=/\s|^$/.test(r),a=/\s|^$/.test(i),l=gS.test(r),c=gS.test(i);return e.addDelimiter(Gyt,n,n+2,!a&&(!c||s||l),!s&&(!l||a||c))},after:"Emphasis"}]};function Zv(e,t,n=0,r,i=0){let s=0,a=!0,l=-1,c=-1,u=!1,d=()=>{r.push(e.elt("TableCell",i+l,i+c,e.parser.parseInline(t.slice(l,c),i+l)))};for(let f=n;f-1)&&s++,a=!1,r&&(l>-1&&d(),r.push(e.elt("TableDelimiter",f+i,f+i+1))),l=c=-1):(u||h!=32&&h!=9)&&(l<0&&(l=f),c=f+1),u=!u&&h==92}return l>-1&&(s++,r&&d()),s}function YZ(e,t){for(let n=t;n\s]*\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;class ZZ{constructor(){this.rows=null}nextLine(t,n,r){if(this.rows==null){this.rows=!1;let i;if((n.next==45||n.next==58||n.next==124)&&cOe.test(i=n.text.slice(n.pos))){let s=[];Zv(t,r.content,0,s,r.start)==Zv(t,i,0)&&(this.rows=[t.elt("TableHeader",r.start,r.start+r.content.length,s),t.elt("TableDelimiter",t.lineStart+n.pos,t.lineStart+n.text.length)])}}else if(this.rows){let i=[];Zv(t,n.text,n.pos,i,t.lineStart),this.rows.push(t.elt("TableRow",t.lineStart+n.pos,t.lineStart+n.text.length,i))}return!1}finish(t,n){return this.rows?(t.addLeafElement(n,t.elt("Table",n.start,n.start+n.content.length,this.rows)),!0):!1}}const Yyt={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":Y.heading}},"TableRow",{name:"TableCell",style:Y.content},{name:"TableDelimiter",style:Y.processingInstruction}],parseBlock:[{name:"Table",leaf(e,t){return YZ(t.content,0)?new ZZ:null},endLeaf(e,t,n){if(n.parsers.some(i=>i instanceof ZZ)||!YZ(t.text,t.basePos))return!1;let r=e.peekLine();return cOe.test(r)&&Zv(e,t.text,t.basePos)==Zv(e,r,t.basePos)},before:"SetextHeading"}]};class Zyt{nextLine(){return!1}finish(t,n){return t.addLeafElement(n,t.elt("Task",n.start,n.start+n.content.length,[t.elt("TaskMarker",n.start,n.start+3),...t.parser.parseInline(n.content.slice(3),n.start+3)])),!0}}const Kyt={defineNodes:[{name:"Task",block:!0,style:Y.list},{name:"TaskMarker",style:Y.atom}],parseBlock:[{name:"TaskList",leaf(e,t){return/^\[[ xX]\][ \t]/.test(t.content)&&e.parentType().name=="ListItem"?new Zyt:null},after:"SetextHeading"}]},KZ=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,JZ=/[\w-]+(\.[\w-]+)+(:\d+)?(\/[^\s<]*)?/gy,Jyt=/[\w-]+\.[\w-]+($|[/:])/,eK=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,tK=/\/[a-zA-Z\d@.]+/gy;function nK(e,t,n,r){let i=0;for(let s=t;s-1)return-1;let r=t+n[0].length;for(;;){let i=e[r-1],s;if(/[?!.,:*_~]/.test(i)||i==")"&&nK(e,t,r,")")>nK(e,t,r,"("))r--;else if(i==";"&&(s=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(e.slice(t,r))))r=t+s.index;else break}return r}function rK(e,t){eK.lastIndex=t;let n=eK.exec(e);if(!n)return-1;let r=n[0][n[0].length-1];return r=="_"||r=="-"?-1:t+n[0].length-(r=="."?1:0)}const t1t={parseInline:[{name:"Autolink",parse(e,t,n){let r=n-e.offset;if(r&&/\w/.test(e.text[r-1]))return-1;KZ.lastIndex=r;let i=KZ.exec(e.text),s=-1;if(!i)return-1;if(i[1]||i[2]){if(s=e1t(e.text,r+i[0].length),s>-1&&e.hasOpenLink){let a=/([^\[\]]|\[[^\]]*\])*/.exec(e.text.slice(r,s));s=r+a[0].length}}else i[3]?s=rK(e.text,r):(s=rK(e.text,r+i[0].length),s>-1&&i[0]=="xmpp:"&&(tK.lastIndex=s,i=tK.exec(e.text),i&&(s=i.index+i[0].length)));return s<0?-1:(e.addElement(e.elt("URL",n,s+e.offset)),s+e.offset)}}]},n1t=[Yyt,Kyt,Wyt,t1t];function uOe(e,t,n){return(r,i,s)=>{if(i!=e||r.char(s+1)==e)return-1;let a=[r.elt(n,s,s+1)];for(let l=s+1;l=65&&e<=90||e==95||e>=97&&e<=122||e>=161}let oK=null,lK=null,cK=0;function k6(e,t){let n=e.pos+t;if(cK==n&&lK==e)return oK;let r=e.peek(t),i="";for(;A1t(r);)i+=String.fromCharCode(r),r=e.peek(++t);return lK=e,cK=n,oK=i?i.toLowerCase():r==N1t||r==j1t?void 0:null}const yOe=60,DA=62,XQ=47,N1t=63,j1t=33,R1t=45;function uK(e,t){this.name=e,this.parent=t}const I1t=[qQ,pOe,dOe,fOe,hOe],D1t=new oR({start:null,shift(e,t,n,r){return I1t.indexOf(t)>-1?new uK(k6(r,1)||"",e):e},reduce(e,t){return t==mOe&&e?e.parent:e},reuse(e,t,n,r){let i=t.type.id;return i==qQ||i==S1t?new uK(k6(r,1)||"",e):e},strict:!1}),P1t=new js((e,t)=>{if(e.next!=yOe){e.next<0&&t.context&&e.acceptToken(lP);return}e.advance();let n=e.next==XQ;n&&e.advance();let r=k6(e,0);if(r===void 0)return;if(!r)return e.acceptToken(n?b1t:g1t);let i=t.context?t.context.name:null;if(n){if(r==i)return e.acceptToken(h1t);if(i&&C1t[i])return e.acceptToken(lP,-2);if(t.dialectEnabled(k1t))return e.acceptToken(p1t);for(let s=t.context;s;s=s.parent)if(s.name==r)return;e.acceptToken(m1t)}else{if(r=="script")return e.acceptToken(dOe);if(r=="style")return e.acceptToken(fOe);if(r=="textarea")return e.acceptToken(hOe);if(T1t.hasOwnProperty(r))return e.acceptToken(pOe);i&&aK[i]&&aK[i][r]?e.acceptToken(lP,-1):e.acceptToken(qQ)}},{contextual:!0}),M1t=new js(e=>{for(let t=0,n=0;;n++){if(e.next<0){n&&e.acceptToken(sK);break}if(e.next==R1t)t++;else if(e.next==DA&&t>=2){n>=3&&e.acceptToken(sK,-2);break}else t=0;e.advance()}});function L1t(e){for(;e;e=e.parent)if(e.name=="svg"||e.name=="math")return!0;return!1}const $1t=new js((e,t)=>{if(e.next==XQ&&e.peek(1)==DA){let n=t.dialectEnabled(_1t)||L1t(t.context);e.acceptToken(n?f1t:iK,2)}else e.next==DA&&e.acceptToken(iK,1)});function GQ(e,t,n){let r=2+e.length;return new js(i=>{for(let s=0,a=0,l=0;;l++){if(i.next<0){l&&i.acceptToken(t);break}if(s==0&&i.next==yOe||s==1&&i.next==XQ||s>=2&&sa?i.acceptToken(t,-a):i.acceptToken(n,-(a-2));break}else if((i.next==10||i.next==13)&&l){i.acceptToken(t,1);break}else s=a=0;i.advance()}})}const B1t=GQ("script",a1t,o1t),Q1t=GQ("style",l1t,c1t),U1t=GQ("textarea",u1t,d1t),F1t=vh({"Text RawText IncompleteTag IncompleteCloseTag":Y.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":Y.angleBracket,TagName:Y.tagName,"MismatchedCloseTag/TagName":[Y.tagName,Y.invalid],AttributeName:Y.attributeName,"AttributeValue UnquotedAttributeValue":Y.attributeValue,Is:Y.definitionOperator,"EntityReference CharacterReference":Y.character,Comment:Y.blockComment,ProcessingInst:Y.processingInstruction,DoctypeDecl:Y.documentMeta}),z1t=ch.deserialize({version:14,states:",xOVO!rOOO!ZQ#tO'#CrO!`Q#tO'#C{O!eQ#tO'#DOO!jQ#tO'#DRO!oQ#tO'#DTO!tOaO'#CqO#PObO'#CqO#[OdO'#CqO$kO!rO'#CqOOO`'#Cq'#CqO$rO$fO'#DUO$zQ#tO'#DWO%PQ#tO'#DXOOO`'#Dl'#DlOOO`'#DZ'#DZQVO!rOOO%UQ&rO,59^O%aQ&rO,59gO%lQ&rO,59jO%wQ&rO,59mO&SQ&rO,59oOOOa'#D_'#D_O&_OaO'#CyO&jOaO,59]OOOb'#D`'#D`O&rObO'#C|O&}ObO,59]OOOd'#Da'#DaO'VOdO'#DPO'bOdO,59]OOO`'#Db'#DbO'jO!rO,59]O'qQ#tO'#DSOOO`,59],59]OOOp'#Dc'#DcO'vO$fO,59pOOO`,59p,59pO(OQ#|O,59rO(TQ#|O,59sOOO`-E7X-E7XO(YQ&rO'#CtOOQW'#D['#D[O(hQ&rO1G.xOOOa1G.x1G.xOOO`1G/Z1G/ZO(sQ&rO1G/ROOOb1G/R1G/RO)OQ&rO1G/UOOOd1G/U1G/UO)ZQ&rO1G/XOOO`1G/X1G/XO)fQ&rO1G/ZOOOa-E7]-E7]O)qQ#tO'#CzOOO`1G.w1G.wOOOb-E7^-E7^O)vQ#tO'#C}OOOd-E7_-E7_O){Q#tO'#DQOOO`-E7`-E7`O*QQ#|O,59nOOOp-E7a-E7aOOO`1G/[1G/[OOO`1G/^1G/^OOO`1G/_1G/_O*VQ,UO,59`OOQW-E7Y-E7YOOOa7+$d7+$dOOO`7+$u7+$uOOOb7+$m7+$mOOOd7+$p7+$pOOO`7+$s7+$sO*bQ#|O,59fO*gQ#|O,59iO*lQ#|O,59lOOO`1G/Y1G/YO*qO7[O'#CwO+SOMhO'#CwOOQW1G.z1G.zOOO`1G/Q1G/QOOO`1G/T1G/TOOO`1G/W1G/WOOOO'#D]'#D]O+eO7[O,59cOOQW,59c,59cOOOO'#D^'#D^O+vOMhO,59cOOOO-E7Z-E7ZOOQW1G.}1G.}OOOO-E7[-E7[",stateData:",c~O!_OS~OUSOVPOWQOXROYTO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O|_O!eZO~OgaO~OgbO~OgcO~OgdO~OgeO~O!XfOPmP![mP~O!YiOQpP![pP~O!ZlORsP![sP~OUSOVPOWQOXROYTOZqO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O!eZO~O![rO~P#gO!]sO!fuO~OgvO~OgwO~OS|OT}OiyO~OS!POT}OiyO~OS!ROT}OiyO~OS!TOT}OiyO~OS}OT}OiyO~O!XfOPmX![mX~OP!WO![!XO~O!YiOQpX![pX~OQ!ZO![!XO~O!ZlORsX![sX~OR!]O![!XO~O![!XO~P#gOg!_O~O!]sO!f!aO~OS!bO~OS!cO~Oj!dOShXThXihX~OS!fOT!gOiyO~OS!hOT!gOiyO~OS!iOT!gOiyO~OS!jOT!gOiyO~OS!gOT!gOiyO~Og!kO~Og!lO~Og!mO~OS!nO~Ol!qO!a!oO!c!pO~OS!rO~OS!sO~OS!tO~Ob!uOc!uOd!uO!a!wO!b!uO~Ob!xOc!xOd!xO!c!wO!d!xO~Ob!uOc!uOd!uO!a!{O!b!uO~Ob!xOc!xOd!xO!c!{O!d!xO~OT~cbd!ey|!e~",goto:"%q!aPPPPPPPPPPPPPPPPPPPPP!b!hP!nPP!zP!}#Q#T#Z#^#a#g#j#m#s#y!bP!b!bP$P$V$m$s$y%P%V%]%cPPPPPPPP%iX^OX`pXUOX`pezabcde{!O!Q!S!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ!ObQ!QcQ!SdQ!UeZ!e{!O!Q!S!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:68,context:D1t,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,22,31,34,37,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,30,33,36,38,"OpenTag"],["group",-10,14,15,18,19,20,21,40,41,42,43,"Entity",17,"Entity TextContent",-3,29,32,35,"TextContent Entity"],["isolate",-11,22,30,31,33,34,36,37,38,39,42,43,"ltr",-3,27,28,40,""]],propSources:[F1t],skippedNodes:[0],repeatNodeCount:9,tokenData:"!]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zblWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOb!R!R7tP;=`<%l7S!Z8OYlWb!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{iiSlWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!_:sbiSlWb!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VP<%l?Ah;{?Ah?BY7S?BY?Mn;{?MnO7S!V=dXiSb!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!V>SP;=`<%l;{!_>YP;=`<%l8t!_>dhiSlWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^/^!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!Z@TalWOX@OXZAYZ[@O[^AY^p@Oqr@OrsAYsw@OwxAYx!]@O!]!^Az!^!aAY!a#S@O#S#TAY#T;'S@O;'S;=`Bq<%lO@O!RA]UOpAYq!]AY!]!^Ao!^;'SAY;'S;=`At<%lOAY!RAtOc!R!RAwP;=`<%lAY!ZBRYlWc!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!ZBtP;=`<%l@O!_COhiSlWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^Dj!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!_DsbiSlWc!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VFQbiSOpAYqrE{rsAYswE{wxAYx!PE{!P!QAY!Q!]E{!]!^GY!^!aAY!a#sE{#s$fAY$f;'SE{;'S;=`G|<%l?AhE{?Ah?BYAY?BY?MnE{?MnOAY!VGaXiSc!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!VHPP;=`<%lE{!_HVP;=`<%lBw!ZHcW!cxaP!b`Or(trs'ksv(tw!^(t!^!_)e!_;'S(t;'S;=`*P<%lO(t!aIYliSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OKQ!O!P-_!P!Q$q!Q!^-_!^!_*V!_!a&X!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!aK_kiSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx!P-_!P!Q$q!Q!^-_!^!_*V!_!`&X!`!aMS!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!TM_XaP!b`!dp!fQOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X!aNZ!ZiSgQaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OMz!O!PMz!P!Q$q!Q![Mz![!]Mz!]!^-_!^!_*V!_!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f$}-_$}%OMz%O%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz1p4UMz4U4dMz4d4e-_4e$ISMz$IS$I`-_$I`$IbMz$Ib$Je-_$Je$JgMz$Jg$Kh-_$Kh%#tMz%#t&/x-_&/x&EtMz&Et&FV-_&FV;'SMz;'S;:j!#|;:j;=`3X<%l?&r-_?&r?AhMz?Ah?BY$q?BY?MnMz?MnO$q!a!$PP;=`<%lMz!R!$ZY!b`!dpOq*Vqr!$yrs(Vsv*Vwx)ex!a*V!a!b!4t!b;'S*V;'S;=`*s<%lO*V!R!%Q]!b`!dpOr*Vrs(Vsv*Vwx)ex}*V}!O!%y!O!f*V!f!g!']!g#W*V#W#X!0`#X;'S*V;'S;=`*s<%lO*V!R!&QX!b`!dpOr*Vrs(Vsv*Vwx)ex}*V}!O!&m!O;'S*V;'S;=`*s<%lO*V!R!&vV!b`!dp!ePOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!'dX!b`!dpOr*Vrs(Vsv*Vwx)ex!q*V!q!r!(P!r;'S*V;'S;=`*s<%lO*V!R!(WX!b`!dpOr*Vrs(Vsv*Vwx)ex!e*V!e!f!(s!f;'S*V;'S;=`*s<%lO*V!R!(zX!b`!dpOr*Vrs(Vsv*Vwx)ex!v*V!v!w!)g!w;'S*V;'S;=`*s<%lO*V!R!)nX!b`!dpOr*Vrs(Vsv*Vwx)ex!{*V!{!|!*Z!|;'S*V;'S;=`*s<%lO*V!R!*bX!b`!dpOr*Vrs(Vsv*Vwx)ex!r*V!r!s!*}!s;'S*V;'S;=`*s<%lO*V!R!+UX!b`!dpOr*Vrs(Vsv*Vwx)ex!g*V!g!h!+q!h;'S*V;'S;=`*s<%lO*V!R!+xY!b`!dpOr!+qrs!,hsv!+qvw!-Swx!.[x!`!+q!`!a!/j!a;'S!+q;'S;=`!0Y<%lO!+qq!,mV!dpOv!,hvx!-Sx!`!,h!`!a!-q!a;'S!,h;'S;=`!.U<%lO!,hP!-VTO!`!-S!`!a!-f!a;'S!-S;'S;=`!-k<%lO!-SP!-kO|PP!-nP;=`<%l!-Sq!-xS!dp|POv(Vx;'S(V;'S;=`(h<%lO(Vq!.XP;=`<%l!,ha!.aX!b`Or!.[rs!-Ssv!.[vw!-Sw!`!.[!`!a!.|!a;'S!.[;'S;=`!/d<%lO!.[a!/TT!b`|POr)esv)ew;'S)e;'S;=`)y<%lO)ea!/gP;=`<%l!.[!R!/sV!b`!dp|POr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!0]P;=`<%l!+q!R!0gX!b`!dpOr*Vrs(Vsv*Vwx)ex#c*V#c#d!1S#d;'S*V;'S;=`*s<%lO*V!R!1ZX!b`!dpOr*Vrs(Vsv*Vwx)ex#V*V#V#W!1v#W;'S*V;'S;=`*s<%lO*V!R!1}X!b`!dpOr*Vrs(Vsv*Vwx)ex#h*V#h#i!2j#i;'S*V;'S;=`*s<%lO*V!R!2qX!b`!dpOr*Vrs(Vsv*Vwx)ex#m*V#m#n!3^#n;'S*V;'S;=`*s<%lO*V!R!3eX!b`!dpOr*Vrs(Vsv*Vwx)ex#d*V#d#e!4Q#e;'S*V;'S;=`*s<%lO*V!R!4XX!b`!dpOr*Vrs(Vsv*Vwx)ex#X*V#X#Y!+q#Y;'S*V;'S;=`*s<%lO*V!R!4{Y!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!a!4t!a!b!:]!b;'S!4t;'S;=`!;r<%lO!4tq!5pV!dpOv!5kvx!6Vx!a!5k!a!b!7W!b;'S!5k;'S;=`!8V<%lO!5kP!6YTO!a!6V!a!b!6i!b;'S!6V;'S;=`!7Q<%lO!6VP!6lTO!`!6V!`!a!6{!a;'S!6V;'S;=`!7Q<%lO!6VP!7QOyPP!7TP;=`<%l!6Vq!7]V!dpOv!5kvx!6Vx!`!5k!`!a!7r!a;'S!5k;'S;=`!8V<%lO!5kq!7yS!dpyPOv(Vx;'S(V;'S;=`(h<%lO(Vq!8YP;=`<%l!5ka!8bX!b`Or!8]rs!6Vsv!8]vw!6Vw!a!8]!a!b!8}!b;'S!8];'S;=`!:V<%lO!8]a!9SX!b`Or!8]rs!6Vsv!8]vw!6Vw!`!8]!`!a!9o!a;'S!8];'S;=`!:V<%lO!8]a!9vT!b`yPOr)esv)ew;'S)e;'S;=`)y<%lO)ea!:YP;=`<%l!8]!R!:dY!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!`!4t!`!a!;S!a;'S!4t;'S;=`!;r<%lO!4t!R!;]V!b`!dpyPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!{let u=l.type.id;if(u==x1t)return cP(l,c,n);if(u==v1t)return cP(l,c,r);if(u==w1t)return cP(l,c,i);if(u==mOe&&s.length){let d=l.node,f=d.firstChild,h=f&&dK(f,c),m;if(h){for(let g of s)if(g.tag==h&&(!g.attrs||g.attrs(m||(m=OOe(f,c))))){let b=d.lastChild,y=b.type.id==E1t?b.from:d.to;if(y>f.to)return{parser:g.parser,overlay:[{from:f.to,to:y}]}}}}if(a&&u==gOe){let d=l.node,f;if(f=d.firstChild){let h=a[c.read(f.from,f.to)];if(h)for(let m of h){if(m.tagName&&m.tagName!=dK(d.parent,c))continue;let g=d.lastChild;if(g.type.id==E6){let b=g.from+1,y=g.lastChild,O=g.to-(y&&y.isError?0:1);if(O>b)return{parser:m.parser,overlay:[{from:b,to:O}],bracketed:!0}}else if(g.type.id==bOe)return{parser:m.parser,overlay:[{from:g.from,to:g.to}]}}}}return null})}const V1t=145,fK=1,H1t=146,q1t=147,vOe=2,X1t=148,G1t=3,W1t=4,wOe=[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],Y1t=58,Z1t=40,SOe=95,K1t=91,wT=45,J1t=46,eOt=35,tOt=37,nOt=38,rOt=92,iOt=10,sOt=42;function bS(e){return e>=65&&e<=90||e>=97&&e<=122||e>=161}function WQ(e){return e>=48&&e<=57}function hK(e){return WQ(e)||e>=97&&e<=102||e>=65&&e<=70}const EOe=(e,t,n)=>(r,i)=>{for(let s=!1,a=0,l=0;;l++){let{next:c}=r;if(bS(c)||c==wT||c==SOe||s&&WQ(c))!s&&(c!=wT||l>0)&&(s=!0),a===l&&c==wT&&a++,r.advance();else if(c==rOt&&r.peek(1)!=iOt){if(r.advance(),hK(r.next)){do r.advance();while(hK(r.next));r.next==32&&r.advance()}else r.next>-1&&r.advance();s=!0}else{s&&r.acceptToken(a==2&&i.canShift(vOe)?t:c==Z1t?n:e);break}}},aOt=new js(EOe(H1t,vOe,q1t),{contextual:!0}),oOt=new js(EOe(X1t,G1t,W1t),{contextual:!0}),lOt=new js(e=>{if(wOe.includes(e.peek(-1))){let{next:t}=e;(bS(t)||t==SOe||t==eOt||t==J1t||t==sOt||t==K1t||t==Y1t&&bS(e.peek(1))||t==wT||t==nOt)&&e.acceptToken(V1t)}}),cOt=new js(e=>{if(!wOe.includes(e.peek(-1))){let{next:t}=e;if(t==tOt&&(e.advance(),e.acceptToken(fK)),bS(t)){do e.advance();while(bS(e.next)||WQ(e.next));e.acceptToken(fK)}}}),uOt=vh({"AtKeyword import charset namespace keyframes media supports font-feature-values":Y.definitionKeyword,"from to selector scope MatchFlag":Y.keyword,NamespaceName:Y.namespace,KeyframeName:Y.labelName,KeyframeRangeName:Y.operatorKeyword,TagName:Y.tagName,ClassName:Y.className,PseudoClassName:Y.constant(Y.className),IdName:Y.labelName,"FeatureName PropertyName":Y.propertyName,AttributeName:Y.attributeName,NumberLiteral:Y.number,KeywordQuery:Y.keyword,UnaryQueryOp:Y.operatorKeyword,"CallTag ValueName FontName":Y.atom,VariableName:Y.variableName,Callee:Y.operatorKeyword,Unit:Y.unit,"UniversalSelector NestingSelector":Y.definitionOperator,"MatchOp CompareOp":Y.compareOperator,"ChildOp SiblingOp, LogicOp":Y.logicOperator,BinOp:Y.arithmeticOperator,Important:Y.modifier,Comment:Y.blockComment,ColorLiteral:Y.color,"ParenthesizedContent StringLiteral":Y.string,":":Y.punctuation,"PseudoOp #":Y.derefOperator,"; , |":Y.separator,"( )":Y.paren,"[ ]":Y.squareBracket,"{ }":Y.brace}),dOt={__proto__:null,lang:44,"nth-child":44,"nth-last-child":44,"nth-of-type":44,"nth-last-of-type":44,dir:44,"host-context":44,if:90,url:152,"url-prefix":152,domain:152,regexp:152},fOt={__proto__:null,or:104,and:104,not:112,only:112,layer:206},hOt={__proto__:null,selector:118,style:124,layer:202},pOt={__proto__:null,"@import":198,"@media":210,"@charset":214,"@namespace":218,"@keyframes":224,"@supports":236,"@scope":240,"@font-feature-values":246},mOt={__proto__:null,to:243},gOt=ch.deserialize({version:14,states:"MlQYQdOOO#}QdOOP$UO`OOO%OQaO'#CfOOQP'#Ce'#CeO%VQdO'#CgO%[Q`O'#CgO%aQaO'#FnO&XQdO'#CkO&xQaO'#CcO'SQdO'#CnO'_QdO'#EOO'dQdO'#EQO'oQdO'#EXO'oQdO'#E[OOQP'#Fn'#FnO)RQhO'#E}OOQS'#Fm'#FmOOQS'#FQ'#FQQYQdOOO)YQdO'#EbO*iQhO'#EhO)YQdO'#EjO*pQdO'#ElO*{QdO'#EoO)}QhO'#EuO+TQdO'#EwO+`QdO'#EzO+eQaO'#CfO+lQ`O'#E_O+qQ`O'#F{O+|QdO'#F{QOQ`OOP,WO&jO'#CaPOOO)CA])CA]OOQP'#Ci'#CiOOQP,59R,59RO%VQdO,59ROOQP'#Cm'#CmOOQP,59V,59VO&XQdO,59VO,cQdO,59YO'_QdO,5:jO'dQdO,5:lO'oQdO,5:sO'oQdO,5:uO'oQdO,5:vO'oQdO'#FXO,nQ`O,58}O,vQdO'#E^OOQS,58},58}OOQP'#Cq'#CqOOQO'#D|'#D|OOQP,59Y,59YO,}Q`O,59YO-SQ`O,59YOOQP'#EP'#EPOOQP,5:j,5:jO-XQpO'#ERO-dQdO'#ESO-iQ`O'#ESO-nQpO,5:lO.XQaO,5:sO.oQaO,5:vOOQW'#D^'#D^O/nQhO'#DgO0RQhO,5;iO)}QhO'#DeO0`Q`O'#DnO0eQhO'#DxOOQW'#Ft'#FtOOQS,5;i,5;iO0jQ`O'#DhO0oQ`O'#DkOOQS-E9O-E9OOOQ['#Cv'#CvO0tQdO'#CwO1[QdO'#C}O1rQdO'#DQO2YQ!pO'#DSO4fQ!jO,5:|OOQO'#DX'#DXO-SQ`O'#DWO4vQ!nO'#FqO6|Q`O'#DYO7RQ`O'#DyOOQ['#Fq'#FqO7WQhO'#GOO7fQ`O,5;SO7kQ!bO,5;UOOQS'#En'#EnO7sQ`O,5;WO7xQdO,5;WOOQO'#Eq'#EqO8QQ`O,5;ZO8VQhO,5;aO'oQdO'#DjOOQS,5;c,5;cO0jQ`O,5;cO8_QdO,5;cOOQS'#F`'#F`O8gQdO'#E|O7fQ`O,5;fO8oQdO,5:yO9PQdO'#FZO9^Q`O,5lQhO'#DoOOQW,5:Y,5:YOOQW,5:d,5:dOOQW,5:S,5:SO>vQhO,5:VO?bQ!fO'#FrOOQS'#Fr'#FrOOQS'#FS'#FSO@rQdO,59cOOQ[,59c,59cOAYQdO,59iOOQ[,59i,59iOApQdO,59lOOQ[,59l,59lOOQ[,59n,59nO)YQdO,59pOBWQhO'#EdOOQW'#Ed'#EdOBuQ`O1G0hO4oQhO1G0hOOQ[,59r,59rO)}QhO'#D[OOQ[,59t,59tOBzQ#tO,5:eOCVQhO'#F]OCdQ`O,5vQhO'#DmOI_QhO'#DqOIgQhO'#DsOIlQhO'#FwOOQO'#Fw'#FwOItQ!bO'#DwOOQO'#Fy'#FyOOQO'#Fv'#FvOIyQ`O1G/qOOQS-E9Q-E9QOOQ[1G.}1G.}OOQ[1G/T1G/TOOQ[1G/W1G/WOOQ[1G/[1G/[OJOQdO,5;OOOQS7+&S7+&SOJTQ`O7+&SOJYQhO'#D]OJbQ`O,59vO)}QhO,59vOOQ[1G0P1G0POJjQ`O1G0POJoQhO,5;wOOQO-E9Z-E9ZOOQS7+&^7+&^OJ}QbO'#DSOOQO'#Et'#EtOK]Q`O'#EsOOQO'#Es'#EsOKhQ`O'#F^OKpQdO,5;^OOQS,5;^,5;^OOQ[1G/p1G/pOOQS7+&i7+&iO7fQ`O7+&iOK{Q!fO'#FYO)YQdO'#FYOMSQdO7+&POOQO7+&P7+&POOQO,5:{,5:{OOQO1G1a1G1aOMgQ!bO<vQhO'#DrOOQO,5:],5:]O! hQhO,5:_OGUQhO,5:cOOQW7+%]7+%]OOQO'#Ef'#EfO! pQ`O1G0jOOQS<xAN>xO!#zQ`OAN>xO!$PQaO,5;rOOQO-E9U-E9UO!$ZQdO,5;qOOQO-E9T-E9TOOQW<vQhO'#DuOOQO1G/y1G/yO!%vQ!bO1G/}OJOQdO'#F[O!&OQ`O7+&UOOQW7+&U7+&UO!&WQ!bO1G/cOOQ[7+$|7+$|O!&cQhO7+$|P!&jQ`O'#FTOOQO,5;y,5;yOOQO-E9]-E9]OOQS1G1d1G1dOOQPG24dG24dO!&oQ`OAN>ZO)YQdO1G1[O!&tQ`O7+'jOOQO1G/x1G/xO!&|Q`O,5:aO!$eQhO7+%iOOQO,5;v,5;vOOQO-E9Y-E9YOOQW<Q!]!^>|!^!_?_!_!`@Z!`!a@n!a!b%Z!b!cAo!c!k%Z!k!lC|!l!u%Z!u!vC|!v!}%Z!}#OD_#O#P%Z#P#QDp#Q#R2X#R#]%Z#]#^ER#^#g%Z#g#hC|#h#o%Z#o#pIf#p#qIw#q#rJ`#r#sJq#s#y%Z#y#z&R#z$f%Z$f$g&R$g#BY%Z#BY#BZ&R#BZ$IS%Z$IS$I_&R$I_$I|%Z$I|$JO&R$JO$JT%Z$JT$JU&R$JU$KV%Z$KV$KW&R$KW&FU%Z&FU&FV&R&FV;'S%Z;'S;=`KY<%lO%Z`%^SOy%jz;'S%j;'S;=`%{<%lO%j`%oS!o`Oy%jz;'S%j;'S;=`%{<%lO%j`&OP;=`<%l%j~&Wh$[~OX%jX^'r^p%jpq'rqy%jz#y%j#y#z'r#z$f%j$f$g'r$g#BY%j#BY#BZ'r#BZ$IS%j$IS$I_'r$I_$I|%j$I|$JO'r$JO$JT%j$JT$JU'r$JU$KV%j$KV$KW'r$KW&FU%j&FU&FV'r&FV;'S%j;'S;=`%{<%lO%j~'yh$[~!o`OX%jX^'r^p%jpq'rqy%jz#y%j#y#z'r#z$f%j$f$g'r$g#BY%j#BY#BZ'r#BZ$IS%j$IS$I_'r$I_$I|%j$I|$JO'r$JO$JT%j$JT$JU'r$JU$KV%j$KV$KW'r$KW&FU%j&FU&FV'r&FV;'S%j;'S;=`%{<%lO%jj)jS$qYOy%jz;'S%j;'S;=`%{<%lO%j~)yWOY)vZr)vrs*cs#O)v#O#P*h#P;'S)v;'S;=`+d<%lO)v~*hOw~~*kRO;'S)v;'S;=`*t;=`O)v~*wXOY)vZr)vrs*cs#O)v#O#P*h#P;'S)v;'S;=`+d;=`<%l)v<%lO)v~+gP;=`<%l)vj+oYmYOy%jz!Q%j!Q![,_![!c%j!c!i,_!i#T%j#T#Z,_#Z;'S%j;'S;=`%{<%lO%jj,dY!o`Oy%jz!Q%j!Q![-S![!c%j!c!i-S!i#T%j#T#Z-S#Z;'S%j;'S;=`%{<%lO%jj-XY!o`Oy%jz!Q%j!Q![-w![!c%j!c!i-w!i#T%j#T#Z-w#Z;'S%j;'S;=`%{<%lO%jj.OYuY!o`Oy%jz!Q%j!Q![.n![!c%j!c!i.n!i#T%j#T#Z.n#Z;'S%j;'S;=`%{<%lO%jj.uYuY!o`Oy%jz!Q%j!Q![/e![!c%j!c!i/e!i#T%j#T#Z/e#Z;'S%j;'S;=`%{<%lO%jj/jY!o`Oy%jz!Q%j!Q![0Y![!c%j!c!i0Y!i#T%j#T#Z0Y#Z;'S%j;'S;=`%{<%lO%jj0aYuY!o`Oy%jz!Q%j!Q![1P![!c%j!c!i1P!i#T%j#T#Z1P#Z;'S%j;'S;=`%{<%lO%jj1UY!o`Oy%jz!Q%j!Q![1t![!c%j!c!i1t!i#T%j#T#Z1t#Z;'S%j;'S;=`%{<%lO%jj1{SuY!o`Oy%jz;'S%j;'S;=`%{<%lO%jd2[UOy%jz!_%j!_!`2n!`;'S%j;'S;=`%{<%lO%jd2uS!yS!o`Oy%jz;'S%j;'S;=`%{<%lO%jb3WS^QOy%jz;'S%j;'S;=`%{<%lO%j~3gWOY3dZw3dwx*cx#O3d#O#P4P#P;'S3d;'S;=`4{<%lO3d~4SRO;'S3d;'S;=`4];=`O3d~4`XOY3dZw3dwx*cx#O3d#O#P4P#P;'S3d;'S;=`4{;=`<%l3d<%lO3d~5OP;=`<%l3dj5WShYOy%jz;'S%j;'S;=`%{<%lO%j~5iOg~n5pUWQyWOy%jz!_%j!_!`2n!`;'S%j;'S;=`%{<%lO%jj6ZWyW#PQOy%jz!O%j!O!P6s!P!Q%j!Q![9x![;'S%j;'S;=`%{<%lO%jj6xU!o`Oy%jz!Q%j!Q![7[![;'S%j;'S;=`%{<%lO%jj7cY!o`$gYOy%jz!Q%j!Q![7[![!g%j!g!h8R!h#X%j#X#Y8R#Y;'S%j;'S;=`%{<%lO%jj8WY!o`Oy%jz{%j{|8v|}%j}!O8v!O!Q%j!Q![9_![;'S%j;'S;=`%{<%lO%jj8{U!o`Oy%jz!Q%j!Q![9_![;'S%j;'S;=`%{<%lO%jj9fU!o`$gYOy%jz!Q%j!Q![9_![;'S%j;'S;=`%{<%lO%jj:P[!o`$gYOy%jz!O%j!O!P7[!P!Q%j!Q![9x![!g%j!g!h8R!h#X%j#X#Y8R#Y;'S%j;'S;=`%{<%lO%jj:zS!dYOy%jz;'S%j;'S;=`%{<%lO%jj;]WyWOy%jz!O%j!O!P6s!P!Q%j!Q![9x![;'S%j;'S;=`%{<%lO%jj;zU`YOy%jz!Q%j!Q![7[![;'S%j;'S;=`%{<%lO%j~VUcYOy%jz![%j![!]>i!];'S%j;'S;=`%{<%lO%jj>pSdY!o`Oy%jz;'S%j;'S;=`%{<%lO%jj?RSnYOy%jz;'S%j;'S;=`%{<%lO%jh?dU!WWOy%jz!_%j!_!`?v!`;'S%j;'S;=`%{<%lO%jh?}S!WW!o`Oy%jz;'S%j;'S;=`%{<%lO%jl@bS!WW!ySOy%jz;'S%j;'S;=`%{<%lO%jj@uV!|Q!WWOy%jz!_%j!_!`?v!`!aA[!a;'S%j;'S;=`%{<%lO%jbAcS!|Q!o`Oy%jz;'S%j;'S;=`%{<%lO%jjArYOy%jz}%j}!OBb!O!c%j!c!}CP!}#T%j#T#oCP#o;'S%j;'S;=`%{<%lO%jjBgW!o`Oy%jz!c%j!c!}CP!}#T%j#T#oCP#o;'S%j;'S;=`%{<%lO%jjCW[lY!o`Oy%jz}%j}!OCP!O!Q%j!Q![CP![!c%j!c!}CP!}#T%j#T#oCP#o;'S%j;'S;=`%{<%lO%jhDRS!zWOy%jz;'S%j;'S;=`%{<%lO%jjDdSpYOy%jz;'S%j;'S;=`%{<%lO%jnDuSo^Oy%jz;'S%j;'S;=`%{<%lO%jjEWU!zWOy%jz#a%j#a#bEj#b;'S%j;'S;=`%{<%lO%jbEoU!o`Oy%jz#d%j#d#eFR#e;'S%j;'S;=`%{<%lO%jbFWU!o`Oy%jz#c%j#c#dFj#d;'S%j;'S;=`%{<%lO%jbFoU!o`Oy%jz#f%j#f#gGR#g;'S%j;'S;=`%{<%lO%jbGWU!o`Oy%jz#h%j#h#iGj#i;'S%j;'S;=`%{<%lO%jbGoU!o`Oy%jz#T%j#T#UHR#U;'S%j;'S;=`%{<%lO%jbHWU!o`Oy%jz#b%j#b#cHj#c;'S%j;'S;=`%{<%lO%jbHoU!o`Oy%jz#h%j#h#iIR#i;'S%j;'S;=`%{<%lO%jbIYS$pQ!o`Oy%jz;'S%j;'S;=`%{<%lO%jjIkSsYOy%jz;'S%j;'S;=`%{<%lO%jfI|U$cUOy%jz!_%j!_!`2n!`;'S%j;'S;=`%{<%lO%jjJeSrYOy%jz;'S%j;'S;=`%{<%lO%jfJvU#PQOy%jz!_%j!_!`2n!`;'S%j;'S;=`%{<%lO%j`K]P;=`<%l%Z",tokenizers:[lOt,cOt,aOt,oOt,1,2,3,4,new AA("m~RRYZ[z{a~~g~aO$_~~dP!P!Qg~lO$`~~",28,152)],topRules:{StyleSheet:[0,6],Styles:[1,126]},dynamicPrecedences:{94:1},specialized:[{term:147,get:e=>dOt[e]||-1},{term:148,get:e=>fOt[e]||-1},{term:4,get:e=>hOt[e]||-1},{term:28,get:e=>pOt[e]||-1},{term:146,get:e=>mOt[e]||-1}],tokenPrec:2405});let uP=null;function dP(){if(!uP&&typeof document=="object"&&document.body){let{style:e}=document.body,t=[],n=new Set;for(let r in e)r!="cssText"&&r!="cssFloat"&&typeof e[r]=="string"&&(/[A-Z]/.test(r)&&(r=r.replace(/[A-Z]/g,i=>"-"+i.toLowerCase())),n.has(r)||(t.push(r),n.add(r)));uP=t.sort().map(r=>({type:"property",label:r,apply:r+": "}))}return uP||[]}const pK=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(e=>({type:"class",label:e})),mK=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(e=>({type:"keyword",label:e})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(e=>({type:"constant",label:e}))),bOt=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(e=>({type:"type",label:e})),yOt=["@charset","@color-profile","@container","@counter-style","@font-face","@font-feature-values","@font-palette-values","@import","@keyframes","@layer","@media","@namespace","@page","@position-try","@property","@scope","@starting-style","@supports","@view-transition"].map(e=>({type:"keyword",label:e})),Yd=/^(\w[\w-]*|-\w[\w-]*|)$/,OOt=/^-(-[\w-]*)?$/;function xOt(e,t){var n;if((e.name=="("||e.type.isError)&&(e=e.parent||e),e.name!="ArgList")return!1;let r=(n=e.parent)===null||n===void 0?void 0:n.firstChild;return(r==null?void 0:r.name)!="Callee"?!1:t.sliceString(r.from,r.to)=="var"}const gK=new aQ,vOt=["Declaration"];function wOt(e){for(let t=e;;){if(t.type.isTop)return t;if(!(t=t.parent))return e}}function kOe(e,t,n){if(t.to-t.from>4096){let r=gK.get(t);if(r)return r;let i=[],s=new Set,a=t.cursor(Qr.IncludeAnonymous);if(a.firstChild())do for(let l of kOe(e,a.node,n))s.has(l.label)||(s.add(l.label),i.push(l));while(a.nextSibling());return gK.set(t,i),i}else{let r=[],i=new Set;return t.cursor().iterate(s=>{var a;if(n(s)&&s.matchContext(vOt)&&((a=s.node.nextSibling)===null||a===void 0?void 0:a.name)==":"){let l=e.sliceString(s.from,s.to);i.has(l)||(i.add(l),r.push({label:l,type:"variable"}))}}),r}}const SOt=e=>t=>{let{state:n,pos:r}=t,i=mi(n).resolveInner(r,-1),s=i.type.isError&&i.from==i.to-1&&n.doc.sliceString(i.from,i.to)=="-";if(i.name=="PropertyName"||(s||i.name=="TagName")&&/^(Block|Styles)$/.test(i.resolve(i.to).name))return{from:i.from,options:dP(),validFor:Yd};if(i.name=="ValueName")return{from:i.from,options:mK,validFor:Yd};if(i.name=="PseudoClassName")return{from:i.from,options:pK,validFor:Yd};if(e(i)||(t.explicit||s)&&xOt(i,n.doc))return{from:e(i)||s?i.from:r,options:kOe(n.doc,wOt(i),e),validFor:OOt};if(i.name=="TagName"){for(let{parent:c}=i;c;c=c.parent)if(c.name=="Block")return{from:i.from,options:dP(),validFor:Yd};return{from:i.from,options:bOt,validFor:Yd}}if(i.name=="AtKeyword")return{from:i.from,options:yOt,validFor:Yd};if(!t.explicit)return null;let a=i.resolve(r),l=a.childBefore(r);return l&&l.name==":"&&a.name=="PseudoClassSelector"?{from:r,options:pK,validFor:Yd}:l&&l.name==":"&&a.name=="Declaration"||a.name=="ArgList"?{from:r,options:mK,validFor:Yd}:a.name=="Block"||a.name=="Styles"?{from:r,options:dP(),validFor:Yd}:null},EOt=SOt(e=>e.name=="VariableName"),PA=lh.define({name:"css",parser:gOt.configure({props:[wh.add({Declaration:Ay()}),Sh.add({"Block KeyframeList":BE})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function kOt(){return new rm(PA,PA.data.of({autocomplete:EOt}))}const Ox=["_blank","_self","_top","_parent"],fP=["ascii","utf-8","utf-16","latin1","latin1"],hP=["get","post","put","delete"],pP=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],hl=["true","false"],on={},_Ot={a:{attrs:{href:null,ping:null,type:null,media:null,target:Ox,hreflang:null}},abbr:on,address:on,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:on,aside:on,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:on,base:{attrs:{href:null,target:Ox}},bdi:on,bdo:on,blockquote:{attrs:{cite:null}},body:on,br:on,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:pP,formmethod:hP,formnovalidate:["novalidate"],formtarget:Ox,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:on,center:on,cite:on,code:on,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:on,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:on,div:on,dl:on,dt:on,em:on,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:on,figure:on,footer:on,form:{attrs:{action:null,name:null,"accept-charset":fP,autocomplete:["on","off"],enctype:pP,method:hP,novalidate:["novalidate"],target:Ox}},h1:on,h2:on,h3:on,h4:on,h5:on,h6:on,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:on,hgroup:on,hr:on,html:{attrs:{manifest:null}},i:on,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:pP,formmethod:hP,formnovalidate:["novalidate"],formtarget:Ox,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:on,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:on,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:on,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:fP,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:on,noscript:on,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:on,param:{attrs:{name:null,value:null}},pre:on,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:on,rt:on,ruby:on,samp:on,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:fP}},section:on,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:on,source:{attrs:{src:null,type:null,media:null}},span:on,strong:on,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:on,summary:on,sup:on,table:on,tbody:on,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:on,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:on,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:on,time:{attrs:{datetime:null}},title:on,tr:on,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:on,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:on},_Oe={accesskey:null,class:null,contenteditable:hl,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:hl,autocorrect:hl,autocapitalize:hl,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":hl,"aria-autocomplete":["inline","list","both","none"],"aria-busy":hl,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":hl,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":hl,"aria-hidden":hl,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":hl,"aria-multiselectable":hl,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":hl,"aria-relevant":null,"aria-required":hl,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},TOe="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(e=>"on"+e);for(let e of TOe)_Oe[e]=null;class yS{constructor(t,n){this.tags={..._Ot,...t},this.globalAttrs={..._Oe,...n},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}yS.default=new yS;function k1(e,t,n=e.length){if(!t)return"";let r=t.firstChild,i=r&&r.getChild("TagName");return i?e.sliceString(i.from,Math.min(i.to,n)):""}function _1(e,t=!1){for(;e;e=e.parent)if(e.name=="Element")if(t)t=!1;else return e;return null}function COe(e,t,n){let r=n.tags[k1(e,_1(t))];return(r==null?void 0:r.children)||n.allTags}function YQ(e,t){let n=[];for(let r=_1(t);r&&!r.type.isTop;r=_1(r.parent)){let i=k1(e,r);if(i&&r.lastChild.name=="CloseTag")break;i&&n.indexOf(i)<0&&(t.name=="EndTag"||t.from>=r.firstChild.to)&&n.push(i)}return n}const AOe=/^[:\-\.\w\u00b7-\uffff]*$/;function bK(e,t,n,r,i){let s=/\s*>/.test(e.sliceDoc(i,i+5))?"":">",a=_1(n,n.name=="StartTag"||n.name=="TagName");return{from:r,to:i,options:COe(e.doc,a,t).map(l=>({label:l,type:"type"})).concat(YQ(e.doc,n).map((l,c)=>({label:"/"+l,apply:"/"+l+s,type:"type",boost:99-c}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function yK(e,t,n,r){let i=/\s*>/.test(e.sliceDoc(r,r+5))?"":">";return{from:n,to:r,options:YQ(e.doc,t).map((s,a)=>({label:s,apply:s+i,type:"type",boost:99-a})),validFor:AOe}}function TOt(e,t,n,r){let i=[],s=0;for(let a of COe(e.doc,n,t))i.push({label:"<"+a,type:"type"});for(let a of YQ(e.doc,n))i.push({label:"",type:"type",boost:99-s++});return{from:r,to:r,options:i,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function COt(e,t,n,r,i){let s=_1(n),a=s?t.tags[k1(e.doc,s)]:null,l=a&&a.attrs?Object.keys(a.attrs):[],c=a&&a.globalAttrs===!1?l:l.length?l.concat(t.globalAttrNames):t.globalAttrNames;return{from:r,to:i,options:c.map(u=>({label:u,type:"property"})),validFor:AOe}}function AOt(e,t,n,r,i){var s;let a=(s=n.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),l=[],c;if(a){let u=e.sliceDoc(a.from,a.to),d=t.globalAttrs[u];if(!d){let f=_1(n),h=f?t.tags[k1(e.doc,f)]:null;d=(h==null?void 0:h.attrs)&&h.attrs[u]}if(d){let f=e.sliceDoc(r,i).toLowerCase(),h='"',m='"';/^['"]/.test(f)?(c=f[0]=='"'?/^[^"]*$/:/^[^']*$/,h="",m=e.sliceDoc(i,i+1)==f[0]?"":f[0],f=f.slice(1),r++):c=/^[^\s<>='"]*$/;for(let g of d)l.push({label:g,apply:h+g+m,type:"constant"})}}return{from:r,to:i,options:l,validFor:c}}function NOe(e,t){let{state:n,pos:r}=t,i=mi(n).resolveInner(r,-1),s=i.resolve(r);for(let a=r,l;s==i&&(l=i.childBefore(a));){let c=l.lastChild;if(!c||!c.type.isError||c.fromNOe(r,i)}const ROt=hd.parser.configure({top:"SingleExpression"}),jOe=[{tag:"script",attrs:e=>e.type=="text/typescript"||e.lang=="ts",parser:$1e.parser},{tag:"script",attrs:e=>e.type=="text/babel"||e.type=="text/jsx",parser:B1e.parser},{tag:"script",attrs:e=>e.type=="text/typescript-jsx",parser:Q1e.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:ROt},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:hd.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:PA.parser}],ROe=[{name:"style",parser:PA.parser.configure({top:"Styles"})}].concat(TOe.map(e=>({name:e,parser:hd.parser}))),IOe=lh.define({name:"html",parser:z1t.configure({props:[wh.add({Element(e){let t=/^(\s*)(<\/)?/.exec(e.textAfter);return e.node.to<=e.pos+t[0].length?e.continue():e.lineIndent(e.node.from)+(t[2]?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit},Document(e){if(e.pos+/\s*/.exec(e.textAfter)[0].lengthe.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),ST=IOe.configure({wrap:xOe(jOe,ROe)});function IOt(e={}){let t="",n;e.matchClosingTags===!1&&(t="noMatch"),e.selfClosingTags===!0&&(t=(t?t+" ":"")+"selfClosing"),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(n=xOe((e.nestedLanguages||[]).concat(jOe),(e.nestedAttributes||[]).concat(ROe)));let r=n?IOe.configure({wrap:n,dialect:t}):t?ST.configure({dialect:t}):ST;return new rm(r,[ST.data.of({autocomplete:jOt(e)}),e.autoCloseTags!==!1?DOt:[],O6().support,kOt().support])}const OK=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),DOt=Ct.inputHandler.of((e,t,n,r,i)=>{if(e.composing||e.state.readOnly||t!=n||r!=">"&&r!="/"||!ST.isActiveAt(e.state,t,-1))return!1;let s=i(),{state:a}=s,l=a.changeByRange(c=>{var u,d,f;let h=a.doc.sliceString(c.from-1,c.to)==r,{head:m}=c,g=mi(a).resolveInner(m,-1),b;if(h&&r==">"&&g.name=="EndTag"){let y=g.parent;if(((d=(u=y.parent)===null||u===void 0?void 0:u.lastChild)===null||d===void 0?void 0:d.name)!="CloseTag"&&(b=k1(a.doc,y.parent,m))&&!OK.has(b)){let O=m+(a.doc.sliceString(m,m+1)===">"?1:0),v=``;return{range:c,changes:{from:m,to:O,insert:v}}}}else if(h&&r=="/"&&g.name=="IncompleteCloseTag"){let y=g.parent;if(g.from==m-2&&((f=y.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(b=k1(a.doc,y,m))&&!OK.has(b)){let O=m+(a.doc.sliceString(m,m+1)===">"?1:0),v=`${b}>`;return{range:Je.cursor(m+v.length,-1),changes:{from:m,to:O,insert:v}}}}return{range:c}});return l.changes.empty?!1:(e.dispatch([s,a.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),DOe=iR({commentTokens:{block:{open:""}}}),POe=new Nn,MOe=Hyt.configure({props:[Sh.add(e=>!e.is("Block")||e.is("Document")||_6(e)!=null||POt(e)?void 0:(t,n)=>({from:n.doc.lineAt(t.from).to,to:t.to})),POe.add(_6),wh.add({Document:()=>null}),bp.add({Document:DOe})]});function _6(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function POt(e){return e.name=="OrderedList"||e.name=="BulletList"}function MOt(e,t){let n=e;for(;;){let r=n.nextSibling,i;if(!r||(i=_6(r.type))!=null&&i<=t)break;n=r}return n.to}const LOt=t1e.of((e,t,n)=>{for(let r=mi(e).resolveInner(n,-1);r&&!(r.fromn)return{from:n,to:s}}return null});function ZQ(e){return new Al(DOe,e,[],"markdown")}const $Ot=ZQ(MOe),BOt=MOe.configure([n1t,i1t,r1t,s1t,{props:[Sh.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]),MA=ZQ(BOt);function QOt(e,t){return n=>{if(n&&e){let r=null;if(n=/\S*/.exec(n)[0],typeof e=="function"?r=e(n):r=EA.matchLanguageName(e,n,!0),r instanceof EA)return r.support?r.support.language.parser:Zg.getSkippingParser(r.load());if(r)return r.parser}return t?t.parser:null}}let mP=class{constructor(t,n,r,i,s,a,l){this.node=t,this.from=n,this.to=r,this.spaceBefore=i,this.spaceAfter=s,this.type=a,this.item=l}blank(t,n=!0){let r=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(t!=null){for(;r.length0;i--)r+=" ";return r+(n?this.spaceAfter:"")}}marker(t,n){let r=this.node.name=="OrderedList"?String(+$Oe(this.item,t)[2]+n):"";return this.spaceBefore+r+this.type+this.spaceAfter}};function LOe(e,t){let n=[],r=[];for(let i=e;i;i=i.parent){if(i.name=="FencedCode")return r;(i.name=="ListItem"||i.name=="Blockquote")&&n.push(i)}for(let i=n.length-1;i>=0;i--){let s=n[i],a,l=t.lineAt(s.from),c=s.from-l.from;if(s.name=="Blockquote"&&(a=/^ *>( ?)/.exec(l.text.slice(c))))r.push(new mP(s,c,c+a[0].length,"",a[1],">",null));else if(s.name=="ListItem"&&s.parent.name=="OrderedList"&&(a=/^( *)\d+([.)])( *)/.exec(l.text.slice(c)))){let u=a[3],d=a[0].length;u.length>=4&&(u=u.slice(0,u.length-4),d-=4),r.push(new mP(s.parent,c,c+d,a[1],u,a[2],s))}else if(s.name=="ListItem"&&s.parent.name=="BulletList"&&(a=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(l.text.slice(c)))){let u=a[4],d=a[0].length;u.length>4&&(u=u.slice(0,u.length-4),d-=4);let f=a[2];a[3]&&(f+=a[3].replace(/[xX]/," ")),r.push(new mP(s.parent,c,c+d,a[1],u,f,s))}}return r}function $Oe(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function gP(e,t,n,r=0){for(let i=-1,s=e;;){if(s.name=="ListItem"){let l=$Oe(s,t),c=+l[2];if(i>=0){if(c!=i+1)return;n.push({from:s.from+l[1].length,to:s.from+l[0].length,insert:String(i+2+r)})}i=c}let a=s.nextSibling;if(!a)break;s=a}}function KQ(e,t){let n=/^[ \t]*/.exec(e)[0].length;if(!n||t.facet(OO)!=" ")return e;let r=vu(e,4,n),i="";for(let s=r;s>0;)s>=4?(i+=" ",s-=4):(i+=" ",s--);return i+e.slice(n)}const UOt=(e={})=>({state:t,dispatch:n})=>{let r=mi(t),{doc:i}=t,s=null,a=t.changeByRange(l=>{if(!l.empty||!MA.isActiveAt(t,l.from,-1)&&!MA.isActiveAt(t,l.from,1))return s={range:l};let c=l.from,u=i.lineAt(c),d=LOe(r.resolveInner(c,-1),i);for(;d.length&&d[d.length-1].from>c-u.from;)d.pop();if(!d.length)return s={range:l};let f=d[d.length-1];if(f.to-f.spaceAfter.length>c-u.from)return s={range:l};let h=c>=f.to-f.spaceAfter.length&&!/\S/.test(u.text.slice(f.to));if(f.item&&h){let O=f.node.firstChild,v=f.node.getChild("ListItem","ListItem");if(O.to>=c||v&&v.to0&&!/[^\s>]/.test(i.lineAt(u.from-1).text)||e.nonTightLists===!1){let x=d.length>1?d[d.length-2]:null,w,S="";x&&x.item?(w=u.from+x.from,S=x.marker(i,1)):w=u.from+(x?x.to:0);let E=[{from:w,to:c,insert:S}];return f.node.name=="OrderedList"&&gP(f.item,i,E,-2),x&&x.node.name=="OrderedList"&&gP(x.item,i,E),{range:Je.cursor(w+S.length),changes:E}}else{let x=vK(d,t,u);return{range:Je.cursor(c+x.length+1),changes:{from:u.from,insert:x+t.lineBreak}}}}if(f.node.name=="Blockquote"&&h&&u.from){let O=i.lineAt(u.from-1),v=/>\s*$/.exec(O.text);if(v&&v.index==f.from){let x=t.changes([{from:O.from+v.index,to:O.to},{from:u.from+f.from,to:u.to}]);return{range:l.map(x),changes:x}}}let m=[];f.node.name=="OrderedList"&&gP(f.item,i,m);let g=f.item&&f.item.from]*/.exec(u.text)[0].length>=f.to)for(let O=0,v=d.length-1;O<=v;O++)b+=O==v&&!g?d[O].marker(i,1):d[O].blank(Ou.from&&/\s/.test(u.text.charAt(y-u.from-1));)y--;return b=KQ(b,t),zOt(f.node,t.doc)&&(b=vK(d,t,u)+t.lineBreak+b),m.push({from:y,to:c,insert:t.lineBreak+b}),{range:Je.cursor(y+b.length+1),changes:m}});return s?!1:(n(t.update(a,{scrollIntoView:!0,userEvent:"input"})),!0)},FOt=UOt();function xK(e){return e.name=="QuoteMark"||e.name=="ListMark"}function zOt(e,t){if(e.name!="OrderedList"&&e.name!="BulletList")return!1;let n=e.firstChild,r=e.getChild("ListItem","ListItem");if(!r)return!1;let i=t.lineAt(n.to),s=t.lineAt(r.from),a=/^[\s>]*$/.test(i.text);return i.number+(a?0:1){let n=mi(e),r=null,i=e.changeByRange(s=>{let a=s.from,{doc:l}=e;if(s.empty&&MA.isActiveAt(e,s.from)){let c=l.lineAt(a),u=LOe(VOt(n,a),l);if(u.length){let d=u[u.length-1],f=d.to-d.spaceAfter.length+(d.spaceAfter?1:0);if(a-c.from>f&&!/\S/.test(c.text.slice(f,a-c.from)))return{range:Je.cursor(c.from+f),changes:{from:c.from+f,to:a}};if(a-c.from==f&&(d.item&&c.from<=d.item.from||/^[\s>]*$/.test(c.text.slice(0,d.to)))){let h=c.from+d.from;if(d.item&&d.node.from{var n;let{main:r}=t.state.selection;if(r.empty)return!1;let i=(n=e.clipboardData)===null||n===void 0?void 0:n.getData("text/plain");if(!i||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(i)||(/^www\./.test(i)&&(i="https://"+i),!MA.isActiveAt(t.state,r.from,1)))return!1;let s=mi(t.state),a=!1;return s.iterate({from:r.from,to:r.to,enter:l=>{(l.from>r.from||YOt.test(l.name))&&(a=!0)},leave:l=>{l.to=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}const Zxt=new js((e,t)=>{let n;if(e.next<0)e.acceptToken(txt);else if(t.context.flags&ET)yP(e.next)&&e.acceptToken(ext,1);else if(((n=e.peek(-1))<0||yP(n))&&t.canShift(wK)){let r=0;for(;e.next==JQ||e.next==uR;)e.advance(),r++;(e.next==e0||e.next==OS||e.next==eU)&&e.acceptToken(wK,-r)}else yP(e.next)&&e.acceptToken(JOt,1)},{contextual:!0}),Kxt=new js((e,t)=>{let n=t.context;if(n.flags)return;let r=e.peek(-1);if(r==e0||r==OS){let i=0,s=0;for(;;){if(e.next==JQ)i++;else if(e.next==uR)i+=8-i%8;else break;e.advance(),s++}i!=n.indent&&e.next!=e0&&e.next!=OS&&e.next!=eU&&(i[e,t|qOe])),tvt=new oR({start:Jxt,reduce(e,t,n,r){return e.flags&ET&&Yxt.has(t)||(t==yxt||t==zOe)&&e.flags&qOe?e.parent:e},shift(e,t,n,r){return t==QOe?new kT(e,evt(r.read(r.pos,n.pos)),0):t==UOe?e.parent:t==ixt||t==lxt||t==dxt||t==FOe?new kT(e,0,ET):_K.has(t)?new kT(e,0,_K.get(t)|e.flags&ET):e},hash(e){return e.hash}}),nvt=new js(e=>{for(let t=0;t<5;t++){if(e.next!="print".charCodeAt(t))return;e.advance()}if(!/\w/.test(String.fromCharCode(e.next)))for(let t=0;;t++){let n=e.peek(t);if(!(n==JQ||n==uR)){n!=zxt&&n!=Vxt&&n!=e0&&n!=OS&&n!=eU&&e.acceptToken(KOt);return}}}),rvt=new js((e,t)=>{let{flags:n}=t.context,r=n&rf?HOe:VOe,i=(n&sf)>0,s=!(n&af),a=(n&of)>0,l=e.pos;for(;!(e.next<0);)if(a&&e.next==T6)if(e.peek(1)==T6)e.advance(2);else{if(e.pos==l){e.acceptToken(FOe,1);return}break}else if(s&&e.next==kK){if(e.pos==l){e.advance();let c=e.next;c>=0&&(e.advance(),ivt(e,c)),e.acceptToken(rxt);return}break}else if(e.next==kK&&!s&&e.peek(1)>-1)e.advance(2);else if(e.next==r&&(!i||e.peek(1)==r&&e.peek(2)==r)){if(e.pos==l){e.acceptToken(SK,i?3:1);return}break}else if(e.next==e0){if(i)e.advance();else if(e.pos==l){e.acceptToken(SK);return}break}else e.advance();e.pos>l&&e.acceptToken(nxt)});function ivt(e,t){if(t==Hxt)for(let n=0;n<2&&e.next>=48&&e.next<=55;n++)e.advance();else if(t==qxt)for(let n=0;n<2&&OP(e.next);n++)e.advance();else if(t==Gxt)for(let n=0;n<4&&OP(e.next);n++)e.advance();else if(t==Wxt)for(let n=0;n<8&&OP(e.next);n++)e.advance();else if(t==Xxt&&e.next==T6){for(e.advance();e.next>=0&&e.next!=EK&&e.next!=VOe&&e.next!=HOe&&e.next!=e0;)e.advance();e.next==EK&&e.advance()}}const svt=vh({'async "*" "**" FormatConversion FormatSpec':Y.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":Y.controlKeyword,"in not and or is del":Y.operatorKeyword,"from def class global nonlocal lambda":Y.definitionKeyword,import:Y.moduleKeyword,"with as print":Y.keyword,Boolean:Y.bool,None:Y.null,VariableName:Y.variableName,"CallExpression/VariableName":Y.function(Y.variableName),"FunctionDefinition/VariableName":Y.function(Y.definition(Y.variableName)),"ClassDefinition/VariableName":Y.definition(Y.className),PropertyName:Y.propertyName,"CallExpression/MemberExpression/PropertyName":Y.function(Y.propertyName),Comment:Y.lineComment,Number:Y.number,String:Y.string,FormatString:Y.special(Y.string),Escape:Y.escape,UpdateOp:Y.updateOperator,"ArithOp!":Y.arithmeticOperator,BitOp:Y.bitwiseOperator,CompareOp:Y.compareOperator,AssignOp:Y.definitionOperator,Ellipsis:Y.punctuation,At:Y.meta,"( )":Y.paren,"[ ]":Y.squareBracket,"{ }":Y.brace,".":Y.derefOperator,", ;":Y.separator}),avt={__proto__:null,await:44,or:54,and:56,in:60,not:62,is:64,if:70,else:72,lambda:76,yield:94,from:96,async:102,for:104,None:162,True:164,False:164,del:178,pass:182,break:186,continue:190,return:194,raise:202,import:206,as:208,global:212,nonlocal:214,assert:218,type:223,elif:236,while:240,try:246,except:248,finally:250,with:254,def:258,class:268,match:279,case:285},ovt=ch.deserialize({version:14,states:"##jQ`QeOOP$}OSOOO&WQtO'#HUOOQS'#Co'#CoOOQS'#Cp'#CpO'vQdO'#CnO*UQtO'#HTOOQS'#HU'#HUOOQS'#DU'#DUOOQS'#HT'#HTO*rQdO'#D_O+VQdO'#DfO+gQdO'#DjO+zOWO'#DuO,VOWO'#DvO.[QtO'#GuOOQS'#Gu'#GuO'vQdO'#GtO0ZQtO'#GtOOQS'#Eb'#EbO0rQdO'#EcOOQS'#Gs'#GsO0|QdO'#GrOOQV'#Gr'#GrO1XQdO'#FYOOQS'#G^'#G^O1^QdO'#FXOOQV'#IS'#ISOOQV'#Gq'#GqOOQV'#Fq'#FqQ`QeOOO'vQdO'#CqO1lQdO'#C}O1sQdO'#DRO2RQdO'#HYO2cQtO'#EVO'vQdO'#EWOOQS'#EY'#EYOOQS'#E['#E[OOQS'#E^'#E^O2wQdO'#E`O3_QdO'#EdO3rQdO'#EfO3zQtO'#EfO1XQdO'#EiO0rQdO'#ElO1XQdO'#EnO0rQdO'#EtO0rQdO'#EwO4VQdO'#EyO4^QdO'#FOO4iQdO'#EzO0rQdO'#FOO1XQdO'#FQO1XQdO'#FVO4nQdO'#F[P4uOdO'#GpPOOO)CBd)CBdOOQS'#Ce'#CeOOQS'#Cf'#CfOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Cl'#ClO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO5TQdO'#DoOOQS,5:Y,5:YO5hQdO'#HdOOQS,5:],5:]O5uQ!fO,5:]O5zQtO,59YO1lQdO,59bO1lQdO,59bO1lQdO,59bO8jQdO,59bO8oQdO,59bO8vQdO,59jO8}QdO'#HTO:TQdO'#HSOOQS'#HS'#HSOOQS'#D['#D[O:lQdO,59aO'vQdO,59aO:zQdO,59aOOQS,59y,59yO;PQdO,5:RO'vQdO,5:ROOQS,5:Q,5:QO;_QdO,5:QO;dQdO,5:XO'vQdO,5:XO'vQdO,5:VOOQS,5:U,5:UO;uQdO,5:UO;zQdO,5:WOOOW'#Fy'#FyOOOOQS'#Ds'#DsOOQS1G/w1G/wOOQS1G.|1G.|O!/[QtO1G.|O!/cQtO1G.|O1lQdO1G.|O!0OQdO1G/UOOQS'#DZ'#DZO0rQdO,59tOOQS1G.{1G.{O!0VQdO1G/eO!0gQdO1G/eO!0oQdO1G/fO'vQdO'#H[O!0tQdO'#H[O!0yQtO1G.{O!1ZQdO,59iO!2aQdO,5=zO!2qQdO,5=zO!2yQdO1G/mO!3OQtO1G/mOOQS1G/l1G/lO!3`QdO,5=uO!4VQdO,5=uO0rQdO1G/qO!4tQdO1G/sO!4yQtO1G/sO!5ZQtO1G/qOOQS1G/p1G/pOOQS1G/r1G/rOOOW-E9w-E9wOOQS1G/{1G/{O!5kQdO'#HxO0rQdO'#HxO!5|QdO,5>cOOOW-E9x-E9xOOQS1G/|1G/|OOQS-E9{-E9{O!6[Q#xO1G2zO!6{QtO1G2zO'vQdO,5kOOQS1G1`1G1`O!8RQdO1G1`OOQS'#DV'#DVO0rQdO,5=qOOQS,5=q,5=qO!8WQdO'#FrO!8cQdO,59oO!8kQdO1G/XO!8uQtO,5=uOOQS1G3`1G3`OOQS,5:m,5:mO!9fQdO'#GtOOQS,5jO!;ZQdO,5>jO1XQdO,5>jO!;lQdO,5>iOOQS-E:R-E:RO!;qQdO1G0lO!;|QdO1G0lO!lO!lO!hO!=VQdO,5>hO!=hQdO'#EpO0rQdO1G0tO!=sQdO1G0tO!=xQgO1G0zO!AvQgO1G0}O!EqQdO,5>oO!E{QdO,5>oO!FTQtO,5>oO0rQdO1G1PO!F_QdO1G1PO4iQdO1G1UO!!vQdO1G1WOOQV,5;a,5;aO!FdQfO,5;aO!FiQgO1G1QO!JjQdO'#GZO4iQdO1G1QO4iQdO1G1QO!JzQdO,5>pO!KXQdO,5>pO1XQdO,5>pOOQV1G1U1G1UO!KaQdO'#FSO!KrQ!fO1G1WO!KzQdO1G1WOOQV1G1]1G1]O4iQdO1G1]O!LPQdO1G1]O!LXQdO'#F^OOQV1G1b1G1bO!#ZQtO1G1bPOOO1G2v1G2vP!L^OSO1G2vOOQS,5=},5=}OOQS'#Dp'#DpO0rQdO,5=}O!LfQdO,5=|O!LyQdO,5=|OOQS1G/u1G/uO!MRQdO,5>PO!McQdO,5>PO!MkQdO,5>PO!NOQdO,5>PO!N`QdO,5>POOQS1G3j1G3jOOQS7+$h7+$hO!8kQdO7+$pO#!RQdO1G.|O#!YQdO1G.|OOQS1G/`1G/`OOQS,5<`,5<`O'vQdO,5<`OOQS7+%P7+%PO#!aQdO7+%POOQS-E9r-E9rOOQS7+%Q7+%QO#!qQdO,5=vO'vQdO,5=vOOQS7+$g7+$gO#!vQdO7+%PO##OQdO7+%QO##TQdO1G3fOOQS7+%X7+%XO##eQdO1G3fO##mQdO7+%XOOQS,5<_,5<_O'vQdO,5<_O##rQdO1G3aOOQS-E9q-E9qO#$iQdO7+%]OOQS7+%_7+%_O#$wQdO1G3aO#%fQdO7+%_O#%kQdO1G3gO#%{QdO1G3gO#&TQdO7+%]O#&YQdO,5>dO#&sQdO,5>dO#&sQdO,5>dOOQS'#Dx'#DxO#'UO&jO'#DzO#'aO`O'#HyOOOW1G3}1G3}O#'fQdO1G3}O#'nQdO1G3}O#'yQ#xO7+(fO#(jQtO1G2UP#)TQdO'#GOOOQS,5nQdO,5sQdO1G4OOOQS-E9y-E9yO#?^QdO1G4OO<[QdO'#H{OOOO'#D{'#D{OOOO'#F|'#F|O#?oO&jO,5:fOOOW,5>e,5>eOOOW7+)i7+)iO#?zQdO7+)iO#@SQdO1G2zO#@mQdO1G2zP'vQdO'#FuO0rQdO<mO#BQQdO,5>mOOQS1G0v1G0vOOQS<rO#KgQdO,5>rO#KrQdO,5>rO#K}QdO,5>qO#L`QdO,5>qOOQS1G1Y1G1YOOQS,5;p,5;pOOQV<VAN>VO$ oQdO<cAN>cO0rQdO1G1|O$!PQtO1G1|P$!ZQdO'#FvOOQS1G2R1G2RP$!hQdO'#F{O$!uQdO7+)jO$#`QdO,5>gOOOO-E9z-E9zOOOW<tO$4{QdO,5>tO1XQdO,5vO$)nQdO,5>vOOQS1G1p1G1pOOQS,5<[,5<[OOQU7+'P7+'PO$+zQdO1G/iO$)nQdO,5wO$8zQdO,5>wOOQS1G1s1G1sOOQS7+'S7+'SP$)nQdO'#GdO$9SQdO1G4bO$9^QdO1G4bO$9fQdO1G4bOOQS7+%T7+%TO$9tQdO1G1tO$:SQtO'#FaO$:ZQdO,5<}OOQS,5<},5<}O$:iQdO1G4cOOQS-E:a-E:aO$)nQdO,5<|O$:pQdO,5<|O$:uQdO7+)|OOQS-E:`-E:`O$;PQdO7+)|O$)nQdO,5S~O%cOS%^OSSOS%]PQ~OPdOVaOfoOhYOopOs!POvqO!PrO!Q{O!T!SO!U!RO!XZO!][O!h`O!r`O!s`O!t`O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#l!QO#o!TO#s!UO#u!VO#z!WO#}hO$P!XO%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~O%]!YO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%j![O%k!]O%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aO~Ok%xXl%xXm%xXn%xXo%xXp%xXs%xXz%xX{%xX!x%xX#g%xX%[%xX%_%xX%z%xXg%xX!T%xX!U%xX%{%xX!W%xX![%xX!Q%xX#[%xXt%xX!m%xX~P%SOfoOhYO!XZO!][O!h`O!r`O!s`O!t`O%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~Oz%wX{%wX#g%wX%[%wX%_%wX%z%wX~Ok!pOl!qOm!oOn!oOo!rOp!sOs!tO!x%wX~P)pOV!zOg!|Oo0cOv0qO!PrO~P'vOV#OOo0cOv0qO!W#PO~P'vOV#SOa#TOo0cOv0qO![#UO~P'vOQ#XO%`#XO%a#ZO~OQ#^OR#[O%`#^O%a#`O~OV%iX_%iXa%iXh%iXk%iXl%iXm%iXn%iXo%iXp%iXs%iXz%iX!X%iX!f%iX%j%iX%k%iX%l%iX%m%iX%n%iX%o%iX%p%iX%q%iX%r%iX%s%iXg%iX!T%iX!U%iX~O&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O{%iX!x%iX#g%iX%[%iX%_%iX%z%iX%{%iX!W%iX![%iX!Q%iX#[%iXt%iX!m%iX~P,eOz#dO{%hX!x%hX#g%hX%[%hX%_%hX%z%hX~Oo0cOv0qO~P'vO#g#gO%[#iO%_#iO~O%uWO~O!T#nO#u!VO#z!WO#}hO~OopO~P'vOV#sOa#tO%uWO{wP~OV#xOo0cOv0qO!Q#yO~P'vO{#{O!x$QO%z#|O#g!yX%[!yX%_!yX~OV#xOo0cOv0qO#g#SX%[#SX%_#SX~P'vOo0cOv0qO#g#WX%[#WX%_#WX~P'vOh$WO%uWO~O!f$YO!r$YO%uWO~OV$eO~P'vO!U$gO#s$hO#u$iO~O{$jO~OV$qO~P'vOS$sO%[$rO%_$rO%c$tO~OV$}Oa$}Og%POo0cOv0qO~P'vOo0cOv0qO{%SO~P'vO&Y%UO~Oa!bOh!iO!X!kO!f!mOVba_bakbalbambanbaobapbasbazba{ba!xba#gba%[ba%_ba%jba%kba%lba%mba%nba%oba%pba%qba%rba%sba%zbagba!Tba!Uba%{ba!Wba![ba!Qba#[batba!mba~On%ZO~Oo%ZO~P'vOo0cO~P'vOk0eOl0fOm0dOn0dOo0mOp0nOs0rOg%wX!T%wX!U%wX%{%wX!W%wX![%wX!Q%wX#[%wX!m%wX~P)pO%{%]Og%vXz%vX!T%vX!U%vX!W%vX{%vX~Og%_Oz%`O!T%dO!U%cO~Og%_O~Oz%gO!T%dO!U%cO!W&SX~O!W%kO~Oz%lO{%nO!T%dO!U%cO![%}X~O![%rO~O![%sO~OQ#XO%`#XO%a%uO~OV%wOo0cOv0qO!PrO~P'vOQ#^OR#[O%`#^O%a%zO~OV!qa_!qaa!qah!qak!qal!qam!qan!qao!qap!qas!qaz!qa{!qa!X!qa!f!qa!x!qa#g!qa%[!qa%_!qa%j!qa%k!qa%l!qa%m!qa%n!qa%o!qa%p!qa%q!qa%r!qa%s!qa%z!qag!qa!T!qa!U!qa%{!qa!W!qa![!qa!Q!qa#[!qat!qa!m!qa~P#yOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P%SOV&OOopOvqO{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P'vOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#g$zX%[$zX%_$zX~P'vO#g#gO%[&TO%_&TO~O!f&UOh&sX%[&sXz&sX#[&sX#g&sX%_&sX#Z&sXg&sX~Oh!iO%[&WO~Okealeameaneaoeapeaseazea{ea!xea#gea%[ea%_ea%zeagea!Tea!Uea%{ea!Wea![ea!Qea#[eatea!mea~P%SOsqazqa{qa#gqa%[qa%_qa%zqa~Ok!pOl!qOm!oOn!oOo!rOp!sO!xqa~PEcO%z&YOz%yX{%yX~O%uWOz%yX{%yX~Oz&]O{wX~O{&_O~Oz%lO#g%}X%[%}X%_%}Xg%}X{%}X![%}X!m%}X%z%}X~OV0lOo0cOv0qO!PrO~P'vO%z#|O#gUa%[Ua%_Ua~Oz&hO#g&PX%[&PX%_&PXn&PX~P%SOz&kO!Q&jO#g#Wa%[#Wa%_#Wa~Oz&lO#[&nO#g&rX%[&rX%_&rXg&rX~O!f$YO!r$YO#Z&qO%uWO~O#Z&qO~Oz&sO#g&tX%[&tX%_&tX~Oz&uO#g&pX%[&pX%_&pX{&pX~O!X&wO%z&xO~Oz&|On&wX~P%SOn'PO~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO%['UO~P'vOt'YO#p'WO#q'XOP#naV#naf#nah#nao#nas#nav#na!P#na!Q#na!T#na!U#na!X#na!]#na!h#na!r#na!s#na!t#na!{#na!}#na#P#na#R#na#T#na#X#na#Z#na#^#na#_#na#a#na#c#na#l#na#o#na#s#na#u#na#z#na#}#na$P#na%X#na%o#na%p#na%t#na%u#na&Z#na&[#na&]#na&^#na&_#na&`#na&a#na&b#na&c#na&d#na&e#na&f#na&g#na&h#na&i#na&j#na%Z#na%_#na~Oz'ZO#[']O{&xX~Oh'_O!X&wO~Oh!iO{$jO!X&wO~O{'eO~P%SO%['hO%_'hO~OS'iO%['hO%_'hO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%k!]O~P!#uO%kWi~P!#uOV!aO_!aOa!bOh!iO!X!kO!f!mO%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%m!_O%n!_O~P!&pO%mWi%nWi~P!&pOa!bOh!iO!X!kO!f!mOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%mWi%nWi%oWi%pWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~OV!aO_!aO%q!aO%r!aO%s!aO~P!)nOVWi_Wi%qWi%rWi%sWi~P!)nO!T%dO!U%cOg&VXz&VX~O%z'kO%{'kO~P,eOz'mOg&UX~Og'oO~Oz'pO{'rO!W&XX~Oo0cOv0qOz'pO{'sO!W&XX~P'vO!W'uO~Om!oOn!oOo!rOp!sOkjisjizji{ji!xji#gji%[ji%_ji%zji~Ol!qO~P!.aOlji~P!.aOk0eOl0fOm0dOn0dOo0mOp0nO~Ot'wO~P!/jOV'|Og'}Oo0cOv0qO~P'vOg'}Oz(OO~Og(QO~O!U(SO~Og(TOz(OO!T%dO!U%cO~P%SOk0eOl0fOm0dOn0dOo0mOp0nOgqa!Tqa!Uqa%{qa!Wqa![qa!Qqa#[qatqa!mqa~PEcOV'|Oo0cOv0qO!W&Sa~P'vOz(WO!W&Sa~O!W(XO~Oz(WO!T%dO!U%cO!W&Sa~P%SOV(]Oo0cOv0qO![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~P'vOz(^O![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~O![(aO~Oz(^O!T%dO!U%cO![%}a~P%SOz(dO!T%dO!U%cO![&Ta~P%SOz(gO{&lX![&lX!m&lX%z&lX~O{(kO![(mO!m(nO%z(jO~OV&OOopOvqO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~P'vOz(pO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~O!f&UOh&sa%[&saz&sa#[&sa#g&sa%_&sa#Z&sag&sa~O%[(uO~OV#sOa#tO%uWO~Oz&]O{wa~OopOvqO~P'vOz(^O#g%}a%[%}a%_%}ag%}a{%}a![%}a!m%}a%z%}a~P%SOz(zO#g%hX%[%hX%_%hX%z%hX~O%z#|O#gUi%[Ui%_Ui~O#g&Pa%[&Pa%_&Pan&Pa~P'vOz(}O#g&Pa%[&Pa%_&Pan&Pa~O%uWO#g&ra%[&ra%_&rag&ra~Oz)SO#g&ra%[&ra%_&rag&ra~Og)VO~OV)WOh$WO%uWO~O#Z)XO~O%uWO#g&ta%[&ta%_&ta~Oz)ZO#g&ta%[&ta%_&ta~Oo0cOv0qO#g&pa%[&pa%_&pa{&pa~P'vOz)^O#g&pa%[&pa%_&pa{&pa~OV)`Oa)`O%uWO~O%z)eO~Ot)hO#j)gOP#hiV#hif#hih#hio#his#hiv#hi!P#hi!Q#hi!T#hi!U#hi!X#hi!]#hi!h#hi!r#hi!s#hi!t#hi!{#hi!}#hi#P#hi#R#hi#T#hi#X#hi#Z#hi#^#hi#_#hi#a#hi#c#hi#l#hi#o#hi#s#hi#u#hi#z#hi#}#hi$P#hi%X#hi%o#hi%p#hi%t#hi%u#hi&Z#hi&[#hi&]#hi&^#hi&_#hi&`#hi&a#hi&b#hi&c#hi&d#hi&e#hi&f#hi&g#hi&h#hi&i#hi&j#hi%Z#hi%_#hi~Ot)iOP#kiV#kif#kih#kio#kis#kiv#ki!P#ki!Q#ki!T#ki!U#ki!X#ki!]#ki!h#ki!r#ki!s#ki!t#ki!{#ki!}#ki#P#ki#R#ki#T#ki#X#ki#Z#ki#^#ki#_#ki#a#ki#c#ki#l#ki#o#ki#s#ki#u#ki#z#ki#}#ki$P#ki%X#ki%o#ki%p#ki%t#ki%u#ki&Z#ki&[#ki&]#ki&^#ki&_#ki&`#ki&a#ki&b#ki&c#ki&d#ki&e#ki&f#ki&g#ki&h#ki&i#ki&j#ki%Z#ki%_#ki~OV)kOn&wa~P'vOz)lOn&wa~Oz)lOn&wa~P%SOn)pO~O%Y)tO~Ot)wO#p'WO#q)vOP#niV#nif#nih#nio#nis#niv#ni!P#ni!Q#ni!T#ni!U#ni!X#ni!]#ni!h#ni!r#ni!s#ni!t#ni!{#ni!}#ni#P#ni#R#ni#T#ni#X#ni#Z#ni#^#ni#_#ni#a#ni#c#ni#l#ni#o#ni#s#ni#u#ni#z#ni#}#ni$P#ni%X#ni%o#ni%p#ni%t#ni%u#ni&Z#ni&[#ni&]#ni&^#ni&_#ni&`#ni&a#ni&b#ni&c#ni&d#ni&e#ni&f#ni&g#ni&h#ni&i#ni&j#ni%Z#ni%_#ni~OV)zOo0cOv0qO{$jO~P'vOo0cOv0qO{&xa~P'vOz*OO{&xa~OV*SOa*TOg*WO%q*UO%uWO~O{$jO&{*YO~Oh'_O~Oh!iO{$jO~O%[*_O~O%[*aO%_*aO~OV$}Oa$}Oo0cOv0qOg&Ua~P'vOz*dOg&Ua~Oo0cOv0qO{*gO!W&Xa~P'vOz*hO!W&Xa~Oo0cOv0qOz*hO{*kO!W&Xa~P'vOo0cOv0qOz*hO!W&Xa~P'vOz*hO{*kO!W&Xa~Om0dOn0dOo0mOp0nOgjikjisjizji!Tji!Uji%{ji!Wji{ji![ji#gji%[ji%_ji!Qji#[jitji!mji%zji~Ol0fO~P!NkOlji~P!NkOV'|Og*pOo0cOv0qO~P'vOn*rO~Og*pOz*tO~Og*uO~OV'|Oo0cOv0qO!W&Si~P'vOz*vO!W&Si~O!W*wO~OV(]Oo0cOv0qO![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~P'vOz*zO!T%dO!U%cO![&Ti~Oz*}O![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~O![+OO~Oa+QOo0cOv0qO![&Ti~P'vOz*zO![&Ti~O![+SO~OV+UOo0cOv0qO{&la![&la!m&la%z&la~P'vOz+VO{&la![&la!m&la%z&la~O!]+YO&n+[O![!nX~O![+^O~O{(kO![+_O~O{(kO![+_O!m+`O~OV&OOopOvqO{%hq!x%hq#g%hq%[%hq%_%hq%z%hq~P'vOz$ri{$ri!x$ri#g$ri%[$ri%_$ri%z$ri~P%SOV&OOopOvqO~P'vOV&OOo0cOv0qO#g%ha%[%ha%_%ha%z%ha~P'vOz+aO#g%ha%[%ha%_%ha%z%ha~Oz$ia#g$ia%[$ia%_$ian$ia~P%SO#g&Pi%[&Pi%_&Pin&Pi~P'vOz+dO#g#Wq%[#Wq%_#Wq~O#[+eOz$va#g$va%[$va%_$vag$va~O%uWO#g&ri%[&ri%_&rig&ri~Oz+gO#g&ri%[&ri%_&rig&ri~OV+iOh$WO%uWO~O%uWO#g&ti%[&ti%_&ti~Oo0cOv0qO#g&pi%[&pi%_&pi{&pi~P'vO{#{Oz#eX!W#eX~Oz+mO!W&uX~O!W+oO~Ot+rO#j)gOP#hqV#hqf#hqh#hqo#hqs#hqv#hq!P#hq!Q#hq!T#hq!U#hq!X#hq!]#hq!h#hq!r#hq!s#hq!t#hq!{#hq!}#hq#P#hq#R#hq#T#hq#X#hq#Z#hq#^#hq#_#hq#a#hq#c#hq#l#hq#o#hq#s#hq#u#hq#z#hq#}#hq$P#hq%X#hq%o#hq%p#hq%t#hq%u#hq&Z#hq&[#hq&]#hq&^#hq&_#hq&`#hq&a#hq&b#hq&c#hq&d#hq&e#hq&f#hq&g#hq&h#hq&i#hq&j#hq%Z#hq%_#hq~On$|az$|a~P%SOV)kOn&wi~P'vOz+yOn&wi~Oz,TO{$jO#[,TO~O#q,VOP#nqV#nqf#nqh#nqo#nqs#nqv#nq!P#nq!Q#nq!T#nq!U#nq!X#nq!]#nq!h#nq!r#nq!s#nq!t#nq!{#nq!}#nq#P#nq#R#nq#T#nq#X#nq#Z#nq#^#nq#_#nq#a#nq#c#nq#l#nq#o#nq#s#nq#u#nq#z#nq#}#nq$P#nq%X#nq%o#nq%p#nq%t#nq%u#nq&Z#nq&[#nq&]#nq&^#nq&_#nq&`#nq&a#nq&b#nq&c#nq&d#nq&e#nq&f#nq&g#nq&h#nq&i#nq&j#nq%Z#nq%_#nq~O#[,WOz%Oa{%Oa~Oo0cOv0qO{&xi~P'vOz,YO{&xi~O{#{O%z,[Og&zXz&zX~O%uWOg&zXz&zX~Oz,`Og&yX~Og,bO~O%Y,eO~O!T%dO!U%cOg&Viz&Vi~OV$}Oa$}Oo0cOv0qOg&Ui~P'vO{,hOz$la!W$la~Oo0cOv0qO{,iOz$la!W$la~P'vOo0cOv0qO{*gO!W&Xi~P'vOz,lO!W&Xi~Oo0cOv0qOz,lO!W&Xi~P'vOz,lO{,oO!W&Xi~Og$hiz$hi!W$hi~P%SOV'|Oo0cOv0qO~P'vOn,qO~OV'|Og,rOo0cOv0qO~P'vOV'|Oo0cOv0qO!W&Sq~P'vOz$gi![$gi#g$gi%[$gi%_$gig$gi{$gi!m$gi%z$gi~P%SOV(]Oo0cOv0qO~P'vOa+QOo0cOv0qO![&Tq~P'vOz,sO![&Tq~O![,tO~OV(]Oo0cOv0qO![%}q#g%}q%[%}q%_%}qg%}q{%}q!m%}q%z%}q~P'vO{,uO~OV+UOo0cOv0qO{&li![&li!m&li%z&li~P'vOz,zO{&li![&li!m&li%z&li~O!]+YO&n+[O![!na~O{(kO![,}O~OV&OOo0cOv0qO#g%hi%[%hi%_%hi%z%hi~P'vOz-OO#g%hi%[%hi%_%hi%z%hi~O%uWO#g&rq%[&rq%_&rqg&rq~Oz-RO#g&rq%[&rq%_&rqg&rq~OV)`Oa)`O%uWO!W&ua~Oz-TO!W&ua~On$|iz$|i~P%SOV)kO~P'vOV)kOn&wq~P'vOt-XOP#myV#myf#myh#myo#mys#myv#my!P#my!Q#my!T#my!U#my!X#my!]#my!h#my!r#my!s#my!t#my!{#my!}#my#P#my#R#my#T#my#X#my#Z#my#^#my#_#my#a#my#c#my#l#my#o#my#s#my#u#my#z#my#}#my$P#my%X#my%o#my%p#my%t#my%u#my&Z#my&[#my&]#my&^#my&_#my&`#my&a#my&b#my&c#my&d#my&e#my&f#my&g#my&h#my&i#my&j#my%Z#my%_#my~O%Z-]O%_-]O~P`O#q-^OP#nyV#nyf#nyh#nyo#nys#nyv#ny!P#ny!Q#ny!T#ny!U#ny!X#ny!]#ny!h#ny!r#ny!s#ny!t#ny!{#ny!}#ny#P#ny#R#ny#T#ny#X#ny#Z#ny#^#ny#_#ny#a#ny#c#ny#l#ny#o#ny#s#ny#u#ny#z#ny#}#ny$P#ny%X#ny%o#ny%p#ny%t#ny%u#ny&Z#ny&[#ny&]#ny&^#ny&_#ny&`#ny&a#ny&b#ny&c#ny&d#ny&e#ny&f#ny&g#ny&h#ny&i#ny&j#ny%Z#ny%_#ny~Oz-aO{$jO#[-aO~Oo0cOv0qO{&xq~P'vOz-dO{&xq~O%z,[Og&zaz&za~O{#{Og&zaz&za~OV*SOa*TO%q*UO%uWOg&ya~Oz-hOg&ya~O$S-lO~OV$}Oa$}Oo0cOv0qO~P'vOo0cOv0qO{-mOz$li!W$li~P'vOo0cOv0qOz$li!W$li~P'vO{-mOz$li!W$li~Oo0cOv0qO{*gO~P'vOo0cOv0qO{*gO!W&Xq~P'vOz-pO!W&Xq~Oo0cOv0qOz-pO!W&Xq~P'vOs-sO!T%dO!U%cOg&Oq!W&Oq![&Oqz&Oq~P!/jOa+QOo0cOv0qO![&Ty~P'vOz$ji![$ji~P%SOa+QOo0cOv0qO~P'vOV+UOo0cOv0qO~P'vOV+UOo0cOv0qO{&lq![&lq!m&lq%z&lq~P'vO{(kO![-xO!m-yO%z-wO~OV&OOo0cOv0qO#g%hq%[%hq%_%hq%z%hq~P'vO%uWO#g&ry%[&ry%_&ryg&ry~OV)`Oa)`O%uWO!W&ui~Ot-}OP#m!RV#m!Rf#m!Rh#m!Ro#m!Rs#m!Rv#m!R!P#m!R!Q#m!R!T#m!R!U#m!R!X#m!R!]#m!R!h#m!R!r#m!R!s#m!R!t#m!R!{#m!R!}#m!R#P#m!R#R#m!R#T#m!R#X#m!R#Z#m!R#^#m!R#_#m!R#a#m!R#c#m!R#l#m!R#o#m!R#s#m!R#u#m!R#z#m!R#}#m!R$P#m!R%X#m!R%o#m!R%p#m!R%t#m!R%u#m!R&Z#m!R&[#m!R&]#m!R&^#m!R&_#m!R&`#m!R&a#m!R&b#m!R&c#m!R&d#m!R&e#m!R&f#m!R&g#m!R&h#m!R&i#m!R&j#m!R%Z#m!R%_#m!R~Oo0cOv0qO{&xy~P'vOV*SOa*TO%q*UO%uWOg&yi~O$S-lO%Z.VO%_.VO~OV.aOh._O!X.^O!].`O!h.YO!s.[O!t.[O%p.XO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O~Oo0cOv0qOz$lq!W$lq~P'vO{.fOz$lq!W$lq~Oo0cOv0qO{*gO!W&Xy~P'vOz.gO!W&Xy~Oo0cOv.kO~P'vOs-sO!T%dO!U%cOg&Oy!W&Oy![&Oyz&Oy~P!/jO{(kO![.nO~O{(kO![.nO!m.oO~OV*SOa*TO%q*UO%uWO~Oh.tO!f.rOz$TX#[$TX%j$TXg$TX~Os$TX{$TX!W$TX![$TX~P$-bO%o.vO%p.vOs$UXz$UX{$UX#[$UX%j$UX!W$UXg$UX![$UX~O!h.xO~Oz.|O#[/OO%j.yOs&|X{&|X!W&|Xg&|X~Oa/RO~P$)zOh.tOs&}Xz&}X{&}X#[&}X%j&}X!W&}Xg&}X![&}X~Os/VO{$jO~Oo0cOv0qOz$ly!W$ly~P'vOo0cOv0qO{*gO!W&X!R~P'vOz/ZO!W&X!R~Og&RXs&RX!T&RX!U&RX!W&RX![&RXz&RX~P!/jOs-sO!T%dO!U%cOg&Qa!W&Qa![&Qaz&Qa~O{(kO![/^O~O!f.rOh$[as$[az$[a{$[a#[$[a%j$[a!W$[ag$[a![$[a~O!h/eO~O%o.vO%p.vOs$Uaz$Ua{$Ua#[$Ua%j$Ua!W$Uag$Ua![$Ua~O%j.yOs$Yaz$Ya{$Ya#[$Ya!W$Yag$Ya![$Ya~Os&|a{&|a!W&|ag&|a~P$)nOz/jOs&|a{&|a!W&|ag&|a~O!W/mO~Og/mO~O{/oO~O![/pO~Oo0cOv0qO{*gO!W&X!Z~P'vO{/sO~O%z/tO~P$-bOz/uO#[/OO%j.yOg'PX~Oz/uOg'PX~Og/wO~O!h/xO~O#[/OOs%Saz%Sa{%Sa%j%Sa!W%Sag%Sa![%Sa~O#[/OO%j.yOs%Waz%Wa{%Wa!W%Wag%Wa~Os&|i{&|i!W&|ig&|i~P$)nOz/zO#[/OO%j.yO!['Oa~Og'Pa~P$)nOz0SOg'Pa~Oa0UO!['Oi~P$)zOz0WO!['Oi~Oz0WO#[/OO%j.yO!['Oi~O#[/OO%j.yOg$biz$bi~O%z0ZO~P$-bO#[/OO%j.yOg%Vaz%Va~Og'Pi~P$)nO{0^O~Oa0UO!['Oq~P$)zOz0`O!['Oq~O#[/OO%j.yOz%Ui![%Ui~Oa0UO~P$)zOa0UO!['Oy~P$)zO#[/OO%j.yOg$ciz$ci~O#[/OO%j.yOz%Uq![%Uq~Oz+aO#g%ha%[%ha%_%ha%z%ha~P%SOV&OOo0cOv0qO~P'vOn0hO~Oo0hO~P'vO{0iO~Ot0jO~P!/jO&]&Z&j&h&i&g&f&d&e&c&b&`&a&_&^&[%u~",goto:"!=j'QPPPPPP'RP'Z*s+[+t,_,y-fP.SP'Z.r.r'ZPPP'Z2[PPPPPP2[5PPP5PP7b7k=sPP=v>h>kPP'Z'ZPP>zPP'Z'ZPP'Z'Z'Z'Z'Z?O?w'ZP?zP@QDXGuGyPG|HWH['ZPPPH_Hk'RP'R'RP'RP'RP'RP'RP'R'R'RP'RPP'RPP'RP'RPHqH}IVPI^IdPI^PI^I^PPPI^PKrPK{LVL]KrPI^LfPI^PLmLsPLwM]MzNeLwLwNkNxLwLwLwLw! ^! d! g! l! o! y!!P!!]!!o!!u!#P!#V!#s!#y!$P!$Z!$a!$g!$y!%T!%Z!%a!%k!%q!%w!%}!&T!&Z!&e!&k!&u!&{!'U!'[!'k!'s!'}!(UPPPPPPPPPPP!([!(_!(e!(n!(x!)TPPPPPPPPPPPP!-u!/Z!3^!6oPP!6w!7W!7a!8Y!8P!8c!8i!8l!8o!8r!8z!9jPPPPPPPPPPPPPPPPP!9m!9q!9wP!:]!:a!:m!:v!;S!;j!;m!;p!;v!;|!_![!]Do!]!^Es!^!_FZ!_!`Gk!`!aHX!a!b%T!b!cIf!c!dJU!d!eK^!e!hJU!h!i!#f!i!tJU!t!u!,|!u!wJU!w!x!.t!x!}JU!}#O!0S#O#P&o#P#Q!0j#Q#R!1Q#R#SJU#S#T%T#T#UJU#U#VK^#V#YJU#Y#Z!#f#Z#fJU#f#g!,|#g#iJU#i#j!.t#j#oJU#o#p!1n#p#q!1s#q#r!2a#r#s!2f#s$g%T$g;'SJU;'S;=`KW<%lOJU`%YT&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T`%lP;=`<%l%To%v]&n`%c_OX%TXY%oY[%T[]%o]p%Tpq%oq#O%T#O#P&o#P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To&tX&n`OY%TYZ%oZ]%T]^%o^#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc'f[&n`O!_%T!_!`([!`#T%T#T#U(r#U#f%T#f#g(r#g#h(r#h#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(cTmR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(yT!mR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk)aV&n`&[ZOr%Trs)vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk){V&n`Or%Trs*bs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk*iT&n`&^ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To+PZS_&n`OY*xYZ%TZ]*x]^%T^#o*x#o#p+r#p#q*x#q#r+r#r;'S*x;'S;=`,^<%lO*x_+wTS_OY+rZ]+r^;'S+r;'S;=`,W<%lO+r_,ZP;=`<%l+ro,aP;=`<%l*xj,kV%rQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-XT!xY&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-oV%lQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.]V&n`&ZZOw%Twx.rx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.wV&n`Ow%Twx/^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/eT&n`&]ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/{ThZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc0cTgR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk0yXVZ&n`Oz%Tz{1f{!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk1mVaR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk2ZV%oZ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc2wTzR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To3_W%pZ&n`O!_%T!_!`-Q!`!a3w!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Td4OT&{S&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk4fX!fQ&n`O!O%T!O!P5R!P!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5WV&n`O!O%T!O!P5m!P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5tT!rZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti6[a!hX&n`O!Q%T!Q![6T![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S6T#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti7fZ&n`O{%T{|8X|}%T}!O8X!O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8^V&n`O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8z]!hX&n`O!Q%T!Q![8s![!l%T!l!m9s!m#R%T#R#S8s#S#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti9zT!hX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk:bX%qR&n`O!P%T!P!Q:}!Q!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj;UV%sQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti;ro!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!d%T!d!e?q!e!g%T!g!h7a!h!l%T!l!m9s!m!q%T!q!rA]!r!z%T!z!{Bq!{#R%T#R#S>_#S#U%T#U#V?q#V#X%T#X#Y7a#Y#^%T#^#_9s#_#c%T#c#dA]#d#l%T#l#mBq#m#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti=xV&n`O!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti>fc!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S>_#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti?vY&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti@mY!hX&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiAbX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBUX!hX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBv]&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiCv]!hX&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToDvV{_&n`O!_%T!_!`E]!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TcEdT%{R&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkEzT#gZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkFbXmR&n`O!^%T!^!_F}!_!`([!`!a([!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjGUV%mQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkGrV%zZ&n`O!_%T!_!`([!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkH`WmR&n`O!_%T!_!`([!`!aHx!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjIPV%nQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkIoV_Q#}P&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToJ_]&n`&YS%uZO!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoKZP;=`<%lJUoKge&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!tJU!t!uLx!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#gLx#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoMRa&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUkN_V&n`&`ZOr%TrsNts#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkNyV&n`Or%Trs! `s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! gT&n`&bZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! }V&n`&_ZOw%Twx!!dx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!!iV&n`Ow%Twx!#Ox#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!#VT&n`&aZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!#oe&n`&YS%uZOr%Trs!%Qsw%Twx!&px!Q%T!Q![JU![!c%T!c!tJU!t!u!(`!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#g!(`#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!%XV&n`&dZOr%Trs!%ns#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!%sV&n`Or%Trs!&Ys#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&aT&n`&fZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&wV&n`&cZOw%Twx!'^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!'cV&n`Ow%Twx!'xx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!(PT&n`&eZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!(ia&n`&YS%uZOr%Trs!)nsw%Twx!+^x!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!)uV&n`&hZOr%Trs!*[s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*aV&n`Or%Trs!*vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*}T&n`&jZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!+eV&n`&gZOw%Twx!+zx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,PV&n`Ow%Twx!,fx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,mT&n`&iZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!-Vi&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!dJU!d!eLx!e!hJU!h!i!(`!i!}JU!}#R%T#R#SJU#S#T%T#T#UJU#U#VLx#V#YJU#Y#Z!(`#Z#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUo!.}a&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!0ZT!XZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc!0qT!WR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj!1XV%kQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!1sO!]~k!1zV%jR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!2fO![~i!2mT%tX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T",tokenizers:[nvt,Kxt,Zxt,rvt,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:e=>avt[e]||-1}],tokenPrec:7668}),TK=new aQ,XOe=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function r_(e){return(t,n,r)=>{if(r)return!1;let i=t.node.getChild("VariableName");return i&&n(i,e),!0}}const lvt={FunctionDefinition:r_("function"),ClassDefinition:r_("class"),ForStatement(e,t,n){if(n){for(let r=e.node.firstChild;r;r=r.nextSibling)if(r.name=="VariableName")t(r,"variable");else if(r.name=="in")break}},ImportStatement(e,t){var n,r;let{node:i}=e,s=((n=i.firstChild)===null||n===void 0?void 0:n.name)=="from";for(let a=i.getChild("import");a;a=a.nextSibling)a.name=="VariableName"&&((r=a.nextSibling)===null||r===void 0?void 0:r.name)!="as"&&t(a,s?"variable":"namespace")},AssignStatement(e,t){for(let n=e.node.firstChild;n;n=n.nextSibling)if(n.name=="VariableName")t(n,"variable");else if(n.name==":"||n.name=="AssignOp")break},ParamList(e,t){for(let n=null,r=e.node.firstChild;r;r=r.nextSibling)r.name=="VariableName"&&(!n||!/\*|AssignOp/.test(n.name))&&t(r,"variable"),n=r},CapturePattern:r_("variable"),AsPattern:r_("variable"),__proto__:null};function GOe(e,t){let n=TK.get(t);if(n)return n;let r=[],i=!0;function s(a,l){let c=e.sliceString(a.from,a.to);r.push({label:c,type:l})}return t.cursor(Qr.IncludeAnonymous).iterate(a=>{if(a.name){let l=lvt[a.name];if(l&&l(a,s,i)||!i&&XOe.has(a.name))return!1;i=!1}else if(a.to-a.from>8192){for(let l of GOe(e,a.node))r.push(l);return!1}}),TK.set(t,r),r}const CK=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,WOe=["String","FormatString","Comment","PropertyName"];function cvt(e){let t=mi(e.state).resolveInner(e.pos,-1);if(WOe.indexOf(t.name)>-1)return null;let n=t.name=="VariableName"||t.to-t.from<20&&CK.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let r=[];for(let i=t;i;i=i.parent)XOe.has(i.name)&&(r=r.concat(GOe(e.state.doc,i)));return{options:r,from:n?t.from:e.pos,validFor:CK}}const uvt=["__annotations__","__builtins__","__debug__","__doc__","__import__","__name__","__loader__","__package__","__spec__","False","None","True"].map(e=>({label:e,type:"constant"})).concat(["ArithmeticError","AssertionError","AttributeError","BaseException","BlockingIOError","BrokenPipeError","BufferError","BytesWarning","ChildProcessError","ConnectionAbortedError","ConnectionError","ConnectionRefusedError","ConnectionResetError","DeprecationWarning","EOFError","Ellipsis","EncodingWarning","EnvironmentError","Exception","FileExistsError","FileNotFoundError","FloatingPointError","FutureWarning","GeneratorExit","IOError","ImportError","ImportWarning","IndentationError","IndexError","InterruptedError","IsADirectoryError","KeyError","KeyboardInterrupt","LookupError","MemoryError","ModuleNotFoundError","NameError","NotADirectoryError","NotImplemented","NotImplementedError","OSError","OverflowError","PendingDeprecationWarning","PermissionError","ProcessLookupError","RecursionError","ReferenceError","ResourceWarning","RuntimeError","RuntimeWarning","StopAsyncIteration","StopIteration","SyntaxError","SyntaxWarning","SystemError","SystemExit","TabError","TimeoutError","TypeError","UnboundLocalError","UnicodeDecodeError","UnicodeEncodeError","UnicodeError","UnicodeTranslateError","UnicodeWarning","UserWarning","ValueError","Warning","ZeroDivisionError"].map(e=>({label:e,type:"type"}))).concat(["bool","bytearray","bytes","classmethod","complex","float","frozenset","int","list","map","memoryview","object","range","set","staticmethod","str","super","tuple","type"].map(e=>({label:e,type:"class"}))).concat(["abs","aiter","all","anext","any","ascii","bin","breakpoint","callable","chr","compile","delattr","dict","dir","divmod","enumerate","eval","exec","exit","filter","format","getattr","globals","hasattr","hash","help","hex","id","input","isinstance","issubclass","iter","len","license","locals","max","min","next","oct","open","ord","pow","print","property","quit","repr","reversed","round","setattr","slice","sorted","sum","vars","zip"].map(e=>({label:e,type:"function"}))),dvt=[rs("def ${name}(${params}):\n ${}",{label:"def",detail:"function",type:"keyword"}),rs("for ${name} in ${collection}:\n ${}",{label:"for",detail:"loop",type:"keyword"}),rs("while ${}:\n ${}",{label:"while",detail:"loop",type:"keyword"}),rs("try:\n ${}\nexcept ${error}:\n ${}",{label:"try",detail:"/ except block",type:"keyword"}),rs(`if \${}: +`);r=i<0?n:n.slice(0,i)}return t+r.length>this.to?r.slice(0,this.to-t):r}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(t,n,r=0){this.block=RA.create(t,r,this.lineStart+n,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(t,n,r=0){this.startContext(this.parser.getNodeType(t),n,r)}addNode(t,n,r){typeof t=="number"&&(t=new lr(this.parser.nodeSet.types[t],E1,E1,(r??this.prevLineEnd())-n)),this.block.addChild(t,n-this.block.from)}addElement(t){this.block.addChild(t.toTree(this.parser.nodeSet),t.from-this.block.from)}addLeafElement(t,n){this.addNode(this.buffer.writeElements(S6(n.children,t.marks),-n.from).finish(n.type,n.to-n.from),n.from)}finishContext(){let t=this.stack.pop(),n=this.stack[this.stack.length-1];n.addChild(t.toTree(this.parser.nodeSet),t.from-n.from),this.block=n}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(t){return this.ranges.length>1?J1e(this.ranges,0,t.topNode,this.ranges[0].from,this.reusePlaceholders):t}finishLeaf(t){for(let r of t.parsers)if(r.finish(this,t))return;let n=S6(this.parser.parseInline(t.content,t.start),t.marks);this.addNode(this.buffer.writeElements(n,-t.start).finish(wt.Paragraph,t.content.length),t.start)}elt(t,n,r,i){return typeof t=="string"?Ir(this.parser.getNodeType(t),n,r,i):new nOe(t,n)}get buffer(){return new tOe(this.parser.nodeSet)}}function J1e(e,t,n,r,i){let s=e[t].to,a=[],l=[],c=n.from+r;function u(d,f){for(;f?d>=s:d>s;){let h=e[t+1].from-s;r+=h,d+=h,t++,s=e[t].to}}for(let d=n.firstChild;d;d=d.nextSibling){u(d.from+r,!0);let f=d.from+r,h,m=i.get(d.tree);m?h=m:d.to+r>s?(h=J1e(e,t,d,r,i),u(d.to+r,!1)):h=d.toTree(),a.push(h),l.push(f-c)}return u(n.to+r,!1),new lr(n.type,a,l,n.to+r-c,n.tree?n.tree.propValues:void 0)}class cR extends Yj{constructor(t,n,r,i,s,a,l,c,u){super(),this.nodeSet=t,this.blockParsers=n,this.leafBlockParsers=r,this.blockNames=i,this.endLeafBlock=s,this.skipContextMarkup=a,this.inlineParsers=l,this.inlineNames=c,this.wrappers=u,this.nodeTypes=Object.create(null);for(let d of t.types)this.nodeTypes[d.name]=d.id}createParse(t,n,r){let i=new Byt(this,t,n,r);for(let s of this.wrappers)i=s(i,t,n,r);return i}configure(t){let n=w6(t);if(!n)return this;let{nodeSet:r,skipContextMarkup:i}=this,s=this.blockParsers.slice(),a=this.leafBlockParsers.slice(),l=this.blockNames.slice(),c=this.inlineParsers.slice(),u=this.inlineNames.slice(),d=this.endLeafBlock.slice(),f=this.wrappers;if(yx(n.defineNodes)){i=Object.assign({},i);let h=r.types.slice(),m;for(let g of n.defineNodes){let{name:b,block:y,composite:O,style:v}=typeof g=="string"?{name:g}:g;if(h.some(S=>S.name==b))continue;O&&(i[h.length]=(S,E,k)=>O(E,k,S.value));let x=h.length,w=O?["Block","BlockContext"]:y?x>=wt.ATXHeading1&&x<=wt.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;h.push(Fs.define({id:x,name:b,props:w&&[[An.group,w]]})),v&&(m||(m={}),Array.isArray(v)||v instanceof Wu?m[b]=v:Object.assign(m,v))}r=new bO(h),m&&(r=r.extend(vh(m)))}if(yx(n.props)&&(r=r.extend(...n.props)),yx(n.remove))for(let h of n.remove){let m=this.blockNames.indexOf(h),g=this.inlineNames.indexOf(h);m>-1&&(s[m]=a[m]=void 0),g>-1&&(c[g]=void 0)}if(yx(n.parseBlock))for(let h of n.parseBlock){let m=l.indexOf(h.name);if(m>-1)s[m]=h.parse,a[m]=h.leaf;else{let g=h.before?i_(l,h.before):h.after?i_(l,h.after)+1:l.length-1;s.splice(g,0,h.parse),a.splice(g,0,h.leaf),l.splice(g,0,h.name)}h.endLeaf&&d.push(h.endLeaf)}if(yx(n.parseInline))for(let h of n.parseInline){let m=u.indexOf(h.name);if(m>-1)c[m]=h.parse;else{let g=h.before?i_(u,h.before):h.after?i_(u,h.after)+1:u.length-1;c.splice(g,0,h.parse),u.splice(g,0,h.name)}}return n.wrap&&(f=f.concat(n.wrap)),new cR(r,s,a,l,d,i,c,u,f)}getNodeType(t){let n=this.nodeTypes[t];if(n==null)throw new RangeError(`Unknown node type '${t}'`);return n}parseInline(t,n){let r=new HQ(this,t,n);e:for(let i=n;i=0){i=l;continue e}}i++}return r.resolveMarkers(0)}}function yx(e){return e!=null&&e.length>0}function w6(e){if(!Array.isArray(e))return e;if(e.length==0)return null;let t=w6(e[0]);if(e.length==1)return t;let n=w6(e.slice(1));if(!n||!t)return t||n;let r=(a,l)=>(a||E1).concat(l||E1),i=t.wrap,s=n.wrap;return{props:r(t.props,n.props),defineNodes:r(t.defineNodes,n.defineNodes),parseBlock:r(t.parseBlock,n.parseBlock),parseInline:r(t.parseInline,n.parseInline),remove:r(t.remove,n.remove),wrap:i?s?(a,l,c,u)=>i(s(a,l,c,u),l,c,u):i:s}}function i_(e,t){let n=e.indexOf(t);if(n<0)throw new RangeError(`Position specified relative to unknown parser ${t}`);return n}let eOe=[Fs.none];for(let e=1,t;t=wt[e];e++)eOe[e]=Fs.define({id:e,name:t,props:e>=wt.Escape?[]:[[An.group,e in z1e?["Block","BlockContext"]:["Block","LeafBlock"]]],top:t=="Document"});const E1=[];class tOe{constructor(t){this.nodeSet=t,this.content=[],this.nodes=[]}write(t,n,r,i=0){return this.content.push(t,n,r,4+i*4),this}writeElements(t,n=0){for(let r of t)r.writeTo(this,n);return this}finish(t,n){return lr.build({buffer:this.content,nodeSet:this.nodeSet,reused:this.nodes,topID:t,length:n})}}let bS=class{constructor(t,n,r,i=E1){this.type=t,this.from=n,this.to=r,this.children=i}writeTo(t,n){let r=t.content.length;t.writeElements(this.children,n),t.content.push(this.type,this.from+n,this.to+n,t.content.length+4-r)}toTree(t){return new tOe(t).writeElements(this.children,-this.from).finish(this.type,this.to-this.from)}};class nOe{constructor(t,n){this.tree=t,this.from=n}get to(){return this.from+this.tree.length}get type(){return this.tree.type.id}get children(){return E1}writeTo(t,n){t.nodes.push(this.tree),t.content.push(t.nodes.length-1,this.from+n,this.to+n,-1)}toTree(){return this.tree}}function Ir(e,t,n,r){return new bS(e,t,n,r)}const rOe={resolve:"Emphasis",mark:"EmphasisMark"},iOe={resolve:"Emphasis",mark:"EmphasisMark"},Zm={},IA={};class wl{constructor(t,n,r,i){this.type=t,this.from=n,this.to=r,this.side=i}}const WZ="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";let yS=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;try{yS=new RegExp("[\\p{S}|\\p{P}]","u")}catch{}const oP={Escape(e,t,n){if(t!=92||n==e.end-1)return-1;let r=e.char(n+1);for(let i=0;i]+|[a-z\d.!#$%&'*+/=?^_`{|}~-]+@[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*)>/i.exec(r);if(i)return e.append(Ir(wt.Autolink,n,n+1+i[0].length,[Ir(wt.LinkMark,n,n+1),Ir(wt.URL,n+1,n+i[0].length),Ir(wt.LinkMark,n+i[0].length,n+1+i[0].length)]));let s=/^!--[^>](?:-[^-]|[^-])*?-->/i.exec(r);if(s)return e.append(Ir(wt.Comment,n,n+1+s[0].length));let a=/^\?[^]*?\?>/.exec(r);if(a)return e.append(Ir(wt.ProcessingInstruction,n,n+1+a[0].length));let l=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(r);return l?e.append(Ir(wt.HTMLTag,n,n+1+l[0].length)):-1},Emphasis(e,t,n){if(t!=95&&t!=42)return-1;let r=n+1;for(;e.char(r)==t;)r++;let i=e.slice(n-1,n),s=e.slice(r,r+1),a=yS.test(i),l=yS.test(s),c=/\s|^$/.test(i),u=/\s|^$/.test(s),d=!u&&(!l||c||a),f=!c&&(!a||u||l),h=d&&(t==42||!f||a),m=f&&(t==42||!d||l);return e.append(new wl(t==95?rOe:iOe,n,r,(h?1:0)|(m?2:0)))},HardBreak(e,t,n){if(t==92&&e.char(n+1)==10)return e.append(Ir(wt.HardBreak,n,n+2));if(t==32){let r=n+1;for(;e.char(r)==32;)r++;if(e.char(r)==10&&r>=n+2)return e.append(Ir(wt.HardBreak,n,r+1))}return-1},Link(e,t,n){return t==91?e.append(new wl(Zm,n,n+1,1)):-1},Image(e,t,n){return t==33&&e.char(n+1)==91?e.append(new wl(IA,n,n+2,1)):-1},LinkEnd(e,t,n){if(t!=93)return-1;for(let r=e.parts.length-1;r>=0;r--){let i=e.parts[r];if(i instanceof wl&&(i.type==Zm||i.type==IA)){if(!i.side||e.skipSpace(i.to)==n&&!/[(\[]/.test(e.slice(n+1,n+2)))return e.parts[r]=null,-1;let s=e.takeContent(r),a=e.parts[r]=Qyt(e,s,i.type==Zm?wt.Link:wt.Image,i.from,n+1);if(i.type==Zm)for(let l=0;lt?Ir(wt.URL,t+n,s+n):s==e.length?null:!1}}function aOe(e,t,n){let r=e.charCodeAt(t);if(r!=39&&r!=34&&r!=40)return!1;let i=r==40?41:r;for(let s=t+1,a=!1;s=this.end?-1:this.text.charCodeAt(t-this.offset)}get end(){return this.offset+this.text.length}slice(t,n){return this.text.slice(t-this.offset,n-this.offset)}append(t){return this.parts.push(t),t.to}addDelimiter(t,n,r,i,s){return this.append(new wl(t,n,r,(i?1:0)|(s?2:0)))}get hasOpenLink(){for(let t=this.parts.length-1;t>=0;t--){let n=this.parts[t];if(n instanceof wl&&(n.type==Zm||n.type==IA))return!0}return!1}addElement(t){return this.append(t)}resolveMarkers(t){for(let r=t;r=t;c--){let b=this.parts[c];if(b instanceof wl&&b.side&1&&b.type==i.type&&!(s&&(i.side&1||b.side&2)&&(b.to-b.from+a)%3==0&&((b.to-b.from)%3||a%3))){l=b;break}}if(!l)continue;let u=i.type.resolve,d=[],f=l.from,h=i.to;if(s){let b=Math.min(2,l.to-l.from,a);f=l.to-b,h=i.from+b,u=b==1?"Emphasis":"StrongEmphasis"}l.type.mark&&d.push(this.elt(l.type.mark,f,l.to));for(let b=c+1;b=0;n--){let r=this.parts[n];if(r instanceof wl&&r.type==t&&r.side&1)return n}return null}takeContent(t){let n=this.resolveMarkers(t);return this.parts.length=t,n}getDelimiterAt(t){let n=this.parts[t];return n instanceof wl?n:null}skipSpace(t){return Kv(this.text,t-this.offset)+this.offset}elt(t,n,r,i){return typeof t=="string"?Ir(this.parser.getNodeType(t),n,r,i):new nOe(t,n)}}HQ.linkStart=Zm;HQ.imageStart=IA;function S6(e,t){if(!t.length)return e;if(!e.length)return t;let n=e.slice(),r=0;for(let i of t){for(;r(t?t-1:0))return!1;if(this.fragmentEnd<0){let s=this.fragment.to;for(;s>0&&this.input.read(s-1,s)!=` +`;)s--;this.fragmentEnd=s?s-1:0}let r=this.cursor;r||(r=this.cursor=this.fragment.tree.cursor(),r.firstChild());let i=t+this.fragment.offset;for(;r.to<=i;)if(!r.parent())return!1;for(;;){if(r.from>=i)return this.fragment.from<=n;if(!r.childAfter(i))return!1}}matches(t){let n=this.cursor.tree;return n&&n.prop(An.contextHash)==t}takeNodes(t){let n=this.cursor,r=this.fragment.offset,i=this.fragmentEnd-(this.fragment.openEnd?1:0),s=t.absoluteLineStart,a=s,l=t.block.children.length,c=a,u=l;for(;;){if(n.to-r>i){if(n.type.isAnonymous&&n.firstChild())continue;break}let d=lOe(n.from-r,t.ranges);if(n.to-r<=t.ranges[t.rangeI].to)t.addNode(n.tree,d);else{let f=new lr(t.parser.nodeSet.types[wt.Paragraph],[],[],0,t.block.hashProp);t.reusePlaceholders.set(f,n.tree),t.addNode(f,d)}if(n.type.is("Block")&&(Uyt.indexOf(n.type.id)<0?(a=n.to-r,l=t.block.children.length):(a=c,l=u),c=n.to-r,u=t.block.children.length),!n.nextSibling())break}for(;t.block.children.length>l;)t.block.children.pop(),t.block.positions.pop();return a-s}}function lOe(e,t){let n=e;for(let r=1;rr_[e]),Object.keys(r_).map(e=>K1e[e]),Object.keys(r_),Lyt,z1e,Object.keys(oP).map(e=>oP[e]),Object.keys(oP),[]);function Hyt(e,t,n){let r=[];for(let i=e.firstChild,s=t;;i=i.nextSibling){let a=i?i.from:n;if(a>s&&r.push({from:s,to:a}),!i)break;s=i.to}return r}function qyt(e){let{codeParser:t,htmlParser:n}=e;return{wrap:Ebe((i,s)=>{let a=i.type.id;if(t&&(a==wt.CodeBlock||a==wt.FencedCode)){let l="";if(a==wt.FencedCode){let u=i.node.getChild(wt.CodeInfo);u&&(l=s.read(u.from,u.to))}let c=t(l);if(c)return{parser:c,overlay:u=>u.type.id==wt.CodeText,bracketed:a==wt.FencedCode}}else if(n&&(a==wt.HTMLBlock||a==wt.HTMLTag||a==wt.CommentBlock))return{parser:n,overlay:Hyt(i.node,i.from,i.to)};return null})}}const Xyt={resolve:"Strikethrough",mark:"StrikethroughMark"},Gyt={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":Z.strikethrough}},{name:"StrikethroughMark",style:Z.processingInstruction}],parseInline:[{name:"Strikethrough",parse(e,t,n){if(t!=126||e.char(n+1)!=126||e.char(n+2)==126)return-1;let r=e.slice(n-1,n),i=e.slice(n+2,n+3),s=/\s|^$/.test(r),a=/\s|^$/.test(i),l=yS.test(r),c=yS.test(i);return e.addDelimiter(Xyt,n,n+2,!a&&(!c||s||l),!s&&(!l||a||c))},after:"Emphasis"}]};function Jv(e,t,n=0,r,i=0){let s=0,a=!0,l=-1,c=-1,u=!1,d=()=>{r.push(e.elt("TableCell",i+l,i+c,e.parser.parseInline(t.slice(l,c),i+l)))};for(let f=n;f-1)&&s++,a=!1,r&&(l>-1&&d(),r.push(e.elt("TableDelimiter",f+i,f+i+1))),l=c=-1):(u||h!=32&&h!=9)&&(l<0&&(l=f),c=f+1),u=!u&&h==92}return l>-1&&(s++,r&&d()),s}function YZ(e,t){for(let n=t;n\s]*\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;class ZZ{constructor(){this.rows=null}nextLine(t,n,r){if(this.rows==null){this.rows=!1;let i;if((n.next==45||n.next==58||n.next==124)&&cOe.test(i=n.text.slice(n.pos))){let s=[];Jv(t,r.content,0,s,r.start)==Jv(t,i,0)&&(this.rows=[t.elt("TableHeader",r.start,r.start+r.content.length,s),t.elt("TableDelimiter",t.lineStart+n.pos,t.lineStart+n.text.length)])}}else if(this.rows){let i=[];Jv(t,n.text,n.pos,i,t.lineStart),this.rows.push(t.elt("TableRow",t.lineStart+n.pos,t.lineStart+n.text.length,i))}return!1}finish(t,n){return this.rows?(t.addLeafElement(n,t.elt("Table",n.start,n.start+n.content.length,this.rows)),!0):!1}}const Wyt={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":Z.heading}},"TableRow",{name:"TableCell",style:Z.content},{name:"TableDelimiter",style:Z.processingInstruction}],parseBlock:[{name:"Table",leaf(e,t){return YZ(t.content,0)?new ZZ:null},endLeaf(e,t,n){if(n.parsers.some(i=>i instanceof ZZ)||!YZ(t.text,t.basePos))return!1;let r=e.peekLine();return cOe.test(r)&&Jv(e,t.text,t.basePos)==Jv(e,r,t.basePos)},before:"SetextHeading"}]};class Yyt{nextLine(){return!1}finish(t,n){return t.addLeafElement(n,t.elt("Task",n.start,n.start+n.content.length,[t.elt("TaskMarker",n.start,n.start+3),...t.parser.parseInline(n.content.slice(3),n.start+3)])),!0}}const Zyt={defineNodes:[{name:"Task",block:!0,style:Z.list},{name:"TaskMarker",style:Z.atom}],parseBlock:[{name:"TaskList",leaf(e,t){return/^\[[ xX]\][ \t]/.test(t.content)&&e.parentType().name=="ListItem"?new Yyt:null},after:"SetextHeading"}]},KZ=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,JZ=/[\w-]+(\.[\w-]+)+(:\d+)?(\/[^\s<]*)?/gy,Kyt=/[\w-]+\.[\w-]+($|[/:])/,eK=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,tK=/\/[a-zA-Z\d@.]+/gy;function nK(e,t,n,r){let i=0;for(let s=t;s-1)return-1;let r=t+n[0].length;for(;;){let i=e[r-1],s;if(/[?!.,:*_~]/.test(i)||i==")"&&nK(e,t,r,")")>nK(e,t,r,"("))r--;else if(i==";"&&(s=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(e.slice(t,r))))r=t+s.index;else break}return r}function rK(e,t){eK.lastIndex=t;let n=eK.exec(e);if(!n)return-1;let r=n[0][n[0].length-1];return r=="_"||r=="-"?-1:t+n[0].length-(r=="."?1:0)}const e1t={parseInline:[{name:"Autolink",parse(e,t,n){let r=n-e.offset;if(r&&/\w/.test(e.text[r-1]))return-1;KZ.lastIndex=r;let i=KZ.exec(e.text),s=-1;if(!i)return-1;if(i[1]||i[2]){if(s=Jyt(e.text,r+i[0].length),s>-1&&e.hasOpenLink){let a=/([^\[\]]|\[[^\]]*\])*/.exec(e.text.slice(r,s));s=r+a[0].length}}else i[3]?s=rK(e.text,r):(s=rK(e.text,r+i[0].length),s>-1&&i[0]=="xmpp:"&&(tK.lastIndex=s,i=tK.exec(e.text),i&&(s=i.index+i[0].length)));return s<0?-1:(e.addElement(e.elt("URL",n,s+e.offset)),s+e.offset)}}]},t1t=[Wyt,Zyt,Gyt,e1t];function uOe(e,t,n){return(r,i,s)=>{if(i!=e||r.char(s+1)==e)return-1;let a=[r.elt(n,s,s+1)];for(let l=s+1;l=65&&e<=90||e==95||e>=97&&e<=122||e>=161}let oK=null,lK=null,cK=0;function k6(e,t){let n=e.pos+t;if(cK==n&&lK==e)return oK;let r=e.peek(t),i="";for(;C1t(r);)i+=String.fromCharCode(r),r=e.peek(++t);return lK=e,cK=n,oK=i?i.toLowerCase():r==A1t||r==N1t?void 0:null}const yOe=60,DA=62,XQ=47,A1t=63,N1t=33,j1t=45;function uK(e,t){this.name=e,this.parent=t}const R1t=[qQ,pOe,dOe,fOe,hOe],I1t=new oR({start:null,shift(e,t,n,r){return R1t.indexOf(t)>-1?new uK(k6(r,1)||"",e):e},reduce(e,t){return t==mOe&&e?e.parent:e},reuse(e,t,n,r){let i=t.type.id;return i==qQ||i==w1t?new uK(k6(r,1)||"",e):e},strict:!1}),D1t=new js((e,t)=>{if(e.next!=yOe){e.next<0&&t.context&&e.acceptToken(lP);return}e.advance();let n=e.next==XQ;n&&e.advance();let r=k6(e,0);if(r===void 0)return;if(!r)return e.acceptToken(n?g1t:m1t);let i=t.context?t.context.name:null;if(n){if(r==i)return e.acceptToken(f1t);if(i&&T1t[i])return e.acceptToken(lP,-2);if(t.dialectEnabled(E1t))return e.acceptToken(h1t);for(let s=t.context;s;s=s.parent)if(s.name==r)return;e.acceptToken(p1t)}else{if(r=="script")return e.acceptToken(dOe);if(r=="style")return e.acceptToken(fOe);if(r=="textarea")return e.acceptToken(hOe);if(_1t.hasOwnProperty(r))return e.acceptToken(pOe);i&&aK[i]&&aK[i][r]?e.acceptToken(lP,-1):e.acceptToken(qQ)}},{contextual:!0}),P1t=new js(e=>{for(let t=0,n=0;;n++){if(e.next<0){n&&e.acceptToken(sK);break}if(e.next==j1t)t++;else if(e.next==DA&&t>=2){n>=3&&e.acceptToken(sK,-2);break}else t=0;e.advance()}});function M1t(e){for(;e;e=e.parent)if(e.name=="svg"||e.name=="math")return!0;return!1}const L1t=new js((e,t)=>{if(e.next==XQ&&e.peek(1)==DA){let n=t.dialectEnabled(k1t)||M1t(t.context);e.acceptToken(n?d1t:iK,2)}else e.next==DA&&e.acceptToken(iK,1)});function GQ(e,t,n){let r=2+e.length;return new js(i=>{for(let s=0,a=0,l=0;;l++){if(i.next<0){l&&i.acceptToken(t);break}if(s==0&&i.next==yOe||s==1&&i.next==XQ||s>=2&&sa?i.acceptToken(t,-a):i.acceptToken(n,-(a-2));break}else if((i.next==10||i.next==13)&&l){i.acceptToken(t,1);break}else s=a=0;i.advance()}})}const $1t=GQ("script",s1t,a1t),B1t=GQ("style",o1t,l1t),Q1t=GQ("textarea",c1t,u1t),U1t=vh({"Text RawText IncompleteTag IncompleteCloseTag":Z.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":Z.angleBracket,TagName:Z.tagName,"MismatchedCloseTag/TagName":[Z.tagName,Z.invalid],AttributeName:Z.attributeName,"AttributeValue UnquotedAttributeValue":Z.attributeValue,Is:Z.definitionOperator,"EntityReference CharacterReference":Z.character,Comment:Z.blockComment,ProcessingInst:Z.processingInstruction,DoctypeDecl:Z.documentMeta}),F1t=ch.deserialize({version:14,states:",xOVO!rOOO!ZQ#tO'#CrO!`Q#tO'#C{O!eQ#tO'#DOO!jQ#tO'#DRO!oQ#tO'#DTO!tOaO'#CqO#PObO'#CqO#[OdO'#CqO$kO!rO'#CqOOO`'#Cq'#CqO$rO$fO'#DUO$zQ#tO'#DWO%PQ#tO'#DXOOO`'#Dl'#DlOOO`'#DZ'#DZQVO!rOOO%UQ&rO,59^O%aQ&rO,59gO%lQ&rO,59jO%wQ&rO,59mO&SQ&rO,59oOOOa'#D_'#D_O&_OaO'#CyO&jOaO,59]OOOb'#D`'#D`O&rObO'#C|O&}ObO,59]OOOd'#Da'#DaO'VOdO'#DPO'bOdO,59]OOO`'#Db'#DbO'jO!rO,59]O'qQ#tO'#DSOOO`,59],59]OOOp'#Dc'#DcO'vO$fO,59pOOO`,59p,59pO(OQ#|O,59rO(TQ#|O,59sOOO`-E7X-E7XO(YQ&rO'#CtOOQW'#D['#D[O(hQ&rO1G.xOOOa1G.x1G.xOOO`1G/Z1G/ZO(sQ&rO1G/ROOOb1G/R1G/RO)OQ&rO1G/UOOOd1G/U1G/UO)ZQ&rO1G/XOOO`1G/X1G/XO)fQ&rO1G/ZOOOa-E7]-E7]O)qQ#tO'#CzOOO`1G.w1G.wOOOb-E7^-E7^O)vQ#tO'#C}OOOd-E7_-E7_O){Q#tO'#DQOOO`-E7`-E7`O*QQ#|O,59nOOOp-E7a-E7aOOO`1G/[1G/[OOO`1G/^1G/^OOO`1G/_1G/_O*VQ,UO,59`OOQW-E7Y-E7YOOOa7+$d7+$dOOO`7+$u7+$uOOOb7+$m7+$mOOOd7+$p7+$pOOO`7+$s7+$sO*bQ#|O,59fO*gQ#|O,59iO*lQ#|O,59lOOO`1G/Y1G/YO*qO7[O'#CwO+SOMhO'#CwOOQW1G.z1G.zOOO`1G/Q1G/QOOO`1G/T1G/TOOO`1G/W1G/WOOOO'#D]'#D]O+eO7[O,59cOOQW,59c,59cOOOO'#D^'#D^O+vOMhO,59cOOOO-E7Z-E7ZOOQW1G.}1G.}OOOO-E7[-E7[",stateData:",c~O!_OS~OUSOVPOWQOXROYTO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O|_O!eZO~OgaO~OgbO~OgcO~OgdO~OgeO~O!XfOPmP![mP~O!YiOQpP![pP~O!ZlORsP![sP~OUSOVPOWQOXROYTOZqO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O!eZO~O![rO~P#gO!]sO!fuO~OgvO~OgwO~OS|OT}OiyO~OS!POT}OiyO~OS!ROT}OiyO~OS!TOT}OiyO~OS}OT}OiyO~O!XfOPmX![mX~OP!WO![!XO~O!YiOQpX![pX~OQ!ZO![!XO~O!ZlORsX![sX~OR!]O![!XO~O![!XO~P#gOg!_O~O!]sO!f!aO~OS!bO~OS!cO~Oj!dOShXThXihX~OS!fOT!gOiyO~OS!hOT!gOiyO~OS!iOT!gOiyO~OS!jOT!gOiyO~OS!gOT!gOiyO~Og!kO~Og!lO~Og!mO~OS!nO~Ol!qO!a!oO!c!pO~OS!rO~OS!sO~OS!tO~Ob!uOc!uOd!uO!a!wO!b!uO~Ob!xOc!xOd!xO!c!wO!d!xO~Ob!uOc!uOd!uO!a!{O!b!uO~Ob!xOc!xOd!xO!c!{O!d!xO~OT~cbd!ey|!e~",goto:"%q!aPPPPPPPPPPPPPPPPPPPPP!b!hP!nPP!zP!}#Q#T#Z#^#a#g#j#m#s#y!bP!b!bP$P$V$m$s$y%P%V%]%cPPPPPPPP%iX^OX`pXUOX`pezabcde{!O!Q!S!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ!ObQ!QcQ!SdQ!UeZ!e{!O!Q!S!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:68,context:I1t,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,22,31,34,37,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,30,33,36,38,"OpenTag"],["group",-10,14,15,18,19,20,21,40,41,42,43,"Entity",17,"Entity TextContent",-3,29,32,35,"TextContent Entity"],["isolate",-11,22,30,31,33,34,36,37,38,39,42,43,"ltr",-3,27,28,40,""]],propSources:[U1t],skippedNodes:[0],repeatNodeCount:9,tokenData:"!]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zblWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOb!R!R7tP;=`<%l7S!Z8OYlWb!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{iiSlWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!_:sbiSlWb!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VP<%l?Ah;{?Ah?BY7S?BY?Mn;{?MnO7S!V=dXiSb!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!V>SP;=`<%l;{!_>YP;=`<%l8t!_>dhiSlWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^/^!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!Z@TalWOX@OXZAYZ[@O[^AY^p@Oqr@OrsAYsw@OwxAYx!]@O!]!^Az!^!aAY!a#S@O#S#TAY#T;'S@O;'S;=`Bq<%lO@O!RA]UOpAYq!]AY!]!^Ao!^;'SAY;'S;=`At<%lOAY!RAtOc!R!RAwP;=`<%lAY!ZBRYlWc!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!ZBtP;=`<%l@O!_COhiSlWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^Dj!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!_DsbiSlWc!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VFQbiSOpAYqrE{rsAYswE{wxAYx!PE{!P!QAY!Q!]E{!]!^GY!^!aAY!a#sE{#s$fAY$f;'SE{;'S;=`G|<%l?AhE{?Ah?BYAY?BY?MnE{?MnOAY!VGaXiSc!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!VHPP;=`<%lE{!_HVP;=`<%lBw!ZHcW!cxaP!b`Or(trs'ksv(tw!^(t!^!_)e!_;'S(t;'S;=`*P<%lO(t!aIYliSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OKQ!O!P-_!P!Q$q!Q!^-_!^!_*V!_!a&X!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!aK_kiSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx!P-_!P!Q$q!Q!^-_!^!_*V!_!`&X!`!aMS!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!TM_XaP!b`!dp!fQOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X!aNZ!ZiSgQaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OMz!O!PMz!P!Q$q!Q![Mz![!]Mz!]!^-_!^!_*V!_!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f$}-_$}%OMz%O%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz1p4UMz4U4dMz4d4e-_4e$ISMz$IS$I`-_$I`$IbMz$Ib$Je-_$Je$JgMz$Jg$Kh-_$Kh%#tMz%#t&/x-_&/x&EtMz&Et&FV-_&FV;'SMz;'S;:j!#|;:j;=`3X<%l?&r-_?&r?AhMz?Ah?BY$q?BY?MnMz?MnO$q!a!$PP;=`<%lMz!R!$ZY!b`!dpOq*Vqr!$yrs(Vsv*Vwx)ex!a*V!a!b!4t!b;'S*V;'S;=`*s<%lO*V!R!%Q]!b`!dpOr*Vrs(Vsv*Vwx)ex}*V}!O!%y!O!f*V!f!g!']!g#W*V#W#X!0`#X;'S*V;'S;=`*s<%lO*V!R!&QX!b`!dpOr*Vrs(Vsv*Vwx)ex}*V}!O!&m!O;'S*V;'S;=`*s<%lO*V!R!&vV!b`!dp!ePOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!'dX!b`!dpOr*Vrs(Vsv*Vwx)ex!q*V!q!r!(P!r;'S*V;'S;=`*s<%lO*V!R!(WX!b`!dpOr*Vrs(Vsv*Vwx)ex!e*V!e!f!(s!f;'S*V;'S;=`*s<%lO*V!R!(zX!b`!dpOr*Vrs(Vsv*Vwx)ex!v*V!v!w!)g!w;'S*V;'S;=`*s<%lO*V!R!)nX!b`!dpOr*Vrs(Vsv*Vwx)ex!{*V!{!|!*Z!|;'S*V;'S;=`*s<%lO*V!R!*bX!b`!dpOr*Vrs(Vsv*Vwx)ex!r*V!r!s!*}!s;'S*V;'S;=`*s<%lO*V!R!+UX!b`!dpOr*Vrs(Vsv*Vwx)ex!g*V!g!h!+q!h;'S*V;'S;=`*s<%lO*V!R!+xY!b`!dpOr!+qrs!,hsv!+qvw!-Swx!.[x!`!+q!`!a!/j!a;'S!+q;'S;=`!0Y<%lO!+qq!,mV!dpOv!,hvx!-Sx!`!,h!`!a!-q!a;'S!,h;'S;=`!.U<%lO!,hP!-VTO!`!-S!`!a!-f!a;'S!-S;'S;=`!-k<%lO!-SP!-kO|PP!-nP;=`<%l!-Sq!-xS!dp|POv(Vx;'S(V;'S;=`(h<%lO(Vq!.XP;=`<%l!,ha!.aX!b`Or!.[rs!-Ssv!.[vw!-Sw!`!.[!`!a!.|!a;'S!.[;'S;=`!/d<%lO!.[a!/TT!b`|POr)esv)ew;'S)e;'S;=`)y<%lO)ea!/gP;=`<%l!.[!R!/sV!b`!dp|POr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!0]P;=`<%l!+q!R!0gX!b`!dpOr*Vrs(Vsv*Vwx)ex#c*V#c#d!1S#d;'S*V;'S;=`*s<%lO*V!R!1ZX!b`!dpOr*Vrs(Vsv*Vwx)ex#V*V#V#W!1v#W;'S*V;'S;=`*s<%lO*V!R!1}X!b`!dpOr*Vrs(Vsv*Vwx)ex#h*V#h#i!2j#i;'S*V;'S;=`*s<%lO*V!R!2qX!b`!dpOr*Vrs(Vsv*Vwx)ex#m*V#m#n!3^#n;'S*V;'S;=`*s<%lO*V!R!3eX!b`!dpOr*Vrs(Vsv*Vwx)ex#d*V#d#e!4Q#e;'S*V;'S;=`*s<%lO*V!R!4XX!b`!dpOr*Vrs(Vsv*Vwx)ex#X*V#X#Y!+q#Y;'S*V;'S;=`*s<%lO*V!R!4{Y!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!a!4t!a!b!:]!b;'S!4t;'S;=`!;r<%lO!4tq!5pV!dpOv!5kvx!6Vx!a!5k!a!b!7W!b;'S!5k;'S;=`!8V<%lO!5kP!6YTO!a!6V!a!b!6i!b;'S!6V;'S;=`!7Q<%lO!6VP!6lTO!`!6V!`!a!6{!a;'S!6V;'S;=`!7Q<%lO!6VP!7QOyPP!7TP;=`<%l!6Vq!7]V!dpOv!5kvx!6Vx!`!5k!`!a!7r!a;'S!5k;'S;=`!8V<%lO!5kq!7yS!dpyPOv(Vx;'S(V;'S;=`(h<%lO(Vq!8YP;=`<%l!5ka!8bX!b`Or!8]rs!6Vsv!8]vw!6Vw!a!8]!a!b!8}!b;'S!8];'S;=`!:V<%lO!8]a!9SX!b`Or!8]rs!6Vsv!8]vw!6Vw!`!8]!`!a!9o!a;'S!8];'S;=`!:V<%lO!8]a!9vT!b`yPOr)esv)ew;'S)e;'S;=`)y<%lO)ea!:YP;=`<%l!8]!R!:dY!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!`!4t!`!a!;S!a;'S!4t;'S;=`!;r<%lO!4t!R!;]V!b`!dpyPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!{let u=l.type.id;if(u==O1t)return cP(l,c,n);if(u==x1t)return cP(l,c,r);if(u==v1t)return cP(l,c,i);if(u==mOe&&s.length){let d=l.node,f=d.firstChild,h=f&&dK(f,c),m;if(h){for(let g of s)if(g.tag==h&&(!g.attrs||g.attrs(m||(m=OOe(f,c))))){let b=d.lastChild,y=b.type.id==S1t?b.from:d.to;if(y>f.to)return{parser:g.parser,overlay:[{from:f.to,to:y}]}}}}if(a&&u==gOe){let d=l.node,f;if(f=d.firstChild){let h=a[c.read(f.from,f.to)];if(h)for(let m of h){if(m.tagName&&m.tagName!=dK(d.parent,c))continue;let g=d.lastChild;if(g.type.id==E6){let b=g.from+1,y=g.lastChild,O=g.to-(y&&y.isError?0:1);if(O>b)return{parser:m.parser,overlay:[{from:b,to:O}],bracketed:!0}}else if(g.type.id==bOe)return{parser:m.parser,overlay:[{from:g.from,to:g.to}]}}}}return null})}const z1t=145,fK=1,V1t=146,H1t=147,vOe=2,q1t=148,X1t=3,G1t=4,wOe=[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],W1t=58,Y1t=40,SOe=95,Z1t=91,ET=45,K1t=46,J1t=35,eOt=37,tOt=38,nOt=92,rOt=10,iOt=42;function OS(e){return e>=65&&e<=90||e>=97&&e<=122||e>=161}function WQ(e){return e>=48&&e<=57}function hK(e){return WQ(e)||e>=97&&e<=102||e>=65&&e<=70}const EOe=(e,t,n)=>(r,i)=>{for(let s=!1,a=0,l=0;;l++){let{next:c}=r;if(OS(c)||c==ET||c==SOe||s&&WQ(c))!s&&(c!=ET||l>0)&&(s=!0),a===l&&c==ET&&a++,r.advance();else if(c==nOt&&r.peek(1)!=rOt){if(r.advance(),hK(r.next)){do r.advance();while(hK(r.next));r.next==32&&r.advance()}else r.next>-1&&r.advance();s=!0}else{s&&r.acceptToken(a==2&&i.canShift(vOe)?t:c==Y1t?n:e);break}}},sOt=new js(EOe(V1t,vOe,H1t),{contextual:!0}),aOt=new js(EOe(q1t,X1t,G1t),{contextual:!0}),oOt=new js(e=>{if(wOe.includes(e.peek(-1))){let{next:t}=e;(OS(t)||t==SOe||t==J1t||t==K1t||t==iOt||t==Z1t||t==W1t&&OS(e.peek(1))||t==ET||t==tOt)&&e.acceptToken(z1t)}}),lOt=new js(e=>{if(!wOe.includes(e.peek(-1))){let{next:t}=e;if(t==eOt&&(e.advance(),e.acceptToken(fK)),OS(t)){do e.advance();while(OS(e.next)||WQ(e.next));e.acceptToken(fK)}}}),cOt=vh({"AtKeyword import charset namespace keyframes media supports font-feature-values":Z.definitionKeyword,"from to selector scope MatchFlag":Z.keyword,NamespaceName:Z.namespace,KeyframeName:Z.labelName,KeyframeRangeName:Z.operatorKeyword,TagName:Z.tagName,ClassName:Z.className,PseudoClassName:Z.constant(Z.className),IdName:Z.labelName,"FeatureName PropertyName":Z.propertyName,AttributeName:Z.attributeName,NumberLiteral:Z.number,KeywordQuery:Z.keyword,UnaryQueryOp:Z.operatorKeyword,"CallTag ValueName FontName":Z.atom,VariableName:Z.variableName,Callee:Z.operatorKeyword,Unit:Z.unit,"UniversalSelector NestingSelector":Z.definitionOperator,"MatchOp CompareOp":Z.compareOperator,"ChildOp SiblingOp, LogicOp":Z.logicOperator,BinOp:Z.arithmeticOperator,Important:Z.modifier,Comment:Z.blockComment,ColorLiteral:Z.color,"ParenthesizedContent StringLiteral":Z.string,":":Z.punctuation,"PseudoOp #":Z.derefOperator,"; , |":Z.separator,"( )":Z.paren,"[ ]":Z.squareBracket,"{ }":Z.brace}),uOt={__proto__:null,lang:44,"nth-child":44,"nth-last-child":44,"nth-of-type":44,"nth-last-of-type":44,dir:44,"host-context":44,if:90,url:152,"url-prefix":152,domain:152,regexp:152},dOt={__proto__:null,or:104,and:104,not:112,only:112,layer:206},fOt={__proto__:null,selector:118,style:124,layer:202},hOt={__proto__:null,"@import":198,"@media":210,"@charset":214,"@namespace":218,"@keyframes":224,"@supports":236,"@scope":240,"@font-feature-values":246},pOt={__proto__:null,to:243},mOt=ch.deserialize({version:14,states:"MlQYQdOOO#}QdOOP$UO`OOO%OQaO'#CfOOQP'#Ce'#CeO%VQdO'#CgO%[Q`O'#CgO%aQaO'#FnO&XQdO'#CkO&xQaO'#CcO'SQdO'#CnO'_QdO'#EOO'dQdO'#EQO'oQdO'#EXO'oQdO'#E[OOQP'#Fn'#FnO)RQhO'#E}OOQS'#Fm'#FmOOQS'#FQ'#FQQYQdOOO)YQdO'#EbO*iQhO'#EhO)YQdO'#EjO*pQdO'#ElO*{QdO'#EoO)}QhO'#EuO+TQdO'#EwO+`QdO'#EzO+eQaO'#CfO+lQ`O'#E_O+qQ`O'#F{O+|QdO'#F{QOQ`OOP,WO&jO'#CaPOOO)CA])CA]OOQP'#Ci'#CiOOQP,59R,59RO%VQdO,59ROOQP'#Cm'#CmOOQP,59V,59VO&XQdO,59VO,cQdO,59YO'_QdO,5:jO'dQdO,5:lO'oQdO,5:sO'oQdO,5:uO'oQdO,5:vO'oQdO'#FXO,nQ`O,58}O,vQdO'#E^OOQS,58},58}OOQP'#Cq'#CqOOQO'#D|'#D|OOQP,59Y,59YO,}Q`O,59YO-SQ`O,59YOOQP'#EP'#EPOOQP,5:j,5:jO-XQpO'#ERO-dQdO'#ESO-iQ`O'#ESO-nQpO,5:lO.XQaO,5:sO.oQaO,5:vOOQW'#D^'#D^O/nQhO'#DgO0RQhO,5;iO)}QhO'#DeO0`Q`O'#DnO0eQhO'#DxOOQW'#Ft'#FtOOQS,5;i,5;iO0jQ`O'#DhO0oQ`O'#DkOOQS-E9O-E9OOOQ['#Cv'#CvO0tQdO'#CwO1[QdO'#C}O1rQdO'#DQO2YQ!pO'#DSO4fQ!jO,5:|OOQO'#DX'#DXO-SQ`O'#DWO4vQ!nO'#FqO6|Q`O'#DYO7RQ`O'#DyOOQ['#Fq'#FqO7WQhO'#GOO7fQ`O,5;SO7kQ!bO,5;UOOQS'#En'#EnO7sQ`O,5;WO7xQdO,5;WOOQO'#Eq'#EqO8QQ`O,5;ZO8VQhO,5;aO'oQdO'#DjOOQS,5;c,5;cO0jQ`O,5;cO8_QdO,5;cOOQS'#F`'#F`O8gQdO'#E|O7fQ`O,5;fO8oQdO,5:yO9PQdO'#FZO9^Q`O,5lQhO'#DoOOQW,5:Y,5:YOOQW,5:d,5:dOOQW,5:S,5:SO>vQhO,5:VO?bQ!fO'#FrOOQS'#Fr'#FrOOQS'#FS'#FSO@rQdO,59cOOQ[,59c,59cOAYQdO,59iOOQ[,59i,59iOApQdO,59lOOQ[,59l,59lOOQ[,59n,59nO)YQdO,59pOBWQhO'#EdOOQW'#Ed'#EdOBuQ`O1G0hO4oQhO1G0hOOQ[,59r,59rO)}QhO'#D[OOQ[,59t,59tOBzQ#tO,5:eOCVQhO'#F]OCdQ`O,5vQhO'#DmOI_QhO'#DqOIgQhO'#DsOIlQhO'#FwOOQO'#Fw'#FwOItQ!bO'#DwOOQO'#Fy'#FyOOQO'#Fv'#FvOIyQ`O1G/qOOQS-E9Q-E9QOOQ[1G.}1G.}OOQ[1G/T1G/TOOQ[1G/W1G/WOOQ[1G/[1G/[OJOQdO,5;OOOQS7+&S7+&SOJTQ`O7+&SOJYQhO'#D]OJbQ`O,59vO)}QhO,59vOOQ[1G0P1G0POJjQ`O1G0POJoQhO,5;wOOQO-E9Z-E9ZOOQS7+&^7+&^OJ}QbO'#DSOOQO'#Et'#EtOK]Q`O'#EsOOQO'#Es'#EsOKhQ`O'#F^OKpQdO,5;^OOQS,5;^,5;^OOQ[1G/p1G/pOOQS7+&i7+&iO7fQ`O7+&iOK{Q!fO'#FYO)YQdO'#FYOMSQdO7+&POOQO7+&P7+&POOQO,5:{,5:{OOQO1G1a1G1aOMgQ!bO<vQhO'#DrOOQO,5:],5:]O! hQhO,5:_OGUQhO,5:cOOQW7+%]7+%]OOQO'#Ef'#EfO! pQ`O1G0jOOQS<xAN>xO!#zQ`OAN>xO!$PQaO,5;rOOQO-E9U-E9UO!$ZQdO,5;qOOQO-E9T-E9TOOQW<vQhO'#DuOOQO1G/y1G/yO!%vQ!bO1G/}OJOQdO'#F[O!&OQ`O7+&UOOQW7+&U7+&UO!&WQ!bO1G/cOOQ[7+$|7+$|O!&cQhO7+$|P!&jQ`O'#FTOOQO,5;y,5;yOOQO-E9]-E9]OOQS1G1d1G1dOOQPG24dG24dO!&oQ`OAN>ZO)YQdO1G1[O!&tQ`O7+'jOOQO1G/x1G/xO!&|Q`O,5:aO!$eQhO7+%iOOQO,5;v,5;vOOQO-E9Y-E9YOOQW<Q!]!^>|!^!_?_!_!`@Z!`!a@n!a!b%Z!b!cAo!c!k%Z!k!lC|!l!u%Z!u!vC|!v!}%Z!}#OD_#O#P%Z#P#QDp#Q#R2X#R#]%Z#]#^ER#^#g%Z#g#hC|#h#o%Z#o#pIf#p#qIw#q#rJ`#r#sJq#s#y%Z#y#z&R#z$f%Z$f$g&R$g#BY%Z#BY#BZ&R#BZ$IS%Z$IS$I_&R$I_$I|%Z$I|$JO&R$JO$JT%Z$JT$JU&R$JU$KV%Z$KV$KW&R$KW&FU%Z&FU&FV&R&FV;'S%Z;'S;=`KY<%lO%Z`%^SOy%jz;'S%j;'S;=`%{<%lO%j`%oS!o`Oy%jz;'S%j;'S;=`%{<%lO%j`&OP;=`<%l%j~&Wh$[~OX%jX^'r^p%jpq'rqy%jz#y%j#y#z'r#z$f%j$f$g'r$g#BY%j#BY#BZ'r#BZ$IS%j$IS$I_'r$I_$I|%j$I|$JO'r$JO$JT%j$JT$JU'r$JU$KV%j$KV$KW'r$KW&FU%j&FU&FV'r&FV;'S%j;'S;=`%{<%lO%j~'yh$[~!o`OX%jX^'r^p%jpq'rqy%jz#y%j#y#z'r#z$f%j$f$g'r$g#BY%j#BY#BZ'r#BZ$IS%j$IS$I_'r$I_$I|%j$I|$JO'r$JO$JT%j$JT$JU'r$JU$KV%j$KV$KW'r$KW&FU%j&FU&FV'r&FV;'S%j;'S;=`%{<%lO%jj)jS$qYOy%jz;'S%j;'S;=`%{<%lO%j~)yWOY)vZr)vrs*cs#O)v#O#P*h#P;'S)v;'S;=`+d<%lO)v~*hOw~~*kRO;'S)v;'S;=`*t;=`O)v~*wXOY)vZr)vrs*cs#O)v#O#P*h#P;'S)v;'S;=`+d;=`<%l)v<%lO)v~+gP;=`<%l)vj+oYmYOy%jz!Q%j!Q![,_![!c%j!c!i,_!i#T%j#T#Z,_#Z;'S%j;'S;=`%{<%lO%jj,dY!o`Oy%jz!Q%j!Q![-S![!c%j!c!i-S!i#T%j#T#Z-S#Z;'S%j;'S;=`%{<%lO%jj-XY!o`Oy%jz!Q%j!Q![-w![!c%j!c!i-w!i#T%j#T#Z-w#Z;'S%j;'S;=`%{<%lO%jj.OYuY!o`Oy%jz!Q%j!Q![.n![!c%j!c!i.n!i#T%j#T#Z.n#Z;'S%j;'S;=`%{<%lO%jj.uYuY!o`Oy%jz!Q%j!Q![/e![!c%j!c!i/e!i#T%j#T#Z/e#Z;'S%j;'S;=`%{<%lO%jj/jY!o`Oy%jz!Q%j!Q![0Y![!c%j!c!i0Y!i#T%j#T#Z0Y#Z;'S%j;'S;=`%{<%lO%jj0aYuY!o`Oy%jz!Q%j!Q![1P![!c%j!c!i1P!i#T%j#T#Z1P#Z;'S%j;'S;=`%{<%lO%jj1UY!o`Oy%jz!Q%j!Q![1t![!c%j!c!i1t!i#T%j#T#Z1t#Z;'S%j;'S;=`%{<%lO%jj1{SuY!o`Oy%jz;'S%j;'S;=`%{<%lO%jd2[UOy%jz!_%j!_!`2n!`;'S%j;'S;=`%{<%lO%jd2uS!yS!o`Oy%jz;'S%j;'S;=`%{<%lO%jb3WS^QOy%jz;'S%j;'S;=`%{<%lO%j~3gWOY3dZw3dwx*cx#O3d#O#P4P#P;'S3d;'S;=`4{<%lO3d~4SRO;'S3d;'S;=`4];=`O3d~4`XOY3dZw3dwx*cx#O3d#O#P4P#P;'S3d;'S;=`4{;=`<%l3d<%lO3d~5OP;=`<%l3dj5WShYOy%jz;'S%j;'S;=`%{<%lO%j~5iOg~n5pUWQyWOy%jz!_%j!_!`2n!`;'S%j;'S;=`%{<%lO%jj6ZWyW#PQOy%jz!O%j!O!P6s!P!Q%j!Q![9x![;'S%j;'S;=`%{<%lO%jj6xU!o`Oy%jz!Q%j!Q![7[![;'S%j;'S;=`%{<%lO%jj7cY!o`$gYOy%jz!Q%j!Q![7[![!g%j!g!h8R!h#X%j#X#Y8R#Y;'S%j;'S;=`%{<%lO%jj8WY!o`Oy%jz{%j{|8v|}%j}!O8v!O!Q%j!Q![9_![;'S%j;'S;=`%{<%lO%jj8{U!o`Oy%jz!Q%j!Q![9_![;'S%j;'S;=`%{<%lO%jj9fU!o`$gYOy%jz!Q%j!Q![9_![;'S%j;'S;=`%{<%lO%jj:P[!o`$gYOy%jz!O%j!O!P7[!P!Q%j!Q![9x![!g%j!g!h8R!h#X%j#X#Y8R#Y;'S%j;'S;=`%{<%lO%jj:zS!dYOy%jz;'S%j;'S;=`%{<%lO%jj;]WyWOy%jz!O%j!O!P6s!P!Q%j!Q![9x![;'S%j;'S;=`%{<%lO%jj;zU`YOy%jz!Q%j!Q![7[![;'S%j;'S;=`%{<%lO%j~VUcYOy%jz![%j![!]>i!];'S%j;'S;=`%{<%lO%jj>pSdY!o`Oy%jz;'S%j;'S;=`%{<%lO%jj?RSnYOy%jz;'S%j;'S;=`%{<%lO%jh?dU!WWOy%jz!_%j!_!`?v!`;'S%j;'S;=`%{<%lO%jh?}S!WW!o`Oy%jz;'S%j;'S;=`%{<%lO%jl@bS!WW!ySOy%jz;'S%j;'S;=`%{<%lO%jj@uV!|Q!WWOy%jz!_%j!_!`?v!`!aA[!a;'S%j;'S;=`%{<%lO%jbAcS!|Q!o`Oy%jz;'S%j;'S;=`%{<%lO%jjArYOy%jz}%j}!OBb!O!c%j!c!}CP!}#T%j#T#oCP#o;'S%j;'S;=`%{<%lO%jjBgW!o`Oy%jz!c%j!c!}CP!}#T%j#T#oCP#o;'S%j;'S;=`%{<%lO%jjCW[lY!o`Oy%jz}%j}!OCP!O!Q%j!Q![CP![!c%j!c!}CP!}#T%j#T#oCP#o;'S%j;'S;=`%{<%lO%jhDRS!zWOy%jz;'S%j;'S;=`%{<%lO%jjDdSpYOy%jz;'S%j;'S;=`%{<%lO%jnDuSo^Oy%jz;'S%j;'S;=`%{<%lO%jjEWU!zWOy%jz#a%j#a#bEj#b;'S%j;'S;=`%{<%lO%jbEoU!o`Oy%jz#d%j#d#eFR#e;'S%j;'S;=`%{<%lO%jbFWU!o`Oy%jz#c%j#c#dFj#d;'S%j;'S;=`%{<%lO%jbFoU!o`Oy%jz#f%j#f#gGR#g;'S%j;'S;=`%{<%lO%jbGWU!o`Oy%jz#h%j#h#iGj#i;'S%j;'S;=`%{<%lO%jbGoU!o`Oy%jz#T%j#T#UHR#U;'S%j;'S;=`%{<%lO%jbHWU!o`Oy%jz#b%j#b#cHj#c;'S%j;'S;=`%{<%lO%jbHoU!o`Oy%jz#h%j#h#iIR#i;'S%j;'S;=`%{<%lO%jbIYS$pQ!o`Oy%jz;'S%j;'S;=`%{<%lO%jjIkSsYOy%jz;'S%j;'S;=`%{<%lO%jfI|U$cUOy%jz!_%j!_!`2n!`;'S%j;'S;=`%{<%lO%jjJeSrYOy%jz;'S%j;'S;=`%{<%lO%jfJvU#PQOy%jz!_%j!_!`2n!`;'S%j;'S;=`%{<%lO%j`K]P;=`<%l%Z",tokenizers:[oOt,lOt,sOt,aOt,1,2,3,4,new AA("m~RRYZ[z{a~~g~aO$_~~dP!P!Qg~lO$`~~",28,152)],topRules:{StyleSheet:[0,6],Styles:[1,126]},dynamicPrecedences:{94:1},specialized:[{term:147,get:e=>uOt[e]||-1},{term:148,get:e=>dOt[e]||-1},{term:4,get:e=>fOt[e]||-1},{term:28,get:e=>hOt[e]||-1},{term:146,get:e=>pOt[e]||-1}],tokenPrec:2405});let uP=null;function dP(){if(!uP&&typeof document=="object"&&document.body){let{style:e}=document.body,t=[],n=new Set;for(let r in e)r!="cssText"&&r!="cssFloat"&&typeof e[r]=="string"&&(/[A-Z]/.test(r)&&(r=r.replace(/[A-Z]/g,i=>"-"+i.toLowerCase())),n.has(r)||(t.push(r),n.add(r)));uP=t.sort().map(r=>({type:"property",label:r,apply:r+": "}))}return uP||[]}const pK=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(e=>({type:"class",label:e})),mK=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(e=>({type:"keyword",label:e})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(e=>({type:"constant",label:e}))),gOt=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(e=>({type:"type",label:e})),bOt=["@charset","@color-profile","@container","@counter-style","@font-face","@font-feature-values","@font-palette-values","@import","@keyframes","@layer","@media","@namespace","@page","@position-try","@property","@scope","@starting-style","@supports","@view-transition"].map(e=>({type:"keyword",label:e})),Yd=/^(\w[\w-]*|-\w[\w-]*|)$/,yOt=/^-(-[\w-]*)?$/;function OOt(e,t){var n;if((e.name=="("||e.type.isError)&&(e=e.parent||e),e.name!="ArgList")return!1;let r=(n=e.parent)===null||n===void 0?void 0:n.firstChild;return(r==null?void 0:r.name)!="Callee"?!1:t.sliceString(r.from,r.to)=="var"}const gK=new aQ,xOt=["Declaration"];function vOt(e){for(let t=e;;){if(t.type.isTop)return t;if(!(t=t.parent))return e}}function kOe(e,t,n){if(t.to-t.from>4096){let r=gK.get(t);if(r)return r;let i=[],s=new Set,a=t.cursor(Ur.IncludeAnonymous);if(a.firstChild())do for(let l of kOe(e,a.node,n))s.has(l.label)||(s.add(l.label),i.push(l));while(a.nextSibling());return gK.set(t,i),i}else{let r=[],i=new Set;return t.cursor().iterate(s=>{var a;if(n(s)&&s.matchContext(xOt)&&((a=s.node.nextSibling)===null||a===void 0?void 0:a.name)==":"){let l=e.sliceString(s.from,s.to);i.has(l)||(i.add(l),r.push({label:l,type:"variable"}))}}),r}}const wOt=e=>t=>{let{state:n,pos:r}=t,i=yi(n).resolveInner(r,-1),s=i.type.isError&&i.from==i.to-1&&n.doc.sliceString(i.from,i.to)=="-";if(i.name=="PropertyName"||(s||i.name=="TagName")&&/^(Block|Styles)$/.test(i.resolve(i.to).name))return{from:i.from,options:dP(),validFor:Yd};if(i.name=="ValueName")return{from:i.from,options:mK,validFor:Yd};if(i.name=="PseudoClassName")return{from:i.from,options:pK,validFor:Yd};if(e(i)||(t.explicit||s)&&OOt(i,n.doc))return{from:e(i)||s?i.from:r,options:kOe(n.doc,vOt(i),e),validFor:yOt};if(i.name=="TagName"){for(let{parent:c}=i;c;c=c.parent)if(c.name=="Block")return{from:i.from,options:dP(),validFor:Yd};return{from:i.from,options:gOt,validFor:Yd}}if(i.name=="AtKeyword")return{from:i.from,options:bOt,validFor:Yd};if(!t.explicit)return null;let a=i.resolve(r),l=a.childBefore(r);return l&&l.name==":"&&a.name=="PseudoClassSelector"?{from:r,options:pK,validFor:Yd}:l&&l.name==":"&&a.name=="Declaration"||a.name=="ArgList"?{from:r,options:mK,validFor:Yd}:a.name=="Block"||a.name=="Styles"?{from:r,options:dP(),validFor:Yd}:null},SOt=wOt(e=>e.name=="VariableName"),PA=lh.define({name:"css",parser:mOt.configure({props:[wh.add({Declaration:Ay()}),Sh.add({"Block KeyframeList":UE})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function EOt(){return new rm(PA,PA.data.of({autocomplete:SOt}))}const Ox=["_blank","_self","_top","_parent"],fP=["ascii","utf-8","utf-16","latin1","latin1"],hP=["get","post","put","delete"],pP=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],hl=["true","false"],nn={},kOt={a:{attrs:{href:null,ping:null,type:null,media:null,target:Ox,hreflang:null}},abbr:nn,address:nn,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:nn,aside:nn,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:nn,base:{attrs:{href:null,target:Ox}},bdi:nn,bdo:nn,blockquote:{attrs:{cite:null}},body:nn,br:nn,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:pP,formmethod:hP,formnovalidate:["novalidate"],formtarget:Ox,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:nn,center:nn,cite:nn,code:nn,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:nn,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:nn,div:nn,dl:nn,dt:nn,em:nn,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:nn,figure:nn,footer:nn,form:{attrs:{action:null,name:null,"accept-charset":fP,autocomplete:["on","off"],enctype:pP,method:hP,novalidate:["novalidate"],target:Ox}},h1:nn,h2:nn,h3:nn,h4:nn,h5:nn,h6:nn,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:nn,hgroup:nn,hr:nn,html:{attrs:{manifest:null}},i:nn,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:pP,formmethod:hP,formnovalidate:["novalidate"],formtarget:Ox,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:nn,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:nn,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:nn,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:fP,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:nn,noscript:nn,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:nn,param:{attrs:{name:null,value:null}},pre:nn,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:nn,rt:nn,ruby:nn,samp:nn,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:fP}},section:nn,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:nn,source:{attrs:{src:null,type:null,media:null}},span:nn,strong:nn,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:nn,summary:nn,sup:nn,table:nn,tbody:nn,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:nn,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:nn,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:nn,time:{attrs:{datetime:null}},title:nn,tr:nn,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:nn,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:nn},_Oe={accesskey:null,class:null,contenteditable:hl,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:hl,autocorrect:hl,autocapitalize:hl,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":hl,"aria-autocomplete":["inline","list","both","none"],"aria-busy":hl,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":hl,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":hl,"aria-hidden":hl,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":hl,"aria-multiselectable":hl,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":hl,"aria-relevant":null,"aria-required":hl,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},TOe="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(e=>"on"+e);for(let e of TOe)_Oe[e]=null;class xS{constructor(t,n){this.tags={...kOt,...t},this.globalAttrs={..._Oe,...n},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}xS.default=new xS;function k1(e,t,n=e.length){if(!t)return"";let r=t.firstChild,i=r&&r.getChild("TagName");return i?e.sliceString(i.from,Math.min(i.to,n)):""}function _1(e,t=!1){for(;e;e=e.parent)if(e.name=="Element")if(t)t=!1;else return e;return null}function COe(e,t,n){let r=n.tags[k1(e,_1(t))];return(r==null?void 0:r.children)||n.allTags}function YQ(e,t){let n=[];for(let r=_1(t);r&&!r.type.isTop;r=_1(r.parent)){let i=k1(e,r);if(i&&r.lastChild.name=="CloseTag")break;i&&n.indexOf(i)<0&&(t.name=="EndTag"||t.from>=r.firstChild.to)&&n.push(i)}return n}const AOe=/^[:\-\.\w\u00b7-\uffff]*$/;function bK(e,t,n,r,i){let s=/\s*>/.test(e.sliceDoc(i,i+5))?"":">",a=_1(n,n.name=="StartTag"||n.name=="TagName");return{from:r,to:i,options:COe(e.doc,a,t).map(l=>({label:l,type:"type"})).concat(YQ(e.doc,n).map((l,c)=>({label:"/"+l,apply:"/"+l+s,type:"type",boost:99-c}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function yK(e,t,n,r){let i=/\s*>/.test(e.sliceDoc(r,r+5))?"":">";return{from:n,to:r,options:YQ(e.doc,t).map((s,a)=>({label:s,apply:s+i,type:"type",boost:99-a})),validFor:AOe}}function _Ot(e,t,n,r){let i=[],s=0;for(let a of COe(e.doc,n,t))i.push({label:"<"+a,type:"type"});for(let a of YQ(e.doc,n))i.push({label:"",type:"type",boost:99-s++});return{from:r,to:r,options:i,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function TOt(e,t,n,r,i){let s=_1(n),a=s?t.tags[k1(e.doc,s)]:null,l=a&&a.attrs?Object.keys(a.attrs):[],c=a&&a.globalAttrs===!1?l:l.length?l.concat(t.globalAttrNames):t.globalAttrNames;return{from:r,to:i,options:c.map(u=>({label:u,type:"property"})),validFor:AOe}}function COt(e,t,n,r,i){var s;let a=(s=n.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),l=[],c;if(a){let u=e.sliceDoc(a.from,a.to),d=t.globalAttrs[u];if(!d){let f=_1(n),h=f?t.tags[k1(e.doc,f)]:null;d=(h==null?void 0:h.attrs)&&h.attrs[u]}if(d){let f=e.sliceDoc(r,i).toLowerCase(),h='"',m='"';/^['"]/.test(f)?(c=f[0]=='"'?/^[^"]*$/:/^[^']*$/,h="",m=e.sliceDoc(i,i+1)==f[0]?"":f[0],f=f.slice(1),r++):c=/^[^\s<>='"]*$/;for(let g of d)l.push({label:g,apply:h+g+m,type:"constant"})}}return{from:r,to:i,options:l,validFor:c}}function NOe(e,t){let{state:n,pos:r}=t,i=yi(n).resolveInner(r,-1),s=i.resolve(r);for(let a=r,l;s==i&&(l=i.childBefore(a));){let c=l.lastChild;if(!c||!c.type.isError||c.fromNOe(r,i)}const jOt=md.parser.configure({top:"SingleExpression"}),jOe=[{tag:"script",attrs:e=>e.type=="text/typescript"||e.lang=="ts",parser:$1e.parser},{tag:"script",attrs:e=>e.type=="text/babel"||e.type=="text/jsx",parser:B1e.parser},{tag:"script",attrs:e=>e.type=="text/typescript-jsx",parser:Q1e.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:jOt},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:md.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:PA.parser}],ROe=[{name:"style",parser:PA.parser.configure({top:"Styles"})}].concat(TOe.map(e=>({name:e,parser:md.parser}))),IOe=lh.define({name:"html",parser:F1t.configure({props:[wh.add({Element(e){let t=/^(\s*)(<\/)?/.exec(e.textAfter);return e.node.to<=e.pos+t[0].length?e.continue():e.lineIndent(e.node.from)+(t[2]?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit},Document(e){if(e.pos+/\s*/.exec(e.textAfter)[0].lengthe.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),kT=IOe.configure({wrap:xOe(jOe,ROe)});function ROt(e={}){let t="",n;e.matchClosingTags===!1&&(t="noMatch"),e.selfClosingTags===!0&&(t=(t?t+" ":"")+"selfClosing"),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(n=xOe((e.nestedLanguages||[]).concat(jOe),(e.nestedAttributes||[]).concat(ROe)));let r=n?IOe.configure({wrap:n,dialect:t}):t?kT.configure({dialect:t}):kT;return new rm(r,[kT.data.of({autocomplete:NOt(e)}),e.autoCloseTags!==!1?IOt:[],O6().support,EOt().support])}const OK=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),IOt=Ct.inputHandler.of((e,t,n,r,i)=>{if(e.composing||e.state.readOnly||t!=n||r!=">"&&r!="/"||!kT.isActiveAt(e.state,t,-1))return!1;let s=i(),{state:a}=s,l=a.changeByRange(c=>{var u,d,f;let h=a.doc.sliceString(c.from-1,c.to)==r,{head:m}=c,g=yi(a).resolveInner(m,-1),b;if(h&&r==">"&&g.name=="EndTag"){let y=g.parent;if(((d=(u=y.parent)===null||u===void 0?void 0:u.lastChild)===null||d===void 0?void 0:d.name)!="CloseTag"&&(b=k1(a.doc,y.parent,m))&&!OK.has(b)){let O=m+(a.doc.sliceString(m,m+1)===">"?1:0),v=``;return{range:c,changes:{from:m,to:O,insert:v}}}}else if(h&&r=="/"&&g.name=="IncompleteCloseTag"){let y=g.parent;if(g.from==m-2&&((f=y.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(b=k1(a.doc,y,m))&&!OK.has(b)){let O=m+(a.doc.sliceString(m,m+1)===">"?1:0),v=`${b}>`;return{range:tt.cursor(m+v.length,-1),changes:{from:m,to:O,insert:v}}}}return{range:c}});return l.changes.empty?!1:(e.dispatch([s,a.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),DOe=iR({commentTokens:{block:{open:""}}}),POe=new An,MOe=Vyt.configure({props:[Sh.add(e=>!e.is("Block")||e.is("Document")||_6(e)!=null||DOt(e)?void 0:(t,n)=>({from:n.doc.lineAt(t.from).to,to:t.to})),POe.add(_6),wh.add({Document:()=>null}),bp.add({Document:DOe})]});function _6(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function DOt(e){return e.name=="OrderedList"||e.name=="BulletList"}function POt(e,t){let n=e;for(;;){let r=n.nextSibling,i;if(!r||(i=_6(r.type))!=null&&i<=t)break;n=r}return n.to}const MOt=t1e.of((e,t,n)=>{for(let r=yi(e).resolveInner(n,-1);r&&!(r.fromn)return{from:n,to:s}}return null});function ZQ(e){return new Al(DOe,e,[],"markdown")}const LOt=ZQ(MOe),$Ot=MOe.configure([t1t,r1t,n1t,i1t,{props:[Sh.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]),MA=ZQ($Ot);function BOt(e,t){return n=>{if(n&&e){let r=null;if(n=/\S*/.exec(n)[0],typeof e=="function"?r=e(n):r=EA.matchLanguageName(e,n,!0),r instanceof EA)return r.support?r.support.language.parser:Zg.getSkippingParser(r.load());if(r)return r.parser}return t?t.parser:null}}let mP=class{constructor(t,n,r,i,s,a,l){this.node=t,this.from=n,this.to=r,this.spaceBefore=i,this.spaceAfter=s,this.type=a,this.item=l}blank(t,n=!0){let r=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(t!=null){for(;r.length0;i--)r+=" ";return r+(n?this.spaceAfter:"")}}marker(t,n){let r=this.node.name=="OrderedList"?String(+$Oe(this.item,t)[2]+n):"";return this.spaceBefore+r+this.type+this.spaceAfter}};function LOe(e,t){let n=[],r=[];for(let i=e;i;i=i.parent){if(i.name=="FencedCode")return r;(i.name=="ListItem"||i.name=="Blockquote")&&n.push(i)}for(let i=n.length-1;i>=0;i--){let s=n[i],a,l=t.lineAt(s.from),c=s.from-l.from;if(s.name=="Blockquote"&&(a=/^ *>( ?)/.exec(l.text.slice(c))))r.push(new mP(s,c,c+a[0].length,"",a[1],">",null));else if(s.name=="ListItem"&&s.parent.name=="OrderedList"&&(a=/^( *)\d+([.)])( *)/.exec(l.text.slice(c)))){let u=a[3],d=a[0].length;u.length>=4&&(u=u.slice(0,u.length-4),d-=4),r.push(new mP(s.parent,c,c+d,a[1],u,a[2],s))}else if(s.name=="ListItem"&&s.parent.name=="BulletList"&&(a=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(l.text.slice(c)))){let u=a[4],d=a[0].length;u.length>4&&(u=u.slice(0,u.length-4),d-=4);let f=a[2];a[3]&&(f+=a[3].replace(/[xX]/," ")),r.push(new mP(s.parent,c,c+d,a[1],u,f,s))}}return r}function $Oe(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function gP(e,t,n,r=0){for(let i=-1,s=e;;){if(s.name=="ListItem"){let l=$Oe(s,t),c=+l[2];if(i>=0){if(c!=i+1)return;n.push({from:s.from+l[1].length,to:s.from+l[0].length,insert:String(i+2+r)})}i=c}let a=s.nextSibling;if(!a)break;s=a}}function KQ(e,t){let n=/^[ \t]*/.exec(e)[0].length;if(!n||t.facet(OO)!=" ")return e;let r=Su(e,4,n),i="";for(let s=r;s>0;)s>=4?(i+=" ",s-=4):(i+=" ",s--);return i+e.slice(n)}const QOt=(e={})=>({state:t,dispatch:n})=>{let r=yi(t),{doc:i}=t,s=null,a=t.changeByRange(l=>{if(!l.empty||!MA.isActiveAt(t,l.from,-1)&&!MA.isActiveAt(t,l.from,1))return s={range:l};let c=l.from,u=i.lineAt(c),d=LOe(r.resolveInner(c,-1),i);for(;d.length&&d[d.length-1].from>c-u.from;)d.pop();if(!d.length)return s={range:l};let f=d[d.length-1];if(f.to-f.spaceAfter.length>c-u.from)return s={range:l};let h=c>=f.to-f.spaceAfter.length&&!/\S/.test(u.text.slice(f.to));if(f.item&&h){let O=f.node.firstChild,v=f.node.getChild("ListItem","ListItem");if(O.to>=c||v&&v.to0&&!/[^\s>]/.test(i.lineAt(u.from-1).text)||e.nonTightLists===!1){let x=d.length>1?d[d.length-2]:null,w,S="";x&&x.item?(w=u.from+x.from,S=x.marker(i,1)):w=u.from+(x?x.to:0);let E=[{from:w,to:c,insert:S}];return f.node.name=="OrderedList"&&gP(f.item,i,E,-2),x&&x.node.name=="OrderedList"&&gP(x.item,i,E),{range:tt.cursor(w+S.length),changes:E}}else{let x=vK(d,t,u);return{range:tt.cursor(c+x.length+1),changes:{from:u.from,insert:x+t.lineBreak}}}}if(f.node.name=="Blockquote"&&h&&u.from){let O=i.lineAt(u.from-1),v=/>\s*$/.exec(O.text);if(v&&v.index==f.from){let x=t.changes([{from:O.from+v.index,to:O.to},{from:u.from+f.from,to:u.to}]);return{range:l.map(x),changes:x}}}let m=[];f.node.name=="OrderedList"&&gP(f.item,i,m);let g=f.item&&f.item.from]*/.exec(u.text)[0].length>=f.to)for(let O=0,v=d.length-1;O<=v;O++)b+=O==v&&!g?d[O].marker(i,1):d[O].blank(Ou.from&&/\s/.test(u.text.charAt(y-u.from-1));)y--;return b=KQ(b,t),FOt(f.node,t.doc)&&(b=vK(d,t,u)+t.lineBreak+b),m.push({from:y,to:c,insert:t.lineBreak+b}),{range:tt.cursor(y+b.length+1),changes:m}});return s?!1:(n(t.update(a,{scrollIntoView:!0,userEvent:"input"})),!0)},UOt=QOt();function xK(e){return e.name=="QuoteMark"||e.name=="ListMark"}function FOt(e,t){if(e.name!="OrderedList"&&e.name!="BulletList")return!1;let n=e.firstChild,r=e.getChild("ListItem","ListItem");if(!r)return!1;let i=t.lineAt(n.to),s=t.lineAt(r.from),a=/^[\s>]*$/.test(i.text);return i.number+(a?0:1){let n=yi(e),r=null,i=e.changeByRange(s=>{let a=s.from,{doc:l}=e;if(s.empty&&MA.isActiveAt(e,s.from)){let c=l.lineAt(a),u=LOe(zOt(n,a),l);if(u.length){let d=u[u.length-1],f=d.to-d.spaceAfter.length+(d.spaceAfter?1:0);if(a-c.from>f&&!/\S/.test(c.text.slice(f,a-c.from)))return{range:tt.cursor(c.from+f),changes:{from:c.from+f,to:a}};if(a-c.from==f&&(d.item&&c.from<=d.item.from||/^[\s>]*$/.test(c.text.slice(0,d.to)))){let h=c.from+d.from;if(d.item&&d.node.from{var n;let{main:r}=t.state.selection;if(r.empty)return!1;let i=(n=e.clipboardData)===null||n===void 0?void 0:n.getData("text/plain");if(!i||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(i)||(/^www\./.test(i)&&(i="https://"+i),!MA.isActiveAt(t.state,r.from,1)))return!1;let s=yi(t.state),a=!1;return s.iterate({from:r.from,to:r.to,enter:l=>{(l.from>r.from||WOt.test(l.name))&&(a=!0)},leave:l=>{l.to=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}const Yxt=new js((e,t)=>{let n;if(e.next<0)e.acceptToken(ext);else if(t.context.flags&_T)yP(e.next)&&e.acceptToken(JOt,1);else if(((n=e.peek(-1))<0||yP(n))&&t.canShift(wK)){let r=0;for(;e.next==JQ||e.next==uR;)e.advance(),r++;(e.next==e0||e.next==vS||e.next==eU)&&e.acceptToken(wK,-r)}else yP(e.next)&&e.acceptToken(KOt,1)},{contextual:!0}),Zxt=new js((e,t)=>{let n=t.context;if(n.flags)return;let r=e.peek(-1);if(r==e0||r==vS){let i=0,s=0;for(;;){if(e.next==JQ)i++;else if(e.next==uR)i+=8-i%8;else break;e.advance(),s++}i!=n.indent&&e.next!=e0&&e.next!=vS&&e.next!=eU&&(i[e,t|qOe])),evt=new oR({start:Kxt,reduce(e,t,n,r){return e.flags&_T&&Wxt.has(t)||(t==bxt||t==zOe)&&e.flags&qOe?e.parent:e},shift(e,t,n,r){return t==QOe?new TT(e,Jxt(r.read(r.pos,n.pos)),0):t==UOe?e.parent:t==rxt||t==oxt||t==uxt||t==FOe?new TT(e,0,_T):_K.has(t)?new TT(e,0,_K.get(t)|e.flags&_T):e},hash(e){return e.hash}}),tvt=new js(e=>{for(let t=0;t<5;t++){if(e.next!="print".charCodeAt(t))return;e.advance()}if(!/\w/.test(String.fromCharCode(e.next)))for(let t=0;;t++){let n=e.peek(t);if(!(n==JQ||n==uR)){n!=Fxt&&n!=zxt&&n!=e0&&n!=vS&&n!=eU&&e.acceptToken(ZOt);return}}}),nvt=new js((e,t)=>{let{flags:n}=t.context,r=n&rf?HOe:VOe,i=(n&sf)>0,s=!(n&af),a=(n&of)>0,l=e.pos;for(;!(e.next<0);)if(a&&e.next==T6)if(e.peek(1)==T6)e.advance(2);else{if(e.pos==l){e.acceptToken(FOe,1);return}break}else if(s&&e.next==kK){if(e.pos==l){e.advance();let c=e.next;c>=0&&(e.advance(),rvt(e,c)),e.acceptToken(nxt);return}break}else if(e.next==kK&&!s&&e.peek(1)>-1)e.advance(2);else if(e.next==r&&(!i||e.peek(1)==r&&e.peek(2)==r)){if(e.pos==l){e.acceptToken(SK,i?3:1);return}break}else if(e.next==e0){if(i)e.advance();else if(e.pos==l){e.acceptToken(SK);return}break}else e.advance();e.pos>l&&e.acceptToken(txt)});function rvt(e,t){if(t==Vxt)for(let n=0;n<2&&e.next>=48&&e.next<=55;n++)e.advance();else if(t==Hxt)for(let n=0;n<2&&OP(e.next);n++)e.advance();else if(t==Xxt)for(let n=0;n<4&&OP(e.next);n++)e.advance();else if(t==Gxt)for(let n=0;n<8&&OP(e.next);n++)e.advance();else if(t==qxt&&e.next==T6){for(e.advance();e.next>=0&&e.next!=EK&&e.next!=VOe&&e.next!=HOe&&e.next!=e0;)e.advance();e.next==EK&&e.advance()}}const ivt=vh({'async "*" "**" FormatConversion FormatSpec':Z.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":Z.controlKeyword,"in not and or is del":Z.operatorKeyword,"from def class global nonlocal lambda":Z.definitionKeyword,import:Z.moduleKeyword,"with as print":Z.keyword,Boolean:Z.bool,None:Z.null,VariableName:Z.variableName,"CallExpression/VariableName":Z.function(Z.variableName),"FunctionDefinition/VariableName":Z.function(Z.definition(Z.variableName)),"ClassDefinition/VariableName":Z.definition(Z.className),PropertyName:Z.propertyName,"CallExpression/MemberExpression/PropertyName":Z.function(Z.propertyName),Comment:Z.lineComment,Number:Z.number,String:Z.string,FormatString:Z.special(Z.string),Escape:Z.escape,UpdateOp:Z.updateOperator,"ArithOp!":Z.arithmeticOperator,BitOp:Z.bitwiseOperator,CompareOp:Z.compareOperator,AssignOp:Z.definitionOperator,Ellipsis:Z.punctuation,At:Z.meta,"( )":Z.paren,"[ ]":Z.squareBracket,"{ }":Z.brace,".":Z.derefOperator,", ;":Z.separator}),svt={__proto__:null,await:44,or:54,and:56,in:60,not:62,is:64,if:70,else:72,lambda:76,yield:94,from:96,async:102,for:104,None:162,True:164,False:164,del:178,pass:182,break:186,continue:190,return:194,raise:202,import:206,as:208,global:212,nonlocal:214,assert:218,type:223,elif:236,while:240,try:246,except:248,finally:250,with:254,def:258,class:268,match:279,case:285},avt=ch.deserialize({version:14,states:"##jQ`QeOOP$}OSOOO&WQtO'#HUOOQS'#Co'#CoOOQS'#Cp'#CpO'vQdO'#CnO*UQtO'#HTOOQS'#HU'#HUOOQS'#DU'#DUOOQS'#HT'#HTO*rQdO'#D_O+VQdO'#DfO+gQdO'#DjO+zOWO'#DuO,VOWO'#DvO.[QtO'#GuOOQS'#Gu'#GuO'vQdO'#GtO0ZQtO'#GtOOQS'#Eb'#EbO0rQdO'#EcOOQS'#Gs'#GsO0|QdO'#GrOOQV'#Gr'#GrO1XQdO'#FYOOQS'#G^'#G^O1^QdO'#FXOOQV'#IS'#ISOOQV'#Gq'#GqOOQV'#Fq'#FqQ`QeOOO'vQdO'#CqO1lQdO'#C}O1sQdO'#DRO2RQdO'#HYO2cQtO'#EVO'vQdO'#EWOOQS'#EY'#EYOOQS'#E['#E[OOQS'#E^'#E^O2wQdO'#E`O3_QdO'#EdO3rQdO'#EfO3zQtO'#EfO1XQdO'#EiO0rQdO'#ElO1XQdO'#EnO0rQdO'#EtO0rQdO'#EwO4VQdO'#EyO4^QdO'#FOO4iQdO'#EzO0rQdO'#FOO1XQdO'#FQO1XQdO'#FVO4nQdO'#F[P4uOdO'#GpPOOO)CBd)CBdOOQS'#Ce'#CeOOQS'#Cf'#CfOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Cl'#ClO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO5TQdO'#DoOOQS,5:Y,5:YO5hQdO'#HdOOQS,5:],5:]O5uQ!fO,5:]O5zQtO,59YO1lQdO,59bO1lQdO,59bO1lQdO,59bO8jQdO,59bO8oQdO,59bO8vQdO,59jO8}QdO'#HTO:TQdO'#HSOOQS'#HS'#HSOOQS'#D['#D[O:lQdO,59aO'vQdO,59aO:zQdO,59aOOQS,59y,59yO;PQdO,5:RO'vQdO,5:ROOQS,5:Q,5:QO;_QdO,5:QO;dQdO,5:XO'vQdO,5:XO'vQdO,5:VOOQS,5:U,5:UO;uQdO,5:UO;zQdO,5:WOOOW'#Fy'#FyOOOOQS'#Ds'#DsOOQS1G/w1G/wOOQS1G.|1G.|O!/[QtO1G.|O!/cQtO1G.|O1lQdO1G.|O!0OQdO1G/UOOQS'#DZ'#DZO0rQdO,59tOOQS1G.{1G.{O!0VQdO1G/eO!0gQdO1G/eO!0oQdO1G/fO'vQdO'#H[O!0tQdO'#H[O!0yQtO1G.{O!1ZQdO,59iO!2aQdO,5=zO!2qQdO,5=zO!2yQdO1G/mO!3OQtO1G/mOOQS1G/l1G/lO!3`QdO,5=uO!4VQdO,5=uO0rQdO1G/qO!4tQdO1G/sO!4yQtO1G/sO!5ZQtO1G/qOOQS1G/p1G/pOOQS1G/r1G/rOOOW-E9w-E9wOOQS1G/{1G/{O!5kQdO'#HxO0rQdO'#HxO!5|QdO,5>cOOOW-E9x-E9xOOQS1G/|1G/|OOQS-E9{-E9{O!6[Q#xO1G2zO!6{QtO1G2zO'vQdO,5kOOQS1G1`1G1`O!8RQdO1G1`OOQS'#DV'#DVO0rQdO,5=qOOQS,5=q,5=qO!8WQdO'#FrO!8cQdO,59oO!8kQdO1G/XO!8uQtO,5=uOOQS1G3`1G3`OOQS,5:m,5:mO!9fQdO'#GtOOQS,5jO!;ZQdO,5>jO1XQdO,5>jO!;lQdO,5>iOOQS-E:R-E:RO!;qQdO1G0lO!;|QdO1G0lO!lO!lO!hO!=VQdO,5>hO!=hQdO'#EpO0rQdO1G0tO!=sQdO1G0tO!=xQgO1G0zO!AvQgO1G0}O!EqQdO,5>oO!E{QdO,5>oO!FTQtO,5>oO0rQdO1G1PO!F_QdO1G1PO4iQdO1G1UO!!vQdO1G1WOOQV,5;a,5;aO!FdQfO,5;aO!FiQgO1G1QO!JjQdO'#GZO4iQdO1G1QO4iQdO1G1QO!JzQdO,5>pO!KXQdO,5>pO1XQdO,5>pOOQV1G1U1G1UO!KaQdO'#FSO!KrQ!fO1G1WO!KzQdO1G1WOOQV1G1]1G1]O4iQdO1G1]O!LPQdO1G1]O!LXQdO'#F^OOQV1G1b1G1bO!#ZQtO1G1bPOOO1G2v1G2vP!L^OSO1G2vOOQS,5=},5=}OOQS'#Dp'#DpO0rQdO,5=}O!LfQdO,5=|O!LyQdO,5=|OOQS1G/u1G/uO!MRQdO,5>PO!McQdO,5>PO!MkQdO,5>PO!NOQdO,5>PO!N`QdO,5>POOQS1G3j1G3jOOQS7+$h7+$hO!8kQdO7+$pO#!RQdO1G.|O#!YQdO1G.|OOQS1G/`1G/`OOQS,5<`,5<`O'vQdO,5<`OOQS7+%P7+%PO#!aQdO7+%POOQS-E9r-E9rOOQS7+%Q7+%QO#!qQdO,5=vO'vQdO,5=vOOQS7+$g7+$gO#!vQdO7+%PO##OQdO7+%QO##TQdO1G3fOOQS7+%X7+%XO##eQdO1G3fO##mQdO7+%XOOQS,5<_,5<_O'vQdO,5<_O##rQdO1G3aOOQS-E9q-E9qO#$iQdO7+%]OOQS7+%_7+%_O#$wQdO1G3aO#%fQdO7+%_O#%kQdO1G3gO#%{QdO1G3gO#&TQdO7+%]O#&YQdO,5>dO#&sQdO,5>dO#&sQdO,5>dOOQS'#Dx'#DxO#'UO&jO'#DzO#'aO`O'#HyOOOW1G3}1G3}O#'fQdO1G3}O#'nQdO1G3}O#'yQ#xO7+(fO#(jQtO1G2UP#)TQdO'#GOOOQS,5nQdO,5sQdO1G4OOOQS-E9y-E9yO#?^QdO1G4OO<[QdO'#H{OOOO'#D{'#D{OOOO'#F|'#F|O#?oO&jO,5:fOOOW,5>e,5>eOOOW7+)i7+)iO#?zQdO7+)iO#@SQdO1G2zO#@mQdO1G2zP'vQdO'#FuO0rQdO<mO#BQQdO,5>mOOQS1G0v1G0vOOQS<rO#KgQdO,5>rO#KrQdO,5>rO#K}QdO,5>qO#L`QdO,5>qOOQS1G1Y1G1YOOQS,5;p,5;pOOQV<VAN>VO$ oQdO<cAN>cO0rQdO1G1|O$!PQtO1G1|P$!ZQdO'#FvOOQS1G2R1G2RP$!hQdO'#F{O$!uQdO7+)jO$#`QdO,5>gOOOO-E9z-E9zOOOW<tO$4{QdO,5>tO1XQdO,5vO$)nQdO,5>vOOQS1G1p1G1pOOQS,5<[,5<[OOQU7+'P7+'PO$+zQdO1G/iO$)nQdO,5wO$8zQdO,5>wOOQS1G1s1G1sOOQS7+'S7+'SP$)nQdO'#GdO$9SQdO1G4bO$9^QdO1G4bO$9fQdO1G4bOOQS7+%T7+%TO$9tQdO1G1tO$:SQtO'#FaO$:ZQdO,5<}OOQS,5<},5<}O$:iQdO1G4cOOQS-E:a-E:aO$)nQdO,5<|O$:pQdO,5<|O$:uQdO7+)|OOQS-E:`-E:`O$;PQdO7+)|O$)nQdO,5S~O%cOS%^OSSOS%]PQ~OPdOVaOfoOhYOopOs!POvqO!PrO!Q{O!T!SO!U!RO!XZO!][O!h`O!r`O!s`O!t`O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#l!QO#o!TO#s!UO#u!VO#z!WO#}hO$P!XO%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~O%]!YO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%j![O%k!]O%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aO~Ok%xXl%xXm%xXn%xXo%xXp%xXs%xXz%xX{%xX!x%xX#g%xX%[%xX%_%xX%z%xXg%xX!T%xX!U%xX%{%xX!W%xX![%xX!Q%xX#[%xXt%xX!m%xX~P%SOfoOhYO!XZO!][O!h`O!r`O!s`O!t`O%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~Oz%wX{%wX#g%wX%[%wX%_%wX%z%wX~Ok!pOl!qOm!oOn!oOo!rOp!sOs!tO!x%wX~P)pOV!zOg!|Oo0cOv0qO!PrO~P'vOV#OOo0cOv0qO!W#PO~P'vOV#SOa#TOo0cOv0qO![#UO~P'vOQ#XO%`#XO%a#ZO~OQ#^OR#[O%`#^O%a#`O~OV%iX_%iXa%iXh%iXk%iXl%iXm%iXn%iXo%iXp%iXs%iXz%iX!X%iX!f%iX%j%iX%k%iX%l%iX%m%iX%n%iX%o%iX%p%iX%q%iX%r%iX%s%iXg%iX!T%iX!U%iX~O&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O{%iX!x%iX#g%iX%[%iX%_%iX%z%iX%{%iX!W%iX![%iX!Q%iX#[%iXt%iX!m%iX~P,eOz#dO{%hX!x%hX#g%hX%[%hX%_%hX%z%hX~Oo0cOv0qO~P'vO#g#gO%[#iO%_#iO~O%uWO~O!T#nO#u!VO#z!WO#}hO~OopO~P'vOV#sOa#tO%uWO{wP~OV#xOo0cOv0qO!Q#yO~P'vO{#{O!x$QO%z#|O#g!yX%[!yX%_!yX~OV#xOo0cOv0qO#g#SX%[#SX%_#SX~P'vOo0cOv0qO#g#WX%[#WX%_#WX~P'vOh$WO%uWO~O!f$YO!r$YO%uWO~OV$eO~P'vO!U$gO#s$hO#u$iO~O{$jO~OV$qO~P'vOS$sO%[$rO%_$rO%c$tO~OV$}Oa$}Og%POo0cOv0qO~P'vOo0cOv0qO{%SO~P'vO&Y%UO~Oa!bOh!iO!X!kO!f!mOVba_bakbalbambanbaobapbasbazba{ba!xba#gba%[ba%_ba%jba%kba%lba%mba%nba%oba%pba%qba%rba%sba%zbagba!Tba!Uba%{ba!Wba![ba!Qba#[batba!mba~On%ZO~Oo%ZO~P'vOo0cO~P'vOk0eOl0fOm0dOn0dOo0mOp0nOs0rOg%wX!T%wX!U%wX%{%wX!W%wX![%wX!Q%wX#[%wX!m%wX~P)pO%{%]Og%vXz%vX!T%vX!U%vX!W%vX{%vX~Og%_Oz%`O!T%dO!U%cO~Og%_O~Oz%gO!T%dO!U%cO!W&SX~O!W%kO~Oz%lO{%nO!T%dO!U%cO![%}X~O![%rO~O![%sO~OQ#XO%`#XO%a%uO~OV%wOo0cOv0qO!PrO~P'vOQ#^OR#[O%`#^O%a%zO~OV!qa_!qaa!qah!qak!qal!qam!qan!qao!qap!qas!qaz!qa{!qa!X!qa!f!qa!x!qa#g!qa%[!qa%_!qa%j!qa%k!qa%l!qa%m!qa%n!qa%o!qa%p!qa%q!qa%r!qa%s!qa%z!qag!qa!T!qa!U!qa%{!qa!W!qa![!qa!Q!qa#[!qat!qa!m!qa~P#yOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P%SOV&OOopOvqO{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P'vOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#g$zX%[$zX%_$zX~P'vO#g#gO%[&TO%_&TO~O!f&UOh&sX%[&sXz&sX#[&sX#g&sX%_&sX#Z&sXg&sX~Oh!iO%[&WO~Okealeameaneaoeapeaseazea{ea!xea#gea%[ea%_ea%zeagea!Tea!Uea%{ea!Wea![ea!Qea#[eatea!mea~P%SOsqazqa{qa#gqa%[qa%_qa%zqa~Ok!pOl!qOm!oOn!oOo!rOp!sO!xqa~PEcO%z&YOz%yX{%yX~O%uWOz%yX{%yX~Oz&]O{wX~O{&_O~Oz%lO#g%}X%[%}X%_%}Xg%}X{%}X![%}X!m%}X%z%}X~OV0lOo0cOv0qO!PrO~P'vO%z#|O#gUa%[Ua%_Ua~Oz&hO#g&PX%[&PX%_&PXn&PX~P%SOz&kO!Q&jO#g#Wa%[#Wa%_#Wa~Oz&lO#[&nO#g&rX%[&rX%_&rXg&rX~O!f$YO!r$YO#Z&qO%uWO~O#Z&qO~Oz&sO#g&tX%[&tX%_&tX~Oz&uO#g&pX%[&pX%_&pX{&pX~O!X&wO%z&xO~Oz&|On&wX~P%SOn'PO~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO%['UO~P'vOt'YO#p'WO#q'XOP#naV#naf#nah#nao#nas#nav#na!P#na!Q#na!T#na!U#na!X#na!]#na!h#na!r#na!s#na!t#na!{#na!}#na#P#na#R#na#T#na#X#na#Z#na#^#na#_#na#a#na#c#na#l#na#o#na#s#na#u#na#z#na#}#na$P#na%X#na%o#na%p#na%t#na%u#na&Z#na&[#na&]#na&^#na&_#na&`#na&a#na&b#na&c#na&d#na&e#na&f#na&g#na&h#na&i#na&j#na%Z#na%_#na~Oz'ZO#[']O{&xX~Oh'_O!X&wO~Oh!iO{$jO!X&wO~O{'eO~P%SO%['hO%_'hO~OS'iO%['hO%_'hO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%k!]O~P!#uO%kWi~P!#uOV!aO_!aOa!bOh!iO!X!kO!f!mO%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%m!_O%n!_O~P!&pO%mWi%nWi~P!&pOa!bOh!iO!X!kO!f!mOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%mWi%nWi%oWi%pWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~OV!aO_!aO%q!aO%r!aO%s!aO~P!)nOVWi_Wi%qWi%rWi%sWi~P!)nO!T%dO!U%cOg&VXz&VX~O%z'kO%{'kO~P,eOz'mOg&UX~Og'oO~Oz'pO{'rO!W&XX~Oo0cOv0qOz'pO{'sO!W&XX~P'vO!W'uO~Om!oOn!oOo!rOp!sOkjisjizji{ji!xji#gji%[ji%_ji%zji~Ol!qO~P!.aOlji~P!.aOk0eOl0fOm0dOn0dOo0mOp0nO~Ot'wO~P!/jOV'|Og'}Oo0cOv0qO~P'vOg'}Oz(OO~Og(QO~O!U(SO~Og(TOz(OO!T%dO!U%cO~P%SOk0eOl0fOm0dOn0dOo0mOp0nOgqa!Tqa!Uqa%{qa!Wqa![qa!Qqa#[qatqa!mqa~PEcOV'|Oo0cOv0qO!W&Sa~P'vOz(WO!W&Sa~O!W(XO~Oz(WO!T%dO!U%cO!W&Sa~P%SOV(]Oo0cOv0qO![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~P'vOz(^O![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~O![(aO~Oz(^O!T%dO!U%cO![%}a~P%SOz(dO!T%dO!U%cO![&Ta~P%SOz(gO{&lX![&lX!m&lX%z&lX~O{(kO![(mO!m(nO%z(jO~OV&OOopOvqO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~P'vOz(pO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~O!f&UOh&sa%[&saz&sa#[&sa#g&sa%_&sa#Z&sag&sa~O%[(uO~OV#sOa#tO%uWO~Oz&]O{wa~OopOvqO~P'vOz(^O#g%}a%[%}a%_%}ag%}a{%}a![%}a!m%}a%z%}a~P%SOz(zO#g%hX%[%hX%_%hX%z%hX~O%z#|O#gUi%[Ui%_Ui~O#g&Pa%[&Pa%_&Pan&Pa~P'vOz(}O#g&Pa%[&Pa%_&Pan&Pa~O%uWO#g&ra%[&ra%_&rag&ra~Oz)SO#g&ra%[&ra%_&rag&ra~Og)VO~OV)WOh$WO%uWO~O#Z)XO~O%uWO#g&ta%[&ta%_&ta~Oz)ZO#g&ta%[&ta%_&ta~Oo0cOv0qO#g&pa%[&pa%_&pa{&pa~P'vOz)^O#g&pa%[&pa%_&pa{&pa~OV)`Oa)`O%uWO~O%z)eO~Ot)hO#j)gOP#hiV#hif#hih#hio#his#hiv#hi!P#hi!Q#hi!T#hi!U#hi!X#hi!]#hi!h#hi!r#hi!s#hi!t#hi!{#hi!}#hi#P#hi#R#hi#T#hi#X#hi#Z#hi#^#hi#_#hi#a#hi#c#hi#l#hi#o#hi#s#hi#u#hi#z#hi#}#hi$P#hi%X#hi%o#hi%p#hi%t#hi%u#hi&Z#hi&[#hi&]#hi&^#hi&_#hi&`#hi&a#hi&b#hi&c#hi&d#hi&e#hi&f#hi&g#hi&h#hi&i#hi&j#hi%Z#hi%_#hi~Ot)iOP#kiV#kif#kih#kio#kis#kiv#ki!P#ki!Q#ki!T#ki!U#ki!X#ki!]#ki!h#ki!r#ki!s#ki!t#ki!{#ki!}#ki#P#ki#R#ki#T#ki#X#ki#Z#ki#^#ki#_#ki#a#ki#c#ki#l#ki#o#ki#s#ki#u#ki#z#ki#}#ki$P#ki%X#ki%o#ki%p#ki%t#ki%u#ki&Z#ki&[#ki&]#ki&^#ki&_#ki&`#ki&a#ki&b#ki&c#ki&d#ki&e#ki&f#ki&g#ki&h#ki&i#ki&j#ki%Z#ki%_#ki~OV)kOn&wa~P'vOz)lOn&wa~Oz)lOn&wa~P%SOn)pO~O%Y)tO~Ot)wO#p'WO#q)vOP#niV#nif#nih#nio#nis#niv#ni!P#ni!Q#ni!T#ni!U#ni!X#ni!]#ni!h#ni!r#ni!s#ni!t#ni!{#ni!}#ni#P#ni#R#ni#T#ni#X#ni#Z#ni#^#ni#_#ni#a#ni#c#ni#l#ni#o#ni#s#ni#u#ni#z#ni#}#ni$P#ni%X#ni%o#ni%p#ni%t#ni%u#ni&Z#ni&[#ni&]#ni&^#ni&_#ni&`#ni&a#ni&b#ni&c#ni&d#ni&e#ni&f#ni&g#ni&h#ni&i#ni&j#ni%Z#ni%_#ni~OV)zOo0cOv0qO{$jO~P'vOo0cOv0qO{&xa~P'vOz*OO{&xa~OV*SOa*TOg*WO%q*UO%uWO~O{$jO&{*YO~Oh'_O~Oh!iO{$jO~O%[*_O~O%[*aO%_*aO~OV$}Oa$}Oo0cOv0qOg&Ua~P'vOz*dOg&Ua~Oo0cOv0qO{*gO!W&Xa~P'vOz*hO!W&Xa~Oo0cOv0qOz*hO{*kO!W&Xa~P'vOo0cOv0qOz*hO!W&Xa~P'vOz*hO{*kO!W&Xa~Om0dOn0dOo0mOp0nOgjikjisjizji!Tji!Uji%{ji!Wji{ji![ji#gji%[ji%_ji!Qji#[jitji!mji%zji~Ol0fO~P!NkOlji~P!NkOV'|Og*pOo0cOv0qO~P'vOn*rO~Og*pOz*tO~Og*uO~OV'|Oo0cOv0qO!W&Si~P'vOz*vO!W&Si~O!W*wO~OV(]Oo0cOv0qO![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~P'vOz*zO!T%dO!U%cO![&Ti~Oz*}O![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~O![+OO~Oa+QOo0cOv0qO![&Ti~P'vOz*zO![&Ti~O![+SO~OV+UOo0cOv0qO{&la![&la!m&la%z&la~P'vOz+VO{&la![&la!m&la%z&la~O!]+YO&n+[O![!nX~O![+^O~O{(kO![+_O~O{(kO![+_O!m+`O~OV&OOopOvqO{%hq!x%hq#g%hq%[%hq%_%hq%z%hq~P'vOz$ri{$ri!x$ri#g$ri%[$ri%_$ri%z$ri~P%SOV&OOopOvqO~P'vOV&OOo0cOv0qO#g%ha%[%ha%_%ha%z%ha~P'vOz+aO#g%ha%[%ha%_%ha%z%ha~Oz$ia#g$ia%[$ia%_$ian$ia~P%SO#g&Pi%[&Pi%_&Pin&Pi~P'vOz+dO#g#Wq%[#Wq%_#Wq~O#[+eOz$va#g$va%[$va%_$vag$va~O%uWO#g&ri%[&ri%_&rig&ri~Oz+gO#g&ri%[&ri%_&rig&ri~OV+iOh$WO%uWO~O%uWO#g&ti%[&ti%_&ti~Oo0cOv0qO#g&pi%[&pi%_&pi{&pi~P'vO{#{Oz#eX!W#eX~Oz+mO!W&uX~O!W+oO~Ot+rO#j)gOP#hqV#hqf#hqh#hqo#hqs#hqv#hq!P#hq!Q#hq!T#hq!U#hq!X#hq!]#hq!h#hq!r#hq!s#hq!t#hq!{#hq!}#hq#P#hq#R#hq#T#hq#X#hq#Z#hq#^#hq#_#hq#a#hq#c#hq#l#hq#o#hq#s#hq#u#hq#z#hq#}#hq$P#hq%X#hq%o#hq%p#hq%t#hq%u#hq&Z#hq&[#hq&]#hq&^#hq&_#hq&`#hq&a#hq&b#hq&c#hq&d#hq&e#hq&f#hq&g#hq&h#hq&i#hq&j#hq%Z#hq%_#hq~On$|az$|a~P%SOV)kOn&wi~P'vOz+yOn&wi~Oz,TO{$jO#[,TO~O#q,VOP#nqV#nqf#nqh#nqo#nqs#nqv#nq!P#nq!Q#nq!T#nq!U#nq!X#nq!]#nq!h#nq!r#nq!s#nq!t#nq!{#nq!}#nq#P#nq#R#nq#T#nq#X#nq#Z#nq#^#nq#_#nq#a#nq#c#nq#l#nq#o#nq#s#nq#u#nq#z#nq#}#nq$P#nq%X#nq%o#nq%p#nq%t#nq%u#nq&Z#nq&[#nq&]#nq&^#nq&_#nq&`#nq&a#nq&b#nq&c#nq&d#nq&e#nq&f#nq&g#nq&h#nq&i#nq&j#nq%Z#nq%_#nq~O#[,WOz%Oa{%Oa~Oo0cOv0qO{&xi~P'vOz,YO{&xi~O{#{O%z,[Og&zXz&zX~O%uWOg&zXz&zX~Oz,`Og&yX~Og,bO~O%Y,eO~O!T%dO!U%cOg&Viz&Vi~OV$}Oa$}Oo0cOv0qOg&Ui~P'vO{,hOz$la!W$la~Oo0cOv0qO{,iOz$la!W$la~P'vOo0cOv0qO{*gO!W&Xi~P'vOz,lO!W&Xi~Oo0cOv0qOz,lO!W&Xi~P'vOz,lO{,oO!W&Xi~Og$hiz$hi!W$hi~P%SOV'|Oo0cOv0qO~P'vOn,qO~OV'|Og,rOo0cOv0qO~P'vOV'|Oo0cOv0qO!W&Sq~P'vOz$gi![$gi#g$gi%[$gi%_$gig$gi{$gi!m$gi%z$gi~P%SOV(]Oo0cOv0qO~P'vOa+QOo0cOv0qO![&Tq~P'vOz,sO![&Tq~O![,tO~OV(]Oo0cOv0qO![%}q#g%}q%[%}q%_%}qg%}q{%}q!m%}q%z%}q~P'vO{,uO~OV+UOo0cOv0qO{&li![&li!m&li%z&li~P'vOz,zO{&li![&li!m&li%z&li~O!]+YO&n+[O![!na~O{(kO![,}O~OV&OOo0cOv0qO#g%hi%[%hi%_%hi%z%hi~P'vOz-OO#g%hi%[%hi%_%hi%z%hi~O%uWO#g&rq%[&rq%_&rqg&rq~Oz-RO#g&rq%[&rq%_&rqg&rq~OV)`Oa)`O%uWO!W&ua~Oz-TO!W&ua~On$|iz$|i~P%SOV)kO~P'vOV)kOn&wq~P'vOt-XOP#myV#myf#myh#myo#mys#myv#my!P#my!Q#my!T#my!U#my!X#my!]#my!h#my!r#my!s#my!t#my!{#my!}#my#P#my#R#my#T#my#X#my#Z#my#^#my#_#my#a#my#c#my#l#my#o#my#s#my#u#my#z#my#}#my$P#my%X#my%o#my%p#my%t#my%u#my&Z#my&[#my&]#my&^#my&_#my&`#my&a#my&b#my&c#my&d#my&e#my&f#my&g#my&h#my&i#my&j#my%Z#my%_#my~O%Z-]O%_-]O~P`O#q-^OP#nyV#nyf#nyh#nyo#nys#nyv#ny!P#ny!Q#ny!T#ny!U#ny!X#ny!]#ny!h#ny!r#ny!s#ny!t#ny!{#ny!}#ny#P#ny#R#ny#T#ny#X#ny#Z#ny#^#ny#_#ny#a#ny#c#ny#l#ny#o#ny#s#ny#u#ny#z#ny#}#ny$P#ny%X#ny%o#ny%p#ny%t#ny%u#ny&Z#ny&[#ny&]#ny&^#ny&_#ny&`#ny&a#ny&b#ny&c#ny&d#ny&e#ny&f#ny&g#ny&h#ny&i#ny&j#ny%Z#ny%_#ny~Oz-aO{$jO#[-aO~Oo0cOv0qO{&xq~P'vOz-dO{&xq~O%z,[Og&zaz&za~O{#{Og&zaz&za~OV*SOa*TO%q*UO%uWOg&ya~Oz-hOg&ya~O$S-lO~OV$}Oa$}Oo0cOv0qO~P'vOo0cOv0qO{-mOz$li!W$li~P'vOo0cOv0qOz$li!W$li~P'vO{-mOz$li!W$li~Oo0cOv0qO{*gO~P'vOo0cOv0qO{*gO!W&Xq~P'vOz-pO!W&Xq~Oo0cOv0qOz-pO!W&Xq~P'vOs-sO!T%dO!U%cOg&Oq!W&Oq![&Oqz&Oq~P!/jOa+QOo0cOv0qO![&Ty~P'vOz$ji![$ji~P%SOa+QOo0cOv0qO~P'vOV+UOo0cOv0qO~P'vOV+UOo0cOv0qO{&lq![&lq!m&lq%z&lq~P'vO{(kO![-xO!m-yO%z-wO~OV&OOo0cOv0qO#g%hq%[%hq%_%hq%z%hq~P'vO%uWO#g&ry%[&ry%_&ryg&ry~OV)`Oa)`O%uWO!W&ui~Ot-}OP#m!RV#m!Rf#m!Rh#m!Ro#m!Rs#m!Rv#m!R!P#m!R!Q#m!R!T#m!R!U#m!R!X#m!R!]#m!R!h#m!R!r#m!R!s#m!R!t#m!R!{#m!R!}#m!R#P#m!R#R#m!R#T#m!R#X#m!R#Z#m!R#^#m!R#_#m!R#a#m!R#c#m!R#l#m!R#o#m!R#s#m!R#u#m!R#z#m!R#}#m!R$P#m!R%X#m!R%o#m!R%p#m!R%t#m!R%u#m!R&Z#m!R&[#m!R&]#m!R&^#m!R&_#m!R&`#m!R&a#m!R&b#m!R&c#m!R&d#m!R&e#m!R&f#m!R&g#m!R&h#m!R&i#m!R&j#m!R%Z#m!R%_#m!R~Oo0cOv0qO{&xy~P'vOV*SOa*TO%q*UO%uWOg&yi~O$S-lO%Z.VO%_.VO~OV.aOh._O!X.^O!].`O!h.YO!s.[O!t.[O%p.XO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O~Oo0cOv0qOz$lq!W$lq~P'vO{.fOz$lq!W$lq~Oo0cOv0qO{*gO!W&Xy~P'vOz.gO!W&Xy~Oo0cOv.kO~P'vOs-sO!T%dO!U%cOg&Oy!W&Oy![&Oyz&Oy~P!/jO{(kO![.nO~O{(kO![.nO!m.oO~OV*SOa*TO%q*UO%uWO~Oh.tO!f.rOz$TX#[$TX%j$TXg$TX~Os$TX{$TX!W$TX![$TX~P$-bO%o.vO%p.vOs$UXz$UX{$UX#[$UX%j$UX!W$UXg$UX![$UX~O!h.xO~Oz.|O#[/OO%j.yOs&|X{&|X!W&|Xg&|X~Oa/RO~P$)zOh.tOs&}Xz&}X{&}X#[&}X%j&}X!W&}Xg&}X![&}X~Os/VO{$jO~Oo0cOv0qOz$ly!W$ly~P'vOo0cOv0qO{*gO!W&X!R~P'vOz/ZO!W&X!R~Og&RXs&RX!T&RX!U&RX!W&RX![&RXz&RX~P!/jOs-sO!T%dO!U%cOg&Qa!W&Qa![&Qaz&Qa~O{(kO![/^O~O!f.rOh$[as$[az$[a{$[a#[$[a%j$[a!W$[ag$[a![$[a~O!h/eO~O%o.vO%p.vOs$Uaz$Ua{$Ua#[$Ua%j$Ua!W$Uag$Ua![$Ua~O%j.yOs$Yaz$Ya{$Ya#[$Ya!W$Yag$Ya![$Ya~Os&|a{&|a!W&|ag&|a~P$)nOz/jOs&|a{&|a!W&|ag&|a~O!W/mO~Og/mO~O{/oO~O![/pO~Oo0cOv0qO{*gO!W&X!Z~P'vO{/sO~O%z/tO~P$-bOz/uO#[/OO%j.yOg'PX~Oz/uOg'PX~Og/wO~O!h/xO~O#[/OOs%Saz%Sa{%Sa%j%Sa!W%Sag%Sa![%Sa~O#[/OO%j.yOs%Waz%Wa{%Wa!W%Wag%Wa~Os&|i{&|i!W&|ig&|i~P$)nOz/zO#[/OO%j.yO!['Oa~Og'Pa~P$)nOz0SOg'Pa~Oa0UO!['Oi~P$)zOz0WO!['Oi~Oz0WO#[/OO%j.yO!['Oi~O#[/OO%j.yOg$biz$bi~O%z0ZO~P$-bO#[/OO%j.yOg%Vaz%Va~Og'Pi~P$)nO{0^O~Oa0UO!['Oq~P$)zOz0`O!['Oq~O#[/OO%j.yOz%Ui![%Ui~Oa0UO~P$)zOa0UO!['Oy~P$)zO#[/OO%j.yOg$ciz$ci~O#[/OO%j.yOz%Uq![%Uq~Oz+aO#g%ha%[%ha%_%ha%z%ha~P%SOV&OOo0cOv0qO~P'vOn0hO~Oo0hO~P'vO{0iO~Ot0jO~P!/jO&]&Z&j&h&i&g&f&d&e&c&b&`&a&_&^&[%u~",goto:"!=j'QPPPPPP'RP'Z*s+[+t,_,y-fP.SP'Z.r.r'ZPPP'Z2[PPPPPP2[5PPP5PP7b7k=sPP=v>h>kPP'Z'ZPP>zPP'Z'ZPP'Z'Z'Z'Z'Z?O?w'ZP?zP@QDXGuGyPG|HWH['ZPPPH_Hk'RP'R'RP'RP'RP'RP'RP'R'R'RP'RPP'RPP'RP'RPHqH}IVPI^IdPI^PI^I^PPPI^PKrPK{LVL]KrPI^LfPI^PLmLsPLwM]MzNeLwLwNkNxLwLwLwLw! ^! d! g! l! o! y!!P!!]!!o!!u!#P!#V!#s!#y!$P!$Z!$a!$g!$y!%T!%Z!%a!%k!%q!%w!%}!&T!&Z!&e!&k!&u!&{!'U!'[!'k!'s!'}!(UPPPPPPPPPPP!([!(_!(e!(n!(x!)TPPPPPPPPPPPP!-u!/Z!3^!6oPP!6w!7W!7a!8Y!8P!8c!8i!8l!8o!8r!8z!9jPPPPPPPPPPPPPPPPP!9m!9q!9wP!:]!:a!:m!:v!;S!;j!;m!;p!;v!;|!_![!]Do!]!^Es!^!_FZ!_!`Gk!`!aHX!a!b%T!b!cIf!c!dJU!d!eK^!e!hJU!h!i!#f!i!tJU!t!u!,|!u!wJU!w!x!.t!x!}JU!}#O!0S#O#P&o#P#Q!0j#Q#R!1Q#R#SJU#S#T%T#T#UJU#U#VK^#V#YJU#Y#Z!#f#Z#fJU#f#g!,|#g#iJU#i#j!.t#j#oJU#o#p!1n#p#q!1s#q#r!2a#r#s!2f#s$g%T$g;'SJU;'S;=`KW<%lOJU`%YT&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T`%lP;=`<%l%To%v]&n`%c_OX%TXY%oY[%T[]%o]p%Tpq%oq#O%T#O#P&o#P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To&tX&n`OY%TYZ%oZ]%T]^%o^#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc'f[&n`O!_%T!_!`([!`#T%T#T#U(r#U#f%T#f#g(r#g#h(r#h#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(cTmR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(yT!mR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk)aV&n`&[ZOr%Trs)vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk){V&n`Or%Trs*bs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk*iT&n`&^ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To+PZS_&n`OY*xYZ%TZ]*x]^%T^#o*x#o#p+r#p#q*x#q#r+r#r;'S*x;'S;=`,^<%lO*x_+wTS_OY+rZ]+r^;'S+r;'S;=`,W<%lO+r_,ZP;=`<%l+ro,aP;=`<%l*xj,kV%rQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-XT!xY&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-oV%lQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.]V&n`&ZZOw%Twx.rx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.wV&n`Ow%Twx/^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/eT&n`&]ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/{ThZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc0cTgR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk0yXVZ&n`Oz%Tz{1f{!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk1mVaR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk2ZV%oZ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc2wTzR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To3_W%pZ&n`O!_%T!_!`-Q!`!a3w!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Td4OT&{S&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk4fX!fQ&n`O!O%T!O!P5R!P!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5WV&n`O!O%T!O!P5m!P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5tT!rZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti6[a!hX&n`O!Q%T!Q![6T![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S6T#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti7fZ&n`O{%T{|8X|}%T}!O8X!O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8^V&n`O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8z]!hX&n`O!Q%T!Q![8s![!l%T!l!m9s!m#R%T#R#S8s#S#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti9zT!hX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk:bX%qR&n`O!P%T!P!Q:}!Q!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj;UV%sQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti;ro!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!d%T!d!e?q!e!g%T!g!h7a!h!l%T!l!m9s!m!q%T!q!rA]!r!z%T!z!{Bq!{#R%T#R#S>_#S#U%T#U#V?q#V#X%T#X#Y7a#Y#^%T#^#_9s#_#c%T#c#dA]#d#l%T#l#mBq#m#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti=xV&n`O!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti>fc!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S>_#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti?vY&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti@mY!hX&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiAbX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBUX!hX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBv]&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiCv]!hX&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToDvV{_&n`O!_%T!_!`E]!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TcEdT%{R&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkEzT#gZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkFbXmR&n`O!^%T!^!_F}!_!`([!`!a([!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjGUV%mQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkGrV%zZ&n`O!_%T!_!`([!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkH`WmR&n`O!_%T!_!`([!`!aHx!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjIPV%nQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkIoV_Q#}P&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToJ_]&n`&YS%uZO!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoKZP;=`<%lJUoKge&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!tJU!t!uLx!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#gLx#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoMRa&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUkN_V&n`&`ZOr%TrsNts#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkNyV&n`Or%Trs! `s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! gT&n`&bZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! }V&n`&_ZOw%Twx!!dx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!!iV&n`Ow%Twx!#Ox#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!#VT&n`&aZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!#oe&n`&YS%uZOr%Trs!%Qsw%Twx!&px!Q%T!Q![JU![!c%T!c!tJU!t!u!(`!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#g!(`#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!%XV&n`&dZOr%Trs!%ns#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!%sV&n`Or%Trs!&Ys#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&aT&n`&fZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&wV&n`&cZOw%Twx!'^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!'cV&n`Ow%Twx!'xx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!(PT&n`&eZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!(ia&n`&YS%uZOr%Trs!)nsw%Twx!+^x!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!)uV&n`&hZOr%Trs!*[s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*aV&n`Or%Trs!*vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*}T&n`&jZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!+eV&n`&gZOw%Twx!+zx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,PV&n`Ow%Twx!,fx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,mT&n`&iZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!-Vi&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!dJU!d!eLx!e!hJU!h!i!(`!i!}JU!}#R%T#R#SJU#S#T%T#T#UJU#U#VLx#V#YJU#Y#Z!(`#Z#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUo!.}a&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!0ZT!XZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc!0qT!WR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj!1XV%kQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!1sO!]~k!1zV%jR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!2fO![~i!2mT%tX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T",tokenizers:[tvt,Zxt,Yxt,nvt,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:e=>svt[e]||-1}],tokenPrec:7668}),TK=new aQ,XOe=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function s_(e){return(t,n,r)=>{if(r)return!1;let i=t.node.getChild("VariableName");return i&&n(i,e),!0}}const ovt={FunctionDefinition:s_("function"),ClassDefinition:s_("class"),ForStatement(e,t,n){if(n){for(let r=e.node.firstChild;r;r=r.nextSibling)if(r.name=="VariableName")t(r,"variable");else if(r.name=="in")break}},ImportStatement(e,t){var n,r;let{node:i}=e,s=((n=i.firstChild)===null||n===void 0?void 0:n.name)=="from";for(let a=i.getChild("import");a;a=a.nextSibling)a.name=="VariableName"&&((r=a.nextSibling)===null||r===void 0?void 0:r.name)!="as"&&t(a,s?"variable":"namespace")},AssignStatement(e,t){for(let n=e.node.firstChild;n;n=n.nextSibling)if(n.name=="VariableName")t(n,"variable");else if(n.name==":"||n.name=="AssignOp")break},ParamList(e,t){for(let n=null,r=e.node.firstChild;r;r=r.nextSibling)r.name=="VariableName"&&(!n||!/\*|AssignOp/.test(n.name))&&t(r,"variable"),n=r},CapturePattern:s_("variable"),AsPattern:s_("variable"),__proto__:null};function GOe(e,t){let n=TK.get(t);if(n)return n;let r=[],i=!0;function s(a,l){let c=e.sliceString(a.from,a.to);r.push({label:c,type:l})}return t.cursor(Ur.IncludeAnonymous).iterate(a=>{if(a.name){let l=ovt[a.name];if(l&&l(a,s,i)||!i&&XOe.has(a.name))return!1;i=!1}else if(a.to-a.from>8192){for(let l of GOe(e,a.node))r.push(l);return!1}}),TK.set(t,r),r}const CK=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,WOe=["String","FormatString","Comment","PropertyName"];function lvt(e){let t=yi(e.state).resolveInner(e.pos,-1);if(WOe.indexOf(t.name)>-1)return null;let n=t.name=="VariableName"||t.to-t.from<20&&CK.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let r=[];for(let i=t;i;i=i.parent)XOe.has(i.name)&&(r=r.concat(GOe(e.state.doc,i)));return{options:r,from:n?t.from:e.pos,validFor:CK}}const cvt=["__annotations__","__builtins__","__debug__","__doc__","__import__","__name__","__loader__","__package__","__spec__","False","None","True"].map(e=>({label:e,type:"constant"})).concat(["ArithmeticError","AssertionError","AttributeError","BaseException","BlockingIOError","BrokenPipeError","BufferError","BytesWarning","ChildProcessError","ConnectionAbortedError","ConnectionError","ConnectionRefusedError","ConnectionResetError","DeprecationWarning","EOFError","Ellipsis","EncodingWarning","EnvironmentError","Exception","FileExistsError","FileNotFoundError","FloatingPointError","FutureWarning","GeneratorExit","IOError","ImportError","ImportWarning","IndentationError","IndexError","InterruptedError","IsADirectoryError","KeyError","KeyboardInterrupt","LookupError","MemoryError","ModuleNotFoundError","NameError","NotADirectoryError","NotImplemented","NotImplementedError","OSError","OverflowError","PendingDeprecationWarning","PermissionError","ProcessLookupError","RecursionError","ReferenceError","ResourceWarning","RuntimeError","RuntimeWarning","StopAsyncIteration","StopIteration","SyntaxError","SyntaxWarning","SystemError","SystemExit","TabError","TimeoutError","TypeError","UnboundLocalError","UnicodeDecodeError","UnicodeEncodeError","UnicodeError","UnicodeTranslateError","UnicodeWarning","UserWarning","ValueError","Warning","ZeroDivisionError"].map(e=>({label:e,type:"type"}))).concat(["bool","bytearray","bytes","classmethod","complex","float","frozenset","int","list","map","memoryview","object","range","set","staticmethod","str","super","tuple","type"].map(e=>({label:e,type:"class"}))).concat(["abs","aiter","all","anext","any","ascii","bin","breakpoint","callable","chr","compile","delattr","dict","dir","divmod","enumerate","eval","exec","exit","filter","format","getattr","globals","hasattr","hash","help","hex","id","input","isinstance","issubclass","iter","len","license","locals","max","min","next","oct","open","ord","pow","print","property","quit","repr","reversed","round","setattr","slice","sorted","sum","vars","zip"].map(e=>({label:e,type:"function"}))),uvt=[rs("def ${name}(${params}):\n ${}",{label:"def",detail:"function",type:"keyword"}),rs("for ${name} in ${collection}:\n ${}",{label:"for",detail:"loop",type:"keyword"}),rs("while ${}:\n ${}",{label:"while",detail:"loop",type:"keyword"}),rs("try:\n ${}\nexcept ${error}:\n ${}",{label:"try",detail:"/ except block",type:"keyword"}),rs(`if \${}: -`,{label:"if",detail:"block",type:"keyword"}),rs("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),rs("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),rs("import ${module}",{label:"import",detail:"statement",type:"keyword"}),rs("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],fvt=S1e(WOe,IQ(uvt.concat(dvt)));function xP(e){let{node:t,pos:n}=e,r=e.lineIndent(n,-1),i=null;for(;;){let s=t.childBefore(n);if(s)if(s.name=="Comment")n=s.from;else if(s.name=="Body"||s.name=="MatchBody")e.baseIndentFor(s)+e.unit<=r&&(i=s),t=s;else if(s.name=="MatchClause")t=s;else if(s.type.is("Statement"))t=s;else break;else break}return i}function vP(e,t){let n=e.baseIndentFor(t),r=e.lineAt(e.pos,-1),i=r.from+r.text.length;return/^\s*($|#)/.test(r.text)&&e.node.ton?null:n+e.unit}const wP=lh.define({name:"python",parser:ovt.configure({props:[wh.add({Body:e=>{var t;let n=/^\s*(#|$)/.test(e.textAfter)&&xP(e)||e.node;return(t=vP(e,n))!==null&&t!==void 0?t:e.continue()},MatchBody:e=>{var t;let n=xP(e);return(t=vP(e,n||e.node))!==null&&t!==void 0?t:e.continue()},IfStatement:e=>/^\s*(else:|elif )/.test(e.textAfter)?e.baseIndent:e.continue(),"ForStatement WhileStatement":e=>/^\s*else:/.test(e.textAfter)?e.baseIndent:e.continue(),TryStatement:e=>/^\s*(except[ :]|finally:|else:)/.test(e.textAfter)?e.baseIndent:e.continue(),MatchStatement:e=>/^\s*case /.test(e.textAfter)?e.baseIndent+e.unit:e.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":Cy({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":Cy({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":Cy({closing:"]"}),MemberExpression:e=>e.baseIndent+e.unit,"String FormatString":()=>null,Script:e=>{var t;let n=xP(e);return(t=n&&vP(e,n))!==null&&t!==void 0?t:e.continue()}}),Sh.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":BE,Body:(e,t)=>({from:e.from+1,to:e.to-(e.to==t.doc.length?0:1)}),"String FormatString":(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/}});function hvt(){return new rm(wP,[wP.data.of({autocomplete:cvt}),wP.data.of({autocomplete:fvt})])}const vb=63,AK=64,pvt=1,mvt=2,YOe=3,gvt=4,ZOe=5,bvt=6,yvt=7,KOe=65,Ovt=66,xvt=8,vvt=9,wvt=10,Svt=11,Evt=12,JOe=13,kvt=19,_vt=20,Tvt=29,Cvt=33,Avt=34,Nvt=47,jvt=0,tU=1,C6=2,xS=3,A6=4;class Km{constructor(t,n,r){this.parent=t,this.depth=n,this.type=r,this.hash=(t?t.hash+t.hash<<8:0)+n+(n<<4)+r}}Km.top=new Km(null,-1,jvt);function Kv(e,t){for(let n=0,r=t-e.pos-1;;r--,n++){let i=e.peek(r);if(uh(i)||i==-1)return n}}function N6(e){return e==32||e==9}function uh(e){return e==10||e==13}function exe(e){return N6(e)||uh(e)}function dg(e){return e<0||exe(e)}const Rvt=new oR({start:Km.top,reduce(e,t){return e.type==xS&&(t==_vt||t==Avt)?e.parent:e},shift(e,t,n,r){if(t==YOe)return new Km(e,Kv(r,r.pos),tU);if(t==KOe||t==ZOe)return new Km(e,Kv(r,r.pos),C6);if(t==vb)return e.parent;if(t==kvt||t==Cvt)return new Km(e,0,xS);if(t==JOe&&e.type==A6)return e.parent;if(t==Nvt){let i=/[1-9]/.exec(r.read(r.pos,n.pos));if(i)return new Km(e,e.depth+ +i[0],A6)}return e},hash(e){return e.hash}});function T1(e,t,n=0){return e.peek(n)==t&&e.peek(n+1)==t&&e.peek(n+2)==t&&dg(e.peek(n+3))}const Ivt=new js((e,t)=>{if(e.next==-1&&t.canShift(AK))return e.acceptToken(AK);let n=e.peek(-1);if((uh(n)||n<0)&&t.context.type!=xS){if(T1(e,45))if(t.canShift(vb))e.acceptToken(vb);else return e.acceptToken(pvt,3);if(T1(e,46))if(t.canShift(vb))e.acceptToken(vb);else return e.acceptToken(mvt,3);let r=0;for(;e.next==32;)r++,e.advance();(r{if(t.context.type==xS){e.next==63&&(e.advance(),dg(e.next)&&e.acceptToken(yvt));return}if(e.next==45)e.advance(),dg(e.next)&&e.acceptToken(t.context.type==tU&&t.context.depth==Kv(e,e.pos-1)?gvt:YOe);else if(e.next==63)e.advance(),dg(e.next)&&e.acceptToken(t.context.type==C6&&t.context.depth==Kv(e,e.pos-1)?bvt:ZOe);else{let n=e.pos;for(;;)if(N6(e.next)){if(e.pos==n)return;e.advance()}else if(e.next==33)txe(e);else if(e.next==38)j6(e);else if(e.next==42){j6(e);break}else if(e.next==39||e.next==34){if(nU(e,!0))break;return}else if(e.next==91||e.next==123){if(!Mvt(e))return;break}else{nxe(e,!0,!1,0);break}for(;N6(e.next);)e.advance();if(e.next==58){if(e.pos==n&&t.canShift(Tvt))return;let r=e.peek(1);dg(r)&&e.acceptTokenTo(t.context.type==C6&&t.context.depth==Kv(e,n)?Ovt:KOe,n)}}},{contextual:!0});function Pvt(e){return e>32&&e<127&&e!=34&&e!=37&&e!=44&&e!=60&&e!=62&&e!=92&&e!=94&&e!=96&&e!=123&&e!=124&&e!=125}function NK(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function jK(e,t){return e.next==37?(e.advance(),NK(e.next)&&e.advance(),NK(e.next)&&e.advance(),!0):Pvt(e.next)||t&&e.next==44?(e.advance(),!0):!1}function txe(e){if(e.advance(),e.next==60){for(e.advance();;)if(!jK(e,!0)){e.next==62&&e.advance();break}}else for(;jK(e,!1););}function j6(e){for(e.advance();!dg(e.next)&&LA(e.next)!="f";)e.advance()}function nU(e,t){let n=e.next,r=!1,i=e.pos;for(e.advance();;){let s=e.next;if(s<0)break;if(e.advance(),s==n)if(s==39)if(e.next==39)e.advance();else break;else break;else if(s==92&&n==34)e.next>=0&&e.advance();else if(uh(s)){if(t)return!1;r=!0}else if(t&&e.pos>=i+1024)return!1}return!r}function Mvt(e){for(let t=[],n=e.pos+1024;;)if(e.next==91||e.next==123)t.push(e.next),e.advance();else if(e.next==39||e.next==34){if(!nU(e,!0))return!1}else if(e.next==93||e.next==125){if(t[t.length-1]!=e.next-2)return!1;if(t.pop(),e.advance(),!t.length)return!0}else{if(e.next<0||e.pos>n||uh(e.next))return!1;e.advance()}}const Lvt="iiisiiissisfissssssssssssisssiiissssssssssssssssssssssssssfsfssissssssssssssssssssssssssssfif";function LA(e){return e<33?"u":e>125?"s":Lvt[e-33]}function SP(e,t){let n=LA(e);return n!="u"&&!(t&&n=="f")}function nxe(e,t,n,r){if(LA(e.next)=="s"||(e.next==63||e.next==58||e.next==45)&&SP(e.peek(1),n))e.advance();else return!1;let i=e.pos;for(;;){let s=e.next,a=0,l=r+1;for(;exe(s);){if(uh(s)){if(t)return!1;l=0}else l++;s=e.peek(++a)}if(!(s>=0&&(s==58?SP(e.peek(a+1),n):s==35?e.peek(a-1)!=32:SP(s,n)))||!n&&l<=r||l==0&&!n&&(T1(e,45,a)||T1(e,46,a)))break;if(t&&LA(s)=="f")return!1;for(let u=a;u>=0;u--)e.advance();if(t&&e.pos>i+1024)return!1}return!0}const $vt=new js((e,t)=>{if(e.next==33)txe(e),e.acceptToken(Evt);else if(e.next==38||e.next==42){let n=e.next==38?wvt:Svt;j6(e),e.acceptToken(n)}else e.next==39||e.next==34?(nU(e,!1),e.acceptToken(vvt)):nxe(e,!1,t.context.type==xS,t.context.depth)&&e.acceptToken(xvt)}),Bvt=new js((e,t)=>{let n=t.context.type==A6?t.context.depth:-1,r=e.pos;e:for(;;){let i=0,s=e.next;for(;s==32;)s=e.peek(++i);if(!i&&(T1(e,45,i)||T1(e,46,i))||!uh(s)&&(n<0&&(n=Math.max(t.context.depth+1,i)),iYAN>Y",stateData:";S~O!fOS!gOS^OS~OP_OQbORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!V[O!cTO~O`cO~P]OVkOWROXROYeOZfO[dOcPOmhOqQO~OboO~P!bOVtOWROXROYeOZfO[dOcPOmrOqQO~OpwO~P#WORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!cTO~OSvP!avP!bvP~P#|OWROXROYeOZfO[dOcPOqQO~OmzO~P%OOm!OOUzP!azP!bzP!dzP~P#|O^!SO!b!QO!f!TO!g!RO~ORSOTUOWROXROcPOqQO!PVO!cTO~OY!UOP!QXQ!QX!V!QX!`!QXS!QX!a!QX!b!QXU!QXm!QX!d!QX~P&aO[!WOP!SXQ!SX!V!SX!`!SXS!SX!a!SX!b!SXU!SXm!SX!d!SX~P&aO^!ZO!W![O!b!YO!f!]O!g!YO~OP!_O!V[OQaX!`aX~OPaXQaX!VaX!`aX~P#|OP!bOQ!cO!V[O~OP_O!V[O~P#|OWROXROY!fOcPOqQObfXmfXofXpfX~OWROXRO[!hOcPOqQObhXmhXohXphX~ObeXmlXoeX~ObkXokX~P%OOm!kO~Om!lObnPonP~P%OOb!pOo!oO~Ob!pO~P!bOm!sOosXpsX~OosXpsX~P%OOm!uOotPptP~P%OOo!xOp!yO~Op!yO~P#WOS!|O!a#OO!b#OO~OUyX!ayX!byX!dyX~P#|Om#QO~OU#SO!a#UO!b#UO!d#RO~Om#WOUzX!azX!bzX!dzX~O]#XO~O!b#XO!g#YO~O^#ZO!b#XO!g#YO~OP!RXQ!RX!V!RX!`!RXS!RX!a!RX!b!RXU!RXm!RX!d!RX~P&aOP!TXQ!TX!V!TX!`!TXS!TX!a!TX!b!TXU!TXm!TX!d!TX~P&aO!b#^O!g#^O~O^#_O!b#^O!f#`O!g#^O~O^#_O!W#aO!b#^O!g#^O~OPaaQaa!Vaa!`aa~P#|OP#cO!V[OQ!XX!`!XX~OP!XXQ!XX!V!XX!`!XX~P#|OP_O!V[OQ!_X!`!_X~P#|OWROXROcPOqQObgXmgXogXpgX~OWROXROcPOqQObiXmiXoiXpiX~Obkaoka~P%OObnXonX~P%OOm#kO~Ob#lOo!oO~Oosapsa~P%OOotXptX~P%OOm#pO~Oo!xOp#qO~OSwP!awP!bwP~P#|OS!|O!a#vO!b#vO~OUya!aya!bya!dya~P#|Om#xO~P%OOm#{OU}P!a}P!b}P!d}P~P#|OU#SO!a$OO!b$OO!d#RO~O]$QO~O!b$QO!g$RO~O!b$SO!g$SO~O^$TO!b$SO!g$SO~O^$TO!b$SO!f$UO!g$SO~OP!XaQ!Xa!V!Xa!`!Xa~P#|Obnaona~P%OOotapta~P%OOo!xO~OU|X!a|X!b|X!d|X~P#|Om$ZO~Om$]OU}X!a}X!b}X!d}X~O]$^O~O!b$_O!g$_O~O^$`O!b$_O!g$_O~OU|a!a|a!b|a!d|a~P#|O!b$cO!g$cO~O",goto:",]!mPPPPPPPPPPPPPPPPP!nPP!v#v#|$`#|$c$f$j$nP%VPPP!v%Y%^%a%{&O%a&R&U&X&_&b%aP&e&{&e'O'RPP']'a'g'm's'y(XPPPPPPPP(_)e*X+c,VUaObcR#e!c!{ROPQSTUXY_bcdehknrtvz!O!U!W!_!b!c!f!h!k!l!s!u!|#Q#R#S#W#c#k#p#x#{$Z$]QmPR!qnqfPQThknrtv!k!l!s!u#R#k#pR!gdR!ieTlPnTjPnSiPnSqQvQ{TQ!mkQ!trQ!vtR#y#RR!nkTsQvR!wt!RWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]RySR#t!|R|TR|UQ!PUR#|#SR#z#RR#z#SyZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]R!VXR!XYa]O^abc!a!c!eT!da!eQnPR!rnQvQR!{vQ!}yR#u!}Q#T|R#}#TW^Obc!cS!^^!aT!aa!eQ!eaR#f!eW`Obc!cQxSS}U#SQ!`_Q#PzQ#V!OQ#b!_Q#d!bQ#s!|Q#w#QQ$P#WQ$V#cQ$Y#xQ$[#{Q$a$ZR$b$]xZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]Q!VXQ!XYQ#[!UR#]!W!QWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]pfPQThknrtv!k!l!s!u#R#k#pQ!gdQ!ieQ#g!fR#h!hSgPn^pQTkrtv#RQ!jhQ#i!kQ#j!lQ#n!sQ#o!uQ$W#kR$X#pQuQR!zv",nodeNames:"⚠ DirectiveEnd DocEnd - - ? ? ? Literal QuotedLiteral Anchor Alias Tag BlockLiteralContent Comment Stream BOM Document ] [ FlowSequence Item Tagged Anchored Anchored Tagged FlowMapping Pair Key : Pair , } { FlowMapping Pair Pair BlockSequence Item Item BlockMapping Pair Pair Key Pair Pair BlockLiteral BlockLiteralHeader Tagged Anchored Anchored Tagged Directive DirectiveName DirectiveContent Document",maxTerm:74,context:Rvt,nodeProps:[["isolate",-3,8,9,14,""],["openedBy",18,"[",32,"{"],["closedBy",19,"]",33,"}"]],propSources:[Qvt],skippedNodes:[0],repeatNodeCount:6,tokenData:"-Y~RnOX#PXY$QYZ$]Z]#P]^$]^p#Ppq$Qqs#Pst$btu#Puv$yv|#P|}&e}![#P![!]'O!]!`#P!`!a'i!a!}#P!}#O*g#O#P#P#P#Q+Q#Q#o#P#o#p+k#p#q'i#q#r,U#r;'S#P;'S;=`#z<%l?HT#P?HT?HU,o?HUO#PQ#UU!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PQ#kTOY#PZs#Pt;'S#P;'S;=`#z<%lO#PQ#}P;=`<%l#P~$VQ!f~XY$Qpq$Q~$bO!g~~$gS^~OY$bZ;'S$b;'S;=`$s<%lO$b~$vP;=`<%l$bR%OX!WQOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR%rX!WQ!VPOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR&bP;=`<%l%kR&lUoP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'VUmP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'p[!PP!WQOY#PZp#Ppq#hq{#P{|(f|}#P}!O(f!O!R#P!R![)p![;'S#P;'S;=`#z<%lO#PR(mW!PP!WQOY#PZp#Ppq#hq!R#P!R![)V![;'S#P;'S;=`#z<%lO#PR)^U!PP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR)wY!PP!WQOY#PZp#Ppq#hq{#P{|)V|}#P}!O)V!O;'S#P;'S;=`#z<%lO#PR*nUcP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+XUbP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+rUqP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,]UpP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,vU`P!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#P",tokenizers:[Ivt,Dvt,$vt,Bvt,0,1],topRules:{Stream:[0,15]},tokenPrec:0}),Fvt=lh.define({name:"yaml",parser:Uvt.configure({props:[wh.add({Stream:e=>{for(let t=e.node.resolve(e.pos,-1);t&&t.to>=e.pos;t=t.parent){if(t.name=="BlockLiteralContent"&&t.frome.pos)return null}}return null},FlowMapping:Cy({closing:"}"}),FlowSequence:Cy({closing:"]"})}),Sh.add({"FlowMapping FlowSequence":BE,"Item Pair BlockLiteral":(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}),languageData:{commentTokens:{line:"#"},indentOnInput:/^\s*[\]\}]$/}});function zvt(){return new rm(Fvt)}function Vvt(e){rxe(e,"start");var t={},n=e.languageData||{},r=!1;for(var i in e)if(i!=n&&e.hasOwnProperty(i))for(var s=t[i]=[],a=e[i],l=0;l2&&a.token&&typeof a.token!="string"){n.pending=[];for(var u=2;u-1)return null;var i=n.indent.length-1,s=e[n.state];e:for(;;){for(var a=0;a{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=iU(e.state,n.from);return r.line?awt(e):r.block?lwt(e):!1};function rU(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return i?(r(n.update(i)),!0):!1}}const awt=rU(dwt,0),owt=rU(lxe,0),lwt=rU((e,t)=>lxe(e,t,uwt(t)),0);function iU(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const xx=50;function cwt(e,{open:t,close:n},r,i){let s=e.sliceDoc(r-xx,r),a=e.sliceDoc(i,i+xx),l=/\s*$/.exec(s)[0].length,c=/^\s*/.exec(a)[0].length,u=s.length-l;if(s.slice(u-t.length,u)==t&&a.slice(c,c+n.length)==n)return{open:{pos:r-l,margin:l&&1},close:{pos:i+c,margin:c&&1}};let d,f;i-r<=2*xx?d=f=e.sliceDoc(r,i):(d=e.sliceDoc(r,r+xx),f=e.sliceDoc(i-xx,i));let h=/^\s*/.exec(d)[0].length,m=/\s*$/.exec(f)[0].length,g=f.length-m-n.length;return d.slice(h,h+t.length)==t&&f.slice(g,g+n.length)==n?{open:{pos:r+h+t.length,margin:/\s/.test(d.charAt(h+t.length))?1:0},close:{pos:i-m-n.length,margin:/\s/.test(f.charAt(g-1))?1:0}}:null}function uwt(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let s=t.length-1;s>=0&&t[s].to>r.from?t[s].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}function lxe(e,t,n=t.selection.ranges){let r=n.map(s=>iU(t,s.from).block);if(!r.every(s=>s))return null;let i=n.map((s,a)=>cwt(t,r[a],s.from,s.to));if(e!=2&&!i.every(s=>s))return{changes:t.changes(n.map((s,a)=>i[a]?[]:[{from:s.from,insert:r[a].open+" "},{from:s.to,insert:" "+r[a].close}]))};if(e!=1&&i.some(s=>s)){let s=[];for(let a=0,l;ai&&(s==a||a>f.from)){i=f.from;let h=/^\s*/.exec(f.text)[0].length,m=h==f.length,g=f.text.slice(h,h+u.length)==u?h:-1;hs.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:l,token:c,indent:u,empty:d,single:f}of r)(f||!d)&&s.push({from:l.from+u,insert:c+" "});let a=t.changes(s);return{changes:a,selection:t.selection.map(a,1)}}else if(e!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:a,comment:l,token:c}of r)if(l>=0){let u=a.from+l,d=u+c.length;a.text[d-a.from]==" "&&d++,s.push({from:u,to:d})}return{changes:s}}return null}const I6=Ad.define(),fwt=Ad.define(),hwt=Qt.define(),cxe=Qt.define({combine(e){return Nd(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(r,i)=>t(r,i)||n(r,i)})}}),uxe=Qa.define({create(){return ad.empty},update(e,t){let n=t.state.facet(cxe),r=t.annotation(I6);if(r){let c=Wo.fromTransaction(t,r.selection),u=r.side,d=u==0?e.undone:e.done;return c?d=$A(d,d.length,n.minDepth,c):d=hxe(d,t.startState.selection),new ad(u==0?r.rest:d,u==0?d:r.rest)}let i=t.annotation(fwt);if((i=="full"||i=="before")&&(e=e.isolate()),t.annotation(Vs.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let s=Wo.fromTransaction(t),a=t.annotation(Vs.time),l=t.annotation(Vs.userEvent);return s?e=e.addChanges(s,a,l,n,t):t.selection&&(e=e.addSelection(t.startState.selection,a,l,n.newGroupDelay)),(i=="full"||i=="after")&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(t=>t.toJSON()),undone:e.undone.map(t=>t.toJSON())}},fromJSON(e){return new ad(e.done.map(Wo.fromJSON),e.undone.map(Wo.fromJSON))}});function pwt(e={}){return[uxe,cxe.of(e),Ct.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?dxe:t.inputType=="historyRedo"?D6:null;return r?(t.preventDefault(),r(n)):!1}})]}function dR(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(uxe,!1);if(!i)return!1;let s=i.pop(e,n,t);return s?(r(s),!0):!1}}const dxe=dR(0,!1),D6=dR(1,!1),mwt=dR(0,!0),gwt=dR(1,!0);class Wo{constructor(t,n,r,i,s){this.changes=t,this.effects=n,this.mapped=r,this.startSelection=i,this.selectionsAfter=s}setSelAfter(t){return new Wo(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,n,r;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(i=>i.toJSON())}}static fromJSON(t){return new Wo(t.changes&&Js.fromJSON(t.changes),[],t.mapped&&fd.fromJSON(t.mapped),t.startSelection&&Je.fromJSON(t.startSelection),t.selectionsAfter.map(Je.fromJSON))}static fromTransaction(t,n){let r=Nc;for(let i of t.startState.facet(hwt)){let s=i(t);s.length&&(r=r.concat(s))}return!r.length&&t.changes.empty?null:new Wo(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,Nc)}static selection(t){return new Wo(void 0,Nc,void 0,void 0,t)}}function $A(e,t,n,r){let i=t+1>n+20?t-n-1:0,s=e.slice(i,t);return s.push(r),s}function bwt(e,t){let n=[],r=!1;return e.iterChangedRanges((i,s)=>n.push(i,s)),t.iterChangedRanges((i,s,a,l)=>{for(let c=0;c=u&&a<=d&&(r=!0)}}),r}function ywt(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function fxe(e,t){return e.length?t.length?e.concat(t):e:t}const Nc=[],Owt=200;function hxe(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Owt));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),$A(e,e.length-1,1e9,n.setSelAfter(r)))}else return[Wo.selection([t])]}function xwt(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function EP(e,t){if(!e.length)return e;let n=e.length,r=Nc;for(;n;){let i=vwt(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let s=e.slice(0,n);return s[n-1]=i,s}else t=i.mapped,n--,r=i.selectionsAfter}return r.length?[Wo.selection(r)]:Nc}function vwt(e,t,n){let r=fxe(e.selectionsAfter.length?e.selectionsAfter.map(l=>l.map(t)):Nc,n);if(!e.changes)return Wo.selection(r);let i=e.changes.map(t),s=t.mapDesc(e.changes,!0),a=e.mapped?e.mapped.composeDesc(s):s;return new Wo(i,jn.mapEffects(e.effects,t),a,e.startSelection.map(s),r)}const wwt=/^(input\.type|delete)($|\.)/;class ad{constructor(t,n,r=0,i=void 0){this.done=t,this.undone=n,this.prevTime=r,this.prevUserEvent=i}isolate(){return this.prevTime?new ad(this.done,this.undone):this}addChanges(t,n,r,i,s){let a=this.done,l=a[a.length-1];return l&&l.changes&&!l.changes.empty&&t.changes&&(!r||wwt.test(r))&&(!l.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?e.moveByChar(n,t):fR(n,t))}function io(e){return e.textDirectionAt(e.state.selection.main.head)==xi.LTR}const mxe=e=>pxe(e,!io(e)),gxe=e=>pxe(e,io(e));function bxe(e,t){return Ru(e,n=>n.empty?e.moveByGroup(n,t):fR(n,t))}const Ewt=e=>bxe(e,!io(e)),kwt=e=>bxe(e,io(e));function _wt(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function hR(e,t,n){let r=mi(e).resolveInner(t.head),i=n?Nn.closedBy:Nn.openedBy;for(let c=t.head;;){let u=n?r.childAfter(c):r.childBefore(c);if(!u)break;_wt(e,u,i)?r=u:c=n?u.to:u.from}let s=r.type.prop(i),a,l;return s&&(a=n?sd(e,r.from,1):sd(e,r.to,-1))&&a.matched?l=n?a.end.to:a.end.from:l=n?r.to:r.from,Je.cursor(l,n?-1:1)}const Twt=e=>Ru(e,t=>hR(e.state,t,!io(e))),Cwt=e=>Ru(e,t=>hR(e.state,t,io(e)));function yxe(e,t){return Ru(e,n=>{if(!n.empty)return fR(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const Oxe=e=>yxe(e,!1),xxe=e=>yxe(e,!0);function vxe(e){let t=e.scrollDOM.clientHeighta.empty?e.moveVertically(a,t,n.height):fR(a,t));if(i.eq(r.selection))return!1;let s;if(n.selfScroll){let a=e.coordsAtPos(r.selection.main.head),l=e.scrollDOM.getBoundingClientRect(),c=l.top+n.marginTop,u=l.bottom-n.marginBottom;a&&a.top>c&&a.bottomwxe(e,!1),P6=e=>wxe(e,!0);function gm(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let s=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&t.head!=r.from+s&&(i=Je.cursor(r.from+s))}return i}const Awt=e=>Ru(e,t=>gm(e,t,!0)),Nwt=e=>Ru(e,t=>gm(e,t,!1)),jwt=e=>Ru(e,t=>gm(e,t,!io(e))),Rwt=e=>Ru(e,t=>gm(e,t,io(e))),Iwt=e=>Ru(e,t=>Je.cursor(e.lineBlockAt(t.head).from,1)),Dwt=e=>Ru(e,t=>Je.cursor(e.lineBlockAt(t.head).to,-1));function Pwt(e,t,n){let r=!1,i=vO(e.selection,s=>{let a=sd(e,s.head,-1)||sd(e,s.head,1)||s.head>0&&sd(e,s.head-1,1)||s.headPwt(e,t);function Fc(e,t,n){let r=vO(e.state.selection,i=>{i.undirectional&&i.head>=i.anchor!=t&&(i=Je.range(i.head,i.anchor));let s=n(i);return Je.range(i.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return r.eq(e.state.selection)?!1:(e.dispatch(ju(e.state,r)),!0)}function Sxe(e,t){return Fc(e,t,n=>e.moveByChar(n,t))}const Exe=e=>Sxe(e,!io(e)),kxe=e=>Sxe(e,io(e));function _xe(e,t){return Fc(e,t,n=>e.moveByGroup(n,t))}const Lwt=e=>_xe(e,!io(e)),$wt=e=>_xe(e,io(e)),Bwt=e=>{let t=!io(e);return Fc(e,t,n=>hR(e.state,n,t))},Qwt=e=>{let t=io(e);return Fc(e,t,n=>hR(e.state,n,t))};function Txe(e,t){return Fc(e,t,n=>e.moveVertically(n,t))}const Cxe=e=>Txe(e,!1),Axe=e=>Txe(e,!0);function Nxe(e,t){return Fc(e,t,n=>e.moveVertically(n,t,vxe(e).height))}const IK=e=>Nxe(e,!1),DK=e=>Nxe(e,!0),Uwt=e=>Fc(e,!0,t=>gm(e,t,!0)),Fwt=e=>Fc(e,!1,t=>gm(e,t,!1)),zwt=e=>{let t=!io(e);return Fc(e,t,n=>gm(e,n,t))},Vwt=e=>{let t=io(e);return Fc(e,t,n=>gm(e,n,t))},Hwt=e=>Fc(e,!1,t=>Je.cursor(e.lineBlockAt(t.head).from)),qwt=e=>Fc(e,!0,t=>Je.cursor(e.lineBlockAt(t.head).to)),PK=({state:e,dispatch:t})=>(t(ju(e,{anchor:0})),!0),MK=({state:e,dispatch:t})=>(t(ju(e,{anchor:e.doc.length})),!0),LK=({state:e,dispatch:t})=>(t(ju(e,{anchor:e.selection.main.anchor,head:0})),!0),$K=({state:e,dispatch:t})=>(t(ju(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),Xwt=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),Gwt=({state:e,dispatch:t})=>{let n=pR(e).map(({from:r,to:i})=>Je.range(r,Math.min(i+1,e.doc.length)));return t(e.update({selection:Je.create(n),userEvent:"select"})),!0},Wwt=({state:e,dispatch:t})=>{let n=vO(e.selection,r=>{let i=mi(e),s=i.resolveStack(r.from,1);if(r.empty){let a=i.resolveStack(r.from,-1);a.node.from>=s.node.from&&a.node.to<=s.node.to&&(s=a)}for(let a=s;a;a=a.next){let{node:l}=a;if((l.from=r.to||l.to>r.to&&l.from<=r.from)&&a.next)return Je.range(l.to,l.from)}return r});return n.eq(e.selection)?!1:(t(ju(e,n)),!0)};function jxe(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let s of n.selection.ranges){let a=n.doc.lineAt(s.head);if(t?a.to0)for(let l=s;;){let c=e.moveVertically(l,t);if(c.heada.to){i.some(u=>u.head==c.head)||i.push(c);break}else{if(c.head==l.head)break;l=c}}}return i.length==r.ranges.length?!1:(e.dispatch(ju(n,Je.create(i,i.length-1))),!0)}const Ywt=e=>jxe(e,!1),Zwt=e=>jxe(e,!0),Kwt=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=Je.create([n.main]):n.main.empty||(r=Je.create([Je.cursor(n.main.head)])),r?(t(ju(e,r)),!0):!1};function zE(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,i=r.changeByRange(s=>{let{from:a,to:l}=s;if(a==l){let c=t(s);ca&&(n="delete.forward",c=i_(e,c,!0)),a=Math.min(a,c),l=Math.max(l,c)}else a=i_(e,a,!1),l=i_(e,l,!0);return a==l?{range:s}:{changes:{from:a,to:l},range:Je.cursor(a,ai(e)))r.between(t,t,(i,s)=>{it&&(t=n?s:i)});return t}const Rxe=(e,t,n)=>zE(e,r=>{let i=r.from,{state:s}=e,a=s.doc.lineAt(i),l,c;if(n&&!t&&i>a.from&&iRxe(e,!1,!0),Ixe=e=>Rxe(e,!0,!1),Dxe=(e,t)=>zE(e,n=>{let r=n.head,{state:i}=e,s=i.doc.lineAt(r),a=i.charCategorizer(r);for(let l=null;;){if(r==(t?s.to:s.from)){r==n.head&&s.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let c=ba(s.text,r-s.from,t)+s.from,u=s.text.slice(Math.min(r,c)-s.from,Math.max(r,c)-s.from),d=a(u);if(l!=null&&d!=l)break;(u!=" "||r!=n.head)&&(l=d),r=c}return r}),Pxe=e=>Dxe(e,!1),Jwt=e=>Dxe(e,!0),eSt=e=>zE(e,t=>{let n=e.lineBlockAt(t.head).to;return t.headzE(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),nSt=e=>zE(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head{if(e.readOnly)return!1;let n=e.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Br.of(["",""])},range:Je.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},iSt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>{if(!r.empty||r.from==0||r.from==e.doc.length)return{range:r};let i=r.from,s=e.doc.lineAt(i),a=i==s.from?i-1:ba(s.text,i-s.from,!1)+s.from,l=i==s.to?i+1:ba(s.text,i-s.from,!0)+s.from;return{changes:{from:a,to:l,insert:e.doc.slice(i,l).append(e.doc.slice(a,i))},range:Je.cursor(l)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function pR(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),s=e.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=e.doc.lineAt(r.to-1)),n>=i.number){let a=t[t.length-1];a.to=s.to,a.ranges.push(r)}else t.push({from:i.from,to:s.to,ranges:[r]});n=s.number+1}return t}function Mxe(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let s of pR(e)){if(n?s.to==e.doc.length:s.from==0)continue;let a=e.doc.lineAt(n?s.to+1:s.from-1),l=a.length+1;if(n){r.push({from:s.to,to:a.to},{from:s.from,insert:a.text+e.lineBreak});for(let c of s.ranges)i.push(Je.range(Math.min(e.doc.length,c.anchor+l),Math.min(e.doc.length,c.head+l)))}else{r.push({from:a.from,to:s.from},{from:s.to,insert:e.lineBreak+a.text});for(let c of s.ranges)i.push(Je.range(c.anchor-l,c.head-l))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:Je.create(i,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const sSt=({state:e,dispatch:t})=>Mxe(e,t,!1),aSt=({state:e,dispatch:t})=>Mxe(e,t,!0);function Lxe(e,t,n){if(e.readOnly)return!1;let r=[];for(let s of pR(e))n?r.push({from:s.from,insert:e.doc.slice(s.from,s.to)+e.lineBreak}):r.push({from:s.to,insert:e.lineBreak+e.doc.slice(s.from,s.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const oSt=({state:e,dispatch:t})=>Lxe(e,t,!1),lSt=({state:e,dispatch:t})=>Lxe(e,t,!0),cSt=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(pR(t).map(({from:i,to:s})=>(i>0?i--:s{let s;if(e.lineWrapping){let a=e.lineBlockAt(i.head),l=e.coordsAtPos(i.head,i.assoc||1);l&&(s=a.bottom+e.documentTop-l.bottom+e.defaultLineHeight/2)}return e.moveVertically(i,!0,s)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function uSt(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=mi(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),s;return r&&i&&r.to<=t&&i.from>=t&&(s=r.type.prop(Nn.closedBy))&&s.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}const BK=$xe(!1),dSt=$xe(!0);function $xe(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(i=>{let{from:s,to:a}=i,l=t.doc.lineAt(s),c=!e&&s==a&&uSt(t,s);e&&(s=a=(a<=l.to?l:t.doc.lineAt(a)).to);let u=new sR(t,{simulateBreak:s,simulateDoubleBreak:!!c}),d=TQ(u,s);for(d==null&&(d=vu(/^\s*/.exec(t.doc.lineAt(s).text)[0],t.tabSize));al.from&&s{let i=[];for(let a=r.from;a<=r.to;){let l=e.doc.lineAt(a);l.number>n&&(r.empty||r.to>l.from)&&(t(l,i,r),n=l.number),a=l.to+1}let s=e.changes(i);return{changes:i,range:Je.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const fSt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new sR(e,{overrideIndentation:s=>{let a=n[s];return a??-1}}),i=sU(e,(s,a,l)=>{let c=TQ(r,s.from);if(c==null)return;/\S/.test(s.text)||(c=0);let u=/^\s*/.exec(s.text)[0],d=uS(e,c);(u!=d||l.frome.readOnly?!1:(t(e.update(sU(e,(n,r)=>{r.push({from:n.from,insert:e.facet(OO)})}),{userEvent:"input.indent"})),!0),Qxe=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(sU(e,(n,r)=>{let i=/^\s*/.exec(n.text)[0];if(!i)return;let s=vu(i,e.tabSize),a=0,l=uS(e,Math.max(0,s-Kg(e)));for(;a(e.setTabFocusMode(),!0),pSt=[{key:"Ctrl-b",run:mxe,shift:Exe,preventDefault:!0},{key:"Ctrl-f",run:gxe,shift:kxe},{key:"Ctrl-p",run:Oxe,shift:Cxe},{key:"Ctrl-n",run:xxe,shift:Axe},{key:"Ctrl-a",run:Iwt,shift:Hwt},{key:"Ctrl-e",run:Dwt,shift:qwt},{key:"Ctrl-d",run:Ixe},{key:"Ctrl-h",run:M6},{key:"Ctrl-k",run:eSt},{key:"Ctrl-Alt-h",run:Pxe},{key:"Ctrl-o",run:rSt},{key:"Ctrl-t",run:iSt},{key:"Ctrl-v",run:P6}],mSt=[{key:"ArrowLeft",run:mxe,shift:Exe,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Ewt,shift:Lwt,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:jwt,shift:zwt,preventDefault:!0},{key:"ArrowRight",run:gxe,shift:kxe,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:kwt,shift:$wt,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Rwt,shift:Vwt,preventDefault:!0},{key:"ArrowUp",run:Oxe,shift:Cxe,preventDefault:!0},{mac:"Cmd-ArrowUp",run:PK,shift:LK},{mac:"Ctrl-ArrowUp",run:RK,shift:IK},{key:"ArrowDown",run:xxe,shift:Axe,preventDefault:!0},{mac:"Cmd-ArrowDown",run:MK,shift:$K},{mac:"Ctrl-ArrowDown",run:P6,shift:DK},{key:"PageUp",run:RK,shift:IK},{key:"PageDown",run:P6,shift:DK},{key:"Home",run:Nwt,shift:Fwt,preventDefault:!0},{key:"Mod-Home",run:PK,shift:LK},{key:"End",run:Awt,shift:Uwt,preventDefault:!0},{key:"Mod-End",run:MK,shift:$K},{key:"Enter",run:BK,shift:BK},{key:"Mod-a",run:Xwt},{key:"Backspace",run:M6,shift:M6,preventDefault:!0},{key:"Delete",run:Ixe,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Pxe,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Jwt,preventDefault:!0},{mac:"Mod-Backspace",run:tSt,preventDefault:!0},{mac:"Mod-Delete",run:nSt,preventDefault:!0}].concat(pSt.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),gSt=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Twt,shift:Bwt},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Cwt,shift:Qwt},{key:"Alt-ArrowUp",run:sSt},{key:"Shift-Alt-ArrowUp",run:oSt},{key:"Alt-ArrowDown",run:aSt},{key:"Shift-Alt-ArrowDown",run:lSt},{key:"Mod-Alt-ArrowUp",run:Ywt},{key:"Mod-Alt-ArrowDown",run:Zwt},{key:"Escape",run:Kwt},{key:"Mod-Enter",run:dSt},{key:"Alt-l",mac:"Ctrl-l",run:Gwt},{key:"Mod-i",run:Wwt,preventDefault:!0},{key:"Mod-[",run:Qxe},{key:"Mod-]",run:Bxe},{key:"Mod-Alt-\\",run:fSt},{key:"Shift-Mod-k",run:cSt},{key:"Shift-Mod-\\",run:Mwt},{key:"Mod-/",run:swt},{key:"Alt-A",run:owt},{key:"Ctrl-m",mac:"Shift-Alt-m",run:hSt}].concat(mSt),bSt={key:"Tab",run:Bxe,shift:Qxe},QK=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class C1{constructor(t,n,r=0,i=t.length,s,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(r,i),this.bufferStart=r,this.normalize=s?l=>s(QK(l)):QK,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Uo(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let n=oQ(t),r=this.bufferStart+this.bufferPos;this.bufferPos+=Yu(t);let i=this.normalize(n);if(i.length)for(let s=0,a=r,l=!0;;s++){let c=i.charCodeAt(s),u=this.match(c,a,l,this.bufferPos+this.bufferStart,s==i.length-1);if(u)return this.value=u,this;if(s==i.length-1)break;l&&sthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,i=r+n[0].length;if(this.matchPos=BA(this.text,i+(r==i?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(rthis.value.to)&&(!this.test||this.test(r,i,n)))return this.value={from:r,to:i,precise:!0,match:n},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=r||i.to<=n){let l=new Ry(n,t.sliceString(n,r));return kP.set(t,l),l}if(i.from==n&&i.to==r)return i;let{text:s,from:a}=i;return a>n&&(s=t.sliceString(n,a)+s,a=n),i.to=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==t&&(this.re.lastIndex=t+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,i=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,i,n)))return this.value={from:r,to:i,precise:!0,match:n},this.matchPos=BA(this.text,i+(r==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ry.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Fxe.prototype[Symbol.iterator]=zxe.prototype[Symbol.iterator]=function(){return this});function ySt(e){try{return new RegExp(e,aU),!0}catch{return!1}}function BA(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t=56320&&r<57344;)t++;return t}const OSt=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:i}=Agt(e,{label:t.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:t.phrase("go")});return i.then(s=>{let a=s&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(s.elements.line.value);if(!a){e.dispatch({effects:r});return}let l=t.doc.lineAt(t.selection.main.head),[,c,u,d,f]=a,h=d?+d.slice(1):0,m=u?+u:l.number;if(u&&f){let y=m/100;c&&(y=y*(c=="-"?-1:1)+l.number/t.doc.lines),m=Math.round(t.doc.lines*y)}else u&&c&&(m=m*(c=="-"?-1:1)+l.number);let g=t.doc.line(Math.max(1,Math.min(t.doc.lines,m))),b=Je.cursor(g.from+Math.max(0,Math.min(h,g.length)));e.dispatch({effects:[r,Ct.scrollIntoView(b.from,{y:"center"})],selection:b})}),!0},xSt={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},vSt=Qt.define({combine(e){return Nd(e,xSt,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function wSt(e){return[TSt,_St]}const SSt=dn.mark({class:"cm-selectionMatch"}),ESt=dn.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function UK(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=Yi.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=Yi.Word)}function kSt(e,t,n,r){return e(t.sliceDoc(n,n+1))==Yi.Word&&e(t.sliceDoc(r-1,r))==Yi.Word}const _St=ps.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(vSt),{state:n}=e,r=n.selection;if(r.ranges.length>1)return dn.none;let i=r.main,s,a=null;if(i.empty){if(!t.highlightWordAroundCursor)return dn.none;let c=n.wordAt(i.head);if(!c)return dn.none;a=n.charCategorizer(i.head),s=n.sliceDoc(c.from,c.to)}else{let c=i.to-i.from;if(c200)return dn.none;if(t.wholeWords){if(s=n.sliceDoc(i.from,i.to),a=n.charCategorizer(i.head),!(UK(a,n,i.from,i.to)&&kSt(a,n,i.from,i.to)))return dn.none}else if(s=n.sliceDoc(i.from,i.to),!s)return dn.none}let l=[];for(let c of e.visibleRanges){let u=new C1(n.doc,s,c.from,c.to);for(;!u.next().done;){let{from:d,to:f}=u.value;if((!a||UK(a,n,d,f))&&(i.empty&&d<=i.from&&f>=i.to?l.push(ESt.range(d,f)):(d>=i.to||f<=i.from)&&l.push(SSt.range(d,f)),l.length>t.maxMatches))return dn.none}}return dn.set(l)}},{decorations:e=>e.decorations}),TSt=Ct.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),CSt=({state:e,dispatch:t})=>{let{selection:n}=e,r=Je.create(n.ranges.map(i=>e.wordAt(i.head)||Je.cursor(i.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function ASt(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),s=i&&i.from==n.from&&i.to==n.to;for(let a=!1,l=new C1(e.doc,t,r[r.length-1].to);;)if(l.next(),l.done){if(a)return null;l=new C1(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),a=!0}else{if(a&&r.some(c=>c.from==l.value.from))continue;if(s){let c=e.wordAt(l.value.from);if(!c||c.from!=l.value.from||c.to!=l.value.to)continue}return l.value}}const NSt=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(s=>s.from===s.to))return CSt({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(s=>e.sliceDoc(s.from,s.to)!=r))return!1;let i=ASt(e,r);return i?(t(e.update({selection:e.selection.addRange(Je.range(i.from,i.to),!1),effects:Ct.scrollIntoView(i.to)})),!0):!1},wO=Qt.define({combine(e){return Nd(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new VSt(t),scrollToMatch:t=>Ct.scrollIntoView(t)})}});class Vxe{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||ySt(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord,this.test=t.test}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?` -`:r=="r"?"\r":r=="t"?" ":"\\")}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord&&this.test==t.test}create(){return this.regexp?new MSt(this):new ISt(this)}getCursor(t,n=0,r){let i=t.doc?t:vr.create({doc:t});return r==null&&(r=i.doc.length),this.regexp?Sb(this,i,n,r):wb(this,i,n,r)}}class Hxe{constructor(t){this.spec=t}}function jSt(e,t,n){return(r,i,s,a)=>{if(n&&!n(r,i,s,a))return!1;let l=r>=a&&i<=a+s.length?s.slice(r-a,i-a):t.doc.sliceString(r,i);return e(l,t,r,i)}}function wb(e,t,n,r){let i;return e.wholeWord&&(i=RSt(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=jSt(e.test,t,i)),new C1(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:s=>s.toLowerCase(),i)}function RSt(e,t){return(n,r,i,s)=>((s>n||s+i.length=n)return null;i.push(r.value)}return i}highlight(t,n,r,i){let s=wb(this.spec,t,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,t.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}function DSt(e,t,n){return(r,i,s)=>(!n||n(r,i,s))&&e(s[0],t,r,i)}function Sb(e,t,n,r){let i;return e.wholeWord&&(i=PSt(t.charCategorizer(t.selection.main.head))),e.test&&(i=DSt(e.test,t,i)),new Fxe(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function QA(e,t){return e.slice(ba(e,t,!1),t)}function UA(e,t){return e.slice(t,ba(e,t))}function PSt(e){return(t,n,r)=>!r[0].length||(e(QA(r.input,r.index))!=Yi.Word||e(UA(r.input,r.index))!=Yi.Word)&&(e(UA(r.input,r.index+r[0].length))!=Yi.Word||e(QA(r.input,r.index+r[0].length))!=Yi.Word)}class MSt extends Hxe{nextMatch(t,n,r){let i=Sb(this.spec,t,r,t.doc.length).next();return i.done&&(i=Sb(this.spec,t,0,n).next()),i.done?null:i.value}prevMatchInRange(t,n,r){for(let i=1;;i++){let s=Math.max(n,r-i*1e4),a=Sb(this.spec,t,s,r),l=null;for(;!a.next().done;)l=a.value;if(l&&(s==n||l.from>s+10))return l;if(s==n)return null}}prevMatch(t,n,r){return this.prevMatchInRange(t,0,n)||this.prevMatchInRange(t,r,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return t.match[0];if(r=="$")return"$";for(let i=r.length;i>0;i--){let s=+r.slice(0,i);if(s>0&&s=n)return null;i.push(r.value)}return i}highlight(t,n,r,i){let s=Sb(this.spec,t,Math.max(0,n-250),Math.min(r+250,t.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}const vS=jn.define(),oU=jn.define(),Ip=Qa.define({create(e){return new _P(L6(e).create(),null)},update(e,t){for(let n of t.effects)n.is(vS)?e=new _P(n.value.create(),e.panel):n.is(oU)&&(e=new _P(e.query,n.value?lU:null));return e},provide:e=>lS.from(e,t=>t.panel)});class _P{constructor(t,n){this.query=t,this.panel=n}}const LSt=dn.mark({class:"cm-searchMatch"}),$St=dn.mark({class:"cm-searchMatch cm-searchMatch-selected"}),BSt=ps.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(Ip))}update(e){let t=e.state.field(Ip);(t!=e.startState.field(Ip)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return dn.none;let{view:n}=this,r=new sh;for(let i=0,s=n.visibleRanges,a=s.length;is[i+1].from-2*250;)c=s[++i].to;e.highlight(n.state,l,c,(u,d)=>{let f=n.state.selection.ranges.some(h=>h.from==u&&h.to==d);r.add(u,d,f?$St:LSt)})}return r.finish()}},{decorations:e=>e.decorations});function VE(e){return t=>{let n=t.state.field(Ip,!1);return n&&n.query.spec.valid?e(t,n):Gxe(t)}}const FA=VE((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=Je.single(r.from,r.to),s=e.state.facet(wO);return e.dispatch({selection:i,effects:[cU(e,r),s.scrollToMatch(i.main,e)],userEvent:"select.search"}),Xxe(e),!0}),zA=VE((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let s=Je.single(i.from,i.to),a=e.state.facet(wO);return e.dispatch({selection:s,effects:[cU(e,i),a.scrollToMatch(s.main,e)],userEvent:"select.search"}),Xxe(e),!0}),QSt=VE((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:Je.create(n.map(r=>Je.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),USt=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,s=[],a=0;for(let l=new C1(e.doc,e.sliceDoc(r,i));!l.next().done;){if(s.length>1e3)return!1;l.value.from==r&&(a=s.length),s.push(Je.range(l.value.from,l.value.to))}return t(e.update({selection:Je.create(s,a),userEvent:"select.search.matches"})),!0},FK=VE((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let s=t.nextMatch(n,r,r);if(!s)return!1;let a=s,l=[],c,u,d=[];a.precise?a.from==r&&a.to==i&&(u=n.toText(t.getReplacement(a)),l.push({from:a.from,to:a.to,insert:u}),a=t.nextMatch(n,a.from,a.to),d.push(Ct.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."))):a=t.nextMatch(n,a.from,a.to);let f=e.state.changes(l);return a&&(c=Je.single(a.from,a.to).map(f),d.push(cU(e,a)),d.push(n.facet(wO).scrollToMatch(c.main,e))),e.dispatch({changes:f,selection:c,effects:d,userEvent:"input.replace"}),!0}),FSt=VE((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let i of t.matchAll(e.state,1e9)){let{from:s,to:a,precise:l}=i;l&&n.push({from:s,to:a,insert:t.getReplacement(i)})}if(!n.length)return!1;let r=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:Ct.announce.of(r),userEvent:"input.replace.all"}),!0});function lU(e){return e.state.facet(wO).createPanel(e)}function L6(e,t){var n,r,i,s,a;let l=e.selection.main,c=l.empty||l.to>l.from+100?"":e.sliceDoc(l.from,l.to);if(t&&!c)return t;let u=e.facet(wO);return new Vxe({search:((n=t==null?void 0:t.literal)!==null&&n!==void 0?n:u.literal)?c:c.replace(/\n/g,"\\n"),caseSensitive:(r=t==null?void 0:t.caseSensitive)!==null&&r!==void 0?r:u.caseSensitive,literal:(i=t==null?void 0:t.literal)!==null&&i!==void 0?i:u.literal,regexp:(s=t==null?void 0:t.regexp)!==null&&s!==void 0?s:u.regexp,wholeWord:(a=t==null?void 0:t.wholeWord)!==null&&a!==void 0?a:u.wholeWord})}function qxe(e){let t=kQ(e,lU);return t&&t.dom.querySelector("[main-field]")}function Xxe(e){let t=qxe(e);t&&t==e.root.activeElement&&t.select()}const Gxe=e=>{let t=e.state.field(Ip,!1);if(t&&t.panel){let n=qxe(e);if(n&&n!=e.root.activeElement){let r=L6(e.state,t.query.spec);r.valid&&e.dispatch({effects:vS.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[oU.of(!0),t?vS.of(L6(e.state,t.query.spec)):jn.appendConfig.of(qSt)]});return!0},Wxe=e=>{let t=e.state.field(Ip,!1);if(!t||!t.panel)return!1;let n=kQ(e,lU);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:oU.of(!1)}),!0},zSt=[{key:"Mod-f",run:Gxe,scope:"editor search-panel"},{key:"F3",run:FA,shift:zA,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:FA,shift:zA,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Wxe,scope:"editor search-panel"},{key:"Mod-Shift-l",run:USt},{key:"Mod-Alt-g",run:OSt},{key:"Mod-d",run:NSt,preventDefault:!0}];class VSt{constructor(t){this.view=t;let n=this.query=t.state.field(Ip).query.spec;this.commit=this.commit.bind(this),this.searchField=fi("input",{value:n.search,placeholder:pl(t,"Find"),"aria-label":pl(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=fi("input",{value:n.replace,placeholder:pl(t,"Replace"),"aria-label":pl(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=fi("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=fi("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=fi("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(i,s,a){return fi("button",{class:"cm-button",name:i,onclick:s,type:"button"},a)}this.dom=fi("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,r("next",()=>FA(t),[pl(t,"next")]),r("prev",()=>zA(t),[pl(t,"previous")]),r("select",()=>QSt(t),[pl(t,"all")]),fi("label",null,[this.caseField,pl(t,"match case")]),fi("label",null,[this.reField,pl(t,"regexp")]),fi("label",null,[this.wordField,pl(t,"by word")]),...t.state.readOnly?[]:[fi("br"),this.replaceField,r("replace",()=>FK(t),[pl(t,"replace")]),r("replaceAll",()=>FSt(t),[pl(t,"replace all")])],fi("button",{name:"close",onclick:()=>Wxe(t),"aria-label":pl(t,"close"),type:"button"},["×"])])}commit(){let t=new Vxe({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:vS.of(t)}))}keydown(t){$mt(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?zA:FA)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),FK(this.view))}update(t){for(let n of t.transactions)for(let r of n.effects)r.is(vS)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(wO).top}}function pl(e,t){return e.state.phrase(t)}const s_=30,a_=/[\s\.,:;?!]/;function cU(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,s=Math.max(r.from,t-s_),a=Math.min(i,n+s_),l=e.state.sliceDoc(s,a);if(s!=r.from){for(let c=0;cl.length-s_;c--)if(!a_.test(l[c-1])&&a_.test(l[c])){l=l.slice(0,c);break}}return Ct.announce.of(`${e.state.phrase("current match")}. ${l} ${e.state.phrase("on line")} ${r.number}.`)}const HSt=Ct.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),qSt=[Ip,xh.low(BSt),HSt];class zK{constructor(t,n,r){this.from=t,this.to=n,this.diagnostic=r}}class Jm{constructor(t,n,r){this.diagnostics=t,this.panel=n,this.selected=r}static init(t,n,r){let i=r.facet(wS).markerFilter;i&&(t=i(t,r));let s=t.slice().sort((m,g)=>m.from-g.from||m.to-g.to),a=new sh,l=[],c=0,u=r.doc.iter(),d=0,f=r.doc.length;for(let m=0;;){let g=m==s.length?null:s[m];if(!g&&!l.length)break;let b,y;if(l.length)b=c,y=l.reduce((x,w)=>Math.min(x,w.to),g&&g.from>b?g.from:1e8);else{if(b=g.from,b>f)break;y=g.to,l.push(g),m++}for(;mx.from||x.to==b))l.push(x),m++,y=Math.min(x.to,y);else{y=Math.min(x.from,y);break}}y=Math.min(y,f);let O=!1;if(l.some(x=>x.from==b&&(x.to==y||y==f))&&(O=b==y,!O&&y-b<10)){let x=b-(d+u.value.length);x>0&&(u.next(x),d=b);for(let w=b;;){if(w>=y){O=!0;break}if(!u.lineBreak&&d+u.value.length>w)break;w=d+u.value.length,d+=u.value.length,u.next()}}let v=sEt(l);if(O)a.add(b,b,dn.widget({widget:new tEt(v),diagnostics:l.slice()}));else{let x=l.reduce((w,S)=>S.markClass?w+" "+S.markClass:w,"");a.add(b,y,dn.mark({class:"cm-lintRange cm-lintRange-"+v+x,diagnostics:l.slice(),inclusiveEnd:l.some(w=>w.to>y)}))}if(c=y,c==f)break;for(let x=0;x{if(!(t&&a.diagnostics.indexOf(t)<0))if(!r)r=new zK(i,s,t||a.diagnostics[0]);else{if(a.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new zK(r.from,s,r.diagnostic)}}),r}function XSt(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(wS).hideOn(e,n,r);if(i!=null)return i;let s=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(a=>a.is(Yxe))||e.changes.touchesRange(s.from,Math.max(s.to,r)))}function GSt(e,t){return e.field(Nl,!1)?t:t.concat(jn.appendConfig.of(aEt))}const Yxe=jn.define(),uU=jn.define(),Zxe=jn.define(),Nl=Qa.define({create(){return new Jm(dn.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let s=t.changes.mapPos(e.selected.from,1);r=im(n,e.selected.diagnostic,s)||im(n,null,s)}!n.size&&i&&t.state.facet(wS).autoPanel&&(i=null),e=new Jm(n,i,r)}for(let n of t.effects)if(n.is(Yxe)){let r=t.state.facet(wS).autoPanel?n.value.length?SS.open:null:e.panel;e=Jm.init(n.value,r,t.state)}else n.is(uU)?e=new Jm(e.diagnostics,n.value?SS.open:null,e.selected):n.is(Zxe)&&(e=new Jm(e.diagnostics,e.panel,n.value));return e},provide:e=>[lS.from(e,t=>t.panel),Ct.decorations.from(e,t=>t.diagnostics)]}),WSt=dn.mark({class:"cm-lintRange cm-lintRange-active"});function YSt(e,t,n){let{diagnostics:r}=e.state.field(Nl),i,s=-1,a=-1;r.between(t-(n<0?1:0),t+(n>0?1:0),(c,u,{spec:d})=>{if(t>=c&&t<=u&&(c==u||(t>c||n>0)&&(tJxe(e,n,!1)))}const KSt=e=>{let t=e.state.field(Nl,!1);(!t||!t.panel)&&e.dispatch({effects:GSt(e.state,[uU.of(!0)])});let n=kQ(e,SS.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},VK=e=>{let t=e.state.field(Nl,!1);return!t||!t.panel?!1:(e.dispatch({effects:uU.of(!1)}),!0)},JSt=e=>{let t=e.state.field(Nl,!1);if(!t)return!1;let n=e.state.selection.main,r=im(t.diagnostics,null,n.to+1);return!r&&(r=im(t.diagnostics,null,0),!r||r.from==n.from&&r.to==n.to)?!1:(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),Tgt(e,r.from,1,{tooltip:eve,until:i=>i.docChanged||i.newSelection.main.headr.to}),!0)},eEt=[{key:"Mod-Shift-m",run:KSt,preventDefault:!0},{key:"F8",run:JSt}],wS=Qt.define({combine(e){return{sources:e.map(t=>t.source).filter(t=>t!=null),...Nd(e.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:HK,tooltipFilter:HK,needsRefresh:(t,n)=>t?n?r=>t(r)||n(r):t:n,hideOn:(t,n)=>t?n?(r,i,s)=>t(r,i,s)||n(r,i,s):t:n,autoPanel:(t,n)=>t||n})}}});function HK(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function Kxe(e){let t=[];if(e)e:for(let{name:n}of e){for(let r=0;rs.toLowerCase()==i.toLowerCase())){t.push(i);continue e}}t.push("")}return t}function Jxe(e,t,n){var r;let i=n?Kxe(t.actions):[];return fi("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},fi("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),(r=t.actions)===null||r===void 0?void 0:r.map((s,a)=>{let l=!1,c=m=>{if(m.preventDefault(),l)return;l=!0;let g=im(e.state.field(Nl).diagnostics,t);g&&s.apply(e,g.from,g.to)},{name:u}=s,d=i[a]?u.indexOf(i[a]):-1,f=d<0?u:[u.slice(0,d),fi("u",u.slice(d,d+1)),u.slice(d+1)],h=s.markClass?" "+s.markClass:"";return fi("button",{type:"button",class:"cm-diagnosticAction"+h,onclick:c,onmousedown:c,"aria-label":` Action: ${u}${d<0?"":` (access key "${i[a]})"`}.`},f)}),t.source&&fi("div",{class:"cm-diagnosticSource"},t.source))}class tEt extends Nu{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return fi("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class qK{constructor(t,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Jxe(t,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class SS{constructor(t){this.view=t,this.items=[];let n=i=>{if(!(i.ctrlKey||i.altKey||i.metaKey)){if(i.keyCode==27)VK(this.view),this.view.focus();else if(i.keyCode==38||i.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(i.keyCode==40||i.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(i.keyCode==36)this.moveSelection(0);else if(i.keyCode==35)this.moveSelection(this.items.length-1);else if(i.keyCode==13)this.view.focus();else if(i.keyCode>=65&&i.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],a=Kxe(s.actions);for(let l=0;l{for(let s=0;sVK(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(Nl).selected;if(!t)return-1;for(let n=0;n{for(let d of u.diagnostics){if(a.has(d))continue;a.add(d);let f=-1,h;for(let m=r;mr&&(this.items.splice(r,f-r),i=!0)),n&&h.diagnostic==n.diagnostic?h.dom.hasAttribute("aria-selected")||(h.dom.setAttribute("aria-selected","true"),s=h):h.dom.hasAttribute("aria-selected")&&h.dom.removeAttribute("aria-selected"),r++}});r({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:c})=>{let u=c.height/this.list.offsetHeight;l.topc.bottom&&(this.list.scrollTop+=(l.bottom-c.bottom)/u)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let t=this.list.firstChild;function n(){let r=t;t=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;t!=r.dom;)n();t=r.dom.nextSibling}else this.list.insertBefore(r.dom,t);for(;t;)n()}moveSelection(t){if(this.selectedIndex<0)return;let n=this.view.state.field(Nl),r=im(n.diagnostics,this.items[t].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:Zxe.of(r)})}static open(t){return new SS(t)}}function nEt(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(e)}')`}function o_(e){return nEt(``,'width="6" height="3"')}const rEt=Ct.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:o_("#f11")},".cm-lintRange-warning":{backgroundImage:o_("orange")},".cm-lintRange-info":{backgroundImage:o_("#999")},".cm-lintRange-hint":{backgroundImage:o_("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function iEt(e){return e=="error"?4:e=="warning"?3:e=="info"?2:1}function sEt(e){let t="hint",n=1;for(let r of e){let i=iEt(r.severity);i>n&&(n=i,t=r.severity)}return t}const eve=_gt(YSt,{hideOn:XSt}),aEt=[Nl,Ct.decorations.compute([Nl],e=>{let{selected:t,panel:n}=e.field(Nl);return!t||!n||t.from==t.to?dn.none:dn.set([WSt.range(t.from,t.to)])}),eve,rEt];var XK=function(t){t===void 0&&(t={});var n=t,r=n.crosshairCursor,i=r===void 0?!1:r,s=[];t.closeBracketsKeymap!==!1&&(s=s.concat(hyt)),t.defaultKeymap!==!1&&(s=s.concat(gSt)),t.searchKeymap!==!1&&(s=s.concat(zSt)),t.historyKeymap!==!1&&(s=s.concat(Swt)),t.foldKeymap!==!1&&(s=s.concat(b0t)),t.completionKeymap!==!1&&(s=s.concat(R1e)),t.lintKeymap!==!1&&(s=s.concat(eEt));var a=[];return t.lineNumbers!==!1&&a.push(Qgt()),t.highlightActiveLineGutter!==!1&&a.push(zgt()),t.highlightSpecialChars!==!1&&a.push(tgt()),t.history!==!1&&a.push(pwt()),t.foldGutter!==!1&&a.push(v0t()),t.drawSelection!==!1&&a.push(Vmt()),t.dropCursor!==!1&&a.push(Wmt()),t.allowMultipleSelections!==!1&&a.push(vr.allowMultipleSelections.of(!0)),t.indentOnInput!==!1&&a.push(c0t()),t.syntaxHighlighting!==!1&&a.push(u1e(k0t,{fallback:!0})),t.bracketMatching!==!1&&a.push(R0t()),t.closeBrackets!==!1&&a.push(cyt()),t.autocompletion!==!1&&a.push(xyt()),t.rectangularSelection!==!1&&a.push(mgt()),i!==!1&&a.push(ygt()),t.highlightActiveLine!==!1&&a.push(ogt()),t.highlightSelectionMatches!==!1&&a.push(wSt()),t.tabSize&&typeof t.tabSize=="number"&&a.push(OO.of(" ".repeat(t.tabSize))),a.concat([yO.of(s.flat())]).filter(Boolean)};const oEt="#e5c07b",GK="#e06c75",lEt="#56b6c2",cEt="#ffffff",_T="#abb2bf",$6="#7d8799",uEt="#61afef",dEt="#98c379",WK="#d19a66",fEt="#c678dd",hEt="#21252b",YK="#2c313a",ZK="#282c34",TP="#353a42",pEt="#3E4451",KK="#528bff",mEt=Ct.theme({"&":{color:_T,backgroundColor:ZK},".cm-content":{caretColor:KK},".cm-cursor, .cm-dropCursor":{borderLeftColor:KK},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:pEt},".cm-panels":{backgroundColor:hEt,color:_T},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:ZK,color:$6,border:"none"},".cm-activeLineGutter":{backgroundColor:YK},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:TP},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:TP,borderBottomColor:TP},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:YK,color:_T}}},{dark:!0}),gEt=UE.define([{tag:Y.keyword,color:fEt},{tag:[Y.name,Y.deleted,Y.character,Y.propertyName,Y.macroName],color:GK},{tag:[Y.function(Y.variableName),Y.labelName],color:uEt},{tag:[Y.color,Y.constant(Y.name),Y.standard(Y.name)],color:WK},{tag:[Y.definition(Y.name),Y.separator],color:_T},{tag:[Y.typeName,Y.className,Y.number,Y.changed,Y.annotation,Y.modifier,Y.self,Y.namespace],color:oEt},{tag:[Y.operator,Y.operatorKeyword,Y.url,Y.escape,Y.regexp,Y.link,Y.special(Y.string)],color:lEt},{tag:[Y.meta,Y.comment],color:$6},{tag:Y.strong,fontWeight:"bold"},{tag:Y.emphasis,fontStyle:"italic"},{tag:Y.strikethrough,textDecoration:"line-through"},{tag:Y.link,color:$6,textDecoration:"underline"},{tag:Y.heading,fontWeight:"bold",color:GK},{tag:[Y.atom,Y.bool,Y.special(Y.variableName)],color:WK},{tag:[Y.processingInstruction,Y.string,Y.inserted],color:dEt},{tag:Y.invalid,color:cEt}]),bEt=[mEt,u1e(gEt)];var yEt=Ct.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),OEt=function(t){t===void 0&&(t={});var n=t,r=n.indentWithTab,i=r===void 0?!0:r,s=n.editable,a=s===void 0?!0:s,l=n.readOnly,c=l===void 0?!1:l,u=n.theme,d=u===void 0?"light":u,f=n.placeholder,h=f===void 0?"":f,m=n.basicSetup,g=m===void 0?!0:m,b=[];switch(i&&b.unshift(yO.of([bSt])),g&&(typeof g=="boolean"?b.unshift(XK()):b.unshift(XK(g))),h&&b.unshift(dgt(h)),d){case"light":b.push(yEt);break;case"dark":b.push(bEt);break;case"none":break;default:b.push(d);break}return a===!1&&b.push(Ct.editable.of(!1)),c&&b.push(vr.readOnly.of(!0)),[...b]},xEt=e=>({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to)),selectedText:e.state.selection.ranges.some(t=>!t.empty)});class vEt{constructor(t,n){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=n,this.timeoutMS=n,this.callbacks.push(t)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var t=this.callbacks.slice();this.callbacks.length=0,t.forEach(n=>{try{n()}catch(r){console.error("TimeoutLatch callback error:",r)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class JK{constructor(){this.interval=null,this.latches=new Set}add(t){this.latches.add(t),this.start()}remove(t){this.latches.delete(t),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(t=>{t.tick(),t.isDone&&this.remove(t)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var CP=null,wEt=()=>typeof window>"u"?new JK:(CP||(CP=new JK),CP),SEt=Ct.theme({"& .cm-scroller":{height:"100% !important"}}),eJ=null,AP=null;function EEt(e,t,n,r,i,s){if(!e&&!t&&!n&&!r&&!i&&!s)return null;var a=JSON.stringify({height:e,minHeight:t,maxHeight:n,width:r,minWidth:i,maxWidth:s});return a===eJ||(eJ=a,AP=Ct.theme({"&":{height:e,minHeight:t,maxHeight:n,width:r,minWidth:i,maxWidth:s}})),AP}var tJ=Ad.define(),kEt=200,_Et=[];function TEt(e){var t=e.value,n=e.selection,r=e.onChange,i=e.onStatistics,s=e.onCreateEditor,a=e.onUpdate,l=e.extensions,c=l===void 0?_Et:l,u=e.autoFocus,d=e.theme,f=d===void 0?"light":d,h=e.height,m=h===void 0?null:h,g=e.minHeight,b=g===void 0?null:g,y=e.maxHeight,O=y===void 0?null:y,v=e.width,x=v===void 0?null:v,w=e.minWidth,S=w===void 0?null:w,E=e.maxWidth,k=E===void 0?null:E,_=e.placeholder,C=_===void 0?"":_,T=e.editable,A=T===void 0?!0:T,j=e.readOnly,L=j===void 0?!1:j,I=e.indentWithTab,M=I===void 0?!0:I,N=e.basicSetup,D=N===void 0?!0:N,Q=e.root,F=e.initialState,$=p.useState(),H=$[0],z=$[1],B=p.useState(),V=B[0],Z=B[1],ce=p.useState(),be=ce[0],ie=ce[1],q=p.useState(()=>({current:null}))[0],X=p.useState(()=>({current:null}))[0],K=EEt(m,b,O,x,S,k),de=Ct.updateListener.of(Ae=>{if(Ae.docChanged&&typeof r=="function"&&!Ae.transactions.some(Te=>Te.annotation(tJ))){q.current?q.current.reset():(q.current=new vEt(()=>{if(X.current){var Te=X.current;X.current=null,Te()}q.current=null},kEt),wEt().add(q.current));var He=Ae.state.doc,et=He.toString();r(et,Ae)}i&&i(xEt(Ae))}),xe=OEt({theme:f,editable:A,readOnly:L,placeholder:C,indentWithTab:M,basicSetup:D}),Me=[de,...K?[K]:[],SEt,...xe];return a&&typeof a=="function"&&Me.push(Ct.updateListener.of(a)),Me=Me.concat(c),p.useLayoutEffect(()=>{if(H&&!be){var Ae={doc:t,selection:n,extensions:Me},He=F?vr.fromJSON(F.json,Ae,F.fields):vr.create(Ae);if(ie(He),!V){var et=new Ct({state:He,parent:H,root:Q});Z(et),s&&s(et,He)}}return()=>{V&&(ie(void 0),Z(void 0))}},[H,be]),p.useEffect(()=>{e.container&&z(e.container)},[e.container]),p.useEffect(()=>()=>{V&&(V.destroy(),Z(void 0)),q.current&&(q.current.cancel(),q.current=null)},[V]),p.useEffect(()=>{u&&V&&V.focus()},[u,V]),p.useEffect(()=>{V&&V.dispatch({effects:jn.reconfigure.of(Me)})},[f,c,m,b,O,x,S,k,C,A,L,M,D,r,a]),p.useEffect(()=>{if(t!==void 0){var Ae=V?V.state.doc.toString():"";if(V&&t!==Ae){var He=q.current&&!q.current.isDone,et=()=>{V&&t!==V.state.doc.toString()&&V.dispatch({changes:{from:0,to:V.state.doc.toString().length,insert:t||""},annotations:[tJ.of(!0)]})};He?X.current=et:et()}}},[t,V]),{state:be,setState:ie,view:V,setView:Z,container:H,setContainer:z}}var CEt=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],tve=p.forwardRef((e,t)=>{var n=e.className,r=e.value,i=r===void 0?"":r,s=e.selection,a=e.extensions,l=a===void 0?[]:a,c=e.onChange,u=e.onStatistics,d=e.onCreateEditor,f=e.onUpdate,h=e.autoFocus,m=e.theme,g=m===void 0?"light":m,b=e.height,y=e.minHeight,O=e.maxHeight,v=e.width,x=e.minWidth,w=e.maxWidth,S=e.basicSetup,E=e.placeholder,k=e.indentWithTab,_=e.editable,C=e.readOnly,T=e.root,A=e.initialState,j=iwt(e,CEt),L=p.useRef(null),I=TEt({root:T,value:i,autoFocus:h,theme:g,height:b,minHeight:y,maxHeight:O,width:v,minWidth:x,maxWidth:w,basicSetup:S,placeholder:E,indentWithTab:k,editable:_,readOnly:C,selection:s,onChange:c,onStatistics:u,onCreateEditor:d,onUpdate:f,extensions:l,initialState:A}),M=I.state,N=I.view,D=I.container,Q=I.setContainer;p.useImperativeHandle(t,()=>({editor:L.current,state:M,view:N}),[L,D,M,N]);var F=p.useCallback(H=>{L.current=H,Q(H)},[Q]);if(typeof i!="string")throw new Error("value must be typeof string but got "+typeof i);var $=typeof g=="string"?"cm-theme-"+g:"cm-theme";return o.jsx("div",R6({ref:F,className:""+$+(n?" "+n:"")},j))});tve.displayName="CodeMirror";function nve(e){const t=e.toLowerCase(),n=t.split("/").pop()??t,r=n.includes(".")?n.split(".").pop():"";return n==="dockerfile"||n.startsWith("dockerfile.")||n.endsWith(".dockerfile")?[AQ.define(rwt)]:r==="py"||r==="pyi"?[hvt()]:["ts","tsx","mts","cts"].includes(r??"")?[O6({typescript:!0,jsx:r==="tsx"})]:["js","jsx","mjs","cjs"].includes(r??"")?[O6({jsx:r==="jsx"})]:r==="json"||r==="jsonc"?[Iyt()]:r==="yaml"||r==="yml"?[zvt()]:["md","markdown"].includes(r??"")?[XOt()]:[]}function mR({value:e,path:t,onChange:n,readOnly:r=!1,theme:i="light"}){const s=p.useMemo(()=>nve(t),[t]);return o.jsx(tve,{value:e,height:"100%",theme:i,extensions:s,editable:!r,onChange:n,basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0,highlightActiveLineGutter:!0,autocompletion:!1}})}const rve=Object.freeze(Object.defineProperty({__proto__:null,default:mR,languageFor:nve},Symbol.toStringTag,{value:"Module"}));function AEt(e){var s;const t=e.split(/\r?\n/);if(((s=t[0])==null?void 0:s.trim())!=="---")return{body:e,frontmatter:[]};const n=t.findIndex((a,l)=>l>0&&a.trim()==="---");if(n<0)return{body:e,frontmatter:[]};const r=Obe(t.slice(1,n).join(` +`,{label:"if",detail:"block",type:"keyword"}),rs("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),rs("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),rs("import ${module}",{label:"import",detail:"statement",type:"keyword"}),rs("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],dvt=S1e(WOe,IQ(cvt.concat(uvt)));function xP(e){let{node:t,pos:n}=e,r=e.lineIndent(n,-1),i=null;for(;;){let s=t.childBefore(n);if(s)if(s.name=="Comment")n=s.from;else if(s.name=="Body"||s.name=="MatchBody")e.baseIndentFor(s)+e.unit<=r&&(i=s),t=s;else if(s.name=="MatchClause")t=s;else if(s.type.is("Statement"))t=s;else break;else break}return i}function vP(e,t){let n=e.baseIndentFor(t),r=e.lineAt(e.pos,-1),i=r.from+r.text.length;return/^\s*($|#)/.test(r.text)&&e.node.ton?null:n+e.unit}const wP=lh.define({name:"python",parser:avt.configure({props:[wh.add({Body:e=>{var t;let n=/^\s*(#|$)/.test(e.textAfter)&&xP(e)||e.node;return(t=vP(e,n))!==null&&t!==void 0?t:e.continue()},MatchBody:e=>{var t;let n=xP(e);return(t=vP(e,n||e.node))!==null&&t!==void 0?t:e.continue()},IfStatement:e=>/^\s*(else:|elif )/.test(e.textAfter)?e.baseIndent:e.continue(),"ForStatement WhileStatement":e=>/^\s*else:/.test(e.textAfter)?e.baseIndent:e.continue(),TryStatement:e=>/^\s*(except[ :]|finally:|else:)/.test(e.textAfter)?e.baseIndent:e.continue(),MatchStatement:e=>/^\s*case /.test(e.textAfter)?e.baseIndent+e.unit:e.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":Cy({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":Cy({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":Cy({closing:"]"}),MemberExpression:e=>e.baseIndent+e.unit,"String FormatString":()=>null,Script:e=>{var t;let n=xP(e);return(t=n&&vP(e,n))!==null&&t!==void 0?t:e.continue()}}),Sh.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":UE,Body:(e,t)=>({from:e.from+1,to:e.to-(e.to==t.doc.length?0:1)}),"String FormatString":(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/}});function fvt(){return new rm(wP,[wP.data.of({autocomplete:lvt}),wP.data.of({autocomplete:dvt})])}const vb=63,AK=64,hvt=1,pvt=2,YOe=3,mvt=4,ZOe=5,gvt=6,bvt=7,KOe=65,yvt=66,Ovt=8,xvt=9,vvt=10,wvt=11,Svt=12,JOe=13,Evt=19,kvt=20,_vt=29,Tvt=33,Cvt=34,Avt=47,Nvt=0,tU=1,C6=2,wS=3,A6=4;class Km{constructor(t,n,r){this.parent=t,this.depth=n,this.type=r,this.hash=(t?t.hash+t.hash<<8:0)+n+(n<<4)+r}}Km.top=new Km(null,-1,Nvt);function ew(e,t){for(let n=0,r=t-e.pos-1;;r--,n++){let i=e.peek(r);if(uh(i)||i==-1)return n}}function N6(e){return e==32||e==9}function uh(e){return e==10||e==13}function exe(e){return N6(e)||uh(e)}function dg(e){return e<0||exe(e)}const jvt=new oR({start:Km.top,reduce(e,t){return e.type==wS&&(t==kvt||t==Cvt)?e.parent:e},shift(e,t,n,r){if(t==YOe)return new Km(e,ew(r,r.pos),tU);if(t==KOe||t==ZOe)return new Km(e,ew(r,r.pos),C6);if(t==vb)return e.parent;if(t==Evt||t==Tvt)return new Km(e,0,wS);if(t==JOe&&e.type==A6)return e.parent;if(t==Avt){let i=/[1-9]/.exec(r.read(r.pos,n.pos));if(i)return new Km(e,e.depth+ +i[0],A6)}return e},hash(e){return e.hash}});function T1(e,t,n=0){return e.peek(n)==t&&e.peek(n+1)==t&&e.peek(n+2)==t&&dg(e.peek(n+3))}const Rvt=new js((e,t)=>{if(e.next==-1&&t.canShift(AK))return e.acceptToken(AK);let n=e.peek(-1);if((uh(n)||n<0)&&t.context.type!=wS){if(T1(e,45))if(t.canShift(vb))e.acceptToken(vb);else return e.acceptToken(hvt,3);if(T1(e,46))if(t.canShift(vb))e.acceptToken(vb);else return e.acceptToken(pvt,3);let r=0;for(;e.next==32;)r++,e.advance();(r{if(t.context.type==wS){e.next==63&&(e.advance(),dg(e.next)&&e.acceptToken(bvt));return}if(e.next==45)e.advance(),dg(e.next)&&e.acceptToken(t.context.type==tU&&t.context.depth==ew(e,e.pos-1)?mvt:YOe);else if(e.next==63)e.advance(),dg(e.next)&&e.acceptToken(t.context.type==C6&&t.context.depth==ew(e,e.pos-1)?gvt:ZOe);else{let n=e.pos;for(;;)if(N6(e.next)){if(e.pos==n)return;e.advance()}else if(e.next==33)txe(e);else if(e.next==38)j6(e);else if(e.next==42){j6(e);break}else if(e.next==39||e.next==34){if(nU(e,!0))break;return}else if(e.next==91||e.next==123){if(!Pvt(e))return;break}else{nxe(e,!0,!1,0);break}for(;N6(e.next);)e.advance();if(e.next==58){if(e.pos==n&&t.canShift(_vt))return;let r=e.peek(1);dg(r)&&e.acceptTokenTo(t.context.type==C6&&t.context.depth==ew(e,n)?yvt:KOe,n)}}},{contextual:!0});function Dvt(e){return e>32&&e<127&&e!=34&&e!=37&&e!=44&&e!=60&&e!=62&&e!=92&&e!=94&&e!=96&&e!=123&&e!=124&&e!=125}function NK(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function jK(e,t){return e.next==37?(e.advance(),NK(e.next)&&e.advance(),NK(e.next)&&e.advance(),!0):Dvt(e.next)||t&&e.next==44?(e.advance(),!0):!1}function txe(e){if(e.advance(),e.next==60){for(e.advance();;)if(!jK(e,!0)){e.next==62&&e.advance();break}}else for(;jK(e,!1););}function j6(e){for(e.advance();!dg(e.next)&&LA(e.next)!="f";)e.advance()}function nU(e,t){let n=e.next,r=!1,i=e.pos;for(e.advance();;){let s=e.next;if(s<0)break;if(e.advance(),s==n)if(s==39)if(e.next==39)e.advance();else break;else break;else if(s==92&&n==34)e.next>=0&&e.advance();else if(uh(s)){if(t)return!1;r=!0}else if(t&&e.pos>=i+1024)return!1}return!r}function Pvt(e){for(let t=[],n=e.pos+1024;;)if(e.next==91||e.next==123)t.push(e.next),e.advance();else if(e.next==39||e.next==34){if(!nU(e,!0))return!1}else if(e.next==93||e.next==125){if(t[t.length-1]!=e.next-2)return!1;if(t.pop(),e.advance(),!t.length)return!0}else{if(e.next<0||e.pos>n||uh(e.next))return!1;e.advance()}}const Mvt="iiisiiissisfissssssssssssisssiiissssssssssssssssssssssssssfsfssissssssssssssssssssssssssssfif";function LA(e){return e<33?"u":e>125?"s":Mvt[e-33]}function SP(e,t){let n=LA(e);return n!="u"&&!(t&&n=="f")}function nxe(e,t,n,r){if(LA(e.next)=="s"||(e.next==63||e.next==58||e.next==45)&&SP(e.peek(1),n))e.advance();else return!1;let i=e.pos;for(;;){let s=e.next,a=0,l=r+1;for(;exe(s);){if(uh(s)){if(t)return!1;l=0}else l++;s=e.peek(++a)}if(!(s>=0&&(s==58?SP(e.peek(a+1),n):s==35?e.peek(a-1)!=32:SP(s,n)))||!n&&l<=r||l==0&&!n&&(T1(e,45,a)||T1(e,46,a)))break;if(t&&LA(s)=="f")return!1;for(let u=a;u>=0;u--)e.advance();if(t&&e.pos>i+1024)return!1}return!0}const Lvt=new js((e,t)=>{if(e.next==33)txe(e),e.acceptToken(Svt);else if(e.next==38||e.next==42){let n=e.next==38?vvt:wvt;j6(e),e.acceptToken(n)}else e.next==39||e.next==34?(nU(e,!1),e.acceptToken(xvt)):nxe(e,!1,t.context.type==wS,t.context.depth)&&e.acceptToken(Ovt)}),$vt=new js((e,t)=>{let n=t.context.type==A6?t.context.depth:-1,r=e.pos;e:for(;;){let i=0,s=e.next;for(;s==32;)s=e.peek(++i);if(!i&&(T1(e,45,i)||T1(e,46,i))||!uh(s)&&(n<0&&(n=Math.max(t.context.depth+1,i)),iYAN>Y",stateData:";S~O!fOS!gOS^OS~OP_OQbORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!V[O!cTO~O`cO~P]OVkOWROXROYeOZfO[dOcPOmhOqQO~OboO~P!bOVtOWROXROYeOZfO[dOcPOmrOqQO~OpwO~P#WORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!cTO~OSvP!avP!bvP~P#|OWROXROYeOZfO[dOcPOqQO~OmzO~P%OOm!OOUzP!azP!bzP!dzP~P#|O^!SO!b!QO!f!TO!g!RO~ORSOTUOWROXROcPOqQO!PVO!cTO~OY!UOP!QXQ!QX!V!QX!`!QXS!QX!a!QX!b!QXU!QXm!QX!d!QX~P&aO[!WOP!SXQ!SX!V!SX!`!SXS!SX!a!SX!b!SXU!SXm!SX!d!SX~P&aO^!ZO!W![O!b!YO!f!]O!g!YO~OP!_O!V[OQaX!`aX~OPaXQaX!VaX!`aX~P#|OP!bOQ!cO!V[O~OP_O!V[O~P#|OWROXROY!fOcPOqQObfXmfXofXpfX~OWROXRO[!hOcPOqQObhXmhXohXphX~ObeXmlXoeX~ObkXokX~P%OOm!kO~Om!lObnPonP~P%OOb!pOo!oO~Ob!pO~P!bOm!sOosXpsX~OosXpsX~P%OOm!uOotPptP~P%OOo!xOp!yO~Op!yO~P#WOS!|O!a#OO!b#OO~OUyX!ayX!byX!dyX~P#|Om#QO~OU#SO!a#UO!b#UO!d#RO~Om#WOUzX!azX!bzX!dzX~O]#XO~O!b#XO!g#YO~O^#ZO!b#XO!g#YO~OP!RXQ!RX!V!RX!`!RXS!RX!a!RX!b!RXU!RXm!RX!d!RX~P&aOP!TXQ!TX!V!TX!`!TXS!TX!a!TX!b!TXU!TXm!TX!d!TX~P&aO!b#^O!g#^O~O^#_O!b#^O!f#`O!g#^O~O^#_O!W#aO!b#^O!g#^O~OPaaQaa!Vaa!`aa~P#|OP#cO!V[OQ!XX!`!XX~OP!XXQ!XX!V!XX!`!XX~P#|OP_O!V[OQ!_X!`!_X~P#|OWROXROcPOqQObgXmgXogXpgX~OWROXROcPOqQObiXmiXoiXpiX~Obkaoka~P%OObnXonX~P%OOm#kO~Ob#lOo!oO~Oosapsa~P%OOotXptX~P%OOm#pO~Oo!xOp#qO~OSwP!awP!bwP~P#|OS!|O!a#vO!b#vO~OUya!aya!bya!dya~P#|Om#xO~P%OOm#{OU}P!a}P!b}P!d}P~P#|OU#SO!a$OO!b$OO!d#RO~O]$QO~O!b$QO!g$RO~O!b$SO!g$SO~O^$TO!b$SO!g$SO~O^$TO!b$SO!f$UO!g$SO~OP!XaQ!Xa!V!Xa!`!Xa~P#|Obnaona~P%OOotapta~P%OOo!xO~OU|X!a|X!b|X!d|X~P#|Om$ZO~Om$]OU}X!a}X!b}X!d}X~O]$^O~O!b$_O!g$_O~O^$`O!b$_O!g$_O~OU|a!a|a!b|a!d|a~P#|O!b$cO!g$cO~O",goto:",]!mPPPPPPPPPPPPPPPPP!nPP!v#v#|$`#|$c$f$j$nP%VPPP!v%Y%^%a%{&O%a&R&U&X&_&b%aP&e&{&e'O'RPP']'a'g'm's'y(XPPPPPPPP(_)e*X+c,VUaObcR#e!c!{ROPQSTUXY_bcdehknrtvz!O!U!W!_!b!c!f!h!k!l!s!u!|#Q#R#S#W#c#k#p#x#{$Z$]QmPR!qnqfPQThknrtv!k!l!s!u#R#k#pR!gdR!ieTlPnTjPnSiPnSqQvQ{TQ!mkQ!trQ!vtR#y#RR!nkTsQvR!wt!RWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]RySR#t!|R|TR|UQ!PUR#|#SR#z#RR#z#SyZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]R!VXR!XYa]O^abc!a!c!eT!da!eQnPR!rnQvQR!{vQ!}yR#u!}Q#T|R#}#TW^Obc!cS!^^!aT!aa!eQ!eaR#f!eW`Obc!cQxSS}U#SQ!`_Q#PzQ#V!OQ#b!_Q#d!bQ#s!|Q#w#QQ$P#WQ$V#cQ$Y#xQ$[#{Q$a$ZR$b$]xZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]Q!VXQ!XYQ#[!UR#]!W!QWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]pfPQThknrtv!k!l!s!u#R#k#pQ!gdQ!ieQ#g!fR#h!hSgPn^pQTkrtv#RQ!jhQ#i!kQ#j!lQ#n!sQ#o!uQ$W#kR$X#pQuQR!zv",nodeNames:"⚠ DirectiveEnd DocEnd - - ? ? ? Literal QuotedLiteral Anchor Alias Tag BlockLiteralContent Comment Stream BOM Document ] [ FlowSequence Item Tagged Anchored Anchored Tagged FlowMapping Pair Key : Pair , } { FlowMapping Pair Pair BlockSequence Item Item BlockMapping Pair Pair Key Pair Pair BlockLiteral BlockLiteralHeader Tagged Anchored Anchored Tagged Directive DirectiveName DirectiveContent Document",maxTerm:74,context:jvt,nodeProps:[["isolate",-3,8,9,14,""],["openedBy",18,"[",32,"{"],["closedBy",19,"]",33,"}"]],propSources:[Bvt],skippedNodes:[0],repeatNodeCount:6,tokenData:"-Y~RnOX#PXY$QYZ$]Z]#P]^$]^p#Ppq$Qqs#Pst$btu#Puv$yv|#P|}&e}![#P![!]'O!]!`#P!`!a'i!a!}#P!}#O*g#O#P#P#P#Q+Q#Q#o#P#o#p+k#p#q'i#q#r,U#r;'S#P;'S;=`#z<%l?HT#P?HT?HU,o?HUO#PQ#UU!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PQ#kTOY#PZs#Pt;'S#P;'S;=`#z<%lO#PQ#}P;=`<%l#P~$VQ!f~XY$Qpq$Q~$bO!g~~$gS^~OY$bZ;'S$b;'S;=`$s<%lO$b~$vP;=`<%l$bR%OX!WQOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR%rX!WQ!VPOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR&bP;=`<%l%kR&lUoP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'VUmP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'p[!PP!WQOY#PZp#Ppq#hq{#P{|(f|}#P}!O(f!O!R#P!R![)p![;'S#P;'S;=`#z<%lO#PR(mW!PP!WQOY#PZp#Ppq#hq!R#P!R![)V![;'S#P;'S;=`#z<%lO#PR)^U!PP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR)wY!PP!WQOY#PZp#Ppq#hq{#P{|)V|}#P}!O)V!O;'S#P;'S;=`#z<%lO#PR*nUcP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+XUbP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+rUqP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,]UpP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,vU`P!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#P",tokenizers:[Rvt,Ivt,Lvt,$vt,0,1],topRules:{Stream:[0,15]},tokenPrec:0}),Uvt=lh.define({name:"yaml",parser:Qvt.configure({props:[wh.add({Stream:e=>{for(let t=e.node.resolve(e.pos,-1);t&&t.to>=e.pos;t=t.parent){if(t.name=="BlockLiteralContent"&&t.frome.pos)return null}}return null},FlowMapping:Cy({closing:"}"}),FlowSequence:Cy({closing:"]"})}),Sh.add({"FlowMapping FlowSequence":UE,"Item Pair BlockLiteral":(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}),languageData:{commentTokens:{line:"#"},indentOnInput:/^\s*[\]\}]$/}});function Fvt(){return new rm(Uvt)}function zvt(e){rxe(e,"start");var t={},n=e.languageData||{},r=!1;for(var i in e)if(i!=n&&e.hasOwnProperty(i))for(var s=t[i]=[],a=e[i],l=0;l2&&a.token&&typeof a.token!="string"){n.pending=[];for(var u=2;u-1)return null;var i=n.indent.length-1,s=e[n.state];e:for(;;){for(var a=0;a{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=iU(e.state,n.from);return r.line?swt(e):r.block?owt(e):!1};function rU(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return i?(r(n.update(i)),!0):!1}}const swt=rU(uwt,0),awt=rU(lxe,0),owt=rU((e,t)=>lxe(e,t,cwt(t)),0);function iU(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const xx=50;function lwt(e,{open:t,close:n},r,i){let s=e.sliceDoc(r-xx,r),a=e.sliceDoc(i,i+xx),l=/\s*$/.exec(s)[0].length,c=/^\s*/.exec(a)[0].length,u=s.length-l;if(s.slice(u-t.length,u)==t&&a.slice(c,c+n.length)==n)return{open:{pos:r-l,margin:l&&1},close:{pos:i+c,margin:c&&1}};let d,f;i-r<=2*xx?d=f=e.sliceDoc(r,i):(d=e.sliceDoc(r,r+xx),f=e.sliceDoc(i-xx,i));let h=/^\s*/.exec(d)[0].length,m=/\s*$/.exec(f)[0].length,g=f.length-m-n.length;return d.slice(h,h+t.length)==t&&f.slice(g,g+n.length)==n?{open:{pos:r+h+t.length,margin:/\s/.test(d.charAt(h+t.length))?1:0},close:{pos:i-m-n.length,margin:/\s/.test(f.charAt(g-1))?1:0}}:null}function cwt(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let s=t.length-1;s>=0&&t[s].to>r.from?t[s].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}function lxe(e,t,n=t.selection.ranges){let r=n.map(s=>iU(t,s.from).block);if(!r.every(s=>s))return null;let i=n.map((s,a)=>lwt(t,r[a],s.from,s.to));if(e!=2&&!i.every(s=>s))return{changes:t.changes(n.map((s,a)=>i[a]?[]:[{from:s.from,insert:r[a].open+" "},{from:s.to,insert:" "+r[a].close}]))};if(e!=1&&i.some(s=>s)){let s=[];for(let a=0,l;ai&&(s==a||a>f.from)){i=f.from;let h=/^\s*/.exec(f.text)[0].length,m=h==f.length,g=f.text.slice(h,h+u.length)==u?h:-1;hs.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:l,token:c,indent:u,empty:d,single:f}of r)(f||!d)&&s.push({from:l.from+u,insert:c+" "});let a=t.changes(s);return{changes:a,selection:t.selection.map(a,1)}}else if(e!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:a,comment:l,token:c}of r)if(l>=0){let u=a.from+l,d=u+c.length;a.text[d-a.from]==" "&&d++,s.push({from:u,to:d})}return{changes:s}}return null}const I6=jd.define(),dwt=jd.define(),fwt=Qt.define(),cxe=Qt.define({combine(e){return Rd(e,{minDepth:100,newGroupDelay:500,joinToEvent:(t,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,n)=>(r,i)=>t(r,i)||n(r,i)})}}),uxe=Ba.define({create(){return ld.empty},update(e,t){let n=t.state.facet(cxe),r=t.annotation(I6);if(r){let c=Go.fromTransaction(t,r.selection),u=r.side,d=u==0?e.undone:e.done;return c?d=$A(d,d.length,n.minDepth,c):d=hxe(d,t.startState.selection),new ld(u==0?r.rest:d,u==0?d:r.rest)}let i=t.annotation(dwt);if((i=="full"||i=="before")&&(e=e.isolate()),t.annotation(Us.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let s=Go.fromTransaction(t),a=t.annotation(Us.time),l=t.annotation(Us.userEvent);return s?e=e.addChanges(s,a,l,n,t):t.selection&&(e=e.addSelection(t.startState.selection,a,l,n.newGroupDelay)),(i=="full"||i=="after")&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(t=>t.toJSON()),undone:e.undone.map(t=>t.toJSON())}},fromJSON(e){return new ld(e.done.map(Go.fromJSON),e.undone.map(Go.fromJSON))}});function hwt(e={}){return[uxe,cxe.of(e),Ct.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?dxe:t.inputType=="historyRedo"?D6:null;return r?(t.preventDefault(),r(n)):!1}})]}function dR(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(uxe,!1);if(!i)return!1;let s=i.pop(e,n,t);return s?(r(s),!0):!1}}const dxe=dR(0,!1),D6=dR(1,!1),pwt=dR(0,!0),mwt=dR(1,!0);class Go{constructor(t,n,r,i,s){this.changes=t,this.effects=n,this.mapped=r,this.startSelection=i,this.selectionsAfter=s}setSelAfter(t){return new Go(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,n,r;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(i=>i.toJSON())}}static fromJSON(t){return new Go(t.changes&&Zs.fromJSON(t.changes),[],t.mapped&&pd.fromJSON(t.mapped),t.startSelection&&tt.fromJSON(t.startSelection),t.selectionsAfter.map(tt.fromJSON))}static fromTransaction(t,n){let r=jc;for(let i of t.startState.facet(fwt)){let s=i(t);s.length&&(r=r.concat(s))}return!r.length&&t.changes.empty?null:new Go(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,jc)}static selection(t){return new Go(void 0,jc,void 0,void 0,t)}}function $A(e,t,n,r){let i=t+1>n+20?t-n-1:0,s=e.slice(i,t);return s.push(r),s}function gwt(e,t){let n=[],r=!1;return e.iterChangedRanges((i,s)=>n.push(i,s)),t.iterChangedRanges((i,s,a,l)=>{for(let c=0;c=u&&a<=d&&(r=!0)}}),r}function bwt(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function fxe(e,t){return e.length?t.length?e.concat(t):e:t}const jc=[],ywt=200;function hxe(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-ywt));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),$A(e,e.length-1,1e9,n.setSelAfter(r)))}else return[Go.selection([t])]}function Owt(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function EP(e,t){if(!e.length)return e;let n=e.length,r=jc;for(;n;){let i=xwt(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let s=e.slice(0,n);return s[n-1]=i,s}else t=i.mapped,n--,r=i.selectionsAfter}return r.length?[Go.selection(r)]:jc}function xwt(e,t,n){let r=fxe(e.selectionsAfter.length?e.selectionsAfter.map(l=>l.map(t)):jc,n);if(!e.changes)return Go.selection(r);let i=e.changes.map(t),s=t.mapDesc(e.changes,!0),a=e.mapped?e.mapped.composeDesc(s):s;return new Go(i,jn.mapEffects(e.effects,t),a,e.startSelection.map(s),r)}const vwt=/^(input\.type|delete)($|\.)/;class ld{constructor(t,n,r=0,i=void 0){this.done=t,this.undone=n,this.prevTime=r,this.prevUserEvent=i}isolate(){return this.prevTime?new ld(this.done,this.undone):this}addChanges(t,n,r,i,s){let a=this.done,l=a[a.length-1];return l&&l.changes&&!l.changes.empty&&t.changes&&(!r||vwt.test(r))&&(!l.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?e.moveByChar(n,t):fR(n,t))}function to(e){return e.textDirectionAt(e.state.selection.main.head)==wi.LTR}const mxe=e=>pxe(e,!to(e)),gxe=e=>pxe(e,to(e));function bxe(e,t){return Du(e,n=>n.empty?e.moveByGroup(n,t):fR(n,t))}const Swt=e=>bxe(e,!to(e)),Ewt=e=>bxe(e,to(e));function kwt(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function hR(e,t,n){let r=yi(e).resolveInner(t.head),i=n?An.closedBy:An.openedBy;for(let c=t.head;;){let u=n?r.childAfter(c):r.childBefore(c);if(!u)break;kwt(e,u,i)?r=u:c=n?u.to:u.from}let s=r.type.prop(i),a,l;return s&&(a=n?od(e,r.from,1):od(e,r.to,-1))&&a.matched?l=n?a.end.to:a.end.from:l=n?r.to:r.from,tt.cursor(l,n?-1:1)}const _wt=e=>Du(e,t=>hR(e.state,t,!to(e))),Twt=e=>Du(e,t=>hR(e.state,t,to(e)));function yxe(e,t){return Du(e,n=>{if(!n.empty)return fR(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const Oxe=e=>yxe(e,!1),xxe=e=>yxe(e,!0);function vxe(e){let t=e.scrollDOM.clientHeighta.empty?e.moveVertically(a,t,n.height):fR(a,t));if(i.eq(r.selection))return!1;let s;if(n.selfScroll){let a=e.coordsAtPos(r.selection.main.head),l=e.scrollDOM.getBoundingClientRect(),c=l.top+n.marginTop,u=l.bottom-n.marginBottom;a&&a.top>c&&a.bottomwxe(e,!1),P6=e=>wxe(e,!0);function gm(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let s=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&t.head!=r.from+s&&(i=tt.cursor(r.from+s))}return i}const Cwt=e=>Du(e,t=>gm(e,t,!0)),Awt=e=>Du(e,t=>gm(e,t,!1)),Nwt=e=>Du(e,t=>gm(e,t,!to(e))),jwt=e=>Du(e,t=>gm(e,t,to(e))),Rwt=e=>Du(e,t=>tt.cursor(e.lineBlockAt(t.head).from,1)),Iwt=e=>Du(e,t=>tt.cursor(e.lineBlockAt(t.head).to,-1));function Dwt(e,t,n){let r=!1,i=vO(e.selection,s=>{let a=od(e,s.head,-1)||od(e,s.head,1)||s.head>0&&od(e,s.head-1,1)||s.headDwt(e,t);function zc(e,t,n){let r=vO(e.state.selection,i=>{i.undirectional&&i.head>=i.anchor!=t&&(i=tt.range(i.head,i.anchor));let s=n(i);return tt.range(i.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return r.eq(e.state.selection)?!1:(e.dispatch(Iu(e.state,r)),!0)}function Sxe(e,t){return zc(e,t,n=>e.moveByChar(n,t))}const Exe=e=>Sxe(e,!to(e)),kxe=e=>Sxe(e,to(e));function _xe(e,t){return zc(e,t,n=>e.moveByGroup(n,t))}const Mwt=e=>_xe(e,!to(e)),Lwt=e=>_xe(e,to(e)),$wt=e=>{let t=!to(e);return zc(e,t,n=>hR(e.state,n,t))},Bwt=e=>{let t=to(e);return zc(e,t,n=>hR(e.state,n,t))};function Txe(e,t){return zc(e,t,n=>e.moveVertically(n,t))}const Cxe=e=>Txe(e,!1),Axe=e=>Txe(e,!0);function Nxe(e,t){return zc(e,t,n=>e.moveVertically(n,t,vxe(e).height))}const IK=e=>Nxe(e,!1),DK=e=>Nxe(e,!0),Qwt=e=>zc(e,!0,t=>gm(e,t,!0)),Uwt=e=>zc(e,!1,t=>gm(e,t,!1)),Fwt=e=>{let t=!to(e);return zc(e,t,n=>gm(e,n,t))},zwt=e=>{let t=to(e);return zc(e,t,n=>gm(e,n,t))},Vwt=e=>zc(e,!1,t=>tt.cursor(e.lineBlockAt(t.head).from)),Hwt=e=>zc(e,!0,t=>tt.cursor(e.lineBlockAt(t.head).to)),PK=({state:e,dispatch:t})=>(t(Iu(e,{anchor:0})),!0),MK=({state:e,dispatch:t})=>(t(Iu(e,{anchor:e.doc.length})),!0),LK=({state:e,dispatch:t})=>(t(Iu(e,{anchor:e.selection.main.anchor,head:0})),!0),$K=({state:e,dispatch:t})=>(t(Iu(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),qwt=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),Xwt=({state:e,dispatch:t})=>{let n=pR(e).map(({from:r,to:i})=>tt.range(r,Math.min(i+1,e.doc.length)));return t(e.update({selection:tt.create(n),userEvent:"select"})),!0},Gwt=({state:e,dispatch:t})=>{let n=vO(e.selection,r=>{let i=yi(e),s=i.resolveStack(r.from,1);if(r.empty){let a=i.resolveStack(r.from,-1);a.node.from>=s.node.from&&a.node.to<=s.node.to&&(s=a)}for(let a=s;a;a=a.next){let{node:l}=a;if((l.from=r.to||l.to>r.to&&l.from<=r.from)&&a.next)return tt.range(l.to,l.from)}return r});return n.eq(e.selection)?!1:(t(Iu(e,n)),!0)};function jxe(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let s of n.selection.ranges){let a=n.doc.lineAt(s.head);if(t?a.to0)for(let l=s;;){let c=e.moveVertically(l,t);if(c.heada.to){i.some(u=>u.head==c.head)||i.push(c);break}else{if(c.head==l.head)break;l=c}}}return i.length==r.ranges.length?!1:(e.dispatch(Iu(n,tt.create(i,i.length-1))),!0)}const Wwt=e=>jxe(e,!1),Ywt=e=>jxe(e,!0),Zwt=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=tt.create([n.main]):n.main.empty||(r=tt.create([tt.cursor(n.main.head)])),r?(t(Iu(e,r)),!0):!1};function HE(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,i=r.changeByRange(s=>{let{from:a,to:l}=s;if(a==l){let c=t(s);ca&&(n="delete.forward",c=a_(e,c,!0)),a=Math.min(a,c),l=Math.max(l,c)}else a=a_(e,a,!1),l=a_(e,l,!0);return a==l?{range:s}:{changes:{from:a,to:l},range:tt.cursor(a,ai(e)))r.between(t,t,(i,s)=>{it&&(t=n?s:i)});return t}const Rxe=(e,t,n)=>HE(e,r=>{let i=r.from,{state:s}=e,a=s.doc.lineAt(i),l,c;if(n&&!t&&i>a.from&&iRxe(e,!1,!0),Ixe=e=>Rxe(e,!0,!1),Dxe=(e,t)=>HE(e,n=>{let r=n.head,{state:i}=e,s=i.doc.lineAt(r),a=i.charCategorizer(r);for(let l=null;;){if(r==(t?s.to:s.from)){r==n.head&&s.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let c=ma(s.text,r-s.from,t)+s.from,u=s.text.slice(Math.min(r,c)-s.from,Math.max(r,c)-s.from),d=a(u);if(l!=null&&d!=l)break;(u!=" "||r!=n.head)&&(l=d),r=c}return r}),Pxe=e=>Dxe(e,!1),Kwt=e=>Dxe(e,!0),Jwt=e=>HE(e,t=>{let n=e.lineBlockAt(t.head).to;return t.headHE(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),tSt=e=>HE(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head{if(e.readOnly)return!1;let n=e.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:Br.of(["",""])},range:tt.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},rSt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>{if(!r.empty||r.from==0||r.from==e.doc.length)return{range:r};let i=r.from,s=e.doc.lineAt(i),a=i==s.from?i-1:ma(s.text,i-s.from,!1)+s.from,l=i==s.to?i+1:ma(s.text,i-s.from,!0)+s.from;return{changes:{from:a,to:l,insert:e.doc.slice(i,l).append(e.doc.slice(a,i))},range:tt.cursor(l)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function pR(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),s=e.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=e.doc.lineAt(r.to-1)),n>=i.number){let a=t[t.length-1];a.to=s.to,a.ranges.push(r)}else t.push({from:i.from,to:s.to,ranges:[r]});n=s.number+1}return t}function Mxe(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let s of pR(e)){if(n?s.to==e.doc.length:s.from==0)continue;let a=e.doc.lineAt(n?s.to+1:s.from-1),l=a.length+1;if(n){r.push({from:s.to,to:a.to},{from:s.from,insert:a.text+e.lineBreak});for(let c of s.ranges)i.push(tt.range(Math.min(e.doc.length,c.anchor+l),Math.min(e.doc.length,c.head+l)))}else{r.push({from:a.from,to:s.from},{from:s.to,insert:e.lineBreak+a.text});for(let c of s.ranges)i.push(tt.range(c.anchor-l,c.head-l))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:tt.create(i,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const iSt=({state:e,dispatch:t})=>Mxe(e,t,!1),sSt=({state:e,dispatch:t})=>Mxe(e,t,!0);function Lxe(e,t,n){if(e.readOnly)return!1;let r=[];for(let s of pR(e))n?r.push({from:s.from,insert:e.doc.slice(s.from,s.to)+e.lineBreak}):r.push({from:s.to,insert:e.lineBreak+e.doc.slice(s.from,s.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const aSt=({state:e,dispatch:t})=>Lxe(e,t,!1),oSt=({state:e,dispatch:t})=>Lxe(e,t,!0),lSt=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(pR(t).map(({from:i,to:s})=>(i>0?i--:s{let s;if(e.lineWrapping){let a=e.lineBlockAt(i.head),l=e.coordsAtPos(i.head,i.assoc||1);l&&(s=a.bottom+e.documentTop-l.bottom+e.defaultLineHeight/2)}return e.moveVertically(i,!0,s)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function cSt(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=yi(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),s;return r&&i&&r.to<=t&&i.from>=t&&(s=r.type.prop(An.closedBy))&&s.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}const BK=$xe(!1),uSt=$xe(!0);function $xe(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(i=>{let{from:s,to:a}=i,l=t.doc.lineAt(s),c=!e&&s==a&&cSt(t,s);e&&(s=a=(a<=l.to?l:t.doc.lineAt(a)).to);let u=new sR(t,{simulateBreak:s,simulateDoubleBreak:!!c}),d=TQ(u,s);for(d==null&&(d=Su(/^\s*/.exec(t.doc.lineAt(s).text)[0],t.tabSize));al.from&&s{let i=[];for(let a=r.from;a<=r.to;){let l=e.doc.lineAt(a);l.number>n&&(r.empty||r.to>l.from)&&(t(l,i,r),n=l.number),a=l.to+1}let s=e.changes(i);return{changes:i,range:tt.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const dSt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new sR(e,{overrideIndentation:s=>{let a=n[s];return a??-1}}),i=sU(e,(s,a,l)=>{let c=TQ(r,s.from);if(c==null)return;/\S/.test(s.text)||(c=0);let u=/^\s*/.exec(s.text)[0],d=fS(e,c);(u!=d||l.frome.readOnly?!1:(t(e.update(sU(e,(n,r)=>{r.push({from:n.from,insert:e.facet(OO)})}),{userEvent:"input.indent"})),!0),Qxe=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(sU(e,(n,r)=>{let i=/^\s*/.exec(n.text)[0];if(!i)return;let s=Su(i,e.tabSize),a=0,l=fS(e,Math.max(0,s-Kg(e)));for(;a(e.setTabFocusMode(),!0),hSt=[{key:"Ctrl-b",run:mxe,shift:Exe,preventDefault:!0},{key:"Ctrl-f",run:gxe,shift:kxe},{key:"Ctrl-p",run:Oxe,shift:Cxe},{key:"Ctrl-n",run:xxe,shift:Axe},{key:"Ctrl-a",run:Rwt,shift:Vwt},{key:"Ctrl-e",run:Iwt,shift:Hwt},{key:"Ctrl-d",run:Ixe},{key:"Ctrl-h",run:M6},{key:"Ctrl-k",run:Jwt},{key:"Ctrl-Alt-h",run:Pxe},{key:"Ctrl-o",run:nSt},{key:"Ctrl-t",run:rSt},{key:"Ctrl-v",run:P6}],pSt=[{key:"ArrowLeft",run:mxe,shift:Exe,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Swt,shift:Mwt,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Nwt,shift:Fwt,preventDefault:!0},{key:"ArrowRight",run:gxe,shift:kxe,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Ewt,shift:Lwt,preventDefault:!0},{mac:"Cmd-ArrowRight",run:jwt,shift:zwt,preventDefault:!0},{key:"ArrowUp",run:Oxe,shift:Cxe,preventDefault:!0},{mac:"Cmd-ArrowUp",run:PK,shift:LK},{mac:"Ctrl-ArrowUp",run:RK,shift:IK},{key:"ArrowDown",run:xxe,shift:Axe,preventDefault:!0},{mac:"Cmd-ArrowDown",run:MK,shift:$K},{mac:"Ctrl-ArrowDown",run:P6,shift:DK},{key:"PageUp",run:RK,shift:IK},{key:"PageDown",run:P6,shift:DK},{key:"Home",run:Awt,shift:Uwt,preventDefault:!0},{key:"Mod-Home",run:PK,shift:LK},{key:"End",run:Cwt,shift:Qwt,preventDefault:!0},{key:"Mod-End",run:MK,shift:$K},{key:"Enter",run:BK,shift:BK},{key:"Mod-a",run:qwt},{key:"Backspace",run:M6,shift:M6,preventDefault:!0},{key:"Delete",run:Ixe,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Pxe,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Kwt,preventDefault:!0},{mac:"Mod-Backspace",run:eSt,preventDefault:!0},{mac:"Mod-Delete",run:tSt,preventDefault:!0}].concat(hSt.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),mSt=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:_wt,shift:$wt},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Twt,shift:Bwt},{key:"Alt-ArrowUp",run:iSt},{key:"Shift-Alt-ArrowUp",run:aSt},{key:"Alt-ArrowDown",run:sSt},{key:"Shift-Alt-ArrowDown",run:oSt},{key:"Mod-Alt-ArrowUp",run:Wwt},{key:"Mod-Alt-ArrowDown",run:Ywt},{key:"Escape",run:Zwt},{key:"Mod-Enter",run:uSt},{key:"Alt-l",mac:"Ctrl-l",run:Xwt},{key:"Mod-i",run:Gwt,preventDefault:!0},{key:"Mod-[",run:Qxe},{key:"Mod-]",run:Bxe},{key:"Mod-Alt-\\",run:dSt},{key:"Shift-Mod-k",run:lSt},{key:"Shift-Mod-\\",run:Pwt},{key:"Mod-/",run:iwt},{key:"Alt-A",run:awt},{key:"Ctrl-m",mac:"Shift-Alt-m",run:fSt}].concat(pSt),gSt={key:"Tab",run:Bxe,shift:Qxe},QK=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class C1{constructor(t,n,r=0,i=t.length,s,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(r,i),this.bufferStart=r,this.normalize=s?l=>s(QK(l)):QK,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Qo(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let n=oQ(t),r=this.bufferStart+this.bufferPos;this.bufferPos+=Ku(t);let i=this.normalize(n);if(i.length)for(let s=0,a=r,l=!0;;s++){let c=i.charCodeAt(s),u=this.match(c,a,l,this.bufferPos+this.bufferStart,s==i.length-1);if(u)return this.value=u,this;if(s==i.length-1)break;l&&sthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,i=r+n[0].length;if(this.matchPos=BA(this.text,i+(r==i?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(rthis.value.to)&&(!this.test||this.test(r,i,n)))return this.value={from:r,to:i,precise:!0,match:n},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=r||i.to<=n){let l=new Ry(n,t.sliceString(n,r));return kP.set(t,l),l}if(i.from==n&&i.to==r)return i;let{text:s,from:a}=i;return a>n&&(s=t.sliceString(n,a)+s,a=n),i.to=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==t&&(this.re.lastIndex=t+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,i=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,i,n)))return this.value={from:r,to:i,precise:!0,match:n},this.matchPos=BA(this.text,i+(r==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ry.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Fxe.prototype[Symbol.iterator]=zxe.prototype[Symbol.iterator]=function(){return this});function bSt(e){try{return new RegExp(e,aU),!0}catch{return!1}}function BA(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t=56320&&r<57344;)t++;return t}const ySt=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:i}=Cgt(e,{label:t.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:t.phrase("go")});return i.then(s=>{let a=s&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(s.elements.line.value);if(!a){e.dispatch({effects:r});return}let l=t.doc.lineAt(t.selection.main.head),[,c,u,d,f]=a,h=d?+d.slice(1):0,m=u?+u:l.number;if(u&&f){let y=m/100;c&&(y=y*(c=="-"?-1:1)+l.number/t.doc.lines),m=Math.round(t.doc.lines*y)}else u&&c&&(m=m*(c=="-"?-1:1)+l.number);let g=t.doc.line(Math.max(1,Math.min(t.doc.lines,m))),b=tt.cursor(g.from+Math.max(0,Math.min(h,g.length)));e.dispatch({effects:[r,Ct.scrollIntoView(b.from,{y:"center"})],selection:b})}),!0},OSt={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},xSt=Qt.define({combine(e){return Rd(e,OSt,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function vSt(e){return[_St,kSt]}const wSt=ln.mark({class:"cm-selectionMatch"}),SSt=ln.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function UK(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=Yi.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=Yi.Word)}function ESt(e,t,n,r){return e(t.sliceDoc(n,n+1))==Yi.Word&&e(t.sliceDoc(r-1,r))==Yi.Word}const kSt=ms.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(xSt),{state:n}=e,r=n.selection;if(r.ranges.length>1)return ln.none;let i=r.main,s,a=null;if(i.empty){if(!t.highlightWordAroundCursor)return ln.none;let c=n.wordAt(i.head);if(!c)return ln.none;a=n.charCategorizer(i.head),s=n.sliceDoc(c.from,c.to)}else{let c=i.to-i.from;if(c200)return ln.none;if(t.wholeWords){if(s=n.sliceDoc(i.from,i.to),a=n.charCategorizer(i.head),!(UK(a,n,i.from,i.to)&&ESt(a,n,i.from,i.to)))return ln.none}else if(s=n.sliceDoc(i.from,i.to),!s)return ln.none}let l=[];for(let c of e.visibleRanges){let u=new C1(n.doc,s,c.from,c.to);for(;!u.next().done;){let{from:d,to:f}=u.value;if((!a||UK(a,n,d,f))&&(i.empty&&d<=i.from&&f>=i.to?l.push(SSt.range(d,f)):(d>=i.to||f<=i.from)&&l.push(wSt.range(d,f)),l.length>t.maxMatches))return ln.none}}return ln.set(l)}},{decorations:e=>e.decorations}),_St=Ct.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),TSt=({state:e,dispatch:t})=>{let{selection:n}=e,r=tt.create(n.ranges.map(i=>e.wordAt(i.head)||tt.cursor(i.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function CSt(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),s=i&&i.from==n.from&&i.to==n.to;for(let a=!1,l=new C1(e.doc,t,r[r.length-1].to);;)if(l.next(),l.done){if(a)return null;l=new C1(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),a=!0}else{if(a&&r.some(c=>c.from==l.value.from))continue;if(s){let c=e.wordAt(l.value.from);if(!c||c.from!=l.value.from||c.to!=l.value.to)continue}return l.value}}const ASt=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(s=>s.from===s.to))return TSt({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(s=>e.sliceDoc(s.from,s.to)!=r))return!1;let i=CSt(e,r);return i?(t(e.update({selection:e.selection.addRange(tt.range(i.from,i.to),!1),effects:Ct.scrollIntoView(i.to)})),!0):!1},wO=Qt.define({combine(e){return Rd(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new zSt(t),scrollToMatch:t=>Ct.scrollIntoView(t)})}});class Vxe{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||bSt(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord,this.test=t.test}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?` +`:r=="r"?"\r":r=="t"?" ":"\\")}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord&&this.test==t.test}create(){return this.regexp?new PSt(this):new RSt(this)}getCursor(t,n=0,r){let i=t.doc?t:xr.create({doc:t});return r==null&&(r=i.doc.length),this.regexp?Sb(this,i,n,r):wb(this,i,n,r)}}class Hxe{constructor(t){this.spec=t}}function NSt(e,t,n){return(r,i,s,a)=>{if(n&&!n(r,i,s,a))return!1;let l=r>=a&&i<=a+s.length?s.slice(r-a,i-a):t.doc.sliceString(r,i);return e(l,t,r,i)}}function wb(e,t,n,r){let i;return e.wholeWord&&(i=jSt(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=NSt(e.test,t,i)),new C1(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:s=>s.toLowerCase(),i)}function jSt(e,t){return(n,r,i,s)=>((s>n||s+i.length=n)return null;i.push(r.value)}return i}highlight(t,n,r,i){let s=wb(this.spec,t,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,t.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}function ISt(e,t,n){return(r,i,s)=>(!n||n(r,i,s))&&e(s[0],t,r,i)}function Sb(e,t,n,r){let i;return e.wholeWord&&(i=DSt(t.charCategorizer(t.selection.main.head))),e.test&&(i=ISt(e.test,t,i)),new Fxe(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function QA(e,t){return e.slice(ma(e,t,!1),t)}function UA(e,t){return e.slice(t,ma(e,t))}function DSt(e){return(t,n,r)=>!r[0].length||(e(QA(r.input,r.index))!=Yi.Word||e(UA(r.input,r.index))!=Yi.Word)&&(e(UA(r.input,r.index+r[0].length))!=Yi.Word||e(QA(r.input,r.index+r[0].length))!=Yi.Word)}class PSt extends Hxe{nextMatch(t,n,r){let i=Sb(this.spec,t,r,t.doc.length).next();return i.done&&(i=Sb(this.spec,t,0,n).next()),i.done?null:i.value}prevMatchInRange(t,n,r){for(let i=1;;i++){let s=Math.max(n,r-i*1e4),a=Sb(this.spec,t,s,r),l=null;for(;!a.next().done;)l=a.value;if(l&&(s==n||l.from>s+10))return l;if(s==n)return null}}prevMatch(t,n,r){return this.prevMatchInRange(t,0,n)||this.prevMatchInRange(t,r,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return t.match[0];if(r=="$")return"$";for(let i=r.length;i>0;i--){let s=+r.slice(0,i);if(s>0&&s=n)return null;i.push(r.value)}return i}highlight(t,n,r,i){let s=Sb(this.spec,t,Math.max(0,n-250),Math.min(r+250,t.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}const SS=jn.define(),oU=jn.define(),Ip=Ba.define({create(e){return new _P(L6(e).create(),null)},update(e,t){for(let n of t.effects)n.is(SS)?e=new _P(n.value.create(),e.panel):n.is(oU)&&(e=new _P(e.query,n.value?lU:null));return e},provide:e=>uS.from(e,t=>t.panel)});class _P{constructor(t,n){this.query=t,this.panel=n}}const MSt=ln.mark({class:"cm-searchMatch"}),LSt=ln.mark({class:"cm-searchMatch cm-searchMatch-selected"}),$St=ms.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(Ip))}update(e){let t=e.state.field(Ip);(t!=e.startState.field(Ip)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return ln.none;let{view:n}=this,r=new sh;for(let i=0,s=n.visibleRanges,a=s.length;is[i+1].from-2*250;)c=s[++i].to;e.highlight(n.state,l,c,(u,d)=>{let f=n.state.selection.ranges.some(h=>h.from==u&&h.to==d);r.add(u,d,f?LSt:MSt)})}return r.finish()}},{decorations:e=>e.decorations});function qE(e){return t=>{let n=t.state.field(Ip,!1);return n&&n.query.spec.valid?e(t,n):Gxe(t)}}const FA=qE((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=tt.single(r.from,r.to),s=e.state.facet(wO);return e.dispatch({selection:i,effects:[cU(e,r),s.scrollToMatch(i.main,e)],userEvent:"select.search"}),Xxe(e),!0}),zA=qE((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let s=tt.single(i.from,i.to),a=e.state.facet(wO);return e.dispatch({selection:s,effects:[cU(e,i),a.scrollToMatch(s.main,e)],userEvent:"select.search"}),Xxe(e),!0}),BSt=qE((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:tt.create(n.map(r=>tt.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),QSt=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,s=[],a=0;for(let l=new C1(e.doc,e.sliceDoc(r,i));!l.next().done;){if(s.length>1e3)return!1;l.value.from==r&&(a=s.length),s.push(tt.range(l.value.from,l.value.to))}return t(e.update({selection:tt.create(s,a),userEvent:"select.search.matches"})),!0},FK=qE((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let s=t.nextMatch(n,r,r);if(!s)return!1;let a=s,l=[],c,u,d=[];a.precise?a.from==r&&a.to==i&&(u=n.toText(t.getReplacement(a)),l.push({from:a.from,to:a.to,insert:u}),a=t.nextMatch(n,a.from,a.to),d.push(Ct.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."))):a=t.nextMatch(n,a.from,a.to);let f=e.state.changes(l);return a&&(c=tt.single(a.from,a.to).map(f),d.push(cU(e,a)),d.push(n.facet(wO).scrollToMatch(c.main,e))),e.dispatch({changes:f,selection:c,effects:d,userEvent:"input.replace"}),!0}),USt=qE((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let i of t.matchAll(e.state,1e9)){let{from:s,to:a,precise:l}=i;l&&n.push({from:s,to:a,insert:t.getReplacement(i)})}if(!n.length)return!1;let r=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:Ct.announce.of(r),userEvent:"input.replace.all"}),!0});function lU(e){return e.state.facet(wO).createPanel(e)}function L6(e,t){var n,r,i,s,a;let l=e.selection.main,c=l.empty||l.to>l.from+100?"":e.sliceDoc(l.from,l.to);if(t&&!c)return t;let u=e.facet(wO);return new Vxe({search:((n=t==null?void 0:t.literal)!==null&&n!==void 0?n:u.literal)?c:c.replace(/\n/g,"\\n"),caseSensitive:(r=t==null?void 0:t.caseSensitive)!==null&&r!==void 0?r:u.caseSensitive,literal:(i=t==null?void 0:t.literal)!==null&&i!==void 0?i:u.literal,regexp:(s=t==null?void 0:t.regexp)!==null&&s!==void 0?s:u.regexp,wholeWord:(a=t==null?void 0:t.wholeWord)!==null&&a!==void 0?a:u.wholeWord})}function qxe(e){let t=kQ(e,lU);return t&&t.dom.querySelector("[main-field]")}function Xxe(e){let t=qxe(e);t&&t==e.root.activeElement&&t.select()}const Gxe=e=>{let t=e.state.field(Ip,!1);if(t&&t.panel){let n=qxe(e);if(n&&n!=e.root.activeElement){let r=L6(e.state,t.query.spec);r.valid&&e.dispatch({effects:SS.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[oU.of(!0),t?SS.of(L6(e.state,t.query.spec)):jn.appendConfig.of(HSt)]});return!0},Wxe=e=>{let t=e.state.field(Ip,!1);if(!t||!t.panel)return!1;let n=kQ(e,lU);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:oU.of(!1)}),!0},FSt=[{key:"Mod-f",run:Gxe,scope:"editor search-panel"},{key:"F3",run:FA,shift:zA,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:FA,shift:zA,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Wxe,scope:"editor search-panel"},{key:"Mod-Shift-l",run:QSt},{key:"Mod-Alt-g",run:ySt},{key:"Mod-d",run:ASt,preventDefault:!0}];class zSt{constructor(t){this.view=t;let n=this.query=t.state.field(Ip).query.spec;this.commit=this.commit.bind(this),this.searchField=mi("input",{value:n.search,placeholder:pl(t,"Find"),"aria-label":pl(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=mi("input",{value:n.replace,placeholder:pl(t,"Replace"),"aria-label":pl(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=mi("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=mi("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=mi("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(i,s,a){return mi("button",{class:"cm-button",name:i,onclick:s,type:"button"},a)}this.dom=mi("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,r("next",()=>FA(t),[pl(t,"next")]),r("prev",()=>zA(t),[pl(t,"previous")]),r("select",()=>BSt(t),[pl(t,"all")]),mi("label",null,[this.caseField,pl(t,"match case")]),mi("label",null,[this.reField,pl(t,"regexp")]),mi("label",null,[this.wordField,pl(t,"by word")]),...t.state.readOnly?[]:[mi("br"),this.replaceField,r("replace",()=>FK(t),[pl(t,"replace")]),r("replaceAll",()=>USt(t),[pl(t,"replace all")])],mi("button",{name:"close",onclick:()=>Wxe(t),"aria-label":pl(t,"close"),type:"button"},["×"])])}commit(){let t=new Vxe({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:SS.of(t)}))}keydown(t){Lmt(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?zA:FA)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),FK(this.view))}update(t){for(let n of t.transactions)for(let r of n.effects)r.is(SS)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(wO).top}}function pl(e,t){return e.state.phrase(t)}const o_=30,l_=/[\s\.,:;?!]/;function cU(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,s=Math.max(r.from,t-o_),a=Math.min(i,n+o_),l=e.state.sliceDoc(s,a);if(s!=r.from){for(let c=0;cl.length-o_;c--)if(!l_.test(l[c-1])&&l_.test(l[c])){l=l.slice(0,c);break}}return Ct.announce.of(`${e.state.phrase("current match")}. ${l} ${e.state.phrase("on line")} ${r.number}.`)}const VSt=Ct.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),HSt=[Ip,xh.low($St),VSt];class zK{constructor(t,n,r){this.from=t,this.to=n,this.diagnostic=r}}class Jm{constructor(t,n,r){this.diagnostics=t,this.panel=n,this.selected=r}static init(t,n,r){let i=r.facet(ES).markerFilter;i&&(t=i(t,r));let s=t.slice().sort((m,g)=>m.from-g.from||m.to-g.to),a=new sh,l=[],c=0,u=r.doc.iter(),d=0,f=r.doc.length;for(let m=0;;){let g=m==s.length?null:s[m];if(!g&&!l.length)break;let b,y;if(l.length)b=c,y=l.reduce((x,w)=>Math.min(x,w.to),g&&g.from>b?g.from:1e8);else{if(b=g.from,b>f)break;y=g.to,l.push(g),m++}for(;mx.from||x.to==b))l.push(x),m++,y=Math.min(x.to,y);else{y=Math.min(x.from,y);break}}y=Math.min(y,f);let O=!1;if(l.some(x=>x.from==b&&(x.to==y||y==f))&&(O=b==y,!O&&y-b<10)){let x=b-(d+u.value.length);x>0&&(u.next(x),d=b);for(let w=b;;){if(w>=y){O=!0;break}if(!u.lineBreak&&d+u.value.length>w)break;w=d+u.value.length,d+=u.value.length,u.next()}}let v=iEt(l);if(O)a.add(b,b,ln.widget({widget:new eEt(v),diagnostics:l.slice()}));else{let x=l.reduce((w,S)=>S.markClass?w+" "+S.markClass:w,"");a.add(b,y,ln.mark({class:"cm-lintRange cm-lintRange-"+v+x,diagnostics:l.slice(),inclusiveEnd:l.some(w=>w.to>y)}))}if(c=y,c==f)break;for(let x=0;x{if(!(t&&a.diagnostics.indexOf(t)<0))if(!r)r=new zK(i,s,t||a.diagnostics[0]);else{if(a.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new zK(r.from,s,r.diagnostic)}}),r}function qSt(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(ES).hideOn(e,n,r);if(i!=null)return i;let s=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(a=>a.is(Yxe))||e.changes.touchesRange(s.from,Math.max(s.to,r)))}function XSt(e,t){return e.field(Nl,!1)?t:t.concat(jn.appendConfig.of(sEt))}const Yxe=jn.define(),uU=jn.define(),Zxe=jn.define(),Nl=Ba.define({create(){return new Jm(ln.none,null,null)},update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let s=t.changes.mapPos(e.selected.from,1);r=im(n,e.selected.diagnostic,s)||im(n,null,s)}!n.size&&i&&t.state.facet(ES).autoPanel&&(i=null),e=new Jm(n,i,r)}for(let n of t.effects)if(n.is(Yxe)){let r=t.state.facet(ES).autoPanel?n.value.length?kS.open:null:e.panel;e=Jm.init(n.value,r,t.state)}else n.is(uU)?e=new Jm(e.diagnostics,n.value?kS.open:null,e.selected):n.is(Zxe)&&(e=new Jm(e.diagnostics,e.panel,n.value));return e},provide:e=>[uS.from(e,t=>t.panel),Ct.decorations.from(e,t=>t.diagnostics)]}),GSt=ln.mark({class:"cm-lintRange cm-lintRange-active"});function WSt(e,t,n){let{diagnostics:r}=e.state.field(Nl),i,s=-1,a=-1;r.between(t-(n<0?1:0),t+(n>0?1:0),(c,u,{spec:d})=>{if(t>=c&&t<=u&&(c==u||(t>c||n>0)&&(tJxe(e,n,!1)))}const ZSt=e=>{let t=e.state.field(Nl,!1);(!t||!t.panel)&&e.dispatch({effects:XSt(e.state,[uU.of(!0)])});let n=kQ(e,kS.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},VK=e=>{let t=e.state.field(Nl,!1);return!t||!t.panel?!1:(e.dispatch({effects:uU.of(!1)}),!0)},KSt=e=>{let t=e.state.field(Nl,!1);if(!t)return!1;let n=e.state.selection.main,r=im(t.diagnostics,null,n.to+1);return!r&&(r=im(t.diagnostics,null,0),!r||r.from==n.from&&r.to==n.to)?!1:(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),_gt(e,r.from,1,{tooltip:eve,until:i=>i.docChanged||i.newSelection.main.headr.to}),!0)},JSt=[{key:"Mod-Shift-m",run:ZSt,preventDefault:!0},{key:"F8",run:KSt}],ES=Qt.define({combine(e){return{sources:e.map(t=>t.source).filter(t=>t!=null),...Rd(e.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:HK,tooltipFilter:HK,needsRefresh:(t,n)=>t?n?r=>t(r)||n(r):t:n,hideOn:(t,n)=>t?n?(r,i,s)=>t(r,i,s)||n(r,i,s):t:n,autoPanel:(t,n)=>t||n})}}});function HK(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function Kxe(e){let t=[];if(e)e:for(let{name:n}of e){for(let r=0;rs.toLowerCase()==i.toLowerCase())){t.push(i);continue e}}t.push("")}return t}function Jxe(e,t,n){var r;let i=n?Kxe(t.actions):[];return mi("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},mi("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),(r=t.actions)===null||r===void 0?void 0:r.map((s,a)=>{let l=!1,c=m=>{if(m.preventDefault(),l)return;l=!0;let g=im(e.state.field(Nl).diagnostics,t);g&&s.apply(e,g.from,g.to)},{name:u}=s,d=i[a]?u.indexOf(i[a]):-1,f=d<0?u:[u.slice(0,d),mi("u",u.slice(d,d+1)),u.slice(d+1)],h=s.markClass?" "+s.markClass:"";return mi("button",{type:"button",class:"cm-diagnosticAction"+h,onclick:c,onmousedown:c,"aria-label":` Action: ${u}${d<0?"":` (access key "${i[a]})"`}.`},f)}),t.source&&mi("div",{class:"cm-diagnosticSource"},t.source))}class eEt extends Ru{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return mi("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class qK{constructor(t,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Jxe(t,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class kS{constructor(t){this.view=t,this.items=[];let n=i=>{if(!(i.ctrlKey||i.altKey||i.metaKey)){if(i.keyCode==27)VK(this.view),this.view.focus();else if(i.keyCode==38||i.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(i.keyCode==40||i.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(i.keyCode==36)this.moveSelection(0);else if(i.keyCode==35)this.moveSelection(this.items.length-1);else if(i.keyCode==13)this.view.focus();else if(i.keyCode>=65&&i.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],a=Kxe(s.actions);for(let l=0;l{for(let s=0;sVK(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(Nl).selected;if(!t)return-1;for(let n=0;n{for(let d of u.diagnostics){if(a.has(d))continue;a.add(d);let f=-1,h;for(let m=r;mr&&(this.items.splice(r,f-r),i=!0)),n&&h.diagnostic==n.diagnostic?h.dom.hasAttribute("aria-selected")||(h.dom.setAttribute("aria-selected","true"),s=h):h.dom.hasAttribute("aria-selected")&&h.dom.removeAttribute("aria-selected"),r++}});r({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:c})=>{let u=c.height/this.list.offsetHeight;l.topc.bottom&&(this.list.scrollTop+=(l.bottom-c.bottom)/u)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let t=this.list.firstChild;function n(){let r=t;t=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;t!=r.dom;)n();t=r.dom.nextSibling}else this.list.insertBefore(r.dom,t);for(;t;)n()}moveSelection(t){if(this.selectedIndex<0)return;let n=this.view.state.field(Nl),r=im(n.diagnostics,this.items[t].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:Zxe.of(r)})}static open(t){return new kS(t)}}function tEt(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(e)}')`}function c_(e){return tEt(``,'width="6" height="3"')}const nEt=Ct.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:c_("#f11")},".cm-lintRange-warning":{backgroundImage:c_("orange")},".cm-lintRange-info":{backgroundImage:c_("#999")},".cm-lintRange-hint":{backgroundImage:c_("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function rEt(e){return e=="error"?4:e=="warning"?3:e=="info"?2:1}function iEt(e){let t="hint",n=1;for(let r of e){let i=rEt(r.severity);i>n&&(n=i,t=r.severity)}return t}const eve=kgt(WSt,{hideOn:qSt}),sEt=[Nl,Ct.decorations.compute([Nl],e=>{let{selected:t,panel:n}=e.field(Nl);return!t||!n||t.from==t.to?ln.none:ln.set([GSt.range(t.from,t.to)])}),eve,nEt];var XK=function(t){t===void 0&&(t={});var n=t,r=n.crosshairCursor,i=r===void 0?!1:r,s=[];t.closeBracketsKeymap!==!1&&(s=s.concat(fyt)),t.defaultKeymap!==!1&&(s=s.concat(mSt)),t.searchKeymap!==!1&&(s=s.concat(FSt)),t.historyKeymap!==!1&&(s=s.concat(wwt)),t.foldKeymap!==!1&&(s=s.concat(g0t)),t.completionKeymap!==!1&&(s=s.concat(R1e)),t.lintKeymap!==!1&&(s=s.concat(JSt));var a=[];return t.lineNumbers!==!1&&a.push(Bgt()),t.highlightActiveLineGutter!==!1&&a.push(Fgt()),t.highlightSpecialChars!==!1&&a.push(egt()),t.history!==!1&&a.push(hwt()),t.foldGutter!==!1&&a.push(x0t()),t.drawSelection!==!1&&a.push(zmt()),t.dropCursor!==!1&&a.push(Gmt()),t.allowMultipleSelections!==!1&&a.push(xr.allowMultipleSelections.of(!0)),t.indentOnInput!==!1&&a.push(l0t()),t.syntaxHighlighting!==!1&&a.push(u1e(E0t,{fallback:!0})),t.bracketMatching!==!1&&a.push(j0t()),t.closeBrackets!==!1&&a.push(lyt()),t.autocompletion!==!1&&a.push(Oyt()),t.rectangularSelection!==!1&&a.push(pgt()),i!==!1&&a.push(bgt()),t.highlightActiveLine!==!1&&a.push(agt()),t.highlightSelectionMatches!==!1&&a.push(vSt()),t.tabSize&&typeof t.tabSize=="number"&&a.push(OO.of(" ".repeat(t.tabSize))),a.concat([yO.of(s.flat())]).filter(Boolean)};const aEt="#e5c07b",GK="#e06c75",oEt="#56b6c2",lEt="#ffffff",CT="#abb2bf",$6="#7d8799",cEt="#61afef",uEt="#98c379",WK="#d19a66",dEt="#c678dd",fEt="#21252b",YK="#2c313a",ZK="#282c34",TP="#353a42",hEt="#3E4451",KK="#528bff",pEt=Ct.theme({"&":{color:CT,backgroundColor:ZK},".cm-content":{caretColor:KK},".cm-cursor, .cm-dropCursor":{borderLeftColor:KK},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:hEt},".cm-panels":{backgroundColor:fEt,color:CT},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:ZK,color:$6,border:"none"},".cm-activeLineGutter":{backgroundColor:YK},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:TP},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:TP,borderBottomColor:TP},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:YK,color:CT}}},{dark:!0}),mEt=zE.define([{tag:Z.keyword,color:dEt},{tag:[Z.name,Z.deleted,Z.character,Z.propertyName,Z.macroName],color:GK},{tag:[Z.function(Z.variableName),Z.labelName],color:cEt},{tag:[Z.color,Z.constant(Z.name),Z.standard(Z.name)],color:WK},{tag:[Z.definition(Z.name),Z.separator],color:CT},{tag:[Z.typeName,Z.className,Z.number,Z.changed,Z.annotation,Z.modifier,Z.self,Z.namespace],color:aEt},{tag:[Z.operator,Z.operatorKeyword,Z.url,Z.escape,Z.regexp,Z.link,Z.special(Z.string)],color:oEt},{tag:[Z.meta,Z.comment],color:$6},{tag:Z.strong,fontWeight:"bold"},{tag:Z.emphasis,fontStyle:"italic"},{tag:Z.strikethrough,textDecoration:"line-through"},{tag:Z.link,color:$6,textDecoration:"underline"},{tag:Z.heading,fontWeight:"bold",color:GK},{tag:[Z.atom,Z.bool,Z.special(Z.variableName)],color:WK},{tag:[Z.processingInstruction,Z.string,Z.inserted],color:uEt},{tag:Z.invalid,color:lEt}]),gEt=[pEt,u1e(mEt)];var bEt=Ct.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),yEt=function(t){t===void 0&&(t={});var n=t,r=n.indentWithTab,i=r===void 0?!0:r,s=n.editable,a=s===void 0?!0:s,l=n.readOnly,c=l===void 0?!1:l,u=n.theme,d=u===void 0?"light":u,f=n.placeholder,h=f===void 0?"":f,m=n.basicSetup,g=m===void 0?!0:m,b=[];switch(i&&b.unshift(yO.of([gSt])),g&&(typeof g=="boolean"?b.unshift(XK()):b.unshift(XK(g))),h&&b.unshift(ugt(h)),d){case"light":b.push(bEt);break;case"dark":b.push(gEt);break;case"none":break;default:b.push(d);break}return a===!1&&b.push(Ct.editable.of(!1)),c&&b.push(xr.readOnly.of(!0)),[...b]},OEt=e=>({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to)),selectedText:e.state.selection.ranges.some(t=>!t.empty)});class xEt{constructor(t,n){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=n,this.timeoutMS=n,this.callbacks.push(t)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var t=this.callbacks.slice();this.callbacks.length=0,t.forEach(n=>{try{n()}catch(r){console.error("TimeoutLatch callback error:",r)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class JK{constructor(){this.interval=null,this.latches=new Set}add(t){this.latches.add(t),this.start()}remove(t){this.latches.delete(t),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(t=>{t.tick(),t.isDone&&this.remove(t)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var CP=null,vEt=()=>typeof window>"u"?new JK:(CP||(CP=new JK),CP),wEt=Ct.theme({"& .cm-scroller":{height:"100% !important"}}),eJ=null,AP=null;function SEt(e,t,n,r,i,s){if(!e&&!t&&!n&&!r&&!i&&!s)return null;var a=JSON.stringify({height:e,minHeight:t,maxHeight:n,width:r,minWidth:i,maxWidth:s});return a===eJ||(eJ=a,AP=Ct.theme({"&":{height:e,minHeight:t,maxHeight:n,width:r,minWidth:i,maxWidth:s}})),AP}var tJ=jd.define(),EEt=200,kEt=[];function _Et(e){var t=e.value,n=e.selection,r=e.onChange,i=e.onStatistics,s=e.onCreateEditor,a=e.onUpdate,l=e.extensions,c=l===void 0?kEt:l,u=e.autoFocus,d=e.theme,f=d===void 0?"light":d,h=e.height,m=h===void 0?null:h,g=e.minHeight,b=g===void 0?null:g,y=e.maxHeight,O=y===void 0?null:y,v=e.width,x=v===void 0?null:v,w=e.minWidth,S=w===void 0?null:w,E=e.maxWidth,k=E===void 0?null:E,_=e.placeholder,T=_===void 0?"":_,C=e.editable,A=C===void 0?!0:C,j=e.readOnly,M=j===void 0?!1:j,I=e.indentWithTab,$=I===void 0?!0:I,N=e.basicSetup,D=N===void 0?!0:N,Q=e.root,F=e.initialState,L=p.useState(),H=L[0],z=L[1],B=p.useState(),V=B[0],W=B[1],le=p.useState(),be=le[0],re=le[1],q=p.useState(()=>({current:null}))[0],G=p.useState(()=>({current:null}))[0],J=SEt(m,b,O,x,S,k),de=Ct.updateListener.of(Ae=>{if(Ae.docChanged&&typeof r=="function"&&!Ae.transactions.some(Ce=>Ce.annotation(tJ))){q.current?q.current.reset():(q.current=new xEt(()=>{if(G.current){var Ce=G.current;G.current=null,Ce()}q.current=null},EEt),vEt().add(q.current));var Ue=Ae.state.doc,Ke=Ue.toString();r(Ke,Ae)}i&&i(OEt(Ae))}),ve=yEt({theme:f,editable:A,readOnly:M,placeholder:T,indentWithTab:$,basicSetup:D}),Pe=[de,...J?[J]:[],wEt,...ve];return a&&typeof a=="function"&&Pe.push(Ct.updateListener.of(a)),Pe=Pe.concat(c),p.useLayoutEffect(()=>{if(H&&!be){var Ae={doc:t,selection:n,extensions:Pe},Ue=F?xr.fromJSON(F.json,Ae,F.fields):xr.create(Ae);if(re(Ue),!V){var Ke=new Ct({state:Ue,parent:H,root:Q});W(Ke),s&&s(Ke,Ue)}}return()=>{V&&(re(void 0),W(void 0))}},[H,be]),p.useEffect(()=>{e.container&&z(e.container)},[e.container]),p.useEffect(()=>()=>{V&&(V.destroy(),W(void 0)),q.current&&(q.current.cancel(),q.current=null)},[V]),p.useEffect(()=>{u&&V&&V.focus()},[u,V]),p.useEffect(()=>{V&&V.dispatch({effects:jn.reconfigure.of(Pe)})},[f,c,m,b,O,x,S,k,T,A,M,$,D,r,a]),p.useEffect(()=>{if(t!==void 0){var Ae=V?V.state.doc.toString():"";if(V&&t!==Ae){var Ue=q.current&&!q.current.isDone,Ke=()=>{V&&t!==V.state.doc.toString()&&V.dispatch({changes:{from:0,to:V.state.doc.toString().length,insert:t||""},annotations:[tJ.of(!0)]})};Ue?G.current=Ke:Ke()}}},[t,V]),{state:be,setState:re,view:V,setView:W,container:H,setContainer:z}}var TEt=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],tve=p.forwardRef((e,t)=>{var n=e.className,r=e.value,i=r===void 0?"":r,s=e.selection,a=e.extensions,l=a===void 0?[]:a,c=e.onChange,u=e.onStatistics,d=e.onCreateEditor,f=e.onUpdate,h=e.autoFocus,m=e.theme,g=m===void 0?"light":m,b=e.height,y=e.minHeight,O=e.maxHeight,v=e.width,x=e.minWidth,w=e.maxWidth,S=e.basicSetup,E=e.placeholder,k=e.indentWithTab,_=e.editable,T=e.readOnly,C=e.root,A=e.initialState,j=rwt(e,TEt),M=p.useRef(null),I=_Et({root:C,value:i,autoFocus:h,theme:g,height:b,minHeight:y,maxHeight:O,width:v,minWidth:x,maxWidth:w,basicSetup:S,placeholder:E,indentWithTab:k,editable:_,readOnly:T,selection:s,onChange:c,onStatistics:u,onCreateEditor:d,onUpdate:f,extensions:l,initialState:A}),$=I.state,N=I.view,D=I.container,Q=I.setContainer;p.useImperativeHandle(t,()=>({editor:M.current,state:$,view:N}),[M,D,$,N]);var F=p.useCallback(H=>{M.current=H,Q(H)},[Q]);if(typeof i!="string")throw new Error("value must be typeof string but got "+typeof i);var L=typeof g=="string"?"cm-theme-"+g:"cm-theme";return o.jsx("div",R6({ref:F,className:""+L+(n?" "+n:"")},j))});tve.displayName="CodeMirror";function nve(e){const t=e.toLowerCase(),n=t.split("/").pop()??t,r=n.includes(".")?n.split(".").pop():"";return n==="dockerfile"||n.startsWith("dockerfile.")||n.endsWith(".dockerfile")?[AQ.define(nwt)]:r==="py"||r==="pyi"?[fvt()]:["ts","tsx","mts","cts"].includes(r??"")?[O6({typescript:!0,jsx:r==="tsx"})]:["js","jsx","mjs","cjs"].includes(r??"")?[O6({jsx:r==="jsx"})]:r==="json"||r==="jsonc"?[Ryt()]:r==="yaml"||r==="yml"?[Fvt()]:["md","markdown"].includes(r??"")?[qOt()]:[]}function mR({value:e,path:t,onChange:n,readOnly:r=!1,theme:i="light"}){const s=p.useMemo(()=>nve(t),[t]);return o.jsx(tve,{value:e,height:"100%",theme:i,extensions:s,editable:!r,onChange:n,basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0,highlightActiveLineGutter:!0,autocompletion:!1}})}const rve=Object.freeze(Object.defineProperty({__proto__:null,default:mR,languageFor:nve},Symbol.toStringTag,{value:"Module"}));function CEt(e){var s;const t=e.split(/\r?\n/);if(((s=t[0])==null?void 0:s.trim())!=="---")return{body:e,frontmatter:[]};const n=t.findIndex((a,l)=>l>0&&a.trim()==="---");if(n<0)return{body:e,frontmatter:[]};const r=Obe(t.slice(1,n).join(` `));if(r.errors.length>0)return{body:e,frontmatter:[]};const i=r.toJS();return!i||typeof i!="object"||Array.isArray(i)?{body:e,frontmatter:[]}:{body:t.slice(n+1).join(` -`).replace(/^\s*\n/,""),frontmatter:Object.entries(i).map(([a,l])=>({key:a,value:typeof l=="string"?l:nQ(l).trim()}))}}function NEt(){return o.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"M2.75 5.5h5l1.5 1.75h8v7.25a1.75 1.75 0 0 1-1.75 1.75h-11a1.75 1.75 0 0 1-1.75-1.75v-9Z"})})}function jEt(){return o.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[o.jsx("path",{d:"M5 2.75h6l4 4v10.5H5z"}),o.jsx("path",{d:"M11 2.75v4h4"})]})}function REt(e){const t={children:[]};for(const r of e){let i=t;const s=r.path.split("/").filter(Boolean);s.forEach((a,l)=>{let c=i.children.find(u=>u.name===a);if(!c){const u=s.slice(0,l+1).join("/");c={name:a,path:u,children:[]},i.children.push(c)}l===s.length-1&&(c.file=r),i=c})}const n=r=>{r.sort((i,s)=>+!!i.file-+!!s.file||i.name.localeCompare(s.name)),r.forEach(i=>n(i.children))};return n(t.children),t.children}function ive({nodes:e,depth:t,activePath:n,onSelect:r}){return e.map(i=>o.jsxs("div",{children:[i.file?o.jsxs("button",{type:"button",className:`skill-file-tree__row${i.path===n?" is-active":""}`,style:{paddingLeft:`${12+t*16}px`},onClick:()=>r(i.file),title:i.path,children:[o.jsx(jEt,{}),o.jsx("span",{children:i.name}),o.jsxs("small",{children:[i.file.size.toLocaleString()," B"]})]}):o.jsxs("div",{className:"skill-file-tree__row is-folder",style:{paddingLeft:`${12+t*16}px`},title:i.path,children:[o.jsx(NEt,{}),o.jsx("span",{children:i.name})]}),i.children.length>0?o.jsx(ive,{nodes:i.children,depth:t+1,activePath:n,onSelect:r}):null]},i.path))}function IEt(e){if(e.content===void 0)return;if(e.content.startsWith("data:")){const r=document.createElement("a");r.href=e.content,r.download=e.path.split("/").pop()||"skill-file",r.click();return}const t=URL.createObjectURL(new Blob([e.content])),n=document.createElement("a");n.href=t,n.download=e.path.split("/").pop()||"skill-file",n.click(),URL.revokeObjectURL(t)}function sve({files:e}){var f;const t=p.useMemo(()=>REt(e),[e]),[n,r]=p.useState(((f=e[0])==null?void 0:f.path)||""),[i,s]=p.useState("preview"),a=e.find(h=>h.path===n)||e[0],l=(a==null?void 0:a.path.toLowerCase())||"",c=l.endsWith(".md")||l.endsWith(".markdown"),u=/\.(png|jpe?g|gif|webp|svg)$/.test(l),d=p.useMemo(()=>AEt(c&&(a==null?void 0:a.content)!==void 0?a.content:""),[a==null?void 0:a.content,c]);return o.jsxs("div",{className:"skill-file-browser",children:[o.jsx("aside",{className:"skill-file-tree","aria-label":"Skill 文件树",children:o.jsx(ive,{nodes:t,depth:0,activePath:(a==null?void 0:a.path)||"",onSelect:h=>r(h.path)})}),o.jsx("section",{className:"skill-file-preview",children:a?o.jsxs(o.Fragment,{children:[o.jsxs("header",{children:[o.jsx("span",{title:a.path,children:a.path}),o.jsxs("div",{children:[c?o.jsx("button",{type:"button",onClick:()=>s(h=>h==="preview"?"source":"preview"),children:i==="preview"?"查看源码":"查看预览"}):null,o.jsx("button",{type:"button",disabled:a.content===void 0,onClick:()=>IEt(a),children:"下载"})]})]}),o.jsx("div",{className:"skill-file-preview__body",children:a.kind==="binary"||a.content===void 0?o.jsxs("div",{className:"skill-file-preview__binary",children:[o.jsx("strong",{children:"二进制文件"}),o.jsxs("span",{children:[a.size.toLocaleString()," 字节"]}),o.jsx("span",{children:"当前接口仅返回文件元数据,可单独下载原文件。"})]}):u?o.jsx("img",{src:a.content.startsWith("data:")?a.content:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(a.content)}`,alt:a.path}):c&&i==="preview"?o.jsxs("div",{className:"skill-file-preview__markdown",children:[d.frontmatter.length>0?o.jsx("dl",{className:"skill-file-preview__frontmatter","aria-label":"Skill 元数据",children:d.frontmatter.map(h=>o.jsxs("div",{children:[o.jsx("dt",{children:h.key}),o.jsx("dd",{children:h.value})]},h.key))}):null,o.jsx(xu,{text:d.body,allowRawHtml:!1,className:"skill-file-preview__markdown-body"})]}):o.jsx(mR,{value:a.content,path:a.path,readOnly:!0,onChange:()=>{}})})]}):o.jsx("div",{className:"skill-file-preview__binary",children:"暂无文件"})})]})}const DEt=1200,PEt=3,ave=2,MEt=/SKILL\.md|frontmatter|Skill name|description|根目录|目录名|UTF-8|文本文件|文件数|符号链接|敏感凭证/i,ove={concise:"简洁实用",strict:"严谨稳健",tutorial:"教程友好",automation:"自动化优先"},LEt=[...Object.entries(ove).map(([e,t])=>({value:e,label:t})),{value:"custom",label:"自定义"}];function nJ(e,t){var n;return{id:`group-${Date.now()}-${e}`,model:((n=t.models[e%Math.max(1,t.models.length)])==null?void 0:n.id)||"",style:"concise",customStyle:""}}function $Et(e){return e?e.state==="ready"?"Skill 已生成并通过格式校验":e.state==="failed"?"生成失败":e.state==="cancelled"?"已停止":e.stage==="validating"?"正在校验 Skill 格式":e.stage==="packaging"?"正在整理文件":"正在生成 Skill":"正在准备 Dev Sandbox"}function NP(e){var t;return e.state==="failed"&&((t=e.validation)==null?void 0:t.valid)===!1&&e.validation.errors.some(n=>MEt.test(n))}function rJ(e){var n;return["只修复下面列出的 Skill 格式错误,不要改变原有用途和内容范围。","修复后重新检查目录结构、SKILL.md frontmatter 和所有文本文件。",(((n=e.validation)==null?void 0:n.errors.join(` +`).replace(/^\s*\n/,""),frontmatter:Object.entries(i).map(([a,l])=>({key:a,value:typeof l=="string"?l:nQ(l).trim()}))}}function AEt(){return o.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"M2.75 5.5h5l1.5 1.75h8v7.25a1.75 1.75 0 0 1-1.75 1.75h-11a1.75 1.75 0 0 1-1.75-1.75v-9Z"})})}function NEt(){return o.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:[o.jsx("path",{d:"M5 2.75h6l4 4v10.5H5z"}),o.jsx("path",{d:"M11 2.75v4h4"})]})}function jEt(e){const t={children:[]};for(const r of e){let i=t;const s=r.path.split("/").filter(Boolean);s.forEach((a,l)=>{let c=i.children.find(u=>u.name===a);if(!c){const u=s.slice(0,l+1).join("/");c={name:a,path:u,children:[]},i.children.push(c)}l===s.length-1&&(c.file=r),i=c})}const n=r=>{r.sort((i,s)=>+!!i.file-+!!s.file||i.name.localeCompare(s.name)),r.forEach(i=>n(i.children))};return n(t.children),t.children}function ive({nodes:e,depth:t,activePath:n,onSelect:r}){return e.map(i=>o.jsxs("div",{children:[i.file?o.jsxs("button",{type:"button",className:`skill-file-tree__row${i.path===n?" is-active":""}`,style:{paddingLeft:`${12+t*16}px`},onClick:()=>r(i.file),title:i.path,children:[o.jsx(NEt,{}),o.jsx("span",{children:i.name}),o.jsxs("small",{children:[i.file.size.toLocaleString()," B"]})]}):o.jsxs("div",{className:"skill-file-tree__row is-folder",style:{paddingLeft:`${12+t*16}px`},title:i.path,children:[o.jsx(AEt,{}),o.jsx("span",{children:i.name})]}),i.children.length>0?o.jsx(ive,{nodes:i.children,depth:t+1,activePath:n,onSelect:r}):null]},i.path))}function REt(e){if(e.content===void 0)return;if(e.content.startsWith("data:")){const r=document.createElement("a");r.href=e.content,r.download=e.path.split("/").pop()||"skill-file",r.click();return}const t=URL.createObjectURL(new Blob([e.content])),n=document.createElement("a");n.href=t,n.download=e.path.split("/").pop()||"skill-file",n.click(),URL.revokeObjectURL(t)}function sve({files:e}){var f;const t=p.useMemo(()=>jEt(e),[e]),[n,r]=p.useState(((f=e[0])==null?void 0:f.path)||""),[i,s]=p.useState("preview"),a=e.find(h=>h.path===n)||e[0],l=(a==null?void 0:a.path.toLowerCase())||"",c=l.endsWith(".md")||l.endsWith(".markdown"),u=/\.(png|jpe?g|gif|webp|svg)$/.test(l),d=p.useMemo(()=>CEt(c&&(a==null?void 0:a.content)!==void 0?a.content:""),[a==null?void 0:a.content,c]);return o.jsxs("div",{className:"skill-file-browser",children:[o.jsx("aside",{className:"skill-file-tree","aria-label":"Skill 文件树",children:o.jsx(ive,{nodes:t,depth:0,activePath:(a==null?void 0:a.path)||"",onSelect:h=>r(h.path)})}),o.jsx("section",{className:"skill-file-preview",children:a?o.jsxs(o.Fragment,{children:[o.jsxs("header",{children:[o.jsx("span",{title:a.path,children:a.path}),o.jsxs("div",{children:[c?o.jsx("button",{type:"button",onClick:()=>s(h=>h==="preview"?"source":"preview"),children:i==="preview"?"查看源码":"查看预览"}):null,o.jsx("button",{type:"button",disabled:a.content===void 0,onClick:()=>REt(a),children:"下载"})]})]}),o.jsx("div",{className:"skill-file-preview__body",children:a.kind==="binary"||a.content===void 0?o.jsxs("div",{className:"skill-file-preview__binary",children:[o.jsx("strong",{children:"二进制文件"}),o.jsxs("span",{children:[a.size.toLocaleString()," 字节"]}),o.jsx("span",{children:"当前接口仅返回文件元数据,可单独下载原文件。"})]}):u?o.jsx("img",{src:a.content.startsWith("data:")?a.content:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(a.content)}`,alt:a.path}):c&&i==="preview"?o.jsxs("div",{className:"skill-file-preview__markdown",children:[d.frontmatter.length>0?o.jsx("dl",{className:"skill-file-preview__frontmatter","aria-label":"Skill 元数据",children:d.frontmatter.map(h=>o.jsxs("div",{children:[o.jsx("dt",{children:h.key}),o.jsx("dd",{children:h.value})]},h.key))}):null,o.jsx(wu,{text:d.body,allowRawHtml:!1,className:"skill-file-preview__markdown-body"})]}):o.jsx(mR,{value:a.content,path:a.path,readOnly:!0,onChange:()=>{}})})]}):o.jsx("div",{className:"skill-file-preview__binary",children:"暂无文件"})})]})}const IEt=1200,DEt=3,ave=2,PEt=/SKILL\.md|frontmatter|Skill name|description|根目录|目录名|UTF-8|文本文件|文件数|符号链接|敏感凭证/i,ove={concise:"简洁实用",strict:"严谨稳健",tutorial:"教程友好",automation:"自动化优先"},MEt=[...Object.entries(ove).map(([e,t])=>({value:e,label:t})),{value:"custom",label:"自定义"}];function nJ(e,t){var n;return{id:`group-${Date.now()}-${e}`,model:((n=t.models[e%Math.max(1,t.models.length)])==null?void 0:n.id)||"",style:"concise",customStyle:""}}function LEt(e){return e?e.state==="ready"?"Skill 已生成并通过格式校验":e.state==="failed"?"生成失败":e.state==="cancelled"?"已停止":e.stage==="validating"?"正在校验 Skill 格式":e.stage==="packaging"?"正在整理文件":"正在生成 Skill":"正在准备 Dev Sandbox"}function NP(e){var t;return e.state==="failed"&&((t=e.validation)==null?void 0:t.valid)===!1&&e.validation.errors.some(n=>PEt.test(n))}function rJ(e){var n;return["只修复下面列出的 Skill 格式错误,不要改变原有用途和内容范围。","修复后重新检查目录结构、SKILL.md frontmatter 和所有文本文件。",(((n=e.validation)==null?void 0:n.errors.join(` `))||e.error||"Skill 格式校验未通过").slice(0,2e3)].join(` -`)}function BEt(e){var t;return e.repairing||((t=e.task)==null?void 0:t.state)==="running"&&e.repairMode?e.repairMode==="manual"?"正在再次修复":`正在自动修复(${Math.max(1,e.repairAttempts||1)}/${ave})`:$Et(e.task)}function iJ(){return o.jsxs("svg",{className:"skill-generation__spinner",viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("circle",{cx:"10",cy:"10",r:"7"}),o.jsx("path",{d:"M10 3a7 7 0 0 1 7 7"})]})}function QEt(e,t=Date.now()){if(!(e!=null&&e.expiresAt))return"Session 最长保留 1 小时";const n=Math.max(0,new Date(e.expiresAt).getTime()-t),r=Math.floor(n/6e4),i=Math.floor(n%6e4/1e3);return`剩余 ${r}:${String(i).padStart(2,"0")}`}function UEt(e){return e?e.length>64?"Skill 名称不能超过 64 个字符":/^[a-z0-9-]+$/.test(e)?"":"Skill 名称只能包含小写字母、数字和连字符":""}function sJ(e){return e?e.length>128?"模型 ID 不能超过 128 个字符":/^[A-Za-z0-9][A-Za-z0-9._:/-]*$/.test(e)?"":"模型 ID 只能包含字母、数字、点、下划线、连字符、斜杠和冒号":""}function jP(e){return`${e.region||""}:${e.id}`}function FEt(){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m14.5 6-6 6 6 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})})}function zEt({operation:e,cloudProvider:t,space:n,availableSpaces:r=[],spacesLoading:i=!1,initialIntent:s="",source:a,onBack:l,onPublished:c}){var re,ue,Pe,Ge;const[u,d]=p.useState(null),[f,h]=p.useState(null),[m,g]=p.useState(s),[b,y]=p.useState(""),[O,v]=p.useState([]),[x,w]=p.useState([]),[S,E]=p.useState(""),[k,_]=p.useState(!1),[C,T]=p.useState(""),[A,j]=p.useState(""),[L,I]=p.useState(null),[M,N]=p.useState(""),[D,Q]=p.useState(""),[F,$]=p.useState(n?jP(n):""),[H,z]=p.useState(Date.now()),B=p.useRef([]);p.useEffect(()=>{const W=new AbortController;return Mj(W.signal).then(_e=>{d(_e),v([nJ(0,_e)])}).catch(_e=>{W.signal.aborted||h(ua(_e,"读取 Dev Sandbox 配置失败"))}),()=>W.abort()},[]),p.useEffect(()=>{B.current=x},[x]),p.useEffect(()=>{const W=window.setInterval(()=>z(Date.now()),1e3);return()=>window.clearInterval(W)},[]),p.useEffect(()=>{const W=_e=>{B.current.some(rt=>{var Ve;return((Ve=rt.task)==null?void 0:Ve.state)==="running"||rt.repairing})&&_e.preventDefault()};return window.addEventListener("beforeunload",W),()=>{var _e;window.removeEventListener("beforeunload",W);for(const rt of B.current)(_e=rt.task)!=null&&_e.jobId&&vct(rt.task.jobId).catch(()=>{})}},[]),p.useEffect(()=>{if(!x.some(Ve=>{var We;return((We=Ve.task)==null?void 0:We.state)==="running"||Ve.repairing}))return;let W=!1,_e;const rt=async()=>{const Ve=B.current,We=await Promise.all(Ve.map(async ot=>{var St;if(((St=ot.task)==null?void 0:St.state)!=="running")return ot;try{const Vt=await yct(ot.task.jobId);if(NP(Vt)&&(ot.repairAttempts||0)$e.map(mt=>mt.id===ot.id?{...mt,task:Vt,repairing:!0,repairMode:"auto",repairAttempts:Ne,repairError:void 0}:mt));try{const $e=await vD({jobId:Vt.jobId,intent:rJ(Vt),expectedRevision:Vt.revision});return{...ot,task:$e,artifact:void 0,repairing:!1,repairMode:"auto",repairAttempts:Ne,repairError:void 0,error:void 0,pollError:void 0}}catch($e){return{...ot,task:Vt,repairing:!1,repairMode:void 0,repairAttempts:Ne,repairError:ua($e,"自动修复格式错误失败"),pollError:void 0}}}let _t=ot.artifact;return Vt.state==="ready"&&(_t=await xD(Vt.jobId,Vt.revision)),{...ot,task:Vt,artifact:_t,repairing:!1,repairMode:Vt.state==="running"?ot.repairMode:void 0,repairError:void 0,error:void 0,pollError:void 0}}catch(Vt){return{...ot,pollError:ua(Vt,"读取候选方案状态失败,正在重试")}}}));W||(w(We),_e=window.setTimeout(()=>void rt(),DEt))};return rt(),()=>{W=!0,_e!==void 0&&window.clearTimeout(_e)}},[x.some(W=>{var _e;return((_e=W.task)==null?void 0:_e.state)==="running"||W.repairing})]);const V=x.find(W=>W.id===S)||x[0],Z=e==="create"&&!n,ce=r.find(W=>jP(W)===F)??null,be=n??ce,ie=r.map(W=>({value:jP(W),label:`${W.name.trim()||"未命名 Skill Space"} · ${Zf(W.region||"cn-beijing",t)}`})),q=UEt(b),X=!!(u!=null&&u.enabled&&m.trim()&&!q&&O.length>0&&O.every(W=>W.model.trim()&&!sJ(W.model.trim()))),K=(W,_e)=>{v(rt=>rt.map(Ve=>Ve.id===W?{...Ve,..._e}:Ve))},de=async W=>{const _e={...W,model:W.model.trim()},rt=W.style==="custom"?W.customStyle.trim():W.style;try{const Ve=await bct({operation:e,intent:m.trim(),model:_e.model,style:rt,name:b.trim()||void 0,source:a});return{id:W.id,config:_e,task:Ve}}catch(Ve){return{id:W.id,config:_e,error:ua(Ve,"创建候选方案失败")}}},xe=async()=>{if(!X)return;_(!0),I(null);const W=O.map(rt=>({id:rt.id,config:rt}));w(W),E(O[0].id);const _e=await Promise.all(O.map(de));w(_e)},Me=async W=>{w(rt=>rt.map(Ve=>Ve.id===W.id?{...Ve,error:void 0}:Ve));const _e=await de(W.config);w(rt=>rt.map(Ve=>Ve.id===W.id?_e:Ve))},Ae=async()=>{if(!(!(V!=null&&V.task)||!C.trim()||V.task.state!=="ready")){j("refine"),I(null);try{const W=await vD({jobId:V.task.jobId,intent:C.trim(),expectedRevision:V.task.revision});w(_e=>_e.map(rt=>rt.id===V.id?{...rt,task:W,artifact:void 0}:rt)),T("")}catch(W){I(ua(W,"继续调整失败"))}finally{j("")}}},He=async()=>{if(!(!(V!=null&&V.task)||!NP(V.task))){j("refine"),I(null),w(W=>W.map(_e=>_e.id===V.id?{..._e,repairing:!0,repairMode:"manual",repairError:void 0}:_e));try{const W=await vD({jobId:V.task.jobId,intent:rJ(V.task),expectedRevision:V.task.revision});w(_e=>_e.map(rt=>rt.id===V.id?{...rt,task:W,artifact:void 0,repairing:!1,repairMode:"manual",repairError:void 0}:rt))}catch(W){w(_e=>_e.map(rt=>rt.id===V.id?{...rt,repairing:!1,repairMode:void 0,repairError:ua(W,"再次修复格式错误失败")}:rt))}finally{j("")}}},et=async()=>{if(!(!(V!=null&&V.task)||V.task.state!=="ready"||D)){j("publish"),I(null);try{if(!be)throw new Error("请选择上传的 Skill Space");const W=V.artifact||await xD(V.task.jobId,V.task.revision),_e=(a==null?void 0:a.region)||be.region||"";if(!HS(_e))throw new Error("当前 Skill 地域不受支持");await xct({jobId:V.task.jobId,expectedRevision:V.task.revision,expectedArtifactSha256:W.sha256,disposition:e==="optimize"?"update-source":"create-new",skillSpaceIds:[be.id],projectName:(a==null?void 0:a.projectName)||be.projectName,region:_e,onProgress:rt=>N(rt.message)}),Q(V.id),c()}catch(W){I(ua(W,"上传 Skill 失败"))}finally{j(""),N("")}}},Te=async()=>{if(!(!(V!=null&&V.task)||V.task.state!=="ready")){j("download");try{const W=V.artifact||await xD(V.task.jobId,V.task.revision);await wct(V.task.jobId,V.task.revision,W.sha256)}catch(W){I(ua(W,"下载失败"))}finally{j("")}}},Re=async()=>{x.some(W=>{var _e;return((_e=W.task)==null?void 0:_e.state)==="running"})&&!window.confirm("离开后将停止并释放正在运行的 Dev Sandbox,确定离开吗?")||(await Promise.allSettled(x.flatMap(W=>{var _e;return((_e=W.task)==null?void 0:_e.state)==="running"?[Oct({jobId:W.task.jobId,expectedRevision:W.task.revision})]:[]})),l())},he=e==="create"?"创建技能":`优化 ${(a==null?void 0:a.name)||"技能"}`,me=W=>{var _e;return((_e=u==null?void 0:u.models.find(rt=>rt.id===W))==null?void 0:_e.label)||W},Se=W=>W.config.style==="custom"?W.config.customStyle.trim()||"自定义风格":ove[W.config.style],ke=W=>W.error||W.repairError?"失败":BEt(W),nt=W=>!W.error&&!W.repairError&&(W.repairing||!W.task||W.task.state==="running"),Qe=x.some(W=>{var _e;return((_e=W.task)==null?void 0:_e.state)==="ready"});return o.jsxs("section",{className:"skill-generation",children:[o.jsxs("header",{className:"skill-generation__header",children:[o.jsx("button",{type:"button",className:"skillcenter-back",onClick:()=>void Re(),"aria-label":"返回技能空间",children:o.jsx(FEt,{})}),o.jsxs("div",{children:[o.jsx("h1",{children:he}),o.jsx("p",{children:(n==null?void 0:n.name)||"主页技能生成"})]}),x.length>0?o.jsx("span",{className:"skill-generation__ttl",children:QEt(V==null?void 0:V.task,H)}):null]}),k?o.jsxs("div",{className:"skill-generation__workspace",children:[o.jsx("div",{className:"skill-generation__candidate-tabs",role:"tablist","aria-label":"候选方案",children:x.map(W=>o.jsxs("button",{type:"button",role:"tab","aria-selected":(V==null?void 0:V.id)===W.id,className:(V==null?void 0:V.id)===W.id?"is-active":"",onClick:()=>E(W.id),children:[o.jsxs("span",{className:"skill-generation__summary-row",children:[o.jsx("span",{children:"风格"}),o.jsx("strong",{children:Se(W)})]}),o.jsxs("span",{className:"skill-generation__summary-row",children:[o.jsx("span",{children:"模型"}),o.jsx("strong",{children:me(W.config.model)})]}),o.jsxs("span",{className:"skill-generation__summary-row",children:[o.jsx("span",{children:"进度"}),o.jsxs("strong",{children:[nt(W)?o.jsx(iJ,{}):null,ke(W)]})]})]},W.id))}),V?o.jsxs("div",{className:"skill-generation__candidate",children:[o.jsxs("section",{className:"skill-generation__activity",children:[o.jsx("header",{children:o.jsxs("div",{className:"skill-generation__candidate-summary",children:[o.jsxs("div",{className:"skill-generation__summary-row",children:[o.jsx("span",{children:"风格"}),o.jsx("strong",{children:Se(V)})]}),o.jsxs("div",{className:"skill-generation__summary-row",children:[o.jsx("span",{children:"模型"}),o.jsx("strong",{children:me(V.config.model)})]}),o.jsxs("div",{className:"skill-generation__summary-row","aria-live":"polite",children:[o.jsx("span",{children:"进度"}),o.jsxs("strong",{children:[nt(V)?o.jsx(iJ,{}):null,nt(V)?o.jsx(En,{children:ke(V)}):ke(V)]})]})]})}),V.task?o.jsx(lft,{activities:V.task.activities}):null,V.pollError?o.jsx("div",{className:"skill-inline-notice",children:o.jsx(zo,{error:V.pollError})}):null,V.repairError?o.jsx("div",{className:"skill-inline-notice",children:o.jsx(zo,{error:V.repairError})}):null,V.error?o.jsxs("div",{className:"skill-inline-error",children:[o.jsx(zo,{error:V.error}),o.jsx("button",{type:"button",onClick:()=>void Me(V),children:"重试此方案"})]}):null,(re=V.task)!=null&&re.validation&&!V.task.validation.valid&&!V.repairing&&V.task.state==="failed"?o.jsxs("div",{className:"skill-validation-errors",children:[o.jsx("strong",{children:"格式校验未通过"}),V.task.validation.errors.map(W=>o.jsx("p",{children:W},W)),NP(V.task)?o.jsx("button",{type:"button",disabled:!!A,onClick:()=>void He(),children:"再次修复"}):null]}):null]}),o.jsxs("section",{className:"skill-generation__files",children:[o.jsxs("header",{children:[o.jsx("h2",{children:"文件"}),((ue=V.task)==null?void 0:ue.state)==="ready"?o.jsx("button",{type:"button",onClick:()=>void Te(),disabled:!!A,children:"下载 ZIP"}):null]}),V.artifact?o.jsx(sve,{files:V.artifact.files}):o.jsx("div",{className:"skill-generation__files-empty",children:((Pe=V.task)==null?void 0:Pe.state)==="ready"?"正在读取文件…":"生成过程中会在这里显示完整文件树"})]}),((Ge=V.task)==null?void 0:Ge.state)==="ready"?o.jsxs("div",{className:"skill-generation__ready-actions",children:[Z?o.jsx("div",{className:"skill-generation__publish-target",children:o.jsx(cT,{label:"上传到 Skill Space",value:F,options:ie,onChange:$,disabled:i,placeholder:i?"正在加载 Skill Space":"选择 Skill Space"})}):null,o.jsxs("footer",{className:"skill-generation__followup",children:[o.jsx("textarea",{value:C,onChange:W=>T(W.target.value),placeholder:"继续调整这个候选方案"}),o.jsx("button",{type:"button",className:"skill-button",disabled:!C.trim()||!!A,onClick:()=>void Ae(),children:"继续调整"}),o.jsx("button",{type:"button",className:"skill-button skill-button--primary",disabled:!!A||!!D||!be,onClick:()=>void et(),children:A==="publish"?M||"上传中…":e==="optimize"?"覆盖原 Skill":Z?"上传到 Skill Space":"上传到当前空间"})]})]}):null,L?o.jsx("div",{className:"skill-inline-error skill-generation__action-error",children:o.jsx(zo,{error:L})}):null]}):null,!Qe&&x.every(W=>W.error)?o.jsx("div",{className:"skill-inline-error",children:"所有方案均创建失败,可分别重试。"}):null]}):o.jsxs("div",{className:"skill-generation__setup",children:[o.jsx("div",{className:"skill-generation__section-head is-basic",children:o.jsx("div",{children:o.jsx("strong",{children:"基本信息"})})}),o.jsxs("label",{children:[o.jsxs("span",{children:["目标",o.jsx("span",{className:"skill-required-mark","aria-hidden":"true",children:"*"})]}),o.jsx("textarea",{required:!0,value:m,onChange:W=>g(W.target.value),placeholder:e==="create"?"描述希望这个 Skill 完成什么任务":"描述希望如何优化当前 Skill"})]}),o.jsxs("label",{children:[o.jsx("span",{children:"Skill 名称"}),o.jsx("input",{value:b,onChange:W=>y(W.target.value),placeholder:"留空时自动生成","aria-invalid":!!q,"aria-describedby":"skill-name-help"}),q?o.jsx("span",{id:"skill-name-help",className:"skill-generation__field-error",role:"alert",children:q}):o.jsx("span",{id:"skill-name-help",className:"skill-generation__field-help",children:"仅支持小写字母、数字和连字符;留空时自动生成。"})]}),o.jsx("div",{className:"skill-generation__section-head",children:o.jsxs("div",{children:[o.jsx("strong",{children:e==="create"?"生成方案":"优化方案"}),o.jsx("span",{children:e==="create"?"按不同方案并行生成多个技能,您可以选择最佳结果":"按不同方案并行优化当前技能,您可以选择最佳结果"})]})}),o.jsxs("div",{className:"skill-generation__groups",children:[O.map((W,_e)=>o.jsxs("article",{className:"skill-generation__group",children:[o.jsxs("header",{children:[o.jsxs("strong",{children:["方案 ",_e+1]}),O.length>1?o.jsx("button",{type:"button",onClick:()=>v(rt=>rt.filter(Ve=>Ve.id!==W.id)),children:"移除"}):null]}),o.jsx(cT,{label:"模型",required:!0,value:W.model,options:(u==null?void 0:u.models.map(rt=>({value:rt.id,label:rt.label})))||[],onChange:rt=>K(W.id,{model:rt}),allowCustom:!0,placeholder:"选择或输入模型 ID",error:sJ(W.model.trim())}),o.jsx(cT,{label:"风格",required:!0,value:W.style,options:LEt,onChange:rt=>K(W.id,{style:rt})}),W.style==="custom"?o.jsxs("label",{children:[o.jsx("span",{children:"自定义风格"}),o.jsx("textarea",{value:W.customStyle,onChange:rt=>K(W.id,{customStyle:rt.target.value}),placeholder:"描述表达方式、严谨程度或输出偏好"})]}):null]},W.id)),u&&O.lengthv(W=>[...W,nJ(W.length,u)]),children:"添加配置"}):null]}),f?o.jsx("div",{className:"skill-inline-error",children:o.jsx(zo,{error:f})}):null,u&&!u.enabled?o.jsx("div",{className:"skill-inline-notice",children:"管理员未配置"}):null,o.jsx("div",{className:"skill-generation__setup-actions",children:o.jsx("button",{type:"button",className:"skill-button skill-button--primary",disabled:!X,onClick:()=>void xe(),children:"生成"})})]})]})}function dU({title:e,children:t,onClose:n,className:r=""}){const i=p.useRef(null);return p.useEffect(()=>{var a;(a=i.current)==null||a.focus();const s=l=>l.key==="Escape"&&n();return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[n]),o.jsx("div",{className:"skill-dialog-backdrop",onMouseDown:n,children:o.jsxs("section",{className:`skill-dialog${r?` ${r}`:""}`,role:"dialog","aria-modal":"true","aria-label":e,onMouseDown:s=>s.stopPropagation(),children:[o.jsxs("header",{children:[o.jsx("h2",{children:e}),o.jsx("button",{ref:i,type:"button",onClick:n,"aria-label":"关闭",children:"关闭"})]}),t]})})}function VEt({region:e,regionOptions:t,onClose:n,onCreated:r}){const[i,s]=p.useState(""),[a,l]=p.useState(""),[c,u]=p.useState(e),[d,f]=p.useState(!1),[h,m]=p.useState(null),g=async()=>{if(i.trim()){f(!0),m(null);try{const b=await tct({name:i.trim(),description:a.trim()||void 0,region:c});r({...b,region:b.region||c})}catch(b){m(ua(b,"创建 Skill 空间失败"))}finally{f(!1)}}};return o.jsxs(dU,{title:"新建 Skill 空间",onClose:n,children:[o.jsxs("div",{className:"skill-dialog__body",children:[o.jsxs("label",{children:[o.jsx("span",{children:"名称"}),o.jsx("input",{autoFocus:!0,value:i,maxLength:128,onChange:b=>s(b.target.value)})]}),o.jsx(cT,{label:"地域",value:c,options:t,onChange:u,required:!0}),o.jsxs("label",{children:[o.jsx("span",{children:"描述(可选)"}),o.jsx("textarea",{value:a,maxLength:1024,onChange:b=>l(b.target.value)})]}),h?o.jsx("div",{className:"skill-inline-error",children:o.jsx(zo,{error:h})}):null]}),o.jsxs("footer",{children:[o.jsx("button",{type:"button",className:"skill-button",onClick:n,children:"取消"}),o.jsx("button",{type:"button",className:"skill-button skill-button--primary",disabled:!i.trim()||d,onClick:()=>void g(),children:d?"创建中…":"创建"})]})]})}function HEt({space:e,region:t,onClose:n,onUpdated:r}){const[i,s]=p.useState(e.name),[a,l]=p.useState(e.description||""),[c,u]=p.useState(!1),[d,f]=p.useState(null),h=async()=>{if(i.trim()){u(!0),f(null);try{const m=await nct({spaceId:e.id,name:i.trim(),description:a.trim()||void 0,region:t});r({...e,...m,skillCount:e.skillCount})}catch(m){f(ua(m,"更新 Skill 空间失败"))}finally{u(!1)}}};return o.jsxs(dU,{title:"编辑 Skill 空间",onClose:n,children:[o.jsxs("div",{className:"skill-dialog__body",children:[o.jsxs("label",{children:[o.jsx("span",{children:"名称"}),o.jsx("input",{autoFocus:!0,value:i,maxLength:128,onChange:m=>s(m.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"描述(可选)"}),o.jsx("textarea",{value:a,maxLength:1024,onChange:m=>l(m.target.value)})]}),d?o.jsx("div",{className:"skill-inline-error",children:o.jsx(zo,{error:d})}):null]}),o.jsxs("footer",{children:[o.jsx("button",{type:"button",className:"skill-button",onClick:n,children:"取消"}),o.jsx("button",{type:"button",className:"skill-button skill-button--primary",disabled:!i.trim()||c,onClick:()=>void h(),children:c?"保存中…":"保存"})]})]})}function qEt({space:e,region:t,onClose:n,onUploaded:r}){const[i,s]=p.useState(null),[a,l]=p.useState(null),[c,u]=p.useState(!1),[d,f]=p.useState(!1),[h,m]=p.useState(null),[g,b]=p.useState(!1),y=p.useRef(0),O=p.useRef(null),v=async w=>{const S=y.current+1;if(y.current=S,s(w),l(null),m(null),u(!!w),!!w)try{const E=await sct(w);y.current===S&&l({name:E.name,fileCount:E.files.length})}catch(E){y.current===S&&m(ua(E,"Skill ZIP 格式校验失败"))}finally{y.current===S&&u(!1)}},x=async()=>{if(!(!i||!a)){f(!0),m(null);try{await ict({spaceId:e.id,region:t,project:e.projectName,file:i}),r()}catch(w){m(ua(w,"上传 Skill 失败"))}finally{f(!1)}}};return o.jsxs(dU,{title:`上传到 ${e.name}`,className:"skill-upload-dialog",onClose:n,children:[o.jsxs("div",{className:"skill-dialog__body",children:[o.jsx("input",{ref:O,className:"skill-upload-dialog__input",type:"file",accept:".zip,application/zip",onChange:w=>{var S;return void v(((S=w.target.files)==null?void 0:S[0])||null)}}),o.jsxs("button",{type:"button",className:`skill-upload-dropzone${g?" is-dragging":""}`,onClick:()=>{var w;return(w=O.current)==null?void 0:w.click()},onDragEnter:w=>{w.preventDefault(),b(!0)},onDragOver:w=>{w.preventDefault(),w.dataTransfer.dropEffect="copy",b(!0)},onDragLeave:w=>{w.currentTarget.contains(w.relatedTarget)||b(!1)},onDrop:w=>{var S;w.preventDefault(),b(!1),v(((S=w.dataTransfer.files)==null?void 0:S[0])||null)},children:[o.jsx("strong",{children:i?i.name:"拖拽 Skill ZIP 到这里"}),o.jsx("span",{children:i?`${i.size.toLocaleString()} 字节`:"或点击选择本地文件"})]}),o.jsx("p",{children:"ZIP 根目录需要包含 SKILL.md,也可以只包含一层包装目录。选择后仅检查格式,不会自动上传。"}),c?o.jsx("div",{className:"skill-inline-notice",children:"正在检查文件格式…"}):null,a?o.jsxs("div",{className:"skill-inline-notice",children:["格式检查通过:",a.name,",共 ",a.fileCount," 个文件"]}):null,h?o.jsx("div",{className:"skill-inline-error",children:o.jsx(zo,{error:h})}):null]}),o.jsxs("footer",{children:[o.jsx("button",{type:"button",className:"skill-button",onClick:n,children:"取消"}),o.jsx("button",{type:"button",className:"skill-button skill-button--primary",disabled:!i||!a||c||d,onClick:()=>void x(),children:d?"上传中…":"上传"})]})]})}function XEt(e){if(typeof e=="number")return e<1e12?e*1e3:e;const t=e.trim(),n=Number(t);return/^\d+(?:\.\d+)?$/.test(t)?n<1e12?n*1e3:n:Date.parse(t)}function lve(e,t=Date.now()){if(e===void 0||e==="")return"—";const n=XEt(e);if(!Number.isFinite(n))return"—";const r=Math.floor(Math.max(0,t-n)/1e3);if(r<60)return`${r} 秒前`;const i=Math.floor(r/60);if(i<60)return`${i} 分钟前`;const s=Math.floor(i/60);if(s<24)return`${s} 小时前`;const a=Math.floor(s/24);if(a<30)return`${a} 天前`;const l=Math.floor(a/30);return l<12?`${l} 个月前`:`${Math.floor(l/12)} 年前`}const GEt=12,aJ=12;function VA({disabled:e,placement:t="top",children:n}){const r=p.useId();return o.jsxs("span",{className:`skillcenter-disabled-action${e?" is-disabled":""} is-${t}`,tabIndex:e?0:void 0,"aria-describedby":e?r:void 0,children:[n,e?o.jsx("span",{id:r,className:"skillcenter-disabled-tooltip",role:"tooltip",children:"管理员未配置 Dev Sandbox"}):null]})}const WEt={active:"可用",available:"可用",creating:"创建中",disabled:"已停用",enabled:"已启用",failed:"异常",inactive:"未启用",pending:"等待中",published:"已发布",ready:"就绪",released:"已发布",running:"运行中",success:"正常",unavailable:"不可用",unreleased:"未发布",updating:"更新中"};function cve(e){return WEt[(e||"").trim().toLowerCase()]||"未知"}function YEt(e){const t=(e||"").toLowerCase();return["active","available","enabled","published","ready","released","success"].includes(t)||t==="running"?"is-positive":["creating","pending","updating"].includes(t)?"is-progress":["failed","unavailable"].includes(t)?"is-danger":"is-muted"}function ZEt(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 oJ(e){if(!e)return 0;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())?0:r.getTime()}function Ol(e){return`${e.region||"default"}:${e.projectName||"default"}:${e.id}`}function KEt(e,t){const n=new Map(e.map(r=>[Ol(r),r]));for(const r of t)n.set(Ol(r),r);return[...n.values()].sort((r,i)=>oJ(i.updatedAt)-oJ(r.updatedAt))}function JEt(e){const t=e.replace(/\r\n/g,` +`)}function $Et(e){var t;return e.repairing||((t=e.task)==null?void 0:t.state)==="running"&&e.repairMode?e.repairMode==="manual"?"正在再次修复":`正在自动修复(${Math.max(1,e.repairAttempts||1)}/${ave})`:LEt(e.task)}function iJ(){return o.jsxs("svg",{className:"skill-generation__spinner",viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("circle",{cx:"10",cy:"10",r:"7"}),o.jsx("path",{d:"M10 3a7 7 0 0 1 7 7"})]})}function BEt(e,t=Date.now()){if(!(e!=null&&e.expiresAt))return"Session 最长保留 1 小时";const n=Math.max(0,new Date(e.expiresAt).getTime()-t),r=Math.floor(n/6e4),i=Math.floor(n%6e4/1e3);return`剩余 ${r}:${String(i).padStart(2,"0")}`}function QEt(e){return e?e.length>64?"Skill 名称不能超过 64 个字符":/^[a-z0-9-]+$/.test(e)?"":"Skill 名称只能包含小写字母、数字和连字符":""}function sJ(e){return e?e.length>128?"模型 ID 不能超过 128 个字符":/^[A-Za-z0-9][A-Za-z0-9._:/-]*$/.test(e)?"":"模型 ID 只能包含字母、数字、点、下划线、连字符、斜杠和冒号":""}function jP(e){return`${e.region||""}:${e.id}`}function UEt(){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m14.5 6-6 6 6 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})})}function FEt({operation:e,cloudProvider:t,space:n,availableSpaces:r=[],spacesLoading:i=!1,initialIntent:s="",source:a,onBack:l,onPublished:c}){var ie,ce,Ie,We;const[u,d]=p.useState(null),[f,h]=p.useState(null),[m,g]=p.useState(s),[b,y]=p.useState(""),[O,v]=p.useState([]),[x,w]=p.useState([]),[S,E]=p.useState(""),[k,_]=p.useState(!1),[T,C]=p.useState(""),[A,j]=p.useState(""),[M,I]=p.useState(null),[$,N]=p.useState(""),[D,Q]=p.useState(""),[F,L]=p.useState(n?jP(n):""),[H,z]=p.useState(Date.now()),B=p.useRef([]);p.useEffect(()=>{const K=new AbortController;return Mj(K.signal).then(_e=>{d(_e),v([nJ(0,_e)])}).catch(_e=>{K.signal.aborted||h(la(_e,"读取 Dev Sandbox 配置失败"))}),()=>K.abort()},[]),p.useEffect(()=>{B.current=x},[x]),p.useEffect(()=>{const K=window.setInterval(()=>z(Date.now()),1e3);return()=>window.clearInterval(K)},[]),p.useEffect(()=>{const K=_e=>{B.current.some(Be=>{var He;return((He=Be.task)==null?void 0:He.state)==="running"||Be.repairing})&&_e.preventDefault()};return window.addEventListener("beforeunload",K),()=>{var _e;window.removeEventListener("beforeunload",K);for(const Be of B.current)(_e=Be.task)!=null&&_e.jobId&&xct(Be.task.jobId).catch(()=>{})}},[]),p.useEffect(()=>{if(!x.some(He=>{var Ye;return((Ye=He.task)==null?void 0:Ye.state)==="running"||He.repairing}))return;let K=!1,_e;const Be=async()=>{const He=B.current,Ye=await Promise.all(He.map(async ot=>{var Tt;if(((Tt=ot.task)==null?void 0:Tt.state)!=="running")return ot;try{const Ft=await bct(ot.task.jobId);if(NP(Ft)&&(ot.repairAttempts||0)Je.map(it=>it.id===ot.id?{...it,task:Ft,repairing:!0,repairMode:"auto",repairAttempts:Ge,repairError:void 0}:it));try{const Je=await vD({jobId:Ft.jobId,intent:rJ(Ft),expectedRevision:Ft.revision});return{...ot,task:Je,artifact:void 0,repairing:!1,repairMode:"auto",repairAttempts:Ge,repairError:void 0,error:void 0,pollError:void 0}}catch(Je){return{...ot,task:Ft,repairing:!1,repairMode:void 0,repairAttempts:Ge,repairError:la(Je,"自动修复格式错误失败"),pollError:void 0}}}let At=ot.artifact;return Ft.state==="ready"&&(At=await xD(Ft.jobId,Ft.revision)),{...ot,task:Ft,artifact:At,repairing:!1,repairMode:Ft.state==="running"?ot.repairMode:void 0,repairError:void 0,error:void 0,pollError:void 0}}catch(Ft){return{...ot,pollError:la(Ft,"读取候选方案状态失败,正在重试")}}}));K||(w(Ye),_e=window.setTimeout(()=>void Be(),IEt))};return Be(),()=>{K=!0,_e!==void 0&&window.clearTimeout(_e)}},[x.some(K=>{var _e;return((_e=K.task)==null?void 0:_e.state)==="running"||K.repairing})]);const V=x.find(K=>K.id===S)||x[0],W=e==="create"&&!n,le=r.find(K=>jP(K)===F)??null,be=n??le,re=r.map(K=>({value:jP(K),label:`${K.name.trim()||"未命名 Skill Space"} · ${Zf(K.region||"cn-beijing",t)}`})),q=QEt(b),G=!!(u!=null&&u.enabled&&m.trim()&&!q&&O.length>0&&O.every(K=>K.model.trim()&&!sJ(K.model.trim()))),J=(K,_e)=>{v(Be=>Be.map(He=>He.id===K?{...He,..._e}:He))},de=async K=>{const _e={...K,model:K.model.trim()},Be=K.style==="custom"?K.customStyle.trim():K.style;try{const He=await gct({operation:e,intent:m.trim(),model:_e.model,style:Be,name:b.trim()||void 0,source:a});return{id:K.id,config:_e,task:He}}catch(He){return{id:K.id,config:_e,error:la(He,"创建候选方案失败")}}},ve=async()=>{if(!G)return;_(!0),I(null);const K=O.map(Be=>({id:Be.id,config:Be}));w(K),E(O[0].id);const _e=await Promise.all(O.map(de));w(_e)},Pe=async K=>{w(Be=>Be.map(He=>He.id===K.id?{...He,error:void 0}:He));const _e=await de(K.config);w(Be=>Be.map(He=>He.id===K.id?_e:He))},Ae=async()=>{if(!(!(V!=null&&V.task)||!T.trim()||V.task.state!=="ready")){j("refine"),I(null);try{const K=await vD({jobId:V.task.jobId,intent:T.trim(),expectedRevision:V.task.revision});w(_e=>_e.map(Be=>Be.id===V.id?{...Be,task:K,artifact:void 0}:Be)),C("")}catch(K){I(la(K,"继续调整失败"))}finally{j("")}}},Ue=async()=>{if(!(!(V!=null&&V.task)||!NP(V.task))){j("refine"),I(null),w(K=>K.map(_e=>_e.id===V.id?{..._e,repairing:!0,repairMode:"manual",repairError:void 0}:_e));try{const K=await vD({jobId:V.task.jobId,intent:rJ(V.task),expectedRevision:V.task.revision});w(_e=>_e.map(Be=>Be.id===V.id?{...Be,task:K,artifact:void 0,repairing:!1,repairMode:"manual",repairError:void 0}:Be))}catch(K){w(_e=>_e.map(Be=>Be.id===V.id?{...Be,repairing:!1,repairMode:void 0,repairError:la(K,"再次修复格式错误失败")}:Be))}finally{j("")}}},Ke=async()=>{if(!(!(V!=null&&V.task)||V.task.state!=="ready"||D)){j("publish"),I(null);try{if(!be)throw new Error("请选择上传的 Skill Space");const K=V.artifact||await xD(V.task.jobId,V.task.revision),_e=(a==null?void 0:a.region)||be.region||"";if(!XS(_e))throw new Error("当前 Skill 地域不受支持");await Oct({jobId:V.task.jobId,expectedRevision:V.task.revision,expectedArtifactSha256:K.sha256,disposition:e==="optimize"?"update-source":"create-new",skillSpaceIds:[be.id],projectName:(a==null?void 0:a.projectName)||be.projectName,region:_e,onProgress:Be=>N(Be.message)}),Q(V.id),c()}catch(K){I(la(K,"上传 Skill 失败"))}finally{j(""),N("")}}},Ce=async()=>{if(!(!(V!=null&&V.task)||V.task.state!=="ready")){j("download");try{const K=V.artifact||await xD(V.task.jobId,V.task.revision);await vct(V.task.jobId,V.task.revision,K.sha256)}catch(K){I(la(K,"下载失败"))}finally{j("")}}},Le=async()=>{x.some(K=>{var _e;return((_e=K.task)==null?void 0:_e.state)==="running"})&&!window.confirm("离开后将停止并释放正在运行的 Dev Sandbox,确定离开吗?")||(await Promise.allSettled(x.flatMap(K=>{var _e;return((_e=K.task)==null?void 0:_e.state)==="running"?[yct({jobId:K.task.jobId,expectedRevision:K.task.revision})]:[]})),l())},pe=e==="create"?"创建技能":`优化 ${(a==null?void 0:a.name)||"技能"}`,me=K=>{var _e;return((_e=u==null?void 0:u.models.find(Be=>Be.id===K))==null?void 0:_e.label)||K},we=K=>K.config.style==="custom"?K.config.customStyle.trim()||"自定义风格":ove[K.config.style],Ee=K=>K.error||K.repairError?"失败":$Et(K),st=K=>!K.error&&!K.repairError&&(K.repairing||!K.task||K.task.state==="running"),$e=x.some(K=>{var _e;return((_e=K.task)==null?void 0:_e.state)==="ready"});return o.jsxs("section",{className:"skill-generation",children:[o.jsxs("header",{className:"skill-generation__header",children:[o.jsx("button",{type:"button",className:"skillcenter-back",onClick:()=>void Le(),"aria-label":"返回技能空间",children:o.jsx(UEt,{})}),o.jsxs("div",{children:[o.jsx("h1",{children:pe}),o.jsx("p",{children:(n==null?void 0:n.name)||"主页技能生成"})]}),x.length>0?o.jsx("span",{className:"skill-generation__ttl",children:BEt(V==null?void 0:V.task,H)}):null]}),k?o.jsxs("div",{className:"skill-generation__workspace",children:[o.jsx("div",{className:"skill-generation__candidate-tabs",role:"tablist","aria-label":"候选方案",children:x.map(K=>o.jsxs("button",{type:"button",role:"tab","aria-selected":(V==null?void 0:V.id)===K.id,className:(V==null?void 0:V.id)===K.id?"is-active":"",onClick:()=>E(K.id),children:[o.jsxs("span",{className:"skill-generation__summary-row",children:[o.jsx("span",{children:"风格"}),o.jsx("strong",{children:we(K)})]}),o.jsxs("span",{className:"skill-generation__summary-row",children:[o.jsx("span",{children:"模型"}),o.jsx("strong",{children:me(K.config.model)})]}),o.jsxs("span",{className:"skill-generation__summary-row",children:[o.jsx("span",{children:"进度"}),o.jsxs("strong",{children:[st(K)?o.jsx(iJ,{}):null,Ee(K)]})]})]},K.id))}),V?o.jsxs("div",{className:"skill-generation__candidate",children:[o.jsxs("section",{className:"skill-generation__activity",children:[o.jsx("header",{children:o.jsxs("div",{className:"skill-generation__candidate-summary",children:[o.jsxs("div",{className:"skill-generation__summary-row",children:[o.jsx("span",{children:"风格"}),o.jsx("strong",{children:we(V)})]}),o.jsxs("div",{className:"skill-generation__summary-row",children:[o.jsx("span",{children:"模型"}),o.jsx("strong",{children:me(V.config.model)})]}),o.jsxs("div",{className:"skill-generation__summary-row","aria-live":"polite",children:[o.jsx("span",{children:"进度"}),o.jsxs("strong",{children:[st(V)?o.jsx(iJ,{}):null,st(V)?o.jsx(En,{children:Ee(V)}):Ee(V)]})]})]})}),V.task?o.jsx(oft,{activities:V.task.activities}):null,V.pollError?o.jsx("div",{className:"skill-inline-notice",children:o.jsx(Fo,{error:V.pollError})}):null,V.repairError?o.jsx("div",{className:"skill-inline-notice",children:o.jsx(Fo,{error:V.repairError})}):null,V.error?o.jsxs("div",{className:"skill-inline-error",children:[o.jsx(Fo,{error:V.error}),o.jsx("button",{type:"button",onClick:()=>void Pe(V),children:"重试此方案"})]}):null,(ie=V.task)!=null&&ie.validation&&!V.task.validation.valid&&!V.repairing&&V.task.state==="failed"?o.jsxs("div",{className:"skill-validation-errors",children:[o.jsx("strong",{children:"格式校验未通过"}),V.task.validation.errors.map(K=>o.jsx("p",{children:K},K)),NP(V.task)?o.jsx("button",{type:"button",disabled:!!A,onClick:()=>void Ue(),children:"再次修复"}):null]}):null]}),o.jsxs("section",{className:"skill-generation__files",children:[o.jsxs("header",{children:[o.jsx("h2",{children:"文件"}),((ce=V.task)==null?void 0:ce.state)==="ready"?o.jsx("button",{type:"button",onClick:()=>void Ce(),disabled:!!A,children:"下载 ZIP"}):null]}),V.artifact?o.jsx(sve,{files:V.artifact.files}):o.jsx("div",{className:"skill-generation__files-empty",children:((Ie=V.task)==null?void 0:Ie.state)==="ready"?"正在读取文件…":"生成过程中会在这里显示完整文件树"})]}),((We=V.task)==null?void 0:We.state)==="ready"?o.jsxs("div",{className:"skill-generation__ready-actions",children:[W?o.jsx("div",{className:"skill-generation__publish-target",children:o.jsx(dT,{label:"上传到 Skill Space",value:F,options:re,onChange:L,disabled:i,placeholder:i?"正在加载 Skill Space":"选择 Skill Space"})}):null,o.jsxs("footer",{className:"skill-generation__followup",children:[o.jsx("textarea",{value:T,onChange:K=>C(K.target.value),placeholder:"继续调整这个候选方案"}),o.jsx("button",{type:"button",className:"skill-button",disabled:!T.trim()||!!A,onClick:()=>void Ae(),children:"继续调整"}),o.jsx("button",{type:"button",className:"skill-button skill-button--primary",disabled:!!A||!!D||!be,onClick:()=>void Ke(),children:A==="publish"?$||"上传中…":e==="optimize"?"覆盖原 Skill":W?"上传到 Skill Space":"上传到当前空间"})]})]}):null,M?o.jsx("div",{className:"skill-inline-error skill-generation__action-error",children:o.jsx(Fo,{error:M})}):null]}):null,!$e&&x.every(K=>K.error)?o.jsx("div",{className:"skill-inline-error",children:"所有方案均创建失败,可分别重试。"}):null]}):o.jsxs("div",{className:"skill-generation__setup",children:[o.jsx("div",{className:"skill-generation__section-head is-basic",children:o.jsx("div",{children:o.jsx("strong",{children:"基本信息"})})}),o.jsxs("label",{children:[o.jsxs("span",{children:["目标",o.jsx("span",{className:"skill-required-mark","aria-hidden":"true",children:"*"})]}),o.jsx("textarea",{required:!0,value:m,onChange:K=>g(K.target.value),placeholder:e==="create"?"描述希望这个 Skill 完成什么任务":"描述希望如何优化当前 Skill"})]}),o.jsxs("label",{children:[o.jsx("span",{children:"Skill 名称"}),o.jsx("input",{value:b,onChange:K=>y(K.target.value),placeholder:"留空时自动生成","aria-invalid":!!q,"aria-describedby":"skill-name-help"}),q?o.jsx("span",{id:"skill-name-help",className:"skill-generation__field-error",role:"alert",children:q}):o.jsx("span",{id:"skill-name-help",className:"skill-generation__field-help",children:"仅支持小写字母、数字和连字符;留空时自动生成。"})]}),o.jsx("div",{className:"skill-generation__section-head",children:o.jsxs("div",{children:[o.jsx("strong",{children:e==="create"?"生成方案":"优化方案"}),o.jsx("span",{children:e==="create"?"按不同方案并行生成多个技能,您可以选择最佳结果":"按不同方案并行优化当前技能,您可以选择最佳结果"})]})}),o.jsxs("div",{className:"skill-generation__groups",children:[O.map((K,_e)=>o.jsxs("article",{className:"skill-generation__group",children:[o.jsxs("header",{children:[o.jsxs("strong",{children:["方案 ",_e+1]}),O.length>1?o.jsx("button",{type:"button",onClick:()=>v(Be=>Be.filter(He=>He.id!==K.id)),children:"移除"}):null]}),o.jsx(dT,{label:"模型",required:!0,value:K.model,options:(u==null?void 0:u.models.map(Be=>({value:Be.id,label:Be.label})))||[],onChange:Be=>J(K.id,{model:Be}),allowCustom:!0,placeholder:"选择或输入模型 ID",error:sJ(K.model.trim())}),o.jsx(dT,{label:"风格",required:!0,value:K.style,options:MEt,onChange:Be=>J(K.id,{style:Be})}),K.style==="custom"?o.jsxs("label",{children:[o.jsx("span",{children:"自定义风格"}),o.jsx("textarea",{value:K.customStyle,onChange:Be=>J(K.id,{customStyle:Be.target.value}),placeholder:"描述表达方式、严谨程度或输出偏好"})]}):null]},K.id)),u&&O.lengthv(K=>[...K,nJ(K.length,u)]),children:"添加配置"}):null]}),f?o.jsx("div",{className:"skill-inline-error",children:o.jsx(Fo,{error:f})}):null,u&&!u.enabled?o.jsx("div",{className:"skill-inline-notice",children:"管理员未配置"}):null,o.jsx("div",{className:"skill-generation__setup-actions",children:o.jsx("button",{type:"button",className:"skill-button skill-button--primary",disabled:!G,onClick:()=>void ve(),children:"生成"})})]})]})}function dU({title:e,children:t,onClose:n,className:r=""}){const i=p.useRef(null);return p.useEffect(()=>{var a;(a=i.current)==null||a.focus();const s=l=>l.key==="Escape"&&n();return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[n]),o.jsx("div",{className:"skill-dialog-backdrop",onMouseDown:n,children:o.jsxs("section",{className:`skill-dialog${r?` ${r}`:""}`,role:"dialog","aria-modal":"true","aria-label":e,onMouseDown:s=>s.stopPropagation(),children:[o.jsxs("header",{children:[o.jsx("h2",{children:e}),o.jsx("button",{ref:i,type:"button",onClick:n,"aria-label":"关闭",children:"关闭"})]}),t]})})}function zEt({region:e,regionOptions:t,onClose:n,onCreated:r}){const[i,s]=p.useState(""),[a,l]=p.useState(""),[c,u]=p.useState(e),[d,f]=p.useState(!1),[h,m]=p.useState(null),g=async()=>{if(i.trim()){f(!0),m(null);try{const b=await ect({name:i.trim(),description:a.trim()||void 0,region:c});r({...b,region:b.region||c})}catch(b){m(la(b,"创建 Skill 空间失败"))}finally{f(!1)}}};return o.jsxs(dU,{title:"新建 Skill 空间",onClose:n,children:[o.jsxs("div",{className:"skill-dialog__body",children:[o.jsxs("label",{children:[o.jsx("span",{children:"名称"}),o.jsx("input",{autoFocus:!0,value:i,maxLength:128,onChange:b=>s(b.target.value)})]}),o.jsx(dT,{label:"地域",value:c,options:t,onChange:u,required:!0}),o.jsxs("label",{children:[o.jsx("span",{children:"描述(可选)"}),o.jsx("textarea",{value:a,maxLength:1024,onChange:b=>l(b.target.value)})]}),h?o.jsx("div",{className:"skill-inline-error",children:o.jsx(Fo,{error:h})}):null]}),o.jsxs("footer",{children:[o.jsx("button",{type:"button",className:"skill-button",onClick:n,children:"取消"}),o.jsx("button",{type:"button",className:"skill-button skill-button--primary",disabled:!i.trim()||d,onClick:()=>void g(),children:d?"创建中…":"创建"})]})]})}function VEt({space:e,region:t,onClose:n,onUpdated:r}){const[i,s]=p.useState(e.name),[a,l]=p.useState(e.description||""),[c,u]=p.useState(!1),[d,f]=p.useState(null),h=async()=>{if(i.trim()){u(!0),f(null);try{const m=await tct({spaceId:e.id,name:i.trim(),description:a.trim()||void 0,region:t});r({...e,...m,skillCount:e.skillCount})}catch(m){f(la(m,"更新 Skill 空间失败"))}finally{u(!1)}}};return o.jsxs(dU,{title:"编辑 Skill 空间",onClose:n,children:[o.jsxs("div",{className:"skill-dialog__body",children:[o.jsxs("label",{children:[o.jsx("span",{children:"名称"}),o.jsx("input",{autoFocus:!0,value:i,maxLength:128,onChange:m=>s(m.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"描述(可选)"}),o.jsx("textarea",{value:a,maxLength:1024,onChange:m=>l(m.target.value)})]}),d?o.jsx("div",{className:"skill-inline-error",children:o.jsx(Fo,{error:d})}):null]}),o.jsxs("footer",{children:[o.jsx("button",{type:"button",className:"skill-button",onClick:n,children:"取消"}),o.jsx("button",{type:"button",className:"skill-button skill-button--primary",disabled:!i.trim()||c,onClick:()=>void h(),children:c?"保存中…":"保存"})]})]})}function HEt({space:e,region:t,onClose:n,onUploaded:r}){const[i,s]=p.useState(null),[a,l]=p.useState(null),[c,u]=p.useState(!1),[d,f]=p.useState(!1),[h,m]=p.useState(null),[g,b]=p.useState(!1),y=p.useRef(0),O=p.useRef(null),v=async w=>{const S=y.current+1;if(y.current=S,s(w),l(null),m(null),u(!!w),!!w)try{const E=await ict(w);y.current===S&&l({name:E.name,fileCount:E.files.length})}catch(E){y.current===S&&m(la(E,"Skill ZIP 格式校验失败"))}finally{y.current===S&&u(!1)}},x=async()=>{if(!(!i||!a)){f(!0),m(null);try{await rct({spaceId:e.id,region:t,project:e.projectName,file:i}),r()}catch(w){m(la(w,"上传 Skill 失败"))}finally{f(!1)}}};return o.jsxs(dU,{title:`上传到 ${e.name}`,className:"skill-upload-dialog",onClose:n,children:[o.jsxs("div",{className:"skill-dialog__body",children:[o.jsx("input",{ref:O,className:"skill-upload-dialog__input",type:"file",accept:".zip,application/zip",onChange:w=>{var S;return void v(((S=w.target.files)==null?void 0:S[0])||null)}}),o.jsxs("button",{type:"button",className:`skill-upload-dropzone${g?" is-dragging":""}`,onClick:()=>{var w;return(w=O.current)==null?void 0:w.click()},onDragEnter:w=>{w.preventDefault(),b(!0)},onDragOver:w=>{w.preventDefault(),w.dataTransfer.dropEffect="copy",b(!0)},onDragLeave:w=>{w.currentTarget.contains(w.relatedTarget)||b(!1)},onDrop:w=>{var S;w.preventDefault(),b(!1),v(((S=w.dataTransfer.files)==null?void 0:S[0])||null)},children:[o.jsx("strong",{children:i?i.name:"拖拽 Skill ZIP 到这里"}),o.jsx("span",{children:i?`${i.size.toLocaleString()} 字节`:"或点击选择本地文件"})]}),o.jsx("p",{children:"ZIP 根目录需要包含 SKILL.md,也可以只包含一层包装目录。选择后仅检查格式,不会自动上传。"}),c?o.jsx("div",{className:"skill-inline-notice",children:"正在检查文件格式…"}):null,a?o.jsxs("div",{className:"skill-inline-notice",children:["格式检查通过:",a.name,",共 ",a.fileCount," 个文件"]}):null,h?o.jsx("div",{className:"skill-inline-error",children:o.jsx(Fo,{error:h})}):null]}),o.jsxs("footer",{children:[o.jsx("button",{type:"button",className:"skill-button",onClick:n,children:"取消"}),o.jsx("button",{type:"button",className:"skill-button skill-button--primary",disabled:!i||!a||c||d,onClick:()=>void x(),children:d?"上传中…":"上传"})]})]})}function qEt(e){if(typeof e=="number")return e<1e12?e*1e3:e;const t=e.trim(),n=Number(t);return/^\d+(?:\.\d+)?$/.test(t)?n<1e12?n*1e3:n:Date.parse(t)}function lve(e,t=Date.now()){if(e===void 0||e==="")return"—";const n=qEt(e);if(!Number.isFinite(n))return"—";const r=Math.floor(Math.max(0,t-n)/1e3);if(r<60)return`${r} 秒前`;const i=Math.floor(r/60);if(i<60)return`${i} 分钟前`;const s=Math.floor(i/60);if(s<24)return`${s} 小时前`;const a=Math.floor(s/24);if(a<30)return`${a} 天前`;const l=Math.floor(a/30);return l<12?`${l} 个月前`:`${Math.floor(l/12)} 年前`}const XEt=12,aJ=12;function VA({disabled:e,placement:t="top",children:n}){const r=p.useId();return o.jsxs("span",{className:`skillcenter-disabled-action${e?" is-disabled":""} is-${t}`,tabIndex:e?0:void 0,"aria-describedby":e?r:void 0,children:[n,e?o.jsx("span",{id:r,className:"skillcenter-disabled-tooltip",role:"tooltip",children:"管理员未配置 Dev Sandbox"}):null]})}const GEt={active:"可用",available:"可用",creating:"创建中",disabled:"已停用",enabled:"已启用",failed:"异常",inactive:"未启用",pending:"等待中",published:"已发布",ready:"就绪",released:"已发布",running:"运行中",success:"正常",unavailable:"不可用",unreleased:"未发布",updating:"更新中"};function cve(e){return GEt[(e||"").trim().toLowerCase()]||"未知"}function WEt(e){const t=(e||"").toLowerCase();return["active","available","enabled","published","ready","released","success"].includes(t)||t==="running"?"is-positive":["creating","pending","updating"].includes(t)?"is-progress":["failed","unavailable"].includes(t)?"is-danger":"is-muted"}function YEt(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 oJ(e){if(!e)return 0;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())?0:r.getTime()}function Ol(e){return`${e.region||"default"}:${e.projectName||"default"}:${e.id}`}function ZEt(e,t){const n=new Map(e.map(r=>[Ol(r),r]));for(const r of t)n.set(Ol(r),r);return[...n.values()].sort((r,i)=>oJ(i.updatedAt)-oJ(r.updatedAt))}function KEt(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 uve(e){const t=(e||"").trim();return!t||[">",">-","|","|-"].includes(t)?"暂无描述":t}function ekt(){return o.jsx("svg",{className:"icon",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:o.jsx("path",{d:"m7.5 7.5 9 9m0-9-9 9",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function tkt(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M12 5.5v13M5.5 12h13",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round"})})}function lJ({direction:e}){return o.jsx("svg",{className:"icon",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,children:o.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 nkt(){return o.jsx("span",{className:"skillcenter-loading-mark","aria-hidden":!0})}function rkt({page:e,total:t,pageSize:n,onPage:r}){const i=Math.max(1,Math.ceil(t/n));return o.jsxs("footer",{className:"skillcenter-pager",children:[o.jsxs("span",{children:["共 ",t," 项"]}),o.jsxs("div",{className:"skillcenter-pager-actions",children:[o.jsx("button",{type:"button",onClick:()=>r(e-1),disabled:e<=1,"aria-label":"上一页",children:o.jsx(lJ,{direction:"left"})}),o.jsxs("span",{children:[e," / ",i]}),o.jsx("button",{type:"button",onClick:()=>r(e+1),disabled:e>=i,"aria-label":"下一页",children:o.jsx(lJ,{direction:"right"})})]})]})}function ikt({children:e}){return o.jsx("div",{className:"skillcenter-empty",children:e})}function RP({kind:e,title:t,description:n,error:r,action:i}){return o.jsx("div",{className:`skillcenter-page-state is-${e}`,role:e==="error"?"alert":"status",children:o.jsxs(xn,{fill:"none",children:[o.jsx(xn.Title,{children:t}),n?o.jsx(xn.Description,{children:n}):null,r?o.jsx(zo,{error:r}):null,i?o.jsx(xn.ActionRow,{children:o.jsx(Nt,{color:"secondary",size:"lg",onClick:i.onClick,children:i.label})}):null]})})}function cJ({errors:e,cloudProvider:t,fullPage:n=!1,onRetry:r}){return o.jsxs("div",{className:`skillcenter-space-errors${n?" is-full-page":""}`,role:"alert",children:[o.jsxs("div",{className:"skillcenter-space-errors__content",children:[o.jsx("strong",{children:n?"无法加载技能空间":"部分技能空间加载失败"}),e.map(({region:i,error:s})=>o.jsxs("section",{children:[o.jsx("span",{children:Zf(i,t)}),o.jsx(zo,{error:s})]},i))]}),o.jsx("button",{type:"button",onClick:r,children:"重新加载"})]})}function skt({skill:e,space:t,region:n,cloudProvider:r,detail:i,files:s,loading:a,error:l,canOptimize:c,onOptimize:u,onDownload:d,onClose:f}){return p.useEffect(()=>{const h=m=>{m.key==="Escape"&&f()};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[f]),o.jsx("div",{className:"skill-detail-backdrop",role:"presentation",onMouseDown:f,children:o.jsxs("section",{className:"skill-detail-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"skill-detail-title",onMouseDown:h=>h.stopPropagation(),children:[o.jsxs("header",{className:"skill-detail-head",children:[o.jsx("div",{className:"skill-detail-heading",children:o.jsxs("div",{children:[o.jsx("h2",{id:"skill-detail-title",children:(i==null?void 0:i.name)||e.skillName}),o.jsx("p",{children:uve((i==null?void 0:i.description)||e.skillDescription)})]})}),o.jsxs("div",{className:"skill-detail-actions",children:[o.jsx("button",{type:"button",onClick:d,disabled:s.length===0,children:"下载 ZIP"}),o.jsx(VA,{disabled:!c,placement:"bottom",children:o.jsx("button",{type:"button",onClick:u,disabled:!c,children:"优化"})}),o.jsx("button",{type:"button",className:"skill-detail-close",onClick:f,"aria-label":"关闭技能详情",children:o.jsx(ekt,{})})]})]}),o.jsxs("dl",{className:"skill-detail-meta",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"技能 ID"}),o.jsx("dd",{title:e.skillId,children:e.skillId})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"版本"}),o.jsx("dd",{children:(i==null?void 0:i.version)||e.version||"—"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"状态"}),o.jsx("dd",{children:cve(e.skillStatus)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"技能空间"}),o.jsx("dd",{title:t.name,children:t.name})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"地域"}),o.jsx("dd",{children:Zf(n,r)})]})]}),o.jsxs("div",{className:"skill-detail-content skill-detail-content--files",children:[o.jsx("div",{className:"skill-detail-content-title",children:"完整文件"}),a?o.jsxs("div",{className:"skillcenter-loading",children:[o.jsx(nkt,{}),"正在读取技能内容…"]}):l?o.jsx("div",{className:"skillcenter-error",children:o.jsx(zo,{error:l})}):s.length>0?o.jsx(sve,{files:s.map(h=>h.path.endsWith("SKILL.md")&&h.content?{...h,content:JEt(h.content)}:h)}):o.jsx(ikt,{children:"该技能暂无 SKILL.md 内容"})]})]})})}function akt({space:e,canUseSandbox:t,onUpload:n,onSandbox:r,onClose:i}){return p.useEffect(()=>{const s=a=>{a.key==="Escape"&&i()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[i]),o.jsx("div",{className:"skill-dialog-backdrop",role:"presentation",onMouseDown:i,children:o.jsxs("section",{className:"skill-dialog skill-add-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"skill-add-dialog-title",onMouseDown:s=>s.stopPropagation(),children:[o.jsxs("header",{children:[o.jsxs("div",{children:[o.jsx("h2",{id:"skill-add-dialog-title",children:"添加技能"}),o.jsx("p",{title:e.name,children:e.name})]}),o.jsx("button",{type:"button",onClick:i,children:"取消"})]}),o.jsxs("div",{className:"skill-add-dialog__options",children:[o.jsxs("button",{type:"button",onClick:n,children:[o.jsx("strong",{children:"本地上传"}),o.jsx("span",{children:"选择 ZIP 文件,校验通过后上传到技能空间"})]}),o.jsx(VA,{disabled:!t,placement:"inside",children:o.jsxs("button",{type:"button",disabled:!t,onClick:r,children:[o.jsx("strong",{children:"自动创建"}),o.jsx("span",{children:"选择模型和风格,通过对话生成技能"})]})})]})]})})}function okt({cloudProvider:e="volcengine",region:t,active:n=!0,activationRevision:r=0,initialWorkspace:i=null,onInitialWorkspaceConsumed:s,onPageTitleChange:a,toolbarLeading:l,toolbarFilters:c}){var Rt;const u=p.useMemo(()=>[t],[t]),[d,f]=p.useState([]),[h,m]=p.useState({}),[g,b]=p.useState(!1),[y,O]=p.useState(""),[v,x]=p.useState((i==null?void 0:i.space)??null),[w,S]=p.useState([]),[E,k]=p.useState(1),[_,C]=p.useState(0),[T,A]=p.useState(!1),[j,L]=p.useState(null),[I,M]=p.useState(""),[N,D]=p.useState("overview"),[Q,F]=p.useState(null),[$,H]=p.useState(null),[z,B]=p.useState([]),[V,Z]=p.useState(!1),[ce,be]=p.useState(null),[ie,q]=p.useState(null),[X,K]=p.useState(!1),[de,xe]=p.useState(null),[Me,Ae]=p.useState(null),[He,et]=p.useState(null),[Te,Re]=p.useState(0),[he,me]=p.useState(0),[Se,ke]=p.useState(""),[nt,Qe]=p.useState(""),[re,ue]=p.useState(null),[Pe,Ge]=p.useState(i),W=p.useRef(0),_e=p.useRef(0),rt=p.useRef(!1),Ve=p.useRef(null),We=p.useRef(null),ot=p.useRef(null),St=p.useDeferredValue(y),Vt=p.useDeferredValue(I),Ne=(Pe&&(v||Pe.selectPublishSpace)?Pe.operation==="create"?"创建技能":`优化 ${((Rt=Pe.source)==null?void 0:Rt.name)||"技能"}`:"")||(v==null?void 0:v.name)||"技能库";p.useEffect(()=>{n&&(a==null||a(Ne))},[n,a,Ne]),p.useEffect(()=>{i&&(s==null||s())},[i,s]);const $e=p.useMemo(()=>{const Ce=St.trim().toLocaleLowerCase();return Ce?d.filter(bt=>`${bt.name} ${bt.description||""} ${bt.projectName||""}`.toLocaleLowerCase().includes(Ce)):d},[St,d]),mt=p.useMemo(()=>{const Ce=Vt.trim().toLocaleLowerCase();return Ce?w.filter(bt=>`${bt.skillName} ${bt.skillDescription||""}`.toLocaleLowerCase().includes(Ce)):w},[Vt,w]),Ht=(v==null?void 0:v.region)||Yr(e),qe=p.useMemo(()=>u.flatMap(Ce=>{var Ut;const bt=(Ut=h[Ce])==null?void 0:Ut.error;return bt?[{region:Ce,error:bt}]:[]}),[h,u]),ye=u.some(Ce=>{const bt=h[Ce];return!!(bt&&!bt.done&&!bt.error)}),Ue=qe.length===u.length;p.useEffect(()=>{const Ce=new AbortController;return Mj(Ce.signal).then(q).catch(()=>q({enabled:!1,reason:"管理员未配置",operations:["create","optimize"],models:[],styles:{}})),()=>Ce.abort()},[]);const it=p.useCallback(async(Ce,bt)=>{var ze;if(rt.current||Ce.length===0)return;rt.current=!0,b(!0),bt&&((ze=Ve.current)==null||ze.abort(),f([]),m(Object.fromEntries(Ce.map(({region:tt})=>[tt,{nextPage:1,loadedCount:0,done:!1,error:null}]))));const Ut=new AbortController;Ve.current=Ut;const lt=++_e.current,sn=await Promise.allSettled(Ce.map(async({region:tt,page:en})=>({region:tt,page:en,result:await ect({region:tt,page:en,pageSize:GEt,signal:Ut.signal})})));if(_e.current!==lt)return;const yr=sn.map((tt,en)=>{const rn=Ce[en];return tt.status==="rejected"?{request:rn,error:ua(tt.reason,"读取技能空间失败,请稍后重试"),items:[],totalCount:0}:{request:rn,error:null,items:(tt.value.result.items||[]).map(rr=>({...rr,region:rr.region||tt.value.region})),totalCount:tt.value.result.totalCount||0}}),sr=yr.flatMap(tt=>tt.items);m(tt=>{const en={...tt};return yr.forEach(({request:rn,error:rr,items:dr,totalCount:Rn})=>{const ar=en[rn.region]||{nextPage:rn.page,loadedCount:0,done:!1,error:null};if(rr){en[rn.region]={...ar,error:rr};return}const Vr=ar.loadedCount+dr.length;en[rn.region]={nextPage:rn.page+1,loadedCount:Vr,done:dr.length===0||Vr>=Rn,error:null}}),en}),f(tt=>KEt(bt?[]:tt,sr)),x(tt=>tt&&(sr.find(en=>Ol(en)===Ol(tt))||tt)),rt.current=!1,b(!1)},[]),we=p.useCallback(()=>{if(rt.current)return;const Ce=u.flatMap(bt=>{const Ut=h[bt];return Ut&&!Ut.done&&!Ut.error?[{region:bt,page:Ut.nextPage}]:[]});it(Ce,!1)},[it,h,u]);p.useEffect(()=>{Pt(),x(null),S([]),k(1)},[e]),p.useEffect(()=>{if(n)return it(u.map(Ce=>({region:Ce,page:1})),!0),()=>{var Ce;_e.current+=1,(Ce=Ve.current)==null||Ce.abort(),rt.current=!1}},[n,r,it,u,Te]),p.useEffect(()=>{const Ce=ot.current,bt=We.current;if(!Ce||!bt||!ye||g)return;const Ut=new IntersectionObserver(([lt])=>{lt.isIntersecting&&we()},{root:bt,rootMargin:"240px 0px",threshold:.01});return Ut.observe(Ce),()=>Ut.disconnect()},[ye,we,g]);const Fe=()=>{const Ce=We.current;!Ce||!ye||g||Ce.scrollHeight-Ce.scrollTop-Ce.clientHeight<=240&&we()};p.useEffect(()=>{if(!v){S([]),C(0);return}let Ce=!0;return A(!0),L(null),cct(v.id,{region:Ht,page:E,pageSize:aJ,project:v.projectName}).then(bt=>{Ce&&(S(bt.items||[]),C(bt.totalCount||0))}).catch(bt=>{Ce&&(S([]),C(0),L(ua(bt,"读取技能失败,请稍后重试")))}).finally(()=>{Ce&&A(!1)}),()=>{Ce=!1}},[Ht,v,E,he]);const dt=Ce=>{Pt(),x(Ce),D("overview"),k(1),M("")},Tt=()=>{Pt(),x(null),S([]),C(0),D("overview"),k(1),M(""),ue(null)},Pt=()=>{W.current+=1,F(null),H(null),B([]),be(null),Z(!1)},nn=async Ce=>{if(!v)return;const bt=W.current+1;W.current=bt,F(Ce),H(null),be(null),Z(!0);try{const[Ut,lt]=await Promise.all([uct(v.id,Ce.skillId,Ce.version,Ht,v.projectName,Ce.skillName,v.name),oct({spaceId:v.id,skillId:Ce.skillId,version:Ce.version,region:Ht,skillSpaceName:v.name,skillName:Ce.skillName})]);W.current===bt&&(H(Ut),B(lt))}catch(Ut){W.current===bt&&be(ua(Ut,"读取技能详情失败,请稍后重试"))}finally{W.current===bt&&Z(!1)}},ln=Ce=>{if(v)return{kind:"skill-center",skillId:Ce.skillId,version:Ce.version,region:Ht,projectName:v.projectName,skillSpaceId:v.id,skillSpaceName:v.name,name:Ce.skillName,description:Ce.skillDescription}},le=Ce=>{const bt=ln(Ce);!bt||!(ie!=null&&ie.enabled)||(Pt(),Ge({operation:"optimize",source:bt}))},Wt=async Ce=>{if(!(!v||!window.confirm(`确定删除整个 Skill“${Ce.skillName}”吗?此操作会影响所有引用它的空间。`))){ke(Ce.skillId),ue(null);try{await act({spaceId:v.id,skillId:Ce.skillId,region:Ht}),me(bt=>bt+1),Re(bt=>bt+1)}catch(bt){ue(ua(bt,"删除 Skill 失败"))}finally{ke("")}}},Le=async Ce=>{if(!window.confirm(`确定删除 Skill 空间“${Ce.name}”吗?请先确认空间中的技能已删除。`))return;const bt=Ol(Ce);Qe(bt),ue(null);try{await rct({spaceId:Ce.id,region:Ce.region||Yr(e)}),v&&Ol(v)===bt&&Tt(),Re(Ut=>Ut+1)}catch(Ut){ue(ua(Ut,"删除 Skill 空间失败"))}finally{Qe("")}};return Pe&&(v||Pe.selectPublishSpace)?o.jsx(zEt,{operation:Pe.operation,cloudProvider:e,space:v??void 0,availableSpaces:d,spacesLoading:g,initialIntent:Pe.initialIntent,source:Pe.source,onBack:()=>Ge(null),onPublished:()=>{me(Ce=>Ce+1),Re(Ce=>Ce+1)}}):o.jsxs("section",{className:`skillcenter${v?" is-space":" resource-collection"}`,children:[v?o.jsx(hE,{className:"skillcenter-detail",title:v.name,description:v.description||"管理空间中的技能并创建新的版本",identitySeed:v.name,backLabel:"返回技能空间列表",onBack:Tt,sections:[{key:"overview",label:"概览",content:o.jsxs(o.Fragment,{children:[re?o.jsx("div",{className:"skillcenter-inline-error",role:"alert",children:o.jsx(zo,{error:re})}):null,o.jsx("section",{className:"skillcenter-overview",children:o.jsxs(G7,{className:"skillcenter-detail-facts",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"技能数量"}),o.jsx("dd",{children:_})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"更新时间"}),o.jsx("dd",{children:v.updatedAt?ZEt(v.updatedAt):"—"})]})]})})]})},{key:"skills",label:"技能",content:o.jsxs(o.Fragment,{children:[re?o.jsx("div",{className:"skillcenter-inline-error",role:"alert",children:o.jsx(zo,{error:re})}):null,o.jsxs("section",{className:"skillcenter-results","aria-label":`${v.name}中的技能`,children:[o.jsx(Qhe,{title:"技能",description:`共 ${_} 项`,actions:o.jsx(Gp,{"aria-label":"搜索技能",value:I,onChange:Ce=>M(Ce.target.value),placeholder:"搜索技能"})}),T&&w.length===0?o.jsx(bd,{}):j&&w.length===0?o.jsx(RP,{kind:"error",title:"无法加载技能",error:j,action:{label:"重新加载",onClick:()=>me(Ce=>Ce+1)}}):mt.length===0?o.jsx(RP,{kind:"empty",title:I.trim()?"没有匹配的技能":"暂无技能",description:I.trim()?"请尝试搜索其他名称":"本地上传 Skill,或自动创建",action:I.trim()?void 0:{label:"本地上传",onClick:()=>et(v)}}):o.jsx("div",{className:"skillcenter-table-wrap",children:o.jsxs("table",{className:"skillcenter-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{scope:"col",children:"技能"}),o.jsx("th",{scope:"col",children:"状态"}),o.jsx("th",{scope:"col",className:"skillcenter-table__actions-heading",children:"操作"})]})}),o.jsx("tbody",{children:mt.map(Ce=>o.jsxs("tr",{children:[o.jsx("td",{className:"skillcenter-table__skill",children:o.jsxs("button",{type:"button",onClick:()=>void nn(Ce),children:[o.jsxs("span",{className:"skillcenter-table__title-row",children:[o.jsx("strong",{title:Ce.skillName,children:Ce.skillName}),Ce.version?o.jsx("span",{className:"skillcenter-table__version-badge",children:Ce.version}):null]}),o.jsx("span",{className:"skillcenter-table__description",children:uve(Ce.skillDescription)})]})}),o.jsx("td",{children:o.jsx("span",{className:`skillcenter-status ${YEt(Ce.skillStatus)}`,children:cve(Ce.skillStatus)})}),o.jsx("td",{children:o.jsxs("div",{className:"skillcenter-table__actions",children:[o.jsx("button",{type:"button",onClick:()=>void nn(Ce),children:"查看"}),o.jsx(VA,{disabled:!(ie!=null&&ie.enabled),children:o.jsx("button",{type:"button",disabled:!(ie!=null&&ie.enabled),onClick:()=>le(Ce),children:"优化"})}),o.jsx("button",{type:"button",className:"is-danger",disabled:Se===Ce.skillId,onClick:()=>void Wt(Ce),children:Se===Ce.skillId?"删除中…":"删除"})]})})]},`${Ce.skillId}:${Ce.version}`))})]})}),!I.trim()&&!T&&!j&&_>0?o.jsx(rkt,{page:E,total:_,pageSize:aJ,onPage:k}):null]})]})}],activeSectionKey:N,navigationLabel:"技能空间详情",onSectionChange:Ce=>D(Ce),actionsClassName:"skillcenter-toolbar-actions",actions:o.jsxs(o.Fragment,{children:[o.jsx(Nt,{type:"button",color:"secondary",variant:"outline",size:"lg",pill:!1,onClick:()=>xe(v),children:"编辑空间"}),o.jsx(Nt,{type:"button",color:"danger",variant:"soft",size:"lg",pill:!1,disabled:nt===Ol(v),onClick:()=>void Le(v),children:nt===Ol(v)?"删除中…":"删除空间"}),o.jsx(Nt,{type:"button",color:"secondary",variant:"outline",size:"lg",pill:!1,onClick:()=>et(v),children:"本地上传"}),o.jsx(VA,{disabled:!(ie!=null&&ie.enabled),children:o.jsxs(Nt,{type:"button",color:"primary",size:"lg",pill:!1,disabled:!(ie!=null&&ie.enabled),onClick:()=>Ge({operation:"create"}),children:[o.jsx(Cae,{"aria-hidden":"true"}),o.jsx("span",{children:"创建技能"})]})})]})}):o.jsxs(o.Fragment,{children:[o.jsxs(g0,{className:"skillcenter-list-toolbar library-resource-toolbar",children:[l,o.jsxs("div",{className:"resource-toolbar__actions",children:[c,o.jsx(Gp,{"aria-label":"搜索技能空间",value:y,onChange:Ce=>O(Ce.target.value),placeholder:"搜索技能空间"})]})]}),re?o.jsx("div",{className:"skillcenter-inline-error",role:"alert",children:o.jsx(zo,{error:re})}):null,o.jsxs(b0,{className:"skillcenter-list-results",ref:We,"aria-label":"技能空间列表",onScroll:Fe,children:[qe.length>0&&!Ue?o.jsx(cJ,{errors:qe,cloudProvider:e,onRetry:()=>Re(Ce=>Ce+1)}):null,g&&d.length===0?o.jsx(bd,{}):Ue&&d.length===0?o.jsx(cJ,{errors:qe,cloudProvider:e,fullPage:!0,onRetry:()=>Re(Ce=>Ce+1)}):$e.length===0&&y.trim()?o.jsx(RP,{kind:"empty",title:"没有匹配的技能空间",description:"请尝试搜索其他名称"}):o.jsxs(aO,{children:[y.trim()?null:o.jsx(Vg,{"aria-label":"新建技能空间",icon:o.jsx(tkt,{}),onClick:()=>K(!0),children:"新建空间"}),$e.map(Ce=>{const bt=Ol(Ce);return o.jsx(bE,{className:"skillcenter-space-card",title:Ce.name,description:Ce.description||"暂无描述",metadata:[{label:"技能数量",value:`${Ce.skillCount??0} 技能`},{label:"更新时间",value:lve(Ce.updatedAt)}],action:{label:"添加技能",icon:"plus",onClick:()=>Ae(Ce)},detailAction:{label:"查看详情",onClick:()=>dt(Ce)}},bt)})]}),!Ue&&d.length>0?o.jsx("div",{className:"my-agent-load-more",ref:ot,"aria-live":"polite",children:g?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载更多技能空间"})]}):ye?o.jsx("span",{children:"继续下滑加载更多"}):qe.length>0?o.jsx("span",{children:"部分技能空间加载失败"}):o.jsx("span",{children:"已加载全部技能空间"})}):null]})]}),Q&&v&&o.jsx(skt,{skill:Q,space:v,region:Ht,cloudProvider:e,detail:$,files:z,loading:V,error:ce,canOptimize:(ie==null?void 0:ie.enabled)===!0,onOptimize:()=>le(Q),onDownload:()=>void lct({spaceId:v.id,skillId:Q.skillId,version:Q.version,region:Ht,fallbackName:Q.skillName,skillSpaceName:v.name,skillName:Q.skillName}).catch(Ce=>be(ua(Ce,"下载 Skill 失败"))),onClose:Pt}),X?o.jsx(VEt,{region:t,regionOptions:Sd(e),onClose:()=>K(!1),onCreated:Ce=>{K(!1),Re(bt=>bt+1),x({...Ce,region:Ce.region||t})}}):null,de?o.jsx(HEt,{space:de,region:de.region||Yr(e),onClose:()=>xe(null),onUpdated:Ce=>{const bt={...Ce,region:Ce.region||de.region||Yr(e)};xe(null),x(Ut=>Ut&&Ol(Ut)===Ol(bt)?bt:Ut),f(Ut=>Ut.map(lt=>Ol(lt)===Ol(bt)?bt:lt)),Re(Ut=>Ut+1)}}):null,Me?o.jsx(akt,{space:Me,canUseSandbox:(ie==null?void 0:ie.enabled)===!0,onClose:()=>Ae(null),onUpload:()=>{et(Me),Ae(null)},onSandbox:()=>{const Ce=Me;Ae(null),dt(Ce),Ge({operation:"create"})}}):null,He?o.jsx(qEt,{space:He,region:He.region||Yr(e),onClose:()=>et(null),onUploaded:()=>{et(null),me(Ce=>Ce+1),Re(Ce=>Ce+1)}}):null]})}const uJ=[{id:"skills",label:"技能库",panelId:"library-skills-panel"},{id:"knowledge",label:"知识库",panelId:"library-knowledge-panel"},{id:"artifacts",label:"产物",panelId:"library-artifacts-panel"}];function lkt({cloudProvider:e,studioRegion:t="",activeTab:n,onTabChange:r,onPageTitleChange:i,skillInitialWorkspace:s=null,onSkillInitialWorkspaceConsumed:a,artifactSources:l=[],artifactUserId:c="",onArtifactActivate:u,onArtifactSourceOpen:d}){const f=HS(t)?t:Yr(e),[h,m]=p.useState(f),[g,b]=p.useState("技能库"),[y,O]=p.useState(!1),[v,x]=p.useState(()=>new Set(["skills",n])),[w,S]=p.useState({skills:0,knowledge:0,artifacts:0}),E=p.useRef(u),[k,_]=p.useState([]),[C,T]=p.useState(!1),[A,j]=p.useState(""),L=p.useMemo(()=>{const z=vGe(l);return{key:JSON.stringify(z),candidates:z}},[l]),I=p.useRef(L);I.current.key!==L.key&&(I.current=L);const M=I.current.candidates,N=p.useMemo(()=>Sd(e),[e]);p.useEffect(()=>{m(f)},[f]),p.useEffect(()=>{E.current=u},[u]),p.useEffect(()=>{x(z=>{if(z.has(n))return z;const B=new Set(z);return B.add(n),B})},[n]),p.useEffect(()=>{var B;const z=n==="skills"?g:((B=uJ.find(V=>V.id===n))==null?void 0:B.label)||"资源库";i==null||i(z)},[n,i,g]),p.useEffect(()=>{var z;n==="artifacts"&&((z=E.current)==null||z.call(E))},[n,w.artifacts]);const D=p.useCallback(async()=>{T(!0),j("");try{_(await jGe(M))}catch(z){j(z instanceof Error?z.message:String(z))}finally{T(!1)}},[M]);p.useEffect(()=>{n==="artifacts"&&D()},[n,w.artifacts,D]);const Q=z=>{x(B=>{if(B.has(z))return B;const V=new Set(B);return V.add(z),V}),S(B=>({...B,[z]:B[z]+1})),r(z)},F=o.jsx(pE,{idPrefix:"library",ariaLabel:"资源库分类",value:n,items:uJ,onChange:Q}),$=z=>o.jsx(HC,{id:z,ariaLabel:"区域",value:h,options:N,onChange:m}),H=n==="skills"?g!=="技能库":n==="knowledge"&&y;return o.jsxs(ih,{className:`library-view${H?" is-detail":""}`,"aria-label":"资源库",children:[H?null:o.jsx(sO,{className:"library-view__header",title:"资源库"}),o.jsxs("div",{className:"library-panels",children:[v.has("skills")?o.jsx("div",{id:"library-skills-panel",className:"library-panel",role:"tabpanel","aria-labelledby":"library-skills-tab",hidden:n!=="skills",children:o.jsx(okt,{cloudProvider:e,region:h,active:n==="skills",activationRevision:w.skills,onPageTitleChange:b,initialWorkspace:s,onInitialWorkspaceConsumed:a,toolbarLeading:F,toolbarFilters:$("library-skills-region-filter")})}):null,v.has("knowledge")?o.jsx("div",{id:"library-knowledge-panel",className:"library-panel",role:"tabpanel","aria-labelledby":"library-knowledge-tab",hidden:n!=="knowledge",children:o.jsx(Flt,{cloudProvider:e,region:h,active:n==="knowledge",activationRevision:w.knowledge,onDetailChange:O,toolbarLeading:F,toolbarFilters:$("library-knowledge-region-filter")})}):null,v.has("artifacts")?o.jsx("div",{id:"library-artifacts-panel",className:"library-panel",role:"tabpanel","aria-labelledby":"library-artifacts-tab",hidden:n!=="artifacts",children:o.jsx(CGe,{items:k,region:h,userId:c,active:n==="artifacts",activationRevision:w.artifacts,loading:C,error:A,onRetry:()=>void D(),onEdit:RGe,onDelete:IGe,onDownload:DGe,onOpenSource:d?z=>d(z.appName,z.sessionId):void 0,toolbarLeading:F,toolbarFilters:$("library-artifacts-region-filter")})}):null]})]})}const dve="veadk_agentkit_connections",ckt=3e3,dJ=6e4;function au(){try{const e=localStorage.getItem(dve);return(e?JSON.parse(e):[]).filter(n=>!n.runtimeId||!!n.region)}catch{return[]}}function gR(e){try{localStorage.setItem(dve,JSON.stringify(e))}catch{}}function bu(e,t){return`agentkit:${e}:${t}`}function fve(e){try{return new URL(e).host}catch{return e}}function SO(e){Xae();for(const t of e)if(!(t.runtimeId&&!t.region))for(const n of t.apps)qae(bu(t.id,n),t.runtimeId?{app:n,runtimeId:t.runtimeId,region:t.region}:{app:n,base:t.base,apiKey:t.apiKey})}function hve(e,t,n,r,i,s){const a={id:`rt_${e}`,name:t||e,runtimeId:e,region:n,apps:r,appLabels:i,currentVersion:s},l=au(),c=l.findIndex(u=>u.runtimeId===e);return c===-1?l.push(a):l[c]=a,gR(l),SO(l),a}async function ukt(e,t,n,r,i){let s=null,a=n||"cn-beijing",l=null;for(const f of qS(n))try{const h=await Jy(e,f,{retryProbe:!0,preferCached:!0,currentVersion:r});if(h&&h.length>0){await lle(e,f),s=h,a=f;break}}catch(h){if(h instanceof F1)throw HA(e),h;if(h instanceof Es&&h.unsupported){l=h;continue}throw h}if(!s||s.length===0)throw HA(e),l||new Es("该 Runtime 暂不支持连接,请确认服务已正常运行。",!0,!0);const c=(i==null?void 0:i.trim())||s[0],u=Object.fromEntries(s.map(f=>[f,f===s[0]?c:f])),d=hve(e,t,a,s,u,r);return bu(d.id,s[0])}function dkt(e){return new Promise(t=>window.setTimeout(t,e))}async function TT(e,t,n,r,i={}){const s=Date.now();for(;;)try{return await ukt(e,t,n,r,i.agentName)}catch(a){const l=Date.now()-s;if(!i.waitForReady||!(a instanceof Es)||!a.retryable||l>=dJ)throw a;const c=Math.min(ckt,dJ-l);await dkt(c)}}async function pve(e,t,n,r){const i=t.trim().replace(/\/+$/,""),s=await XS(i,n.trim()),a={id:Date.now().toString(36),name:e.trim()||fve(i),base:i,apiKey:n.trim(),apps:s,appLabels:r&&s.length>0?{[s[0]]:r}:void 0},l=[...au().filter(c=>c.base!==i),a];return gR(l),SO(l),a}function fkt(e){const t=au().filter(n=>n.id!==e);return gR(t),SO(t),t}function HA(e){const t=au().filter(n=>n.runtimeId!==e);return gR(t),SO(t),t}function mve(e,t){const n=e.map(i=>({id:i,label:i,app:i,remote:!1})),r=t.flatMap(i=>i.apps.map(s=>{var l;const a=((l=i.appLabels)==null?void 0:l[s])??s;return{id:bu(i.id,s),label:a,app:s,remote:!0,host:i.runtimeId?i.name:fve(i.base??""),runtimeId:i.runtimeId,region:i.region,currentVersion:i.currentVersion}}));return[...n,...r]}const fJ=Object.freeze(Object.defineProperty({__proto__:null,addConnection:pve,addRuntimeConnection:hve,buildAgentEntries:mve,connectRuntime:TT,loadConnections:au,registerConnections:SO,remoteAppId:bu,removeConnection:fkt,removeRuntimeConnection:HA},Symbol.toStringTag,{value:"Module"}));function hkt({onAdded:e,onCancel:t}){const[n,r]=p.useState(""),[i,s]=p.useState(""),[a,l]=p.useState(""),[c,u]=p.useState(!1),[d,f]=p.useState(""),h=n.trim().length>0&&i.trim().length>0&&!c;async function m(){if(h){u(!0),f("");try{const g=await pve(a,n,i,a);if(g.apps.length===0){f("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。"),u(!1);return}e(bu(g.id,g.apps[0]))}catch(g){f(`连接失败:${String(g)}。请检查 URL、API Key,以及该网关是否允许跨域。`),u(!1)}}}return o.jsx("div",{className:"addagent",children:o.jsxs("div",{className:"addagent-card",children:[o.jsx("h2",{className:"addagent-title",children:"添加 AgentKit 智能体"}),o.jsx("p",{className:"addagent-sub",children:"填入 AgentKit 部署的访问地址与 API Key,将通过 ADK 协议连接,连接成功后其 Agent 会出现在左上角的下拉中。"}),o.jsxs("label",{className:"addagent-field",children:[o.jsx("span",{className:"addagent-label",children:"访问地址 URL"}),o.jsx("input",{className:"addagent-input",value:n,onChange:g=>r(g.target.value),placeholder:"https://xxxxx.apigateway-cn-beijing.volceapi.com",autoFocus:!0})]}),o.jsxs("label",{className:"addagent-field",children:[o.jsx("span",{className:"addagent-label",children:"API Key"}),o.jsx("input",{className:"addagent-input",type:"password",value:i,onChange:g=>s(g.target.value),placeholder:"以 Authorization: Bearer 方式连接"})]}),o.jsxs("label",{className:"addagent-field",children:[o.jsx("span",{className:"addagent-label",children:"显示名称(可选)"}),o.jsx("input",{className:"addagent-input",value:a,onChange:g=>l(g.target.value),placeholder:"默认取 URL 的主机名"})]}),d&&o.jsx("div",{className:"addagent-error",children:d}),o.jsxs("div",{className:"addagent-actions",children:[o.jsx("button",{className:"addagent-btn addagent-btn--ghost",onClick:t,disabled:c,children:"取消"}),o.jsxs("button",{className:"addagent-btn addagent-btn--primary",onClick:m,disabled:!h,children:[c?o.jsx(lr,{className:"icon spin"}):null,c?"连接中…":"连接并添加"]})]})]})})}const pkt=[{id:"case-1",itemKey:"case-1",kind:"good",input:"总结本周客户反馈,并按优先级归类。",output:"覆盖主要问题,给出清晰的优先级与下一步动作。",referenceOutput:"覆盖主要问题,给出清晰的优先级与下一步动作。",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T09:12:00+08:00",evaluationSetId:"",evaluationSetName:"示例 good case",workspaceId:"",tag:"总结",source:"auto",score:.92,reason:"任务完整覆盖了用户目标,输出结构清晰,并给出了可执行的下一步动作。"},{id:"case-2",itemKey:"case-2",kind:"good",input:"查询最新公开资料并附上来源。",output:"调用搜索工具,结论与引用一一对应。",referenceOutput:"调用搜索工具,结论与引用一一对应。",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T08:47:00+08:00",evaluationSetId:"",evaluationSetName:"示例 good case",workspaceId:"",tag:"工具调用",source:"user"},{id:"case-3",itemKey:"case-3",kind:"bad",input:"在信息不足时直接给出确定结论。",output:"应明确说明未知,并主动询问缺失信息。",referenceOutput:"",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T07:35:00+08:00",evaluationSetId:"",evaluationSetName:"示例 bad case",workspaceId:"",tag:"幻觉",source:"auto",score:.28,reason:"信息不足时仍给出了确定结论,缺少必要的澄清步骤与不确定性说明。"},{id:"case-4",itemKey:"case-4",kind:"bad",input:"连续重复调用相同工具获取同一结果。",output:"复用已有结果,避免无意义的重复调用。",referenceOutput:"",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T06:58:00+08:00",evaluationSetId:"",evaluationSetName:"示例 bad case",workspaceId:"",tag:"效率",source:"user"}],mkt=[{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"}]}],hJ=[{id:"basic",label:"基本信息"},{id:"usage",label:"用量统计"},{id:"evaluations",label:"评测集"},{id:"optimizations",label:"优化项"},{id:"integrations",label:"接入方法"},{id:"versions",label:"版本"}],gkt=20,bkt=new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1});function ykt(e){const t=Date.parse(e);return Number.isNaN(t)?"暂未提供":bkt.format(t)}const vx=[{id:"api-server",label:"API Server"},{id:"a2a",label:"A2A"}];function IP(e,t){return e?`${e.replace(/\/+$/,"")}${t}`:""}function Okt(e,t){const n=e.trim();if(!n||!t)return n;try{const r=new URL(n),i=r.hostname.replace(/^\[|\]$/g,"").toLowerCase();if(!["localhost","127.0.0.1","::1"].includes(i))return n;const s=new URL(t);return r.protocol=s.protocol,r.hostname=s.hostname,r.port=s.port,r.toString()}catch{return n}}function pJ(e){return e==="key_auth"?"API Key":e==="custom_jwt"?"OAuth / JWT":e==="none"?"无需鉴权":"暂无"}function mJ(e){return e==="published"?"已发布":e==="publishing"?"发布中":e==="failed"?"发布失败":e==="pending"?"等待发布":"未知"}function xkt(e){return e.changeType==="rollback"?"回退事件":e.version}function B6(e){return JSON.stringify(e)}function gve(e){return e==="key_auth"?`API_KEY = "" +`,4);return n>=0?t.slice(n+5).trimStart():e}function uve(e){const t=(e||"").trim();return!t||[">",">-","|","|-"].includes(t)?"暂无描述":t}function JEt(){return o.jsx("svg",{className:"icon",viewBox:"0 0 24 24",fill:"none","aria-hidden":!0,children:o.jsx("path",{d:"m7.5 7.5 9 9m0-9-9 9",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function ekt(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M12 5.5v13M5.5 12h13",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round"})})}function lJ({direction:e}){return o.jsx("svg",{className:"icon",viewBox:"0 0 20 20",fill:"none","aria-hidden":!0,children:o.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 tkt(){return o.jsx("span",{className:"skillcenter-loading-mark","aria-hidden":!0})}function nkt({page:e,total:t,pageSize:n,onPage:r}){const i=Math.max(1,Math.ceil(t/n));return o.jsxs("footer",{className:"skillcenter-pager",children:[o.jsxs("span",{children:["共 ",t," 项"]}),o.jsxs("div",{className:"skillcenter-pager-actions",children:[o.jsx("button",{type:"button",onClick:()=>r(e-1),disabled:e<=1,"aria-label":"上一页",children:o.jsx(lJ,{direction:"left"})}),o.jsxs("span",{children:[e," / ",i]}),o.jsx("button",{type:"button",onClick:()=>r(e+1),disabled:e>=i,"aria-label":"下一页",children:o.jsx(lJ,{direction:"right"})})]})]})}function rkt({children:e}){return o.jsx("div",{className:"skillcenter-empty",children:e})}function RP({kind:e,title:t,description:n,error:r,action:i}){return o.jsx("div",{className:`skillcenter-page-state is-${e}`,role:e==="error"?"alert":"status",children:o.jsxs(yn,{fill:"none",children:[o.jsx(yn.Title,{children:t}),n?o.jsx(yn.Description,{children:n}):null,r?o.jsx(Fo,{error:r}):null,i?o.jsx(yn.ActionRow,{children:o.jsx(It,{color:"secondary",size:"lg",onClick:i.onClick,children:i.label})}):null]})})}function cJ({errors:e,cloudProvider:t,fullPage:n=!1,onRetry:r}){return o.jsxs("div",{className:`skillcenter-space-errors${n?" is-full-page":""}`,role:"alert",children:[o.jsxs("div",{className:"skillcenter-space-errors__content",children:[o.jsx("strong",{children:n?"无法加载技能空间":"部分技能空间加载失败"}),e.map(({region:i,error:s})=>o.jsxs("section",{children:[o.jsx("span",{children:Zf(i,t)}),o.jsx(Fo,{error:s})]},i))]}),o.jsx("button",{type:"button",onClick:r,children:"重新加载"})]})}function ikt({skill:e,space:t,region:n,cloudProvider:r,detail:i,files:s,loading:a,error:l,canOptimize:c,onOptimize:u,onDownload:d,onClose:f}){return p.useEffect(()=>{const h=m=>{m.key==="Escape"&&f()};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[f]),o.jsx("div",{className:"skill-detail-backdrop",role:"presentation",onMouseDown:f,children:o.jsxs("section",{className:"skill-detail-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"skill-detail-title",onMouseDown:h=>h.stopPropagation(),children:[o.jsxs("header",{className:"skill-detail-head",children:[o.jsx("div",{className:"skill-detail-heading",children:o.jsxs("div",{children:[o.jsx("h2",{id:"skill-detail-title",children:(i==null?void 0:i.name)||e.skillName}),o.jsx("p",{children:uve((i==null?void 0:i.description)||e.skillDescription)})]})}),o.jsxs("div",{className:"skill-detail-actions",children:[o.jsx("button",{type:"button",onClick:d,disabled:s.length===0,children:"下载 ZIP"}),o.jsx(VA,{disabled:!c,placement:"bottom",children:o.jsx("button",{type:"button",onClick:u,disabled:!c,children:"优化"})}),o.jsx("button",{type:"button",className:"skill-detail-close",onClick:f,"aria-label":"关闭技能详情",children:o.jsx(JEt,{})})]})]}),o.jsxs("dl",{className:"skill-detail-meta",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"技能 ID"}),o.jsx("dd",{title:e.skillId,children:e.skillId})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"版本"}),o.jsx("dd",{children:(i==null?void 0:i.version)||e.version||"—"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"状态"}),o.jsx("dd",{children:cve(e.skillStatus)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"技能空间"}),o.jsx("dd",{title:t.name,children:t.name})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"地域"}),o.jsx("dd",{children:Zf(n,r)})]})]}),o.jsxs("div",{className:"skill-detail-content skill-detail-content--files",children:[o.jsx("div",{className:"skill-detail-content-title",children:"完整文件"}),a?o.jsxs("div",{className:"skillcenter-loading",children:[o.jsx(tkt,{}),"正在读取技能内容…"]}):l?o.jsx("div",{className:"skillcenter-error",children:o.jsx(Fo,{error:l})}):s.length>0?o.jsx(sve,{files:s.map(h=>h.path.endsWith("SKILL.md")&&h.content?{...h,content:KEt(h.content)}:h)}):o.jsx(rkt,{children:"该技能暂无 SKILL.md 内容"})]})]})})}function skt({space:e,canUseSandbox:t,onUpload:n,onSandbox:r,onClose:i}){return p.useEffect(()=>{const s=a=>{a.key==="Escape"&&i()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[i]),o.jsx("div",{className:"skill-dialog-backdrop",role:"presentation",onMouseDown:i,children:o.jsxs("section",{className:"skill-dialog skill-add-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"skill-add-dialog-title",onMouseDown:s=>s.stopPropagation(),children:[o.jsxs("header",{children:[o.jsxs("div",{children:[o.jsx("h2",{id:"skill-add-dialog-title",children:"添加技能"}),o.jsx("p",{title:e.name,children:e.name})]}),o.jsx("button",{type:"button",onClick:i,children:"取消"})]}),o.jsxs("div",{className:"skill-add-dialog__options",children:[o.jsxs("button",{type:"button",onClick:n,children:[o.jsx("strong",{children:"本地上传"}),o.jsx("span",{children:"选择 ZIP 文件,校验通过后上传到技能空间"})]}),o.jsx(VA,{disabled:!t,placement:"inside",children:o.jsxs("button",{type:"button",disabled:!t,onClick:r,children:[o.jsx("strong",{children:"自动创建"}),o.jsx("span",{children:"选择模型和风格,通过对话生成技能"})]})})]})]})})}function akt({cloudProvider:e="volcengine",region:t,active:n=!0,activationRevision:r=0,initialWorkspace:i=null,onInitialWorkspaceConsumed:s,onPageTitleChange:a,toolbarLeading:l,toolbarFilters:c}){var Rt;const u=p.useMemo(()=>[t],[t]),[d,f]=p.useState([]),[h,m]=p.useState({}),[g,b]=p.useState(!1),[y,O]=p.useState(""),[v,x]=p.useState((i==null?void 0:i.space)??null),[w,S]=p.useState([]),[E,k]=p.useState(1),[_,T]=p.useState(0),[C,A]=p.useState(!1),[j,M]=p.useState(null),[I,$]=p.useState(""),[N,D]=p.useState("overview"),[Q,F]=p.useState(null),[L,H]=p.useState(null),[z,B]=p.useState([]),[V,W]=p.useState(!1),[le,be]=p.useState(null),[re,q]=p.useState(null),[G,J]=p.useState(!1),[de,ve]=p.useState(null),[Pe,Ae]=p.useState(null),[Ue,Ke]=p.useState(null),[Ce,Le]=p.useState(0),[pe,me]=p.useState(0),[we,Ee]=p.useState(""),[st,$e]=p.useState(""),[ie,ce]=p.useState(null),[Ie,We]=p.useState(i),K=p.useRef(0),_e=p.useRef(0),Be=p.useRef(!1),He=p.useRef(null),Ye=p.useRef(null),ot=p.useRef(null),Tt=p.useDeferredValue(y),Ft=p.useDeferredValue(I),Ge=(Ie&&(v||Ie.selectPublishSpace)?Ie.operation==="create"?"创建技能":`优化 ${((Rt=Ie.source)==null?void 0:Rt.name)||"技能"}`:"")||(v==null?void 0:v.name)||"技能库";p.useEffect(()=>{n&&(a==null||a(Ge))},[n,a,Ge]),p.useEffect(()=>{i&&(s==null||s())},[i,s]);const Je=p.useMemo(()=>{const Te=Tt.trim().toLocaleLowerCase();return Te?d.filter(bt=>`${bt.name} ${bt.description||""} ${bt.projectName||""}`.toLocaleLowerCase().includes(Te)):d},[Tt,d]),it=p.useMemo(()=>{const Te=Ft.trim().toLocaleLowerCase();return Te?w.filter(bt=>`${bt.skillName} ${bt.skillDescription||""}`.toLocaleLowerCase().includes(Te)):w},[Ft,w]),Et=(v==null?void 0:v.region)||Yr(e),Ve=p.useMemo(()=>u.flatMap(Te=>{var Vt;const bt=(Vt=h[Te])==null?void 0:Vt.error;return bt?[{region:Te,error:bt}]:[]}),[h,u]),ye=u.some(Te=>{const bt=h[Te];return!!(bt&&!bt.done&&!bt.error)}),Qe=Ve.length===u.length;p.useEffect(()=>{const Te=new AbortController;return Mj(Te.signal).then(q).catch(()=>q({enabled:!1,reason:"管理员未配置",operations:["create","optimize"],models:[],styles:{}})),()=>Te.abort()},[]);const rt=p.useCallback(async(Te,bt)=>{var qe;if(Be.current||Te.length===0)return;Be.current=!0,b(!0),bt&&((qe=He.current)==null||qe.abort(),f([]),m(Object.fromEntries(Te.map(({region:et})=>[et,{nextPage:1,loadedCount:0,done:!1,error:null}]))));const Vt=new AbortController;He.current=Vt;const lt=++_e.current,sn=await Promise.allSettled(Te.map(async({region:et,page:Yt})=>({region:et,page:Yt,result:await Jlt({region:et,page:Yt,pageSize:XEt,signal:Vt.signal})})));if(_e.current!==lt)return;const yr=sn.map((et,Yt)=>{const en=Te[Yt];return et.status==="rejected"?{request:en,error:la(et.reason,"读取技能空间失败,请稍后重试"),items:[],totalCount:0}:{request:en,error:null,items:(et.value.result.items||[]).map(dr=>({...dr,region:dr.region||et.value.region})),totalCount:et.value.result.totalCount||0}}),ur=yr.flatMap(et=>et.items);m(et=>{const Yt={...et};return yr.forEach(({request:en,error:dr,items:Cr,totalCount:Rn})=>{const Yn=Yt[en.region]||{nextPage:en.page,loadedCount:0,done:!1,error:null};if(dr){Yt[en.region]={...Yn,error:dr};return}const Lr=Yn.loadedCount+Cr.length;Yt[en.region]={nextPage:en.page+1,loadedCount:Lr,done:Cr.length===0||Lr>=Rn,error:null}}),Yt}),f(et=>ZEt(bt?[]:et,ur)),x(et=>et&&(ur.find(Yt=>Ol(Yt)===Ol(et))||et)),Be.current=!1,b(!1)},[]),Se=p.useCallback(()=>{if(Be.current)return;const Te=u.flatMap(bt=>{const Vt=h[bt];return Vt&&!Vt.done&&!Vt.error?[{region:bt,page:Vt.nextPage}]:[]});rt(Te,!1)},[rt,h,u]);p.useEffect(()=>{Nt(),x(null),S([]),k(1)},[e]),p.useEffect(()=>{if(n)return rt(u.map(Te=>({region:Te,page:1})),!0),()=>{var Te;_e.current+=1,(Te=He.current)==null||Te.abort(),Be.current=!1}},[n,r,rt,u,Ce]),p.useEffect(()=>{const Te=ot.current,bt=Ye.current;if(!Te||!bt||!ye||g)return;const Vt=new IntersectionObserver(([lt])=>{lt.isIntersecting&&Se()},{root:bt,rootMargin:"240px 0px",threshold:.01});return Vt.observe(Te),()=>Vt.disconnect()},[ye,Se,g]);const ze=()=>{const Te=Ye.current;!Te||!ye||g||Te.scrollHeight-Te.scrollTop-Te.clientHeight<=240&&Se()};p.useEffect(()=>{if(!v){S([]),T(0);return}let Te=!0;return A(!0),M(null),lct(v.id,{region:Et,page:E,pageSize:aJ,project:v.projectName}).then(bt=>{Te&&(S(bt.items||[]),T(bt.totalCount||0))}).catch(bt=>{Te&&(S([]),T(0),M(la(bt,"读取技能失败,请稍后重试")))}).finally(()=>{Te&&A(!1)}),()=>{Te=!1}},[Et,v,E,pe]);const ht=Te=>{Nt(),x(Te),D("overview"),k(1),$("")},_t=()=>{Nt(),x(null),S([]),T(0),D("overview"),k(1),$(""),ce(null)},Nt=()=>{K.current+=1,F(null),H(null),B([]),be(null),W(!1)},rn=async Te=>{if(!v)return;const bt=K.current+1;K.current=bt,F(Te),H(null),be(null),W(!0);try{const[Vt,lt]=await Promise.all([cct(v.id,Te.skillId,Te.version,Et,v.projectName,Te.skillName,v.name),act({spaceId:v.id,skillId:Te.skillId,version:Te.version,region:Et,skillSpaceName:v.name,skillName:Te.skillName})]);K.current===bt&&(H(Vt),B(lt))}catch(Vt){K.current===bt&&be(la(Vt,"读取技能详情失败,请稍后重试"))}finally{K.current===bt&&W(!1)}},an=Te=>{if(v)return{kind:"skill-center",skillId:Te.skillId,version:Te.version,region:Et,projectName:v.projectName,skillSpaceId:v.id,skillSpaceName:v.name,name:Te.skillName,description:Te.skillDescription}},oe=Te=>{const bt=an(Te);!bt||!(re!=null&&re.enabled)||(Nt(),We({operation:"optimize",source:bt}))},Zt=async Te=>{if(!(!v||!window.confirm(`确定删除整个 Skill“${Te.skillName}”吗?此操作会影响所有引用它的空间。`))){Ee(Te.skillId),ce(null);try{await sct({spaceId:v.id,skillId:Te.skillId,region:Et}),me(bt=>bt+1),Le(bt=>bt+1)}catch(bt){ce(la(bt,"删除 Skill 失败"))}finally{Ee("")}}},Fe=async Te=>{if(!window.confirm(`确定删除 Skill 空间“${Te.name}”吗?请先确认空间中的技能已删除。`))return;const bt=Ol(Te);$e(bt),ce(null);try{await nct({spaceId:Te.id,region:Te.region||Yr(e)}),v&&Ol(v)===bt&&_t(),Le(Vt=>Vt+1)}catch(Vt){ce(la(Vt,"删除 Skill 空间失败"))}finally{$e("")}};return Ie&&(v||Ie.selectPublishSpace)?o.jsx(FEt,{operation:Ie.operation,cloudProvider:e,space:v??void 0,availableSpaces:d,spacesLoading:g,initialIntent:Ie.initialIntent,source:Ie.source,onBack:()=>We(null),onPublished:()=>{me(Te=>Te+1),Le(Te=>Te+1)}}):o.jsxs("section",{className:`skillcenter${v?" is-space":" resource-collection"}`,children:[v?o.jsx(mE,{className:"skillcenter-detail",title:v.name,description:v.description||"管理空间中的技能并创建新的版本",identitySeed:v.name,backLabel:"返回技能空间列表",onBack:_t,sections:[{key:"overview",label:"概览",content:o.jsxs(o.Fragment,{children:[ie?o.jsx("div",{className:"skillcenter-inline-error",role:"alert",children:o.jsx(Fo,{error:ie})}):null,o.jsx("section",{className:"skillcenter-overview",children:o.jsxs(G7,{className:"skillcenter-detail-facts",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"技能数量"}),o.jsx("dd",{children:_})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"更新时间"}),o.jsx("dd",{children:v.updatedAt?YEt(v.updatedAt):"—"})]})]})})]})},{key:"skills",label:"技能",content:o.jsxs(o.Fragment,{children:[ie?o.jsx("div",{className:"skillcenter-inline-error",role:"alert",children:o.jsx(Fo,{error:ie})}):null,o.jsxs("section",{className:"skillcenter-results","aria-label":`${v.name}中的技能`,children:[o.jsx(Qhe,{title:"技能",description:`共 ${_} 项`,actions:o.jsx(Gp,{"aria-label":"搜索技能",value:I,onChange:Te=>$(Te.target.value),placeholder:"搜索技能"})}),C&&w.length===0?o.jsx(Od,{}):j&&w.length===0?o.jsx(RP,{kind:"error",title:"无法加载技能",error:j,action:{label:"重新加载",onClick:()=>me(Te=>Te+1)}}):it.length===0?o.jsx(RP,{kind:"empty",title:I.trim()?"没有匹配的技能":"暂无技能",description:I.trim()?"请尝试搜索其他名称":"本地上传 Skill,或自动创建",action:I.trim()?void 0:{label:"本地上传",onClick:()=>Ke(v)}}):o.jsx("div",{className:"skillcenter-table-wrap",children:o.jsxs("table",{className:"skillcenter-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{scope:"col",children:"技能"}),o.jsx("th",{scope:"col",children:"状态"}),o.jsx("th",{scope:"col",className:"skillcenter-table__actions-heading",children:"操作"})]})}),o.jsx("tbody",{children:it.map(Te=>o.jsxs("tr",{children:[o.jsx("td",{className:"skillcenter-table__skill",children:o.jsxs("button",{type:"button",onClick:()=>void rn(Te),children:[o.jsxs("span",{className:"skillcenter-table__title-row",children:[o.jsx("strong",{title:Te.skillName,children:Te.skillName}),Te.version?o.jsx("span",{className:"skillcenter-table__version-badge",children:Te.version}):null]}),o.jsx("span",{className:"skillcenter-table__description",children:uve(Te.skillDescription)})]})}),o.jsx("td",{children:o.jsx("span",{className:`skillcenter-status ${WEt(Te.skillStatus)}`,children:cve(Te.skillStatus)})}),o.jsx("td",{children:o.jsxs("div",{className:"skillcenter-table__actions",children:[o.jsx("button",{type:"button",onClick:()=>void rn(Te),children:"查看"}),o.jsx(VA,{disabled:!(re!=null&&re.enabled),children:o.jsx("button",{type:"button",disabled:!(re!=null&&re.enabled),onClick:()=>oe(Te),children:"优化"})}),o.jsx("button",{type:"button",className:"is-danger",disabled:we===Te.skillId,onClick:()=>void Zt(Te),children:we===Te.skillId?"删除中…":"删除"})]})})]},`${Te.skillId}:${Te.version}`))})]})}),!I.trim()&&!C&&!j&&_>0?o.jsx(nkt,{page:E,total:_,pageSize:aJ,onPage:k}):null]})]})}],activeSectionKey:N,navigationLabel:"技能空间详情",onSectionChange:Te=>D(Te),actionsClassName:"skillcenter-toolbar-actions",actions:o.jsxs(o.Fragment,{children:[o.jsx(It,{type:"button",color:"secondary",variant:"outline",size:"lg",pill:!1,onClick:()=>ve(v),children:"编辑空间"}),o.jsx(It,{type:"button",color:"danger",variant:"soft",size:"lg",pill:!1,disabled:st===Ol(v),onClick:()=>void Fe(v),children:st===Ol(v)?"删除中…":"删除空间"}),o.jsx(It,{type:"button",color:"secondary",variant:"outline",size:"lg",pill:!1,onClick:()=>Ke(v),children:"本地上传"}),o.jsx(VA,{disabled:!(re!=null&&re.enabled),children:o.jsxs(It,{type:"button",color:"primary",size:"lg",pill:!1,disabled:!(re!=null&&re.enabled),onClick:()=>We({operation:"create"}),children:[o.jsx(Cae,{"aria-hidden":"true"}),o.jsx("span",{children:"创建技能"})]})})]})}):o.jsxs(o.Fragment,{children:[o.jsxs(g0,{className:"skillcenter-list-toolbar library-resource-toolbar",children:[l,o.jsxs("div",{className:"resource-toolbar__actions",children:[c,o.jsx(Gp,{"aria-label":"搜索技能空间",value:y,onChange:Te=>O(Te.target.value),placeholder:"搜索技能空间"})]})]}),ie?o.jsx("div",{className:"skillcenter-inline-error",role:"alert",children:o.jsx(Fo,{error:ie})}):null,o.jsxs(b0,{className:"skillcenter-list-results",ref:Ye,"aria-label":"技能空间列表",onScroll:ze,children:[Ve.length>0&&!Qe?o.jsx(cJ,{errors:Ve,cloudProvider:e,onRetry:()=>Le(Te=>Te+1)}):null,g&&d.length===0?o.jsx(Od,{}):Qe&&d.length===0?o.jsx(cJ,{errors:Ve,cloudProvider:e,fullPage:!0,onRetry:()=>Le(Te=>Te+1)}):Je.length===0&&y.trim()?o.jsx(RP,{kind:"empty",title:"没有匹配的技能空间",description:"请尝试搜索其他名称"}):o.jsxs(aO,{children:[y.trim()?null:o.jsx(Vg,{"aria-label":"新建技能空间",icon:o.jsx(ekt,{}),onClick:()=>J(!0),children:"新建空间"}),Je.map(Te=>{const bt=Ol(Te);return o.jsx(OE,{className:"skillcenter-space-card",title:Te.name,description:Te.description||"暂无描述",metadata:[{label:"技能数量",value:`${Te.skillCount??0} 技能`},{label:"更新时间",value:lve(Te.updatedAt)}],action:{label:"添加技能",icon:"plus",onClick:()=>Ae(Te)},detailAction:{label:"查看详情",onClick:()=>ht(Te)}},bt)})]}),!Qe&&d.length>0?o.jsx("div",{className:"my-agent-load-more",ref:ot,"aria-live":"polite",children:g?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载更多技能空间"})]}):ye?o.jsx("span",{children:"继续下滑加载更多"}):Ve.length>0?o.jsx("span",{children:"部分技能空间加载失败"}):o.jsx("span",{children:"已加载全部技能空间"})}):null]})]}),Q&&v&&o.jsx(ikt,{skill:Q,space:v,region:Et,cloudProvider:e,detail:L,files:z,loading:V,error:le,canOptimize:(re==null?void 0:re.enabled)===!0,onOptimize:()=>oe(Q),onDownload:()=>void oct({spaceId:v.id,skillId:Q.skillId,version:Q.version,region:Et,fallbackName:Q.skillName,skillSpaceName:v.name,skillName:Q.skillName}).catch(Te=>be(la(Te,"下载 Skill 失败"))),onClose:Nt}),G?o.jsx(zEt,{region:t,regionOptions:kd(e),onClose:()=>J(!1),onCreated:Te=>{J(!1),Le(bt=>bt+1),x({...Te,region:Te.region||t})}}):null,de?o.jsx(VEt,{space:de,region:de.region||Yr(e),onClose:()=>ve(null),onUpdated:Te=>{const bt={...Te,region:Te.region||de.region||Yr(e)};ve(null),x(Vt=>Vt&&Ol(Vt)===Ol(bt)?bt:Vt),f(Vt=>Vt.map(lt=>Ol(lt)===Ol(bt)?bt:lt)),Le(Vt=>Vt+1)}}):null,Pe?o.jsx(skt,{space:Pe,canUseSandbox:(re==null?void 0:re.enabled)===!0,onClose:()=>Ae(null),onUpload:()=>{Ke(Pe),Ae(null)},onSandbox:()=>{const Te=Pe;Ae(null),ht(Te),We({operation:"create"})}}):null,Ue?o.jsx(HEt,{space:Ue,region:Ue.region||Yr(e),onClose:()=>Ke(null),onUploaded:()=>{Ke(null),me(Te=>Te+1),Le(Te=>Te+1)}}):null]})}const uJ=[{id:"skills",label:"技能库",panelId:"library-skills-panel"},{id:"knowledge",label:"知识库",panelId:"library-knowledge-panel"},{id:"artifacts",label:"产物",panelId:"library-artifacts-panel"}];function okt({cloudProvider:e,studioRegion:t="",activeTab:n,onTabChange:r,onPageTitleChange:i,skillInitialWorkspace:s=null,onSkillInitialWorkspaceConsumed:a,artifactSources:l=[],artifactUserId:c="",onArtifactActivate:u,onArtifactSourceOpen:d}){const f=XS(t)?t:Yr(e),[h,m]=p.useState(f),[g,b]=p.useState("技能库"),[y,O]=p.useState(!1),[v,x]=p.useState(()=>new Set(["skills",n])),[w,S]=p.useState({skills:0,knowledge:0,artifacts:0}),E=p.useRef(u),[k,_]=p.useState([]),[T,C]=p.useState(!1),[A,j]=p.useState(""),M=p.useMemo(()=>{const z=xGe(l);return{key:JSON.stringify(z),candidates:z}},[l]),I=p.useRef(M);I.current.key!==M.key&&(I.current=M);const $=I.current.candidates,N=p.useMemo(()=>kd(e),[e]);p.useEffect(()=>{m(f)},[f]),p.useEffect(()=>{E.current=u},[u]),p.useEffect(()=>{x(z=>{if(z.has(n))return z;const B=new Set(z);return B.add(n),B})},[n]),p.useEffect(()=>{var B;const z=n==="skills"?g:((B=uJ.find(V=>V.id===n))==null?void 0:B.label)||"资源库";i==null||i(z)},[n,i,g]),p.useEffect(()=>{var z;n==="artifacts"&&((z=E.current)==null||z.call(E))},[n,w.artifacts]);const D=p.useCallback(async()=>{C(!0),j("");try{_(await NGe($))}catch(z){j(z instanceof Error?z.message:String(z))}finally{C(!1)}},[$]);p.useEffect(()=>{n==="artifacts"&&D()},[n,w.artifacts,D]);const Q=z=>{x(B=>{if(B.has(z))return B;const V=new Set(B);return V.add(z),V}),S(B=>({...B,[z]:B[z]+1})),r(z)},F=o.jsx(gE,{idPrefix:"library",ariaLabel:"资源库分类",value:n,items:uJ,onChange:Q}),L=z=>o.jsx(HC,{id:z,ariaLabel:"区域",value:h,options:N,onChange:m}),H=n==="skills"?g!=="技能库":n==="knowledge"&&y;return o.jsxs(ih,{className:`library-view${H?" is-detail":""}`,"aria-label":"资源库",children:[H?null:o.jsx(sO,{className:"library-view__header",title:"资源库"}),o.jsxs("div",{className:"library-panels",children:[v.has("skills")?o.jsx("div",{id:"library-skills-panel",className:"library-panel",role:"tabpanel","aria-labelledby":"library-skills-tab",hidden:n!=="skills",children:o.jsx(akt,{cloudProvider:e,region:h,active:n==="skills",activationRevision:w.skills,onPageTitleChange:b,initialWorkspace:s,onInitialWorkspaceConsumed:a,toolbarLeading:F,toolbarFilters:L("library-skills-region-filter")})}):null,v.has("knowledge")?o.jsx("div",{id:"library-knowledge-panel",className:"library-panel",role:"tabpanel","aria-labelledby":"library-knowledge-tab",hidden:n!=="knowledge",children:o.jsx(Ult,{cloudProvider:e,region:h,active:n==="knowledge",activationRevision:w.knowledge,onDetailChange:O,toolbarLeading:F,toolbarFilters:L("library-knowledge-region-filter")})}):null,v.has("artifacts")?o.jsx("div",{id:"library-artifacts-panel",className:"library-panel",role:"tabpanel","aria-labelledby":"library-artifacts-tab",hidden:n!=="artifacts",children:o.jsx(TGe,{items:k,region:h,userId:c,active:n==="artifacts",activationRevision:w.artifacts,loading:T,error:A,onRetry:()=>void D(),onEdit:jGe,onDelete:RGe,onDownload:IGe,onOpenSource:d?z=>d(z.appName,z.sessionId):void 0,toolbarLeading:F,toolbarFilters:L("library-artifacts-region-filter")})}):null]})]})}const dve="veadk_agentkit_connections",lkt=3e3,dJ=6e4;function lu(){try{const e=localStorage.getItem(dve);return(e?JSON.parse(e):[]).filter(n=>!n.runtimeId||!!n.region)}catch{return[]}}function gR(e){try{localStorage.setItem(dve,JSON.stringify(e))}catch{}}function Ou(e,t){return`agentkit:${e}:${t}`}function fve(e){try{return new URL(e).host}catch{return e}}function SO(e){Xae();for(const t of e)if(!(t.runtimeId&&!t.region))for(const n of t.apps)qae(Ou(t.id,n),t.runtimeId?{app:n,runtimeId:t.runtimeId,region:t.region}:{app:n,base:t.base,apiKey:t.apiKey})}function hve(e,t,n,r,i,s){const a={id:`rt_${e}`,name:t||e,runtimeId:e,region:n,apps:r,appLabels:i,currentVersion:s},l=lu(),c=l.findIndex(u=>u.runtimeId===e);return c===-1?l.push(a):l[c]=a,gR(l),SO(l),a}async function ckt(e,t,n,r,i){let s=null,a=n||"cn-beijing",l=null;for(const f of GS(n))try{const h=await Jy(e,f,{retryProbe:!0,preferCached:!0,currentVersion:r});if(h&&h.length>0){await lle(e,f),s=h,a=f;break}}catch(h){if(h instanceof F1)throw HA(e),h;if(h instanceof Es&&h.unsupported){l=h;continue}throw h}if(!s||s.length===0)throw HA(e),l||new Es("该 Runtime 暂不支持连接,请确认服务已正常运行。",!0,!0);const c=(i==null?void 0:i.trim())||s[0],u=Object.fromEntries(s.map(f=>[f,f===s[0]?c:f])),d=hve(e,t,a,s,u,r);return Ou(d.id,s[0])}function ukt(e){return new Promise(t=>window.setTimeout(t,e))}async function AT(e,t,n,r,i={}){const s=Date.now();for(;;)try{return await ckt(e,t,n,r,i.agentName)}catch(a){const l=Date.now()-s;if(!i.waitForReady||!(a instanceof Es)||!a.retryable||l>=dJ)throw a;const c=Math.min(lkt,dJ-l);await ukt(c)}}async function pve(e,t,n,r){const i=t.trim().replace(/\/+$/,""),s=await WS(i,n.trim()),a={id:Date.now().toString(36),name:e.trim()||fve(i),base:i,apiKey:n.trim(),apps:s,appLabels:r&&s.length>0?{[s[0]]:r}:void 0},l=[...lu().filter(c=>c.base!==i),a];return gR(l),SO(l),a}function dkt(e){const t=lu().filter(n=>n.id!==e);return gR(t),SO(t),t}function HA(e){const t=lu().filter(n=>n.runtimeId!==e);return gR(t),SO(t),t}function mve(e,t){const n=e.map(i=>({id:i,label:i,app:i,remote:!1})),r=t.flatMap(i=>i.apps.map(s=>{var l;const a=((l=i.appLabels)==null?void 0:l[s])??s;return{id:Ou(i.id,s),label:a,app:s,remote:!0,host:i.runtimeId?i.name:fve(i.base??""),runtimeId:i.runtimeId,region:i.region,currentVersion:i.currentVersion}}));return[...n,...r]}const fJ=Object.freeze(Object.defineProperty({__proto__:null,addConnection:pve,addRuntimeConnection:hve,buildAgentEntries:mve,connectRuntime:AT,loadConnections:lu,registerConnections:SO,remoteAppId:Ou,removeConnection:dkt,removeRuntimeConnection:HA},Symbol.toStringTag,{value:"Module"}));function fkt({onAdded:e,onCancel:t}){const[n,r]=p.useState(""),[i,s]=p.useState(""),[a,l]=p.useState(""),[c,u]=p.useState(!1),[d,f]=p.useState(""),h=n.trim().length>0&&i.trim().length>0&&!c;async function m(){if(h){u(!0),f("");try{const g=await pve(a,n,i,a);if(g.apps.length===0){f("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。"),u(!1);return}e(Ou(g.id,g.apps[0]))}catch(g){f(`连接失败:${String(g)}。请检查 URL、API Key,以及该网关是否允许跨域。`),u(!1)}}}return o.jsx("div",{className:"addagent",children:o.jsxs("div",{className:"addagent-card",children:[o.jsx("h2",{className:"addagent-title",children:"添加 AgentKit 智能体"}),o.jsx("p",{className:"addagent-sub",children:"填入 AgentKit 部署的访问地址与 API Key,将通过 ADK 协议连接,连接成功后其 Agent 会出现在左上角的下拉中。"}),o.jsxs("label",{className:"addagent-field",children:[o.jsx("span",{className:"addagent-label",children:"访问地址 URL"}),o.jsx("input",{className:"addagent-input",value:n,onChange:g=>r(g.target.value),placeholder:"https://xxxxx.apigateway-cn-beijing.volceapi.com",autoFocus:!0})]}),o.jsxs("label",{className:"addagent-field",children:[o.jsx("span",{className:"addagent-label",children:"API Key"}),o.jsx("input",{className:"addagent-input",type:"password",value:i,onChange:g=>s(g.target.value),placeholder:"以 Authorization: Bearer 方式连接"})]}),o.jsxs("label",{className:"addagent-field",children:[o.jsx("span",{className:"addagent-label",children:"显示名称(可选)"}),o.jsx("input",{className:"addagent-input",value:a,onChange:g=>l(g.target.value),placeholder:"默认取 URL 的主机名"})]}),d&&o.jsx("div",{className:"addagent-error",children:d}),o.jsxs("div",{className:"addagent-actions",children:[o.jsx("button",{className:"addagent-btn addagent-btn--ghost",onClick:t,disabled:c,children:"取消"}),o.jsxs("button",{className:"addagent-btn addagent-btn--primary",onClick:m,disabled:!h,children:[c?o.jsx(or,{className:"icon spin"}):null,c?"连接中…":"连接并添加"]})]})]})})}const hkt=[{id:"case-1",itemKey:"case-1",kind:"good",input:"总结本周客户反馈,并按优先级归类。",output:"覆盖主要问题,给出清晰的优先级与下一步动作。",referenceOutput:"覆盖主要问题,给出清晰的优先级与下一步动作。",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T09:12:00+08:00",evaluationSetId:"",evaluationSetName:"示例 good case",workspaceId:"",tag:"总结",source:"auto",score:.92,reason:"任务完整覆盖了用户目标,输出结构清晰,并给出了可执行的下一步动作。"},{id:"case-2",itemKey:"case-2",kind:"good",input:"查询最新公开资料并附上来源。",output:"调用搜索工具,结论与引用一一对应。",referenceOutput:"调用搜索工具,结论与引用一一对应。",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T08:47:00+08:00",evaluationSetId:"",evaluationSetName:"示例 good case",workspaceId:"",tag:"工具调用",source:"user"},{id:"case-3",itemKey:"case-3",kind:"bad",input:"在信息不足时直接给出确定结论。",output:"应明确说明未知,并主动询问缺失信息。",referenceOutput:"",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T07:35:00+08:00",evaluationSetId:"",evaluationSetName:"示例 bad case",workspaceId:"",tag:"幻觉",source:"auto",score:.28,reason:"信息不足时仍给出了确定结论,缺少必要的澄清步骤与不确定性说明。"},{id:"case-4",itemKey:"case-4",kind:"bad",input:"连续重复调用相同工具获取同一结果。",output:"复用已有结果,避免无意义的重复调用。",referenceOutput:"",comment:"",agentName:"示例 Agent",sessionId:"",messageId:"",runtimeId:"",invocationId:"",userId:"",createdAt:"2026-08-05T06:58:00+08:00",evaluationSetId:"",evaluationSetName:"示例 bad case",workspaceId:"",tag:"效率",source:"user"}],pkt=[{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"}]}],hJ=[{id:"basic",label:"基本信息"},{id:"usage",label:"用量统计"},{id:"evaluations",label:"评测集"},{id:"optimizations",label:"优化项"},{id:"integrations",label:"接入方法"},{id:"versions",label:"版本"}],mkt=20,gkt=new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1});function bkt(e){const t=Date.parse(e);return Number.isNaN(t)?"暂未提供":gkt.format(t)}const vx=[{id:"api-server",label:"API Server"},{id:"a2a",label:"A2A"}];function IP(e,t){return e?`${e.replace(/\/+$/,"")}${t}`:""}function ykt(e,t){const n=e.trim();if(!n||!t)return n;try{const r=new URL(n),i=r.hostname.replace(/^\[|\]$/g,"").toLowerCase();if(!["localhost","127.0.0.1","::1"].includes(i))return n;const s=new URL(t);return r.protocol=s.protocol,r.hostname=s.hostname,r.port=s.port,r.toString()}catch{return n}}function pJ(e){return e==="key_auth"?"API Key":e==="custom_jwt"?"OAuth / JWT":e==="none"?"无需鉴权":"暂无"}function mJ(e){return e==="published"?"已发布":e==="publishing"?"发布中":e==="failed"?"发布失败":e==="pending"?"等待发布":"未知"}function Okt(e){return e.changeType==="rollback"?"回退事件":e.version}function B6(e){return JSON.stringify(e)}function gve(e){return e==="key_auth"?`API_KEY = "" HEADERS = {"Authorization": f"Bearer {API_KEY}"}`:e==="custom_jwt"?`ACCESS_TOKEN = "" HEADERS = {"Authorization": f"Bearer {ACCESS_TOKEN}"}`:e==="none"?"HEADERS = {}":`AUTH_TOKEN = "" -HEADERS = {"Authorization": f"Bearer {AUTH_TOKEN}"}`}function vkt(e,t,n){const r=e.replace(/\/+$/,"");return`\`\`\`python +HEADERS = {"Authorization": f"Bearer {AUTH_TOKEN}"}`}function xkt(e,t,n){const r=e.replace(/\/+$/,"");return`\`\`\`python import uuid import requests @@ -770,7 +770,7 @@ with requests.post( for line in response.iter_lines(): if line: print(line.decode("utf-8")) -\`\`\``}function wkt(e,t){return`\`\`\`python +\`\`\``}function vkt(e,t){return`\`\`\`python import uuid import requests @@ -797,16 +797,16 @@ response = requests.post( ) response.raise_for_status() print(response.json()) -\`\`\``}function Skt({visible:e}){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M2.8 12s3.3-5.4 9.2-5.4 9.2 5.4 9.2 5.4-3.3 5.4-9.2 5.4S2.8 12 2.8 12Z"}),o.jsx("circle",{cx:"12",cy:"12",r:"2.4"}),!e&&o.jsx("path",{d:"m4.2 4.2 15.6 15.6"})]})}function gJ({available:e,authType:t,value:n,visible:r,loading:i,error:s,onToggle:a}){return e?t==="none"?"无需 API Key":t==="custom_jwt"?"使用 OAuth / JWT":t!=="key_auth"?"暂无":o.jsxs("span",{className:"aw-integration-secret",children:[o.jsx("span",{className:"aw-integration-secret-value","aria-live":"polite",children:r&&n?n:"****"}),o.jsx("button",{type:"button",className:"aw-integration-secret-toggle","aria-label":r?"隐藏 API Key":"显示 API Key",title:r?"隐藏 API Key":"显示 API Key",disabled:i,onClick:a,children:i?o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}):o.jsx(Skt,{visible:r})}),s&&o.jsx("span",{className:"aw-integration-secret-error",role:"alert",children:s})]}):"暂无"}function bJ({protocol:e,title:t,available:n,fields:r,example:i}){return o.jsxs("section",{className:`aw-integration-panel${n&&i?" has-example":""}`,id:`integration-${e}-panel`,role:"tabpanel","aria-labelledby":`integration-${e}-tab`,children:[o.jsx("header",{children:o.jsx("h3",{children:t})}),o.jsx("dl",{children:r.map(s=>o.jsxs("div",{children:[o.jsx("dt",{children:s.label}),o.jsx("dd",{children:s.value||"暂无"})]},s.label))}),n&&i&&o.jsxs("section",{className:"aw-integration-example",children:[o.jsx("h4",{children:"Python 示例"}),o.jsx(xu,{text:i,className:"aw-integration-example-code",allowRawHtml:!1})]})]})}function Ekt(e,t,n){var r;return z7({appName:((r=e==null?void 0:e.appName)==null?void 0:r.trim())||t,name:e==null?void 0:e.name,description:e==null?void 0:e.description,type:e==null?void 0:e.type,model:e==null?void 0:e.model,tools:e==null?void 0:e.tools,skills:e==null?void 0:e.skills,graph:e==null?void 0:e.graph,draft:e==null?void 0:e.draft},n)}function bve(e){return e?1+e.children.reduce((t,n)=>t+bve(n),0):1}function yve(e){return 1+e.subAgents.reduce((t,n)=>t+yve(n),0)}function Q6(e){if(!e)return 0;const t=Number(e);if(Number.isFinite(t))return t<1e12?t*1e3:t;const n=Date.parse(e);return Number.isFinite(n)?n:0}function kkt(e){const t=Q6(e);return t?new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(t)):"时间未知"}function _kt(e){return typeof e.score!="number"||!Number.isFinite(e.score)?"—":`${Math.round(e.score*100)} 分`}function Tkt(e){return e==="high"?"高":e==="medium"?"中":"低"}const Ckt={agent_structure:"Agent 结构",prompt:"提示词",tool:"工具",knowledge:"知识库",memory:"记忆",workflow:"工作流",other:"其他"};function Akt(e){var t;return e.module==="other"?((t=e.customModule)==null?void 0:t.trim())||"其他":Ckt[e.module]}function Nkt(e,t){return e.find(n=>n.kind===t)}function yJ(e){return e.items.map(t=>({...t,tag:t.kind==="good"?"Good case":"Bad case"})).sort((t,n)=>Q6(n.createdAt)-Q6(t.createdAt))}function jkt(e){const t=n=>[n.name,n.description,n.agentType??"llm",n.modelName??"",n.tools??[],n.builtinTools??[],(n.customTools??[]).map(r=>r.name),(n.mcpTools??[]).map(r=>r.name),n.skills??[],(n.selectedSkills??[]).map(r=>r.name),(n.subAgents??[]).map(t)];return JSON.stringify(t(e))}const CT=[{phase:"prepare",label:"准备部署",description:"校验配置并创建部署任务"},{phase:"build",label:"构建镜像",description:"生成运行环境与智能体代码"},{phase:"deploy",label:"部署服务",description:"创建并启动 AgentKit Runtime"},{phase:"publish",label:"发布服务",description:"等待服务就绪并生成访问地址"},{phase:"complete",label:"部署完成",description:"智能体已可以正常使用"}],Rkt={phase:"evaluation",label:"创建评测集",description:"自动创建 Good Case 和 Bad Case 评测集"},Ikt={phase:"github",label:"挂载 GitHub 持续交付",description:"初始化目标分支与 GitHub Actions workflow"};function Dkt(e){return{phase:"update",label:"更新实例配置",description:`将 Runtime 实例数调整为 ${e.min}~${e.max}`}}const Pkt=CT.findIndex(e=>e.phase==="build");function Ove(e){const t=[...CT.slice(0,-1)];return e.instanceRange&&t.push(Dkt(e.instanceRange)),e.createEvaluationSets&&t.push(Rkt),e.githubDelivery&&t.push(Ikt),t.push(CT[CT.length-1]),t}function xve(e){const t=Ove(e);if(e.status==="success")return t.length-1;const n=e.phase??{准备部署:"prepare",构建镜像:"build",部署:"deploy",发布:"publish",创建评测集:"evaluation","挂载 GitHub 持续交付":"github",部署完成:"complete"}[e.label],r=t.findIndex(i=>i.phase===n);return r<0?0:r}function Mkt(e){if(!e)return"";try{return new Intl.DateTimeFormat("zh-CN",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(new Date(e))}catch{return""}}function vve({log:e,autoExpand:t,title:n,ariaLabel:r,copyLabel:i,defaultPendingMessage:s}){const a=p.useRef(null),l=!!((e==null?void 0:e.status)!=="complete"&&t),[c,u]=p.useState(l),[d,f]=p.useState(!1),h=!!(e!=null&&e.text||e!=null&&e.error),m=(e==null?void 0:e.text)||(e==null?void 0:e.error)||"",g=m.split(` +\`\`\``}function wkt({visible:e}){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M2.8 12s3.3-5.4 9.2-5.4 9.2 5.4 9.2 5.4-3.3 5.4-9.2 5.4S2.8 12 2.8 12Z"}),o.jsx("circle",{cx:"12",cy:"12",r:"2.4"}),!e&&o.jsx("path",{d:"m4.2 4.2 15.6 15.6"})]})}function gJ({available:e,authType:t,value:n,visible:r,loading:i,error:s,onToggle:a}){return e?t==="none"?"无需 API Key":t==="custom_jwt"?"使用 OAuth / JWT":t!=="key_auth"?"暂无":o.jsxs("span",{className:"aw-integration-secret",children:[o.jsx("span",{className:"aw-integration-secret-value","aria-live":"polite",children:r&&n?n:"****"}),o.jsx("button",{type:"button",className:"aw-integration-secret-toggle","aria-label":r?"隐藏 API Key":"显示 API Key",title:r?"隐藏 API Key":"显示 API Key",disabled:i,onClick:a,children:i?o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}):o.jsx(wkt,{visible:r})}),s&&o.jsx("span",{className:"aw-integration-secret-error",role:"alert",children:s})]}):"暂无"}function bJ({protocol:e,title:t,available:n,fields:r,example:i}){return o.jsxs("section",{className:`aw-integration-panel${n&&i?" has-example":""}`,id:`integration-${e}-panel`,role:"tabpanel","aria-labelledby":`integration-${e}-tab`,children:[o.jsx("header",{children:o.jsx("h3",{children:t})}),o.jsx("dl",{children:r.map(s=>o.jsxs("div",{children:[o.jsx("dt",{children:s.label}),o.jsx("dd",{children:s.value||"暂无"})]},s.label))}),n&&i&&o.jsxs("section",{className:"aw-integration-example",children:[o.jsx("h4",{children:"Python 示例"}),o.jsx(wu,{text:i,className:"aw-integration-example-code",allowRawHtml:!1})]})]})}function Skt(e,t,n){var r;return z7({appName:((r=e==null?void 0:e.appName)==null?void 0:r.trim())||t,name:e==null?void 0:e.name,description:e==null?void 0:e.description,type:e==null?void 0:e.type,model:e==null?void 0:e.model,tools:e==null?void 0:e.tools,skills:e==null?void 0:e.skills,graph:e==null?void 0:e.graph,draft:e==null?void 0:e.draft},n)}function bve(e){return e?1+e.children.reduce((t,n)=>t+bve(n),0):1}function yve(e){return 1+e.subAgents.reduce((t,n)=>t+yve(n),0)}function Q6(e){if(!e)return 0;const t=Number(e);if(Number.isFinite(t))return t<1e12?t*1e3:t;const n=Date.parse(e);return Number.isFinite(n)?n:0}function Ekt(e){const t=Q6(e);return t?new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(t)):"时间未知"}function kkt(e){return typeof e.score!="number"||!Number.isFinite(e.score)?"—":`${Math.round(e.score*100)} 分`}function _kt(e){return e==="high"?"高":e==="medium"?"中":"低"}const Tkt={agent_structure:"Agent 结构",prompt:"提示词",tool:"工具",knowledge:"知识库",memory:"记忆",workflow:"工作流",other:"其他"};function Ckt(e){var t;return e.module==="other"?((t=e.customModule)==null?void 0:t.trim())||"其他":Tkt[e.module]}function Akt(e,t){return e.find(n=>n.kind===t)}function yJ(e){return e.items.map(t=>({...t,tag:t.kind==="good"?"Good case":"Bad case"})).sort((t,n)=>Q6(n.createdAt)-Q6(t.createdAt))}function Nkt(e){const t=n=>[n.name,n.description,n.agentType??"llm",n.modelName??"",n.tools??[],n.builtinTools??[],(n.customTools??[]).map(r=>r.name),(n.mcpTools??[]).map(r=>r.name),n.skills??[],(n.selectedSkills??[]).map(r=>r.name),(n.subAgents??[]).map(t)];return JSON.stringify(t(e))}const NT=[{phase:"prepare",label:"准备部署",description:"校验配置并创建部署任务"},{phase:"build",label:"构建镜像",description:"生成运行环境与智能体代码"},{phase:"deploy",label:"部署服务",description:"创建并启动 AgentKit Runtime"},{phase:"publish",label:"发布服务",description:"等待服务就绪并生成访问地址"},{phase:"complete",label:"部署完成",description:"智能体已可以正常使用"}],jkt={phase:"evaluation",label:"创建评测集",description:"自动创建 Good Case 和 Bad Case 评测集"},Rkt={phase:"github",label:"挂载 GitHub 持续交付",description:"初始化目标分支与 GitHub Actions workflow"};function Ikt(e){return{phase:"update",label:"更新实例配置",description:`将 Runtime 实例数调整为 ${e.min}~${e.max}`}}const Dkt=NT.findIndex(e=>e.phase==="build");function Ove(e){const t=[...NT.slice(0,-1)];return e.instanceRange&&t.push(Ikt(e.instanceRange)),e.createEvaluationSets&&t.push(jkt),e.githubDelivery&&t.push(Rkt),t.push(NT[NT.length-1]),t}function xve(e){const t=Ove(e);if(e.status==="success")return t.length-1;const n=e.phase??{准备部署:"prepare",构建镜像:"build",部署:"deploy",发布:"publish",创建评测集:"evaluation","挂载 GitHub 持续交付":"github",部署完成:"complete"}[e.label],r=t.findIndex(i=>i.phase===n);return r<0?0:r}function Pkt(e){if(!e)return"";try{return new Intl.DateTimeFormat("zh-CN",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(new Date(e))}catch{return""}}function vve({log:e,autoExpand:t,title:n,ariaLabel:r,copyLabel:i,defaultPendingMessage:s}){const a=p.useRef(null),l=!!((e==null?void 0:e.status)!=="complete"&&t),[c,u]=p.useState(l),[d,f]=p.useState(!1),h=!!(e!=null&&e.text||e!=null&&e.error),m=(e==null?void 0:e.text)||(e==null?void 0:e.error)||"",g=m.split(` `),b=c?m:g.slice(-36).join(` -`),y=(e==null?void 0:e.pendingMessage)||s;if(p.useEffect(()=>{e&&u(l)},[e==null?void 0:e.status,l]),p.useEffect(()=>{if(!c||!h)return;const E=a.current;E&&(E.scrollTop=E.scrollHeight)},[c,h,b]),!e||!e.text&&e.status!=="error"&&!e.pendingMessage)return null;const O=Mkt(e.updatedAt),v=e.status==="complete"?"已同步":e.status==="error"?"读取失败":"同步中",x=e.omittedEarly?"已省略早期日志":e.snapshotTruncated?"仅显示最近的构建日志":e.truncated?"已省略部分日志":"",w=[v,e.lineCount?`${e.lineCount} 行`:"",x,O].filter(Boolean).join(" · ");async function S(){try{await navigator.clipboard.writeText(m),f(!0),window.setTimeout(()=>f(!1),1500)}catch{f(!1)}}return o.jsxs("section",{className:`aw-deploy-log is-${e.status}${c?"":" is-collapsed"}`,"aria-label":r,children:[o.jsxs("header",{children:[o.jsxs("div",{children:[o.jsx("strong",{children:n}),o.jsx("span",{children:w})]}),o.jsxs("div",{className:"aw-deploy-log-actions",children:[h&&o.jsx("button",{type:"button",onClick:()=>u(E=>!E),children:c?"收起":"展开"}),h&&o.jsxs("button",{type:"button",onClick:()=>void S(),"aria-label":d?`已复制${i}`:`复制${i}`,title:d?"已复制":`复制${i}`,children:[d?o.jsx(Eu,{"aria-hidden":!0}):o.jsx(AN,{"aria-hidden":!0}),o.jsx("span",{children:d?"已复制":"复制"})]})]})]}),c&&(h?o.jsx("pre",{ref:a,children:b}):o.jsx("div",{className:"aw-deploy-log-empty",children:y}))]})}function Lkt({task:e}){var t;return o.jsx(vve,{log:e.buildLog,autoExpand:((t=e.buildLog)==null?void 0:t.status)!=="complete"&&(e.status==="running"||e.status==="error")&&xve(e)===Pkt,title:"构建日志",ariaLabel:"构建日志",copyLabel:"构建日志",defaultPendingMessage:"正在等待构建日志…"})}function $kt({task:e}){var t;return o.jsx(vve,{log:e.githubLog,autoExpand:((t=e.githubLog)==null?void 0:t.status)!=="complete"&&(e.status==="running"||e.status==="error")&&e.phase==="github",title:"GitHub 挂载日志",ariaLabel:"GitHub 持续交付挂载日志",copyLabel:"GitHub 挂载日志",defaultPendingMessage:"正在等待 GitHub 挂载日志…"})}function Bkt({task:e,onReturnToEdit:t}){const n=Ove(e),r=xve(e),i=e.status==="success"?100:Math.max(6,Math.min(100,e.pct??6)),s=e.status==="running"?"正在部署":e.status==="success"?"部署完成":e.status==="error"?"部署失败":"部署已取消";return o.jsxs("section",{className:`aw-deploy-progress-card is-${e.status}`,"aria-live":"polite",children:[o.jsxs("div",{className:"aw-deploy-progress-head",children:[o.jsxs("div",{children:[o.jsx("span",{className:"aw-deploy-progress-icon","aria-hidden":!0,children:e.status==="running"?o.jsx(lr,{className:"spin"}):e.status==="success"?o.jsx(LRe,{}):e.status==="error"?o.jsx(Dae,{}):o.jsx(MM,{})}),o.jsxs("div",{children:[o.jsx("h3",{children:s}),o.jsx("p",{children:e.runtimeName})]})]}),o.jsx("strong",{children:e.status==="running"?`${Math.round(i)}%`:e.label})]}),o.jsx("div",{className:"aw-deploy-progress-track",role:"progressbar","aria-label":"部署进度","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(i),children:o.jsx("span",{style:{width:`${i}%`}})}),o.jsx("ol",{className:"aw-deploy-steps",children:n.map((a,l)=>{const c=e.status==="success"||lnew Set),[tt,en]=p.useState(()=>new Set),[rn,rr]=p.useState(!1),[dr,Rn]=p.useState(""),[ar,Vr]=p.useState(null),[Hr,Zr]=p.useState([]),[Lr,ir]=p.useState([]),[Kr,Jr]=p.useState(!1),[qr,es]=p.useState(""),[li,Xr]=p.useState(""),[ei,ra]=p.useState(0),[ms,gi]=p.useState([]),[gs,Ni]=p.useState(!1),[xa,bs]=p.useState(""),[Ar,Ua]=p.useState(0),[Fi,Fa]=p.useState(null),[$n,Gs]=p.useState(1),[Vn,ss]=p.useState(!1),[bi,Or]=p.useState(""),[Rs,pe]=p.useState(0),[Be,Dt]=p.useState(!1),[kt,qn]=p.useState(()=>new Set),[Dr,za]=p.useState(!1),[so,va]=p.useState(""),[Is,wa]=p.useState(""),[Id,Xl]=p.useState(()=>new Set),Sa=p.useRef(!1),Vc=p.useRef(""),Dd=p.useRef(null),Gl=p.useRef(0),To=p.useRef(0),Co=p.useRef(0),[Wl,Iu]=p.useState(mkt),[sl,Eh]=p.useState("");p.useEffect(()=>{e.length!==0&&Iu(ee=>ee.map((ve,De)=>De===0&&ve.agentIds.length===0?{...ve,agentIds:e.slice(0,2).map(ct=>ct.id)}:ve))},[e]);const Ao=p.useMemo(()=>{const ee=new Map;for(const ve of e)ve.runtimeId&&ee.set(ve.runtimeId,ve);return ee},[e]),Yl=p.useMemo(()=>{var ve;const ee=new Map;for(const De of t){const ct=(ve=De.deploymentTarget)==null?void 0:ve.runtimeId;if(!ct||!Ao.has(ct))continue;const Mt=ee.get(ct);(!Mt||De.updatedAt>Mt.updatedAt)&&ee.set(ct,De)}return ee},[Ao,t]),Zl=p.useMemo(()=>{const ee=new Map;for(const ve of f){if(!ve.runtimeId)continue;const De=ee.get(ve.runtimeId);(!De||ve.startedAt>De.startedAt)&&ee.set(ve.runtimeId,ve)}return ee},[f]),Hc=p.useMemo(()=>{const ee=Fe.trim().toLowerCase();return ee?e.filter(ve=>{const De=ve.runtimeId?Yl.get(ve.runtimeId):void 0,ct=ve.runtimeId?Zl.get(ve.runtimeId):void 0;return[ve.label,ve.app,ve.host??"",(De==null?void 0:De.draft.name)??"",(De==null?void 0:De.draft.description)??"",(ct==null?void 0:ct.runtimeName)??""].join(" ").toLowerCase().includes(ee)}):e},[e,Zl,Fe,Yl]),Dn=p.useMemo(()=>{const ee=Fe.trim().toLowerCase();return t.filter(ve=>{var ct;const De=(ct=ve.deploymentTarget)==null?void 0:ct.runtimeId;return De&&Ao.has(De)?!1:ee?`${ve.draft.name} ${ve.draft.description}`.toLowerCase().includes(ee):!0})},[Ao,t,Fe]),No=p.useMemo(()=>t.filter(ee=>{var De;const ve=(De=ee.deploymentTarget)==null?void 0:De.runtimeId;return!ve||!Ao.has(ve)}).length,[Ao,t]),Pd=p.useMemo(()=>{const ee=Fe.trim().toLowerCase();return ee?Wl.filter(ve=>ve.name.toLowerCase().includes(ee)):Wl},[Wl,Fe]),se=e.find(ee=>ee.id===Q),Tn=t.find(ee=>ee.id===$),Xn=h?f.find(ee=>ee.id===h):void 0,Va=se!=null&&se.runtimeId?Yl.get(se.runtimeId):void 0,Kn=O?St:Q&&i===Q?r:null,ti=(Kn==null?void 0:Kn.appName)||(se==null?void 0:se.runtimeApp)||(se==null?void 0:se.app)||"",Md=c&&(se!=null&&se.runtimeId)?hJ:hJ.filter(ee=>ee.id!=="usage"),al=JSON.stringify([(se==null?void 0:se.runtimeId)??"",(se==null?void 0:se.region)??"cn-beijing",ti,$n]),ys=(Fi==null?void 0:Fi.requestKey)===al?Fi.value:null,ao=`${(se==null?void 0:se.region)??"cn-beijing"}:${(se==null?void 0:se.runtimeId)??""}`,Os=(Me==null?void 0:Me.requestKey)===ao?Me.value:"",oe=(V==null?void 0:V.requestKey)===ao?V:null,Ze=!!((ZE=oe==null?void 0:oe.apiApps)!=null&&ZE.length),yt=!!(oe!=null&&oe.a2a),gn=((Th=oe==null?void 0:oe.apiApps)==null?void 0:Th[0])??ti,Xt=(z==null?void 0:z.endpoint)??"",tn=Okt(((A0=oe==null?void 0:oe.a2a)==null?void 0:A0.endpoint)??"",Xt),cn=(se==null?void 0:se.runtimeApp)||"",Ft=JSON.stringify([(se==null?void 0:se.runtimeId)??"",(se==null?void 0:se.region)??"",(se==null?void 0:se.currentVersion)??null,cn]),It=l&&(se!=null&&se.runtimeId)&&se.region&&it===0?YM({runtimeId:se.runtimeId,region:se.region,appName:cn,currentVersion:se.currentVersion}):null,an=(W==null?void 0:W.requestKey)===Ft?W.value:It;p.useEffect(()=>{const ee=Gl.current+1;Gl.current=ee,_e(null),ot("");const ve=(se==null?void 0:se.runtimeId)??"",De=(se==null?void 0:se.region)??"";if(!l||!ve||!De){Ve(!1);return}const ct=it===0?YM({runtimeId:ve,region:De,appName:cn,currentVersion:se==null?void 0:se.currentVersion}):null;if(ct){_e({requestKey:Ft,value:ct}),Ve(!1);return}const Mt=new AbortController;let Xe,Qn=0;const zi=60;Ve(!0);const Cn=Ws=>{BN({runtimeId:ve,region:De,appName:cn,currentVersion:se==null?void 0:se.currentVersion,signal:Mt.signal,force:Ws&&it>0}).then(Ri=>{var ek,tk;if(ee!==Gl.current)return;const er=Ri.recoveryStatus==="preparing";if(Ri.runtime.runtimeId!==ve||Ri.runtime.region!==De||!er&&cn&&((ek=Ri.agent)==null?void 0:ek.appName)!==cn||Ri.canUpdate&&!((tk=Ri.agent)!=null&&tk.appName)){ot("Runtime 更新能力响应与当前选择不匹配。");return}if(_e({requestKey:Ft,value:Ri}),Ve(!1),!!er){if(Qn+=1,Qn>=zi){ot("更新配置仍在后台恢复,请稍后点击重试。");return}Xe=window.setTimeout(()=>Cn(!1),1e3)}}).catch(Ri=>{ee!==Gl.current||Mt.signal.aborted||ot(Ri instanceof Error?Ri.message:"检查 Runtime 更新能力失败。")}).finally(()=>{ee===Gl.current&&!Mt.signal.aborted&&Ve(!1)})};return Cn(!0),()=>{Mt.abort(),Xe!=null&&window.clearTimeout(Xe)}},[l,cn,it,se==null?void 0:se.currentVersion,se==null?void 0:se.region,se==null?void 0:se.runtimeId,Ft]);const Ye=p.useMemo(()=>{const ee=new Map(e.map((De,ct)=>[De.id,ct])),ve=new Map(n.map((De,ct)=>[De,ct]));return[...Hc].sort((De,ct)=>{const Mt=De.runtimeId?Zl.get(De.runtimeId):void 0,Xe=ct.runtimeId?Zl.get(ct.runtimeId):void 0,Qn=(Mt==null?void 0:Mt.status)==="running"?Mt.startedAt:0,zi=(Xe==null?void 0:Xe.status)==="running"?Xe.startedAt:0;if(Qn!==zi)return zi-Qn;const Cn=ve.get(De.id),Ws=ve.get(ct.id);return Cn!=null&&Ws!=null?Cn-Ws:Cn!=null?-1:Ws!=null?1:(ee.get(De.id)??0)-(ee.get(ct.id)??0)})},[n,e,Hc,Zl]),ts=(se==null?void 0:se.label)||(Kn==null?void 0:Kn.name)||(Tn==null?void 0:Tn.draft.name)||(Xn==null?void 0:Xn.agentName)||((KE=Xn==null?void 0:Xn.agentDraft)==null?void 0:KE.name)||"未选择智能体",J=Wl.find(ee=>ee.id===sl),Ie=Ye.filter(ee=>ee.canDelete===!0),ft=Ye.filter(ee=>sr.has(ee.id)&&ee.canDelete===!0),Kt=Dn.filter(ee=>tt.has(ee.id)),bn=Ie.length+Dn.length,kn=ft.length+Kt.length,Gn=p.useMemo(()=>{var ve;if(Xn!=null&&Xn.agentDraft)return Xn.agentDraft;if(Tn!=null&&Tn.draft)return Tn.draft;const ee=(ve=se==null?void 0:se.region)!=null&&ve.startsWith("ap-")?"byteplus":"volcengine";return an!=null&&an.agent&&(an.recoveryStatus==="complete"||an.recoveryStatus==="draft-only")?z7(an.agent,ee,an.runtime.configuredEnvKeys):Ekt(Kn,ti||(se==null?void 0:se.label)||"agent",ee)},[Kn,ti,se==null?void 0:se.label,se==null?void 0:se.region,Tn==null?void 0:Tn.draft,Xn==null?void 0:Xn.agentDraft,an]),Jn=((jO=Kn==null?void 0:Kn.draft)==null?void 0:jO.harnessSidecar)??vHe(z==null?void 0:z.envs),fn=Jn?nO.filter(ee=>Jn.componentOverrides[ee]):[],Bt=Tn?a?"":"当前账号没有新建 Agent 的权限。":l?se!=null&&se.runtimeId?se.region?rt?"正在检查 Runtime 更新配置。":We||(an?an.recoveryStatus!=="complete"&&an.recoveryStatus!=="draft-only"?an.reason||"该 Runtime 的原发布配置不可恢复,无法安全更新。":an.canUpdate?(JE=an.agent)!=null&&JE.appName?"":"Runtime 更新能力响应缺少智能体信息。":an.reason||"当前 Runtime 不支持原地更新。":"尚未完成 Runtime 更新能力检查。"):"Runtime 缺少地域信息,无法更新。":"仅支持更新已部署的云端智能体。":"当前账号没有管理 Agent 的权限。",hn="aw-update-disabled-reason",Gr=p.useMemo(()=>{if(Kn)return Kn.tools;const ee=(Gn.builtinTools??[]).map(ve=>{var De;return((De=tO.find(ct=>ct.id===ve))==null?void 0:De.label)??ve});return Array.from(new Set([...Gn.tools,...ee,...(Gn.customTools??[]).map(ve=>ve.name),...(Gn.mcpTools??[]).map(ve=>ve.name)].filter(Boolean)))},[Gn,Kn]),Bn=p.useMemo(()=>Kn?Kn.skillsPreviewSupported?Kn.skills.map(ee=>ee.name):null:Array.from(new Set([...(Gn.selectedSkills??[]).map(ee=>ee.name),...Gn.skills].filter(Boolean))),[Gn,Kn]),Jt=p.useMemo(()=>{if(Xn)return Xn;if(Tn){const ee=f.filter(ve=>ve.draftId===Tn.id).sort((ve,De)=>De.startedAt-ve.startedAt)[0];return ee||f.filter(ve=>{var De,ct;return((De=ve.agentDraft)==null?void 0:De.name)===Tn.draft.name||ve.agentName===Tn.draft.name||!!((ct=Tn.deploymentTarget)!=null&&ct.runtimeId)&&ve.runtimeId===Tn.deploymentTarget.runtimeId}).sort((ve,De)=>De.startedAt-ve.startedAt)[0]}if(se)return f.filter(ee=>!!se.runtimeId&&ee.runtimeId===se.runtimeId||ee.agentName===se.label).sort((ee,ve)=>ve.startedAt-ee.startedAt)[0]},[f,se,Tn,Xn]),ji=!!(h&&Jt&&Jt.id===h),Ds=!!(Jt&&(Jt.status!=="success"||ji)),Kl=(Jt==null?void 0:Jt.status)==="running",kh=Jt!=null&&Jt.draftId?t.find(ee=>ee.id===Jt.draftId)??(Jt.agentDraft?{id:Jt.draftId,draft:Jt.agentDraft,updatedAt:Jt.startedAt}:void 0):void 0,bm=p.useMemo(()=>jkt(Gn),[Gn]),Jl=(se==null?void 0:se.currentVersion)??(z==null?void 0:z.currentVersion)??null,_0=Jl??(Xn==null?void 0:Xn.startedAt)??"unknown",T0=Kn?`runtime:${(se==null?void 0:se.runtimeId)??Kn.name}:v${_0}:${bm}`:`draft:${(Xn==null?void 0:Xn.id)??(Tn==null?void 0:Tn.id)??(se==null?void 0:se.id)??ts}:${bm}`;p.useEffect(()=>{N==="usage"&&!c&&D("basic")},[c,N]),p.useEffect(()=>{if(!h)return;const ee=f.find(De=>De.id===h),ve=ee!=null&&ee.runtimeId?Ao.get(ee.runtimeId):void 0;if(ve){H(""),F(ve.id),D("basic");return}F(""),H(""),D("basic")},[Ao,f,h]),p.useEffect(()=>{if(!m){Vc.current="";return}const ee=`${m}:${g}:${b}:${c}`;Vc.current!==ee&&e.some(ve=>ve.id===m)&&(Vc.current=ee,H(""),F(m),D(g==="usage"&&!c?"basic":g),g==="evaluations"&&(Pt(b),ln("")))},[e,c,m,g,b]),p.useEffect(()=>{for(const ee of Ye.slice(0,8)){if(!ee.runtimeId)continue;const ve=ee.region??"cn-beijing";hle(ee.runtimeId,ve),poe(ee.runtimeId,ve,ee.runtimeApp??"")}},[Ye]),p.useEffect(()=>{let ee=!1;const ve=(se==null?void 0:se.runtimeId)??"",De=(se==null?void 0:se.region)??"cn-beijing",ct=(se==null?void 0:se.runtimeApp)??"",Mt=ve?hoe(ve,De,ct):null;if(Vt(Mt),mt(""),qe(!1),Ne(!!Mt||!O||!ve),!(!O||!ve))return g9(ve,De,ct,{force:!0}).then(Xe=>{ee||Vt(Xe)}).catch(Xe=>{!ee&&!Mt&&Vt(null),ee||(qe(Xe instanceof Es&&Xe.unsupported),mt(Xe instanceof Error?Xe.message:"加载 Agent 信息失败。"))}).finally(()=>{ee||Ne(!0)}),()=>{ee=!0}},[O,it,se==null?void 0:se.currentVersion,se==null?void 0:se.region,se==null?void 0:se.runtimeApp,se==null?void 0:se.runtimeId]),p.useEffect(()=>{let ee=!1;const ve=(se==null?void 0:se.runtimeId)??"",De=(se==null?void 0:se.region)??"cn-beijing";if(gi([]),bs(""),N!=="optimizations"||!ve){Ni(!1);return}if(O&&!ti){Ni(!_t);return}return Ni(!0),roe({runtimeId:ve,region:De,appName:ti}).then(ct=>{ee||gi(ct.groups)}).catch(ct=>{ee||bs(ct instanceof Error?ct.message:String(ct))}).finally(()=>{ee||Ni(!1)}),()=>{ee=!0}},[_t,O,Ar,N,ti,se==null?void 0:se.region,se==null?void 0:se.runtimeId]),p.useEffect(()=>{Gs(1)},[se==null?void 0:se.runtimeId,ti]),p.useEffect(()=>{const ee=Co.current+1;Co.current=ee;const ve=(se==null?void 0:se.runtimeId)??"",De=(se==null?void 0:se.region)??"cn-beijing",ct=ti;if(Or(""),N!=="usage"||!ve){ss(!1);return}if(!ct){ss(O&&!_t);return}const Mt=new AbortController;return ss(!0),ele({runtimeId:ve,region:De,appName:ct,page:$n,pageSize:gkt,signal:Mt.signal}).then(Xe=>{if(ee===Co.current){if(Xe.runtimeId!==ve||Xe.appName!==ct||Xe.page!==$n){Or("用量响应与当前 Agent 不匹配,请重试。");return}Fa({requestKey:al,value:Xe})}}).catch(Xe=>{ee!==Co.current||Mt.signal.aborted||Or(Xe instanceof Error?Xe.message:"加载 Agent 用量失败。")}).finally(()=>{ee===Co.current&&ss(!1)}),()=>{Mt.abort()}},[$n,Rs,al,_t,O,N,ti,se==null?void 0:se.region,se==null?void 0:se.runtimeId]),p.useEffect(()=>{To.current+=1,Ae(null),et(!1),Re(!1),me(""),xe("api-server")},[ao,N]);function ni(){To.current+=1,Ae(null),et(!1),Re(!1),me("")}function Ea(ee){ee!==de&&(ni(),xe(ee))}async function Du(){if(He){ni();return}const ee=(se==null?void 0:se.runtimeId)??"",ve=(se==null?void 0:se.region)??"cn-beijing";if(!ee)return;const De=To.current+1;To.current=De,Re(!0),me("");try{const ct=await ule(ee,ve);if(De!==To.current)return;Ae({requestKey:ao,value:ct}),et(!0)}catch(ct){if(De!==To.current)return;Ae(null),et(!1),me(ct instanceof Error?ct.message:"读取 Runtime API Key 失败。")}finally{De===To.current&&Re(!1)}}p.useEffect(()=>{let ee=!1;const ve=(se==null?void 0:se.runtimeId)??"",De=(se==null?void 0:se.region)??"cn-beijing",ct=ve?fle(ve,De):null;if(B(ct),Ue(""),!!ve)return S9(ve,De,{force:!0}).then(Mt=>{ee||B(Mt)}).catch(Mt=>{!ee&&!ct&&B(null),ee||Ue(Mt instanceof Error?Mt.message:"加载 Runtime 详情失败。")}),()=>{ee=!0}},[it,se==null?void 0:se.currentVersion,se==null?void 0:se.region,se==null?void 0:se.runtimeId]),p.useEffect(()=>{let ee=!1;const ve=(se==null?void 0:se.runtimeId)??"";if(ue(""),N!=="versions"||!ve){Qe(!1),ve||ke(null);return}return Qe(!0),z_(ve).then(De=>{ee||ke(De)}).catch(De=>{ee||(ke(null),ue(De instanceof Error?De.message:"读取 GitHub 版本失败。"))}).finally(()=>{ee||Qe(!1)}),()=>{ee=!0}},[N,se==null?void 0:se.currentVersion,se==null?void 0:se.runtimeId]),p.useEffect(()=>{let ee=!1;const ve=(se==null?void 0:se.runtimeId)??"",De=(se==null?void 0:se.region)??"cn-beijing",ct=`${De}:${ve}`;if(q(""),N!=="integrations"||!ve){be(!1),ve||Z(null);return}be(!0);const Mt=Jy(ve,De,{retryProbe:!0}).catch(Xe=>{if(Xe instanceof Es&&Xe.unsupported)return null;throw Xe});return Promise.all([Mt,cle(ve,De,{retryProbe:!0})]).then(([Xe,Qn])=>{ee||Z({requestKey:ct,apiApps:Xe,a2a:Qn})}).catch(Xe=>{ee||(Z(null),q(Xe instanceof Error?Xe.message:"探测集成方式失败。"))}).finally(()=>{ee||be(!1)}),()=>{ee=!0}},[X,N,se==null?void 0:se.currentVersion,se==null?void 0:se.region,se==null?void 0:se.runtimeId]),p.useEffect(()=>{let ee=!1;const ve=(se==null?void 0:se.runtimeId)??"",De=(se==null?void 0:se.region)??"cn-beijing",ct=ve&&ti?ioe({runtimeId:ve,region:De,appName:ti,pageSize:100}):null;if(Zr(ct?yJ(ct):[]),ir((ct==null?void 0:ct.sets)??[]),es(""),Xr((ct==null?void 0:ct.unsupportedMessage)??""),N!=="evaluations"||!ve){Jr(!1);return}if(O&&!ti){Jr(!_t);return}return Jr(!ct),MN({runtimeId:ve,region:De,appName:ti,pageSize:100},{force:!0}).then(Mt=>{ee||(ir(Mt.sets),Zr(yJ(Mt)),Xr(Mt.unsupportedMessage??""))}).catch(Mt=>{ee||(es(Mt instanceof Error?Mt.message:String(Mt)),Xr(""))}).finally(()=>{ee||Jr(!1)}),()=>{ee=!0}},[_t,O,ei,N,ti,Kn==null?void 0:Kn.appName,se==null?void 0:se.region,se==null?void 0:se.runtimeId]);async function _h(ee){const ve=(se==null?void 0:se.runtimeId)??"",De=ee.commitSha??"";if(!(!ve||!De||Pe)){Ge(De),ue("");try{await Hoe({runtimeId:ve,targetCommitSha:De});const ct=await z_(ve);ke(ct)}catch(ct){ue(ct instanceof Error?ct.message:"回退版本失败。")}finally{Ge("")}}}p.useEffect(()=>{const ee=new Set(Hr.map(ve=>ve.id));qn(ve=>{const De=new Set([...ve].filter(ct=>ee.has(ct)));return De.size===ve.size?ve:De}),Xl(ve=>{const De=new Set([...ve].filter(ct=>ee.has(ct)));return De.size===ve.size?ve:De}),Is&&!ee.has(Is)&&wa("")},[Hr,Is]),p.useEffect(()=>{Dt(!1),qn(new Set),Xl(new Set),va(""),wa("")},[se==null?void 0:se.runtimeId]),p.useEffect(()=>{const ee=new Set(Ye.filter(ve=>ve.canDelete===!0).map(ve=>ve.id));ze(ve=>{const De=new Set([...ve].filter(ct=>ee.has(ct)));return De.size===ve.size?ve:De})},[Ye]),p.useEffect(()=>{const ee=new Set(Dn.map(ve=>ve.id));en(ve=>{const De=new Set([...ve].filter(ct=>ee.has(ct)));return De.size===ve.size?ve:De})},[Dn]);const ec=p.useMemo(()=>!y||!(se!=null&&se.runtimeId)||y.runtimeId!==se.runtimeId||ti&&y.agentName&&y.agentName!==ti?null:{...y,tag:y.kind==="good"?"Good case":"Bad case"},[y,se==null?void 0:se.runtimeId,ti]),qc=p.useMemo(()=>se!=null&&se.runtimeId?ec?[ec,...Hr.filter(ee=>ee.id!==ec.id&&(!ee.messageId||ee.messageId!==ec.messageId))]:Hr:pkt,[Hr,ec,se==null?void 0:se.runtimeId]),tc=qc.filter(ee=>{if(ee.kind!==Tt||(ee.source==="auto"?"auto":"user")!==le)return!1;const De=nn.trim().toLowerCase();return De?[ee.input,ee.output,ee.referenceOutput,ee.comment,ee.tag??"",ee.sessionId,ee.messageId,ee.userId,ee.evaluationSetName].join(" ").toLowerCase().includes(De):!0}),jo=tc.filter(ee=>kt.has(ee.id)),Xc=!!(se!=null&&se.runtimeId),Ld=ee=>{Pt(ee),ln(""),va("");const ve=qc.find(De=>De.kind===ee);wa((ve==null?void 0:ve.id)??""),window.setTimeout(()=>{var De;(De=Dd.current)==null||De.scrollIntoView({behavior:"smooth",block:"start"})},0)},ym=ee=>{va(""),qn(ve=>{const De=new Set(ve);return De.has(ee.id)?De.delete(ee.id):De.add(ee.id),De})},Et=()=>{va(""),qn(new Set(tc.map(ee=>ee.id)))},nc=()=>{va(""),qn(new Set),Dt(!1)},Si=ee=>{Xl(ve=>{const De=new Set(ve);return De.has(ee)?De.delete(ee):De.add(ee),De})},rc=ee=>{wa(ee.id),va(""),!(!ee.sessionId||!ee.messageId)&&(C==null||C(ee))},$r=async ee=>{if(!(se!=null&&se.runtimeId)||!ti||Dr||ee.length===0)return;const ve=ee.length===1?"确定删除这条反馈案例?原始聊天记录不会被删除。":`确定删除选中的 ${ee.length} 条反馈案例?原始聊天记录不会被删除。`;if(!window.confirm(ve))return;const De=ee.map(Mt=>Mt.id),ct=new Set(De);za(!0),va("");try{await ooe({runtimeId:se.runtimeId,region:se.region??"cn-beijing",appName:ti,itemIds:De});const Mt=new Map;for(const Xe of ee)Mt.set(Xe.kind,(Mt.get(Xe.kind)??0)+1);Zr(Xe=>Xe.filter(Qn=>!ct.has(Qn.id))),ir(Xe=>Xe.map(Qn=>({...Qn,itemCount:Math.max(0,Qn.itemCount-(Mt.get(Qn.kind)??0))}))),qn(Xe=>new Set([...Xe].filter(Qn=>!ct.has(Qn)))),Xl(Xe=>new Set([...Xe].filter(Qn=>!ct.has(Qn)))),Is&&ct.has(Is)&&wa(""),ee.length>1&&Dt(!1),T==null||T(ee)}catch(Mt){va(Mt instanceof Error?Mt.message:String(Mt))}finally{za(!1)}},$d=ee=>{Iu(ve=>ve.map(De=>De.id===ee.id?ee:De))},CO=()=>{const ee=new Set(e.map(ct=>ct.id)),ve=n.filter(ct=>ee.has(ct)),De=new Set(ve);return[...ve,...e.filter(ct=>!De.has(ct.id)).map(ct=>ct.id)]},AO=(ee,ve,De)=>{if(!w||ee===ve)return;const ct=CO().filter(Qn=>Qn!==ee),Mt=ct.indexOf(ve),Xe=Mt<0?ct.length:De==="after"?Mt+1:Mt;ct.splice(Xe,0,ee),w(ct)},YE=(ee,ve)=>{if(!Le||Le===ve)return;const De=ee.currentTarget.getBoundingClientRect();bt(ve),lt(ee.clientY>De.top+De.height/2?"after":"before")},ic=(ee,ve)=>{if(!w)return;const De=CO(),ct=De.indexOf(ee),Mt=Math.max(0,Math.min(De.length-1,ct+ve));ct<0||ct===Mt||(De.splice(ct,1),De.splice(Mt,0,ee),w(De))},RR=ee=>{ee.canDelete===!0&&(Rn(""),ze(ve=>{const De=new Set(ve);return De.has(ee.id)?De.delete(ee.id):De.add(ee.id),De}))},Om=ee=>{Rn(""),en(ve=>{const De=new Set(ve);return De.has(ee.id)?De.delete(ee.id):De.add(ee.id),De})},IR=()=>{Rn(""),ze(new Set(Ie.map(ee=>ee.id))),en(new Set(Dn.map(ee=>ee.id)))},Pn=()=>{Rn(""),ze(new Set),en(new Set),yr(!1)},DR=()=>{if(kn===0||rn)return;const ee=ft.length,ve=Kt.length;Rn(""),Vr({kind:"selection",title:ee===1&&ve===0?"删除 Agent?":ee===0&&ve===1?"删除草稿?":"删除所选项目?",description:ee===1&&ve===0?`"${ft[0].label}" 对应的云端 Runtime 将被永久删除,此操作不可撤销。`:ee===0&&ve===1?`"${Kt[0].draft.name||"未命名 Agent"}" 将从本地草稿中删除。`:`将删除选中的 ${kn} 个项目。${ee>0?`${ee} 个云端 Runtime 将被永久删除,此操作不可撤销。`:"草稿删除后无法恢复。"}`,confirmLabel:ee===0&&ve===1?"删除草稿":"删除所选",agents:ft,drafts:Kt})},PR=async()=>{if(!(!ar||rn)){rr(!0),Rn("");try{if(ar.kind==="selection"){const{agents:ee,drafts:ve}=ar;if(ee.length>0){if(!S)throw new Error("当前页面不支持删除已部署 Agent。");await S(ee)}ve.length>0&&(E==null||E(ve)),ze(new Set),en(new Set),yr(!1),ee.some(De=>De.id===Q)&&F(""),ve.some(De=>De.id===$)&&H("")}else if(ar.kind==="agent"){if(!S)throw new Error("当前页面不支持删除已部署 Agent。");await S([ar.agent]),Q===ar.agent.id&&F("")}else{if(!E)throw new Error("当前页面不支持删除草稿。");E([ar.draft]),$===ar.draft.id&&H("")}Vr(null)}catch(ee){Rn(ee instanceof Error?ee.message:String(ee))}finally{rr(!1)}}},MR=ee=>{!S||ee.canDelete!==!0||rn||(Rn(""),Vr({kind:"agent",title:"删除 Agent?",description:`"${ee.label}" 对应的云端 Runtime 将被永久删除,此操作不可撤销。`,confirmLabel:"删除 Agent",agent:ee}))},NO=ee=>{if(!E||rn)return;const ve=ee.draft.name||"未命名 Agent";Rn(""),Vr({kind:"draft",title:"删除草稿?",description:`"${ve}" 将从本地草稿中删除。`,confirmLabel:"删除草稿",draft:ee})},LR=()=>{const ee=`eval-${Date.now()}`,ve={id:ee,name:`新评测组 ${Wl.length+1}`,agentIds:[],caseSet:"核心回归集",evaluator:"综合质量评估器",metrics:["回答质量"],concurrency:"4",history:[]};Iu(De=>[ve,...De]),Eh(ee)},C0=ee=>{$d({...ee,history:[{id:`run-${Date.now()}`,createdAt:"刚刚",score:86+ee.history.length%7,status:"completed"},...ee.history]})};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`aw-root${O?" is-detail-only":""}`,children:[o.jsxs("nav",{className:"aw-view-tabs","aria-label":"智能体工作台",children:[o.jsx("button",{type:"button",className:I==="library"?"is-active":"","aria-pressed":I==="library",onClick:()=>{M("library"),dt("")},children:"智能体库"}),o.jsx("button",{type:"button",className:I==="evaluation"?"is-active":"","aria-pressed":I==="evaluation",onClick:()=>{M("evaluation"),dt("")},children:"评测"})]}),o.jsxs("div",{className:"aw-workspace-frame",children:[o.jsxs("div",{className:"aw-workspace","aria-hidden":I==="evaluation"||void 0,ref:ee=>{ee==null||ee.toggleAttribute("inert",I==="evaluation")},children:[o.jsxs("aside",{className:"aw-sidebar","aria-label":I==="library"?"智能体列表":"评测组列表",children:[o.jsxs("label",{className:"aw-search",children:[o.jsx(gC,{"aria-hidden":!0}),o.jsx("input",{value:Fe,onChange:ee=>dt(ee.currentTarget.value),placeholder:I==="library"?"搜索智能体":"搜索评测组","aria-label":I==="library"?"搜索智能体":"搜索评测组"})]}),o.jsxs("button",{type:"button",className:"aw-create-card",onClick:I==="library"?A:LR,disabled:I==="library"&&!a,children:[o.jsx(yo,{"aria-hidden":!0}),o.jsx("span",{children:I==="library"?"新建 Agent":"新建评测组"})]}),I==="library"&&(S||E)&&o.jsx("div",{className:`aw-selection-toolbar${sn?" is-active":""}`,children:sn?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"aw-selection-count",children:["已选 ",kn," 个"]}),o.jsx("button",{type:"button",onClick:IR,disabled:bn===0||rn,children:"全选"}),o.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void DR(),disabled:kn===0||rn,children:rn?"删除中…":"删除所选"}),o.jsx("button",{type:"button",onClick:Pn,disabled:rn,children:"取消"})]}):o.jsx("button",{type:"button",onClick:()=>{Rn(""),yr(!0)},disabled:bn===0,children:"选择"})}),I==="library"&&dr&&o.jsx("div",{className:"aw-delete-error",role:"alert",children:dr}),o.jsx("div",{className:"aw-agent-list",children:I==="evaluation"?Pd.length===0?o.jsx("div",{className:"aw-list-empty",children:"没有匹配的评测组"}):Pd.map(ee=>o.jsxs("button",{type:"button",className:`aw-agent-item${ee.id===sl?" is-active":""}`,onClick:()=>Eh(ee.id),children:[o.jsxs("span",{className:"aw-agent-copy aw-eval-group-copy",children:[o.jsx("strong",{children:ee.name}),o.jsxs("small",{children:[ee.agentIds.length," 个智能体 · ",ee.history.length," 次运行"]})]}),o.jsx(wv,{"aria-hidden":!0})]},ee.id)):u&&Ye.length===0&&Dn.length===0?o.jsx("div",{className:"aw-list-empty",children:"正在读取云端智能体…"}):d&&Ye.length===0&&Dn.length===0?o.jsxs("div",{className:"aw-list-empty aw-list-error",children:[o.jsx("span",{children:d}),x&&o.jsx("button",{type:"button",onClick:x,children:"重试"})]}):Ye.length===0&&Dn.length===0?o.jsx("div",{className:"aw-list-empty",children:"没有匹配的智能体"}):o.jsxs(o.Fragment,{children:[Dn.map(ee=>{const De=f.filter(Mt=>Mt.draftId===ee.id).sort((Mt,Xe)=>Xe.startedAt-Mt.startedAt)[0]??f.filter(Mt=>{var Xe,Qn;return((Xe=Mt.agentDraft)==null?void 0:Xe.name)===ee.draft.name||Mt.agentName===ee.draft.name||!!((Qn=ee.deploymentTarget)!=null&&Qn.runtimeId)&&Mt.runtimeId===ee.deploymentTarget.runtimeId}).sort((Mt,Xe)=>Xe.startedAt-Mt.startedAt)[0],ct=tt.has(ee.id);return o.jsxs("button",{type:"button",className:["aw-agent-item",sn?"is-selecting":"",ct?"is-selected-for-delete":"",ee.id===$?"is-active":""].filter(Boolean).join(" "),"aria-pressed":sn?ct:void 0,onClick:()=>{if(sn){Om(ee);return}F(""),H(ee.id),D("basic")},children:[sn&&o.jsx("span",{className:`aw-select-marker${ct?" is-checked":""}`,"aria-hidden":"true"}),o.jsxs("span",{className:"aw-agent-copy",children:[o.jsxs("span",{className:"aw-agent-name-row",children:[o.jsx("strong",{children:ee.draft.name||"未命名 Agent"}),o.jsx("span",{className:`aw-draft-badge${(De==null?void 0:De.status)==="running"?" is-deploying":""}`,children:(De==null?void 0:De.status)==="running"?"部署中":"草稿"})]}),o.jsx("small",{children:ee.deploymentTarget?"待更新":"尚未发布"})]}),o.jsx(wv,{"aria-hidden":!0})]},ee.id)}),Ye.map(ee=>{const ve=ee.runtimeId?Zl.get(ee.runtimeId):void 0,De=ee.runtimeId?Yl.get(ee.runtimeId):void 0,ct=sr.has(ee.id),Mt=ee.canDelete===!0,Xe=(ve==null?void 0:ve.status)==="running"?{label:"部署中",className:" is-deploying"}:(ve==null?void 0:ve.status)==="error"?{label:"失败",className:" is-error"}:(ve==null?void 0:ve.status)==="cancelled"?{label:"已取消",className:" is-muted"}:De?{label:"待更新",className:""}:null,Qn=(ve==null?void 0:ve.status)==="running"?"正在更新部署":De?"待更新":ee.remote?ee.host||"远程智能体":"本地智能体",zi=["aw-agent-item","aw-agent-item--sortable",ee.id===Q?"is-active":"",sn?"is-selecting":"",ct?"is-selected-for-delete":"",sn&&!Mt?"is-selection-disabled":"",ee.id===Le?"is-dragging":"",ee.id===Ce&&ee.id!==Le?`is-drop-target is-drop-${Ut}`:""].filter(Boolean).join(" ");return o.jsxs("button",{type:"button",draggable:!!w&&!sn,className:zi,"aria-pressed":sn?ct:void 0,"aria-keyshortcuts":w?"Alt+ArrowUp Alt+ArrowDown":void 0,onDragStart:Cn=>{w&&(Sa.current=!0,Rt(ee.id),Cn.dataTransfer.effectAllowed="move",Cn.dataTransfer.setData("text/plain",ee.id))},onDragEnter:Cn=>{YE(Cn,ee.id)},onDragOver:Cn=>{!Le||Le===ee.id||(Cn.preventDefault(),Cn.dataTransfer.dropEffect="move",YE(Cn,ee.id))},onDragLeave:Cn=>{const Ws=Cn.relatedTarget;Ws instanceof Node&&Cn.currentTarget.contains(Ws)||Ce===ee.id&&bt("")},onDrop:Cn=>{Cn.preventDefault();const Ws=Cn.dataTransfer.getData("text/plain")||Le;AO(Ws,ee.id,Ut),Rt(""),bt(""),lt("before")},onDragEnd:()=>{Rt(""),bt(""),lt("before"),window.setTimeout(()=>{Sa.current=!1},0)},onKeyDown:Cn=>{Cn.altKey&&(Cn.key==="ArrowUp"?(Cn.preventDefault(),ic(ee.id,-1)):Cn.key==="ArrowDown"&&(Cn.preventDefault(),ic(ee.id,1)))},onClick:Cn=>{if(sn){Cn.preventDefault(),RR(ee);return}if(Sa.current){Cn.preventDefault(),Sa.current=!1;return}H(""),F(ee.id),D("basic"),k(ee.id)},children:[sn&&o.jsx("span",{className:`aw-select-marker${ct?" is-checked":""}`,"aria-hidden":"true"}),o.jsxs("span",{className:"aw-agent-copy",children:[o.jsxs("span",{className:"aw-agent-name-row",children:[o.jsx("strong",{children:ee.label}),ee.currentVersion!=null&&o.jsxs("span",{className:"aw-version-badge",children:["v",ee.currentVersion]}),Xe&&o.jsx("span",{className:`aw-draft-badge${Xe.className}`,children:Xe.label})]}),o.jsx("small",{children:Qn})]}),o.jsx(wv,{"aria-hidden":!0})]},ee.id)})]})}),o.jsxs("div",{className:"aw-list-count",children:["共 ",I==="library"?e.length+No:Wl.length," 个"]})]}),I==="evaluation"&&J?o.jsx(Vkt,{group:J,agents:e,cases:qc,onChange:$d,onRun:C0}):I==="evaluation"?o.jsx("main",{className:"aw-main aw-empty-selection",children:o.jsx("p",{children:"未选择评测组"})}):!se&&!Tn&&!Xn?o.jsx("main",{className:"aw-main aw-empty-selection",children:o.jsx("p",{children:"未选择智能体"})}):o.jsxs("main",{className:`aw-main${Kl?" is-deploying":""}${O?" resource-page":""}`,children:[se&&!Kn&&s&&o.jsx("div",{className:"aw-detail-loading",role:"status","aria-live":"polite",children:o.jsxs("div",{className:"aw-detail-loading-card",children:[o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),o.jsxs("span",{children:[o.jsx("strong",{children:"正在加载智能体"}),o.jsx("small",{children:"正在读取配置与运行信息…"})]})]})}),N==="integrations"&&ce&&o.jsx("div",{className:"aw-detail-loading",role:"status","aria-live":"polite",children:o.jsxs("div",{className:"aw-detail-loading-card",children:[o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),o.jsxs("span",{children:[o.jsx("strong",{children:"正在探测接入方式"}),o.jsx("small",{children:"正在确认 API Server 与 A2A…"})]})]})}),o.jsx(hE,{className:"aw-agent-detail",title:ts,description:Gn.description||(s||O&&!_t?"正在读取智能体信息…":"暂无描述"),identitySeed:ts,backLabel:"返回智能体列表",onBack:O?v:void 0,meta:o.jsxs(o.Fragment,{children:[Jl!=null&&o.jsxs("span",{className:"aw-agent-meta",children:["v",Jl]}),Tn&&o.jsx("span",{className:"aw-agent-meta",children:"草稿"}),Va&&o.jsx("span",{className:"aw-agent-meta",children:"待更新"}),!se&&!Tn&&Xn&&o.jsx("span",{className:"aw-agent-meta",children:Xn.label})]}),actionsClassName:"aw-head-actions",bodyClassName:"aw-agent-detail__body",actions:Tn||Va||se!=null&&se.canDelete?o.jsxs(o.Fragment,{children:[(Tn||Va)&&o.jsxs(Nt,{type:"button",color:"danger",variant:"soft",size:"lg",pill:!1,onClick:()=>{const ee=Tn??Va;ee&&NO(ee)},disabled:rn,"aria-label":"删除草稿",title:"删除草稿",children:[o.jsx(Up,{"aria-hidden":!0}),o.jsx("span",{children:"删除草稿"})]}),(se==null?void 0:se.canDelete)&&o.jsxs(Nt,{type:"button",color:"danger",variant:"soft",size:"lg",pill:!1,onClick:()=>void MR(se),disabled:rn,"aria-label":"删除 Agent",title:"删除 Agent",children:[o.jsx(Up,{"aria-hidden":!0}),o.jsx("span",{children:rn?"删除中…":"删除 Agent"})]})]}):void 0,sections:Md.map(ee=>{var ve,De,ct,Mt;return{key:ee.id,label:ee.label,disabled:Kl,content:ee.id===N?o.jsxs(o.Fragment,{children:[Jt&&Ds&&o.jsx("div",{className:`aw-detail-deployment${Kl?" is-running":""}`,children:o.jsx(Bkt,{task:Jt,onReturnToEdit:kh&&L?()=>L(kh):void 0})}),o.jsxs("div",{className:"aw-content",children:[N==="basic"&&o.jsxs("div",{className:"aw-basic-stack",children:[Ht&&o.jsx(zg,{className:"aw-detail-fetch-alert",color:"warning",variant:"soft",title:"部分信息暂不可用",description:"当前 Runtime 暂不支持 Studio 详情接口。升级 Runtime 后可查看完整信息。"}),($e&&!Ht||ye)&&o.jsx(zg,{className:"aw-detail-fetch-alert",color:"danger",variant:"soft",title:"详情加载失败",description:"暂时无法读取完整的 Agent 或 Runtime 信息,请稍后重试。",actions:o.jsx(Nt,{type:"button",color:"danger",variant:"soft",size:"sm",pill:!1,onClick:()=>we(Xe=>Xe+1),children:"重试"})}),se&&an&&!an.canUpdate&&o.jsxs("div",{className:"aw-update-recovery-notice",role:an.recoveryStatus==="preparing"?"status":"alert",children:[o.jsx("strong",{children:an.recoveryStatus==="preparing"?"正在后台恢复更新配置":"已检测到运行中的智能体,但原发布配置不可恢复"}),an.reason&&o.jsx("span",{children:an.reason}),an.warnings.map(Xe=>o.jsx("span",{children:Xe},Xe))]}),o.jsxs("section",{className:"aw-deployment-panel aw-settings-card",children:[o.jsx("div",{className:"aw-section-head",children:o.jsxs("div",{children:[o.jsx("h3",{children:"部署配置"}),o.jsx("p",{children:"配置目标环境与网络访问方式。"})]})}),o.jsxs("dl",{className:"aw-readonly-config",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"运行状态"}),o.jsxs("dd",{className:(z==null?void 0:z.status.toLowerCase())==="ready"?"is-ready":void 0,children:[(z==null?void 0:z.status.toLowerCase())==="ready"&&o.jsx("span",{className:"aw-status-dot"}),(z==null?void 0:z.status)||"读取中…"]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"部署区域"}),o.jsx("dd",{children:(z==null?void 0:z.region)||(se==null?void 0:se.region)||(Jt==null?void 0:Jt.region)||"暂未提供"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"网络访问"}),o.jsx("dd",{children:z!=null&&z.networkTypes.length?z.networkTypes.join(" / "):"暂未提供"})]})]})]}),o.jsxs("section",{className:"aw-canvas-card",children:[o.jsx("div",{className:"aw-card-head",children:o.jsx("strong",{children:"执行流程"})}),o.jsx("div",{className:"aw-canvas",children:o.jsx(Qw,{draft:Gn,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0},T0)})]}),o.jsxs("section",{className:"aw-details-card",children:[o.jsx("div",{className:"aw-card-head",children:o.jsx("strong",{children:"详细信息"})}),o.jsxs("dl",{className:"aw-facts",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"模型"}),o.jsx("dd",{children:F7(Kn==null?void 0:Kn.model)||Gn.modelName||"暂未提供"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"智能体数量"}),o.jsx("dd",{children:Kn!=null&&Kn.graph?bve(Kn.graph):yve(Gn)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"工具"}),o.jsx("dd",{className:"aw-fact-badges",children:Gr.length?Gr.map(Xe=>o.jsx("span",{children:Xe},Xe)):"暂无"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"技能"}),o.jsx("dd",{className:"aw-fact-badges",children:Bn===null?"暂不支持预览":Bn.length?Bn.map(Xe=>o.jsx("span",{children:Xe},Xe)):"暂无"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"当前版本"}),o.jsx("dd",{children:Jl!=null?`v${Jl}`:"暂未提供"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"状态"}),o.jsx("dd",{children:Tn?"草稿":(Jt==null?void 0:Jt.status)==="error"?"部署失败":(Jt==null?void 0:Jt.status)==="cancelled"?"已取消":Va?"待更新":o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"aw-status-dot"}),"可用"]})})]})]})]}),o.jsxs("section",{className:"aw-sidecar-panel aw-settings-card","aria-label":"已选择的优化项",children:[o.jsx("div",{className:"aw-section-head",children:o.jsxs("div",{children:[o.jsx("h3",{children:"已选择的优化项"}),o.jsx("p",{children:"发布时选择的智能体优化项。"})]})}),o.jsxs("dl",{className:"aw-readonly-config",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"配置状态"}),o.jsx("dd",{className:Jn!=null&&Jn.enabled?"is-ready":void 0,children:Jn?Jn.enabled?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"aw-status-dot"}),"已启用"]}):"未启用":"未记录"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"优化场景"}),o.jsx("dd",{children:Jn?hhe(Jn.profile):"旧版本未保存此配置"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"已选优化项"}),o.jsx("dd",{className:"aw-fact-badges",children:Jn?fn.length?fn.map(Xe=>o.jsx("span",{children:Av(Xe)},Xe)):"未选择":"旧版本未保存此配置"})]})]})]})]}),N==="usage"&&(se==null?void 0:se.runtimeId)&&o.jsxs("section",{className:"aw-usage","aria-busy":Vn,children:[o.jsx("div",{className:"aw-usage-intro",children:o.jsx("h3",{children:"使用概览"})}),Vn&&!ys&&o.jsx("div",{className:"aw-usage-state",role:"status","aria-live":"polite",children:o.jsx(En,{as:"span",children:"正在加载用量统计"})}),bi&&o.jsxs("div",{className:"aw-usage-state is-error",role:"alert",children:[o.jsx("span",{children:bi}),o.jsx("button",{type:"button",onClick:()=>pe(Xe=>Xe+1),children:"重试"})]}),!Vn&&!bi&&!ys&&!ti&&o.jsx("div",{className:"aw-usage-state",children:"当前 Runtime 未返回可用的 Agent 应用名称,暂时无法读取用量。"}),ys&&o.jsxs(o.Fragment,{children:[o.jsxs("dl",{className:"aw-usage-summary","aria-label":"Agent 用量摘要",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"总调用次数"}),o.jsx("dd",{children:ys.totalInvocations.toLocaleString("zh-CN")})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"使用用户数"}),o.jsx("dd",{children:ys.totalUsers.toLocaleString("zh-CN")})]})]}),o.jsxs("div",{className:"aw-usage-users-head",children:[o.jsx("h3",{children:"用户明细"}),Vn&&o.jsx(En,{as:"span",role:"status","aria-live":"polite",children:"正在刷新"})]}),ys.users.length===0?o.jsx("div",{className:"aw-usage-state",children:"暂无使用记录。用户成功调用后将在这里显示。"}):o.jsx("div",{className:"aw-usage-table-wrap",children:o.jsxs("table",{className:"aw-usage-table",children:[o.jsx("caption",{children:"当前 Agent 的使用用户列表"}),o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{scope:"col",children:"用户"}),o.jsx("th",{scope:"col",children:"调用次数"}),o.jsx("th",{scope:"col",children:"最近使用"})]})}),o.jsx("tbody",{children:ys.users.map(Xe=>o.jsxs("tr",{children:[o.jsxs("td",{children:[o.jsx("strong",{children:Xe.displayName||Xe.userId||"未知用户"}),Xe.displayName&&Xe.userId&&o.jsx("small",{title:Xe.userId,children:Xe.userId})]}),o.jsx("td",{children:Xe.invocationCount.toLocaleString("zh-CN")}),o.jsx("td",{children:o.jsx("time",{dateTime:Xe.lastUsedAt,children:ykt(Xe.lastUsedAt)})})]},Xe.userId))})]})}),ys.totalPages>1&&o.jsxs("nav",{className:"aw-usage-pagination","aria-label":"用量用户列表分页",children:[o.jsx("button",{type:"button",disabled:Vn||ys.page<=1,onClick:()=>Gs(Xe=>Math.max(1,Xe-1)),children:"上一页"}),o.jsxs("span",{"aria-live":"polite",children:["第 ",ys.page," / ",ys.totalPages," 页"]}),o.jsx("button",{type:"button",disabled:Vn||ys.page>=ys.totalPages,onClick:()=>Gs(Xe=>Xe+1),children:"下一页"})]})]})]}),N==="versions"&&o.jsxs("section",{className:"aw-version-stack",children:[o.jsxs("div",{className:"aw-integration-intro",children:[o.jsx("h3",{children:"GitHub 交付版本"}),o.jsx("p",{children:(ve=Se==null?void 0:Se.cicd)!=null&&ve.enabled?"展示当前 Runtime 绑定 GitHub 后由 Studio 记录的版本与 PR。":"未挂载 GitHub 时仅展示 Studio 当前版本。"})]}),nt&&o.jsx("div",{className:"aw-case-empty",children:"正在读取版本…"}),re&&o.jsxs("div",{className:"aw-integration-error",role:"alert",children:[o.jsx("span",{children:re}),(se==null?void 0:se.runtimeId)&&o.jsx("button",{type:"button",onClick:()=>void z_(se.runtimeId??"").then(ke),children:"重试"})]}),!nt&&!re&&o.jsxs("div",{className:"aw-version-list",children:[(Se==null?void 0:Se.githubSyncError)&&o.jsx("div",{className:"aw-integration-error",role:"alert",children:o.jsx("span",{children:Se.githubSyncError})}),(Se==null?void 0:Se.latestSourceRuntimeStatus)&&Se.latestSourceRuntimeStatus!=="published"&&((De=Se.versions[0])==null?void 0:De.commitSha)&&Se.versions[0].commitSha!==Se.currentCommitSha&&o.jsx("div",{className:"aw-integration-notice",role:"status",children:o.jsxs("span",{children:["源码已合入 main,Runtime 仍在",mJ(Se.latestSourceRuntimeStatus),";当前线上版本保持在最近一次发布成功的版本。"]})}),Se!=null&&Se.versions.length?Se.versions.map(Xe=>{var Ri;const Qn=Xe.commitSha??"",zi=Xe.runtimeStatus??Xe.status,Cn=Xe.changeType==="rollback",Ws=!!((Ri=Se.cicd)!=null&&Ri.enabled)&&!!Qn&&!Cn&&Qn!==Se.currentCommitSha;return o.jsxs("article",{className:"aw-version-row",children:[o.jsxs("div",{children:[o.jsx("strong",{children:xkt(Xe)}),o.jsx("small",{children:Xe.createdAt||"暂无时间"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"PR 链接"}),Xe.pullRequestUrl?o.jsx("a",{href:Xe.pullRequestUrl,target:"_blank",rel:"noopener noreferrer",children:"查看 PR"}):o.jsx("em",{children:"无 PR"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"提交人"}),o.jsx("em",{children:Xe.author||"Studio"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"发布状态"}),o.jsx("em",{children:mJ(zi)})]}),o.jsxs("div",{className:"aw-version-actions",children:[o.jsx("button",{type:"button",disabled:!Ws||Pe===Qn,onClick:()=>void _h(Xe),children:Pe===Qn?"回退中…":"回退到此版本"}),Xe.workflowRunUrl&&o.jsx("a",{href:Xe.workflowRunUrl,target:"_blank",rel:"noopener noreferrer",children:"查看发布"})]})]},`${Xe.version}-${Qn||Xe.createdAt}`)}):o.jsxs("article",{className:"aw-version-row",children:[o.jsxs("div",{children:[o.jsx("strong",{children:Jl!=null?`v${Jl}`:"暂无版本"}),o.jsx("small",{children:(z==null?void 0:z.updatedAt)||"暂无时间"})]}),o.jsx("p",{children:"未挂载 GitHub 时仅展示 Studio 当前版本。"})]})]})]}),N==="integrations"&&o.jsxs("div",{className:"aw-integration-stack",children:[o.jsxs("div",{className:"aw-integration-intro",children:[o.jsx("h3",{children:"接入方式"}),o.jsx("p",{children:"仅展示当前 Runtime 可确认的公开协议与地址。"})]}),ie&&o.jsxs("div",{className:"aw-integration-error",role:"alert",children:[o.jsx("span",{children:ie}),o.jsx("button",{type:"button",onClick:()=>K(Xe=>Xe+1),children:"重试"})]}),!ie&&o.jsxs("div",{className:"aw-integration-body",children:[o.jsxs("div",{className:`aw-integration-protocol-tabs${de==="a2a"?" is-a2a":""}`,role:"tablist","aria-label":"接入协议",children:[o.jsx("span",{className:"aw-integration-protocol-slider","aria-hidden":"true"}),vx.map((Xe,Qn)=>o.jsx("button",{type:"button",id:`integration-${Xe.id}-tab`,role:"tab","aria-selected":de===Xe.id,"aria-controls":`integration-${Xe.id}-panel`,tabIndex:de===Xe.id?0:-1,onClick:()=>Ea(Xe.id),onKeyDown:zi=>{var Ri;if(!["ArrowLeft","ArrowRight","Home","End"].includes(zi.key))return;zi.preventDefault();const Cn=zi.key==="Home"?0:zi.key==="End"?vx.length-1:(Qn+(zi.key==="ArrowRight"?1:-1)+vx.length)%vx.length,Ws=vx[Cn];Ea(Ws.id),(Ri=document.getElementById(`integration-${Ws.id}-tab`))==null||Ri.focus()},children:Xe.label},Xe.id))]}),de==="api-server"?o.jsx(bJ,{protocol:"api-server",title:"API Server",available:Ze,fields:[{label:"Agent",value:Ze?((ct=oe==null?void 0:oe.apiApps)==null?void 0:ct.join("、"))??"":""},{label:"发现接口",value:Ze?IP(Xt,"/list-apps"):""},{label:"调用接口",value:Ze?IP(Xt,"/run_sse"):""},{label:"鉴权方式",value:Ze?pJ(z==null?void 0:z.authType):""},{label:"API Key",value:o.jsx(gJ,{available:Ze,authType:z==null?void 0:z.authType,value:Os,visible:He&&!!Os,loading:Te,error:he,onToggle:()=>void Du()})}],example:Ze?vkt(Xt,gn,z==null?void 0:z.authType):""}):o.jsx(bJ,{protocol:"a2a",title:"A2A",available:yt,fields:[{label:"Agent",value:((Mt=oe==null?void 0:oe.a2a)==null?void 0:Mt.name)??""},{label:"Agent Card",value:yt?IP(Xt,"/.well-known/agent-card.json"):""},{label:"调用地址",value:tn},{label:"鉴权方式",value:yt?pJ(z==null?void 0:z.authType):""},{label:"API Key",value:o.jsx(gJ,{available:yt,authType:z==null?void 0:z.authType,value:Os,visible:He&&!!Os,loading:Te,error:he,onToggle:()=>void Du()})}],example:yt?wkt(tn,z==null?void 0:z.authType):""})]})]}),N==="evaluations"&&o.jsxs("section",{className:"aw-cases",children:[(se==null?void 0:se.runtimeId)&&o.jsx("div",{className:"aw-case-summary",children:["good","bad"].map(Xe=>{const Qn=Nkt(Lr,Xe),zi=qc.filter(Ws=>Ws.kind===Xe).length,Cn=ec?zi:(Qn==null?void 0:Qn.itemCount)??zi;return o.jsxs("button",{type:"button",onClick:()=>Ld(Xe),children:[o.jsx("strong",{children:Cn}),o.jsx("span",{children:Xe==="good"?"Good cases":"Bad cases"})]},Xe)})}),o.jsxs("div",{className:"aw-case-filter-bar",children:[o.jsxs("div",{className:"aw-case-filter-stack",children:[o.jsx("div",{className:"aw-case-filters","aria-label":"案例结果筛选",children:["good","bad"].map(Xe=>o.jsx("button",{type:"button",className:Tt===Xe?"is-active":"","aria-pressed":Tt===Xe,onClick:()=>Pt(Xe),children:Xe==="good"?"Good case":"Bad case"},Xe))}),o.jsx("div",{className:"aw-case-source-filters","aria-label":"回流方式筛选",children:["auto","user"].map(Xe=>o.jsx("button",{type:"button",className:le===Xe?"is-active":"","aria-pressed":le===Xe,onClick:()=>Wt(Xe),children:Xe==="auto"?"自动回流":"手动回流"},Xe))})]}),o.jsxs("label",{className:"aw-case-search",children:[o.jsx(gC,{"aria-hidden":!0}),o.jsx("input",{type:"search",value:nn,onChange:Xe=>ln(Xe.currentTarget.value),placeholder:"搜索用户输入、期望行为或标签","aria-label":"搜索评测案例"})]})]}),Xc&&o.jsx("div",{className:`aw-case-toolbar${Be?" is-active":""}`,children:Be?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"aw-selection-count",children:["已选 ",jo.length," 条"]}),o.jsx("button",{type:"button",onClick:Et,disabled:tc.length===0||Dr,children:"全选当前"}),o.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void $r(jo),disabled:jo.length===0||Dr,children:Dr?"删除中…":"删除所选"}),o.jsx("button",{type:"button",onClick:nc,disabled:Dr,children:"取消"})]}):o.jsx("button",{type:"button",onClick:()=>{va(""),Dt(!0)},disabled:tc.length===0||Dr,children:"选择案例"})}),so&&o.jsx("div",{className:"aw-delete-error",role:"alert",children:so}),o.jsx("div",{ref:Dd,children:o.jsx(zkt,{cases:tc,loading:Kr&&tc.length===0,error:qr,notice:li,runtimeBacked:!!(se!=null&&se.runtimeId),selectionMode:Be,selectedCaseIds:kt,focusedCaseId:Is,expandedCaseIds:Id,deleting:Dr,canDelete:Xc,onOpenCase:rc,onToggleCase:ym,onToggleExpanded:Si,onDeleteCase:Xe=>void $r([Xe]),onRetry:()=>ra(Xe=>Xe+1)})})]}),N==="optimizations"&&o.jsxs("section",{className:"aw-optimizations",children:[o.jsxs("div",{className:"aw-optimization-intro",children:[o.jsx("h3",{children:"优化项"}),o.jsx("p",{children:"根据评测结果汇总需要优先处理的改进建议。"})]}),gs?o.jsxs("div",{className:"aw-optimization-state",role:"status",children:[o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),o.jsx("span",{children:"正在读取优化项"})]}):xa?o.jsxs("div",{className:"aw-optimization-state is-error",role:"alert",children:[o.jsx("span",{children:xa}),o.jsx("button",{type:"button",onClick:()=>Ua(Xe=>Xe+1),children:"重试"})]}):ms.length>0?o.jsx(Ukt,{groups:ms}):o.jsx("div",{className:"aw-optimization-state",children:"暂无优化项,自动评测完成后会在这里生成建议。"})]})]}),N==="basic"&&(se||Tn)&&o.jsxs("div",{className:"aw-basic-actions",children:[se&&o.jsxs("button",{type:"button",className:"aw-talk studio-update-action",onClick:()=>_==null?void 0:_(se),children:[o.jsx(eIe,{"aria-hidden":!0}),o.jsx("span",{children:"去对话"})]}),o.jsxs("span",{className:`aw-update-wrap${Bt?" is-disabled":""}`,tabIndex:Bt?0:void 0,"aria-describedby":Bt?hn:void 0,children:[o.jsx("button",{type:"button",className:"aw-update studio-update-action",disabled:!!Bt,"aria-busy":rt||void 0,"aria-describedby":Bt?hn:void 0,onClick:()=>Tn?L==null?void 0:L(Tn):an?j(an):void 0,children:rt?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"loading-gap-spinner aw-update-spinner","aria-hidden":"true"}),o.jsx("span",{children:"准备中"})]}):Tn||Va?"继续编辑":"更新"}),Bt&&o.jsx("span",{id:hn,className:"aw-update-disabled-reason",role:"tooltip",children:Bt})]})]})]}):null}}),activeSectionKey:N,navigationLabel:"智能体详情",onSectionChange:D})]})]}),I==="evaluation"&&o.jsx("div",{className:"aw-evaluation-glass",role:"status",children:o.jsx("span",{children:"敬请期待"})})]})]}),ar&&o.jsx(zl,{variant:"danger",title:ar.title,description:ar.description,confirmLabel:rn?"删除中...":ar.confirmLabel,closeLabel:"关闭删除确认",busy:rn,onCancel:()=>Vr(null),onConfirm:()=>void PR()})]})}function Ukt({groups:e}){return o.jsx("div",{className:"aw-optimization-table-wrap",children:o.jsxs("table",{className:"aw-optimization-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{scope:"col",children:"修复优先级"}),o.jsx("th",{scope:"col",children:"建议优化模块"}),o.jsx("th",{scope:"col",children:"优化建议和理由"})]})}),o.jsx("tbody",{children:e.map(t=>o.jsxs("tr",{children:[o.jsx("td",{children:o.jsx("span",{className:`aw-priority is-${t.priority}`,children:Tkt(t.priority)})}),o.jsx("td",{children:o.jsx("span",{className:"aw-optimization-module",children:Akt(t)})}),o.jsx("td",{children:o.jsx("ul",{className:"aw-optimization-list",children:t.items.map(n=>o.jsxs("li",{children:[o.jsx("strong",{children:n.suggestion}),o.jsx("p",{children:n.reason})]},`${n.suggestion}:${n.reason}`))})})]},`${t.priority}:${t.module}:${t.customModule??""}`))})]})})}function Fkt(){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M4.5 7h15"}),o.jsx("path",{d:"M9 7V4.8h6V7"}),o.jsx("path",{d:"m6.5 7 .8 12h9.4l.8-12"}),o.jsx("path",{d:"M10 10.5v5M14 10.5v5"})]})}function zkt({cases:e,loading:t=!1,error:n="",notice:r="",runtimeBacked:i=!1,selectionMode:s=!1,selectedCaseIds:a,focusedCaseId:l="",expandedCaseIds:c,deleting:u=!1,canDelete:d=!1,onOpenCase:f,onToggleCase:h,onToggleExpanded:m,onDeleteCase:g,onRetry:b}){return o.jsxs("div",{className:"aw-case-table",children:[o.jsxs("div",{className:"aw-case-row aw-case-row-head",children:[o.jsx("span",{children:"用户输入"}),o.jsx("span",{children:"Agent 输出"}),o.jsx("span",{children:"评分"}),o.jsx("span",{children:"评分理由"}),o.jsx("span",{className:"aw-case-action-head",children:"操作"})]}),t?o.jsx("div",{className:"aw-case-empty",children:"正在读取 AgentKit 评测集…"}):n?o.jsxs("div",{className:"aw-case-empty aw-case-error",children:[o.jsx("span",{children:n}),b&&o.jsx("button",{type:"button",onClick:b,children:"重试"})]}):r?o.jsx("div",{className:"aw-case-empty",children:r}):e.length===0?o.jsx("div",{className:"aw-case-empty",children:i?"暂无用户反馈案例":"没有匹配的案例"}):e.map(y=>{var _,C;const O=y.id.startsWith("local:"),v=(a==null?void 0:a.has(y.id))??!1,x=(c==null?void 0:c.has(y.id))??!1,S=y.output.length+y.referenceOutput.length>220||(((_=y.reason)==null?void 0:_.length)??0)>120,E=d&&!O,k=!!(y.comment&&y.comment.trim()!==((C=y.reason)==null?void 0:C.trim()));return o.jsxs("div",{className:["aw-case-row",l===y.id?"is-focused":"",s?"is-selecting":"",v?"is-selected-for-delete":""].filter(Boolean).join(" "),role:"row",tabIndex:0,"aria-selected":s?v:void 0,onClick:()=>{if(s){E&&(h==null||h(y));return}f==null||f(y)},onKeyDown:T=>{T.target===T.currentTarget&&(T.key!=="Enter"&&T.key!==" "||(T.preventDefault(),s?E&&(h==null||h(y)):f==null||f(y)))},children:[o.jsxs("div",{className:"aw-case-text aw-case-cell","data-label":"用户输入",children:[o.jsxs("span",{className:"aw-case-title-line",children:[s&&E&&o.jsx("span",{className:`aw-select-marker${v?" is-checked":""}`,"aria-hidden":"true"}),o.jsx("strong",{title:y.input,children:y.input||"无用户输入"})]}),k&&o.jsxs("small",{title:y.comment,children:["备注:",y.comment]}),o.jsx("small",{className:"aw-case-time",children:kkt(y.createdAt)}),(y.userId||y.sessionId)&&o.jsx("small",{title:[y.userId,y.sessionId].filter(Boolean).join(" · "),children:[y.userId,y.sessionId].filter(Boolean).join(" · ")})]}),o.jsxs("div",{className:`aw-case-output aw-case-cell${x?" is-expanded":""}`,"data-label":"Agent 输出",children:[o.jsx("p",{className:"aw-case-output-preview",title:y.output,children:y.output||"无可见回复"}),y.referenceOutput&&o.jsxs("small",{className:"aw-case-output-preview",title:y.referenceOutput,children:["Reference: ",y.referenceOutput]}),S&&o.jsx("button",{type:"button",className:"aw-case-expand",onClick:T=>{T.stopPropagation(),m==null||m(y.id)},children:x?"收起":"展开"})]}),o.jsx("div",{className:"aw-case-score aw-case-cell","data-label":"评分",children:_kt(y)}),o.jsx("div",{className:`aw-case-reason aw-case-cell${x?" is-expanded":""}`,"data-label":"评分理由",children:o.jsx("p",{title:y.reason||void 0,children:y.reason||"—"})}),o.jsx("div",{className:"aw-case-actions aw-case-cell","data-label":"操作",children:E&&o.jsx("button",{type:"button",className:"aw-case-delete",onClick:T=>{T.stopPropagation(),g==null||g(y)},disabled:u,title:"删除反馈案例","aria-label":"删除反馈案例",children:o.jsx(Fkt,{})})})]},y.id)})]})}function Vkt({group:e,agents:t,cases:n,onChange:r,onRun:i}){const[s,a]=p.useState("config"),l=e.agentIds.map(f=>t.find(h=>h.id===f)).filter(f=>!!f),c=["回答质量","事实准确性","工具调用","响应效率"];p.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 o.jsxs("main",{className:"aw-main",children:[o.jsxs("div",{className:"aw-eval-head",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"aw-agent-title-row",children:[o.jsx("h2",{children:e.name}),o.jsx("span",{children:"评测组"})]}),o.jsxs("p",{children:[l.length," 个参评智能体 · ",e.caseSet," · ",e.history.length," 次运行"]})]}),o.jsxs("button",{type:"button",className:"aw-run",onClick:()=>i(e),disabled:!0,children:[o.jsx(XRe,{"aria-hidden":!0}),"开始评测"]})]}),o.jsxs("nav",{className:"aw-agent-tabs","aria-label":"评测组详情",children:[o.jsx("button",{type:"button",className:s==="config"?"is-active":"","aria-pressed":s==="config",onClick:()=>a("config"),disabled:!0,children:"评测配置"}),o.jsx("button",{type:"button",className:s==="history"?"is-active":"","aria-pressed":s==="history",onClick:()=>a("history"),disabled:!0,children:"历史结果"})]}),o.jsx("div",{className:"aw-content",children:s==="config"?o.jsxs("div",{className:"aw-eval-setup",children:[o.jsxs("section",{className:"aw-eval-block",children:[o.jsxs("div",{className:"aw-card-head",children:[o.jsx("strong",{children:"参评智能体"}),o.jsxs("span",{children:["已选择 ",l.length," 个"]})]}),o.jsx("div",{className:"aw-eval-agent-grid",children:t.map(f=>o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:e.agentIds.includes(f.id),onChange:()=>u(f.id)}),o.jsxs("span",{children:[o.jsx("strong",{children:f.label}),o.jsx("small",{children:f.remote?"远程":"本地"})]})]},f.id))})]}),o.jsxs("div",{className:"aw-eval-setting-grid",children:[o.jsxs("section",{className:"aw-eval-block",children:[o.jsx("div",{className:"aw-card-head",children:o.jsx("strong",{children:"评测资源"})}),o.jsxs("div",{className:"aw-eval-fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:"评测集"}),o.jsxs("select",{value:e.caseSet,onChange:f=>r({...e,caseSet:f.currentTarget.value}),children:[o.jsx("option",{children:"核心回归集"}),o.jsx("option",{children:"安全边界集"}),o.jsx("option",{children:"工具调用集"})]}),o.jsxs("small",{children:[n.length," 条案例"]})]}),o.jsxs("label",{children:[o.jsx("span",{children:"评估器"}),o.jsxs("select",{value:e.evaluator,onChange:f=>r({...e,evaluator:f.currentTarget.value}),children:[o.jsx("option",{children:"综合质量评估器"}),o.jsx("option",{children:"事实一致性评估器"}),o.jsx("option",{children:"工具调用评估器"})]})]}),o.jsxs("label",{children:[o.jsx("span",{children:"并发数"}),o.jsxs("select",{value:e.concurrency,onChange:f=>r({...e,concurrency:f.currentTarget.value}),children:[o.jsx("option",{value:"2",children:"2"}),o.jsx("option",{value:"4",children:"4"}),o.jsx("option",{value:"8",children:"8"})]})]})]})]}),o.jsxs("section",{className:"aw-eval-block",children:[o.jsxs("div",{className:"aw-card-head",children:[o.jsx("strong",{children:"评测指标"}),o.jsxs("span",{children:["已选择 ",e.metrics.length," 项"]})]}),o.jsx("div",{className:"aw-metric-list",children:c.map(f=>o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:e.metrics.includes(f),onChange:()=>d(f)}),o.jsx("span",{children:f})]},f))})]})]})]}):o.jsxs("section",{className:"aw-eval-history",children:[o.jsx("div",{className:"aw-section-head",children:o.jsxs("div",{children:[o.jsx("h3",{children:"历史结果"}),o.jsx("p",{children:"查看该评测组历次运行的总体表现。"})]})}),e.history.length===0?o.jsxs("div",{className:"aw-results-empty",children:[o.jsx("strong",{children:"暂无历史结果"}),o.jsx("span",{children:"完成首次评测后,结果会出现在这里。"})]}):o.jsx("div",{className:"aw-history-list",children:e.history.map((f,h)=>o.jsxs("button",{type:"button",children:[o.jsxs("span",{children:[o.jsxs("strong",{children:["评测运行 #",e.history.length-h]}),o.jsxs("small",{children:[f.createdAt," · ",l.length," 个智能体"]})]}),o.jsxs("span",{className:"aw-history-score",children:[o.jsx("strong",{children:f.score}),o.jsx("small",{children:"综合得分"})]}),o.jsxs("span",{className:"aw-complete",children:[o.jsx(Eu,{}),"已完成"]}),o.jsx(wv,{"aria-hidden":!0})]},f.id))})]})})]})}const Hkt=5e3,qkt=4;let DP=0;const OJ=[];function xJ(e){return e instanceof Error&&e.name==="AbortError"}function Xkt(e){return e instanceof Error&&e.name==="TimeoutError"}function Gkt(e){return Xkt(e)||e instanceof w9&&[500,502,503,504].includes(e.status)}function Wkt(e,t){return t!=null&&t.aborted?Promise.reject(t.reason??new DOMException("Request aborted","AbortError")):new Promise((n,r)=>{const i=()=>{globalThis.clearTimeout(s),r((t==null?void 0:t.reason)??new DOMException("Request aborted","AbortError"))},s=globalThis.setTimeout(()=>{t==null||t.removeEventListener("abort",i),n()},e);t==null||t.addEventListener("abort",i,{once:!0})})}async function Ykt(e={},t={}){const n=t.request??H1,r=t.wait??Wkt;try{return await n(e)}catch(i){if(!Gkt(i))throw i;return await r(Hkt,e.signal),n(e)}}async function wve(e){var t;DP>=qkt&&await new Promise(n=>OJ.push(n)),DP+=1;try{return await e()}finally{DP-=1,(t=OJ.shift())==null||t()}}async function Zkt(e,t){await Promise.allSettled(e.map(n=>wve(()=>t(n))))}const Kkt="/web/sandbox/sessions",vJ="/web/sandbox/codex-project-handoff",wJ=3e4,PP=33e4,Jkt=6e4,e2t=6e5,wx=15e3,uf=6e4,t2t=33e4,SJ=3e4,n2t=60*60,EJ=40;function bR(e){switch(e.trim().toLowerCase()){case"ready":return"就绪";case"wakeable":return"可唤醒";case"creating":return"创建中";case"starting":case"initializing":return"启动中";case"pending":return"等待中";case"running":return"运行中";case"failed":case"error":return"异常";case"stopped":return"已停止";case"expired":return"已过期";case"deleting":return"删除中";case"deleted":return"已删除";default:return"未知状态"}}function Xi(e){const t=new Headers(e);return t.has("Accept")||t.set("Accept","application/json"),t}class yR extends Error{constructor(n,r={}){var i;super(n);kr(this,"code");kr(this,"retryable");kr(this,"publicMessage");kr(this,"httpStatus");this.name="SandboxServiceError",this.code=r.code??"",this.retryable=r.retryable===!0,this.publicMessage=((i=r.publicMessage)==null?void 0:i.trim())||n,this.httpStatus=r.httpStatus}}function kJ(e){return e instanceof yR?e.publicMessage:e instanceof Error&&e.name==="TimeoutError"?"等待开发环境响应超时。任务可能仍在运行,请稍后重新进入当前会话查看状态。":e instanceof TypeError?"与开发环境的连接已中断。任务可能仍在运行,请稍后重新进入当前会话查看状态。":"开发任务未能继续,开发环境已保留。请在当前会话重试。"}async function Gi(e,t){const n=await e.text().catch(()=>"");let r={};try{r=JSON.parse(n)}catch{const d=`${t}(HTTP ${e.status})`;return new Error(n?`${d}:${n}`:d)}const i=r.detail,s=i&&typeof i=="object"?i:r,a=i&&typeof i=="object"&&"message"in i?i.message:i??r.error??r.message,l=typeof a=="string"?a:a==null?"":JSON.stringify(a),c=`${t}(HTTP ${e.status})`,u=l?`${c}:${l}`:c;return new yR(u,{code:typeof s.code=="string"?s.code:"",retryable:s.retryable===!0,publicMessage:l||c,httpStatus:e.status})}async function _J(e,t){const n=await e.text().catch(()=>"");try{return JSON.parse(n)}catch{throw new Error(`${t} Studio 服务响应异常,请刷新后重试。`)}}function jm(e,t="codex"){if(!e.sessionId||!e.status)throw new Error("AgentKit 沙箱返回了无效的 Session 信息。");return{resourceType:"session",id:e.sessionId,toolName:t,userSessionId:e.userSessionId??"",displayName:e.displayName??"",status:e.status,createdAt:e.createdAt??"",expireAt:e.expireAt??"",persistent:e.persistent!==!1,toolType:e.toolType??"",intelligentDevelopment:e.toolName==="intelligent-development",createdBy:e.createdBy??"",region:e.region??"",isMine:e.isMine===!0,threadId:e.threadId??"",cwd:e.cwd??"",workspaceLocked:e.workspaceLocked===!0,busy:e.busy===!0,...typeof e.model=="string"?{model:e.model}:{},permissions:OR(e.permissions),...e.conversation===void 0?{}:{restoredConversation:Xm(e.conversation)}}}function TJ(e,t="codex"){if(!e.snapshotId||!e.status)throw new Error("AgentKit 沙箱返回了无效的 Snapshot 信息。");return{resourceType:"snapshot",id:e.snapshotId,snapshotId:e.snapshotId,sourceSessionId:e.sessionId??"",toolName:t,userSessionId:e.userSessionId??"",displayName:e.displayName??"",status:e.status,snapshotStatus:e.snapshotStatus??"Unknown",reason:e.reason??"",createdAt:e.createdAt??"",createdBy:e.createdBy??"",region:e.region??"",isMine:e.isMine===!0}}function CJ(e,t){if(!(t!=null&&t.autoResumeSnapshots))return e;const n=new URLSearchParams({autoResumeSnapshots:"true"});return`${e}?${n.toString()}`}const Sx={approvalPolicy:"on-request",approvalsReviewer:"user",sandboxMode:"workspace-write",networkAccess:!1};function OR(e){if(!e||typeof e!="object")return{...Sx};const t=e,n=t.approvalPolicy,r=t.approvalsReviewer,i=t.sandboxMode;return{approvalPolicy:n==="untrusted"||n==="on-request"||n==="never"?n:Sx.approvalPolicy,approvalsReviewer:r==="user"||r==="auto_review"?r:Sx.approvalsReviewer,sandboxMode:i==="read-only"||i==="workspace-write"||i==="danger-full-access"?i:Sx.sandboxMode,networkAccess:typeof t.networkAccess=="boolean"?t.networkAccess:Sx.networkAccess}}function AJ(e){if(!e||typeof e!="object")throw new Error("Sandbox 返回了无效设置。");const t=e;return{threadId:typeof t.threadId=="string"?t.threadId:"",cwd:typeof t.cwd=="string"?t.cwd:"",...typeof t.model=="string"?{model:t.model}:{},workspaceLocked:t.workspaceLocked===!0,busy:t.busy===!0,permissions:OR(t.permissions)}}function la(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function r2t(e){const t=la(e);if(!(!t||typeof t.id!="string"||!t.id))return{id:t.id,displayName:typeof t.displayName=="string"?t.displayName:t.id,description:typeof t.description=="string"?t.description:"",isDefault:t.isDefault===!0}}function i2t(e){const t=la(e);if(!(!t||typeof t.id!="string"||!t.id||typeof t.name!="string"||!t.name))return{id:t.id,name:t.name,description:typeof t.description=="string"?t.description:""}}function Sve(e){const t=la(e);if(!(!t||typeof t.id!="string"||!t.id))return{id:t.id,...typeof t.name=="string"&&t.name?{name:t.name}:{},preview:typeof t.preview=="string"?t.preview:"",cwd:typeof t.cwd=="string"?t.cwd:"",modelProvider:typeof t.modelProvider=="string"?t.modelProvider:"",createdAt:typeof t.createdAt=="number"&&Number.isFinite(t.createdAt)?t.createdAt:0,updatedAt:typeof t.updatedAt=="number"&&Number.isFinite(t.updatedAt)?t.updatedAt:0,status:typeof t.status=="string"?t.status:"unknown"}}function Xm(e){const t=la(e),n=Sve(t==null?void 0:t.thread);if(!t||!n||typeof t.threadId!="string"||!Array.isArray(t.messages))throw new Error("Sandbox 返回了无效 Thread 快照。");const r=t.messages.flatMap(i=>{const s=la(i);if(!s||typeof s.id!="string"||s.role!=="user"&&s.role!=="assistant"||typeof s.content!="string"||typeof s.timestamp!="number")return[];const a=Array.isArray(s.skillNames)?s.skillNames.filter(c=>typeof c=="string"&&!!c):[],l=Array.isArray(s.images)?s.images.flatMap(c=>{const u=la(c);return!u||typeof u.mimeType!="string"||!u.mimeType.startsWith("image/")||typeof u.data!="string"||!u.data?[]:[{mimeType:u.mimeType,data:u.data,...typeof u.name=="string"&&u.name?{name:u.name}:{},...typeof u.alt=="string"&&u.alt?{alt:u.alt}:{}}]}):[];return[{id:s.id,role:s.role,content:s.content,timestamp:s.timestamp,...a.length?{skillNames:a}:{},...l.length?{images:l}:{}}]});return{thread:n,threadId:t.threadId,messages:r,...typeof t.model=="string"?{model:t.model}:{},...typeof t.cwd=="string"?{cwd:t.cwd}:{},workspaceLocked:t.workspaceLocked===!0,permissions:OR(t.permissions)}}function U6(e){if(!e||typeof e!="object")return;const t=e;if(![t.totalTokens,t.inputTokens,t.cachedInputTokens,t.outputTokens,t.reasoningOutputTokens].some(r=>typeof r!="number"||!Number.isFinite(r)||r<0))return{totalTokens:Math.trunc(t.totalTokens),inputTokens:Math.trunc(t.inputTokens),cachedInputTokens:Math.trunc(t.cachedInputTokens),outputTokens:Math.trunc(t.outputTokens),reasoningOutputTokens:Math.trunc(t.reasoningOutputTokens)}}function s2t(e){const t=U6(e.usage);if(!t||typeof e.turnId!="string")return;const n=U6(e.threadTotal),r=e.modelContextWindow;return{turnId:e.turnId,usage:t,...n?{threadTotal:n}:{},...typeof r=="number"&&Number.isFinite(r)&&r>=0?{modelContextWindow:Math.trunc(r)}:{}}}function a2t(e){return typeof e.id!="string"||e.kind!=="command"&&e.kind!=="file"||typeof e.method!="string"?null:{id:e.id,kind:e.kind,method:e.method,...typeof e.reason=="string"?{reason:e.reason}:{},...typeof e.command=="string"?{command:e.command}:{},...typeof e.cwd=="string"?{cwd:e.cwd}:{},...typeof e.grantRoot=="string"?{grantRoot:e.grantRoot}:{},...e.changes!==void 0?{changes:e.changes}:{},...typeof e.threadId=="string"?{threadId:e.threadId}:{},...typeof e.turnId=="string"?{turnId:e.turnId}:{},...typeof e.itemId=="string"?{itemId:e.itemId}:{}}}async function o2t(e,t={}){if(!e.body)throw new Error("沙箱对话服务未返回内容。");const n=e.body.getReader(),r=new TextDecoder;let i="",s="";const a=[],l=new Map;let c,u;function d(){var b;const g=c?[...a,c]:a;(b=t.onBlocks)==null||b.call(t,g.map(y=>({...y})))}function f(g){s+=g;const b=a[a.length-1],y=a.length-1,O=[...l.values()].includes(y);(b==null?void 0:b.kind)==="text"&&!O?b.text+=g:a.push({kind:"text",text:g}),d()}function h(g){if(typeof g.id!="string"||g.kind!=="thinking"&&g.kind!=="commentary"&&g.kind!=="tool"||g.status!=="running"&&g.status!=="done")return;const b=g.status==="done";let y;if(g.kind==="thinking"){if(typeof g.text!="string"||!g.text)return;y={kind:"thinking",text:g.text,done:b}}else if(g.kind==="commentary"){if(typeof g.text!="string"||!g.text)return;y={kind:"text",text:g.text}}else{if(typeof g.name!="string"||!g.name)return;y={kind:"tool",name:g.name,args:g.args,response:g.response,done:b}}const O=l.get(g.id);O===void 0?(l.set(g.id,a.length),a.push(y)):a[O]=y,d()}function m(g){var v,x,w;let b="message";const y=[];for(const S of g.split(/\r?\n/))S.startsWith("event:")&&(b=S.slice(6).trim()),S.startsWith("data:")&&y.push(S.slice(5).trimStart());if(y.length===0)return;let O;try{O=JSON.parse(y.join(` -`))}catch{throw new Error("沙箱对话服务返回了无法解析的响应。")}if(b==="error"){const S=typeof O.message=="string"&&O.message?O.message:"沙箱对话失败,请稍后重试。";throw new yR(S,{code:typeof O.code=="string"?O.code:"",retryable:O.retryable===!0,publicMessage:S})}if(b==="progress"&&typeof O.text=="string"&&O.text&&(c={kind:"progress",text:O.text},d()),b==="activity"&&h(O),b==="development.source_ready"||b==="development.succeeded"){const S=la(O.payload),E=la(S==null?void 0:S.delivery),k=b==="development.succeeded";if(E&&typeof E.sessionId=="string"&&typeof E.artifactSha256=="string"&&typeof E.validationReportSha256=="string"&&typeof E.agentName=="string"&&typeof E.entryPoint=="string"&&typeof E.fileCount=="number"&&typeof E.artifactSize=="number"&&typeof E.validatedAt=="string"&&E.deployable===!0&&E.verified===k&&typeof E.validationSummary=="string"&&Array.isArray(E.gateSummary)&&E.gateSummary.every(_=>typeof _=="string")){const _={kind:"delivery",value:{sessionId:E.sessionId,...typeof E.projectId=="string"&&typeof E.versionId=="string"?{projectId:E.projectId,versionId:E.versionId,...E.parentVersionId===null||typeof E.parentVersionId=="string"?{parentVersionId:E.parentVersionId}:{}}:{},artifactSha256:E.artifactSha256,validationReportSha256:E.validationReportSha256,agentName:E.agentName,entryPoint:E.entryPoint,fileCount:E.fileCount,artifactSize:E.artifactSize,validatedAt:E.validatedAt,gateSummary:E.gateSummary,deployable:E.deployable,verified:E.verified,validationSummary:E.validationSummary}},C=a.findIndex(T=>T.kind==="delivery"&&T.value.sessionId===E.sessionId&&T.value.artifactSha256===E.artifactSha256&&T.value.validationReportSha256===E.validationReportSha256);C===-1?a.push(_):a[C]=_,d()}}if(b==="approval"){const S=a2t(O);S&&((v=t.onApproval)==null||v.call(t,S))}if(b==="usage"){const S=s2t(O);S&&(u=S,(x=t.onUsage)==null||x.call(t,S))}b==="approval_resolved"&&typeof O.approvalId=="string"&&((w=t.onApprovalResolved)==null||w.call(t,O.approvalId)),b==="delta"&&typeof O.text=="string"&&f(O.text),b==="done"&&!s&&typeof O.text=="string"&&f(O.text),b==="done"&&c&&(c=void 0,d())}for(;;){const{done:g,value:b}=await n.read();i+=r.decode(b,{stream:!g});const y=i.split(/\r?\n\r?\n/);if(i=y.pop()??"",y.forEach(m),g)break}if(i.trim()&&m(i),c&&(c=void 0,d()),a.length===0)throw new Error("沙箱未返回有效回复,请重试。");return{text:s,blocks:a,...u?{usage:u}:{}}}async function ml(e,t,n,{method:r="GET",body:i,options:s={},fallback:a}){if(!t)throw new Error("缺少要操作的 AgentKit Session。");const l=await In(`${e}/${encodeURIComponent(t)}/${n}`,{method:r,headers:Xi(i===void 0?void 0:{"Content-Type":"application/json"}),...i===void 0?{}:{body:JSON.stringify(i)},signal:s.signal},uf);if(!l.ok)throw await Gi(l,a);return l.json()}function Eve(e,t={}){return{async listSessions(n={}){const r=await In(CJ(e,n),{method:"GET",headers:Xi(),signal:n.signal},wJ);if(!r.ok)throw await Gi(r,"无法读取 Codex 智能体,请稍后重试。");const i=await r.json();if(!Array.isArray(i.sessions))throw new Error("AgentKit 沙箱返回了无效的 Session 列表。");if(i.snapshots!==void 0&&!Array.isArray(i.snapshots))throw new Error("AgentKit 沙箱返回了无效的 Snapshot 列表。");return[...i.sessions.map(s=>jm(s)),...(i.snapshots??[]).map(s=>TJ(s))]},async startSession(n={}){var i,s;const r=await In(e,{method:"POST",headers:Xi({"Content-Type":"application/json"}),body:JSON.stringify({displayName:((i=n.displayName)==null?void 0:i.trim())??"",...(s=n.modelId)!=null&&s.trim()?{modelId:n.modelId.trim()}:{},...t.textOnly&&n.projectId?{projectId:n.projectId,...n.baseVersionId?{baseVersionId:n.baseVersionId}:{}}:{},...t.textOnly?{}:{persistent:n.persistent??!0}}),signal:n.signal},PP);if(!r.ok)throw await Gi(r,"无法启动 AgentKit 沙箱,请稍后重试。");return jm(await r.json())},async listAgentSessions(n,r={}){const i=await In(CJ(`/web/${n}/sessions`,r),{method:"GET",headers:Xi(),signal:r.signal},wJ);if(!i.ok)throw await Gi(i,`无法读取 ${n} 智能体,请稍后重试。`);const s=await i.json();if(!Array.isArray(s.sessions))throw new Error(`AgentKit 返回了无效的 ${n} Session 列表。`);if(s.snapshots!==void 0&&!Array.isArray(s.snapshots))throw new Error(`AgentKit 返回了无效的 ${n} Snapshot 列表。`);return[...s.sessions.map(a=>jm(a,n)),...(s.snapshots??[]).map(a=>TJ(a,n))]},async startAgentSession(n,r={}){var s;const i=await In(`/web/${n}/sessions`,{method:"POST",headers:Xi({"Content-Type":"application/json"}),body:JSON.stringify({displayName:((s=r.displayName)==null?void 0:s.trim())??"",persistent:r.persistent??!0}),signal:r.signal},PP);if(!i.ok)throw await Gi(i,`无法创建 ${n} 智能体,请稍后重试。`);return jm(await i.json(),n)},async openAgentSession(n,r,i={}){if(!r)throw new Error("缺少要打开的 AgentKit Session。");const s=await In(`/web/${n}/sessions/${encodeURIComponent(r)}/open`,{method:"POST",headers:Xi(),signal:i.signal},uf);if(!s.ok)throw await Gi(s,`无法打开 ${n} 智能体。`);const a=await s.json();if(typeof a.webuiUrl!="string"||!a.webuiUrl.startsWith("/"))throw new Error(`${n} 智能体返回了无效的主页面地址。`);return{session:jm(a,n),kind:n,webuiUrl:xo(a.webuiUrl)}},async launchAgentTerminal(n,r,i={}){if(!r)throw new Error("缺少要打开 Terminal 的 AgentKit Session。");const s=await In(`/web/${n}/sessions/${encodeURIComponent(r)}/terminal`,{method:"POST",headers:Xi(),signal:i.signal},uf);if(!s.ok)throw await Gi(s,`无法打开 ${n} Terminal。`);const a=await s.json();return{url:kve(a.url,`${n} Terminal`),...typeof a.shellSessionId=="string"?{shellSessionId:a.shellSessionId}:{}}},async deleteAgentSession(n,r,i={}){if(!r)return;const s=await In(`/web/${n}/sessions/${encodeURIComponent(r)}`,{method:"DELETE",headers:Xi(),signal:i.signal},wx);if(!s.ok&&s.status!==404)throw await Gi(s,`无法删除 ${n} 智能体。`)},async resumeSnapshot(n,r,i={}){if(!r)throw new Error("缺少要唤醒的 AgentKit Snapshot。");const s=n==="codex"?"/web/sandbox":`/web/${n}`,a=await In(`${s}/snapshots/${encodeURIComponent(r)}/resume`,{method:"POST",headers:Xi(),signal:i.signal},PP);if(!a.ok)throw await Gi(a,"无法从快照唤醒智能体,请稍后重试。");return jm(await a.json(),n)},async deleteSnapshot(n,r,i={}){if(!r)return;const s=n==="codex"?"/web/sandbox":`/web/${n}`,a=await In(`${s}/snapshots/${encodeURIComponent(r)}`,{method:"DELETE",headers:Xi(),signal:i.signal},wx);if(!a.ok&&a.status!==404)throw await Gi(a,"无法删除智能体快照。")},async connectSession(n,r={}){if(!n)throw new Error("缺少要连接的 AgentKit Session。");const i=await In(`${e}/${encodeURIComponent(n)}/connect`,{method:"POST",headers:Xi({"Content-Type":"application/json"}),signal:r.signal},Jkt);if(!i.ok)throw await Gi(i,"无法连接 Codex 智能体,请稍后重试。");const s=jm(await i.json());if(s.status.toLowerCase()!=="ready")throw new Error(`AgentKit Session 尚未就绪,当前状态:${s.status}。`);return s},async sendMessage(n,r={}){var s;if(!n.sessionId||!n.text.trim())throw new Error("内置智能体会话缺少有效的消息内容。");const i=await In(`${e}/${encodeURIComponent(n.sessionId)}/messages`,{method:"POST",headers:Xi({Accept:"text/event-stream","Content-Type":"application/json"}),body:JSON.stringify({message:n.text,...!t.textOnly&&((s=n.skillIds)!=null&&s.length)?{skillIds:n.skillIds}:{}}),signal:r.signal},t.messageTimeoutMs??e2t);if(!i.ok)throw await Gi(i,"沙箱对话失败,请稍后重试。");return o2t(i,r)},async interruptSession(n,r={}){if(!n)return;const i=await In(`${e}/${encodeURIComponent(n)}/interrupt`,{method:"POST",headers:Xi(),signal:r.signal},t.interruptTimeoutMs??wx);if(!i.ok&&![404,409].includes(i.status))throw await Gi(i,"无法停止当前任务。")},async getStatus(n,r={}){const i=await ml(e,n,"status",{options:r,fallback:"无法读取 Codex 状态。"}),s=AJ(i),a=la(i),l=U6(a==null?void 0:a.threadTotal),c=a==null?void 0:a.modelContextWindow;return{...s,...l?{threadTotal:l}:{},...typeof c=="number"&&Number.isFinite(c)&&c>=0?{modelContextWindow:Math.trunc(c)}:{}}},async getEndpoint(n,r={}){const i=la(await ml(e,n,"endpoint",{options:r,fallback:"无法读取 Sandbox Endpoint。"}));if(typeof(i==null?void 0:i.endpoint)!="string"||!i.endpoint.trim())throw new Error("Sandbox 返回了无效 Endpoint。");return{endpoint:i.endpoint,sessionId:typeof i.sessionId=="string"?i.sessionId:n,...typeof i.expireAt=="string"?{expireAt:i.expireAt}:{}}},async createCodexProjectHandoffPairing(n={}){const r=await In(`${vJ}/pairings`,{method:"POST",headers:Xi({Accept:"application/json","Content-Type":"application/json"}),body:JSON.stringify({ttlSeconds:n2t}),signal:n.signal},SJ);if(!r.ok)throw await Gi(r,"无法生成 Codex 云端接力配对码。");const i=la(await _J(r,"无法生成 Codex 云端接力配对码。"));if(typeof(i==null?void 0:i.pairingCode)!="string"||!i.pairingCode.trim()||typeof i.expireAt!="string"||!i.expireAt.trim())throw new Error("Studio 返回了无效的 Codex 云端接力配对码。");const s=typeof i.studioUrl=="string"&&i.studioUrl.trim()?i.studioUrl.trim():window.location.origin;return{pairingCode:i.pairingCode,expireAt:i.expireAt,studioUrl:s}},async getCodexProjectHandoffStatus(n,r={}){const i=await In(`${vJ}/pairings/${encodeURIComponent(n)}`,{headers:Xi({Accept:"application/json"}),signal:r.signal},SJ);if(!i.ok)throw await Gi(i,"无法读取端云接力状态。");const s=la(await _J(i,"无法读取端云接力状态。")),a=new Set(["issued","creating","session-created","continuing","running","completed","failed"]);if(typeof(s==null?void 0:s.state)!="string"||!a.has(s.state)||typeof s.expireAt!="string"||!s.expireAt.trim())throw new Error("Studio 返回了无效的端云接力状态。");return{state:s.state,expireAt:s.expireAt,...typeof s.projectName=="string"?{projectName:s.projectName}:{},...typeof s.agentName=="string"?{agentName:s.agentName}:{},...typeof s.sessionId=="string"?{sessionId:s.sessionId}:{},...typeof s.error=="string"?{error:s.error}:{},...s.failedStage==="creating-session"||s.failedStage==="uploading-project"||s.failedStage==="restoring-project"||s.failedStage==="continuing-task"?{failedStage:s.failedStage}:{}}},async listModels(n,r={}){const i=la(await ml(e,n,"models",{options:r,fallback:"无法读取 Codex 模型列表。"}));if(!Array.isArray(i==null?void 0:i.models))throw new Error("Sandbox 返回了无效模型列表。");return i.models.flatMap(s=>{const a=r2t(s);return a?[a]:[]})},async setModel(n,r,i={}){const s=la(await ml(e,n,"model",{method:"PUT",body:{model:r},options:i,fallback:"无法切换 Codex 模型。"}));if(typeof(s==null?void 0:s.model)!="string"||!s.model)throw new Error("Sandbox 返回了无效模型。");return s.model},async listSkills(n,r=!1,i={}){const a=la(await ml(e,n,`skills${r?"?force_reload=true":""}`,{options:i,fallback:"无法读取 Codex Skills。"}));if(!Array.isArray(a==null?void 0:a.skills))throw new Error("Sandbox 返回了无效 Skill 列表。");return a.skills.flatMap(l=>{const c=i2t(l);return c?[c]:[]})},async listThreads(n,r={},i={}){const s=new URLSearchParams;r.cursor&&s.set("cursor",r.cursor),r.search&&s.set("search",r.search),r.archived&&s.set("archived","true");const a=s.size?`?${s}`:"",l=la(await ml(e,n,`threads${a}`,{options:i,fallback:"无法读取 Codex Thread 列表。"}));if(!Array.isArray(l==null?void 0:l.threads))throw new Error("Sandbox 返回了无效 Thread 列表。");return{threads:l.threads.flatMap(c=>{const u=Sve(c);return u?[u]:[]}),...typeof l.nextCursor=="string"?{nextCursor:l.nextCursor}:{}}},async newThread(n,r={}){return Xm(await ml(e,n,"threads/new",{method:"POST",options:r,fallback:"无法创建新的 Codex Thread。"}))},async readThread(n,r,i={}){if(!r)throw new Error("缺少要读取的 Codex Thread。");return Xm(await ml(e,n,`threads/${encodeURIComponent(r)}`,{options:i,fallback:"无法读取 Codex 历史消息。"}))},async resumeThread(n,r,i={}){return Xm(await ml(e,n,"threads/resume",{method:"POST",body:{threadId:r},options:i,fallback:"无法恢复 Codex Thread。"}))},async forkThread(n,r={}){return Xm(await ml(e,n,"threads/fork",{method:"POST",options:r,fallback:"无法分叉 Codex Thread。"}))},async archiveThread(n,r,i={}){const s=la(await ml(e,n,"threads/archive",{method:"POST",body:{threadId:r},options:i,fallback:"无法归档 Codex Thread。"}));if((s==null?void 0:s.archived)!==!0)throw new Error("Sandbox 返回了无效归档结果。");return{archived:!0,...s.thread?{snapshot:Xm(s)}:{}}},async deleteThread(n,r,i={}){const s=la(await ml(e,n,"threads/delete",{method:"POST",body:{threadId:r},options:i,fallback:"无法删除 Codex Thread。"}));if((s==null?void 0:s.deleted)!==!0)throw new Error("Sandbox 返回了无效删除结果。");return{deleted:!0,...s.thread?{snapshot:Xm(s)}:{}}},async compactThread(n,r={}){await ml(e,n,"threads/compact",{method:"POST",options:r,fallback:"无法压缩 Codex Thread。"})},async getSettings(n,r={}){const i=await In(`${e}/${encodeURIComponent(n)}/settings`,{method:"GET",headers:Xi(),signal:r.signal},uf);if(!i.ok)throw await Gi(i,"无法读取 Codex 权限与工作空间。");return AJ(await i.json())},async updatePermissions(n,r,i={}){const s=await In(`${e}/${encodeURIComponent(n)}/permissions`,{method:"PUT",headers:Xi({"Content-Type":"application/json"}),body:JSON.stringify(r),signal:i.signal},uf);if(!s.ok)throw await Gi(s,"无法更新 Codex 权限。");const a=await s.json();return OR(a.permissions)},async updateWorkspace(n,r,i={}){const s=await In(`${e}/${encodeURIComponent(n)}/workspace`,{method:"PUT",headers:Xi({"Content-Type":"application/json"}),body:JSON.stringify({cwd:r}),signal:i.signal},uf);if(!s.ok)throw await Gi(s,"无法更新 Codex 工作空间。");const a=await s.json();if(typeof a.cwd!="string"||!a.cwd)throw new Error("Sandbox 返回了无效工作目录。");return a.cwd},async listDirectories(n,r,i={}){const s=new URLSearchParams({path:r}),a=await In(`${e}/${encodeURIComponent(n)}/directories?${s}`,{method:"GET",headers:Xi(),signal:i.signal},uf);if(!a.ok)throw await Gi(a,"无法读取 Sandbox 目录。");const l=await a.json();if(typeof l.path!="string"||!Array.isArray(l.directories)||l.directories.some(c=>!c||typeof c.name!="string"||typeof c.path!="string"))throw new Error("Sandbox 返回了无效目录列表。");return{path:l.path,...typeof l.parent=="string"?{parent:l.parent}:{},directories:l.directories}},async resolveApproval(n,r,i,s={}){const a=await In(`${e}/${encodeURIComponent(n)}/approvals/${encodeURIComponent(r)}`,{method:"POST",headers:Xi({"Content-Type":"application/json"}),body:JSON.stringify({decision:i}),signal:s.signal},uf);if(!a.ok)throw await Gi(a,"无法提交 Codex 审批决定。")},async launchTerminal(n,r={}){return NJ(e,n,"terminal",r)},async launchBrowser(n,r={}){return NJ(e,n,"browser",r)},async uploadFile(n,r,i={}){const s=new FormData;s.set("file",r,r.name);const a=await In(`${e}/${encodeURIComponent(n)}/files`,{method:"POST",headers:Xi(),body:s,signal:i.signal},t2t);if(!a.ok)throw await Gi(a,"无法上传文件到 Sandbox。");const l=await a.json();if(typeof l.id!="string"||typeof l.path!="string"||typeof l.name!="string"||typeof l.mimeType!="string"||typeof l.sizeBytes!="number")throw new Error("Sandbox 返回了无效上传结果。");return l},async closeSession(n,r={}){if(!n)return;const i=await In(`${e}/${encodeURIComponent(n)}/disconnect`,{method:"POST",headers:Xi(),signal:r.signal},wx);if(!i.ok&&i.status!==404)throw await Gi(i,"无法断开 Codex 智能体连接。")},async deleteSession(n,r={}){if(!n)return;const i=await In(`${e}/${encodeURIComponent(n)}`,{method:"DELETE",headers:Xi(),signal:r.signal},wx);if(!i.ok&&i.status!==404)throw await Gi(i,"无法删除 Codex 智能体。")}}}const ui=Eve(Kkt),Uh=Eve("/web/intelligent-development/sessions",{textOnly:!0,messageTimeoutMs:36e5,interruptTimeoutMs:45e3});async function NJ(e,t,n,r){const i=await In(`${e}/${encodeURIComponent(t)}/${n}`,{method:"POST",headers:Xi(),signal:r.signal},uf);if(!i.ok)throw await Gi(i,n==="terminal"?"无法打开 Sandbox Terminal。":"无法打开 Sandbox Browser。");const s=await i.json();return{url:kve(s.url,"Sandbox 工具"),...typeof s.shellSessionId=="string"?{shellSessionId:s.shellSessionId}:{}}}function kve(e,t){if(typeof e!="string")throw new Error(`${t} 返回了无效地址。`);if(e.startsWith("/"))return xo(e);let n;try{n=new URL(e)}catch{throw new Error(`${t} 返回了无效地址。`)}const r=n.protocol==="http:"&&window.location.protocol==="http:";if(n.protocol!=="https:"&&!r)throw new Error(`${t} 返回了不安全的地址。`);return n.toString()}function eg(e,t,n){const r=e instanceof Error?`${e.name}: ${e.message}`:String(e||"未知错误");return[`${t}失败`,`详细信息:${r}`,n?`请求:${n}`:""].filter(Boolean).join(` -`)}function Cf({className:e="icon"}){return o.jsxs("svg",{className:`${e} sidebar-agent-face`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("rect",{x:"4.25",y:"5.25",width:"15.5",height:"13.5",rx:"4.75"}),o.jsx("path",{className:"sidebar-agent-face__eye",d:"M8.5 10.7v2"}),o.jsx("path",{className:"sidebar-agent-face__eye",d:"M15.5 10.7v2"})]})}function l2t(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M8.4 18.4H7.2a4.2 4.2 0 0 1-.65-8.35A5.7 5.7 0 0 1 17.3 8.2a4.6 4.6 0 0 1-.4 9.2h-3.2"}),o.jsx("path",{d:"m7.8 12.3 2 2-2 2M12.2 16.3h3.2"})]})}function c2t(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M18.9 6.25A8.4 8.4 0 1 0 19.6 16"}),o.jsx("path",{d:"M19 6.2c.1 2.1-.65 3.75-2.25 4.95-1.2.9-2.75 1.25-4.2.9"}),o.jsx("circle",{cx:"10.6",cy:"12.8",r:"2.45"}),o.jsx("path",{d:"m5.25 18.6 3.65-3.9M14.8 17.9c1.9-.45 3.55-1.65 4.65-3.35"})]})}function u2t(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M6.2 20c.55-2.15.75-4.1.75-6.7V9.8A5.35 5.35 0 0 1 12.35 4c3.35 0 5.65 2.35 5.65 5.65v4.6c0 2.35.35 4.25 1.15 5.75"}),o.jsx("path",{d:"M8.05 10.2c1.35-.6 2.2-1.65 2.55-3.15.45 1.55 1.35 2.55 2.7 3.05.1-1 .4-1.95.85-2.75.45 1.25 1.2 2.2 2.15 2.75"}),o.jsx("path",{d:"M9.3 12.65h.01M14.9 12.65h.01M10.8 15.55c.8.5 1.65.5 2.45 0"}),o.jsx("path",{d:"M8.45 19.85c.95-.85 1.45-1.95 1.5-3.25M15.1 16.65c.05 1.2.55 2.3 1.55 3.2"})]})}function d2t(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M5.2 17.2V8.1a3 3 0 0 1 3-3h7.6a3 3 0 0 1 3 3v9.1"}),o.jsx("path",{d:"M7.4 17.2h9.2M9 19.9h6"}),o.jsx("path",{d:"M9.1 9.25h5.8M9.1 12h3.1"}),o.jsx("path",{d:"m14.1 12.4 2 2.1M16.2 12.4l-2.1 2.1"})]})}function ES({kind:e,...t}){return e==="codex"?o.jsx(l2t,{...t}):e==="deepseek-harness"?o.jsx(d2t,{...t}):e==="openclaw"?o.jsx(c2t,{...t}):o.jsx(u2t,{...t})}const F6=[{id:"general",label:"通用智能体"},{id:"codex",label:"Codex"},{id:"deepseek-harness",label:"DeepSeek"},{id:"openclaw",label:"OpenClaw"},{id:"hermes",label:"Hermes"}],f2t=F6.map(({id:e,label:t})=>({value:e,label:t})),h2t=24,p2t=3e4,m2t=7e3,g2t=2e4,b2t=6,y2t=2,O2t=250,MP="正在请求 Runtime /list-apps,以确认该智能体是否支持 Studio 对话。",jJ="Runtime /list-apps 未返回可用的 Agent,暂时无法连接对话。",yp=new Map,Iy=new Map,x2t=new Set;function Rm(e){const t=e.runtime;return t?`${t.region}:${t.runtimeId}:${t.currentVersion??""}`:""}function RJ(e){const t=e instanceof Error&&e.message.trim()?e.message.trim():"Runtime /list-apps 请求失败,未返回可识别的错误信息。";return{status:e instanceof Es&&e.unsupported?"unsupported":"error",message:t}}function l_(e){if(!e){yp.clear(),Iy.clear(),KM();return}const t=new Set(e);if(t.size!==0){for(const[n,r]of Iy)r.page.runtimes.some(i=>t.has(i.runtimeId))&&Iy.delete(n);for(const n of t)KM(n);yp.clear()}}function v2t(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M8 3.25v9.5M3.25 8h9.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function w2t(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M8.313 3.646a.5.5 0 0 1 .707 0l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 1 1-.707-.708L11.46 8.5H3.333a.5.5 0 0 1 0-1h8.127L8.313 4.354a.5.5 0 0 1 0-.708Z",fill:"currentColor"})})}function S2t(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M2.75 5.25h8.75m0 0-2-2m2 2-2 2M13.25 10.75H4.5m0 0 2 2m-2-2 2-2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function E2t({type:e}){return e==="general"?o.jsx(Cf,{}):o.jsx(ES,{kind:e})}function k2t(e,t=Date.now()){return lve(e,t)}function _2t(e,t=Date.now()){const n=Date.parse(e);if(!Number.isFinite(n)||n-t<6e4)return"即将清空";const r=Math.ceil((n-t)/6e4),i=Math.floor(r/60),s=r%60;return`${i} 小时 ${s} 分钟`}function IJ(e){var t;return{id:e.runtimeId,name:e.name,description:((t=e.description)==null?void 0:t.trim())||"暂无描述",createdAt:e.createdAt??"",specificationLabel:"创建人",specification:Ige(e.author),isMine:e.isMine,runtime:{runtimeId:e.runtimeId,region:e.region,currentVersion:e.currentVersion,canDelete:e.canDelete}}}function T2t(e){return{id:e.id,name:e.displayName||`${e.toolName} 智能体`,description:bR(e.status),createdAt:e.createdAt,specificationLabel:"创建人",specification:Ige(e.createdBy),isMine:e.isMine,region:e.region,sandbox:e}}function C2t(e){var t,n;return{id:e.id,name:e.draft.name||"未命名 Agent",description:((t=e.draft.description)==null?void 0:t.trim())||"暂无描述",createdAt:new Date(e.updatedAt).toISOString(),specificationLabel:"存储位置",specification:"当前浏览器",isMine:!0,region:(n=e.deploymentTarget)==null?void 0:n.region,draft:e}}function A2t(e,t){if(!e.draft)return e;const n=e.draft.deploymentTarget;return n?t.find(r=>{var i;return((i=r.runtime)==null?void 0:i.runtimeId)===n.runtimeId&&r.runtime.region===n.region})??{id:n.runtimeId,appName:n.appName,name:n.name||e.name,description:e.description,createdAt:e.createdAt,specificationLabel:"地域",specification:n.region,isMine:!0,runtime:{runtimeId:n.runtimeId,region:n.region,currentVersion:n.currentVersion,canDelete:!1}}:null}function N2t(e,t){const n=Sd(t);return HS(e)&&n.some(r=>r.value===e)?e:Yr(t)}async function j2t(e,t,n,r,i){const s=`${e}:${t}:${n}`,a=Iy.get(s);if(a&&a.expiresAt>Date.now())return r(a.page.runtimes.map(IJ)),a.page.nextToken;a&&Iy.delete(s);let l=yp.get(s);l||(l=Ykt({scope:e,region:t,pageSize:h2t,nextToken:n,signal:i}),yp.set(s,l),l.then(()=>yp.delete(s),()=>yp.delete(s)));const c=await l;return Iy.set(s,{page:c,expiresAt:Date.now()+p2t}),r(c.runtimes.map(IJ)),c.nextToken}function R2t({agent:e,onUse:t,onViewDetails:n,onPrepareUpdate:r,compatibility:i,onRetryCompatibility:s,connecting:a,connected:l,deploymentTask:c,nowMs:u,onViewDeploymentTask:d,onEditDraft:f,onDeleteDraft:h}){var k,_,C,T;const m=(k=e.sandbox)==null?void 0:k.status.toLowerCase(),g=((_=e.sandbox)==null?void 0:_.resourceType)==="snapshot",b=!!(e.runtime||m==="ready"||m==="wakeable"),y=(i==null?void 0:i.status)==="checking",O=(i==null?void 0:i.status)==="unsupported",v=(i==null?void 0:i.status)==="error",x=((C=e.sandbox)==null?void 0:C.resourceType)==="snapshot"?e.sandbox.sourceSessionId||e.sandbox.snapshotId:(T=e.sandbox)==null?void 0:T.id,w=()=>{if(e.draft){c?d==null||d(c):n==null||n(e);return}b&&(c?d==null||d(c):n==null||n(e))},S=(e.draft||b)&&!!(c?d:n),E=e.draft?c?`查看 ${e.name} 部署进度`:`查看 ${e.name} Runtime 详情`:c?`查看 ${e.name} 部署进度`:`查看 ${e.name} 详情`;return o.jsxs(W7,{className:a?"my-agent-card is-connecting":"my-agent-card",activateLabel:S?E:void 0,onActivate:S?w:void 0,onPointerEnter:()=>r==null?void 0:r(e),onFocusCapture:()=>r==null?void 0:r(e),footer:o.jsx(Uhe,{className:"my-agent-meta",items:[{label:e.specificationLabel,value:e.specification,hideLabel:!0,className:"my-agent-region"},{label:"时间",value:k2t(e.createdAt,u),hideLabel:!0,className:"my-agent-created-at"},...e.sandbox?[{label:"剩余时间",value:e.sandbox.resourceType==="snapshot"?"可唤醒":e.sandbox.persistent?"永不过期":_2t(e.sandbox.expireAt,u),className:`my-agent-expiry${e.sandbox.resourceType==="session"&&e.sandbox.persistent?"":" is-expiring"}`}]:[]]}),actions:e.draft?o.jsxs(o.Fragment,{children:[o.jsx(q4,{"aria-label":c?`查看 ${e.name} 部署进度`:`编辑草稿 ${e.name}`,onClick:()=>c?d==null?void 0:d(c):f==null?void 0:f(e.draft),children:c?"查看进度":"编辑"}),o.jsx(q4,{tone:"danger","aria-label":`删除草稿 ${e.name}`,onClick:()=>h==null?void 0:h(e.draft),children:"删除"})]}):v||O?o.jsxs(Nt,{type:"button",color:"primary",size:"sm",pill:!1,"aria-label":`重新检测 ${e.name} 的对话兼容性`,onClick:()=>s==null?void 0:s(e),children:[o.jsx(CN,{}),"重试"]}):o.jsx(X4,{className:l?"my-agent-use is-connected":"my-agent-use",disabled:!b||y||O||a||l,"aria-busy":a||void 0,label:l?`${e.name} 已连接`:g?`唤醒 ${e.name} 并开始对话`:`与 ${e.name} 对话`,onClick:()=>void(t==null?void 0:t(e)),children:a?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-use-spinner","aria-hidden":"true"}),o.jsx("span",{className:"sr-only",children:g?"唤醒中":"连接中"})]}):o.jsx(w2t,{})}),children:[o.jsx(Y7,{leading:o.jsx(d1,{seed:e.name}),title:e.name,subtitle:e.sandbox?o.jsx("span",{className:"my-agent-session-id",title:x,children:x}):void 0,status:e.draft?c?o.jsx("span",{className:"my-agent-deploying-badge",children:"部署中"}):o.jsx("span",{className:"my-agent-draft-badge",children:"草稿"}):e.sandbox?o.jsx("span",{className:"my-agent-status-label","data-ready":e.sandbox.status.toLowerCase()==="ready"||void 0,"data-wakeable":g||void 0,children:e.description}):e.runtime&&c?o.jsx("span",{className:"my-agent-deploying-badge",children:"部署中"}):y?o.jsx(vo,{content:i==null?void 0:i.message,contentClassName:"my-agent-compatibility-tooltip",maxWidth:360,align:"end",interactive:!0,preventUnintentionalClickToClose:!0,children:o.jsx("span",{className:"my-agent-compatibility-trigger",tabIndex:0,children:o.jsxs(ta,{className:"my-agent-compatibility-status",color:"secondary",variant:"soft",size:"sm",pill:!0,children:[o.jsx("span",{className:"my-agent-compatibility-spinner","aria-hidden":"true"}),o.jsx("span",{children:"检测中"})]})})}):O?o.jsx(vo,{content:i==null?void 0:i.message,contentClassName:"my-agent-compatibility-tooltip",maxWidth:360,align:"end",interactive:!0,preventUnintentionalClickToClose:!0,children:o.jsx("span",{className:"my-agent-compatibility-trigger",tabIndex:0,children:o.jsx(ta,{className:"my-agent-compatibility-status",color:"warning",variant:"soft",size:"sm",pill:!0,children:"不支持对话"})})}):v?o.jsx(vo,{content:i==null?void 0:i.message,contentClassName:"my-agent-compatibility-tooltip",maxWidth:360,align:"end",interactive:!0,preventUnintentionalClickToClose:!0,children:o.jsx("span",{className:"my-agent-compatibility-trigger",tabIndex:0,children:o.jsx(ta,{className:"my-agent-compatibility-status",color:"danger",variant:"soft",size:"sm",pill:!0,children:"检测失败"})})}):null}),e.sandbox?null:o.jsx(Z7,{children:e.description})]})}function I2t({cloudProvider:e,studioRegion:t,canCreate:n,canUpdate:r,runtimeScope:i,onCreateAgent:s,onOpenCodexProjectUpload:a,onUseAgent:l,onViewAgentDetails:c,onCreateSandboxAgent:u,onUseSandboxAgent:d,onViewSandboxAgentDetails:f,activeType:h,onActiveTypeChange:m,sandboxRefreshKey:g=0,connectedRuntimeId:b="",hiddenRuntimeIds:y=x2t,drafts:O=[],deploymentTasks:v=[],draftDeploymentTaskIds:x={},onViewDeploymentTask:w,onEditDraft:S,onDeleteDraft:E}){const k=p.useRef(null),_=p.useRef(null),C=p.useRef(0),T=p.useRef(null),A=p.useRef(0),j=p.useRef(null),L=p.useRef(new Map),I=N2t(t,e),[M,N]=p.useState(""),[D,Q]=p.useState(i==="mine"?"mine":"all"),[F,$]=p.useState(I),[H,z]=p.useState([]),[B,V]=p.useState(""),[Z,ce]=p.useState(!0),[be,ie]=p.useState(""),[q,X]=p.useState([]),[K,de]=p.useState(!1),[xe,Me]=p.useState(""),[Ae,He]=p.useState(""),[et,Te]=p.useState({}),[Re,he]=p.useState(null),[me,Se]=p.useState(()=>Date.now()),ke=p.useMemo(()=>Sd(e),[e]);p.useEffect(()=>{i==="mine"&&Q("mine")},[i]),p.useEffect(()=>{$(I)},[I]),p.useEffect(()=>{Se(Date.now());const qe=window.setInterval(()=>Se(Date.now()),1e3);return()=>window.clearInterval(qe)},[]);const nt=p.useMemo(()=>O.map(C2t),[O]),Qe=p.useMemo(()=>{const qe=new Map,ye=new Map,Ue=new Map;for(const it of v){if(it.status!=="running")continue;if(qe.set(it.id,it),it.draftId){const Fe=ye.get(it.draftId);(!Fe||it.startedAt>Fe.startedAt)&&ye.set(it.draftId,it)}if(!it.runtimeId)continue;const we=Ue.get(it.runtimeId);(!we||it.startedAt>we.startedAt)&&Ue.set(it.runtimeId,it)}return{byId:qe,byDraftId:ye,byRuntimeId:Ue}},[v]),re=p.useCallback(qe=>{var Ue;if(qe.draft){const it=x[qe.draft.id];return Qe.byDraftId.get(qe.draft.id)??(it?Qe.byId.get(it):void 0)}const ye=(Ue=qe.runtime)==null?void 0:Ue.runtimeId;return ye?Qe.byRuntimeId.get(ye):void 0},[Qe,x]),ue=p.useCallback((qe,ye)=>{var we;(we=T.current)==null||we.abort(),yp.clear();const Ue=new AbortController;T.current=Ue;const it=++C.current;return ce(!0),ie(""),j2t(D,F,qe,Fe=>{C.current===it&&z(dt=>ye?Fe:[...dt,...Fe])},Ue.signal).then(Fe=>{C.current===it&&V(Fe)}).catch(Fe=>{C.current===it&&(xJ(Fe)||ie(eg(Fe,"加载通用智能体","GET /web/runtimes")))}).finally(()=>{C.current===it&&ce(!1),T.current===Ue&&(T.current=null)})},[D,F]);p.useEffect(()=>{if(h==="general")return z([]),V(""),ue("",!0),()=>{var qe;(qe=T.current)==null||qe.abort(),T.current=null,yp.clear(),C.current+=1}},[h,ue]),p.useEffect(()=>{if(h!=="general"){for(const Ue of L.current.values())Ue.abort();L.current.clear();return}const qe=new Set(H.filter(Ue=>{var it,we;return((it=Ue.runtime)==null?void 0:it.runtimeId)!==b&&((we=Ue.runtime)==null?void 0:we.region)===F}).map(Rm).filter(Boolean));for(const[Ue,it]of L.current)qe.has(Ue)||(it.abort(),L.current.delete(Ue));const ye=H.filter(Ue=>{var dt,Tt,Pt;const it=(dt=Ue.runtime)==null?void 0:dt.runtimeId;if(!it||it===b||((Tt=Ue.runtime)==null?void 0:Tt.region)!==F)return!1;const we=Rm(Ue),Fe=(Pt=et[we])==null?void 0:Pt.status;return!L.current.has(we)&&(!Fe||Fe==="checking")});for(const Ue of ye)L.current.set(Rm(Ue),new AbortController);Te(Ue=>{var Fe,dt;let it=!1;const we={...Ue};for(const Tt of H){const Pt=Rm(Tt);if(!Pt)continue;const nn=((Fe=Tt.runtime)==null?void 0:Fe.runtimeId)===b;nn&&((dt=we[Pt])==null?void 0:dt.status)!=="compatible"?(we[Pt]={status:"compatible",message:"Runtime 支持 Studio 对话。"},it=!0):!nn&&!we[Pt]&&(we[Pt]={status:"checking",message:MP},it=!0)}return it?we:Ue}),Zkt(ye,async Ue=>{const it=Ue.runtime;if(!it)return;const we=Rm(Ue),Fe=L.current.get(we);if(Fe)try{const dt=await Jy(it.runtimeId,it.region,{signal:Fe.signal,preferCached:!0,timeoutMs:m2t,currentVersion:it.currentVersion});if(Fe.signal.aborted)return;Te(Tt=>({...Tt,[we]:dt&&dt.length>0?{status:"compatible",message:"Runtime 支持 Studio 对话。"}:{status:"unsupported",message:jJ}}))}catch(dt){if(Fe.signal.aborted||(dt==null?void 0:dt.name)==="AbortError")return;Te(Tt=>({...Tt,[we]:RJ(dt)}))}finally{L.current.get(we)===Fe&&L.current.delete(we)}})},[h,b,F,H]),p.useEffect(()=>()=>{var qe;(qe=T.current)==null||qe.abort();for(const ye of L.current.values())ye.abort();L.current.clear()},[]);const Pe=p.useCallback(async qe=>{var it,we;(it=j.current)==null||it.abort();const ye=new AbortController;j.current=ye;const Ue=++A.current;de(!0),Me(""),X([]);try{const Fe=qe==="codex"?await ui.listSessions({signal:ye.signal,autoResumeSnapshots:!0}):await ui.listAgentSessions(qe,{signal:ye.signal,autoResumeSnapshots:!0});if(A.current!==Ue)return;X(Fe.map(T2t))}catch(Fe){if((Fe==null?void 0:Fe.name)==="AbortError"||A.current!==Ue)return;Me(eg(Fe,`加载 ${((we=F6.find(dt=>dt.id===qe))==null?void 0:we.label)??qe}`,`GET /web/${qe==="codex"?"sandbox":qe}/sessions`))}finally{j.current===ye&&(j.current=null),A.current===Ue&&de(!1)}},[]);function Ge(qe){var ye;qe!==h&&(qe==="general"?(C.current+=1,z([]),V(""),ie(""),ce(!0)):((ye=j.current)==null||ye.abort(),j.current=null,A.current+=1,X([]),Me(""),de(!0)),m(qe))}function W(){h==="general"&&(C.current+=1,z([]),V(""),ie(""),ce(!0))}function _e(qe){qe!==D&&(W(),Q(qe))}function rt(qe){qe!==F&&(W(),$(qe))}p.useEffect(()=>{var qe;if(h==="general"){(qe=j.current)==null||qe.abort(),j.current=null,A.current+=1;return}return Pe(h),()=>{var ye;(ye=j.current)==null||ye.abort(),j.current=null,A.current+=1}},[h,Pe,g]),p.useEffect(()=>{const qe=_.current,ye=k.current;if(!qe||!ye||h!=="general"||!B||Z)return;const Ue=new IntersectionObserver(([it])=>{it.isIntersecting&&ue(B,!1)},{root:ye,rootMargin:"240px 0px",threshold:.01});return Ue.observe(qe),()=>Ue.disconnect()},[h,ue,Z,B]);const Ve=p.useCallback(async qe=>{if(!Ae){He(qe.id);try{await new Promise(ye=>requestAnimationFrame(()=>ye())),qe.sandbox?await d(qe.sandbox):await l(qe)}finally{He("")}}},[Ae,l,d]),We=p.useCallback(async qe=>{var we;const ye=qe.runtime;if(!ye)return;const Ue=Rm(qe);Te(Fe=>({...Fe,[Ue]:{status:"checking",message:MP}})),(we=L.current.get(Ue))==null||we.abort();const it=new AbortController;L.current.set(Ue,it);try{const Fe=await wve(()=>Jy(ye.runtimeId,ye.region,{retryProbe:!0,signal:it.signal,timeoutMs:g2t,currentVersion:ye.currentVersion}));if(it.signal.aborted)return;Te(dt=>({...dt,[Ue]:Fe&&Fe.length>0?{status:"compatible",message:"Runtime 支持 Studio 对话。"}:{status:"unsupported",message:jJ}}))}catch(Fe){if(it.signal.aborted||xJ(Fe))return;Te(dt=>({...dt,[Ue]:RJ(Fe)}))}finally{L.current.get(Ue)===it&&L.current.delete(Ue)}},[]),ot=p.useCallback(qe=>{const ye=qe.runtime;!r||!ye||re(qe)||ZM({runtimeId:ye.runtimeId,region:ye.region,appName:qe.appName,currentVersion:ye.currentVersion})},[r,re]),St=p.useMemo(()=>{const qe=M.trim().toLocaleLowerCase(),ye=h==="general"?[...nt,...H]:q,it=(D==="mine"?ye.filter(Tt=>Tt.isMine):ye).filter(Tt=>{var nn;const Pt=((nn=Tt.runtime)==null?void 0:nn.region)??Tt.region;return!Pt||Pt===F}),we=qe?it.filter(Tt=>Tt.name.toLocaleLowerCase().includes(qe)):it;if(h!=="general")return we;const Fe=y.size>0?we.filter(Tt=>!Tt.runtime||!y.has(Tt.runtime.runtimeId)):we,dt=Fe.findIndex(Tt=>{var Pt;return((Pt=Tt.runtime)==null?void 0:Pt.runtimeId)===b});return dt<=0?Fe:[Fe[dt],...Fe.slice(0,dt),...Fe.slice(dt+1)]},[h,b,nt,y,M,D,F,H,q]);p.useEffect(()=>{if(!r||h!=="general")return;const qe=St.filter(Fe=>!!Fe.runtime).filter(Fe=>!re(Fe)).slice(0,b2t);if(qe.length===0)return;let ye=!1,Ue=0;const it=async()=>{for(;!ye;){const Fe=qe[Ue];if(Ue+=1,!(Fe!=null&&Fe.runtime)||(await ZM({runtimeId:Fe.runtime.runtimeId,region:Fe.runtime.region,appName:Fe.appName,currentVersion:Fe.runtime.currentVersion}),ye))return}},we=window.setTimeout(()=>{for(let Fe=0;Fe{ye=!0,window.clearTimeout(we)}},[h,r,re,St]);const Vt=F6.find(qe=>qe.id===h),_t=(Vt==null?void 0:Vt.label)??"智能体",Ne=h==="general"?Z&&H.length===0&&nt.length===0:K&&q.length===0,$e=!Ne&&St.length===0,mt=n?h==="general"?()=>s(F):()=>u(h):void 0,Ht=h==="codex"&&n&&!!a;return o.jsxs(ih,{className:"my-agents-page","aria-label":"智能体",children:[o.jsx(sO,{title:"智能体",className:"my-agents-header"}),o.jsxs(g0,{className:"my-agent-toolbar",children:[o.jsx(pE,{idPrefix:"my-agent-ownership",ariaLabel:"创建人筛选",value:D,items:[{id:"all",label:"全部",disabled:i==="mine"},{id:"mine",label:"我创建的"}],onChange:_e}),o.jsxs("div",{className:"resource-toolbar__actions",children:[o.jsx(HC,{id:"my-agent-type-filter",ariaLabel:"智能体类型",value:h,options:f2t,onChange:Ge}),o.jsx(HC,{id:"my-agent-region-filter",ariaLabel:"区域",value:F,options:ke,onChange:rt}),o.jsx(Gp,{className:"my-agent-search","aria-label":"搜索智能体",value:M,onChange:qe=>N(qe.target.value),placeholder:"搜索"}),Ht?o.jsxs("button",{type:"button",className:"my-agent-create-secondary",onClick:a,children:[o.jsx(S2t,{}),o.jsx("span",{children:"接力"})]}):null]})]}),o.jsxs(b0,{className:"my-agent-results",ref:k,"aria-label":`${_t}列表`,children:[Ne?o.jsx(bd,{}):(h==="general"?be:xe)&&St.length===0?o.jsxs("div",{className:"my-agent-empty",role:"alert",children:[o.jsx("p",{children:h==="general"?be:xe}),o.jsx("button",{type:"button",onClick:()=>{h==="general"?ue("",!0):Pe(h)},children:"重新加载"})]}):$e&&!mt?M.trim()||D==="mine"||F!==I?o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(xn,{fill:"none",children:[o.jsx(xn.Icon,{children:o.jsx(mRe,{})}),o.jsx(xn.Title,{children:"没有匹配的智能体"}),o.jsx(xn.Description,{children:"请尝试调整搜索或筛选条件"})]})}):h!=="general"?o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(xn,{fill:"none",children:[o.jsx(xn.Icon,{children:o.jsx(E2t,{type:h})}),o.jsxs(xn.Title,{className:"my-agent-sandbox-empty-title",children:["暂无 ",_t]})]})}):o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(xn,{fill:"none",children:[o.jsx(xn.Icon,{children:o.jsx(Cf,{})}),o.jsx(xn.Title,{children:"暂无通用智能体"}),o.jsx(xn.Description,{children:"创建一个通用智能体,开始构建和对话"})]})}):o.jsxs(o.Fragment,{children:[h==="general"&&be?o.jsxs("div",{className:"my-agent-inline-error",role:"alert",children:[o.jsx("span",{children:be}),o.jsx("button",{type:"button",onClick:()=>void ue("",!0),children:"重新加载"})]}):null,o.jsxs(aO,{className:"my-agent-grid",children:[mt?o.jsx(Vg,{className:"my-agent-create-card","aria-label":`创建${_t}`,onClick:mt,icon:o.jsx(v2t,{}),children:"创建智能体"}):null,St.map(qe=>{var Ue;const ye=A2t(qe,H);return o.jsx(R2t,{agent:qe,deploymentTask:re(qe),nowMs:me,onViewDeploymentTask:w,onUse:Ve,compatibility:qe.runtime?et[Rm(qe)]??{status:"checking",message:MP}:void 0,onRetryCompatibility:We,onPrepareUpdate:ot,onViewDetails:ye?()=>{ye.sandbox?f(ye.sandbox):c(ye)}:void 0,connecting:qe.id===Ae,connected:((Ue=qe.runtime)==null?void 0:Ue.runtimeId)===b,onEditDraft:S,onDeleteDraft:he},qe.id)})]})]}),h==="general"&&!be&&!Ne&&(St.length>0||!!B)&&o.jsx("div",{className:"my-agent-load-more",ref:_,"aria-live":"polite",children:Z?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载更多智能体"})]}):B?o.jsx("span",{children:"继续下滑加载更多"}):o.jsx("span",{children:"已加载全部智能体"})})]}),Re?o.jsx(zl,{title:"删除草稿?",description:`删除后将无法恢复“${Re.draft.name||"未命名 Agent"}”。`,confirmLabel:"删除草稿",variant:"danger",onCancel:()=>he(null),onConfirm:()=>{E==null||E(Re),he(null)}}):null]})}const D2t="_RadioGroup_onrfm_1",P2t="_RadioLabel_onrfm_9",M2t="_RadioIndicatorWrapper_onrfm_26",L2t="_RadioItem_onrfm_43",$2t="_RadioIndicator_onrfm_26",nv={RadioGroup:D2t,RadioLabel:P2t,RadioIndicatorWrapper:M2t,RadioItem:L2t,RadioIndicator:$2t},_ve=p.createContext(null),B2t=()=>{const e=p.use(_ve);if(!e)throw new Error("RadioGroup components must be wrapped in ");return e},oa=({onChange:e,children:t,className:n,direction:r="row",disabled:i=!1,...s})=>{const a=p.useMemo(()=>({disabled:i,direction:r}),[i,r]);return o.jsx(_ve,{value:a,children:o.jsx(_Le,{className:ur(nv.RadioGroup,n),"data-direction":r,onValueChange:e,disabled:i,...s,children:t})})},Q2t=({value:e,disabled:t=!1,required:n,children:r,className:i,block:s=!1,...a})=>{const{disabled:l}=B2t(),c=l||t,u=p.useId(),d=`${e}-${u}`;return o.jsx("div",{className:"flex",...a,children:o.jsxs("label",{htmlFor:d,className:ur(nv.RadioLabel,i),"data-disabled":c?"":void 0,"data-block":s?"":void 0,onMouseDown:f=>{!f.defaultPrevented&&f.detail>1&&f.preventDefault()},children:[o.jsx("div",{className:nv.RadioIndicatorWrapper,children:o.jsx(NLe,{id:d,value:e,disabled:c,required:n,className:nv.RadioItem,children:o.jsx(RLe,{className:nv.RadioIndicator})})}),r]})})};oa.Item=Q2t;const U2t="_Container_13560_1",F2t="_Textarea_13560_174",DJ={Container:U2t,Textarea:F2t},pd=e=>{const t=p.useRef(null),r=`search-ui-input-${p.useId()}`,{id:i,name:s,variant:a="outline",size:l="md",gutterSize:c,className:u,autoComplete:d,disabled:f=!1,readOnly:h=!1,invalid:m=!1,allowAutofillExtensions:g=!!s,onFocus:b,onBlur:y,onAnimationStart:O,onAutofill:v,autoSelect:x,rows:w=3,maxRows:S,autoResize:E,ref:k,onChange:_,...C}=e,[T,A]=p.useState(!1),j=E?Math.max(S??10,w):w;p.useEffect(()=>{var M;x&&((M=t.current)==null||M.select())},[x]);const L=M=>{O==null||O(M),M.animationName==="native-autofill-in"&&(v==null||v())},I=p.useCallback(()=>{if(!E||!t.current||j===void 0)return;t.current.style.height="0px";const M=t.current.scrollHeight;t.current.style.height=M+"px"},[E,j]);return p.useEffect(()=>{I()},[e.value,w,I]),o.jsx("div",{className:ur(DJ.Container,u),"data-variant":a,"data-size":l,"data-gutter-size":c,"data-focused":T,"data-disabled":f?"":void 0,"data-readonly":h?"":void 0,"data-invalid":m?"":void 0,style:d0({"textarea-min-rows":`${w}`,"textarea-max-rows":`${j}`}),children:o.jsx("textarea",{...C,onChange:M=>{_==null||_(M),I()},ref:uE([t,k]),id:i||(g?void 0:r),className:DJ.Textarea,name:s,readOnly:h,disabled:f,rows:w,onFocus:M=>{A(!0),b==null||b(M)},onBlur:M=>{A(!1),y==null||y(M)},onAnimationStart:L,"data-lpignore":g?void 0:!0,"data-1p-ignore":g?void 0:!0})})},xR="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",z2t="data:image/svg+xml,%3c?xml%20version='1.0'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%20100%20100'%3e%3ctitle%3ePandoc%20Icon%3c/title%3e%3cdesc%20property='dc:creator'%3eAlbert%20Krewinkel%3c/desc%3e%3cmetadata%20id='license'%20xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23'%20xmlns:dc='http://purl.org/dc/elements/1.1/'%20xmlns:cc='http://creativecommons.org/ns%23'%3e%3crdf:RDF%3e%3ccc:Work%20rdf:about=''%3e%3cdc:format%3eimage/svg+xml%3c/dc:format%3e%3cdc:type%20rdf:resource='http://purl.org/dc/dcmitype/StillImage'%20/%3e%3ccc:license%20rdf:resource='http://creativecommons.org/licenses/by-sa/4.0/'%20/%3e%3c/cc:Work%3e%3ccc:License%20rdf:about='http://creativecommons.org/licenses/by-sa/4.0/'%3e%3ccc:permits%20rdf:resource='http://creativecommons.org/ns%23Reproduction'%20/%3e%3ccc:permits%20rdf:resource='http://creativecommons.org/ns%23Distribution'%20/%3e%3ccc:requires%20rdf:resource='http://creativecommons.org/ns%23Notice'%20/%3e%3ccc:requires%20rdf:resource='http://creativecommons.org/ns%23Attribution'%20/%3e%3ccc:permits%20rdf:resource='http://creativecommons.org/ns%23DerivativeWorks'%20/%3e%3ccc:requires%20rdf:resource='http://creativecommons.org/ns%23ShareAlike'%20/%3e%3c/cc:License%3e%3c/rdf:RDF%3e%3c/metadata%3e%3crect%20fill='%23fed'%20stroke='%23fed'%20width='100'%20height='100'/%3e%3cg%20fill='none'%20stroke='%234093da'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='8'%20transform='skewX(-6)%20translate(8%201)'%3e%3cpath%20d='M%2030,10%20l%200,80%20M%2045,10%20l%200,80%20M%2020,10%20l%2040,0%20l%2018,18%20l%200,25%20l%20-33,0'%20/%3e%3cpath%20fill='%234093da'%20stroke-width='6'%20d='M%2061,10%20l%2017,17%20l%20-17,0%20l%200,-17'%20/%3e%3c/g%3e%3c/svg%3e",V2t="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%20100%20100'%20version='1.1'%20id='svg4'%20sodipodi:docname='favicon.svg'%20inkscape:version='1.4.4%20(dcaf3e7,%202026-05-05)'%20xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape'%20xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:svg='http://www.w3.org/2000/svg'%3e%3csodipodi:namedview%20id='namedview4'%20pagecolor='%23ffffff'%20bordercolor='%23000000'%20borderopacity='0.25'%20inkscape:showpageshadow='2'%20inkscape:pageopacity='0.0'%20inkscape:pagecheckerboard='0'%20inkscape:deskcolor='%23d1d1d1'%20showgrid='true'%20inkscape:zoom='8.2236519'%20inkscape:cx='34.534536'%20inkscape:cy='45.174577'%20inkscape:window-width='1881'%20inkscape:window-height='1382'%20inkscape:window-x='1512'%20inkscape:window-y='30'%20inkscape:window-maximized='0'%20inkscape:current-layer='svg4'%3e%3cinkscape:grid%20type='axonomgrid'%20id='grid4'%20units='px'%20originx='0'%20originy='0'%20spacingx='3.7795276'%20spacingy='3.7795276'%20empcolor='%230099e5'%20empopacity='0.30196078'%20color='%230099e5'%20opacity='0.14901961'%20empspacing='0'%20dotted='false'%20gridanglex='40'%20gridanglez='40'%20enabled='true'%20visible='true'%20/%3e%3c/sodipodi:namedview%3e%3cdefs%20id='defs1'%3e%3cfilter%20id='shadow'%20x='0'%20y='0'%20width='1'%20height='1'%3e%3cfeDropShadow%20dx='0'%20dy='2'%20stdDeviation='3'%20flood-color='rgba(50,%2050,%2093,%200.18)'%20/%3e%3c/filter%3e%3c/defs%3e%3crect%20x='4'%20y='4'%20width='92'%20height='92'%20rx='22.08'%20fill='%23e8efff'%20filter='url(%23shadow)'%20id='rect1'%20transform='matrix(1.0869565,0,0,1.0869565,-4.347826,-4.347826)'%20style='stroke-width:0.92'%20ry='22.08'%20/%3e%3cpath%20style='fill:%230a2540;fill-opacity:1;stroke-width:1.88976'%20d='M%2049.999999,6.535431%204.9573423,44.330708%2049.999999,82.125984%2092.790523,46.220471%2095.042656,44.330708%20Z'%20id='path1'%20/%3e%3cpath%20style='fill:%23425466;fill-opacity:1;stroke-width:1.88976'%20d='M%204.9573423,44.330708%20V%2055.669291%20L%2049.999999,93.464567%20V%2082.125984%20Z'%20id='path2'%20/%3e%3cpath%20style='fill:%231a3550;fill-opacity:1;stroke-width:1.88976'%20d='M%2049.999999,82.125984%2095.042656,44.330708%20V%2055.669291%20L%2049.999999,93.464567%20Z'%20id='path3'%20/%3e%3cpath%20style='fill:%234ade80;stroke:none;stroke-width:5;stroke-linecap:round;stroke-linejoin:round;fill-opacity:1'%20d='m%2045.042657,30.236221%209.008531,-7.559055%2022.521328,18.897638%20-9.008531,7.559056%20z'%20id='path5'%20/%3e%3cpath%20style='fill:none;fill-opacity:1;stroke:%234ade80;stroke-width:5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1'%20d='M%2027.025594,49.133859%2047.29479,47.244096%2045.042657,64.25197'%20id='path6'%20/%3e%3c/svg%3e",H2t="data:image/svg+xml,%3csvg%20fill='%23261230'%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eAstral%3c/title%3e%3cpath%20d='M1.44%200C.6422%200%200%20.6422%200%201.44v21.12C0%2023.3578.6422%2024%201.44%2024h21.12c.7978%200%201.44-.6422%201.44-1.44V1.44C24%20.6422%2023.3578%200%2022.56%200Zm4.7998%204.8h11.5199c.7953%200%201.44.6447%201.44%201.44V19.2h-6.624v-4.32h-1.152v4.32H4.8V6.24c0-.7953.6446-1.44%201.4398-1.44m4.032%205.472v1.152h3.456v-1.152z'/%3e%3c/svg%3e",q2t="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='1.34em'%20height='1em'%20viewBox='0%200%20256%20192'%3e%3cpath%20fill='%232d4552'%20d='M84.38%20108.352c-9.556%202.712-15.826%207.467-19.956%2012.218c3.956-3.461%209.255-6.639%2016.402-8.665c7.311-2.072%2013.548-2.057%2018.702-1.062v-4.03c-4.397-.402-9.437-.082-15.148%201.539M63.987%2074.475l-35.49%209.35s.646.914%201.844%202.133l30.092-7.93s-.427%205.495-4.13%2010.41c7.005-5.299%207.684-13.963%207.684-13.963m29.709%2083.41c-49.946%2013.452-76.37-44.43-84.37-74.472c-3.696-13.868-5.31-24.37-5.74-31.148a11.5%2011.5%200%200%201%20.025-1.84C1.021%2050.58-.22%2051.927.032%2055.82c.43%206.773%202.044%2017.275%205.74%2031.147c7.997%2030.038%2034.424%2087.92%2084.37%2074.468c10.871-2.929%2019.038-8.263%2025.17-15.073c-5.652%205.104-12.724%209.123-21.616%2011.523M103.08%2039.05v3.555h19.59c-.401-1.259-.806-2.393-1.208-3.555z'/%3e%3cpath%20fill='%232d4552'%20d='M127.05%2068.325c8.81%202.503%2013.47%208.68%2015.933%2014.146l9.824%202.79s-1.34-19.132-18.645-24.047c-16.189-4.6-26.151%208.995-27.363%2010.754c4.71-3.355%2011.586-6.102%2020.251-3.643m78.197%2014.234c-16.204-4.62-26.162%209.003-27.356%2010.737c4.713-3.351%2011.586-6.099%2020.247-3.629c8.797%202.506%2013.452%208.676%2015.923%2014.146l9.837%202.8s-1.361-19.135-18.651-24.054m-9.76%2050.443l-81.718-22.845s.885%204.485%204.279%2010.293l68.803%2019.234c5.664-3.277%208.636-6.682%208.636-6.682m-56.655%2049.174C74.127%20164.828%2081.949%2082.386%2092.419%2043.32c4.311-16.1%208.743-28.066%2012.419-36.088c-2.193-.451-4.01.704-5.804%204.354C95.13%2019.5%2090.14%2032.387%2085.312%2050.427c-10.467%2039.066-18.29%20121.506%2046.412%20138.854c30.497%208.17%2054.256-4.247%2071.966-23.749c-16.81%2015.226-38.274%2023.763-64.858%2016.644'/%3e%3cpath%20fill='%23e2574c'%20d='M103.081%20138.565v-16.637l-46.223%2013.108s3.415-19.846%2027.522-26.684c7.311-2.072%2013.549-2.058%2018.701-1.063V39.05h23.145c-2.52-7.787-4.958-13.782-7.006-17.948c-3.387-6.895-6.859-2.324-14.741%204.269c-5.552%204.638-19.583%2014.533-40.698%2020.222c-21.114%205.694-38.185%204.184-45.307%202.95c-10.097-1.742-15.378-3.96-14.884%203.721c.43%206.774%202.043%2017.277%205.74%2031.148c7.996%2030.039%2034.424%2087.92%2084.37%2074.468c13.046-3.515%2022.254-10.464%2028.637-19.32h-19.256zm-74.588-54.74l35.494-9.35s-1.034%2013.654-14.34%2017.162c-13.31%203.504-21.154-7.812-21.154-7.812'/%3e%3cpath%20fill='%232ead33'%20d='M236.664%2039.84c-9.226%201.617-31.361%203.632-58.716-3.7c-27.363-7.328-45.517-20.144-52.71-26.168c-10.197-8.54-14.682-14.476-19.096-5.498c-3.902%207.918-8.893%2020.805-13.723%2038.846c-10.466%2039.066-18.289%20121.505%2046.413%20138.853c64.687%2017.333%2099.126-57.978%20109.593-97.047c4.83-18.037%206.948-31.695%207.53-40.502c.665-9.976-6.187-7.08-19.29-4.784M106.668%2072.161s10.196-15.859%2027.49-10.943c17.305%204.915%2018.645%2024.046%2018.645%2024.046zm42.215%2071.163c-30.419-8.91-35.11-33.167-35.11-33.167l81.714%2022.846c0-.004-16.494%2019.12-46.604%2010.32m28.89-49.85s10.183-15.847%2027.474-10.918c17.29%204.923%2018.651%2024.054%2018.651%2024.054z'/%3e%3cpath%20fill='%23d65348'%20d='m86.928%20126.51l-30.07%208.522s3.266-18.609%2025.418-25.983L65.25%2045.147l-1.471.447c-21.115%205.694-38.185%204.184-45.307%202.95c-10.097-1.741-15.379-3.96-14.885%203.722c.43%206.774%202.044%2017.276%205.74%2031.147c7.997%2030.039%2034.425%2087.92%2084.37%2074.468l1.471-.462zM28.493%2083.825l35.494-9.351s-1.034%2013.654-14.34%2017.162c-13.31%203.504-21.154-7.811-21.154-7.811'/%3e%3cpath%20fill='%231d8d22'%20d='m150.255%20143.658l-1.376-.335c-30.419-8.91-35.11-33.166-35.11-33.166l42.137%2011.778l22.308-85.724l-.27-.07c-27.362-7.329-45.516-20.145-52.71-26.17c-10.196-8.54-14.682-14.475-19.096-5.497c-3.898%207.918-8.889%2020.805-13.719%2038.846c-10.466%2039.066-18.289%20121.505%2046.413%20138.852l1.326.3zM106.668%2072.16s10.196-15.859%2027.49-10.943c17.305%204.915%2018.645%2024.046%2018.645%2024.046z'/%3e%3cpath%20fill='%23c04b41'%20d='m88.46%20126.072l-8.064%202.289c1.906%2010.74%205.264%2021.047%2010.534%2030.152c.918-.202%201.828-.376%202.762-.632c2.449-.66%204.72-1.479%206.906-2.371c-5.89-8.74-9.785-18.804-12.137-29.438m-3.148-75.644c-4.144%2015.467-7.852%2037.73-6.831%2060.06c1.826-.793%203.756-1.532%205.9-2.14l1.492-.334c-1.82-23.852%202.114-48.157%206.546-64.694a323%20323%200%200%201%203.373-11.704a105%20105%200%200%201-5.974%203.547a307%20307%200%200%200-4.506%2015.265'/%3e%3c/svg%3e",X2t="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='512'%20height='512'%20version='1.1'%20viewBox='0%200%20135.47%20135.47'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='m67.733%2067.733%2029.33%2016.933-29.33%2050.8c37.408%200%2067.733-30.325%2067.733-67.733%200-12.341-3.3168-23.901-9.0837-33.867h-58.65z'%20fill='%23afccf9'/%3e%3cpath%20d='m67.733-1e-6c-25.07%200-46.942%2013.63-58.654%2033.875l29.324%2050.792%2029.33-16.933v-33.867h58.65c-11.714-20.24-33.583-33.867-58.65-33.867z'%20fill='%231767d1'/%3e%3cpath%20d='m0%2067.733c0%2037.408%2030.324%2067.733%2067.733%2067.733l29.33-50.8-29.33-16.933-29.33%2016.933-29.324-50.792c-5.7637%209.9632-9.0794%2021.519-9.0794%2033.858'%20fill='%23679ef5'/%3e%3cpath%20d='m101.6%2067.733c0%2018.704-15.163%2033.867-33.867%2033.867-18.704%200-33.867-15.163-33.867-33.867s15.163-33.867%2033.867-33.867c18.704%200%2033.867%2015.163%2033.867%2033.867'%20fill='%23fff'/%3e%3cpath%20d='m95.25%2067.733c0%2015.197-12.32%2027.517-27.517%2027.517-15.197%200-27.517-12.32-27.517-27.517%200-15.197%2012.32-27.517%2027.517-27.517%2015.197%200%2027.517%2012.32%2027.517%2027.517'%20fill='%231a74e7'/%3e%3c/svg%3e",G2t="data:image/svg+xml,%3csvg%20fill='%23F03C2E'%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eGit%3c/title%3e%3cpath%20d='M13.09%2023.549a1.54%201.54%200%200%201-2.18%200L.451%2013.089a1.54%201.54%200%200%201%200-2.179l7.191-7.19%202.733%202.733a1.85%201.85%200%200%200%20.964%202.326v6.66a1.849%201.849%200%201%200%201.54%200V8.957l2.508%202.508a1.85%201.85%200%201%200%201.09-1.09l-2.634-2.634a1.85%201.85%200%200%200-2.378-2.377L8.73%202.63%2010.91.451a1.54%201.54%200%200%201%202.179%200l10.459%2010.46a1.54%201.54%200%200%201%200%202.179z'/%3e%3c/svg%3e",W2t="data:image/svg+xml,%3csvg%20fill='%23073551'%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3ecurl%3c/title%3e%3cpath%20d='M.803%2014.8169c0-.5342.433-.9665.9665-.9665.5335%200%20.9665.4323.9665.9665%200%20.5335-.433.9657-.9665.9657-.5335%200-.9666-.4322-.9666-.9657m2.736%200c0-.1963-.0532-.376-.1119-.5525-.2344-.7024-.876-1.2169-1.6575-1.2169-.1249%200-.2344.0465-.3524.0708C.6149%2013.2865%200%2013.9646%200%2014.817c0%20.9764.7923%201.7694%201.7695%201.7694.9772%200%201.7694-.793%201.7694-1.7694m-1.7694-7.149c.5335%200%20.9665.433.9665.9665%200%20.5335-.433.9665-.9665.9665-.5343%200-.9666-.433-.9666-.9665%200-.5335.4323-.9665.9666-.9665m0%202.7359c.9772%200%201.7694-.7923%201.7694-1.7694%200-.1956-.0532-.376-.1119-.5525-.2344-.7024-.8767-1.2169-1.6575-1.2169-.1249%200-.2344.0465-.3524.0716C.6149%207.104%200%207.782%200%208.6344c0%20.9771.7923%201.7694%201.7695%201.7694m13.221-5.694c-.5342%200-.9665-.433-.9665-.9664a.966.966%200%2001.9666-.9665c.5335%200%20.9658.4322.9658.9665%200%20.5334-.4323.9664-.9658.9664m-9.6%2016.5133c-.5335%200-.9666-.433-.9666-.9665%200-.5342.433-.9665.9666-.9665a.966.966%200%2001.9665.9665c0%20.5335-.4323.9665-.9665.9665m9.6-19.2491c-.978%200-1.7695.7922-1.7695%201.7694%200%20.2085.0525.4025.1187.5882L5.039%2018.5581c-.803.1681-1.4179.8462-1.4179%201.6985%200%20.9772.7923%201.7694%201.7695%201.7694.9772%200%201.7694-.7922%201.7694-1.7694%200-.1963-.0525-.3759-.111-.5525l8.3427-14.2728c.7778-.1865%201.3683-.8531%201.3683-1.688%200-.977-.793-1.7693-1.7694-1.7693m7.24%202.7359c-.5343%200-.9666-.433-.9666-.9665a.966.966%200%2001.9665-.9665c.5335%200%20.9666.4322.9666.9665%200%20.5334-.433.9665-.9666.9665M12.6313%2021.223c-.5343%200-.9665-.433-.9665-.9665a.966.966%200%2001.9665-.9665c.5335%200%20.9658.4323.9658.9665%200%20.5335-.4323.9665-.9658.9665M22.2305%201.974c-.9772%200-1.7694.7922-1.7694%201.7694%200%20.2085.0525.4025.1187.5882l-8.3009%2014.2265c-.8021.1681-1.417.8462-1.417%201.6985%200%20.9772.7922%201.7694%201.7694%201.7694.9764%200%201.7687-.7922%201.7687-1.7694%200-.1963-.0525-.3759-.1111-.5525l8.3427-14.2728C23.4094%205.2448%2024%204.5782%2024%203.7433c0-.977-.7923-1.7693-1.7695-1.7693'/%3e%3c/svg%3e",Y2t="data:image/svg+xml,%3csvg%20fill='%23007808'%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eFFmpeg%3c/title%3e%3cpath%20d='M21.72%2017.91V6.5l-.53-.49L9.05%2018.52l-1.29-.06L24%201.53l-.33-.95-11.93%201-5.75%206.6v-.23l4.7-5.39-1.38-.77-9.11.77v2.85l1.91.46v.01l.19-.01-.56.66v10.6c.609-.126%201.22-.241%201.83-.36L14.12%205.22l.83-.04L0%2021.44l9.67.82%201.35-.77%206.82-6.74v2.15l-5.72%205.57%2011.26.95.35-.94v-3.16l-3.29-.18c.434-.403.858-.816%201.28-1.23z'/%3e%3c/svg%3e",Z2t="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20viewBox='0%200%201080%201080'%3e%3c!--%20Generator:%20Adobe%20Illustrator%2030.3.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%202.1.3%20Build%20182)%20--%3e%3cdefs%3e%3cstyle%3e%20.st0%20{%20fill:%20%23ff0;%20}%20.st1%20{%20fill:%20%23333;%20}%20%3c/style%3e%3c/defs%3e%3cpath%20class='st0'%20d='M660.52,419.49l-195.15-52.98c-15.84-4.3-19.16-25.29-5.43-34.28l169.23-110.7-9.91-201.97c-.8-16.39,18.13-26.04,30.92-15.76l157.57,126.74,189.03-71.84c15.34-5.83,30.37,9.2,24.54,24.54l-71.84,189.03,126.74,157.57c10.29,12.79.64,31.73-15.76,30.92l-201.97-9.91-110.7,169.23c-8.98,13.73-29.98,10.41-34.28-5.43l-52.98-195.15h-.01Z'/%3e%3cpath%20class='st1'%20d='M603.34,476.66l32.94,121.68,4.45,16.23-429.11,429.11c-48.45,48.45-126.85,48.45-175.3,0C12.16,1019.51,0,987.89,0,956.15s12.02-63.48,36.31-87.77l429.11-429.11,16.35,4.33,121.56,33.06h0Z'/%3e%3c/svg%3e";function fU(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...e,children:o.jsx("path",{d:"M12 .5C5.65.5.5 5.65.5 12c0 5.08 3.29 9.39 7.86 10.91 .58 .11 .79-.25.79-.56v-2.02c-3.2.7-3.88-1.36-3.88-1.36-.52-1.33-1.28-1.69-1.28-1.69-1.05-.72.08-.7.08-.7 1.16.08 1.77 1.19 1.77 1.19 1.03 1.77 2.71 1.26 3.37.96.1-.75.4-1.26.73-1.55-2.56-.29-5.25-1.28-5.25-5.7 0-1.26.45-2.29 1.19-3.1-.12-.29-.52-1.47.11-3.06 0 0 .97-.31 3.16 1.18A10.98 10.98 0 0 1 12 6.11c.98 0 1.96.13 2.87.39 2.19-1.49 3.16-1.18 3.16-1.18.63 1.59.23 2.77.11 3.06.74.81 1.19 1.84 1.19 3.1 0 4.43-2.7 5.4-5.27 5.69.42.36.78 1.06.78 2.14v3.04c0 .31.21.67.8.56A11.51 11.51 0 0 0 23.5 12C23.5 5.65 18.35.5 12 .5Z"})})}eo.registerLanguage("bash",gB);const K2t=48;function J2t(e,t=K2t){return e.scrollHeight-e.scrollTop-e.clientHeight<=t}function e_t(e){return eo.highlight(e,{language:"bash",ignoreIllegals:!0}).value}function t_t({status:e}){return e==="succeeded"?o.jsx(Eu,{"aria-hidden":!0}):e==="failed"?o.jsx(MM,{"aria-hidden":!0}):e==="running"?o.jsx(lr,{className:"studio-build-progress__spinner","aria-hidden":!0}):o.jsx($Re,{"aria-hidden":!0})}function PJ(e){if(!e)return"";const t=Date.parse(e);return Number.isNaN(t)?"":new Intl.DateTimeFormat("zh-CN",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(t)}function n_t({steps:e,log:t,logError:n="",logTruncated:r=!1,logUpdatedAt:i,loading:s=!1}){const a=p.useRef(null),l=p.useRef(!0),[c,u]=p.useState(!1),d=p.useMemo(()=>e_t(t),[t]);p.useEffect(()=>{const h=a.current;h&&t&&l.current&&(h.scrollTop=h.scrollHeight)},[t]);const f=async()=>{try{await navigator.clipboard.writeText(t),u(!0),window.setTimeout(()=>u(!1),1500)}catch{u(!1)}};return o.jsxs("div",{className:"studio-build-progress",children:[o.jsx("ol",{className:"studio-build-progress__steps","aria-label":"构建步骤",children:e.map(h=>o.jsxs("li",{className:`is-${h.status}`,children:[o.jsx("span",{className:"studio-build-progress__step-icon",children:o.jsx(t_t,{status:h.status})}),o.jsx("span",{children:h.label})]},h.key))}),o.jsxs("section",{className:"studio-build-progress__log","aria-label":"构建日志",children:[o.jsxs("header",{children:[o.jsxs("div",{children:[o.jsx("strong",{children:"构建日志"}),o.jsxs("span",{children:[s?"同步中":n?"读取失败":"已同步",r?" · 仅显示最近日志":"",PJ(i)?` · ${PJ(i)}`:""]})]}),o.jsxs(Nt,{type:"button",color:"secondary",variant:"ghost",size:"sm",disabled:!t,onClick:()=>void f(),"aria-label":c?"已复制构建日志":"复制构建日志",children:[c?o.jsx(Eu,{"aria-hidden":!0}):o.jsx(AN,{"aria-hidden":!0}),c?"已复制":"复制"]})]}),t?o.jsx("pre",{ref:a,tabIndex:0,"aria-label":"构建日志内容",onScroll:h=>{l.current=J2t(h.currentTarget)},children:o.jsx("code",{className:"hljs language-bash",dangerouslySetInnerHTML:{__html:d}})}):o.jsx("div",{className:`studio-build-progress__log-empty${n?" is-error":""}`,children:n||(s?"正在等待 CodePipeline 输出日志…":"暂无构建日志")})]})]})}function MJ({name:e,description:t,icon:n,selected:r,disabled:i=!1,onChange:s,className:a=""}){return o.jsxs("div",{className:`studio-package-option${r?" is-selected":""}${a?` ${a}`:""}`,children:[o.jsx("span",{className:"studio-package-option__icon","aria-hidden":"true",children:n}),o.jsxs("span",{className:"studio-package-option__content",children:[o.jsx("strong",{children:e}),t?o.jsx("span",{children:t}):null]}),o.jsx(Nt,{type:"button",className:"studio-package-option__action",color:"secondary",variant:"ghost",size:"sm",iconSize:"sm",uniform:!0,"aria-label":r?`移除 ${e}`:`安装 ${e}`,"aria-pressed":r,disabled:i,onClick:()=>s(!r),children:r?o.jsx(yRe,{}):o.jsx(vRe,{})})]})}function Im(e,t){return e[t]|e[t+1]<<8}function nb(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}async function r_t(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 Tve(e,t={}){let r=-1;for(let u=e.length-22;u>=0&&u>e.length-65557;u--)if(nb(e,u)===101010256){r=u;break}if(r<0)throw new Error("无效的 zip:找不到 EOCD");const i=Im(e,r+10);if(t.maxEntries!==void 0&&i>t.maxEntries)throw new Error(`zip 文件数不能超过 ${t.maxEntries} 个`);let s=nb(e,r+16);const a=new TextDecoder("utf-8"),l=[];let c=0;for(let u=0;ut.maxUncompressedBytes)throw new Error("zip 解压后的内容过大");const v=Im(e,y+26),x=Im(e,y+28),w=y+30+v+x,S=e.subarray(w,w+f);let E;if(d===0)E=S;else if(d===8)E=await r_t(S);else{s+=46+m+g+b;continue}l.push({name:O,text:a.decode(E)}),s+=46+m+g+b}return l}const z6=/(^|\/)skill\.md$/i;function i_t(e){const t=(e??"").replace(/\r\n?/g,` +`),y=(e==null?void 0:e.pendingMessage)||s;if(p.useEffect(()=>{e&&u(l)},[e==null?void 0:e.status,l]),p.useEffect(()=>{if(!c||!h)return;const E=a.current;E&&(E.scrollTop=E.scrollHeight)},[c,h,b]),!e||!e.text&&e.status!=="error"&&!e.pendingMessage)return null;const O=Pkt(e.updatedAt),v=e.status==="complete"?"已同步":e.status==="error"?"读取失败":"同步中",x=e.omittedEarly?"已省略早期日志":e.snapshotTruncated?"仅显示最近的构建日志":e.truncated?"已省略部分日志":"",w=[v,e.lineCount?`${e.lineCount} 行`:"",x,O].filter(Boolean).join(" · ");async function S(){try{await navigator.clipboard.writeText(m),f(!0),window.setTimeout(()=>f(!1),1500)}catch{f(!1)}}return o.jsxs("section",{className:`aw-deploy-log is-${e.status}${c?"":" is-collapsed"}`,"aria-label":r,children:[o.jsxs("header",{children:[o.jsxs("div",{children:[o.jsx("strong",{children:n}),o.jsx("span",{children:w})]}),o.jsxs("div",{className:"aw-deploy-log-actions",children:[h&&o.jsx("button",{type:"button",onClick:()=>u(E=>!E),children:c?"收起":"展开"}),h&&o.jsxs("button",{type:"button",onClick:()=>void S(),"aria-label":d?`已复制${i}`:`复制${i}`,title:d?"已复制":`复制${i}`,children:[d?o.jsx(_u,{"aria-hidden":!0}):o.jsx(AN,{"aria-hidden":!0}),o.jsx("span",{children:d?"已复制":"复制"})]})]})]}),c&&(h?o.jsx("pre",{ref:a,children:b}):o.jsx("div",{className:"aw-deploy-log-empty",children:y}))]})}function Mkt({task:e}){var t;return o.jsx(vve,{log:e.buildLog,autoExpand:((t=e.buildLog)==null?void 0:t.status)!=="complete"&&(e.status==="running"||e.status==="error")&&xve(e)===Dkt,title:"构建日志",ariaLabel:"构建日志",copyLabel:"构建日志",defaultPendingMessage:"正在等待构建日志…"})}function Lkt({task:e}){var t;return o.jsx(vve,{log:e.githubLog,autoExpand:((t=e.githubLog)==null?void 0:t.status)!=="complete"&&(e.status==="running"||e.status==="error")&&e.phase==="github",title:"GitHub 挂载日志",ariaLabel:"GitHub 持续交付挂载日志",copyLabel:"GitHub 挂载日志",defaultPendingMessage:"正在等待 GitHub 挂载日志…"})}function $kt({task:e,onReturnToEdit:t}){const n=Ove(e),r=xve(e),i=e.status==="success"?100:Math.max(6,Math.min(100,e.pct??6)),s=e.status==="running"?"正在部署":e.status==="success"?"部署完成":e.status==="error"?"部署失败":"部署已取消";return o.jsxs("section",{className:`aw-deploy-progress-card is-${e.status}`,"aria-live":"polite",children:[o.jsxs("div",{className:"aw-deploy-progress-head",children:[o.jsxs("div",{children:[o.jsx("span",{className:"aw-deploy-progress-icon","aria-hidden":!0,children:e.status==="running"?o.jsx(or,{className:"spin"}):e.status==="success"?o.jsx(MRe,{}):e.status==="error"?o.jsx(Dae,{}):o.jsx(MM,{})}),o.jsxs("div",{children:[o.jsx("h3",{children:s}),o.jsx("p",{children:e.runtimeName})]})]}),o.jsx("strong",{children:e.status==="running"?`${Math.round(i)}%`:e.label})]}),o.jsx("div",{className:"aw-deploy-progress-track",role:"progressbar","aria-label":"部署进度","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(i),children:o.jsx("span",{style:{width:`${i}%`}})}),o.jsx("ol",{className:"aw-deploy-steps",children:n.map((a,l)=>{const c=e.status==="success"||lnew Set),[et,Yt]=p.useState(()=>new Set),[en,dr]=p.useState(!1),[Cr,Rn]=p.useState(""),[Yn,Lr]=p.useState(null),[Hr,Zr]=p.useState([]),[qr,Zn]=p.useState([]),[Xr,Kr]=p.useState(!1),[Gr,es]=p.useState(""),[Jr,ei]=p.useState(""),[ti,ta]=p.useState(0),[gs,di]=p.useState([]),[bs,ts]=p.useState(!1),[Qa,ss]=p.useState(""),[ya,Oa]=p.useState(0),[Bn,no]=p.useState(null),[ni,Hs]=p.useState(1),[un,as]=p.useState(!1),[Oi,Ar]=p.useState(""),[xa,he]=p.useState(0),[Me,Pt]=p.useState(!1),[Xt,ir]=p.useState(()=>new Set),[xn,qs]=p.useState(!1),[Xl,va]=p.useState(""),[wa,il]=p.useState(""),[ro,Ua]=p.useState(()=>new Set),io=p.useRef(!1),Hc=p.useRef(""),qc=p.useRef(null),Gl=p.useRef(0),so=p.useRef(0),sl=p.useRef(0),[Wl,Xc]=p.useState(pkt),[Yl,Eh]=p.useState("");p.useEffect(()=>{e.length!==0&&Xc(ee=>ee.map((xe,Re)=>Re===0&&xe.agentIds.length===0?{...xe,agentIds:e.slice(0,2).map(ut=>ut.id)}:xe))},[e]);const ao=p.useMemo(()=>{const ee=new Map;for(const xe of e)xe.runtimeId&&ee.set(xe.runtimeId,xe);return ee},[e]),Pu=p.useMemo(()=>{var xe;const ee=new Map;for(const Re of t){const ut=(xe=Re.deploymentTarget)==null?void 0:xe.runtimeId;if(!ut||!ao.has(ut))continue;const Lt=ee.get(ut);(!Lt||Re.updatedAt>Lt.updatedAt)&&ee.set(ut,Re)}return ee},[ao,t]),Zl=p.useMemo(()=>{const ee=new Map;for(const xe of f){if(!xe.runtimeId)continue;const Re=ee.get(xe.runtimeId);(!Re||xe.startedAt>Re.startedAt)&&ee.set(xe.runtimeId,xe)}return ee},[f]),Kl=p.useMemo(()=>{const ee=ze.trim().toLowerCase();return ee?e.filter(xe=>{const Re=xe.runtimeId?Pu.get(xe.runtimeId):void 0,ut=xe.runtimeId?Zl.get(xe.runtimeId):void 0;return[xe.label,xe.app,xe.host??"",(Re==null?void 0:Re.draft.name)??"",(Re==null?void 0:Re.draft.description)??"",(ut==null?void 0:ut.runtimeName)??""].join(" ").toLowerCase().includes(ee)}):e},[e,Zl,ze,Pu]),Pn=p.useMemo(()=>{const ee=ze.trim().toLowerCase();return t.filter(xe=>{var ut;const Re=(ut=xe.deploymentTarget)==null?void 0:ut.runtimeId;return Re&&ao.has(Re)?!1:ee?`${xe.draft.name} ${xe.draft.description}`.toLowerCase().includes(ee):!0})},[ao,t,ze]),Jl=p.useMemo(()=>t.filter(ee=>{var Re;const xe=(Re=ee.deploymentTarget)==null?void 0:Re.runtimeId;return!xe||!ao.has(xe)}).length,[ao,t]),Pd=p.useMemo(()=>{const ee=ze.trim().toLowerCase();return ee?Wl.filter(xe=>xe.name.toLowerCase().includes(ee)):Wl},[Wl,ze]),se=e.find(ee=>ee.id===Q),Tn=t.find(ee=>ee.id===L),qn=h?f.find(ee=>ee.id===h):void 0,oo=se!=null&&se.runtimeId?Pu.get(se.runtimeId):void 0,nr=O?Tt:Q&&i===Q?r:null,ri=(nr==null?void 0:nr.appName)||(se==null?void 0:se.runtimeApp)||(se==null?void 0:se.app)||"",Md=c&&(se!=null&&se.runtimeId)?hJ:hJ.filter(ee=>ee.id!=="usage"),al=JSON.stringify([(se==null?void 0:se.runtimeId)??"",(se==null?void 0:se.region)??"cn-beijing",ri,ni]),ys=(Bn==null?void 0:Bn.requestKey)===al?Bn.value:null,lo=`${(se==null?void 0:se.region)??"cn-beijing"}:${(se==null?void 0:se.runtimeId)??""}`,Os=(Pe==null?void 0:Pe.requestKey)===lo?Pe.value:"",Nr=(V==null?void 0:V.requestKey)===lo?V:null,na=!!((JE=Nr==null?void 0:Nr.apiApps)!=null&&JE.length),ue=!!(Nr!=null&&Nr.a2a),nt=((Th=Nr==null?void 0:Nr.apiApps)==null?void 0:Th[0])??ri,vt=(z==null?void 0:z.endpoint)??"",vn=ykt(((A0=Nr==null?void 0:Nr.a2a)==null?void 0:A0.endpoint)??"",vt),Ht=(se==null?void 0:se.runtimeApp)||"",tn=JSON.stringify([(se==null?void 0:se.runtimeId)??"",(se==null?void 0:se.region)??"",(se==null?void 0:se.currentVersion)??null,Ht]),Mt=l&&(se!=null&&se.runtimeId)&&se.region&&rt===0?YM({runtimeId:se.runtimeId,region:se.region,appName:Ht,currentVersion:se.currentVersion}):null,yt=(K==null?void 0:K.requestKey)===tn?K.value:Mt;p.useEffect(()=>{const ee=Gl.current+1;Gl.current=ee,_e(null),ot("");const xe=(se==null?void 0:se.runtimeId)??"",Re=(se==null?void 0:se.region)??"";if(!l||!xe||!Re){He(!1);return}const ut=rt===0?YM({runtimeId:xe,region:Re,appName:Ht,currentVersion:se==null?void 0:se.currentVersion}):null;if(ut){_e({requestKey:tn,value:ut}),He(!1);return}const Lt=new AbortController;let Xe,Qn=0;const zi=60;He(!0);const Cn=Xs=>{BN({runtimeId:xe,region:Re,appName:Ht,currentVersion:se==null?void 0:se.currentVersion,signal:Lt.signal,force:Xs&&rt>0}).then(Ii=>{var nk,rk;if(ee!==Gl.current)return;const Jn=Ii.recoveryStatus==="preparing";if(Ii.runtime.runtimeId!==xe||Ii.runtime.region!==Re||!Jn&&Ht&&((nk=Ii.agent)==null?void 0:nk.appName)!==Ht||Ii.canUpdate&&!((rk=Ii.agent)!=null&&rk.appName)){ot("Runtime 更新能力响应与当前选择不匹配。");return}if(_e({requestKey:tn,value:Ii}),He(!1),!!Jn){if(Qn+=1,Qn>=zi){ot("更新配置仍在后台恢复,请稍后点击重试。");return}Xe=window.setTimeout(()=>Cn(!1),1e3)}}).catch(Ii=>{ee!==Gl.current||Lt.signal.aborted||ot(Ii instanceof Error?Ii.message:"检查 Runtime 更新能力失败。")}).finally(()=>{ee===Gl.current&&!Lt.signal.aborted&&He(!1)})};return Cn(!0),()=>{Lt.abort(),Xe!=null&&window.clearTimeout(Xe)}},[l,Ht,rt,se==null?void 0:se.currentVersion,se==null?void 0:se.region,se==null?void 0:se.runtimeId,tn]);const De=p.useMemo(()=>{const ee=new Map(e.map((Re,ut)=>[Re.id,ut])),xe=new Map(n.map((Re,ut)=>[Re,ut]));return[...Kl].sort((Re,ut)=>{const Lt=Re.runtimeId?Zl.get(Re.runtimeId):void 0,Xe=ut.runtimeId?Zl.get(ut.runtimeId):void 0,Qn=(Lt==null?void 0:Lt.status)==="running"?Lt.startedAt:0,zi=(Xe==null?void 0:Xe.status)==="running"?Xe.startedAt:0;if(Qn!==zi)return zi-Qn;const Cn=xe.get(Re.id),Xs=xe.get(ut.id);return Cn!=null&&Xs!=null?Cn-Xs:Cn!=null?-1:Xs!=null?1:(ee.get(Re.id)??0)-(ee.get(ut.id)??0)})},[n,e,Kl,Zl]),Vn=(se==null?void 0:se.label)||(nr==null?void 0:nr.name)||(Tn==null?void 0:Tn.draft.name)||(qn==null?void 0:qn.agentName)||((ek=qn==null?void 0:qn.agentDraft)==null?void 0:ek.name)||"未选择智能体",Y=Wl.find(ee=>ee.id===Yl),Ne=De.filter(ee=>ee.canDelete===!0),ft=De.filter(ee=>ur.has(ee.id)&&ee.canDelete===!0),Kt=Pn.filter(ee=>et.has(ee.id)),mn=Ne.length+Pn.length,hn=ft.length+Kt.length,Kn=p.useMemo(()=>{var xe;if(qn!=null&&qn.agentDraft)return qn.agentDraft;if(Tn!=null&&Tn.draft)return Tn.draft;const ee=(xe=se==null?void 0:se.region)!=null&&xe.startsWith("ap-")?"byteplus":"volcengine";return yt!=null&&yt.agent&&(yt.recoveryStatus==="complete"||yt.recoveryStatus==="draft-only")?z7(yt.agent,ee,yt.runtime.configuredEnvKeys):Skt(nr,ri||(se==null?void 0:se.label)||"agent",ee)},[nr,ri,se==null?void 0:se.label,se==null?void 0:se.region,Tn==null?void 0:Tn.draft,qn==null?void 0:qn.agentDraft,yt]),rr=((jO=nr==null?void 0:nr.draft)==null?void 0:jO.harnessSidecar)??xHe(z==null?void 0:z.envs),Qr=rr?nO.filter(ee=>rr.componentOverrides[ee]):[],sr=Tn?a?"":"当前账号没有新建 Agent 的权限。":l?se!=null&&se.runtimeId?se.region?Be?"正在检查 Runtime 更新配置。":Ye||(yt?yt.recoveryStatus!=="complete"&&yt.recoveryStatus!=="draft-only"?yt.reason||"该 Runtime 的原发布配置不可恢复,无法安全更新。":yt.canUpdate?(tk=yt.agent)!=null&&tk.appName?"":"Runtime 更新能力响应缺少智能体信息。":yt.reason||"当前 Runtime 不支持原地更新。":"尚未完成 Runtime 更新能力检查。"):"Runtime 缺少地域信息,无法更新。":"仅支持更新已部署的云端智能体。":"当前账号没有管理 Agent 的权限。",wn="aw-update-disabled-reason",cn=p.useMemo(()=>{if(nr)return nr.tools;const ee=(Kn.builtinTools??[]).map(xe=>{var Re;return((Re=tO.find(ut=>ut.id===xe))==null?void 0:Re.label)??xe});return Array.from(new Set([...Kn.tools,...ee,...(Kn.customTools??[]).map(xe=>xe.name),...(Kn.mcpTools??[]).map(xe=>xe.name)].filter(Boolean)))},[Kn,nr]),pn=p.useMemo(()=>nr?nr.skillsPreviewSupported?nr.skills.map(ee=>ee.name):null:Array.from(new Set([...(Kn.selectedSkills??[]).map(ee=>ee.name),...Kn.skills].filter(Boolean))),[Kn,nr]),Jt=p.useMemo(()=>{if(qn)return qn;if(Tn){const ee=f.filter(xe=>xe.draftId===Tn.id).sort((xe,Re)=>Re.startedAt-xe.startedAt)[0];return ee||f.filter(xe=>{var Re,ut;return((Re=xe.agentDraft)==null?void 0:Re.name)===Tn.draft.name||xe.agentName===Tn.draft.name||!!((ut=Tn.deploymentTarget)!=null&&ut.runtimeId)&&xe.runtimeId===Tn.deploymentTarget.runtimeId}).sort((xe,Re)=>Re.startedAt-xe.startedAt)[0]}if(se)return f.filter(ee=>!!se.runtimeId&&ee.runtimeId===se.runtimeId||ee.agentName===se.label).sort((ee,xe)=>xe.startedAt-ee.startedAt)[0]},[f,se,Tn,qn]),In=!!(h&&Jt&&Jt.id===h),jr=!!(Jt&&(Jt.status!=="success"||In)),co=(Jt==null?void 0:Jt.status)==="running",kh=Jt!=null&&Jt.draftId?t.find(ee=>ee.id===Jt.draftId)??(Jt.agentDraft?{id:Jt.draftId,draft:Jt.agentDraft,updatedAt:Jt.startedAt}:void 0):void 0,bm=p.useMemo(()=>Nkt(Kn),[Kn]),ec=(se==null?void 0:se.currentVersion)??(z==null?void 0:z.currentVersion)??null,_0=ec??(qn==null?void 0:qn.startedAt)??"unknown",T0=nr?`runtime:${(se==null?void 0:se.runtimeId)??nr.name}:v${_0}:${bm}`:`draft:${(qn==null?void 0:qn.id)??(Tn==null?void 0:Tn.id)??(se==null?void 0:se.id)??Vn}:${bm}`;p.useEffect(()=>{N==="usage"&&!c&&D("basic")},[c,N]),p.useEffect(()=>{if(!h)return;const ee=f.find(Re=>Re.id===h),xe=ee!=null&&ee.runtimeId?ao.get(ee.runtimeId):void 0;if(xe){H(""),F(xe.id),D("basic");return}F(""),H(""),D("basic")},[ao,f,h]),p.useEffect(()=>{if(!m){Hc.current="";return}const ee=`${m}:${g}:${b}:${c}`;Hc.current!==ee&&e.some(xe=>xe.id===m)&&(Hc.current=ee,H(""),F(m),D(g==="usage"&&!c?"basic":g),g==="evaluations"&&(Nt(b),an("")))},[e,c,m,g,b]),p.useEffect(()=>{for(const ee of De.slice(0,8)){if(!ee.runtimeId)continue;const xe=ee.region??"cn-beijing";hle(ee.runtimeId,xe),poe(ee.runtimeId,xe,ee.runtimeApp??"")}},[De]),p.useEffect(()=>{let ee=!1;const xe=(se==null?void 0:se.runtimeId)??"",Re=(se==null?void 0:se.region)??"cn-beijing",ut=(se==null?void 0:se.runtimeApp)??"",Lt=xe?hoe(xe,Re,ut):null;if(Ft(Lt),it(""),Ve(!1),Ge(!!Lt||!O||!xe),!(!O||!xe))return g9(xe,Re,ut,{force:!0}).then(Xe=>{ee||Ft(Xe)}).catch(Xe=>{!ee&&!Lt&&Ft(null),ee||(Ve(Xe instanceof Es&&Xe.unsupported),it(Xe instanceof Error?Xe.message:"加载 Agent 信息失败。"))}).finally(()=>{ee||Ge(!0)}),()=>{ee=!0}},[O,rt,se==null?void 0:se.currentVersion,se==null?void 0:se.region,se==null?void 0:se.runtimeApp,se==null?void 0:se.runtimeId]),p.useEffect(()=>{let ee=!1;const xe=(se==null?void 0:se.runtimeId)??"",Re=(se==null?void 0:se.region)??"cn-beijing";if(di([]),ss(""),N!=="optimizations"||!xe){ts(!1);return}if(O&&!ri){ts(!At);return}return ts(!0),roe({runtimeId:xe,region:Re,appName:ri}).then(ut=>{ee||di(ut.groups)}).catch(ut=>{ee||ss(ut instanceof Error?ut.message:String(ut))}).finally(()=>{ee||ts(!1)}),()=>{ee=!0}},[At,O,ya,N,ri,se==null?void 0:se.region,se==null?void 0:se.runtimeId]),p.useEffect(()=>{Hs(1)},[se==null?void 0:se.runtimeId,ri]),p.useEffect(()=>{const ee=sl.current+1;sl.current=ee;const xe=(se==null?void 0:se.runtimeId)??"",Re=(se==null?void 0:se.region)??"cn-beijing",ut=ri;if(Ar(""),N!=="usage"||!xe){as(!1);return}if(!ut){as(O&&!At);return}const Lt=new AbortController;return as(!0),ele({runtimeId:xe,region:Re,appName:ut,page:ni,pageSize:mkt,signal:Lt.signal}).then(Xe=>{if(ee===sl.current){if(Xe.runtimeId!==xe||Xe.appName!==ut||Xe.page!==ni){Ar("用量响应与当前 Agent 不匹配,请重试。");return}no({requestKey:al,value:Xe})}}).catch(Xe=>{ee!==sl.current||Lt.signal.aborted||Ar(Xe instanceof Error?Xe.message:"加载 Agent 用量失败。")}).finally(()=>{ee===sl.current&&as(!1)}),()=>{Lt.abort()}},[ni,xa,al,At,O,N,ri,se==null?void 0:se.region,se==null?void 0:se.runtimeId]),p.useEffect(()=>{so.current+=1,Ae(null),Ke(!1),Le(!1),me(""),ve("api-server")},[lo,N]);function ii(){so.current+=1,Ae(null),Ke(!1),Le(!1),me("")}function Sa(ee){ee!==de&&(ii(),ve(ee))}async function Mu(){if(Ue){ii();return}const ee=(se==null?void 0:se.runtimeId)??"",xe=(se==null?void 0:se.region)??"cn-beijing";if(!ee)return;const Re=so.current+1;so.current=Re,Le(!0),me("");try{const ut=await ule(ee,xe);if(Re!==so.current)return;Ae({requestKey:lo,value:ut}),Ke(!0)}catch(ut){if(Re!==so.current)return;Ae(null),Ke(!1),me(ut instanceof Error?ut.message:"读取 Runtime API Key 失败。")}finally{Re===so.current&&Le(!1)}}p.useEffect(()=>{let ee=!1;const xe=(se==null?void 0:se.runtimeId)??"",Re=(se==null?void 0:se.region)??"cn-beijing",ut=xe?fle(xe,Re):null;if(B(ut),Qe(""),!!xe)return S9(xe,Re,{force:!0}).then(Lt=>{ee||B(Lt)}).catch(Lt=>{!ee&&!ut&&B(null),ee||Qe(Lt instanceof Error?Lt.message:"加载 Runtime 详情失败。")}),()=>{ee=!0}},[rt,se==null?void 0:se.currentVersion,se==null?void 0:se.region,se==null?void 0:se.runtimeId]),p.useEffect(()=>{let ee=!1;const xe=(se==null?void 0:se.runtimeId)??"";if(ce(""),N!=="versions"||!xe){$e(!1),xe||Ee(null);return}return $e(!0),H_(xe).then(Re=>{ee||Ee(Re)}).catch(Re=>{ee||(Ee(null),ce(Re instanceof Error?Re.message:"读取 GitHub 版本失败。"))}).finally(()=>{ee||$e(!1)}),()=>{ee=!0}},[N,se==null?void 0:se.currentVersion,se==null?void 0:se.runtimeId]),p.useEffect(()=>{let ee=!1;const xe=(se==null?void 0:se.runtimeId)??"",Re=(se==null?void 0:se.region)??"cn-beijing",ut=`${Re}:${xe}`;if(q(""),N!=="integrations"||!xe){be(!1),xe||W(null);return}be(!0);const Lt=Jy(xe,Re,{retryProbe:!0}).catch(Xe=>{if(Xe instanceof Es&&Xe.unsupported)return null;throw Xe});return Promise.all([Lt,cle(xe,Re,{retryProbe:!0})]).then(([Xe,Qn])=>{ee||W({requestKey:ut,apiApps:Xe,a2a:Qn})}).catch(Xe=>{ee||(W(null),q(Xe instanceof Error?Xe.message:"探测集成方式失败。"))}).finally(()=>{ee||be(!1)}),()=>{ee=!0}},[G,N,se==null?void 0:se.currentVersion,se==null?void 0:se.region,se==null?void 0:se.runtimeId]),p.useEffect(()=>{let ee=!1;const xe=(se==null?void 0:se.runtimeId)??"",Re=(se==null?void 0:se.region)??"cn-beijing",ut=xe&&ri?ioe({runtimeId:xe,region:Re,appName:ri,pageSize:100}):null;if(Zr(ut?yJ(ut):[]),Zn((ut==null?void 0:ut.sets)??[]),es(""),ei((ut==null?void 0:ut.unsupportedMessage)??""),N!=="evaluations"||!xe){Kr(!1);return}if(O&&!ri){Kr(!At);return}return Kr(!ut),MN({runtimeId:xe,region:Re,appName:ri,pageSize:100},{force:!0}).then(Lt=>{ee||(Zn(Lt.sets),Zr(yJ(Lt)),ei(Lt.unsupportedMessage??""))}).catch(Lt=>{ee||(es(Lt instanceof Error?Lt.message:String(Lt)),ei(""))}).finally(()=>{ee||Kr(!1)}),()=>{ee=!0}},[At,O,ti,N,ri,nr==null?void 0:nr.appName,se==null?void 0:se.region,se==null?void 0:se.runtimeId]);async function _h(ee){const xe=(se==null?void 0:se.runtimeId)??"",Re=ee.commitSha??"";if(!(!xe||!Re||Ie)){We(Re),ce("");try{await Hoe({runtimeId:xe,targetCommitSha:Re});const ut=await H_(xe);Ee(ut)}catch(ut){ce(ut instanceof Error?ut.message:"回退版本失败。")}finally{We("")}}}p.useEffect(()=>{const ee=new Set(Hr.map(xe=>xe.id));ir(xe=>{const Re=new Set([...xe].filter(ut=>ee.has(ut)));return Re.size===xe.size?xe:Re}),Ua(xe=>{const Re=new Set([...xe].filter(ut=>ee.has(ut)));return Re.size===xe.size?xe:Re}),wa&&!ee.has(wa)&&il("")},[Hr,wa]),p.useEffect(()=>{Pt(!1),ir(new Set),Ua(new Set),va(""),il("")},[se==null?void 0:se.runtimeId]),p.useEffect(()=>{const ee=new Set(De.filter(xe=>xe.canDelete===!0).map(xe=>xe.id));qe(xe=>{const Re=new Set([...xe].filter(ut=>ee.has(ut)));return Re.size===xe.size?xe:Re})},[De]),p.useEffect(()=>{const ee=new Set(Pn.map(xe=>xe.id));Yt(xe=>{const Re=new Set([...xe].filter(ut=>ee.has(ut)));return Re.size===xe.size?xe:Re})},[Pn]);const tc=p.useMemo(()=>!y||!(se!=null&&se.runtimeId)||y.runtimeId!==se.runtimeId||ri&&y.agentName&&y.agentName!==ri?null:{...y,tag:y.kind==="good"?"Good case":"Bad case"},[y,se==null?void 0:se.runtimeId,ri]),Gc=p.useMemo(()=>se!=null&&se.runtimeId?tc?[tc,...Hr.filter(ee=>ee.id!==tc.id&&(!ee.messageId||ee.messageId!==tc.messageId))]:Hr:hkt,[Hr,tc,se==null?void 0:se.runtimeId]),nc=Gc.filter(ee=>{if(ee.kind!==_t||(ee.source==="auto"?"auto":"user")!==oe)return!1;const Re=rn.trim().toLowerCase();return Re?[ee.input,ee.output,ee.referenceOutput,ee.comment,ee.tag??"",ee.sessionId,ee.messageId,ee.userId,ee.evaluationSetName].join(" ").toLowerCase().includes(Re):!0}),No=nc.filter(ee=>Xt.has(ee.id)),Wc=!!(se!=null&&se.runtimeId),Ld=ee=>{Nt(ee),an(""),va("");const xe=Gc.find(Re=>Re.kind===ee);il((xe==null?void 0:xe.id)??""),window.setTimeout(()=>{var Re;(Re=qc.current)==null||Re.scrollIntoView({behavior:"smooth",block:"start"})},0)},ym=ee=>{va(""),ir(xe=>{const Re=new Set(xe);return Re.has(ee.id)?Re.delete(ee.id):Re.add(ee.id),Re})},kt=()=>{va(""),ir(new Set(nc.map(ee=>ee.id)))},rc=()=>{va(""),ir(new Set),Pt(!1)},ki=ee=>{Ua(xe=>{const Re=new Set(xe);return Re.has(ee)?Re.delete(ee):Re.add(ee),Re})},ic=ee=>{il(ee.id),va(""),!(!ee.sessionId||!ee.messageId)&&(T==null||T(ee))},$r=async ee=>{if(!(se!=null&&se.runtimeId)||!ri||xn||ee.length===0)return;const xe=ee.length===1?"确定删除这条反馈案例?原始聊天记录不会被删除。":`确定删除选中的 ${ee.length} 条反馈案例?原始聊天记录不会被删除。`;if(!window.confirm(xe))return;const Re=ee.map(Lt=>Lt.id),ut=new Set(Re);qs(!0),va("");try{await ooe({runtimeId:se.runtimeId,region:se.region??"cn-beijing",appName:ri,itemIds:Re});const Lt=new Map;for(const Xe of ee)Lt.set(Xe.kind,(Lt.get(Xe.kind)??0)+1);Zr(Xe=>Xe.filter(Qn=>!ut.has(Qn.id))),Zn(Xe=>Xe.map(Qn=>({...Qn,itemCount:Math.max(0,Qn.itemCount-(Lt.get(Qn.kind)??0))}))),ir(Xe=>new Set([...Xe].filter(Qn=>!ut.has(Qn)))),Ua(Xe=>new Set([...Xe].filter(Qn=>!ut.has(Qn)))),wa&&ut.has(wa)&&il(""),ee.length>1&&Pt(!1),C==null||C(ee)}catch(Lt){va(Lt instanceof Error?Lt.message:String(Lt))}finally{qs(!1)}},$d=ee=>{Xc(xe=>xe.map(Re=>Re.id===ee.id?ee:Re))},CO=()=>{const ee=new Set(e.map(ut=>ut.id)),xe=n.filter(ut=>ee.has(ut)),Re=new Set(xe);return[...xe,...e.filter(ut=>!Re.has(ut.id)).map(ut=>ut.id)]},AO=(ee,xe,Re)=>{if(!w||ee===xe)return;const ut=CO().filter(Qn=>Qn!==ee),Lt=ut.indexOf(xe),Xe=Lt<0?ut.length:Re==="after"?Lt+1:Lt;ut.splice(Xe,0,ee),w(ut)},KE=(ee,xe)=>{if(!Fe||Fe===xe)return;const Re=ee.currentTarget.getBoundingClientRect();bt(xe),lt(ee.clientY>Re.top+Re.height/2?"after":"before")},sc=(ee,xe)=>{if(!w)return;const Re=CO(),ut=Re.indexOf(ee),Lt=Math.max(0,Math.min(Re.length-1,ut+xe));ut<0||ut===Lt||(Re.splice(ut,1),Re.splice(Lt,0,ee),w(Re))},RR=ee=>{ee.canDelete===!0&&(Rn(""),qe(xe=>{const Re=new Set(xe);return Re.has(ee.id)?Re.delete(ee.id):Re.add(ee.id),Re}))},Om=ee=>{Rn(""),Yt(xe=>{const Re=new Set(xe);return Re.has(ee.id)?Re.delete(ee.id):Re.add(ee.id),Re})},IR=()=>{Rn(""),qe(new Set(Ne.map(ee=>ee.id))),Yt(new Set(Pn.map(ee=>ee.id)))},Mn=()=>{Rn(""),qe(new Set),Yt(new Set),yr(!1)},DR=()=>{if(hn===0||en)return;const ee=ft.length,xe=Kt.length;Rn(""),Lr({kind:"selection",title:ee===1&&xe===0?"删除 Agent?":ee===0&&xe===1?"删除草稿?":"删除所选项目?",description:ee===1&&xe===0?`"${ft[0].label}" 对应的云端 Runtime 将被永久删除,此操作不可撤销。`:ee===0&&xe===1?`"${Kt[0].draft.name||"未命名 Agent"}" 将从本地草稿中删除。`:`将删除选中的 ${hn} 个项目。${ee>0?`${ee} 个云端 Runtime 将被永久删除,此操作不可撤销。`:"草稿删除后无法恢复。"}`,confirmLabel:ee===0&&xe===1?"删除草稿":"删除所选",agents:ft,drafts:Kt})},PR=async()=>{if(!(!Yn||en)){dr(!0),Rn("");try{if(Yn.kind==="selection"){const{agents:ee,drafts:xe}=Yn;if(ee.length>0){if(!S)throw new Error("当前页面不支持删除已部署 Agent。");await S(ee)}xe.length>0&&(E==null||E(xe)),qe(new Set),Yt(new Set),yr(!1),ee.some(Re=>Re.id===Q)&&F(""),xe.some(Re=>Re.id===L)&&H("")}else if(Yn.kind==="agent"){if(!S)throw new Error("当前页面不支持删除已部署 Agent。");await S([Yn.agent]),Q===Yn.agent.id&&F("")}else{if(!E)throw new Error("当前页面不支持删除草稿。");E([Yn.draft]),L===Yn.draft.id&&H("")}Lr(null)}catch(ee){Rn(ee instanceof Error?ee.message:String(ee))}finally{dr(!1)}}},MR=ee=>{!S||ee.canDelete!==!0||en||(Rn(""),Lr({kind:"agent",title:"删除 Agent?",description:`"${ee.label}" 对应的云端 Runtime 将被永久删除,此操作不可撤销。`,confirmLabel:"删除 Agent",agent:ee}))},NO=ee=>{if(!E||en)return;const xe=ee.draft.name||"未命名 Agent";Rn(""),Lr({kind:"draft",title:"删除草稿?",description:`"${xe}" 将从本地草稿中删除。`,confirmLabel:"删除草稿",draft:ee})},LR=()=>{const ee=`eval-${Date.now()}`,xe={id:ee,name:`新评测组 ${Wl.length+1}`,agentIds:[],caseSet:"核心回归集",evaluator:"综合质量评估器",metrics:["回答质量"],concurrency:"4",history:[]};Xc(Re=>[xe,...Re]),Eh(ee)},C0=ee=>{$d({...ee,history:[{id:`run-${Date.now()}`,createdAt:"刚刚",score:86+ee.history.length%7,status:"completed"},...ee.history]})};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`aw-root${O?" is-detail-only":""}`,children:[o.jsxs("nav",{className:"aw-view-tabs","aria-label":"智能体工作台",children:[o.jsx("button",{type:"button",className:I==="library"?"is-active":"","aria-pressed":I==="library",onClick:()=>{$("library"),ht("")},children:"智能体库"}),o.jsx("button",{type:"button",className:I==="evaluation"?"is-active":"","aria-pressed":I==="evaluation",onClick:()=>{$("evaluation"),ht("")},children:"评测"})]}),o.jsxs("div",{className:"aw-workspace-frame",children:[o.jsxs("div",{className:"aw-workspace","aria-hidden":I==="evaluation"||void 0,ref:ee=>{ee==null||ee.toggleAttribute("inert",I==="evaluation")},children:[o.jsxs("aside",{className:"aw-sidebar","aria-label":I==="library"?"智能体列表":"评测组列表",children:[o.jsxs("label",{className:"aw-search",children:[o.jsx(bC,{"aria-hidden":!0}),o.jsx("input",{value:ze,onChange:ee=>ht(ee.currentTarget.value),placeholder:I==="library"?"搜索智能体":"搜索评测组","aria-label":I==="library"?"搜索智能体":"搜索评测组"})]}),o.jsxs("button",{type:"button",className:"aw-create-card",onClick:I==="library"?A:LR,disabled:I==="library"&&!a,children:[o.jsx(vo,{"aria-hidden":!0}),o.jsx("span",{children:I==="library"?"新建 Agent":"新建评测组"})]}),I==="library"&&(S||E)&&o.jsx("div",{className:`aw-selection-toolbar${sn?" is-active":""}`,children:sn?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"aw-selection-count",children:["已选 ",hn," 个"]}),o.jsx("button",{type:"button",onClick:IR,disabled:mn===0||en,children:"全选"}),o.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void DR(),disabled:hn===0||en,children:en?"删除中…":"删除所选"}),o.jsx("button",{type:"button",onClick:Mn,disabled:en,children:"取消"})]}):o.jsx("button",{type:"button",onClick:()=>{Rn(""),yr(!0)},disabled:mn===0,children:"选择"})}),I==="library"&&Cr&&o.jsx("div",{className:"aw-delete-error",role:"alert",children:Cr}),o.jsx("div",{className:"aw-agent-list",children:I==="evaluation"?Pd.length===0?o.jsx("div",{className:"aw-list-empty",children:"没有匹配的评测组"}):Pd.map(ee=>o.jsxs("button",{type:"button",className:`aw-agent-item${ee.id===Yl?" is-active":""}`,onClick:()=>Eh(ee.id),children:[o.jsxs("span",{className:"aw-agent-copy aw-eval-group-copy",children:[o.jsx("strong",{children:ee.name}),o.jsxs("small",{children:[ee.agentIds.length," 个智能体 · ",ee.history.length," 次运行"]})]}),o.jsx(Sv,{"aria-hidden":!0})]},ee.id)):u&&De.length===0&&Pn.length===0?o.jsx("div",{className:"aw-list-empty",children:"正在读取云端智能体…"}):d&&De.length===0&&Pn.length===0?o.jsxs("div",{className:"aw-list-empty aw-list-error",children:[o.jsx("span",{children:d}),x&&o.jsx("button",{type:"button",onClick:x,children:"重试"})]}):De.length===0&&Pn.length===0?o.jsx("div",{className:"aw-list-empty",children:"没有匹配的智能体"}):o.jsxs(o.Fragment,{children:[Pn.map(ee=>{const Re=f.filter(Lt=>Lt.draftId===ee.id).sort((Lt,Xe)=>Xe.startedAt-Lt.startedAt)[0]??f.filter(Lt=>{var Xe,Qn;return((Xe=Lt.agentDraft)==null?void 0:Xe.name)===ee.draft.name||Lt.agentName===ee.draft.name||!!((Qn=ee.deploymentTarget)!=null&&Qn.runtimeId)&&Lt.runtimeId===ee.deploymentTarget.runtimeId}).sort((Lt,Xe)=>Xe.startedAt-Lt.startedAt)[0],ut=et.has(ee.id);return o.jsxs("button",{type:"button",className:["aw-agent-item",sn?"is-selecting":"",ut?"is-selected-for-delete":"",ee.id===L?"is-active":""].filter(Boolean).join(" "),"aria-pressed":sn?ut:void 0,onClick:()=>{if(sn){Om(ee);return}F(""),H(ee.id),D("basic")},children:[sn&&o.jsx("span",{className:`aw-select-marker${ut?" is-checked":""}`,"aria-hidden":"true"}),o.jsxs("span",{className:"aw-agent-copy",children:[o.jsxs("span",{className:"aw-agent-name-row",children:[o.jsx("strong",{children:ee.draft.name||"未命名 Agent"}),o.jsx("span",{className:`aw-draft-badge${(Re==null?void 0:Re.status)==="running"?" is-deploying":""}`,children:(Re==null?void 0:Re.status)==="running"?"部署中":"草稿"})]}),o.jsx("small",{children:ee.deploymentTarget?"待更新":"尚未发布"})]}),o.jsx(Sv,{"aria-hidden":!0})]},ee.id)}),De.map(ee=>{const xe=ee.runtimeId?Zl.get(ee.runtimeId):void 0,Re=ee.runtimeId?Pu.get(ee.runtimeId):void 0,ut=ur.has(ee.id),Lt=ee.canDelete===!0,Xe=(xe==null?void 0:xe.status)==="running"?{label:"部署中",className:" is-deploying"}:(xe==null?void 0:xe.status)==="error"?{label:"失败",className:" is-error"}:(xe==null?void 0:xe.status)==="cancelled"?{label:"已取消",className:" is-muted"}:Re?{label:"待更新",className:""}:null,Qn=(xe==null?void 0:xe.status)==="running"?"正在更新部署":Re?"待更新":ee.remote?ee.host||"远程智能体":"本地智能体",zi=["aw-agent-item","aw-agent-item--sortable",ee.id===Q?"is-active":"",sn?"is-selecting":"",ut?"is-selected-for-delete":"",sn&&!Lt?"is-selection-disabled":"",ee.id===Fe?"is-dragging":"",ee.id===Te&&ee.id!==Fe?`is-drop-target is-drop-${Vt}`:""].filter(Boolean).join(" ");return o.jsxs("button",{type:"button",draggable:!!w&&!sn,className:zi,"aria-pressed":sn?ut:void 0,"aria-keyshortcuts":w?"Alt+ArrowUp Alt+ArrowDown":void 0,onDragStart:Cn=>{w&&(io.current=!0,Rt(ee.id),Cn.dataTransfer.effectAllowed="move",Cn.dataTransfer.setData("text/plain",ee.id))},onDragEnter:Cn=>{KE(Cn,ee.id)},onDragOver:Cn=>{!Fe||Fe===ee.id||(Cn.preventDefault(),Cn.dataTransfer.dropEffect="move",KE(Cn,ee.id))},onDragLeave:Cn=>{const Xs=Cn.relatedTarget;Xs instanceof Node&&Cn.currentTarget.contains(Xs)||Te===ee.id&&bt("")},onDrop:Cn=>{Cn.preventDefault();const Xs=Cn.dataTransfer.getData("text/plain")||Fe;AO(Xs,ee.id,Vt),Rt(""),bt(""),lt("before")},onDragEnd:()=>{Rt(""),bt(""),lt("before"),window.setTimeout(()=>{io.current=!1},0)},onKeyDown:Cn=>{Cn.altKey&&(Cn.key==="ArrowUp"?(Cn.preventDefault(),sc(ee.id,-1)):Cn.key==="ArrowDown"&&(Cn.preventDefault(),sc(ee.id,1)))},onClick:Cn=>{if(sn){Cn.preventDefault(),RR(ee);return}if(io.current){Cn.preventDefault(),io.current=!1;return}H(""),F(ee.id),D("basic"),k(ee.id)},children:[sn&&o.jsx("span",{className:`aw-select-marker${ut?" is-checked":""}`,"aria-hidden":"true"}),o.jsxs("span",{className:"aw-agent-copy",children:[o.jsxs("span",{className:"aw-agent-name-row",children:[o.jsx("strong",{children:ee.label}),ee.currentVersion!=null&&o.jsxs("span",{className:"aw-version-badge",children:["v",ee.currentVersion]}),Xe&&o.jsx("span",{className:`aw-draft-badge${Xe.className}`,children:Xe.label})]}),o.jsx("small",{children:Qn})]}),o.jsx(Sv,{"aria-hidden":!0})]},ee.id)})]})}),o.jsxs("div",{className:"aw-list-count",children:["共 ",I==="library"?e.length+Jl:Wl.length," 个"]})]}),I==="evaluation"&&Y?o.jsx(zkt,{group:Y,agents:e,cases:Gc,onChange:$d,onRun:C0}):I==="evaluation"?o.jsx("main",{className:"aw-main aw-empty-selection",children:o.jsx("p",{children:"未选择评测组"})}):!se&&!Tn&&!qn?o.jsx("main",{className:"aw-main aw-empty-selection",children:o.jsx("p",{children:"未选择智能体"})}):o.jsxs("main",{className:`aw-main${co?" is-deploying":""}${O?" resource-page":""}`,children:[se&&!nr&&s&&o.jsx("div",{className:"aw-detail-loading",role:"status","aria-live":"polite",children:o.jsxs("div",{className:"aw-detail-loading-card",children:[o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),o.jsxs("span",{children:[o.jsx("strong",{children:"正在加载智能体"}),o.jsx("small",{children:"正在读取配置与运行信息…"})]})]})}),N==="integrations"&&le&&o.jsx("div",{className:"aw-detail-loading",role:"status","aria-live":"polite",children:o.jsxs("div",{className:"aw-detail-loading-card",children:[o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),o.jsxs("span",{children:[o.jsx("strong",{children:"正在探测接入方式"}),o.jsx("small",{children:"正在确认 API Server 与 A2A…"})]})]})}),o.jsx(mE,{className:"aw-agent-detail",title:Vn,description:Kn.description||(s||O&&!At?"正在读取智能体信息…":"暂无描述"),identitySeed:Vn,backLabel:"返回智能体列表",onBack:O?v:void 0,meta:o.jsxs(o.Fragment,{children:[ec!=null&&o.jsxs("span",{className:"aw-agent-meta",children:["v",ec]}),Tn&&o.jsx("span",{className:"aw-agent-meta",children:"草稿"}),oo&&o.jsx("span",{className:"aw-agent-meta",children:"待更新"}),!se&&!Tn&&qn&&o.jsx("span",{className:"aw-agent-meta",children:qn.label})]}),actionsClassName:"aw-head-actions",bodyClassName:"aw-agent-detail__body",actions:Tn||oo||se!=null&&se.canDelete?o.jsxs(o.Fragment,{children:[(Tn||oo)&&o.jsxs(It,{type:"button",color:"danger",variant:"soft",size:"lg",pill:!1,onClick:()=>{const ee=Tn??oo;ee&&NO(ee)},disabled:en,"aria-label":"删除草稿",title:"删除草稿",children:[o.jsx(Up,{"aria-hidden":!0}),o.jsx("span",{children:"删除草稿"})]}),(se==null?void 0:se.canDelete)&&o.jsxs(It,{type:"button",color:"danger",variant:"soft",size:"lg",pill:!1,onClick:()=>void MR(se),disabled:en,"aria-label":"删除 Agent",title:"删除 Agent",children:[o.jsx(Up,{"aria-hidden":!0}),o.jsx("span",{children:en?"删除中…":"删除 Agent"})]})]}):void 0,sections:Md.map(ee=>{var xe,Re,ut,Lt;return{key:ee.id,label:ee.label,disabled:co,content:ee.id===N?o.jsxs(o.Fragment,{children:[Jt&&jr&&o.jsx("div",{className:`aw-detail-deployment${co?" is-running":""}`,children:o.jsx($kt,{task:Jt,onReturnToEdit:kh&&M?()=>M(kh):void 0})}),o.jsxs("div",{className:"aw-content",children:[N==="basic"&&o.jsxs("div",{className:"aw-basic-stack",children:[Et&&o.jsx(zg,{className:"aw-detail-fetch-alert",color:"warning",variant:"soft",title:"部分信息暂不可用",description:"当前 Runtime 暂不支持 Studio 详情接口。升级 Runtime 后可查看完整信息。"}),(Je&&!Et||ye)&&o.jsx(zg,{className:"aw-detail-fetch-alert",color:"danger",variant:"soft",title:"详情加载失败",description:"暂时无法读取完整的 Agent 或 Runtime 信息,请稍后重试。",actions:o.jsx(It,{type:"button",color:"danger",variant:"soft",size:"sm",pill:!1,onClick:()=>Se(Xe=>Xe+1),children:"重试"})}),se&&yt&&!yt.canUpdate&&o.jsxs("div",{className:"aw-update-recovery-notice",role:yt.recoveryStatus==="preparing"?"status":"alert",children:[o.jsx("strong",{children:yt.recoveryStatus==="preparing"?"正在后台恢复更新配置":"已检测到运行中的智能体,但原发布配置不可恢复"}),yt.reason&&o.jsx("span",{children:yt.reason}),yt.warnings.map(Xe=>o.jsx("span",{children:Xe},Xe))]}),o.jsxs("section",{className:"aw-deployment-panel aw-settings-card",children:[o.jsx("div",{className:"aw-section-head",children:o.jsxs("div",{children:[o.jsx("h3",{children:"部署配置"}),o.jsx("p",{children:"配置目标环境与网络访问方式。"})]})}),o.jsxs("dl",{className:"aw-readonly-config",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"运行状态"}),o.jsxs("dd",{className:(z==null?void 0:z.status.toLowerCase())==="ready"?"is-ready":void 0,children:[(z==null?void 0:z.status.toLowerCase())==="ready"&&o.jsx("span",{className:"aw-status-dot"}),(z==null?void 0:z.status)||"读取中…"]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"部署区域"}),o.jsx("dd",{children:(z==null?void 0:z.region)||(se==null?void 0:se.region)||(Jt==null?void 0:Jt.region)||"暂未提供"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"网络访问"}),o.jsx("dd",{children:z!=null&&z.networkTypes.length?z.networkTypes.join(" / "):"暂未提供"})]})]})]}),o.jsxs("section",{className:"aw-canvas-card",children:[o.jsx("div",{className:"aw-card-head",children:o.jsx("strong",{children:"执行流程"})}),o.jsx("div",{className:"aw-canvas",children:o.jsx(Fw,{draft:Kn,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0},T0)})]}),o.jsxs("section",{className:"aw-details-card",children:[o.jsx("div",{className:"aw-card-head",children:o.jsx("strong",{children:"详细信息"})}),o.jsxs("dl",{className:"aw-facts",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"模型"}),o.jsx("dd",{children:F7(nr==null?void 0:nr.model)||Kn.modelName||"暂未提供"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"智能体数量"}),o.jsx("dd",{children:nr!=null&&nr.graph?bve(nr.graph):yve(Kn)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"工具"}),o.jsx("dd",{className:"aw-fact-badges",children:cn.length?cn.map(Xe=>o.jsx("span",{children:Xe},Xe)):"暂无"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"技能"}),o.jsx("dd",{className:"aw-fact-badges",children:pn===null?"暂不支持预览":pn.length?pn.map(Xe=>o.jsx("span",{children:Xe},Xe)):"暂无"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"当前版本"}),o.jsx("dd",{children:ec!=null?`v${ec}`:"暂未提供"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"状态"}),o.jsx("dd",{children:Tn?"草稿":(Jt==null?void 0:Jt.status)==="error"?"部署失败":(Jt==null?void 0:Jt.status)==="cancelled"?"已取消":oo?"待更新":o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"aw-status-dot"}),"可用"]})})]})]})]}),o.jsxs("section",{className:"aw-sidecar-panel aw-settings-card","aria-label":"已选择的优化项",children:[o.jsx("div",{className:"aw-section-head",children:o.jsxs("div",{children:[o.jsx("h3",{children:"已选择的优化项"}),o.jsx("p",{children:"发布时选择的智能体优化项。"})]})}),o.jsxs("dl",{className:"aw-readonly-config",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"配置状态"}),o.jsx("dd",{className:rr!=null&&rr.enabled?"is-ready":void 0,children:rr?rr.enabled?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"aw-status-dot"}),"已启用"]}):"未启用":"未记录"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"优化场景"}),o.jsx("dd",{children:rr?hhe(rr.profile):"旧版本未保存此配置"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"已选优化项"}),o.jsx("dd",{className:"aw-fact-badges",children:rr?Qr.length?Qr.map(Xe=>o.jsx("span",{children:jv(Xe)},Xe)):"未选择":"旧版本未保存此配置"})]})]})]})]}),N==="usage"&&(se==null?void 0:se.runtimeId)&&o.jsxs("section",{className:"aw-usage","aria-busy":un,children:[o.jsx("div",{className:"aw-usage-intro",children:o.jsx("h3",{children:"使用概览"})}),un&&!ys&&o.jsx("div",{className:"aw-usage-state",role:"status","aria-live":"polite",children:o.jsx(En,{as:"span",children:"正在加载用量统计"})}),Oi&&o.jsxs("div",{className:"aw-usage-state is-error",role:"alert",children:[o.jsx("span",{children:Oi}),o.jsx("button",{type:"button",onClick:()=>he(Xe=>Xe+1),children:"重试"})]}),!un&&!Oi&&!ys&&!ri&&o.jsx("div",{className:"aw-usage-state",children:"当前 Runtime 未返回可用的 Agent 应用名称,暂时无法读取用量。"}),ys&&o.jsxs(o.Fragment,{children:[o.jsxs("dl",{className:"aw-usage-summary","aria-label":"Agent 用量摘要",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"总调用次数"}),o.jsx("dd",{children:ys.totalInvocations.toLocaleString("zh-CN")})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"使用用户数"}),o.jsx("dd",{children:ys.totalUsers.toLocaleString("zh-CN")})]})]}),o.jsxs("div",{className:"aw-usage-users-head",children:[o.jsx("h3",{children:"用户明细"}),un&&o.jsx(En,{as:"span",role:"status","aria-live":"polite",children:"正在刷新"})]}),ys.users.length===0?o.jsx("div",{className:"aw-usage-state",children:"暂无使用记录。用户成功调用后将在这里显示。"}):o.jsx("div",{className:"aw-usage-table-wrap",children:o.jsxs("table",{className:"aw-usage-table",children:[o.jsx("caption",{children:"当前 Agent 的使用用户列表"}),o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{scope:"col",children:"用户"}),o.jsx("th",{scope:"col",children:"调用次数"}),o.jsx("th",{scope:"col",children:"最近使用"})]})}),o.jsx("tbody",{children:ys.users.map(Xe=>o.jsxs("tr",{children:[o.jsxs("td",{children:[o.jsx("strong",{children:Xe.displayName||Xe.userId||"未知用户"}),Xe.displayName&&Xe.userId&&o.jsx("small",{title:Xe.userId,children:Xe.userId})]}),o.jsx("td",{children:Xe.invocationCount.toLocaleString("zh-CN")}),o.jsx("td",{children:o.jsx("time",{dateTime:Xe.lastUsedAt,children:bkt(Xe.lastUsedAt)})})]},Xe.userId))})]})}),ys.totalPages>1&&o.jsxs("nav",{className:"aw-usage-pagination","aria-label":"用量用户列表分页",children:[o.jsx("button",{type:"button",disabled:un||ys.page<=1,onClick:()=>Hs(Xe=>Math.max(1,Xe-1)),children:"上一页"}),o.jsxs("span",{"aria-live":"polite",children:["第 ",ys.page," / ",ys.totalPages," 页"]}),o.jsx("button",{type:"button",disabled:un||ys.page>=ys.totalPages,onClick:()=>Hs(Xe=>Xe+1),children:"下一页"})]})]})]}),N==="versions"&&o.jsxs("section",{className:"aw-version-stack",children:[o.jsxs("div",{className:"aw-integration-intro",children:[o.jsx("h3",{children:"GitHub 交付版本"}),o.jsx("p",{children:(xe=we==null?void 0:we.cicd)!=null&&xe.enabled?"展示当前 Runtime 绑定 GitHub 后由 Studio 记录的版本与 PR。":"未挂载 GitHub 时仅展示 Studio 当前版本。"})]}),st&&o.jsx("div",{className:"aw-case-empty",children:"正在读取版本…"}),ie&&o.jsxs("div",{className:"aw-integration-error",role:"alert",children:[o.jsx("span",{children:ie}),(se==null?void 0:se.runtimeId)&&o.jsx("button",{type:"button",onClick:()=>void H_(se.runtimeId??"").then(Ee),children:"重试"})]}),!st&&!ie&&o.jsxs("div",{className:"aw-version-list",children:[(we==null?void 0:we.githubSyncError)&&o.jsx("div",{className:"aw-integration-error",role:"alert",children:o.jsx("span",{children:we.githubSyncError})}),(we==null?void 0:we.latestSourceRuntimeStatus)&&we.latestSourceRuntimeStatus!=="published"&&((Re=we.versions[0])==null?void 0:Re.commitSha)&&we.versions[0].commitSha!==we.currentCommitSha&&o.jsx("div",{className:"aw-integration-notice",role:"status",children:o.jsxs("span",{children:["源码已合入 main,Runtime 仍在",mJ(we.latestSourceRuntimeStatus),";当前线上版本保持在最近一次发布成功的版本。"]})}),we!=null&&we.versions.length?we.versions.map(Xe=>{var Ii;const Qn=Xe.commitSha??"",zi=Xe.runtimeStatus??Xe.status,Cn=Xe.changeType==="rollback",Xs=!!((Ii=we.cicd)!=null&&Ii.enabled)&&!!Qn&&!Cn&&Qn!==we.currentCommitSha;return o.jsxs("article",{className:"aw-version-row",children:[o.jsxs("div",{children:[o.jsx("strong",{children:Okt(Xe)}),o.jsx("small",{children:Xe.createdAt||"暂无时间"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"PR 链接"}),Xe.pullRequestUrl?o.jsx("a",{href:Xe.pullRequestUrl,target:"_blank",rel:"noopener noreferrer",children:"查看 PR"}):o.jsx("em",{children:"无 PR"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"提交人"}),o.jsx("em",{children:Xe.author||"Studio"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"发布状态"}),o.jsx("em",{children:mJ(zi)})]}),o.jsxs("div",{className:"aw-version-actions",children:[o.jsx("button",{type:"button",disabled:!Xs||Ie===Qn,onClick:()=>void _h(Xe),children:Ie===Qn?"回退中…":"回退到此版本"}),Xe.workflowRunUrl&&o.jsx("a",{href:Xe.workflowRunUrl,target:"_blank",rel:"noopener noreferrer",children:"查看发布"})]})]},`${Xe.version}-${Qn||Xe.createdAt}`)}):o.jsxs("article",{className:"aw-version-row",children:[o.jsxs("div",{children:[o.jsx("strong",{children:ec!=null?`v${ec}`:"暂无版本"}),o.jsx("small",{children:(z==null?void 0:z.updatedAt)||"暂无时间"})]}),o.jsx("p",{children:"未挂载 GitHub 时仅展示 Studio 当前版本。"})]})]})]}),N==="integrations"&&o.jsxs("div",{className:"aw-integration-stack",children:[o.jsxs("div",{className:"aw-integration-intro",children:[o.jsx("h3",{children:"接入方式"}),o.jsx("p",{children:"仅展示当前 Runtime 可确认的公开协议与地址。"})]}),re&&o.jsxs("div",{className:"aw-integration-error",role:"alert",children:[o.jsx("span",{children:re}),o.jsx("button",{type:"button",onClick:()=>J(Xe=>Xe+1),children:"重试"})]}),!re&&o.jsxs("div",{className:"aw-integration-body",children:[o.jsxs("div",{className:`aw-integration-protocol-tabs${de==="a2a"?" is-a2a":""}`,role:"tablist","aria-label":"接入协议",children:[o.jsx("span",{className:"aw-integration-protocol-slider","aria-hidden":"true"}),vx.map((Xe,Qn)=>o.jsx("button",{type:"button",id:`integration-${Xe.id}-tab`,role:"tab","aria-selected":de===Xe.id,"aria-controls":`integration-${Xe.id}-panel`,tabIndex:de===Xe.id?0:-1,onClick:()=>Sa(Xe.id),onKeyDown:zi=>{var Ii;if(!["ArrowLeft","ArrowRight","Home","End"].includes(zi.key))return;zi.preventDefault();const Cn=zi.key==="Home"?0:zi.key==="End"?vx.length-1:(Qn+(zi.key==="ArrowRight"?1:-1)+vx.length)%vx.length,Xs=vx[Cn];Sa(Xs.id),(Ii=document.getElementById(`integration-${Xs.id}-tab`))==null||Ii.focus()},children:Xe.label},Xe.id))]}),de==="api-server"?o.jsx(bJ,{protocol:"api-server",title:"API Server",available:na,fields:[{label:"Agent",value:na?((ut=Nr==null?void 0:Nr.apiApps)==null?void 0:ut.join("、"))??"":""},{label:"发现接口",value:na?IP(vt,"/list-apps"):""},{label:"调用接口",value:na?IP(vt,"/run_sse"):""},{label:"鉴权方式",value:na?pJ(z==null?void 0:z.authType):""},{label:"API Key",value:o.jsx(gJ,{available:na,authType:z==null?void 0:z.authType,value:Os,visible:Ue&&!!Os,loading:Ce,error:pe,onToggle:()=>void Mu()})}],example:na?xkt(vt,nt,z==null?void 0:z.authType):""}):o.jsx(bJ,{protocol:"a2a",title:"A2A",available:ue,fields:[{label:"Agent",value:((Lt=Nr==null?void 0:Nr.a2a)==null?void 0:Lt.name)??""},{label:"Agent Card",value:ue?IP(vt,"/.well-known/agent-card.json"):""},{label:"调用地址",value:vn},{label:"鉴权方式",value:ue?pJ(z==null?void 0:z.authType):""},{label:"API Key",value:o.jsx(gJ,{available:ue,authType:z==null?void 0:z.authType,value:Os,visible:Ue&&!!Os,loading:Ce,error:pe,onToggle:()=>void Mu()})}],example:ue?vkt(vn,z==null?void 0:z.authType):""})]})]}),N==="evaluations"&&o.jsxs("section",{className:"aw-cases",children:[(se==null?void 0:se.runtimeId)&&o.jsx("div",{className:"aw-case-summary",children:["good","bad"].map(Xe=>{const Qn=Akt(qr,Xe),zi=Gc.filter(Xs=>Xs.kind===Xe).length,Cn=tc?zi:(Qn==null?void 0:Qn.itemCount)??zi;return o.jsxs("button",{type:"button",onClick:()=>Ld(Xe),children:[o.jsx("strong",{children:Cn}),o.jsx("span",{children:Xe==="good"?"Good cases":"Bad cases"})]},Xe)})}),o.jsxs("div",{className:"aw-case-filter-bar",children:[o.jsxs("div",{className:"aw-case-filter-stack",children:[o.jsx("div",{className:"aw-case-filters","aria-label":"案例结果筛选",children:["good","bad"].map(Xe=>o.jsx("button",{type:"button",className:_t===Xe?"is-active":"","aria-pressed":_t===Xe,onClick:()=>Nt(Xe),children:Xe==="good"?"Good case":"Bad case"},Xe))}),o.jsx("div",{className:"aw-case-source-filters","aria-label":"回流方式筛选",children:["auto","user"].map(Xe=>o.jsx("button",{type:"button",className:oe===Xe?"is-active":"","aria-pressed":oe===Xe,onClick:()=>Zt(Xe),children:Xe==="auto"?"自动回流":"手动回流"},Xe))})]}),o.jsxs("label",{className:"aw-case-search",children:[o.jsx(bC,{"aria-hidden":!0}),o.jsx("input",{type:"search",value:rn,onChange:Xe=>an(Xe.currentTarget.value),placeholder:"搜索用户输入、期望行为或标签","aria-label":"搜索评测案例"})]})]}),Wc&&o.jsx("div",{className:`aw-case-toolbar${Me?" is-active":""}`,children:Me?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"aw-selection-count",children:["已选 ",No.length," 条"]}),o.jsx("button",{type:"button",onClick:kt,disabled:nc.length===0||xn,children:"全选当前"}),o.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void $r(No),disabled:No.length===0||xn,children:xn?"删除中…":"删除所选"}),o.jsx("button",{type:"button",onClick:rc,disabled:xn,children:"取消"})]}):o.jsx("button",{type:"button",onClick:()=>{va(""),Pt(!0)},disabled:nc.length===0||xn,children:"选择案例"})}),Xl&&o.jsx("div",{className:"aw-delete-error",role:"alert",children:Xl}),o.jsx("div",{ref:qc,children:o.jsx(Fkt,{cases:nc,loading:Xr&&nc.length===0,error:Gr,notice:Jr,runtimeBacked:!!(se!=null&&se.runtimeId),selectionMode:Me,selectedCaseIds:Xt,focusedCaseId:wa,expandedCaseIds:ro,deleting:xn,canDelete:Wc,onOpenCase:ic,onToggleCase:ym,onToggleExpanded:ki,onDeleteCase:Xe=>void $r([Xe]),onRetry:()=>ta(Xe=>Xe+1)})})]}),N==="optimizations"&&o.jsxs("section",{className:"aw-optimizations",children:[o.jsxs("div",{className:"aw-optimization-intro",children:[o.jsx("h3",{children:"优化项"}),o.jsx("p",{children:"根据评测结果汇总需要优先处理的改进建议。"})]}),bs?o.jsxs("div",{className:"aw-optimization-state",role:"status",children:[o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),o.jsx("span",{children:"正在读取优化项"})]}):Qa?o.jsxs("div",{className:"aw-optimization-state is-error",role:"alert",children:[o.jsx("span",{children:Qa}),o.jsx("button",{type:"button",onClick:()=>Oa(Xe=>Xe+1),children:"重试"})]}):gs.length>0?o.jsx(Qkt,{groups:gs}):o.jsx("div",{className:"aw-optimization-state",children:"暂无优化项,自动评测完成后会在这里生成建议。"})]})]}),N==="basic"&&(se||Tn)&&o.jsxs("div",{className:"aw-basic-actions",children:[se&&o.jsxs("button",{type:"button",className:"aw-talk studio-update-action",onClick:()=>_==null?void 0:_(se),children:[o.jsx(JRe,{"aria-hidden":!0}),o.jsx("span",{children:"去对话"})]}),o.jsxs("span",{className:`aw-update-wrap${sr?" is-disabled":""}`,tabIndex:sr?0:void 0,"aria-describedby":sr?wn:void 0,children:[o.jsx("button",{type:"button",className:"aw-update studio-update-action",disabled:!!sr,"aria-busy":Be||void 0,"aria-describedby":sr?wn:void 0,onClick:()=>Tn?M==null?void 0:M(Tn):yt?j(yt):void 0,children:Be?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"loading-gap-spinner aw-update-spinner","aria-hidden":"true"}),o.jsx("span",{children:"准备中"})]}):Tn||oo?"继续编辑":"更新"}),sr&&o.jsx("span",{id:wn,className:"aw-update-disabled-reason",role:"tooltip",children:sr})]})]})]}):null}}),activeSectionKey:N,navigationLabel:"智能体详情",onSectionChange:D})]})]}),I==="evaluation"&&o.jsx("div",{className:"aw-evaluation-glass",role:"status",children:o.jsx("span",{children:"敬请期待"})})]})]}),Yn&&o.jsx(zl,{variant:"danger",title:Yn.title,description:Yn.description,confirmLabel:en?"删除中...":Yn.confirmLabel,closeLabel:"关闭删除确认",busy:en,onCancel:()=>Lr(null),onConfirm:()=>void PR()})]})}function Qkt({groups:e}){return o.jsx("div",{className:"aw-optimization-table-wrap",children:o.jsxs("table",{className:"aw-optimization-table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{scope:"col",children:"修复优先级"}),o.jsx("th",{scope:"col",children:"建议优化模块"}),o.jsx("th",{scope:"col",children:"优化建议和理由"})]})}),o.jsx("tbody",{children:e.map(t=>o.jsxs("tr",{children:[o.jsx("td",{children:o.jsx("span",{className:`aw-priority is-${t.priority}`,children:_kt(t.priority)})}),o.jsx("td",{children:o.jsx("span",{className:"aw-optimization-module",children:Ckt(t)})}),o.jsx("td",{children:o.jsx("ul",{className:"aw-optimization-list",children:t.items.map(n=>o.jsxs("li",{children:[o.jsx("strong",{children:n.suggestion}),o.jsx("p",{children:n.reason})]},`${n.suggestion}:${n.reason}`))})})]},`${t.priority}:${t.module}:${t.customModule??""}`))})]})})}function Ukt(){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("path",{d:"M4.5 7h15"}),o.jsx("path",{d:"M9 7V4.8h6V7"}),o.jsx("path",{d:"m6.5 7 .8 12h9.4l.8-12"}),o.jsx("path",{d:"M10 10.5v5M14 10.5v5"})]})}function Fkt({cases:e,loading:t=!1,error:n="",notice:r="",runtimeBacked:i=!1,selectionMode:s=!1,selectedCaseIds:a,focusedCaseId:l="",expandedCaseIds:c,deleting:u=!1,canDelete:d=!1,onOpenCase:f,onToggleCase:h,onToggleExpanded:m,onDeleteCase:g,onRetry:b}){return o.jsxs("div",{className:"aw-case-table",children:[o.jsxs("div",{className:"aw-case-row aw-case-row-head",children:[o.jsx("span",{children:"用户输入"}),o.jsx("span",{children:"Agent 输出"}),o.jsx("span",{children:"评分"}),o.jsx("span",{children:"评分理由"}),o.jsx("span",{className:"aw-case-action-head",children:"操作"})]}),t?o.jsx("div",{className:"aw-case-empty",children:"正在读取 AgentKit 评测集…"}):n?o.jsxs("div",{className:"aw-case-empty aw-case-error",children:[o.jsx("span",{children:n}),b&&o.jsx("button",{type:"button",onClick:b,children:"重试"})]}):r?o.jsx("div",{className:"aw-case-empty",children:r}):e.length===0?o.jsx("div",{className:"aw-case-empty",children:i?"暂无用户反馈案例":"没有匹配的案例"}):e.map(y=>{var _,T;const O=y.id.startsWith("local:"),v=(a==null?void 0:a.has(y.id))??!1,x=(c==null?void 0:c.has(y.id))??!1,S=y.output.length+y.referenceOutput.length>220||(((_=y.reason)==null?void 0:_.length)??0)>120,E=d&&!O,k=!!(y.comment&&y.comment.trim()!==((T=y.reason)==null?void 0:T.trim()));return o.jsxs("div",{className:["aw-case-row",l===y.id?"is-focused":"",s?"is-selecting":"",v?"is-selected-for-delete":""].filter(Boolean).join(" "),role:"row",tabIndex:0,"aria-selected":s?v:void 0,onClick:()=>{if(s){E&&(h==null||h(y));return}f==null||f(y)},onKeyDown:C=>{C.target===C.currentTarget&&(C.key!=="Enter"&&C.key!==" "||(C.preventDefault(),s?E&&(h==null||h(y)):f==null||f(y)))},children:[o.jsxs("div",{className:"aw-case-text aw-case-cell","data-label":"用户输入",children:[o.jsxs("span",{className:"aw-case-title-line",children:[s&&E&&o.jsx("span",{className:`aw-select-marker${v?" is-checked":""}`,"aria-hidden":"true"}),o.jsx("strong",{title:y.input,children:y.input||"无用户输入"})]}),k&&o.jsxs("small",{title:y.comment,children:["备注:",y.comment]}),o.jsx("small",{className:"aw-case-time",children:Ekt(y.createdAt)}),(y.userId||y.sessionId)&&o.jsx("small",{title:[y.userId,y.sessionId].filter(Boolean).join(" · "),children:[y.userId,y.sessionId].filter(Boolean).join(" · ")})]}),o.jsxs("div",{className:`aw-case-output aw-case-cell${x?" is-expanded":""}`,"data-label":"Agent 输出",children:[o.jsx("p",{className:"aw-case-output-preview",title:y.output,children:y.output||"无可见回复"}),y.referenceOutput&&o.jsxs("small",{className:"aw-case-output-preview",title:y.referenceOutput,children:["Reference: ",y.referenceOutput]}),S&&o.jsx("button",{type:"button",className:"aw-case-expand",onClick:C=>{C.stopPropagation(),m==null||m(y.id)},children:x?"收起":"展开"})]}),o.jsx("div",{className:"aw-case-score aw-case-cell","data-label":"评分",children:kkt(y)}),o.jsx("div",{className:`aw-case-reason aw-case-cell${x?" is-expanded":""}`,"data-label":"评分理由",children:o.jsx("p",{title:y.reason||void 0,children:y.reason||"—"})}),o.jsx("div",{className:"aw-case-actions aw-case-cell","data-label":"操作",children:E&&o.jsx("button",{type:"button",className:"aw-case-delete",onClick:C=>{C.stopPropagation(),g==null||g(y)},disabled:u,title:"删除反馈案例","aria-label":"删除反馈案例",children:o.jsx(Ukt,{})})})]},y.id)})]})}function zkt({group:e,agents:t,cases:n,onChange:r,onRun:i}){const[s,a]=p.useState("config"),l=e.agentIds.map(f=>t.find(h=>h.id===f)).filter(f=>!!f),c=["回答质量","事实准确性","工具调用","响应效率"];p.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 o.jsxs("main",{className:"aw-main",children:[o.jsxs("div",{className:"aw-eval-head",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"aw-agent-title-row",children:[o.jsx("h2",{children:e.name}),o.jsx("span",{children:"评测组"})]}),o.jsxs("p",{children:[l.length," 个参评智能体 · ",e.caseSet," · ",e.history.length," 次运行"]})]}),o.jsxs("button",{type:"button",className:"aw-run",onClick:()=>i(e),disabled:!0,children:[o.jsx(qRe,{"aria-hidden":!0}),"开始评测"]})]}),o.jsxs("nav",{className:"aw-agent-tabs","aria-label":"评测组详情",children:[o.jsx("button",{type:"button",className:s==="config"?"is-active":"","aria-pressed":s==="config",onClick:()=>a("config"),disabled:!0,children:"评测配置"}),o.jsx("button",{type:"button",className:s==="history"?"is-active":"","aria-pressed":s==="history",onClick:()=>a("history"),disabled:!0,children:"历史结果"})]}),o.jsx("div",{className:"aw-content",children:s==="config"?o.jsxs("div",{className:"aw-eval-setup",children:[o.jsxs("section",{className:"aw-eval-block",children:[o.jsxs("div",{className:"aw-card-head",children:[o.jsx("strong",{children:"参评智能体"}),o.jsxs("span",{children:["已选择 ",l.length," 个"]})]}),o.jsx("div",{className:"aw-eval-agent-grid",children:t.map(f=>o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:e.agentIds.includes(f.id),onChange:()=>u(f.id)}),o.jsxs("span",{children:[o.jsx("strong",{children:f.label}),o.jsx("small",{children:f.remote?"远程":"本地"})]})]},f.id))})]}),o.jsxs("div",{className:"aw-eval-setting-grid",children:[o.jsxs("section",{className:"aw-eval-block",children:[o.jsx("div",{className:"aw-card-head",children:o.jsx("strong",{children:"评测资源"})}),o.jsxs("div",{className:"aw-eval-fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:"评测集"}),o.jsxs("select",{value:e.caseSet,onChange:f=>r({...e,caseSet:f.currentTarget.value}),children:[o.jsx("option",{children:"核心回归集"}),o.jsx("option",{children:"安全边界集"}),o.jsx("option",{children:"工具调用集"})]}),o.jsxs("small",{children:[n.length," 条案例"]})]}),o.jsxs("label",{children:[o.jsx("span",{children:"评估器"}),o.jsxs("select",{value:e.evaluator,onChange:f=>r({...e,evaluator:f.currentTarget.value}),children:[o.jsx("option",{children:"综合质量评估器"}),o.jsx("option",{children:"事实一致性评估器"}),o.jsx("option",{children:"工具调用评估器"})]})]}),o.jsxs("label",{children:[o.jsx("span",{children:"并发数"}),o.jsxs("select",{value:e.concurrency,onChange:f=>r({...e,concurrency:f.currentTarget.value}),children:[o.jsx("option",{value:"2",children:"2"}),o.jsx("option",{value:"4",children:"4"}),o.jsx("option",{value:"8",children:"8"})]})]})]})]}),o.jsxs("section",{className:"aw-eval-block",children:[o.jsxs("div",{className:"aw-card-head",children:[o.jsx("strong",{children:"评测指标"}),o.jsxs("span",{children:["已选择 ",e.metrics.length," 项"]})]}),o.jsx("div",{className:"aw-metric-list",children:c.map(f=>o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:e.metrics.includes(f),onChange:()=>d(f)}),o.jsx("span",{children:f})]},f))})]})]})]}):o.jsxs("section",{className:"aw-eval-history",children:[o.jsx("div",{className:"aw-section-head",children:o.jsxs("div",{children:[o.jsx("h3",{children:"历史结果"}),o.jsx("p",{children:"查看该评测组历次运行的总体表现。"})]})}),e.history.length===0?o.jsxs("div",{className:"aw-results-empty",children:[o.jsx("strong",{children:"暂无历史结果"}),o.jsx("span",{children:"完成首次评测后,结果会出现在这里。"})]}):o.jsx("div",{className:"aw-history-list",children:e.history.map((f,h)=>o.jsxs("button",{type:"button",children:[o.jsxs("span",{children:[o.jsxs("strong",{children:["评测运行 #",e.history.length-h]}),o.jsxs("small",{children:[f.createdAt," · ",l.length," 个智能体"]})]}),o.jsxs("span",{className:"aw-history-score",children:[o.jsx("strong",{children:f.score}),o.jsx("small",{children:"综合得分"})]}),o.jsxs("span",{className:"aw-complete",children:[o.jsx(_u,{}),"已完成"]}),o.jsx(Sv,{"aria-hidden":!0})]},f.id))})]})})]})}const Vkt=5e3,Hkt=4;let DP=0;const OJ=[];function xJ(e){return e instanceof Error&&e.name==="AbortError"}function qkt(e){return e instanceof Error&&e.name==="TimeoutError"}function Xkt(e){return qkt(e)||e instanceof w9&&[500,502,503,504].includes(e.status)}function Gkt(e,t){return t!=null&&t.aborted?Promise.reject(t.reason??new DOMException("Request aborted","AbortError")):new Promise((n,r)=>{const i=()=>{globalThis.clearTimeout(s),r((t==null?void 0:t.reason)??new DOMException("Request aborted","AbortError"))},s=globalThis.setTimeout(()=>{t==null||t.removeEventListener("abort",i),n()},e);t==null||t.addEventListener("abort",i,{once:!0})})}async function Wkt(e={},t={}){const n=t.request??H1,r=t.wait??Gkt;try{return await n(e)}catch(i){if(!Xkt(i))throw i;return await r(Vkt,e.signal),n(e)}}async function wve(e){var t;DP>=Hkt&&await new Promise(n=>OJ.push(n)),DP+=1;try{return await e()}finally{DP-=1,(t=OJ.shift())==null||t()}}async function Ykt(e,t){await Promise.allSettled(e.map(n=>wve(()=>t(n))))}const Zkt="/web/sandbox/sessions",vJ="/web/sandbox/codex-project-handoff",wJ=3e4,PP=33e4,Kkt=6e4,Jkt=6e5,wx=15e3,uf=6e4,e2t=33e4,SJ=3e4,t2t=60*60,EJ=40;function bR(e){switch(e.trim().toLowerCase()){case"ready":return"就绪";case"wakeable":return"可唤醒";case"creating":return"创建中";case"starting":case"initializing":return"启动中";case"pending":return"等待中";case"running":return"运行中";case"failed":case"error":return"异常";case"stopped":return"已停止";case"expired":return"已过期";case"deleting":return"删除中";case"deleted":return"已删除";default:return"未知状态"}}function Xi(e){const t=new Headers(e);return t.has("Accept")||t.set("Accept","application/json"),t}class yR extends Error{constructor(n,r={}){var i;super(n);Er(this,"code");Er(this,"retryable");Er(this,"publicMessage");Er(this,"httpStatus");this.name="SandboxServiceError",this.code=r.code??"",this.retryable=r.retryable===!0,this.publicMessage=((i=r.publicMessage)==null?void 0:i.trim())||n,this.httpStatus=r.httpStatus}}function kJ(e){return e instanceof yR?e.publicMessage:e instanceof Error&&e.name==="TimeoutError"?"等待开发环境响应超时。任务可能仍在运行,请稍后重新进入当前会话查看状态。":e instanceof TypeError?"与开发环境的连接已中断。任务可能仍在运行,请稍后重新进入当前会话查看状态。":"开发任务未能继续,开发环境已保留。请在当前会话重试。"}async function Gi(e,t){const n=await e.text().catch(()=>"");let r={};try{r=JSON.parse(n)}catch{const d=`${t}(HTTP ${e.status})`;return new Error(n?`${d}:${n}`:d)}const i=r.detail,s=i&&typeof i=="object"?i:r,a=i&&typeof i=="object"&&"message"in i?i.message:i??r.error??r.message,l=typeof a=="string"?a:a==null?"":JSON.stringify(a),c=`${t}(HTTP ${e.status})`,u=l?`${c}:${l}`:c;return new yR(u,{code:typeof s.code=="string"?s.code:"",retryable:s.retryable===!0,publicMessage:l||c,httpStatus:e.status})}async function _J(e,t){const n=await e.text().catch(()=>"");try{return JSON.parse(n)}catch{throw new Error(`${t} Studio 服务响应异常,请刷新后重试。`)}}function jm(e,t="codex"){if(!e.sessionId||!e.status)throw new Error("AgentKit 沙箱返回了无效的 Session 信息。");return{resourceType:"session",id:e.sessionId,toolName:t,userSessionId:e.userSessionId??"",displayName:e.displayName??"",status:e.status,createdAt:e.createdAt??"",expireAt:e.expireAt??"",persistent:e.persistent!==!1,toolType:e.toolType??"",intelligentDevelopment:e.toolName==="intelligent-development",createdBy:e.createdBy??"",region:e.region??"",isMine:e.isMine===!0,threadId:e.threadId??"",cwd:e.cwd??"",workspaceLocked:e.workspaceLocked===!0,busy:e.busy===!0,...typeof e.model=="string"?{model:e.model}:{},permissions:OR(e.permissions),...e.conversation===void 0?{}:{restoredConversation:Xm(e.conversation)}}}function TJ(e,t="codex"){if(!e.snapshotId||!e.status)throw new Error("AgentKit 沙箱返回了无效的 Snapshot 信息。");return{resourceType:"snapshot",id:e.snapshotId,snapshotId:e.snapshotId,sourceSessionId:e.sessionId??"",toolName:t,userSessionId:e.userSessionId??"",displayName:e.displayName??"",status:e.status,snapshotStatus:e.snapshotStatus??"Unknown",reason:e.reason??"",createdAt:e.createdAt??"",createdBy:e.createdBy??"",region:e.region??"",isMine:e.isMine===!0}}function CJ(e,t){if(!(t!=null&&t.autoResumeSnapshots))return e;const n=new URLSearchParams({autoResumeSnapshots:"true"});return`${e}?${n.toString()}`}const Sx={approvalPolicy:"on-request",approvalsReviewer:"user",sandboxMode:"workspace-write",networkAccess:!1};function OR(e){if(!e||typeof e!="object")return{...Sx};const t=e,n=t.approvalPolicy,r=t.approvalsReviewer,i=t.sandboxMode;return{approvalPolicy:n==="untrusted"||n==="on-request"||n==="never"?n:Sx.approvalPolicy,approvalsReviewer:r==="user"||r==="auto_review"?r:Sx.approvalsReviewer,sandboxMode:i==="read-only"||i==="workspace-write"||i==="danger-full-access"?i:Sx.sandboxMode,networkAccess:typeof t.networkAccess=="boolean"?t.networkAccess:Sx.networkAccess}}function AJ(e){if(!e||typeof e!="object")throw new Error("Sandbox 返回了无效设置。");const t=e;return{threadId:typeof t.threadId=="string"?t.threadId:"",cwd:typeof t.cwd=="string"?t.cwd:"",...typeof t.model=="string"?{model:t.model}:{},workspaceLocked:t.workspaceLocked===!0,busy:t.busy===!0,permissions:OR(t.permissions)}}function aa(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function n2t(e){const t=aa(e);if(!(!t||typeof t.id!="string"||!t.id))return{id:t.id,displayName:typeof t.displayName=="string"?t.displayName:t.id,description:typeof t.description=="string"?t.description:"",isDefault:t.isDefault===!0}}function r2t(e){const t=aa(e);if(!(!t||typeof t.id!="string"||!t.id||typeof t.name!="string"||!t.name))return{id:t.id,name:t.name,description:typeof t.description=="string"?t.description:""}}function Sve(e){const t=aa(e);if(!(!t||typeof t.id!="string"||!t.id))return{id:t.id,...typeof t.name=="string"&&t.name?{name:t.name}:{},preview:typeof t.preview=="string"?t.preview:"",cwd:typeof t.cwd=="string"?t.cwd:"",modelProvider:typeof t.modelProvider=="string"?t.modelProvider:"",createdAt:typeof t.createdAt=="number"&&Number.isFinite(t.createdAt)?t.createdAt:0,updatedAt:typeof t.updatedAt=="number"&&Number.isFinite(t.updatedAt)?t.updatedAt:0,status:typeof t.status=="string"?t.status:"unknown"}}function Xm(e){const t=aa(e),n=Sve(t==null?void 0:t.thread);if(!t||!n||typeof t.threadId!="string"||!Array.isArray(t.messages))throw new Error("Sandbox 返回了无效 Thread 快照。");const r=t.messages.flatMap(i=>{const s=aa(i);if(!s||typeof s.id!="string"||s.role!=="user"&&s.role!=="assistant"||typeof s.content!="string"||typeof s.timestamp!="number")return[];const a=Array.isArray(s.skillNames)?s.skillNames.filter(c=>typeof c=="string"&&!!c):[],l=Array.isArray(s.images)?s.images.flatMap(c=>{const u=aa(c);return!u||typeof u.mimeType!="string"||!u.mimeType.startsWith("image/")||typeof u.data!="string"||!u.data?[]:[{mimeType:u.mimeType,data:u.data,...typeof u.name=="string"&&u.name?{name:u.name}:{},...typeof u.alt=="string"&&u.alt?{alt:u.alt}:{}}]}):[];return[{id:s.id,role:s.role,content:s.content,timestamp:s.timestamp,...a.length?{skillNames:a}:{},...l.length?{images:l}:{}}]});return{thread:n,threadId:t.threadId,messages:r,...typeof t.model=="string"?{model:t.model}:{},...typeof t.cwd=="string"?{cwd:t.cwd}:{},workspaceLocked:t.workspaceLocked===!0,permissions:OR(t.permissions)}}function U6(e){if(!e||typeof e!="object")return;const t=e;if(![t.totalTokens,t.inputTokens,t.cachedInputTokens,t.outputTokens,t.reasoningOutputTokens].some(r=>typeof r!="number"||!Number.isFinite(r)||r<0))return{totalTokens:Math.trunc(t.totalTokens),inputTokens:Math.trunc(t.inputTokens),cachedInputTokens:Math.trunc(t.cachedInputTokens),outputTokens:Math.trunc(t.outputTokens),reasoningOutputTokens:Math.trunc(t.reasoningOutputTokens)}}function i2t(e){const t=U6(e.usage);if(!t||typeof e.turnId!="string")return;const n=U6(e.threadTotal),r=e.modelContextWindow;return{turnId:e.turnId,usage:t,...n?{threadTotal:n}:{},...typeof r=="number"&&Number.isFinite(r)&&r>=0?{modelContextWindow:Math.trunc(r)}:{}}}function s2t(e){return typeof e.id!="string"||e.kind!=="command"&&e.kind!=="file"||typeof e.method!="string"?null:{id:e.id,kind:e.kind,method:e.method,...typeof e.reason=="string"?{reason:e.reason}:{},...typeof e.command=="string"?{command:e.command}:{},...typeof e.cwd=="string"?{cwd:e.cwd}:{},...typeof e.grantRoot=="string"?{grantRoot:e.grantRoot}:{},...e.changes!==void 0?{changes:e.changes}:{},...typeof e.threadId=="string"?{threadId:e.threadId}:{},...typeof e.turnId=="string"?{turnId:e.turnId}:{},...typeof e.itemId=="string"?{itemId:e.itemId}:{}}}async function a2t(e,t={}){if(!e.body)throw new Error("沙箱对话服务未返回内容。");const n=e.body.getReader(),r=new TextDecoder;let i="",s="";const a=[],l=new Map;let c,u;function d(){var b;const g=c?[...a,c]:a;(b=t.onBlocks)==null||b.call(t,g.map(y=>({...y})))}function f(g){s+=g;const b=a[a.length-1],y=a.length-1,O=[...l.values()].includes(y);(b==null?void 0:b.kind)==="text"&&!O?b.text+=g:a.push({kind:"text",text:g}),d()}function h(g){if(typeof g.id!="string"||g.kind!=="thinking"&&g.kind!=="commentary"&&g.kind!=="tool"||g.status!=="running"&&g.status!=="done")return;const b=g.status==="done";let y;if(g.kind==="thinking"){if(typeof g.text!="string"||!g.text)return;y={kind:"thinking",text:g.text,done:b}}else if(g.kind==="commentary"){if(typeof g.text!="string"||!g.text)return;y={kind:"text",text:g.text}}else{if(typeof g.name!="string"||!g.name)return;y={kind:"tool",name:g.name,args:g.args,response:g.response,done:b}}const O=l.get(g.id);O===void 0?(l.set(g.id,a.length),a.push(y)):a[O]=y,d()}function m(g){var v,x,w;let b="message";const y=[];for(const S of g.split(/\r?\n/))S.startsWith("event:")&&(b=S.slice(6).trim()),S.startsWith("data:")&&y.push(S.slice(5).trimStart());if(y.length===0)return;let O;try{O=JSON.parse(y.join(` +`))}catch{throw new Error("沙箱对话服务返回了无法解析的响应。")}if(b==="error"){const S=typeof O.message=="string"&&O.message?O.message:"沙箱对话失败,请稍后重试。";throw new yR(S,{code:typeof O.code=="string"?O.code:"",retryable:O.retryable===!0,publicMessage:S})}if(b==="progress"&&typeof O.text=="string"&&O.text&&(c={kind:"progress",text:O.text},d()),b==="activity"&&h(O),b==="development.source_ready"||b==="development.succeeded"){const S=aa(O.payload),E=aa(S==null?void 0:S.delivery),k=b==="development.succeeded";if(E&&typeof E.sessionId=="string"&&typeof E.artifactSha256=="string"&&typeof E.validationReportSha256=="string"&&typeof E.agentName=="string"&&typeof E.entryPoint=="string"&&typeof E.fileCount=="number"&&typeof E.artifactSize=="number"&&typeof E.validatedAt=="string"&&E.deployable===!0&&E.verified===k&&typeof E.validationSummary=="string"&&Array.isArray(E.gateSummary)&&E.gateSummary.every(_=>typeof _=="string")){const _={kind:"delivery",value:{sessionId:E.sessionId,...typeof E.projectId=="string"&&typeof E.versionId=="string"?{projectId:E.projectId,versionId:E.versionId,...E.parentVersionId===null||typeof E.parentVersionId=="string"?{parentVersionId:E.parentVersionId}:{}}:{},artifactSha256:E.artifactSha256,validationReportSha256:E.validationReportSha256,agentName:E.agentName,entryPoint:E.entryPoint,fileCount:E.fileCount,artifactSize:E.artifactSize,validatedAt:E.validatedAt,gateSummary:E.gateSummary,deployable:E.deployable,verified:E.verified,validationSummary:E.validationSummary}},T=a.findIndex(C=>C.kind==="delivery"&&C.value.sessionId===E.sessionId&&C.value.artifactSha256===E.artifactSha256&&C.value.validationReportSha256===E.validationReportSha256);T===-1?a.push(_):a[T]=_,d()}}if(b==="approval"){const S=s2t(O);S&&((v=t.onApproval)==null||v.call(t,S))}if(b==="usage"){const S=i2t(O);S&&(u=S,(x=t.onUsage)==null||x.call(t,S))}b==="approval_resolved"&&typeof O.approvalId=="string"&&((w=t.onApprovalResolved)==null||w.call(t,O.approvalId)),b==="delta"&&typeof O.text=="string"&&f(O.text),b==="done"&&!s&&typeof O.text=="string"&&f(O.text),b==="done"&&c&&(c=void 0,d())}for(;;){const{done:g,value:b}=await n.read();i+=r.decode(b,{stream:!g});const y=i.split(/\r?\n\r?\n/);if(i=y.pop()??"",y.forEach(m),g)break}if(i.trim()&&m(i),c&&(c=void 0,d()),a.length===0)throw new Error("沙箱未返回有效回复,请重试。");return{text:s,blocks:a,...u?{usage:u}:{}}}async function ml(e,t,n,{method:r="GET",body:i,options:s={},fallback:a}){if(!t)throw new Error("缺少要操作的 AgentKit Session。");const l=await Dn(`${e}/${encodeURIComponent(t)}/${n}`,{method:r,headers:Xi(i===void 0?void 0:{"Content-Type":"application/json"}),...i===void 0?{}:{body:JSON.stringify(i)},signal:s.signal},uf);if(!l.ok)throw await Gi(l,a);return l.json()}function Eve(e,t={}){return{async listSessions(n={}){const r=await Dn(CJ(e,n),{method:"GET",headers:Xi(),signal:n.signal},wJ);if(!r.ok)throw await Gi(r,"无法读取 Codex 智能体,请稍后重试。");const i=await r.json();if(!Array.isArray(i.sessions))throw new Error("AgentKit 沙箱返回了无效的 Session 列表。");if(i.snapshots!==void 0&&!Array.isArray(i.snapshots))throw new Error("AgentKit 沙箱返回了无效的 Snapshot 列表。");return[...i.sessions.map(s=>jm(s)),...(i.snapshots??[]).map(s=>TJ(s))]},async startSession(n={}){var i,s;const r=await Dn(e,{method:"POST",headers:Xi({"Content-Type":"application/json"}),body:JSON.stringify({displayName:((i=n.displayName)==null?void 0:i.trim())??"",...(s=n.modelId)!=null&&s.trim()?{modelId:n.modelId.trim()}:{},...t.textOnly&&n.projectId?{projectId:n.projectId,...n.baseVersionId?{baseVersionId:n.baseVersionId}:{}}:{},...t.textOnly?{}:{persistent:n.persistent??!0}}),signal:n.signal},PP);if(!r.ok)throw await Gi(r,"无法启动 AgentKit 沙箱,请稍后重试。");return jm(await r.json())},async listAgentSessions(n,r={}){const i=await Dn(CJ(`/web/${n}/sessions`,r),{method:"GET",headers:Xi(),signal:r.signal},wJ);if(!i.ok)throw await Gi(i,`无法读取 ${n} 智能体,请稍后重试。`);const s=await i.json();if(!Array.isArray(s.sessions))throw new Error(`AgentKit 返回了无效的 ${n} Session 列表。`);if(s.snapshots!==void 0&&!Array.isArray(s.snapshots))throw new Error(`AgentKit 返回了无效的 ${n} Snapshot 列表。`);return[...s.sessions.map(a=>jm(a,n)),...(s.snapshots??[]).map(a=>TJ(a,n))]},async startAgentSession(n,r={}){var s;const i=await Dn(`/web/${n}/sessions`,{method:"POST",headers:Xi({"Content-Type":"application/json"}),body:JSON.stringify({displayName:((s=r.displayName)==null?void 0:s.trim())??"",persistent:r.persistent??!0}),signal:r.signal},PP);if(!i.ok)throw await Gi(i,`无法创建 ${n} 智能体,请稍后重试。`);return jm(await i.json(),n)},async openAgentSession(n,r,i={}){if(!r)throw new Error("缺少要打开的 AgentKit Session。");const s=await Dn(`/web/${n}/sessions/${encodeURIComponent(r)}/open`,{method:"POST",headers:Xi(),signal:i.signal},uf);if(!s.ok)throw await Gi(s,`无法打开 ${n} 智能体。`);const a=await s.json();if(typeof a.webuiUrl!="string"||!a.webuiUrl.startsWith("/"))throw new Error(`${n} 智能体返回了无效的主页面地址。`);return{session:jm(a,n),kind:n,webuiUrl:So(a.webuiUrl)}},async launchAgentTerminal(n,r,i={}){if(!r)throw new Error("缺少要打开 Terminal 的 AgentKit Session。");const s=await Dn(`/web/${n}/sessions/${encodeURIComponent(r)}/terminal`,{method:"POST",headers:Xi(),signal:i.signal},uf);if(!s.ok)throw await Gi(s,`无法打开 ${n} Terminal。`);const a=await s.json();return{url:kve(a.url,`${n} Terminal`),...typeof a.shellSessionId=="string"?{shellSessionId:a.shellSessionId}:{}}},async deleteAgentSession(n,r,i={}){if(!r)return;const s=await Dn(`/web/${n}/sessions/${encodeURIComponent(r)}`,{method:"DELETE",headers:Xi(),signal:i.signal},wx);if(!s.ok&&s.status!==404)throw await Gi(s,`无法删除 ${n} 智能体。`)},async resumeSnapshot(n,r,i={}){if(!r)throw new Error("缺少要唤醒的 AgentKit Snapshot。");const s=n==="codex"?"/web/sandbox":`/web/${n}`,a=await Dn(`${s}/snapshots/${encodeURIComponent(r)}/resume`,{method:"POST",headers:Xi(),signal:i.signal},PP);if(!a.ok)throw await Gi(a,"无法从快照唤醒智能体,请稍后重试。");return jm(await a.json(),n)},async deleteSnapshot(n,r,i={}){if(!r)return;const s=n==="codex"?"/web/sandbox":`/web/${n}`,a=await Dn(`${s}/snapshots/${encodeURIComponent(r)}`,{method:"DELETE",headers:Xi(),signal:i.signal},wx);if(!a.ok&&a.status!==404)throw await Gi(a,"无法删除智能体快照。")},async connectSession(n,r={}){if(!n)throw new Error("缺少要连接的 AgentKit Session。");const i=await Dn(`${e}/${encodeURIComponent(n)}/connect`,{method:"POST",headers:Xi({"Content-Type":"application/json"}),signal:r.signal},Kkt);if(!i.ok)throw await Gi(i,"无法连接 Codex 智能体,请稍后重试。");const s=jm(await i.json());if(s.status.toLowerCase()!=="ready")throw new Error(`AgentKit Session 尚未就绪,当前状态:${s.status}。`);return s},async sendMessage(n,r={}){var s;if(!n.sessionId||!n.text.trim())throw new Error("内置智能体会话缺少有效的消息内容。");const i=await Dn(`${e}/${encodeURIComponent(n.sessionId)}/messages`,{method:"POST",headers:Xi({Accept:"text/event-stream","Content-Type":"application/json"}),body:JSON.stringify({message:n.text,...!t.textOnly&&((s=n.skillIds)!=null&&s.length)?{skillIds:n.skillIds}:{}}),signal:r.signal},t.messageTimeoutMs??Jkt);if(!i.ok)throw await Gi(i,"沙箱对话失败,请稍后重试。");return a2t(i,r)},async interruptSession(n,r={}){if(!n)return;const i=await Dn(`${e}/${encodeURIComponent(n)}/interrupt`,{method:"POST",headers:Xi(),signal:r.signal},t.interruptTimeoutMs??wx);if(!i.ok&&![404,409].includes(i.status))throw await Gi(i,"无法停止当前任务。")},async getStatus(n,r={}){const i=await ml(e,n,"status",{options:r,fallback:"无法读取 Codex 状态。"}),s=AJ(i),a=aa(i),l=U6(a==null?void 0:a.threadTotal),c=a==null?void 0:a.modelContextWindow;return{...s,...l?{threadTotal:l}:{},...typeof c=="number"&&Number.isFinite(c)&&c>=0?{modelContextWindow:Math.trunc(c)}:{}}},async getEndpoint(n,r={}){const i=aa(await ml(e,n,"endpoint",{options:r,fallback:"无法读取 Sandbox Endpoint。"}));if(typeof(i==null?void 0:i.endpoint)!="string"||!i.endpoint.trim())throw new Error("Sandbox 返回了无效 Endpoint。");return{endpoint:i.endpoint,sessionId:typeof i.sessionId=="string"?i.sessionId:n,...typeof i.expireAt=="string"?{expireAt:i.expireAt}:{}}},async createCodexProjectHandoffPairing(n={}){const r=await Dn(`${vJ}/pairings`,{method:"POST",headers:Xi({Accept:"application/json","Content-Type":"application/json"}),body:JSON.stringify({ttlSeconds:t2t}),signal:n.signal},SJ);if(!r.ok)throw await Gi(r,"无法生成 Codex 云端接力配对码。");const i=aa(await _J(r,"无法生成 Codex 云端接力配对码。"));if(typeof(i==null?void 0:i.pairingCode)!="string"||!i.pairingCode.trim()||typeof i.expireAt!="string"||!i.expireAt.trim())throw new Error("Studio 返回了无效的 Codex 云端接力配对码。");const s=typeof i.studioUrl=="string"&&i.studioUrl.trim()?i.studioUrl.trim():window.location.origin;return{pairingCode:i.pairingCode,expireAt:i.expireAt,studioUrl:s}},async getCodexProjectHandoffStatus(n,r={}){const i=await Dn(`${vJ}/pairings/${encodeURIComponent(n)}`,{headers:Xi({Accept:"application/json"}),signal:r.signal},SJ);if(!i.ok)throw await Gi(i,"无法读取端云接力状态。");const s=aa(await _J(i,"无法读取端云接力状态。")),a=new Set(["issued","creating","session-created","continuing","running","completed","failed"]);if(typeof(s==null?void 0:s.state)!="string"||!a.has(s.state)||typeof s.expireAt!="string"||!s.expireAt.trim())throw new Error("Studio 返回了无效的端云接力状态。");return{state:s.state,expireAt:s.expireAt,...typeof s.projectName=="string"?{projectName:s.projectName}:{},...typeof s.agentName=="string"?{agentName:s.agentName}:{},...typeof s.sessionId=="string"?{sessionId:s.sessionId}:{},...typeof s.error=="string"?{error:s.error}:{},...s.failedStage==="creating-session"||s.failedStage==="uploading-project"||s.failedStage==="restoring-project"||s.failedStage==="continuing-task"?{failedStage:s.failedStage}:{}}},async listModels(n,r={}){const i=aa(await ml(e,n,"models",{options:r,fallback:"无法读取 Codex 模型列表。"}));if(!Array.isArray(i==null?void 0:i.models))throw new Error("Sandbox 返回了无效模型列表。");return i.models.flatMap(s=>{const a=n2t(s);return a?[a]:[]})},async setModel(n,r,i={}){const s=aa(await ml(e,n,"model",{method:"PUT",body:{model:r},options:i,fallback:"无法切换 Codex 模型。"}));if(typeof(s==null?void 0:s.model)!="string"||!s.model)throw new Error("Sandbox 返回了无效模型。");return s.model},async listSkills(n,r=!1,i={}){const a=aa(await ml(e,n,`skills${r?"?force_reload=true":""}`,{options:i,fallback:"无法读取 Codex Skills。"}));if(!Array.isArray(a==null?void 0:a.skills))throw new Error("Sandbox 返回了无效 Skill 列表。");return a.skills.flatMap(l=>{const c=r2t(l);return c?[c]:[]})},async listThreads(n,r={},i={}){const s=new URLSearchParams;r.cursor&&s.set("cursor",r.cursor),r.search&&s.set("search",r.search),r.archived&&s.set("archived","true");const a=s.size?`?${s}`:"",l=aa(await ml(e,n,`threads${a}`,{options:i,fallback:"无法读取 Codex Thread 列表。"}));if(!Array.isArray(l==null?void 0:l.threads))throw new Error("Sandbox 返回了无效 Thread 列表。");return{threads:l.threads.flatMap(c=>{const u=Sve(c);return u?[u]:[]}),...typeof l.nextCursor=="string"?{nextCursor:l.nextCursor}:{}}},async newThread(n,r={}){return Xm(await ml(e,n,"threads/new",{method:"POST",options:r,fallback:"无法创建新的 Codex Thread。"}))},async readThread(n,r,i={}){if(!r)throw new Error("缺少要读取的 Codex Thread。");return Xm(await ml(e,n,`threads/${encodeURIComponent(r)}`,{options:i,fallback:"无法读取 Codex 历史消息。"}))},async resumeThread(n,r,i={}){return Xm(await ml(e,n,"threads/resume",{method:"POST",body:{threadId:r},options:i,fallback:"无法恢复 Codex Thread。"}))},async forkThread(n,r={}){return Xm(await ml(e,n,"threads/fork",{method:"POST",options:r,fallback:"无法分叉 Codex Thread。"}))},async archiveThread(n,r,i={}){const s=aa(await ml(e,n,"threads/archive",{method:"POST",body:{threadId:r},options:i,fallback:"无法归档 Codex Thread。"}));if((s==null?void 0:s.archived)!==!0)throw new Error("Sandbox 返回了无效归档结果。");return{archived:!0,...s.thread?{snapshot:Xm(s)}:{}}},async deleteThread(n,r,i={}){const s=aa(await ml(e,n,"threads/delete",{method:"POST",body:{threadId:r},options:i,fallback:"无法删除 Codex Thread。"}));if((s==null?void 0:s.deleted)!==!0)throw new Error("Sandbox 返回了无效删除结果。");return{deleted:!0,...s.thread?{snapshot:Xm(s)}:{}}},async compactThread(n,r={}){await ml(e,n,"threads/compact",{method:"POST",options:r,fallback:"无法压缩 Codex Thread。"})},async getSettings(n,r={}){const i=await Dn(`${e}/${encodeURIComponent(n)}/settings`,{method:"GET",headers:Xi(),signal:r.signal},uf);if(!i.ok)throw await Gi(i,"无法读取 Codex 权限与工作空间。");return AJ(await i.json())},async updatePermissions(n,r,i={}){const s=await Dn(`${e}/${encodeURIComponent(n)}/permissions`,{method:"PUT",headers:Xi({"Content-Type":"application/json"}),body:JSON.stringify(r),signal:i.signal},uf);if(!s.ok)throw await Gi(s,"无法更新 Codex 权限。");const a=await s.json();return OR(a.permissions)},async updateWorkspace(n,r,i={}){const s=await Dn(`${e}/${encodeURIComponent(n)}/workspace`,{method:"PUT",headers:Xi({"Content-Type":"application/json"}),body:JSON.stringify({cwd:r}),signal:i.signal},uf);if(!s.ok)throw await Gi(s,"无法更新 Codex 工作空间。");const a=await s.json();if(typeof a.cwd!="string"||!a.cwd)throw new Error("Sandbox 返回了无效工作目录。");return a.cwd},async listDirectories(n,r,i={}){const s=new URLSearchParams({path:r}),a=await Dn(`${e}/${encodeURIComponent(n)}/directories?${s}`,{method:"GET",headers:Xi(),signal:i.signal},uf);if(!a.ok)throw await Gi(a,"无法读取 Sandbox 目录。");const l=await a.json();if(typeof l.path!="string"||!Array.isArray(l.directories)||l.directories.some(c=>!c||typeof c.name!="string"||typeof c.path!="string"))throw new Error("Sandbox 返回了无效目录列表。");return{path:l.path,...typeof l.parent=="string"?{parent:l.parent}:{},directories:l.directories}},async resolveApproval(n,r,i,s={}){const a=await Dn(`${e}/${encodeURIComponent(n)}/approvals/${encodeURIComponent(r)}`,{method:"POST",headers:Xi({"Content-Type":"application/json"}),body:JSON.stringify({decision:i}),signal:s.signal},uf);if(!a.ok)throw await Gi(a,"无法提交 Codex 审批决定。")},async launchTerminal(n,r={}){return NJ(e,n,"terminal",r)},async launchBrowser(n,r={}){return NJ(e,n,"browser",r)},async uploadFile(n,r,i={}){const s=new FormData;s.set("file",r,r.name);const a=await Dn(`${e}/${encodeURIComponent(n)}/files`,{method:"POST",headers:Xi(),body:s,signal:i.signal},e2t);if(!a.ok)throw await Gi(a,"无法上传文件到 Sandbox。");const l=await a.json();if(typeof l.id!="string"||typeof l.path!="string"||typeof l.name!="string"||typeof l.mimeType!="string"||typeof l.sizeBytes!="number")throw new Error("Sandbox 返回了无效上传结果。");return l},async closeSession(n,r={}){if(!n)return;const i=await Dn(`${e}/${encodeURIComponent(n)}/disconnect`,{method:"POST",headers:Xi(),signal:r.signal},wx);if(!i.ok&&i.status!==404)throw await Gi(i,"无法断开 Codex 智能体连接。")},async deleteSession(n,r={}){if(!n)return;const i=await Dn(`${e}/${encodeURIComponent(n)}`,{method:"DELETE",headers:Xi(),signal:r.signal},wx);if(!i.ok&&i.status!==404)throw await Gi(i,"无法删除 Codex 智能体。")}}}const hi=Eve(Zkt),Uh=Eve("/web/intelligent-development/sessions",{textOnly:!0,messageTimeoutMs:36e5,interruptTimeoutMs:45e3});async function NJ(e,t,n,r){const i=await Dn(`${e}/${encodeURIComponent(t)}/${n}`,{method:"POST",headers:Xi(),signal:r.signal},uf);if(!i.ok)throw await Gi(i,n==="terminal"?"无法打开 Sandbox Terminal。":"无法打开 Sandbox Browser。");const s=await i.json();return{url:kve(s.url,"Sandbox 工具"),...typeof s.shellSessionId=="string"?{shellSessionId:s.shellSessionId}:{}}}function kve(e,t){if(typeof e!="string")throw new Error(`${t} 返回了无效地址。`);if(e.startsWith("/"))return So(e);let n;try{n=new URL(e)}catch{throw new Error(`${t} 返回了无效地址。`)}const r=n.protocol==="http:"&&window.location.protocol==="http:";if(n.protocol!=="https:"&&!r)throw new Error(`${t} 返回了不安全的地址。`);return n.toString()}function eg(e,t,n){const r=e instanceof Error?`${e.name}: ${e.message}`:String(e||"未知错误");return[`${t}失败`,`详细信息:${r}`,n?`请求:${n}`:""].filter(Boolean).join(` +`)}function Cf({className:e="icon"}){return o.jsxs("svg",{className:`${e} sidebar-agent-face`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.jsx("rect",{x:"4.25",y:"5.25",width:"15.5",height:"13.5",rx:"4.75"}),o.jsx("path",{className:"sidebar-agent-face__eye",d:"M8.5 10.7v2"}),o.jsx("path",{className:"sidebar-agent-face__eye",d:"M15.5 10.7v2"})]})}function o2t(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M8.4 18.4H7.2a4.2 4.2 0 0 1-.65-8.35A5.7 5.7 0 0 1 17.3 8.2a4.6 4.6 0 0 1-.4 9.2h-3.2"}),o.jsx("path",{d:"m7.8 12.3 2 2-2 2M12.2 16.3h3.2"})]})}function l2t(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M18.9 6.25A8.4 8.4 0 1 0 19.6 16"}),o.jsx("path",{d:"M19 6.2c.1 2.1-.65 3.75-2.25 4.95-1.2.9-2.75 1.25-4.2.9"}),o.jsx("circle",{cx:"10.6",cy:"12.8",r:"2.45"}),o.jsx("path",{d:"m5.25 18.6 3.65-3.9M14.8 17.9c1.9-.45 3.55-1.65 4.65-3.35"})]})}function c2t(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M6.2 20c.55-2.15.75-4.1.75-6.7V9.8A5.35 5.35 0 0 1 12.35 4c3.35 0 5.65 2.35 5.65 5.65v4.6c0 2.35.35 4.25 1.15 5.75"}),o.jsx("path",{d:"M8.05 10.2c1.35-.6 2.2-1.65 2.55-3.15.45 1.55 1.35 2.55 2.7 3.05.1-1 .4-1.95.85-2.75.45 1.25 1.2 2.2 2.15 2.75"}),o.jsx("path",{d:"M9.3 12.65h.01M14.9 12.65h.01M10.8 15.55c.8.5 1.65.5 2.45 0"}),o.jsx("path",{d:"M8.45 19.85c.95-.85 1.45-1.95 1.5-3.25M15.1 16.65c.05 1.2.55 2.3 1.55 3.2"})]})}function u2t(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M5.2 17.2V8.1a3 3 0 0 1 3-3h7.6a3 3 0 0 1 3 3v9.1"}),o.jsx("path",{d:"M7.4 17.2h9.2M9 19.9h6"}),o.jsx("path",{d:"M9.1 9.25h5.8M9.1 12h3.1"}),o.jsx("path",{d:"m14.1 12.4 2 2.1M16.2 12.4l-2.1 2.1"})]})}function _S({kind:e,...t}){return e==="codex"?o.jsx(o2t,{...t}):e==="deepseek-harness"?o.jsx(u2t,{...t}):e==="openclaw"?o.jsx(l2t,{...t}):o.jsx(c2t,{...t})}const F6=[{id:"general",label:"通用智能体"},{id:"codex",label:"Codex"},{id:"deepseek-harness",label:"DeepSeek"},{id:"openclaw",label:"OpenClaw"},{id:"hermes",label:"Hermes"}],d2t=F6.map(({id:e,label:t})=>({value:e,label:t})),f2t=24,h2t=3e4,p2t=7e3,m2t=2e4,g2t=6,b2t=2,y2t=250,MP="正在请求 Runtime /list-apps,以确认该智能体是否支持 Studio 对话。",jJ="Runtime /list-apps 未返回可用的 Agent,暂时无法连接对话。",yp=new Map,Iy=new Map,O2t=new Set;function Rm(e){const t=e.runtime;return t?`${t.region}:${t.runtimeId}:${t.currentVersion??""}`:""}function RJ(e){const t=e instanceof Error&&e.message.trim()?e.message.trim():"Runtime /list-apps 请求失败,未返回可识别的错误信息。";return{status:e instanceof Es&&e.unsupported?"unsupported":"error",message:t}}function u_(e){if(!e){yp.clear(),Iy.clear(),KM();return}const t=new Set(e);if(t.size!==0){for(const[n,r]of Iy)r.page.runtimes.some(i=>t.has(i.runtimeId))&&Iy.delete(n);for(const n of t)KM(n);yp.clear()}}function x2t(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M8 3.25v9.5M3.25 8h9.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function v2t(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M8.313 3.646a.5.5 0 0 1 .707 0l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 1 1-.707-.708L11.46 8.5H3.333a.5.5 0 0 1 0-1h8.127L8.313 4.354a.5.5 0 0 1 0-.708Z",fill:"currentColor"})})}function w2t(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M2.75 5.25h8.75m0 0-2-2m2 2-2 2M13.25 10.75H4.5m0 0 2 2m-2-2 2-2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function S2t({type:e}){return e==="general"?o.jsx(Cf,{}):o.jsx(_S,{kind:e})}function E2t(e,t=Date.now()){return lve(e,t)}function k2t(e,t=Date.now()){const n=Date.parse(e);if(!Number.isFinite(n)||n-t<6e4)return"即将清空";const r=Math.ceil((n-t)/6e4),i=Math.floor(r/60),s=r%60;return`${i} 小时 ${s} 分钟`}function IJ(e){var t;return{id:e.runtimeId,name:e.name,description:((t=e.description)==null?void 0:t.trim())||"暂无描述",createdAt:e.createdAt??"",specificationLabel:"创建人",specification:Ige(e.author),isMine:e.isMine,runtime:{runtimeId:e.runtimeId,region:e.region,currentVersion:e.currentVersion,canDelete:e.canDelete}}}function _2t(e){return{id:e.id,name:e.displayName||`${e.toolName} 智能体`,description:bR(e.status),createdAt:e.createdAt,specificationLabel:"创建人",specification:Ige(e.createdBy),isMine:e.isMine,region:e.region,sandbox:e}}function T2t(e){var t,n;return{id:e.id,name:e.draft.name||"未命名 Agent",description:((t=e.draft.description)==null?void 0:t.trim())||"暂无描述",createdAt:new Date(e.updatedAt).toISOString(),specificationLabel:"存储位置",specification:"当前浏览器",isMine:!0,region:(n=e.deploymentTarget)==null?void 0:n.region,draft:e}}function C2t(e,t){if(!e.draft)return e;const n=e.draft.deploymentTarget;return n?t.find(r=>{var i;return((i=r.runtime)==null?void 0:i.runtimeId)===n.runtimeId&&r.runtime.region===n.region})??{id:n.runtimeId,appName:n.appName,name:n.name||e.name,description:e.description,createdAt:e.createdAt,specificationLabel:"地域",specification:n.region,isMine:!0,runtime:{runtimeId:n.runtimeId,region:n.region,currentVersion:n.currentVersion,canDelete:!1}}:null}function A2t(e,t){const n=kd(t);return XS(e)&&n.some(r=>r.value===e)?e:Yr(t)}async function N2t(e,t,n,r,i){const s=`${e}:${t}:${n}`,a=Iy.get(s);if(a&&a.expiresAt>Date.now())return r(a.page.runtimes.map(IJ)),a.page.nextToken;a&&Iy.delete(s);let l=yp.get(s);l||(l=Wkt({scope:e,region:t,pageSize:f2t,nextToken:n,signal:i}),yp.set(s,l),l.then(()=>yp.delete(s),()=>yp.delete(s)));const c=await l;return Iy.set(s,{page:c,expiresAt:Date.now()+h2t}),r(c.runtimes.map(IJ)),c.nextToken}function j2t({agent:e,onUse:t,onViewDetails:n,onPrepareUpdate:r,compatibility:i,onRetryCompatibility:s,connecting:a,connected:l,deploymentTask:c,nowMs:u,onViewDeploymentTask:d,onEditDraft:f,onDeleteDraft:h}){var k,_,T,C;const m=(k=e.sandbox)==null?void 0:k.status.toLowerCase(),g=((_=e.sandbox)==null?void 0:_.resourceType)==="snapshot",b=!!(e.runtime||m==="ready"||m==="wakeable"),y=(i==null?void 0:i.status)==="checking",O=(i==null?void 0:i.status)==="unsupported",v=(i==null?void 0:i.status)==="error",x=((T=e.sandbox)==null?void 0:T.resourceType)==="snapshot"?e.sandbox.sourceSessionId||e.sandbox.snapshotId:(C=e.sandbox)==null?void 0:C.id,w=()=>{if(e.draft){c?d==null||d(c):n==null||n(e);return}b&&(c?d==null||d(c):n==null||n(e))},S=(e.draft||b)&&!!(c?d:n),E=e.draft?c?`查看 ${e.name} 部署进度`:`查看 ${e.name} Runtime 详情`:c?`查看 ${e.name} 部署进度`:`查看 ${e.name} 详情`;return o.jsxs(W7,{className:a?"my-agent-card is-connecting":"my-agent-card",activateLabel:S?E:void 0,onActivate:S?w:void 0,onPointerEnter:()=>r==null?void 0:r(e),onFocusCapture:()=>r==null?void 0:r(e),footer:o.jsx(Uhe,{className:"my-agent-meta",items:[{label:e.specificationLabel,value:e.specification,hideLabel:!0,className:"my-agent-region"},{label:"时间",value:E2t(e.createdAt,u),hideLabel:!0,className:"my-agent-created-at"},...e.sandbox?[{label:"剩余时间",value:e.sandbox.resourceType==="snapshot"?"可唤醒":e.sandbox.persistent?"永不过期":k2t(e.sandbox.expireAt,u),className:`my-agent-expiry${e.sandbox.resourceType==="session"&&e.sandbox.persistent?"":" is-expiring"}`}]:[]]}),actions:e.draft?o.jsxs(o.Fragment,{children:[o.jsx(q4,{"aria-label":c?`查看 ${e.name} 部署进度`:`编辑草稿 ${e.name}`,onClick:()=>c?d==null?void 0:d(c):f==null?void 0:f(e.draft),children:c?"查看进度":"编辑"}),o.jsx(q4,{tone:"danger","aria-label":`删除草稿 ${e.name}`,onClick:()=>h==null?void 0:h(e.draft),children:"删除"})]}):v||O?o.jsxs(It,{type:"button",color:"primary",size:"sm",pill:!1,"aria-label":`重新检测 ${e.name} 的对话兼容性`,onClick:()=>s==null?void 0:s(e),children:[o.jsx(CN,{}),"重试"]}):o.jsx(X4,{className:l?"my-agent-use is-connected":"my-agent-use",disabled:!b||y||O||a||l,"aria-busy":a||void 0,label:l?`${e.name} 已连接`:g?`唤醒 ${e.name} 并开始对话`:`与 ${e.name} 对话`,onClick:()=>void(t==null?void 0:t(e)),children:a?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-use-spinner","aria-hidden":"true"}),o.jsx("span",{className:"sr-only",children:g?"唤醒中":"连接中"})]}):o.jsx(v2t,{})}),children:[o.jsx(Y7,{leading:o.jsx(d1,{seed:e.name}),title:e.name,subtitle:e.sandbox?o.jsx("span",{className:"my-agent-session-id",title:x,children:x}):void 0,status:e.draft?c?o.jsx("span",{className:"my-agent-deploying-badge",children:"部署中"}):o.jsx("span",{className:"my-agent-draft-badge",children:"草稿"}):e.sandbox?o.jsx("span",{className:"my-agent-status-label","data-ready":e.sandbox.status.toLowerCase()==="ready"||void 0,"data-wakeable":g||void 0,children:e.description}):e.runtime&&c?o.jsx("span",{className:"my-agent-deploying-badge",children:"部署中"}):y?o.jsx(Eo,{content:i==null?void 0:i.message,contentClassName:"my-agent-compatibility-tooltip",maxWidth:360,align:"end",interactive:!0,preventUnintentionalClickToClose:!0,children:o.jsx("span",{className:"my-agent-compatibility-trigger",tabIndex:0,children:o.jsxs(Js,{className:"my-agent-compatibility-status",color:"secondary",variant:"soft",size:"sm",pill:!0,children:[o.jsx("span",{className:"my-agent-compatibility-spinner","aria-hidden":"true"}),o.jsx("span",{children:"检测中"})]})})}):O?o.jsx(Eo,{content:i==null?void 0:i.message,contentClassName:"my-agent-compatibility-tooltip",maxWidth:360,align:"end",interactive:!0,preventUnintentionalClickToClose:!0,children:o.jsx("span",{className:"my-agent-compatibility-trigger",tabIndex:0,children:o.jsx(Js,{className:"my-agent-compatibility-status",color:"warning",variant:"soft",size:"sm",pill:!0,children:"不支持对话"})})}):v?o.jsx(Eo,{content:i==null?void 0:i.message,contentClassName:"my-agent-compatibility-tooltip",maxWidth:360,align:"end",interactive:!0,preventUnintentionalClickToClose:!0,children:o.jsx("span",{className:"my-agent-compatibility-trigger",tabIndex:0,children:o.jsx(Js,{className:"my-agent-compatibility-status",color:"danger",variant:"soft",size:"sm",pill:!0,children:"检测失败"})})}):null}),e.sandbox?null:o.jsx(Z7,{children:e.description})]})}function R2t({cloudProvider:e,studioRegion:t,canCreate:n,canUpdate:r,runtimeScope:i,onCreateAgent:s,onOpenCodexProjectUpload:a,onUseAgent:l,onViewAgentDetails:c,onCreateSandboxAgent:u,onUseSandboxAgent:d,onViewSandboxAgentDetails:f,activeType:h,onActiveTypeChange:m,sandboxRefreshKey:g=0,connectedRuntimeId:b="",hiddenRuntimeIds:y=O2t,drafts:O=[],deploymentTasks:v=[],draftDeploymentTaskIds:x={},onViewDeploymentTask:w,onEditDraft:S,onDeleteDraft:E}){const k=p.useRef(null),_=p.useRef(null),T=p.useRef(0),C=p.useRef(null),A=p.useRef(0),j=p.useRef(null),M=p.useRef(new Map),I=A2t(t,e),[$,N]=p.useState(""),[D,Q]=p.useState(i==="mine"?"mine":"all"),[F,L]=p.useState(I),[H,z]=p.useState([]),[B,V]=p.useState(""),[W,le]=p.useState(!0),[be,re]=p.useState(""),[q,G]=p.useState([]),[J,de]=p.useState(!1),[ve,Pe]=p.useState(""),[Ae,Ue]=p.useState(""),[Ke,Ce]=p.useState({}),[Le,pe]=p.useState(null),[me,we]=p.useState(()=>Date.now()),Ee=p.useMemo(()=>kd(e),[e]);p.useEffect(()=>{i==="mine"&&Q("mine")},[i]),p.useEffect(()=>{L(I)},[I]),p.useEffect(()=>{we(Date.now());const Ve=window.setInterval(()=>we(Date.now()),1e3);return()=>window.clearInterval(Ve)},[]);const st=p.useMemo(()=>O.map(T2t),[O]),$e=p.useMemo(()=>{const Ve=new Map,ye=new Map,Qe=new Map;for(const rt of v){if(rt.status!=="running")continue;if(Ve.set(rt.id,rt),rt.draftId){const ze=ye.get(rt.draftId);(!ze||rt.startedAt>ze.startedAt)&&ye.set(rt.draftId,rt)}if(!rt.runtimeId)continue;const Se=Qe.get(rt.runtimeId);(!Se||rt.startedAt>Se.startedAt)&&Qe.set(rt.runtimeId,rt)}return{byId:Ve,byDraftId:ye,byRuntimeId:Qe}},[v]),ie=p.useCallback(Ve=>{var Qe;if(Ve.draft){const rt=x[Ve.draft.id];return $e.byDraftId.get(Ve.draft.id)??(rt?$e.byId.get(rt):void 0)}const ye=(Qe=Ve.runtime)==null?void 0:Qe.runtimeId;return ye?$e.byRuntimeId.get(ye):void 0},[$e,x]),ce=p.useCallback((Ve,ye)=>{var Se;(Se=C.current)==null||Se.abort(),yp.clear();const Qe=new AbortController;C.current=Qe;const rt=++T.current;return le(!0),re(""),N2t(D,F,Ve,ze=>{T.current===rt&&z(ht=>ye?ze:[...ht,...ze])},Qe.signal).then(ze=>{T.current===rt&&V(ze)}).catch(ze=>{T.current===rt&&(xJ(ze)||re(eg(ze,"加载通用智能体","GET /web/runtimes")))}).finally(()=>{T.current===rt&&le(!1),C.current===Qe&&(C.current=null)})},[D,F]);p.useEffect(()=>{if(h==="general")return z([]),V(""),ce("",!0),()=>{var Ve;(Ve=C.current)==null||Ve.abort(),C.current=null,yp.clear(),T.current+=1}},[h,ce]),p.useEffect(()=>{if(h!=="general"){for(const Qe of M.current.values())Qe.abort();M.current.clear();return}const Ve=new Set(H.filter(Qe=>{var rt,Se;return((rt=Qe.runtime)==null?void 0:rt.runtimeId)!==b&&((Se=Qe.runtime)==null?void 0:Se.region)===F}).map(Rm).filter(Boolean));for(const[Qe,rt]of M.current)Ve.has(Qe)||(rt.abort(),M.current.delete(Qe));const ye=H.filter(Qe=>{var ht,_t,Nt;const rt=(ht=Qe.runtime)==null?void 0:ht.runtimeId;if(!rt||rt===b||((_t=Qe.runtime)==null?void 0:_t.region)!==F)return!1;const Se=Rm(Qe),ze=(Nt=Ke[Se])==null?void 0:Nt.status;return!M.current.has(Se)&&(!ze||ze==="checking")});for(const Qe of ye)M.current.set(Rm(Qe),new AbortController);Ce(Qe=>{var ze,ht;let rt=!1;const Se={...Qe};for(const _t of H){const Nt=Rm(_t);if(!Nt)continue;const rn=((ze=_t.runtime)==null?void 0:ze.runtimeId)===b;rn&&((ht=Se[Nt])==null?void 0:ht.status)!=="compatible"?(Se[Nt]={status:"compatible",message:"Runtime 支持 Studio 对话。"},rt=!0):!rn&&!Se[Nt]&&(Se[Nt]={status:"checking",message:MP},rt=!0)}return rt?Se:Qe}),Ykt(ye,async Qe=>{const rt=Qe.runtime;if(!rt)return;const Se=Rm(Qe),ze=M.current.get(Se);if(ze)try{const ht=await Jy(rt.runtimeId,rt.region,{signal:ze.signal,preferCached:!0,timeoutMs:p2t,currentVersion:rt.currentVersion});if(ze.signal.aborted)return;Ce(_t=>({..._t,[Se]:ht&&ht.length>0?{status:"compatible",message:"Runtime 支持 Studio 对话。"}:{status:"unsupported",message:jJ}}))}catch(ht){if(ze.signal.aborted||(ht==null?void 0:ht.name)==="AbortError")return;Ce(_t=>({..._t,[Se]:RJ(ht)}))}finally{M.current.get(Se)===ze&&M.current.delete(Se)}})},[h,b,F,H]),p.useEffect(()=>()=>{var Ve;(Ve=C.current)==null||Ve.abort();for(const ye of M.current.values())ye.abort();M.current.clear()},[]);const Ie=p.useCallback(async Ve=>{var rt,Se;(rt=j.current)==null||rt.abort();const ye=new AbortController;j.current=ye;const Qe=++A.current;de(!0),Pe(""),G([]);try{const ze=Ve==="codex"?await hi.listSessions({signal:ye.signal,autoResumeSnapshots:!0}):await hi.listAgentSessions(Ve,{signal:ye.signal,autoResumeSnapshots:!0});if(A.current!==Qe)return;G(ze.map(_2t))}catch(ze){if((ze==null?void 0:ze.name)==="AbortError"||A.current!==Qe)return;Pe(eg(ze,`加载 ${((Se=F6.find(ht=>ht.id===Ve))==null?void 0:Se.label)??Ve}`,`GET /web/${Ve==="codex"?"sandbox":Ve}/sessions`))}finally{j.current===ye&&(j.current=null),A.current===Qe&&de(!1)}},[]);function We(Ve){var ye;Ve!==h&&(Ve==="general"?(T.current+=1,z([]),V(""),re(""),le(!0)):((ye=j.current)==null||ye.abort(),j.current=null,A.current+=1,G([]),Pe(""),de(!0)),m(Ve))}function K(){h==="general"&&(T.current+=1,z([]),V(""),re(""),le(!0))}function _e(Ve){Ve!==D&&(K(),Q(Ve))}function Be(Ve){Ve!==F&&(K(),L(Ve))}p.useEffect(()=>{var Ve;if(h==="general"){(Ve=j.current)==null||Ve.abort(),j.current=null,A.current+=1;return}return Ie(h),()=>{var ye;(ye=j.current)==null||ye.abort(),j.current=null,A.current+=1}},[h,Ie,g]),p.useEffect(()=>{const Ve=_.current,ye=k.current;if(!Ve||!ye||h!=="general"||!B||W)return;const Qe=new IntersectionObserver(([rt])=>{rt.isIntersecting&&ce(B,!1)},{root:ye,rootMargin:"240px 0px",threshold:.01});return Qe.observe(Ve),()=>Qe.disconnect()},[h,ce,W,B]);const He=p.useCallback(async Ve=>{if(!Ae){Ue(Ve.id);try{await new Promise(ye=>requestAnimationFrame(()=>ye())),Ve.sandbox?await d(Ve.sandbox):await l(Ve)}finally{Ue("")}}},[Ae,l,d]),Ye=p.useCallback(async Ve=>{var Se;const ye=Ve.runtime;if(!ye)return;const Qe=Rm(Ve);Ce(ze=>({...ze,[Qe]:{status:"checking",message:MP}})),(Se=M.current.get(Qe))==null||Se.abort();const rt=new AbortController;M.current.set(Qe,rt);try{const ze=await wve(()=>Jy(ye.runtimeId,ye.region,{retryProbe:!0,signal:rt.signal,timeoutMs:m2t,currentVersion:ye.currentVersion}));if(rt.signal.aborted)return;Ce(ht=>({...ht,[Qe]:ze&&ze.length>0?{status:"compatible",message:"Runtime 支持 Studio 对话。"}:{status:"unsupported",message:jJ}}))}catch(ze){if(rt.signal.aborted||xJ(ze))return;Ce(ht=>({...ht,[Qe]:RJ(ze)}))}finally{M.current.get(Qe)===rt&&M.current.delete(Qe)}},[]),ot=p.useCallback(Ve=>{const ye=Ve.runtime;!r||!ye||ie(Ve)||ZM({runtimeId:ye.runtimeId,region:ye.region,appName:Ve.appName,currentVersion:ye.currentVersion})},[r,ie]),Tt=p.useMemo(()=>{const Ve=$.trim().toLocaleLowerCase(),ye=h==="general"?[...st,...H]:q,rt=(D==="mine"?ye.filter(_t=>_t.isMine):ye).filter(_t=>{var rn;const Nt=((rn=_t.runtime)==null?void 0:rn.region)??_t.region;return!Nt||Nt===F}),Se=Ve?rt.filter(_t=>_t.name.toLocaleLowerCase().includes(Ve)):rt;if(h!=="general")return Se;const ze=y.size>0?Se.filter(_t=>!_t.runtime||!y.has(_t.runtime.runtimeId)):Se,ht=ze.findIndex(_t=>{var Nt;return((Nt=_t.runtime)==null?void 0:Nt.runtimeId)===b});return ht<=0?ze:[ze[ht],...ze.slice(0,ht),...ze.slice(ht+1)]},[h,b,st,y,$,D,F,H,q]);p.useEffect(()=>{if(!r||h!=="general")return;const Ve=Tt.filter(ze=>!!ze.runtime).filter(ze=>!ie(ze)).slice(0,g2t);if(Ve.length===0)return;let ye=!1,Qe=0;const rt=async()=>{for(;!ye;){const ze=Ve[Qe];if(Qe+=1,!(ze!=null&&ze.runtime)||(await ZM({runtimeId:ze.runtime.runtimeId,region:ze.runtime.region,appName:ze.appName,currentVersion:ze.runtime.currentVersion}),ye))return}},Se=window.setTimeout(()=>{for(let ze=0;ze{ye=!0,window.clearTimeout(Se)}},[h,r,ie,Tt]);const Ft=F6.find(Ve=>Ve.id===h),At=(Ft==null?void 0:Ft.label)??"智能体",Ge=h==="general"?W&&H.length===0&&st.length===0:J&&q.length===0,Je=!Ge&&Tt.length===0,it=n?h==="general"?()=>s(F):()=>u(h):void 0,Et=h==="codex"&&n&&!!a;return o.jsxs(ih,{className:"my-agents-page","aria-label":"智能体",children:[o.jsx(sO,{title:"智能体",className:"my-agents-header"}),o.jsxs(g0,{className:"my-agent-toolbar",children:[o.jsx(gE,{idPrefix:"my-agent-ownership",ariaLabel:"创建人筛选",value:D,items:[{id:"all",label:"全部",disabled:i==="mine"},{id:"mine",label:"我创建的"}],onChange:_e}),o.jsxs("div",{className:"resource-toolbar__actions",children:[o.jsx(HC,{id:"my-agent-type-filter",ariaLabel:"智能体类型",value:h,options:d2t,onChange:We}),o.jsx(HC,{id:"my-agent-region-filter",ariaLabel:"区域",value:F,options:Ee,onChange:Be}),o.jsx(Gp,{className:"my-agent-search","aria-label":"搜索智能体",value:$,onChange:Ve=>N(Ve.target.value),placeholder:"搜索"}),Et?o.jsxs("button",{type:"button",className:"my-agent-create-secondary",onClick:a,children:[o.jsx(w2t,{}),o.jsx("span",{children:"接力"})]}):null]})]}),o.jsxs(b0,{className:"my-agent-results",ref:k,"aria-label":`${At}列表`,children:[Ge?o.jsx(Od,{}):(h==="general"?be:ve)&&Tt.length===0?o.jsxs("div",{className:"my-agent-empty",role:"alert",children:[o.jsx("p",{children:h==="general"?be:ve}),o.jsx("button",{type:"button",onClick:()=>{h==="general"?ce("",!0):Ie(h)},children:"重新加载"})]}):Je&&!it?$.trim()||D==="mine"||F!==I?o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(yn,{fill:"none",children:[o.jsx(yn.Icon,{children:o.jsx(pRe,{})}),o.jsx(yn.Title,{children:"没有匹配的智能体"}),o.jsx(yn.Description,{children:"请尝试调整搜索或筛选条件"})]})}):h!=="general"?o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(yn,{fill:"none",children:[o.jsx(yn.Icon,{children:o.jsx(S2t,{type:h})}),o.jsxs(yn.Title,{className:"my-agent-sandbox-empty-title",children:["暂无 ",At]})]})}):o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(yn,{fill:"none",children:[o.jsx(yn.Icon,{children:o.jsx(Cf,{})}),o.jsx(yn.Title,{children:"暂无通用智能体"}),o.jsx(yn.Description,{children:"创建一个通用智能体,开始构建和对话"})]})}):o.jsxs(o.Fragment,{children:[h==="general"&&be?o.jsxs("div",{className:"my-agent-inline-error",role:"alert",children:[o.jsx("span",{children:be}),o.jsx("button",{type:"button",onClick:()=>void ce("",!0),children:"重新加载"})]}):null,o.jsxs(aO,{className:"my-agent-grid",children:[it?o.jsx(Vg,{className:"my-agent-create-card","aria-label":`创建${At}`,onClick:it,icon:o.jsx(x2t,{}),children:"创建智能体"}):null,Tt.map(Ve=>{var Qe;const ye=C2t(Ve,H);return o.jsx(j2t,{agent:Ve,deploymentTask:ie(Ve),nowMs:me,onViewDeploymentTask:w,onUse:He,compatibility:Ve.runtime?Ke[Rm(Ve)]??{status:"checking",message:MP}:void 0,onRetryCompatibility:Ye,onPrepareUpdate:ot,onViewDetails:ye?()=>{ye.sandbox?f(ye.sandbox):c(ye)}:void 0,connecting:Ve.id===Ae,connected:((Qe=Ve.runtime)==null?void 0:Qe.runtimeId)===b,onEditDraft:S,onDeleteDraft:pe},Ve.id)})]})]}),h==="general"&&!be&&!Ge&&(Tt.length>0||!!B)&&o.jsx("div",{className:"my-agent-load-more",ref:_,"aria-live":"polite",children:W?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载更多智能体"})]}):B?o.jsx("span",{children:"继续下滑加载更多"}):o.jsx("span",{children:"已加载全部智能体"})})]}),Le?o.jsx(zl,{title:"删除草稿?",description:`删除后将无法恢复“${Le.draft.name||"未命名 Agent"}”。`,confirmLabel:"删除草稿",variant:"danger",onCancel:()=>pe(null),onConfirm:()=>{E==null||E(Le),pe(null)}}):null]})}const I2t="_RadioGroup_onrfm_1",D2t="_RadioLabel_onrfm_9",P2t="_RadioIndicatorWrapper_onrfm_26",M2t="_RadioItem_onrfm_43",L2t="_RadioIndicator_onrfm_26",nv={RadioGroup:I2t,RadioLabel:D2t,RadioIndicatorWrapper:P2t,RadioItem:M2t,RadioIndicator:L2t},_ve=p.createContext(null),$2t=()=>{const e=p.use(_ve);if(!e)throw new Error("RadioGroup components must be wrapped in ");return e},sa=({onChange:e,children:t,className:n,direction:r="row",disabled:i=!1,...s})=>{const a=p.useMemo(()=>({disabled:i,direction:r}),[i,r]);return o.jsx(_ve,{value:a,children:o.jsx(kLe,{className:cr(nv.RadioGroup,n),"data-direction":r,onValueChange:e,disabled:i,...s,children:t})})},B2t=({value:e,disabled:t=!1,required:n,children:r,className:i,block:s=!1,...a})=>{const{disabled:l}=$2t(),c=l||t,u=p.useId(),d=`${e}-${u}`;return o.jsx("div",{className:"flex",...a,children:o.jsxs("label",{htmlFor:d,className:cr(nv.RadioLabel,i),"data-disabled":c?"":void 0,"data-block":s?"":void 0,onMouseDown:f=>{!f.defaultPrevented&&f.detail>1&&f.preventDefault()},children:[o.jsx("div",{className:nv.RadioIndicatorWrapper,children:o.jsx(ALe,{id:d,value:e,disabled:c,required:n,className:nv.RadioItem,children:o.jsx(jLe,{className:nv.RadioIndicator})})}),r]})})};sa.Item=B2t;const Q2t="_Container_13560_1",U2t="_Textarea_13560_174",DJ={Container:Q2t,Textarea:U2t},gd=e=>{const t=p.useRef(null),r=`search-ui-input-${p.useId()}`,{id:i,name:s,variant:a="outline",size:l="md",gutterSize:c,className:u,autoComplete:d,disabled:f=!1,readOnly:h=!1,invalid:m=!1,allowAutofillExtensions:g=!!s,onFocus:b,onBlur:y,onAnimationStart:O,onAutofill:v,autoSelect:x,rows:w=3,maxRows:S,autoResize:E,ref:k,onChange:_,...T}=e,[C,A]=p.useState(!1),j=E?Math.max(S??10,w):w;p.useEffect(()=>{var $;x&&(($=t.current)==null||$.select())},[x]);const M=$=>{O==null||O($),$.animationName==="native-autofill-in"&&(v==null||v())},I=p.useCallback(()=>{if(!E||!t.current||j===void 0)return;t.current.style.height="0px";const $=t.current.scrollHeight;t.current.style.height=$+"px"},[E,j]);return p.useEffect(()=>{I()},[e.value,w,I]),o.jsx("div",{className:cr(DJ.Container,u),"data-variant":a,"data-size":l,"data-gutter-size":c,"data-focused":C,"data-disabled":f?"":void 0,"data-readonly":h?"":void 0,"data-invalid":m?"":void 0,style:d0({"textarea-min-rows":`${w}`,"textarea-max-rows":`${j}`}),children:o.jsx("textarea",{...T,onChange:$=>{_==null||_($),I()},ref:fE([t,k]),id:i||(g?void 0:r),className:DJ.Textarea,name:s,readOnly:h,disabled:f,rows:w,onFocus:$=>{A(!0),b==null||b($)},onBlur:$=>{A(!1),y==null||y($)},onAnimationStart:M,"data-lpignore":g?void 0:!0,"data-1p-ignore":g?void 0:!0})})},xR="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",F2t="data:image/svg+xml,%3c?xml%20version='1.0'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20viewBox='0%200%20100%20100'%3e%3ctitle%3ePandoc%20Icon%3c/title%3e%3cdesc%20property='dc:creator'%3eAlbert%20Krewinkel%3c/desc%3e%3cmetadata%20id='license'%20xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23'%20xmlns:dc='http://purl.org/dc/elements/1.1/'%20xmlns:cc='http://creativecommons.org/ns%23'%3e%3crdf:RDF%3e%3ccc:Work%20rdf:about=''%3e%3cdc:format%3eimage/svg+xml%3c/dc:format%3e%3cdc:type%20rdf:resource='http://purl.org/dc/dcmitype/StillImage'%20/%3e%3ccc:license%20rdf:resource='http://creativecommons.org/licenses/by-sa/4.0/'%20/%3e%3c/cc:Work%3e%3ccc:License%20rdf:about='http://creativecommons.org/licenses/by-sa/4.0/'%3e%3ccc:permits%20rdf:resource='http://creativecommons.org/ns%23Reproduction'%20/%3e%3ccc:permits%20rdf:resource='http://creativecommons.org/ns%23Distribution'%20/%3e%3ccc:requires%20rdf:resource='http://creativecommons.org/ns%23Notice'%20/%3e%3ccc:requires%20rdf:resource='http://creativecommons.org/ns%23Attribution'%20/%3e%3ccc:permits%20rdf:resource='http://creativecommons.org/ns%23DerivativeWorks'%20/%3e%3ccc:requires%20rdf:resource='http://creativecommons.org/ns%23ShareAlike'%20/%3e%3c/cc:License%3e%3c/rdf:RDF%3e%3c/metadata%3e%3crect%20fill='%23fed'%20stroke='%23fed'%20width='100'%20height='100'/%3e%3cg%20fill='none'%20stroke='%234093da'%20stroke-linecap='round'%20stroke-linejoin='round'%20stroke-width='8'%20transform='skewX(-6)%20translate(8%201)'%3e%3cpath%20d='M%2030,10%20l%200,80%20M%2045,10%20l%200,80%20M%2020,10%20l%2040,0%20l%2018,18%20l%200,25%20l%20-33,0'%20/%3e%3cpath%20fill='%234093da'%20stroke-width='6'%20d='M%2061,10%20l%2017,17%20l%20-17,0%20l%200,-17'%20/%3e%3c/g%3e%3c/svg%3e",z2t="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%20100%20100'%20version='1.1'%20id='svg4'%20sodipodi:docname='favicon.svg'%20inkscape:version='1.4.4%20(dcaf3e7,%202026-05-05)'%20xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape'%20xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:svg='http://www.w3.org/2000/svg'%3e%3csodipodi:namedview%20id='namedview4'%20pagecolor='%23ffffff'%20bordercolor='%23000000'%20borderopacity='0.25'%20inkscape:showpageshadow='2'%20inkscape:pageopacity='0.0'%20inkscape:pagecheckerboard='0'%20inkscape:deskcolor='%23d1d1d1'%20showgrid='true'%20inkscape:zoom='8.2236519'%20inkscape:cx='34.534536'%20inkscape:cy='45.174577'%20inkscape:window-width='1881'%20inkscape:window-height='1382'%20inkscape:window-x='1512'%20inkscape:window-y='30'%20inkscape:window-maximized='0'%20inkscape:current-layer='svg4'%3e%3cinkscape:grid%20type='axonomgrid'%20id='grid4'%20units='px'%20originx='0'%20originy='0'%20spacingx='3.7795276'%20spacingy='3.7795276'%20empcolor='%230099e5'%20empopacity='0.30196078'%20color='%230099e5'%20opacity='0.14901961'%20empspacing='0'%20dotted='false'%20gridanglex='40'%20gridanglez='40'%20enabled='true'%20visible='true'%20/%3e%3c/sodipodi:namedview%3e%3cdefs%20id='defs1'%3e%3cfilter%20id='shadow'%20x='0'%20y='0'%20width='1'%20height='1'%3e%3cfeDropShadow%20dx='0'%20dy='2'%20stdDeviation='3'%20flood-color='rgba(50,%2050,%2093,%200.18)'%20/%3e%3c/filter%3e%3c/defs%3e%3crect%20x='4'%20y='4'%20width='92'%20height='92'%20rx='22.08'%20fill='%23e8efff'%20filter='url(%23shadow)'%20id='rect1'%20transform='matrix(1.0869565,0,0,1.0869565,-4.347826,-4.347826)'%20style='stroke-width:0.92'%20ry='22.08'%20/%3e%3cpath%20style='fill:%230a2540;fill-opacity:1;stroke-width:1.88976'%20d='M%2049.999999,6.535431%204.9573423,44.330708%2049.999999,82.125984%2092.790523,46.220471%2095.042656,44.330708%20Z'%20id='path1'%20/%3e%3cpath%20style='fill:%23425466;fill-opacity:1;stroke-width:1.88976'%20d='M%204.9573423,44.330708%20V%2055.669291%20L%2049.999999,93.464567%20V%2082.125984%20Z'%20id='path2'%20/%3e%3cpath%20style='fill:%231a3550;fill-opacity:1;stroke-width:1.88976'%20d='M%2049.999999,82.125984%2095.042656,44.330708%20V%2055.669291%20L%2049.999999,93.464567%20Z'%20id='path3'%20/%3e%3cpath%20style='fill:%234ade80;stroke:none;stroke-width:5;stroke-linecap:round;stroke-linejoin:round;fill-opacity:1'%20d='m%2045.042657,30.236221%209.008531,-7.559055%2022.521328,18.897638%20-9.008531,7.559056%20z'%20id='path5'%20/%3e%3cpath%20style='fill:none;fill-opacity:1;stroke:%234ade80;stroke-width:5;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1'%20d='M%2027.025594,49.133859%2047.29479,47.244096%2045.042657,64.25197'%20id='path6'%20/%3e%3c/svg%3e",V2t="data:image/svg+xml,%3csvg%20fill='%23261230'%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eAstral%3c/title%3e%3cpath%20d='M1.44%200C.6422%200%200%20.6422%200%201.44v21.12C0%2023.3578.6422%2024%201.44%2024h21.12c.7978%200%201.44-.6422%201.44-1.44V1.44C24%20.6422%2023.3578%200%2022.56%200Zm4.7998%204.8h11.5199c.7953%200%201.44.6447%201.44%201.44V19.2h-6.624v-4.32h-1.152v4.32H4.8V6.24c0-.7953.6446-1.44%201.4398-1.44m4.032%205.472v1.152h3.456v-1.152z'/%3e%3c/svg%3e",H2t="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='1.34em'%20height='1em'%20viewBox='0%200%20256%20192'%3e%3cpath%20fill='%232d4552'%20d='M84.38%20108.352c-9.556%202.712-15.826%207.467-19.956%2012.218c3.956-3.461%209.255-6.639%2016.402-8.665c7.311-2.072%2013.548-2.057%2018.702-1.062v-4.03c-4.397-.402-9.437-.082-15.148%201.539M63.987%2074.475l-35.49%209.35s.646.914%201.844%202.133l30.092-7.93s-.427%205.495-4.13%2010.41c7.005-5.299%207.684-13.963%207.684-13.963m29.709%2083.41c-49.946%2013.452-76.37-44.43-84.37-74.472c-3.696-13.868-5.31-24.37-5.74-31.148a11.5%2011.5%200%200%201%20.025-1.84C1.021%2050.58-.22%2051.927.032%2055.82c.43%206.773%202.044%2017.275%205.74%2031.147c7.997%2030.038%2034.424%2087.92%2084.37%2074.468c10.871-2.929%2019.038-8.263%2025.17-15.073c-5.652%205.104-12.724%209.123-21.616%2011.523M103.08%2039.05v3.555h19.59c-.401-1.259-.806-2.393-1.208-3.555z'/%3e%3cpath%20fill='%232d4552'%20d='M127.05%2068.325c8.81%202.503%2013.47%208.68%2015.933%2014.146l9.824%202.79s-1.34-19.132-18.645-24.047c-16.189-4.6-26.151%208.995-27.363%2010.754c4.71-3.355%2011.586-6.102%2020.251-3.643m78.197%2014.234c-16.204-4.62-26.162%209.003-27.356%2010.737c4.713-3.351%2011.586-6.099%2020.247-3.629c8.797%202.506%2013.452%208.676%2015.923%2014.146l9.837%202.8s-1.361-19.135-18.651-24.054m-9.76%2050.443l-81.718-22.845s.885%204.485%204.279%2010.293l68.803%2019.234c5.664-3.277%208.636-6.682%208.636-6.682m-56.655%2049.174C74.127%20164.828%2081.949%2082.386%2092.419%2043.32c4.311-16.1%208.743-28.066%2012.419-36.088c-2.193-.451-4.01.704-5.804%204.354C95.13%2019.5%2090.14%2032.387%2085.312%2050.427c-10.467%2039.066-18.29%20121.506%2046.412%20138.854c30.497%208.17%2054.256-4.247%2071.966-23.749c-16.81%2015.226-38.274%2023.763-64.858%2016.644'/%3e%3cpath%20fill='%23e2574c'%20d='M103.081%20138.565v-16.637l-46.223%2013.108s3.415-19.846%2027.522-26.684c7.311-2.072%2013.549-2.058%2018.701-1.063V39.05h23.145c-2.52-7.787-4.958-13.782-7.006-17.948c-3.387-6.895-6.859-2.324-14.741%204.269c-5.552%204.638-19.583%2014.533-40.698%2020.222c-21.114%205.694-38.185%204.184-45.307%202.95c-10.097-1.742-15.378-3.96-14.884%203.721c.43%206.774%202.043%2017.277%205.74%2031.148c7.996%2030.039%2034.424%2087.92%2084.37%2074.468c13.046-3.515%2022.254-10.464%2028.637-19.32h-19.256zm-74.588-54.74l35.494-9.35s-1.034%2013.654-14.34%2017.162c-13.31%203.504-21.154-7.812-21.154-7.812'/%3e%3cpath%20fill='%232ead33'%20d='M236.664%2039.84c-9.226%201.617-31.361%203.632-58.716-3.7c-27.363-7.328-45.517-20.144-52.71-26.168c-10.197-8.54-14.682-14.476-19.096-5.498c-3.902%207.918-8.893%2020.805-13.723%2038.846c-10.466%2039.066-18.289%20121.505%2046.413%20138.853c64.687%2017.333%2099.126-57.978%20109.593-97.047c4.83-18.037%206.948-31.695%207.53-40.502c.665-9.976-6.187-7.08-19.29-4.784M106.668%2072.161s10.196-15.859%2027.49-10.943c17.305%204.915%2018.645%2024.046%2018.645%2024.046zm42.215%2071.163c-30.419-8.91-35.11-33.167-35.11-33.167l81.714%2022.846c0-.004-16.494%2019.12-46.604%2010.32m28.89-49.85s10.183-15.847%2027.474-10.918c17.29%204.923%2018.651%2024.054%2018.651%2024.054z'/%3e%3cpath%20fill='%23d65348'%20d='m86.928%20126.51l-30.07%208.522s3.266-18.609%2025.418-25.983L65.25%2045.147l-1.471.447c-21.115%205.694-38.185%204.184-45.307%202.95c-10.097-1.741-15.379-3.96-14.885%203.722c.43%206.774%202.044%2017.276%205.74%2031.147c7.997%2030.039%2034.425%2087.92%2084.37%2074.468l1.471-.462zM28.493%2083.825l35.494-9.351s-1.034%2013.654-14.34%2017.162c-13.31%203.504-21.154-7.811-21.154-7.811'/%3e%3cpath%20fill='%231d8d22'%20d='m150.255%20143.658l-1.376-.335c-30.419-8.91-35.11-33.166-35.11-33.166l42.137%2011.778l22.308-85.724l-.27-.07c-27.362-7.329-45.516-20.145-52.71-26.17c-10.196-8.54-14.682-14.475-19.096-5.497c-3.898%207.918-8.889%2020.805-13.719%2038.846c-10.466%2039.066-18.289%20121.505%2046.413%20138.852l1.326.3zM106.668%2072.16s10.196-15.859%2027.49-10.943c17.305%204.915%2018.645%2024.046%2018.645%2024.046z'/%3e%3cpath%20fill='%23c04b41'%20d='m88.46%20126.072l-8.064%202.289c1.906%2010.74%205.264%2021.047%2010.534%2030.152c.918-.202%201.828-.376%202.762-.632c2.449-.66%204.72-1.479%206.906-2.371c-5.89-8.74-9.785-18.804-12.137-29.438m-3.148-75.644c-4.144%2015.467-7.852%2037.73-6.831%2060.06c1.826-.793%203.756-1.532%205.9-2.14l1.492-.334c-1.82-23.852%202.114-48.157%206.546-64.694a323%20323%200%200%201%203.373-11.704a105%20105%200%200%201-5.974%203.547a307%20307%200%200%200-4.506%2015.265'/%3e%3c/svg%3e",q2t="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='512'%20height='512'%20version='1.1'%20viewBox='0%200%20135.47%20135.47'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='m67.733%2067.733%2029.33%2016.933-29.33%2050.8c37.408%200%2067.733-30.325%2067.733-67.733%200-12.341-3.3168-23.901-9.0837-33.867h-58.65z'%20fill='%23afccf9'/%3e%3cpath%20d='m67.733-1e-6c-25.07%200-46.942%2013.63-58.654%2033.875l29.324%2050.792%2029.33-16.933v-33.867h58.65c-11.714-20.24-33.583-33.867-58.65-33.867z'%20fill='%231767d1'/%3e%3cpath%20d='m0%2067.733c0%2037.408%2030.324%2067.733%2067.733%2067.733l29.33-50.8-29.33-16.933-29.33%2016.933-29.324-50.792c-5.7637%209.9632-9.0794%2021.519-9.0794%2033.858'%20fill='%23679ef5'/%3e%3cpath%20d='m101.6%2067.733c0%2018.704-15.163%2033.867-33.867%2033.867-18.704%200-33.867-15.163-33.867-33.867s15.163-33.867%2033.867-33.867c18.704%200%2033.867%2015.163%2033.867%2033.867'%20fill='%23fff'/%3e%3cpath%20d='m95.25%2067.733c0%2015.197-12.32%2027.517-27.517%2027.517-15.197%200-27.517-12.32-27.517-27.517%200-15.197%2012.32-27.517%2027.517-27.517%2015.197%200%2027.517%2012.32%2027.517%2027.517'%20fill='%231a74e7'/%3e%3c/svg%3e",X2t="data:image/svg+xml,%3csvg%20fill='%23F03C2E'%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eGit%3c/title%3e%3cpath%20d='M13.09%2023.549a1.54%201.54%200%200%201-2.18%200L.451%2013.089a1.54%201.54%200%200%201%200-2.179l7.191-7.19%202.733%202.733a1.85%201.85%200%200%200%20.964%202.326v6.66a1.849%201.849%200%201%200%201.54%200V8.957l2.508%202.508a1.85%201.85%200%201%200%201.09-1.09l-2.634-2.634a1.85%201.85%200%200%200-2.378-2.377L8.73%202.63%2010.91.451a1.54%201.54%200%200%201%202.179%200l10.459%2010.46a1.54%201.54%200%200%201%200%202.179z'/%3e%3c/svg%3e",G2t="data:image/svg+xml,%3csvg%20fill='%23073551'%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3ecurl%3c/title%3e%3cpath%20d='M.803%2014.8169c0-.5342.433-.9665.9665-.9665.5335%200%20.9665.4323.9665.9665%200%20.5335-.433.9657-.9665.9657-.5335%200-.9666-.4322-.9666-.9657m2.736%200c0-.1963-.0532-.376-.1119-.5525-.2344-.7024-.876-1.2169-1.6575-1.2169-.1249%200-.2344.0465-.3524.0708C.6149%2013.2865%200%2013.9646%200%2014.817c0%20.9764.7923%201.7694%201.7695%201.7694.9772%200%201.7694-.793%201.7694-1.7694m-1.7694-7.149c.5335%200%20.9665.433.9665.9665%200%20.5335-.433.9665-.9665.9665-.5343%200-.9666-.433-.9666-.9665%200-.5335.4323-.9665.9666-.9665m0%202.7359c.9772%200%201.7694-.7923%201.7694-1.7694%200-.1956-.0532-.376-.1119-.5525-.2344-.7024-.8767-1.2169-1.6575-1.2169-.1249%200-.2344.0465-.3524.0716C.6149%207.104%200%207.782%200%208.6344c0%20.9771.7923%201.7694%201.7695%201.7694m13.221-5.694c-.5342%200-.9665-.433-.9665-.9664a.966.966%200%2001.9666-.9665c.5335%200%20.9658.4322.9658.9665%200%20.5334-.4323.9664-.9658.9664m-9.6%2016.5133c-.5335%200-.9666-.433-.9666-.9665%200-.5342.433-.9665.9666-.9665a.966.966%200%2001.9665.9665c0%20.5335-.4323.9665-.9665.9665m9.6-19.2491c-.978%200-1.7695.7922-1.7695%201.7694%200%20.2085.0525.4025.1187.5882L5.039%2018.5581c-.803.1681-1.4179.8462-1.4179%201.6985%200%20.9772.7923%201.7694%201.7695%201.7694.9772%200%201.7694-.7922%201.7694-1.7694%200-.1963-.0525-.3759-.111-.5525l8.3427-14.2728c.7778-.1865%201.3683-.8531%201.3683-1.688%200-.977-.793-1.7693-1.7694-1.7693m7.24%202.7359c-.5343%200-.9666-.433-.9666-.9665a.966.966%200%2001.9665-.9665c.5335%200%20.9666.4322.9666.9665%200%20.5334-.433.9665-.9666.9665M12.6313%2021.223c-.5343%200-.9665-.433-.9665-.9665a.966.966%200%2001.9665-.9665c.5335%200%20.9658.4323.9658.9665%200%20.5335-.4323.9665-.9658.9665M22.2305%201.974c-.9772%200-1.7694.7922-1.7694%201.7694%200%20.2085.0525.4025.1187.5882l-8.3009%2014.2265c-.8021.1681-1.417.8462-1.417%201.6985%200%20.9772.7922%201.7694%201.7694%201.7694.9764%200%201.7687-.7922%201.7687-1.7694%200-.1963-.0525-.3759-.1111-.5525l8.3427-14.2728C23.4094%205.2448%2024%204.5782%2024%203.7433c0-.977-.7923-1.7693-1.7695-1.7693'/%3e%3c/svg%3e",W2t="data:image/svg+xml,%3csvg%20fill='%23007808'%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eFFmpeg%3c/title%3e%3cpath%20d='M21.72%2017.91V6.5l-.53-.49L9.05%2018.52l-1.29-.06L24%201.53l-.33-.95-11.93%201-5.75%206.6v-.23l4.7-5.39-1.38-.77-9.11.77v2.85l1.91.46v.01l.19-.01-.56.66v10.6c.609-.126%201.22-.241%201.83-.36L14.12%205.22l.83-.04L0%2021.44l9.67.82%201.35-.77%206.82-6.74v2.15l-5.72%205.57%2011.26.95.35-.94v-3.16l-3.29-.18c.434-.403.858-.816%201.28-1.23z'/%3e%3c/svg%3e",Y2t="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20viewBox='0%200%201080%201080'%3e%3c!--%20Generator:%20Adobe%20Illustrator%2030.3.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%202.1.3%20Build%20182)%20--%3e%3cdefs%3e%3cstyle%3e%20.st0%20{%20fill:%20%23ff0;%20}%20.st1%20{%20fill:%20%23333;%20}%20%3c/style%3e%3c/defs%3e%3cpath%20class='st0'%20d='M660.52,419.49l-195.15-52.98c-15.84-4.3-19.16-25.29-5.43-34.28l169.23-110.7-9.91-201.97c-.8-16.39,18.13-26.04,30.92-15.76l157.57,126.74,189.03-71.84c15.34-5.83,30.37,9.2,24.54,24.54l-71.84,189.03,126.74,157.57c10.29,12.79.64,31.73-15.76,30.92l-201.97-9.91-110.7,169.23c-8.98,13.73-29.98,10.41-34.28-5.43l-52.98-195.15h-.01Z'/%3e%3cpath%20class='st1'%20d='M603.34,476.66l32.94,121.68,4.45,16.23-429.11,429.11c-48.45,48.45-126.85,48.45-175.3,0C12.16,1019.51,0,987.89,0,956.15s12.02-63.48,36.31-87.77l429.11-429.11,16.35,4.33,121.56,33.06h0Z'/%3e%3c/svg%3e";function fU(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...e,children:o.jsx("path",{d:"M12 .5C5.65.5.5 5.65.5 12c0 5.08 3.29 9.39 7.86 10.91 .58 .11 .79-.25.79-.56v-2.02c-3.2.7-3.88-1.36-3.88-1.36-.52-1.33-1.28-1.69-1.28-1.69-1.05-.72.08-.7.08-.7 1.16.08 1.77 1.19 1.77 1.19 1.03 1.77 2.71 1.26 3.37.96.1-.75.4-1.26.73-1.55-2.56-.29-5.25-1.28-5.25-5.7 0-1.26.45-2.29 1.19-3.1-.12-.29-.52-1.47.11-3.06 0 0 .97-.31 3.16 1.18A10.98 10.98 0 0 1 12 6.11c.98 0 1.96.13 2.87.39 2.19-1.49 3.16-1.18 3.16-1.18.63 1.59.23 2.77.11 3.06.74.81 1.19 1.84 1.19 3.1 0 4.43-2.7 5.4-5.27 5.69.42.36.78 1.06.78 2.14v3.04c0 .31.21.67.8.56A11.51 11.51 0 0 0 23.5 12C23.5 5.65 18.35.5 12 .5Z"})})}Za.registerLanguage("bash",gB);const Z2t=48;function K2t(e,t=Z2t){return e.scrollHeight-e.scrollTop-e.clientHeight<=t}function J2t(e){return Za.highlight(e,{language:"bash",ignoreIllegals:!0}).value}function e_t({status:e}){return e==="succeeded"?o.jsx(_u,{"aria-hidden":!0}):e==="failed"?o.jsx(MM,{"aria-hidden":!0}):e==="running"?o.jsx(or,{className:"studio-build-progress__spinner","aria-hidden":!0}):o.jsx(LRe,{"aria-hidden":!0})}function PJ(e){if(!e)return"";const t=Date.parse(e);return Number.isNaN(t)?"":new Intl.DateTimeFormat("zh-CN",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(t)}function t_t({steps:e,log:t,logError:n="",logTruncated:r=!1,logUpdatedAt:i,loading:s=!1}){const a=p.useRef(null),l=p.useRef(!0),[c,u]=p.useState(!1),d=p.useMemo(()=>J2t(t),[t]);p.useEffect(()=>{const h=a.current;h&&t&&l.current&&(h.scrollTop=h.scrollHeight)},[t]);const f=async()=>{try{await navigator.clipboard.writeText(t),u(!0),window.setTimeout(()=>u(!1),1500)}catch{u(!1)}};return o.jsxs("div",{className:"studio-build-progress",children:[o.jsx("ol",{className:"studio-build-progress__steps","aria-label":"构建步骤",children:e.map(h=>o.jsxs("li",{className:`is-${h.status}`,children:[o.jsx("span",{className:"studio-build-progress__step-icon",children:o.jsx(e_t,{status:h.status})}),o.jsx("span",{children:h.label})]},h.key))}),o.jsxs("section",{className:"studio-build-progress__log","aria-label":"构建日志",children:[o.jsxs("header",{children:[o.jsxs("div",{children:[o.jsx("strong",{children:"构建日志"}),o.jsxs("span",{children:[s?"同步中":n?"读取失败":"已同步",r?" · 仅显示最近日志":"",PJ(i)?` · ${PJ(i)}`:""]})]}),o.jsxs(It,{type:"button",color:"secondary",variant:"ghost",size:"sm",disabled:!t,onClick:()=>void f(),"aria-label":c?"已复制构建日志":"复制构建日志",children:[c?o.jsx(_u,{"aria-hidden":!0}):o.jsx(AN,{"aria-hidden":!0}),c?"已复制":"复制"]})]}),t?o.jsx("pre",{ref:a,tabIndex:0,"aria-label":"构建日志内容",onScroll:h=>{l.current=K2t(h.currentTarget)},children:o.jsx("code",{className:"hljs language-bash",dangerouslySetInnerHTML:{__html:d}})}):o.jsx("div",{className:`studio-build-progress__log-empty${n?" is-error":""}`,children:n||(s?"正在等待 CodePipeline 输出日志…":"暂无构建日志")})]})]})}function MJ({name:e,description:t,icon:n,selected:r,disabled:i=!1,onChange:s,className:a=""}){return o.jsxs("div",{className:`studio-package-option${r?" is-selected":""}${a?` ${a}`:""}`,children:[o.jsx("span",{className:"studio-package-option__icon","aria-hidden":"true",children:n}),o.jsxs("span",{className:"studio-package-option__content",children:[o.jsx("strong",{children:e}),t?o.jsx("span",{children:t}):null]}),o.jsx(It,{type:"button",className:"studio-package-option__action",color:"secondary",variant:"ghost",size:"sm",iconSize:"sm",uniform:!0,"aria-label":r?`移除 ${e}`:`安装 ${e}`,"aria-pressed":r,disabled:i,onClick:()=>s(!r),children:r?o.jsx(bRe,{}):o.jsx(xRe,{})})]})}function Im(e,t){return e[t]|e[t+1]<<8}function nb(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}async function n_t(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 Tve(e,t={}){let r=-1;for(let u=e.length-22;u>=0&&u>e.length-65557;u--)if(nb(e,u)===101010256){r=u;break}if(r<0)throw new Error("无效的 zip:找不到 EOCD");const i=Im(e,r+10);if(t.maxEntries!==void 0&&i>t.maxEntries)throw new Error(`zip 文件数不能超过 ${t.maxEntries} 个`);let s=nb(e,r+16);const a=new TextDecoder("utf-8"),l=[];let c=0;for(let u=0;ut.maxUncompressedBytes)throw new Error("zip 解压后的内容过大");const v=Im(e,y+26),x=Im(e,y+28),w=y+30+v+x,S=e.subarray(w,w+f);let E;if(d===0)E=S;else if(d===8)E=await n_t(S);else{s+=46+m+g+b;continue}l.push({name:O,text:a.decode(E)}),s+=46+m+g+b}return l}const z6=/(^|\/)skill\.md$/i;function r_t(e){const t=(e??"").replace(/\r\n?/g,` `).split(` -`);if(!t.length||t[0].trim()!=="---")return{name:"",description:""};let n=-1;for(let i=1;i=2&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))}function a_t(...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 o_t(e,t){return t.trim()||e}function Cve(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(i=>({path:i.path.slice(r.length),text:i.text}))}return t}function l_t(e){const t=new Map,n=new Set;for(const r of e)if(z6.test("/"+r.path)){const i=r.path.split("/");n.add(i.slice(0,-1).join("/"))}for(const r of e){const i=r.path.split("/");let s="";for(let u=i.length-1;u>=0;u--){const d=i.slice(0,u).join("/");if(n.has(d)){s=d;break}}const a=z6.test("/"+r.path);if(!s&&!a&&!n.has("")||!n.has(s)&&!a)continue;const l=s?r.path.slice(s.length+1):r.path,c=t.get(s)||[];c.push({path:l,text:r.text}),t.set(s,c)}return t}function c_t(e,t,n){const r=`${n}${e?"/"+e:""}`,i=t.find(c=>z6.test("/"+c.path));if(!i)return{hit:null,error:`${r} 缺少 SKILL.md`};const s=i_t(i.text),a=a_t(s.name,e,n.replace(/\.[^.]+$/,"")),l=[];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}`};l.push({path:d,content:c.text})}return{hit:{source:"local",id:`local:${a}:${t.length}`,name:o_t(a,s.name),description:s.description||"本地 Skill",folder:a,localFiles:l},error:null}}async function u_t(e){const t=new Uint8Array(await e.arrayBuffer()),r=(await Tve(t)).map(i=>({path:i.name,text:i.text}));return Ave(Cve(r),e.name)}async function d_t(e,t=new Map){const n=[];for(let r=0;re.file(t,n))}async function h_t(e){const t=e.createReader(),n=[];for(;;){const r=await new Promise((i,s)=>t.readEntries(i,s));if(r.length===0)return n;n.push(...r)}}async function Nve(e,t=""){const n=t?`${t}/${e.name}`:e.name;if(e.isFile)return[{file:await f_t(e),path:n}];if(!e.isDirectory)return[];const r=await h_t(e);return(await Promise.all(r.map(i=>Nve(i,n)))).flat()}function p_t({selected:e,onChange:t}){const[n,r]=p.useState([]),[i,s]=p.useState([]),[a,l]=p.useState(!1),[c,u]=p.useState(!1),d=p.useRef(0),f=x=>e.some(w=>w.source==="local"&&w.folder===x),h=x=>{x.localFiles&&(f(x.folder||x.name)?t(e.filter(w=>!(w.source==="local"&&w.folder===(x.folder||x.name)))):t([...e,{source:"local",folder:x.folder||x.name,name:x.name,description:x.description,localFiles:x.localFiles}]))},m=p.useRef([]),g=p.useRef(e);p.useEffect(()=>{m.current=i},[i]),p.useEffect(()=>{g.current=e},[e]);const b=x=>{const w=new Set([...m.current.map(_=>_.folder||_.name),...g.current.filter(_=>_.source==="local").map(_=>_.folder)]),S=[],E=[];for(const _ of x.hits){const C=_.folder||_.name;if(w.has(C)){S.push(_.name);continue}w.add(C),E.push(_)}s(_=>[..._,...E]);const k=[...x.errors];if(S.length>0&&k.push(`已跳过重复技能:${S.join("、")}`),r(k),E.length===1&&x.errors.length===0&&S.length===0){const _=E[0];_.localFiles&&t([...g.current,{source:"local",folder:_.folder||_.name,name:_.name,description:_.description,localFiles:_.localFiles}])}},y=x=>{x.preventDefault(),d.current+=1,u(!0)},O=x=>{x.preventDefault(),d.current=Math.max(0,d.current-1),d.current===0&&u(!1)},v=async x=>{if(x.preventDefault(),d.current=0,u(!1),a)return;const w=Array.from(x.dataTransfer.items).map(S=>{var E;return(E=S.webkitGetAsEntry)==null?void 0:E.call(S)}).filter(S=>S!==null);if(w.length===0){r(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}l(!0);try{const S=(await Promise.all(w.map(_=>Nve(_)))).flat(),E=w.some(_=>_.isDirectory);if(!E&&S.length===1&&S[0].file.name.toLowerCase().endsWith(".zip")){b(await u_t(S[0].file));return}if(!E){r(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}const k=new Map(S.map(({file:_,path:C})=>[_,C]));b(await d_t(S.map(({file:_})=>_),k))}catch(S){r([`读取失败:${S instanceof Error?S.message:String(S)}`])}finally{l(!1)}};return o.jsxs("div",{className:"cw-local",children:[o.jsxs("div",{className:`cw-local-dropzone ${c?"is-dragging":""}`,role:"group","aria-label":"拖入文件夹或 ZIP,自动识别 Skill",onDragEnter:y,onDragOver:x=>x.preventDefault(),onDragLeave:O,onDrop:x=>void v(x),children:[o.jsx(n9,{className:"cw-local-drop-icon","aria-hidden":!0}),o.jsx("p",{className:"cw-local-drop-hint",children:"拖入文件夹或 ZIP,自动识别 Skill"})]}),o.jsx("p",{className:"cw-local-hint",children:"每个技能需包含 SKILL.md。支持包含多个技能的目录。"}),a&&o.jsx("p",{className:"cw-empty-line",children:"正在读取文件…"}),n.length>0&&o.jsxs("div",{className:"cw-banner",children:[o.jsx(wd,{className:"cw-i"}),o.jsx("span",{children:n.join(";")})]}),i.length>0&&o.jsx("div",{className:"cw-skill-results",children:i.map(x=>{var S;const w=f(x.folder||x.name);return o.jsxs("button",{type:"button",className:`cw-skill-result ${w?"is-on":""}`,onClick:()=>h(x),"aria-pressed":w,children:[o.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:w?o.jsx(Eu,{className:"cw-i cw-i-sm"}):o.jsx(yo,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-skill-result-meta",children:[o.jsx("span",{className:"cw-skill-result-name",children:x.name}),x.description&&o.jsx("span",{className:"cw-skill-result-desc",children:kS(x.description)}),o.jsxs("span",{className:"cw-skill-result-repo",children:["本地 · ",((S=x.localFiles)==null?void 0:S.length)??0," 个文件"]})]})]},x.id)})})]})}const m_t="/harness/skills/findskill";async function g_t(e,t="public"){const n=e.trim(),r=new URLSearchParams({query:n,page_number:"1",page_size:"20"}),i=`${m_t}?${r.toString()}`,s=await fetch(i,{headers:{accept:"application/json"},signal:nl(void 0,_o)});if(!s.ok)throw new Error(`搜索失败 (${s.status})`);return((await s.json()).items??[]).map(l=>({source:"skillhub",id:l.slug??l.name??"",slug:l.slug??"",name:l.name??l.slug??"",description:l.description??"",namespace:t,sourceRepo:l.sourceRepo,downloadCount:l.downloadCount,version:l.version}))}function b_t({selected:e,onChange:t}){const[n,r]=p.useState(""),[i,s]=p.useState([]),[a,l]=p.useState(!1),[c,u]=p.useState(null),[d,f]=p.useState(!1),h=b=>e.some(y=>y.source==="skillhub"&&y.slug===b),m=b=>{b.slug&&(h(b.slug)?t(e.filter(y=>!(y.source==="skillhub"&&y.slug===b.slug))):t([...e,{source:"skillhub",slug:b.slug,name:b.name,folder:b.slug.split("/").pop()||b.name,namespace:b.namespace||"public",description:b.description}]))},g=async b=>{l(!0),u(null),f(!0);try{const y=await g_t(b);s(y)}catch(y){u(y instanceof Error?y.message:"搜索失败,请稍后重试。"),s([])}finally{l(!1)}};return p.useEffect(()=>{const b=n.trim();if(!b){s([]),f(!1),u(null);return}const y=setTimeout(()=>g(b),300);return()=>clearTimeout(y)},[n]),o.jsxs("div",{className:"cw-skillhub",children:[o.jsxs("div",{className:"cw-skill-searchrow",children:[o.jsxs("div",{className:"cw-skill-searchbox",children:[o.jsx(gC,{className:"cw-i cw-skill-searchicon","aria-hidden":!0}),o.jsx("input",{className:"cw-input cw-skill-input",value:n,placeholder:"搜索火山 Find Skill 技能广场,例如 数据分析、PDF…",onChange:b=>r(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),n.trim()&&g(n))}})]}),o.jsxs("button",{type:"button",className:"cw-btn cw-btn-soft",onClick:()=>n.trim()&&g(n),disabled:!n.trim()||a,children:[a?o.jsx(lr,{className:"cw-i cw-spin"}):o.jsx(gC,{className:"cw-i"}),"搜索"]})]}),c&&o.jsxs("div",{className:"cw-banner",children:[o.jsx(wd,{className:"cw-i"}),o.jsx("span",{children:c})]}),a&&i.length===0?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(lr,{className:"cw-i cw-spin"})," 正在搜索…"]}):i.length>0?o.jsx("div",{className:"cw-skill-results",children:i.map(b=>{const y=h(b.slug||"");return o.jsxs("button",{type:"button",className:`cw-skill-result ${y?"is-on":""}`,onClick:()=>m(b),"aria-pressed":y,children:[o.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:y?o.jsx(Eu,{className:"cw-i cw-i-sm"}):o.jsx(yo,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-skill-result-meta",children:[o.jsx("span",{className:"cw-skill-result-name",children:b.name}),b.description&&o.jsx("span",{className:"cw-skill-result-desc",children:kS(b.description)}),b.sourceRepo&&o.jsx("span",{className:"cw-skill-result-repo",children:b.sourceRepo})]})]},b.id||b.slug)})}):d&&!c?o.jsx("p",{className:"cw-empty-line",children:"没有找到匹配的技能,换个关键词试试。"}):!d&&o.jsx("p",{className:"cw-empty-line",children:"输入关键词搜索火山 Find Skill 技能广场,所选技能会在生成项目时下载到 skills/ 目录。"})]})}function y_t({selected:e,onChange:t,cloudProvider:n="volcengine"}){const[r,i]=p.useState([]),[s,a]=p.useState([]),[l,c]=p.useState(""),[u,d]=p.useState(!0),[f,h]=p.useState(!1),[m,g]=p.useState(null);p.useEffect(()=>{let x=!1;return(async()=>{d(!0),g(null);try{const w=await Fge();x||(i(w),w.length>0&&c(w[0].id))}catch(w){x||g(w instanceof Error?w.message:"加载失败")}finally{x||d(!1)}})(),()=>{x=!0}},[]),p.useEffect(()=>{if(!l){a([]);return}const x=r.find(S=>S.id===l);let w=!1;return(async()=>{h(!0),g(null);try{const S=await zge(l,x==null?void 0:x.region);w||a(S)}catch(S){w||g(S instanceof Error?S.message:"加载失败")}finally{w||h(!1)}})(),()=>{w=!0}},[l,r]);const b=r.find(x=>x.id===l),y=b?fct(b.id,b.region,n):"",O=(x,w)=>e.some(S=>S.source==="skillspace"&&S.skillId===x&&(S.version||"")===w),v=x=>{if(b)if(O(x.skillId,x.version))t(e.filter(w=>!(w.source==="skillspace"&&w.skillId===x.skillId&&(w.version||"")===x.version)));else{const w=dct(b,x);t([...e,{source:"skillspace",folder:w.folder||x.skillName,name:w.name,description:w.description,skillSpaceId:w.skillSpaceId,skillSpaceName:w.skillSpaceName,skillSpaceRegion:w.skillSpaceRegion,skillId:w.skillId,version:w.version}])}};return o.jsx("div",{className:"cw-skillspace",children:u?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(lr,{className:"cw-i cw-spin"})," 正在加载 AgentKit Skills 中心…"]}):m?o.jsxs("div",{className:"cw-banner",children:[o.jsx(wd,{className:"cw-i"}),o.jsx("span",{children:m})]}):r.length===0?o.jsx("p",{className:"cw-empty-line",children:"此账号下没有 AgentKit Skills 中心。"}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"cw-skillspace-header",children:[o.jsx("select",{className:"cw-input cw-skillspace-select",value:l,onChange:x=>c(x.target.value),"aria-label":"选择 AgentKit Skills 中心",children:r.map(x=>o.jsxs("option",{value:x.id,children:[x.name||x.id,x.description?` — ${kS(x.description)}`:""]},x.id))}),b&&o.jsxs(o.Fragment,{children:[b.region&&o.jsx("span",{className:"cw-skillspace-region-label",title:b.region,children:Zf(b.region,n)}),y&&o.jsx("a",{href:y,target:"_blank",rel:"noopener noreferrer",className:"cw-button cw-button-secondary cw-skillspace-console-link",title:"在火山引擎控制台打开","aria-label":"在火山引擎控制台打开",children:o.jsx(Dg,{className:"cw-i cw-i-sm"})})]})]}),f?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(lr,{className:"cw-i cw-spin"})," 正在加载技能列表…"]}):s.length===0?o.jsx("p",{className:"cw-empty-line",children:"此 AgentKit Skills 中心暂无技能。"}):o.jsx("div",{className:"cw-skill-results",children:s.map(x=>{const w=O(x.skillId,x.version);return o.jsxs("button",{type:"button",className:`cw-skill-result ${w?"is-on":""}`,onClick:()=>v(x),"aria-pressed":w,children:[o.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:w?o.jsx(Eu,{className:"cw-i cw-i-sm"}):o.jsx(yo,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-skill-result-meta",children:[o.jsxs("span",{className:"cw-skill-result-name",children:[x.skillName,x.version&&o.jsxs("span",{className:"cw-skill-result-version",children:[" ","v",x.version]})]}),x.skillDescription&&o.jsx("span",{className:"cw-skill-result-desc",children:kS(x.skillDescription)}),o.jsxs("span",{className:"cw-skill-result-repo",children:[o.jsx(BRe,{className:"cw-i cw-i-sm"})," ",(b==null?void 0:b.name)||l]})]})]},`${x.skillId}/${x.version}`)})})]})})}function jve({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.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"}),o.jsx("path",{d:"M7 4.75h9.5a2 2 0 0 1 2 2",opacity:".58"}),o.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"}),o.jsx("path",{d:"M19.25 11.25h1.5M20 10.5V12",opacity:".72"})]})}function LP(e){return e.source==="runtime"?`runtime:${e.folder}`:e.source==="skillhub"?`hub:${e.namespace}/${e.slug}`:e.source==="local"?`local:${e.folder}`:`ss:${e.skillSpaceId}/${e.skillId}/${e.version||""}`}function O_t(e){return e.source==="runtime"?"运行中来源 · 原样保留,可移除或用同名 Skill 替换":e.source==="local"?"本地":e.source==="skillspace"?"AgentKit Skills 中心":"火山 Find Skill 技能广场"}function x_t({skill:e,onRemove:t,disabled:n}){let r=xw;e.source==="local"||e.source==="runtime"?r=n9:e.source==="skillspace"&&(r=jve);const i=`${O_t(e)}${e.description?` · ${kS(e.description)}`:""}`;return o.jsxs(oi.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:[o.jsx("span",{className:"cw-selected-skill-icon","aria-hidden":"true",children:o.jsx(r,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-selected-skill-meta",children:[o.jsx("span",{className:"cw-selected-skill-name",children:e.name}),o.jsx("span",{className:"cw-selected-skill-detail",tabIndex:0,title:i,children:i})]}),o.jsx("button",{type:"button",className:"cw-selected-skill-remove",onClick:t,disabled:n,"aria-label":`移除 ${e.name}`,title:`移除 ${e.name}`,children:o.jsx(Oa,{className:"cw-i cw-i-sm"})})]})}const $P=[{id:"local",label:"本地文件",shortLabel:"本地文件",icon:n9},{id:"skillspace",label:"AgentKit Skills 中心",shortLabel:"AgentKit",icon:jve},{id:"skillhub",label:"火山 Find Skill 技能广场",shortLabel:"Find Skill",icon:jN}];function hU({selected:e,onChange:t,cloudProvider:n,disabled:r=!1,addLabel:i="添加 Skill",showSelectedCount:s=!0}){const[a,l]=p.useState("local"),[c,u]=p.useState(!1),d=p.useId(),f=p.useId(),h=p.useRef(null),m=$P.findIndex(y=>y.id===a);p.useEffect(()=>{var x;if(!c)return;const y=document.body.style.overflow,O=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(x=h.current)==null||x.focus();const v=w=>{w.key==="Escape"&&u(!1)};return window.addEventListener("keydown",v),()=>{document.body.style.overflow=y,window.removeEventListener("keydown",v),O!=null&&O.isConnected&&O.focus()}},[c]);const g=(y,O)=>{O.source==="runtime"&&!window.confirm(`从新版本中移除运行中的 Skill「${O.name}」?`)||t(e.filter(v=>LP(v)!==y))},b=y=>{const O=new Set(y.filter(v=>v.source!=="runtime").map(v=>v.folder));t(y.filter(v=>v.source!=="runtime"||!O.has(v.folder)))};return o.jsxs("div",{className:"cw-skillspane",children:[o.jsxs("button",{type:"button",className:"cw-skill-add","aria-haspopup":"dialog",disabled:r,onClick:()=>u(!0),children:[o.jsx("span",{className:"cw-skill-add-icon","aria-hidden":"true",children:o.jsx(yo,{className:"cw-i"})}),o.jsx("span",{children:i})]}),e.length>0&&o.jsxs("div",{className:"cw-skill-selected",children:[s?o.jsxs("span",{className:"cw-skill-selected-label",children:["已加入技能 · ",e.length]}):null,o.jsx("div",{className:"cw-selected-skill-list",children:o.jsx(hu,{initial:!1,children:e.map(y=>o.jsx(x_t,{skill:y,disabled:r,onRemove:()=>g(LP(y),y)},LP(y)))})})]}),Cr.createPortal(o.jsx(hu,{children:c&&o.jsx(oi.div,{className:"cw-skill-dialog-backdrop",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.16},onMouseDown:y=>{y.target===y.currentTarget&&u(!1)},children:o.jsxs(oi.section,{className:"cw-skill-dialog",role:"dialog","aria-modal":"true","aria-labelledby":d,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:[o.jsxs("header",{className:"cw-skill-dialog-head",children:[o.jsx("h3",{id:d,children:i}),o.jsx("button",{ref:h,type:"button",className:"cw-skill-dialog-close","aria-label":`关闭${i}`,onClick:()=>u(!1),children:o.jsx(Oa,{className:"cw-i"})})]}),o.jsxs("div",{className:"cw-skill-dialog-body",children:[o.jsxs("div",{className:"cw-skill-sourcetabs",role:"tablist",style:{"--cw-skill-tab-slider-width":`calc((100% - 16px) / ${$P.length})`,"--cw-active-skill-tab-offset":`calc(${m*100}% + ${m*4}px)`},children:[o.jsx("span",{className:"cw-skill-tab-slider","aria-hidden":"true"}),$P.map(({id:y,label:O,shortLabel:v,icon:x})=>o.jsxs("button",{type:"button",role:"tab",id:`${f}-${y}`,"aria-controls":f,"aria-selected":a===y,className:`cw-skill-pickertab ${a===y?"is-on":""}`,onClick:()=>l(y),children:[o.jsx(x,{className:"cw-i cw-i-sm"}),o.jsx("span",{className:"cw-skill-tab-label-full",children:O}),o.jsx("span",{className:"cw-skill-tab-label-short",children:v})]},y))]}),o.jsxs("div",{id:f,className:"cw-skill-tabbody",role:"tabpanel","aria-labelledby":`${f}-${a}`,children:[a==="skillhub"&&o.jsx(b_t,{selected:e,onChange:b}),a==="local"&&o.jsx(p_t,{selected:e,onChange:b}),a==="skillspace"&&o.jsx(y_t,{selected:e,onChange:b,cloudProvider:n})]})]})]})})}),document.body)]})}const Rve=128*1024;function v_t(e){return e.replace(/^\uFEFF/,"").replace(/\r\n?/g,` -`)}function V6(e){return new TextEncoder().encode(e).byteLength}function Ive(e,t=V6(e)){return t>Rve?"Dockerfile 不能超过 128 KiB。":e.trim()?/^\s*FROM\s+\S+/im.test(e)?"":"Dockerfile 缺少 FROM 指令。":"Dockerfile 内容不能为空。"}async function w_t(e){if(e.size>Rve)return{content:"",error:"Dockerfile 不能超过 128 KiB。"};const t=v_t(await e.text());return{content:t,error:Ive(t,e.size)}}function S_t(e){return nQ(e,{lineWidth:0})}function E_t(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m7 9.5 5 5 5-5"})})}function k_t(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m6.5 12.5 3.5 3.5 7.5-8"})})}function HE({ariaLabel:e,value:t,valueLabel:n,placeholder:r,options:i,disabled:s=!1,searchValue:a,searchPlaceholder:l="搜索资源名称",loading:c=!1,hasMore:u=!1,emptyMessage:d="暂无可用选项",onSearchChange:f,onLoadMore:h,onChange:m}){const g=p.useId(),b=p.useRef(null),y=p.useRef(null),O=p.useRef(null),v=p.useRef(null),x=p.useRef([]),[w,S]=p.useState(!1),[E,k]=p.useState(0),_=i.find(M=>M.value===t),C=(_==null?void 0:_.label)??(t?n:void 0),T=a!==void 0&&!!f,A=()=>{S(!1),T&&a&&(f==null||f(""))};p.useEffect(()=>{if(!w)return;const M=N=>{N.target instanceof Node&&b.current&&!b.current.contains(N.target)&&A()};return window.addEventListener("pointerdown",M),()=>window.removeEventListener("pointerdown",M)},[w,f,a,T]),p.useEffect(()=>{var M,N;if(w){if(T){(M=O.current)==null||M.focus();return}(N=x.current[E])==null||N.focus()}},[w,T]),p.useEffect(()=>{var M;!w||T&&document.activeElement===O.current||(M=x.current[E])==null||M.focus()},[E,w,T]),p.useEffect(()=>{k(M=>Math.min(M,Math.max(0,i.length-1)))},[i.length]),p.useEffect(()=>{if(!w||!u||c||!h)return;const M=window.requestAnimationFrame(()=>{const N=v.current;N&&N.scrollHeight<=N.clientHeight+1&&h()});return()=>window.cancelAnimationFrame(M)},[u,c,h,w,i.length]);const j=(M=1)=>{const N=i.findIndex(Q=>Q.value===t),D=N>=0?N:M===1?0:Math.max(0,i.length-1);k(D),S(!0)},L=M=>{i.length!==0&&k((M+i.length)%i.length)},I=M=>{var N;m(M.value),A(),(N=y.current)==null||N.focus()};return o.jsxs("div",{className:"pp-deployment-select",ref:b,onKeyDown:M=>{var D,Q;const N=M.target===O.current;if(M.key==="Escape"&&w){M.preventDefault(),A(),(D=y.current)==null||D.focus();return}if(M.key==="Tab"){A();return}if(N){M.key==="ArrowDown"&&i.length>0&&(M.preventDefault(),k(0),(Q=x.current[0])==null||Q.focus());return}M.key==="ArrowDown"?(M.preventDefault(),w?L(E+1):j(1)):M.key==="ArrowUp"?(M.preventDefault(),w?L(E-1):j(-1)):w&&M.key==="Home"?(M.preventDefault(),k(0)):w&&M.key==="End"&&(M.preventDefault(),k(Math.max(0,i.length-1)))},children:[o.jsxs("button",{ref:y,type:"button",className:"pp-deployment-select-trigger","aria-label":e,"aria-haspopup":"listbox","aria-expanded":w,"aria-controls":w?g:void 0,disabled:s,onClick:()=>{w?A():j()},children:[o.jsx("span",{className:C?void 0:"is-placeholder",children:C??r}),o.jsx(E_t,{className:`pp-deployment-select-chevron${w?" is-open":""}`})]}),w&&o.jsxs("div",{className:"pp-deployment-select-menu",children:[T&&o.jsx("div",{className:"pp-deployment-select-search",children:o.jsx("input",{ref:O,type:"search",value:a,"aria-label":`搜索${e}`,placeholder:l,autoComplete:"off",onChange:M=>f==null?void 0:f(M.currentTarget.value)})}),o.jsx("div",{id:g,ref:v,className:"pp-deployment-select-options",role:"listbox","aria-label":e,"aria-busy":c||void 0,onScroll:M=>{if(!u||c||!h)return;const N=M.currentTarget;N.scrollHeight-N.scrollTop-N.clientHeight<=24&&h()},children:i.map((M,N)=>{const D=M.value===t;return o.jsxs("button",{ref:Q=>{x.current[N]=Q},type:"button",role:"option","aria-selected":D,tabIndex:N===E?0:-1,className:`pp-deployment-select-option${D?" is-selected":""}`,title:M.description,onFocus:()=>k(N),onClick:()=>I(M),children:[o.jsxs("span",{className:"pp-deployment-select-copy",children:[o.jsxs("span",{className:"pp-deployment-select-name",children:[M.label,M.badge&&o.jsx("span",{className:"pp-deployment-select-badge",children:M.badge})]}),M.description&&o.jsx("small",{children:M.description})]}),D&&o.jsx(k_t,{})]},M.value)})}),c&&o.jsx("div",{className:"pp-deployment-select-state","aria-live":"polite",children:"正在加载更多资源…"}),!c&&i.length===0&&o.jsx("div",{className:"pp-deployment-select-state",children:d})]})]})}const __t=[{value:"auto",label:"自动创建",description:"部署时自动创建所需资源",badge:"推荐"},{value:"create",label:"指定名称",description:"使用指定名称创建或复用资源"},{value:"existing",label:"选择已有",description:"从当前账号的已有资源中选择"}],Dve={tos:{mode:"auto"},cr:{mode:"auto"},codePipeline:{mode:"auto"}};function mf(e){const[t,n]=p.useState([]),[r,i]=p.useState(""),[s,a]=p.useState(1),[l,c]=p.useState(0),[u,d]=p.useState(!1),[f,h]=p.useState(!1),[m,g]=p.useState(null),[b,y]=p.useState(""),[O,v]=p.useState(""),[x,w]=p.useState(""),[S,E]=p.useState(0),k=p.useRef(!1),_=p.useRef(null),C=e?JSON.stringify(e):"",T=e?JSON.stringify({...e,search:O}):"";p.useEffect(()=>{const M=window.setTimeout(()=>{v(b.trim())},250);return()=>window.clearTimeout(M)},[b]),p.useEffect(()=>{y(""),v("")},[C]);const A=p.useCallback((M,N)=>{var F;if(!T)return;(F=_.current)==null||F.abort();const D=new AbortController;_.current=D;const Q=JSON.parse(T);N&&n([]),k.current=!0,h(!0),g(null),Ooe({...Q,pageNumber:M,pageSize:100},D.signal).then($=>{n(H=>{if(N)return $.items;const z=new Set(H.map(B=>`${B.id}\0${B.name}`));return[...H,...$.items.filter(B=>!z.has(`${B.id}\0${B.name}`))]}),i($.serviceRegion),a($.pageNumber),c($.totalCount),d($.hasMore),w(T)}).catch($=>{$ instanceof DOMException&&$.name==="AbortError"||(w(T),g($ instanceof Error?$.message:String($)))}).finally(()=>{_.current===D&&(_.current=null,k.current=!1,h(!1))})},[T]);p.useEffect(()=>{var M;if(!T){(M=_.current)==null||M.abort(),_.current=null,k.current=!1,n([]),i(""),a(1),c(0),d(!1),w(""),h(!1),g(null);return}return A(1,!0),()=>{var N;return(N=_.current)==null?void 0:N.abort()}},[A,T,S]);const j=!!T&&x===T&&b.trim()===O,L=p.useCallback(()=>{w(""),E(M=>M+1)},[]),I=p.useCallback(()=>{!j||k.current||!u||A(s+1,!1)},[u,A,s,j]);return{items:t,serviceRegion:r,totalCount:l,hasMore:j?u:!1,loading:!!T&&(!j||f),error:m,search:b,setSearch:y,reload:L,loadMore:I}}function T_t(e,t){return e.map(n=>({value:n[t],label:n.name,description:[n.status,n.region,n.id].filter(Boolean).join(" · ")}))}function gf({ariaLabel:e,value:t,valueLabel:n,state:r,disabled:i,disabledMessage:s,valueField:a="id",onChange:l}){const c=p.useMemo(()=>T_t(r.items,a),[r.items,a]);return o.jsxs("div",{className:"pp-resource-picker",children:[o.jsx(HE,{ariaLabel:e,value:t,valueLabel:n,placeholder:r.loading?"正在加载…":"请选择已有资源",options:c,disabled:i||!!r.error,searchValue:r.search,searchPlaceholder:"搜索资源名称",loading:r.loading,hasMore:r.hasMore,emptyMessage:r.search.trim()?"未找到匹配资源":"暂无可用资源",onSearchChange:r.setSearch,onLoadMore:r.loadMore,onChange:u=>{const d=r.items.find(f=>f[a]===u);d&&l(d)}}),s?o.jsx("span",{className:"pp-resource-status",children:s}):r.error?o.jsxs("div",{className:"pp-resource-error",role:"alert",children:[o.jsx("span",{children:r.error}),o.jsx("button",{type:"button",onClick:r.reload,children:"重试"})]}):r.loading&&r.items.length===0?o.jsx("span",{className:"pp-resource-status","aria-live":"polite",children:r.search.trim()?"正在搜索云资源…":"正在加载云资源…"}):r.items.length===0?o.jsx("span",{className:"pp-resource-status",children:r.search.trim()?"未找到匹配资源。":"暂无可用资源。"}):r.serviceRegion?o.jsxs("span",{className:"pp-resource-status",children:["实际服务区域:",r.serviceRegion," · 已加载 ",r.items.length,r.totalCount>0?`/${r.totalCount}`:""]}):null]})}function Pve({region:e,value:t,disabled:n=!1,onChange:r}){const i=mf(e?{kind:"cr-registry",region:e}:null),s=mf(e&&(t!=null&&t.registry)?{kind:"cr-namespace",region:e,registry:t.registry}:null),a=mf(e&&(t!=null&&t.registry)&&t.namespace?{kind:"cr-repository",region:e,registry:t.registry,namespace:t.namespace}:null),l=t??{region:e,registry:"",namespace:"",repository:""};return o.jsxs("div",{className:"pp-resource-fields pp-resource-fields-three environment-repository-fields",children:[o.jsxs("label",{className:"pp-resource-field",children:[o.jsx("span",{children:"Registry 实例"}),o.jsx(gf,{ariaLabel:"镜像仓库 Registry 实例",value:l.registry,valueLabel:l.registry,state:i,disabled:n||!e,valueField:"name",onChange:c=>r({region:e,registry:c.name,namespace:"",repository:""})})]}),o.jsxs("label",{className:"pp-resource-field",children:[o.jsx("span",{children:"Namespace"}),o.jsx(gf,{ariaLabel:"镜像仓库 Namespace",value:l.namespace,valueLabel:l.namespace,state:s,disabled:n||!l.registry,disabledMessage:l.registry?void 0:"请先选择 Registry 实例。",valueField:"name",onChange:c=>r({...l,region:e,namespace:c.name,repository:""})})]}),o.jsxs("label",{className:"pp-resource-field",children:[o.jsx("span",{children:"镜像仓库"}),o.jsx(gf,{ariaLabel:"已有镜像仓库",value:l.repository,valueLabel:l.repository,state:a,disabled:n||!l.registry||!l.namespace,disabledMessage:l.registry?l.namespace?void 0:"请先选择 Namespace。":"请先选择 Registry 实例。",valueField:"name",onChange:c=>r({...l,region:e,repository:c.name})})]})]})}function BP({resource:e,value:t,disabled:n,onChange:r}){return o.jsxs("label",{className:"pp-resource-field pp-resource-mode",children:[o.jsx("span",{children:"配置方式"}),o.jsx(HE,{ariaLabel:`${e}配置方式`,value:t,placeholder:"请选择配置方式",options:__t,disabled:n,onChange:i=>r(i)})]})}function rb({label:e,value:t,placeholder:n,disabled:r,onChange:i}){return o.jsxs("label",{className:"pp-resource-field",children:[o.jsx("span",{children:e}),o.jsx("input",{value:t,placeholder:n,disabled:r,autoComplete:"off",onChange:s=>i(s.currentTarget.value)})]})}function QP({items:e,note:t}){return o.jsxs("div",{className:"pp-resource-auto-names",children:[o.jsx("span",{children:"自动创建名称"}),o.jsx("dl",{children:e.map(n=>o.jsxs("div",{children:[o.jsx("dt",{children:n.label}),o.jsx("dd",{title:n.name,children:n.name})]},n.label))}),t&&o.jsx("small",{children:t})]})}function Mve(e){var t,n,r,i,s,a,l,c;return e.tos.mode!=="auto"&&!((t=e.tos.bucket)!=null&&t.trim())?"请填写或选择 TOS 存储桶。":e.cr.mode!=="auto"&&(!((n=e.cr.instance)!=null&&n.trim())||!((r=e.cr.namespace)!=null&&r.trim())||!((i=e.cr.repository)!=null&&i.trim()))?"请完整填写或选择 CR 实例、命名空间和镜像仓库。":e.codePipeline.mode!=="auto"&&(!((s=e.codePipeline.workspaceName)!=null&&s.trim())||!((a=e.codePipeline.pipelineName)!=null&&a.trim()))?"请完整填写或选择 CodePipeline Workspace 和 Pipeline。":e.codePipeline.mode==="existing"&&(!((l=e.codePipeline.workspaceId)!=null&&l.trim())||!((c=e.codePipeline.pipelineId)!=null&&c.trim()))?"请选择已有的 CodePipeline Workspace 和兼容 Pipeline。":null}function Lve({value:e,agentName:t,runtimeName:n,region:r,disabled:i,validationError:s,onChange:a}){const l=t.trim()||"agentkit-app",c=n.trim()||l,u=r&&r!=="cn-beijing"?`agentkit-platform-{账号 ID}-${r.startsWith("cn-")?r.slice(3):r}`:"agentkit-platform-{账号 ID}",d=mf(e.tos.mode==="existing"?{kind:"tos-bucket",region:r}:null),f=mf(e.cr.mode==="existing"?{kind:"cr-registry",region:r}:null),h=mf(e.cr.mode==="existing"&&e.cr.instance?{kind:"cr-namespace",region:r,registry:e.cr.instance}:null),m=mf(e.cr.mode==="existing"&&e.cr.instance&&e.cr.namespace?{kind:"cr-repository",region:r,registry:e.cr.instance,namespace:e.cr.namespace}:null),g=mf(e.codePipeline.mode==="existing"?{kind:"cp-workspace",region:r}:null),b=mf(e.codePipeline.mode==="existing"&&e.codePipeline.workspaceId?{kind:"cp-pipeline",region:r,workspaceId:e.codePipeline.workspaceId}:null),y=O=>a({...e,...O});return o.jsxs("div",{className:"pp-resource-list",children:[o.jsxs("div",{className:"pp-resource-item",children:[o.jsx("div",{className:"pp-resource-name",children:"TOS 存储桶"}),o.jsxs("div",{className:"pp-resource-grid",children:[o.jsx(BP,{resource:"TOS 存储桶",value:e.tos.mode,disabled:i,onChange:O=>y({tos:{mode:O}})}),e.tos.mode==="create"&&o.jsx(rb,{label:"存储桶名称",value:e.tos.bucket??"",placeholder:"输入存储桶名称",disabled:i,onChange:O=>y({tos:{...e.tos,bucket:O}})}),e.tos.mode==="existing"&&o.jsxs("label",{className:"pp-resource-field",children:[o.jsx("span",{children:"已有存储桶"}),o.jsx(gf,{ariaLabel:"已有 TOS 存储桶",value:e.tos.bucket??"",valueLabel:e.tos.bucket,state:d,disabled:i,onChange:O=>y({tos:{...e.tos,bucket:O.name}})})]}),e.tos.mode==="auto"&&o.jsx(QP,{items:[{label:"存储桶",name:u}],note:"账号 ID 在部署时按当前云账号解析。"})]})]}),o.jsxs("div",{className:"pp-resource-item",children:[o.jsx("div",{className:"pp-resource-name",children:"容器镜像仓库(CR)"}),o.jsxs("div",{className:"pp-resource-grid",children:[o.jsx(BP,{resource:"CR",value:e.cr.mode,disabled:i,onChange:O=>y({cr:{mode:O}})}),e.cr.mode==="create"&&o.jsxs("div",{className:"pp-resource-fields pp-resource-fields-three",children:[o.jsx(rb,{label:"实例名称",value:e.cr.instance??"",placeholder:"CR 实例",disabled:i,onChange:O=>y({cr:{...e.cr,instance:O}})}),o.jsx(rb,{label:"命名空间",value:e.cr.namespace??"",placeholder:"命名空间",disabled:i,onChange:O=>y({cr:{...e.cr,namespace:O}})}),o.jsx(rb,{label:"镜像仓库",value:e.cr.repository??"",placeholder:"镜像仓库",disabled:i,onChange:O=>y({cr:{...e.cr,repository:O}})})]}),e.cr.mode==="existing"&&o.jsxs("div",{className:"pp-resource-fields pp-resource-fields-three",children:[o.jsxs("label",{className:"pp-resource-field",children:[o.jsx("span",{children:"CR 实例"}),o.jsx(gf,{ariaLabel:"已有 CR 实例",value:e.cr.instance??"",valueLabel:e.cr.instance,state:f,disabled:i,valueField:"name",onChange:O=>y({cr:{mode:"existing",instance:O.name}})})]}),o.jsxs("label",{className:"pp-resource-field",children:[o.jsx("span",{children:"命名空间"}),o.jsx(gf,{ariaLabel:"已有 CR 命名空间",value:e.cr.namespace??"",valueLabel:e.cr.namespace,state:h,disabled:i||!e.cr.instance,valueField:"name",onChange:O=>y({cr:{...e.cr,namespace:O.name,repository:void 0}})})]}),o.jsxs("label",{className:"pp-resource-field",children:[o.jsx("span",{children:"镜像仓库"}),o.jsx(gf,{ariaLabel:"已有 CR 镜像仓库",value:e.cr.repository??"",valueLabel:e.cr.repository,state:m,disabled:i||!e.cr.namespace,valueField:"name",onChange:O=>y({cr:{...e.cr,repository:O.name}})})]})]}),e.cr.mode==="auto"&&o.jsx(QP,{items:[{label:"CR 实例",name:"agentkit-platform-{账号 ID}"},{label:"命名空间",name:"agentkit"},{label:"镜像仓库",name:`${l}-{4 位随机字符}`}],note:"账号 ID 在部署时解析,镜像仓库的随机字符在部署时生成。"})]})]}),o.jsxs("div",{className:"pp-resource-item",children:[o.jsx("div",{className:"pp-resource-name",children:"CodePipeline"}),o.jsxs("div",{className:"pp-resource-grid",children:[o.jsx(BP,{resource:"CodePipeline",value:e.codePipeline.mode,disabled:i,onChange:O=>y({codePipeline:{mode:O}})}),e.codePipeline.mode==="create"&&o.jsxs("div",{className:"pp-resource-fields",children:[o.jsx(rb,{label:"Workspace 名称",value:e.codePipeline.workspaceName??"",placeholder:"Workspace 名称",disabled:i,onChange:O=>y({codePipeline:{...e.codePipeline,workspaceName:O}})}),o.jsx(rb,{label:"Pipeline 名称",value:e.codePipeline.pipelineName??"",placeholder:"Pipeline 名称",disabled:i,onChange:O=>y({codePipeline:{...e.codePipeline,pipelineName:O}})})]}),e.codePipeline.mode==="existing"&&o.jsxs("div",{className:"pp-resource-fields",children:[o.jsxs("label",{className:"pp-resource-field",children:[o.jsx("span",{children:"Workspace"}),o.jsx(gf,{ariaLabel:"已有 CodePipeline Workspace",value:e.codePipeline.workspaceId??"",valueLabel:e.codePipeline.workspaceName,state:g,disabled:i,onChange:O=>y({codePipeline:{mode:"existing",workspaceId:O.id,workspaceName:O.name}})})]}),o.jsxs("label",{className:"pp-resource-field",children:[o.jsx("span",{children:"兼容 Pipeline"}),o.jsx(gf,{ariaLabel:"已有 AgentKit CodePipeline",value:e.codePipeline.pipelineId??"",valueLabel:e.codePipeline.pipelineName,state:b,disabled:i||!e.codePipeline.workspaceId,onChange:O=>y({codePipeline:{...e.codePipeline,pipelineId:O.id,pipelineName:O.name}})})]})]}),e.codePipeline.mode==="auto"&&o.jsx(QP,{items:[{label:"Workspace",name:"agentkit-cli-workspace"},{label:"Pipeline",name:c}],note:"Pipeline 与 Runtime 名称一致。"})]})]}),s&&o.jsx("p",{className:"pp-resource-validation",role:"alert",children:s})]})}const $ve=20,LJ=new Set,$J="未能读取剪贴板。请允许剪贴板权限,或点击“导入环境”后手动粘贴分享码。",C_t="当前浏览器无法自动读取剪贴板;请点击“导入环境”后手动粘贴分享码。";async function A_t(){var e;if(typeof navigator>"u"||!((e=navigator.permissions)!=null&&e.query))return!1;try{return(await navigator.permissions.query({name:"clipboard-read"})).state==="denied"}catch{return!1}}const N_t={opencli:V2t,uv:H2t,playwright:q2t,chromium:X2t,git:G2t,curl:W2t,ffmpeg:Y2t,imagemagick:Z2t};function j_t(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"M8 3.25v9.5M3.25 8h9.5"})})}function R_t(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"6",cy:"5",r:"2"}),o.jsx("circle",{cx:"6",cy:"19",r:"2"}),o.jsx("circle",{cx:"18",cy:"12",r:"2"}),o.jsx("path",{d:"M8 5h2a4 4 0 0 1 4 4v0a3 3 0 0 0 3 3M8 19h2a4 4 0 0 0 4-4v0a3 3 0 0 1 3-3"})]})}function I_t(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"m4.5 7.5 7.5-4 7.5 4v9l-7.5 4-7.5-4v-9Z"}),o.jsx("path",{d:"m4.5 7.5 7.5 4 7.5-4M12 11.5v9"}),o.jsx("path",{d:"m8.5 5.4 7.3 4"})]})}function D_t(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M12 3v11m0 0 4-4m-4 4-4-4"}),o.jsx("path",{d:"M5 16v2.5A2.5 2.5 0 0 0 7.5 21h9a2.5 2.5 0 0 0 2.5-2.5V16"})]})}function H6(e){const t=e.trim();if(!t)return"请输入公开代码仓库地址。";try{const n=new URL(t);if(n.protocol!=="https:"||!n.hostname)return"请输入公开仓库的 HTTPS 地址。"}catch{return"请输入有效的公开仓库 HTTPS 地址。"}return""}function BJ(e){return!!(e!=null&&e.region&&e.registry&&e.namespace&&e.repository)}function Bve(e){const t=e.trim();return t?/\s/.test(t)?"Tag 或 Digest 不能包含空格。":t.startsWith("sha256:")?/^sha256:[0-9a-fA-F]{64}$/.test(t)?"":"Digest 必须是完整的 sha256 值。":/[@/]/.test(t)?"这里只填写 Tag,不要重复填写镜像仓库路径。":"":""}function P_t(e){return(e instanceof Error?e.message:String(e)).split(` -原始响应:`,1)[0].trim()}function M_t(e){return o.jsxs("svg",{viewBox:"0 0 32 32",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M5.5 10.5 16 5l10.5 5.5L16 16 5.5 10.5Z"}),o.jsx("path",{d:"M5.5 16 16 21.5 26.5 16M5.5 21.5 16 27l10.5-5.5"})]})}function L_t({label:e}){return o.jsx("span",{className:"environment-package-fallback",children:e.slice(0,1).toUpperCase()})}function $_t({option:e}){if(e.id==="lark-cli")return o.jsx("img",{src:xR,alt:""});if(e.id==="pandoc")return o.jsx("img",{src:z2t,alt:""});if(e.id==="github-cli")return o.jsx(fU,{});const t=N_t[e.id];return t?o.jsx("img",{src:t,alt:""}):o.jsx(L_t,{label:e.label})}function B_t(e){return e?{name:e.name,description:e.description,baseEnvironment:e.baseEnvironment,operatingSystem:e.operatingSystem,language:e.language,optionIds:[...e.optionIds],selectedSkills:[...e.selectedSkills],dockerfile:e.dockerfile===H7(e)?void 0:e.dockerfile,gitSource:e.gitSource,containerRepository:e.containerRepository,imageSource:e.imageSource}:{...X5,optionIds:[...X5.optionIds],selectedSkills:[...X5.selectedSkills]}}const fg=new Set(["preparing","queued","building","scanning"]),QJ=3e3,UP={preparing:"准备中",queued:"排队中",building:"构建中",scanning:"扫描中",available:"可用",failed:"构建失败"};function Qve(e){var n;const t=(n=e.latestVersion)==null?void 0:n.status;return t?t==="available"?{label:UP[t],color:"success"}:t==="failed"?{label:UP[t],color:"danger"}:{label:UP[t],color:"warning"}:{label:"未构建",color:"secondary"}}function Q_t(e){const t=Date.parse(e);return Number.isNaN(t)?e:new Intl.DateTimeFormat("zh-CN",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(t)}function U_t(e,t=Date.now()){const n=Date.parse(e.createdAt),i=fg.has(e.status)?t:Date.parse(e.updatedAt);if(Number.isNaN(n)||Number.isNaN(i))return"";const s=Math.max(0,Math.floor((i-n)/1e3));if(s<60)return`${s} 秒`;const a=Math.floor(s/60),l=s%60;return a<60?`${a} 分 ${l} 秒`:`${Math.floor(a/60)} 小时 ${a%60} 分`}function F_t({environment:e,onClose:t}){var v;const n=((v=e.latestVersion)==null?void 0:v.versionId)??"",r=p.useId(),i=p.useRef(null),s=p.useRef(t),[a,l]=p.useState(null),[c,u]=p.useState(!0),[d,f]=p.useState(""),[h,m]=p.useState(0),[g,b]=p.useState("idle"),y=p.useMemo(()=>a?S_t(a):"",[a]);s.current=t,p.useEffect(()=>{var E;const x=document.body.style.overflow,w=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(E=i.current)==null||E.focus();const S=k=>{if(k.key==="Escape"){k.preventDefault(),s.current();return}if(k.key!=="Tab"||!i.current)return;const _=Array.from(i.current.querySelectorAll('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])')).filter(A=>A.getClientRects().length>0);if(!_.length)return;const C=_[0],T=_[_.length-1];k.shiftKey&&document.activeElement===C?(k.preventDefault(),T.focus()):!k.shiftKey&&document.activeElement===T&&(k.preventDefault(),C.focus())};return window.addEventListener("keydown",S),()=>{document.body.style.overflow=x,window.removeEventListener("keydown",S),w!=null&&w.isConnected&&w.focus()}},[]),p.useEffect(()=>{const x=new AbortController;return u(!0),f(""),$oe(e.id,n,x.signal).then(l).catch(w=>{(w==null?void 0:w.name)!=="AbortError"&&f(w instanceof Error?w.message:String(w))}).finally(()=>{x.signal.aborted||u(!1)}),()=>x.abort()},[e.id,h,n]),p.useEffect(()=>{if(g!=="copied")return;const x=window.setTimeout(()=>b("idle"),1500);return()=>window.clearTimeout(x)},[g]);const O=async()=>{try{await navigator.clipboard.writeText(y),b("copied")}catch{b("error")}};return Cr.createPortal(o.jsx("div",{className:"environment-build-dialog__backdrop",onMouseDown:x=>{x.target===x.currentTarget&&t()},children:o.jsxs("section",{ref:i,className:"environment-build-dialog environment-manifest-dialog",role:"dialog","aria-modal":"true","aria-labelledby":r,"aria-busy":c||void 0,tabIndex:-1,children:[o.jsxs("header",{className:"environment-build-dialog__header",children:[o.jsxs("div",{children:[o.jsx("div",{className:"environment-build-dialog__title-row",children:o.jsx("h2",{id:r,children:"环境 Manifest"})}),o.jsxs("p",{children:[e.name," / ",n]})]}),o.jsx(Nt,{type:"button",color:"secondary",variant:"ghost",size:"sm",uniform:!0,onClick:t,"aria-label":"关闭环境 Manifest",children:o.jsx(Oa,{"aria-hidden":!0})})]}),o.jsx("div",{className:"environment-manifest-dialog__body",children:c?o.jsx("div",{className:"environment-manifest-dialog__state",role:"status",children:o.jsx(En,{as:"span",children:"正在加载 Manifest"})}):d?o.jsxs("div",{className:"environment-manifest-dialog__state is-error",role:"alert",children:[o.jsx("p",{children:d}),o.jsx(Nt,{type:"button",color:"secondary",variant:"soft",size:"sm",onClick:()=>m(x=>x+1),children:"重新加载"})]}):o.jsx("div",{className:"environment-manifest-dialog__editor","aria-label":"环境 Manifest YAML",children:o.jsx(mR,{value:y,path:"environment.yaml",readOnly:!0,onChange:()=>{}})})}),o.jsxs("footer",{className:"environment-build-dialog__actions",children:[g==="error"?o.jsx("span",{className:"environment-manifest-dialog__copy-error",role:"alert",children:"复制失败,请重试"}):null,o.jsx(Nt,{type:"button",color:"secondary",variant:"ghost",size:"sm",onClick:t,children:"关闭"}),o.jsx(Nt,{type:"button",color:"info",size:"sm",disabled:!y,onClick:()=>void O(),children:g==="copied"?"已复制":"复制 Manifest"})]})]})}),document.body)}function z_t({environment:e,onClose:t,onBuildUpdate:n,onRebuild:r}){var S,E;const i=e.latestVersion,[s,a]=p.useState(i),[l,c]=p.useState(!!i),[u,d]=p.useState(""),[f,h]=p.useState(Date.now()),[m,g]=p.useState(!1),b=p.useId(),y=p.useRef(null),O=p.useRef(t),v=p.useRef(n);p.useEffect(()=>{O.current=t,v.current=n},[n,t]),p.useEffect(()=>{var T;const k=document.body.style.overflow,_=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(T=y.current)==null||T.focus();const C=A=>{var M;if(A.key==="Escape"&&O.current(),A.key!=="Tab")return;const j=Array.from(((M=y.current)==null?void 0:M.querySelectorAll('button:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])'))??[]).filter(N=>N.getClientRects().length>0);if(!j.length)return;const L=j[0],I=j[j.length-1];A.shiftKey&&document.activeElement===L?(A.preventDefault(),I.focus()):!A.shiftKey&&document.activeElement===I&&(A.preventDefault(),L.focus())};return window.addEventListener("keydown",C),()=>{document.body.style.overflow=k,window.removeEventListener("keydown",C),_!=null&&_.isConnected&&_.focus()}},[]),p.useEffect(()=>{if(!i)return;let k=0;const _=new AbortController,C=async()=>{c(!0);try{const T=await Loe(e.id,i.versionId,{includeLogs:!0,signal:_.signal});a(T),d(""),v.current(T),fg.has(T.status)&&(k=window.setTimeout(C,QJ))}catch(T){if((T==null?void 0:T.name)==="AbortError")return;d(T instanceof Error?T.message:String(T)),k=window.setTimeout(C,QJ)}finally{_.signal.aborted||c(!1)}};return C(),()=>{_.abort(),window.clearTimeout(k)}},[e.id,i==null?void 0:i.versionId]),p.useEffect(()=>{if(!s||!fg.has(s.status))return;const k=window.setInterval(()=>h(Date.now()),1e3);return()=>window.clearInterval(k)},[s==null?void 0:s.status]);const x=s?Qve({...e,latestVersion:s}):{label:"未构建",color:"secondary"},w=e.imageSource||(E=(S=s==null?void 0:s.resources)==null?void 0:S.codePipeline)==null?void 0:E.consoleUrl;return Cr.createPortal(o.jsx("div",{className:"environment-build-dialog__backdrop",onMouseDown:k=>{k.target===k.currentTarget&&t()},children:o.jsxs("section",{ref:y,className:"environment-build-dialog",role:"dialog","aria-modal":"true","aria-labelledby":b,tabIndex:-1,children:[o.jsxs("header",{className:"environment-build-dialog__header",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"environment-build-dialog__title-row",children:[o.jsx("h2",{id:b,children:"构建详情"}),o.jsx(ta,{color:x.color,size:"sm",children:x.label})]}),o.jsx("p",{children:e.name})]}),o.jsx(Nt,{type:"button",color:"secondary",variant:"ghost",size:"sm",uniform:!0,onClick:t,"aria-label":"关闭构建详情",children:o.jsx(Oa,{"aria-hidden":!0})})]}),o.jsxs("div",{className:"environment-build-dialog__summary",children:[o.jsxs("div",{children:[o.jsx("span",{children:"当前步骤"}),o.jsx("strong",{children:(s==null?void 0:s.currentStep)||"等待构建信息"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"已用时"}),o.jsx("strong",{children:s?U_t(s,f):"-"})]}),s!=null&&s.sourceCommitSha?o.jsxs("div",{children:[o.jsx("span",{children:"源码提交"}),o.jsx("strong",{title:s.sourceCommitSha,children:s.sourceCommitSha.slice(0,12)})]}):null,w?o.jsxs("a",{href:w,target:"_blank",rel:"noreferrer",children:["在 CodePipeline 中查看 ",o.jsx(Dg,{"aria-hidden":!0})]}):null]}),o.jsxs("div",{className:"environment-build-dialog__body",children:[u?o.jsx("p",{className:"environment-build-dialog__error",role:"alert",children:u}):null,s!=null&&s.progressError?o.jsx("p",{className:"environment-build-dialog__notice",children:s.progressError}):null,o.jsx(n_t,{steps:(s==null?void 0:s.steps)??[],log:(s==null?void 0:s.logTail)??"",logError:s==null?void 0:s.logError,logTruncated:s==null?void 0:s.logTruncated,logUpdatedAt:s==null?void 0:s.logUpdatedAt,loading:l&&!!(s&&fg.has(s.status))}),(s==null?void 0:s.status)==="failed"&&s.error?o.jsx("p",{className:"environment-build-dialog__failure",role:"alert",children:s.error}):null]}),o.jsxs("footer",{className:"environment-build-dialog__actions",children:[o.jsx(Nt,{type:"button",color:"secondary",variant:"ghost",size:"sm",onClick:t,children:"关闭"}),s&&!e.imageSource&&!fg.has(s.status)?o.jsx(Nt,{type:"button",color:"info",size:"sm",disabled:m,onClick:()=>{g(!0),r().then(t).finally(()=>g(!1))},children:m?"正在启动":"重新构建"}):null]})]})}),document.body)}function Uve({cloudProvider:e,value:t,disabled:n,onChange:r}){const i=Sd(e);return o.jsxs("div",{className:"environment-source-field",children:[o.jsx("span",{className:"environment-source-field__label",children:"Region"}),o.jsx(Fs,{className:"environment-region-control",value:t,"aria-label":"镜像仓库 Region",disabled:n,onChange:s=>r(s),children:i.map(s=>o.jsx(Fs.Option,{value:s.value,children:s.label},s.value))})]})}function V_t({repositoryUrl:e,gitRef:t,dockerfilePath:n,inspection:r,inspectedKey:i,disabled:s,onRepositoryUrlChange:a,onGitRefChange:l,onDockerfilePathChange:c,onInspectionChange:u,onInspectedKeyChange:d}){const[f,h]=p.useState(!1),[m,g]=p.useState(""),b=p.useRef(null),y=p.useRef(""),O=`${e.trim()}\0${t.trim()}`,v=i===O;p.useEffect(()=>()=>{const E=b.current;b.current=null,E==null||E.abort()},[]);const x=()=>{var E;(E=b.current)==null||E.abort(),b.current=null,h(!1),g(""),u(null),d(""),c(""),y.current=""},w=p.useCallback(async()=>{var _;const E=H6(e);if(E){g(E);return}y.current=O,(_=b.current)==null||_.abort();const k=new AbortController;b.current=k,h(!0),g("");try{const C=await Aoe({repositoryUrl:e.trim(),...t.trim()?{ref:t.trim()}:{}},k.signal);if(b.current!==k)return;u(C),d(O),c(C.dockerfiles.length===1?C.dockerfiles[0]:"")}catch(C){if((C==null?void 0:C.name)==="AbortError")return;g(P_t(C)),u(null),d(""),c("")}finally{b.current===k&&(b.current=null,h(!1))}},[O,t,c,d,u,e]);p.useEffect(()=>{if(s||v||y.current===O||H6(e))return;const E=window.setTimeout(()=>void w(),600);return()=>window.clearTimeout(E)},[O,s,w,v,e]);const S=v?(r==null?void 0:r.dockerfiles)??[]:[];return o.jsxs("section",{className:"environment-source-section","aria-labelledby":"environment-git-source-title",children:[o.jsxs("div",{className:"environment-source-section__header",children:[o.jsx("h2",{id:"environment-git-source-title",children:"公开代码仓库"}),o.jsx("p",{children:"输入无需鉴权的 HTTPS Git 地址后,将自动探查并列出 Dockerfile。"})]}),o.jsxs("div",{className:"environment-source-fields environment-source-fields--git",children:[o.jsxs("label",{className:"environment-source-field environment-source-field--wide",children:[o.jsx("span",{className:"environment-source-field__label",children:"Git 地址"}),o.jsx(Li,{size:"lg",type:"url",value:e,placeholder:"https://github.com/owner/repository.git",autoComplete:"url",disabled:s,"aria-invalid":!!m,onChange:E=>{x(),a(E.currentTarget.value)}})]}),o.jsxs("label",{className:"environment-source-field",children:[o.jsx("span",{className:"environment-source-field__label",children:"Branch、Tag 或 Commit(可选)"}),o.jsx(Li,{size:"lg",value:t,placeholder:"默认分支",autoComplete:"off",disabled:s,onChange:E=>{x(),l(E.currentTarget.value)}})]})]}),o.jsxs("div",{className:"environment-inspection-status","aria-live":"polite",children:[f?o.jsx(En,{as:"span",children:"正在拉取仓库并查找 Dockerfile"}):null,m?o.jsxs("div",{className:"environment-source-error",role:"alert",children:[o.jsx("span",{children:m}),o.jsxs(Nt,{type:"button",color:"primary",size:"sm",pill:!1,disabled:s,onClick:()=>void w(),children:[o.jsx(CN,{}),"重试"]})]}):null,!f&&!m&&v&&r?S.length>0?o.jsx("span",{children:r.commitSha?`已在提交 ${r.commitSha.slice(0,12)} 中找到 ${S.length} 个 Dockerfile。`:"已载入保存的 Dockerfile,可重新探查仓库更新。"}):o.jsxs("div",{className:"environment-source-error",role:"alert",children:[o.jsx("span",{children:"仓库中未找到 Dockerfile,请检查分支或仓库内容。"}),o.jsx("button",{type:"button",disabled:s,onClick:()=>void w(),children:"重新探查"})]}):null]}),S.length>0?o.jsxs("label",{className:"environment-source-field environment-dockerfile-picker",children:[o.jsx("span",{className:"environment-source-field__label",children:"Dockerfile"}),o.jsx(HE,{ariaLabel:"选择 Dockerfile",value:n,valueLabel:n,placeholder:"请选择 Dockerfile",options:S.map(E=>({value:E,label:E})),disabled:s||f,onChange:c})]}):null]})}function H_t({cloudProvider:e,mode:t,region:n,value:r,disabled:i,onModeChange:s,onRegionChange:a,onChange:l}){return o.jsxs("section",{className:"environment-source-section","aria-labelledby":"environment-output-repository-title",children:[o.jsxs("div",{className:"environment-source-section__header",children:[o.jsx("h2",{id:"environment-output-repository-title",children:"构建输出"}),o.jsx("p",{children:"CodePipeline 会把构建完成的镜像推送到所选镜像仓库。"})]}),o.jsxs(Fs,{className:"environment-repository-mode",value:t,"aria-label":"构建输出镜像仓库",disabled:i,onChange:c=>s(c),children:[o.jsx(Fs.Option,{value:"managed",children:"Studio 默认镜像仓库"}),o.jsx(Fs.Option,{value:"existing",children:"已有镜像仓库"})]}),o.jsx(Uve,{cloudProvider:e,value:n,disabled:i,onChange:a}),t==="existing"?o.jsx(Pve,{region:n,value:r,disabled:i,onChange:l}):o.jsx("p",{className:"environment-source-note",children:"构建时自动创建或复用当前 Region 的 Studio 镜像仓库。"})]})}function q_t({cloudProvider:e,region:t,repository:n,reference:r,disabled:i,onRegionChange:s,onRepositoryChange:a,onReferenceChange:l}){const c=Bve(r);return o.jsxs("section",{className:"environment-source-section","aria-labelledby":"environment-image-source-title",children:[o.jsxs("div",{className:"environment-source-section__header",children:[o.jsx("h2",{id:"environment-image-source-title",children:"已有镜像"}),o.jsx("p",{children:"绑定已由外部流水线交付到 CR 的镜像,创建后不会触发 CodePipeline 构建。"})]}),o.jsx(Uve,{cloudProvider:e,value:t,disabled:i,onChange:s}),o.jsx(Pve,{region:t,value:n,disabled:i,onChange:a}),o.jsxs("label",{className:"environment-source-field environment-image-reference",children:[o.jsx("span",{className:"environment-source-field__label",children:"Tag 或 Digest"}),o.jsx(Li,{size:"lg",value:r,placeholder:"例如:latest 或 sha256:...",autoComplete:"off",disabled:i,"aria-invalid":!!c,onChange:u=>l(u.currentTarget.value)}),c?o.jsx("small",{className:"environment-source-field__error",role:"alert",children:c}):o.jsx("small",{children:"填写镜像 Tag,或以 sha256: 开头的完整 Digest。"})]})]})}function Fve(e,t,n,r){const i=p.useRef(n),s=p.useRef(r);i.current=n,s.current=r,p.useEffect(()=>{const a=document.body.style.overflow,l=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden";const c=window.requestAnimationFrame(()=>{var d;return(d=t.current)==null?void 0:d.focus()}),u=d=>{var g;if(d.key==="Escape"&&!s.current){d.preventDefault(),i.current();return}if(d.key!=="Tab")return;const f=Array.from(((g=e.current)==null?void 0:g.querySelectorAll('button:not([disabled]), textarea:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])'))??[]).filter(b=>b.getClientRects().length>0);if(!f.length)return;const h=f[0],m=f[f.length-1];d.shiftKey&&document.activeElement===h?(d.preventDefault(),m.focus()):!d.shiftKey&&document.activeElement===m&&(d.preventDefault(),h.focus())};return window.addEventListener("keydown",u),()=>{window.cancelAnimationFrame(c),document.body.style.overflow=a,window.removeEventListener("keydown",u),l!=null&&l.isConnected&&l.focus()}},[e,t])}function X_t({environment:e,onClose:t}){const n=p.useId(),r=p.useId(),i=p.useRef(null),s=p.useRef(null),[a,l]=p.useState(""),[c,u]=p.useState("loading"),[d,f]=p.useState(""),h=c==="loading";Fve(i,s,t,h);const m=async(g="",b)=>{u("loading"),f("");try{const y=g||(await Noe(e.id,b)).shareCode;l(y),await xoe(y),b!=null&&b.aborted||u("copied")}catch(y){if((y==null?void 0:y.name)==="AbortError")return;f(y instanceof Error?y.message:String(y)),u("error")}};return p.useEffect(()=>{const g=new AbortController;return m("",g.signal),()=>g.abort()},[e.id]),Cr.createPortal(o.jsx("div",{className:"environment-build-dialog__backdrop",onMouseDown:g=>{g.target===g.currentTarget&&!h&&t()},children:o.jsxs("section",{ref:i,className:"environment-share-dialog",role:"dialog","aria-modal":"true","aria-labelledby":n,"aria-describedby":r,"aria-busy":h||void 0,children:[o.jsxs("header",{className:"environment-build-dialog__header",children:[o.jsxs("div",{children:[o.jsx("h2",{id:n,children:"分享环境"}),o.jsx("p",{id:r,children:e.name})]}),o.jsx(Nt,{ref:s,type:"button",color:"secondary",variant:"ghost",size:"sm",uniform:!0,disabled:h,onClick:t,"aria-label":"关闭分享环境",children:o.jsx(Oa,{"aria-hidden":!0})})]}),o.jsx("div",{className:"environment-share-dialog__body",children:c==="loading"?o.jsx(En,{as:"p",children:"正在生成并复制分享码"}):o.jsxs("div",{className:"environment-share-dialog__result",children:[c==="copied"?o.jsx("p",{className:"environment-share-dialog__success",role:"status","aria-live":"polite",children:"分享码已复制"}):o.jsxs("div",{className:"environment-share-dialog__error",role:"alert",children:[o.jsx("strong",{children:"分享失败"}),o.jsx("span",{children:d})]}),a?o.jsxs("label",{className:"environment-share-dialog__field environment-share-dialog__manual-code",children:[o.jsx("span",{children:"分享码"}),o.jsx(pd,{size:"lg",rows:4,value:a,readOnly:!0,"aria-label":"完整环境分享码",onFocus:g=>g.currentTarget.select(),onClick:g=>g.currentTarget.select()}),o.jsx("small",{children:c==="copied"?"分享码已自动复制,也可在这里查看或手动复制。":"自动复制失败,可手动复制上方分享码,或重试。"})]}):null,o.jsx("p",{className:"environment-share-dialog__safety",children:"分享码可能包含环境配置与本地 Skill 内容,请仅发送给可信对象。"})]})}),o.jsxs("footer",{className:"environment-build-dialog__actions",children:[o.jsx(Nt,{type:"button",color:"secondary",variant:"ghost",size:"sm",disabled:h,onClick:t,children:"关闭"}),c==="error"?o.jsx(Nt,{type:"button",color:"info",size:"sm",onClick:()=>void m(a),children:"重试"}):c==="copied"?o.jsx(Nt,{type:"button",color:"info",size:"sm",onClick:()=>void m(a),children:"再次复制"}):null]})]})}),document.body)}function G_t({initialValue:e,autoInspect:t,onClose:n,onImported:r}){const i=p.useId(),s=p.useId(),a=p.useId(),l=p.useRef(null),c=p.useRef(null),u=p.useRef(!1),[d,f]=p.useState(e),[h,m]=p.useState("editing"),[g,b]=p.useState([]),[y,O]=p.useState(""),[v,x]=p.useState([]),w=p.useMemo(()=>b9(d),[d]),S=w.length>$ve,E=h==="inspecting"||h==="importing",k=g.filter(L=>L.status==="valid"),_=g.filter(L=>L.status==="invalid"),C=h==="ready"&&k.length>0;Fve(l,c,n,E);const T=p.useCallback(async()=>{if(!(!w.length||S)){m("inspecting"),O(""),x([]);try{const L=await joe(w);b([...L].sort((I,M)=>I.index-M.index)),m("ready")}catch(L){O(L instanceof Error?L.message:String(L)),m("editing")}}},[w,S]);p.useEffect(()=>{!t||u.current||(u.current=!0,T())},[t,T]);const A=async()=>{if(C){m("importing"),O(""),x([]);try{const L=k.map(z=>({code:w[z.index],name:z.name})).filter(z=>!!z.code),I=await Roe(L.map(z=>z.code)),M=I.filter(z=>z.status==="created").length,N=I.filter(z=>z.status==="duplicate").length,D=new Map(I.map(z=>[z.index,z])),Q=L.flatMap(({code:z,name:B},V)=>{const Z=D.get(V);return!Z||Z.status==="failed"?[{code:z,name:B,status:"valid",error:(Z==null?void 0:Z.error)||"服务未返回该分享码的导入结果。"}]:[]}),$=[..._.flatMap(z=>{const B=w[z.index];return B?[{code:B,name:"",status:"invalid",error:z.error||"分享码无效。"}]:[]}),...Q],H=new Map;if(I.forEach(z=>{z.environment&&H.set(z.environment.id,z.environment)}),r([...H.values()],M,N,$.length),!$.length){n();return}f($.map(z=>z.code).join(` -`)),x(Q),b($.map((z,B)=>({index:B,status:z.status,name:z.name,error:z.status==="invalid"?z.error:""}))),O(`已导入 ${M} 个环境,${$.length} 个未完成,可重试有效失败项。`),m("ready")}catch(L){O(L instanceof Error?L.message:String(L)),m("ready")}}},j=h==="inspecting"?"正在检测":h==="importing"?"正在导入":C?v.length?"重试导入":"确认导入":"检测分享码";return Cr.createPortal(o.jsx("div",{className:"environment-build-dialog__backdrop",onMouseDown:L=>{L.target===L.currentTarget&&!E&&n()},children:o.jsxs("section",{ref:l,className:"environment-share-dialog environment-import-dialog",role:"dialog","aria-modal":"true","aria-labelledby":i,"aria-describedby":s,"aria-busy":E||void 0,children:[o.jsxs("header",{className:"environment-build-dialog__header",children:[o.jsxs("div",{children:[o.jsx("h2",{id:i,children:"导入环境"}),o.jsx("p",{id:s,children:"先检测分享码中的环境,再确认添加到当前账号。"})]}),o.jsx(Nt,{type:"button",color:"secondary",variant:"ghost",size:"sm",uniform:!0,disabled:E,onClick:n,"aria-label":"关闭导入环境",children:o.jsx(Oa,{"aria-hidden":!0})})]}),o.jsxs("div",{className:"environment-share-dialog__body",children:[o.jsxs("label",{className:"environment-share-dialog__field",children:[o.jsx("span",{children:"环境分享码"}),o.jsx(pd,{ref:c,size:"lg",rows:6,value:d,disabled:E,"aria-invalid":S||_.length>0||void 0,"aria-describedby":a,placeholder:"例如:akenv://v1/...",onChange:L=>{f(L.currentTarget.value),m("editing"),b([]),O(""),x([])}})]}),o.jsx("p",{id:a,className:`environment-share-dialog__help${S?" is-error":""}`,children:S?`最多可一次导入 20 个环境,当前检测到 ${w.length} 个分享码。`:"多个分享码可使用英文逗号、中文逗号或换行分隔,重复项会自动忽略。"}),o.jsx("p",{className:"environment-share-dialog__safety",children:"分享码可能包含环境配置与本地 Skill 内容,请仅导入可信来源的分享码。"}),h==="inspecting"?o.jsx(En,{as:"p",children:"正在检测环境分享码"}):k.length?o.jsxs("p",{className:"environment-share-dialog__summary",role:"status","aria-live":"polite",children:["检测到 ",k.length," 个环境,名称分别是:",k.map(L=>L.name||"未命名环境").join("、"),"。"]}):null,_.length?o.jsx("ul",{className:"environment-share-dialog__failures",role:"alert",children:_.map(L=>o.jsxs("li",{children:["第 ",L.index+1," 个分享码:",L.error||"分享码无效。"]},L.index))}):null,v.length?o.jsx("ul",{className:"environment-share-dialog__failures",role:"alert",children:v.map((L,I)=>o.jsxs("li",{children:["第 ",I+1," 个分享码:",L.error]},`${L.code}:${I}`))}):null,y?o.jsx("p",{className:"environment-share-dialog__error-text",role:"alert",children:y}):null]}),o.jsxs("footer",{className:"environment-build-dialog__actions",children:[o.jsx(Nt,{type:"button",color:"secondary",variant:"ghost",size:"sm",disabled:E,onClick:n,children:"取消"}),o.jsx(Nt,{type:"button",color:"info",size:"sm",loading:E,disabled:E||!w.length||S||h==="ready"&&!C,onClick:()=>C?void A():void T(),children:j})]})]})}),document.body)}function W_t({environment:e,cloudProvider:t,onCancel:n,onDelete:r,onShare:i,onSave:s}){var Ve,We,ot,St,Vt,_t;const a=B_t(e),l=a.dockerfile!==void 0,[c,u]=p.useState(()=>({...a,dockerfile:l?void 0:a.dockerfile})),[d,f]=p.useState(a.gitSource?"git":a.imageSource?"image":l?"dockerfile":"custom"),[h,m]=p.useState("configuration"),[g,b]=p.useState(l?(e==null?void 0:e.dockerfile)??"":""),[y,O]=p.useState(l?"已保存的 Dockerfile":""),[v,x]=p.useState(""),[w,S]=p.useState(!1),[E,k]=p.useState(!1),[_,C]=p.useState(((Ve=a.gitSource)==null?void 0:Ve.repositoryUrl)??""),[T,A]=p.useState(((We=a.gitSource)==null?void 0:We.ref)??""),[j,L]=p.useState(((ot=a.gitSource)==null?void 0:ot.dockerfilePath)??""),[I,M]=p.useState(a.gitSource?{repositoryUrl:a.gitSource.repositoryUrl,ref:a.gitSource.ref??"",commitSha:"",dockerfiles:[a.gitSource.dockerfilePath]}:null),[N,D]=p.useState(a.gitSource?`${a.gitSource.repositoryUrl}\0${a.gitSource.ref??""}`:""),[Q,F]=p.useState(a.containerRepository?"existing":"managed"),[$,H]=p.useState(((St=a.containerRepository)==null?void 0:St.region)??Yr(t)),[z,B]=p.useState(a.containerRepository??void 0),[V,Z]=p.useState(((Vt=a.imageSource)==null?void 0:Vt.region)??Yr(t)),[ce,be]=p.useState(a.imageSource?{region:a.imageSource.region,registry:a.imageSource.registry,namespace:a.imageSource.namespace,repository:a.imageSource.repository}:void 0),[ie,q]=p.useState(((_t=a.imageSource)==null?void 0:_t.reference)??""),X=p.useRef(null),K=p.useRef(0),de=p.useMemo(()=>H7(c),[c.baseEnvironment,c.operatingSystem,c.language,c.optionIds]),xe=c.dockerfile??de,Me=!!e,Ae="environment-editor-form",[He,et]=p.useState(!1),[Te,Re]=p.useState(""),he=!!g.trim()&&!v,me=`${_.trim()}\0${T.trim()}`,Se=!H6(_)&&N===me&&!!j&&(Q==="managed"||BJ(z)),ke=BJ(ce)&&!!ie.trim()&&!Bve(ie),nt=!!c.name.trim()&&!He&&!w&&(d==="custom"||d==="dockerfile"&&he||d==="git"&&Se||d==="image"&&ke);p.useEffect(()=>()=>{K.current+=1},[]);const Qe=(Ne,$e)=>{u(mt=>({...mt,optionIds:$e?[...mt.optionIds,Ne]:mt.optionIds.filter(Ht=>Ht!==Ne)}))},re=async Ne=>{const $e=K.current+1;K.current=$e,S(!0),x("");try{const mt=await w_t(Ne);if(K.current!==$e)return;b(mt.content),O(Ne.name||"Dockerfile"),x(mt.error)}catch(mt){if(K.current!==$e)return;b(""),O(Ne.name||"Dockerfile"),x(`无法读取 Dockerfile:${mt instanceof Error?mt.message:String(mt)}`)}finally{K.current===$e&&S(!1),X.current&&(X.current.value="")}},ue=Ne=>{var mt;const $e=(mt=Ne.target.files)==null?void 0:mt[0];$e&&re($e)},Pe=Ne=>{if(Ne.preventDefault(),k(!1),He||w)return;if(Ne.dataTransfer.files.length!==1){x("请一次只上传一个 Dockerfile。");return}const $e=Ne.dataTransfer.files[0];$e&&re($e)},Ge=Ne=>{b(Ne),x(Ive(Ne))},W=()=>{K.current+=1,S(!1),b(""),O(""),x(""),X.current&&(X.current.value="")},_e=async Ne=>{if(Ne.preventDefault(),!!nt){et(!0),Re("");try{const $e=VHe(g);await s({...c,name:c.name.trim(),description:c.description.trim(),optionIds:d==="custom"?c.optionIds:[],selectedSkills:d==="custom"?c.selectedSkills:[],dockerfile:d==="dockerfile"?g:d==="custom"?xe:"",gitSource:d==="git"?{repositoryUrl:_.trim(),...T.trim()?{ref:T.trim()}:{},dockerfilePath:j}:null,containerRepository:d==="git"&&Q==="existing"?z:null,imageSource:d==="image"&&ce?{...ce,reference:ie.trim()}:null,...d==="dockerfile"?$e:{}})}catch($e){Re($e instanceof Error?$e.message:String($e)),et(!1)}}},rt=c.name.trim()||(Me?(e==null?void 0:e.name)||"配置环境":"新建环境");return o.jsx(ih,{className:"environment-editor","aria-label":Me?"环境详情":"新建环境",children:o.jsx(hE,{title:rt,description:"配置运行环境,或接入代码仓库和已有镜像",identitySeed:rt,backLabel:"返回环境列表",onBack:n,actions:o.jsxs(o.Fragment,{children:[r?o.jsx(Nt,{type:"button",color:"danger",variant:"ghost",size:"sm",onClick:r,disabled:He,children:"删除"}):null,i?o.jsx(Nt,{color:"secondary",variant:"soft",size:"sm",onClick:i,disabled:He,children:"分享"}):null,o.jsx(Nt,{color:"secondary",variant:"soft",size:"sm",onClick:n,disabled:He,children:"取消"}),o.jsx(Nt,{color:"info",size:"sm",type:"submit",form:Ae,disabled:!nt,children:He?"正在保存":d==="image"?Me?"保存环境":"创建环境":Me?"保存并构建":"创建并构建"})]}),children:o.jsxs("form",{id:Ae,className:"environment-form",onSubmit:_e,children:[o.jsxs("div",{className:"environment-fields",children:[o.jsxs("label",{className:"environment-field",children:[o.jsx("span",{children:"环境名称"}),o.jsx(Li,{className:"environment-text-input",type:"text",size:"lg",value:c.name,maxLength:60,placeholder:"例如:Python 数据处理",onChange:Ne=>u($e=>({...$e,name:Ne.target.value}))})]}),o.jsxs("label",{className:"environment-field",children:[o.jsx("span",{children:"描述"}),o.jsx(pd,{className:"environment-description-input",size:"lg",rows:3,value:c.description,maxLength:180,placeholder:"说明这个环境适合处理的任务",onChange:Ne=>u($e=>({...$e,description:Ne.target.value}))})]})]}),o.jsxs("fieldset",{className:"environment-creation-method",children:[o.jsx("legend",{children:"创建方式"}),o.jsxs(oa,{className:"environment-creation-options",value:d,"aria-label":"环境创建方式",onChange:Ne=>{f(Ne),Re("")},children:[o.jsxs(oa.Item,{value:"custom",block:!0,className:d==="custom"?"is-selected":"",children:[o.jsx("span",{className:"environment-creation-option__icon",children:o.jsx(aIe,{"aria-hidden":!0})}),o.jsxs("span",{className:"environment-creation-option__copy",children:[o.jsx("strong",{children:"自定义配置"}),o.jsx("span",{children:"选择基础环境、Python、工具和技能"})]})]}),o.jsxs(oa.Item,{value:"dockerfile",block:!0,className:d==="dockerfile"?"is-selected":"",children:[o.jsx("span",{className:"environment-creation-option__icon",children:o.jsx(OH,{"aria-hidden":!0})}),o.jsxs("span",{className:"environment-creation-option__copy",children:[o.jsx("strong",{children:"上传 Dockerfile"}),o.jsx("span",{children:"直接使用已有构建描述文件"})]})]}),o.jsxs(oa.Item,{value:"git",block:!0,className:d==="git"?"is-selected":"",children:[o.jsx("span",{className:"environment-creation-option__icon",children:o.jsx(R_t,{})}),o.jsxs("span",{className:"environment-creation-option__copy",children:[o.jsx("strong",{children:"从代码仓库构建"}),o.jsx("span",{children:"探查公开仓库并通过 CodePipeline 构建"})]})]}),o.jsxs(oa.Item,{value:"image",block:!0,className:d==="image"?"is-selected":"",children:[o.jsx("span",{className:"environment-creation-option__icon",children:o.jsx(I_t,{})}),o.jsxs("span",{className:"environment-creation-option__copy",children:[o.jsx("strong",{children:"使用已有镜像"}),o.jsx("span",{children:"绑定由外部流水线交付的 CR 镜像"})]})]})]})]}),Te?o.jsx("p",{className:"environment-form-error",role:"alert",children:Te}):null,d==="custom"?o.jsxs(o.Fragment,{children:[o.jsxs(Fs,{className:"environment-tabs",value:h,"aria-label":"自定义环境编辑内容",onChange:Ne=>m(Ne),children:[o.jsx(Fs.Option,{value:"configuration",children:"配置"}),o.jsx(Fs.Option,{value:"dockerfile",children:"描述文件"})]}),h==="configuration"?o.jsxs("div",{className:"environment-configuration",children:[o.jsxs("section",{className:"environment-section","aria-labelledby":"environment-base-title",children:[o.jsx("h2",{id:"environment-base-title",children:"基础环境"}),o.jsx(oa,{className:"environment-base-options","aria-label":"基础环境",value:c.baseEnvironment,onChange:Ne=>u($e=>({...$e,baseEnvironment:Ne,operatingSystem:Ne==="aio-sandbox"?"ubuntu-22.04":$e.operatingSystem,language:Ne==="aio-sandbox"?"python-3.12":$e.language})),children:bhe.map(Ne=>o.jsx(oa.Item,{value:Ne.id,block:!0,className:c.baseEnvironment===Ne.id?"is-selected":"",children:o.jsxs("span",{className:"environment-base-copy",children:[o.jsx("strong",{children:Ne.label}),o.jsx("span",{children:Ne.description})]})},Ne.id))}),c.baseEnvironment==="ubuntu"?o.jsx(oa,{className:"environment-os-version-options","aria-label":"Ubuntu 版本",value:c.operatingSystem,onChange:Ne=>u($e=>({...$e,operatingSystem:Ne})),children:VC.map(Ne=>o.jsx(oa.Item,{value:Ne.id,block:!0,className:c.operatingSystem===Ne.id?"is-selected":"",children:o.jsx("span",{className:"environment-language-copy",children:Ne.label})},Ne.id))}):null]}),o.jsxs("section",{className:"environment-section","aria-labelledby":"environment-language-title",children:[o.jsx("h2",{id:"environment-language-title",children:"语言"}),o.jsx(oa,{className:"environment-language-options","aria-label":"Python 版本",value:c.language,onChange:Ne=>u($e=>({...$e,language:Ne})),children:yhe.filter(Ne=>c.baseEnvironment!=="aio-sandbox"||Ne.id==="python-3.12").map(Ne=>o.jsx(oa.Item,{value:Ne.id,block:!0,className:c.language===Ne.id?"is-selected":"",children:o.jsx("span",{className:"environment-language-copy",children:Ne.label})},Ne.id))})]}),o.jsxs("section",{className:"environment-section","aria-labelledby":"environment-runtime-title",children:[o.jsx("h2",{id:"environment-runtime-title",children:"执行环境"}),o.jsx("div",{className:"environment-option-grid",children:o.jsx(MJ,{name:"VeADK",description:"Agent 开发与运行框架",selected:!0,disabled:!0,onChange:()=>{},icon:o.jsx("img",{src:nj,alt:""})})})]}),o.jsxs("section",{className:"environment-section","aria-labelledby":"environment-skills-title",children:[o.jsx("h2",{id:"environment-skills-title",children:"技能"}),o.jsx(hU,{selected:c.selectedSkills,onChange:Ne=>u($e=>({...$e,selectedSkills:Ne})),cloudProvider:t,disabled:He,addLabel:"添加环境技能"})]}),V7.map(Ne=>o.jsxs("section",{className:"environment-section","aria-labelledby":`environment-${Ne.id}-title`,children:[o.jsx("h2",{id:`environment-${Ne.id}-title`,children:Ne.label}),o.jsx("div",{className:"environment-option-grid",children:Ne.options.map($e=>{const mt=c.optionIds.includes($e.id);return o.jsx(MJ,{name:$e.label,description:$e.description,selected:mt,onChange:Ht=>Qe($e.id,Ht),icon:o.jsx($_t,{option:$e})},$e.id)})})]},Ne.id))]}):o.jsxs("section",{className:"environment-dockerfile","aria-labelledby":"environment-dockerfile-title",children:[o.jsxs("div",{className:"environment-dockerfile__header",children:[o.jsxs("div",{children:[o.jsx("h2",{id:"environment-dockerfile-title",children:"Dockerfile"}),o.jsx("p",{children:"可直接编辑;配置页中的软件变更不会覆盖自定义内容。"})]}),c.dockerfile!==void 0?o.jsx(Nt,{type:"button",color:"secondary",variant:"ghost",size:"sm",onClick:()=>u(Ne=>({...Ne,dockerfile:void 0})),children:"恢复生成内容"}):null]}),o.jsx(pd,{className:"environment-dockerfile__editor",value:xe,"aria-label":"Dockerfile 内容",spellCheck:!1,onChange:Ne=>u($e=>({...$e,dockerfile:Ne.target.value}))})]})]}):d==="dockerfile"?o.jsxs("section",{className:"environment-upload","aria-labelledby":"environment-upload-title",children:[o.jsxs("div",{className:"environment-upload__header",children:[o.jsxs("div",{children:[o.jsx("h2",{id:"environment-upload-title",children:"上传 Dockerfile"}),o.jsx("p",{id:"environment-upload-help",children:"支持任意文件名,文件上限 128 KiB。上传后可继续编辑内容。"})]}),g?o.jsx(Nt,{type:"button",color:"secondary",variant:"ghost",size:"sm",onClick:W,disabled:He,children:"移除文件"}):null]}),o.jsxs("div",{className:`environment-upload-dropzone${E?" is-dragging":""}${g?" is-ready":""}`,onDragEnter:Ne=>{Ne.preventDefault(),!He&&!w&&k(!0)},onDragOver:Ne=>Ne.preventDefault(),onDragLeave:Ne=>{Ne.currentTarget.contains(Ne.relatedTarget)||k(!1)},onDrop:Pe,children:[o.jsx("input",{ref:X,type:"file","aria-label":"Dockerfile 文件","aria-describedby":"environment-upload-help",disabled:He||w,onChange:ue}),o.jsx("span",{className:"environment-upload-dropzone__icon",children:o.jsx(OH,{"aria-hidden":!0})}),o.jsxs("span",{className:"environment-upload-dropzone__copy",children:[o.jsx("strong",{children:w?"正在读取 Dockerfile":y||"选择 Dockerfile 或拖拽到这里"}),o.jsx("span",{children:g?`${V6(g).toLocaleString("zh-CN")} 字节,点击可替换`:"Dockerfile 通常无扩展名"})]})]}),v?o.jsx("p",{className:"environment-upload__error",role:"alert",children:v}):null,g?o.jsxs("div",{className:"environment-upload__preview",children:[o.jsxs("div",{children:[o.jsx("h3",{children:"内容预览"}),o.jsxs("span",{children:[V6(g).toLocaleString("zh-CN")," / 131,072 字节"]})]}),o.jsx(pd,{className:"environment-dockerfile__editor environment-upload__editor",value:g,"aria-label":"上传的 Dockerfile 内容","aria-invalid":!!v,spellCheck:!1,onChange:Ne=>Ge(Ne.target.value)})]}):null]}):d==="git"?o.jsxs("div",{className:"environment-source-workflow",children:[o.jsx(V_t,{repositoryUrl:_,gitRef:T,dockerfilePath:j,inspection:I,inspectedKey:N,disabled:He,onRepositoryUrlChange:C,onGitRefChange:A,onDockerfilePathChange:L,onInspectionChange:M,onInspectedKeyChange:D}),o.jsx(H_t,{cloudProvider:t,mode:Q,region:$,value:z,disabled:He,onModeChange:Ne=>{F(Ne),Re("")},onRegionChange:Ne=>{H(Ne),B(void 0),Re("")},onChange:B})]}):o.jsx(q_t,{cloudProvider:t,region:V,repository:ce,reference:ie,disabled:He,onRegionChange:Ne=>{Z(Ne),be(void 0),Re("")},onRepositoryChange:be,onReferenceChange:q})]})})})}function zve({cloudProvider:e="volcengine",onWorkspace:t,clipboardImport:n=null,clipboardReadError:r=""}){const[i,s]=p.useState([]),[a,l]=p.useState({kind:"list"}),[c,u]=p.useState(""),[d,f]=p.useState(null),[h,m]=p.useState(null),[g,b]=p.useState(null),[y,O]=p.useState(null),[v,x]=p.useState(null),w=p.useRef(0),[S,E]=p.useState(""),[k,_]=p.useState(!1),[C,T]=p.useState(r),[A,j]=p.useState(!0),[L,I]=p.useState(""),[M,N]=p.useState(0),[D,Q]=p.useState(()=>new Set),F=p.useDeferredValue(c),$=p.useMemo(()=>{const q=F.trim().toLocaleLowerCase();return q?i.filter(X=>`${X.name} ${X.description} ${z4(X.operatingSystem)} ${$f(X.language)} ${zHe(X.baseEnvironment)}`.toLocaleLowerCase().includes(q)):i},[F,i]),H=p.useCallback((q="",X=!1)=>{w.current+=1,x({key:w.current,initialValue:q,autoInspect:X})},[]),z=p.useCallback((q,X=!1)=>{const K=q.trim();if(!K.startsWith("akenv://")||!X&&LJ.has(K))return!1;const de=b9(K);return!de.length||de.length>$ve?!1:(LJ.add(K),T(""),H(K,!0),!0)},[H]),B=p.useCallback(async()=>{var q;if(!(a.kind!=="list"||v)){if(typeof navigator>"u"||!((q=navigator.clipboard)!=null&&q.readText)){T(C_t);return}try{const X=await navigator.clipboard.readText();!z(X)&&!X.trim()&&await A_t()&&T($J)}catch{T($J)}}},[v,z,a.kind]);p.useEffect(()=>{const q=new AbortController;return i.length===0&&j(!0),I(""),GS(q.signal).then(X=>{s(X)}).catch(X=>{(X==null?void 0:X.name)!=="AbortError"&&I(X instanceof Error?X.message:String(X))}).finally(()=>{q.signal.aborted||j(!1)}),()=>q.abort()},[M]),p.useEffect(()=>{if(!i.some(X=>X.latestVersion&&fg.has(X.latestVersion.status)))return;const q=window.setTimeout(()=>N(X=>X+1),2500);return()=>window.clearTimeout(q)},[i]),p.useEffect(()=>{if(!S||k)return;const q=window.setTimeout(()=>E(""),2800);return()=>window.clearTimeout(q)},[k,S]),p.useEffect(()=>{r&&T(r)},[r]),p.useEffect(()=>{n&&z(n.text)},[n,z]),p.useEffect(()=>{if(a.kind!=="list")return;const q=()=>void B(),X=()=>{document.visibilityState==="visible"&&B()},K=de=>{var Ae;const xe=de.target;if(xe instanceof HTMLInputElement||xe instanceof HTMLTextAreaElement||xe instanceof HTMLElement&&xe.isContentEditable)return;const Me=((Ae=de.clipboardData)==null?void 0:Ae.getData("text/plain"))??"";z(Me,!0)&&de.preventDefault()};return window.addEventListener("focus",q),document.addEventListener("visibilitychange",X),window.addEventListener("paste",K),()=>{window.removeEventListener("focus",q),document.removeEventListener("visibilitychange",X),window.removeEventListener("paste",K)}},[z,B,a.kind]);const V=a.kind==="editor"&&a.environmentId?i.find(q=>q.id===a.environmentId):void 0,Z=async q=>{const X={...q,dockerfile:q.dockerfile??H7(q)},K=V?await Poe(V.id,X):await Doe(X);if(s(de=>[K,...de.filter(xe=>xe.id!==K.id)]),l({kind:"list"}),_(!1),X.imageSource){E(`环境“${K.name}”已绑定已有镜像`);return}try{const de=await qM(K.id);s(xe=>xe.map(Me=>Me.id===K.id?{...Me,latestVersion:de}:Me)),E(`环境“${K.name}”已进入构建队列`)}catch(de){_(!0),E(`环境已保存,但构建未启动:${de instanceof Error?de.message:String(de)}`)}},ce=async q=>{if(!D.has(q.id)){Q(X=>new Set(X).add(q.id)),_(!1);try{const X=await qM(q.id);s(K=>K.map(de=>de.id===q.id?{...de,latestVersion:X}:de)),E(`环境“${q.name}”已进入构建队列`)}catch(X){_(!0),E(X instanceof Error?X.message:String(X))}finally{Q(X=>{const K=new Set(X);return K.delete(q.id),K})}}},be=(q,X,K,de)=>{q.length&&s(xe=>{const Me=new Set(q.map(Ae=>Ae.id));return[...q,...xe.filter(Ae=>!Me.has(Ae.id))]}),_(de>0),E(de>0?`已导入 ${X} 个环境,${de} 个失败`:K>0?`已导入 ${X} 个环境,${K} 个分享码已存在`:`已导入 ${X} 个环境`)},ie=d?o.jsx(zl,{title:"删除环境",description:`确定删除环境“${d.name}”吗?删除后无法恢复。`,confirmLabel:"删除",variant:"danger",onCancel:()=>f(null),onConfirm:()=>{const q=d;f(null),l({kind:"list"}),Moe(q.id).then(()=>{s(X=>X.filter(K=>K.id!==q.id)),_(!1),E(`已删除环境“${q.name}”`)}).catch(X=>{_(!0),E(X instanceof Error?X.message:String(X))})}}):null;return a.kind==="editor"?o.jsxs(o.Fragment,{children:[o.jsx(W_t,{environment:V,cloudProvider:e,onCancel:()=>l({kind:"list"}),onDelete:V?()=>f(V):void 0,onShare:V?()=>O(V):void 0,onSave:Z},a.environmentId??"new"),y?o.jsx(X_t,{environment:y,onClose:()=>O(null)}):null,ie]}):o.jsxs(ih,{className:"environment-center","aria-label":"环境",children:[o.jsx(sO,{title:"环境"}),o.jsxs(g0,{className:"environment-toolbar",children:[t?o.jsx(pE,{items:[{id:"workspaces",label:"工作区"},{id:"environments",label:"环境"}],value:"environments",onChange:q=>{q==="workspaces"&&t()},ariaLabel:"工作区资源类型",idPrefix:"environment-center"}):null,o.jsxs("div",{className:"resource-toolbar__actions",children:[S?o.jsx("span",{className:`environment-status${k?" is-error":""}`,role:k?"alert":"status","aria-live":"polite",children:S}):null,o.jsx(Gp,{"aria-label":"搜索环境",value:c,onChange:q=>u(q.target.value),placeholder:"搜索环境"})]})]}),C?o.jsxs("div",{className:"environment-clipboard-notice",role:"alert",children:[o.jsx("span",{children:C}),o.jsx(Nt,{type:"button",color:"secondary",variant:"soft",size:"sm",onClick:()=>{T(""),H()},children:"手动导入"})]}):null,o.jsx(b0,{"aria-live":"polite",children:A?o.jsx(bd,{}):L?o.jsxs("div",{className:"environment-load-error",role:"alert",children:[o.jsx("p",{children:L}),o.jsx(Nt,{color:"secondary",variant:"soft",size:"sm",onClick:()=>N(q=>q+1),children:"重新加载"})]}):$.length===0&&c.trim()?o.jsx("div",{className:"environment-empty",children:o.jsxs(xn,{fill:"none",children:[o.jsx(xn.Icon,{children:o.jsx(M_t,{})}),o.jsx(xn.Title,{children:"没有匹配的环境"}),o.jsx(xn.Description,{children:"请尝试搜索其他名称"})]})}):o.jsxs(aO,{children:[c.trim()?null:o.jsxs(o.Fragment,{children:[o.jsx(Vg,{"aria-label":"新建环境",icon:o.jsx(j_t,{}),onClick:()=>l({kind:"editor",environmentId:null}),children:"新建环境"}),o.jsx(Vg,{"aria-label":"导入环境",icon:o.jsx(D_t,{}),onClick:()=>H(),children:"导入环境"})]}),$.map(q=>{var xe,Me;const X=Qve(q),K=!!(q.latestVersion&&fg.has(q.latestVersion.status)),de=D.has(q.id);return o.jsx(bE,{className:"environment-card",title:q.name,status:o.jsx(ta,{color:X.color,size:"sm",children:X.label}),description:((xe=q.latestVersion)==null?void 0:xe.error)||(K?(Me=q.latestVersion)==null?void 0:Me.currentStep:"")||q.description||"暂无描述",metadata:[{label:"更新",value:Q_t(q.updatedAt)}],action:{label:q.latestVersion?"构建详情":de?"正在启动":"开始构建",icon:"play",title:"构建",disabled:de,onClick:()=>q.latestVersion?m(q.id):void ce(q)},auxiliaryAction:{label:"查看环境 Manifest",icon:o.jsx(gRe,{}),title:q.latestVersion?"查看 Manifest":"尚无可用 Manifest",disabled:!q.latestVersion,onClick:()=>b(q)},detailAction:{label:"配置",onClick:()=>l({kind:"editor",environmentId:q.id})}},q.id)})]})}),h?(()=>{const q=i.find(X=>X.id===h);return q?o.jsx(z_t,{environment:q,onClose:()=>m(null),onBuildUpdate:X=>{s(K=>K.map(de=>de.id===q.id?{...de,latestVersion:X}:de))},onRebuild:()=>ce(q)}):null})():null,g!=null&&g.latestVersion?o.jsx(F_t,{environment:g,onClose:()=>b(null)}):null,ie,v?o.jsx(G_t,{initialValue:v.initialValue,autoInspect:v.autoInspect,onClose:()=>x(null),onImported:be},v.key):null]})}function Y_t(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"M8 3.25v9.5M3.25 8h9.5"})})}function Z_t(e){return o.jsxs("svg",{viewBox:"0 0 32 32",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"4.5",y:"7",width:"23",height:"18",rx:"3"}),o.jsx("path",{d:"M10 7V5.5A1.5 1.5 0 0 1 11.5 4h4A1.5 1.5 0 0 1 17 5.5V7M9 13h5v5H9zM18 13h5M18 17h5M9 22h14"})]})}function q6(e){const t=Date.parse(e);return Number.isNaN(t)?e:new Intl.DateTimeFormat("zh-CN",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(t)}function K_t(e,t){return e.environmentIds.reduce((n,r)=>{var i,s;return((s=(i=t.get(r))==null?void 0:i.latestVersion)==null?void 0:s.status)==="available"?n+1:n},0)}function J_t({workspace:e,environments:t,onBack:n,onSave:r,onDelete:i}){const[s,a]=p.useState((e==null?void 0:e.name)??""),[l,c]=p.useState((e==null?void 0:e.description)??""),[u,d]=p.useState((e==null?void 0:e.environmentIds)??[]),[f,h]=p.useState(""),[m,g]=p.useState(!1),[b,y]=p.useState(""),O=f.trim().toLocaleLowerCase(),v=t.filter(w=>`${w.name} ${w.description} ${$f(w.language)}`.toLocaleLowerCase().includes(O)),x=async w=>{if(w.preventDefault(),!(!s.trim()||m)){g(!0),y("");try{await r({name:s.trim(),description:l.trim(),environmentIds:u})}catch(S){y(S instanceof Error?S.message:String(S)),g(!1)}}};return o.jsx(ih,{className:"workspace-center","aria-label":e?"工作区详情":"新建工作区",children:o.jsxs(hE,{title:e?e.name:"新建工作区",description:"将常用环境组合在一起;同一个环境可以加入多个工作区。",identitySeed:(e==null?void 0:e.name)||"新建工作区",backLabel:"返回工作区列表",onBack:n,actions:o.jsxs(o.Fragment,{children:[i?o.jsx("button",{type:"button",className:"is-danger",onClick:i,children:"删除"}):null,o.jsx("button",{type:"submit",form:"workspace-form",disabled:m||!s.trim(),children:m?"保存中":"保存"})]}),children:[e?o.jsxs(G7,{children:[o.jsxs("div",{children:[o.jsx("dt",{children:"环境"}),o.jsxs("dd",{children:[u.length," 个"]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"创建时间"}),o.jsx("dd",{children:q6(e.createdAt)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"最近更新"}),o.jsx("dd",{children:q6(e.updatedAt)})]})]}):null,o.jsxs("form",{id:"workspace-form",className:"workspace-form",onSubmit:x,children:[o.jsxs("section",{className:"workspace-fields","aria-label":"基本信息",children:[o.jsxs("label",{children:[o.jsx("span",{children:"名称"}),o.jsx(Li,{value:s,maxLength:128,autoFocus:!0,onChange:w=>a(w.target.value),placeholder:"例如:内容生产"})]}),o.jsxs("label",{children:[o.jsx("span",{children:"描述"}),o.jsx(pd,{value:l,maxLength:2e3,onChange:w=>c(w.target.value),placeholder:"说明这个工作区的用途"})]})]}),o.jsxs("section",{className:"workspace-environments",children:[o.jsx(Qhe,{title:"环境",description:`已选择 ${u.length} 个,可在其他工作区中继续复用`,actions:o.jsx(Gp,{"aria-label":"搜索可用环境",value:f,onChange:w=>h(w.target.value),placeholder:"搜索环境"})}),t.length===0?o.jsxs("div",{className:"workspace-environment-empty",children:[o.jsx("p",{children:"还没有可添加的环境"}),o.jsx("span",{children:"请先在“环境”页面创建并构建环境。"})]}):v.length===0?o.jsxs("div",{className:"workspace-environment-empty",children:[o.jsx("p",{children:"没有匹配的环境"}),o.jsx("span",{children:"请尝试搜索其他名称。"})]}):o.jsx("div",{className:"workspace-environment-list",children:v.map(w=>{var k;const S=u.includes(w.id),E=((k=w.latestVersion)==null?void 0:k.status)==="available"?"可用":w.latestVersion?"构建中":"未构建";return o.jsxs("label",{className:`workspace-environment-option${S?" is-selected":""}`,children:[o.jsx("input",{type:"checkbox",checked:S,onChange:()=>d(_=>S?_.filter(C=>C!==w.id):[..._,w.id])}),o.jsxs("span",{className:"workspace-environment-option__copy",children:[o.jsx("strong",{title:w.name,children:w.name}),o.jsxs("span",{children:[$f(w.language)," · ",E]})]}),o.jsx("span",{className:"workspace-environment-option__action",children:S?"已添加":"添加"})]},w.id)})})]}),b?o.jsx("p",{className:"workspace-form-error",role:"alert",children:b}):null]})]})})}function eTt({onEnvironment:e}){const[t,n]=p.useState([]),[r,i]=p.useState([]),[s,a]=p.useState({kind:"list"}),[l,c]=p.useState(""),[u,d]=p.useState(!0),[f,h]=p.useState(""),[m,g]=p.useState(""),[b,y]=p.useState(!1),[O,v]=p.useState(null),[x,w]=p.useState(0),S=p.useDeferredValue(l);p.useEffect(()=>{const C=new AbortController;return d(!0),h(""),Promise.all([x9(C.signal),GS(C.signal)]).then(([T,A])=>{n(T),i(A)}).catch(T=>{(T==null?void 0:T.name)!=="AbortError"&&h(T instanceof Error?T.message:String(T))}).finally(()=>{C.signal.aborted||d(!1)}),()=>C.abort()},[x]),p.useEffect(()=>{if(!m||b)return;const C=window.setTimeout(()=>g(""),2800);return()=>window.clearTimeout(C)},[b,m]);const E=p.useMemo(()=>new Map(r.map(C=>[C.id,C])),[r]),k=p.useMemo(()=>{const C=S.trim().toLocaleLowerCase();return C?t.filter(T=>{const A=T.environmentIds.map(j=>{var L;return((L=E.get(j))==null?void 0:L.name)??""}).join(" ");return`${T.name} ${T.description} ${A}`.toLocaleLowerCase().includes(C)}):t},[S,E,t]),_=s.kind==="detail"&&s.workspaceId?t.find(C=>C.id===s.workspaceId):void 0;return s.kind==="detail"?o.jsx(J_t,{workspace:_,environments:r,onBack:()=>a({kind:"list"}),onDelete:_?()=>v(_):null,onSave:async C=>{const T=_?await Toe(_.id,C):await _oe(C);n(A=>[T,...A.filter(j=>j.id!==T.id)]),y(!1),g(`已保存工作区“${T.name}”`),a({kind:"list"})}},s.workspaceId??"new"):o.jsxs(ih,{className:"workspace-center","aria-label":"工作区",children:[o.jsx(sO,{title:"工作区"}),o.jsxs(g0,{children:[o.jsx(pE,{items:[{id:"workspaces",label:"工作区"},{id:"environments",label:"环境"}],value:"workspaces",onChange:C=>{C==="environments"&&e()},ariaLabel:"工作区资源类型",idPrefix:"workspace-center"}),o.jsxs("div",{className:"resource-toolbar__actions",children:[m?o.jsx("span",{className:`workspace-status${b?" is-error":""}`,role:b?"alert":"status","aria-live":"polite",children:m}):null,o.jsx(Gp,{"aria-label":"搜索工作区",value:l,onChange:C=>c(C.target.value),placeholder:"搜索工作区"})]})]}),o.jsx(b0,{"aria-live":"polite",children:u?o.jsx(bd,{}):f?o.jsxs("div",{className:"workspace-load-error",role:"alert",children:[o.jsx("p",{children:f}),o.jsx(Nt,{color:"secondary",variant:"soft",size:"sm",onClick:()=>w(C=>C+1),children:"重新加载"})]}):k.length===0&&l.trim()?o.jsx("div",{className:"workspace-empty",children:o.jsxs(xn,{fill:"none",children:[o.jsx(xn.Icon,{children:o.jsx(Z_t,{})}),o.jsx(xn.Title,{children:"没有匹配的工作区"}),o.jsx(xn.Description,{children:"请尝试搜索其他名称或环境"})]})}):o.jsxs(aO,{children:[l.trim()?null:o.jsx(Vg,{"aria-label":"新建工作区",icon:o.jsx(Y_t,{}),onClick:()=>a({kind:"detail",workspaceId:null}),children:"新建工作区"}),k.map(C=>{const T=K_t(C,E),A=C.environmentIds.filter(j=>!E.has(j)).length;return o.jsx(bE,{className:"workspace-card",title:C.name,status:o.jsx(ta,{color:A?"danger":T===C.environmentIds.length&&T>0?"success":"secondary",size:"sm",children:C.environmentIds.length===0?"未添加环境":A?"环境缺失":`${T}/${C.environmentIds.length} 可用`}),description:C.description||"暂无描述",metadata:[{label:"环境",value:`${C.environmentIds.length} 个环境`},{label:"可用",value:`${T} 个可用`},{label:"更新",value:q6(C.updatedAt)}],detailAction:{label:"管理",onClick:()=>a({kind:"detail",workspaceId:C.id})},action:{label:"添加环境",icon:"plus",onClick:()=>a({kind:"detail",workspaceId:C.id})}},C.id)})]})}),O?o.jsx(zl,{title:"删除工作区",description:`确定删除工作区“${O.name}”吗?环境本身不会被删除。`,confirmLabel:"删除",variant:"danger",onCancel:()=>v(null),onConfirm:()=>{const C=O;v(null),Coe(C.id).then(()=>{n(T=>T.filter(A=>A.id!==C.id)),y(!1),g(`已删除工作区“${C.name}”`),a({kind:"list"})}).catch(T=>{y(!0),g(T instanceof Error?T.message:String(T))})}}):null]})}function tTt({cloudProvider:e}){const[t,n]=p.useState("workspaces"),[r,i]=p.useState(null),[s,a]=p.useState(""),l=p.useRef(0),c=()=>{var f;l.current+=1;const u=l.current;a("");let d=null;if(typeof navigator<"u"&&((f=navigator.clipboard)!=null&&f.readText))try{d=navigator.clipboard.readText()}catch{a("未能读取剪贴板。请允许剪贴板权限,或点击“导入环境”后手动粘贴分享码。")}else a("当前浏览器无法自动读取剪贴板;请点击“导入环境”后手动粘贴分享码。");n("environments"),d&&d.then(async h=>{var m;if(l.current===u){if(h.trim()){i({key:u,text:h});return}try{const g=await((m=navigator.permissions)==null?void 0:m.query({name:"clipboard-read"}));l.current===u&&(g==null?void 0:g.state)==="denied"&&a("未能读取剪贴板。请允许剪贴板权限,或点击“导入环境”后手动粘贴分享码。")}catch{}}}).catch(()=>{l.current===u&&a("未能读取剪贴板。请允许剪贴板权限,或点击“导入环境”后手动粘贴分享码。")})};return t==="environments"?o.jsx(zve,{cloudProvider:e,onWorkspace:()=>n("workspaces"),clipboardImport:r,clipboardReadError:s}):o.jsx(eTt,{onEnvironment:c})}function nTt(e){return e==="127.0.0.1"}const rTt={id:"coding-agents",kind:"coding-agent",category:"development",icon:"coding-agents",name:"配置 Coding Agents",badge:"本地",badgeTone:"success",description:"将 VeADK 和 AgentKit 内置 Skills 全局配置到 Trae、Claude Code 或 Codex。"},iTt={id:"feishu",kind:"feishu",category:"channels",icon:"feishu",name:"飞书机器人",badge:"Beta",description:"创建飞书机器人,并将消息直接接入 AgentKit Runtime。"},sTt="https://api.github.com",aTt=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/,UJ=/^[A-Za-z0-9][A-Za-z0-9._/-]{0,199}$/,oTt=/^[A-Za-z0-9._/-]+$/;function lTt(e,t,n){return e===401||e===403?"GitHub Token 无效或没有仓库写入权限":e===404?"仓库、分支或文件不存在,或 Token 无权访问":e===422?"GitHub 拒绝了提交,请检查分支和文件状态":String((t==null?void 0:t.message)||"").split(n).join("***").trim().slice(0,240)||`GitHub 请求失败(HTTP ${e})`}async function Dm(e,t){const n={Accept:"application/vnd.github+json",Authorization:`Bearer ${t.token}`,"X-GitHub-Api-Version":"2022-11-28"};t.body&&(n["Content-Type"]="application/json");let r;try{r=await fetch(`${sTt}${e}`,{method:t.method||"GET",headers:n,body:t.body?JSON.stringify(t.body):void 0,signal:t.signal})}catch(s){throw t.signal.aborted?s:new Error("连接 GitHub 失败,请检查网络后重试")}const i=await r.json().catch(()=>null);if(!t.expected.includes(r.status))throw new Error(lTt(r.status,i,t.token));return{status:r.status,payload:i}}function FP(e){return e.split("/").map(encodeURIComponent).join("/")}function cTt(e){const t=new TextEncoder().encode(e);let n="";const r=32768;for(let i=0;i({...h,path:pU(h.path,"")})),s=AbortSignal.any([t,AbortSignal.timeout(6e4)]),a=`/repos/${n}`;await Dm(`${a}`,{token:e.token,expected:[200],signal:s});const c=(f=(await Dm(`${a}/git/ref/heads/${FP(r)}`,{token:e.token,expected:[200],signal:s})).payload.object)==null?void 0:f.sha;if(!c)throw new Error("目标分支缺少有效 Git SHA");const u=uTt(e.branchPrefix);await Dm(`${a}/git/refs`,{token:e.token,expected:[201],signal:s,method:"POST",body:{ref:`refs/heads/${u}`,sha:c}});let d=!0;try{for(const m of i){const g=FP(m.path),b=await Dm(`${a}/contents/${g}?ref=${encodeURIComponent(r)}`,{token:e.token,expected:[200,404],signal:s});if(m.mustBeNew&&b.status===200)throw new Error(`目标仓库中已存在 ${m.path},未覆盖现有文件`);if(b.status===200&&!b.payload.sha)throw new Error(`目标路径 ${m.path} 不是可更新的文件`);await Dm(`${a}/contents/${g}`,{token:e.token,expected:[200,201],signal:s,method:"PUT",body:{message:m.commitMessage,content:cTt(m.content),branch:u,...b.payload.sha?{sha:b.payload.sha}:{}}})}const h=await Dm(`${a}/pulls`,{token:e.token,expected:[201],signal:s,method:"POST",body:{title:e.title,head:u,base:r,body:e.description}});if(!h.payload.number||!h.payload.html_url)throw new Error("GitHub 未返回有效的 Pull Request");return d=!1,{number:h.payload.number,url:h.payload.html_url,branch:u}}finally{d&&await Dm(`${a}/git/refs/heads/${FP(u)}`,{token:e.token,expected:[204],signal:AbortSignal.timeout(15e3),method:"DELETE"}).catch(()=>{})}}const gU={name:"repository",label:"GitHub Repo",placeholder:"owner/repository",help:"支持 owner/repository 或完整 github.com URL",required:!0},bU={name:"baseBranch",label:"目标分支",placeholder:"main",help:"留空时使用 main,PR 将以此分支为 base",required:!1},Hve={name:"runtimeName",label:"Runtime 名称",placeholder:"support-agent",help:"用于 AgentKit 发布配置",required:!0},qve={name:"runtimeId",label:"Runtime ID",placeholder:"rt-xxxxxxxx",help:"持续更新的目标 AgentKit Runtime",required:!0},dTt="https://ark.cn-beijing.volces.com/api/coding/v3";function fTt(e){return e==="byteplus"?el(e):dTt}function vR(e){return e==="byteplus"?{accessKey:"BYTEPLUS_ACCESS_KEY",secretKey:"BYTEPLUS_SECRET_KEY",sessionToken:"BYTEPLUS_SESSION_TOKEN"}:{accessKey:"VOLCENGINE_ACCESS_KEY",secretKey:"VOLCENGINE_SECRET_KEY",sessionToken:"VOLCENGINE_SESSION_TOKEN"}}function yU(e){const t=vR(e);return[`${t.accessKey}、${t.secretKey}(必填)`,`${t.sessionToken}(使用临时凭据时必填)`]}function OU(e){return e==="byteplus"?"BytePlus":"Volcengine"}function xU(e,t={}){return{repository:"",baseBranch:"main",projectPath:".",runtimeName:"",runtimeId:"",sandboxToolId:"",modelName:"",modelBaseUrl:fTt(e),region:Yr(e),token:"",...t}}function vU(e){return{repository:e.repository.trim(),baseBranch:e.baseBranch.trim()||"main",region:e.region,token:e.token.trim()}}const hTt=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/,pTt=/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/;function mTt(e){if(!hTt.test(e.sandboxToolId))throw new Error("Sandbox Tool ID 格式不正确");if(!pTt.test(e.modelName))throw new Error("模型名称格式不正确");let t;try{t=new URL(e.modelBaseUrl)}catch{throw new Error("模型 API 地址必须是安全的 HTTPS URL")}if(t.protocol!=="https:"||!t.hostname||t.username||t.password||t.search||t.hash)throw new Error("模型 API 地址必须是安全的 HTTPS URL")}function gTt(e){mTt(e);const t=e.cloudProvider??"volcengine",n=vR(t),r=t==="byteplus"?` +`);if(!t.length||t[0].trim()!=="---")return{name:"",description:""};let n=-1;for(let i=1;i=2&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))}function s_t(...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 a_t(e,t){return t.trim()||e}function Cve(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(i=>({path:i.path.slice(r.length),text:i.text}))}return t}function o_t(e){const t=new Map,n=new Set;for(const r of e)if(z6.test("/"+r.path)){const i=r.path.split("/");n.add(i.slice(0,-1).join("/"))}for(const r of e){const i=r.path.split("/");let s="";for(let u=i.length-1;u>=0;u--){const d=i.slice(0,u).join("/");if(n.has(d)){s=d;break}}const a=z6.test("/"+r.path);if(!s&&!a&&!n.has("")||!n.has(s)&&!a)continue;const l=s?r.path.slice(s.length+1):r.path,c=t.get(s)||[];c.push({path:l,text:r.text}),t.set(s,c)}return t}function l_t(e,t,n){const r=`${n}${e?"/"+e:""}`,i=t.find(c=>z6.test("/"+c.path));if(!i)return{hit:null,error:`${r} 缺少 SKILL.md`};const s=r_t(i.text),a=s_t(s.name,e,n.replace(/\.[^.]+$/,"")),l=[];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}`};l.push({path:d,content:c.text})}return{hit:{source:"local",id:`local:${a}:${t.length}`,name:a_t(a,s.name),description:s.description||"本地 Skill",folder:a,localFiles:l},error:null}}async function c_t(e){const t=new Uint8Array(await e.arrayBuffer()),r=(await Tve(t)).map(i=>({path:i.name,text:i.text}));return Ave(Cve(r),e.name)}async function u_t(e,t=new Map){const n=[];for(let r=0;re.file(t,n))}async function f_t(e){const t=e.createReader(),n=[];for(;;){const r=await new Promise((i,s)=>t.readEntries(i,s));if(r.length===0)return n;n.push(...r)}}async function Nve(e,t=""){const n=t?`${t}/${e.name}`:e.name;if(e.isFile)return[{file:await d_t(e),path:n}];if(!e.isDirectory)return[];const r=await f_t(e);return(await Promise.all(r.map(i=>Nve(i,n)))).flat()}function h_t({selected:e,onChange:t}){const[n,r]=p.useState([]),[i,s]=p.useState([]),[a,l]=p.useState(!1),[c,u]=p.useState(!1),d=p.useRef(0),f=x=>e.some(w=>w.source==="local"&&w.folder===x),h=x=>{x.localFiles&&(f(x.folder||x.name)?t(e.filter(w=>!(w.source==="local"&&w.folder===(x.folder||x.name)))):t([...e,{source:"local",folder:x.folder||x.name,name:x.name,description:x.description,localFiles:x.localFiles}]))},m=p.useRef([]),g=p.useRef(e);p.useEffect(()=>{m.current=i},[i]),p.useEffect(()=>{g.current=e},[e]);const b=x=>{const w=new Set([...m.current.map(_=>_.folder||_.name),...g.current.filter(_=>_.source==="local").map(_=>_.folder)]),S=[],E=[];for(const _ of x.hits){const T=_.folder||_.name;if(w.has(T)){S.push(_.name);continue}w.add(T),E.push(_)}s(_=>[..._,...E]);const k=[...x.errors];if(S.length>0&&k.push(`已跳过重复技能:${S.join("、")}`),r(k),E.length===1&&x.errors.length===0&&S.length===0){const _=E[0];_.localFiles&&t([...g.current,{source:"local",folder:_.folder||_.name,name:_.name,description:_.description,localFiles:_.localFiles}])}},y=x=>{x.preventDefault(),d.current+=1,u(!0)},O=x=>{x.preventDefault(),d.current=Math.max(0,d.current-1),d.current===0&&u(!1)},v=async x=>{if(x.preventDefault(),d.current=0,u(!1),a)return;const w=Array.from(x.dataTransfer.items).map(S=>{var E;return(E=S.webkitGetAsEntry)==null?void 0:E.call(S)}).filter(S=>S!==null);if(w.length===0){r(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}l(!0);try{const S=(await Promise.all(w.map(_=>Nve(_)))).flat(),E=w.some(_=>_.isDirectory);if(!E&&S.length===1&&S[0].file.name.toLowerCase().endsWith(".zip")){b(await c_t(S[0].file));return}if(!E){r(["请拖入包含 SKILL.md 的文件夹或一个 .zip 文件"]);return}const k=new Map(S.map(({file:_,path:T})=>[_,T]));b(await u_t(S.map(({file:_})=>_),k))}catch(S){r([`读取失败:${S instanceof Error?S.message:String(S)}`])}finally{l(!1)}};return o.jsxs("div",{className:"cw-local",children:[o.jsxs("div",{className:`cw-local-dropzone ${c?"is-dragging":""}`,role:"group","aria-label":"拖入文件夹或 ZIP,自动识别 Skill",onDragEnter:y,onDragOver:x=>x.preventDefault(),onDragLeave:O,onDrop:x=>void v(x),children:[o.jsx(n9,{className:"cw-local-drop-icon","aria-hidden":!0}),o.jsx("p",{className:"cw-local-drop-hint",children:"拖入文件夹或 ZIP,自动识别 Skill"})]}),o.jsx("p",{className:"cw-local-hint",children:"每个技能需包含 SKILL.md。支持包含多个技能的目录。"}),a&&o.jsx("p",{className:"cw-empty-line",children:"正在读取文件…"}),n.length>0&&o.jsxs("div",{className:"cw-banner",children:[o.jsx(Ed,{className:"cw-i"}),o.jsx("span",{children:n.join(";")})]}),i.length>0&&o.jsx("div",{className:"cw-skill-results",children:i.map(x=>{var S;const w=f(x.folder||x.name);return o.jsxs("button",{type:"button",className:`cw-skill-result ${w?"is-on":""}`,onClick:()=>h(x),"aria-pressed":w,children:[o.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:w?o.jsx(_u,{className:"cw-i cw-i-sm"}):o.jsx(vo,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-skill-result-meta",children:[o.jsx("span",{className:"cw-skill-result-name",children:x.name}),x.description&&o.jsx("span",{className:"cw-skill-result-desc",children:TS(x.description)}),o.jsxs("span",{className:"cw-skill-result-repo",children:["本地 · ",((S=x.localFiles)==null?void 0:S.length)??0," 个文件"]})]})]},x.id)})})]})}const p_t="/harness/skills/findskill";async function m_t(e,t="public"){const n=e.trim(),r=new URLSearchParams({query:n,page_number:"1",page_size:"20"}),i=`${p_t}?${r.toString()}`,s=await fetch(i,{headers:{accept:"application/json"},signal:tl(void 0,Ao)});if(!s.ok)throw new Error(`搜索失败 (${s.status})`);return((await s.json()).items??[]).map(l=>({source:"skillhub",id:l.slug??l.name??"",slug:l.slug??"",name:l.name??l.slug??"",description:l.description??"",namespace:t,sourceRepo:l.sourceRepo,downloadCount:l.downloadCount,version:l.version}))}function g_t({selected:e,onChange:t}){const[n,r]=p.useState(""),[i,s]=p.useState([]),[a,l]=p.useState(!1),[c,u]=p.useState(null),[d,f]=p.useState(!1),h=b=>e.some(y=>y.source==="skillhub"&&y.slug===b),m=b=>{b.slug&&(h(b.slug)?t(e.filter(y=>!(y.source==="skillhub"&&y.slug===b.slug))):t([...e,{source:"skillhub",slug:b.slug,name:b.name,folder:b.slug.split("/").pop()||b.name,namespace:b.namespace||"public",description:b.description}]))},g=async b=>{l(!0),u(null),f(!0);try{const y=await m_t(b);s(y)}catch(y){u(y instanceof Error?y.message:"搜索失败,请稍后重试。"),s([])}finally{l(!1)}};return p.useEffect(()=>{const b=n.trim();if(!b){s([]),f(!1),u(null);return}const y=setTimeout(()=>g(b),300);return()=>clearTimeout(y)},[n]),o.jsxs("div",{className:"cw-skillhub",children:[o.jsxs("div",{className:"cw-skill-searchrow",children:[o.jsxs("div",{className:"cw-skill-searchbox",children:[o.jsx(bC,{className:"cw-i cw-skill-searchicon","aria-hidden":!0}),o.jsx("input",{className:"cw-input cw-skill-input",value:n,placeholder:"搜索火山 Find Skill 技能广场,例如 数据分析、PDF…",onChange:b=>r(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),n.trim()&&g(n))}})]}),o.jsxs("button",{type:"button",className:"cw-btn cw-btn-soft",onClick:()=>n.trim()&&g(n),disabled:!n.trim()||a,children:[a?o.jsx(or,{className:"cw-i cw-spin"}):o.jsx(bC,{className:"cw-i"}),"搜索"]})]}),c&&o.jsxs("div",{className:"cw-banner",children:[o.jsx(Ed,{className:"cw-i"}),o.jsx("span",{children:c})]}),a&&i.length===0?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(or,{className:"cw-i cw-spin"})," 正在搜索…"]}):i.length>0?o.jsx("div",{className:"cw-skill-results",children:i.map(b=>{const y=h(b.slug||"");return o.jsxs("button",{type:"button",className:`cw-skill-result ${y?"is-on":""}`,onClick:()=>m(b),"aria-pressed":y,children:[o.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:y?o.jsx(_u,{className:"cw-i cw-i-sm"}):o.jsx(vo,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-skill-result-meta",children:[o.jsx("span",{className:"cw-skill-result-name",children:b.name}),b.description&&o.jsx("span",{className:"cw-skill-result-desc",children:TS(b.description)}),b.sourceRepo&&o.jsx("span",{className:"cw-skill-result-repo",children:b.sourceRepo})]})]},b.id||b.slug)})}):d&&!c?o.jsx("p",{className:"cw-empty-line",children:"没有找到匹配的技能,换个关键词试试。"}):!d&&o.jsx("p",{className:"cw-empty-line",children:"输入关键词搜索火山 Find Skill 技能广场,所选技能会在生成项目时下载到 skills/ 目录。"})]})}function b_t({selected:e,onChange:t,cloudProvider:n="volcengine"}){const[r,i]=p.useState([]),[s,a]=p.useState([]),[l,c]=p.useState(""),[u,d]=p.useState(!0),[f,h]=p.useState(!1),[m,g]=p.useState(null);p.useEffect(()=>{let x=!1;return(async()=>{d(!0),g(null);try{const w=await Fge();x||(i(w),w.length>0&&c(w[0].id))}catch(w){x||g(w instanceof Error?w.message:"加载失败")}finally{x||d(!1)}})(),()=>{x=!0}},[]),p.useEffect(()=>{if(!l){a([]);return}const x=r.find(S=>S.id===l);let w=!1;return(async()=>{h(!0),g(null);try{const S=await zge(l,x==null?void 0:x.region);w||a(S)}catch(S){w||g(S instanceof Error?S.message:"加载失败")}finally{w||h(!1)}})(),()=>{w=!0}},[l,r]);const b=r.find(x=>x.id===l),y=b?dct(b.id,b.region,n):"",O=(x,w)=>e.some(S=>S.source==="skillspace"&&S.skillId===x&&(S.version||"")===w),v=x=>{if(b)if(O(x.skillId,x.version))t(e.filter(w=>!(w.source==="skillspace"&&w.skillId===x.skillId&&(w.version||"")===x.version)));else{const w=uct(b,x);t([...e,{source:"skillspace",folder:w.folder||x.skillName,name:w.name,description:w.description,skillSpaceId:w.skillSpaceId,skillSpaceName:w.skillSpaceName,skillSpaceRegion:w.skillSpaceRegion,skillId:w.skillId,version:w.version}])}};return o.jsx("div",{className:"cw-skillspace",children:u?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(or,{className:"cw-i cw-spin"})," 正在加载 AgentKit Skills 中心…"]}):m?o.jsxs("div",{className:"cw-banner",children:[o.jsx(Ed,{className:"cw-i"}),o.jsx("span",{children:m})]}):r.length===0?o.jsx("p",{className:"cw-empty-line",children:"此账号下没有 AgentKit Skills 中心。"}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"cw-skillspace-header",children:[o.jsx("select",{className:"cw-input cw-skillspace-select",value:l,onChange:x=>c(x.target.value),"aria-label":"选择 AgentKit Skills 中心",children:r.map(x=>o.jsxs("option",{value:x.id,children:[x.name||x.id,x.description?` — ${TS(x.description)}`:""]},x.id))}),b&&o.jsxs(o.Fragment,{children:[b.region&&o.jsx("span",{className:"cw-skillspace-region-label",title:b.region,children:Zf(b.region,n)}),y&&o.jsx("a",{href:y,target:"_blank",rel:"noopener noreferrer",className:"cw-button cw-button-secondary cw-skillspace-console-link",title:"在火山引擎控制台打开","aria-label":"在火山引擎控制台打开",children:o.jsx(Dg,{className:"cw-i cw-i-sm"})})]})]}),f?o.jsxs("p",{className:"cw-empty-line cw-skill-loading",role:"status",children:[o.jsx(or,{className:"cw-i cw-spin"})," 正在加载技能列表…"]}):s.length===0?o.jsx("p",{className:"cw-empty-line",children:"此 AgentKit Skills 中心暂无技能。"}):o.jsx("div",{className:"cw-skill-results",children:s.map(x=>{const w=O(x.skillId,x.version);return o.jsxs("button",{type:"button",className:`cw-skill-result ${w?"is-on":""}`,onClick:()=>v(x),"aria-pressed":w,children:[o.jsx("span",{className:"cw-skill-result-icon","aria-hidden":!0,children:w?o.jsx(_u,{className:"cw-i cw-i-sm"}):o.jsx(vo,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-skill-result-meta",children:[o.jsxs("span",{className:"cw-skill-result-name",children:[x.skillName,x.version&&o.jsxs("span",{className:"cw-skill-result-version",children:[" ","v",x.version]})]}),x.skillDescription&&o.jsx("span",{className:"cw-skill-result-desc",children:TS(x.skillDescription)}),o.jsxs("span",{className:"cw-skill-result-repo",children:[o.jsx($Re,{className:"cw-i cw-i-sm"})," ",(b==null?void 0:b.name)||l]})]})]},`${x.skillId}/${x.version}`)})})]})})}function jve({className:e}){return o.jsxs("svg",{className:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[o.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"}),o.jsx("path",{d:"M7 4.75h9.5a2 2 0 0 1 2 2",opacity:".58"}),o.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"}),o.jsx("path",{d:"M19.25 11.25h1.5M20 10.5V12",opacity:".72"})]})}function LP(e){return e.source==="runtime"?`runtime:${e.folder}`:e.source==="skillhub"?`hub:${e.namespace}/${e.slug}`:e.source==="local"?`local:${e.folder}`:`ss:${e.skillSpaceId}/${e.skillId}/${e.version||""}`}function y_t(e){return e.source==="runtime"?"运行中来源 · 原样保留,可移除或用同名 Skill 替换":e.source==="local"?"本地":e.source==="skillspace"?"AgentKit Skills 中心":"火山 Find Skill 技能广场"}function O_t({skill:e,onRemove:t,disabled:n}){let r=ww;e.source==="local"||e.source==="runtime"?r=n9:e.source==="skillspace"&&(r=jve);const i=`${y_t(e)}${e.description?` · ${TS(e.description)}`:""}`;return o.jsxs(ui.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:[o.jsx("span",{className:"cw-selected-skill-icon","aria-hidden":"true",children:o.jsx(r,{className:"cw-i cw-i-sm"})}),o.jsxs("span",{className:"cw-selected-skill-meta",children:[o.jsx("span",{className:"cw-selected-skill-name",children:e.name}),o.jsx("span",{className:"cw-selected-skill-detail",tabIndex:0,title:i,children:i})]}),o.jsx("button",{type:"button",className:"cw-selected-skill-remove",onClick:t,disabled:n,"aria-label":`移除 ${e.name}`,title:`移除 ${e.name}`,children:o.jsx(ba,{className:"cw-i cw-i-sm"})})]})}const $P=[{id:"local",label:"本地文件",shortLabel:"本地文件",icon:n9},{id:"skillspace",label:"AgentKit Skills 中心",shortLabel:"AgentKit",icon:jve},{id:"skillhub",label:"火山 Find Skill 技能广场",shortLabel:"Find Skill",icon:jN}];function hU({selected:e,onChange:t,cloudProvider:n,disabled:r=!1,addLabel:i="添加 Skill",showSelectedCount:s=!0}){const[a,l]=p.useState("local"),[c,u]=p.useState(!1),d=p.useId(),f=p.useId(),h=p.useRef(null),m=$P.findIndex(y=>y.id===a);p.useEffect(()=>{var x;if(!c)return;const y=document.body.style.overflow,O=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(x=h.current)==null||x.focus();const v=w=>{w.key==="Escape"&&u(!1)};return window.addEventListener("keydown",v),()=>{document.body.style.overflow=y,window.removeEventListener("keydown",v),O!=null&&O.isConnected&&O.focus()}},[c]);const g=(y,O)=>{O.source==="runtime"&&!window.confirm(`从新版本中移除运行中的 Skill「${O.name}」?`)||t(e.filter(v=>LP(v)!==y))},b=y=>{const O=new Set(y.filter(v=>v.source!=="runtime").map(v=>v.folder));t(y.filter(v=>v.source!=="runtime"||!O.has(v.folder)))};return o.jsxs("div",{className:"cw-skillspane",children:[o.jsxs("button",{type:"button",className:"cw-skill-add","aria-haspopup":"dialog",disabled:r,onClick:()=>u(!0),children:[o.jsx("span",{className:"cw-skill-add-icon","aria-hidden":"true",children:o.jsx(vo,{className:"cw-i"})}),o.jsx("span",{children:i})]}),e.length>0&&o.jsxs("div",{className:"cw-skill-selected",children:[s?o.jsxs("span",{className:"cw-skill-selected-label",children:["已加入技能 · ",e.length]}):null,o.jsx("div",{className:"cw-selected-skill-list",children:o.jsx(mu,{initial:!1,children:e.map(y=>o.jsx(O_t,{skill:y,disabled:r,onRemove:()=>g(LP(y),y)},LP(y)))})})]}),Tr.createPortal(o.jsx(mu,{children:c&&o.jsx(ui.div,{className:"cw-skill-dialog-backdrop",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.16},onMouseDown:y=>{y.target===y.currentTarget&&u(!1)},children:o.jsxs(ui.section,{className:"cw-skill-dialog",role:"dialog","aria-modal":"true","aria-labelledby":d,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:[o.jsxs("header",{className:"cw-skill-dialog-head",children:[o.jsx("h3",{id:d,children:i}),o.jsx("button",{ref:h,type:"button",className:"cw-skill-dialog-close","aria-label":`关闭${i}`,onClick:()=>u(!1),children:o.jsx(ba,{className:"cw-i"})})]}),o.jsxs("div",{className:"cw-skill-dialog-body",children:[o.jsxs("div",{className:"cw-skill-sourcetabs",role:"tablist",style:{"--cw-skill-tab-slider-width":`calc((100% - 16px) / ${$P.length})`,"--cw-active-skill-tab-offset":`calc(${m*100}% + ${m*4}px)`},children:[o.jsx("span",{className:"cw-skill-tab-slider","aria-hidden":"true"}),$P.map(({id:y,label:O,shortLabel:v,icon:x})=>o.jsxs("button",{type:"button",role:"tab",id:`${f}-${y}`,"aria-controls":f,"aria-selected":a===y,className:`cw-skill-pickertab ${a===y?"is-on":""}`,onClick:()=>l(y),children:[o.jsx(x,{className:"cw-i cw-i-sm"}),o.jsx("span",{className:"cw-skill-tab-label-full",children:O}),o.jsx("span",{className:"cw-skill-tab-label-short",children:v})]},y))]}),o.jsxs("div",{id:f,className:"cw-skill-tabbody",role:"tabpanel","aria-labelledby":`${f}-${a}`,children:[a==="skillhub"&&o.jsx(g_t,{selected:e,onChange:b}),a==="local"&&o.jsx(h_t,{selected:e,onChange:b}),a==="skillspace"&&o.jsx(b_t,{selected:e,onChange:b,cloudProvider:n})]})]})]})})}),document.body)]})}const Rve=128*1024;function x_t(e){return e.replace(/^\uFEFF/,"").replace(/\r\n?/g,` +`)}function V6(e){return new TextEncoder().encode(e).byteLength}function Ive(e,t=V6(e)){return t>Rve?"Dockerfile 不能超过 128 KiB。":e.trim()?/^\s*FROM\s+\S+/im.test(e)?"":"Dockerfile 缺少 FROM 指令。":"Dockerfile 内容不能为空。"}async function v_t(e){if(e.size>Rve)return{content:"",error:"Dockerfile 不能超过 128 KiB。"};const t=x_t(await e.text());return{content:t,error:Ive(t,e.size)}}function w_t(e){return nQ(e,{lineWidth:0})}function S_t(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m7 9.5 5 5 5-5"})})}function E_t(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"m6.5 12.5 3.5 3.5 7.5-8"})})}function XE({ariaLabel:e,value:t,valueLabel:n,placeholder:r,options:i,disabled:s=!1,searchValue:a,searchPlaceholder:l="搜索资源名称",loading:c=!1,hasMore:u=!1,emptyMessage:d="暂无可用选项",onSearchChange:f,onLoadMore:h,onChange:m}){const g=p.useId(),b=p.useRef(null),y=p.useRef(null),O=p.useRef(null),v=p.useRef(null),x=p.useRef([]),[w,S]=p.useState(!1),[E,k]=p.useState(0),_=i.find($=>$.value===t),T=(_==null?void 0:_.label)??(t?n:void 0),C=a!==void 0&&!!f,A=()=>{S(!1),C&&a&&(f==null||f(""))};p.useEffect(()=>{if(!w)return;const $=N=>{N.target instanceof Node&&b.current&&!b.current.contains(N.target)&&A()};return window.addEventListener("pointerdown",$),()=>window.removeEventListener("pointerdown",$)},[w,f,a,C]),p.useEffect(()=>{var $,N;if(w){if(C){($=O.current)==null||$.focus();return}(N=x.current[E])==null||N.focus()}},[w,C]),p.useEffect(()=>{var $;!w||C&&document.activeElement===O.current||($=x.current[E])==null||$.focus()},[E,w,C]),p.useEffect(()=>{k($=>Math.min($,Math.max(0,i.length-1)))},[i.length]),p.useEffect(()=>{if(!w||!u||c||!h)return;const $=window.requestAnimationFrame(()=>{const N=v.current;N&&N.scrollHeight<=N.clientHeight+1&&h()});return()=>window.cancelAnimationFrame($)},[u,c,h,w,i.length]);const j=($=1)=>{const N=i.findIndex(Q=>Q.value===t),D=N>=0?N:$===1?0:Math.max(0,i.length-1);k(D),S(!0)},M=$=>{i.length!==0&&k(($+i.length)%i.length)},I=$=>{var N;m($.value),A(),(N=y.current)==null||N.focus()};return o.jsxs("div",{className:"pp-deployment-select",ref:b,onKeyDown:$=>{var D,Q;const N=$.target===O.current;if($.key==="Escape"&&w){$.preventDefault(),A(),(D=y.current)==null||D.focus();return}if($.key==="Tab"){A();return}if(N){$.key==="ArrowDown"&&i.length>0&&($.preventDefault(),k(0),(Q=x.current[0])==null||Q.focus());return}$.key==="ArrowDown"?($.preventDefault(),w?M(E+1):j(1)):$.key==="ArrowUp"?($.preventDefault(),w?M(E-1):j(-1)):w&&$.key==="Home"?($.preventDefault(),k(0)):w&&$.key==="End"&&($.preventDefault(),k(Math.max(0,i.length-1)))},children:[o.jsxs("button",{ref:y,type:"button",className:"pp-deployment-select-trigger","aria-label":e,"aria-haspopup":"listbox","aria-expanded":w,"aria-controls":w?g:void 0,disabled:s,onClick:()=>{w?A():j()},children:[o.jsx("span",{className:T?void 0:"is-placeholder",children:T??r}),o.jsx(S_t,{className:`pp-deployment-select-chevron${w?" is-open":""}`})]}),w&&o.jsxs("div",{className:"pp-deployment-select-menu",children:[C&&o.jsx("div",{className:"pp-deployment-select-search",children:o.jsx("input",{ref:O,type:"search",value:a,"aria-label":`搜索${e}`,placeholder:l,autoComplete:"off",onChange:$=>f==null?void 0:f($.currentTarget.value)})}),o.jsx("div",{id:g,ref:v,className:"pp-deployment-select-options",role:"listbox","aria-label":e,"aria-busy":c||void 0,onScroll:$=>{if(!u||c||!h)return;const N=$.currentTarget;N.scrollHeight-N.scrollTop-N.clientHeight<=24&&h()},children:i.map(($,N)=>{const D=$.value===t;return o.jsxs("button",{ref:Q=>{x.current[N]=Q},type:"button",role:"option","aria-selected":D,tabIndex:N===E?0:-1,className:`pp-deployment-select-option${D?" is-selected":""}`,title:$.description,onFocus:()=>k(N),onClick:()=>I($),children:[o.jsxs("span",{className:"pp-deployment-select-copy",children:[o.jsxs("span",{className:"pp-deployment-select-name",children:[$.label,$.badge&&o.jsx("span",{className:"pp-deployment-select-badge",children:$.badge})]}),$.description&&o.jsx("small",{children:$.description})]}),D&&o.jsx(E_t,{})]},$.value)})}),c&&o.jsx("div",{className:"pp-deployment-select-state","aria-live":"polite",children:"正在加载更多资源…"}),!c&&i.length===0&&o.jsx("div",{className:"pp-deployment-select-state",children:d})]})]})}const k_t=[{value:"auto",label:"自动创建",description:"部署时自动创建所需资源",badge:"推荐"},{value:"create",label:"指定名称",description:"使用指定名称创建或复用资源"},{value:"existing",label:"选择已有",description:"从当前账号的已有资源中选择"}],Dve={tos:{mode:"auto"},cr:{mode:"auto"},codePipeline:{mode:"auto"}};function mf(e){const[t,n]=p.useState([]),[r,i]=p.useState(""),[s,a]=p.useState(1),[l,c]=p.useState(0),[u,d]=p.useState(!1),[f,h]=p.useState(!1),[m,g]=p.useState(null),[b,y]=p.useState(""),[O,v]=p.useState(""),[x,w]=p.useState(""),[S,E]=p.useState(0),k=p.useRef(!1),_=p.useRef(null),T=e?JSON.stringify(e):"",C=e?JSON.stringify({...e,search:O}):"";p.useEffect(()=>{const $=window.setTimeout(()=>{v(b.trim())},250);return()=>window.clearTimeout($)},[b]),p.useEffect(()=>{y(""),v("")},[T]);const A=p.useCallback(($,N)=>{var F;if(!C)return;(F=_.current)==null||F.abort();const D=new AbortController;_.current=D;const Q=JSON.parse(C);N&&n([]),k.current=!0,h(!0),g(null),Ooe({...Q,pageNumber:$,pageSize:100},D.signal).then(L=>{n(H=>{if(N)return L.items;const z=new Set(H.map(B=>`${B.id}\0${B.name}`));return[...H,...L.items.filter(B=>!z.has(`${B.id}\0${B.name}`))]}),i(L.serviceRegion),a(L.pageNumber),c(L.totalCount),d(L.hasMore),w(C)}).catch(L=>{L instanceof DOMException&&L.name==="AbortError"||(w(C),g(L instanceof Error?L.message:String(L)))}).finally(()=>{_.current===D&&(_.current=null,k.current=!1,h(!1))})},[C]);p.useEffect(()=>{var $;if(!C){($=_.current)==null||$.abort(),_.current=null,k.current=!1,n([]),i(""),a(1),c(0),d(!1),w(""),h(!1),g(null);return}return A(1,!0),()=>{var N;return(N=_.current)==null?void 0:N.abort()}},[A,C,S]);const j=!!C&&x===C&&b.trim()===O,M=p.useCallback(()=>{w(""),E($=>$+1)},[]),I=p.useCallback(()=>{!j||k.current||!u||A(s+1,!1)},[u,A,s,j]);return{items:t,serviceRegion:r,totalCount:l,hasMore:j?u:!1,loading:!!C&&(!j||f),error:m,search:b,setSearch:y,reload:M,loadMore:I}}function __t(e,t){return e.map(n=>({value:n[t],label:n.name,description:[n.status,n.region,n.id].filter(Boolean).join(" · ")}))}function gf({ariaLabel:e,value:t,valueLabel:n,state:r,disabled:i,disabledMessage:s,valueField:a="id",onChange:l}){const c=p.useMemo(()=>__t(r.items,a),[r.items,a]);return o.jsxs("div",{className:"pp-resource-picker",children:[o.jsx(XE,{ariaLabel:e,value:t,valueLabel:n,placeholder:r.loading?"正在加载…":"请选择已有资源",options:c,disabled:i||!!r.error,searchValue:r.search,searchPlaceholder:"搜索资源名称",loading:r.loading,hasMore:r.hasMore,emptyMessage:r.search.trim()?"未找到匹配资源":"暂无可用资源",onSearchChange:r.setSearch,onLoadMore:r.loadMore,onChange:u=>{const d=r.items.find(f=>f[a]===u);d&&l(d)}}),s?o.jsx("span",{className:"pp-resource-status",children:s}):r.error?o.jsxs("div",{className:"pp-resource-error",role:"alert",children:[o.jsx("span",{children:r.error}),o.jsx("button",{type:"button",onClick:r.reload,children:"重试"})]}):r.loading&&r.items.length===0?o.jsx("span",{className:"pp-resource-status","aria-live":"polite",children:r.search.trim()?"正在搜索云资源…":"正在加载云资源…"}):r.items.length===0?o.jsx("span",{className:"pp-resource-status",children:r.search.trim()?"未找到匹配资源。":"暂无可用资源。"}):r.serviceRegion?o.jsxs("span",{className:"pp-resource-status",children:["实际服务区域:",r.serviceRegion," · 已加载 ",r.items.length,r.totalCount>0?`/${r.totalCount}`:""]}):null]})}function Pve({region:e,value:t,disabled:n=!1,onChange:r}){const i=mf(e?{kind:"cr-registry",region:e}:null),s=mf(e&&(t!=null&&t.registry)?{kind:"cr-namespace",region:e,registry:t.registry}:null),a=mf(e&&(t!=null&&t.registry)&&t.namespace?{kind:"cr-repository",region:e,registry:t.registry,namespace:t.namespace}:null),l=t??{region:e,registry:"",namespace:"",repository:""};return o.jsxs("div",{className:"pp-resource-fields pp-resource-fields-three environment-repository-fields",children:[o.jsxs("label",{className:"pp-resource-field",children:[o.jsx("span",{children:"Registry 实例"}),o.jsx(gf,{ariaLabel:"镜像仓库 Registry 实例",value:l.registry,valueLabel:l.registry,state:i,disabled:n||!e,valueField:"name",onChange:c=>r({region:e,registry:c.name,namespace:"",repository:""})})]}),o.jsxs("label",{className:"pp-resource-field",children:[o.jsx("span",{children:"Namespace"}),o.jsx(gf,{ariaLabel:"镜像仓库 Namespace",value:l.namespace,valueLabel:l.namespace,state:s,disabled:n||!l.registry,disabledMessage:l.registry?void 0:"请先选择 Registry 实例。",valueField:"name",onChange:c=>r({...l,region:e,namespace:c.name,repository:""})})]}),o.jsxs("label",{className:"pp-resource-field",children:[o.jsx("span",{children:"镜像仓库"}),o.jsx(gf,{ariaLabel:"已有镜像仓库",value:l.repository,valueLabel:l.repository,state:a,disabled:n||!l.registry||!l.namespace,disabledMessage:l.registry?l.namespace?void 0:"请先选择 Namespace。":"请先选择 Registry 实例。",valueField:"name",onChange:c=>r({...l,region:e,repository:c.name})})]})]})}function BP({resource:e,value:t,disabled:n,onChange:r}){return o.jsxs("label",{className:"pp-resource-field pp-resource-mode",children:[o.jsx("span",{children:"配置方式"}),o.jsx(XE,{ariaLabel:`${e}配置方式`,value:t,placeholder:"请选择配置方式",options:k_t,disabled:n,onChange:i=>r(i)})]})}function rb({label:e,value:t,placeholder:n,disabled:r,onChange:i}){return o.jsxs("label",{className:"pp-resource-field",children:[o.jsx("span",{children:e}),o.jsx("input",{value:t,placeholder:n,disabled:r,autoComplete:"off",onChange:s=>i(s.currentTarget.value)})]})}function QP({items:e,note:t}){return o.jsxs("div",{className:"pp-resource-auto-names",children:[o.jsx("span",{children:"自动创建名称"}),o.jsx("dl",{children:e.map(n=>o.jsxs("div",{children:[o.jsx("dt",{children:n.label}),o.jsx("dd",{title:n.name,children:n.name})]},n.label))}),t&&o.jsx("small",{children:t})]})}function Mve(e){var t,n,r,i,s,a,l,c;return e.tos.mode!=="auto"&&!((t=e.tos.bucket)!=null&&t.trim())?"请填写或选择 TOS 存储桶。":e.cr.mode!=="auto"&&(!((n=e.cr.instance)!=null&&n.trim())||!((r=e.cr.namespace)!=null&&r.trim())||!((i=e.cr.repository)!=null&&i.trim()))?"请完整填写或选择 CR 实例、命名空间和镜像仓库。":e.codePipeline.mode!=="auto"&&(!((s=e.codePipeline.workspaceName)!=null&&s.trim())||!((a=e.codePipeline.pipelineName)!=null&&a.trim()))?"请完整填写或选择 CodePipeline Workspace 和 Pipeline。":e.codePipeline.mode==="existing"&&(!((l=e.codePipeline.workspaceId)!=null&&l.trim())||!((c=e.codePipeline.pipelineId)!=null&&c.trim()))?"请选择已有的 CodePipeline Workspace 和兼容 Pipeline。":null}function Lve({value:e,agentName:t,runtimeName:n,region:r,disabled:i,validationError:s,onChange:a}){const l=t.trim()||"agentkit-app",c=n.trim()||l,u=r&&r!=="cn-beijing"?`agentkit-platform-{账号 ID}-${r.startsWith("cn-")?r.slice(3):r}`:"agentkit-platform-{账号 ID}",d=mf(e.tos.mode==="existing"?{kind:"tos-bucket",region:r}:null),f=mf(e.cr.mode==="existing"?{kind:"cr-registry",region:r}:null),h=mf(e.cr.mode==="existing"&&e.cr.instance?{kind:"cr-namespace",region:r,registry:e.cr.instance}:null),m=mf(e.cr.mode==="existing"&&e.cr.instance&&e.cr.namespace?{kind:"cr-repository",region:r,registry:e.cr.instance,namespace:e.cr.namespace}:null),g=mf(e.codePipeline.mode==="existing"?{kind:"cp-workspace",region:r}:null),b=mf(e.codePipeline.mode==="existing"&&e.codePipeline.workspaceId?{kind:"cp-pipeline",region:r,workspaceId:e.codePipeline.workspaceId}:null),y=O=>a({...e,...O});return o.jsxs("div",{className:"pp-resource-list",children:[o.jsxs("div",{className:"pp-resource-item",children:[o.jsx("div",{className:"pp-resource-name",children:"TOS 存储桶"}),o.jsxs("div",{className:"pp-resource-grid",children:[o.jsx(BP,{resource:"TOS 存储桶",value:e.tos.mode,disabled:i,onChange:O=>y({tos:{mode:O}})}),e.tos.mode==="create"&&o.jsx(rb,{label:"存储桶名称",value:e.tos.bucket??"",placeholder:"输入存储桶名称",disabled:i,onChange:O=>y({tos:{...e.tos,bucket:O}})}),e.tos.mode==="existing"&&o.jsxs("label",{className:"pp-resource-field",children:[o.jsx("span",{children:"已有存储桶"}),o.jsx(gf,{ariaLabel:"已有 TOS 存储桶",value:e.tos.bucket??"",valueLabel:e.tos.bucket,state:d,disabled:i,onChange:O=>y({tos:{...e.tos,bucket:O.name}})})]}),e.tos.mode==="auto"&&o.jsx(QP,{items:[{label:"存储桶",name:u}],note:"账号 ID 在部署时按当前云账号解析。"})]})]}),o.jsxs("div",{className:"pp-resource-item",children:[o.jsx("div",{className:"pp-resource-name",children:"容器镜像仓库(CR)"}),o.jsxs("div",{className:"pp-resource-grid",children:[o.jsx(BP,{resource:"CR",value:e.cr.mode,disabled:i,onChange:O=>y({cr:{mode:O}})}),e.cr.mode==="create"&&o.jsxs("div",{className:"pp-resource-fields pp-resource-fields-three",children:[o.jsx(rb,{label:"实例名称",value:e.cr.instance??"",placeholder:"CR 实例",disabled:i,onChange:O=>y({cr:{...e.cr,instance:O}})}),o.jsx(rb,{label:"命名空间",value:e.cr.namespace??"",placeholder:"命名空间",disabled:i,onChange:O=>y({cr:{...e.cr,namespace:O}})}),o.jsx(rb,{label:"镜像仓库",value:e.cr.repository??"",placeholder:"镜像仓库",disabled:i,onChange:O=>y({cr:{...e.cr,repository:O}})})]}),e.cr.mode==="existing"&&o.jsxs("div",{className:"pp-resource-fields pp-resource-fields-three",children:[o.jsxs("label",{className:"pp-resource-field",children:[o.jsx("span",{children:"CR 实例"}),o.jsx(gf,{ariaLabel:"已有 CR 实例",value:e.cr.instance??"",valueLabel:e.cr.instance,state:f,disabled:i,valueField:"name",onChange:O=>y({cr:{mode:"existing",instance:O.name}})})]}),o.jsxs("label",{className:"pp-resource-field",children:[o.jsx("span",{children:"命名空间"}),o.jsx(gf,{ariaLabel:"已有 CR 命名空间",value:e.cr.namespace??"",valueLabel:e.cr.namespace,state:h,disabled:i||!e.cr.instance,valueField:"name",onChange:O=>y({cr:{...e.cr,namespace:O.name,repository:void 0}})})]}),o.jsxs("label",{className:"pp-resource-field",children:[o.jsx("span",{children:"镜像仓库"}),o.jsx(gf,{ariaLabel:"已有 CR 镜像仓库",value:e.cr.repository??"",valueLabel:e.cr.repository,state:m,disabled:i||!e.cr.namespace,valueField:"name",onChange:O=>y({cr:{...e.cr,repository:O.name}})})]})]}),e.cr.mode==="auto"&&o.jsx(QP,{items:[{label:"CR 实例",name:"agentkit-platform-{账号 ID}"},{label:"命名空间",name:"agentkit"},{label:"镜像仓库",name:`${l}-{4 位随机字符}`}],note:"账号 ID 在部署时解析,镜像仓库的随机字符在部署时生成。"})]})]}),o.jsxs("div",{className:"pp-resource-item",children:[o.jsx("div",{className:"pp-resource-name",children:"CodePipeline"}),o.jsxs("div",{className:"pp-resource-grid",children:[o.jsx(BP,{resource:"CodePipeline",value:e.codePipeline.mode,disabled:i,onChange:O=>y({codePipeline:{mode:O}})}),e.codePipeline.mode==="create"&&o.jsxs("div",{className:"pp-resource-fields",children:[o.jsx(rb,{label:"Workspace 名称",value:e.codePipeline.workspaceName??"",placeholder:"Workspace 名称",disabled:i,onChange:O=>y({codePipeline:{...e.codePipeline,workspaceName:O}})}),o.jsx(rb,{label:"Pipeline 名称",value:e.codePipeline.pipelineName??"",placeholder:"Pipeline 名称",disabled:i,onChange:O=>y({codePipeline:{...e.codePipeline,pipelineName:O}})})]}),e.codePipeline.mode==="existing"&&o.jsxs("div",{className:"pp-resource-fields",children:[o.jsxs("label",{className:"pp-resource-field",children:[o.jsx("span",{children:"Workspace"}),o.jsx(gf,{ariaLabel:"已有 CodePipeline Workspace",value:e.codePipeline.workspaceId??"",valueLabel:e.codePipeline.workspaceName,state:g,disabled:i,onChange:O=>y({codePipeline:{mode:"existing",workspaceId:O.id,workspaceName:O.name}})})]}),o.jsxs("label",{className:"pp-resource-field",children:[o.jsx("span",{children:"兼容 Pipeline"}),o.jsx(gf,{ariaLabel:"已有 AgentKit CodePipeline",value:e.codePipeline.pipelineId??"",valueLabel:e.codePipeline.pipelineName,state:b,disabled:i||!e.codePipeline.workspaceId,onChange:O=>y({codePipeline:{...e.codePipeline,pipelineId:O.id,pipelineName:O.name}})})]})]}),e.codePipeline.mode==="auto"&&o.jsx(QP,{items:[{label:"Workspace",name:"agentkit-cli-workspace"},{label:"Pipeline",name:c}],note:"Pipeline 与 Runtime 名称一致。"})]})]}),s&&o.jsx("p",{className:"pp-resource-validation",role:"alert",children:s})]})}const $ve=20,LJ=new Set,$J="未能读取剪贴板。请允许剪贴板权限,或点击“导入环境”后手动粘贴分享码。",T_t="当前浏览器无法自动读取剪贴板;请点击“导入环境”后手动粘贴分享码。";async function C_t(){var e;if(typeof navigator>"u"||!((e=navigator.permissions)!=null&&e.query))return!1;try{return(await navigator.permissions.query({name:"clipboard-read"})).state==="denied"}catch{return!1}}const A_t={opencli:z2t,uv:V2t,playwright:H2t,chromium:q2t,git:X2t,curl:G2t,ffmpeg:W2t,imagemagick:Y2t};function N_t(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"M8 3.25v9.5M3.25 8h9.5"})})}function j_t(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"6",cy:"5",r:"2"}),o.jsx("circle",{cx:"6",cy:"19",r:"2"}),o.jsx("circle",{cx:"18",cy:"12",r:"2"}),o.jsx("path",{d:"M8 5h2a4 4 0 0 1 4 4v0a3 3 0 0 0 3 3M8 19h2a4 4 0 0 0 4-4v0a3 3 0 0 1 3-3"})]})}function R_t(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"m4.5 7.5 7.5-4 7.5 4v9l-7.5 4-7.5-4v-9Z"}),o.jsx("path",{d:"m4.5 7.5 7.5 4 7.5-4M12 11.5v9"}),o.jsx("path",{d:"m8.5 5.4 7.3 4"})]})}function I_t(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M12 3v11m0 0 4-4m-4 4-4-4"}),o.jsx("path",{d:"M5 16v2.5A2.5 2.5 0 0 0 7.5 21h9a2.5 2.5 0 0 0 2.5-2.5V16"})]})}function H6(e){const t=e.trim();if(!t)return"请输入公开代码仓库地址。";try{const n=new URL(t);if(n.protocol!=="https:"||!n.hostname)return"请输入公开仓库的 HTTPS 地址。"}catch{return"请输入有效的公开仓库 HTTPS 地址。"}return""}function BJ(e){return!!(e!=null&&e.region&&e.registry&&e.namespace&&e.repository)}function Bve(e){const t=e.trim();return t?/\s/.test(t)?"Tag 或 Digest 不能包含空格。":t.startsWith("sha256:")?/^sha256:[0-9a-fA-F]{64}$/.test(t)?"":"Digest 必须是完整的 sha256 值。":/[@/]/.test(t)?"这里只填写 Tag,不要重复填写镜像仓库路径。":"":""}function D_t(e){return(e instanceof Error?e.message:String(e)).split(` +原始响应:`,1)[0].trim()}function P_t(e){return o.jsxs("svg",{viewBox:"0 0 32 32",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M5.5 10.5 16 5l10.5 5.5L16 16 5.5 10.5Z"}),o.jsx("path",{d:"M5.5 16 16 21.5 26.5 16M5.5 21.5 16 27l10.5-5.5"})]})}function M_t({label:e}){return o.jsx("span",{className:"environment-package-fallback",children:e.slice(0,1).toUpperCase()})}function L_t({option:e}){if(e.id==="lark-cli")return o.jsx("img",{src:xR,alt:""});if(e.id==="pandoc")return o.jsx("img",{src:F2t,alt:""});if(e.id==="github-cli")return o.jsx(fU,{});const t=A_t[e.id];return t?o.jsx("img",{src:t,alt:""}):o.jsx(M_t,{label:e.label})}function $_t(e){return e?{name:e.name,description:e.description,baseEnvironment:e.baseEnvironment,operatingSystem:e.operatingSystem,language:e.language,optionIds:[...e.optionIds],selectedSkills:[...e.selectedSkills],dockerfile:e.dockerfile===H7(e)?void 0:e.dockerfile,gitSource:e.gitSource,containerRepository:e.containerRepository,imageSource:e.imageSource}:{...X5,optionIds:[...X5.optionIds],selectedSkills:[...X5.selectedSkills]}}const fg=new Set(["preparing","queued","building","scanning"]),QJ=3e3,UP={preparing:"准备中",queued:"排队中",building:"构建中",scanning:"扫描中",available:"可用",failed:"构建失败"};function Qve(e){var n;const t=(n=e.latestVersion)==null?void 0:n.status;return t?t==="available"?{label:UP[t],color:"success"}:t==="failed"?{label:UP[t],color:"danger"}:{label:UP[t],color:"warning"}:{label:"未构建",color:"secondary"}}function B_t(e){const t=Date.parse(e);return Number.isNaN(t)?e:new Intl.DateTimeFormat("zh-CN",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(t)}function Q_t(e,t=Date.now()){const n=Date.parse(e.createdAt),i=fg.has(e.status)?t:Date.parse(e.updatedAt);if(Number.isNaN(n)||Number.isNaN(i))return"";const s=Math.max(0,Math.floor((i-n)/1e3));if(s<60)return`${s} 秒`;const a=Math.floor(s/60),l=s%60;return a<60?`${a} 分 ${l} 秒`:`${Math.floor(a/60)} 小时 ${a%60} 分`}function U_t({environment:e,onClose:t}){var v;const n=((v=e.latestVersion)==null?void 0:v.versionId)??"",r=p.useId(),i=p.useRef(null),s=p.useRef(t),[a,l]=p.useState(null),[c,u]=p.useState(!0),[d,f]=p.useState(""),[h,m]=p.useState(0),[g,b]=p.useState("idle"),y=p.useMemo(()=>a?w_t(a):"",[a]);s.current=t,p.useEffect(()=>{var E;const x=document.body.style.overflow,w=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(E=i.current)==null||E.focus();const S=k=>{if(k.key==="Escape"){k.preventDefault(),s.current();return}if(k.key!=="Tab"||!i.current)return;const _=Array.from(i.current.querySelectorAll('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])')).filter(A=>A.getClientRects().length>0);if(!_.length)return;const T=_[0],C=_[_.length-1];k.shiftKey&&document.activeElement===T?(k.preventDefault(),C.focus()):!k.shiftKey&&document.activeElement===C&&(k.preventDefault(),T.focus())};return window.addEventListener("keydown",S),()=>{document.body.style.overflow=x,window.removeEventListener("keydown",S),w!=null&&w.isConnected&&w.focus()}},[]),p.useEffect(()=>{const x=new AbortController;return u(!0),f(""),$oe(e.id,n,x.signal).then(l).catch(w=>{(w==null?void 0:w.name)!=="AbortError"&&f(w instanceof Error?w.message:String(w))}).finally(()=>{x.signal.aborted||u(!1)}),()=>x.abort()},[e.id,h,n]),p.useEffect(()=>{if(g!=="copied")return;const x=window.setTimeout(()=>b("idle"),1500);return()=>window.clearTimeout(x)},[g]);const O=async()=>{try{await navigator.clipboard.writeText(y),b("copied")}catch{b("error")}};return Tr.createPortal(o.jsx("div",{className:"environment-build-dialog__backdrop",onMouseDown:x=>{x.target===x.currentTarget&&t()},children:o.jsxs("section",{ref:i,className:"environment-build-dialog environment-manifest-dialog",role:"dialog","aria-modal":"true","aria-labelledby":r,"aria-busy":c||void 0,tabIndex:-1,children:[o.jsxs("header",{className:"environment-build-dialog__header",children:[o.jsxs("div",{children:[o.jsx("div",{className:"environment-build-dialog__title-row",children:o.jsx("h2",{id:r,children:"环境 Manifest"})}),o.jsxs("p",{children:[e.name," / ",n]})]}),o.jsx(It,{type:"button",color:"secondary",variant:"ghost",size:"sm",uniform:!0,onClick:t,"aria-label":"关闭环境 Manifest",children:o.jsx(ba,{"aria-hidden":!0})})]}),o.jsx("div",{className:"environment-manifest-dialog__body",children:c?o.jsx("div",{className:"environment-manifest-dialog__state",role:"status",children:o.jsx(En,{as:"span",children:"正在加载 Manifest"})}):d?o.jsxs("div",{className:"environment-manifest-dialog__state is-error",role:"alert",children:[o.jsx("p",{children:d}),o.jsx(It,{type:"button",color:"secondary",variant:"soft",size:"sm",onClick:()=>m(x=>x+1),children:"重新加载"})]}):o.jsx("div",{className:"environment-manifest-dialog__editor","aria-label":"环境 Manifest YAML",children:o.jsx(mR,{value:y,path:"environment.yaml",readOnly:!0,onChange:()=>{}})})}),o.jsxs("footer",{className:"environment-build-dialog__actions",children:[g==="error"?o.jsx("span",{className:"environment-manifest-dialog__copy-error",role:"alert",children:"复制失败,请重试"}):null,o.jsx(It,{type:"button",color:"secondary",variant:"ghost",size:"sm",onClick:t,children:"关闭"}),o.jsx(It,{type:"button",color:"info",size:"sm",disabled:!y,onClick:()=>void O(),children:g==="copied"?"已复制":"复制 Manifest"})]})]})}),document.body)}function F_t({environment:e,onClose:t,onBuildUpdate:n,onRebuild:r}){var S,E;const i=e.latestVersion,[s,a]=p.useState(i),[l,c]=p.useState(!!i),[u,d]=p.useState(""),[f,h]=p.useState(Date.now()),[m,g]=p.useState(!1),b=p.useId(),y=p.useRef(null),O=p.useRef(t),v=p.useRef(n);p.useEffect(()=>{O.current=t,v.current=n},[n,t]),p.useEffect(()=>{var C;const k=document.body.style.overflow,_=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(C=y.current)==null||C.focus();const T=A=>{var $;if(A.key==="Escape"&&O.current(),A.key!=="Tab")return;const j=Array.from((($=y.current)==null?void 0:$.querySelectorAll('button:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])'))??[]).filter(N=>N.getClientRects().length>0);if(!j.length)return;const M=j[0],I=j[j.length-1];A.shiftKey&&document.activeElement===M?(A.preventDefault(),I.focus()):!A.shiftKey&&document.activeElement===I&&(A.preventDefault(),M.focus())};return window.addEventListener("keydown",T),()=>{document.body.style.overflow=k,window.removeEventListener("keydown",T),_!=null&&_.isConnected&&_.focus()}},[]),p.useEffect(()=>{if(!i)return;let k=0;const _=new AbortController,T=async()=>{c(!0);try{const C=await Loe(e.id,i.versionId,{includeLogs:!0,signal:_.signal});a(C),d(""),v.current(C),fg.has(C.status)&&(k=window.setTimeout(T,QJ))}catch(C){if((C==null?void 0:C.name)==="AbortError")return;d(C instanceof Error?C.message:String(C)),k=window.setTimeout(T,QJ)}finally{_.signal.aborted||c(!1)}};return T(),()=>{_.abort(),window.clearTimeout(k)}},[e.id,i==null?void 0:i.versionId]),p.useEffect(()=>{if(!s||!fg.has(s.status))return;const k=window.setInterval(()=>h(Date.now()),1e3);return()=>window.clearInterval(k)},[s==null?void 0:s.status]);const x=s?Qve({...e,latestVersion:s}):{label:"未构建",color:"secondary"},w=e.imageSource||(E=(S=s==null?void 0:s.resources)==null?void 0:S.codePipeline)==null?void 0:E.consoleUrl;return Tr.createPortal(o.jsx("div",{className:"environment-build-dialog__backdrop",onMouseDown:k=>{k.target===k.currentTarget&&t()},children:o.jsxs("section",{ref:y,className:"environment-build-dialog",role:"dialog","aria-modal":"true","aria-labelledby":b,tabIndex:-1,children:[o.jsxs("header",{className:"environment-build-dialog__header",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"environment-build-dialog__title-row",children:[o.jsx("h2",{id:b,children:"构建详情"}),o.jsx(Js,{color:x.color,size:"sm",children:x.label})]}),o.jsx("p",{children:e.name})]}),o.jsx(It,{type:"button",color:"secondary",variant:"ghost",size:"sm",uniform:!0,onClick:t,"aria-label":"关闭构建详情",children:o.jsx(ba,{"aria-hidden":!0})})]}),o.jsxs("div",{className:"environment-build-dialog__summary",children:[o.jsxs("div",{children:[o.jsx("span",{children:"当前步骤"}),o.jsx("strong",{children:(s==null?void 0:s.currentStep)||"等待构建信息"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"已用时"}),o.jsx("strong",{children:s?Q_t(s,f):"-"})]}),s!=null&&s.sourceCommitSha?o.jsxs("div",{children:[o.jsx("span",{children:"源码提交"}),o.jsx("strong",{title:s.sourceCommitSha,children:s.sourceCommitSha.slice(0,12)})]}):null,w?o.jsxs("a",{href:w,target:"_blank",rel:"noreferrer",children:["在 CodePipeline 中查看 ",o.jsx(Dg,{"aria-hidden":!0})]}):null]}),o.jsxs("div",{className:"environment-build-dialog__body",children:[u?o.jsx("p",{className:"environment-build-dialog__error",role:"alert",children:u}):null,s!=null&&s.progressError?o.jsx("p",{className:"environment-build-dialog__notice",children:s.progressError}):null,o.jsx(t_t,{steps:(s==null?void 0:s.steps)??[],log:(s==null?void 0:s.logTail)??"",logError:s==null?void 0:s.logError,logTruncated:s==null?void 0:s.logTruncated,logUpdatedAt:s==null?void 0:s.logUpdatedAt,loading:l&&!!(s&&fg.has(s.status))}),(s==null?void 0:s.status)==="failed"&&s.error?o.jsx("p",{className:"environment-build-dialog__failure",role:"alert",children:s.error}):null]}),o.jsxs("footer",{className:"environment-build-dialog__actions",children:[o.jsx(It,{type:"button",color:"secondary",variant:"ghost",size:"sm",onClick:t,children:"关闭"}),s&&!e.imageSource&&!fg.has(s.status)?o.jsx(It,{type:"button",color:"info",size:"sm",disabled:m,onClick:()=>{g(!0),r().then(t).finally(()=>g(!1))},children:m?"正在启动":"重新构建"}):null]})]})}),document.body)}function Uve({cloudProvider:e,value:t,disabled:n,onChange:r}){const i=kd(e);return o.jsxs("div",{className:"environment-source-field",children:[o.jsx("span",{className:"environment-source-field__label",children:"Region"}),o.jsx(Bs,{className:"environment-region-control",value:t,"aria-label":"镜像仓库 Region",disabled:n,onChange:s=>r(s),children:i.map(s=>o.jsx(Bs.Option,{value:s.value,children:s.label},s.value))})]})}function z_t({repositoryUrl:e,gitRef:t,dockerfilePath:n,inspection:r,inspectedKey:i,disabled:s,onRepositoryUrlChange:a,onGitRefChange:l,onDockerfilePathChange:c,onInspectionChange:u,onInspectedKeyChange:d}){const[f,h]=p.useState(!1),[m,g]=p.useState(""),b=p.useRef(null),y=p.useRef(""),O=`${e.trim()}\0${t.trim()}`,v=i===O;p.useEffect(()=>()=>{const E=b.current;b.current=null,E==null||E.abort()},[]);const x=()=>{var E;(E=b.current)==null||E.abort(),b.current=null,h(!1),g(""),u(null),d(""),c(""),y.current=""},w=p.useCallback(async()=>{var _;const E=H6(e);if(E){g(E);return}y.current=O,(_=b.current)==null||_.abort();const k=new AbortController;b.current=k,h(!0),g("");try{const T=await Aoe({repositoryUrl:e.trim(),...t.trim()?{ref:t.trim()}:{}},k.signal);if(b.current!==k)return;u(T),d(O),c(T.dockerfiles.length===1?T.dockerfiles[0]:"")}catch(T){if((T==null?void 0:T.name)==="AbortError")return;g(D_t(T)),u(null),d(""),c("")}finally{b.current===k&&(b.current=null,h(!1))}},[O,t,c,d,u,e]);p.useEffect(()=>{if(s||v||y.current===O||H6(e))return;const E=window.setTimeout(()=>void w(),600);return()=>window.clearTimeout(E)},[O,s,w,v,e]);const S=v?(r==null?void 0:r.dockerfiles)??[]:[];return o.jsxs("section",{className:"environment-source-section","aria-labelledby":"environment-git-source-title",children:[o.jsxs("div",{className:"environment-source-section__header",children:[o.jsx("h2",{id:"environment-git-source-title",children:"公开代码仓库"}),o.jsx("p",{children:"输入无需鉴权的 HTTPS Git 地址后,将自动探查并列出 Dockerfile。"})]}),o.jsxs("div",{className:"environment-source-fields environment-source-fields--git",children:[o.jsxs("label",{className:"environment-source-field environment-source-field--wide",children:[o.jsx("span",{className:"environment-source-field__label",children:"Git 地址"}),o.jsx($i,{size:"lg",type:"url",value:e,placeholder:"https://github.com/owner/repository.git",autoComplete:"url",disabled:s,"aria-invalid":!!m,onChange:E=>{x(),a(E.currentTarget.value)}})]}),o.jsxs("label",{className:"environment-source-field",children:[o.jsx("span",{className:"environment-source-field__label",children:"Branch、Tag 或 Commit(可选)"}),o.jsx($i,{size:"lg",value:t,placeholder:"默认分支",autoComplete:"off",disabled:s,onChange:E=>{x(),l(E.currentTarget.value)}})]})]}),o.jsxs("div",{className:"environment-inspection-status","aria-live":"polite",children:[f?o.jsx(En,{as:"span",children:"正在拉取仓库并查找 Dockerfile"}):null,m?o.jsxs("div",{className:"environment-source-error",role:"alert",children:[o.jsx("span",{children:m}),o.jsxs(It,{type:"button",color:"primary",size:"sm",pill:!1,disabled:s,onClick:()=>void w(),children:[o.jsx(CN,{}),"重试"]})]}):null,!f&&!m&&v&&r?S.length>0?o.jsx("span",{children:r.commitSha?`已在提交 ${r.commitSha.slice(0,12)} 中找到 ${S.length} 个 Dockerfile。`:"已载入保存的 Dockerfile,可重新探查仓库更新。"}):o.jsxs("div",{className:"environment-source-error",role:"alert",children:[o.jsx("span",{children:"仓库中未找到 Dockerfile,请检查分支或仓库内容。"}),o.jsx("button",{type:"button",disabled:s,onClick:()=>void w(),children:"重新探查"})]}):null]}),S.length>0?o.jsxs("label",{className:"environment-source-field environment-dockerfile-picker",children:[o.jsx("span",{className:"environment-source-field__label",children:"Dockerfile"}),o.jsx(XE,{ariaLabel:"选择 Dockerfile",value:n,valueLabel:n,placeholder:"请选择 Dockerfile",options:S.map(E=>({value:E,label:E})),disabled:s||f,onChange:c})]}):null]})}function V_t({cloudProvider:e,mode:t,region:n,value:r,disabled:i,onModeChange:s,onRegionChange:a,onChange:l}){return o.jsxs("section",{className:"environment-source-section","aria-labelledby":"environment-output-repository-title",children:[o.jsxs("div",{className:"environment-source-section__header",children:[o.jsx("h2",{id:"environment-output-repository-title",children:"构建输出"}),o.jsx("p",{children:"CodePipeline 会把构建完成的镜像推送到所选镜像仓库。"})]}),o.jsxs(Bs,{className:"environment-repository-mode",value:t,"aria-label":"构建输出镜像仓库",disabled:i,onChange:c=>s(c),children:[o.jsx(Bs.Option,{value:"managed",children:"Studio 默认镜像仓库"}),o.jsx(Bs.Option,{value:"existing",children:"已有镜像仓库"})]}),o.jsx(Uve,{cloudProvider:e,value:n,disabled:i,onChange:a}),t==="existing"?o.jsx(Pve,{region:n,value:r,disabled:i,onChange:l}):o.jsx("p",{className:"environment-source-note",children:"构建时自动创建或复用当前 Region 的 Studio 镜像仓库。"})]})}function H_t({cloudProvider:e,region:t,repository:n,reference:r,disabled:i,onRegionChange:s,onRepositoryChange:a,onReferenceChange:l}){const c=Bve(r);return o.jsxs("section",{className:"environment-source-section","aria-labelledby":"environment-image-source-title",children:[o.jsxs("div",{className:"environment-source-section__header",children:[o.jsx("h2",{id:"environment-image-source-title",children:"已有镜像"}),o.jsx("p",{children:"绑定已由外部流水线交付到 CR 的镜像,创建后不会触发 CodePipeline 构建。"})]}),o.jsx(Uve,{cloudProvider:e,value:t,disabled:i,onChange:s}),o.jsx(Pve,{region:t,value:n,disabled:i,onChange:a}),o.jsxs("label",{className:"environment-source-field environment-image-reference",children:[o.jsx("span",{className:"environment-source-field__label",children:"Tag 或 Digest"}),o.jsx($i,{size:"lg",value:r,placeholder:"例如:latest 或 sha256:...",autoComplete:"off",disabled:i,"aria-invalid":!!c,onChange:u=>l(u.currentTarget.value)}),c?o.jsx("small",{className:"environment-source-field__error",role:"alert",children:c}):o.jsx("small",{children:"填写镜像 Tag,或以 sha256: 开头的完整 Digest。"})]})]})}function Fve(e,t,n,r){const i=p.useRef(n),s=p.useRef(r);i.current=n,s.current=r,p.useEffect(()=>{const a=document.body.style.overflow,l=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden";const c=window.requestAnimationFrame(()=>{var d;return(d=t.current)==null?void 0:d.focus()}),u=d=>{var g;if(d.key==="Escape"&&!s.current){d.preventDefault(),i.current();return}if(d.key!=="Tab")return;const f=Array.from(((g=e.current)==null?void 0:g.querySelectorAll('button:not([disabled]), textarea:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])'))??[]).filter(b=>b.getClientRects().length>0);if(!f.length)return;const h=f[0],m=f[f.length-1];d.shiftKey&&document.activeElement===h?(d.preventDefault(),m.focus()):!d.shiftKey&&document.activeElement===m&&(d.preventDefault(),h.focus())};return window.addEventListener("keydown",u),()=>{window.cancelAnimationFrame(c),document.body.style.overflow=a,window.removeEventListener("keydown",u),l!=null&&l.isConnected&&l.focus()}},[e,t])}function q_t({environment:e,onClose:t}){const n=p.useId(),r=p.useId(),i=p.useRef(null),s=p.useRef(null),[a,l]=p.useState(""),[c,u]=p.useState("loading"),[d,f]=p.useState(""),h=c==="loading";Fve(i,s,t,h);const m=async(g="",b)=>{u("loading"),f("");try{const y=g||(await Noe(e.id,b)).shareCode;l(y),await xoe(y),b!=null&&b.aborted||u("copied")}catch(y){if((y==null?void 0:y.name)==="AbortError")return;f(y instanceof Error?y.message:String(y)),u("error")}};return p.useEffect(()=>{const g=new AbortController;return m("",g.signal),()=>g.abort()},[e.id]),Tr.createPortal(o.jsx("div",{className:"environment-build-dialog__backdrop",onMouseDown:g=>{g.target===g.currentTarget&&!h&&t()},children:o.jsxs("section",{ref:i,className:"environment-share-dialog",role:"dialog","aria-modal":"true","aria-labelledby":n,"aria-describedby":r,"aria-busy":h||void 0,children:[o.jsxs("header",{className:"environment-build-dialog__header",children:[o.jsxs("div",{children:[o.jsx("h2",{id:n,children:"分享环境"}),o.jsx("p",{id:r,children:e.name})]}),o.jsx(It,{ref:s,type:"button",color:"secondary",variant:"ghost",size:"sm",uniform:!0,disabled:h,onClick:t,"aria-label":"关闭分享环境",children:o.jsx(ba,{"aria-hidden":!0})})]}),o.jsx("div",{className:"environment-share-dialog__body",children:c==="loading"?o.jsx(En,{as:"p",children:"正在生成并复制分享码"}):o.jsxs("div",{className:"environment-share-dialog__result",children:[c==="copied"?o.jsx("p",{className:"environment-share-dialog__success",role:"status","aria-live":"polite",children:"分享码已复制"}):o.jsxs("div",{className:"environment-share-dialog__error",role:"alert",children:[o.jsx("strong",{children:"分享失败"}),o.jsx("span",{children:d})]}),a?o.jsxs("label",{className:"environment-share-dialog__field environment-share-dialog__manual-code",children:[o.jsx("span",{children:"分享码"}),o.jsx(gd,{size:"lg",rows:4,value:a,readOnly:!0,"aria-label":"完整环境分享码",onFocus:g=>g.currentTarget.select(),onClick:g=>g.currentTarget.select()}),o.jsx("small",{children:c==="copied"?"分享码已自动复制,也可在这里查看或手动复制。":"自动复制失败,可手动复制上方分享码,或重试。"})]}):null,o.jsx("p",{className:"environment-share-dialog__safety",children:"分享码可能包含环境配置与本地 Skill 内容,请仅发送给可信对象。"})]})}),o.jsxs("footer",{className:"environment-build-dialog__actions",children:[o.jsx(It,{type:"button",color:"secondary",variant:"ghost",size:"sm",disabled:h,onClick:t,children:"关闭"}),c==="error"?o.jsx(It,{type:"button",color:"info",size:"sm",onClick:()=>void m(a),children:"重试"}):c==="copied"?o.jsx(It,{type:"button",color:"info",size:"sm",onClick:()=>void m(a),children:"再次复制"}):null]})]})}),document.body)}function X_t({initialValue:e,autoInspect:t,onClose:n,onImported:r}){const i=p.useId(),s=p.useId(),a=p.useId(),l=p.useRef(null),c=p.useRef(null),u=p.useRef(!1),[d,f]=p.useState(e),[h,m]=p.useState("editing"),[g,b]=p.useState([]),[y,O]=p.useState(""),[v,x]=p.useState([]),w=p.useMemo(()=>b9(d),[d]),S=w.length>$ve,E=h==="inspecting"||h==="importing",k=g.filter(M=>M.status==="valid"),_=g.filter(M=>M.status==="invalid"),T=h==="ready"&&k.length>0;Fve(l,c,n,E);const C=p.useCallback(async()=>{if(!(!w.length||S)){m("inspecting"),O(""),x([]);try{const M=await joe(w);b([...M].sort((I,$)=>I.index-$.index)),m("ready")}catch(M){O(M instanceof Error?M.message:String(M)),m("editing")}}},[w,S]);p.useEffect(()=>{!t||u.current||(u.current=!0,C())},[t,C]);const A=async()=>{if(T){m("importing"),O(""),x([]);try{const M=k.map(z=>({code:w[z.index],name:z.name})).filter(z=>!!z.code),I=await Roe(M.map(z=>z.code)),$=I.filter(z=>z.status==="created").length,N=I.filter(z=>z.status==="duplicate").length,D=new Map(I.map(z=>[z.index,z])),Q=M.flatMap(({code:z,name:B},V)=>{const W=D.get(V);return!W||W.status==="failed"?[{code:z,name:B,status:"valid",error:(W==null?void 0:W.error)||"服务未返回该分享码的导入结果。"}]:[]}),L=[..._.flatMap(z=>{const B=w[z.index];return B?[{code:B,name:"",status:"invalid",error:z.error||"分享码无效。"}]:[]}),...Q],H=new Map;if(I.forEach(z=>{z.environment&&H.set(z.environment.id,z.environment)}),r([...H.values()],$,N,L.length),!L.length){n();return}f(L.map(z=>z.code).join(` +`)),x(Q),b(L.map((z,B)=>({index:B,status:z.status,name:z.name,error:z.status==="invalid"?z.error:""}))),O(`已导入 ${$} 个环境,${L.length} 个未完成,可重试有效失败项。`),m("ready")}catch(M){O(M instanceof Error?M.message:String(M)),m("ready")}}},j=h==="inspecting"?"正在检测":h==="importing"?"正在导入":T?v.length?"重试导入":"确认导入":"检测分享码";return Tr.createPortal(o.jsx("div",{className:"environment-build-dialog__backdrop",onMouseDown:M=>{M.target===M.currentTarget&&!E&&n()},children:o.jsxs("section",{ref:l,className:"environment-share-dialog environment-import-dialog",role:"dialog","aria-modal":"true","aria-labelledby":i,"aria-describedby":s,"aria-busy":E||void 0,children:[o.jsxs("header",{className:"environment-build-dialog__header",children:[o.jsxs("div",{children:[o.jsx("h2",{id:i,children:"导入环境"}),o.jsx("p",{id:s,children:"先检测分享码中的环境,再确认添加到当前账号。"})]}),o.jsx(It,{type:"button",color:"secondary",variant:"ghost",size:"sm",uniform:!0,disabled:E,onClick:n,"aria-label":"关闭导入环境",children:o.jsx(ba,{"aria-hidden":!0})})]}),o.jsxs("div",{className:"environment-share-dialog__body",children:[o.jsxs("label",{className:"environment-share-dialog__field",children:[o.jsx("span",{children:"环境分享码"}),o.jsx(gd,{ref:c,size:"lg",rows:6,value:d,disabled:E,"aria-invalid":S||_.length>0||void 0,"aria-describedby":a,placeholder:"例如:akenv://v1/...",onChange:M=>{f(M.currentTarget.value),m("editing"),b([]),O(""),x([])}})]}),o.jsx("p",{id:a,className:`environment-share-dialog__help${S?" is-error":""}`,children:S?`最多可一次导入 20 个环境,当前检测到 ${w.length} 个分享码。`:"多个分享码可使用英文逗号、中文逗号或换行分隔,重复项会自动忽略。"}),o.jsx("p",{className:"environment-share-dialog__safety",children:"分享码可能包含环境配置与本地 Skill 内容,请仅导入可信来源的分享码。"}),h==="inspecting"?o.jsx(En,{as:"p",children:"正在检测环境分享码"}):k.length?o.jsxs("p",{className:"environment-share-dialog__summary",role:"status","aria-live":"polite",children:["检测到 ",k.length," 个环境,名称分别是:",k.map(M=>M.name||"未命名环境").join("、"),"。"]}):null,_.length?o.jsx("ul",{className:"environment-share-dialog__failures",role:"alert",children:_.map(M=>o.jsxs("li",{children:["第 ",M.index+1," 个分享码:",M.error||"分享码无效。"]},M.index))}):null,v.length?o.jsx("ul",{className:"environment-share-dialog__failures",role:"alert",children:v.map((M,I)=>o.jsxs("li",{children:["第 ",I+1," 个分享码:",M.error]},`${M.code}:${I}`))}):null,y?o.jsx("p",{className:"environment-share-dialog__error-text",role:"alert",children:y}):null]}),o.jsxs("footer",{className:"environment-build-dialog__actions",children:[o.jsx(It,{type:"button",color:"secondary",variant:"ghost",size:"sm",disabled:E,onClick:n,children:"取消"}),o.jsx(It,{type:"button",color:"info",size:"sm",loading:E,disabled:E||!w.length||S||h==="ready"&&!T,onClick:()=>T?void A():void C(),children:j})]})]})}),document.body)}function G_t({environment:e,cloudProvider:t,onCancel:n,onDelete:r,onShare:i,onSave:s}){var He,Ye,ot,Tt,Ft,At;const a=$_t(e),l=a.dockerfile!==void 0,[c,u]=p.useState(()=>({...a,dockerfile:l?void 0:a.dockerfile})),[d,f]=p.useState(a.gitSource?"git":a.imageSource?"image":l?"dockerfile":"custom"),[h,m]=p.useState("configuration"),[g,b]=p.useState(l?(e==null?void 0:e.dockerfile)??"":""),[y,O]=p.useState(l?"已保存的 Dockerfile":""),[v,x]=p.useState(""),[w,S]=p.useState(!1),[E,k]=p.useState(!1),[_,T]=p.useState(((He=a.gitSource)==null?void 0:He.repositoryUrl)??""),[C,A]=p.useState(((Ye=a.gitSource)==null?void 0:Ye.ref)??""),[j,M]=p.useState(((ot=a.gitSource)==null?void 0:ot.dockerfilePath)??""),[I,$]=p.useState(a.gitSource?{repositoryUrl:a.gitSource.repositoryUrl,ref:a.gitSource.ref??"",commitSha:"",dockerfiles:[a.gitSource.dockerfilePath]}:null),[N,D]=p.useState(a.gitSource?`${a.gitSource.repositoryUrl}\0${a.gitSource.ref??""}`:""),[Q,F]=p.useState(a.containerRepository?"existing":"managed"),[L,H]=p.useState(((Tt=a.containerRepository)==null?void 0:Tt.region)??Yr(t)),[z,B]=p.useState(a.containerRepository??void 0),[V,W]=p.useState(((Ft=a.imageSource)==null?void 0:Ft.region)??Yr(t)),[le,be]=p.useState(a.imageSource?{region:a.imageSource.region,registry:a.imageSource.registry,namespace:a.imageSource.namespace,repository:a.imageSource.repository}:void 0),[re,q]=p.useState(((At=a.imageSource)==null?void 0:At.reference)??""),G=p.useRef(null),J=p.useRef(0),de=p.useMemo(()=>H7(c),[c.baseEnvironment,c.operatingSystem,c.language,c.optionIds]),ve=c.dockerfile??de,Pe=!!e,Ae="environment-editor-form",[Ue,Ke]=p.useState(!1),[Ce,Le]=p.useState(""),pe=!!g.trim()&&!v,me=`${_.trim()}\0${C.trim()}`,we=!H6(_)&&N===me&&!!j&&(Q==="managed"||BJ(z)),Ee=BJ(le)&&!!re.trim()&&!Bve(re),st=!!c.name.trim()&&!Ue&&!w&&(d==="custom"||d==="dockerfile"&&pe||d==="git"&&we||d==="image"&&Ee);p.useEffect(()=>()=>{J.current+=1},[]);const $e=(Ge,Je)=>{u(it=>({...it,optionIds:Je?[...it.optionIds,Ge]:it.optionIds.filter(Et=>Et!==Ge)}))},ie=async Ge=>{const Je=J.current+1;J.current=Je,S(!0),x("");try{const it=await v_t(Ge);if(J.current!==Je)return;b(it.content),O(Ge.name||"Dockerfile"),x(it.error)}catch(it){if(J.current!==Je)return;b(""),O(Ge.name||"Dockerfile"),x(`无法读取 Dockerfile:${it instanceof Error?it.message:String(it)}`)}finally{J.current===Je&&S(!1),G.current&&(G.current.value="")}},ce=Ge=>{var it;const Je=(it=Ge.target.files)==null?void 0:it[0];Je&&ie(Je)},Ie=Ge=>{if(Ge.preventDefault(),k(!1),Ue||w)return;if(Ge.dataTransfer.files.length!==1){x("请一次只上传一个 Dockerfile。");return}const Je=Ge.dataTransfer.files[0];Je&&ie(Je)},We=Ge=>{b(Ge),x(Ive(Ge))},K=()=>{J.current+=1,S(!1),b(""),O(""),x(""),G.current&&(G.current.value="")},_e=async Ge=>{if(Ge.preventDefault(),!!st){Ke(!0),Le("");try{const Je=zHe(g);await s({...c,name:c.name.trim(),description:c.description.trim(),optionIds:d==="custom"?c.optionIds:[],selectedSkills:d==="custom"?c.selectedSkills:[],dockerfile:d==="dockerfile"?g:d==="custom"?ve:"",gitSource:d==="git"?{repositoryUrl:_.trim(),...C.trim()?{ref:C.trim()}:{},dockerfilePath:j}:null,containerRepository:d==="git"&&Q==="existing"?z:null,imageSource:d==="image"&&le?{...le,reference:re.trim()}:null,...d==="dockerfile"?Je:{}})}catch(Je){Le(Je instanceof Error?Je.message:String(Je)),Ke(!1)}}},Be=c.name.trim()||(Pe?(e==null?void 0:e.name)||"配置环境":"新建环境");return o.jsx(ih,{className:"environment-editor","aria-label":Pe?"环境详情":"新建环境",children:o.jsx(mE,{title:Be,description:"配置运行环境,或接入代码仓库和已有镜像",identitySeed:Be,backLabel:"返回环境列表",onBack:n,actions:o.jsxs(o.Fragment,{children:[r?o.jsx(It,{type:"button",color:"danger",variant:"ghost",size:"sm",onClick:r,disabled:Ue,children:"删除"}):null,i?o.jsx(It,{color:"secondary",variant:"soft",size:"sm",onClick:i,disabled:Ue,children:"分享"}):null,o.jsx(It,{color:"secondary",variant:"soft",size:"sm",onClick:n,disabled:Ue,children:"取消"}),o.jsx(It,{color:"info",size:"sm",type:"submit",form:Ae,disabled:!st,children:Ue?"正在保存":d==="image"?Pe?"保存环境":"创建环境":Pe?"保存并构建":"创建并构建"})]}),children:o.jsxs("form",{id:Ae,className:"environment-form",onSubmit:_e,children:[o.jsxs("div",{className:"environment-fields",children:[o.jsxs("label",{className:"environment-field",children:[o.jsx("span",{children:"环境名称"}),o.jsx($i,{className:"environment-text-input",type:"text",size:"lg",value:c.name,maxLength:60,placeholder:"例如:Python 数据处理",onChange:Ge=>u(Je=>({...Je,name:Ge.target.value}))})]}),o.jsxs("label",{className:"environment-field",children:[o.jsx("span",{children:"描述"}),o.jsx(gd,{className:"environment-description-input",size:"lg",rows:3,value:c.description,maxLength:180,placeholder:"说明这个环境适合处理的任务",onChange:Ge=>u(Je=>({...Je,description:Ge.target.value}))})]})]}),o.jsxs("fieldset",{className:"environment-creation-method",children:[o.jsx("legend",{children:"创建方式"}),o.jsxs(sa,{className:"environment-creation-options",value:d,"aria-label":"环境创建方式",onChange:Ge=>{f(Ge),Le("")},children:[o.jsxs(sa.Item,{value:"custom",block:!0,className:d==="custom"?"is-selected":"",children:[o.jsx("span",{className:"environment-creation-option__icon",children:o.jsx(sIe,{"aria-hidden":!0})}),o.jsxs("span",{className:"environment-creation-option__copy",children:[o.jsx("strong",{children:"自定义配置"}),o.jsx("span",{children:"选择基础环境、Python、工具和技能"})]})]}),o.jsxs(sa.Item,{value:"dockerfile",block:!0,className:d==="dockerfile"?"is-selected":"",children:[o.jsx("span",{className:"environment-creation-option__icon",children:o.jsx(OH,{"aria-hidden":!0})}),o.jsxs("span",{className:"environment-creation-option__copy",children:[o.jsx("strong",{children:"上传 Dockerfile"}),o.jsx("span",{children:"直接使用已有构建描述文件"})]})]}),o.jsxs(sa.Item,{value:"git",block:!0,className:d==="git"?"is-selected":"",children:[o.jsx("span",{className:"environment-creation-option__icon",children:o.jsx(j_t,{})}),o.jsxs("span",{className:"environment-creation-option__copy",children:[o.jsx("strong",{children:"从代码仓库构建"}),o.jsx("span",{children:"探查公开仓库并通过 CodePipeline 构建"})]})]}),o.jsxs(sa.Item,{value:"image",block:!0,className:d==="image"?"is-selected":"",children:[o.jsx("span",{className:"environment-creation-option__icon",children:o.jsx(R_t,{})}),o.jsxs("span",{className:"environment-creation-option__copy",children:[o.jsx("strong",{children:"使用已有镜像"}),o.jsx("span",{children:"绑定由外部流水线交付的 CR 镜像"})]})]})]})]}),Ce?o.jsx("p",{className:"environment-form-error",role:"alert",children:Ce}):null,d==="custom"?o.jsxs(o.Fragment,{children:[o.jsxs(Bs,{className:"environment-tabs",value:h,"aria-label":"自定义环境编辑内容",onChange:Ge=>m(Ge),children:[o.jsx(Bs.Option,{value:"configuration",children:"配置"}),o.jsx(Bs.Option,{value:"dockerfile",children:"描述文件"})]}),h==="configuration"?o.jsxs("div",{className:"environment-configuration",children:[o.jsxs("section",{className:"environment-section","aria-labelledby":"environment-base-title",children:[o.jsx("h2",{id:"environment-base-title",children:"基础环境"}),o.jsx(sa,{className:"environment-base-options","aria-label":"基础环境",value:c.baseEnvironment,onChange:Ge=>u(Je=>({...Je,baseEnvironment:Ge,operatingSystem:Ge==="aio-sandbox"?"ubuntu-22.04":Je.operatingSystem,language:Ge==="aio-sandbox"?"python-3.12":Je.language})),children:bhe.map(Ge=>o.jsx(sa.Item,{value:Ge.id,block:!0,className:c.baseEnvironment===Ge.id?"is-selected":"",children:o.jsxs("span",{className:"environment-base-copy",children:[o.jsx("strong",{children:Ge.label}),o.jsx("span",{children:Ge.description})]})},Ge.id))}),c.baseEnvironment==="ubuntu"?o.jsx(sa,{className:"environment-os-version-options","aria-label":"Ubuntu 版本",value:c.operatingSystem,onChange:Ge=>u(Je=>({...Je,operatingSystem:Ge})),children:VC.map(Ge=>o.jsx(sa.Item,{value:Ge.id,block:!0,className:c.operatingSystem===Ge.id?"is-selected":"",children:o.jsx("span",{className:"environment-language-copy",children:Ge.label})},Ge.id))}):null]}),o.jsxs("section",{className:"environment-section","aria-labelledby":"environment-language-title",children:[o.jsx("h2",{id:"environment-language-title",children:"语言"}),o.jsx(sa,{className:"environment-language-options","aria-label":"Python 版本",value:c.language,onChange:Ge=>u(Je=>({...Je,language:Ge})),children:yhe.filter(Ge=>c.baseEnvironment!=="aio-sandbox"||Ge.id==="python-3.12").map(Ge=>o.jsx(sa.Item,{value:Ge.id,block:!0,className:c.language===Ge.id?"is-selected":"",children:o.jsx("span",{className:"environment-language-copy",children:Ge.label})},Ge.id))})]}),o.jsxs("section",{className:"environment-section","aria-labelledby":"environment-runtime-title",children:[o.jsx("h2",{id:"environment-runtime-title",children:"执行环境"}),o.jsx("div",{className:"environment-option-grid",children:o.jsx(MJ,{name:"VeADK",description:"Agent 开发与运行框架",selected:!0,disabled:!0,onChange:()=>{},icon:o.jsx("img",{src:nj,alt:""})})})]}),o.jsxs("section",{className:"environment-section","aria-labelledby":"environment-skills-title",children:[o.jsx("h2",{id:"environment-skills-title",children:"技能"}),o.jsx(hU,{selected:c.selectedSkills,onChange:Ge=>u(Je=>({...Je,selectedSkills:Ge})),cloudProvider:t,disabled:Ue,addLabel:"添加环境技能"})]}),V7.map(Ge=>o.jsxs("section",{className:"environment-section","aria-labelledby":`environment-${Ge.id}-title`,children:[o.jsx("h2",{id:`environment-${Ge.id}-title`,children:Ge.label}),o.jsx("div",{className:"environment-option-grid",children:Ge.options.map(Je=>{const it=c.optionIds.includes(Je.id);return o.jsx(MJ,{name:Je.label,description:Je.description,selected:it,onChange:Et=>$e(Je.id,Et),icon:o.jsx(L_t,{option:Je})},Je.id)})})]},Ge.id))]}):o.jsxs("section",{className:"environment-dockerfile","aria-labelledby":"environment-dockerfile-title",children:[o.jsxs("div",{className:"environment-dockerfile__header",children:[o.jsxs("div",{children:[o.jsx("h2",{id:"environment-dockerfile-title",children:"Dockerfile"}),o.jsx("p",{children:"可直接编辑;配置页中的软件变更不会覆盖自定义内容。"})]}),c.dockerfile!==void 0?o.jsx(It,{type:"button",color:"secondary",variant:"ghost",size:"sm",onClick:()=>u(Ge=>({...Ge,dockerfile:void 0})),children:"恢复生成内容"}):null]}),o.jsx(gd,{className:"environment-dockerfile__editor",value:ve,"aria-label":"Dockerfile 内容",spellCheck:!1,onChange:Ge=>u(Je=>({...Je,dockerfile:Ge.target.value}))})]})]}):d==="dockerfile"?o.jsxs("section",{className:"environment-upload","aria-labelledby":"environment-upload-title",children:[o.jsxs("div",{className:"environment-upload__header",children:[o.jsxs("div",{children:[o.jsx("h2",{id:"environment-upload-title",children:"上传 Dockerfile"}),o.jsx("p",{id:"environment-upload-help",children:"支持任意文件名,文件上限 128 KiB。上传后可继续编辑内容。"})]}),g?o.jsx(It,{type:"button",color:"secondary",variant:"ghost",size:"sm",onClick:K,disabled:Ue,children:"移除文件"}):null]}),o.jsxs("div",{className:`environment-upload-dropzone${E?" is-dragging":""}${g?" is-ready":""}`,onDragEnter:Ge=>{Ge.preventDefault(),!Ue&&!w&&k(!0)},onDragOver:Ge=>Ge.preventDefault(),onDragLeave:Ge=>{Ge.currentTarget.contains(Ge.relatedTarget)||k(!1)},onDrop:Ie,children:[o.jsx("input",{ref:G,type:"file","aria-label":"Dockerfile 文件","aria-describedby":"environment-upload-help",disabled:Ue||w,onChange:ce}),o.jsx("span",{className:"environment-upload-dropzone__icon",children:o.jsx(OH,{"aria-hidden":!0})}),o.jsxs("span",{className:"environment-upload-dropzone__copy",children:[o.jsx("strong",{children:w?"正在读取 Dockerfile":y||"选择 Dockerfile 或拖拽到这里"}),o.jsx("span",{children:g?`${V6(g).toLocaleString("zh-CN")} 字节,点击可替换`:"Dockerfile 通常无扩展名"})]})]}),v?o.jsx("p",{className:"environment-upload__error",role:"alert",children:v}):null,g?o.jsxs("div",{className:"environment-upload__preview",children:[o.jsxs("div",{children:[o.jsx("h3",{children:"内容预览"}),o.jsxs("span",{children:[V6(g).toLocaleString("zh-CN")," / 131,072 字节"]})]}),o.jsx(gd,{className:"environment-dockerfile__editor environment-upload__editor",value:g,"aria-label":"上传的 Dockerfile 内容","aria-invalid":!!v,spellCheck:!1,onChange:Ge=>We(Ge.target.value)})]}):null]}):d==="git"?o.jsxs("div",{className:"environment-source-workflow",children:[o.jsx(z_t,{repositoryUrl:_,gitRef:C,dockerfilePath:j,inspection:I,inspectedKey:N,disabled:Ue,onRepositoryUrlChange:T,onGitRefChange:A,onDockerfilePathChange:M,onInspectionChange:$,onInspectedKeyChange:D}),o.jsx(V_t,{cloudProvider:t,mode:Q,region:L,value:z,disabled:Ue,onModeChange:Ge=>{F(Ge),Le("")},onRegionChange:Ge=>{H(Ge),B(void 0),Le("")},onChange:B})]}):o.jsx(H_t,{cloudProvider:t,region:V,repository:le,reference:re,disabled:Ue,onRegionChange:Ge=>{W(Ge),be(void 0),Le("")},onRepositoryChange:be,onReferenceChange:q})]})})})}function zve({cloudProvider:e="volcengine",onWorkspace:t,clipboardImport:n=null,clipboardReadError:r=""}){const[i,s]=p.useState([]),[a,l]=p.useState({kind:"list"}),[c,u]=p.useState(""),[d,f]=p.useState(null),[h,m]=p.useState(null),[g,b]=p.useState(null),[y,O]=p.useState(null),[v,x]=p.useState(null),w=p.useRef(0),[S,E]=p.useState(""),[k,_]=p.useState(!1),[T,C]=p.useState(r),[A,j]=p.useState(!0),[M,I]=p.useState(""),[$,N]=p.useState(0),[D,Q]=p.useState(()=>new Set),F=p.useDeferredValue(c),L=p.useMemo(()=>{const q=F.trim().toLocaleLowerCase();return q?i.filter(G=>`${G.name} ${G.description} ${z4(G.operatingSystem)} ${$f(G.language)} ${FHe(G.baseEnvironment)}`.toLocaleLowerCase().includes(q)):i},[F,i]),H=p.useCallback((q="",G=!1)=>{w.current+=1,x({key:w.current,initialValue:q,autoInspect:G})},[]),z=p.useCallback((q,G=!1)=>{const J=q.trim();if(!J.startsWith("akenv://")||!G&&LJ.has(J))return!1;const de=b9(J);return!de.length||de.length>$ve?!1:(LJ.add(J),C(""),H(J,!0),!0)},[H]),B=p.useCallback(async()=>{var q;if(!(a.kind!=="list"||v)){if(typeof navigator>"u"||!((q=navigator.clipboard)!=null&&q.readText)){C(T_t);return}try{const G=await navigator.clipboard.readText();!z(G)&&!G.trim()&&await C_t()&&C($J)}catch{C($J)}}},[v,z,a.kind]);p.useEffect(()=>{const q=new AbortController;return i.length===0&&j(!0),I(""),YS(q.signal).then(G=>{s(G)}).catch(G=>{(G==null?void 0:G.name)!=="AbortError"&&I(G instanceof Error?G.message:String(G))}).finally(()=>{q.signal.aborted||j(!1)}),()=>q.abort()},[$]),p.useEffect(()=>{if(!i.some(G=>G.latestVersion&&fg.has(G.latestVersion.status)))return;const q=window.setTimeout(()=>N(G=>G+1),2500);return()=>window.clearTimeout(q)},[i]),p.useEffect(()=>{if(!S||k)return;const q=window.setTimeout(()=>E(""),2800);return()=>window.clearTimeout(q)},[k,S]),p.useEffect(()=>{r&&C(r)},[r]),p.useEffect(()=>{n&&z(n.text)},[n,z]),p.useEffect(()=>{if(a.kind!=="list")return;const q=()=>void B(),G=()=>{document.visibilityState==="visible"&&B()},J=de=>{var Ae;const ve=de.target;if(ve instanceof HTMLInputElement||ve instanceof HTMLTextAreaElement||ve instanceof HTMLElement&&ve.isContentEditable)return;const Pe=((Ae=de.clipboardData)==null?void 0:Ae.getData("text/plain"))??"";z(Pe,!0)&&de.preventDefault()};return window.addEventListener("focus",q),document.addEventListener("visibilitychange",G),window.addEventListener("paste",J),()=>{window.removeEventListener("focus",q),document.removeEventListener("visibilitychange",G),window.removeEventListener("paste",J)}},[z,B,a.kind]);const V=a.kind==="editor"&&a.environmentId?i.find(q=>q.id===a.environmentId):void 0,W=async q=>{const G={...q,dockerfile:q.dockerfile??H7(q)},J=V?await Poe(V.id,G):await Doe(G);if(s(de=>[J,...de.filter(ve=>ve.id!==J.id)]),l({kind:"list"}),_(!1),G.imageSource){E(`环境“${J.name}”已绑定已有镜像`);return}try{const de=await qM(J.id);s(ve=>ve.map(Pe=>Pe.id===J.id?{...Pe,latestVersion:de}:Pe)),E(`环境“${J.name}”已进入构建队列`)}catch(de){_(!0),E(`环境已保存,但构建未启动:${de instanceof Error?de.message:String(de)}`)}},le=async q=>{if(!D.has(q.id)){Q(G=>new Set(G).add(q.id)),_(!1);try{const G=await qM(q.id);s(J=>J.map(de=>de.id===q.id?{...de,latestVersion:G}:de)),E(`环境“${q.name}”已进入构建队列`)}catch(G){_(!0),E(G instanceof Error?G.message:String(G))}finally{Q(G=>{const J=new Set(G);return J.delete(q.id),J})}}},be=(q,G,J,de)=>{q.length&&s(ve=>{const Pe=new Set(q.map(Ae=>Ae.id));return[...q,...ve.filter(Ae=>!Pe.has(Ae.id))]}),_(de>0),E(de>0?`已导入 ${G} 个环境,${de} 个失败`:J>0?`已导入 ${G} 个环境,${J} 个分享码已存在`:`已导入 ${G} 个环境`)},re=d?o.jsx(zl,{title:"删除环境",description:`确定删除环境“${d.name}”吗?删除后无法恢复。`,confirmLabel:"删除",variant:"danger",onCancel:()=>f(null),onConfirm:()=>{const q=d;f(null),l({kind:"list"}),Moe(q.id).then(()=>{s(G=>G.filter(J=>J.id!==q.id)),_(!1),E(`已删除环境“${q.name}”`)}).catch(G=>{_(!0),E(G instanceof Error?G.message:String(G))})}}):null;return a.kind==="editor"?o.jsxs(o.Fragment,{children:[o.jsx(G_t,{environment:V,cloudProvider:e,onCancel:()=>l({kind:"list"}),onDelete:V?()=>f(V):void 0,onShare:V?()=>O(V):void 0,onSave:W},a.environmentId??"new"),y?o.jsx(q_t,{environment:y,onClose:()=>O(null)}):null,re]}):o.jsxs(ih,{className:"environment-center","aria-label":"环境",children:[o.jsx(sO,{title:"环境"}),o.jsxs(g0,{className:"environment-toolbar",children:[t?o.jsx(gE,{items:[{id:"workspaces",label:"工作区"},{id:"environments",label:"环境"}],value:"environments",onChange:q=>{q==="workspaces"&&t()},ariaLabel:"工作区资源类型",idPrefix:"environment-center"}):null,o.jsxs("div",{className:"resource-toolbar__actions",children:[S?o.jsx("span",{className:`environment-status${k?" is-error":""}`,role:k?"alert":"status","aria-live":"polite",children:S}):null,o.jsx(Gp,{"aria-label":"搜索环境",value:c,onChange:q=>u(q.target.value),placeholder:"搜索环境"})]})]}),T?o.jsxs("div",{className:"environment-clipboard-notice",role:"alert",children:[o.jsx("span",{children:T}),o.jsx(It,{type:"button",color:"secondary",variant:"soft",size:"sm",onClick:()=>{C(""),H()},children:"手动导入"})]}):null,o.jsx(b0,{"aria-live":"polite",children:A?o.jsx(Od,{}):M?o.jsxs("div",{className:"environment-load-error",role:"alert",children:[o.jsx("p",{children:M}),o.jsx(It,{color:"secondary",variant:"soft",size:"sm",onClick:()=>N(q=>q+1),children:"重新加载"})]}):L.length===0&&c.trim()?o.jsx("div",{className:"environment-empty",children:o.jsxs(yn,{fill:"none",children:[o.jsx(yn.Icon,{children:o.jsx(P_t,{})}),o.jsx(yn.Title,{children:"没有匹配的环境"}),o.jsx(yn.Description,{children:"请尝试搜索其他名称"})]})}):o.jsxs(aO,{children:[c.trim()?null:o.jsxs(o.Fragment,{children:[o.jsx(Vg,{"aria-label":"新建环境",icon:o.jsx(N_t,{}),onClick:()=>l({kind:"editor",environmentId:null}),children:"新建环境"}),o.jsx(Vg,{"aria-label":"导入环境",icon:o.jsx(I_t,{}),onClick:()=>H(),children:"导入环境"})]}),L.map(q=>{var ve,Pe;const G=Qve(q),J=!!(q.latestVersion&&fg.has(q.latestVersion.status)),de=D.has(q.id);return o.jsx(OE,{className:"environment-card",title:q.name,status:o.jsx(Js,{color:G.color,size:"sm",children:G.label}),description:((ve=q.latestVersion)==null?void 0:ve.error)||(J?(Pe=q.latestVersion)==null?void 0:Pe.currentStep:"")||q.description||"暂无描述",metadata:[{label:"更新",value:B_t(q.updatedAt)}],action:{label:q.latestVersion?"构建详情":de?"正在启动":"开始构建",icon:"play",title:"构建",disabled:de,onClick:()=>q.latestVersion?m(q.id):void le(q)},auxiliaryAction:{label:"查看环境 Manifest",icon:o.jsx(mRe,{}),title:q.latestVersion?"查看 Manifest":"尚无可用 Manifest",disabled:!q.latestVersion,onClick:()=>b(q)},detailAction:{label:"配置",onClick:()=>l({kind:"editor",environmentId:q.id})}},q.id)})]})}),h?(()=>{const q=i.find(G=>G.id===h);return q?o.jsx(F_t,{environment:q,onClose:()=>m(null),onBuildUpdate:G=>{s(J=>J.map(de=>de.id===q.id?{...de,latestVersion:G}:de))},onRebuild:()=>le(q)}):null})():null,g!=null&&g.latestVersion?o.jsx(U_t,{environment:g,onClose:()=>b(null)}):null,re,v?o.jsx(X_t,{initialValue:v.initialValue,autoInspect:v.autoInspect,onClose:()=>x(null),onImported:be},v.key):null]})}function W_t(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",...e,children:o.jsx("path",{d:"M8 3.25v9.5M3.25 8h9.5"})})}function Y_t(e){return o.jsxs("svg",{viewBox:"0 0 32 32",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"4.5",y:"7",width:"23",height:"18",rx:"3"}),o.jsx("path",{d:"M10 7V5.5A1.5 1.5 0 0 1 11.5 4h4A1.5 1.5 0 0 1 17 5.5V7M9 13h5v5H9zM18 13h5M18 17h5M9 22h14"})]})}function q6(e){const t=Date.parse(e);return Number.isNaN(t)?e:new Intl.DateTimeFormat("zh-CN",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(t)}function Z_t(e,t){return e.environmentIds.reduce((n,r)=>{var i,s;return((s=(i=t.get(r))==null?void 0:i.latestVersion)==null?void 0:s.status)==="available"?n+1:n},0)}function K_t({workspace:e,environments:t,onBack:n,onSave:r,onDelete:i}){const[s,a]=p.useState((e==null?void 0:e.name)??""),[l,c]=p.useState((e==null?void 0:e.description)??""),[u,d]=p.useState((e==null?void 0:e.environmentIds)??[]),[f,h]=p.useState(""),[m,g]=p.useState(!1),[b,y]=p.useState(""),O=f.trim().toLocaleLowerCase(),v=t.filter(w=>`${w.name} ${w.description} ${$f(w.language)}`.toLocaleLowerCase().includes(O)),x=async w=>{if(w.preventDefault(),!(!s.trim()||m)){g(!0),y("");try{await r({name:s.trim(),description:l.trim(),environmentIds:u})}catch(S){y(S instanceof Error?S.message:String(S)),g(!1)}}};return o.jsx(ih,{className:"workspace-center","aria-label":e?"工作区详情":"新建工作区",children:o.jsxs(mE,{title:e?e.name:"新建工作区",description:"将常用环境组合在一起;同一个环境可以加入多个工作区。",identitySeed:(e==null?void 0:e.name)||"新建工作区",backLabel:"返回工作区列表",onBack:n,actions:o.jsxs(o.Fragment,{children:[i?o.jsx("button",{type:"button",className:"is-danger",onClick:i,children:"删除"}):null,o.jsx("button",{type:"submit",form:"workspace-form",disabled:m||!s.trim(),children:m?"保存中":"保存"})]}),children:[e?o.jsxs(G7,{children:[o.jsxs("div",{children:[o.jsx("dt",{children:"环境"}),o.jsxs("dd",{children:[u.length," 个"]})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"创建时间"}),o.jsx("dd",{children:q6(e.createdAt)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"最近更新"}),o.jsx("dd",{children:q6(e.updatedAt)})]})]}):null,o.jsxs("form",{id:"workspace-form",className:"workspace-form",onSubmit:x,children:[o.jsxs("section",{className:"workspace-fields","aria-label":"基本信息",children:[o.jsxs("label",{children:[o.jsx("span",{children:"名称"}),o.jsx($i,{value:s,maxLength:128,autoFocus:!0,onChange:w=>a(w.target.value),placeholder:"例如:内容生产"})]}),o.jsxs("label",{children:[o.jsx("span",{children:"描述"}),o.jsx(gd,{value:l,maxLength:2e3,onChange:w=>c(w.target.value),placeholder:"说明这个工作区的用途"})]})]}),o.jsxs("section",{className:"workspace-environments",children:[o.jsx(Qhe,{title:"环境",description:`已选择 ${u.length} 个,可在其他工作区中继续复用`,actions:o.jsx(Gp,{"aria-label":"搜索可用环境",value:f,onChange:w=>h(w.target.value),placeholder:"搜索环境"})}),t.length===0?o.jsxs("div",{className:"workspace-environment-empty",children:[o.jsx("p",{children:"还没有可添加的环境"}),o.jsx("span",{children:"请先在“环境”页面创建并构建环境。"})]}):v.length===0?o.jsxs("div",{className:"workspace-environment-empty",children:[o.jsx("p",{children:"没有匹配的环境"}),o.jsx("span",{children:"请尝试搜索其他名称。"})]}):o.jsx("div",{className:"workspace-environment-list",children:v.map(w=>{var k;const S=u.includes(w.id),E=((k=w.latestVersion)==null?void 0:k.status)==="available"?"可用":w.latestVersion?"构建中":"未构建";return o.jsxs("label",{className:`workspace-environment-option${S?" is-selected":""}`,children:[o.jsx("input",{type:"checkbox",checked:S,onChange:()=>d(_=>S?_.filter(T=>T!==w.id):[..._,w.id])}),o.jsxs("span",{className:"workspace-environment-option__copy",children:[o.jsx("strong",{title:w.name,children:w.name}),o.jsxs("span",{children:[$f(w.language)," · ",E]})]}),o.jsx("span",{className:"workspace-environment-option__action",children:S?"已添加":"添加"})]},w.id)})})]}),b?o.jsx("p",{className:"workspace-form-error",role:"alert",children:b}):null]})]})})}function J_t({onEnvironment:e}){const[t,n]=p.useState([]),[r,i]=p.useState([]),[s,a]=p.useState({kind:"list"}),[l,c]=p.useState(""),[u,d]=p.useState(!0),[f,h]=p.useState(""),[m,g]=p.useState(""),[b,y]=p.useState(!1),[O,v]=p.useState(null),[x,w]=p.useState(0),S=p.useDeferredValue(l);p.useEffect(()=>{const T=new AbortController;return d(!0),h(""),Promise.all([x9(T.signal),YS(T.signal)]).then(([C,A])=>{n(C),i(A)}).catch(C=>{(C==null?void 0:C.name)!=="AbortError"&&h(C instanceof Error?C.message:String(C))}).finally(()=>{T.signal.aborted||d(!1)}),()=>T.abort()},[x]),p.useEffect(()=>{if(!m||b)return;const T=window.setTimeout(()=>g(""),2800);return()=>window.clearTimeout(T)},[b,m]);const E=p.useMemo(()=>new Map(r.map(T=>[T.id,T])),[r]),k=p.useMemo(()=>{const T=S.trim().toLocaleLowerCase();return T?t.filter(C=>{const A=C.environmentIds.map(j=>{var M;return((M=E.get(j))==null?void 0:M.name)??""}).join(" ");return`${C.name} ${C.description} ${A}`.toLocaleLowerCase().includes(T)}):t},[S,E,t]),_=s.kind==="detail"&&s.workspaceId?t.find(T=>T.id===s.workspaceId):void 0;return s.kind==="detail"?o.jsx(K_t,{workspace:_,environments:r,onBack:()=>a({kind:"list"}),onDelete:_?()=>v(_):null,onSave:async T=>{const C=_?await Toe(_.id,T):await _oe(T);n(A=>[C,...A.filter(j=>j.id!==C.id)]),y(!1),g(`已保存工作区“${C.name}”`),a({kind:"list"})}},s.workspaceId??"new"):o.jsxs(ih,{className:"workspace-center","aria-label":"工作区",children:[o.jsx(sO,{title:"工作区"}),o.jsxs(g0,{children:[o.jsx(gE,{items:[{id:"workspaces",label:"工作区"},{id:"environments",label:"环境"}],value:"workspaces",onChange:T=>{T==="environments"&&e()},ariaLabel:"工作区资源类型",idPrefix:"workspace-center"}),o.jsxs("div",{className:"resource-toolbar__actions",children:[m?o.jsx("span",{className:`workspace-status${b?" is-error":""}`,role:b?"alert":"status","aria-live":"polite",children:m}):null,o.jsx(Gp,{"aria-label":"搜索工作区",value:l,onChange:T=>c(T.target.value),placeholder:"搜索工作区"})]})]}),o.jsx(b0,{"aria-live":"polite",children:u?o.jsx(Od,{}):f?o.jsxs("div",{className:"workspace-load-error",role:"alert",children:[o.jsx("p",{children:f}),o.jsx(It,{color:"secondary",variant:"soft",size:"sm",onClick:()=>w(T=>T+1),children:"重新加载"})]}):k.length===0&&l.trim()?o.jsx("div",{className:"workspace-empty",children:o.jsxs(yn,{fill:"none",children:[o.jsx(yn.Icon,{children:o.jsx(Y_t,{})}),o.jsx(yn.Title,{children:"没有匹配的工作区"}),o.jsx(yn.Description,{children:"请尝试搜索其他名称或环境"})]})}):o.jsxs(aO,{children:[l.trim()?null:o.jsx(Vg,{"aria-label":"新建工作区",icon:o.jsx(W_t,{}),onClick:()=>a({kind:"detail",workspaceId:null}),children:"新建工作区"}),k.map(T=>{const C=Z_t(T,E),A=T.environmentIds.filter(j=>!E.has(j)).length;return o.jsx(OE,{className:"workspace-card",title:T.name,status:o.jsx(Js,{color:A?"danger":C===T.environmentIds.length&&C>0?"success":"secondary",size:"sm",children:T.environmentIds.length===0?"未添加环境":A?"环境缺失":`${C}/${T.environmentIds.length} 可用`}),description:T.description||"暂无描述",metadata:[{label:"环境",value:`${T.environmentIds.length} 个环境`},{label:"可用",value:`${C} 个可用`},{label:"更新",value:q6(T.updatedAt)}],detailAction:{label:"管理",onClick:()=>a({kind:"detail",workspaceId:T.id})},action:{label:"添加环境",icon:"plus",onClick:()=>a({kind:"detail",workspaceId:T.id})}},T.id)})]})}),O?o.jsx(zl,{title:"删除工作区",description:`确定删除工作区“${O.name}”吗?环境本身不会被删除。`,confirmLabel:"删除",variant:"danger",onCancel:()=>v(null),onConfirm:()=>{const T=O;v(null),Coe(T.id).then(()=>{n(C=>C.filter(A=>A.id!==T.id)),y(!1),g(`已删除工作区“${T.name}”`),a({kind:"list"})}).catch(C=>{y(!0),g(C instanceof Error?C.message:String(C))})}}):null]})}function eTt({cloudProvider:e}){const[t,n]=p.useState("workspaces"),[r,i]=p.useState(null),[s,a]=p.useState(""),l=p.useRef(0),c=()=>{var f;l.current+=1;const u=l.current;a("");let d=null;if(typeof navigator<"u"&&((f=navigator.clipboard)!=null&&f.readText))try{d=navigator.clipboard.readText()}catch{a("未能读取剪贴板。请允许剪贴板权限,或点击“导入环境”后手动粘贴分享码。")}else a("当前浏览器无法自动读取剪贴板;请点击“导入环境”后手动粘贴分享码。");n("environments"),d&&d.then(async h=>{var m;if(l.current===u){if(h.trim()){i({key:u,text:h});return}try{const g=await((m=navigator.permissions)==null?void 0:m.query({name:"clipboard-read"}));l.current===u&&(g==null?void 0:g.state)==="denied"&&a("未能读取剪贴板。请允许剪贴板权限,或点击“导入环境”后手动粘贴分享码。")}catch{}}}).catch(()=>{l.current===u&&a("未能读取剪贴板。请允许剪贴板权限,或点击“导入环境”后手动粘贴分享码。")})};return t==="environments"?o.jsx(zve,{cloudProvider:e,onWorkspace:()=>n("workspaces"),clipboardImport:r,clipboardReadError:s}):o.jsx(J_t,{onEnvironment:c})}function tTt(e){return e==="127.0.0.1"}const nTt={id:"coding-agents",kind:"coding-agent",category:"development",icon:"coding-agents",name:"配置 Coding Agents",badge:"本地",badgeTone:"success",description:"将 VeADK 和 AgentKit 内置 Skills 全局配置到 Trae、Claude Code 或 Codex。"},rTt={id:"feishu",kind:"feishu",category:"channels",icon:"feishu",name:"飞书机器人",badge:"Beta",description:"创建飞书机器人,并将消息直接接入 AgentKit Runtime。"},iTt="https://api.github.com",sTt=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/,UJ=/^[A-Za-z0-9][A-Za-z0-9._/-]{0,199}$/,aTt=/^[A-Za-z0-9._/-]+$/;function oTt(e,t,n){return e===401||e===403?"GitHub Token 无效或没有仓库写入权限":e===404?"仓库、分支或文件不存在,或 Token 无权访问":e===422?"GitHub 拒绝了提交,请检查分支和文件状态":String((t==null?void 0:t.message)||"").split(n).join("***").trim().slice(0,240)||`GitHub 请求失败(HTTP ${e})`}async function Dm(e,t){const n={Accept:"application/vnd.github+json",Authorization:`Bearer ${t.token}`,"X-GitHub-Api-Version":"2022-11-28"};t.body&&(n["Content-Type"]="application/json");let r;try{r=await fetch(`${iTt}${e}`,{method:t.method||"GET",headers:n,body:t.body?JSON.stringify(t.body):void 0,signal:t.signal})}catch(s){throw t.signal.aborted?s:new Error("连接 GitHub 失败,请检查网络后重试")}const i=await r.json().catch(()=>null);if(!t.expected.includes(r.status))throw new Error(oTt(r.status,i,t.token));return{status:r.status,payload:i}}function FP(e){return e.split("/").map(encodeURIComponent).join("/")}function lTt(e){const t=new TextEncoder().encode(e);let n="";const r=32768;for(let i=0;i({...h,path:pU(h.path,"")})),s=AbortSignal.any([t,AbortSignal.timeout(6e4)]),a=`/repos/${n}`;await Dm(`${a}`,{token:e.token,expected:[200],signal:s});const c=(f=(await Dm(`${a}/git/ref/heads/${FP(r)}`,{token:e.token,expected:[200],signal:s})).payload.object)==null?void 0:f.sha;if(!c)throw new Error("目标分支缺少有效 Git SHA");const u=cTt(e.branchPrefix);await Dm(`${a}/git/refs`,{token:e.token,expected:[201],signal:s,method:"POST",body:{ref:`refs/heads/${u}`,sha:c}});let d=!0;try{for(const m of i){const g=FP(m.path),b=await Dm(`${a}/contents/${g}?ref=${encodeURIComponent(r)}`,{token:e.token,expected:[200,404],signal:s});if(m.mustBeNew&&b.status===200)throw new Error(`目标仓库中已存在 ${m.path},未覆盖现有文件`);if(b.status===200&&!b.payload.sha)throw new Error(`目标路径 ${m.path} 不是可更新的文件`);await Dm(`${a}/contents/${g}`,{token:e.token,expected:[200,201],signal:s,method:"PUT",body:{message:m.commitMessage,content:lTt(m.content),branch:u,...b.payload.sha?{sha:b.payload.sha}:{}}})}const h=await Dm(`${a}/pulls`,{token:e.token,expected:[201],signal:s,method:"POST",body:{title:e.title,head:u,base:r,body:e.description}});if(!h.payload.number||!h.payload.html_url)throw new Error("GitHub 未返回有效的 Pull Request");return d=!1,{number:h.payload.number,url:h.payload.html_url,branch:u}}finally{d&&await Dm(`${a}/git/refs/heads/${FP(u)}`,{token:e.token,expected:[204],signal:AbortSignal.timeout(15e3),method:"DELETE"}).catch(()=>{})}}const gU={name:"repository",label:"GitHub Repo",placeholder:"owner/repository",help:"支持 owner/repository 或完整 github.com URL",required:!0},bU={name:"baseBranch",label:"目标分支",placeholder:"main",help:"留空时使用 main,PR 将以此分支为 base",required:!1},Hve={name:"runtimeName",label:"Runtime 名称",placeholder:"support-agent",help:"用于 AgentKit 发布配置",required:!0},qve={name:"runtimeId",label:"Runtime ID",placeholder:"rt-xxxxxxxx",help:"持续更新的目标 AgentKit Runtime",required:!0},uTt="https://ark.cn-beijing.volces.com/api/coding/v3";function dTt(e){return e==="byteplus"?Jo(e):uTt}function vR(e){return e==="byteplus"?{accessKey:"BYTEPLUS_ACCESS_KEY",secretKey:"BYTEPLUS_SECRET_KEY",sessionToken:"BYTEPLUS_SESSION_TOKEN"}:{accessKey:"VOLCENGINE_ACCESS_KEY",secretKey:"VOLCENGINE_SECRET_KEY",sessionToken:"VOLCENGINE_SESSION_TOKEN"}}function yU(e){const t=vR(e);return[`${t.accessKey}、${t.secretKey}(必填)`,`${t.sessionToken}(使用临时凭据时必填)`]}function OU(e){return e==="byteplus"?"BytePlus":"Volcengine"}function xU(e,t={}){return{repository:"",baseBranch:"main",projectPath:".",runtimeName:"",runtimeId:"",sandboxToolId:"",modelName:"",modelBaseUrl:dTt(e),region:Yr(e),token:"",...t}}function vU(e){return{repository:e.repository.trim(),baseBranch:e.baseBranch.trim()||"main",region:e.region,token:e.token.trim()}}const fTt=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/,hTt=/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/;function pTt(e){if(!fTt.test(e.sandboxToolId))throw new Error("Sandbox Tool ID 格式不正确");if(!hTt.test(e.modelName))throw new Error("模型名称格式不正确");let t;try{t=new URL(e.modelBaseUrl)}catch{throw new Error("模型 API 地址必须是安全的 HTTPS URL")}if(t.protocol!=="https:"||!t.hostname||t.username||t.password||t.search||t.hash)throw new Error("模型 API 地址必须是安全的 HTTPS URL")}function mTt(e){pTt(e);const t=e.cloudProvider??"volcengine",n=vR(t),r=t==="byteplus"?` VOLCENGINE_ACCESS_KEY: \${{ secrets.${n.accessKey} }} VOLCENGINE_SECRET_KEY: \${{ secrets.${n.secretKey} }} VOLCENGINE_SESSION_TOKEN: \${{ secrets.${n.sessionToken} }}`:"",i=t==="byteplus"?` BYTEPLUS_REGION: ${JSON.stringify(e.region)}`:` VOLCENGINE_REGION: ${JSON.stringify(e.region)}`,s=String.raw`name: PR Automated Review @@ -896,12 +896,12 @@ __PROVIDER_REGION_ENV__ gh pr review "__GH__ github.event.pull_request.number }}" \ --comment \ --body-file review-body.md -`,a={__GH__:"${{",__REGION__:JSON.stringify(e.region),__CLOUD_PROVIDER__:JSON.stringify(t),__ACCESS_KEY_SECRET__:n.accessKey,__SECRET_KEY_SECRET__:n.secretKey,__SESSION_TOKEN_SECRET__:n.sessionToken,__BYTEPLUS_COMPATIBILITY_ENV__:r,__PROVIDER_REGION_ENV__:i,__SANDBOX_TOOL_ID__:JSON.stringify(e.sandboxToolId),__MODEL_NAME__:JSON.stringify(e.modelName),__MODEL_BASE_URL__:JSON.stringify(e.modelBaseUrl)};return Object.entries(a).reduce((l,[c,u])=>l.split(c).join(u),s)}const bTt={id:"review",kind:"github",category:"development",icon:"github",name:"PR 自动评审",description:"在隔离 Sandbox 中评审代码变更,并将结果发布到 Pull Request。",title:"PR 自动评审",subtitle:"在隔离 Sandbox 中检查代码变更并把结果发布到 Pull Request",panel:"工作流仅评审同仓库的非草稿 PR;fork PR 不会读取仓库 Secrets。",submitLabel:"添加评审并提交 PR",fields:[gU,bU,{name:"sandboxToolId",label:"Sandbox Tool ID",placeholder:"tool-xxxxxxxx",help:"用于运行每次评审的 AgentKit CodeEnv",required:!0},{name:"modelName",label:"评审模型",placeholder:"review-model",help:"注入 Sandbox 的代码评审模型名称",required:!0},{name:"modelBaseUrl",label:"模型 API 地址",placeholder:"https://ark.example.com/api/v3",help:"必须使用 OpenAI 兼容的 HTTPS 地址",required:!0}],initialValues:({cloudProvider:e})=>xU(e),regionHelp:"必须与 Sandbox Tool 所在地域一致",secrets:({cloudProvider:e})=>{const[t,n]=yU(e);return[t,"CODEX_MODEL_API_KEY(必填)",n]},submit(e,t,n){const r=vU(e);return mU({...r,files:[{path:".github/workflows/codex-pr-review.yml",content:gTt({sandboxToolId:e.sandboxToolId.trim(),modelName:e.modelName.trim(),modelBaseUrl:e.modelBaseUrl.trim(),region:r.region,cloudProvider:t.cloudProvider}),commitMessage:"chore: configure PR automated review"}],branchPrefix:"chore/pr-automated-review",title:"chore: 配置 PR 自动评审",description:"新增 GitHub Actions 工作流,在隔离 Sandbox 中评审同仓库 PR,并将结果发布为 GitHub Review。合并前请配置工作流所需 Secrets。"},n)}},yTt=/^[A-Za-z0-9_-]+$/,Xve=4,qA=64,XA=6,FJ="agent-runtime";function Gve(e){const t=e.trim();if(!t)return FJ;let n=t.replace(/[^A-Za-z0-9_-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").slice(0,qA);return n?(n.lengthqA?"Runtime 名称长度须为 4-64 个字符":null:"Runtime 名称只能包含英文字母、数字、下划线和连字符":"Runtime 名称为必填项"}const vTt=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/,wTt="cn-hongkong";function STt(e){const t=qE(e.runtimeName);if(t)throw new Error(t);if(!vTt.test(e.runtimeId))throw new Error("Runtime ID 格式不正确")}function Yve(e){STt(e);const t=e.cloudProvider??"volcengine",n=vR(t),r=t==="byteplus"?` +`,a={__GH__:"${{",__REGION__:JSON.stringify(e.region),__CLOUD_PROVIDER__:JSON.stringify(t),__ACCESS_KEY_SECRET__:n.accessKey,__SECRET_KEY_SECRET__:n.secretKey,__SESSION_TOKEN_SECRET__:n.sessionToken,__BYTEPLUS_COMPATIBILITY_ENV__:r,__PROVIDER_REGION_ENV__:i,__SANDBOX_TOOL_ID__:JSON.stringify(e.sandboxToolId),__MODEL_NAME__:JSON.stringify(e.modelName),__MODEL_BASE_URL__:JSON.stringify(e.modelBaseUrl)};return Object.entries(a).reduce((l,[c,u])=>l.split(c).join(u),s)}const gTt={id:"review",kind:"github",category:"development",icon:"github",name:"PR 自动评审",description:"在隔离 Sandbox 中评审代码变更,并将结果发布到 Pull Request。",title:"PR 自动评审",subtitle:"在隔离 Sandbox 中检查代码变更并把结果发布到 Pull Request",panel:"工作流仅评审同仓库的非草稿 PR;fork PR 不会读取仓库 Secrets。",submitLabel:"添加评审并提交 PR",fields:[gU,bU,{name:"sandboxToolId",label:"Sandbox Tool ID",placeholder:"tool-xxxxxxxx",help:"用于运行每次评审的 AgentKit CodeEnv",required:!0},{name:"modelName",label:"评审模型",placeholder:"review-model",help:"注入 Sandbox 的代码评审模型名称",required:!0},{name:"modelBaseUrl",label:"模型 API 地址",placeholder:"https://ark.example.com/api/v3",help:"必须使用 OpenAI 兼容的 HTTPS 地址",required:!0}],initialValues:({cloudProvider:e})=>xU(e),regionHelp:"必须与 Sandbox Tool 所在地域一致",secrets:({cloudProvider:e})=>{const[t,n]=yU(e);return[t,"CODEX_MODEL_API_KEY(必填)",n]},submit(e,t,n){const r=vU(e);return mU({...r,files:[{path:".github/workflows/codex-pr-review.yml",content:mTt({sandboxToolId:e.sandboxToolId.trim(),modelName:e.modelName.trim(),modelBaseUrl:e.modelBaseUrl.trim(),region:r.region,cloudProvider:t.cloudProvider}),commitMessage:"chore: configure PR automated review"}],branchPrefix:"chore/pr-automated-review",title:"chore: 配置 PR 自动评审",description:"新增 GitHub Actions 工作流,在隔离 Sandbox 中评审同仓库 PR,并将结果发布为 GitHub Review。合并前请配置工作流所需 Secrets。"},n)}},bTt=/^[A-Za-z0-9_-]+$/,Xve=4,qA=64,XA=6,FJ="agent-runtime";function Gve(e){const t=e.trim();if(!t)return FJ;let n=t.replace(/[^A-Za-z0-9_-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").slice(0,qA);return n?(n.lengthqA?"Runtime 名称长度须为 4-64 个字符":null:"Runtime 名称只能包含英文字母、数字、下划线和连字符":"Runtime 名称为必填项"}const xTt=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/,vTt="cn-hongkong";function wTt(e){const t=GE(e.runtimeName);if(t)throw new Error(t);if(!xTt.test(e.runtimeId))throw new Error("Runtime ID 格式不正确")}function Yve(e){wTt(e);const t=e.cloudProvider??"volcengine",n=vR(t),r=t==="byteplus"?` VOLCENGINE_ACCESS_KEY: \${{ secrets.${n.accessKey} }} VOLCENGINE_SECRET_KEY: \${{ secrets.${n.secretKey} }} VOLCENGINE_SESSION_TOKEN: \${{ secrets.${n.sessionToken} }} BYTEPLUS_REGION: ${JSON.stringify(e.region)}`:"",i=t==="byteplus"?` - "DATABASE_VIKING_REGION": ${JSON.stringify(wTt)},`:"",s=`name: Publish to AgentKit Runtime + "DATABASE_VIKING_REGION": ${JSON.stringify(vTt)},`:"",s=`name: Publish to AgentKit Runtime on: push: @@ -1008,8 +1008,8 @@ jobs: if not result.success: raise SystemExit(f"AgentKit publish failed: {result.error}") PY -`,a={__BASE_BRANCH__:JSON.stringify(e.baseBranch),__PROJECT_PATH__:JSON.stringify(e.projectPath),__RUNTIME_NAME__:JSON.stringify(e.runtimeName),__RUNTIME_ID__:JSON.stringify(e.runtimeId),__REGION__:JSON.stringify(e.region),__CLOUD_PROVIDER__:JSON.stringify(t),__ACCESS_KEY_SECRET__:n.accessKey,__SECRET_KEY_SECRET__:n.secretKey,__SESSION_TOKEN_SECRET__:n.sessionToken,__BYTEPLUS_ENV__:r,__BYTEPLUS_RUNTIME_ENV__:i,__CONCURRENCY_GROUP__:JSON.stringify(`agentkit-runtime-${e.runtimeId}`)};return Object.entries(a).reduce((l,[c,u])=>l.split(c).join(u),s)}const ETt={id:"delivery",kind:"github",category:"development",icon:"github",name:"AgentKit Runtime 持续交付",description:"为您的仓库添加持续交付到 AgentKit Runtime 的自动化工作流。",title:"AgentKit Runtime 持续交付",subtitle:"用 Pull Request 把持续发布配置安全地加入代码仓库",panel:"提交后将在目标仓库创建发布分支,并发起包含 GitHub Actions 工作流的 PR。",submitLabel:"确定并提交 PR",fields:[gU,bU,{name:"projectPath",label:"Agent 项目目录",placeholder:".",help:"留空时使用仓库根目录;目录内需包含挂载完整 Studio App Server 的 app.py",required:!1},Hve,qve],initialValues:({cloudProvider:e})=>xU(e),regionHelp:"必须与目标 Runtime 所在地域一致",secrets:({cloudProvider:e})=>yU(e),submit(e,t,n){const r=vU(e),i=pU(e.projectPath,"."),s=OU(t.cloudProvider);return mU({...r,files:[{path:".github/workflows/publish-agentkit.yml",content:Yve({baseBranch:r.baseBranch,projectPath:i,runtimeName:e.runtimeName.trim(),runtimeId:e.runtimeId.trim(),region:r.region,cloudProvider:t.cloudProvider}),commitMessage:"feat: publish Agent to AgentKit Runtime"}],branchPrefix:"feat/agentkit-release",title:"feat: 持续发布到 AgentKit Runtime",description:`新增 GitHub Actions 工作流,在目标分支更新时持续发布到 AgentKit Runtime。合并前请配置工作流所需的 ${s} Secrets。`},n)}};function kTt(e,t){return e==="."?t:`${e}/${t}`}function _Tt(e){return`.github/workflows/publish-agentkit-${e.replace(/[^A-Za-z0-9]+/g,"-").replace(/^-|-$/g,"").toLowerCase()||"root"}.yml`}const TTt={volcengine:"agentkit-prod-public-cn-beijing.cr.volces.com/base/py-simple:python3.12-bookworm-slim-latest",byteplus:"agentkit-prod-public-ap-southeast-1.cr.bytepluses.com/base/py-simple:python3.12-bookworm-slim-latest"},CTt="1.1.9",ATt=["https://repo.huaweicloud.com/repository/pypi/simple","https://mirrors.aliyun.com/pypi/simple/","https://pypi.org/simple"];function NTt(e){return e!=="volcengine"?"RUN uv pip install -r requirements.txt":`RUN ${ATt.map(n=>`uv pip install --index-url ${n} -r requirements.txt`).join(` || \\ - `)}`}function jTt(e){const t=vR(e);return`# Local ${OU(e)} credentials. Never commit real values. +`,a={__BASE_BRANCH__:JSON.stringify(e.baseBranch),__PROJECT_PATH__:JSON.stringify(e.projectPath),__RUNTIME_NAME__:JSON.stringify(e.runtimeName),__RUNTIME_ID__:JSON.stringify(e.runtimeId),__REGION__:JSON.stringify(e.region),__CLOUD_PROVIDER__:JSON.stringify(t),__ACCESS_KEY_SECRET__:n.accessKey,__SECRET_KEY_SECRET__:n.secretKey,__SESSION_TOKEN_SECRET__:n.sessionToken,__BYTEPLUS_ENV__:r,__BYTEPLUS_RUNTIME_ENV__:i,__CONCURRENCY_GROUP__:JSON.stringify(`agentkit-runtime-${e.runtimeId}`)};return Object.entries(a).reduce((l,[c,u])=>l.split(c).join(u),s)}const STt={id:"delivery",kind:"github",category:"development",icon:"github",name:"AgentKit Runtime 持续交付",description:"为您的仓库添加持续交付到 AgentKit Runtime 的自动化工作流。",title:"AgentKit Runtime 持续交付",subtitle:"用 Pull Request 把持续发布配置安全地加入代码仓库",panel:"提交后将在目标仓库创建发布分支,并发起包含 GitHub Actions 工作流的 PR。",submitLabel:"确定并提交 PR",fields:[gU,bU,{name:"projectPath",label:"Agent 项目目录",placeholder:".",help:"留空时使用仓库根目录;目录内需包含挂载完整 Studio App Server 的 app.py",required:!1},Hve,qve],initialValues:({cloudProvider:e})=>xU(e),regionHelp:"必须与目标 Runtime 所在地域一致",secrets:({cloudProvider:e})=>yU(e),submit(e,t,n){const r=vU(e),i=pU(e.projectPath,"."),s=OU(t.cloudProvider);return mU({...r,files:[{path:".github/workflows/publish-agentkit.yml",content:Yve({baseBranch:r.baseBranch,projectPath:i,runtimeName:e.runtimeName.trim(),runtimeId:e.runtimeId.trim(),region:r.region,cloudProvider:t.cloudProvider}),commitMessage:"feat: publish Agent to AgentKit Runtime"}],branchPrefix:"feat/agentkit-release",title:"feat: 持续发布到 AgentKit Runtime",description:`新增 GitHub Actions 工作流,在目标分支更新时持续发布到 AgentKit Runtime。合并前请配置工作流所需的 ${s} Secrets。`},n)}};function ETt(e,t){return e==="."?t:`${e}/${t}`}function kTt(e){return`.github/workflows/publish-agentkit-${e.replace(/[^A-Za-z0-9]+/g,"-").replace(/^-|-$/g,"").toLowerCase()||"root"}.yml`}const _Tt={volcengine:"agentkit-prod-public-cn-beijing.cr.volces.com/base/py-simple:python3.12-bookworm-slim-latest",byteplus:"agentkit-prod-public-ap-southeast-1.cr.bytepluses.com/base/py-simple:python3.12-bookworm-slim-latest"},TTt="1.1.9",CTt=["https://repo.huaweicloud.com/repository/pypi/simple","https://mirrors.aliyun.com/pypi/simple/","https://pypi.org/simple"];function ATt(e){return e!=="volcengine"?"RUN uv pip install -r requirements.txt":`RUN ${CTt.map(n=>`uv pip install --index-url ${n} -r requirements.txt`).join(` || \\ + `)}`}function NTt(e){const t=vR(e);return`# Local ${OU(e)} credentials. Never commit real values. ${t.accessKey}= ${t.secretKey}= # ${t.sessionToken}= @@ -1020,13 +1020,13 @@ AGENTKIT_CLOUD_PROVIDER=${e} # Optional model overrides. # MODEL_AGENT_PROVIDER=openai # MODEL_AGENT_NAME=${Kf(e)} -# MODEL_AGENT_API_BASE=${el(e)} +# MODEL_AGENT_API_BASE=${Jo(e)} # MODEL_AGENT_API_KEY= # Optional Feishu Channel credentials. Studio can create and bind these. FEISHU_APP_ID= FEISHU_APP_SECRET= -`}function RTt(e,t="volcengine"){const n={"app.py":`"""__PROJECT_NAME__ — a VeADK agent with the full Studio App Server.""" +`}function jTt(e,t="volcengine"){const n={"app.py":`"""__PROJECT_NAME__ — a VeADK agent with the full Studio App Server.""" from assistant import root_agent from veadk.integrations.agentkit import create_agentkit_app, run_agentkit_app @@ -1070,19 +1070,19 @@ root_agent = Agent( instruction="You are a helpful assistant. Use your tools when relevant.", tools=[get_city_weather], ) -`,"requirements.txt":`veadk-python==${CTt} +`,"requirements.txt":`veadk-python==${TTt} agentkit-sdk-python==0.8.4 google-adk==2.1.0 lark-channel-sdk==1.2.0 lark-oapi==1.7.3 starlette==0.52.1 -`,Dockerfile:`FROM ${TTt[t]} +`,Dockerfile:`FROM ${_Tt[t]} ENV UV_SYSTEM_PYTHON=1 UV_COMPILE_BYTECODE=1 PYTHONUNBUFFERED=1 WORKDIR /app COPY requirements.txt ./ -${NTt(t)} +${ATt(t)} COPY . . @@ -1107,7 +1107,7 @@ and local short-term memory fallback. Pushes to the configured target branch are continuously published by the GitHub Actions workflow added with this project. -`,".env.example":jTt(t),".gitignore":`__pycache__/ +`,".env.example":NTt(t),".gitignore":`__pycache__/ *.pyc .venv/ .env @@ -1121,7 +1121,7 @@ __pycache__/ Dockerfile .dockerignore README.md -`};return Object.fromEntries(Object.entries(n).map(([r,i])=>[r,i.split("__PROJECT_NAME__").join(e)]))}const ITt={id:"template",kind:"github",category:"development",icon:"github",name:"模板项目导入",description:"在您的仓库中创建一个可持续交付到 AgentKit Runtime 的最简智能体",title:"模板项目导入",subtitle:"把可直接启动 Studio 的 basic Agent 和持续交付配置加入仓库",panel:"提交后将创建一个 PR,同时导入 basic 项目和 AgentKit Runtime 发布工作流。",submitLabel:"导入模板并提交 PR",fields:[gU,bU,{name:"projectPath",label:"Agent 项目目录",placeholder:"agentkit-basic-agent",help:"将在此目录新增 basic 项目;app.py 挂载完整 Studio App Server,并作为服务入口启动",required:!0},Hve,qve],initialValues:({cloudProvider:e})=>xU(e,{projectPath:"agentkit-basic-agent"}),regionHelp:"必须与目标 Runtime 所在地域一致",secrets:({cloudProvider:e})=>yU(e),submit(e,t,n){const r=vU(e),i=Vve(r.repository),s=pU(e.projectPath,"agentkit-basic-agent"),a=s==="."?i.split("/").slice(-1)[0]||"agentkit-basic-agent":s.split("/").slice(-1)[0]||"agentkit-basic-agent",l=Object.entries(RTt(a,t.cloudProvider)).map(([c,u])=>({path:kTt(s,c),content:u,commitMessage:"feat: import AgentKit basic template",mustBeNew:!0}));return l.push({path:_Tt(s),content:Yve({baseBranch:r.baseBranch,projectPath:s,runtimeName:e.runtimeName.trim(),runtimeId:e.runtimeId.trim(),region:r.region,cloudProvider:t.cloudProvider}),commitMessage:"feat: add AgentKit Runtime delivery",mustBeNew:!0}),mU({...r,repository:i,files:l,branchPrefix:"feat/agentkit-basic-template",title:"feat: 导入 AgentKit basic 模板",description:`导入带有 AgentKit Studio App Server 的 basic Agent 项目,并添加持续发布到 AgentKit Runtime 的工作流。合并前请配置 ${OU(t.cloudProvider)} Secrets。`},n)}},DTt={id:"website-integration",kind:"website-integration",category:"channels",icon:"website-integration",name:"网站集成",description:"将 AgentKit Runtime 以悬浮聊天窗口嵌入网站。"},zJ=[{id:"development",label:"研发"},{id:"channels",label:"消息渠道"}],Zve=[rTt,ITt,ETt,bTt,iTt,DTt],PTt=new Map(Zve.map(e=>[e.id,e]));function Kve(e){const t=PTt.get(e);if(!t)throw new Error(`Unknown automation: ${e}`);return t}function MTt(e){const t=Kve(e);if(t.kind!=="github")throw new Error(`Automation is not backed by GitHub: ${e}`);return t}function VJ(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"10.8",cy:"10.8",r:"6.2",stroke:"currentColor",strokeWidth:"1.7"}),o.jsx("path",{d:"m15.4 15.4 4 4",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})]})}function LTt(e){return o.jsxs("svg",{viewBox:"0 0 36 36",fill:"none","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"5",width:"18",height:"18",rx:"5",fill:"currentColor",opacity:"0.1"}),o.jsx("rect",{x:"3.5",y:"5",width:"18",height:"18",rx:"5",stroke:"currentColor",strokeWidth:"1.6"}),o.jsx("path",{d:"m9.2 11.2-2.8 2.7 2.8 2.7M12.1 17.4h4.3",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("circle",{cx:"26.5",cy:"12",r:"3",fill:"hsl(var(--background))",stroke:"currentColor",strokeWidth:"1.6"}),o.jsx("circle",{cx:"27",cy:"26.5",r:"3",fill:"hsl(var(--background))",stroke:"currentColor",strokeWidth:"1.6"}),o.jsx("path",{d:"M21.5 12h2M19.3 21l5.6 3.8M27 15v8.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})]})}function $Tt(e){return o.jsxs("svg",{viewBox:"0 0 36 36",fill:"none","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"5",width:"22",height:"18",rx:"4",stroke:"currentColor",strokeWidth:"1.6"}),o.jsx("path",{d:"M4.5 10h20M9 7.5h.1M12 7.5h.1",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),o.jsx("path",{d:"M18 18.5c0-3 2.5-5.5 5.5-5.5h3c3 0 5.5 2.5 5.5 5.5v5c0 3-2.5 5.5-5.5 5.5H25l-4 3v-3.6a5.5 5.5 0 0 1-3-4.9v-5Z",fill:"hsl(var(--background))",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),o.jsx("path",{d:"M22 19.5h6M22 23h4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})]})}function BTt({onOpen:e}){var u;const[t,n]=p.useState("development"),[r,i]=p.useState(""),s=p.useDeferredValue(r),a=p.useMemo(()=>{const d=s.trim().toLocaleLowerCase();return Zve.filter(f=>f.category===t).filter(f=>!d||`${f.name} ${f.description}`.toLocaleLowerCase().includes(d))},[t,s]),l=(u=zJ.find(d=>d.id===t))==null?void 0:u.label,c=nTt(window.location.hostname);return o.jsxs("div",{className:"applications-page",children:[o.jsxs("header",{className:"applications-header",children:[o.jsxs("div",{children:[o.jsx("h1",{children:"自动化"}),o.jsx("p",{children:"连接研发工具,为智能体扩展自动化工作流"})]}),o.jsxs("label",{className:"applications-search",children:[o.jsx(VJ,{}),o.jsx("input",{type:"search","aria-label":"搜索自动化",value:r,onChange:d=>i(d.target.value),placeholder:"搜索自动化"})]})]}),o.jsx("nav",{className:"applications-categories","aria-label":"自动化分类",children:zJ.map(d=>o.jsx("button",{type:"button",className:t===d.id?"is-active":"","aria-pressed":t===d.id,onClick:()=>n(d.id),children:d.label},d.id))}),o.jsx("section",{className:"applications-results","aria-label":`${l}自动化列表`,children:a.length?o.jsx("div",{className:"applications-grid",children:a.map(d=>{const f=d.id==="coding-agents"&&!c,h=f?"coding-agents-local-only-tooltip":void 0;return o.jsxs("div",{className:`application-card-wrap${f?" is-disabled":""}`,tabIndex:f?0:void 0,"aria-describedby":h,children:[o.jsxs("button",{type:"button",className:"application-card",onClick:()=>e(d.id),"aria-label":`打开${d.name}`,disabled:f,children:[d.icon==="feishu"?o.jsx("img",{className:"application-card-icon application-card-brand-icon",src:xR,alt:"","aria-hidden":"true"}):d.icon==="coding-agents"?o.jsx(LTt,{className:"application-card-icon"}):d.icon==="website-integration"?o.jsx($Tt,{className:"application-card-icon"}):o.jsx(fU,{className:"application-card-icon"}),o.jsxs("div",{className:"application-card-copy",children:[o.jsxs("div",{className:"application-card-title",children:[o.jsx("h2",{children:d.name}),d.badge?o.jsx("span",{className:`application-card-badge is-${d.badgeTone||"default"}`,children:d.badge}):null]}),o.jsx("p",{children:d.description})]})]}),f?o.jsx("span",{id:h,className:"application-card-tooltip",role:"tooltip",children:"仅本地部署可用"}):null]},d.id)})}):o.jsxs("div",{className:"applications-empty",role:"status",children:[o.jsx(VJ,{}),o.jsx("h2",{children:"没有匹配的自动化"}),o.jsx("p",{children:"请尝试搜索其他名称"})]})})]})}const QTt="_Container_1bl61_1",UTt="_Track_1bl61_16",FTt="_Thumb_1bl61_56",zTt="_Label_1bl61_78",c_={Container:QTt,Track:UTt,Thumb:FTt,Label:zTt},X6=({className:e,label:t,id:n,disabled:r,labelPosition:i="end",...s})=>{const a=p.useId(),l=n??a;return o.jsxs("div",{className:ur(c_.Container,e),"data-disabled":r?"":void 0,"data-has-label":t?"":void 0,"data-label-position":i,children:[o.jsx($Le,{id:l,className:c_.Track,disabled:r,...s,children:o.jsx(QLe,{className:c_.Thumb})}),t&&o.jsx("label",{htmlFor:l,className:c_.Label,children:t})]})};function t0({message:e,className:t="",onRetry:n,retryLabel:r="重试部署",defaultExpanded:i=!0}){const[s,a]=p.useState(i),[l,c]=p.useState(!1),u=async()=>{if(!(!n||l)){c(!0);try{await n()}finally{c(!1)}}};return o.jsxs("div",{className:`deploy-error-message${s?" is-expanded":""}${t?` ${t}`:""}`,role:"alert",children:[o.jsx("p",{className:"deploy-error-message-text",children:e}),o.jsxs("div",{className:"deploy-error-message-actions",children:[n&&o.jsxs(Nt,{type:"button",className:"deploy-error-retry",color:"danger",variant:"soft",size:"sm",pill:!1,loading:l,onClick:()=>void u(),children:[!l&&o.jsx(iRe,{}),l?"重试中…":r]}),o.jsx(Nt,{type:"button",color:"secondary",variant:"ghost",size:"sm",uniform:!0,pill:!1,title:s?"收起错误信息":"展开完整错误信息","aria-label":s?"收起错误信息":"展开完整错误信息",onClick:()=>a(d=>!d),children:s?o.jsx(cRe,{}):o.jsx(pRe,{})}),o.jsx(q7,{copyValue:e,color:"secondary",variant:"ghost",size:"sm",uniform:!0,pill:!1,title:"复制完整错误信息","aria-label":"复制完整错误信息",children:({copied:d})=>d?o.jsx(Zy,{}):o.jsx(J8,{})})]})]})}const VTt={queued:"已排队",pending:"准备中",running:"执行中",retrying:"自动重试中",success:"成功",failed:"失败",cancelled:"已取消",skipped:"已跳过"},Jve=["周日","周一","周二","周三","周四","周五","周六"];function G6(e){if(!e)return"-";const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).format(t).replace(/\//g,"-")}function HTt(e){if(!e.startedAt)return"-";const t=Date.parse(e.startedAt),n=e.finishedAt?Date.parse(e.finishedAt):Date.now();if(!Number.isFinite(t)||!Number.isFinite(n)||n{const u=n.current;!u||r.current||l(u.scrollHeight>u.clientHeight+1)},[]);return p.useLayoutEffect(()=>{r.current=i,i||c()},[i,c,e]),p.useEffect(()=>{const u=n.current;if(!u||typeof ResizeObserver>"u")return;const d=new ResizeObserver(c);return d.observe(u),()=>d.disconnect()},[c]),o.jsxs("div",{className:`cronjobs-run-output-body${i?" is-expanded":""}`,children:[o.jsx("p",{id:t,ref:n,children:e}),a?o.jsx(Nt,{type:"button",className:"cronjobs-run-output-toggle",color:"secondary",variant:"ghost",size:"sm",pill:!1,"aria-expanded":i,"aria-controls":t,onClick:()=>s(u=>!u),children:i?"收起":"展开"}):null]})}const Y6="Asia/Shanghai",XTt=3e3,GTt=["Asia/Shanghai","Asia/Singapore","Asia/Tokyo","Europe/London","America/Los_Angeles","America/New_York","UTC"];function WTt(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||Y6}catch{return Y6}}function YTt(){const e=WTt(),t=new Date(Date.now()+24*60*60*1e3);return t.setSeconds(0,0),{name:"",runtimeId:"",prompt:"",scheduleType:"daily",onceAt:new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,16),time:"09:00",weekday:1,cron:"0 9 * * *",timezone:e,enabled:!0}}function ZTt(e){return{name:e.name,runtimeId:e.runtimeId,prompt:e.prompt,scheduleType:e.schedule.type,onceAt:e.schedule.onceAt??"",time:e.schedule.time??"09:00",weekday:e.schedule.weekday??1,cron:e.schedule.cron??"0 9 * * *",timezone:e.schedule.timezone||Y6,enabled:e.enabled}}function KTt({run:e}){const t=e?e.status==="success"?"success":e.status==="failed"?"danger":["queued","pending","running","retrying"].includes(e.status)?"info":"secondary":"secondary";return o.jsx(ta,{className:"cronjobs-status",color:t,variant:"soft",size:"sm",pill:!0,children:e?VTt[e.status]:"尚未执行"})}function HJ({job:e,runtimes:t,cloudProvider:n,busy:r,onClose:i,onSubmit:s}){const[a,l]=p.useState(()=>e?ZTt(e):YTt()),[c,u]=p.useState(""),[d,f]=p.useState(!1),h=p.useRef(null),m=p.useRef(null),g=p.useRef(null),b=r||d,y=p.useRef(b),O=p.useRef(i),v=p.useMemo(()=>Array.from(new Set([a.timezone,...GTt])),[a.timezone]),x=p.useMemo(()=>t.map(k=>({value:k.runtimeId,label:k.name,description:Zf(k.region,n)})),[n,t]),w=p.useMemo(()=>Jve.map((k,_)=>({value:String(_),label:k})),[]),S=p.useMemo(()=>v.map(k=>({value:k,label:k})),[v]);p.useEffect(()=>{y.current=b,O.current=i},[b,i]),p.useEffect(()=>{var T;const k=document.body.style.overflow,_=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(T=m.current)==null||T.focus();const C=A=>{var N,D;if(A.key==="Escape"&&!y.current){O.current();return}if(A.key!=="Tab")return;const j=Array.from(((N=h.current)==null?void 0:N.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'))??[]).filter(Q=>!Q.hidden&&Q.getClientRects().length>0);if(j.length===0){A.preventDefault();return}const L=j[0],I=j[j.length-1],M=document.activeElement;A.shiftKey&&(M===L||!((D=h.current)!=null&&D.contains(M)))?(A.preventDefault(),I.focus()):!A.shiftKey&&M===I&&(A.preventDefault(),L.focus())};return window.addEventListener("keydown",C),()=>{document.body.style.overflow=k,window.removeEventListener("keydown",C),_!=null&&_.isConnected&&_.focus()}},[]);const E=async k=>{k.preventDefault();const _=a.name.trim(),C=a.prompt.trim(),T=t.find(j=>j.runtimeId===a.runtimeId);if(!_)return u("请输入任务名称。");if(!T)return u("请选择可用的 Runtime Agent。");if(!C)return u("请输入每次执行时发送给 Agent 的文本。");if(a.scheduleType==="once"&&!a.onceAt||(a.scheduleType==="daily"||a.scheduleType==="weekly")&&!a.time)return u("请选择执行时间。");const A=a.cron.trim().split(/\s+/);if(a.scheduleType==="cron"&&A.length!==5)return u("Cron 表达式需要包含 5 个字段,例如 0 9 * * *。");u(""),f(!0);try{let j=(e==null?void 0:e.runtimeId)===T.runtimeId?e.agentName.trim():"";if(!j){const[L]=await XS("","",{runtimeId:T.runtimeId,region:T.region});j=(L==null?void 0:L.trim())??""}if(!j)throw new Error("Runtime Agent 未返回可调用的 appName,请确认 Runtime 已就绪且版本兼容。");await s({name:_,runtimeId:T.runtimeId,runtimeName:T.name,agentName:j,region:T.region,prompt:C,enabled:a.enabled,schedule:{type:a.scheduleType,timezone:a.timezone,...a.scheduleType==="once"?{onceAt:a.onceAt}:{},...a.scheduleType==="daily"?{time:a.time}:{},...a.scheduleType==="weekly"?{time:a.time,weekday:a.weekday}:{},...a.scheduleType==="cron"?{cron:a.cron.trim()}:{}}})}catch(j){u(j instanceof Error?j.message:String(j)),window.requestAnimationFrame(()=>{var L;return(L=g.current)==null?void 0:L.focus()})}finally{f(!1)}};return o.jsx("div",{className:"cronjobs-drawer-backdrop",onMouseDown:k=>{k.target===k.currentTarget&&!b&&i()},children:o.jsxs("aside",{ref:h,className:"cronjobs-drawer",role:"dialog","aria-modal":"true","aria-labelledby":"cronjobs-drawer-title",children:[o.jsxs("header",{className:"cronjobs-drawer-head",children:[o.jsxs("div",{children:[o.jsx("h2",{id:"cronjobs-drawer-title",children:e?"编辑定时任务":"创建定时任务"}),o.jsx("p",{children:"每次触发都会为 Runtime Agent 创建独立 Session。"})]}),o.jsx(Nt,{type:"button",color:"secondary",variant:"ghost",size:"lg",uniform:!0,pill:!1,onClick:i,disabled:b,"aria-label":"关闭抽屉",children:o.jsx(e9,{})})]}),o.jsxs("form",{className:"cronjobs-form",onSubmit:k=>void E(k),children:[o.jsxs("div",{className:"cronjobs-form-scroll",children:[o.jsxs("label",{className:"cronjobs-field",children:[o.jsx("span",{children:"任务名称"}),o.jsx(Li,{ref:m,size:"lg",value:a.name,maxLength:80,invalid:!!c&&!a.name.trim(),onChange:k=>l({...a,name:k.target.value}),placeholder:"例如:每日生成运营摘要"})]}),o.jsxs("label",{className:"cronjobs-field",children:[o.jsx("span",{children:"Runtime Agent"}),o.jsx(Xo,{value:a.runtimeId,options:x,size:"lg",disabled:t.length===0,placeholder:t.length?"选择 Runtime Agent":"暂无可用 Runtime",onChange:k=>l({...a,runtimeId:k.value})}),o.jsx("small",{children:"任务始终跟随该 Runtime 当前生效版本。"})]}),o.jsxs("label",{className:"cronjobs-field",children:[o.jsx("span",{children:"执行文本"}),o.jsx(pd,{value:a.prompt,rows:5,maxRows:10,autoResize:!0,maxLength:2e4,invalid:!!c&&!a.prompt.trim(),onChange:k=>l({...a,prompt:k.target.value}),placeholder:"输入每次执行时发送给 Agent 的固定文本"}),o.jsxs("small",{className:"cronjobs-character-count",children:[a.prompt.length.toLocaleString()," / 20,000"]})]}),o.jsxs("fieldset",{className:"cronjobs-fieldset",children:[o.jsx("legend",{children:"执行计划"}),o.jsxs(Fs,{className:"cronjobs-schedule-types",value:a.scheduleType,size:"lg",block:!0,"aria-label":"执行计划类型",onChange:k=>l({...a,scheduleType:k}),children:[o.jsx(Fs.Option,{value:"once",children:"一次性"}),o.jsx(Fs.Option,{value:"daily",children:"每天"}),o.jsx(Fs.Option,{value:"weekly",children:"每周"}),o.jsx(Fs.Option,{value:"cron",children:"Cron"})]}),a.scheduleType==="once"?o.jsxs("label",{className:"cronjobs-field",children:[o.jsx("span",{children:"执行时间"}),o.jsx(Li,{size:"lg",type:"datetime-local",value:a.onceAt,onChange:k=>l({...a,onceAt:k.target.value})})]}):null,a.scheduleType==="daily"?o.jsxs("label",{className:"cronjobs-field",children:[o.jsx("span",{children:"每天执行时间"}),o.jsx(Li,{size:"lg",type:"time",value:a.time,onChange:k=>l({...a,time:k.target.value})})]}):null,a.scheduleType==="weekly"?o.jsxs("div",{className:"cronjobs-inline-fields",children:[o.jsxs("label",{className:"cronjobs-field",children:[o.jsx("span",{children:"星期"}),o.jsx(Xo,{value:String(a.weekday),options:w,size:"lg",onChange:k=>l({...a,weekday:Number(k.value)})})]}),o.jsxs("label",{className:"cronjobs-field",children:[o.jsx("span",{children:"执行时间"}),o.jsx(Li,{size:"lg",type:"time",value:a.time,onChange:k=>l({...a,time:k.target.value})})]})]}):null,a.scheduleType==="cron"?o.jsxs("label",{className:"cronjobs-field",children:[o.jsx("span",{children:"Cron 表达式"}),o.jsx(Li,{size:"lg",value:a.cron,onChange:k=>l({...a,cron:k.target.value}),placeholder:"0 9 * * *"}),o.jsx("small",{children:"依次填写分钟、小时、日期、月份、星期。"})]}):null,o.jsxs("label",{className:"cronjobs-field",children:[o.jsx("span",{children:"时区"}),o.jsx(Xo,{value:a.timezone,options:S,size:"lg",onChange:k=>l({...a,timezone:k.value})})]})]}),o.jsxs("div",{className:"cronjobs-switch-row",children:[o.jsxs("span",{children:[o.jsx("strong",{children:"创建后启用"}),o.jsx("small",{children:"启用后会从下一个计划时间开始执行。"})]}),o.jsx(X6,{checked:a.enabled,onCheckedChange:k=>l({...a,enabled:k}),"aria-label":"创建后启用"})]}),c?o.jsx("div",{ref:g,className:"cronjobs-inline-error",tabIndex:-1,children:o.jsx(zg,{color:"danger",variant:"soft",description:c})}):null]}),o.jsxs("footer",{className:"cronjobs-drawer-actions",children:[o.jsx(Nt,{type:"button",color:"secondary",variant:"ghost",size:"lg",pill:!1,onClick:i,disabled:b,children:"取消"}),o.jsx(Nt,{type:"submit",color:"primary",size:"lg",pill:!1,loading:b,disabled:t.length===0,"aria-busy":b||void 0,children:d?"正在连接 Runtime…":r?"保存中…":e?"保存更改":"创建任务"})]})]})]})})}function JTt({jobs:e,canCreate:t,onCreate:n,onSelect:r}){return o.jsxs(aO,{children:[o.jsx(Vg,{icon:o.jsx(Tae,{}),onClick:n,disabled:!t,title:t?"创建定时任务":"暂无可用的 Runtime Agent",children:"创建定时任务"}),e.map(i=>{const s=ewe(i.schedule);return o.jsx(bE,{className:"cronjobs-card",title:i.name,status:o.jsx(ta,{color:i.enabled?"success":"secondary",variant:"soft",size:"sm",pill:!0,children:i.enabled?"已启用":"已暂停"}),description:i.prompt,metadata:[{label:"执行计划",value:s,title:s}],detailAction:{label:"查看详情",onClick:()=>r(i)}},i.jobId)})]})}function eCt({job:e,runs:t,runsLoading:n,runsError:r,busyAction:i,onBack:s,onEdit:a,onToggle:l,onRun:c,onDelete:u,onCancel:d,onRetryRun:f,onRetryRuns:h}){const m=t.find(b=>b.status==="queued"||b.status==="running"||b.status==="retrying"||b.status==="pending")??(W6(e)?e.latestRun:void 0),g=i.includes(e.jobId);return o.jsxs("div",{className:"cronjobs-detail",children:[o.jsxs("header",{className:"cronjobs-detail-head",children:[o.jsxs("div",{className:"cronjobs-detail-title",children:[o.jsx(Nt,{type:"button",color:"secondary",variant:"ghost",size:"lg",uniform:!0,pill:!1,onClick:s,"aria-label":"返回定时任务列表",children:o.jsx(nRe,{})}),o.jsxs("div",{children:[o.jsx("h1",{children:e.name}),o.jsxs("p",{children:[e.runtimeName||e.agentName," · ",ewe(e.schedule)]})]})]}),o.jsxs("div",{className:"cronjobs-detail-actions",children:[o.jsxs(Nt,{type:"button",color:"secondary",variant:"outline",size:"lg",pill:!1,onClick:a,disabled:g,children:[o.jsx(hRe,{}),"编辑"]}),o.jsxs(Nt,{type:"button",color:"secondary",variant:"outline",size:"lg",pill:!1,onClick:l,disabled:g,children:[e.enabled?o.jsx(ORe,{}):o.jsx(bH,{}),e.enabled?"暂停":"启用"]}),m?o.jsxs(Nt,{type:"button",color:"danger",variant:"soft",size:"lg",pill:!1,onClick:()=>d(m),disabled:g||!!m.cancellationRequestedAt,children:[o.jsx(ERe,{}),m.cancellationRequestedAt?m.status==="queued"?"取消中…":"终止中…":m.status==="queued"?"取消排队":"终止本次执行"]}):o.jsxs(Nt,{type:"button",color:"primary",size:"lg",pill:!1,onClick:c,disabled:g||!e.enabled,children:[o.jsx(bH,{}),"立即执行"]}),o.jsx(vo,{compact:!0,content:m?m.status==="queued"?"请先取消排队":"请先终止当前执行":"删除任务",children:o.jsxs(Nt,{type:"button",color:"danger",variant:"ghost",size:"lg",pill:!1,onClick:u,disabled:g||!!m,"aria-label":"删除任务",children:[o.jsx(uRe,{}),"删除"]})})]})]}),o.jsxs("div",{className:"cronjobs-detail-scroll",children:[o.jsxs("section",{className:"cronjobs-summary-grid","aria-label":"任务配置",children:[o.jsxs("dl",{children:[o.jsxs("div",{children:[o.jsx("dt",{children:"任务状态"}),o.jsx("dd",{children:e.enabled?"已启用":"已暂停"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"下次执行"}),o.jsx("dd",{children:e.enabled?G6(e.nextRunAt):"-"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"Runtime"}),o.jsx("dd",{title:e.runtimeName,children:e.runtimeName})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"地域"}),o.jsx("dd",{children:e.region})]})]}),o.jsxs("div",{className:"cronjobs-prompt",children:[o.jsx("span",{children:"执行文本"}),o.jsx("p",{children:e.prompt})]})]}),o.jsxs("section",{className:"cronjobs-history",children:[o.jsxs("header",{children:[o.jsxs("div",{children:[o.jsx("h2",{children:"执行历史"}),o.jsx("p",{children:"每次运行均使用独立 Session,结果与错误会永久保留。"})]}),o.jsx(vo,{compact:!0,content:"刷新",children:o.jsx(Nt,{type:"button",color:"secondary",variant:"ghost",size:"lg",uniform:!0,pill:!1,onClick:h,disabled:n,"aria-label":"刷新执行历史",children:o.jsx(CN,{})})})]}),n&&t.length===0?o.jsx(bd,{}):r?o.jsx(zg,{className:"cronjobs-history-alert",color:"danger",variant:"soft",title:"无法加载执行历史",description:r,actions:o.jsx(Nt,{type:"button",color:"danger",variant:"soft",size:"sm",pill:!1,onClick:h,children:"重试"})}):t.length===0?o.jsxs(xn,{className:"cronjobs-history-state",fill:"none",children:[o.jsx(xn.Icon,{children:o.jsx(K8,{})}),o.jsx(xn.Title,{children:"暂无执行记录"}),o.jsx(xn.Description,{children:"任务触发或立即执行后,记录会显示在这里。"})]}):o.jsx("div",{className:"cronjobs-runs",children:t.map(b=>o.jsxs("article",{className:"cronjobs-run",children:[o.jsxs("div",{className:"cronjobs-run-main",children:[o.jsx(KTt,{run:b}),o.jsxs("div",{children:[o.jsx("strong",{children:G6(b.startedAt||b.scheduledAt)}),o.jsxs("span",{children:["耗时 ",HTt(b),b.runtimeVersion?` · Runtime v${b.runtimeVersion}`:""]})]})]}),b.sessionId?o.jsxs("div",{className:"cronjobs-run-meta",children:[o.jsx("span",{children:"Session"}),o.jsx("strong",{title:b.sessionId,children:b.sessionId})]}):null,b.output?o.jsxs("div",{className:"cronjobs-run-output",children:[o.jsx("span",{children:"最终回答"}),o.jsx(qTt,{output:b.output})]}):null,b.error?o.jsxs("div",{className:"cronjobs-run-output is-error",children:[o.jsx("span",{children:"错误详情"}),o.jsx(t0,{message:b.error,className:"cronjobs-run-error-detail",defaultExpanded:!1,onRetry:b.status==="failed"?f:void 0,retryLabel:"重新执行"})]}):null,b.status==="queued"||b.status==="running"||b.status==="retrying"||b.status==="pending"?o.jsx(Nt,{type:"button",className:"cronjobs-run-cancel",color:"danger",variant:"soft",size:"sm",pill:!1,onClick:()=>d(b),disabled:g||!!b.cancellationRequestedAt,loading:!!b.cancellationRequestedAt,children:b.cancellationRequestedAt?"终止中…":b.status==="queued"?"取消排队":"终止执行"}):null]},b.runId))})]})]})]})}function tCt({cloudProvider:e}){const[t,n]=p.useState([]),[r,i]=p.useState([]),[s,a]=p.useState(!0),[l,c]=p.useState(""),[u,d]=p.useState(""),[f,h]=p.useState(void 0),[m,g]=p.useState([]),[b,y]=p.useState(!1),[O,v]=p.useState(""),[x,w]=p.useState(""),[S,E]=p.useState("all"),[k,_]=p.useState(""),[C,T]=p.useState(null),[A,j]=p.useState(""),L=t.find(Z=>Z.jobId===u),I=S==="all"?t:t.filter(Z=>S==="enabled"?Z.enabled:!Z.enabled),M=p.useCallback(async Z=>{a(!0),c("");try{const[ce,be]=await Promise.all([GM(Z),H1({scope:"all",region:"all",pageSize:100})]);if(Z!=null&&Z.aborted)return;n(ce),i(be.runtimes.filter(ie=>ie.status.toLowerCase()==="ready"))}catch(ce){if(Z!=null&&Z.aborted)return;c(ce instanceof Error?ce.message:String(ce))}finally{Z!=null&&Z.aborted||a(!1)}},[]);p.useEffect(()=>{const Z=new AbortController;return M(Z.signal),()=>Z.abort()},[M]);const N=p.useCallback(async(Z,ce)=>{y(!0),v("");try{const be=await WM(Z,ce);ce!=null&&ce.aborted||g(be)}catch(be){ce!=null&&ce.aborted||v(be instanceof Error?be.message:String(be))}finally{ce!=null&&ce.aborted||y(!1)}},[]);p.useEffect(()=>{if(!u){g([]),v("");return}const Z=new AbortController;return N(u,Z.signal),()=>Z.abort()},[N,u]);const D=t.some(W6);p.useEffect(()=>{!D&&k.includes("已排队")&&_("")},[D,k]),p.useEffect(()=>{if(!D)return;const Z=new AbortController,ce=async()=>{try{const[ie,q]=await Promise.all([GM(Z.signal),u?WM(u,Z.signal):Promise.resolve(null)]);if(Z.signal.aborted)return;n(ie),q&&g(q),ie.some(W6)||_("")}catch(ie){Z.signal.aborted||_(ie instanceof Error?ie.message:String(ie))}},be=window.setInterval(()=>void ce(),XTt);return()=>{window.clearInterval(be),Z.abort()}},[D,u]);const Q=Z=>n(ce=>ce.some(be=>be.jobId===Z.jobId)?ce.map(be=>be.jobId===Z.jobId?Z:be):[Z,...ce]),F=async(Z,ce,be,ie=!1)=>{w(Z),_("");try{await ce(),_(be)}catch(q){const X=q instanceof Error?q.message:String(q);if(ie)throw new Error(X);_(X)}finally{w("")}},$=async Z=>{const ce=f??null;await F(`${(ce==null?void 0:ce.jobId)??"new"}:save`,async()=>{const be=ce?await nle(ce.jobId,Z):await tle(Z);Q(be),h(void 0),ce&&d(be.jobId)},ce?"任务已更新。":"任务已创建。",!0)},H=Z=>void F(`${Z.jobId}:toggle`,async()=>Q(await rle(Z.jobId,!Z.enabled)),Z.enabled?"任务已暂停。":"任务已启用。"),z=(Z,ce)=>F(`${Z.jobId}:run`,async()=>{const be=await ile(Z.jobId);Q({...Z,latestRun:be}),u===Z.jobId&&g(ie=>[be,...ie.filter(q=>q.runId!==be.runId)])},ce),B=Z=>void z(Z,"任务已排队,将在一分钟内开始执行。"),V=()=>{if(!C)return;j("");const Z=C;Z.kind==="delete"?F(`${Z.job.jobId}:delete`,async()=>{await ale(Z.job.jobId),n(ce=>ce.filter(be=>be.jobId!==Z.job.jobId)),d(""),T(null)},"任务及其执行历史已删除。",!0).catch(ce=>{j(ce instanceof Error?ce.message:String(ce))}):F(`${Z.job.jobId}:cancel`,async()=>{var be;const ce=await sle(Z.job.jobId,Z.run.runId);g(ie=>ie.map(q=>q.runId===ce.runId?ce:q)),Q({...Z.job,latestRun:((be=Z.job.latestRun)==null?void 0:be.runId)===ce.runId?ce:Z.job.latestRun}),T(null)},"已提交终止请求。",!0).catch(ce=>{j(ce instanceof Error?ce.message:String(ce))})};return L?o.jsxs(ih,{className:"cronjobs-page","aria-label":"定时任务详情",children:[o.jsx(eCt,{job:L,runs:m,runsLoading:b,runsError:O,busyAction:x,onBack:()=>d(""),onEdit:()=>h(L),onToggle:()=>H(L),onRun:()=>B(L),onDelete:()=>{j(""),T({kind:"delete",job:L})},onCancel:Z=>{j(""),T({kind:"cancel",job:L,run:Z})},onRetryRun:()=>z(L,"任务已重新排队,将在一分钟内开始执行。"),onRetryRuns:()=>void N(L.jobId)}),k?o.jsx("div",{className:"cronjobs-notice",role:"status",children:o.jsx(zg,{color:"info",variant:"soft",description:k})}):null,f!==void 0?o.jsx(HJ,{job:f,runtimes:r,cloudProvider:e,busy:x.endsWith(":save"),onClose:()=>h(void 0),onSubmit:$}):null,C?o.jsx(zl,{title:C.kind==="delete"?"删除定时任务?":"终止本次执行?",description:C.kind==="delete"?`“${C.job.name}”及其全部执行历史将被永久删除。`:"本次 Session 将被取消,后续计划不会暂停。",error:A,confirmLabel:C.kind==="delete"?"删除任务":"终止执行",variant:"danger",busy:x.endsWith(C.kind),onCancel:()=>{j(""),T(null)},onConfirm:V}):null]}):o.jsxs(ih,{className:"cronjobs-page","aria-label":"定时任务",children:[o.jsx(sO,{className:"cronjobs-page-head",title:"定时任务"}),o.jsx(g0,{children:o.jsx(pE,{idPrefix:"cronjobs-filter",ariaLabel:"定时任务状态筛选",value:S,items:[{id:"all",label:"全部"},{id:"enabled",label:"已启用"},{id:"paused",label:"已暂停"}],onChange:E})}),k?o.jsx("div",{className:"cronjobs-banner",role:"status",children:o.jsx(zg,{color:"info",variant:"soft",description:k})}):null,o.jsx(b0,{"aria-label":"定时任务列表",children:s&&t.length===0?o.jsx(bd,{}):l?o.jsxs(xn,{className:"cronjobs-state",fill:"none",children:[o.jsx(xn.Icon,{color:"danger",children:o.jsx(K8,{})}),o.jsx(xn.Title,{color:"danger",children:"无法加载定时任务"}),o.jsx(xn.Description,{children:l}),o.jsx(xn.ActionRow,{children:o.jsxs(Nt,{type:"button",color:"secondary",variant:"outline",size:"lg",pill:!1,onClick:()=>void M(),children:[o.jsx(CN,{}),"重试"]})})]}):o.jsx(JTt,{jobs:I,canCreate:!s&&r.length>0,onCreate:()=>h(null),onSelect:Z=>d(Z.jobId)})}),f!==void 0?o.jsx(HJ,{job:f,runtimes:r,cloudProvider:e,busy:x.endsWith(":save"),onClose:()=>h(void 0),onSubmit:$}):null]})}function twe({label:e,onClick:t}){return o.jsx("button",{type:"button",className:"page-back-button","aria-label":e,title:e,onClick:t,children:o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m14.5 6-6 6 6 6"})})})}const nCt={volcengine:"https://console.volcengine.com",byteplus:"https://console.byteplus.com"};function _S(e){return e.trim()}function wU(e){return nCt[e]}function rCt(e){const t=_S(e);if(!t)return null;let n=t;try{n=new URL(t.includes("://")?t:`https://${t}`).hostname}catch{return null}const r=n.match(/^(.+)\.tos-([a-z0-9-]+)\.(?:volces|bytepluses)\.com$/i);return r?{bucket:r[1],region:r[2]}:null}function iCt(e,t){const n=rCt(t);if(!n)return null;const r=new URLSearchParams({id:n.bucket,region:n.region,type:"objects"});return`${wU(e)}/tos/bucket/setting?${r.toString()}`}function sCt(e,t,n){const r=_S(t),i=_S(n);return!r||!i?null:`${wU(e)}/agentkit/region:agentkit+${encodeURIComponent(r)}/builtintools/${encodeURIComponent(i)}/detail`}function aCt(e,t,n){const r=_S(t),i=_S(n);return!r||!i?null:`${wU(e)}/identity/region:identity+${encodeURIComponent(r)}/user-pools/${encodeURIComponent(i)}/info`}function Ex({href:e,label:t,children:n}){return e?o.jsxs("a",{className:"system-info-resource-link",href:e,target:"_blank",rel:"noreferrer","aria-label":t,title:t,children:[o.jsx("span",{children:n}),o.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[o.jsx("path",{d:"M7.75 5.25h-2.5a1.5 1.5 0 0 0-1.5 1.5v8a1.5 1.5 0 0 0 1.5 1.5h8a1.5 1.5 0 0 0 1.5-1.5v-2.5"}),o.jsx("path",{d:"M10.25 3.75h6v6M16 4 9 11"})]})]}):o.jsx("span",{children:n})}function oCt(e){return e instanceof Error&&e.message.includes("Volcengine credentials not found")}function qJ(e){return e==="codex"||e==="codex_snapshot"}function XJ(){return{busy:!1,error:"",message:""}}function lCt({version:e,localMode:t,role:n,provider:r,region:i,onBack:s}){const a=n==="admin",[l,c]=p.useState(""),[u,d]=p.useState([]),[f,h]=p.useState([]),[m,g]=p.useState(null),[b,y]=p.useState(!0),[O,v]=p.useState(""),[x,w]=p.useState(!0),[S,E]=p.useState(""),[k,_]=p.useState(!0),[C,T]=p.useState(""),[A,j]=p.useState(0),[L,I]=p.useState(0),[M,N]=p.useState(0),D=p.useRef(!1),[Q,F]=p.useState({});p.useEffect(()=>(D.current=!0,()=>{D.current=!1}),[]);function $(z,B){F(V=>({...V,[z]:{...XJ(),...V[z],...B}}))}async function H(z){if(!(!qJ(z.kind)||!z.toolId||(Q[z.kind]??XJ()).busy)){$(z.kind,{busy:!0,error:"",message:""});try{const V=await Qoe(z.kind);if(!D.current)return;d(Z=>Z.map(ce=>ce.kind===z.kind?{...ce,needsModelEnvUpdate:!1,canUpdateModelEnv:!1,modelEnvError:"",modelEnvErrorCode:""}:ce)),$(z.kind,{busy:!1,error:"",message:V.updated?"已更新":"无需更新"})}catch(V){if(!D.current)return;$(z.kind,{busy:!1,error:V instanceof Error?V.message:String(V),message:""})}}}return p.useEffect(()=>{if(!a){c(""),d([]),y(!1),v("");return}const z=new AbortController;return y(!0),v(""),voe(z.signal).then(B=>{c(B.storage.tosAddress),d(B.sandboxTools)}).catch(B=>{(B==null?void 0:B.name)!=="AbortError"&&v(B instanceof Error?B.message:String(B))}).finally(()=>{z.signal.aborted||y(!1)}),()=>z.abort()},[a,A]),p.useEffect(()=>{if(!a){h([]),w(!1),E("");return}const z=new AbortController;return w(!0),E(""),$N(z.signal).then(B=>{h(B.filter(V=>V.isCurrent))}).catch(B=>{if((B==null?void 0:B.name)!=="AbortError"){if(t&&oCt(B)){h([]);return}E(B instanceof Error?B.message:String(B))}}).finally(()=>{z.signal.aborted||w(!1)}),()=>z.abort()},[a,t,L]),p.useEffect(()=>{if(!a){g(null),_(!1),T("");return}const z=new AbortController;return _(!0),T(""),Boe(z.signal).then(g).catch(B=>{(B==null?void 0:B.name)!=="AbortError"&&T(B instanceof Error?B.message:String(B))}).finally(()=>{z.signal.aborted||_(!1)}),()=>z.abort()},[a,M]),o.jsxs("div",{className:"system-info-page",children:[o.jsxs("header",{className:"system-info-page-header",children:[o.jsx(twe,{label:"返回上一页",onClick:s}),o.jsxs("div",{children:[o.jsx("h1",{children:"系统信息"}),o.jsx("p",{children:"查看当前 Studio 版本及关联的基础资源"})]})]}),o.jsxs("div",{className:"system-info-scroll",children:[o.jsxs("section",{className:"system-info-section","aria-labelledby":"studio-info-title",children:[o.jsx("h2",{id:"studio-info-title",children:"通用"}),o.jsx("dl",{className:"system-info-summary",children:o.jsxs("div",{children:[o.jsx("dt",{children:"当前版本"}),o.jsx("dd",{children:e||"—"})]})})]}),a?o.jsxs(o.Fragment,{children:[o.jsxs("section",{className:"system-info-section","aria-labelledby":"storage-info-title",children:[o.jsx("h2",{id:"storage-info-title",children:"存储"}),b?o.jsx("div",{className:"system-info-loading",role:"status","aria-live":"polite",children:o.jsx(En,{as:"span",children:"正在加载存储信息"})}):O?o.jsxs("div",{className:"system-info-error",role:"alert",children:[o.jsx("p",{children:O}),o.jsx("button",{type:"button",onClick:()=>j(z=>z+1),children:"重新加载"})]}):o.jsx("dl",{className:"system-info-summary",children:o.jsxs("div",{className:"system-info-resource-row",children:[o.jsx("dt",{children:"TOS 地址"}),o.jsx("dd",{className:`system-info-resource-value${l?"":" is-empty"}`,children:o.jsx(Ex,{href:iCt(r,l),label:"在云控制台中打开 TOS 存储桶",children:l||"未配置"})})]})})]}),o.jsxs("section",{className:"system-info-section","aria-labelledby":"environment-build-info-title",children:[o.jsx("h2",{id:"environment-build-info-title",children:"环境构建"}),k?o.jsx("div",{className:"system-info-loading",role:"status","aria-live":"polite",children:o.jsx(En,{as:"span",children:"正在加载环境构建资源"})}):C?o.jsxs("div",{className:"system-info-error",role:"alert",children:[o.jsx("p",{children:C}),o.jsx("button",{type:"button",onClick:()=>N(z=>z+1),children:"重新加载"})]}):m?o.jsxs("dl",{className:"system-info-summary",children:[o.jsxs("div",{className:"system-info-resource-row",children:[o.jsx("dt",{children:"CodePipeline Workspace"}),o.jsx("dd",{className:"system-info-resource-value",children:o.jsx(Ex,{href:m.codePipeline.consoleUrl||null,label:"在云控制台中打开 CodePipeline Workspace",children:m.codePipeline.workspaceName||m.codePipeline.workspaceId||"首次构建时自动创建"})})]}),o.jsxs("div",{className:"system-info-resource-row",children:[o.jsx("dt",{children:"CodePipeline Pipeline"}),o.jsx("dd",{className:"system-info-resource-value",children:m.codePipeline.pipelineName||m.codePipeline.pipelineId||"首次构建时自动创建"})]}),o.jsxs("div",{className:"system-info-resource-row",children:[o.jsx("dt",{children:"Container Registry 仓库"}),o.jsx("dd",{className:"system-info-resource-value",children:o.jsx(Ex,{href:m.containerRegistry.consoleUrl||null,label:"在云控制台中打开 Container Registry 仓库",children:m.containerRegistry.imageRepository||[m.containerRegistry.registry,m.containerRegistry.namespace,m.containerRegistry.repository].filter(Boolean).join("/")||"首次构建时自动创建"})})]})]}):null]}),o.jsxs("section",{className:"system-info-section","aria-labelledby":"sandbox-tool-title",children:[o.jsx("h2",{id:"sandbox-tool-title",children:"沙箱信息"}),b?o.jsx("div",{className:"system-info-loading",role:"status","aria-live":"polite",children:o.jsx(En,{as:"span",children:"正在加载沙箱信息"})}):O?o.jsxs("div",{className:"system-info-error",role:"alert",children:[o.jsx("p",{children:O}),o.jsx("button",{type:"button",onClick:()=>j(z=>z+1),children:"重新加载"})]}):o.jsx("div",{className:"system-info-tool-list",children:u.map(z=>{const B=qJ(z.kind)?z.kind:null,V=B?Q[B]:void 0,Z=B!==null&&!!z.toolId&&z.needsModelEnvUpdate&&z.canUpdateModelEnv,ce=B?(V==null?void 0:V.error)||z.modelEnvError:"";return o.jsx("dl",{className:"system-info-tool",children:o.jsxs("div",{className:"system-info-resource-row",children:[o.jsxs("dt",{className:"system-info-tool-label",children:[o.jsx("span",{children:z.label}),z.snapshot?o.jsx("span",{className:"system-info-tool-badge",children:"快照版"}):null]}),o.jsxs("dd",{className:`system-info-resource-value${z.toolId?"":" is-empty"}`,children:[o.jsx(Ex,{href:sCt(r,i,z.toolId),label:`在云控制台中打开${z.label}`,children:z.toolId||"未配置"}),Z?o.jsx("button",{type:"button",className:"system-info-resource-update",disabled:V==null?void 0:V.busy,"aria-busy":(V==null?void 0:V.busy)||void 0,"aria-label":`更新${z.snapshot?"快照版 ":""}${z.label}模型环境变量`,title:`更新${z.snapshot?"快照版 ":""}${z.label}模型环境变量`,onClick:()=>void H(z),children:o.jsx($ae,{"aria-hidden":"true",className:V!=null&&V.busy?"is-spinning":""})}):null,B&&(V!=null&&V.message)?o.jsx("span",{className:"system-info-inline-status",role:"status",children:V.message}):null,ce?o.jsx("span",{className:"system-info-inline-error",role:"alert",children:ce}):null]})]})},z.kind)})})]}),o.jsxs("section",{className:"system-info-section","aria-labelledby":"user-pool-title",children:[o.jsx("h2",{id:"user-pool-title",children:"用户池"}),x?o.jsx("div",{className:"system-info-loading",role:"status","aria-live":"polite",children:o.jsx(En,{as:"span",children:"正在加载用户池"})}):S?o.jsxs("div",{className:"system-info-error",role:"alert",children:[o.jsx("p",{children:S}),o.jsx("button",{type:"button",onClick:()=>I(z=>z+1),children:"重新加载"})]}):f.length>0?o.jsx("div",{className:"system-info-pool-list",children:f.map(z=>o.jsxs("dl",{className:"system-info-pool",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"名称"}),o.jsx("dd",{className:"system-info-resource-value",children:o.jsx(Ex,{href:aCt(r,z.region||i,z.uid),label:`在云控制台中打开用户池${z.name?`“${z.name}”`:""}`,children:z.name||"未命名用户池"})})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"ID"}),o.jsx("dd",{children:z.uid||"—"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"域名"}),o.jsx("dd",{children:z.domain||"—"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"区域"}),o.jsx("dd",{children:z.region||"—"})]})]},z.uid))}):o.jsx("p",{className:"system-info-empty",children:t?"本地模式未配置用户池":"当前 Studio 未配置用户池"})]})]}):null]})]})}const cCt="_TextLink_16uec_1",uCt={TextLink:cCt},u_=e=>{const{children:t,primary:n=!1,underline:r=!n,className:i,target:s,forceExternal:a,as:l,href:c,to:u,...d}=e,f=a??/^https?:\/\//.test(c??u??""),h=khe(),m=l||(f?"a":h),g={...d,className:ur(uCt.TextLink,i),"data-primary":n?"":void 0,"data-underline":r?"":void 0};if(!c&&!u)return o.jsx("span",{...g,role:"button",children:t});const b={...f?{target:"_blank",rel:"noopener noreferrer",href:c??u}:{href:c,to:u},...g};return o.jsx(m,{...b,children:t})},dCt="/assets/media/article-agent-workflow-GXPkXUjV.webp",fCt="/assets/media/article-tool-debugging-BxiMDz_8.webp",hCt="/assets/media/showcase-a2ui-BgBnE9RT.webp",pCt="/assets/media/showcase-customer-service-DNw0mUH1.webp",mCt="/assets/media/showcase-multimodal-BRTl8NLI.webp",gCt="/assets/media/showcase-research-assistant-CbfMFfhS.webp",bCt="/assets/media/showcase-web-search-D2kl1imN.webp",yCt={volcengine:{console:"https://console.volcengine.com/agentkit",docs:"https://www.volcengine.com/docs/86681/1844823"},byteplus:{console:"https://console.byteplus.com/agentkit",docs:"https://docs.byteplus.com/en/docs/AgentKit"}};function OCt(e){return yCt[e]}const xCt=[{id:"documentation",title:"相关链接",description:"查看开发文档与 AgentKit 常用入口"},{id:"best-practices",title:"最佳实践",description:"参考开发、调试与部署经验"},{id:"showcases",title:"Showcases",description:"探索 AgentKit 应用案例"}],vCt="https://volcengine.github.io/veadk-python/",wCt="https://volcengine.github.io/agentkit-sdk-python/content/2.agentkit-cli/1.overview.html",SCt=[{id:"veadk-development",title:"使用 VeADK 开发并部署智能体",description:"使用 VeADK 构建 Agent,并部署至 AgentKit 智能体运行时。",meta:"AgentKit · VeADK",image:dCt,href:"https://docs.volcengine.com/docs/86681/2155817?lang=zh"},{id:"agentkit-cli-development",title:"使用 AgentKit CLI 开发并部署智能体",description:"通过 AgentKit CLI 创建项目、调试 Agent,并完成部署。",meta:"AgentKit · CLI",image:fCt,href:"https://docs.volcengine.com/docs/86681/1844871?lang=zh"}],ECt=[{id:"research-assistant",title:"多智能体研究助手",description:"由多个专业 Agent 协同完成资料检索、分析和结论整理。",image:gCt,href:"https://github.com/volcengine/veadk-python/tree/main/examples/06_multi_agent"},{id:"multimodal-analysis",title:"多模态内容分析",description:"在统一会话中理解图片、文档和视频内容。",image:mCt,href:"https://github.com/volcengine/veadk-python/tree/main/examples/multimodal_agent"},{id:"customer-service",title:"智能客服工作台",description:"结合知识检索与工具调用处理复杂的客户服务任务。",image:pCt,href:"https://github.com/volcengine/veadk-python/tree/main/examples/basic-app"},{id:"web-search",title:"联网搜索 Agent",description:"检索实时网页内容,并将信息整理为可追溯的回答。",image:bCt,href:"https://github.com/volcengine/veadk-python/tree/main/examples/04_web_search"},{id:"a2ui-app",title:"A2UI 交互应用",description:"让 Agent 根据任务过程生成可交互的前端界面。",image:hCt,href:"https://github.com/volcengine/veadk-python/tree/main/examples/a2ui_agent"}];function kCt({cloudProvider:e}){const t=OCt(e);return o.jsxs(ih,{className:"developer-resources","aria-label":"开发者资源",children:[o.jsx(sO,{title:"开发者资源"}),o.jsx("div",{className:"developer-resources__content",children:xCt.map(n=>o.jsxs("section",{className:"developer-resources__section","aria-labelledby":`developer-resources-${n.id}`,children:[o.jsxs("header",{className:"developer-resources__section-header",children:[o.jsx("h2",{id:`developer-resources-${n.id}`,children:n.title}),o.jsx("p",{children:n.description})]}),n.id==="documentation"?o.jsxs("ul",{className:"developer-resources__links",children:[o.jsx("li",{children:o.jsxs(u_,{className:"developer-resources__link",primary:!0,underline:!0,href:vCt,target:"_blank",rel:"noreferrer",children:["VeADK 文档",o.jsx(Fk,{"aria-hidden":"true"})]})}),o.jsx("li",{children:o.jsxs(u_,{className:"developer-resources__link",primary:!0,underline:!0,href:wCt,target:"_blank",rel:"noreferrer",children:["AgentKit CLI 文档",o.jsx(Fk,{"aria-hidden":"true"})]})}),o.jsx("li",{children:o.jsxs(u_,{className:"developer-resources__link",primary:!0,underline:!0,href:t.docs,target:"_blank",rel:"noreferrer",children:["AgentKit 平台文档",o.jsx(Fk,{"aria-hidden":"true"})]})}),o.jsx("li",{children:o.jsxs(u_,{className:"developer-resources__link",primary:!0,underline:!0,href:t.console,target:"_blank",rel:"noreferrer",children:["AgentKit 控制台",o.jsx(Fk,{"aria-hidden":"true"})]})})]}):n.id==="best-practices"?o.jsx("div",{className:"developer-resources__articles",children:SCt.map(r=>o.jsxs("a",{className:"developer-resources__article",href:r.href,target:"_blank",rel:"noreferrer",children:[o.jsx("img",{src:r.image,alt:`${r.title}文章封面`,loading:"lazy"}),o.jsxs("span",{className:"developer-resources__article-copy",children:[o.jsx("strong",{children:r.title}),o.jsx("span",{children:r.description}),o.jsx("small",{children:r.meta})]})]},r.id))}):n.id==="showcases"?o.jsx("div",{className:"developer-resources__showcases",children:ECt.map(r=>o.jsxs("a",{className:"developer-resources__showcase",href:r.href,target:"_blank",rel:"noreferrer",children:[o.jsx("span",{className:"developer-resources__showcase-media",children:o.jsx("img",{src:r.image,alt:`${r.title}界面预览`,loading:"lazy"})}),o.jsx("strong",{children:r.title}),o.jsx("span",{children:r.description})]},r.id))}):null]},n.id))})]})}function _Ct(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m9.8 3.5-4.5 4.5 4.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function TCt({hidden:e,...t}){return o.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...t,children:[o.jsx("path",{d:"M2.5 10s2.6-4 7.5-4 7.5 4 7.5 4-2.6 4-7.5 4-7.5-4-7.5-4Z"}),o.jsx("circle",{cx:"10",cy:"10",r:"1.8"}),e?o.jsx("path",{d:"m4 4 12 12"}):null]})}function GJ(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M6.5 4H4.8A1.8 1.8 0 0 0 3 5.8v5.4A1.8 1.8 0 0 0 4.8 13h5.4a1.8 1.8 0 0 0 1.8-1.8V9.5M9 3h4v4M12.5 3.5 7.2 8.8",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function CCt(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function ACt(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m3.5 8.2 2.8 2.8 6.2-6.2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function zP(e,t,n){const r=t.trim();if(!r)return n?"此项不能为空":"";if(e==="repository"&&!/^(?:https:\/\/github\.com\/)?[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+(?:\.git)?$/.test(r))return"请输入 owner/repository 或完整 GitHub Repo URL";if(e==="baseBranch"&&(!/^[A-Za-z0-9][A-Za-z0-9._/-]*$/.test(r)||r.includes("..")))return"目标分支格式不正确";if(e==="projectPath"&&(r.startsWith("/")||r.split("/").includes("..")))return"请输入仓库内的相对目录";if(e==="runtimeName")return qE(r)??"";if(e==="runtimeId"&&!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(r))return"Runtime ID 格式不正确";if(e==="sandboxToolId"&&!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(r))return"Sandbox Tool ID 格式不正确";if(e==="modelName"&&!/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/.test(r))return"模型名称格式不正确";if(e==="modelBaseUrl")try{const i=new URL(r);if(i.protocol!=="https:"||i.username||i.password||i.search||i.hash)return"请输入不含凭据、查询参数或锚点的 HTTPS 地址"}catch{return"请输入有效的 HTTPS 地址"}return""}function NCt({automation:e,cloudProvider:t,onBack:n}){const r=MTt(e),i=Sd(t),s=r.secrets({cloudProvider:t}),[a,l]=p.useState(()=>({...r.initialValues({cloudProvider:t})})),c=i.find(A=>A.value===a.region),[u,d]=p.useState({}),[f,h]=p.useState(""),[m,g]=p.useState(!1),[b,y]=p.useState(!1),[O,v]=p.useState(!1),[x,w]=p.useState(null),S=p.useRef(null);p.useEffect(()=>()=>{var A;return(A=S.current)==null?void 0:A.abort()},[]),p.useEffect(()=>{var A;l({...r.initialValues({cloudProvider:t})}),d({}),h(""),w(null),v(!1),(A=S.current)==null||A.abort()},[e,t,r]);const E=(A,j)=>{l(L=>({...L,[A]:j})),u[A]&&d(L=>({...L,[A]:""}))},k=A=>{var I;const j=A==="token"||((I=r.fields.find(M=>M.name===A))==null?void 0:I.required)===!0,L=zP(A,a[A],j);d(M=>({...M,[A]:L}))},_=async A=>{var M;A.preventDefault();const j={};for(const N of r.fields){const D=zP(N.name,a[N.name],N.required);D&&(j[N.name]=D)}const L=zP("token",a.token,!0);if(L&&(j.token=L),d(j),Object.keys(j).length)return;(M=S.current)==null||M.abort();const I=new AbortController;S.current=I,g(!0),h(""),w(null);try{const N=await r.submit(a,{cloudProvider:t},I.signal);if(S.current!==I)return;w(N),l(D=>({...D,token:""}))}catch(N){if(I.signal.aborted||S.current!==I)return;h(N instanceof Error?N.message:String(N))}finally{S.current===I&&(S.current=null,g(!1))}},C=A=>{A.key==="Enter"&&(A.nativeEvent.isComposing||A.nativeEvent.keyCode===229)&&A.preventDefault()},T=A=>{const{name:j,label:L,placeholder:I,help:M,required:N}=A;return o.jsxs("div",{className:"github-field",children:[o.jsxs("label",{htmlFor:`github-${j}`,children:[o.jsx("span",{children:L}),o.jsx("span",{className:`github-field-requirement${N?" is-required":""}`,children:N?"必填":"可选"})]}),o.jsx("input",{id:`github-${j}`,value:a[j],onChange:D=>E(j,D.target.value),onBlur:()=>k(j),placeholder:I,required:N,"aria-invalid":!!u[j],"aria-describedby":`github-${j}-help${u[j]?` github-${j}-error`:""}`}),o.jsx("span",{id:`github-${j}-help`,className:"github-field-help",children:M}),u[j]?o.jsx("span",{id:`github-${j}-error`,className:"github-field-error",role:"alert",children:u[j]}):null]},j)};return o.jsxs("div",{className:"github-integration-page",children:[o.jsxs("header",{className:"github-integration-header",children:[o.jsx("button",{type:"button",className:"github-back",onClick:n,"aria-label":"返回自动化列表",children:o.jsx(_Ct,{})}),o.jsx(fU,{className:"github-integration-logo"}),o.jsxs("div",{children:[o.jsx("h1",{children:r.title}),o.jsx("p",{children:r.subtitle})]})]}),o.jsx("div",{className:"github-integration-layout",children:o.jsxs("section",{id:`github-panel-${e}`,className:"github-section-panel",children:[o.jsx("div",{className:"github-panel-heading",children:o.jsx("p",{children:r.panel})}),o.jsxs("form",{className:"github-release-form",onSubmit:_,onKeyDown:C,noValidate:!0,children:[o.jsxs("div",{className:"github-field-grid",children:[r.fields.map(T),o.jsxs("div",{className:"github-field",children:[o.jsxs("label",{id:"github-region-label",children:[o.jsx("span",{children:"地域"}),o.jsx("span",{className:"github-field-requirement is-required",children:"必填"})]}),o.jsxs("div",{className:"pp-network-region github-region-picker",onKeyDown:A=>{A.key==="Escape"&&v(!1)},children:[o.jsxs("button",{type:"button",className:"pp-region-trigger","aria-labelledby":"github-region-label","aria-haspopup":"listbox","aria-expanded":O,onClick:()=>v(A=>!A),children:[o.jsx("span",{children:(c==null?void 0:c.label)??a.region}),o.jsx(CCt,{className:`pp-region-chevron${O?" is-open":""}`})]}),O?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>v(!1)}),o.jsx("div",{className:"pp-region-menu",role:"listbox","aria-label":"地域",children:i.map(A=>{const j=A.value===a.region;return o.jsxs("button",{type:"button",role:"option","aria-selected":j,className:`pp-region-option${j?" is-selected":""}`,onClick:()=>{E("region",A.value),v(!1)},children:[o.jsx("span",{children:A.label}),j?o.jsx(ACt,{}):null]},A.value)})})]}):null]}),o.jsx("span",{className:"github-field-help",children:r.regionHelp})]})]}),o.jsxs("div",{className:"github-field github-token-field",children:[o.jsxs("div",{className:"github-token-label-row",children:[o.jsxs("label",{htmlFor:"github-token",children:[o.jsx("span",{children:"GitHub Token"}),o.jsx("span",{className:"github-field-requirement is-required",children:"必填"})]}),o.jsxs("a",{href:"https://github.com/settings/personal-access-tokens/new?name=VeADK%20Studio&description=Create%20a%20GitHub%20automation%20pull%20request&contents=write&pull_requests=write",target:"_blank",rel:"noreferrer",children:["获取 Token",o.jsx(GJ,{})]})]}),o.jsxs("div",{className:"github-token-input",children:[o.jsx("input",{id:"github-token",type:b?"text":"password",value:a.token,onChange:A=>E("token",A.target.value),onBlur:()=>k("token"),autoComplete:"off",required:!0,placeholder:"需要仓库 Contents 与 Pull requests 写权限","aria-invalid":!!u.token,"aria-describedby":`github-token-help${u.token?" github-token-error":""}`}),o.jsx("button",{type:"button",onClick:()=>y(A=>!A),"aria-label":b?"隐藏 Token":"显示 Token",title:b?"隐藏 Token":"显示 Token",children:o.jsx(TCt,{hidden:b})})]}),o.jsx("span",{id:"github-token-help",className:"github-field-help",children:"Token 仅用于本次提交,不会保存在浏览器或写入 PR"}),u.token?o.jsx("span",{id:"github-token-error",className:"github-field-error",role:"alert",children:u.token}):null]}),f?o.jsx("div",{className:"github-submit-message is-error",role:"alert",children:f}):null,x?o.jsxs("div",{className:"github-submit-message is-success",role:"status",children:[o.jsxs("span",{children:["PR #",x.number," 已创建"]}),o.jsxs("a",{href:x.url,target:"_blank",rel:"noreferrer",children:["在 GitHub 查看",o.jsx(GJ,{})]})]}):null,o.jsxs("div",{className:"github-form-actions",children:[o.jsxs("div",{className:"github-secrets-note",children:[o.jsx("strong",{children:"合并 PR 前,请在仓库的 GitHub Actions Secrets 中配置:"}),s.map(A=>o.jsx("span",{children:A},A))]}),o.jsx("button",{type:"submit",disabled:m,children:m?"提交 PR 中…":r.submitLabel})]})]})]})})]})}const jCt=1050062,WJ="1.0",RCt="https://lf-static.applogcdn.com/obj/applog-sdk-static/log-sdk/collect/5/collect.js";class ICt{constructor(){kr(this,"enabled",!1);kr(this,"initialized",!1);kr(this,"pending",[]);kr(this,"userUniqueId","");kr(this,"initPromise")}init(t){return this.enabled=t.enabled,this.enabled?this.initPromise?this.initPromise:(this.initPromise=Promise.resolve().then(()=>{const n=this.bootstrapCollector();n("init",{app_id:jCt,channel:"cn",disable_auto_pv:1}),this.userUniqueId&&n("config",{user_unique_id:this.userUniqueId}),n("config",{_staging_flag:t.environment==="prod"?0:1}),n("start"),this.initialized=!0;const r=this.pending;this.pending=[];for(const[i,s]of r)this.collect(i,s)}),this.initPromise):(this.pending=[],Promise.resolve())}identify(t){this.userUniqueId=t,this.initialized&&this.collect("config",{user_unique_id:t})}emit(t,n){if(this.enabled){if(this.initialized){this.collect(t,n);return}this.pending=[...this.pending.slice(-49),[t,n]]}}bootstrapCollector(){if(window.collectEvent)return window.collectEvent;window.LogAnalyticsObject="collectEvent";const t=function(){var i;(i=t.q)==null||i.push(arguments)};t.q=[],t.l=Date.now(),window.collectEvent=t;const n=document.createElement("script");return n.async=!0,n.src=RCt,n.onerror=()=>{this.enabled=!1,t.q=[],console.warn("[telemetry] TEA SDK script failed to load")},document.head.appendChild(n),t}collect(t,n){var r;(r=window.collectEvent)==null||r.call(window,t,n)}}const DCt=256,nwe=1024,VP="[REDACTED]";function PCt(e){if(typeof e!="string"&&typeof e!="number")return;const t=String(e).trim();return/^[A-Za-z0-9_.:-]{1,64}$/.test(t)?t:void 0}function Zd(e,t){return t===void 0?{errorKind:e}:{errorKind:e,errorCode:t}}function rwe(e,t,n={}){if(e.length<=t)return e;if(n.preserveEnd){const i="[truncated] ...";return`${i}${e.slice(-Math.max(0,t-i.length))}`}const r="... [truncated]";return`${e.slice(0,Math.max(0,t-r.length))}${r}`}function MCt(e){return e.replace(/\b(Authorization\s*[:=]\s*)(Bearer\s+)?[^\s"',;&]+/gi,(t,n,r)=>`${n}${r??""}${VP}`).replace(/\bBearer\s+[A-Za-z0-9._~+/=-]+/gi,`Bearer ${VP}`).replace(/\b([\w.-]*(?:token|password|passwd|secret|api[_-]?key|access[_-]?key|secret[_-]?key|cookie)[\w.-]*\s*[:=]\s*)(["']?)[^\s"',;&]+/gi,(t,n,r)=>`${n}${r}${VP}`)}function Dy(e,t={}){const n=e!==null&&typeof e=="object"?e:{},i=(typeof n.message=="string"?n.message:typeof e=="string"||typeof e=="number"||typeof e=="boolean"?String(e):"").replace(/\s+/g," ").trim();if(i)return rwe(MCt(i),nwe,t)}function fo(e,t={}){const n=e!==null&&typeof e=="object"?e:{},r=PCt(n.code),i=typeof n.name=="string"?n.name:"";if(i==="RuntimeProbeError")return Zd("runtime_probe_error",r);if(i==="AbortError")return Zd("abort",r);if(i==="RuntimeAccessDeniedError"||i==="AuthError")return Zd("auth",r);if(t.phase==="build")return Zd("build_failed",r);if(i==="TimeoutError")return Zd("timeout",r);if(i==="NetworkError"||i==="TypeError")return Zd("network",r);if(i==="ValidationError")return Zd("validation",r);if(i==="ServerError")return Zd("server",r);const s=typeof n.status=="number"&&Number.isInteger(n.status)?n.status:void 0;if(s===void 0||s<400||s>599)return Zd("unknown",r);const a=String(s);return s===401||s===403?{errorKind:"auth",errorCode:a}:s===400||s===409||s===422?{errorKind:"validation",errorCode:a}:s>=500?{errorKind:"server",errorCode:a}:{errorKind:"unknown",errorCode:a}}const LCt=["schema_version","event_id","operation_id","user_pool_id","studio_deploy_id","vefaas_application_id","vefaas_function_id","studio_region","studio_project","studio_version","environment","cloud_provider","account_id","account_id_resolution_error","user_role","user_source","page_instance_id"],$Ct={studio_entry_viewed:["auth_state"],studio_session_started:["agents_source"],studio_agent_deploy:["status","agent_id","deploy_action","deploy_source","create_mode","ai_assisted","deploy_region","runtime_network_type","feishu_enabled","runtime_id","duration_ms","failed_phase","error_kind","error_code","error_message"],studio_sandbox_create:["status","sandbox_kind","sandbox_source","sandbox_id","duration_ms","error_kind","error_code"],studio_agent_debug:["status","agent_id","variant_type","debug_run_id","duration_ms","failed_phase","error_kind","error_code"],studio_agent_connect:["status","target_id","agent_kind","connect_source","runtime_region","runtime_is_mine","sandbox_status","duration_ms","error_kind","error_code"],studio_agent_message:["status","agent_id","agent_kind","message_source","session_state","session_id","duration_ms","failed_phase","error_kind","error_code"],studio_agent_source_download:["status","agent_id","deploy_action","deploy_source","create_mode","ai_assisted","duration_ms","file_count","zip_size_bytes","error_kind","error_code"]};function BCt(e){return typeof e=="string"||typeof e=="number"&&Number.isFinite(e)}function YJ(e,t){const n=new Set([...LCt,...$Ct[e]]),r={};for(const[i,s]of Object.entries(t))!n.has(i)||!BCt(s)||(typeof s=="string"?r[i]=rwe(s,i==="error_message"?nwe:DCt):r[i]=s);return r}function QCt(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`}function UCt(){return typeof performance<"u"?performance.now():Date.now()}function ib(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0))}class FCt{constructor(t){kr(this,"sink");kr(this,"createId");kr(this,"now");kr(this,"pageInstanceId");kr(this,"context");kr(this,"identity");kr(this,"entryViewed",!1);kr(this,"sessionStarted",!1);this.sink=t.sink,this.createId=t.createId??QCt,this.now=t.now??UCt,this.pageInstanceId=this.createId()}setContext(t){var n,r;this.context={...t,accountId:((n=t.accountId)==null?void 0:n.trim())??"",accountIdResolutionError:((r=t.accountIdResolutionError)==null?void 0:r.trim())??""}}identify(t){var r,i,s;const n=t.userUniqueId.trim();n&&(this.identity&&this.identity.userUniqueId!==n&&(this.pageInstanceId=this.createId(),this.sessionStarted=!1),this.identity={...t,userUniqueId:n,accountId:((r=t.accountId)==null?void 0:r.trim())??""},(s=(i=this.sink).identify)==null||s.call(i,n))}trackStudioSessionStarted(t){this.sessionStarted||!this.context||!this.identity||(this.sessionStarted=!0,this.emit("studio_session_started",{agents_source:t.agentsSource}))}trackStudioEntryViewed(t){if(this.entryViewed||!this.context)return;this.entryViewed=!0;const n=YJ("studio_entry_viewed",ib({schema_version:WJ,event_id:this.createId(),user_pool_id:this.context.userPoolId,studio_deploy_id:this.context.studioDeployId,vefaas_application_id:this.context.applicationId,vefaas_function_id:this.context.functionId,studio_region:this.context.studioRegion,studio_project:this.context.studioProject,studio_version:this.context.studioVersion,environment:this.context.environment,cloud_provider:this.context.cloudProvider,account_id:this.context.accountId,account_id_resolution_error:this.context.accountIdResolutionError||void 0,page_instance_id:this.pageInstanceId,auth_state:t.authState}));this.sink.emit("studio_entry_viewed",n)}beginAgentDeploy(t){return this.beginOperation("studio_agent_deploy",{agent_id:t.agentId,deploy_action:t.deployAction,deploy_source:t.deploySource,create_mode:t.createMode,ai_assisted:t.aiAssisted,deploy_region:t.deployRegion,runtime_network_type:t.runtimeNetworkType,feishu_enabled:t.feishuEnabled},n=>({runtime_id:n.runtimeId}),n=>({failed_phase:n.failedPhase,error_kind:n.errorKind,error_code:n.errorCode,error_message:n.errorMessage}))}beginSandboxCreate(t){return this.beginOperation("studio_sandbox_create",{sandbox_kind:t.sandboxKind,sandbox_source:t.sandboxSource},n=>({sandbox_id:n.sandboxId}),n=>({error_kind:n.errorKind,error_code:n.errorCode}))}beginAgentDebug(t){return this.beginOperation("studio_agent_debug",{agent_id:t.agentId,variant_type:t.variantType},n=>({debug_run_id:n.debugRunId}),n=>({failed_phase:n.failedPhase,error_kind:n.errorKind,error_code:n.errorCode}))}beginAgentConnect(t){return this.beginOperation("studio_agent_connect",{target_id:t.targetId,agent_kind:t.agentKind,connect_source:t.connectSource},n=>ib({runtime_region:n.runtimeRegion,runtime_is_mine:n.runtimeIsMine,sandbox_status:n.sandboxStatus}),n=>ib({error_kind:n.errorKind,error_code:n.errorCode}))}beginAgentMessage(t){return this.beginOperation("studio_agent_message",ib({agent_id:t.agentId,agent_kind:t.agentKind,message_source:t.messageSource,session_state:t.sessionState,session_id:t.sessionId}),n=>({session_id:n.sessionId}),n=>ib({session_id:n.sessionId,failed_phase:n.failedPhase,error_kind:n.errorKind,error_code:n.errorCode}))}beginAgentSourceDownload(t){return this.beginOperation("studio_agent_source_download",{agent_id:t.agentId,deploy_action:t.deployAction,deploy_source:t.deploySource,create_mode:t.createMode,ai_assisted:t.aiAssisted},n=>({file_count:n.fileCount,zip_size_bytes:n.zipSizeBytes}),n=>({file_count:n.fileCount,error_kind:n.errorKind,error_code:n.errorCode}))}beginOperation(t,n,r,i){const s=this.createId(),a=this.now(),l=!!(this.context&&this.identity);let c=!1;l&&this.emit(t,{...n,status:"started"},s);const u=(d,f)=>{c||(c=!0,l&&this.emit(t,{...n,...f,status:d,duration_ms:Math.max(0,this.now()-a)},s))};return{operationId:s,succeed:d=>u("succeeded",r(d)),fail:d=>u("failed",i(d))}}emit(t,n,r){if(!this.context||!this.identity)return;const i=YJ(t,ib({schema_version:WJ,event_id:this.createId(),operation_id:r,user_pool_id:this.context.userPoolId,studio_deploy_id:this.context.studioDeployId,vefaas_application_id:this.context.applicationId,vefaas_function_id:this.context.functionId,studio_region:this.context.studioRegion,studio_project:this.context.studioProject,studio_version:this.context.studioVersion,environment:this.context.environment,cloud_provider:this.context.cloudProvider,account_id:this.identity.accountId,account_id_resolution_error:this.context.accountIdResolutionError||void 0,user_role:this.identity.userRole,user_source:this.identity.userSource,page_instance_id:this.pageInstanceId,...n}));this.sink.emit(t,i)}}const iwe=new ICt,jd=new FCt({sink:iwe});function zCt(e){return iwe.init(e)}function VCt(e){jd.setContext(e)}function HCt(e){jd.identify(e)}function qCt(e){jd.trackStudioEntryViewed(e)}function XCt(e){jd.trackStudioSessionStarted(e)}function swe(e){return jd.beginAgentDeploy(e)}function GCt(e){return jd.beginSandboxCreate(e)}function WCt(e){return jd.beginAgentDebug(e)}function HP(e){return jd.beginAgentConnect(e)}function ZJ(e){return jd.beginAgentMessage(e)}function awe(e){return jd.beginAgentSourceDownload(e)}const YCt=/^[A-Za-z_][A-Za-z0-9_]*$/;function A1(e){return e.trim().length===0?"名称为必填项":e==="user"?"user 是 Google ADK 保留名称,请使用其他名称":YCt.test(e)?null:"名称须以英文字母或下划线开头,且只能包含英文字母、数字和下划线"}function ZCt(e){const t=new Set,n=new Set,r=i=>{A1(i.name)===null&&(t.has(i.name)?n.add(i.name):t.add(i.name)),i.subAgents.forEach(r)};return r(e),n}function KCt(e){return{...Ml(),name:e,description:"一个通过飞书接收消息并提供帮助的智能助手。",instruction:"你是一个通过飞书为用户提供帮助的智能助手。准确理解用户问题,给出简洁、可靠的回答;信息不足时先提问澄清,不要臆造事实。",deployment:{feishuEnabled:!0}}}async function JCt(e){const t=KCt(e.agentName),n=await xC(t);return V1(n.name,n.files,{region:e.region,projectName:"default"},{taskId:e.taskId,sessionStorage:"in-memory",minInstance:1,maxInstance:1,description:t.description,im:{feishu:{enabled:!0}},envs:[{key:"FEISHU_APP_ID",value:e.appId},{key:"FEISHU_APP_SECRET",value:e.appSecret}],onStage:e.onStage})}const Kc=[{value:"cn-beijing",label:"北京"},{value:"cn-shanghai",label:"上海"}],owe=[{phase:"prepare",label:"生成智能体"},{phase:"build",label:"构建镜像"},{phase:"deploy",label:"创建 Runtime"},{phase:"publish",label:"发布服务"}];function eAt(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m9.8 3.5-4.5 4.5 4.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function tAt(e){return o.jsx("svg",{viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m5 7 4 4 4-4",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function KJ(e){return o.jsx("svg",{viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m4 9.2 3.1 3.1L14 5.8",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function nAt(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"M6.5 4H4.8A1.8 1.8 0 0 0 3 5.8v5.4A1.8 1.8 0 0 0 4.8 13h5.4a1.8 1.8 0 0 0 1.8-1.8V9.5M9 3h4v4M12.5 3.5 7.2 8.8",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function rAt(e){if(!e||e==="upload")return 0;const t=owe.findIndex(n=>n.phase===e);return t<0?0:t}function qP(e){switch(e){case"prepare":case"upload":case"build":case"deploy":case"publish":case"update":case"evaluation":return e;default:return"unknown"}}function iAt({onBack:e}){var ie;const[t,n]=p.useState("feishu_assistant"),[r,i]=p.useState(""),[s,a]=p.useState(""),[l,c]=p.useState(!1),[u,d]=p.useState("cn-beijing"),[f,h]=p.useState(!1),[m,g]=p.useState(""),[b,y]=p.useState(""),[O,v]=p.useState(""),[x,w]=p.useState("idle"),[S,E]=p.useState(null),[k,_]=p.useState(""),[C,T]=p.useState(null),A=p.useRef(null),j=p.useRef(null),L=p.useRef([]),I=p.useRef(0),M=p.useRef(null),N=p.useRef(null),D=p.useRef("prepare"),Q=p.useRef(!1),F=p.useRef(!0),$=["preparing","running","cancelling"].includes(x);p.useEffect(()=>(F.current=!0,()=>{F.current=!1}),[]),p.useEffect(()=>{var K;if(!f)return;(K=L.current[I.current])==null||K.focus();const q=de=>{de.target instanceof Node&&A.current&&!A.current.contains(de.target)&&h(!1)},X=de=>{var xe;de.key==="Escape"&&(h(!1),(xe=j.current)==null||xe.focus())};return window.addEventListener("pointerdown",q),window.addEventListener("keydown",X),()=>{window.removeEventListener("pointerdown",q),window.removeEventListener("keydown",X)}},[f]);const H=q=>{q.key==="Enter"&&(q.nativeEvent.isComposing||q.nativeEvent.keyCode===229)&&q.preventDefault()},z=()=>{const q=A1(t.trim())??"",X=r.trim()?"":"请输入飞书 App ID",K=s.trim()?"":"请输入飞书 App Secret";return g(q),y(X),v(K),!q&&!X&&!K},B=async q=>{if(q.preventDefault(),!z()||$)return;const X=crypto.randomUUID();M.current=X,D.current="prepare",Q.current=!1,w("preparing"),E(null),_(""),T(null);const K=swe({agentId:String(t.trim()),deployAction:"create",deploySource:"feishu_automation",createMode:"feishu_template",aiAssisted:0,deployRegion:String(u),runtimeNetworkType:"public",feishuEnabled:1});N.current=K;try{const de=await JCt({agentName:t.trim(),appId:r.trim(),appSecret:s.trim(),region:u,taskId:X,onStage:xe=>{D.current=xe.phase||"deploy",!(!F.current||Q.current)&&(w("running"),E(xe))}});if(Q.current){K.fail({failedPhase:qP(D.current),errorKind:"abort",errorMessage:Dy("用户取消部署")});return}if(K.succeed({runtimeId:String(de.runtimeId||"")}),!F.current)return;T(de),a(""),c(!1),w("succeeded")}catch(de){if(K.fail({failedPhase:qP(D.current),...Q.current?{errorKind:"abort"}:fo(de,{phase:D.current}),errorMessage:Dy(de)}),!F.current||Q.current)return;w("failed"),_(de instanceof Error?de.message:String(de))}finally{M.current===X&&(M.current=null),N.current===K&&(N.current=null)}},V=async()=>{var X;const q=M.current;if(!(!q||x!=="running")&&window.confirm("取消部署将停止任务并清理已创建的 Runtime,确定继续吗?")){Q.current=!0,w("cancelling"),_("");try{await Xoe(q),(X=N.current)==null||X.fail({failedPhase:qP(D.current),errorKind:"abort",errorMessage:Dy("用户取消部署")}),F.current&&w("cancelled")}catch(K){if(Q.current=!1,!F.current)return;w("failed"),_(K instanceof Error?K.message:String(K))}}},Z=rAt((S==null?void 0:S.phase)??null),ce=!!(t.trim()&&r.trim()&&s.trim()&&!$),be=Kc.find(q=>q.value===u);return o.jsxs("div",{className:"feishu-integration-page",children:[o.jsxs("header",{className:"feishu-integration-header",children:[o.jsx("button",{type:"button",className:"feishu-back",onClick:e,"aria-label":"返回自动化列表",disabled:$,children:o.jsx(eAt,{})}),o.jsx("img",{className:"feishu-integration-logo",src:xR,alt:"","aria-hidden":"true"}),o.jsxs("div",{children:[o.jsx("h1",{children:"飞书机器人"}),o.jsx("p",{children:"创建一个由 AgentKit Runtime 驱动的飞书智能体"})]})]}),o.jsx("div",{className:"feishu-integration-layout",children:o.jsxs("section",{className:"feishu-section-panel",children:[o.jsx("p",{className:"feishu-panel-description",children:"填写已发布飞书应用的凭据,Studio 将生成 basic 智能体、创建独立 Runtime,并启用飞书消息长连接。"}),o.jsxs("form",{className:"feishu-form",onSubmit:B,onKeyDown:H,noValidate:!0,children:[o.jsxs("div",{className:"feishu-field-grid",children:[o.jsxs("div",{className:"feishu-field",children:[o.jsx("label",{htmlFor:"feishu-agent-name",children:"智能体名称"}),o.jsx("input",{id:"feishu-agent-name",value:t,maxLength:64,disabled:$,onChange:q=>{n(q.target.value),m&&g("")},onBlur:()=>g(A1(t.trim())??""),"aria-invalid":!!m,"aria-describedby":`feishu-agent-name-help${m?" feishu-agent-name-error":""}`}),o.jsx("span",{id:"feishu-agent-name-help",className:"feishu-field-help",children:"将作为新 Runtime 中的根智能体名称"}),m?o.jsx("span",{id:"feishu-agent-name-error",className:"feishu-field-error",role:"alert",children:m}):null]}),o.jsxs("div",{className:"feishu-field",children:[o.jsx("label",{id:"feishu-region-label",children:"部署地域"}),o.jsxs("div",{className:"feishu-region-picker",ref:A,children:[o.jsxs("button",{ref:j,type:"button",className:"feishu-region-trigger",disabled:$,"aria-haspopup":"listbox","aria-expanded":f,"aria-labelledby":"feishu-region-label feishu-region-value",onClick:()=>{I.current=Kc.findIndex(q=>q.value===u),h(q=>!q)},onKeyDown:q=>{q.key!=="ArrowDown"&&q.key!=="ArrowUp"||(q.preventDefault(),I.current=q.key==="ArrowUp"?Kc.length-1:Kc.findIndex(X=>X.value===u),h(!0))},children:[o.jsx("span",{id:"feishu-region-value",children:be.label}),o.jsx(tAt,{})]}),f?o.jsx("div",{className:"feishu-region-menu",role:"listbox","aria-label":"部署地域",onKeyDown:q=>{var de;const X=L.current.findIndex(xe=>xe===document.activeElement);let K=null;q.key==="ArrowDown"?K=(X+1)%Kc.length:q.key==="ArrowUp"?K=(X-1+Kc.length)%Kc.length:q.key==="Home"?K=0:q.key==="End"?K=Kc.length-1:q.key==="Tab"&&h(!1),K!==null&&(q.preventDefault(),(de=L.current[K])==null||de.focus())},children:Kc.map(q=>o.jsx("button",{ref:X=>{const K=Kc.findIndex(de=>de.value===q.value);L.current[K]=X},type:"button",role:"option","aria-selected":u===q.value,className:`feishu-region-option${u===q.value?" is-selected":""}`,onClick:()=>{var X;d(q.value),h(!1),(X=j.current)==null||X.focus()},children:q.label},q.value))}):null]}),o.jsx("span",{className:"feishu-field-help",children:"Runtime 与构建产物将创建在该地域"})]}),o.jsxs("div",{className:"feishu-field",children:[o.jsx("label",{htmlFor:"feishu-app-id",children:"飞书 App ID"}),o.jsx("input",{id:"feishu-app-id",value:r,maxLength:128,autoComplete:"off",disabled:$,placeholder:"cli_xxxxxxxxxxxxxxxx",onChange:q=>{i(q.target.value),b&&y("")},onBlur:()=>y(r.trim()?"":"请输入飞书 App ID"),"aria-invalid":!!b,"aria-describedby":`feishu-app-id-help${b?" feishu-app-id-error":""}`}),o.jsx("span",{id:"feishu-app-id-help",className:"feishu-field-help",children:"来自飞书开放平台的应用凭证"}),b?o.jsx("span",{id:"feishu-app-id-error",className:"feishu-field-error",role:"alert",children:b}):null]}),o.jsxs("div",{className:"feishu-field",children:[o.jsx("label",{htmlFor:"feishu-app-secret",children:"飞书 App Secret"}),o.jsxs("div",{className:"feishu-secret-input",children:[o.jsx("input",{id:"feishu-app-secret",type:l?"text":"password",value:s,maxLength:256,autoComplete:"off",disabled:$,placeholder:"请输入 App Secret",onChange:q=>{a(q.target.value),O&&v("")},onBlur:()=>v(s.trim()?"":"请输入飞书 App Secret"),"aria-invalid":!!O,"aria-describedby":`feishu-app-secret-help${O?" feishu-app-secret-error":""}`}),o.jsx("button",{type:"button",disabled:$,onClick:()=>c(q=>!q),"aria-label":l?"隐藏 App Secret":"显示 App Secret",children:l?"隐藏":"显示"})]}),o.jsx("span",{id:"feishu-app-secret-help",className:"feishu-field-help",children:"仅写入新 Runtime 的环境变量"}),O?o.jsx("span",{id:"feishu-app-secret-error",className:"feishu-field-error",role:"alert",children:O}):null]})]}),x!=="idle"?o.jsxs("div",{className:`feishu-deployment-status is-${x}`,role:x==="failed"?"alert":"status",children:[o.jsxs("div",{className:"feishu-deployment-heading",children:[x==="preparing"?o.jsx(En,{as:"strong",children:"正在生成 basic 智能体"}):null,x==="running"?o.jsx(En,{as:"strong",children:(S==null?void 0:S.message)||"正在创建 Runtime"}):null,x==="cancelling"?o.jsx(En,{as:"strong",children:"正在取消部署"}):null,x==="succeeded"?o.jsxs("strong",{children:[o.jsx(KJ,{}),"飞书机器人 Runtime 已创建"]}):null,x==="cancelled"?o.jsx("strong",{children:"部署已取消"}):null,x==="failed"?o.jsx("strong",{children:"创建失败"}):null]}),x==="preparing"||x==="running"||x==="cancelling"?o.jsx("ol",{className:"feishu-deployment-steps",children:owe.map((q,X)=>{const K=x==="running"&&Xq.value===(C.region||u)))==null?void 0:ie.label)||C.region}),C.consoleUrl?o.jsxs("a",{href:C.consoleUrl,target:"_blank",rel:"noreferrer",children:["打开 Runtime 控制台",o.jsx(nAt,{})]}):null]}):null]}):null,o.jsxs("div",{className:"feishu-form-actions",children:[o.jsxs("div",{className:"feishu-secrets-note",children:[o.jsx("strong",{children:"凭据处理"}),o.jsx("span",{children:"App Secret 仅用于本次部署,不会写入生成源码或浏览器存储。"})]}),o.jsxs("div",{className:"feishu-action-buttons",children:[x==="running"?o.jsx("button",{type:"button",className:"feishu-cancel",onClick:()=>void V(),children:"取消部署"}):null,o.jsx("button",{type:"submit",className:"feishu-submit",disabled:!ce,children:$?"正在创建…":"创建飞书机器人 Runtime"})]})]})]})]})})]})}async function SU(e,t,n,r=_o){var s;const i=await In(e,{...t,headers:{accept:"application/json",...t.headers},signal:n},r);if(!i.ok){let a="";try{a=((s=(await i.json()).detail)==null?void 0:s.trim())||""}catch{}throw new Error(a||`请求失败 (${i.status})`)}return i.json()}function sAt(e){return SU("/web/coding-agents/capabilities",{method:"GET"},e,i9)}function aAt(e,t){return SU(`/web/coding-agents/skills/${encodeURIComponent(e)}/preview`,{method:"GET"},t)}function oAt(e,t){return SU("/web/coding-agents/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)},t)}const lAt="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='16'%20height='16'%20rx='3.692'%20fill='%231A1B1D'/%3e%3cpath%20d='M13.235%205.829V4.332H2.758v5.987h1.496v1.496h8.981V5.828Zm-1.497%204.49H4.254V5.83h7.484v4.49Z'%20fill='%2332F08C'/%3e%3cpath%20d='M6.937%206.993%205.88%208.051%206.937%209.11%207.995%208.05%206.937%206.993ZM9.931%206.992%208.873%208.05%209.931%209.11%2010.99%208.05%209.93%206.992Z'%20fill='%2332F08C'/%3e%3c/svg%3e";function cAt(){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"m4 4 8 8m0-8-8 8",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})}function JJ(){return o.jsxs("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[o.jsx("path",{d:"M4 1.8h5l3 3V14H4z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"}),o.jsx("path",{d:"M9 1.8V5h3M6 8h4M6 10.5h4",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function eee(){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:o.jsx("path",{d:"M1.8 4.5h4l1.2-1.3h2.2l1.2 1.3h3.8v8H1.8z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})})}function uAt(e){return e instanceof DOMException&&e.name==="AbortError"}function dAt(e){return e instanceof Error&&e.message?e.message:"读取 Skill 文件失败"}function fAt(e){return e<1024?`${e} B`:`${(e/1024).toFixed(e<10*1024?1:0)} KB`}function hAt(e){const t=e.split("/");return t[t.length-1]??e}function pAt(e){const t=new Map;for(const n of e){const r=n.path.split("/"),i=r.length>1?r.slice(0,-1).join("/"):"";t.set(i,[...t.get(i)??[],n])}return Array.from(t,([n,r])=>({directory:n,files:r})).sort((n,r)=>n.directory?r.directory?n.directory.localeCompare(r.directory):1:-1)}function mAt({skill:e,onClose:t}){const n=p.useRef(null),r=p.useRef(null),i=p.useId(),s=p.useId(),[a,l]=p.useState(null),[c,u]=p.useState(""),[d,f]=p.useState(!0),[h,m]=p.useState(""),[g,b]=p.useState(0);p.useEffect(()=>{r.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const v=n.current;return v&&!v.open&&v.showModal(),()=>{var x;v!=null&&v.open&&v.close(),(x=r.current)==null||x.focus()}},[]),p.useEffect(()=>{const v=new AbortController;return f(!0),m(""),l(null),u(""),aAt(e.id,v.signal).then(x=>{if(v.signal.aborted)return;l(x);const w=x.files.find(S=>S.path==="SKILL.md")??x.files[0];u((w==null?void 0:w.path)??"")}).catch(x=>{!v.signal.aborted&&!uAt(x)&&m(dAt(x))}).finally(()=>{v.signal.aborted||f(!1)}),()=>v.abort()},[g,e.id]);const y=p.useMemo(()=>pAt((a==null?void 0:a.files)??[]),[a]),O=(a==null?void 0:a.files.find(v=>v.path===c))??null;return o.jsxs("dialog",{ref:n,className:"coding-agents-preview-dialog","aria-labelledby":i,"aria-describedby":s,onCancel:v=>{v.preventDefault(),t()},onMouseDown:v=>{const x=v.currentTarget.getBoundingClientRect();(v.clientXx.right||v.clientYx.bottom)&&t()},children:[o.jsxs("header",{className:"coding-agents-preview-header",children:[o.jsx("span",{className:"coding-agents-preview-mark",children:o.jsx(eee,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:i,children:e.name}),o.jsx("p",{id:s,children:"只读浏览随 Studio 提供的 Skill 文件"})]}),o.jsx("button",{type:"button",autoFocus:!0,"aria-label":"关闭文件预览",onClick:t,children:o.jsx(cAt,{})})]}),d?o.jsxs("div",{className:"coding-agents-preview-state",children:[o.jsx("i",{}),"正在读取文件…"]}):h?o.jsxs("div",{className:"coding-agents-preview-state is-error",role:"alert",children:[o.jsx("span",{children:h}),o.jsx("button",{type:"button",onClick:()=>b(v=>v+1),children:"重试"})]}):o.jsxs("div",{className:"coding-agents-preview-layout",children:[o.jsxs("nav",{className:"coding-agents-preview-tree","aria-label":`${e.name} 文件`,children:[o.jsxs("div",{className:"coding-agents-preview-tree-title",children:[o.jsx("span",{children:"文件"}),o.jsx("small",{children:(a==null?void 0:a.files.length)??0})]}),o.jsx("div",{className:"coding-agents-preview-tree-scroll",children:y.map(v=>v.directory?o.jsxs("details",{open:!0,children:[o.jsxs("summary",{children:[o.jsx(eee,{}),o.jsx("span",{children:v.directory})]}),o.jsx("div",{children:v.files.map(x=>o.jsxs("button",{type:"button",className:c===x.path?"is-selected":"","aria-current":c===x.path?"true":void 0,onClick:()=>u(x.path),children:[o.jsx(JJ,{}),o.jsx("span",{children:hAt(x.path)})]},x.path))})]},v.directory):v.files.map(x=>o.jsxs("button",{type:"button",className:c===x.path?"is-selected":"","aria-current":c===x.path?"true":void 0,onClick:()=>u(x.path),children:[o.jsx(JJ,{}),o.jsx("span",{children:x.path})]},x.path)))})]}),o.jsx("section",{className:"coding-agents-preview-file","aria-label":"文件内容",children:O?o.jsxs(o.Fragment,{children:[o.jsxs("header",{children:[o.jsx("strong",{children:O.path}),o.jsx("span",{children:fAt(O.size)})]}),O.previewable&&O.content!==null?o.jsx("pre",{tabIndex:0,children:o.jsx("code",{children:O.content})}):o.jsx("div",{className:"coding-agents-preview-unavailable",children:"此文件不是可预览的 UTF-8 文本。"})]}):o.jsx("div",{className:"coding-agents-preview-unavailable",children:"没有可预览的文件。"})})]})]})}function gAt(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m9.8 3.5-4.5 4.5 4.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function bAt(e){return o.jsxs("svg",{viewBox:"0 0 32 32",fill:"none","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"5",width:"16",height:"16",rx:"4.5",stroke:"currentColor",strokeWidth:"1.5"}),o.jsx("path",{d:"m8.5 11-2.4 2.4 2.4 2.4M11 16.5h3.8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("circle",{cx:"24.5",cy:"10.5",r:"2.5",stroke:"currentColor",strokeWidth:"1.5"}),o.jsx("circle",{cx:"24.5",cy:"24.5",r:"2.5",stroke:"currentColor",strokeWidth:"1.5"}),o.jsx("path",{d:"M19.5 10.5H22M18.2 19l4.3 3.7M24.5 13v9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function yAt(e){return o.jsx("svg",{viewBox:"0 0 32 32",fill:"none","aria-hidden":"true",...e,children:o.jsxs("g",{stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",children:[o.jsx("path",{d:"M16 4.5v7M16 20.5v7"}),o.jsx("path",{d:"m9.3 6.3 3.5 6.1M19.2 19.6l3.5 6.1"}),o.jsx("path",{d:"m5.9 11.1 6.2 3.5M19.9 17.4l6.2 3.5"}),o.jsx("path",{d:"M4.7 16h7M20.3 16h7"}),o.jsx("path",{d:"m5.9 20.9 6.2-3.5M19.9 14.6l6.2-3.5"}),o.jsx("path",{d:"m9.3 25.7 3.5-6.1M19.2 12.4l3.5-6.1"})]})})}function OAt(e){return o.jsxs("svg",{viewBox:"0 0 32 32",fill:"none","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M15.8 4.2c2.4 0 4.5 1.2 5.7 3.1 2.2-.3 4.5.8 5.6 2.9 1.1 2 .8 4.4-.5 6.1 1.2 1.8 1.3 4.3.1 6.2-1.2 2-3.4 3-5.6 2.6-1.3 1.8-3.5 2.9-5.8 2.7-2.2-.2-4.1-1.5-5.1-3.4-2.2.1-4.4-1-5.4-3.1-1-2-.6-4.4.8-6.1-1.1-1.9-1.1-4.3.2-6.1 1.3-1.9 3.6-2.7 5.7-2.2 1.1-1.7 2.6-2.7 4.3-2.7Z",stroke:"currentColor",strokeWidth:"1.7",strokeLinejoin:"round"}),o.jsx("path",{d:"m10.7 12.2 3.1 3.8-3.1 3.8M17.1 20h4.3",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function tee(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m3.4 8.2 3 3L12.8 5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})})}function xAt(e){return o.jsxs("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",...e,children:[o.jsx("path",{d:"M2.8 6.3h14.4v8.3a1.6 1.6 0 0 1-1.6 1.6H4.4a1.6 1.6 0 0 1-1.6-1.6V6.3Z",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"}),o.jsx("path",{d:"M2.8 6.3V5.1a1.4 1.4 0 0 1 1.4-1.4h3.4l1.5 1.6h6.5a1.6 1.6 0 0 1 1.6 1.6",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"})]})}function vAt({agentId:e}){return e==="trae"?o.jsx("img",{src:lAt,alt:"","aria-hidden":"true"}):e==="claude-code"?o.jsx(yAt,{}):o.jsx(OAt,{})}function nee(e){return e instanceof DOMException&&e.name==="AbortError"}function ree(e,t){return e instanceof Error&&e.message?e.message:t}function wAt({onBack:e}){var T;const[t,n]=p.useState(null),[r,i]=p.useState(!0),[s,a]=p.useState(""),[l,c]=p.useState(0),[u,d]=p.useState(new Set),[f,h]=p.useState(new Set),[m,g]=p.useState(null),[b,y]=p.useState(!1),[O,v]=p.useState(null),x=p.useRef(null);p.useEffect(()=>{const A=new AbortController;return i(!0),a(""),sAt(A.signal).then(j=>{if(A.signal.aborted)return;n(j);const L=j.agents.filter(I=>I.available);d(I=>{const M=L.filter(N=>I.has(N.id));return new Set((M.length?M:L.slice(0,1)).map(N=>N.id))}),h(I=>{const M=j.skills.filter(N=>I.has(N.id));return new Set((M.length?M:j.skills).map(N=>N.id))})}).catch(j=>{!nee(j)&&!A.signal.aborted&&(n(null),a(ree(j,"检测本机客户端失败")))}).finally(()=>{A.signal.aborted||i(!1)}),()=>A.abort()},[l]),p.useEffect(()=>()=>{var A;return(A=x.current)==null?void 0:A.abort()},[]);const w=p.useMemo(()=>(t==null?void 0:t.agents.filter(A=>A.available&&u.has(A.id)))||[],[t,u]),S=p.useMemo(()=>(t==null?void 0:t.skills.filter(A=>f.has(A.id)))||[],[t,f]),E=!!(!b&&w.length&&S.length),k=(A,j)=>{!j||b||(v(null),d(L=>{const I=new Set(L);return I.has(A)?I.delete(A):I.add(A),I}))},_=A=>{b||(v(null),h(j=>{const L=new Set(j);return L.has(A)?L.delete(A):L.add(A),L}))},C=async()=>{var j;if(!E)return;(j=x.current)==null||j.abort();const A=new AbortController;x.current=A,y(!0),v(null);try{const L=await oAt({agents:w.map(M=>M.id),skills:S.map(M=>M.id)},A.signal);if(A.signal.aborted)return;const I=L.installations;v({tone:"success",message:`已为 ${w.length} 个客户端配置 ${S.length} 个 Skill`,details:I.map(M=>`${M.agentName} · ${M.skill} → ${M.displayPath}`)})}catch(L){!nee(L)&&!A.signal.aborted&&v({tone:"error",message:ree(L,"配置失败,请检查用户目录权限后重试")})}finally{x.current===A&&(x.current=null),A.signal.aborted||y(!1)}};return o.jsxs("section",{className:"coding-agents-page",children:[o.jsxs("header",{className:"coding-agents-header",children:[o.jsx("button",{type:"button",className:"coding-agents-back",onClick:e,disabled:b,"aria-label":"返回自动化列表",children:o.jsx(gAt,{})}),o.jsx(bAt,{className:"coding-agents-logo"}),o.jsxs("div",{children:[o.jsx("h1",{children:"配置 Coding Agents"}),o.jsx("p",{children:"把随 Studio 提供的 AgentKit Skills 全局安装到本地编码客户端。"})]})]}),o.jsx("div",{className:"coding-agents-scroll",children:o.jsxs("div",{className:"coding-agents-content",children:[o.jsxs("section",{className:"coding-agents-section","aria-label":"选择 Coding Agent",children:[o.jsxs("div",{className:"coding-agents-section-heading",children:[o.jsxs("div",{children:[o.jsx("span",{children:"1"}),o.jsx("h2",{children:"本机客户端"})]}),o.jsx("button",{type:"button",onClick:()=>c(A=>A+1),disabled:r||b,children:"重新检测"})]}),r?o.jsxs("div",{className:"coding-agents-inline-state",children:[o.jsx("i",{}),"正在检测本机客户端…"]}):s?o.jsxs("div",{className:"coding-agents-error-row",role:"alert",children:[o.jsx("span",{children:s}),o.jsx("button",{type:"button",onClick:()=>c(A=>A+1),children:"重试"})]}):o.jsx("div",{className:"coding-agents-agent-grid",children:t==null?void 0:t.agents.map(A=>o.jsxs("button",{type:"button",className:`coding-agents-agent ${u.has(A.id)?"is-selected":""}`,"aria-pressed":u.has(A.id),disabled:!A.available||b,onClick:()=>k(A.id,A.available),title:A.available?A.name:A.reason,children:[o.jsx("span",{className:`coding-agents-agent-mark is-${A.id}`,children:o.jsx(vAt,{agentId:A.id})}),o.jsxs("span",{className:"coding-agents-agent-copy",children:[o.jsx("strong",{children:A.name}),o.jsx("small",{children:A.available?A.version||"已检测到客户端":A.reason})]}),o.jsx("span",{className:`coding-agents-status ${A.available?"is-ready":""}`,children:A.available?"可用":"未检测到"}),o.jsx("span",{className:"coding-agents-check",children:o.jsx(tee,{})})]},A.id))})]}),o.jsxs("section",{className:"coding-agents-section","aria-label":"选择内置 Skill",children:[o.jsx("div",{className:"coding-agents-section-heading",children:o.jsxs("div",{children:[o.jsx("span",{children:"2"}),o.jsx("h2",{children:"内置 Skills"})]})}),o.jsx("div",{className:"coding-agents-skill-list",children:t==null?void 0:t.skills.map(A=>o.jsxs("div",{className:`coding-agents-skill ${f.has(A.id)?"is-selected":""}`,children:[o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:f.has(A.id),onChange:()=>_(A.id),disabled:b}),o.jsx("span",{className:"coding-agents-skill-check","aria-hidden":"true",children:o.jsx(tee,{})}),o.jsxs("span",{children:[o.jsx("strong",{children:A.name}),o.jsx("small",{children:A.description})]})]}),o.jsx("button",{type:"button",onClick:()=>g(A),children:"查看文件"})]},A.id))}),o.jsxs("div",{className:"coding-agents-global","aria-label":"全局安装目录",children:[o.jsxs("div",{className:"coding-agents-global-heading",children:[o.jsx(xAt,{}),o.jsxs("div",{children:[o.jsx("strong",{children:"全局安装"}),o.jsx("span",{children:"配置后可在本机其他项目中使用"})]})]}),w.length?o.jsx("dl",{children:w.map(A=>o.jsxs("div",{children:[o.jsx("dt",{children:A.name}),o.jsx("dd",{children:A.globalSkillsPath})]},A.id))}):o.jsx("p",{children:"选择客户端后显示对应安装目录。"})]})]}),O?o.jsxs("div",{className:`coding-agents-result is-${O.tone}`,role:O.tone==="error"?"alert":"status",children:[o.jsx("strong",{children:O.message}),(T=O.details)!=null&&T.length?o.jsx("ul",{children:O.details.map(A=>o.jsx("li",{children:A},A))}):null]}):null,o.jsxs("div",{className:"coding-agents-actions",children:[o.jsx("span",{children:w.length?`已选择 ${w.length} 个客户端、${S.length} 个 Skill`:"请先选择客户端"}),o.jsx("button",{type:"button",onClick:()=>void C(),disabled:!E,children:b?"正在配置…":"配置"})]})]})}),m?o.jsx(mAt,{skill:m,onClose:()=>g(null)}):null]})}async function EU(e,t){const n=await e.json().catch(()=>null),r=typeof(n==null?void 0:n.detail)=="string"?n.detail:"";return new Error(r||`${t}(HTTP ${e.status})`)}async function SAt(e){const t=await In("/web/website-integrations",{cache:"no-store",signal:e});if(!t.ok)throw await EU(t,"加载网站集成失败");return(await t.json()).integrations??[]}async function EAt(e){const t=await In("/web/website-integrations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw await EU(t,"创建网站集成失败");return t.json()}async function kAt(e){const t=await In(`/web/website-integrations/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok)throw await EU(t,"删除网站集成失败")}function _At(e){return o.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m9.8 3.5-4.5 4.5 4.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function iee(e){return o.jsxs("svg",{viewBox:"0 0 32 32",fill:"none","aria-hidden":"true",...e,children:[o.jsx("rect",{x:"3.5",y:"5",width:"20",height:"17",rx:"3.5",stroke:"currentColor",strokeWidth:"1.5"}),o.jsx("path",{d:"M4.5 10h18M8.5 7.5h.1M11.5 7.5h.1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),o.jsx("path",{d:"M17 18.5a5 5 0 0 1 5-5h1.5a5 5 0 0 1 5 5V23a5 5 0 0 1-5 5H22l-3.5 2.5v-3.3A5 5 0 0 1 17 23v-4.5Z",fill:"hsl(var(--background))",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),o.jsx("path",{d:"M21 19h4M21 22.5h3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function TAt(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}async function CAt(e){const t=[];let n="";for(let r=0;r<10;r+=1){const i=await H1({nextToken:n||void 0,pageSize:100,region:"all",scope:"all"});if(e.aborted)return[];if(t.push(...i.runtimes),n=i.nextToken,!n)break}return t}function AAt({onBack:e}){const[t,n]=p.useState([]),[r,i]=p.useState([]),[s,a]=p.useState(""),[l,c]=p.useState(""),[u,d]=p.useState(""),[f,h]=p.useState(!0),[m,g]=p.useState(!1),[b,y]=p.useState(""),[O,v]=p.useState("");p.useEffect(()=>{const C=new AbortController;return h(!0),v(""),Promise.all([SAt(C.signal),CAt(C.signal)]).then(([T,A])=>{var L;if(C.signal.aborted)return;n(T),i(A),c(((L=T[0])==null?void 0:L.id)??"");const j=A[0];j&&a(`${j.region}::${j.runtimeId}`)}).catch(T=>{C.signal.aborted||v(T instanceof Error?T.message:"加载网站集成失败")}).finally(()=>{C.signal.aborted||h(!1)}),()=>C.abort()},[]);const x=p.useMemo(()=>r.map(C=>({value:`${C.region}::${C.runtimeId}`,label:C.name||C.runtimeId,description:`${C.region} · ${C.status}`,runtime:C})),[r]),w=p.useMemo(()=>new Map(x.map(C=>[C.value,C.runtime])),[x]),S=t.find(C=>C.id===l)??t[0],E=S?` +