From 0a2bf58d75ebca975362c40cf7ce6729f1ce3750 Mon Sep 17 00:00:00 2001 From: "yanan.zhangyn" Date: Mon, 24 Aug 2026 23:51:47 +0800 Subject: [PATCH 1/2] fix(studio): route managed MCP tools through sidecar --- frontend/src/create/CustomCreate.tsx | 23 +- frontend/src/create/deploymentEnv.ts | 10 +- frontend/src/create/mcpGatewayEnv.ts | 96 ++++ frontend/src/ui/ProjectPreview.tsx | 68 ++- frontend/tests/agentWorkspace.test.mjs | 2 +- .../tests/debugErrorPresentation.test.mjs | 24 +- frontend/tests/deploymentEnv.test.mjs | 31 ++ frontend/tests/mcpGatewayEnv.test.mjs | 203 ++++++++ .../test_generated_agent_harness_sidecar.py | 60 +++ tests/cli/test_studio_rbac.py | 3 +- veadk/cli/cli_frontend.py | 5 +- veadk/cli/generated_agent_codegen.py | 81 ++- .../{index-CXqNedNy.js => index-B9BtGdvS.js} | 484 +++++++++--------- ...ww.js => MarkdownPromptEditor-BWLhh-Kn.js} | 2 +- .../{arc-sRBhsxpP.js => arc-DrU_PDmo.js} | 2 +- ...hannel-rKf8bukp.js => channel-DHFV--CI.js} | 2 +- ...{linear-mIGlavsz.js => linear-CPpy0lzr.js} | 2 +- ...8U.js => abnfDiagram-N423BO3Z-CbR2aK_K.js} | 2 +- ... architectureDiagram-T3A2C74G-6pVSJM1X.js} | 2 +- ...n.js => blockDiagram-VBNYF7ZC-MwYg-O2l.js} | 2 +- ...aExu.js => c4Diagram-5PPSVZJV-8doEscWa.js} | 2 +- ...Qsyu2nVd.js => chunk-2GRJ4B5K-G4PF3hfu.js} | 2 +- ...CEA-oyP4.js => chunk-2Q5K7J3B-B4JmMDvm.js} | 2 +- ...D_g9IDZo.js => chunk-5RXB4S5H-DqasuJ7m.js} | 2 +- ...CNtPBefl.js => chunk-5VM5RSS4-BAL22RqJ.js} | 2 +- ...1mGbObAR.js => chunk-6Q2QTUOP-DRGAFnps.js} | 2 +- ...C6u_8qcd.js => chunk-GF5L2VYU-BqH1tRR_.js} | 2 +- ...DiuS78aC.js => chunk-JWPE2WC7-BX0oJtaC.js} | 2 +- ...frh4Ht4Z.js => chunk-KBJHAD2P-DtnJtbP5.js} | 2 +- ...p2ZpKfoe.js => chunk-RYQCIY6F-Db6F-mJ2.js} | 2 +- ...Ak5urIOy.js => chunk-XXDRQBXY-BmSdLknv.js} | 2 +- .../mermaid/classDiagram-JCYQIIEL-CeWMGN0g.js | 1 - .../mermaid/classDiagram-JCYQIIEL-Cl74QkWN.js | 1 + .../classDiagram-v2-OCEON4UE-CeWMGN0g.js | 1 - .../classDiagram-v2-OCEON4UE-Cl74QkWN.js | 1 + ...w.js => cose-bilkent-JH36ORCC-apwzrAY8.js} | 2 +- ...jeowma.js => cynefin-OW5HDTMX-CdB-YAs4.js} | 2 +- ...js => cynefinDiagram-MW4NZA55-hc9OlVN3.js} | 2 +- ...NiLHarH5.js => dagre-VZM6K2ZE-BAlZPL2K.js} | 2 +- ...fc5XUN.js => diagram-7IWD3JNH-DfJGCgvE.js} | 2 +- ...lEgP2R.js => diagram-B4RE2ZJO-Cr-DcJtt.js} | 2 +- ...mUTx5b.js => diagram-LBJQPF4R-Dy1Ydkl8.js} | 2 +- ...hhDrjA.js => diagram-Q27KOJAE-Bx0hJI9Z.js} | 2 +- ...IAoGm3.js => diagram-UB23O5K3-DywdOEic.js} | 2 +- ...3c.js => ebnfDiagram-BXEA7PRR-BXgh4k52.js} | 2 +- ...ziVK.js => erDiagram-JOGREHBK-BT0xq3p3.js} | 2 +- ...Sp.js => flowDiagram-UKHOOZJN-Bit_Iia-.js} | 2 +- ...K.js => ganttDiagram-PKOTCBZU-C1JrZnQA.js} | 2 +- ...s => gitGraphDiagram-DS77QQ5N-CXR9f4y0.js} | 2 +- ...LJ.js => infoDiagram-6WML65LV-C_TTo4EI.js} | 2 +- ...s => ishikawaDiagram-WSZJBQD7-B7nNcrJM.js} | 2 +- ...js => journeyDiagram-NVQOT4AX-DSK3Dv23.js} | 2 +- ...=> kanban-definition-27J2QSJJ-qe0LooX5.js} | 2 +- ...e-Bboy0vem.js => mermaid.core-BwbpQM0L.js} | 8 +- ...> mindmap-definition-FAOFIHXS-DNbqRidM.js} | 2 +- ...aD9.js => pegDiagram-VL7TDLO6-CiHB6aOa.js} | 2 +- ...dT1.js => pieDiagram-7S7Q4E2Y-zcplLQw9.js} | 2 +- ...s => quadrantDiagram-CIZ2JOQS-BQOEo73v.js} | 2 +- ...s => railroadDiagram-AXF67PYL-hF99mv26.js} | 2 +- ...> requirementDiagram-LRYGKXZP-dnx3B94n.js} | 2 +- ....js => sankeyDiagram-W5VNT64P-DpOxiA_e.js} | 2 +- ...s => sequenceDiagram-SI44F4Z6-CoG30ttl.js} | 2 +- ...yH.js => sizeCapture-X5ZJPWSS-B3KNyel_.js} | 2 +- ...9.js => stateDiagram-OKZ733FA-KYU1HJt_.js} | 2 +- .../stateDiagram-v2-UEYNNEHI-Cna_Ur4V.js | 1 - .../stateDiagram-v2-UEYNNEHI-xyDXztSZ.js | 1 + ...D98P.js => swimlanes-SLNWSIFB-DTrjq4Rs.js} | 4 +- .../swimlanesDiagram-ULZ7WXOC-CJgRDH0W.js | 8 - .../swimlanesDiagram-ULZ7WXOC-V2hB29EC.js | 8 + ... timeline-definition-Z64GVDOM-Ba9LxWgN.js} | 2 +- ...74.js => vennDiagram-T6HMQDX7-DpCio1Bm.js} | 2 +- ...js => wardleyDiagram-T6FBY63Y-DTHjy-lx.js} | 2 +- ...js => xychartDiagram-ELKLHX3M-BcrJw6pY.js} | 2 +- veadk/webui/index.html | 2 +- 74 files changed, 882 insertions(+), 344 deletions(-) create mode 100644 frontend/src/create/mcpGatewayEnv.ts create mode 100644 frontend/tests/mcpGatewayEnv.test.mjs rename veadk/webui/assets/app/{index-CXqNedNy.js => index-B9BtGdvS.js} (70%) rename veadk/webui/assets/chunks/{MarkdownPromptEditor-gp4PNdww.js => MarkdownPromptEditor-BWLhh-Kn.js} (99%) rename veadk/webui/assets/chunks/{arc-sRBhsxpP.js => arc-DrU_PDmo.js} (98%) rename veadk/webui/assets/chunks/{channel-rKf8bukp.js => channel-DHFV--CI.js} (53%) rename veadk/webui/assets/chunks/{linear-mIGlavsz.js => linear-CPpy0lzr.js} (98%) rename veadk/webui/assets/visualizations/mermaid/{abnfDiagram-N423BO3Z-DSqOEr8U.js => abnfDiagram-N423BO3Z-CbR2aK_K.js} (85%) rename veadk/webui/assets/visualizations/mermaid/{architectureDiagram-T3A2C74G-Bkf0LWx5.js => architectureDiagram-T3A2C74G-6pVSJM1X.js} (99%) rename veadk/webui/assets/visualizations/mermaid/{blockDiagram-VBNYF7ZC-86syBrNn.js => blockDiagram-VBNYF7ZC-MwYg-O2l.js} (99%) rename veadk/webui/assets/visualizations/mermaid/{c4Diagram-5PPSVZJV-qx4daExu.js => c4Diagram-5PPSVZJV-8doEscWa.js} (99%) rename veadk/webui/assets/visualizations/mermaid/{chunk-2GRJ4B5K-Qsyu2nVd.js => chunk-2GRJ4B5K-G4PF3hfu.js} (93%) rename veadk/webui/assets/visualizations/mermaid/{chunk-2Q5K7J3B-CEA-oyP4.js => chunk-2Q5K7J3B-B4JmMDvm.js} (66%) rename veadk/webui/assets/visualizations/mermaid/{chunk-5RXB4S5H-D_g9IDZo.js => chunk-5RXB4S5H-DqasuJ7m.js} (99%) rename veadk/webui/assets/visualizations/mermaid/{chunk-5VM5RSS4-CNtPBefl.js => chunk-5VM5RSS4-BAL22RqJ.js} (83%) rename veadk/webui/assets/visualizations/mermaid/{chunk-6Q2QTUOP-1mGbObAR.js => chunk-6Q2QTUOP-DRGAFnps.js} (99%) rename veadk/webui/assets/visualizations/mermaid/{chunk-GF5L2VYU-C6u_8qcd.js => chunk-GF5L2VYU-BqH1tRR_.js} (99%) rename veadk/webui/assets/visualizations/mermaid/{chunk-JWPE2WC7-DiuS78aC.js => chunk-JWPE2WC7-BX0oJtaC.js} (78%) rename veadk/webui/assets/visualizations/mermaid/{chunk-KBJHAD2P-frh4Ht4Z.js => chunk-KBJHAD2P-DtnJtbP5.js} (87%) rename veadk/webui/assets/visualizations/mermaid/{chunk-RYQCIY6F-p2ZpKfoe.js => chunk-RYQCIY6F-Db6F-mJ2.js} (99%) rename veadk/webui/assets/visualizations/mermaid/{chunk-XXDRQBXY-Ak5urIOy.js => chunk-XXDRQBXY-BmSdLknv.js} (52%) delete mode 100644 veadk/webui/assets/visualizations/mermaid/classDiagram-JCYQIIEL-CeWMGN0g.js create mode 100644 veadk/webui/assets/visualizations/mermaid/classDiagram-JCYQIIEL-Cl74QkWN.js delete mode 100644 veadk/webui/assets/visualizations/mermaid/classDiagram-v2-OCEON4UE-CeWMGN0g.js create mode 100644 veadk/webui/assets/visualizations/mermaid/classDiagram-v2-OCEON4UE-Cl74QkWN.js rename veadk/webui/assets/visualizations/mermaid/{cose-bilkent-JH36ORCC-CUpqkJsw.js => cose-bilkent-JH36ORCC-apwzrAY8.js} (99%) rename veadk/webui/assets/visualizations/mermaid/{cynefin-OW5HDTMX-Uwjeowma.js => cynefin-OW5HDTMX-CdB-YAs4.js} (99%) rename veadk/webui/assets/visualizations/mermaid/{cynefinDiagram-MW4NZA55-BTPkI9OJ.js => cynefinDiagram-MW4NZA55-hc9OlVN3.js} (98%) rename veadk/webui/assets/visualizations/mermaid/{dagre-VZM6K2ZE-NiLHarH5.js => dagre-VZM6K2ZE-BAlZPL2K.js} (97%) rename veadk/webui/assets/visualizations/mermaid/{diagram-7IWD3JNH-Dsfc5XUN.js => diagram-7IWD3JNH-DfJGCgvE.js} (96%) rename veadk/webui/assets/visualizations/mermaid/{diagram-B4RE2ZJO-arlEgP2R.js => diagram-B4RE2ZJO-Cr-DcJtt.js} (97%) rename veadk/webui/assets/visualizations/mermaid/{diagram-LBJQPF4R-DmmUTx5b.js => diagram-LBJQPF4R-Dy1Ydkl8.js} (93%) rename veadk/webui/assets/visualizations/mermaid/{diagram-Q27KOJAE-UUhhDrjA.js => diagram-Q27KOJAE-Bx0hJI9Z.js} (98%) rename veadk/webui/assets/visualizations/mermaid/{diagram-UB23O5K3-DHIAoGm3.js => diagram-UB23O5K3-DywdOEic.js} (95%) rename veadk/webui/assets/visualizations/mermaid/{ebnfDiagram-BXEA7PRR-BoW56h3c.js => ebnfDiagram-BXEA7PRR-BXgh4k52.js} (87%) rename veadk/webui/assets/visualizations/mermaid/{erDiagram-JOGREHBK-H4v_ziVK.js => erDiagram-JOGREHBK-BT0xq3p3.js} (99%) rename veadk/webui/assets/visualizations/mermaid/{flowDiagram-UKHOOZJN-BzeR9LSp.js => flowDiagram-UKHOOZJN-Bit_Iia-.js} (99%) rename veadk/webui/assets/visualizations/mermaid/{ganttDiagram-PKOTCBZU-C1CdFd4K.js => ganttDiagram-PKOTCBZU-C1JrZnQA.js} (99%) rename veadk/webui/assets/visualizations/mermaid/{gitGraphDiagram-DS77QQ5N-1b4VxzWc.js => gitGraphDiagram-DS77QQ5N-CXR9f4y0.js} (99%) rename veadk/webui/assets/visualizations/mermaid/{infoDiagram-6WML65LV-DbfxH4LJ.js => infoDiagram-6WML65LV-C_TTo4EI.js} (67%) rename veadk/webui/assets/visualizations/mermaid/{ishikawaDiagram-WSZJBQD7-5vn2ZD7Y.js => ishikawaDiagram-WSZJBQD7-B7nNcrJM.js} (99%) rename veadk/webui/assets/visualizations/mermaid/{journeyDiagram-NVQOT4AX-D3d-P653.js => journeyDiagram-NVQOT4AX-DSK3Dv23.js} (98%) rename veadk/webui/assets/visualizations/mermaid/{kanban-definition-27J2QSJJ-BEZd7gpI.js => kanban-definition-27J2QSJJ-qe0LooX5.js} (99%) rename veadk/webui/assets/visualizations/mermaid/{mermaid.core-Bboy0vem.js => mermaid.core-BwbpQM0L.js} (98%) rename veadk/webui/assets/visualizations/mermaid/{mindmap-definition-FAOFIHXS-DcJR3wRj.js => mindmap-definition-FAOFIHXS-DNbqRidM.js} (98%) rename veadk/webui/assets/visualizations/mermaid/{pegDiagram-VL7TDLO6-B6IwhaD9.js => pegDiagram-VL7TDLO6-CiHB6aOa.js} (86%) rename veadk/webui/assets/visualizations/mermaid/{pieDiagram-7S7Q4E2Y-B3S1bdT1.js => pieDiagram-7S7Q4E2Y-zcplLQw9.js} (95%) rename veadk/webui/assets/visualizations/mermaid/{quadrantDiagram-CIZ2JOQS-CrKfhVeH.js => quadrantDiagram-CIZ2JOQS-BQOEo73v.js} (99%) rename veadk/webui/assets/visualizations/mermaid/{railroadDiagram-AXF67PYL-C2cHHpPk.js => railroadDiagram-AXF67PYL-hF99mv26.js} (84%) rename veadk/webui/assets/visualizations/mermaid/{requirementDiagram-LRYGKXZP-DhTGQW4s.js => requirementDiagram-LRYGKXZP-dnx3B94n.js} (99%) rename veadk/webui/assets/visualizations/mermaid/{sankeyDiagram-W5VNT64P-VOk-tTam.js => sankeyDiagram-W5VNT64P-DpOxiA_e.js} (99%) rename veadk/webui/assets/visualizations/mermaid/{sequenceDiagram-SI44F4Z6-BkDPZ4eO.js => sequenceDiagram-SI44F4Z6-CoG30ttl.js} (99%) rename veadk/webui/assets/visualizations/mermaid/{sizeCapture-X5ZJPWSS-Dp3zNSyH.js => sizeCapture-X5ZJPWSS-B3KNyel_.js} (87%) rename veadk/webui/assets/visualizations/mermaid/{stateDiagram-OKZ733FA-BrGJ2QL9.js => stateDiagram-OKZ733FA-KYU1HJt_.js} (96%) delete mode 100644 veadk/webui/assets/visualizations/mermaid/stateDiagram-v2-UEYNNEHI-Cna_Ur4V.js create mode 100644 veadk/webui/assets/visualizations/mermaid/stateDiagram-v2-UEYNNEHI-xyDXztSZ.js rename veadk/webui/assets/visualizations/mermaid/{swimlanes-SLNWSIFB-CeS2D98P.js => swimlanes-SLNWSIFB-DTrjq4Rs.js} (99%) delete mode 100644 veadk/webui/assets/visualizations/mermaid/swimlanesDiagram-ULZ7WXOC-CJgRDH0W.js create mode 100644 veadk/webui/assets/visualizations/mermaid/swimlanesDiagram-ULZ7WXOC-V2hB29EC.js rename veadk/webui/assets/visualizations/mermaid/{timeline-definition-Z64GVDOM-CMlt24G7.js => timeline-definition-Z64GVDOM-Ba9LxWgN.js} (99%) rename veadk/webui/assets/visualizations/mermaid/{vennDiagram-T6HMQDX7-Ca_4g774.js => vennDiagram-T6HMQDX7-DpCio1Bm.js} (99%) rename veadk/webui/assets/visualizations/mermaid/{wardleyDiagram-T6FBY63Y-CQ1yw7f0.js => wardleyDiagram-T6FBY63Y-DTHjy-lx.js} (99%) rename veadk/webui/assets/visualizations/mermaid/{xychartDiagram-ELKLHX3M-D-1Xt9-2.js => xychartDiagram-ELKLHX3M-BcrJw6pY.js} (99%) diff --git a/frontend/src/create/CustomCreate.tsx b/frontend/src/create/CustomCreate.tsx index b09df15bc..d959eb22a 100644 --- a/frontend/src/create/CustomCreate.tsx +++ b/frontend/src/create/CustomCreate.tsx @@ -99,6 +99,7 @@ import { prepareMcpAuth, updateMcpAuthTokenInput, } from "./mcpAuth"; +import { resolveMcpGatewayEnv } from "./mcpGatewayEnv"; import { normalizeDraft, sanitizeGeneratedDraftCapabilities, @@ -2606,24 +2607,40 @@ function collectDeploymentEnv(root: AgentDraft): RuntimeEnvConfiguration { if ( selectedHarnessOptimizations(prepared.draft).includes("mcp_resilience") ) { + const gatewayEnv = resolveMcpGatewayEnv( + prepared.draft, + prepared.envValues, + ); + const gatewayError = gatewayEnv.ok ? undefined : gatewayEnv.message; selections.push({ env: [ { key: "MCP_URLS", required: true, - comment: "MCP 统一网关地址", - placeholder: "https://example.com/mcp", + comment: "由已添加的 MCP 工具注入", + placeholder: "由已添加的 HTTP MCP 工具自动生成", + help: "由已添加的 HTTP MCP 工具自动注入。", + readOnly: true, requiredBy: [harnessSidecarOptionLabel("mcp_resilience")], + missingError: gatewayError, }, { key: "MCP_API_KEY", required: true, - comment: "MCP 统一网关 API Key", + comment: "由已添加的 MCP 工具注入", + placeholder: "由已添加的 HTTP MCP 工具自动生成", + help: "由已添加的 HTTP MCP 工具自动注入。", secret: true, + readOnly: true, requiredBy: [harnessSidecarOptionLabel("mcp_resilience")], + missingError: gatewayError, }, ], }); + if (gatewayEnv.ok) { + fixedValues.MCP_URLS = gatewayEnv.urls.join(","); + fixedValues.MCP_API_KEY = gatewayEnv.apiKey; + } } const config = runtimeEnvConfiguration(selections); return { diff --git a/frontend/src/create/deploymentEnv.ts b/frontend/src/create/deploymentEnv.ts index 3c560540b..4e64ca096 100644 --- a/frontend/src/create/deploymentEnv.ts +++ b/frontend/src/create/deploymentEnv.ts @@ -18,6 +18,8 @@ export interface RuntimeEnvSpec { hidden?: boolean; /** User-facing optimization names that require this Runtime setting. */ requiredBy?: string[]; + /** Actionable error shown when a derived required value cannot be produced. */ + missingError?: string; } export interface RuntimeEnvSelection { @@ -122,12 +124,16 @@ export function runtimeEnvRequirementHint( spec: RuntimeEnvSpec, ): string | undefined { const labels = runtimeEnvRequirementLabels(spec); - return labels.length + const requirement = labels.length ? `优化项「${labels.join("、")}」依赖此配置。` - : undefined; + : ""; + return ( + [requirement, spec.help?.trim()].filter(Boolean).join(" ") || undefined + ); } export function runtimeEnvMissingError(spec: RuntimeEnvSpec): string { + if (spec.missingError?.trim()) return spec.missingError.trim(); const labels = runtimeEnvRequirementLabels(spec); return labels.length ? `优化项「${labels.join("、")}」依赖此配置,请填写 ${spec.key}。` diff --git a/frontend/src/create/mcpGatewayEnv.ts b/frontend/src/create/mcpGatewayEnv.ts new file mode 100644 index 000000000..4a1ac88cc --- /dev/null +++ b/frontend/src/create/mcpGatewayEnv.ts @@ -0,0 +1,96 @@ +// Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import type { AgentDraft } from "./types"; + +export type McpGatewayEnvErrorReason = + | "missing_http_tool" + | "missing_url" + | "missing_api_key" + | "conflicting_api_keys"; + +export type McpGatewayEnvResolution = + | { ok: true; urls: string[]; apiKey: string } + | { + ok: false; + reason: McpGatewayEnvErrorReason; + message: string; + }; + +const ERROR_MESSAGES: Record = { + missing_http_tool: + "请返回“添加 MCP 工具”并添加至少一个 HTTP MCP 服务;MCP 稳定性治理不支持 stdio 服务。", + missing_url: + "已添加的 HTTP MCP 工具缺少有效服务地址,请返回“添加 MCP 工具”补充后再发布。", + missing_api_key: + "已添加的 HTTP MCP 工具缺少 Bearer Token,请返回“添加 MCP 工具”补充后再发布。", + conflicting_api_keys: + "多个 HTTP MCP 工具使用了不同凭证,而 MCP 稳定性治理当前只支持一个共享凭证;请统一凭证或改用统一网关。", +}; + +function failure(reason: McpGatewayEnvErrorReason): McpGatewayEnvResolution { + return { ok: false, reason, message: ERROR_MESSAGES[reason] }; +} + +function isHttpUrl(value: string): boolean { + try { + const url = new URL(value); + return url.protocol === "http:" || url.protocol === "https:"; + } catch { + return false; + } +} + +/** Resolve Sidecar gateway inputs from HTTP MCP tools configured earlier. */ +export function resolveMcpGatewayEnv( + root: AgentDraft, + injectedEnvValues: Record, +): McpGatewayEnvResolution { + const envValues: Record = {}; + const nodes: AgentDraft[] = []; + const visited = new Set(); + + const visit = (node: AgentDraft) => { + if (visited.has(node)) return; + visited.add(node); + nodes.push(node); + Object.assign(envValues, node.deployment?.envValues ?? {}); + node.subAgents.forEach(visit); + node.workflow?.nodes.forEach((workflowNode) => visit(workflowNode.agent)); + }; + visit(root); + Object.assign(envValues, injectedEnvValues); + + const httpTools = nodes.flatMap((node) => + (node.mcpTools ?? []).filter((tool) => tool.transport === "http"), + ); + if (httpTools.length === 0) return failure("missing_http_tool"); + + const urls: string[] = []; + const credentials = new Set(); + for (const tool of httpTools) { + const url = tool.url?.trim() ?? ""; + if (!url || !isHttpUrl(url)) return failure("missing_url"); + + const envName = tool.authTokenEnv?.trim() ?? ""; + const apiKey = envName ? (envValues[envName] ?? "").trim() : ""; + if (!apiKey) return failure("missing_api_key"); + + urls.push(url); + credentials.add(apiKey); + } + if (credentials.size !== 1) return failure("conflicting_api_keys"); + + return { ok: true, urls, apiKey: [...credentials][0] }; +} diff --git a/frontend/src/ui/ProjectPreview.tsx b/frontend/src/ui/ProjectPreview.tsx index ad057c827..5163685f2 100644 --- a/frontend/src/ui/ProjectPreview.tsx +++ b/frontend/src/ui/ProjectPreview.tsx @@ -158,6 +158,16 @@ const DEPLOY_PHASE_ORDER: Record = { github: 8, }; +export const BUILD_STATUS_CONFIRMATION_ERROR_MESSAGE = + "构建任务已经提交,但暂时无法确认最终状态。请稍后在 Code Pipeline 查看构建结果,避免重复部署。"; + +export function isBuildStatusConfirmationError(error: unknown): boolean { + const message = error instanceof Error ? error.message : String(error); + return /RunPipeline result could not be reconciled|Polling build status failed/i.test( + message, + ); +} + function advanceDeploymentPhase( current: string | undefined, next: string | undefined, @@ -1964,7 +1974,12 @@ export function ProjectPreview({ }); return; } - if (mountedRef.current) setDeployError(message); + const buildStatusUnconfirmed = + latestPhase === "build" && isBuildStatusConfirmationError(err); + const displayMessage = buildStatusUnconfirmed + ? BUILD_STATUS_CONFIRMATION_ERROR_MESSAGE + : message; + if (mountedRef.current) setDeployError(displayMessage); if (mountedRef.current) setDeployResult(null); const buildLog = finalizeBuildFailureLog(); operation.fail({ @@ -1983,17 +1998,21 @@ export function ProjectPreview({ startedAt: taskStartedAt, status: "error", phase: latestPhase, - label: "部署失败", - message: failedInBuild - ? "构建镜像失败,详见构建日志。" - : failedInGithub - ? "挂载 GitHub 持续交付失败,详见 GitHub 日志。" - : message, + label: buildStatusUnconfirmed ? "构建状态待确认" : "部署失败", + message: buildStatusUnconfirmed + ? BUILD_STATUS_CONFIRMATION_ERROR_MESSAGE + : failedInBuild + ? "构建镜像失败,详见构建日志。" + : failedInGithub + ? "挂载 GitHub 持续交付失败,详见 GitHub 日志。" + : message, ...(buildLog ? { buildLog } : terminalBuildLogUpdate("complete")), ...(failedInGithub ? { githubDelivery: true, githubLog: latestGithubLog } : {}), - retry: requestDeploymentConfirmation, + ...(buildStatusUnconfirmed + ? {} + : { retry: requestDeploymentConfirmation }), }); } finally { if (mountedRef.current) setDeploying(false); @@ -2893,7 +2912,10 @@ export function ProjectPreview({ className="pp-env-value pp-env-json-value" value={row.value} placeholder={ - row.required ? "必填,尚未填写" : "可选,尚未填写" + row.placeholder || + (row.required + ? "必填,尚未填写" + : "可选,尚未填写") } readOnly={fixed} disabled={ @@ -2949,9 +2971,10 @@ export function ProjectPreview({ } value={displayedValue} placeholder={ - row.required + row.placeholder || + (row.required ? "必填,尚未填写" - : "可选,尚未填写" + : "可选,尚未填写") } readOnly={fixed} disabled={ @@ -3199,13 +3222,22 @@ export function ProjectPreview({ {deployError && ( step.phase === activePhase)?.label ?? - activePhase - }阶段):` - : ""}${deployError}`} - onRetry={requestDeploymentConfirmation} + message={ + deployError === BUILD_STATUS_CONFIRMATION_ERROR_MESSAGE + ? `构建状态待确认:${deployError}` + : `${activePhase + ? `${isRuntimeUpdate ? "更新" : "部署"}失败(${ + deploymentSteps.find( + (step) => step.phase === activePhase, + )?.label ?? activePhase + }阶段):` + : ""}${deployError}` + } + onRetry={ + deployError === BUILD_STATUS_CONFIRMATION_ERROR_MESSAGE + ? undefined + : requestDeploymentConfirmation + } retryLabel={ isRuntimeUpdate ? "重试更新" : "重试部署" } diff --git a/frontend/tests/agentWorkspace.test.mjs b/frontend/tests/agentWorkspace.test.mjs index 7f5d82b9b..b1212d4b3 100644 --- a/frontend/tests/agentWorkspace.test.mjs +++ b/frontend/tests/agentWorkspace.test.mjs @@ -410,7 +410,7 @@ test("workspace publish flow restores PR 748 deployment lifecycle hooks", () => assert.match(projectPreviewSource, /setActivePhase\(latestPhase\)/); assert.match( projectPreviewSource, - /label: "部署失败"[\s\S]*?message: failedInBuild[\s\S]*?\.\.\.\(buildLog/, + /label: buildStatusUnconfirmed[\s\S]*?"构建状态待确认"[\s\S]*?"部署失败"[\s\S]*?message: buildStatusUnconfirmed[\s\S]*?failedInBuild[\s\S]*?\.\.\.\(buildLog/, ); assert.match(projectPreviewSource, /const failedInGithub = latestPhase === "github" && Boolean\(latestGithubLog\)/); assert.match(projectPreviewSource, /failedInBuild[\s\S]*?"构建镜像失败,详见构建日志。"[\s\S]*?failedInGithub[\s\S]*?"挂载 GitHub 持续交付失败,详见 GitHub 日志。"/); diff --git a/frontend/tests/debugErrorPresentation.test.mjs b/frontend/tests/debugErrorPresentation.test.mjs index 27191827d..ff28f0bd9 100644 --- a/frontend/tests/debugErrorPresentation.test.mjs +++ b/frontend/tests/debugErrorPresentation.test.mjs @@ -72,12 +72,34 @@ test("creation and deployment keep friendly context and the original error", () assert.match(clientSource, /原始响应:\\n\$\{text\}/); assert.match( projectPreviewSource, - /label: "部署失败"[\s\S]*?message: failedInBuild[\s\S]*?\.\.\.\(buildLog/, + /label: buildStatusUnconfirmed[\s\S]*?"构建状态待确认"[\s\S]*?"部署失败"[\s\S]*?message: buildStatusUnconfirmed[\s\S]*?failedInBuild[\s\S]*?\.\.\.\(buildLog/, ); assert.match( projectPreviewSource, /failedInBuild[\s\S]*?"构建镜像失败,详见构建日志。"[\s\S]*?failedInGithub[\s\S]*?"挂载 GitHub 持续交付失败,详见 GitHub 日志。"[\s\S]*?: message/, ); + assert.match( + projectPreviewSource, + /isBuildStatusConfirmationError[\s\S]*?RunPipeline result could not be reconciled[\s\S]*?Polling build status failed/, + ); + assert.doesNotMatch( + projectPreviewSource.match( + /export function isBuildStatusConfirmationError[\s\S]*?\n}/, + )?.[0] ?? "", + /network error|fetch failed|Volcengine request timed out/i, + ); + assert.match( + projectPreviewSource, + /buildStatusUnconfirmed[\s\S]*?BUILD_STATUS_CONFIRMATION_ERROR_MESSAGE[\s\S]*?failedInBuild/, + ); + assert.match( + projectPreviewSource, + /deployError === BUILD_STATUS_CONFIRMATION_ERROR_MESSAGE[\s\S]*?undefined[\s\S]*?: requestDeploymentConfirmation/, + ); + assert.match( + projectPreviewSource, + /deployError === BUILD_STATUS_CONFIRMATION_ERROR_MESSAGE[\s\S]*?`构建状态待确认:\$\{deployError\}`/, + ); }); test("generated-agent debug requests preserve backend error details", () => { diff --git a/frontend/tests/deploymentEnv.test.mjs b/frontend/tests/deploymentEnv.test.mjs index ccd30e638..1872822bd 100644 --- a/frontend/tests/deploymentEnv.test.mjs +++ b/frontend/tests/deploymentEnv.test.mjs @@ -352,6 +352,23 @@ test("explains optimization dependencies and reports every missing runtime setti }), [], ); + + const derivedSpec = { + key: "MCP_URLS", + required: true, + readOnly: true, + requiredBy: ["MCP 稳定性治理"], + help: "由已添加的 HTTP MCP 工具自动注入。", + missingError: "请返回“添加 MCP 工具”补充配置。", + }; + assert.equal( + runtimeEnvRequirementHint(derivedSpec), + "优化项「MCP 稳定性治理」依赖此配置。 由已添加的 HTTP MCP 工具自动注入。", + ); + assert.equal( + runtimeEnvMissingError(derivedSpec), + "请返回“添加 MCP 工具”补充配置。", + ); }); test("marks missing optimization env inputs invalid and focuses the first error", () => { @@ -363,7 +380,21 @@ test("marks missing optimization env inputs invalid and focuses the first error" customCreateSource, /requiredBy:\s*\[harnessSidecarOptionLabel\("mcp_resilience"\)\]/, ); + assert.match(customCreateSource, /resolveMcpGatewayEnv\(/); + assert.match( + customCreateSource, + /fixedValues\.MCP_URLS = gatewayEnv\.urls\.join\(","\)/, + ); + assert.match( + customCreateSource, + /fixedValues\.MCP_API_KEY = gatewayEnv\.apiKey/, + ); + assert.match( + customCreateSource, + /key: "MCP_API_KEY",[\s\S]*?secret: true,[\s\S]*?readOnly: true/, + ); assert.match(projectPreviewSource, /missingRuntimeEnvs\(/); + assert.match(projectPreviewSource, /row\.placeholder \|\|/); assert.match(projectPreviewSource, /setDeploymentEnvErrors\(/); assert.match(projectPreviewSource, /focusDeploymentEnv\(/); assert.match( diff --git a/frontend/tests/mcpGatewayEnv.test.mjs b/frontend/tests/mcpGatewayEnv.test.mjs new file mode 100644 index 000000000..f59cdcf29 --- /dev/null +++ b/frontend/tests/mcpGatewayEnv.test.mjs @@ -0,0 +1,203 @@ +// Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import assert from "node:assert/strict"; +import { Buffer } from "node:buffer"; +import { fileURLToPath } from "node:url"; +import test from "node:test"; + +import { build } from "esbuild"; + +async function loadTypeScriptModule(relativePath) { + const result = await build({ + entryPoints: [fileURLToPath(new URL(relativePath, import.meta.url))], + bundle: true, + format: "esm", + platform: "node", + target: "node20", + write: false, + }); + const source = Buffer.from(result.outputFiles[0].contents).toString("base64"); + return import(`data:text/javascript;base64,${source}`); +} + +function draft(overrides = {}) { + return { + name: "root-agent", + description: "draft", + instruction: "help", + tools: [], + skills: [], + memory: { shortTerm: false, longTerm: false }, + knowledgebase: false, + tracing: false, + subAgents: [], + ...overrides, + }; +} + +const { resolveMcpGatewayEnv } = await loadTypeScriptModule( + "../src/create/mcpGatewayEnv.ts", +); + +test("derives Sidecar MCP gateway env from the previously added HTTP tool", () => { + const result = resolveMcpGatewayEnv( + draft({ + mcpTools: [ + { + name: "orders", + transport: "http", + url: " https://mcp.example.test/orders/mcp ", + authTokenEnv: "MCP_ORDERS_TOKEN", + }, + ], + }), + { MCP_ORDERS_TOKEN: "shared-secret" }, + ); + + assert.deepEqual(result, { + ok: true, + urls: ["https://mcp.example.test/orders/mcp"], + apiKey: "shared-secret", + }); +}); + +test("collects nested and workflow HTTP tools once when they share one key", () => { + const sharedTool = { + name: "inventory", + transport: "http", + url: "https://mcp.example.test/inventory/mcp", + authTokenEnv: "MCP_SHARED_TOKEN", + }; + const workflowAgent = draft({ name: "workflow-agent", mcpTools: [sharedTool] }); + const result = resolveMcpGatewayEnv( + draft({ + mcpTools: [ + { + name: "orders", + transport: "http", + url: "https://mcp.example.test/orders/mcp", + authTokenEnv: "MCP_SHARED_TOKEN", + }, + { name: "local", transport: "stdio", command: "example" }, + ], + subAgents: [workflowAgent], + workflow: { + type: "sequential", + nodes: [{ id: "inventory", agent: workflowAgent }], + edges: [], + }, + }), + { MCP_SHARED_TOKEN: "shared-secret" }, + ); + + assert.deepEqual(result, { + ok: true, + urls: [ + "https://mcp.example.test/orders/mcp", + "https://mcp.example.test/inventory/mcp", + ], + apiKey: "shared-secret", + }); +}); + +test("preserves one gateway route per configured HTTP tool", () => { + const result = resolveMcpGatewayEnv( + draft({ + mcpTools: [ + { + name: "orders-primary", + transport: "http", + url: "https://mcp.example.test/shared/mcp", + authTokenEnv: "MCP_SHARED_TOKEN", + }, + { + name: "orders-secondary", + transport: "http", + url: "https://mcp.example.test/shared/mcp", + authTokenEnv: "MCP_SHARED_TOKEN", + }, + ], + }), + { MCP_SHARED_TOKEN: "shared-secret" }, + ); + + assert.deepEqual(result, { + ok: true, + urls: [ + "https://mcp.example.test/shared/mcp", + "https://mcp.example.test/shared/mcp", + ], + apiKey: "shared-secret", + }); +}); + +test("fails closed when no usable HTTP MCP tool is available", () => { + assert.equal( + resolveMcpGatewayEnv( + draft({ + mcpTools: [{ name: "local", transport: "stdio", command: "example" }], + }), + {}, + ).reason, + "missing_http_tool", + ); + assert.equal( + resolveMcpGatewayEnv( + draft({ mcpTools: [{ name: "orders", transport: "http", url: "" }] }), + {}, + ).reason, + "missing_url", + ); +}); + +test("fails closed when a credential is missing or conflicts", () => { + const missing = resolveMcpGatewayEnv( + draft({ + mcpTools: [ + { + name: "orders", + transport: "http", + url: "https://mcp.example.test/orders/mcp", + }, + ], + }), + {}, + ); + assert.equal(missing.reason, "missing_api_key"); + + const conflicting = resolveMcpGatewayEnv( + draft({ + mcpTools: [ + { + name: "orders", + transport: "http", + url: "https://mcp.example.test/orders/mcp", + authTokenEnv: "MCP_ORDERS_TOKEN", + }, + { + name: "inventory", + transport: "http", + url: "https://mcp.example.test/inventory/mcp", + authTokenEnv: "MCP_INVENTORY_TOKEN", + }, + ], + }), + { + MCP_ORDERS_TOKEN: "orders-secret", + MCP_INVENTORY_TOKEN: "inventory-secret", + }, + ); + assert.equal(conflicting.reason, "conflicting_api_keys"); +}); diff --git a/tests/cli/test_generated_agent_harness_sidecar.py b/tests/cli/test_generated_agent_harness_sidecar.py index c0a7092ac..c054b15e4 100644 --- a/tests/cli/test_generated_agent_harness_sidecar.py +++ b/tests/cli/test_generated_agent_harness_sidecar.py @@ -87,6 +87,66 @@ def test_selected_component_generates_extra_app_plugins_and_close_lifecycle( assert "HARNESS_SIDECAR_ENABLED=true" in files[".env.example"] +def test_mcp_resilience_constructs_toolsets_after_sidecar_gateway_binding() -> None: + files = _files( + AgentDraft.model_validate( + { + "name": "sidecar-mcp-agent", + "mcpTools": [ + { + "name": "orders", + "transport": "http", + "url": "https://mcp.example.test/orders/mcp", + "authTokenEnv": "MCP_ORDERS_TOKEN", + }, + { + "name": "inventory", + "transport": "http", + "url": "https://mcp.example.test/inventory/mcp", + "authTokenEnv": "MCP_INVENTORY_TOKEN", + }, + ], + "harnessSidecar": { + "componentOverrides": {"mcp_resilience": True}, + }, + } + ) + ) + + agent_py = files["agents/sidecar_mcp_agent/agent.py"] + assert agent_py.index("HarnessExtension.from_env()") < agent_py.index("MCPToolset(") + assert "def _managed_mcp_connection(index: int)" in agent_py + assert 'os.environ.get("MCP_URLS", "")' in agent_py + assert 'os.environ.get("MCP_API_KEY", "")' in agent_py + assert "connection_params=_managed_mcp_connection(0)" in agent_py + assert "connection_params=_managed_mcp_connection(1)" in agent_py + assert "MCP gateway endpoint count does not match" in agent_py + compile(agent_py, "agent.py", "exec") + + +def test_plain_http_mcp_tool_keeps_direct_connection_without_sidecar_gateway() -> None: + files = _files( + AgentDraft.model_validate( + { + "name": "plain-mcp-agent", + "mcpTools": [ + { + "name": "orders", + "transport": "http", + "url": "https://mcp.example.test/orders/mcp", + "authTokenEnv": "MCP_ORDERS_TOKEN", + } + ], + } + ) + ) + + agent_py = files["agents/plain_mcp_agent/agent.py"] + assert "_managed_mcp_connection" not in agent_py + assert 'url="https://mcp.example.test/orders/mcp"' in agent_py + assert 'os.environ["MCP_ORDERS_TOKEN"]' in agent_py + + def test_ops_profile_is_preserved_in_generated_public_configuration() -> None: draft = AgentDraft.model_validate( { diff --git a/tests/cli/test_studio_rbac.py b/tests/cli/test_studio_rbac.py index 37219a41c..744b9672e 100644 --- a/tests/cli/test_studio_rbac.py +++ b/tests/cli/test_studio_rbac.py @@ -203,7 +203,8 @@ def test_managed_sidecar_runtime_envs_fail_before_build_without_mcp_upstream() - ) assert error == ( - "已选择 MCP 稳定性治理,请在发布配置中填写 MCP_URLS 和 MCP_API_KEY。" + "已选择 MCP 稳定性治理,请在“添加 MCP 工具”中配置至少一个 HTTP MCP " + "服务地址和共享 Bearer Token 后重新发布。" ) assert runtime_envs["MODEL_AGENT_NAME"] assert runtime_envs["MODEL_NAME"] == runtime_envs["MODEL_AGENT_NAME"] diff --git a/veadk/cli/cli_frontend.py b/veadk/cli/cli_frontend.py index 4a31a27b6..a3e84a712 100644 --- a/veadk/cli/cli_frontend.py +++ b/veadk/cli/cli_frontend.py @@ -249,7 +249,10 @@ def _prepare_managed_sidecar_runtime_envs( if effective_components & {"mcp_resilience", "sql_readonly"} and any( not runtime_envs.get(key, "").strip() for key in ("MCP_URLS", "MCP_API_KEY") ): - return "已选择 MCP 稳定性治理,请在发布配置中填写 MCP_URLS 和 MCP_API_KEY。" + return ( + "已选择 MCP 稳定性治理,请在“添加 MCP 工具”中配置至少一个 HTTP MCP " + "服务地址和共享 Bearer Token 后重新发布。" + ) return None diff --git a/veadk/cli/generated_agent_codegen.py b/veadk/cli/generated_agent_codegen.py index 568dbd60b..c8a8cf7b9 100644 --- a/veadk/cli/generated_agent_codegen.py +++ b/veadk/cli/generated_agent_codegen.py @@ -305,8 +305,15 @@ class GeneratedAgentTestRunRequest(BaseModel): class _Acc: - def __init__(self, cloud_provider: str = "volcengine") -> None: + def __init__( + self, + cloud_provider: str = "volcengine", + *, + managed_mcp_gateway: bool = False, + ) -> None: self.cloud_provider = cloud_provider + self.managed_mcp_gateway = managed_mcp_gateway + self.managed_mcp_http_count = 0 self.imports: list[str] = [] self.pre_lines: list[str] = [] self.env: list[EnvVar] = list(model_env_for_provider(cloud_provider)) @@ -631,6 +638,15 @@ def _build_agent(acc: _Acc, draft: AgentDraft, var_name: str) -> str: "StreamableHTTPConnectionParams", ) v = _unique_ident(acc, f"{mcp_tool.name or 'mcp'}_mcp", "mcp_tool") + if acc.managed_mcp_gateway: + index = acc.managed_mcp_http_count + acc.managed_mcp_http_count += 1 + acc.pre_lines.append( + f"{v} = MCPToolset(" + f"connection_params=_managed_mcp_connection({index}))" + ) + tool_exprs.append(v) + continue headers = "" if mcp_tool.authTokenEnv.strip(): _add_import(acc, "import os") @@ -1767,7 +1783,18 @@ def generate_project_from_draft(draft: AgentDraft) -> GeneratedProject: draft = _normalize_harness_sidecar_draft(draft) draft = prepare_mcp_auth(draft) pkg = ident(draft.name, "my_agent") - acc = _Acc(draft.cloudProvider) + harness_sidecar_enabled = bool( + draft.harnessSidecar and draft.harnessSidecar.enabled + ) + managed_mcp_gateway = bool( + harness_sidecar_enabled + and draft.harnessSidecar + and draft.harnessSidecar.componentOverrides.get("mcp_resilience") + ) + acc = _Acc( + draft.cloudProvider, + managed_mcp_gateway=managed_mcp_gateway, + ) feishu_channel_enabled = bool(draft.deployment.feishuEnabled) if feishu_channel_enabled: acc.env.extend( @@ -1786,9 +1813,6 @@ def generate_project_from_draft(draft: AgentDraft) -> GeneratedProject: ), ] ) - harness_sidecar_enabled = bool( - draft.harnessSidecar and draft.harnessSidecar.enabled - ) if harness_sidecar_enabled: acc.extras.add("harness-sidecar") for key, value in studio_harness_env_example(draft.harnessSidecar).items(): @@ -1805,12 +1829,52 @@ def generate_project_from_draft(draft: AgentDraft) -> GeneratedProject: if harness_sidecar_enabled: _add_import(acc, "from google.adk.apps.app import App") _add_import(acc, "from veadk.extensions.harness import HarnessExtension") + if acc.managed_mcp_http_count: + _add_import(acc, "import os") + acc.env.extend( + [ + EnvVar( + "MCP_URLS", + True, + "https://example.com/mcp", + "MCP upstream URLs, separated by commas", + ), + EnvVar( + "MCP_API_KEY", + True, + "replace-with-your-mcp-api-key", + "Shared MCP upstream API key", + ), + ] + ) import_block = "\n".join(["from veadk import Agent", *_dedupe_imports(acc.imports)]) + harness_bootstrap = "" + managed_mcp_bootstrap = "" + if harness_sidecar_enabled: + harness_bootstrap = "harness_extension = HarnessExtension.from_env()\n" + if acc.managed_mcp_http_count: + managed_mcp_bootstrap = ( + "\n_managed_mcp_urls = [\n" + ' value.strip() for value in os.environ.get("MCP_URLS", "").split(",")\n' + " if value.strip()\n" + "]\n" + f"if len(_managed_mcp_urls) != {acc.managed_mcp_http_count}:\n" + ' raise RuntimeError("Harness Sidecar MCP gateway endpoint count does not match configured HTTP MCP tools")\n' + '_managed_mcp_api_key = os.environ.get("MCP_API_KEY", "").strip()\n' + "if not _managed_mcp_api_key:\n" + ' raise RuntimeError("Harness Sidecar MCP gateway API key is missing")\n' + "\n" + "def _managed_mcp_connection(index: int):\n" + " return StreamableHTTPConnectionParams(\n" + " url=_managed_mcp_urls[index],\n" + ' headers={"Authorization": f"Bearer {_managed_mcp_api_key}"},\n' + " )\n" + ) harness_definition = "" if harness_sidecar_enabled: harness_definition = ( - "\nharness_extension = HarnessExtension.from_env()\n" + "\n" "app = App(\n" ' name=__package__.split(".")[-1],\n' " root_agent=root_agent,\n" @@ -1818,7 +1882,10 @@ def generate_project_from_draft(draft: AgentDraft) -> GeneratedProject: ")\n" ) agent_definition = ( - "\n\n".join(acc.pre_lines) + harness_bootstrap + + managed_mcp_bootstrap + + ("\n" if harness_bootstrap or managed_mcp_bootstrap else "") + + "\n\n".join(acc.pre_lines) + f"\n\nAGENT_DISPLAY_NAMES = {acc.agent_display_names!r}\n" + f"AGENT_DRAFT = {_safe_draft_payload(draft)!r}\n" + "\n# ADK 加载器要求:顶层 agent 必须命名为 root_agent\nroot_agent = agent\n" diff --git a/veadk/webui/assets/app/index-CXqNedNy.js b/veadk/webui/assets/app/index-B9BtGdvS.js similarity index 70% rename from veadk/webui/assets/app/index-CXqNedNy.js rename to veadk/webui/assets/app/index-B9BtGdvS.js index 881b3a8ba..9d1cae180 100644 --- a/veadk/webui/assets/app/index-CXqNedNy.js +++ b/veadk/webui/assets/app/index-B9BtGdvS.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/chunks/MarkdownPromptEditor-gp4PNdww.js","assets/styles/MarkdownPromptEditor-ZH9qtki0.css"])))=>i.map(i=>d[i]); -var T1e=Object.defineProperty;var H7=e=>{throw TypeError(e)};var _1e=(e,t,n)=>t in e?T1e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Hi=(e,t,n)=>_1e(e,typeof t!="symbol"?t+"":t,n),X7=(e,t,n)=>t.has(e)||H7("Cannot "+n);var wa=(e,t,n)=>(X7(e,t,"read from private field"),n?n.call(e):t.get(e)),G7=(e,t,n)=>t.has(e)?H7("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),QN=(e,t,n,r)=>(X7(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);function A1e(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 Jf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Jb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var LZ={exports:{}},M_={};/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/chunks/MarkdownPromptEditor-BWLhh-Kn.js","assets/styles/MarkdownPromptEditor-ZH9qtki0.css"])))=>i.map(i=>d[i]); +var A1e=Object.defineProperty;var G7=e=>{throw TypeError(e)};var C1e=(e,t,n)=>t in e?A1e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Hi=(e,t,n)=>C1e(e,typeof t!="symbol"?t+"":t,n),Y7=(e,t,n)=>t.has(e)||G7("Cannot "+n);var wa=(e,t,n)=>(Y7(e,t,"read from private field"),n?n.call(e):t.get(e)),W7=(e,t,n)=>t.has(e)?G7("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),UN=(e,t,n,r)=>(Y7(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);function N1e(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 Jf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function eO(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var BZ={exports:{}},$_={};/** * @license React * react-jsx-runtime.production.js * @@ -7,7 +7,7 @@ var T1e=Object.defineProperty;var H7=e=>{throw TypeError(e)};var _1e=(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 C1e=Symbol.for("react.transitional.element"),N1e=Symbol.for("react.fragment");function $Z(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:C1e,type:e,key:r,ref:t!==void 0?t:null,props:n}}M_.Fragment=N1e;M_.jsx=$Z;M_.jsxs=$Z;LZ.exports=M_;var o=LZ.exports,BZ={exports:{}},Sn={};/** + */var j1e=Symbol.for("react.transitional.element"),R1e=Symbol.for("react.fragment");function QZ(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:j1e,type:e,key:r,ref:t!==void 0?t:null,props:n}}$_.Fragment=R1e;$_.jsx=QZ;$_.jsxs=QZ;BZ.exports=$_;var o=BZ.exports,FZ={exports:{}},Sn={};/** * @license React * react.production.js * @@ -15,7 +15,7 @@ var T1e=Object.defineProperty;var H7=e=>{throw TypeError(e)};var _1e=(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 gL=Symbol.for("react.transitional.element"),j1e=Symbol.for("react.portal"),R1e=Symbol.for("react.fragment"),I1e=Symbol.for("react.strict_mode"),D1e=Symbol.for("react.profiler"),P1e=Symbol.for("react.consumer"),M1e=Symbol.for("react.context"),L1e=Symbol.for("react.forward_ref"),$1e=Symbol.for("react.suspense"),B1e=Symbol.for("react.memo"),QZ=Symbol.for("react.lazy"),Q1e=Symbol.for("react.activity"),Y7=Symbol.iterator;function F1e(e){return e===null||typeof e!="object"?null:(e=Y7&&e[Y7]||e["@@iterator"],typeof e=="function"?e:null)}var FZ={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},UZ=Object.assign,zZ={};function eO(e,t,n){this.props=e,this.context=t,this.refs=zZ,this.updater=n||FZ}eO.prototype.isReactComponent={};eO.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")};eO.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function VZ(){}VZ.prototype=eO.prototype;function bL(e,t,n){this.props=e,this.context=t,this.refs=zZ,this.updater=n||FZ}var OL=bL.prototype=new VZ;OL.constructor=bL;UZ(OL,eO.prototype);OL.isPureReactComponent=!0;var W7=Array.isArray;function HD(){}var bi={H:null,A:null,T:null,S:null},qZ=Object.prototype.hasOwnProperty;function yL(e,t,n){var r=n.ref;return{$$typeof:gL,type:e,key:t,ref:r!==void 0?r:null,props:n}}function U1e(e,t){return yL(e.type,t,e.props)}function xL(e){return typeof e=="object"&&e!==null&&e.$$typeof===gL}function z1e(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Z7=/\/+/g;function FN(e,t){return typeof e=="object"&&e!==null&&e.key!=null?z1e(""+e.key):t.toString(36)}function V1e(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(HD,HD):(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 Ug(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 gL:case j1e:a=!0;break;case QZ:return a=e._init,Ug(a(e._payload),t,n,r,i)}}if(a)return i=i(e),a=r===""?"."+FN(e,0):r,W7(i)?(n="",a!=null&&(n=a.replace(Z7,"$&/")+"/"),Ug(i,t,n,"",function(u){return u})):i!=null&&(xL(i)&&(i=U1e(i,n+(i.key==null||e&&e.key===i.key?"":(""+i.key).replace(Z7,"$&/")+"/")+a)),t.push(i)),1;a=0;var l=r===""?".":r+":";if(W7(e))for(var c=0;c{throw TypeError(e)};var _1e=(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(j,P){var L=j.length;j.push(P);e:for(;0>>1,F=j[U];if(0>>1;Ui(B,L))Vi(ce,B)?(j[U]=ce,j[V]=L,U=V):(j[U]=B,j[z]=L,U=z);else if(Vi(ce,L))j[U]=ce,j[V]=L,U=V;else break e}}return P}function i(j,P){var L=j.sortIndex-P.sortIndex;return L!==0?L:j.id-P.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,p=!1,b=!1,g=!1,O=!1,y=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;function w(j){for(var P=n(u);P!==null;){if(P.callback===null)r(u);else if(P.startTime<=j)r(u),P.sortIndex=P.expirationTime,t(c,P);else break;P=n(u)}}function S(j){if(g=!1,w(j),!b)if(n(c)!==null)b=!0,E||(E=!0,R());else{var P=n(u);P!==null&&M(S,P.startTime-j)}}var E=!1,k=-1,T=5,C=-1;function N(){return O?!0:!(e.unstable_now()-Cj&&N());){var U=f.callback;if(typeof U=="function"){f.callback=null,h=f.priorityLevel;var F=U(f.expirationTime<=j);if(j=e.unstable_now(),typeof F=="function"){f.callback=F,w(j),P=!0;break t}f===n(c)&&r(c),w(j)}else r(c);f=n(c)}if(f!==null)P=!0;else{var q=n(u);q!==null&&M(S,q.startTime-j),P=!1}}break e}finally{f=null,h=L,p=!1}P=void 0}}finally{P?R():E=!1}}}var R;if(typeof x=="function")R=function(){x(_)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,D=$.port2;$.port1.onmessage=_,R=function(){D.postMessage(null)}}else R=function(){y(_,0)};function M(j,P){k=y(function(){j(e.unstable_now())},P)}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(j){j.callback=null},e.unstable_forceFrameRate=function(j){0>j||125U?(j.sortIndex=L,t(u,j),n(c)===null&&j===n(u)&&(g?(v(k),k=-1):g=!0,M(S,L-U))):(j.sortIndex=F,t(c,j),b||p||(b=!0,E||(E=!0,R()))),j},e.unstable_shouldYield=N,e.unstable_wrapCallback=function(j){var P=h;return function(){var L=h;h=P;try{return j.apply(this,arguments)}finally{h=L}}}})(GZ);XZ.exports=GZ;var X1e=XZ.exports,YZ={exports:{}},Za={};/** + */(function(e){function t(j,P){var L=j.length;j.push(P);e:for(;0>>1,F=j[U];if(0>>1;Ui(B,L))Vi(ce,B)?(j[U]=ce,j[V]=L,U=V):(j[U]=B,j[z]=L,U=z);else if(Vi(ce,L))j[U]=ce,j[V]=L,U=V;else break e}}return P}function i(j,P){var L=j.sortIndex-P.sortIndex;return L!==0?L:j.id-P.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,p=!1,b=!1,g=!1,O=!1,y=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;function w(j){for(var P=n(u);P!==null;){if(P.callback===null)r(u);else if(P.startTime<=j)r(u),P.sortIndex=P.expirationTime,t(c,P);else break;P=n(u)}}function S(j){if(g=!1,w(j),!b)if(n(c)!==null)b=!0,E||(E=!0,R());else{var P=n(u);P!==null&&M(S,P.startTime-j)}}var E=!1,k=-1,T=5,C=-1;function N(){return O?!0:!(e.unstable_now()-Cj&&N());){var U=f.callback;if(typeof U=="function"){f.callback=null,h=f.priorityLevel;var F=U(f.expirationTime<=j);if(j=e.unstable_now(),typeof F=="function"){f.callback=F,w(j),P=!0;break t}f===n(c)&&r(c),w(j)}else r(c);f=n(c)}if(f!==null)P=!0;else{var q=n(u);q!==null&&M(S,q.startTime-j),P=!1}}break e}finally{f=null,h=L,p=!1}P=void 0}}finally{P?R():E=!1}}}var R;if(typeof x=="function")R=function(){x(_)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,D=$.port2;$.port1.onmessage=_,R=function(){D.postMessage(null)}}else R=function(){y(_,0)};function M(j,P){k=y(function(){j(e.unstable_now())},P)}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(j){j.callback=null},e.unstable_forceFrameRate=function(j){0>j||125U?(j.sortIndex=L,t(u,j),n(c)===null&&j===n(u)&&(g?(v(k),k=-1):g=!0,M(S,L-U))):(j.sortIndex=F,t(c,j),b||p||(b=!0,E||(E=!0,R()))),j},e.unstable_shouldYield=N,e.unstable_wrapCallback=function(j){var P=h;return function(){var L=h;h=P;try{return j.apply(this,arguments)}finally{h=L}}}})(WZ);YZ.exports=WZ;var Y1e=YZ.exports,ZZ={exports:{}},Za={};/** * @license React * react-dom.production.js * @@ -31,7 +31,7 @@ var T1e=Object.defineProperty;var H7=e=>{throw TypeError(e)};var _1e=(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 G1e=m;function WZ(e){var t="https://react.dev/errors/"+e;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ZZ)}catch(e){console.error(e)}}ZZ(),YZ.exports=Za;var ii=YZ.exports;/** + */var W1e=m;function KZ(e){var t="https://react.dev/errors/"+e;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(JZ)}catch(e){console.error(e)}}JZ(),ZZ.exports=Za;var si=ZZ.exports;/** * @license React * react-dom-client.production.js * @@ -39,15 +39,15 @@ var T1e=Object.defineProperty;var H7=e=>{throw TypeError(e)};var _1e=(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 Is=X1e,KZ=m,Z1e=ii;function Xe(e){var t="https://react.dev/errors/"+e;if(1r0||(e.current=KD[r0],KD[r0]=null,r0--)}function di(e,t){r0++,KD[r0]=e.current,e.current=t}var yu=Nu(null),cx=Nu(null),ch=Nu(null),gT=Nu(null);function bT(e,t){switch(di(ch,t),di(cx,e),di(yu,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?aQ(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=aQ(t),e=Eee(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Ys(yu),di(yu,e)}function ub(){Ys(yu),Ys(cx),Ys(ch)}function JD(e){e.memoizedState!==null&&di(gT,e);var t=yu.current,n=Eee(t,e.type);t!==n&&(di(cx,e),di(yu,n))}function OT(e){cx.current===e&&(Ys(yu),Ys(cx)),gT.current===e&&(Ys(gT),xx._currentValue=nm)}var UN,tB;function kp(e){if(UN===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);UN=t&&t[1]||"",tB=-1i0||(e.current=eP[i0],eP[i0]=null,i0--)}function di(e,t){i0++,eP[i0]=e.current,e.current=t}var yu=Nu(null),ux=Nu(null),ch=Nu(null),OT=Nu(null);function yT(e,t){switch(di(ch,t),di(ux,e),di(yu,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?lQ(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=lQ(t),e=Tee(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Ws(yu),di(yu,e)}function db(){Ws(yu),Ws(ux),Ws(ch)}function tP(e){e.memoizedState!==null&&di(OT,e);var t=yu.current,n=Tee(t,e.type);t!==n&&(di(ux,e),di(yu,n))}function xT(e){ux.current===e&&(Ws(yu),Ws(ux)),OT.current===e&&(Ws(OT),vx._currentValue=rm)}var VN,rB;function Tp(e){if(VN===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);VN=t&&t[1]||"",rB=-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{zN=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?kp(n):""}function nxe(e,t){switch(e.tag){case 26:case 27:case 5:return kp(e.type);case 16:return kp("Lazy");case 13:return e.child!==t&&t!==null?kp("Suspense Fallback"):kp("Suspense");case 19:return kp("SuspenseList");case 0:case 15:return VN(e.type,!1);case 11:return VN(e.type.render,!1);case 1:return VN(e.type,!0);case 31:return kp("Activity");default:return""}}function nB(e){try{var t="",n=null;do t+=nxe(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{qN=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Tp(n):""}function ixe(e,t){switch(e.tag){case 26:case 27:case 5:return Tp(e.type);case 16:return Tp("Lazy");case 13:return e.child!==t&&t!==null?Tp("Suspense Fallback"):Tp("Suspense");case 19:return Tp("SuspenseList");case 0:case 15:return HN(e.type,!1);case 11:return HN(e.type.render,!1);case 1:return HN(e.type,!0);case 31:return Tp("Activity");default:return""}}function iB(e){try{var t="",n=null;do t+=ixe(e,n),n=e,e=e.return;while(e);return t}catch(r){return` Error generating stack: `+r.message+` -`+r.stack}}var e5=Object.prototype.hasOwnProperty,SL=Is.unstable_scheduleCallback,qN=Is.unstable_cancelCallback,rxe=Is.unstable_shouldYield,ixe=Is.unstable_requestPaint,Ko=Is.unstable_now,sxe=Is.unstable_getCurrentPriorityLevel,sK=Is.unstable_ImmediatePriority,aK=Is.unstable_UserBlockingPriority,yT=Is.unstable_NormalPriority,axe=Is.unstable_LowPriority,oK=Is.unstable_IdlePriority,oxe=Is.log,lxe=Is.unstable_setDisableYieldValue,Mv=null,Jo=null;function eh(e){if(typeof oxe=="function"&&lxe(e),Jo&&typeof Jo.setStrictMode=="function")try{Jo.setStrictMode(Mv,e)}catch{}}var el=Math.clz32?Math.clz32:dxe,cxe=Math.log,uxe=Math.LN2;function dxe(e){return e>>>=0,e===0?32:31-(cxe(e)/uxe|0)|0}var yS=256,xS=262144,vS=4194304;function Tp(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 B_(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=Tp(r):(a&=l,a!==0?i=Tp(a):n||(n=l&~e,n!==0&&(i=Tp(n))))):(l=r&~s,l!==0?i=Tp(l):a!==0?i=Tp(a):n||(n=r&~e,n!==0&&(i=Tp(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 Lv(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function fxe(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 lK(){var e=vS;return vS<<=1,!(vS&62914560)&&(vS=4194304),e}function HN(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function $v(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function hxe(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 yxe=/[\n"\\]/g;function _l(e){return e.replace(yxe,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function r5(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=""+wl(t)):e.value!==""+wl(t)&&(e.value=""+wl(t)):a!=="submit"&&a!=="reset"||e.removeAttribute("value"),t!=null?i5(e,a,wl(t)):n!=null?i5(e,a,wl(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=""+wl(l):e.removeAttribute("name")}function bK(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)){n5(e);return}n=n!=null?""+wl(n):"",t=t!=null?""+wl(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),n5(e)}function i5(e,t,n){t==="number"&&xT(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function D0(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"),a5=!1;if(Qd)try{var ly={};Object.defineProperty(ly,"passive",{get:function(){a5=!0}}),window.addEventListener("test",ly,ly),window.removeEventListener("test",ly,ly)}catch{a5=!1}var th=null,CL=null,ok=null;function wK(){if(ok)return ok;var e,t=CL,n=t.length,r,i="value"in th?th.value:th.textContent,s=i.length;for(e=0;e=m1),hB=" ",pB=!1;function EK(e,t){switch(e){case"keyup":return Xxe.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function kK(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var a0=!1;function Yxe(e,t){switch(e){case"compositionend":return kK(t);case"keypress":return t.which!==32?null:(pB=!0,hB);case"textInput":return e=t.data,e===hB&&pB?null:e;default:return null}}function Wxe(e,t){if(a0)return e==="compositionend"||!jL&&EK(e,t)?(e=wK(),ok=CL=th=null,a0=!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=yB(n)}}function CK(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?CK(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function NK(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=xT(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=xT(e.document)}return t}function RL(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 ive=Qd&&"documentMode"in document&&11>=document.documentMode,o0=null,o5=null,b1=null,l5=!1;function vB(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;l5||o0==null||o0!==xT(r)||(r=o0,"selectionStart"in r&&RL(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}),b1&&fx(b1,r)||(b1=r,r=$T(o5,"onSelect"),0>=a,i-=a,cu=1<<32-el(t)+i|n<T?(C=k,k=null):C=k.sibling;var N=h(y,k,x[T],w);if(N===null){k===null&&(k=C);break}e&&k&&N.alternate===null&&t(y,k),v=s(N,v,T),E===null?S=N:E.sibling=N,E=N,k=C}if(T===x.length)return n(y,k),pr&&pd(y,T),S;if(k===null){for(;TT?(C=k,k=null):C=k.sibling;var _=h(y,k,N.value,w);if(_===null){k===null&&(k=C);break}e&&k&&_.alternate===null&&t(y,k),v=s(_,v,T),E===null?S=_:E.sibling=_,E=_,k=C}if(N.done)return n(y,k),pr&&pd(y,T),S;if(k===null){for(;!N.done;T++,N=x.next())N=f(y,N.value,w),N!==null&&(v=s(N,v,T),E===null?S=N:E.sibling=N,E=N);return pr&&pd(y,T),S}for(k=r(k);!N.done;T++,N=x.next())N=p(k,y,T,N.value,w),N!==null&&(e&&N.alternate!==null&&k.delete(N.key===null?T:N.key),v=s(N,v,T),E===null?S=N:E.sibling=N,E=N);return e&&k.forEach(function(R){return t(y,R)}),pr&&pd(y,T),S}function O(y,v,x,w){if(typeof x=="object"&&x!==null&&x.type===n0&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case OS:e:{for(var S=x.key;v!==null;){if(v.key===S){if(S=x.type,S===n0){if(v.tag===7){n(y,v.sibling),w=i(v,x.props.children),w.return=y,y=w;break e}}else if(v.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Bf&&_p(S)===v.type){n(y,v.sibling),w=i(v,x.props),uy(w,x),w.return=y,y=w;break e}n(y,v);break}else t(y,v);v=v.sibling}x.type===n0?(w=rm(x.props.children,y.mode,w,x.key),w.return=y,y=w):(w=ck(x.type,x.key,x.props,null,y.mode,w),uy(w,x),w.return=y,y=w)}return a(y);case Vy: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(y,v.sibling),w=i(v,x.children||[]),w.return=y,y=w;break e}else{n(y,v);break}else t(y,v);v=v.sibling}w=tj(x,y.mode,w),w.return=y,y=w}return a(y);case Bf:return x=_p(x),O(y,v,x,w)}if(qy(x))return b(y,v,x,w);if(oy(x)){if(S=oy(x),typeof S!="function")throw Error(Xe(150));return x=S.call(x),g(y,v,x,w)}if(typeof x.then=="function")return O(y,v,kS(x),w);if(x.$$typeof===vd)return O(y,v,ES(y,x),w);TS(y,x)}return typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint"?(x=""+x,v!==null&&v.tag===6?(n(y,v.sibling),w=i(v,x),w.return=y,y=w):(n(y,v),w=ej(x,y.mode,w),w.return=y,y=w),a(y)):n(y,v)}return function(y,v,x,w){try{mx=0;var S=O(y,v,x,w);return L0=null,S}catch(k){if(k===sO||k===q_)throw k;var E=Ho(29,k,null,y.mode);return E.lanes=w,E.return=y,E}finally{}}}var ym=qK(!0),HK=qK(!1),Qf=!1;function FL(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function m5(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 dh(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function fh(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Cr&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=wT(e),LK(e,null,n),t}return V_(e,r,t,n),wT(e)}function y1(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,uK(e,n)}}function rj(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 g5=!1;function x1(){if(g5){var e=M0;if(e!==null)throw e}}function v1(e,t,n,r){g5=!1;var i=e.updateQueue;Qf=!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,p=h!==l.lane;if(p?(rr&h)===h:(r&h)===h){h!==0&&h===hb&&(g5=!0),d!==null&&(d=d.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});e:{var b=e,g=l;h=t;var O=n;switch(g.tag){case 1:if(b=g.payload,typeof b=="function"){f=b.call(O,f,h);break e}f=b;break e;case 3:b.flags=b.flags&-65537|128;case 0:if(b=g.payload,h=typeof b=="function"?b.call(O,f,h):b,h==null)break e;f=yi({},f,h);break e;case 2:Qf=!0}}h=l.callback,h!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[h]:p.push(h))}else p={lane:h,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,a|=h;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;p=l,l=p.next,p.next=null,i.lastBaseUpdate=p,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),Ch|=a,e.lanes=a,e.memoizedState=f}}function XK(e,t){if(typeof e!="function")throw Error(Xe(191,e));e.call(t)}function GK(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;es?s:8;var a=cn.T,l={};cn.T=l,e4(e,!1,t,n);try{var c=i(),u=cn.S;if(u!==null&&u(l,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=hve(c,r);w1(e,t,d,tl(e))}else w1(e,t,r,tl(e))}catch(f){w1(e,t,{then:function(){},status:"rejected",reason:f},tl())}finally{Nr.p=s,a!==null&&l.types!==null&&(a.types=l.types),cn.T=a}}function yve(){}function v5(e,t,n,r){if(e.tag!==5)throw Error(Xe(476));var i=yJ(e).queue;OJ(e,i,t,nm,n===null?yve:function(){return xJ(e),n(r)})}function yJ(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:nm,baseState:nm,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ud,lastRenderedState:nm},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ud,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function xJ(e){var t=yJ(e);t.next===null&&(t=e.alternate.memoizedState),w1(e,t.next.queue,{},tl())}function JL(){return da(xx)}function vJ(){return ls().memoizedState}function wJ(){return ls().memoizedState}function xve(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=tl();e=dh(n);var r=fh(t,e,n);r!==null&&(go(r,t,n),y1(r,t,n)),t={cache:$L()},e.payload=t;return}t=t.return}}function vve(e,t,n){var r=tl();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Y_(e)?EJ(t,n):(n=DL(e,t,n,r),n!==null&&(go(n,e,r),kJ(n,t,r)))}function SJ(e,t,n){var r=tl();w1(e,t,n,r)}function w1(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Y_(e))EJ(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,al(l,a))return V_(e,t,i,0),ni===null&&z_(),!1}catch{}finally{}if(n=DL(e,t,i,r),n!==null)return go(n,e,r),kJ(n,t,r),!0}return!1}function e4(e,t,n,r){if(r={lane:2,revertLane:c4(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Y_(e)){if(t)throw Error(Xe(479))}else t=DL(e,n,r,2),t!==null&&go(t,e,2)}function Y_(e){var t=e.alternate;return e===Tn||t!==null&&t===Tn}function EJ(e,t){$0=AT=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function kJ(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,uK(e,n)}}var bx={readContext:da,use:X_,useCallback:Xi,useContext:Xi,useEffect:Xi,useImperativeHandle:Xi,useLayoutEffect:Xi,useInsertionEffect:Xi,useMemo:Xi,useReducer:Xi,useRef:Xi,useState:Xi,useDebugValue:Xi,useDeferredValue:Xi,useTransition:Xi,useSyncExternalStore:Xi,useId:Xi,useHostTransitionStatus:Xi,useFormState:Xi,useActionState:Xi,useOptimistic:Xi,useMemoCache:Xi,useCacheRefresh:Xi};bx.useEffectEvent=Xi;var TJ={readContext:da,use:X_,useCallback:function(e,t){return La().memoizedState=[e,t===void 0?null:t],e},useContext:da,useEffect:MB,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,fk(4194308,4,hJ.bind(null,t,e),n)},useLayoutEffect:function(e,t){return fk(4194308,4,e,t)},useInsertionEffect:function(e,t){fk(4,2,e,t)},useMemo:function(e,t){var n=La();t=t===void 0?null:t;var r=e();if(xm){eh(!0);try{e()}finally{eh(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=La();if(n!==void 0){var i=n(t);if(xm){eh(!0);try{n(t)}finally{eh(!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=vve.bind(null,Tn,e),[r.memoizedState,e]},useRef:function(e){var t=La();return e={current:e},t.memoizedState=e},useState:function(e){e=y5(e);var t=e.queue,n=SJ.bind(null,Tn,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ZL,useDeferredValue:function(e,t){var n=La();return KL(n,e,t)},useTransition:function(){var e=y5(!1);return e=OJ.bind(null,Tn,e.queue,!0,!1),La().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Tn,i=La();if(pr){if(n===void 0)throw Error(Xe(407));n=n()}else{if(n=t(),ni===null)throw Error(Xe(349));rr&127||JK(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,MB(tJ.bind(null,r,s,e),[e]),r.flags|=2048,mb(9,{destroy:void 0},eJ.bind(null,r,s,n,t),null),n},useId:function(){var e=La(),t=ni.identifierPrefix;if(pr){var n=uu,r=cu;n=(r&~(1<<32-el(r)-1)).toString(32)+n,t="_"+t+"R_"+n,n=CT++,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[la]=t,s[vo]=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(ha(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&&Zu(t)}}return hi(t),dj(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Zu(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(Xe(166));if(e=ch.current,xg(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=ca,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[la]=t,e=!!(e.nodeValue===n||r!==null&&r.suppressHydrationWarning===!0||See(e.nodeValue,n)),e||_h(t,!0)}else e=BT(e).createTextNode(r),e[la]=t,t.stateNode=e}return hi(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=xg(t),n!==null){if(e===null){if(!r)throw Error(Xe(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Xe(557));e[la]=t}else bm(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;hi(t),e=!1}else n=nj(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(qo(t),t):(qo(t),null);if(t.flags&128)throw Error(Xe(558))}return hi(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=xg(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(Xe(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Xe(317));i[la]=t}else bm(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;hi(t),i=!1}else i=nj(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(qo(t),t):(qo(t),null)}return qo(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),_S(t,t.updateQueue),hi(t),null);case 4:return ub(),e===null&&u4(t.stateNode.containerInfo),hi(t),null;case 10:return Ad(t.type),hi(t),null;case 19:if(Ys(ss),r=t.memoizedState,r===null)return hi(t),null;if(i=(t.flags&128)!==0,s=r.rendering,s===null)if(i)dy(r,!1);else{if(Yi!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=_T(e),s!==null){for(t.flags|=128,dy(r,!1),e=s.updateQueue,t.updateQueue=e,_S(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)$K(n,e),n=n.sibling;return di(ss,ss.current&1|2),pr&&pd(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ko()>IT&&(t.flags|=128,i=!0,dy(r,!1),t.lanes=4194304)}else{if(!i)if(e=_T(s),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,_S(t,e),dy(r,!0),r.tail===null&&r.tailMode==="hidden"&&!s.alternate&&!pr)return hi(t),null}else 2*Ko()-r.renderingStartTime>IT&&n!==536870912&&(t.flags|=128,i=!0,dy(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=Ko(),e.sibling=null,n=ss.current,di(ss,i?n&1|2:n&1),pr&&pd(t,r.treeForkCount),e):(hi(t),null);case 22:case 23:return qo(t),UL(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(hi(t),t.subtreeFlags&6&&(t.flags|=8192)):hi(t),n=t.updateQueue,n!==null&&_S(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&&Ys(im),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ad(ys),hi(t),null;case 25:return null;case 30:return null}throw Error(Xe(156,t.tag))}function Tve(e,t){switch(LL(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ad(ys),ub(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return OT(t),null;case 31:if(t.memoizedState!==null){if(qo(t),t.alternate===null)throw Error(Xe(340));bm()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(qo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Xe(340));bm()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ys(ss),null;case 4:return ub(),null;case 10:return Ad(t.type),null;case 22:case 23:return qo(t),UL(),e!==null&&Ys(im),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ad(ys),null;case 25:return null;default:return null}}function $J(e,t){switch(LL(t),t.tag){case 3:Ad(ys),ub();break;case 26:case 27:case 5:OT(t);break;case 4:ub();break;case 31:t.memoizedState!==null&&qo(t);break;case 13:qo(t);break;case 19:Ys(ss);break;case 10:Ad(t.type);break;case 22:case 23:qo(t),UL(),e!==null&&Ys(im);break;case 24:Ad(ys)}}function zv(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){Ur(t,t.return,l)}}function Ah(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){Ur(i,c,d)}}}r=r.next}while(r!==s)}}catch(d){Ur(t,t.return,d)}}function BJ(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{GK(t,n)}catch(r){Ur(e,e.return,r)}}}function QJ(e,t,n){n.props=vm(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(r){Ur(e,t,r)}}function S1(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){Ur(e,t,i)}}function du(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r=="function")try{r()}catch(i){Ur(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){Ur(e,t,i)}else n.current=null}function FJ(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){Ur(e,e.return,i)}}function fj(e,t,n){try{var r=e.stateNode;Gve(r,e.type,n,t),r[vo]=t}catch(i){Ur(e,e.return,i)}}function UJ(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Wh(e.type)||e.tag===4}function hj(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||UJ(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&&Wh(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 T5(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=wd));else if(r!==4&&(r===27&&Wh(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(T5(e,t,n),e=e.sibling;e!==null;)T5(e,t,n),e=e.sibling}function RT(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&&Wh(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(RT(e,t,n),e=e.sibling;e!==null;)RT(e,t,n),e=e.sibling}function zJ(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);ha(t,r,n),t[la]=e,t[vo]=n}catch(s){Ur(e,e.return,s)}}var bd=!1,Os=!1,pj=!1,YB=typeof WeakSet=="function"?WeakSet:Set,Qs=null;function _ve(e,t){if(e=e.containerInfo,I5=zT,e=NK(e),RL(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 p;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),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===i&&(l=a),h===s&&++d===r&&(c=a),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(D5={focusedElem:e,selectionRange:n},zT=!1,Qs=t;Qs!==null;)if(t=Qs,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Qs=e;else for(;Qs!==null;){switch(t=Qs,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"))),ha(s,r,n),s[la]=e,zs(s),r=s;break e;case"link":var a=mQ("link","href",i).get(r+(n.href||""));if(a){for(var l=0;lO&&(a=O,O=g,g=a);var y=xB(l,g),v=xB(l,O);if(y&&v&&(p.rangeCount!==1||p.anchorNode!==y.node||p.anchorOffset!==y.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var x=f.createRange();x.setStart(y.node,y.offset),p.removeAllRanges(),g>O?(p.addRange(x),p.extend(v.node,v.offset)):(x.setEnd(v.node,v.offset),p.addRange(x))}}}}for(f=[],p=l;p=p.parentNode;)p.nodeType===1&&f.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;ln?32:n,cn.T=null,n=C5,C5=null;var s=ph,a=Cd;if(Rs=0,bb=ph=null,Cd=0,Cr&6)throw Error(Xe(331));var l=Cr;if(Cr|=4,eee(s.current),ZJ(s,s.current,a,n),Cr=l,Vv(0,!1),Jo&&typeof Jo.onPostCommitFiberRoot=="function")try{Jo.onPostCommitFiberRoot(Mv,s)}catch{}return!0}finally{Nr.p=i,cn.T=r,mee(e,t)}}function JB(e,t,n){t=Al(n,t),t=S5(e.stateNode,t,2),e=fh(e,t,2),e!==null&&($v(e,2),ju(e))}function Ur(e,t,n){if(e.tag===3)JB(e,e,n);else for(;t!==null;){if(t.tag===3){JB(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(hh===null||!hh.has(r))){e=Al(n,e),n=jJ(2),r=fh(t,n,2),r!==null&&(RJ(n,r,t,e),$v(r,2),ju(r));break}}t=t.return}}function gj(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Nve;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)||(a4=!0,i.add(n),e=Pve.bind(null,e,t,n),t.then(e,e))}function Pve(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ni===e&&(rr&n)===n&&(Yi===4||Yi===3&&(rr&62914560)===rr&&300>Ko()-W_?!(Cr&2)&&Ob(e,0):o4|=n,gb===rr&&(gb=0)),ju(e)}function bee(e,t){t===0&&(t=lK()),e=zm(e,t),e!==null&&($v(e,t),ju(e))}function Mve(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),bee(e,n)}function Lve(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(Xe(314))}r!==null&&r.delete(t),bee(e,n)}function $ve(e,t){return SL(e,t)}var MT=null,Vg=null,j5=!1,LT=!1,bj=!1,ih=0;function ju(e){e!==Vg&&e.next===null&&(Vg===null?MT=Vg=e:Vg=Vg.next=e),LT=!0,j5||(j5=!0,Qve())}function Vv(e,t){if(!bj&<){bj=!0;do for(var n=!1,r=MT;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-el(42|e)+1)-1,s&=i&~(a&~l),s=s&201326741?s&201326741|1:s?s|2:0}s!==0&&(n=!0,eQ(r,s))}else s=rr,s=B_(r,r===ni?s:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(s&3)||Lv(r,s)||(n=!0,eQ(r,s));r=r.next}while(n);bj=!1}}function Bve(){Oee()}function Oee(){LT=j5=!1;var e=0;ih!==0&&Wve()&&(e=ih);for(var t=Ko(),n=null,r=MT;r!==null;){var i=r.next,s=yee(r,t);s===0?(r.next=null,n===null?MT=i:n.next=i,i===null&&(Vg=n)):(n=r,(e!==0||s&3)&&(LT=!0)),r=i}Rs!==0&&Rs!==5||Vv(e),ih!==0&&(ih=0)}function yee(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&&sQ(f)&&(c=c.responseEnd,a+=d*(c"u"?null:document;function Aee(e,t,n){var r=oO;if(r&&typeof t=="string"&&t){var i=_l(t);i='link[rel="'+e+'"][href="'+i+'"]',typeof n=="string"&&(i+='[crossorigin="'+n+'"]'),fQ.has(i)||(fQ.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement("link"),ha(t,"link",e),zs(t),r.head.appendChild(t)))}}function swe(e){nf.D(e),Aee("dns-prefetch",e,null)}function awe(e,t){nf.C(e,t),Aee("preconnect",e,t)}function owe(e,t,n){nf.L(e,t,n);var r=oO;if(r&&e&&t){var i='link[rel="preload"][as="'+_l(t)+'"]';t==="image"&&n&&n.imageSrcSet?(i+='[imagesrcset="'+_l(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(i+='[imagesizes="'+_l(n.imageSizes)+'"]')):i+='[href="'+_l(e)+'"]';var s=i;switch(t){case"style":s=yb(e);break;case"script":s=lO(e)}zl.has(s)||(e=yi({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),zl.set(s,e),r.querySelector(i)!==null||t==="style"&&r.querySelector(qv(s))||t==="script"&&r.querySelector(Hv(s))||(t=r.createElement("link"),ha(t,"link",e),zs(t),r.head.appendChild(t)))}}function lwe(e,t){nf.m(e,t);var n=oO;if(n&&e){var r=t&&typeof t.as=="string"?t.as:"script",i='link[rel="modulepreload"][as="'+_l(r)+'"][href="'+_l(e)+'"]',s=i;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=lO(e)}if(!zl.has(s)&&(e=yi({rel:"modulepreload",href:e},t),zl.set(s,e),n.querySelector(i)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Hv(s)))return}r=n.createElement("link"),ha(r,"link",e),zs(r),n.head.appendChild(r)}}}function cwe(e,t,n){nf.S(e,t,n);var r=oO;if(r&&e){var i=I0(r).hoistableStyles,s=yb(e);t=t||"default";var a=i.get(s);if(!a){var l={loading:0,preload:null};if(a=r.querySelector(qv(s)))l.loading=5;else{e=yi({rel:"stylesheet",href:e,"data-precedence":t},n),(n=zl.get(s))&&d4(e,n);var c=a=r.createElement("link");zs(c),ha(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,gk(a,t,r)}a={type:"stylesheet",instance:a,count:1,state:l},i.set(s,a)}}}function uwe(e,t){nf.X(e,t);var n=oO;if(n&&e){var r=I0(n).hoistableScripts,i=lO(e),s=r.get(i);s||(s=n.querySelector(Hv(i)),s||(e=yi({src:e,async:!0},t),(t=zl.get(i))&&f4(e,t),s=n.createElement("script"),zs(s),ha(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},r.set(i,s))}}function dwe(e,t){nf.M(e,t);var n=oO;if(n&&e){var r=I0(n).hoistableScripts,i=lO(e),s=r.get(i);s||(s=n.querySelector(Hv(i)),s||(e=yi({src:e,async:!0,type:"module"},t),(t=zl.get(i))&&f4(e,t),s=n.createElement("script"),zs(s),ha(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},r.set(i,s))}}function hQ(e,t,n,r){var i=(i=ch.current)?QT(i):null;if(!i)throw Error(Xe(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=yb(n.href),n=I0(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=yb(n.href);var s=I0(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(qv(e)))&&!s._p&&(a.instance=s,a.state.loading=5),zl.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},zl.set(e,n),s||fwe(i,e,n,a.state))),t&&r===null)throw Error(Xe(528,""));return a}if(t&&r!==null)throw Error(Xe(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=lO(n),n=I0(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(Xe(444,e))}}function yb(e){return'href="'+_l(e)+'"'}function qv(e){return'link[rel="stylesheet"]['+e+"]"}function Cee(e){return yi({},e,{"data-precedence":e.precedence,precedence:null})}function fwe(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}),ha(t,"link",n),zs(t),e.head.appendChild(t))}function lO(e){return'[src="'+_l(e)+'"]'}function Hv(e){return"script[async]"+e}function pQ(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+_l(n.href)+'"]');if(r)return t.instance=r,zs(r),r;var i=yi({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),zs(r),ha(r,"style",i),gk(r,n.precedence,e),t.instance=r;case"stylesheet":i=yb(n.href);var s=e.querySelector(qv(i));if(s)return t.state.loading|=4,t.instance=s,zs(s),s;r=Cee(n),(i=zl.get(i))&&d4(r,i),s=(e.ownerDocument||e).createElement("link"),zs(s);var a=s;return a._p=new Promise(function(l,c){a.onload=l,a.onerror=c}),ha(s,"link",r),t.state.loading|=4,gk(s,n.precedence,e),t.instance=s;case"script":return s=lO(n.src),(i=e.querySelector(Hv(s)))?(t.instance=i,zs(i),i):(r=n,(i=zl.get(s))&&(r=yi({},n),f4(r,i)),e=e.ownerDocument||e,i=e.createElement("script"),zs(i),ha(i,"link",r),e.head.appendChild(i),t.instance=i);case"void":return null;default:throw Error(Xe(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,gk(r,n.precedence,e));return t.instance}function gk(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 hwe(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 Nee(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function pwe(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=yb(r.href),s=t.querySelector(qv(i));if(s){t=s._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=FT.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=s,zs(s);return}s=t.ownerDocument||t,r=Cee(r),(i=zl.get(i))&&d4(r,i),s=s.createElement("link"),zs(s);var a=s;a._p=new Promise(function(l,c){a.onload=l,a.onerror=c}),ha(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=FT.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var Sj=0;function mwe(e,t){return e.stylesheets&&e.count===0&&Ok(e,e.stylesheets),0Sj?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function FT(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ok(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var UT=null;function Ok(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,UT=new Map,t.forEach(gwe,e),UT=null,FT.call(e))}function gwe(e,t){if(!(t.state.loading&4)){var n=UT.get(e);if(n)var r=n.get(null);else{n=new Map,UT.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($ee)}catch(e){console.error(e)}}$ee(),HZ.exports=L_;var Ewe=HZ.exports;const kwe=Jb(Ewe),b4=m.createContext({});function tA(e){const t=m.useRef(null);return t.current===null&&(t.current=e()),t.current}const nA=m.createContext(null),Sx=m.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class Twe extends m.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 _we({children:e,isPresent:t}){const n=m.useId(),r=m.useRef(null),i=m.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=m.useContext(Sx);return m.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 nP=Object.prototype.hasOwnProperty,kL=Is.unstable_scheduleCallback,XN=Is.unstable_cancelCallback,sxe=Is.unstable_shouldYield,axe=Is.unstable_requestPaint,Ko=Is.unstable_now,oxe=Is.unstable_getCurrentPriorityLevel,oK=Is.unstable_ImmediatePriority,lK=Is.unstable_UserBlockingPriority,vT=Is.unstable_NormalPriority,lxe=Is.unstable_LowPriority,cK=Is.unstable_IdlePriority,cxe=Is.log,uxe=Is.unstable_setDisableYieldValue,Lv=null,Jo=null;function eh(e){if(typeof cxe=="function"&&uxe(e),Jo&&typeof Jo.setStrictMode=="function")try{Jo.setStrictMode(Lv,e)}catch{}}var el=Math.clz32?Math.clz32:hxe,dxe=Math.log,fxe=Math.LN2;function hxe(e){return e>>>=0,e===0?32:31-(dxe(e)/fxe|0)|0}var yS=256,xS=262144,vS=4194304;function _p(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 F_(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=_p(r):(a&=l,a!==0?i=_p(a):n||(n=l&~e,n!==0&&(i=_p(n))))):(l=r&~s,l!==0?i=_p(l):a!==0?i=_p(a):n||(n=r&~e,n!==0&&(i=_p(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 $v(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function pxe(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 uK(){var e=vS;return vS<<=1,!(vS&62914560)&&(vS=4194304),e}function GN(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Bv(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function mxe(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 vxe=/[\n"\\]/g;function _l(e){return e.replace(vxe,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function sP(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=""+wl(t)):e.value!==""+wl(t)&&(e.value=""+wl(t)):a!=="submit"&&a!=="reset"||e.removeAttribute("value"),t!=null?aP(e,a,wl(t)):n!=null?aP(e,a,wl(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=""+wl(l):e.removeAttribute("name")}function yK(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)){iP(e);return}n=n!=null?""+wl(n):"",t=t!=null?""+wl(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),iP(e)}function aP(e,t,n){t==="number"&&wT(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function P0(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"),lP=!1;if(Qd)try{var cy={};Object.defineProperty(cy,"passive",{get:function(){lP=!0}}),window.addEventListener("test",cy,cy),window.removeEventListener("test",cy,cy)}catch{lP=!1}var th=null,jL=null,ck=null;function EK(){if(ck)return ck;var e,t=jL,n=t.length,r,i="value"in th?th.value:th.textContent,s=i.length;for(e=0;e=g1),mB=" ",gB=!1;function TK(e,t){switch(e){case"keyup":return Yxe.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _K(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var o0=!1;function Zxe(e,t){switch(e){case"compositionend":return _K(t);case"keypress":return t.which!==32?null:(gB=!0,mB);case"textInput":return e=t.data,e===mB&&gB?null:e;default:return null}}function Kxe(e,t){if(o0)return e==="compositionend"||!IL&&TK(e,t)?(e=EK(),ck=jL=th=null,o0=!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=vB(n)}}function jK(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?jK(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function RK(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=wT(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=wT(e.document)}return t}function DL(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 ave=Qd&&"documentMode"in document&&11>=document.documentMode,l0=null,cP=null,O1=null,uP=!1;function SB(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;uP||l0==null||l0!==wT(r)||(r=l0,"selectionStart"in r&&DL(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}),O1&&hx(O1,r)||(O1=r,r=QT(cP,"onSelect"),0>=a,i-=a,cu=1<<32-el(t)+i|n<T?(C=k,k=null):C=k.sibling;var N=h(y,k,x[T],w);if(N===null){k===null&&(k=C);break}e&&k&&N.alternate===null&&t(y,k),v=s(N,v,T),E===null?S=N:E.sibling=N,E=N,k=C}if(T===x.length)return n(y,k),mr&&pd(y,T),S;if(k===null){for(;TT?(C=k,k=null):C=k.sibling;var _=h(y,k,N.value,w);if(_===null){k===null&&(k=C);break}e&&k&&_.alternate===null&&t(y,k),v=s(_,v,T),E===null?S=_:E.sibling=_,E=_,k=C}if(N.done)return n(y,k),mr&&pd(y,T),S;if(k===null){for(;!N.done;T++,N=x.next())N=f(y,N.value,w),N!==null&&(v=s(N,v,T),E===null?S=N:E.sibling=N,E=N);return mr&&pd(y,T),S}for(k=r(k);!N.done;T++,N=x.next())N=p(k,y,T,N.value,w),N!==null&&(e&&N.alternate!==null&&k.delete(N.key===null?T:N.key),v=s(N,v,T),E===null?S=N:E.sibling=N,E=N);return e&&k.forEach(function(R){return t(y,R)}),mr&&pd(y,T),S}function O(y,v,x,w){if(typeof x=="object"&&x!==null&&x.type===r0&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case OS:e:{for(var S=x.key;v!==null;){if(v.key===S){if(S=x.type,S===r0){if(v.tag===7){n(y,v.sibling),w=i(v,x.props.children),w.return=y,y=w;break e}}else if(v.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Bf&&Ap(S)===v.type){n(y,v.sibling),w=i(v,x.props),dy(w,x),w.return=y,y=w;break e}n(y,v);break}else t(y,v);v=v.sibling}x.type===r0?(w=im(x.props.children,y.mode,w,x.key),w.return=y,y=w):(w=dk(x.type,x.key,x.props,null,y.mode,w),dy(w,x),w.return=y,y=w)}return a(y);case qy: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(y,v.sibling),w=i(v,x.children||[]),w.return=y,y=w;break e}else{n(y,v);break}else t(y,v);v=v.sibling}w=rj(x,y.mode,w),w.return=y,y=w}return a(y);case Bf:return x=Ap(x),O(y,v,x,w)}if(Hy(x))return b(y,v,x,w);if(ly(x)){if(S=ly(x),typeof S!="function")throw Error(Xe(150));return x=S.call(x),g(y,v,x,w)}if(typeof x.then=="function")return O(y,v,kS(x),w);if(x.$$typeof===vd)return O(y,v,ES(y,x),w);TS(y,x)}return typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint"?(x=""+x,v!==null&&v.tag===6?(n(y,v.sibling),w=i(v,x),w.return=y,y=w):(n(y,v),w=nj(x,y.mode,w),w.return=y,y=w),a(y)):n(y,v)}return function(y,v,x,w){try{gx=0;var S=O(y,v,x,w);return $0=null,S}catch(k){if(k===aO||k===X_)throw k;var E=Ho(29,k,null,y.mode);return E.lanes=w,E.return=y,E}finally{}}}var xm=XK(!0),GK=XK(!1),Qf=!1;function zL(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function bP(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 dh(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function fh(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Cr&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ET(e),BK(e,null,n),t}return H_(e,r,t,n),ET(e)}function x1(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,fK(e,n)}}function sj(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 OP=!1;function v1(){if(OP){var e=L0;if(e!==null)throw e}}function w1(e,t,n,r){OP=!1;var i=e.updateQueue;Qf=!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,p=h!==l.lane;if(p?(ir&h)===h:(r&h)===h){h!==0&&h===pb&&(OP=!0),d!==null&&(d=d.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});e:{var b=e,g=l;h=t;var O=n;switch(g.tag){case 1:if(b=g.payload,typeof b=="function"){f=b.call(O,f,h);break e}f=b;break e;case 3:b.flags=b.flags&-65537|128;case 0:if(b=g.payload,h=typeof b=="function"?b.call(O,f,h):b,h==null)break e;f=yi({},f,h);break e;case 2:Qf=!0}}h=l.callback,h!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[h]:p.push(h))}else p={lane:h,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,a|=h;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;p=l,l=p.next,p.next=null,i.lastBaseUpdate=p,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),Ch|=a,e.lanes=a,e.memoizedState=f}}function YK(e,t){if(typeof e!="function")throw Error(Xe(191,e));e.call(t)}function WK(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;es?s:8;var a=cn.T,l={};cn.T=l,n4(e,!1,t,n);try{var c=i(),u=cn.S;if(u!==null&&u(l,c),c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=mve(c,r);S1(e,t,d,tl(e))}else S1(e,t,r,tl(e))}catch(f){S1(e,t,{then:function(){},status:"rejected",reason:f},tl())}finally{Nr.p=s,a!==null&&l.types!==null&&(a.types=l.types),cn.T=a}}function vve(){}function SP(e,t,n,r){if(e.tag!==5)throw Error(Xe(476));var i=vJ(e).queue;xJ(e,i,t,rm,n===null?vve:function(){return wJ(e),n(r)})}function vJ(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:rm,baseState:rm,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ud,lastRenderedState:rm},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ud,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function wJ(e){var t=vJ(e);t.next===null&&(t=e.alternate.memoizedState),S1(e,t.next.queue,{},tl())}function t4(){return fa(vx)}function SJ(){return ls().memoizedState}function EJ(){return ls().memoizedState}function wve(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=tl();e=dh(n);var r=fh(t,e,n);r!==null&&(go(r,t,n),x1(r,t,n)),t={cache:QL()},e.payload=t;return}t=t.return}}function Sve(e,t,n){var r=tl();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Z_(e)?TJ(t,n):(n=ML(e,t,n,r),n!==null&&(go(n,e,r),_J(n,t,r)))}function kJ(e,t,n){var r=tl();S1(e,t,n,r)}function S1(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Z_(e))TJ(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,al(l,a))return H_(e,t,i,0),ri===null&&q_(),!1}catch{}finally{}if(n=ML(e,t,i,r),n!==null)return go(n,e,r),_J(n,t,r),!0}return!1}function n4(e,t,n,r){if(r={lane:2,revertLane:d4(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Z_(e)){if(t)throw Error(Xe(479))}else t=ML(e,n,r,2),t!==null&&go(t,e,2)}function Z_(e){var t=e.alternate;return e===Tn||t!==null&&t===Tn}function TJ(e,t){B0=NT=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function _J(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,fK(e,n)}}var Ox={readContext:fa,use:Y_,useCallback:Xi,useContext:Xi,useEffect:Xi,useImperativeHandle:Xi,useLayoutEffect:Xi,useInsertionEffect:Xi,useMemo:Xi,useReducer:Xi,useRef:Xi,useState:Xi,useDebugValue:Xi,useDeferredValue:Xi,useTransition:Xi,useSyncExternalStore:Xi,useId:Xi,useHostTransitionStatus:Xi,useFormState:Xi,useActionState:Xi,useOptimistic:Xi,useMemoCache:Xi,useCacheRefresh:Xi};Ox.useEffectEvent=Xi;var AJ={readContext:fa,use:Y_,useCallback:function(e,t){return La().memoizedState=[e,t===void 0?null:t],e},useContext:fa,useEffect:$B,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,pk(4194308,4,mJ.bind(null,t,e),n)},useLayoutEffect:function(e,t){return pk(4194308,4,e,t)},useInsertionEffect:function(e,t){pk(4,2,e,t)},useMemo:function(e,t){var n=La();t=t===void 0?null:t;var r=e();if(vm){eh(!0);try{e()}finally{eh(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=La();if(n!==void 0){var i=n(t);if(vm){eh(!0);try{n(t)}finally{eh(!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=Sve.bind(null,Tn,e),[r.memoizedState,e]},useRef:function(e){var t=La();return e={current:e},t.memoizedState=e},useState:function(e){e=vP(e);var t=e.queue,n=kJ.bind(null,Tn,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:JL,useDeferredValue:function(e,t){var n=La();return e4(n,e,t)},useTransition:function(){var e=vP(!1);return e=xJ.bind(null,Tn,e.queue,!0,!1),La().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Tn,i=La();if(mr){if(n===void 0)throw Error(Xe(407));n=n()}else{if(n=t(),ri===null)throw Error(Xe(349));ir&127||tJ(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,$B(rJ.bind(null,r,s,e),[e]),r.flags|=2048,gb(9,{destroy:void 0},nJ.bind(null,r,s,n,t),null),n},useId:function(){var e=La(),t=ri.identifierPrefix;if(mr){var n=uu,r=cu;n=(r&~(1<<32-el(r)-1)).toString(32)+n,t="_"+t+"R_"+n,n=jT++,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[ca]=t,s[vo]=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(pa(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&&Zu(t)}}return hi(t),hj(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Zu(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(Xe(166));if(e=ch.current,vg(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=ua,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[ca]=t,e=!!(e.nodeValue===n||r!==null&&r.suppressHydrationWarning===!0||kee(e.nodeValue,n)),e||_h(t,!0)}else e=FT(e).createTextNode(r),e[ca]=t,t.stateNode=e}return hi(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=vg(t),n!==null){if(e===null){if(!r)throw Error(Xe(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Xe(557));e[ca]=t}else Om(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;hi(t),e=!1}else n=ij(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(qo(t),t):(qo(t),null);if(t.flags&128)throw Error(Xe(558))}return hi(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=vg(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(Xe(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Xe(317));i[ca]=t}else Om(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;hi(t),i=!1}else i=ij(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(qo(t),t):(qo(t),null)}return qo(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),_S(t,t.updateQueue),hi(t),null);case 4:return db(),e===null&&f4(t.stateNode.containerInfo),hi(t),null;case 10:return Ad(t.type),hi(t),null;case 19:if(Ws(ss),r=t.memoizedState,r===null)return hi(t),null;if(i=(t.flags&128)!==0,s=r.rendering,s===null)if(i)fy(r,!1);else{if(Yi!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=CT(e),s!==null){for(t.flags|=128,fy(r,!1),e=s.updateQueue,t.updateQueue=e,_S(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)QK(n,e),n=n.sibling;return di(ss,ss.current&1|2),mr&&pd(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ko()>PT&&(t.flags|=128,i=!0,fy(r,!1),t.lanes=4194304)}else{if(!i)if(e=CT(s),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,_S(t,e),fy(r,!0),r.tail===null&&r.tailMode==="hidden"&&!s.alternate&&!mr)return hi(t),null}else 2*Ko()-r.renderingStartTime>PT&&n!==536870912&&(t.flags|=128,i=!0,fy(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=Ko(),e.sibling=null,n=ss.current,di(ss,i?n&1|2:n&1),mr&&pd(t,r.treeForkCount),e):(hi(t),null);case 22:case 23:return qo(t),VL(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(hi(t),t.subtreeFlags&6&&(t.flags|=8192)):hi(t),n=t.updateQueue,n!==null&&_S(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&&Ws(sm),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ad(ys),hi(t),null;case 25:return null;case 30:return null}throw Error(Xe(156,t.tag))}function Ave(e,t){switch(BL(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ad(ys),db(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return xT(t),null;case 31:if(t.memoizedState!==null){if(qo(t),t.alternate===null)throw Error(Xe(340));Om()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(qo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Xe(340));Om()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ws(ss),null;case 4:return db(),null;case 10:return Ad(t.type),null;case 22:case 23:return qo(t),VL(),e!==null&&Ws(sm),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ad(ys),null;case 25:return null;default:return null}}function QJ(e,t){switch(BL(t),t.tag){case 3:Ad(ys),db();break;case 26:case 27:case 5:xT(t);break;case 4:db();break;case 31:t.memoizedState!==null&&qo(t);break;case 13:qo(t);break;case 19:Ws(ss);break;case 10:Ad(t.type);break;case 22:case 23:qo(t),VL(),e!==null&&Ws(sm);break;case 24:Ad(ys)}}function Vv(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){Ur(t,t.return,l)}}function Ah(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){Ur(i,c,d)}}}r=r.next}while(r!==s)}}catch(d){Ur(t,t.return,d)}}function FJ(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{WK(t,n)}catch(r){Ur(e,e.return,r)}}}function UJ(e,t,n){n.props=wm(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(r){Ur(e,t,r)}}function E1(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){Ur(e,t,i)}}function du(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r=="function")try{r()}catch(i){Ur(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){Ur(e,t,i)}else n.current=null}function zJ(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){Ur(e,e.return,i)}}function pj(e,t,n){try{var r=e.stateNode;Wve(r,e.type,n,t),r[vo]=t}catch(i){Ur(e,e.return,i)}}function VJ(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Wh(e.type)||e.tag===4}function mj(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||VJ(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&&Wh(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 AP(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=wd));else if(r!==4&&(r===27&&Wh(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(AP(e,t,n),e=e.sibling;e!==null;)AP(e,t,n),e=e.sibling}function DT(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&&Wh(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(DT(e,t,n),e=e.sibling;e!==null;)DT(e,t,n),e=e.sibling}function qJ(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);pa(t,r,n),t[ca]=e,t[vo]=n}catch(s){Ur(e,e.return,s)}}var bd=!1,Os=!1,gj=!1,ZB=typeof WeakSet=="function"?WeakSet:Set,Fs=null;function Cve(e,t){if(e=e.containerInfo,PP=qT,e=RK(e),DL(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 p;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),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===i&&(l=a),h===s&&++d===r&&(c=a),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(MP={focusedElem:e,selectionRange:n},qT=!1,Fs=t;Fs!==null;)if(t=Fs,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Fs=e;else for(;Fs!==null;){switch(t=Fs,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"))),pa(s,r,n),s[ca]=e,Vs(s),r=s;break e;case"link":var a=bQ("link","href",i).get(r+(n.href||""));if(a){for(var l=0;lO&&(a=O,O=g,g=a);var y=wB(l,g),v=wB(l,O);if(y&&v&&(p.rangeCount!==1||p.anchorNode!==y.node||p.anchorOffset!==y.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var x=f.createRange();x.setStart(y.node,y.offset),p.removeAllRanges(),g>O?(p.addRange(x),p.extend(v.node,v.offset)):(x.setEnd(v.node,v.offset),p.addRange(x))}}}}for(f=[],p=l;p=p.parentNode;)p.nodeType===1&&f.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;ln?32:n,cn.T=null,n=jP,jP=null;var s=ph,a=Cd;if(Rs=0,Ob=ph=null,Cd=0,Cr&6)throw Error(Xe(331));var l=Cr;if(Cr|=4,nee(s.current),JJ(s,s.current,a,n),Cr=l,qv(0,!1),Jo&&typeof Jo.onPostCommitFiberRoot=="function")try{Jo.onPostCommitFiberRoot(Lv,s)}catch{}return!0}finally{Nr.p=i,cn.T=r,bee(e,t)}}function tQ(e,t,n){t=Al(n,t),t=kP(e.stateNode,t,2),e=fh(e,t,2),e!==null&&(Bv(e,2),ju(e))}function Ur(e,t,n){if(e.tag===3)tQ(e,e,n);else for(;t!==null;){if(t.tag===3){tQ(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(hh===null||!hh.has(r))){e=Al(n,e),n=IJ(2),r=fh(t,n,2),r!==null&&(DJ(n,r,t,e),Bv(r,2),ju(r));break}}t=t.return}}function Oj(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Rve;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)||(l4=!0,i.add(n),e=Lve.bind(null,e,t,n),t.then(e,e))}function Lve(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ri===e&&(ir&n)===n&&(Yi===4||Yi===3&&(ir&62914560)===ir&&300>Ko()-K_?!(Cr&2)&&yb(e,0):c4|=n,bb===ir&&(bb=0)),ju(e)}function yee(e,t){t===0&&(t=uK()),e=Vm(e,t),e!==null&&(Bv(e,t),ju(e))}function $ve(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),yee(e,n)}function Bve(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(Xe(314))}r!==null&&r.delete(t),yee(e,n)}function Qve(e,t){return kL(e,t)}var $T=null,qg=null,IP=!1,BT=!1,yj=!1,ih=0;function ju(e){e!==qg&&e.next===null&&(qg===null?$T=qg=e:qg=qg.next=e),BT=!0,IP||(IP=!0,Uve())}function qv(e,t){if(!yj&&BT){yj=!0;do for(var n=!1,r=$T;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-el(42|e)+1)-1,s&=i&~(a&~l),s=s&201326741?s&201326741|1:s?s|2:0}s!==0&&(n=!0,nQ(r,s))}else s=ir,s=F_(r,r===ri?s:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(s&3)||$v(r,s)||(n=!0,nQ(r,s));r=r.next}while(n);yj=!1}}function Fve(){xee()}function xee(){BT=IP=!1;var e=0;ih!==0&&Kve()&&(e=ih);for(var t=Ko(),n=null,r=$T;r!==null;){var i=r.next,s=vee(r,t);s===0?(r.next=null,n===null?$T=i:n.next=i,i===null&&(qg=n)):(n=r,(e!==0||s&3)&&(BT=!0)),r=i}Rs!==0&&Rs!==5||qv(e),ih!==0&&(ih=0)}function vee(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&&oQ(f)&&(c=c.responseEnd,a+=d*(c"u"?null:document;function Nee(e,t,n){var r=lO;if(r&&typeof t=="string"&&t){var i=_l(t);i='link[rel="'+e+'"][href="'+i+'"]',typeof n=="string"&&(i+='[crossorigin="'+n+'"]'),pQ.has(i)||(pQ.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement("link"),pa(t,"link",e),Vs(t),r.head.appendChild(t)))}}function owe(e){nf.D(e),Nee("dns-prefetch",e,null)}function lwe(e,t){nf.C(e,t),Nee("preconnect",e,t)}function cwe(e,t,n){nf.L(e,t,n);var r=lO;if(r&&e&&t){var i='link[rel="preload"][as="'+_l(t)+'"]';t==="image"&&n&&n.imageSrcSet?(i+='[imagesrcset="'+_l(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(i+='[imagesizes="'+_l(n.imageSizes)+'"]')):i+='[href="'+_l(e)+'"]';var s=i;switch(t){case"style":s=xb(e);break;case"script":s=cO(e)}zl.has(s)||(e=yi({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),zl.set(s,e),r.querySelector(i)!==null||t==="style"&&r.querySelector(Hv(s))||t==="script"&&r.querySelector(Xv(s))||(t=r.createElement("link"),pa(t,"link",e),Vs(t),r.head.appendChild(t)))}}function uwe(e,t){nf.m(e,t);var n=lO;if(n&&e){var r=t&&typeof t.as=="string"?t.as:"script",i='link[rel="modulepreload"][as="'+_l(r)+'"][href="'+_l(e)+'"]',s=i;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=cO(e)}if(!zl.has(s)&&(e=yi({rel:"modulepreload",href:e},t),zl.set(s,e),n.querySelector(i)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Xv(s)))return}r=n.createElement("link"),pa(r,"link",e),Vs(r),n.head.appendChild(r)}}}function dwe(e,t,n){nf.S(e,t,n);var r=lO;if(r&&e){var i=D0(r).hoistableStyles,s=xb(e);t=t||"default";var a=i.get(s);if(!a){var l={loading:0,preload:null};if(a=r.querySelector(Hv(s)))l.loading=5;else{e=yi({rel:"stylesheet",href:e,"data-precedence":t},n),(n=zl.get(s))&&h4(e,n);var c=a=r.createElement("link");Vs(c),pa(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,Ok(a,t,r)}a={type:"stylesheet",instance:a,count:1,state:l},i.set(s,a)}}}function fwe(e,t){nf.X(e,t);var n=lO;if(n&&e){var r=D0(n).hoistableScripts,i=cO(e),s=r.get(i);s||(s=n.querySelector(Xv(i)),s||(e=yi({src:e,async:!0},t),(t=zl.get(i))&&p4(e,t),s=n.createElement("script"),Vs(s),pa(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},r.set(i,s))}}function hwe(e,t){nf.M(e,t);var n=lO;if(n&&e){var r=D0(n).hoistableScripts,i=cO(e),s=r.get(i);s||(s=n.querySelector(Xv(i)),s||(e=yi({src:e,async:!0,type:"module"},t),(t=zl.get(i))&&p4(e,t),s=n.createElement("script"),Vs(s),pa(s,"link",e),n.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},r.set(i,s))}}function mQ(e,t,n,r){var i=(i=ch.current)?UT(i):null;if(!i)throw Error(Xe(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=xb(n.href),n=D0(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=xb(n.href);var s=D0(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(Hv(e)))&&!s._p&&(a.instance=s,a.state.loading=5),zl.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},zl.set(e,n),s||pwe(i,e,n,a.state))),t&&r===null)throw Error(Xe(528,""));return a}if(t&&r!==null)throw Error(Xe(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=cO(n),n=D0(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(Xe(444,e))}}function xb(e){return'href="'+_l(e)+'"'}function Hv(e){return'link[rel="stylesheet"]['+e+"]"}function jee(e){return yi({},e,{"data-precedence":e.precedence,precedence:null})}function pwe(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}),pa(t,"link",n),Vs(t),e.head.appendChild(t))}function cO(e){return'[src="'+_l(e)+'"]'}function Xv(e){return"script[async]"+e}function gQ(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+_l(n.href)+'"]');if(r)return t.instance=r,Vs(r),r;var i=yi({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),Vs(r),pa(r,"style",i),Ok(r,n.precedence,e),t.instance=r;case"stylesheet":i=xb(n.href);var s=e.querySelector(Hv(i));if(s)return t.state.loading|=4,t.instance=s,Vs(s),s;r=jee(n),(i=zl.get(i))&&h4(r,i),s=(e.ownerDocument||e).createElement("link"),Vs(s);var a=s;return a._p=new Promise(function(l,c){a.onload=l,a.onerror=c}),pa(s,"link",r),t.state.loading|=4,Ok(s,n.precedence,e),t.instance=s;case"script":return s=cO(n.src),(i=e.querySelector(Xv(s)))?(t.instance=i,Vs(i),i):(r=n,(i=zl.get(s))&&(r=yi({},n),p4(r,i)),e=e.ownerDocument||e,i=e.createElement("script"),Vs(i),pa(i,"link",r),e.head.appendChild(i),t.instance=i);case"void":return null;default:throw Error(Xe(443,t.type))}else t.type==="stylesheet"&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Ok(r,n.precedence,e));return t.instance}function Ok(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 mwe(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 Ree(e){return!(e.type==="stylesheet"&&!(e.state.loading&3))}function gwe(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=xb(r.href),s=t.querySelector(Hv(i));if(s){t=s._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=zT.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=s,Vs(s);return}s=t.ownerDocument||t,r=jee(r),(i=zl.get(i))&&h4(r,i),s=s.createElement("link"),Vs(s);var a=s;a._p=new Promise(function(l,c){a.onload=l,a.onerror=c}),pa(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=zT.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var kj=0;function bwe(e,t){return e.stylesheets&&e.count===0&&xk(e,e.stylesheets),0kj?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function zT(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)xk(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var VT=null;function xk(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,VT=new Map,t.forEach(Owe,e),VT=null,zT.call(e))}function Owe(e,t){if(!(t.state.loading&4)){var n=VT.get(e);if(n)var r=n.get(null);else{n=new Map,VT.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(Qee)}catch(e){console.error(e)}}Qee(),GZ.exports=B_;var Twe=GZ.exports;const _we=eO(Twe),y4=m.createContext({});function rA(e){const t=m.useRef(null);return t.current===null&&(t.current=e()),t.current}const iA=m.createContext(null),Ex=m.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class Awe extends m.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 Cwe({children:e,isPresent:t}){const n=m.useId(),r=m.useRef(null),i=m.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=m.useContext(Ex);return m.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,62 +55,62 @@ Error generating stack: `+r.message+` top: ${c}px !important; left: ${u}px !important; } - `),()=>{document.head.removeChild(d)}},[t]),o.jsx(Twe,{isPresent:t,childRef:r,sizeRef:i,children:m.cloneElement(e,{ref:r})})}const Awe=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:s,mode:a})=>{const l=tA(Cwe),c=m.useId(),u=m.useCallback(f=>{l.set(f,!0);for(const h of l.values())if(!h)return;r&&r()},[l,r]),d=m.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 m.useMemo(()=>{l.forEach((f,h)=>l.set(h,!1))},[n]),m.useEffect(()=>{!n&&!l.size&&r&&r()},[n]),a==="popLayout"&&(e=o.jsx(_we,{isPresent:n,children:e})),o.jsx(nA.Provider,{value:d,children:e})};function Cwe(){return new Map}function Bee(e=!0){const t=m.useContext(nA);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:i}=t,s=m.useId();m.useEffect(()=>{e&&i(s)},[e]);const a=m.useCallback(()=>e&&r&&r(s),[s,r,e]);return!n&&r?[!1,a]:[!0]}const IS=e=>e.key||"";function SQ(e){const t=[];return m.Children.forEach(e,n=>{m.isValidElement(n)&&t.push(n)}),t}const O4=typeof window<"u",Qee=O4?m.useLayoutEffect:m.useEffect,Oh=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:s="sync",propagate:a=!1})=>{const[l,c]=Bee(a),u=m.useMemo(()=>SQ(e),[e]),d=a&&!l?[]:u.map(IS),f=m.useRef(!0),h=m.useRef(u),p=tA(()=>new Map),[b,g]=m.useState(u),[O,y]=m.useState(u);Qee(()=>{f.current=!1,h.current=u;for(let w=0;w{const S=IS(w),E=a&&!l?!1:u===O||d.includes(S),k=()=>{if(p.has(S))p.set(S,!0);else return;let T=!0;p.forEach(C=>{C||(T=!1)}),T&&(x==null||x(),y(h.current),a&&(c==null||c()),r&&r())};return o.jsx(Awe,{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)})})},nl=e=>e;let Fee=nl;const Nwe={useManualTiming:!1};function jwe(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 p=f&&r?t:n;return d&&s.add(u),p.has(u)||p.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 DS=["read","resolveKeyframes","update","preRender","render","postRender"],Rwe=40;function Uee(e,t){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>n=!0,a=DS.reduce((y,v)=>(y[v]=jwe(s),y),{}),{read:l,resolveKeyframes:c,update:u,preRender:d,render:f,postRender:h}=a,p=()=>{const y=performance.now();n=!1,i.delta=r?1e3/60:Math.max(Math.min(y-i.timestamp,Rwe),1),i.timestamp=y,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(p))},b=()=>{n=!0,r=!0,i.isProcessing||e(p)};return{schedule:DS.reduce((y,v)=>{const x=a[v];return y[v]=(w,S=!1,E=!1)=>(n||b(),x.schedule(w,S,E)),y},{}),cancel:y=>{for(let v=0;vEQ[e].some(n=>!!t[n])};function Iwe(e){for(const t in e)vb[t]={...vb[t],...e[t]}}const Dwe=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 qT(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Dwe.has(e)}let Vee=e=>!qT(e);function qee(e){e&&(Vee=t=>t.startsWith("on")?!qT(t):e(t))}try{qee(require("@emotion/is-prop-valid").default)}catch{}function Pwe(e,t,n){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||(Vee(i)||n===!0&&qT(i)||!t&&!qT(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}function Mwe({children:e,isValidProp:t,...n}){t&&qee(t),n={...m.useContext(Sx),...n},n.isStatic=tA(()=>n.isStatic);const r=m.useMemo(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion]);return o.jsx(Sx.Provider,{value:r,children:e})}function Lwe(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 rA=m.createContext({});function Ex(e){return typeof e=="string"||Array.isArray(e)}function iA(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const y4=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],x4=["initial",...y4];function sA(e){return iA(e.animate)||x4.some(t=>Ex(e[t]))}function Hee(e){return!!(sA(e)||e.variants)}function $we(e,t){if(sA(e)){const{initial:n,animate:r}=e;return{initial:n===!1||Ex(n)?n:void 0,animate:Ex(r)?r:void 0}}return e.inherit!==!1?t:{}}function Bwe(e){const{initial:t,animate:n}=$we(e,m.useContext(rA));return m.useMemo(()=>({initial:t,animate:n}),[kQ(t),kQ(n)])}function kQ(e){return Array.isArray(e)?e.join(" "):e}const Qwe=Symbol.for("motionComponentSymbol");function p0(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Fwe(e,t,n){return m.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):p0(n)&&(n.current=r))},[t])}const v4=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Uwe="framerAppearId",Xee="data-"+v4(Uwe),{schedule:w4}=Uee(queueMicrotask,!1),Gee=m.createContext({});function zwe(e,t,n,r,i){var s,a;const{visualElement:l}=m.useContext(rA),c=m.useContext(zee),u=m.useContext(nA),d=m.useContext(Sx).reducedMotion,f=m.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,p=m.useContext(Gee);h&&!h.projection&&i&&(h.type==="html"||h.type==="svg")&&Vwe(f.current,n,i,p);const b=m.useRef(!1);m.useInsertionEffect(()=>{h&&b.current&&h.update(n,u)});const g=n[Xee],O=m.useRef(!!g&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,g))&&((a=window.MotionHasOptimisedAnimation)===null||a===void 0?void 0:a.call(window,g)));return Qee(()=>{h&&(b.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),w4.render(h.render),O.current&&h.animationState&&h.animationState.animateChanges())}),m.useEffect(()=>{h&&(!O.current&&h.animationState&&h.animationState.animateChanges(),O.current&&(queueMicrotask(()=>{var y;(y=window.MotionHandoffMarkAsComplete)===null||y===void 0||y.call(window,g)}),O.current=!1))}),h}function Vwe(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:Yee(e.parent)),e.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!a||l&&p0(l),visualElement:e,animationType:typeof s=="string"?s:"both",initialPromotionConfig:r,layoutScroll:c,layoutRoot:u})}function Yee(e){if(e)return e.options.allowProjection!==!1?e.projection:Yee(e.parent)}function qwe({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:i}){var s,a;e&&Iwe(e);function l(u,d){let f;const h={...m.useContext(Sx),...u,layoutId:Hwe(u)},{isStatic:p}=h,b=Bwe(u),g=r(u,p);if(!p&&O4){Xwe();const O=Gwe(h);f=O.MeasureLayout,b.visualElement=zwe(i,g,h,t,O.ProjectionNode)}return o.jsxs(rA.Provider,{value:b,children:[f&&b.visualElement?o.jsx(f,{visualElement:b.visualElement,...h}):null,n(i,u,Fwe(g,b.visualElement,d),g,p,b.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=m.forwardRef(l);return c[Qwe]=i,c}function Hwe({layoutId:e}){const t=m.useContext(b4).id;return t&&e!==void 0?t+"-"+e:e}function Xwe(e,t){m.useContext(zee).strict}function Gwe(e){const{drag:t,layout:n}=vb;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 Ywe=["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 S4(e){return typeof e!="string"||e.includes("-")?!1:!!(Ywe.indexOf(e)>-1||/[A-Z]/u.test(e))}function TQ(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function E4(e,t,n,r){if(typeof t=="function"){const[i,s]=TQ(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]=TQ(r);t=t(n!==void 0?n:e.custom,i,s)}return t}const U5=e=>Array.isArray(e),Wwe=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),Zwe=e=>U5(e)?e[e.length-1]||0:e,Ta=e=>!!(e&&e.getVelocity);function xk(e){const t=Ta(e)?e.get():e;return Wwe(t)?t.toValue():t}function Kwe({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},r,i,s){const a={latestValues:Jwe(r,i,s,e),renderState:t()};return n&&(a.onMount=l=>n({props:r,current:l,...a}),a.onUpdate=l=>n(l)),a}const Wee=e=>(t,n)=>{const r=m.useContext(rA),i=m.useContext(nA),s=()=>Kwe(e,t,r,i);return n?s():tA(s)};function Jwe(e,t,n,r){const i={},s=r(e,{});for(const h in s)i[h]=xk(s[h]);let{initial:a,animate:l}=e;const c=sA(e),u=Hee(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"&&!iA(f)){const h=Array.isArray(f)?f:[f];for(let p=0;pt=>typeof t=="string"&&t.startsWith(e),Kee=Zee("--"),eSe=Zee("var(--"),k4=e=>eSe(e)?tSe.test(e.split("/*")[0].trim()):!1,tSe=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Jee=(e,t)=>t&&typeof e=="number"?t.transform(e):e,qd=(e,t,n)=>n>t?t:ntypeof e=="number",parse:parseFloat,transform:e=>e},kx={...uO,transform:e=>qd(0,1,e)},PS={...uO,default:1},Xv=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Pf=Xv("deg"),xu=Xv("%"),nn=Xv("px"),nSe=Xv("vh"),rSe=Xv("vw"),_Q={...xu,parse:e=>xu.parse(e)/100,transform:e=>xu.transform(e*100)},iSe={borderWidth:nn,borderTopWidth:nn,borderRightWidth:nn,borderBottomWidth:nn,borderLeftWidth:nn,borderRadius:nn,radius:nn,borderTopLeftRadius:nn,borderTopRightRadius:nn,borderBottomRightRadius:nn,borderBottomLeftRadius:nn,width:nn,maxWidth:nn,height:nn,maxHeight:nn,top:nn,right:nn,bottom:nn,left:nn,padding:nn,paddingTop:nn,paddingRight:nn,paddingBottom:nn,paddingLeft:nn,margin:nn,marginTop:nn,marginRight:nn,marginBottom:nn,marginLeft:nn,backgroundPositionX:nn,backgroundPositionY:nn},sSe={rotate:Pf,rotateX:Pf,rotateY:Pf,rotateZ:Pf,scale:PS,scaleX:PS,scaleY:PS,scaleZ:PS,skew:Pf,skewX:Pf,skewY:Pf,distance:nn,translateX:nn,translateY:nn,translateZ:nn,x:nn,y:nn,z:nn,perspective:nn,transformPerspective:nn,opacity:kx,originX:_Q,originY:_Q,originZ:nn},AQ={...uO,transform:Math.round},T4={...iSe,...sSe,zIndex:AQ,size:nn,fillOpacity:kx,strokeOpacity:kx,numOctaves:AQ},aSe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},oSe=cO.length;function lSe(e,t,n){let r="",i=!0;for(let s=0;s({style:{},transform:{},transformOrigin:{},vars:{}}),ete=()=>({...C4(),attrs:{}}),N4=e=>typeof e=="string"&&e.toLowerCase()==="svg";function tte(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 nte=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 rte(e,t,n,r){tte(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(nte.has(i)?i:v4(i),t.attrs[i])}const HT={};function hSe(e){Object.assign(HT,e)}function ite(e,{layout:t,layoutId:n}){return qm.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!HT[e]||e==="opacity")}function j4(e,t,n){var r;const{style:i}=e,s={};for(const a in i)(Ta(i[a])||t.style&&Ta(t.style[a])||ite(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 ste(e,t,n){const r=j4(e,t,n);for(const i in e)if(Ta(e[i])||Ta(t[i])){const s=cO.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[s]=e[i]}return r}function pSe(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 NQ=["x","y","width","height","cx","cy","r"],mSe={useVisualState:Wee({scrapeMotionValuesFromProps:ste,createRenderState:ete,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(qm.has(l)){s=!0;break}}if(!s)return;let a=!t;if(t)for(let l=0;l{pSe(n,r),Oi.render(()=>{A4(r,i,N4(n.tagName),e.transformTemplate),rte(n,r)})})}})},gSe={useVisualState:Wee({scrapeMotionValuesFromProps:j4,createRenderState:C4})};function ate(e,t,n){for(const r in t)!Ta(t[r])&&!ite(r,n)&&(e[r]=t[r])}function bSe({transformTemplate:e},t){return m.useMemo(()=>{const n=C4();return _4(n,t,e),Object.assign({},n.vars,n.style)},[t])}function OSe(e,t){const n=e.style||{},r={};return ate(r,n,e),Object.assign(r,bSe(e,t)),r}function ySe(e,t){const n={},r=OSe(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 xSe(e,t,n,r){const i=m.useMemo(()=>{const s=ete();return A4(s,t,N4(r),e.transformTemplate),{...s.attrs,style:{...s.style}}},[t]);if(e.style){const s={};ate(s,e.style,e),i.style={...s,...i.style}}return i}function vSe(e=!1){return(n,r,i,{latestValues:s},a)=>{const c=(S4(n)?xSe:ySe)(r,s,a,n),u=Pwe(r,typeof n=="string",e),d=n!==m.Fragment?{...u,...c,ref:i}:{},{children:f}=r,h=m.useMemo(()=>Ta(f)?f.get():f,[f]);return m.createElement(n,{...d,children:h})}}function wSe(e,t){return function(r,{forwardMotionProps:i}={forwardMotionProps:!1}){const a={...S4(r)?mSe:gSe,preloadedFeatures:e,useRender:vSe(i),createVisualElement:t,Component:r};return qwe(a)}}function ote(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r(vk===void 0&&vu.set(ia.isProcessing||Nwe.useManualTiming?ia.timestamp:performance.now()),vk),set:e=>{vk=e,queueMicrotask(SSe)}};function I4(e,t){e.indexOf(t)===-1&&e.push(t)}function D4(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class P4{constructor(){this.subscriptions=[]}add(t){return I4(this.subscriptions,t),()=>D4(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 kSe{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,i=!0)=>{const s=vu.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=vu.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=ESe(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 P4);const r=this.events[t].add(n);return t==="change"?()=>{r(),Oi.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=vu.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>jQ)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,jQ);return cte(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 Tx(e,t){return new kSe(e,t)}function TSe(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Tx(n))}function _Se(e,t){const n=aA(e,t);let{transitionEnd:r={},transition:i={},...s}=n||{};s={...s,...r};for(const a in s){const l=Zwe(s[a]);TSe(e,a,l)}}function ASe(e){return!!(Ta(e)&&e.add)}function z5(e,t){const n=e.getValue("willChange");if(ASe(n))return n.add(t)}function ute(e){return e.props[Xee]}function M4(e){let t;return()=>(t===void 0&&(t=e()),t)}const CSe=M4(()=>window.ScrollTimeline!==void 0);class NSe{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(CSe()&&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 jSe extends NSe{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}const Nd=e=>e*1e3,jd=e=>e/1e3;function L4(e){return typeof e=="function"}function RQ(e,t){e.timeline=t,e.onfinish=null}const $4=e=>Array.isArray(e)&&typeof e[0]=="number",RSe={linearEasing:void 0};function ISe(e,t){const n=M4(e);return()=>{var r;return(r=RSe[t])!==null&&r!==void 0?r:n()}}const XT=ISe(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),wb=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},dte=(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})`,V5={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Yy([0,.65,.55,1]),circOut:Yy([.55,0,1,.45]),backIn:Yy([.31,.01,.66,-.59]),backOut:Yy([.33,1.53,.69,.99])};function hte(e,t){if(e)return typeof e=="function"&&XT()?dte(e,t):$4(e)?Yy(e):Array.isArray(e)?e.map(n=>hte(n,t)||V5.easeOut):V5[e]}const pte=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,DSe=1e-7,PSe=12;function MSe(e,t,n,r,i){let s,a,l=0;do a=t+(n-t)/2,s=pte(a,r,i)-e,s>0?n=a:t=a;while(Math.abs(s)>DSe&&++lMSe(s,0,1,e,n);return s=>s===0||s===1?s:pte(i(s),t,r)}const mte=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,gte=e=>t=>1-e(1-t),bte=Gv(.33,1.53,.69,.99),B4=gte(bte),Ote=mte(B4),yte=e=>(e*=2)<1?.5*B4(e):.5*(2-Math.pow(2,-10*(e-1))),Q4=e=>1-Math.sin(Math.acos(e)),xte=gte(Q4),vte=mte(Q4),wte=e=>/^0[^.\s]+$/u.test(e);function LSe(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||wte(e):!0}const A1=e=>Math.round(e*1e5)/1e5,F4=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function $Se(e){return e==null}const BSe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,U4=(e,t)=>n=>!!(typeof n=="string"&&BSe.test(n)&&n.startsWith(e)||t&&!$Se(n)&&Object.prototype.hasOwnProperty.call(n,t)),Ste=(e,t,n)=>r=>{if(typeof r!="string")return r;const[i,s,a,l]=r.match(F4);return{[e]:parseFloat(i),[t]:parseFloat(s),[n]:parseFloat(a),alpha:l!==void 0?parseFloat(l):1}},QSe=e=>qd(0,255,e),kj={...uO,transform:e=>Math.round(QSe(e))},Hp={test:U4("rgb","red"),parse:Ste("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+kj.transform(e)+", "+kj.transform(t)+", "+kj.transform(n)+", "+A1(kx.transform(r))+")"};function FSe(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 q5={test:U4("#"),parse:FSe,transform:Hp.transform},m0={test:U4("hsl","hue"),parse:Ste("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+xu.transform(A1(t))+", "+xu.transform(A1(n))+", "+A1(kx.transform(r))+")"},Sa={test:e=>Hp.test(e)||q5.test(e)||m0.test(e),parse:e=>Hp.test(e)?Hp.parse(e):m0.test(e)?m0.parse(e):q5.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Hp.transform(e):m0.transform(e)},USe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function zSe(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(F4))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(USe))===null||n===void 0?void 0:n.length)||0)>0}const Ete="number",kte="color",VSe="var",qSe="var(",IQ="${}",HSe=/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 _x(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[];let s=0;const l=t.replace(HSe,c=>(Sa.test(c)?(r.color.push(s),i.push(kte),n.push(Sa.parse(c))):c.startsWith(qSe)?(r.var.push(s),i.push(VSe),n.push(c)):(r.number.push(s),i.push(Ete),n.push(parseFloat(c))),++s,IQ)).split(IQ);return{values:n,split:l,indexes:r,types:i}}function Tte(e){return _x(e).values}function _te(e){const{split:t,types:n}=_x(e),r=t.length;return i=>{let s="";for(let a=0;atypeof e=="number"?0:e;function GSe(e){const t=Tte(e);return _te(e)(t.map(XSe))}const jh={test:zSe,parse:Tte,createTransformer:_te,getAnimatableNone:GSe},YSe=new Set(["brightness","contrast","saturate","opacity"]);function WSe(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(F4)||[];if(!r)return e;const i=n.replace(r,"");let s=YSe.has(t)?1:0;return r!==n&&(s*=100),t+"("+s+i+")"}const ZSe=/\b([a-z-]*)\(.*?\)/gu,H5={...jh,getAnimatableNone:e=>{const t=e.match(ZSe);return t?t.map(WSe).join(" "):e}},KSe={...T4,color:Sa,backgroundColor:Sa,outlineColor:Sa,fill:Sa,stroke:Sa,borderColor:Sa,borderTopColor:Sa,borderRightColor:Sa,borderBottomColor:Sa,borderLeftColor:Sa,filter:H5,WebkitFilter:H5},z4=e=>KSe[e];function Ate(e,t){let n=z4(e);return n!==H5&&(n=jh),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const JSe=new Set(["auto","none","0"]);function eEe(e,t,n){let r=0,i;for(;re===uO||e===nn,PQ=(e,t)=>parseFloat(e.split(", ")[t]),MQ=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/u);if(i)return PQ(i[1],t);{const s=r.match(/^matrix\((.+)\)$/u);return s?PQ(s[1],e):0}},tEe=new Set(["x","y","z"]),nEe=cO.filter(e=>!tEe.has(e));function rEe(e){const t=[];return nEe.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const Sb={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:MQ(4,13),y:MQ(5,14)};Sb.translateX=Sb.x;Sb.translateY=Sb.y;const om=new Set;let X5=!1,G5=!1;function Cte(){if(G5){const e=Array.from(om).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const i=rEe(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)})}G5=!1,X5=!1,om.forEach(e=>e.complete()),om.clear()}function Nte(){om.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(G5=!0)})}function iEe(){Nte(),Cte()}class V4{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?(om.add(this),X5||(X5=!0,Oi.read(Nte),Oi.resolveKeyframes(Cte))):(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),sEe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function aEe(e){const t=sEe.exec(e);if(!t)return[,];const[,n,r,i]=t;return[`--${n??r}`,i]}function Rte(e,t,n=1){const[r,i]=aEe(e);if(!r)return;const s=window.getComputedStyle(t).getPropertyValue(r);if(s){const a=s.trim();return jte(a)?parseFloat(a):a}return k4(i)?Rte(i,t,n+1):i}const Ite=e=>t=>t.test(e),oEe={test:e=>e==="auto",parse:e=>e},Dte=[uO,nn,xu,Pf,rSe,nSe,oEe],LQ=e=>Dte.find(Ite(e));class Pte extends V4{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 $Q=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(jh.test(e)||e==="0")&&!e.startsWith("url("));function lEe(e){const t=e[0];if(e.length===1)return!0;for(let n=0;ne!==null;function oA(e,{repeat:t,repeatType:n="loop"},r){const i=e.filter(uEe),s=t&&n!=="loop"&&t%2===1?0:i.length-1;return!s||r===void 0?i[s]:r}const dEe=40;class Mte{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=vu.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>dEe?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&iEe(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=vu.now(),this.hasAttemptedResolve=!0;const{name:r,type:i,velocity:s,delay:a,onComplete:l,onUpdate:c,isGenerator:u}=this.options;if(!u&&!cEe(t,r,i,s))if(a)this.options.duration=0;else{c&&c(oA(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 Y5=2e4;function Lte(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=Y5?1/0:t}const Bi=(e,t,n)=>e+(t-e)*n;function Tj(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 fEe({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=Tj(c,l,e+1/3),s=Tj(c,l,e),a=Tj(c,l,e-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(a*255),alpha:r}}function GT(e,t){return n=>n>0?t:e}const _j=(e,t,n)=>{const r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},hEe=[q5,Hp,m0],pEe=e=>hEe.find(t=>t.test(e));function BQ(e){const t=pEe(e);if(!t)return!1;let n=t.parse(e);return t===m0&&(n=fEe(n)),n}const QQ=(e,t)=>{const n=BQ(e),r=BQ(t);if(!n||!r)return GT(e,t);const i={...n};return s=>(i.red=_j(n.red,r.red,s),i.green=_j(n.green,r.green,s),i.blue=_j(n.blue,r.blue,s),i.alpha=Bi(n.alpha,r.alpha,s),Hp.transform(i))},mEe=(e,t)=>n=>t(e(n)),Yv=(...e)=>e.reduce(mEe),W5=new Set(["none","hidden"]);function gEe(e,t){return W5.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function bEe(e,t){return n=>Bi(e,t,n)}function q4(e){return typeof e=="number"?bEe:typeof e=="string"?k4(e)?GT:Sa.test(e)?QQ:xEe:Array.isArray(e)?$te:typeof e=="object"?Sa.test(e)?QQ:OEe:GT}function $te(e,t){const n=[...e],r=n.length,i=e.map((s,a)=>q4(s)(s,t[a]));return s=>{for(let a=0;a{for(const s in r)n[s]=r[s](i);return n}}function yEe(e,t){var n;const r=[],i={color:0,var:0,number:0};for(let s=0;s{const n=jh.createTransformer(t),r=_x(e),i=_x(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?W5.has(e)&&!i.values.length||W5.has(t)&&!r.values.length?gEe(e,t):Yv($te(yEe(r,i),i.values),n):GT(e,t)};function Bte(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Bi(e,t,n):q4(e)(e,t)}const vEe=5;function Qte(e,t,n){const r=Math.max(t-vEe,0);return cte(n-e(r),t-r)}const Gi={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},Aj=.001;function wEe({duration:e=Gi.duration,bounce:t=Gi.bounce,velocity:n=Gi.velocity,mass:r=Gi.mass}){let i,s,a=1-t;a=qd(Gi.minDamping,Gi.maxDamping,a),e=qd(Gi.minDuration,Gi.maxDuration,jd(e)),a<1?(i=u=>{const d=u*a,f=d*e,h=d-n,p=Z5(u,a),b=Math.exp(-f);return Aj-h/p*b},s=u=>{const f=u*a*e,h=f*n+n,p=Math.pow(a,2)*Math.pow(u,2)*e,b=Math.exp(-f),g=Z5(Math.pow(u,2),a);return(-i(u)+Aj>0?-1:1)*((h-p)*b)/g}):(i=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-Aj+d*f},s=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const l=5/e,c=EEe(i,s,l);if(e=Nd(e),isNaN(c))return{stiffness:Gi.stiffness,damping:Gi.damping,duration:e};{const u=Math.pow(c,2)*r;return{stiffness:u,damping:a*2*Math.sqrt(r*u),duration:e}}}const SEe=12;function EEe(e,t,n){let r=n;for(let i=1;ie[n]!==void 0)}function _Ee(e){let t={velocity:Gi.velocity,stiffness:Gi.stiffness,damping:Gi.damping,mass:Gi.mass,isResolvedFromDuration:!1,...e};if(!FQ(e,TEe)&&FQ(e,kEe))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,s=2*qd(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:Gi.mass,stiffness:i,damping:s}}else{const n=wEe(e);t={...t,...n,mass:Gi.mass},t.isResolvedFromDuration=!0}return t}function Fte(e=Gi.visualDuration,t=Gi.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:p}=_Ee({...n,velocity:-jd(n.velocity||0)}),b=h||0,g=u/(2*Math.sqrt(c*d)),O=a-s,y=jd(Math.sqrt(c/d)),v=Math.abs(O)<5;r||(r=v?Gi.restSpeed.granular:Gi.restSpeed.default),i||(i=v?Gi.restDelta.granular:Gi.restDelta.default);let x;if(g<1){const S=Z5(y,g);x=E=>{const k=Math.exp(-g*y*E);return a-k*((b+g*y*O)/S*Math.sin(S*E)+O*Math.cos(S*E))}}else if(g===1)x=S=>a-Math.exp(-y*S)*(O+(b+y*O)*S);else{const S=y*Math.sqrt(g*g-1);x=E=>{const k=Math.exp(-g*y*E),T=Math.min(S*E,300);return a-k*((b+g*y*O)*Math.sinh(T)+S*O*Math.cosh(T))/S}}const w={calculatedDuration:p&&f||null,next:S=>{const E=x(S);if(p)l.done=S>=f;else{let k=0;g<1&&(k=S===0?Nd(b):Qte(x,S,E));const T=Math.abs(k)<=r,C=Math.abs(a-E)<=i;l.done=T&&C}return l.value=l.done?a:E,l},toString:()=>{const S=Math.min(Lte(w),Y5),E=dte(k=>w.next(S*k).value,S,30);return S+"ms "+E}};return w}function UQ({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},p=T=>l!==void 0&&Tc,b=T=>l===void 0?c:c===void 0||Math.abs(l-T)-g*Math.exp(-T/r),x=T=>y+v(T),w=T=>{const C=v(T),N=x(T);h.done=Math.abs(C)<=u,h.value=h.done?y:N};let S,E;const k=T=>{p(h.value)&&(S=T,E=Fte({keyframes:[h.value,b(h.value)],velocity:Qte(x,T,h.value),damping:i,stiffness:s,restDelta:u,restSpeed:d}))};return k(0),{calculatedDuration:null,next:T=>{let C=!1;return!E&&S===void 0&&(C=!0,w(T),k(T)),S!==void 0&&T>=S?E.next(T-S):(!C&&w(T),h)}}}const AEe=Gv(.42,0,1,1),CEe=Gv(0,0,.58,1),Ute=Gv(.42,0,.58,1),NEe=e=>Array.isArray(e)&&typeof e[0]!="number",jEe={linear:nl,easeIn:AEe,easeInOut:Ute,easeOut:CEe,circIn:Q4,circInOut:vte,circOut:xte,backIn:B4,backInOut:Ote,backOut:bte,anticipate:yte},zQ=e=>{if($4(e)){Fee(e.length===4);const[t,n,r,i]=e;return Gv(t,n,r,i)}else if(typeof e=="string")return jEe[e];return e};function REe(e,t,n){const r=[],i=n||Bte,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=REe(t,r,i),c=l.length,u=d=>{if(a&&d1)for(;fu(qd(e[0],e[s-1],d)):u}function DEe(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=wb(0,t,r);e.push(Bi(n,1,i))}}function PEe(e){const t=[0];return DEe(t,e.length-1),t}function MEe(e,t){return e.map(n=>n*t)}function LEe(e,t){return e.map(()=>t||Ute).splice(0,e.length-1)}function YT({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=NEe(r)?r.map(zQ):zQ(r),s={done:!1,value:t[0]},a=MEe(n&&n.length===t.length?n:PEe(t),e),l=IEe(a,t,{ease:Array.isArray(i)?i:LEe(t,i)});return{calculatedDuration:e,next:c=>(s.value=l(c),s.done=c>=e,s)}}const $Ee=e=>{const t=({timestamp:n})=>e(n);return{start:()=>Oi.update(t,!0),stop:()=>Nh(t),now:()=>ia.isProcessing?ia.timestamp:vu.now()}},BEe={decay:UQ,inertia:UQ,tween:YT,keyframes:YT,spring:Fte},QEe=e=>e/100;class H4 extends Mte{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)||V4,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=L4(n)?n:BEe[n]||YT;let c,u;l!==YT&&typeof t[0]!="number"&&(c=Yv(QEe,Bte(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=Lte(d));const{calculatedDuration:f}=d,h=f+i,p=h*(r+1)-i;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:c,calculatedDuration:f,resolvedDuration:h,totalDuration:p}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:r}=this;if(!r){const{keyframes:T}=this.options;return{done:!0,value:T[T.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:p,repeatType:b,repeatDelay:g,onUpdate:O}=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 y=this.currentTime-h*(this.speed>=0?1:-1),v=this.speed>=0?y<0:y>d;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let x=this.currentTime,w=s;if(p){const T=Math.min(this.currentTime,d)/f;let C=Math.floor(T),N=T%1;!N&&T>=1&&(N=1),N===1&&C--,C=Math.min(C,p+1),!!(C%2)&&(b==="reverse"?(N=1-N,g&&(N-=g/f)):b==="mirror"&&(w=a)),x=qd(0,1,N)*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=oA(c,this.options,i)),O&&O(S.value),k&&this.finish(),S}get duration(){const{resolved:t}=this;return t?jd(t.calculatedDuration):0}get time(){return jd(this.currentTime)}set time(t){t=Nd(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=jd(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=$Ee,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 FEe=new Set(["opacity","clipPath","filter","transform"]);function UEe(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=hte(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 zEe=M4(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),WT=10,VEe=2e4;function qEe(e){return L4(e.type)||e.type==="spring"||!fte(e.ease)}function HEe(e,t){const n=new H4({...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"&&XT()&&XEe(s)&&(s=zte[s]),qEe(this.options)){const{onComplete:f,onUpdate:h,motionValue:p,element:b,...g}=this.options,O=HEe(t,g);t=O.keyframes,t.length===1&&(t[1]=t[0]),r=O.duration,i=O.times,s=O.ease,a="keyframes"}const d=UEe(l.owner.current,c,t,{...this.options,duration:r,times:i,ease:s});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(RQ(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:f}=this.options;l.set(oA(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 jd(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return jd(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=Nd(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 nl;const{animation:r}=n;RQ(r,t)}return nl}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,...p}=this.options,b=new H4({...p,keyframes:r,duration:i,type:s,ease:a,times:l,isGenerator:!0}),g=Nd(this.time);u.setWithVelocity(b.sample(g-WT).value,b.sample(g).value,WT)}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 zEe()&&r&&FEe.has(r)&&!c&&!u&&!i&&s!=="mirror"&&a!==0&&l!=="inertia"}}const GEe={type:"spring",stiffness:500,damping:25,restSpeed:10},YEe=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),WEe={type:"keyframes",duration:.8},ZEe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},KEe=(e,{keyframes:t})=>t.length>2?WEe:qm.has(e)?e.startsWith("scale")?YEe(t[1]):GEe:ZEe;function JEe({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 X4=(e,t,n,r={},i,s)=>a=>{const l=R4(r,e)||{},c=l.delay||r.delay||0;let{elapsed:u=0}=r;u=u-Nd(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};JEe(l)||(d={...d,...KEe(e,d)}),d.duration&&(d.duration=Nd(d.duration)),d.repeatDelay&&(d.repeatDelay=Nd(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=oA(d.keyframes,l);if(h!==void 0)return Oi.update(()=>{d.onUpdate(h),d.onComplete()}),new jSe([])}return!s&&VQ.supports(d)?new VQ(d):new H4(d)};function eke({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function Vte(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),p=c[f];if(p===void 0||d&&eke(d,f))continue;const b={delay:n,...R4(a||{},f)};let g=!1;if(window.MotionHandoffAnimation){const y=ute(e);if(y){const v=window.MotionHandoffAnimation(y,f,Oi);v!==null&&(b.startTime=v,g=!0)}}z5(e,f),h.start(X4(f,h,p,e.shouldReduceMotion&<e.has(f)?{type:!1}:b,e,g));const O=h.animation;O&&u.push(O)}return l&&Promise.all(u).then(()=>{Oi.update(()=>{l&&_Se(e,l)})}),u}function K5(e,t,n={}){var r;const i=aA(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(Vte(e,i,n)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=s;return tke(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 tke(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(nke).forEach((u,d)=>{u.notify("AnimationStart",t),a.push(K5(u,t,{...s,delay:n+c(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function nke(e,t){return e.sortNodePosition(t)}function rke(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(s=>K5(e,s,n));r=Promise.all(i)}else if(typeof t=="string")r=K5(e,t,n);else{const i=typeof t=="function"?aA(e,t,n.custom):t;r=Promise.all(Vte(e,i,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const ike=x4.length;function qte(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?qte(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})=>rke(e,n,r)))}function lke(e){let t=oke(e),n=qQ(),r=!0;const i=c=>(u,d)=>{var f;const h=aA(e,d,c==="exit"?(f=e.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(h){const{transition:p,transitionEnd:b,...g}=h;u={...u,...g,...b}}return u};function s(c){t=c(e)}function a(c){const{props:u}=e,d=qte(e.parent)||{},f=[],h=new Set;let p={},b=1/0;for(let O=0;Ob&&w,C=!1;const N=Array.isArray(x)?x:[x];let _=N.reduce(i(y),{});S===!1&&(_={});const{prevResolvedValues:R={}}=v,$={...R,..._},D=P=>{T=!0,h.has(P)&&(C=!0,h.delete(P)),v.needsAnimating[P]=!0;const L=e.getValue(P);L&&(L.liveStyle=!1)};for(const P in $){const L=_[P],U=R[P];if(p.hasOwnProperty(P))continue;let F=!1;U5(L)&&U5(U)?F=!ote(L,U):F=L!==U,F?L!=null?D(P):h.add(P):L!==void 0&&h.has(P)?D(P):v.protectedKeys[P]=!0}v.prevProp=x,v.prevResolvedValues=_,v.isActive&&(p={...p,..._}),r&&e.blockInitialAnimation&&(T=!1),T&&(!(E&&k)||C)&&f.push(...N.map(P=>({animation:P,options:{type:y}})))}if(h.size){const O={};h.forEach(y=>{const v=e.getBaseTarget(y),x=e.getValue(y);x&&(x.liveStyle=!0),O[y]=v??null}),f.push({animation:O})}let g=!!f.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(g=!1),r=!1,g?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 p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(c,u)}),n[c].isActive=u;const f=a(c);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:a,setActive:l,setAnimateFunction:s,getState:()=>n,reset:()=>{n=qQ(),r=!0}}}function cke(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!ote(t,e):!1}function hp(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function qQ(){return{animate:hp(!0),whileInView:hp(),whileHover:hp(),whileTap:hp(),whileDrag:hp(),whileFocus:hp(),exit:hp()}}class Zh{constructor(t){this.isMounted=!1,this.node=t}update(){}}class uke extends Zh{constructor(t){super(t),t.animationState||(t.animationState=lke(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();iA(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 dke=0;class fke extends Zh{constructor(){super(...arguments),this.id=dke++}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 hke={animation:{Feature:uke},exit:{Feature:fke}},lc={x:!1,y:!1};function Hte(){return lc.x||lc.y}function pke(e){return e==="x"||e==="y"?lc[e]?null:(lc[e]=!0,()=>{lc[e]=!1}):lc.x||lc.y?null:(lc.x=lc.y=!0,()=>{lc.x=lc.y=!1})}const G4=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function Ax(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function Wv(e){return{point:{x:e.pageX,y:e.pageY}}}const mke=e=>t=>G4(t)&&e(t,Wv(t));function C1(e,t,n,r){return Ax(e,t,mke(n),r)}const HQ=(e,t)=>Math.abs(e-t);function gke(e,t){const n=HQ(e.x,t.x),r=HQ(e.y,t.y);return Math.sqrt(n**2+r**2)}class Xte{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=Nj(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,p=gke(f.offset,{x:0,y:0})>=3;if(!h&&!p)return;const{point:b}=f,{timestamp:g}=ia;this.history.push({...b,timestamp:g});const{onStart:O,onMove:y}=this.handlers;h||(O&&O(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),y&&y(this.lastMoveEvent,f)},this.handlePointerMove=(f,h)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=Cj(h,this.transformPagePoint),Oi.update(this.updatePoint,!0)},this.handlePointerUp=(f,h)=>{this.end();const{onEnd:p,onSessionEnd:b,resumeAnimation:g}=this.handlers;if(this.dragSnapToOrigin&&g&&g(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const O=Nj(f.type==="pointercancel"?this.lastMoveEventInfo:Cj(h,this.transformPagePoint),this.history);this.startEvent&&p&&p(f,O),b&&b(f,O)},!G4(t))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=r,this.contextWindow=i||window;const a=Wv(t),l=Cj(a,this.transformPagePoint),{point:c}=l,{timestamp:u}=ia;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,Nj(l,this.history)),this.removeListeners=Yv(C1(this.contextWindow,"pointermove",this.handlePointerMove),C1(this.contextWindow,"pointerup",this.handlePointerUp),C1(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Nh(this.updatePoint)}}function Cj(e,t){return t?{point:t(e.point)}:e}function XQ(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Nj({point:e},t){return{point:e,delta:XQ(e,Gte(t)),offset:XQ(e,bke(t)),velocity:Oke(t,.1)}}function bke(e){return e[0]}function Gte(e){return e[e.length-1]}function Oke(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=Gte(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Nd(t)));)n--;if(!r)return{x:0,y:0};const s=jd(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 Yte=1e-4,yke=1-Yte,xke=1+Yte,Wte=.01,vke=0-Wte,wke=0+Wte;function ll(e){return e.max-e.min}function Ske(e,t,n){return Math.abs(e-t)<=n}function GQ(e,t,n,r=.5){e.origin=r,e.originPoint=Bi(t.min,t.max,e.origin),e.scale=ll(n)/ll(t),e.translate=Bi(n.min,n.max,e.origin)-e.originPoint,(e.scale>=yke&&e.scale<=xke||isNaN(e.scale))&&(e.scale=1),(e.translate>=vke&&e.translate<=wke||isNaN(e.translate))&&(e.translate=0)}function N1(e,t,n,r){GQ(e.x,t.x,n.x,r?r.originX:void 0),GQ(e.y,t.y,n.y,r?r.originY:void 0)}function YQ(e,t,n){e.min=n.min+t.min,e.max=e.min+ll(t)}function Eke(e,t,n){YQ(e.x,t.x,n.x),YQ(e.y,t.y,n.y)}function WQ(e,t,n){e.min=t.min-n.min,e.max=e.min+ll(t)}function j1(e,t,n){WQ(e.x,t.x,n.x),WQ(e.y,t.y,n.y)}function kke(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?Bi(n,e,r.max):Math.min(e,n)),e}function ZQ(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 Tke(e,{top:t,left:n,bottom:r,right:i}){return{x:ZQ(e.x,n,i),y:ZQ(e.y,t,r)}}function KQ(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=wb(t.min,t.max-r,e.min):r>i&&(n=wb(e.min,e.max-i,t.min)),qd(0,1,n)}function Cke(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 J5=.35;function Nke(e=J5){return e===!1?e=0:e===!0&&(e=J5),{x:JQ(e,"left","right"),y:JQ(e,"top","bottom")}}function JQ(e,t,n){return{min:eF(e,t),max:eF(e,n)}}function eF(e,t){return typeof e=="number"?e:e[t]||0}const tF=()=>({translate:0,scale:1,origin:0,originPoint:0}),g0=()=>({x:tF(),y:tF()}),nF=()=>({min:0,max:0}),ns=()=>({x:nF(),y:nF()});function xl(e){return[e("x"),e("y")]}function Zte({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function jke({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Rke(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 jj(e){return e===void 0||e===1}function eP({scale:e,scaleX:t,scaleY:n}){return!jj(e)||!jj(t)||!jj(n)}function Cp(e){return eP(e)||Kte(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Kte(e){return rF(e.x)||rF(e.y)}function rF(e){return e&&e!=="0%"}function ZT(e,t,n){const r=e-n,i=t*r;return n+i}function iF(e,t,n,r,i){return i!==void 0&&(e=ZT(e,i,r)),ZT(e,n,r)+t}function tP(e,t=0,n=1,r,i){e.min=iF(e.min,t,n,r,i),e.max=iF(e.max,t,n,r,i)}function Jte(e,{x:t,y:n}){tP(e.x,t.translate,t.scale,t.originPoint),tP(e.y,n.translate,n.scale,n.originPoint)}const sF=.999999999999,aF=1.0000000000001;function Ike(e,t,n,r=!1){const i=n.length;if(!i)return;t.x=t.y=1;let s,a;for(let l=0;lsF&&(t.x=1),t.ysF&&(t.y=1)}function b0(e,t){e.min=e.min+t,e.max=e.max+t}function oF(e,t,n,r,i=.5){const s=Bi(e.min,e.max,i);tP(e,t,n,s,r)}function O0(e,t){oF(e.x,t.x,t.scaleX,t.scale,t.originX),oF(e.y,t.y,t.scaleY,t.scale,t.originY)}function ene(e,t){return Zte(Rke(e.getBoundingClientRect(),t))}function Dke(e,t,n){const r=ene(e,n),{scroll:i}=t;return i&&(b0(r.x,i.offset.x),b0(r.y,i.offset.y)),r}const tne=({current:e})=>e?e.ownerDocument.defaultView:null,Pke=new WeakMap;class Mke{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=ns(),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(Wv(d).point)},s=(d,f)=>{const{drag:h,dragPropagation:p,onDragStart:b}=this.getProps();if(h&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=pke(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),xl(O=>{let y=this.getAxisMotionValue(O).get()||0;if(xu.test(y)){const{projection:v}=this.visualElement;if(v&&v.layout){const x=v.layout.layoutBox[O];x&&(y=ll(x)*(parseFloat(y)/100))}}this.originPoint[O]=y}),b&&Oi.postRender(()=>b(d,f)),z5(this.visualElement,"transform");const{animationState:g}=this.visualElement;g&&g.setActive("whileDrag",!0)},a=(d,f)=>{const{dragPropagation:h,dragDirectionLock:p,onDirectionLock:b,onDrag:g}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:O}=f;if(p&&this.currentDirection===null){this.currentDirection=Lke(O),this.currentDirection!==null&&b&&b(this.currentDirection);return}this.updateAxis("x",f.point,O),this.updateAxis("y",f.point,O),this.visualElement.render(),g&&g(d,f)},l=(d,f)=>this.stop(d,f),c=()=>xl(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 Xte(t,{onSessionStart:i,onStart:s,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:tne(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&&Oi.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||!MS(t,i,this.currentDirection))return;const s=this.getAxisMotionValue(t);let a=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(a=kke(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&&p0(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&i?this.constraints=Tke(i.layoutBox,n):this.constraints=!1,this.elastic=Nke(r),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&xl(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=Cke(i.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!p0(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=Dke(r,i.root,this.visualElement.getTransformPagePoint());let a=_ke(i.layout.layoutBox,s);if(n){const l=n(jke(a));this.hasMutatedConstraints=!!l,l&&(a=Zte(l))}return a}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:s,dragSnapToOrigin:a,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=xl(d=>{if(!MS(d,n,this.currentDirection))return;let f=c&&c[d]||{};a&&(f={min:0,max:0});const h=i?200:1e6,p=i?40:1e7,b={type:"inertia",velocity:r?t[d]:0,bounceStiffness:h,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...s,...f};return this.startAxisValueAnimation(d,b)});return Promise.all(u).then(l)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return z5(this.visualElement,t),r.start(X4(t,r,0,n,this.visualElement,!1))}stopAnimation(){xl(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){xl(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){xl(n=>{const{drag:r}=this.getProps();if(!MS(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]-Bi(a,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!p0(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};xl(a=>{const l=this.getAxisMotionValue(a);if(l&&this.constraints!==!1){const c=l.get();i[a]=Ake({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(),xl(a=>{if(!MS(a,t,null))return;const l=this.getAxisMotionValue(a),{min:c,max:u}=this.constraints[a];l.set(Bi(c,u,i[a]))})}addListeners(){if(!this.visualElement.current)return;Pke.set(this.visualElement,this);const t=this.visualElement.current,n=C1(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();p0(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()),Oi.read(r);const a=Ax(window,"resize",()=>this.scalePositionWithinConstraints()),l=i.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(xl(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=J5,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:s,dragElastic:a,dragMomentum:l}}}function MS(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function Lke(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class $ke extends Zh{constructor(t){super(t),this.removeGroupControls=nl,this.removeListeners=nl,this.controls=new Mke(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||nl}unmount(){this.removeGroupControls(),this.removeListeners()}}const lF=e=>(t,n)=>{e&&Oi.postRender(()=>e(t,n))};class Bke extends Zh{constructor(){super(...arguments),this.removePointerDownListener=nl}onPointerDown(t){this.session=new Xte(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:tne(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:lF(t),onStart:lF(n),onMove:r,onEnd:(s,a)=>{delete this.session,i&&Oi.postRender(()=>i(s,a))}}}mount(){this.removePointerDownListener=C1(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 wk={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function cF(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const py={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(nn.test(e))e=parseFloat(e);else return e;const n=cF(e,t.target.x),r=cF(e,t.target.y);return`${n}% ${r}%`}},Qke={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=jh.parse(e);if(i.length>5)return r;const s=jh.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=Bi(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 Fke extends m.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:s}=t;hSe(Uke),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()})),wk.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()||Oi.postRender(()=>{const l=a.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),w4.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 nne(e){const[t,n]=Bee(),r=m.useContext(b4);return o.jsx(Fke,{...e,layoutGroup:r,switchLayoutGroup:m.useContext(Gee),isPresent:t,safeToRemove:n})}const Uke={borderRadius:{...py,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:py,borderTopRightRadius:py,borderBottomLeftRadius:py,borderBottomRightRadius:py,boxShadow:Qke};function zke(e,t,n){const r=Ta(e)?e:Tx(e);return r.start(X4("",r,t,n)),r.animation}function Vke(e){return e instanceof SVGElement&&e.tagName!=="svg"}const qke=(e,t)=>e.depth-t.depth;class Hke{constructor(){this.children=[],this.isDirty=!1}add(t){I4(this.children,t),this.isDirty=!0}remove(t){D4(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(qke),this.isDirty=!1,this.children.forEach(t)}}function Xke(e,t){const n=vu.now(),r=({timestamp:i})=>{const s=i-n;s>=t&&(Nh(r),e(s-t))};return Oi.read(r,!0),()=>Nh(r)}const rne=["TopLeft","TopRight","BottomLeft","BottomRight"],Gke=rne.length,uF=e=>typeof e=="string"?parseFloat(e):e,dF=e=>typeof e=="number"||nn.test(e);function Yke(e,t,n,r,i,s){i?(e.opacity=Bi(0,n.opacity!==void 0?n.opacity:1,Wke(r)),e.opacityExit=Bi(t.opacity!==void 0?t.opacity:1,0,Zke(r))):s&&(e.opacity=Bi(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let a=0;art?1:n(wb(e,t,r))}function hF(e,t){e.min=t.min,e.max=t.max}function Ol(e,t){hF(e.x,t.x),hF(e.y,t.y)}function pF(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function mF(e,t,n,r,i){return e-=t,e=ZT(e,1/n,r),i!==void 0&&(e=ZT(e,1/i,r)),e}function Kke(e,t=0,n=1,r=.5,i,s=e,a=e){if(xu.test(t)&&(t=parseFloat(t),t=Bi(a.min,a.max,t/100)-a.min),typeof t!="number")return;let l=Bi(s.min,s.max,r);e===s&&(l-=t),e.min=mF(e.min,t,n,l,i),e.max=mF(e.max,t,n,l,i)}function gF(e,t,[n,r,i],s,a){Kke(e,t[n],t[r],t[i],t.scale,s,a)}const Jke=["x","scaleX","originX"],eTe=["y","scaleY","originY"];function bF(e,t,n,r){gF(e.x,t,Jke,n?n.x:void 0,r?r.x:void 0),gF(e.y,t,eTe,n?n.y:void 0,r?r.y:void 0)}function OF(e){return e.translate===0&&e.scale===1}function sne(e){return OF(e.x)&&OF(e.y)}function yF(e,t){return e.min===t.min&&e.max===t.max}function tTe(e,t){return yF(e.x,t.x)&&yF(e.y,t.y)}function xF(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function ane(e,t){return xF(e.x,t.x)&&xF(e.y,t.y)}function vF(e){return ll(e.x)/ll(e.y)}function wF(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class nTe{constructor(){this.members=[]}add(t){I4(this.members,t),t.scheduleRender()}remove(t){if(D4(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 rTe(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:p,skewY:b}=n;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),f&&(r+=`rotateX(${f}deg) `),h&&(r+=`rotateY(${h}deg) `),p&&(r+=`skewX(${p}deg) `),b&&(r+=`skewY(${b}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 Np={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Wy=typeof window<"u"&&window.MotionDebug!==void 0,Rj=["","X","Y","Z"],iTe={visibility:"hidden"},SF=1e3;let sTe=0;function Ij(e,t,n,r){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function one(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=ute(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:s}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Oi,!(i||s))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&one(r)}function lne({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(a={},l=t==null?void 0:t()){this.id=sTe++,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,Wy&&(Np.totalNodes=Np.resolvedTargetDeltas=Np.recalculatedProjection=0),this.nodes.forEach(lTe),this.nodes.forEach(hTe),this.nodes.forEach(pTe),this.nodes.forEach(cTe),Wy&&window.MotionDebug.record(Np)},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=Xke(h,250),wk.hasAnimatedSinceResize&&(wk.hasAnimatedSinceResize=!1,this.nodes.forEach(kF))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:p,layout:b})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||d.getDefaultTransition()||yTe,{onLayoutAnimationStart:O,onLayoutAnimationComplete:y}=d.getProps(),v=!this.targetLayout||!ane(this.targetLayout,b)||p,x=!h&&p;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={...R4(g,"layout"),onPlay:O,onComplete:y};(d.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w)}else h||kF(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=b})}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,Nh(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(mTe),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&&one(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;TF(f.x,a.x,S),TF(f.y,a.y,S),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(j1(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),bTe(this.relativeTarget,this.relativeTargetOrigin,h,S),x&&tTe(this.relativeTarget,x)&&(this.isProjectionDirty=!1),x||(x=ns()),Ol(x,this.relativeTarget)),g&&(this.animationValues=d,Yke(d,u,this.latestValues,S,v,y)),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&&(Nh(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Oi.update(()=>{wk.hasAnimatedSinceResize=!0,this.currentAnimation=zke(0,SF,{...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(SF),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&&cne(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||ns();const f=ll(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+f;const h=ll(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+h}Ol(l,c),O0(l,d),N1(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(a,l){this.sharedNodes.has(a)||this.sharedNodes.set(a,new nTe),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&&Ij("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(EF),this.root.sharedNodes.clear()}}}function aTe(e){e.updateLayout()}function oTe(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"?xl(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=ll(h);h.min=r[f].min,h.max=h.min+p}):cne(s,n.layoutBox,r)&&xl(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=ll(r[f]);h.max=h.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+p)});const l=g0();N1(l,r,n.layoutBox);const c=g0();a?N1(c,e.applyTransform(i,!0),n.measuredBox):N1(c,r,n.layoutBox);const u=!sne(l);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:p}=f;if(h&&p){const b=ns();j1(b,n.layoutBox,h.layoutBox);const g=ns();j1(g,r,p.layoutBox),ane(b,g)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=g,e.relativeTargetOrigin=b,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 lTe(e){Wy&&Np.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 cTe(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function uTe(e){e.clearSnapshot()}function EF(e){e.clearMeasurements()}function dTe(e){e.isLayoutDirty=!1}function fTe(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function kF(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function hTe(e){e.resolveTargetDelta()}function pTe(e){e.calcProjection()}function mTe(e){e.resetSkewAndRotation()}function gTe(e){e.removeLeadSnapshot()}function TF(e,t,n){e.translate=Bi(t.translate,0,n),e.scale=Bi(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function _F(e,t,n,r){e.min=Bi(t.min,n.min,r),e.max=Bi(t.max,n.max,r)}function bTe(e,t,n,r){_F(e.x,t.x,n.x,r),_F(e.y,t.y,n.y,r)}function OTe(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const yTe={duration:.45,ease:[.4,0,.1,1]},AF=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),CF=AF("applewebkit/")&&!AF("chrome/")?Math.round:nl;function NF(e){e.min=CF(e.min),e.max=CF(e.max)}function xTe(e){NF(e.x),NF(e.y)}function cne(e,t,n){return e==="position"||e==="preserve-aspect"&&!Ske(vF(t),vF(n),.2)}function vTe(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const wTe=lne({attachResizeListener:(e,t)=>Ax(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Dj={current:void 0},une=lne({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Dj.current){const e=new wTe({});e.mount(window),e.setOptions({layoutScroll:!0}),Dj.current=e}return Dj.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),STe={pan:{Feature:Bke},drag:{Feature:$ke,ProjectionNode:une,MeasureLayout:nne}};function ETe(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 dne(e,t){const n=ETe(e),r=new AbortController,i={passive:!0,...t,signal:r.signal};return[n,i,()=>r.abort()]}function jF(e){return t=>{t.pointerType==="touch"||Hte()||e(t)}}function kTe(e,t,n={}){const[r,i,s]=dne(e,n),a=jF(l=>{const{target:c}=l,u=t(l);if(typeof u!="function"||!c)return;const d=jF(f=>{u(f),c.removeEventListener("pointerleave",d)});c.addEventListener("pointerleave",d,i)});return r.forEach(l=>{l.addEventListener("pointerenter",a,i)}),s}function RF(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&&Oi.postRender(()=>s(t,Wv(t)))}class TTe extends Zh{mount(){const{current:t}=this.node;t&&(this.unmount=kTe(t,n=>(RF(this.node,n,"Start"),r=>RF(this.node,r,"End"))))}unmount(){}}class _Te extends Zh{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=Yv(Ax(this.node.current,"focus",()=>this.onFocus()),Ax(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const fne=(e,t)=>t?e===t?!0:fne(e,t.parentElement):!1,ATe=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function CTe(e){return ATe.has(e.tagName)||e.tabIndex!==-1}const Zy=new WeakSet;function IF(e){return t=>{t.key==="Enter"&&e(t)}}function Pj(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const NTe=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=IF(()=>{if(Zy.has(n))return;Pj(n,"down");const i=IF(()=>{Pj(n,"up")}),s=()=>Pj(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 DF(e){return G4(e)&&!Hte()}function jTe(e,t,n={}){const[r,i,s]=dne(e,n),a=l=>{const c=l.currentTarget;if(!DF(l)||Zy.has(c))return;Zy.add(c);const u=t(l),d=(p,b)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),!(!DF(p)||!Zy.has(c))&&(Zy.delete(c),typeof u=="function"&&u(p,{success:b}))},f=p=>{d(p,n.useGlobalTarget||fne(c,p.target))},h=p=>{d(p,!1)};window.addEventListener("pointerup",f,i),window.addEventListener("pointercancel",h,i)};return r.forEach(l=>{!CTe(l)&&l.getAttribute("tabindex")===null&&(l.tabIndex=0),(n.useGlobalTarget?window:l).addEventListener("pointerdown",a,i),l.addEventListener("focus",u=>NTe(u,i),i)}),s}function PF(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&&Oi.postRender(()=>s(t,Wv(t)))}class RTe extends Zh{mount(){const{current:t}=this.node;t&&(this.unmount=jTe(t,n=>(PF(this.node,n,"Start"),(r,{success:i})=>PF(this.node,r,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const nP=new WeakMap,Mj=new WeakMap,ITe=e=>{const t=nP.get(e.target);t&&t(e)},DTe=e=>{e.forEach(ITe)};function PTe({root:e,...t}){const n=e||document;Mj.has(n)||Mj.set(n,{});const r=Mj.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(DTe,{root:e,...t})),r[i]}function MTe(e,t,n){const r=PTe(t);return nP.set(e,n),r.observe(e),()=>{nP.delete(e),r.unobserve(e)}}const LTe={some:0,all:1};class $Te extends Zh{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:LTe[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 MTe(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(BTe(t,n))&&this.startObserver()}unmount(){}}function BTe({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const QTe={inView:{Feature:$Te},tap:{Feature:RTe},focus:{Feature:_Te},hover:{Feature:TTe}},FTe={layout:{ProjectionNode:une,MeasureLayout:nne}},KT={current:null},Y4={current:!1};function hne(){if(Y4.current=!0,!!O4)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>KT.current=e.matches;e.addListener(t),t()}else KT.current=!1}const UTe=[...Dte,Sa,jh],zTe=e=>UTe.find(Ite(e)),MF=new WeakMap;function VTe(e,t,n){for(const r in t){const i=t[r],s=n[r];if(Ta(i))e.addValue(r,i);else if(Ta(s))e.addValue(r,Tx(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,Tx(a!==void 0?a:i,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const LF=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class qTe{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=V4,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=vu.now();this.renderScheduledAtthis.bindToMotionValue(r,n)),Y4.current||hne(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:KT.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){MF.delete(this.current),this.projection&&this.projection.unmount(),Nh(this.notifyUpdate),Nh(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=qm.has(t),i=n.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&Oi.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 vb){const n=vb[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):ns()}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=Tx(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"&&(jte(i)||wte(i))?i=parseFloat(i):!zTe(i)&&jh.test(n)&&(i=Ate(t,n)),this.setBaseTarget(t,Ta(i)?i.get():i)),Ta(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=E4(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&&!Ta(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 P4),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class pne extends qTe{constructor(){super(...arguments),this.KeyframeResolver=Pte}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;Ta(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function HTe(e){return window.getComputedStyle(e)}class XTe extends pne{constructor(){super(...arguments),this.type="html",this.renderInstance=tte}readValueFromInstance(t,n){if(qm.has(n)){const r=z4(n);return r&&r.default||0}else{const r=HTe(t),i=(Kee(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return ene(t,n)}build(t,n,r){_4(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return j4(t,n,r)}}class GTe extends pne{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ns}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(qm.has(n)){const r=z4(n);return r&&r.default||0}return n=nte.has(n)?n:v4(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return ste(t,n,r)}build(t,n,r){A4(t,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,n,r,i){rte(t,n,r,i)}mount(t){this.isSVGTag=N4(t.tagName),super.mount(t)}}const YTe=(e,t)=>S4(e)?new GTe(t):new XTe(t,{allowProjection:e!==m.Fragment}),WTe=wSe({...hke,...QTe,...STe,...FTe},YTe),Wi=Lwe(WTe);function ZTe(){!Y4.current&&hne();const[e]=m.useState(KT.current);return e}function Ns(){return Ns=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u"||/ServerSideRendering/.test(navigator&&navigator.userAgent)?m.useEffect:m.useLayoutEffect;function qg(e,t,n){var r=m.useRef(t);r.current=t,m.useEffect(function(){function i(s){r.current(s)}return e&&window.addEventListener(e,i,n),function(){e&&window.removeEventListener(e,i)}},[e])}var KTe=["container"];function JTe(e){var t=e.container,n=t===void 0?document.body:t,r=lA(e,KTe);return ii.createPortal(Cn.createElement("div",Ns({},r)),n)}function e2e(e){return Cn.createElement("svg",Ns({width:"44",height:"44",viewBox:"0 0 768 768"},e),Cn.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 t2e(e){return Cn.createElement("svg",Ns({width:"44",height:"44",viewBox:"0 0 768 768"},e),Cn.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 n2e(e){return Cn.createElement("svg",Ns({width:"44",height:"44",viewBox:"0 0 768 768"},e),Cn.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function r2e(){return m.useEffect(function(){var e=document.body.style,t=e.overflow;return e.overflow="hidden",function(){e.overflow=t}},[]),null}function BF(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 Ff=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 Lj(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=Ff(e,s,n,innerWidth)[0],f=Ff(t,s,r,innerHeight),h=innerWidth/2,p=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-(p+t))-p+(f[0]?u/2:u),lastCX:a,lastCY:l}}function sP(e,t,n){var r=e%180!=0;return r?[n,t,r]:[t,n,r]}function $j(e,t,n){var r=sP(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 $S(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=m.useRef(e);l.current=e;var c=m.useRef(0),u=m.useRef(),d=function(){return u.current&&clearTimeout(u.current)},f=m.useCallback(function(){var h=[].slice.call(arguments),p=Date.now();function b(){c.current=p,d(),l.current.apply(null,h)}var g=c.current,O=p-g;if(g===0&&(r&&b(),c.current=p),i!==void 0){if(O>i)return void b()}else O=1&&s&&s())};d()}function d(){c=requestAnimationFrame(u)}}var s2e={T:0,L:0,W:0,H:0,FIT:void 0},gne=function(){var e=m.useRef(!1);return m.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),e},a2e=["className"];function o2e(e){var t=e.className,n=t===void 0?"":t,r=lA(e,a2e);return Cn.createElement("div",Ns({className:"PhotoView__Spinner "+n},r),Cn.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},Cn.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"}),Cn.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}var l2e=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function c2e(e){var t=e.src,n=e.loaded,r=e.broken,i=e.className,s=e.onPhotoLoad,a=e.loadingElement,l=e.brokenElement,c=lA(e,l2e),u=gne();return t&&!r?Cn.createElement(Cn.Fragment,null,Cn.createElement("img",Ns({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?Cn.createElement("span",{className:"PhotoView__icon"},a):Cn.createElement(o2e,{className:"PhotoView__icon"}))):l?Cn.createElement("span",{className:"PhotoView__icon"},typeof l=="function"?l({src:t}):l):null}var u2e={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 d2e(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,p=e.className,b=e.style,g=e.loadingElement,O=e.brokenElement,y=e.onPhotoTap,v=e.onMaskTap,x=e.onReachMove,w=e.onReachUp,S=e.onPhotoResize,E=e.isActive,k=e.expose,T=JT(u2e),C=T[0],N=T[1],_=m.useRef(0),R=gne(),$=C.naturalWidth,D=$===void 0?s:$,M=C.naturalHeight,j=M===void 0?l:M,P=C.width,L=P===void 0?s:P,U=C.height,F=U===void 0?l:U,q=C.loaded,z=q===void 0?!n:q,B=C.broken,V=C.x,ce=C.y,we=C.touched,Oe=C.stopRaf,de=C.maskTouched,Z=C.rotate,J=C.scale,fe=C.CX,be=C.CY,je=C.lastX,Qe=C.lastY,Me=C.lastCX,le=C.lastCY,ke=C.lastScale,ye=C.touchTime,$e=C.touchLength,ze=C.pause,Ae=C.reach,Ve=lm({onScale:function(Ne){return ut(LS(Ne))},onRotate:function(Ne){Z!==Ne&&(k({rotate:Ne}),N(Ns({rotate:Ne},$j(D,j,Ne))))}});function ut(Ne,Ge,Pt){J!==Ne&&(k({scale:Ne}),N(Ns({scale:Ne},Lj(V,ce,L,F,J,Ne,Ge,Pt),Ne<=1&&{x:0,y:0})))}var Tt=$S(function(Ne,Ge,Pt){if(Pt===void 0&&(Pt=0),(we||de)&&E){var Kt=sP(Z,L,F),tt=Kt[0],an=Kt[1];if(Pt===0&&_.current===0){var ar=Math.abs(Ne-fe)<=20,Qt=Math.abs(Ge-be)<=20;if(ar&&Qt)return void N({lastCX:Ne,lastCY:Ge});_.current=ar?Ge>be?3:2:1}var Ut,Ce=Ne-Me,Ze=Ge-le;if(Pt===0){var $t=Ff(Ce+je,J,tt,innerWidth)[0],En=Ff(Ze+Qe,J,an,innerHeight);Ut=function(xr,Pe,at,Lt){return Pe&&xr===1||Lt==="x"?"x":at&&xr>1||Lt==="y"?"y":void 0}(_.current,$t,En[0],Ae),Ut!==void 0&&x(Ut,Ne,Ge,J)}if(Ut==="x"||de)return void N({reach:"x"});var gn=LS(J+(Pt-$e)/100/2*J,D/L,.2);k({scale:gn}),N(Ns({touchLength:Pt,reach:Ut,scale:gn},Lj(V,ce,L,F,J,gn,Ne,Ge,Ce,Ze)))}},{maxWait:8});function We(Ne){return!Oe&&!we&&(R.current&&N(Ns({},Ne,{pause:u})),R.current)}var W,ne,he,xe,re,Re,nt,Ke,tn=(re=function(Ne){return We({x:Ne})},Re=function(Ne){return We({y:Ne})},nt=function(Ne){return R.current&&(k({scale:Ne}),N({scale:Ne})),!we&&R.current},Ke=lm({X:function(Ne){return re(Ne)},Y:function(Ne){return Re(Ne)},S:function(Ne){return nt(Ne)}}),function(Ne,Ge,Pt,Kt,tt,an,ar,Qt,Ut,Ce,Ze){var $t=sP(Ce,tt,an),En=$t[0],gn=$t[1],xr=Ff(Ne,Qt,En,innerWidth),Pe=xr[0],at=xr[1],Lt=Ff(Ge,Qt,gn,innerHeight),Wt=Lt[0],fn=Lt[1],Jt=Date.now()-Ze;if(Jt>=200||Qt!==ar||Math.abs(Ut-ar)>1){var or=Lj(Ne,Ge,tt,an,ar,Qt),Sr=or.x,si=or.y,Yt=Pe?at:Sr!==Ne?Sr:null,_r=Wt?fn:si!==Ge?si:null;return Yt!==null&&Lp(Ne,Yt,Ke.X),_r!==null&&Lp(Ge,_r,Ke.Y),void(Qt!==ar&&Lp(ar,Qt,Ke.S))}var kn=(Ne-Pt)/Jt,Wr=(Ge-Kt)/Jt,jr=Math.sqrt(Math.pow(kn,2)+Math.pow(Wr,2)),Rr=!1,Rn=!1;(function(lr,Nn){var cr,Lr=lr,$r=0,Zr=0,bn=function(ot){cr||(cr=ot);var dt=ot-cr,Zn=Math.sign(lr),Fi=-.001*Zn,Ui=Math.sign(-Lr)*Math.pow(Lr,2)*2e-4,Es=Lr*dt+(Fi+Ui)*Math.pow(dt,2)/2;$r+=Es,cr=ot,Zn*(Lr+=(Fi+Ui)*dt)<=0?Ie():Nn($r)?ue():Ie()};function ue(){Zr=requestAnimationFrame(bn)}function Ie(){cancelAnimationFrame(Zr)}ue()})(jr,function(lr){var Nn=Ne+lr*(kn/jr),cr=Ge+lr*(Wr/jr),Lr=Ff(Nn,ar,En,innerWidth),$r=Lr[0],Zr=Lr[1],bn=Ff(cr,ar,gn,innerHeight),ue=bn[0],Ie=bn[1];if($r&&!Rr&&(Rr=!0,Pe?Lp(Nn,Zr,Ke.X):QF(Zr,Nn+(Nn-Zr),Ke.X)),ue&&!Rn&&(Rn=!0,Wt?Lp(cr,Ie,Ke.Y):QF(Ie,cr+(cr-Ie),Ke.Y)),Rr&&Rn)return!1;var ot=Rr||Ke.X(Zr),dt=Rn||Ke.Y(Ie);return ot&&dt})}),Gt=(W=y,ne=function(Ne,Ge){Ae||ut(J!==1?1:Math.max(2,D/L),Ne,Ge)},he=m.useRef(0),xe=$S(function(){he.current=0,W.apply(void 0,[].slice.call(arguments))},{wait:300}),function(){var Ne=[].slice.call(arguments);he.current+=1,xe.apply(void 0,Ne),he.current>=2&&(xe.cancel(),he.current=0,ne.apply(void 0,Ne))});function At(Ne,Ge){if(_.current=0,(we||de)&&E){N({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});var Pt=LS(J,D/L);if(tn(V,ce,je,Qe,L,F,J,Pt,ke,Z,ye),w(Ne,Ge),fe===Ne&&be===Ge){if(we)return void Gt(Ne,Ge);de&&v(Ne,Ge)}}}function St(Ne,Ge,Pt){Pt===void 0&&(Pt=0),N({touched:!0,CX:Ne,CY:Ge,lastCX:Ne,lastCY:Ge,lastX:V,lastY:ce,lastScale:J,touchLength:Pt,touchTime:Date.now()})}function ve(Ne){N({maskTouched:!0,CX:Ne.clientX,CY:Ne.clientY,lastX:V,lastY:ce})}qg(sd?void 0:"mousemove",function(Ne){Ne.preventDefault(),Tt(Ne.clientX,Ne.clientY)}),qg(sd?void 0:"mouseup",function(Ne){At(Ne.clientX,Ne.clientY)}),qg(sd?"touchmove":void 0,function(Ne){Ne.preventDefault();var Ge=BF(Ne);Tt.apply(void 0,Ge)},{passive:!1}),qg(sd?"touchend":void 0,function(Ne){var Ge=Ne.changedTouches[0];At(Ge.clientX,Ge.clientY)},{passive:!1}),qg("resize",$S(function(){z&&!we&&(N($j(D,j,Z)),S())},{maxWait:8})),iP(function(){E&&k(Ns({scale:J,rotate:Z},Ve))},[E]);var Ue=function(Ne,Ge,Pt,Kt,tt,an,ar,Qt,Ut,Ce){var Ze=function(Sr,si,Yt,_r,kn){var Wr=m.useRef(!1),jr=JT({lead:!0,scale:Yt}),Rr=jr[0],Rn=Rr.lead,lr=Rr.scale,Nn=jr[1],cr=$S(function(Lr){try{return kn(!0),Nn({lead:!1,scale:Lr}),Promise.resolve()}catch($r){return Promise.reject($r)}},{wait:_r});return iP(function(){Wr.current?(kn(!1),Nn({lead:!0}),cr(Yt)):Wr.current=!0},[Yt]),Rn?[Sr*lr,si*lr,Yt/lr]:[Sr*Yt,si*Yt,1]}(an,ar,Qt,Ut,Ce),$t=Ze[0],En=Ze[1],gn=Ze[2],xr=function(Sr,si,Yt,_r,kn){var Wr=m.useState(s2e),jr=Wr[0],Rr=Wr[1],Rn=m.useState(0),lr=Rn[0],Nn=Rn[1],cr=m.useRef(),Lr=lm({OK:function(){return Sr&&Nn(4)}});function $r(Zr){kn(!1),Nn(Zr)}return m.useEffect(function(){if(cr.current||(cr.current=Date.now()),Yt){if(function(Zr,bn){var ue=Zr&&Zr.current;if(ue&&ue.nodeType===1){var Ie=ue.getBoundingClientRect();bn({T:Ie.top,L:Ie.left,W:Ie.width,H:Ie.height,FIT:ue.tagName==="IMG"?getComputedStyle(ue).objectFit:void 0})}}(si,Rr),Sr)return Date.now()-cr.current<250?(Nn(1),requestAnimationFrame(function(){Nn(2),requestAnimationFrame(function(){return $r(3)})}),void setTimeout(Lr.OK,_r)):void Nn(4);$r(5)}},[Sr,Yt]),[lr,jr]}(Ne,Ge,Pt,Ut,Ce),Pe=xr[0],at=xr[1],Lt=at.W,Wt=at.FIT,fn=innerWidth/2,Jt=innerHeight/2,or=Pe<3||Pe>4;return[or?Lt?at.L:fn:Kt+(fn-an*Qt/2),or?Lt?at.T:Jt:tt+(Jt-ar*Qt/2),$t,or&&Wt?$t*(at.H/Lt):En,Pe===0?gn:or?Lt/(an*Qt)||.01:gn,or?Wt?1:0:1,Pe,Wt]}(u,c,z,V,ce,L,F,J,d,function(Ne){return N({pause:Ne})}),Y=Ue[4],mt=Ue[6],xt="transform "+d+"ms "+f,Dt={className:p,onMouseDown:sd?void 0:function(Ne){Ne.stopPropagation(),Ne.button===0&&St(Ne.clientX,Ne.clientY,0)},onTouchStart:sd?function(Ne){Ne.stopPropagation(),St.apply(void 0,BF(Ne))}:void 0,onWheel:function(Ne){if(!Ae){var Ge=LS(J-Ne.deltaY/100/2,D/L);N({stopRaf:!0}),ut(Ge,Ne.clientX,Ne.clientY)}},style:{width:Ue[2]+"px",height:Ue[3]+"px",opacity:Ue[5],objectFit:mt===4?void 0:Ue[7],transform:Z?"rotate("+Z+"deg)":void 0,transition:mt>2?xt+", opacity "+d+"ms ease, height "+(mt<4?d/2:mt>4?d:0)+"ms "+f:void 0}};return Cn.createElement("div",{className:"PhotoView__PhotoWrap"+(h?" "+h:""),style:b,onMouseDown:!sd&&E?ve:void 0,onTouchStart:sd&&E?function(Ne){return ve(Ne.touches[0])}:void 0},Cn.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:"matrix("+Y+", 0, 0, "+Y+", "+Ue[0]+", "+Ue[1]+")",transition:we||ze?void 0:xt,willChange:E?"transform":void 0}},n?Cn.createElement(c2e,Ns({src:n,loaded:z,broken:B},Dt,{onPhotoLoad:function(Ne){N(Ns({},Ne,Ne.loaded&&$j(Ne.naturalWidth||0,Ne.naturalHeight||0,Z)))},loadingElement:g,brokenElement:O})):r&&r({attrs:Dt,scale:Y,rotate:Z})))}var FF={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 f2e(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,p=h===void 0||h,b=e.overlayRender,g=e.toolbarRender,O=e.className,y=e.maskClassName,v=e.photoClassName,x=e.photoWrapClassName,w=e.loadingElement,S=e.brokenElement,E=e.images,k=e.index,T=k===void 0?0:k,C=e.onIndexChange,N=e.visible,_=e.onClose,R=e.afterClose,$=e.portalContainer,D=JT(FF),M=D[0],j=D[1],P=m.useState(0),L=P[0],U=P[1],F=M.x,q=M.touched,z=M.pause,B=M.lastCX,V=M.lastCY,ce=M.bg,we=ce===void 0?u:ce,Oe=M.lastBg,de=M.overlay,Z=M.minimal,J=M.scale,fe=M.rotate,be=M.onScale,je=M.onRotate,Qe=e.hasOwnProperty("index"),Me=Qe?T:L,le=Qe?C:U,ke=m.useRef(Me),ye=E.length,$e=E[Me],ze=typeof n=="boolean"?n:ye>n,Ae=function(Y,mt){var xt=m.useReducer(function(Pt){return!Pt},!1)[1],Dt=m.useRef(0),Ne=function(Pt){var Kt=m.useRef(Pt);function tt(an){Kt.current=an}return m.useMemo(function(){(function(an){Y?(an(Y),Dt.current=1):Dt.current=2})(tt)},[Pt]),[Kt.current,tt]}(Y),Ge=Ne[1];return[Ne[0],Dt.current,function(){xt(),Dt.current===2&&(Ge(!1),mt&&mt()),Dt.current=0}]}(N,R),Ve=Ae[0],ut=Ae[1],Tt=Ae[2];iP(function(){if(Ve)return j({pause:!0,x:Me*-(innerWidth+wg)}),void(ke.current=Me);j(FF)},[Ve]);var We=lm({close:function(Y){je&&je(0),j({overlay:!0,lastBg:we}),_(Y)},changeIndex:function(Y,mt){mt===void 0&&(mt=!1);var xt=ze?ke.current+(Y-Me):Y,Dt=ye-1,Ne=rP(xt,0,Dt),Ge=ze?xt:Ne,Pt=innerWidth+wg;j({touched:!1,lastCX:void 0,lastCY:void 0,x:-Pt*Ge,pause:mt}),ke.current=Ge,le&&le(ze?Y<0?Dt:Y>Dt?0:Y:Ne)}}),W=We.close,ne=We.changeIndex;function he(Y){return Y?W():j({overlay:!de})}function xe(){j({x:-(innerWidth+wg)*Me,lastCX:void 0,lastCY:void 0,pause:!0}),ke.current=Me}function re(Y,mt,xt,Dt){Y==="x"?function(Ne){if(B!==void 0){var Ge=Ne-B,Pt=Ge;!ze&&(Me===0&&Ge>0||Me===ye-1&&Ge<0)&&(Pt=Ge/2),j({touched:!0,lastCX:B,x:-(innerWidth+wg)*ke.current+Pt,pause:!1})}else j({touched:!0,lastCX:Ne,x:F,pause:!1})}(mt):Y==="y"&&function(Ne,Ge){if(V!==void 0){var Pt=u===null?null:rP(u,.01,u-Math.abs(Ne-V)/100/4);j({touched:!0,lastCY:V,bg:Ge===1?Pt:u,minimal:Ge===1})}else j({touched:!0,lastCY:Ne,bg:we,minimal:!0})}(xt,Dt)}function Re(Y,mt){var xt=Y-(B??Y),Dt=mt-(V??mt),Ne=!1;if(xt<-40)ne(Me+1);else if(xt>40)ne(Me-1);else{var Ge=-(innerWidth+wg)*ke.current;Math.abs(Dt)>100&&Z&&f&&(Ne=!0,W()),j({touched:!1,x:Ge,lastCX:void 0,lastCY:void 0,bg:u,overlay:!!Ne||de})}}qg("keydown",function(Y){if(N)switch(Y.key){case"ArrowLeft":ne(Me-1,!0);break;case"ArrowRight":ne(Me+1,!0);break;case"Escape":W()}});var nt=function(Y,mt,xt){return m.useMemo(function(){var Dt=Y.length;return xt?Y.concat(Y).concat(Y).slice(Dt+mt-1,Dt+mt+2):Y.slice(Math.max(mt-1,0),Math.min(mt+2,Dt+1))},[Y,mt,xt])}(E,Me,ze);if(!Ve)return null;var Ke=de&&!ut,tn=N?we:Oe,Gt=be&&je&&{images:E,index:Me,visible:N,onClose:W,onIndexChange:ne,overlayVisible:Ke,overlay:$e&&$e.overlay,scale:J,rotate:fe,onScale:be,onRotate:je},At=r?r(ut):400,St=i?i(ut):$F,ve=r?r(3):600,Ue=i?i(3):$F;return Cn.createElement(JTe,{className:"PhotoView-Portal"+(Ke?"":" PhotoView-Slider__clean")+(N?"":" PhotoView-Slider__willClose")+(O?" "+O:""),role:"dialog",onClick:function(Y){return Y.stopPropagation()},container:$},N&&Cn.createElement(r2e,null),Cn.createElement("div",{className:"PhotoView-Slider__Backdrop"+(y?" "+y:"")+(ut===1?" PhotoView-Slider__fadeIn":ut===2?" PhotoView-Slider__fadeOut":""),style:{background:tn?"rgba(0, 0, 0, "+tn+")":void 0,transitionTimingFunction:St,transitionDuration:(q?0:At)+"ms",animationDuration:At+"ms"},onAnimationEnd:Tt}),p&&Cn.createElement("div",{className:"PhotoView-Slider__BannerWrap"},Cn.createElement("div",{className:"PhotoView-Slider__Counter"},Me+1," / ",ye),Cn.createElement("div",{className:"PhotoView-Slider__BannerRight"},g&&Gt&&g(Gt),Cn.createElement(e2e,{className:"PhotoView-Slider__toolbarIcon",onClick:W}))),nt.map(function(Y,mt){var xt=ze||Me!==0?ke.current-1+mt:Me+mt;return Cn.createElement(d2e,{key:ze?Y.key+"/"+Y.src+"/"+xt:Y.key,item:Y,speed:At,easing:St,visible:N,onReachMove:re,onReachUp:Re,onPhotoTap:function(){return he(s)},onMaskTap:function(){return he(l)},wrapClassName:x,className:v,style:{left:(innerWidth+wg)*xt+"px",transform:"translate3d("+F+"px, 0px, 0)",transition:q||z?void 0:"transform "+ve+"ms "+Ue},loadingElement:w,brokenElement:S,onPhotoResize:xe,isActive:ke.current===xt,expose:j})}),!sd&&p&&Cn.createElement(Cn.Fragment,null,(ze||Me!==0)&&Cn.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:function(){return ne(Me-1,!0)}},Cn.createElement(t2e,null)),(ze||Me+1-1){var y=u.slice();return y.splice(O,1,g),void l({images:y})}l(function(v){return{images:v.images.concat(g)}})},remove:function(g){l(function(O){var y=O.images.filter(function(v){return v.key!==g});return{images:y,index:Math.min(y.length-1,f)}})},show:function(g){var O=u.findIndex(function(y){return y.key===g});l({visible:!0,index:O}),r&&r(!0,O,a)}}),p=lm({close:function(){l({visible:!1}),r&&r(!1,f,a)},changeIndex:function(g){l({index:g}),n&&n(g,a)}}),b=m.useMemo(function(){return Ns({},a,h)},[a,h]);return Cn.createElement(mne.Provider,{value:b},t,Cn.createElement(f2e,Ns({images:u,visible:d,index:f,onIndexChange:p.changeIndex,onClose:p.close},i)))}var bne=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=m.useContext(mne),h=(t=function(){return f.nextId()},(n=m.useRef({sign:!1,fn:void 0}).current).sign||(n.sign=!0,n.fn=t()),n.fn),p=m.useRef(null);m.useImperativeHandle(d==null?void 0:d.ref,function(){return p.current}),m.useEffect(function(){return function(){f.remove(h)}},[]);var b=lm({render:function(O){return i&&i(O)},show:function(O,y){f.show(h),function(v,x){if(d){var w=d.props[v];w&&w(x)}}(O,y)}}),g=m.useMemo(function(){var O={};return u.forEach(function(y){O[y]=b.show.bind(null,y)}),O},[]);return m.useEffect(function(){f.update({key:h,src:r,originRef:p,render:b.render,overlay:s,width:a,height:l})},[r]),d?m.Children.only(m.cloneElement(d,Ns({},g,{ref:p}))):null};const g2e=e=>o.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:[o.jsx("path",{d:"M11 7.5C11 8.32843 10.3284 9 9.5 9C8.67157 9 8 8.32843 8 7.5C8 6.67157 8.67157 6 9.5 6C10.3284 6 11 6.67157 11 7.5Z",fill:"currentColor"}),o.jsx("path",{d:"M14.5 9C15.3284 9 16 8.32843 16 7.5C16 6.67157 15.3284 6 14.5 6C13.6716 6 13 6.67157 13 7.5C13 8.32843 13.6716 9 14.5 9Z",fill:"currentColor"}),o.jsx("path",{d:"M12 1C12.5523 1 13 1.44772 13 2V2.5L15.8708 2.5C16.3832 2.49998 16.8252 2.49997 17.1896 2.52892C17.574 2.55947 17.9568 2.62688 18.3269 2.80938C18.9192 3.10147 19.3985 3.58084 19.6906 4.17313C19.8731 4.54322 19.9405 4.92598 19.9711 5.31042C20 5.6748 20 6.1168 20 6.62913V6.70824C20 7.76163 20 8.61129 19.9453 9.29994C19.889 10.0088 19.77 10.6322 19.4844 11.2114C18.9976 12.1986 18.1986 12.9975 17.2114 13.4844C16.6322 13.77 16.0088 13.889 15.2999 13.9453C14.6113 14 13.7616 14 12.7082 14H11.2918C10.2384 14 9.38872 14 8.70006 13.9453C7.99117 13.889 7.36777 13.77 6.78856 13.4844C5.8014 12.9976 5.00246 12.1986 4.51564 11.2114C4.23001 10.6322 4.11104 10.0088 4.05471 9.29995C3.99999 8.61131 3.99999 7.76169 4 6.70834V6.62922C3.99998 6.11688 3.99997 5.67481 4.02893 5.31042C4.05948 4.92598 4.12688 4.54322 4.30938 4.17313C4.60147 3.58084 5.08084 3.10147 5.67313 2.80938C6.04322 2.62688 6.42598 2.55947 6.81042 2.52892C7.17482 2.49997 7.61685 2.49998 8.12922 2.5L11 2.5V2C11 1.44772 11.4477 1 12 1ZM6.96885 4.52264C6.7044 4.54365 6.60587 4.57938 6.55771 4.60313C6.36028 4.70049 6.20049 4.86028 6.10313 5.05771C6.07938 5.10587 6.04366 5.2044 6.02264 5.46885C6.00074 5.7445 6 6.10631 6 6.66667C6 7.77136 6.00074 8.54142 6.04843 9.14152C6.09522 9.73042 6.18251 10.0696 6.30939 10.3269C6.60148 10.9192 7.08084 11.3985 7.67314 11.6906C7.93042 11.8175 8.26959 11.9048 8.85849 11.9516C9.45858 11.9993 10.2286 12 11.3333 12H12.6667C13.7714 12 14.5414 11.9993 15.1415 11.9516C15.7304 11.9048 16.0696 11.8175 16.3269 11.6906C16.9192 11.3985 17.3985 10.9192 17.6906 10.3269C17.8175 10.0696 17.9048 9.73042 17.9516 9.14152C17.9993 8.54142 18 7.77136 18 6.66667C18 6.1063 17.9993 5.7445 17.9774 5.46885C17.9563 5.20439 17.9206 5.10587 17.8969 5.05771C17.7995 4.86028 17.6397 4.70049 17.4423 4.60313C17.3941 4.57938 17.2956 4.54365 17.0312 4.52264C16.7555 4.50074 16.3937 4.5 15.8333 4.5H8.16667C7.60631 4.5 7.2445 4.50074 6.96885 4.52264Z",fill:"currentColor"}),o.jsx("path",{d:"M6 21C6 20.0261 6.55099 19.05 7.63152 18.2782C8.71012 17.5078 10.2515 17 12 17C13.7486 17 15.2899 17.5078 16.3685 18.2782C17.449 19.05 18 20.0261 18 21C18 21.5523 18.4477 22 19 22C19.5523 22 20 21.5523 20 21C20 19.2125 18.984 17.6886 17.531 16.6507C16.0761 15.6115 14.1174 15 12.0001 15C9.88267 15 7.92397 15.6115 6.46905 16.6507C5.01605 17.6886 4 19.2125 4 21C4 21.5523 4.44772 22 5 22C5.55229 22 6 21.5523 6 21Z",fill:"currentColor"})]}),b2e=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"})}),O2e=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"})}),One=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"})}),W4=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"})}),y2e=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"})}),x2e=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"})}),e2=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"})}),v2e=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"})}),yne=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"})}),xne=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"})}),w2e=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"})}),Z4=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"})}),S2e=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"})}),E2e=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"})}),k2e=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M5.91456 7.59106C4.34202 9.04124 3.28878 10.7415 2.77064 11.6971C2.66597 11.8902 2.66597 12.1098 2.77064 12.3029C3.28878 13.2585 4.34202 14.9588 5.91456 16.4089C7.48207 17.8545 9.50584 19 12.0001 19C14.4944 19 16.5182 17.8545 18.0857 16.4089C19.6582 14.9588 20.7114 13.2585 21.2296 12.3029C21.3343 12.1098 21.3343 11.8902 21.2296 11.6971C20.7114 10.7415 19.6582 9.04124 18.0857 7.59105C16.5182 6.1455 14.4944 5 12.0001 5C9.50584 5 7.48207 6.1455 5.91456 7.59106ZM4.5587 6.1208C6.36071 4.45899 8.84593 3 12.0001 3C15.1543 3 17.6395 4.45899 19.4415 6.1208C21.2385 7.77798 22.4153 9.68799 22.9878 10.7438C23.4149 11.5315 23.4149 12.4685 22.9878 13.2562C22.4153 14.312 21.2385 16.222 19.4415 17.8792C17.6395 19.541 15.1543 21 12.0001 21C8.84593 21 6.36071 19.541 4.5587 17.8792C2.76171 16.222 1.5849 14.312 1.01244 13.2562C0.585372 12.4685 0.585371 11.5315 1.01244 10.7438C1.5849 9.688 2.76171 7.77798 4.5587 6.1208ZM12.0001 9.5C10.6194 9.5 9.50011 10.6193 9.50011 12C9.50011 13.3807 10.6194 14.5 12.0001 14.5C13.3808 14.5 14.5001 13.3807 14.5001 12C14.5001 10.6193 13.3808 9.5 12.0001 9.5ZM7.50011 12C7.50011 9.51472 9.51483 7.5 12.0001 7.5C14.4854 7.5 16.5001 9.51472 16.5001 12C16.5001 14.4853 14.4854 16.5 12.0001 16.5C9.51483 16.5 7.50011 14.4853 7.50011 12Z",fill:"currentColor"})}),vne=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"})]}),T2e=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"})}),wne=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"})]}),t2=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"})]}),UF=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"})}),_2e=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"})}),A2e=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"})}),C2e=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"})}),N2e=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"})}),Bj=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"})}),Sne=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"})]}),K4=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(Awe,{isPresent:t,childRef:r,sizeRef:i,children:m.cloneElement(e,{ref:r})})}const Nwe=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:s,mode:a})=>{const l=rA(jwe),c=m.useId(),u=m.useCallback(f=>{l.set(f,!0);for(const h of l.values())if(!h)return;r&&r()},[l,r]),d=m.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 m.useMemo(()=>{l.forEach((f,h)=>l.set(h,!1))},[n]),m.useEffect(()=>{!n&&!l.size&&r&&r()},[n]),a==="popLayout"&&(e=o.jsx(Cwe,{isPresent:n,children:e})),o.jsx(iA.Provider,{value:d,children:e})};function jwe(){return new Map}function Fee(e=!0){const t=m.useContext(iA);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:i}=t,s=m.useId();m.useEffect(()=>{e&&i(s)},[e]);const a=m.useCallback(()=>e&&r&&r(s),[s,r,e]);return!n&&r?[!1,a]:[!0]}const IS=e=>e.key||"";function kQ(e){const t=[];return m.Children.forEach(e,n=>{m.isValidElement(n)&&t.push(n)}),t}const x4=typeof window<"u",Uee=x4?m.useLayoutEffect:m.useEffect,Oh=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:s="sync",propagate:a=!1})=>{const[l,c]=Fee(a),u=m.useMemo(()=>kQ(e),[e]),d=a&&!l?[]:u.map(IS),f=m.useRef(!0),h=m.useRef(u),p=rA(()=>new Map),[b,g]=m.useState(u),[O,y]=m.useState(u);Uee(()=>{f.current=!1,h.current=u;for(let w=0;w{const S=IS(w),E=a&&!l?!1:u===O||d.includes(S),k=()=>{if(p.has(S))p.set(S,!0);else return;let T=!0;p.forEach(C=>{C||(T=!1)}),T&&(x==null||x(),y(h.current),a&&(c==null||c()),r&&r())};return o.jsx(Nwe,{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)})})},nl=e=>e;let zee=nl;const Rwe={useManualTiming:!1};function Iwe(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 p=f&&r?t:n;return d&&s.add(u),p.has(u)||p.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 DS=["read","resolveKeyframes","update","preRender","render","postRender"],Dwe=40;function Vee(e,t){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>n=!0,a=DS.reduce((y,v)=>(y[v]=Iwe(s),y),{}),{read:l,resolveKeyframes:c,update:u,preRender:d,render:f,postRender:h}=a,p=()=>{const y=performance.now();n=!1,i.delta=r?1e3/60:Math.max(Math.min(y-i.timestamp,Dwe),1),i.timestamp=y,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(p))},b=()=>{n=!0,r=!0,i.isProcessing||e(p)};return{schedule:DS.reduce((y,v)=>{const x=a[v];return y[v]=(w,S=!1,E=!1)=>(n||b(),x.schedule(w,S,E)),y},{}),cancel:y=>{for(let v=0;vTQ[e].some(n=>!!t[n])};function Pwe(e){for(const t in e)wb[t]={...wb[t],...e[t]}}const Mwe=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 XT(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Mwe.has(e)}let Hee=e=>!XT(e);function Xee(e){e&&(Hee=t=>t.startsWith("on")?!XT(t):e(t))}try{Xee(require("@emotion/is-prop-valid").default)}catch{}function Lwe(e,t,n){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||(Hee(i)||n===!0&&XT(i)||!t&&!XT(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}function $we({children:e,isValidProp:t,...n}){t&&Xee(t),n={...m.useContext(Ex),...n},n.isStatic=rA(()=>n.isStatic);const r=m.useMemo(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion]);return o.jsx(Ex.Provider,{value:r,children:e})}function Bwe(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 sA=m.createContext({});function kx(e){return typeof e=="string"||Array.isArray(e)}function aA(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}const v4=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],w4=["initial",...v4];function oA(e){return aA(e.animate)||w4.some(t=>kx(e[t]))}function Gee(e){return!!(oA(e)||e.variants)}function Qwe(e,t){if(oA(e)){const{initial:n,animate:r}=e;return{initial:n===!1||kx(n)?n:void 0,animate:kx(r)?r:void 0}}return e.inherit!==!1?t:{}}function Fwe(e){const{initial:t,animate:n}=Qwe(e,m.useContext(sA));return m.useMemo(()=>({initial:t,animate:n}),[_Q(t),_Q(n)])}function _Q(e){return Array.isArray(e)?e.join(" "):e}const Uwe=Symbol.for("motionComponentSymbol");function m0(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function zwe(e,t,n){return m.useCallback(r=>{r&&e.onMount&&e.onMount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):m0(n)&&(n.current=r))},[t])}const S4=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Vwe="framerAppearId",Yee="data-"+S4(Vwe),{schedule:E4}=Vee(queueMicrotask,!1),Wee=m.createContext({});function qwe(e,t,n,r,i){var s,a;const{visualElement:l}=m.useContext(sA),c=m.useContext(qee),u=m.useContext(iA),d=m.useContext(Ex).reducedMotion,f=m.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,p=m.useContext(Wee);h&&!h.projection&&i&&(h.type==="html"||h.type==="svg")&&Hwe(f.current,n,i,p);const b=m.useRef(!1);m.useInsertionEffect(()=>{h&&b.current&&h.update(n,u)});const g=n[Yee],O=m.useRef(!!g&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,g))&&((a=window.MotionHasOptimisedAnimation)===null||a===void 0?void 0:a.call(window,g)));return Uee(()=>{h&&(b.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),E4.render(h.render),O.current&&h.animationState&&h.animationState.animateChanges())}),m.useEffect(()=>{h&&(!O.current&&h.animationState&&h.animationState.animateChanges(),O.current&&(queueMicrotask(()=>{var y;(y=window.MotionHandoffMarkAsComplete)===null||y===void 0||y.call(window,g)}),O.current=!1))}),h}function Hwe(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:Zee(e.parent)),e.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!a||l&&m0(l),visualElement:e,animationType:typeof s=="string"?s:"both",initialPromotionConfig:r,layoutScroll:c,layoutRoot:u})}function Zee(e){if(e)return e.options.allowProjection!==!1?e.projection:Zee(e.parent)}function Xwe({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:i}){var s,a;e&&Pwe(e);function l(u,d){let f;const h={...m.useContext(Ex),...u,layoutId:Gwe(u)},{isStatic:p}=h,b=Fwe(u),g=r(u,p);if(!p&&x4){Ywe();const O=Wwe(h);f=O.MeasureLayout,b.visualElement=qwe(i,g,h,t,O.ProjectionNode)}return o.jsxs(sA.Provider,{value:b,children:[f&&b.visualElement?o.jsx(f,{visualElement:b.visualElement,...h}):null,n(i,u,zwe(g,b.visualElement,d),g,p,b.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=m.forwardRef(l);return c[Uwe]=i,c}function Gwe({layoutId:e}){const t=m.useContext(y4).id;return t&&e!==void 0?t+"-"+e:e}function Ywe(e,t){m.useContext(qee).strict}function Wwe(e){const{drag:t,layout:n}=wb;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 Zwe=["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 k4(e){return typeof e!="string"||e.includes("-")?!1:!!(Zwe.indexOf(e)>-1||/[A-Z]/u.test(e))}function AQ(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function T4(e,t,n,r){if(typeof t=="function"){const[i,s]=AQ(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]=AQ(r);t=t(n!==void 0?n:e.custom,i,s)}return t}const VP=e=>Array.isArray(e),Kwe=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),Jwe=e=>VP(e)?e[e.length-1]||0:e,Ta=e=>!!(e&&e.getVelocity);function wk(e){const t=Ta(e)?e.get():e;return Kwe(t)?t.toValue():t}function eSe({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},r,i,s){const a={latestValues:tSe(r,i,s,e),renderState:t()};return n&&(a.onMount=l=>n({props:r,current:l,...a}),a.onUpdate=l=>n(l)),a}const Kee=e=>(t,n)=>{const r=m.useContext(sA),i=m.useContext(iA),s=()=>eSe(e,t,r,i);return n?s():rA(s)};function tSe(e,t,n,r){const i={},s=r(e,{});for(const h in s)i[h]=wk(s[h]);let{initial:a,animate:l}=e;const c=oA(e),u=Gee(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"&&!aA(f)){const h=Array.isArray(f)?f:[f];for(let p=0;pt=>typeof t=="string"&&t.startsWith(e),ete=Jee("--"),nSe=Jee("var(--"),_4=e=>nSe(e)?rSe.test(e.split("/*")[0].trim()):!1,rSe=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,tte=(e,t)=>t&&typeof e=="number"?t.transform(e):e,qd=(e,t,n)=>n>t?t:ntypeof e=="number",parse:parseFloat,transform:e=>e},Tx={...dO,transform:e=>qd(0,1,e)},PS={...dO,default:1},Gv=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Pf=Gv("deg"),xu=Gv("%"),nn=Gv("px"),iSe=Gv("vh"),sSe=Gv("vw"),CQ={...xu,parse:e=>xu.parse(e)/100,transform:e=>xu.transform(e*100)},aSe={borderWidth:nn,borderTopWidth:nn,borderRightWidth:nn,borderBottomWidth:nn,borderLeftWidth:nn,borderRadius:nn,radius:nn,borderTopLeftRadius:nn,borderTopRightRadius:nn,borderBottomRightRadius:nn,borderBottomLeftRadius:nn,width:nn,maxWidth:nn,height:nn,maxHeight:nn,top:nn,right:nn,bottom:nn,left:nn,padding:nn,paddingTop:nn,paddingRight:nn,paddingBottom:nn,paddingLeft:nn,margin:nn,marginTop:nn,marginRight:nn,marginBottom:nn,marginLeft:nn,backgroundPositionX:nn,backgroundPositionY:nn},oSe={rotate:Pf,rotateX:Pf,rotateY:Pf,rotateZ:Pf,scale:PS,scaleX:PS,scaleY:PS,scaleZ:PS,skew:Pf,skewX:Pf,skewY:Pf,distance:nn,translateX:nn,translateY:nn,translateZ:nn,x:nn,y:nn,z:nn,perspective:nn,transformPerspective:nn,opacity:Tx,originX:CQ,originY:CQ,originZ:nn},NQ={...dO,transform:Math.round},A4={...aSe,...oSe,zIndex:NQ,size:nn,fillOpacity:Tx,strokeOpacity:Tx,numOctaves:NQ},lSe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},cSe=uO.length;function uSe(e,t,n){let r="",i=!0;for(let s=0;s({style:{},transform:{},transformOrigin:{},vars:{}}),nte=()=>({...j4(),attrs:{}}),R4=e=>typeof e=="string"&&e.toLowerCase()==="svg";function rte(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 ite=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 ste(e,t,n,r){rte(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(ite.has(i)?i:S4(i),t.attrs[i])}const GT={};function mSe(e){Object.assign(GT,e)}function ate(e,{layout:t,layoutId:n}){return Hm.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!GT[e]||e==="opacity")}function I4(e,t,n){var r;const{style:i}=e,s={};for(const a in i)(Ta(i[a])||t.style&&Ta(t.style[a])||ate(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 ote(e,t,n){const r=I4(e,t,n);for(const i in e)if(Ta(e[i])||Ta(t[i])){const s=uO.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[s]=e[i]}return r}function gSe(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 RQ=["x","y","width","height","cx","cy","r"],bSe={useVisualState:Kee({scrapeMotionValuesFromProps:ote,createRenderState:nte,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(Hm.has(l)){s=!0;break}}if(!s)return;let a=!t;if(t)for(let l=0;l{gSe(n,r),Oi.render(()=>{N4(r,i,R4(n.tagName),e.transformTemplate),ste(n,r)})})}})},OSe={useVisualState:Kee({scrapeMotionValuesFromProps:I4,createRenderState:j4})};function lte(e,t,n){for(const r in t)!Ta(t[r])&&!ate(r,n)&&(e[r]=t[r])}function ySe({transformTemplate:e},t){return m.useMemo(()=>{const n=j4();return C4(n,t,e),Object.assign({},n.vars,n.style)},[t])}function xSe(e,t){const n=e.style||{},r={};return lte(r,n,e),Object.assign(r,ySe(e,t)),r}function vSe(e,t){const n={},r=xSe(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 wSe(e,t,n,r){const i=m.useMemo(()=>{const s=nte();return N4(s,t,R4(r),e.transformTemplate),{...s.attrs,style:{...s.style}}},[t]);if(e.style){const s={};lte(s,e.style,e),i.style={...s,...i.style}}return i}function SSe(e=!1){return(n,r,i,{latestValues:s},a)=>{const c=(k4(n)?wSe:vSe)(r,s,a,n),u=Lwe(r,typeof n=="string",e),d=n!==m.Fragment?{...u,...c,ref:i}:{},{children:f}=r,h=m.useMemo(()=>Ta(f)?f.get():f,[f]);return m.createElement(n,{...d,children:h})}}function ESe(e,t){return function(r,{forwardMotionProps:i}={forwardMotionProps:!1}){const a={...k4(r)?bSe:OSe,preloadedFeatures:e,useRender:SSe(i),createVisualElement:t,Component:r};return Xwe(a)}}function cte(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r(Sk===void 0&&vu.set(sa.isProcessing||Rwe.useManualTiming?sa.timestamp:performance.now()),Sk),set:e=>{Sk=e,queueMicrotask(kSe)}};function P4(e,t){e.indexOf(t)===-1&&e.push(t)}function M4(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class L4{constructor(){this.subscriptions=[]}add(t){return P4(this.subscriptions,t),()=>M4(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 _Se{constructor(t,n={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,i=!0)=>{const s=vu.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=vu.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=TSe(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 L4);const r=this.events[t].add(n);return t==="change"?()=>{r(),Oi.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=vu.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>IQ)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,IQ);return dte(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 _x(e,t){return new _Se(e,t)}function ASe(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,_x(n))}function CSe(e,t){const n=lA(e,t);let{transitionEnd:r={},transition:i={},...s}=n||{};s={...s,...r};for(const a in s){const l=Jwe(s[a]);ASe(e,a,l)}}function NSe(e){return!!(Ta(e)&&e.add)}function qP(e,t){const n=e.getValue("willChange");if(NSe(n))return n.add(t)}function fte(e){return e.props[Yee]}function $4(e){let t;return()=>(t===void 0&&(t=e()),t)}const jSe=$4(()=>window.ScrollTimeline!==void 0);class RSe{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(jSe()&&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 ISe extends RSe{then(t,n){return Promise.all(this.animations).then(t).catch(n)}}const Nd=e=>e*1e3,jd=e=>e/1e3;function B4(e){return typeof e=="function"}function DQ(e,t){e.timeline=t,e.onfinish=null}const Q4=e=>Array.isArray(e)&&typeof e[0]=="number",DSe={linearEasing:void 0};function PSe(e,t){const n=$4(e);return()=>{var r;return(r=DSe[t])!==null&&r!==void 0?r:n()}}const YT=PSe(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Sb=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},hte=(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})`,HP={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Wy([0,.65,.55,1]),circOut:Wy([.55,0,1,.45]),backIn:Wy([.31,.01,.66,-.59]),backOut:Wy([.33,1.53,.69,.99])};function mte(e,t){if(e)return typeof e=="function"&&YT()?hte(e,t):Q4(e)?Wy(e):Array.isArray(e)?e.map(n=>mte(n,t)||HP.easeOut):HP[e]}const gte=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,MSe=1e-7,LSe=12;function $Se(e,t,n,r,i){let s,a,l=0;do a=t+(n-t)/2,s=gte(a,r,i)-e,s>0?n=a:t=a;while(Math.abs(s)>MSe&&++l$Se(s,0,1,e,n);return s=>s===0||s===1?s:gte(i(s),t,r)}const bte=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Ote=e=>t=>1-e(1-t),yte=Yv(.33,1.53,.69,.99),F4=Ote(yte),xte=bte(F4),vte=e=>(e*=2)<1?.5*F4(e):.5*(2-Math.pow(2,-10*(e-1))),U4=e=>1-Math.sin(Math.acos(e)),wte=Ote(U4),Ste=bte(U4),Ete=e=>/^0[^.\s]+$/u.test(e);function BSe(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||Ete(e):!0}const C1=e=>Math.round(e*1e5)/1e5,z4=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function QSe(e){return e==null}const FSe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,V4=(e,t)=>n=>!!(typeof n=="string"&&FSe.test(n)&&n.startsWith(e)||t&&!QSe(n)&&Object.prototype.hasOwnProperty.call(n,t)),kte=(e,t,n)=>r=>{if(typeof r!="string")return r;const[i,s,a,l]=r.match(z4);return{[e]:parseFloat(i),[t]:parseFloat(s),[n]:parseFloat(a),alpha:l!==void 0?parseFloat(l):1}},USe=e=>qd(0,255,e),_j={...dO,transform:e=>Math.round(USe(e))},Xp={test:V4("rgb","red"),parse:kte("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+_j.transform(e)+", "+_j.transform(t)+", "+_j.transform(n)+", "+C1(Tx.transform(r))+")"};function zSe(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 XP={test:V4("#"),parse:zSe,transform:Xp.transform},g0={test:V4("hsl","hue"),parse:kte("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+xu.transform(C1(t))+", "+xu.transform(C1(n))+", "+C1(Tx.transform(r))+")"},Sa={test:e=>Xp.test(e)||XP.test(e)||g0.test(e),parse:e=>Xp.test(e)?Xp.parse(e):g0.test(e)?g0.parse(e):XP.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Xp.transform(e):g0.transform(e)},VSe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function qSe(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(z4))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(VSe))===null||n===void 0?void 0:n.length)||0)>0}const Tte="number",_te="color",HSe="var",XSe="var(",PQ="${}",GSe=/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 Ax(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[];let s=0;const l=t.replace(GSe,c=>(Sa.test(c)?(r.color.push(s),i.push(_te),n.push(Sa.parse(c))):c.startsWith(XSe)?(r.var.push(s),i.push(HSe),n.push(c)):(r.number.push(s),i.push(Tte),n.push(parseFloat(c))),++s,PQ)).split(PQ);return{values:n,split:l,indexes:r,types:i}}function Ate(e){return Ax(e).values}function Cte(e){const{split:t,types:n}=Ax(e),r=t.length;return i=>{let s="";for(let a=0;atypeof e=="number"?0:e;function WSe(e){const t=Ate(e);return Cte(e)(t.map(YSe))}const jh={test:qSe,parse:Ate,createTransformer:Cte,getAnimatableNone:WSe},ZSe=new Set(["brightness","contrast","saturate","opacity"]);function KSe(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(z4)||[];if(!r)return e;const i=n.replace(r,"");let s=ZSe.has(t)?1:0;return r!==n&&(s*=100),t+"("+s+i+")"}const JSe=/\b([a-z-]*)\(.*?\)/gu,GP={...jh,getAnimatableNone:e=>{const t=e.match(JSe);return t?t.map(KSe).join(" "):e}},eEe={...A4,color:Sa,backgroundColor:Sa,outlineColor:Sa,fill:Sa,stroke:Sa,borderColor:Sa,borderTopColor:Sa,borderRightColor:Sa,borderBottomColor:Sa,borderLeftColor:Sa,filter:GP,WebkitFilter:GP},q4=e=>eEe[e];function Nte(e,t){let n=q4(e);return n!==GP&&(n=jh),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const tEe=new Set(["auto","none","0"]);function nEe(e,t,n){let r=0,i;for(;re===dO||e===nn,LQ=(e,t)=>parseFloat(e.split(", ")[t]),$Q=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/u);if(i)return LQ(i[1],t);{const s=r.match(/^matrix\((.+)\)$/u);return s?LQ(s[1],e):0}},rEe=new Set(["x","y","z"]),iEe=uO.filter(e=>!rEe.has(e));function sEe(e){const t=[];return iEe.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const Eb={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:$Q(4,13),y:$Q(5,14)};Eb.translateX=Eb.x;Eb.translateY=Eb.y;const lm=new Set;let YP=!1,WP=!1;function jte(){if(WP){const e=Array.from(lm).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const i=sEe(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)})}WP=!1,YP=!1,lm.forEach(e=>e.complete()),lm.clear()}function Rte(){lm.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(WP=!0)})}function aEe(){Rte(),jte()}class H4{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?(lm.add(this),YP||(YP=!0,Oi.read(Rte),Oi.resolveKeyframes(jte))):(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),oEe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function lEe(e){const t=oEe.exec(e);if(!t)return[,];const[,n,r,i]=t;return[`--${n??r}`,i]}function Dte(e,t,n=1){const[r,i]=lEe(e);if(!r)return;const s=window.getComputedStyle(t).getPropertyValue(r);if(s){const a=s.trim();return Ite(a)?parseFloat(a):a}return _4(i)?Dte(i,t,n+1):i}const Pte=e=>t=>t.test(e),cEe={test:e=>e==="auto",parse:e=>e},Mte=[dO,nn,xu,Pf,sSe,iSe,cEe],BQ=e=>Mte.find(Pte(e));class Lte extends H4{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 QQ=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(jh.test(e)||e==="0")&&!e.startsWith("url("));function uEe(e){const t=e[0];if(e.length===1)return!0;for(let n=0;ne!==null;function cA(e,{repeat:t,repeatType:n="loop"},r){const i=e.filter(fEe),s=t&&n!=="loop"&&t%2===1?0:i.length-1;return!s||r===void 0?i[s]:r}const hEe=40;class $te{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=vu.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>hEe?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&aEe(),this._resolved}onKeyframesResolved(t,n){this.resolvedAt=vu.now(),this.hasAttemptedResolve=!0;const{name:r,type:i,velocity:s,delay:a,onComplete:l,onUpdate:c,isGenerator:u}=this.options;if(!u&&!dEe(t,r,i,s))if(a)this.options.duration=0;else{c&&c(cA(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 ZP=2e4;function Bte(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=ZP?1/0:t}const Bi=(e,t,n)=>e+(t-e)*n;function Aj(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 pEe({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=Aj(c,l,e+1/3),s=Aj(c,l,e),a=Aj(c,l,e-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(a*255),alpha:r}}function WT(e,t){return n=>n>0?t:e}const Cj=(e,t,n)=>{const r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},mEe=[XP,Xp,g0],gEe=e=>mEe.find(t=>t.test(e));function FQ(e){const t=gEe(e);if(!t)return!1;let n=t.parse(e);return t===g0&&(n=pEe(n)),n}const UQ=(e,t)=>{const n=FQ(e),r=FQ(t);if(!n||!r)return WT(e,t);const i={...n};return s=>(i.red=Cj(n.red,r.red,s),i.green=Cj(n.green,r.green,s),i.blue=Cj(n.blue,r.blue,s),i.alpha=Bi(n.alpha,r.alpha,s),Xp.transform(i))},bEe=(e,t)=>n=>t(e(n)),Wv=(...e)=>e.reduce(bEe),KP=new Set(["none","hidden"]);function OEe(e,t){return KP.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function yEe(e,t){return n=>Bi(e,t,n)}function X4(e){return typeof e=="number"?yEe:typeof e=="string"?_4(e)?WT:Sa.test(e)?UQ:wEe:Array.isArray(e)?Qte:typeof e=="object"?Sa.test(e)?UQ:xEe:WT}function Qte(e,t){const n=[...e],r=n.length,i=e.map((s,a)=>X4(s)(s,t[a]));return s=>{for(let a=0;a{for(const s in r)n[s]=r[s](i);return n}}function vEe(e,t){var n;const r=[],i={color:0,var:0,number:0};for(let s=0;s{const n=jh.createTransformer(t),r=Ax(e),i=Ax(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?KP.has(e)&&!i.values.length||KP.has(t)&&!r.values.length?OEe(e,t):Wv(Qte(vEe(r,i),i.values),n):WT(e,t)};function Fte(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?Bi(e,t,n):X4(e)(e,t)}const SEe=5;function Ute(e,t,n){const r=Math.max(t-SEe,0);return dte(n-e(r),t-r)}const Gi={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},Nj=.001;function EEe({duration:e=Gi.duration,bounce:t=Gi.bounce,velocity:n=Gi.velocity,mass:r=Gi.mass}){let i,s,a=1-t;a=qd(Gi.minDamping,Gi.maxDamping,a),e=qd(Gi.minDuration,Gi.maxDuration,jd(e)),a<1?(i=u=>{const d=u*a,f=d*e,h=d-n,p=JP(u,a),b=Math.exp(-f);return Nj-h/p*b},s=u=>{const f=u*a*e,h=f*n+n,p=Math.pow(a,2)*Math.pow(u,2)*e,b=Math.exp(-f),g=JP(Math.pow(u,2),a);return(-i(u)+Nj>0?-1:1)*((h-p)*b)/g}):(i=u=>{const d=Math.exp(-u*e),f=(u-n)*e+1;return-Nj+d*f},s=u=>{const d=Math.exp(-u*e),f=(n-u)*(e*e);return d*f});const l=5/e,c=TEe(i,s,l);if(e=Nd(e),isNaN(c))return{stiffness:Gi.stiffness,damping:Gi.damping,duration:e};{const u=Math.pow(c,2)*r;return{stiffness:u,damping:a*2*Math.sqrt(r*u),duration:e}}}const kEe=12;function TEe(e,t,n){let r=n;for(let i=1;ie[n]!==void 0)}function CEe(e){let t={velocity:Gi.velocity,stiffness:Gi.stiffness,damping:Gi.damping,mass:Gi.mass,isResolvedFromDuration:!1,...e};if(!zQ(e,AEe)&&zQ(e,_Ee))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,s=2*qd(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:Gi.mass,stiffness:i,damping:s}}else{const n=EEe(e);t={...t,...n,mass:Gi.mass},t.isResolvedFromDuration=!0}return t}function zte(e=Gi.visualDuration,t=Gi.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:p}=CEe({...n,velocity:-jd(n.velocity||0)}),b=h||0,g=u/(2*Math.sqrt(c*d)),O=a-s,y=jd(Math.sqrt(c/d)),v=Math.abs(O)<5;r||(r=v?Gi.restSpeed.granular:Gi.restSpeed.default),i||(i=v?Gi.restDelta.granular:Gi.restDelta.default);let x;if(g<1){const S=JP(y,g);x=E=>{const k=Math.exp(-g*y*E);return a-k*((b+g*y*O)/S*Math.sin(S*E)+O*Math.cos(S*E))}}else if(g===1)x=S=>a-Math.exp(-y*S)*(O+(b+y*O)*S);else{const S=y*Math.sqrt(g*g-1);x=E=>{const k=Math.exp(-g*y*E),T=Math.min(S*E,300);return a-k*((b+g*y*O)*Math.sinh(T)+S*O*Math.cosh(T))/S}}const w={calculatedDuration:p&&f||null,next:S=>{const E=x(S);if(p)l.done=S>=f;else{let k=0;g<1&&(k=S===0?Nd(b):Ute(x,S,E));const T=Math.abs(k)<=r,C=Math.abs(a-E)<=i;l.done=T&&C}return l.value=l.done?a:E,l},toString:()=>{const S=Math.min(Bte(w),ZP),E=hte(k=>w.next(S*k).value,S,30);return S+"ms "+E}};return w}function VQ({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},p=T=>l!==void 0&&Tc,b=T=>l===void 0?c:c===void 0||Math.abs(l-T)-g*Math.exp(-T/r),x=T=>y+v(T),w=T=>{const C=v(T),N=x(T);h.done=Math.abs(C)<=u,h.value=h.done?y:N};let S,E;const k=T=>{p(h.value)&&(S=T,E=zte({keyframes:[h.value,b(h.value)],velocity:Ute(x,T,h.value),damping:i,stiffness:s,restDelta:u,restSpeed:d}))};return k(0),{calculatedDuration:null,next:T=>{let C=!1;return!E&&S===void 0&&(C=!0,w(T),k(T)),S!==void 0&&T>=S?E.next(T-S):(!C&&w(T),h)}}}const NEe=Yv(.42,0,1,1),jEe=Yv(0,0,.58,1),Vte=Yv(.42,0,.58,1),REe=e=>Array.isArray(e)&&typeof e[0]!="number",IEe={linear:nl,easeIn:NEe,easeInOut:Vte,easeOut:jEe,circIn:U4,circInOut:Ste,circOut:wte,backIn:F4,backInOut:xte,backOut:yte,anticipate:vte},qQ=e=>{if(Q4(e)){zee(e.length===4);const[t,n,r,i]=e;return Yv(t,n,r,i)}else if(typeof e=="string")return IEe[e];return e};function DEe(e,t,n){const r=[],i=n||Fte,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=DEe(t,r,i),c=l.length,u=d=>{if(a&&d1)for(;fu(qd(e[0],e[s-1],d)):u}function MEe(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=Sb(0,t,r);e.push(Bi(n,1,i))}}function LEe(e){const t=[0];return MEe(t,e.length-1),t}function $Ee(e,t){return e.map(n=>n*t)}function BEe(e,t){return e.map(()=>t||Vte).splice(0,e.length-1)}function ZT({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=REe(r)?r.map(qQ):qQ(r),s={done:!1,value:t[0]},a=$Ee(n&&n.length===t.length?n:LEe(t),e),l=PEe(a,t,{ease:Array.isArray(i)?i:BEe(t,i)});return{calculatedDuration:e,next:c=>(s.value=l(c),s.done=c>=e,s)}}const QEe=e=>{const t=({timestamp:n})=>e(n);return{start:()=>Oi.update(t,!0),stop:()=>Nh(t),now:()=>sa.isProcessing?sa.timestamp:vu.now()}},FEe={decay:VQ,inertia:VQ,tween:ZT,keyframes:ZT,spring:zte},UEe=e=>e/100;class G4 extends $te{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)||H4,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=B4(n)?n:FEe[n]||ZT;let c,u;l!==ZT&&typeof t[0]!="number"&&(c=Wv(UEe,Fte(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=Bte(d));const{calculatedDuration:f}=d,h=f+i,p=h*(r+1)-i;return{generator:d,mirroredGenerator:u,mapPercentToKeyframes:c,calculatedDuration:f,resolvedDuration:h,totalDuration:p}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!t?this.pause():this.state=this.pendingPlayState}tick(t,n=!1){const{resolved:r}=this;if(!r){const{keyframes:T}=this.options;return{done:!0,value:T[T.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:p,repeatType:b,repeatDelay:g,onUpdate:O}=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 y=this.currentTime-h*(this.speed>=0?1:-1),v=this.speed>=0?y<0:y>d;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let x=this.currentTime,w=s;if(p){const T=Math.min(this.currentTime,d)/f;let C=Math.floor(T),N=T%1;!N&&T>=1&&(N=1),N===1&&C--,C=Math.min(C,p+1),!!(C%2)&&(b==="reverse"?(N=1-N,g&&(N-=g/f)):b==="mirror"&&(w=a)),x=qd(0,1,N)*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=cA(c,this.options,i)),O&&O(S.value),k&&this.finish(),S}get duration(){const{resolved:t}=this;return t?jd(t.calculatedDuration):0}get time(){return jd(this.currentTime)}set time(t){t=Nd(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=jd(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:t=QEe,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 zEe=new Set(["opacity","clipPath","filter","transform"]);function VEe(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=mte(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 qEe=$4(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),KT=10,HEe=2e4;function XEe(e){return B4(e.type)||e.type==="spring"||!pte(e.ease)}function GEe(e,t){const n=new G4({...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"&&YT()&&YEe(s)&&(s=qte[s]),XEe(this.options)){const{onComplete:f,onUpdate:h,motionValue:p,element:b,...g}=this.options,O=GEe(t,g);t=O.keyframes,t.length===1&&(t[1]=t[0]),r=O.duration,i=O.times,s=O.ease,a="keyframes"}const d=VEe(l.owner.current,c,t,{...this.options,duration:r,times:i,ease:s});return d.startTime=u??this.calcStartTime(),this.pendingTimeline?(DQ(d,this.pendingTimeline),this.pendingTimeline=void 0):d.onfinish=()=>{const{onComplete:f}=this.options;l.set(cA(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 jd(n)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:n}=t;return jd(n.currentTime||0)}set time(t){const{resolved:n}=this;if(!n)return;const{animation:r}=n;r.currentTime=Nd(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 nl;const{animation:r}=n;DQ(r,t)}return nl}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,...p}=this.options,b=new G4({...p,keyframes:r,duration:i,type:s,ease:a,times:l,isGenerator:!0}),g=Nd(this.time);u.setWithVelocity(b.sample(g-KT).value,b.sample(g).value,KT)}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 qEe()&&r&&zEe.has(r)&&!c&&!u&&!i&&s!=="mirror"&&a!==0&&l!=="inertia"}}const WEe={type:"spring",stiffness:500,damping:25,restSpeed:10},ZEe=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),KEe={type:"keyframes",duration:.8},JEe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},eke=(e,{keyframes:t})=>t.length>2?KEe:Hm.has(e)?e.startsWith("scale")?ZEe(t[1]):WEe:JEe;function tke({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 Y4=(e,t,n,r={},i,s)=>a=>{const l=D4(r,e)||{},c=l.delay||r.delay||0;let{elapsed:u=0}=r;u=u-Nd(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};tke(l)||(d={...d,...eke(e,d)}),d.duration&&(d.duration=Nd(d.duration)),d.repeatDelay&&(d.repeatDelay=Nd(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=cA(d.keyframes,l);if(h!==void 0)return Oi.update(()=>{d.onUpdate(h),d.onComplete()}),new ISe([])}return!s&&HQ.supports(d)?new HQ(d):new G4(d)};function nke({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function Hte(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),p=c[f];if(p===void 0||d&&nke(d,f))continue;const b={delay:n,...D4(a||{},f)};let g=!1;if(window.MotionHandoffAnimation){const y=fte(e);if(y){const v=window.MotionHandoffAnimation(y,f,Oi);v!==null&&(b.startTime=v,g=!0)}}qP(e,f),h.start(Y4(f,h,p,e.shouldReduceMotion&&ute.has(f)?{type:!1}:b,e,g));const O=h.animation;O&&u.push(O)}return l&&Promise.all(u).then(()=>{Oi.update(()=>{l&&CSe(e,l)})}),u}function e5(e,t,n={}){var r;const i=lA(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(Hte(e,i,n)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=s;return rke(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 rke(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(ike).forEach((u,d)=>{u.notify("AnimationStart",t),a.push(e5(u,t,{...s,delay:n+c(d)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function ike(e,t){return e.sortNodePosition(t)}function ske(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(s=>e5(e,s,n));r=Promise.all(i)}else if(typeof t=="string")r=e5(e,t,n);else{const i=typeof t=="function"?lA(e,t,n.custom):t;r=Promise.all(Hte(e,i,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const ake=w4.length;function Xte(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?Xte(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})=>ske(e,n,r)))}function uke(e){let t=cke(e),n=XQ(),r=!0;const i=c=>(u,d)=>{var f;const h=lA(e,d,c==="exit"?(f=e.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(h){const{transition:p,transitionEnd:b,...g}=h;u={...u,...g,...b}}return u};function s(c){t=c(e)}function a(c){const{props:u}=e,d=Xte(e.parent)||{},f=[],h=new Set;let p={},b=1/0;for(let O=0;Ob&&w,C=!1;const N=Array.isArray(x)?x:[x];let _=N.reduce(i(y),{});S===!1&&(_={});const{prevResolvedValues:R={}}=v,$={...R,..._},D=P=>{T=!0,h.has(P)&&(C=!0,h.delete(P)),v.needsAnimating[P]=!0;const L=e.getValue(P);L&&(L.liveStyle=!1)};for(const P in $){const L=_[P],U=R[P];if(p.hasOwnProperty(P))continue;let F=!1;VP(L)&&VP(U)?F=!cte(L,U):F=L!==U,F?L!=null?D(P):h.add(P):L!==void 0&&h.has(P)?D(P):v.protectedKeys[P]=!0}v.prevProp=x,v.prevResolvedValues=_,v.isActive&&(p={...p,..._}),r&&e.blockInitialAnimation&&(T=!1),T&&(!(E&&k)||C)&&f.push(...N.map(P=>({animation:P,options:{type:y}})))}if(h.size){const O={};h.forEach(y=>{const v=e.getBaseTarget(y),x=e.getValue(y);x&&(x.liveStyle=!0),O[y]=v??null}),f.push({animation:O})}let g=!!f.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(g=!1),r=!1,g?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 p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(c,u)}),n[c].isActive=u;const f=a(c);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:a,setActive:l,setAnimateFunction:s,getState:()=>n,reset:()=>{n=XQ(),r=!0}}}function dke(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!cte(t,e):!1}function pp(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function XQ(){return{animate:pp(!0),whileInView:pp(),whileHover:pp(),whileTap:pp(),whileDrag:pp(),whileFocus:pp(),exit:pp()}}class Zh{constructor(t){this.isMounted=!1,this.node=t}update(){}}class fke extends Zh{constructor(t){super(t),t.animationState||(t.animationState=uke(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();aA(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 hke=0;class pke extends Zh{constructor(){super(...arguments),this.id=hke++}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 mke={animation:{Feature:fke},exit:{Feature:pke}},lc={x:!1,y:!1};function Gte(){return lc.x||lc.y}function gke(e){return e==="x"||e==="y"?lc[e]?null:(lc[e]=!0,()=>{lc[e]=!1}):lc.x||lc.y?null:(lc.x=lc.y=!0,()=>{lc.x=lc.y=!1})}const W4=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function Cx(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function Zv(e){return{point:{x:e.pageX,y:e.pageY}}}const bke=e=>t=>W4(t)&&e(t,Zv(t));function N1(e,t,n,r){return Cx(e,t,bke(n),r)}const GQ=(e,t)=>Math.abs(e-t);function Oke(e,t){const n=GQ(e.x,t.x),r=GQ(e.y,t.y);return Math.sqrt(n**2+r**2)}class Yte{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=Rj(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,p=Oke(f.offset,{x:0,y:0})>=3;if(!h&&!p)return;const{point:b}=f,{timestamp:g}=sa;this.history.push({...b,timestamp:g});const{onStart:O,onMove:y}=this.handlers;h||(O&&O(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),y&&y(this.lastMoveEvent,f)},this.handlePointerMove=(f,h)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=jj(h,this.transformPagePoint),Oi.update(this.updatePoint,!0)},this.handlePointerUp=(f,h)=>{this.end();const{onEnd:p,onSessionEnd:b,resumeAnimation:g}=this.handlers;if(this.dragSnapToOrigin&&g&&g(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const O=Rj(f.type==="pointercancel"?this.lastMoveEventInfo:jj(h,this.transformPagePoint),this.history);this.startEvent&&p&&p(f,O),b&&b(f,O)},!W4(t))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=r,this.contextWindow=i||window;const a=Zv(t),l=jj(a,this.transformPagePoint),{point:c}=l,{timestamp:u}=sa;this.history=[{...c,timestamp:u}];const{onSessionStart:d}=n;d&&d(t,Rj(l,this.history)),this.removeListeners=Wv(N1(this.contextWindow,"pointermove",this.handlePointerMove),N1(this.contextWindow,"pointerup",this.handlePointerUp),N1(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Nh(this.updatePoint)}}function jj(e,t){return t?{point:t(e.point)}:e}function YQ(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Rj({point:e},t){return{point:e,delta:YQ(e,Wte(t)),offset:YQ(e,yke(t)),velocity:xke(t,.1)}}function yke(e){return e[0]}function Wte(e){return e[e.length-1]}function xke(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=Wte(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Nd(t)));)n--;if(!r)return{x:0,y:0};const s=jd(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 Zte=1e-4,vke=1-Zte,wke=1+Zte,Kte=.01,Ske=0-Kte,Eke=0+Kte;function ll(e){return e.max-e.min}function kke(e,t,n){return Math.abs(e-t)<=n}function WQ(e,t,n,r=.5){e.origin=r,e.originPoint=Bi(t.min,t.max,e.origin),e.scale=ll(n)/ll(t),e.translate=Bi(n.min,n.max,e.origin)-e.originPoint,(e.scale>=vke&&e.scale<=wke||isNaN(e.scale))&&(e.scale=1),(e.translate>=Ske&&e.translate<=Eke||isNaN(e.translate))&&(e.translate=0)}function j1(e,t,n,r){WQ(e.x,t.x,n.x,r?r.originX:void 0),WQ(e.y,t.y,n.y,r?r.originY:void 0)}function ZQ(e,t,n){e.min=n.min+t.min,e.max=e.min+ll(t)}function Tke(e,t,n){ZQ(e.x,t.x,n.x),ZQ(e.y,t.y,n.y)}function KQ(e,t,n){e.min=t.min-n.min,e.max=e.min+ll(t)}function R1(e,t,n){KQ(e.x,t.x,n.x),KQ(e.y,t.y,n.y)}function _ke(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?Bi(n,e,r.max):Math.min(e,n)),e}function JQ(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 Ake(e,{top:t,left:n,bottom:r,right:i}){return{x:JQ(e.x,n,i),y:JQ(e.y,t,r)}}function eF(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=Sb(t.min,t.max-r,e.min):r>i&&(n=Sb(e.min,e.max-i,t.min)),qd(0,1,n)}function jke(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 t5=.35;function Rke(e=t5){return e===!1?e=0:e===!0&&(e=t5),{x:tF(e,"left","right"),y:tF(e,"top","bottom")}}function tF(e,t,n){return{min:nF(e,t),max:nF(e,n)}}function nF(e,t){return typeof e=="number"?e:e[t]||0}const rF=()=>({translate:0,scale:1,origin:0,originPoint:0}),b0=()=>({x:rF(),y:rF()}),iF=()=>({min:0,max:0}),ns=()=>({x:iF(),y:iF()});function xl(e){return[e("x"),e("y")]}function Jte({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function Ike({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Dke(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 Ij(e){return e===void 0||e===1}function n5({scale:e,scaleX:t,scaleY:n}){return!Ij(e)||!Ij(t)||!Ij(n)}function Np(e){return n5(e)||ene(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function ene(e){return sF(e.x)||sF(e.y)}function sF(e){return e&&e!=="0%"}function JT(e,t,n){const r=e-n,i=t*r;return n+i}function aF(e,t,n,r,i){return i!==void 0&&(e=JT(e,i,r)),JT(e,n,r)+t}function r5(e,t=0,n=1,r,i){e.min=aF(e.min,t,n,r,i),e.max=aF(e.max,t,n,r,i)}function tne(e,{x:t,y:n}){r5(e.x,t.translate,t.scale,t.originPoint),r5(e.y,n.translate,n.scale,n.originPoint)}const oF=.999999999999,lF=1.0000000000001;function Pke(e,t,n,r=!1){const i=n.length;if(!i)return;t.x=t.y=1;let s,a;for(let l=0;loF&&(t.x=1),t.yoF&&(t.y=1)}function O0(e,t){e.min=e.min+t,e.max=e.max+t}function cF(e,t,n,r,i=.5){const s=Bi(e.min,e.max,i);r5(e,t,n,s,r)}function y0(e,t){cF(e.x,t.x,t.scaleX,t.scale,t.originX),cF(e.y,t.y,t.scaleY,t.scale,t.originY)}function nne(e,t){return Jte(Dke(e.getBoundingClientRect(),t))}function Mke(e,t,n){const r=nne(e,n),{scroll:i}=t;return i&&(O0(r.x,i.offset.x),O0(r.y,i.offset.y)),r}const rne=({current:e})=>e?e.ownerDocument.defaultView:null,Lke=new WeakMap;class $ke{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=ns(),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(Zv(d).point)},s=(d,f)=>{const{drag:h,dragPropagation:p,onDragStart:b}=this.getProps();if(h&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=gke(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),xl(O=>{let y=this.getAxisMotionValue(O).get()||0;if(xu.test(y)){const{projection:v}=this.visualElement;if(v&&v.layout){const x=v.layout.layoutBox[O];x&&(y=ll(x)*(parseFloat(y)/100))}}this.originPoint[O]=y}),b&&Oi.postRender(()=>b(d,f)),qP(this.visualElement,"transform");const{animationState:g}=this.visualElement;g&&g.setActive("whileDrag",!0)},a=(d,f)=>{const{dragPropagation:h,dragDirectionLock:p,onDirectionLock:b,onDrag:g}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:O}=f;if(p&&this.currentDirection===null){this.currentDirection=Bke(O),this.currentDirection!==null&&b&&b(this.currentDirection);return}this.updateAxis("x",f.point,O),this.updateAxis("y",f.point,O),this.visualElement.render(),g&&g(d,f)},l=(d,f)=>this.stop(d,f),c=()=>xl(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 Yte(t,{onSessionStart:i,onStart:s,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,contextWindow:rne(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&&Oi.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||!MS(t,i,this.currentDirection))return;const s=this.getAxisMotionValue(t);let a=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(a=_ke(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&&m0(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&i?this.constraints=Ake(i.layoutBox,n):this.constraints=!1,this.elastic=Rke(r),s!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&xl(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=jke(i.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!m0(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=Mke(r,i.root,this.visualElement.getTransformPagePoint());let a=Cke(i.layout.layoutBox,s);if(n){const l=n(Ike(a));this.hasMutatedConstraints=!!l,l&&(a=Jte(l))}return a}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:s,dragSnapToOrigin:a,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=xl(d=>{if(!MS(d,n,this.currentDirection))return;let f=c&&c[d]||{};a&&(f={min:0,max:0});const h=i?200:1e6,p=i?40:1e7,b={type:"inertia",velocity:r?t[d]:0,bounceStiffness:h,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...s,...f};return this.startAxisValueAnimation(d,b)});return Promise.all(u).then(l)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return qP(this.visualElement,t),r.start(Y4(t,r,0,n,this.visualElement,!1))}stopAnimation(){xl(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){xl(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){xl(n=>{const{drag:r}=this.getProps();if(!MS(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]-Bi(a,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!m0(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};xl(a=>{const l=this.getAxisMotionValue(a);if(l&&this.constraints!==!1){const c=l.get();i[a]=Nke({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(),xl(a=>{if(!MS(a,t,null))return;const l=this.getAxisMotionValue(a),{min:c,max:u}=this.constraints[a];l.set(Bi(c,u,i[a]))})}addListeners(){if(!this.visualElement.current)return;Lke.set(this.visualElement,this);const t=this.visualElement.current,n=N1(t,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),r=()=>{const{dragConstraints:c}=this.getProps();m0(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()),Oi.read(r);const a=Cx(window,"resize",()=>this.scalePositionWithinConstraints()),l=i.addEventListener("didUpdate",({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(xl(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=t5,dragMomentum:l=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:s,dragElastic:a,dragMomentum:l}}}function MS(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function Bke(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class Qke extends Zh{constructor(t){super(t),this.removeGroupControls=nl,this.removeListeners=nl,this.controls=new $ke(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||nl}unmount(){this.removeGroupControls(),this.removeListeners()}}const uF=e=>(t,n)=>{e&&Oi.postRender(()=>e(t,n))};class Fke extends Zh{constructor(){super(...arguments),this.removePointerDownListener=nl}onPointerDown(t){this.session=new Yte(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:rne(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:uF(t),onStart:uF(n),onMove:r,onEnd:(s,a)=>{delete this.session,i&&Oi.postRender(()=>i(s,a))}}}mount(){this.removePointerDownListener=N1(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 Ek={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function dF(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const my={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(nn.test(e))e=parseFloat(e);else return e;const n=dF(e,t.target.x),r=dF(e,t.target.y);return`${n}% ${r}%`}},Uke={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=jh.parse(e);if(i.length>5)return r;const s=jh.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=Bi(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 zke extends m.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:s}=t;mSe(Vke),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()})),Ek.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()||Oi.postRender(()=>{const l=a.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),E4.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 ine(e){const[t,n]=Fee(),r=m.useContext(y4);return o.jsx(zke,{...e,layoutGroup:r,switchLayoutGroup:m.useContext(Wee),isPresent:t,safeToRemove:n})}const Vke={borderRadius:{...my,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:my,borderTopRightRadius:my,borderBottomLeftRadius:my,borderBottomRightRadius:my,boxShadow:Uke};function qke(e,t,n){const r=Ta(e)?e:_x(e);return r.start(Y4("",r,t,n)),r.animation}function Hke(e){return e instanceof SVGElement&&e.tagName!=="svg"}const Xke=(e,t)=>e.depth-t.depth;class Gke{constructor(){this.children=[],this.isDirty=!1}add(t){P4(this.children,t),this.isDirty=!0}remove(t){M4(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(Xke),this.isDirty=!1,this.children.forEach(t)}}function Yke(e,t){const n=vu.now(),r=({timestamp:i})=>{const s=i-n;s>=t&&(Nh(r),e(s-t))};return Oi.read(r,!0),()=>Nh(r)}const sne=["TopLeft","TopRight","BottomLeft","BottomRight"],Wke=sne.length,fF=e=>typeof e=="string"?parseFloat(e):e,hF=e=>typeof e=="number"||nn.test(e);function Zke(e,t,n,r,i,s){i?(e.opacity=Bi(0,n.opacity!==void 0?n.opacity:1,Kke(r)),e.opacityExit=Bi(t.opacity!==void 0?t.opacity:1,0,Jke(r))):s&&(e.opacity=Bi(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let a=0;art?1:n(Sb(e,t,r))}function mF(e,t){e.min=t.min,e.max=t.max}function Ol(e,t){mF(e.x,t.x),mF(e.y,t.y)}function gF(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function bF(e,t,n,r,i){return e-=t,e=JT(e,1/n,r),i!==void 0&&(e=JT(e,1/i,r)),e}function eTe(e,t=0,n=1,r=.5,i,s=e,a=e){if(xu.test(t)&&(t=parseFloat(t),t=Bi(a.min,a.max,t/100)-a.min),typeof t!="number")return;let l=Bi(s.min,s.max,r);e===s&&(l-=t),e.min=bF(e.min,t,n,l,i),e.max=bF(e.max,t,n,l,i)}function OF(e,t,[n,r,i],s,a){eTe(e,t[n],t[r],t[i],t.scale,s,a)}const tTe=["x","scaleX","originX"],nTe=["y","scaleY","originY"];function yF(e,t,n,r){OF(e.x,t,tTe,n?n.x:void 0,r?r.x:void 0),OF(e.y,t,nTe,n?n.y:void 0,r?r.y:void 0)}function xF(e){return e.translate===0&&e.scale===1}function one(e){return xF(e.x)&&xF(e.y)}function vF(e,t){return e.min===t.min&&e.max===t.max}function rTe(e,t){return vF(e.x,t.x)&&vF(e.y,t.y)}function wF(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function lne(e,t){return wF(e.x,t.x)&&wF(e.y,t.y)}function SF(e){return ll(e.x)/ll(e.y)}function EF(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class iTe{constructor(){this.members=[]}add(t){P4(this.members,t),t.scheduleRender()}remove(t){if(M4(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 sTe(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:p,skewY:b}=n;u&&(r=`perspective(${u}px) ${r}`),d&&(r+=`rotate(${d}deg) `),f&&(r+=`rotateX(${f}deg) `),h&&(r+=`rotateY(${h}deg) `),p&&(r+=`skewX(${p}deg) `),b&&(r+=`skewY(${b}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 jp={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Zy=typeof window<"u"&&window.MotionDebug!==void 0,Dj=["","X","Y","Z"],aTe={visibility:"hidden"},kF=1e3;let oTe=0;function Pj(e,t,n,r){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function cne(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=fte(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:s}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Oi,!(i||s))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&cne(r)}function une({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(a={},l=t==null?void 0:t()){this.id=oTe++,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,Zy&&(jp.totalNodes=jp.resolvedTargetDeltas=jp.recalculatedProjection=0),this.nodes.forEach(uTe),this.nodes.forEach(mTe),this.nodes.forEach(gTe),this.nodes.forEach(dTe),Zy&&window.MotionDebug.record(jp)},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=Yke(h,250),Ek.hasAnimatedSinceResize&&(Ek.hasAnimatedSinceResize=!1,this.nodes.forEach(_F))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeTargetChanged:p,layout:b})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||d.getDefaultTransition()||vTe,{onLayoutAnimationStart:O,onLayoutAnimationComplete:y}=d.getProps(),v=!this.targetLayout||!lne(this.targetLayout,b)||p,x=!h&&p;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={...D4(g,"layout"),onPlay:O,onComplete:y};(d.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w)}else h||_F(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=b})}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,Nh(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(bTe),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&&cne(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;AF(f.x,a.x,S),AF(f.y,a.y,S),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(R1(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),yTe(this.relativeTarget,this.relativeTargetOrigin,h,S),x&&rTe(this.relativeTarget,x)&&(this.isProjectionDirty=!1),x||(x=ns()),Ol(x,this.relativeTarget)),g&&(this.animationValues=d,Zke(d,u,this.latestValues,S,v,y)),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&&(Nh(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Oi.update(()=>{Ek.hasAnimatedSinceResize=!0,this.currentAnimation=qke(0,kF,{...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(kF),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&&dne(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||ns();const f=ll(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+f;const h=ll(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+h}Ol(l,c),y0(l,d),j1(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(a,l){this.sharedNodes.has(a)||this.sharedNodes.set(a,new iTe),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&&Pj("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(TF),this.root.sharedNodes.clear()}}}function lTe(e){e.updateLayout()}function cTe(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"?xl(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=ll(h);h.min=r[f].min,h.max=h.min+p}):dne(s,n.layoutBox,r)&&xl(f=>{const h=a?n.measuredBox[f]:n.layoutBox[f],p=ll(r[f]);h.max=h.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+p)});const l=b0();j1(l,r,n.layoutBox);const c=b0();a?j1(c,e.applyTransform(i,!0),n.measuredBox):j1(c,r,n.layoutBox);const u=!one(l);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:p}=f;if(h&&p){const b=ns();R1(b,n.layoutBox,h.layoutBox);const g=ns();R1(g,r,p.layoutBox),lne(b,g)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=g,e.relativeTargetOrigin=b,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 uTe(e){Zy&&jp.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 dTe(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function fTe(e){e.clearSnapshot()}function TF(e){e.clearMeasurements()}function hTe(e){e.isLayoutDirty=!1}function pTe(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function _F(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function mTe(e){e.resolveTargetDelta()}function gTe(e){e.calcProjection()}function bTe(e){e.resetSkewAndRotation()}function OTe(e){e.removeLeadSnapshot()}function AF(e,t,n){e.translate=Bi(t.translate,0,n),e.scale=Bi(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function CF(e,t,n,r){e.min=Bi(t.min,n.min,r),e.max=Bi(t.max,n.max,r)}function yTe(e,t,n,r){CF(e.x,t.x,n.x,r),CF(e.y,t.y,n.y,r)}function xTe(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const vTe={duration:.45,ease:[.4,0,.1,1]},NF=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),jF=NF("applewebkit/")&&!NF("chrome/")?Math.round:nl;function RF(e){e.min=jF(e.min),e.max=jF(e.max)}function wTe(e){RF(e.x),RF(e.y)}function dne(e,t,n){return e==="position"||e==="preserve-aspect"&&!kke(SF(t),SF(n),.2)}function STe(e){var t;return e!==e.root&&((t=e.scroll)===null||t===void 0?void 0:t.wasRoot)}const ETe=une({attachResizeListener:(e,t)=>Cx(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Mj={current:void 0},fne=une({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Mj.current){const e=new ETe({});e.mount(window),e.setOptions({layoutScroll:!0}),Mj.current=e}return Mj.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),kTe={pan:{Feature:Fke},drag:{Feature:Qke,ProjectionNode:fne,MeasureLayout:ine}};function TTe(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 hne(e,t){const n=TTe(e),r=new AbortController,i={passive:!0,...t,signal:r.signal};return[n,i,()=>r.abort()]}function IF(e){return t=>{t.pointerType==="touch"||Gte()||e(t)}}function _Te(e,t,n={}){const[r,i,s]=hne(e,n),a=IF(l=>{const{target:c}=l,u=t(l);if(typeof u!="function"||!c)return;const d=IF(f=>{u(f),c.removeEventListener("pointerleave",d)});c.addEventListener("pointerleave",d,i)});return r.forEach(l=>{l.addEventListener("pointerenter",a,i)}),s}function DF(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&&Oi.postRender(()=>s(t,Zv(t)))}class ATe extends Zh{mount(){const{current:t}=this.node;t&&(this.unmount=_Te(t,n=>(DF(this.node,n,"Start"),r=>DF(this.node,r,"End"))))}unmount(){}}class CTe extends Zh{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=Wv(Cx(this.node.current,"focus",()=>this.onFocus()),Cx(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const pne=(e,t)=>t?e===t?!0:pne(e,t.parentElement):!1,NTe=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function jTe(e){return NTe.has(e.tagName)||e.tabIndex!==-1}const Ky=new WeakSet;function PF(e){return t=>{t.key==="Enter"&&e(t)}}function Lj(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const RTe=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=PF(()=>{if(Ky.has(n))return;Lj(n,"down");const i=PF(()=>{Lj(n,"up")}),s=()=>Lj(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 MF(e){return W4(e)&&!Gte()}function ITe(e,t,n={}){const[r,i,s]=hne(e,n),a=l=>{const c=l.currentTarget;if(!MF(l)||Ky.has(c))return;Ky.add(c);const u=t(l),d=(p,b)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",h),!(!MF(p)||!Ky.has(c))&&(Ky.delete(c),typeof u=="function"&&u(p,{success:b}))},f=p=>{d(p,n.useGlobalTarget||pne(c,p.target))},h=p=>{d(p,!1)};window.addEventListener("pointerup",f,i),window.addEventListener("pointercancel",h,i)};return r.forEach(l=>{!jTe(l)&&l.getAttribute("tabindex")===null&&(l.tabIndex=0),(n.useGlobalTarget?window:l).addEventListener("pointerdown",a,i),l.addEventListener("focus",u=>RTe(u,i),i)}),s}function LF(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&&Oi.postRender(()=>s(t,Zv(t)))}class DTe extends Zh{mount(){const{current:t}=this.node;t&&(this.unmount=ITe(t,n=>(LF(this.node,n,"Start"),(r,{success:i})=>LF(this.node,r,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const i5=new WeakMap,$j=new WeakMap,PTe=e=>{const t=i5.get(e.target);t&&t(e)},MTe=e=>{e.forEach(PTe)};function LTe({root:e,...t}){const n=e||document;$j.has(n)||$j.set(n,{});const r=$j.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(MTe,{root:e,...t})),r[i]}function $Te(e,t,n){const r=LTe(t);return i5.set(e,n),r.observe(e),()=>{i5.delete(e),r.unobserve(e)}}const BTe={some:0,all:1};class QTe extends Zh{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:BTe[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 $Te(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(FTe(t,n))&&this.startObserver()}unmount(){}}function FTe({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const UTe={inView:{Feature:QTe},tap:{Feature:DTe},focus:{Feature:CTe},hover:{Feature:ATe}},zTe={layout:{ProjectionNode:fne,MeasureLayout:ine}},e2={current:null},Z4={current:!1};function mne(){if(Z4.current=!0,!!x4)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>e2.current=e.matches;e.addListener(t),t()}else e2.current=!1}const VTe=[...Mte,Sa,jh],qTe=e=>VTe.find(Pte(e)),$F=new WeakMap;function HTe(e,t,n){for(const r in t){const i=t[r],s=n[r];if(Ta(i))e.addValue(r,i);else if(Ta(s))e.addValue(r,_x(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,_x(a!==void 0?a:i,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const BF=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class XTe{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=H4,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=vu.now();this.renderScheduledAtthis.bindToMotionValue(r,n)),Z4.current||mne(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:e2.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){$F.delete(this.current),this.projection&&this.projection.unmount(),Nh(this.notifyUpdate),Nh(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=Hm.has(t),i=n.on("change",l=>{this.latestValues[t]=l,this.props.onUpdate&&Oi.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 wb){const n=wb[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):ns()}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=_x(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"&&(Ite(i)||Ete(i))?i=parseFloat(i):!qTe(i)&&jh.test(n)&&(i=Nte(t,n)),this.setBaseTarget(t,Ta(i)?i.get():i)),Ta(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=T4(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&&!Ta(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 L4),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class gne extends XTe{constructor(){super(...arguments),this.KeyframeResolver=Lte}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;Ta(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function GTe(e){return window.getComputedStyle(e)}class YTe extends gne{constructor(){super(...arguments),this.type="html",this.renderInstance=rte}readValueFromInstance(t,n){if(Hm.has(n)){const r=q4(n);return r&&r.default||0}else{const r=GTe(t),i=(ete(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return nne(t,n)}build(t,n,r){C4(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return I4(t,n,r)}}class WTe extends gne{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ns}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(Hm.has(n)){const r=q4(n);return r&&r.default||0}return n=ite.has(n)?n:S4(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return ote(t,n,r)}build(t,n,r){N4(t,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,n,r,i){ste(t,n,r,i)}mount(t){this.isSVGTag=R4(t.tagName),super.mount(t)}}const ZTe=(e,t)=>k4(e)?new WTe(t):new YTe(t,{allowProjection:e!==m.Fragment}),KTe=ESe({...mke,...UTe,...kTe,...zTe},ZTe),Wi=Bwe(KTe);function JTe(){!Z4.current&&mne();const[e]=m.useState(e2.current);return e}function Ns(){return Ns=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u"||/ServerSideRendering/.test(navigator&&navigator.userAgent)?m.useEffect:m.useLayoutEffect;function Hg(e,t,n){var r=m.useRef(t);r.current=t,m.useEffect(function(){function i(s){r.current(s)}return e&&window.addEventListener(e,i,n),function(){e&&window.removeEventListener(e,i)}},[e])}var e2e=["container"];function t2e(e){var t=e.container,n=t===void 0?document.body:t,r=uA(e,e2e);return si.createPortal(Cn.createElement("div",Ns({},r)),n)}function n2e(e){return Cn.createElement("svg",Ns({width:"44",height:"44",viewBox:"0 0 768 768"},e),Cn.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 r2e(e){return Cn.createElement("svg",Ns({width:"44",height:"44",viewBox:"0 0 768 768"},e),Cn.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 i2e(e){return Cn.createElement("svg",Ns({width:"44",height:"44",viewBox:"0 0 768 768"},e),Cn.createElement("path",{d:"M384 127.5l256.5 256.5-256.5 256.5-45-45 178.5-180h-390v-63h390l-178.5-180z"}))}function s2e(){return m.useEffect(function(){var e=document.body.style,t=e.overflow;return e.overflow="hidden",function(){e.overflow=t}},[]),null}function FF(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 Ff=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 Bj(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=Ff(e,s,n,innerWidth)[0],f=Ff(t,s,r,innerHeight),h=innerWidth/2,p=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-(p+t))-p+(f[0]?u/2:u),lastCX:a,lastCY:l}}function o5(e,t,n){var r=e%180!=0;return r?[n,t,r]:[t,n,r]}function Qj(e,t,n){var r=o5(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 $S(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=m.useRef(e);l.current=e;var c=m.useRef(0),u=m.useRef(),d=function(){return u.current&&clearTimeout(u.current)},f=m.useCallback(function(){var h=[].slice.call(arguments),p=Date.now();function b(){c.current=p,d(),l.current.apply(null,h)}var g=c.current,O=p-g;if(g===0&&(r&&b(),c.current=p),i!==void 0){if(O>i)return void b()}else O=1&&s&&s())};d()}function d(){c=requestAnimationFrame(u)}}var o2e={T:0,L:0,W:0,H:0,FIT:void 0},One=function(){var e=m.useRef(!1);return m.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),e},l2e=["className"];function c2e(e){var t=e.className,n=t===void 0?"":t,r=uA(e,l2e);return Cn.createElement("div",Ns({className:"PhotoView__Spinner "+n},r),Cn.createElement("svg",{viewBox:"0 0 32 32",width:"36",height:"36",fill:"white"},Cn.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"}),Cn.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}var u2e=["src","loaded","broken","className","onPhotoLoad","loadingElement","brokenElement"];function d2e(e){var t=e.src,n=e.loaded,r=e.broken,i=e.className,s=e.onPhotoLoad,a=e.loadingElement,l=e.brokenElement,c=uA(e,u2e),u=One();return t&&!r?Cn.createElement(Cn.Fragment,null,Cn.createElement("img",Ns({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?Cn.createElement("span",{className:"PhotoView__icon"},a):Cn.createElement(c2e,{className:"PhotoView__icon"}))):l?Cn.createElement("span",{className:"PhotoView__icon"},typeof l=="function"?l({src:t}):l):null}var f2e={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 h2e(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,p=e.className,b=e.style,g=e.loadingElement,O=e.brokenElement,y=e.onPhotoTap,v=e.onMaskTap,x=e.onReachMove,w=e.onReachUp,S=e.onPhotoResize,E=e.isActive,k=e.expose,T=t2(f2e),C=T[0],N=T[1],_=m.useRef(0),R=One(),$=C.naturalWidth,D=$===void 0?s:$,M=C.naturalHeight,j=M===void 0?l:M,P=C.width,L=P===void 0?s:P,U=C.height,F=U===void 0?l:U,q=C.loaded,z=q===void 0?!n:q,B=C.broken,V=C.x,ce=C.y,we=C.touched,Oe=C.stopRaf,de=C.maskTouched,Z=C.rotate,J=C.scale,fe=C.CX,be=C.CY,je=C.lastX,Qe=C.lastY,Me=C.lastCX,le=C.lastCY,ke=C.lastScale,ye=C.touchTime,$e=C.touchLength,ze=C.pause,Ae=C.reach,Ve=cm({onScale:function(Ne){return ut(LS(Ne))},onRotate:function(Ne){Z!==Ne&&(k({rotate:Ne}),N(Ns({rotate:Ne},Qj(D,j,Ne))))}});function ut(Ne,Ge,Pt){J!==Ne&&(k({scale:Ne}),N(Ns({scale:Ne},Bj(V,ce,L,F,J,Ne,Ge,Pt),Ne<=1&&{x:0,y:0})))}var Tt=$S(function(Ne,Ge,Pt){if(Pt===void 0&&(Pt=0),(we||de)&&E){var Kt=o5(Z,L,F),tt=Kt[0],an=Kt[1];if(Pt===0&&_.current===0){var or=Math.abs(Ne-fe)<=20,Qt=Math.abs(Ge-be)<=20;if(or&&Qt)return void N({lastCX:Ne,lastCY:Ge});_.current=or?Ge>be?3:2:1}var Ut,Ce=Ne-Me,Ze=Ge-le;if(Pt===0){var $t=Ff(Ce+je,J,tt,innerWidth)[0],En=Ff(Ze+Qe,J,an,innerHeight);Ut=function(xr,Pe,at,Lt){return Pe&&xr===1||Lt==="x"?"x":at&&xr>1||Lt==="y"?"y":void 0}(_.current,$t,En[0],Ae),Ut!==void 0&&x(Ut,Ne,Ge,J)}if(Ut==="x"||de)return void N({reach:"x"});var gn=LS(J+(Pt-$e)/100/2*J,D/L,.2);k({scale:gn}),N(Ns({touchLength:Pt,reach:Ut,scale:gn},Bj(V,ce,L,F,J,gn,Ne,Ge,Ce,Ze)))}},{maxWait:8});function We(Ne){return!Oe&&!we&&(R.current&&N(Ns({},Ne,{pause:u})),R.current)}var W,ne,he,xe,re,Re,nt,Ke,tn=(re=function(Ne){return We({x:Ne})},Re=function(Ne){return We({y:Ne})},nt=function(Ne){return R.current&&(k({scale:Ne}),N({scale:Ne})),!we&&R.current},Ke=cm({X:function(Ne){return re(Ne)},Y:function(Ne){return Re(Ne)},S:function(Ne){return nt(Ne)}}),function(Ne,Ge,Pt,Kt,tt,an,or,Qt,Ut,Ce,Ze){var $t=o5(Ce,tt,an),En=$t[0],gn=$t[1],xr=Ff(Ne,Qt,En,innerWidth),Pe=xr[0],at=xr[1],Lt=Ff(Ge,Qt,gn,innerHeight),Wt=Lt[0],fn=Lt[1],Jt=Date.now()-Ze;if(Jt>=200||Qt!==or||Math.abs(Ut-or)>1){var lr=Bj(Ne,Ge,tt,an,or,Qt),Sr=lr.x,ai=lr.y,Yt=Pe?at:Sr!==Ne?Sr:null,_r=Wt?fn:ai!==Ge?ai:null;return Yt!==null&&$p(Ne,Yt,Ke.X),_r!==null&&$p(Ge,_r,Ke.Y),void(Qt!==or&&$p(or,Qt,Ke.S))}var kn=(Ne-Pt)/Jt,Wr=(Ge-Kt)/Jt,jr=Math.sqrt(Math.pow(kn,2)+Math.pow(Wr,2)),Rr=!1,Rn=!1;(function(cr,Nn){var ur,Lr=cr,$r=0,Zr=0,bn=function(ot){ur||(ur=ot);var dt=ot-ur,Zn=Math.sign(cr),Fi=-.001*Zn,Ui=Math.sign(-Lr)*Math.pow(Lr,2)*2e-4,Es=Lr*dt+(Fi+Ui)*Math.pow(dt,2)/2;$r+=Es,ur=ot,Zn*(Lr+=(Fi+Ui)*dt)<=0?Ie():Nn($r)?ue():Ie()};function ue(){Zr=requestAnimationFrame(bn)}function Ie(){cancelAnimationFrame(Zr)}ue()})(jr,function(cr){var Nn=Ne+cr*(kn/jr),ur=Ge+cr*(Wr/jr),Lr=Ff(Nn,or,En,innerWidth),$r=Lr[0],Zr=Lr[1],bn=Ff(ur,or,gn,innerHeight),ue=bn[0],Ie=bn[1];if($r&&!Rr&&(Rr=!0,Pe?$p(Nn,Zr,Ke.X):UF(Zr,Nn+(Nn-Zr),Ke.X)),ue&&!Rn&&(Rn=!0,Wt?$p(ur,Ie,Ke.Y):UF(Ie,ur+(ur-Ie),Ke.Y)),Rr&&Rn)return!1;var ot=Rr||Ke.X(Zr),dt=Rn||Ke.Y(Ie);return ot&&dt})}),Gt=(W=y,ne=function(Ne,Ge){Ae||ut(J!==1?1:Math.max(2,D/L),Ne,Ge)},he=m.useRef(0),xe=$S(function(){he.current=0,W.apply(void 0,[].slice.call(arguments))},{wait:300}),function(){var Ne=[].slice.call(arguments);he.current+=1,xe.apply(void 0,Ne),he.current>=2&&(xe.cancel(),he.current=0,ne.apply(void 0,Ne))});function At(Ne,Ge){if(_.current=0,(we||de)&&E){N({touched:!1,maskTouched:!1,pause:!1,stopRaf:!1,reach:void 0});var Pt=LS(J,D/L);if(tn(V,ce,je,Qe,L,F,J,Pt,ke,Z,ye),w(Ne,Ge),fe===Ne&&be===Ge){if(we)return void Gt(Ne,Ge);de&&v(Ne,Ge)}}}function St(Ne,Ge,Pt){Pt===void 0&&(Pt=0),N({touched:!0,CX:Ne,CY:Ge,lastCX:Ne,lastCY:Ge,lastX:V,lastY:ce,lastScale:J,touchLength:Pt,touchTime:Date.now()})}function ve(Ne){N({maskTouched:!0,CX:Ne.clientX,CY:Ne.clientY,lastX:V,lastY:ce})}Hg(sd?void 0:"mousemove",function(Ne){Ne.preventDefault(),Tt(Ne.clientX,Ne.clientY)}),Hg(sd?void 0:"mouseup",function(Ne){At(Ne.clientX,Ne.clientY)}),Hg(sd?"touchmove":void 0,function(Ne){Ne.preventDefault();var Ge=FF(Ne);Tt.apply(void 0,Ge)},{passive:!1}),Hg(sd?"touchend":void 0,function(Ne){var Ge=Ne.changedTouches[0];At(Ge.clientX,Ge.clientY)},{passive:!1}),Hg("resize",$S(function(){z&&!we&&(N(Qj(D,j,Z)),S())},{maxWait:8})),a5(function(){E&&k(Ns({scale:J,rotate:Z},Ve))},[E]);var Ue=function(Ne,Ge,Pt,Kt,tt,an,or,Qt,Ut,Ce){var Ze=function(Sr,ai,Yt,_r,kn){var Wr=m.useRef(!1),jr=t2({lead:!0,scale:Yt}),Rr=jr[0],Rn=Rr.lead,cr=Rr.scale,Nn=jr[1],ur=$S(function(Lr){try{return kn(!0),Nn({lead:!1,scale:Lr}),Promise.resolve()}catch($r){return Promise.reject($r)}},{wait:_r});return a5(function(){Wr.current?(kn(!1),Nn({lead:!0}),ur(Yt)):Wr.current=!0},[Yt]),Rn?[Sr*cr,ai*cr,Yt/cr]:[Sr*Yt,ai*Yt,1]}(an,or,Qt,Ut,Ce),$t=Ze[0],En=Ze[1],gn=Ze[2],xr=function(Sr,ai,Yt,_r,kn){var Wr=m.useState(o2e),jr=Wr[0],Rr=Wr[1],Rn=m.useState(0),cr=Rn[0],Nn=Rn[1],ur=m.useRef(),Lr=cm({OK:function(){return Sr&&Nn(4)}});function $r(Zr){kn(!1),Nn(Zr)}return m.useEffect(function(){if(ur.current||(ur.current=Date.now()),Yt){if(function(Zr,bn){var ue=Zr&&Zr.current;if(ue&&ue.nodeType===1){var Ie=ue.getBoundingClientRect();bn({T:Ie.top,L:Ie.left,W:Ie.width,H:Ie.height,FIT:ue.tagName==="IMG"?getComputedStyle(ue).objectFit:void 0})}}(ai,Rr),Sr)return Date.now()-ur.current<250?(Nn(1),requestAnimationFrame(function(){Nn(2),requestAnimationFrame(function(){return $r(3)})}),void setTimeout(Lr.OK,_r)):void Nn(4);$r(5)}},[Sr,Yt]),[cr,jr]}(Ne,Ge,Pt,Ut,Ce),Pe=xr[0],at=xr[1],Lt=at.W,Wt=at.FIT,fn=innerWidth/2,Jt=innerHeight/2,lr=Pe<3||Pe>4;return[lr?Lt?at.L:fn:Kt+(fn-an*Qt/2),lr?Lt?at.T:Jt:tt+(Jt-or*Qt/2),$t,lr&&Wt?$t*(at.H/Lt):En,Pe===0?gn:lr?Lt/(an*Qt)||.01:gn,lr?Wt?1:0:1,Pe,Wt]}(u,c,z,V,ce,L,F,J,d,function(Ne){return N({pause:Ne})}),Y=Ue[4],mt=Ue[6],xt="transform "+d+"ms "+f,Dt={className:p,onMouseDown:sd?void 0:function(Ne){Ne.stopPropagation(),Ne.button===0&&St(Ne.clientX,Ne.clientY,0)},onTouchStart:sd?function(Ne){Ne.stopPropagation(),St.apply(void 0,FF(Ne))}:void 0,onWheel:function(Ne){if(!Ae){var Ge=LS(J-Ne.deltaY/100/2,D/L);N({stopRaf:!0}),ut(Ge,Ne.clientX,Ne.clientY)}},style:{width:Ue[2]+"px",height:Ue[3]+"px",opacity:Ue[5],objectFit:mt===4?void 0:Ue[7],transform:Z?"rotate("+Z+"deg)":void 0,transition:mt>2?xt+", opacity "+d+"ms ease, height "+(mt<4?d/2:mt>4?d:0)+"ms "+f:void 0}};return Cn.createElement("div",{className:"PhotoView__PhotoWrap"+(h?" "+h:""),style:b,onMouseDown:!sd&&E?ve:void 0,onTouchStart:sd&&E?function(Ne){return ve(Ne.touches[0])}:void 0},Cn.createElement("div",{className:"PhotoView__PhotoBox",style:{transform:"matrix("+Y+", 0, 0, "+Y+", "+Ue[0]+", "+Ue[1]+")",transition:we||ze?void 0:xt,willChange:E?"transform":void 0}},n?Cn.createElement(d2e,Ns({src:n,loaded:z,broken:B},Dt,{onPhotoLoad:function(Ne){N(Ns({},Ne,Ne.loaded&&Qj(Ne.naturalWidth||0,Ne.naturalHeight||0,Z)))},loadingElement:g,brokenElement:O})):r&&r({attrs:Dt,scale:Y,rotate:Z})))}var zF={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 p2e(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,p=h===void 0||h,b=e.overlayRender,g=e.toolbarRender,O=e.className,y=e.maskClassName,v=e.photoClassName,x=e.photoWrapClassName,w=e.loadingElement,S=e.brokenElement,E=e.images,k=e.index,T=k===void 0?0:k,C=e.onIndexChange,N=e.visible,_=e.onClose,R=e.afterClose,$=e.portalContainer,D=t2(zF),M=D[0],j=D[1],P=m.useState(0),L=P[0],U=P[1],F=M.x,q=M.touched,z=M.pause,B=M.lastCX,V=M.lastCY,ce=M.bg,we=ce===void 0?u:ce,Oe=M.lastBg,de=M.overlay,Z=M.minimal,J=M.scale,fe=M.rotate,be=M.onScale,je=M.onRotate,Qe=e.hasOwnProperty("index"),Me=Qe?T:L,le=Qe?C:U,ke=m.useRef(Me),ye=E.length,$e=E[Me],ze=typeof n=="boolean"?n:ye>n,Ae=function(Y,mt){var xt=m.useReducer(function(Pt){return!Pt},!1)[1],Dt=m.useRef(0),Ne=function(Pt){var Kt=m.useRef(Pt);function tt(an){Kt.current=an}return m.useMemo(function(){(function(an){Y?(an(Y),Dt.current=1):Dt.current=2})(tt)},[Pt]),[Kt.current,tt]}(Y),Ge=Ne[1];return[Ne[0],Dt.current,function(){xt(),Dt.current===2&&(Ge(!1),mt&&mt()),Dt.current=0}]}(N,R),Ve=Ae[0],ut=Ae[1],Tt=Ae[2];a5(function(){if(Ve)return j({pause:!0,x:Me*-(innerWidth+Sg)}),void(ke.current=Me);j(zF)},[Ve]);var We=cm({close:function(Y){je&&je(0),j({overlay:!0,lastBg:we}),_(Y)},changeIndex:function(Y,mt){mt===void 0&&(mt=!1);var xt=ze?ke.current+(Y-Me):Y,Dt=ye-1,Ne=s5(xt,0,Dt),Ge=ze?xt:Ne,Pt=innerWidth+Sg;j({touched:!1,lastCX:void 0,lastCY:void 0,x:-Pt*Ge,pause:mt}),ke.current=Ge,le&&le(ze?Y<0?Dt:Y>Dt?0:Y:Ne)}}),W=We.close,ne=We.changeIndex;function he(Y){return Y?W():j({overlay:!de})}function xe(){j({x:-(innerWidth+Sg)*Me,lastCX:void 0,lastCY:void 0,pause:!0}),ke.current=Me}function re(Y,mt,xt,Dt){Y==="x"?function(Ne){if(B!==void 0){var Ge=Ne-B,Pt=Ge;!ze&&(Me===0&&Ge>0||Me===ye-1&&Ge<0)&&(Pt=Ge/2),j({touched:!0,lastCX:B,x:-(innerWidth+Sg)*ke.current+Pt,pause:!1})}else j({touched:!0,lastCX:Ne,x:F,pause:!1})}(mt):Y==="y"&&function(Ne,Ge){if(V!==void 0){var Pt=u===null?null:s5(u,.01,u-Math.abs(Ne-V)/100/4);j({touched:!0,lastCY:V,bg:Ge===1?Pt:u,minimal:Ge===1})}else j({touched:!0,lastCY:Ne,bg:we,minimal:!0})}(xt,Dt)}function Re(Y,mt){var xt=Y-(B??Y),Dt=mt-(V??mt),Ne=!1;if(xt<-40)ne(Me+1);else if(xt>40)ne(Me-1);else{var Ge=-(innerWidth+Sg)*ke.current;Math.abs(Dt)>100&&Z&&f&&(Ne=!0,W()),j({touched:!1,x:Ge,lastCX:void 0,lastCY:void 0,bg:u,overlay:!!Ne||de})}}Hg("keydown",function(Y){if(N)switch(Y.key){case"ArrowLeft":ne(Me-1,!0);break;case"ArrowRight":ne(Me+1,!0);break;case"Escape":W()}});var nt=function(Y,mt,xt){return m.useMemo(function(){var Dt=Y.length;return xt?Y.concat(Y).concat(Y).slice(Dt+mt-1,Dt+mt+2):Y.slice(Math.max(mt-1,0),Math.min(mt+2,Dt+1))},[Y,mt,xt])}(E,Me,ze);if(!Ve)return null;var Ke=de&&!ut,tn=N?we:Oe,Gt=be&&je&&{images:E,index:Me,visible:N,onClose:W,onIndexChange:ne,overlayVisible:Ke,overlay:$e&&$e.overlay,scale:J,rotate:fe,onScale:be,onRotate:je},At=r?r(ut):400,St=i?i(ut):QF,ve=r?r(3):600,Ue=i?i(3):QF;return Cn.createElement(t2e,{className:"PhotoView-Portal"+(Ke?"":" PhotoView-Slider__clean")+(N?"":" PhotoView-Slider__willClose")+(O?" "+O:""),role:"dialog",onClick:function(Y){return Y.stopPropagation()},container:$},N&&Cn.createElement(s2e,null),Cn.createElement("div",{className:"PhotoView-Slider__Backdrop"+(y?" "+y:"")+(ut===1?" PhotoView-Slider__fadeIn":ut===2?" PhotoView-Slider__fadeOut":""),style:{background:tn?"rgba(0, 0, 0, "+tn+")":void 0,transitionTimingFunction:St,transitionDuration:(q?0:At)+"ms",animationDuration:At+"ms"},onAnimationEnd:Tt}),p&&Cn.createElement("div",{className:"PhotoView-Slider__BannerWrap"},Cn.createElement("div",{className:"PhotoView-Slider__Counter"},Me+1," / ",ye),Cn.createElement("div",{className:"PhotoView-Slider__BannerRight"},g&&Gt&&g(Gt),Cn.createElement(n2e,{className:"PhotoView-Slider__toolbarIcon",onClick:W}))),nt.map(function(Y,mt){var xt=ze||Me!==0?ke.current-1+mt:Me+mt;return Cn.createElement(h2e,{key:ze?Y.key+"/"+Y.src+"/"+xt:Y.key,item:Y,speed:At,easing:St,visible:N,onReachMove:re,onReachUp:Re,onPhotoTap:function(){return he(s)},onMaskTap:function(){return he(l)},wrapClassName:x,className:v,style:{left:(innerWidth+Sg)*xt+"px",transform:"translate3d("+F+"px, 0px, 0)",transition:q||z?void 0:"transform "+ve+"ms "+Ue},loadingElement:w,brokenElement:S,onPhotoResize:xe,isActive:ke.current===xt,expose:j})}),!sd&&p&&Cn.createElement(Cn.Fragment,null,(ze||Me!==0)&&Cn.createElement("div",{className:"PhotoView-Slider__ArrowLeft",onClick:function(){return ne(Me-1,!0)}},Cn.createElement(r2e,null)),(ze||Me+1-1){var y=u.slice();return y.splice(O,1,g),void l({images:y})}l(function(v){return{images:v.images.concat(g)}})},remove:function(g){l(function(O){var y=O.images.filter(function(v){return v.key!==g});return{images:y,index:Math.min(y.length-1,f)}})},show:function(g){var O=u.findIndex(function(y){return y.key===g});l({visible:!0,index:O}),r&&r(!0,O,a)}}),p=cm({close:function(){l({visible:!1}),r&&r(!1,f,a)},changeIndex:function(g){l({index:g}),n&&n(g,a)}}),b=m.useMemo(function(){return Ns({},a,h)},[a,h]);return Cn.createElement(bne.Provider,{value:b},t,Cn.createElement(p2e,Ns({images:u,visible:d,index:f,onIndexChange:p.changeIndex,onClose:p.close},i)))}var yne=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=m.useContext(bne),h=(t=function(){return f.nextId()},(n=m.useRef({sign:!1,fn:void 0}).current).sign||(n.sign=!0,n.fn=t()),n.fn),p=m.useRef(null);m.useImperativeHandle(d==null?void 0:d.ref,function(){return p.current}),m.useEffect(function(){return function(){f.remove(h)}},[]);var b=cm({render:function(O){return i&&i(O)},show:function(O,y){f.show(h),function(v,x){if(d){var w=d.props[v];w&&w(x)}}(O,y)}}),g=m.useMemo(function(){var O={};return u.forEach(function(y){O[y]=b.show.bind(null,y)}),O},[]);return m.useEffect(function(){f.update({key:h,src:r,originRef:p,render:b.render,overlay:s,width:a,height:l})},[r]),d?m.Children.only(m.cloneElement(d,Ns({},g,{ref:p}))):null};const O2e=e=>o.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:[o.jsx("path",{d:"M11 7.5C11 8.32843 10.3284 9 9.5 9C8.67157 9 8 8.32843 8 7.5C8 6.67157 8.67157 6 9.5 6C10.3284 6 11 6.67157 11 7.5Z",fill:"currentColor"}),o.jsx("path",{d:"M14.5 9C15.3284 9 16 8.32843 16 7.5C16 6.67157 15.3284 6 14.5 6C13.6716 6 13 6.67157 13 7.5C13 8.32843 13.6716 9 14.5 9Z",fill:"currentColor"}),o.jsx("path",{d:"M12 1C12.5523 1 13 1.44772 13 2V2.5L15.8708 2.5C16.3832 2.49998 16.8252 2.49997 17.1896 2.52892C17.574 2.55947 17.9568 2.62688 18.3269 2.80938C18.9192 3.10147 19.3985 3.58084 19.6906 4.17313C19.8731 4.54322 19.9405 4.92598 19.9711 5.31042C20 5.6748 20 6.1168 20 6.62913V6.70824C20 7.76163 20 8.61129 19.9453 9.29994C19.889 10.0088 19.77 10.6322 19.4844 11.2114C18.9976 12.1986 18.1986 12.9975 17.2114 13.4844C16.6322 13.77 16.0088 13.889 15.2999 13.9453C14.6113 14 13.7616 14 12.7082 14H11.2918C10.2384 14 9.38872 14 8.70006 13.9453C7.99117 13.889 7.36777 13.77 6.78856 13.4844C5.8014 12.9976 5.00246 12.1986 4.51564 11.2114C4.23001 10.6322 4.11104 10.0088 4.05471 9.29995C3.99999 8.61131 3.99999 7.76169 4 6.70834V6.62922C3.99998 6.11688 3.99997 5.67481 4.02893 5.31042C4.05948 4.92598 4.12688 4.54322 4.30938 4.17313C4.60147 3.58084 5.08084 3.10147 5.67313 2.80938C6.04322 2.62688 6.42598 2.55947 6.81042 2.52892C7.17482 2.49997 7.61685 2.49998 8.12922 2.5L11 2.5V2C11 1.44772 11.4477 1 12 1ZM6.96885 4.52264C6.7044 4.54365 6.60587 4.57938 6.55771 4.60313C6.36028 4.70049 6.20049 4.86028 6.10313 5.05771C6.07938 5.10587 6.04366 5.2044 6.02264 5.46885C6.00074 5.7445 6 6.10631 6 6.66667C6 7.77136 6.00074 8.54142 6.04843 9.14152C6.09522 9.73042 6.18251 10.0696 6.30939 10.3269C6.60148 10.9192 7.08084 11.3985 7.67314 11.6906C7.93042 11.8175 8.26959 11.9048 8.85849 11.9516C9.45858 11.9993 10.2286 12 11.3333 12H12.6667C13.7714 12 14.5414 11.9993 15.1415 11.9516C15.7304 11.9048 16.0696 11.8175 16.3269 11.6906C16.9192 11.3985 17.3985 10.9192 17.6906 10.3269C17.8175 10.0696 17.9048 9.73042 17.9516 9.14152C17.9993 8.54142 18 7.77136 18 6.66667C18 6.1063 17.9993 5.7445 17.9774 5.46885C17.9563 5.20439 17.9206 5.10587 17.8969 5.05771C17.7995 4.86028 17.6397 4.70049 17.4423 4.60313C17.3941 4.57938 17.2956 4.54365 17.0312 4.52264C16.7555 4.50074 16.3937 4.5 15.8333 4.5H8.16667C7.60631 4.5 7.2445 4.50074 6.96885 4.52264Z",fill:"currentColor"}),o.jsx("path",{d:"M6 21C6 20.0261 6.55099 19.05 7.63152 18.2782C8.71012 17.5078 10.2515 17 12 17C13.7486 17 15.2899 17.5078 16.3685 18.2782C17.449 19.05 18 20.0261 18 21C18 21.5523 18.4477 22 19 22C19.5523 22 20 21.5523 20 21C20 19.2125 18.984 17.6886 17.531 16.6507C16.0761 15.6115 14.1174 15 12.0001 15C9.88267 15 7.92397 15.6115 6.46905 16.6507C5.01605 17.6886 4 19.2125 4 21C4 21.5523 4.44772 22 5 22C5.55229 22 6 21.5523 6 21Z",fill:"currentColor"})]}),y2e=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"})}),x2e=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"})}),xne=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"})}),K4=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"})}),v2e=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"})}),w2e=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"})}),n2=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"})}),S2e=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"})}),vne=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"})}),wne=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"})}),E2e=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"})}),J4=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"})}),k2e=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"})}),T2e=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"})}),_2e=e=>o.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",...e,children:o.jsx("path",{d:"M5.91456 7.59106C4.34202 9.04124 3.28878 10.7415 2.77064 11.6971C2.66597 11.8902 2.66597 12.1098 2.77064 12.3029C3.28878 13.2585 4.34202 14.9588 5.91456 16.4089C7.48207 17.8545 9.50584 19 12.0001 19C14.4944 19 16.5182 17.8545 18.0857 16.4089C19.6582 14.9588 20.7114 13.2585 21.2296 12.3029C21.3343 12.1098 21.3343 11.8902 21.2296 11.6971C20.7114 10.7415 19.6582 9.04124 18.0857 7.59105C16.5182 6.1455 14.4944 5 12.0001 5C9.50584 5 7.48207 6.1455 5.91456 7.59106ZM4.5587 6.1208C6.36071 4.45899 8.84593 3 12.0001 3C15.1543 3 17.6395 4.45899 19.4415 6.1208C21.2385 7.77798 22.4153 9.68799 22.9878 10.7438C23.4149 11.5315 23.4149 12.4685 22.9878 13.2562C22.4153 14.312 21.2385 16.222 19.4415 17.8792C17.6395 19.541 15.1543 21 12.0001 21C8.84593 21 6.36071 19.541 4.5587 17.8792C2.76171 16.222 1.5849 14.312 1.01244 13.2562C0.585372 12.4685 0.585371 11.5315 1.01244 10.7438C1.5849 9.688 2.76171 7.77798 4.5587 6.1208ZM12.0001 9.5C10.6194 9.5 9.50011 10.6193 9.50011 12C9.50011 13.3807 10.6194 14.5 12.0001 14.5C13.3808 14.5 14.5001 13.3807 14.5001 12C14.5001 10.6193 13.3808 9.5 12.0001 9.5ZM7.50011 12C7.50011 9.51472 9.51483 7.5 12.0001 7.5C14.4854 7.5 16.5001 9.51472 16.5001 12C16.5001 14.4853 14.4854 16.5 12.0001 16.5C9.51483 16.5 7.50011 14.4853 7.50011 12Z",fill:"currentColor"})}),Sne=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"})]}),A2e=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"})}),Ene=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"})]}),r2=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"})]}),VF=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"})}),C2e=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"})}),N2e=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"})}),j2e=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"})}),R2e=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"})}),Fj=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"})}),kne=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"})]}),e6=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 j2e=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ene=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/** + */const I2e=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Tne=(...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 R2e={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 D2e={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 I2e=m.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:a,...l},c)=>m.createElement("svg",{ref:c,...R2e,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Ene("lucide",i),...l},[...a.map(([u,d])=>m.createElement(u,d)),...Array.isArray(s)?s:[s]]));/** + */const P2e=m.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:a,...l},c)=>m.createElement("svg",{ref:c,...D2e,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Tne("lucide",i),...l},[...a.map(([u,d])=>m.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 Bt=(e,t)=>{const n=m.forwardRef(({className:r,...i},s)=>m.createElement(I2e,{ref:s,iconNode:t,className:Ene(`lucide-${j2e(e)}`,r),...i}));return n.displayName=`${e}`,n};/** + */const Bt=(e,t)=>{const n=m.forwardRef(({className:r,...i},s)=>m.createElement(P2e,{ref:s,iconNode:t,className:Tne(`lucide-${I2e(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 kne=Bt("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** + */const _ne=Bt("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 D2e=Bt("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 M2e=Bt("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 R1=Bt("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** + */const I1=Bt("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 P2e=Bt("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** + */const L2e=Bt("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 Tne=Bt("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 Ane=Bt("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 _ne=Bt("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 Cne=Bt("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 M2e=Bt("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 $2e=Bt("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. @@ -120,147 +120,147 @@ Error generating stack: `+r.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const L2e=Bt("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + */const B2e=Bt("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 dO=Bt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + */const fO=Bt("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 Ane=Bt("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 Nne=Bt("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 $2e=Bt("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + */const Q2e=Bt("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 zF=Bt("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 qF=Bt("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 B2e=Bt("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 F2e=Bt("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 Cne=Bt("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/** + */const jne=Bt("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const J4=Bt("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 t6=Bt("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 Q2e=Bt("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/** + */const U2e=Bt("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 F2e=Bt("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 z2e=Bt("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 Sk=Bt("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 kk=Bt("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 cA=Bt("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 dA=Bt("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 VF=Bt("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 HF=Bt("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 Eb=Bt("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 kb=Bt("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 U2e=Bt("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 V2e=Bt("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 qF=Bt("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/** + */const XF=Bt("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const z2e=Bt("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 q2e=Bt("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 V2e=Bt("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 H2e=Bt("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 e6=Bt("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 n6=Bt("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 q2e=Bt("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 X2e=Bt("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 Nne=Bt("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 Rne=Bt("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 H2e=Bt("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 G2e=Bt("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 X2e=Bt("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 Y2e=Bt("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 t6=Bt("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 r6=Bt("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 jne=Bt("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 Ine=Bt("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 G2e=Bt("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 W2e=Bt("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 Y2e=Bt("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 Z2e=Bt("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 uA=Bt("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 fA=Bt("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 n6=Bt("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 i6=Bt("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. @@ -270,57 +270,57 @@ Error generating stack: `+r.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Rne=Bt("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 Dne=Bt("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 W2e=Bt("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 K2e=Bt("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 ir=Bt("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** + */const sr=Bt("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 Z2e=Bt("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 J2e=Bt("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 K2e=Bt("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 e_e=Bt("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 Q0=Bt("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 F0=Bt("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 J2e=Bt("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** + */const t_e=Bt("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 Ine=Bt("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 Pne=Bt("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 e_e=Bt("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 n_e=Bt("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 t_e=Bt("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 r_e=Bt("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 n_e=Bt("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** + */const i_e=Bt("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. @@ -330,42 +330,42 @@ Error generating stack: `+r.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Dne=Bt("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 Mne=Bt("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 Pne=Bt("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 Lne=Bt("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 r_e=Bt("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 s_e=Bt("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 n2=Bt("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + */const i2=Bt("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 i_e=Bt("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 a_e=Bt("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 HF=Bt("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 GF=Bt("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 Cx=Bt("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 Nx=Bt("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 s_e=Bt("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 o_e=Bt("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. @@ -375,30 +375,30 @@ Error generating stack: `+r.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const a_e=Bt("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 l_e=Bt("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 o_e=Bt("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 c_e=Bt("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 Ya=Bt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),XF="veadk_auth_qs",l_e=new Set(["view","source","sessionId","artifactSha256","validationReportSha256"]);let my=null;function c_e(){if(my!==null)return my;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&&l_e.has(a)?n:t).append(a,s)});const i=t.toString();if(i?(sessionStorage.setItem(XF,i),my=i):my=sessionStorage.getItem(XF)??"",i){const s=n.toString();window.history.replaceState(null,"",window.location.pathname+(s?`?${s}`:"")+window.location.hash)}return my}function bo(e){const t=c_e();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 So=3e4,Ni=12e4,r6=1e4;function Eo(e,t=So){if(t<=0)return e??void 0;const n=AbortSignal.timeout(t);return e?AbortSignal.any([e,n]):n}const r2="veadk_local_user",i2="veadk_local_user_tab",u_e="X-VeADK-OAuth-Refresh-Retry",d_e=[50,250],f_e=/^[A-Za-z0-9]{1,16}$/;function Mne(){try{const e=sessionStorage.getItem(i2);if(e)return e;const t=localStorage.getItem(r2);return t&&sessionStorage.setItem(i2,t),t}catch{try{return localStorage.getItem(r2)}catch{return null}}}function GF(e){try{sessionStorage.setItem(i2,e)}catch{}try{localStorage.setItem(r2,e)}catch{}}function h_e(){try{sessionStorage.removeItem(i2)}catch{}try{localStorage.removeItem(r2)}catch{}}function Kh(e){const t=new Headers(e),n=Mne();return n&&t.set("X-VeADK-Local-User",n),t}async function Lne(){let e;try{e=await fetch("/web/auth-config",{headers:{Accept:"application/json"},signal:Eo(void 0,r6)})}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 p_e(e){const t=window.location.pathname+window.location.search+window.location.hash,n=e.includes("?")?"&":"?";window.location.assign(`${e}${n}redirect=${encodeURIComponent(t)}`)}function m_e(){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 g_e(){const[e,t]=await Promise.all([aP(),Lne()]);return e.status==="unauthenticated"&&t.length>0}function b_e(){window.location.assign("/oauth2/logout")}async function O_e(){for(let e=0;;e+=1){let t;try{t=await fetch("/oauth2/userinfo",{headers:{Accept:"application/json"},signal:Eo(void 0,r6)})}catch(r){throw console.warn("[identity] /oauth2/userinfo is unreachable:",r),new Error("无法连接身份服务,请检查网络后重试。")}const n=d_e[e];if(t.status!==401||t.headers.get(u_e)!=="1"||n===void 0)return t;await new Promise(r=>window.setTimeout(r,n))}}async function aP(){const e=await O_e();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=Mne();return t?{status:"authenticated",userId:t,info:{name:t},local:!0}:{status:"unauthenticated",userId:"",local:!0}}function y_e(e){return e?String(e.name??e.preferred_username??e.email??e.sub??""):""}function x_e(e){const t=e==null?void 0:e.picture;return typeof t=="string"?t.trim():""}const oP="veadk:authentication-required";let I1=null,Ky=null;function v_e(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 w_e(e){I1||(I1=new Promise(n=>{Ky=n}),window.dispatchEvent(new Event(oP)));const t=I1;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 S_e(){return I1!==null}function E_e(){Ky==null||Ky(),Ky=null,I1=null}async function dA(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 k_e=/\brun_sse\s*failed\s*:\s*404\b/i,T_e=/session not found/i,__e=/(?:^|[::\s])not found\s*$/i,A_e=/Expecting (?:'[^']+'|\w+)(?: delimiter)?: line \d+ column \d+ \(char \d+\)/i,C_e="提示:会话已不存在。使用 in-memory 或 SQLite 短期记忆时,多实例、进程重启或滚动发布都可能导致会话丢失;建议改用基于数据库的持久化短期记忆存储。",N_e="提示:该 Runtime 未提供会话能力运行接口,可能是 Runtime 版本与当前 Studio 不兼容。",j_e="提示:模型生成的工具参数格式不完整,请重新发送一次。",R_e="提示:请检查共享公网出口等网络配置,然后重试。",YF="原始响应:";function BS(e,t){return e.includes(t)?e:`${e} + */const Ya=Bt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),YF="veadk_auth_qs",u_e=new Set(["view","source","sessionId","artifactSha256","validationReportSha256"]);let gy=null;function d_e(){if(gy!==null)return gy;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&&u_e.has(a)?n:t).append(a,s)});const i=t.toString();if(i?(sessionStorage.setItem(YF,i),gy=i):gy=sessionStorage.getItem(YF)??"",i){const s=n.toString();window.history.replaceState(null,"",window.location.pathname+(s?`?${s}`:"")+window.location.hash)}return gy}function bo(e){const t=d_e();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 So=3e4,Ni=12e4,s6=1e4;function Eo(e,t=So){if(t<=0)return e??void 0;const n=AbortSignal.timeout(t);return e?AbortSignal.any([e,n]):n}const s2="veadk_local_user",a2="veadk_local_user_tab",f_e="X-VeADK-OAuth-Refresh-Retry",h_e=[50,250],p_e=/^[A-Za-z0-9]{1,16}$/;function $ne(){try{const e=sessionStorage.getItem(a2);if(e)return e;const t=localStorage.getItem(s2);return t&&sessionStorage.setItem(a2,t),t}catch{try{return localStorage.getItem(s2)}catch{return null}}}function WF(e){try{sessionStorage.setItem(a2,e)}catch{}try{localStorage.setItem(s2,e)}catch{}}function m_e(){try{sessionStorage.removeItem(a2)}catch{}try{localStorage.removeItem(s2)}catch{}}function Kh(e){const t=new Headers(e),n=$ne();return n&&t.set("X-VeADK-Local-User",n),t}async function Bne(){let e;try{e=await fetch("/web/auth-config",{headers:{Accept:"application/json"},signal:Eo(void 0,s6)})}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 g_e(e){const t=window.location.pathname+window.location.search+window.location.hash,n=e.includes("?")?"&":"?";window.location.assign(`${e}${n}redirect=${encodeURIComponent(t)}`)}function b_e(){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 O_e(){const[e,t]=await Promise.all([l5(),Bne()]);return e.status==="unauthenticated"&&t.length>0}function y_e(){window.location.assign("/oauth2/logout")}async function x_e(){for(let e=0;;e+=1){let t;try{t=await fetch("/oauth2/userinfo",{headers:{Accept:"application/json"},signal:Eo(void 0,s6)})}catch(r){throw console.warn("[identity] /oauth2/userinfo is unreachable:",r),new Error("无法连接身份服务,请检查网络后重试。")}const n=h_e[e];if(t.status!==401||t.headers.get(f_e)!=="1"||n===void 0)return t;await new Promise(r=>window.setTimeout(r,n))}}async function l5(){const e=await x_e();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=$ne();return t?{status:"authenticated",userId:t,info:{name:t},local:!0}:{status:"unauthenticated",userId:"",local:!0}}function v_e(e){return e?String(e.name??e.preferred_username??e.email??e.sub??""):""}function w_e(e){const t=e==null?void 0:e.picture;return typeof t=="string"?t.trim():""}const c5="veadk:authentication-required";let D1=null,Jy=null;function S_e(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 E_e(e){D1||(D1=new Promise(n=>{Jy=n}),window.dispatchEvent(new Event(c5)));const t=D1;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 k_e(){return D1!==null}function T_e(){Jy==null||Jy(),Jy=null,D1=null}async function hA(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 __e=/\brun_sse\s*failed\s*:\s*404\b/i,A_e=/session not found/i,C_e=/(?:^|[::\s])not found\s*$/i,N_e=/Expecting (?:'[^']+'|\w+)(?: delimiter)?: line \d+ column \d+ \(char \d+\)/i,j_e="提示:会话已不存在。使用 in-memory 或 SQLite 短期记忆时,多实例、进程重启或滚动发布都可能导致会话丢失;建议改用基于数据库的持久化短期记忆存储。",R_e="提示:该 Runtime 未提供会话能力运行接口,可能是 Runtime 版本与当前 Studio 不兼容。",I_e="提示:模型生成的工具参数格式不完整,请重新发送一次。",D_e="提示:请检查共享公网出口等网络配置,然后重试。",ZF="原始响应:";function BS(e,t){return e.includes(t)?e:`${e} -${t}`}function Uf(e){const t=String(e);let n=t.includes(YF)?t:`${YF}${t}`;return A_e.test(t)?n=BS(n,j_e):k_e.test(t)&&(T_e.test(t)?n=BS(n,C_e):__e.test(t)&&(n=BS(n,N_e))),BS(n,R_e)}async function*i6(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 I_e=255,D_e=/[\p{L}\p{M}\p{N}\p{P}\p{Zs}]/u;function P_e(e){const t=e.normalize("NFKC").replace(/\s+/gu," ").trim(),n=new TextEncoder;let r=0,i="";for(const s of t){if(!D_e.test(s))continue;const a=n.encode(s).byteLength;if(r+a>I_e)break;i+=s,r+=a}return i.replace(/ +/g," ").trimEnd()}const lP="ap-southeast-1",s6="cn-beijing",M_e="https://ark.ap-southeast.bytepluses.com/api/v3",L_e="https://ark.cn-beijing.volces.com/api/v3/",$_e="https://console.byteplus.com/ark/region:ark+ap-southeast-1/openManagement",B_e="https://console.volcengine.com/ark/region:ark+cn-beijing/openManagement",Q_e="dola-seed-2-1-turbo-260628",F_e="doubao-seed-2-1-pro-260628",U_e="skylark-embedding-vision-250615",z_e="doubao-embedding-vision-250615",V_e="seed-2-0-lite-260228",q_e="doubao-seed-2-0-lite-260428",H_e="dola-seedream-5-0-pro-260628",X_e="doubao-seedream-5-0-260128",G_e="seededit-3-0-i2i-250628",Y_e="doubao-seededit-3-0-i2i-250628",W_e="dreamina-seedance-2-0-260128",Z_e="doubao-seedance-2-0-260128",$ne=[{value:"cn-beijing",label:"华北 2(北京)"},{value:"cn-shanghai",label:"华东 2(上海)"}],Bne=[{value:lP,label:lP}];function kb(e){return e==="byteplus"?Bne:$ne}function Hr(e){var t;return((t=kb(e)[0])==null?void 0:t.value)||s6}const K_e=new Set(["cn-beijing","cn-shanghai","ap-southeast-1"]);function a6(e){return typeof e=="string"&&K_e.has(e)}function Ec(e,t){var r;return((r=(t?kb(t):[...$ne,...Bne]).find(i=>i.value===e))==null?void 0:r.label)||e||"-"}function wm(e){return e==="byteplus"?Q_e:F_e}function kc(e){return e==="byteplus"?M_e:L_e}function J_e(e){return e==="byteplus"?$_e:B_e}function eAe(e){return e==="byteplus"?U_e:z_e}function tAe(e){return e==="byteplus"?V_e:q_e}function nAe(e){return e==="byteplus"?H_e:X_e}function rAe(e){return e==="byteplus"?G_e:Y_e}function iAe(e){return e==="byteplus"?W_e:Z_e}const o6="veadk.messageFeedback.v1";function l6(e,t,n,r){return[e,t,n,r].join(":")}function c6(){if(typeof window>"u")return{};try{const e=JSON.parse(localStorage.getItem(o6)??"{}");return e&&typeof e=="object"?e:{}}catch{return{}}}function sAe(e,t,n){if(typeof window>"u")return;const r=c6();r[e]={...r[e]??{},[`veadk_feedback:${t}`]:n},localStorage.setItem(o6,JSON.stringify(r))}function Qne(e){if(typeof window>"u")return;const t=l6(e.runtimeId,e.appName,e.userId,e.sessionId),n=c6(),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(o6,JSON.stringify(n))}}const Ek="",u6=new Map;function Fne(e,t){u6.set(e,t)}function Une(){u6.clear()}function ul(e){const t=u6.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=So){const i=!!n.runtimeId&&String(t.method??"GET").toUpperCase()==="DELETE",s={...t,...i?{method:"POST"}:{},headers:Kh(t.headers)},a=()=>{const u={...s,signal:Eo(t.signal,r)};if(n.runtimeId){const d=new URLSearchParams;n.region&&d.set("_runtime_region",n.region),n.retryProbe&&d.set("probe_retry","connect"),i&&d.set("_method","DELETE");const f=d.toString()?`${e.includes("?")?"&":"?"}${d.toString()}`:"";return fetch(bo(`${Ek}/web/runtime-proxy/${n.runtimeId}${e}${f}`),u)}if(n.base){const d=new Headers(u.headers);return d.set("X-AgentKit-Base",n.base),n.apiKey&&d.set("X-AgentKit-Key",n.apiKey),fetch(bo(`${Ek}/agentkit-proxy${e}`),{...u,headers:d})}return fetch(bo(`${Ek}${e}`),u)},l=async u=>{if(v_e(u))return!0;if(u.status!==401)return!1;try{return await g_e()}catch{return!1}};let c=await a();for(;await l(c);)await w_e(t.signal),c=await a();return c}function Hn(e,t={},n=So){return wt(e,t,{},n)}function aAe(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 sn(e,t){const n=`${t}(HTTP ${e.status})`,r=await e.text().catch(()=>"");if(!r)return n;try{const i=JSON.parse(r),s=aAe(i.detail??i.error);return s?`${n} +${t}`}function Uf(e){const t=String(e);let n=t.includes(ZF)?t:`${ZF}${t}`;return N_e.test(t)?n=BS(n,I_e):__e.test(t)&&(A_e.test(t)?n=BS(n,j_e):C_e.test(t)&&(n=BS(n,R_e))),BS(n,D_e)}async function*a6(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 P_e=255,M_e=/[\p{L}\p{M}\p{N}\p{P}\p{Zs}]/u;function L_e(e){const t=e.normalize("NFKC").replace(/\s+/gu," ").trim(),n=new TextEncoder;let r=0,i="";for(const s of t){if(!M_e.test(s))continue;const a=n.encode(s).byteLength;if(r+a>P_e)break;i+=s,r+=a}return i.replace(/ +/g," ").trimEnd()}const u5="ap-southeast-1",o6="cn-beijing",$_e="https://ark.ap-southeast.bytepluses.com/api/v3",B_e="https://ark.cn-beijing.volces.com/api/v3/",Q_e="https://console.byteplus.com/ark/region:ark+ap-southeast-1/openManagement",F_e="https://console.volcengine.com/ark/region:ark+cn-beijing/openManagement",U_e="dola-seed-2-1-turbo-260628",z_e="doubao-seed-2-1-pro-260628",V_e="skylark-embedding-vision-250615",q_e="doubao-embedding-vision-250615",H_e="seed-2-0-lite-260228",X_e="doubao-seed-2-0-lite-260428",G_e="dola-seedream-5-0-pro-260628",Y_e="doubao-seedream-5-0-260128",W_e="seededit-3-0-i2i-250628",Z_e="doubao-seededit-3-0-i2i-250628",K_e="dreamina-seedance-2-0-260128",J_e="doubao-seedance-2-0-260128",Qne=[{value:"cn-beijing",label:"华北 2(北京)"},{value:"cn-shanghai",label:"华东 2(上海)"}],Fne=[{value:u5,label:u5}];function Tb(e){return e==="byteplus"?Fne:Qne}function Hr(e){var t;return((t=Tb(e)[0])==null?void 0:t.value)||o6}const eAe=new Set(["cn-beijing","cn-shanghai","ap-southeast-1"]);function l6(e){return typeof e=="string"&&eAe.has(e)}function Ec(e,t){var r;return((r=(t?Tb(t):[...Qne,...Fne]).find(i=>i.value===e))==null?void 0:r.label)||e||"-"}function Sm(e){return e==="byteplus"?U_e:z_e}function kc(e){return e==="byteplus"?$_e:B_e}function tAe(e){return e==="byteplus"?Q_e:F_e}function nAe(e){return e==="byteplus"?V_e:q_e}function rAe(e){return e==="byteplus"?H_e:X_e}function iAe(e){return e==="byteplus"?G_e:Y_e}function sAe(e){return e==="byteplus"?W_e:Z_e}function aAe(e){return e==="byteplus"?K_e:J_e}const c6="veadk.messageFeedback.v1";function u6(e,t,n,r){return[e,t,n,r].join(":")}function d6(){if(typeof window>"u")return{};try{const e=JSON.parse(localStorage.getItem(c6)??"{}");return e&&typeof e=="object"?e:{}}catch{return{}}}function oAe(e,t,n){if(typeof window>"u")return;const r=d6();r[e]={...r[e]??{},[`veadk_feedback:${t}`]:n},localStorage.setItem(c6,JSON.stringify(r))}function Une(e){if(typeof window>"u")return;const t=u6(e.runtimeId,e.appName,e.userId,e.sessionId),n=d6(),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(c6,JSON.stringify(n))}}const Tk="",f6=new Map;function zne(e,t){f6.set(e,t)}function Vne(){f6.clear()}function ul(e){const t=f6.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=So){const i=!!n.runtimeId&&String(t.method??"GET").toUpperCase()==="DELETE",s={...t,...i?{method:"POST"}:{},headers:Kh(t.headers)},a=()=>{const u={...s,signal:Eo(t.signal,r)};if(n.runtimeId){const d=new URLSearchParams;n.region&&d.set("_runtime_region",n.region),n.retryProbe&&d.set("probe_retry","connect"),i&&d.set("_method","DELETE");const f=d.toString()?`${e.includes("?")?"&":"?"}${d.toString()}`:"";return fetch(bo(`${Tk}/web/runtime-proxy/${n.runtimeId}${e}${f}`),u)}if(n.base){const d=new Headers(u.headers);return d.set("X-AgentKit-Base",n.base),n.apiKey&&d.set("X-AgentKit-Key",n.apiKey),fetch(bo(`${Tk}/agentkit-proxy${e}`),{...u,headers:d})}return fetch(bo(`${Tk}${e}`),u)},l=async u=>{if(S_e(u))return!0;if(u.status!==401)return!1;try{return await O_e()}catch{return!1}};let c=await a();for(;await l(c);)await E_e(t.signal),c=await a();return c}function Hn(e,t={},n=So){return wt(e,t,{},n)}function lAe(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 sn(e,t){const n=`${t}(HTTP ${e.status})`,r=await e.text().catch(()=>"");if(!r)return n;try{const i=JSON.parse(r),s=lAe(i.detail??i.error);return s?`${n} ${s} 原始响应: ${r}`:`${n} 原始响应: ${r}`}catch{return`${n} 原始响应: -${r}`}}async function zne(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 sn(n,"加载 Ark API Key 失败"));return await n.json()}async function Vne(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 sn(n,"加载 Ark API Key 失败"));return await n.json()}async function fA(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 sn(r,"加载模型列表失败"));return await r.json()}async function qne(){const e=await wt("/list-apps");if(!e.ok)throw new Error(`list-apps failed: ${e.status}`);return e.json()}class fO extends Error{constructor(){super("当前账号无权访问该 Runtime,请刷新列表或重新登录后重试。"),this.name="RuntimeAccessDeniedError"}}class fa extends Error{constructor(t,n=!1,r=!1){super(t),this.unsupported=n,this.retryable=r,this.name="RuntimeProbeError"}}const Hne="Runtime 已部署成功,但当前 Studio 无法访问私网 Runtime。请使用已绑定相同 VPC 的 Studio 访问,或改用公网 / 公网+VPC 部署。",Xne="Runtime 已部署成功,但 Studio 暂时无法连接服务。网关域名可能仍在生效,或当前网络/DNS 无法访问该 Runtime,请稍后在智能体管理页重试连接。",WF=["cn-beijing","cn-shanghai"],oAe=3e4,hA=5*60*1e3,Gne=60*1e3;let Yne="volcengine";const kk=new Map,jp=new Map,Rp=new Map,hc=new Map;function Wne(e,t){return`${t}:${e}`}function Zne(e){Yne=e}function Zv(e){const t=(e||"").trim();if(Yne==="byteplus")return[t&&!t.startsWith("cn-")?t:lP];const n=t&&!t.startsWith("ap-")?t:s6;return WF.includes(n)?[n,...WF.filter(r=>r!==n)]:[n]}function pA(e){const t=(e||"").trim();return t?[t]:Zv()}function hO(...e){return e.map(t=>String(t??"")).join("")}function pO(e,t,n){const r=e.get(t);return r!=null&&r.value&&Date.now()-r.updatedAt<=n?r.value:null}function d6(e,t,n){return e.set(t,{value:n,updatedAt:Date.now()}),n}async function Kne(e){try{const t=await e.clone().json();return typeof t.detail=="string"?t.detail:""}catch{return""}}async function Kv(e,t,n){const r=await wt("/list-apps",{},n??{base:e,apiKey:t}),i=n!=null&&n.runtimeId?await Kne(r):"";if(n!=null&&n.runtimeId&&i==="runtime_access_denied")throw new fO;if(n!=null&&n.runtimeId&&i==="runtime_private_endpoint_unreachable")throw new fa(Hne);if(n!=null&&n.runtimeId&&["runtime_proxy_connect_error","runtime_proxy_timeout","runtime_json_connect_error","runtime_json_timeout"].includes(i))throw new fa(Xne,!1,!0);if(n!=null&&n.runtimeId&&r.status===404)throw new fa("该 Runtime 的 Agent Server 未提供连接接口,请确认 Runtime 已就绪且版本兼容。",!0,!0);if(n!=null&&n.runtimeId&&(r.status===401||r.status===403))throw new fa("Runtime 服务拒绝了连接请求,请检查 Runtime 的鉴权配置。");if(!r.ok)throw new Error(await sn(r,"读取 Agent 列表失败"));const s=await r.json();return n!=null&&n.runtimeId&&kk.set(Wne(n.runtimeId,n.region??""),{apps:s,expiresAt:Date.now()+oAe}),s}async function Jne(e,t){const{app:n,ep:r}=ul(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 sn(i,"创建会话失败");throw new Error(l===a?a:`${a}:${l}`)}return(await i.json()).id}async function f6(e,t){const{app:n,ep:r}=ul(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 mA(e,t,n){const{app:r,ep:i}=ul(e),s=await wt(`/apps/${r}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}`,{},i);if(!s.ok){const l=await sn(s,"读取会话失败");throw new Error(`get session failed: ${s.status}:${l}`)}const a=await s.json();if(i.runtimeId){const l=l6(i.runtimeId,r,t,n);a.state={...c6()[l]??{},...a.state??{}}}return a}async function ere(e){const{app:t,ep:n}=ul(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??""})},{},Ni);if(!r.ok)throw new Error(await sn(r,"提交反馈失败"));const i=await r.json(),s=l6(n.runtimeId,t,e.userId,e.sessionId);return sAe(s,e.eventId,i),i}async function gA(e,t={}){const n=hO(e.runtimeId,e.region||"cn-beijing",e.appName,e.pageSize??100),r=pO(hc,n,Gne);if(!t.force&&r)return r;const i=hc.get(n);if(!t.force&&(i!=null&&i.promise))return i.promise;let s=null;const a=(async()=>{for(const l of pA(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 d6(hc,n,await u.json());s=new Error(await sn(u,"读取评测集失败"))}throw s??new Error("读取评测集失败")})();hc.set(n,{...i,promise:a,updatedAt:(i==null?void 0:i.updatedAt)??0});try{return await a}finally{const l=hc.get(n);(l==null?void 0:l.promise)===a&&hc.set(n,{value:l.value,updatedAt:l.updatedAt})}}async function cP(e){let t=null;for(const n of pA(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 sn(i,"读取自动评测状态失败"))}throw t??new Error("读取自动评测状态失败")}async function tre(e){let t=null;for(const n of pA(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 sn(i,"读取优化项失败"))}throw t??new Error("读取优化项失败")}function nre(e){return pO(hc,hO(e.runtimeId,e.region||"cn-beijing",e.appName,e.pageSize??100),Gne)}function lAe(e){gA(e).catch(()=>{})}function rre(e){gA(e,{force:!0}).catch(()=>{})}function ire(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 Tk(e){const t=e.comment??"",n=e.rating==="bad"&&!!t.trim();for(const[r,i]of hc.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;hc.set(r,{value:{...s,sets:ire(s.sets,l),items:l},updatedAt:Date.now(),promise:i.promise})}}async function sre(e){let t=null;for(const n of pA(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})},{},Ni);if(r.ok){const i=await r.json(),s=new Set(e.itemIds);for(const[a,l]of hc.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));hc.set(a,{value:{...c,sets:ire(c.sets,u),items:u},updatedAt:Date.now()})}return i}t=new Error(await sn(r,"删除评测案例失败"))}throw t??new Error("删除评测案例失败")}async function uP(e,t,n){const{app:r,ep:i}=ul(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 cAe(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 are(e,t,n,r,i){const{app:s,ep:a}=ul(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,Ni);if(!u.ok)throw new Error(await sn(u,"下载文件失败"));const d=await u.json(),f=d.inlineData??d.inline_data;if(!(f!=null&&f.data))throw new Error("文件内容不可用");const h=cAe(f.data),p=h.buffer.slice(h.byteOffset,h.byteOffset+h.byteLength);return{blob:new Blob([p],{type:f.mimeType??f.mime_type??"application/octet-stream"}),downloadName:f.displayName??f.display_name??r}}async function p6(e,t,n,r,i){const{blob:s}=await are(e,t,n,r,i);return URL.createObjectURL(s)}async function uAe(e){const t=await wt("/web/media/capabilities");if(!t.ok)throw new Error(await sn(t,"media capabilities failed"));return t.json()}async function ore(e,t,n,r){const{app:i}=ul(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},{},Ni);if(!a.ok)throw new Error(await sn(a,"文件上传失败"));return{...await a.json(),status:"ready"}}async function dP(e,t,n){const{app:r}=ul(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 sn(s,"media cleanup failed"))}function lre(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 _k(e,t){const n=lre(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 sn(r,"media cleanup failed"))}function cre(e,t){if(t.startsWith("data:")||t.startsWith("blob:")||/^https?:/.test(t))return t;const n=lre(t);if(!n)return t;const r=`${n}/content`;return bo(`${Ek}${r}`)}async function s2(e,t,n){const{app:r,ep:i}=ul(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 sn(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 fP(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 sn(t,"问题反馈上报失败"));if((await t.json()).submitted!==!0)throw new Error("问题反馈上报失败:服务端未确认提交结果");return{submitted:!0}}async function ure(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 hP(e){const{app:t,ep:n}=ul(e);return ure(t,n,!1)}async function dAe(e,t,n){let r=null;for(const i of Zv(t)){const s={runtimeId:e,region:i};try{const a=Wne(e,i),l=kk.get(a);l&&l.expiresAt<=Date.now()&&kk.delete(a);const c=kk.get(a),u=n||(c==null?void 0:c.apps[0])||(await Kv("","",s))[0];if(!u)throw new Error("该 Runtime 未提供可预览的 Agent。");return ure(u,s)}catch(a){if(a instanceof fO||a instanceof fa&&!a.unsupported)throw a;r=a instanceof Error?a:new Error(String(a))}}throw r??new Error("该 Runtime 未提供可预览的 Agent。")}async function m6(e,t,n={},r={}){const i=typeof n=="string"?n:void 0,s=typeof n=="string"?r:n,a=hO(e,t||"cn-beijing",i??""),l=pO(jp,a,hA);if(!s.force&&l)return l;const c=jp.get(a);if(!s.force&&(c!=null&&c.promise))return c.promise;const u=dAe(e,t,i).then(d=>d6(jp,a,d));jp.set(a,{...c,promise:u,updatedAt:(c==null?void 0:c.updatedAt)??0});try{return await u}finally{const d=jp.get(a);(d==null?void 0:d.promise)===u&&jp.set(a,{value:d.value,updatedAt:d.updatedAt})}}function dre(e,t,n=""){return pO(jp,hO(e,t||"cn-beijing",n),hA)}function fre(e,t,n=""){m6(e,t,n).catch(()=>{})}async function hre(e,t,n,r){const{app:i,ep:s}=ul(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 sn(l,"Agent 检索失败"));return l.json()}async function pre(e,t){const{app:n}=ul(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 mre=Uf("HTTP 200,SSE 响应体为空。"),Ak=Uf("HTTP 200,SSE 响应中没有可展示的模型回复。");async function*pP({appName:e,userId:t,sessionId:n,text:r,attachments:i=[],invocation:s,platformTools:a,functionResponses:l=[],signal:c}){const{app:u,ep:d}=ul(e),f=i.flatMap(O=>O.status&&O.status!=="ready"?[]:O.uri?[{fileData:{mimeType:O.mimeType,fileUri:O.uri,displayName:O.name},partMetadata:{veadkMedia:{id:O.id,uri:O.uri,name:O.name,mimeType:O.mimeType,sizeBytes:O.sizeBytes}}}]:O.data?[{inlineData:{mimeType:O.mimeType,data:O.data,displayName:O.name}}]:[]),h=s&&(s.skills.length>0||s.targetAgent)?s:void 0,p=[...f,...l.map(O=>({functionResponse:{id:O.id,name:O.name,response:O.response}})),...r.trim()?[{text:r}]:[]];if(h&&p.length>0){const O=p[0],y=O.partMetadata;p[0]={...O,partMetadata:{...y,veadkInvocation:h}}}let b;try{b=await wt("/run_sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({app_name:u,user_id:t,session_id:n,new_message:{role:"user",parts:p},streaming:!0,...a!==void 0?{platform_tools:[...a]}:{},custom_metadata:h?{veadkInvocation:h}:void 0}),signal:c},d,0)}catch(O){throw c!=null&&c.aborted||(O==null?void 0:O.name)==="AbortError"?O:new Error(Uf(O))}if(!b.ok){const O=await sn(b,"运行会话失败");throw new Error(Uf(`run_sse failed: ${b.status}:${O}`))}let g=!1;try{for await(const O of i6(b)){g=!0;const y=O;typeof y.error=="string"&&(y.error=Uf(y.error)),typeof y.errorMessage=="string"&&(y.errorMessage=Uf(y.errorMessage)),typeof y.error_message=="string"&&(y.error_message=Uf(y.error_message)),yield y}}catch(O){throw c!=null&&c.aborted||(O==null?void 0:O.name)==="AbortError"?O:new Error(Uf(O))}if(!g)throw new Error(mre)}async function g6(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 sn(r,"检查 Runtime 名称失败"));const i=await r.json();if(typeof i.available!="boolean")throw new Error("检查 Runtime 名称失败:服务返回格式错误");return{available:i.available}}async function gre(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 sn(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}}const ZF={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 bre(e){var i;const t=await wt("/web/system-info",{signal:e});if(!t.ok)throw new Error(await sn(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)=>(ZF[s.kind]??Number.MAX_SAFE_INTEGER)-(ZF[a.kind]??Number.MAX_SAFE_INTEGER));return{storage:{tosAddress:n.storage.tosAddress},sandboxTools:r}}async function Ore(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 sn(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 b6(e){const t=await wt("/web/identity/user-pools",{signal:e});if(!t.ok)throw new Error(await sn(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 D1=new Map;function fAe(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 P1 extends Error{constructor(t){super(t.message),this.detail=t,this.name="GithubCicdPipelineError"}}async function sf(e){const t=await e.text().catch(()=>"");if(t)try{const n=JSON.parse(t),r=fAe(n.detail??n.error);if(r)return new P1(r)}catch{return new P1({message:t})}return new P1({message:`同步 GitHub 代码失败 (${e.status})`})}async function yre(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 sf(t);return t.json()}async function xre(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 sf(t);return t.json()}async function vre(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 sf(t);return t.json()}async function hAe(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 sf(t);return t.json()}async function wre(e){const t=await wt(`/web/github-cicd/runtime-binding?runtimeId=${encodeURIComponent(e)}`);if(!t.ok)throw await sf(t);const n=await t.json();return n.pipelineId?n:null}async function Ck(e){const t=await wt(`/web/github-delivery/versions?runtimeId=${encodeURIComponent(e)}`);if(!t.ok)throw await sf(t);return t.json()}async function Sre(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 sf(t);return t.json()}async function O6(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 sf(t);return t.json()}async function Ere(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 sf(t);return t.json()}async function mO(e,t,n,r){var f,h,p,b,g;const i=r==null?void 0:r.taskId,s=i?new AbortController:void 0;i&&s&&D1.set(i,s);const a=()=>{i&&D1.get(i)===s&&D1.delete(i)};let l;try{const O=!!(r!=null&&r.migrationTaskId);(f=r==null?void 0:r.onStage)==null||f.call(r,{level:"info",phase:"upload",message:O?"正在校验迁移产物":"正在上传代码包",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:O?[]: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,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:P_e((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})},{},0),(h=r==null?void 0:r.onStage)==null||h.call(r,{level:"success",phase:"upload",message:O?"迁移产物校验完成":"代码包上传完成",pct:100})}catch(O){throw a(),O}if(!l.ok){const O=await sn(l,"部署失败");throw a(),new Error(O)}let c=null;try{for await(const O of i6(l)){const y=O;if(y&&y.done){c=y;break}y&&y.message&&((p=r==null?void 0:r.onStage)==null||p.call(r,y))}}catch(O){throw a(),O}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=(b=c.runtimeName)!=null&&b.trim()?c.agentName:e,d=((g=c.runtimeName)==null?void 0:g.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 kre(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=D1.get(e))==null||n.abort(),D1.delete(e)}async function pAe(e=s6){const t=await wt(`/web/my-runtimes?region=${encodeURIComponent(e)}`);if(!t.ok)throw new Error(`加载失败 (${t.status})`);return(await t.json()).runtimes??[]}const Nx={title:"AgentKit Studio",logoUrl:""},mP={enabled:!1},Qj={studio:!1,version:"",provider:"volcengine",branding:Nx,features:{newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,agentUsage:!1,addAgentkit:!0,generatedAgentTestRun:!0},defaultView:"chat",agentsSource:"local",telemetry:mP};function mAe(e){if(!e||typeof e!="object")return mP;const t=e;if(t.enabled!==!0||!t.studio||typeof t.studio!="object")return mP;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 Tre(){var e,t;try{const n=await wt("/web/ui-config");if(!n.ok)return Qj;const r=await n.json(),i=typeof((e=r.branding)==null?void 0:e.logoUrl)=="string"?r.branding.logoUrl:Nx.logoUrl,s=r.provider==="byteplus"?"byteplus":"volcengine";return Zne(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:Nx.title,logoUrl:i?bo(i):""},features:{...Qj.features,...r.features??{}},defaultView:r.defaultView??"chat",agentsSource:r.agentsSource==="cloud"?"cloud":"local",telemetry:mAe(r.telemetry)}}catch{return Qj}}const _re={role:"user",telemetry:{userId:"",accountId:""},capabilities:{createAgents:!1,manageAgents:!1,runtimeScope:"mine"}};async function Are(){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 Cre(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 Nre(){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 jre(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})},{},Ni);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 Rre({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 sn(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 af(e=""){return`/web/cronjobs${e?`/${encodeURIComponent(e)}`:""}`}async function gP(e){const t=await wt(af(),{signal:e});if(!t.ok)throw new Error(await sn(t,"加载定时任务失败"));const n=await t.json();return Array.isArray(n)?n:n.items??[]}async function gAe(e,t){const n=await wt(af(e),{signal:t});if(!n.ok)throw new Error(await sn(n,"加载定时任务详情失败"));return await n.json()}async function Ire(e){const t=await wt(af(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(await sn(t,"创建定时任务失败"));return await t.json()}async function Dre(e,t){const n=await wt(`${af(e)}/update`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(await sn(n,"更新定时任务失败"));return await n.json()}async function Pre(e,t){const n=t?"enable":"disable",r=await wt(`${af(e)}/${n}`,{method:"POST"});if(!r.ok)throw new Error(await sn(r,t?"启用定时任务失败":"暂停定时任务失败"));return await r.json()}async function Mre(e){const t=await wt(`${af(e)}/run`,{method:"POST"});if(!t.ok)throw new Error(await sn(t,"立即执行定时任务失败"));return await t.json()}async function bP(e,t){const n=await wt(`${af(e)}/runs`,{signal:t});if(!n.ok)throw new Error(await sn(n,"加载执行历史失败"));const r=await n.json();return Array.isArray(r)?r:r.items??[]}async function Lre(e,t){const n=await wt(`${af(e)}/runs/${encodeURIComponent(t)}/cancel`,{method:"POST"});if(!n.ok)throw new Error(await sn(n,"终止执行失败"));return await n.json()}async function $re(e){const t=await wt(af(e),{method:"DELETE"});if(!t.ok)throw new Error(await sn(t,"删除定时任务失败"))}async function gO(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()}`);if(!n.ok){const i=await sn(n,"加载 Runtime 失败");throw new Error(i)}const r=await n.json();return{runtimes:r.runtimes??[],nextToken:r.nextToken??""}}async function bA(e,t,n={}){try{const r={runtimeId:e,region:t};return n.retryProbe&&(r.retryProbe=!0),await Kv("","",r)}catch(r){if(r instanceof fO||r instanceof fa)throw r;return null}}async function Bre(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 fa(await sn(r,"读取本地工具失败"),!1,!0);return await r.json()}async function Qre(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 fa(await sn(r,"连接 Studio 动态路由失败"),!1,!0);return await r.json()}async function Fre(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 Kne(i);if(s==="runtime_access_denied")throw new fO;if(s==="runtime_private_endpoint_unreachable")throw new fa(Hne);if(["runtime_proxy_connect_error","runtime_proxy_timeout"].includes(s))throw new fa(Xne);if(i.status===404)return null;if(i.status===401||i.status===403)throw new fa("Runtime 服务拒绝了 A2A 探测请求,请检查 Runtime 的鉴权配置。");if(!i.ok)throw new Error(await sn(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 Ure(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 sn(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 zre(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})`)}}async function Vre({runtimeId:e,region:t,appName:n,signal:r}){const i=new URLSearchParams({runtimeId:e,region:t});n&&i.set("appName",n);const s=await wt(`/web/runtime-update-capability?${i.toString()}`,{signal:r});if(!s.ok)throw new Error(await bAe(s));return await s.json()}async function bAe(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 OAe(e,t){let n=null;for(const r of Zv(t)){const i=await wt(`/web/runtime-detail?runtimeId=${encodeURIComponent(e)}®ion=${encodeURIComponent(r)}`);if(i.ok)return i.json();n=new Error(await sn(i,"加载 Runtime 详情失败"))}throw n??new Error("加载 Runtime 详情失败")}async function y6(e,t="cn-beijing",n={}){const r=hO(e,t||"cn-beijing"),i=pO(Rp,r,hA);if(!n.force&&i)return i;const s=Rp.get(r);if(!n.force&&(s!=null&&s.promise))return s.promise;const a=OAe(e,t).then(l=>d6(Rp,r,l));Rp.set(r,{...s,promise:a,updatedAt:(s==null?void 0:s.updatedAt)??0});try{return await a}finally{const l=Rp.get(r);(l==null?void 0:l.promise)===a&&Rp.set(r,{value:l.value,updatedAt:l.updatedAt})}}function qre(e,t="cn-beijing"){return pO(Rp,hO(e,t||"cn-beijing"),hA)}function Hre(e,t="cn-beijing"){y6(e,t).catch(()=>{})}async function x6(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 sn(t,"生成项目失败"));return t.json()}const yAe=19e4;async function Xre(e){const t=await wt("/web/generated-agent-drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({requirement:e})},{},yAe);if(!t.ok)throw new Error(await sn(t,"生成 Agent 配置失败"));return dA(t,"生成 Agent 配置失败")}async function Gre(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 sn(n,"创建调试运行失败"));return dA(n,"创建调试运行失败")}async function Yre(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 sn(n,"创建调试会话失败"));return(await dA(n,"创建调试会话失败")).id}async function Wre(e,t){const n=await wt(`/web/generated-agent-test-runs/${encodeURIComponent(e)}/trace/session/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(await sn(n,"加载调试调用链路失败"));const r=await dA(n,"加载调试调用链路失败");if(!Array.isArray(r))throw new Error("加载调试调用链路失败:返回格式无效");return r}async function*Zre({runId:e,userId:t,sessionId:n,text:r,signal:i}){const s=r.trim()?[{text:r}]:[],a=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:i},{},0);if(!a.ok)throw new Error(await sn(a,"调试运行失败"));for await(const l of i6(a))yield l}async function Hg(e){const t=await wt(`/web/generated-agent-test-runs/${e}`,{method:"DELETE"});if(!t.ok&&t.status!==404)throw new Error(await sn(t,"清理调试运行失败"))}const xAe=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_SITE_BRANDING:Nx,DEFAULT_STUDIO_ACCESS:_re,GithubCicdPipelineError:P1,RUN_SSE_EMPTY_RESPONSE_ERROR:mre,RUN_SSE_INCOMPLETE_RESPONSE_ERROR:Ak,RuntimeAccessDeniedError:fO,RuntimeProbeError:fa,attachGithubDeliveryCicdToSourceSync:hAe,bindGithubCicdRuntime:O6,cancelAgentkitDeployment:kre,cancelCronJobRun:Lre,checkRuntimeNameAvailability:g6,clearMessageFeedbackCache:Qne,clearRemoteApps:Une,componentSearch:hre,createCronJob:Ire,createGeneratedAgentTestRun:Gre,createGeneratedAgentTestSession:Yre,createGithubCicdPipeline:yre,createGithubDeliveryCicdPipeline:xre,createGithubDeliveryRollbackPr:Sre,createSession:Jne,deleteAgentFeedbackCases:sre,deleteCronJob:$re,deleteGeneratedAgentTestRun:Hg,deleteMedia:_k,deleteRuntime:zre,deleteSession:uP,deleteSessionMedia:dP,deployAgentkitProject:mO,downloadArtifact:h6,ensureRuntimeRouteChannel:Qre,fetchRemoteApps:Kv,generateAgentDraftFromRequirement:Xre,generateAgentProject:x6,getAgentFeedbackCases:gA,getAgentInfo:hP,getAgentOptimizations:tre,getAgentUsage:Rre,getAutomaticEvaluationStatuses:cP,getCachedAgentFeedbackCases:nre,getCachedRuntimeAgentInfo:dre,getCachedRuntimeDetail:qre,getCronJob:gAe,getGeneratedAgentTestTrace:Wre,getGithubCicdRuntimeBinding:wre,getGithubDeliveryVersions:Ck,getMediaCapabilities:uAe,getMyRuntimes:pAe,getRuntimeAgentInfo:m6,getRuntimeDetail:y6,getRuntimeStudioToolCapabilities:Bre,getRuntimeUpdateCapability:Vre,getRuntimes:gO,getSession:mA,getSessionTrace:s2,getStudioAccess:Are,getStudioUpdatePermissions:Nre,getStudioUpdateStatus:Cre,getSystemInfo:bre,getUiConfig:Tre,initializeGithubDeliveryMain:vre,listApps:qne,listCronJobRuns:bP,listCronJobs:gP,listDeploymentResources:gre,listIdentityUserPools:b6,listModelApiKeys:zne,listModelOptions:fA,listSessions:f6,mediaContentUrl:cre,prefetchAgentFeedbackCases:lAe,prefetchRuntimeAgentInfo:fre,prefetchRuntimeDetail:Hre,previewArtifact:p6,probeRuntimeA2a:Fre,probeRuntimeApps:bA,refreshAgentFeedbackCases:rre,registerRemoteApp:Fne,revealModelApiKey:Vne,revealRuntimeApiKey:Ure,runCronJobNow:Mre,runGeneratedAgentTestSSE:Zre,runSSE:pP,runtimeRegionCandidates:Zv,setClientCloudProvider:Zne,setCronJobEnabled:Pre,startStudioUpdate:jre,studioFetch:Hn,submitIssueFeedback:fP,submitMessageFeedback:ere,syncGithubCicdRuntime:Ere,updateCodexSandboxToolModelEnv:Ore,updateCronJob:Dre,uploadMedia:ore,upsertCachedAgentFeedbackCase:Tk,webSearch:pre},Symbol.toStringTag,{value:"Module"})),KF=Object.freeze({totalTokenCount:0,promptTokenCount:0,candidatesTokenCount:0,thoughtsTokenCount:0,cachedContentTokenCount:0}),Nk=Object.freeze({modelName:"",current:KF,cumulative:KF}),vAe={totalTokenCount:"total_token_count",promptTokenCount:"prompt_token_count",candidatesTokenCount:"candidates_token_count",thoughtsTokenCount:"thoughts_token_count",cachedContentTokenCount:"cached_content_token_count"},wAe=24,SAe=64,EAe=16;function QS(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 kAe(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=QS(t),s=n.reduce((d,f)=>d+SAe+QS(f),0),a=r.reduce((d,f)=>d+EAe+QS(f.name)+QS(f.description??""),0);return wAe+i+s+a}function TAe({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 _Ae(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 gy(e,t){const n=e,r=n[t]??n[vAe[t]];return typeof r=="number"&&Number.isFinite(r)&&r>0?Math.round(r):0}function AAe(e){const t=gy(e,"promptTokenCount"),n=gy(e,"candidatesTokenCount"),r=gy(e,"thoughtsTokenCount");return{totalTokenCount:gy(e,"totalTokenCount")||t+n+r,promptTokenCount:t,candidatesTokenCount:n,thoughtsTokenCount:r,cachedContentTokenCount:gy(e,"cachedContentTokenCount")}}function CAe(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 Kre(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=AAe(s);return a.totalTokenCount===0?i===e.modelName?e:{...e,modelName:i}:{modelName:i,current:a,cumulative:CAe(e.cumulative,a)}}function JF(e){return e.reduce((t,n)=>Kre(t,n),Nk)}function eU(e){return e.blocks.flatMap(t=>t.kind==="tool"?[{name:t.name,args:t.args,response:t.response,done:t.done}]:[])}function NAe(e){const t=e.attributes;return String(t["invocation.id"]??t["gen_ai.invocation.id"]??t["gcp.vertex.agent.invocation_id"]??"")}function jAe(e,t){if(!t)return e;const n=new Set(e.filter(i=>NAe(i)===t).map(i=>i.trace_id)),r=e.filter(i=>n.has(i.trace_id));return r.length>0?r:e}const RAe="send_a2ui_json_to_client",IAe="validated_a2ui_json",OP="adk_request_credential",tU="transfer_to_agent";function DAe(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 Ed(){return{blocks:[],liveStart:0}}const nU=e=>e.functionCall??e.function_call,yP=e=>e.functionResponse??e.function_response;function PAe(e){if(!e||typeof e!="object")return"";const t=e,n=t.agentName??t.agent_name;return typeof n=="string"?n:""}function MAe(e){return e.replace(/-/g,"+").replace(/_/g,"/")}function Jre(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:MAe(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 xP(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 LAe=new Set(["llm","sequential","parallel","loop","a2a"]);function $Ae(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"&&LAe.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 BAe(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 QAe(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 rU(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 FS(e){for(const t of e)t.kind==="thinking"&&(t.done=!0)}function a2(e,t){var l,c,u,d,f,h;const n=e.blocks.map(p=>({...p}));let r=e.liveStart;const i=((l=t.content)==null?void 0:l.parts)??[],s=i.some(p=>nU(p)||yP(p));if(t.partial&&!s){for(const p of i){const b=xP(p);typeof b=="string"&&b&&rU(n,p.thought?"thinking":"text",b)}return{blocks:n,liveStart:r}}n.length=r;for(const p of i){const b=nU(p),g=yP(p),O=Jre([p]),y=xP(p);if(typeof y=="string"&&y)rU(n,p.thought?"thinking":"text",y);else if(O.length)FS(n),BAe(n,O);else if(b)if(FS(n),b.name===tU){const v=PAe(b.args)||((c=t.actions)==null?void 0:c.transferToAgent)||((u=t.actions)==null?void 0:u.transfer_to_agent)||"未知 Agent";n.push({kind:"agent-transfer",agentName:v,done:!1})}else if(b.name===OP){const v=b.args??{},x=v.authConfig??v.auth_config??v,S=String(v.functionCallId??v.function_call_id??"").replace(/^_adk_toolset_auth_/,"")||void 0;n.push({kind:"auth",callId:b.id??"",label:S,authUri:DAe(x),authConfig:x,done:!1})}else n.push({kind:"tool",name:b.name??"",args:b.args,done:!1});else if(g){if(FS(n),g.name===tU)for(let v=n.length-1;v>=0;v--){const x=n[v];if(x.kind==="agent-transfer"&&!x.done){x.done=!0;break}}if(g.name===OP)for(let v=n.length-1;v>=0;v--){const x=n[v];if(x.kind==="auth"&&!x.done){x.done=!0;break}}for(let v=n.length-1;v>=0;v--){const x=n[v];if(x.kind==="tool"&&!x.done&&x.name===g.name){x.done=!0,x.response=g.response;break}}if(g.name===RAe){const v=((d=g.response)==null?void 0:d[IAe])??[];if(v.length){const x=n[n.length-1];x&&x.kind==="a2ui"?x.messages.push(...v):n.push({kind:"a2ui",messages:v})}}}}const a=((f=t.actions)==null?void 0:f.artifactDelta)??((h=t.actions)==null?void 0:h.artifact_delta);return a&&QAe(n,Object.entries(a).map(([p,b])=>({filename:p,version:b}))),FS(n),r=n.length,{blocks:n,liveStart:r}}function FAe(e,t={}){var i,s;const n=[];let r=Ed();for(const a of e)if(a.author==="user"){const c=((i=a.content)==null?void 0:i.parts)??[];if(c.some(p=>{var b;return((b=yP(p))==null?void 0:b.name)===OP})){for(let p=n.length-1;p>=0;p--)if(n[p].role==="assistant"){for(let b=n[p].blocks.length-1;b>=0;b--){const g=n[p].blocks[b];if(g.kind==="auth"){g.done=!0;break}}break}}const u=c.map(xP).filter(p=>!!p).join(""),d=Jre(c),f=$Ae(c);if(!u&&!d.length&&!f){r=Ed();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=Ed()}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=Ed()),r=a2(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 OA(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 eie(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=m.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},v6=e=>{const t=UAe(e),n=m.Children.count(t);return m.Children.map(t,r=>{if(typeof r=="string"&&r.trim())return n<=1?r:o.jsx("span",{children:r});if(m.isValidElement(r)){const i=r,{children:s,...a}=i.props;return s!=null?m.cloneElement(i,a,v6(s)):i}return r})},zAe="_Badge_1viyg_1",VAe={Badge:zAe},bO=({children:e,className:t,variant:n="soft",color:r="secondary",size:i="sm",pill:s,...a})=>o.jsx("div",{className:zr(VAe.Badge,t),"data-color":r,"data-size":i,"data-pill":s?"":void 0,"data-variant":n,...a,children:v6(e)}),qAe=50,iU=48;function HAe(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 XAe(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 GAe(e,t,n){const r=Math.max(0,t-iU),i=Math.min(e.length,t+n+iU);return(r>0?"…":"")+e.slice(r,i).trim()+(i{var c;if((c=l.events)!=null&&c.length)return l;try{return await mA(t,e,l.id)}catch{return l}})),a=[];for(const l of s)for(const{text:c,role:u,ts:d}of HAe(l)){const f=c.toLowerCase().indexOf(r);if(f!==-1){a.push({type:"session",appId:t,sessionId:l.id,title:XAe(l),snippet:GAe(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,qAe)}async function WAe(e,t){if(!e||!t.trim())return{results:[]};let n;try{n=await pre(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 ZAe(e,t,n,r){if(!t||!r.trim())return{results:[]};const i=await hre(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 KAe(e,t,n){return e==="session"?{results:await YAe(n.userId,n.appId,t)}:e==="web"?WAe(n.appId,t):ZAe(e,n.appId,n.userId,t)}function tie({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 JAe(e){return o.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",...e,children:o.jsx(tie,{})})}function eCe(e){return o.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",...e,children:o.jsx(tie,{mirrored:!0})})}function tCe(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 nCe(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 rCe(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 iCe(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 sCe({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 aCe({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 oCe({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(nCe,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"搜索"})]})}function lCe(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 o2(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 sU(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 cCe({userId:e,appId:t,agentInfo:n,capabilitiesLoading:r,agentLabel:i,onOpenSession:s}){var M,j;const[a,l]=m.useState("session"),[c,u]=m.useState(""),[d,f]=m.useState([]),[h,p]=m.useState(),[b,g]=m.useState(!1),[O,y]=m.useState(!1),[v,x]=m.useState(!1),w=m.useRef(0),S=m.useRef(null),E=lCe(t,n,r),k=E.find(P=>P.id===a),T=a==="knowledge"?(M=n==null?void 0:n.components)==null?void 0:M.find(P=>P.source==="knowledgebase"||P.kind==="knowledgebase"):a==="memory"?(j=n==null?void 0:n.components)==null?void 0:j.find(P=>P.source==="long_term_memory"||P.kind==="memory"):void 0;m.useEffect(()=>{w.current+=1,l("session"),f([]),p(void 0),y(!1),g(!1),x(!1)},[t]),m.useEffect(()=>{if(!v)return;function P(L){var U;(U=S.current)!=null&&U.contains(L.target)||x(!1)}return document.addEventListener("pointerdown",P),()=>document.removeEventListener("pointerdown",P)},[v]);async function C(P,L){var z;const U=P.trim();if(!U||!((z=E.find(B=>B.id===L))!=null&&z.ready))return;const F=++w.current;g(!0),y(!0);let q;try{q=await KAe(L,U,{userId:e,appId:t})}catch(B){const V=B instanceof Error?B.message:String(B);q={results:[],note:`搜索失败:${V}`}}F===w.current&&(f(q.results),p(q.note),g(!1))}function N(P){w.current+=1,u(P),f([]),p(void 0),y(!1),g(!1)}function _(P){w.current+=1,l(P),x(!1),f([]),p(void 0),y(!1),g(!1)}const R=!!(k!=null&&k.ready),$=t?a==="web"?"在网络中检索":a==="knowledge"?`在 ${(T==null?void 0:T.name)??"当前 Agent 的知识库"} 中检索`:a==="memory"?`在 ${(T==null?void 0:T.name)??"当前用户的长期记忆"} 中检索`:"在当前 Agent 的会话中检索":"请先选择 Agent",D=T!=null&&T.backend?o2(T.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(P=>!P),children:[o.jsx("span",{children:(k==null?void 0:k.label)??"搜索类型"}),D&&o.jsx("small",{children:D}),o.jsx(aCe,{open:v})]}),v&&o.jsx("div",{className:"search-source-menu",role:"listbox","aria-label":"选择搜索类型",children:E.map(P=>{var F,q;const L=P.id==="knowledge"?(F=n==null?void 0:n.components)==null?void 0:F.find(z=>z.source==="knowledgebase"||z.kind==="knowledgebase"):P.id==="memory"?(q=n==null?void 0:n.components)==null?void 0:q.find(z=>z.source==="long_term_memory"||z.kind==="memory"):void 0,U=L?[L.name,L.backend?o2(L.backend):""].filter(Boolean).join(" · "):P.ready?P.description:P.unavailableLabel;return o.jsxs("button",{type:"button",role:"option","aria-selected":a===P.id,disabled:!P.ready,onClick:()=>_(P.id),children:[o.jsx("span",{children:P.label}),U&&o.jsx("small",{children:U})]},P.id)})})]}),o.jsx("span",{className:"search-box-divider","aria-hidden":!0}),o.jsx("input",{className:"search-input",value:c,onChange:P=>N(P.target.value),onKeyDown:P=>{P.key==="Enter"&&(P.preventDefault(),C(c,a))},placeholder:$,disabled:!R,autoFocus:!0}),o.jsx("button",{className:"search-go",onClick:()=>void C(c,a),disabled:!c.trim()||b,"aria-label":"搜索",children:b?o.jsx(ir,{className:"icon spin"}):o.jsx(sCe,{className:"icon"})})]}),o.jsx("div",{className:"search-results",children:R?O?b?null:h?o.jsx("div",{className:"search-empty",children:h}):d.length===0&&O?o.jsxs("div",{className:"search-empty",children:["未找到匹配「",c.trim(),"」的结果。"]}):d.map((P,L)=>o.jsx(uCe,{result:P,agentLabel:i,onOpen:s},L)):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 uCe({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(Ine,{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?` · ${sU(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(uA,{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(Eb,{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(aU,{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?` · ${o2(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(aU,{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?` · ${o2(e.sourceType)}`:"",e.ts?` · ${sU(e.ts)}`:""]})]}),o.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});default:return null}}function aU({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"})]})}const dCe={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 fCe(e){return dCe[e]}function oU({href:e,label:t,tone:n}){return o.jsxs("a",{className:`agentkit-promo-link is-${n}`,href:e,target:"_blank",rel:"noreferrer","aria-label":`${t},在新窗口打开`,title:t,children:[o.jsx("span",{className:"agentkit-promo-content",children:o.jsx("span",{className:"agentkit-promo-copy",children:t})}),o.jsxs("svg",{className:"agentkit-promo-external-icon",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"})]})]})}function hCe({cloudProvider:e}){const t=fCe(e);return o.jsxs("div",{className:"agentkit-promo-stack",children:[o.jsx(oU,{href:t.console,label:"前往 AgentKit 控制台",tone:"console"}),o.jsx(oU,{href:t.docs,label:"查看 AgentKit 官方文档",tone:"docs"})]})}function pCe({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 mCe({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 nie(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 w6="/assets/media/logo-DCsNZy-k.svg",S6="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",lU="(max-width: 860px)";function gCe(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 bCe(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 OCe={admin:"管理员",developer:"开发者",user:"普通用户"};function cU({role:e}){const t=OCe[e];return o.jsx("span",{className:`studio-role-badge studio-role-badge--${e}`,title:t,children:t})}function yCe({access:e,userInfo:t,onSystemInfo:n,onIssueFeedback:r,onLogout:i}){const[s,a]=m.useState(!1),[l,c]=m.useState("");if(!t)return null;const u=y_e(t),d=typeof t.email=="string"?t.email:"",f=(u||"U").slice(0,1).toUpperCase(),h=bCe(u||d||f),p=x_e(t),b=p===l?"":p;return o.jsxs("div",{className:"sidebar-user",children:[o.jsxs("button",{className:"sidebar-user-btn",onClick:()=>a(g=>!g),title:d?`${u} -${d}`:u,children:[o.jsxs("span",{className:`account-avatar${b?" has-image":""}`,style:h,children:[f,b?o.jsx("img",{className:"account-avatar-image",src:b,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>c(b)}):null]}),o.jsxs("span",{className:"sidebar-user-identity",children:[o.jsxs("span",{className:"sidebar-user-primary",children:[o.jsx("span",{className:"sidebar-user-name",children:u}),o.jsx(cU,{role:e.role})]}),d&&d!==u&&o.jsx("span",{className:"sidebar-user-email",children:d})]})]}),s&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>a(!1)}),o.jsxs("div",{className:"account-pop sidebar-user-pop",children:[o.jsxs("div",{className:"account-head",children:[o.jsxs("span",{className:`account-avatar account-avatar--lg${b?" has-image":""}`,style:h,children:[f,b?o.jsx("img",{className:"account-avatar-image",src:b,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>c(b)}):null]}),o.jsxs("div",{className:"account-id",children:[o.jsxs("div",{className:"account-name-row",children:[o.jsx("div",{className:"account-name",children:u}),o.jsx(cU,{role:e.role})]}),d&&d!==u&&o.jsx("div",{className:"account-sub",children:d})]})]}),o.jsxs("button",{type:"button",className:"account-action",onClick:()=>{a(!1),n()},children:[o.jsx(Ru,{className:"icon"})," 系统信息"]}),o.jsxs("button",{type:"button",className:"account-action",onClick:()=>{a(!1),r()},children:[o.jsx(nie,{className:"icon"})," 问题反馈"]}),o.jsxs("button",{type:"button",className:"account-action",onClick:()=>{a(!1),i()},children:[o.jsx(K2e,{className:"icon"})," 退出登录"]})]})]})]})}function xCe({branding:e,cloudProvider:t,sessions:n,currentSessionId:r,activePage:i,features:s,access:a,streamingSids:l,evaluatingSids:c,sandboxHistory:u,intelligentHistory:d,onNewChat:f,onSearch:h,onQuickCreate:p,onLibrary:b,onAddAgent:g,onMyAgents:O,onApplications:y,onCronJobs:v,onSystemInfo:x,onIssueFeedback:w,onPickSession:S,onDeleteSession:E,userInfo:k,onLogout:T}){const C=L=>(s==null?void 0:s[L])!==!1,[N,_]=m.useState(null),R=m.useRef(typeof window<"u"&&window.matchMedia(lU).matches),[$,D]=m.useState(R.current),M=[...n.map(L=>({kind:"agent",id:L.id,title:OA(L.events),createdAt:(L.lastUpdateTime??0)*1e3,session:L})),...((d==null?void 0:d.sessions)??[]).map(L=>({kind:"intelligent",id:L.id,title:L.displayName||"智能构建",createdAt:Date.parse(L.createdAt)||0,session:L}))].sort((L,U)=>U.createdAt-L.createdAt),j=()=>{R.current=!1,D(L=>!L),_(null)};m.useEffect(()=>{const L=window.matchMedia(lU),U=F=>{F.matches?D(q=>q||(R.current=!0,!0)):R.current&&(R.current=!1,D(!1))};return L.addEventListener("change",U),()=>L.removeEventListener("change",U)},[]);const P=t==="byteplus"?S6:w6;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:f,"aria-label":"返回首页",title:"返回首页",children:[o.jsx("img",{className:"brand-logo",src:e.logoUrl||P,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:j,"aria-label":$?"展开侧边栏":"收起侧边栏",title:$?"展开侧边栏":"收起侧边栏",children:$?o.jsx(eCe,{className:"icon"}):o.jsx(JAe,{className:"icon"})})]}),o.jsxs("nav",{className:"sidebar-nav","aria-label":"主导航",children:[C("newChat")&&o.jsxs("button",{className:`new-chat new-chat--conversation${i==="new-chat"?" is-active":""}`,onClick:f,"aria-label":"新会话","aria-current":i==="new-chat"?"page":void 0,title:"新会话",children:[o.jsx(tCe,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"新会话"})]}),C("search")&&o.jsx(oCe,{active:i==="search",onClick:h}),o.jsxs("button",{className:`new-chat new-chat--agents${i==="agents"?" is-active":""}`,onClick:O,"aria-label":"智能体","aria-current":i==="agents"?"page":void 0,title:"智能体",children:[o.jsx(rCe,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"智能体"})]}),o.jsxs("button",{className:`new-chat new-chat--library${i==="library"?" is-active":""}`,onClick:b,"aria-label":"资源库","aria-current":i==="library"?"page":void 0,title:"资源库",children:[o.jsx(iCe,{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(e2,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"定时任务"}),o.jsx(bO,{className:"sidebar-cronjobs-beta",color:"discovery",variant:"soft",size:"sm",pill:!0,children:"Beta"})]}),o.jsxs("button",{className:`new-chat new-chat--applications${i==="applications"?" is-active":""}`,onClick:y,"aria-label":"自动化","aria-current":i==="applications"?"page":void 0,title:"自动化",children:[o.jsx(gCe,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"自动化"})]})]})]}),C("history")&&o.jsxs("div",{className:"sidebar-history",children:[o.jsxs("div",{className:"history-head",children:[o.jsx("span",{children:"历史会话"}),C("newChat")&&o.jsx("button",{type:"button",className:"history-new-chat",onClick:(u==null?void 0:u.onNew)??f,disabled:u==null?void 0:u.newDisabled,"aria-label":"新建会话",title:"新建会话",children:o.jsx(qa,{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 U=L.id===u.currentThreadId,F=L.name||L.preview||`Thread ${L.id.slice(0,8)}`,q=L.id===u.busyThreadId;return o.jsxs("div",{className:`history-item ${U?"active":""}`,children:[o.jsxs("button",{type:"button",className:"history-item-btn",onClick:()=>u.onSelect(L.id),"aria-current":U?"page":void 0,title:F,disabled:q,children:[o.jsx("span",{className:"history-title",children:F}),U?o.jsx("span",{className:"history-current-badge",children:"当前"}):null]}),o.jsx("button",{type:"button",className:"history-more","aria-label":`管理历史会话:${F}`,title:"更多",disabled:q,onClick:()=>_(z=>z===L.id?null:L.id),children:o.jsx(VF,{className:"icon"})}),N===L.id?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>_(null)}),o.jsx("div",{className:"history-menu",children:o.jsxs("button",{type:"button",className:"menu-item menu-item--danger",onClick:()=>{_(null),u.onDelete(L)},children:[o.jsx(Rh,{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!=null&&d.loading&&M.length===0?o.jsx("div",{className:"history-empty",role:"status",children:"正在加载历史会话…"}):null,d!=null&&d.error?o.jsx("div",{className:"history-error",role:"alert",children:d.error}):null,!(d!=null&&d.loading)&&!(d!=null&&d.error)&&M.length===0?o.jsx("div",{className:"history-empty",children:"暂无会话"}):null,M.map(L=>{const U=`${L.kind}:${L.id}`,F=L.kind==="intelligent",q=F?L.id===(d==null?void 0:d.currentSessionId):L.id===r,z=F?L.id===(d==null?void 0:d.busySessionId):(l==null?void 0:l.has(L.id))===!0,B=!F&&!z&&(c==null?void 0:c.has(L.id))===!0,V=F&&L.id===(d==null?void 0:d.openingSessionId);return o.jsxs("div",{className:`history-item ${q?"active":""}`,children:[o.jsxs("button",{className:"history-item-btn",onClick:()=>L.kind==="intelligent"?d==null?void 0:d.onSelect(L.session):S(L.id),"aria-current":q?"page":void 0,title:L.title,disabled:V,children:[z&&o.jsx("span",{className:"history-streaming",title:F?"正在构建…":"正在生成…","aria-label":F?"正在构建":"正在生成"}),o.jsx("span",{className:"history-title",children:L.title}),B&&o.jsxs("span",{className:"history-evaluating-status",title:"正在自动评测",children:[o.jsx("span",{className:"history-evaluating","aria-hidden":"true"}),"评测中"]})]}),o.jsx("button",{type:"button",className:"history-more","aria-label":`管理历史会话:${L.title}`,title:"更多",disabled:V||F&&z,onClick:()=>_(ce=>ce===U?null:U),children:o.jsx(VF,{className:"icon"})}),N===U&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>_(null)}),o.jsx("div",{className:"history-menu",children:o.jsxs("button",{type:"button",className:"menu-item menu-item--danger",onClick:()=>{_(null),L.kind==="intelligent"?d==null||d.onDelete(L.session):E(L.id)},children:[o.jsx(Rh,{className:"icon"})," 删除"]})})]})]},U)})]})})]}),o.jsxs("div",{className:"sidebar-footer",children:[o.jsx(hCe,{cloudProvider:t}),o.jsx(yCe,{access:a,userInfo:k,onSystemInfo:x,onIssueFeedback:w,onLogout:T})]})]})}function Ss(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{}};function yA(){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}})}jk.prototype=yA.prototype={constructor:jk,on:function(e,t){var n=this._,r=wCe(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)),dU.hasOwnProperty(t)?{space:dU[t],local:e}:e}function ECe(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===vP&&t.documentElement.namespaceURI===vP?t.createElement(e):t.createElementNS(n,e)}}function kCe(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function rie(e){var t=xA(e);return(t.local?kCe:ECe)(t)}function TCe(){}function E6(e){return e==null?TCe:function(){return this.querySelector(e)}}function _Ce(e){typeof e!="function"&&(e=E6(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=x&&(x=v+1);!(S=O[x])&&++x=0;)(a=r[i])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function KCe(e){e||(e=JCe);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 eNe(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function tNe(){return Array.from(this)}function nNe(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?hNe:typeof t=="function"?mNe:pNe)(e,t,n??"")):Tb(this.node(),e)}function Tb(e,t){return e.style.getPropertyValue(t)||lie(e).getComputedStyle(e,null).getPropertyValue(t)}function bNe(e){return function(){delete this[e]}}function ONe(e,t){return function(){this[e]=t}}function yNe(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function xNe(e,t){return arguments.length>1?this.each((t==null?bNe:typeof t=="function"?yNe:ONe)(e,t)):this.node()[e]}function cie(e){return e.trim().split(/^|\s+/)}function k6(e){return e.classList||new uie(e)}function uie(e){this._node=e,this._names=cie(e.getAttribute("class")||"")}uie.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 die(e,t){for(var n=k6(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function GNe(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,s;n()=>e;function wP(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}})}wP.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function ije(e){return!e.ctrlKey&&!e.button}function sje(){return this.parentNode}function aje(e,t){return t??{x:e.x,y:e.y}}function oje(){return navigator.maxTouchPoints||"ontouchstart"in this}function bie(){var e=ije,t=sje,n=aje,r=oje,i={},s=yA("start","drag","end"),a=0,l,c,u,d,f=0;function h(w){w.on("mousedown.drag",p).filter(r).on("touchstart.drag",O).on("touchmove.drag",y,rje).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(w,S){if(!(d||!e.call(this,w,S))){var E=x(this,t.call(this,w,S),w,S,"mouse");E&&(Xo(w.view).on("mousemove.drag",b,jx).on("mouseup.drag",g,jx),mie(w.view),Fj(w),u=!1,l=w.clientX,c=w.clientY,E("start",w))}}function b(w){if(F0(w),!u){var S=w.clientX-l,E=w.clientY-c;u=S*S+E*E>f}i.mouse("drag",w)}function g(w){Xo(w.view).on("mousemove.drag mouseup.drag",null),gie(w.view,u),F0(w),i.mouse("end",w)}function O(w,S){if(e.call(this,w,S)){var E=w.changedTouches,k=t.call(this,w,S),T=E.length,C,N;for(C=0;C>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?zS(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?zS(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=cje.exec(e))?new fo(t[1],t[2],t[3],1):(t=uje.exec(e))?new fo(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=dje.exec(e))?zS(t[1],t[2],t[3],t[4]):(t=fje.exec(e))?zS(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=hje.exec(e))?OU(t[1],t[2]/100,t[3]/100,1):(t=pje.exec(e))?OU(t[1],t[2]/100,t[3]/100,t[4]):fU.hasOwnProperty(e)?mU(fU[e]):e==="transparent"?new fo(NaN,NaN,NaN,0):null}function mU(e){return new fo(e>>16&255,e>>8&255,e&255,1)}function zS(e,t,n,r){return r<=0&&(e=t=n=NaN),new fo(e,t,n,r)}function bje(e){return e instanceof ew||(e=Sm(e)),e?(e=e.rgb(),new fo(e.r,e.g,e.b,e.opacity)):new fo}function SP(e,t,n,r){return arguments.length===1?bje(e):new fo(e,t,n,r??1)}function fo(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}T6(fo,SP,Oie(ew,{brighter(e){return e=e==null?c2:Math.pow(c2,e),new fo(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Rx:Math.pow(Rx,e),new fo(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new fo(cm(this.r),cm(this.g),cm(this.b),u2(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:gU,formatHex:gU,formatHex8:Oje,formatRgb:bU,toString:bU}));function gU(){return`#${Xp(this.r)}${Xp(this.g)}${Xp(this.b)}`}function Oje(){return`#${Xp(this.r)}${Xp(this.g)}${Xp(this.b)}${Xp((isNaN(this.opacity)?1:this.opacity)*255)}`}function bU(){const e=u2(this.opacity);return`${e===1?"rgb(":"rgba("}${cm(this.r)}, ${cm(this.g)}, ${cm(this.b)}${e===1?")":`, ${e})`}`}function u2(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function cm(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Xp(e){return e=cm(e),(e<16?"0":"")+e.toString(16)}function OU(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new mc(e,t,n,r)}function yie(e){if(e instanceof mc)return new mc(e.h,e.s,e.l,e.opacity);if(e instanceof ew||(e=Sm(e)),!e)return new mc;if(e instanceof mc)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 mc(a,l,c,e.opacity)}function yje(e,t,n,r){return arguments.length===1?yie(e):new mc(e,t,n,r??1)}function mc(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}T6(mc,yje,Oie(ew,{brighter(e){return e=e==null?c2:Math.pow(c2,e),new mc(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Rx:Math.pow(Rx,e),new mc(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 fo(Uj(e>=240?e-240:e+120,i,r),Uj(e,i,r),Uj(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new mc(yU(this.h),VS(this.s),VS(this.l),u2(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=u2(this.opacity);return`${e===1?"hsl(":"hsla("}${yU(this.h)}, ${VS(this.s)*100}%, ${VS(this.l)*100}%${e===1?")":`, ${e})`}`}}));function yU(e){return e=(e||0)%360,e<0?e+360:e}function VS(e){return Math.max(0,Math.min(1,e||0))}function Uj(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 vA=e=>()=>e;function xie(e,t){return function(n){return e+n*t}}function xje(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 STt(e,t){var n=t-e;return n?xie(e,n>180||n<-180?n-360*Math.round(n/360):n):vA(isNaN(e)?t:e)}function vje(e){return(e=+e)==1?vie:function(t,n){return n-t?xje(t,n,e):vA(isNaN(t)?n:t)}}function vie(e,t){var n=t-e;return n?xie(e,n):vA(isNaN(e)?t:e)}const d2=function e(t){var n=vje(t);function r(i,s){var a=n((i=SP(i)).r,(s=SP(s)).r),l=n(i.g,s.g),c=n(i.b,s.b),u=vie(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 wje(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:nu(r,i)})),n=zj.lastIndex;return n180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(i(f)+"rotate(",null,r)-2,x:nu(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:nu(u,d)}):d&&f.push(i(f)+"skewX("+d+r)}function c(u,d,f,h,p,b){if(u!==f||d!==h){var g=p.push(i(p)+"scale(",null,",",null,")");b.push({i:g-4,x:nu(u,f)},{i:g-2,x:nu(d,h)})}else(f!==1||h!==1)&&p.push(i(p)+"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(p){for(var b=-1,g=h.length,O;++b=0&&e._call.call(void 0,t),e=e._next;--_b}function wU(){Em=(h2=Dx.now())+wA,_b=Jy=0;try{Lje()}finally{_b=0,Bje(),Em=0}}function $je(){var e=Dx.now(),t=e-h2;t>kie&&(wA-=t,h2=e)}function Bje(){for(var e,t=f2,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:f2=n);e1=e,TP(r)}function TP(e){if(!_b){Jy&&(Jy=clearTimeout(Jy));var t=e-Em;t>24?(e<1/0&&(Jy=setTimeout(wU,e-Dx.now()-wA)),by&&(by=clearInterval(by))):(by||(h2=Dx.now(),by=setInterval($je,kie)),_b=1,Tie(wU))}}function SU(e,t,n){var r=new p2;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var Qje=yA("start","end","cancel","interrupt"),Fje=[],Aie=0,EU=1,_P=2,Ik=3,kU=4,AP=5,Dk=6;function SA(e,t,n,r,i,s){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;Uje(e,n,{name:t,index:r,group:i,on:Qje,tween:Fje,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Aie})}function A6(e,t){var n=Nc(e,t);if(n.state>Aie)throw new Error("too late; already scheduled");return n}function Iu(e,t){var n=Nc(e,t);if(n.state>Ik)throw new Error("too late; already running");return n}function Nc(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Uje(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=_ie(s,0,n.time);function s(u){n.state=EU,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var d,f,h,p;if(n.state!==EU)return c();for(d in r)if(p=r[d],p.name===n.name){if(p.state===Ik)return SU(a);p.state===kU?(p.state=Dk,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete r[d]):+d_P&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function ORe(e,t,n){var r,i,s=bRe(t)?A6:Iu;return function(){var a=s(this,e),l=a.on;l!==r&&(i=(r=l).copy()).on(t,n),a.on=i}}function yRe(e,t){var n=this._id;return arguments.length<2?Nc(this.node(),n).on.on(e):this.each(ORe(n,e,t))}function xRe(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function vRe(){return this.on("end.remove",xRe(this._id))}function wRe(e){var t=this._name,n=this._id;typeof e!="function"&&(e=E6(e));for(var r=this._groups,i=r.length,s=new Array(i),a=0;a()=>e;function XRe(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 kd(e,t,n){this.k=e,this.x=t,this.y=n}kd.prototype={constructor:kd,scale:function(e){return e===1?this:new kd(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new kd(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 EA=new kd(1,0,0);Rie.prototype=kd.prototype;function Rie(e){for(;!e.__zoom;)if(!(e=e.parentNode))return EA;return e.__zoom}function Vj(e){e.stopImmediatePropagation()}function Oy(e){e.preventDefault(),e.stopImmediatePropagation()}function GRe(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function YRe(){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 TU(){return this.__zoom||EA}function WRe(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function ZRe(){return navigator.maxTouchPoints||"ontouchstart"in this}function KRe(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 Iie(){var e=GRe,t=YRe,n=KRe,r=WRe,i=ZRe,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Rk,u=yA("start","zoom","end"),d,f,h,p=500,b=150,g=0,O=10;function y(D){D.property("__zoom",TU).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",C).on("dblclick.zoom",N).filter(i).on("touchstart.zoom",_).on("touchmove.zoom",R).on("touchend.zoom touchcancel.zoom",$).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(D,M,j,P){var L=D.selection?D.selection():D;L.property("__zoom",TU),D!==L?S(D,M,j,P):L.interrupt().each(function(){E(this,arguments).event(P).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},y.scaleBy=function(D,M,j,P){y.scaleTo(D,function(){var L=this.__zoom.k,U=typeof M=="function"?M.apply(this,arguments):M;return L*U},j,P)},y.scaleTo=function(D,M,j,P){y.transform(D,function(){var L=t.apply(this,arguments),U=this.__zoom,F=j==null?w(L):typeof j=="function"?j.apply(this,arguments):j,q=U.invert(F),z=typeof M=="function"?M.apply(this,arguments):M;return n(x(v(U,z),F,q),L,a)},j,P)},y.translateBy=function(D,M,j,P){y.transform(D,function(){return n(this.__zoom.translate(typeof M=="function"?M.apply(this,arguments):M,typeof j=="function"?j.apply(this,arguments):j),t.apply(this,arguments),a)},null,P)},y.translateTo=function(D,M,j,P,L){y.transform(D,function(){var U=t.apply(this,arguments),F=this.__zoom,q=P==null?w(U):typeof P=="function"?P.apply(this,arguments):P;return n(EA.translate(q[0],q[1]).scale(F.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof j=="function"?-j.apply(this,arguments):-j),U,a)},P,L)};function v(D,M){return M=Math.max(s[0],Math.min(s[1],M)),M===D.k?D:new kd(M,D.x,D.y)}function x(D,M,j){var P=M[0]-j[0]*D.k,L=M[1]-j[1]*D.k;return P===D.x&&L===D.y?D:new kd(D.k,P,L)}function w(D){return[(+D[0][0]+ +D[1][0])/2,(+D[0][1]+ +D[1][1])/2]}function S(D,M,j,P){D.on("start.zoom",function(){E(this,arguments).event(P).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(P).end()}).tween("zoom",function(){var L=this,U=arguments,F=E(L,U).event(P),q=t.apply(L,U),z=j==null?w(q):typeof j=="function"?j.apply(L,U):j,B=Math.max(q[1][0]-q[0][0],q[1][1]-q[0][1]),V=L.__zoom,ce=typeof M=="function"?M.apply(L,U):M,we=c(V.invert(z).concat(B/V.k),ce.invert(z).concat(B/ce.k));return function(Oe){if(Oe===1)Oe=ce;else{var de=we(Oe),Z=B/de[2];Oe=new kd(Z,z[0]-de[0]*Z,z[1]-de[1]*Z)}F.zoom(null,Oe)}})}function E(D,M,j){return!j&&D.__zooming||new k(D,M)}function k(D,M){this.that=D,this.args=M,this.active=0,this.sourceEvent=null,this.extent=t.apply(D,M),this.taps=0}k.prototype={event:function(D){return D&&(this.sourceEvent=D),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(D,M){return this.mouse&&D!=="mouse"&&(this.mouse[1]=M.invert(this.mouse[0])),this.touch0&&D!=="touch"&&(this.touch0[1]=M.invert(this.touch0[0])),this.touch1&&D!=="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(D){var M=Xo(this.that).datum();u.call(D,this.that,new XRe(D,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:u}),M)}};function T(D,...M){if(!e.apply(this,arguments))return;var j=E(this,M).event(D),P=this.__zoom,L=Math.max(s[0],Math.min(s[1],P.k*Math.pow(2,r.apply(this,arguments)))),U=fc(D);if(j.wheel)(j.mouse[0][0]!==U[0]||j.mouse[0][1]!==U[1])&&(j.mouse[1]=P.invert(j.mouse[0]=U)),clearTimeout(j.wheel);else{if(P.k===L)return;j.mouse=[U,P.invert(U)],Pk(this),j.start()}Oy(D),j.wheel=setTimeout(F,b),j.zoom("mouse",n(x(v(P,L),j.mouse[0],j.mouse[1]),j.extent,a));function F(){j.wheel=null,j.end()}}function C(D,...M){if(h||!e.apply(this,arguments))return;var j=D.currentTarget,P=E(this,M,!0).event(D),L=Xo(D.view).on("mousemove.zoom",z,!0).on("mouseup.zoom",B,!0),U=fc(D,j),F=D.clientX,q=D.clientY;mie(D.view),Vj(D),P.mouse=[U,this.__zoom.invert(U)],Pk(this),P.start();function z(V){if(Oy(V),!P.moved){var ce=V.clientX-F,we=V.clientY-q;P.moved=ce*ce+we*we>g}P.event(V).zoom("mouse",n(x(P.that.__zoom,P.mouse[0]=fc(V,j),P.mouse[1]),P.extent,a))}function B(V){L.on("mousemove.zoom mouseup.zoom",null),gie(V.view,P.moved),Oy(V),P.event(V).end()}}function N(D,...M){if(e.apply(this,arguments)){var j=this.__zoom,P=fc(D.changedTouches?D.changedTouches[0]:D,this),L=j.invert(P),U=j.k*(D.shiftKey?.5:2),F=n(x(v(j,U),P,L),t.apply(this,M),a);Oy(D),l>0?Xo(this).transition().duration(l).call(S,F,P,D):Xo(this).call(y.transform,F,P,D)}}function _(D,...M){if(e.apply(this,arguments)){var j=D.touches,P=j.length,L=E(this,M,D.changedTouches.length===P).event(D),U,F,q,z;for(Vj(D),F=0;F`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.`},Px=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Die=["Enter"," ","Escape"],Pie={"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 Ab;(function(e){e.Strict="strict",e.Loose="loose"})(Ab||(Ab={}));var um;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(um||(um={}));var Mx;(function(e){e.Partial="partial",e.Full="full"})(Mx||(Mx={}));const Mie={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Wf;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Wf||(Wf={}));var Lx;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Lx||(Lx={}));var Nt;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Nt||(Nt={}));const _U={[Nt.Left]:Nt.Right,[Nt.Right]:Nt.Left,[Nt.Top]:Nt.Bottom,[Nt.Bottom]:Nt.Top};function Lie(e){return e===null?null:e?"valid":"invalid"}const $ie=e=>"id"in e&&"source"in e&&"target"in e,JRe=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),N6=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),tw=(e,t=[0,0])=>{const{width:n,height:r}=of(e),i=e.origin??t,s=n*i[0],a=r*i[1];return{x:e.position.x-s,y:e.position.y-a}},eIe=(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):N6(i)?i:t.nodeLookup.get(i.id));const l=a?m2(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return kA(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return TA(n)},nw=(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=kA(n,m2(i)),r=!0)}),r?TA(n):{x:0,y:0,width:0,height:0}},j6=(e,t,[n,r,i]=[0,0,1],s=!1,a=!1)=>{const l={...OO(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 p=d.width??u.width??u.initialWidth??null,b=d.height??u.height??u.initialHeight??null,g=$x(l,Nb(u)),O=(p??0)*(b??0),y=s&&g>0;(!u.internals.handleBounds||y||g>=O||u.dragging)&&c.push(u)}return c},tIe=(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 nIe(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 rIe({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:s},a){if(e.size===0)return!0;const l=nIe(e,a),c=nw(l),u=I6(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 Bie({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",Tc.error005());else{const p=l.measured.width,b=l.measured.height;p&&b&&(f=[[c,u],[c+p,u+b]])}else l&&Tm(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=Tm(f)?km(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(s==null||s("015",Tc.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 iIe({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 p=s.has(h.id),b=!p&&h.parentId&&a.find(g=>g.id===h.parentId);(p||b)&&a.push(h)}const l=new Set(t.map(h=>h.id)),c=r.filter(h=>h.deletable!==!1),d=tIe(a,c);for(const h of c)l.has(h.id)&&!d.find(b=>b.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 Cb=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),km=(e={x:0,y:0},t,n)=>({x:Cb(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Cb(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function Qie(e,t,n){const{width:r,height:i}=of(n),{x:s,y:a}=n.internals.positionAbsolute;return km(e,[[s,a],[s+r,a+i]],t)}const AU=(e,t,n)=>en?-Cb(Math.abs(e-n),1,t)/t:0,R6=(e,t,n=15,r=40)=>{const i=AU(e.x,r,t.width-r)*n,s=AU(e.y,r,t.height-r)*n;return[i,s]},kA=(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)}),CP=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),TA=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Nb=(e,t=[0,0])=>{var i,s;const{x:n,y:r}=N6(e)?e.internals.positionAbsolute:tw(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}},m2=(e,t=[0,0])=>{var i,s;const{x:n,y:r}=N6(e)?e.internals.positionAbsolute:tw(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)}},Fie=(e,t)=>TA(kA(CP(e),CP(t))),$x=(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)},CU=e=>bc(e.width)&&bc(e.height)&&bc(e.x)&&bc(e.y),bc=e=>!isNaN(e)&&isFinite(e),Uie=(e,t)=>(n,r)=>{},rw=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),OO=({x:e,y:t},[n,r,i],s=!1,a=[1,1])=>{const l={x:(e-n)/i,y:(t-r)/i};return s?rw(l,a):l},jb=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function Sg(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 sIe(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Sg(e,n),i=Sg(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e=="object"){const r=Sg(e.top??e.y??0,n),i=Sg(e.bottom??e.y??0,n),s=Sg(e.left??e.x??0,t),a=Sg(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 aIe(e,t,n,r,i,s){const{x:a,y:l}=jb(e,[t,n,r]),{x:c,y:u}=jb({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 I6=(e,t,n,r,i,s)=>{const a=sIe(s,t,n),l=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(l,c),d=Cb(u,r,i),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d,b=n/2-h*d,g=aIe(e,p,b,d,t,n),O={left:Math.min(g.left-a.left,0),top:Math.min(g.top-a.top,0),right:Math.min(g.right-a.right,0),bottom:Math.min(g.bottom-a.bottom,0)};return{x:p-O.left+O.right,y:b-O.top+O.bottom,zoom:d}},Bx=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Tm(e){return e!=null&&e!=="parent"}function of(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 D6(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 zie(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 NU(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function oIe(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}function lIe(e){return{...Pie,...e||{}}}function L1(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){const{x:s,y:a}=Oc(e),l=OO({x:s-((i==null?void 0:i.left)??0),y:a-((i==null?void 0:i.top)??0)},r),{x:c,y:u}=n?rw(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const P6=e=>({width:e.offsetWidth,height:e.offsetHeight}),Vie=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},cIe=["INPUT","SELECT","TEXTAREA"];function qie(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:cIe.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Hie=e=>"clientX"in e,Oc=(e,t)=>{var s,a;const n=Hie(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)}},jU=(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,...P6(a)}})};function Xie({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 XS(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function RU({pos:e,x1:t,y1:n,x2:r,y2:i,c:s}){switch(e){case Nt.Left:return[t-XS(t-r,s),n];case Nt.Right:return[t+XS(r-t,s),n];case Nt.Top:return[t,n-XS(n-i,s)];case Nt.Bottom:return[t,n+XS(i-n,s)]}}function Gie({sourceX:e,sourceY:t,sourcePosition:n=Nt.Bottom,targetX:r,targetY:i,targetPosition:s=Nt.Top,curvature:a=.25}){const[l,c]=RU({pos:n,x1:e,y1:t,x2:r,y2:i,c:a}),[u,d]=RU({pos:s,x1:r,y1:i,x2:e,y2:t,c:a}),[f,h,p,b]=Xie({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,p,b]}function Yie({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,s=n0}const fIe=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,hIe=(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)),pIe=(e,t,n={})=>{var s;if(!e.source||!e.target)return(s=n.onError)==null||s.call(n,"006",Tc.error006()),t;const r=n.getEdgeId||fIe;let i;return $ie(e)?i={...e}:i={...e,id:r(e)},hIe(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function Wie({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,s,a,l]=Yie({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,s,a,l]}const IU={[Nt.Left]:{x:-1,y:0},[Nt.Right]:{x:1,y:0},[Nt.Top]:{x:0,y:-1},[Nt.Bottom]:{x:0,y:1}},mIe=({source:e,sourcePosition:t=Nt.Bottom,target:n})=>t===Nt.Left||t===Nt.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function gIe({source:e,sourcePosition:t=Nt.Bottom,target:n,targetPosition:r=Nt.Top,center:i,offset:s,stepPosition:a}){const l=IU[t],c=IU[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=mIe({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",p=f[h];let b=[],g,O;const y={x:0,y:0},v={x:0,y:0},[,,x,w]=Yie({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[h]*c[h]===-1){h==="x"?(g=i.x??u.x+(d.x-u.x)*a,O=i.y??(u.y+d.y)/2):(g=i.x??(u.x+d.x)/2,O=i.y??u.y+(d.y-u.y)*a);const T=[{x:g,y:u.y},{x:g,y:d.y}],C=[{x:u.x,y:O},{x:d.x,y:O}];l[h]===p?b=h==="x"?T:C:b=h==="x"?C:T}else{const T=[{x:u.x,y:d.y}],C=[{x:d.x,y:u.y}];if(h==="x"?b=l.x===p?C:T:b=l.y===p?T:C,t===r){const D=Math.abs(e[h]-n[h]);if(D<=s){const M=Math.min(s-1,s-D);l[h]===p?y[h]=(u[h]>e[h]?-1:1)*M:v[h]=(d[h]>n[h]?-1:1)*M}}if(t!==r){const D=h==="x"?"y":"x",M=l[h]===c[D],j=u[D]>d[D],P=u[D]=$?(g=(N.x+_.x)/2,O=b[0].y):(g=b[0].x,O=(N.y+_.y)/2)}const S={x:u.x+y.x,y:u.y+y.y},E={x:d.x+v.x,y:d.y+v.y};return[[e,...S.x!==b[0].x||S.y!==b[0].y?[S]:[],...b,...E.x!==b[b.length-1].x||E.y!==b[b.length-1].y?[E]:[],n],g,O,x,w]}function bIe(e,t,n,r){const i=Math.min(DU(e,t)/2,DU(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 NP(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function yIe(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=NP(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 Zie=1e3,xIe=10,M6={nodeOrigin:[0,0],nodeExtent:Px,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},vIe={...M6,checkEquality:!0};function L6(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function wIe(e,t,n){const r=L6(M6,n);for(const i of e.values())if(i.parentId)B6(i,e,t,r);else{const s=tw(i,r.nodeOrigin),a=Tm(i.extent)?i.extent:r.nodeExtent,l=km(s,a,of(i));i.internals.positionAbsolute=l}}function SIe(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 $6(e){return e==="manual"}function jP(e,t,n,r={}){var d,f;const i=L6(vIe,r),s={i:0},a=new Map(t),l=i!=null&&i.elevateNodesOnSelect&&!$6(i.zIndexMode)?Zie:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const h of e){let p=a.get(h.id);if(i.checkEquality&&h===(p==null?void 0:p.internals.userNode))t.set(h.id,p);else{const b=tw(h,i.nodeOrigin),g=Tm(h.extent)?h.extent:i.nodeExtent,O=km(b,g,of(h));p={...i.defaults,...h,measured:{width:(d=h.measured)==null?void 0:d.width,height:(f=h.measured)==null?void 0:f.height},internals:{positionAbsolute:O,handleBounds:SIe(h,p),z:Kie(h,l,i.zIndexMode),userNode:h}},t.set(h.id,p)}(p.measured===void 0||p.measured.width===void 0||p.measured.height===void 0)&&!p.hidden&&(c=!1),h.parentId&&B6(p,t,n,r,s),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function EIe(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 B6(e,t,n,r,i){const{elevateNodesOnSelect:s,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=L6(M6,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}EIe(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*xIe),i&&d.internals.rootParentIndex!==void 0&&(i.i=d.internals.rootParentIndex);const f=s&&!$6(c)?Zie:0,{x:h,y:p,z:b}=kIe(e,d,a,l,f,c),{positionAbsolute:g}=e.internals,O=h!==g.x||p!==g.y;(O||b!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:O?{x:h,y:p}:g,z:b}})}function Kie(e,t,n){const r=bc(e.zIndex)?e.zIndex:0;return $6(n)?r:r+(e.selected?t:0)}function kIe(e,t,n,r,i,s){const{x:a,y:l}=t.internals.positionAbsolute,c=of(e),u=tw(e,n),d=Tm(e.extent)?km(u,e.extent,c):u;let f=km({x:a+d.x,y:l+d.y},r,c);e.extent==="parent"&&(f=Qie(f,c,t));const h=Kie(e,i,s),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=h?p+1:h}}function Q6(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)??Nb(c),d=Fie(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=of(c),h=c.origin??r,p=l.x0||b>0||y||v)&&(i.push({id:u,type:"position",position:{x:c.position.x-p+y,y:c.position.y-b+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+p,y:w.position.y+b}})})),(f.width0){const p=Q6(h,t,n,i);u.push(...p)}return{changes:u,updatedInternals:c}}async function _Ie({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 $U(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 Jie(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}`;$U("source",c,d,e,i,a),$U("target",c,u,e,s,l),t.set(r.id,r)}}function ese(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:ese(n,t):!1}function BU(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 AIe(e,t,n,r){const i=new Map;for(const[s,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!ese(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 qj({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 CIe({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=rw(s,t);return{x:a.x-s.x,y:a.y-s.y}}function NIe({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,p=!1,b=!1,g=null;function O({noDragClassName:v,handleSelector:x,domNode:w,isSelectable:S,nodeId:E,nodeClickDistance:k=0}){h=Xo(w);function T({x:R,y:$}){const{nodeLookup:D,nodeExtent:M,snapGrid:j,snapToGrid:P,nodeOrigin:L,onNodeDrag:U,onSelectionDrag:F,onError:q,updateNodePositions:z}=t();s={x:R,y:$};let B=!1;const V=l.size>1,ce=V&&M?CP(nw(l)):null,we=V&&P?CIe({dragItems:l,snapGrid:j,x:R,y:$}):null;for(const[Oe,de]of l){if(!D.has(Oe))continue;let Z={x:R-de.distance.x,y:$-de.distance.y};P&&(Z=we?{x:Math.round(Z.x+we.x),y:Math.round(Z.y+we.y)}:rw(Z,j));let J=null;if(V&&M&&!de.extent&&ce){const{positionAbsolute:je}=de.internals,Qe=je.x-ce.x+M[0][0],Me=je.x+de.measured.width-ce.x2+M[1][0],le=je.y-ce.y+M[0][1],ke=je.y+de.measured.height-ce.y2+M[1][1];J=[[Qe,le],[Me,ke]]}const{position:fe,positionAbsolute:be}=Bie({nodeId:Oe,nextPosition:Z,nodeLookup:D,nodeExtent:J||M,nodeOrigin:L,onError:q});B=B||de.position.x!==fe.x||de.position.y!==fe.y,de.position=fe,de.internals.positionAbsolute=be}if(b=b||B,!!B&&(z(l,!0),g&&(r||U||!E&&F))){const[Oe,de]=qj({nodeId:E,dragItems:l,nodeLookup:D});r==null||r(g,l,Oe,de),U==null||U(g,Oe,de),E||F==null||F(g,de)}}async function C(){if(!d)return;const{transform:R,panBy:$,autoPanSpeed:D,autoPanOnNodeDrag:M}=t();if(!M){c=!1,cancelAnimationFrame(a);return}const[j,P]=R6(u,d,D);(j!==0||P!==0)&&(s.x=(s.x??0)-j/R[2],s.y=(s.y??0)-P/R[2],await $({x:j,y:P})&&T(s)),a=requestAnimationFrame(C)}function N(R){var V;const{nodeLookup:$,multiSelectionActive:D,nodesDraggable:M,transform:j,snapGrid:P,snapToGrid:L,selectNodesOnDrag:U,onNodeDragStart:F,onSelectionDragStart:q,unselectNodesAndEdges:z}=t();f=!0,(!U||!S)&&!D&&E&&((V=$.get(E))!=null&&V.selected||z()),S&&U&&E&&(e==null||e(E));const B=L1(R.sourceEvent,{transform:j,snapGrid:P,snapToGrid:L,containerBounds:d});if(s=B,l=AIe($,M,B,E),l.size>0&&(n||F||!E&&q)){const[ce,we]=qj({nodeId:E,dragItems:l,nodeLookup:$});n==null||n(R.sourceEvent,l,ce,we),F==null||F(R.sourceEvent,ce,we),E||q==null||q(R.sourceEvent,we)}}const _=bie().clickDistance(k).on("start",R=>{const{domNode:$,nodeDragThreshold:D,transform:M,snapGrid:j,snapToGrid:P}=t();d=($==null?void 0:$.getBoundingClientRect())||null,p=!1,b=!1,g=R.sourceEvent,D===0&&N(R),s=L1(R.sourceEvent,{transform:M,snapGrid:j,snapToGrid:P,containerBounds:d}),u=Oc(R.sourceEvent,d)}).on("drag",R=>{const{autoPanOnNodeDrag:$,transform:D,snapGrid:M,snapToGrid:j,nodeDragThreshold:P,nodeLookup:L}=t(),U=L1(R.sourceEvent,{transform:D,snapGrid:M,snapToGrid:j,containerBounds:d});if(g=R.sourceEvent,(R.sourceEvent.type==="touchmove"&&R.sourceEvent.touches.length>1||E&&!L.has(E))&&(p=!0),!p){if(!c&&$&&f&&(c=!0,C()),!f){const F=Oc(R.sourceEvent,d),q=F.x-u.x,z=F.y-u.y;Math.sqrt(q*q+z*z)>P&&N(R)}(s.x!==U.xSnapped||s.y!==U.ySnapped)&&l&&f&&(u=Oc(R.sourceEvent,d),T(U))}}).on("end",R=>{if(!f||p){p&&l.size>0&&t().updateNodePositions(l,!1);return}if(c=!1,f=!1,cancelAnimationFrame(a),l.size>0){const{nodeLookup:$,updateNodePositions:D,onNodeDragStop:M,onSelectionDragStop:j}=t();if(b&&(D(l,!1),b=!1),i||M||!E&&j){const[P,L]=qj({nodeId:E,dragItems:l,nodeLookup:$,dragging:!1});i==null||i(R.sourceEvent,l,P,L),M==null||M(R.sourceEvent,P,L),E||j==null||j(R.sourceEvent,L)}}}).filter(R=>{const $=R.target;return!R.button&&(!v||!BU($,`.${v}`,w))&&(!x||BU($,x,w))});h.call(_)}function y(){h==null||h.on(".drag",null)}return{update:O,destroy:y}}function jIe(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())$x(i,Nb(s))>0&&r.push(s);return r}const RIe=250;function IIe(e,t,n,r){var l,c;let i=[],s=1/0;const a=jIe(e,n,t+RIe);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:p}=_m(u,f,f.position,!0),b=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(p-e.y,2));b>t||(b1){const u=r.type==="source"?"target":"source";return i.find(d=>d.type===u)??i[0]}return i[0]}function tse(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,..._m(a,c,c.position,!0)}:c}function nse(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function DIe(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const rse=()=>!0;function PIe(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:p,onConnectStart:b,onConnect:g,onConnectEnd:O,isValidConnection:y=rse,onReconnectEnd:v,updateConnection:x,getTransform:w,getFromHandle:S,autoPanSpeed:E,dragThreshold:k=1,handleDomNode:T}){const C=Vie(e.target);let N=0,_;const{x:R,y:$}=Oc(e),D=nse(s,T),M=l==null?void 0:l.getBoundingClientRect();let j=!1;if(!M||!D)return;const P=tse(i,D,r,c,t);if(!P)return;let L=Oc(e,M),U=!1,F=null,q=!1,z=null;function B(){if(!d||!M)return;const[fe,be]=R6(L,M,E);h({x:fe,y:be}),N=requestAnimationFrame(B)}const V={...P,nodeId:i,type:D,position:P.position},ce=c.get(i);let Oe={inProgress:!0,isValid:null,from:_m(ce,V,Nt.Left,!0),fromHandle:V,fromPosition:V.position,fromNode:ce,to:L,toHandle:null,toPosition:_U[V.position],toNode:null,pointer:L};function de(){j=!0,x(Oe),b==null||b(e,{nodeId:i,handleId:r,handleType:D})}k===0&&de();function Z(fe){if(!j){const{x:ke,y:ye}=Oc(fe),$e=ke-R,ze=ye-$;if(!($e*$e+ze*ze>k*k))return;de()}if(!S()||!V){J(fe);return}const be=w();L=Oc(fe,M),_=IIe(OO(L,be,!1,[1,1]),n,c,V),U||(B(),U=!0);const je=ise(fe,{handle:_,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:a?"target":"source",isValidConnection:y,doc:C,lib:u,flowId:f,nodeLookup:c});z=je.handleDomNode,F=je.connection,q=DIe(!!_,je.isValid);const Qe=c.get(i),Me=Qe?_m(Qe,V,Nt.Left,!0):Oe.from,le={...Oe,from:Me,isValid:q,to:je.toHandle&&q?jb({x:je.toHandle.x,y:je.toHandle.y},be):L,toHandle:je.toHandle,toPosition:q&&je.toHandle?je.toHandle.position:_U[V.position],toNode:je.toHandle?c.get(je.toHandle.nodeId):null,pointer:L};x(le),Oe=le}function J(fe){if(!("touches"in fe&&fe.touches.length>0)){if(j){(_||z)&&F&&q&&(g==null||g(F));const{inProgress:be,...je}=Oe,Qe={...je,toPosition:Oe.toHandle?Oe.toPosition:null};O==null||O(fe,Qe),s&&(v==null||v(fe,Qe))}p(),cancelAnimationFrame(N),U=!1,q=!1,F=null,z=null,C.removeEventListener("mousemove",Z),C.removeEventListener("mouseup",J),C.removeEventListener("touchmove",Z),C.removeEventListener("touchend",J)}}C.addEventListener("mousemove",Z),C.addEventListener("mouseup",J),C.addEventListener("touchmove",Z),C.addEventListener("touchend",J)}function ise(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:s,doc:a,lib:l,flowId:c,isValidConnection:u=rse,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:p,y:b}=Oc(e),g=a.elementFromPoint(p,b),O=g!=null&&g.classList.contains(`${l}-flow__handle`)?g:h,y={handleDomNode:O,isValid:!1,connection:null,toHandle:null};if(O){const v=nse(void 0,O),x=O.getAttribute("data-nodeid"),w=O.getAttribute("data-handleid"),S=O.classList.contains("connectable"),E=O.classList.contains("connectableend");if(!x||!v)return y;const k={source:f?x:r,sourceHandle:f?w:i,target:f?r:x,targetHandle:f?i:w};y.connection=k;const C=S&&E&&(n===Ab.Strict?f&&v==="source"||!f&&v==="target":x!==r||w!==i);y.isValid=C&&u(k),y.toHandle=tse(x,v,w,d,n,!0)}return y}const RP={onPointerDown:PIe,isValid:ise};function MIe({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const i=Xo(e);function s({translateExtent:l,width:c,height:u,zoomStep:d=1,pannable:f=!0,zoomable:h=!0,inversePan:p=!1}){const b=x=>{if(x.sourceEvent.type!=="wheel"||!t)return;const w=n(),S=x.sourceEvent.ctrlKey&&Bx()?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 g=[0,0];const O=x=>{(x.sourceEvent.type==="mousedown"||x.sourceEvent.type==="touchstart")&&(g=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY])},y=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]-g[0],S[1]-g[1]];g=S;const k=r()*Math.max(w[2],Math.log(w[2]))*(p?-1:1),T={x:w[0]-E[0]*k,y:w[1]-E[1]*k},C=[[0,0],[c,u]];t.setViewportConstrained({x:T.x,y:T.y,zoom:w[2]},C,l)},v=Iie().on("start",O).on("zoom",f?y:null).on("zoom.wheel",h?b:null);i.call(v,{})}function a(){i.on("zoom",null)}return{update:s,destroy:a,pointer:fc}}const _A=e=>({x:e.x,y:e.y,zoom:e.k}),Hj=({x:e,y:t,zoom:n})=>EA.translate(e,t).scale(n),y0=(e,t)=>e.target.closest(`.${t}`),sse=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),LIe=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Xj=(e,t=0,n=LIe,r=()=>{})=>{const i=typeof t=="number"&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on("end",r):e},ase=e=>{const t=e.ctrlKey&&Bx()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function $Ie({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:s,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(y0(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&a){const O=fc(d),y=ase(d),v=f*Math.pow(2,y);r.scaleTo(n,v,O,d);return}const h=d.deltaMode===1?20:1;let p=i===um.Vertical?0:d.deltaX*h,b=i===um.Horizontal?0:d.deltaY*h;!Bx()&&d.shiftKey&&i!==um.Vertical&&(p=d.deltaY*h,b=0),r.translateBy(n,-(p/f)*s,-(b/f)*s,{internal:!0});const g=_A(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,g),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,g),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(d,g))}}function BIe({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){const s=r.type==="wheel",a=!t&&s&&!r.ctrlKey,l=y0(r,e);if(r.ctrlKey&&s&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,i)}}function QIe({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var s,a,l;if((s=r.sourceEvent)!=null&&s.internal)return;const i=_A(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 FIe({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return s=>{var a,l;e.usedRightMouseButton=!!(n&&sse(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,_A(s.transform)))}}function UIe({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&&sse(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&s(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){const c=_A(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i==null||i(a.sourceEvent,c)},n?150:0)}}}function zIe({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 O;const h=e||t,p=n&&f.ctrlKey,b=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(y0(f,`${u}-flow__node`)||y0(f,`${u}-flow__edge`)))return!0;if(!r&&!h&&!i&&!s&&!n||a||d&&!b||y0(f,l)&&b||y0(f,c)&&(!b||i&&b&&!e)||!n&&f.ctrlKey&&b)return!1;if(!n&&f.type==="touchstart"&&((O=f.touches)==null?void 0:O.length)>1)return f.preventDefault(),!1;if(!h&&!i&&!p&&b||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const g=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||b)&&g}}function VIe({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=Iie().scaleExtent([t,n]).translateExtent(r),h=Xo(e).call(f);v({x:i.x,y:i.y,zoom:Cb(i.zoom,t,n)},[[0,0],[d.width,d.height]],r);const p=h.on("wheel.zoom"),b=h.on("dblclick.zoom");f.wheelDelta(ase);async function g(_,R){return h?new Promise($=>{f==null||f.interpolate((R==null?void 0:R.interpolate)==="linear"?M1:Rk).transform(Xj(h,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>$(!0)),_)}):!1}function O({noWheelClassName:_,noPanClassName:R,onPaneContextMenu:$,userSelectionActive:D,panOnScroll:M,panOnDrag:j,panOnScrollMode:P,panOnScrollSpeed:L,preventScrolling:U,zoomOnPinch:F,zoomOnScroll:q,zoomOnDoubleClick:z,zoomActivationKeyPressed:B,lib:V,onTransformChange:ce,connectionInProgress:we,paneClickDistance:Oe,selectionOnDrag:de}){D&&!u.isZoomingOrPanning&&y();const Z=M&&!B&&!D;f.clickDistance(de?1/0:!bc(Oe)||Oe<0?0:Oe);const J=Z?$Ie({zoomPanValues:u,noWheelClassName:_,d3Selection:h,d3Zoom:f,panOnScrollMode:P,panOnScrollSpeed:L,zoomOnPinch:F,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:l}):BIe({noWheelClassName:_,preventScrolling:U,d3ZoomHandler:p});h.on("wheel.zoom",J,{passive:!1});const fe=QIe({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});f.on("start",fe);const be=FIe({zoomPanValues:u,panOnDrag:j,onPaneContextMenu:!!$,onPanZoom:s,onTransformChange:ce});f.on("zoom",be);const je=UIe({zoomPanValues:u,panOnDrag:j,panOnScroll:M,onPaneContextMenu:$,onPanZoomEnd:l,onDraggingChange:c});f.on("end",je);const Qe=zIe({zoomActivationKeyPressed:B,panOnDrag:j,zoomOnScroll:q,panOnScroll:M,zoomOnDoubleClick:z,zoomOnPinch:F,userSelectionActive:D,noPanClassName:R,noWheelClassName:_,lib:V,connectionInProgress:we});f.filter(Qe),z?h.on("dblclick.zoom",b):h.on("dblclick.zoom",null)}function y(){f.on("zoom",null)}async function v(_,R,$){const D=Hj(_),M=f==null?void 0:f.constrain()(D,R,$);return M&&await g(M),M}async function x(_,R){const $=Hj(_);return await g($,R),$}function w(_){if(h){const R=Hj(_),$=h.property("__zoom");($.k!==_.zoom||$.x!==_.x||$.y!==_.y)&&(f==null||f.transform(h,R,null,{sync:!0}))}}function S(){const _=h?Rie(h.node()):{x:0,y:0,k:1};return{x:_.x,y:_.y,zoom:_.k}}async function E(_,R){return h?new Promise($=>{f==null||f.interpolate((R==null?void 0:R.interpolate)==="linear"?M1:Rk).scaleTo(Xj(h,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>$(!0)),_)}):!1}async function k(_,R){return h?new Promise($=>{f==null||f.interpolate((R==null?void 0:R.interpolate)==="linear"?M1:Rk).scaleBy(Xj(h,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>$(!0)),_)}):!1}function T(_){f==null||f.scaleExtent(_)}function C(_){f==null||f.translateExtent(_)}function N(_){const R=!bc(_)||_<0?0:_;f==null||f.clickDistance(R)}return{update:O,destroy:y,setViewport:x,setViewportConstrained:v,getViewport:S,scaleTo:E,scaleBy:k,setScaleExtent:T,setTranslateExtent:C,syncViewport:w,setClickDistance:N}}var Rb;(function(e){e.Line="line",e.Handle="handle"})(Rb||(Rb={}));function qIe({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 QU(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 Cf(e,t){return Math.max(0,t-e)}function Nf(e,t){return Math.max(0,e-t)}function GS(e,t,n){return Math.max(0,t-e,e-n)}function FU(e,t){return e?!t:t}function HIe(e,t,n,r,i,s,a,l){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:f}=t,h=d&&f,{xSnapped:p,ySnapped:b}=n,{minWidth:g,maxWidth:O,minHeight:y,maxHeight:v}=r,{x,y:w,width:S,height:E,aspectRatio:k}=e;let T=Math.floor(d?p-e.pointerX:0),C=Math.floor(f?b-e.pointerY:0);const N=S+(c?-T:T),_=E+(u?-C:C),R=-s[0]*S,$=-s[1]*E;let D=GS(N,g,O),M=GS(_,y,v);if(a){let L=0,U=0;c&&T<0?L=Cf(x+T+R,a[0][0]):!c&&T>0&&(L=Nf(x+N+R,a[1][0])),u&&C<0?U=Cf(w+C+$,a[0][1]):!u&&C>0&&(U=Nf(w+_+$,a[1][1])),D=Math.max(D,L),M=Math.max(M,U)}if(l){let L=0,U=0;c&&T>0?L=Nf(x+T,l[0][0]):!c&&T<0&&(L=Cf(x+N,l[1][0])),u&&C>0?U=Nf(w+C,l[0][1]):!u&&C<0&&(U=Cf(w+_,l[1][1])),D=Math.max(D,L),M=Math.max(M,U)}if(i){if(d){const L=GS(N/k,y,v)*k;if(D=Math.max(D,L),a){let U=0;!c&&!u||c&&!u&&h?U=Nf(w+$+N/k,a[1][1])*k:U=Cf(w+$+(c?T:-T)/k,a[0][1])*k,D=Math.max(D,U)}if(l){let U=0;!c&&!u||c&&!u&&h?U=Cf(w+N/k,l[1][1])*k:U=Nf(w+(c?T:-T)/k,l[0][1])*k,D=Math.max(D,U)}}if(f){const L=GS(_*k,g,O)/k;if(M=Math.max(M,L),a){let U=0;!c&&!u||u&&!c&&h?U=Nf(x+_*k+R,a[1][0])/k:U=Cf(x+(u?C:-C)*k+R,a[0][0])/k,M=Math.max(M,U)}if(l){let U=0;!c&&!u||u&&!c&&h?U=Cf(x+_*k,l[1][0])/k:U=Nf(x+(u?C:-C)*k,l[0][0])/k,M=Math.max(M,U)}}}C=C+(C<0?M:-M),T=T+(T<0?D:-D),i&&(h?N>_*k?C=(FU(c,u)?-T:T)/k:T=(FU(c,u)?-C:C)*k:d?(C=T/k,u=c):(T=C*k,c=u));const j=c?x+T:x,P=u?w+C:w;return{width:S+(c?-T:T),height:E+(u?-C:C),x:s[0]*T*(c?-1:1)+j,y:s[1]*C*(u?-1:1)+P}}const ose={width:0,height:0,x:0,y:0},XIe={...ose,pointerX:0,pointerY:0,aspectRatio:1};function GIe(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 YIe({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){const s=Xo(e);let a={controlDirection:QU("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:p,onResize:b,onResizeEnd:g,shouldResize:O}){let y={...ose},v={...XIe};a={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:QU(u)};let x,w=null,S=[],E,k,T,C=!1;const N=bie().on("start",_=>{const{nodeLookup:R,transform:$,snapGrid:D,snapToGrid:M,nodeOrigin:j,paneDomNode:P}=n();if(x=R.get(t),!x)return;w=(P==null?void 0:P.getBoundingClientRect())??null;const{xSnapped:L,ySnapped:U}=L1(_.sourceEvent,{transform:$,snapGrid:D,snapToGrid:M,containerBounds:w});y={width:x.measured.width??0,height:x.measured.height??0,x:x.position.x??0,y:x.position.y??0},v={...y,pointerX:L,pointerY:U,aspectRatio:y.width/y.height},E=void 0,k=Tm(x.extent)?x.extent:void 0,x.parentId&&(x.extent==="parent"||x.expandParent)&&(E=R.get(x.parentId)),E&&x.extent==="parent"&&(k=[[0,0],[E.measured.width,E.measured.height]]),S=[],T=void 0;for(const[F,q]of R)if(q.parentId===t&&(S.push({id:F,position:{...q.position},extent:q.extent}),q.extent==="parent"||q.expandParent)){const z=GIe(q,x,q.origin??j);T?T=[[Math.min(z[0][0],T[0][0]),Math.min(z[0][1],T[0][1])],[Math.max(z[1][0],T[1][0]),Math.max(z[1][1],T[1][1])]]:T=z}p==null||p(_,{...y})}).on("drag",_=>{const{transform:R,snapGrid:$,snapToGrid:D,nodeOrigin:M}=n(),j=L1(_.sourceEvent,{transform:R,snapGrid:$,snapToGrid:D,containerBounds:w}),P=[];if(!x)return;const{x:L,y:U,width:F,height:q}=y,z={},B=x.origin??M,{width:V,height:ce,x:we,y:Oe}=HIe(v,a.controlDirection,j,a.boundaries,a.keepAspectRatio,B,k,T),de=V!==F,Z=ce!==q,J=we!==L&&de,fe=Oe!==U&&Z;if(!J&&!fe&&!de&&!Z)return;if((J||fe||B[0]===1||B[1]===1)&&(z.x=J?we:y.x,z.y=fe?Oe:y.y,y.x=z.x,y.y=z.y,S.length>0)){const Me=we-L,le=Oe-U;for(const ke of S)ke.position={x:ke.position.x-Me+B[0]*(V-F),y:ke.position.y-le+B[1]*(ce-q)},P.push(ke)}if((de||Z)&&(z.width=de&&(!a.resizeDirection||a.resizeDirection==="horizontal")?V:y.width,z.height=Z&&(!a.resizeDirection||a.resizeDirection==="vertical")?ce:y.height,y.width=z.width,y.height=z.height),E&&x.expandParent){const Me=B[0]*(z.width??0);z.x&&z.x{C&&(g==null||g(_,{...y}),i==null||i({...y}),C=!1)});s.call(N)}function c(){s.on(".drag",null)}return{update:l,destroy:c}}var lse={exports:{}},cse={},use={exports:{}},dse={};/** +${r}`}}async function qne(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 sn(n,"加载 Ark API Key 失败"));return await n.json()}async function Hne(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 sn(n,"加载 Ark API Key 失败"));return await n.json()}async function pA(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 sn(r,"加载模型列表失败"));return await r.json()}async function Xne(){const e=await wt("/list-apps");if(!e.ok)throw new Error(`list-apps failed: ${e.status}`);return e.json()}class hO extends Error{constructor(){super("当前账号无权访问该 Runtime,请刷新列表或重新登录后重试。"),this.name="RuntimeAccessDeniedError"}}class ha extends Error{constructor(t,n=!1,r=!1){super(t),this.unsupported=n,this.retryable=r,this.name="RuntimeProbeError"}}const Gne="Runtime 已部署成功,但当前 Studio 无法访问私网 Runtime。请使用已绑定相同 VPC 的 Studio 访问,或改用公网 / 公网+VPC 部署。",Yne="Runtime 已部署成功,但 Studio 暂时无法连接服务。网关域名可能仍在生效,或当前网络/DNS 无法访问该 Runtime,请稍后在智能体管理页重试连接。",KF=["cn-beijing","cn-shanghai"],cAe=3e4,mA=5*60*1e3,Wne=60*1e3;let Zne="volcengine";const _k=new Map,Rp=new Map,Ip=new Map,hc=new Map;function Kne(e,t){return`${t}:${e}`}function Jne(e){Zne=e}function Kv(e){const t=(e||"").trim();if(Zne==="byteplus")return[t&&!t.startsWith("cn-")?t:u5];const n=t&&!t.startsWith("ap-")?t:o6;return KF.includes(n)?[n,...KF.filter(r=>r!==n)]:[n]}function gA(e){const t=(e||"").trim();return t?[t]:Kv()}function pO(...e){return e.map(t=>String(t??"")).join("")}function mO(e,t,n){const r=e.get(t);return r!=null&&r.value&&Date.now()-r.updatedAt<=n?r.value:null}function h6(e,t,n){return e.set(t,{value:n,updatedAt:Date.now()}),n}async function ere(e){try{const t=await e.clone().json();return typeof t.detail=="string"?t.detail:""}catch{return""}}async function Jv(e,t,n){const r=await wt("/list-apps",{},n??{base:e,apiKey:t}),i=n!=null&&n.runtimeId?await ere(r):"";if(n!=null&&n.runtimeId&&i==="runtime_access_denied")throw new hO;if(n!=null&&n.runtimeId&&i==="runtime_private_endpoint_unreachable")throw new ha(Gne);if(n!=null&&n.runtimeId&&["runtime_proxy_connect_error","runtime_proxy_timeout","runtime_json_connect_error","runtime_json_timeout"].includes(i))throw new ha(Yne,!1,!0);if(n!=null&&n.runtimeId&&r.status===404)throw new ha("该 Runtime 的 Agent Server 未提供连接接口,请确认 Runtime 已就绪且版本兼容。",!0,!0);if(n!=null&&n.runtimeId&&(r.status===401||r.status===403))throw new ha("Runtime 服务拒绝了连接请求,请检查 Runtime 的鉴权配置。");if(!r.ok)throw new Error(await sn(r,"读取 Agent 列表失败"));const s=await r.json();return n!=null&&n.runtimeId&&_k.set(Kne(n.runtimeId,n.region??""),{apps:s,expiresAt:Date.now()+cAe}),s}async function tre(e,t){const{app:n,ep:r}=ul(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 sn(i,"创建会话失败");throw new Error(l===a?a:`${a}:${l}`)}return(await i.json()).id}async function p6(e,t){const{app:n,ep:r}=ul(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 bA(e,t,n){const{app:r,ep:i}=ul(e),s=await wt(`/apps/${r}/users/${encodeURIComponent(t)}/sessions/${encodeURIComponent(n)}`,{},i);if(!s.ok){const l=await sn(s,"读取会话失败");throw new Error(`get session failed: ${s.status}:${l}`)}const a=await s.json();if(i.runtimeId){const l=u6(i.runtimeId,r,t,n);a.state={...d6()[l]??{},...a.state??{}}}return a}async function nre(e){const{app:t,ep:n}=ul(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??""})},{},Ni);if(!r.ok)throw new Error(await sn(r,"提交反馈失败"));const i=await r.json(),s=u6(n.runtimeId,t,e.userId,e.sessionId);return oAe(s,e.eventId,i),i}async function OA(e,t={}){const n=pO(e.runtimeId,e.region||"cn-beijing",e.appName,e.pageSize??100),r=mO(hc,n,Wne);if(!t.force&&r)return r;const i=hc.get(n);if(!t.force&&(i!=null&&i.promise))return i.promise;let s=null;const a=(async()=>{for(const l of gA(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 h6(hc,n,await u.json());s=new Error(await sn(u,"读取评测集失败"))}throw s??new Error("读取评测集失败")})();hc.set(n,{...i,promise:a,updatedAt:(i==null?void 0:i.updatedAt)??0});try{return await a}finally{const l=hc.get(n);(l==null?void 0:l.promise)===a&&hc.set(n,{value:l.value,updatedAt:l.updatedAt})}}async function d5(e){let t=null;for(const n of gA(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 sn(i,"读取自动评测状态失败"))}throw t??new Error("读取自动评测状态失败")}async function rre(e){let t=null;for(const n of gA(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 sn(i,"读取优化项失败"))}throw t??new Error("读取优化项失败")}function ire(e){return mO(hc,pO(e.runtimeId,e.region||"cn-beijing",e.appName,e.pageSize??100),Wne)}function uAe(e){OA(e).catch(()=>{})}function sre(e){OA(e,{force:!0}).catch(()=>{})}function are(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 Ak(e){const t=e.comment??"",n=e.rating==="bad"&&!!t.trim();for(const[r,i]of hc.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;hc.set(r,{value:{...s,sets:are(s.sets,l),items:l},updatedAt:Date.now(),promise:i.promise})}}async function ore(e){let t=null;for(const n of gA(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})},{},Ni);if(r.ok){const i=await r.json(),s=new Set(e.itemIds);for(const[a,l]of hc.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));hc.set(a,{value:{...c,sets:are(c.sets,u),items:u},updatedAt:Date.now()})}return i}t=new Error(await sn(r,"删除评测案例失败"))}throw t??new Error("删除评测案例失败")}async function f5(e,t,n){const{app:r,ep:i}=ul(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 dAe(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 lre(e,t,n,r,i){const{app:s,ep:a}=ul(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,Ni);if(!u.ok)throw new Error(await sn(u,"下载文件失败"));const d=await u.json(),f=d.inlineData??d.inline_data;if(!(f!=null&&f.data))throw new Error("文件内容不可用");const h=dAe(f.data),p=h.buffer.slice(h.byteOffset,h.byteOffset+h.byteLength);return{blob:new Blob([p],{type:f.mimeType??f.mime_type??"application/octet-stream"}),downloadName:f.displayName??f.display_name??r}}async function g6(e,t,n,r,i){const{blob:s}=await lre(e,t,n,r,i);return URL.createObjectURL(s)}async function fAe(e){const t=await wt("/web/media/capabilities");if(!t.ok)throw new Error(await sn(t,"media capabilities failed"));return t.json()}async function cre(e,t,n,r){const{app:i}=ul(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},{},Ni);if(!a.ok)throw new Error(await sn(a,"文件上传失败"));return{...await a.json(),status:"ready"}}async function h5(e,t,n){const{app:r}=ul(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 sn(s,"media cleanup failed"))}function ure(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 Ck(e,t){const n=ure(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 sn(r,"media cleanup failed"))}function dre(e,t){if(t.startsWith("data:")||t.startsWith("blob:")||/^https?:/.test(t))return t;const n=ure(t);if(!n)return t;const r=`${n}/content`;return bo(`${Tk}${r}`)}async function o2(e,t,n){const{app:r,ep:i}=ul(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 sn(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 p5(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 sn(t,"问题反馈上报失败"));if((await t.json()).submitted!==!0)throw new Error("问题反馈上报失败:服务端未确认提交结果");return{submitted:!0}}async function fre(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 m5(e){const{app:t,ep:n}=ul(e);return fre(t,n,!1)}async function hAe(e,t,n){let r=null;for(const i of Kv(t)){const s={runtimeId:e,region:i};try{const a=Kne(e,i),l=_k.get(a);l&&l.expiresAt<=Date.now()&&_k.delete(a);const c=_k.get(a),u=n||(c==null?void 0:c.apps[0])||(await Jv("","",s))[0];if(!u)throw new Error("该 Runtime 未提供可预览的 Agent。");return fre(u,s)}catch(a){if(a instanceof hO||a instanceof ha&&!a.unsupported)throw a;r=a instanceof Error?a:new Error(String(a))}}throw r??new Error("该 Runtime 未提供可预览的 Agent。")}async function b6(e,t,n={},r={}){const i=typeof n=="string"?n:void 0,s=typeof n=="string"?r:n,a=pO(e,t||"cn-beijing",i??""),l=mO(Rp,a,mA);if(!s.force&&l)return l;const c=Rp.get(a);if(!s.force&&(c!=null&&c.promise))return c.promise;const u=hAe(e,t,i).then(d=>h6(Rp,a,d));Rp.set(a,{...c,promise:u,updatedAt:(c==null?void 0:c.updatedAt)??0});try{return await u}finally{const d=Rp.get(a);(d==null?void 0:d.promise)===u&&Rp.set(a,{value:d.value,updatedAt:d.updatedAt})}}function hre(e,t,n=""){return mO(Rp,pO(e,t||"cn-beijing",n),mA)}function pre(e,t,n=""){b6(e,t,n).catch(()=>{})}async function mre(e,t,n,r){const{app:i,ep:s}=ul(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 sn(l,"Agent 检索失败"));return l.json()}async function gre(e,t){const{app:n}=ul(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 bre=Uf("HTTP 200,SSE 响应体为空。"),Nk=Uf("HTTP 200,SSE 响应中没有可展示的模型回复。");async function*g5({appName:e,userId:t,sessionId:n,text:r,attachments:i=[],invocation:s,platformTools:a,functionResponses:l=[],signal:c}){const{app:u,ep:d}=ul(e),f=i.flatMap(O=>O.status&&O.status!=="ready"?[]:O.uri?[{fileData:{mimeType:O.mimeType,fileUri:O.uri,displayName:O.name},partMetadata:{veadkMedia:{id:O.id,uri:O.uri,name:O.name,mimeType:O.mimeType,sizeBytes:O.sizeBytes}}}]:O.data?[{inlineData:{mimeType:O.mimeType,data:O.data,displayName:O.name}}]:[]),h=s&&(s.skills.length>0||s.targetAgent)?s:void 0,p=[...f,...l.map(O=>({functionResponse:{id:O.id,name:O.name,response:O.response}})),...r.trim()?[{text:r}]:[]];if(h&&p.length>0){const O=p[0],y=O.partMetadata;p[0]={...O,partMetadata:{...y,veadkInvocation:h}}}let b;try{b=await wt("/run_sse",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({app_name:u,user_id:t,session_id:n,new_message:{role:"user",parts:p},streaming:!0,...a!==void 0?{platform_tools:[...a]}:{},custom_metadata:h?{veadkInvocation:h}:void 0}),signal:c},d,0)}catch(O){throw c!=null&&c.aborted||(O==null?void 0:O.name)==="AbortError"?O:new Error(Uf(O))}if(!b.ok){const O=await sn(b,"运行会话失败");throw new Error(Uf(`run_sse failed: ${b.status}:${O}`))}let g=!1;try{for await(const O of a6(b)){g=!0;const y=O;typeof y.error=="string"&&(y.error=Uf(y.error)),typeof y.errorMessage=="string"&&(y.errorMessage=Uf(y.errorMessage)),typeof y.error_message=="string"&&(y.error_message=Uf(y.error_message)),yield y}}catch(O){throw c!=null&&c.aborted||(O==null?void 0:O.name)==="AbortError"?O:new Error(Uf(O))}if(!g)throw new Error(bre)}async function O6(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 sn(r,"检查 Runtime 名称失败"));const i=await r.json();if(typeof i.available!="boolean")throw new Error("检查 Runtime 名称失败:服务返回格式错误");return{available:i.available}}async function Ore(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 sn(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}}const JF={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 yre(e){var i;const t=await wt("/web/system-info",{signal:e});if(!t.ok)throw new Error(await sn(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)=>(JF[s.kind]??Number.MAX_SAFE_INTEGER)-(JF[a.kind]??Number.MAX_SAFE_INTEGER));return{storage:{tosAddress:n.storage.tosAddress},sandboxTools:r}}async function xre(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 sn(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 y6(e){const t=await wt("/web/identity/user-pools",{signal:e});if(!t.ok)throw new Error(await sn(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 P1=new Map;function pAe(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 M1 extends Error{constructor(t){super(t.message),this.detail=t,this.name="GithubCicdPipelineError"}}async function sf(e){const t=await e.text().catch(()=>"");if(t)try{const n=JSON.parse(t),r=pAe(n.detail??n.error);if(r)return new M1(r)}catch{return new M1({message:t})}return new M1({message:`同步 GitHub 代码失败 (${e.status})`})}async function vre(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 sf(t);return t.json()}async function wre(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 sf(t);return t.json()}async function Sre(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 sf(t);return t.json()}async function mAe(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 sf(t);return t.json()}async function Ere(e){const t=await wt(`/web/github-cicd/runtime-binding?runtimeId=${encodeURIComponent(e)}`);if(!t.ok)throw await sf(t);const n=await t.json();return n.pipelineId?n:null}async function jk(e){const t=await wt(`/web/github-delivery/versions?runtimeId=${encodeURIComponent(e)}`);if(!t.ok)throw await sf(t);return t.json()}async function kre(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 sf(t);return t.json()}async function x6(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 sf(t);return t.json()}async function Tre(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 sf(t);return t.json()}async function gO(e,t,n,r){var f,h,p,b,g;const i=r==null?void 0:r.taskId,s=i?new AbortController:void 0;i&&s&&P1.set(i,s);const a=()=>{i&&P1.get(i)===s&&P1.delete(i)};let l;try{const O=!!(r!=null&&r.migrationTaskId);(f=r==null?void 0:r.onStage)==null||f.call(r,{level:"info",phase:"upload",message:O?"正在校验迁移产物":"正在上传代码包",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:O?[]: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,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:L_e((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})},{},0),(h=r==null?void 0:r.onStage)==null||h.call(r,{level:"success",phase:"upload",message:O?"迁移产物校验完成":"代码包上传完成",pct:100})}catch(O){throw a(),O}if(!l.ok){const O=await sn(l,"部署失败");throw a(),new Error(O)}let c=null;try{for await(const O of a6(l)){const y=O;if(y&&y.done){c=y;break}y&&y.message&&((p=r==null?void 0:r.onStage)==null||p.call(r,y))}}catch(O){throw a(),O}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=(b=c.runtimeName)!=null&&b.trim()?c.agentName:e,d=((g=c.runtimeName)==null?void 0:g.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 _re(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=P1.get(e))==null||n.abort(),P1.delete(e)}async function gAe(e=o6){const t=await wt(`/web/my-runtimes?region=${encodeURIComponent(e)}`);if(!t.ok)throw new Error(`加载失败 (${t.status})`);return(await t.json()).runtimes??[]}const jx={title:"AgentKit Studio",logoUrl:""},b5={enabled:!1},Uj={studio:!1,version:"",provider:"volcengine",branding:jx,features:{newChat:!0,search:!0,skillCenter:!0,history:!0,addAgent:!0,manageAgents:!0,agentUsage:!1,addAgentkit:!0,generatedAgentTestRun:!0},defaultView:"chat",agentsSource:"local",telemetry:b5};function bAe(e){if(!e||typeof e!="object")return b5;const t=e;if(t.enabled!==!0||!t.studio||typeof t.studio!="object")return b5;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 Are(){var e,t;try{const n=await wt("/web/ui-config");if(!n.ok)return Uj;const r=await n.json(),i=typeof((e=r.branding)==null?void 0:e.logoUrl)=="string"?r.branding.logoUrl:jx.logoUrl,s=r.provider==="byteplus"?"byteplus":"volcengine";return Jne(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:jx.title,logoUrl:i?bo(i):""},features:{...Uj.features,...r.features??{}},defaultView:r.defaultView??"chat",agentsSource:r.agentsSource==="cloud"?"cloud":"local",telemetry:bAe(r.telemetry)}}catch{return Uj}}const Cre={role:"user",telemetry:{userId:"",accountId:""},capabilities:{createAgents:!1,manageAgents:!1,runtimeScope:"mine"}};async function Nre(){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 jre(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 Rre(){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 Ire(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})},{},Ni);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 Dre({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 sn(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 af(e=""){return`/web/cronjobs${e?`/${encodeURIComponent(e)}`:""}`}async function O5(e){const t=await wt(af(),{signal:e});if(!t.ok)throw new Error(await sn(t,"加载定时任务失败"));const n=await t.json();return Array.isArray(n)?n:n.items??[]}async function OAe(e,t){const n=await wt(af(e),{signal:t});if(!n.ok)throw new Error(await sn(n,"加载定时任务详情失败"));return await n.json()}async function Pre(e){const t=await wt(af(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error(await sn(t,"创建定时任务失败"));return await t.json()}async function Mre(e,t){const n=await wt(`${af(e)}/update`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw new Error(await sn(n,"更新定时任务失败"));return await n.json()}async function Lre(e,t){const n=t?"enable":"disable",r=await wt(`${af(e)}/${n}`,{method:"POST"});if(!r.ok)throw new Error(await sn(r,t?"启用定时任务失败":"暂停定时任务失败"));return await r.json()}async function $re(e){const t=await wt(`${af(e)}/run`,{method:"POST"});if(!t.ok)throw new Error(await sn(t,"立即执行定时任务失败"));return await t.json()}async function y5(e,t){const n=await wt(`${af(e)}/runs`,{signal:t});if(!n.ok)throw new Error(await sn(n,"加载执行历史失败"));const r=await n.json();return Array.isArray(r)?r:r.items??[]}async function Bre(e,t){const n=await wt(`${af(e)}/runs/${encodeURIComponent(t)}/cancel`,{method:"POST"});if(!n.ok)throw new Error(await sn(n,"终止执行失败"));return await n.json()}async function Qre(e){const t=await wt(af(e),{method:"DELETE"});if(!t.ok)throw new Error(await sn(t,"删除定时任务失败"))}async function bO(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()}`);if(!n.ok){const i=await sn(n,"加载 Runtime 失败");throw new Error(i)}const r=await n.json();return{runtimes:r.runtimes??[],nextToken:r.nextToken??""}}async function yA(e,t,n={}){try{const r={runtimeId:e,region:t};return n.retryProbe&&(r.retryProbe=!0),await Jv("","",r)}catch(r){if(r instanceof hO||r instanceof ha)throw r;return null}}async function Fre(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 ha(await sn(r,"读取本地工具失败"),!1,!0);return await r.json()}async function Ure(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 ha(await sn(r,"连接 Studio 动态路由失败"),!1,!0);return await r.json()}async function zre(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 ere(i);if(s==="runtime_access_denied")throw new hO;if(s==="runtime_private_endpoint_unreachable")throw new ha(Gne);if(["runtime_proxy_connect_error","runtime_proxy_timeout"].includes(s))throw new ha(Yne);if(i.status===404)return null;if(i.status===401||i.status===403)throw new ha("Runtime 服务拒绝了 A2A 探测请求,请检查 Runtime 的鉴权配置。");if(!i.ok)throw new Error(await sn(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 Vre(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 sn(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 qre(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})`)}}async function Hre({runtimeId:e,region:t,appName:n,signal:r}){const i=new URLSearchParams({runtimeId:e,region:t});n&&i.set("appName",n);const s=await wt(`/web/runtime-update-capability?${i.toString()}`,{signal:r});if(!s.ok)throw new Error(await yAe(s));return await s.json()}async function yAe(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 xAe(e,t){let n=null;for(const r of Kv(t)){const i=await wt(`/web/runtime-detail?runtimeId=${encodeURIComponent(e)}®ion=${encodeURIComponent(r)}`);if(i.ok)return i.json();n=new Error(await sn(i,"加载 Runtime 详情失败"))}throw n??new Error("加载 Runtime 详情失败")}async function v6(e,t="cn-beijing",n={}){const r=pO(e,t||"cn-beijing"),i=mO(Ip,r,mA);if(!n.force&&i)return i;const s=Ip.get(r);if(!n.force&&(s!=null&&s.promise))return s.promise;const a=xAe(e,t).then(l=>h6(Ip,r,l));Ip.set(r,{...s,promise:a,updatedAt:(s==null?void 0:s.updatedAt)??0});try{return await a}finally{const l=Ip.get(r);(l==null?void 0:l.promise)===a&&Ip.set(r,{value:l.value,updatedAt:l.updatedAt})}}function Xre(e,t="cn-beijing"){return mO(Ip,pO(e,t||"cn-beijing"),mA)}function Gre(e,t="cn-beijing"){v6(e,t).catch(()=>{})}async function w6(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 sn(t,"生成项目失败"));return t.json()}const vAe=19e4;async function Yre(e){const t=await wt("/web/generated-agent-drafts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({requirement:e})},{},vAe);if(!t.ok)throw new Error(await sn(t,"生成 Agent 配置失败"));return hA(t,"生成 Agent 配置失败")}async function Wre(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 sn(n,"创建调试运行失败"));return hA(n,"创建调试运行失败")}async function Zre(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 sn(n,"创建调试会话失败"));return(await hA(n,"创建调试会话失败")).id}async function Kre(e,t){const n=await wt(`/web/generated-agent-test-runs/${encodeURIComponent(e)}/trace/session/${encodeURIComponent(t)}`);if(!n.ok)throw new Error(await sn(n,"加载调试调用链路失败"));const r=await hA(n,"加载调试调用链路失败");if(!Array.isArray(r))throw new Error("加载调试调用链路失败:返回格式无效");return r}async function*Jre({runId:e,userId:t,sessionId:n,text:r,signal:i}){const s=r.trim()?[{text:r}]:[],a=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:i},{},0);if(!a.ok)throw new Error(await sn(a,"调试运行失败"));for await(const l of a6(a))yield l}async function Xg(e){const t=await wt(`/web/generated-agent-test-runs/${e}`,{method:"DELETE"});if(!t.ok&&t.status!==404)throw new Error(await sn(t,"清理调试运行失败"))}const wAe=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_SITE_BRANDING:jx,DEFAULT_STUDIO_ACCESS:Cre,GithubCicdPipelineError:M1,RUN_SSE_EMPTY_RESPONSE_ERROR:bre,RUN_SSE_INCOMPLETE_RESPONSE_ERROR:Nk,RuntimeAccessDeniedError:hO,RuntimeProbeError:ha,attachGithubDeliveryCicdToSourceSync:mAe,bindGithubCicdRuntime:x6,cancelAgentkitDeployment:_re,cancelCronJobRun:Bre,checkRuntimeNameAvailability:O6,clearMessageFeedbackCache:Une,clearRemoteApps:Vne,componentSearch:mre,createCronJob:Pre,createGeneratedAgentTestRun:Wre,createGeneratedAgentTestSession:Zre,createGithubCicdPipeline:vre,createGithubDeliveryCicdPipeline:wre,createGithubDeliveryRollbackPr:kre,createSession:tre,deleteAgentFeedbackCases:ore,deleteCronJob:Qre,deleteGeneratedAgentTestRun:Xg,deleteMedia:Ck,deleteRuntime:qre,deleteSession:f5,deleteSessionMedia:h5,deployAgentkitProject:gO,downloadArtifact:m6,ensureRuntimeRouteChannel:Ure,fetchRemoteApps:Jv,generateAgentDraftFromRequirement:Yre,generateAgentProject:w6,getAgentFeedbackCases:OA,getAgentInfo:m5,getAgentOptimizations:rre,getAgentUsage:Dre,getAutomaticEvaluationStatuses:d5,getCachedAgentFeedbackCases:ire,getCachedRuntimeAgentInfo:hre,getCachedRuntimeDetail:Xre,getCronJob:OAe,getGeneratedAgentTestTrace:Kre,getGithubCicdRuntimeBinding:Ere,getGithubDeliveryVersions:jk,getMediaCapabilities:fAe,getMyRuntimes:gAe,getRuntimeAgentInfo:b6,getRuntimeDetail:v6,getRuntimeStudioToolCapabilities:Fre,getRuntimeUpdateCapability:Hre,getRuntimes:bO,getSession:bA,getSessionTrace:o2,getStudioAccess:Nre,getStudioUpdatePermissions:Rre,getStudioUpdateStatus:jre,getSystemInfo:yre,getUiConfig:Are,initializeGithubDeliveryMain:Sre,listApps:Xne,listCronJobRuns:y5,listCronJobs:O5,listDeploymentResources:Ore,listIdentityUserPools:y6,listModelApiKeys:qne,listModelOptions:pA,listSessions:p6,mediaContentUrl:dre,prefetchAgentFeedbackCases:uAe,prefetchRuntimeAgentInfo:pre,prefetchRuntimeDetail:Gre,previewArtifact:g6,probeRuntimeA2a:zre,probeRuntimeApps:yA,refreshAgentFeedbackCases:sre,registerRemoteApp:zne,revealModelApiKey:Hne,revealRuntimeApiKey:Vre,runCronJobNow:$re,runGeneratedAgentTestSSE:Jre,runSSE:g5,runtimeRegionCandidates:Kv,setClientCloudProvider:Jne,setCronJobEnabled:Lre,startStudioUpdate:Ire,studioFetch:Hn,submitIssueFeedback:p5,submitMessageFeedback:nre,syncGithubCicdRuntime:Tre,updateCodexSandboxToolModelEnv:xre,updateCronJob:Mre,uploadMedia:cre,upsertCachedAgentFeedbackCase:Ak,webSearch:gre},Symbol.toStringTag,{value:"Module"})),eU=Object.freeze({totalTokenCount:0,promptTokenCount:0,candidatesTokenCount:0,thoughtsTokenCount:0,cachedContentTokenCount:0}),Rk=Object.freeze({modelName:"",current:eU,cumulative:eU}),SAe={totalTokenCount:"total_token_count",promptTokenCount:"prompt_token_count",candidatesTokenCount:"candidates_token_count",thoughtsTokenCount:"thoughts_token_count",cachedContentTokenCount:"cached_content_token_count"},EAe=24,kAe=64,TAe=16;function QS(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 _Ae(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=QS(t),s=n.reduce((d,f)=>d+kAe+QS(f),0),a=r.reduce((d,f)=>d+TAe+QS(f.name)+QS(f.description??""),0);return EAe+i+s+a}function AAe({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 CAe(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 by(e,t){const n=e,r=n[t]??n[SAe[t]];return typeof r=="number"&&Number.isFinite(r)&&r>0?Math.round(r):0}function NAe(e){const t=by(e,"promptTokenCount"),n=by(e,"candidatesTokenCount"),r=by(e,"thoughtsTokenCount");return{totalTokenCount:by(e,"totalTokenCount")||t+n+r,promptTokenCount:t,candidatesTokenCount:n,thoughtsTokenCount:r,cachedContentTokenCount:by(e,"cachedContentTokenCount")}}function jAe(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 eie(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=NAe(s);return a.totalTokenCount===0?i===e.modelName?e:{...e,modelName:i}:{modelName:i,current:a,cumulative:jAe(e.cumulative,a)}}function tU(e){return e.reduce((t,n)=>eie(t,n),Rk)}function nU(e){return e.blocks.flatMap(t=>t.kind==="tool"?[{name:t.name,args:t.args,response:t.response,done:t.done}]:[])}function RAe(e){const t=e.attributes;return String(t["invocation.id"]??t["gen_ai.invocation.id"]??t["gcp.vertex.agent.invocation_id"]??"")}function IAe(e,t){if(!t)return e;const n=new Set(e.filter(i=>RAe(i)===t).map(i=>i.trace_id)),r=e.filter(i=>n.has(i.trace_id));return r.length>0?r:e}const DAe="send_a2ui_json_to_client",PAe="validated_a2ui_json",x5="adk_request_credential",rU="transfer_to_agent";function MAe(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 Ed(){return{blocks:[],liveStart:0}}const iU=e=>e.functionCall??e.function_call,v5=e=>e.functionResponse??e.function_response;function LAe(e){if(!e||typeof e!="object")return"";const t=e,n=t.agentName??t.agent_name;return typeof n=="string"?n:""}function $Ae(e){return e.replace(/-/g,"+").replace(/_/g,"/")}function tie(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:$Ae(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 w5(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 BAe=new Set(["llm","sequential","parallel","loop","a2a"]);function QAe(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"&&BAe.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 FAe(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 UAe(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 sU(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 FS(e){for(const t of e)t.kind==="thinking"&&(t.done=!0)}function l2(e,t){var l,c,u,d,f,h;const n=e.blocks.map(p=>({...p}));let r=e.liveStart;const i=((l=t.content)==null?void 0:l.parts)??[],s=i.some(p=>iU(p)||v5(p));if(t.partial&&!s){for(const p of i){const b=w5(p);typeof b=="string"&&b&&sU(n,p.thought?"thinking":"text",b)}return{blocks:n,liveStart:r}}n.length=r;for(const p of i){const b=iU(p),g=v5(p),O=tie([p]),y=w5(p);if(typeof y=="string"&&y)sU(n,p.thought?"thinking":"text",y);else if(O.length)FS(n),FAe(n,O);else if(b)if(FS(n),b.name===rU){const v=LAe(b.args)||((c=t.actions)==null?void 0:c.transferToAgent)||((u=t.actions)==null?void 0:u.transfer_to_agent)||"未知 Agent";n.push({kind:"agent-transfer",agentName:v,done:!1})}else if(b.name===x5){const v=b.args??{},x=v.authConfig??v.auth_config??v,S=String(v.functionCallId??v.function_call_id??"").replace(/^_adk_toolset_auth_/,"")||void 0;n.push({kind:"auth",callId:b.id??"",label:S,authUri:MAe(x),authConfig:x,done:!1})}else n.push({kind:"tool",name:b.name??"",args:b.args,done:!1});else if(g){if(FS(n),g.name===rU)for(let v=n.length-1;v>=0;v--){const x=n[v];if(x.kind==="agent-transfer"&&!x.done){x.done=!0;break}}if(g.name===x5)for(let v=n.length-1;v>=0;v--){const x=n[v];if(x.kind==="auth"&&!x.done){x.done=!0;break}}for(let v=n.length-1;v>=0;v--){const x=n[v];if(x.kind==="tool"&&!x.done&&x.name===g.name){x.done=!0,x.response=g.response;break}}if(g.name===DAe){const v=((d=g.response)==null?void 0:d[PAe])??[];if(v.length){const x=n[n.length-1];x&&x.kind==="a2ui"?x.messages.push(...v):n.push({kind:"a2ui",messages:v})}}}}const a=((f=t.actions)==null?void 0:f.artifactDelta)??((h=t.actions)==null?void 0:h.artifact_delta);return a&&UAe(n,Object.entries(a).map(([p,b])=>({filename:p,version:b}))),FS(n),r=n.length,{blocks:n,liveStart:r}}function zAe(e,t={}){var i,s;const n=[];let r=Ed();for(const a of e)if(a.author==="user"){const c=((i=a.content)==null?void 0:i.parts)??[];if(c.some(p=>{var b;return((b=v5(p))==null?void 0:b.name)===x5})){for(let p=n.length-1;p>=0;p--)if(n[p].role==="assistant"){for(let b=n[p].blocks.length-1;b>=0;b--){const g=n[p].blocks[b];if(g.kind==="auth"){g.done=!0;break}}break}}const u=c.map(w5).filter(p=>!!p).join(""),d=tie(c),f=QAe(c);if(!u&&!d.length&&!f){r=Ed();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=Ed()}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=Ed()),r=l2(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 xA(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 nie(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=m.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},S6=e=>{const t=VAe(e),n=m.Children.count(t);return m.Children.map(t,r=>{if(typeof r=="string"&&r.trim())return n<=1?r:o.jsx("span",{children:r});if(m.isValidElement(r)){const i=r,{children:s,...a}=i.props;return s!=null?m.cloneElement(i,a,S6(s)):i}return r})},qAe="_Badge_1viyg_1",HAe={Badge:qAe},OO=({children:e,className:t,variant:n="soft",color:r="secondary",size:i="sm",pill:s,...a})=>o.jsx("div",{className:zr(HAe.Badge,t),"data-color":r,"data-size":i,"data-pill":s?"":void 0,"data-variant":n,...a,children:S6(e)}),XAe=50,aU=48;function GAe(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 YAe(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 WAe(e,t,n){const r=Math.max(0,t-aU),i=Math.min(e.length,t+n+aU);return(r>0?"…":"")+e.slice(r,i).trim()+(i{var c;if((c=l.events)!=null&&c.length)return l;try{return await bA(t,e,l.id)}catch{return l}})),a=[];for(const l of s)for(const{text:c,role:u,ts:d}of GAe(l)){const f=c.toLowerCase().indexOf(r);if(f!==-1){a.push({type:"session",appId:t,sessionId:l.id,title:YAe(l),snippet:WAe(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,XAe)}async function KAe(e,t){if(!e||!t.trim())return{results:[]};let n;try{n=await gre(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 JAe(e,t,n,r){if(!t||!r.trim())return{results:[]};const i=await mre(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 eCe(e,t,n){return e==="session"?{results:await ZAe(n.userId,n.appId,t)}:e==="web"?KAe(n.appId,t):JAe(e,n.appId,n.userId,t)}function rie({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 tCe(e){return o.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",...e,children:o.jsx(rie,{})})}function nCe(e){return o.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",...e,children:o.jsx(rie,{mirrored:!0})})}function rCe(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 iCe(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 sCe(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 aCe(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 oCe({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 lCe({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 cCe({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(iCe,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"搜索"})]})}function uCe(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 c2(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 oU(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 dCe({userId:e,appId:t,agentInfo:n,capabilitiesLoading:r,agentLabel:i,onOpenSession:s}){var M,j;const[a,l]=m.useState("session"),[c,u]=m.useState(""),[d,f]=m.useState([]),[h,p]=m.useState(),[b,g]=m.useState(!1),[O,y]=m.useState(!1),[v,x]=m.useState(!1),w=m.useRef(0),S=m.useRef(null),E=uCe(t,n,r),k=E.find(P=>P.id===a),T=a==="knowledge"?(M=n==null?void 0:n.components)==null?void 0:M.find(P=>P.source==="knowledgebase"||P.kind==="knowledgebase"):a==="memory"?(j=n==null?void 0:n.components)==null?void 0:j.find(P=>P.source==="long_term_memory"||P.kind==="memory"):void 0;m.useEffect(()=>{w.current+=1,l("session"),f([]),p(void 0),y(!1),g(!1),x(!1)},[t]),m.useEffect(()=>{if(!v)return;function P(L){var U;(U=S.current)!=null&&U.contains(L.target)||x(!1)}return document.addEventListener("pointerdown",P),()=>document.removeEventListener("pointerdown",P)},[v]);async function C(P,L){var z;const U=P.trim();if(!U||!((z=E.find(B=>B.id===L))!=null&&z.ready))return;const F=++w.current;g(!0),y(!0);let q;try{q=await eCe(L,U,{userId:e,appId:t})}catch(B){const V=B instanceof Error?B.message:String(B);q={results:[],note:`搜索失败:${V}`}}F===w.current&&(f(q.results),p(q.note),g(!1))}function N(P){w.current+=1,u(P),f([]),p(void 0),y(!1),g(!1)}function _(P){w.current+=1,l(P),x(!1),f([]),p(void 0),y(!1),g(!1)}const R=!!(k!=null&&k.ready),$=t?a==="web"?"在网络中检索":a==="knowledge"?`在 ${(T==null?void 0:T.name)??"当前 Agent 的知识库"} 中检索`:a==="memory"?`在 ${(T==null?void 0:T.name)??"当前用户的长期记忆"} 中检索`:"在当前 Agent 的会话中检索":"请先选择 Agent",D=T!=null&&T.backend?c2(T.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(P=>!P),children:[o.jsx("span",{children:(k==null?void 0:k.label)??"搜索类型"}),D&&o.jsx("small",{children:D}),o.jsx(lCe,{open:v})]}),v&&o.jsx("div",{className:"search-source-menu",role:"listbox","aria-label":"选择搜索类型",children:E.map(P=>{var F,q;const L=P.id==="knowledge"?(F=n==null?void 0:n.components)==null?void 0:F.find(z=>z.source==="knowledgebase"||z.kind==="knowledgebase"):P.id==="memory"?(q=n==null?void 0:n.components)==null?void 0:q.find(z=>z.source==="long_term_memory"||z.kind==="memory"):void 0,U=L?[L.name,L.backend?c2(L.backend):""].filter(Boolean).join(" · "):P.ready?P.description:P.unavailableLabel;return o.jsxs("button",{type:"button",role:"option","aria-selected":a===P.id,disabled:!P.ready,onClick:()=>_(P.id),children:[o.jsx("span",{children:P.label}),U&&o.jsx("small",{children:U})]},P.id)})})]}),o.jsx("span",{className:"search-box-divider","aria-hidden":!0}),o.jsx("input",{className:"search-input",value:c,onChange:P=>N(P.target.value),onKeyDown:P=>{P.key==="Enter"&&(P.preventDefault(),C(c,a))},placeholder:$,disabled:!R,autoFocus:!0}),o.jsx("button",{className:"search-go",onClick:()=>void C(c,a),disabled:!c.trim()||b,"aria-label":"搜索",children:b?o.jsx(sr,{className:"icon spin"}):o.jsx(oCe,{className:"icon"})})]}),o.jsx("div",{className:"search-results",children:R?O?b?null:h?o.jsx("div",{className:"search-empty",children:h}):d.length===0&&O?o.jsxs("div",{className:"search-empty",children:["未找到匹配「",c.trim(),"」的结果。"]}):d.map((P,L)=>o.jsx(fCe,{result:P,agentLabel:i,onOpen:s},L)):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 fCe({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(Pne,{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?` · ${oU(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(fA,{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(kb,{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(lU,{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?` · ${c2(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(lU,{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?` · ${c2(e.sourceType)}`:"",e.ts?` · ${oU(e.ts)}`:""]})]}),o.jsx("div",{className:"search-result-snippet search-result-snippet-expanded",children:e.content})]})]});default:return null}}function lU({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"})]})}const hCe={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 pCe(e){return hCe[e]}function cU({href:e,label:t,tone:n}){return o.jsxs("a",{className:`agentkit-promo-link is-${n}`,href:e,target:"_blank",rel:"noreferrer","aria-label":`${t},在新窗口打开`,title:t,children:[o.jsx("span",{className:"agentkit-promo-content",children:o.jsx("span",{className:"agentkit-promo-copy",children:t})}),o.jsxs("svg",{className:"agentkit-promo-external-icon",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"})]})]})}function mCe({cloudProvider:e}){const t=pCe(e);return o.jsxs("div",{className:"agentkit-promo-stack",children:[o.jsx(cU,{href:t.console,label:"前往 AgentKit 控制台",tone:"console"}),o.jsx(cU,{href:t.docs,label:"查看 AgentKit 官方文档",tone:"docs"})]})}function gCe({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 bCe({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 iie(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 E6="/assets/media/logo-DCsNZy-k.svg",k6="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",uU="(max-width: 860px)";function OCe(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 yCe(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 xCe={admin:"管理员",developer:"开发者",user:"普通用户"};function dU({role:e}){const t=xCe[e];return o.jsx("span",{className:`studio-role-badge studio-role-badge--${e}`,title:t,children:t})}function vCe({access:e,userInfo:t,onSystemInfo:n,onIssueFeedback:r,onLogout:i}){const[s,a]=m.useState(!1),[l,c]=m.useState("");if(!t)return null;const u=v_e(t),d=typeof t.email=="string"?t.email:"",f=(u||"U").slice(0,1).toUpperCase(),h=yCe(u||d||f),p=w_e(t),b=p===l?"":p;return o.jsxs("div",{className:"sidebar-user",children:[o.jsxs("button",{className:"sidebar-user-btn",onClick:()=>a(g=>!g),title:d?`${u} +${d}`:u,children:[o.jsxs("span",{className:`account-avatar${b?" has-image":""}`,style:h,children:[f,b?o.jsx("img",{className:"account-avatar-image",src:b,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>c(b)}):null]}),o.jsxs("span",{className:"sidebar-user-identity",children:[o.jsxs("span",{className:"sidebar-user-primary",children:[o.jsx("span",{className:"sidebar-user-name",children:u}),o.jsx(dU,{role:e.role})]}),d&&d!==u&&o.jsx("span",{className:"sidebar-user-email",children:d})]})]}),s&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>a(!1)}),o.jsxs("div",{className:"account-pop sidebar-user-pop",children:[o.jsxs("div",{className:"account-head",children:[o.jsxs("span",{className:`account-avatar account-avatar--lg${b?" has-image":""}`,style:h,children:[f,b?o.jsx("img",{className:"account-avatar-image",src:b,alt:"","aria-hidden":"true",referrerPolicy:"no-referrer",onError:()=>c(b)}):null]}),o.jsxs("div",{className:"account-id",children:[o.jsxs("div",{className:"account-name-row",children:[o.jsx("div",{className:"account-name",children:u}),o.jsx(dU,{role:e.role})]}),d&&d!==u&&o.jsx("div",{className:"account-sub",children:d})]})]}),o.jsxs("button",{type:"button",className:"account-action",onClick:()=>{a(!1),n()},children:[o.jsx(Ru,{className:"icon"})," 系统信息"]}),o.jsxs("button",{type:"button",className:"account-action",onClick:()=>{a(!1),r()},children:[o.jsx(iie,{className:"icon"})," 问题反馈"]}),o.jsxs("button",{type:"button",className:"account-action",onClick:()=>{a(!1),i()},children:[o.jsx(e_e,{className:"icon"})," 退出登录"]})]})]})]})}function wCe({branding:e,cloudProvider:t,sessions:n,currentSessionId:r,activePage:i,features:s,access:a,streamingSids:l,evaluatingSids:c,sandboxHistory:u,intelligentHistory:d,onNewChat:f,onSearch:h,onQuickCreate:p,onLibrary:b,onAddAgent:g,onMyAgents:O,onApplications:y,onCronJobs:v,onSystemInfo:x,onIssueFeedback:w,onPickSession:S,onDeleteSession:E,userInfo:k,onLogout:T}){const C=L=>(s==null?void 0:s[L])!==!1,[N,_]=m.useState(null),R=m.useRef(typeof window<"u"&&window.matchMedia(uU).matches),[$,D]=m.useState(R.current),M=[...n.map(L=>({kind:"agent",id:L.id,title:xA(L.events),createdAt:(L.lastUpdateTime??0)*1e3,session:L})),...((d==null?void 0:d.sessions)??[]).map(L=>({kind:"intelligent",id:L.id,title:L.displayName||"智能构建",createdAt:Date.parse(L.createdAt)||0,session:L}))].sort((L,U)=>U.createdAt-L.createdAt),j=()=>{R.current=!1,D(L=>!L),_(null)};m.useEffect(()=>{const L=window.matchMedia(uU),U=F=>{F.matches?D(q=>q||(R.current=!0,!0)):R.current&&(R.current=!1,D(!1))};return L.addEventListener("change",U),()=>L.removeEventListener("change",U)},[]);const P=t==="byteplus"?k6:E6;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:f,"aria-label":"返回首页",title:"返回首页",children:[o.jsx("img",{className:"brand-logo",src:e.logoUrl||P,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:j,"aria-label":$?"展开侧边栏":"收起侧边栏",title:$?"展开侧边栏":"收起侧边栏",children:$?o.jsx(nCe,{className:"icon"}):o.jsx(tCe,{className:"icon"})})]}),o.jsxs("nav",{className:"sidebar-nav","aria-label":"主导航",children:[C("newChat")&&o.jsxs("button",{className:`new-chat new-chat--conversation${i==="new-chat"?" is-active":""}`,onClick:f,"aria-label":"新会话","aria-current":i==="new-chat"?"page":void 0,title:"新会话",children:[o.jsx(rCe,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"新会话"})]}),C("search")&&o.jsx(cCe,{active:i==="search",onClick:h}),o.jsxs("button",{className:`new-chat new-chat--agents${i==="agents"?" is-active":""}`,onClick:O,"aria-label":"智能体","aria-current":i==="agents"?"page":void 0,title:"智能体",children:[o.jsx(sCe,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"智能体"})]}),o.jsxs("button",{className:`new-chat new-chat--library${i==="library"?" is-active":""}`,onClick:b,"aria-label":"资源库","aria-current":i==="library"?"page":void 0,title:"资源库",children:[o.jsx(aCe,{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(n2,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"定时任务"}),o.jsx(OO,{className:"sidebar-cronjobs-beta",color:"discovery",variant:"soft",size:"sm",pill:!0,children:"Beta"})]}),o.jsxs("button",{className:`new-chat new-chat--applications${i==="applications"?" is-active":""}`,onClick:y,"aria-label":"自动化","aria-current":i==="applications"?"page":void 0,title:"自动化",children:[o.jsx(OCe,{className:"icon"}),o.jsx("span",{className:"sidebar-nav-label",children:"自动化"})]})]})]}),C("history")&&o.jsxs("div",{className:"sidebar-history",children:[o.jsxs("div",{className:"history-head",children:[o.jsx("span",{children:"历史会话"}),C("newChat")&&o.jsx("button",{type:"button",className:"history-new-chat",onClick:(u==null?void 0:u.onNew)??f,disabled:u==null?void 0:u.newDisabled,"aria-label":"新建会话",title:"新建会话",children:o.jsx(qa,{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 U=L.id===u.currentThreadId,F=L.name||L.preview||`Thread ${L.id.slice(0,8)}`,q=L.id===u.busyThreadId;return o.jsxs("div",{className:`history-item ${U?"active":""}`,children:[o.jsxs("button",{type:"button",className:"history-item-btn",onClick:()=>u.onSelect(L.id),"aria-current":U?"page":void 0,title:F,disabled:q,children:[o.jsx("span",{className:"history-title",children:F}),U?o.jsx("span",{className:"history-current-badge",children:"当前"}):null]}),o.jsx("button",{type:"button",className:"history-more","aria-label":`管理历史会话:${F}`,title:"更多",disabled:q,onClick:()=>_(z=>z===L.id?null:L.id),children:o.jsx(HF,{className:"icon"})}),N===L.id?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>_(null)}),o.jsx("div",{className:"history-menu",children:o.jsxs("button",{type:"button",className:"menu-item menu-item--danger",onClick:()=>{_(null),u.onDelete(L)},children:[o.jsx(Rh,{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!=null&&d.loading&&M.length===0?o.jsx("div",{className:"history-empty",role:"status",children:"正在加载历史会话…"}):null,d!=null&&d.error?o.jsx("div",{className:"history-error",role:"alert",children:d.error}):null,!(d!=null&&d.loading)&&!(d!=null&&d.error)&&M.length===0?o.jsx("div",{className:"history-empty",children:"暂无会话"}):null,M.map(L=>{const U=`${L.kind}:${L.id}`,F=L.kind==="intelligent",q=F?L.id===(d==null?void 0:d.currentSessionId):L.id===r,z=F?L.id===(d==null?void 0:d.busySessionId):(l==null?void 0:l.has(L.id))===!0,B=!F&&!z&&(c==null?void 0:c.has(L.id))===!0,V=F&&L.id===(d==null?void 0:d.openingSessionId);return o.jsxs("div",{className:`history-item ${q?"active":""}`,children:[o.jsxs("button",{className:"history-item-btn",onClick:()=>L.kind==="intelligent"?d==null?void 0:d.onSelect(L.session):S(L.id),"aria-current":q?"page":void 0,title:L.title,disabled:V,children:[z&&o.jsx("span",{className:"history-streaming",title:F?"正在构建…":"正在生成…","aria-label":F?"正在构建":"正在生成"}),o.jsx("span",{className:"history-title",children:L.title}),B&&o.jsxs("span",{className:"history-evaluating-status",title:"正在自动评测",children:[o.jsx("span",{className:"history-evaluating","aria-hidden":"true"}),"评测中"]})]}),o.jsx("button",{type:"button",className:"history-more","aria-label":`管理历史会话:${L.title}`,title:"更多",disabled:V||F&&z,onClick:()=>_(ce=>ce===U?null:U),children:o.jsx(HF,{className:"icon"})}),N===U&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"menu-scrim",onClick:()=>_(null)}),o.jsx("div",{className:"history-menu",children:o.jsxs("button",{type:"button",className:"menu-item menu-item--danger",onClick:()=>{_(null),L.kind==="intelligent"?d==null||d.onDelete(L.session):E(L.id)},children:[o.jsx(Rh,{className:"icon"})," 删除"]})})]})]},U)})]})})]}),o.jsxs("div",{className:"sidebar-footer",children:[o.jsx(mCe,{cloudProvider:t}),o.jsx(vCe,{access:a,userInfo:k,onSystemInfo:x,onIssueFeedback:w,onLogout:T})]})]})}function Ss(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{}};function vA(){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}})}Ik.prototype=vA.prototype={constructor:Ik,on:function(e,t){var n=this._,r=ECe(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)),hU.hasOwnProperty(t)?{space:hU[t],local:e}:e}function TCe(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===S5&&t.documentElement.namespaceURI===S5?t.createElement(e):t.createElementNS(n,e)}}function _Ce(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function sie(e){var t=wA(e);return(t.local?_Ce:TCe)(t)}function ACe(){}function T6(e){return e==null?ACe:function(){return this.querySelector(e)}}function CCe(e){typeof e!="function"&&(e=T6(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=x&&(x=v+1);!(S=O[x])&&++x=0;)(a=r[i])&&(s&&a.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(a,s),s=a);return this}function eNe(e){e||(e=tNe);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 nNe(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function rNe(){return Array.from(this)}function iNe(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?mNe:typeof t=="function"?bNe:gNe)(e,t,n??"")):_b(this.node(),e)}function _b(e,t){return e.style.getPropertyValue(t)||uie(e).getComputedStyle(e,null).getPropertyValue(t)}function yNe(e){return function(){delete this[e]}}function xNe(e,t){return function(){this[e]=t}}function vNe(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function wNe(e,t){return arguments.length>1?this.each((t==null?yNe:typeof t=="function"?vNe:xNe)(e,t)):this.node()[e]}function die(e){return e.trim().split(/^|\s+/)}function _6(e){return e.classList||new fie(e)}function fie(e){this._node=e,this._names=die(e.getAttribute("class")||"")}fie.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 hie(e,t){for(var n=_6(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function WNe(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,s;n()=>e;function E5(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}})}E5.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function aje(e){return!e.ctrlKey&&!e.button}function oje(){return this.parentNode}function lje(e,t){return t??{x:e.x,y:e.y}}function cje(){return navigator.maxTouchPoints||"ontouchstart"in this}function yie(){var e=aje,t=oje,n=lje,r=cje,i={},s=vA("start","drag","end"),a=0,l,c,u,d,f=0;function h(w){w.on("mousedown.drag",p).filter(r).on("touchstart.drag",O).on("touchmove.drag",y,sje).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(w,S){if(!(d||!e.call(this,w,S))){var E=x(this,t.call(this,w,S),w,S,"mouse");E&&(Xo(w.view).on("mousemove.drag",b,Rx).on("mouseup.drag",g,Rx),bie(w.view),zj(w),u=!1,l=w.clientX,c=w.clientY,E("start",w))}}function b(w){if(U0(w),!u){var S=w.clientX-l,E=w.clientY-c;u=S*S+E*E>f}i.mouse("drag",w)}function g(w){Xo(w.view).on("mousemove.drag mouseup.drag",null),Oie(w.view,u),U0(w),i.mouse("end",w)}function O(w,S){if(e.call(this,w,S)){var E=w.changedTouches,k=t.call(this,w,S),T=E.length,C,N;for(C=0;C>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?zS(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?zS(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=dje.exec(e))?new fo(t[1],t[2],t[3],1):(t=fje.exec(e))?new fo(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=hje.exec(e))?zS(t[1],t[2],t[3],t[4]):(t=pje.exec(e))?zS(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=mje.exec(e))?xU(t[1],t[2]/100,t[3]/100,1):(t=gje.exec(e))?xU(t[1],t[2]/100,t[3]/100,t[4]):pU.hasOwnProperty(e)?bU(pU[e]):e==="transparent"?new fo(NaN,NaN,NaN,0):null}function bU(e){return new fo(e>>16&255,e>>8&255,e&255,1)}function zS(e,t,n,r){return r<=0&&(e=t=n=NaN),new fo(e,t,n,r)}function yje(e){return e instanceof tw||(e=Em(e)),e?(e=e.rgb(),new fo(e.r,e.g,e.b,e.opacity)):new fo}function k5(e,t,n,r){return arguments.length===1?yje(e):new fo(e,t,n,r??1)}function fo(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}A6(fo,k5,xie(tw,{brighter(e){return e=e==null?d2:Math.pow(d2,e),new fo(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ix:Math.pow(Ix,e),new fo(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new fo(um(this.r),um(this.g),um(this.b),f2(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:OU,formatHex:OU,formatHex8:xje,formatRgb:yU,toString:yU}));function OU(){return`#${Gp(this.r)}${Gp(this.g)}${Gp(this.b)}`}function xje(){return`#${Gp(this.r)}${Gp(this.g)}${Gp(this.b)}${Gp((isNaN(this.opacity)?1:this.opacity)*255)}`}function yU(){const e=f2(this.opacity);return`${e===1?"rgb(":"rgba("}${um(this.r)}, ${um(this.g)}, ${um(this.b)}${e===1?")":`, ${e})`}`}function f2(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function um(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Gp(e){return e=um(e),(e<16?"0":"")+e.toString(16)}function xU(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new mc(e,t,n,r)}function vie(e){if(e instanceof mc)return new mc(e.h,e.s,e.l,e.opacity);if(e instanceof tw||(e=Em(e)),!e)return new mc;if(e instanceof mc)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 mc(a,l,c,e.opacity)}function vje(e,t,n,r){return arguments.length===1?vie(e):new mc(e,t,n,r??1)}function mc(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}A6(mc,vje,xie(tw,{brighter(e){return e=e==null?d2:Math.pow(d2,e),new mc(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ix:Math.pow(Ix,e),new mc(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 fo(Vj(e>=240?e-240:e+120,i,r),Vj(e,i,r),Vj(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new mc(vU(this.h),VS(this.s),VS(this.l),f2(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=f2(this.opacity);return`${e===1?"hsl(":"hsla("}${vU(this.h)}, ${VS(this.s)*100}%, ${VS(this.l)*100}%${e===1?")":`, ${e})`}`}}));function vU(e){return e=(e||0)%360,e<0?e+360:e}function VS(e){return Math.max(0,Math.min(1,e||0))}function Vj(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 SA=e=>()=>e;function wie(e,t){return function(n){return e+n*t}}function wje(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 CTt(e,t){var n=t-e;return n?wie(e,n>180||n<-180?n-360*Math.round(n/360):n):SA(isNaN(e)?t:e)}function Sje(e){return(e=+e)==1?Sie:function(t,n){return n-t?wje(t,n,e):SA(isNaN(t)?n:t)}}function Sie(e,t){var n=t-e;return n?wie(e,n):SA(isNaN(e)?t:e)}const h2=function e(t){var n=Sje(t);function r(i,s){var a=n((i=k5(i)).r,(s=k5(s)).r),l=n(i.g,s.g),c=n(i.b,s.b),u=Sie(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 Eje(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:nu(r,i)})),n=qj.lastIndex;return n180?d+=360:d-u>180&&(u+=360),h.push({i:f.push(i(f)+"rotate(",null,r)-2,x:nu(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:nu(u,d)}):d&&f.push(i(f)+"skewX("+d+r)}function c(u,d,f,h,p,b){if(u!==f||d!==h){var g=p.push(i(p)+"scale(",null,",",null,")");b.push({i:g-4,x:nu(u,f)},{i:g-2,x:nu(d,h)})}else(f!==1||h!==1)&&p.push(i(p)+"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(p){for(var b=-1,g=h.length,O;++b=0&&e._call.call(void 0,t),e=e._next;--Ab}function EU(){km=(m2=Px.now())+EA,Ab=e1=0;try{Bje()}finally{Ab=0,Fje(),km=0}}function Qje(){var e=Px.now(),t=e-m2;t>_ie&&(EA-=t,m2=e)}function Fje(){for(var e,t=p2,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:p2=n);t1=e,A5(r)}function A5(e){if(!Ab){e1&&(e1=clearTimeout(e1));var t=e-km;t>24?(e<1/0&&(e1=setTimeout(EU,e-Px.now()-EA)),Oy&&(Oy=clearInterval(Oy))):(Oy||(m2=Px.now(),Oy=setInterval(Qje,_ie)),Ab=1,Aie(EU))}}function kU(e,t,n){var r=new g2;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var Uje=vA("start","end","cancel","interrupt"),zje=[],Nie=0,TU=1,C5=2,Pk=3,_U=4,N5=5,Mk=6;function kA(e,t,n,r,i,s){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;Vje(e,n,{name:t,index:r,group:i,on:Uje,tween:zje,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Nie})}function N6(e,t){var n=Nc(e,t);if(n.state>Nie)throw new Error("too late; already scheduled");return n}function Iu(e,t){var n=Nc(e,t);if(n.state>Pk)throw new Error("too late; already running");return n}function Nc(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Vje(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Cie(s,0,n.time);function s(u){n.state=TU,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var d,f,h,p;if(n.state!==TU)return c();for(d in r)if(p=r[d],p.name===n.name){if(p.state===Pk)return kU(a);p.state===_U?(p.state=Mk,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete r[d]):+dC5&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function xRe(e,t,n){var r,i,s=yRe(t)?N6:Iu;return function(){var a=s(this,e),l=a.on;l!==r&&(i=(r=l).copy()).on(t,n),a.on=i}}function vRe(e,t){var n=this._id;return arguments.length<2?Nc(this.node(),n).on.on(e):this.each(xRe(n,e,t))}function wRe(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function SRe(){return this.on("end.remove",wRe(this._id))}function ERe(e){var t=this._name,n=this._id;typeof e!="function"&&(e=T6(e));for(var r=this._groups,i=r.length,s=new Array(i),a=0;a()=>e;function YRe(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 kd(e,t,n){this.k=e,this.x=t,this.y=n}kd.prototype={constructor:kd,scale:function(e){return e===1?this:new kd(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new kd(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 TA=new kd(1,0,0);Die.prototype=kd.prototype;function Die(e){for(;!e.__zoom;)if(!(e=e.parentNode))return TA;return e.__zoom}function Hj(e){e.stopImmediatePropagation()}function yy(e){e.preventDefault(),e.stopImmediatePropagation()}function WRe(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function ZRe(){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 AU(){return this.__zoom||TA}function KRe(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function JRe(){return navigator.maxTouchPoints||"ontouchstart"in this}function eIe(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 Pie(){var e=WRe,t=ZRe,n=eIe,r=KRe,i=JRe,s=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Dk,u=vA("start","zoom","end"),d,f,h,p=500,b=150,g=0,O=10;function y(D){D.property("__zoom",AU).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",C).on("dblclick.zoom",N).filter(i).on("touchstart.zoom",_).on("touchmove.zoom",R).on("touchend.zoom touchcancel.zoom",$).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(D,M,j,P){var L=D.selection?D.selection():D;L.property("__zoom",AU),D!==L?S(D,M,j,P):L.interrupt().each(function(){E(this,arguments).event(P).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},y.scaleBy=function(D,M,j,P){y.scaleTo(D,function(){var L=this.__zoom.k,U=typeof M=="function"?M.apply(this,arguments):M;return L*U},j,P)},y.scaleTo=function(D,M,j,P){y.transform(D,function(){var L=t.apply(this,arguments),U=this.__zoom,F=j==null?w(L):typeof j=="function"?j.apply(this,arguments):j,q=U.invert(F),z=typeof M=="function"?M.apply(this,arguments):M;return n(x(v(U,z),F,q),L,a)},j,P)},y.translateBy=function(D,M,j,P){y.transform(D,function(){return n(this.__zoom.translate(typeof M=="function"?M.apply(this,arguments):M,typeof j=="function"?j.apply(this,arguments):j),t.apply(this,arguments),a)},null,P)},y.translateTo=function(D,M,j,P,L){y.transform(D,function(){var U=t.apply(this,arguments),F=this.__zoom,q=P==null?w(U):typeof P=="function"?P.apply(this,arguments):P;return n(TA.translate(q[0],q[1]).scale(F.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof j=="function"?-j.apply(this,arguments):-j),U,a)},P,L)};function v(D,M){return M=Math.max(s[0],Math.min(s[1],M)),M===D.k?D:new kd(M,D.x,D.y)}function x(D,M,j){var P=M[0]-j[0]*D.k,L=M[1]-j[1]*D.k;return P===D.x&&L===D.y?D:new kd(D.k,P,L)}function w(D){return[(+D[0][0]+ +D[1][0])/2,(+D[0][1]+ +D[1][1])/2]}function S(D,M,j,P){D.on("start.zoom",function(){E(this,arguments).event(P).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(P).end()}).tween("zoom",function(){var L=this,U=arguments,F=E(L,U).event(P),q=t.apply(L,U),z=j==null?w(q):typeof j=="function"?j.apply(L,U):j,B=Math.max(q[1][0]-q[0][0],q[1][1]-q[0][1]),V=L.__zoom,ce=typeof M=="function"?M.apply(L,U):M,we=c(V.invert(z).concat(B/V.k),ce.invert(z).concat(B/ce.k));return function(Oe){if(Oe===1)Oe=ce;else{var de=we(Oe),Z=B/de[2];Oe=new kd(Z,z[0]-de[0]*Z,z[1]-de[1]*Z)}F.zoom(null,Oe)}})}function E(D,M,j){return!j&&D.__zooming||new k(D,M)}function k(D,M){this.that=D,this.args=M,this.active=0,this.sourceEvent=null,this.extent=t.apply(D,M),this.taps=0}k.prototype={event:function(D){return D&&(this.sourceEvent=D),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(D,M){return this.mouse&&D!=="mouse"&&(this.mouse[1]=M.invert(this.mouse[0])),this.touch0&&D!=="touch"&&(this.touch0[1]=M.invert(this.touch0[0])),this.touch1&&D!=="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(D){var M=Xo(this.that).datum();u.call(D,this.that,new YRe(D,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:u}),M)}};function T(D,...M){if(!e.apply(this,arguments))return;var j=E(this,M).event(D),P=this.__zoom,L=Math.max(s[0],Math.min(s[1],P.k*Math.pow(2,r.apply(this,arguments)))),U=fc(D);if(j.wheel)(j.mouse[0][0]!==U[0]||j.mouse[0][1]!==U[1])&&(j.mouse[1]=P.invert(j.mouse[0]=U)),clearTimeout(j.wheel);else{if(P.k===L)return;j.mouse=[U,P.invert(U)],Lk(this),j.start()}yy(D),j.wheel=setTimeout(F,b),j.zoom("mouse",n(x(v(P,L),j.mouse[0],j.mouse[1]),j.extent,a));function F(){j.wheel=null,j.end()}}function C(D,...M){if(h||!e.apply(this,arguments))return;var j=D.currentTarget,P=E(this,M,!0).event(D),L=Xo(D.view).on("mousemove.zoom",z,!0).on("mouseup.zoom",B,!0),U=fc(D,j),F=D.clientX,q=D.clientY;bie(D.view),Hj(D),P.mouse=[U,this.__zoom.invert(U)],Lk(this),P.start();function z(V){if(yy(V),!P.moved){var ce=V.clientX-F,we=V.clientY-q;P.moved=ce*ce+we*we>g}P.event(V).zoom("mouse",n(x(P.that.__zoom,P.mouse[0]=fc(V,j),P.mouse[1]),P.extent,a))}function B(V){L.on("mousemove.zoom mouseup.zoom",null),Oie(V.view,P.moved),yy(V),P.event(V).end()}}function N(D,...M){if(e.apply(this,arguments)){var j=this.__zoom,P=fc(D.changedTouches?D.changedTouches[0]:D,this),L=j.invert(P),U=j.k*(D.shiftKey?.5:2),F=n(x(v(j,U),P,L),t.apply(this,M),a);yy(D),l>0?Xo(this).transition().duration(l).call(S,F,P,D):Xo(this).call(y.transform,F,P,D)}}function _(D,...M){if(e.apply(this,arguments)){var j=D.touches,P=j.length,L=E(this,M,D.changedTouches.length===P).event(D),U,F,q,z;for(Hj(D),F=0;F`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.`},Mx=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Mie=["Enter"," ","Escape"],Lie={"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 Cb;(function(e){e.Strict="strict",e.Loose="loose"})(Cb||(Cb={}));var dm;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(dm||(dm={}));var Lx;(function(e){e.Partial="partial",e.Full="full"})(Lx||(Lx={}));const $ie={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Wf;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Wf||(Wf={}));var $x;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})($x||($x={}));var Nt;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Nt||(Nt={}));const CU={[Nt.Left]:Nt.Right,[Nt.Right]:Nt.Left,[Nt.Top]:Nt.Bottom,[Nt.Bottom]:Nt.Top};function Bie(e){return e===null?null:e?"valid":"invalid"}const Qie=e=>"id"in e&&"source"in e&&"target"in e,tIe=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),R6=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),nw=(e,t=[0,0])=>{const{width:n,height:r}=of(e),i=e.origin??t,s=n*i[0],a=r*i[1];return{x:e.position.x-s,y:e.position.y-a}},nIe=(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):R6(i)?i:t.nodeLookup.get(i.id));const l=a?b2(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return _A(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return AA(n)},rw=(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=_A(n,b2(i)),r=!0)}),r?AA(n):{x:0,y:0,width:0,height:0}},I6=(e,t,[n,r,i]=[0,0,1],s=!1,a=!1)=>{const l={...yO(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 p=d.width??u.width??u.initialWidth??null,b=d.height??u.height??u.initialHeight??null,g=Bx(l,jb(u)),O=(p??0)*(b??0),y=s&&g>0;(!u.internals.handleBounds||y||g>=O||u.dragging)&&c.push(u)}return c},rIe=(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 iIe(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 sIe({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:s},a){if(e.size===0)return!0;const l=iIe(e,a),c=rw(l),u=P6(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 Fie({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",Tc.error005());else{const p=l.measured.width,b=l.measured.height;p&&b&&(f=[[c,u],[c+p,u+b]])}else l&&_m(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=_m(f)?Tm(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(s==null||s("015",Tc.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 aIe({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 p=s.has(h.id),b=!p&&h.parentId&&a.find(g=>g.id===h.parentId);(p||b)&&a.push(h)}const l=new Set(t.map(h=>h.id)),c=r.filter(h=>h.deletable!==!1),d=rIe(a,c);for(const h of c)l.has(h.id)&&!d.find(b=>b.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 Nb=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Tm=(e={x:0,y:0},t,n)=>({x:Nb(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Nb(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function Uie(e,t,n){const{width:r,height:i}=of(n),{x:s,y:a}=n.internals.positionAbsolute;return Tm(e,[[s,a],[s+r,a+i]],t)}const NU=(e,t,n)=>en?-Nb(Math.abs(e-n),1,t)/t:0,D6=(e,t,n=15,r=40)=>{const i=NU(e.x,r,t.width-r)*n,s=NU(e.y,r,t.height-r)*n;return[i,s]},_A=(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)}),j5=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),AA=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),jb=(e,t=[0,0])=>{var i,s;const{x:n,y:r}=R6(e)?e.internals.positionAbsolute:nw(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}},b2=(e,t=[0,0])=>{var i,s;const{x:n,y:r}=R6(e)?e.internals.positionAbsolute:nw(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)}},zie=(e,t)=>AA(_A(j5(e),j5(t))),Bx=(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)},jU=e=>bc(e.width)&&bc(e.height)&&bc(e.x)&&bc(e.y),bc=e=>!isNaN(e)&&isFinite(e),Vie=(e,t)=>(n,r)=>{},iw=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),yO=({x:e,y:t},[n,r,i],s=!1,a=[1,1])=>{const l={x:(e-n)/i,y:(t-r)/i};return s?iw(l,a):l},Rb=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function Eg(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 oIe(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Eg(e,n),i=Eg(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e=="object"){const r=Eg(e.top??e.y??0,n),i=Eg(e.bottom??e.y??0,n),s=Eg(e.left??e.x??0,t),a=Eg(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 lIe(e,t,n,r,i,s){const{x:a,y:l}=Rb(e,[t,n,r]),{x:c,y:u}=Rb({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 P6=(e,t,n,r,i,s)=>{const a=oIe(s,t,n),l=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(l,c),d=Nb(u,r,i),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d,b=n/2-h*d,g=lIe(e,p,b,d,t,n),O={left:Math.min(g.left-a.left,0),top:Math.min(g.top-a.top,0),right:Math.min(g.right-a.right,0),bottom:Math.min(g.bottom-a.bottom,0)};return{x:p-O.left+O.right,y:b-O.top+O.bottom,zoom:d}},Qx=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function _m(e){return e!=null&&e!=="parent"}function of(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 M6(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 qie(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 RU(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function cIe(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}function uIe(e){return{...Lie,...e||{}}}function $1(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){const{x:s,y:a}=Oc(e),l=yO({x:s-((i==null?void 0:i.left)??0),y:a-((i==null?void 0:i.top)??0)},r),{x:c,y:u}=n?iw(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const L6=e=>({width:e.offsetWidth,height:e.offsetHeight}),Hie=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},dIe=["INPUT","SELECT","TEXTAREA"];function Xie(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:dIe.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Gie=e=>"clientX"in e,Oc=(e,t)=>{var s,a;const n=Gie(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)}},IU=(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,...L6(a)}})};function Yie({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 XS(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function DU({pos:e,x1:t,y1:n,x2:r,y2:i,c:s}){switch(e){case Nt.Left:return[t-XS(t-r,s),n];case Nt.Right:return[t+XS(r-t,s),n];case Nt.Top:return[t,n-XS(n-i,s)];case Nt.Bottom:return[t,n+XS(i-n,s)]}}function Wie({sourceX:e,sourceY:t,sourcePosition:n=Nt.Bottom,targetX:r,targetY:i,targetPosition:s=Nt.Top,curvature:a=.25}){const[l,c]=DU({pos:n,x1:e,y1:t,x2:r,y2:i,c:a}),[u,d]=DU({pos:s,x1:r,y1:i,x2:e,y2:t,c:a}),[f,h,p,b]=Yie({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,p,b]}function Zie({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,s=n0}const pIe=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,mIe=(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)),gIe=(e,t,n={})=>{var s;if(!e.source||!e.target)return(s=n.onError)==null||s.call(n,"006",Tc.error006()),t;const r=n.getEdgeId||pIe;let i;return Qie(e)?i={...e}:i={...e,id:r(e)},mIe(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function Kie({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,s,a,l]=Zie({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,s,a,l]}const PU={[Nt.Left]:{x:-1,y:0},[Nt.Right]:{x:1,y:0},[Nt.Top]:{x:0,y:-1},[Nt.Bottom]:{x:0,y:1}},bIe=({source:e,sourcePosition:t=Nt.Bottom,target:n})=>t===Nt.Left||t===Nt.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function OIe({source:e,sourcePosition:t=Nt.Bottom,target:n,targetPosition:r=Nt.Top,center:i,offset:s,stepPosition:a}){const l=PU[t],c=PU[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=bIe({source:u,sourcePosition:t,target:d}),h=f.x!==0?"x":"y",p=f[h];let b=[],g,O;const y={x:0,y:0},v={x:0,y:0},[,,x,w]=Zie({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[h]*c[h]===-1){h==="x"?(g=i.x??u.x+(d.x-u.x)*a,O=i.y??(u.y+d.y)/2):(g=i.x??(u.x+d.x)/2,O=i.y??u.y+(d.y-u.y)*a);const T=[{x:g,y:u.y},{x:g,y:d.y}],C=[{x:u.x,y:O},{x:d.x,y:O}];l[h]===p?b=h==="x"?T:C:b=h==="x"?C:T}else{const T=[{x:u.x,y:d.y}],C=[{x:d.x,y:u.y}];if(h==="x"?b=l.x===p?C:T:b=l.y===p?T:C,t===r){const D=Math.abs(e[h]-n[h]);if(D<=s){const M=Math.min(s-1,s-D);l[h]===p?y[h]=(u[h]>e[h]?-1:1)*M:v[h]=(d[h]>n[h]?-1:1)*M}}if(t!==r){const D=h==="x"?"y":"x",M=l[h]===c[D],j=u[D]>d[D],P=u[D]=$?(g=(N.x+_.x)/2,O=b[0].y):(g=b[0].x,O=(N.y+_.y)/2)}const S={x:u.x+y.x,y:u.y+y.y},E={x:d.x+v.x,y:d.y+v.y};return[[e,...S.x!==b[0].x||S.y!==b[0].y?[S]:[],...b,...E.x!==b[b.length-1].x||E.y!==b[b.length-1].y?[E]:[],n],g,O,x,w]}function yIe(e,t,n,r){const i=Math.min(MU(e,t)/2,MU(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 R5(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function vIe(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=R5(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 Jie=1e3,wIe=10,$6={nodeOrigin:[0,0],nodeExtent:Mx,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},SIe={...$6,checkEquality:!0};function B6(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function EIe(e,t,n){const r=B6($6,n);for(const i of e.values())if(i.parentId)F6(i,e,t,r);else{const s=nw(i,r.nodeOrigin),a=_m(i.extent)?i.extent:r.nodeExtent,l=Tm(s,a,of(i));i.internals.positionAbsolute=l}}function kIe(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 Q6(e){return e==="manual"}function I5(e,t,n,r={}){var d,f;const i=B6(SIe,r),s={i:0},a=new Map(t),l=i!=null&&i.elevateNodesOnSelect&&!Q6(i.zIndexMode)?Jie:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const h of e){let p=a.get(h.id);if(i.checkEquality&&h===(p==null?void 0:p.internals.userNode))t.set(h.id,p);else{const b=nw(h,i.nodeOrigin),g=_m(h.extent)?h.extent:i.nodeExtent,O=Tm(b,g,of(h));p={...i.defaults,...h,measured:{width:(d=h.measured)==null?void 0:d.width,height:(f=h.measured)==null?void 0:f.height},internals:{positionAbsolute:O,handleBounds:kIe(h,p),z:ese(h,l,i.zIndexMode),userNode:h}},t.set(h.id,p)}(p.measured===void 0||p.measured.width===void 0||p.measured.height===void 0)&&!p.hidden&&(c=!1),h.parentId&&F6(p,t,n,r,s),u||(u=h.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function TIe(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 F6(e,t,n,r,i){const{elevateNodesOnSelect:s,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=B6($6,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}TIe(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*wIe),i&&d.internals.rootParentIndex!==void 0&&(i.i=d.internals.rootParentIndex);const f=s&&!Q6(c)?Jie:0,{x:h,y:p,z:b}=_Ie(e,d,a,l,f,c),{positionAbsolute:g}=e.internals,O=h!==g.x||p!==g.y;(O||b!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:O?{x:h,y:p}:g,z:b}})}function ese(e,t,n){const r=bc(e.zIndex)?e.zIndex:0;return Q6(n)?r:r+(e.selected?t:0)}function _Ie(e,t,n,r,i,s){const{x:a,y:l}=t.internals.positionAbsolute,c=of(e),u=nw(e,n),d=_m(e.extent)?Tm(u,e.extent,c):u;let f=Tm({x:a+d.x,y:l+d.y},r,c);e.extent==="parent"&&(f=Uie(f,c,t));const h=ese(e,i,s),p=t.internals.z??0;return{x:f.x,y:f.y,z:p>=h?p+1:h}}function U6(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)??jb(c),d=zie(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=of(c),h=c.origin??r,p=l.x0||b>0||y||v)&&(i.push({id:u,type:"position",position:{x:c.position.x-p+y,y:c.position.y-b+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+p,y:w.position.y+b}})})),(f.width0){const p=U6(h,t,n,i);u.push(...p)}return{changes:u,updatedInternals:c}}async function CIe({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 QU(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 tse(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}`;QU("source",c,d,e,i,a),QU("target",c,u,e,s,l),t.set(r.id,r)}}function nse(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:nse(n,t):!1}function FU(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 NIe(e,t,n,r){const i=new Map;for(const[s,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!nse(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 Xj({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 jIe({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=iw(s,t);return{x:a.x-s.x,y:a.y-s.y}}function RIe({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,p=!1,b=!1,g=null;function O({noDragClassName:v,handleSelector:x,domNode:w,isSelectable:S,nodeId:E,nodeClickDistance:k=0}){h=Xo(w);function T({x:R,y:$}){const{nodeLookup:D,nodeExtent:M,snapGrid:j,snapToGrid:P,nodeOrigin:L,onNodeDrag:U,onSelectionDrag:F,onError:q,updateNodePositions:z}=t();s={x:R,y:$};let B=!1;const V=l.size>1,ce=V&&M?j5(rw(l)):null,we=V&&P?jIe({dragItems:l,snapGrid:j,x:R,y:$}):null;for(const[Oe,de]of l){if(!D.has(Oe))continue;let Z={x:R-de.distance.x,y:$-de.distance.y};P&&(Z=we?{x:Math.round(Z.x+we.x),y:Math.round(Z.y+we.y)}:iw(Z,j));let J=null;if(V&&M&&!de.extent&&ce){const{positionAbsolute:je}=de.internals,Qe=je.x-ce.x+M[0][0],Me=je.x+de.measured.width-ce.x2+M[1][0],le=je.y-ce.y+M[0][1],ke=je.y+de.measured.height-ce.y2+M[1][1];J=[[Qe,le],[Me,ke]]}const{position:fe,positionAbsolute:be}=Fie({nodeId:Oe,nextPosition:Z,nodeLookup:D,nodeExtent:J||M,nodeOrigin:L,onError:q});B=B||de.position.x!==fe.x||de.position.y!==fe.y,de.position=fe,de.internals.positionAbsolute=be}if(b=b||B,!!B&&(z(l,!0),g&&(r||U||!E&&F))){const[Oe,de]=Xj({nodeId:E,dragItems:l,nodeLookup:D});r==null||r(g,l,Oe,de),U==null||U(g,Oe,de),E||F==null||F(g,de)}}async function C(){if(!d)return;const{transform:R,panBy:$,autoPanSpeed:D,autoPanOnNodeDrag:M}=t();if(!M){c=!1,cancelAnimationFrame(a);return}const[j,P]=D6(u,d,D);(j!==0||P!==0)&&(s.x=(s.x??0)-j/R[2],s.y=(s.y??0)-P/R[2],await $({x:j,y:P})&&T(s)),a=requestAnimationFrame(C)}function N(R){var V;const{nodeLookup:$,multiSelectionActive:D,nodesDraggable:M,transform:j,snapGrid:P,snapToGrid:L,selectNodesOnDrag:U,onNodeDragStart:F,onSelectionDragStart:q,unselectNodesAndEdges:z}=t();f=!0,(!U||!S)&&!D&&E&&((V=$.get(E))!=null&&V.selected||z()),S&&U&&E&&(e==null||e(E));const B=$1(R.sourceEvent,{transform:j,snapGrid:P,snapToGrid:L,containerBounds:d});if(s=B,l=NIe($,M,B,E),l.size>0&&(n||F||!E&&q)){const[ce,we]=Xj({nodeId:E,dragItems:l,nodeLookup:$});n==null||n(R.sourceEvent,l,ce,we),F==null||F(R.sourceEvent,ce,we),E||q==null||q(R.sourceEvent,we)}}const _=yie().clickDistance(k).on("start",R=>{const{domNode:$,nodeDragThreshold:D,transform:M,snapGrid:j,snapToGrid:P}=t();d=($==null?void 0:$.getBoundingClientRect())||null,p=!1,b=!1,g=R.sourceEvent,D===0&&N(R),s=$1(R.sourceEvent,{transform:M,snapGrid:j,snapToGrid:P,containerBounds:d}),u=Oc(R.sourceEvent,d)}).on("drag",R=>{const{autoPanOnNodeDrag:$,transform:D,snapGrid:M,snapToGrid:j,nodeDragThreshold:P,nodeLookup:L}=t(),U=$1(R.sourceEvent,{transform:D,snapGrid:M,snapToGrid:j,containerBounds:d});if(g=R.sourceEvent,(R.sourceEvent.type==="touchmove"&&R.sourceEvent.touches.length>1||E&&!L.has(E))&&(p=!0),!p){if(!c&&$&&f&&(c=!0,C()),!f){const F=Oc(R.sourceEvent,d),q=F.x-u.x,z=F.y-u.y;Math.sqrt(q*q+z*z)>P&&N(R)}(s.x!==U.xSnapped||s.y!==U.ySnapped)&&l&&f&&(u=Oc(R.sourceEvent,d),T(U))}}).on("end",R=>{if(!f||p){p&&l.size>0&&t().updateNodePositions(l,!1);return}if(c=!1,f=!1,cancelAnimationFrame(a),l.size>0){const{nodeLookup:$,updateNodePositions:D,onNodeDragStop:M,onSelectionDragStop:j}=t();if(b&&(D(l,!1),b=!1),i||M||!E&&j){const[P,L]=Xj({nodeId:E,dragItems:l,nodeLookup:$,dragging:!1});i==null||i(R.sourceEvent,l,P,L),M==null||M(R.sourceEvent,P,L),E||j==null||j(R.sourceEvent,L)}}}).filter(R=>{const $=R.target;return!R.button&&(!v||!FU($,`.${v}`,w))&&(!x||FU($,x,w))});h.call(_)}function y(){h==null||h.on(".drag",null)}return{update:O,destroy:y}}function IIe(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())Bx(i,jb(s))>0&&r.push(s);return r}const DIe=250;function PIe(e,t,n,r){var l,c;let i=[],s=1/0;const a=IIe(e,n,t+DIe);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:p}=Am(u,f,f.position,!0),b=Math.sqrt(Math.pow(h-e.x,2)+Math.pow(p-e.y,2));b>t||(b1){const u=r.type==="source"?"target":"source";return i.find(d=>d.type===u)??i[0]}return i[0]}function rse(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,...Am(a,c,c.position,!0)}:c}function ise(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function MIe(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const sse=()=>!0;function LIe(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:p,onConnectStart:b,onConnect:g,onConnectEnd:O,isValidConnection:y=sse,onReconnectEnd:v,updateConnection:x,getTransform:w,getFromHandle:S,autoPanSpeed:E,dragThreshold:k=1,handleDomNode:T}){const C=Hie(e.target);let N=0,_;const{x:R,y:$}=Oc(e),D=ise(s,T),M=l==null?void 0:l.getBoundingClientRect();let j=!1;if(!M||!D)return;const P=rse(i,D,r,c,t);if(!P)return;let L=Oc(e,M),U=!1,F=null,q=!1,z=null;function B(){if(!d||!M)return;const[fe,be]=D6(L,M,E);h({x:fe,y:be}),N=requestAnimationFrame(B)}const V={...P,nodeId:i,type:D,position:P.position},ce=c.get(i);let Oe={inProgress:!0,isValid:null,from:Am(ce,V,Nt.Left,!0),fromHandle:V,fromPosition:V.position,fromNode:ce,to:L,toHandle:null,toPosition:CU[V.position],toNode:null,pointer:L};function de(){j=!0,x(Oe),b==null||b(e,{nodeId:i,handleId:r,handleType:D})}k===0&&de();function Z(fe){if(!j){const{x:ke,y:ye}=Oc(fe),$e=ke-R,ze=ye-$;if(!($e*$e+ze*ze>k*k))return;de()}if(!S()||!V){J(fe);return}const be=w();L=Oc(fe,M),_=PIe(yO(L,be,!1,[1,1]),n,c,V),U||(B(),U=!0);const je=ase(fe,{handle:_,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:a?"target":"source",isValidConnection:y,doc:C,lib:u,flowId:f,nodeLookup:c});z=je.handleDomNode,F=je.connection,q=MIe(!!_,je.isValid);const Qe=c.get(i),Me=Qe?Am(Qe,V,Nt.Left,!0):Oe.from,le={...Oe,from:Me,isValid:q,to:je.toHandle&&q?Rb({x:je.toHandle.x,y:je.toHandle.y},be):L,toHandle:je.toHandle,toPosition:q&&je.toHandle?je.toHandle.position:CU[V.position],toNode:je.toHandle?c.get(je.toHandle.nodeId):null,pointer:L};x(le),Oe=le}function J(fe){if(!("touches"in fe&&fe.touches.length>0)){if(j){(_||z)&&F&&q&&(g==null||g(F));const{inProgress:be,...je}=Oe,Qe={...je,toPosition:Oe.toHandle?Oe.toPosition:null};O==null||O(fe,Qe),s&&(v==null||v(fe,Qe))}p(),cancelAnimationFrame(N),U=!1,q=!1,F=null,z=null,C.removeEventListener("mousemove",Z),C.removeEventListener("mouseup",J),C.removeEventListener("touchmove",Z),C.removeEventListener("touchend",J)}}C.addEventListener("mousemove",Z),C.addEventListener("mouseup",J),C.addEventListener("touchmove",Z),C.addEventListener("touchend",J)}function ase(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:s,doc:a,lib:l,flowId:c,isValidConnection:u=sse,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:p,y:b}=Oc(e),g=a.elementFromPoint(p,b),O=g!=null&&g.classList.contains(`${l}-flow__handle`)?g:h,y={handleDomNode:O,isValid:!1,connection:null,toHandle:null};if(O){const v=ise(void 0,O),x=O.getAttribute("data-nodeid"),w=O.getAttribute("data-handleid"),S=O.classList.contains("connectable"),E=O.classList.contains("connectableend");if(!x||!v)return y;const k={source:f?x:r,sourceHandle:f?w:i,target:f?r:x,targetHandle:f?i:w};y.connection=k;const C=S&&E&&(n===Cb.Strict?f&&v==="source"||!f&&v==="target":x!==r||w!==i);y.isValid=C&&u(k),y.toHandle=rse(x,v,w,d,n,!0)}return y}const D5={onPointerDown:LIe,isValid:ase};function $Ie({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const i=Xo(e);function s({translateExtent:l,width:c,height:u,zoomStep:d=1,pannable:f=!0,zoomable:h=!0,inversePan:p=!1}){const b=x=>{if(x.sourceEvent.type!=="wheel"||!t)return;const w=n(),S=x.sourceEvent.ctrlKey&&Qx()?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 g=[0,0];const O=x=>{(x.sourceEvent.type==="mousedown"||x.sourceEvent.type==="touchstart")&&(g=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY])},y=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]-g[0],S[1]-g[1]];g=S;const k=r()*Math.max(w[2],Math.log(w[2]))*(p?-1:1),T={x:w[0]-E[0]*k,y:w[1]-E[1]*k},C=[[0,0],[c,u]];t.setViewportConstrained({x:T.x,y:T.y,zoom:w[2]},C,l)},v=Pie().on("start",O).on("zoom",f?y:null).on("zoom.wheel",h?b:null);i.call(v,{})}function a(){i.on("zoom",null)}return{update:s,destroy:a,pointer:fc}}const CA=e=>({x:e.x,y:e.y,zoom:e.k}),Gj=({x:e,y:t,zoom:n})=>TA.translate(e,t).scale(n),x0=(e,t)=>e.target.closest(`.${t}`),ose=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),BIe=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Yj=(e,t=0,n=BIe,r=()=>{})=>{const i=typeof t=="number"&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on("end",r):e},lse=e=>{const t=e.ctrlKey&&Qx()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function QIe({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:s,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(x0(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&a){const O=fc(d),y=lse(d),v=f*Math.pow(2,y);r.scaleTo(n,v,O,d);return}const h=d.deltaMode===1?20:1;let p=i===dm.Vertical?0:d.deltaX*h,b=i===dm.Horizontal?0:d.deltaY*h;!Qx()&&d.shiftKey&&i!==dm.Vertical&&(p=d.deltaY*h,b=0),r.translateBy(n,-(p/f)*s,-(b/f)*s,{internal:!0});const g=CA(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,g),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,g),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(d,g))}}function FIe({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){const s=r.type==="wheel",a=!t&&s&&!r.ctrlKey,l=x0(r,e);if(r.ctrlKey&&s&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,i)}}function UIe({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var s,a,l;if((s=r.sourceEvent)!=null&&s.internal)return;const i=CA(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 zIe({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return s=>{var a,l;e.usedRightMouseButton=!!(n&&ose(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,CA(s.transform)))}}function VIe({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&&ose(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&s(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){const c=CA(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i==null||i(a.sourceEvent,c)},n?150:0)}}}function qIe({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 O;const h=e||t,p=n&&f.ctrlKey,b=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(x0(f,`${u}-flow__node`)||x0(f,`${u}-flow__edge`)))return!0;if(!r&&!h&&!i&&!s&&!n||a||d&&!b||x0(f,l)&&b||x0(f,c)&&(!b||i&&b&&!e)||!n&&f.ctrlKey&&b)return!1;if(!n&&f.type==="touchstart"&&((O=f.touches)==null?void 0:O.length)>1)return f.preventDefault(),!1;if(!h&&!i&&!p&&b||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const g=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||b)&&g}}function HIe({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=Pie().scaleExtent([t,n]).translateExtent(r),h=Xo(e).call(f);v({x:i.x,y:i.y,zoom:Nb(i.zoom,t,n)},[[0,0],[d.width,d.height]],r);const p=h.on("wheel.zoom"),b=h.on("dblclick.zoom");f.wheelDelta(lse);async function g(_,R){return h?new Promise($=>{f==null||f.interpolate((R==null?void 0:R.interpolate)==="linear"?L1:Dk).transform(Yj(h,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>$(!0)),_)}):!1}function O({noWheelClassName:_,noPanClassName:R,onPaneContextMenu:$,userSelectionActive:D,panOnScroll:M,panOnDrag:j,panOnScrollMode:P,panOnScrollSpeed:L,preventScrolling:U,zoomOnPinch:F,zoomOnScroll:q,zoomOnDoubleClick:z,zoomActivationKeyPressed:B,lib:V,onTransformChange:ce,connectionInProgress:we,paneClickDistance:Oe,selectionOnDrag:de}){D&&!u.isZoomingOrPanning&&y();const Z=M&&!B&&!D;f.clickDistance(de?1/0:!bc(Oe)||Oe<0?0:Oe);const J=Z?QIe({zoomPanValues:u,noWheelClassName:_,d3Selection:h,d3Zoom:f,panOnScrollMode:P,panOnScrollSpeed:L,zoomOnPinch:F,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:l}):FIe({noWheelClassName:_,preventScrolling:U,d3ZoomHandler:p});h.on("wheel.zoom",J,{passive:!1});const fe=UIe({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});f.on("start",fe);const be=zIe({zoomPanValues:u,panOnDrag:j,onPaneContextMenu:!!$,onPanZoom:s,onTransformChange:ce});f.on("zoom",be);const je=VIe({zoomPanValues:u,panOnDrag:j,panOnScroll:M,onPaneContextMenu:$,onPanZoomEnd:l,onDraggingChange:c});f.on("end",je);const Qe=qIe({zoomActivationKeyPressed:B,panOnDrag:j,zoomOnScroll:q,panOnScroll:M,zoomOnDoubleClick:z,zoomOnPinch:F,userSelectionActive:D,noPanClassName:R,noWheelClassName:_,lib:V,connectionInProgress:we});f.filter(Qe),z?h.on("dblclick.zoom",b):h.on("dblclick.zoom",null)}function y(){f.on("zoom",null)}async function v(_,R,$){const D=Gj(_),M=f==null?void 0:f.constrain()(D,R,$);return M&&await g(M),M}async function x(_,R){const $=Gj(_);return await g($,R),$}function w(_){if(h){const R=Gj(_),$=h.property("__zoom");($.k!==_.zoom||$.x!==_.x||$.y!==_.y)&&(f==null||f.transform(h,R,null,{sync:!0}))}}function S(){const _=h?Die(h.node()):{x:0,y:0,k:1};return{x:_.x,y:_.y,zoom:_.k}}async function E(_,R){return h?new Promise($=>{f==null||f.interpolate((R==null?void 0:R.interpolate)==="linear"?L1:Dk).scaleTo(Yj(h,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>$(!0)),_)}):!1}async function k(_,R){return h?new Promise($=>{f==null||f.interpolate((R==null?void 0:R.interpolate)==="linear"?L1:Dk).scaleBy(Yj(h,R==null?void 0:R.duration,R==null?void 0:R.ease,()=>$(!0)),_)}):!1}function T(_){f==null||f.scaleExtent(_)}function C(_){f==null||f.translateExtent(_)}function N(_){const R=!bc(_)||_<0?0:_;f==null||f.clickDistance(R)}return{update:O,destroy:y,setViewport:x,setViewportConstrained:v,getViewport:S,scaleTo:E,scaleBy:k,setScaleExtent:T,setTranslateExtent:C,syncViewport:w,setClickDistance:N}}var Ib;(function(e){e.Line="line",e.Handle="handle"})(Ib||(Ib={}));function XIe({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 UU(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 Cf(e,t){return Math.max(0,t-e)}function Nf(e,t){return Math.max(0,e-t)}function GS(e,t,n){return Math.max(0,t-e,e-n)}function zU(e,t){return e?!t:t}function GIe(e,t,n,r,i,s,a,l){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:f}=t,h=d&&f,{xSnapped:p,ySnapped:b}=n,{minWidth:g,maxWidth:O,minHeight:y,maxHeight:v}=r,{x,y:w,width:S,height:E,aspectRatio:k}=e;let T=Math.floor(d?p-e.pointerX:0),C=Math.floor(f?b-e.pointerY:0);const N=S+(c?-T:T),_=E+(u?-C:C),R=-s[0]*S,$=-s[1]*E;let D=GS(N,g,O),M=GS(_,y,v);if(a){let L=0,U=0;c&&T<0?L=Cf(x+T+R,a[0][0]):!c&&T>0&&(L=Nf(x+N+R,a[1][0])),u&&C<0?U=Cf(w+C+$,a[0][1]):!u&&C>0&&(U=Nf(w+_+$,a[1][1])),D=Math.max(D,L),M=Math.max(M,U)}if(l){let L=0,U=0;c&&T>0?L=Nf(x+T,l[0][0]):!c&&T<0&&(L=Cf(x+N,l[1][0])),u&&C>0?U=Nf(w+C,l[0][1]):!u&&C<0&&(U=Cf(w+_,l[1][1])),D=Math.max(D,L),M=Math.max(M,U)}if(i){if(d){const L=GS(N/k,y,v)*k;if(D=Math.max(D,L),a){let U=0;!c&&!u||c&&!u&&h?U=Nf(w+$+N/k,a[1][1])*k:U=Cf(w+$+(c?T:-T)/k,a[0][1])*k,D=Math.max(D,U)}if(l){let U=0;!c&&!u||c&&!u&&h?U=Cf(w+N/k,l[1][1])*k:U=Nf(w+(c?T:-T)/k,l[0][1])*k,D=Math.max(D,U)}}if(f){const L=GS(_*k,g,O)/k;if(M=Math.max(M,L),a){let U=0;!c&&!u||u&&!c&&h?U=Nf(x+_*k+R,a[1][0])/k:U=Cf(x+(u?C:-C)*k+R,a[0][0])/k,M=Math.max(M,U)}if(l){let U=0;!c&&!u||u&&!c&&h?U=Cf(x+_*k,l[1][0])/k:U=Nf(x+(u?C:-C)*k,l[0][0])/k,M=Math.max(M,U)}}}C=C+(C<0?M:-M),T=T+(T<0?D:-D),i&&(h?N>_*k?C=(zU(c,u)?-T:T)/k:T=(zU(c,u)?-C:C)*k:d?(C=T/k,u=c):(T=C*k,c=u));const j=c?x+T:x,P=u?w+C:w;return{width:S+(c?-T:T),height:E+(u?-C:C),x:s[0]*T*(c?-1:1)+j,y:s[1]*C*(u?-1:1)+P}}const cse={width:0,height:0,x:0,y:0},YIe={...cse,pointerX:0,pointerY:0,aspectRatio:1};function WIe(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 ZIe({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){const s=Xo(e);let a={controlDirection:UU("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:p,onResize:b,onResizeEnd:g,shouldResize:O}){let y={...cse},v={...YIe};a={boundaries:d,resizeDirection:h,keepAspectRatio:f,controlDirection:UU(u)};let x,w=null,S=[],E,k,T,C=!1;const N=yie().on("start",_=>{const{nodeLookup:R,transform:$,snapGrid:D,snapToGrid:M,nodeOrigin:j,paneDomNode:P}=n();if(x=R.get(t),!x)return;w=(P==null?void 0:P.getBoundingClientRect())??null;const{xSnapped:L,ySnapped:U}=$1(_.sourceEvent,{transform:$,snapGrid:D,snapToGrid:M,containerBounds:w});y={width:x.measured.width??0,height:x.measured.height??0,x:x.position.x??0,y:x.position.y??0},v={...y,pointerX:L,pointerY:U,aspectRatio:y.width/y.height},E=void 0,k=_m(x.extent)?x.extent:void 0,x.parentId&&(x.extent==="parent"||x.expandParent)&&(E=R.get(x.parentId)),E&&x.extent==="parent"&&(k=[[0,0],[E.measured.width,E.measured.height]]),S=[],T=void 0;for(const[F,q]of R)if(q.parentId===t&&(S.push({id:F,position:{...q.position},extent:q.extent}),q.extent==="parent"||q.expandParent)){const z=WIe(q,x,q.origin??j);T?T=[[Math.min(z[0][0],T[0][0]),Math.min(z[0][1],T[0][1])],[Math.max(z[1][0],T[1][0]),Math.max(z[1][1],T[1][1])]]:T=z}p==null||p(_,{...y})}).on("drag",_=>{const{transform:R,snapGrid:$,snapToGrid:D,nodeOrigin:M}=n(),j=$1(_.sourceEvent,{transform:R,snapGrid:$,snapToGrid:D,containerBounds:w}),P=[];if(!x)return;const{x:L,y:U,width:F,height:q}=y,z={},B=x.origin??M,{width:V,height:ce,x:we,y:Oe}=GIe(v,a.controlDirection,j,a.boundaries,a.keepAspectRatio,B,k,T),de=V!==F,Z=ce!==q,J=we!==L&&de,fe=Oe!==U&&Z;if(!J&&!fe&&!de&&!Z)return;if((J||fe||B[0]===1||B[1]===1)&&(z.x=J?we:y.x,z.y=fe?Oe:y.y,y.x=z.x,y.y=z.y,S.length>0)){const Me=we-L,le=Oe-U;for(const ke of S)ke.position={x:ke.position.x-Me+B[0]*(V-F),y:ke.position.y-le+B[1]*(ce-q)},P.push(ke)}if((de||Z)&&(z.width=de&&(!a.resizeDirection||a.resizeDirection==="horizontal")?V:y.width,z.height=Z&&(!a.resizeDirection||a.resizeDirection==="vertical")?ce:y.height,y.width=z.width,y.height=z.height),E&&x.expandParent){const Me=B[0]*(z.width??0);z.x&&z.x{C&&(g==null||g(_,{...y}),i==null||i({...y}),C=!1)});s.call(N)}function c(){s.on(".drag",null)}return{update:l,destroy:c}}var use={exports:{}},dse={},fse={exports:{}},hse={};/** * @license React * use-sync-external-store-shim.production.js * @@ -406,7 +406,7 @@ ${d}`:u,children:[o.jsxs("span",{className:`account-avatar${b?" has-image":""}`, * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Ib=m;function WIe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var ZIe=typeof Object.is=="function"?Object.is:WIe,KIe=Ib.useState,JIe=Ib.useEffect,eDe=Ib.useLayoutEffect,tDe=Ib.useDebugValue;function nDe(e,t){var n=t(),r=KIe({inst:{value:n,getSnapshot:t}}),i=r[0].inst,s=r[1];return eDe(function(){i.value=n,i.getSnapshot=t,Gj(i)&&s({inst:i})},[e,n,t]),JIe(function(){return Gj(i)&&s({inst:i}),e(function(){Gj(i)&&s({inst:i})})},[e]),tDe(n),n}function Gj(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!ZIe(e,n)}catch{return!0}}function rDe(e,t){return t()}var iDe=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?rDe:nDe;dse.useSyncExternalStore=Ib.useSyncExternalStore!==void 0?Ib.useSyncExternalStore:iDe;use.exports=dse;var sDe=use.exports;/** + */var Db=m;function KIe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var JIe=typeof Object.is=="function"?Object.is:KIe,eDe=Db.useState,tDe=Db.useEffect,nDe=Db.useLayoutEffect,rDe=Db.useDebugValue;function iDe(e,t){var n=t(),r=eDe({inst:{value:n,getSnapshot:t}}),i=r[0].inst,s=r[1];return nDe(function(){i.value=n,i.getSnapshot=t,Wj(i)&&s({inst:i})},[e,n,t]),tDe(function(){return Wj(i)&&s({inst:i}),e(function(){Wj(i)&&s({inst:i})})},[e]),rDe(n),n}function Wj(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!JIe(e,n)}catch{return!0}}function sDe(e,t){return t()}var aDe=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?sDe:iDe;hse.useSyncExternalStore=Db.useSyncExternalStore!==void 0?Db.useSyncExternalStore:aDe;fse.exports=hse;var oDe=fse.exports;/** * @license React * use-sync-external-store-shim/with-selector.production.js * @@ -414,30 +414,30 @@ ${d}`:u,children:[o.jsxs("span",{className:`account-avatar${b?" has-image":""}`, * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var AA=m,aDe=sDe;function oDe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var lDe=typeof Object.is=="function"?Object.is:oDe,cDe=aDe.useSyncExternalStore,uDe=AA.useRef,dDe=AA.useEffect,fDe=AA.useMemo,hDe=AA.useDebugValue;cse.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var s=uDe(null);if(s.current===null){var a={hasValue:!1,value:null};s.current=a}else a=s.current;s=fDe(function(){function c(p){if(!u){if(u=!0,d=p,p=r(p),i!==void 0&&a.hasValue){var b=a.value;if(i(b,p))return f=b}return f=p}if(b=f,lDe(d,p))return b;var g=r(p);return i!==void 0&&i(b,g)?(d=p,b):(d=p,f=g)}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=cDe(e,s[0],s[1]);return dDe(function(){a.hasValue=!0,a.value=l},[l]),hDe(l),l};lse.exports=cse;var pDe=lse.exports;const mDe=Jb(pDe),gDe={},UU=e=>{let t;const n=new Set,r=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const p=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(b=>b(t,p))}},i=()=>t,c={setState:r,getState:i,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(gDe?"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},bDe=e=>e?UU(e):UU,{useDebugValue:ODe}=Cn,{useSyncExternalStoreWithSelector:yDe}=mDe,xDe=e=>e;function fse(e,t=xDe,n){const r=yDe(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return ODe(r),r}const zU=(e,t)=>{const n=bDe(e),r=(i,s=t)=>fse(n,i,s);return Object.assign(r,n),r},vDe=(e,t)=>e?zU(e,t):zU;function ji(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 CA=m.createContext(null),wDe=CA.Provider,hse=Tc.error001("react");function sr(e,t){const n=m.useContext(CA);if(n===null)throw new Error(hse);return fse(n,e,t)}function Ri(){const e=m.useContext(CA);if(e===null)throw new Error(hse);return m.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const VU={display:"none"},SDe={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},pse="react-flow__node-desc",mse="react-flow__edge-desc",EDe="react-flow__aria-live",kDe=e=>e.ariaLiveMessage,TDe=e=>e.ariaLabelConfig;function _De({rfId:e}){const t=sr(kDe);return o.jsx("div",{id:`${EDe}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:SDe,children:t})}function ADe({rfId:e,disableKeyboardA11y:t}){const n=sr(TDe);return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:`${pse}-${e}`,style:VU,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),o.jsx("div",{id:`${mse}-${e}`,style:VU,children:n["edge.a11yDescription.default"]}),!t&&o.jsx(_De,{rfId:e})]})}const NA=m.forwardRef(({position:e="top-left",children:t,className:n,style:r,...i},s)=>{const a=`${e}`.split("-");return o.jsx("div",{className:Ss(["react-flow__panel",n,...a]),style:r,ref:s,...i,children:t})});NA.displayName="Panel";function CDe({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:o.jsx(NA,{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 NDe=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}},YS=e=>e.id;function jDe(e,t){return ji(e.selectedNodes.map(YS),t.selectedNodes.map(YS))&&ji(e.selectedEdges.map(YS),t.selectedEdges.map(YS))}function RDe({onSelectionChange:e}){const t=Ri(),{selectedNodes:n,selectedEdges:r}=sr(NDe,jDe);return m.useEffect(()=>{const i={nodes:n,edges:r};e==null||e(i),t.getState().onSelectionChangeHandlers.forEach(s=>s(i))},[n,r,e]),null}const IDe=e=>!!e.onSelectionChangeHandlers;function DDe({onSelectionChange:e}){const t=sr(IDe);return e||t?o.jsx(RDe,{onSelectionChange:e}):null}const gse=[0,0],PDe={x:0,y:0,zoom:1},MDe=["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"],qU=[...MDe,"rfId"],LDe=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}),HU={translateExtent:Px,nodeOrigin:gse,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function $De(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:s,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=sr(LDe,ji),u=Ri();m.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=HU,l()}),[]);const d=m.useRef(HU);return m.useEffect(()=>{for(const f of qU){const h=e[f],p=d.current[f];h!==p&&(typeof e[f]>"u"||(f==="nodes"?t(h):f==="edges"?n(h):f==="minZoom"?r(h):f==="maxZoom"?i(h):f==="translateExtent"?s(h):f==="nodeExtent"?a(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:lIe(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},qU.map(f=>e[f])),null}function XU(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function BDe(e){var r;const[t,n]=m.useState(e==="system"?null:e);return m.useEffect(()=>{if(e!=="system"){n(e);return}const i=XU(),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=XU())!=null&&r.matches?"dark":"light"}const GU=typeof document<"u"?document:null;function Qx(e=null,t={target:GU,actInsideInputWithModifier:!0}){const[n,r]=m.useState(!1),i=m.useRef(!1),s=m.useRef(new Set([])),[a,l]=m.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",` + */var NA=m,lDe=oDe;function cDe(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var uDe=typeof Object.is=="function"?Object.is:cDe,dDe=lDe.useSyncExternalStore,fDe=NA.useRef,hDe=NA.useEffect,pDe=NA.useMemo,mDe=NA.useDebugValue;dse.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var s=fDe(null);if(s.current===null){var a={hasValue:!1,value:null};s.current=a}else a=s.current;s=pDe(function(){function c(p){if(!u){if(u=!0,d=p,p=r(p),i!==void 0&&a.hasValue){var b=a.value;if(i(b,p))return f=b}return f=p}if(b=f,uDe(d,p))return b;var g=r(p);return i!==void 0&&i(b,g)?(d=p,b):(d=p,f=g)}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=dDe(e,s[0],s[1]);return hDe(function(){a.hasValue=!0,a.value=l},[l]),mDe(l),l};use.exports=dse;var gDe=use.exports;const bDe=eO(gDe),ODe={},VU=e=>{let t;const n=new Set,r=(d,f)=>{const h=typeof d=="function"?d(t):d;if(!Object.is(h,t)){const p=t;t=f??(typeof h!="object"||h===null)?h:Object.assign({},t,h),n.forEach(b=>b(t,p))}},i=()=>t,c={setState:r,getState:i,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(ODe?"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},yDe=e=>e?VU(e):VU,{useDebugValue:xDe}=Cn,{useSyncExternalStoreWithSelector:vDe}=bDe,wDe=e=>e;function pse(e,t=wDe,n){const r=vDe(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return xDe(r),r}const qU=(e,t)=>{const n=yDe(e),r=(i,s=t)=>pse(n,i,s);return Object.assign(r,n),r},SDe=(e,t)=>e?qU(e,t):qU;function ji(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 jA=m.createContext(null),EDe=jA.Provider,mse=Tc.error001("react");function ar(e,t){const n=m.useContext(jA);if(n===null)throw new Error(mse);return pse(n,e,t)}function Ri(){const e=m.useContext(jA);if(e===null)throw new Error(mse);return m.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const HU={display:"none"},kDe={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},gse="react-flow__node-desc",bse="react-flow__edge-desc",TDe="react-flow__aria-live",_De=e=>e.ariaLiveMessage,ADe=e=>e.ariaLabelConfig;function CDe({rfId:e}){const t=ar(_De);return o.jsx("div",{id:`${TDe}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:kDe,children:t})}function NDe({rfId:e,disableKeyboardA11y:t}){const n=ar(ADe);return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:`${gse}-${e}`,style:HU,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),o.jsx("div",{id:`${bse}-${e}`,style:HU,children:n["edge.a11yDescription.default"]}),!t&&o.jsx(CDe,{rfId:e})]})}const RA=m.forwardRef(({position:e="top-left",children:t,className:n,style:r,...i},s)=>{const a=`${e}`.split("-");return o.jsx("div",{className:Ss(["react-flow__panel",n,...a]),style:r,ref:s,...i,children:t})});RA.displayName="Panel";function jDe({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:o.jsx(RA,{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 RDe=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}},YS=e=>e.id;function IDe(e,t){return ji(e.selectedNodes.map(YS),t.selectedNodes.map(YS))&&ji(e.selectedEdges.map(YS),t.selectedEdges.map(YS))}function DDe({onSelectionChange:e}){const t=Ri(),{selectedNodes:n,selectedEdges:r}=ar(RDe,IDe);return m.useEffect(()=>{const i={nodes:n,edges:r};e==null||e(i),t.getState().onSelectionChangeHandlers.forEach(s=>s(i))},[n,r,e]),null}const PDe=e=>!!e.onSelectionChangeHandlers;function MDe({onSelectionChange:e}){const t=ar(PDe);return e||t?o.jsx(DDe,{onSelectionChange:e}):null}const Ose=[0,0],LDe={x:0,y:0,zoom:1},$De=["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"],XU=[...$De,"rfId"],BDe=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}),GU={translateExtent:Mx,nodeOrigin:Ose,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function QDe(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:s,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=ar(BDe,ji),u=Ri();m.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=GU,l()}),[]);const d=m.useRef(GU);return m.useEffect(()=>{for(const f of XU){const h=e[f],p=d.current[f];h!==p&&(typeof e[f]>"u"||(f==="nodes"?t(h):f==="edges"?n(h):f==="minZoom"?r(h):f==="maxZoom"?i(h):f==="translateExtent"?s(h):f==="nodeExtent"?a(h):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:uIe(h)}):f==="fitView"?u.setState({fitViewQueued:h}):f==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[f]:h})))}d.current=e},XU.map(f=>e[f])),null}function YU(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function FDe(e){var r;const[t,n]=m.useState(e==="system"?null:e);return m.useEffect(()=>{if(e!=="system"){n(e);return}const i=YU(),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=YU())!=null&&r.matches?"dark":"light"}const WU=typeof document<"u"?document:null;function Fx(e=null,t={target:WU,actInsideInputWithModifier:!0}){const[n,r]=m.useState(!1),i=m.useRef(!1),s=m.useRef(new Set([])),[a,l]=m.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 m.useEffect(()=>{const c=(t==null?void 0:t.target)??GU,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=p=>{var O,y;if(i.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!i.current||i.current&&!u)&&qie(p))return!1;const g=WU(p.code,l);if(s.current.add(p[g]),YU(a,s.current,!1)){const v=((y=(O=p.composedPath)==null?void 0:O.call(p))==null?void 0:y[0])||p.target,x=(v==null?void 0:v.nodeName)==="BUTTON"||(v==null?void 0:v.nodeName)==="A";t.preventDefault!==!1&&(i.current||!x)&&p.preventDefault(),r(!0)}},f=p=>{const b=WU(p.code,l);YU(a,s.current,!0)?(r(!1),s.current.clear()):s.current.delete(p[b]),p.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 YU(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function WU(e,t){return t.includes(e)?"code":"key"}const QDe=()=>{const e=Ri();return m.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=I6(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 OO(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=jb(t,n);return{x:a.x+i,y:a.y+s}}}),[])};function bse(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)FDe(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 FDe(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 Ose(e,t){return bse(e,t)}function yse(e,t){return bse(e,t)}function Ip(e,t){return{id:e,type:"select",selected:t}}function x0(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(Ip(s.id,a)))}return r}function ZU({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 KU(e){return{id:e.id,type:"remove"}}const UDe=Uie();function zDe(e,t,n={}){return pIe(e,t,{...n,onError:n.onError??UDe})}const JU=e=>JRe(e),VDe=e=>$ie(e);function xse(e){return m.forwardRef(e)}const qDe=typeof window<"u"?m.useLayoutEffect:m.useEffect;function ez(e){const[t,n]=m.useState(BigInt(0)),[r]=m.useState(()=>HDe(()=>n(i=>i+BigInt(1))));return qDe(()=>{const i=r.get();i.length&&(e(i),r.reset())},[t]),r}function HDe(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const vse=m.createContext(null);function XDe({children:e}){const t=Ri(),n=m.useCallback(l=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:h,fitViewQueued:p,onNodesChangeMiddlewareMap:b}=t.getState();let g=c;for(const y of l)g=typeof y=="function"?y(g):y;let O=ZU({items:g,lookup:h});for(const y of b.values())O=y(O);d&&u(g),O.length>0?f==null||f(O):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:y,nodes:v,setNodes:x}=t.getState();y&&x(v)})},[]),r=ez(n),i=m.useCallback(l=>{const{edges:c=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:h}=t.getState();let p=c;for(const b of l)p=typeof b=="function"?b(p):b;d?u(p):f&&f(ZU({items:p,lookup:h}))},[]),s=ez(i),a=m.useMemo(()=>({nodeQueue:r,edgeQueue:s}),[]);return o.jsx(vse.Provider,{value:a,children:e})}function GDe(){const e=m.useContext(vse);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const YDe=e=>!!e.panZoom;function jA(){const e=QDe(),t=Ri(),n=GDe(),r=sr(YDe),i=m.useMemo(()=>{const s=f=>t.getState().nodeLookup.get(f),a=f=>{n.nodeQueue.push(f)},l=f=>{n.edgeQueue.push(f)},c=f=>{var y,v;const{nodeLookup:h,nodeOrigin:p}=t.getState(),b=JU(f)?f:h.get(f.id),g=b.parentId?zie(b.position,b.measured,b.parentId,h,p):b.position,O={...b,position:g,width:((y=b.measured)==null?void 0:y.width)??b.width,height:((v=b.measured)==null?void 0:v.height)??b.height};return Nb(O)},u=(f,h,p={replace:!1})=>{a(b=>b.map(g=>{if(g.id===f){const O=typeof h=="function"?h(g):h;return p.replace&&JU(O)?O:{...g,...O}}return g}))},d=(f,h,p={replace:!1})=>{l(b=>b.map(g=>{if(g.id===f){const O=typeof h=="function"?h(g):h;return p.replace&&VDe(O)?O:{...g,...O}}return g}))};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(p=>[...p,...h])},addEdges:f=>{const h=Array.isArray(f)?f:[f];n.edgeQueue.push(p=>[...p,...h])},toObject:()=>{const{nodes:f=[],edges:h=[],transform:p}=t.getState(),[b,g,O]=p;return{nodes:f.map(y=>({...y})),edges:h.map(y=>({...y})),viewport:{x:b,y:g,zoom:O}}},deleteElements:async({nodes:f=[],edges:h=[]})=>{const{nodes:p,edges:b,onNodesDelete:g,onEdgesDelete:O,triggerNodeChanges:y,triggerEdgeChanges:v,onDelete:x,onBeforeDelete:w}=t.getState(),{nodes:S,edges:E}=await iIe({nodesToRemove:f,edgesToRemove:h,nodes:p,edges:b,onBeforeDelete:w}),k=E.length>0,T=S.length>0;if(k){const C=E.map(KU);O==null||O(E),v(C)}if(T){const C=S.map(KU);g==null||g(S),y(C)}return(T||k)&&(x==null||x({nodes:S,edges:E})),{deletedNodes:S,deletedEdges:E}},getIntersectingNodes:(f,h=!0,p)=>{const b=CU(f),g=b?f:c(f),O=p!==void 0;return g?(p||t.getState().nodes).filter(y=>{const v=t.getState().nodeLookup.get(y.id);if(v&&!b&&(y.id===f.id||!v.internals.positionAbsolute))return!1;const x=Nb(O?y:v),w=$x(x,g);return h&&w>0||w>=x.width*x.height||w>=g.width*g.height}):[]},isNodeIntersecting:(f,h,p=!0)=>{const g=CU(f)?f:c(f);if(!g)return!1;const O=$x(g,h);return p&&O>0||O>=h.width*h.height||O>=g.width*g.height},updateNode:u,updateNodeData:(f,h,p={replace:!1})=>{u(f,b=>{const g=typeof h=="function"?h(b):h;return p.replace?{...b,data:g}:{...b,data:{...b.data,...g}}},p)},updateEdge:d,updateEdgeData:(f,h,p={replace:!1})=>{d(f,b=>{const g=typeof h=="function"?h(b):h;return p.replace?{...b,data:g}:{...b,data:{...b.data,...g}}},p)},getNodesBounds:f=>{const{nodeLookup:h,nodeOrigin:p}=t.getState();return eIe(f,{nodeLookup:h,nodeOrigin:p})},getHandleConnections:({type:f,id:h,nodeId:p})=>{var b;return Array.from(((b=t.getState().connectionLookup.get(`${p}-${f}${h?`-${h}`:""}`))==null?void 0:b.values())??[])},getNodeConnections:({type:f,handleId:h,nodeId:p})=>{var b;return Array.from(((b=t.getState().connectionLookup.get(`${p}${f?h?`-${f}-${h}`:`-${f}`:""}`))==null?void 0:b.values())??[])},fitView:async f=>{const h=t.getState().fitViewResolver??oIe();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:h}),n.nodeQueue.push(p=>[...p]),h.promise}}},[]);return m.useMemo(()=>({...i,...e,viewportInitialized:r}),[r])}const tz=e=>e.selected,WDe=typeof window<"u"?window:void 0;function ZDe({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Ri(),{deleteElements:r}=jA(),i=Qx(e,{actInsideInputWithModifier:!1}),s=Qx(t,{target:WDe});m.useEffect(()=>{if(i){const{edges:a,nodes:l}=n.getState();r({nodes:l.filter(tz),edges:a.filter(tz)}),n.setState({nodesSelectionActive:!1})}},[i]),m.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function KDe(e){const t=Ri();m.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=P6(e.current);(r.height===0||r.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",Tc.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 RA={position:"absolute",width:"100%",height:"100%",top:0,left:0},JDe=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function e5e({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:s=um.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:p=!0,children:b,noWheelClassName:g,noPanClassName:O,onViewportChange:y,isControlledViewport:v,paneClickDistance:x,selectionOnDrag:w}){const S=Ri(),E=m.useRef(null),{userSelectionActive:k,lib:T,connectionInProgress:C}=sr(JDe,ji),N=Qx(h),_=m.useRef();KDe(E);const R=m.useCallback($=>{y==null||y({x:$[0],y:$[1],zoom:$[2]}),v||S.setState({transform:$})},[y,v]);return m.useEffect(()=>{if(E.current){_.current=VIe({domNode:E.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:j=>S.setState(P=>P.paneDragging===j?P:{paneDragging:j}),onPanZoomStart:(j,P)=>{const{onViewportChangeStart:L,onMoveStart:U}=S.getState();U==null||U(j,P),L==null||L(P)},onPanZoom:(j,P)=>{const{onViewportChange:L,onMove:U}=S.getState();U==null||U(j,P),L==null||L(P)},onPanZoomEnd:(j,P)=>{const{onViewportChangeEnd:L,onMoveEnd:U}=S.getState();U==null||U(j,P),L==null||L(P)}});const{x:$,y:D,zoom:M}=_.current.getViewport();return S.setState({panZoom:_.current,transform:[$,D,M],domNode:E.current.closest(".react-flow")}),()=>{var j;(j=_.current)==null||j.destroy()}}},[]),m.useEffect(()=>{var $;($=_.current)==null||$.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:s,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:N,preventScrolling:p,noPanClassName:O,userSelectionActive:k,noWheelClassName:g,lib:T,onTransformChange:R,connectionInProgress:C,selectionOnDrag:w,paneClickDistance:x})},[e,t,n,r,i,s,a,l,N,p,O,k,g,T,R,C,w,x]),o.jsx("div",{className:"react-flow__renderer",ref:E,style:RA,children:b})}const t5e=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function n5e(){const{userSelectionActive:e,userSelectionRect:t}=sr(t5e,ji);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 Yj=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},r5e=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function i5e({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Mx.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:s,selectionOnDrag:a,onSelectionStart:l,onSelectionEnd:c,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:b,children:g}){const O=m.useRef(0),y=Ri(),{userSelectionActive:v,elementsSelectable:x,dragging:w,connectionInProgress:S,panBy:E,autoPanSpeed:k}=sr(r5e,ji),T=x&&(e||v),C=m.useRef(null),N=m.useRef(),_=m.useRef(new Set),R=m.useRef(new Set),$=m.useRef(!1),D=m.useRef({x:0,y:0}),M=m.useRef(!1),j=de=>{if($.current||S){$.current=!1;return}u==null||u(de),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1})},P=de=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){de.preventDefault();return}d==null||d(de)},L=f?de=>f(de):void 0,U=de=>{$.current&&(de.stopPropagation(),$.current=!1)},F=de=>{var ke,ye;const{domNode:Z,transform:J}=y.getState();if(N.current=Z==null?void 0:Z.getBoundingClientRect(),!N.current)return;const fe=de.target===C.current;if(!fe&&!!de.target.closest(".nokey")||!e||!(a&&fe||t)||de.button!==0||!de.isPrimary)return;(ye=(ke=de.target)==null?void 0:ke.setPointerCapture)==null||ye.call(ke,de.pointerId),$.current=!1;const{x:Qe,y:Me}=Oc(de.nativeEvent,N.current),le=OO({x:Qe,y:Me},J);y.setState({userSelectionRect:{width:0,height:0,startX:le.x,startY:le.y,x:Qe,y:Me}}),fe||(de.stopPropagation(),de.preventDefault())};function q(de,Z){const{userSelectionRect:J}=y.getState();if(!J)return;const{transform:fe,nodeLookup:be,edgeLookup:je,connectionLookup:Qe,triggerNodeChanges:Me,triggerEdgeChanges:le,defaultEdgeOptions:ke}=y.getState(),ye={x:J.startX,y:J.startY},{x:$e,y:ze}=jb(ye,fe),Ae={startX:ye.x,startY:ye.y,x:de<$e?de:$e,y:ZWe.id)),R.current=new Set;const Tt=(ke==null?void 0:ke.selectable)??!0;for(const We of _.current){const W=Qe.get(We);if(W)for(const{edgeId:ne}of W.values()){const he=je.get(ne);he&&(he.selectable??Tt)&&R.current.add(ne)}}if(!NU(Ve,_.current)){const We=x0(be,_.current,!0);Me(We)}if(!NU(ut,R.current)){const We=x0(je,R.current);le(We)}y.setState({userSelectionRect:Ae,userSelectionActive:!0,nodesSelectionActive:!1})}function z(){if(!i||!N.current)return;const[de,Z]=R6(D.current,N.current,k);E({x:de,y:Z}).then(J=>{if(!$.current||!J){O.current=requestAnimationFrame(z);return}const{x:fe,y:be}=D.current;q(fe,be),O.current=requestAnimationFrame(z)})}const B=()=>{cancelAnimationFrame(O.current),O.current=0,M.current=!1};m.useEffect(()=>()=>B(),[]);const V=de=>{const{userSelectionRect:Z,transform:J,resetSelectedElements:fe}=y.getState();if(!N.current||!Z)return;const{x:be,y:je}=Oc(de.nativeEvent,N.current);D.current={x:be,y:je};const Qe=jb({x:Z.startX,y:Z.startY},J);if(!$.current){const Me=t?0:s;if(Math.hypot(be-Qe.x,je-Qe.y)<=Me)return;fe(),l==null||l(de)}$.current=!0,M.current||(z(),M.current=!0),q(be,je)},ce=de=>{var Z,J;de.button===0&&((J=(Z=de.target)==null?void 0:Z.releasePointerCapture)==null||J.call(Z,de.pointerId),!v&&de.target===C.current&&y.getState().userSelectionRect&&(j==null||j(de)),y.setState({userSelectionActive:!1,userSelectionRect:null}),$.current&&(c==null||c(de),y.setState({nodesSelectionActive:_.current.size>0})),B())},we=de=>{var Z,J;(J=(Z=de.target)==null?void 0:Z.releasePointerCapture)==null||J.call(Z,de.pointerId),B()},Oe=r===!0||Array.isArray(r)&&r.includes(0);return o.jsxs("div",{className:Ss(["react-flow__pane",{draggable:Oe,dragging:w,selection:e}]),onClick:T?void 0:Yj(j,C),onContextMenu:Yj(P,C),onWheel:Yj(L,C),onPointerEnter:T?void 0:h,onPointerMove:T?V:p,onPointerUp:T?ce:void 0,onPointerCancel:T?we:void 0,onPointerDownCapture:T?F:void 0,onClickCapture:T?U:void 0,onPointerLeave:b,ref:C,style:RA,children:[g,o.jsx(n5e,{})]})}function IP({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",Tc.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 wse({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:s,nodeClickDistance:a}){const l=Ri(),[c,u]=m.useState(!1),d=m.useRef();return m.useEffect(()=>{d.current=NIe({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{IP({id:f,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),m.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 s5e=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Sse(){const e=Ri();return m.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=s5e(a),p=i?s[0]:5,b=i?s[1]:5,g=n.direction.x*p*n.factor,O=n.direction.y*b*n.factor;for(const[,y]of u){if(!h(y))continue;let v={x:y.internals.positionAbsolute.x+g,y:y.internals.positionAbsolute.y+O};i&&(v=rw(v,s));const{position:x,positionAbsolute:w}=Bie({nodeId:y.id,nextPosition:v,nodeLookup:u,nodeExtent:r,nodeOrigin:d,onError:l});y.position=x,y.internals.positionAbsolute=w,f.set(y.id,y)}c(f)},[])}const F6=m.createContext(null),a5e=F6.Provider;F6.Consumer;const Ese=()=>m.useContext(F6),o5e=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),l5e=(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===Ab.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 c5e({type:e="source",position:t=Nt.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},p){var M,j;const b=a||null,g=e==="target",O=Ri(),y=Ese(),{connectOnClick:v,noPanClassName:x,rfId:w}=sr(o5e,ji),{connectingFrom:S,connectingTo:E,clickConnecting:k,isPossibleEndHandle:T,connectionInProcess:C,clickConnectionInProcess:N,valid:_}=sr(l5e(y,b,e),ji);y||(j=(M=O.getState()).onError)==null||j.call(M,"010",Tc.error010());const R=P=>{const{defaultEdgeOptions:L,onConnect:U,hasDefaultEdges:F}=O.getState(),q={...L,...P};if(F){const{edges:z,setEdges:B,onError:V}=O.getState();B(zDe(q,z,{onError:V}))}U==null||U(q),l==null||l(q)},$=P=>{if(!y)return;const L=Hie(P.nativeEvent);if(i&&(L&&P.button===0||!L)){const U=O.getState();RP.onPointerDown(P.nativeEvent,{handleDomNode:P.currentTarget,autoPanOnConnect:U.autoPanOnConnect,connectionMode:U.connectionMode,connectionRadius:U.connectionRadius,domNode:U.domNode,nodeLookup:U.nodeLookup,lib:U.lib,isTarget:g,handleId:b,nodeId:y,flowId:U.rfId,panBy:U.panBy,cancelConnection:U.cancelConnection,onConnectStart:U.onConnectStart,onConnectEnd:(...F)=>{var q,z;return(z=(q=O.getState()).onConnectEnd)==null?void 0:z.call(q,...F)},updateConnection:U.updateConnection,onConnect:R,isValidConnection:n||((...F)=>{var q,z;return((z=(q=O.getState()).isValidConnection)==null?void 0:z.call(q,...F))??!0}),getTransform:()=>O.getState().transform,getFromHandle:()=>O.getState().connection.fromHandle,autoPanSpeed:U.autoPanSpeed,dragThreshold:U.connectionDragThreshold})}L?d==null||d(P):f==null||f(P)},D=P=>{const{onClickConnectStart:L,onClickConnectEnd:U,connectionClickStartHandle:F,connectionMode:q,isValidConnection:z,lib:B,rfId:V,nodeLookup:ce,connection:we}=O.getState();if(!y||!F&&!i)return;if(!F){L==null||L(P.nativeEvent,{nodeId:y,handleId:b,handleType:e}),O.setState({connectionClickStartHandle:{nodeId:y,type:e,id:b}});return}const Oe=Vie(P.target),de=n||z,{connection:Z,isValid:J}=RP.isValid(P.nativeEvent,{handle:{nodeId:y,id:b,type:e},connectionMode:q,fromNodeId:F.nodeId,fromHandleId:F.id||null,fromType:F.type,isValidConnection:de,flowId:V,doc:Oe,lib:B,nodeLookup:ce});J&&Z&&R(Z);const fe=structuredClone(we);delete fe.inProgress,fe.toPosition=fe.toHandle?fe.toHandle.position:null,U==null||U(P,fe),O.setState({connectionClickStartHandle:null})};return o.jsx("div",{"data-handleid":b,"data-nodeid":y,"data-handlepos":t,"data-id":`${w}-${y}-${b}-${e}`,className:Ss(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",x,u,{source:!g,target:g,connectable:r,connectablestart:i,connectableend:s,clickconnecting:k,connectingfrom:S,connectingto:E,valid:_,connectionindicator:r&&(!C||T)&&(C||N?s:i)}]),onMouseDown:$,onTouchStart:$,onClick:v?D:void 0,ref:p,...h,children:c})}const ho=m.memo(xse(c5e));function u5e({data:e,isConnectable:t,sourcePosition:n=Nt.Bottom}){return o.jsxs(o.Fragment,{children:[e==null?void 0:e.label,o.jsx(ho,{type:"source",position:n,isConnectable:t})]})}function d5e({data:e,isConnectable:t,targetPosition:n=Nt.Top,sourcePosition:r=Nt.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 f5e(){return null}function h5e({data:e,isConnectable:t,targetPosition:n=Nt.Top}){return o.jsxs(o.Fragment,{children:[o.jsx(ho,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const b2={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},nz={input:u5e,default:d5e,output:h5e,group:f5e};function p5e(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 m5e=e=>{const{width:t,height:n,x:r,y:i}=nw(e.nodeLookup,{filter:s=>!!s.selected});return{width:bc(t)?t:null,height:bc(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 g5e({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Ri(),{width:i,height:s,transformString:a,userSelectionActive:l}=sr(m5e,ji),c=Sse(),u=m.useRef(null);m.useEffect(()=>{var p;n||(p=u.current)==null||p.focus({preventScroll:!0})},[n]);const d=!l&&i!==null&&s!==null;if(wse({nodeRef:u,disabled:!d}),!d)return null;const f=e?p=>{const b=r.getState().nodes.filter(g=>g.selected);e(p,b)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(b2,p.key)&&(p.preventDefault(),c({direction:b2[p.key],factor:p.shiftKey?4:1}))};return o.jsx("div",{className:Ss(["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 rz=typeof window<"u"?window:void 0,b5e=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function kse({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:p,multiSelectionKeyCode:b,panActivationKeyCode:g,zoomActivationKeyCode:O,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:x,panOnScroll:w,panOnScrollSpeed:S,panOnScrollMode:E,zoomOnDoubleClick:k,panOnDrag:T,autoPanOnSelection:C,defaultViewport:N,translateExtent:_,minZoom:R,maxZoom:$,preventScrolling:D,onSelectionContextMenu:M,noWheelClassName:j,noPanClassName:P,disableKeyboardA11y:L,onViewportChange:U,isControlledViewport:F}){const{nodesSelectionActive:q,userSelectionActive:z}=sr(b5e,ji),B=Qx(u,{target:rz}),V=Qx(g,{target:rz}),ce=V||T,we=V||w,Oe=d&&ce!==!0,de=B||z||Oe;return ZDe({deleteKeyCode:c,multiSelectionKeyCode:b}),o.jsx(e5e,{onPaneContextMenu:s,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:x,panOnScroll:we,panOnScrollSpeed:S,panOnScrollMode:E,zoomOnDoubleClick:k,panOnDrag:!B&&ce,defaultViewport:N,translateExtent:_,minZoom:R,maxZoom:$,zoomActivationKeyCode:O,preventScrolling:D,noWheelClassName:j,noPanClassName:P,onViewportChange:U,isControlledViewport:F,paneClickDistance:l,selectionOnDrag:Oe,children:o.jsxs(i5e,{onSelectionStart:h,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:a,panOnDrag:ce,autoPanOnSelection:C,isSelecting:!!de,selectionMode:f,selectionKeyPressed:B,paneClickDistance:l,selectionOnDrag:Oe,children:[e,q&&o.jsx(g5e,{onSelectionContextMenu:M,noPanClassName:P,disableKeyboardA11y:L})]})})}kse.displayName="FlowRenderer";const O5e=m.memo(kse),y5e=e=>t=>e?j6(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 x5e(e){return sr(m.useCallback(y5e(e),[e]),ji)}const v5e=e=>e.updateNodeInternals;function w5e(){const e=sr(v5e),[t]=m.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 m.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function S5e({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const i=Ri(),s=m.useRef(null),a=m.useRef(null),l=m.useRef(e.sourcePosition),c=m.useRef(e.targetPosition),u=m.useRef(t),d=n&&!!e.internals.handleBounds;return m.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]),m.useEffect(()=>()=>{a.current&&(r==null||r.unobserve(a.current),a.current=null)},[]),m.useEffect(()=>{if(s.current){const f=u.current!==t,h=l.current!==e.sourcePosition,p=c.current!==e.targetPosition;(f||h||p)&&(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 E5e({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:p,disableKeyboardA11y:b,rfId:g,nodeTypes:O,nodeClickDistance:y,onError:v}){const{node:x,internals:w,isParent:S}=sr(de=>{const Z=de.nodeLookup.get(e),J=de.parentLookup.has(e);return{node:Z,internals:Z.internals,isParent:J}},ji);let E=x.type||"default",k=(O==null?void 0:O[E])||nz[E];k===void 0&&(v==null||v("003",Tc.error003(E)),E="default",k=(O==null?void 0:O.default)||nz.default);const T=!!(x.draggable||l&&typeof x.draggable>"u"),C=!!(x.selectable||c&&typeof x.selectable>"u"),N=!!(x.connectable||u&&typeof x.connectable>"u"),_=!!(x.focusable||d&&typeof x.focusable>"u"),R=Ri(),$=D6(x),D=S5e({node:x,nodeType:E,hasDimensions:$,resizeObserver:f}),M=wse({nodeRef:D,disabled:x.hidden||!T,noDragClassName:h,handleSelector:x.dragHandle,nodeId:e,isSelectable:C,nodeClickDistance:y}),j=Sse();if(x.hidden)return null;const P=of(x),L=p5e(x),U=C||T||t||n||r||i,F=n?de=>n(de,{...w.userNode}):void 0,q=r?de=>r(de,{...w.userNode}):void 0,z=i?de=>i(de,{...w.userNode}):void 0,B=s?de=>s(de,{...w.userNode}):void 0,V=a?de=>a(de,{...w.userNode}):void 0,ce=de=>{const{selectNodesOnDrag:Z,nodeDragThreshold:J}=R.getState();C&&(!Z||!T||J>0)&&IP({id:e,store:R,nodeRef:D}),t&&t(de,{...w.userNode})},we=de=>{if(!(qie(de.nativeEvent)||b)){if(Die.includes(de.key)&&C){const Z=de.key==="Escape";IP({id:e,store:R,unselect:Z,nodeRef:D})}else if(T&&x.selected&&Object.prototype.hasOwnProperty.call(b2,de.key)){de.preventDefault();const{ariaLabelConfig:Z}=R.getState();R.setState({ariaLiveMessage:Z["node.a11yDescription.ariaLiveMessage"]({direction:de.key.replace("Arrow","").toLowerCase(),x:~~w.positionAbsolute.x,y:~~w.positionAbsolute.y})}),j({direction:b2[de.key],factor:de.shiftKey?4:1})}}},Oe=()=>{var Qe;if(b||!((Qe=D.current)!=null&&Qe.matches(":focus-visible")))return;const{transform:de,width:Z,height:J,autoPanOnNodeFocus:fe,setCenter:be}=R.getState();if(!fe)return;j6(new Map([[e,x]]),{x:0,y:0,width:Z,height:J},de,!0).length>0||be(x.position.x+P.width/2,x.position.y+P.height/2,{zoom:de[2]})};return o.jsx("div",{className:Ss(["react-flow__node",`react-flow__node-${E}`,{[p]:T},x.className,{selected:x.selected,selectable:C,parent:S,draggable:T,dragging:M}]),ref:D,style:{zIndex:w.z,transform:`translate(${w.positionAbsolute.x}px,${w.positionAbsolute.y}px)`,pointerEvents:U?"all":"none",visibility:$?"visible":"hidden",...x.style,...L},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:F,onMouseMove:q,onMouseLeave:z,onContextMenu:B,onClick:ce,onDoubleClick:V,onKeyDown:_?we:void 0,tabIndex:_?0:void 0,onFocus:_?Oe:void 0,role:x.ariaRole??(_?"group":void 0),"aria-roledescription":"node","aria-describedby":b?void 0:`${pse}-${g}`,"aria-label":x.ariaLabel,...x.domAttributes,children:o.jsx(a5e,{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:T,deletable:x.deletable??!0,isConnectable:N,sourcePosition:x.sourcePosition,targetPosition:x.targetPosition,dragging:M,dragHandle:x.dragHandle,zIndex:w.z,parentId:x.parentId,...P})})})}var k5e=m.memo(E5e);const T5e=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Tse(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:s}=sr(T5e,ji),a=x5e(e.onlyRenderVisibleElements),l=w5e();return o.jsx("div",{className:"react-flow__nodes",style:RA,children:a.map(c=>o.jsx(k5e,{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))})}Tse.displayName="NodeRenderer";const _5e=m.memo(Tse);function A5e(e){return sr(m.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&&dIe({sourceNode:s,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(i.id)}return r},[e]),ji)}const C5e=({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"})},N5e=({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"})},iz={[Lx.Arrow]:C5e,[Lx.ArrowClosed]:N5e};function j5e(e){const t=Ri();return m.useMemo(()=>{var i,s;return Object.prototype.hasOwnProperty.call(iz,e)?iz[e]:((s=(i=t.getState()).onError)==null||s.call(i,"009",Tc.error009(e)),null)},[e])}const R5e=({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=j5e(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},_se=({defaultColor:e,rfId:t})=>{const n=sr(s=>s.edges),r=sr(s=>s.defaultEdgeOptions),i=m.useMemo(()=>yIe(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(R5e,{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};_se.displayName="MarkerDefinitions";var I5e=m.memo(_se);function Ase({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]=m.useState({x:1,y:0,width:0,height:0}),p=Ss(["react-flow__edge-textwrapper",u]),b=m.useRef(null);return m.useEffect(()=>{if(b.current){const g=b.current.getBBox();h({x:g.x,y:g.y,width:g.width,height:g.height})}},[n]),n?o.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,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:b,style:r,children:n}),c]}):null}Ase.displayName="EdgeText";const D5e=m.memo(Ase);function iw({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:Ss(["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&&bc(t)&&bc(n)?o.jsx(D5e,{x:t,y:n,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function sz({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===Nt.Left||e===Nt.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function Cse({sourceX:e,sourceY:t,sourcePosition:n=Nt.Bottom,targetX:r,targetY:i,targetPosition:s=Nt.Top}){const[a,l]=sz({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,u]=sz({pos:s,x1:r,y1:i,x2:e,y2:t}),[d,f,h,p]=Xie({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,p]}function Nse(e){return m.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:p,style:b,markerEnd:g,markerStart:O,interactionWidth:y})=>{const[v,x,w]=Cse({sourceX:n,sourceY:r,sourcePosition:a,targetX:i,targetY:s,targetPosition:l}),S=e.isInternal?void 0:t;return o.jsx(iw,{id:S,path:v,labelX:x,labelY:w,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:b,markerEnd:g,markerStart:O,interactionWidth:y})})}const P5e=Nse({isInternal:!1}),jse=Nse({isInternal:!0});P5e.displayName="SimpleBezierEdge";jse.displayName="SimpleBezierEdgeInternal";function Rse(e){return m.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:p=Nt.Bottom,targetPosition:b=Nt.Top,markerEnd:g,markerStart:O,pathOptions:y,interactionWidth:v})=>{const[x,w,S]=g2({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:s,targetPosition:b,borderRadius:y==null?void 0:y.borderRadius,offset:y==null?void 0:y.offset,stepPosition:y==null?void 0:y.stepPosition}),E=e.isInternal?void 0:t;return o.jsx(iw,{id:E,path:x,labelX:w,labelY:S,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:g,markerStart:O,interactionWidth:v})})}const Ise=Rse({isInternal:!1}),Dse=Rse({isInternal:!0});Ise.displayName="SmoothStepEdge";Dse.displayName="SmoothStepEdgeInternal";function Pse(e){return m.memo(({id:t,...n})=>{var i;const r=e.isInternal?void 0:t;return o.jsx(Ise,{...n,id:r,pathOptions:m.useMemo(()=>{var s;return{borderRadius:0,offset:(s=n.pathOptions)==null?void 0:s.offset}},[(i=n.pathOptions)==null?void 0:i.offset])})})}const M5e=Pse({isInternal:!1}),Mse=Pse({isInternal:!0});M5e.displayName="StepEdge";Mse.displayName="StepEdgeInternal";function Lse(e){return m.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:p,markerStart:b,interactionWidth:g})=>{const[O,y,v]=Wie({sourceX:n,sourceY:r,targetX:i,targetY:s}),x=e.isInternal?void 0:t;return o.jsx(iw,{id:x,path:O,labelX:y,labelY:v,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:b,interactionWidth:g})})}const L5e=Lse({isInternal:!1}),$se=Lse({isInternal:!0});L5e.displayName="StraightEdge";$se.displayName="StraightEdgeInternal";function Bse(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:a=Nt.Bottom,targetPosition:l=Nt.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:b,markerEnd:g,markerStart:O,pathOptions:y,interactionWidth:v})=>{const[x,w,S]=Gie({sourceX:n,sourceY:r,sourcePosition:a,targetX:i,targetY:s,targetPosition:l,curvature:y==null?void 0:y.curvature}),E=e.isInternal?void 0:t;return o.jsx(iw,{id:E,path:x,labelX:w,labelY:S,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:b,markerEnd:g,markerStart:O,interactionWidth:v})})}const $5e=Bse({isInternal:!1}),Qse=Bse({isInternal:!0});$5e.displayName="BezierEdge";Qse.displayName="BezierEdgeInternal";const az={default:Qse,straight:$se,step:Mse,smoothstep:Dse,simplebezier:jse},oz={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},B5e=(e,t,n)=>n===Nt.Left?e-t:n===Nt.Right?e+t:e,Q5e=(e,t,n)=>n===Nt.Top?e-t:n===Nt.Bottom?e+t:e,lz="react-flow__edgeupdater";function cz({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:Ss([lz,`${lz}-${l}`]),cx:B5e(t,r,e),cy:Q5e(n,r,e),r,stroke:"transparent",fill:"transparent"})}function F5e({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:p}){const b=Ri(),g=(w,S)=>{if(w.button!==0)return;const{autoPanOnConnect:E,domNode:k,connectionMode:T,connectionRadius:C,lib:N,onConnectStart:_,cancelConnection:R,nodeLookup:$,rfId:D,panBy:M,updateConnection:j}=b.getState(),P=S.type==="target",L=(q,z)=>{h(!1),f==null||f(q,n,S.type,z)},U=q=>u==null?void 0:u(n,q),F=(q,z)=>{h(!0),d==null||d(w,n,S.type),_==null||_(q,z)};RP.onPointerDown(w.nativeEvent,{autoPanOnConnect:E,connectionMode:T,connectionRadius:C,domNode:k,handleId:S.id,nodeId:S.nodeId,nodeLookup:$,isTarget:P,edgeUpdaterType:S.type,lib:N,flowId:D,cancelConnection:R,panBy:M,isValidConnection:(...q)=>{var z,B;return((B=(z=b.getState()).isValidConnection)==null?void 0:B.call(z,...q))??!0},onConnect:U,onConnectStart:F,onConnectEnd:(...q)=>{var z,B;return(B=(z=b.getState()).onConnectEnd)==null?void 0:B.call(z,...q)},onReconnectEnd:L,updateConnection:j,getTransform:()=>b.getState().transform,getFromHandle:()=>b.getState().connection.fromHandle,dragThreshold:b.getState().connectionDragThreshold,handleDomNode:w.currentTarget})},O=w=>g(w,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=w=>g(w,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),v=()=>p(!0),x=()=>p(!1);return o.jsxs(o.Fragment,{children:[(e===!0||e==="source")&&o.jsx(cz,{position:l,centerX:r,centerY:i,radius:t,onMouseDown:O,onMouseEnter:v,onMouseOut:x,type:"source"}),(e===!0||e==="target")&&o.jsx(cz,{position:c,centerX:s,centerY:a,radius:t,onMouseDown:y,onMouseEnter:v,onMouseOut:x,type:"target"})]})}function U5e({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:p,rfId:b,edgeTypes:g,noPanClassName:O,onError:y,disableKeyboardA11y:v}){let x=sr(be=>be.edgeLookup.get(e));const w=sr(be=>be.defaultEdgeOptions);x=w?{...w,...x}:x;let S=x.type||"default",E=(g==null?void 0:g[S])||az[S];E===void 0&&(y==null||y("011",Tc.error011(S)),S="default",E=(g==null?void 0:g.default)||az.default);const k=!!(x.focusable||t&&typeof x.focusable>"u"),T=typeof f<"u"&&(x.reconnectable||n&&typeof x.reconnectable>"u"),C=!!(x.selectable||r&&typeof x.selectable>"u"),N=m.useRef(null),[_,R]=m.useState(!1),[$,D]=m.useState(!1),M=Ri(),{zIndex:j,sourceX:P,sourceY:L,targetX:U,targetY:F,sourcePosition:q,targetPosition:z}=sr(m.useCallback(be=>{const je=be.nodeLookup.get(x.source),Qe=be.nodeLookup.get(x.target);if(!je||!Qe)return{zIndex:x.zIndex,...oz};const Me=OIe({id:e,sourceNode:je,targetNode:Qe,sourceHandle:x.sourceHandle||null,targetHandle:x.targetHandle||null,connectionMode:be.connectionMode,onError:y});return{zIndex:uIe({selected:x.selected,zIndex:x.zIndex,sourceNode:je,targetNode:Qe,elevateOnSelect:be.elevateEdgesOnSelect,zIndexMode:be.zIndexMode}),...Me||oz}},[x.source,x.target,x.sourceHandle,x.targetHandle,x.selected,x.zIndex]),ji),B=m.useMemo(()=>x.markerStart?`url('#${NP(x.markerStart,b)}')`:void 0,[x.markerStart,b]),V=m.useMemo(()=>x.markerEnd?`url('#${NP(x.markerEnd,b)}')`:void 0,[x.markerEnd,b]);if(x.hidden||P===null||L===null||U===null||F===null)return null;const ce=be=>{var le;const{addSelectedEdges:je,unselectNodesAndEdges:Qe,multiSelectionActive:Me}=M.getState();C&&(M.setState({nodesSelectionActive:!1}),x.selected&&Me?(Qe({nodes:[],edges:[x]}),(le=N.current)==null||le.blur()):je([e])),i&&i(be,x)},we=s?be=>{s(be,{...x})}:void 0,Oe=a?be=>{a(be,{...x})}:void 0,de=l?be=>{l(be,{...x})}:void 0,Z=c?be=>{c(be,{...x})}:void 0,J=u?be=>{u(be,{...x})}:void 0,fe=be=>{var je;if(!v&&Die.includes(be.key)&&C){const{unselectNodesAndEdges:Qe,addSelectedEdges:Me}=M.getState();be.key==="Escape"?((je=N.current)==null||je.blur(),Qe({edges:[x]})):Me([e])}};return o.jsx("svg",{style:{zIndex:j},children:o.jsxs("g",{className:Ss(["react-flow__edge",`react-flow__edge-${S}`,x.className,O,{selected:x.selected,animated:x.animated,inactive:!C&&!i,updating:_,selectable:C}]),onClick:ce,onDoubleClick:we,onContextMenu:Oe,onMouseEnter:de,onMouseMove:Z,onMouseLeave:J,onKeyDown:k?fe: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?`${mse}-${b}`:void 0,ref:N,...x.domAttributes,children:[!$&&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:P,sourceY:L,targetX:U,targetY:F,sourcePosition:q,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}),T&&o.jsx(F5e,{edge:x,isReconnectable:T,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,sourceX:P,sourceY:L,targetX:U,targetY:F,sourcePosition:q,targetPosition:z,setUpdateHover:R,setReconnecting:D})]})})}var z5e=m.memo(U5e);const V5e=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Fse({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:p,onReconnectEnd:b,disableKeyboardA11y:g}){const{edgesFocusable:O,edgesReconnectable:y,elementsSelectable:v,onError:x}=sr(V5e,ji),w=A5e(t);return o.jsxs("div",{className:"react-flow__edges",children:[o.jsx(I5e,{defaultColor:e,rfId:n}),w.map(S=>o.jsx(z5e,{id:S,edgesFocusable:O,edgesReconnectable:y,elementsSelectable:v,noPanClassName:i,onReconnect:s,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:d,reconnectRadius:f,onDoubleClick:h,onReconnectStart:p,onReconnectEnd:b,rfId:n,onError:x,edgeTypes:r,disableKeyboardA11y:g},S))]})}Fse.displayName="EdgeRenderer";const q5e=m.memo(Fse),H5e=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function X5e({children:e}){const t=sr(H5e);return o.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function G5e(e){const t=jA(),n=m.useRef(!1);m.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Y5e=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function W5e(e){const t=sr(Y5e),n=Ri();return m.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Z5e(e){return e.connection.inProgress?{...e.connection,to:OO(e.connection.to,e.transform)}:{...e.connection}}function K5e(e){return Z5e}function J5e(e){const t=K5e();return sr(t,ji)}const ePe=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function tPe({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:i,width:s,height:a,isValid:l,inProgress:c}=sr(ePe,ji);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:Ss(["react-flow__connection",Lie(l)]),children:o.jsx(Use,{style:t,type:n,CustomComponent:r,isValid:l})})})}const Use=({style:e,type:t=Wf.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:p}=J5e();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:Lie(r),toNode:d,toHandle:f,pointer:p});let b="";const g={sourceX:s.x,sourceY:s.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case Wf.Bezier:[b]=Gie(g);break;case Wf.SimpleBezier:[b]=Cse(g);break;case Wf.Step:[b]=g2({...g,borderRadius:0});break;case Wf.SmoothStep:[b]=g2(g);break;default:[b]=Wie(g)}return o.jsx("path",{d:b,fill:"none",className:"react-flow__connection-path",style:e})};Use.displayName="ConnectionLine";const nPe={};function uz(e=nPe){m.useRef(e),Ri(),m.useEffect(()=>{},[e])}function rPe(){Ri(),m.useRef(!1),m.useEffect(()=>{},[])}function zse({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:p,connectionLineType:b,connectionLineStyle:g,connectionLineComponent:O,connectionLineContainerStyle:y,selectionKeyCode:v,selectionOnDrag:x,selectionMode:w,multiSelectionKeyCode:S,panActivationKeyCode:E,zoomActivationKeyCode:k,deleteKeyCode:T,onlyRenderVisibleElements:C,elementsSelectable:N,defaultViewport:_,translateExtent:R,minZoom:$,maxZoom:D,preventScrolling:M,defaultMarkerColor:j,zoomOnScroll:P,zoomOnPinch:L,panOnScroll:U,panOnScrollSpeed:F,panOnScrollMode:q,zoomOnDoubleClick:z,panOnDrag:B,autoPanOnSelection:V,onPaneClick:ce,onPaneMouseEnter:we,onPaneMouseMove:Oe,onPaneMouseLeave:de,onPaneScroll:Z,onPaneContextMenu:J,paneClickDistance:fe,nodeClickDistance:be,onEdgeContextMenu:je,onEdgeMouseEnter:Qe,onEdgeMouseMove:Me,onEdgeMouseLeave:le,reconnectRadius:ke,onReconnect:ye,onReconnectStart:$e,onReconnectEnd:ze,noDragClassName:Ae,noWheelClassName:Ve,noPanClassName:ut,disableKeyboardA11y:Tt,nodeExtent:We,rfId:W,viewport:ne,onViewportChange:he}){return uz(e),uz(t),rPe(),G5e(n),W5e(ne),o.jsx(O5e,{onPaneClick:ce,onPaneMouseEnter:we,onPaneMouseMove:Oe,onPaneMouseLeave:de,onPaneContextMenu:J,onPaneScroll:Z,paneClickDistance:fe,deleteKeyCode:T,selectionKeyCode:v,selectionOnDrag:x,selectionMode:w,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:S,panActivationKeyCode:E,zoomActivationKeyCode:k,elementsSelectable:N,zoomOnScroll:P,zoomOnPinch:L,zoomOnDoubleClick:z,panOnScroll:U,panOnScrollSpeed:F,panOnScrollMode:q,panOnDrag:B,autoPanOnSelection:V,defaultViewport:_,translateExtent:R,minZoom:$,maxZoom:D,onSelectionContextMenu:f,preventScrolling:M,noDragClassName:Ae,noWheelClassName:Ve,noPanClassName:ut,disableKeyboardA11y:Tt,onViewportChange:he,isControlledViewport:!!ne,children:o.jsxs(X5e,{children:[o.jsx(q5e,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:a,onReconnect:ye,onReconnectStart:$e,onReconnectEnd:ze,onlyRenderVisibleElements:C,onEdgeContextMenu:je,onEdgeMouseEnter:Qe,onEdgeMouseMove:Me,onEdgeMouseLeave:le,reconnectRadius:ke,defaultMarkerColor:j,noPanClassName:ut,disableKeyboardA11y:Tt,rfId:W}),o.jsx(tPe,{style:g,type:b,component:O,containerStyle:y}),o.jsx("div",{className:"react-flow__edgelabel-renderer"}),o.jsx(_5e,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:s,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:be,onlyRenderVisibleElements:C,noPanClassName:ut,noDragClassName:Ae,disableKeyboardA11y:Tt,nodeExtent:We,rfId:W}),o.jsx("div",{className:"react-flow__viewport-portal"})]})})}zse.displayName="GraphView";const iPe=m.memo(zse),sPe=Uie(),dz=({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 p=new Map,b=new Map,g=new Map,O=new Map,y=r??t??[],v=n??e??[],x=d??[0,0],w=f??Px;Jie(g,O,y);const{nodesInitialized:S}=jP(v,p,b,{nodeOrigin:x,nodeExtent:w,zIndexMode:h});let E=[0,0,1];if(a&&i&&s){const k=nw(p,{filter:_=>!!((_.width||_.initialWidth)&&(_.height||_.initialHeight))}),{x:T,y:C,zoom:N}=I6(k,i,s,c,u,(l==null?void 0:l.padding)??.1);E=[T,C,N]}return{rfId:"1",width:i??0,height:s??0,transform:E,nodes:v,nodesInitialized:S,nodeLookup:p,parentLookup:b,edges:y,edgeLookup:O,connectionLookup:g,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:Px,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ab.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:{...Mie},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:sPe,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Pie,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},aPe=({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})=>vDe((p,b)=>{async function g(){const{nodeLookup:O,panZoom:y,fitViewOptions:v,fitViewResolver:x,width:w,height:S,minZoom:E,maxZoom:k}=b();y&&(await rIe({nodes:O,width:w,height:S,panZoom:y,minZoom:E,maxZoom:k},v),x==null||x.resolve(!0),p({fitViewResolver:null}))}return{...dz({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:O=>{const{nodeLookup:y,parentLookup:v,nodeOrigin:x,elevateNodesOnSelect:w,fitViewQueued:S,zIndexMode:E,nodesSelectionActive:k}=b(),{nodesInitialized:T,hasSelectedNodes:C}=jP(O,y,v,{nodeOrigin:x,nodeExtent:f,elevateNodesOnSelect:w,checkEquality:!0,zIndexMode:E}),N=k&&C;S&&T?(g(),p({nodes:O,nodesInitialized:T,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:N})):p({nodes:O,nodesInitialized:T,nodesSelectionActive:N})},setEdges:O=>{const{connectionLookup:y,edgeLookup:v}=b();Jie(y,v,O),p({edges:O})},setDefaultNodesAndEdges:(O,y)=>{if(O){const{setNodes:v}=b();v(O),p({hasDefaultNodes:!0})}if(y){const{setEdges:v}=b();v(y),p({hasDefaultEdges:!0})}},updateNodeInternals:O=>{const{triggerNodeChanges:y,nodeLookup:v,parentLookup:x,domNode:w,nodeOrigin:S,nodeExtent:E,debug:k,fitViewQueued:T,zIndexMode:C}=b(),{changes:N,updatedInternals:_}=TIe(O,v,x,w,S,E,C);_&&(wIe(v,x,{nodeOrigin:S,nodeExtent:E,zIndexMode:C}),T?(g(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),(N==null?void 0:N.length)>0&&(k&&console.log("React Flow: trigger node changes",N),y==null||y(N)))},updateNodePositions:(O,y=!1)=>{const v=[];let x=[];const{nodeLookup:w,triggerNodeChanges:S,connection:E,updateConnection:k,onNodesChangeMiddlewareMap:T}=b();for(const[C,N]of O){const _=w.get(C),R=!!(_!=null&&_.expandParent&&(_!=null&&_.parentId)&&(N!=null&&N.position)),$={id:C,type:"position",position:R?{x:Math.max(0,N.position.x),y:Math.max(0,N.position.y)}:N.position,dragging:y};if(_&&E.inProgress&&E.fromNode.id===_.id){const D=_m(_,E.fromHandle,Nt.Left,!0);k({...E,from:D})}R&&_.parentId&&v.push({id:C,parentId:_.parentId,rect:{...N.internals.positionAbsolute,width:N.measured.width??0,height:N.measured.height??0}}),x.push($)}if(v.length>0){const{parentLookup:C,nodeOrigin:N}=b(),_=Q6(v,w,C,N);x.push(..._)}for(const C of T.values())x=C(x);S(x)},triggerNodeChanges:O=>{const{onNodesChange:y,setNodes:v,nodes:x,hasDefaultNodes:w,debug:S}=b();if(O!=null&&O.length){if(w){const E=Ose(O,x);v(E)}S&&console.log("React Flow: trigger node changes",O),y==null||y(O)}},triggerEdgeChanges:O=>{const{onEdgesChange:y,setEdges:v,edges:x,hasDefaultEdges:w,debug:S}=b();if(O!=null&&O.length){if(w){const E=yse(O,x);v(E)}S&&console.log("React Flow: trigger edge changes",O),y==null||y(O)}},addSelectedNodes:O=>{const{multiSelectionActive:y,edgeLookup:v,nodeLookup:x,triggerNodeChanges:w,triggerEdgeChanges:S}=b();if(y){const E=O.map(k=>Ip(k,!0));w(E);return}w(x0(x,new Set([...O]),!0)),S(x0(v))},addSelectedEdges:O=>{const{multiSelectionActive:y,edgeLookup:v,nodeLookup:x,triggerNodeChanges:w,triggerEdgeChanges:S}=b();if(y){const E=O.map(k=>Ip(k,!0));S(E);return}S(x0(v,new Set([...O]))),w(x0(x,new Set,!0))},unselectNodesAndEdges:({nodes:O,edges:y}={})=>{const{edges:v,nodes:x,nodeLookup:w,triggerNodeChanges:S,triggerEdgeChanges:E}=b(),k=O||x,T=y||v,C=[];for(const _ of k){if(!_.selected)continue;const R=w.get(_.id);R&&(R.selected=!1),C.push(Ip(_.id,!1))}const N=[];for(const _ of T)_.selected&&N.push(Ip(_.id,!1));S(C),E(N)},setMinZoom:O=>{const{panZoom:y,maxZoom:v}=b();y==null||y.setScaleExtent([O,v]),p({minZoom:O})},setMaxZoom:O=>{const{panZoom:y,minZoom:v}=b();y==null||y.setScaleExtent([v,O]),p({maxZoom:O})},setTranslateExtent:O=>{var y;(y=b().panZoom)==null||y.setTranslateExtent(O),p({translateExtent:O})},resetSelectedElements:()=>{const{edges:O,nodes:y,triggerNodeChanges:v,triggerEdgeChanges:x,elementsSelectable:w}=b();if(!w)return;const S=y.reduce((k,T)=>T.selected?[...k,Ip(T.id,!1)]:k,[]),E=O.reduce((k,T)=>T.selected?[...k,Ip(T.id,!1)]:k,[]);v(S),x(E)},setNodeExtent:O=>{const{nodes:y,nodeLookup:v,parentLookup:x,nodeOrigin:w,elevateNodesOnSelect:S,nodeExtent:E,zIndexMode:k}=b();O[0][0]===E[0][0]&&O[0][1]===E[0][1]&&O[1][0]===E[1][0]&&O[1][1]===E[1][1]||(jP(y,v,x,{nodeOrigin:w,nodeExtent:O,elevateNodesOnSelect:S,checkEquality:!1,zIndexMode:k}),p({nodeExtent:O}))},panBy:O=>{const{transform:y,width:v,height:x,panZoom:w,translateExtent:S}=b();return _Ie({delta:O,panZoom:w,transform:y,translateExtent:S,width:v,height:x})},setCenter:async(O,y,v)=>{const{width:x,height:w,maxZoom:S,panZoom:E}=b();if(!E)return!1;const k=typeof(v==null?void 0:v.zoom)<"u"?v.zoom:S;return await E.setViewport({x:x/2-O*k,y:w/2-y*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:()=>{p({connection:{...Mie}})},updateConnection:O=>{p({connection:O})},reset:()=>p({...dz()})}},Object.is);function Vse({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:p}){const[b]=m.useState(()=>aPe({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(wDe,{value:b,children:o.jsx(XDe,{children:p})})}function oPe({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:p}){return m.useContext(CA)?o.jsx(o.Fragment,{children:e}):o.jsx(Vse,{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:p,children:e})}const lPe={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function cPe({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:p,onConnectStart:b,onConnectEnd:g,onClickConnectStart:O,onClickConnectEnd:y,onNodeMouseEnter:v,onNodeMouseMove:x,onNodeMouseLeave:w,onNodeContextMenu:S,onNodeDoubleClick:E,onNodeDragStart:k,onNodeDrag:T,onNodeDragStop:C,onNodesDelete:N,onEdgesDelete:_,onDelete:R,onSelectionChange:$,onSelectionDragStart:D,onSelectionDrag:M,onSelectionDragStop:j,onSelectionContextMenu:P,onSelectionStart:L,onSelectionEnd:U,onBeforeDelete:F,connectionMode:q,connectionLineType:z=Wf.Bezier,connectionLineStyle:B,connectionLineComponent:V,connectionLineContainerStyle:ce,deleteKeyCode:we="Backspace",selectionKeyCode:Oe="Shift",selectionOnDrag:de=!1,selectionMode:Z=Mx.Full,panActivationKeyCode:J="Space",multiSelectionKeyCode:fe=Bx()?"Meta":"Control",zoomActivationKeyCode:be=Bx()?"Meta":"Control",snapToGrid:je,snapGrid:Qe,onlyRenderVisibleElements:Me=!1,selectNodesOnDrag:le,nodesDraggable:ke,autoPanOnNodeFocus:ye,nodesConnectable:$e,nodesFocusable:ze,nodeOrigin:Ae=gse,edgesFocusable:Ve,edgesReconnectable:ut,elementsSelectable:Tt=!0,defaultViewport:We=PDe,minZoom:W=.5,maxZoom:ne=2,translateExtent:he=Px,preventScrolling:xe=!0,nodeExtent:re,defaultMarkerColor:Re="#b1b1b7",zoomOnScroll:nt=!0,zoomOnPinch:Ke=!0,panOnScroll:tn=!1,panOnScrollSpeed:Gt=.5,panOnScrollMode:At=um.Free,zoomOnDoubleClick:St=!0,panOnDrag:ve=!0,onPaneClick:Ue,onPaneMouseEnter:Y,onPaneMouseMove:mt,onPaneMouseLeave:xt,onPaneScroll:Dt,onPaneContextMenu:Ne,paneClickDistance:Ge=1,nodeClickDistance:Pt=0,children:Kt,onReconnect:tt,onReconnectStart:an,onReconnectEnd:ar,onEdgeContextMenu:Qt,onEdgeDoubleClick:Ut,onEdgeMouseEnter:Ce,onEdgeMouseMove:Ze,onEdgeMouseLeave:$t,reconnectRadius:En=10,onNodesChange:gn,onEdgesChange:xr,noDragClassName:Pe="nodrag",noWheelClassName:at="nowheel",noPanClassName:Lt="nopan",fitView:Wt,fitViewOptions:fn,connectOnClick:Jt,attributionPosition:or,proOptions:Sr,defaultEdgeOptions:si,elevateNodesOnSelect:Yt=!0,elevateEdgesOnSelect:_r=!1,disableKeyboardA11y:kn=!1,autoPanOnConnect:Wr,autoPanOnNodeDrag:jr,autoPanOnSelection:Rr=!0,autoPanSpeed:Rn,connectionRadius:lr,isValidConnection:Nn,onError:cr,style:Lr,id:$r,nodeDragThreshold:Zr,connectionDragThreshold:bn,viewport:ue,onViewportChange:Ie,width:ot,height:dt,colorMode:Zn="light",debug:Fi,onScroll:Ui,ariaLabelConfig:Es,zIndexMode:Ii="basic",...Ds},mr){const Ws=$r||"1",$c=BDe(Zn),Ka=m.useCallback(ai=>{ai.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Ui==null||Ui(ai)},[Ui]);return o.jsx("div",{"data-testid":"rf__wrapper",...Ds,onScroll:Ka,style:{...Lr,...lPe},ref:mr,className:Ss(["react-flow",i,$c]),id:$r,role:"application",children:o.jsxs(oPe,{nodes:e,edges:t,width:ot,height:dt,fitView:Wt,fitViewOptions:fn,minZoom:W,maxZoom:ne,nodeOrigin:Ae,nodeExtent:re,zIndexMode:Ii,children:[o.jsx($De,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:b,onConnectEnd:g,onClickConnectStart:O,onClickConnectEnd:y,nodesDraggable:ke,autoPanOnNodeFocus:ye,nodesConnectable:$e,nodesFocusable:ze,edgesFocusable:Ve,edgesReconnectable:ut,elementsSelectable:Tt,elevateNodesOnSelect:Yt,elevateEdgesOnSelect:_r,minZoom:W,maxZoom:ne,nodeExtent:re,onNodesChange:gn,onEdgesChange:xr,snapToGrid:je,snapGrid:Qe,connectionMode:q,translateExtent:he,connectOnClick:Jt,defaultEdgeOptions:si,fitView:Wt,fitViewOptions:fn,onNodesDelete:N,onEdgesDelete:_,onDelete:R,onNodeDragStart:k,onNodeDrag:T,onNodeDragStop:C,onSelectionDrag:M,onSelectionDragStart:D,onSelectionDragStop:j,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:Lt,nodeOrigin:Ae,rfId:Ws,autoPanOnConnect:Wr,autoPanOnNodeDrag:jr,autoPanSpeed:Rn,onError:cr,connectionRadius:lr,isValidConnection:Nn,selectNodesOnDrag:le,nodeDragThreshold:Zr,connectionDragThreshold:bn,onBeforeDelete:F,debug:Fi,ariaLabelConfig:Es,zIndexMode:Ii}),o.jsx(iPe,{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:ce,selectionKeyCode:Oe,selectionOnDrag:de,selectionMode:Z,deleteKeyCode:we,multiSelectionKeyCode:fe,panActivationKeyCode:J,zoomActivationKeyCode:be,onlyRenderVisibleElements:Me,defaultViewport:We,translateExtent:he,minZoom:W,maxZoom:ne,preventScrolling:xe,zoomOnScroll:nt,zoomOnPinch:Ke,zoomOnDoubleClick:St,panOnScroll:tn,panOnScrollSpeed:Gt,panOnScrollMode:At,panOnDrag:ve,autoPanOnSelection:Rr,onPaneClick:Ue,onPaneMouseEnter:Y,onPaneMouseMove:mt,onPaneMouseLeave:xt,onPaneScroll:Dt,onPaneContextMenu:Ne,paneClickDistance:Ge,nodeClickDistance:Pt,onSelectionContextMenu:P,onSelectionStart:L,onSelectionEnd:U,onReconnect:tt,onReconnectStart:an,onReconnectEnd:ar,onEdgeContextMenu:Qt,onEdgeDoubleClick:Ut,onEdgeMouseEnter:Ce,onEdgeMouseMove:Ze,onEdgeMouseLeave:$t,reconnectRadius:En,defaultMarkerColor:Re,noDragClassName:Pe,noWheelClassName:at,noPanClassName:Lt,rfId:Ws,disableKeyboardA11y:kn,nodeExtent:re,viewport:ue,onViewportChange:Ie}),o.jsx(DDe,{onSelectionChange:$}),Kt,o.jsx(CDe,{proOptions:Sr,position:or}),o.jsx(ADe,{rfId:Ws,disableKeyboardA11y:kn})]})})}var uPe=xse(cPe);const dPe=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function fPe({children:e}){const t=sr(dPe);return t?ii.createPortal(e,t):null}function hPe(e){const[t,n]=m.useState(e),r=m.useCallback(i=>n(s=>Ose(i,s)),[]);return[t,n,r]}function pPe(e){const[t,n]=m.useState(e),r=m.useCallback(i=>n(s=>yse(i,s)),[]);return[t,n,r]}const mPe=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||!D6(n.userNode))return!1;return!0};function gPe(e={includeHiddenNodes:!1}){return sr(mPe(e))}function bPe({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:Ss(["react-flow__background-pattern",n,r])})}function OPe({radius:e,className:t}){return o.jsx("circle",{cx:e,cy:e,r:e,className:Ss(["react-flow__background-pattern","dots",t])})}var yh;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(yh||(yh={}));const yPe={[yh.Dots]:1,[yh.Lines]:1,[yh.Cross]:6},xPe=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function qse({id:e,variant:t=yh.Dots,gap:n=20,size:r,lineWidth:i=1,offset:s=0,color:a,bgColor:l,style:c,className:u,patternClassName:d}){const f=m.useRef(null),{transform:h,patternId:p}=sr(xPe,ji),b=r||yPe[t],g=t===yh.Dots,O=t===yh.Cross,y=Array.isArray(n)?n:[n,n],v=[y[0]*h[2]||1,y[1]*h[2]||1],x=b*h[2],w=Array.isArray(s)?s:[s,s],S=O?[x,x]:v,E=[w[0]*h[2]||1+S[0]/2,w[1]*h[2]||1+S[1]/2],k=`${p}${e||""}`;return o.jsxs("svg",{className:Ss(["react-flow__background",u]),style:{...c,...RA,"--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:g?o.jsx(OPe,{radius:x/2,className:d}):o.jsx(bPe,{dimensions:S,lineWidth:i,variant:t,className:d})}),o.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${k})`})]})}qse.displayName="Background";const vPe=m.memo(qse);function wPe(){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 SPe(){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 EPe(){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 kPe(){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 TPe(){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 WS({children:e,className:t,...n}){return o.jsx("button",{type:"button",className:Ss(["react-flow__controls-button",t]),...n,children:e})}const _Pe=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Hse({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":p}){const b=Ri(),{isInteractive:g,minZoomReached:O,maxZoomReached:y,ariaLabelConfig:v}=sr(_Pe,ji),{zoomIn:x,zoomOut:w,fitView:S}=jA(),E=()=>{x(),s==null||s()},k=()=>{w(),a==null||a()},T=()=>{S(i),l==null||l()},C=()=>{b.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),c==null||c(!g)},N=h==="horizontal"?"horizontal":"vertical";return o.jsxs(NA,{className:Ss(["react-flow__controls",N,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":p??v["controls.ariaLabel"],children:[t&&o.jsxs(o.Fragment,{children:[o.jsx(WS,{onClick:E,className:"react-flow__controls-zoomin",title:v["controls.zoomIn.ariaLabel"],"aria-label":v["controls.zoomIn.ariaLabel"],disabled:y,children:o.jsx(wPe,{})}),o.jsx(WS,{onClick:k,className:"react-flow__controls-zoomout",title:v["controls.zoomOut.ariaLabel"],"aria-label":v["controls.zoomOut.ariaLabel"],disabled:O,children:o.jsx(SPe,{})})]}),n&&o.jsx(WS,{className:"react-flow__controls-fitview",onClick:T,title:v["controls.fitView.ariaLabel"],"aria-label":v["controls.fitView.ariaLabel"],children:o.jsx(EPe,{})}),r&&o.jsx(WS,{className:"react-flow__controls-interactive",onClick:C,title:v["controls.interactive.ariaLabel"],"aria-label":v["controls.interactive.ariaLabel"],children:g?o.jsx(TPe,{}):o.jsx(kPe,{})}),d]})}Hse.displayName="Controls";const APe=m.memo(Hse);function CPe({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:p}){const{background:b,backgroundColor:g}=s||{},O=a||b||g;return o.jsx("rect",{className:Ss(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:d,ry:d,width:r,height:i,style:{fill:O,stroke:l,strokeWidth:c},shapeRendering:f,onClick:p?y=>p(y,e):void 0})}const NPe=m.memo(CPe),jPe=e=>e.nodes.map(t=>t.id),Wj=e=>e instanceof Function?e:()=>e;function RPe({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:s=NPe,onClick:a}){const l=sr(jPe,ji),c=Wj(t),u=Wj(e),d=Wj(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return o.jsx(o.Fragment,{children:l.map(h=>o.jsx(DPe,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:s,onClick:a,shapeRendering:f},h))})}function IPe({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:p}=sr(b=>{const g=b.nodeLookup.get(e);if(!g)return{node:void 0,x:0,y:0,width:0,height:0};const O=g.internals.userNode,{x:y,y:v}=g.internals.positionAbsolute,{width:x,height:w}=of(O);return{node:O,x:y,y:v,width:x,height:w}},ji);return!u||u.hidden||!D6(u)?null:o.jsx(l,{x:d,y:f,width:h,height:p,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 DPe=m.memo(IPe);var PPe=m.memo(RPe);const MPe=200,LPe=150,$Pe=e=>!e.hidden,BPe=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?Fie(nw(e.nodeLookup,{filter:$Pe}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},QPe="react-flow__minimap-desc";function Xse({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:p,onNodeClick:b,pannable:g=!1,zoomable:O=!1,ariaLabel:y,inversePan:v,zoomStep:x=1,offsetScale:w=5}){const S=Ri(),E=m.useRef(null),{boundingRect:k,viewBB:T,rfId:C,panZoom:N,translateExtent:_,flowWidth:R,flowHeight:$,ariaLabelConfig:D}=sr(BPe,ji),M=(e==null?void 0:e.width)??MPe,j=(e==null?void 0:e.height)??LPe,P=k.width/M,L=k.height/j,U=Math.max(P,L),F=U*M,q=U*j,z=w*U,B=k.x-(F-k.width)/2-z,V=k.y-(q-k.height)/2-z,ce=F+z*2,we=q+z*2,Oe=`${QPe}-${C}`,de=m.useRef(0),Z=m.useRef();de.current=U,m.useEffect(()=>{if(E.current&&N)return Z.current=MIe({domNode:E.current,panZoom:N,getTransform:()=>S.getState().transform,getViewScale:()=>de.current}),()=>{var je;(je=Z.current)==null||je.destroy()}},[N]),m.useEffect(()=>{var je;(je=Z.current)==null||je.update({translateExtent:_,width:R,height:$,inversePan:v,pannable:g,zoomStep:x,zoomable:O})},[g,O,v,x,_,R,$]);const J=p?je=>{var le;const[Qe,Me]=((le=Z.current)==null?void 0:le.pointer(je))||[0,0];p(je,{x:Qe,y:Me})}:void 0,fe=b?m.useCallback((je,Qe)=>{const Me=S.getState().nodeLookup.get(Qe).internals.userNode;b(je,Me)},[]):void 0,be=y??D["minimap.ariaLabel"];return o.jsx(NA,{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*U: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:Ss(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:o.jsxs("svg",{width:M,height:j,viewBox:`${B} ${V} ${ce} ${we}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Oe,ref:E,onClick:J,children:[be&&o.jsx("title",{id:Oe,children:be}),o.jsx(PPe,{onClick:fe,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${ce+z*2}v${we+z*2}h${-ce-z*2}z - M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Xse.displayName="MiniMap";m.memo(Xse);const FPe=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,UPe={[Rb.Line]:"right",[Rb.Handle]:"bottom-right"};function zPe({nodeId:e,position:t,variant:n=Rb.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:p=!0,shouldResize:b,onResizeStart:g,onResize:O,onResizeEnd:y}){const v=Ese(),x=typeof e=="string"?e:v,w=Ri(),S=m.useRef(null),E=n===Rb.Handle,k=sr(m.useCallback(FPe(E&&p),[E,p]),ji),T=m.useRef(null),C=t??UPe[n];m.useEffect(()=>{if(!(!S.current||!x))return T.current||(T.current=YIe({domNode:S.current,nodeId:x,getStoreItems:()=>{const{nodeLookup:_,transform:R,snapGrid:$,snapToGrid:D,nodeOrigin:M,domNode:j}=w.getState();return{nodeLookup:_,transform:R,snapGrid:$,snapToGrid:D,nodeOrigin:M,paneDomNode:j}},onChange:(_,R)=>{const{triggerNodeChanges:$,nodeLookup:D,parentLookup:M,nodeOrigin:j}=w.getState(),P=[],L={x:_.x,y:_.y},U=D.get(x);if(U&&U.expandParent&&U.parentId){const F=U.origin??j,q=_.width??U.measured.width??0,z=_.height??U.measured.height??0,B={id:U.id,parentId:U.parentId,rect:{width:q,height:z,...zie({x:_.x??U.position.x,y:_.y??U.position.y},{width:q,height:z},U.parentId,D,F)}},V=Q6([B],D,M,j);P.push(...V),L.x=_.x?Math.max(F[0]*q,_.x):void 0,L.y=_.y?Math.max(F[1]*z,_.y):void 0}if(L.x!==void 0&&L.y!==void 0){const F={id:x,type:"position",position:{...L}};P.push(F)}if(_.width!==void 0&&_.height!==void 0){const q={id:x,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:_.width,height:_.height}};P.push(q)}for(const F of R){const q={...F,type:"position"};P.push(q)}$(P)},onEnd:({width:_,height:R})=>{const $={id:x,type:"dimensions",resizing:!1,dimensions:{width:_,height:R}};w.getState().triggerNodeChanges([$])}})),T.current.update({controlPosition:C,boundaries:{minWidth:l,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:g,onResize:O,onResizeEnd:y,shouldResize:b}),()=>{var _;(_=T.current)==null||_.destroy()}},[C,l,c,u,d,f,g,O,y,b]);const N=C.split("-");return o.jsx("div",{className:Ss(["react-flow__resize-control","nodrag",...N,n,r]),ref:S,style:{...i,scale:k,...a&&{[E?"backgroundColor":"borderColor"]:a}},children:s})}m.memo(zPe);var Gse=Object.defineProperty,VPe=(e,t,n)=>t in e?Gse(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,qPe=(e,t)=>{for(var n in t)Gse(e,n,{get:t[n],enumerable:!0})},HPe=(e,t,n)=>VPe(e,t+"",n),Yse={};qPe(Yse,{Graph:()=>Hl,alg:()=>U6,json:()=>Zse,version:()=>YPe});var XPe=Object.defineProperty,Wse=(e,t)=>{for(var n in t)XPe(e,n,{get:t[n],enumerable:!0})},Hl=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=t1(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=GPe(this._isDirected,s,a,l);return s=f.v,a=f.w,Object.freeze(f),this._edgeObjs[d]=f,fz(this._preds[a],s),fz(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?Zj(this._isDirected,t):t1(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?Zj(this._isDirected,t):t1(this._isDirected,t,n,r))in this._edgeLabels}removeEdge(t,n,r){let i=arguments.length===1?Zj(this._isDirected,t):t1(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],hz(this._preds[l],a),hz(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 fz(e,t){e[t]?e[t]++:e[t]=1}function hz(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function t1(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 GPe(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 Zj(e,t){return t1(e,t.v,t.w,t.name)}var YPe="4.0.1",Zse={};Wse(Zse,{read:()=>JPe,write:()=>WPe});function WPe(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:ZPe(e),edges:KPe(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function ZPe(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 KPe(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 JPe(e){let t=new Hl(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 U6={};Wse(U6,{CycleException:()=>y2,bellmanFord:()=>Kse,components:()=>nMe,dijkstra:()=>O2,dijkstraAll:()=>sMe,findCycles:()=>aMe,floydWarshall:()=>lMe,isAcyclic:()=>uMe,postorder:()=>fMe,preorder:()=>hMe,prim:()=>pMe,shortestPaths:()=>mMe,tarjan:()=>eae,topsort:()=>tae});var eMe=()=>1;function Kse(e,t,n,r){return tMe(e,String(t),n||eMe,r||function(i){return e.outEdges(i)})}function tMe(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 O2(e,t,n,r){let i=function(s){return e.outEdges(s)};return iMe(e,String(t),n||rMe,r||i)}function iMe(e,t,n,r){let i={},s=new Jse,a,l,c=function(u){let d=u.v!==a?u.v:u.w,f=i[d],h=n(u),p=l.distance+h;if(h<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+h);p0&&(a=s.removeMin(),l=i[a],l.distance!==Number.POSITIVE_INFINITY);)r(a).forEach(c);return i}function sMe(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=O2(e,i,t,n),r},{})}function eae(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 aMe(e){return eae(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var oMe=()=>1;function lMe(e,t,n){return cMe(e,t||oMe,n||function(r){return e.outEdges(r)})}function cMe(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],p=d.distance+f.distance;p{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=nae(e,l,n==="post",a,s,r,i)}),i}function nae(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=nae(e,l,n,r,i,s,a)}),n&&(a=s(a,t))),a}function rae(e,t,n){return dMe(e,t,n,function(r,i){return r.push(i),r},[])}function fMe(e,t){return rae(e,t,"post")}function hMe(e,t){return rae(e,t,"pre")}function pMe(e,t){let n=new Hl,r={},i=new Jse,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 mMe(e,t,n,r){return gMe(e,t,n,r??(i=>{let s=e.outEdges(i);return s??[]}))}function gMe(e,t,n,r){if(n===void 0)return O2(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 iae(e){let t=new Hl({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 pz(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 sw(e){let t=Fx(aae(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 OMe(e){let t=e.nodes().map(r=>{let i=e.node(r).rank;return i===void 0?Number.MAX_VALUE:i}),n=fu(Math.min,t);e.nodes().forEach(r=>{let i=e.node(r);Object.hasOwn(i,"rank")&&(i.rank-=n)})}function yMe(e){let t=e.nodes().map(a=>e.node(a).rank).filter(a=>a!==void 0),n=fu(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 mz(e,t,n,r){let i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),yO(e,"border",i,t)}function xMe(e,t=sae){let n=[];for(let r=0;rsae){let n=xMe(t);return e(...n.map(r=>e(...r)))}else return e(...t)}function aae(e){let t=e.nodes().map(n=>{let r=e.node(n).rank;return r===void 0?Number.MIN_VALUE:r});return fu(Math.max,t)}function vMe(e,t){let n={lhs:[],rhs:[]};return e.forEach(r=>{t(r)?n.lhs.push(r):n.rhs.push(r)}),n}function oae(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function lae(e,t){return t()}var wMe=0;function z6(e){let t=++wMe;return e+(""+t)}function Fx(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 SMe(e,t){return e.reduce((n,r,i)=>(n[r]=t[i],n),{})}var DA="\0",EMe="3.0.0",kMe=class{constructor(){HPe(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return gz(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&gz(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,TMe)),n=n._prev;return"["+e.join(", ")+"]"}};function gz(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function TMe(e,t){if(e!=="_next"&&e!=="_prev")return t}var _Me=kMe,AMe=()=>1;function CMe(e,t){if(e.nodeCount()<=1)return[];let n=jMe(e,t||AMe);return NMe(n.graph,n.buckets,n.zeroIdx).flatMap(r=>e.outEdges(r.v,r.w)||[])}function NMe(e,t,n){var r;let i=[],s=t[t.length-1],a=t[0],l;for(;e.nodeCount();){for(;l=a.dequeue();)Kj(e,t,n,l);for(;l=s.dequeue();)Kj(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(Kj(e,t,n,l,!0)||[]);break}}}return i}function Kj(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,DP(t,n,u)}),(e.outEdges(r.v)||[]).forEach(l=>{let c=e.edge(l),u=l.w,d=e.node(u);d.in-=c,DP(t,n,d)}),e.removeNode(r.v),a}function jMe(e,t){let n=new Hl,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=RMe(i+r+3).map(()=>new _Me),a=r+1;return n.nodes().forEach(l=>{DP(s,a,n.node(l))}),{graph:n,buckets:s,zeroIdx:a}}function DP(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 RMe(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,z6("rev"))});function t(n){return r=>n.edge(r).weight}}function DMe(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 PMe(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 MMe(e){e.graph().dummyChains=[],e.edges().forEach(t=>LMe(e,t))}function LMe(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 V6(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=fu(Math.min,a);return l===Number.POSITIVE_INFINITY&&(l=0),i.rank=l}e.sources().forEach(n)}function Db(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var cae=BMe;function BMe(e){let t=new Hl({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(;QMe(t,e){let a=s.v,l=r===a?s.w:a;!e.hasNode(l)&&!Db(t,s)&&(e.setNode(l,{}),e.setEdge(r,l,{}),n(l))})}return e.nodes().forEach(n),e.nodeCount()}function FMe(e,t){return t.edges().reduce((n,r)=>{let i=Number.POSITIVE_INFINITY;return e.hasNode(r.v)!==e.hasNode(r.w)&&(i=Db(t,r)),it.node(r).rank+=n)}var{preorder:zMe,postorder:VMe}=U6,qMe=Hm;Hm.initLowLimValues=H6;Hm.initCutValues=q6;Hm.calcCutValue=uae;Hm.leaveEdge=fae;Hm.enterEdge=hae;Hm.exchangeEdges=pae;function Hm(e){e=bMe(e),V6(e);let t=cae(e);H6(t),q6(t,e);let n,r;for(;n=fae(t);)r=hae(t,e,n),pae(t,e,n,r)}function q6(e,t){let n=VMe(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(r=>HMe(e,t,r))}function HMe(e,t,n){let r=e.node(n).parent,i=e.edge(n,r);i.cutvalue=uae(e,t,n)}function uae(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,GMe(e,n,d)){let p=e.edge(n,d).cutvalue;a+=f?-p:p}}}),a}function H6(e,t){arguments.length<2&&(t=e.nodes()[0]),dae(e,{},1,t)}function dae(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=dae(e,t,n,c,r))}),a.low=s,a.lim=n++,i?a.parent=i:delete a.parent,n}function fae(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function hae(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===bz(e,e.node(u.v),l)&&c!==bz(e,e.node(u.w),l)).reduce((u,d)=>Db(t,d)!e.node(i).parent);if(!n)return;let r=zMe(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 GMe(e,t,n){return e.hasEdge(t,n)}function bz(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var YMe=WMe;function WMe(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":Oz(e);break;case"tight-tree":KMe(e);break;case"longest-path":ZMe(e);break;case"none":break;default:Oz(e)}}var ZMe=V6;function KMe(e){V6(e),cae(e)}function Oz(e){qMe(e)}var JMe=e3e;function e3e(e){let t=n3e(e);e.graph().dummyChains.forEach(n=>{let r=e.node(n),i=r.edgeObj,s=t3e(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 n3e(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(DA).forEach(r),t}function r3e(e){let t=yO(e,"root",{},"_root"),n=i3e(e),r=Object.values(n),i=fu(Math.max,r)-1,s=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(l=>e.edge(l).minlen*=s);let a=s3e(e)+1;e.children(DA).forEach(l=>mae(e,t,s,a,i,n,l)),e.graph().nodeRankFactor=s}function mae(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=mz(e,"_bt"),d=mz(e,"_bb"),f=e.node(a);e.setParent(u,a),f.borderTop=u,e.setParent(d,a),f.borderBottom=d,c.forEach(h=>{var p;mae(e,t,n,r,i,s,h);let b=e.node(h),g=b.borderTop?b.borderTop:h,O=b.borderBottom?b.borderBottom:h,y=b.borderTop?r:2*r,v=g!==O?1:i-((p=s[a])!=null?p:0)+1;e.setEdge(u,g,{weight:y,minlen:v,nestingEdge:!0}),e.setEdge(O,d,{weight:y,minlen:v,nestingEdge:!0})}),e.parent(a)||e.setEdge(t,u,{weight:0,minlen:i+((l=s[a])!=null?l:0)})}function i3e(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(DA).forEach(r=>n(r,1)),t}function s3e(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function a3e(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var o3e=l3e;function l3e(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;sxz(e.node(t))),e.edges().forEach(t=>xz(e.edge(t)))}function xz(e){let t=e.width;e.width=e.height,e.height=t}function d3e(e){e.nodes().forEach(t=>Jj(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(Jj),Object.hasOwn(r,"y")&&Jj(r)})}function Jj(e){e.y=-e.y}function f3e(e){e.nodes().forEach(t=>eR(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(eR),Object.hasOwn(r,"x")&&eR(r)})}function eR(e){let t=e.x;e.x=e.y,e.y=t}function h3e(e){let t={},n=e.nodes().filter(l=>!e.children(l).length),r=n.map(l=>e.node(l).rank),i=fu(Math.max,r),s=Fx(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 p3e(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 g3e(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 b3e(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 O3e(r)}function O3e(e){let t=[];function n(i){return s=>{s.merged||(s.barycenter===void 0||i.barycenter===void 0||s.barycenter>=i.barycenter)&&y3e(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=>x2(i,["vs","i","barycenter","weight"]))}function y3e(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 x3e(e,t){let n=vMe(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(v3e(!!t)),c=vz(s,i,c),r.forEach(d=>{c+=d.vs.length,s.push(d.vs),a+=d.barycenter*d.weight,l+=d.weight,c=vz(s,i,c)});let u={vs:s.flat(1)};return l&&(u.barycenter=a/l,u.weight=l),u}function vz(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 v3e(e){return(t,n)=>t.barycentern.barycenter?1:e?n.i-t.i:t.i-n.i}function bae(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=g3e(e,i);u.forEach(h=>{if(e.children(h.v).length){let p=bae(e,h.v,n,r);c[h.v]=p,Object.hasOwn(p,"barycenter")&&S3e(h,p)}});let d=b3e(u,n);w3e(d,c);let f=x3e(d,r);if(a&&l){f.vs=[a,f.vs,l].flat(1);let h=e.predecessors(a);if(h&&h.length){let p=e.node(h[0]),b=e.predecessors(l),g=e.node(b[0]);Object.hasOwn(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+p.order+g.order)/(f.weight+2),f.weight+=2}}return f}function w3e(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(r=>t[r]?t[r].vs:r)})}function S3e(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 E3e(e,t,n,r){r||(r=e.nodes());let i=k3e(e),s=new Hl({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),p=h!==void 0?h.weight:0;s.setEdge(f,a,{weight:e.edge(d).weight+p})}),Object.hasOwn(l,"minRank")&&s.setNode(a,{borderLeft:l.borderLeft[t],borderRight:l.borderRight[t]})}}),s}function k3e(e){let t;for(;e.hasNode(t=z6("_root")););return t}function T3e(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 Oae(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,Oae);return}let n=aae(e),r=wz(e,Fx(1,n+1),"inEdges"),i=wz(e,Fx(n-1,-1,-1),"outEdges"),s=h3e(e);if(Sz(e,s),t.disableOptimalOrderHeuristic)return;let a=Number.POSITIVE_INFINITY,l,c=t.constraints||[];for(let u=0,d=0;d<4;++u,++d){_3e(u%2?r:i,u%4>=2,c),s=sw(e);let f=p3e(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 E3e(e,s,n,r.get(s)||[])})}function _3e(e,t,n){let r=new Hl;e.forEach(function(i){n.forEach(l=>r.setEdge(l.left,l.right));let s=i.graph().root,a=bae(i,s,r,t);a.vs.forEach((l,c)=>i.node(l).order=c),T3e(i,r,a.vs)})}function Sz(e,t){Object.values(t).forEach(n=>n.forEach((r,i)=>e.node(r).order=i))}function A3e(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=N3e(e,d),p=h?e.node(h).order:c;(h||d===u)&&(s.slice(l,f+1).forEach(b=>{let g=e.predecessors(b);g&&g.forEach(O=>{let y=e.node(O),v=y.order;(v{let f=s[d];if(f!==void 0&&e.node(f).dummy){let h=e.predecessors(f);h&&h.forEach(p=>{if(p===void 0)return;let b=e.node(p);b.dummy&&(b.orderu)&&yae(n,p,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 p=h[0];if(p===void 0)return;c=e.node(p).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 N3e(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(r=>e.node(r).dummy)}}function yae(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 j3e(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 R3e(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((p,b)=>{let g=a[p],O=a[b];return(g!==void 0?g:0)-(O!==void 0?O:0)}),h=(f.length-1)/2;for(let p=Math.floor(h),b=Math.ceil(h);p<=b;++p){let g=f[p];if(g===void 0)continue;let O=a[g];if(O!==void 0&&s[u]===u&&c{var y;let v=(y=s[O.v])!=null?y:0,x=a.edge(O);return Math.max(g,v+(x!==void 0?x:0))},0):s[p]=0}function d(p){let b=a.outEdges(p),g=Number.POSITIVE_INFINITY;b&&(g=b.reduce((y,v)=>{let x=s[v.w],w=a.edge(v);return Math.min(y,(x!==void 0?x:0)-(w!==void 0?w:0))},Number.POSITIVE_INFINITY));let O=e.node(p);g!==Number.POSITIVE_INFINITY&&O.borderType!==l&&(s[p]=Math.max(s[p]!==void 0?s[p]:0,g))}function f(p){return a.predecessors(p)||[]}function h(p){return a.successors(p)||[]}return c(u,f),c(d,h),Object.keys(r).forEach(p=>{var b;let g=n[p];g!==void 0&&(s[p]=(b=s[g])!=null?b:0)}),s}function D3e(e,t,n,r){let i=new Hl,s=e.graph(),a=B3e(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 P3e(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=Q3e(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-fu(Math.min,u);a!=="l"&&(d=i-fu(Math.max,u)),d&&(e[l]=IA(c,f=>f+d))})})}function L3e(e,t=void 0){let n=e.ul;return n?IA(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 $3e(e){let t=sw(e),n=Object.assign(A3e(e,t),C3e(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=R3e(e,i,n,d=>(a==="u"?e.predecessors(d):e.successors(d))||[]),u=I3e(e,i,c.root,c.align,l==="r");l==="r"&&(u=IA(u,d=>-d)),r[a+l]=u})});let s=P3e(e,r);return M3e(r,s),L3e(r,e.graph().align)}function B3e(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 Q3e(e,t){return e.node(t).width}function F3e(e){e=iae(e),U3e(e),Object.entries($3e(e)).forEach(([t,n])=>e.node(t).x=n)}function U3e(e){let t=sw(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 z3e(e,t={}){let n=t.debugTiming?oae:lae;return n("layout",()=>{let r=n(" buildLayoutGraph",()=>J3e(e));return n(" runLayout",()=>V3e(r,n,t)),n(" updateInputGraph",()=>q3e(e,r)),r})}function V3e(e,t,n){t(" makeSpaceForEdgeLabels",()=>eLe(e)),t(" removeSelfEdges",()=>cLe(e)),t(" acyclic",()=>IMe(e)),t(" nestingGraph.run",()=>r3e(e)),t(" rank",()=>YMe(iae(e))),t(" injectEdgeLabelProxies",()=>tLe(e)),t(" removeEmptyRanks",()=>yMe(e)),t(" nestingGraph.cleanup",()=>a3e(e)),t(" normalizeRanks",()=>OMe(e)),t(" assignRankMinMax",()=>nLe(e)),t(" removeEdgeLabelProxies",()=>rLe(e)),t(" normalize.run",()=>MMe(e)),t(" parentDummyChains",()=>JMe(e)),t(" addBorderSegments",()=>o3e(e)),t(" order",()=>Oae(e,n)),t(" insertSelfEdges",()=>uLe(e)),t(" adjustCoordinateSystem",()=>c3e(e)),t(" position",()=>F3e(e)),t(" positionSelfEdges",()=>dLe(e)),t(" removeBorderNodes",()=>lLe(e)),t(" normalize.undo",()=>$Me(e)),t(" fixupEdgeLabelCoords",()=>aLe(e)),t(" undoCoordinateSystem",()=>u3e(e)),t(" translateGraph",()=>iLe(e)),t(" assignNodeIntersects",()=>sLe(e)),t(" reversePoints",()=>oLe(e)),t(" acyclic.undo",()=>PMe(e))}function q3e(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 H3e=["nodesep","edgesep","ranksep","marginx","marginy"],X3e={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},G3e=["acyclicer","ranker","rankdir","align","rankalign"],Y3e=["width","height","rank"],Ez={width:0,height:0},W3e=["minlen","weight","width","height","labeloffset"],Z3e={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},K3e=["labelpos"];function J3e(e){let t=new Hl({multigraph:!0,compound:!0}),n=nR(e.graph());return t.setGraph(Object.assign({},X3e,tR(n,H3e),x2(n,G3e))),e.nodes().forEach(r=>{let i=nR(e.node(r)),s=tR(i,Y3e);Object.keys(Ez).forEach(l=>{s[l]===void 0&&(s[l]=Ez[l])}),t.setNode(r,s);let a=e.parent(r);a!==void 0&&t.setParent(r,a)}),e.edges().forEach(r=>{let i=nR(e.edge(r));t.setEdge(r,Object.assign({},Z3e,tR(i,W3e),x2(i,K3e)))}),t}function eLe(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 tLe(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};yO(e,"edge-proxy",i,"_ep")}})}function nLe(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 rLe(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 iLe(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,p=u.height;t=Math.min(t,d-h/2),n=Math.max(n,d+h/2),r=Math.min(r,f-p/2),i=Math.max(i,f+p/2)}e.nodes().forEach(u=>c(e.node(u))),e.edges().forEach(u=>{let d=e.edge(u);Object.hasOwn(d,"x")&&c(d)}),t-=a,r-=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 sLe(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(pz(r,s)),n.points.push(pz(i,a))})}function aLe(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 oLe(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function lLe(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 cLe(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 uLe(e){sw(e).forEach(t=>{let n=0;t.forEach((r,i)=>{let s=e.node(r);s.order=i+n,(s.selfEdges||[]).forEach(a=>{yO(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 dLe(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 tR(e,t){return IA(x2(e,t),Number)}function nR(e){let t={};return e&&Object.entries(e).forEach(([n,r])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=r}),t}function fLe(e){let t=sw(e),n=new Hl({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 hLe={graphlib:Yse,version:EMe,layout:z3e,debug:fLe,util:{time:oae,notime:lae}},kz=hLe;/*! For license information please see dagre.esm.js.LEGAL.txt */const n1={llm:{label:"智能体",description:"理解任务并直接完成一个具体工作",icon:_ne},sequential:{label:"分步协作",description:"内部步骤按照顺序依次执行",icon:W2e},parallel:{label:"同时处理",description:"内部步骤同时工作,完成后统一汇总",icon:D2e},loop:{label:"循环执行",description:"重复执行内部步骤,直到满足停止条件",icon:Pne},a2a:{label:"远程智能体",description:"调用已经存在的远程 Agent",icon:uA}},PP=220,MP=88,Tz=96,_z=34,$1=64,rR=310,v0=24,xae=56,LP=40,Az=40,pLe=18,mLe=58,gLe=!1,bLe=e=>e==="sequential"||e==="parallel"||e==="loop";function $P(e,t){const n=e.agentType??"llm";return bLe(n)||n==="llm"&&(t.length===0||e.subAgents.length>0)}function BP(e,t=[],n="horizontal",r=!1){const i=e.agentType??"llm";if(!$P(e,t))return{width:PP,height:MP};if(r&&e.subAgents.length===0)return{width:rR,height:$1};const s=e.subAgents.map((f,h)=>BP(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"?xae:v0,u=n==="horizontal"?i!=="parallel":i==="parallel",d=s.length?i==="parallel"?pLe+Az:i==="loop"?mLe:0:Az;return u?{width:Math.max(rR,s.reduce((f,h)=>f+h.width,0)+LP*Math.max(0,s.length-1)+c*2),height:$1+v0+l+d+v0}:{width:Math.max(rR,a+v0*2),height:$1+c+s.reduce((f,h)=>f+h.height,0)+LP*Math.max(0,s.length-1)+d+c}}function yy(e){return e.length===0?"agent-root":`agent-${e.join("-")}`}function OLe(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function Cz(e){const t=n=>[n.agentType??"llm",n.subAgents.map(t)];return JSON.stringify(t(e))}function xy(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:Lx.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 Nz(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,p,b){const g=d.agentType??"llm",O=yy(f);return $P(d,f)?(a(d,f,h,p,b),O):(r.push({id:O,type:"agent",parentId:h,extent:"parent",position:p,data:{kind:"agent",path:f,agent:d,title:g==="a2a"?"远程智能体":d.name.trim()||(f.length===0?"主 Agent":"未命名步骤"),pattern:g,description:d.description.trim()||n1[g].description,childCount:d.subAgents.length,containedIn:b}}),O)}function a(d,f,h,p={x:0,y:0},b){const g=d.agentType??"sequential",O=yy(f),y=BP(d,f,t,n);r.push({id:O,type:"group",parentId:h,extent:h?"parent":void 0,position:p,style:{width:y.width,height:y.height},data:{kind:"agent",path:f,agent:d,title:d.name.trim()||(f.length===0?"主 Agent":n1[g].label),pattern:g,description:d.description.trim()||n1[g].description,childCount:d.subAgents.length,containedIn:b,layoutWidth:y.width,layoutHeight:y.height,compactEmptyGroup:n&&d.subAgents.length===0}});const v=d.subAgents.map((k,T)=>BP(k,[...f,T],t,n)),x=v.length&&g!=="parallel"?xae:v0,w=t==="horizontal"?g!=="parallel":g==="parallel";let S=x;const E=d.subAgents.map((k,T)=>{const C=v[T],N=w?{x:S,y:$1+v0}:{x:(y.width-C.width)/2,y:$1+S};return S+=(w?C.width:C.height)+LP,s(k,[...f,T],O,N,g)});if(g==="sequential"||g==="loop"){for(let k=0;k1&&i.push(xy(E[E.length-1],E[0],"继续循环",{loop:!0,tone:"loop"}))}return O}const l=(d,f)=>{const h=d.agentType??"llm",p=yy(f);if($P(d,f))return a(d,f),[p];if(r.push({id:p,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()||n1[h].description,childCount:d.subAgents.length}}),d.subAgents.length===0)return[p];const b=[];return d.subAgents.forEach((g,O)=>{const y=[...f,O],v=yy(y);i.push(xy(p,v,"调用",{insert:{parentPath:f,index:O}})),b.push(...l(g,y))}),b},c=yy([]),u=l(e,[]);return i.push(xy("terminal-input",c)),u.forEach(d=>i.push(xy(d,"terminal-output"))),yLe(r,i,t)}function yLe(e,t,n){const r=new kz.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?Tz:s.data.layoutWidth??PP,height:a?_z:s.data.layoutHeight??MP})}),t.filter(s=>i.has(s.source)&&i.has(s.target)).forEach(s=>r.setEdge(s.source,s.target)),kz.layout(r),{nodes:e.map(s=>{if(s.parentId)return s;const a=r.node(s.id),l=s.data.kind==="terminal",c=l?Tz:s.data.layoutWidth??PP,u=l?_z:s.data.layoutHeight??MP;return{...s,position:{x:a.x-c/2,y:a.y-u/2}}}),edges:t}}const PA=m.createContext(null),MA=m.createContext("horizontal");function xLe({id:e,sourceX:t,sourceY:n,targetX:r,targetY:i,sourcePosition:s,targetPosition:a,markerEnd:l,style:c,label:u,data:d}){const f=m.useContext(PA),[h,p]=m.useState(!1),[b,g,O]=g2({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(iw,{id:e,path:b,markerEnd:l,style:c}),f&&(d==null?void 0:d.insert)&&o.jsx("path",{d:b,className:"abc-edge-hover-path",onPointerEnter:()=>p(!0),onPointerLeave:()=>p(!1)}),(u||f&&(d==null?void 0:d.insert))&&o.jsx(fPe,{children:o.jsxs("div",{className:`abc-edge-tools${f&&(d!=null&&d.insert)?" can-insert":""}${h?" is-visible":""}`,style:{transform:`translate(-50%, -50%) translate(${g}px, ${O}px)`},onPointerEnter:()=>p(!0),onPointerLeave:()=>p(!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:y=>{y.stopPropagation(),f==null||f.onInsert(d.insert.parentPath,d.insert.index)},children:o.jsx(qa,{})})]})})]})}function vLe({data:e,selected:t}){const n=m.useContext(PA),r=m.useContext(MA),i=r==="vertical"?Nt.Top:Nt.Left,s=r==="vertical"?Nt.Bottom:Nt.Right,a=r==="vertical"?Nt.Right:Nt.Bottom,l=e.pattern??"llm",c=n1[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(Rh,{})}),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 wLe({data:e,selected:t}){const n=m.useContext(PA),r=m.useContext(MA),i=r==="vertical"?Nt.Top:Nt.Left,s=r==="vertical"?Nt.Bottom:Nt.Right,a=r==="vertical"?Nt.Right:Nt.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(qa,{})}),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(qa,{})})]}),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(qa,{}),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(qa,{}),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(Rh,{})}),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 SLe({data:e}){const t=m.useContext(MA);return o.jsxs("div",{className:"abc-terminal",children:[o.jsx(ho,{type:"target",position:t==="vertical"?Nt.Top:Nt.Left,className:"abc-handle"}),o.jsx("span",{children:e.title}),o.jsx(ho,{type:"source",position:t==="vertical"?Nt.Bottom:Nt.Right,className:"abc-handle"})]})}const ELe={agent:vLe,group:wLe,terminal:SLe},kLe={insertStep:xLe};function TLe({draft:e,selectedPath:t,onSelect:n,onAdd:r,onInsert:i,onDelete:s,readOnly:a=!1,interactivePreview:l=!1,direction:c="horizontal"}){const u=m.useMemo(()=>Nz(e,c,a),[]),[d,f,h]=hPe(u.nodes),[p,b,g]=pPe(u.edges),O=gPe(),y=m.useRef(`${c}:${a?"readonly":"editable"}:${Cz(e)}`),v=m.useRef(null),{fitView:x}=jA(),w=m.useMemo(()=>Nz(e,c,a),[c,e,a]),[S,E]=m.useState(()=>window.matchMedia("(max-width: 860px)").matches),k=m.useMemo(()=>a?{padding:.16,minZoom:.05,maxZoom:.9}:S?{padding:.08,minZoom:.35,maxZoom:.9}:{padding:.14,minZoom:.42,maxZoom:1.1},[S,a]),T=m.useCallback((N=0)=>{window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{const _=v.current;if(_&&(_.clientWidth===0||_.clientHeight===0)&&N<8){T(N+1);return}x(k)})})},[k,x]);m.useEffect(()=>{const N=window.matchMedia("(max-width: 860px)"),_=R=>E(R.matches);return N.addEventListener("change",_),()=>N.removeEventListener("change",_)},[]),m.useEffect(()=>{const N=`${c}:${a?"readonly":"editable"}:${Cz(e)}`,_=N!==y.current;y.current=N,b(w.edges),f(R=>{const $=new Map(R.map(D=>[D.id,D]));return w.nodes.map(D=>{const M=$.get(D.id);return{...D,measured:!_&&M&&M.type===D.type?M.measured:void 0,position:!_&&M?M.position:D.position,selected:D.data.kind==="agent"&&!!D.data.path&&OLe(D.data.path,t)}})}),_&&T()},[w,e,T,t,b,f]),m.useEffect(()=>{T()},[S,T]),m.useEffect(()=>{O&&T()},[w,T,O]),m.useEffect(()=>{if(!a||!v.current)return;const N=new ResizeObserver(()=>T());return N.observe(v.current),T(),()=>N.disconnect()},[T,a]);const C=m.useMemo(()=>a?null:{onAdd:r,onInsert:i,onDelete:s},[r,s,i,a]);return o.jsx(MA.Provider,{value:c,children:o.jsx(PA.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(uPe,{nodes:d,edges:p,nodeTypes:ELe,edgeTypes:kLe,onNodesChange:h,onEdgesChange:g,onNodeClick:(N,_)=>{!a&&_.data.kind==="agent"&&_.data.path&&n(_.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:()=>T(),minZoom:a?.05:.35,maxZoom:1.6,proOptions:{hideAttribution:!0},children:[o.jsx(vPe,{gap:20,size:1.2,color:"hsl(34 20% 82%)"}),(!a||l)&&o.jsx(APe,{showInteractive:!1}),gLe]})})})})})}function Ux(e){return o.jsx(Vse,{children:o.jsx(TLe,{...e})})}const _Le="https://ark.cn-beijing.volces.com/api/v3/",Mk=[{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:_Le}],v2=[],w2={label:"控制台",url:"https://console.volcengine.com/vikingdb/openviking"},ALe={label:"文档",url:"https://github.com/volcengine/OpenViking/blob/main/docs/zh/api/05-sessions.md"},vae="https://api.vikingdb.cn-beijing.volces.com/openviking",CLe=`{ +`)),d=u.reduce((f,h)=>f.concat(...h),[]);return[u,d]}return[[],[]]},[e]);return m.useEffect(()=>{const c=(t==null?void 0:t.target)??WU,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=p=>{var O,y;if(i.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!i.current||i.current&&!u)&&Xie(p))return!1;const g=KU(p.code,l);if(s.current.add(p[g]),ZU(a,s.current,!1)){const v=((y=(O=p.composedPath)==null?void 0:O.call(p))==null?void 0:y[0])||p.target,x=(v==null?void 0:v.nodeName)==="BUTTON"||(v==null?void 0:v.nodeName)==="A";t.preventDefault!==!1&&(i.current||!x)&&p.preventDefault(),r(!0)}},f=p=>{const b=KU(p.code,l);ZU(a,s.current,!0)?(r(!1),s.current.clear()):s.current.delete(p[b]),p.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 ZU(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function KU(e,t){return t.includes(e)?"code":"key"}const UDe=()=>{const e=Ri();return m.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=P6(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 yO(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=Rb(t,n);return{x:a.x+i,y:a.y+s}}}),[])};function yse(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)zDe(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 zDe(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 xse(e,t){return yse(e,t)}function vse(e,t){return yse(e,t)}function Dp(e,t){return{id:e,type:"select",selected:t}}function v0(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(Dp(s.id,a)))}return r}function JU({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 ez(e){return{id:e.id,type:"remove"}}const VDe=Vie();function qDe(e,t,n={}){return gIe(e,t,{...n,onError:n.onError??VDe})}const tz=e=>tIe(e),HDe=e=>Qie(e);function wse(e){return m.forwardRef(e)}const XDe=typeof window<"u"?m.useLayoutEffect:m.useEffect;function nz(e){const[t,n]=m.useState(BigInt(0)),[r]=m.useState(()=>GDe(()=>n(i=>i+BigInt(1))));return XDe(()=>{const i=r.get();i.length&&(e(i),r.reset())},[t]),r}function GDe(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const Sse=m.createContext(null);function YDe({children:e}){const t=Ri(),n=m.useCallback(l=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:h,fitViewQueued:p,onNodesChangeMiddlewareMap:b}=t.getState();let g=c;for(const y of l)g=typeof y=="function"?y(g):y;let O=JU({items:g,lookup:h});for(const y of b.values())O=y(O);d&&u(g),O.length>0?f==null||f(O):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:y,nodes:v,setNodes:x}=t.getState();y&&x(v)})},[]),r=nz(n),i=m.useCallback(l=>{const{edges:c=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:h}=t.getState();let p=c;for(const b of l)p=typeof b=="function"?b(p):b;d?u(p):f&&f(JU({items:p,lookup:h}))},[]),s=nz(i),a=m.useMemo(()=>({nodeQueue:r,edgeQueue:s}),[]);return o.jsx(Sse.Provider,{value:a,children:e})}function WDe(){const e=m.useContext(Sse);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const ZDe=e=>!!e.panZoom;function IA(){const e=UDe(),t=Ri(),n=WDe(),r=ar(ZDe),i=m.useMemo(()=>{const s=f=>t.getState().nodeLookup.get(f),a=f=>{n.nodeQueue.push(f)},l=f=>{n.edgeQueue.push(f)},c=f=>{var y,v;const{nodeLookup:h,nodeOrigin:p}=t.getState(),b=tz(f)?f:h.get(f.id),g=b.parentId?qie(b.position,b.measured,b.parentId,h,p):b.position,O={...b,position:g,width:((y=b.measured)==null?void 0:y.width)??b.width,height:((v=b.measured)==null?void 0:v.height)??b.height};return jb(O)},u=(f,h,p={replace:!1})=>{a(b=>b.map(g=>{if(g.id===f){const O=typeof h=="function"?h(g):h;return p.replace&&tz(O)?O:{...g,...O}}return g}))},d=(f,h,p={replace:!1})=>{l(b=>b.map(g=>{if(g.id===f){const O=typeof h=="function"?h(g):h;return p.replace&&HDe(O)?O:{...g,...O}}return g}))};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(p=>[...p,...h])},addEdges:f=>{const h=Array.isArray(f)?f:[f];n.edgeQueue.push(p=>[...p,...h])},toObject:()=>{const{nodes:f=[],edges:h=[],transform:p}=t.getState(),[b,g,O]=p;return{nodes:f.map(y=>({...y})),edges:h.map(y=>({...y})),viewport:{x:b,y:g,zoom:O}}},deleteElements:async({nodes:f=[],edges:h=[]})=>{const{nodes:p,edges:b,onNodesDelete:g,onEdgesDelete:O,triggerNodeChanges:y,triggerEdgeChanges:v,onDelete:x,onBeforeDelete:w}=t.getState(),{nodes:S,edges:E}=await aIe({nodesToRemove:f,edgesToRemove:h,nodes:p,edges:b,onBeforeDelete:w}),k=E.length>0,T=S.length>0;if(k){const C=E.map(ez);O==null||O(E),v(C)}if(T){const C=S.map(ez);g==null||g(S),y(C)}return(T||k)&&(x==null||x({nodes:S,edges:E})),{deletedNodes:S,deletedEdges:E}},getIntersectingNodes:(f,h=!0,p)=>{const b=jU(f),g=b?f:c(f),O=p!==void 0;return g?(p||t.getState().nodes).filter(y=>{const v=t.getState().nodeLookup.get(y.id);if(v&&!b&&(y.id===f.id||!v.internals.positionAbsolute))return!1;const x=jb(O?y:v),w=Bx(x,g);return h&&w>0||w>=x.width*x.height||w>=g.width*g.height}):[]},isNodeIntersecting:(f,h,p=!0)=>{const g=jU(f)?f:c(f);if(!g)return!1;const O=Bx(g,h);return p&&O>0||O>=h.width*h.height||O>=g.width*g.height},updateNode:u,updateNodeData:(f,h,p={replace:!1})=>{u(f,b=>{const g=typeof h=="function"?h(b):h;return p.replace?{...b,data:g}:{...b,data:{...b.data,...g}}},p)},updateEdge:d,updateEdgeData:(f,h,p={replace:!1})=>{d(f,b=>{const g=typeof h=="function"?h(b):h;return p.replace?{...b,data:g}:{...b,data:{...b.data,...g}}},p)},getNodesBounds:f=>{const{nodeLookup:h,nodeOrigin:p}=t.getState();return nIe(f,{nodeLookup:h,nodeOrigin:p})},getHandleConnections:({type:f,id:h,nodeId:p})=>{var b;return Array.from(((b=t.getState().connectionLookup.get(`${p}-${f}${h?`-${h}`:""}`))==null?void 0:b.values())??[])},getNodeConnections:({type:f,handleId:h,nodeId:p})=>{var b;return Array.from(((b=t.getState().connectionLookup.get(`${p}${f?h?`-${f}-${h}`:`-${f}`:""}`))==null?void 0:b.values())??[])},fitView:async f=>{const h=t.getState().fitViewResolver??cIe();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:h}),n.nodeQueue.push(p=>[...p]),h.promise}}},[]);return m.useMemo(()=>({...i,...e,viewportInitialized:r}),[r])}const rz=e=>e.selected,KDe=typeof window<"u"?window:void 0;function JDe({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Ri(),{deleteElements:r}=IA(),i=Fx(e,{actInsideInputWithModifier:!1}),s=Fx(t,{target:KDe});m.useEffect(()=>{if(i){const{edges:a,nodes:l}=n.getState();r({nodes:l.filter(rz),edges:a.filter(rz)}),n.setState({nodesSelectionActive:!1})}},[i]),m.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function ePe(e){const t=Ri();m.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=L6(e.current);(r.height===0||r.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",Tc.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 DA={position:"absolute",width:"100%",height:"100%",top:0,left:0},tPe=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function nPe({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:s=dm.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:h,preventScrolling:p=!0,children:b,noWheelClassName:g,noPanClassName:O,onViewportChange:y,isControlledViewport:v,paneClickDistance:x,selectionOnDrag:w}){const S=Ri(),E=m.useRef(null),{userSelectionActive:k,lib:T,connectionInProgress:C}=ar(tPe,ji),N=Fx(h),_=m.useRef();ePe(E);const R=m.useCallback($=>{y==null||y({x:$[0],y:$[1],zoom:$[2]}),v||S.setState({transform:$})},[y,v]);return m.useEffect(()=>{if(E.current){_.current=HIe({domNode:E.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:j=>S.setState(P=>P.paneDragging===j?P:{paneDragging:j}),onPanZoomStart:(j,P)=>{const{onViewportChangeStart:L,onMoveStart:U}=S.getState();U==null||U(j,P),L==null||L(P)},onPanZoom:(j,P)=>{const{onViewportChange:L,onMove:U}=S.getState();U==null||U(j,P),L==null||L(P)},onPanZoomEnd:(j,P)=>{const{onViewportChangeEnd:L,onMoveEnd:U}=S.getState();U==null||U(j,P),L==null||L(P)}});const{x:$,y:D,zoom:M}=_.current.getViewport();return S.setState({panZoom:_.current,transform:[$,D,M],domNode:E.current.closest(".react-flow")}),()=>{var j;(j=_.current)==null||j.destroy()}}},[]),m.useEffect(()=>{var $;($=_.current)==null||$.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:s,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:N,preventScrolling:p,noPanClassName:O,userSelectionActive:k,noWheelClassName:g,lib:T,onTransformChange:R,connectionInProgress:C,selectionOnDrag:w,paneClickDistance:x})},[e,t,n,r,i,s,a,l,N,p,O,k,g,T,R,C,w,x]),o.jsx("div",{className:"react-flow__renderer",ref:E,style:DA,children:b})}const rPe=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function iPe(){const{userSelectionActive:e,userSelectionRect:t}=ar(rPe,ji);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 Zj=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},sPe=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function aPe({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Lx.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:s,selectionOnDrag:a,onSelectionStart:l,onSelectionEnd:c,onPaneClick:u,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:h,onPaneMouseMove:p,onPaneMouseLeave:b,children:g}){const O=m.useRef(0),y=Ri(),{userSelectionActive:v,elementsSelectable:x,dragging:w,connectionInProgress:S,panBy:E,autoPanSpeed:k}=ar(sPe,ji),T=x&&(e||v),C=m.useRef(null),N=m.useRef(),_=m.useRef(new Set),R=m.useRef(new Set),$=m.useRef(!1),D=m.useRef({x:0,y:0}),M=m.useRef(!1),j=de=>{if($.current||S){$.current=!1;return}u==null||u(de),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1})},P=de=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){de.preventDefault();return}d==null||d(de)},L=f?de=>f(de):void 0,U=de=>{$.current&&(de.stopPropagation(),$.current=!1)},F=de=>{var ke,ye;const{domNode:Z,transform:J}=y.getState();if(N.current=Z==null?void 0:Z.getBoundingClientRect(),!N.current)return;const fe=de.target===C.current;if(!fe&&!!de.target.closest(".nokey")||!e||!(a&&fe||t)||de.button!==0||!de.isPrimary)return;(ye=(ke=de.target)==null?void 0:ke.setPointerCapture)==null||ye.call(ke,de.pointerId),$.current=!1;const{x:Qe,y:Me}=Oc(de.nativeEvent,N.current),le=yO({x:Qe,y:Me},J);y.setState({userSelectionRect:{width:0,height:0,startX:le.x,startY:le.y,x:Qe,y:Me}}),fe||(de.stopPropagation(),de.preventDefault())};function q(de,Z){const{userSelectionRect:J}=y.getState();if(!J)return;const{transform:fe,nodeLookup:be,edgeLookup:je,connectionLookup:Qe,triggerNodeChanges:Me,triggerEdgeChanges:le,defaultEdgeOptions:ke}=y.getState(),ye={x:J.startX,y:J.startY},{x:$e,y:ze}=Rb(ye,fe),Ae={startX:ye.x,startY:ye.y,x:de<$e?de:$e,y:ZWe.id)),R.current=new Set;const Tt=(ke==null?void 0:ke.selectable)??!0;for(const We of _.current){const W=Qe.get(We);if(W)for(const{edgeId:ne}of W.values()){const he=je.get(ne);he&&(he.selectable??Tt)&&R.current.add(ne)}}if(!RU(Ve,_.current)){const We=v0(be,_.current,!0);Me(We)}if(!RU(ut,R.current)){const We=v0(je,R.current);le(We)}y.setState({userSelectionRect:Ae,userSelectionActive:!0,nodesSelectionActive:!1})}function z(){if(!i||!N.current)return;const[de,Z]=D6(D.current,N.current,k);E({x:de,y:Z}).then(J=>{if(!$.current||!J){O.current=requestAnimationFrame(z);return}const{x:fe,y:be}=D.current;q(fe,be),O.current=requestAnimationFrame(z)})}const B=()=>{cancelAnimationFrame(O.current),O.current=0,M.current=!1};m.useEffect(()=>()=>B(),[]);const V=de=>{const{userSelectionRect:Z,transform:J,resetSelectedElements:fe}=y.getState();if(!N.current||!Z)return;const{x:be,y:je}=Oc(de.nativeEvent,N.current);D.current={x:be,y:je};const Qe=Rb({x:Z.startX,y:Z.startY},J);if(!$.current){const Me=t?0:s;if(Math.hypot(be-Qe.x,je-Qe.y)<=Me)return;fe(),l==null||l(de)}$.current=!0,M.current||(z(),M.current=!0),q(be,je)},ce=de=>{var Z,J;de.button===0&&((J=(Z=de.target)==null?void 0:Z.releasePointerCapture)==null||J.call(Z,de.pointerId),!v&&de.target===C.current&&y.getState().userSelectionRect&&(j==null||j(de)),y.setState({userSelectionActive:!1,userSelectionRect:null}),$.current&&(c==null||c(de),y.setState({nodesSelectionActive:_.current.size>0})),B())},we=de=>{var Z,J;(J=(Z=de.target)==null?void 0:Z.releasePointerCapture)==null||J.call(Z,de.pointerId),B()},Oe=r===!0||Array.isArray(r)&&r.includes(0);return o.jsxs("div",{className:Ss(["react-flow__pane",{draggable:Oe,dragging:w,selection:e}]),onClick:T?void 0:Zj(j,C),onContextMenu:Zj(P,C),onWheel:Zj(L,C),onPointerEnter:T?void 0:h,onPointerMove:T?V:p,onPointerUp:T?ce:void 0,onPointerCancel:T?we:void 0,onPointerDownCapture:T?F:void 0,onClickCapture:T?U:void 0,onPointerLeave:b,ref:C,style:DA,children:[g,o.jsx(iPe,{})]})}function P5({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",Tc.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 Ese({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:s,nodeClickDistance:a}){const l=Ri(),[c,u]=m.useState(!1),d=m.useRef();return m.useEffect(()=>{d.current=RIe({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{P5({id:f,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),m.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 oPe=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function kse(){const e=Ri();return m.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=oPe(a),p=i?s[0]:5,b=i?s[1]:5,g=n.direction.x*p*n.factor,O=n.direction.y*b*n.factor;for(const[,y]of u){if(!h(y))continue;let v={x:y.internals.positionAbsolute.x+g,y:y.internals.positionAbsolute.y+O};i&&(v=iw(v,s));const{position:x,positionAbsolute:w}=Fie({nodeId:y.id,nextPosition:v,nodeLookup:u,nodeExtent:r,nodeOrigin:d,onError:l});y.position=x,y.internals.positionAbsolute=w,f.set(y.id,y)}c(f)},[])}const z6=m.createContext(null),lPe=z6.Provider;z6.Consumer;const Tse=()=>m.useContext(z6),cPe=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),uPe=(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===Cb.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 dPe({type:e="source",position:t=Nt.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},p){var M,j;const b=a||null,g=e==="target",O=Ri(),y=Tse(),{connectOnClick:v,noPanClassName:x,rfId:w}=ar(cPe,ji),{connectingFrom:S,connectingTo:E,clickConnecting:k,isPossibleEndHandle:T,connectionInProcess:C,clickConnectionInProcess:N,valid:_}=ar(uPe(y,b,e),ji);y||(j=(M=O.getState()).onError)==null||j.call(M,"010",Tc.error010());const R=P=>{const{defaultEdgeOptions:L,onConnect:U,hasDefaultEdges:F}=O.getState(),q={...L,...P};if(F){const{edges:z,setEdges:B,onError:V}=O.getState();B(qDe(q,z,{onError:V}))}U==null||U(q),l==null||l(q)},$=P=>{if(!y)return;const L=Gie(P.nativeEvent);if(i&&(L&&P.button===0||!L)){const U=O.getState();D5.onPointerDown(P.nativeEvent,{handleDomNode:P.currentTarget,autoPanOnConnect:U.autoPanOnConnect,connectionMode:U.connectionMode,connectionRadius:U.connectionRadius,domNode:U.domNode,nodeLookup:U.nodeLookup,lib:U.lib,isTarget:g,handleId:b,nodeId:y,flowId:U.rfId,panBy:U.panBy,cancelConnection:U.cancelConnection,onConnectStart:U.onConnectStart,onConnectEnd:(...F)=>{var q,z;return(z=(q=O.getState()).onConnectEnd)==null?void 0:z.call(q,...F)},updateConnection:U.updateConnection,onConnect:R,isValidConnection:n||((...F)=>{var q,z;return((z=(q=O.getState()).isValidConnection)==null?void 0:z.call(q,...F))??!0}),getTransform:()=>O.getState().transform,getFromHandle:()=>O.getState().connection.fromHandle,autoPanSpeed:U.autoPanSpeed,dragThreshold:U.connectionDragThreshold})}L?d==null||d(P):f==null||f(P)},D=P=>{const{onClickConnectStart:L,onClickConnectEnd:U,connectionClickStartHandle:F,connectionMode:q,isValidConnection:z,lib:B,rfId:V,nodeLookup:ce,connection:we}=O.getState();if(!y||!F&&!i)return;if(!F){L==null||L(P.nativeEvent,{nodeId:y,handleId:b,handleType:e}),O.setState({connectionClickStartHandle:{nodeId:y,type:e,id:b}});return}const Oe=Hie(P.target),de=n||z,{connection:Z,isValid:J}=D5.isValid(P.nativeEvent,{handle:{nodeId:y,id:b,type:e},connectionMode:q,fromNodeId:F.nodeId,fromHandleId:F.id||null,fromType:F.type,isValidConnection:de,flowId:V,doc:Oe,lib:B,nodeLookup:ce});J&&Z&&R(Z);const fe=structuredClone(we);delete fe.inProgress,fe.toPosition=fe.toHandle?fe.toHandle.position:null,U==null||U(P,fe),O.setState({connectionClickStartHandle:null})};return o.jsx("div",{"data-handleid":b,"data-nodeid":y,"data-handlepos":t,"data-id":`${w}-${y}-${b}-${e}`,className:Ss(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",x,u,{source:!g,target:g,connectable:r,connectablestart:i,connectableend:s,clickconnecting:k,connectingfrom:S,connectingto:E,valid:_,connectionindicator:r&&(!C||T)&&(C||N?s:i)}]),onMouseDown:$,onTouchStart:$,onClick:v?D:void 0,ref:p,...h,children:c})}const ho=m.memo(wse(dPe));function fPe({data:e,isConnectable:t,sourcePosition:n=Nt.Bottom}){return o.jsxs(o.Fragment,{children:[e==null?void 0:e.label,o.jsx(ho,{type:"source",position:n,isConnectable:t})]})}function hPe({data:e,isConnectable:t,targetPosition:n=Nt.Top,sourcePosition:r=Nt.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 pPe(){return null}function mPe({data:e,isConnectable:t,targetPosition:n=Nt.Top}){return o.jsxs(o.Fragment,{children:[o.jsx(ho,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const y2={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},iz={input:fPe,default:hPe,output:mPe,group:pPe};function gPe(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 bPe=e=>{const{width:t,height:n,x:r,y:i}=rw(e.nodeLookup,{filter:s=>!!s.selected});return{width:bc(t)?t:null,height:bc(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 OPe({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Ri(),{width:i,height:s,transformString:a,userSelectionActive:l}=ar(bPe,ji),c=kse(),u=m.useRef(null);m.useEffect(()=>{var p;n||(p=u.current)==null||p.focus({preventScroll:!0})},[n]);const d=!l&&i!==null&&s!==null;if(Ese({nodeRef:u,disabled:!d}),!d)return null;const f=e?p=>{const b=r.getState().nodes.filter(g=>g.selected);e(p,b)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(y2,p.key)&&(p.preventDefault(),c({direction:y2[p.key],factor:p.shiftKey?4:1}))};return o.jsx("div",{className:Ss(["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 sz=typeof window<"u"?window:void 0,yPe=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function _se({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:p,multiSelectionKeyCode:b,panActivationKeyCode:g,zoomActivationKeyCode:O,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:x,panOnScroll:w,panOnScrollSpeed:S,panOnScrollMode:E,zoomOnDoubleClick:k,panOnDrag:T,autoPanOnSelection:C,defaultViewport:N,translateExtent:_,minZoom:R,maxZoom:$,preventScrolling:D,onSelectionContextMenu:M,noWheelClassName:j,noPanClassName:P,disableKeyboardA11y:L,onViewportChange:U,isControlledViewport:F}){const{nodesSelectionActive:q,userSelectionActive:z}=ar(yPe,ji),B=Fx(u,{target:sz}),V=Fx(g,{target:sz}),ce=V||T,we=V||w,Oe=d&&ce!==!0,de=B||z||Oe;return JDe({deleteKeyCode:c,multiSelectionKeyCode:b}),o.jsx(nPe,{onPaneContextMenu:s,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:x,panOnScroll:we,panOnScrollSpeed:S,panOnScrollMode:E,zoomOnDoubleClick:k,panOnDrag:!B&&ce,defaultViewport:N,translateExtent:_,minZoom:R,maxZoom:$,zoomActivationKeyCode:O,preventScrolling:D,noWheelClassName:j,noPanClassName:P,onViewportChange:U,isControlledViewport:F,paneClickDistance:l,selectionOnDrag:Oe,children:o.jsxs(aPe,{onSelectionStart:h,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:a,panOnDrag:ce,autoPanOnSelection:C,isSelecting:!!de,selectionMode:f,selectionKeyPressed:B,paneClickDistance:l,selectionOnDrag:Oe,children:[e,q&&o.jsx(OPe,{onSelectionContextMenu:M,noPanClassName:P,disableKeyboardA11y:L})]})})}_se.displayName="FlowRenderer";const xPe=m.memo(_se),vPe=e=>t=>e?I6(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 wPe(e){return ar(m.useCallback(vPe(e),[e]),ji)}const SPe=e=>e.updateNodeInternals;function EPe(){const e=ar(SPe),[t]=m.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 m.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function kPe({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const i=Ri(),s=m.useRef(null),a=m.useRef(null),l=m.useRef(e.sourcePosition),c=m.useRef(e.targetPosition),u=m.useRef(t),d=n&&!!e.internals.handleBounds;return m.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]),m.useEffect(()=>()=>{a.current&&(r==null||r.unobserve(a.current),a.current=null)},[]),m.useEffect(()=>{if(s.current){const f=u.current!==t,h=l.current!==e.sourcePosition,p=c.current!==e.targetPosition;(f||h||p)&&(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 TPe({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:p,disableKeyboardA11y:b,rfId:g,nodeTypes:O,nodeClickDistance:y,onError:v}){const{node:x,internals:w,isParent:S}=ar(de=>{const Z=de.nodeLookup.get(e),J=de.parentLookup.has(e);return{node:Z,internals:Z.internals,isParent:J}},ji);let E=x.type||"default",k=(O==null?void 0:O[E])||iz[E];k===void 0&&(v==null||v("003",Tc.error003(E)),E="default",k=(O==null?void 0:O.default)||iz.default);const T=!!(x.draggable||l&&typeof x.draggable>"u"),C=!!(x.selectable||c&&typeof x.selectable>"u"),N=!!(x.connectable||u&&typeof x.connectable>"u"),_=!!(x.focusable||d&&typeof x.focusable>"u"),R=Ri(),$=M6(x),D=kPe({node:x,nodeType:E,hasDimensions:$,resizeObserver:f}),M=Ese({nodeRef:D,disabled:x.hidden||!T,noDragClassName:h,handleSelector:x.dragHandle,nodeId:e,isSelectable:C,nodeClickDistance:y}),j=kse();if(x.hidden)return null;const P=of(x),L=gPe(x),U=C||T||t||n||r||i,F=n?de=>n(de,{...w.userNode}):void 0,q=r?de=>r(de,{...w.userNode}):void 0,z=i?de=>i(de,{...w.userNode}):void 0,B=s?de=>s(de,{...w.userNode}):void 0,V=a?de=>a(de,{...w.userNode}):void 0,ce=de=>{const{selectNodesOnDrag:Z,nodeDragThreshold:J}=R.getState();C&&(!Z||!T||J>0)&&P5({id:e,store:R,nodeRef:D}),t&&t(de,{...w.userNode})},we=de=>{if(!(Xie(de.nativeEvent)||b)){if(Mie.includes(de.key)&&C){const Z=de.key==="Escape";P5({id:e,store:R,unselect:Z,nodeRef:D})}else if(T&&x.selected&&Object.prototype.hasOwnProperty.call(y2,de.key)){de.preventDefault();const{ariaLabelConfig:Z}=R.getState();R.setState({ariaLiveMessage:Z["node.a11yDescription.ariaLiveMessage"]({direction:de.key.replace("Arrow","").toLowerCase(),x:~~w.positionAbsolute.x,y:~~w.positionAbsolute.y})}),j({direction:y2[de.key],factor:de.shiftKey?4:1})}}},Oe=()=>{var Qe;if(b||!((Qe=D.current)!=null&&Qe.matches(":focus-visible")))return;const{transform:de,width:Z,height:J,autoPanOnNodeFocus:fe,setCenter:be}=R.getState();if(!fe)return;I6(new Map([[e,x]]),{x:0,y:0,width:Z,height:J},de,!0).length>0||be(x.position.x+P.width/2,x.position.y+P.height/2,{zoom:de[2]})};return o.jsx("div",{className:Ss(["react-flow__node",`react-flow__node-${E}`,{[p]:T},x.className,{selected:x.selected,selectable:C,parent:S,draggable:T,dragging:M}]),ref:D,style:{zIndex:w.z,transform:`translate(${w.positionAbsolute.x}px,${w.positionAbsolute.y}px)`,pointerEvents:U?"all":"none",visibility:$?"visible":"hidden",...x.style,...L},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:F,onMouseMove:q,onMouseLeave:z,onContextMenu:B,onClick:ce,onDoubleClick:V,onKeyDown:_?we:void 0,tabIndex:_?0:void 0,onFocus:_?Oe:void 0,role:x.ariaRole??(_?"group":void 0),"aria-roledescription":"node","aria-describedby":b?void 0:`${gse}-${g}`,"aria-label":x.ariaLabel,...x.domAttributes,children:o.jsx(lPe,{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:T,deletable:x.deletable??!0,isConnectable:N,sourcePosition:x.sourcePosition,targetPosition:x.targetPosition,dragging:M,dragHandle:x.dragHandle,zIndex:w.z,parentId:x.parentId,...P})})})}var _Pe=m.memo(TPe);const APe=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Ase(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:s}=ar(APe,ji),a=wPe(e.onlyRenderVisibleElements),l=EPe();return o.jsx("div",{className:"react-flow__nodes",style:DA,children:a.map(c=>o.jsx(_Pe,{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))})}Ase.displayName="NodeRenderer";const CPe=m.memo(Ase);function NPe(e){return ar(m.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&&hIe({sourceNode:s,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(i.id)}return r},[e]),ji)}const jPe=({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"})},RPe=({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"})},az={[$x.Arrow]:jPe,[$x.ArrowClosed]:RPe};function IPe(e){const t=Ri();return m.useMemo(()=>{var i,s;return Object.prototype.hasOwnProperty.call(az,e)?az[e]:((s=(i=t.getState()).onError)==null||s.call(i,"009",Tc.error009(e)),null)},[e])}const DPe=({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=IPe(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},Cse=({defaultColor:e,rfId:t})=>{const n=ar(s=>s.edges),r=ar(s=>s.defaultEdgeOptions),i=m.useMemo(()=>vIe(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(DPe,{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};Cse.displayName="MarkerDefinitions";var PPe=m.memo(Cse);function Nse({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]=m.useState({x:1,y:0,width:0,height:0}),p=Ss(["react-flow__edge-textwrapper",u]),b=m.useRef(null);return m.useEffect(()=>{if(b.current){const g=b.current.getBBox();h({x:g.x,y:g.y,width:g.width,height:g.height})}},[n]),n?o.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,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:b,style:r,children:n}),c]}):null}Nse.displayName="EdgeText";const MPe=m.memo(Nse);function sw({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:Ss(["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&&bc(t)&&bc(n)?o.jsx(MPe,{x:t,y:n,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function oz({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===Nt.Left||e===Nt.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function jse({sourceX:e,sourceY:t,sourcePosition:n=Nt.Bottom,targetX:r,targetY:i,targetPosition:s=Nt.Top}){const[a,l]=oz({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,u]=oz({pos:s,x1:r,y1:i,x2:e,y2:t}),[d,f,h,p]=Yie({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,p]}function Rse(e){return m.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:p,style:b,markerEnd:g,markerStart:O,interactionWidth:y})=>{const[v,x,w]=jse({sourceX:n,sourceY:r,sourcePosition:a,targetX:i,targetY:s,targetPosition:l}),S=e.isInternal?void 0:t;return o.jsx(sw,{id:S,path:v,labelX:x,labelY:w,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:b,markerEnd:g,markerStart:O,interactionWidth:y})})}const LPe=Rse({isInternal:!1}),Ise=Rse({isInternal:!0});LPe.displayName="SimpleBezierEdge";Ise.displayName="SimpleBezierEdgeInternal";function Dse(e){return m.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:p=Nt.Bottom,targetPosition:b=Nt.Top,markerEnd:g,markerStart:O,pathOptions:y,interactionWidth:v})=>{const[x,w,S]=O2({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:s,targetPosition:b,borderRadius:y==null?void 0:y.borderRadius,offset:y==null?void 0:y.offset,stepPosition:y==null?void 0:y.stepPosition}),E=e.isInternal?void 0:t;return o.jsx(sw,{id:E,path:x,labelX:w,labelY:S,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:g,markerStart:O,interactionWidth:v})})}const Pse=Dse({isInternal:!1}),Mse=Dse({isInternal:!0});Pse.displayName="SmoothStepEdge";Mse.displayName="SmoothStepEdgeInternal";function Lse(e){return m.memo(({id:t,...n})=>{var i;const r=e.isInternal?void 0:t;return o.jsx(Pse,{...n,id:r,pathOptions:m.useMemo(()=>{var s;return{borderRadius:0,offset:(s=n.pathOptions)==null?void 0:s.offset}},[(i=n.pathOptions)==null?void 0:i.offset])})})}const $Pe=Lse({isInternal:!1}),$se=Lse({isInternal:!0});$Pe.displayName="StepEdge";$se.displayName="StepEdgeInternal";function Bse(e){return m.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:p,markerStart:b,interactionWidth:g})=>{const[O,y,v]=Kie({sourceX:n,sourceY:r,targetX:i,targetY:s}),x=e.isInternal?void 0:t;return o.jsx(sw,{id:x,path:O,labelX:y,labelY:v,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:b,interactionWidth:g})})}const BPe=Bse({isInternal:!1}),Qse=Bse({isInternal:!0});BPe.displayName="StraightEdge";Qse.displayName="StraightEdgeInternal";function Fse(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:a=Nt.Bottom,targetPosition:l=Nt.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:b,markerEnd:g,markerStart:O,pathOptions:y,interactionWidth:v})=>{const[x,w,S]=Wie({sourceX:n,sourceY:r,sourcePosition:a,targetX:i,targetY:s,targetPosition:l,curvature:y==null?void 0:y.curvature}),E=e.isInternal?void 0:t;return o.jsx(sw,{id:E,path:x,labelX:w,labelY:S,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:b,markerEnd:g,markerStart:O,interactionWidth:v})})}const QPe=Fse({isInternal:!1}),Use=Fse({isInternal:!0});QPe.displayName="BezierEdge";Use.displayName="BezierEdgeInternal";const lz={default:Use,straight:Qse,step:$se,smoothstep:Mse,simplebezier:Ise},cz={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},FPe=(e,t,n)=>n===Nt.Left?e-t:n===Nt.Right?e+t:e,UPe=(e,t,n)=>n===Nt.Top?e-t:n===Nt.Bottom?e+t:e,uz="react-flow__edgeupdater";function dz({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:Ss([uz,`${uz}-${l}`]),cx:FPe(t,r,e),cy:UPe(n,r,e),r,stroke:"transparent",fill:"transparent"})}function zPe({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:p}){const b=Ri(),g=(w,S)=>{if(w.button!==0)return;const{autoPanOnConnect:E,domNode:k,connectionMode:T,connectionRadius:C,lib:N,onConnectStart:_,cancelConnection:R,nodeLookup:$,rfId:D,panBy:M,updateConnection:j}=b.getState(),P=S.type==="target",L=(q,z)=>{h(!1),f==null||f(q,n,S.type,z)},U=q=>u==null?void 0:u(n,q),F=(q,z)=>{h(!0),d==null||d(w,n,S.type),_==null||_(q,z)};D5.onPointerDown(w.nativeEvent,{autoPanOnConnect:E,connectionMode:T,connectionRadius:C,domNode:k,handleId:S.id,nodeId:S.nodeId,nodeLookup:$,isTarget:P,edgeUpdaterType:S.type,lib:N,flowId:D,cancelConnection:R,panBy:M,isValidConnection:(...q)=>{var z,B;return((B=(z=b.getState()).isValidConnection)==null?void 0:B.call(z,...q))??!0},onConnect:U,onConnectStart:F,onConnectEnd:(...q)=>{var z,B;return(B=(z=b.getState()).onConnectEnd)==null?void 0:B.call(z,...q)},onReconnectEnd:L,updateConnection:j,getTransform:()=>b.getState().transform,getFromHandle:()=>b.getState().connection.fromHandle,dragThreshold:b.getState().connectionDragThreshold,handleDomNode:w.currentTarget})},O=w=>g(w,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=w=>g(w,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),v=()=>p(!0),x=()=>p(!1);return o.jsxs(o.Fragment,{children:[(e===!0||e==="source")&&o.jsx(dz,{position:l,centerX:r,centerY:i,radius:t,onMouseDown:O,onMouseEnter:v,onMouseOut:x,type:"source"}),(e===!0||e==="target")&&o.jsx(dz,{position:c,centerX:s,centerY:a,radius:t,onMouseDown:y,onMouseEnter:v,onMouseOut:x,type:"target"})]})}function VPe({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:p,rfId:b,edgeTypes:g,noPanClassName:O,onError:y,disableKeyboardA11y:v}){let x=ar(be=>be.edgeLookup.get(e));const w=ar(be=>be.defaultEdgeOptions);x=w?{...w,...x}:x;let S=x.type||"default",E=(g==null?void 0:g[S])||lz[S];E===void 0&&(y==null||y("011",Tc.error011(S)),S="default",E=(g==null?void 0:g.default)||lz.default);const k=!!(x.focusable||t&&typeof x.focusable>"u"),T=typeof f<"u"&&(x.reconnectable||n&&typeof x.reconnectable>"u"),C=!!(x.selectable||r&&typeof x.selectable>"u"),N=m.useRef(null),[_,R]=m.useState(!1),[$,D]=m.useState(!1),M=Ri(),{zIndex:j,sourceX:P,sourceY:L,targetX:U,targetY:F,sourcePosition:q,targetPosition:z}=ar(m.useCallback(be=>{const je=be.nodeLookup.get(x.source),Qe=be.nodeLookup.get(x.target);if(!je||!Qe)return{zIndex:x.zIndex,...cz};const Me=xIe({id:e,sourceNode:je,targetNode:Qe,sourceHandle:x.sourceHandle||null,targetHandle:x.targetHandle||null,connectionMode:be.connectionMode,onError:y});return{zIndex:fIe({selected:x.selected,zIndex:x.zIndex,sourceNode:je,targetNode:Qe,elevateOnSelect:be.elevateEdgesOnSelect,zIndexMode:be.zIndexMode}),...Me||cz}},[x.source,x.target,x.sourceHandle,x.targetHandle,x.selected,x.zIndex]),ji),B=m.useMemo(()=>x.markerStart?`url('#${R5(x.markerStart,b)}')`:void 0,[x.markerStart,b]),V=m.useMemo(()=>x.markerEnd?`url('#${R5(x.markerEnd,b)}')`:void 0,[x.markerEnd,b]);if(x.hidden||P===null||L===null||U===null||F===null)return null;const ce=be=>{var le;const{addSelectedEdges:je,unselectNodesAndEdges:Qe,multiSelectionActive:Me}=M.getState();C&&(M.setState({nodesSelectionActive:!1}),x.selected&&Me?(Qe({nodes:[],edges:[x]}),(le=N.current)==null||le.blur()):je([e])),i&&i(be,x)},we=s?be=>{s(be,{...x})}:void 0,Oe=a?be=>{a(be,{...x})}:void 0,de=l?be=>{l(be,{...x})}:void 0,Z=c?be=>{c(be,{...x})}:void 0,J=u?be=>{u(be,{...x})}:void 0,fe=be=>{var je;if(!v&&Mie.includes(be.key)&&C){const{unselectNodesAndEdges:Qe,addSelectedEdges:Me}=M.getState();be.key==="Escape"?((je=N.current)==null||je.blur(),Qe({edges:[x]})):Me([e])}};return o.jsx("svg",{style:{zIndex:j},children:o.jsxs("g",{className:Ss(["react-flow__edge",`react-flow__edge-${S}`,x.className,O,{selected:x.selected,animated:x.animated,inactive:!C&&!i,updating:_,selectable:C}]),onClick:ce,onDoubleClick:we,onContextMenu:Oe,onMouseEnter:de,onMouseMove:Z,onMouseLeave:J,onKeyDown:k?fe: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?`${bse}-${b}`:void 0,ref:N,...x.domAttributes,children:[!$&&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:P,sourceY:L,targetX:U,targetY:F,sourcePosition:q,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}),T&&o.jsx(zPe,{edge:x,isReconnectable:T,reconnectRadius:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,sourceX:P,sourceY:L,targetX:U,targetY:F,sourcePosition:q,targetPosition:z,setUpdateHover:R,setReconnecting:D})]})})}var qPe=m.memo(VPe);const HPe=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function zse({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:p,onReconnectEnd:b,disableKeyboardA11y:g}){const{edgesFocusable:O,edgesReconnectable:y,elementsSelectable:v,onError:x}=ar(HPe,ji),w=NPe(t);return o.jsxs("div",{className:"react-flow__edges",children:[o.jsx(PPe,{defaultColor:e,rfId:n}),w.map(S=>o.jsx(qPe,{id:S,edgesFocusable:O,edgesReconnectable:y,elementsSelectable:v,noPanClassName:i,onReconnect:s,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:d,reconnectRadius:f,onDoubleClick:h,onReconnectStart:p,onReconnectEnd:b,rfId:n,onError:x,edgeTypes:r,disableKeyboardA11y:g},S))]})}zse.displayName="EdgeRenderer";const XPe=m.memo(zse),GPe=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function YPe({children:e}){const t=ar(GPe);return o.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function WPe(e){const t=IA(),n=m.useRef(!1);m.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const ZPe=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function KPe(e){const t=ar(ZPe),n=Ri();return m.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function JPe(e){return e.connection.inProgress?{...e.connection,to:yO(e.connection.to,e.transform)}:{...e.connection}}function e5e(e){return JPe}function t5e(e){const t=e5e();return ar(t,ji)}const n5e=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function r5e({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:i,width:s,height:a,isValid:l,inProgress:c}=ar(n5e,ji);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:Ss(["react-flow__connection",Bie(l)]),children:o.jsx(Vse,{style:t,type:n,CustomComponent:r,isValid:l})})})}const Vse=({style:e,type:t=Wf.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:p}=t5e();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:Bie(r),toNode:d,toHandle:f,pointer:p});let b="";const g={sourceX:s.x,sourceY:s.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(t){case Wf.Bezier:[b]=Wie(g);break;case Wf.SimpleBezier:[b]=jse(g);break;case Wf.Step:[b]=O2({...g,borderRadius:0});break;case Wf.SmoothStep:[b]=O2(g);break;default:[b]=Kie(g)}return o.jsx("path",{d:b,fill:"none",className:"react-flow__connection-path",style:e})};Vse.displayName="ConnectionLine";const i5e={};function fz(e=i5e){m.useRef(e),Ri(),m.useEffect(()=>{},[e])}function s5e(){Ri(),m.useRef(!1),m.useEffect(()=>{},[])}function qse({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:p,connectionLineType:b,connectionLineStyle:g,connectionLineComponent:O,connectionLineContainerStyle:y,selectionKeyCode:v,selectionOnDrag:x,selectionMode:w,multiSelectionKeyCode:S,panActivationKeyCode:E,zoomActivationKeyCode:k,deleteKeyCode:T,onlyRenderVisibleElements:C,elementsSelectable:N,defaultViewport:_,translateExtent:R,minZoom:$,maxZoom:D,preventScrolling:M,defaultMarkerColor:j,zoomOnScroll:P,zoomOnPinch:L,panOnScroll:U,panOnScrollSpeed:F,panOnScrollMode:q,zoomOnDoubleClick:z,panOnDrag:B,autoPanOnSelection:V,onPaneClick:ce,onPaneMouseEnter:we,onPaneMouseMove:Oe,onPaneMouseLeave:de,onPaneScroll:Z,onPaneContextMenu:J,paneClickDistance:fe,nodeClickDistance:be,onEdgeContextMenu:je,onEdgeMouseEnter:Qe,onEdgeMouseMove:Me,onEdgeMouseLeave:le,reconnectRadius:ke,onReconnect:ye,onReconnectStart:$e,onReconnectEnd:ze,noDragClassName:Ae,noWheelClassName:Ve,noPanClassName:ut,disableKeyboardA11y:Tt,nodeExtent:We,rfId:W,viewport:ne,onViewportChange:he}){return fz(e),fz(t),s5e(),WPe(n),KPe(ne),o.jsx(xPe,{onPaneClick:ce,onPaneMouseEnter:we,onPaneMouseMove:Oe,onPaneMouseLeave:de,onPaneContextMenu:J,onPaneScroll:Z,paneClickDistance:fe,deleteKeyCode:T,selectionKeyCode:v,selectionOnDrag:x,selectionMode:w,onSelectionStart:h,onSelectionEnd:p,multiSelectionKeyCode:S,panActivationKeyCode:E,zoomActivationKeyCode:k,elementsSelectable:N,zoomOnScroll:P,zoomOnPinch:L,zoomOnDoubleClick:z,panOnScroll:U,panOnScrollSpeed:F,panOnScrollMode:q,panOnDrag:B,autoPanOnSelection:V,defaultViewport:_,translateExtent:R,minZoom:$,maxZoom:D,onSelectionContextMenu:f,preventScrolling:M,noDragClassName:Ae,noWheelClassName:Ve,noPanClassName:ut,disableKeyboardA11y:Tt,onViewportChange:he,isControlledViewport:!!ne,children:o.jsxs(YPe,{children:[o.jsx(XPe,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:a,onReconnect:ye,onReconnectStart:$e,onReconnectEnd:ze,onlyRenderVisibleElements:C,onEdgeContextMenu:je,onEdgeMouseEnter:Qe,onEdgeMouseMove:Me,onEdgeMouseLeave:le,reconnectRadius:ke,defaultMarkerColor:j,noPanClassName:ut,disableKeyboardA11y:Tt,rfId:W}),o.jsx(r5e,{style:g,type:b,component:O,containerStyle:y}),o.jsx("div",{className:"react-flow__edgelabel-renderer"}),o.jsx(CPe,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:s,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:be,onlyRenderVisibleElements:C,noPanClassName:ut,noDragClassName:Ae,disableKeyboardA11y:Tt,nodeExtent:We,rfId:W}),o.jsx("div",{className:"react-flow__viewport-portal"})]})})}qse.displayName="GraphView";const a5e=m.memo(qse),o5e=Vie(),hz=({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 p=new Map,b=new Map,g=new Map,O=new Map,y=r??t??[],v=n??e??[],x=d??[0,0],w=f??Mx;tse(g,O,y);const{nodesInitialized:S}=I5(v,p,b,{nodeOrigin:x,nodeExtent:w,zIndexMode:h});let E=[0,0,1];if(a&&i&&s){const k=rw(p,{filter:_=>!!((_.width||_.initialWidth)&&(_.height||_.initialHeight))}),{x:T,y:C,zoom:N}=P6(k,i,s,c,u,(l==null?void 0:l.padding)??.1);E=[T,C,N]}return{rfId:"1",width:i??0,height:s??0,transform:E,nodes:v,nodesInitialized:S,nodeLookup:p,parentLookup:b,edges:y,edgeLookup:O,connectionLookup:g,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:Mx,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Cb.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:{...$ie},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:o5e,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Lie,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},l5e=({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})=>SDe((p,b)=>{async function g(){const{nodeLookup:O,panZoom:y,fitViewOptions:v,fitViewResolver:x,width:w,height:S,minZoom:E,maxZoom:k}=b();y&&(await sIe({nodes:O,width:w,height:S,panZoom:y,minZoom:E,maxZoom:k},v),x==null||x.resolve(!0),p({fitViewResolver:null}))}return{...hz({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:O=>{const{nodeLookup:y,parentLookup:v,nodeOrigin:x,elevateNodesOnSelect:w,fitViewQueued:S,zIndexMode:E,nodesSelectionActive:k}=b(),{nodesInitialized:T,hasSelectedNodes:C}=I5(O,y,v,{nodeOrigin:x,nodeExtent:f,elevateNodesOnSelect:w,checkEquality:!0,zIndexMode:E}),N=k&&C;S&&T?(g(),p({nodes:O,nodesInitialized:T,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:N})):p({nodes:O,nodesInitialized:T,nodesSelectionActive:N})},setEdges:O=>{const{connectionLookup:y,edgeLookup:v}=b();tse(y,v,O),p({edges:O})},setDefaultNodesAndEdges:(O,y)=>{if(O){const{setNodes:v}=b();v(O),p({hasDefaultNodes:!0})}if(y){const{setEdges:v}=b();v(y),p({hasDefaultEdges:!0})}},updateNodeInternals:O=>{const{triggerNodeChanges:y,nodeLookup:v,parentLookup:x,domNode:w,nodeOrigin:S,nodeExtent:E,debug:k,fitViewQueued:T,zIndexMode:C}=b(),{changes:N,updatedInternals:_}=AIe(O,v,x,w,S,E,C);_&&(EIe(v,x,{nodeOrigin:S,nodeExtent:E,zIndexMode:C}),T?(g(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),(N==null?void 0:N.length)>0&&(k&&console.log("React Flow: trigger node changes",N),y==null||y(N)))},updateNodePositions:(O,y=!1)=>{const v=[];let x=[];const{nodeLookup:w,triggerNodeChanges:S,connection:E,updateConnection:k,onNodesChangeMiddlewareMap:T}=b();for(const[C,N]of O){const _=w.get(C),R=!!(_!=null&&_.expandParent&&(_!=null&&_.parentId)&&(N!=null&&N.position)),$={id:C,type:"position",position:R?{x:Math.max(0,N.position.x),y:Math.max(0,N.position.y)}:N.position,dragging:y};if(_&&E.inProgress&&E.fromNode.id===_.id){const D=Am(_,E.fromHandle,Nt.Left,!0);k({...E,from:D})}R&&_.parentId&&v.push({id:C,parentId:_.parentId,rect:{...N.internals.positionAbsolute,width:N.measured.width??0,height:N.measured.height??0}}),x.push($)}if(v.length>0){const{parentLookup:C,nodeOrigin:N}=b(),_=U6(v,w,C,N);x.push(..._)}for(const C of T.values())x=C(x);S(x)},triggerNodeChanges:O=>{const{onNodesChange:y,setNodes:v,nodes:x,hasDefaultNodes:w,debug:S}=b();if(O!=null&&O.length){if(w){const E=xse(O,x);v(E)}S&&console.log("React Flow: trigger node changes",O),y==null||y(O)}},triggerEdgeChanges:O=>{const{onEdgesChange:y,setEdges:v,edges:x,hasDefaultEdges:w,debug:S}=b();if(O!=null&&O.length){if(w){const E=vse(O,x);v(E)}S&&console.log("React Flow: trigger edge changes",O),y==null||y(O)}},addSelectedNodes:O=>{const{multiSelectionActive:y,edgeLookup:v,nodeLookup:x,triggerNodeChanges:w,triggerEdgeChanges:S}=b();if(y){const E=O.map(k=>Dp(k,!0));w(E);return}w(v0(x,new Set([...O]),!0)),S(v0(v))},addSelectedEdges:O=>{const{multiSelectionActive:y,edgeLookup:v,nodeLookup:x,triggerNodeChanges:w,triggerEdgeChanges:S}=b();if(y){const E=O.map(k=>Dp(k,!0));S(E);return}S(v0(v,new Set([...O]))),w(v0(x,new Set,!0))},unselectNodesAndEdges:({nodes:O,edges:y}={})=>{const{edges:v,nodes:x,nodeLookup:w,triggerNodeChanges:S,triggerEdgeChanges:E}=b(),k=O||x,T=y||v,C=[];for(const _ of k){if(!_.selected)continue;const R=w.get(_.id);R&&(R.selected=!1),C.push(Dp(_.id,!1))}const N=[];for(const _ of T)_.selected&&N.push(Dp(_.id,!1));S(C),E(N)},setMinZoom:O=>{const{panZoom:y,maxZoom:v}=b();y==null||y.setScaleExtent([O,v]),p({minZoom:O})},setMaxZoom:O=>{const{panZoom:y,minZoom:v}=b();y==null||y.setScaleExtent([v,O]),p({maxZoom:O})},setTranslateExtent:O=>{var y;(y=b().panZoom)==null||y.setTranslateExtent(O),p({translateExtent:O})},resetSelectedElements:()=>{const{edges:O,nodes:y,triggerNodeChanges:v,triggerEdgeChanges:x,elementsSelectable:w}=b();if(!w)return;const S=y.reduce((k,T)=>T.selected?[...k,Dp(T.id,!1)]:k,[]),E=O.reduce((k,T)=>T.selected?[...k,Dp(T.id,!1)]:k,[]);v(S),x(E)},setNodeExtent:O=>{const{nodes:y,nodeLookup:v,parentLookup:x,nodeOrigin:w,elevateNodesOnSelect:S,nodeExtent:E,zIndexMode:k}=b();O[0][0]===E[0][0]&&O[0][1]===E[0][1]&&O[1][0]===E[1][0]&&O[1][1]===E[1][1]||(I5(y,v,x,{nodeOrigin:w,nodeExtent:O,elevateNodesOnSelect:S,checkEquality:!1,zIndexMode:k}),p({nodeExtent:O}))},panBy:O=>{const{transform:y,width:v,height:x,panZoom:w,translateExtent:S}=b();return CIe({delta:O,panZoom:w,transform:y,translateExtent:S,width:v,height:x})},setCenter:async(O,y,v)=>{const{width:x,height:w,maxZoom:S,panZoom:E}=b();if(!E)return!1;const k=typeof(v==null?void 0:v.zoom)<"u"?v.zoom:S;return await E.setViewport({x:x/2-O*k,y:w/2-y*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:()=>{p({connection:{...$ie}})},updateConnection:O=>{p({connection:O})},reset:()=>p({...hz()})}},Object.is);function Hse({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:p}){const[b]=m.useState(()=>l5e({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(EDe,{value:b,children:o.jsx(YDe,{children:p})})}function c5e({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:p}){return m.useContext(jA)?o.jsx(o.Fragment,{children:e}):o.jsx(Hse,{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:p,children:e})}const u5e={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function d5e({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:p,onConnectStart:b,onConnectEnd:g,onClickConnectStart:O,onClickConnectEnd:y,onNodeMouseEnter:v,onNodeMouseMove:x,onNodeMouseLeave:w,onNodeContextMenu:S,onNodeDoubleClick:E,onNodeDragStart:k,onNodeDrag:T,onNodeDragStop:C,onNodesDelete:N,onEdgesDelete:_,onDelete:R,onSelectionChange:$,onSelectionDragStart:D,onSelectionDrag:M,onSelectionDragStop:j,onSelectionContextMenu:P,onSelectionStart:L,onSelectionEnd:U,onBeforeDelete:F,connectionMode:q,connectionLineType:z=Wf.Bezier,connectionLineStyle:B,connectionLineComponent:V,connectionLineContainerStyle:ce,deleteKeyCode:we="Backspace",selectionKeyCode:Oe="Shift",selectionOnDrag:de=!1,selectionMode:Z=Lx.Full,panActivationKeyCode:J="Space",multiSelectionKeyCode:fe=Qx()?"Meta":"Control",zoomActivationKeyCode:be=Qx()?"Meta":"Control",snapToGrid:je,snapGrid:Qe,onlyRenderVisibleElements:Me=!1,selectNodesOnDrag:le,nodesDraggable:ke,autoPanOnNodeFocus:ye,nodesConnectable:$e,nodesFocusable:ze,nodeOrigin:Ae=Ose,edgesFocusable:Ve,edgesReconnectable:ut,elementsSelectable:Tt=!0,defaultViewport:We=LDe,minZoom:W=.5,maxZoom:ne=2,translateExtent:he=Mx,preventScrolling:xe=!0,nodeExtent:re,defaultMarkerColor:Re="#b1b1b7",zoomOnScroll:nt=!0,zoomOnPinch:Ke=!0,panOnScroll:tn=!1,panOnScrollSpeed:Gt=.5,panOnScrollMode:At=dm.Free,zoomOnDoubleClick:St=!0,panOnDrag:ve=!0,onPaneClick:Ue,onPaneMouseEnter:Y,onPaneMouseMove:mt,onPaneMouseLeave:xt,onPaneScroll:Dt,onPaneContextMenu:Ne,paneClickDistance:Ge=1,nodeClickDistance:Pt=0,children:Kt,onReconnect:tt,onReconnectStart:an,onReconnectEnd:or,onEdgeContextMenu:Qt,onEdgeDoubleClick:Ut,onEdgeMouseEnter:Ce,onEdgeMouseMove:Ze,onEdgeMouseLeave:$t,reconnectRadius:En=10,onNodesChange:gn,onEdgesChange:xr,noDragClassName:Pe="nodrag",noWheelClassName:at="nowheel",noPanClassName:Lt="nopan",fitView:Wt,fitViewOptions:fn,connectOnClick:Jt,attributionPosition:lr,proOptions:Sr,defaultEdgeOptions:ai,elevateNodesOnSelect:Yt=!0,elevateEdgesOnSelect:_r=!1,disableKeyboardA11y:kn=!1,autoPanOnConnect:Wr,autoPanOnNodeDrag:jr,autoPanOnSelection:Rr=!0,autoPanSpeed:Rn,connectionRadius:cr,isValidConnection:Nn,onError:ur,style:Lr,id:$r,nodeDragThreshold:Zr,connectionDragThreshold:bn,viewport:ue,onViewportChange:Ie,width:ot,height:dt,colorMode:Zn="light",debug:Fi,onScroll:Ui,ariaLabelConfig:Es,zIndexMode:Ii="basic",...Ds},gr){const Zs=$r||"1",$c=FDe(Zn),Ka=m.useCallback(oi=>{oi.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Ui==null||Ui(oi)},[Ui]);return o.jsx("div",{"data-testid":"rf__wrapper",...Ds,onScroll:Ka,style:{...Lr,...u5e},ref:gr,className:Ss(["react-flow",i,$c]),id:$r,role:"application",children:o.jsxs(c5e,{nodes:e,edges:t,width:ot,height:dt,fitView:Wt,fitViewOptions:fn,minZoom:W,maxZoom:ne,nodeOrigin:Ae,nodeExtent:re,zIndexMode:Ii,children:[o.jsx(QDe,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:b,onConnectEnd:g,onClickConnectStart:O,onClickConnectEnd:y,nodesDraggable:ke,autoPanOnNodeFocus:ye,nodesConnectable:$e,nodesFocusable:ze,edgesFocusable:Ve,edgesReconnectable:ut,elementsSelectable:Tt,elevateNodesOnSelect:Yt,elevateEdgesOnSelect:_r,minZoom:W,maxZoom:ne,nodeExtent:re,onNodesChange:gn,onEdgesChange:xr,snapToGrid:je,snapGrid:Qe,connectionMode:q,translateExtent:he,connectOnClick:Jt,defaultEdgeOptions:ai,fitView:Wt,fitViewOptions:fn,onNodesDelete:N,onEdgesDelete:_,onDelete:R,onNodeDragStart:k,onNodeDrag:T,onNodeDragStop:C,onSelectionDrag:M,onSelectionDragStart:D,onSelectionDragStop:j,onMove:d,onMoveStart:f,onMoveEnd:h,noPanClassName:Lt,nodeOrigin:Ae,rfId:Zs,autoPanOnConnect:Wr,autoPanOnNodeDrag:jr,autoPanSpeed:Rn,onError:ur,connectionRadius:cr,isValidConnection:Nn,selectNodesOnDrag:le,nodeDragThreshold:Zr,connectionDragThreshold:bn,onBeforeDelete:F,debug:Fi,ariaLabelConfig:Es,zIndexMode:Ii}),o.jsx(a5e,{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:ce,selectionKeyCode:Oe,selectionOnDrag:de,selectionMode:Z,deleteKeyCode:we,multiSelectionKeyCode:fe,panActivationKeyCode:J,zoomActivationKeyCode:be,onlyRenderVisibleElements:Me,defaultViewport:We,translateExtent:he,minZoom:W,maxZoom:ne,preventScrolling:xe,zoomOnScroll:nt,zoomOnPinch:Ke,zoomOnDoubleClick:St,panOnScroll:tn,panOnScrollSpeed:Gt,panOnScrollMode:At,panOnDrag:ve,autoPanOnSelection:Rr,onPaneClick:Ue,onPaneMouseEnter:Y,onPaneMouseMove:mt,onPaneMouseLeave:xt,onPaneScroll:Dt,onPaneContextMenu:Ne,paneClickDistance:Ge,nodeClickDistance:Pt,onSelectionContextMenu:P,onSelectionStart:L,onSelectionEnd:U,onReconnect:tt,onReconnectStart:an,onReconnectEnd:or,onEdgeContextMenu:Qt,onEdgeDoubleClick:Ut,onEdgeMouseEnter:Ce,onEdgeMouseMove:Ze,onEdgeMouseLeave:$t,reconnectRadius:En,defaultMarkerColor:Re,noDragClassName:Pe,noWheelClassName:at,noPanClassName:Lt,rfId:Zs,disableKeyboardA11y:kn,nodeExtent:re,viewport:ue,onViewportChange:Ie}),o.jsx(MDe,{onSelectionChange:$}),Kt,o.jsx(jDe,{proOptions:Sr,position:lr}),o.jsx(NDe,{rfId:Zs,disableKeyboardA11y:kn})]})})}var f5e=wse(d5e);const h5e=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function p5e({children:e}){const t=ar(h5e);return t?si.createPortal(e,t):null}function m5e(e){const[t,n]=m.useState(e),r=m.useCallback(i=>n(s=>xse(i,s)),[]);return[t,n,r]}function g5e(e){const[t,n]=m.useState(e),r=m.useCallback(i=>n(s=>vse(i,s)),[]);return[t,n,r]}const b5e=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||!M6(n.userNode))return!1;return!0};function O5e(e={includeHiddenNodes:!1}){return ar(b5e(e))}function y5e({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:Ss(["react-flow__background-pattern",n,r])})}function x5e({radius:e,className:t}){return o.jsx("circle",{cx:e,cy:e,r:e,className:Ss(["react-flow__background-pattern","dots",t])})}var yh;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(yh||(yh={}));const v5e={[yh.Dots]:1,[yh.Lines]:1,[yh.Cross]:6},w5e=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Xse({id:e,variant:t=yh.Dots,gap:n=20,size:r,lineWidth:i=1,offset:s=0,color:a,bgColor:l,style:c,className:u,patternClassName:d}){const f=m.useRef(null),{transform:h,patternId:p}=ar(w5e,ji),b=r||v5e[t],g=t===yh.Dots,O=t===yh.Cross,y=Array.isArray(n)?n:[n,n],v=[y[0]*h[2]||1,y[1]*h[2]||1],x=b*h[2],w=Array.isArray(s)?s:[s,s],S=O?[x,x]:v,E=[w[0]*h[2]||1+S[0]/2,w[1]*h[2]||1+S[1]/2],k=`${p}${e||""}`;return o.jsxs("svg",{className:Ss(["react-flow__background",u]),style:{...c,...DA,"--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:g?o.jsx(x5e,{radius:x/2,className:d}):o.jsx(y5e,{dimensions:S,lineWidth:i,variant:t,className:d})}),o.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${k})`})]})}Xse.displayName="Background";const S5e=m.memo(Xse);function E5e(){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 k5e(){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 T5e(){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 _5e(){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 A5e(){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 WS({children:e,className:t,...n}){return o.jsx("button",{type:"button",className:Ss(["react-flow__controls-button",t]),...n,children:e})}const C5e=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Gse({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":p}){const b=Ri(),{isInteractive:g,minZoomReached:O,maxZoomReached:y,ariaLabelConfig:v}=ar(C5e,ji),{zoomIn:x,zoomOut:w,fitView:S}=IA(),E=()=>{x(),s==null||s()},k=()=>{w(),a==null||a()},T=()=>{S(i),l==null||l()},C=()=>{b.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),c==null||c(!g)},N=h==="horizontal"?"horizontal":"vertical";return o.jsxs(RA,{className:Ss(["react-flow__controls",N,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":p??v["controls.ariaLabel"],children:[t&&o.jsxs(o.Fragment,{children:[o.jsx(WS,{onClick:E,className:"react-flow__controls-zoomin",title:v["controls.zoomIn.ariaLabel"],"aria-label":v["controls.zoomIn.ariaLabel"],disabled:y,children:o.jsx(E5e,{})}),o.jsx(WS,{onClick:k,className:"react-flow__controls-zoomout",title:v["controls.zoomOut.ariaLabel"],"aria-label":v["controls.zoomOut.ariaLabel"],disabled:O,children:o.jsx(k5e,{})})]}),n&&o.jsx(WS,{className:"react-flow__controls-fitview",onClick:T,title:v["controls.fitView.ariaLabel"],"aria-label":v["controls.fitView.ariaLabel"],children:o.jsx(T5e,{})}),r&&o.jsx(WS,{className:"react-flow__controls-interactive",onClick:C,title:v["controls.interactive.ariaLabel"],"aria-label":v["controls.interactive.ariaLabel"],children:g?o.jsx(A5e,{}):o.jsx(_5e,{})}),d]})}Gse.displayName="Controls";const N5e=m.memo(Gse);function j5e({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:p}){const{background:b,backgroundColor:g}=s||{},O=a||b||g;return o.jsx("rect",{className:Ss(["react-flow__minimap-node",{selected:h},u]),x:t,y:n,rx:d,ry:d,width:r,height:i,style:{fill:O,stroke:l,strokeWidth:c},shapeRendering:f,onClick:p?y=>p(y,e):void 0})}const R5e=m.memo(j5e),I5e=e=>e.nodes.map(t=>t.id),Kj=e=>e instanceof Function?e:()=>e;function D5e({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:s=R5e,onClick:a}){const l=ar(I5e,ji),c=Kj(t),u=Kj(e),d=Kj(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return o.jsx(o.Fragment,{children:l.map(h=>o.jsx(M5e,{id:h,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:s,onClick:a,shapeRendering:f},h))})}function P5e({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:p}=ar(b=>{const g=b.nodeLookup.get(e);if(!g)return{node:void 0,x:0,y:0,width:0,height:0};const O=g.internals.userNode,{x:y,y:v}=g.internals.positionAbsolute,{width:x,height:w}=of(O);return{node:O,x:y,y:v,width:x,height:w}},ji);return!u||u.hidden||!M6(u)?null:o.jsx(l,{x:d,y:f,width:h,height:p,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 M5e=m.memo(P5e);var L5e=m.memo(D5e);const $5e=200,B5e=150,Q5e=e=>!e.hidden,F5e=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?zie(rw(e.nodeLookup,{filter:Q5e}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},U5e="react-flow__minimap-desc";function Yse({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:p,onNodeClick:b,pannable:g=!1,zoomable:O=!1,ariaLabel:y,inversePan:v,zoomStep:x=1,offsetScale:w=5}){const S=Ri(),E=m.useRef(null),{boundingRect:k,viewBB:T,rfId:C,panZoom:N,translateExtent:_,flowWidth:R,flowHeight:$,ariaLabelConfig:D}=ar(F5e,ji),M=(e==null?void 0:e.width)??$5e,j=(e==null?void 0:e.height)??B5e,P=k.width/M,L=k.height/j,U=Math.max(P,L),F=U*M,q=U*j,z=w*U,B=k.x-(F-k.width)/2-z,V=k.y-(q-k.height)/2-z,ce=F+z*2,we=q+z*2,Oe=`${U5e}-${C}`,de=m.useRef(0),Z=m.useRef();de.current=U,m.useEffect(()=>{if(E.current&&N)return Z.current=$Ie({domNode:E.current,panZoom:N,getTransform:()=>S.getState().transform,getViewScale:()=>de.current}),()=>{var je;(je=Z.current)==null||je.destroy()}},[N]),m.useEffect(()=>{var je;(je=Z.current)==null||je.update({translateExtent:_,width:R,height:$,inversePan:v,pannable:g,zoomStep:x,zoomable:O})},[g,O,v,x,_,R,$]);const J=p?je=>{var le;const[Qe,Me]=((le=Z.current)==null?void 0:le.pointer(je))||[0,0];p(je,{x:Qe,y:Me})}:void 0,fe=b?m.useCallback((je,Qe)=>{const Me=S.getState().nodeLookup.get(Qe).internals.userNode;b(je,Me)},[]):void 0,be=y??D["minimap.ariaLabel"];return o.jsx(RA,{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*U: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:Ss(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:o.jsxs("svg",{width:M,height:j,viewBox:`${B} ${V} ${ce} ${we}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Oe,ref:E,onClick:J,children:[be&&o.jsx("title",{id:Oe,children:be}),o.jsx(L5e,{onClick:fe,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${ce+z*2}v${we+z*2}h${-ce-z*2}z + M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Yse.displayName="MiniMap";m.memo(Yse);const z5e=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,V5e={[Ib.Line]:"right",[Ib.Handle]:"bottom-right"};function q5e({nodeId:e,position:t,variant:n=Ib.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:p=!0,shouldResize:b,onResizeStart:g,onResize:O,onResizeEnd:y}){const v=Tse(),x=typeof e=="string"?e:v,w=Ri(),S=m.useRef(null),E=n===Ib.Handle,k=ar(m.useCallback(z5e(E&&p),[E,p]),ji),T=m.useRef(null),C=t??V5e[n];m.useEffect(()=>{if(!(!S.current||!x))return T.current||(T.current=ZIe({domNode:S.current,nodeId:x,getStoreItems:()=>{const{nodeLookup:_,transform:R,snapGrid:$,snapToGrid:D,nodeOrigin:M,domNode:j}=w.getState();return{nodeLookup:_,transform:R,snapGrid:$,snapToGrid:D,nodeOrigin:M,paneDomNode:j}},onChange:(_,R)=>{const{triggerNodeChanges:$,nodeLookup:D,parentLookup:M,nodeOrigin:j}=w.getState(),P=[],L={x:_.x,y:_.y},U=D.get(x);if(U&&U.expandParent&&U.parentId){const F=U.origin??j,q=_.width??U.measured.width??0,z=_.height??U.measured.height??0,B={id:U.id,parentId:U.parentId,rect:{width:q,height:z,...qie({x:_.x??U.position.x,y:_.y??U.position.y},{width:q,height:z},U.parentId,D,F)}},V=U6([B],D,M,j);P.push(...V),L.x=_.x?Math.max(F[0]*q,_.x):void 0,L.y=_.y?Math.max(F[1]*z,_.y):void 0}if(L.x!==void 0&&L.y!==void 0){const F={id:x,type:"position",position:{...L}};P.push(F)}if(_.width!==void 0&&_.height!==void 0){const q={id:x,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:_.width,height:_.height}};P.push(q)}for(const F of R){const q={...F,type:"position"};P.push(q)}$(P)},onEnd:({width:_,height:R})=>{const $={id:x,type:"dimensions",resizing:!1,dimensions:{width:_,height:R}};w.getState().triggerNodeChanges([$])}})),T.current.update({controlPosition:C,boundaries:{minWidth:l,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:h,onResizeStart:g,onResize:O,onResizeEnd:y,shouldResize:b}),()=>{var _;(_=T.current)==null||_.destroy()}},[C,l,c,u,d,f,g,O,y,b]);const N=C.split("-");return o.jsx("div",{className:Ss(["react-flow__resize-control","nodrag",...N,n,r]),ref:S,style:{...i,scale:k,...a&&{[E?"backgroundColor":"borderColor"]:a}},children:s})}m.memo(q5e);var Wse=Object.defineProperty,H5e=(e,t,n)=>t in e?Wse(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,X5e=(e,t)=>{for(var n in t)Wse(e,n,{get:t[n],enumerable:!0})},G5e=(e,t,n)=>H5e(e,t+"",n),Zse={};X5e(Zse,{Graph:()=>Hl,alg:()=>V6,json:()=>Jse,version:()=>Z5e});var Y5e=Object.defineProperty,Kse=(e,t)=>{for(var n in t)Y5e(e,n,{get:t[n],enumerable:!0})},Hl=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=n1(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=W5e(this._isDirected,s,a,l);return s=f.v,a=f.w,Object.freeze(f),this._edgeObjs[d]=f,pz(this._preds[a],s),pz(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?Jj(this._isDirected,t):n1(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?Jj(this._isDirected,t):n1(this._isDirected,t,n,r))in this._edgeLabels}removeEdge(t,n,r){let i=arguments.length===1?Jj(this._isDirected,t):n1(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],mz(this._preds[l],a),mz(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 pz(e,t){e[t]?e[t]++:e[t]=1}function mz(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function n1(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 W5e(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 Jj(e,t){return n1(e,t.v,t.w,t.name)}var Z5e="4.0.1",Jse={};Kse(Jse,{read:()=>tMe,write:()=>K5e});function K5e(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:J5e(e),edges:eMe(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function J5e(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 eMe(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 tMe(e){let t=new Hl(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 V6={};Kse(V6,{CycleException:()=>v2,bellmanFord:()=>eae,components:()=>iMe,dijkstra:()=>x2,dijkstraAll:()=>oMe,findCycles:()=>lMe,floydWarshall:()=>uMe,isAcyclic:()=>fMe,postorder:()=>pMe,preorder:()=>mMe,prim:()=>gMe,shortestPaths:()=>bMe,tarjan:()=>nae,topsort:()=>rae});var nMe=()=>1;function eae(e,t,n,r){return rMe(e,String(t),n||nMe,r||function(i){return e.outEdges(i)})}function rMe(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 x2(e,t,n,r){let i=function(s){return e.outEdges(s)};return aMe(e,String(t),n||sMe,r||i)}function aMe(e,t,n,r){let i={},s=new tae,a,l,c=function(u){let d=u.v!==a?u.v:u.w,f=i[d],h=n(u),p=l.distance+h;if(h<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+h);p0&&(a=s.removeMin(),l=i[a],l.distance!==Number.POSITIVE_INFINITY);)r(a).forEach(c);return i}function oMe(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=x2(e,i,t,n),r},{})}function nae(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 lMe(e){return nae(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var cMe=()=>1;function uMe(e,t,n){return dMe(e,t||cMe,n||function(r){return e.outEdges(r)})}function dMe(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],p=d.distance+f.distance;p{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=iae(e,l,n==="post",a,s,r,i)}),i}function iae(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=iae(e,l,n,r,i,s,a)}),n&&(a=s(a,t))),a}function sae(e,t,n){return hMe(e,t,n,function(r,i){return r.push(i),r},[])}function pMe(e,t){return sae(e,t,"post")}function mMe(e,t){return sae(e,t,"pre")}function gMe(e,t){let n=new Hl,r={},i=new tae,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 bMe(e,t,n,r){return OMe(e,t,n,r??(i=>{let s=e.outEdges(i);return s??[]}))}function OMe(e,t,n,r){if(n===void 0)return x2(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 aae(e){let t=new Hl({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 gz(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 aw(e){let t=Ux(lae(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 xMe(e){let t=e.nodes().map(r=>{let i=e.node(r).rank;return i===void 0?Number.MAX_VALUE:i}),n=fu(Math.min,t);e.nodes().forEach(r=>{let i=e.node(r);Object.hasOwn(i,"rank")&&(i.rank-=n)})}function vMe(e){let t=e.nodes().map(a=>e.node(a).rank).filter(a=>a!==void 0),n=fu(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 bz(e,t,n,r){let i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),xO(e,"border",i,t)}function wMe(e,t=oae){let n=[];for(let r=0;roae){let n=wMe(t);return e(...n.map(r=>e(...r)))}else return e(...t)}function lae(e){let t=e.nodes().map(n=>{let r=e.node(n).rank;return r===void 0?Number.MIN_VALUE:r});return fu(Math.max,t)}function SMe(e,t){let n={lhs:[],rhs:[]};return e.forEach(r=>{t(r)?n.lhs.push(r):n.rhs.push(r)}),n}function cae(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function uae(e,t){return t()}var EMe=0;function q6(e){let t=++EMe;return e+(""+t)}function Ux(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 kMe(e,t){return e.reduce((n,r,i)=>(n[r]=t[i],n),{})}var MA="\0",TMe="3.0.0",_Me=class{constructor(){G5e(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return Oz(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&Oz(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,AMe)),n=n._prev;return"["+e.join(", ")+"]"}};function Oz(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function AMe(e,t){if(e!=="_next"&&e!=="_prev")return t}var CMe=_Me,NMe=()=>1;function jMe(e,t){if(e.nodeCount()<=1)return[];let n=IMe(e,t||NMe);return RMe(n.graph,n.buckets,n.zeroIdx).flatMap(r=>e.outEdges(r.v,r.w)||[])}function RMe(e,t,n){var r;let i=[],s=t[t.length-1],a=t[0],l;for(;e.nodeCount();){for(;l=a.dequeue();)eR(e,t,n,l);for(;l=s.dequeue();)eR(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(eR(e,t,n,l,!0)||[]);break}}}return i}function eR(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,M5(t,n,u)}),(e.outEdges(r.v)||[]).forEach(l=>{let c=e.edge(l),u=l.w,d=e.node(u);d.in-=c,M5(t,n,d)}),e.removeNode(r.v),a}function IMe(e,t){let n=new Hl,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=DMe(i+r+3).map(()=>new CMe),a=r+1;return n.nodes().forEach(l=>{M5(s,a,n.node(l))}),{graph:n,buckets:s,zeroIdx:a}}function M5(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 DMe(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,q6("rev"))});function t(n){return r=>n.edge(r).weight}}function MMe(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 LMe(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 $Me(e){e.graph().dummyChains=[],e.edges().forEach(t=>BMe(e,t))}function BMe(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 H6(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=fu(Math.min,a);return l===Number.POSITIVE_INFINITY&&(l=0),i.rank=l}e.sources().forEach(n)}function Pb(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var dae=FMe;function FMe(e){let t=new Hl({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(;UMe(t,e){let a=s.v,l=r===a?s.w:a;!e.hasNode(l)&&!Pb(t,s)&&(e.setNode(l,{}),e.setEdge(r,l,{}),n(l))})}return e.nodes().forEach(n),e.nodeCount()}function zMe(e,t){return t.edges().reduce((n,r)=>{let i=Number.POSITIVE_INFINITY;return e.hasNode(r.v)!==e.hasNode(r.w)&&(i=Pb(t,r)),it.node(r).rank+=n)}var{preorder:qMe,postorder:HMe}=V6,XMe=Xm;Xm.initLowLimValues=G6;Xm.initCutValues=X6;Xm.calcCutValue=fae;Xm.leaveEdge=pae;Xm.enterEdge=mae;Xm.exchangeEdges=gae;function Xm(e){e=yMe(e),H6(e);let t=dae(e);G6(t),X6(t,e);let n,r;for(;n=pae(t);)r=mae(t,e,n),gae(t,e,n,r)}function X6(e,t){let n=HMe(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(r=>GMe(e,t,r))}function GMe(e,t,n){let r=e.node(n).parent,i=e.edge(n,r);i.cutvalue=fae(e,t,n)}function fae(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,WMe(e,n,d)){let p=e.edge(n,d).cutvalue;a+=f?-p:p}}}),a}function G6(e,t){arguments.length<2&&(t=e.nodes()[0]),hae(e,{},1,t)}function hae(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=hae(e,t,n,c,r))}),a.low=s,a.lim=n++,i?a.parent=i:delete a.parent,n}function pae(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function mae(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===yz(e,e.node(u.v),l)&&c!==yz(e,e.node(u.w),l)).reduce((u,d)=>Pb(t,d)!e.node(i).parent);if(!n)return;let r=qMe(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 WMe(e,t,n){return e.hasEdge(t,n)}function yz(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var ZMe=KMe;function KMe(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":xz(e);break;case"tight-tree":e3e(e);break;case"longest-path":JMe(e);break;case"none":break;default:xz(e)}}var JMe=H6;function e3e(e){H6(e),dae(e)}function xz(e){XMe(e)}var t3e=n3e;function n3e(e){let t=i3e(e);e.graph().dummyChains.forEach(n=>{let r=e.node(n),i=r.edgeObj,s=r3e(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 i3e(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(MA).forEach(r),t}function s3e(e){let t=xO(e,"root",{},"_root"),n=a3e(e),r=Object.values(n),i=fu(Math.max,r)-1,s=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(l=>e.edge(l).minlen*=s);let a=o3e(e)+1;e.children(MA).forEach(l=>bae(e,t,s,a,i,n,l)),e.graph().nodeRankFactor=s}function bae(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=bz(e,"_bt"),d=bz(e,"_bb"),f=e.node(a);e.setParent(u,a),f.borderTop=u,e.setParent(d,a),f.borderBottom=d,c.forEach(h=>{var p;bae(e,t,n,r,i,s,h);let b=e.node(h),g=b.borderTop?b.borderTop:h,O=b.borderBottom?b.borderBottom:h,y=b.borderTop?r:2*r,v=g!==O?1:i-((p=s[a])!=null?p:0)+1;e.setEdge(u,g,{weight:y,minlen:v,nestingEdge:!0}),e.setEdge(O,d,{weight:y,minlen:v,nestingEdge:!0})}),e.parent(a)||e.setEdge(t,u,{weight:0,minlen:i+((l=s[a])!=null?l:0)})}function a3e(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(MA).forEach(r=>n(r,1)),t}function o3e(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function l3e(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var c3e=u3e;function u3e(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;swz(e.node(t))),e.edges().forEach(t=>wz(e.edge(t)))}function wz(e){let t=e.width;e.width=e.height,e.height=t}function h3e(e){e.nodes().forEach(t=>tR(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(tR),Object.hasOwn(r,"y")&&tR(r)})}function tR(e){e.y=-e.y}function p3e(e){e.nodes().forEach(t=>nR(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(nR),Object.hasOwn(r,"x")&&nR(r)})}function nR(e){let t=e.x;e.x=e.y,e.y=t}function m3e(e){let t={},n=e.nodes().filter(l=>!e.children(l).length),r=n.map(l=>e.node(l).rank),i=fu(Math.max,r),s=Ux(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 g3e(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 O3e(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 y3e(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 x3e(r)}function x3e(e){let t=[];function n(i){return s=>{s.merged||(s.barycenter===void 0||i.barycenter===void 0||s.barycenter>=i.barycenter)&&v3e(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=>w2(i,["vs","i","barycenter","weight"]))}function v3e(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 w3e(e,t){let n=SMe(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(S3e(!!t)),c=Sz(s,i,c),r.forEach(d=>{c+=d.vs.length,s.push(d.vs),a+=d.barycenter*d.weight,l+=d.weight,c=Sz(s,i,c)});let u={vs:s.flat(1)};return l&&(u.barycenter=a/l,u.weight=l),u}function Sz(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 S3e(e){return(t,n)=>t.barycentern.barycenter?1:e?n.i-t.i:t.i-n.i}function yae(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=O3e(e,i);u.forEach(h=>{if(e.children(h.v).length){let p=yae(e,h.v,n,r);c[h.v]=p,Object.hasOwn(p,"barycenter")&&k3e(h,p)}});let d=y3e(u,n);E3e(d,c);let f=w3e(d,r);if(a&&l){f.vs=[a,f.vs,l].flat(1);let h=e.predecessors(a);if(h&&h.length){let p=e.node(h[0]),b=e.predecessors(l),g=e.node(b[0]);Object.hasOwn(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+p.order+g.order)/(f.weight+2),f.weight+=2}}return f}function E3e(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(r=>t[r]?t[r].vs:r)})}function k3e(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 T3e(e,t,n,r){r||(r=e.nodes());let i=_3e(e),s=new Hl({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),p=h!==void 0?h.weight:0;s.setEdge(f,a,{weight:e.edge(d).weight+p})}),Object.hasOwn(l,"minRank")&&s.setNode(a,{borderLeft:l.borderLeft[t],borderRight:l.borderRight[t]})}}),s}function _3e(e){let t;for(;e.hasNode(t=q6("_root")););return t}function A3e(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 xae(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,xae);return}let n=lae(e),r=Ez(e,Ux(1,n+1),"inEdges"),i=Ez(e,Ux(n-1,-1,-1),"outEdges"),s=m3e(e);if(kz(e,s),t.disableOptimalOrderHeuristic)return;let a=Number.POSITIVE_INFINITY,l,c=t.constraints||[];for(let u=0,d=0;d<4;++u,++d){C3e(u%2?r:i,u%4>=2,c),s=aw(e);let f=g3e(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 T3e(e,s,n,r.get(s)||[])})}function C3e(e,t,n){let r=new Hl;e.forEach(function(i){n.forEach(l=>r.setEdge(l.left,l.right));let s=i.graph().root,a=yae(i,s,r,t);a.vs.forEach((l,c)=>i.node(l).order=c),A3e(i,r,a.vs)})}function kz(e,t){Object.values(t).forEach(n=>n.forEach((r,i)=>e.node(r).order=i))}function N3e(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=R3e(e,d),p=h?e.node(h).order:c;(h||d===u)&&(s.slice(l,f+1).forEach(b=>{let g=e.predecessors(b);g&&g.forEach(O=>{let y=e.node(O),v=y.order;(v{let f=s[d];if(f!==void 0&&e.node(f).dummy){let h=e.predecessors(f);h&&h.forEach(p=>{if(p===void 0)return;let b=e.node(p);b.dummy&&(b.orderu)&&vae(n,p,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 p=h[0];if(p===void 0)return;c=e.node(p).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 R3e(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(r=>e.node(r).dummy)}}function vae(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 I3e(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 D3e(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((p,b)=>{let g=a[p],O=a[b];return(g!==void 0?g:0)-(O!==void 0?O:0)}),h=(f.length-1)/2;for(let p=Math.floor(h),b=Math.ceil(h);p<=b;++p){let g=f[p];if(g===void 0)continue;let O=a[g];if(O!==void 0&&s[u]===u&&c{var y;let v=(y=s[O.v])!=null?y:0,x=a.edge(O);return Math.max(g,v+(x!==void 0?x:0))},0):s[p]=0}function d(p){let b=a.outEdges(p),g=Number.POSITIVE_INFINITY;b&&(g=b.reduce((y,v)=>{let x=s[v.w],w=a.edge(v);return Math.min(y,(x!==void 0?x:0)-(w!==void 0?w:0))},Number.POSITIVE_INFINITY));let O=e.node(p);g!==Number.POSITIVE_INFINITY&&O.borderType!==l&&(s[p]=Math.max(s[p]!==void 0?s[p]:0,g))}function f(p){return a.predecessors(p)||[]}function h(p){return a.successors(p)||[]}return c(u,f),c(d,h),Object.keys(r).forEach(p=>{var b;let g=n[p];g!==void 0&&(s[p]=(b=s[g])!=null?b:0)}),s}function M3e(e,t,n,r){let i=new Hl,s=e.graph(),a=F3e(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 L3e(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=U3e(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-fu(Math.min,u);a!=="l"&&(d=i-fu(Math.max,u)),d&&(e[l]=PA(c,f=>f+d))})})}function B3e(e,t=void 0){let n=e.ul;return n?PA(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 Q3e(e){let t=aw(e),n=Object.assign(N3e(e,t),j3e(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=D3e(e,i,n,d=>(a==="u"?e.predecessors(d):e.successors(d))||[]),u=P3e(e,i,c.root,c.align,l==="r");l==="r"&&(u=PA(u,d=>-d)),r[a+l]=u})});let s=L3e(e,r);return $3e(r,s),B3e(r,e.graph().align)}function F3e(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 U3e(e,t){return e.node(t).width}function z3e(e){e=aae(e),V3e(e),Object.entries(Q3e(e)).forEach(([t,n])=>e.node(t).x=n)}function V3e(e){let t=aw(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 q3e(e,t={}){let n=t.debugTiming?cae:uae;return n("layout",()=>{let r=n(" buildLayoutGraph",()=>tLe(e));return n(" runLayout",()=>H3e(r,n,t)),n(" updateInputGraph",()=>X3e(e,r)),r})}function H3e(e,t,n){t(" makeSpaceForEdgeLabels",()=>nLe(e)),t(" removeSelfEdges",()=>dLe(e)),t(" acyclic",()=>PMe(e)),t(" nestingGraph.run",()=>s3e(e)),t(" rank",()=>ZMe(aae(e))),t(" injectEdgeLabelProxies",()=>rLe(e)),t(" removeEmptyRanks",()=>vMe(e)),t(" nestingGraph.cleanup",()=>l3e(e)),t(" normalizeRanks",()=>xMe(e)),t(" assignRankMinMax",()=>iLe(e)),t(" removeEdgeLabelProxies",()=>sLe(e)),t(" normalize.run",()=>$Me(e)),t(" parentDummyChains",()=>t3e(e)),t(" addBorderSegments",()=>c3e(e)),t(" order",()=>xae(e,n)),t(" insertSelfEdges",()=>fLe(e)),t(" adjustCoordinateSystem",()=>d3e(e)),t(" position",()=>z3e(e)),t(" positionSelfEdges",()=>hLe(e)),t(" removeBorderNodes",()=>uLe(e)),t(" normalize.undo",()=>QMe(e)),t(" fixupEdgeLabelCoords",()=>lLe(e)),t(" undoCoordinateSystem",()=>f3e(e)),t(" translateGraph",()=>aLe(e)),t(" assignNodeIntersects",()=>oLe(e)),t(" reversePoints",()=>cLe(e)),t(" acyclic.undo",()=>LMe(e))}function X3e(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 G3e=["nodesep","edgesep","ranksep","marginx","marginy"],Y3e={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},W3e=["acyclicer","ranker","rankdir","align","rankalign"],Z3e=["width","height","rank"],Tz={width:0,height:0},K3e=["minlen","weight","width","height","labeloffset"],J3e={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},eLe=["labelpos"];function tLe(e){let t=new Hl({multigraph:!0,compound:!0}),n=iR(e.graph());return t.setGraph(Object.assign({},Y3e,rR(n,G3e),w2(n,W3e))),e.nodes().forEach(r=>{let i=iR(e.node(r)),s=rR(i,Z3e);Object.keys(Tz).forEach(l=>{s[l]===void 0&&(s[l]=Tz[l])}),t.setNode(r,s);let a=e.parent(r);a!==void 0&&t.setParent(r,a)}),e.edges().forEach(r=>{let i=iR(e.edge(r));t.setEdge(r,Object.assign({},J3e,rR(i,K3e),w2(i,eLe)))}),t}function nLe(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 rLe(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};xO(e,"edge-proxy",i,"_ep")}})}function iLe(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 sLe(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 aLe(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,p=u.height;t=Math.min(t,d-h/2),n=Math.max(n,d+h/2),r=Math.min(r,f-p/2),i=Math.max(i,f+p/2)}e.nodes().forEach(u=>c(e.node(u))),e.edges().forEach(u=>{let d=e.edge(u);Object.hasOwn(d,"x")&&c(d)}),t-=a,r-=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 oLe(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(gz(r,s)),n.points.push(gz(i,a))})}function lLe(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 cLe(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function uLe(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 dLe(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 fLe(e){aw(e).forEach(t=>{let n=0;t.forEach((r,i)=>{let s=e.node(r);s.order=i+n,(s.selfEdges||[]).forEach(a=>{xO(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 hLe(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 rR(e,t){return PA(w2(e,t),Number)}function iR(e){let t={};return e&&Object.entries(e).forEach(([n,r])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=r}),t}function pLe(e){let t=aw(e),n=new Hl({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 mLe={graphlib:Zse,version:TMe,layout:q3e,debug:pLe,util:{time:cae,notime:uae}},_z=mLe;/*! For license information please see dagre.esm.js.LEGAL.txt */const r1={llm:{label:"智能体",description:"理解任务并直接完成一个具体工作",icon:Cne},sequential:{label:"分步协作",description:"内部步骤按照顺序依次执行",icon:K2e},parallel:{label:"同时处理",description:"内部步骤同时工作,完成后统一汇总",icon:M2e},loop:{label:"循环执行",description:"重复执行内部步骤,直到满足停止条件",icon:Lne},a2a:{label:"远程智能体",description:"调用已经存在的远程 Agent",icon:fA}},L5=220,$5=88,Az=96,Cz=34,B1=64,sR=310,w0=24,wae=56,B5=40,Nz=40,gLe=18,bLe=58,OLe=!1,yLe=e=>e==="sequential"||e==="parallel"||e==="loop";function Q5(e,t){const n=e.agentType??"llm";return yLe(n)||n==="llm"&&(t.length===0||e.subAgents.length>0)}function F5(e,t=[],n="horizontal",r=!1){const i=e.agentType??"llm";if(!Q5(e,t))return{width:L5,height:$5};if(r&&e.subAgents.length===0)return{width:sR,height:B1};const s=e.subAgents.map((f,h)=>F5(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"?wae:w0,u=n==="horizontal"?i!=="parallel":i==="parallel",d=s.length?i==="parallel"?gLe+Nz:i==="loop"?bLe:0:Nz;return u?{width:Math.max(sR,s.reduce((f,h)=>f+h.width,0)+B5*Math.max(0,s.length-1)+c*2),height:B1+w0+l+d+w0}:{width:Math.max(sR,a+w0*2),height:B1+c+s.reduce((f,h)=>f+h.height,0)+B5*Math.max(0,s.length-1)+d+c}}function xy(e){return e.length===0?"agent-root":`agent-${e.join("-")}`}function xLe(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function jz(e){const t=n=>[n.agentType??"llm",n.subAgents.map(t)];return JSON.stringify(t(e))}function vy(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:$x.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 Rz(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,p,b){const g=d.agentType??"llm",O=xy(f);return Q5(d,f)?(a(d,f,h,p,b),O):(r.push({id:O,type:"agent",parentId:h,extent:"parent",position:p,data:{kind:"agent",path:f,agent:d,title:g==="a2a"?"远程智能体":d.name.trim()||(f.length===0?"主 Agent":"未命名步骤"),pattern:g,description:d.description.trim()||r1[g].description,childCount:d.subAgents.length,containedIn:b}}),O)}function a(d,f,h,p={x:0,y:0},b){const g=d.agentType??"sequential",O=xy(f),y=F5(d,f,t,n);r.push({id:O,type:"group",parentId:h,extent:h?"parent":void 0,position:p,style:{width:y.width,height:y.height},data:{kind:"agent",path:f,agent:d,title:d.name.trim()||(f.length===0?"主 Agent":r1[g].label),pattern:g,description:d.description.trim()||r1[g].description,childCount:d.subAgents.length,containedIn:b,layoutWidth:y.width,layoutHeight:y.height,compactEmptyGroup:n&&d.subAgents.length===0}});const v=d.subAgents.map((k,T)=>F5(k,[...f,T],t,n)),x=v.length&&g!=="parallel"?wae:w0,w=t==="horizontal"?g!=="parallel":g==="parallel";let S=x;const E=d.subAgents.map((k,T)=>{const C=v[T],N=w?{x:S,y:B1+w0}:{x:(y.width-C.width)/2,y:B1+S};return S+=(w?C.width:C.height)+B5,s(k,[...f,T],O,N,g)});if(g==="sequential"||g==="loop"){for(let k=0;k1&&i.push(vy(E[E.length-1],E[0],"继续循环",{loop:!0,tone:"loop"}))}return O}const l=(d,f)=>{const h=d.agentType??"llm",p=xy(f);if(Q5(d,f))return a(d,f),[p];if(r.push({id:p,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()||r1[h].description,childCount:d.subAgents.length}}),d.subAgents.length===0)return[p];const b=[];return d.subAgents.forEach((g,O)=>{const y=[...f,O],v=xy(y);i.push(vy(p,v,"调用",{insert:{parentPath:f,index:O}})),b.push(...l(g,y))}),b},c=xy([]),u=l(e,[]);return i.push(vy("terminal-input",c)),u.forEach(d=>i.push(vy(d,"terminal-output"))),vLe(r,i,t)}function vLe(e,t,n){const r=new _z.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?Az:s.data.layoutWidth??L5,height:a?Cz:s.data.layoutHeight??$5})}),t.filter(s=>i.has(s.source)&&i.has(s.target)).forEach(s=>r.setEdge(s.source,s.target)),_z.layout(r),{nodes:e.map(s=>{if(s.parentId)return s;const a=r.node(s.id),l=s.data.kind==="terminal",c=l?Az:s.data.layoutWidth??L5,u=l?Cz:s.data.layoutHeight??$5;return{...s,position:{x:a.x-c/2,y:a.y-u/2}}}),edges:t}}const LA=m.createContext(null),$A=m.createContext("horizontal");function wLe({id:e,sourceX:t,sourceY:n,targetX:r,targetY:i,sourcePosition:s,targetPosition:a,markerEnd:l,style:c,label:u,data:d}){const f=m.useContext(LA),[h,p]=m.useState(!1),[b,g,O]=O2({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(sw,{id:e,path:b,markerEnd:l,style:c}),f&&(d==null?void 0:d.insert)&&o.jsx("path",{d:b,className:"abc-edge-hover-path",onPointerEnter:()=>p(!0),onPointerLeave:()=>p(!1)}),(u||f&&(d==null?void 0:d.insert))&&o.jsx(p5e,{children:o.jsxs("div",{className:`abc-edge-tools${f&&(d!=null&&d.insert)?" can-insert":""}${h?" is-visible":""}`,style:{transform:`translate(-50%, -50%) translate(${g}px, ${O}px)`},onPointerEnter:()=>p(!0),onPointerLeave:()=>p(!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:y=>{y.stopPropagation(),f==null||f.onInsert(d.insert.parentPath,d.insert.index)},children:o.jsx(qa,{})})]})})]})}function SLe({data:e,selected:t}){const n=m.useContext(LA),r=m.useContext($A),i=r==="vertical"?Nt.Top:Nt.Left,s=r==="vertical"?Nt.Bottom:Nt.Right,a=r==="vertical"?Nt.Right:Nt.Bottom,l=e.pattern??"llm",c=r1[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(Rh,{})}),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 ELe({data:e,selected:t}){const n=m.useContext(LA),r=m.useContext($A),i=r==="vertical"?Nt.Top:Nt.Left,s=r==="vertical"?Nt.Bottom:Nt.Right,a=r==="vertical"?Nt.Right:Nt.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(qa,{})}),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(qa,{})})]}),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(qa,{}),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(qa,{}),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(Rh,{})}),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 kLe({data:e}){const t=m.useContext($A);return o.jsxs("div",{className:"abc-terminal",children:[o.jsx(ho,{type:"target",position:t==="vertical"?Nt.Top:Nt.Left,className:"abc-handle"}),o.jsx("span",{children:e.title}),o.jsx(ho,{type:"source",position:t==="vertical"?Nt.Bottom:Nt.Right,className:"abc-handle"})]})}const TLe={agent:SLe,group:ELe,terminal:kLe},_Le={insertStep:wLe};function ALe({draft:e,selectedPath:t,onSelect:n,onAdd:r,onInsert:i,onDelete:s,readOnly:a=!1,interactivePreview:l=!1,direction:c="horizontal"}){const u=m.useMemo(()=>Rz(e,c,a),[]),[d,f,h]=m5e(u.nodes),[p,b,g]=g5e(u.edges),O=O5e(),y=m.useRef(`${c}:${a?"readonly":"editable"}:${jz(e)}`),v=m.useRef(null),{fitView:x}=IA(),w=m.useMemo(()=>Rz(e,c,a),[c,e,a]),[S,E]=m.useState(()=>window.matchMedia("(max-width: 860px)").matches),k=m.useMemo(()=>a?{padding:.16,minZoom:.05,maxZoom:.9}:S?{padding:.08,minZoom:.35,maxZoom:.9}:{padding:.14,minZoom:.42,maxZoom:1.1},[S,a]),T=m.useCallback((N=0)=>{window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{const _=v.current;if(_&&(_.clientWidth===0||_.clientHeight===0)&&N<8){T(N+1);return}x(k)})})},[k,x]);m.useEffect(()=>{const N=window.matchMedia("(max-width: 860px)"),_=R=>E(R.matches);return N.addEventListener("change",_),()=>N.removeEventListener("change",_)},[]),m.useEffect(()=>{const N=`${c}:${a?"readonly":"editable"}:${jz(e)}`,_=N!==y.current;y.current=N,b(w.edges),f(R=>{const $=new Map(R.map(D=>[D.id,D]));return w.nodes.map(D=>{const M=$.get(D.id);return{...D,measured:!_&&M&&M.type===D.type?M.measured:void 0,position:!_&&M?M.position:D.position,selected:D.data.kind==="agent"&&!!D.data.path&&xLe(D.data.path,t)}})}),_&&T()},[w,e,T,t,b,f]),m.useEffect(()=>{T()},[S,T]),m.useEffect(()=>{O&&T()},[w,T,O]),m.useEffect(()=>{if(!a||!v.current)return;const N=new ResizeObserver(()=>T());return N.observe(v.current),T(),()=>N.disconnect()},[T,a]);const C=m.useMemo(()=>a?null:{onAdd:r,onInsert:i,onDelete:s},[r,s,i,a]);return o.jsx($A.Provider,{value:c,children:o.jsx(LA.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(f5e,{nodes:d,edges:p,nodeTypes:TLe,edgeTypes:_Le,onNodesChange:h,onEdgesChange:g,onNodeClick:(N,_)=>{!a&&_.data.kind==="agent"&&_.data.path&&n(_.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:()=>T(),minZoom:a?.05:.35,maxZoom:1.6,proOptions:{hideAttribution:!0},children:[o.jsx(S5e,{gap:20,size:1.2,color:"hsl(34 20% 82%)"}),(!a||l)&&o.jsx(N5e,{showInteractive:!1}),OLe]})})})})})}function zx(e){return o.jsx(Hse,{children:o.jsx(ALe,{...e})})}const CLe="https://ark.cn-beijing.volces.com/api/v3/",$k=[{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:CLe}],S2=[],E2={label:"控制台",url:"https://console.volcengine.com/vikingdb/openviking"},NLe={label:"文档",url:"https://github.com/volcengine/OpenViking/blob/main/docs/zh/api/05-sessions.md"},Sae="https://api.vikingdb.cn-beijing.volces.com/openviking",jLe=`{ "self": {"enabled": true}, "peer": {"enabled": true}, "working_memory": {"enabled": true}, "memory_types": null -}`,NLe=[{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}],jLe=[{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}],vy=[{key:"FEISHU_APP_ID",required:!0,placeholder:"cli_xxx",comment:"飞书应用 App ID"},{key:"FEISHU_APP_SECRET",required:!0,placeholder:"输入 App Secret",comment:"飞书应用 App Secret"}],xc={topK:"3",region:"cn-beijing",endpoint:"https://open.volcengineapi.com/"},wae=[{key:"REGISTRY_SPACE_ID",required:!0,placeholder:"请选择智能体中心",comment:"AgentKit 智能体中心"},{key:"REGISTRY_TOP_K",required:!1,placeholder:xc.topK,comment:"召回 Agent 数量"},{key:"REGISTRY_REGION",required:!1,placeholder:xc.region,comment:"AgentKit 智能体中心地域"},{key:"REGISTRY_ENDPOINT",required:!1,placeholder:xc.endpoint,comment:"AgentKit 智能体中心 OpenAPI 地址"}],xO=[{id:"web_search",label:"联网搜索",desc:"火山引擎 Web Search,获取实时信息。",importLine:"from veadk.tools.builtin_tools.web_search import web_search",toolNames:["web_search"],env:v2},{id:"parallel_web_search",label:"并行联网搜索",desc:"并行发起多条搜索查询,更快汇总。",importLine:"from veadk.tools.builtin_tools.parallel_web_search import parallel_web_search",toolNames:["parallel_web_search"],env:v2},{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"}]}],RLe=new Set(["web_scraper","text_to_speech","vesearch"]),ILe=new Set(["web_search","parallel_web_search"]),DLe=xO.filter(e=>!RLe.has(e.id));function Sae(e="volcengine"){const t=e==="byteplus"?ILe:new Set;return DLe.filter(n=>!t.has(n.id))}const QP=[{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}]}],FP=[{id:"local",label:"本地向量库",desc:"进程内 llama-index 向量库。",env:Mk,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},...Mk],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},...Mk],pipExtra:"extensions",needsEmbedding:!0},{id:"viking",label:"VikingDB Memory",desc:"VikingDB 记忆库(支持用户画像)。",env:jLe},{id:"openviking",label:"OpenViking Memory",desc:"OpenViking 长期记忆,按用户维度保存和检索偏好、事件与实体。",env:[{key:"DATABASE_OPENVIKING_URL",required:!0,placeholder:vae,comment:"OpenViking 服务地址",link:w2},{key:"DATABASE_OPENVIKING_API_KEY",required:!0,comment:"OpenViking API Key",link:w2},{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:CLe,comment:"记忆策略",multiline:!0,format:"json",help:"记忆的抽取策略和隔离策略,不填写时使用官方默认策略。",link:ALe}]},{id:"mem0",label:"Mem0",desc:"Mem0 托管记忆服务。",env:[{key:"DATABASE_MEM0_API_KEY",required:!0},{key:"DATABASE_MEM0_BASE_URL",required:!1}],pipExtra:"database"}],xh="viking",UP=[{id:"viking",label:"VikingDB Knowledge",desc:"VikingDB 知识库。",env:NLe},{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},...Mk],pipExtra:"extensions",needsEmbedding:!0},{id:"context_search",label:"Context Search",desc:"火山 Context Search 引擎(无需向量化)。",env:[...v2,{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:vae,comment:"OpenViking 服务地址",link:w2},{key:"DATABASE_OPENVIKING_API_KEY",required:!0,comment:"OpenViking API Key",link:w2},{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 资源目录,优先级最高。"}]}],PLe=[{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:[...v2,{key:"OBSERVABILITY_OPENTELEMETRY_TLS_SERVICE_NAME",required:!1,comment:"TLS topic_id,留空自动创建"}]}],Eae=65536,MLe="一个基于 VeADK 构建的智能助手,理解用户意图并调用合适的工具完成任务。",LLe=`你是一个专业、可靠的智能助手。 +}`,RLe=[{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}],ILe=[{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}],wy=[{key:"FEISHU_APP_ID",required:!0,placeholder:"cli_xxx",comment:"飞书应用 App ID"},{key:"FEISHU_APP_SECRET",required:!0,placeholder:"输入 App Secret",comment:"飞书应用 App Secret"}],xc={topK:"3",region:"cn-beijing",endpoint:"https://open.volcengineapi.com/"},Eae=[{key:"REGISTRY_SPACE_ID",required:!0,placeholder:"请选择智能体中心",comment:"AgentKit 智能体中心"},{key:"REGISTRY_TOP_K",required:!1,placeholder:xc.topK,comment:"召回 Agent 数量"},{key:"REGISTRY_REGION",required:!1,placeholder:xc.region,comment:"AgentKit 智能体中心地域"},{key:"REGISTRY_ENDPOINT",required:!1,placeholder:xc.endpoint,comment:"AgentKit 智能体中心 OpenAPI 地址"}],vO=[{id:"web_search",label:"联网搜索",desc:"火山引擎 Web Search,获取实时信息。",importLine:"from veadk.tools.builtin_tools.web_search import web_search",toolNames:["web_search"],env:S2},{id:"parallel_web_search",label:"并行联网搜索",desc:"并行发起多条搜索查询,更快汇总。",importLine:"from veadk.tools.builtin_tools.parallel_web_search import parallel_web_search",toolNames:["parallel_web_search"],env:S2},{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"}]}],DLe=new Set(["web_scraper","text_to_speech","vesearch"]),PLe=new Set(["web_search","parallel_web_search"]),MLe=vO.filter(e=>!DLe.has(e.id));function kae(e="volcengine"){const t=e==="byteplus"?PLe:new Set;return MLe.filter(n=>!t.has(n.id))}const U5=[{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}]}],z5=[{id:"local",label:"本地向量库",desc:"进程内 llama-index 向量库。",env:$k,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},...$k],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},...$k],pipExtra:"extensions",needsEmbedding:!0},{id:"viking",label:"VikingDB Memory",desc:"VikingDB 记忆库(支持用户画像)。",env:ILe},{id:"openviking",label:"OpenViking Memory",desc:"OpenViking 长期记忆,按用户维度保存和检索偏好、事件与实体。",env:[{key:"DATABASE_OPENVIKING_URL",required:!0,placeholder:Sae,comment:"OpenViking 服务地址",link:E2},{key:"DATABASE_OPENVIKING_API_KEY",required:!0,comment:"OpenViking API Key",link:E2},{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:jLe,comment:"记忆策略",multiline:!0,format:"json",help:"记忆的抽取策略和隔离策略,不填写时使用官方默认策略。",link:NLe}]},{id:"mem0",label:"Mem0",desc:"Mem0 托管记忆服务。",env:[{key:"DATABASE_MEM0_API_KEY",required:!0},{key:"DATABASE_MEM0_BASE_URL",required:!1}],pipExtra:"database"}],xh="viking",V5=[{id:"viking",label:"VikingDB Knowledge",desc:"VikingDB 知识库。",env:RLe},{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},...$k],pipExtra:"extensions",needsEmbedding:!0},{id:"context_search",label:"Context Search",desc:"火山 Context Search 引擎(无需向量化)。",env:[...S2,{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:Sae,comment:"OpenViking 服务地址",link:E2},{key:"DATABASE_OPENVIKING_API_KEY",required:!0,comment:"OpenViking API Key",link:E2},{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 资源目录,优先级最高。"}]}],LLe=[{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:[...S2,{key:"OBSERVABILITY_OPENTELEMETRY_TLS_SERVICE_NAME",required:!1,comment:"TLS topic_id,留空自动创建"}]}],Tae=65536,$Le="一个基于 VeADK 构建的智能助手,理解用户意图并调用合适的工具完成任务。",BLe=`你是一个专业、可靠的智能助手。 你的目标是准确理解用户的需求,并给出条理清晰、简洁有用的回答。 约束: - 信息不足时主动提问澄清,不要臆造事实。 - 需要时合理调用可用的工具,并说明关键结论。 -- 保持礼貌、专业的语气。`;function rl(e="volcengine"){return{name:"",description:MLe,instruction:LLe,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:wm(e),modelSource:"ark",modelProvider:"",modelApiBase:"",shortTermBackend:"local",longTermBackend:"local",longTermMemoryIndex:"",autoSaveSession:!1,knowledgebaseBackend:xh,knowledgebaseIndex:"",tracingExporters:[],selectedSkills:[],cloudEnvironment:{cliTools:[]},deployment:{feishuEnabled:!1,modelApiKeyId:"",modelApiKeyName:""}}}function Xm(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 X6(e){return Xm(e).modelName}function kae(e,t,n){var s,a,l;const r=Xm((t==null?void 0:t.model)||(n==null?void 0:n.model)),i=(t==null?void 0:t.children)??[];return{...e,name:((s=t==null?void 0:t.name)==null?void 0:s.trim())||((a=n==null?void 0:n.name)==null?void 0:a.trim())||e.name,description:(t==null?void 0:t.description)??e.description,instruction:(t==null?void 0:t.instruction)??e.instruction,agentType:(t==null?void 0:t.type)??e.agentType,modelName:r.modelName||e.modelName,modelProvider:r.modelProvider||e.modelProvider,skills:((l=t==null?void 0:t.skills)==null?void 0:l.map(c=>c.name))??e.skills,subAgents:e.subAgents.map((c,u)=>kae(c,i[u]))}}function zP(e,t){var c,u,d;const n=e.cloudProvider??t,r=rl(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,subAgents:(e.subAgents??[]).map(f=>zP(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:zP(f.agent,n)}))}}:{}}}function Tae(e,t){var l,c;const n=rl(t),r=[...e.tools??[]],i=xO.filter(u=>u.toolNames.some(d=>r.includes(d))),s=new Set(i.flatMap(u=>u.toolNames)),a=Xm(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=>Tae(u,t))}}function G6(e,t){var s,a,l,c;const n=((s=e.draft)==null?void 0:s.cloudProvider)??t,r=Xm(e.model),i=e.draft?zP(e.draft,n):e.graph?Tae(e.graph,n):{...rl(n),modelSource:void 0,name:((a=e.name)==null?void 0:a.trim())||e.appName.trim(),description:e.description??"",instruction:e.instruction||rl(n).instruction,agentType:e.type??"llm",modelName:r.modelName,modelProvider:r.modelProvider,tools:[...e.tools??[]],skills:((l=e.skills)==null?void 0:l.map(u=>u.name))??[]};return kae(i,e.graph,{name:((c=e.name)==null?void 0:c.trim())||e.appName.trim(),model:e.model})}function $Le(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 jz({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 BLe={coding:"智能编程",get_city_weather:"城市天气查询",get_location_weather:"位置天气查询",web_fetch:"网页内容获取"};function _ae(e){const t=xO.find(n=>n.id===e||n.toolNames.includes(e));return BLe[e]??(t==null?void 0:t.label)??e}function QLe(){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 FLe(){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 ULe({agentName:e,tools:t,selectedIds:n,loading:r,disabled:i,unavailableReason:s,onChange:a,onClose:l}){const[c,u]=m.useState(""),d=m.useMemo(()=>new Set(n),[n]),f=m.useRef(`studio-tool-${Math.random().toString(36).slice(2)}`),h=m.useMemo(()=>{const b=c.trim().toLowerCase();return b?t.filter(g=>`${g.name} ${g.id} ${g.description}`.toLowerCase().includes(b)):t},[c,t]);m.useEffect(()=>{const b=document.body.style.overflow;document.body.style.overflow="hidden";const g=O=>{O.key==="Escape"&&l()};return document.addEventListener("keydown",g),()=>{document.removeEventListener("keydown",g),document.body.style.overflow=b}},[l]);const p=b=>{const g=new Set(d);g.has(b)?g.delete(b):g.add(b),a([...g])};return ii.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(jz,{})}),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(QLe,{})})]}),o.jsxs("div",{className:"studio-tool-dialog-body",children:[o.jsxs("label",{className:"studio-tool-search",children:[o.jsx(FLe,{}),o.jsx("input",{value:c,"aria-label":"搜索 Studio 工具",placeholder:"搜索中文名称或工具标识",autoFocus:!0,onChange:b=>u(b.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(b=>{const g=d.has(b.id);return o.jsxs("article",{className:"studio-tool-option",role:"listitem",children:[o.jsx("span",{className:"studio-tool-option-icon",children:o.jsx(jz,{})}),o.jsxs("span",{className:"studio-tool-option-copy",children:[o.jsx("strong",{children:b.name||_ae(b.id)}),o.jsx("code",{children:b.id}),o.jsx("span",{children:b.description})]}),o.jsx("button",{type:"button",disabled:i,"aria-pressed":g,onClick:()=>p(b.id),children:g?"移除":"添加"})]},b.id)})})]})]})]}),document.body)}function Ln({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})}function Aae(e){return 1+e.children.reduce((t,n)=>t+Aae(n),0)}function Cae(e){return e.id||e.name}function zLe(e,t){const n=Cae(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 Nae(e,t=!0){return{...e,id:Cae(e),name:zLe(e,t),children:e.children.map(n=>Nae(n,!1))}}function jae(e){const t=rl(),n=Xm(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(jae)}}function VLe(e){return[...new Set(e.map(t=>t.trim()).filter(Boolean))]}function qLe(e){return[...new Map(e.filter(t=>t.name.trim()).map(t=>[t.name.trim(),{...t,name:t.name.trim()}])).values()]}function iR({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 HLe({appName:e,info:t,loading:n,variant:r="rail",studioTools:i=[],selectedStudioToolIds:s=[],studioToolsLoading:a=!1,studioToolsDisabled:l=!1,studioToolsUnavailableReason:c="",onStudioToolsChange:u}){const[d,f]=m.useState(null),[h,p]=m.useState(!1),b=m.useRef(null),g=()=>{p(!1),window.requestAnimationFrame(()=>{var _;return(_=b.current)==null?void 0:_.focus()})};if(m.useEffect(()=>{if(!h)return;const _=document.body.style.overflow,R=$=>{$.key==="Escape"&&g()};return document.body.style.overflow="hidden",document.addEventListener("keydown",R),()=>{document.body.style.overflow=_,document.removeEventListener("keydown",R)}},[h]),n&&!t)return o.jsx("aside",{className:`topo is-loading${r==="drawer"?" is-drawer":""}`,"aria-label":"Agent 信息","aria-live":"polite",children:o.jsx(Ln,{as:"span",className:"topo-loading-label",duration:2.2,children:"正在读取 Agent 信息…"})});if(!t)return null;const O=X6(t.model),y=Nae(t.graph??{id:t.name,name:t.name,description:t.description,type:t.type??"llm",model:O,tools:t.tools,skills:t.skills,path:[t.name],mentionable:!1,children:[]}),v=VLe(t.tools).map(_=>({id:`base:tool:${_}`,name:_,label:_ae(_),custom:!1})),x=new Set(v.map(_=>_.name)),w=new Set(s),S=i.filter(_=>w.has(_.id)&&!x.has(_.id)).map(_=>({id:`studio:tool:${_.id}`,name:_.id,label:_.name,custom:!0})),E=[...v,...S],k=qLe(t.skills),T=!!u,C=jae(y),N=_=>o.jsx(Ux,{draft:C,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0},_);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"}),O&&o.jsx("span",{title:O,children:O})]}),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(iR,{title:"工具",count:E.length}),o.jsx("div",{className:"topo-module-scroll topo-tools-scroll",role:"region","aria-label":"工具列表",tabIndex:0,children:E.length>0?o.jsx("div",{className:"topo-tool-list",children:E.map(_=>o.jsxs("div",{className:"topo-tool",title:_.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:_.label}),o.jsx("code",{children:_.name})]}),_.custom&&o.jsx("span",{className:"topo-custom-badge",children:"Studio Tool"})]}),_.custom&&o.jsx("button",{type:"button",className:"topo-remove-capability","aria-label":`移除工具 ${_.name}`,title:"移除",disabled:l,onClick:()=>u==null?void 0:u(s.filter(R=>R!==_.name)),children:"×"})]},_.id))}):o.jsx("div",{className:"topo-empty",children:"未配置"})}),T&&o.jsx("div",{className:"topo-capability-add-dock",children:o.jsxs("button",{type:"button",className:"topo-capability-add-slot","aria-label":"添加 Studio 工具",disabled:l,onClick:()=>f("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(iR,{title:"技能",count:t.skillsPreviewSupported?k.length:void 0}),o.jsx("div",{className:"topo-module-scroll topo-skills-scroll",role:"region","aria-label":"技能列表",tabIndex:0,children:t.skillsPreviewSupported?k.length>0?o.jsx("div",{className:"topo-skill-list",children:k.map(_=>o.jsxs("div",{className:"topo-skill",title:_.description||_.name,children:[o.jsx("div",{className:"topo-skill-title",children:o.jsx("span",{className:"topo-skill-name",children:_.name})}),_.description&&o.jsx("span",{className:"topo-skill-description",children:_.description})]},`${_.name}:${_.description}`))}):o.jsx("div",{className:"topo-empty",children:"未配置"}):o.jsx("div",{className:"topo-empty",children:"暂不支持预览"})})]}),o.jsxs("section",{className:"topo-module-card topo-topology","aria-label":"Agent 画布",children:[o.jsxs("div",{className:"topo-canvas-heading",children:[o.jsx(iR,{title:"结构拓扑",count:Aae(y)}),o.jsx("button",{ref:b,type:"button",className:"topo-canvas-expand","aria-label":"全屏查看 Agent 画布",title:"全屏查看",onClick:()=>p(!0),children:o.jsx(Q0,{"aria-hidden":"true"})})]}),o.jsx("div",{className:"topo-canvas-preview",role:"region","aria-label":"Agent 执行画布",children:N(`conversation-canvas:${e}`)})]})]}),d==="tool"&&u&&o.jsx(ULe,{agentName:t.name,tools:i.filter(_=>!x.has(_.id)),selectedIds:s,loading:a,disabled:l,unavailableReason:c,onChange:u,onClose:()=>f(null)})]}),h&&ii.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:g,autoFocus:!0,children:o.jsx(Ya,{"aria-hidden":"true"})})]}),o.jsx("div",{className:"topo-canvas-dialog-body",children:N(`conversation-canvas-fullscreen:${e}`)})]}),document.body)]})}const vO={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};function Rz(e){return o.jsxs("svg",{...vO,...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 XLe(e){return o.jsxs("svg",{...vO,...e,children:[o.jsx("circle",{cx:"10.7",cy:"10.7",r:"6.1"}),o.jsx("path",{d:"m15.25 15.25 4.2 4.2"})]})}function GLe(e){return o.jsxs("svg",{...vO,...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 YLe(e){return o.jsxs("svg",{...vO,...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 WLe(e){return o.jsxs("svg",{...vO,...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 Rae(e){return o.jsx("svg",{...vO,...e,children:o.jsx("path",{d:"m6.5 6.5 11 11M17.5 6.5l-11 11"})})}const ZLe=180,Iz=500,Dz=10,Pz=32;function KLe(e){return Array.from(new Set(e.split(/[,,]/).map(t=>t.trim()).filter(Boolean)))}function JLe({artifact:e,busy:t,error:n,onClose:r,onSave:i}){const[s,a]=m.useState(e.name),[l,c]=m.useState(e.description??""),[u,d]=m.useState((e.tags??[]).join(",")),[f,h]=m.useState(""),p=m.useId(),b=m.useId(),g=m.useRef(null),O=m.useRef(null),y=m.useRef(t),v=m.useRef(r);m.useEffect(()=>{y.current=t,v.current=r},[t,r]),m.useEffect(()=>{var T,C;const S=document.body.style.overflow,E=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(T=O.current)==null||T.focus(),(C=O.current)==null||C.select();const k=N=>{if(N.key==="Escape"&&!y.current){N.preventDefault(),v.current();return}if(N.key!=="Tab")return;const _=g.current;if(!_)return;const R=Array.from(_.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(M=>M.getClientRects().length>0);if(R.length===0){N.preventDefault();return}const $=R[0],D=R[R.length-1];N.shiftKey&&document.activeElement===$?(N.preventDefault(),D.focus()):!N.shiftKey&&document.activeElement===D&&(N.preventDefault(),$.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 T;S.preventDefault();const E=s.trim(),k=KLe(u);if(!E){h("请输入产物名称"),(T=O.current)==null||T.focus();return}if(k.length>Dz){h(`标签最多 ${Dz} 个`);return}if(k.some(C=>C.length>Pz)){h(`单个标签不能超过 ${Pz} 个字符`);return}h(""),i({name:E,description:l.trim(),tags:k})},w=f||n;return ii.createPortal(o.jsx("div",{className:"artifact-edit-backdrop",onMouseDown:S=>{S.target===S.currentTarget&&!t&&r()},children:o.jsxs("section",{ref:g,className:"artifact-edit-dialog",role:"dialog","aria-modal":"true","aria-labelledby":p,"aria-describedby":b,"aria-busy":t||void 0,children:[o.jsxs("header",{className:"artifact-edit-dialog__header",children:[o.jsxs("div",{children:[o.jsx("h2",{id:p,children:"编辑产物信息"}),o.jsx("p",{id:b,children:"内容文件不会被修改"})]}),o.jsx("button",{type:"button",onClick:r,disabled:t,"aria-label":"关闭编辑框",children:o.jsx(Rae,{})})]}),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:O,value:s,maxLength:ZLe,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:Iz,disabled:t,rows:4,placeholder:"补充用途、版本或使用说明",onChange:S=>c(S.target.value)}),o.jsxs("small",{children:[l.length,"/",Iz]})]}),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)}function e4e(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"5.5",cy:"12",r:"1.4"}),o.jsx("circle",{cx:"12",cy:"12",r:"1.4"}),o.jsx("circle",{cx:"18.5",cy:"12",r:"1.4"})]})}function Iae({label:e,menuLabel:t,items:n,className:r="",placement:i="bottom-end"}){const[s,a]=m.useState(!1),l=m.useRef(null),c=m.useRef(null),u=m.useRef([]);m.useEffect(()=>{if(!s)return;const f=p=>{var b;(b=l.current)!=null&&b.contains(p.target)||a(!1)},h=p=>{var b;p.key==="Escape"&&(p.preventDefault(),a(!1),(b=c.current)==null||b.focus())};return window.addEventListener("pointerdown",f),window.addEventListener("keydown",h),()=>{window.removeEventListener("pointerdown",f),window.removeEventListener("keydown",h)}},[s]),m.useEffect(()=>{var f;s&&((f=u.current.find(h=>h&&!h.disabled))==null||f.focus())},[s]);const d=f=>{var g;if(!s||!["ArrowDown","ArrowUp","Home","End"].includes(f.key))return;f.preventDefault();const h=u.current.filter(O=>!!(O&&!O.disabled));if(h.length===0)return;const p=h.indexOf(document.activeElement),b=f.key==="Home"?0:f.key==="End"?h.length-1:(p+(f.key==="ArrowDown"?1:-1)+h.length)%h.length;(g=h[b])==null||g.focus()};return o.jsxs("div",{className:"studio-action-menu",ref:l,onKeyDown:d,children:[o.jsx("button",{ref:c,type:"button",className:`studio-action-menu__trigger ${r}`.trim(),"aria-label":e,"aria-haspopup":"menu","aria-expanded":s,disabled:n.length===0,onClick:()=>a(f=>!f),children:o.jsx(e4e,{})}),s?o.jsx("div",{className:`studio-action-menu__popover studio-action-menu__popover--${i}`,role:"menu","aria-label":t,children:n.map((f,h)=>o.jsx("button",{ref:p=>{u.current[h]=p},type:"button",role:"menuitem",className:`studio-action-menu__item${f.danger?" is-danger":""}`,disabled:f.disabled,title:f.title,onClick:()=>{a(!1),f.onSelect()},children:f.label},f.label))}):null]})}function aw(e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var t4e=typeof Jf=="object"&&Jf&&Jf.Object===Object&&Jf,n4e=typeof self=="object"&&self&&self.Object===Object&&self;t4e||n4e||Function("return this")();var r4e=typeof window<"u"?m.useLayoutEffect:m.useEffect;function i4e(){const e=m.useRef(!1);return m.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),m.useCallback(()=>e.current,[])}var Mz={width:void 0,height:void 0};function Dae(e){const{ref:t,box:n="content-box"}=e,[{width:r,height:i},s]=m.useState(Mz),a=i4e(),l=m.useRef({...Mz}),c=m.useRef(void 0);return c.current=e.onResize,m.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=Lz(d,f,"inlineSize"),p=Lz(d,f,"blockSize");if(l.current.width!==h||l.current.height!==p){const g={width:h,height:p};l.current.width=h,l.current.height=p,c.current?c.current(g):a()&&s(g)}});return u.observe(t.current,{box:n}),()=>{u.disconnect()}},[n,t,a]),{width:r,height:i}}function Lz(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 Y6(e,t){const n=m.useRef(e);r4e(()=>{n.current=e},[e]),m.useEffect(()=>{if(!t&&t!==0)return;const r=setTimeout(()=>{n.current()},t);return()=>{clearTimeout(r)}},[t])}const s4e="_Alert_1tr02_1",a4e="_Content_1tr02_145",o4e="_Indicator_1tr02_156",l4e="_Message_1tr02_159",c4e="_Title_1tr02_162",u4e="_Description_1tr02_168",d4e="_Actions_1tr02_173",pp={Alert:s4e,Content:a4e,Indicator:o4e,Message:l4e,Title:c4e,Description:u4e,Actions:d4e},zx=({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=m.useRef(null),h=m.useRef(null),[p,b]=m.useState("end"),{width:g}=Dae({ref:f});return m.useEffect(()=>{var y;const O=((y=h.current)==null?void 0:y.clientWidth)??0;if(O&&g){const v=O>g/3?"bottom":"end";b(v)}},[g]),o.jsxs("div",{ref:aw([u,f]),className:zr(pp.Alert,l),"data-variant":t,"data-color":e,role:e==="danger"?"alert":void 0,"data-actions-placement":s??p,...d,children:[a===!1?null:o.jsx("div",{className:pp.Indicator,children:a??o.jsx(f4e,{color:e})}),o.jsxs("div",{className:pp.Content,children:[o.jsxs("div",{className:pp.Message,children:[n&&o.jsx("div",{className:pp.Title,children:n}),r&&o.jsx("div",{className:pp.Description,children:r})]}),i&&o.jsx("div",{className:zr(pp.Actions,c),ref:h,children:i})]})]})},f4e=({color:e})=>{switch(e){case"warning":case"caution":case"danger":return o.jsx(Sne,{});case"success":return o.jsx(y2e,{});default:return o.jsx(vne,{})}},h4e={DEV:!1,MODE:"production"},z0=typeof import.meta<"u"?h4e:void 0,p4e=!!(z0!=null&&z0.DEV),m4e=typeof navigator<"u"&&/(jsdom|happy-dom)/i.test(navigator.userAgent)||typeof globalThis.happyDOM=="object",Pae=(z0==null?void 0:z0.MODE)==="test"||m4e,g4e=typeof window<"u",Mae=typeof document<"u",b4e=g4e&&Mae,W6=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())},S2=(e,t)=>{const n=()=>{const a=setTimeout(e);return()=>{clearTimeout(a)}};if(!b4e||typeof window.requestAnimationFrame!="function"||Mae&&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)}},ow=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},{}),sR=e=>typeof e=="number"?`${e}deg`:e,aR=e=>String(e),ZS=e=>`${e}ms`,oR=({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(${sR(r)})`,i==null?null:`skewX(${sR(i)})`,s==null?null:`skewY(${sR(s)})`].filter(Boolean);return a.length?a.join(" "):"none"},lR=({blur:e}={})=>{const t=[e==null?null:`blur(${e}px)`].filter(Boolean);return t.length?t.join(" "):"none"},dm=e=>{e.preventDefault()},Lae=e=>e.querySelectorAll('a[href], input:not([disabled]):not([type="hidden"]), textarea:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex^="-"]), [contenteditable]');m.createContext(null);const O4e="_LoadingIndicator_7yl6f_1",y4e={LoadingIndicator:O4e},LA=({className:e,size:t,strokeWidth:n,style:r,...i})=>o.jsx("div",{...i,className:zr(y4e.LoadingIndicator,e),style:r||ow({"indicator-size":t,"indicator-stroke":n})}),x4e=()=>Pae,$z=(e,t=!1,n="TransitionGroup")=>{const r=[];return m.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},Eg=()=>{},kg=e=>{const t=m.useRef(e);return t.current=e,m.useCallback(n=>t.current(n),[])};function v4e(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 w4e(e,t,n){if((Pae||p4e)&&t&&n>1)throw new Error(`Cannot use forwardRef with multiple children in <${e} />`)}const S4e="_TransitionGroupChild_1hv1z_1",E4e={TransitionGroupChild:S4e},$ae={enter:!1,enterActive:!1,exit:!1,exitActive:!1,interrupted:!1},k4e=e=>({...$ae,enter:!e}),T4e=(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 $ae}},_4e=({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:p,onExit:b,onExitActive:g,onExitComplete:O})=>{const[y,v]=m.useReducer(T4e,k4e(a||!1)),x=m.useRef(!1),w=m.useRef(null),S=m.useRef(c);S.current=c;const E=m.useRef(u);E.current=u;const k=m.useRef(null),T=m.useCallback(C=>{const N=w.current;if(!(!N||C===k.current))switch(k.current=C,C){case"enter":f(N);break;case"enter-active":h(N);break;case"enter-complete":p(N);break;case"exit":b(N);break;case"exit-active":g(N);break;case"exit-complete":O(N);break}},[f,h,p,b,g,O]);return Cn.useLayoutEffect(()=>{if(!l){let _;v({type:"exit-before"}),T("exit");const R=S2(()=>{v({type:"exit-active"}),T("exit-active"),_=window.setTimeout(()=>{T("exit-complete"),d()},E.current)});return()=>{R(),_!==void 0&&clearTimeout(_)}}if(a&&!x.current){x.current=!0;return}let C;v({type:"enter-before"}),T("enter");const N=S2(()=>{v({type:"enter-active"}),T("enter-active"),C=window.setTimeout(()=>{v({type:"done"}),T("enter-complete")},S.current)});return()=>{N(),C!==void 0&&clearTimeout(C)}},[l,a,d,T]),m.useEffect(()=>()=>{x.current=!1},[]),o.jsx(t,{ref:aw([w,e]),className:zr(r,E4e.TransitionGroupChild),"data-transition-id":i,style:s,"data-entering":y.enter?"":void 0,"data-entering-active":y.enterActive?"":void 0,"data-exiting":y.exit?"":void 0,"data-exiting-active":y.exitActive?"":void 0,"data-interrupted":y.interrupted?"":void 0,children:n})},A4e=e=>{const{enterMountDelay:t,preventMountTransition:n}=e,r=!n&&t!=null?t:null,[i,s]=m.useState(r==null);return Y6(()=>s(!0),i?null:r),i?o.jsx(_4e,{...e}):null},$A=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=x4e()}=e,p=kg(e.onEnter??Eg),b=kg(e.onEnterActive??Eg),g=kg(e.onEnterComplete??Eg),O=kg(e.onExit??Eg),y=kg(e.onExitActive??Eg),v=kg(e.onExitComplete??Eg);m.Children.forEach(r,E=>{if(E&&!E.key)throw new Error("Child elements of must include a `key`")});const x=m.useCallback(E=>({component:E,shouldRender:!0,removeChild:()=>{S(k=>k.filter(T=>E.key!==T.component.key))},onEnter:p,onEnterActive:b,onEnterComplete:g,onExit:O,onExitActive:y,onExitComplete:v}),[p,b,g,O,y,v]),[w,S]=m.useState(()=>$z(r).map(E=>({...x(E),preventMountTransition:u})));return m.useLayoutEffect(()=>{S(E=>{const k=$z(r);return v4e(k,E,x,f)})},[r,f,x]),w4e("TransitionGroup",t,m.Children.count(r)),h?o.jsx(o.Fragment,{children:m.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(A4e,{...k,as:n,className:i,transitionId:s,enterDuration:l,exitDuration:c,enterMountDelay:d,style:a,ref:t,children:E},E.key))})},C4e="_Button_1864l_1",N4e="_ButtonInner_1864l_4",j4e="_ButtonLoader_1864l_749",cR={Button:C4e,ButtonInner:N4e,ButtonLoader:j4e},vn=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:p,className:b,onClick:g,disabled:O,disabledTone:y,inert:v=u,...x}=e,w=O||v,S=m.useCallback(E=>{O||g==null||g(E)},[g,O]);return o.jsxs("button",{type:t,className:zr(cR.Button,b),"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:W6,disabled:w,"aria-disabled":w,tabIndex:w?-1:void 0,"data-disabled":O?"":void 0,"data-disabled-tone":O?y:void 0,onClick:S,...x,children:[o.jsx($A,{className:cR.ButtonLoader,enterDuration:250,exitDuration:150,children:u&&o.jsx(LA,{},"loader")}),o.jsx("span",{className:cR.ButtonInner,children:v6(p)})]})},R4e=()=>{var e;return typeof ClipboardItem<"u"&&!!((e=navigator.clipboard)!=null&&e.write)};function I4e(e){const{"text/plain":t,...n}=e;return new ClipboardItem({...n,...t?{"text/plain":new Blob([t],{type:"text/plain"})}:null})}async function D4e(e,t=document.body){if(typeof e=="string")return Bz(e,t);try{return R4e()?(await navigator.clipboard.write([I4e(e)]),!0):e["text/plain"]?Bz(e["text/plain"],t):!1}catch{return!1}}async function Bz(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}const P4e="_TransitionItem_1o7b1_1",M4e={TransitionItem:P4e},L4e=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}=U4e(e);return o.jsx(t,{className:zr("block",l==="absolute"&&"relative",n),"data-transition-position":l,style:d,children:o.jsx($A,{as:t,className:zr(M4e.TransitionItem,a),enterDuration:c,exitDuration:u,insertMethod:s,preventInitialTransition:i,children:r})})},$4e=400,B4e=500,Q4e=200,F4e=300;function U4e({initial:e,enter:t,exit:n,forceCompositeLayer:r}){const i=oR(e),s=oR(t),a=oR(n),l=[i,a,s].some(g=>g!=="none"),c=(t==null?void 0:t.duration)??(l?B4e:$4e),u=(t==null?void 0:t.timingFunction)??(l?"var(--cubic-enter)":"ease"),d=(n==null?void 0:n.duration)??(l?F4e:Q4e),f=(n==null?void 0:n.timingFunction)??(l?"var(--cubic-exit)":"ease"),h=ow({"tg-will-change":r?"transform, opacity":"auto","tg-enter-opacity":aR((t==null?void 0:t.opacity)??1),"tg-enter-transform":s,"tg-enter-filter":lR(t),"tg-enter-duration":ZS(c),"tg-enter-delay":ZS((t==null?void 0:t.delay)??0),"tg-enter-timing-function":u,"tg-exit-opacity":aR((n==null?void 0:n.opacity)??0),"tg-exit-transform":a,"tg-exit-filter":lR(n),"tg-exit-duration":ZS(d),"tg-exit-delay":ZS((n==null?void 0:n.delay)??0),"tg-exit-timing-function":f,"tg-initial-opacity":aR((e==null?void 0:e.opacity)??(n==null?void 0:n.opacity)??0),"tg-initial-transform":i==="none"?a:i,"tg-initial-filter":lR(e??n??{})}),p=((t==null?void 0:t.delay)??0)+c,b=((n==null?void 0:n.delay)??0)+d;return{enterTotalDuration:p,exitTotalDuration:b,variables:h}}const Bae=({children:e,copyValue:t,onClick:n,...r})=>{const[i,s]=m.useState(!1),a=m.useRef(null),l=c=>{i||(s(!0),n==null||n(c),D4e(typeof t=="function"?t():t),a.current=window.setTimeout(()=>{s(!1)},1300))};return m.useEffect(()=>()=>{a.current&&clearTimeout(a.current)},[]),o.jsxs(vn,{...r,onClick:l,children:[o.jsx(L4e,{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(W4,{},"copied-icon"):o.jsx(yne,{},"copy-icon")}),typeof e=="function"?e({copied:i}):e]})};function Bl({title:e,description:t,error:n,confirmLabel:r,cancelLabel:i="取消",closeLabel:s="关闭确认框",variant:a="warning",busy:l=!1,onCancel:c,onConfirm:u}){const d=m.useId(),f=m.useId(),h=m.useRef(null),p=m.useRef(l),b=m.useRef(c);return m.useEffect(()=>{p.current=l,b.current=c},[l,c]),m.useEffect(()=>{var v;const g=document.body.style.overflow,O=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(v=h.current)==null||v.focus();const y=x=>{x.key==="Escape"&&!p.current&&b.current()};return window.addEventListener("keydown",y),()=>{document.body.style.overflow=g,window.removeEventListener("keydown",y),O!=null&&O.isConnected&&O.focus()}},[]),ii.createPortal(o.jsx("div",{className:"studio-confirm-backdrop",onMouseDown:g=>{g.target===g.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(Sne,{})}),o.jsx("h2",{id:d,children:e})]}),o.jsx(vn,{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(K4,{})})]}),o.jsxs("div",{className:"studio-confirm-body",children:[o.jsx("p",{id:f,children:t}),n?o.jsx(zx,{className:"studio-confirm-error",color:"danger",variant:"soft",description:n}):null]}),o.jsxs("footer",{className:"studio-confirm-actions",children:[o.jsx(vn,{ref:h,type:"button",color:"secondary",variant:"ghost",size:"lg",pill:!1,onClick:c,disabled:l,children:i}),o.jsx(vn,{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 z4e=new Set(["avif","bmp","gif","heic","jpeg","jpg","png","svg","tif","tiff","webp"]),V4e=new Set(["avi","m4v","mkv","mov","mp4","mpeg","mpg","webm"]),q4e=new Set(["csv","htm","html","json","md","pdf","svg","txt","xml","yaml","yml"]);function Qae(e){const t=e.lastIndexOf(".");return t<0?"":e.slice(t+1).toLocaleLowerCase()}function E2(e,t){if(!Number.isFinite(e))return t;const n=e;return n>1e10?n:n*1e3}function H4e(e){var t,n;return((t=e.actions)==null?void 0:t.artifactDelta)??((n=e.actions)==null?void 0:n.artifact_delta)}function X4e(e){return`${e.replace(/\.pptx$/i,"")}.preview.webp`}function G4e(e){var t;return(((t=e.content)==null?void 0:t.parts)??[]).map(n=>n.functionResponse??n.function_response).filter(n=>!!n)}function Y4e(e){if(!e)return{};const t=e.result;return t&&typeof t=="object"&&!Array.isArray(t)?t:e}function Qz(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 W4e(e,t){const n=Y4e(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:Qz(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:Qz(u||"generated-video",c,s),url:c,type:s,taskId:u})}return a}function Fz(e,t){return new Date(E2(e,t)||Date.now()).toISOString()}function Z4e(e){var r;const t=[],n=new Set;for(const i of e)for(const s of i.sessions){const a=E2(s.lastUpdateTime,Date.now()),l=OA(s.events);for(const c of s.events??[])for(const u of G4e(c)){const d=(u==null?void 0:u.name)??"";for(const f of W4e(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:Fz(s.lastUpdateTime,a),createdAt:Fz(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 Fae(e){const t=Qae(e);return z4e.has(t)?"image":V4e.has(t)?"video":"document"}function K4e(e){const t=Fae(e);return t==="image"?"image":t==="video"?"video":q4e.has(Qae(e))?"frame":"unavailable"}function J4e(e){var n;const t=[];for(const r of e)for(const i of r.sessions){const s=E2(i.lastUpdateTime,0),a=new Map;for(const l of i.events??[]){const c=H4e(l);if(!c)continue;const u=E2(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(X4e(l.filename)),u=c??l,d=c?"image":K4e(l.filename);t.push({id:`${r.appName}:${i.id}:${l.filename}:${l.version}`,appName:r.appName,agentId:r.agentId,sessionId:i.id,sessionTitle:OA(i.events),agentName:((n=r.agentName)==null?void 0:n.trim())||r.appName,sessionUpdatedAt:s,name:l.filename,version:l.version,type:Fae(l.filename),createdAt:l.createdAt||s,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 Uae(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 zae(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 uR=40,e6e=[{id:"document",label:"文档"},{id:"image",label:"图片"},{id:"video",label:"视频"}],t6e={document:"文档",image:"图片",video:"视频"};function KS(e){return e instanceof Error?e.message:String(e)}function Vae({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(Rz,{})}):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(Rz,{})})]})})}function n6e({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(Vae,{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:zae(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:Uae(e.updatedAt??e.createdAt)}),o.jsx("td",{className:"library-artifact-actions-cell",children:o.jsx("div",{className:"library-artifact-actions",children:o.jsx(Iae,{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 r6e({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}){var We,W;const[h,p]=m.useState(null),[b,g]=m.useState(""),[O,y]=m.useState(null),[v,x]=m.useState(""),[w,S]=m.useState(""),[E,k]=m.useState(""),[T,C]=m.useState(""),[N,_]=m.useState({}),[R,$]=m.useState(()=>new Set),[D,M]=m.useState(null),[j,P]=m.useState(!1),[L,U]=m.useState(""),[F,q]=m.useState(null),[z,B]=m.useState(!1),[V,ce]=m.useState(uR),we=m.useRef(null),Oe=m.useRef(null),de=m.useRef(0),Z=m.useRef(null),J=m.useRef(null),fe=m.useRef(!1),be=m.useCallback(()=>{de.current+=1,y(null),x(""),S("")},[]),je=m.useMemo(()=>t?[...t]:J4e(e),[t,e]),Qe=m.useMemo(()=>je.filter(ne=>!R.has(ne.id)).map(ne=>N[ne.id]??ne),[je,N,R]);m.useEffect(()=>()=>{de.current+=1},[]),m.useEffect(()=>()=>{v&&URL.revokeObjectURL(v)},[v]),m.useEffect(()=>{var re;if(!O)return;const ne=document.activeElement,he=document.body.style.overflow;document.body.style.overflow="hidden",(re=we.current)==null||re.focus();const xe=Re=>{if(Re.key==="Escape"){Re.preventDefault(),be();return}if(Re.key!=="Tab")return;const nt=Oe.current;if(!nt)return;const Ke=Array.from(nt.querySelectorAll('button:not([disabled]), video[controls], iframe, [tabindex]:not([tabindex="-1"])')).filter(At=>At.getClientRects().length>0);if(Ke.length===0){Re.preventDefault();return}const tn=Ke[0],Gt=Ke[Ke.length-1];Re.shiftKey&&document.activeElement===tn?(Re.preventDefault(),Gt.focus()):!Re.shiftKey&&document.activeElement===Gt&&(Re.preventDefault(),tn.focus())};return document.addEventListener("keydown",xe),()=>{document.removeEventListener("keydown",xe),document.body.style.overflow=he,ne!=null&&ne.isConnected&&ne.focus()}},[be,O]);const Me=async ne=>{const he=de.current+1;if(de.current=he,k(""),x(""),y(ne),ne.preview.mode!=="unavailable"){if(ne.contentUrl){x(ne.contentUrl);return}S(`preview:${ne.id}`);try{const xe=await p6(ne.appName,n,ne.sessionId,ne.preview.filename,ne.preview.version);if(de.current!==he){URL.revokeObjectURL(xe);return}x(xe)}catch(xe){de.current===he&&k(`无法预览“${ne.name}”:${KS(xe)}`)}finally{de.current===he&&S("")}}},le=async ne=>{k(""),S(`download:${ne.id}`);try{d?await d(ne):await h6(ne.appName,n,ne.sessionId,ne.name,ne.version),C(`已开始下载 ${ne.name}`)}catch(he){k(`无法下载“${ne.name}”:${KS(he)}`)}finally{S("")}},ke=async ne=>{if(!(!D||!c)){P(!0),U("");try{const xe=await c(D,ne)??{...D,...ne,updatedAt:Date.now()};_(re=>({...re,[D.id]:xe})),C(`已更新 ${xe.name}`),M(null)}catch(he){U(KS(he))}finally{P(!1)}}},ye=async()=>{if(!(!F||!u)){B(!0),k("");try{await u(F),$(ne=>new Set([...ne,F.id])),C(`已删除 ${F.name}`),(O==null?void 0:O.id)===F.id&&be(),q(null)}catch(ne){k(`无法删除“${F.name}”:${KS(ne)}`),q(null)}finally{B(!1)}}},$e=m.useMemo(()=>{const ne=b.trim().toLocaleLowerCase();return Qe.filter(he=>h&&he.type!==h?!1:ne?[he.name,he.sessionTitle,he.agentName].some(xe=>xe.toLocaleLowerCase().includes(ne)):!0)},[h,Qe,b]),ze=m.useMemo(()=>$e.slice(0,V),[$e,V]),Ae=V<$e.length,Ve=m.useCallback(()=>{fe.current||(fe.current=!0,ce(ne=>ne+uR))},[]);m.useEffect(()=>{ce(uR)},[i,h,b,$e.length]),m.useEffect(()=>{fe.current=!1},[V]),m.useEffect(()=>{const ne=J.current,he=Z.current;if(!r||!ne||!he||!Ae)return;const xe=new IntersectionObserver(([re])=>{re.isIntersecting&&Ve()},{root:he,rootMargin:"240px 0px",threshold:.01});return xe.observe(ne),()=>xe.disconnect()},[r,Ae,Ve,V]);const ut=()=>{const ne=Z.current;!r||!ne||!Ae||ne.scrollHeight-ne.scrollTop-ne.clientHeight<=240&&Ve()},Tt=!!b.trim()||h!==null;return o.jsxs("div",{className:"artifact-library-page",children:[o.jsxs("div",{className:"artifact-library-toolbar library-resource-toolbar",children:[o.jsx("nav",{className:"artifact-type-pills","aria-label":"产物类型",children:e6e.map(ne=>o.jsx("button",{type:"button",className:`artifact-type-pill${h===ne.id?" is-active":""}`,"aria-pressed":h===ne.id,onClick:()=>p(he=>he===ne.id?null:ne.id),children:ne.label},ne.id))}),o.jsxs("label",{className:"artifact-library-search",children:[o.jsx(XLe,{}),o.jsx("input",{type:"search","aria-label":"搜索产物",value:b,onChange:ne=>g(ne.target.value),placeholder:"搜索产物或会话"})]})]}),a&&Qe.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,E?o.jsxs("div",{className:"artifact-library-banner",role:"alert",children:[o.jsx("span",{children:E}),o.jsx("button",{type:"button",onClick:()=>k(""),children:"关闭"})]}):null,o.jsx("section",{ref:Z,className:"artifact-library-results","aria-label":"产物列表",onScroll:ut,children:o.jsxs("div",{className:"artifact-library-panel",children:[s&&Qe.length===0?o.jsx("div",{className:"artifact-library-empty",role:"status","aria-live":"polite",children:o.jsx(Ln,{as:"p",duration:2.4,children:"正在加载产物"})}):a&&Qe.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]}):$e.length===0?o.jsxs("div",{className:"artifact-library-empty",children:[o.jsx("p",{children:Tt?"没有找到匹配的产物":"您还没有任何产物"}),o.jsx("span",{children:Tt?"请尝试搜索其他名称或切换类型":"聊天中生成的产物会自动显示在这里"})]}):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:ze.map(ne=>o.jsx(n6e,{artifact:ne,pendingAction:w,disabled:!n&&!t,onPreview:he=>void Me(he),onDownload:he=>void le(he),onEdit:c?he=>{U(""),M(he)}:void 0,onDelete:u?q:void 0,onOpenSource:f},ne.id))})]})}),Ae?o.jsx("div",{ref:J,className:"artifact-library-load-more",role:"status","aria-live":"polite",children:o.jsx(Ln,{as:"span",duration:2.4,children:"正在加载更多产物"})}):null]})}),o.jsx("p",{className:"artifact-library-status","aria-live":"polite",children:T}),O?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:be}),o.jsxs("div",{ref:Oe,className:"artifact-library-preview-panel",children:[o.jsxs("header",{children:[o.jsxs("div",{children:[o.jsx("h2",{id:"artifact-library-preview-title",children:O.name}),o.jsxs("p",{children:[t6e[O.type]," / 版本 ",O.version]})]}),o.jsx("button",{ref:we,type:"button","aria-label":"关闭预览",onClick:be,children:o.jsx(Rae,{})})]}),o.jsxs("div",{className:"artifact-library-preview-content",children:[o.jsx("div",{className:"artifact-library-preview-canvas",children:w===`preview:${O.id}`?o.jsx(Ln,{as:"span",duration:2.4,children:"正在加载预览"}):v&&O.preview.mode==="image"?o.jsx("img",{src:v,alt:`${O.name} 预览`}):v&&O.preview.mode==="video"?o.jsx("video",{src:v,controls:!0,"aria-label":`${O.name} 预览`}):v&&O.preview.mode==="frame"?o.jsx("iframe",{src:v,title:`${O.name} 预览`}):o.jsxs("div",{className:"artifact-library-preview-unavailable",children:[o.jsx(Vae,{artifact:O,large:!0}),o.jsx("p",{children:E?"预览加载失败,请稍后重试或下载查看":"当前格式暂不支持在线预览,请下载查看"})]})}),o.jsxs("aside",{className:"artifact-library-preview-details","aria-label":"产物来源",children:[O.description?o.jsx("p",{className:"artifact-library-preview-description",children:O.description}):null,o.jsxs("dl",{children:[o.jsxs("div",{children:[o.jsx("dt",{children:"Agent"}),o.jsx("dd",{title:O.agentName,children:O.agentName})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"会话"}),o.jsx("dd",{title:O.sessionTitle,children:O.sessionTitle})]}),(We=O.origin)!=null&&We.toolName?o.jsxs("div",{children:[o.jsx("dt",{children:"生成工具"}),o.jsx("dd",{children:O.origin.toolName})]}):null,o.jsxs("div",{children:[o.jsx("dt",{children:"生成时间"}),o.jsx("dd",{children:Uae(O.createdAt)})]}),O.sizeBytes?o.jsxs("div",{children:[o.jsx("dt",{children:"文件大小"}),o.jsx("dd",{children:zae(O.sizeBytes)})]}):null]}),(W=O.tags)!=null&&W.length?o.jsx("div",{className:"artifact-library-preview-tags","aria-label":"标签",children:O.tags.map(ne=>o.jsx("span",{children:ne},ne))}):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 ne=O;be(),f(ne)},children:[o.jsx(YLe,{}),"查看会话"]}):null,c?o.jsxs("button",{type:"button",className:"is-secondary",disabled:O.canManage===!1,onClick:()=>{const ne=O;be(),U(""),M(ne)},children:[o.jsx(WLe,{}),"编辑信息"]}):null]}),o.jsxs("button",{type:"button",disabled:w.startsWith("download:")||!n&&!t,onClick:()=>void le(O),children:[o.jsx(GLe,{}),"下载"]})]})]})]}):null,D?o.jsx(JLe,{artifact:D,busy:j,error:L,onClose:()=>{j||M(null)},onSave:ne=>void ke(ne)}):null,F?o.jsx(Bl,{title:"删除产物?",description:`“${F.name}”将从产物库永久删除,聊天记录不会受到影响。`,confirmLabel:z?"删除中":"删除",closeLabel:"关闭删除确认框",variant:"danger",busy:z,onCancel:()=>{z||q(null)},onConfirm:()=>void ye()}):null]})}function i6e(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 lw(e,t){if(e.ok)return e;let n;try{n=await e.json()}catch{n=void 0}throw new Error(i6e(n,`${t}(${e.status})`))}function dR(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 qae(e){const t=e;return{...t,createdAt:dR(t.createdAt),updatedAt:dR(t.updatedAt),sessionUpdatedAt:dR(t.sessionUpdatedAt)}}async function Hae(e){const t=await e.json();return Array.isArray(t.items)?t.items.map(qae):[]}async function s6e(){const e=await lw(await Hn("/web/artifacts"),"读取产物库失败");return Hae(e)}async function a6e(e){if(e.length===0)return s6e();const t=await lw(await Hn("/web/artifacts/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({candidates:e})},24e4),"同步聊天产物失败");return Hae(t)}async function o6e(e,t){const n=await lw(await Hn(`/web/artifacts/${encodeURIComponent(e.id)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),"更新产物失败");return qae(await n.json())}async function l6e(e){await lw(await Hn(`/web/artifacts/${encodeURIComponent(e.id)}`,{method:"DELETE"}),"删除产物失败")}async function c6e(e){const n=await(await lw(await Hn(`/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)}var u6e=Object.defineProperty,Z6=(e,t)=>u6e(e,"name",{value:t,configurable:!0});function VP(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Z6(VP,"setRef");function Xae(...e){return t=>{let n=!1;const r=e.map(i=>{const s=VP(i,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;id6e(e,"name",{value:t,configurable:!0});function Ih(e){const t=m.forwardRef((n,r)=>{let{children:i,...s}=n,a=null,l=!1;const c=[];qP(i)&&typeof JS=="function"&&(i=JS(i._payload)),m.Children.forEach(i,h=>{var p;if(Jae(h)){l=!0;const b=h;let g="child"in b.props?b.props.child:b.props.children;qP(g)&&typeof JS=="function"&&(g=JS(g._payload)),a=f6e(b,g),c.push((p=a==null?void 0:a.props)==null?void 0:p.children)}else c.push(h)}),a?a=m.cloneElement(a,void 0,c):!l&&m.Children.count(i)===1&&m.isValidElement(i)&&(a=i);const u=a?Kae(a):void 0,d=Ci(r,u);if(!a){if(i||i===0)throw new Error(l?m6e(e):p6e(e));return i}const f=Zae(s,a.props??{});return a.type!==m.Fragment&&(f.ref=r?d:u),m.cloneElement(a,f)});return t.displayName=`${e}.Slot`,t}jc(Ih,"createSlot");var Gae=Ih("Slot"),Yae=Symbol.for("radix.slottable");function Wae(e){const t=jc(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=Yae,t}jc(Wae,"createSlottable");var f6e=jc((e,t)=>{if("child"in e.props){const n=e.props.child;return m.isValidElement(n)?m.cloneElement(n,void 0,e.props.children(n.props.children)):null}return m.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function Zae(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}}jc(Zae,"mergeProps");function Kae(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)}jc(Kae,"getElementRef");function Jae(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Yae}jc(Jae,"isSlottable");var h6e=Symbol.for("react.lazy");function qP(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===h6e&&"_payload"in e&&eoe(e._payload)}jc(qP,"isLazyComponent");function eoe(e){return typeof e=="object"&&e!==null&&"then"in e}jc(eoe,"isPromiseLike");var p6e=jc(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),m6e=jc(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),JS=tO[" use ".trim().toString()],g6e=Object.defineProperty,b6e=(e,t)=>g6e(e,"name",{value:t,configurable:!0}),O6e=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Qi=O6e.reduce((e,t)=>{const n=Ih(`Primitive.${t}`),r=m.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 toe(e,t){e&&ii.flushSync(()=>e.dispatchEvent(t))}b6e(toe,"dispatchDiscreteCustomEvent");var y6e=Object.defineProperty,x6e=(e,t)=>y6e(e,"name",{value:t,configurable:!0}),v6e=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"}),w6e=m.forwardRef(x6e(function(t,n){return o.jsx(Qi.span,{...t,ref:n,style:{...v6e,...t.style}})},"VisuallyHidden")),S6e=w6e,E6e=Object.defineProperty,Nl=(e,t)=>E6e(e,"name",{value:t,configurable:!0});function k6e(e,t){const n=m.createContext(t);n.displayName=e+"Context";const r=Nl(s=>{const{children:a,...l}=s,c=m.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=m.useContext(n);if(c)return c;if(t!==void 0)return t;if(!l)throw new Error(`\`${s}\` must be used within \`${e}\``)}return Nl(i,"useContext"),[r,i]}Nl(k6e,"createContext");function Xl(e,t=[]){let n=[];function r(s,a){const l=m.createContext(a);l.displayName=s+"Context";const c=n.length;n=[...n,a];const u=Nl(f=>{var y;const{scope:h,children:p,...b}=f,g=((y=h==null?void 0:h[e])==null?void 0:y[c])||l,O=m.useMemo(()=>b,Object.values(b));return o.jsx(g.Provider,{value:O,children:p})},"Provider");u.displayName=s+"Provider";function d(f,h,p={}){var y;const{optional:b=!1}=p,g=((y=h==null?void 0:h[e])==null?void 0:y[c])||l,O=m.useContext(g);if(O)return O;if(a!==void 0)return a;if(!b)throw new Error(`\`${f}\` must be used within \`${s}\``)}return Nl(d,"useContext"),[u,d]}Nl(r,"createContext");const i=Nl(()=>{const s=n.map(a=>m.createContext(a));return Nl(function(l){const c=(l==null?void 0:l[e])||s;return m.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])},"useScope")},"createScope");return i.scopeName=e,[r,noe(i,...t)]}Nl(Xl,"createContextScope");function noe(...e){const t=e[0];if(e.length===1)return t;const n=Nl(()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return Nl(function(s){const a=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}Nl(noe,"composeContextScopes");var T6e=Object.defineProperty,Vs=(e,t)=>T6e(e,"name",{value:t,configurable:!0});function roe(e){const t=e+"CollectionProvider",[n,r]=Xl(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=Vs(g=>{const{scope:O,children:y}=g,v=m.useRef(null),x=m.useRef(new Map).current;return o.jsx(i,{scope:O,itemMap:x,collectionRef:v,children:y})},"CollectionProvider");a.displayName=t;const l=e+"CollectionSlot",c=Ih(l),u=m.forwardRef((g,O)=>{const{scope:y,children:v}=g,x=s(l,y),w=Ci(O,x.collectionRef);return o.jsx(c,{ref:w,children:v})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=Ih(d),p=m.forwardRef((g,O)=>{const{scope:y,children:v,...x}=g,w=m.useRef(null),S=Ci(O,w),E=s(d,y);return m.useEffect(()=>(E.itemMap.set(w,{ref:w,...x}),()=>void E.itemMap.delete(w))),o.jsx(h,{[f]:"",ref:S,children:v})});p.displayName=d;function b(g){const O=s(e+"CollectionConsumer",g);return m.useCallback(()=>{const v=O.collectionRef.current;if(!v)return[];const x=Array.from(v.querySelectorAll(`[${f}]`));return Array.from(O.itemMap.values()).sort((E,k)=>x.indexOf(E.ref.current)-x.indexOf(k.ref.current))},[O.collectionRef,O.itemMap])}return Vs(b,"useCollection"),[{Provider:a,Slot:u,ItemSlot:p},b,r]}Vs(roe,"createCollection");var Uz=new WeakMap,ms,zo,fR=(zo=class extends Map{constructor(n){super(n);G7(this,ms);QN(this,ms,[...super.keys()]),Uz.set(this,!0)}set(n,r){return Uz.get(this)&&(this.has(n)?wa(this,ms)[wa(this,ms).indexOf(n)]=n:wa(this,ms).push(n)),super.set(n,r),this}insert(n,r,i){const s=this.has(r),a=wa(this,ms).length,l=K6(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=[...wa(this,ms)];let h,p=!1;for(let b=c;b=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 zo(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 zo(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 zo(r)}toReversed(){const n=new zo;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 zo(r)}slice(n,r){const i=new zo;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}},ms=new WeakMap,Vs(zo,"OrderedDict"),zo);function Lk(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=ioe(e,t);return n===-1?void 0:e[n]}Vs(Lk,"at");function ioe(e,t){const n=e.length,r=K6(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}Vs(ioe,"toSafeIndex");function K6(e){return e!==e||e===0?0:Math.trunc(e)}Vs(K6,"toSafeInteger");function _6e(e){const t=e+"CollectionProvider",[n,r]=Xl(t),[i,s]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new fR,setItemMap:Vs(()=>{},"setItemMap")}),a=Vs(({state:x,...w})=>x?o.jsx(c,{...w,state:x}):o.jsx(l,{...w}),"CollectionProvider");a.displayName=t;const l=Vs(x=>{const w=O();return o.jsx(c,{...x,state:w})},"CollectionInit");l.displayName=t+"Init";const c=Vs(x=>{const{scope:w,children:S,state:E}=x,k=m.useRef(null),[T,C]=m.useState(null),N=Ci(k,C),[_,R]=E;return m.useEffect(()=>{if(!T)return;const $=ooe(()=>{});return $.observe(T,{childList:!0,subtree:!0}),()=>{$.disconnect()}},[T]),o.jsx(i,{scope:w,itemMap:_,setItemMap:R,collectionRef:N,collectionRefObject:k,collectionElement:T,children:S})},"CollectionProviderImpl");c.displayName=t+"Impl";const u=e+"CollectionSlot",d=Ih(u),f=m.forwardRef((x,w)=>{const{scope:S,children:E}=x,k=s(u,S),T=Ci(w,k.collectionRef);return o.jsx(d,{ref:T,children:E})});f.displayName=u;const h=e+"CollectionItemSlot",p="data-radix-collection-item",b=Ih(h),g=m.forwardRef((x,w)=>{const{scope:S,children:E,...k}=x,T=m.useRef(null),[C,N]=m.useState(null),_=Ci(w,T,N),R=s(h,S),{setItemMap:$}=R,D=m.useRef(k);soe(D.current,k)||(D.current=k);const M=D.current;return m.useEffect(()=>{const j=M;return $(P=>C?P.has(C)?P.set(C,{...j,element:C}).toSorted(HP):(P.set(C,{...j,element:C}),P.toSorted(HP)):P),()=>{$(P=>!C||!P.has(C)?P:(P.delete(C),new fR(P)))}},[C,M,$]),o.jsx(b,{[p]:"",ref:_,children:E})});g.displayName=h;function O(){return m.useState(new fR)}Vs(O,"useInitCollection");function y(x){const{itemMap:w}=s(e+"CollectionConsumer",x);return w}return Vs(y,"useCollection"),[{Provider:a,Slot:f,ItemSlot:g},{createCollectionScope:r,useCollection:y,useInitCollection:O}]}Vs(_6e,"createCollection");function soe(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}Vs(soe,"shallowEqual");function aoe(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}Vs(aoe,"isElementPreceding");function HP(e,t){return!e[1].element||!t[1].element?0:aoe(e[1].element,t[1].element)?-1:1}Vs(HP,"sortByDocumentPosition");function ooe(e){return new MutationObserver(n=>{for(const r of n)if(r.type==="childList"){e();return}})}Vs(ooe,"getChildListObserver");var A6e=Object.defineProperty,wO=(e,t)=>A6e(e,"name",{value:t,configurable:!0}),loe=!!(typeof window<"u"&&window.document&&window.document.createElement);function Mr(e,t,{checkForDefaultPrevented:n=!0}={}){return wO(function(i){if(e==null||e(i),n===!1||!i||!i.defaultPrevented)return t==null?void 0:t(i)},"handleEvent")}wO(Mr,"composeEventHandlers");function C6e(e){var t;if(!loe)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}wO(C6e,"getOwnerWindow");function XP(e){if(!loe)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}wO(XP,"getOwnerDocument");function coe(e,t=!1){const{activeElement:n}=XP(e);if(!(n!=null&&n.nodeName))return null;if(uoe(n)&&n.contentDocument)return coe(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const i=XP(n).getElementById(r);if(i)return i}}return n}wO(coe,"getActiveElement");function uoe(e){return e.tagName==="IFRAME"}wO(uoe,"isFrame");var Ql=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},N6e=Object.defineProperty,j6e=(e,t)=>N6e(e,"name",{value:t,configurable:!0}),zz=tO[" useEffectEvent ".trim().toString()],Vz=tO[" useInsertionEffect ".trim().toString()];function doe(e){if(typeof zz=="function")return zz(e);const t=m.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Vz=="function"?Vz(()=>{t.current=e}):Ql(()=>{t.current=e}),m.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}j6e(doe,"useEffectEvent");var R6e=Object.defineProperty,cw=(e,t)=>R6e(e,"name",{value:t,configurable:!0}),I6e=tO[" useInsertionEffect ".trim().toString()]||Ql;function Du({prop:e,defaultProp:t,onChange:n=cw(()=>{},"onChange"),caller:r}){const[i,s,a]=foe({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:i,u=m.useCallback(d=>{var f;if(l){const h=hoe(d)?d(e):d;h!==e&&((f=a.current)==null||f.call(a,h))}else s(d)},[l,e,s,a]);return[c,u]}cw(Du,"useControllableState");function foe({defaultProp:e,onChange:t}){const[n,r]=m.useState(e),i=m.useRef(n),s=m.useRef(t);return I6e(()=>{s.current=t},[t]),m.useEffect(()=>{var a;i.current!==n&&((a=s.current)==null||a.call(s,n),i.current=n)},[n,i]),[n,r,s]}cw(foe,"useUncontrolledState");function hoe(e){return typeof e=="function"}cw(hoe,"isFunction");var qz=Symbol("RADIX:SYNC_STATE");function D6e(e,t,n,r){const{prop:i,defaultProp:s,onChange:a,caller:l}=t,c=i!==void 0,u=doe(a),d=[{...n,state:s}];r&&d.push(r);const[f,h]=m.useReducer((O,y)=>{if(y.type===qz)return{...O,state:y.state};const v=e(O,y);return c&&!Object.is(v.state,O.state)&&u(v.state),v},...d),p=f.state,b=m.useRef(p);m.useEffect(()=>{b.current!==p&&(b.current=p,c||u(p))},[p,b,c]);const g=m.useMemo(()=>i!==void 0?{...f,state:i}:f,[f,i]);return m.useEffect(()=>{c&&!Object.is(i,f.state)&&h({type:qz,state:i})},[i,f.state,c]),[g,h]}cw(D6e,"useControllableStateReducer");var P6e=Object.defineProperty,Xd=(e,t)=>P6e(e,"name",{value:t,configurable:!0});function poe(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}Xd(poe,"useStateMachine");var SO=Xd(e=>{const{present:t,children:n}=e,r=moe(t),i=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),s=goe(r.ref,boe(i));return typeof n=="function"||r.isPresent?m.cloneElement(i,{ref:s}):null},"Presence");function moe(e){const[t,n]=m.useState(),r=m.useRef(null),i=m.useRef(e),s=m.useRef("none"),a=m.useRef(void 0),l=e?"mounted":"unmounted",[c,u]=poe(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{c==="mounted"?(s.current=a.current??Xg(r.current),a.current=void 0):s.current="none"},[c]),Ql(()=>{const d=r.current,f=i.current;if(f!==e){const p=s.current,b=Xg(d);e?(a.current=b,u("MOUNT")):b==="none"||(d==null?void 0:d.display)==="none"?u("UNMOUNT"):u(f&&p!==b?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,u]),Ql(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,h=Xd(b=>{const O=Xg(r.current).includes(CSS.escape(b.animationName));if(b.target===t&&O&&(u("ANIMATION_END"),!i.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},"handleAnimationEnd"),p=Xd(b=>{b.target===t&&(s.current=Xg(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:m.useCallback(d=>{if(d){const f=getComputedStyle(d);r.current=f,a.current=Xg(f)}else r.current=null;n(d)},[])}}Xd(moe,"usePresence");function GP(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Xd(GP,"setRef");function goe(...e){const t=m.useRef(e);return t.current=e,m.useCallback(n=>{const r=t.current;let i=!1;const s=r.map(a=>{const l=GP(a,n);return!i&&typeof l=="function"&&(i=!0),l});if(i)return()=>{for(let a=0;aM6e(e,"name",{value:t,configurable:!0}),$6e=tO[" useId ".trim().toString()]||(()=>{}),B6e=0;function BA(e){const[t,n]=m.useState($6e());return Ql(()=>{e||n(r=>r??String(B6e++))},[e]),e||(t?`radix-${t}`:"")}L6e(BA,"useId");var Q6e=Object.defineProperty,F6e=(e,t)=>Q6e(e,"name",{value:t,configurable:!0}),U6e=m.createContext(void 0);function QA(e){const t=m.useContext(U6e);return e||t||"ltr"}F6e(QA,"useDirection");var z6e=Object.defineProperty,V6e=(e,t)=>z6e(e,"name",{value:t,configurable:!0});function Dh(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}V6e(Dh,"useCallbackRef");var q6e=Object.defineProperty,Us=(e,t)=>q6e(e,"name",{value:t,configurable:!0}),YP="dismissableLayer.update",H6e="dismissableLayer.pointerDownOutside",X6e="dismissableLayer.focusOutside",Hz,Ooe=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),yoe=m.forwardRef(Us(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:l,onInteractOutside:c,onDismiss:u,...d}=t,f=m.useContext(Ooe),[h,p]=m.useState(null),b=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=m.useState({}),O=Ci(n,p),y=Array.from(f.layers),[v]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),x=v?y.indexOf(v):-1,w=h?y.indexOf(h):-1,S=f.layersWithOutsidePointerEventsDisabled.size>0,E=w>=x,k=m.useRef(!1),T=xoe(R=>{a==null||a(R),c==null||c(R),R.defaultPrevented||u==null||u()},{ownerDocument:b,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:k,dismissableSurfaces:f.dismissableSurfaces,shouldHandlePointerDownOutside:m.useCallback(R=>{if(!(R instanceof Node))return!1;const $=[...f.branches].some(D=>D.contains(R));return E&&!$},[f.branches,E])}),C=voe(R=>{if(i&&k.current)return;const $=R.target;[...f.branches].some(M=>M.contains($))||(l==null||l(R),c==null||c(R),R.defaultPrevented||u==null||u())},b),N=h?w===y.length-1:!1,_=Dh(R=>{R.key==="Escape"&&(s==null||s(R),!R.defaultPrevented&&u&&(R.preventDefault(),u()))});return m.useEffect(()=>{if(N)return b.addEventListener("keydown",_,{capture:!0}),()=>b.removeEventListener("keydown",_,{capture:!0})},[b,N,_]),m.useEffect(()=>{if(h)return r&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(Hz=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(h)),f.layers.add(h),WP(),()=>{r&&(f.layersWithOutsidePointerEventsDisabled.delete(h),f.layersWithOutsidePointerEventsDisabled.size===0&&(b.body.style.pointerEvents=Hz))}},[h,b,r,f]),m.useEffect(()=>()=>{h&&(f.layers.delete(h),f.layersWithOutsidePointerEventsDisabled.delete(h),WP())},[h,f]),m.useEffect(()=>{const R=Us(()=>g({}),"handleUpdate");return document.addEventListener(YP,R),()=>document.removeEventListener(YP,R)},[]),o.jsx(Qi.div,{...d,ref:O,style:{pointerEvents:S?E?"auto":"none":void 0,...t.style},onFocusCapture:Mr(t.onFocusCapture,C.onFocusCapture),onBlurCapture:Mr(t.onBlurCapture,C.onBlurCapture),onPointerDownCapture:Mr(t.onPointerDownCapture,T.onPointerDownCapture)})},"DismissableLayer"));function G6e(){const e=m.useContext(Ooe),[t,n]=m.useState(null);return m.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}Us(G6e,"useDismissableLayerSurface");var Y6e=Us(()=>!0,"IS_TRUE");function xoe(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:s,shouldHandlePointerDownOutside:a=Y6e}=t,l=Dh(e),c=m.useRef(!1),u=m.useRef(!1),d=m.useRef(new Map),f=m.useRef(()=>{});return m.useEffect(()=>{function h(){u.current=!1,i.current=!1,d.current.clear()}Us(h,"resetOutsideInteraction");function p(){return Array.from(d.current.values()).some(Boolean)}Us(p,"isOutsideInteractionIntercepted");function b(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)}Us(b,"handleInteractionCapture");function g(x){u.current&&d.current.set(x.type,!1)}Us(g,"handleInteractionBubble");const O=Us(x=>{if(x.target&&!c.current){let w=function(){n.removeEventListener("click",f.current);const E=p();h(),E||J6(H6e,l,S,{discrete:!0})};if(Us(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"),y=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const x of y)n.addEventListener(x,b,!0),n.addEventListener(x,g);const v=window.setTimeout(()=>{n.addEventListener("pointerdown",O)},0);return()=>{window.clearTimeout(v),n.removeEventListener("pointerdown",O),n.removeEventListener("click",f.current);for(const x of y)n.removeEventListener(x,b,!0),n.removeEventListener(x,g)}},[n,l,r,i,s,a]),{onPointerDownCapture:Us(()=>c.current=!0,"onPointerDownCapture")}}Us(xoe,"usePointerDownOutside");function voe(e,t=globalThis==null?void 0:globalThis.document){const n=Dh(e),r=m.useRef(!1);return m.useEffect(()=>{const i=Us(s=>{s.target&&!r.current&&J6(X6e,n,{originalEvent:s},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:Us(()=>r.current=!0,"onFocusCapture"),onBlurCapture:Us(()=>r.current=!1,"onBlurCapture")}}Us(voe,"useFocusOutside");function WP(){const e=new CustomEvent(YP);document.dispatchEvent(e)}Us(WP,"dispatchUpdate");function J6(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?toe(i,s):i.dispatchEvent(s)}Us(J6,"handleAndDispatchCustomEvent");var W6e=Object.defineProperty,Ha=(e,t)=>W6e(e,"name",{value:t,configurable:!0}),hR="focusScope.autoFocusOnMount",pR="focusScope.autoFocusOnUnmount",Xz={bubbles:!1,cancelable:!0},Z6e=m.forwardRef(Ha(function(t,n){const{loop:r=!1,trapped:i=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...l}=t,[c,u]=m.useState(null),d=Dh(s),f=Dh(a),h=m.useRef(null),p=Ci(n,u),b=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(i){let O=function(w){if(b.paused||!c)return;const S=w.target;c.contains(S)?h.current=S:dd(h.current,{select:!0})},y=function(w){if(b.paused||!c)return;const S=w.relatedTarget;S!==null&&(c.contains(S)||dd(h.current,{select:!0}))},v=function(w){if(document.activeElement===document.body)for(const E of w)E.removedNodes.length>0&&dd(c)};Ha(O,"handleFocusIn"),Ha(y,"handleFocusOut"),Ha(v,"handleMutations"),document.addEventListener("focusin",O),document.addEventListener("focusout",y);const x=new MutationObserver(v);return c&&x.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",O),document.removeEventListener("focusout",y),x.disconnect()}}},[i,c,b.paused]),m.useEffect(()=>{if(c){Gz.add(b);const O=document.activeElement;if(!c.contains(O)){const v=new CustomEvent(hR,Xz);c.addEventListener(hR,d),c.dispatchEvent(v),v.defaultPrevented||(woe(_oe(e$(c)),{select:!0}),document.activeElement===O&&dd(c))}return()=>{c.removeEventListener(hR,d),setTimeout(()=>{const v=new CustomEvent(pR,Xz);c.addEventListener(pR,f),c.dispatchEvent(v),v.defaultPrevented||dd(O??document.body,{select:!0}),c.removeEventListener(pR,f),Gz.remove(b)},0)}}},[c,d,f,b]);const g=m.useCallback(O=>{if(!r&&!i||b.paused)return;const y=O.key==="Tab"&&!O.altKey&&!O.ctrlKey&&!O.metaKey,v=document.activeElement;if(y&&v){const x=O.currentTarget,[w,S]=Soe(x);w&&S?!O.shiftKey&&v===S?(O.preventDefault(),r&&dd(w,{select:!0})):O.shiftKey&&v===w&&(O.preventDefault(),r&&dd(S,{select:!0})):v===x&&O.preventDefault()}},[r,i,b.paused]);return o.jsx(Qi.div,{tabIndex:-1,...l,ref:p,onKeyDown:g})},"FocusScope"));function woe(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(dd(r,{select:t}),document.activeElement!==n)return}Ha(woe,"focusFirst");function Soe(e){const t=e$(e),n=ZP(t,e),r=ZP(t.reverse(),e);return[n,r]}Ha(Soe,"getTabbableEdges");function e$(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:Ha(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}Ha(e$,"getTabbableCandidates");function ZP(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Eoe(r,{upTo:t})))return r}Ha(ZP,"findVisible");function Eoe(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}Ha(Eoe,"isHidden");function koe(e){return e instanceof HTMLInputElement&&"select"in e}Ha(koe,"isSelectableInput");function dd(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&koe(e)&&t&&e.select()}}Ha(dd,"focus");var Gz=Toe();function Toe(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=KP(e,t),e.unshift(t)},remove(t){var n;e=KP(e,t),(n=e[0])==null||n.resume()}}}Ha(Toe,"createFocusScopesStack");function KP(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}Ha(KP,"arrayRemove");function _oe(e){return e.filter(t=>t.tagName!=="A")}Ha(_oe,"removeLinks");var K6e=Object.defineProperty,J6e=(e,t)=>K6e(e,"name",{value:t,configurable:!0}),Aoe=m.forwardRef(J6e(function(t,n){var c;const{container:r,...i}=t,[s,a]=m.useState(!1);Ql(()=>a(!0),[]);const l=r||s&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return l?ii.createPortal(o.jsx(Qi.div,{...i,ref:n}),l):null},"Portal")),e$e=Object.defineProperty,t$=(e,t)=>e$e(e,"name",{value:t,configurable:!0}),eE=0,Gc=null;function t$e(e){return n$(),e.children}t$(t$e,"FocusGuards");function n$(){m.useEffect(()=>{Gc||(Gc={start:JP(),end:JP()});const{start:e,end:t}=Gc;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),eE++,()=>{eE===1&&(Gc==null||Gc.start.remove(),Gc==null||Gc.end.remove(),Gc=null),eE=Math.max(0,eE-1)}},[])}t$(n$,"useFocusGuards");function JP(){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}t$(JP,"createFocusGuard");var su=function(){return su=Object.assign||function(t){for(var n,r=1,i=arguments.length;r"u")return O$e;var t=y$e(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])}},v$e=Roe(),V0="data-scroll-locked",w$e=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(r$e,` { +- 保持礼貌、专业的语气。`;function rl(e="volcengine"){return{name:"",description:$Le,instruction:BLe,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:Sm(e),modelSource:"ark",modelProvider:"",modelApiBase:"",shortTermBackend:"local",longTermBackend:"local",longTermMemoryIndex:"",autoSaveSession:!1,knowledgebaseBackend:xh,knowledgebaseIndex:"",tracingExporters:[],selectedSkills:[],cloudEnvironment:{cliTools:[]},deployment:{feishuEnabled:!1,modelApiKeyId:"",modelApiKeyName:""}}}function Gm(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 Y6(e){return Gm(e).modelName}function _ae(e,t,n){var s,a,l;const r=Gm((t==null?void 0:t.model)||(n==null?void 0:n.model)),i=(t==null?void 0:t.children)??[];return{...e,name:((s=t==null?void 0:t.name)==null?void 0:s.trim())||((a=n==null?void 0:n.name)==null?void 0:a.trim())||e.name,description:(t==null?void 0:t.description)??e.description,instruction:(t==null?void 0:t.instruction)??e.instruction,agentType:(t==null?void 0:t.type)??e.agentType,modelName:r.modelName||e.modelName,modelProvider:r.modelProvider||e.modelProvider,skills:((l=t==null?void 0:t.skills)==null?void 0:l.map(c=>c.name))??e.skills,subAgents:e.subAgents.map((c,u)=>_ae(c,i[u]))}}function q5(e,t){var c,u,d;const n=e.cloudProvider??t,r=rl(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,subAgents:(e.subAgents??[]).map(f=>q5(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:q5(f.agent,n)}))}}:{}}}function Aae(e,t){var l,c;const n=rl(t),r=[...e.tools??[]],i=vO.filter(u=>u.toolNames.some(d=>r.includes(d))),s=new Set(i.flatMap(u=>u.toolNames)),a=Gm(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=>Aae(u,t))}}function W6(e,t){var s,a,l,c;const n=((s=e.draft)==null?void 0:s.cloudProvider)??t,r=Gm(e.model),i=e.draft?q5(e.draft,n):e.graph?Aae(e.graph,n):{...rl(n),modelSource:void 0,name:((a=e.name)==null?void 0:a.trim())||e.appName.trim(),description:e.description??"",instruction:e.instruction||rl(n).instruction,agentType:e.type??"llm",modelName:r.modelName,modelProvider:r.modelProvider,tools:[...e.tools??[]],skills:((l=e.skills)==null?void 0:l.map(u=>u.name))??[]};return _ae(i,e.graph,{name:((c=e.name)==null?void 0:c.trim())||e.appName.trim(),model:e.model})}function QLe(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 Iz({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 FLe={coding:"智能编程",get_city_weather:"城市天气查询",get_location_weather:"位置天气查询",web_fetch:"网页内容获取"};function Cae(e){const t=vO.find(n=>n.id===e||n.toolNames.includes(e));return FLe[e]??(t==null?void 0:t.label)??e}function ULe(){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 zLe(){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 VLe({agentName:e,tools:t,selectedIds:n,loading:r,disabled:i,unavailableReason:s,onChange:a,onClose:l}){const[c,u]=m.useState(""),d=m.useMemo(()=>new Set(n),[n]),f=m.useRef(`studio-tool-${Math.random().toString(36).slice(2)}`),h=m.useMemo(()=>{const b=c.trim().toLowerCase();return b?t.filter(g=>`${g.name} ${g.id} ${g.description}`.toLowerCase().includes(b)):t},[c,t]);m.useEffect(()=>{const b=document.body.style.overflow;document.body.style.overflow="hidden";const g=O=>{O.key==="Escape"&&l()};return document.addEventListener("keydown",g),()=>{document.removeEventListener("keydown",g),document.body.style.overflow=b}},[l]);const p=b=>{const g=new Set(d);g.has(b)?g.delete(b):g.add(b),a([...g])};return si.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(Iz,{})}),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(ULe,{})})]}),o.jsxs("div",{className:"studio-tool-dialog-body",children:[o.jsxs("label",{className:"studio-tool-search",children:[o.jsx(zLe,{}),o.jsx("input",{value:c,"aria-label":"搜索 Studio 工具",placeholder:"搜索中文名称或工具标识",autoFocus:!0,onChange:b=>u(b.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(b=>{const g=d.has(b.id);return o.jsxs("article",{className:"studio-tool-option",role:"listitem",children:[o.jsx("span",{className:"studio-tool-option-icon",children:o.jsx(Iz,{})}),o.jsxs("span",{className:"studio-tool-option-copy",children:[o.jsx("strong",{children:b.name||Cae(b.id)}),o.jsx("code",{children:b.id}),o.jsx("span",{children:b.description})]}),o.jsx("button",{type:"button",disabled:i,"aria-pressed":g,onClick:()=>p(b.id),children:g?"移除":"添加"})]},b.id)})})]})]})]}),document.body)}function Ln({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})}function Nae(e){return 1+e.children.reduce((t,n)=>t+Nae(n),0)}function jae(e){return e.id||e.name}function qLe(e,t){const n=jae(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 Rae(e,t=!0){return{...e,id:jae(e),name:qLe(e,t),children:e.children.map(n=>Rae(n,!1))}}function Iae(e){const t=rl(),n=Gm(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(Iae)}}function HLe(e){return[...new Set(e.map(t=>t.trim()).filter(Boolean))]}function XLe(e){return[...new Map(e.filter(t=>t.name.trim()).map(t=>[t.name.trim(),{...t,name:t.name.trim()}])).values()]}function aR({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 GLe({appName:e,info:t,loading:n,variant:r="rail",studioTools:i=[],selectedStudioToolIds:s=[],studioToolsLoading:a=!1,studioToolsDisabled:l=!1,studioToolsUnavailableReason:c="",onStudioToolsChange:u}){const[d,f]=m.useState(null),[h,p]=m.useState(!1),b=m.useRef(null),g=()=>{p(!1),window.requestAnimationFrame(()=>{var _;return(_=b.current)==null?void 0:_.focus()})};if(m.useEffect(()=>{if(!h)return;const _=document.body.style.overflow,R=$=>{$.key==="Escape"&&g()};return document.body.style.overflow="hidden",document.addEventListener("keydown",R),()=>{document.body.style.overflow=_,document.removeEventListener("keydown",R)}},[h]),n&&!t)return o.jsx("aside",{className:`topo is-loading${r==="drawer"?" is-drawer":""}`,"aria-label":"Agent 信息","aria-live":"polite",children:o.jsx(Ln,{as:"span",className:"topo-loading-label",duration:2.2,children:"正在读取 Agent 信息…"})});if(!t)return null;const O=Y6(t.model),y=Rae(t.graph??{id:t.name,name:t.name,description:t.description,type:t.type??"llm",model:O,tools:t.tools,skills:t.skills,path:[t.name],mentionable:!1,children:[]}),v=HLe(t.tools).map(_=>({id:`base:tool:${_}`,name:_,label:Cae(_),custom:!1})),x=new Set(v.map(_=>_.name)),w=new Set(s),S=i.filter(_=>w.has(_.id)&&!x.has(_.id)).map(_=>({id:`studio:tool:${_.id}`,name:_.id,label:_.name,custom:!0})),E=[...v,...S],k=XLe(t.skills),T=!!u,C=Iae(y),N=_=>o.jsx(zx,{draft:C,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0},_);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"}),O&&o.jsx("span",{title:O,children:O})]}),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(aR,{title:"工具",count:E.length}),o.jsx("div",{className:"topo-module-scroll topo-tools-scroll",role:"region","aria-label":"工具列表",tabIndex:0,children:E.length>0?o.jsx("div",{className:"topo-tool-list",children:E.map(_=>o.jsxs("div",{className:"topo-tool",title:_.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:_.label}),o.jsx("code",{children:_.name})]}),_.custom&&o.jsx("span",{className:"topo-custom-badge",children:"Studio Tool"})]}),_.custom&&o.jsx("button",{type:"button",className:"topo-remove-capability","aria-label":`移除工具 ${_.name}`,title:"移除",disabled:l,onClick:()=>u==null?void 0:u(s.filter(R=>R!==_.name)),children:"×"})]},_.id))}):o.jsx("div",{className:"topo-empty",children:"未配置"})}),T&&o.jsx("div",{className:"topo-capability-add-dock",children:o.jsxs("button",{type:"button",className:"topo-capability-add-slot","aria-label":"添加 Studio 工具",disabled:l,onClick:()=>f("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(aR,{title:"技能",count:t.skillsPreviewSupported?k.length:void 0}),o.jsx("div",{className:"topo-module-scroll topo-skills-scroll",role:"region","aria-label":"技能列表",tabIndex:0,children:t.skillsPreviewSupported?k.length>0?o.jsx("div",{className:"topo-skill-list",children:k.map(_=>o.jsxs("div",{className:"topo-skill",title:_.description||_.name,children:[o.jsx("div",{className:"topo-skill-title",children:o.jsx("span",{className:"topo-skill-name",children:_.name})}),_.description&&o.jsx("span",{className:"topo-skill-description",children:_.description})]},`${_.name}:${_.description}`))}):o.jsx("div",{className:"topo-empty",children:"未配置"}):o.jsx("div",{className:"topo-empty",children:"暂不支持预览"})})]}),o.jsxs("section",{className:"topo-module-card topo-topology","aria-label":"Agent 画布",children:[o.jsxs("div",{className:"topo-canvas-heading",children:[o.jsx(aR,{title:"结构拓扑",count:Nae(y)}),o.jsx("button",{ref:b,type:"button",className:"topo-canvas-expand","aria-label":"全屏查看 Agent 画布",title:"全屏查看",onClick:()=>p(!0),children:o.jsx(F0,{"aria-hidden":"true"})})]}),o.jsx("div",{className:"topo-canvas-preview",role:"region","aria-label":"Agent 执行画布",children:N(`conversation-canvas:${e}`)})]})]}),d==="tool"&&u&&o.jsx(VLe,{agentName:t.name,tools:i.filter(_=>!x.has(_.id)),selectedIds:s,loading:a,disabled:l,unavailableReason:c,onChange:u,onClose:()=>f(null)})]}),h&&si.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:g,autoFocus:!0,children:o.jsx(Ya,{"aria-hidden":"true"})})]}),o.jsx("div",{className:"topo-canvas-dialog-body",children:N(`conversation-canvas-fullscreen:${e}`)})]}),document.body)]})}const wO={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0};function Dz(e){return o.jsxs("svg",{...wO,...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 YLe(e){return o.jsxs("svg",{...wO,...e,children:[o.jsx("circle",{cx:"10.7",cy:"10.7",r:"6.1"}),o.jsx("path",{d:"m15.25 15.25 4.2 4.2"})]})}function WLe(e){return o.jsxs("svg",{...wO,...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 ZLe(e){return o.jsxs("svg",{...wO,...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 KLe(e){return o.jsxs("svg",{...wO,...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 Dae(e){return o.jsx("svg",{...wO,...e,children:o.jsx("path",{d:"m6.5 6.5 11 11M17.5 6.5l-11 11"})})}const JLe=180,Pz=500,Mz=10,Lz=32;function e4e(e){return Array.from(new Set(e.split(/[,,]/).map(t=>t.trim()).filter(Boolean)))}function t4e({artifact:e,busy:t,error:n,onClose:r,onSave:i}){const[s,a]=m.useState(e.name),[l,c]=m.useState(e.description??""),[u,d]=m.useState((e.tags??[]).join(",")),[f,h]=m.useState(""),p=m.useId(),b=m.useId(),g=m.useRef(null),O=m.useRef(null),y=m.useRef(t),v=m.useRef(r);m.useEffect(()=>{y.current=t,v.current=r},[t,r]),m.useEffect(()=>{var T,C;const S=document.body.style.overflow,E=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(T=O.current)==null||T.focus(),(C=O.current)==null||C.select();const k=N=>{if(N.key==="Escape"&&!y.current){N.preventDefault(),v.current();return}if(N.key!=="Tab")return;const _=g.current;if(!_)return;const R=Array.from(_.querySelectorAll('button:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(M=>M.getClientRects().length>0);if(R.length===0){N.preventDefault();return}const $=R[0],D=R[R.length-1];N.shiftKey&&document.activeElement===$?(N.preventDefault(),D.focus()):!N.shiftKey&&document.activeElement===D&&(N.preventDefault(),$.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 T;S.preventDefault();const E=s.trim(),k=e4e(u);if(!E){h("请输入产物名称"),(T=O.current)==null||T.focus();return}if(k.length>Mz){h(`标签最多 ${Mz} 个`);return}if(k.some(C=>C.length>Lz)){h(`单个标签不能超过 ${Lz} 个字符`);return}h(""),i({name:E,description:l.trim(),tags:k})},w=f||n;return si.createPortal(o.jsx("div",{className:"artifact-edit-backdrop",onMouseDown:S=>{S.target===S.currentTarget&&!t&&r()},children:o.jsxs("section",{ref:g,className:"artifact-edit-dialog",role:"dialog","aria-modal":"true","aria-labelledby":p,"aria-describedby":b,"aria-busy":t||void 0,children:[o.jsxs("header",{className:"artifact-edit-dialog__header",children:[o.jsxs("div",{children:[o.jsx("h2",{id:p,children:"编辑产物信息"}),o.jsx("p",{id:b,children:"内容文件不会被修改"})]}),o.jsx("button",{type:"button",onClick:r,disabled:t,"aria-label":"关闭编辑框",children:o.jsx(Dae,{})})]}),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:O,value:s,maxLength:JLe,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:Pz,disabled:t,rows:4,placeholder:"补充用途、版本或使用说明",onChange:S=>c(S.target.value)}),o.jsxs("small",{children:[l.length,"/",Pz]})]}),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)}function n4e(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"5.5",cy:"12",r:"1.4"}),o.jsx("circle",{cx:"12",cy:"12",r:"1.4"}),o.jsx("circle",{cx:"18.5",cy:"12",r:"1.4"})]})}function Pae({label:e,menuLabel:t,items:n,className:r="",placement:i="bottom-end"}){const[s,a]=m.useState(!1),l=m.useRef(null),c=m.useRef(null),u=m.useRef([]);m.useEffect(()=>{if(!s)return;const f=p=>{var b;(b=l.current)!=null&&b.contains(p.target)||a(!1)},h=p=>{var b;p.key==="Escape"&&(p.preventDefault(),a(!1),(b=c.current)==null||b.focus())};return window.addEventListener("pointerdown",f),window.addEventListener("keydown",h),()=>{window.removeEventListener("pointerdown",f),window.removeEventListener("keydown",h)}},[s]),m.useEffect(()=>{var f;s&&((f=u.current.find(h=>h&&!h.disabled))==null||f.focus())},[s]);const d=f=>{var g;if(!s||!["ArrowDown","ArrowUp","Home","End"].includes(f.key))return;f.preventDefault();const h=u.current.filter(O=>!!(O&&!O.disabled));if(h.length===0)return;const p=h.indexOf(document.activeElement),b=f.key==="Home"?0:f.key==="End"?h.length-1:(p+(f.key==="ArrowDown"?1:-1)+h.length)%h.length;(g=h[b])==null||g.focus()};return o.jsxs("div",{className:"studio-action-menu",ref:l,onKeyDown:d,children:[o.jsx("button",{ref:c,type:"button",className:`studio-action-menu__trigger ${r}`.trim(),"aria-label":e,"aria-haspopup":"menu","aria-expanded":s,disabled:n.length===0,onClick:()=>a(f=>!f),children:o.jsx(n4e,{})}),s?o.jsx("div",{className:`studio-action-menu__popover studio-action-menu__popover--${i}`,role:"menu","aria-label":t,children:n.map((f,h)=>o.jsx("button",{ref:p=>{u.current[h]=p},type:"button",role:"menuitem",className:`studio-action-menu__item${f.danger?" is-danger":""}`,disabled:f.disabled,title:f.title,onClick:()=>{a(!1),f.onSelect()},children:f.label},f.label))}):null]})}function ow(e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var r4e=typeof Jf=="object"&&Jf&&Jf.Object===Object&&Jf,i4e=typeof self=="object"&&self&&self.Object===Object&&self;r4e||i4e||Function("return this")();var s4e=typeof window<"u"?m.useLayoutEffect:m.useEffect;function a4e(){const e=m.useRef(!1);return m.useEffect(()=>(e.current=!0,()=>{e.current=!1}),[]),m.useCallback(()=>e.current,[])}var $z={width:void 0,height:void 0};function Mae(e){const{ref:t,box:n="content-box"}=e,[{width:r,height:i},s]=m.useState($z),a=a4e(),l=m.useRef({...$z}),c=m.useRef(void 0);return c.current=e.onResize,m.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=Bz(d,f,"inlineSize"),p=Bz(d,f,"blockSize");if(l.current.width!==h||l.current.height!==p){const g={width:h,height:p};l.current.width=h,l.current.height=p,c.current?c.current(g):a()&&s(g)}});return u.observe(t.current,{box:n}),()=>{u.disconnect()}},[n,t,a]),{width:r,height:i}}function Bz(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 Z6(e,t){const n=m.useRef(e);s4e(()=>{n.current=e},[e]),m.useEffect(()=>{if(!t&&t!==0)return;const r=setTimeout(()=>{n.current()},t);return()=>{clearTimeout(r)}},[t])}const o4e="_Alert_1tr02_1",l4e="_Content_1tr02_145",c4e="_Indicator_1tr02_156",u4e="_Message_1tr02_159",d4e="_Title_1tr02_162",f4e="_Description_1tr02_168",h4e="_Actions_1tr02_173",mp={Alert:o4e,Content:l4e,Indicator:c4e,Message:u4e,Title:d4e,Description:f4e,Actions:h4e},Vx=({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=m.useRef(null),h=m.useRef(null),[p,b]=m.useState("end"),{width:g}=Mae({ref:f});return m.useEffect(()=>{var y;const O=((y=h.current)==null?void 0:y.clientWidth)??0;if(O&&g){const v=O>g/3?"bottom":"end";b(v)}},[g]),o.jsxs("div",{ref:ow([u,f]),className:zr(mp.Alert,l),"data-variant":t,"data-color":e,role:e==="danger"?"alert":void 0,"data-actions-placement":s??p,...d,children:[a===!1?null:o.jsx("div",{className:mp.Indicator,children:a??o.jsx(p4e,{color:e})}),o.jsxs("div",{className:mp.Content,children:[o.jsxs("div",{className:mp.Message,children:[n&&o.jsx("div",{className:mp.Title,children:n}),r&&o.jsx("div",{className:mp.Description,children:r})]}),i&&o.jsx("div",{className:zr(mp.Actions,c),ref:h,children:i})]})]})},p4e=({color:e})=>{switch(e){case"warning":case"caution":case"danger":return o.jsx(kne,{});case"success":return o.jsx(v2e,{});default:return o.jsx(Sne,{})}},m4e={DEV:!1,MODE:"production"},V0=typeof import.meta<"u"?m4e:void 0,g4e=!!(V0!=null&&V0.DEV),b4e=typeof navigator<"u"&&/(jsdom|happy-dom)/i.test(navigator.userAgent)||typeof globalThis.happyDOM=="object",Lae=(V0==null?void 0:V0.MODE)==="test"||b4e,O4e=typeof window<"u",$ae=typeof document<"u",y4e=O4e&&$ae,K6=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())},k2=(e,t)=>{const n=()=>{const a=setTimeout(e);return()=>{clearTimeout(a)}};if(!y4e||typeof window.requestAnimationFrame!="function"||$ae&&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)}},lw=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},{}),oR=e=>typeof e=="number"?`${e}deg`:e,lR=e=>String(e),ZS=e=>`${e}ms`,cR=({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(${oR(r)})`,i==null?null:`skewX(${oR(i)})`,s==null?null:`skewY(${oR(s)})`].filter(Boolean);return a.length?a.join(" "):"none"},uR=({blur:e}={})=>{const t=[e==null?null:`blur(${e}px)`].filter(Boolean);return t.length?t.join(" "):"none"},fm=e=>{e.preventDefault()},Bae=e=>e.querySelectorAll('a[href], input:not([disabled]):not([type="hidden"]), textarea:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex^="-"]), [contenteditable]');m.createContext(null);const x4e="_LoadingIndicator_7yl6f_1",v4e={LoadingIndicator:x4e},BA=({className:e,size:t,strokeWidth:n,style:r,...i})=>o.jsx("div",{...i,className:zr(v4e.LoadingIndicator,e),style:r||lw({"indicator-size":t,"indicator-stroke":n})}),w4e=()=>Lae,Qz=(e,t=!1,n="TransitionGroup")=>{const r=[];return m.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},kg=()=>{},Tg=e=>{const t=m.useRef(e);return t.current=e,m.useCallback(n=>t.current(n),[])};function S4e(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 E4e(e,t,n){if((Lae||g4e)&&t&&n>1)throw new Error(`Cannot use forwardRef with multiple children in <${e} />`)}const k4e="_TransitionGroupChild_1hv1z_1",T4e={TransitionGroupChild:k4e},Qae={enter:!1,enterActive:!1,exit:!1,exitActive:!1,interrupted:!1},_4e=e=>({...Qae,enter:!e}),A4e=(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 Qae}},C4e=({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:p,onExit:b,onExitActive:g,onExitComplete:O})=>{const[y,v]=m.useReducer(A4e,_4e(a||!1)),x=m.useRef(!1),w=m.useRef(null),S=m.useRef(c);S.current=c;const E=m.useRef(u);E.current=u;const k=m.useRef(null),T=m.useCallback(C=>{const N=w.current;if(!(!N||C===k.current))switch(k.current=C,C){case"enter":f(N);break;case"enter-active":h(N);break;case"enter-complete":p(N);break;case"exit":b(N);break;case"exit-active":g(N);break;case"exit-complete":O(N);break}},[f,h,p,b,g,O]);return Cn.useLayoutEffect(()=>{if(!l){let _;v({type:"exit-before"}),T("exit");const R=k2(()=>{v({type:"exit-active"}),T("exit-active"),_=window.setTimeout(()=>{T("exit-complete"),d()},E.current)});return()=>{R(),_!==void 0&&clearTimeout(_)}}if(a&&!x.current){x.current=!0;return}let C;v({type:"enter-before"}),T("enter");const N=k2(()=>{v({type:"enter-active"}),T("enter-active"),C=window.setTimeout(()=>{v({type:"done"}),T("enter-complete")},S.current)});return()=>{N(),C!==void 0&&clearTimeout(C)}},[l,a,d,T]),m.useEffect(()=>()=>{x.current=!1},[]),o.jsx(t,{ref:ow([w,e]),className:zr(r,T4e.TransitionGroupChild),"data-transition-id":i,style:s,"data-entering":y.enter?"":void 0,"data-entering-active":y.enterActive?"":void 0,"data-exiting":y.exit?"":void 0,"data-exiting-active":y.exitActive?"":void 0,"data-interrupted":y.interrupted?"":void 0,children:n})},N4e=e=>{const{enterMountDelay:t,preventMountTransition:n}=e,r=!n&&t!=null?t:null,[i,s]=m.useState(r==null);return Z6(()=>s(!0),i?null:r),i?o.jsx(C4e,{...e}):null},QA=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=w4e()}=e,p=Tg(e.onEnter??kg),b=Tg(e.onEnterActive??kg),g=Tg(e.onEnterComplete??kg),O=Tg(e.onExit??kg),y=Tg(e.onExitActive??kg),v=Tg(e.onExitComplete??kg);m.Children.forEach(r,E=>{if(E&&!E.key)throw new Error("Child elements of must include a `key`")});const x=m.useCallback(E=>({component:E,shouldRender:!0,removeChild:()=>{S(k=>k.filter(T=>E.key!==T.component.key))},onEnter:p,onEnterActive:b,onEnterComplete:g,onExit:O,onExitActive:y,onExitComplete:v}),[p,b,g,O,y,v]),[w,S]=m.useState(()=>Qz(r).map(E=>({...x(E),preventMountTransition:u})));return m.useLayoutEffect(()=>{S(E=>{const k=Qz(r);return S4e(k,E,x,f)})},[r,f,x]),E4e("TransitionGroup",t,m.Children.count(r)),h?o.jsx(o.Fragment,{children:m.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(N4e,{...k,as:n,className:i,transitionId:s,enterDuration:l,exitDuration:c,enterMountDelay:d,style:a,ref:t,children:E},E.key))})},j4e="_Button_1864l_1",R4e="_ButtonInner_1864l_4",I4e="_ButtonLoader_1864l_749",dR={Button:j4e,ButtonInner:R4e,ButtonLoader:I4e},vn=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:p,className:b,onClick:g,disabled:O,disabledTone:y,inert:v=u,...x}=e,w=O||v,S=m.useCallback(E=>{O||g==null||g(E)},[g,O]);return o.jsxs("button",{type:t,className:zr(dR.Button,b),"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:K6,disabled:w,"aria-disabled":w,tabIndex:w?-1:void 0,"data-disabled":O?"":void 0,"data-disabled-tone":O?y:void 0,onClick:S,...x,children:[o.jsx(QA,{className:dR.ButtonLoader,enterDuration:250,exitDuration:150,children:u&&o.jsx(BA,{},"loader")}),o.jsx("span",{className:dR.ButtonInner,children:S6(p)})]})},D4e=()=>{var e;return typeof ClipboardItem<"u"&&!!((e=navigator.clipboard)!=null&&e.write)};function P4e(e){const{"text/plain":t,...n}=e;return new ClipboardItem({...n,...t?{"text/plain":new Blob([t],{type:"text/plain"})}:null})}async function M4e(e,t=document.body){if(typeof e=="string")return Fz(e,t);try{return D4e()?(await navigator.clipboard.write([P4e(e)]),!0):e["text/plain"]?Fz(e["text/plain"],t):!1}catch{return!1}}async function Fz(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}const L4e="_TransitionItem_1o7b1_1",$4e={TransitionItem:L4e},B4e=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}=V4e(e);return o.jsx(t,{className:zr("block",l==="absolute"&&"relative",n),"data-transition-position":l,style:d,children:o.jsx(QA,{as:t,className:zr($4e.TransitionItem,a),enterDuration:c,exitDuration:u,insertMethod:s,preventInitialTransition:i,children:r})})},Q4e=400,F4e=500,U4e=200,z4e=300;function V4e({initial:e,enter:t,exit:n,forceCompositeLayer:r}){const i=cR(e),s=cR(t),a=cR(n),l=[i,a,s].some(g=>g!=="none"),c=(t==null?void 0:t.duration)??(l?F4e:Q4e),u=(t==null?void 0:t.timingFunction)??(l?"var(--cubic-enter)":"ease"),d=(n==null?void 0:n.duration)??(l?z4e:U4e),f=(n==null?void 0:n.timingFunction)??(l?"var(--cubic-exit)":"ease"),h=lw({"tg-will-change":r?"transform, opacity":"auto","tg-enter-opacity":lR((t==null?void 0:t.opacity)??1),"tg-enter-transform":s,"tg-enter-filter":uR(t),"tg-enter-duration":ZS(c),"tg-enter-delay":ZS((t==null?void 0:t.delay)??0),"tg-enter-timing-function":u,"tg-exit-opacity":lR((n==null?void 0:n.opacity)??0),"tg-exit-transform":a,"tg-exit-filter":uR(n),"tg-exit-duration":ZS(d),"tg-exit-delay":ZS((n==null?void 0:n.delay)??0),"tg-exit-timing-function":f,"tg-initial-opacity":lR((e==null?void 0:e.opacity)??(n==null?void 0:n.opacity)??0),"tg-initial-transform":i==="none"?a:i,"tg-initial-filter":uR(e??n??{})}),p=((t==null?void 0:t.delay)??0)+c,b=((n==null?void 0:n.delay)??0)+d;return{enterTotalDuration:p,exitTotalDuration:b,variables:h}}const Fae=({children:e,copyValue:t,onClick:n,...r})=>{const[i,s]=m.useState(!1),a=m.useRef(null),l=c=>{i||(s(!0),n==null||n(c),M4e(typeof t=="function"?t():t),a.current=window.setTimeout(()=>{s(!1)},1300))};return m.useEffect(()=>()=>{a.current&&clearTimeout(a.current)},[]),o.jsxs(vn,{...r,onClick:l,children:[o.jsx(B4e,{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(K4,{},"copied-icon"):o.jsx(vne,{},"copy-icon")}),typeof e=="function"?e({copied:i}):e]})};function Bl({title:e,description:t,error:n,confirmLabel:r,cancelLabel:i="取消",closeLabel:s="关闭确认框",variant:a="warning",busy:l=!1,onCancel:c,onConfirm:u}){const d=m.useId(),f=m.useId(),h=m.useRef(null),p=m.useRef(l),b=m.useRef(c);return m.useEffect(()=>{p.current=l,b.current=c},[l,c]),m.useEffect(()=>{var v;const g=document.body.style.overflow,O=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.style.overflow="hidden",(v=h.current)==null||v.focus();const y=x=>{x.key==="Escape"&&!p.current&&b.current()};return window.addEventListener("keydown",y),()=>{document.body.style.overflow=g,window.removeEventListener("keydown",y),O!=null&&O.isConnected&&O.focus()}},[]),si.createPortal(o.jsx("div",{className:"studio-confirm-backdrop",onMouseDown:g=>{g.target===g.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(kne,{})}),o.jsx("h2",{id:d,children:e})]}),o.jsx(vn,{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(e6,{})})]}),o.jsxs("div",{className:"studio-confirm-body",children:[o.jsx("p",{id:f,children:t}),n?o.jsx(Vx,{className:"studio-confirm-error",color:"danger",variant:"soft",description:n}):null]}),o.jsxs("footer",{className:"studio-confirm-actions",children:[o.jsx(vn,{ref:h,type:"button",color:"secondary",variant:"ghost",size:"lg",pill:!1,onClick:c,disabled:l,children:i}),o.jsx(vn,{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 q4e=new Set(["avif","bmp","gif","heic","jpeg","jpg","png","svg","tif","tiff","webp"]),H4e=new Set(["avi","m4v","mkv","mov","mp4","mpeg","mpg","webm"]),X4e=new Set(["csv","htm","html","json","md","pdf","svg","txt","xml","yaml","yml"]);function Uae(e){const t=e.lastIndexOf(".");return t<0?"":e.slice(t+1).toLocaleLowerCase()}function T2(e,t){if(!Number.isFinite(e))return t;const n=e;return n>1e10?n:n*1e3}function G4e(e){var t,n;return((t=e.actions)==null?void 0:t.artifactDelta)??((n=e.actions)==null?void 0:n.artifact_delta)}function Y4e(e){return`${e.replace(/\.pptx$/i,"")}.preview.webp`}function W4e(e){var t;return(((t=e.content)==null?void 0:t.parts)??[]).map(n=>n.functionResponse??n.function_response).filter(n=>!!n)}function Z4e(e){if(!e)return{};const t=e.result;return t&&typeof t=="object"&&!Array.isArray(t)?t:e}function Uz(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 K4e(e,t){const n=Z4e(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:Uz(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:Uz(u||"generated-video",c,s),url:c,type:s,taskId:u})}return a}function zz(e,t){return new Date(T2(e,t)||Date.now()).toISOString()}function J4e(e){var r;const t=[],n=new Set;for(const i of e)for(const s of i.sessions){const a=T2(s.lastUpdateTime,Date.now()),l=xA(s.events);for(const c of s.events??[])for(const u of W4e(c)){const d=(u==null?void 0:u.name)??"";for(const f of K4e(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:zz(s.lastUpdateTime,a),createdAt:zz(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 zae(e){const t=Uae(e);return q4e.has(t)?"image":H4e.has(t)?"video":"document"}function e6e(e){const t=zae(e);return t==="image"?"image":t==="video"?"video":X4e.has(Uae(e))?"frame":"unavailable"}function t6e(e){var n;const t=[];for(const r of e)for(const i of r.sessions){const s=T2(i.lastUpdateTime,0),a=new Map;for(const l of i.events??[]){const c=G4e(l);if(!c)continue;const u=T2(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(Y4e(l.filename)),u=c??l,d=c?"image":e6e(l.filename);t.push({id:`${r.appName}:${i.id}:${l.filename}:${l.version}`,appName:r.appName,agentId:r.agentId,sessionId:i.id,sessionTitle:xA(i.events),agentName:((n=r.agentName)==null?void 0:n.trim())||r.appName,sessionUpdatedAt:s,name:l.filename,version:l.version,type:zae(l.filename),createdAt:l.createdAt||s,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 Vae(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 qae(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 fR=40,n6e=[{id:"document",label:"文档"},{id:"image",label:"图片"},{id:"video",label:"视频"}],r6e={document:"文档",image:"图片",video:"视频"};function KS(e){return e instanceof Error?e.message:String(e)}function Hae({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(Dz,{})}):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(Dz,{})})]})})}function i6e({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(Hae,{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:qae(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:Vae(e.updatedAt??e.createdAt)}),o.jsx("td",{className:"library-artifact-actions-cell",children:o.jsx("div",{className:"library-artifact-actions",children:o.jsx(Pae,{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 s6e({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}){var We,W;const[h,p]=m.useState(null),[b,g]=m.useState(""),[O,y]=m.useState(null),[v,x]=m.useState(""),[w,S]=m.useState(""),[E,k]=m.useState(""),[T,C]=m.useState(""),[N,_]=m.useState({}),[R,$]=m.useState(()=>new Set),[D,M]=m.useState(null),[j,P]=m.useState(!1),[L,U]=m.useState(""),[F,q]=m.useState(null),[z,B]=m.useState(!1),[V,ce]=m.useState(fR),we=m.useRef(null),Oe=m.useRef(null),de=m.useRef(0),Z=m.useRef(null),J=m.useRef(null),fe=m.useRef(!1),be=m.useCallback(()=>{de.current+=1,y(null),x(""),S("")},[]),je=m.useMemo(()=>t?[...t]:t6e(e),[t,e]),Qe=m.useMemo(()=>je.filter(ne=>!R.has(ne.id)).map(ne=>N[ne.id]??ne),[je,N,R]);m.useEffect(()=>()=>{de.current+=1},[]),m.useEffect(()=>()=>{v&&URL.revokeObjectURL(v)},[v]),m.useEffect(()=>{var re;if(!O)return;const ne=document.activeElement,he=document.body.style.overflow;document.body.style.overflow="hidden",(re=we.current)==null||re.focus();const xe=Re=>{if(Re.key==="Escape"){Re.preventDefault(),be();return}if(Re.key!=="Tab")return;const nt=Oe.current;if(!nt)return;const Ke=Array.from(nt.querySelectorAll('button:not([disabled]), video[controls], iframe, [tabindex]:not([tabindex="-1"])')).filter(At=>At.getClientRects().length>0);if(Ke.length===0){Re.preventDefault();return}const tn=Ke[0],Gt=Ke[Ke.length-1];Re.shiftKey&&document.activeElement===tn?(Re.preventDefault(),Gt.focus()):!Re.shiftKey&&document.activeElement===Gt&&(Re.preventDefault(),tn.focus())};return document.addEventListener("keydown",xe),()=>{document.removeEventListener("keydown",xe),document.body.style.overflow=he,ne!=null&&ne.isConnected&&ne.focus()}},[be,O]);const Me=async ne=>{const he=de.current+1;if(de.current=he,k(""),x(""),y(ne),ne.preview.mode!=="unavailable"){if(ne.contentUrl){x(ne.contentUrl);return}S(`preview:${ne.id}`);try{const xe=await g6(ne.appName,n,ne.sessionId,ne.preview.filename,ne.preview.version);if(de.current!==he){URL.revokeObjectURL(xe);return}x(xe)}catch(xe){de.current===he&&k(`无法预览“${ne.name}”:${KS(xe)}`)}finally{de.current===he&&S("")}}},le=async ne=>{k(""),S(`download:${ne.id}`);try{d?await d(ne):await m6(ne.appName,n,ne.sessionId,ne.name,ne.version),C(`已开始下载 ${ne.name}`)}catch(he){k(`无法下载“${ne.name}”:${KS(he)}`)}finally{S("")}},ke=async ne=>{if(!(!D||!c)){P(!0),U("");try{const xe=await c(D,ne)??{...D,...ne,updatedAt:Date.now()};_(re=>({...re,[D.id]:xe})),C(`已更新 ${xe.name}`),M(null)}catch(he){U(KS(he))}finally{P(!1)}}},ye=async()=>{if(!(!F||!u)){B(!0),k("");try{await u(F),$(ne=>new Set([...ne,F.id])),C(`已删除 ${F.name}`),(O==null?void 0:O.id)===F.id&&be(),q(null)}catch(ne){k(`无法删除“${F.name}”:${KS(ne)}`),q(null)}finally{B(!1)}}},$e=m.useMemo(()=>{const ne=b.trim().toLocaleLowerCase();return Qe.filter(he=>h&&he.type!==h?!1:ne?[he.name,he.sessionTitle,he.agentName].some(xe=>xe.toLocaleLowerCase().includes(ne)):!0)},[h,Qe,b]),ze=m.useMemo(()=>$e.slice(0,V),[$e,V]),Ae=V<$e.length,Ve=m.useCallback(()=>{fe.current||(fe.current=!0,ce(ne=>ne+fR))},[]);m.useEffect(()=>{ce(fR)},[i,h,b,$e.length]),m.useEffect(()=>{fe.current=!1},[V]),m.useEffect(()=>{const ne=J.current,he=Z.current;if(!r||!ne||!he||!Ae)return;const xe=new IntersectionObserver(([re])=>{re.isIntersecting&&Ve()},{root:he,rootMargin:"240px 0px",threshold:.01});return xe.observe(ne),()=>xe.disconnect()},[r,Ae,Ve,V]);const ut=()=>{const ne=Z.current;!r||!ne||!Ae||ne.scrollHeight-ne.scrollTop-ne.clientHeight<=240&&Ve()},Tt=!!b.trim()||h!==null;return o.jsxs("div",{className:"artifact-library-page",children:[o.jsxs("div",{className:"artifact-library-toolbar library-resource-toolbar",children:[o.jsx("nav",{className:"artifact-type-pills","aria-label":"产物类型",children:n6e.map(ne=>o.jsx("button",{type:"button",className:`artifact-type-pill${h===ne.id?" is-active":""}`,"aria-pressed":h===ne.id,onClick:()=>p(he=>he===ne.id?null:ne.id),children:ne.label},ne.id))}),o.jsxs("label",{className:"artifact-library-search",children:[o.jsx(YLe,{}),o.jsx("input",{type:"search","aria-label":"搜索产物",value:b,onChange:ne=>g(ne.target.value),placeholder:"搜索产物或会话"})]})]}),a&&Qe.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,E?o.jsxs("div",{className:"artifact-library-banner",role:"alert",children:[o.jsx("span",{children:E}),o.jsx("button",{type:"button",onClick:()=>k(""),children:"关闭"})]}):null,o.jsx("section",{ref:Z,className:"artifact-library-results","aria-label":"产物列表",onScroll:ut,children:o.jsxs("div",{className:"artifact-library-panel",children:[s&&Qe.length===0?o.jsx("div",{className:"artifact-library-empty",role:"status","aria-live":"polite",children:o.jsx(Ln,{as:"p",duration:2.4,children:"正在加载产物"})}):a&&Qe.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]}):$e.length===0?o.jsxs("div",{className:"artifact-library-empty",children:[o.jsx("p",{children:Tt?"没有找到匹配的产物":"您还没有任何产物"}),o.jsx("span",{children:Tt?"请尝试搜索其他名称或切换类型":"聊天中生成的产物会自动显示在这里"})]}):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:ze.map(ne=>o.jsx(i6e,{artifact:ne,pendingAction:w,disabled:!n&&!t,onPreview:he=>void Me(he),onDownload:he=>void le(he),onEdit:c?he=>{U(""),M(he)}:void 0,onDelete:u?q:void 0,onOpenSource:f},ne.id))})]})}),Ae?o.jsx("div",{ref:J,className:"artifact-library-load-more",role:"status","aria-live":"polite",children:o.jsx(Ln,{as:"span",duration:2.4,children:"正在加载更多产物"})}):null]})}),o.jsx("p",{className:"artifact-library-status","aria-live":"polite",children:T}),O?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:be}),o.jsxs("div",{ref:Oe,className:"artifact-library-preview-panel",children:[o.jsxs("header",{children:[o.jsxs("div",{children:[o.jsx("h2",{id:"artifact-library-preview-title",children:O.name}),o.jsxs("p",{children:[r6e[O.type]," / 版本 ",O.version]})]}),o.jsx("button",{ref:we,type:"button","aria-label":"关闭预览",onClick:be,children:o.jsx(Dae,{})})]}),o.jsxs("div",{className:"artifact-library-preview-content",children:[o.jsx("div",{className:"artifact-library-preview-canvas",children:w===`preview:${O.id}`?o.jsx(Ln,{as:"span",duration:2.4,children:"正在加载预览"}):v&&O.preview.mode==="image"?o.jsx("img",{src:v,alt:`${O.name} 预览`}):v&&O.preview.mode==="video"?o.jsx("video",{src:v,controls:!0,"aria-label":`${O.name} 预览`}):v&&O.preview.mode==="frame"?o.jsx("iframe",{src:v,title:`${O.name} 预览`}):o.jsxs("div",{className:"artifact-library-preview-unavailable",children:[o.jsx(Hae,{artifact:O,large:!0}),o.jsx("p",{children:E?"预览加载失败,请稍后重试或下载查看":"当前格式暂不支持在线预览,请下载查看"})]})}),o.jsxs("aside",{className:"artifact-library-preview-details","aria-label":"产物来源",children:[O.description?o.jsx("p",{className:"artifact-library-preview-description",children:O.description}):null,o.jsxs("dl",{children:[o.jsxs("div",{children:[o.jsx("dt",{children:"Agent"}),o.jsx("dd",{title:O.agentName,children:O.agentName})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"会话"}),o.jsx("dd",{title:O.sessionTitle,children:O.sessionTitle})]}),(We=O.origin)!=null&&We.toolName?o.jsxs("div",{children:[o.jsx("dt",{children:"生成工具"}),o.jsx("dd",{children:O.origin.toolName})]}):null,o.jsxs("div",{children:[o.jsx("dt",{children:"生成时间"}),o.jsx("dd",{children:Vae(O.createdAt)})]}),O.sizeBytes?o.jsxs("div",{children:[o.jsx("dt",{children:"文件大小"}),o.jsx("dd",{children:qae(O.sizeBytes)})]}):null]}),(W=O.tags)!=null&&W.length?o.jsx("div",{className:"artifact-library-preview-tags","aria-label":"标签",children:O.tags.map(ne=>o.jsx("span",{children:ne},ne))}):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 ne=O;be(),f(ne)},children:[o.jsx(ZLe,{}),"查看会话"]}):null,c?o.jsxs("button",{type:"button",className:"is-secondary",disabled:O.canManage===!1,onClick:()=>{const ne=O;be(),U(""),M(ne)},children:[o.jsx(KLe,{}),"编辑信息"]}):null]}),o.jsxs("button",{type:"button",disabled:w.startsWith("download:")||!n&&!t,onClick:()=>void le(O),children:[o.jsx(WLe,{}),"下载"]})]})]})]}):null,D?o.jsx(t4e,{artifact:D,busy:j,error:L,onClose:()=>{j||M(null)},onSave:ne=>void ke(ne)}):null,F?o.jsx(Bl,{title:"删除产物?",description:`“${F.name}”将从产物库永久删除,聊天记录不会受到影响。`,confirmLabel:z?"删除中":"删除",closeLabel:"关闭删除确认框",variant:"danger",busy:z,onCancel:()=>{z||q(null)},onConfirm:()=>void ye()}):null]})}function a6e(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 cw(e,t){if(e.ok)return e;let n;try{n=await e.json()}catch{n=void 0}throw new Error(a6e(n,`${t}(${e.status})`))}function hR(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 Xae(e){const t=e;return{...t,createdAt:hR(t.createdAt),updatedAt:hR(t.updatedAt),sessionUpdatedAt:hR(t.sessionUpdatedAt)}}async function Gae(e){const t=await e.json();return Array.isArray(t.items)?t.items.map(Xae):[]}async function o6e(){const e=await cw(await Hn("/web/artifacts"),"读取产物库失败");return Gae(e)}async function l6e(e){if(e.length===0)return o6e();const t=await cw(await Hn("/web/artifacts/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({candidates:e})},24e4),"同步聊天产物失败");return Gae(t)}async function c6e(e,t){const n=await cw(await Hn(`/web/artifacts/${encodeURIComponent(e.id)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),"更新产物失败");return Xae(await n.json())}async function u6e(e){await cw(await Hn(`/web/artifacts/${encodeURIComponent(e.id)}`,{method:"DELETE"}),"删除产物失败")}async function d6e(e){const n=await(await cw(await Hn(`/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)}var f6e=Object.defineProperty,J6=(e,t)=>f6e(e,"name",{value:t,configurable:!0});function H5(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}J6(H5,"setRef");function Yae(...e){return t=>{let n=!1;const r=e.map(i=>{const s=H5(i,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;ih6e(e,"name",{value:t,configurable:!0});function Ih(e){const t=m.forwardRef((n,r)=>{let{children:i,...s}=n,a=null,l=!1;const c=[];X5(i)&&typeof JS=="function"&&(i=JS(i._payload)),m.Children.forEach(i,h=>{var p;if(toe(h)){l=!0;const b=h;let g="child"in b.props?b.props.child:b.props.children;X5(g)&&typeof JS=="function"&&(g=JS(g._payload)),a=p6e(b,g),c.push((p=a==null?void 0:a.props)==null?void 0:p.children)}else c.push(h)}),a?a=m.cloneElement(a,void 0,c):!l&&m.Children.count(i)===1&&m.isValidElement(i)&&(a=i);const u=a?eoe(a):void 0,d=Ci(r,u);if(!a){if(i||i===0)throw new Error(l?b6e(e):g6e(e));return i}const f=Jae(s,a.props??{});return a.type!==m.Fragment&&(f.ref=r?d:u),m.cloneElement(a,f)});return t.displayName=`${e}.Slot`,t}jc(Ih,"createSlot");var Wae=Ih("Slot"),Zae=Symbol.for("radix.slottable");function Kae(e){const t=jc(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=Zae,t}jc(Kae,"createSlottable");var p6e=jc((e,t)=>{if("child"in e.props){const n=e.props.child;return m.isValidElement(n)?m.cloneElement(n,void 0,e.props.children(n.props.children)):null}return m.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function Jae(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}}jc(Jae,"mergeProps");function eoe(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)}jc(eoe,"getElementRef");function toe(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Zae}jc(toe,"isSlottable");var m6e=Symbol.for("react.lazy");function X5(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===m6e&&"_payload"in e&&noe(e._payload)}jc(X5,"isLazyComponent");function noe(e){return typeof e=="object"&&e!==null&&"then"in e}jc(noe,"isPromiseLike");var g6e=jc(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),b6e=jc(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),JS=nO[" use ".trim().toString()],O6e=Object.defineProperty,y6e=(e,t)=>O6e(e,"name",{value:t,configurable:!0}),x6e=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Qi=x6e.reduce((e,t)=>{const n=Ih(`Primitive.${t}`),r=m.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 roe(e,t){e&&si.flushSync(()=>e.dispatchEvent(t))}y6e(roe,"dispatchDiscreteCustomEvent");var v6e=Object.defineProperty,w6e=(e,t)=>v6e(e,"name",{value:t,configurable:!0}),S6e=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"}),E6e=m.forwardRef(w6e(function(t,n){return o.jsx(Qi.span,{...t,ref:n,style:{...S6e,...t.style}})},"VisuallyHidden")),k6e=E6e,T6e=Object.defineProperty,Nl=(e,t)=>T6e(e,"name",{value:t,configurable:!0});function _6e(e,t){const n=m.createContext(t);n.displayName=e+"Context";const r=Nl(s=>{const{children:a,...l}=s,c=m.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=m.useContext(n);if(c)return c;if(t!==void 0)return t;if(!l)throw new Error(`\`${s}\` must be used within \`${e}\``)}return Nl(i,"useContext"),[r,i]}Nl(_6e,"createContext");function Xl(e,t=[]){let n=[];function r(s,a){const l=m.createContext(a);l.displayName=s+"Context";const c=n.length;n=[...n,a];const u=Nl(f=>{var y;const{scope:h,children:p,...b}=f,g=((y=h==null?void 0:h[e])==null?void 0:y[c])||l,O=m.useMemo(()=>b,Object.values(b));return o.jsx(g.Provider,{value:O,children:p})},"Provider");u.displayName=s+"Provider";function d(f,h,p={}){var y;const{optional:b=!1}=p,g=((y=h==null?void 0:h[e])==null?void 0:y[c])||l,O=m.useContext(g);if(O)return O;if(a!==void 0)return a;if(!b)throw new Error(`\`${f}\` must be used within \`${s}\``)}return Nl(d,"useContext"),[u,d]}Nl(r,"createContext");const i=Nl(()=>{const s=n.map(a=>m.createContext(a));return Nl(function(l){const c=(l==null?void 0:l[e])||s;return m.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])},"useScope")},"createScope");return i.scopeName=e,[r,ioe(i,...t)]}Nl(Xl,"createContextScope");function ioe(...e){const t=e[0];if(e.length===1)return t;const n=Nl(()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return Nl(function(s){const a=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}Nl(ioe,"composeContextScopes");var A6e=Object.defineProperty,qs=(e,t)=>A6e(e,"name",{value:t,configurable:!0});function soe(e){const t=e+"CollectionProvider",[n,r]=Xl(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=qs(g=>{const{scope:O,children:y}=g,v=m.useRef(null),x=m.useRef(new Map).current;return o.jsx(i,{scope:O,itemMap:x,collectionRef:v,children:y})},"CollectionProvider");a.displayName=t;const l=e+"CollectionSlot",c=Ih(l),u=m.forwardRef((g,O)=>{const{scope:y,children:v}=g,x=s(l,y),w=Ci(O,x.collectionRef);return o.jsx(c,{ref:w,children:v})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=Ih(d),p=m.forwardRef((g,O)=>{const{scope:y,children:v,...x}=g,w=m.useRef(null),S=Ci(O,w),E=s(d,y);return m.useEffect(()=>(E.itemMap.set(w,{ref:w,...x}),()=>void E.itemMap.delete(w))),o.jsx(h,{[f]:"",ref:S,children:v})});p.displayName=d;function b(g){const O=s(e+"CollectionConsumer",g);return m.useCallback(()=>{const v=O.collectionRef.current;if(!v)return[];const x=Array.from(v.querySelectorAll(`[${f}]`));return Array.from(O.itemMap.values()).sort((E,k)=>x.indexOf(E.ref.current)-x.indexOf(k.ref.current))},[O.collectionRef,O.itemMap])}return qs(b,"useCollection"),[{Provider:a,Slot:u,ItemSlot:p},b,r]}qs(soe,"createCollection");var Vz=new WeakMap,ms,zo,pR=(zo=class extends Map{constructor(n){super(n);W7(this,ms);UN(this,ms,[...super.keys()]),Vz.set(this,!0)}set(n,r){return Vz.get(this)&&(this.has(n)?wa(this,ms)[wa(this,ms).indexOf(n)]=n:wa(this,ms).push(n)),super.set(n,r),this}insert(n,r,i){const s=this.has(r),a=wa(this,ms).length,l=e$(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=[...wa(this,ms)];let h,p=!1;for(let b=c;b=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 zo(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 zo(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 zo(r)}toReversed(){const n=new zo;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 zo(r)}slice(n,r){const i=new zo;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}},ms=new WeakMap,qs(zo,"OrderedDict"),zo);function Bk(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=aoe(e,t);return n===-1?void 0:e[n]}qs(Bk,"at");function aoe(e,t){const n=e.length,r=e$(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}qs(aoe,"toSafeIndex");function e$(e){return e!==e||e===0?0:Math.trunc(e)}qs(e$,"toSafeInteger");function C6e(e){const t=e+"CollectionProvider",[n,r]=Xl(t),[i,s]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new pR,setItemMap:qs(()=>{},"setItemMap")}),a=qs(({state:x,...w})=>x?o.jsx(c,{...w,state:x}):o.jsx(l,{...w}),"CollectionProvider");a.displayName=t;const l=qs(x=>{const w=O();return o.jsx(c,{...x,state:w})},"CollectionInit");l.displayName=t+"Init";const c=qs(x=>{const{scope:w,children:S,state:E}=x,k=m.useRef(null),[T,C]=m.useState(null),N=Ci(k,C),[_,R]=E;return m.useEffect(()=>{if(!T)return;const $=coe(()=>{});return $.observe(T,{childList:!0,subtree:!0}),()=>{$.disconnect()}},[T]),o.jsx(i,{scope:w,itemMap:_,setItemMap:R,collectionRef:N,collectionRefObject:k,collectionElement:T,children:S})},"CollectionProviderImpl");c.displayName=t+"Impl";const u=e+"CollectionSlot",d=Ih(u),f=m.forwardRef((x,w)=>{const{scope:S,children:E}=x,k=s(u,S),T=Ci(w,k.collectionRef);return o.jsx(d,{ref:T,children:E})});f.displayName=u;const h=e+"CollectionItemSlot",p="data-radix-collection-item",b=Ih(h),g=m.forwardRef((x,w)=>{const{scope:S,children:E,...k}=x,T=m.useRef(null),[C,N]=m.useState(null),_=Ci(w,T,N),R=s(h,S),{setItemMap:$}=R,D=m.useRef(k);ooe(D.current,k)||(D.current=k);const M=D.current;return m.useEffect(()=>{const j=M;return $(P=>C?P.has(C)?P.set(C,{...j,element:C}).toSorted(G5):(P.set(C,{...j,element:C}),P.toSorted(G5)):P),()=>{$(P=>!C||!P.has(C)?P:(P.delete(C),new pR(P)))}},[C,M,$]),o.jsx(b,{[p]:"",ref:_,children:E})});g.displayName=h;function O(){return m.useState(new pR)}qs(O,"useInitCollection");function y(x){const{itemMap:w}=s(e+"CollectionConsumer",x);return w}return qs(y,"useCollection"),[{Provider:a,Slot:f,ItemSlot:g},{createCollectionScope:r,useCollection:y,useInitCollection:O}]}qs(C6e,"createCollection");function ooe(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}qs(ooe,"shallowEqual");function loe(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}qs(loe,"isElementPreceding");function G5(e,t){return!e[1].element||!t[1].element?0:loe(e[1].element,t[1].element)?-1:1}qs(G5,"sortByDocumentPosition");function coe(e){return new MutationObserver(n=>{for(const r of n)if(r.type==="childList"){e();return}})}qs(coe,"getChildListObserver");var N6e=Object.defineProperty,SO=(e,t)=>N6e(e,"name",{value:t,configurable:!0}),uoe=!!(typeof window<"u"&&window.document&&window.document.createElement);function Mr(e,t,{checkForDefaultPrevented:n=!0}={}){return SO(function(i){if(e==null||e(i),n===!1||!i||!i.defaultPrevented)return t==null?void 0:t(i)},"handleEvent")}SO(Mr,"composeEventHandlers");function j6e(e){var t;if(!uoe)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}SO(j6e,"getOwnerWindow");function Y5(e){if(!uoe)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}SO(Y5,"getOwnerDocument");function doe(e,t=!1){const{activeElement:n}=Y5(e);if(!(n!=null&&n.nodeName))return null;if(foe(n)&&n.contentDocument)return doe(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const i=Y5(n).getElementById(r);if(i)return i}}return n}SO(doe,"getActiveElement");function foe(e){return e.tagName==="IFRAME"}SO(foe,"isFrame");var Ql=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},R6e=Object.defineProperty,I6e=(e,t)=>R6e(e,"name",{value:t,configurable:!0}),qz=nO[" useEffectEvent ".trim().toString()],Hz=nO[" useInsertionEffect ".trim().toString()];function hoe(e){if(typeof qz=="function")return qz(e);const t=m.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Hz=="function"?Hz(()=>{t.current=e}):Ql(()=>{t.current=e}),m.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}I6e(hoe,"useEffectEvent");var D6e=Object.defineProperty,uw=(e,t)=>D6e(e,"name",{value:t,configurable:!0}),P6e=nO[" useInsertionEffect ".trim().toString()]||Ql;function Du({prop:e,defaultProp:t,onChange:n=uw(()=>{},"onChange"),caller:r}){const[i,s,a]=poe({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:i,u=m.useCallback(d=>{var f;if(l){const h=moe(d)?d(e):d;h!==e&&((f=a.current)==null||f.call(a,h))}else s(d)},[l,e,s,a]);return[c,u]}uw(Du,"useControllableState");function poe({defaultProp:e,onChange:t}){const[n,r]=m.useState(e),i=m.useRef(n),s=m.useRef(t);return P6e(()=>{s.current=t},[t]),m.useEffect(()=>{var a;i.current!==n&&((a=s.current)==null||a.call(s,n),i.current=n)},[n,i]),[n,r,s]}uw(poe,"useUncontrolledState");function moe(e){return typeof e=="function"}uw(moe,"isFunction");var Xz=Symbol("RADIX:SYNC_STATE");function M6e(e,t,n,r){const{prop:i,defaultProp:s,onChange:a,caller:l}=t,c=i!==void 0,u=hoe(a),d=[{...n,state:s}];r&&d.push(r);const[f,h]=m.useReducer((O,y)=>{if(y.type===Xz)return{...O,state:y.state};const v=e(O,y);return c&&!Object.is(v.state,O.state)&&u(v.state),v},...d),p=f.state,b=m.useRef(p);m.useEffect(()=>{b.current!==p&&(b.current=p,c||u(p))},[p,b,c]);const g=m.useMemo(()=>i!==void 0?{...f,state:i}:f,[f,i]);return m.useEffect(()=>{c&&!Object.is(i,f.state)&&h({type:Xz,state:i})},[i,f.state,c]),[g,h]}uw(M6e,"useControllableStateReducer");var L6e=Object.defineProperty,Xd=(e,t)=>L6e(e,"name",{value:t,configurable:!0});function goe(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}Xd(goe,"useStateMachine");var EO=Xd(e=>{const{present:t,children:n}=e,r=boe(t),i=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),s=Ooe(r.ref,yoe(i));return typeof n=="function"||r.isPresent?m.cloneElement(i,{ref:s}):null},"Presence");function boe(e){const[t,n]=m.useState(),r=m.useRef(null),i=m.useRef(e),s=m.useRef("none"),a=m.useRef(void 0),l=e?"mounted":"unmounted",[c,u]=goe(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{c==="mounted"?(s.current=a.current??Gg(r.current),a.current=void 0):s.current="none"},[c]),Ql(()=>{const d=r.current,f=i.current;if(f!==e){const p=s.current,b=Gg(d);e?(a.current=b,u("MOUNT")):b==="none"||(d==null?void 0:d.display)==="none"?u("UNMOUNT"):u(f&&p!==b?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,u]),Ql(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,h=Xd(b=>{const O=Gg(r.current).includes(CSS.escape(b.animationName));if(b.target===t&&O&&(u("ANIMATION_END"),!i.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},"handleAnimationEnd"),p=Xd(b=>{b.target===t&&(s.current=Gg(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:m.useCallback(d=>{if(d){const f=getComputedStyle(d);r.current=f,a.current=Gg(f)}else r.current=null;n(d)},[])}}Xd(boe,"usePresence");function W5(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Xd(W5,"setRef");function Ooe(...e){const t=m.useRef(e);return t.current=e,m.useCallback(n=>{const r=t.current;let i=!1;const s=r.map(a=>{const l=W5(a,n);return!i&&typeof l=="function"&&(i=!0),l});if(i)return()=>{for(let a=0;a$6e(e,"name",{value:t,configurable:!0}),Q6e=nO[" useId ".trim().toString()]||(()=>{}),F6e=0;function FA(e){const[t,n]=m.useState(Q6e());return Ql(()=>{e||n(r=>r??String(F6e++))},[e]),e||(t?`radix-${t}`:"")}B6e(FA,"useId");var U6e=Object.defineProperty,z6e=(e,t)=>U6e(e,"name",{value:t,configurable:!0}),V6e=m.createContext(void 0);function UA(e){const t=m.useContext(V6e);return e||t||"ltr"}z6e(UA,"useDirection");var q6e=Object.defineProperty,H6e=(e,t)=>q6e(e,"name",{value:t,configurable:!0});function Dh(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}H6e(Dh,"useCallbackRef");var X6e=Object.defineProperty,zs=(e,t)=>X6e(e,"name",{value:t,configurable:!0}),Z5="dismissableLayer.update",G6e="dismissableLayer.pointerDownOutside",Y6e="dismissableLayer.focusOutside",Gz,xoe=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),voe=m.forwardRef(zs(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:l,onInteractOutside:c,onDismiss:u,...d}=t,f=m.useContext(xoe),[h,p]=m.useState(null),b=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=m.useState({}),O=Ci(n,p),y=Array.from(f.layers),[v]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),x=v?y.indexOf(v):-1,w=h?y.indexOf(h):-1,S=f.layersWithOutsidePointerEventsDisabled.size>0,E=w>=x,k=m.useRef(!1),T=woe(R=>{a==null||a(R),c==null||c(R),R.defaultPrevented||u==null||u()},{ownerDocument:b,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:k,dismissableSurfaces:f.dismissableSurfaces,shouldHandlePointerDownOutside:m.useCallback(R=>{if(!(R instanceof Node))return!1;const $=[...f.branches].some(D=>D.contains(R));return E&&!$},[f.branches,E])}),C=Soe(R=>{if(i&&k.current)return;const $=R.target;[...f.branches].some(M=>M.contains($))||(l==null||l(R),c==null||c(R),R.defaultPrevented||u==null||u())},b),N=h?w===y.length-1:!1,_=Dh(R=>{R.key==="Escape"&&(s==null||s(R),!R.defaultPrevented&&u&&(R.preventDefault(),u()))});return m.useEffect(()=>{if(N)return b.addEventListener("keydown",_,{capture:!0}),()=>b.removeEventListener("keydown",_,{capture:!0})},[b,N,_]),m.useEffect(()=>{if(h)return r&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(Gz=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(h)),f.layers.add(h),K5(),()=>{r&&(f.layersWithOutsidePointerEventsDisabled.delete(h),f.layersWithOutsidePointerEventsDisabled.size===0&&(b.body.style.pointerEvents=Gz))}},[h,b,r,f]),m.useEffect(()=>()=>{h&&(f.layers.delete(h),f.layersWithOutsidePointerEventsDisabled.delete(h),K5())},[h,f]),m.useEffect(()=>{const R=zs(()=>g({}),"handleUpdate");return document.addEventListener(Z5,R),()=>document.removeEventListener(Z5,R)},[]),o.jsx(Qi.div,{...d,ref:O,style:{pointerEvents:S?E?"auto":"none":void 0,...t.style},onFocusCapture:Mr(t.onFocusCapture,C.onFocusCapture),onBlurCapture:Mr(t.onBlurCapture,C.onBlurCapture),onPointerDownCapture:Mr(t.onPointerDownCapture,T.onPointerDownCapture)})},"DismissableLayer"));function W6e(){const e=m.useContext(xoe),[t,n]=m.useState(null);return m.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}zs(W6e,"useDismissableLayerSurface");var Z6e=zs(()=>!0,"IS_TRUE");function woe(e,t){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:s,shouldHandlePointerDownOutside:a=Z6e}=t,l=Dh(e),c=m.useRef(!1),u=m.useRef(!1),d=m.useRef(new Map),f=m.useRef(()=>{});return m.useEffect(()=>{function h(){u.current=!1,i.current=!1,d.current.clear()}zs(h,"resetOutsideInteraction");function p(){return Array.from(d.current.values()).some(Boolean)}zs(p,"isOutsideInteractionIntercepted");function b(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)}zs(b,"handleInteractionCapture");function g(x){u.current&&d.current.set(x.type,!1)}zs(g,"handleInteractionBubble");const O=zs(x=>{if(x.target&&!c.current){let w=function(){n.removeEventListener("click",f.current);const E=p();h(),E||t$(G6e,l,S,{discrete:!0})};if(zs(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"),y=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const x of y)n.addEventListener(x,b,!0),n.addEventListener(x,g);const v=window.setTimeout(()=>{n.addEventListener("pointerdown",O)},0);return()=>{window.clearTimeout(v),n.removeEventListener("pointerdown",O),n.removeEventListener("click",f.current);for(const x of y)n.removeEventListener(x,b,!0),n.removeEventListener(x,g)}},[n,l,r,i,s,a]),{onPointerDownCapture:zs(()=>c.current=!0,"onPointerDownCapture")}}zs(woe,"usePointerDownOutside");function Soe(e,t=globalThis==null?void 0:globalThis.document){const n=Dh(e),r=m.useRef(!1);return m.useEffect(()=>{const i=zs(s=>{s.target&&!r.current&&t$(Y6e,n,{originalEvent:s},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:zs(()=>r.current=!0,"onFocusCapture"),onBlurCapture:zs(()=>r.current=!1,"onBlurCapture")}}zs(Soe,"useFocusOutside");function K5(){const e=new CustomEvent(Z5);document.dispatchEvent(e)}zs(K5,"dispatchUpdate");function t$(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?roe(i,s):i.dispatchEvent(s)}zs(t$,"handleAndDispatchCustomEvent");var K6e=Object.defineProperty,Ha=(e,t)=>K6e(e,"name",{value:t,configurable:!0}),mR="focusScope.autoFocusOnMount",gR="focusScope.autoFocusOnUnmount",Yz={bubbles:!1,cancelable:!0},J6e=m.forwardRef(Ha(function(t,n){const{loop:r=!1,trapped:i=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...l}=t,[c,u]=m.useState(null),d=Dh(s),f=Dh(a),h=m.useRef(null),p=Ci(n,u),b=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(i){let O=function(w){if(b.paused||!c)return;const S=w.target;c.contains(S)?h.current=S:dd(h.current,{select:!0})},y=function(w){if(b.paused||!c)return;const S=w.relatedTarget;S!==null&&(c.contains(S)||dd(h.current,{select:!0}))},v=function(w){if(document.activeElement===document.body)for(const E of w)E.removedNodes.length>0&&dd(c)};Ha(O,"handleFocusIn"),Ha(y,"handleFocusOut"),Ha(v,"handleMutations"),document.addEventListener("focusin",O),document.addEventListener("focusout",y);const x=new MutationObserver(v);return c&&x.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",O),document.removeEventListener("focusout",y),x.disconnect()}}},[i,c,b.paused]),m.useEffect(()=>{if(c){Wz.add(b);const O=document.activeElement;if(!c.contains(O)){const v=new CustomEvent(mR,Yz);c.addEventListener(mR,d),c.dispatchEvent(v),v.defaultPrevented||(Eoe(Coe(n$(c)),{select:!0}),document.activeElement===O&&dd(c))}return()=>{c.removeEventListener(mR,d),setTimeout(()=>{const v=new CustomEvent(gR,Yz);c.addEventListener(gR,f),c.dispatchEvent(v),v.defaultPrevented||dd(O??document.body,{select:!0}),c.removeEventListener(gR,f),Wz.remove(b)},0)}}},[c,d,f,b]);const g=m.useCallback(O=>{if(!r&&!i||b.paused)return;const y=O.key==="Tab"&&!O.altKey&&!O.ctrlKey&&!O.metaKey,v=document.activeElement;if(y&&v){const x=O.currentTarget,[w,S]=koe(x);w&&S?!O.shiftKey&&v===S?(O.preventDefault(),r&&dd(w,{select:!0})):O.shiftKey&&v===w&&(O.preventDefault(),r&&dd(S,{select:!0})):v===x&&O.preventDefault()}},[r,i,b.paused]);return o.jsx(Qi.div,{tabIndex:-1,...l,ref:p,onKeyDown:g})},"FocusScope"));function Eoe(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(dd(r,{select:t}),document.activeElement!==n)return}Ha(Eoe,"focusFirst");function koe(e){const t=n$(e),n=J5(t,e),r=J5(t.reverse(),e);return[n,r]}Ha(koe,"getTabbableEdges");function n$(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:Ha(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}Ha(n$,"getTabbableCandidates");function J5(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Toe(r,{upTo:t})))return r}Ha(J5,"findVisible");function Toe(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}Ha(Toe,"isHidden");function _oe(e){return e instanceof HTMLInputElement&&"select"in e}Ha(_oe,"isSelectableInput");function dd(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&_oe(e)&&t&&e.select()}}Ha(dd,"focus");var Wz=Aoe();function Aoe(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=eM(e,t),e.unshift(t)},remove(t){var n;e=eM(e,t),(n=e[0])==null||n.resume()}}}Ha(Aoe,"createFocusScopesStack");function eM(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}Ha(eM,"arrayRemove");function Coe(e){return e.filter(t=>t.tagName!=="A")}Ha(Coe,"removeLinks");var e$e=Object.defineProperty,t$e=(e,t)=>e$e(e,"name",{value:t,configurable:!0}),Noe=m.forwardRef(t$e(function(t,n){var c;const{container:r,...i}=t,[s,a]=m.useState(!1);Ql(()=>a(!0),[]);const l=r||s&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return l?si.createPortal(o.jsx(Qi.div,{...i,ref:n}),l):null},"Portal")),n$e=Object.defineProperty,r$=(e,t)=>n$e(e,"name",{value:t,configurable:!0}),eE=0,Gc=null;function r$e(e){return i$(),e.children}r$(r$e,"FocusGuards");function i$(){m.useEffect(()=>{Gc||(Gc={start:tM(),end:tM()});const{start:e,end:t}=Gc;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),eE++,()=>{eE===1&&(Gc==null||Gc.start.remove(),Gc==null||Gc.end.remove(),Gc=null),eE=Math.max(0,eE-1)}},[])}r$(i$,"useFocusGuards");function tM(){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}r$(tM,"createFocusGuard");var su=function(){return su=Object.assign||function(t){for(var n,r=1,i=arguments.length;r"u")return x$e;var t=v$e(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])}},S$e=Doe(),q0="data-scroll-locked",E$e=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(s$e,` { overflow: hidden `).concat(r,`; padding-right: `).concat(l,"px ").concat(r,`; } - body[`).concat(V0,`] { + body[`).concat(q0,`] { overflow: hidden `).concat(r,`; overscroll-behavior: contain; `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&` @@ -450,122 +450,122 @@ ${d}`:u,children:[o.jsxs("span",{className:`account-avatar${b?" has-image":""}`, `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),` } - .`).concat($k,` { + .`).concat(Qk,` { right: `).concat(l,"px ").concat(r,`; } - .`).concat(Bk,` { + .`).concat(Fk,` { margin-right: `).concat(l,"px ").concat(r,`; } - .`).concat($k," .").concat($k,` { + .`).concat(Qk," .").concat(Qk,` { right: 0 `).concat(r,`; } - .`).concat(Bk," .").concat(Bk,` { + .`).concat(Fk," .").concat(Fk,` { margin-right: 0 `).concat(r,`; } - body[`).concat(V0,`] { - `).concat(i$e,": ").concat(l,`px; + body[`).concat(q0,`] { + `).concat(a$e,": ").concat(l,`px; } -`)},Wz=function(){var e=parseInt(document.body.getAttribute(V0)||"0",10);return isFinite(e)?e:0},S$e=function(){m.useEffect(function(){return document.body.setAttribute(V0,(Wz()+1).toString()),function(){var e=Wz()-1;e<=0?document.body.removeAttribute(V0):document.body.setAttribute(V0,e.toString())}},[])},E$e=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;S$e();var s=m.useMemo(function(){return x$e(i)},[i]);return m.createElement(v$e,{styles:w$e(s,!t,i,n?"":"!important")})},eM=!1;if(typeof window<"u")try{var tE=Object.defineProperty({},"passive",{get:function(){return eM=!0,!0}});window.addEventListener("test",tE,tE),window.removeEventListener("test",tE,tE)}catch{eM=!1}var Tg=eM?{passive:!1}:!1,k$e=function(e){return e.tagName==="TEXTAREA"},Ioe=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!k$e(e)&&n[t]==="visible")},T$e=function(e){return Ioe(e,"overflowY")},_$e=function(e){return Ioe(e,"overflowX")},Zz=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=Doe(e,r);if(i){var s=Poe(e,r),a=s[1],l=s[2];if(a>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},A$e=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},C$e=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Doe=function(e,t){return e==="v"?T$e(t):_$e(t)},Poe=function(e,t){return e==="v"?A$e(t):C$e(t)},N$e=function(e,t){return e==="h"&&t==="rtl"?-1:1},j$e=function(e,t,n,r,i){var s=N$e(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 p=Poe(e,l),b=p[0],g=p[1],O=p[2],y=g-O-s*b;(b||y)&&Doe(e,l)&&(f+=y,h+=b);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},nE=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Kz=function(e){return[e.deltaX,e.deltaY]},Jz=function(e){return e&&"current"in e?e.current:e},R$e=function(e,t){return e[0]===t[0]&&e[1]===t[1]},I$e=function(e){return` +`)},Kz=function(){var e=parseInt(document.body.getAttribute(q0)||"0",10);return isFinite(e)?e:0},k$e=function(){m.useEffect(function(){return document.body.setAttribute(q0,(Kz()+1).toString()),function(){var e=Kz()-1;e<=0?document.body.removeAttribute(q0):document.body.setAttribute(q0,e.toString())}},[])},T$e=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;k$e();var s=m.useMemo(function(){return w$e(i)},[i]);return m.createElement(S$e,{styles:E$e(s,!t,i,n?"":"!important")})},nM=!1;if(typeof window<"u")try{var tE=Object.defineProperty({},"passive",{get:function(){return nM=!0,!0}});window.addEventListener("test",tE,tE),window.removeEventListener("test",tE,tE)}catch{nM=!1}var _g=nM?{passive:!1}:!1,_$e=function(e){return e.tagName==="TEXTAREA"},Poe=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!_$e(e)&&n[t]==="visible")},A$e=function(e){return Poe(e,"overflowY")},C$e=function(e){return Poe(e,"overflowX")},Jz=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=Moe(e,r);if(i){var s=Loe(e,r),a=s[1],l=s[2];if(a>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},N$e=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},j$e=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Moe=function(e,t){return e==="v"?A$e(t):C$e(t)},Loe=function(e,t){return e==="v"?N$e(t):j$e(t)},R$e=function(e,t){return e==="h"&&t==="rtl"?-1:1},I$e=function(e,t,n,r,i){var s=R$e(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 p=Loe(e,l),b=p[0],g=p[1],O=p[2],y=g-O-s*b;(b||y)&&Moe(e,l)&&(f+=y,h+=b);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},nE=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},eV=function(e){return[e.deltaX,e.deltaY]},tV=function(e){return e&&"current"in e?e.current:e},D$e=function(e,t){return e[0]===t[0]&&e[1]===t[1]},P$e=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},D$e=0,_g=[];function P$e(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),i=m.useState(D$e++)[0],s=m.useState(Roe)[0],a=m.useRef(e);m.useEffect(function(){a.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var g=n$e([e.lockRef.current],(e.shards||[]).map(Jz),!0).filter(Boolean);return g.forEach(function(O){return O.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),g.forEach(function(O){return O.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var l=m.useCallback(function(g,O){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!a.current.allowPinchZoom;var y=nE(g),v=n.current,x="deltaX"in g?g.deltaX:v[0]-y[0],w="deltaY"in g?g.deltaY:v[1]-y[1],S,E=g.target,k=Math.abs(x)>Math.abs(w)?"h":"v";if("touches"in g&&k==="h"&&E.type==="range")return!1;var T=window.getSelection(),C=T&&T.anchorNode,N=C?C===E||C.contains(E):!1;if(N)return!1;var _=Zz(k,E);if(!_)return!0;if(_?S=k:(S=k==="v"?"h":"v",_=Zz(k,E)),!_)return!1;if(!r.current&&"changedTouches"in g&&(x||w)&&(r.current=S),!S)return!0;var R=r.current||S;return j$e(R,O,g,R==="h"?x:w)},[]),c=m.useCallback(function(g){var O=g;if(!(!_g.length||_g[_g.length-1]!==s)){var y="deltaY"in O?Kz(O):nE(O),v=t.current.filter(function(S){return S.name===O.type&&(S.target===O.target||O.target===S.shadowParent)&&R$e(S.delta,y)})[0];if(v&&v.should){O.cancelable&&O.preventDefault();return}if(!v){var x=(a.current.shards||[]).map(Jz).filter(Boolean).filter(function(S){return S.contains(O.target)}),w=x.length>0?l(O,x[0]):!a.current.noIsolation;w&&O.cancelable&&O.preventDefault()}}},[]),u=m.useCallback(function(g,O,y,v){var x={name:g,delta:O,target:y,should:v,shadowParent:M$e(y)};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(w){return w!==x})},1)},[]),d=m.useCallback(function(g){n.current=nE(g),r.current=void 0},[]),f=m.useCallback(function(g){u(g.type,Kz(g),g.target,l(g,e.lockRef.current))},[]),h=m.useCallback(function(g){u(g.type,nE(g),g.target,l(g,e.lockRef.current))},[]);m.useEffect(function(){return _g.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,Tg),document.addEventListener("touchmove",c,Tg),document.addEventListener("touchstart",d,Tg),function(){_g=_g.filter(function(g){return g!==s}),document.removeEventListener("wheel",c,Tg),document.removeEventListener("touchmove",c,Tg),document.removeEventListener("touchstart",d,Tg)}},[]);var p=e.removeScrollBar,b=e.inert;return m.createElement(m.Fragment,null,b?m.createElement(s,{styles:I$e(i)}):null,p?m.createElement(E$e,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function M$e(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const L$e=d$e(joe,P$e);var Moe=m.forwardRef(function(e,t){return m.createElement(FA,su({},e,{ref:t,sideCar:L$e}))});Moe.classNames=FA.classNames;var $$e=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ag=new WeakMap,rE=new WeakMap,iE={},OR=0,Loe=function(e){return e&&(e.host||Loe(e.parentNode))},B$e=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Loe(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})},Q$e=function(e,t,n,r){var i=B$e(t,Array.isArray(e)?e:[e]);iE[n]||(iE[n]=new WeakMap);var s=iE[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 p=h.getAttribute(r),b=p!==null&&p!=="false",g=(Ag.get(h)||0)+1,O=(s.get(h)||0)+1;Ag.set(h,g),s.set(h,O),a.push(h),g===1&&b&&rE.set(h,!0),O===1&&h.setAttribute(n,"true"),b||h.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",h,y)}})};return d(t),l.clear(),OR++,function(){a.forEach(function(f){var h=Ag.get(f)-1,p=s.get(f)-1;Ag.set(f,h),s.set(f,p),h||(rE.has(f)||f.removeAttribute(r),rE.delete(f)),p||f.removeAttribute(n)}),OR--,OR||(Ag=new WeakMap,Ag=new WeakMap,rE=new WeakMap,iE={})}},F$e=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=$$e(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),Q$e(r,i,n,"aria-hidden")):function(){return null}},U$e=Object.defineProperty,z$e=(e,t)=>U$e(e,"name",{value:t,configurable:!0});function uw(e){const[t,n]=m.useState(void 0);return Ql(()=>{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}z$e(uw,"useSize");var V$e=Object.defineProperty,Gd=(e,t)=>V$e(e,"name",{value:t,configurable:!0}),r$="Checkbox",[q$e,kTt]=Xl(r$),[H$e,i$]=q$e(r$);function $oe(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,p]=Du({prop:n,defaultProp:i??!1,onChange:c,caller:r$}),[b,g]=m.useState(null),[O,y]=m.useState(null),v=m.useRef(!1),[x,w]=m.useReducer(k=>k+1,0),S=b?!!a||!!b.closest("form"):!0,E={checked:h,disabled:s,setChecked:p,control:b,setControl:g,name:l,form:a,value:d,hasConsumerStoppedPropagationRef:v,userInteractionCount:x,onUserInteraction:w,required:u,defaultChecked:Rd(i)?!1:i,isFormControl:S,bubbleInput:O,setBubbleInput:y};return o.jsx(H$e,{scope:t,...E,children:Boe(f)?f(E):r})}Gd($oe,"CheckboxProvider");var X$e="CheckboxTrigger",G$e=m.forwardRef(Gd(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:p,onUserInteraction:b,isFormControl:g,bubbleInput:O}=i$(X$e,t),y=Ci(s,f),v=m.useRef(u);return m.useEffect(()=>{const x=a==null?void 0:a.form;if(x){const w=Gd(()=>h(v.current),"reset");return x.addEventListener("reset",w),()=>x.removeEventListener("reset",w)}},[a,h]),o.jsx(Qi.button,{type:"button",role:"checkbox","aria-checked":Rd(u)?"mixed":u,"aria-required":d,"data-state":s$(u),"data-disabled":c?"":void 0,disabled:c,value:l,...i,ref:y,onKeyDown:Mr(n,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:Mr(r,x=>{b(),h(w=>Rd(w)?!0:!w),O&&g&&(p.current=x.isPropagationStopped(),p.current||x.stopPropagation())})})},"CheckboxTrigger")),Y$e=m.forwardRef(Gd(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($oe,{__scopeCheckbox:r,checked:s,defaultChecked:a,disabled:c,required:l,onCheckedChange:d,name:i,form:f,value:u,internal_do_not_use_render:({isFormControl:p})=>o.jsxs(o.Fragment,{children:[o.jsx(G$e,{...h,ref:n,__scopeCheckbox:r}),p&&o.jsx(J$e,{__scopeCheckbox:r})]})})},"Checkbox")),W$e="CheckboxIndicator",Z$e=m.forwardRef(Gd(function(t,n){const{__scopeCheckbox:r,forceMount:i,...s}=t,a=i$(W$e,r);return o.jsx(SO,{present:i||Rd(a.checked)||a.checked===!0,children:o.jsx(Qi.span,{"data-state":s$(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:n,style:{pointerEvents:"none",...t.style}})})},"CheckboxIndicator")),K$e="CheckboxBubbleInput",J$e=m.forwardRef(Gd(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:p,form:b,bubbleInput:g,setBubbleInput:O}=i$(K$e,t),y=Ci(i,O),v=uw(s),x=m.useRef(!1),w=m.useRef(c),S=m.useRef(l);m.useEffect(()=>{const k=g;if(!k)return;const T=window.HTMLInputElement.prototype,N=Object.getOwnPropertyDescriptor(T,"checked").set,_=l!==S.current;S.current=l;const R=w.current!==c;w.current=c;const $=!(_&&a.current);if(R&&N){x.current=!_;const D=new Event("click",{bubbles:$});k.indeterminate=Rd(c),N.call(k,Rd(c)?!1:c),k.dispatchEvent(D),x.current=!1}},[g,c,a,l]);const E=m.useRef(Rd(c)?!1:c);return o.jsx(Qi.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??E.current,required:d,disabled:f,name:h,value:p,form:b,...r,tabIndex:-1,ref:y,onClick:Mr(n,k=>{x.current&&k.stopPropagation()}),style:{...r.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function Boe(e){return typeof e=="function"}Gd(Boe,"isFunction");function Rd(e){return e==="indeterminate"}Gd(Rd,"isIndeterminate");function s$(e){return Rd(e)?"indeterminate":e?"checked":"unchecked"}Gd(s$,"getState");const e8e=["top","right","bottom","left"],Ph=Math.min,Id=Math.max,k2=Math.round,sE=Math.floor,Dd=e=>({x:e,y:e}),t8e={left:"right",right:"left",bottom:"top",top:"bottom"};function Qoe(e,t,n){return Id(e,Ph(t,n))}function Yd(e,t){return typeof e=="function"?e(t):e}function Mh(e){return e.split("-")[0]}function EO(e){return e.split("-")[1]}function a$(e){return e==="x"?"y":"x"}function o$(e){return e==="y"?"height":"width"}function hu(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function l$(e){return a$(hu(e))}function n8e(e,t,n){n===void 0&&(n=!1);const r=EO(e),i=l$(e),s=o$(i);let a=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=T2(a)),[a,T2(a)]}function r8e(e){const t=T2(e);return[tM(e),t,tM(t)]}function tM(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const eV=["left","right"],tV=["right","left"],i8e=["top","bottom"],s8e=["bottom","top"];function a8e(e,t,n){switch(e){case"top":case"bottom":return n?t?tV:eV:t?eV:tV;case"left":case"right":return t?i8e:s8e;default:return[]}}function o8e(e,t,n,r){const i=EO(e);let s=a8e(Mh(e),n==="start",r);return i&&(s=s.map(a=>a+"-"+i),t&&(s=s.concat(s.map(tM)))),s}function T2(e){const t=Mh(e);return t8e[t]+e.slice(t.length)}function l8e(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 Foe(e){return typeof e!="number"?l8e(e):{top:e,right:e,bottom:e,left:e}}function _2(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 nV(e,t,n){let{reference:r,floating:i}=e;const s=hu(t),a=l$(t),l=o$(a),c=Mh(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 p;switch(c){case"top":p={x:d,y:r.y-i.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-i.width,y:f};break;default:p={x:r.x,y:r.y}}const b=EO(t);return b&&(p[a]+=h*(b==="end"?1:-1)*(n&&u?-1:1)),p}async function c8e(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:p=0}=Yd(t,e),b=Foe(p),O=l[h?f==="floating"?"reference":"floating":f],y=_2(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(O)))==null||n?O:O.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=_2(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:x,strategy:c}):v);return{top:(y.top-S.top+b.top)/w.y,bottom:(S.bottom-y.bottom+b.bottom)/w.y,left:(y.left-S.left+b.left)/w.x,right:(S.right-y.right+b.right)/w.x}}const u8e=50,d8e=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:c8e},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}=nV(u,r,c),h=r,p=0;const b={};for(let g=0;g({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}=Yd(e,t)||{};if(u==null)return{};const f=Foe(d),h={x:n,y:r},p=l$(i),b=o$(p),g=await a.getDimensions(u),O=p==="y",y=O?"top":"left",v=O?"bottom":"right",x=O?"clientHeight":"clientWidth",w=s.reference[b]+s.reference[p]-h[p]-s.floating[b],S=h[p]-s.reference[p],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[b]);const T=w/2-S/2,C=k/2-g[b]/2-1,N=Ph(f[y],C),_=Ph(f[v],C),R=k-g[b]-_,$=k/2-g[b]/2+T,D=Qoe(N,$,R),M=!c.arrow&&EO(i)!=null&&$!==D&&s.reference[b]/2-($D<=0)){var _,R;const D=(((_=s.flip)==null?void 0:_.index)||0)+1,M=k[D];if(M&&(!(f==="alignment"?v!==hu(M):!1)||N.every(L=>hu(L.placement)===v?L.overflows[0]>0:!0)))return{data:{index:D,overflows:N},reset:{placement:M}};let j=(R=N.filter(P=>P.overflows[0]<=0).sort((P,L)=>P.overflows[1]-L.overflows[1])[0])==null?void 0:R.placement;if(!j)switch(p){case"bestFit":{var $;const P=($=N.filter(L=>{if(E){const U=hu(L.placement);return U===v||U==="y"}return!0}).map(L=>[L.placement,L.overflows.filter(U=>U>0).reduce((U,F)=>U+F,0)]).sort((L,U)=>L[1]-U[1])[0])==null?void 0:$[0];P&&(j=P);break}case"initialPlacement":j=l;break}if(i!==j)return{reset:{placement:j}}}return{}}}};function rV(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function iV(e){return e8e.some(t=>e[t]>=0)}const p8e=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=Yd(e,t);switch(i){case"referenceHidden":{const a=await r.detectOverflow(t,{...s,elementContext:"reference"}),l=rV(a,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:iV(l)}}}case"escaped":{const a=await r.detectOverflow(t,{...s,altBoundary:!0}),l=rV(a,n.floating);return{data:{escapedOffsets:l,escaped:iV(l)}}}default:return{}}}}},Uoe=new Set(["left","top"]);async function m8e(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),a=Mh(n),l=EO(n),c=hu(n)==="y",u=Uoe.has(a)?-1:1,d=s&&c?-1:1,f=Yd(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:b}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof b=="number"&&(p=l==="end"?b*-1:b),c?{x:p*d,y:h*u}:{x:h*u,y:p*d}}const g8e=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 m8e(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}}}}},b8e=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}=Yd(e,t),d={x:n,y:r},f=await s.detectOverflow(t,u),h=hu(i),p=a$(h);let b=d[p],g=d[h];const O=(v,x)=>Qoe(x+f[v==="y"?"top":"left"],x,x-f[v==="y"?"bottom":"right"]);a&&(b=O(p,b)),l&&(g=O(h,g));const y=c.fn({...t,[p]:b,[h]:g});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[p]:a,[h]:l}}}}}},O8e=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}=Yd(e,t),h={x:i,y:s},p=hu(a),b=a$(p);let g=h[b],O=h[p];const y=Yd(u,t),v=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:(n=y.mainAxis)!=null?n:0,crossAxis:(r=y.crossAxis)!=null?r:0};if(d){const S=b==="y"?"height":"width",E=l.reference[b]-l.floating[S]+v.mainAxis,k=l.reference[b]+l.reference[S]-v.mainAxis;gk&&(g=k)}if(f){var x,w;const S=b==="y"?"width":"height",E=Uoe.has(Mh(a)),k=l.reference[p]-l.floating[S]+(E&&((x=c.offset)==null?void 0:x[p])||0)+(E?0:v.crossAxis),T=l.reference[p]+l.reference[S]+(E?0:((w=c.offset)==null?void 0:w[p])||0)-(E?v.crossAxis:0);OT&&(O=T)}return{[b]:g,[p]:O}}}},y8e=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}=Yd(e,t),c=await i.detectOverflow(t,l),u=Mh(n),d=EO(n),f=hu(n)==="y",{width:h,height:p}=r.floating;let b,g;u==="top"||u==="bottom"?(b=u,g=d===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(g=u,b=d==="end"?"top":"bottom");const O=p-c.top-c.bottom,y=h-c.left-c.right,v=Ph(p-c[b],O),x=Ph(h-c[g],y),w=t.middlewareData.shift,S=!w;let E=v,k=x;w!=null&&w.enabled.x&&(k=y),w!=null&&w.enabled.y&&(E=O),S&&!d&&(f?k=h-2*Id(c.left,c.right):E=p-2*Id(c.top,c.bottom)),await a({...t,availableWidth:k,availableHeight:E});const T=await i.getDimensions(s.floating);return h!==T.width||p!==T.height?{reset:{rects:!0}}:{}}}};function UA(){return typeof window<"u"}function kO(e){return zoe(e)?(e.nodeName||"").toLowerCase():"#document"}function Oo(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function lf(e){var t;return(t=(zoe(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function zoe(e){return UA()?e instanceof Node||e instanceof Oo(e).Node:!1}function ku(e){return UA()?e instanceof Element||e instanceof Oo(e).Element:!1}function Jh(e){return UA()?e instanceof HTMLElement||e instanceof Oo(e).HTMLElement:!1}function sV(e){return!UA()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Oo(e).ShadowRoot}function zA(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Tu(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function x8e(e){return/^(table|td|th)$/.test(kO(e))}function VA(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const v8e=/transform|translate|scale|rotate|perspective|filter/,w8e=/paint|layout|strict|content/,mp=e=>!!e&&e!=="none";let yR;function c$(e){const t=ku(e)?Tu(e):e;return mp(t.transform)||mp(t.translate)||mp(t.scale)||mp(t.rotate)||mp(t.perspective)||!u$()&&(mp(t.backdropFilter)||mp(t.filter))||v8e.test(t.willChange||"")||w8e.test(t.contain||"")}function S8e(e){let t=Am(e);for(;Jh(t)&&!Vx(t);){if(c$(t))return t;if(VA(t))return null;t=Am(t)}return null}function u$(){return yR==null&&(yR=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),yR}function Vx(e){return/^(html|body|#document)$/.test(kO(e))}function Tu(e){return Oo(e).getComputedStyle(e)}function qA(e){return ku(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Am(e){if(kO(e)==="html")return e;const t=e.assignedSlot||e.parentNode||sV(e)&&e.host||lf(e);return sV(t)?t.host:t}function Voe(e){const t=Am(e);return Vx(t)?(e.ownerDocument||e).body:Jh(t)&&zA(t)?t:Voe(t)}function qx(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=Voe(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),a=Oo(i);if(s){const l=nM(a);return t.concat(a,a.visualViewport||[],zA(i)?i:[],l&&n?qx(l):[])}else return t.concat(i,qx(i,[],n))}function nM(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function qoe(e){const t=Tu(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Jh(e),s=i?e.offsetWidth:n,a=i?e.offsetHeight:r,l=k2(n)!==s||k2(r)!==a;return l&&(n=s,r=a),{width:n,height:r,$:l}}function d$(e){return ku(e)?e:e.contextElement}function q0(e){const t=d$(e);if(!Jh(t))return Dd(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=qoe(t);let a=(s?k2(n.width):n.width)/r,l=(s?k2(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const E8e=Dd(0);function Hoe(e){const t=Oo(e);return!u$()||!t.visualViewport?E8e:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function k8e(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Oo(e)}function Cm(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=d$(e);let a=Dd(1);t&&(r?ku(r)&&(a=q0(r)):a=q0(e));const l=k8e(s,n,r)?Hoe(s):Dd(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=Oo(s),p=ku(r)?Oo(r):r;let b=h,g=nM(b);for(;g&&p!==b;){const O=q0(g),y=g.getBoundingClientRect(),v=Tu(g),x=y.left+(g.clientLeft+parseFloat(v.paddingLeft))*O.x,w=y.top+(g.clientTop+parseFloat(v.paddingTop))*O.y;c*=O.x,u*=O.y,d*=O.x,f*=O.y,c+=x,u+=w,b=Oo(g),g=nM(b)}}return _2({width:d,height:f,x:c,y:u})}function HA(e,t){const n=qA(e).scrollLeft;return t?t.left+n:Cm(lf(e)).left+n}function Xoe(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-HA(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function T8e(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",a=lf(r),l=t?VA(t.floating):!1;if(r===a||l&&s)return n;let c={scrollLeft:0,scrollTop:0},u=Dd(1);const d=Dd(0),f=Jh(r);if((f||!s)&&((kO(r)!=="body"||zA(a))&&(c=qA(r)),f)){const p=Cm(r);u=q0(r),d.x=p.x+r.clientLeft,d.y=p.y+r.clientTop}const h=a&&!f&&!s?Xoe(a,c):Dd(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 _8e(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function A8e(e){const t=qA(e),n=e.ownerDocument.body,r=Id(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Id(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-t.scrollLeft+HA(e);const a=-t.scrollTop;return Tu(n).direction==="rtl"&&(s+=Id(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:s,y:a}}const C8e=25;function N8e(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",i=Oo(e),s=lf(e),a=i.visualViewport;let l=s.clientWidth,c=s.clientHeight,u=0,d=0;if(a){const h=!u$()||t==="fixed";r?h||(u=-a.offsetLeft,d=-a.offsetTop):(l=a.width,c=a.height,h&&(u=a.offsetLeft,d=a.offsetTop))}if(HA(s)<=0){const h=s.ownerDocument,p=h.body,b=getComputedStyle(p),g=h.compatMode==="CSS1Compat"&&parseFloat(b.marginLeft)+parseFloat(b.marginRight)||0,O=Math.abs(s.clientWidth-p.clientWidth-g),y=getComputedStyle(s).scrollbarGutter==="stable both-edges"?O/2:O;y<=C8e&&(l-=y)}return{width:l,height:c,x:u,y:d}}function j8e(e,t){const n=Cm(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=q0(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 aV(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=N8e(e,n,t);else if(t==="document")r=A8e(lf(e));else if(ku(t))r=j8e(t,n);else{const i=Hoe(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return _2(r)}function R8e(e,t){const n=t.get(e);if(n)return n;let r=qx(e,[],!1).filter(l=>ku(l)&&kO(l)!=="body"),i=null;const s=Tu(e).position==="fixed";let a=s?Am(e):e;for(;ku(a)&&!Vx(a);){const l=Tu(a),c=c$(a),u=i?i.position:s?"fixed":"";!c&&(u==="fixed"||u==="absolute"&&l.position==="static")?r=r.filter(f=>f!==a):i=l,a=Am(a)}return t.set(e,r),r}function I8e(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const a=[...n==="clippingAncestors"?VA(t)?[]:R8e(t,this._c):[].concat(n),r],l=aV(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(T,{...E,root:s.ownerDocument})}catch{r=new IntersectionObserver(T,E)}r.observe(e)}const c=Oo(e),u=()=>l(n);return c.addEventListener("resize",u),l(!0),()=>{c.removeEventListener("resize",u),a()}}function Q8e(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=d$(e),d=i||s?[...u?qx(u):[],...t?qx(t):[]]:[];d.forEach(y=>{i&&y.addEventListener("scroll",n),s&&y.addEventListener("resize",n)});const f=u&&l?B8e(u,n,s):null;let h=-1,p=null;a&&(p=new ResizeObserver(y=>{let[v]=y;v&&v.target===u&&p&&t&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var x;(x=p)==null||x.observe(t)})),n()}),u&&!c&&p.observe(u),t&&p.observe(t));let b,g=c?Cm(e):null;c&&O();function O(){const y=Cm(e);g&&!Yoe(g,y)&&n(),g=y,b=requestAnimationFrame(O)}return n(),()=>{var y;d.forEach(v=>{i&&v.removeEventListener("scroll",n),s&&v.removeEventListener("resize",n)}),f==null||f(),(y=p)==null||y.disconnect(),p=null,c&&cancelAnimationFrame(b)}}const F8e=g8e,U8e=b8e,z8e=h8e,V8e=y8e,q8e=p8e,lV=f8e,H8e=O8e,X8e=(e,t,n)=>{const r=new Map,i=n??{},s={...$8e,...i.platform,_c:r};return d8e(e,t,{...i,platform:s})};var G8e=typeof document<"u",Y8e=function(){},Qk=G8e?m.useLayoutEffect:Y8e;function A2(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(!A2(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)&&!A2(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Woe(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function cV(e,t){const n=Woe(e);return Math.round(t*n)/n}function vR(e){const t=m.useRef(e);return Qk(()=>{t.current=e}),t}function W8e(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]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=m.useState(r);A2(h,r)||p(r);const[b,g]=m.useState(null),[O,y]=m.useState(null),v=m.useCallback(L=>{L!==E.current&&(E.current=L,g(L))},[]),x=m.useCallback(L=>{L!==k.current&&(k.current=L,y(L))},[]),w=s||b,S=a||O,E=m.useRef(null),k=m.useRef(null),T=m.useRef(d),C=c!=null,N=vR(c),_=vR(i),R=vR(u),$=m.useCallback(()=>{if(!E.current||!k.current)return;const L={placement:t,strategy:n,middleware:h};_.current&&(L.platform=_.current),X8e(E.current,k.current,L).then(U=>{const F={...U,isPositioned:R.current!==!1};D.current&&!A2(T.current,F)&&(T.current=F,ii.flushSync(()=>{f(F)}))})},[h,t,n,_,R]);Qk(()=>{u===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,f(L=>({...L,isPositioned:!1})))},[u]);const D=m.useRef(!1);Qk(()=>(D.current=!0,()=>{D.current=!1}),[]),Qk(()=>{if(w&&(E.current=w),S&&(k.current=S),w&&S){if(N.current)return N.current(w,S,$);$()}},[w,S,$,N,C]);const M=m.useMemo(()=>({reference:E,floating:k,setReference:v,setFloating:x}),[v,x]),j=m.useMemo(()=>({reference:w,floating:S}),[w,S]),P=m.useMemo(()=>{const L={position:n,left:0,top:0};if(!j.floating)return L;const U=cV(j.floating,d.x),F=cV(j.floating,d.y);return l?{...L,transform:"translate("+U+"px, "+F+"px)",...Woe(j.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:F}},[n,l,j.floating,d.x,d.y]);return m.useMemo(()=>({...d,update:$,refs:M,elements:j,floatingStyles:P}),[d,$,M,j,P])}const Z8e=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?lV({element:r.current,padding:i}).fn(n):{}:r?lV({element:r,padding:i}).fn(n):{}}}},K8e=(e,t)=>{const n=F8e(e);return{name:n.name,fn:n.fn,options:[e,t]}},J8e=(e,t)=>{const n=U8e(e);return{name:n.name,fn:n.fn,options:[e,t]}},e9e=(e,t)=>({fn:H8e(e).fn,options:[e,t]}),t9e=(e,t)=>{const n=z8e(e);return{name:n.name,fn:n.fn,options:[e,t]}},n9e=(e,t)=>{const n=V8e(e);return{name:n.name,fn:n.fn,options:[e,t]}},r9e=(e,t)=>{const n=q8e(e);return{name:n.name,fn:n.fn,options:[e,t]}},i9e=(e,t)=>{const n=Z8e(e);return{name:n.name,fn:n.fn,options:[e,t]}};var s9e=Object.defineProperty,vh=(e,t)=>s9e(e,"name",{value:t,configurable:!0}),Zoe="Popper",[Koe,XA]=Xl(Zoe),[a9e,Joe]=Koe(Zoe),o9e=vh(e=>{const{__scopePopper:t,children:n}=e,[r,i]=m.useState(null),[s,a]=m.useState(void 0);return o.jsx(a9e,{scope:t,anchor:r,onAnchorChange:i,placementState:s,setPlacementState:a,children:n})},"Popper"),l9e="PopperAnchor",c9e=m.forwardRef(vh(function(t,n){const{__scopePopper:r,virtualRef:i,...s}=t,a=Joe(l9e,r),l=m.useRef(null),c=a.onAnchorChange,u=m.useCallback(g=>{l.current=g,g&&c(g)},[c]),d=Ci(n,u),f=m.useRef(null);m.useEffect(()=>{if(!i)return;const g=f.current;f.current=i.current,g!==f.current&&c(f.current)});const h=a.placementState&&GA(a.placementState),p=h==null?void 0:h[0],b=h==null?void 0:h[1];return i?null:o.jsx(Qi.div,{"data-radix-popper-side":p,"data-radix-popper-align":b,...s,ref:d})},"PopperAnchor")),ele="PopperContent",[u9e,TTt]=Koe(ele),d9e=m.forwardRef(vh(function(t,n){var Z,J,fe,be,je,Qe,Me;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:p=!1,updatePositionStrategy:b="optimized",onPlaced:g,...O}=t,y=Joe(ele,r),[v,x]=m.useState(null),w=Ci(n,x),[S,E]=m.useState(null),k=uw(S),T=(k==null?void 0:k.width)??0,C=(k==null?void 0:k.height)??0,N=i+(a!=="center"?"-"+a:""),_=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},R=Array.isArray(d)?d:[d],$=R.length>0,D={padding:_,boundary:R.filter(tle),altBoundary:$},{refs:M,floatingStyles:j,placement:P,isPositioned:L,middlewareData:U}=W8e({strategy:"fixed",placement:N,whileElementsMounted:vh((...le)=>Q8e(...le,{animationFrame:b==="always"}),"whileElementsMounted"),elements:{reference:y.anchor},middleware:[K8e({mainAxis:s+C,alignmentAxis:l}),u&&J8e({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?e9e():void 0,...D}),u&&t9e({...D}),n9e({...D,apply:vh(({elements:le,rects:ke,availableWidth:ye,availableHeight:$e})=>{const{width:ze,height:Ae}=ke.reference,Ve=le.floating.style;Ve.setProperty("--radix-popper-available-width",`${ye}px`),Ve.setProperty("--radix-popper-available-height",`${$e}px`),Ve.setProperty("--radix-popper-anchor-width",`${ze}px`),Ve.setProperty("--radix-popper-anchor-height",`${Ae}px`)},"apply")}),S&&i9e({element:S,padding:c}),f9e({arrowWidth:T,arrowHeight:C}),p&&r9e({strategy:"referenceHidden",...D,boundary:$?D.boundary:void 0})]}),F=y.setPlacementState;Ql(()=>(F(P),()=>{F(void 0)}),[P,F]);const[q,z]=GA(P),B=Dh(g);Ql(()=>{L&&(B==null||B())},[L,B]);const V=(Z=U.arrow)==null?void 0:Z.x,ce=(J=U.arrow)==null?void 0:J.y,we=((fe=U.arrow)==null?void 0:fe.centerOffset)!==0,[Oe,de]=m.useState();return Ql(()=>{v&&de(window.getComputedStyle(v).zIndex)},[v]),o.jsx("div",{ref:M.setFloating,"data-radix-popper-content-wrapper":"",style:{...j,transform:L?j.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Oe,"--radix-popper-transform-origin":[(be=U.transformOrigin)==null?void 0:be.x,(je=U.transformOrigin)==null?void 0:je.y].join(" "),...((Qe=U.hide)==null?void 0:Qe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:o.jsx(u9e,{scope:r,placedSide:q,placedAlign:z,onArrowChange:E,arrowX:V,arrowY:ce,shouldHideArrow:we,children:o.jsx(Qi.div,{"data-side":q,"data-align":z,...O,ref:w,style:{...O.style,animation:L?(Me=O.style)==null?void 0:Me.animation:"none"}})})})},"PopperContent"));function tle(e){return e!==null}vh(tle,"isNotNull");var f9e=vh(e=>({name:"transformOrigin",options:e,fn(t){var O,y,v;const{placement:n,rects:r,middlewareData:i}=t,a=((O=i.arrow)==null?void 0:O.centerOffset)!==0,l=a?0:e.arrowWidth,c=a?0:e.arrowHeight,[u,d]=GA(n),f={start:"0%",center:"50%",end:"100%"}[d],h=(((y=i.arrow)==null?void 0:y.x)??0)+l/2,p=(((v=i.arrow)==null?void 0:v.y)??0)+c/2;let b="",g="";return u==="bottom"?(b=a?f:`${h}px`,g=`${-c}px`):u==="top"?(b=a?f:`${h}px`,g=`${r.floating.height+c}px`):u==="right"?(b=`${-c}px`,g=a?f:`${p}px`):u==="left"&&(b=`${r.floating.width+c}px`,g=a?f:`${p}px`),{data:{x:b,y:g}}}}),"transformOrigin");function GA(e){const[t,n="center"]=e.split("-");return[t,n]}vh(GA,"getSideAndAlignFromPlacement");var nle=o9e,rle=c9e,ile=d9e,h9e=Object.defineProperty,f$=(e,t)=>h9e(e,"name",{value:t,configurable:!0}),wR=!1;function sle(){const[e,t]=m.useState(wR);return m.useEffect(()=>{wR||(wR=!0,t(!0))},[]),e}f$(sle,"useIsHydrated");var ale=tO[" useSyncExternalStore ".trim().toString()];function ole(){return()=>{}}f$(ole,"subscribe");function lle(){return ale(ole,()=>!0,()=>!1)}f$(lle,"useIsHydratedModern");var p9e=typeof ale=="function"?lle:sle,m9e=Object.defineProperty,Gm=(e,t)=>m9e(e,"name",{value:t,configurable:!0}),SR="rovingFocusGroup.onEntryFocus",g9e={bubbles:!1,cancelable:!0},YA="RovingFocusGroup",[rM,cle,b9e]=roe(YA),[O9e,WA]=Xl(YA,[b9e]),[y9e,x9e]=O9e(YA),v9e=m.forwardRef(Gm(function(t,n){return o.jsx(rM.Provider,{scope:t.__scopeRovingFocusGroup,children:o.jsx(rM.Slot,{scope:t.__scopeRovingFocusGroup,children:o.jsx(w9e,{...t,ref:n})})})},"RovingFocusGroup")),w9e=m.forwardRef(Gm(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,p=m.useRef(null),b=Ci(n,p),g=QA(a),[O,y]=Du({prop:l,defaultProp:c??null,onChange:u,caller:YA}),[v,x]=m.useState(!1),w=Dh(d),S=cle(r),E=m.useRef(!1),[k,T]=m.useState(0);return m.useEffect(()=>{const C=p.current;if(C)return C.addEventListener(SR,w),()=>C.removeEventListener(SR,w)},[w]),o.jsx(y9e,{scope:r,orientation:i,dir:g,loop:s,currentTabStopId:O,onItemFocus:m.useCallback(C=>y(C),[y]),onItemShiftTab:m.useCallback(()=>x(!0),[]),onFocusableItemAdd:m.useCallback(()=>T(C=>C+1),[]),onFocusableItemRemove:m.useCallback(()=>T(C=>C-1),[]),children:o.jsx(Qi.div,{tabIndex:v||k===0?-1:0,"data-orientation":i,...h,ref:b,style:{outline:"none",...t.style},onMouseDown:Mr(t.onMouseDown,()=>{E.current=!0}),onFocus:Mr(t.onFocus,C=>{const N=!E.current;if(C.target===C.currentTarget&&N&&!v){const _=new CustomEvent(SR,g9e);if(C.currentTarget.dispatchEvent(_),!_.defaultPrevented){const R=S().filter(P=>P.focusable),$=R.find(P=>P.active),D=R.find(P=>P.id===O),j=[$,D,...R].filter(Boolean).map(P=>P.ref.current);h$(j,f)}}E.current=!1}),onBlur:Mr(t.onBlur,()=>x(!1))})})},"RovingFocusGroupImpl")),S9e="RovingFocusGroupItem",E9e=m.forwardRef(Gm(function(t,n){const{__scopeRovingFocusGroup:r,focusable:i=!0,active:s=!1,tabStopId:a,children:l,...c}=t,u=BA(),d=a||u,f=x9e(S9e,r),h=f.currentTabStopId===d,p=cle(r),{onFocusableItemAdd:b,onFocusableItemRemove:g,currentTabStopId:O}=f,y=p9e();return Ql(()=>{if(!(!y||!i))return b(),()=>g()},[y,i,b,g]),m.useEffect(()=>{if(!(y||!i))return b(),()=>g()},[y,i,b,g]),o.jsx(rM.ItemSlot,{scope:r,id:d,focusable:i,active:s,children:o.jsx(Qi.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...c,ref:n,onMouseDown:Mr(t.onMouseDown,v=>{i?f.onItemFocus(d):v.preventDefault()}),onFocus:Mr(t.onFocus,()=>f.onItemFocus(d)),onKeyDown:Mr(t.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){f.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const x=dle(v,f.orientation,f.dir);if(x!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let S=p().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?fle(S,E+1):S.slice(E+1)}setTimeout(()=>h$(S))}}),children:typeof l=="function"?l({isCurrentTabStop:h,hasTabStop:O!=null}):l})})},"RovingFocusGroupItem")),k9e={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ule(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}Gm(ule,"getDirectionAwareKey");function dle(e,t,n){const r=ule(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return k9e[r]}Gm(dle,"getFocusIntent");function h$(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}Gm(h$,"focusFirst");function fle(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Gm(fle,"wrapArray");var hle=v9e,ple=E9e,T9e=Object.defineProperty,ep=(e,t)=>T9e(e,"name",{value:t,configurable:!0}),p$="Popover",[mle,_Tt]=Xl(p$,[XA]),m$=XA(),[_9e,TO]=mle(p$),A9e=ep(e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:a=!1}=e,l=m$(t),c=m.useRef(null),[u,d]=m.useState(!1),[f,h]=Du({prop:r,defaultProp:i??!1,onChange:s,caller:p$});return o.jsx(nle,{...l,children:o.jsx(_9e,{scope:t,contentId:BA(),triggerRef:c,open:f,onOpenChange:h,onOpenToggle:m.useCallback(()=>h(p=>!p),[h]),hasCustomAnchor:u,onCustomAnchorAdd:m.useCallback(()=>d(!0),[]),onCustomAnchorRemove:m.useCallback(()=>d(!1),[]),modal:a,children:n})})},"Popover"),C9e="PopoverTrigger",N9e=m.forwardRef(ep(function(t,n){const{__scopePopover:r,...i}=t,s=TO(C9e,r),a=m$(r),l=Ci(n,s.triggerRef),c=o.jsx(Qi.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":g$(s.open),...i,ref:l,onClick:Mr(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?c:o.jsx(rle,{asChild:!0,...a,children:c})},"PopoverTrigger")),gle="PopoverPortal",[j9e,R9e]=mle(gle,{forceMount:void 0}),I9e=ep(e=>{const{__scopePopover:t,forceMount:n,children:r,container:i}=e,s=TO(gle,t);return o.jsx(j9e,{scope:t,forceMount:n,children:o.jsx(SO,{present:n||s.open,children:o.jsx(Aoe,{asChild:!0,container:i,children:r})})})},"PopoverPortal"),Hx="PopoverContent",D9e=m.forwardRef(ep(function(t,n){const r=R9e(Hx,t.__scopePopover),{forceMount:i=r.forceMount,...s}=t,a=TO(Hx,t.__scopePopover);return o.jsx(SO,{present:i||a.open,children:a.modal?o.jsx(M9e,{...s,ref:n}):o.jsx(L9e,{...s,ref:n})})},"PopoverContent")),P9e=Ih("PopoverContent.RemoveScroll"),M9e=m.forwardRef(ep(function(t,n){const r=TO(Hx,t.__scopePopover),i=m.useRef(null),s=Ci(n,i),a=m.useRef(!1);return m.useEffect(()=>{const l=i.current;if(l)return F$e(l)},[]),o.jsx(Moe,{as:P9e,allowPinchZoom:!0,children:o.jsx(ble,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Mr(t.onCloseAutoFocus,l=>{var c;l.preventDefault(),a.current||(c=r.triggerRef.current)==null||c.focus()}),onPointerDownOutside:Mr(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:Mr(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})},"PopoverContentModal")),L9e=m.forwardRef(ep(function(t,n){const r=TO(Hx,t.__scopePopover),i=m.useRef(!1),s=m.useRef(!1);return o.jsx(ble,{...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")),ble=m.forwardRef(ep(function(t,n){const{__scopePopover:r,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,...h}=t,p=TO(Hx,r),b=m$(r);return n$(),o.jsx(Z6e,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:s,onUnmountAutoFocus:a,children:o.jsx(yoe,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:f,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onDismiss:()=>p.onOpenChange(!1),deferPointerDownOutside:!0,children:o.jsx(ile,{"data-state":g$(p.open),role:"dialog",id:p.contentId,...b,...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 g$(e){return e?"open":"closed"}ep(g$,"getState");var Ole=A9e,yle=N9e,xle=I9e,vle=D9e,$9e=Object.defineProperty,Aa=(e,t)=>$9e(e,"name",{value:t,configurable:!0}),wle="Radio",[B9e,Sle]=Xl(wle),[Q9e,ZA]=B9e(wle);function Ele(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]=m.useState(null),[p,b]=m.useState(null),g=m.useRef(!1),[O,y]=m.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:g,userInteractionCount:O,onUserInteraction:y,isFormControl:v,bubbleInput:p,setBubbleInput:b,onCheck:Aa(()=>l==null?void 0:l(),"onCheck")};return o.jsx(Q9e,{scope:t,...x,children:kle(d)?d(x):r})}Aa(Ele,"RadioProvider");var F9e="RadioTrigger",U9e=m.forwardRef(Aa(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:p}=ZA(F9e,t),b=Ci(i,c);return o.jsx(Qi.button,{type:"button",role:"radio","aria-checked":s,"data-state":b$(s),"data-disabled":a?"":void 0,disabled:a,value:l,...r,ref:b,onClick:Mr(n,g=>{s||(f(),u()),p&&h&&(d.current=g.isPropagationStopped(),d.current||g.stopPropagation())})})},"RadioTrigger")),z9e="RadioIndicator",V9e=m.forwardRef(Aa(function(t,n){const{__scopeRadio:r,forceMount:i,...s}=t,a=ZA(z9e,r);return o.jsx(SO,{present:i||a.checked,children:o.jsx(Qi.span,{"data-state":b$(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:n})})},"RadioIndicator")),q9e="RadioBubbleInput",H9e=m.forwardRef(Aa(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:p,hasConsumerStoppedPropagationRef:b,userInteractionCount:g}=ZA(q9e,t),O=Ci(i,p),y=uw(s),v=m.useRef(!1),x=m.useRef(a),w=m.useRef(g);m.useEffect(()=>{const E=h;if(!E)return;const k=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(k,"checked").set,N=g!==w.current;w.current=g;const _=x.current!==a;x.current=a;const R=!(N&&b.current);if(_&&C){v.current=!N;const $=new Event("click",{bubbles:R});C.call(E,a),E.dispatchEvent($),v.current=!1}},[h,a,b,g]);const S=m.useRef(a);return o.jsx(Qi.input,{type:"radio","aria-hidden":!0,defaultChecked:S.current,required:l,disabled:c,name:u,value:d,form:f,...r,tabIndex:-1,ref:O,onClick:Mr(n,E=>{v.current&&E.stopPropagation()}),style:{...r.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"RadioBubbleInput"));function kle(e){return typeof e=="function"}Aa(kle,"isFunction");function b$(e){return e?"checked":"unchecked"}Aa(b$,"getState");var X9e=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],O$="RadioGroup",[G9e,ATt]=Xl(O$,[WA,Sle]),Tle=WA(),KA=Sle(),[Y9e,W9e]=G9e(O$),Z9e=m.forwardRef(Aa(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:p,...b}=t,g=Tle(r),O=QA(f),[y,v]=Du({prop:l,defaultProp:a??null,onChange:p,caller:O$}),[x,w]=m.useState(null),S=Ci(n,w),E=m.useRef(y);return m.useEffect(()=>{const k=s?x==null?void 0:x.ownerDocument.getElementById(s):x==null?void 0:x.closest("form");if(k instanceof HTMLFormElement){const T=Aa(()=>v(E.current),"reset");return k.addEventListener("reset",T),()=>k.removeEventListener("reset",T)}},[x,s,v]),o.jsx(Y9e,{scope:r,name:i,form:s,required:c,disabled:u,value:y,onValueChange:v,children:o.jsx(hle,{asChild:!0,...g,orientation:d,dir:O,loop:h,children:o.jsx(Qi.div,{role:"radiogroup","aria-required":c,"aria-orientation":d,"data-disabled":u?"":void 0,dir:O,...b,ref:S})})})},"RadioGroup")),K9e="RadioGroupItemProvider",J9e="RadioGroupItemTrigger";function _le(e){const{__scopeRadioGroup:t,value:n,disabled:r,children:i,internal_do_not_use_render:s}=e,a=W9e(K9e,t),l=KA(t),c=a.disabled||r;return o.jsx(Ele,{...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})}Aa(_le,"RadioGroupItemProvider");var e7e=m.forwardRef(Aa(function(t,n){const{__scopeRadioGroup:r,...i}=t,s=Tle(r),a=KA(r),{checked:l,disabled:c}=ZA(J9e,a.__scopeRadio),u=m.useRef(null),d=Ci(n,u),f=m.useRef(!1);return m.useEffect(()=>{const h=Aa(b=>{X9e.includes(b.key)&&(f.current=!0)},"handleKeyDown"),p=Aa(()=>f.current=!1,"handleKeyUp");return document.addEventListener("keydown",h),document.addEventListener("keyup",p),()=>{document.removeEventListener("keydown",h),document.removeEventListener("keyup",p)}},[]),o.jsx(ple,{asChild:!0,...s,focusable:!c,active:l,children:o.jsx(U9e,{...a,...i,ref:d,onKeyDown:Mr(i.onKeyDown,h=>{h.key==="Enter"&&h.preventDefault()}),onFocus:Mr(i.onFocus,()=>{var h;f.current&&((h=u.current)==null||h.click())})})})},"RadioGroupItemTrigger")),t7e=m.forwardRef(Aa(function(t,n){const{__scopeRadioGroup:r,value:i,disabled:s,...a}=t;return o.jsx(_le,{__scopeRadioGroup:r,value:i,disabled:s,internal_do_not_use_render:({isFormControl:l})=>o.jsxs(o.Fragment,{children:[o.jsx(e7e,{...a,ref:n,__scopeRadioGroup:r}),l&&o.jsx(n7e,{__scopeRadioGroup:r})]})})},"RadioGroupItem")),n7e=m.forwardRef(Aa(function(t,n){const{__scopeRadioGroup:r,...i}=t,s=KA(r);return o.jsx(H9e,{...s,...i,ref:n})},"RadioGroupItemBubbleInput")),r7e=m.forwardRef(Aa(function(t,n){const{__scopeRadioGroup:r,...i}=t,s=KA(r);return o.jsx(V9e,{...s,...i,ref:n})},"RadioGroupIndicator")),i7e=Object.defineProperty,Lh=(e,t)=>i7e(e,"name",{value:t,configurable:!0}),y$="Switch",[s7e,CTt]=Xl(y$),[a7e,x$]=s7e(y$);function Ale(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,p]=Du({prop:n,defaultProp:i??!1,onChange:c,caller:y$}),[b,g]=m.useState(null),[O,y]=m.useState(null),v=m.useRef(!1),[x,w]=m.useReducer(k=>k+1,0),S=b?!!a||!!b.closest("form"):!0,E={checked:h,setChecked:p,disabled:s,control:b,setControl:g,name:l,form:a,value:d,hasConsumerStoppedPropagationRef:v,userInteractionCount:x,onUserInteraction:w,required:u,defaultChecked:i,isFormControl:S,bubbleInput:O,setBubbleInput:y};return o.jsx(a7e,{scope:t,...E,children:Cle(f)?f(E):r})}Lh(Ale,"SwitchProvider");var o7e="SwitchTrigger",l7e=m.forwardRef(Lh(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:p,onUserInteraction:b,isFormControl:g,bubbleInput:O}=x$(o7e,t),y=Ci(i,f),v=m.useRef(u);return m.useEffect(()=>{const x=a?s==null?void 0:s.ownerDocument.getElementById(a):s==null?void 0:s.form;if(x instanceof HTMLFormElement){const w=Lh(()=>h(v.current),"reset");return x.addEventListener("reset",w),()=>x.removeEventListener("reset",w)}},[s,a,h]),o.jsx(Qi.button,{type:"button",role:"switch","aria-checked":u,"aria-required":d,"data-state":v$(u),"data-disabled":c?"":void 0,disabled:c,value:l,...r,ref:y,onClick:Mr(n,x=>{b(),h(w=>!w),O&&g&&(p.current=x.isPropagationStopped(),p.current||x.stopPropagation())})})},"SwitchTrigger")),c7e=m.forwardRef(Lh(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(Ale,{__scopeSwitch:r,checked:s,defaultChecked:a,disabled:c,required:l,onCheckedChange:d,name:i,form:f,value:u,internal_do_not_use_render:({isFormControl:p})=>o.jsxs(o.Fragment,{children:[o.jsx(l7e,{...h,ref:n,__scopeSwitch:r}),p&&o.jsx(h7e,{__scopeSwitch:r})]})})},"Switch")),u7e="SwitchThumb",d7e=m.forwardRef(Lh(function(t,n){const{__scopeSwitch:r,...i}=t,s=x$(u7e,r);return o.jsx(Qi.span,{"data-state":v$(s.checked),"data-disabled":s.disabled?"":void 0,...i,ref:n})},"SwitchThumb")),f7e="SwitchBubbleInput",h7e=m.forwardRef(Lh(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:p,form:b,bubbleInput:g,setBubbleInput:O}=x$(f7e,t),y=Ci(i,O),v=uw(s),x=m.useRef(!1),w=m.useRef(c),S=m.useRef(l);m.useEffect(()=>{const k=g;if(!k)return;const T=window.HTMLInputElement.prototype,N=Object.getOwnPropertyDescriptor(T,"checked").set,_=l!==S.current;S.current=l;const R=w.current!==c;w.current=c;const $=!(_&&a.current);if(R&&N){x.current=!_;const D=new Event("click",{bubbles:$});N.call(k,c),k.dispatchEvent(D),x.current=!1}},[g,c,a,l]);const E=m.useRef(c);return o.jsx(Qi.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??E.current,required:d,disabled:f,name:h,value:p,form:b,...r,tabIndex:-1,ref:y,onClick:Mr(n,k=>{x.current&&k.stopPropagation()}),style:{...r.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function Cle(e){return typeof e=="function"}Lh(Cle,"isFunction");function v$(e){return e?"checked":"unchecked"}Lh(v$,"getState");var p7e=Object.defineProperty,m7e=(e,t)=>p7e(e,"name",{value:t,configurable:!0}),g7e="Toggle",b7e=m.forwardRef(m7e(function(t,n){const{pressed:r,defaultPressed:i,onPressedChange:s,...a}=t,[l,c]=Du({prop:r,onChange:s,defaultProp:i??!1,caller:g7e});return o.jsx(Qi.button,{type:"button","aria-pressed":l,"data-state":l?"on":"off","data-disabled":t.disabled?"":void 0,...a,ref:n,onClick:Mr(t.onClick,()=>{t.disabled||c(!l)})})},"Toggle")),O7e=Object.defineProperty,$h=(e,t)=>O7e(e,"name",{value:t,configurable:!0}),_O="ToggleGroup",[Nle,NTt]=Xl(_O,[WA]),jle=WA(),y7e=m.forwardRef($h(function(t,n){const{type:r,...i}=t;if(r==="single"){const s=i;return o.jsx(x7e,{role:"radiogroup",...s,ref:n})}if(r==="multiple"){const s=i;return o.jsx(v7e,{role:"toolbar",...s,ref:n})}throw new Error(`Missing prop \`type\` expected on \`${_O}\``)},"ToggleGroup")),[Rle,Ile]=Nle(_O),x7e=m.forwardRef($h(function(t,n){const{value:r,defaultValue:i,onValueChange:s=$h(()=>{},"onValueChange"),...a}=t,[l,c]=Du({prop:r,defaultProp:i??"",onChange:s,caller:_O});return o.jsx(Rle,{scope:t.__scopeToggleGroup,type:"single",value:m.useMemo(()=>l?[l]:[],[l]),onItemActivate:c,onItemDeactivate:m.useCallback(()=>c(""),[c]),children:o.jsx(Dle,{...a,ref:n})})},"ToggleGroupImplSingle")),v7e=m.forwardRef($h(function(t,n){const{value:r,defaultValue:i,onValueChange:s=$h(()=>{},"onValueChange"),...a}=t,[l,c]=Du({prop:r,defaultProp:i??[],onChange:s,caller:_O}),u=m.useCallback(f=>c((h=[])=>[...h,f]),[c]),d=m.useCallback(f=>c((h=[])=>h.filter(p=>p!==f)),[c]);return o.jsx(Rle,{scope:t.__scopeToggleGroup,type:"multiple",value:l,onItemActivate:u,onItemDeactivate:d,children:o.jsx(Dle,{...a,ref:n})})},"ToggleGroupImplMultiple")),[w7e,S7e]=Nle(_O),Dle=m.forwardRef($h(function(t,n){const{__scopeToggleGroup:r,disabled:i=!1,rovingFocus:s=!0,orientation:a,dir:l,loop:c=!0,...u}=t,d=jle(r),f=QA(l),h={dir:f,...u};return o.jsx(w7e,{scope:r,rovingFocus:s,disabled:i,children:s?o.jsx(hle,{asChild:!0,...d,orientation:a,dir:f,loop:c,children:o.jsx(Qi.div,{...h,ref:n})}):o.jsx(Qi.div,{...h,ref:n})})},"ToggleGroupImpl")),iM="ToggleGroupItem",E7e=m.forwardRef($h(function(t,n){const r=Ile(iM,t.__scopeToggleGroup),i=S7e(iM,t.__scopeToggleGroup),s=jle(t.__scopeToggleGroup),a=r.value.includes(t.value),l=i.disabled||t.disabled,c={...t,pressed:a,disabled:l},u=m.useRef(null);return i.rovingFocus?o.jsx(ple,{asChild:!0,...s,focusable:!l,active:a,ref:u,children:o.jsx(uV,{...c,ref:n})}):o.jsx(uV,{...c,ref:n})},"ToggleGroupItem")),uV=m.forwardRef($h(function(t,n){const{__scopeToggleGroup:r,value:i,...s}=t,a=Ile(iM,r),l={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},c=a.type==="single"?l:void 0;return o.jsx(b7e,{...c,...s,ref:n,onPressedChange:u=>{u?a.onItemActivate(i):a.onItemDeactivate(i)}})},"ToggleGroupItemImpl")),k7e=Object.defineProperty,Xs=(e,t)=>k7e(e,"name",{value:t,configurable:!0}),[w$,jTt]=Xl("Tooltip",[XA]),S$=XA(),T7e="TooltipProvider",_7e=700,sM="tooltip.open",[A7e,E$]=w$(T7e),C7e=Xs(e=>{const{__scopeTooltip:t,delayDuration:n=_7e,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=e,a=m.useRef(!0),l=m.useRef(!1),c=m.useRef(0);return m.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),o.jsx(A7e,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:m.useCallback(()=>{r<=0||(window.clearTimeout(c.current),a.current=!1)},[r]),onClose:m.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.current=!0,r))},[r]),isPointerInTransitRef:l,onPointerInTransitChange:m.useCallback(u=>{l.current=u},[]),disableHoverableContent:i,children:s})},"TooltipProvider"),aM="Tooltip",[N7e,dw]=w$(aM),j7e=Xs(e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:a,delayDuration:l}=e,c=E$(aM,e.__scopeTooltip),u=S$(t),[d,f]=m.useState(null),[h,p]=m.useState(void 0),b=BA(),g=m.useRef(0),O=a??c.disableHoverableContent,y=l??c.delayDuration,v=m.useRef(!1),[x,w]=Du({prop:r,defaultProp:i??!1,onChange:Xs(N=>{N?(c.onOpen(),document.dispatchEvent(new CustomEvent(sM))):c.onClose(),s==null||s(N)},"onChange"),caller:aM}),S=m.useMemo(()=>x?v.current?"delayed-open":"instant-open":"closed",[x]),E=m.useCallback(()=>{window.clearTimeout(g.current),g.current=0,v.current=!1,w(!0)},[w]),k=m.useCallback(()=>{window.clearTimeout(g.current),g.current=0,w(!1)},[w]),T=m.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{v.current=!0,w(!0),g.current=0},y)},[y,w]);m.useEffect(()=>()=>{g.current&&(window.clearTimeout(g.current),g.current=0)},[]);const C=h??b;return o.jsx(nle,{...u,children:o.jsx(N7e,{scope:t,contentId:C,setContentId:p,open:x,stateAttribute:S,trigger:d,onTriggerChange:f,onTriggerEnter:m.useCallback(()=>{c.isOpenDelayedRef.current?T():E()},[c.isOpenDelayedRef,T,E]),onTriggerLeave:m.useCallback(()=>{O?k():(window.clearTimeout(g.current),g.current=0)},[k,O]),onOpen:E,onClose:k,disableHoverableContent:O,children:n})})},"Tooltip"),dV="TooltipTrigger",R7e=m.forwardRef(Xs(function(t,n){const{__scopeTooltip:r,...i}=t,s=dw(dV,r),a=E$(dV,r),l=S$(r),c=m.useRef(null),u=Ci(n,c,s.onTriggerChange),d=m.useRef(!1),f=m.useRef(!1),h=m.useCallback(()=>d.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),o.jsx(rle,{asChild:!0,...l,children:o.jsx(Qi.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...i,ref:u,onPointerMove:Mr(t.onPointerMove,p=>{p.pointerType!=="touch"&&!f.current&&!a.isPointerInTransitRef.current&&(s.onTriggerEnter(),f.current=!0)}),onPointerLeave:Mr(t.onPointerLeave,()=>{s.onTriggerLeave(),f.current=!1}),onPointerDown:Mr(t.onPointerDown,()=>{s.open&&s.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Mr(t.onFocus,()=>{d.current||s.onOpen()}),onBlur:Mr(t.onBlur,s.onClose),onClick:Mr(t.onClick,s.onClose)})})},"TooltipTrigger")),Ple="TooltipPortal",[I7e,D7e]=w$(Ple,{forceMount:void 0}),P7e=Xs(e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,s=dw(Ple,t);return o.jsx(I7e,{scope:t,forceMount:n,children:o.jsx(SO,{present:n||s.open,children:o.jsx(Aoe,{asChild:!0,container:i,children:r})})})},"TooltipPortal"),Xx="TooltipContent",M7e=m.forwardRef(Xs(function(t,n){const r=D7e(Xx,t.__scopeTooltip),{forceMount:i=r.forceMount,side:s="top",...a}=t,l=dw(Xx,t.__scopeTooltip);return o.jsx(SO,{present:i||l.open,children:l.disableHoverableContent?o.jsx(Mle,{side:s,...a,ref:n}):o.jsx(L7e,{side:s,...a,ref:n})})},"TooltipContent")),L7e=m.forwardRef(Xs(function(t,n){const r=dw(Xx,t.__scopeTooltip),i=E$(Xx,t.__scopeTooltip),s=m.useRef(null),a=Ci(n,s),[l,c]=m.useState(null),{trigger:u,onClose:d}=r,f=s.current,{onPointerInTransitChange:h}=i,p=m.useCallback(()=>{c(null),h(!1)},[h]),b=m.useCallback((g,O)=>{const y=g.currentTarget,v={x:g.clientX,y:g.clientY},x=Lle(v,y.getBoundingClientRect()),w=$le(v,x),S=Ble(O.getBoundingClientRect()),E=Fle([...w,...S]);c(E),h(!0)},[h]);return m.useEffect(()=>()=>p(),[p]),m.useEffect(()=>{if(u&&f){const g=Xs(y=>b(y,f),"handleTriggerLeave"),O=Xs(y=>b(y,u),"handleContentLeave");return u.addEventListener("pointerleave",g),f.addEventListener("pointerleave",O),()=>{u.removeEventListener("pointerleave",g),f.removeEventListener("pointerleave",O)}}},[u,f,b,p]),m.useEffect(()=>{if(l){const g=Xs(O=>{const y=O.target,v={x:O.clientX,y:O.clientY},x=(u==null?void 0:u.contains(y))||(f==null?void 0:f.contains(y)),w=!Qle(v,l);x?p():w&&(p(),d())},"handleTrackPointerGrace");return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[u,f,l,d,p]),o.jsx(Mle,{...t,ref:a})},"TooltipContentHoverable")),$7e=Wae("TooltipContent"),Mle=m.forwardRef(Xs(function(t,n){const{__scopeTooltip:r,children:i,"aria-label":s,id:a,onEscapeKeyDown:l,onPointerDownOutside:c,...u}=t,d=dw(Xx,r),f=S$(r),{onClose:h}=d;m.useEffect(()=>(document.addEventListener(sM,h),()=>document.removeEventListener(sM,h)),[h]),m.useEffect(()=>{if(d.trigger){const b=Xs(g=>{g.target instanceof Node&&g.target.contains(d.trigger)&&h()},"handleScroll");return window.addEventListener("scroll",b,{capture:!0}),()=>window.removeEventListener("scroll",b,{capture:!0})}},[d.trigger,h]);const{setContentId:p}=d;return Ql(()=>(p(a),()=>{p(void 0)}),[a,p]),o.jsx(yoe,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:b=>b.preventDefault(),onDismiss:h,children:o.jsxs(ile,{"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($7e,{children:i}),s?o.jsx(S6e,{id:d.contentId,role:"tooltip",children:s}):null]})})},"TooltipContentImpl"));function Lle(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")}}Xs(Lle,"getExitSideFromRect");function $le(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}Xs($le,"getPaddedExitPoints");function Ble(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}]}Xs(Ble,"getPointsFromRect");function Qle(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}Xs(Qle,"isPointInPolygon");function Fle(e){const t=e.slice();return t.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),Ule(t)}Xs(Fle,"getHull");function Ule(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)}Xs(Ule,"getHullPresorted");var B7e=C7e,Q7e=j7e,zle=R7e,F7e=P7e,U7e=M7e;function C2(e){const t=m.useRef(e);return t.current=e,t}let Pb=[],aE=!1;const fV=e=>{var t,n;if(e.key==="Escape"){const[r]=Pb;r&&(e.preventDefault(),(n=(t=r.callback).current)==null||n.call(t))}},Vle=()=>{Pb.length>0&&!aE?(document.body.addEventListener("keydown",fV),aE=!0):Pb.length===0&&aE&&(document.body.removeEventListener("keydown",fV),aE=!1)},z7e=e=>{Pb.unshift(e),Vle()},V7e=({id:e})=>{Pb=Pb.filter(t=>t.id!==e),Vle()},k$=(e,t)=>{const n=m.useId(),r=C2(t);m.useEffect(()=>{if(!e)return;const i={id:n,callback:r};return z7e(i),()=>V7e(i)},[n,e,r])},q7e="_Tooltip_16g2y_1",H7e="_TriggerDecorator_16g2y_73",qle={Tooltip:q7e,TriggerDecorator:H7e},il=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:p=5,gutterSize:b="md",contentClassName:g,onPointerDown:O,onClick:y,...v}=e,[x,w]=m.useState(!1),[S,E]=m.useState(!1);Y6(()=>E(!1),S?400:null);const k=i??x,T=N=>{typeof i!="boolean"&&(w(N),u&&E(N))},C=N=>{u&&S&&(N.preventDefault(),N.stopPropagation())};return o.jsxs(Hle,{open:k,delayDuration:a,onOpenChange:T,disableHoverableContent:!l,children:[o.jsx(zle,{asChild:!0,children:o.jsx(Gae,{...v,ref:t,onPointerDown:N=>{C(N),O==null||O(N)},onClick:N=>{C(N),y==null||y(N)},children:n})}),o.jsx(Xle,{maxWidth:s,compact:c,align:d,alignOffset:f,side:h,sideOffset:p,gutterSize:b,className:g,children:r})]})},Hle=({children:e,open:t,onOpenChange:n,...r})=>(k$(t,()=>{n(!1)}),o.jsx(B7e,{children:o.jsx(Q7e,{open:t,onOpenChange:n,...r,children:e})})),Xle=({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(F7e,{children:o.jsx(U7e,{...u,className:zr(qle.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:dm,children:e})}),X7e=({children:e,asChild:t=!0,...n})=>o.jsx(zle,{asChild:t,...n,children:e}),G7e=e=>{const{children:t,className:n,focusable:r=!0,ref:i,...s}=e,a=typeof t=="string";return o.jsx(Gae,{ref:i,...s,className:zr(qle.TriggerDecorator,n),tabIndex:r?0:void 0,children:a?o.jsx("span",{children:t}):t})};il.Root=Hle;il.Content=Xle;il.Trigger=X7e;il.TriggerDecorator=G7e;const Gle="KNOWLEDGE_PROVIDER_ASSOCIATION_INVALID";class JA extends Error{constructor(n,r,i={}){super(n);Hi(this,"status");Hi(this,"errorCode");Hi(this,"requestId");Hi(this,"diagnostics");Hi(this,"detail");Hi(this,"payload");Hi(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 Yle extends Error{constructor(n){super(n.map(({region:r,error:i})=>`${r}: ${i.message||"读取知识库失败"}`).join(` -`));Hi(this,"failures");this.name="KnowledgeRegionAggregateError",this.failures=n}}const Y7e=new Set(["ak","apikey","sk","accesskey","accesskeyid","authorization","authkey","clientsecret","cookie","credential","credentials","password","passwd","privatekey","secret","secretaccesskey","secretkey","securitytoken","sessiontoken","setcookie","token"]),W7e=6,hV=50,Wle=4e3;function Z7e(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function K7e(e){const t=Z7e(e);return Y7e.has(t)||t.endsWith("password")||t.endsWith("secret")||t.endsWith("token")||t.endsWith("credential")}function J7e(e){return/<\s*(?:!doctype|html|head|body|script|style)\b/i.test(e)}function r1(e){return J7e(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 oM(e,t=0,n=new WeakSet){if(e===null||typeof e=="number"||typeof e=="boolean")return e;if(typeof e=="string")return r1(e).slice(0,Wle);if(typeof e!="object")return;if(t>=W7e)return"[内容过深,已截断]";if(n.has(e))return"[循环引用]";if(n.add(e),Array.isArray(e))return e.slice(0,hV).map(i=>oM(i,t+1,n));const r={};return Object.entries(e).slice(0,hV).forEach(([i,s])=>{r[i]=K7e(i)?"[已脱敏]":oM(s,t+1,n)}),r}function pV(e){if(e===void 0)return"";const t=oM(e);if(typeof t=="string")return t;if(t===void 0)return"";try{return JSON.stringify(t).slice(0,Wle)}catch{return"[诊断信息无法显示]"}}function Ea(e,t){if(e instanceof Yle)return e.failures.map(({region:a,error:l})=>`${a} +`)},M$e=0,Ag=[];function L$e(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),i=m.useState(M$e++)[0],s=m.useState(Doe)[0],a=m.useRef(e);m.useEffect(function(){a.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var g=i$e([e.lockRef.current],(e.shards||[]).map(tV),!0).filter(Boolean);return g.forEach(function(O){return O.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),g.forEach(function(O){return O.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var l=m.useCallback(function(g,O){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!a.current.allowPinchZoom;var y=nE(g),v=n.current,x="deltaX"in g?g.deltaX:v[0]-y[0],w="deltaY"in g?g.deltaY:v[1]-y[1],S,E=g.target,k=Math.abs(x)>Math.abs(w)?"h":"v";if("touches"in g&&k==="h"&&E.type==="range")return!1;var T=window.getSelection(),C=T&&T.anchorNode,N=C?C===E||C.contains(E):!1;if(N)return!1;var _=Jz(k,E);if(!_)return!0;if(_?S=k:(S=k==="v"?"h":"v",_=Jz(k,E)),!_)return!1;if(!r.current&&"changedTouches"in g&&(x||w)&&(r.current=S),!S)return!0;var R=r.current||S;return I$e(R,O,g,R==="h"?x:w)},[]),c=m.useCallback(function(g){var O=g;if(!(!Ag.length||Ag[Ag.length-1]!==s)){var y="deltaY"in O?eV(O):nE(O),v=t.current.filter(function(S){return S.name===O.type&&(S.target===O.target||O.target===S.shadowParent)&&D$e(S.delta,y)})[0];if(v&&v.should){O.cancelable&&O.preventDefault();return}if(!v){var x=(a.current.shards||[]).map(tV).filter(Boolean).filter(function(S){return S.contains(O.target)}),w=x.length>0?l(O,x[0]):!a.current.noIsolation;w&&O.cancelable&&O.preventDefault()}}},[]),u=m.useCallback(function(g,O,y,v){var x={name:g,delta:O,target:y,should:v,shadowParent:$$e(y)};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(w){return w!==x})},1)},[]),d=m.useCallback(function(g){n.current=nE(g),r.current=void 0},[]),f=m.useCallback(function(g){u(g.type,eV(g),g.target,l(g,e.lockRef.current))},[]),h=m.useCallback(function(g){u(g.type,nE(g),g.target,l(g,e.lockRef.current))},[]);m.useEffect(function(){return Ag.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,_g),document.addEventListener("touchmove",c,_g),document.addEventListener("touchstart",d,_g),function(){Ag=Ag.filter(function(g){return g!==s}),document.removeEventListener("wheel",c,_g),document.removeEventListener("touchmove",c,_g),document.removeEventListener("touchstart",d,_g)}},[]);var p=e.removeScrollBar,b=e.inert;return m.createElement(m.Fragment,null,b?m.createElement(s,{styles:P$e(i)}):null,p?m.createElement(T$e,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function $$e(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const B$e=h$e(Ioe,L$e);var $oe=m.forwardRef(function(e,t){return m.createElement(zA,su({},e,{ref:t,sideCar:B$e}))});$oe.classNames=zA.classNames;var Q$e=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Cg=new WeakMap,rE=new WeakMap,iE={},xR=0,Boe=function(e){return e&&(e.host||Boe(e.parentNode))},F$e=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Boe(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})},U$e=function(e,t,n,r){var i=F$e(t,Array.isArray(e)?e:[e]);iE[n]||(iE[n]=new WeakMap);var s=iE[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 p=h.getAttribute(r),b=p!==null&&p!=="false",g=(Cg.get(h)||0)+1,O=(s.get(h)||0)+1;Cg.set(h,g),s.set(h,O),a.push(h),g===1&&b&&rE.set(h,!0),O===1&&h.setAttribute(n,"true"),b||h.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",h,y)}})};return d(t),l.clear(),xR++,function(){a.forEach(function(f){var h=Cg.get(f)-1,p=s.get(f)-1;Cg.set(f,h),s.set(f,p),h||(rE.has(f)||f.removeAttribute(r),rE.delete(f)),p||f.removeAttribute(n)}),xR--,xR||(Cg=new WeakMap,Cg=new WeakMap,rE=new WeakMap,iE={})}},z$e=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=Q$e(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),U$e(r,i,n,"aria-hidden")):function(){return null}},V$e=Object.defineProperty,q$e=(e,t)=>V$e(e,"name",{value:t,configurable:!0});function dw(e){const[t,n]=m.useState(void 0);return Ql(()=>{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}q$e(dw,"useSize");var H$e=Object.defineProperty,Gd=(e,t)=>H$e(e,"name",{value:t,configurable:!0}),s$="Checkbox",[X$e,jTt]=Xl(s$),[G$e,a$]=X$e(s$);function Qoe(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,p]=Du({prop:n,defaultProp:i??!1,onChange:c,caller:s$}),[b,g]=m.useState(null),[O,y]=m.useState(null),v=m.useRef(!1),[x,w]=m.useReducer(k=>k+1,0),S=b?!!a||!!b.closest("form"):!0,E={checked:h,disabled:s,setChecked:p,control:b,setControl:g,name:l,form:a,value:d,hasConsumerStoppedPropagationRef:v,userInteractionCount:x,onUserInteraction:w,required:u,defaultChecked:Rd(i)?!1:i,isFormControl:S,bubbleInput:O,setBubbleInput:y};return o.jsx(G$e,{scope:t,...E,children:Foe(f)?f(E):r})}Gd(Qoe,"CheckboxProvider");var Y$e="CheckboxTrigger",W$e=m.forwardRef(Gd(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:p,onUserInteraction:b,isFormControl:g,bubbleInput:O}=a$(Y$e,t),y=Ci(s,f),v=m.useRef(u);return m.useEffect(()=>{const x=a==null?void 0:a.form;if(x){const w=Gd(()=>h(v.current),"reset");return x.addEventListener("reset",w),()=>x.removeEventListener("reset",w)}},[a,h]),o.jsx(Qi.button,{type:"button",role:"checkbox","aria-checked":Rd(u)?"mixed":u,"aria-required":d,"data-state":o$(u),"data-disabled":c?"":void 0,disabled:c,value:l,...i,ref:y,onKeyDown:Mr(n,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:Mr(r,x=>{b(),h(w=>Rd(w)?!0:!w),O&&g&&(p.current=x.isPropagationStopped(),p.current||x.stopPropagation())})})},"CheckboxTrigger")),Z$e=m.forwardRef(Gd(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(Qoe,{__scopeCheckbox:r,checked:s,defaultChecked:a,disabled:c,required:l,onCheckedChange:d,name:i,form:f,value:u,internal_do_not_use_render:({isFormControl:p})=>o.jsxs(o.Fragment,{children:[o.jsx(W$e,{...h,ref:n,__scopeCheckbox:r}),p&&o.jsx(t8e,{__scopeCheckbox:r})]})})},"Checkbox")),K$e="CheckboxIndicator",J$e=m.forwardRef(Gd(function(t,n){const{__scopeCheckbox:r,forceMount:i,...s}=t,a=a$(K$e,r);return o.jsx(EO,{present:i||Rd(a.checked)||a.checked===!0,children:o.jsx(Qi.span,{"data-state":o$(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:n,style:{pointerEvents:"none",...t.style}})})},"CheckboxIndicator")),e8e="CheckboxBubbleInput",t8e=m.forwardRef(Gd(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:p,form:b,bubbleInput:g,setBubbleInput:O}=a$(e8e,t),y=Ci(i,O),v=dw(s),x=m.useRef(!1),w=m.useRef(c),S=m.useRef(l);m.useEffect(()=>{const k=g;if(!k)return;const T=window.HTMLInputElement.prototype,N=Object.getOwnPropertyDescriptor(T,"checked").set,_=l!==S.current;S.current=l;const R=w.current!==c;w.current=c;const $=!(_&&a.current);if(R&&N){x.current=!_;const D=new Event("click",{bubbles:$});k.indeterminate=Rd(c),N.call(k,Rd(c)?!1:c),k.dispatchEvent(D),x.current=!1}},[g,c,a,l]);const E=m.useRef(Rd(c)?!1:c);return o.jsx(Qi.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??E.current,required:d,disabled:f,name:h,value:p,form:b,...r,tabIndex:-1,ref:y,onClick:Mr(n,k=>{x.current&&k.stopPropagation()}),style:{...r.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function Foe(e){return typeof e=="function"}Gd(Foe,"isFunction");function Rd(e){return e==="indeterminate"}Gd(Rd,"isIndeterminate");function o$(e){return Rd(e)?"indeterminate":e?"checked":"unchecked"}Gd(o$,"getState");const n8e=["top","right","bottom","left"],Ph=Math.min,Id=Math.max,_2=Math.round,sE=Math.floor,Dd=e=>({x:e,y:e}),r8e={left:"right",right:"left",bottom:"top",top:"bottom"};function Uoe(e,t,n){return Id(e,Ph(t,n))}function Yd(e,t){return typeof e=="function"?e(t):e}function Mh(e){return e.split("-")[0]}function kO(e){return e.split("-")[1]}function l$(e){return e==="x"?"y":"x"}function c$(e){return e==="y"?"height":"width"}function hu(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function u$(e){return l$(hu(e))}function i8e(e,t,n){n===void 0&&(n=!1);const r=kO(e),i=u$(e),s=c$(i);let a=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=A2(a)),[a,A2(a)]}function s8e(e){const t=A2(e);return[rM(e),t,rM(t)]}function rM(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const nV=["left","right"],rV=["right","left"],a8e=["top","bottom"],o8e=["bottom","top"];function l8e(e,t,n){switch(e){case"top":case"bottom":return n?t?rV:nV:t?nV:rV;case"left":case"right":return t?a8e:o8e;default:return[]}}function c8e(e,t,n,r){const i=kO(e);let s=l8e(Mh(e),n==="start",r);return i&&(s=s.map(a=>a+"-"+i),t&&(s=s.concat(s.map(rM)))),s}function A2(e){const t=Mh(e);return r8e[t]+e.slice(t.length)}function u8e(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 zoe(e){return typeof e!="number"?u8e(e):{top:e,right:e,bottom:e,left:e}}function C2(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 iV(e,t,n){let{reference:r,floating:i}=e;const s=hu(t),a=u$(t),l=c$(a),c=Mh(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 p;switch(c){case"top":p={x:d,y:r.y-i.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-i.width,y:f};break;default:p={x:r.x,y:r.y}}const b=kO(t);return b&&(p[a]+=h*(b==="end"?1:-1)*(n&&u?-1:1)),p}async function d8e(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:p=0}=Yd(t,e),b=zoe(p),O=l[h?f==="floating"?"reference":"floating":f],y=C2(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(O)))==null||n?O:O.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=C2(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:x,strategy:c}):v);return{top:(y.top-S.top+b.top)/w.y,bottom:(S.bottom-y.bottom+b.bottom)/w.y,left:(y.left-S.left+b.left)/w.x,right:(S.right-y.right+b.right)/w.x}}const f8e=50,h8e=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:d8e},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}=iV(u,r,c),h=r,p=0;const b={};for(let g=0;g({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}=Yd(e,t)||{};if(u==null)return{};const f=zoe(d),h={x:n,y:r},p=u$(i),b=c$(p),g=await a.getDimensions(u),O=p==="y",y=O?"top":"left",v=O?"bottom":"right",x=O?"clientHeight":"clientWidth",w=s.reference[b]+s.reference[p]-h[p]-s.floating[b],S=h[p]-s.reference[p],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[b]);const T=w/2-S/2,C=k/2-g[b]/2-1,N=Ph(f[y],C),_=Ph(f[v],C),R=k-g[b]-_,$=k/2-g[b]/2+T,D=Uoe(N,$,R),M=!c.arrow&&kO(i)!=null&&$!==D&&s.reference[b]/2-($D<=0)){var _,R;const D=(((_=s.flip)==null?void 0:_.index)||0)+1,M=k[D];if(M&&(!(f==="alignment"?v!==hu(M):!1)||N.every(L=>hu(L.placement)===v?L.overflows[0]>0:!0)))return{data:{index:D,overflows:N},reset:{placement:M}};let j=(R=N.filter(P=>P.overflows[0]<=0).sort((P,L)=>P.overflows[1]-L.overflows[1])[0])==null?void 0:R.placement;if(!j)switch(p){case"bestFit":{var $;const P=($=N.filter(L=>{if(E){const U=hu(L.placement);return U===v||U==="y"}return!0}).map(L=>[L.placement,L.overflows.filter(U=>U>0).reduce((U,F)=>U+F,0)]).sort((L,U)=>L[1]-U[1])[0])==null?void 0:$[0];P&&(j=P);break}case"initialPlacement":j=l;break}if(i!==j)return{reset:{placement:j}}}return{}}}};function sV(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function aV(e){return n8e.some(t=>e[t]>=0)}const g8e=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=Yd(e,t);switch(i){case"referenceHidden":{const a=await r.detectOverflow(t,{...s,elementContext:"reference"}),l=sV(a,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:aV(l)}}}case"escaped":{const a=await r.detectOverflow(t,{...s,altBoundary:!0}),l=sV(a,n.floating);return{data:{escapedOffsets:l,escaped:aV(l)}}}default:return{}}}}},Voe=new Set(["left","top"]);async function b8e(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),a=Mh(n),l=kO(n),c=hu(n)==="y",u=Voe.has(a)?-1:1,d=s&&c?-1:1,f=Yd(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:b}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof b=="number"&&(p=l==="end"?b*-1:b),c?{x:p*d,y:h*u}:{x:h*u,y:p*d}}const O8e=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 b8e(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}}}}},y8e=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}=Yd(e,t),d={x:n,y:r},f=await s.detectOverflow(t,u),h=hu(i),p=l$(h);let b=d[p],g=d[h];const O=(v,x)=>Uoe(x+f[v==="y"?"top":"left"],x,x-f[v==="y"?"bottom":"right"]);a&&(b=O(p,b)),l&&(g=O(h,g));const y=c.fn({...t,[p]:b,[h]:g});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[p]:a,[h]:l}}}}}},x8e=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}=Yd(e,t),h={x:i,y:s},p=hu(a),b=l$(p);let g=h[b],O=h[p];const y=Yd(u,t),v=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:(n=y.mainAxis)!=null?n:0,crossAxis:(r=y.crossAxis)!=null?r:0};if(d){const S=b==="y"?"height":"width",E=l.reference[b]-l.floating[S]+v.mainAxis,k=l.reference[b]+l.reference[S]-v.mainAxis;gk&&(g=k)}if(f){var x,w;const S=b==="y"?"width":"height",E=Voe.has(Mh(a)),k=l.reference[p]-l.floating[S]+(E&&((x=c.offset)==null?void 0:x[p])||0)+(E?0:v.crossAxis),T=l.reference[p]+l.reference[S]+(E?0:((w=c.offset)==null?void 0:w[p])||0)-(E?v.crossAxis:0);OT&&(O=T)}return{[b]:g,[p]:O}}}},v8e=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}=Yd(e,t),c=await i.detectOverflow(t,l),u=Mh(n),d=kO(n),f=hu(n)==="y",{width:h,height:p}=r.floating;let b,g;u==="top"||u==="bottom"?(b=u,g=d===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(g=u,b=d==="end"?"top":"bottom");const O=p-c.top-c.bottom,y=h-c.left-c.right,v=Ph(p-c[b],O),x=Ph(h-c[g],y),w=t.middlewareData.shift,S=!w;let E=v,k=x;w!=null&&w.enabled.x&&(k=y),w!=null&&w.enabled.y&&(E=O),S&&!d&&(f?k=h-2*Id(c.left,c.right):E=p-2*Id(c.top,c.bottom)),await a({...t,availableWidth:k,availableHeight:E});const T=await i.getDimensions(s.floating);return h!==T.width||p!==T.height?{reset:{rects:!0}}:{}}}};function VA(){return typeof window<"u"}function TO(e){return qoe(e)?(e.nodeName||"").toLowerCase():"#document"}function Oo(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function lf(e){var t;return(t=(qoe(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function qoe(e){return VA()?e instanceof Node||e instanceof Oo(e).Node:!1}function ku(e){return VA()?e instanceof Element||e instanceof Oo(e).Element:!1}function Jh(e){return VA()?e instanceof HTMLElement||e instanceof Oo(e).HTMLElement:!1}function oV(e){return!VA()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Oo(e).ShadowRoot}function qA(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Tu(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function w8e(e){return/^(table|td|th)$/.test(TO(e))}function HA(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const S8e=/transform|translate|scale|rotate|perspective|filter/,E8e=/paint|layout|strict|content/,gp=e=>!!e&&e!=="none";let vR;function d$(e){const t=ku(e)?Tu(e):e;return gp(t.transform)||gp(t.translate)||gp(t.scale)||gp(t.rotate)||gp(t.perspective)||!f$()&&(gp(t.backdropFilter)||gp(t.filter))||S8e.test(t.willChange||"")||E8e.test(t.contain||"")}function k8e(e){let t=Cm(e);for(;Jh(t)&&!qx(t);){if(d$(t))return t;if(HA(t))return null;t=Cm(t)}return null}function f$(){return vR==null&&(vR=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),vR}function qx(e){return/^(html|body|#document)$/.test(TO(e))}function Tu(e){return Oo(e).getComputedStyle(e)}function XA(e){return ku(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Cm(e){if(TO(e)==="html")return e;const t=e.assignedSlot||e.parentNode||oV(e)&&e.host||lf(e);return oV(t)?t.host:t}function Hoe(e){const t=Cm(e);return qx(t)?(e.ownerDocument||e).body:Jh(t)&&qA(t)?t:Hoe(t)}function Hx(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=Hoe(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),a=Oo(i);if(s){const l=iM(a);return t.concat(a,a.visualViewport||[],qA(i)?i:[],l&&n?Hx(l):[])}else return t.concat(i,Hx(i,[],n))}function iM(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Xoe(e){const t=Tu(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Jh(e),s=i?e.offsetWidth:n,a=i?e.offsetHeight:r,l=_2(n)!==s||_2(r)!==a;return l&&(n=s,r=a),{width:n,height:r,$:l}}function h$(e){return ku(e)?e:e.contextElement}function H0(e){const t=h$(e);if(!Jh(t))return Dd(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=Xoe(t);let a=(s?_2(n.width):n.width)/r,l=(s?_2(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const T8e=Dd(0);function Goe(e){const t=Oo(e);return!f$()||!t.visualViewport?T8e:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function _8e(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Oo(e)}function Nm(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=h$(e);let a=Dd(1);t&&(r?ku(r)&&(a=H0(r)):a=H0(e));const l=_8e(s,n,r)?Goe(s):Dd(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=Oo(s),p=ku(r)?Oo(r):r;let b=h,g=iM(b);for(;g&&p!==b;){const O=H0(g),y=g.getBoundingClientRect(),v=Tu(g),x=y.left+(g.clientLeft+parseFloat(v.paddingLeft))*O.x,w=y.top+(g.clientTop+parseFloat(v.paddingTop))*O.y;c*=O.x,u*=O.y,d*=O.x,f*=O.y,c+=x,u+=w,b=Oo(g),g=iM(b)}}return C2({width:d,height:f,x:c,y:u})}function GA(e,t){const n=XA(e).scrollLeft;return t?t.left+n:Nm(lf(e)).left+n}function Yoe(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-GA(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function A8e(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",a=lf(r),l=t?HA(t.floating):!1;if(r===a||l&&s)return n;let c={scrollLeft:0,scrollTop:0},u=Dd(1);const d=Dd(0),f=Jh(r);if((f||!s)&&((TO(r)!=="body"||qA(a))&&(c=XA(r)),f)){const p=Nm(r);u=H0(r),d.x=p.x+r.clientLeft,d.y=p.y+r.clientTop}const h=a&&!f&&!s?Yoe(a,c):Dd(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 C8e(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function N8e(e){const t=XA(e),n=e.ownerDocument.body,r=Id(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Id(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-t.scrollLeft+GA(e);const a=-t.scrollTop;return Tu(n).direction==="rtl"&&(s+=Id(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:s,y:a}}const j8e=25;function R8e(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",i=Oo(e),s=lf(e),a=i.visualViewport;let l=s.clientWidth,c=s.clientHeight,u=0,d=0;if(a){const h=!f$()||t==="fixed";r?h||(u=-a.offsetLeft,d=-a.offsetTop):(l=a.width,c=a.height,h&&(u=a.offsetLeft,d=a.offsetTop))}if(GA(s)<=0){const h=s.ownerDocument,p=h.body,b=getComputedStyle(p),g=h.compatMode==="CSS1Compat"&&parseFloat(b.marginLeft)+parseFloat(b.marginRight)||0,O=Math.abs(s.clientWidth-p.clientWidth-g),y=getComputedStyle(s).scrollbarGutter==="stable both-edges"?O/2:O;y<=j8e&&(l-=y)}return{width:l,height:c,x:u,y:d}}function I8e(e,t){const n=Nm(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=H0(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 lV(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=R8e(e,n,t);else if(t==="document")r=N8e(lf(e));else if(ku(t))r=I8e(t,n);else{const i=Goe(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return C2(r)}function D8e(e,t){const n=t.get(e);if(n)return n;let r=Hx(e,[],!1).filter(l=>ku(l)&&TO(l)!=="body"),i=null;const s=Tu(e).position==="fixed";let a=s?Cm(e):e;for(;ku(a)&&!qx(a);){const l=Tu(a),c=d$(a),u=i?i.position:s?"fixed":"";!c&&(u==="fixed"||u==="absolute"&&l.position==="static")?r=r.filter(f=>f!==a):i=l,a=Cm(a)}return t.set(e,r),r}function P8e(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const a=[...n==="clippingAncestors"?HA(t)?[]:D8e(t,this._c):[].concat(n),r],l=lV(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(T,{...E,root:s.ownerDocument})}catch{r=new IntersectionObserver(T,E)}r.observe(e)}const c=Oo(e),u=()=>l(n);return c.addEventListener("resize",u),l(!0),()=>{c.removeEventListener("resize",u),a()}}function U8e(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=h$(e),d=i||s?[...u?Hx(u):[],...t?Hx(t):[]]:[];d.forEach(y=>{i&&y.addEventListener("scroll",n),s&&y.addEventListener("resize",n)});const f=u&&l?F8e(u,n,s):null;let h=-1,p=null;a&&(p=new ResizeObserver(y=>{let[v]=y;v&&v.target===u&&p&&t&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var x;(x=p)==null||x.observe(t)})),n()}),u&&!c&&p.observe(u),t&&p.observe(t));let b,g=c?Nm(e):null;c&&O();function O(){const y=Nm(e);g&&!Zoe(g,y)&&n(),g=y,b=requestAnimationFrame(O)}return n(),()=>{var y;d.forEach(v=>{i&&v.removeEventListener("scroll",n),s&&v.removeEventListener("resize",n)}),f==null||f(),(y=p)==null||y.disconnect(),p=null,c&&cancelAnimationFrame(b)}}const z8e=O8e,V8e=y8e,q8e=m8e,H8e=v8e,X8e=g8e,uV=p8e,G8e=x8e,Y8e=(e,t,n)=>{const r=new Map,i=n??{},s={...Q8e,...i.platform,_c:r};return h8e(e,t,{...i,platform:s})};var W8e=typeof document<"u",Z8e=function(){},Uk=W8e?m.useLayoutEffect:Z8e;function N2(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(!N2(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)&&!N2(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Koe(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function dV(e,t){const n=Koe(e);return Math.round(t*n)/n}function SR(e){const t=m.useRef(e);return Uk(()=>{t.current=e}),t}function K8e(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]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=m.useState(r);N2(h,r)||p(r);const[b,g]=m.useState(null),[O,y]=m.useState(null),v=m.useCallback(L=>{L!==E.current&&(E.current=L,g(L))},[]),x=m.useCallback(L=>{L!==k.current&&(k.current=L,y(L))},[]),w=s||b,S=a||O,E=m.useRef(null),k=m.useRef(null),T=m.useRef(d),C=c!=null,N=SR(c),_=SR(i),R=SR(u),$=m.useCallback(()=>{if(!E.current||!k.current)return;const L={placement:t,strategy:n,middleware:h};_.current&&(L.platform=_.current),Y8e(E.current,k.current,L).then(U=>{const F={...U,isPositioned:R.current!==!1};D.current&&!N2(T.current,F)&&(T.current=F,si.flushSync(()=>{f(F)}))})},[h,t,n,_,R]);Uk(()=>{u===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,f(L=>({...L,isPositioned:!1})))},[u]);const D=m.useRef(!1);Uk(()=>(D.current=!0,()=>{D.current=!1}),[]),Uk(()=>{if(w&&(E.current=w),S&&(k.current=S),w&&S){if(N.current)return N.current(w,S,$);$()}},[w,S,$,N,C]);const M=m.useMemo(()=>({reference:E,floating:k,setReference:v,setFloating:x}),[v,x]),j=m.useMemo(()=>({reference:w,floating:S}),[w,S]),P=m.useMemo(()=>{const L={position:n,left:0,top:0};if(!j.floating)return L;const U=dV(j.floating,d.x),F=dV(j.floating,d.y);return l?{...L,transform:"translate("+U+"px, "+F+"px)",...Koe(j.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:F}},[n,l,j.floating,d.x,d.y]);return m.useMemo(()=>({...d,update:$,refs:M,elements:j,floatingStyles:P}),[d,$,M,j,P])}const J8e=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?uV({element:r.current,padding:i}).fn(n):{}:r?uV({element:r,padding:i}).fn(n):{}}}},e9e=(e,t)=>{const n=z8e(e);return{name:n.name,fn:n.fn,options:[e,t]}},t9e=(e,t)=>{const n=V8e(e);return{name:n.name,fn:n.fn,options:[e,t]}},n9e=(e,t)=>({fn:G8e(e).fn,options:[e,t]}),r9e=(e,t)=>{const n=q8e(e);return{name:n.name,fn:n.fn,options:[e,t]}},i9e=(e,t)=>{const n=H8e(e);return{name:n.name,fn:n.fn,options:[e,t]}},s9e=(e,t)=>{const n=X8e(e);return{name:n.name,fn:n.fn,options:[e,t]}},a9e=(e,t)=>{const n=J8e(e);return{name:n.name,fn:n.fn,options:[e,t]}};var o9e=Object.defineProperty,vh=(e,t)=>o9e(e,"name",{value:t,configurable:!0}),Joe="Popper",[ele,YA]=Xl(Joe),[l9e,tle]=ele(Joe),c9e=vh(e=>{const{__scopePopper:t,children:n}=e,[r,i]=m.useState(null),[s,a]=m.useState(void 0);return o.jsx(l9e,{scope:t,anchor:r,onAnchorChange:i,placementState:s,setPlacementState:a,children:n})},"Popper"),u9e="PopperAnchor",d9e=m.forwardRef(vh(function(t,n){const{__scopePopper:r,virtualRef:i,...s}=t,a=tle(u9e,r),l=m.useRef(null),c=a.onAnchorChange,u=m.useCallback(g=>{l.current=g,g&&c(g)},[c]),d=Ci(n,u),f=m.useRef(null);m.useEffect(()=>{if(!i)return;const g=f.current;f.current=i.current,g!==f.current&&c(f.current)});const h=a.placementState&&WA(a.placementState),p=h==null?void 0:h[0],b=h==null?void 0:h[1];return i?null:o.jsx(Qi.div,{"data-radix-popper-side":p,"data-radix-popper-align":b,...s,ref:d})},"PopperAnchor")),nle="PopperContent",[f9e,RTt]=ele(nle),h9e=m.forwardRef(vh(function(t,n){var Z,J,fe,be,je,Qe,Me;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:p=!1,updatePositionStrategy:b="optimized",onPlaced:g,...O}=t,y=tle(nle,r),[v,x]=m.useState(null),w=Ci(n,x),[S,E]=m.useState(null),k=dw(S),T=(k==null?void 0:k.width)??0,C=(k==null?void 0:k.height)??0,N=i+(a!=="center"?"-"+a:""),_=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},R=Array.isArray(d)?d:[d],$=R.length>0,D={padding:_,boundary:R.filter(rle),altBoundary:$},{refs:M,floatingStyles:j,placement:P,isPositioned:L,middlewareData:U}=K8e({strategy:"fixed",placement:N,whileElementsMounted:vh((...le)=>U8e(...le,{animationFrame:b==="always"}),"whileElementsMounted"),elements:{reference:y.anchor},middleware:[e9e({mainAxis:s+C,alignmentAxis:l}),u&&t9e({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?n9e():void 0,...D}),u&&r9e({...D}),i9e({...D,apply:vh(({elements:le,rects:ke,availableWidth:ye,availableHeight:$e})=>{const{width:ze,height:Ae}=ke.reference,Ve=le.floating.style;Ve.setProperty("--radix-popper-available-width",`${ye}px`),Ve.setProperty("--radix-popper-available-height",`${$e}px`),Ve.setProperty("--radix-popper-anchor-width",`${ze}px`),Ve.setProperty("--radix-popper-anchor-height",`${Ae}px`)},"apply")}),S&&a9e({element:S,padding:c}),p9e({arrowWidth:T,arrowHeight:C}),p&&s9e({strategy:"referenceHidden",...D,boundary:$?D.boundary:void 0})]}),F=y.setPlacementState;Ql(()=>(F(P),()=>{F(void 0)}),[P,F]);const[q,z]=WA(P),B=Dh(g);Ql(()=>{L&&(B==null||B())},[L,B]);const V=(Z=U.arrow)==null?void 0:Z.x,ce=(J=U.arrow)==null?void 0:J.y,we=((fe=U.arrow)==null?void 0:fe.centerOffset)!==0,[Oe,de]=m.useState();return Ql(()=>{v&&de(window.getComputedStyle(v).zIndex)},[v]),o.jsx("div",{ref:M.setFloating,"data-radix-popper-content-wrapper":"",style:{...j,transform:L?j.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Oe,"--radix-popper-transform-origin":[(be=U.transformOrigin)==null?void 0:be.x,(je=U.transformOrigin)==null?void 0:je.y].join(" "),...((Qe=U.hide)==null?void 0:Qe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:o.jsx(f9e,{scope:r,placedSide:q,placedAlign:z,onArrowChange:E,arrowX:V,arrowY:ce,shouldHideArrow:we,children:o.jsx(Qi.div,{"data-side":q,"data-align":z,...O,ref:w,style:{...O.style,animation:L?(Me=O.style)==null?void 0:Me.animation:"none"}})})})},"PopperContent"));function rle(e){return e!==null}vh(rle,"isNotNull");var p9e=vh(e=>({name:"transformOrigin",options:e,fn(t){var O,y,v;const{placement:n,rects:r,middlewareData:i}=t,a=((O=i.arrow)==null?void 0:O.centerOffset)!==0,l=a?0:e.arrowWidth,c=a?0:e.arrowHeight,[u,d]=WA(n),f={start:"0%",center:"50%",end:"100%"}[d],h=(((y=i.arrow)==null?void 0:y.x)??0)+l/2,p=(((v=i.arrow)==null?void 0:v.y)??0)+c/2;let b="",g="";return u==="bottom"?(b=a?f:`${h}px`,g=`${-c}px`):u==="top"?(b=a?f:`${h}px`,g=`${r.floating.height+c}px`):u==="right"?(b=`${-c}px`,g=a?f:`${p}px`):u==="left"&&(b=`${r.floating.width+c}px`,g=a?f:`${p}px`),{data:{x:b,y:g}}}}),"transformOrigin");function WA(e){const[t,n="center"]=e.split("-");return[t,n]}vh(WA,"getSideAndAlignFromPlacement");var ile=c9e,sle=d9e,ale=h9e,m9e=Object.defineProperty,p$=(e,t)=>m9e(e,"name",{value:t,configurable:!0}),ER=!1;function ole(){const[e,t]=m.useState(ER);return m.useEffect(()=>{ER||(ER=!0,t(!0))},[]),e}p$(ole,"useIsHydrated");var lle=nO[" useSyncExternalStore ".trim().toString()];function cle(){return()=>{}}p$(cle,"subscribe");function ule(){return lle(cle,()=>!0,()=>!1)}p$(ule,"useIsHydratedModern");var g9e=typeof lle=="function"?ule:ole,b9e=Object.defineProperty,Ym=(e,t)=>b9e(e,"name",{value:t,configurable:!0}),kR="rovingFocusGroup.onEntryFocus",O9e={bubbles:!1,cancelable:!0},ZA="RovingFocusGroup",[sM,dle,y9e]=soe(ZA),[x9e,KA]=Xl(ZA,[y9e]),[v9e,w9e]=x9e(ZA),S9e=m.forwardRef(Ym(function(t,n){return o.jsx(sM.Provider,{scope:t.__scopeRovingFocusGroup,children:o.jsx(sM.Slot,{scope:t.__scopeRovingFocusGroup,children:o.jsx(E9e,{...t,ref:n})})})},"RovingFocusGroup")),E9e=m.forwardRef(Ym(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,p=m.useRef(null),b=Ci(n,p),g=UA(a),[O,y]=Du({prop:l,defaultProp:c??null,onChange:u,caller:ZA}),[v,x]=m.useState(!1),w=Dh(d),S=dle(r),E=m.useRef(!1),[k,T]=m.useState(0);return m.useEffect(()=>{const C=p.current;if(C)return C.addEventListener(kR,w),()=>C.removeEventListener(kR,w)},[w]),o.jsx(v9e,{scope:r,orientation:i,dir:g,loop:s,currentTabStopId:O,onItemFocus:m.useCallback(C=>y(C),[y]),onItemShiftTab:m.useCallback(()=>x(!0),[]),onFocusableItemAdd:m.useCallback(()=>T(C=>C+1),[]),onFocusableItemRemove:m.useCallback(()=>T(C=>C-1),[]),children:o.jsx(Qi.div,{tabIndex:v||k===0?-1:0,"data-orientation":i,...h,ref:b,style:{outline:"none",...t.style},onMouseDown:Mr(t.onMouseDown,()=>{E.current=!0}),onFocus:Mr(t.onFocus,C=>{const N=!E.current;if(C.target===C.currentTarget&&N&&!v){const _=new CustomEvent(kR,O9e);if(C.currentTarget.dispatchEvent(_),!_.defaultPrevented){const R=S().filter(P=>P.focusable),$=R.find(P=>P.active),D=R.find(P=>P.id===O),j=[$,D,...R].filter(Boolean).map(P=>P.ref.current);m$(j,f)}}E.current=!1}),onBlur:Mr(t.onBlur,()=>x(!1))})})},"RovingFocusGroupImpl")),k9e="RovingFocusGroupItem",T9e=m.forwardRef(Ym(function(t,n){const{__scopeRovingFocusGroup:r,focusable:i=!0,active:s=!1,tabStopId:a,children:l,...c}=t,u=FA(),d=a||u,f=w9e(k9e,r),h=f.currentTabStopId===d,p=dle(r),{onFocusableItemAdd:b,onFocusableItemRemove:g,currentTabStopId:O}=f,y=g9e();return Ql(()=>{if(!(!y||!i))return b(),()=>g()},[y,i,b,g]),m.useEffect(()=>{if(!(y||!i))return b(),()=>g()},[y,i,b,g]),o.jsx(sM.ItemSlot,{scope:r,id:d,focusable:i,active:s,children:o.jsx(Qi.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...c,ref:n,onMouseDown:Mr(t.onMouseDown,v=>{i?f.onItemFocus(d):v.preventDefault()}),onFocus:Mr(t.onFocus,()=>f.onItemFocus(d)),onKeyDown:Mr(t.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){f.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const x=hle(v,f.orientation,f.dir);if(x!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let S=p().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?ple(S,E+1):S.slice(E+1)}setTimeout(()=>m$(S))}}),children:typeof l=="function"?l({isCurrentTabStop:h,hasTabStop:O!=null}):l})})},"RovingFocusGroupItem")),_9e={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function fle(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}Ym(fle,"getDirectionAwareKey");function hle(e,t,n){const r=fle(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return _9e[r]}Ym(hle,"getFocusIntent");function m$(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}Ym(m$,"focusFirst");function ple(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Ym(ple,"wrapArray");var mle=S9e,gle=T9e,A9e=Object.defineProperty,ep=(e,t)=>A9e(e,"name",{value:t,configurable:!0}),g$="Popover",[ble,ITt]=Xl(g$,[YA]),b$=YA(),[C9e,_O]=ble(g$),N9e=ep(e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:a=!1}=e,l=b$(t),c=m.useRef(null),[u,d]=m.useState(!1),[f,h]=Du({prop:r,defaultProp:i??!1,onChange:s,caller:g$});return o.jsx(ile,{...l,children:o.jsx(C9e,{scope:t,contentId:FA(),triggerRef:c,open:f,onOpenChange:h,onOpenToggle:m.useCallback(()=>h(p=>!p),[h]),hasCustomAnchor:u,onCustomAnchorAdd:m.useCallback(()=>d(!0),[]),onCustomAnchorRemove:m.useCallback(()=>d(!1),[]),modal:a,children:n})})},"Popover"),j9e="PopoverTrigger",R9e=m.forwardRef(ep(function(t,n){const{__scopePopover:r,...i}=t,s=_O(j9e,r),a=b$(r),l=Ci(n,s.triggerRef),c=o.jsx(Qi.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":O$(s.open),...i,ref:l,onClick:Mr(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?c:o.jsx(sle,{asChild:!0,...a,children:c})},"PopoverTrigger")),Ole="PopoverPortal",[I9e,D9e]=ble(Ole,{forceMount:void 0}),P9e=ep(e=>{const{__scopePopover:t,forceMount:n,children:r,container:i}=e,s=_O(Ole,t);return o.jsx(I9e,{scope:t,forceMount:n,children:o.jsx(EO,{present:n||s.open,children:o.jsx(Noe,{asChild:!0,container:i,children:r})})})},"PopoverPortal"),Xx="PopoverContent",M9e=m.forwardRef(ep(function(t,n){const r=D9e(Xx,t.__scopePopover),{forceMount:i=r.forceMount,...s}=t,a=_O(Xx,t.__scopePopover);return o.jsx(EO,{present:i||a.open,children:a.modal?o.jsx($9e,{...s,ref:n}):o.jsx(B9e,{...s,ref:n})})},"PopoverContent")),L9e=Ih("PopoverContent.RemoveScroll"),$9e=m.forwardRef(ep(function(t,n){const r=_O(Xx,t.__scopePopover),i=m.useRef(null),s=Ci(n,i),a=m.useRef(!1);return m.useEffect(()=>{const l=i.current;if(l)return z$e(l)},[]),o.jsx($oe,{as:L9e,allowPinchZoom:!0,children:o.jsx(yle,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Mr(t.onCloseAutoFocus,l=>{var c;l.preventDefault(),a.current||(c=r.triggerRef.current)==null||c.focus()}),onPointerDownOutside:Mr(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:Mr(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})},"PopoverContentModal")),B9e=m.forwardRef(ep(function(t,n){const r=_O(Xx,t.__scopePopover),i=m.useRef(!1),s=m.useRef(!1);return o.jsx(yle,{...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")),yle=m.forwardRef(ep(function(t,n){const{__scopePopover:r,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,...h}=t,p=_O(Xx,r),b=b$(r);return i$(),o.jsx(J6e,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:s,onUnmountAutoFocus:a,children:o.jsx(voe,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:f,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onDismiss:()=>p.onOpenChange(!1),deferPointerDownOutside:!0,children:o.jsx(ale,{"data-state":O$(p.open),role:"dialog",id:p.contentId,...b,...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 O$(e){return e?"open":"closed"}ep(O$,"getState");var xle=N9e,vle=R9e,wle=P9e,Sle=M9e,Q9e=Object.defineProperty,Aa=(e,t)=>Q9e(e,"name",{value:t,configurable:!0}),Ele="Radio",[F9e,kle]=Xl(Ele),[U9e,JA]=F9e(Ele);function Tle(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]=m.useState(null),[p,b]=m.useState(null),g=m.useRef(!1),[O,y]=m.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:g,userInteractionCount:O,onUserInteraction:y,isFormControl:v,bubbleInput:p,setBubbleInput:b,onCheck:Aa(()=>l==null?void 0:l(),"onCheck")};return o.jsx(U9e,{scope:t,...x,children:_le(d)?d(x):r})}Aa(Tle,"RadioProvider");var z9e="RadioTrigger",V9e=m.forwardRef(Aa(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:p}=JA(z9e,t),b=Ci(i,c);return o.jsx(Qi.button,{type:"button",role:"radio","aria-checked":s,"data-state":y$(s),"data-disabled":a?"":void 0,disabled:a,value:l,...r,ref:b,onClick:Mr(n,g=>{s||(f(),u()),p&&h&&(d.current=g.isPropagationStopped(),d.current||g.stopPropagation())})})},"RadioTrigger")),q9e="RadioIndicator",H9e=m.forwardRef(Aa(function(t,n){const{__scopeRadio:r,forceMount:i,...s}=t,a=JA(q9e,r);return o.jsx(EO,{present:i||a.checked,children:o.jsx(Qi.span,{"data-state":y$(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:n})})},"RadioIndicator")),X9e="RadioBubbleInput",G9e=m.forwardRef(Aa(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:p,hasConsumerStoppedPropagationRef:b,userInteractionCount:g}=JA(X9e,t),O=Ci(i,p),y=dw(s),v=m.useRef(!1),x=m.useRef(a),w=m.useRef(g);m.useEffect(()=>{const E=h;if(!E)return;const k=window.HTMLInputElement.prototype,C=Object.getOwnPropertyDescriptor(k,"checked").set,N=g!==w.current;w.current=g;const _=x.current!==a;x.current=a;const R=!(N&&b.current);if(_&&C){v.current=!N;const $=new Event("click",{bubbles:R});C.call(E,a),E.dispatchEvent($),v.current=!1}},[h,a,b,g]);const S=m.useRef(a);return o.jsx(Qi.input,{type:"radio","aria-hidden":!0,defaultChecked:S.current,required:l,disabled:c,name:u,value:d,form:f,...r,tabIndex:-1,ref:O,onClick:Mr(n,E=>{v.current&&E.stopPropagation()}),style:{...r.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"RadioBubbleInput"));function _le(e){return typeof e=="function"}Aa(_le,"isFunction");function y$(e){return e?"checked":"unchecked"}Aa(y$,"getState");var Y9e=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],x$="RadioGroup",[W9e,DTt]=Xl(x$,[KA,kle]),Ale=KA(),eC=kle(),[Z9e,K9e]=W9e(x$),J9e=m.forwardRef(Aa(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:p,...b}=t,g=Ale(r),O=UA(f),[y,v]=Du({prop:l,defaultProp:a??null,onChange:p,caller:x$}),[x,w]=m.useState(null),S=Ci(n,w),E=m.useRef(y);return m.useEffect(()=>{const k=s?x==null?void 0:x.ownerDocument.getElementById(s):x==null?void 0:x.closest("form");if(k instanceof HTMLFormElement){const T=Aa(()=>v(E.current),"reset");return k.addEventListener("reset",T),()=>k.removeEventListener("reset",T)}},[x,s,v]),o.jsx(Z9e,{scope:r,name:i,form:s,required:c,disabled:u,value:y,onValueChange:v,children:o.jsx(mle,{asChild:!0,...g,orientation:d,dir:O,loop:h,children:o.jsx(Qi.div,{role:"radiogroup","aria-required":c,"aria-orientation":d,"data-disabled":u?"":void 0,dir:O,...b,ref:S})})})},"RadioGroup")),e7e="RadioGroupItemProvider",t7e="RadioGroupItemTrigger";function Cle(e){const{__scopeRadioGroup:t,value:n,disabled:r,children:i,internal_do_not_use_render:s}=e,a=K9e(e7e,t),l=eC(t),c=a.disabled||r;return o.jsx(Tle,{...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})}Aa(Cle,"RadioGroupItemProvider");var n7e=m.forwardRef(Aa(function(t,n){const{__scopeRadioGroup:r,...i}=t,s=Ale(r),a=eC(r),{checked:l,disabled:c}=JA(t7e,a.__scopeRadio),u=m.useRef(null),d=Ci(n,u),f=m.useRef(!1);return m.useEffect(()=>{const h=Aa(b=>{Y9e.includes(b.key)&&(f.current=!0)},"handleKeyDown"),p=Aa(()=>f.current=!1,"handleKeyUp");return document.addEventListener("keydown",h),document.addEventListener("keyup",p),()=>{document.removeEventListener("keydown",h),document.removeEventListener("keyup",p)}},[]),o.jsx(gle,{asChild:!0,...s,focusable:!c,active:l,children:o.jsx(V9e,{...a,...i,ref:d,onKeyDown:Mr(i.onKeyDown,h=>{h.key==="Enter"&&h.preventDefault()}),onFocus:Mr(i.onFocus,()=>{var h;f.current&&((h=u.current)==null||h.click())})})})},"RadioGroupItemTrigger")),r7e=m.forwardRef(Aa(function(t,n){const{__scopeRadioGroup:r,value:i,disabled:s,...a}=t;return o.jsx(Cle,{__scopeRadioGroup:r,value:i,disabled:s,internal_do_not_use_render:({isFormControl:l})=>o.jsxs(o.Fragment,{children:[o.jsx(n7e,{...a,ref:n,__scopeRadioGroup:r}),l&&o.jsx(i7e,{__scopeRadioGroup:r})]})})},"RadioGroupItem")),i7e=m.forwardRef(Aa(function(t,n){const{__scopeRadioGroup:r,...i}=t,s=eC(r);return o.jsx(G9e,{...s,...i,ref:n})},"RadioGroupItemBubbleInput")),s7e=m.forwardRef(Aa(function(t,n){const{__scopeRadioGroup:r,...i}=t,s=eC(r);return o.jsx(H9e,{...s,...i,ref:n})},"RadioGroupIndicator")),a7e=Object.defineProperty,Lh=(e,t)=>a7e(e,"name",{value:t,configurable:!0}),v$="Switch",[o7e,PTt]=Xl(v$),[l7e,w$]=o7e(v$);function Nle(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,p]=Du({prop:n,defaultProp:i??!1,onChange:c,caller:v$}),[b,g]=m.useState(null),[O,y]=m.useState(null),v=m.useRef(!1),[x,w]=m.useReducer(k=>k+1,0),S=b?!!a||!!b.closest("form"):!0,E={checked:h,setChecked:p,disabled:s,control:b,setControl:g,name:l,form:a,value:d,hasConsumerStoppedPropagationRef:v,userInteractionCount:x,onUserInteraction:w,required:u,defaultChecked:i,isFormControl:S,bubbleInput:O,setBubbleInput:y};return o.jsx(l7e,{scope:t,...E,children:jle(f)?f(E):r})}Lh(Nle,"SwitchProvider");var c7e="SwitchTrigger",u7e=m.forwardRef(Lh(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:p,onUserInteraction:b,isFormControl:g,bubbleInput:O}=w$(c7e,t),y=Ci(i,f),v=m.useRef(u);return m.useEffect(()=>{const x=a?s==null?void 0:s.ownerDocument.getElementById(a):s==null?void 0:s.form;if(x instanceof HTMLFormElement){const w=Lh(()=>h(v.current),"reset");return x.addEventListener("reset",w),()=>x.removeEventListener("reset",w)}},[s,a,h]),o.jsx(Qi.button,{type:"button",role:"switch","aria-checked":u,"aria-required":d,"data-state":S$(u),"data-disabled":c?"":void 0,disabled:c,value:l,...r,ref:y,onClick:Mr(n,x=>{b(),h(w=>!w),O&&g&&(p.current=x.isPropagationStopped(),p.current||x.stopPropagation())})})},"SwitchTrigger")),d7e=m.forwardRef(Lh(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(Nle,{__scopeSwitch:r,checked:s,defaultChecked:a,disabled:c,required:l,onCheckedChange:d,name:i,form:f,value:u,internal_do_not_use_render:({isFormControl:p})=>o.jsxs(o.Fragment,{children:[o.jsx(u7e,{...h,ref:n,__scopeSwitch:r}),p&&o.jsx(m7e,{__scopeSwitch:r})]})})},"Switch")),f7e="SwitchThumb",h7e=m.forwardRef(Lh(function(t,n){const{__scopeSwitch:r,...i}=t,s=w$(f7e,r);return o.jsx(Qi.span,{"data-state":S$(s.checked),"data-disabled":s.disabled?"":void 0,...i,ref:n})},"SwitchThumb")),p7e="SwitchBubbleInput",m7e=m.forwardRef(Lh(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:p,form:b,bubbleInput:g,setBubbleInput:O}=w$(p7e,t),y=Ci(i,O),v=dw(s),x=m.useRef(!1),w=m.useRef(c),S=m.useRef(l);m.useEffect(()=>{const k=g;if(!k)return;const T=window.HTMLInputElement.prototype,N=Object.getOwnPropertyDescriptor(T,"checked").set,_=l!==S.current;S.current=l;const R=w.current!==c;w.current=c;const $=!(_&&a.current);if(R&&N){x.current=!_;const D=new Event("click",{bubbles:$});N.call(k,c),k.dispatchEvent(D),x.current=!1}},[g,c,a,l]);const E=m.useRef(c);return o.jsx(Qi.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??E.current,required:d,disabled:f,name:h,value:p,form:b,...r,tabIndex:-1,ref:y,onClick:Mr(n,k=>{x.current&&k.stopPropagation()}),style:{...r.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function jle(e){return typeof e=="function"}Lh(jle,"isFunction");function S$(e){return e?"checked":"unchecked"}Lh(S$,"getState");var g7e=Object.defineProperty,b7e=(e,t)=>g7e(e,"name",{value:t,configurable:!0}),O7e="Toggle",y7e=m.forwardRef(b7e(function(t,n){const{pressed:r,defaultPressed:i,onPressedChange:s,...a}=t,[l,c]=Du({prop:r,onChange:s,defaultProp:i??!1,caller:O7e});return o.jsx(Qi.button,{type:"button","aria-pressed":l,"data-state":l?"on":"off","data-disabled":t.disabled?"":void 0,...a,ref:n,onClick:Mr(t.onClick,()=>{t.disabled||c(!l)})})},"Toggle")),x7e=Object.defineProperty,$h=(e,t)=>x7e(e,"name",{value:t,configurable:!0}),AO="ToggleGroup",[Rle,MTt]=Xl(AO,[KA]),Ile=KA(),v7e=m.forwardRef($h(function(t,n){const{type:r,...i}=t;if(r==="single"){const s=i;return o.jsx(w7e,{role:"radiogroup",...s,ref:n})}if(r==="multiple"){const s=i;return o.jsx(S7e,{role:"toolbar",...s,ref:n})}throw new Error(`Missing prop \`type\` expected on \`${AO}\``)},"ToggleGroup")),[Dle,Ple]=Rle(AO),w7e=m.forwardRef($h(function(t,n){const{value:r,defaultValue:i,onValueChange:s=$h(()=>{},"onValueChange"),...a}=t,[l,c]=Du({prop:r,defaultProp:i??"",onChange:s,caller:AO});return o.jsx(Dle,{scope:t.__scopeToggleGroup,type:"single",value:m.useMemo(()=>l?[l]:[],[l]),onItemActivate:c,onItemDeactivate:m.useCallback(()=>c(""),[c]),children:o.jsx(Mle,{...a,ref:n})})},"ToggleGroupImplSingle")),S7e=m.forwardRef($h(function(t,n){const{value:r,defaultValue:i,onValueChange:s=$h(()=>{},"onValueChange"),...a}=t,[l,c]=Du({prop:r,defaultProp:i??[],onChange:s,caller:AO}),u=m.useCallback(f=>c((h=[])=>[...h,f]),[c]),d=m.useCallback(f=>c((h=[])=>h.filter(p=>p!==f)),[c]);return o.jsx(Dle,{scope:t.__scopeToggleGroup,type:"multiple",value:l,onItemActivate:u,onItemDeactivate:d,children:o.jsx(Mle,{...a,ref:n})})},"ToggleGroupImplMultiple")),[E7e,k7e]=Rle(AO),Mle=m.forwardRef($h(function(t,n){const{__scopeToggleGroup:r,disabled:i=!1,rovingFocus:s=!0,orientation:a,dir:l,loop:c=!0,...u}=t,d=Ile(r),f=UA(l),h={dir:f,...u};return o.jsx(E7e,{scope:r,rovingFocus:s,disabled:i,children:s?o.jsx(mle,{asChild:!0,...d,orientation:a,dir:f,loop:c,children:o.jsx(Qi.div,{...h,ref:n})}):o.jsx(Qi.div,{...h,ref:n})})},"ToggleGroupImpl")),aM="ToggleGroupItem",T7e=m.forwardRef($h(function(t,n){const r=Ple(aM,t.__scopeToggleGroup),i=k7e(aM,t.__scopeToggleGroup),s=Ile(t.__scopeToggleGroup),a=r.value.includes(t.value),l=i.disabled||t.disabled,c={...t,pressed:a,disabled:l},u=m.useRef(null);return i.rovingFocus?o.jsx(gle,{asChild:!0,...s,focusable:!l,active:a,ref:u,children:o.jsx(fV,{...c,ref:n})}):o.jsx(fV,{...c,ref:n})},"ToggleGroupItem")),fV=m.forwardRef($h(function(t,n){const{__scopeToggleGroup:r,value:i,...s}=t,a=Ple(aM,r),l={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},c=a.type==="single"?l:void 0;return o.jsx(y7e,{...c,...s,ref:n,onPressedChange:u=>{u?a.onItemActivate(i):a.onItemDeactivate(i)}})},"ToggleGroupItemImpl")),_7e=Object.defineProperty,Gs=(e,t)=>_7e(e,"name",{value:t,configurable:!0}),[E$,LTt]=Xl("Tooltip",[YA]),k$=YA(),A7e="TooltipProvider",C7e=700,oM="tooltip.open",[N7e,T$]=E$(A7e),j7e=Gs(e=>{const{__scopeTooltip:t,delayDuration:n=C7e,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=e,a=m.useRef(!0),l=m.useRef(!1),c=m.useRef(0);return m.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),o.jsx(N7e,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:m.useCallback(()=>{r<=0||(window.clearTimeout(c.current),a.current=!1)},[r]),onClose:m.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.current=!0,r))},[r]),isPointerInTransitRef:l,onPointerInTransitChange:m.useCallback(u=>{l.current=u},[]),disableHoverableContent:i,children:s})},"TooltipProvider"),lM="Tooltip",[R7e,fw]=E$(lM),I7e=Gs(e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:a,delayDuration:l}=e,c=T$(lM,e.__scopeTooltip),u=k$(t),[d,f]=m.useState(null),[h,p]=m.useState(void 0),b=FA(),g=m.useRef(0),O=a??c.disableHoverableContent,y=l??c.delayDuration,v=m.useRef(!1),[x,w]=Du({prop:r,defaultProp:i??!1,onChange:Gs(N=>{N?(c.onOpen(),document.dispatchEvent(new CustomEvent(oM))):c.onClose(),s==null||s(N)},"onChange"),caller:lM}),S=m.useMemo(()=>x?v.current?"delayed-open":"instant-open":"closed",[x]),E=m.useCallback(()=>{window.clearTimeout(g.current),g.current=0,v.current=!1,w(!0)},[w]),k=m.useCallback(()=>{window.clearTimeout(g.current),g.current=0,w(!1)},[w]),T=m.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{v.current=!0,w(!0),g.current=0},y)},[y,w]);m.useEffect(()=>()=>{g.current&&(window.clearTimeout(g.current),g.current=0)},[]);const C=h??b;return o.jsx(ile,{...u,children:o.jsx(R7e,{scope:t,contentId:C,setContentId:p,open:x,stateAttribute:S,trigger:d,onTriggerChange:f,onTriggerEnter:m.useCallback(()=>{c.isOpenDelayedRef.current?T():E()},[c.isOpenDelayedRef,T,E]),onTriggerLeave:m.useCallback(()=>{O?k():(window.clearTimeout(g.current),g.current=0)},[k,O]),onOpen:E,onClose:k,disableHoverableContent:O,children:n})})},"Tooltip"),hV="TooltipTrigger",D7e=m.forwardRef(Gs(function(t,n){const{__scopeTooltip:r,...i}=t,s=fw(hV,r),a=T$(hV,r),l=k$(r),c=m.useRef(null),u=Ci(n,c,s.onTriggerChange),d=m.useRef(!1),f=m.useRef(!1),h=m.useCallback(()=>d.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),o.jsx(sle,{asChild:!0,...l,children:o.jsx(Qi.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...i,ref:u,onPointerMove:Mr(t.onPointerMove,p=>{p.pointerType!=="touch"&&!f.current&&!a.isPointerInTransitRef.current&&(s.onTriggerEnter(),f.current=!0)}),onPointerLeave:Mr(t.onPointerLeave,()=>{s.onTriggerLeave(),f.current=!1}),onPointerDown:Mr(t.onPointerDown,()=>{s.open&&s.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Mr(t.onFocus,()=>{d.current||s.onOpen()}),onBlur:Mr(t.onBlur,s.onClose),onClick:Mr(t.onClick,s.onClose)})})},"TooltipTrigger")),Lle="TooltipPortal",[P7e,M7e]=E$(Lle,{forceMount:void 0}),L7e=Gs(e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,s=fw(Lle,t);return o.jsx(P7e,{scope:t,forceMount:n,children:o.jsx(EO,{present:n||s.open,children:o.jsx(Noe,{asChild:!0,container:i,children:r})})})},"TooltipPortal"),Gx="TooltipContent",$7e=m.forwardRef(Gs(function(t,n){const r=M7e(Gx,t.__scopeTooltip),{forceMount:i=r.forceMount,side:s="top",...a}=t,l=fw(Gx,t.__scopeTooltip);return o.jsx(EO,{present:i||l.open,children:l.disableHoverableContent?o.jsx($le,{side:s,...a,ref:n}):o.jsx(B7e,{side:s,...a,ref:n})})},"TooltipContent")),B7e=m.forwardRef(Gs(function(t,n){const r=fw(Gx,t.__scopeTooltip),i=T$(Gx,t.__scopeTooltip),s=m.useRef(null),a=Ci(n,s),[l,c]=m.useState(null),{trigger:u,onClose:d}=r,f=s.current,{onPointerInTransitChange:h}=i,p=m.useCallback(()=>{c(null),h(!1)},[h]),b=m.useCallback((g,O)=>{const y=g.currentTarget,v={x:g.clientX,y:g.clientY},x=Ble(v,y.getBoundingClientRect()),w=Qle(v,x),S=Fle(O.getBoundingClientRect()),E=zle([...w,...S]);c(E),h(!0)},[h]);return m.useEffect(()=>()=>p(),[p]),m.useEffect(()=>{if(u&&f){const g=Gs(y=>b(y,f),"handleTriggerLeave"),O=Gs(y=>b(y,u),"handleContentLeave");return u.addEventListener("pointerleave",g),f.addEventListener("pointerleave",O),()=>{u.removeEventListener("pointerleave",g),f.removeEventListener("pointerleave",O)}}},[u,f,b,p]),m.useEffect(()=>{if(l){const g=Gs(O=>{const y=O.target,v={x:O.clientX,y:O.clientY},x=(u==null?void 0:u.contains(y))||(f==null?void 0:f.contains(y)),w=!Ule(v,l);x?p():w&&(p(),d())},"handleTrackPointerGrace");return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[u,f,l,d,p]),o.jsx($le,{...t,ref:a})},"TooltipContentHoverable")),Q7e=Kae("TooltipContent"),$le=m.forwardRef(Gs(function(t,n){const{__scopeTooltip:r,children:i,"aria-label":s,id:a,onEscapeKeyDown:l,onPointerDownOutside:c,...u}=t,d=fw(Gx,r),f=k$(r),{onClose:h}=d;m.useEffect(()=>(document.addEventListener(oM,h),()=>document.removeEventListener(oM,h)),[h]),m.useEffect(()=>{if(d.trigger){const b=Gs(g=>{g.target instanceof Node&&g.target.contains(d.trigger)&&h()},"handleScroll");return window.addEventListener("scroll",b,{capture:!0}),()=>window.removeEventListener("scroll",b,{capture:!0})}},[d.trigger,h]);const{setContentId:p}=d;return Ql(()=>(p(a),()=>{p(void 0)}),[a,p]),o.jsx(voe,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:b=>b.preventDefault(),onDismiss:h,children:o.jsxs(ale,{"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(Q7e,{children:i}),s?o.jsx(k6e,{id:d.contentId,role:"tooltip",children:s}):null]})})},"TooltipContentImpl"));function Ble(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")}}Gs(Ble,"getExitSideFromRect");function Qle(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}Gs(Qle,"getPaddedExitPoints");function Fle(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}]}Gs(Fle,"getPointsFromRect");function Ule(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}Gs(Ule,"isPointInPolygon");function zle(e){const t=e.slice();return t.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),Vle(t)}Gs(zle,"getHull");function Vle(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)}Gs(Vle,"getHullPresorted");var F7e=j7e,U7e=I7e,qle=D7e,z7e=L7e,V7e=$7e;function j2(e){const t=m.useRef(e);return t.current=e,t}let Mb=[],aE=!1;const pV=e=>{var t,n;if(e.key==="Escape"){const[r]=Mb;r&&(e.preventDefault(),(n=(t=r.callback).current)==null||n.call(t))}},Hle=()=>{Mb.length>0&&!aE?(document.body.addEventListener("keydown",pV),aE=!0):Mb.length===0&&aE&&(document.body.removeEventListener("keydown",pV),aE=!1)},q7e=e=>{Mb.unshift(e),Hle()},H7e=({id:e})=>{Mb=Mb.filter(t=>t.id!==e),Hle()},_$=(e,t)=>{const n=m.useId(),r=j2(t);m.useEffect(()=>{if(!e)return;const i={id:n,callback:r};return q7e(i),()=>H7e(i)},[n,e,r])},X7e="_Tooltip_16g2y_1",G7e="_TriggerDecorator_16g2y_73",Xle={Tooltip:X7e,TriggerDecorator:G7e},il=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:p=5,gutterSize:b="md",contentClassName:g,onPointerDown:O,onClick:y,...v}=e,[x,w]=m.useState(!1),[S,E]=m.useState(!1);Z6(()=>E(!1),S?400:null);const k=i??x,T=N=>{typeof i!="boolean"&&(w(N),u&&E(N))},C=N=>{u&&S&&(N.preventDefault(),N.stopPropagation())};return o.jsxs(Gle,{open:k,delayDuration:a,onOpenChange:T,disableHoverableContent:!l,children:[o.jsx(qle,{asChild:!0,children:o.jsx(Wae,{...v,ref:t,onPointerDown:N=>{C(N),O==null||O(N)},onClick:N=>{C(N),y==null||y(N)},children:n})}),o.jsx(Yle,{maxWidth:s,compact:c,align:d,alignOffset:f,side:h,sideOffset:p,gutterSize:b,className:g,children:r})]})},Gle=({children:e,open:t,onOpenChange:n,...r})=>(_$(t,()=>{n(!1)}),o.jsx(F7e,{children:o.jsx(U7e,{open:t,onOpenChange:n,...r,children:e})})),Yle=({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(z7e,{children:o.jsx(V7e,{...u,className:zr(Xle.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:fm,children:e})}),Y7e=({children:e,asChild:t=!0,...n})=>o.jsx(qle,{asChild:t,...n,children:e}),W7e=e=>{const{children:t,className:n,focusable:r=!0,ref:i,...s}=e,a=typeof t=="string";return o.jsx(Wae,{ref:i,...s,className:zr(Xle.TriggerDecorator,n),tabIndex:r?0:void 0,children:a?o.jsx("span",{children:t}):t})};il.Root=Gle;il.Content=Yle;il.Trigger=Y7e;il.TriggerDecorator=W7e;const Wle="KNOWLEDGE_PROVIDER_ASSOCIATION_INVALID";class tC extends Error{constructor(n,r,i={}){super(n);Hi(this,"status");Hi(this,"errorCode");Hi(this,"requestId");Hi(this,"diagnostics");Hi(this,"detail");Hi(this,"payload");Hi(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 Zle extends Error{constructor(n){super(n.map(({region:r,error:i})=>`${r}: ${i.message||"读取知识库失败"}`).join(` +`));Hi(this,"failures");this.name="KnowledgeRegionAggregateError",this.failures=n}}const Z7e=new Set(["ak","apikey","sk","accesskey","accesskeyid","authorization","authkey","clientsecret","cookie","credential","credentials","password","passwd","privatekey","secret","secretaccesskey","secretkey","securitytoken","sessiontoken","setcookie","token"]),K7e=6,mV=50,Kle=4e3;function J7e(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function eBe(e){const t=J7e(e);return Z7e.has(t)||t.endsWith("password")||t.endsWith("secret")||t.endsWith("token")||t.endsWith("credential")}function tBe(e){return/<\s*(?:!doctype|html|head|body|script|style)\b/i.test(e)}function i1(e){return tBe(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 cM(e,t=0,n=new WeakSet){if(e===null||typeof e=="number"||typeof e=="boolean")return e;if(typeof e=="string")return i1(e).slice(0,Kle);if(typeof e!="object")return;if(t>=K7e)return"[内容过深,已截断]";if(n.has(e))return"[循环引用]";if(n.add(e),Array.isArray(e))return e.slice(0,mV).map(i=>cM(i,t+1,n));const r={};return Object.entries(e).slice(0,mV).forEach(([i,s])=>{r[i]=eBe(i)?"[已脱敏]":cM(s,t+1,n)}),r}function gV(e){if(e===void 0)return"";const t=cM(e);if(typeof t=="string")return t;if(t===void 0)return"";try{return JSON.stringify(t).slice(0,Kle)}catch{return"[诊断信息无法显示]"}}function Ea(e,t){if(e instanceof Zle)return e.failures.map(({region:a,error:l})=>`${a} ${Ea(l,t)}`).join(` -`);if(!(e instanceof JA))return(e instanceof Error?r1(e.message):"")||t;const n=r1(e.message)||t,r=[Number.isFinite(e.status)?`状态码:${e.status}`:"",e.errorCode?`错误码:${r1(e.errorCode)}`:"",e.requestId?`请求 ID:${r1(e.requestId)}`:""].filter(Boolean).join(" · "),i=pV(e.diagnostics),s=pV(e.detail);return[n,r,i?`诊断:${i}`:"",s&&s!==n?`详情:${s}`:""].filter(Boolean).join(` -`)}function Fk(...e){for(const t of e)if(typeof t=="string"&&t.trim())return t.trim();return""}function eBe(e){return Array.isArray(e)?e.map(t=>{const n=Vl(t),r=Fk(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 tBe(e,t=!0){const n=Vl(e),r=Object.prototype.hasOwnProperty.call(n,"detail")?n.detail:typeof e=="string"?e:void 0,i=Vl(r);return{message:typeof r=="string"?t?r.trim():"":Fk(i.message,n.message,eBe(r)),errorCode:Fk(i.errorCode,n.errorCode),requestId:Fk(i.requestId,i.request_id,i.RequestId,n.requestId,n.request_id),diagnostics:i.diagnostics??n.diagnostics,detail:r,payload:e}}function Vl(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function hr(e){return typeof e=="string"?e:""}function Gx(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function T$(e){const t=Vl(e);return{id:hr(t.id),name:hr(t.name),description:hr(t.description),providerType:hr(t.providerType),providerKnowledgeId:hr(t.providerKnowledgeId),projectName:hr(t.projectName),region:hr(t.region),status:hr(t.status),createdAt:hr(t.createdAt),updatedAt:hr(t.updatedAt),ownerId:hr(t.ownerId),ownerLabel:hr(t.ownerLabel),canManage:t.canManage===!0}}function fw(e){const t=Vl(e);return{id:hr(t.id),name:hr(t.name),type:hr(t.type),sizeBytes:Gx(t.sizeBytes,0),status:hr(t.status),url:hr(t.url),tosPath:hr(t.tosPath),metadata:Vl(t.metadata),createdAt:hr(t.createdAt),updatedAt:hr(t.updatedAt),sourceMarkdown:hr(t.sourceMarkdown)}}function nBe(e){const t=Vl(e),n=t.attachment,r=Vl(n);return{id:hr(t.id),title:hr(t.title),content:hr(t.content),attachmentUrl:hr(t.attachmentUrl)||hr(r.url)||hr(r.previewUrl),attachmentType:hr(t.attachmentType)||hr(r.type)||hr(r.mimeType),attachment:n,tableFields:t.tableFields}}async function Rc(e,t={},n=So){var f;const r=Kh(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:Eo(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=tBe(a,l||c.startsWith("text/plain")),d=i.status===401?"请先登录后再访问知识库":i.status===403?"你没有权限操作这个知识库":i.status===404?"知识库或知识内容不存在":i.status===409?"知识库当前状态不允许执行此操作":`知识库请求失败 (${i.status})`;throw new JA(u.message||d,i.status,{errorCode:u.errorCode,requestId:u.requestId,diagnostics:u.diagnostics,detail:u.detail,payload:u.payload,rawBody:s})}function Ym(e){const t=new URLSearchParams;e.trim()&&t.set("region",e.trim());const n=t.toString();return n?`?${n}`:""}async function rBe(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 Rc(`/web/knowledge-bases?${t.toString()}`,{signal:e.signal}),r=Vl(n);return{items:Array.isArray(r.items)?r.items.map(T$):[],nextToken:hr(r.nextToken)}}function iBe(e){return`${e.region}\0${e.id}`}async function sBe(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 rBe({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 p=h.region?h:{...h,region:d};a.set(iBe(p),p)})}),i.length===n.length)throw new Yle(i);return{items:[...a.values()],nextTokens:s,failures:i}}function aBe(e){return Rc("/web/knowledge-bases",{method:"POST",body:JSON.stringify(e)},Ni).then(T$)}function oBe(e,t,n){return Rc(`/web/knowledge-bases/${encodeURIComponent(e)}${Ym(t)}`,{method:"PATCH",body:JSON.stringify(n)}).then(T$)}function lBe(e,t){return Rc(`/web/knowledge-bases/${encodeURIComponent(e)}${Ym(t)}`,{method:"DELETE"},Ni)}async function cBe(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 Rc(`/web/knowledge-bases/${encodeURIComponent(e)}/documents?${n.toString()}`,{signal:t.signal}),i=Vl(r);return{items:Array.isArray(i.items)?i.items.map(fw):[],offset:Gx(i.offset,0),limit:Gx(i.limit,t.limit??30),hasMore:i.hasMore===!0}}async function uBe(e,t,n){const r=new URLSearchParams({region:n.region,offset:String(n.offset??0),limit:String(n.limit??20)}),i=await Rc(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/${encodeURIComponent(t)}/preview?${r.toString()}`,{signal:n.signal}),s=Vl(i);return{document:fw(s.document),chunks:Array.isArray(s.chunks)?s.chunks.map(nBe):[],sourceMarkdown:hr(s.sourceMarkdown),offset:Gx(s.offset,0),limit:Gx(s.limit,n.limit??20),hasMore:s.hasMore===!0}}function dBe(e,t,n){return Rc(`/web/knowledge-bases/${encodeURIComponent(e)}/documents${Ym(t)}`,{method:"POST",body:JSON.stringify(n)},Ni).then(fw)}async function fBe(e,t,n){const r=await Rc(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/web-preview${Ym(t)}`,{method:"POST",body:JSON.stringify({sourceType:"url",url:n.url})},Ni),i=Vl(r);return{name:hr(i.name),url:hr(i.url),sourceMarkdown:hr(i.sourceMarkdown)}}function hBe(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)),Rc(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/upload${Ym(t)}`,{method:"POST",body:r},Ni).then(fw)}function pBe(e,t,n,r){return Rc(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/${encodeURIComponent(t)}${Ym(n)}`,{method:"PATCH",body:JSON.stringify(r)}).then(fw)}function mBe(e,t,n){return Rc(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/${encodeURIComponent(t)}${Ym(n)}`,{method:"DELETE"},Ni)}function gBe({secondaryAction:e,primaryAction:t,menuLabel:n,menuAriaLabel:r,menuActions:i}){return o.jsxs("footer",{className:"library-resource-card__actions",children:[o.jsx("button",{type:"button",className:"library-resource-card__action library-resource-card__action--secondary",disabled:e.disabled,title:e.title,onClick:e.onClick,children:e.label}),o.jsx("button",{type:"button",className:"library-resource-card__action library-resource-card__action--primary",disabled:t.disabled,title:t.title,onClick:t.onClick,children:t.label}),o.jsx(Iae,{label:n,menuLabel:r,className:"library-resource-card__action library-resource-card__more",placement:"top-end",items:i.map(s=>({label:s.label,onSelect:s.onClick,disabled:s.disabled,danger:s.danger,title:s.title}))})]})}function Zle({className:e="",title:t,status:n,description:r,metadata:i,secondaryAction:s,primaryAction:a,menuLabel:l,menuAriaLabel:c,menuActions:u}){return o.jsxs("article",{className:`my-agent-card library-resource-card ${e}`.trim(),children:[o.jsxs("div",{className:"my-agent-card-content",children:[o.jsxs("div",{className:"my-agent-card-title",children:[o.jsx("div",{className:"my-agent-card-title-copy",children:o.jsx("h3",{title:t,children:t})}),n]}),o.jsx("p",{className:"my-agent-description",title:r,children:r}),o.jsx("dl",{className:"my-agent-meta",children:i.map((d,f)=>o.jsxs("div",{className:f===0?"my-agent-created-at":"my-agent-region",children:[o.jsx("dt",{children:d.label}),o.jsx("dd",{title:d.title,children:d.value})]},`${d.label}:${f}`))})]}),o.jsx(gBe,{secondaryAction:s,primaryAction:a,menuLabel:l,menuAriaLabel:c,menuActions:u})]})}function RTt(){}function mV(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 Kle(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const bBe=/[$_\p{ID_Start}]/u,OBe=/[$_\u{200C}\u{200D}\p{ID_Continue}]/u,yBe=/[-$_\u{200C}\u{200D}\p{ID_Continue}]/u,xBe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,vBe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Jle={};function ITt(e){return e?bBe.test(String.fromCodePoint(e)):!1}function DTt(e,t){const r=(t||Jle).jsx?yBe:OBe;return e?r.test(String.fromCodePoint(e)):!1}function gV(e,t){return(Jle.jsx?vBe:xBe).test(e)}const wBe=/[ \t\n\f\r]/g;function SBe(e){return typeof e=="object"?e.type==="text"?bV(e.value):!1:bV(e)}function bV(e){return e.replace(wBe,"")===""}let hw=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};hw.prototype.normal={};hw.prototype.property={};hw.prototype.space=void 0;function ece(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new hw(n,r,t)}function Yx(e){return e.toLowerCase()}class ko{constructor(t,n){this.attribute=n,this.property=t}}ko.prototype.attribute="";ko.prototype.booleanish=!1;ko.prototype.boolean=!1;ko.prototype.commaOrSpaceSeparated=!1;ko.prototype.commaSeparated=!1;ko.prototype.defined=!1;ko.prototype.mustUseProperty=!1;ko.prototype.number=!1;ko.prototype.overloadedBoolean=!1;ko.prototype.property="";ko.prototype.spaceSeparated=!1;ko.prototype.space=void 0;let EBe=0;const An=Wm(),gs=Wm(),lM=Wm(),lt=Wm(),li=Wm(),H0=Wm(),Bo=Wm();function Wm(){return 2**++EBe}const cM=Object.freeze(Object.defineProperty({__proto__:null,boolean:An,booleanish:gs,commaOrSpaceSeparated:Bo,commaSeparated:H0,number:lt,overloadedBoolean:lM,spaceSeparated:li},Symbol.toStringTag,{value:"Module"})),ER=Object.keys(cM);class _$ extends ko{constructor(t,n,r,i){let s=-1;if(super(t,n),OV(this,"space",i),typeof r=="number")for(;++s4&&n.slice(0,4)==="data"&&CBe.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(yV,jBe);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!yV.test(s)){let a=s.replace(ABe,NBe);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=_$}return new i(r,t)}function NBe(e){return"-"+e.toLowerCase()}function jBe(e){return e.charAt(1).toUpperCase()}const pw=ece([tce,kBe,ice,sce,ace],"html"),tp=ece([tce,TBe,ice,sce,ace],"svg");function xV(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function oce(e){return e.join(" ").trim()}var A$={},vV=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,RBe=/\n/g,IBe=/^\s*/,DBe=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,PBe=/^:\s*/,MBe=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,LBe=/^[;\s]*/,$Be=/^\s+|\s+$/g,BBe=` -`,wV="/",SV="*",$p="",QBe="comment",FBe="declaration";function UBe(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(b){var g=b.match(RBe);g&&(n+=g.length);var O=b.lastIndexOf(BBe);r=~O?b.length-O:r+b.length}function s(){var b={line:n,column:r};return function(g){return g.position=new a(b),u(),g}}function a(b){this.start=b,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function l(b){var g=new Error(t.source+":"+n+":"+r+": "+b);if(g.reason=b,g.filename=t.source,g.line=n,g.column=r,g.source=e,!t.silent)throw g}function c(b){var g=b.exec(e);if(g){var O=g[0];return i(O),e=e.slice(O.length),g}}function u(){c(IBe)}function d(b){var g;for(b=b||[];g=f();)g!==!1&&b.push(g);return b}function f(){var b=s();if(!(wV!=e.charAt(0)||SV!=e.charAt(1))){for(var g=2;$p!=e.charAt(g)&&(SV!=e.charAt(g)||wV!=e.charAt(g+1));)++g;if(g+=2,$p===e.charAt(g-1))return l("End of comment missing");var O=e.slice(2,g-2);return r+=2,i(O),e=e.slice(g),r+=2,b({type:QBe,comment:O})}}function h(){var b=s(),g=c(DBe);if(g){if(f(),!c(PBe))return l("property missing ':'");var O=c(MBe),y=b({type:FBe,property:EV(g[0].replace(vV,$p)),value:O?EV(O[0].replace(vV,$p)):$p});return c(LBe),y}}function p(){var b=[];d(b);for(var g;g=h();)g!==!1&&(b.push(g),d(b));return b}return u(),p()}function EV(e){return e?e.replace($Be,$p):$p}var zBe=UBe,VBe=Jf&&Jf.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(A$,"__esModule",{value:!0});A$.default=HBe;const qBe=VBe(zBe);function HBe(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,qBe.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 tC={};Object.defineProperty(tC,"__esModule",{value:!0});tC.camelCase=void 0;var XBe=/^--[a-zA-Z0-9_-]+$/,GBe=/-([a-z])/g,YBe=/^[^-]+$/,WBe=/^-(webkit|moz|ms|o|khtml)-/,ZBe=/^-(ms)-/,KBe=function(e){return!e||YBe.test(e)||XBe.test(e)},JBe=function(e,t){return t.toUpperCase()},kV=function(e,t){return"".concat(t,"-")},eQe=function(e,t){return t===void 0&&(t={}),KBe(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(ZBe,kV):e=e.replace(WBe,kV),e.replace(GBe,JBe))};tC.camelCase=eQe;var tQe=Jf&&Jf.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},nQe=tQe(A$),rQe=tC;function uM(e,t){var n={};return!e||typeof e!="string"||(0,nQe.default)(e,function(r,i){r&&i&&(n[(0,rQe.camelCase)(r,t)]=i)}),n}uM.default=uM;var iQe=uM;const sQe=Jb(iQe),nC=lce("end"),Pu=lce("start");function lce(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 aQe(e){const t=Pu(e),n=nC(e);if(t&&n)return{start:t,end:n}}function B1(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?TV(e.position):"start"in e||"end"in e?TV(e):"line"in e||"column"in e?dM(e):""}function dM(e){return _V(e&&e.line)+":"+_V(e&&e.column)}function TV(e){return dM(e&&e.start)+"-"+dM(e&&e.end)}function _V(e){return e&&typeof e=="number"?e:1}class Na 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=B1(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}}Na.prototype.file="";Na.prototype.name="";Na.prototype.reason="";Na.prototype.message="";Na.prototype.stack="";Na.prototype.column=void 0;Na.prototype.line=void 0;Na.prototype.ancestors=void 0;Na.prototype.cause=void 0;Na.prototype.fatal=void 0;Na.prototype.place=void 0;Na.prototype.ruleId=void 0;Na.prototype.source=void 0;const C$={}.hasOwnProperty,oQe=new Map,lQe=/[A-Z]/g,cQe=new Set(["table","tbody","thead","tfoot","tr"]),uQe=new Set(["td","th"]),cce="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function dQe(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=yQe(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=OQe(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"?tp:pw,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=uce(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function uce(e,t,n){if(t.type==="element")return fQe(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return hQe(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return mQe(e,t,n);if(t.type==="mdxjsEsm")return pQe(e,t);if(t.type==="root")return gQe(e,t,n);if(t.type==="text")return bQe(e,t)}function fQe(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=tp,e.schema=i),e.ancestors.push(t);const s=fce(e,t.tagName,!1),a=xQe(e,t);let l=j$(e,t);return cQe.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!SBe(c):!0})),dce(e,a,s,t),N$(a,l),e.ancestors.pop(),e.schema=r,e.create(t,s,a,n)}function hQe(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)}Wx(e,t.position)}function pQe(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Wx(e,t.position)}function mQe(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=tp,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:fce(e,t.name,!0),a=vQe(e,t),l=j$(e,t);return dce(e,a,s,t),N$(a,l),e.ancestors.pop(),e.schema=r,e.create(t,s,a,n)}function gQe(e,t,n){const r={};return N$(r,j$(e,t)),e.create(t,e.Fragment,r,n)}function bQe(e,t){return t.value}function dce(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function N$(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function OQe(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 yQe(e,t){return n;function n(r,i,s,a){const l=Array.isArray(s.children),c=Pu(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 xQe(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&C$.call(t.properties,i)){const s=wQe(e,i,t.properties[i]);if(s){const[a,l]=s;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&uQe.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 vQe(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 Wx(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 Wx(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function j$(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:oQe;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?(sl(e,e.length,0,t),e):t}const NV={}.hasOwnProperty;function pce(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 vc(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ua=np(/[A-Za-z]/),_a=np(/[\dA-Za-z]/),jQe=np(/[#-'*+\--9=?A-Z^-~]/);function N2(e){return e!==null&&(e<32||e===127)}const fM=np(/\d/),RQe=np(/[\dA-Fa-f]/),IQe=np(/[!-/:-@[-`{-~]/);function Zt(e){return e!==null&&e<-2}function ri(e){return e!==null&&(e<0||e===32)}function Wn(e){return e===-2||e===-1||e===32}const rC=np(new RegExp("\\p{P}|\\p{S}","u")),Nm=np(/\s/);function np(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function CO(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 yr(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return a;function a(c){return Wn(c)?(e.enter(n),l(c)):t(c)}function l(c){return Wn(c)&&s++a))return;const k=t.events.length;let T=k,C,N;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(C){N=t.events[T][1].end;break}C=!0}for(y(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 $Qe(e,t,n){return yr(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Mb(e){if(e===null||ri(e)||Nm(e))return 1;if(rC(e))return 2}function iC(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};RV(f,-c),RV(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=kl(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=kl(u,[["enter",i,t],["enter",a,t],["exit",a,t],["enter",s,t]]),u=kl(u,iC(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=kl(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=kl(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,sl(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n0&&Wn(E)?yr(e,v,"linePrefix",s+1)(E):v(E)}function v(E){return E===null||Zt(E)?e.check(IV,g,w)(E):(e.enter("codeFlowValue"),x(E))}function x(E){return E===null||Zt(E)?(e.exit("codeFlowValue"),v(E)):(e.consume(E),x)}function w(E){return e.exit("codeFenced"),t(E)}function S(E,k,T){let C=0;return N;function N(M){return E.enter("lineEnding"),E.consume(M),E.exit("lineEnding"),_}function _(M){return E.enter("codeFencedFence"),Wn(M)?yr(E,R,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):R(M)}function R(M){return M===l?(E.enter("codeFencedFenceSequence"),$(M)):T(M)}function $(M){return M===l?(C++,E.consume(M),$):C>=a?(E.exit("codeFencedFenceSequence"),Wn(M)?yr(E,D,"whitespace")(M):D(M)):T(M)}function D(M){return M===null||Zt(M)?(E.exit("codeFencedFence"),k(M)):T(M)}}}function WQe(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 TR={name:"codeIndented",tokenize:KQe},ZQe={partial:!0,tokenize:JQe};function KQe(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),yr(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):Zt(u)?e.attempt(ZQe,a,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||Zt(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function JQe(e,t,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):Zt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):yr(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):Zt(a)?i(a):n(a)}}const eFe={name:"codeText",previous:nFe,resolve:tFe,tokenize:rFe};function tFe(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&&wy(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),wy(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),wy(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 xce(e,t,n,r,i,s,a,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(y){return y===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(y),e.exit(s),h):y===null||y===32||y===41||N2(y)?n(y):(e.enter(r),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),g(y))}function h(y){return y===62?(e.enter(s),e.consume(y),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(e.exit("chunkString"),e.exit(l),h(y)):y===null||y===60||Zt(y)?n(y):(e.consume(y),y===92?b:p)}function b(y){return y===60||y===62||y===92?(e.consume(y),p):p(y)}function g(y){return!d&&(y===null||y===41||ri(y))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(r),t(y)):d999||p===null||p===91||p===93&&!c||p===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(p):p===93?(e.exit(s),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):Zt(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||Zt(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!Wn(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),l++,f):f(p)}}function wce(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):Zt(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),yr(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===a||h===null||Zt(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 Q1(e,t){let n;return r;function r(i){return Zt(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Wn(i)?yr(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const dFe={name:"definition",tokenize:hFe},fFe={partial:!0,tokenize:pFe};function hFe(e,t,n){const r=this;let i;return s;function s(p){return e.enter("definition"),a(p)}function a(p){return vce.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return i=vc(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),c):n(p)}function c(p){return ri(p)?Q1(e,u)(p):u(p)}function u(p){return xce(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(fFe,f,f)(p)}function f(p){return Wn(p)?yr(e,h,"whitespace")(p):h(p)}function h(p){return p===null||Zt(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function pFe(e,t,n){return r;function r(l){return ri(l)?Q1(e,i)(l):n(l)}function i(l){return wce(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return Wn(l)?yr(e,a,"whitespace")(l):a(l)}function a(l){return l===null||Zt(l)?t(l):n(l)}}const mFe={name:"hardBreakEscape",tokenize:gFe};function gFe(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return Zt(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const bFe={name:"headingAtx",resolve:OFe,tokenize:yFe};function OFe(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"},sl(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function yFe(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||ri(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||Zt(d)?(e.exit("atxHeading"),t(d)):Wn(d)?yr(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||ri(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const xFe=["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"],PV=["pre","script","style","textarea"],vFe={concrete:!0,name:"htmlFlow",resolveTo:EFe,tokenize:kFe},wFe={partial:!0,tokenize:_Fe},SFe={partial:!0,tokenize:TFe};function EFe(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 kFe(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,g):B===63?(e.consume(B),i=3,r.interrupt?t:F):Ua(B)?(e.consume(B),a=String.fromCharCode(B),O):n(B)}function h(B){return B===45?(e.consume(B),i=2,p):B===91?(e.consume(B),i=5,l=0,b):Ua(B)?(e.consume(B),i=4,r.interrupt?t:F):n(B)}function p(B){return B===45?(e.consume(B),r.interrupt?t:F):n(B)}function b(B){const V="CDATA[";return B===V.charCodeAt(l++)?(e.consume(B),l===V.length?r.interrupt?t:R:b):n(B)}function g(B){return Ua(B)?(e.consume(B),a=String.fromCharCode(B),O):n(B)}function O(B){if(B===null||B===47||B===62||ri(B)){const V=B===47,ce=a.toLowerCase();return!V&&!s&&PV.includes(ce)?(i=1,r.interrupt?t(B):R(B)):xFe.includes(a.toLowerCase())?(i=6,V?(e.consume(B),y):r.interrupt?t(B):R(B)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(B):s?v(B):x(B))}return B===45||_a(B)?(e.consume(B),a+=String.fromCharCode(B),O):n(B)}function y(B){return B===62?(e.consume(B),r.interrupt?t:R):n(B)}function v(B){return Wn(B)?(e.consume(B),v):N(B)}function x(B){return B===47?(e.consume(B),N):B===58||B===95||Ua(B)?(e.consume(B),w):Wn(B)?(e.consume(B),x):N(B)}function w(B){return B===45||B===46||B===58||B===95||_a(B)?(e.consume(B),w):S(B)}function S(B){return B===61?(e.consume(B),E):Wn(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):Wn(B)?(e.consume(B),E):T(B)}function k(B){return B===c?(e.consume(B),c=null,C):B===null||Zt(B)?n(B):(e.consume(B),k)}function T(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||ri(B)?S(B):(e.consume(B),T)}function C(B){return B===47||B===62||Wn(B)?x(B):n(B)}function N(B){return B===62?(e.consume(B),_):n(B)}function _(B){return B===null||Zt(B)?R(B):Wn(B)?(e.consume(B),_):n(B)}function R(B){return B===45&&i===2?(e.consume(B),j):B===60&&i===1?(e.consume(B),P):B===62&&i===4?(e.consume(B),q):B===63&&i===3?(e.consume(B),F):B===93&&i===5?(e.consume(B),U):Zt(B)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(wFe,z,$)(B)):B===null||Zt(B)?(e.exit("htmlFlowData"),$(B)):(e.consume(B),R)}function $(B){return e.check(SFe,D,z)(B)}function D(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),M}function M(B){return B===null||Zt(B)?$(B):(e.enter("htmlFlowData"),R(B))}function j(B){return B===45?(e.consume(B),F):R(B)}function P(B){return B===47?(e.consume(B),a="",L):R(B)}function L(B){if(B===62){const V=a.toLowerCase();return PV.includes(V)?(e.consume(B),q):R(B)}return Ua(B)&&a.length<8?(e.consume(B),a+=String.fromCharCode(B),L):R(B)}function U(B){return B===93?(e.consume(B),F):R(B)}function F(B){return B===62?(e.consume(B),q):B===45&&i===2?(e.consume(B),F):R(B)}function q(B){return B===null||Zt(B)?(e.exit("htmlFlowData"),z(B)):(e.consume(B),q)}function z(B){return e.exit("htmlFlow"),t(B)}}function TFe(e,t,n){const r=this;return i;function i(a){return Zt(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 _Fe(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(mw,t,n)}}const AFe={name:"htmlText",tokenize:CFe};function CFe(e,t,n){const r=this;let i,s,a;return l;function l(F){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(F),c}function c(F){return F===33?(e.consume(F),u):F===47?(e.consume(F),S):F===63?(e.consume(F),x):Ua(F)?(e.consume(F),T):n(F)}function u(F){return F===45?(e.consume(F),d):F===91?(e.consume(F),s=0,b):Ua(F)?(e.consume(F),v):n(F)}function d(F){return F===45?(e.consume(F),p):n(F)}function f(F){return F===null?n(F):F===45?(e.consume(F),h):Zt(F)?(a=f,P(F)):(e.consume(F),f)}function h(F){return F===45?(e.consume(F),p):f(F)}function p(F){return F===62?j(F):F===45?h(F):f(F)}function b(F){const q="CDATA[";return F===q.charCodeAt(s++)?(e.consume(F),s===q.length?g:b):n(F)}function g(F){return F===null?n(F):F===93?(e.consume(F),O):Zt(F)?(a=g,P(F)):(e.consume(F),g)}function O(F){return F===93?(e.consume(F),y):g(F)}function y(F){return F===62?j(F):F===93?(e.consume(F),y):g(F)}function v(F){return F===null||F===62?j(F):Zt(F)?(a=v,P(F)):(e.consume(F),v)}function x(F){return F===null?n(F):F===63?(e.consume(F),w):Zt(F)?(a=x,P(F)):(e.consume(F),x)}function w(F){return F===62?j(F):x(F)}function S(F){return Ua(F)?(e.consume(F),E):n(F)}function E(F){return F===45||_a(F)?(e.consume(F),E):k(F)}function k(F){return Zt(F)?(a=k,P(F)):Wn(F)?(e.consume(F),k):j(F)}function T(F){return F===45||_a(F)?(e.consume(F),T):F===47||F===62||ri(F)?C(F):n(F)}function C(F){return F===47?(e.consume(F),j):F===58||F===95||Ua(F)?(e.consume(F),N):Zt(F)?(a=C,P(F)):Wn(F)?(e.consume(F),C):j(F)}function N(F){return F===45||F===46||F===58||F===95||_a(F)?(e.consume(F),N):_(F)}function _(F){return F===61?(e.consume(F),R):Zt(F)?(a=_,P(F)):Wn(F)?(e.consume(F),_):C(F)}function R(F){return F===null||F===60||F===61||F===62||F===96?n(F):F===34||F===39?(e.consume(F),i=F,$):Zt(F)?(a=R,P(F)):Wn(F)?(e.consume(F),R):(e.consume(F),D)}function $(F){return F===i?(e.consume(F),i=void 0,M):F===null?n(F):Zt(F)?(a=$,P(F)):(e.consume(F),$)}function D(F){return F===null||F===34||F===39||F===60||F===61||F===96?n(F):F===47||F===62||ri(F)?C(F):(e.consume(F),D)}function M(F){return F===47||F===62||ri(F)?C(F):n(F)}function j(F){return F===62?(e.consume(F),e.exit("htmlTextData"),e.exit("htmlText"),t):n(F)}function P(F){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),L}function L(F){return Wn(F)?yr(e,U,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):U(F)}function U(F){return e.enter("htmlTextData"),a(F)}}const D$={name:"labelEnd",resolveAll:IFe,resolveTo:DFe,tokenize:PFe},NFe={tokenize:MFe},jFe={tokenize:LFe},RFe={tokenize:$Fe};function IFe(e){let t=-1;const n=[];for(;++t=3&&(u===null||Zt(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===i?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),Wn(u)?yr(e,l,"whitespace")(u):l(u))}}const io={continuation:{tokenize:GFe},exit:WFe,name:"list",tokenize:XFe},qFe={partial:!0,tokenize:ZFe},HFe={partial:!0,tokenize:YFe};function XFe(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(p){const b=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:fM(p)){if(r.containerState.type||(r.containerState.type=b,e.enter(b,{_container:!0})),b==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Uk,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return fM(p)&&++a<10?(e.consume(p),c):(!r.interrupt||a<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(mw,r.interrupt?n:d,e.attempt(qFe,h,f))}function d(p){return r.containerState.initialBlankLine=!0,s++,h(p)}function f(p){return Wn(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function GFe(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(mw,i,s);function i(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,yr(e,t,"listItemIndent",r.containerState.size+1)(l)}function s(l){return r.containerState.furtherBlankLines||!Wn(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(HFe,t,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,yr(e,e.attempt(io,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function YFe(e,t,n){const r=this;return yr(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 WFe(e){e.exit(this.containerState.type)}function ZFe(e,t,n){const r=this;return yr(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!Wn(s)&&a&&a[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const MV={name:"setextUnderline",resolveTo:KFe,tokenize:JFe};function KFe(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 JFe(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"),Wn(u)?yr(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||Zt(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const eUe={tokenize:tUe};function tUe(e){const t=this,n=e.attempt(mw,r,e.attempt(this.parser.constructs.flowInitial,i,yr(e,e.attempt(this.parser.constructs.flow,i,e.attempt(aFe,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 nUe={resolveAll:Ece()},rUe=Sce("string"),iUe=Sce("text");function Sce(e){return{resolveAll:Ece(e==="text"?sUe: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 OUe(e,t){let n=-1;const r=[];let i;for(;++n{const n=Vl(t),r=zk(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 rBe(e,t=!0){const n=Vl(e),r=Object.prototype.hasOwnProperty.call(n,"detail")?n.detail:typeof e=="string"?e:void 0,i=Vl(r);return{message:typeof r=="string"?t?r.trim():"":zk(i.message,n.message,nBe(r)),errorCode:zk(i.errorCode,n.errorCode),requestId:zk(i.requestId,i.request_id,i.RequestId,n.requestId,n.request_id),diagnostics:i.diagnostics??n.diagnostics,detail:r,payload:e}}function Vl(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function pr(e){return typeof e=="string"?e:""}function Yx(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function A$(e){const t=Vl(e);return{id:pr(t.id),name:pr(t.name),description:pr(t.description),providerType:pr(t.providerType),providerKnowledgeId:pr(t.providerKnowledgeId),projectName:pr(t.projectName),region:pr(t.region),status:pr(t.status),createdAt:pr(t.createdAt),updatedAt:pr(t.updatedAt),ownerId:pr(t.ownerId),ownerLabel:pr(t.ownerLabel),canManage:t.canManage===!0}}function hw(e){const t=Vl(e);return{id:pr(t.id),name:pr(t.name),type:pr(t.type),sizeBytes:Yx(t.sizeBytes,0),status:pr(t.status),url:pr(t.url),tosPath:pr(t.tosPath),metadata:Vl(t.metadata),createdAt:pr(t.createdAt),updatedAt:pr(t.updatedAt),sourceMarkdown:pr(t.sourceMarkdown)}}function iBe(e){const t=Vl(e),n=t.attachment,r=Vl(n);return{id:pr(t.id),title:pr(t.title),content:pr(t.content),attachmentUrl:pr(t.attachmentUrl)||pr(r.url)||pr(r.previewUrl),attachmentType:pr(t.attachmentType)||pr(r.type)||pr(r.mimeType),attachment:n,tableFields:t.tableFields}}async function Rc(e,t={},n=So){var f;const r=Kh(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:Eo(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=rBe(a,l||c.startsWith("text/plain")),d=i.status===401?"请先登录后再访问知识库":i.status===403?"你没有权限操作这个知识库":i.status===404?"知识库或知识内容不存在":i.status===409?"知识库当前状态不允许执行此操作":`知识库请求失败 (${i.status})`;throw new tC(u.message||d,i.status,{errorCode:u.errorCode,requestId:u.requestId,diagnostics:u.diagnostics,detail:u.detail,payload:u.payload,rawBody:s})}function Wm(e){const t=new URLSearchParams;e.trim()&&t.set("region",e.trim());const n=t.toString();return n?`?${n}`:""}async function sBe(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 Rc(`/web/knowledge-bases?${t.toString()}`,{signal:e.signal}),r=Vl(n);return{items:Array.isArray(r.items)?r.items.map(A$):[],nextToken:pr(r.nextToken)}}function aBe(e){return`${e.region}\0${e.id}`}async function oBe(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 sBe({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 p=h.region?h:{...h,region:d};a.set(aBe(p),p)})}),i.length===n.length)throw new Zle(i);return{items:[...a.values()],nextTokens:s,failures:i}}function lBe(e){return Rc("/web/knowledge-bases",{method:"POST",body:JSON.stringify(e)},Ni).then(A$)}function cBe(e,t,n){return Rc(`/web/knowledge-bases/${encodeURIComponent(e)}${Wm(t)}`,{method:"PATCH",body:JSON.stringify(n)}).then(A$)}function uBe(e,t){return Rc(`/web/knowledge-bases/${encodeURIComponent(e)}${Wm(t)}`,{method:"DELETE"},Ni)}async function dBe(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 Rc(`/web/knowledge-bases/${encodeURIComponent(e)}/documents?${n.toString()}`,{signal:t.signal}),i=Vl(r);return{items:Array.isArray(i.items)?i.items.map(hw):[],offset:Yx(i.offset,0),limit:Yx(i.limit,t.limit??30),hasMore:i.hasMore===!0}}async function fBe(e,t,n){const r=new URLSearchParams({region:n.region,offset:String(n.offset??0),limit:String(n.limit??20)}),i=await Rc(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/${encodeURIComponent(t)}/preview?${r.toString()}`,{signal:n.signal}),s=Vl(i);return{document:hw(s.document),chunks:Array.isArray(s.chunks)?s.chunks.map(iBe):[],sourceMarkdown:pr(s.sourceMarkdown),offset:Yx(s.offset,0),limit:Yx(s.limit,n.limit??20),hasMore:s.hasMore===!0}}function hBe(e,t,n){return Rc(`/web/knowledge-bases/${encodeURIComponent(e)}/documents${Wm(t)}`,{method:"POST",body:JSON.stringify(n)},Ni).then(hw)}async function pBe(e,t,n){const r=await Rc(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/web-preview${Wm(t)}`,{method:"POST",body:JSON.stringify({sourceType:"url",url:n.url})},Ni),i=Vl(r);return{name:pr(i.name),url:pr(i.url),sourceMarkdown:pr(i.sourceMarkdown)}}function mBe(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)),Rc(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/upload${Wm(t)}`,{method:"POST",body:r},Ni).then(hw)}function gBe(e,t,n,r){return Rc(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/${encodeURIComponent(t)}${Wm(n)}`,{method:"PATCH",body:JSON.stringify(r)}).then(hw)}function bBe(e,t,n){return Rc(`/web/knowledge-bases/${encodeURIComponent(e)}/documents/${encodeURIComponent(t)}${Wm(n)}`,{method:"DELETE"},Ni)}function OBe({secondaryAction:e,primaryAction:t,menuLabel:n,menuAriaLabel:r,menuActions:i}){return o.jsxs("footer",{className:"library-resource-card__actions",children:[o.jsx("button",{type:"button",className:"library-resource-card__action library-resource-card__action--secondary",disabled:e.disabled,title:e.title,onClick:e.onClick,children:e.label}),o.jsx("button",{type:"button",className:"library-resource-card__action library-resource-card__action--primary",disabled:t.disabled,title:t.title,onClick:t.onClick,children:t.label}),o.jsx(Pae,{label:n,menuLabel:r,className:"library-resource-card__action library-resource-card__more",placement:"top-end",items:i.map(s=>({label:s.label,onSelect:s.onClick,disabled:s.disabled,danger:s.danger,title:s.title}))})]})}function Jle({className:e="",title:t,status:n,description:r,metadata:i,secondaryAction:s,primaryAction:a,menuLabel:l,menuAriaLabel:c,menuActions:u}){return o.jsxs("article",{className:`my-agent-card library-resource-card ${e}`.trim(),children:[o.jsxs("div",{className:"my-agent-card-content",children:[o.jsxs("div",{className:"my-agent-card-title",children:[o.jsx("div",{className:"my-agent-card-title-copy",children:o.jsx("h3",{title:t,children:t})}),n]}),o.jsx("p",{className:"my-agent-description",title:r,children:r}),o.jsx("dl",{className:"my-agent-meta",children:i.map((d,f)=>o.jsxs("div",{className:f===0?"my-agent-created-at":"my-agent-region",children:[o.jsx("dt",{children:d.label}),o.jsx("dd",{title:d.title,children:d.value})]},`${d.label}:${f}`))})]}),o.jsx(OBe,{secondaryAction:s,primaryAction:a,menuLabel:l,menuAriaLabel:c,menuActions:u})]})}function $Tt(){}function bV(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 ece(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const yBe=/[$_\p{ID_Start}]/u,xBe=/[$_\u{200C}\u{200D}\p{ID_Continue}]/u,vBe=/[-$_\u{200C}\u{200D}\p{ID_Continue}]/u,wBe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,SBe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,tce={};function BTt(e){return e?yBe.test(String.fromCodePoint(e)):!1}function QTt(e,t){const r=(t||tce).jsx?vBe:xBe;return e?r.test(String.fromCodePoint(e)):!1}function OV(e,t){return(tce.jsx?SBe:wBe).test(e)}const EBe=/[ \t\n\f\r]/g;function kBe(e){return typeof e=="object"?e.type==="text"?yV(e.value):!1:yV(e)}function yV(e){return e.replace(EBe,"")===""}let pw=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};pw.prototype.normal={};pw.prototype.property={};pw.prototype.space=void 0;function nce(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new pw(n,r,t)}function Wx(e){return e.toLowerCase()}class ko{constructor(t,n){this.attribute=n,this.property=t}}ko.prototype.attribute="";ko.prototype.booleanish=!1;ko.prototype.boolean=!1;ko.prototype.commaOrSpaceSeparated=!1;ko.prototype.commaSeparated=!1;ko.prototype.defined=!1;ko.prototype.mustUseProperty=!1;ko.prototype.number=!1;ko.prototype.overloadedBoolean=!1;ko.prototype.property="";ko.prototype.spaceSeparated=!1;ko.prototype.space=void 0;let TBe=0;const An=Zm(),gs=Zm(),uM=Zm(),lt=Zm(),li=Zm(),X0=Zm(),Bo=Zm();function Zm(){return 2**++TBe}const dM=Object.freeze(Object.defineProperty({__proto__:null,boolean:An,booleanish:gs,commaOrSpaceSeparated:Bo,commaSeparated:X0,number:lt,overloadedBoolean:uM,spaceSeparated:li},Symbol.toStringTag,{value:"Module"})),TR=Object.keys(dM);class C$ extends ko{constructor(t,n,r,i){let s=-1;if(super(t,n),xV(this,"space",i),typeof r=="number")for(;++s4&&n.slice(0,4)==="data"&&jBe.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(vV,IBe);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!vV.test(s)){let a=s.replace(NBe,RBe);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}i=C$}return new i(r,t)}function RBe(e){return"-"+e.toLowerCase()}function IBe(e){return e.charAt(1).toUpperCase()}const mw=nce([rce,_Be,ace,oce,lce],"html"),tp=nce([rce,ABe,ace,oce,lce],"svg");function wV(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function cce(e){return e.join(" ").trim()}var N$={},SV=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,DBe=/\n/g,PBe=/^\s*/,MBe=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,LBe=/^:\s*/,$Be=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,BBe=/^[;\s]*/,QBe=/^\s+|\s+$/g,FBe=` +`,EV="/",kV="*",Bp="",UBe="comment",zBe="declaration";function VBe(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(b){var g=b.match(DBe);g&&(n+=g.length);var O=b.lastIndexOf(FBe);r=~O?b.length-O:r+b.length}function s(){var b={line:n,column:r};return function(g){return g.position=new a(b),u(),g}}function a(b){this.start=b,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function l(b){var g=new Error(t.source+":"+n+":"+r+": "+b);if(g.reason=b,g.filename=t.source,g.line=n,g.column=r,g.source=e,!t.silent)throw g}function c(b){var g=b.exec(e);if(g){var O=g[0];return i(O),e=e.slice(O.length),g}}function u(){c(PBe)}function d(b){var g;for(b=b||[];g=f();)g!==!1&&b.push(g);return b}function f(){var b=s();if(!(EV!=e.charAt(0)||kV!=e.charAt(1))){for(var g=2;Bp!=e.charAt(g)&&(kV!=e.charAt(g)||EV!=e.charAt(g+1));)++g;if(g+=2,Bp===e.charAt(g-1))return l("End of comment missing");var O=e.slice(2,g-2);return r+=2,i(O),e=e.slice(g),r+=2,b({type:UBe,comment:O})}}function h(){var b=s(),g=c(MBe);if(g){if(f(),!c(LBe))return l("property missing ':'");var O=c($Be),y=b({type:zBe,property:TV(g[0].replace(SV,Bp)),value:O?TV(O[0].replace(SV,Bp)):Bp});return c(BBe),y}}function p(){var b=[];d(b);for(var g;g=h();)g!==!1&&(b.push(g),d(b));return b}return u(),p()}function TV(e){return e?e.replace(QBe,Bp):Bp}var qBe=VBe,HBe=Jf&&Jf.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(N$,"__esModule",{value:!0});N$.default=GBe;const XBe=HBe(qBe);function GBe(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,XBe.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 rC={};Object.defineProperty(rC,"__esModule",{value:!0});rC.camelCase=void 0;var YBe=/^--[a-zA-Z0-9_-]+$/,WBe=/-([a-z])/g,ZBe=/^[^-]+$/,KBe=/^-(webkit|moz|ms|o|khtml)-/,JBe=/^-(ms)-/,eQe=function(e){return!e||ZBe.test(e)||YBe.test(e)},tQe=function(e,t){return t.toUpperCase()},_V=function(e,t){return"".concat(t,"-")},nQe=function(e,t){return t===void 0&&(t={}),eQe(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(JBe,_V):e=e.replace(KBe,_V),e.replace(WBe,tQe))};rC.camelCase=nQe;var rQe=Jf&&Jf.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},iQe=rQe(N$),sQe=rC;function fM(e,t){var n={};return!e||typeof e!="string"||(0,iQe.default)(e,function(r,i){r&&i&&(n[(0,sQe.camelCase)(r,t)]=i)}),n}fM.default=fM;var aQe=fM;const oQe=eO(aQe),iC=uce("end"),Pu=uce("start");function uce(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 lQe(e){const t=Pu(e),n=iC(e);if(t&&n)return{start:t,end:n}}function Q1(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?AV(e.position):"start"in e||"end"in e?AV(e):"line"in e||"column"in e?hM(e):""}function hM(e){return CV(e&&e.line)+":"+CV(e&&e.column)}function AV(e){return hM(e&&e.start)+"-"+hM(e&&e.end)}function CV(e){return e&&typeof e=="number"?e:1}class Na 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=Q1(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}}Na.prototype.file="";Na.prototype.name="";Na.prototype.reason="";Na.prototype.message="";Na.prototype.stack="";Na.prototype.column=void 0;Na.prototype.line=void 0;Na.prototype.ancestors=void 0;Na.prototype.cause=void 0;Na.prototype.fatal=void 0;Na.prototype.place=void 0;Na.prototype.ruleId=void 0;Na.prototype.source=void 0;const j$={}.hasOwnProperty,cQe=new Map,uQe=/[A-Z]/g,dQe=new Set(["table","tbody","thead","tfoot","tr"]),fQe=new Set(["td","th"]),dce="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function hQe(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=vQe(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=xQe(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"?tp:mw,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=fce(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function fce(e,t,n){if(t.type==="element")return pQe(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return mQe(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return bQe(e,t,n);if(t.type==="mdxjsEsm")return gQe(e,t);if(t.type==="root")return OQe(e,t,n);if(t.type==="text")return yQe(e,t)}function pQe(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=tp,e.schema=i),e.ancestors.push(t);const s=pce(e,t.tagName,!1),a=wQe(e,t);let l=I$(e,t);return dQe.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!kBe(c):!0})),hce(e,a,s,t),R$(a,l),e.ancestors.pop(),e.schema=r,e.create(t,s,a,n)}function mQe(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)}Zx(e,t.position)}function gQe(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Zx(e,t.position)}function bQe(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=tp,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:pce(e,t.name,!0),a=SQe(e,t),l=I$(e,t);return hce(e,a,s,t),R$(a,l),e.ancestors.pop(),e.schema=r,e.create(t,s,a,n)}function OQe(e,t,n){const r={};return R$(r,I$(e,t)),e.create(t,e.Fragment,r,n)}function yQe(e,t){return t.value}function hce(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function R$(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function xQe(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 vQe(e,t){return n;function n(r,i,s,a){const l=Array.isArray(s.children),c=Pu(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 wQe(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&j$.call(t.properties,i)){const s=EQe(e,i,t.properties[i]);if(s){const[a,l]=s;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&fQe.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 SQe(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 Zx(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 Zx(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function I$(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:cQe;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?(sl(e,e.length,0,t),e):t}const RV={}.hasOwnProperty;function gce(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 vc(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ua=np(/[A-Za-z]/),_a=np(/[\dA-Za-z]/),IQe=np(/[#-'*+\--9=?A-Z^-~]/);function R2(e){return e!==null&&(e<32||e===127)}const pM=np(/\d/),DQe=np(/[\dA-Fa-f]/),PQe=np(/[!-/:-@[-`{-~]/);function Zt(e){return e!==null&&e<-2}function ii(e){return e!==null&&(e<0||e===32)}function Wn(e){return e===-2||e===-1||e===32}const sC=np(new RegExp("\\p{P}|\\p{S}","u")),jm=np(/\s/);function np(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function NO(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 yr(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return a;function a(c){return Wn(c)?(e.enter(n),l(c)):t(c)}function l(c){return Wn(c)&&s++a))return;const k=t.events.length;let T=k,C,N;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(C){N=t.events[T][1].end;break}C=!0}for(y(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 QQe(e,t,n){return yr(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Lb(e){if(e===null||ii(e)||jm(e))return 1;if(sC(e))return 2}function aC(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};DV(f,-c),DV(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=kl(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=kl(u,[["enter",i,t],["enter",a,t],["exit",a,t],["enter",s,t]]),u=kl(u,aC(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=kl(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=kl(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,sl(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n0&&Wn(E)?yr(e,v,"linePrefix",s+1)(E):v(E)}function v(E){return E===null||Zt(E)?e.check(PV,g,w)(E):(e.enter("codeFlowValue"),x(E))}function x(E){return E===null||Zt(E)?(e.exit("codeFlowValue"),v(E)):(e.consume(E),x)}function w(E){return e.exit("codeFenced"),t(E)}function S(E,k,T){let C=0;return N;function N(M){return E.enter("lineEnding"),E.consume(M),E.exit("lineEnding"),_}function _(M){return E.enter("codeFencedFence"),Wn(M)?yr(E,R,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):R(M)}function R(M){return M===l?(E.enter("codeFencedFenceSequence"),$(M)):T(M)}function $(M){return M===l?(C++,E.consume(M),$):C>=a?(E.exit("codeFencedFenceSequence"),Wn(M)?yr(E,D,"whitespace")(M):D(M)):T(M)}function D(M){return M===null||Zt(M)?(E.exit("codeFencedFence"),k(M)):T(M)}}}function KQe(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 AR={name:"codeIndented",tokenize:eFe},JQe={partial:!0,tokenize:tFe};function eFe(e,t,n){const r=this;return i;function i(u){return e.enter("codeIndented"),yr(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):Zt(u)?e.attempt(JQe,a,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||Zt(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function tFe(e,t,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):Zt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):yr(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):Zt(a)?i(a):n(a)}}const nFe={name:"codeText",previous:iFe,resolve:rFe,tokenize:sFe};function rFe(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&&Sy(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),Sy(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Sy(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 wce(e,t,n,r,i,s,a,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(y){return y===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(y),e.exit(s),h):y===null||y===32||y===41||R2(y)?n(y):(e.enter(r),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),g(y))}function h(y){return y===62?(e.enter(s),e.consume(y),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(e.exit("chunkString"),e.exit(l),h(y)):y===null||y===60||Zt(y)?n(y):(e.consume(y),y===92?b:p)}function b(y){return y===60||y===62||y===92?(e.consume(y),p):p(y)}function g(y){return!d&&(y===null||y===41||ii(y))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(r),t(y)):d999||p===null||p===91||p===93&&!c||p===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(p):p===93?(e.exit(s),e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):Zt(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||Zt(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!Wn(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),l++,f):f(p)}}function Ece(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):Zt(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),yr(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===a||h===null||Zt(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 F1(e,t){let n;return r;function r(i){return Zt(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Wn(i)?yr(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const hFe={name:"definition",tokenize:mFe},pFe={partial:!0,tokenize:gFe};function mFe(e,t,n){const r=this;let i;return s;function s(p){return e.enter("definition"),a(p)}function a(p){return Sce.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return i=vc(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),c):n(p)}function c(p){return ii(p)?F1(e,u)(p):u(p)}function u(p){return wce(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(pFe,f,f)(p)}function f(p){return Wn(p)?yr(e,h,"whitespace")(p):h(p)}function h(p){return p===null||Zt(p)?(e.exit("definition"),r.parser.defined.push(i),t(p)):n(p)}}function gFe(e,t,n){return r;function r(l){return ii(l)?F1(e,i)(l):n(l)}function i(l){return Ece(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return Wn(l)?yr(e,a,"whitespace")(l):a(l)}function a(l){return l===null||Zt(l)?t(l):n(l)}}const bFe={name:"hardBreakEscape",tokenize:OFe};function OFe(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return Zt(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const yFe={name:"headingAtx",resolve:xFe,tokenize:vFe};function xFe(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"},sl(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function vFe(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||ii(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||Zt(d)?(e.exit("atxHeading"),t(d)):Wn(d)?yr(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||ii(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const wFe=["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"],LV=["pre","script","style","textarea"],SFe={concrete:!0,name:"htmlFlow",resolveTo:TFe,tokenize:_Fe},EFe={partial:!0,tokenize:CFe},kFe={partial:!0,tokenize:AFe};function TFe(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 _Fe(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,g):B===63?(e.consume(B),i=3,r.interrupt?t:F):Ua(B)?(e.consume(B),a=String.fromCharCode(B),O):n(B)}function h(B){return B===45?(e.consume(B),i=2,p):B===91?(e.consume(B),i=5,l=0,b):Ua(B)?(e.consume(B),i=4,r.interrupt?t:F):n(B)}function p(B){return B===45?(e.consume(B),r.interrupt?t:F):n(B)}function b(B){const V="CDATA[";return B===V.charCodeAt(l++)?(e.consume(B),l===V.length?r.interrupt?t:R:b):n(B)}function g(B){return Ua(B)?(e.consume(B),a=String.fromCharCode(B),O):n(B)}function O(B){if(B===null||B===47||B===62||ii(B)){const V=B===47,ce=a.toLowerCase();return!V&&!s&&LV.includes(ce)?(i=1,r.interrupt?t(B):R(B)):wFe.includes(a.toLowerCase())?(i=6,V?(e.consume(B),y):r.interrupt?t(B):R(B)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(B):s?v(B):x(B))}return B===45||_a(B)?(e.consume(B),a+=String.fromCharCode(B),O):n(B)}function y(B){return B===62?(e.consume(B),r.interrupt?t:R):n(B)}function v(B){return Wn(B)?(e.consume(B),v):N(B)}function x(B){return B===47?(e.consume(B),N):B===58||B===95||Ua(B)?(e.consume(B),w):Wn(B)?(e.consume(B),x):N(B)}function w(B){return B===45||B===46||B===58||B===95||_a(B)?(e.consume(B),w):S(B)}function S(B){return B===61?(e.consume(B),E):Wn(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):Wn(B)?(e.consume(B),E):T(B)}function k(B){return B===c?(e.consume(B),c=null,C):B===null||Zt(B)?n(B):(e.consume(B),k)}function T(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||ii(B)?S(B):(e.consume(B),T)}function C(B){return B===47||B===62||Wn(B)?x(B):n(B)}function N(B){return B===62?(e.consume(B),_):n(B)}function _(B){return B===null||Zt(B)?R(B):Wn(B)?(e.consume(B),_):n(B)}function R(B){return B===45&&i===2?(e.consume(B),j):B===60&&i===1?(e.consume(B),P):B===62&&i===4?(e.consume(B),q):B===63&&i===3?(e.consume(B),F):B===93&&i===5?(e.consume(B),U):Zt(B)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(EFe,z,$)(B)):B===null||Zt(B)?(e.exit("htmlFlowData"),$(B)):(e.consume(B),R)}function $(B){return e.check(kFe,D,z)(B)}function D(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),M}function M(B){return B===null||Zt(B)?$(B):(e.enter("htmlFlowData"),R(B))}function j(B){return B===45?(e.consume(B),F):R(B)}function P(B){return B===47?(e.consume(B),a="",L):R(B)}function L(B){if(B===62){const V=a.toLowerCase();return LV.includes(V)?(e.consume(B),q):R(B)}return Ua(B)&&a.length<8?(e.consume(B),a+=String.fromCharCode(B),L):R(B)}function U(B){return B===93?(e.consume(B),F):R(B)}function F(B){return B===62?(e.consume(B),q):B===45&&i===2?(e.consume(B),F):R(B)}function q(B){return B===null||Zt(B)?(e.exit("htmlFlowData"),z(B)):(e.consume(B),q)}function z(B){return e.exit("htmlFlow"),t(B)}}function AFe(e,t,n){const r=this;return i;function i(a){return Zt(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 CFe(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(gw,t,n)}}const NFe={name:"htmlText",tokenize:jFe};function jFe(e,t,n){const r=this;let i,s,a;return l;function l(F){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(F),c}function c(F){return F===33?(e.consume(F),u):F===47?(e.consume(F),S):F===63?(e.consume(F),x):Ua(F)?(e.consume(F),T):n(F)}function u(F){return F===45?(e.consume(F),d):F===91?(e.consume(F),s=0,b):Ua(F)?(e.consume(F),v):n(F)}function d(F){return F===45?(e.consume(F),p):n(F)}function f(F){return F===null?n(F):F===45?(e.consume(F),h):Zt(F)?(a=f,P(F)):(e.consume(F),f)}function h(F){return F===45?(e.consume(F),p):f(F)}function p(F){return F===62?j(F):F===45?h(F):f(F)}function b(F){const q="CDATA[";return F===q.charCodeAt(s++)?(e.consume(F),s===q.length?g:b):n(F)}function g(F){return F===null?n(F):F===93?(e.consume(F),O):Zt(F)?(a=g,P(F)):(e.consume(F),g)}function O(F){return F===93?(e.consume(F),y):g(F)}function y(F){return F===62?j(F):F===93?(e.consume(F),y):g(F)}function v(F){return F===null||F===62?j(F):Zt(F)?(a=v,P(F)):(e.consume(F),v)}function x(F){return F===null?n(F):F===63?(e.consume(F),w):Zt(F)?(a=x,P(F)):(e.consume(F),x)}function w(F){return F===62?j(F):x(F)}function S(F){return Ua(F)?(e.consume(F),E):n(F)}function E(F){return F===45||_a(F)?(e.consume(F),E):k(F)}function k(F){return Zt(F)?(a=k,P(F)):Wn(F)?(e.consume(F),k):j(F)}function T(F){return F===45||_a(F)?(e.consume(F),T):F===47||F===62||ii(F)?C(F):n(F)}function C(F){return F===47?(e.consume(F),j):F===58||F===95||Ua(F)?(e.consume(F),N):Zt(F)?(a=C,P(F)):Wn(F)?(e.consume(F),C):j(F)}function N(F){return F===45||F===46||F===58||F===95||_a(F)?(e.consume(F),N):_(F)}function _(F){return F===61?(e.consume(F),R):Zt(F)?(a=_,P(F)):Wn(F)?(e.consume(F),_):C(F)}function R(F){return F===null||F===60||F===61||F===62||F===96?n(F):F===34||F===39?(e.consume(F),i=F,$):Zt(F)?(a=R,P(F)):Wn(F)?(e.consume(F),R):(e.consume(F),D)}function $(F){return F===i?(e.consume(F),i=void 0,M):F===null?n(F):Zt(F)?(a=$,P(F)):(e.consume(F),$)}function D(F){return F===null||F===34||F===39||F===60||F===61||F===96?n(F):F===47||F===62||ii(F)?C(F):(e.consume(F),D)}function M(F){return F===47||F===62||ii(F)?C(F):n(F)}function j(F){return F===62?(e.consume(F),e.exit("htmlTextData"),e.exit("htmlText"),t):n(F)}function P(F){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),L}function L(F){return Wn(F)?yr(e,U,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):U(F)}function U(F){return e.enter("htmlTextData"),a(F)}}const M$={name:"labelEnd",resolveAll:PFe,resolveTo:MFe,tokenize:LFe},RFe={tokenize:$Fe},IFe={tokenize:BFe},DFe={tokenize:QFe};function PFe(e){let t=-1;const n=[];for(;++t=3&&(u===null||Zt(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===i?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),Wn(u)?yr(e,l,"whitespace")(u):l(u))}}const io={continuation:{tokenize:WFe},exit:KFe,name:"list",tokenize:YFe},XFe={partial:!0,tokenize:JFe},GFe={partial:!0,tokenize:ZFe};function YFe(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(p){const b=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:pM(p)){if(r.containerState.type||(r.containerState.type=b,e.enter(b,{_container:!0})),b==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(Vk,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return pM(p)&&++a<10?(e.consume(p),c):(!r.interrupt||a<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(gw,r.interrupt?n:d,e.attempt(XFe,h,f))}function d(p){return r.containerState.initialBlankLine=!0,s++,h(p)}function f(p){return Wn(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function WFe(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(gw,i,s);function i(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,yr(e,t,"listItemIndent",r.containerState.size+1)(l)}function s(l){return r.containerState.furtherBlankLines||!Wn(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(GFe,t,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,yr(e,e.attempt(io,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function ZFe(e,t,n){const r=this;return yr(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 KFe(e){e.exit(this.containerState.type)}function JFe(e,t,n){const r=this;return yr(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!Wn(s)&&a&&a[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const $V={name:"setextUnderline",resolveTo:eUe,tokenize:tUe};function eUe(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 tUe(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"),Wn(u)?yr(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||Zt(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const nUe={tokenize:rUe};function rUe(e){const t=this,n=e.attempt(gw,r,e.attempt(this.parser.constructs.flowInitial,i,yr(e,e.attempt(this.parser.constructs.flow,i,e.attempt(lFe,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 iUe={resolveAll:Tce()},sUe=kce("string"),aUe=kce("text");function kce(e){return{resolveAll:Tce(e==="text"?oUe: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 xUe(e,t){let n=-1;const r=[];let i;for(;++n0){const Re=he.tokenStack[he.tokenStack.length-1];(Re[1]||$V).call(he,void 0,Re[0])}for(ne.position={start:jf(W.length>0?W[0][1].start:{line:1,column:1,offset:0}),end:jf(W.length>0?W[W.length-2][1].end:{line:1,column:1,offset:0})},re=-1;++re0&&(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 RUe(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function IUe(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function DUe(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=CO(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 PUe(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 MUe(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function _ce(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 LUe(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return _ce(e,t);const i={src:CO(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 $Ue(e,t){const n={src:CO(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 BUe(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 QUe(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return _ce(e,t);const i={href:CO(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 FUe(e,t){const n={href:CO(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 UUe(e,t,n){const r=e.all(t),i=n?zUe(n):Ace(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 Re=he.tokenStack[he.tokenStack.length-1];(Re[1]||QV).call(he,void 0,Re[0])}for(ne.position={start:jf(W.length>0?W[0][1].start:{line:1,column:1,offset:0}),end:jf(W.length>0?W[W.length-2][1].end:{line:1,column:1,offset:0})},re=-1;++re0&&(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 DUe(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function PUe(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function MUe(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=NO(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 LUe(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 $Ue(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Cce(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 BUe(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Cce(e,t);const i={src:NO(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 QUe(e,t){const n={src:NO(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 FUe(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 UUe(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Cce(e,t);const i={href:NO(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 zUe(e,t){const n={href:NO(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 VUe(e,t,n){const r=e.all(t),i=n?qUe(n):Nce(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 VUe(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=Pu(t.children[1]),c=nC(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 YUe(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(FV(t.slice(i),i>0,!1)),s.join("")}function FV(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===BV||s===QV;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===BV||s===QV;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function KUe(e,t){const n={type:"text",value:ZUe(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function JUe(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const eze={blockquote:CUe,break:NUe,code:jUe,delete:RUe,emphasis:IUe,footnoteReference:DUe,heading:PUe,html:MUe,imageReference:LUe,image:$Ue,inlineCode:BUe,linkReference:QUe,link:FUe,listItem:UUe,list:VUe,paragraph:qUe,root:HUe,strong:XUe,table:GUe,tableCell:WUe,tableRow:YUe,text:KUe,thematicBreak:JUe,toml:oE,yaml:oE,definition:oE,footnoteDefinition:oE};function oE(){}const Cce=-1,sC=0,F1=1,j2=2,P$=3,M$=4,L$=5,$$=6,Nce=7,jce=8,tze=typeof self=="object"?self:globalThis,UV=(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 tze[e](t)},nze=(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 sC:case Cce:return n(a,i);case F1:{const l=n([],i);for(const c of a)l.push(r(c));return l}case j2:{const l=n({},i);for(const[c,u]of a)l[r(c)]=r(u);return l}case P$:return n(new Date(a),i);case M$:{const{source:l,flags:c}=a;return n(new RegExp(l,c),i)}case L$:{const l=n(new Map,i);for(const[c,u]of a)l.set(r(c),r(u));return l}case $$:{const l=n(new Set,i);for(const c of a)l.add(r(c));return l}case Nce:{const{name:l,message:c}=a;return n(UV(l,c),i)}case jce: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(UV(s,a),i)};return r},zV=e=>nze(new Map,e)(0),Cg="",{toString:rze}={},{keys:ize}=Object,Sy=e=>{const t=typeof e;if(t!=="object"||!e)return[sC,t];const n=rze.call(e).slice(8,-1);switch(n){case"Array":return[F1,Cg];case"Object":return[j2,Cg];case"Date":return[P$,Cg];case"RegExp":return[M$,Cg];case"Map":return[L$,Cg];case"Set":return[$$,Cg];case"DataView":return[F1,n]}return n.includes("Array")?[F1,n]:n.includes("Error")?[Nce,n]:[j2,n]},lE=([e,t])=>e===sC&&(t==="function"||t==="symbol"),sze=(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]=Sy(a);switch(l){case sC:{let d=a;switch(c){case"bigint":l=jce,d=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return i([Cce],a)}return i([l,d],a)}case F1:{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 j2:{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 ize(a))(e||!lE(Sy(a[h])))&&d.push([s(h),s(a[h])]);return f}case P$:return i([l,a.toISOString()],a);case M$:{const{source:d,flags:f}=a;return i([l,{source:d,flags:f}],a)}case L$:{const d=[],f=i([l,d],a);for(const[h,p]of a)(e||!(lE(Sy(h))||lE(Sy(p))))&&d.push([s(h),s(p)]);return f}case $$:{const d=[],f=i([l,d],a);for(const h of a)(e||!lE(Sy(h)))&&d.push(s(h));return f}}const{message:u}=a;return i([l,{name:c,message:u}],a)};return s},VV=(e,{json:t,lossy:n}={})=>{const r=[];return sze(!(t||n),!!t,new Map,r)(e),r},Lb=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?zV(VV(e,t)):structuredClone(e):(e,t)=>zV(VV(e,t));function aze(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 oze(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function lze(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||aze,r=e.options.footnoteBackLabel||oze,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c0&&b.push({type:"text",value:" "});let v=typeof n=="string"?n:n(c,p);typeof v=="string"&&(v={type:"text",value:v}),b.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,p),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const O=d[d.length-1];if(O&&O.type==="element"&&O.tagName==="p"){const v=O.children[O.children.length-1];v&&v.type==="text"?v.value+=" ":O.children.push({type:"text",value:" "}),O.children.push(...b)}else d.push(...b);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(d,!0)};e.patch(u,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Lb(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 qUe(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r1}function HUe(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=Pu(t.children[1]),c=iC(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 ZUe(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(zV(t.slice(i),i>0,!1)),s.join("")}function zV(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===FV||s===UV;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===FV||s===UV;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function eze(e,t){const n={type:"text",value:JUe(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function tze(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const nze={blockquote:jUe,break:RUe,code:IUe,delete:DUe,emphasis:PUe,footnoteReference:MUe,heading:LUe,html:$Ue,imageReference:BUe,image:QUe,inlineCode:FUe,linkReference:UUe,link:zUe,listItem:VUe,list:HUe,paragraph:XUe,root:GUe,strong:YUe,table:WUe,tableCell:KUe,tableRow:ZUe,text:eze,thematicBreak:tze,toml:oE,yaml:oE,definition:oE,footnoteDefinition:oE};function oE(){}const jce=-1,oC=0,U1=1,I2=2,L$=3,$$=4,B$=5,Q$=6,Rce=7,Ice=8,rze=typeof self=="object"?self:globalThis,VV=(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 rze[e](t)},ize=(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 oC:case jce:return n(a,i);case U1:{const l=n([],i);for(const c of a)l.push(r(c));return l}case I2:{const l=n({},i);for(const[c,u]of a)l[r(c)]=r(u);return l}case L$:return n(new Date(a),i);case $$:{const{source:l,flags:c}=a;return n(new RegExp(l,c),i)}case B$:{const l=n(new Map,i);for(const[c,u]of a)l.set(r(c),r(u));return l}case Q$:{const l=n(new Set,i);for(const c of a)l.add(r(c));return l}case Rce:{const{name:l,message:c}=a;return n(VV(l,c),i)}case Ice: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(VV(s,a),i)};return r},qV=e=>ize(new Map,e)(0),Ng="",{toString:sze}={},{keys:aze}=Object,Ey=e=>{const t=typeof e;if(t!=="object"||!e)return[oC,t];const n=sze.call(e).slice(8,-1);switch(n){case"Array":return[U1,Ng];case"Object":return[I2,Ng];case"Date":return[L$,Ng];case"RegExp":return[$$,Ng];case"Map":return[B$,Ng];case"Set":return[Q$,Ng];case"DataView":return[U1,n]}return n.includes("Array")?[U1,n]:n.includes("Error")?[Rce,n]:[I2,n]},lE=([e,t])=>e===oC&&(t==="function"||t==="symbol"),oze=(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]=Ey(a);switch(l){case oC:{let d=a;switch(c){case"bigint":l=Ice,d=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return i([jce],a)}return i([l,d],a)}case U1:{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 I2:{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 aze(a))(e||!lE(Ey(a[h])))&&d.push([s(h),s(a[h])]);return f}case L$:return i([l,a.toISOString()],a);case $$:{const{source:d,flags:f}=a;return i([l,{source:d,flags:f}],a)}case B$:{const d=[],f=i([l,d],a);for(const[h,p]of a)(e||!(lE(Ey(h))||lE(Ey(p))))&&d.push([s(h),s(p)]);return f}case Q$:{const d=[],f=i([l,d],a);for(const h of a)(e||!lE(Ey(h)))&&d.push(s(h));return f}}const{message:u}=a;return i([l,{name:c,message:u}],a)};return s},HV=(e,{json:t,lossy:n}={})=>{const r=[];return oze(!(t||n),!!t,new Map,r)(e),r},$b=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?qV(HV(e,t)):structuredClone(e):(e,t)=>qV(HV(e,t));function lze(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 cze(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function uze(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||lze,r=e.options.footnoteBackLabel||cze,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c0&&b.push({type:"text",value:" "});let v=typeof n=="string"?n:n(c,p);typeof v=="string"&&(v={type:"text",value:v}),b.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,p),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const O=d[d.length-1];if(O&&O.type==="element"&&O.tagName==="p"){const v=O.children[O.children.length-1];v&&v.type==="text"?v.value+=" ":O.children.push({type:"text",value:" "}),O.children.push(...b)}else d.push(...b);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(d,!0)};e.patch(u,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...$b(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 gw=function(e){if(e==null)return fze;if(typeof e=="function")return aC(e);if(typeof e=="object")return Array.isArray(e)?cze(e):uze(e);if(typeof e=="string")return dze(e);throw new Error("Expected function, string, or object as test")};function cze(e){const t=[];let n=-1;for(;++n":""))+")"})}return h;function h(){let p=Rce,b,g,O;if((!t||s(c,u,d[d.length-1]||void 0))&&(p=gze(n(c,d)),p[0]===pM))return p;if("children"in c&&c.children){const y=c;if(y.children&&p[0]!==mze)for(g=(r?y.children.length:-1)+a,O=d.concat(y);g>-1&&g":""))+")"})}return h;function h(){let p=Dce,b,g,O;if((!t||s(c,u,d[d.length-1]||void 0))&&(p=Oze(n(c,d)),p[0]===gM))return p;if("children"in c&&c.children){const y=c;if(y.children&&p[0]!==bze)for(g=(r?y.children.length:-1)+a,O=d.concat(y);g>-1&&g0&&n.push({type:"text",value:` -`}),n}function qV(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function HV(e,t){const n=Oze(e,t),r=n.one(e,void 0),i=lze(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:` -`},i),s}function Sze(e,t){return e&&"run"in e?async function(n,r){const i=HV(n,{file:r,...t});await e.run(i,r)}:function(n,r){return HV(n,{file:r,...e||t})}}function XV(e){if(e)throw e}var zk=Object.prototype.hasOwnProperty,Dce=Object.prototype.toString,GV=Object.defineProperty,YV=Object.getOwnPropertyDescriptor,WV=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Dce.call(t)==="[object Array]"},ZV=function(t){if(!t||Dce.call(t)!=="[object Object]")return!1;var n=zk.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&zk.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||zk.call(t,i)},KV=function(t,n){GV&&n.name==="__proto__"?GV(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},JV=function(t,n){if(n==="__proto__")if(zk.call(t,n)){if(YV)return YV(t,n).value}else return;return t[n]},Eze=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 tu={basename:_ze,dirname:Aze,extname:Cze,join:Nze,sep:"/"};function _ze(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ow(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 Aze(e){if(Ow(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 Cze(e){Ow(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 Nze(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Rze(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 Ow(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Ize={cwd:Dze};function Dze(){return"/"}function bM(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Pze(e){if(typeof e=="string")e=new URL(e);else if(!bM(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 Mze(e)}function Mze(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n0){let[p,...b]=d;const g=r[h][1];gM(g)&&gM(p)&&(p=AR(!0,g,p)),r[h]=[u,p,...b]}}}}const Qze=new B$().freeze();function RR(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function IR(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function DR(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 tq(e){if(!gM(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function nq(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function cE(e){return Fze(e)?e:new Pce(e)}function Fze(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Uze(e){return typeof e=="string"||zze(e)}function zze(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Vze="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",rq=[],iq={allowDangerousHtml:!0},qze=/^(https?|ircs?|mailto|xmpp)$/i,Hze=[{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 Xze(e){const t=Gze(e),n=Yze(e);return Wze(t.runSync(t.parse(n),n),e)}function Gze(e){const t=e.rehypePlugins||rq,n=e.remarkPlugins||rq,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...iq}:iq;return Qze().use(AUe).use(n).use(Sze,r).use(t)}function Yze(e){const t=e.children||"",n=new Pce;return typeof t=="string"&&(n.value=t),n}function Wze(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||Zze;for(const d of Hze)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+Vze+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),bw(e,u),dQe(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 p;for(p in kR)if(Object.hasOwn(kR,p)&&Object.hasOwn(d.properties,p)){const b=d.properties[p],g=kR[p];(g===null||g.includes(d.tagName))&&(d.properties[p]=c(String(b||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):s?s.includes(d.tagName):!1;if(!p&&r&&typeof f=="number"&&(p=!r(d,f,h)),p&&h&&typeof f=="number")return l&&d.children?h.children.splice(f,1,...d.children):h.children.splice(f,1),f}}}function Zze(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||qze.test(e.slice(0,t))?e:""}function sq(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 Kze(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Jze(e,t,n){const i=gw((n||{}).ignore||[]),s=eVe(t);let a=-1;for(;++a0?{type:"text",value:E}:void 0),E===!1?h.lastIndex=w+1:(b!==w&&v.push({type:"text",value:u.value.slice(b,w)}),Array.isArray(E)?v.push(...E):E&&v.push(E),b=w+x[0].length,y=!0),!h.global)break;x=h.exec(u.value)}return y?(b?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=sq(e,"(");let s=sq(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 Mce(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Nm(n)||rC(n))&&(!t||n!==47)}Lce.peek=SVe;function mVe(){this.buffer()}function gVe(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function bVe(){this.buffer()}function OVe(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function yVe(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=vc(this.sliceSerialize(e)).toLowerCase(),n.label=t}function xVe(e){this.exit(e)}function vVe(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=vc(this.sliceSerialize(e)).toLowerCase(),n.label=t}function wVe(e){this.exit(e)}function SVe(){return"["}function Lce(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 EVe(){return{enter:{gfmFootnoteCallString:mVe,gfmFootnoteCall:gVe,gfmFootnoteDefinitionLabelString:bVe,gfmFootnoteDefinition:OVe},exit:{gfmFootnoteCallString:yVe,gfmFootnoteCall:xVe,gfmFootnoteDefinitionLabelString:vVe,gfmFootnoteDefinition:wVe}}}function kVe(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Lce},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?$ce:TVe))),u(),c}}function TVe(e,t,n){return t===0?e:$ce(e,t,n)}function $ce(e,t,n){return(n?"":" ")+e}const _Ve=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Bce.peek=RVe;function AVe(){return{canContainEols:["delete"],enter:{strikethrough:NVe},exit:{strikethrough:jVe}}}function CVe(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:_Ve}],handlers:{delete:Bce}}}function NVe(e){this.enter({type:"delete",children:[]},e)}function jVe(e){this.exit(e)}function Bce(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 RVe(){return"~"}function IVe(e){return e.length}function DVe(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||IVe,s=[],a=[],l=[],c=[];let u=0,d=-1;for(;++du&&(u=e[d].length);++yc[y])&&(c[y]=x)}g.push(v)}a[d]=g,l[d]=O}let f=-1;if(typeof r=="object"&&"length"in r)for(;++fc[f]&&(c[f]=v),p[f]=v),h[f]=x}a.splice(1,0,h),l.splice(1,0,p),d=-1;const b=[];for(;++d "),s.shift(2);const a=n.indentLines(n.containerFlow(e,s.current()),LVe);return i(),a}function LVe(e,t,n){return">"+(n?"":" ")+e}function $Ve(e,t){return lq(e,t.inConstruct,!0)&&!lq(e,t.notInConstruct,!1)}function lq(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 QVe(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 FVe(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 UVe(e,t,n,r){const i=FVe(n),s=e.value||"",a=i==="`"?"GraveAccent":"Tilde";if(QVe(e,n)){const f=n.enter("codeIndented"),h=n.indentLines(s,zVe);return f(),h}const l=n.createTracker(r),c=i.repeat(Math.max(BVe(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 XV(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function GV(e,t){const n=xze(e,t),r=n.one(e,void 0),i=uze(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:` +`},i),s}function kze(e,t){return e&&"run"in e?async function(n,r){const i=GV(n,{file:r,...t});await e.run(i,r)}:function(n,r){return GV(n,{file:r,...e||t})}}function YV(e){if(e)throw e}var qk=Object.prototype.hasOwnProperty,Mce=Object.prototype.toString,WV=Object.defineProperty,ZV=Object.getOwnPropertyDescriptor,KV=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Mce.call(t)==="[object Array]"},JV=function(t){if(!t||Mce.call(t)!=="[object Object]")return!1;var n=qk.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&qk.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||qk.call(t,i)},eq=function(t,n){WV&&n.name==="__proto__"?WV(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},tq=function(t,n){if(n==="__proto__")if(qk.call(t,n)){if(ZV)return ZV(t,n).value}else return;return t[n]},Tze=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 tu={basename:Cze,dirname:Nze,extname:jze,join:Rze,sep:"/"};function Cze(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');yw(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 Nze(e){if(yw(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 jze(e){yw(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 Rze(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Dze(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 yw(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Pze={cwd:Mze};function Mze(){return"/"}function yM(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Lze(e){if(typeof e=="string")e=new URL(e);else if(!yM(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 $ze(e)}function $ze(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n0){let[p,...b]=d;const g=r[h][1];OM(g)&&OM(p)&&(p=NR(!0,g,p)),r[h]=[u,p,...b]}}}}const Uze=new F$().freeze();function DR(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function PR(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function MR(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 rq(e){if(!OM(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function iq(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function cE(e){return zze(e)?e:new Lce(e)}function zze(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Vze(e){return typeof e=="string"||qze(e)}function qze(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Hze="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",sq=[],aq={allowDangerousHtml:!0},Xze=/^(https?|ircs?|mailto|xmpp)$/i,Gze=[{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 Yze(e){const t=Wze(e),n=Zze(e);return Kze(t.runSync(t.parse(n),n),e)}function Wze(e){const t=e.rehypePlugins||sq,n=e.remarkPlugins||sq,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...aq}:aq;return Uze().use(NUe).use(n).use(kze,r).use(t)}function Zze(e){const t=e.children||"",n=new Lce;return typeof t=="string"&&(n.value=t),n}function Kze(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||Jze;for(const d of Gze)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+Hze+d.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),Ow(e,u),hQe(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 p;for(p in _R)if(Object.hasOwn(_R,p)&&Object.hasOwn(d.properties,p)){const b=d.properties[p],g=_R[p];(g===null||g.includes(d.tagName))&&(d.properties[p]=c(String(b||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):s?s.includes(d.tagName):!1;if(!p&&r&&typeof f=="number"&&(p=!r(d,f,h)),p&&h&&typeof f=="number")return l&&d.children?h.children.splice(f,1,...d.children):h.children.splice(f,1),f}}}function Jze(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||Xze.test(e.slice(0,t))?e:""}function oq(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 eVe(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function tVe(e,t,n){const i=bw((n||{}).ignore||[]),s=nVe(t);let a=-1;for(;++a0?{type:"text",value:E}:void 0),E===!1?h.lastIndex=w+1:(b!==w&&v.push({type:"text",value:u.value.slice(b,w)}),Array.isArray(E)?v.push(...E):E&&v.push(E),b=w+x[0].length,y=!0),!h.global)break;x=h.exec(u.value)}return y?(b?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const i=oq(e,"(");let s=oq(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 $ce(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||jm(n)||sC(n))&&(!t||n!==47)}Bce.peek=kVe;function bVe(){this.buffer()}function OVe(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function yVe(){this.buffer()}function xVe(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function vVe(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=vc(this.sliceSerialize(e)).toLowerCase(),n.label=t}function wVe(e){this.exit(e)}function SVe(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=vc(this.sliceSerialize(e)).toLowerCase(),n.label=t}function EVe(e){this.exit(e)}function kVe(){return"["}function Bce(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 TVe(){return{enter:{gfmFootnoteCallString:bVe,gfmFootnoteCall:OVe,gfmFootnoteDefinitionLabelString:yVe,gfmFootnoteDefinition:xVe},exit:{gfmFootnoteCallString:vVe,gfmFootnoteCall:wVe,gfmFootnoteDefinitionLabelString:SVe,gfmFootnoteDefinition:EVe}}}function _Ve(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Bce},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?Qce:AVe))),u(),c}}function AVe(e,t,n){return t===0?e:Qce(e,t,n)}function Qce(e,t,n){return(n?"":" ")+e}const CVe=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Fce.peek=DVe;function NVe(){return{canContainEols:["delete"],enter:{strikethrough:RVe},exit:{strikethrough:IVe}}}function jVe(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:CVe}],handlers:{delete:Fce}}}function RVe(e){this.enter({type:"delete",children:[]},e)}function IVe(e){this.exit(e)}function Fce(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 DVe(){return"~"}function PVe(e){return e.length}function MVe(e,t){const n=t||{},r=(n.align||[]).concat(),i=n.stringLength||PVe,s=[],a=[],l=[],c=[];let u=0,d=-1;for(;++du&&(u=e[d].length);++yc[y])&&(c[y]=x)}g.push(v)}a[d]=g,l[d]=O}let f=-1;if(typeof r=="object"&&"length"in r)for(;++fc[f]&&(c[f]=v),p[f]=v),h[f]=x}a.splice(1,0,h),l.splice(1,0,p),d=-1;const b=[];for(;++d "),s.shift(2);const a=n.indentLines(n.containerFlow(e,s.current()),BVe);return i(),a}function BVe(e,t,n){return">"+(n?"":" ")+e}function QVe(e,t){return uq(e,t.inConstruct,!0)&&!uq(e,t.notInConstruct,!1)}function uq(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 UVe(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 zVe(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 VVe(e,t,n,r){const i=zVe(n),s=e.value||"",a=i==="`"?"GraveAccent":"Tilde";if(UVe(e,n)){const f=n.enter("codeIndented"),h=n.indentLines(s,qVe);return f(),h}const l=n.createTracker(r),c=i.repeat(Math.max(FVe(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 zVe(e,t,n){return(n?"":" ")+e}function Q$(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 VVe(e,t,n,r){const i=Q$(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 qVe(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 Zx(e){return"&#x"+e.toString(16).toUpperCase()+";"}function R2(e,t,n){const r=Mb(e),i=Mb(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}}Fce.peek=HVe;function Fce(e,t,n,r){const i=qVe(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=R2(r.before.charCodeAt(r.before.length-1),u,i);d.inside&&(c=Zx(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=R2(r.after.charCodeAt(0),f,i);h.inside&&(c=c.slice(0,-1)+Zx(f));const p=a.move(i);return s(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+p}function HVe(e,t,n){return n.options.emphasis||"*"}function XVe(e,t){let n=!1;return bw(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,pM}),!!((!e.depth||e.depth<3)&&R$(e)&&(t.options.setext||n))}function GVe(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(XVe(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 qVe(e,t,n){return(n?"":" ")+e}function U$(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 HVe(e,t,n,r){const i=U$(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 XVe(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 Kx(e){return"&#x"+e.toString(16).toUpperCase()+";"}function D2(e,t,n){const r=Lb(e),i=Lb(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}}zce.peek=GVe;function zce(e,t,n,r){const i=XVe(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=D2(r.before.charCodeAt(r.before.length-1),u,i);d.inside&&(c=Kx(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=D2(r.after.charCodeAt(0),f,i);h.inside&&(c=c.slice(0,-1)+Kx(f));const p=a.move(i);return s(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+p}function GVe(e,t,n){return n.options.emphasis||"*"}function YVe(e,t){let n=!1;return Ow(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,gM}),!!((!e.depth||e.depth<3)&&D$(e)&&(t.options.setext||n))}function WVe(e,t,n,r){const i=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(YVe(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=Zx(u.charCodeAt(0))+u.slice(1)),u=u?a+" "+u:a,n.options.closeAtx&&(u+=" "+a),c(),l(),u}Uce.peek=YVe;function Uce(e){return e.value||""}function YVe(){return"<"}zce.peek=WVe;function zce(e,t,n,r){const i=Q$(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 WVe(){return"!"}Vce.peek=ZVe;function Vce(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 ZVe(){return"!"}qce.peek=KVe;function qce(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))}Xce.peek=JVe;function Xce(e,t,n,r){const i=Q$(n),s=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let l,c;if(Hce(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 JVe(e,t,n){return Hce(e,n)?"<":"["}Gce.peek=eqe;function Gce(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 eqe(){return"["}function F$(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 tqe(e){const t=F$(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 nqe(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 Yce(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 rqe(e,t,n,r){const i=n.enter("list"),s=n.bulletCurrent;let a=e.ordered?nqe(n):F$(n);const l=e.ordered?a==="."?")":".":tqe(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),Yce(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,p){return h?(p?"":" ".repeat(a))+f:(p?s:s+" ".repeat(a-s.length))+f}}function aqe(e,t,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),a=n.containerPhrasing(e,r);return s(),i(),a}const oqe=gw(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function lqe(e,t,n,r){return(e.children.some(function(a){return oqe(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function cqe(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Wce.peek=uqe;function Wce(e,t,n,r){const i=cqe(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=R2(r.before.charCodeAt(r.before.length-1),u,i);d.inside&&(c=Zx(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=R2(r.after.charCodeAt(0),f,i);h.inside&&(c=c.slice(0,-1)+Zx(f));const p=a.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+p}function uqe(e,t,n){return n.options.strong||"*"}function dqe(e,t,n,r){return n.safe(e.value,r)}function fqe(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 hqe(e,t,n){const r=(Yce(n)+(n.options.ruleSpaces?" ":"")).repeat(fqe(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Zce={blockquote:MVe,break:cq,code:UVe,definition:VVe,emphasis:Fce,hardBreak:cq,heading:GVe,html:Uce,image:zce,imageReference:Vce,inlineCode:qce,link:Xce,linkReference:Gce,list:rqe,listItem:sqe,paragraph:aqe,root:lqe,strong:Wce,text:dqe,thematicBreak:hqe};function pqe(){return{enter:{table:mqe,tableData:uq,tableHeader:uq,tableRow:bqe},exit:{codeText:Oqe,table:gqe,tableData:$R,tableHeader:$R,tableRow:$R}}}function mqe(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 gqe(e){this.exit(e),this.data.inTable=void 0}function bqe(e){this.enter({type:"tableRow",children:[]},e)}function $R(e){this.exit(e)}function uq(e){this.enter({type:"tableCell",children:[]},e)}function Oqe(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,yqe));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function yqe(e,t){return t==="|"?t:e}function xqe(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=Kx(u.charCodeAt(0))+u.slice(1)),u=u?a+" "+u:a,n.options.closeAtx&&(u+=" "+a),c(),l(),u}Vce.peek=ZVe;function Vce(e){return e.value||""}function ZVe(){return"<"}qce.peek=KVe;function qce(e,t,n,r){const i=U$(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 KVe(){return"!"}Hce.peek=JVe;function Hce(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 JVe(){return"!"}Xce.peek=eqe;function Xce(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))}Yce.peek=tqe;function Yce(e,t,n,r){const i=U$(n),s=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let l,c;if(Gce(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 tqe(e,t,n){return Gce(e,n)?"<":"["}Wce.peek=nqe;function Wce(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 nqe(){return"["}function z$(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 rqe(e){const t=z$(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 iqe(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 Zce(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 sqe(e,t,n,r){const i=n.enter("list"),s=n.bulletCurrent;let a=e.ordered?iqe(n):z$(n);const l=e.ordered?a==="."?")":".":rqe(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),Zce(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,p){return h?(p?"":" ".repeat(a))+f:(p?s:s+" ".repeat(a-s.length))+f}}function lqe(e,t,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),a=n.containerPhrasing(e,r);return s(),i(),a}const cqe=bw(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function uqe(e,t,n,r){return(e.children.some(function(a){return cqe(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function dqe(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Kce.peek=fqe;function Kce(e,t,n,r){const i=dqe(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=D2(r.before.charCodeAt(r.before.length-1),u,i);d.inside&&(c=Kx(u)+c.slice(1));const f=c.charCodeAt(c.length-1),h=D2(r.after.charCodeAt(0),f,i);h.inside&&(c=c.slice(0,-1)+Kx(f));const p=a.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:h.outside,before:d.outside},l+c+p}function fqe(e,t,n){return n.options.strong||"*"}function hqe(e,t,n,r){return n.safe(e.value,r)}function pqe(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 mqe(e,t,n){const r=(Zce(n)+(n.options.ruleSpaces?" ":"")).repeat(pqe(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Jce={blockquote:$Ve,break:dq,code:VVe,definition:HVe,emphasis:zce,hardBreak:dq,heading:WVe,html:Vce,image:qce,imageReference:Hce,inlineCode:Xce,link:Yce,linkReference:Wce,list:sqe,listItem:oqe,paragraph:lqe,root:uqe,strong:Kce,text:hqe,thematicBreak:mqe};function gqe(){return{enter:{table:bqe,tableData:fq,tableHeader:fq,tableRow:yqe},exit:{codeText:xqe,table:Oqe,tableData:QR,tableHeader:QR,tableRow:QR}}}function bqe(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 Oqe(e){this.exit(e),this.data.inTable=void 0}function yqe(e){this.enter({type:"tableRow",children:[]},e)}function QR(e){this.exit(e)}function fq(e){this.enter({type:"tableCell",children:[]},e)}function xqe(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,vqe));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function vqe(e,t){return t==="|"?t:e}function wqe(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(p,b,g,O){return u(d(p,g,O),p.align)}function l(p,b,g,O){const y=f(p,g,O),v=u([y]);return v.slice(0,v.indexOf(` -`))}function c(p,b,g,O){const y=g.enter("tableCell"),v=g.enter("phrasing"),x=g.containerPhrasing(p,{...O,before:s,after:s});return v(),y(),x}function u(p,b){return DVe(p,{align:b,alignDelimiters:r,padding:n,stringLength:i})}function d(p,b,g){const O=p.children;let y=-1;const v=[],x=b.enter("table");for(;++y0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const $qe={tokenize:Hqe,partial:!0};function Bqe(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:zqe,continuation:{tokenize:Vqe},exit:qqe}},text:{91:{name:"gfmFootnoteCall",tokenize:Uqe},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Qqe,resolveTo:Fqe}}}}function Qqe(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=vc(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 Fqe(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 Uqe(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||ri(f))return n(f);if(f===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return i.includes(vc(r.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return ri(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 zqe(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,a=0,l;return c;function c(b){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(b){return b===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(b)}function d(b){if(a>999||b===93&&!l||b===null||b===91||ri(b))return n(b);if(b===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return s=vc(r.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return ri(b)||(l=!0),a++,e.consume(b),b===92?f:d}function f(b){return b===91||b===92||b===93?(e.consume(b),a++,d):d(b)}function h(b){return b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),i.includes(s)||i.push(s),yr(e,p,"gfmFootnoteDefinitionWhitespace")):n(b)}function p(b){return t(b)}}function Vqe(e,t,n){return e.check(mw,t,e.attempt($qe,t,n))}function qqe(e){e.exit("gfmFootnoteDefinition")}function Hqe(e,t,n){const r=this;return yr(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 Xqe(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(b):(a.consume(b),f++,p);if(f<2&&!n)return c(b);const O=a.exit("strikethroughSequenceTemporary"),y=Mb(b);return O._open=!y||y===2&&!!g,O._close=!g||g===2&&!!y,l(b)}}}class Gqe{constructor(){this.map=[]}add(t,n,r){Yqe(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 Yqe(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i-1;){const D=r.events[_][1].type;if(D==="lineEnding"||D==="linePrefix")_--;else break}const R=_>-1?r.events[_][1].type:null,$=R==="tableHead"||R==="tableRow"?E:c;return $===E&&r.parser.lazy[r.now().line]?n(N):$(N)}function c(N){return e.enter("tableHead"),e.enter("tableRow"),u(N)}function u(N){return N===124||(a=!0,s+=1),d(N)}function d(N){return N===null?n(N):Zt(N)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),p):n(N):Wn(N)?yr(e,d,"whitespace")(N):(s+=1,a&&(a=!1,i+=1),N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),a=!0,d):(e.enter("data"),f(N)))}function f(N){return N===null||N===124||ri(N)?(e.exit("data"),d(N)):(e.consume(N),N===92?h:f)}function h(N){return N===92||N===124?(e.consume(N),f):f(N)}function p(N){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(N):(e.enter("tableDelimiterRow"),a=!1,Wn(N)?yr(e,b,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):b(N))}function b(N){return N===45||N===58?O(N):N===124?(a=!0,e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),g):S(N)}function g(N){return Wn(N)?yr(e,O,"whitespace")(N):O(N)}function O(N){return N===58?(s+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),y):N===45?(s+=1,y(N)):N===null||Zt(N)?w(N):S(N)}function y(N){return N===45?(e.enter("tableDelimiterFiller"),v(N)):S(N)}function v(N){return N===45?(e.consume(N),v):N===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),x):(e.exit("tableDelimiterFiller"),x(N))}function x(N){return Wn(N)?yr(e,w,"whitespace")(N):w(N)}function w(N){return N===124?b(N):N===null||Zt(N)?!a||i!==s?S(N):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(N)):S(N)}function S(N){return n(N)}function E(N){return e.enter("tableRow"),k(N)}function k(N){return N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),k):N===null||Zt(N)?(e.exit("tableRow"),t(N)):Wn(N)?yr(e,k,"whitespace")(N):(e.enter("data"),T(N))}function T(N){return N===null||N===124||ri(N)?(e.exit("data"),k(N)):(e.consume(N),N===92?C:T)}function C(N){return N===92||N===124?(e.consume(N),T):T(N)}}function Jqe(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 Gqe;for(;++nn[2]+1){const b=n[2]+1,g=n[3]-n[2]-1;e.add(b,g,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return i!==void 0&&(s.end=Object.assign({},Gg(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function fq(e,t,n,r,i){const s=[],a=Gg(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 Gg(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const eHe={name:"tasklistCheck",tokenize:nHe};function tHe(){return{text:{91:eHe}}}function nHe(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 ri(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 Zt(c)?t(c):Wn(c)?e.check({tokenize:rHe},t,n)(c):n(c)}}function rHe(e,t,n){return yr(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function iHe(e){return pce([Cqe(),Bqe(),Xqe(e),Zqe(),tHe()])}const sHe={};function aHe(e){const t=this,n=e||sHe,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(iHe(n)),s.push(kqe()),a.push(Tqe(n))}const hq=function(e,t,n){const r=gw(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 oue(e,t,n){return e.type==="element"?pHe(e,t,n):e.type==="text"?n.whitespace==="normal"?lue(e,n):mHe(e):[]}function pHe(e,t,n){const r=cue(e,n),i=e.children||[];let s=-1,a=[];if(fHe(e))return a;let l,c;for(yM(e)||bq(e)&&hq(t,e,bq)?c=` -`:dHe(e)?(l=2,c=2):aue(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},p=t.optional(i)+e.IDENT_RE+"\\s*\\(",b=["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"],g=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],O=["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"],y=["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:g,keyword:b,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:O},S={className:"function.dispatch",relevance:0,keywords:{_hint:y},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},T={className:"function",begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:w,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:w,relevance:0},{begin:p,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords: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 wHe(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=vHe(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 uue(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"],p=e.SHEBANG({binary:`(${h.join("|")})`,relevance:10}),b={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},g=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],O=["true","false"],y={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:g,literal:O,built_in:[...v,...x,"set","shopt",...w,...S]},contains:[p,e.SHEBANG(),b,f,s,a,y,l,c,u,d,n]}}function SHe(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},p=t.optional(i)+e.IDENT_RE+"\\s*\\(",O={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"},y=[f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],v={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:O,contains:y.concat([{begin:/\(/,end:/\)/,keywords:O,contains:y.concat(["self"]),relevance:0}]),relevance:0},x={begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:O,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:O,relevance:0},{begin:p,returnBegin:!0,contains:[e.inherit(h,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:O,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:O,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:O,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:f,strings:u,keywords:O}}}function EHe(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},p=t.optional(i)+e.IDENT_RE+"\\s*\\(",b=["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"],g=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],O=["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"],y=["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:g,keyword:b,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:O},S={className:"function.dispatch",relevance:0,keywords:{_hint:y},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},T={className:"function",begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:w,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:w,relevance:0},{begin:p,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords: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 kHe(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},p=e.inherit(h,{illegal:/\n/}),b={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,p]},g={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]},O=e.inherit(g,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},p]});h.contains=[g,b,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.C_BLOCK_COMMENT_MODE],p.contains=[O,b,f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const y={variants:[u,g,b,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"}},y,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:[y,c,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},w]}}const THe=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_-]*/}}),_He=["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"],AHe=["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"],CHe=[..._He,...AHe],NHe=["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(),jHe=["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(),RHe=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),IHe=["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 DHe(e){const t=e.regex,n=THe(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:":("+jHe.join("|")+")"},{begin:":(:)?("+RHe.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+IHe.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:NHe.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...l,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+CHe.join("|")+")\\b"}]}}function PHe(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 MHe(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:"fue(e,t,n-1))}function $He(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+fue("(?:<"+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,Oq,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},Oq,u]}}const yq="[A-Za-z$_][0-9A-Za-z$_]*",BHe=["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"],QHe=["true","false","null","undefined","NaN","Infinity"],hue=["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"],pue=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],mue=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],FHe=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],UHe=[].concat(mue,hue,pue);function gue(e){const t=e.regex,n=(L,{after:U})=>{const F="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(L,U)=>{const F=L[0].length+L.index,q=L.input[F];if(q==="<"||q===","){U.ignoreMatch();return}q===">"&&(n(L,{after:F})||U.ignoreMatch());let z;const B=L.input.substring(F);if(z=B.match(/^\s*=/)){U.ignoreMatch();return}if((z=B.match(/^\s+extends\s+/))&&z.index===0){U.ignoreMatch();return}}},l={$pattern:yq,keyword:BHe,literal:QHe,built_in:UHe,"variable.language":FHe},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:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},b={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},O={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,p,b,g,O,{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"}}]},T={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:{_:[...hue,...pue]}},C={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},N={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[E],illegal:/%/},_={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function R(L){return t.concat("(?!",L.join("|"),")")}const $={match:t.concat(/\b/,R([...mue,"super","import"].map(L=>`${L}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},D={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]},j="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",P={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(j)],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:T},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),C,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,b,g,O,v,{match:/\$\d+/},f,T,{scope:"attr",match:r+t.lookahead(":"),relevance:0},P,{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:j,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"]}]}]},N,{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},D,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[E]},$,_,k,M,{match:/\$[(.]/}]}}function bue(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 Wg="[0-9](_*[0-9])*",hE=`\\.(${Wg})`,pE="[0-9a-fA-F](_*[0-9a-fA-F])*",zHe={className:"number",variants:[{begin:`(\\b(${Wg})((${hE})|\\.)?|(${hE}))[eE][+-]?(${Wg})[fFdD]?\\b`},{begin:`\\b(${Wg})((${hE})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${hE})[fFdD]?\\b`},{begin:`\\b(${Wg})[fFdD]\\b`},{begin:`\\b0[xX]((${pE})\\.?|(${pE})?\\.(${pE}))[pP][+-]?(${Wg})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${pE})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function VHe(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=zHe,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 qHe=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_-]*/}}),HHe=["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"],XHe=["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"],GHe=[...HHe,...XHe],YHe=["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(),Oue=["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(),yue=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),WHe=["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(),ZHe=Oue.concat(yue).sort().reverse();function KHe(e){const t=qHe(e),n=ZHe,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:YHe.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}),p={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(l)},b={begin:s+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+WHe.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:l}}]},g={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}},O={className:"variable",variants:[{begin:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:h}},y={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:s,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,p,u("keyword","all\\b"),u("variable","@\\{"+i+"\\}"),{begin:"\\b("+GHe.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:":("+Oue.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+yue.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:h},{begin:"!important"},t.FUNCTION_DISPATCH]},v={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[y]};return a.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,g,O,v,b,y,p,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:a}}function JHe(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 xue(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 p=[n,c];return[u,d,f,h].forEach(y=>{y.contains=y.contains.concat(p)}),p=p.concat(u,d),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:p},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:p}]}]},n,s,u,d,{className:"quote",begin:"^>\\s+",contains:p,end:"$"},i,r,c,a,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function eXe(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 tXe(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=(g,O,y="\\1")=>{const v=y==="\\1"?y:t.concat(y,O);return t.concat(t.concat("(?:",g,")"),O,/(?:\\.|[^\\\/])*?/,v,/(?:\\.|[^\\\/])*?/,y,r)},p=(g,O,y)=>t.concat(t.concat("(?:",g,")"),O,/(?:\\.|[^\\\/])*?/,y,r),b=[c,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),a,{className:"string",contains:d,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},u,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:h("s|tr|y",t.either(...f,{capture:!0}))},{begin:h("s|tr|y","\\(","\\)")},{begin:h("s|tr|y","\\[","\\]")},{begin:h("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p("(?:m|qr)?",/\//,/\//)},{begin:p("m|qr",t.either(...f,{capture:!0}),/\1/)},{begin:p("m|qr",/\(/,/\)/)},{begin:p("m|qr",/\[/,/\]/)},{begin:p("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,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=b,a.contains=b,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:b}}function nXe(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":(D,M)=>{M.data._beginMatch=D[1]||D[2]},"on:end":(D,M)=>{M.data._beginMatch!==D[1]&&M.ignoreMatch()}},h=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),p=`[ -]`,b={scope:"string",variants:[d,u,f,h]},g={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},O=["false","null","true"],y=["__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:y,literal:(D=>{const M=[];return D.forEach(j=>{M.push(j),j.toLowerCase()===j?M.push(j.toUpperCase()):M.push(j.toLowerCase())}),M})(O),built_in:v},S=D=>D.map(M=>M.replace(/\|\d+$/,"")),E={variants:[{match:[/new/,t.concat(p,"+"),t.concat("(?!",S(v).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},k=t.concat(r,"\\b(?!\\()"),T={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(/(?!::)/))},N={relevance:0,begin:/\(/,end:/\)/,keywords:w,contains:[C,a,T,e.C_BLOCK_COMMENT_MODE,b,g,E]},_={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",S(y).join("\\b|"),"|",S(v).join("\\b|"),"\\b)"),r,t.concat(p,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[N]};N.contains.push(_);const R=[C,T,e.C_BLOCK_COMMENT_MODE,b,g,E],$={begin:t.concat(/#\[\s*\\?/,t.either(i,s)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:O,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:O,keyword:["new","array"]},contains:["self",...R]},...R,{scope:"meta",variants:[{match:i},{match:s}]}]};return{case_insensitive:!1,keywords:w,contains:[$,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,_,T,{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",$,a,T,e.C_BLOCK_COMMENT_MODE,b,g]}]},{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]},b,g]}}function rXe(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 iXe(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function wue(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])*",p=`(\\b(${h}))?\\.(${h})|\\b(${h})\\.`,b=`\\b|${r.join("|")}`,g={className:"number",relevance:0,variants:[{begin:`(\\b(${h})|(${p}))[eE][+-]?(${h})[jJ]?(?=${b})`},{begin:`(${p})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${b})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${b})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${b})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${b})`},{begin:`\\b(${h})[jJ](?=${b})`}]},O={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:l,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},y={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:["self",c,g,f,e.HASH_COMMENT_MODE]}]};return u.contains=[f,g,c],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:l,illegal:/(<\/|\?)|=>/,contains:[c,g,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},f,O,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[y]},{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:[g,y,f]}]}}function sXe(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function aXe(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 oXe(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",p="[0-9](_?[0-9])*",b={className:"number",relevance:0,variants:[{begin:`\\b(${h})(\\.(${p}))?([eE][+-]?(${p})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},g={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:[g]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[f,{begin:n}],relevance:0},b,{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,g.contains=E;const N=[{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(N).concat(u).concat(E)}}function lXe(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 cXe=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_-]*/}}),uXe=["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"],dXe=["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"],fXe=[...uXe,...dXe],hXe=["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(),pXe=["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(),mXe=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),gXe=["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 bXe(e){const t=cXe(e),n=mXe,r=pXe,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("+fXe.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("+gXe.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:hXe.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 OXe(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function yXe(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"],p=d,b=[...u,...c].filter(S=>!d.includes(S)),g={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},O={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},y={match:t.concat(/\b/,t.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};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 T=k;return E=E||[],S.map(C=>C.match(/\|\d+$/)||E.includes(C)?C:T(C)?`${C}|0`:C)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:w(b,{when:S=>S.length<3}),literal:s,type:l,built_in:f},contains:[{scope:"type",match:v(a)},x,y,g,r,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,O]}}function Sue(e){return e?typeof e=="string"?e:e.source:null}function Ey(e){return Vr("(?=",e,")")}function Vr(...e){return e.map(n=>Sue(n)).join("")}function xXe(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function $a(...e){return"("+(xXe(e).capture?"":"?:")+e.map(r=>Sue(r)).join("|")+")"}const V$=e=>Vr(/\b/,e,/\w$/.test(e)?/\b/:/\B/),vXe=["Protocol","Type"].map(V$),xq=["init","self"].map(V$),wXe=["Any","Self"],BR=["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"],vq=["false","nil","true"],SXe=["assignment","associativity","higherThan","left","lowerThan","none","right"],EXe=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],wq=["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"],Eue=$a(/[/=\-+!*%<>&|^~?]/,/[\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]/),kue=$a(Eue,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),QR=Vr(Eue,kue,"*"),Tue=$a(/[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]/),I2=$a(Tue,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Jc=Vr(Tue,I2,"*"),mE=Vr(/[A-Z]/,I2,"*"),kXe=["attached","autoclosure",Vr(/convention\(/,$a("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Vr(/objc\(/,Jc,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],TXe=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function _Xe(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],i={match:[/\./,$a(...vXe,...xq)],className:{2:"keyword"}},s={match:Vr(/\./,$a(...BR)),relevance:0},a=BR.filter(le=>typeof le=="string").concat(["_|0"]),l=BR.filter(le=>typeof le!="string").concat(wXe).map(V$),c={variants:[{className:"keyword",match:$a(...l,...xq)}]},u={$pattern:$a(/\b\w+/,/#\w+/),keyword:a.concat(EXe),literal:vq},d=[i,s,c],f={match:Vr(/\./,$a(...wq)),relevance:0},h={className:"built_in",match:Vr(/\b/,$a(...wq),/(?=\()/)},p=[f,h],b={match:/->/,relevance:0},g={className:"operator",relevance:0,variants:[{match:QR},{match:`\\.(\\.|${kue})+`}]},O=[b,g],y="([0-9]_*)+",v="([0-9a-fA-F]_*)+",x={className:"number",relevance:0,variants:[{match:`\\b(${y})(\\.(${y}))?([eE][+-]?(${y}))?\\b`},{match:`\\b0x(${v})(\\.(${v}))?([pP][+-]?(${y}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},w=(le="")=>({className:"subst",variants:[{match:Vr(/\\/,le,/[0\\tnr"']/)},{match:Vr(/\\/,le,/u\{[0-9a-fA-F]{1,8}\}/)}]}),S=(le="")=>({className:"subst",match:Vr(/\\/,le,/[\t ]*(?:[\r\n]|\r\n)/)}),E=(le="")=>({className:"subst",label:"interpol",begin:Vr(/\\/,le,/\(/),end:/\)/}),k=(le="")=>({begin:Vr(le,/"""/),end:Vr(/"""/,le),contains:[w(le),S(le),E(le)]}),T=(le="")=>({begin:Vr(le,/"/),end:Vr(/"/,le),contains:[w(le),E(le)]}),C={className:"string",variants:[k(),k("#"),k("##"),k("###"),T(),T("#"),T("##"),T("###")]},N=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],_={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:N},R=le=>{const ke=Vr(le,/\//),ye=Vr(/\//,le);return{begin:ke,end:ye,contains:[...N,{scope:"comment",begin:`#(?!.*${ye})`,end:/$/}]}},$={scope:"regexp",variants:[R("###"),R("##"),R("#"),_]},D={match:Vr(/`/,Jc,/`/)},M={className:"variable",match:/\$\d+/},j={className:"variable",match:`\\$${I2}+`},P=[D,M,j],L={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:TXe,contains:[...O,x,C]}]}},U={scope:"keyword",match:Vr(/@/,$a(...kXe),Ey($a(/\(/,/\s+/)))},F={scope:"meta",match:Vr(/@/,Jc)},q=[L,U,F],z={match:Ey(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Vr(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,I2,"+")},{className:"type",match:mE,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Vr(/\s+&\s+/,Ey(mE)),relevance:0}]},B={begin://,keywords:u,contains:[...r,...d,...q,b,z]};z.contains.push(B);const V={match:Vr(Jc,/\s*:/),keywords:"_|0",relevance:0},ce={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",V,...r,$,...d,...p,...O,x,C,...P,...q,z]},we={begin://,keywords:"repeat each",contains:[...r,z]},Oe={begin:$a(Ey(Vr(Jc,/\s*:/)),Ey(Vr(Jc,/\s+/,Jc,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Jc}]},de={begin:/\(/,end:/\)/,keywords:u,contains:[Oe,...r,...d,...O,x,C,...q,z,ce],endsParent:!0,illegal:/["']/},Z={match:[/(func|macro)/,/\s+/,$a(D.match,Jc,QR)],className:{1:"keyword",3:"title.function"},contains:[we,de,t],illegal:[/\[/,/%/]},J={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[we,de,t],illegal:/\[|%/},fe={match:[/operator/,/\s+/,QR],className:{1:"keyword",3:"title"}},be={begin:[/precedencegroup/,/\s+/,mE],className:{1:"keyword",3:"title"},contains:[z],keywords:[...SXe,...vq],end:/}/},je={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Qe={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},Me={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,Jc,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:u,contains:[we,...d,{begin:/:/,end:/\{/,keywords:u,contains:[{scope:"title.class.inherited",match:mE},...d],relevance:0}]};for(const le of C.variants){const ke=le.contains.find($e=>$e.label==="interpol");ke.keywords=u;const ye=[...d,...p,...O,x,C,...P];ke.contains=[...ye,{begin:/\(/,end:/\)/,contains:["self",...ye]}]}return{name:"Swift",keywords:u,contains:[...r,Z,J,je,Qe,Me,fe,be,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},$,...d,...p,...O,x,C,...P,...q,z,ce]}}const D2="[A-Za-z$_][0-9A-Za-z$_]*",_ue=["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"],Aue=["true","false","null","undefined","NaN","Infinity"],Cue=["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"],Nue=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],jue=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Rue=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Iue=[].concat(jue,Cue,Nue);function AXe(e){const t=e.regex,n=(L,{after:U})=>{const F="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(L,U)=>{const F=L[0].length+L.index,q=L.input[F];if(q==="<"||q===","){U.ignoreMatch();return}q===">"&&(n(L,{after:F})||U.ignoreMatch());let z;const B=L.input.substring(F);if(z=B.match(/^\s*=/)){U.ignoreMatch();return}if((z=B.match(/^\s+extends\s+/))&&z.index===0){U.ignoreMatch();return}}},l={$pattern:D2,keyword:_ue,literal:Aue,built_in:Iue,"variable.language":Rue},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:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},b={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},O={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,p,b,g,O,{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"}}]},T={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:{_:[...Cue,...Nue]}},C={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},N={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[E],illegal:/%/},_={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function R(L){return t.concat("(?!",L.join("|"),")")}const $={match:t.concat(/\b/,R([...jue,"super","import"].map(L=>`${L}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},D={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]},j="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",P={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(j)],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:T},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),C,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,b,g,O,v,{match:/\$\d+/},f,T,{scope:"attr",match:r+t.lookahead(":"),relevance:0},P,{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:j,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"]}]}]},N,{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},D,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[E]},$,_,k,M,{match:/\$[(.]/}]}}function Due(e){const t=e.regex,n=AXe(e),r=D2,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:D2,keyword:_ue.concat(c),literal:Aue,built_in:Iue.concat(i),"variable.language":Rue},d={className:"meta",begin:"@"+r},f=(g,O,y)=>{const v=g.contains.findIndex(x=>x.label===O);if(v===-1)throw new Error("can not find mode to replace");g.contains.splice(v,1,y)};Object.assign(n.keywords,u),n.exports.PARAMS_CONTAINS.push(d);const h=n.contains.find(g=>g.scope==="attr"),p=Object.assign({},h,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,h,p]),n.contains=n.contains.concat([d,s,a,p]),f(n,"shebang",e.SHEBANG()),f(n,"use_strict",l);const b=n.contains.find(g=>g.label==="func.def");return b.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function CXe(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 NXe(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 jXe(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 Pue(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"},p={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},b={begin:/\{/,end:/\}/,contains:[p],illegal:"\\n",relevance:0},g={begin:"\\[",end:"\\]",contains:[p],illegal:"\\n",relevance:0},O=[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},b,g,s,a],y=[...O];return y.pop(),y.push(l),p.contains=y,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:O}}const RXe={arduino:wHe,bash:uue,c:SHe,cpp:EHe,csharp:kHe,css:DHe,diff:PHe,go:MHe,graphql:LHe,ini:due,java:$He,javascript:gue,json:bue,kotlin:VHe,less:KHe,lua:JHe,makefile:xue,markdown:vue,objectivec:eXe,perl:tXe,php:nXe,"php-template":rXe,plaintext:iXe,python:wue,"python-repl":sXe,r:aXe,ruby:oXe,rust:lXe,scss:bXe,shell:OXe,sql:yXe,swift:_Xe,typescript:Due,vbnet:CXe,wasm:NXe,xml:jXe,yaml:Pue};function Mue(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)&&Mue(n)}),e}let Sq=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function Lue(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function sh(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 IXe="",Eq=e=>!!e.scope,DXe=(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 PXe{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=Lue(t)}openNode(t){if(!Eq(t))return;const n=DXe(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){Eq(t)&&(this.buffer+=IXe)}value(){return this.buffer}span(t){this.buffer+=``}}const kq=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class q${constructor(){this.rootNode=kq(),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=kq({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=>{q$._collapse(n)}))}}class MXe extends q${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 PXe(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Kx(e){return e?typeof e=="string"?e:e.source:null}function $ue(e){return Km("(?=",e,")")}function LXe(e){return Km("(?:",e,")*")}function $Xe(e){return Km("(?:",e,")?")}function Km(...e){return e.map(n=>Kx(n)).join("")}function BXe(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function H$(...e){return"("+(BXe(e).capture?"":"?:")+e.map(r=>Kx(r)).join("|")+")"}function Bue(e){return new RegExp(e.toString()+"|").exec("").length-1}function QXe(e,t){const n=e&&e.exec(t);return n&&n.index===0}const FXe=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function X$(e,{joinWith:t}){let n=0;return e.map(r=>{n+=1;const i=n;let s=Kx(r),a="";for(;s.length>0;){const l=FXe.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 UXe=/\b\B/,Que="[a-zA-Z]\\w*",G$="[a-zA-Z_]\\w*",Fue="\\b\\d+(\\.\\d+)?",Uue="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",zue="\\b(0b[01]+)",zXe="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",VXe=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=Km(t,/.*\b/,e.binary,/\b.*/)),sh({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},e)},Jx={begin:"\\\\[\\s\\S]",relevance:0},qXe={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Jx]},HXe={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Jx]},XXe={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/},oC=function(e,t,n={}){const r=sh({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=H$("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:Km(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},GXe=oC("//","$"),YXe=oC("/\\*","\\*/"),WXe=oC("#","$"),ZXe={scope:"number",begin:Fue,relevance:0},KXe={scope:"number",begin:Uue,relevance:0},JXe={scope:"number",begin:zue,relevance:0},eGe={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Jx,{begin:/\[/,end:/\]/,relevance:0,contains:[Jx]}]},tGe={scope:"title",begin:Que,relevance:0},nGe={scope:"title",begin:G$,relevance:0},rGe={begin:"\\.\\s*"+G$,relevance:0},iGe=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 gE=Object.freeze({__proto__:null,APOS_STRING_MODE:qXe,BACKSLASH_ESCAPE:Jx,BINARY_NUMBER_MODE:JXe,BINARY_NUMBER_RE:zue,COMMENT:oC,C_BLOCK_COMMENT_MODE:YXe,C_LINE_COMMENT_MODE:GXe,C_NUMBER_MODE:KXe,C_NUMBER_RE:Uue,END_SAME_AS_BEGIN:iGe,HASH_COMMENT_MODE:WXe,IDENT_RE:Que,MATCH_NOTHING_RE:UXe,METHOD_GUARD:rGe,NUMBER_MODE:ZXe,NUMBER_RE:Fue,PHRASAL_WORDS_MODE:XXe,QUOTE_STRING_MODE:HXe,REGEXP_MODE:eGe,RE_STARTERS_RE:zXe,SHEBANG:VXe,TITLE_MODE:tGe,UNDERSCORE_IDENT_RE:G$,UNDERSCORE_TITLE_MODE:nGe});function sGe(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function aGe(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function oGe(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=sGe,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function lGe(e,t){Array.isArray(e.illegal)&&(e.illegal=H$(...e.illegal))}function cGe(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 uGe(e,t){e.relevance===void 0&&(e.relevance=1)}const dGe=(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=Km(n.beforeMatch,$ue(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},fGe=["of","and","for","in","not","or","if","then","parent","list","value"],hGe="keyword";function Vue(e,t,n=hGe){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,Vue(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,pGe(c[0],c[1])]})}}function pGe(e,t){return t?Number(t):mGe(e)?0:1}function mGe(e){return fGe.includes(e.toLowerCase())}const Tq={},fm=e=>{console.error(e)},_q=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Ng=(e,t)=>{Tq[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),Tq[`${e}/${t}`]=!0)},P2=new Error;function que(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+=Bue(t[l-1]);e[n]=a,e[n]._emit=s,e[n]._multi=!0}function gGe(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw fm("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),P2;if(typeof e.beginScope!="object"||e.beginScope===null)throw fm("beginScope must be object"),P2;que(e,e.begin,{key:"beginScope"}),e.begin=X$(e.begin,{joinWith:""})}}function bGe(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw fm("skip, excludeEnd, returnEnd not compatible with endScope: {}"),P2;if(typeof e.endScope!="object"||e.endScope===null)throw fm("endScope must be object"),P2;que(e,e.end,{key:"endScope"}),e.end=X$(e.end,{joinWith:""})}}function OGe(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function yGe(e){OGe(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),gGe(e),bGe(e)}function xGe(e){function t(a,l){return new RegExp(Kx(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+=Bue(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const l=this.regexes.map(c=>c[1]);this.matcherRe=t(X$(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;[aGe,cGe,yGe,dGe].forEach(d=>d(a,l)),e.compilerExtensions.forEach(d=>d(a,l)),a.__beforeBegin=null,[oGe,lGe,uGe].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=Vue(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=Kx(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 vGe(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=sh(e.classNameAliases||{}),s(e)}function Hue(e){return e?e.endsWithParent||Hue(e.starts):!1}function vGe(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return sh(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:Hue(e)?sh(e,{starts:e.starts?sh(e.starts):null}):Object.isFrozen(e)?sh(e):e}var wGe="11.11.1";class SGe extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}}const FR=Lue,Aq=sh,Cq=Symbol("nomatch"),EGe=7,Xue=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:MXe};function c(j){return l.noHighlightRe.test(j)}function u(j){let P=j.className+" ";P+=j.parentNode?j.parentNode.className:"";const L=l.languageDetectRe.exec(P);if(L){const U=T(L[1]);return U||(_q(s.replace("{}",L[1])),_q("Falling back to no-highlight mode for this block.",j)),U?L[1]:"no-highlight"}return P.split(/\s+/).find(U=>c(U)||T(U))}function d(j,P,L){let U="",F="";typeof P=="object"?(U=j,L=P.ignoreIllegals,F=P.language):(Ng("10.7.0","highlight(lang, code, ...args) has been deprecated."),Ng("10.7.0",`Please use highlight(code, options) instead. -https://github.com/highlightjs/highlight.js/issues/2277`),F=j,U=P),L===void 0&&(L=!0);const q={code:U,language:F};D("before:highlight",q);const z=q.result?q.result:f(q.language,q.code,L);return z.code=q.code,D("after:highlight",z),z}function f(j,P,L,U){const F=Object.create(null);function q(W,ne){return W.keywords[ne]}function z(){if(!ye.keywords){ze.addText(Ae);return}let W=0;ye.keywordPatternRe.lastIndex=0;let ne=ye.keywordPatternRe.exec(Ae),he="";for(;ne;){he+=Ae.substring(W,ne.index);const xe=Me.case_insensitive?ne[0].toLowerCase():ne[0],re=q(ye,xe);if(re){const[Re,nt]=re;if(ze.addText(he),he="",F[xe]=(F[xe]||0)+1,F[xe]<=EGe&&(Ve+=nt),Re.startsWith("_"))he+=ne[0];else{const Ke=Me.classNameAliases[Re]||Re;ce(ne[0],Ke)}}else he+=ne[0];W=ye.keywordPatternRe.lastIndex,ne=ye.keywordPatternRe.exec(Ae)}he+=Ae.substring(W),ze.addText(he)}function B(){if(Ae==="")return;let W=null;if(typeof ye.subLanguage=="string"){if(!t[ye.subLanguage]){ze.addText(Ae);return}W=f(ye.subLanguage,Ae,!0,$e[ye.subLanguage]),$e[ye.subLanguage]=W._top}else W=p(Ae,ye.subLanguage.length?ye.subLanguage:null);ye.relevance>0&&(Ve+=W.relevance),ze.__addSublanguage(W._emitter,W.language)}function V(){ye.subLanguage!=null?B():z(),Ae=""}function ce(W,ne){W!==""&&(ze.startScope(ne),ze.addText(W),ze.endScope())}function we(W,ne){let he=1;const xe=ne.length-1;for(;he<=xe;){if(!W._emit[he]){he++;continue}const re=Me.classNameAliases[W[he]]||W[he],Re=ne[he];re?ce(Re,re):(Ae=Re,z(),Ae=""),he++}}function Oe(W,ne){return W.scope&&typeof W.scope=="string"&&ze.openNode(Me.classNameAliases[W.scope]||W.scope),W.beginScope&&(W.beginScope._wrap?(ce(Ae,Me.classNameAliases[W.beginScope._wrap]||W.beginScope._wrap),Ae=""):W.beginScope._multi&&(we(W.beginScope,ne),Ae="")),ye=Object.create(W,{parent:{value:ye}}),ye}function de(W,ne,he){let xe=QXe(W.endRe,he);if(xe){if(W["on:end"]){const re=new Sq(W);W["on:end"](ne,re),re.isMatchIgnored&&(xe=!1)}if(xe){for(;W.endsParent&&W.parent;)W=W.parent;return W}}if(W.endsWithParent)return de(W.parent,ne,he)}function Z(W){return ye.matcher.regexIndex===0?(Ae+=W[0],1):(We=!0,0)}function J(W){const ne=W[0],he=W.rule,xe=new Sq(he),re=[he.__beforeBegin,he["on:begin"]];for(const Re of re)if(Re&&(Re(W,xe),xe.isMatchIgnored))return Z(ne);return he.skip?Ae+=ne:(he.excludeBegin&&(Ae+=ne),V(),!he.returnBegin&&!he.excludeBegin&&(Ae=ne)),Oe(he,W),he.returnBegin?0:ne.length}function fe(W){const ne=W[0],he=P.substring(W.index),xe=de(ye,W,he);if(!xe)return Cq;const re=ye;ye.endScope&&ye.endScope._wrap?(V(),ce(ne,ye.endScope._wrap)):ye.endScope&&ye.endScope._multi?(V(),we(ye.endScope,W)):re.skip?Ae+=ne:(re.returnEnd||re.excludeEnd||(Ae+=ne),V(),re.excludeEnd&&(Ae=ne));do ye.scope&&ze.closeNode(),!ye.skip&&!ye.subLanguage&&(Ve+=ye.relevance),ye=ye.parent;while(ye!==xe.parent);return xe.starts&&Oe(xe.starts,W),re.returnEnd?0:ne.length}function be(){const W=[];for(let ne=ye;ne!==Me;ne=ne.parent)ne.scope&&W.unshift(ne.scope);W.forEach(ne=>ze.openNode(ne))}let je={};function Qe(W,ne){const he=ne&&ne[0];if(Ae+=W,he==null)return V(),0;if(je.type==="begin"&&ne.type==="end"&&je.index===ne.index&&he===""){if(Ae+=P.slice(ne.index,ne.index+1),!i){const xe=new Error(`0 width match regex (${j})`);throw xe.languageName=j,xe.badRule=je.rule,xe}return 1}if(je=ne,ne.type==="begin")return J(ne);if(ne.type==="illegal"&&!L){const xe=new Error('Illegal lexeme "'+he+'" for mode "'+(ye.scope||"")+'"');throw xe.mode=ye,xe}else if(ne.type==="end"){const xe=fe(ne);if(xe!==Cq)return xe}if(ne.type==="illegal"&&he==="")return Ae+=` -`,1;if(Tt>1e5&&Tt>ne.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Ae+=he,he.length}const Me=T(j);if(!Me)throw fm(s.replace("{}",j)),new Error('Unknown language: "'+j+'"');const le=xGe(Me);let ke="",ye=U||le;const $e={},ze=new l.__emitter(l);be();let Ae="",Ve=0,ut=0,Tt=0,We=!1;try{if(Me.__emitTokens)Me.__emitTokens(P,ze);else{for(ye.matcher.considerAll();;){Tt++,We?We=!1:ye.matcher.considerAll(),ye.matcher.lastIndex=ut;const W=ye.matcher.exec(P);if(!W)break;const ne=P.substring(ut,W.index),he=Qe(ne,W);ut=W.index+he}Qe(P.substring(ut))}return ze.finalize(),ke=ze.toHTML(),{language:j,value:ke,relevance:Ve,illegal:!1,_emitter:ze,_top:ye}}catch(W){if(W.message&&W.message.includes("Illegal"))return{language:j,value:FR(P),illegal:!0,relevance:0,_illegalBy:{message:W.message,index:ut,context:P.slice(ut-100,ut+100),mode:W.mode,resultSoFar:ke},_emitter:ze};if(i)return{language:j,value:FR(P),illegal:!1,relevance:0,errorRaised:W,_emitter:ze,_top:ye};throw W}}function h(j){const P={value:FR(j),illegal:!1,relevance:0,_top:a,_emitter:new l.__emitter(l)};return P._emitter.addText(j),P}function p(j,P){P=P||l.languages||Object.keys(t);const L=h(j),U=P.filter(T).filter(N).map(V=>f(V,j,!1));U.unshift(L);const F=U.sort((V,ce)=>{if(V.relevance!==ce.relevance)return ce.relevance-V.relevance;if(V.language&&ce.language){if(T(V.language).supersetOf===ce.language)return 1;if(T(ce.language).supersetOf===V.language)return-1}return 0}),[q,z]=F,B=q;return B.secondBest=z,B}function b(j,P,L){const U=P&&n[P]||L;j.classList.add("hljs"),j.classList.add(`language-${U}`)}function g(j){let P=null;const L=u(j);if(c(L))return;if(D("before:highlightElement",{el:j,language:L}),j.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",j);return}if(j.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(j)),l.throwUnescapedHTML))throw new SGe("One of your code blocks includes unescaped HTML.",j.innerHTML);P=j;const U=P.textContent,F=L?d(U,{language:L,ignoreIllegals:!0}):p(U);j.innerHTML=F.value,j.dataset.highlighted="yes",b(j,L,F.language),j.result={language:F.language,re:F.relevance,relevance:F.relevance},F.secondBest&&(j.secondBest={language:F.secondBest.language,relevance:F.secondBest.relevance}),D("after:highlightElement",{el:j,result:F,text:U})}function O(j){l=Aq(l,j)}const y=()=>{w(),Ng("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function v(){w(),Ng("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let x=!1;function w(){function j(){w()}if(document.readyState==="loading"){x||window.addEventListener("DOMContentLoaded",j,!1),x=!0;return}document.querySelectorAll(l.cssSelector).forEach(g)}function S(j,P){let L=null;try{L=P(e)}catch(U){if(fm("Language definition for '{}' could not be registered.".replace("{}",j)),i)fm(U);else throw U;L=a}L.name||(L.name=j),t[j]=L,L.rawDefinition=P.bind(null,e),L.aliases&&C(L.aliases,{languageName:j})}function E(j){delete t[j];for(const P of Object.keys(n))n[P]===j&&delete n[P]}function k(){return Object.keys(t)}function T(j){return j=(j||"").toLowerCase(),t[j]||t[n[j]]}function C(j,{languageName:P}){typeof j=="string"&&(j=[j]),j.forEach(L=>{n[L.toLowerCase()]=P})}function N(j){const P=T(j);return P&&!P.disableAutodetect}function _(j){j["before:highlightBlock"]&&!j["before:highlightElement"]&&(j["before:highlightElement"]=P=>{j["before:highlightBlock"](Object.assign({block:P.el},P))}),j["after:highlightBlock"]&&!j["after:highlightElement"]&&(j["after:highlightElement"]=P=>{j["after:highlightBlock"](Object.assign({block:P.el},P))})}function R(j){_(j),r.push(j)}function $(j){const P=r.indexOf(j);P!==-1&&r.splice(P,1)}function D(j,P){const L=j;r.forEach(function(U){U[L]&&U[L](P)})}function M(j){return Ng("10.7.0","highlightBlock will be removed entirely in v12.0"),Ng("10.7.0","Please use highlightElement now."),g(j)}Object.assign(e,{highlight:d,highlightAuto:p,highlightAll:w,highlightElement:g,highlightBlock:M,configure:O,initHighlighting:y,initHighlightingOnLoad:v,registerLanguage:S,unregisterLanguage:E,listLanguages:k,getLanguage:T,registerAliases:C,autoDetection:N,inherit:Aq,addPlugin:R,removePlugin:$}),e.debugMode=function(){i=!1},e.safeMode=function(){i=!0},e.versionString=wGe,e.regex={concat:Km,lookahead:$ue,either:H$,optional:$Xe,anyNumberOfTimes:LXe};for(const j in gE)typeof gE[j]=="object"&&Mue(gE[j]);return Object.assign(e,gE),e},$b=Xue({});$b.newInstance=()=>Xue({});var kGe=$b;$b.HighlightJS=$b;$b.default=$b;const yo=Jb(kGe),Nq={},TGe="hljs-";function _Ge(e){const t=yo.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||Nq,h=typeof f.prefix=="string"?f.prefix:TGe;if(!t.getLanguage(c))throw new Error("Unknown language: `"+c+"` is not registered");t.configure({__emitter:AGe,classPrefix:h});const p=t.highlight(u,{ignoreIllegals:!0,language:c});if(p.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:p.errorRaised});const b=p._emitter.root,g=b.data;return g.language=p.language,g.relevance=p.relevance,b}function r(c,u){const f=(u||Nq).subset||i();let h=-1,p=0,b;for(;++hp&&(p=O.data.relevance,b=O)}return b||{type:"root",children:[],data:{language:void 0,relevance:p}}}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 AGe{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 CGe={};function jq(e){const t=e||CGe,n=t.aliases,r=t.detect||!1,i=t.languages||RXe,s=t.plainText,a=t.prefix,l=t.subset;let c="hljs";const u=_Ge(i);if(n&&u.registerAlias(n),a){const d=a.indexOf("-");c=d===-1?a:a.slice(0,d)}return function(d,f){bw(d,"element",function(h,p,b){if(h.tagName!=="code"||!b||b.type!=="element"||b.tagName!=="pre")return;const g=NGe(h);if(g===!1||!g&&!r||g&&s&&s.includes(g))return;Array.isArray(h.properties.className)||(h.properties.className=[]),h.properties.className.includes(c)||h.properties.className.unshift(c);const O=hHe(h,{whitespace:"pre"});let y;try{y=g?u.highlight(g,O,{prefix:a}):u.highlightAuto(O,{prefix:a,subset:l})}catch(v){const x=v;if(g&&/Unknown language/.test(x.message)){f.message("Cannot highlight as `"+g+"`, it’s not registered",{ancestors:[b,h],cause:x,place:h.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw x}!g&&y.data&&y.data.language&&h.properties.className.push("language-"+y.data.language),y.children.length>0&&(h.children=y.children)})}}function NGe(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=Dq(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 nYe(e){return e>=56320&&e<=57343}function rYe(e,t){return(e-55296)*1024+9216+t}function Jue(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function ede(e){return e>=64976&&e<=65007||tYe.has(e)}var Be;(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"})(Be||(Be={}));const iYe=65536;class sYe{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=iYe,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(nYe(n))return this.pos++,this._addGap(),rYe(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,K.EOF;return this._err(Be.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,K.EOF;const r=this.html.charCodeAt(n);return r===K.CARRIAGE_RETURN?K.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,K.EOF;let t=this.html.charCodeAt(this.pos);return t===K.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,K.LINE_FEED):t===K.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,Kue(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===K.LINE_FEED||t===K.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){Jue(t)?this._err(Be.controlCharacterInInputStream):ede(t)&&this._err(Be.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 aYe=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))),oYe=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 lYe(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=oYe.get(e))!==null&&t!==void 0?t:e}var qs;(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"})(qs||(qs={}));const cYe=32;var ah;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(ah||(ah={}));function vM(e){return e>=qs.ZERO&&e<=qs.NINE}function uYe(e){return e>=qs.UPPER_A&&e<=qs.UPPER_F||e>=qs.LOWER_A&&e<=qs.LOWER_F}function dYe(e){return e>=qs.UPPER_A&&e<=qs.UPPER_Z||e>=qs.LOWER_A&&e<=qs.LOWER_Z||vM(e)}function fYe(e){return e===qs.EQUALS||dYe(e)}var Ls;(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"})(Ls||(Ls={}));var Od;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(Od||(Od={}));class hYe{constructor(t,n,r){this.decodeTree=t,this.emitCodePoint=n,this.errors=r,this.state=Ls.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Od.Strict}startEntity(t){this.decodeMode=t,this.state=Ls.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case Ls.EntityStart:return t.charCodeAt(n)===qs.NUM?(this.state=Ls.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=Ls.NamedEntity,this.stateNamedEntity(t,n));case Ls.NumericStart:return this.stateNumericStart(t,n);case Ls.NumericDecimal:return this.stateNumericDecimal(t,n);case Ls.NumericHex:return this.stateNumericHex(t,n);case Ls.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|cYe)===qs.LOWER_X?(this.state=Ls.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=Ls.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===qs.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==Od.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]&ah.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]&~ah.VALUE_LENGTH:i[t+1],r),n===3&&this.emitCodePoint(i[t+2],r),r}end(){var t;switch(this.state){case Ls.NamedEntity:return this.result!==0&&(this.decodeMode!==Od.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Ls.NumericDecimal:return this.emitNumericEntity(0,2);case Ls.NumericHex:return this.emitNumericEntity(0,3);case Ls.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Ls.EntityStart:return 0}}}function pYe(e,t,n,r){const i=(t&ah.BRANCH_LENGTH)>>7,s=t&ah.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 et;(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/"})(et||(et={}));var hm;(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"})(hm||(hm={}));var Tl;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(Tl||(Tl={}));var Te;(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"})(Te||(Te={}));var A;(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"})(A||(A={}));const mYe=new Map([[Te.A,A.A],[Te.ADDRESS,A.ADDRESS],[Te.ANNOTATION_XML,A.ANNOTATION_XML],[Te.APPLET,A.APPLET],[Te.AREA,A.AREA],[Te.ARTICLE,A.ARTICLE],[Te.ASIDE,A.ASIDE],[Te.B,A.B],[Te.BASE,A.BASE],[Te.BASEFONT,A.BASEFONT],[Te.BGSOUND,A.BGSOUND],[Te.BIG,A.BIG],[Te.BLOCKQUOTE,A.BLOCKQUOTE],[Te.BODY,A.BODY],[Te.BR,A.BR],[Te.BUTTON,A.BUTTON],[Te.CAPTION,A.CAPTION],[Te.CENTER,A.CENTER],[Te.CODE,A.CODE],[Te.COL,A.COL],[Te.COLGROUP,A.COLGROUP],[Te.DD,A.DD],[Te.DESC,A.DESC],[Te.DETAILS,A.DETAILS],[Te.DIALOG,A.DIALOG],[Te.DIR,A.DIR],[Te.DIV,A.DIV],[Te.DL,A.DL],[Te.DT,A.DT],[Te.EM,A.EM],[Te.EMBED,A.EMBED],[Te.FIELDSET,A.FIELDSET],[Te.FIGCAPTION,A.FIGCAPTION],[Te.FIGURE,A.FIGURE],[Te.FONT,A.FONT],[Te.FOOTER,A.FOOTER],[Te.FOREIGN_OBJECT,A.FOREIGN_OBJECT],[Te.FORM,A.FORM],[Te.FRAME,A.FRAME],[Te.FRAMESET,A.FRAMESET],[Te.H1,A.H1],[Te.H2,A.H2],[Te.H3,A.H3],[Te.H4,A.H4],[Te.H5,A.H5],[Te.H6,A.H6],[Te.HEAD,A.HEAD],[Te.HEADER,A.HEADER],[Te.HGROUP,A.HGROUP],[Te.HR,A.HR],[Te.HTML,A.HTML],[Te.I,A.I],[Te.IMG,A.IMG],[Te.IMAGE,A.IMAGE],[Te.INPUT,A.INPUT],[Te.IFRAME,A.IFRAME],[Te.KEYGEN,A.KEYGEN],[Te.LABEL,A.LABEL],[Te.LI,A.LI],[Te.LINK,A.LINK],[Te.LISTING,A.LISTING],[Te.MAIN,A.MAIN],[Te.MALIGNMARK,A.MALIGNMARK],[Te.MARQUEE,A.MARQUEE],[Te.MATH,A.MATH],[Te.MENU,A.MENU],[Te.META,A.META],[Te.MGLYPH,A.MGLYPH],[Te.MI,A.MI],[Te.MO,A.MO],[Te.MN,A.MN],[Te.MS,A.MS],[Te.MTEXT,A.MTEXT],[Te.NAV,A.NAV],[Te.NOBR,A.NOBR],[Te.NOFRAMES,A.NOFRAMES],[Te.NOEMBED,A.NOEMBED],[Te.NOSCRIPT,A.NOSCRIPT],[Te.OBJECT,A.OBJECT],[Te.OL,A.OL],[Te.OPTGROUP,A.OPTGROUP],[Te.OPTION,A.OPTION],[Te.P,A.P],[Te.PARAM,A.PARAM],[Te.PLAINTEXT,A.PLAINTEXT],[Te.PRE,A.PRE],[Te.RB,A.RB],[Te.RP,A.RP],[Te.RT,A.RT],[Te.RTC,A.RTC],[Te.RUBY,A.RUBY],[Te.S,A.S],[Te.SCRIPT,A.SCRIPT],[Te.SEARCH,A.SEARCH],[Te.SECTION,A.SECTION],[Te.SELECT,A.SELECT],[Te.SOURCE,A.SOURCE],[Te.SMALL,A.SMALL],[Te.SPAN,A.SPAN],[Te.STRIKE,A.STRIKE],[Te.STRONG,A.STRONG],[Te.STYLE,A.STYLE],[Te.SUB,A.SUB],[Te.SUMMARY,A.SUMMARY],[Te.SUP,A.SUP],[Te.TABLE,A.TABLE],[Te.TBODY,A.TBODY],[Te.TEMPLATE,A.TEMPLATE],[Te.TEXTAREA,A.TEXTAREA],[Te.TFOOT,A.TFOOT],[Te.TD,A.TD],[Te.TH,A.TH],[Te.THEAD,A.THEAD],[Te.TITLE,A.TITLE],[Te.TR,A.TR],[Te.TRACK,A.TRACK],[Te.TT,A.TT],[Te.U,A.U],[Te.UL,A.UL],[Te.SVG,A.SVG],[Te.VAR,A.VAR],[Te.WBR,A.WBR],[Te.XMP,A.XMP]]);function jO(e){var t;return(t=mYe.get(e))!==null&&t!==void 0?t:A.UNKNOWN}const st=A,gYe={[et.HTML]:new Set([st.ADDRESS,st.APPLET,st.AREA,st.ARTICLE,st.ASIDE,st.BASE,st.BASEFONT,st.BGSOUND,st.BLOCKQUOTE,st.BODY,st.BR,st.BUTTON,st.CAPTION,st.CENTER,st.COL,st.COLGROUP,st.DD,st.DETAILS,st.DIR,st.DIV,st.DL,st.DT,st.EMBED,st.FIELDSET,st.FIGCAPTION,st.FIGURE,st.FOOTER,st.FORM,st.FRAME,st.FRAMESET,st.H1,st.H2,st.H3,st.H4,st.H5,st.H6,st.HEAD,st.HEADER,st.HGROUP,st.HR,st.HTML,st.IFRAME,st.IMG,st.INPUT,st.LI,st.LINK,st.LISTING,st.MAIN,st.MARQUEE,st.MENU,st.META,st.NAV,st.NOEMBED,st.NOFRAMES,st.NOSCRIPT,st.OBJECT,st.OL,st.P,st.PARAM,st.PLAINTEXT,st.PRE,st.SCRIPT,st.SECTION,st.SELECT,st.SOURCE,st.STYLE,st.SUMMARY,st.TABLE,st.TBODY,st.TD,st.TEMPLATE,st.TEXTAREA,st.TFOOT,st.TH,st.THEAD,st.TITLE,st.TR,st.TRACK,st.UL,st.WBR,st.XMP]),[et.MATHML]:new Set([st.MI,st.MO,st.MN,st.MS,st.MTEXT,st.ANNOTATION_XML]),[et.SVG]:new Set([st.TITLE,st.FOREIGN_OBJECT,st.DESC]),[et.XLINK]:new Set,[et.XML]:new Set,[et.XMLNS]:new Set},wM=new Set([st.H1,st.H2,st.H3,st.H4,st.H5,st.H6]);Te.STYLE,Te.SCRIPT,Te.XMP,Te.IFRAME,Te.NOEMBED,Te.NOFRAMES,Te.PLAINTEXT;var ie;(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"})(ie||(ie={}));const as={DATA:ie.DATA,RCDATA:ie.RCDATA,RAWTEXT:ie.RAWTEXT,SCRIPT_DATA:ie.SCRIPT_DATA,PLAINTEXT:ie.PLAINTEXT,CDATA_SECTION:ie.CDATA_SECTION};function bYe(e){return e>=K.DIGIT_0&&e<=K.DIGIT_9}function i1(e){return e>=K.LATIN_CAPITAL_A&&e<=K.LATIN_CAPITAL_Z}function OYe(e){return e>=K.LATIN_SMALL_A&&e<=K.LATIN_SMALL_Z}function Mf(e){return OYe(e)||i1(e)}function Mq(e){return Mf(e)||bYe(e)}function bE(e){return e+32}function nde(e){return e===K.SPACE||e===K.LINE_FEED||e===K.TABULATION||e===K.FORM_FEED}function Lq(e){return nde(e)||e===K.SOLIDUS||e===K.GREATER_THAN_SIGN}function yYe(e){return e===K.NULL?Be.nullCharacterReference:e>1114111?Be.characterReferenceOutsideUnicodeRange:Kue(e)?Be.surrogateCharacterReference:ede(e)?Be.noncharacterCharacterReference:Jue(e)||e===K.CARRIAGE_RETURN?Be.controlCharacterReference:null}class xYe{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=ie.DATA,this.returnState=ie.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new sYe(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new hYe(aYe,(r,i)=>{this.preprocessor.pos=this.entityStartPos+i-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(Be.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(Be.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const i=yYe(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(Be.endTagWithAttributes),t.selfClosing&&this._err(Be.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 Qn.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case Qn.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case Qn.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:Qn.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=nde(t)?Qn.WHITESPACE_CHARACTER:t===K.NULL?Qn.NULL_CHARACTER:Qn.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(Qn.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=ie.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Od.Attribute:Od.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===ie.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===ie.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===ie.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case ie.DATA:{this._stateData(t);break}case ie.RCDATA:{this._stateRcdata(t);break}case ie.RAWTEXT:{this._stateRawtext(t);break}case ie.SCRIPT_DATA:{this._stateScriptData(t);break}case ie.PLAINTEXT:{this._statePlaintext(t);break}case ie.TAG_OPEN:{this._stateTagOpen(t);break}case ie.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case ie.TAG_NAME:{this._stateTagName(t);break}case ie.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case ie.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case ie.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case ie.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case ie.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case ie.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case ie.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case ie.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case ie.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case ie.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case ie.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case ie.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case ie.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case ie.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case ie.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case ie.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case ie.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case ie.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case ie.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case ie.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case ie.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case ie.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case ie.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case ie.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case ie.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case ie.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case ie.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case ie.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case ie.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case ie.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case ie.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case ie.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case ie.BOGUS_COMMENT:{this._stateBogusComment(t);break}case ie.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case ie.COMMENT_START:{this._stateCommentStart(t);break}case ie.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case ie.COMMENT:{this._stateComment(t);break}case ie.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case ie.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case ie.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case ie.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case ie.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case ie.COMMENT_END:{this._stateCommentEnd(t);break}case ie.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case ie.DOCTYPE:{this._stateDoctype(t);break}case ie.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case ie.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case ie.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case ie.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case ie.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case ie.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case ie.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case ie.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case ie.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case ie.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case ie.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case ie.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case ie.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case ie.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case ie.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case ie.CDATA_SECTION:{this._stateCdataSection(t);break}case ie.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case ie.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case ie.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case ie.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case K.LESS_THAN_SIGN:{this.state=ie.TAG_OPEN;break}case K.AMPERSAND:{this._startCharacterReference();break}case K.NULL:{this._err(Be.unexpectedNullCharacter),this._emitCodePoint(t);break}case K.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case K.AMPERSAND:{this._startCharacterReference();break}case K.LESS_THAN_SIGN:{this.state=ie.RCDATA_LESS_THAN_SIGN;break}case K.NULL:{this._err(Be.unexpectedNullCharacter),this._emitChars(Ei);break}case K.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case K.LESS_THAN_SIGN:{this.state=ie.RAWTEXT_LESS_THAN_SIGN;break}case K.NULL:{this._err(Be.unexpectedNullCharacter),this._emitChars(Ei);break}case K.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case K.LESS_THAN_SIGN:{this.state=ie.SCRIPT_DATA_LESS_THAN_SIGN;break}case K.NULL:{this._err(Be.unexpectedNullCharacter),this._emitChars(Ei);break}case K.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case K.NULL:{this._err(Be.unexpectedNullCharacter),this._emitChars(Ei);break}case K.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(Mf(t))this._createStartTagToken(),this.state=ie.TAG_NAME,this._stateTagName(t);else switch(t){case K.EXCLAMATION_MARK:{this.state=ie.MARKUP_DECLARATION_OPEN;break}case K.SOLIDUS:{this.state=ie.END_TAG_OPEN;break}case K.QUESTION_MARK:{this._err(Be.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=ie.BOGUS_COMMENT,this._stateBogusComment(t);break}case K.EOF:{this._err(Be.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(Be.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=ie.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(Mf(t))this._createEndTagToken(),this.state=ie.TAG_NAME,this._stateTagName(t);else switch(t){case K.GREATER_THAN_SIGN:{this._err(Be.missingEndTagName),this.state=ie.DATA;break}case K.EOF:{this._err(Be.eofBeforeTagName),this._emitChars("");break}case K.NULL:{this._err(Be.unexpectedNullCharacter),this.state=ie.SCRIPT_DATA_ESCAPED,this._emitChars(Ei);break}case K.EOF:{this._err(Be.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=ie.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===K.SOLIDUS?this.state=ie.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:Mf(t)?(this._emitChars("<"),this.state=ie.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=ie.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){Mf(t)?(this.state=ie.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("");break}case K.NULL:{this._err(Be.unexpectedNullCharacter),this.state=ie.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(Ei);break}case K.EOF:{this._err(Be.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=ie.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===K.SOLIDUS?(this.state=ie.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=ie.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(ro.SCRIPT,!1)&&Lq(this.preprocessor.peek(ro.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])!==et.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(kYe,et.HTML)}clearBackToTableBodyContext(){this.clearBackTo(EYe,et.HTML)}clearBackToTableRowContext(){this.clearBackTo(SYe,et.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]===A.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]===A.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 et.HTML:{if(i===t)return!0;if(n.has(i))return!1;break}case et.SVG:{if(Qq.has(i))return!1;break}case et.MATHML:{if(Bq.has(i))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,M2)}hasInListItemScope(t){return this.hasInDynamicScope(t,vYe)}hasInButtonScope(t){return this.hasInDynamicScope(t,wYe)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const n=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case et.HTML:{if(wM.has(n))return!0;if(M2.has(n))return!1;break}case et.SVG:{if(Qq.has(n))return!1;break}case et.MATHML:{if(Bq.has(n))return!1;break}}}return!0}hasInTableScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===et.HTML)switch(this.tagIDs[n]){case t:return!0;case A.TABLE:case A.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===et.HTML)switch(this.tagIDs[t]){case A.TBODY:case A.THEAD:case A.TFOOT:return!0;case A.TABLE:case A.HTML:return!1}return!0}hasInSelectScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===et.HTML)switch(this.tagIDs[n]){case t:return!0;case A.OPTION:case A.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&rde.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&$q.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&$q.has(this.currentTagId);)this.pop()}}const UR=3;var ru;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(ru||(ru={}));const Fq={type:ru.Marker};class AYe{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>=UR&&this.entries.splice(l.idx,1))}}insertMarker(){this.entries.unshift(Fq)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:ru.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:ru.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(Fq);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(r=>r.type===ru.Marker||this.treeAdapter.getTagName(r.element)===t);return n&&n.type===ru.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===ru.Element&&n.element===t)}}const Lf={createDocument(){return{nodeName:"#document",mode:Tl.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};Lf.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(Lf.isTextNode(n)){n.value+=t;return}}Lf.appendChild(e,Lf.createTextNode(t))},insertTextBefore(e,t,n){const r=e.childNodes[e.childNodes.indexOf(n)-1];r&&Lf.isTextNode(r)?r.value+=t:Lf.insertBefore(e,Lf.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(r=>r.name));for(let r=0;re.startsWith(n))}function DYe(e){return e.name===ide&&e.publicId===null&&(e.systemId===null||e.systemId===CYe)}function PYe(e){if(e.name!==ide)return Tl.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===NYe)return Tl.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),RYe.has(n))return Tl.QUIRKS;let r=t===null?jYe:sde;if(Uq(n,r))return Tl.QUIRKS;if(r=t===null?ade:IYe,Uq(n,r))return Tl.LIMITED_QUIRKS}return Tl.NO_QUIRKS}const zq={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},MYe="definitionurl",LYe="definitionURL",$Ye=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])),BYe=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:et.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:et.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:et.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:et.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:et.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:et.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:et.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:et.XML}],["xml:space",{prefix:"xml",name:"space",namespace:et.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:et.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:et.XMLNS}]]),QYe=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])),FYe=new Set([A.B,A.BIG,A.BLOCKQUOTE,A.BODY,A.BR,A.CENTER,A.CODE,A.DD,A.DIV,A.DL,A.DT,A.EM,A.EMBED,A.H1,A.H2,A.H3,A.H4,A.H5,A.H6,A.HEAD,A.HR,A.I,A.IMG,A.LI,A.LISTING,A.MENU,A.META,A.NOBR,A.OL,A.P,A.PRE,A.RUBY,A.S,A.SMALL,A.SPAN,A.STRONG,A.STRIKE,A.SUB,A.SUP,A.TABLE,A.TT,A.U,A.UL,A.VAR]);function UYe(e){const t=e.tagID;return t===A.FONT&&e.attrs.some(({name:r})=>r===hm.COLOR||r===hm.SIZE||r===hm.FACE)||FYe.has(t)}function ode(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)===et.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&t!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,t)}_switchToTextParsing(t,n){this._insertElement(t,et.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=oe.TEXT}switchToPlaintextParsing(){this.insertionMode=oe.TEXT,this.originalInsertionMode=oe.IN_BODY,this.tokenizer.state=as.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)===Te.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==et.HTML))switch(this.fragmentContextID){case A.TITLE:case A.TEXTAREA:{this.tokenizer.state=as.RCDATA;break}case A.STYLE:case A.XMP:case A.IFRAME:case A.NOEMBED:case A.NOFRAMES:case A.NOSCRIPT:{this.tokenizer.state=as.RAWTEXT;break}case A.SCRIPT:{this.tokenizer.state=as.SCRIPT_DATA;break}case A.PLAINTEXT:{this.tokenizer.state=as.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,et.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,n)}_insertTemplate(t){const n=this.treeAdapter.createElement(t.tagName,et.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(Te.HTML,et.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,A.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===Qn.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===A.SVG&&this.treeAdapter.getTagName(n)===Te.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===et.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===A.MGLYPH||t.tagID===A.MALIGNMARK)&&r!==void 0&&!this._isIntegrationPoint(r,n,et.HTML)}_processToken(t){switch(t.type){case Qn.CHARACTER:{this.onCharacter(t);break}case Qn.NULL_CHARACTER:{this.onNullCharacter(t);break}case Qn.COMMENT:{this.onComment(t);break}case Qn.DOCTYPE:{this.onDoctype(t);break}case Qn.START_TAG:{this._processStartTag(t);break}case Qn.END_TAG:{this.onEndTag(t);break}case Qn.EOF:{this.onEof(t);break}case Qn.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,r){const i=this.treeAdapter.getNamespaceURI(n),s=this.treeAdapter.getAttrList(n);return HYe(t,i,s,r)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(i=>i.type===ru.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=oe.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(A.P),this.openElements.popUntilTagNamePopped(A.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case A.TR:{this.insertionMode=oe.IN_ROW;return}case A.TBODY:case A.THEAD:case A.TFOOT:{this.insertionMode=oe.IN_TABLE_BODY;return}case A.CAPTION:{this.insertionMode=oe.IN_CAPTION;return}case A.COLGROUP:{this.insertionMode=oe.IN_COLUMN_GROUP;return}case A.TABLE:{this.insertionMode=oe.IN_TABLE;return}case A.BODY:{this.insertionMode=oe.IN_BODY;return}case A.FRAMESET:{this.insertionMode=oe.IN_FRAMESET;return}case A.SELECT:{this._resetInsertionModeForSelect(t);return}case A.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case A.HTML:{this.insertionMode=this.headElement?oe.AFTER_HEAD:oe.BEFORE_HEAD;return}case A.TD:case A.TH:{if(t>0){this.insertionMode=oe.IN_CELL;return}break}case A.HEAD:{if(t>0){this.insertionMode=oe.IN_HEAD;return}break}}this.insertionMode=oe.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let n=t-1;n>0;n--){const r=this.openElements.tagIDs[n];if(r===A.TEMPLATE)break;if(r===A.TABLE){this.insertionMode=oe.IN_SELECT_IN_TABLE;return}}this.insertionMode=oe.IN_SELECT}_isElementCausesFosterParenting(t){return cde.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 A.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===et.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case A.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 gYe[r].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){TZe(this,t);return}switch(this.insertionMode){case oe.INITIAL:{ky(this,t);break}case oe.BEFORE_HTML:{U1(this,t);break}case oe.BEFORE_HEAD:{z1(this,t);break}case oe.IN_HEAD:{V1(this,t);break}case oe.IN_HEAD_NO_SCRIPT:{q1(this,t);break}case oe.AFTER_HEAD:{H1(this,t);break}case oe.IN_BODY:case oe.IN_CAPTION:case oe.IN_CELL:case oe.IN_TEMPLATE:{dde(this,t);break}case oe.TEXT:case oe.IN_SELECT:case oe.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case oe.IN_TABLE:case oe.IN_TABLE_BODY:case oe.IN_ROW:{zR(this,t);break}case oe.IN_TABLE_TEXT:{bde(this,t);break}case oe.IN_COLUMN_GROUP:{L2(this,t);break}case oe.AFTER_BODY:{$2(this,t);break}case oe.AFTER_AFTER_BODY:{qk(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){kZe(this,t);return}switch(this.insertionMode){case oe.INITIAL:{ky(this,t);break}case oe.BEFORE_HTML:{U1(this,t);break}case oe.BEFORE_HEAD:{z1(this,t);break}case oe.IN_HEAD:{V1(this,t);break}case oe.IN_HEAD_NO_SCRIPT:{q1(this,t);break}case oe.AFTER_HEAD:{H1(this,t);break}case oe.TEXT:{this._insertCharacters(t);break}case oe.IN_TABLE:case oe.IN_TABLE_BODY:case oe.IN_ROW:{zR(this,t);break}case oe.IN_COLUMN_GROUP:{L2(this,t);break}case oe.AFTER_BODY:{$2(this,t);break}case oe.AFTER_AFTER_BODY:{qk(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){SM(this,t);return}switch(this.insertionMode){case oe.INITIAL:case oe.BEFORE_HTML:case oe.BEFORE_HEAD:case oe.IN_HEAD:case oe.IN_HEAD_NO_SCRIPT:case oe.AFTER_HEAD:case oe.IN_BODY:case oe.IN_TABLE:case oe.IN_CAPTION:case oe.IN_COLUMN_GROUP:case oe.IN_TABLE_BODY:case oe.IN_ROW:case oe.IN_CELL:case oe.IN_SELECT:case oe.IN_SELECT_IN_TABLE:case oe.IN_TEMPLATE:case oe.IN_FRAMESET:case oe.AFTER_FRAMESET:{SM(this,t);break}case oe.IN_TABLE_TEXT:{Ty(this,t);break}case oe.AFTER_BODY:{rWe(this,t);break}case oe.AFTER_AFTER_BODY:case oe.AFTER_AFTER_FRAMESET:{iWe(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case oe.INITIAL:{sWe(this,t);break}case oe.BEFORE_HEAD:case oe.IN_HEAD:case oe.IN_HEAD_NO_SCRIPT:case oe.AFTER_HEAD:{this._err(t,Be.misplacedDoctype);break}case oe.IN_TABLE_TEXT:{Ty(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,Be.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?_Ze(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case oe.INITIAL:{ky(this,t);break}case oe.BEFORE_HTML:{aWe(this,t);break}case oe.BEFORE_HEAD:{lWe(this,t);break}case oe.IN_HEAD:{Ic(this,t);break}case oe.IN_HEAD_NO_SCRIPT:{dWe(this,t);break}case oe.AFTER_HEAD:{hWe(this,t);break}case oe.IN_BODY:{ja(this,t);break}case oe.IN_TABLE:{Bb(this,t);break}case oe.IN_TABLE_TEXT:{Ty(this,t);break}case oe.IN_CAPTION:{cZe(this,t);break}case oe.IN_COLUMN_GROUP:{e8(this,t);break}case oe.IN_TABLE_BODY:{uC(this,t);break}case oe.IN_ROW:{dC(this,t);break}case oe.IN_CELL:{fZe(this,t);break}case oe.IN_SELECT:{xde(this,t);break}case oe.IN_SELECT_IN_TABLE:{pZe(this,t);break}case oe.IN_TEMPLATE:{gZe(this,t);break}case oe.AFTER_BODY:{OZe(this,t);break}case oe.IN_FRAMESET:{yZe(this,t);break}case oe.AFTER_FRAMESET:{vZe(this,t);break}case oe.AFTER_AFTER_BODY:{SZe(this,t);break}case oe.AFTER_AFTER_FRAMESET:{EZe(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?AZe(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case oe.INITIAL:{ky(this,t);break}case oe.BEFORE_HTML:{oWe(this,t);break}case oe.BEFORE_HEAD:{cWe(this,t);break}case oe.IN_HEAD:{uWe(this,t);break}case oe.IN_HEAD_NO_SCRIPT:{fWe(this,t);break}case oe.AFTER_HEAD:{pWe(this,t);break}case oe.IN_BODY:{cC(this,t);break}case oe.TEXT:{JWe(this,t);break}case oe.IN_TABLE:{ev(this,t);break}case oe.IN_TABLE_TEXT:{Ty(this,t);break}case oe.IN_CAPTION:{uZe(this,t);break}case oe.IN_COLUMN_GROUP:{dZe(this,t);break}case oe.IN_TABLE_BODY:{EM(this,t);break}case oe.IN_ROW:{yde(this,t);break}case oe.IN_CELL:{hZe(this,t);break}case oe.IN_SELECT:{vde(this,t);break}case oe.IN_SELECT_IN_TABLE:{mZe(this,t);break}case oe.IN_TEMPLATE:{bZe(this,t);break}case oe.AFTER_BODY:{Sde(this,t);break}case oe.IN_FRAMESET:{xZe(this,t);break}case oe.AFTER_FRAMESET:{wZe(this,t);break}case oe.AFTER_AFTER_BODY:{qk(this,t);break}}}onEof(t){switch(this.insertionMode){case oe.INITIAL:{ky(this,t);break}case oe.BEFORE_HTML:{U1(this,t);break}case oe.BEFORE_HEAD:{z1(this,t);break}case oe.IN_HEAD:{V1(this,t);break}case oe.IN_HEAD_NO_SCRIPT:{q1(this,t);break}case oe.AFTER_HEAD:{H1(this,t);break}case oe.IN_BODY:case oe.IN_TABLE:case oe.IN_CAPTION:case oe.IN_COLUMN_GROUP:case oe.IN_TABLE_BODY:case oe.IN_ROW:case oe.IN_CELL:case oe.IN_SELECT:case oe.IN_SELECT_IN_TABLE:{mde(this,t);break}case oe.TEXT:{eZe(this,t);break}case oe.IN_TABLE_TEXT:{Ty(this,t);break}case oe.IN_TEMPLATE:{wde(this,t);break}case oe.AFTER_BODY:case oe.IN_FRAMESET:case oe.AFTER_FRAMESET:case oe.AFTER_AFTER_BODY:case oe.AFTER_AFTER_FRAMESET:{J$(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===K.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 oe.IN_HEAD:case oe.IN_HEAD_NO_SCRIPT:case oe.AFTER_HEAD:case oe.TEXT:case oe.IN_COLUMN_GROUP:case oe.IN_SELECT:case oe.IN_SELECT_IN_TABLE:case oe.IN_FRAMESET:case oe.AFTER_FRAMESET:{this._insertCharacters(t);break}case oe.IN_BODY:case oe.IN_CAPTION:case oe.IN_CELL:case oe.IN_TEMPLATE:case oe.AFTER_BODY:case oe.AFTER_AFTER_BODY:case oe.AFTER_AFTER_FRAMESET:{ude(this,t);break}case oe.IN_TABLE:case oe.IN_TABLE_BODY:case oe.IN_ROW:{zR(this,t);break}case oe.IN_TABLE_TEXT:{gde(this,t);break}}}};function ZYe(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):pde(e,t),n}function KYe(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 JYe(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>=YYe;!l||c?(c&&e.activeFormattingElements.removeEntry(l),e.openElements.remove(a)):(a=eWe(e,l),r===t&&(e.activeFormattingElements.bookmark=l),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(a,r),r=a)}return r}function eWe(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 tWe(e,t,n){const r=e.treeAdapter.getTagName(t),i=jO(r);if(e._isElementCausesFosterParenting(i))e._fosterParentElement(n);else{const s=e.treeAdapter.getNamespaceURI(t);i===A.TEMPLATE&&s===et.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function nWe(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 K$(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 sWe(e,t){e._setDocumentType(t);const n=t.forceQuirks?Tl.QUIRKS:PYe(t);DYe(t)||e._err(t,Be.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=oe.BEFORE_HTML}function ky(e,t){e._err(t,Be.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Tl.QUIRKS),e.insertionMode=oe.BEFORE_HTML,e._processToken(t)}function aWe(e,t){t.tagID===A.HTML?(e._insertElement(t,et.HTML),e.insertionMode=oe.BEFORE_HEAD):U1(e,t)}function oWe(e,t){const n=t.tagID;(n===A.HTML||n===A.HEAD||n===A.BODY||n===A.BR)&&U1(e,t)}function U1(e,t){e._insertFakeRootElement(),e.insertionMode=oe.BEFORE_HEAD,e._processToken(t)}function lWe(e,t){switch(t.tagID){case A.HTML:{ja(e,t);break}case A.HEAD:{e._insertElement(t,et.HTML),e.headElement=e.openElements.current,e.insertionMode=oe.IN_HEAD;break}default:z1(e,t)}}function cWe(e,t){const n=t.tagID;n===A.HEAD||n===A.BODY||n===A.HTML||n===A.BR?z1(e,t):e._err(t,Be.endTagWithoutMatchingOpenElement)}function z1(e,t){e._insertFakeElement(Te.HEAD,A.HEAD),e.headElement=e.openElements.current,e.insertionMode=oe.IN_HEAD,e._processToken(t)}function Ic(e,t){switch(t.tagID){case A.HTML:{ja(e,t);break}case A.BASE:case A.BASEFONT:case A.BGSOUND:case A.LINK:case A.META:{e._appendElement(t,et.HTML),t.ackSelfClosing=!0;break}case A.TITLE:{e._switchToTextParsing(t,as.RCDATA);break}case A.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,as.RAWTEXT):(e._insertElement(t,et.HTML),e.insertionMode=oe.IN_HEAD_NO_SCRIPT);break}case A.NOFRAMES:case A.STYLE:{e._switchToTextParsing(t,as.RAWTEXT);break}case A.SCRIPT:{e._switchToTextParsing(t,as.SCRIPT_DATA);break}case A.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=oe.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(oe.IN_TEMPLATE);break}case A.HEAD:{e._err(t,Be.misplacedStartTagForHeadElement);break}default:V1(e,t)}}function uWe(e,t){switch(t.tagID){case A.HEAD:{e.openElements.pop(),e.insertionMode=oe.AFTER_HEAD;break}case A.BODY:case A.BR:case A.HTML:{V1(e,t);break}case A.TEMPLATE:{Jm(e,t);break}default:e._err(t,Be.endTagWithoutMatchingOpenElement)}}function Jm(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==A.TEMPLATE&&e._err(t,Be.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(A.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,Be.endTagWithoutMatchingOpenElement)}function V1(e,t){e.openElements.pop(),e.insertionMode=oe.AFTER_HEAD,e._processToken(t)}function dWe(e,t){switch(t.tagID){case A.HTML:{ja(e,t);break}case A.BASEFONT:case A.BGSOUND:case A.HEAD:case A.LINK:case A.META:case A.NOFRAMES:case A.STYLE:{Ic(e,t);break}case A.NOSCRIPT:{e._err(t,Be.nestedNoscriptInHead);break}default:q1(e,t)}}function fWe(e,t){switch(t.tagID){case A.NOSCRIPT:{e.openElements.pop(),e.insertionMode=oe.IN_HEAD;break}case A.BR:{q1(e,t);break}default:e._err(t,Be.endTagWithoutMatchingOpenElement)}}function q1(e,t){const n=t.type===Qn.EOF?Be.openElementsLeftAfterEof:Be.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=oe.IN_HEAD,e._processToken(t)}function hWe(e,t){switch(t.tagID){case A.HTML:{ja(e,t);break}case A.BODY:{e._insertElement(t,et.HTML),e.framesetOk=!1,e.insertionMode=oe.IN_BODY;break}case A.FRAMESET:{e._insertElement(t,et.HTML),e.insertionMode=oe.IN_FRAMESET;break}case A.BASE:case A.BASEFONT:case A.BGSOUND:case A.LINK:case A.META:case A.NOFRAMES:case A.SCRIPT:case A.STYLE:case A.TEMPLATE:case A.TITLE:{e._err(t,Be.abandonedHeadElementChild),e.openElements.push(e.headElement,A.HEAD),Ic(e,t),e.openElements.remove(e.headElement);break}case A.HEAD:{e._err(t,Be.misplacedStartTagForHeadElement);break}default:H1(e,t)}}function pWe(e,t){switch(t.tagID){case A.BODY:case A.HTML:case A.BR:{H1(e,t);break}case A.TEMPLATE:{Jm(e,t);break}default:e._err(t,Be.endTagWithoutMatchingOpenElement)}}function H1(e,t){e._insertFakeElement(Te.BODY,A.BODY),e.insertionMode=oe.IN_BODY,lC(e,t)}function lC(e,t){switch(t.type){case Qn.CHARACTER:{dde(e,t);break}case Qn.WHITESPACE_CHARACTER:{ude(e,t);break}case Qn.COMMENT:{SM(e,t);break}case Qn.START_TAG:{ja(e,t);break}case Qn.END_TAG:{cC(e,t);break}case Qn.EOF:{mde(e,t);break}}}function ude(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function dde(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function mWe(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function gWe(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function bWe(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,et.HTML),e.insertionMode=oe.IN_FRAMESET)}function OWe(e,t){e.openElements.hasInButtonScope(A.P)&&e._closePElement(),e._insertElement(t,et.HTML)}function yWe(e,t){e.openElements.hasInButtonScope(A.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&wM.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,et.HTML)}function xWe(e,t){e.openElements.hasInButtonScope(A.P)&&e._closePElement(),e._insertElement(t,et.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function vWe(e,t){const n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(A.P)&&e._closePElement(),e._insertElement(t,et.HTML),n||(e.formElement=e.openElements.current))}function wWe(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===A.LI&&i===A.LI||(n===A.DD||n===A.DT)&&(i===A.DD||i===A.DT)){e.openElements.generateImpliedEndTagsWithExclusion(i),e.openElements.popUntilTagNamePopped(i);break}if(i!==A.ADDRESS&&i!==A.DIV&&i!==A.P&&e._isSpecialElement(e.openElements.items[r],i))break}e.openElements.hasInButtonScope(A.P)&&e._closePElement(),e._insertElement(t,et.HTML)}function SWe(e,t){e.openElements.hasInButtonScope(A.P)&&e._closePElement(),e._insertElement(t,et.HTML),e.tokenizer.state=as.PLAINTEXT}function EWe(e,t){e.openElements.hasInScope(A.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(A.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,et.HTML),e.framesetOk=!1}function kWe(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(Te.A);n&&(K$(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,et.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function TWe(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,et.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function _We(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(A.NOBR)&&(K$(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,et.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function AWe(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,et.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function CWe(e,t){e.treeAdapter.getDocumentMode(e.document)!==Tl.QUIRKS&&e.openElements.hasInButtonScope(A.P)&&e._closePElement(),e._insertElement(t,et.HTML),e.framesetOk=!1,e.insertionMode=oe.IN_TABLE}function fde(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,et.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function hde(e){const t=tde(e,hm.TYPE);return t!=null&&t.toLowerCase()===XYe}function NWe(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,et.HTML),hde(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function jWe(e,t){e._appendElement(t,et.HTML),t.ackSelfClosing=!0}function RWe(e,t){e.openElements.hasInButtonScope(A.P)&&e._closePElement(),e._appendElement(t,et.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function IWe(e,t){t.tagName=Te.IMG,t.tagID=A.IMG,fde(e,t)}function DWe(e,t){e._insertElement(t,et.HTML),e.skipNextNewLine=!0,e.tokenizer.state=as.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=oe.TEXT}function PWe(e,t){e.openElements.hasInButtonScope(A.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,as.RAWTEXT)}function MWe(e,t){e.framesetOk=!1,e._switchToTextParsing(t,as.RAWTEXT)}function Hq(e,t){e._switchToTextParsing(t,as.RAWTEXT)}function LWe(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,et.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===oe.IN_TABLE||e.insertionMode===oe.IN_CAPTION||e.insertionMode===oe.IN_TABLE_BODY||e.insertionMode===oe.IN_ROW||e.insertionMode===oe.IN_CELL?oe.IN_SELECT_IN_TABLE:oe.IN_SELECT}function $We(e,t){e.openElements.currentTagId===A.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,et.HTML)}function BWe(e,t){e.openElements.hasInScope(A.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,et.HTML)}function QWe(e,t){e.openElements.hasInScope(A.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(A.RTC),e._insertElement(t,et.HTML)}function FWe(e,t){e._reconstructActiveFormattingElements(),ode(t),Z$(t),t.selfClosing?e._appendElement(t,et.MATHML):e._insertElement(t,et.MATHML),t.ackSelfClosing=!0}function UWe(e,t){e._reconstructActiveFormattingElements(),lde(t),Z$(t),t.selfClosing?e._appendElement(t,et.SVG):e._insertElement(t,et.SVG),t.ackSelfClosing=!0}function Xq(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,et.HTML)}function ja(e,t){switch(t.tagID){case A.I:case A.S:case A.B:case A.U:case A.EM:case A.TT:case A.BIG:case A.CODE:case A.FONT:case A.SMALL:case A.STRIKE:case A.STRONG:{TWe(e,t);break}case A.A:{kWe(e,t);break}case A.H1:case A.H2:case A.H3:case A.H4:case A.H5:case A.H6:{yWe(e,t);break}case A.P:case A.DL:case A.OL:case A.UL:case A.DIV:case A.DIR:case A.NAV:case A.MAIN:case A.MENU:case A.ASIDE:case A.CENTER:case A.FIGURE:case A.FOOTER:case A.HEADER:case A.HGROUP:case A.DIALOG:case A.DETAILS:case A.ADDRESS:case A.ARTICLE:case A.SEARCH:case A.SECTION:case A.SUMMARY:case A.FIELDSET:case A.BLOCKQUOTE:case A.FIGCAPTION:{OWe(e,t);break}case A.LI:case A.DD:case A.DT:{wWe(e,t);break}case A.BR:case A.IMG:case A.WBR:case A.AREA:case A.EMBED:case A.KEYGEN:{fde(e,t);break}case A.HR:{RWe(e,t);break}case A.RB:case A.RTC:{BWe(e,t);break}case A.RT:case A.RP:{QWe(e,t);break}case A.PRE:case A.LISTING:{xWe(e,t);break}case A.XMP:{PWe(e,t);break}case A.SVG:{UWe(e,t);break}case A.HTML:{mWe(e,t);break}case A.BASE:case A.LINK:case A.META:case A.STYLE:case A.TITLE:case A.SCRIPT:case A.BGSOUND:case A.BASEFONT:case A.TEMPLATE:{Ic(e,t);break}case A.BODY:{gWe(e,t);break}case A.FORM:{vWe(e,t);break}case A.NOBR:{_We(e,t);break}case A.MATH:{FWe(e,t);break}case A.TABLE:{CWe(e,t);break}case A.INPUT:{NWe(e,t);break}case A.PARAM:case A.TRACK:case A.SOURCE:{jWe(e,t);break}case A.IMAGE:{IWe(e,t);break}case A.BUTTON:{EWe(e,t);break}case A.APPLET:case A.OBJECT:case A.MARQUEE:{AWe(e,t);break}case A.IFRAME:{MWe(e,t);break}case A.SELECT:{LWe(e,t);break}case A.OPTION:case A.OPTGROUP:{$We(e,t);break}case A.NOEMBED:case A.NOFRAMES:{Hq(e,t);break}case A.FRAMESET:{bWe(e,t);break}case A.TEXTAREA:{DWe(e,t);break}case A.NOSCRIPT:{e.options.scriptingEnabled?Hq(e,t):Xq(e,t);break}case A.PLAINTEXT:{SWe(e,t);break}case A.COL:case A.TH:case A.TD:case A.TR:case A.HEAD:case A.FRAME:case A.TBODY:case A.TFOOT:case A.THEAD:case A.CAPTION:case A.COLGROUP:break;default:Xq(e,t)}}function zWe(e,t){if(e.openElements.hasInScope(A.BODY)&&(e.insertionMode=oe.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function VWe(e,t){e.openElements.hasInScope(A.BODY)&&(e.insertionMode=oe.AFTER_BODY,Sde(e,t))}function qWe(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function HWe(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(A.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(A.FORM):n&&e.openElements.remove(n))}function XWe(e){e.openElements.hasInButtonScope(A.P)||e._insertFakeElement(Te.P,A.P),e._closePElement()}function GWe(e){e.openElements.hasInListItemScope(A.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(A.LI),e.openElements.popUntilTagNamePopped(A.LI))}function YWe(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function WWe(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function ZWe(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function KWe(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(Te.BR,A.BR),e.openElements.pop(),e.framesetOk=!1}function pde(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!==A.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 cC(e,t){switch(t.tagID){case A.A:case A.B:case A.I:case A.S:case A.U:case A.EM:case A.TT:case A.BIG:case A.CODE:case A.FONT:case A.NOBR:case A.SMALL:case A.STRIKE:case A.STRONG:{K$(e,t);break}case A.P:{XWe(e);break}case A.DL:case A.UL:case A.OL:case A.DIR:case A.DIV:case A.NAV:case A.PRE:case A.MAIN:case A.MENU:case A.ASIDE:case A.BUTTON:case A.CENTER:case A.FIGURE:case A.FOOTER:case A.HEADER:case A.HGROUP:case A.DIALOG:case A.ADDRESS:case A.ARTICLE:case A.DETAILS:case A.SEARCH:case A.SECTION:case A.SUMMARY:case A.LISTING:case A.FIELDSET:case A.BLOCKQUOTE:case A.FIGCAPTION:{qWe(e,t);break}case A.LI:{GWe(e);break}case A.DD:case A.DT:{YWe(e,t);break}case A.H1:case A.H2:case A.H3:case A.H4:case A.H5:case A.H6:{WWe(e);break}case A.BR:{KWe(e);break}case A.BODY:{zWe(e,t);break}case A.HTML:{VWe(e,t);break}case A.FORM:{HWe(e);break}case A.APPLET:case A.OBJECT:case A.MARQUEE:{ZWe(e,t);break}case A.TEMPLATE:{Jm(e,t);break}default:pde(e,t)}}function mde(e,t){e.tmplInsertionModeStack.length>0?wde(e,t):J$(e,t)}function JWe(e,t){var n;t.tagID===A.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function eZe(e,t){e._err(t,Be.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function zR(e,t){if(e.openElements.currentTagId!==void 0&&cde.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=oe.IN_TABLE_TEXT,t.type){case Qn.CHARACTER:{bde(e,t);break}case Qn.WHITESPACE_CHARACTER:{gde(e,t);break}}else yw(e,t)}function tZe(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,et.HTML),e.insertionMode=oe.IN_CAPTION}function nZe(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,et.HTML),e.insertionMode=oe.IN_COLUMN_GROUP}function rZe(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(Te.COLGROUP,A.COLGROUP),e.insertionMode=oe.IN_COLUMN_GROUP,e8(e,t)}function iZe(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,et.HTML),e.insertionMode=oe.IN_TABLE_BODY}function sZe(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(Te.TBODY,A.TBODY),e.insertionMode=oe.IN_TABLE_BODY,uC(e,t)}function aZe(e,t){e.openElements.hasInTableScope(A.TABLE)&&(e.openElements.popUntilTagNamePopped(A.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function oZe(e,t){hde(t)?e._appendElement(t,et.HTML):yw(e,t),t.ackSelfClosing=!0}function lZe(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,et.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function Bb(e,t){switch(t.tagID){case A.TD:case A.TH:case A.TR:{sZe(e,t);break}case A.STYLE:case A.SCRIPT:case A.TEMPLATE:{Ic(e,t);break}case A.COL:{rZe(e,t);break}case A.FORM:{lZe(e,t);break}case A.TABLE:{aZe(e,t);break}case A.TBODY:case A.TFOOT:case A.THEAD:{iZe(e,t);break}case A.INPUT:{oZe(e,t);break}case A.CAPTION:{tZe(e,t);break}case A.COLGROUP:{nZe(e,t);break}default:yw(e,t)}}function ev(e,t){switch(t.tagID){case A.TABLE:{e.openElements.hasInTableScope(A.TABLE)&&(e.openElements.popUntilTagNamePopped(A.TABLE),e._resetInsertionMode());break}case A.TEMPLATE:{Jm(e,t);break}case A.BODY:case A.CAPTION:case A.COL:case A.COLGROUP:case A.HTML:case A.TBODY:case A.TD:case A.TFOOT:case A.TH:case A.THEAD:case A.TR:break;default:yw(e,t)}}function yw(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,lC(e,t),e.fosterParentingEnabled=n}function gde(e,t){e.pendingCharacterTokens.push(t)}function bde(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function Ty(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n0&&e.openElements.currentTagId===A.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===A.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===A.OPTGROUP&&e.openElements.pop();break}case A.OPTION:{e.openElements.currentTagId===A.OPTION&&e.openElements.pop();break}case A.SELECT:{e.openElements.hasInSelectScope(A.SELECT)&&(e.openElements.popUntilTagNamePopped(A.SELECT),e._resetInsertionMode());break}case A.TEMPLATE:{Jm(e,t);break}}}function pZe(e,t){const n=t.tagID;n===A.CAPTION||n===A.TABLE||n===A.TBODY||n===A.TFOOT||n===A.THEAD||n===A.TR||n===A.TD||n===A.TH?(e.openElements.popUntilTagNamePopped(A.SELECT),e._resetInsertionMode(),e._processStartTag(t)):xde(e,t)}function mZe(e,t){const n=t.tagID;n===A.CAPTION||n===A.TABLE||n===A.TBODY||n===A.TFOOT||n===A.THEAD||n===A.TR||n===A.TD||n===A.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(A.SELECT),e._resetInsertionMode(),e.onEndTag(t)):vde(e,t)}function gZe(e,t){switch(t.tagID){case A.BASE:case A.BASEFONT:case A.BGSOUND:case A.LINK:case A.META:case A.NOFRAMES:case A.SCRIPT:case A.STYLE:case A.TEMPLATE:case A.TITLE:{Ic(e,t);break}case A.CAPTION:case A.COLGROUP:case A.TBODY:case A.TFOOT:case A.THEAD:{e.tmplInsertionModeStack[0]=oe.IN_TABLE,e.insertionMode=oe.IN_TABLE,Bb(e,t);break}case A.COL:{e.tmplInsertionModeStack[0]=oe.IN_COLUMN_GROUP,e.insertionMode=oe.IN_COLUMN_GROUP,e8(e,t);break}case A.TR:{e.tmplInsertionModeStack[0]=oe.IN_TABLE_BODY,e.insertionMode=oe.IN_TABLE_BODY,uC(e,t);break}case A.TD:case A.TH:{e.tmplInsertionModeStack[0]=oe.IN_ROW,e.insertionMode=oe.IN_ROW,dC(e,t);break}default:e.tmplInsertionModeStack[0]=oe.IN_BODY,e.insertionMode=oe.IN_BODY,ja(e,t)}}function bZe(e,t){t.tagID===A.TEMPLATE&&Jm(e,t)}function wde(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(A.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):J$(e,t)}function OZe(e,t){t.tagID===A.HTML?ja(e,t):$2(e,t)}function Sde(e,t){var n;if(t.tagID===A.HTML){if(e.fragmentContext||(e.insertionMode=oe.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===A.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 $2(e,t)}function $2(e,t){e.insertionMode=oe.IN_BODY,lC(e,t)}function yZe(e,t){switch(t.tagID){case A.HTML:{ja(e,t);break}case A.FRAMESET:{e._insertElement(t,et.HTML);break}case A.FRAME:{e._appendElement(t,et.HTML),t.ackSelfClosing=!0;break}case A.NOFRAMES:{Ic(e,t);break}}}function xZe(e,t){t.tagID===A.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==A.FRAMESET&&(e.insertionMode=oe.AFTER_FRAMESET))}function vZe(e,t){switch(t.tagID){case A.HTML:{ja(e,t);break}case A.NOFRAMES:{Ic(e,t);break}}}function wZe(e,t){t.tagID===A.HTML&&(e.insertionMode=oe.AFTER_AFTER_FRAMESET)}function SZe(e,t){t.tagID===A.HTML?ja(e,t):qk(e,t)}function qk(e,t){e.insertionMode=oe.IN_BODY,lC(e,t)}function EZe(e,t){switch(t.tagID){case A.HTML:{ja(e,t);break}case A.NOFRAMES:{Ic(e,t);break}}}function kZe(e,t){t.chars=Ei,e._insertCharacters(t)}function TZe(e,t){e._insertCharacters(t),e.framesetOk=!1}function Ede(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==et.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function _Ze(e,t){if(UYe(t))Ede(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===et.MATHML?ode(t):r===et.SVG&&(zYe(t),lde(t)),Z$(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function AZe(e,t){if(t.tagID===A.P||t.tagID===A.BR){Ede(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)===et.HTML){e._endTagOutsideForeignContent(t);break}const i=e.treeAdapter.getTagName(r);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}Te.AREA,Te.BASE,Te.BASEFONT,Te.BGSOUND,Te.BR,Te.COL,Te.EMBED,Te.FRAME,Te.HR,Te.IMG,Te.INPUT,Te.KEYGEN,Te.LINK,Te.META,Te.PARAM,Te.SOURCE,Te.TRACK,Te.WBR;const CZe=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,NZe=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),Gq={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function kde(e,t){const n=QZe(e),r=Qce("type",{handlers:{root:jZe,element:RZe,text:IZe,comment:_de,doctype:DZe,raw:MZe},unknown:LZe}),i={parser:n?new qq(Gq):qq.getFragmentParser(void 0,Gq),handle(l){r(l,i)},stitches:!1,options:t||{}};r(e,i),RO(i,Pu());const s=n?i.parser.document:i.parser.getFragment(),a=FGe(s,{file:i.options.file});return i.stitches&&bw(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 Tde(e,t){let n=-1;if(e)for(;++n4&&(t.parser.tokenizer.state=0);const n={type:Qn.CHARACTER,chars:e.value,location:xw(e)};RO(t,Pu(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function DZe(e,t){const n={type:Qn.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:xw(e)};RO(t,Pu(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function PZe(e,t){t.stitches=!0;const n=FZe(e);if("children"in e&&"children"in n){const r=kde({type:"root",children:e.children},t.options);n.children=r.children}_de({type:"comment",value:{stitch:n}},t)}function _de(e,t){const n=e.value,r={type:Qn.COMMENT,data:n,location:xw(e)};RO(t,Pu(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function MZe(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,Ade(t,Pu(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(CZe,"<$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 LZe(e,t){const n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))PZe(n,t);else{let r="";throw NZe.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 RO(e,t){Ade(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=as.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 Ade(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 $Ze(e,t){const n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===as.PLAINTEXT)return;RO(t,Pu(e));const r=t.parser.openElements.current;let i="namespaceURI"in r?r.namespaceURI:Gp.html;i===Gp.html&&n==="svg"&&(i=Gp.svg);const s=HGe({...e,children:[]},{space:i===Gp.svg?"svg":"html"}),a={type:Qn.START_TAG,tagName:n,tagID:jO(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in s?s.attrs:[],location:xw(e)};t.parser.currentToken=a,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function BZe(e,t){const n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&eYe.includes(n)||t.parser.tokenizer.state===as.PLAINTEXT)return;RO(t,nC(e));const r={type:Qn.END_TAG,tagName:n,tagID:jO(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:xw(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===as.RCDATA||t.parser.tokenizer.state===as.RAWTEXT||t.parser.tokenizer.state===as.SCRIPT_DATA)&&(t.parser.tokenizer.state=as.DATA)}function QZe(e){const t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function xw(e){const t=Pu(e)||{line:void 0,column:void 0,offset:void 0},n=nC(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 FZe(e){return"children"in e?Lb({...e,children:[]}):Lb(e)}function UZe(e){return function(t,n){return kde(t,{...e,file:n})}}const zZe="modulepreload",VZe=function(e){return"/"+e},Yq={},Pd=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=VZe(c),c in Yq)return;Yq[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":zZe,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((h,p)=>{f.addEventListener("load",h),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function 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 qZe=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,HZe=/[\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]/,XZe=/[\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]/,VR={Space_Separator:qZe,ID_Start:HZe,ID_Continue:XZe},rs={isSpaceSeparator(e){return typeof e=="string"&&VR.Space_Separator.test(e)},isIdStartChar(e){return typeof e=="string"&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="$"||e==="_"||VR.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==="‍"||VR.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 kM,za,yd,B2,Bh,wc,$s,t8,X1;var GZe=function(t,n){kM=String(t),za="start",yd=[],B2=0,Bh=1,wc=0,$s=void 0,t8=void 0,X1=void 0;do $s=YZe(),KZe[za]();while($s.type!=="eof");return typeof n=="function"?TM({"":X1},"",n):X1};function TM(e,t,n){const r=e[t];if(r!=null&&typeof r=="object")if(Array.isArray(r))for(let i=0;i0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const Qqe={tokenize:Gqe,partial:!0};function Fqe(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:qqe,continuation:{tokenize:Hqe},exit:Xqe}},text:{91:{name:"gfmFootnoteCall",tokenize:Vqe},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Uqe,resolveTo:zqe}}}}function Uqe(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=vc(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 zqe(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 Vqe(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||ii(f))return n(f);if(f===93){e.exit("chunkString");const h=e.exit("gfmFootnoteCallString");return i.includes(vc(r.sliceSerialize(h)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return ii(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 qqe(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,a=0,l;return c;function c(b){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(b){return b===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",d):n(b)}function d(b){if(a>999||b===93&&!l||b===null||b===91||ii(b))return n(b);if(b===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return s=vc(r.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return ii(b)||(l=!0),a++,e.consume(b),b===92?f:d}function f(b){return b===91||b===92||b===93?(e.consume(b),a++,d):d(b)}function h(b){return b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),i.includes(s)||i.push(s),yr(e,p,"gfmFootnoteDefinitionWhitespace")):n(b)}function p(b){return t(b)}}function Hqe(e,t,n){return e.check(gw,t,e.attempt(Qqe,t,n))}function Xqe(e){e.exit("gfmFootnoteDefinition")}function Gqe(e,t,n){const r=this;return yr(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 Yqe(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(b):(a.consume(b),f++,p);if(f<2&&!n)return c(b);const O=a.exit("strikethroughSequenceTemporary"),y=Lb(b);return O._open=!y||y===2&&!!g,O._close=!g||g===2&&!!y,l(b)}}}class Wqe{constructor(){this.map=[]}add(t,n,r){Zqe(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 Zqe(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i-1;){const D=r.events[_][1].type;if(D==="lineEnding"||D==="linePrefix")_--;else break}const R=_>-1?r.events[_][1].type:null,$=R==="tableHead"||R==="tableRow"?E:c;return $===E&&r.parser.lazy[r.now().line]?n(N):$(N)}function c(N){return e.enter("tableHead"),e.enter("tableRow"),u(N)}function u(N){return N===124||(a=!0,s+=1),d(N)}function d(N){return N===null?n(N):Zt(N)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),p):n(N):Wn(N)?yr(e,d,"whitespace")(N):(s+=1,a&&(a=!1,i+=1),N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),a=!0,d):(e.enter("data"),f(N)))}function f(N){return N===null||N===124||ii(N)?(e.exit("data"),d(N)):(e.consume(N),N===92?h:f)}function h(N){return N===92||N===124?(e.consume(N),f):f(N)}function p(N){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(N):(e.enter("tableDelimiterRow"),a=!1,Wn(N)?yr(e,b,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):b(N))}function b(N){return N===45||N===58?O(N):N===124?(a=!0,e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),g):S(N)}function g(N){return Wn(N)?yr(e,O,"whitespace")(N):O(N)}function O(N){return N===58?(s+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),y):N===45?(s+=1,y(N)):N===null||Zt(N)?w(N):S(N)}function y(N){return N===45?(e.enter("tableDelimiterFiller"),v(N)):S(N)}function v(N){return N===45?(e.consume(N),v):N===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),x):(e.exit("tableDelimiterFiller"),x(N))}function x(N){return Wn(N)?yr(e,w,"whitespace")(N):w(N)}function w(N){return N===124?b(N):N===null||Zt(N)?!a||i!==s?S(N):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(N)):S(N)}function S(N){return n(N)}function E(N){return e.enter("tableRow"),k(N)}function k(N){return N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),k):N===null||Zt(N)?(e.exit("tableRow"),t(N)):Wn(N)?yr(e,k,"whitespace")(N):(e.enter("data"),T(N))}function T(N){return N===null||N===124||ii(N)?(e.exit("data"),k(N)):(e.consume(N),N===92?C:T)}function C(N){return N===92||N===124?(e.consume(N),T):T(N)}}function tHe(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 Wqe;for(;++nn[2]+1){const b=n[2]+1,g=n[3]-n[2]-1;e.add(b,g,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return i!==void 0&&(s.end=Object.assign({},Yg(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function pq(e,t,n,r,i){const s=[],a=Yg(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 Yg(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const nHe={name:"tasklistCheck",tokenize:iHe};function rHe(){return{text:{91:nHe}}}function iHe(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 ii(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 Zt(c)?t(c):Wn(c)?e.check({tokenize:sHe},t,n)(c):n(c)}}function sHe(e,t,n){return yr(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function aHe(e){return gce([jqe(),Fqe(),Yqe(e),Jqe(),rHe()])}const oHe={};function lHe(e){const t=this,n=e||oHe,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(aHe(n)),s.push(_qe()),a.push(Aqe(n))}const mq=function(e,t,n){const r=bw(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 cue(e,t,n){return e.type==="element"?gHe(e,t,n):e.type==="text"?n.whitespace==="normal"?uue(e,n):bHe(e):[]}function gHe(e,t,n){const r=due(e,n),i=e.children||[];let s=-1,a=[];if(pHe(e))return a;let l,c;for(vM(e)||yq(e)&&mq(t,e,yq)?c=` +`:hHe(e)?(l=2,c=2):lue(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},p=t.optional(i)+e.IDENT_RE+"\\s*\\(",b=["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"],g=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],O=["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"],y=["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:g,keyword:b,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:O},S={className:"function.dispatch",relevance:0,keywords:{_hint:y},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},T={className:"function",begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:w,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:w,relevance:0},{begin:p,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords: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 EHe(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=SHe(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 fue(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"],p=e.SHEBANG({binary:`(${h.join("|")})`,relevance:10}),b={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},g=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],O=["true","false"],y={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:g,literal:O,built_in:[...v,...x,"set","shopt",...w,...S]},contains:[p,e.SHEBANG(),b,f,s,a,y,l,c,u,d,n]}}function kHe(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},p=t.optional(i)+e.IDENT_RE+"\\s*\\(",O={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"},y=[f,l,n,e.C_BLOCK_COMMENT_MODE,d,u],v={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:O,contains:y.concat([{begin:/\(/,end:/\)/,keywords:O,contains:y.concat(["self"]),relevance:0}]),relevance:0},x={begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:O,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:O,relevance:0},{begin:p,returnBegin:!0,contains:[e.inherit(h,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:O,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,d,l,{begin:/\(/,end:/\)/,keywords:O,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:O,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:f,strings:u,keywords:O}}}function THe(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},p=t.optional(i)+e.IDENT_RE+"\\s*\\(",b=["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"],g=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],O=["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"],y=["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:g,keyword:b,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:O},S={className:"function.dispatch",relevance:0,keywords:{_hint:y},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},T={className:"function",begin:"("+a+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:w,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:w,relevance:0},{begin:p,returnBegin:!0,contains:[h],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,d]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords: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 _He(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},p=e.inherit(h,{illegal:/\n/}),b={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,p]},g={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]},O=e.inherit(g,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},p]});h.contains=[g,b,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.C_BLOCK_COMMENT_MODE],p.contains=[O,b,f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,c,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const y={variants:[u,g,b,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"}},y,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:[y,c,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},w]}}const AHe=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_-]*/}}),CHe=["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"],NHe=["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"],jHe=[...CHe,...NHe],RHe=["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(),IHe=["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(),DHe=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),PHe=["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 MHe(e){const t=e.regex,n=AHe(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:":("+IHe.join("|")+")"},{begin:":(:)?("+DHe.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+PHe.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:RHe.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...l,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+jHe.join("|")+")\\b"}]}}function LHe(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 $He(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:"pue(e,t,n-1))}function QHe(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+pue("(?:<"+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,xq,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},xq,u]}}const vq="[A-Za-z$_][0-9A-Za-z$_]*",FHe=["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"],UHe=["true","false","null","undefined","NaN","Infinity"],mue=["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"],gue=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],bue=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],zHe=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],VHe=[].concat(bue,mue,gue);function Oue(e){const t=e.regex,n=(L,{after:U})=>{const F="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(L,U)=>{const F=L[0].length+L.index,q=L.input[F];if(q==="<"||q===","){U.ignoreMatch();return}q===">"&&(n(L,{after:F})||U.ignoreMatch());let z;const B=L.input.substring(F);if(z=B.match(/^\s*=/)){U.ignoreMatch();return}if((z=B.match(/^\s+extends\s+/))&&z.index===0){U.ignoreMatch();return}}},l={$pattern:vq,keyword:FHe,literal:UHe,built_in:VHe,"variable.language":zHe},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:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},b={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},O={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,p,b,g,O,{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"}}]},T={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:{_:[...mue,...gue]}},C={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},N={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[E],illegal:/%/},_={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function R(L){return t.concat("(?!",L.join("|"),")")}const $={match:t.concat(/\b/,R([...bue,"super","import"].map(L=>`${L}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},D={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]},j="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",P={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(j)],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:T},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),C,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,b,g,O,v,{match:/\$\d+/},f,T,{scope:"attr",match:r+t.lookahead(":"),relevance:0},P,{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:j,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"]}]}]},N,{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},D,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[E]},$,_,k,M,{match:/\$[(.]/}]}}function yue(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 Zg="[0-9](_*[0-9])*",hE=`\\.(${Zg})`,pE="[0-9a-fA-F](_*[0-9a-fA-F])*",qHe={className:"number",variants:[{begin:`(\\b(${Zg})((${hE})|\\.)?|(${hE}))[eE][+-]?(${Zg})[fFdD]?\\b`},{begin:`\\b(${Zg})((${hE})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${hE})[fFdD]?\\b`},{begin:`\\b(${Zg})[fFdD]\\b`},{begin:`\\b0[xX]((${pE})\\.?|(${pE})?\\.(${pE}))[pP][+-]?(${Zg})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${pE})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function HHe(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=qHe,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 XHe=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_-]*/}}),GHe=["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"],YHe=["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"],WHe=[...GHe,...YHe],ZHe=["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(),xue=["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(),vue=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),KHe=["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(),JHe=xue.concat(vue).sort().reverse();function eXe(e){const t=XHe(e),n=JHe,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:ZHe.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}),p={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(l)},b={begin:s+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+KHe.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:l}}]},g={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}},O={className:"variable",variants:[{begin:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:h}},y={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:s,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,p,u("keyword","all\\b"),u("variable","@\\{"+i+"\\}"),{begin:"\\b("+WHe.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:":("+xue.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+vue.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:h},{begin:"!important"},t.FUNCTION_DISPATCH]},v={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[y]};return a.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,g,O,v,b,y,p,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:a}}function tXe(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 wue(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 p=[n,c];return[u,d,f,h].forEach(y=>{y.contains=y.contains.concat(p)}),p=p.concat(u,d),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:p},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:p}]}]},n,s,u,d,{className:"quote",begin:"^>\\s+",contains:p,end:"$"},i,r,c,a,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function nXe(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 rXe(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=(g,O,y="\\1")=>{const v=y==="\\1"?y:t.concat(y,O);return t.concat(t.concat("(?:",g,")"),O,/(?:\\.|[^\\\/])*?/,v,/(?:\\.|[^\\\/])*?/,y,r)},p=(g,O,y)=>t.concat(t.concat("(?:",g,")"),O,/(?:\\.|[^\\\/])*?/,y,r),b=[c,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),a,{className:"string",contains:d,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},u,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:h("s|tr|y",t.either(...f,{capture:!0}))},{begin:h("s|tr|y","\\(","\\)")},{begin:h("s|tr|y","\\[","\\]")},{begin:h("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p("(?:m|qr)?",/\//,/\//)},{begin:p("m|qr",t.either(...f,{capture:!0}),/\1/)},{begin:p("m|qr",/\(/,/\)/)},{begin:p("m|qr",/\[/,/\]/)},{begin:p("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,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=b,a.contains=b,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:b}}function iXe(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":(D,M)=>{M.data._beginMatch=D[1]||D[2]},"on:end":(D,M)=>{M.data._beginMatch!==D[1]&&M.ignoreMatch()}},h=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),p=`[ +]`,b={scope:"string",variants:[d,u,f,h]},g={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},O=["false","null","true"],y=["__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:y,literal:(D=>{const M=[];return D.forEach(j=>{M.push(j),j.toLowerCase()===j?M.push(j.toUpperCase()):M.push(j.toLowerCase())}),M})(O),built_in:v},S=D=>D.map(M=>M.replace(/\|\d+$/,"")),E={variants:[{match:[/new/,t.concat(p,"+"),t.concat("(?!",S(v).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},k=t.concat(r,"\\b(?!\\()"),T={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(/(?!::)/))},N={relevance:0,begin:/\(/,end:/\)/,keywords:w,contains:[C,a,T,e.C_BLOCK_COMMENT_MODE,b,g,E]},_={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",S(y).join("\\b|"),"|",S(v).join("\\b|"),"\\b)"),r,t.concat(p,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[N]};N.contains.push(_);const R=[C,T,e.C_BLOCK_COMMENT_MODE,b,g,E],$={begin:t.concat(/#\[\s*\\?/,t.either(i,s)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:O,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:O,keyword:["new","array"]},contains:["self",...R]},...R,{scope:"meta",variants:[{match:i},{match:s}]}]};return{case_insensitive:!1,keywords:w,contains:[$,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,_,T,{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",$,a,T,e.C_BLOCK_COMMENT_MODE,b,g]}]},{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]},b,g]}}function sXe(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 aXe(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function Eue(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])*",p=`(\\b(${h}))?\\.(${h})|\\b(${h})\\.`,b=`\\b|${r.join("|")}`,g={className:"number",relevance:0,variants:[{begin:`(\\b(${h})|(${p}))[eE][+-]?(${h})[jJ]?(?=${b})`},{begin:`(${p})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${b})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${b})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${b})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${b})`},{begin:`\\b(${h})[jJ](?=${b})`}]},O={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:l,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},y={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:["self",c,g,f,e.HASH_COMMENT_MODE]}]};return u.contains=[f,g,c],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:l,illegal:/(<\/|\?)|=>/,contains:[c,g,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},f,O,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[y]},{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:[g,y,f]}]}}function oXe(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function lXe(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 cXe(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",p="[0-9](_?[0-9])*",b={className:"number",relevance:0,variants:[{begin:`\\b(${h})(\\.(${p}))?([eE][+-]?(${p})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},g={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:[g]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[f,{begin:n}],relevance:0},b,{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,g.contains=E;const N=[{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(N).concat(u).concat(E)}}function uXe(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 dXe=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_-]*/}}),fXe=["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"],hXe=["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"],pXe=[...fXe,...hXe],mXe=["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(),gXe=["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(),bXe=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),OXe=["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 yXe(e){const t=dXe(e),n=bXe,r=gXe,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("+pXe.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("+OXe.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:mXe.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 xXe(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function vXe(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"],p=d,b=[...u,...c].filter(S=>!d.includes(S)),g={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},O={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},y={match:t.concat(/\b/,t.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};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 T=k;return E=E||[],S.map(C=>C.match(/\|\d+$/)||E.includes(C)?C:T(C)?`${C}|0`:C)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:w(b,{when:S=>S.length<3}),literal:s,type:l,built_in:f},contains:[{scope:"type",match:v(a)},x,y,g,r,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,O]}}function kue(e){return e?typeof e=="string"?e:e.source:null}function ky(e){return Vr("(?=",e,")")}function Vr(...e){return e.map(n=>kue(n)).join("")}function wXe(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function $a(...e){return"("+(wXe(e).capture?"":"?:")+e.map(r=>kue(r)).join("|")+")"}const H$=e=>Vr(/\b/,e,/\w$/.test(e)?/\b/:/\B/),SXe=["Protocol","Type"].map(H$),wq=["init","self"].map(H$),EXe=["Any","Self"],FR=["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"],Sq=["false","nil","true"],kXe=["assignment","associativity","higherThan","left","lowerThan","none","right"],TXe=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],Eq=["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"],Tue=$a(/[/=\-+!*%<>&|^~?]/,/[\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]/),_ue=$a(Tue,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),UR=Vr(Tue,_ue,"*"),Aue=$a(/[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]/),P2=$a(Aue,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Jc=Vr(Aue,P2,"*"),mE=Vr(/[A-Z]/,P2,"*"),_Xe=["attached","autoclosure",Vr(/convention\(/,$a("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Vr(/objc\(/,Jc,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],AXe=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function CXe(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],i={match:[/\./,$a(...SXe,...wq)],className:{2:"keyword"}},s={match:Vr(/\./,$a(...FR)),relevance:0},a=FR.filter(le=>typeof le=="string").concat(["_|0"]),l=FR.filter(le=>typeof le!="string").concat(EXe).map(H$),c={variants:[{className:"keyword",match:$a(...l,...wq)}]},u={$pattern:$a(/\b\w+/,/#\w+/),keyword:a.concat(TXe),literal:Sq},d=[i,s,c],f={match:Vr(/\./,$a(...Eq)),relevance:0},h={className:"built_in",match:Vr(/\b/,$a(...Eq),/(?=\()/)},p=[f,h],b={match:/->/,relevance:0},g={className:"operator",relevance:0,variants:[{match:UR},{match:`\\.(\\.|${_ue})+`}]},O=[b,g],y="([0-9]_*)+",v="([0-9a-fA-F]_*)+",x={className:"number",relevance:0,variants:[{match:`\\b(${y})(\\.(${y}))?([eE][+-]?(${y}))?\\b`},{match:`\\b0x(${v})(\\.(${v}))?([pP][+-]?(${y}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},w=(le="")=>({className:"subst",variants:[{match:Vr(/\\/,le,/[0\\tnr"']/)},{match:Vr(/\\/,le,/u\{[0-9a-fA-F]{1,8}\}/)}]}),S=(le="")=>({className:"subst",match:Vr(/\\/,le,/[\t ]*(?:[\r\n]|\r\n)/)}),E=(le="")=>({className:"subst",label:"interpol",begin:Vr(/\\/,le,/\(/),end:/\)/}),k=(le="")=>({begin:Vr(le,/"""/),end:Vr(/"""/,le),contains:[w(le),S(le),E(le)]}),T=(le="")=>({begin:Vr(le,/"/),end:Vr(/"/,le),contains:[w(le),E(le)]}),C={className:"string",variants:[k(),k("#"),k("##"),k("###"),T(),T("#"),T("##"),T("###")]},N=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],_={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:N},R=le=>{const ke=Vr(le,/\//),ye=Vr(/\//,le);return{begin:ke,end:ye,contains:[...N,{scope:"comment",begin:`#(?!.*${ye})`,end:/$/}]}},$={scope:"regexp",variants:[R("###"),R("##"),R("#"),_]},D={match:Vr(/`/,Jc,/`/)},M={className:"variable",match:/\$\d+/},j={className:"variable",match:`\\$${P2}+`},P=[D,M,j],L={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:AXe,contains:[...O,x,C]}]}},U={scope:"keyword",match:Vr(/@/,$a(..._Xe),ky($a(/\(/,/\s+/)))},F={scope:"meta",match:Vr(/@/,Jc)},q=[L,U,F],z={match:ky(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Vr(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,P2,"+")},{className:"type",match:mE,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Vr(/\s+&\s+/,ky(mE)),relevance:0}]},B={begin://,keywords:u,contains:[...r,...d,...q,b,z]};z.contains.push(B);const V={match:Vr(Jc,/\s*:/),keywords:"_|0",relevance:0},ce={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",V,...r,$,...d,...p,...O,x,C,...P,...q,z]},we={begin://,keywords:"repeat each",contains:[...r,z]},Oe={begin:$a(ky(Vr(Jc,/\s*:/)),ky(Vr(Jc,/\s+/,Jc,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Jc}]},de={begin:/\(/,end:/\)/,keywords:u,contains:[Oe,...r,...d,...O,x,C,...q,z,ce],endsParent:!0,illegal:/["']/},Z={match:[/(func|macro)/,/\s+/,$a(D.match,Jc,UR)],className:{1:"keyword",3:"title.function"},contains:[we,de,t],illegal:[/\[/,/%/]},J={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[we,de,t],illegal:/\[|%/},fe={match:[/operator/,/\s+/,UR],className:{1:"keyword",3:"title"}},be={begin:[/precedencegroup/,/\s+/,mE],className:{1:"keyword",3:"title"},contains:[z],keywords:[...kXe,...Sq],end:/}/},je={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Qe={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},Me={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,Jc,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:u,contains:[we,...d,{begin:/:/,end:/\{/,keywords:u,contains:[{scope:"title.class.inherited",match:mE},...d],relevance:0}]};for(const le of C.variants){const ke=le.contains.find($e=>$e.label==="interpol");ke.keywords=u;const ye=[...d,...p,...O,x,C,...P];ke.contains=[...ye,{begin:/\(/,end:/\)/,contains:["self",...ye]}]}return{name:"Swift",keywords:u,contains:[...r,Z,J,je,Qe,Me,fe,be,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},$,...d,...p,...O,x,C,...P,...q,z,ce]}}const M2="[A-Za-z$_][0-9A-Za-z$_]*",Cue=["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"],Nue=["true","false","null","undefined","NaN","Infinity"],jue=["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"],Rue=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Iue=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Due=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Pue=[].concat(Iue,jue,Rue);function NXe(e){const t=e.regex,n=(L,{after:U})=>{const F="",end:""},s=/<[A-Za-z0-9\\._:-]+\s*\/>/,a={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(L,U)=>{const F=L[0].length+L.index,q=L.input[F];if(q==="<"||q===","){U.ignoreMatch();return}q===">"&&(n(L,{after:F})||U.ignoreMatch());let z;const B=L.input.substring(F);if(z=B.match(/^\s*=/)){U.ignoreMatch();return}if((z=B.match(/^\s+extends\s+/))&&z.index===0){U.ignoreMatch();return}}},l={$pattern:M2,keyword:Cue,literal:Nue,built_in:Pue,"variable.language":Due},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:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},b={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},O={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,p,b,g,O,{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"}}]},T={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:{_:[...jue,...Rue]}},C={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},N={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[E],illegal:/%/},_={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function R(L){return t.concat("(?!",L.join("|"),")")}const $={match:t.concat(/\b/,R([...Iue,"super","import"].map(L=>`${L}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},D={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]},j="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",P={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(j)],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:T},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),C,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,b,g,O,v,{match:/\$\d+/},f,T,{scope:"attr",match:r+t.lookahead(":"),relevance:0},P,{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:j,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"]}]}]},N,{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},D,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[E]},$,_,k,M,{match:/\$[(.]/}]}}function Mue(e){const t=e.regex,n=NXe(e),r=M2,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:M2,keyword:Cue.concat(c),literal:Nue,built_in:Pue.concat(i),"variable.language":Due},d={className:"meta",begin:"@"+r},f=(g,O,y)=>{const v=g.contains.findIndex(x=>x.label===O);if(v===-1)throw new Error("can not find mode to replace");g.contains.splice(v,1,y)};Object.assign(n.keywords,u),n.exports.PARAMS_CONTAINS.push(d);const h=n.contains.find(g=>g.scope==="attr"),p=Object.assign({},h,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,h,p]),n.contains=n.contains.concat([d,s,a,p]),f(n,"shebang",e.SHEBANG()),f(n,"use_strict",l);const b=n.contains.find(g=>g.label==="func.def");return b.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function jXe(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 RXe(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 IXe(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 Lue(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"},p={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},b={begin:/\{/,end:/\}/,contains:[p],illegal:"\\n",relevance:0},g={begin:"\\[",end:"\\]",contains:[p],illegal:"\\n",relevance:0},O=[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},b,g,s,a],y=[...O];return y.pop(),y.push(l),p.contains=y,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:O}}const DXe={arduino:EHe,bash:fue,c:kHe,cpp:THe,csharp:_He,css:MHe,diff:LHe,go:$He,graphql:BHe,ini:hue,java:QHe,javascript:Oue,json:yue,kotlin:HHe,less:eXe,lua:tXe,makefile:wue,markdown:Sue,objectivec:nXe,perl:rXe,php:iXe,"php-template":sXe,plaintext:aXe,python:Eue,"python-repl":oXe,r:lXe,ruby:cXe,rust:uXe,scss:yXe,shell:xXe,sql:vXe,swift:CXe,typescript:Mue,vbnet:jXe,wasm:RXe,xml:IXe,yaml:Lue};function $ue(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)&&$ue(n)}),e}let kq=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function Bue(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function sh(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 PXe="",Tq=e=>!!e.scope,MXe=(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 LXe{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=Bue(t)}openNode(t){if(!Tq(t))return;const n=MXe(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){Tq(t)&&(this.buffer+=PXe)}value(){return this.buffer}span(t){this.buffer+=``}}const _q=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class X${constructor(){this.rootNode=_q(),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=_q({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=>{X$._collapse(n)}))}}class $Xe extends X${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 LXe(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function Jx(e){return e?typeof e=="string"?e:e.source:null}function Que(e){return Jm("(?=",e,")")}function BXe(e){return Jm("(?:",e,")*")}function QXe(e){return Jm("(?:",e,")?")}function Jm(...e){return e.map(n=>Jx(n)).join("")}function FXe(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function G$(...e){return"("+(FXe(e).capture?"":"?:")+e.map(r=>Jx(r)).join("|")+")"}function Fue(e){return new RegExp(e.toString()+"|").exec("").length-1}function UXe(e,t){const n=e&&e.exec(t);return n&&n.index===0}const zXe=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function Y$(e,{joinWith:t}){let n=0;return e.map(r=>{n+=1;const i=n;let s=Jx(r),a="";for(;s.length>0;){const l=zXe.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 VXe=/\b\B/,Uue="[a-zA-Z]\\w*",W$="[a-zA-Z_]\\w*",zue="\\b\\d+(\\.\\d+)?",Vue="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",que="\\b(0b[01]+)",qXe="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",HXe=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=Jm(t,/.*\b/,e.binary,/\b.*/)),sh({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},e)},ev={begin:"\\\\[\\s\\S]",relevance:0},XXe={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[ev]},GXe={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[ev]},YXe={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/},cC=function(e,t,n={}){const r=sh({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=G$("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:Jm(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},WXe=cC("//","$"),ZXe=cC("/\\*","\\*/"),KXe=cC("#","$"),JXe={scope:"number",begin:zue,relevance:0},eGe={scope:"number",begin:Vue,relevance:0},tGe={scope:"number",begin:que,relevance:0},nGe={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[ev,{begin:/\[/,end:/\]/,relevance:0,contains:[ev]}]},rGe={scope:"title",begin:Uue,relevance:0},iGe={scope:"title",begin:W$,relevance:0},sGe={begin:"\\.\\s*"+W$,relevance:0},aGe=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 gE=Object.freeze({__proto__:null,APOS_STRING_MODE:XXe,BACKSLASH_ESCAPE:ev,BINARY_NUMBER_MODE:tGe,BINARY_NUMBER_RE:que,COMMENT:cC,C_BLOCK_COMMENT_MODE:ZXe,C_LINE_COMMENT_MODE:WXe,C_NUMBER_MODE:eGe,C_NUMBER_RE:Vue,END_SAME_AS_BEGIN:aGe,HASH_COMMENT_MODE:KXe,IDENT_RE:Uue,MATCH_NOTHING_RE:VXe,METHOD_GUARD:sGe,NUMBER_MODE:JXe,NUMBER_RE:zue,PHRASAL_WORDS_MODE:YXe,QUOTE_STRING_MODE:GXe,REGEXP_MODE:nGe,RE_STARTERS_RE:qXe,SHEBANG:HXe,TITLE_MODE:rGe,UNDERSCORE_IDENT_RE:W$,UNDERSCORE_TITLE_MODE:iGe});function oGe(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function lGe(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function cGe(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=oGe,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function uGe(e,t){Array.isArray(e.illegal)&&(e.illegal=G$(...e.illegal))}function dGe(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 fGe(e,t){e.relevance===void 0&&(e.relevance=1)}const hGe=(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=Jm(n.beforeMatch,Que(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},pGe=["of","and","for","in","not","or","if","then","parent","list","value"],mGe="keyword";function Hue(e,t,n=mGe){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,Hue(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,gGe(c[0],c[1])]})}}function gGe(e,t){return t?Number(t):bGe(e)?0:1}function bGe(e){return pGe.includes(e.toLowerCase())}const Aq={},hm=e=>{console.error(e)},Cq=(e,...t)=>{console.log(`WARN: ${e}`,...t)},jg=(e,t)=>{Aq[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),Aq[`${e}/${t}`]=!0)},L2=new Error;function Xue(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+=Fue(t[l-1]);e[n]=a,e[n]._emit=s,e[n]._multi=!0}function OGe(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw hm("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),L2;if(typeof e.beginScope!="object"||e.beginScope===null)throw hm("beginScope must be object"),L2;Xue(e,e.begin,{key:"beginScope"}),e.begin=Y$(e.begin,{joinWith:""})}}function yGe(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw hm("skip, excludeEnd, returnEnd not compatible with endScope: {}"),L2;if(typeof e.endScope!="object"||e.endScope===null)throw hm("endScope must be object"),L2;Xue(e,e.end,{key:"endScope"}),e.end=Y$(e.end,{joinWith:""})}}function xGe(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function vGe(e){xGe(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),OGe(e),yGe(e)}function wGe(e){function t(a,l){return new RegExp(Jx(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+=Fue(l)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const l=this.regexes.map(c=>c[1]);this.matcherRe=t(Y$(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;[lGe,dGe,vGe,hGe].forEach(d=>d(a,l)),e.compilerExtensions.forEach(d=>d(a,l)),a.__beforeBegin=null,[cGe,uGe,fGe].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=Hue(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=Jx(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 SGe(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=sh(e.classNameAliases||{}),s(e)}function Gue(e){return e?e.endsWithParent||Gue(e.starts):!1}function SGe(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return sh(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:Gue(e)?sh(e,{starts:e.starts?sh(e.starts):null}):Object.isFrozen(e)?sh(e):e}var EGe="11.11.1";class kGe extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}}const zR=Bue,Nq=sh,jq=Symbol("nomatch"),TGe=7,Yue=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:$Xe};function c(j){return l.noHighlightRe.test(j)}function u(j){let P=j.className+" ";P+=j.parentNode?j.parentNode.className:"";const L=l.languageDetectRe.exec(P);if(L){const U=T(L[1]);return U||(Cq(s.replace("{}",L[1])),Cq("Falling back to no-highlight mode for this block.",j)),U?L[1]:"no-highlight"}return P.split(/\s+/).find(U=>c(U)||T(U))}function d(j,P,L){let U="",F="";typeof P=="object"?(U=j,L=P.ignoreIllegals,F=P.language):(jg("10.7.0","highlight(lang, code, ...args) has been deprecated."),jg("10.7.0",`Please use highlight(code, options) instead. +https://github.com/highlightjs/highlight.js/issues/2277`),F=j,U=P),L===void 0&&(L=!0);const q={code:U,language:F};D("before:highlight",q);const z=q.result?q.result:f(q.language,q.code,L);return z.code=q.code,D("after:highlight",z),z}function f(j,P,L,U){const F=Object.create(null);function q(W,ne){return W.keywords[ne]}function z(){if(!ye.keywords){ze.addText(Ae);return}let W=0;ye.keywordPatternRe.lastIndex=0;let ne=ye.keywordPatternRe.exec(Ae),he="";for(;ne;){he+=Ae.substring(W,ne.index);const xe=Me.case_insensitive?ne[0].toLowerCase():ne[0],re=q(ye,xe);if(re){const[Re,nt]=re;if(ze.addText(he),he="",F[xe]=(F[xe]||0)+1,F[xe]<=TGe&&(Ve+=nt),Re.startsWith("_"))he+=ne[0];else{const Ke=Me.classNameAliases[Re]||Re;ce(ne[0],Ke)}}else he+=ne[0];W=ye.keywordPatternRe.lastIndex,ne=ye.keywordPatternRe.exec(Ae)}he+=Ae.substring(W),ze.addText(he)}function B(){if(Ae==="")return;let W=null;if(typeof ye.subLanguage=="string"){if(!t[ye.subLanguage]){ze.addText(Ae);return}W=f(ye.subLanguage,Ae,!0,$e[ye.subLanguage]),$e[ye.subLanguage]=W._top}else W=p(Ae,ye.subLanguage.length?ye.subLanguage:null);ye.relevance>0&&(Ve+=W.relevance),ze.__addSublanguage(W._emitter,W.language)}function V(){ye.subLanguage!=null?B():z(),Ae=""}function ce(W,ne){W!==""&&(ze.startScope(ne),ze.addText(W),ze.endScope())}function we(W,ne){let he=1;const xe=ne.length-1;for(;he<=xe;){if(!W._emit[he]){he++;continue}const re=Me.classNameAliases[W[he]]||W[he],Re=ne[he];re?ce(Re,re):(Ae=Re,z(),Ae=""),he++}}function Oe(W,ne){return W.scope&&typeof W.scope=="string"&&ze.openNode(Me.classNameAliases[W.scope]||W.scope),W.beginScope&&(W.beginScope._wrap?(ce(Ae,Me.classNameAliases[W.beginScope._wrap]||W.beginScope._wrap),Ae=""):W.beginScope._multi&&(we(W.beginScope,ne),Ae="")),ye=Object.create(W,{parent:{value:ye}}),ye}function de(W,ne,he){let xe=UXe(W.endRe,he);if(xe){if(W["on:end"]){const re=new kq(W);W["on:end"](ne,re),re.isMatchIgnored&&(xe=!1)}if(xe){for(;W.endsParent&&W.parent;)W=W.parent;return W}}if(W.endsWithParent)return de(W.parent,ne,he)}function Z(W){return ye.matcher.regexIndex===0?(Ae+=W[0],1):(We=!0,0)}function J(W){const ne=W[0],he=W.rule,xe=new kq(he),re=[he.__beforeBegin,he["on:begin"]];for(const Re of re)if(Re&&(Re(W,xe),xe.isMatchIgnored))return Z(ne);return he.skip?Ae+=ne:(he.excludeBegin&&(Ae+=ne),V(),!he.returnBegin&&!he.excludeBegin&&(Ae=ne)),Oe(he,W),he.returnBegin?0:ne.length}function fe(W){const ne=W[0],he=P.substring(W.index),xe=de(ye,W,he);if(!xe)return jq;const re=ye;ye.endScope&&ye.endScope._wrap?(V(),ce(ne,ye.endScope._wrap)):ye.endScope&&ye.endScope._multi?(V(),we(ye.endScope,W)):re.skip?Ae+=ne:(re.returnEnd||re.excludeEnd||(Ae+=ne),V(),re.excludeEnd&&(Ae=ne));do ye.scope&&ze.closeNode(),!ye.skip&&!ye.subLanguage&&(Ve+=ye.relevance),ye=ye.parent;while(ye!==xe.parent);return xe.starts&&Oe(xe.starts,W),re.returnEnd?0:ne.length}function be(){const W=[];for(let ne=ye;ne!==Me;ne=ne.parent)ne.scope&&W.unshift(ne.scope);W.forEach(ne=>ze.openNode(ne))}let je={};function Qe(W,ne){const he=ne&&ne[0];if(Ae+=W,he==null)return V(),0;if(je.type==="begin"&&ne.type==="end"&&je.index===ne.index&&he===""){if(Ae+=P.slice(ne.index,ne.index+1),!i){const xe=new Error(`0 width match regex (${j})`);throw xe.languageName=j,xe.badRule=je.rule,xe}return 1}if(je=ne,ne.type==="begin")return J(ne);if(ne.type==="illegal"&&!L){const xe=new Error('Illegal lexeme "'+he+'" for mode "'+(ye.scope||"")+'"');throw xe.mode=ye,xe}else if(ne.type==="end"){const xe=fe(ne);if(xe!==jq)return xe}if(ne.type==="illegal"&&he==="")return Ae+=` +`,1;if(Tt>1e5&&Tt>ne.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Ae+=he,he.length}const Me=T(j);if(!Me)throw hm(s.replace("{}",j)),new Error('Unknown language: "'+j+'"');const le=wGe(Me);let ke="",ye=U||le;const $e={},ze=new l.__emitter(l);be();let Ae="",Ve=0,ut=0,Tt=0,We=!1;try{if(Me.__emitTokens)Me.__emitTokens(P,ze);else{for(ye.matcher.considerAll();;){Tt++,We?We=!1:ye.matcher.considerAll(),ye.matcher.lastIndex=ut;const W=ye.matcher.exec(P);if(!W)break;const ne=P.substring(ut,W.index),he=Qe(ne,W);ut=W.index+he}Qe(P.substring(ut))}return ze.finalize(),ke=ze.toHTML(),{language:j,value:ke,relevance:Ve,illegal:!1,_emitter:ze,_top:ye}}catch(W){if(W.message&&W.message.includes("Illegal"))return{language:j,value:zR(P),illegal:!0,relevance:0,_illegalBy:{message:W.message,index:ut,context:P.slice(ut-100,ut+100),mode:W.mode,resultSoFar:ke},_emitter:ze};if(i)return{language:j,value:zR(P),illegal:!1,relevance:0,errorRaised:W,_emitter:ze,_top:ye};throw W}}function h(j){const P={value:zR(j),illegal:!1,relevance:0,_top:a,_emitter:new l.__emitter(l)};return P._emitter.addText(j),P}function p(j,P){P=P||l.languages||Object.keys(t);const L=h(j),U=P.filter(T).filter(N).map(V=>f(V,j,!1));U.unshift(L);const F=U.sort((V,ce)=>{if(V.relevance!==ce.relevance)return ce.relevance-V.relevance;if(V.language&&ce.language){if(T(V.language).supersetOf===ce.language)return 1;if(T(ce.language).supersetOf===V.language)return-1}return 0}),[q,z]=F,B=q;return B.secondBest=z,B}function b(j,P,L){const U=P&&n[P]||L;j.classList.add("hljs"),j.classList.add(`language-${U}`)}function g(j){let P=null;const L=u(j);if(c(L))return;if(D("before:highlightElement",{el:j,language:L}),j.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",j);return}if(j.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(j)),l.throwUnescapedHTML))throw new kGe("One of your code blocks includes unescaped HTML.",j.innerHTML);P=j;const U=P.textContent,F=L?d(U,{language:L,ignoreIllegals:!0}):p(U);j.innerHTML=F.value,j.dataset.highlighted="yes",b(j,L,F.language),j.result={language:F.language,re:F.relevance,relevance:F.relevance},F.secondBest&&(j.secondBest={language:F.secondBest.language,relevance:F.secondBest.relevance}),D("after:highlightElement",{el:j,result:F,text:U})}function O(j){l=Nq(l,j)}const y=()=>{w(),jg("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function v(){w(),jg("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let x=!1;function w(){function j(){w()}if(document.readyState==="loading"){x||window.addEventListener("DOMContentLoaded",j,!1),x=!0;return}document.querySelectorAll(l.cssSelector).forEach(g)}function S(j,P){let L=null;try{L=P(e)}catch(U){if(hm("Language definition for '{}' could not be registered.".replace("{}",j)),i)hm(U);else throw U;L=a}L.name||(L.name=j),t[j]=L,L.rawDefinition=P.bind(null,e),L.aliases&&C(L.aliases,{languageName:j})}function E(j){delete t[j];for(const P of Object.keys(n))n[P]===j&&delete n[P]}function k(){return Object.keys(t)}function T(j){return j=(j||"").toLowerCase(),t[j]||t[n[j]]}function C(j,{languageName:P}){typeof j=="string"&&(j=[j]),j.forEach(L=>{n[L.toLowerCase()]=P})}function N(j){const P=T(j);return P&&!P.disableAutodetect}function _(j){j["before:highlightBlock"]&&!j["before:highlightElement"]&&(j["before:highlightElement"]=P=>{j["before:highlightBlock"](Object.assign({block:P.el},P))}),j["after:highlightBlock"]&&!j["after:highlightElement"]&&(j["after:highlightElement"]=P=>{j["after:highlightBlock"](Object.assign({block:P.el},P))})}function R(j){_(j),r.push(j)}function $(j){const P=r.indexOf(j);P!==-1&&r.splice(P,1)}function D(j,P){const L=j;r.forEach(function(U){U[L]&&U[L](P)})}function M(j){return jg("10.7.0","highlightBlock will be removed entirely in v12.0"),jg("10.7.0","Please use highlightElement now."),g(j)}Object.assign(e,{highlight:d,highlightAuto:p,highlightAll:w,highlightElement:g,highlightBlock:M,configure:O,initHighlighting:y,initHighlightingOnLoad:v,registerLanguage:S,unregisterLanguage:E,listLanguages:k,getLanguage:T,registerAliases:C,autoDetection:N,inherit:Nq,addPlugin:R,removePlugin:$}),e.debugMode=function(){i=!1},e.safeMode=function(){i=!0},e.versionString=EGe,e.regex={concat:Jm,lookahead:Que,either:G$,optional:QXe,anyNumberOfTimes:BXe};for(const j in gE)typeof gE[j]=="object"&&$ue(gE[j]);return Object.assign(e,gE),e},Bb=Yue({});Bb.newInstance=()=>Yue({});var _Ge=Bb;Bb.HighlightJS=Bb;Bb.default=Bb;const yo=eO(_Ge),Rq={},AGe="hljs-";function CGe(e){const t=yo.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||Rq,h=typeof f.prefix=="string"?f.prefix:AGe;if(!t.getLanguage(c))throw new Error("Unknown language: `"+c+"` is not registered");t.configure({__emitter:NGe,classPrefix:h});const p=t.highlight(u,{ignoreIllegals:!0,language:c});if(p.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:p.errorRaised});const b=p._emitter.root,g=b.data;return g.language=p.language,g.relevance=p.relevance,b}function r(c,u){const f=(u||Rq).subset||i();let h=-1,p=0,b;for(;++hp&&(p=O.data.relevance,b=O)}return b||{type:"root",children:[],data:{language:void 0,relevance:p}}}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 NGe{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 jGe={};function Iq(e){const t=e||jGe,n=t.aliases,r=t.detect||!1,i=t.languages||DXe,s=t.plainText,a=t.prefix,l=t.subset;let c="hljs";const u=CGe(i);if(n&&u.registerAlias(n),a){const d=a.indexOf("-");c=d===-1?a:a.slice(0,d)}return function(d,f){Ow(d,"element",function(h,p,b){if(h.tagName!=="code"||!b||b.type!=="element"||b.tagName!=="pre")return;const g=RGe(h);if(g===!1||!g&&!r||g&&s&&s.includes(g))return;Array.isArray(h.properties.className)||(h.properties.className=[]),h.properties.className.includes(c)||h.properties.className.unshift(c);const O=mHe(h,{whitespace:"pre"});let y;try{y=g?u.highlight(g,O,{prefix:a}):u.highlightAuto(O,{prefix:a,subset:l})}catch(v){const x=v;if(g&&/Unknown language/.test(x.message)){f.message("Cannot highlight as `"+g+"`, it’s not registered",{ancestors:[b,h],cause:x,place:h.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw x}!g&&y.data&&y.data.language&&h.properties.className.push("language-"+y.data.language),y.children.length>0&&(h.children=y.children)})}}function RGe(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=Mq(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 iYe(e){return e>=56320&&e<=57343}function sYe(e,t){return(e-55296)*1024+9216+t}function tde(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function nde(e){return e>=64976&&e<=65007||rYe.has(e)}var Be;(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"})(Be||(Be={}));const aYe=65536;class oYe{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=aYe,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(iYe(n))return this.pos++,this._addGap(),sYe(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,K.EOF;return this._err(Be.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,K.EOF;const r=this.html.charCodeAt(n);return r===K.CARRIAGE_RETURN?K.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,K.EOF;let t=this.html.charCodeAt(this.pos);return t===K.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,K.LINE_FEED):t===K.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,ede(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===K.LINE_FEED||t===K.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){tde(t)?this._err(Be.controlCharacterInInputStream):nde(t)&&this._err(Be.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 lYe=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))),cYe=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 uYe(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=cYe.get(e))!==null&&t!==void 0?t:e}var Hs;(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"})(Hs||(Hs={}));const dYe=32;var ah;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(ah||(ah={}));function SM(e){return e>=Hs.ZERO&&e<=Hs.NINE}function fYe(e){return e>=Hs.UPPER_A&&e<=Hs.UPPER_F||e>=Hs.LOWER_A&&e<=Hs.LOWER_F}function hYe(e){return e>=Hs.UPPER_A&&e<=Hs.UPPER_Z||e>=Hs.LOWER_A&&e<=Hs.LOWER_Z||SM(e)}function pYe(e){return e===Hs.EQUALS||hYe(e)}var $s;(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"})($s||($s={}));var Od;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(Od||(Od={}));class mYe{constructor(t,n,r){this.decodeTree=t,this.emitCodePoint=n,this.errors=r,this.state=$s.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Od.Strict}startEntity(t){this.decodeMode=t,this.state=$s.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case $s.EntityStart:return t.charCodeAt(n)===Hs.NUM?(this.state=$s.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=$s.NamedEntity,this.stateNamedEntity(t,n));case $s.NumericStart:return this.stateNumericStart(t,n);case $s.NumericDecimal:return this.stateNumericDecimal(t,n);case $s.NumericHex:return this.stateNumericHex(t,n);case $s.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|dYe)===Hs.LOWER_X?(this.state=$s.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=$s.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===Hs.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==Od.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]&ah.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]&~ah.VALUE_LENGTH:i[t+1],r),n===3&&this.emitCodePoint(i[t+2],r),r}end(){var t;switch(this.state){case $s.NamedEntity:return this.result!==0&&(this.decodeMode!==Od.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case $s.NumericDecimal:return this.emitNumericEntity(0,2);case $s.NumericHex:return this.emitNumericEntity(0,3);case $s.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case $s.EntityStart:return 0}}}function gYe(e,t,n,r){const i=(t&ah.BRANCH_LENGTH)>>7,s=t&ah.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 et;(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/"})(et||(et={}));var pm;(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"})(pm||(pm={}));var Tl;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(Tl||(Tl={}));var Te;(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"})(Te||(Te={}));var A;(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"})(A||(A={}));const bYe=new Map([[Te.A,A.A],[Te.ADDRESS,A.ADDRESS],[Te.ANNOTATION_XML,A.ANNOTATION_XML],[Te.APPLET,A.APPLET],[Te.AREA,A.AREA],[Te.ARTICLE,A.ARTICLE],[Te.ASIDE,A.ASIDE],[Te.B,A.B],[Te.BASE,A.BASE],[Te.BASEFONT,A.BASEFONT],[Te.BGSOUND,A.BGSOUND],[Te.BIG,A.BIG],[Te.BLOCKQUOTE,A.BLOCKQUOTE],[Te.BODY,A.BODY],[Te.BR,A.BR],[Te.BUTTON,A.BUTTON],[Te.CAPTION,A.CAPTION],[Te.CENTER,A.CENTER],[Te.CODE,A.CODE],[Te.COL,A.COL],[Te.COLGROUP,A.COLGROUP],[Te.DD,A.DD],[Te.DESC,A.DESC],[Te.DETAILS,A.DETAILS],[Te.DIALOG,A.DIALOG],[Te.DIR,A.DIR],[Te.DIV,A.DIV],[Te.DL,A.DL],[Te.DT,A.DT],[Te.EM,A.EM],[Te.EMBED,A.EMBED],[Te.FIELDSET,A.FIELDSET],[Te.FIGCAPTION,A.FIGCAPTION],[Te.FIGURE,A.FIGURE],[Te.FONT,A.FONT],[Te.FOOTER,A.FOOTER],[Te.FOREIGN_OBJECT,A.FOREIGN_OBJECT],[Te.FORM,A.FORM],[Te.FRAME,A.FRAME],[Te.FRAMESET,A.FRAMESET],[Te.H1,A.H1],[Te.H2,A.H2],[Te.H3,A.H3],[Te.H4,A.H4],[Te.H5,A.H5],[Te.H6,A.H6],[Te.HEAD,A.HEAD],[Te.HEADER,A.HEADER],[Te.HGROUP,A.HGROUP],[Te.HR,A.HR],[Te.HTML,A.HTML],[Te.I,A.I],[Te.IMG,A.IMG],[Te.IMAGE,A.IMAGE],[Te.INPUT,A.INPUT],[Te.IFRAME,A.IFRAME],[Te.KEYGEN,A.KEYGEN],[Te.LABEL,A.LABEL],[Te.LI,A.LI],[Te.LINK,A.LINK],[Te.LISTING,A.LISTING],[Te.MAIN,A.MAIN],[Te.MALIGNMARK,A.MALIGNMARK],[Te.MARQUEE,A.MARQUEE],[Te.MATH,A.MATH],[Te.MENU,A.MENU],[Te.META,A.META],[Te.MGLYPH,A.MGLYPH],[Te.MI,A.MI],[Te.MO,A.MO],[Te.MN,A.MN],[Te.MS,A.MS],[Te.MTEXT,A.MTEXT],[Te.NAV,A.NAV],[Te.NOBR,A.NOBR],[Te.NOFRAMES,A.NOFRAMES],[Te.NOEMBED,A.NOEMBED],[Te.NOSCRIPT,A.NOSCRIPT],[Te.OBJECT,A.OBJECT],[Te.OL,A.OL],[Te.OPTGROUP,A.OPTGROUP],[Te.OPTION,A.OPTION],[Te.P,A.P],[Te.PARAM,A.PARAM],[Te.PLAINTEXT,A.PLAINTEXT],[Te.PRE,A.PRE],[Te.RB,A.RB],[Te.RP,A.RP],[Te.RT,A.RT],[Te.RTC,A.RTC],[Te.RUBY,A.RUBY],[Te.S,A.S],[Te.SCRIPT,A.SCRIPT],[Te.SEARCH,A.SEARCH],[Te.SECTION,A.SECTION],[Te.SELECT,A.SELECT],[Te.SOURCE,A.SOURCE],[Te.SMALL,A.SMALL],[Te.SPAN,A.SPAN],[Te.STRIKE,A.STRIKE],[Te.STRONG,A.STRONG],[Te.STYLE,A.STYLE],[Te.SUB,A.SUB],[Te.SUMMARY,A.SUMMARY],[Te.SUP,A.SUP],[Te.TABLE,A.TABLE],[Te.TBODY,A.TBODY],[Te.TEMPLATE,A.TEMPLATE],[Te.TEXTAREA,A.TEXTAREA],[Te.TFOOT,A.TFOOT],[Te.TD,A.TD],[Te.TH,A.TH],[Te.THEAD,A.THEAD],[Te.TITLE,A.TITLE],[Te.TR,A.TR],[Te.TRACK,A.TRACK],[Te.TT,A.TT],[Te.U,A.U],[Te.UL,A.UL],[Te.SVG,A.SVG],[Te.VAR,A.VAR],[Te.WBR,A.WBR],[Te.XMP,A.XMP]]);function RO(e){var t;return(t=bYe.get(e))!==null&&t!==void 0?t:A.UNKNOWN}const st=A,OYe={[et.HTML]:new Set([st.ADDRESS,st.APPLET,st.AREA,st.ARTICLE,st.ASIDE,st.BASE,st.BASEFONT,st.BGSOUND,st.BLOCKQUOTE,st.BODY,st.BR,st.BUTTON,st.CAPTION,st.CENTER,st.COL,st.COLGROUP,st.DD,st.DETAILS,st.DIR,st.DIV,st.DL,st.DT,st.EMBED,st.FIELDSET,st.FIGCAPTION,st.FIGURE,st.FOOTER,st.FORM,st.FRAME,st.FRAMESET,st.H1,st.H2,st.H3,st.H4,st.H5,st.H6,st.HEAD,st.HEADER,st.HGROUP,st.HR,st.HTML,st.IFRAME,st.IMG,st.INPUT,st.LI,st.LINK,st.LISTING,st.MAIN,st.MARQUEE,st.MENU,st.META,st.NAV,st.NOEMBED,st.NOFRAMES,st.NOSCRIPT,st.OBJECT,st.OL,st.P,st.PARAM,st.PLAINTEXT,st.PRE,st.SCRIPT,st.SECTION,st.SELECT,st.SOURCE,st.STYLE,st.SUMMARY,st.TABLE,st.TBODY,st.TD,st.TEMPLATE,st.TEXTAREA,st.TFOOT,st.TH,st.THEAD,st.TITLE,st.TR,st.TRACK,st.UL,st.WBR,st.XMP]),[et.MATHML]:new Set([st.MI,st.MO,st.MN,st.MS,st.MTEXT,st.ANNOTATION_XML]),[et.SVG]:new Set([st.TITLE,st.FOREIGN_OBJECT,st.DESC]),[et.XLINK]:new Set,[et.XML]:new Set,[et.XMLNS]:new Set},EM=new Set([st.H1,st.H2,st.H3,st.H4,st.H5,st.H6]);Te.STYLE,Te.SCRIPT,Te.XMP,Te.IFRAME,Te.NOEMBED,Te.NOFRAMES,Te.PLAINTEXT;var ie;(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"})(ie||(ie={}));const as={DATA:ie.DATA,RCDATA:ie.RCDATA,RAWTEXT:ie.RAWTEXT,SCRIPT_DATA:ie.SCRIPT_DATA,PLAINTEXT:ie.PLAINTEXT,CDATA_SECTION:ie.CDATA_SECTION};function yYe(e){return e>=K.DIGIT_0&&e<=K.DIGIT_9}function s1(e){return e>=K.LATIN_CAPITAL_A&&e<=K.LATIN_CAPITAL_Z}function xYe(e){return e>=K.LATIN_SMALL_A&&e<=K.LATIN_SMALL_Z}function Mf(e){return xYe(e)||s1(e)}function $q(e){return Mf(e)||yYe(e)}function bE(e){return e+32}function ide(e){return e===K.SPACE||e===K.LINE_FEED||e===K.TABULATION||e===K.FORM_FEED}function Bq(e){return ide(e)||e===K.SOLIDUS||e===K.GREATER_THAN_SIGN}function vYe(e){return e===K.NULL?Be.nullCharacterReference:e>1114111?Be.characterReferenceOutsideUnicodeRange:ede(e)?Be.surrogateCharacterReference:nde(e)?Be.noncharacterCharacterReference:tde(e)||e===K.CARRIAGE_RETURN?Be.controlCharacterReference:null}class wYe{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=ie.DATA,this.returnState=ie.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new oYe(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new mYe(lYe,(r,i)=>{this.preprocessor.pos=this.entityStartPos+i-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(Be.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(Be.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const i=vYe(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(Be.endTagWithAttributes),t.selfClosing&&this._err(Be.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 Fn.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case Fn.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case Fn.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:Fn.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=ide(t)?Fn.WHITESPACE_CHARACTER:t===K.NULL?Fn.NULL_CHARACTER:Fn.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(Fn.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=ie.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Od.Attribute:Od.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===ie.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===ie.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===ie.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case ie.DATA:{this._stateData(t);break}case ie.RCDATA:{this._stateRcdata(t);break}case ie.RAWTEXT:{this._stateRawtext(t);break}case ie.SCRIPT_DATA:{this._stateScriptData(t);break}case ie.PLAINTEXT:{this._statePlaintext(t);break}case ie.TAG_OPEN:{this._stateTagOpen(t);break}case ie.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case ie.TAG_NAME:{this._stateTagName(t);break}case ie.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case ie.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case ie.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case ie.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case ie.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case ie.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case ie.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case ie.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case ie.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case ie.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case ie.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case ie.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case ie.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case ie.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case ie.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case ie.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case ie.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case ie.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case ie.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case ie.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case ie.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case ie.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case ie.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case ie.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case ie.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case ie.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case ie.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case ie.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case ie.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case ie.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case ie.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case ie.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case ie.BOGUS_COMMENT:{this._stateBogusComment(t);break}case ie.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case ie.COMMENT_START:{this._stateCommentStart(t);break}case ie.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case ie.COMMENT:{this._stateComment(t);break}case ie.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case ie.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case ie.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case ie.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case ie.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case ie.COMMENT_END:{this._stateCommentEnd(t);break}case ie.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case ie.DOCTYPE:{this._stateDoctype(t);break}case ie.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case ie.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case ie.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case ie.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case ie.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case ie.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case ie.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case ie.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case ie.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case ie.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case ie.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case ie.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case ie.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case ie.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case ie.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case ie.CDATA_SECTION:{this._stateCdataSection(t);break}case ie.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case ie.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case ie.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case ie.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case K.LESS_THAN_SIGN:{this.state=ie.TAG_OPEN;break}case K.AMPERSAND:{this._startCharacterReference();break}case K.NULL:{this._err(Be.unexpectedNullCharacter),this._emitCodePoint(t);break}case K.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case K.AMPERSAND:{this._startCharacterReference();break}case K.LESS_THAN_SIGN:{this.state=ie.RCDATA_LESS_THAN_SIGN;break}case K.NULL:{this._err(Be.unexpectedNullCharacter),this._emitChars(Ei);break}case K.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case K.LESS_THAN_SIGN:{this.state=ie.RAWTEXT_LESS_THAN_SIGN;break}case K.NULL:{this._err(Be.unexpectedNullCharacter),this._emitChars(Ei);break}case K.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case K.LESS_THAN_SIGN:{this.state=ie.SCRIPT_DATA_LESS_THAN_SIGN;break}case K.NULL:{this._err(Be.unexpectedNullCharacter),this._emitChars(Ei);break}case K.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case K.NULL:{this._err(Be.unexpectedNullCharacter),this._emitChars(Ei);break}case K.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(Mf(t))this._createStartTagToken(),this.state=ie.TAG_NAME,this._stateTagName(t);else switch(t){case K.EXCLAMATION_MARK:{this.state=ie.MARKUP_DECLARATION_OPEN;break}case K.SOLIDUS:{this.state=ie.END_TAG_OPEN;break}case K.QUESTION_MARK:{this._err(Be.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=ie.BOGUS_COMMENT,this._stateBogusComment(t);break}case K.EOF:{this._err(Be.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(Be.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=ie.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(Mf(t))this._createEndTagToken(),this.state=ie.TAG_NAME,this._stateTagName(t);else switch(t){case K.GREATER_THAN_SIGN:{this._err(Be.missingEndTagName),this.state=ie.DATA;break}case K.EOF:{this._err(Be.eofBeforeTagName),this._emitChars("");break}case K.NULL:{this._err(Be.unexpectedNullCharacter),this.state=ie.SCRIPT_DATA_ESCAPED,this._emitChars(Ei);break}case K.EOF:{this._err(Be.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=ie.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===K.SOLIDUS?this.state=ie.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:Mf(t)?(this._emitChars("<"),this.state=ie.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=ie.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){Mf(t)?(this.state=ie.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("");break}case K.NULL:{this._err(Be.unexpectedNullCharacter),this.state=ie.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(Ei);break}case K.EOF:{this._err(Be.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=ie.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===K.SOLIDUS?(this.state=ie.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=ie.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(ro.SCRIPT,!1)&&Bq(this.preprocessor.peek(ro.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])!==et.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(_Ye,et.HTML)}clearBackToTableBodyContext(){this.clearBackTo(TYe,et.HTML)}clearBackToTableRowContext(){this.clearBackTo(kYe,et.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]===A.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]===A.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 et.HTML:{if(i===t)return!0;if(n.has(i))return!1;break}case et.SVG:{if(Uq.has(i))return!1;break}case et.MATHML:{if(Fq.has(i))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,$2)}hasInListItemScope(t){return this.hasInDynamicScope(t,SYe)}hasInButtonScope(t){return this.hasInDynamicScope(t,EYe)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const n=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case et.HTML:{if(EM.has(n))return!0;if($2.has(n))return!1;break}case et.SVG:{if(Uq.has(n))return!1;break}case et.MATHML:{if(Fq.has(n))return!1;break}}}return!0}hasInTableScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===et.HTML)switch(this.tagIDs[n]){case t:return!0;case A.TABLE:case A.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===et.HTML)switch(this.tagIDs[t]){case A.TBODY:case A.THEAD:case A.TFOOT:return!0;case A.TABLE:case A.HTML:return!1}return!0}hasInSelectScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===et.HTML)switch(this.tagIDs[n]){case t:return!0;case A.OPTION:case A.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&sde.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&Qq.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&Qq.has(this.currentTagId);)this.pop()}}const VR=3;var ru;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(ru||(ru={}));const zq={type:ru.Marker};class NYe{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>=VR&&this.entries.splice(l.idx,1))}}insertMarker(){this.entries.unshift(zq)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:ru.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:ru.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(zq);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(r=>r.type===ru.Marker||this.treeAdapter.getTagName(r.element)===t);return n&&n.type===ru.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===ru.Element&&n.element===t)}}const Lf={createDocument(){return{nodeName:"#document",mode:Tl.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};Lf.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(Lf.isTextNode(n)){n.value+=t;return}}Lf.appendChild(e,Lf.createTextNode(t))},insertTextBefore(e,t,n){const r=e.childNodes[e.childNodes.indexOf(n)-1];r&&Lf.isTextNode(r)?r.value+=t:Lf.insertBefore(e,Lf.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(r=>r.name));for(let r=0;re.startsWith(n))}function MYe(e){return e.name===ade&&e.publicId===null&&(e.systemId===null||e.systemId===jYe)}function LYe(e){if(e.name!==ade)return Tl.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===RYe)return Tl.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),DYe.has(n))return Tl.QUIRKS;let r=t===null?IYe:ode;if(Vq(n,r))return Tl.QUIRKS;if(r=t===null?lde:PYe,Vq(n,r))return Tl.LIMITED_QUIRKS}return Tl.NO_QUIRKS}const qq={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},$Ye="definitionurl",BYe="definitionURL",QYe=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])),FYe=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:et.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:et.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:et.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:et.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:et.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:et.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:et.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:et.XML}],["xml:space",{prefix:"xml",name:"space",namespace:et.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:et.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:et.XMLNS}]]),UYe=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])),zYe=new Set([A.B,A.BIG,A.BLOCKQUOTE,A.BODY,A.BR,A.CENTER,A.CODE,A.DD,A.DIV,A.DL,A.DT,A.EM,A.EMBED,A.H1,A.H2,A.H3,A.H4,A.H5,A.H6,A.HEAD,A.HR,A.I,A.IMG,A.LI,A.LISTING,A.MENU,A.META,A.NOBR,A.OL,A.P,A.PRE,A.RUBY,A.S,A.SMALL,A.SPAN,A.STRONG,A.STRIKE,A.SUB,A.SUP,A.TABLE,A.TT,A.U,A.UL,A.VAR]);function VYe(e){const t=e.tagID;return t===A.FONT&&e.attrs.some(({name:r})=>r===pm.COLOR||r===pm.SIZE||r===pm.FACE)||zYe.has(t)}function cde(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)===et.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&t!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,t)}_switchToTextParsing(t,n){this._insertElement(t,et.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=oe.TEXT}switchToPlaintextParsing(){this.insertionMode=oe.TEXT,this.originalInsertionMode=oe.IN_BODY,this.tokenizer.state=as.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)===Te.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==et.HTML))switch(this.fragmentContextID){case A.TITLE:case A.TEXTAREA:{this.tokenizer.state=as.RCDATA;break}case A.STYLE:case A.XMP:case A.IFRAME:case A.NOEMBED:case A.NOFRAMES:case A.NOSCRIPT:{this.tokenizer.state=as.RAWTEXT;break}case A.SCRIPT:{this.tokenizer.state=as.SCRIPT_DATA;break}case A.PLAINTEXT:{this.tokenizer.state=as.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,et.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,n)}_insertTemplate(t){const n=this.treeAdapter.createElement(t.tagName,et.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(Te.HTML,et.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,A.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===Fn.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===A.SVG&&this.treeAdapter.getTagName(n)===Te.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===et.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===A.MGLYPH||t.tagID===A.MALIGNMARK)&&r!==void 0&&!this._isIntegrationPoint(r,n,et.HTML)}_processToken(t){switch(t.type){case Fn.CHARACTER:{this.onCharacter(t);break}case Fn.NULL_CHARACTER:{this.onNullCharacter(t);break}case Fn.COMMENT:{this.onComment(t);break}case Fn.DOCTYPE:{this.onDoctype(t);break}case Fn.START_TAG:{this._processStartTag(t);break}case Fn.END_TAG:{this.onEndTag(t);break}case Fn.EOF:{this.onEof(t);break}case Fn.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,r){const i=this.treeAdapter.getNamespaceURI(n),s=this.treeAdapter.getAttrList(n);return GYe(t,i,s,r)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(i=>i.type===ru.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=oe.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(A.P),this.openElements.popUntilTagNamePopped(A.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case A.TR:{this.insertionMode=oe.IN_ROW;return}case A.TBODY:case A.THEAD:case A.TFOOT:{this.insertionMode=oe.IN_TABLE_BODY;return}case A.CAPTION:{this.insertionMode=oe.IN_CAPTION;return}case A.COLGROUP:{this.insertionMode=oe.IN_COLUMN_GROUP;return}case A.TABLE:{this.insertionMode=oe.IN_TABLE;return}case A.BODY:{this.insertionMode=oe.IN_BODY;return}case A.FRAMESET:{this.insertionMode=oe.IN_FRAMESET;return}case A.SELECT:{this._resetInsertionModeForSelect(t);return}case A.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case A.HTML:{this.insertionMode=this.headElement?oe.AFTER_HEAD:oe.BEFORE_HEAD;return}case A.TD:case A.TH:{if(t>0){this.insertionMode=oe.IN_CELL;return}break}case A.HEAD:{if(t>0){this.insertionMode=oe.IN_HEAD;return}break}}this.insertionMode=oe.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let n=t-1;n>0;n--){const r=this.openElements.tagIDs[n];if(r===A.TEMPLATE)break;if(r===A.TABLE){this.insertionMode=oe.IN_SELECT_IN_TABLE;return}}this.insertionMode=oe.IN_SELECT}_isElementCausesFosterParenting(t){return dde.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 A.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===et.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case A.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 OYe[r].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){AZe(this,t);return}switch(this.insertionMode){case oe.INITIAL:{Ty(this,t);break}case oe.BEFORE_HTML:{z1(this,t);break}case oe.BEFORE_HEAD:{V1(this,t);break}case oe.IN_HEAD:{q1(this,t);break}case oe.IN_HEAD_NO_SCRIPT:{H1(this,t);break}case oe.AFTER_HEAD:{X1(this,t);break}case oe.IN_BODY:case oe.IN_CAPTION:case oe.IN_CELL:case oe.IN_TEMPLATE:{hde(this,t);break}case oe.TEXT:case oe.IN_SELECT:case oe.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case oe.IN_TABLE:case oe.IN_TABLE_BODY:case oe.IN_ROW:{qR(this,t);break}case oe.IN_TABLE_TEXT:{yde(this,t);break}case oe.IN_COLUMN_GROUP:{B2(this,t);break}case oe.AFTER_BODY:{Q2(this,t);break}case oe.AFTER_AFTER_BODY:{Xk(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){_Ze(this,t);return}switch(this.insertionMode){case oe.INITIAL:{Ty(this,t);break}case oe.BEFORE_HTML:{z1(this,t);break}case oe.BEFORE_HEAD:{V1(this,t);break}case oe.IN_HEAD:{q1(this,t);break}case oe.IN_HEAD_NO_SCRIPT:{H1(this,t);break}case oe.AFTER_HEAD:{X1(this,t);break}case oe.TEXT:{this._insertCharacters(t);break}case oe.IN_TABLE:case oe.IN_TABLE_BODY:case oe.IN_ROW:{qR(this,t);break}case oe.IN_COLUMN_GROUP:{B2(this,t);break}case oe.AFTER_BODY:{Q2(this,t);break}case oe.AFTER_AFTER_BODY:{Xk(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){kM(this,t);return}switch(this.insertionMode){case oe.INITIAL:case oe.BEFORE_HTML:case oe.BEFORE_HEAD:case oe.IN_HEAD:case oe.IN_HEAD_NO_SCRIPT:case oe.AFTER_HEAD:case oe.IN_BODY:case oe.IN_TABLE:case oe.IN_CAPTION:case oe.IN_COLUMN_GROUP:case oe.IN_TABLE_BODY:case oe.IN_ROW:case oe.IN_CELL:case oe.IN_SELECT:case oe.IN_SELECT_IN_TABLE:case oe.IN_TEMPLATE:case oe.IN_FRAMESET:case oe.AFTER_FRAMESET:{kM(this,t);break}case oe.IN_TABLE_TEXT:{_y(this,t);break}case oe.AFTER_BODY:{sWe(this,t);break}case oe.AFTER_AFTER_BODY:case oe.AFTER_AFTER_FRAMESET:{aWe(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case oe.INITIAL:{oWe(this,t);break}case oe.BEFORE_HEAD:case oe.IN_HEAD:case oe.IN_HEAD_NO_SCRIPT:case oe.AFTER_HEAD:{this._err(t,Be.misplacedDoctype);break}case oe.IN_TABLE_TEXT:{_y(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,Be.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?CZe(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case oe.INITIAL:{Ty(this,t);break}case oe.BEFORE_HTML:{lWe(this,t);break}case oe.BEFORE_HEAD:{uWe(this,t);break}case oe.IN_HEAD:{Ic(this,t);break}case oe.IN_HEAD_NO_SCRIPT:{hWe(this,t);break}case oe.AFTER_HEAD:{mWe(this,t);break}case oe.IN_BODY:{ja(this,t);break}case oe.IN_TABLE:{Qb(this,t);break}case oe.IN_TABLE_TEXT:{_y(this,t);break}case oe.IN_CAPTION:{dZe(this,t);break}case oe.IN_COLUMN_GROUP:{n8(this,t);break}case oe.IN_TABLE_BODY:{fC(this,t);break}case oe.IN_ROW:{hC(this,t);break}case oe.IN_CELL:{pZe(this,t);break}case oe.IN_SELECT:{wde(this,t);break}case oe.IN_SELECT_IN_TABLE:{gZe(this,t);break}case oe.IN_TEMPLATE:{OZe(this,t);break}case oe.AFTER_BODY:{xZe(this,t);break}case oe.IN_FRAMESET:{vZe(this,t);break}case oe.AFTER_FRAMESET:{SZe(this,t);break}case oe.AFTER_AFTER_BODY:{kZe(this,t);break}case oe.AFTER_AFTER_FRAMESET:{TZe(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?NZe(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case oe.INITIAL:{Ty(this,t);break}case oe.BEFORE_HTML:{cWe(this,t);break}case oe.BEFORE_HEAD:{dWe(this,t);break}case oe.IN_HEAD:{fWe(this,t);break}case oe.IN_HEAD_NO_SCRIPT:{pWe(this,t);break}case oe.AFTER_HEAD:{gWe(this,t);break}case oe.IN_BODY:{dC(this,t);break}case oe.TEXT:{tZe(this,t);break}case oe.IN_TABLE:{tv(this,t);break}case oe.IN_TABLE_TEXT:{_y(this,t);break}case oe.IN_CAPTION:{fZe(this,t);break}case oe.IN_COLUMN_GROUP:{hZe(this,t);break}case oe.IN_TABLE_BODY:{TM(this,t);break}case oe.IN_ROW:{vde(this,t);break}case oe.IN_CELL:{mZe(this,t);break}case oe.IN_SELECT:{Sde(this,t);break}case oe.IN_SELECT_IN_TABLE:{bZe(this,t);break}case oe.IN_TEMPLATE:{yZe(this,t);break}case oe.AFTER_BODY:{kde(this,t);break}case oe.IN_FRAMESET:{wZe(this,t);break}case oe.AFTER_FRAMESET:{EZe(this,t);break}case oe.AFTER_AFTER_BODY:{Xk(this,t);break}}}onEof(t){switch(this.insertionMode){case oe.INITIAL:{Ty(this,t);break}case oe.BEFORE_HTML:{z1(this,t);break}case oe.BEFORE_HEAD:{V1(this,t);break}case oe.IN_HEAD:{q1(this,t);break}case oe.IN_HEAD_NO_SCRIPT:{H1(this,t);break}case oe.AFTER_HEAD:{X1(this,t);break}case oe.IN_BODY:case oe.IN_TABLE:case oe.IN_CAPTION:case oe.IN_COLUMN_GROUP:case oe.IN_TABLE_BODY:case oe.IN_ROW:case oe.IN_CELL:case oe.IN_SELECT:case oe.IN_SELECT_IN_TABLE:{bde(this,t);break}case oe.TEXT:{nZe(this,t);break}case oe.IN_TABLE_TEXT:{_y(this,t);break}case oe.IN_TEMPLATE:{Ede(this,t);break}case oe.AFTER_BODY:case oe.IN_FRAMESET:case oe.AFTER_FRAMESET:case oe.AFTER_AFTER_BODY:case oe.AFTER_AFTER_FRAMESET:{t8(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===K.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 oe.IN_HEAD:case oe.IN_HEAD_NO_SCRIPT:case oe.AFTER_HEAD:case oe.TEXT:case oe.IN_COLUMN_GROUP:case oe.IN_SELECT:case oe.IN_SELECT_IN_TABLE:case oe.IN_FRAMESET:case oe.AFTER_FRAMESET:{this._insertCharacters(t);break}case oe.IN_BODY:case oe.IN_CAPTION:case oe.IN_CELL:case oe.IN_TEMPLATE:case oe.AFTER_BODY:case oe.AFTER_AFTER_BODY:case oe.AFTER_AFTER_FRAMESET:{fde(this,t);break}case oe.IN_TABLE:case oe.IN_TABLE_BODY:case oe.IN_ROW:{qR(this,t);break}case oe.IN_TABLE_TEXT:{Ode(this,t);break}}}};function JYe(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):gde(e,t),n}function eWe(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 tWe(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>=ZYe;!l||c?(c&&e.activeFormattingElements.removeEntry(l),e.openElements.remove(a)):(a=nWe(e,l),r===t&&(e.activeFormattingElements.bookmark=l),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(a,r),r=a)}return r}function nWe(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 rWe(e,t,n){const r=e.treeAdapter.getTagName(t),i=RO(r);if(e._isElementCausesFosterParenting(i))e._fosterParentElement(n);else{const s=e.treeAdapter.getNamespaceURI(t);i===A.TEMPLATE&&s===et.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function iWe(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 e8(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 oWe(e,t){e._setDocumentType(t);const n=t.forceQuirks?Tl.QUIRKS:LYe(t);MYe(t)||e._err(t,Be.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=oe.BEFORE_HTML}function Ty(e,t){e._err(t,Be.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Tl.QUIRKS),e.insertionMode=oe.BEFORE_HTML,e._processToken(t)}function lWe(e,t){t.tagID===A.HTML?(e._insertElement(t,et.HTML),e.insertionMode=oe.BEFORE_HEAD):z1(e,t)}function cWe(e,t){const n=t.tagID;(n===A.HTML||n===A.HEAD||n===A.BODY||n===A.BR)&&z1(e,t)}function z1(e,t){e._insertFakeRootElement(),e.insertionMode=oe.BEFORE_HEAD,e._processToken(t)}function uWe(e,t){switch(t.tagID){case A.HTML:{ja(e,t);break}case A.HEAD:{e._insertElement(t,et.HTML),e.headElement=e.openElements.current,e.insertionMode=oe.IN_HEAD;break}default:V1(e,t)}}function dWe(e,t){const n=t.tagID;n===A.HEAD||n===A.BODY||n===A.HTML||n===A.BR?V1(e,t):e._err(t,Be.endTagWithoutMatchingOpenElement)}function V1(e,t){e._insertFakeElement(Te.HEAD,A.HEAD),e.headElement=e.openElements.current,e.insertionMode=oe.IN_HEAD,e._processToken(t)}function Ic(e,t){switch(t.tagID){case A.HTML:{ja(e,t);break}case A.BASE:case A.BASEFONT:case A.BGSOUND:case A.LINK:case A.META:{e._appendElement(t,et.HTML),t.ackSelfClosing=!0;break}case A.TITLE:{e._switchToTextParsing(t,as.RCDATA);break}case A.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,as.RAWTEXT):(e._insertElement(t,et.HTML),e.insertionMode=oe.IN_HEAD_NO_SCRIPT);break}case A.NOFRAMES:case A.STYLE:{e._switchToTextParsing(t,as.RAWTEXT);break}case A.SCRIPT:{e._switchToTextParsing(t,as.SCRIPT_DATA);break}case A.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=oe.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(oe.IN_TEMPLATE);break}case A.HEAD:{e._err(t,Be.misplacedStartTagForHeadElement);break}default:q1(e,t)}}function fWe(e,t){switch(t.tagID){case A.HEAD:{e.openElements.pop(),e.insertionMode=oe.AFTER_HEAD;break}case A.BODY:case A.BR:case A.HTML:{q1(e,t);break}case A.TEMPLATE:{eg(e,t);break}default:e._err(t,Be.endTagWithoutMatchingOpenElement)}}function eg(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==A.TEMPLATE&&e._err(t,Be.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(A.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,Be.endTagWithoutMatchingOpenElement)}function q1(e,t){e.openElements.pop(),e.insertionMode=oe.AFTER_HEAD,e._processToken(t)}function hWe(e,t){switch(t.tagID){case A.HTML:{ja(e,t);break}case A.BASEFONT:case A.BGSOUND:case A.HEAD:case A.LINK:case A.META:case A.NOFRAMES:case A.STYLE:{Ic(e,t);break}case A.NOSCRIPT:{e._err(t,Be.nestedNoscriptInHead);break}default:H1(e,t)}}function pWe(e,t){switch(t.tagID){case A.NOSCRIPT:{e.openElements.pop(),e.insertionMode=oe.IN_HEAD;break}case A.BR:{H1(e,t);break}default:e._err(t,Be.endTagWithoutMatchingOpenElement)}}function H1(e,t){const n=t.type===Fn.EOF?Be.openElementsLeftAfterEof:Be.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=oe.IN_HEAD,e._processToken(t)}function mWe(e,t){switch(t.tagID){case A.HTML:{ja(e,t);break}case A.BODY:{e._insertElement(t,et.HTML),e.framesetOk=!1,e.insertionMode=oe.IN_BODY;break}case A.FRAMESET:{e._insertElement(t,et.HTML),e.insertionMode=oe.IN_FRAMESET;break}case A.BASE:case A.BASEFONT:case A.BGSOUND:case A.LINK:case A.META:case A.NOFRAMES:case A.SCRIPT:case A.STYLE:case A.TEMPLATE:case A.TITLE:{e._err(t,Be.abandonedHeadElementChild),e.openElements.push(e.headElement,A.HEAD),Ic(e,t),e.openElements.remove(e.headElement);break}case A.HEAD:{e._err(t,Be.misplacedStartTagForHeadElement);break}default:X1(e,t)}}function gWe(e,t){switch(t.tagID){case A.BODY:case A.HTML:case A.BR:{X1(e,t);break}case A.TEMPLATE:{eg(e,t);break}default:e._err(t,Be.endTagWithoutMatchingOpenElement)}}function X1(e,t){e._insertFakeElement(Te.BODY,A.BODY),e.insertionMode=oe.IN_BODY,uC(e,t)}function uC(e,t){switch(t.type){case Fn.CHARACTER:{hde(e,t);break}case Fn.WHITESPACE_CHARACTER:{fde(e,t);break}case Fn.COMMENT:{kM(e,t);break}case Fn.START_TAG:{ja(e,t);break}case Fn.END_TAG:{dC(e,t);break}case Fn.EOF:{bde(e,t);break}}}function fde(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function hde(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function bWe(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function OWe(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function yWe(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,et.HTML),e.insertionMode=oe.IN_FRAMESET)}function xWe(e,t){e.openElements.hasInButtonScope(A.P)&&e._closePElement(),e._insertElement(t,et.HTML)}function vWe(e,t){e.openElements.hasInButtonScope(A.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&EM.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,et.HTML)}function wWe(e,t){e.openElements.hasInButtonScope(A.P)&&e._closePElement(),e._insertElement(t,et.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function SWe(e,t){const n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(A.P)&&e._closePElement(),e._insertElement(t,et.HTML),n||(e.formElement=e.openElements.current))}function EWe(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===A.LI&&i===A.LI||(n===A.DD||n===A.DT)&&(i===A.DD||i===A.DT)){e.openElements.generateImpliedEndTagsWithExclusion(i),e.openElements.popUntilTagNamePopped(i);break}if(i!==A.ADDRESS&&i!==A.DIV&&i!==A.P&&e._isSpecialElement(e.openElements.items[r],i))break}e.openElements.hasInButtonScope(A.P)&&e._closePElement(),e._insertElement(t,et.HTML)}function kWe(e,t){e.openElements.hasInButtonScope(A.P)&&e._closePElement(),e._insertElement(t,et.HTML),e.tokenizer.state=as.PLAINTEXT}function TWe(e,t){e.openElements.hasInScope(A.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(A.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,et.HTML),e.framesetOk=!1}function _We(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(Te.A);n&&(e8(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,et.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function AWe(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,et.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function CWe(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(A.NOBR)&&(e8(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,et.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function NWe(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,et.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function jWe(e,t){e.treeAdapter.getDocumentMode(e.document)!==Tl.QUIRKS&&e.openElements.hasInButtonScope(A.P)&&e._closePElement(),e._insertElement(t,et.HTML),e.framesetOk=!1,e.insertionMode=oe.IN_TABLE}function pde(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,et.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function mde(e){const t=rde(e,pm.TYPE);return t!=null&&t.toLowerCase()===YYe}function RWe(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,et.HTML),mde(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function IWe(e,t){e._appendElement(t,et.HTML),t.ackSelfClosing=!0}function DWe(e,t){e.openElements.hasInButtonScope(A.P)&&e._closePElement(),e._appendElement(t,et.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function PWe(e,t){t.tagName=Te.IMG,t.tagID=A.IMG,pde(e,t)}function MWe(e,t){e._insertElement(t,et.HTML),e.skipNextNewLine=!0,e.tokenizer.state=as.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=oe.TEXT}function LWe(e,t){e.openElements.hasInButtonScope(A.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,as.RAWTEXT)}function $We(e,t){e.framesetOk=!1,e._switchToTextParsing(t,as.RAWTEXT)}function Gq(e,t){e._switchToTextParsing(t,as.RAWTEXT)}function BWe(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,et.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===oe.IN_TABLE||e.insertionMode===oe.IN_CAPTION||e.insertionMode===oe.IN_TABLE_BODY||e.insertionMode===oe.IN_ROW||e.insertionMode===oe.IN_CELL?oe.IN_SELECT_IN_TABLE:oe.IN_SELECT}function QWe(e,t){e.openElements.currentTagId===A.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,et.HTML)}function FWe(e,t){e.openElements.hasInScope(A.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,et.HTML)}function UWe(e,t){e.openElements.hasInScope(A.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(A.RTC),e._insertElement(t,et.HTML)}function zWe(e,t){e._reconstructActiveFormattingElements(),cde(t),J$(t),t.selfClosing?e._appendElement(t,et.MATHML):e._insertElement(t,et.MATHML),t.ackSelfClosing=!0}function VWe(e,t){e._reconstructActiveFormattingElements(),ude(t),J$(t),t.selfClosing?e._appendElement(t,et.SVG):e._insertElement(t,et.SVG),t.ackSelfClosing=!0}function Yq(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,et.HTML)}function ja(e,t){switch(t.tagID){case A.I:case A.S:case A.B:case A.U:case A.EM:case A.TT:case A.BIG:case A.CODE:case A.FONT:case A.SMALL:case A.STRIKE:case A.STRONG:{AWe(e,t);break}case A.A:{_We(e,t);break}case A.H1:case A.H2:case A.H3:case A.H4:case A.H5:case A.H6:{vWe(e,t);break}case A.P:case A.DL:case A.OL:case A.UL:case A.DIV:case A.DIR:case A.NAV:case A.MAIN:case A.MENU:case A.ASIDE:case A.CENTER:case A.FIGURE:case A.FOOTER:case A.HEADER:case A.HGROUP:case A.DIALOG:case A.DETAILS:case A.ADDRESS:case A.ARTICLE:case A.SEARCH:case A.SECTION:case A.SUMMARY:case A.FIELDSET:case A.BLOCKQUOTE:case A.FIGCAPTION:{xWe(e,t);break}case A.LI:case A.DD:case A.DT:{EWe(e,t);break}case A.BR:case A.IMG:case A.WBR:case A.AREA:case A.EMBED:case A.KEYGEN:{pde(e,t);break}case A.HR:{DWe(e,t);break}case A.RB:case A.RTC:{FWe(e,t);break}case A.RT:case A.RP:{UWe(e,t);break}case A.PRE:case A.LISTING:{wWe(e,t);break}case A.XMP:{LWe(e,t);break}case A.SVG:{VWe(e,t);break}case A.HTML:{bWe(e,t);break}case A.BASE:case A.LINK:case A.META:case A.STYLE:case A.TITLE:case A.SCRIPT:case A.BGSOUND:case A.BASEFONT:case A.TEMPLATE:{Ic(e,t);break}case A.BODY:{OWe(e,t);break}case A.FORM:{SWe(e,t);break}case A.NOBR:{CWe(e,t);break}case A.MATH:{zWe(e,t);break}case A.TABLE:{jWe(e,t);break}case A.INPUT:{RWe(e,t);break}case A.PARAM:case A.TRACK:case A.SOURCE:{IWe(e,t);break}case A.IMAGE:{PWe(e,t);break}case A.BUTTON:{TWe(e,t);break}case A.APPLET:case A.OBJECT:case A.MARQUEE:{NWe(e,t);break}case A.IFRAME:{$We(e,t);break}case A.SELECT:{BWe(e,t);break}case A.OPTION:case A.OPTGROUP:{QWe(e,t);break}case A.NOEMBED:case A.NOFRAMES:{Gq(e,t);break}case A.FRAMESET:{yWe(e,t);break}case A.TEXTAREA:{MWe(e,t);break}case A.NOSCRIPT:{e.options.scriptingEnabled?Gq(e,t):Yq(e,t);break}case A.PLAINTEXT:{kWe(e,t);break}case A.COL:case A.TH:case A.TD:case A.TR:case A.HEAD:case A.FRAME:case A.TBODY:case A.TFOOT:case A.THEAD:case A.CAPTION:case A.COLGROUP:break;default:Yq(e,t)}}function qWe(e,t){if(e.openElements.hasInScope(A.BODY)&&(e.insertionMode=oe.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function HWe(e,t){e.openElements.hasInScope(A.BODY)&&(e.insertionMode=oe.AFTER_BODY,kde(e,t))}function XWe(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function GWe(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(A.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(A.FORM):n&&e.openElements.remove(n))}function YWe(e){e.openElements.hasInButtonScope(A.P)||e._insertFakeElement(Te.P,A.P),e._closePElement()}function WWe(e){e.openElements.hasInListItemScope(A.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(A.LI),e.openElements.popUntilTagNamePopped(A.LI))}function ZWe(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function KWe(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function JWe(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function eZe(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(Te.BR,A.BR),e.openElements.pop(),e.framesetOk=!1}function gde(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!==A.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 dC(e,t){switch(t.tagID){case A.A:case A.B:case A.I:case A.S:case A.U:case A.EM:case A.TT:case A.BIG:case A.CODE:case A.FONT:case A.NOBR:case A.SMALL:case A.STRIKE:case A.STRONG:{e8(e,t);break}case A.P:{YWe(e);break}case A.DL:case A.UL:case A.OL:case A.DIR:case A.DIV:case A.NAV:case A.PRE:case A.MAIN:case A.MENU:case A.ASIDE:case A.BUTTON:case A.CENTER:case A.FIGURE:case A.FOOTER:case A.HEADER:case A.HGROUP:case A.DIALOG:case A.ADDRESS:case A.ARTICLE:case A.DETAILS:case A.SEARCH:case A.SECTION:case A.SUMMARY:case A.LISTING:case A.FIELDSET:case A.BLOCKQUOTE:case A.FIGCAPTION:{XWe(e,t);break}case A.LI:{WWe(e);break}case A.DD:case A.DT:{ZWe(e,t);break}case A.H1:case A.H2:case A.H3:case A.H4:case A.H5:case A.H6:{KWe(e);break}case A.BR:{eZe(e);break}case A.BODY:{qWe(e,t);break}case A.HTML:{HWe(e,t);break}case A.FORM:{GWe(e);break}case A.APPLET:case A.OBJECT:case A.MARQUEE:{JWe(e,t);break}case A.TEMPLATE:{eg(e,t);break}default:gde(e,t)}}function bde(e,t){e.tmplInsertionModeStack.length>0?Ede(e,t):t8(e,t)}function tZe(e,t){var n;t.tagID===A.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function nZe(e,t){e._err(t,Be.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function qR(e,t){if(e.openElements.currentTagId!==void 0&&dde.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=oe.IN_TABLE_TEXT,t.type){case Fn.CHARACTER:{yde(e,t);break}case Fn.WHITESPACE_CHARACTER:{Ode(e,t);break}}else xw(e,t)}function rZe(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,et.HTML),e.insertionMode=oe.IN_CAPTION}function iZe(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,et.HTML),e.insertionMode=oe.IN_COLUMN_GROUP}function sZe(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(Te.COLGROUP,A.COLGROUP),e.insertionMode=oe.IN_COLUMN_GROUP,n8(e,t)}function aZe(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,et.HTML),e.insertionMode=oe.IN_TABLE_BODY}function oZe(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(Te.TBODY,A.TBODY),e.insertionMode=oe.IN_TABLE_BODY,fC(e,t)}function lZe(e,t){e.openElements.hasInTableScope(A.TABLE)&&(e.openElements.popUntilTagNamePopped(A.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function cZe(e,t){mde(t)?e._appendElement(t,et.HTML):xw(e,t),t.ackSelfClosing=!0}function uZe(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,et.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function Qb(e,t){switch(t.tagID){case A.TD:case A.TH:case A.TR:{oZe(e,t);break}case A.STYLE:case A.SCRIPT:case A.TEMPLATE:{Ic(e,t);break}case A.COL:{sZe(e,t);break}case A.FORM:{uZe(e,t);break}case A.TABLE:{lZe(e,t);break}case A.TBODY:case A.TFOOT:case A.THEAD:{aZe(e,t);break}case A.INPUT:{cZe(e,t);break}case A.CAPTION:{rZe(e,t);break}case A.COLGROUP:{iZe(e,t);break}default:xw(e,t)}}function tv(e,t){switch(t.tagID){case A.TABLE:{e.openElements.hasInTableScope(A.TABLE)&&(e.openElements.popUntilTagNamePopped(A.TABLE),e._resetInsertionMode());break}case A.TEMPLATE:{eg(e,t);break}case A.BODY:case A.CAPTION:case A.COL:case A.COLGROUP:case A.HTML:case A.TBODY:case A.TD:case A.TFOOT:case A.TH:case A.THEAD:case A.TR:break;default:xw(e,t)}}function xw(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,uC(e,t),e.fosterParentingEnabled=n}function Ode(e,t){e.pendingCharacterTokens.push(t)}function yde(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function _y(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n0&&e.openElements.currentTagId===A.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===A.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===A.OPTGROUP&&e.openElements.pop();break}case A.OPTION:{e.openElements.currentTagId===A.OPTION&&e.openElements.pop();break}case A.SELECT:{e.openElements.hasInSelectScope(A.SELECT)&&(e.openElements.popUntilTagNamePopped(A.SELECT),e._resetInsertionMode());break}case A.TEMPLATE:{eg(e,t);break}}}function gZe(e,t){const n=t.tagID;n===A.CAPTION||n===A.TABLE||n===A.TBODY||n===A.TFOOT||n===A.THEAD||n===A.TR||n===A.TD||n===A.TH?(e.openElements.popUntilTagNamePopped(A.SELECT),e._resetInsertionMode(),e._processStartTag(t)):wde(e,t)}function bZe(e,t){const n=t.tagID;n===A.CAPTION||n===A.TABLE||n===A.TBODY||n===A.TFOOT||n===A.THEAD||n===A.TR||n===A.TD||n===A.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(A.SELECT),e._resetInsertionMode(),e.onEndTag(t)):Sde(e,t)}function OZe(e,t){switch(t.tagID){case A.BASE:case A.BASEFONT:case A.BGSOUND:case A.LINK:case A.META:case A.NOFRAMES:case A.SCRIPT:case A.STYLE:case A.TEMPLATE:case A.TITLE:{Ic(e,t);break}case A.CAPTION:case A.COLGROUP:case A.TBODY:case A.TFOOT:case A.THEAD:{e.tmplInsertionModeStack[0]=oe.IN_TABLE,e.insertionMode=oe.IN_TABLE,Qb(e,t);break}case A.COL:{e.tmplInsertionModeStack[0]=oe.IN_COLUMN_GROUP,e.insertionMode=oe.IN_COLUMN_GROUP,n8(e,t);break}case A.TR:{e.tmplInsertionModeStack[0]=oe.IN_TABLE_BODY,e.insertionMode=oe.IN_TABLE_BODY,fC(e,t);break}case A.TD:case A.TH:{e.tmplInsertionModeStack[0]=oe.IN_ROW,e.insertionMode=oe.IN_ROW,hC(e,t);break}default:e.tmplInsertionModeStack[0]=oe.IN_BODY,e.insertionMode=oe.IN_BODY,ja(e,t)}}function yZe(e,t){t.tagID===A.TEMPLATE&&eg(e,t)}function Ede(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(A.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):t8(e,t)}function xZe(e,t){t.tagID===A.HTML?ja(e,t):Q2(e,t)}function kde(e,t){var n;if(t.tagID===A.HTML){if(e.fragmentContext||(e.insertionMode=oe.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===A.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 Q2(e,t)}function Q2(e,t){e.insertionMode=oe.IN_BODY,uC(e,t)}function vZe(e,t){switch(t.tagID){case A.HTML:{ja(e,t);break}case A.FRAMESET:{e._insertElement(t,et.HTML);break}case A.FRAME:{e._appendElement(t,et.HTML),t.ackSelfClosing=!0;break}case A.NOFRAMES:{Ic(e,t);break}}}function wZe(e,t){t.tagID===A.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==A.FRAMESET&&(e.insertionMode=oe.AFTER_FRAMESET))}function SZe(e,t){switch(t.tagID){case A.HTML:{ja(e,t);break}case A.NOFRAMES:{Ic(e,t);break}}}function EZe(e,t){t.tagID===A.HTML&&(e.insertionMode=oe.AFTER_AFTER_FRAMESET)}function kZe(e,t){t.tagID===A.HTML?ja(e,t):Xk(e,t)}function Xk(e,t){e.insertionMode=oe.IN_BODY,uC(e,t)}function TZe(e,t){switch(t.tagID){case A.HTML:{ja(e,t);break}case A.NOFRAMES:{Ic(e,t);break}}}function _Ze(e,t){t.chars=Ei,e._insertCharacters(t)}function AZe(e,t){e._insertCharacters(t),e.framesetOk=!1}function Tde(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==et.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function CZe(e,t){if(VYe(t))Tde(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===et.MATHML?cde(t):r===et.SVG&&(qYe(t),ude(t)),J$(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function NZe(e,t){if(t.tagID===A.P||t.tagID===A.BR){Tde(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)===et.HTML){e._endTagOutsideForeignContent(t);break}const i=e.treeAdapter.getTagName(r);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}Te.AREA,Te.BASE,Te.BASEFONT,Te.BGSOUND,Te.BR,Te.COL,Te.EMBED,Te.FRAME,Te.HR,Te.IMG,Te.INPUT,Te.KEYGEN,Te.LINK,Te.META,Te.PARAM,Te.SOURCE,Te.TRACK,Te.WBR;const jZe=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,RZe=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),Wq={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function _de(e,t){const n=UZe(e),r=Uce("type",{handlers:{root:IZe,element:DZe,text:PZe,comment:Cde,doctype:MZe,raw:$Ze},unknown:BZe}),i={parser:n?new Xq(Wq):Xq.getFragmentParser(void 0,Wq),handle(l){r(l,i)},stitches:!1,options:t||{}};r(e,i),IO(i,Pu());const s=n?i.parser.document:i.parser.getFragment(),a=zGe(s,{file:i.options.file});return i.stitches&&Ow(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 Ade(e,t){let n=-1;if(e)for(;++n4&&(t.parser.tokenizer.state=0);const n={type:Fn.CHARACTER,chars:e.value,location:vw(e)};IO(t,Pu(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function MZe(e,t){const n={type:Fn.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:vw(e)};IO(t,Pu(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function LZe(e,t){t.stitches=!0;const n=zZe(e);if("children"in e&&"children"in n){const r=_de({type:"root",children:e.children},t.options);n.children=r.children}Cde({type:"comment",value:{stitch:n}},t)}function Cde(e,t){const n=e.value,r={type:Fn.COMMENT,data:n,location:vw(e)};IO(t,Pu(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function $Ze(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,Nde(t,Pu(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(jZe,"<$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 BZe(e,t){const n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))LZe(n,t);else{let r="";throw RZe.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 IO(e,t){Nde(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=as.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 Nde(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 QZe(e,t){const n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===as.PLAINTEXT)return;IO(t,Pu(e));const r=t.parser.openElements.current;let i="namespaceURI"in r?r.namespaceURI:Yp.html;i===Yp.html&&n==="svg"&&(i=Yp.svg);const s=GGe({...e,children:[]},{space:i===Yp.svg?"svg":"html"}),a={type:Fn.START_TAG,tagName:n,tagID:RO(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in s?s.attrs:[],location:vw(e)};t.parser.currentToken=a,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function FZe(e,t){const n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&nYe.includes(n)||t.parser.tokenizer.state===as.PLAINTEXT)return;IO(t,iC(e));const r={type:Fn.END_TAG,tagName:n,tagID:RO(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:vw(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===as.RCDATA||t.parser.tokenizer.state===as.RAWTEXT||t.parser.tokenizer.state===as.SCRIPT_DATA)&&(t.parser.tokenizer.state=as.DATA)}function UZe(e){const t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function vw(e){const t=Pu(e)||{line:void 0,column:void 0,offset:void 0},n=iC(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 zZe(e){return"children"in e?$b({...e,children:[]}):$b(e)}function VZe(e){return function(t,n){return _de(t,{...e,file:n})}}const qZe="modulepreload",HZe=function(e){return"/"+e},Zq={},Pd=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=HZe(c),c in Zq)return;Zq[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":qZe,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((h,p)=>{f.addEventListener("load",h),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function 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 XZe=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,GZe=/[\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]/,YZe=/[\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]/,HR={Space_Separator:XZe,ID_Start:GZe,ID_Continue:YZe},rs={isSpaceSeparator(e){return typeof e=="string"&&HR.Space_Separator.test(e)},isIdStartChar(e){return typeof e=="string"&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="$"||e==="_"||HR.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==="‍"||HR.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 _M,za,yd,F2,Bh,wc,Bs,r8,G1;var WZe=function(t,n){_M=String(t),za="start",yd=[],F2=0,Bh=1,wc=0,Bs=void 0,r8=void 0,G1=void 0;do Bs=ZZe(),eKe[za]();while(Bs.type!=="eof");return typeof n=="function"?AM({"":G1},"",n):G1};function AM(e,t,n){const r=e[t];if(r!=null&&typeof r=="object")if(Array.isArray(r))for(let i=0;i0;){const n=Md();if(!rs.isHexDigit(n))throw mi(Ye());e+=Ye()}return String.fromCodePoint(parseInt(e,16))}const KZe={start(){if($s.type==="eof")throw Op();qR()},beforePropertyName(){switch($s.type){case"identifier":case"string":t8=$s.value,za="afterPropertyName";return;case"punctuator":OE();return;case"eof":throw Op()}},afterPropertyName(){if($s.type==="eof")throw Op();za="beforePropertyValue"},beforePropertyValue(){if($s.type==="eof")throw Op();qR()},beforeArrayValue(){if($s.type==="eof")throw Op();if($s.type==="punctuator"&&$s.value==="]"){OE();return}qR()},afterPropertyValue(){if($s.type==="eof")throw Op();switch($s.value){case",":za="beforePropertyName";return;case"}":OE()}},afterArrayValue(){if($s.type==="eof")throw Op();switch($s.value){case",":za="beforeArrayValue";return;case"]":OE()}},end(){}};function qR(){let e;switch($s.type){case"punctuator":switch($s.value){case"{":e={};break;case"[":e=[];break}break;case"null":case"boolean":case"numeric":case"string":e=$s.value;break}if(X1===void 0)X1=e;else{const t=yd[yd.length-1];Array.isArray(t)?t.push(e):Object.defineProperty(t,t8,{value:e,writable:!0,enumerable:!0,configurable:!0})}if(e!==null&&typeof e=="object")yd.push(e),Array.isArray(e)?za="beforeArrayValue":za="beforePropertyName";else{const t=yd[yd.length-1];t==null?za="end":Array.isArray(t)?za="afterArrayValue":za="afterPropertyValue"}}function OE(){yd.pop();const e=yd[yd.length-1];e==null?za="end":Array.isArray(e)?za="afterArrayValue":za="afterPropertyValue"}function mi(e){return Q2(e===void 0?`JSON5: invalid end of input at ${Bh}:${wc}`:`JSON5: invalid character '${Nde(e)}' at ${Bh}:${wc}`)}function Op(){return Q2(`JSON5: invalid end of input at ${Bh}:${wc}`)}function Wq(){return wc-=5,Q2(`JSON5: invalid identifier character at ${Bh}:${wc}`)}function JZe(e){console.warn(`JSON5: '${Nde(e)}' in strings is not valid ECMAScript; consider escaping`)}function Nde(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 Q2(e){const t=new SyntaxError(e);return t.lineNumber=Bh,t.columnNumber=wc,t}var eKe=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 g of n){let O;typeof g=="string"?O=g:(typeof g=="number"||g instanceof String||g instanceof Number)&&(O=String(g)),O!==void 0&&a.indexOf(O)<0&&a.push(O)}}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(g,O){let y=O[g];switch(y!=null&&(typeof y.toJSON5=="function"?y=y.toJSON5(g):typeof y.toJSON=="function"&&(y=y.toJSON(g))),l&&(y=l.call(O,g,y)),y instanceof Number?y=Number(y):y instanceof String?y=String(y):y instanceof Boolean&&(y=y.valueOf()),y){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof y=="string")return f(y);if(typeof y=="number")return String(y);if(typeof y=="object")return Array.isArray(y)?b(y):h(y)}function f(g){const O={"'":.1,'"':.2},y={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};let v="";for(let w=0;wO[w]=0)throw TypeError("Converting circular structure to JSON5");i.push(g);let O=s;s=s+c;let y=a||Object.keys(g),v=[];for(const w of y){const S=d(w,g);if(S!==void 0){let E=p(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=`, +`&&Ye(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw mi(Ye());case void 0:throw mi(Ye())}return Ye()}function JZe(){let e="",t=Md();if(!rs.isHexDigit(t)||(e+=Ye(),t=Md(),!rs.isHexDigit(t)))throw mi(Ye());return e+=Ye(),String.fromCodePoint(parseInt(e,16))}function CM(){let e="",t=4;for(;t-- >0;){const n=Md();if(!rs.isHexDigit(n))throw mi(Ye());e+=Ye()}return String.fromCodePoint(parseInt(e,16))}const eKe={start(){if(Bs.type==="eof")throw yp();XR()},beforePropertyName(){switch(Bs.type){case"identifier":case"string":r8=Bs.value,za="afterPropertyName";return;case"punctuator":OE();return;case"eof":throw yp()}},afterPropertyName(){if(Bs.type==="eof")throw yp();za="beforePropertyValue"},beforePropertyValue(){if(Bs.type==="eof")throw yp();XR()},beforeArrayValue(){if(Bs.type==="eof")throw yp();if(Bs.type==="punctuator"&&Bs.value==="]"){OE();return}XR()},afterPropertyValue(){if(Bs.type==="eof")throw yp();switch(Bs.value){case",":za="beforePropertyName";return;case"}":OE()}},afterArrayValue(){if(Bs.type==="eof")throw yp();switch(Bs.value){case",":za="beforeArrayValue";return;case"]":OE()}},end(){}};function XR(){let e;switch(Bs.type){case"punctuator":switch(Bs.value){case"{":e={};break;case"[":e=[];break}break;case"null":case"boolean":case"numeric":case"string":e=Bs.value;break}if(G1===void 0)G1=e;else{const t=yd[yd.length-1];Array.isArray(t)?t.push(e):Object.defineProperty(t,r8,{value:e,writable:!0,enumerable:!0,configurable:!0})}if(e!==null&&typeof e=="object")yd.push(e),Array.isArray(e)?za="beforeArrayValue":za="beforePropertyName";else{const t=yd[yd.length-1];t==null?za="end":Array.isArray(t)?za="afterArrayValue":za="afterPropertyValue"}}function OE(){yd.pop();const e=yd[yd.length-1];e==null?za="end":Array.isArray(e)?za="afterArrayValue":za="afterPropertyValue"}function mi(e){return U2(e===void 0?`JSON5: invalid end of input at ${Bh}:${wc}`:`JSON5: invalid character '${Rde(e)}' at ${Bh}:${wc}`)}function yp(){return U2(`JSON5: invalid end of input at ${Bh}:${wc}`)}function Kq(){return wc-=5,U2(`JSON5: invalid identifier character at ${Bh}:${wc}`)}function tKe(e){console.warn(`JSON5: '${Rde(e)}' in strings is not valid ECMAScript; consider escaping`)}function Rde(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 U2(e){const t=new SyntaxError(e);return t.lineNumber=Bh,t.columnNumber=wc,t}var nKe=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 g of n){let O;typeof g=="string"?O=g:(typeof g=="number"||g instanceof String||g instanceof Number)&&(O=String(g)),O!==void 0&&a.indexOf(O)<0&&a.push(O)}}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(g,O){let y=O[g];switch(y!=null&&(typeof y.toJSON5=="function"?y=y.toJSON5(g):typeof y.toJSON=="function"&&(y=y.toJSON(g))),l&&(y=l.call(O,g,y)),y instanceof Number?y=Number(y):y instanceof String?y=String(y):y instanceof Boolean&&(y=y.valueOf()),y){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof y=="string")return f(y);if(typeof y=="number")return String(y);if(typeof y=="object")return Array.isArray(y)?b(y):h(y)}function f(g){const O={"'":.1,'"':.2},y={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};let v="";for(let w=0;wO[w]=0)throw TypeError("Converting circular structure to JSON5");i.push(g);let O=s;s=s+c;let y=a||Object.keys(g),v=[];for(const w of y){const S=d(w,g);if(S!==void 0){let E=p(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+`, `+O+"}"}}return i.pop(),s=O,x}function p(g){if(g.length===0)return f(g);const O=String.fromCodePoint(g.codePointAt(0));if(!rs.isIdStartChar(O))return f(g);for(let y=O.length;y=0)throw TypeError("Converting circular structure to JSON5");i.push(g);let O=s;s=s+c;let y=[];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"&&iKe.test(e.trim()))throw new Error("ECharts option contains an external resource");if(Array.isArray(e)){for(const n of e)F2(n,t+1);return}if(a1(e))for(const[n,r]of Object.entries(e)){if(rKe.has(n))throw new Error("ECharts option contains an unsafe key");F2(r,t+1)}}function sKe(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 aKe(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(oKe),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 cKe(e,t){const n=/^(?:new\s+)?echarts\.graphic\.(LinearGradient|RadialGradient)\s*\(/;let r="",i=!1,s=!1,a=!1;for(let l=t;lnKe)throw new Error("ECharts option is too large");const n=uKe(sKe(e));let r;try{r=jde.parse(n)}catch(a){throw/\bfunction\s*\(|=>/.test(n)?new Error("ECharts function callbacks are not supported"):a}if(!a1(r))throw new Error("ECharts option must be a data object");F2(r);const i={...r};i.aria={...a1(i.aria)?i.aria:{},enabled:!0};const s=i.tooltip;return a1(s)?i.tooltip={...s,renderMode:"richText"}:Array.isArray(s)&&(i.tooltip=s.map(a=>a1(a)?{...a,renderMode:"richText"}:a)),t&&(i.animation=!1),i}let HR;function fKe(){return HR??(HR=Pd(()=>import("../visualizations/echarts/index-CGT341lL.js"),[]).catch(e=>{throw HR=void 0,e})),HR}function hKe({source:e}){const t=m.useRef(null),[n,r]=m.useState(!1),[i,s]=m.useState("");return m.useEffect(()=>{let a=!1,l,c,u;r(!1);try{u=dKe(e,window.matchMedia("(prefers-reduced-motion: reduce)").matches),s("")}catch{s("ECharts 配置不是有效且安全的数据对象,请切换到代码检查内容。");return}return fKe().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(Ln,{duration:2.2,spread:15,children:"正在渲染图表…"})}):null,i?o.jsx("p",{className:"echarts-diagram__error",role:"alert",children:i}):null]})}const pKe=m.memo(hKe);let Zq,Kq=Promise.resolve(),mKe=0;function gKe(){return Zq??(Zq=Pd(async()=>{const{default:e}=await import("../visualizations/mermaid/mermaid.core-Bboy0vem.js").then(t=>t.ay);return{default:e}},[]).then(({default:e})=>(e.initialize({startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,theme:"neutral"}),e))),Zq}function bKe(e){const t=Kq.then(async()=>{const n=await gKe(),r=`mermaid-diagram-${mKe+=1}`;return n.render(r,e)});return Kq=t.then(()=>{},()=>{}),t}function OKe({source:e}){const t=m.useRef(null),[n,r]=m.useState(null),[i,s]=m.useState(!1);return m.useEffect(()=>{let a=!1;return r(null),s(!1),bKe(e).then(l=>{a||r(l)}).catch(()=>{a||s(!0)}),()=>{a=!0}},[e]),m.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(Ln,{duration:2.2,spread:15,children:"正在渲染图表…"})})}const yKe=m.memo(OKe),xKe="_SegmentedControl_1sl7d_1",vKe="_SegmentedControlOption_1sl7d_140",wKe="_SegmentedControlThumb_1sl7d_219",AM={SegmentedControl:xKe,SegmentedControlOption:vKe,SegmentedControlThumb:wKe},jl=({value:e,onChange:t,children:n,block:r,pill:i=!0,size:s="md",gutterSize:a,className:l,onClick:c,...u})=>{const d=m.useRef(null),f=m.useRef(null),h=m.useCallback(b=>{const g=d.current,O=f.current;if(!g||!O)return;const y=g==null?void 0:g.querySelector('[data-state="on"]');if(!y)return;const v=g.clientWidth;let x=Math.floor(y.clientWidth);const w=y.offsetLeft;if(v-(x+w)<2&&(x=x-1),O.style.width=`${Math.floor(x)}px`,O.style.transform=`translateX(${w}px)`,g.scrollWidth>v){const S=v*.15,E=g.scrollLeft,k=y.offsetLeft,T=k+x;(kE+v-S)&&b&&y.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"})}},[]);Dae({ref:d,onResize:()=>{const b=f.current;if(!b)return;const g=b.style.transition;b.style.transition="",h(!1),b.style.transition=g}}),m.useLayoutEffect(()=>{const b=d.current,g=f.current;!b||!g||(h(!!g.style.transition),g.style.transition||S2(()=>{g.style.transition="width 300ms var(--cubic-enter), transform 300ms var(--cubic-enter)"}))},[h,e,s,a,i]);const p=b=>{b&&t&&t(b)};return o.jsxs(y7e,{ref:d,className:zr(AM.SegmentedControl,l),type:"single",value:e,loop:!1,onValueChange:p,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:AM.SegmentedControlThumb,ref:f}),n]})},SKe=({children:e,...t})=>o.jsx(E7e,{className:AM.SegmentedControlOption,...t,onPointerEnter:W6,children:o.jsx("span",{className:"relative",children:e})});jl.Option=SKe;function EKe({children:e,label:t,language:n,source:r,streaming:i=!1}){const[s,a]=m.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(jl,{className:"visualization-card__tabs",value:l,size:"sm",gutterSize:"sm",pill:!1,"aria-label":`${t} 显示方式`,onChange:c=>{i||a(c)},children:[o.jsx(jl.Option,{value:"preview",disabled:i,children:"预览"}),o.jsx(jl.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 kKe=m.memo(EKe);function TKe(e){const t=e==null?void 0:e.trim().toLowerCase();if(t==="mermaid")return"mermaid";if(t==="echart"||t==="echarts")return"echarts"}const Rde=[".mp4",".webm",".mov",".m4v",".ogg",".avi"];function CM(e){return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(CM).join(""):m.isValidElement(e)?CM(e.props.children):""}function _Ke(e){var r;const t=m.Children.toArray(e)[0];if(!m.isValidElement(t))return;const n=(r=t.props.className)==null?void 0:r.split(/\s+/).find(i=>i.startsWith("language-"));return TKe(n==null?void 0:n.slice(9))}function Ide(e){if(!e)return!1;try{const t=e.toLowerCase();return Rde.some(n=>t.includes(n))}catch{return!1}}function AKe(e){var r;const t=(r=e==null?void 0:e.properties)==null?void 0:r.href;if(!t)return!1;if(Ide(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 Rde.some(s=>i.includes(s))}return!1}function CKe({text:e,className:t,allowRawHtml:n=!0,streaming:r=!1}){const[i,s]=m.useState(null),a=(u,d)=>{if(u.src)return u.src;if(d){const f=p=>{var b;if(!p)return null;if(p.type==="source"&&((b=p.properties)!=null&&b.src))return p.properties.src;if(p.children)for(const g of p.children){const O=f(g);if(O)return O}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(Xze,{remarkPlugins:[aHe],rehypePlugins:n?[UZe,jq]:[jq],components:{pre:({node:u,children:d,...f})=>{const h=_Ke(d);if(h==="mermaid"||h==="echarts"){const p=CM(d).replace(/\n$/,"");return o.jsx(kKe,{label:h==="mermaid"?"Mermaid":"ECharts",language:h,source:p,streaming:r,children:h==="mermaid"?o.jsx(yKe,{source:p}):o.jsx(pKe,{source:p})})}return o.jsx("pre",{...f,children:d})},a:({node:u,...d})=>{const f=d.href;if(f&&(Ide(f)||AKe(u))){const h=f,p=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":`点击播放视频: ${p}`,onClick:()=>s({src:h,title:p}),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(Q0,{})})]}),o.jsx("div",{className:"video-caption",children:o.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",className:"video-link-text",children:p})})]})}return o.jsx("a",{...d,target:"_blank",rel:"noopener noreferrer"})},img:({node:u,src:d,alt:f,...h})=>{const p=o.jsx("img",{...h,src:d,alt:f??"",loading:"lazy"});return d?o.jsx(bne,{src:d,children:o.jsxs("button",{type:"button",className:"image-preview-trigger","aria-label":`放大预览:${f||"图片"}`,children:[p,o.jsx("span",{className:"image-preview-hint","aria-hidden":"true",children:o.jsx(Q0,{})})]})}):p},video:({node:u,src:d,children:f,...h})=>{const p=a({src:d},f);return p?o.jsx("div",{className:"video-container",children:o.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":"点击放大视频",onClick:()=>s({src:p}),children:[o.jsx("video",{src:p,...h,playsInline:!0,className:"video-thumbnail",children:f}),o.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:o.jsx(Q0,{})})]})}):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(cA,{})}),o.jsx("button",{type:"button",className:"video-viewer-close","aria-label":"关闭",onClick:()=>s(null),children:o.jsx(Ya,{})})]})]}),o.jsx("div",{className:"video-viewer-body",children:o.jsx("video",{src:i.src,controls:!0,autoPlay:!0,playsInline:!0,className:"video-fullscreen"})})]})})]})}const _u=m.memo(CKe);function NKe(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 jKe(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 RKe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"10.8",cy:"10.8",r:"6.3"}),o.jsx("path",{d:"m15.5 15.5 4 4"})]})}function IKe(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 Jq(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 DKe(e){return o.jsx("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:"m15 18-6-6 6-6"})})}function vw({title:e,children:t,onClose:n,busy:r=!1,className:i=""}){const s=m.useId(),a=m.useRef(null),l=m.useRef(null),c=m.useRef(r),u=m.useRef(n);return m.useEffect(()=>{c.current=r,u.current=n},[r,n]),m.useEffect(()=>{var p;const d=document.activeElement instanceof HTMLElement?document.activeElement:null,f=document.body.style.overflow;document.body.style.overflow="hidden",(p=a.current)==null||p.focus();const h=b=>{if(b.key==="Escape"&&!c.current){u.current();return}if(b.key!=="Tab")return;const g=l.current;if(!g)return;const O=Array.from(g.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(O.length===0){b.preventDefault();return}const y=O[0],v=O[O.length-1];b.shiftKey&&(document.activeElement===y||!g.contains(document.activeElement))?(b.preventDefault(),v.focus()):!b.shiftKey&&(document.activeElement===v||!g.contains(document.activeElement))&&(b.preventDefault(),y.focus())};return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h),document.body.style.overflow=f,d!=null&&d.isConnected&&d.focus()}},[]),ii.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(IKe,{})})]}),t]})}),document.body)}function tv({message:e}){return e?o.jsx("div",{className:"knowledge-form-error",role:"alert",children:e}):null}function NM(e){return e instanceof DOMException&&e.name==="AbortError"}function PKe(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}function MKe(e){const t=e.trim().toLowerCase();return["ready","active","available","success"].includes(t)?"可用":["creating","pending","processing","indexing"].includes(t)?"处理中":["failed","error","unavailable"].includes(t)?"异常":e||"未知"}const Dde=[".jpg",".jpeg",".png"].join(","),LKe=new Set(Dde.split(",")),Pde=[".pdf",".pptx",".docx",".xlsx",".txt"].join(","),$Ke=new Set(Pde.split(",")),BKe=200*1024*1024;function jM(e){const t=e.lastIndexOf(".");return t<0?"":e.slice(t).toLocaleLowerCase()}function QKe(e,t){return e.size>BKe?"单个文件不能超过 200 MB":t==="image"?LKe.has(jM(e.name))?"":"请选择 PNG、JPG 或 JPEG 图片":$Ke.has(jM(e.name))?"":"请选择 PDF、PPTX、DOCX、XLSX 或 TXT 文件"}function n8(e){return e<=0?"-":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Mde(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 FKe({onClose:e,onCreated:t}){const[n,r]=m.useState(""),[i,s]=m.useState(""),[a,l]=m.useState(!1),[c,u]=m.useState(!1),[d,f]=m.useState(""),h=n.trim(),p=!!(h&&!/^[A-Za-z][A-Za-z0-9_]{0,47}$/.test(h)),b=async g=>{if(g.preventDefault(),l(!0),!h||p)return;u(!0),f("");const O={name:h,description:i.trim()||void 0};try{t(await aBe(O))}catch(y){f(Ea(y,"创建知识库失败"))}finally{u(!1)}};return o.jsx(vw,{title:"新建知识库",onClose:e,busy:c,children:o.jsxs("form",{onSubmit:g=>void b(g),children:[o.jsxs("div",{className:"knowledge-dialog__body",children:[o.jsxs("label",{children:[o.jsx("span",{children:"名称"}),o.jsx("input",{autoFocus:!0,value:n,maxLength:48,"aria-invalid":a&&p||void 0,"aria-describedby":"knowledge-name-help",onBlur:()=>l(!0),onChange:g=>r(g.target.value)})]}),o.jsx("p",{id:"knowledge-name-help",className:`knowledge-dialog__note${a&&p?" is-error":""}`,role:a&&p?"alert":void 0,children:a&&p?"名称必须以字母开头,且只能包含字母、数字和下划线。":"以字母开头,仅支持字母、数字和下划线,最多 48 个字符。"}),o.jsxs("label",{children:[o.jsx("span",{children:"描述(可选)"}),o.jsx("textarea",{value:i,maxLength:80,onChange:g=>s(g.target.value)})]}),o.jsx(tv,{message:d})]}),o.jsxs("footer",{className:"knowledge-dialog__actions",children:[o.jsx("button",{type:"button",onClick:e,disabled:c,children:"取消"}),o.jsx("button",{type:"submit",className:"is-primary",disabled:c||!h||p,children:c?"创建中":"创建"})]})]})})}function UKe({item:e,onClose:t,onUpdated:n}){const[r,i]=m.useState(e.description),[s,a]=m.useState(!1),[l,c]=m.useState(""),u=async d=>{d.preventDefault(),a(!0),c("");try{n(await oBe(e.id,e.region,{description:r.trim()}))}catch(f){c(Ea(f,"更新知识库失败"))}finally{a(!1)}};return o.jsx(vw,{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(tv,{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 Lde(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 zKe({base:e,onClose:t,onCreated:n,onAssociationInvalid:r}){const[i,s]=m.useState("document"),[a,l]=m.useState(""),[c,u]=m.useState(""),[d,f]=m.useState(""),[h,p]=m.useState(null),[b,g]=m.useState(!1),[O,y]=m.useState("{}"),[v,x]=m.useState(""),[w,S]=m.useState(""),[E,k]=m.useState(null),T=m.useRef(null),C=m.useRef(null),N=m.useRef(null),_=m.useRef(0),R=!!v;m.useEffect(()=>{var P;E&&!R&&((P=N.current)==null||P.focus())},[R,E]);const $=P=>{R||P===i||(s(P),p(null),f(""),l(""),u(""),S(""),k(null),g(!1),_.current=0,T.current&&(T.current.value=""))},D=P=>{if(!P||i==="web")return;const L=QKe(P,i);if(L){p(null),l(""),u(""),S(L);return}p(P),S(""),l(P.name.replace(/\.[^.]+$/,"")),u(jM(P.name).slice(1))},M=async P=>{if(P.preventDefault(),i==="web"?!d.trim():!h)return;let L;try{L=Lde(O)}catch(U){S(Ea(U,"Metadata 格式错误"));return}x(i==="web"?E?"save":"preview":"upload"),S("");try{if(i==="web")if(E){const U={sourceType:"url",metadata:E.metadata,url:E.preview.url,sourceTitle:E.preview.name,sourceMarkdown:E.preview.sourceMarkdown};await dBe(e.id,e.region,U),n()}else{const U=await fBe(e.id,e.region,{url:d.trim()});if(!U.sourceMarkdown.trim())throw new Error("网页没有可预览的 Markdown 内容");k({preview:U,metadata:L})}else h&&(await hBe(e.id,e.region,{file:h,name:a.trim()||void 0,documentType:c.trim()||void 0,metadata:L}),n())}catch(U){U instanceof JA&&U.errorCode===Gle?r(U):S(Ea(U,i==="web"?E?"添加网页失败":"生成网页预览失败":"上传文件失败"))}finally{x("")}},j=()=>{R||(k(null),S(""),requestAnimationFrame(()=>{var P;return(P=C.current)==null?void 0:P.focus()}))};return o.jsx(vw,{title:E?"预览网页内容":"添加数据",onClose:t,busy:R,className:E?"knowledge-dialog--preview knowledge-dialog--web-confirm":"",children:o.jsx("form",{onSubmit:P=>void M(P),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(_u,{text:E.preview.sourceMarkdown,allowRawHtml:!1,className:"knowledge-preview__markdown"})})}),w?o.jsx("div",{className:"knowledge-web-preview__error",children:o.jsx(tv,{message:w})}):null]}),o.jsxs("footer",{className:"knowledge-dialog__actions",children:[o.jsx("button",{type:"button",className:"is-back",onClick:j,disabled:R,children:"返回修改"}),o.jsx("button",{type:"button",onClick:t,disabled:R,children:"取消"}),o.jsx("button",{ref:N,type:"submit",className:"is-primary",disabled:R,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(([P,L])=>o.jsx("button",{type:"button",role:"tab",id:`knowledge-source-${P}-tab`,"aria-controls":`knowledge-source-${P}-panel`,"aria-selected":i===P,tabIndex:i===P?0:-1,className:i===P?"is-active":"",disabled:R,onClick:()=>$(P),onKeyDown:U=>{const F=["image","document","web"];if(!["ArrowLeft","ArrowRight","Home","End"].includes(U.key))return;U.preventDefault();const q=F.indexOf(P),z=U.key==="Home"?F[0]:U.key==="End"?F[F.length-1]:F[(q+(U.key==="ArrowRight"?1:-1)+F.length)%F.length];$(z),requestAnimationFrame(()=>{var B;return(B=document.getElementById(`knowledge-source-${z}-tab`))==null?void 0:B.focus()})},children:L},P))}),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:R,onChange:P=>{f(P.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(Ln,{children:"正在抓取网页并生成 Markdown 预览"}):null})]}):o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:T,className:"knowledge-upload-input",type:"file","aria-label":"选择知识文件",accept:i==="image"?Dde:Pde,disabled:R,onChange:P=>{var L;D(((L=P.currentTarget.files)==null?void 0:L[0])??null),P.currentTarget.value=""}}),o.jsxs("button",{type:"button",className:`knowledge-upload-dropzone${b?" is-dragging":""}${h?" is-ready":""}`,disabled:R,onClick:()=>{var P;return(P=T.current)==null?void 0:P.click()},onDragEnter:P=>{P.preventDefault(),!R&&(_.current+=1,g(!0))},onDragOver:P=>{P.preventDefault(),R||(P.dataTransfer.dropEffect="copy")},onDragLeave:P=>{P.preventDefault(),_.current=Math.max(0,_.current-1),_.current===0&&g(!1)},onDrop:P=>{var L;P.preventDefault(),_.current=0,g(!1),R||D(((L=P.dataTransfer.files)==null?void 0:L[0])??null)},children:[o.jsx("strong",{children:h?h.name:"选择文件或拖拽到这里"}),o.jsx("span",{children:h?`${n8(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:R?o.jsx(Ln,{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:R,maxLength:256,onChange:P=>l(P.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"类型(可选)"}),o.jsx("input",{value:c,disabled:R,maxLength:64,onChange:P=>u(P.target.value),placeholder:"pdf、docx、png"})]})]}):null,o.jsxs("label",{children:[o.jsx("span",{children:"Metadata(JSON)"}),o.jsx("textarea",{className:"is-code",value:O,disabled:R,onChange:P=>y(P.target.value),spellCheck:!1})]}),o.jsx(tv,{message:w})]}),o.jsxs("footer",{className:"knowledge-dialog__actions",children:[o.jsx("button",{type:"button",onClick:t,disabled:R,children:"取消"}),o.jsx("button",{type:"submit",className:"is-primary",disabled:R||(i==="web"?!d.trim():!h),children:R?i==="web"?"生成中":"上传中":i==="web"?"生成预览":"上传文件"})]})]})})})}function VKe({base:e,item:t,onClose:n,onUpdated:r}){const[i,s]=m.useState(()=>JSON.stringify(t.metadata??{},null,2)),[a,l]=m.useState(!1),[c,u]=m.useState(""),d=async f=>{f.preventDefault();let h;try{h=Lde(i)}catch(p){u(Ea(p,"Metadata 格式错误"));return}l(!0),u("");try{r(await pBe(e.id,t.id,e.region,{metadata:h}))}catch(p){u(Ea(p,"更新知识失败"))}finally{l(!1)}};return o.jsx(vw,{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(tv,{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 $de=new Set(["avif","bmp","gif","jpeg","jpg","png","svg","webp"]),Bde=new Set(["aac","flac","m4a","mp3","ogg","wav","webm"]),Qde=new Set(["m4v","mov","mp4","mpeg","mpg","ogg","webm"]),qKe=new Set(["pdf"]),HKe=new Set(["doc","docx","ppt","pptx","xls","xlsx"]),XKe=new Set(["creating","indexing","pending","processing","queued","submitted"]),GKe=new Set(["error","failed","unavailable"]);function eH(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function yE(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 YKe(e){if(Array.isArray(e)){if(e.length===0)return null;const r=e.map(eH);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=>yE(s[a])))}}return{columns:["值"],rows:e.map(i=>[yE(i)])}}const t=eH(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])=>yE(l[a])))}}return{columns:["字段","值"],rows:n.map(([r,i])=>[r,yE(i)])}}function Fde(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 WKe(e){const t=Fde(e);return t.startsWith("http://")||t.startsWith("https://")?t:""}function ZKe(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 $de.has(r)?"image":Bde.has(r)?"audio":Qde.has(r)?"video":qKe.has(r)?"pdf":t||r?"file":"none"}function KKe(e){const t=e.status.trim().toLocaleLowerCase();if(XKe.has(t))return{title:"数据正在处理中",detail:"知识库完成解析后即可预览,请稍后重新加载。"};if(GKe.has(t))return{title:"数据解析失败",detail:"请检查源文件或网页地址后重新添加,也可以重新加载最新状态。"};const n=Mde(e).toLocaleLowerCase();return n==="pdf"||HKe.has(n)?{title:"暂时没有可预览的解析内容",detail:"此类文件会在知识库完成解析后显示文本、表格或页面图片。"}:$de.has(n)||Bde.has(n)||Qde.has(n)?{title:"暂时没有可预览的媒体内容",detail:"知识库尚未返回可访问的媒体预览,请稍后重新加载。"}:{title:"暂无可预览的数据内容",detail:"知识库尚未返回解析结果,请稍后重新加载。"}}function JKe({chunk:e}){const[t,n]=m.useState(!1),r=Fde(e.attachmentUrl),i=ZKe(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 eJe({base:e,item:t,onClose:n}){const[r,i]=m.useState([]),[s,a]=m.useState(t),[l,c]=m.useState(""),[u,d]=m.useState(!0),[f,h]=m.useState(!1),[p,b]=m.useState(!1),[g,O]=m.useState(""),y=m.useRef(0),v=m.useRef(null),x=m.useCallback(async(k=0)=>{var N;(N=v.current)==null||N.abort();const T=new AbortController;v.current=T;const C=y.current+1;y.current=C,k>0?h(!0):d(!0),O(""),k===0&&(i([]),b(!1));try{const _=await uBe(e.id,t.id,{region:e.region,offset:k,signal:T.signal});if(y.current!==C)return;a(_.document.id?_.document:t),c(_.sourceMarkdown||_.document.sourceMarkdown),i(R=>k>0?[...R,..._.chunks]:_.chunks),b(_.hasMore)}catch(_){!NM(_)&&y.current===C&&O(Ea(_,"加载数据预览失败"))}finally{y.current===C&&(d(!1),h(!1))}},[e.id,e.region,t]);m.useEffect(()=>(x(),()=>{var k;(k=v.current)==null||k.abort(),y.current+=1}),[x]);const w=WKe(s.url||t.url),S=KKe(s),E=s.metadata._veadk_content_format==="markdown";return o.jsx(vw,{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:n8(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(_u,{text:l,allowRawHtml:!1,className:"knowledge-preview__markdown"})}):u?o.jsx("div",{className:"knowledge-preview__state",role:"status",children:o.jsx(Ln,{as:"span",duration:2.4,children:"正在加载数据预览"})}):g&&r.length===0?o.jsxs("div",{className:"knowledge-preview__state is-error",role:"alert",children:[o.jsx("p",{children:g}),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,T)=>{const C=YKe(k.tableFields),N=k.id||`${T}:${k.title}`;return o.jsxs("article",{className:"knowledge-preview__chunk",children:[o.jsx("header",{children:o.jsx("h3",{children:k.title||`片段 ${T+1}`})}),k.content?E?o.jsx(_u,{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((_,R)=>o.jsx("th",{scope:"col",children:_},`${_}:${R}`))})}),o.jsx("tbody",{children:C.rows.map((_,R)=>o.jsx("tr",{children:_.map(($,D)=>o.jsx("td",{children:$},D))},R))})]})}):null,o.jsx(JKe,{chunk:k})]},N)}),g?o.jsx("div",{className:"knowledge-preview__more-error",role:"alert",children:g}):null,p?o.jsx("button",{type:"button",className:"knowledge-preview__load-more",disabled:f,onClick:()=>void x(r.length),children:f?o.jsx(Ln,{as:"span",duration:2.4,children:"正在加载更多"}):"加载更多"}):null]})})]})})}function tJe({cloudProvider:e,active:t=!0,activationRevision:n=0}){const[r,i]=m.useState([]),[s,a]=m.useState({}),[l,c]=m.useState([]),[u,d]=m.useState(""),[f,h]=m.useState(""),[p,b]=m.useState(!0),[g,O]=m.useState(!1),[y,v]=m.useState(""),[x,w]=m.useState([]),[S,E]=m.useState(!1),[k,T]=m.useState(""),[C,N]=m.useState(""),[_,R]=m.useState(""),[$,D]=m.useState(!1),[M,j]=m.useState(!1),[P,L]=m.useState(!1),[U,F]=m.useState(null),[q,z]=m.useState(null),[B,V]=m.useState(null),[ce,we]=m.useState(null),[Oe,de]=m.useState(null),[Z,J]=m.useState(!1),fe=m.useRef(0),be=m.useRef(0),je=m.useRef([]),Qe=m.useRef(!1),Me=m.useRef(!1),le=m.useRef(null),ke=m.useRef(null),ye=m.useRef({}),$e=m.useRef(!1),ze=m.useRef(null),Ae=m.useRef(null),Ve=m.useRef(null),ut=m.useRef(null),Tt=m.useMemo(()=>kb(e).map(ve=>ve.value),[e]),We=m.useCallback(ve=>`${ve.region}\0${ve.id}`,[]),W=r.find(ve=>We(ve)===u)??null,ne=!!(W&&_===We(W)),he=m.useMemo(()=>{const ve=f.trim().toLocaleLowerCase();return ve?r.filter(Ue=>[Ue.name,Ue.description,Ue.ownerLabel,Ue.providerKnowledgeId].some(Y=>Y.toLocaleLowerCase().includes(ve))):r},[r,f]);m.useEffect(()=>{z(null)},[W==null?void 0:W.id,W==null?void 0:W.region]);const xe=m.useCallback(async(ve=!1)=>{var mt;if(ve&&($e.current||Object.keys(ye.current).length===0))return;(mt=le.current)==null||mt.abort();const Ue=new AbortController;le.current=Ue;const Y=fe.current+1;fe.current=Y,$e.current=!0,ve?O(!0):b(!0),v(""),ve||c([]);try{const xt=await sBe({regions:Tt,nextTokens:ve?ye.current:void 0,signal:Ue.signal});if(fe.current!==Y)return;i(Ne=>ve?[...Ne,...xt.items.filter(Ge=>!Ne.some(Pt=>We(Pt)===We(Ge)))]:xt.items),ye.current=xt.nextTokens,a(xt.nextTokens);const Dt=xt.failures.map(({region:Ne,error:Ge})=>`${Ec(Ne,e)}:${Ea(Ge,"加载失败")}`);c(Ne=>ve?[...new Set([...Ne,...Dt])]:Dt),ve||d(Ne=>xt.items.some(Ge=>We(Ge)===Ne)?Ne:"")}catch(xt){if(NM(xt))return;fe.current===Y&&(ve?c(Dt=>[...new Set([...Dt,Ea(xt,"加载更多知识库失败")])]):v(Ea(xt,"加载知识库失败")))}finally{fe.current===Y&&($e.current=!1,b(!1),O(!1))}},[We,e,Tt]),re=m.useCallback(async(ve,Ue=!1)=>{var xt;if(Ue&&Qe.current)return;(xt=ke.current)==null||xt.abort();const Y=new AbortController;ke.current=Y;const mt=be.current+1;be.current=mt,Ue||(je.current=[],Me.current=!1,w([]),D(!1),N("")),Qe.current=!0,E(!0),Ue?N(""):T("");try{const Dt=await cBe(ve.id,{region:ve.region,offset:Ue?je.current.length:0,signal:Y.signal});if(be.current!==mt)return;R(Kt=>Kt===We(ve)?"":Kt);const Ne=je.current,Ge=Ue?[...Ne,...Dt.items.filter(Kt=>!Kt.id||!Ne.some(tt=>tt.id===Kt.id))]:Dt.items,Pt=Dt.hasMore&&(!Ue||Ge.length>Ne.length);je.current=Ge,Me.current=Pt,w(Ge),D(Pt)}catch(Dt){if(NM(Dt))return;be.current===mt&&(Dt instanceof JA&&Dt.errorCode===Gle&&(R(We(ve)),F(Ge=>Ge&&We(Ge)===We(ve)?null:Ge)),Ue?N(Ea(Dt,"加载更多数据失败")):T(Ea(Dt,"加载数据失败")))}finally{be.current===mt&&(Qe.current=!1,E(!1))}},[We]);m.useEffect(()=>{var ve;(ve=le.current)==null||ve.abort(),fe.current+=1,$e.current=!1,ye.current={},i([]),a({}),c([]),d(""),R(""),v(""),b(!0)},[e]),m.useEffect(()=>{if(t)return xe(),()=>{var ve;(ve=le.current)==null||ve.abort(),fe.current+=1,$e.current=!1}},[t,n,xe]),m.useEffect(()=>{var ve,Ue;if(!t){(ve=ke.current)==null||ve.abort(),be.current+=1,Qe.current=!1;return}if(!W){(Ue=ke.current)==null||Ue.abort(),be.current+=1,je.current=[],Qe.current=!1,Me.current=!1,w([]),D(!1),N("");return}return re(W),()=>{var Y;(Y=ke.current)==null||Y.abort(),be.current+=1,Qe.current=!1}},[t,n,W==null?void 0:W.id,W==null?void 0:W.region]);const Re=t&&!W&&!f.trim()&&!p&&!g&&!y&&Object.keys(s).length>0;m.useEffect(()=>{const ve=Ae.current,Ue=ze.current;if(!ve||!Ue||!Re)return;const Y=new IntersectionObserver(([mt])=>{mt.isIntersecting&&xe(!0)},{root:Ue,rootMargin:"240px 0px",threshold:.01});return Y.observe(ve),()=>Y.disconnect()},[Re,xe]);const nt=()=>{const ve=ze.current;!ve||!Re||ve.scrollHeight-ve.scrollTop-ve.clientHeight<=240&&xe(!0)},Ke=!!(W&&x.length>0&&$&&!S&&!C);m.useEffect(()=>{const ve=ut.current,Ue=Ve.current;if(!W||!ve||!Ue||!Ke)return;const Y=new IntersectionObserver(([mt])=>{mt.isIntersecting&&re(W,!0)},{root:Ve.current,rootMargin:"240px 0px",threshold:.01});return Y.observe(ve),()=>Y.disconnect()},[Ke,re,W==null?void 0:W.id,W==null?void 0:W.region]);const tn=()=>{const ve=Ve.current;if(!W||!ve||!Me.current||Qe.current||C)return;const{scrollHeight:Ue,scrollTop:Y,clientHeight:mt}=ve;Ue-Y-mt<=240&&re(W,!0)},Gt=ve=>{i(Ue=>Ue.map(Y=>We(Y)===We(ve)?ve:Y))},At=async()=>{if(ce){J(!0);try{await lBe(ce.id,ce.region),i(ve=>ve.filter(Ue=>We(Ue)!==We(ce))),R(ve=>ve===We(ce)?"":ve),u===We(ce)&&d(""),we(null)}catch(ve){v(Ea(ve,"删除知识库失败")),we(null)}finally{J(!1)}}},St=async()=>{if(!(!W||!Oe)){J(!0);try{await mBe(W.id,Oe.id,W.region);const ve=je.current.filter(Ue=>Ue.id!==Oe.id);je.current=ve,w(ve),de(null)}catch(ve){T(Ea(ve,"删除知识失败")),de(null)}finally{J(!1)}}};return o.jsxs("section",{className:`knowledge-library${W?" is-detail":" my-agents-page"}`,"aria-label":"知识库",children:[W?o.jsxs("div",{className:"knowledge-library__detail",children:[o.jsxs("header",{className:"knowledge-detail-head",children:[o.jsxs("div",{className:"knowledge-detail-head__title",children:[o.jsx("button",{type:"button",className:"knowledge-back-button",onClick:()=>d(""),"aria-label":"返回知识库列表",children:o.jsx(DKe,{})}),o.jsxs("div",{children:[o.jsx("h2",{title:W.name,children:W.name}),o.jsx("p",{children:W.description||"暂无描述"})]})]}),W.canManage&&o.jsxs("div",{className:"knowledge-detail-head__actions",children:[o.jsx("button",{type:"button",onClick:()=>L(!0),children:"编辑"}),o.jsx("button",{type:"button",className:"is-danger",onClick:()=>we(W),children:"删除"})]})]}),o.jsxs("dl",{className:"knowledge-detail-meta",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"Provider"}),o.jsx("dd",{children:W.providerType||"-"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"Knowledge ID"}),o.jsx("dd",{className:"knowledge-keyboard-reveal",tabIndex:0,title:W.providerKnowledgeId,children:W.providerKnowledgeId||"-"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"项目"}),o.jsx("dd",{children:W.projectName||"default"})]}),W.ownerLabel&&o.jsxs("div",{children:[o.jsx("dt",{children:"创建者"}),o.jsx("dd",{children:W.ownerLabel})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"更新时间"}),o.jsx("dd",{children:PKe(W.updatedAt)||"-"})]})]}),o.jsxs("section",{className:"knowledge-documents",children:[o.jsxs("header",{className:"knowledge-documents__head",children:[o.jsx("h3",{children:"数据"}),W.canManage&&o.jsxs("button",{type:"button",className:"knowledge-primary-button",disabled:ne,title:ne?"底层 Provider 知识库已不存在":void 0,onClick:()=>F(W),children:[o.jsx(Jq,{}),o.jsx("span",{children:ne?"关联已失效":"添加数据"})]})]}),o.jsx("div",{className:`knowledge-documents__body${x.length>0?" is-table":""}`,"aria-live":"polite",children:S&&x.length===0?o.jsxs("div",{className:"my-agent-initial-loading",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载数据"})]}):k&&x.length===0?o.jsxs("div",{className:"knowledge-library__state is-error",role:"alert",children:[o.jsx("p",{children:k}),ne&&W.canManage?o.jsx("button",{type:"button",onClick:()=>we(W),children:"删除失效关联"}):o.jsx("button",{type:"button",onClick:()=>void re(W),children:"重试"})]}):x.length===0?o.jsxs("div",{className:"knowledge-library__state",children:[o.jsx(jKe,{}),o.jsx("p",{children:"这个知识库还没有数据"}),W.canManage&&o.jsx("button",{type:"button",onClick:()=>F(W),children:"添加第一项数据"})]}):o.jsxs("div",{ref:Ve,className:"knowledge-document-table-wrap","aria-busy":S||void 0,onScroll:tn,children:[o.jsxs("table",{className:"knowledge-document-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("th",{scope:"col",className:"knowledge-document-table__actions-heading",children:"操作"})]})}),o.jsx("tbody",{children:x.map(ve=>o.jsxs("tr",{children:[o.jsx("td",{className:"knowledge-document-table__name",title:ve.name||ve.id,children:ve.name||ve.id}),o.jsx("td",{children:Mde(ve)}),o.jsx("td",{children:n8(ve.sizeBytes)}),o.jsx("td",{children:o.jsxs("div",{className:"knowledge-document-table__actions",children:[o.jsx(il,{content:"预览",compact:!0,children:o.jsx(vn,{type:"button",className:"knowledge-document-action-button",color:"secondary",variant:"ghost",size:"sm",iconSize:"sm",uniform:!0,"aria-label":`预览 ${ve.name||ve.id}`,onClick:()=>z(ve),children:o.jsx(k2e,{"aria-hidden":"true"})})}),W.canManage?o.jsxs(o.Fragment,{children:[o.jsx(il,{content:"编辑",compact:!0,children:o.jsx(vn,{type:"button",className:"knowledge-document-action-button",color:"secondary",variant:"ghost",size:"sm",iconSize:"sm",uniform:!0,"aria-label":`编辑 ${ve.name||ve.id}`,onClick:()=>V(ve),children:o.jsx(Z4,{"aria-hidden":"true"})})}),o.jsx(il,{content:"删除",compact:!0,children:o.jsx(vn,{type:"button",className:"knowledge-document-action-button",color:"danger",variant:"ghost",size:"sm",iconSize:"sm",uniform:!0,"aria-label":`删除 ${ve.name||ve.id}`,onClick:()=>de(ve),children:o.jsx(xne,{"aria-hidden":"true"})})})]}):null]})})]},ve.id))})]}),S?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:"正在加载更多数据"})]}):C?o.jsxs("div",{className:"knowledge-document-pagination is-error",role:"alert",children:[o.jsx("span",{children:C}),o.jsx("button",{type:"button",onClick:()=>void re(W,!0),children:"重试加载"})]}):$?o.jsx("div",{ref:ut,className:"knowledge-document-pagination",role:"status","aria-live":"polite",children:"继续下滑加载更多"}):null]})})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"knowledge-library__toolbar my-agent-type-bar library-resource-toolbar",children:[o.jsx("div",{className:"knowledge-library__toolbar-actions library-resource-toolbar__controls",children:o.jsxs("button",{type:"button",className:"my-agent-create-primary",onClick:()=>j(!0),children:[o.jsx(Jq,{}),o.jsx("span",{children:"新建知识库"})]})}),o.jsxs("label",{className:"knowledge-library__search my-agent-search",children:[o.jsx(RKe,{}),o.jsx("input",{type:"search",value:f,onChange:ve=>h(ve.target.value),placeholder:"搜索知识库","aria-label":"搜索知识库"})]})]}),o.jsxs("div",{ref:ze,className:"knowledge-library__results my-agent-results","aria-live":"polite",onScroll:nt,children:[l.length>0&&!p&&o.jsxs("div",{className:"knowledge-region-warning",role:"status",children:[o.jsx("span",{children:"部分知识库暂时无法加载,已展示其余可用内容。"}),o.jsx("button",{type:"button",onClick:()=>void xe(),children:"重试"})]}),p&&r.length===0?o.jsxs("div",{className:"my-agent-initial-loading",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载知识库"})]}):y?o.jsxs("div",{className:"knowledge-library__state is-error",role:"alert",children:[o.jsx("p",{children:y}),o.jsx("button",{type:"button",onClick:()=>void xe(),children:"重试"})]}):he.length===0?o.jsxs("div",{className:"knowledge-library__state",children:[o.jsx(NKe,{}),o.jsx("p",{children:f.trim()?"没有匹配的知识库":"您还没有任何知识库"})]}):o.jsx("div",{className:"knowledge-library__grid my-agent-grid",children:he.map(ve=>o.jsx(Zle,{className:"knowledge-card",title:ve.name,status:o.jsx("span",{className:`knowledge-status is-${ve.status.toLowerCase()}`,children:MKe(ve.status)}),description:ve.description||"暂无描述",metadata:[{label:"创建者",value:ve.ownerLabel||"—",title:ve.ownerLabel||"—"},{label:"项目",value:ve.projectName||"default",title:ve.projectName||"default"}],secondaryAction:{label:_===We(ve)?"关联已失效":"添加数据",disabled:!ve.canManage||_===We(ve),title:ve.canManage?_===We(ve)?"底层 Provider 知识库已不存在":void 0:"您没有管理此知识库的权限",onClick:()=>F(ve)},primaryAction:{label:"查看详情",onClick:()=>d(We(ve))},menuLabel:`更多知识库操作:${ve.name}`,menuAriaLabel:`${ve.name}知识库操作`,menuActions:[{label:"编辑知识库",disabled:!ve.canManage,title:ve.canManage?void 0:"您没有管理此知识库的权限",onClick:()=>{d(We(ve)),L(!0)}},{label:"删除知识库",danger:!0,disabled:!ve.canManage||Z,title:ve.canManage?void 0:"您没有管理此知识库的权限",onClick:()=>we(ve)}]},We(ve)))}),Re||g?o.jsx("div",{ref:Ae,className:"my-agent-load-more",role:"status","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:"正在加载更多知识库"})]}):Re?o.jsx("span",{children:"继续下滑加载更多"}):null}):null]})]}),M&&o.jsx(FKe,{onClose:()=>j(!1),onCreated:ve=>{i(Ue=>[ve,...Ue]),d(We(ve)),j(!1)}}),W&&P&&o.jsx(UKe,{item:W,onClose:()=>L(!1),onUpdated:ve=>{Gt(ve),L(!1)}}),W&&q&&o.jsx(eJe,{base:W,item:q,onClose:()=>z(null)}),U&&o.jsx(zKe,{base:U,onClose:()=>F(null),onAssociationInvalid:ve=>{R(We(U)),W&&We(W)===We(U)&&T(Ea(ve,"知识库关联已失效")),F(null)},onCreated:()=>{W&&We(W)===We(U)&&re(W),F(null)}}),W&&B&&o.jsx(VKe,{base:W,item:B,onClose:()=>V(null),onUpdated:ve=>{const Ue=je.current.map(Y=>Y.id===ve.id?ve:Y);je.current=Ue,w(Ue),V(null)}}),ce&&o.jsx(Bl,{title:"删除知识库?",description:`将删除 ${ce.name} 的 AgentKit 关联;如果它由 Studio 创建,也会同时删除 Provider 资源。此操作无法撤销。`,confirmLabel:Z?"删除中":"删除",variant:"danger",busy:Z,onCancel:()=>we(null),onConfirm:()=>void At()}),Oe&&o.jsx(Bl,{title:"删除知识?",description:`将从 Provider 知识库中删除 ${Oe.name||Oe.id},此操作无法撤销。`,confirmLabel:Z?"删除中":"删除",variant:"danger",busy:Z,onCancel:()=>de(null),onConfirm:()=>void St()})]})}const nJe="_EmptyMessage_1r5gu_1",rJe="_IconBadge_1r5gu_16",iJe="_Title_1r5gu_54",sJe="_Description_1r5gu_69",aJe="_ActionRow_1r5gu_77",ww={EmptyMessage:nJe,IconBadge:rJe,Title:iJe,Description:sJe,ActionRow:aJe},ln=({children:e,className:t,fill:n="static"})=>o.jsx("div",{className:zr(ww.EmptyMessage,t),"data-fill":n,children:e}),oJe=({size:e="md",color:t="secondary",children:n,className:r})=>o.jsx("div",{className:zr(ww.IconBadge,r),"data-size":e,"data-color":t,children:n}),lJe=({children:e,className:t,color:n="secondary"})=>o.jsx("div",{className:zr(ww.Title,t),"data-color":n,children:e}),cJe=({children:e,className:t})=>o.jsx("div",{className:zr(ww.Description,t),children:e}),uJe=({children:e,className:t})=>o.jsx("div",{className:zr(ww.ActionRow,t),children:e});ln.Icon=oJe;ln.Title=lJe;ln.Description=cJe;ln.ActionRow=uJe;const dJe="/web/skill-management";class fJe 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 uf(e,t={},n=So){return fetch(bo(`${dJe}${e}`),{...t,headers:Kh(t.headers),signal:Eo(t.signal,n)})}async function Ude(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 fJe(n,e.status,r,e.statusText,i,s)}async function df(e,t){if(!e.ok)throw await Ude(e,t);return e.json()}async function hJe(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),df(await uf(`/spaces?${t}`,{signal:e.signal}),"读取 Skill 空间失败")}async function pJe(e){return df(await uf("/spaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),"创建 Skill 空间失败")}async function mJe(e){return df(await uf(`/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 gJe(e){const t=new URLSearchParams({region:e.region});await df(await uf(`/spaces/${encodeURIComponent(e.spaceId)}?${t}`,{method:"DELETE"}),"删除 Skill 空间失败")}async function bJe(e){const t=new URLSearchParams({region:e.region});return e.project&&t.set("project",e.project),df(await uf(`/spaces/${encodeURIComponent(e.spaceId)}/skills?${t}`,{method:"POST",headers:{"Content-Type":"application/zip"},body:e.file},Ni),"上传 Skill 失败")}async function OJe(e){return df(await uf("/validate",{method:"POST",headers:{"Content-Type":"application/zip"},body:e},Ni),"校验 Skill 失败")}async function yJe(e){const t=new URLSearchParams({region:e.region});await df(await uf(`/spaces/${encodeURIComponent(e.spaceId)}/skills/${encodeURIComponent(e.skillId)}?${t}`,{method:"DELETE"}),"删除 Skill 失败")}async function xJe(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 df(await uf(`/spaces/${encodeURIComponent(e.spaceId)}/skills/${encodeURIComponent(e.skillId)}/files?${t}`),"读取 Skill 文件失败");return Array.isArray(n.files)?n.files:[]}async function vJe(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 uf(`/spaces/${encodeURIComponent(e.spaceId)}/skills/${encodeURIComponent(e.skillId)}/archive?${t}`,{},Ni);n.ok||await df(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 fC(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:Eo(void 0,So)});if(!t.ok)throw await Ude(t,"AgentKit Skills 请求失败");return t.json()}async function zde(){return(await fC("/web/skill-spaces?region=all")).items||[]}async function Vde(e,t){const n=t?`?region=${encodeURIComponent(t)}`:"";return(await fC(`/web/skill-spaces/${encodeURIComponent(e)}/skills${n}`)).items||[]}async function wJe(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),fC(`/web/skill-spaces/${encodeURIComponent(e)}/skills?${n.toString()}`)}async function SJe(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 fC(`/web/skill-spaces/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}${c}`)}function EJe(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 kJe(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 TJe="/web/skill-workbench";class RM 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 Fl(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t}格式错误。`);return e}function tH(e,t){if(e!=null){if(typeof e!="string"||!e.trim()||e.trim().length>256)throw new Error(`${t}格式错误。`);return e.trim()}}function _Je(e){if(e!=null){if(e==="pending"||e==="ready"||e==="failed"||e==="unknown")return e;throw new Error("Skill 恢复点状态格式错误。")}}async function Au(e,t={},n=So){return fetch(bo(`${TJe}${e}`),{...t,headers:Kh(t.headers),signal:Eo(t.signal,n)})}async function r8(e,t){var r;const n=await e.text().catch(()=>"");try{const i=Fl(JSON.parse(n),"错误响应"),s=i.detail&&typeof i.detail=="object"?Fl(i.detail,"错误详情"):i;return new RM(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 RM(`${t}(HTTP ${e.status},Content-Type: ${i})。请检查代理或网关配置。`,e.status,"SKILL_WORKBENCH_ERROR",!1,e.statusText,void 0,n)}}async function Qh(e,t){if(!e.ok)throw await r8(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 AJe(e){return Array.isArray(e)?e.map(t=>{const n=Fl(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 CJe(e){if(e==null)return;const t=Fl(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"||!a6(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 nv(e){const t=Fl(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=Fl(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=tH(t.toolId,"Tool ID"),s=tH(t.sessionId,"Session ID"),a=_Je(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:AJe(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:CJe(t.publication)}:{}}}async function hC(e){const t=Fl(await Qh(await Au("/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 NJe(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 Au(`/tasks/from-upload?${n}`,{method:"POST",body:e.file,headers:{"Content-Type":"application/zip"},signal:e.signal},Ni);return nv(await Qh(r,"开始优化 Skill 失败"))}const t=await Au("/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},Ni);return nv(await Qh(t,"开始 Skill 会话失败"))}async function jJe(e,t){return nv(await Qh(await Au(`/tasks/${encodeURIComponent(e)}`,{signal:t}),"读取 Skill 会话失败"))}async function XR(e,t,n){const r=new URLSearchParams;r.set("expected_revision",String(t));const i=Fl(await Qh(await Au(`/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=Fl(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 GR(e){const t=await Au(`/tasks/${encodeURIComponent(e.jobId)}/refinements`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({intent:e.intent,expectedRevision:e.expectedRevision})},Ni);return nv(await Qh(t,"继续调整 Skill 失败"))}async function RJe(e){const t=await Au(`/tasks/${encodeURIComponent(e.jobId)}/stop`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expectedRevision:e.expectedRevision})});return nv(await Qh(t,"停止当前 Skill 任务失败"))}async function IJe(e){const t=await Au(`/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 r8(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=Fl(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 p=Fl(d.error,"发布错误");throw new RM(typeof p.message=="string"?p.message:"发布 Skill 失败",500,typeof p.code=="string"?p.code:"SKILL_PUBLISH_FAILED",p.retryable===!0,"",p.originalError&&typeof p.originalError=="object"?p.originalError:void 0,JSON.stringify(d.error))}if(d.type!=="complete")throw new Error("未知的发布进度事件。");const f=Fl(d.result,"发布结果");if(typeof f.skillId!="string"||typeof f.version!="string"||!Array.isArray(f.skillSpaceIds)||!f.skillSpaceIds.every(p=>typeof p=="string")||f.disposition!=="create-new"&&f.disposition!=="update-source"||!a6(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 DJe(e){await Qh(await Au(`/tasks/${encodeURIComponent(e)}`,{method:"DELETE"}),"删除 Skill 会话失败")}async function PJe(e,t,n){var c;const r=new URLSearchParams;r.set("expected_revision",String(t)),r.set("expected_sha256",n);const i=await Au(`/tasks/${encodeURIComponent(e)}/download?${r.toString()}`,{},Ni);if(!i.ok)throw await r8(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 MJe={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 LJe(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 $Je(e){return typeof e=="object"&&e!==null&&typeof e.path=="string"}function BJe(e){return typeof e=="object"&&e!==null&&typeof e.call=="string"}function i8(e,t){if($Je(e))return LJe(t,e.path);if(BJe(e)){const n=MJe[e.call],r={};for(const[i,s]of Object.entries(e.args??{}))r[i]=i8(s,t);return n?n(r):`[unknown fn: ${e.call}]`}return e}function QJe(e,t){const n=i8(e,t);return n==null?"":typeof n=="string"?n:String(n)}const qde=new Map;function eg(e,t){qde.set(e,t)}function FJe(e){return qde.get(e)}function UJe(e,t,n){const r=t.replace(/^\//,"").split("/").map(s=>s.replace(/~1/g,"/").replace(/~0/g,"~"));let i=e;for(let s=0;si8(r,e.dataModel),resolveString:r=>QJe(r,e.dataModel),dispatchAction:t,render:r=>{if(!r)return null;const i=e.components[r];if(!i)return null;const s=FJe(i.component)??zJe;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 Xde(e){const t=m.useRef(null),n=m.useRef(!0),r=28,i=m.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 pC({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(Cx,{"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(Ya,{})}):null]},i.name)),e.targetAgent?o.jsxs("span",{className:"invocation-chip invocation-chip--agent",title:e.targetAgent.description,children:[o.jsx(Tne,{"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(Ya,{})}):null]}):null]})}function s8(e=""){return e.startsWith("image/")?"image":e.startsWith("video/")?"video":e==="application/pdf"?"pdf":e==="text/markdown"?"markdown":"text"}function Gde(e){var n,r,i,s;const t=s8(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 Yde(e){return e?e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:""}function Wde(e,t){return e.previewUrl?e.previewUrl:e.data?`data:${e.mimeType??"application/octet-stream"};base64,${e.data}`:e.uri?cre(t,e.uri):""}function qJe({kind:e}){return e==="image"?o.jsx(n6,{}):e==="video"?o.jsx(Nne,{}):e==="pdf"?o.jsx(q2e,{}):o.jsx(e6,{})}function mC({appName:e,items:t,compact:n=!1,onRemove:r}){const[i,s]=m.useState(null);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`media-grid${n?" media-grid--compact":""}`,children:t.map(a=>{const l=s8(a.mimeType),c=Wde(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(n_e,{})})]}):o.jsx("span",{className:"media-card-icon",children:o.jsx(qJe,{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:Gde(a)}),a.status==="uploading"?o.jsxs(o.Fragment,{children:[o.jsx(ir,{className:"media-card-spinner"})," 上传中"]}):a.status==="error"?a.error??"上传失败":Yde(a.sizeBytes)]})]}),!n&&a.status!=="uploading"&&a.status!=="error"?o.jsx(Q0,{className:"media-card-open"}):null]});return o.jsxs(Wi.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(bne,{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(Ya,{})}):null]},a.id)})}),o.jsx(Oh,{children:i?o.jsx(HJe,{appName:e,item:i,onClose:()=>s(null)}):null})]})}function HJe({appName:e,item:t,onClose:n}){const r=m.useMemo(()=>Wde(t,e),[e,t]),i=s8(t.mimeType),[s,a]=m.useState(""),[l,c]=m.useState(i==="text"||i==="markdown"),[u,d]=m.useState("");return m.useEffect(()=>{const f=h=>{h.key==="Escape"&&n()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[n]),m.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(Wi.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(Wi.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:[Gde(t),t.sizeBytes?` · ${Yde(t.sizeBytes)}`:""]})]}),o.jsxs("nav",{children:[o.jsx("a",{href:r,download:t.name,"aria-label":"下载",children:o.jsx(cA,{})}),o.jsx("button",{type:"button",onClick:n,"aria-label":"关闭",children:o.jsx(Ya,{})})]})]}),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(ir,{})," 正在读取文档…"]}):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(_u,{text:s})}):null,!l&&i==="text"?o.jsx("pre",{className:"media-document media-document--plain",children:s}):null]})]})})}function XJe(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 GJe(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 a8(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 YJe(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 WJe(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 ZJe(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 KJe(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 JJe(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 o8(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 eet({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(Ln,{className:"builtin-tool-label",duration:2.4,spread:18,"aria-live":"polite",children:a}),o.jsx(o8,{className:`builtin-tool-chevron${r?" is-open":""}`})]})}const tet={web_search:{name:"web_search",runningLabel:"正在进行网络搜索",doneLabel:"已完成网络搜索",tone:"search",icon:XJe},run_code:{name:"run_code",runningLabel:"正在 AgentKit 沙箱中执行代码",doneLabel:"已在 AgentKit 沙箱中完成代码执行",tone:"sandbox",icon:JJe},image_generate:{name:"image_generate",runningLabel:"正在生成图片",doneLabel:"已完成图片生成",tone:"image",icon:GJe},video_generate:{name:"video_generate",runningLabel:"正在生成视频",doneLabel:"已完成视频生成",tone:"video",icon:a8},ppt_generate:{name:"ppt_generate",runningLabel:"正在生成 PPT",doneLabel:"已完成 PPT 生成",tone:"presentation",icon:YJe},load_memory:{name:"load_memory",runningLabel:"正在检索长期记忆",doneLabel:"已完成记忆检索",tone:"memory",icon:WJe},load_knowledgebase:{name:"load_knowledgebase",runningLabel:"正在检索知识库",doneLabel:"已完成知识库检索",tone:"knowledge",icon:ZJe},load_skill:{name:"load_skill",runningLabel:"正在加载技能",doneLabel:"已加载技能",tone:"skill",icon:KJe}};function net(e){return tet[e]}function Zde(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 ret(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 iet(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"})]})}const set=m.lazy(()=>Pd(()=>Promise.resolve().then(()=>R9),void 0));function aet(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 oet(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 l8({project:e,open:t,onClose:n,onChange:r,readOnly:i=!1}){var g;const[s,a]=m.useState(((g=e.files[0])==null?void 0:g.path)??null),[l,c]=m.useState(new Set),u=m.useRef(null),d=m.useMemo(()=>aet(e.files),[e.files]),f=e.files.find(O=>O.path===s)??null;if(m.useEffect(()=>{var v;if(!t)return;const O=document.body.style.overflow;document.body.style.overflow="hidden",(v=u.current)==null||v.focus();const y=x=>{x.key==="Escape"&&n()};return window.addEventListener("keydown",y),()=>{document.body.style.overflow=O,window.removeEventListener("keydown",y)}},[n,t]),m.useEffect(()=>{f||e.files.length===0||a(e.files[0].path)},[e.files,f]),!t)return null;function h(O){c(y=>{const v=new Set(y);return v.has(O)?v.delete(O):v.add(O),v})}function p(O,y,v){return oet(O,y===0).map(x=>{const w=v?`${v}/${x.name}`:x.name;if(!(x.children.size>0&&x.path===void 0)&&x.path)return o.jsxs("button",{type:"button",className:`code-browser-file${s===x.path?" is-active":""}`,style:{paddingLeft:`${12+y*16}px`},onClick:()=>a(x.path??null),title:x.path,children:[o.jsx(qF,{"aria-hidden":"true"}),o.jsx("span",{children:x.name})]},w);const E=l.has(w);return o.jsxs("div",{children:[o.jsxs("button",{type:"button",className:"code-browser-folder",style:{paddingLeft:`${10+y*16}px`},onClick:()=>h(w),"aria-expanded":!E,children:[o.jsx(dO,{className:E?"":"is-open","aria-hidden":"true"}),o.jsx(jne,{"aria-hidden":"true"}),o.jsx("span",{children:x.name})]}),!E&&p(x,y+1,w)]},w)})}function b(O){f&&r({...e,files:e.files.map(y=>y.path===f.path?{...y,content:O}:y)})}return ii.createPortal(o.jsx("div",{className:"code-browser-backdrop",onMouseDown:O=>{O.target===O.currentTarget&&n()},children:o.jsxs("section",{className:"code-browser-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"code-browser-title",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","aria-hidden":"true",children:o.jsx(Cne,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:"code-browser-title",children:"项目代码"}),o.jsx("p",{children:e.name||"Agent 项目"})]})]}),o.jsx("button",{ref:u,type:"button",className:"code-browser-close",onClick:n,"aria-label":"关闭代码浏览器",children:o.jsx(Ya,{"aria-hidden":"true"})})]}),o.jsxs("div",{className:"code-browser-workspace",children:[o.jsxs("aside",{className:"code-browser-sidebar","aria-label":"项目文件",children:[o.jsxs("div",{className:"code-browser-sidebar-head",children:["文件 ",o.jsx("span",{children:e.files.length})]}),o.jsx("div",{className:"code-browser-tree",children:e.files.length>0?p(d,0,""):o.jsx("div",{className:"code-browser-empty",children:"暂无项目文件"})})]}),o.jsxs("main",{className:"code-browser-main",children:[o.jsxs("div",{className:"code-browser-path",children:[o.jsx(qF,{"aria-hidden":"true"}),o.jsx("span",{children:(f==null?void 0:f.path)??"未选择文件"})]}),o.jsx("div",{className:"code-browser-editor",children:f?o.jsx(m.Suspense,{fallback:o.jsx("div",{className:"code-browser-empty",children:"正在加载编辑器…"}),children:o.jsx(set,{value:f.content,path:f.path,onChange:b,readOnly:i})}):o.jsx("div",{className:"code-browser-empty",children:"从左侧选择文件以查看代码"})})]})]})]})}),document.body)}function cet({project:e,onChange:t,className:n="",label:r="查看源码"}){const[i,s]=m.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(Cne,{"aria-hidden":"true"}),o.jsx("span",{children:r})]}),o.jsx(l8,{project:e,open:i,onClose:()=>s(!1),onChange:t})]})}const Kde="send_a2ui_json_to_client",uet=28,det=3e3;function fet(e,t,n){let r=t;for(let i=0;i65535?2:1}return r}function het(e){return e<=4?1:Math.min(18,Math.max(2,Math.ceil(e/6)))}function Jde(e,t,n,r){const[i,s]=m.useState(()=>t?"":e),a=m.useRef(i),l=m.useRef(e),c=m.useRef(null),u=m.useRef(0),d=m.useRef(n);return l.current=e,d.current=n,m.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 p=b=>{const g=l.current,O=a.current;if(!g.startsWith(O)){a.current=g,s(g),c.current=null;return}if(b-u.current{var f;(f=d.current)==null||f.call(d)},[i]),m.useEffect(()=>{i===e&&(r==null||r())},[i,r,e]),m.useEffect(()=>()=>{c.current!==null&&(window.cancelAnimationFrame(c.current),c.current=null)},[]),i}function pet(){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 met(){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 get(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 efe({text:e,done:t,answerStarted:n=!1,streaming:r=!1,onStreamFrame:i}){const[s,a]=m.useState(!(t||n)),l=m.useRef(!1);m.useEffect(()=>{l.current||a(!(t||n))},[n,t]);const c=()=>{l.current=!0,a(p=>!p)},u=e.replace(/^\s+/,""),d=Jde(u,!t||r,i),{ref:f,onScroll:h}=Xde(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(Zde,{className:`thinking-logo ${t?"":"is-active"}`})}),t?o.jsx("span",{className:"think-label think-label--done",children:"已完成思考"}):o.jsx(Ln,{className:"think-label",duration:2.4,spread:18,children:"思考中"}),o.jsx(dO,{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 bet({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(Zde,{className:"thinking-logo is-active"})}),o.jsx(Ln,{className:"think-label",duration:2.4,spread:18,children:e})]})})}function Oet({value:e,onResolve:t,onDownload:n,onDeploy:r}){const[i,s]=m.useState(e.files?e:null),[a,l]=m.useState(!1),[c,u]=m.useState(null),[d,f]=m.useState(""),[h,p]=m.useState(null),b=new Date(e.validatedAt),g=e.validatedAt?Number.isNaN(b.getTime())?e.validatedAt:b.toLocaleString("zh-CN",{hour12:!1}):"刚刚";m.useEffect(()=>{if(!h)return;const w=window.setTimeout(()=>p(null),det);return()=>window.clearTimeout(w)},[h]);async function O(){if(i)return i;if(!t)throw new Error("暂时无法读取生成的源码,请稍后重试。");const w=await t(e);return s(w),w}async function y(){u("source"),f(""),p(null);try{await O(),l(!0)}catch(w){f(w instanceof Error?w.message:String(w))}finally{u(null)}}async function v(){if(n){u("download"),f(""),p(null);try{await n(e),p({message:"已开始下载"})}catch(w){f(w instanceof Error?w.message:String(w))}finally{u(null)}}}async function x(){u("deploy"),f(""),p(null);try{r==null||r(await O())}catch(w){f(w instanceof Error?w.message:String(w))}finally{u(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(iet,{}):o.jsx(ret,{})}),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:g})]})]}),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 y(),disabled:!t||c!==null,children:[c==="source"?o.jsx(ir,{className:"spin","aria-hidden":"true"}):null,"查看源码"]}),o.jsxs("button",{type:"button",className:"delivery-card-secondary",onClick:()=>void v(),disabled:!n||c!==null,"aria-busy":c==="download",children:[c==="download"?o.jsx(ir,{className:"spin","aria-hidden":"true"}):null,c==="download"?"正在准备…":"下载源码"]}),o.jsxs("button",{type:"button",onClick:()=>void x(),disabled:!e.deployable||!r||!t||c!==null,title:e.deployable?void 0:"源码尚未准备好",children:[c==="deploy"?o.jsx(ir,{className:"spin","aria-hidden":"true"}):null,"手动部署到 Runtime"]})]}),d?o.jsx("p",{className:"delivery-card-error",role:"alert",children:d}):null,h?o.jsx("p",{className:"delivery-card-status",role:"status","aria-live":"polite",children:h.message}):null]}),o.jsx(l8,{project:{name:e.agentName,files:(i==null?void 0:i.files)??[]},open:a,onClose:()=>l(!1),onChange:()=>{},readOnly:!0})]})}function tfe(){return o.jsx(efe,{text:"",done:!1})}const yet=m.memo(function({text:t,streaming:n,onStreamFrame:r,onStreamComplete:i}){const s=Jde(t,n,r,i);return s?o.jsx("div",{className:"bubble",children:o.jsx(_u,{text:s,streaming:n})}):null}),xet={pending:"待处理",in_progress:"进行中",completed:"已完成",failed:"未完成"};function vet({title:e,summary:t,items:n,done:r}){const[i,s]=m.useState(!r),a=m.useRef(!1);m.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(met,{})}),r?o.jsx("span",{className:"plan-title",children:e}):o.jsx(Ln,{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(o8,{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:xet[c.status]})]},`${u}:${c.text}`))}):null})})]})}function wet(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 Eet({name:e,args:t,response:n,done:r,status:i}){const[s,a]=m.useState(!1),l=e===Kde?"渲染 UI":e,c=i??(r?"completed":"running"),u=c==="failed"?void 0:net(e),d=wet(n),f=n==null?null:typeof n=="string"?n:JSON.stringify(n,null,2),h=f&&f.length>2e3?f.slice(0,2e3)+` -…(已截断)`:f;return o.jsxs(Wi.div,{className:`block-tool${u?" block-tool--builtin":""}`,"data-status":c,initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[u?o.jsx(eet,{definition:u,label:get(e,t),done:r,open:s,onToggle:()=>a(p=>!p)}):o.jsxs("button",{className:"tool-head tool-head--generic",onClick:()=>a(p=>!p),type:"button","aria-expanded":s,children:[o.jsx("span",{className:"tool-icon tool-icon--generic","aria-hidden":"true",children:o.jsx(pet,{})}),r?o.jsx("span",{className:"tool-name",children:l}):o.jsx(Ln,{className:"tool-name",duration:2.2,spread:15,children:l}),o.jsx(o8,{className:`tool-chevron${s?" is-open":""}`})]}),o.jsx("div",{className:`think-collapse ${s?"open":""}`,children:o.jsx("div",{className:"think-collapse-inner",children: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)})]}),h!=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:h})]}),d.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:d.map(p=>o.jsxs("a",{href:p.contentUrl,download:p.name,children:["下载 ",p.name]},`${p.contentUrl}:${p.name}`))})]})]})})})]})}function ket({block:e,onDownload:t,onPreview:n}){const[r,i]=m.useState(""),[s,a]=m.useState(""),[l,c]=m.useState(null);m.useEffect(()=>()=>{l&&URL.revokeObjectURL(l.url)},[l]);const u=()=>c(null),d=async(p,b)=>{if(t){i(`download:${p}`),a("");try{await t(p,b)}catch(g){a(g instanceof Error?g.message:String(g))}finally{i("")}}},f=async(p,b,g)=>{if(n){i(`preview:${g}`),a("");try{const O=await n(p,b);c({name:g,url:O})}catch(O){a(O instanceof Error?O.message:String(O))}finally{i("")}}},h=e.files.filter(p=>!p.filename.endsWith(".preview.webp"));return o.jsxs("div",{className:"artifact-list",children:[h.map(p=>{const b=`${p.filename.replace(/\.pptx$/i,"")}.preview.webp`,g=e.files.find(O=>O.filename===b);return o.jsxs("div",{className:"artifact-card",children:[o.jsx("span",{className:"artifact-card__icon","aria-hidden":"true",children:o.jsx(e6,{})}),o.jsxs("span",{className:"artifact-card__copy",children:[o.jsx("span",{className:"artifact-card__name",children:p.filename}),o.jsx("span",{className:"artifact-card__hint",children:"PowerPoint 演示文稿"})]}),o.jsxs("span",{className:"artifact-card__actions",children:[g&&o.jsxs("button",{className:"artifact-card__action",type:"button",disabled:!n||r!=="",onClick:()=>void f(g.filename,g.version,p.filename),children:[r===`preview:${p.filename}`?o.jsx(ir,{className:"spin"}):o.jsx(U2e,{}),"预览"]}),o.jsxs("button",{className:"artifact-card__action artifact-card__action--primary",type:"button",disabled:!t||r!=="",onClick:()=>void d(p.filename,p.version),children:[r===`download:${p.filename}`?o.jsx(ir,{className:"spin"}):o.jsx(cA,{}),"下载"]})]})]},`${p.filename}:${p.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(Ya,{})})]}),o.jsx("div",{className:"artifact-preview__canvas",children:o.jsx("img",{src:l.url,alt:`${l.name} 幻灯片预览`})})]})]})]})}function Tet({block:e,onAuth:t}){const[n,r]=m.useState(e.done?"done":"idle"),[i,s]=m.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(Wi.div,{className:"auth-card-collapsed",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},children:[o.jsx(HF,{className:"auth-card-icon auth-card-icon--done"}),o.jsxs("span",{children:["已授权 · ",a]})]}):o.jsxs(Wi.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(HF,{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(ir,{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 gC({blocks:e,appName:t="",streaming:n=!1,onStreamFrame:r,onStreamComplete:i,onAction:s,onAuth:a,onArtifactDownload:l,onArtifactPreview:c,onResolveDelivery:u,onDownloadDelivery:d,onDeployDelivery:f}){const h=e.reduce((p,b,g)=>b.kind==="text"?g:p,-1);return o.jsx(o.Fragment,{children:e.map((p,b)=>{switch(p.kind){case"progress":return o.jsx(bet,{text:p.text},"build-progress");case"thinking":{const g=e.slice(b+1).some(O=>O.kind==="text"&&!!O.text.trim());return o.jsx(efe,{text:p.text,done:p.done,answerStarted:g,streaming:n,onStreamFrame:r},b)}case"text":{const g=p.text.replace(/^\s+/,"");return g?o.jsx(yet,{text:g,streaming:n,onStreamFrame:r,onStreamComplete:b===h?i:void 0},b):null}case"plan":return o.jsx(vet,{title:p.title,summary:p.summary,items:p.items,done:p.done},b);case"attachment":return o.jsx(mC,{appName:t,items:p.files},b);case"artifact":return o.jsx(ket,{block:p,onDownload:l,onPreview:c},b);case"delivery":return o.jsx(Oet,{value:p.value,onResolve:u,onDownload:d,onDeploy:f},b);case"invocation":return o.jsx(pC,{value:p.value},b);case"tool":return p.name===Kde&&p.done?null:o.jsx(Eet,{name:p.name,args:p.args,response:p.response,done:p.done,status:p.status},b);case"agent-transfer":return null;case"auth":return o.jsx(Tet,{block:p,onAuth:a},b);case"a2ui":return Hde(p.messages).filter(g=>g.components[g.rootId]).map(g=>o.jsx(Wi.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(VJe,{surface:g,onAction:s})},`${b}-${g.surfaceId}`));default:return null}})})}const _et=()=>{};function Aet(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 Cet({activities:e}){const t=m.useMemo(()=>e.filter(n=>n.kind!=="status").map(Aet),[e]);return t.length===0?null:o.jsx("div",{className:"skill-conversation","aria-label":"Skill 生成对话","aria-live":"polite",children:o.jsx(gC,{blocks:t,onAction:_et})})}function nH(){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 Hk({label:e,value:t,options:n,onChange:r,disabled:i=!1,allowCustom:s=!1,required:a=!1,placeholder:l="请选择",error:c}){const u=m.useId(),d=m.useId(),f=m.useId(),h=m.useRef(null),p=m.useRef(null),b=m.useRef(null),g=m.useRef(null),O=m.useRef([]),y=n.findIndex($=>$.value===t),v=t.trim().toLocaleLowerCase(),x=s&&v?n.filter($=>$.value.toLocaleLowerCase().includes(v)||$.label.toLocaleLowerCase().includes(v)):n,[w,S]=m.useState(!1),[E,k]=m.useState(Math.max(0,y)),T=y>=0?n[y]:void 0,C=i||!s&&n.length===0,N=($=!1)=>{S(!1),$&&window.requestAnimationFrame(()=>{var D,M;return s?(D=b.current)==null?void 0:D.focus():(M=p.current)==null?void 0:M.focus()})},_=$=>{C||x.length!==0&&(k(Math.min(Math.max($,0),x.length-1)),S(!0))};m.useEffect(()=>{if(!w)return;const $=g.current,D=s?void 0:window.requestAnimationFrame(()=>{var L;(L=O.current[E])==null||L.focus()}),M=L=>{if(!$)return;const U=$.scrollTop<=0,F=$.scrollTop+$.clientHeight>=$.scrollHeight-1;($.scrollHeight<=$.clientHeight||L.deltaY<0&&U||L.deltaY>0&&F)&&L.preventDefault(),L.stopPropagation()},j=L=>{var U;L.target instanceof Node&&!((U=h.current)!=null&&U.contains(L.target))&&N()},P=L=>{L.key==="Escape"&&N(!0)};return $==null||$.addEventListener("wheel",M,{passive:!1}),window.addEventListener("pointerdown",j),window.addEventListener("keydown",P),()=>{D!==void 0&&window.cancelAnimationFrame(D),$==null||$.removeEventListener("wheel",M),window.removeEventListener("pointerdown",j),window.removeEventListener("keydown",P)}},[E,s,w]);const R=$=>{var M;if(x.length===0)return;const D=($+x.length)%x.length;k(D),(M=O.current[D])==null||M.focus()};return o.jsxs("div",{ref:h,className:`skill-config-select${w?" is-open":""}`,onBlur:$=>{var D;(!$.relatedTarget||!((D=h.current)!=null&&D.contains($.relatedTarget)))&&N()},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:b,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:$=>{r($.target.value),k(0),n.length>0&&S(!0)},onClick:()=>{!w&&x.length>0&&_(0)},onKeyDown:$=>{var D,M;if(!($.nativeEvent.isComposing||$.keyCode===229))if($.key==="ArrowDown")$.preventDefault(),w?(D=O.current[E])==null||D.focus():_(0);else if($.key==="ArrowUp")$.preventDefault(),w?(M=O.current[x.length-1])==null||M.focus():_(x.length-1);else if($.key==="Enter"&&w){$.preventDefault();const j=x[E];j&&r(j.value),N()}else $.key==="Escape"&&($.preventDefault(),N())}}),o.jsx("button",{type:"button",className:"skill-config-select__toggle",disabled:i||n.length===0,"aria-label":w?"收起模型选项":"展开模型选项",onClick:()=>{w?N():_(0)},children:o.jsx(nH,{})})]}):o.jsxs("button",{ref:p,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?N():_(y>=0?y:0)},onKeyDown:$=>{$.key==="ArrowDown"?($.preventDefault(),_(y>=0?y:0)):$.key==="ArrowUp"&&($.preventDefault(),_(y>=0?y:n.length-1))},children:[o.jsx("span",{className:T?void 0:"is-placeholder",title:T==null?void 0:T.label,children:(T==null?void 0:T.label)||(n.length===0?"暂无可用选项":l)}),o.jsx(nH,{})]}),w?o.jsxs("div",{ref:g,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(($,D)=>{const M=$.value===t;return o.jsx("button",{ref:j=>{O.current[D]=j},type:"button",role:"option","aria-selected":M,tabIndex:D===E?0:-1,className:`skill-config-select__option${M?" is-selected":""}`,title:$.label,onFocus:()=>k(D),onClick:()=>{r($.value),N(!0)},onKeyDown:j=>{j.key==="Enter"||j.key===" "?(j.preventDefault(),r($.value),N(!0)):j.key==="ArrowDown"?(j.preventDefault(),R(D+1)):j.key==="ArrowUp"?(j.preventDefault(),R(D-1)):j.key==="Home"?(j.preventDefault(),R(0)):j.key==="End"&&(j.preventDefault(),R(n.length-1))},children:$.label},$.value)})]}):null,c?o.jsx("span",{id:f,className:"skill-config-select__error",role:"alert",children:c}):null]})}function Fs(e,t){return e instanceof Error?e:typeof e=="string"&&e.trim()?new Error(e.trim()):new Error(t)}function Go({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()?`服务端原始响应: +`+O+"]"}return i.pop(),s=O,v}};const rKe={parse:WZe,stringify:nKe};var Ide=rKe;const iKe=2e5,sKe=new Set(["__proto__","constructor","prototype"]),aKe=/^(?:https?:|data:|blob:|file:|javascript:|image:\/\/)/i;function o1(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function z2(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"&&aKe.test(e.trim()))throw new Error("ECharts option contains an external resource");if(Array.isArray(e)){for(const n of e)z2(n,t+1);return}if(o1(e))for(const[n,r]of Object.entries(e)){if(sKe.has(n))throw new Error("ECharts option contains an unsafe key");z2(r,t+1)}}function oKe(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 lKe(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(cKe),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 dKe(e,t){const n=/^(?:new\s+)?echarts\.graphic\.(LinearGradient|RadialGradient)\s*\(/;let r="",i=!1,s=!1,a=!1;for(let l=t;liKe)throw new Error("ECharts option is too large");const n=fKe(oKe(e));let r;try{r=Ide.parse(n)}catch(a){throw/\bfunction\s*\(|=>/.test(n)?new Error("ECharts function callbacks are not supported"):a}if(!o1(r))throw new Error("ECharts option must be a data object");z2(r);const i={...r};i.aria={...o1(i.aria)?i.aria:{},enabled:!0};const s=i.tooltip;return o1(s)?i.tooltip={...s,renderMode:"richText"}:Array.isArray(s)&&(i.tooltip=s.map(a=>o1(a)?{...a,renderMode:"richText"}:a)),t&&(i.animation=!1),i}let GR;function pKe(){return GR??(GR=Pd(()=>import("../visualizations/echarts/index-CGT341lL.js"),[]).catch(e=>{throw GR=void 0,e})),GR}function mKe({source:e}){const t=m.useRef(null),[n,r]=m.useState(!1),[i,s]=m.useState("");return m.useEffect(()=>{let a=!1,l,c,u;r(!1);try{u=hKe(e,window.matchMedia("(prefers-reduced-motion: reduce)").matches),s("")}catch{s("ECharts 配置不是有效且安全的数据对象,请切换到代码检查内容。");return}return pKe().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(Ln,{duration:2.2,spread:15,children:"正在渲染图表…"})}):null,i?o.jsx("p",{className:"echarts-diagram__error",role:"alert",children:i}):null]})}const gKe=m.memo(mKe);let Jq,eH=Promise.resolve(),bKe=0;function OKe(){return Jq??(Jq=Pd(async()=>{const{default:e}=await import("../visualizations/mermaid/mermaid.core-BwbpQM0L.js").then(t=>t.ay);return{default:e}},[]).then(({default:e})=>(e.initialize({startOnLoad:!1,securityLevel:"strict",suppressErrorRendering:!0,theme:"neutral"}),e))),Jq}function yKe(e){const t=eH.then(async()=>{const n=await OKe(),r=`mermaid-diagram-${bKe+=1}`;return n.render(r,e)});return eH=t.then(()=>{},()=>{}),t}function xKe({source:e}){const t=m.useRef(null),[n,r]=m.useState(null),[i,s]=m.useState(!1);return m.useEffect(()=>{let a=!1;return r(null),s(!1),yKe(e).then(l=>{a||r(l)}).catch(()=>{a||s(!0)}),()=>{a=!0}},[e]),m.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(Ln,{duration:2.2,spread:15,children:"正在渲染图表…"})})}const vKe=m.memo(xKe),wKe="_SegmentedControl_1sl7d_1",SKe="_SegmentedControlOption_1sl7d_140",EKe="_SegmentedControlThumb_1sl7d_219",NM={SegmentedControl:wKe,SegmentedControlOption:SKe,SegmentedControlThumb:EKe},jl=({value:e,onChange:t,children:n,block:r,pill:i=!0,size:s="md",gutterSize:a,className:l,onClick:c,...u})=>{const d=m.useRef(null),f=m.useRef(null),h=m.useCallback(b=>{const g=d.current,O=f.current;if(!g||!O)return;const y=g==null?void 0:g.querySelector('[data-state="on"]');if(!y)return;const v=g.clientWidth;let x=Math.floor(y.clientWidth);const w=y.offsetLeft;if(v-(x+w)<2&&(x=x-1),O.style.width=`${Math.floor(x)}px`,O.style.transform=`translateX(${w}px)`,g.scrollWidth>v){const S=v*.15,E=g.scrollLeft,k=y.offsetLeft,T=k+x;(kE+v-S)&&b&&y.scrollIntoView({block:"nearest",inline:"center",behavior:"smooth"})}},[]);Mae({ref:d,onResize:()=>{const b=f.current;if(!b)return;const g=b.style.transition;b.style.transition="",h(!1),b.style.transition=g}}),m.useLayoutEffect(()=>{const b=d.current,g=f.current;!b||!g||(h(!!g.style.transition),g.style.transition||k2(()=>{g.style.transition="width 300ms var(--cubic-enter), transform 300ms var(--cubic-enter)"}))},[h,e,s,a,i]);const p=b=>{b&&t&&t(b)};return o.jsxs(v7e,{ref:d,className:zr(NM.SegmentedControl,l),type:"single",value:e,loop:!1,onValueChange:p,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:NM.SegmentedControlThumb,ref:f}),n]})},kKe=({children:e,...t})=>o.jsx(T7e,{className:NM.SegmentedControlOption,...t,onPointerEnter:K6,children:o.jsx("span",{className:"relative",children:e})});jl.Option=kKe;function TKe({children:e,label:t,language:n,source:r,streaming:i=!1}){const[s,a]=m.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(jl,{className:"visualization-card__tabs",value:l,size:"sm",gutterSize:"sm",pill:!1,"aria-label":`${t} 显示方式`,onChange:c=>{i||a(c)},children:[o.jsx(jl.Option,{value:"preview",disabled:i,children:"预览"}),o.jsx(jl.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 _Ke=m.memo(TKe);function AKe(e){const t=e==null?void 0:e.trim().toLowerCase();if(t==="mermaid")return"mermaid";if(t==="echart"||t==="echarts")return"echarts"}const Dde=[".mp4",".webm",".mov",".m4v",".ogg",".avi"];function jM(e){return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(jM).join(""):m.isValidElement(e)?jM(e.props.children):""}function CKe(e){var r;const t=m.Children.toArray(e)[0];if(!m.isValidElement(t))return;const n=(r=t.props.className)==null?void 0:r.split(/\s+/).find(i=>i.startsWith("language-"));return AKe(n==null?void 0:n.slice(9))}function Pde(e){if(!e)return!1;try{const t=e.toLowerCase();return Dde.some(n=>t.includes(n))}catch{return!1}}function NKe(e){var r;const t=(r=e==null?void 0:e.properties)==null?void 0:r.href;if(!t)return!1;if(Pde(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 Dde.some(s=>i.includes(s))}return!1}function jKe({text:e,className:t,allowRawHtml:n=!0,streaming:r=!1}){const[i,s]=m.useState(null),a=(u,d)=>{if(u.src)return u.src;if(d){const f=p=>{var b;if(!p)return null;if(p.type==="source"&&((b=p.properties)!=null&&b.src))return p.properties.src;if(p.children)for(const g of p.children){const O=f(g);if(O)return O}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(Yze,{remarkPlugins:[lHe],rehypePlugins:n?[VZe,Iq]:[Iq],components:{pre:({node:u,children:d,...f})=>{const h=CKe(d);if(h==="mermaid"||h==="echarts"){const p=jM(d).replace(/\n$/,"");return o.jsx(_Ke,{label:h==="mermaid"?"Mermaid":"ECharts",language:h,source:p,streaming:r,children:h==="mermaid"?o.jsx(vKe,{source:p}):o.jsx(gKe,{source:p})})}return o.jsx("pre",{...f,children:d})},a:({node:u,...d})=>{const f=d.href;if(f&&(Pde(f)||NKe(u))){const h=f,p=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":`点击播放视频: ${p}`,onClick:()=>s({src:h,title:p}),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(F0,{})})]}),o.jsx("div",{className:"video-caption",children:o.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",className:"video-link-text",children:p})})]})}return o.jsx("a",{...d,target:"_blank",rel:"noopener noreferrer"})},img:({node:u,src:d,alt:f,...h})=>{const p=o.jsx("img",{...h,src:d,alt:f??"",loading:"lazy"});return d?o.jsx(yne,{src:d,children:o.jsxs("button",{type:"button",className:"image-preview-trigger","aria-label":`放大预览:${f||"图片"}`,children:[p,o.jsx("span",{className:"image-preview-hint","aria-hidden":"true",children:o.jsx(F0,{})})]})}):p},video:({node:u,src:d,children:f,...h})=>{const p=a({src:d},f);return p?o.jsx("div",{className:"video-container",children:o.jsxs("button",{type:"button",className:"video-preview-trigger","aria-label":"点击放大视频",onClick:()=>s({src:p}),children:[o.jsx("video",{src:p,...h,playsInline:!0,className:"video-thumbnail",children:f}),o.jsx("span",{className:"video-preview-hint","aria-hidden":"true",children:o.jsx(F0,{})})]})}):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(dA,{})}),o.jsx("button",{type:"button",className:"video-viewer-close","aria-label":"关闭",onClick:()=>s(null),children:o.jsx(Ya,{})})]})]}),o.jsx("div",{className:"video-viewer-body",children:o.jsx("video",{src:i.src,controls:!0,autoPlay:!0,playsInline:!0,className:"video-fullscreen"})})]})})]})}const _u=m.memo(jKe);function RKe(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 IKe(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 DKe(e){return o.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round","aria-hidden":"true",...e,children:[o.jsx("circle",{cx:"10.8",cy:"10.8",r:"6.3"}),o.jsx("path",{d:"m15.5 15.5 4 4"})]})}function PKe(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 tH(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 MKe(e){return o.jsx("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:"m15 18-6-6 6-6"})})}function ww({title:e,children:t,onClose:n,busy:r=!1,className:i=""}){const s=m.useId(),a=m.useRef(null),l=m.useRef(null),c=m.useRef(r),u=m.useRef(n);return m.useEffect(()=>{c.current=r,u.current=n},[r,n]),m.useEffect(()=>{var p;const d=document.activeElement instanceof HTMLElement?document.activeElement:null,f=document.body.style.overflow;document.body.style.overflow="hidden",(p=a.current)==null||p.focus();const h=b=>{if(b.key==="Escape"&&!c.current){u.current();return}if(b.key!=="Tab")return;const g=l.current;if(!g)return;const O=Array.from(g.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(O.length===0){b.preventDefault();return}const y=O[0],v=O[O.length-1];b.shiftKey&&(document.activeElement===y||!g.contains(document.activeElement))?(b.preventDefault(),v.focus()):!b.shiftKey&&(document.activeElement===v||!g.contains(document.activeElement))&&(b.preventDefault(),y.focus())};return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h),document.body.style.overflow=f,d!=null&&d.isConnected&&d.focus()}},[]),si.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(PKe,{})})]}),t]})}),document.body)}function nv({message:e}){return e?o.jsx("div",{className:"knowledge-form-error",role:"alert",children:e}):null}function RM(e){return e instanceof DOMException&&e.name==="AbortError"}function LKe(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}function $Ke(e){const t=e.trim().toLowerCase();return["ready","active","available","success"].includes(t)?"可用":["creating","pending","processing","indexing"].includes(t)?"处理中":["failed","error","unavailable"].includes(t)?"异常":e||"未知"}const Mde=[".jpg",".jpeg",".png"].join(","),BKe=new Set(Mde.split(",")),Lde=[".pdf",".pptx",".docx",".xlsx",".txt"].join(","),QKe=new Set(Lde.split(",")),FKe=200*1024*1024;function IM(e){const t=e.lastIndexOf(".");return t<0?"":e.slice(t).toLocaleLowerCase()}function UKe(e,t){return e.size>FKe?"单个文件不能超过 200 MB":t==="image"?BKe.has(IM(e.name))?"":"请选择 PNG、JPG 或 JPEG 图片":QKe.has(IM(e.name))?"":"请选择 PDF、PPTX、DOCX、XLSX 或 TXT 文件"}function i8(e){return e<=0?"-":e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function $de(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 zKe({onClose:e,onCreated:t}){const[n,r]=m.useState(""),[i,s]=m.useState(""),[a,l]=m.useState(!1),[c,u]=m.useState(!1),[d,f]=m.useState(""),h=n.trim(),p=!!(h&&!/^[A-Za-z][A-Za-z0-9_]{0,47}$/.test(h)),b=async g=>{if(g.preventDefault(),l(!0),!h||p)return;u(!0),f("");const O={name:h,description:i.trim()||void 0};try{t(await lBe(O))}catch(y){f(Ea(y,"创建知识库失败"))}finally{u(!1)}};return o.jsx(ww,{title:"新建知识库",onClose:e,busy:c,children:o.jsxs("form",{onSubmit:g=>void b(g),children:[o.jsxs("div",{className:"knowledge-dialog__body",children:[o.jsxs("label",{children:[o.jsx("span",{children:"名称"}),o.jsx("input",{autoFocus:!0,value:n,maxLength:48,"aria-invalid":a&&p||void 0,"aria-describedby":"knowledge-name-help",onBlur:()=>l(!0),onChange:g=>r(g.target.value)})]}),o.jsx("p",{id:"knowledge-name-help",className:`knowledge-dialog__note${a&&p?" is-error":""}`,role:a&&p?"alert":void 0,children:a&&p?"名称必须以字母开头,且只能包含字母、数字和下划线。":"以字母开头,仅支持字母、数字和下划线,最多 48 个字符。"}),o.jsxs("label",{children:[o.jsx("span",{children:"描述(可选)"}),o.jsx("textarea",{value:i,maxLength:80,onChange:g=>s(g.target.value)})]}),o.jsx(nv,{message:d})]}),o.jsxs("footer",{className:"knowledge-dialog__actions",children:[o.jsx("button",{type:"button",onClick:e,disabled:c,children:"取消"}),o.jsx("button",{type:"submit",className:"is-primary",disabled:c||!h||p,children:c?"创建中":"创建"})]})]})})}function VKe({item:e,onClose:t,onUpdated:n}){const[r,i]=m.useState(e.description),[s,a]=m.useState(!1),[l,c]=m.useState(""),u=async d=>{d.preventDefault(),a(!0),c("");try{n(await cBe(e.id,e.region,{description:r.trim()}))}catch(f){c(Ea(f,"更新知识库失败"))}finally{a(!1)}};return o.jsx(ww,{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(nv,{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 Bde(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 qKe({base:e,onClose:t,onCreated:n,onAssociationInvalid:r}){const[i,s]=m.useState("document"),[a,l]=m.useState(""),[c,u]=m.useState(""),[d,f]=m.useState(""),[h,p]=m.useState(null),[b,g]=m.useState(!1),[O,y]=m.useState("{}"),[v,x]=m.useState(""),[w,S]=m.useState(""),[E,k]=m.useState(null),T=m.useRef(null),C=m.useRef(null),N=m.useRef(null),_=m.useRef(0),R=!!v;m.useEffect(()=>{var P;E&&!R&&((P=N.current)==null||P.focus())},[R,E]);const $=P=>{R||P===i||(s(P),p(null),f(""),l(""),u(""),S(""),k(null),g(!1),_.current=0,T.current&&(T.current.value=""))},D=P=>{if(!P||i==="web")return;const L=UKe(P,i);if(L){p(null),l(""),u(""),S(L);return}p(P),S(""),l(P.name.replace(/\.[^.]+$/,"")),u(IM(P.name).slice(1))},M=async P=>{if(P.preventDefault(),i==="web"?!d.trim():!h)return;let L;try{L=Bde(O)}catch(U){S(Ea(U,"Metadata 格式错误"));return}x(i==="web"?E?"save":"preview":"upload"),S("");try{if(i==="web")if(E){const U={sourceType:"url",metadata:E.metadata,url:E.preview.url,sourceTitle:E.preview.name,sourceMarkdown:E.preview.sourceMarkdown};await hBe(e.id,e.region,U),n()}else{const U=await pBe(e.id,e.region,{url:d.trim()});if(!U.sourceMarkdown.trim())throw new Error("网页没有可预览的 Markdown 内容");k({preview:U,metadata:L})}else h&&(await mBe(e.id,e.region,{file:h,name:a.trim()||void 0,documentType:c.trim()||void 0,metadata:L}),n())}catch(U){U instanceof tC&&U.errorCode===Wle?r(U):S(Ea(U,i==="web"?E?"添加网页失败":"生成网页预览失败":"上传文件失败"))}finally{x("")}},j=()=>{R||(k(null),S(""),requestAnimationFrame(()=>{var P;return(P=C.current)==null?void 0:P.focus()}))};return o.jsx(ww,{title:E?"预览网页内容":"添加数据",onClose:t,busy:R,className:E?"knowledge-dialog--preview knowledge-dialog--web-confirm":"",children:o.jsx("form",{onSubmit:P=>void M(P),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(_u,{text:E.preview.sourceMarkdown,allowRawHtml:!1,className:"knowledge-preview__markdown"})})}),w?o.jsx("div",{className:"knowledge-web-preview__error",children:o.jsx(nv,{message:w})}):null]}),o.jsxs("footer",{className:"knowledge-dialog__actions",children:[o.jsx("button",{type:"button",className:"is-back",onClick:j,disabled:R,children:"返回修改"}),o.jsx("button",{type:"button",onClick:t,disabled:R,children:"取消"}),o.jsx("button",{ref:N,type:"submit",className:"is-primary",disabled:R,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(([P,L])=>o.jsx("button",{type:"button",role:"tab",id:`knowledge-source-${P}-tab`,"aria-controls":`knowledge-source-${P}-panel`,"aria-selected":i===P,tabIndex:i===P?0:-1,className:i===P?"is-active":"",disabled:R,onClick:()=>$(P),onKeyDown:U=>{const F=["image","document","web"];if(!["ArrowLeft","ArrowRight","Home","End"].includes(U.key))return;U.preventDefault();const q=F.indexOf(P),z=U.key==="Home"?F[0]:U.key==="End"?F[F.length-1]:F[(q+(U.key==="ArrowRight"?1:-1)+F.length)%F.length];$(z),requestAnimationFrame(()=>{var B;return(B=document.getElementById(`knowledge-source-${z}-tab`))==null?void 0:B.focus()})},children:L},P))}),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:R,onChange:P=>{f(P.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(Ln,{children:"正在抓取网页并生成 Markdown 预览"}):null})]}):o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:T,className:"knowledge-upload-input",type:"file","aria-label":"选择知识文件",accept:i==="image"?Mde:Lde,disabled:R,onChange:P=>{var L;D(((L=P.currentTarget.files)==null?void 0:L[0])??null),P.currentTarget.value=""}}),o.jsxs("button",{type:"button",className:`knowledge-upload-dropzone${b?" is-dragging":""}${h?" is-ready":""}`,disabled:R,onClick:()=>{var P;return(P=T.current)==null?void 0:P.click()},onDragEnter:P=>{P.preventDefault(),!R&&(_.current+=1,g(!0))},onDragOver:P=>{P.preventDefault(),R||(P.dataTransfer.dropEffect="copy")},onDragLeave:P=>{P.preventDefault(),_.current=Math.max(0,_.current-1),_.current===0&&g(!1)},onDrop:P=>{var L;P.preventDefault(),_.current=0,g(!1),R||D(((L=P.dataTransfer.files)==null?void 0:L[0])??null)},children:[o.jsx("strong",{children:h?h.name:"选择文件或拖拽到这里"}),o.jsx("span",{children:h?`${i8(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:R?o.jsx(Ln,{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:R,maxLength:256,onChange:P=>l(P.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"类型(可选)"}),o.jsx("input",{value:c,disabled:R,maxLength:64,onChange:P=>u(P.target.value),placeholder:"pdf、docx、png"})]})]}):null,o.jsxs("label",{children:[o.jsx("span",{children:"Metadata(JSON)"}),o.jsx("textarea",{className:"is-code",value:O,disabled:R,onChange:P=>y(P.target.value),spellCheck:!1})]}),o.jsx(nv,{message:w})]}),o.jsxs("footer",{className:"knowledge-dialog__actions",children:[o.jsx("button",{type:"button",onClick:t,disabled:R,children:"取消"}),o.jsx("button",{type:"submit",className:"is-primary",disabled:R||(i==="web"?!d.trim():!h),children:R?i==="web"?"生成中":"上传中":i==="web"?"生成预览":"上传文件"})]})]})})})}function HKe({base:e,item:t,onClose:n,onUpdated:r}){const[i,s]=m.useState(()=>JSON.stringify(t.metadata??{},null,2)),[a,l]=m.useState(!1),[c,u]=m.useState(""),d=async f=>{f.preventDefault();let h;try{h=Bde(i)}catch(p){u(Ea(p,"Metadata 格式错误"));return}l(!0),u("");try{r(await gBe(e.id,t.id,e.region,{metadata:h}))}catch(p){u(Ea(p,"更新知识失败"))}finally{l(!1)}};return o.jsx(ww,{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(nv,{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 Qde=new Set(["avif","bmp","gif","jpeg","jpg","png","svg","webp"]),Fde=new Set(["aac","flac","m4a","mp3","ogg","wav","webm"]),Ude=new Set(["m4v","mov","mp4","mpeg","mpg","ogg","webm"]),XKe=new Set(["pdf"]),GKe=new Set(["doc","docx","ppt","pptx","xls","xlsx"]),YKe=new Set(["creating","indexing","pending","processing","queued","submitted"]),WKe=new Set(["error","failed","unavailable"]);function nH(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function yE(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 ZKe(e){if(Array.isArray(e)){if(e.length===0)return null;const r=e.map(nH);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=>yE(s[a])))}}return{columns:["值"],rows:e.map(i=>[yE(i)])}}const t=nH(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])=>yE(l[a])))}}return{columns:["字段","值"],rows:n.map(([r,i])=>[r,yE(i)])}}function zde(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 KKe(e){const t=zde(e);return t.startsWith("http://")||t.startsWith("https://")?t:""}function JKe(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 Qde.has(r)?"image":Fde.has(r)?"audio":Ude.has(r)?"video":XKe.has(r)?"pdf":t||r?"file":"none"}function eJe(e){const t=e.status.trim().toLocaleLowerCase();if(YKe.has(t))return{title:"数据正在处理中",detail:"知识库完成解析后即可预览,请稍后重新加载。"};if(WKe.has(t))return{title:"数据解析失败",detail:"请检查源文件或网页地址后重新添加,也可以重新加载最新状态。"};const n=$de(e).toLocaleLowerCase();return n==="pdf"||GKe.has(n)?{title:"暂时没有可预览的解析内容",detail:"此类文件会在知识库完成解析后显示文本、表格或页面图片。"}:Qde.has(n)||Fde.has(n)||Ude.has(n)?{title:"暂时没有可预览的媒体内容",detail:"知识库尚未返回可访问的媒体预览,请稍后重新加载。"}:{title:"暂无可预览的数据内容",detail:"知识库尚未返回解析结果,请稍后重新加载。"}}function tJe({chunk:e}){const[t,n]=m.useState(!1),r=zde(e.attachmentUrl),i=JKe(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 nJe({base:e,item:t,onClose:n}){const[r,i]=m.useState([]),[s,a]=m.useState(t),[l,c]=m.useState(""),[u,d]=m.useState(!0),[f,h]=m.useState(!1),[p,b]=m.useState(!1),[g,O]=m.useState(""),y=m.useRef(0),v=m.useRef(null),x=m.useCallback(async(k=0)=>{var N;(N=v.current)==null||N.abort();const T=new AbortController;v.current=T;const C=y.current+1;y.current=C,k>0?h(!0):d(!0),O(""),k===0&&(i([]),b(!1));try{const _=await fBe(e.id,t.id,{region:e.region,offset:k,signal:T.signal});if(y.current!==C)return;a(_.document.id?_.document:t),c(_.sourceMarkdown||_.document.sourceMarkdown),i(R=>k>0?[...R,..._.chunks]:_.chunks),b(_.hasMore)}catch(_){!RM(_)&&y.current===C&&O(Ea(_,"加载数据预览失败"))}finally{y.current===C&&(d(!1),h(!1))}},[e.id,e.region,t]);m.useEffect(()=>(x(),()=>{var k;(k=v.current)==null||k.abort(),y.current+=1}),[x]);const w=KKe(s.url||t.url),S=eJe(s),E=s.metadata._veadk_content_format==="markdown";return o.jsx(ww,{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:i8(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(_u,{text:l,allowRawHtml:!1,className:"knowledge-preview__markdown"})}):u?o.jsx("div",{className:"knowledge-preview__state",role:"status",children:o.jsx(Ln,{as:"span",duration:2.4,children:"正在加载数据预览"})}):g&&r.length===0?o.jsxs("div",{className:"knowledge-preview__state is-error",role:"alert",children:[o.jsx("p",{children:g}),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,T)=>{const C=ZKe(k.tableFields),N=k.id||`${T}:${k.title}`;return o.jsxs("article",{className:"knowledge-preview__chunk",children:[o.jsx("header",{children:o.jsx("h3",{children:k.title||`片段 ${T+1}`})}),k.content?E?o.jsx(_u,{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((_,R)=>o.jsx("th",{scope:"col",children:_},`${_}:${R}`))})}),o.jsx("tbody",{children:C.rows.map((_,R)=>o.jsx("tr",{children:_.map(($,D)=>o.jsx("td",{children:$},D))},R))})]})}):null,o.jsx(tJe,{chunk:k})]},N)}),g?o.jsx("div",{className:"knowledge-preview__more-error",role:"alert",children:g}):null,p?o.jsx("button",{type:"button",className:"knowledge-preview__load-more",disabled:f,onClick:()=>void x(r.length),children:f?o.jsx(Ln,{as:"span",duration:2.4,children:"正在加载更多"}):"加载更多"}):null]})})]})})}function rJe({cloudProvider:e,active:t=!0,activationRevision:n=0}){const[r,i]=m.useState([]),[s,a]=m.useState({}),[l,c]=m.useState([]),[u,d]=m.useState(""),[f,h]=m.useState(""),[p,b]=m.useState(!0),[g,O]=m.useState(!1),[y,v]=m.useState(""),[x,w]=m.useState([]),[S,E]=m.useState(!1),[k,T]=m.useState(""),[C,N]=m.useState(""),[_,R]=m.useState(""),[$,D]=m.useState(!1),[M,j]=m.useState(!1),[P,L]=m.useState(!1),[U,F]=m.useState(null),[q,z]=m.useState(null),[B,V]=m.useState(null),[ce,we]=m.useState(null),[Oe,de]=m.useState(null),[Z,J]=m.useState(!1),fe=m.useRef(0),be=m.useRef(0),je=m.useRef([]),Qe=m.useRef(!1),Me=m.useRef(!1),le=m.useRef(null),ke=m.useRef(null),ye=m.useRef({}),$e=m.useRef(!1),ze=m.useRef(null),Ae=m.useRef(null),Ve=m.useRef(null),ut=m.useRef(null),Tt=m.useMemo(()=>Tb(e).map(ve=>ve.value),[e]),We=m.useCallback(ve=>`${ve.region}\0${ve.id}`,[]),W=r.find(ve=>We(ve)===u)??null,ne=!!(W&&_===We(W)),he=m.useMemo(()=>{const ve=f.trim().toLocaleLowerCase();return ve?r.filter(Ue=>[Ue.name,Ue.description,Ue.ownerLabel,Ue.providerKnowledgeId].some(Y=>Y.toLocaleLowerCase().includes(ve))):r},[r,f]);m.useEffect(()=>{z(null)},[W==null?void 0:W.id,W==null?void 0:W.region]);const xe=m.useCallback(async(ve=!1)=>{var mt;if(ve&&($e.current||Object.keys(ye.current).length===0))return;(mt=le.current)==null||mt.abort();const Ue=new AbortController;le.current=Ue;const Y=fe.current+1;fe.current=Y,$e.current=!0,ve?O(!0):b(!0),v(""),ve||c([]);try{const xt=await oBe({regions:Tt,nextTokens:ve?ye.current:void 0,signal:Ue.signal});if(fe.current!==Y)return;i(Ne=>ve?[...Ne,...xt.items.filter(Ge=>!Ne.some(Pt=>We(Pt)===We(Ge)))]:xt.items),ye.current=xt.nextTokens,a(xt.nextTokens);const Dt=xt.failures.map(({region:Ne,error:Ge})=>`${Ec(Ne,e)}:${Ea(Ge,"加载失败")}`);c(Ne=>ve?[...new Set([...Ne,...Dt])]:Dt),ve||d(Ne=>xt.items.some(Ge=>We(Ge)===Ne)?Ne:"")}catch(xt){if(RM(xt))return;fe.current===Y&&(ve?c(Dt=>[...new Set([...Dt,Ea(xt,"加载更多知识库失败")])]):v(Ea(xt,"加载知识库失败")))}finally{fe.current===Y&&($e.current=!1,b(!1),O(!1))}},[We,e,Tt]),re=m.useCallback(async(ve,Ue=!1)=>{var xt;if(Ue&&Qe.current)return;(xt=ke.current)==null||xt.abort();const Y=new AbortController;ke.current=Y;const mt=be.current+1;be.current=mt,Ue||(je.current=[],Me.current=!1,w([]),D(!1),N("")),Qe.current=!0,E(!0),Ue?N(""):T("");try{const Dt=await dBe(ve.id,{region:ve.region,offset:Ue?je.current.length:0,signal:Y.signal});if(be.current!==mt)return;R(Kt=>Kt===We(ve)?"":Kt);const Ne=je.current,Ge=Ue?[...Ne,...Dt.items.filter(Kt=>!Kt.id||!Ne.some(tt=>tt.id===Kt.id))]:Dt.items,Pt=Dt.hasMore&&(!Ue||Ge.length>Ne.length);je.current=Ge,Me.current=Pt,w(Ge),D(Pt)}catch(Dt){if(RM(Dt))return;be.current===mt&&(Dt instanceof tC&&Dt.errorCode===Wle&&(R(We(ve)),F(Ge=>Ge&&We(Ge)===We(ve)?null:Ge)),Ue?N(Ea(Dt,"加载更多数据失败")):T(Ea(Dt,"加载数据失败")))}finally{be.current===mt&&(Qe.current=!1,E(!1))}},[We]);m.useEffect(()=>{var ve;(ve=le.current)==null||ve.abort(),fe.current+=1,$e.current=!1,ye.current={},i([]),a({}),c([]),d(""),R(""),v(""),b(!0)},[e]),m.useEffect(()=>{if(t)return xe(),()=>{var ve;(ve=le.current)==null||ve.abort(),fe.current+=1,$e.current=!1}},[t,n,xe]),m.useEffect(()=>{var ve,Ue;if(!t){(ve=ke.current)==null||ve.abort(),be.current+=1,Qe.current=!1;return}if(!W){(Ue=ke.current)==null||Ue.abort(),be.current+=1,je.current=[],Qe.current=!1,Me.current=!1,w([]),D(!1),N("");return}return re(W),()=>{var Y;(Y=ke.current)==null||Y.abort(),be.current+=1,Qe.current=!1}},[t,n,W==null?void 0:W.id,W==null?void 0:W.region]);const Re=t&&!W&&!f.trim()&&!p&&!g&&!y&&Object.keys(s).length>0;m.useEffect(()=>{const ve=Ae.current,Ue=ze.current;if(!ve||!Ue||!Re)return;const Y=new IntersectionObserver(([mt])=>{mt.isIntersecting&&xe(!0)},{root:Ue,rootMargin:"240px 0px",threshold:.01});return Y.observe(ve),()=>Y.disconnect()},[Re,xe]);const nt=()=>{const ve=ze.current;!ve||!Re||ve.scrollHeight-ve.scrollTop-ve.clientHeight<=240&&xe(!0)},Ke=!!(W&&x.length>0&&$&&!S&&!C);m.useEffect(()=>{const ve=ut.current,Ue=Ve.current;if(!W||!ve||!Ue||!Ke)return;const Y=new IntersectionObserver(([mt])=>{mt.isIntersecting&&re(W,!0)},{root:Ve.current,rootMargin:"240px 0px",threshold:.01});return Y.observe(ve),()=>Y.disconnect()},[Ke,re,W==null?void 0:W.id,W==null?void 0:W.region]);const tn=()=>{const ve=Ve.current;if(!W||!ve||!Me.current||Qe.current||C)return;const{scrollHeight:Ue,scrollTop:Y,clientHeight:mt}=ve;Ue-Y-mt<=240&&re(W,!0)},Gt=ve=>{i(Ue=>Ue.map(Y=>We(Y)===We(ve)?ve:Y))},At=async()=>{if(ce){J(!0);try{await uBe(ce.id,ce.region),i(ve=>ve.filter(Ue=>We(Ue)!==We(ce))),R(ve=>ve===We(ce)?"":ve),u===We(ce)&&d(""),we(null)}catch(ve){v(Ea(ve,"删除知识库失败")),we(null)}finally{J(!1)}}},St=async()=>{if(!(!W||!Oe)){J(!0);try{await bBe(W.id,Oe.id,W.region);const ve=je.current.filter(Ue=>Ue.id!==Oe.id);je.current=ve,w(ve),de(null)}catch(ve){T(Ea(ve,"删除知识失败")),de(null)}finally{J(!1)}}};return o.jsxs("section",{className:`knowledge-library${W?" is-detail":" my-agents-page"}`,"aria-label":"知识库",children:[W?o.jsxs("div",{className:"knowledge-library__detail",children:[o.jsxs("header",{className:"knowledge-detail-head",children:[o.jsxs("div",{className:"knowledge-detail-head__title",children:[o.jsx("button",{type:"button",className:"knowledge-back-button",onClick:()=>d(""),"aria-label":"返回知识库列表",children:o.jsx(MKe,{})}),o.jsxs("div",{children:[o.jsx("h2",{title:W.name,children:W.name}),o.jsx("p",{children:W.description||"暂无描述"})]})]}),W.canManage&&o.jsxs("div",{className:"knowledge-detail-head__actions",children:[o.jsx("button",{type:"button",onClick:()=>L(!0),children:"编辑"}),o.jsx("button",{type:"button",className:"is-danger",onClick:()=>we(W),children:"删除"})]})]}),o.jsxs("dl",{className:"knowledge-detail-meta",children:[o.jsxs("div",{children:[o.jsx("dt",{children:"Provider"}),o.jsx("dd",{children:W.providerType||"-"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"Knowledge ID"}),o.jsx("dd",{className:"knowledge-keyboard-reveal",tabIndex:0,title:W.providerKnowledgeId,children:W.providerKnowledgeId||"-"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"项目"}),o.jsx("dd",{children:W.projectName||"default"})]}),W.ownerLabel&&o.jsxs("div",{children:[o.jsx("dt",{children:"创建者"}),o.jsx("dd",{children:W.ownerLabel})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"更新时间"}),o.jsx("dd",{children:LKe(W.updatedAt)||"-"})]})]}),o.jsxs("section",{className:"knowledge-documents",children:[o.jsxs("header",{className:"knowledge-documents__head",children:[o.jsx("h3",{children:"数据"}),W.canManage&&o.jsxs("button",{type:"button",className:"knowledge-primary-button",disabled:ne,title:ne?"底层 Provider 知识库已不存在":void 0,onClick:()=>F(W),children:[o.jsx(tH,{}),o.jsx("span",{children:ne?"关联已失效":"添加数据"})]})]}),o.jsx("div",{className:`knowledge-documents__body${x.length>0?" is-table":""}`,"aria-live":"polite",children:S&&x.length===0?o.jsxs("div",{className:"my-agent-initial-loading",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载数据"})]}):k&&x.length===0?o.jsxs("div",{className:"knowledge-library__state is-error",role:"alert",children:[o.jsx("p",{children:k}),ne&&W.canManage?o.jsx("button",{type:"button",onClick:()=>we(W),children:"删除失效关联"}):o.jsx("button",{type:"button",onClick:()=>void re(W),children:"重试"})]}):x.length===0?o.jsxs("div",{className:"knowledge-library__state",children:[o.jsx(IKe,{}),o.jsx("p",{children:"这个知识库还没有数据"}),W.canManage&&o.jsx("button",{type:"button",onClick:()=>F(W),children:"添加第一项数据"})]}):o.jsxs("div",{ref:Ve,className:"knowledge-document-table-wrap","aria-busy":S||void 0,onScroll:tn,children:[o.jsxs("table",{className:"knowledge-document-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("th",{scope:"col",className:"knowledge-document-table__actions-heading",children:"操作"})]})}),o.jsx("tbody",{children:x.map(ve=>o.jsxs("tr",{children:[o.jsx("td",{className:"knowledge-document-table__name",title:ve.name||ve.id,children:ve.name||ve.id}),o.jsx("td",{children:$de(ve)}),o.jsx("td",{children:i8(ve.sizeBytes)}),o.jsx("td",{children:o.jsxs("div",{className:"knowledge-document-table__actions",children:[o.jsx(il,{content:"预览",compact:!0,children:o.jsx(vn,{type:"button",className:"knowledge-document-action-button",color:"secondary",variant:"ghost",size:"sm",iconSize:"sm",uniform:!0,"aria-label":`预览 ${ve.name||ve.id}`,onClick:()=>z(ve),children:o.jsx(_2e,{"aria-hidden":"true"})})}),W.canManage?o.jsxs(o.Fragment,{children:[o.jsx(il,{content:"编辑",compact:!0,children:o.jsx(vn,{type:"button",className:"knowledge-document-action-button",color:"secondary",variant:"ghost",size:"sm",iconSize:"sm",uniform:!0,"aria-label":`编辑 ${ve.name||ve.id}`,onClick:()=>V(ve),children:o.jsx(J4,{"aria-hidden":"true"})})}),o.jsx(il,{content:"删除",compact:!0,children:o.jsx(vn,{type:"button",className:"knowledge-document-action-button",color:"danger",variant:"ghost",size:"sm",iconSize:"sm",uniform:!0,"aria-label":`删除 ${ve.name||ve.id}`,onClick:()=>de(ve),children:o.jsx(wne,{"aria-hidden":"true"})})})]}):null]})})]},ve.id))})]}),S?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:"正在加载更多数据"})]}):C?o.jsxs("div",{className:"knowledge-document-pagination is-error",role:"alert",children:[o.jsx("span",{children:C}),o.jsx("button",{type:"button",onClick:()=>void re(W,!0),children:"重试加载"})]}):$?o.jsx("div",{ref:ut,className:"knowledge-document-pagination",role:"status","aria-live":"polite",children:"继续下滑加载更多"}):null]})})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"knowledge-library__toolbar my-agent-type-bar library-resource-toolbar",children:[o.jsx("div",{className:"knowledge-library__toolbar-actions library-resource-toolbar__controls",children:o.jsxs("button",{type:"button",className:"my-agent-create-primary",onClick:()=>j(!0),children:[o.jsx(tH,{}),o.jsx("span",{children:"新建知识库"})]})}),o.jsxs("label",{className:"knowledge-library__search my-agent-search",children:[o.jsx(DKe,{}),o.jsx("input",{type:"search",value:f,onChange:ve=>h(ve.target.value),placeholder:"搜索知识库","aria-label":"搜索知识库"})]})]}),o.jsxs("div",{ref:ze,className:"knowledge-library__results my-agent-results","aria-live":"polite",onScroll:nt,children:[l.length>0&&!p&&o.jsxs("div",{className:"knowledge-region-warning",role:"status",children:[o.jsx("span",{children:"部分知识库暂时无法加载,已展示其余可用内容。"}),o.jsx("button",{type:"button",onClick:()=>void xe(),children:"重试"})]}),p&&r.length===0?o.jsxs("div",{className:"my-agent-initial-loading",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载知识库"})]}):y?o.jsxs("div",{className:"knowledge-library__state is-error",role:"alert",children:[o.jsx("p",{children:y}),o.jsx("button",{type:"button",onClick:()=>void xe(),children:"重试"})]}):he.length===0?o.jsxs("div",{className:"knowledge-library__state",children:[o.jsx(RKe,{}),o.jsx("p",{children:f.trim()?"没有匹配的知识库":"您还没有任何知识库"})]}):o.jsx("div",{className:"knowledge-library__grid my-agent-grid",children:he.map(ve=>o.jsx(Jle,{className:"knowledge-card",title:ve.name,status:o.jsx("span",{className:`knowledge-status is-${ve.status.toLowerCase()}`,children:$Ke(ve.status)}),description:ve.description||"暂无描述",metadata:[{label:"创建者",value:ve.ownerLabel||"—",title:ve.ownerLabel||"—"},{label:"项目",value:ve.projectName||"default",title:ve.projectName||"default"}],secondaryAction:{label:_===We(ve)?"关联已失效":"添加数据",disabled:!ve.canManage||_===We(ve),title:ve.canManage?_===We(ve)?"底层 Provider 知识库已不存在":void 0:"您没有管理此知识库的权限",onClick:()=>F(ve)},primaryAction:{label:"查看详情",onClick:()=>d(We(ve))},menuLabel:`更多知识库操作:${ve.name}`,menuAriaLabel:`${ve.name}知识库操作`,menuActions:[{label:"编辑知识库",disabled:!ve.canManage,title:ve.canManage?void 0:"您没有管理此知识库的权限",onClick:()=>{d(We(ve)),L(!0)}},{label:"删除知识库",danger:!0,disabled:!ve.canManage||Z,title:ve.canManage?void 0:"您没有管理此知识库的权限",onClick:()=>we(ve)}]},We(ve)))}),Re||g?o.jsx("div",{ref:Ae,className:"my-agent-load-more",role:"status","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:"正在加载更多知识库"})]}):Re?o.jsx("span",{children:"继续下滑加载更多"}):null}):null]})]}),M&&o.jsx(zKe,{onClose:()=>j(!1),onCreated:ve=>{i(Ue=>[ve,...Ue]),d(We(ve)),j(!1)}}),W&&P&&o.jsx(VKe,{item:W,onClose:()=>L(!1),onUpdated:ve=>{Gt(ve),L(!1)}}),W&&q&&o.jsx(nJe,{base:W,item:q,onClose:()=>z(null)}),U&&o.jsx(qKe,{base:U,onClose:()=>F(null),onAssociationInvalid:ve=>{R(We(U)),W&&We(W)===We(U)&&T(Ea(ve,"知识库关联已失效")),F(null)},onCreated:()=>{W&&We(W)===We(U)&&re(W),F(null)}}),W&&B&&o.jsx(HKe,{base:W,item:B,onClose:()=>V(null),onUpdated:ve=>{const Ue=je.current.map(Y=>Y.id===ve.id?ve:Y);je.current=Ue,w(Ue),V(null)}}),ce&&o.jsx(Bl,{title:"删除知识库?",description:`将删除 ${ce.name} 的 AgentKit 关联;如果它由 Studio 创建,也会同时删除 Provider 资源。此操作无法撤销。`,confirmLabel:Z?"删除中":"删除",variant:"danger",busy:Z,onCancel:()=>we(null),onConfirm:()=>void At()}),Oe&&o.jsx(Bl,{title:"删除知识?",description:`将从 Provider 知识库中删除 ${Oe.name||Oe.id},此操作无法撤销。`,confirmLabel:Z?"删除中":"删除",variant:"danger",busy:Z,onCancel:()=>de(null),onConfirm:()=>void St()})]})}const iJe="_EmptyMessage_1r5gu_1",sJe="_IconBadge_1r5gu_16",aJe="_Title_1r5gu_54",oJe="_Description_1r5gu_69",lJe="_ActionRow_1r5gu_77",Sw={EmptyMessage:iJe,IconBadge:sJe,Title:aJe,Description:oJe,ActionRow:lJe},ln=({children:e,className:t,fill:n="static"})=>o.jsx("div",{className:zr(Sw.EmptyMessage,t),"data-fill":n,children:e}),cJe=({size:e="md",color:t="secondary",children:n,className:r})=>o.jsx("div",{className:zr(Sw.IconBadge,r),"data-size":e,"data-color":t,children:n}),uJe=({children:e,className:t,color:n="secondary"})=>o.jsx("div",{className:zr(Sw.Title,t),"data-color":n,children:e}),dJe=({children:e,className:t})=>o.jsx("div",{className:zr(Sw.Description,t),children:e}),fJe=({children:e,className:t})=>o.jsx("div",{className:zr(Sw.ActionRow,t),children:e});ln.Icon=cJe;ln.Title=uJe;ln.Description=dJe;ln.ActionRow=fJe;const hJe="/web/skill-management";class pJe 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 uf(e,t={},n=So){return fetch(bo(`${hJe}${e}`),{...t,headers:Kh(t.headers),signal:Eo(t.signal,n)})}async function Vde(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 pJe(n,e.status,r,e.statusText,i,s)}async function df(e,t){if(!e.ok)throw await Vde(e,t);return e.json()}async function mJe(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),df(await uf(`/spaces?${t}`,{signal:e.signal}),"读取 Skill 空间失败")}async function gJe(e){return df(await uf("/spaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),"创建 Skill 空间失败")}async function bJe(e){return df(await uf(`/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 OJe(e){const t=new URLSearchParams({region:e.region});await df(await uf(`/spaces/${encodeURIComponent(e.spaceId)}?${t}`,{method:"DELETE"}),"删除 Skill 空间失败")}async function yJe(e){const t=new URLSearchParams({region:e.region});return e.project&&t.set("project",e.project),df(await uf(`/spaces/${encodeURIComponent(e.spaceId)}/skills?${t}`,{method:"POST",headers:{"Content-Type":"application/zip"},body:e.file},Ni),"上传 Skill 失败")}async function xJe(e){return df(await uf("/validate",{method:"POST",headers:{"Content-Type":"application/zip"},body:e},Ni),"校验 Skill 失败")}async function vJe(e){const t=new URLSearchParams({region:e.region});await df(await uf(`/spaces/${encodeURIComponent(e.spaceId)}/skills/${encodeURIComponent(e.skillId)}?${t}`,{method:"DELETE"}),"删除 Skill 失败")}async function wJe(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 df(await uf(`/spaces/${encodeURIComponent(e.spaceId)}/skills/${encodeURIComponent(e.skillId)}/files?${t}`),"读取 Skill 文件失败");return Array.isArray(n.files)?n.files:[]}async function SJe(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 uf(`/spaces/${encodeURIComponent(e.spaceId)}/skills/${encodeURIComponent(e.skillId)}/archive?${t}`,{},Ni);n.ok||await df(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 pC(e){const t=await fetch(e,{headers:{accept:"application/json"},signal:Eo(void 0,So)});if(!t.ok)throw await Vde(t,"AgentKit Skills 请求失败");return t.json()}async function qde(){return(await pC("/web/skill-spaces?region=all")).items||[]}async function Hde(e,t){const n=t?`?region=${encodeURIComponent(t)}`:"";return(await pC(`/web/skill-spaces/${encodeURIComponent(e)}/skills${n}`)).items||[]}async function EJe(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),pC(`/web/skill-spaces/${encodeURIComponent(e)}/skills?${n.toString()}`)}async function kJe(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 pC(`/web/skill-spaces/${encodeURIComponent(e)}/skills/${encodeURIComponent(t)}${c}`)}function TJe(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 _Je(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 AJe="/web/skill-workbench";class DM 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 Fl(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t}格式错误。`);return e}function rH(e,t){if(e!=null){if(typeof e!="string"||!e.trim()||e.trim().length>256)throw new Error(`${t}格式错误。`);return e.trim()}}function CJe(e){if(e!=null){if(e==="pending"||e==="ready"||e==="failed"||e==="unknown")return e;throw new Error("Skill 恢复点状态格式错误。")}}async function Au(e,t={},n=So){return fetch(bo(`${AJe}${e}`),{...t,headers:Kh(t.headers),signal:Eo(t.signal,n)})}async function s8(e,t){var r;const n=await e.text().catch(()=>"");try{const i=Fl(JSON.parse(n),"错误响应"),s=i.detail&&typeof i.detail=="object"?Fl(i.detail,"错误详情"):i;return new DM(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 DM(`${t}(HTTP ${e.status},Content-Type: ${i})。请检查代理或网关配置。`,e.status,"SKILL_WORKBENCH_ERROR",!1,e.statusText,void 0,n)}}async function Qh(e,t){if(!e.ok)throw await s8(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 NJe(e){return Array.isArray(e)?e.map(t=>{const n=Fl(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 jJe(e){if(e==null)return;const t=Fl(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"||!l6(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 rv(e){const t=Fl(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=Fl(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=rH(t.toolId,"Tool ID"),s=rH(t.sessionId,"Session ID"),a=CJe(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:NJe(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:jJe(t.publication)}:{}}}async function mC(e){const t=Fl(await Qh(await Au("/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 RJe(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 Au(`/tasks/from-upload?${n}`,{method:"POST",body:e.file,headers:{"Content-Type":"application/zip"},signal:e.signal},Ni);return rv(await Qh(r,"开始优化 Skill 失败"))}const t=await Au("/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},Ni);return rv(await Qh(t,"开始 Skill 会话失败"))}async function IJe(e,t){return rv(await Qh(await Au(`/tasks/${encodeURIComponent(e)}`,{signal:t}),"读取 Skill 会话失败"))}async function YR(e,t,n){const r=new URLSearchParams;r.set("expected_revision",String(t));const i=Fl(await Qh(await Au(`/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=Fl(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 WR(e){const t=await Au(`/tasks/${encodeURIComponent(e.jobId)}/refinements`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({intent:e.intent,expectedRevision:e.expectedRevision})},Ni);return rv(await Qh(t,"继续调整 Skill 失败"))}async function DJe(e){const t=await Au(`/tasks/${encodeURIComponent(e.jobId)}/stop`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expectedRevision:e.expectedRevision})});return rv(await Qh(t,"停止当前 Skill 任务失败"))}async function PJe(e){const t=await Au(`/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 s8(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=Fl(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 p=Fl(d.error,"发布错误");throw new DM(typeof p.message=="string"?p.message:"发布 Skill 失败",500,typeof p.code=="string"?p.code:"SKILL_PUBLISH_FAILED",p.retryable===!0,"",p.originalError&&typeof p.originalError=="object"?p.originalError:void 0,JSON.stringify(d.error))}if(d.type!=="complete")throw new Error("未知的发布进度事件。");const f=Fl(d.result,"发布结果");if(typeof f.skillId!="string"||typeof f.version!="string"||!Array.isArray(f.skillSpaceIds)||!f.skillSpaceIds.every(p=>typeof p=="string")||f.disposition!=="create-new"&&f.disposition!=="update-source"||!l6(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 MJe(e){await Qh(await Au(`/tasks/${encodeURIComponent(e)}`,{method:"DELETE"}),"删除 Skill 会话失败")}async function LJe(e,t,n){var c;const r=new URLSearchParams;r.set("expected_revision",String(t)),r.set("expected_sha256",n);const i=await Au(`/tasks/${encodeURIComponent(e)}/download?${r.toString()}`,{},Ni);if(!i.ok)throw await s8(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 $Je={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 BJe(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 QJe(e){return typeof e=="object"&&e!==null&&typeof e.path=="string"}function FJe(e){return typeof e=="object"&&e!==null&&typeof e.call=="string"}function a8(e,t){if(QJe(e))return BJe(t,e.path);if(FJe(e)){const n=$Je[e.call],r={};for(const[i,s]of Object.entries(e.args??{}))r[i]=a8(s,t);return n?n(r):`[unknown fn: ${e.call}]`}return e}function UJe(e,t){const n=a8(e,t);return n==null?"":typeof n=="string"?n:String(n)}const Xde=new Map;function tg(e,t){Xde.set(e,t)}function zJe(e){return Xde.get(e)}function VJe(e,t,n){const r=t.replace(/^\//,"").split("/").map(s=>s.replace(/~1/g,"/").replace(/~0/g,"~"));let i=e;for(let s=0;sa8(r,e.dataModel),resolveString:r=>UJe(r,e.dataModel),dispatchAction:t,render:r=>{if(!r)return null;const i=e.components[r];if(!i)return null;const s=zJe(i.component)??qJe;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 Yde(e){const t=m.useRef(null),n=m.useRef(!0),r=28,i=m.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 gC({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(Nx,{"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(Ya,{})}):null]},i.name)),e.targetAgent?o.jsxs("span",{className:"invocation-chip invocation-chip--agent",title:e.targetAgent.description,children:[o.jsx(Ane,{"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(Ya,{})}):null]}):null]})}function o8(e=""){return e.startsWith("image/")?"image":e.startsWith("video/")?"video":e==="application/pdf"?"pdf":e==="text/markdown"?"markdown":"text"}function Wde(e){var n,r,i,s;const t=o8(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 Zde(e){return e?e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`:""}function Kde(e,t){return e.previewUrl?e.previewUrl:e.data?`data:${e.mimeType??"application/octet-stream"};base64,${e.data}`:e.uri?dre(t,e.uri):""}function XJe({kind:e}){return e==="image"?o.jsx(i6,{}):e==="video"?o.jsx(Rne,{}):e==="pdf"?o.jsx(X2e,{}):o.jsx(n6,{})}function bC({appName:e,items:t,compact:n=!1,onRemove:r}){const[i,s]=m.useState(null);return o.jsxs(o.Fragment,{children:[o.jsx("div",{className:`media-grid${n?" media-grid--compact":""}`,children:t.map(a=>{const l=o8(a.mimeType),c=Kde(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(i_e,{})})]}):o.jsx("span",{className:"media-card-icon",children:o.jsx(XJe,{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:Wde(a)}),a.status==="uploading"?o.jsxs(o.Fragment,{children:[o.jsx(sr,{className:"media-card-spinner"})," 上传中"]}):a.status==="error"?a.error??"上传失败":Zde(a.sizeBytes)]})]}),!n&&a.status!=="uploading"&&a.status!=="error"?o.jsx(F0,{className:"media-card-open"}):null]});return o.jsxs(Wi.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(yne,{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(Ya,{})}):null]},a.id)})}),o.jsx(Oh,{children:i?o.jsx(GJe,{appName:e,item:i,onClose:()=>s(null)}):null})]})}function GJe({appName:e,item:t,onClose:n}){const r=m.useMemo(()=>Kde(t,e),[e,t]),i=o8(t.mimeType),[s,a]=m.useState(""),[l,c]=m.useState(i==="text"||i==="markdown"),[u,d]=m.useState("");return m.useEffect(()=>{const f=h=>{h.key==="Escape"&&n()};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[n]),m.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(Wi.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(Wi.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:[Wde(t),t.sizeBytes?` · ${Zde(t.sizeBytes)}`:""]})]}),o.jsxs("nav",{children:[o.jsx("a",{href:r,download:t.name,"aria-label":"下载",children:o.jsx(dA,{})}),o.jsx("button",{type:"button",onClick:n,"aria-label":"关闭",children:o.jsx(Ya,{})})]})]}),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(sr,{})," 正在读取文档…"]}):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(_u,{text:s})}):null,!l&&i==="text"?o.jsx("pre",{className:"media-document media-document--plain",children:s}):null]})]})})}function YJe(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 WJe(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 l8(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 ZJe(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 KJe(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 JJe(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 eet(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 tet(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 c8(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 net({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(Ln,{className:"builtin-tool-label",duration:2.4,spread:18,"aria-live":"polite",children:a}),o.jsx(c8,{className:`builtin-tool-chevron${r?" is-open":""}`})]})}const ret={web_search:{name:"web_search",runningLabel:"正在进行网络搜索",doneLabel:"已完成网络搜索",tone:"search",icon:YJe},run_code:{name:"run_code",runningLabel:"正在 AgentKit 沙箱中执行代码",doneLabel:"已在 AgentKit 沙箱中完成代码执行",tone:"sandbox",icon:tet},image_generate:{name:"image_generate",runningLabel:"正在生成图片",doneLabel:"已完成图片生成",tone:"image",icon:WJe},video_generate:{name:"video_generate",runningLabel:"正在生成视频",doneLabel:"已完成视频生成",tone:"video",icon:l8},ppt_generate:{name:"ppt_generate",runningLabel:"正在生成 PPT",doneLabel:"已完成 PPT 生成",tone:"presentation",icon:ZJe},load_memory:{name:"load_memory",runningLabel:"正在检索长期记忆",doneLabel:"已完成记忆检索",tone:"memory",icon:KJe},load_knowledgebase:{name:"load_knowledgebase",runningLabel:"正在检索知识库",doneLabel:"已完成知识库检索",tone:"knowledge",icon:JJe},load_skill:{name:"load_skill",runningLabel:"正在加载技能",doneLabel:"已加载技能",tone:"skill",icon:eet}};function iet(e){return ret[e]}function Jde(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 set(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 aet(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"})]})}const oet=m.lazy(()=>Pd(()=>Promise.resolve().then(()=>D9),void 0));function cet(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 uet(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 u8({project:e,open:t,onClose:n,onChange:r,readOnly:i=!1}){var g;const[s,a]=m.useState(((g=e.files[0])==null?void 0:g.path)??null),[l,c]=m.useState(new Set),u=m.useRef(null),d=m.useMemo(()=>cet(e.files),[e.files]),f=e.files.find(O=>O.path===s)??null;if(m.useEffect(()=>{var v;if(!t)return;const O=document.body.style.overflow;document.body.style.overflow="hidden",(v=u.current)==null||v.focus();const y=x=>{x.key==="Escape"&&n()};return window.addEventListener("keydown",y),()=>{document.body.style.overflow=O,window.removeEventListener("keydown",y)}},[n,t]),m.useEffect(()=>{f||e.files.length===0||a(e.files[0].path)},[e.files,f]),!t)return null;function h(O){c(y=>{const v=new Set(y);return v.has(O)?v.delete(O):v.add(O),v})}function p(O,y,v){return uet(O,y===0).map(x=>{const w=v?`${v}/${x.name}`:x.name;if(!(x.children.size>0&&x.path===void 0)&&x.path)return o.jsxs("button",{type:"button",className:`code-browser-file${s===x.path?" is-active":""}`,style:{paddingLeft:`${12+y*16}px`},onClick:()=>a(x.path??null),title:x.path,children:[o.jsx(XF,{"aria-hidden":"true"}),o.jsx("span",{children:x.name})]},w);const E=l.has(w);return o.jsxs("div",{children:[o.jsxs("button",{type:"button",className:"code-browser-folder",style:{paddingLeft:`${10+y*16}px`},onClick:()=>h(w),"aria-expanded":!E,children:[o.jsx(fO,{className:E?"":"is-open","aria-hidden":"true"}),o.jsx(Ine,{"aria-hidden":"true"}),o.jsx("span",{children:x.name})]}),!E&&p(x,y+1,w)]},w)})}function b(O){f&&r({...e,files:e.files.map(y=>y.path===f.path?{...y,content:O}:y)})}return si.createPortal(o.jsx("div",{className:"code-browser-backdrop",onMouseDown:O=>{O.target===O.currentTarget&&n()},children:o.jsxs("section",{className:"code-browser-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"code-browser-title",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","aria-hidden":"true",children:o.jsx(jne,{})}),o.jsxs("div",{children:[o.jsx("h2",{id:"code-browser-title",children:"项目代码"}),o.jsx("p",{children:e.name||"Agent 项目"})]})]}),o.jsx("button",{ref:u,type:"button",className:"code-browser-close",onClick:n,"aria-label":"关闭代码浏览器",children:o.jsx(Ya,{"aria-hidden":"true"})})]}),o.jsxs("div",{className:"code-browser-workspace",children:[o.jsxs("aside",{className:"code-browser-sidebar","aria-label":"项目文件",children:[o.jsxs("div",{className:"code-browser-sidebar-head",children:["文件 ",o.jsx("span",{children:e.files.length})]}),o.jsx("div",{className:"code-browser-tree",children:e.files.length>0?p(d,0,""):o.jsx("div",{className:"code-browser-empty",children:"暂无项目文件"})})]}),o.jsxs("main",{className:"code-browser-main",children:[o.jsxs("div",{className:"code-browser-path",children:[o.jsx(XF,{"aria-hidden":"true"}),o.jsx("span",{children:(f==null?void 0:f.path)??"未选择文件"})]}),o.jsx("div",{className:"code-browser-editor",children:f?o.jsx(m.Suspense,{fallback:o.jsx("div",{className:"code-browser-empty",children:"正在加载编辑器…"}),children:o.jsx(oet,{value:f.content,path:f.path,onChange:b,readOnly:i})}):o.jsx("div",{className:"code-browser-empty",children:"从左侧选择文件以查看代码"})})]})]})]})}),document.body)}function det({project:e,onChange:t,className:n="",label:r="查看源码"}){const[i,s]=m.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(jne,{"aria-hidden":"true"}),o.jsx("span",{children:r})]}),o.jsx(u8,{project:e,open:i,onClose:()=>s(!1),onChange:t})]})}const efe="send_a2ui_json_to_client",fet=28,het=3e3;function pet(e,t,n){let r=t;for(let i=0;i65535?2:1}return r}function met(e){return e<=4?1:Math.min(18,Math.max(2,Math.ceil(e/6)))}function tfe(e,t,n,r){const[i,s]=m.useState(()=>t?"":e),a=m.useRef(i),l=m.useRef(e),c=m.useRef(null),u=m.useRef(0),d=m.useRef(n);return l.current=e,d.current=n,m.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 p=b=>{const g=l.current,O=a.current;if(!g.startsWith(O)){a.current=g,s(g),c.current=null;return}if(b-u.current{var f;(f=d.current)==null||f.call(d)},[i]),m.useEffect(()=>{i===e&&(r==null||r())},[i,r,e]),m.useEffect(()=>()=>{c.current!==null&&(window.cancelAnimationFrame(c.current),c.current=null)},[]),i}function get(){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 bet(){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 Oet(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 nfe({text:e,done:t,answerStarted:n=!1,streaming:r=!1,onStreamFrame:i}){const[s,a]=m.useState(!(t||n)),l=m.useRef(!1);m.useEffect(()=>{l.current||a(!(t||n))},[n,t]);const c=()=>{l.current=!0,a(p=>!p)},u=e.replace(/^\s+/,""),d=tfe(u,!t||r,i),{ref:f,onScroll:h}=Yde(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(Jde,{className:`thinking-logo ${t?"":"is-active"}`})}),t?o.jsx("span",{className:"think-label think-label--done",children:"已完成思考"}):o.jsx(Ln,{className:"think-label",duration:2.4,spread:18,children:"思考中"}),o.jsx(fO,{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 yet({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(Jde,{className:"thinking-logo is-active"})}),o.jsx(Ln,{className:"think-label",duration:2.4,spread:18,children:e})]})})}function xet({value:e,onResolve:t,onDownload:n,onDeploy:r}){const[i,s]=m.useState(e.files?e:null),[a,l]=m.useState(!1),[c,u]=m.useState(null),[d,f]=m.useState(""),[h,p]=m.useState(null),b=new Date(e.validatedAt),g=e.validatedAt?Number.isNaN(b.getTime())?e.validatedAt:b.toLocaleString("zh-CN",{hour12:!1}):"刚刚";m.useEffect(()=>{if(!h)return;const w=window.setTimeout(()=>p(null),het);return()=>window.clearTimeout(w)},[h]);async function O(){if(i)return i;if(!t)throw new Error("暂时无法读取生成的源码,请稍后重试。");const w=await t(e);return s(w),w}async function y(){u("source"),f(""),p(null);try{await O(),l(!0)}catch(w){f(w instanceof Error?w.message:String(w))}finally{u(null)}}async function v(){if(n){u("download"),f(""),p(null);try{await n(e),p({message:"已开始下载"})}catch(w){f(w instanceof Error?w.message:String(w))}finally{u(null)}}}async function x(){u("deploy"),f(""),p(null);try{r==null||r(await O())}catch(w){f(w instanceof Error?w.message:String(w))}finally{u(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(aet,{}):o.jsx(set,{})}),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:g})]})]}),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 y(),disabled:!t||c!==null,children:[c==="source"?o.jsx(sr,{className:"spin","aria-hidden":"true"}):null,"查看源码"]}),o.jsxs("button",{type:"button",className:"delivery-card-secondary",onClick:()=>void v(),disabled:!n||c!==null,"aria-busy":c==="download",children:[c==="download"?o.jsx(sr,{className:"spin","aria-hidden":"true"}):null,c==="download"?"正在准备…":"下载源码"]}),o.jsxs("button",{type:"button",onClick:()=>void x(),disabled:!e.deployable||!r||!t||c!==null,title:e.deployable?void 0:"源码尚未准备好",children:[c==="deploy"?o.jsx(sr,{className:"spin","aria-hidden":"true"}):null,"手动部署到 Runtime"]})]}),d?o.jsx("p",{className:"delivery-card-error",role:"alert",children:d}):null,h?o.jsx("p",{className:"delivery-card-status",role:"status","aria-live":"polite",children:h.message}):null]}),o.jsx(u8,{project:{name:e.agentName,files:(i==null?void 0:i.files)??[]},open:a,onClose:()=>l(!1),onChange:()=>{},readOnly:!0})]})}function rfe(){return o.jsx(nfe,{text:"",done:!1})}const vet=m.memo(function({text:t,streaming:n,onStreamFrame:r,onStreamComplete:i}){const s=tfe(t,n,r,i);return s?o.jsx("div",{className:"bubble",children:o.jsx(_u,{text:s,streaming:n})}):null}),wet={pending:"待处理",in_progress:"进行中",completed:"已完成",failed:"未完成"};function Eet({title:e,summary:t,items:n,done:r}){const[i,s]=m.useState(!r),a=m.useRef(!1);m.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(bet,{})}),r?o.jsx("span",{className:"plan-title",children:e}):o.jsx(Ln,{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(c8,{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:wet[c.status]})]},`${u}:${c.text}`))}):null})})]})}function ket(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 Tet({name:e,args:t,response:n,done:r,status:i}){const[s,a]=m.useState(!1),l=e===efe?"渲染 UI":e,c=i??(r?"completed":"running"),u=c==="failed"?void 0:iet(e),d=ket(n),f=n==null?null:typeof n=="string"?n:JSON.stringify(n,null,2),h=f&&f.length>2e3?f.slice(0,2e3)+` +…(已截断)`:f;return o.jsxs(Wi.div,{className:`block-tool${u?" block-tool--builtin":""}`,"data-status":c,initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},children:[u?o.jsx(net,{definition:u,label:Oet(e,t),done:r,open:s,onToggle:()=>a(p=>!p)}):o.jsxs("button",{className:"tool-head tool-head--generic",onClick:()=>a(p=>!p),type:"button","aria-expanded":s,children:[o.jsx("span",{className:"tool-icon tool-icon--generic","aria-hidden":"true",children:o.jsx(get,{})}),r?o.jsx("span",{className:"tool-name",children:l}):o.jsx(Ln,{className:"tool-name",duration:2.2,spread:15,children:l}),o.jsx(c8,{className:`tool-chevron${s?" is-open":""}`})]}),o.jsx("div",{className:`think-collapse ${s?"open":""}`,children:o.jsx("div",{className:"think-collapse-inner",children: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)})]}),h!=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:h})]}),d.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:d.map(p=>o.jsxs("a",{href:p.contentUrl,download:p.name,children:["下载 ",p.name]},`${p.contentUrl}:${p.name}`))})]})]})})})]})}function _et({block:e,onDownload:t,onPreview:n}){const[r,i]=m.useState(""),[s,a]=m.useState(""),[l,c]=m.useState(null);m.useEffect(()=>()=>{l&&URL.revokeObjectURL(l.url)},[l]);const u=()=>c(null),d=async(p,b)=>{if(t){i(`download:${p}`),a("");try{await t(p,b)}catch(g){a(g instanceof Error?g.message:String(g))}finally{i("")}}},f=async(p,b,g)=>{if(n){i(`preview:${g}`),a("");try{const O=await n(p,b);c({name:g,url:O})}catch(O){a(O instanceof Error?O.message:String(O))}finally{i("")}}},h=e.files.filter(p=>!p.filename.endsWith(".preview.webp"));return o.jsxs("div",{className:"artifact-list",children:[h.map(p=>{const b=`${p.filename.replace(/\.pptx$/i,"")}.preview.webp`,g=e.files.find(O=>O.filename===b);return o.jsxs("div",{className:"artifact-card",children:[o.jsx("span",{className:"artifact-card__icon","aria-hidden":"true",children:o.jsx(n6,{})}),o.jsxs("span",{className:"artifact-card__copy",children:[o.jsx("span",{className:"artifact-card__name",children:p.filename}),o.jsx("span",{className:"artifact-card__hint",children:"PowerPoint 演示文稿"})]}),o.jsxs("span",{className:"artifact-card__actions",children:[g&&o.jsxs("button",{className:"artifact-card__action",type:"button",disabled:!n||r!=="",onClick:()=>void f(g.filename,g.version,p.filename),children:[r===`preview:${p.filename}`?o.jsx(sr,{className:"spin"}):o.jsx(V2e,{}),"预览"]}),o.jsxs("button",{className:"artifact-card__action artifact-card__action--primary",type:"button",disabled:!t||r!=="",onClick:()=>void d(p.filename,p.version),children:[r===`download:${p.filename}`?o.jsx(sr,{className:"spin"}):o.jsx(dA,{}),"下载"]})]})]},`${p.filename}:${p.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(Ya,{})})]}),o.jsx("div",{className:"artifact-preview__canvas",children:o.jsx("img",{src:l.url,alt:`${l.name} 幻灯片预览`})})]})]})]})}function Aet({block:e,onAuth:t}){const[n,r]=m.useState(e.done?"done":"idle"),[i,s]=m.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(Wi.div,{className:"auth-card-collapsed",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},children:[o.jsx(GF,{className:"auth-card-icon auth-card-icon--done"}),o.jsxs("span",{children:["已授权 · ",a]})]}):o.jsxs(Wi.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(GF,{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(sr,{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 OC({blocks:e,appName:t="",streaming:n=!1,onStreamFrame:r,onStreamComplete:i,onAction:s,onAuth:a,onArtifactDownload:l,onArtifactPreview:c,onResolveDelivery:u,onDownloadDelivery:d,onDeployDelivery:f}){const h=e.reduce((p,b,g)=>b.kind==="text"?g:p,-1);return o.jsx(o.Fragment,{children:e.map((p,b)=>{switch(p.kind){case"progress":return o.jsx(yet,{text:p.text},"build-progress");case"thinking":{const g=e.slice(b+1).some(O=>O.kind==="text"&&!!O.text.trim());return o.jsx(nfe,{text:p.text,done:p.done,answerStarted:g,streaming:n,onStreamFrame:r},b)}case"text":{const g=p.text.replace(/^\s+/,"");return g?o.jsx(vet,{text:g,streaming:n,onStreamFrame:r,onStreamComplete:b===h?i:void 0},b):null}case"plan":return o.jsx(Eet,{title:p.title,summary:p.summary,items:p.items,done:p.done},b);case"attachment":return o.jsx(bC,{appName:t,items:p.files},b);case"artifact":return o.jsx(_et,{block:p,onDownload:l,onPreview:c},b);case"delivery":return o.jsx(xet,{value:p.value,onResolve:u,onDownload:d,onDeploy:f},b);case"invocation":return o.jsx(gC,{value:p.value},b);case"tool":return p.name===efe&&p.done?null:o.jsx(Tet,{name:p.name,args:p.args,response:p.response,done:p.done,status:p.status},b);case"agent-transfer":return null;case"auth":return o.jsx(Aet,{block:p,onAuth:a},b);case"a2ui":return Gde(p.messages).filter(g=>g.components[g.rootId]).map(g=>o.jsx(Wi.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(HJe,{surface:g,onAction:s})},`${b}-${g.surfaceId}`));default:return null}})})}const Cet=()=>{};function Net(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 jet({activities:e}){const t=m.useMemo(()=>e.filter(n=>n.kind!=="status").map(Net),[e]);return t.length===0?null:o.jsx("div",{className:"skill-conversation","aria-label":"Skill 生成对话","aria-live":"polite",children:o.jsx(OC,{blocks:t,onAction:Cet})})}function iH(){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 Gk({label:e,value:t,options:n,onChange:r,disabled:i=!1,allowCustom:s=!1,required:a=!1,placeholder:l="请选择",error:c}){const u=m.useId(),d=m.useId(),f=m.useId(),h=m.useRef(null),p=m.useRef(null),b=m.useRef(null),g=m.useRef(null),O=m.useRef([]),y=n.findIndex($=>$.value===t),v=t.trim().toLocaleLowerCase(),x=s&&v?n.filter($=>$.value.toLocaleLowerCase().includes(v)||$.label.toLocaleLowerCase().includes(v)):n,[w,S]=m.useState(!1),[E,k]=m.useState(Math.max(0,y)),T=y>=0?n[y]:void 0,C=i||!s&&n.length===0,N=($=!1)=>{S(!1),$&&window.requestAnimationFrame(()=>{var D,M;return s?(D=b.current)==null?void 0:D.focus():(M=p.current)==null?void 0:M.focus()})},_=$=>{C||x.length!==0&&(k(Math.min(Math.max($,0),x.length-1)),S(!0))};m.useEffect(()=>{if(!w)return;const $=g.current,D=s?void 0:window.requestAnimationFrame(()=>{var L;(L=O.current[E])==null||L.focus()}),M=L=>{if(!$)return;const U=$.scrollTop<=0,F=$.scrollTop+$.clientHeight>=$.scrollHeight-1;($.scrollHeight<=$.clientHeight||L.deltaY<0&&U||L.deltaY>0&&F)&&L.preventDefault(),L.stopPropagation()},j=L=>{var U;L.target instanceof Node&&!((U=h.current)!=null&&U.contains(L.target))&&N()},P=L=>{L.key==="Escape"&&N(!0)};return $==null||$.addEventListener("wheel",M,{passive:!1}),window.addEventListener("pointerdown",j),window.addEventListener("keydown",P),()=>{D!==void 0&&window.cancelAnimationFrame(D),$==null||$.removeEventListener("wheel",M),window.removeEventListener("pointerdown",j),window.removeEventListener("keydown",P)}},[E,s,w]);const R=$=>{var M;if(x.length===0)return;const D=($+x.length)%x.length;k(D),(M=O.current[D])==null||M.focus()};return o.jsxs("div",{ref:h,className:`skill-config-select${w?" is-open":""}`,onBlur:$=>{var D;(!$.relatedTarget||!((D=h.current)!=null&&D.contains($.relatedTarget)))&&N()},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:b,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:$=>{r($.target.value),k(0),n.length>0&&S(!0)},onClick:()=>{!w&&x.length>0&&_(0)},onKeyDown:$=>{var D,M;if(!($.nativeEvent.isComposing||$.keyCode===229))if($.key==="ArrowDown")$.preventDefault(),w?(D=O.current[E])==null||D.focus():_(0);else if($.key==="ArrowUp")$.preventDefault(),w?(M=O.current[x.length-1])==null||M.focus():_(x.length-1);else if($.key==="Enter"&&w){$.preventDefault();const j=x[E];j&&r(j.value),N()}else $.key==="Escape"&&($.preventDefault(),N())}}),o.jsx("button",{type:"button",className:"skill-config-select__toggle",disabled:i||n.length===0,"aria-label":w?"收起模型选项":"展开模型选项",onClick:()=>{w?N():_(0)},children:o.jsx(iH,{})})]}):o.jsxs("button",{ref:p,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?N():_(y>=0?y:0)},onKeyDown:$=>{$.key==="ArrowDown"?($.preventDefault(),_(y>=0?y:0)):$.key==="ArrowUp"&&($.preventDefault(),_(y>=0?y:n.length-1))},children:[o.jsx("span",{className:T?void 0:"is-placeholder",title:T==null?void 0:T.label,children:(T==null?void 0:T.label)||(n.length===0?"暂无可用选项":l)}),o.jsx(iH,{})]}),w?o.jsxs("div",{ref:g,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(($,D)=>{const M=$.value===t;return o.jsx("button",{ref:j=>{O.current[D]=j},type:"button",role:"option","aria-selected":M,tabIndex:D===E?0:-1,className:`skill-config-select__option${M?" is-selected":""}`,title:$.label,onFocus:()=>k(D),onClick:()=>{r($.value),N(!0)},onKeyDown:j=>{j.key==="Enter"||j.key===" "?(j.preventDefault(),r($.value),N(!0)):j.key==="ArrowDown"?(j.preventDefault(),R(D+1)):j.key==="ArrowUp"?(j.preventDefault(),R(D-1)):j.key==="Home"?(j.preventDefault(),R(0)):j.key==="End"&&(j.preventDefault(),R(n.length-1))},children:$.label},$.value)})]}):null,c?o.jsx("span",{id:f,className:"skill-config-select__error",role:"alert",children:c}):null]})}function Us(e,t){return e instanceof Error?e:typeof e=="string"&&e.trim()?new Error(e.trim()):new Error(t)}function Go({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 c8=Symbol.for("yaml.alias"),IM=Symbol.for("yaml.document"),wh=Symbol.for("yaml.map"),nfe=Symbol.for("yaml.pair"),Cu=Symbol.for("yaml.scalar"),IO=Symbol.for("yaml.seq"),ql=Symbol.for("yaml.node.type"),DO=e=>!!e&&typeof e=="object"&&e[ql]===c8,Sw=e=>!!e&&typeof e=="object"&&e[ql]===IM,Ew=e=>!!e&&typeof e=="object"&&e[ql]===wh,us=e=>!!e&&typeof e=="object"&&e[ql]===nfe,fi=e=>!!e&&typeof e=="object"&&e[ql]===Cu,kw=e=>!!e&&typeof e=="object"&&e[ql]===IO;function os(e){if(e&&typeof e=="object")switch(e[ql]){case wh:case IO:return!0}return!1}function cs(e){if(e&&typeof e=="object")switch(e[ql]){case c8:case wh:case Cu:case IO:return!0}return!1}const rfe=e=>(fi(e)||os(e))&&!!e.anchor,Dp=Symbol("break visit"),Net=Symbol("skip children"),G1=Symbol("remove node");function PO(e,t){const n=jet(t);Sw(e)?S0(null,e.contents,n,Object.freeze([e]))===G1&&(e.contents=null):S0(null,e,n,Object.freeze([]))}PO.BREAK=Dp;PO.SKIP=Net;PO.REMOVE=G1;function S0(e,t,n,r){const i=Ret(e,t,n,r);if(cs(i)||us(i))return Iet(e,r,i),S0(e,i,n,r);if(typeof i!="symbol"){if(os(t)){r=Object.freeze(r.concat(t));for(let s=0;se.replace(/[!,[\]{}]/g,t=>Det[t]);class Qa{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Qa.defaultYaml,t),this.tags=Object.assign({},Qa.defaultTags,n)}clone(){const t=new Qa(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new Qa(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:Qa.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},Qa.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:Qa.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},Qa.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+Pet(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&&cs(t.contents)){const s={};PO(t.contents,(a,l)=>{cs(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(` -`)}}Qa.defaultYaml={explicit:!1,version:"1.2"};Qa.defaultTags={"!!":"tag:yaml.org,2002:"};function ife(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 sfe(e){const t=new Set;return PO(e,{Value(n,r){r.anchor&&t.add(r.anchor)}}),t}function afe(e,t){for(let n=1;;++n){const r=`${e}${n}`;if(!t.has(r))return r}}function Met(e,t){const n=[],r=new Map;let i=null;return{onAnchor:s=>{n.push(s),i??(i=sfe(e));const a=afe(t,i);return i.add(a),a},setAnchors:()=>{for(const s of n){const a=r.get(s);if(typeof a=="object"&&a.anchor&&(fi(a.node)||os(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 E0(e,t,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,s=r.length;iUl(r,String(i),n));if(e&&typeof e.toJSON=="function"){if(!n||!rfe(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 u8{constructor(t){Object.defineProperty(this,ql,{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(!Sw(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=Ul(this,"",a);if(typeof i=="function")for(const{count:c,res:u}of a.anchors.values())i(u,c);return typeof s=="function"?E0(s,{"":l},"",l):l}}let d8=class extends u8{constructor(t){super(c8),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)=>{(DO(a)||rfe(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||(Ul(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=Xk(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(ife(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 Xk(e,t,n){if(DO(t)){const r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(os(t)){let r=0;for(const i of t.items){const s=Xk(e,i,n);s>r&&(r=s)}return r}else if(us(t)){const r=Xk(e,t.key,n),i=Xk(e,t.value,n);return Math.max(r,i)}return 1}const ofe=e=>!e||typeof e!="function"&&typeof e!="object";class wn extends u8{constructor(t){super(Cu),this.value=t}toJSON(t,n){return n!=null&&n.keep?this.value:Ul(this.value,t,n)}toString(){return String(this.value)}}wn.BLOCK_FOLDED="BLOCK_FOLDED";wn.BLOCK_LITERAL="BLOCK_LITERAL";wn.PLAIN="PLAIN";wn.QUOTE_DOUBLE="QUOTE_DOUBLE";wn.QUOTE_SINGLE="QUOTE_SINGLE";const Let="tag:yaml.org,2002:";function $et(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 rv(e,t,n){var f,h,p;if(Sw(e)&&(e=e.contents),cs(e))return e;if(us(e)){const b=(h=(f=n.schema[wh]).createNode)==null?void 0:h.call(f,n.schema,null,n);return b.items.push(e),b}(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 d8(c.anchor);c={anchor:null,node:null},l.set(e,c)}t!=null&&t.startsWith("!!")&&(t=Let+t.slice(2));let u=$et(e,t,a.tags);if(!u){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const b=new wn(e);return c&&(c.node=b),b}u=e instanceof Map?a[wh]:Symbol.iterator in Object(e)?a[IO]:a[wh]}s&&(s(u),delete n.onTagObj);const d=u!=null&&u.createNode?u.createNode(n.schema,e,n):typeof((p=u==null?void 0:u.nodeClass)==null?void 0:p.from)=="function"?u.nodeClass.from(n.schema,e,n):new wn(e);return t?d.tag=t:u.default||(d.tag=u.tag),c&&(c.node=d),d}function U2(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 rv(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 o1=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done;class lfe extends u8{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=>cs(r)||us(r)?r.clone(t):r),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(o1(t))this.add(n);else{const[r,...i]=t,s=this.get(r,!0);if(os(s))s.addIn(i,n);else if(s===void 0&&this.schema)this.set(r,U2(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(os(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&&fi(s)?s.value:s:os(s)?s.getIn(i,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!us(n))return!1;const r=n.value;return r==null||t&&fi(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 os(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(os(s))s.setIn(i,n);else if(s===void 0&&this.schema)this.set(r,U2(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}}const Bet=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Td(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const Yp=(e,t,n)=>e.endsWith(` +`)})]}):null]})}const d8=Symbol.for("yaml.alias"),PM=Symbol.for("yaml.document"),wh=Symbol.for("yaml.map"),ife=Symbol.for("yaml.pair"),Cu=Symbol.for("yaml.scalar"),DO=Symbol.for("yaml.seq"),ql=Symbol.for("yaml.node.type"),PO=e=>!!e&&typeof e=="object"&&e[ql]===d8,Ew=e=>!!e&&typeof e=="object"&&e[ql]===PM,kw=e=>!!e&&typeof e=="object"&&e[ql]===wh,us=e=>!!e&&typeof e=="object"&&e[ql]===ife,fi=e=>!!e&&typeof e=="object"&&e[ql]===Cu,Tw=e=>!!e&&typeof e=="object"&&e[ql]===DO;function os(e){if(e&&typeof e=="object")switch(e[ql]){case wh:case DO:return!0}return!1}function cs(e){if(e&&typeof e=="object")switch(e[ql]){case d8:case wh:case Cu:case DO:return!0}return!1}const sfe=e=>(fi(e)||os(e))&&!!e.anchor,Pp=Symbol("break visit"),Ret=Symbol("skip children"),Y1=Symbol("remove node");function MO(e,t){const n=Iet(t);Ew(e)?E0(null,e.contents,n,Object.freeze([e]))===Y1&&(e.contents=null):E0(null,e,n,Object.freeze([]))}MO.BREAK=Pp;MO.SKIP=Ret;MO.REMOVE=Y1;function E0(e,t,n,r){const i=Det(e,t,n,r);if(cs(i)||us(i))return Pet(e,r,i),E0(e,i,n,r);if(typeof i!="symbol"){if(os(t)){r=Object.freeze(r.concat(t));for(let s=0;se.replace(/[!,[\]{}]/g,t=>Met[t]);class Qa{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Qa.defaultYaml,t),this.tags=Object.assign({},Qa.defaultTags,n)}clone(){const t=new Qa(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new Qa(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:Qa.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},Qa.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:Qa.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},Qa.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+Let(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&&cs(t.contents)){const s={};MO(t.contents,(a,l)=>{cs(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(` +`)}}Qa.defaultYaml={explicit:!1,version:"1.2"};Qa.defaultTags={"!!":"tag:yaml.org,2002:"};function afe(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 ofe(e){const t=new Set;return MO(e,{Value(n,r){r.anchor&&t.add(r.anchor)}}),t}function lfe(e,t){for(let n=1;;++n){const r=`${e}${n}`;if(!t.has(r))return r}}function $et(e,t){const n=[],r=new Map;let i=null;return{onAnchor:s=>{n.push(s),i??(i=ofe(e));const a=lfe(t,i);return i.add(a),a},setAnchors:()=>{for(const s of n){const a=r.get(s);if(typeof a=="object"&&a.anchor&&(fi(a.node)||os(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 k0(e,t,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,s=r.length;iUl(r,String(i),n));if(e&&typeof e.toJSON=="function"){if(!n||!sfe(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 f8{constructor(t){Object.defineProperty(this,ql,{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(!Ew(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=Ul(this,"",a);if(typeof i=="function")for(const{count:c,res:u}of a.anchors.values())i(u,c);return typeof s=="function"?k0(s,{"":l},"",l):l}}let h8=class extends f8{constructor(t){super(d8),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=[],MO(t,{Node:(s,a)=>{(PO(a)||sfe(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||(Ul(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=Yk(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(afe(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 Yk(e,t,n){if(PO(t)){const r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(os(t)){let r=0;for(const i of t.items){const s=Yk(e,i,n);s>r&&(r=s)}return r}else if(us(t)){const r=Yk(e,t.key,n),i=Yk(e,t.value,n);return Math.max(r,i)}return 1}const cfe=e=>!e||typeof e!="function"&&typeof e!="object";class wn extends f8{constructor(t){super(Cu),this.value=t}toJSON(t,n){return n!=null&&n.keep?this.value:Ul(this.value,t,n)}toString(){return String(this.value)}}wn.BLOCK_FOLDED="BLOCK_FOLDED";wn.BLOCK_LITERAL="BLOCK_LITERAL";wn.PLAIN="PLAIN";wn.QUOTE_DOUBLE="QUOTE_DOUBLE";wn.QUOTE_SINGLE="QUOTE_SINGLE";const Bet="tag:yaml.org,2002:";function Qet(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 iv(e,t,n){var f,h,p;if(Ew(e)&&(e=e.contents),cs(e))return e;if(us(e)){const b=(h=(f=n.schema[wh]).createNode)==null?void 0:h.call(f,n.schema,null,n);return b.items.push(e),b}(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 h8(c.anchor);c={anchor:null,node:null},l.set(e,c)}t!=null&&t.startsWith("!!")&&(t=Bet+t.slice(2));let u=Qet(e,t,a.tags);if(!u){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const b=new wn(e);return c&&(c.node=b),b}u=e instanceof Map?a[wh]:Symbol.iterator in Object(e)?a[DO]:a[wh]}s&&(s(u),delete n.onTagObj);const d=u!=null&&u.createNode?u.createNode(n.schema,e,n):typeof((p=u==null?void 0:u.nodeClass)==null?void 0:p.from)=="function"?u.nodeClass.from(n.schema,e,n):new wn(e);return t?d.tag=t:u.default||(d.tag=u.tag),c&&(c.node=d),d}function V2(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 iv(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 l1=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done;class ufe extends f8{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=>cs(r)||us(r)?r.clone(t):r),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(l1(t))this.add(n);else{const[r,...i]=t,s=this.get(r,!0);if(os(s))s.addIn(i,n);else if(s===void 0&&this.schema)this.set(r,V2(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(os(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&&fi(s)?s.value:s:os(s)?s.getIn(i,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!us(n))return!1;const r=n.value;return r==null||t&&fi(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 os(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(os(s))s.setIn(i,n);else if(s===void 0&&this.schema)this.set(r,V2(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}}const Fet=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Td(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const Wp=(e,t,n)=>e.endsWith(` `)?Td(n,t):n.includes(` `)?` -`+Td(n,t):(e.endsWith(" ")?"":" ")+n,cfe="flow",DM="block",Gk="quoted";function bC(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,p,b=!1,g=-1,O=-1,y=-1;n===DM&&(g=rH(e,g,t.length),g!==-1&&(f=g+c));for(let x;x=e[g+=1];){if(n===Gk&&x==="\\"){switch(O=g,e[g+1]){case"x":g+=3;break;case"u":g+=5;break;case"U":g+=9;break;default:g+=1}y=g}if(x===` -`)n===DM&&(g=rH(e,g,t.length)),f=g+t.length+c,h=void 0;else{if(x===" "&&p&&p!==" "&&p!==` +`+Td(n,t):(e.endsWith(" ")?"":" ")+n,dfe="flow",MM="block",Wk="quoted";function yC(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,p,b=!1,g=-1,O=-1,y=-1;n===MM&&(g=sH(e,g,t.length),g!==-1&&(f=g+c));for(let x;x=e[g+=1];){if(n===Wk&&x==="\\"){switch(O=g,e[g+1]){case"x":g+=3;break;case"u":g+=5;break;case"U":g+=9;break;default:g+=1}y=g}if(x===` +`)n===MM&&(g=sH(e,g,t.length)),f=g+t.length+c,h=void 0;else{if(x===" "&&p&&p!==" "&&p!==` `&&p!==" "){const w=e[g+1];w&&w!==" "&&w!==` -`&&w!==" "&&(h=g)}if(g>=f)if(h)u.push(h),f=h+c,h=void 0;else if(n===Gk){for(;p===" "||p===" ";)p=x,x=e[g+=1],b=!0;const w=g>y+1?g-2:O-1;if(d[w])return e;u.push(w),d[w]=!0,f=w+c,h=void 0}else b=!0}p=x}if(b&&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}),yC=e=>/^(%|---|\.\.\.)/m.test(e);function Qet(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 Y1(e,t){const n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;const{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,s=t.indent||(yC(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=f)if(h)u.push(h),f=h+c,h=void 0;else if(n===Wk){for(;p===" "||p===" ";)p=x,x=e[g+=1],b=!0;const w=g>y+1?g-2:O-1;if(d[w])return e;u.push(w),d[w]=!0,f=w+c,h=void 0}else b=!0}p=x}if(b&&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}),vC=e=>/^(%|---|\.\.\.)/m.test(e);function Uet(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 W1(e,t){const n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;const{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,s=t.indent||(vC(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 p=n.substring(h);const b=p.indexOf(` `);b===-1?f="-":n===p||b!==p.length-1?(f="+",s&&s()):f="",p&&(n=n.slice(0,-p.length),p[p.length-1]===` -`&&(p=p.slice(0,-1)),p=p.replace(MM,`$&${u}`));let g=!1,O,y=-1;for(O=0;O{E=!0});const T=bC(`${v}${S}${p}`,u,DM,k);if(!E)return`>${w} +$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${u}`);let E=!1;const k=xC(r,!0);a!=="folded"&&t!==wn.BLOCK_FOLDED&&(k.onOverflow=()=>{E=!0});const T=yC(`${v}${S}${p}`,u,MM,k);if(!E)return`>${w} ${u}${T}`}return n=n.replace(/\n+/g,`$&${u}`),`|${w} -${u}${v}${n}${p}`}function Fet(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 k0(s,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return l||d||!s.includes(` -`)?k0(s,t):Yk(e,t,n,r);if(!l&&!d&&i!==wn.PLAIN&&s.includes(` -`))return Yk(e,t,n,r);if(yC(s)){if(c==="")return t.forceBlockIndent=!0,Yk(e,t,n,r);if(l&&c===u)return k0(s,t)}const f=s.replace(/\n+/g,`$& -${c}`);if(a){const h=g=>{var O;return g.default&&g.tag!=="tag:yaml.org,2002:str"&&((O=g.test)==null?void 0:O.test(f))},{compat:p,tags:b}=t.doc.schema;if(b.some(h)||p!=null&&p.some(h))return k0(s,t)}return l?f:bC(f,c,cfe,OC(t,!1))}function f8(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!==wn.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(l=wn.QUOTE_DOUBLE);const c=d=>{switch(d){case wn.BLOCK_FOLDED:case wn.BLOCK_LITERAL:return i||s?k0(a.value,t):Yk(a,t,n,r);case wn.QUOTE_DOUBLE:return Y1(a.value,t);case wn.QUOTE_SINGLE:return PM(a.value,t);case wn.PLAIN:return Fet(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 ufe(e,t){const n=Object.assign({blockQuote:!0,commentString:Bet,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 Uet(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(fi(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 zet(e,t,{anchors:n,doc:r}){if(!r.directives)return"";const i=[],s=(fi(e)||os(e))&&e.anchor;s&&ife(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 Qb(e,t,n,r){var c;if(us(e))return e.toString(t,n,r);if(DO(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=cs(e)?e:t.doc.createNode(e,{onTagObj:u=>i=u});i??(i=Uet(t.doc.schema.tags,s));const a=zet(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):fi(s)?f8(s,t,n,r):s.toString(t,n,r);return a?fi(s)||l[0]==="{"||l[0]==="["?`${a} ${l}`:`${a} -${t.indent}${l}`:l}function Vet({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=cs(e)&&e.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(os(e)||!cs(e)&&typeof e=="object"){const k="With simple keys, collection cannot be used as a key value";throw new Error(k)}}let p=!f&&(!e||h&&t==null&&!n.inFlow||os(e)||(fi(e)?e.type===wn.BLOCK_FOLDED||e.type===wn.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(f||!s),indent:l+c});let b=!1,g=!1,O=Qb(e,n,()=>b=!0,()=>g=!0);if(!p&&!n.inFlow&&O.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(n.inFlow){if(s||t==null)return b&&r&&r(),O===""?"?":p?`? ${O}`:O}else if(s&&!f||t==null&&p)return O=`? ${O}`,h&&!b?O+=Yp(O,n.indent,u(h)):g&&i&&i(),O;b&&(h=null),p?(h&&(O+=Yp(O,n.indent,u(h))),O=`? ${O} -${l}:`):(O=`${O}:`,h&&(O+=Yp(O,n.indent,u(h))));let y,v,x;cs(t)?(y=!!t.spaceBefore,v=t.commentBefore,x=t.comment):(y=!1,v=null,x=null,t&&typeof t=="object"&&(t=a.createNode(t))),n.implicitKey=!1,!p&&!h&&fi(t)&&(n.indentAtStart=O.length+1),g=!1,!d&&c.length>=2&&!n.inFlow&&!p&&kw(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let w=!1;const S=Qb(t,n,()=>w=!0,()=>g=!0);let E=" ";if(h||y||v){if(E=y?` +${u}${v}${n}${p}`}function zet(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 T0(s,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return l||d||!s.includes(` +`)?T0(s,t):Zk(e,t,n,r);if(!l&&!d&&i!==wn.PLAIN&&s.includes(` +`))return Zk(e,t,n,r);if(vC(s)){if(c==="")return t.forceBlockIndent=!0,Zk(e,t,n,r);if(l&&c===u)return T0(s,t)}const f=s.replace(/\n+/g,`$& +${c}`);if(a){const h=g=>{var O;return g.default&&g.tag!=="tag:yaml.org,2002:str"&&((O=g.test)==null?void 0:O.test(f))},{compat:p,tags:b}=t.doc.schema;if(b.some(h)||p!=null&&p.some(h))return T0(s,t)}return l?f:yC(f,c,dfe,xC(t,!1))}function p8(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!==wn.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(l=wn.QUOTE_DOUBLE);const c=d=>{switch(d){case wn.BLOCK_FOLDED:case wn.BLOCK_LITERAL:return i||s?T0(a.value,t):Zk(a,t,n,r);case wn.QUOTE_DOUBLE:return W1(a.value,t);case wn.QUOTE_SINGLE:return LM(a.value,t);case wn.PLAIN:return zet(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 ffe(e,t){const n=Object.assign({blockQuote:!0,commentString:Fet,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 Vet(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(fi(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 qet(e,t,{anchors:n,doc:r}){if(!r.directives)return"";const i=[],s=(fi(e)||os(e))&&e.anchor;s&&afe(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 Fb(e,t,n,r){var c;if(us(e))return e.toString(t,n,r);if(PO(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=cs(e)?e:t.doc.createNode(e,{onTagObj:u=>i=u});i??(i=Vet(t.doc.schema.tags,s));const a=qet(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):fi(s)?p8(s,t,n,r):s.toString(t,n,r);return a?fi(s)||l[0]==="{"||l[0]==="["?`${a} ${l}`:`${a} +${t.indent}${l}`:l}function Het({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=cs(e)&&e.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(os(e)||!cs(e)&&typeof e=="object"){const k="With simple keys, collection cannot be used as a key value";throw new Error(k)}}let p=!f&&(!e||h&&t==null&&!n.inFlow||os(e)||(fi(e)?e.type===wn.BLOCK_FOLDED||e.type===wn.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(f||!s),indent:l+c});let b=!1,g=!1,O=Fb(e,n,()=>b=!0,()=>g=!0);if(!p&&!n.inFlow&&O.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(n.inFlow){if(s||t==null)return b&&r&&r(),O===""?"?":p?`? ${O}`:O}else if(s&&!f||t==null&&p)return O=`? ${O}`,h&&!b?O+=Wp(O,n.indent,u(h)):g&&i&&i(),O;b&&(h=null),p?(h&&(O+=Wp(O,n.indent,u(h))),O=`? ${O} +${l}:`):(O=`${O}:`,h&&(O+=Wp(O,n.indent,u(h))));let y,v,x;cs(t)?(y=!!t.spaceBefore,v=t.commentBefore,x=t.comment):(y=!1,v=null,x=null,t&&typeof t=="object"&&(t=a.createNode(t))),n.implicitKey=!1,!p&&!h&&fi(t)&&(n.indentAtStart=O.length+1),g=!1,!d&&c.length>=2&&!n.inFlow&&!p&&Tw(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let w=!1;const S=Fb(t,n,()=>w=!0,()=>g=!0);let E=" ";if(h||y||v){if(E=y?` `:"",v){const k=u(v);E+=` ${Td(k,n.indent)}`}S===""&&!n.inFlow?E===` `&&x&&(E=` @@ -574,32 +574,32 @@ ${Td(k,n.indent)}`}S===""&&!n.inFlow?E===` ${n.indent}`}else if(!p&&os(t)){const k=S[0],T=S.indexOf(` `),C=T!==-1,N=n.inFlow??t.flow??t.items.length===0;if(C||!N){let _=!1;if(C&&(k==="&"||k==="!")){let R=S.indexOf(" ");k==="&"&&R!==-1&&Re===xE||typeof e=="symbol"&&e.description===xE,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new wn(Symbol(xE)),{addToJSMap:ffe}),stringify:()=>xE},qet=(e,t)=>(Ld.identify(t)||fi(t)&&(!t.type||t.type===wn.PLAIN)&&Ld.identify(t.value))&&(e==null?void 0:e.doc.schema.tags.some(n=>n.tag===Ld.tag&&n.default));function ffe(e,t,n){const r=hfe(e,n);if(kw(r))for(const i of r.items)YR(e,t,i);else if(Array.isArray(r))for(const i of r)YR(e,t,i);else YR(e,t,r)}function YR(e,t,n){const r=hfe(e,n);if(!Ew(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 hfe(e,t){return e&&DO(t)?t.resolve(e.doc,e):t}function pfe(e,t,{key:n,value:r}){if(cs(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(qet(e,n))ffe(e,t,r);else{const i=Ul(n,"",e);if(t instanceof Map)t.set(i,Ul(r,i,e));else if(t instanceof Set)t.add(i);else{const s=Het(n,i,e),a=Ul(r,s,e);s in t?Object.defineProperty(t,s,{value:a,writable:!0,enumerable:!0,configurable:!0}):t[s]=a}}return t}function Het(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(cs(e)&&(n!=null&&n.doc)){const r=ufe(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)+'..."'),dfe(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 h8(e,t,n){const r=rv(e,void 0,n),i=rv(t,void 0,n);return new Xa(r,i)}class Xa{constructor(t,n=null){Object.defineProperty(this,ql,{value:nfe}),this.key=t,this.value=n}clone(t){let{key:n,value:r}=this;return cs(n)&&(n=n.clone(t)),cs(r)&&(r=r.clone(t)),new Xa(n,r)}toJSON(t,n){const r=n!=null&&n.mapAsMap?new Map:{};return pfe(n,r,this)}toString(t,n,r){return t!=null&&t.doc?Vet(this,t,n,r):JSON.stringify(this)}}function mfe(e,t,n){return(t.inFlow??e.flow?Get:Xet)(e,t,n)}function Xet({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 b=0;bO=null,()=>f=!0);O&&(y+=Yp(y,s,u(O))),f&&O&&(f=!1),h.push(r+y)}let p;if(h.length===0)p=i.start+i.end;else{p=h[0];for(let b=1;be===xE||typeof e=="symbol"&&e.description===xE,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new wn(Symbol(xE)),{addToJSMap:pfe}),stringify:()=>xE},Xet=(e,t)=>(Ld.identify(t)||fi(t)&&(!t.type||t.type===wn.PLAIN)&&Ld.identify(t.value))&&(e==null?void 0:e.doc.schema.tags.some(n=>n.tag===Ld.tag&&n.default));function pfe(e,t,n){const r=mfe(e,n);if(Tw(r))for(const i of r.items)ZR(e,t,i);else if(Array.isArray(r))for(const i of r)ZR(e,t,i);else ZR(e,t,r)}function ZR(e,t,n){const r=mfe(e,n);if(!kw(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 mfe(e,t){return e&&PO(t)?t.resolve(e.doc,e):t}function gfe(e,t,{key:n,value:r}){if(cs(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(Xet(e,n))pfe(e,t,r);else{const i=Ul(n,"",e);if(t instanceof Map)t.set(i,Ul(r,i,e));else if(t instanceof Set)t.add(i);else{const s=Get(n,i,e),a=Ul(r,s,e);s in t?Object.defineProperty(t,s,{value:a,writable:!0,enumerable:!0,configurable:!0}):t[s]=a}}return t}function Get(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(cs(e)&&(n!=null&&n.doc)){const r=ffe(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)+'..."'),hfe(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 m8(e,t,n){const r=iv(e,void 0,n),i=iv(t,void 0,n);return new Xa(r,i)}class Xa{constructor(t,n=null){Object.defineProperty(this,ql,{value:ife}),this.key=t,this.value=n}clone(t){let{key:n,value:r}=this;return cs(n)&&(n=n.clone(t)),cs(r)&&(r=r.clone(t)),new Xa(n,r)}toJSON(t,n){const r=n!=null&&n.mapAsMap?new Map:{};return gfe(n,r,this)}toString(t,n,r){return t!=null&&t.doc?Het(this,t,n,r):JSON.stringify(this)}}function bfe(e,t,n){return(t.inFlow??e.flow?Wet:Yet)(e,t,n)}function Yet({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 b=0;bO=null,()=>f=!0);O&&(y+=Wp(y,s,u(O))),f&&O&&(f=!1),h.push(r+y)}let p;if(h.length===0)p=i.start+i.end;else{p=h[0];for(let b=1;bO=null);u||(u=f.length>d||y.includes(` -`)),b0&&(u||(u=f.reduce((v,x)=>v+x.length+2,2)+(y.length+2)>t.options.lineWidth)),u&&(y+=",")),O&&(y+=Yp(y,r,l(O))),f.push(y),d=f.length}const{start:h,end:p}=n;if(f.length===0)return h+p;if(!u){const b=f.reduce((g,O)=>g+O.length+2,2);u=t.options.lineWidth>0&&b>t.options.lineWidth}if(u){let b=h;for(const g of f)b+=g?` +`+Td(u(e),c),l&&l()):f&&a&&a(),p}function Wet({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 b=0;bO=null);u||(u=f.length>d||y.includes(` +`)),b0&&(u||(u=f.reduce((v,x)=>v+x.length+2,2)+(y.length+2)>t.options.lineWidth)),u&&(y+=",")),O&&(y+=Wp(y,r,l(O))),f.push(y),d=f.length}const{start:h,end:p}=n;if(f.length===0)return h+p;if(!u){const b=f.reduce((g,O)=>g+O.length+2,2);u=t.options.lineWidth>0&&b>t.options.lineWidth}if(u){let b=h;for(const g of f)b+=g?` ${s}${i}${g}`:` `;return`${b} -${i}${p}`}else return`${h}${a}${f.join(" ")}${a}${p}`}function z2({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){const s=Td(t(r),e);n.push(s.trimStart())}}function Wp(e,t){const n=fi(t)?t.value:t;for(const r of e)if(us(r)&&(r.key===t||r.key===n||fi(r.key)&&r.key.value===n))return r}class Rl extends lfe{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(wh,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(h8(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;us(t)?r=t:!t||typeof t!="object"||!("key"in t)?r=new Xa(t,t==null?void 0:t.value):r=new Xa(t.key,t.value);const i=Wp(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`);fi(i.value)&&ofe(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=Wp(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){const r=Wp(this.items,t),i=r==null?void 0:r.value;return(!n&&fi(i)?i.value:i)??void 0}has(t){return!!Wp(this.items,t)}set(t,n){this.add(new Xa(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)pfe(n,i,s);return i}toString(t,n,r){if(!t)return JSON.stringify(this);for(const i of this.items)if(!us(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})),mfe(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:r,onComment:n})}}const MO={collection:"map",default:!0,nodeClass:Rl,tag:"tag:yaml.org,2002:map",resolve(e,t){return Ew(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>Rl.from(e,t,n)};class jm extends lfe{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(IO,t),this.items=[]}add(t){this.items.push(t)}delete(t){const n=vE(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){const r=vE(t);if(typeof r!="number")return;const i=this.items[r];return!n&&fi(i)?i.value:i}has(t){const n=vE(t);return typeof n=="number"&&n=0?t:null}const LO={collection:"seq",default:!0,nodeClass:jm,tag:"tag:yaml.org,2002:seq",resolve(e,t){return kw(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>jm.from(e,t,n)},xC={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),f8(e,t,n,r)}},vC={identify:e=>e==null,createNode:()=>new wn(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new wn(null),stringify:({source:e},t)=>typeof e=="string"&&vC.test.test(e)?e:t.options.nullStr},p8={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new wn(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&p8.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 Dc({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 gfe={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:Dc},bfe={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():Dc(e)}},Ofe={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 wn(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:Dc},wC=e=>typeof e=="bigint"||Number.isInteger(e),m8=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function yfe(e,t,n){const{value:r}=e;return wC(r)&&r>=0?n+r.toString(t):Dc(e)}const xfe={identify:e=>wC(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>m8(e,2,8,n),stringify:e=>yfe(e,8,"0o")},vfe={identify:wC,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>m8(e,0,10,n),stringify:Dc},wfe={identify:e=>wC(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>m8(e,2,16,n),stringify:e=>yfe(e,16,"0x")},Yet=[MO,LO,xC,vC,p8,xfe,vfe,wfe,gfe,bfe,Ofe];function iH(e){return typeof e=="bigint"||Number.isInteger(e)}const wE=({value:e})=>JSON.stringify(e),Wet=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:wE},{identify:e=>e==null,createNode:()=>new wn(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:wE},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:wE},{identify:iH,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})=>iH(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:wE}],Zet={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},Ket=[MO,LO].concat(Wet,Zet),g8={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 Xa(new wn(null));if(r.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${r.commentBefore} +${i}${p}`}else return`${h}${a}${f.join(" ")}${a}${p}`}function q2({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){const s=Td(t(r),e);n.push(s.trimStart())}}function Zp(e,t){const n=fi(t)?t.value:t;for(const r of e)if(us(r)&&(r.key===t||r.key===n||fi(r.key)&&r.key.value===n))return r}class Rl extends ufe{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(wh,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(m8(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;us(t)?r=t:!t||typeof t!="object"||!("key"in t)?r=new Xa(t,t==null?void 0:t.value):r=new Xa(t.key,t.value);const i=Zp(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`);fi(i.value)&&cfe(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=Zp(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){const r=Zp(this.items,t),i=r==null?void 0:r.value;return(!n&&fi(i)?i.value:i)??void 0}has(t){return!!Zp(this.items,t)}set(t,n){this.add(new Xa(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)gfe(n,i,s);return i}toString(t,n,r){if(!t)return JSON.stringify(this);for(const i of this.items)if(!us(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})),bfe(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:r,onComment:n})}}const LO={collection:"map",default:!0,nodeClass:Rl,tag:"tag:yaml.org,2002:map",resolve(e,t){return kw(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>Rl.from(e,t,n)};class Rm extends ufe{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(DO,t),this.items=[]}add(t){this.items.push(t)}delete(t){const n=vE(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){const r=vE(t);if(typeof r!="number")return;const i=this.items[r];return!n&&fi(i)?i.value:i}has(t){const n=vE(t);return typeof n=="number"&&n=0?t:null}const $O={collection:"seq",default:!0,nodeClass:Rm,tag:"tag:yaml.org,2002:seq",resolve(e,t){return Tw(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>Rm.from(e,t,n)},wC={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),p8(e,t,n,r)}},SC={identify:e=>e==null,createNode:()=>new wn(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new wn(null),stringify:({source:e},t)=>typeof e=="string"&&SC.test.test(e)?e:t.options.nullStr},g8={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new wn(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&g8.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 Dc({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 Ofe={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:Dc},yfe={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():Dc(e)}},xfe={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 wn(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:Dc},EC=e=>typeof e=="bigint"||Number.isInteger(e),b8=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function vfe(e,t,n){const{value:r}=e;return EC(r)&&r>=0?n+r.toString(t):Dc(e)}const wfe={identify:e=>EC(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>b8(e,2,8,n),stringify:e=>vfe(e,8,"0o")},Sfe={identify:EC,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>b8(e,0,10,n),stringify:Dc},Efe={identify:e=>EC(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>b8(e,2,16,n),stringify:e=>vfe(e,16,"0x")},Zet=[LO,$O,wC,SC,g8,wfe,Sfe,Efe,Ofe,yfe,xfe];function aH(e){return typeof e=="bigint"||Number.isInteger(e)}const wE=({value:e})=>JSON.stringify(e),Ket=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:wE},{identify:e=>e==null,createNode:()=>new wn(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:wE},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:wE},{identify:aH,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})=>aH(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:wE}],Jet={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},ett=[LO,$O].concat(Ket,Jet),O8={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 Xa(new wn(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]=us(r)?r:new Xa(r)}}else t("Expected a sequence for this tag");return e}function Efe(e,t,n){const{replacer:r}=n,i=new jm(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(h8(l,c,n))}return i}const b8={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Sfe,createNode:Efe};class X0 extends jm{constructor(){super(),this.add=Rl.prototype.add.bind(this),this.delete=Rl.prototype.delete.bind(this),this.get=Rl.prototype.get.bind(this),this.has=Rl.prototype.has.bind(this),this.set=Rl.prototype.set.bind(this),this.tag=X0.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(us(i)?(s=Ul(i.key,"",n),a=Ul(i.value,s,n)):s=Ul(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=Efe(t,n,r),s=new this;return s.items=i.items,s}}X0.tag="tag:yaml.org,2002:omap";const O8={collection:"seq",identify:e=>e instanceof Map,nodeClass:X0,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const n=Sfe(e,t),r=[];for(const{key:i}of n.items)fi(i)&&(r.includes(i.value)?t(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new X0,n)},createNode:(e,t,n)=>X0.from(e,t,n)};function kfe({value:e,source:t},n){return t&&(e?Tfe:_fe).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}const Tfe={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 wn(!0),stringify:kfe},_fe={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 wn(!1),stringify:kfe},Jet={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:Dc},ett={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():Dc(e)}},ttt={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 wn(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:Dc},Tw=e=>typeof e=="bigint"||Number.isInteger(e);function SC(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 y8(e,t,n){const{value:r}=e;if(Tw(r)){const i=r.toString(t);return r<0?"-"+n+i.substr(1):n+i}return Dc(e)}const ntt={identify:Tw,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>SC(e,2,2,n),stringify:e=>y8(e,2,"0b")},rtt={identify:Tw,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>SC(e,1,8,n),stringify:e=>y8(e,8,"0")},itt={identify:Tw,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>SC(e,0,10,n),stringify:Dc},stt={identify:Tw,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>SC(e,2,16,n),stringify:e=>y8(e,16,"0x")};class G0 extends Rl{constructor(t){super(t),this.tag=G0.tag}add(t){let n;us(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new Xa(t.key,null):n=new Xa(t,null),Wp(this.items,n.key)||this.items.push(n)}get(t,n){const r=Wp(this.items,t);return!n&&us(r)?fi(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=Wp(this.items,t);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new Xa(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(h8(a,null,r));return s}}G0.tag="tag:yaml.org,2002:set";const x8={collection:"map",identify:e=>e instanceof Set,nodeClass:G0,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>G0.from(e,t,n),resolve(e,t){if(Ew(e)){if(e.hasAllNullValues(!0))return Object.assign(new G0,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function v8(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 Afe(e){let{value:t}=e,n=a=>a;if(typeof t=="bigint")n=a=>BigInt(a);else if(isNaN(t)||!isFinite(t))return Dc(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 Cfe={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})=>v8(e,n),stringify:Afe},Nfe={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=>v8(e,!1),stringify:Afe},EC={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(EC.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=v8(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$/,""))??""},sH=[MO,LO,xC,vC,Tfe,_fe,ntt,rtt,itt,stt,Jet,ett,ttt,g8,Ld,O8,b8,x8,Cfe,Nfe,EC],aH=new Map([["core",Yet],["failsafe",[MO,LO,xC]],["json",Ket],["yaml11",sH],["yaml-1.1",sH]]),oH={binary:g8,bool:p8,float:Ofe,floatExp:bfe,floatNaN:gfe,floatTime:Nfe,int:vfe,intHex:wfe,intOct:xfe,intTime:Cfe,map:MO,merge:Ld,null:vC,omap:O8,pairs:b8,seq:LO,set:x8,timestamp:EC},att={"tag:yaml.org,2002:binary":g8,"tag:yaml.org,2002:merge":Ld,"tag:yaml.org,2002:omap":O8,"tag:yaml.org,2002:pairs":b8,"tag:yaml.org,2002:set":x8,"tag:yaml.org,2002:timestamp":EC};function WR(e,t,n){const r=aH.get(t);if(r&&!e)return n&&!r.includes(Ld)?r.concat(Ld):r.slice();let i=r;if(!i)if(Array.isArray(e))i=[];else{const s=Array.from(aH.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(Ld)),i.reduce((s,a)=>{const l=typeof a=="string"?oH[a]:a;if(!l){const c=JSON.stringify(a),u=Object.keys(oH).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 ott=(e,t)=>e.keyt.key?1:0;let ltt=class jfe{constructor({compat:t,customTags:n,merge:r,resolveKnownTags:i,schema:s,sortMapEntries:a,toStringDefaults:l}){this.compat=Array.isArray(t)?WR(t,"compat"):t?WR(null,t):null,this.name=typeof s=="string"&&s||"core",this.knownTags=i?att:{},this.tags=WR(n,this.name,r),this.toStringOptions=l??null,Object.defineProperty(this,wh,{value:MO}),Object.defineProperty(this,Cu,{value:xC}),Object.defineProperty(this,IO,{value:LO}),this.sortMapEntries=typeof a=="function"?a:a===!0?ott:null}clone(){const t=Object.create(jfe.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function ctt(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=ufe(e,t),{commentString:s}=i.options;if(e.commentBefore){n.length!==1&&n.unshift("");const u=s(e.commentBefore);n.unshift(Td(u,""))}let a=!1,l=null;if(e.contents){if(cs(e.contents)){if(e.contents.spaceBefore&&r&&n.push(""),e.contents.commentBefore){const f=s(e.contents.commentBefore);n.push(Td(f,""))}i.forceBlockIndent=!!e.comment,l=e.contents.comment}const u=l?void 0:()=>a=!0;let d=Qb(e.contents,i,()=>l=null,u);l&&(d+=Yp(d,"",s(l))),(d[0]==="|"||d[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${d}`:n.push(d)}else n.push(Qb(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]=us(r)?r:new Xa(r)}}else t("Expected a sequence for this tag");return e}function Tfe(e,t,n){const{replacer:r}=n,i=new Rm(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(m8(l,c,n))}return i}const y8={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:kfe,createNode:Tfe};class G0 extends Rm{constructor(){super(),this.add=Rl.prototype.add.bind(this),this.delete=Rl.prototype.delete.bind(this),this.get=Rl.prototype.get.bind(this),this.has=Rl.prototype.has.bind(this),this.set=Rl.prototype.set.bind(this),this.tag=G0.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(us(i)?(s=Ul(i.key,"",n),a=Ul(i.value,s,n)):s=Ul(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=Tfe(t,n,r),s=new this;return s.items=i.items,s}}G0.tag="tag:yaml.org,2002:omap";const x8={collection:"seq",identify:e=>e instanceof Map,nodeClass:G0,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const n=kfe(e,t),r=[];for(const{key:i}of n.items)fi(i)&&(r.includes(i.value)?t(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new G0,n)},createNode:(e,t,n)=>G0.from(e,t,n)};function _fe({value:e,source:t},n){return t&&(e?Afe:Cfe).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}const Afe={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 wn(!0),stringify:_fe},Cfe={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 wn(!1),stringify:_fe},ttt={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:Dc},ntt={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():Dc(e)}},rtt={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 wn(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:Dc},_w=e=>typeof e=="bigint"||Number.isInteger(e);function kC(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 v8(e,t,n){const{value:r}=e;if(_w(r)){const i=r.toString(t);return r<0?"-"+n+i.substr(1):n+i}return Dc(e)}const itt={identify:_w,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>kC(e,2,2,n),stringify:e=>v8(e,2,"0b")},stt={identify:_w,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>kC(e,1,8,n),stringify:e=>v8(e,8,"0")},att={identify:_w,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>kC(e,0,10,n),stringify:Dc},ott={identify:_w,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>kC(e,2,16,n),stringify:e=>v8(e,16,"0x")};class Y0 extends Rl{constructor(t){super(t),this.tag=Y0.tag}add(t){let n;us(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new Xa(t.key,null):n=new Xa(t,null),Zp(this.items,n.key)||this.items.push(n)}get(t,n){const r=Zp(this.items,t);return!n&&us(r)?fi(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=Zp(this.items,t);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new Xa(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(m8(a,null,r));return s}}Y0.tag="tag:yaml.org,2002:set";const w8={collection:"map",identify:e=>e instanceof Set,nodeClass:Y0,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>Y0.from(e,t,n),resolve(e,t){if(kw(e)){if(e.hasAllNullValues(!0))return Object.assign(new Y0,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function S8(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 Nfe(e){let{value:t}=e,n=a=>a;if(typeof t=="bigint")n=a=>BigInt(a);else if(isNaN(t)||!isFinite(t))return Dc(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 jfe={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})=>S8(e,n),stringify:Nfe},Rfe={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=>S8(e,!1),stringify:Nfe},TC={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(TC.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=S8(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$/,""))??""},oH=[LO,$O,wC,SC,Afe,Cfe,itt,stt,att,ott,ttt,ntt,rtt,O8,Ld,x8,y8,w8,jfe,Rfe,TC],lH=new Map([["core",Zet],["failsafe",[LO,$O,wC]],["json",ett],["yaml11",oH],["yaml-1.1",oH]]),cH={binary:O8,bool:g8,float:xfe,floatExp:yfe,floatNaN:Ofe,floatTime:Rfe,int:Sfe,intHex:Efe,intOct:wfe,intTime:jfe,map:LO,merge:Ld,null:SC,omap:x8,pairs:y8,seq:$O,set:w8,timestamp:TC},ltt={"tag:yaml.org,2002:binary":O8,"tag:yaml.org,2002:merge":Ld,"tag:yaml.org,2002:omap":x8,"tag:yaml.org,2002:pairs":y8,"tag:yaml.org,2002:set":w8,"tag:yaml.org,2002:timestamp":TC};function KR(e,t,n){const r=lH.get(t);if(r&&!e)return n&&!r.includes(Ld)?r.concat(Ld):r.slice();let i=r;if(!i)if(Array.isArray(e))i=[];else{const s=Array.from(lH.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(Ld)),i.reduce((s,a)=>{const l=typeof a=="string"?cH[a]:a;if(!l){const c=JSON.stringify(a),u=Object.keys(cH).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 ctt=(e,t)=>e.keyt.key?1:0;let utt=class Ife{constructor({compat:t,customTags:n,merge:r,resolveKnownTags:i,schema:s,sortMapEntries:a,toStringDefaults:l}){this.compat=Array.isArray(t)?KR(t,"compat"):t?KR(null,t):null,this.name=typeof s=="string"&&s||"core",this.knownTags=i?ltt:{},this.tags=KR(n,this.name,r),this.toStringOptions=l??null,Object.defineProperty(this,wh,{value:LO}),Object.defineProperty(this,Cu,{value:wC}),Object.defineProperty(this,DO,{value:$O}),this.sortMapEntries=typeof a=="function"?a:a===!0?ctt:null}clone(){const t=Object.create(Ife.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function dtt(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=ffe(e,t),{commentString:s}=i.options;if(e.commentBefore){n.length!==1&&n.unshift("");const u=s(e.commentBefore);n.unshift(Td(u,""))}let a=!1,l=null;if(e.contents){if(cs(e.contents)){if(e.contents.spaceBefore&&r&&n.push(""),e.contents.commentBefore){const f=s(e.contents.commentBefore);n.push(Td(f,""))}i.forceBlockIndent=!!e.comment,l=e.contents.comment}const u=l?void 0:()=>a=!0;let d=Fb(e.contents,i,()=>l=null,u);l&&(d+=Wp(d,"",s(l))),(d[0]==="|"||d[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${d}`:n.push(d)}else n.push(Fb(e.contents,i));if((c=e.directives)!=null&&c.docEnd)if(e.comment){const u=s(e.comment);u.includes(` `)?(n.push("..."),n.push(Td(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(Td(s(u),"")))}return n.join(` `)+` -`}class _w{constructor(t,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ql,{value:IM});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 Qa({version:a}),this.setSchema(a,r),this.contents=t===void 0?null:this.createNode(t,i,r)}clone(){const t=Object.create(_w.prototype,{[ql]:{value:IM}});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=cs(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){jg(this.contents)&&this.contents.add(t)}addIn(t,n){jg(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){const r=sfe(this);t.anchor=!n||r.has(n)?afe(n||"a",r):n}return new d8(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 O=v=>typeof v=="number"||v instanceof String||v instanceof Number,y=n.filter(O).map(String);y.length>0&&(n=n.concat(y)),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:p}=Met(this,a||"a"),b={aliasDuplicateObjects:s??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:u,replacer:i,schema:this.schema,sourceObjects:p},g=rv(t,d,b);return l&&os(g)&&(g.flow=!0),h(),g}createPair(t,n,r={}){const i=this.createNode(t,null,r),s=this.createNode(n,null,r);return new Xa(i,s)}delete(t){return jg(this.contents)?this.contents.delete(t):!1}deleteIn(t){return o1(t)?this.contents==null?!1:(this.contents=null,!0):jg(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return os(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return o1(t)?!n&&fi(this.contents)?this.contents.value:this.contents:os(this.contents)?this.contents.getIn(t,n):void 0}has(t){return os(this.contents)?this.contents.has(t):!1}hasIn(t){return o1(t)?this.contents!==void 0:os(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=U2(this.schema,[t],n):jg(this.contents)&&this.contents.set(t,n)}setIn(t,n){o1(t)?this.contents=n:this.contents==null?this.contents=U2(this.schema,Array.from(t),n):jg(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 Qa({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 Qa({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 ltt(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=Ul(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"?E0(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 ctt(this,t)}}function jg(e){if(os(e))return!0;throw new Error("Expected a YAML collection as document contents")}class Rfe extends Error{constructor(t,n,r,i){super(),this.name=t,this.code=r,this.message=i,this.pos=n}}class l1 extends Rfe{constructor(t,n,r){super("YAMLParseError",t,n,r)}}class utt extends Rfe{constructor(t,n,r){super("YAMLWarning",t,n,r)}}const lH=(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 Aw{constructor(t,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ql,{value:PM});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 Qa({version:a}),this.setSchema(a,r),this.contents=t===void 0?null:this.createNode(t,i,r)}clone(){const t=Object.create(Aw.prototype,{[ql]:{value:PM}});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=cs(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){Rg(this.contents)&&this.contents.add(t)}addIn(t,n){Rg(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){const r=ofe(this);t.anchor=!n||r.has(n)?lfe(n||"a",r):n}return new h8(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 O=v=>typeof v=="number"||v instanceof String||v instanceof Number,y=n.filter(O).map(String);y.length>0&&(n=n.concat(y)),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:p}=$et(this,a||"a"),b={aliasDuplicateObjects:s??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:u,replacer:i,schema:this.schema,sourceObjects:p},g=iv(t,d,b);return l&&os(g)&&(g.flow=!0),h(),g}createPair(t,n,r={}){const i=this.createNode(t,null,r),s=this.createNode(n,null,r);return new Xa(i,s)}delete(t){return Rg(this.contents)?this.contents.delete(t):!1}deleteIn(t){return l1(t)?this.contents==null?!1:(this.contents=null,!0):Rg(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return os(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return l1(t)?!n&&fi(this.contents)?this.contents.value:this.contents:os(this.contents)?this.contents.getIn(t,n):void 0}has(t){return os(this.contents)?this.contents.has(t):!1}hasIn(t){return l1(t)?this.contents!==void 0:os(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=V2(this.schema,[t],n):Rg(this.contents)&&this.contents.set(t,n)}setIn(t,n){l1(t)?this.contents=n:this.contents==null?this.contents=V2(this.schema,Array.from(t),n):Rg(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 Qa({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 Qa({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 utt(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=Ul(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"?k0(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 dtt(this,t)}}function Rg(e){if(os(e))return!0;throw new Error("Expected a YAML collection as document contents")}class Dfe extends Error{constructor(t,n,r,i){super(),this.name=t,this.code=r,this.message=i,this.pos=n}}class c1 extends Dfe{constructor(t,n,r){super("YAMLParseError",t,n,r)}}class ftt extends Dfe{constructor(t,n,r){super("YAMLWarning",t,n,r)}}const uH=(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 Fb(e,{flow:t,indicator:n,next:r,offset:i,onError:s,parentIndent:a,startOnNewline:l}){let c=!1,u=l,d=l,f="",h="",p=!1,b=!1,g=null,O=null,y=null,v=null,x=null,w=null,S=null;for(const T of e)switch(b&&(T.type!=="space"&&T.type!=="newline"&&T.type!=="comma"&&s(T.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),b=!1),g&&(u&&T.type!=="comment"&&T.type!=="newline"&&s(g,"TAB_AS_INDENT","Tabs are not allowed as indentation"),g=null),T.type){case"space":!t&&(n!=="doc-start"||(r==null?void 0:r.type)!=="flow-collection")&&T.source.includes(" ")&&(g=T),d=!0;break;case"comment":{d||s(T,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const C=T.source.substring(1)||" ";f?f+=h+C:f=C,h="",u=!1;break}case"newline":u?f?f+=T.source:(!w||n!=="seq-item-ind")&&(c=!0):h+=T.source,u=!0,p=!0,(O||y)&&(v=T),d=!0;break;case"anchor":O&&s(T,"MULTIPLE_ANCHORS","A node can have at most one anchor"),T.source.endsWith(":")&&s(T.offset+T.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),O=T,S??(S=T.offset),u=!1,d=!1,b=!0;break;case"tag":{y&&s(T,"MULTIPLE_TAGS","A node can have at most one tag"),y=T,S??(S=T.offset),u=!1,d=!1,b=!0;break}case n:(O||y)&&s(T,"BAD_PROP_ORDER",`Anchors and tags must be after the ${T.source} indicator`),w&&s(T,"UNEXPECTED_TOKEN",`Unexpected ${T.source} in ${t??"collection"}`),w=T,u=n==="seq-item-ind"||n==="explicit-key-ind",d=!1;break;case"comma":if(t){x&&s(T,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),x=T,u=!1,d=!1;break}default:s(T,"UNEXPECTED_TOKEN",`Unexpected ${T.type} token`),u=!1,d=!1}const E=e[e.length-1],k=E?E.offset+E.source.length:i;return b&&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"),g&&(u&&g.indent<=a||(r==null?void 0:r.type)==="block-map"||(r==null?void 0:r.type)==="block-seq")&&s(g,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:x,found:w,spaceBefore:c,comment:f,hasNewline:p,anchor:O,tag:y,newlineAfterProp:v,end:k,start:S??k}}function iv(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(iv(t.key)||iv(t.value))return!0}return!1;default:return!0}}function LM(e,t,n){if((t==null?void 0:t.type)==="flow-collection"){const r=t.end[0];r.indent===e&&(r.source==="]"||r.source==="}")&&iv(t)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function Ife(e,t,n){const{uniqueKeys:r}=e.options;if(r===!1)return!1;const i=typeof r=="function"?r:(s,a)=>s===a||fi(s)&&fi(a)&&s.value===a.value;return t.some(s=>i(s.key,n))}const cH="All mapping items must start at the same column";function dtt({composeNode:e,composeEmptyNode:t},n,r,i,s){var d;const a=(s==null?void 0:s.nodeClass)??Rl,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:p,sep:b,value:g}=f,O=Fb(h,{indicator:"explicit-key-ind",next:p??(b==null?void 0:b[0]),offset:c,onError:i,parentIndent:r.indent,startOnNewline:!0}),y=!O.found;if(y){if(p&&(p.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==r.indent&&i(c,"BAD_INDENT",cH)),!O.anchor&&!O.tag&&!b){u=O.end,O.comment&&(l.comment?l.comment+=` -`+O.comment:l.comment=O.comment);continue}(O.newlineAfterProp||iv(p))&&i(p??h[h.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else((d=O.found)==null?void 0:d.indent)!==r.indent&&i(c,"BAD_INDENT",cH);n.atKey=!0;const v=O.end,x=p?e(n,p,O,i):t(n,v,h,null,O,i);n.schema.compat&&LM(r.indent,p,i),n.atKey=!1,Ife(n,l.items,x)&&i(v,"DUPLICATE_KEY","Map keys must be unique");const w=Fb(b??[],{indicator:"map-value-ind",next:g,offset:x.range[2],onError:i,parentIndent:r.indent,startOnNewline:!p||p.type==="block-scalar"});if(c=w.end,w.found){y&&((g==null?void 0:g.type)==="block-map"&&!w.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&O.starte&&(e.type==="block-map"||e.type==="block-seq");function htt({composeNode:e,composeEmptyNode:t},n,r,i,s){var O;const a=r.start.source==="{",l=a?"flow map":"flow sequence",c=(s==null?void 0:s.nodeClass)??(a?Rl:jm),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 y=0;y0){const y=Aw(b,g,n.options.strict,i);y.comment&&(u.comment?u.comment+=` -`+y.comment:u.comment=y.comment),u.range=[r.offset,g,y.offset]}else u.range=[r.offset,g,g];return u}function JR(e,t,n,r,i,s){const a=n.type==="block-map"?dtt(e,t,n,r,s):n.type==="block-seq"?ftt(e,t,n,r,s):htt(e,t,n,r,s),l=a.constructor;return i==="!"||i===l.tagName?(a.tag=l.tagName,a):(i&&(a.tag=i),a)}function ptt(e,t,n,r,i){var h;const s=r.tag,a=s?t.directives.tagName(s.source,p=>i(s,"TAG_RESOLVE_FAILED",p)):null;if(n.type==="block-seq"){const{anchor:p,newlineAfterProp:b}=r,g=p&&s?p.offset>s.offset?p:s:p??s;g&&(!b||b.offsetp.tag===a&&p.collection===l);if(!c){const p=t.schema.knownTags[a];if((p==null?void 0:p.collection)===l)t.schema.tags.push(Object.assign({},p,{default:!1})),c=p;else return p?i(s,"BAD_COLLECTION_TYPE",`${p.tag} used for ${l} collection, but expects ${p.collection??"scalar"}`,!0):i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),JR(e,t,n,i,a)}const u=JR(e,t,n,i,a,c),d=((h=c.resolve)==null?void 0:h.call(c,u,p=>i(s,"TAG_RESOLVE_FAILED",p),t.options))??u,f=cs(d)?d:new wn(d);return f.range=u.range,f.tag=a,c!=null&&c.format&&(f.format=c.format),f}function mtt(e,t,n){const r=t.offset,i=gtt(t,e.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};const s=i.mode===">"?wn.BLOCK_FOLDED:wn.BLOCK_LITERAL,a=t.source?btt(t.source):[];let l=a.length;for(let g=a.length-1;g>=0;--g){const O=a[g][1];if(O===""||O==="\r")l=g;else break}if(l===0){const g=i.chomp==="+"&&a.length>0?` +`}};function Ub(e,{flow:t,indicator:n,next:r,offset:i,onError:s,parentIndent:a,startOnNewline:l}){let c=!1,u=l,d=l,f="",h="",p=!1,b=!1,g=null,O=null,y=null,v=null,x=null,w=null,S=null;for(const T of e)switch(b&&(T.type!=="space"&&T.type!=="newline"&&T.type!=="comma"&&s(T.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),b=!1),g&&(u&&T.type!=="comment"&&T.type!=="newline"&&s(g,"TAB_AS_INDENT","Tabs are not allowed as indentation"),g=null),T.type){case"space":!t&&(n!=="doc-start"||(r==null?void 0:r.type)!=="flow-collection")&&T.source.includes(" ")&&(g=T),d=!0;break;case"comment":{d||s(T,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const C=T.source.substring(1)||" ";f?f+=h+C:f=C,h="",u=!1;break}case"newline":u?f?f+=T.source:(!w||n!=="seq-item-ind")&&(c=!0):h+=T.source,u=!0,p=!0,(O||y)&&(v=T),d=!0;break;case"anchor":O&&s(T,"MULTIPLE_ANCHORS","A node can have at most one anchor"),T.source.endsWith(":")&&s(T.offset+T.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),O=T,S??(S=T.offset),u=!1,d=!1,b=!0;break;case"tag":{y&&s(T,"MULTIPLE_TAGS","A node can have at most one tag"),y=T,S??(S=T.offset),u=!1,d=!1,b=!0;break}case n:(O||y)&&s(T,"BAD_PROP_ORDER",`Anchors and tags must be after the ${T.source} indicator`),w&&s(T,"UNEXPECTED_TOKEN",`Unexpected ${T.source} in ${t??"collection"}`),w=T,u=n==="seq-item-ind"||n==="explicit-key-ind",d=!1;break;case"comma":if(t){x&&s(T,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),x=T,u=!1,d=!1;break}default:s(T,"UNEXPECTED_TOKEN",`Unexpected ${T.type} token`),u=!1,d=!1}const E=e[e.length-1],k=E?E.offset+E.source.length:i;return b&&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"),g&&(u&&g.indent<=a||(r==null?void 0:r.type)==="block-map"||(r==null?void 0:r.type)==="block-seq")&&s(g,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:x,found:w,spaceBefore:c,comment:f,hasNewline:p,anchor:O,tag:y,newlineAfterProp:v,end:k,start:S??k}}function sv(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(sv(t.key)||sv(t.value))return!0}return!1;default:return!0}}function BM(e,t,n){if((t==null?void 0:t.type)==="flow-collection"){const r=t.end[0];r.indent===e&&(r.source==="]"||r.source==="}")&&sv(t)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function Pfe(e,t,n){const{uniqueKeys:r}=e.options;if(r===!1)return!1;const i=typeof r=="function"?r:(s,a)=>s===a||fi(s)&&fi(a)&&s.value===a.value;return t.some(s=>i(s.key,n))}const dH="All mapping items must start at the same column";function htt({composeNode:e,composeEmptyNode:t},n,r,i,s){var d;const a=(s==null?void 0:s.nodeClass)??Rl,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:p,sep:b,value:g}=f,O=Ub(h,{indicator:"explicit-key-ind",next:p??(b==null?void 0:b[0]),offset:c,onError:i,parentIndent:r.indent,startOnNewline:!0}),y=!O.found;if(y){if(p&&(p.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==r.indent&&i(c,"BAD_INDENT",dH)),!O.anchor&&!O.tag&&!b){u=O.end,O.comment&&(l.comment?l.comment+=` +`+O.comment:l.comment=O.comment);continue}(O.newlineAfterProp||sv(p))&&i(p??h[h.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else((d=O.found)==null?void 0:d.indent)!==r.indent&&i(c,"BAD_INDENT",dH);n.atKey=!0;const v=O.end,x=p?e(n,p,O,i):t(n,v,h,null,O,i);n.schema.compat&&BM(r.indent,p,i),n.atKey=!1,Pfe(n,l.items,x)&&i(v,"DUPLICATE_KEY","Map keys must be unique");const w=Ub(b??[],{indicator:"map-value-ind",next:g,offset:x.range[2],onError:i,parentIndent:r.indent,startOnNewline:!p||p.type==="block-scalar"});if(c=w.end,w.found){y&&((g==null?void 0:g.type)==="block-map"&&!w.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&O.starte&&(e.type==="block-map"||e.type==="block-seq");function mtt({composeNode:e,composeEmptyNode:t},n,r,i,s){var O;const a=r.start.source==="{",l=a?"flow map":"flow sequence",c=(s==null?void 0:s.nodeClass)??(a?Rl:Rm),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 y=0;y0){const y=Cw(b,g,n.options.strict,i);y.comment&&(u.comment?u.comment+=` +`+y.comment:u.comment=y.comment),u.range=[r.offset,g,y.offset]}else u.range=[r.offset,g,g];return u}function tI(e,t,n,r,i,s){const a=n.type==="block-map"?htt(e,t,n,r,s):n.type==="block-seq"?ptt(e,t,n,r,s):mtt(e,t,n,r,s),l=a.constructor;return i==="!"||i===l.tagName?(a.tag=l.tagName,a):(i&&(a.tag=i),a)}function gtt(e,t,n,r,i){var h;const s=r.tag,a=s?t.directives.tagName(s.source,p=>i(s,"TAG_RESOLVE_FAILED",p)):null;if(n.type==="block-seq"){const{anchor:p,newlineAfterProp:b}=r,g=p&&s?p.offset>s.offset?p:s:p??s;g&&(!b||b.offsetp.tag===a&&p.collection===l);if(!c){const p=t.schema.knownTags[a];if((p==null?void 0:p.collection)===l)t.schema.tags.push(Object.assign({},p,{default:!1})),c=p;else return p?i(s,"BAD_COLLECTION_TYPE",`${p.tag} used for ${l} collection, but expects ${p.collection??"scalar"}`,!0):i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${a}`,!0),tI(e,t,n,i,a)}const u=tI(e,t,n,i,a,c),d=((h=c.resolve)==null?void 0:h.call(c,u,p=>i(s,"TAG_RESOLVE_FAILED",p),t.options))??u,f=cs(d)?d:new wn(d);return f.range=u.range,f.tag=a,c!=null&&c.format&&(f.format=c.format),f}function btt(e,t,n){const r=t.offset,i=Ott(t,e.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};const s=i.mode===">"?wn.BLOCK_FOLDED:wn.BLOCK_LITERAL,a=t.source?ytt(t.source):[];let l=a.length;for(let g=a.length-1;g>=0;--g){const O=a[g][1];if(O===""||O==="\r")l=g;else break}if(l===0){const g=i.chomp==="+"&&a.length>0?` `.repeat(Math.max(1,a.length-1)):"";let O=r+i.length;return t.source&&(O+=t.source.length),{value:g,type:s,comment:i.comment,range:[r,O,O]}}let c=t.indent+i.indent,u=t.offset+i.length,d=0;for(let g=0;gc&&(c=O.length);else{O.length=l;--g)a[g][0].length>c&&(l=g+1);let f="",h="",p=!1;for(let g=0;gc||y[0]===" "?(h===" "?h=` @@ -614,66 +614,66 @@ ${u} `+a[g][0].slice(c);f[f.length-1]!==` `&&(f+=` `);break;default:f+=` -`}const b=r+i.length+t.source.length;return{value:f,type:s,comment:i.comment,range:[r,b,b]}}function gtt({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,p,b);switch(i){case"scalar":l=wn.PLAIN,c=ytt(s,u);break;case"single-quoted-scalar":l=wn.QUOTE_SINGLE,c=xtt(s,u);break;case"double-quoted-scalar":l=wn.QUOTE_DOUBLE,c=vtt(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=Aw(a,d,t,n);return{value:c,type:l,comment:f.comment,range:[r,d,f.offset]}}function ytt(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}`),Dfe(e)}function xtt(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),Dfe(e.slice(1,-1)).replace(/''/g,"'")}function Dfe(e){let t,n;try{t=new RegExp(`(.*?)(?n(r+h,p,b);switch(i){case"scalar":l=wn.PLAIN,c=vtt(s,u);break;case"single-quoted-scalar":l=wn.QUOTE_SINGLE,c=wtt(s,u);break;case"double-quoted-scalar":l=wn.QUOTE_DOUBLE,c=Stt(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=Cw(a,d,t,n);return{value:c,type:l,comment:f.comment,range:[r,d,f.offset]}}function vtt(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}`),Mfe(e)}function wtt(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),Mfe(e.slice(1,-1)).replace(/''/g,"'")}function Mfe(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 wtt(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 Ett(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 Stt={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Ett(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 Pfe(e,t,n,r){const{value:i,type:s,comment:a,range:l}=t.type==="block-scalar"?mtt(e,t,r):Ott(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[Cu]:c?u=ktt(e.schema,i,c,n,r):t.type==="scalar"?u=Ttt(e,i,t,r):u=e.schema[Cu];let d;try{const f=u.resolve(i,h=>r(n??t,"TAG_RESOLVE_FAILED",h),e.options);d=fi(f)?f:new wn(f)}catch(f){const h=f instanceof Error?f.message:String(f);r(n??t,"TAG_RESOLVE_FAILED",h),d=new wn(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 ktt(e,t,n,r,i){var l;if(n==="!")return e[Cu];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[Cu])}function Ttt({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[Cu];if(n.compat){const l=n.compat.find(c=>{var u;return c.default&&((u=c.test)==null?void 0:u.test(r))})??n[Cu];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 _tt(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 Att={composeNode:Mfe,composeEmptyNode:w8};function Mfe(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=Ctt(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=Pfe(e,t,c,r),l&&(u.anchor=l.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=ptt(Att,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=w8(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&&(!fi(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 w8(e,t,n,r,{spaceBefore:i,comment:s,anchor:a,tag:l,end:c},u){const d={type:"scalar",offset:_tt(t,n,r),indent:-1,source:""},f=Pfe(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 Ctt({options:e},{offset:t,source:n,end:r},i){const s=new d8(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=Aw(r,a,e.strict,i);return s.range=[t,a,l.offset],l.comment&&(s.comment=l.comment),s}function Ntt(e,t,{offset:n,start:r,value:i,end:s},a){const l=Object.assign({_directives:t},e),c=new _w(void 0,l),u={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=Fb(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?Mfe(u,i,d,a):w8(u,d.end,r,null,d,a);const f=c.contents.range[2],h=Aw(s,f,!1,a);return h.comment&&(c.comment=h.comment),c.range=[n,f,h.offset],c}function _y(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 uH(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[Cu]:c?u=_tt(e.schema,i,c,n,r):t.type==="scalar"?u=Att(e,i,t,r):u=e.schema[Cu];let d;try{const f=u.resolve(i,h=>r(n??t,"TAG_RESOLVE_FAILED",h),e.options);d=fi(f)?f:new wn(f)}catch(f){const h=f instanceof Error?f.message:String(f);r(n??t,"TAG_RESOLVE_FAILED",h),d=new wn(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 _tt(e,t,n,r,i){var l;if(n==="!")return e[Cu];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[Cu])}function Att({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[Cu];if(n.compat){const l=n.compat.find(c=>{var u;return c.default&&((u=c.test)==null?void 0:u.test(r))})??n[Cu];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 Ctt(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 Ntt={composeNode:$fe,composeEmptyNode:E8};function $fe(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=jtt(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=Lfe(e,t,c,r),l&&(u.anchor=l.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=gtt(Ntt,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=E8(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&&(!fi(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 E8(e,t,n,r,{spaceBefore:i,comment:s,anchor:a,tag:l,end:c},u){const d={type:"scalar",offset:Ctt(t,n,r),indent:-1,source:""},f=Lfe(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 jtt({options:e},{offset:t,source:n,end:r},i){const s=new h8(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=Cw(r,a,e.strict,i);return s.range=[t,a,l.offset],l.comment&&(s.comment=l.comment),s}function Rtt(e,t,{offset:n,start:r,value:i,end:s},a){const l=Object.assign({_directives:t},e),c=new Aw(void 0,l),u={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=Ub(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?$fe(u,i,d,a):E8(u,d.end,r,null,d,a);const f=c.contents.range[2],h=Cw(s,f,!1,a);return h.comment&&(c.comment=h.comment),c.range=[n,f,h.offset],c}function Ay(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 fH(e){var i;let t="",n=!1,r=!1;for(let s=0;s{const a=_y(n);s?this.warnings.push(new utt(a,r,i)):this.errors.push(new l1(a,r,i))},this.directives=new Qa({version:t.version||"1.2"}),this.options=t}decorate(t,n){const{comment:r,afterEmptyLine:i}=uH(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 Itt=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,r,i,s)=>{const a=Ay(n);s?this.warnings.push(new ftt(a,r,i)):this.errors.push(new c1(a,r,i))},this.directives=new Qa({version:t.version||"1.2"}),this.options=t}decorate(t,n){const{comment:r,afterEmptyLine:i}=fH(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(os(s)&&!s.flow&&s.items.length>0){let a=s.items[0];us(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=_y(t);s[0]+=n,this.onError(s,"BAD_DIRECTIVE",r,i)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{const n=Ntt(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 l1(_y(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 l1(_y(t),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;const n=Aw(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 l1(_y(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 _w(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 Lfe="\uFEFF",$fe="",Bfe="",$M="";function Rtt(e){switch(e){case Lfe:return"byte-order-mark";case $fe:return"doc-mode";case Bfe:return"flow-error-end";case $M:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` +${a}`:r}}if(n){for(let s=0;s{const s=Ay(t);s[0]+=n,this.onError(s,"BAD_DIRECTIVE",r,i)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{const n=Rtt(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 c1(Ay(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 c1(Ay(t),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;const n=Cw(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 c1(Ay(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 Aw(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 Bfe="\uFEFF",Qfe="",Ffe="",QM="";function Dtt(e){switch(e){case Bfe:return"byte-order-mark";case Qfe:return"doc-mode";case Ffe:return"flow-error-end";case QM: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 sc(e){switch(e){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}const dH=new Set("0123456789ABCDEFabcdef"),Itt=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),SE=new Set(",[]{}"),Dtt=new Set(` ,[]{} -\r `),eI=e=>!e||Dtt.has(e);class Ptt{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,n=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!n;let r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===` +`:case"\r":case" ":return!0;default:return!1}}const hH=new Set("0123456789ABCDEFabcdef"),Ptt=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),SE=new Set(",[]{}"),Mtt=new Set(` ,[]{} +\r `),nI=e=>!e||Mtt.has(e);class Ltt{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==="...")&&sc(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&tthis.indentValue&&!sc(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===":")&&sc(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(eI),"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&&rthis.indentValue&&!sc(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===":")&&sc(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(nI),"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=>sc(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 $M,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(sc(s)||t&&SE.has(s))break;n=r}else if(sc(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 QM,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(sc(s)||t&&SE.has(s))break;n=r}else if(sc(i)){let s=this.buffer[r+1];if(i==="\r"&&(s===` `?(r+=1,i=` `,s=this.buffer[r+1]):n=r),s==="#"||t&&SE.has(s))break;if(i===` -`){const a=this.continueScalar(r+1);if(a===-1)break;r=Math.max(r,a-2)}}else{if(t&&SE.has(i))break;n=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield $M,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(eI),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{const n=this.flowLevel>0,r=this.charAt(1);if(sc(r)||n&&SE.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(;!sc(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(Itt.has(n))n=this.buffer[++t];else if(n==="%"&&dH.has(this.buffer[t+1])&&dH.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===` +`){const a=this.continueScalar(r+1);if(a===-1)break;r=Math.max(r,a-2)}}else{if(t&&SE.has(i))break;n=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield QM,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(nI),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{const n=this.flowLevel>0,r=this.charAt(1);if(sc(r)||n&&SE.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(;!sc(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(Ptt.has(n))n=this.buffer[++t];else if(n==="%"&&hH.has(this.buffer[t+1])&&hH.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 Mtt{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 V2(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"&&hH(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&&fH(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 $tt{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 H2(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"&&mH(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&&pH(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(zf(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(Qfe(n.key)&&!zf(n.sep,"newline")){const l=Rg(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(zf(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const l=Rg(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]}):zf(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&&!zf(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)){V2(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||zf(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=EE(r),s=Rg(i);hH(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)){H2(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(zf(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(Ufe(n.key)&&!zf(n.sep,"newline")){const l=Ig(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(zf(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const l=Ig(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]}):zf(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&&!zf(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)){H2(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||zf(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=EE(r),s=Ig(i);mH(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=EE(t),r=Rg(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=EE(t),r=Rg(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 $tt(e){const t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Mtt||null,prettyErrors:t}}function Ffe(e,t={}){const{lineCounter:n,prettyErrors:r}=$tt(t),i=new Ltt(n==null?void 0:n.addNewLine),s=new jtt(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 l1(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(a.errors.forEach(lH(e,n)),a.warnings.forEach(lH(e,n))),a}function Btt(e,t,n){let r;const i=Ffe(e,n);if(!i)return null;if(i.warnings.forEach(s=>dfe(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 Ufe(e,t,n){let r=null;if(Array.isArray(t)&&(r=t),e===void 0){const{keepUndefined:i}={};if(!i)return}return Sw(e)&&!r?e.toString(n):new _w(e,r,n).toString(n)}const zfe=1024;let Qtt=0,Il=class{constructor(t,n){this.from=t,this.to=n}};class dn{constructor(t={}){this.id=Qtt++,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=ws.match(t)),n=>{let r=t(n);return r===void 0?null:[this,r]}}}dn.closedBy=new dn({deserialize:e=>e.split(" ")});dn.openedBy=new dn({deserialize:e=>e.split(" ")});dn.group=new dn({deserialize:e=>e.split(" ")});dn.isolate=new dn({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});dn.contextHash=new dn({perNode:!0});dn.lookAhead=new dn({perNode:!0});dn.mounted=new dn({perNode:!0});class Y0{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[dn.mounted.id]}}const Ftt=Object.create(null);class ws{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):Ftt,r=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new ws(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(dn.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(dn.group),s=-1;s<(i?i.length:0);s++){let a=n[s<0?r.name:i[s]];if(a)return a}}}}ws.none=new ws("",Object.create(null),0,8);class $O{constructor(t){this.types=t;for(let n=0;n0;for(let c=this.cursor(a|Ar.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:k8(ws.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new Fn(this.type,n,r,i,this.propValues),t.makeTree||((n,r,i)=>new Fn(ws.none,n,r,i)))}static build(t){return qtt(t)}}Fn.empty=new Fn(ws.none,[],[],0);class S8{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 S8(this.buffer,this.index)}}class Fh{constructor(t,n,r){this.buffer=t,this.length=n,this.set=r}get type(){return ws.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 sv(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&Ar.EnterBracketed&&d instanceof Fn&&(h=Y0.get(d))&&!h.overlay&&h.bracketed&&r>=f&&r<=f+d.length)&&!Vfe(i,r,f,f+d.length))){if(d instanceof Fh){if(s&Ar.ExcludeBuffers)continue;let p=d.findChild(0,d.buffer.length,n,r-f,i);if(p>-1)return new pu(new Utt(a,d,t,f),null,p)}else if(s&Ar.IncludeAnonymous||!d.type.isAnonymous||E8(d)){let p;if(!(s&Ar.IgnoreMounts)&&(p=Y0.get(d))&&!p.overlay)return new Ca(p.tree,f,t,a);let b=new Ca(d,f,t,a);return s&Ar.IncludeAnonymous||!b.type.isAnonymous?b:b.nextChild(n<0?d.children.length-1:0,n,r,i,s)}}}if(s&Ar.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&Ar.IgnoreOverlays)&&(i=Y0.get(this._tree))&&i.overlay){let s=t-this.from,a=r&Ar.EnterBracketed&&i.bracketed;for(let{from:l,to:c}of i.overlay)if((n>0||a?l<=s:l=s:c>s))return new Ca(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 mH(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 BM(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 Utt{constructor(t,n,r,i){this.parent=t,this.buffer=n,this.index=r,this.start=i}}class pu extends qfe{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 pu(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&Ar.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 pu(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 pu(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 pu(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 Fn(this.type,t,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Hfe(e){if(!e.length)return null;let t=0,n=e[0];for(let s=1;sn.from||a.to=t){let l=new Ca(a.tree,a.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(sv(l,t,n,!1))}}return i?Hfe(i):r}class q2{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&~Ar.EnterBracketed,t instanceof Ca)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 Ca?(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&Ar.ExcludeBuffers?!1:this.enterChild(1,t,n):this.yield(this._tree.enter(t,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ar.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&Ar.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&Ar.IncludeAnonymous||l instanceof Fh||!l.type.isAnonymous||E8(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 BM(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 E8(e){return e.children.some(t=>t instanceof Fh||!t.type.isAnonymous||E8(t))}function qtt(e){var t;let{buffer:n,nodeSet:r,maxBufferLength:i=zfe,reused:s=[],minRepeatType:a=r.types.length}=e,l=Array.isArray(n)?new S8(n,n.length):n,c=r.types,u=0,d=0;function f(S,E,k,T,C,N){let{id:_,start:R,end:$,size:D}=l,M=d,j=u;if(D<0)if(l.next(),D==-1){let q=s[_];k.push(q),T.push(R-S);return}else if(D==-3){u=_;return}else if(D==-4){d=_;return}else throw new RangeError(`Unrecognized record size: ${D}`);let P=c[_],L,U,F=R-S;if($-R<=i&&(U=O(l.pos-E,C))){let q=new Uint16Array(U.size-U.skip),z=l.pos-U.size,B=q.length;for(;l.pos>z;)B=y(U.start,q,B);L=new Fh(q,$-U.start,r),F=U.start-S}else{let q=l.pos-D;l.next();let z=[],B=[],V=_>=a?_:-1,ce=0,we=$;for(;l.pos>q;)V>=0&&l.id==V&&l.size>=0?(l.end<=we-i&&(b(z,B,R,ce,l.end,we,V,M,j),ce=z.length,we=l.end),l.next()):N>2500?h(R,q,z,B):f(R,q,z,B,V,N+1);if(V>=0&&ce>0&&ce-1&&ce>0){let Oe=p(P,j);L=k8(P,z,B,0,z.length,0,$-R,Oe,Oe)}else L=g(P,z,B,$-R,M-$,j)}k.push(L),T.push(F)}function h(S,E,k,T){let C=[],N=0,_=-1;for(;l.pos>E;){let{id:R,start:$,end:D,size:M}=l;if(M>4)l.next();else{if(_>-1&&$<_)break;_<0&&(_=D-i),C.push(R,$,D),N++,l.next()}}if(N){let R=new Uint16Array(N*4),$=C[C.length-2];for(let D=C.length-3,M=0;D>=0;D-=3)R[M++]=C[D],R[M++]=C[D+1]-$,R[M++]=C[D+2]-$,R[M++]=M;k.push(new Fh(R,C[2]-$,r)),T.push($-S)}}function p(S,E){return(k,T,C)=>{let N=0,_=k.length-1,R,$;if(_>=0&&(R=k[_])instanceof Fn){if(!_&&R.type==S&&R.length==C)return R;($=R.prop(dn.lookAhead))&&(N=T[_]+R.length+$)}return g(S,k,T,C,N,E)}}function b(S,E,k,T,C,N,_,R,$){let D=[],M=[];for(;S.length>T;)D.push(S.pop()),M.push(E.pop()+k-C);S.push(g(r.types[_],D,M,N-C,R-N,$)),E.push(C-k)}function g(S,E,k,T,C,N,_){if(N){let R=[dn.contextHash,N];_=_?[R].concat(_):[R]}if(C>25){let R=[dn.lookAhead,C];_=_?[R].concat(_):[R]}return new Fn(S,E,k,T,_)}function O(S,E){let k=l.fork(),T=0,C=0,N=0,_=k.end-i,R={size:0,start:0,skip:0};e:for(let $=k.pos-S;k.pos>$;){let D=k.size;if(k.id==E&&D>=0){R.size=T,R.start=C,R.skip=N,N+=4,T+=4,k.next();continue}let M=k.pos-D;if(D<0||M<$||k.start<_)break;let j=k.id>=a?4:0,P=k.start;for(k.next();k.pos>M;){if(k.size<0)if(k.size==-3||k.size==-4)j+=4;else break e;else k.id>=a&&(j+=4);k.next()}C=P,T+=D,N+=j}return(E<0||T==S)&&(R.size=T,R.start=C,R.skip=N),R.size>4?R:void 0}function y(S,E,k){let{id:T,start:C,end:N,size:_}=l;if(l.next(),_>=0&&T4){let $=l.pos-(_-4);for(;l.pos>$;)k=y(S,E,k)}E[--k]=R,E[--k]=N-S,E[--k]=C-S,E[--k]=T}else _==-3?u=T:_==-4&&(d=T);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 Fn(c[e.topID],v.reverse(),x.reverse(),w)}const gH=new WeakMap;function Wk(e,t){if(!e.isAnonymous||t instanceof Fh||t.type!=e)return 1;let n=gH.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof Fn)){n=1;break}n+=Wk(e,r)}gH.set(t,n)}return n}function k8(e,t,n,r,i,s,a,l,c){let u=0;for(let b=r;b=d)break;E+=k}if(x==w+1){if(E>d){let k=b[w];p(k.children,k.positions,0,k.children.length,g[w]+v);continue}f.push(b[w])}else{let k=g[x-1]+b[x-1].length-S;f.push(k8(e,b,g,w,x,S,k,null,c))}h.push(S+v-s)}}return p(t,n,r,i,0),(l||c)(f,h,a)}class T8{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 pu?this.setBuffer(t.context.buffer,t.index,n):t instanceof Ca&&this.map.set(t.tree,n)}get(t){return t instanceof pu?this.getBuffer(t.context.buffer,t.index):t instanceof Ca?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 $d{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 $d(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 p=Math.max(h.from,c)-u,b=Math.min(h.to,f)-u;h=p>=b?null:new $d(p,b,h.tree,h.offset+u,l>0,!!d)}if(h&&i.push(h),a.to>f)break;a=snew Il(i.from,i.to)):[new Il(0,0)]:[new Il(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 Htt{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 Xfe(e){return(t,n,r,i)=>new Gtt(t,e,n,r,i)}class bH{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 OH(e){if(!e.length||e.some(t=>t.from>=t.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(e))}class Xtt{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 QM=new dn({perNode:!0});class Gtt{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 Fn(r.type,r.children,r.positions,r.length,r.propValues.concat([[QM,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[dn.mounted.id]=new Y0(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(p=>p.fromf)&&n.ranges.push({from:f,to:h})}}l=!1}else if(r&&(a=Ytt(r.ranges,i.from,i.to)))l=a!=2;else if(!i.type.isAnonymous&&(s=this.nest(i,this.input))&&(i.fromnew Il(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 Il(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=vH(this.ranges,n.ranges);u.length&&(OH(u),this.inner.splice(n.index,0,new bH(n.parser,n.parser.startParse(this.input,wH(n.mounts,u),u),n.ranges.map(d=>new Il(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 Ytt(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 yH(e,t,n,r,i,s){if(t=t&&n.enter(r,1,Ar.IgnoreOverlays|Ar.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 Fn)n=n.children[0];else break}return!1}}let Ztt=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(QM))!==null&&n!==void 0?n:r.to,this.inner=new xH(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(QM))!==null&&t!==void 0?t:n.to,this.inner=new xH(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(dn.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 vH(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 Il(l,c.to))):c.to>l?n[s--]=new Il(l,c.to):n.splice(s--,1))}}return r}function Ktt(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),p=Math.min(d,f,r);hnew Il(h.from+r,h.to+r)),f=Ktt(t,d,c,u);for(let h=0,p=c;;h++){let b=h==f.length,g=b?u:f[h].from;if(g>p&&n.push(new $d(p,g,i.tree,-a,s.from>=p||s.openStart,s.to<=g||s.openEnd)),b)break;p=f[h].to}}else n.push(new $d(c,u,i.tree,-a,s.from>=a||s.openStart,s.to<=l||s.openEnd))}return n}let FM=[],Gfe=[];(()=>{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=Gfe[r])t=r+1;else return!0;if(t==n)return!1}}function SH(e){return e>=127462&&e<=127487}const EH=8205;function ent(e,t,n=!0,r=!0){return(n?Yfe:tnt)(e,t,r)}function Yfe(e,t,n){if(t==e.length)return t;t&&Wfe(e.charCodeAt(t))&&Zfe(e.charCodeAt(t-1))&&t--;let r=tI(e,t);for(t+=kH(r);t=0&&SH(tI(e,a));)s++,a-=2;if(s%2==0)break;t+=2}else break}return t}function tnt(e,t,n){for(;t>1;){let r=Yfe(e,t-2,n);if(r=56320&&e<57344}function Zfe(e){return e>=55296&&e<56320}function kH(e){return e<65536?1:2}let Tr=class Kfe{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]=Ub(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),au.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]=Ub(this,t,n);let r=[];return this.decompose(t,n,r,0),au.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 W1(this),s=new W1(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 W1(this,t)}iterRange(t,n=this.length){return new Jfe(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 ehe(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]?Kfe.empty:t.length<=32?new is(t):au.from(is.split(t,[]))}};class is extends Tr{constructor(t,n=nnt(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 rnt(i,l,r,a);i=l+1,r++}}decompose(t,n,r,i){let s=t<=0&&n>=this.length?this:new is(TH(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let a=r.pop(),l=Zk(s.text,a.text.slice(),0,s.length);if(l.length<=32)r.push(new is(l,a.length+s.length));else{let c=l.length>>1;r.push(new is(l.slice(0,c)),new is(l.slice(c)))}}else r.push(s)}replace(t,n,r){if(!(r instanceof is))return super.replace(t,n,r);[t,n]=Ub(this,t,n);let i=Zk(this.text,Zk(r.text,TH(this.text,0,t)),n),s=this.length+r.length-(n-t);return i.length<=32?new is(i,s):au.from(is.split(i,[]),s)}sliceString(t,n=this.length,r=` -`){[t,n]=Ub(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 is(r,i)),r=[],i=-1);return i>-1&&n.push(new is(r,i)),n}}class au extends Tr{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]=Ub(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 au(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]=Ub(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 au))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 p of t)r+=p.lines;if(r<32){let p=[];for(let b of t)b.flatten(p);return new is(p,n)}let i=Math.max(32,r>>5),s=i<<1,a=i>>1,l=[],c=0,u=-1,d=[];function f(p){let b;if(p.lines>s&&p instanceof au)for(let g of p.children)f(g);else p.lines>a&&(c>a||!c)?(h(),l.push(p)):p instanceof is&&c&&(b=d[d.length-1])instanceof is&&p.lines+b.lines<=32?(c+=p.lines,u+=p.length+1,d[d.length-1]=new is(b.text.concat(p.text),b.length+1+p.length)):(c+p.lines>i&&h(),c+=p.lines,u+=p.length+1,d.push(p))}function h(){c!=0&&(l.push(d.length==1?d[0]:au.from(d,u)),u=-1,c=d.length=0)}for(let p of t)f(p);return h(),l.length==1?l[0]:new au(l,n)}}Tr.empty=new is([""],0);function nnt(e){let t=-1;for(let n of e)t+=n.length+1;return t}function Zk(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 is?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 is?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 is){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 is?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 Jfe{constructor(t,n,r){this.value="",this.done=!1,this.cursor=new W1(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 ehe{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"&&(Tr.prototype[Symbol.iterator]=function(){return this.iter()},W1.prototype[Symbol.iterator]=Jfe.prototype[Symbol.iterator]=ehe.prototype[Symbol.iterator]=function(){return this});let rnt=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 Ub(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function Gs(e,t,n=!0,r=!0){return ent(e,t,n,r)}function int(e){return e>=56320&&e<57344}function snt(e){return e>=55296&&e<56320}function lo(e,t){let n=e.charCodeAt(t);if(!snt(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return int(r)?(n-55296<<10)+(r-56320)+65536:n}function _8(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function ou(e){return e<65536?1:2}const UM=/\r\n?|\n/;var ua=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(ua||(ua={}));class Su{constructor(t){this.sections=t}get length(){let t=0;for(let n=0;nt)return s+(t-i);s+=l}else{if(r!=ua.Simple&&u>=t&&(r==ua.TrackDel&&it||r==ua.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 Su(t)}static create(t){return new Su(t)}}class js extends Su{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 zM(this,(n,r,i,s,a)=>t=t.replace(i,i+(r-n),a),!1),t}mapDesc(t,n=!1){return VM(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&&oh(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 b=p?typeof p=="string"?Tr.of(p.split(r||UM)):p:Tr.empty,g=b.length;if(f==h&&g==0)return;fa&&ka(i,f-a,-1),ka(i,h-f,g),oh(s,i,b),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 oh(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 VM(e,t,n,r=!1){let i=[],s=r?[]:null,a=new av(e),l=new av(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);ka(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 av{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i>1;return n>=t.length?Tr.empty:t[n]}textBit(t){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!t?Tr.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 Zf{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 Zf(r,i,this.flags,this.goalColumn)}extend(t,n=t,r=0){if(t<=this.anchor&&n>=this.anchor)return Fe.range(t,n,void 0,void 0,r);let i=Math.abs(t-this.anchor)>Math.abs(n-this.anchor)?t:n;return Fe.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 Fe.range(t.anchor,t.head)}static create(t,n,r,i){return new Zf(t,n,r,i)}}class Fe{constructor(t,n){this.ranges=t,this.mainIndex=n}map(t,n=-1){return t.empty?this:Fe.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 Fe(t.ranges.map(n=>Zf.fromJSON(n)),t.main)}static single(t,n=t){return new Fe([Fe.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?Fe.range(c,l):Fe.range(l,c))}}return new Fe(t,n)}}function nhe(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let A8=0;class kt{constructor(t,n,r,i,s){this.combine=t,this.compareInput=n,this.compare=r,this.isStatic=i,this.id=A8++,this.default=t([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(t={}){return new kt(t.combine||(n=>n),t.compareInput||((n,r)=>n===r),t.compare||(t.combine?(n,r)=>n===r:C8),!!t.static,t.enables)}of(t){return new Kk([],this,0,t)}compute(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Kk(t,this,1,n)}computeN(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Kk(t,this,2,n)}from(t,n){return n||(n=r=>r),this.compute([t],r=>n(r.field(t)))}}function C8(e,t){return e==t||e.length==t.length&&e.every((n,r)=>n===t[r])}class Kk{constructor(t,n,r,i){this.dependencies=t,this.facet=n,this.type=r,this.value=i,this.id=A8++}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)||qM(f,d)){let p=r(f);if(l?!_H(p,f.values[a],i):!i(p,f.values[a]))return f.values[a]=p,1}return 0},reconfigure:(f,h)=>{let p,b=h.config.address[s];if(b!=null){let g=X2(h,b);if(this.dependencies.every(O=>O instanceof kt?h.facet(O)===f.facet(O):O instanceof ma?h.field(O,!1)==f.field(O,!1):!0)||(l?_H(p=r(f),g,i):i(p=r(f),g)))return f.values[a]=g,0}else p=r(f);return f.values[a]=p,1}}}get extension(){return this}}function _H(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(TE).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(TE),a=i.facet(TE),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,TE.of({field:this,create:t})]}get extension(){return this}}const Bp={lowest:4,low:3,default:2,high:1,highest:0};function Ay(e){return t=>new rhe(t,e)}const ff={highest:Ay(Bp.highest),high:Ay(Bp.high),default:Ay(Bp.default),low:Ay(Bp.low),lowest:Ay(Bp.lowest)};class rhe{constructor(t,n){this.inner=t,this.prec=n}get extension(){return this}}class TC{of(t){return new HM(this,t)}reconfigure(t){return TC.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class HM{constructor(t,n){this.compartment=t,this.inner=n}get extension(){return this}}class H2{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 ont(t,n,a))h instanceof ma?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(p=>h.slot(p));let d=r==null?void 0:r.config.facets;for(let h in s){let p=s[h],b=p[0].facet,g=d&&d[h]||[];if(p.every(O=>O.type==0))if(l[b.id]=c.length<<1|1,C8(g,p))c.push(r.facet(b));else{let O=b.combine(p.map(y=>y.value));c.push(r&&b.compare(O,r.facet(b))?r.facet(b):O)}else{for(let O of p)O.type==0?(l[O.id]=c.length<<1|1,c.push(O.value)):(l[O.id]=u.length<<1,u.push(y=>O.dynamicSlot(y)));l[b.id]=u.length<<1,u.push(O=>ant(O,b,p))}}let f=u.map(h=>h(l));return new H2(t,a,f,l,c,s)}}function ont(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 HM&&n.delete(a.compartment)}if(i.set(a,l),Array.isArray(a))for(let u of a)s(u,l);else if(a instanceof HM){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 rhe)s(a.inner,a.prec);else if(a instanceof ma)r[l].push(a),a.provides&&s(a.provides,l);else if(a instanceof Kk)r[l].push(a),a.facet.extensions&&s(a.facet.extensions,Bp.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,Bp.default),r.reduce((a,l)=>a.concat(l))}function Z1(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 X2(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}const ihe=kt.define(),XM=kt.define({combine:e=>e.some(t=>t),static:!0}),she=kt.define({combine:e=>e.length?e[0]:void 0,static:!0}),ahe=kt.define(),ohe=kt.define(),lhe=kt.define(),che=kt.define({combine:e=>e.length?e[0]:!1});class Lu{constructor(t,n){this.type=t,this.value=n}static define(){return new lnt}}class lnt{of(t){return new Lu(this,t)}}class cnt{constructor(t){this.map=t}of(t){return new mn(this,t)}}class mn{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 mn(this.type,n)}is(t){return this.type==t}static define(t={}){return new cnt(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}}mn.reconfigure=mn.define();mn.appendConfig=mn.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&&nhe(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=Lu.define();vs.userEvent=Lu.define();vs.addToHistory=Lu.define();vs.remote=Lu.define();function unt(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=dhe(t,W0(s),!1)}return e}function fnt(e){let t=e.startState,n=t.facet(lhe),r=e;for(let i=n.length-1;i>=0;i--){let s=n[i](e);s&&Object.keys(s).length&&(r=uhe(r,GM(t,s,e.changes.newLength),!0))}return r==e?e:vs.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}const hnt=[];function W0(e){return e==null?hnt:Array.isArray(e)?e:[e]}var Ai=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(Ai||(Ai={}));const pnt=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let YM;try{YM=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function mnt(e){if(YM)return YM.test(e);for(let t=0;t"€"&&(n.toUpperCase()!=n.toLowerCase()||pnt.test(n)))return!0}return!1}function gnt(e){return t=>{if(!/\S/.test(t))return Ai.Space;if(mnt(t))return Ai.Word;for(let n=0;n-1)return Ai.Word;return Ai.Other}}class nr{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(mn.reconfigure)?(n=null,r=l.value):l.is(mn.appendConfig)&&(n=null,r=W0(r).concat(l.value));let s;n?s=t.startState.values.slice():(n=H2.resolve(r,i,this),s=new nr(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(c,u)=>u.reconfigure(c,this),null).values);let a=t.startState.facet(XM)?t.newSelection:t.newSelection.asSingle();new nr(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:Fe.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=W0(r.effects);for(let l=1;la.spec.fromJSON(l,c)))}}return nr.create({doc:t.doc,selection:Fe.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(t={}){let n=H2.resolve(t.extensions||[],new Map),r=t.doc instanceof Tr?t.doc:Tr.of((t.doc||"").split(n.staticFacet(nr.lineSeparator)||UM)),i=t.selection?t.selection instanceof Fe?t.selection:Fe.single(t.selection.anchor,t.selection.head):Fe.single(0);return nhe(i,r.length),n.staticFacet(XM)||(i=i.asSingle()),new nr(n,r,i,n.dynamicSlots.map(()=>null),(s,a)=>a.create(s),null)}get tabSize(){return this.facet(nr.tabSize)}get lineBreak(){return this.facet(nr.lineSeparator)||` -`}get readOnly(){return this.facet(che)}phrase(t,...n){for(let r of this.facet(nr.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(ihe))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 gnt(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=Gs(n,a,!1);if(s(n.slice(c,a))!=Ai.Word)break;a=c}for(;le.length?e[0]:4});nr.lineSeparator=she;nr.readOnly=che;nr.phrases=kt.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])}});nr.languageData=ihe;nr.changeFilter=ahe;nr.transactionFilter=ohe;nr.transactionExtender=lhe;TC.reconfigure=mn.define();function $u(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 Uh{eq(t){return this==t}range(t,n=t){return ov.create(t,n,this)}}Uh.prototype.startSide=Uh.prototype.endSide=0;Uh.prototype.point=!1;Uh.prototype.mapMode=ua.TrackDel;function N8(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}class ov{constructor(t,n,r){this.from=t,this.to=n,this.value=r}static create(t,n,r){return new ov(t,n,r)}}function WM(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class j8{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);sp||h==p&&u.startSide>0&&u.endSide<=0)continue;(p-h||u.endSide-u.startSide)<0||(a<0&&(a=h),u.point&&(l=Math.max(l,p-h)),r.push(u),i.push(h-a),s.push(p-a))}return{mapped:r.length?new j8(i,s,r,l):null,pos:a}}}class Yn{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 Yn(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(WM)),this.isEmpty)return n.length?Yn.of(n):this;let l=new fhe(this,null,-1).goto(0),c=0,u=[],d=new Wd;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 lv.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,n=0){return lv.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=AH(a,l,r),u=new Cy(a,c,s),d=new Cy(l,c,s);r.iterGaps((f,h,p)=>CH(u,f,d,h,p,i)),r.empty&&r.length==0&&CH(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=AH(s,a),c=new Cy(s,l,0).goto(r),u=new Cy(a,l,0).goto(r);for(;;){if(c.to!=u.to||!ZM(c.active,u.active)||c.point&&(!u.point||!N8(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 Cy(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 Wd;for(let i of t instanceof ov?[t]:n?bnt(t):t)r.add(i.from,i.to,i.value);return r.finish()}static join(t){if(!t.length)return Yn.empty;let n=t[t.length-1];for(let r=t.length-2;r>=0;r--)for(let i=t[r];i!=Yn.empty;i=i.nextLayer)n=new Yn(i.chunkPos,i.chunk,n,Math.max(i.maxPoint,n.maxPoint));return n}}Yn.empty=new Yn([],[],null,-1);function bnt(e){if(e.length>1)for(let t=e[0],n=1;n0)return e.slice().sort(WM);t=r}return e}Yn.empty.nextLayer=Yn.empty;class Wd{finishChunk(t){this.chunks.push(new j8(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 Wd)).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(Yn.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let n=Yn.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,n}}function AH(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 fhe(a,n,r,s));return i.length==1?i[0]:new lv(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--)nI(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--)nI(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(),nI(this.heap,0)}}}function nI(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 Cy{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=lv.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){_E(this.active,t),_E(this.activeTo,t),_E(this.activeRank,t),this.minActive=NH(this.active,this.activeTo)}addActive(t){let n=0,{value:r,to:i,rank:s}=this.cursor;for(;n0;)n++;AE(this.active,n,r),AE(this.activeTo,n,i),AE(this.activeRank,n,s),t&&AE(t,n,this.cursor.from),this.minActive=NH(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&&_E(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 CH(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,p=h<0?e.to+c:n.to,b=Math.min(p,a);if(e.point||n.point?(e.point&&n.point&&N8(e.point,n.point)&&ZM(e.activeForPoint(e.to),n.activeForPoint(n.to))||s.comparePoint(l,b,e.point,n.point),d=!1):(d&&s.boundChange(l),b>l&&!ZM(e.active,n.active)&&s.compareRange(l,b,e.active,n.active),u&&ba)break;l=p,h<=0&&e.next(),h>=0&&n.next()}}function ZM(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 NH(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=Gs(e,i)}return r===!0?-1:e.length}const JM="ͼ",jH=typeof Symbol>"u"?"__"+JM:Symbol.for(JM),e3=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),RH=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class zh{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 p in l){let b=l[p];if(/&/.test(p))s(p.split(/,\s*/).map(g=>a.map(O=>g.replace(/&/,O))).reduce((g,O)=>g.concat(O)),b,c);else if(b&&typeof b=="object"){if(!f)throw new RangeError("The value of a property ("+p+") should be a primitive value.");s(i(p),b,d,h)}else b!=null&&d.push(p.replace(/_.*/,"").replace(/[A-Z]/g,g=>"-"+g.toLowerCase())+": "+b+";")}(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=RH[jH]||1;return RH[jH]=t+1,JM+t.toString(36)}static mount(t,n,r){let i=t[e3],s=r&&r.nonce;i?s&&i.setNonce(s):i=new Ont(t,s),i.mount(Array.isArray(n)?n:[n],t)}}let IH=new Map;class Ont{constructor(t,n){let r=t.ownerDocument||t,i=r.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let s=IH.get(r);if(s)return t[e3]=s;this.sheet=new i.CSSStyleSheet,IH.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],t[e3]=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:'"'},ynt=typeof navigator<"u"&&/Mac/.test(navigator.platform),xnt=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var oa=0;oa<10;oa++)Vh[48+oa]=Vh[96+oa]=String(oa);for(var oa=1;oa<=24;oa++)Vh[oa+111]="F"+oa;for(var oa=65;oa<=90;oa++)Vh[oa]=String.fromCharCode(oa+32),cv[oa]=String.fromCharCode(oa);for(var rI in Vh)cv.hasOwnProperty(rI)||(cv[rI]=Vh[rI]);function vnt(e){var t=ynt&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||xnt&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?cv:Vh)[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 Xr(){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 Et={mac:MH||/Mac/.test(Fa.platform),windows:/Win/.test(Fa.platform),linux:/Linux|X11/.test(Fa.platform),ie:_C,ie_version:phe?t3.documentMode||6:r3?+r3[1]:n3?+n3[1]:0,gecko:DH,gecko_version:DH?+(/Firefox\/(\d+)/.exec(Fa.userAgent)||[0,0])[1]:0,chrome:!!iI,chrome_version:iI?+iI[1]:0,ios:MH,android:/Android\b/.test(Fa.userAgent),webkit:PH,webkit_version:PH?+(/\bAppleWebKit\/(\d+)/.exec(Fa.userAgent)||[0,0])[1]:0,safari:i3,safari_version:i3?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Fa.userAgent)||[0,0])[1]:0,tabSize:t3.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function R8(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 G2=Object.create(null);function I8(e,t,n){if(e==t)return!0;e||(e=G2),t||(t=G2);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 wnt(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 LH(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 Snt(e){let t=Object.create(null);for(let n=0;n0?3e8:-4e8:n>0?1e8:-1e8,new Rm(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}=mhe(t,n);r=(s?n?-3e8:-1:5e8)-1,i=(a?n?2e8:1:-6e8)+1}return new Rm(t,r,i,n,t.widget||null,!0)}static line(t){return new Nw(t)}static set(t,n=!1){return Yn.of(t,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Vt.none=Yn.empty;class Cw extends Vt{constructor(t){let{start:n,end:r}=mhe(t);super(n?-1:5e8,r?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?R8(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||G2}eq(t){return this==t||t instanceof Cw&&this.tagName==t.tagName&&I8(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)}}Cw.prototype.point=!1;class Nw extends Vt{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof Nw&&this.spec.class==t.spec.class&&I8(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)}}Nw.prototype.mapMode=ua.TrackBefore;Nw.prototype.point=!0;class Rm extends Vt{constructor(t,n,r,i,s,a){super(n,r,s,t),this.block=i,this.isReplace=a,this.mapMode=i?n<=0?ua.TrackBefore:ua.TrackAfter:ua.TrackDel}get type(){return this.startSide!=this.endSide?pa.WidgetRange:this.startSide<=0?pa.WidgetBefore:pa.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof Rm&&Ent(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)}}Rm.prototype.point=!0;function mhe(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 Ent(e,t){return e==t||!!(e&&t&&e.compare(t))}function Z0(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 uv extends Uh{constructor(t,n,r){super(),this.tagName=t,this.attributes=n,this.rank=r}eq(t){return t==this||t instanceof uv&&this.tagName==t.tagName&&I8(this.attributes,t.attributes)}static create(t){return new uv(t.tagName,t.attributes||G2,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(t,n=!1){return Yn.of(t,n)}}uv.prototype.startSide=uv.prototype.endSide=-1;function dv(e){let t;return e.nodeType==11?t=e.getSelection?e:e.ownerDocument:t=e,t.getSelection()}function s3(e,t){return t?e==t||e.contains(t.nodeType!=1?t.parentNode:t):!1}function K1(e,t){if(!t.anchorNode)return!1;try{return s3(e,t.anchorNode)}catch{return!1}}function J1(e){return e.nodeType==3?hv(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function ex(e,t,n,r){return n?$H(e,t,n,r,-1)||$H(e,t,n,r,1):!1}function qh(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function Y2(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function $H(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:Zd(e))){if(e.nodeName=="DIV")return!1;let s=e.parentNode;if(!s||s.nodeType!=1)return!1;t=qh(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?Zd(e):0}else return!1}}function Zd(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function fv(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 knt(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 ghe(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 Tnt(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,p=d==c.body,b=1,g=1;if(p)h=knt(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:b,scaleY:g}=ghe(d,v)),h={left:v.left,right:v.left+d.clientWidth*b,top:v.top,bottom:v.top+d.clientHeight*g}}let O=0,y=0;if(i=="nearest")t.top0&&t.bottom>h.bottom+y&&(y=t.bottom-h.bottom+a)):t.bottom>h.bottom-a&&(y=t.bottom-h.bottom+a,n<0&&t.top-y0&&t.right>h.right+O&&(O=t.right-h.right+s)):t.right>h.right-s&&(O=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 bhe(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 _nt{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?Zd(n):0),r,Math.min(t.focusOffset,r?Zd(r):0))}set(t,n,r,i){this.anchorNode=t,this.anchorOffset=n,this.focusNode=r,this.focusOffset=i}}let Pp=null;Et.safari&&Et.safari_version>=26&&(Pp=!1);function Ohe(e){if(e.setActive)return e.setActive();if(Pp)return e.focus(Pp);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(Pp==null?{get preventScroll(){return Pp={preventScroll:!0},!0}}:void 0),!Pp){Pp=!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 xhe(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=Zd(n)}else if(n.parentNode&&!Y2(n))r=qh(n),n=n.parentNode;else return null}}function vhe(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 Ehe(e,t){if(e.length!=t.length)return!1;for(let n=0;n=0;g-=3)if(Yc[g+1]==-p){let O=Yc[g+2],y=O&2?i:O&4?O&1?s:i:0;y&&(ei[f]=ei[Yc[g]]=y),l=g;break}}else{if(Yc.length==189)break;Yc[l++]=f,Yc[l++]=h,Yc[l++]=c}else if((b=ei[f])==2||b==1){let g=b==i;c=g?0:1;for(let O=l-3;O>=0;O-=3){let y=Yc[O+2];if(y&2)break;if(g)Yc[O+2]|=2;else{if(y&4)break;Yc[O+2]|=4}}}}}function Pnt(e,t,n,r){for(let i=0,s=r;i<=n.length;i++){let a=i?n[i-1].to:e,l=ic;)b==O&&(b=n[--g].from,O=g?n[g-1].to:e),ei[--b]=p;c=d}else s=u,c++}}}function o3(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 mu(c,g.from,p));let O=g.direction==Im!=!(p%2);l3(e,O?r+1:r,i,g.inner,g.from,g.to,a),c=g.to}b=g.to}else{if(b==n||(d?ei[b]!=l:ei[b]==l))break;b++}h?o3(e,c,b,r+1,i,h,a):ct;){let d=!0,f=!1;if(!u||c>s[u-1].to){let g=ei[c-1];g!=l&&(d=!1,f=g==16)}let h=!d&&l==1?[]:null,p=d?r:r+1,b=c;e:for(;;)if(u&&b==s[u-1].to){if(f)break e;let g=s[--u];if(!d)for(let O=g.from,y=u;;){if(O==t)break e;if(y&&s[y-1].to==O)O=s[--y].from;else{if(ei[O-1]==l)break e;break}}if(h)h.push(g);else{g.toei.length;)ei[ei.length]=256;let r=[],i=t==Im?0:1;return l3(e,i,i,n,0,e.length,r),r}function khe(e){return[new mu(0,e,0)]}let The="";function Lnt(e,t,n,r,i){var s;let a=r.head-e.from,l=mu.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=Gs(e.text,a,c.forward(i,n));(dc.to)&&(d=u),The=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)}),Dhe=kt.define({combine:e=>e.some(t=>t)}),Phe=kt.define();class J0{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 J0(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 J0(Fe.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const CE=mn.define({map:(e,t)=>e.map(t)}),Mhe=mn.define();function po(e,t,n){let r=e.facet(Nhe);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 xd=kt.define({combine:e=>e.length?e[0]:!0});let Bnt=0;const T0=kt.define({combine(e){return e.filter((t,n)=>{for(let r=0;r{let c=[];return a&&c.push(AC.of(u=>{let d=u.plugin(l);return d?a(d):Vt.none})),s&&c.push(s(l)),c})}static fromClass(t,n){return Ki.define((r,i)=>new t(r,i),n)}}class sI{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(po(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){po(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){po(t.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Lhe=kt.define(),L8=kt.define(),AC=kt.define(),$he=kt.define(),$8=kt.define(),jw=kt.define(),Bhe=kt.define();function QH(e,t){let n=e.state.facet(Bhe);if(!n.length)return n;let r=n.map(s=>s instanceof Function?s(e):s),i=[];return Yn.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 p=l[h].spec.bidiIsolate,b;if(p==null&&(p=$nt(t.text,u,d)),c>0&&f.length&&(b=f[f.length-1]).to==u&&b.direction==p)b.to=d,f=b.inner;else{let g={from:u,to:d,direction:p,inner:[]};f.push(g),f=g.inner}}}}),i}const Qhe=kt.define();function B8(e){let t=0,n=0,r=0,i=0;for(let s of e.state.facet(Qhe)){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 c1=kt.define();class Dl{constructor(t,n,r,i){this.fromA=t,this.toA=n,this.fromB=r,this.toB=i}join(t){return new Dl(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 Dl(s,a,l,c))),this.changedRanges=i}static create(t,n,r){return new W2(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 Qnt=[];class Zi{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 Qnt}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&&wnt(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=qh(this.dom),i=this.length?t>0:n>0;return new yc(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 NC)return t;return null}static get(t){return t.cmTile}}class CC extends Zi{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=FH(i);else n.insertBefore(l.dom,i);r=l.dom}for(i=r?r.nextSibling:n.firstChild,s&&i&&(s.written=!0);i;)i=FH(i);this.length=a}}function FH(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class NC extends CC{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=Zi.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 Bd)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 Bd extends CC{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 Bd(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}}class zb extends CC{constructor(t,n){super(t),this.attrs=n}isLine(){return!0}static start(t,n,r){let i=new zb(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,p=0;h=f&&(b.isComposite()?c(b,f-p):(!a||a.isHidden&&(n>0&&!(a.flags&32)||r&&Unt(a,b)))&&(g>f||b.flags&32)?(a=b,l=f-p):(pi&&(t=i);let s=t,a=t,l=0;t==0&&n<0||t==i&&n>=0?Et.chrome||Et.gecko||(t?(s--,l=1):a=0)?0:c.length-1];return Et.safari&&!l&&u.width==0&&(u=Array.prototype.find.call(c,d=>d.width)||u),r==null?u:fv(u,(l?l>0:n<0)==r)}static of(t,n){let r=new Zp(n||document.createTextNode(t),t);return n||(r.flags|=2),r}}class Dm extends Zi{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 fv(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 znt{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 uo&&u.mark.eq(c.mark))u.dom!=c.dom&&u.setDOM(aI(c.dom)),i=u;else{if(this.cache.reused.get(c)){let f=Zi.get(c.dom);f&&f.setDOM(aI(c.dom))}let d=uo.of(c.mark,c.dom);i.append(d),i=d}this.cache.reused.set(c,2)}let s=Zi.get(t.text);s&&this.cache.reused.set(s,2);let a=new Zp(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=Fhe);let i=zb.start(t,n||((r=this.cache.find(zb))===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 uo&&l.mark.eq(a))i=l,n--;else{let c=uo.of(a,(r=this.cache.find(uo,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||!UH(this.curLine,!1)||t.dom.nodeName!="BR"&&t.isWidget()&&!(Et.ios&&UH(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(oI,0,32)||new Dm(oI.toDOM(),0,oI,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 Vnt(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(Z2,void 0,1);return r&&(r.flags=n),r||new Z2(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class Hnt{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 K2=[Dm,zb,Zp,uo,Z2,Bd,NC];for(let e=0;e[]),this.index=K2.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 uo&&i.unshift(a.mark)),this.openWidget=!1},leave:a=>{a.isLine()?i.length&&(i.length=s=0):a instanceof uo&&(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=Yn.spans(this.decorations,t,n,{point:(l,c,u,d,f,h)=>{if(u instanceof Rm){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 p=u.widget||(u.block?Vb.block:Vb.inline),b=Ynt(u),g=this.cache.findWidget(p,c-l,b)||Dm.of(p,this.view,c-l,b);u.block?(u.startSide>0&&i.addLineStartIfNotCovered(r),i.addBlockWidget(g)):(i.ensureLine(r),i.addInlineWidget(g,d,f))}r=null}else r=Wnt(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=Zi.get(i);if(i==this.view.contentDOM)break;s instanceof uo?n.push(s):s!=null&&s.isLine()?r=s:s instanceof Bd||(i.nodeName=="DIV"&&!r&&i!=this.view.contentDOM?r=new zb(i,Fhe):r||n.push(uo.of(new Cw({tagName:i.nodeName.toLowerCase(),attributes:Snt(i)}),i)))}return{line:r,marks:n}}}function UH(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 Ynt(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 Fhe={class:"cm-line"};function Wnt(e,t){let n=t.spec.attributes,r=t.spec.class;return!n&&!r||(e||(e={class:"cm-line"}),n&&R8(n,e),r&&(e.class+=" "+r)),e}function Znt(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 uo&&t.push(r.mark)}return t}function aI(e){let t=Zi.get(e);return t&&t.setDOM(e.cloneNode()),e}class Vb extends Pc{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}}Vb.inline=new Vb("span");Vb.block=new Vb("div");const oI=new class extends Pc{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class zH{constructor(t){this.view=t,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Vt.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 NC(t,t.contentDOM),this.updateInner([new Dl(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:!art(t.changes,this.hasComposition)&&!t.selectionSet&&(i=t.state.selection.main.head));let s=i>-1?Jnt(this.view,t.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:d,to:f}=this.hasComposition;r=new Dl(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,(Et.ie||Et.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=nrt(a,this.decorations,t.changes);c.length&&(r=Dl.extendWithRanges(r,c));let u=irt(l,this.blockWrappers,t.changes);return u.length&&(r=Dl.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 Gnt(this.view,a,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&Zi.get(n.text)&&l.cache.reused.set(Zi.get(n.text),2),this.tile=l.run(t,n),u3(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=Et.chrome||Et.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)&&K1(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)),Et.gecko&&c.empty&&!this.hasComposition&&Knt(u)){let h=document.createTextNode("");this.view.observer.ignore(()=>u.node.insertBefore(h,u.node.childNodes[u.offset]||null)),u=d=new yc(h,0),l=!0}let f=this.view.observer.selectionRange;(l||!f.focusNode||(!ex(u.node,u.offset,f.anchorNode,f.anchorOffset)||!ex(d.node,d.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,c))&&(this.view.observer.ignore(()=>{Et.android&&Et.chrome&&r.contains(f.focusNode)&&srt(f.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let h=dv(this.view.root);if(h)if(c.empty){if(Et.gecko){let p=ert(u.node,u.offset);if(p&&p!=3){let b=(p==1?xhe:vhe)(u.node,u.offset);b&&(u=new yc(b.node,b.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 p=document.createRange();c.anchor>c.head&&([u,d]=[d,u]),p.setEnd(d.node,d.offset),p.setStart(u.node,u.offset),h.removeAllRanges(),h.addRange(p)}a&&this.view.root.activeElement==r&&(r.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(u,d)),this.impreciseAnchor=u.precise?null:new yc(f.anchorNode,f.anchorOffset),this.impreciseHead=d.precise?null:new yc(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(t,n){return this.hasComposition&&n.empty&&ex(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=dv(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=Zd(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&&!Zi.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 lI?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==ti.LTR,u=0,d=(f,h,p)=>{for(let b=0;bi);b++){let g=f.children[b],O=h+g.length,y=g.dom.getBoundingClientRect(),{height:v}=y;if(p&&!b&&(u+=y.top-p.top),g instanceof Bd)O>r&&d(g,h,y);else if(h>=r&&(u>0&&n.push(-u),n.push(v+u),u=0,a)){let x=g.dom.lastChild,w=x?J1(x):[];if(w.length){let S=w[w.length-1],E=c?S.right-y.left:y.right-S.left;E>l&&(l=E,this.minWidth=s,this.minWidthFrom=h,this.minWidthTo=O)}}p&&b==f.children.length-1&&(u+=p.bottom-y.bottom),h=O+g.breakAfter}};return d(this.tile,0,null),n}textDirectionAt(t){let{tile:n}=this.tile.resolveBlock(t,1);return getComputedStyle(n.dom).direction=="rtl"?ti.RTL:ti.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=J1(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=J1(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(Vt.replace({widget:new lI(l),block:!0,inclusive:!0,isBlockGap:!0}).range(r,a))}if(!s)break;r=s.to+1}return Vt.set(t)}updateDeco(){let t=1,n=this.view.state.facet(AC).map(s=>(this.dynamicDecorationMap[t++]=typeof s=="function")?s(this.view):s),r=!1,i=this.view.state.facet($8).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(Yn.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(Phe))try{if(u(this.view,t.range,t))return!0}catch(d){po(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=B8(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(Tnt(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(){u3(this.tile)}}function u3(e,t){let n=t==null?void 0:t.get(e);if(n!=1){n==null&&e.destroy();for(let r of e.children)u3(r,t)}}function Knt(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 Uhe(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=xhe(n.focusNode,n.focusOffset),i=vhe(n.focusNode,n.focusOffset),s=r||i;if(i&&r&&i.node!=r.node){let l=Zi.get(i.node);if(!l||l.isText()&&l.text!=i.node.nodeValue)s=i;else if(e.docView.lastCompositionAfterCursor){let c=Zi.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 Jnt(e,t,n){let r=Uhe(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 Dl(c.mapPos(s),c.mapPos(a),s,a),text:i}}function ert(e,t){return e.nodeType!=1?0:(t&&e.childNodes[t-1].contentEditable=="false"?1:0)|(t{rt.from&&(n=!0)}),n}class lI extends Pc{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 ort(e,t,n=1){let r=e.charCategorizer(t),i=e.doc.lineAt(t),s=t-i.from;if(i.length==0)return Fe.cursor(t);s==0?n=1:s==i.length&&(n=-1);let a=s,l=s;n<0?a=Gs(i.text,s,!1):l=Gs(i.text,s);let c=r(i.text.slice(a,l));for(;a>0;){let u=Gs(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+KM(a,s,e.state.tabSize)}function d3(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==pa.Text&&(i.type!=s.type||(n<0?s.fromt)))&&(i=s)}}return i||r}return r}function crt(e,t,n,r){let i=d3(e,t.head,t.assoc||-1),s=!r||i.type!=pa.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==ti.LTR)?a.right-1:a.left+1,y:(s.top+s.bottom)/2});if(c!=null)return Fe.cursor(c,n?-1:1)}return Fe.cursor(n?i.to:i.from,n?-1:1)}function VH(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=Lnt(i,s,a,l,n),d=The;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 urt(e,t,n){let r=e.state.charCategorizer(t),i=r(n);return s=>{let a=r(s);return i==Ai.Space&&(i=a),i==a}}function drt(e,t,n,r){let i=t.head,s=n?1:-1;if(i==(n?e.state.doc.length:0))return Fe.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 b=e.viewState.lineBlockAt(i);a==null&&(a=Math.min(c.right-c.left,e.defaultCharacterWidth*(i-b.from))),l=(s<0?b.top:b.bottom)+d}let f=c.left+a,h=e.viewState.heightOracle.textHeight>>1,p=r??h;for(let b=0;;b+=h){let g=l+(p+b)*s,O=f3(e,{x:f,y:g},!1,s);if(n?g>c.bottom:gl:v{if(t>s&&ti(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:Fe.cursor(r,re.viewState.docHeight)return new lu(e.state.doc.length,-1);if(u=e.elementAtHeight(c),r==null)break;if(u.type==pa.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==pa.Text){let f=lrt(e,i,u,a,l);return new lu(f,f==u.from?1:-1)}}if(u.type!=pa.Text)return c<(u.top+u.bottom)/2?new lu(u.from,1):new lu(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 frt(e,a,l,e.textDirectionAt(u.from)).scanTile(d,u.from)}class frt{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(g)){let y=i+Math.floor(Math.random()*b);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(b+b+g)/3)return this.y=c.bottom-1,this.scan(t,n,!0);if(u&&u.top<(b+g+g)/3)return this.y=u.top+1,this.scan(t,n,!0)}let p=(l?this.dirAt(t[d],1):this.baseDir)==ti.LTR;return{i:d,after:this.x>(h.left+h.right)/2==p}}scanText(t,n){let r=[];for(let s=0;s{let a=r[s]-n,l=r[s+1]-n;return hv(t.dom,a,l).getClientRects()});return i.after?new lu(r[i.i+1],-1):new lu(r[i.i],1)}scanTile(t,n){if(!t.length)return new lu(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:hv(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 lu(r[i.i+1],-1):new lu(a,1)}}const Zg="￿";class hrt{constructor(t,n){this.points=t,this.view=n,this.text="",this.lineSeparator=n.state.facet(nr.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=Zg}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=Zi.get(i),l=i.nextSibling;if(l==n){a!=null&&a.breakAfter&&!l&&r!=this.view.contentDOM&&this.lineBreak();break}let c=Zi.get(l);(a&&c?a.breakAfter:(a?a.breakAfter:Y2(i))||Y2(l)&&(i.nodeName!="BR"||a!=null&&a.isWidget())&&this.text.length>s)&&!mrt(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=Zi.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+(prt(t,r.node,r.offset)?n:0))}}function prt(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=Vhe(t.docView.tile,n,r,0))){let c=s||a?[]:Ort(t),u=new hrt(c,t);u.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=u.text,this.newSel=yrt(c,this.bounds.from)}else{let c=t.observer.selectionRange,u=s&&s.node==c.focusNode&&s.offset==c.focusOffset||!s3(t.contentDOM,c.focusNode)?l.main.head:t.docView.posFromDOM(c.focusNode,c.focusOffset),d=a&&a.node==c.anchorNode&&a.offset==c.anchorOffset||!s3(t.contentDOM,c.anchorNode)?l.main.anchor:t.docView.posFromDOM(c.anchorNode,c.anchorOffset),f=t.viewport;if((Et.ios||Et.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(Fe.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),p=0;h&&(p=t.inputState.lastTouchY<=h.bottom?-1:1),this.newSel=Fe.create([Fe.cursor(u,p)])}else this.newSel=Fe.single(d,u)}}}function Vhe(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 Vhe(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 qhe(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||Et.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:Tr.of(t.text.slice(s.from-l,h).split(Zg))}:(p=Hhe(f,t.text,u-l,d))&&(Et.chrome&&a==13&&p.toB==p.from+2&&t.text.slice(p.from,p.toB)==Zg+Zg&&p.toB--,n={from:l+p.from,to:l+p.toA,insert:Tr.of(t.text.slice(p.from,p.toB).split(Zg))})}else r&&(!e.hasFocus&&i.facet(xd)||J2(r,s))&&(r=null);if(!n&&!r)return!1;if((Et.mac||Et.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=Fe.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:Tr.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)}:Et.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==` - `&&e.lineWrapping&&(r&&(r=Fe.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:Tr.of([" "])}),n)return Q8(e,n,r,a);if(r&&!J2(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=zhe(i.facet(jw).map(u=>u(e)),r))),e.dispatch({selection:r,scrollIntoView:l,userEvent:c}),!0}else return!1}function Q8(e,t,n,r=-1){if(Et.ios&&e.inputState.flushIOSKey(t))return!0;let i=e.state.selection.main;if(Et.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&&K0(e.contentDOM,"Enter",13)||(t.from==i.from-1&&t.to==i.to&&t.insert.length==0||r==8&&t.insert.lengthi.head)&&K0(e.contentDOM,"Backspace",8)||t.from==i.from&&t.to==i.to+1&&t.insert.length==0&&K0(e.contentDOM,"Delete",46)))return!0;let s=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let a,l=()=>a||(a=brt(e,t,n));return e.state.facet(jhe).some(c=>c(e,t.from,t.to,s,l))||e.dispatch(l()),!0}function brt(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:Fe.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&&Uhe(e,n.main.head);if(h){let b=t.insert.length-(t.to-t.from);f={from:h.from,to:h.to-b}}else f=e.state.doc.lineAt(s.head);let p=s.to-t.to;r=i.changeByRange(b=>{if(b.from==s.from&&b.to==s.to)return{changes:c,range:u||b.map(c)};let g=b.to-p,O=g-d.length;if(e.state.sliceDoc(O,g)!=d||g>=f.from&&O<=f.to)return{range:b};let y=i.changes({from:O,to:g,insert:t.insert}),v=b.to-s.to;return{changes:y,range:u?Fe.range(Math.max(0,u.anchor+v),Math.max(0,u.head+v)):b.map(y)}})}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 Hhe(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 Ort(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 qH(n,r)),(i!=n||s!=r)&&t.push(new qH(i,s))),t}function yrt(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?Fe.single(n+t,r+t):null}function J2(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class xrt{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,Et.safari&&t.contentDOM.addEventListener("input",()=>null),Et.gecko&&Mrt(t.contentDOM.ownerDocument)}handleEvent(t){!Crt(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=wrt(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&&Ghe.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),Et.android&&Et.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;if(Et.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&(Xhe.some(n=>n.keyCode==t.keyCode)&&!t.ctrlKey||Srt.indexOf(t.key)>-1&&t.ctrlKey)){let n={ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey,shiftKey:t.shiftKey};return n.shiftKey&&Et.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&vrt(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:Et.safari&&!Et.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 vrt(e){return e.visualViewport?e.visualViewport.height*e.visualViewport.scale/e.document.documentElement.clientHeight<.85:!1}function HH(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(i){po(n.state,i)}}}function wrt(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(HH(r.value,c))}if(a)for(let l in a){let c=a[l];c&&n(l).observers.push(HH(r.value,c))}}for(let r in Ac)n(r).handlers.push(Ac[r]);for(let r in Wa)n(r).observers.push(Wa[r]);return t}const Xhe=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Srt="dthko",Ghe=[16,17,18,20,91,92,224,225],NE=6;function jE(e){return Math.max(0,e)*.7+8}function Ert(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}class krt{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=bhe(t.contentDOM),this.atoms=t.state.facet(jw).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(nr.allowMultipleSelections)&&Trt(t,n),this.dragging=Art(t,n)&&Zhe(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&&Ert(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=B8(this.view);t.clientX-c.left<=i+NE?n=-jE(i-t.clientX):t.clientX+c.right>=a-NE&&(n=jE(t.clientX-a)),t.clientY-c.top<=s+NE?r=-jE(s-t.clientY):t.clientY+c.bottom>=l-NE&&(r=jE(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=zhe(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 Trt(e,t){let n=e.state.facet(_he);return n.length?n[0](t):Et.mac?t.metaKey:t.ctrlKey}function _rt(e,t){let n=e.state.facet(Ahe);return n.length?n[0](t):Et.mac?!t.altKey:!t.ctrlKey}function Art(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=dv(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 Crt(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=Zi.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(t))return!1;return!0}const Ac=Object.create(null),Wa=Object.create(null),Yhe=Et.ie&&Et.ie_version<15||Et.ios&&Et.webkit_version<604;function Nrt(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(),Whe(e,n.value)},50)}function jC(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function Whe(e,t){t=jC(e.state,P8,t);let{state:n}=e,r,i=1,s=n.toText(t),a=s.lines==n.selection.ranges.length;if(h3!=null&&n.selection.ranges.every(c=>c.empty)&&h3==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:Fe.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:Fe.cursor(c.from+u.length)}}):r=n.replaceSelection(s);e.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Wa.scroll=e=>{let t=e.inputState;t.lastScrollTop=e.scrollDOM.scrollTop,t.lastScrollLeft=e.scrollDOM.scrollLeft,Et.ios&&!t.touchActive&&(t.lastIOSMomentumScroll=Date.now())};Wa.wheel=Wa.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()};Ac.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1);Wa.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")};Wa.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")};Wa.touchend=(e,t)=>{e.inputState.touchActive=!1};Ac.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(Che))if(n=r(e,t),n)break;if(!n&&t.button==0&&(n=Rrt(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new krt(e,t,n,r)),r&&e.observer.ignore(()=>{Ohe(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 XH(e,t,n,r){if(r==1)return Fe.cursor(t,n);if(r==2)return ort(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?(YH+1)%3:1}function Rrt(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=Zhe(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=XH(e,c.pos,c.assoc,r);if(n.pos!=c.pos&&!a){let f=XH(e,n.pos,n.assoc,r),h=Math.min(f.from,d.from),p=Math.max(f.to,d.to);d=h1&&(u=Irt(i,c.pos))?u:l?i.addRange(d):Fe.create([d])}}}function Irt(e,t){for(let n=0;n=t)return Fe.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}Ac.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=Fe.undirectionalRange(s,a))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",jC(e.state,M8,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1};Ac.dragend=e=>(e.inputState.draggedContent=null,!1);function ZH(e,t,n,r){if(n=jC(e.state,P8,n),!n)return;let i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:s}=e.inputState,a=r&&s&&_rt(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}Ac.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&&ZH(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 ZH(e,t,r,!0),!0}return!1};Ac.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=Yhe?null:t.clipboardData;return n?(Whe(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(Nrt(e),!1)};function Drt(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 Prt(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:jC(e,M8,t.join(e.lineBreak)),ranges:n,linewise:r}}let h3=null;Ac.copy=Ac.cut=(e,t)=>{if(!K1(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:i}=Prt(e.state);if(!n&&!i)return!1;h3=i?n:null,t.type=="cut"&&!e.state.readOnly&&e.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=Yhe?null:t.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(Drt(e,n),!1)};const Khe=Lu.define();function Jhe(e,t){let n=[];for(let r of e.facet(Rhe)){let i=r(e,t);i&&n.push(i)}return n.length?e.update({effects:n,annotations:Khe.of(!0)}):null}function epe(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=Jhe(e.state,t);n?e.dispatch(n):e.update([])}},10)}Wa.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),epe(e)};Wa.blur=e=>{e.observer.clearSelectionRange(),epe(e)};Wa.compositionstart=Wa.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange==null&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))};Wa.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,Et.chrome&&Et.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))};Wa.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()};Ac.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 Q8(e,{from:c,to:u,insert:e.state.toText(s)},null),!0}}let i;if(Et.chrome&&Et.android&&(i=Xhe.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 Et.ios&&t.inputType=="deleteContentForward"&&e.observer.flushSoon(),Et.safari&&t.inputType=="insertText"&&e.inputState.composing>=0&&setTimeout(()=>Wa.compositionend(e,t),20),!1};const KH=new Set;function Mrt(e){KH.has(e)||(KH.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}const JH=["pre-wrap","normal","pre-line","break-spaces"];let qb=!1;function eX(){qb=!1}class Lrt{constructor(t){this.lineWrapping=t,this.doc=Tr.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 JH.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)>Jk&&(qb=!0),this.height=t)}replace(t,n,r){return Ga.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,ci.ByPosNoHeight,r.setDoc(n),0,0),p=h.to>=u?h:s.lineAt(u,ci.ByPosNoHeight,r,0,0);for(f+=p.to-u,u=p.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,ci.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 Fo extends tpe{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 gc(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 Fo||i instanceof aa&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof aa?i=new Fo(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):Ga.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 Ga{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 Ga.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)>=Jk&&(c=-2);let p=new Fo(d,f,h);p.outdated=!1,a.push(p),l+=d+1}l<=s&&a.push(null,new aa(s-l).updateHeight(t,l));let u=Ga.of(a);return(c<0||Math.abs(u.height-this.height)>=Jk||Math.abs(c-this.heightMetrics(t,n).perLine)>=Jk)&&(qb=!0),e_(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 Qrt extends Ga{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==ci.ByPosNoHeight?ci.ByPosNoHeight:ci.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,ci.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&&tX(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?Ga.of(this.break?[t,null,n]:[t,n]):(this.left=e_(this.left,t),this.right=e_(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 tX(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 Frt=5;class F8{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 Fo?i.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Fo(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=Frt)&&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 Fo(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 Fo)return t;let n=new Fo(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 Fo)&&!this.isCovered?this.nodes.push(new Fo(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 qrt(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left0&&t.top0}function Hrt(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class uI{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 Lrt(r),this.stateDeco=iX(n),this.heightMap=Ga.empty().applyChanges(this.stateDeco,Tr.empty,this.heightOracle.setDoc(n.doc),[new Dl(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=Vt.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 RE(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?rX:new U8(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(u1(t,this.scaler))})}update(t,n=null){this.state=t.state;let r=this.stateDeco;this.stateDeco=iX(this.state);let i=t.changedRanges,s=Dl.extendWithRanges(i,Urt(r,this.stateDeco,t?t.changes:js.empty(this.state.doc.length))),a=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);eX(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=a||qb)&&(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(Dhe)&&(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"?ti.RTL:ti.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}=ghe(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 p=bhe(this.view.contentDOM,!1).y;p!=this.scrollParent&&(this.scrollParent=p,this.scrollAnchorHeight=-1,this.scrollOffset=0);let b=this.getScrollOffset();this.scrollOffset!=b&&(this.scrollAnchorHeight=-1,this.scrollOffset=b),this.scrolledToBottom=yhe(this.scrollParent||t.win);let g=(this.printing?Hrt:Vrt)(n,this.paddingTop),O=g.top-this.pixelViewport.top,y=g.bottom-this.pixelViewport.bottom;this.pixelViewport=g;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&&!qrt(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}=t.docView.measureTextSize();a=E>0&&i.refresh(s,E,k,T,Math.max(5,x/k),S),a&&(t.docView.minWidth=0,u|=16)}O>0&&y>0?d=Math.max(O,y):O<0&&y<0&&(d=Math.min(O,y)),eX();for(let E of this.viewports){let k=E.from==this.viewport.from?S:t.docView.measureVisibleLineHeights(E);this.heightMap=(a?Ga.empty().applyChanges(this.stateDeco,Tr.empty,this.heightOracle,[new Dl(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(i,0,a,new $rt(E.from,k))}qb&&(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 RE(i.lineAt(a-r*1e3,ci.ByHeight,s,0,0).from,i.lineAt(l+(1-r)*1e3,ci.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,ci.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!=ti.LTR&&!r)return[];let l=[],c=(d,f,h,p)=>{if(f-dd&&yy.from>=h.from&&y.to<=h.to&&Math.abs(y.from-d)y.fromv));if(!O){if(fx.from<=f&&x.to>=f)){let x=n.moveToLineBoundary(Fe.cursor(f),!1,!0).head;x>d&&(f=x)}let y=this.gapSize(h,d,f,p),v=r||y<2e6?y:2e6;O=new uI(d,f,y,v)}l.push(O)},u=d=>{if(d.length2e6)for(let E of t)E.from>=d.from&&E.fromd.from&&c(d.from,p,d,f),bn.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(t){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];Yn.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)||u1(this.heightMap.lineAt(t,ci.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)||u1(this.heightMap.lineAt(this.scaler.fromDOM(t),ci.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 u1(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 RE{constructor(t,n){this.from=t,this.to=n}}function Grt(e,t,n){let r=[],i=e,s=0;return Yn.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 DE(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 Yrt(e,t){for(let n of e)if(t(n))return n}const rX={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function iX(e){let t=e.facet(AC).filter(r=>typeof r!="function"),n=e.facet($8).filter(r=>typeof r!="function");return n.length&&t.push(Yn.join(n)),t}class U8{constructor(t,n,r){let i=0,s=0,a=0;this.viewports=r.map(({from:l,to:c})=>{let u=n.lineAt(l,ci.ByPos,t,0,0).top,d=n.lineAt(c,ci.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 u1(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new gc(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(i=>u1(i,t)):e._content)}const PE=kt.define({combine:e=>e.join(" ")}),p3=kt.define({combine:e=>e.indexOf(!0)>-1}),m3=zh.newName(),npe=zh.newName(),rpe=zh.newName(),ipe={"&light":"."+npe,"&dark":"."+rpe};function g3(e,t,n){return new zh(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 Wrt=g3("."+m3,{"&":{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"}},ipe),Zrt={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},dI=Et.ie&&Et.ie_version<=11;class Krt{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new _nt,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);(Et.ie&&Et.ie_version<=11||Et.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&&Et.android&&t.constructor.EDIT_CONTEXT!==!1&&!(Et.chrome&&Et.chrome_version<126)&&(this.editContext=new eit(t),t.state.facet(xd)&&(t.contentDOM.editContext=this.editContext.editContext)),dI&&(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(xd)?r.root.activeElement!=this.dom:!K1(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}(Et.ie&&Et.ie_version<=11||Et.android&&Et.chrome)&&!r.state.selection.main.empty&&i.focusNode&&ex(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,n=dv(t.root);if(!n)return!1;let r=Et.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&Jrt(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let i=K1(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&&K0(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&&K1(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 grt(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=qhe(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!J2(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=sX(n,t.previousSibling||t.target.previousSibling,-1),i=sX(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(xd)!=t.state.facet(xd)&&(t.view.contentDOM.editContext=t.state.facet(xd)?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 sX(e,t,n){for(;t;){let r=Zi.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 aX(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 ex(a.node,a.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function Jrt(e,t){if(t.getComposedRanges){let i=t.getComposedRanges(e.root)[0];if(i)return aX(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?aX(e,n):null}class eit{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=Hhe(t.state.sliceDoc(l,c),r.text,(u?i.from:i.to)-l,u?"end":null);if(!d){let h=Fe.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));J2(h,i)||t.dispatch({selection:h,userEvent:"select"});return}let f={from:d.from+l,to:d.toA+l,insert:Tr.of(r.text.slice(d.from,d.toB).split(` -`))};if((Et.mac||Et.android)&&f.from==a-1&&/^\. ?$/.test(r.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:c,insert:Tr.of([r.text.replace("."," ")])}),this.pendingContextChange=f,!t.state.readOnly){let h=this.to-this.from+(f.to-f.from+f.insert.length);Q8(t,f,Fe.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=dv(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 pt{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||Ant(t.parent)||document,this.viewState=new nX(this,t.state||nr.create(t)),t.scrollTo&&t.scrollTo.is(CE)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(T0).map(i=>new sI(i));for(let i of this.plugins)i.update(this);this.observer=new Krt(this),this.inputState=new xrt(this),this.inputState.ensureHandlers(this.plugins),this.docView=new zH(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(Khe))?(this.inputState.notifiedFocused=a,l=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,c=Jhe(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(nr.phrases)!=this.state.facet(nr.phrases))return this.setState(s);i=W2.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:p}=h.state.selection,{x:b,y:g}=this.state.facet(pt.cursorScrollMargin);f=new J0(p.empty?p:Fe.cursor(p.head,p.head>p.anchor?-1:1),"nearest","nearest",g,b)}for(let p of h.effects)p.is(CE)&&(f=p.value.clip(this.state))}this.viewState.update(i,f),this.bidiCache=t_.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(c1)!=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(PE)!=i.state.facet(PE)&&(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(c3))try{h(i)}catch(p){po(this.state,p,"update listener")}(c||d)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),d&&!qhe(this,d)&&u.force&&K0(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 nX(this,t),this.plugins=t.facet(T0).map(r=>new sI(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new zH(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(T0),r=t.state.facet(T0);if(n!=r){let i=[];for(let s of r){let a=n.indexOf(s);if(a<0)i.push(new sI(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(yhe(r||this.win))s=-1,a=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(i);s=p.from,a=p.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(p=>{try{return p.read(this)}catch(b){return po(this.state,b),oX}}),f=W2.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 p=0;p1||b<-1)&&!(Et.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+b,r?r.scrollTop+=b:this.win.scrollBy(0,b),a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let l of this.state.facet(c3))l(n)}get themeClasses(){return m3+" "+(this.state.facet(p3)?rpe:npe)+" "+this.state.facet(PE)}updateAttrs(){let t=lX(this,Lhe,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(xd)?"true":"false",class:"cm-content",style:`${Et.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),lX(this,L8,n);let r=this.observer.ignore(()=>{let i=LH(this.contentDOM,this.contentAttrs,n),s=LH(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(pt.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(c1);let t=this.state.facet(pt.cspNonce);zh.mount(this.root,this.styleModules.concat(Wrt).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 cI(this,t,VH(this,t,n,r))}moveByGroup(t,n){return cI(this,t,VH(this,t,n,r=>urt(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 Fe.cursor(s.side(n,i)+t.from,s.forward(!n,i)?1:-1)}moveToLineBoundary(t,n,r=!0){return crt(this,t,n,r)}moveVertically(t,n,r){return cI(this,t,drt(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=f3(this,t,n);return r&&r.pos}posAndSideAtCoords(t,n=!0){return this.readMeasured(),f3(this,t,n)}coordsAtPos(t,n=1){this.readMeasured();let r=this.state.doc.lineAt(t),i=this.bidiSpans(r),s=i[mu.find(i,t-r.from,-1,n)];return this.docView.coordsAt(t,n,s.dir==ti.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(Ihe)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>tit)return khe(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||Ehe(s.isolates,r=QH(this,t))))return s.order;r||(r=QH(this,t));let i=Mnt(t.text,n,r);return this.bidiCache.push(new t_(t.from,t.to,n,r,!0,i)),i}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Et.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Ohe(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 CE.of(new J0(typeof t=="number"?Fe.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 CE.of(new J0(Fe.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 Ki.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return Ki.define(()=>({}),{eventObservers:t})}static theme(t,n){let r=zh.newName(),i=[PE.of(r),c1.of(g3(`.${r}`,t))];return n&&n.dark&&i.push(p3.of(!0)),i}static baseTheme(t){return ff.lowest(c1.of(g3("."+m3,t,ipe)))}static findFromDOM(t){var n;let r=t.querySelector(".cm-content"),i=r&&Zi.get(r)||Zi.get(t);return((n=i==null?void 0:i.root)===null||n===void 0?void 0:n.view)||null}}pt.styleModule=c1;pt.inputHandler=jhe;pt.clipboardInputFilter=P8;pt.clipboardOutputFilter=M8;pt.scrollHandler=Phe;pt.focusChangeEffect=Rhe;pt.perLineTextDirection=Ihe;pt.exceptionSink=Nhe;pt.updateListener=c3;pt.editable=xd;pt.mouseSelectionStyle=Che;pt.dragMovesSelection=Ahe;pt.clickAddsSelectionRange=_he;pt.decorations=AC;pt.blockWrappers=$he;pt.outerDecorations=$8;pt.atomicRanges=jw;pt.bidiIsolatedRanges=Bhe;pt.cursorScrollMargin=kt.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}}});pt.scrollMargins=Qhe;pt.darkTheme=p3;pt.cspNonce=kt.define({combine:e=>e.length?e[0]:""});pt.contentAttributes=L8;pt.editorAttributes=Lhe;pt.lineWrapping=pt.contentAttributes.of({class:"cm-lineWrapping"});pt.announce=mn.define();const tit=4096,oX={};class t_{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:ti.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&&R8(a,n)}return n}const nit=Et.mac?"mac":Et.windows?"win":Et.linux?"linux":"key";function rit(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 sit(e,t,n){return ape(spe(e.state),t,e,n)}let Kf=null;const ait=4e3;function oit(e,t=nit){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 p=n[a]||(n[a]=Object.create(null)),b=l.split(/ (?!$)/).map(y=>rit(y,t));for(let y=1;y{let w=Kf={view:x,prefix:v,scope:a};return setTimeout(()=>{Kf==w&&(Kf=null)},ait),!0}]})}let g=b.join(" ");i(g,!1);let O=p[g]||(p[g]={preventDefault:!1,stopPropagation:!1,run:((h=(f=p._any)===null||f===void 0?void 0:f.run)===null||h===void 0?void 0:h.slice())||[]});c&&O.run.push(c),u&&(O.preventDefault=!0),d&&(O.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(p=>f(p,b3))}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 b3=null;function ape(e,t,n,r){b3=t;let i=vnt(t),s=lo(i,0),a=ou(s)==i.length&&i!=" ",l="",c=!1,u=!1,d=!1;Kf&&Kf.view==n&&Kf.scope==r&&(l=Kf.prefix+" ",Ghe.indexOf(t.keyCode)<0&&(u=!0,Kf=null));let f=new Set,h=O=>{if(O){for(let y of O.run)if(!f.has(y)&&(f.add(y),y(n)))return O.stopPropagation&&(d=!0),!0;O.preventDefault&&(O.stopPropagation&&(d=!0),u=!0)}return!1},p=e[r],b,g;return p&&(h(p[l+ME(i,t,!a)])?c=!0:a&&(t.altKey||t.metaKey||t.ctrlKey)&&!(Et.windows&&t.ctrlKey&&t.altKey)&&!(Et.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(b=Vh[t.keyCode])&&b!=i?(h(p[l+ME(b,t,!0)])||t.shiftKey&&(g=cv[t.keyCode])!=i&&g!=b&&h(p[l+ME(g,t,!1)]))&&(c=!0):a&&t.shiftKey&&h(p[l+ME(i,t,!0)])&&(c=!0),!c&&h(p._any)&&(c=!0)),u&&(c=!0),c&&d&&t.stopPropagation(),b3=null,c}class pm{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=ope(t);return[new pm(n,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return lit(t,n,r)}}function ope(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==ti.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function uX(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 lit(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==ti.LTR,a=e.contentDOM,l=a.getBoundingClientRect(),c=ope(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),p=d3(e,r,1),b=d3(e,i,-1),g=p.type==pa.Text?p:null,O=b.type==pa.Text?b:null;if(g&&(e.lineWrapping||p.widgetLineBreaks)&&(g=uX(e,r,1,g)),O&&(e.lineWrapping||b.widgetLineBreaks)&&(O=uX(e,i,-1,O)),g&&O&&g.from==O.from&&g.to==O.to)return v(x(n.from,n.to,g));{let S=g?x(n.from,null,g):w(p,!1),E=O?x(null,n.to,O):w(b,!0),k=[];return(g||p).to<(O||b).from-(g&&O?1:0)||p.widgetLineBreaks>1&&S.bottom+e.defaultLineHeight/2R&&D.from<$)for(let M=Math.max(D.from,R),j=Math.min(D.to,$);;){let P=e.state.doc.lineAt(M);for(let L of e.bidiSpans(P)){let U=L.from+P.from,F=L.to+P.from;if(U>=j)break;F>M&&_(Math.max(U,M),S==null&&U<=R,Math.min(F,j),E==null&&F>=$,L.dir)}if(M=P.to+1,M>=j)break}return N.length==0&&_(R,S==null,$,E==null,e.textDirection),{top:T,bottom:C,horizontal:N}}function w(S,E){let k=l.top+(E?S.top:S.bottom);return{top:k,bottom:k,horizontal:[]}}}function cit(e,t){return e.constructor==t.constructor&&e.eq(t)}class uit{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(eT)!=t.state.facet(eT)&&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(eT);for(;n!cit(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,Et.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const eT=kt.define();function lpe(e){return[Ki.define(t=>new uit(t,e)),eT.of(e)]}const Hb=kt.define({combine(e){return $u(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(t,n)=>Math.min(t,n),drawRangeCursor:(t,n)=>t||n})}});function dit(e={}){return[Hb.of(e),fit,hit,pit,Dhe.of(!0)]}function cpe(e){return e.startState.facet(Hb)!=e.state.facet(Hb)}const fit=lpe({above:!0,markers(e){let{state:t}=e,n=t.facet(Hb),r=[];for(let i of t.selection.ranges){let s=i==t.selection.main;if(i.empty||n.drawRangeCursor&&!(s&&Et.ios&&n.iosSelectionHandles)){let a=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=i.empty?i:Fe.cursor(i.head,i.assoc);for(let c of pm.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=cpe(e);return n&&dX(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){dX(t.state,e)},class:"cm-cursorLayer"});function dX(e,t){t.style.animationDuration=e.facet(Hb).cursorBlinkRate+"ms"}const hit=lpe({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 pm.forRange(e,"cm-selectionBackground",i))t.push(s);if(Et.ios&&!n.empty&&e.state.facet(Hb).iosSelectionHandles){for(let i of pm.forRange(e,"cm-selectionHandle cm-selectionHandle-start",Fe.cursor(n.from,1)))t.push(i);for(let i of pm.forRange(e,"cm-selectionHandle cm-selectionHandle-end",Fe.cursor(n.to,1)))t.push(i)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||cpe(e)},class:"cm-selectionLayer"}),pit=ff.highest(pt.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"}}}})),upe=mn.define({map(e,t){return e==null?null:t.mapPos(e)}}),d1=ma.define({create(){return null},update(e,t){return e!=null&&(e=t.changes.mapPos(e)),t.effects.reduce((n,r)=>r.is(upe)?r.value:n,e)}}),mit=Ki.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(d1);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(d1)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(d1),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(d1)!=e&&this.view.dispatch({effects:upe.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 git(){return[d1,mit]}function fX(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 bit(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 Oit{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 Wd,r=n.add.bind(n);for(let{from:i,to:s}of bit(t,this.maxLength))fX(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(y.range(g,O));if(c==u)for(this.regexp.lastIndex=d-c.from;(p=this.regexp.exec(c.text))&&p.indexthis.addMatch(O,t,g,b));n=n.update({filterFrom:d,filterTo:f,filter:(g,O)=>gf,add:h})}}return n}}const O3=/x/.unicode!=null?"gu":"g",yit=new RegExp(`[\0-\b ---Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,O3),xit={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 fI=null;function vit(){var e;if(fI==null&&typeof document<"u"&&document.body){let t=document.body.style;fI=((e=t.tabSize)!==null&&e!==void 0?e:t.MozTabSize)!=null}return fI||!1}const tT=kt.define({combine(e){let t=$u(e,{render:null,specialChars:yit,addSpecialChars:null});return(t.replaceTabs=!vit())&&(t.specialChars=new RegExp(" |"+t.specialChars.source,O3)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,O3)),t}});function wit(e={}){return[tT.of(e),Sit()]}let hX=null;function Sit(){return hX||(hX=Ki.fromClass(class{constructor(e){this.view=e,this.decorations=Vt.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(tT)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new Oit({regexp:e.specialChars,decoration:(t,n,r)=>{let{doc:i}=n.state,s=lo(t[0],0);if(s==9){let a=i.lineAt(r),l=n.state.tabSize,c=_c(a.text,l,r-a.from);return Vt.replace({widget:new _it((l-c%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=Vt.replace({widget:new Tit(e,s)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(tT);e.startState.facet(tT)!=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 Eit="•";function kit(e){return e>=32?Eit:e==10?"␤":String.fromCharCode(9216+e)}class Tit extends Pc{constructor(t,n){super(),this.options=t,this.code=n}eq(t){return t.code==this.code}toDOM(t){let n=kit(this.code),r=t.state.phrase("Control character")+" "+(xit[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 _it extends Pc{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 Ait(){return Nit}const Cit=Vt.line({class:"cm-activeLine"}),Nit=Ki.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(Cit.range(i.from)),t=i.from)}return Vt.set(n)}},{decorations:e=>e.decorations});class jit extends Pc{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?J1(t.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(t.parentNode),i=fv(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 Rit(e){let t=Ki.fromClass(class{constructor(n){this.view=n,this.placeholder=e?Vt.set([Vt.widget({widget:new jit(e),side:1}).range(0)]):Vt.none}get decorations(){return this.view.state.doc.length?Vt.none:this.placeholder}},{decorations:n=>n.decorations});return typeof e=="string"?[t,pt.contentAttributes.of({"aria-placeholder":e})]:t}const y3=2e3;function Iit(e,t,n){let r=Math.min(t.line,n.line),i=Math.max(t.line,n.line),s=[];if(t.off>y3||n.off>y3||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(Fe.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=KM(u.text,a,e.tabSize,!0);if(d<0)s.push(Fe.cursor(u.to));else{let f=KM(u.text,l,e.tabSize);s.push(Fe.range(u.from+d,u.from+f))}}}return s}function Dit(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}function pX(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>y3?-1:i==r.length?Dit(e,t.clientX):_c(r.text,e.state.tabSize,n-r.from);return{line:r.number,col:s,off:i}}function Pit(e,t){let n=pX(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=pX(e,i);if(!l)return r;let c=Iit(e.state,n,l);return c.length?a?Fe.create(c.concat(r.ranges)):Fe.create(c):r}}:null}function Mit(e){let t=n=>n.altKey&&n.button==0;return pt.mouseSelectionStyle.of((n,r)=>t(r)?Pit(n,r):null)}const Lit={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},$it={style:"cursor: crosshair"};function Bit(e={}){let[t,n]=Lit[e.key||"Alt"],r=Ki.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,pt.contentAttributes.of(i=>{var s;return!((s=i.plugin(r))===null||s===void 0)&&s.isDown?$it:null})]}const LE="-10000px";class dpe{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 Qit(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const hI=kt.define({combine:e=>{var t,n,r;return{position:Et.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)||Qit}}}),mX=new WeakMap,z8=Ki.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(hI);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 dpe(e,V8,(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(hI);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=LE,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(Et.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=B8(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(hI).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=LE;continue}let p=c.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,b=p?7:0,g=h.right-h.left,O=(t=mX.get(u))!==null&&t!==void 0?t:h.bottom-h.top,y=u.offset||Uit,v=this.view.textDirection==ti.LTR,x=h.width>r.right-r.left?v?r.left:r.right-h.width:v?Math.max(r.left,Math.min(f.left-(p?14:0)+y.x,r.right-g)):Math.min(Math.max(r.left,f.left-g+(p?14:0)-y.x),r.right-g),w=this.above[l];!c.strictSide&&(w?f.top-O-b-y.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)-b;if(Sx&&T.topE&&(E=w?T.top-O-2-b:T.bottom+b+2);if(this.position=="absolute"?(d.style.top=(E-e.parent.top)/s+"px",gX(d,(x-e.parent.left)/i)):(d.style.top=E/s+"px",gX(d,x/i)),p){let T=f.left+(v?y.x:-y.x)-(x+14-7);p.style.left=T/i+"px"}u.overlap!==!0&&a.push({left:x,top:E,right:k,bottom:E+O}),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=LE}},{eventObservers:{scroll(){this.maybeMeasure()}}});function gX(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const Fit=pt.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"}}}),Uit={x:0,y:0},V8=kt.define({enables:[z8,Fit]}),n_=kt.define({combine:e=>e.reduce((t,n)=>t.concat(n),[])});class RC{static create(t){return new RC(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new dpe(t,n_,(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 zit=V8.compute([n_],e=>{let t=e.facet(n_);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:RC.create,above:t[0].above,arrow:t.some(n=>n.arrow)}}),fpe=kt.define();class Vit{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==ti.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=>po(t.state,c,"hover tooltip"))}else a(s)}get tooltip(){let t=this.view.plugin(z8),n=t?t.manager.tooltips.findIndex(r=>r.create==RC.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&&!qit(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:!Hit(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 $E=4;function qit(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-$E&&t.clientX<=r+$E&&t.clientY>=i-$E&&t.clientY<=s+$E}function Hit(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 Xit(e,t={}){let n=mn.define(),r=new WeakMap,i=ma.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,ua.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(Yit)&&!u.value||u.value==i)&&(a=[]);return a.length&&c&&r.set(a,c),a},provide:a=>n_.from(a)});const s=Ki.define(a=>new Vit(a,e,i,r,n,t.hoverTime||300));return{active:i,extension:[i,s,fpe.of(s),zit]}}function Git(e,t,n,r={}){var i;let s=e.state.facet(fpe).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 hpe(e,t){let n=e.plugin(z8);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}const Yit=mn.define(),bX=kt.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 q8(e,t){let n=e.plugin(ppe),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}const ppe=Ki.fromClass(class{constructor(e){this.input=e.state.facet(pv),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(e));let t=e.state.facet(bX);this.top=new BE(e,!0,t.topContainer),this.bottom=new BE(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(bX);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new BE(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new BE(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(pv);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=>pt.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class BE{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=OX(t);t=t.nextSibling}else this.dom.insertBefore(n.dom,t);for(;t;)t=OX(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 OX(e){let t=e.nextSibling;return e.remove(),t}const pv=kt.define({enables:ppe});function Wit(e,t){let n,r=new Promise(a=>n=a),i=a=>Zit(a,t,n);e.state.field(pI,!1)?e.dispatch({effects:mpe.of(i)}):e.dispatch({effects:mn.appendConfig.of(pI.init(()=>[i]))});let s=gpe.of(i);return{close:s,result:r.then(a=>((e.win.queueMicrotask||(c=>e.win.setTimeout(c,10)))(()=>{e.state.field(pI).indexOf(i)>-1&&e.dispatch({effects:s})}),a))}}const pI=ma.define({create(){return[]},update(e,t){for(let n of t.effects)n.is(mpe)?e=[n.value].concat(e):n.is(gpe)&&(e=e.filter(r=>r!=n.value));return e},provide:e=>pv.computeN([e],t=>t.field(e))}),mpe=mn.define(),gpe=mn.define();function Zit(e,t,n){let r=t.content?t.content(e,()=>a(null)):null;if(!r){if(r=Xr("form"),t.input){let l=Xr("input",t.input);/^(text|password|number|email|tel|url)$/.test(l.type)&&l.classList.add("cm-textfield"),l.name||(l.name="input"),r.appendChild(Xr("label",(t.label||"")+": ",l))}else r.appendChild(document.createTextNode(t.label||""));r.appendChild(document.createTextNode(" ")),r.appendChild(Xr("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=Xr("div",r,Xr("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 Kd extends Uh{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Kd.prototype.elementClass="";Kd.prototype.toDOM=void 0;Kd.prototype.mapMode=ua.TrackBefore;Kd.prototype.startSide=Kd.prototype.endSide=-1;Kd.prototype.point=!0;const nT=kt.define(),Kit=kt.define(),Jit={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Yn.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},nx=kt.define();function est(e){return[bpe(),nx.of({...Jit,...e})]}const yX=kt.define({combine:e=>e.some(t=>t)});function bpe(e){return[tst]}const tst=Ki.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(nx).map(t=>new vX(e,t)),this.fixed=!e.state.facet(yX);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(yX)!=!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=Yn.iter(this.view.state.facet(nT),this.view.viewport.from),r=[],i=this.gutters.map(s=>new nst(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==pa.Text&&a){x3(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==pa.Text){x3(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(nx),n=e.state.facet(nx),r=e.docChanged||e.heightChanged||e.viewportChanged||!Yn.eq(e.startState.facet(nT),e.state.facet(nT),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 vX(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=>pt.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==ti.LTR?{left:r,right:i}:{right:r,left:i}})});function xX(e){return Array.isArray(e)?e:[e]}function x3(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class nst{constructor(t,n,r){this.gutter=t,this.height=r,this.i=0,this.cursor=Yn.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 Ope(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=[];x3(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(Kit)){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 vX{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=xX(n.markers(t)),n.initialSpacer&&(this.spacer=new Ope(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=xX(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!Yn.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 Ope{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":""),rst(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 mI extends Kd{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function gI(e,t){return e.state.facet(_0).formatNumber(t,e.state)}const ast=nx.compute([_0],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(t){return t.state.facet(ist)},lineMarker(t,n,r){return r.some(i=>i.toDOM)?null:new mI(gI(t,t.state.doc.lineAt(n.from).number))},widgetMarker:(t,n,r)=>{for(let i of t.state.facet(sst)){let s=i(t,n,r);if(s)return s}return null},lineMarkerChange:t=>t.startState.facet(_0)!=t.state.facet(_0),initialSpacer(t){return new mI(gI(t,wX(t.state.doc.lines)))},updateSpacer(t,n){let r=gI(n.view,wX(n.view.state.doc.lines));return r==t.number?t:new mI(r)},domEventHandlers:e.facet(_0).domEventHandlers,side:"before"}));function ost(e={}){return[_0.of(e),bpe(),ast]}function wX(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(lst.range(i)))}return Yn.of(t)});function ust(){return cst}let dst=0,iu=class v3{constructor(t,n,r,i){this.name=t,this.set=n,this.base=r,this.modified=i,this.id=dst++}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 v3&&(n=t),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let i=new v3(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 r_(t);return r=>r.modified.indexOf(n)>-1?r:r_.get(r.base||r,r.modified.concat(n).sort((i,s)=>i.id-s.id))}},fst=0;class r_{constructor(t){this.name=t,this.instances=[],this.id=fst++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(l=>l.base==t&&hst(n,l.modified));if(r)return r;let i=[],s=new iu(t.name,i,t,n);for(let l of n)l.instances.push(s);let a=pst(n);for(let l of t.set)if(!l.modified.length)for(let c of a)i.push(r_.get(l,c));return s}}function hst(e,t){return e.length==t.length&&e.every((n,r)=>n==t[r])}function pst(e){let t=[[]];for(let n=0;nr.length-n.length)}function hf(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 p=i[f++];if(f==i.length&&p=="!"){a=0;break}if(p!="/")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 mv(r,a,c>0?s.slice(0,c):null);t[u]=d.sort(t[u])}}return ype.add(t)}const ype=new dn({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 mv(i.tags,i.mode,i.context);n?n.next=s:r=s,n=s}return r}});let mv=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 mst(e,t){let n=null;for(let r of e){let i=r.style(t);i&&(n=n?n+" "+i:i)}return n}function gst(e,t,n,r=0,i=e.length){let s=new bst(r,Array.isArray(t)?t:[t],n);s.highlightRange(e.cursor(),r,i,"",s.highlighters),s.flush(i)}class bst{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(p=>!p.scope||p.scope(a)));let u=i,d=Ost(t)||mv.empty,f=mst(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(dn.mounted);if(h&&h.overlay){let p=t.node.enter(h.overlay[0].from+l,1),b=this.highlighters.filter(O=>!O.scope||O.scope(h.tree.type)),g=t.firstChild();for(let O=0,y=l;;O++){let v=O=x||!t.nextSibling())););if(!v||x>r)break;y=v.to+l,y>n&&(this.highlightRange(p.cursor(),Math.max(n,v.from+l),Math.min(r,y),"",b),this.startSpan(Math.min(r,y),u))}g&&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 Ost(e){let t=e.type.prop(ype);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}const Ot=iu.define,QE=Ot(),Vf=Ot(),SX=Ot(Vf),EX=Ot(Vf),qf=Ot(),FE=Ot(qf),bI=Ot(qf),eu=Ot(),yp=Ot(eu),Wc=Ot(),Zc=Ot(),w3=Ot(),Ny=Ot(w3),UE=Ot(),G={comment:QE,lineComment:Ot(QE),blockComment:Ot(QE),docComment:Ot(QE),name:Vf,variableName:Ot(Vf),typeName:SX,tagName:Ot(SX),propertyName:EX,attributeName:Ot(EX),className:Ot(Vf),labelName:Ot(Vf),namespace:Ot(Vf),macroName:Ot(Vf),literal:qf,string:FE,docString:Ot(FE),character:Ot(FE),attributeValue:Ot(FE),number:bI,integer:Ot(bI),float:Ot(bI),bool:Ot(qf),regexp:Ot(qf),escape:Ot(qf),color:Ot(qf),url:Ot(qf),keyword:Wc,self:Ot(Wc),null:Ot(Wc),atom:Ot(Wc),unit:Ot(Wc),modifier:Ot(Wc),operatorKeyword:Ot(Wc),controlKeyword:Ot(Wc),definitionKeyword:Ot(Wc),moduleKeyword:Ot(Wc),operator:Zc,derefOperator:Ot(Zc),arithmeticOperator:Ot(Zc),logicOperator:Ot(Zc),bitwiseOperator:Ot(Zc),compareOperator:Ot(Zc),updateOperator:Ot(Zc),definitionOperator:Ot(Zc),typeOperator:Ot(Zc),controlOperator:Ot(Zc),punctuation:w3,separator:Ot(w3),bracket:Ny,angleBracket:Ot(Ny),squareBracket:Ot(Ny),paren:Ot(Ny),brace:Ot(Ny),content:eu,heading:yp,heading1:Ot(yp),heading2:Ot(yp),heading3:Ot(yp),heading4:Ot(yp),heading5:Ot(yp),heading6:Ot(yp),contentSeparator:Ot(eu),list:Ot(eu),quote:Ot(eu),emphasis:Ot(eu),strong:Ot(eu),link:Ot(eu),monospace:Ot(eu),strikethrough:Ot(eu),inserted:Ot(),deleted:Ot(),changed:Ot(),invalid:Ot(),meta:UE,documentMeta:Ot(UE),annotation:Ot(UE),processingInstruction:Ot(UE),definition:iu.defineModifier("definition"),constant:iu.defineModifier("constant"),function:iu.defineModifier("function"),standard:iu.defineModifier("standard"),local:iu.defineModifier("local"),special:iu.defineModifier("special")};for(let e in G){let t=G[e];t instanceof iu&&(t.name=e)}xpe([{tag:G.link,class:"tok-link"},{tag:G.heading,class:"tok-heading"},{tag:G.emphasis,class:"tok-emphasis"},{tag:G.strong,class:"tok-strong"},{tag:G.keyword,class:"tok-keyword"},{tag:G.atom,class:"tok-atom"},{tag:G.bool,class:"tok-bool"},{tag:G.url,class:"tok-url"},{tag:G.labelName,class:"tok-labelName"},{tag:G.inserted,class:"tok-inserted"},{tag:G.deleted,class:"tok-deleted"},{tag:G.literal,class:"tok-literal"},{tag:G.string,class:"tok-string"},{tag:G.number,class:"tok-number"},{tag:[G.regexp,G.escape,G.special(G.string)],class:"tok-string2"},{tag:G.variableName,class:"tok-variableName"},{tag:G.local(G.variableName),class:"tok-variableName tok-local"},{tag:G.definition(G.variableName),class:"tok-variableName tok-definition"},{tag:G.special(G.variableName),class:"tok-variableName2"},{tag:G.definition(G.propertyName),class:"tok-propertyName tok-definition"},{tag:G.typeName,class:"tok-typeName"},{tag:G.namespace,class:"tok-namespace"},{tag:G.className,class:"tok-className"},{tag:G.macroName,class:"tok-macroName"},{tag:G.propertyName,class:"tok-propertyName"},{tag:G.operator,class:"tok-operator"},{tag:G.comment,class:"tok-comment"},{tag:G.meta,class:"tok-meta"},{tag:G.invalid,class:"tok-invalid"},{tag:G.punctuation,class:"tok-punctuation"}]);var OI;const lh=new dn;function IC(e){return kt.define({combine:e?t=>t.concat(e):void 0})}const H8=new dn;class Wo{constructor(t,n,r=[],i=""){this.data=t,this.name=i,nr.prototype.hasOwnProperty("tree")||Object.defineProperty(nr.prototype,"tree",{get(){return Yr(this)}}),this.parser=n,this.extension=[Hh.of(this),nr.languageData.of((s,a,l)=>{let c=kX(s,a,l),u=c.type.prop(lh);if(!u)return[];let d=s.facet(u),f=c.type.prop(H8);if(f){let h=c.resolve(a-c.from,l);for(let p of f)if(p.test(h,s)){let b=s.facet(p.facet);return p.type=="replace"?b:b.concat(d)}}return d})].concat(r)}isActiveAt(t,n,r=-1){return kX(t,n,r).type.prop(lh)==this.data}findRegions(t){let n=t.facet(Hh);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(lh)==this.data){r.push({from:a,to:a+s.length});return}let l=s.prop(dn.mounted);if(l){if(l.tree.prop(lh)==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 Jd(this.data,this.parser.configure(t),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Yr(e){let t=e.field(Wo.state,!1);return t?t.tree:Fn.empty}class yst{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 jy=null;class Pm{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 Pm(t,n,[],Fn.empty,0,r,[],null)}startParse(){return this.parser.startParse(new yst(this.state.doc),this.fragments)}work(t,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Fn.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($d.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let n=jy;jy=this;try{return t()}finally{jy=n}}withoutTempSkipped(t){for(let n;n=this.tempSkipped.pop();)t=TX(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=$d.applyChanges(r,c),i=Fn.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=TX(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 kC{createParse(n,r,i){let s=i[0].from,a=i[i.length-1].to;return{parsedPos:s,advance(){let c=jy;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 Fn(ws.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 jy}}function TX(e,t,n){return $d.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class Xb{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 Xb(n)}static init(t){let n=Math.min(3e3,t.doc.length),r=Pm.create(t.facet(Hh).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new Xb(r)}}Wo.state=ma.define({create:Xb.init,update(e,t){for(let n of t.effects)if(n.is(Wo.setState))return n.value;return t.startState.facet(Hh)!=t.state.facet(Hh)?Xb.init(t.state):e.apply(t)}});let vpe=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(vpe=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const yI=typeof navigator<"u"&&(!((OI=navigator.scheduling)===null||OI===void 0)&&OI.isInputPending)?()=>navigator.scheduling.isInputPending():null,xst=Ki.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(Wo.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(Wo.state);(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))&&(this.working=vpe(this.work))}work(t){this.working=null;let n=Date.now();if(this.chunkEndi+1e3,c=s.context.work(()=>yI&&yI()||Date.now()>a,i+(l?0:1e5));this.chunkBudget-=Date.now()-n,(c||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Wo.setState.of(new Xb(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=>po(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()}}}),Hh=kt.define({combine(e){return e.length?e[0]:null},enables:e=>[Wo.state,xst,pt.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]});class Xh{constructor(t,n=[]){this.language=t,this.support=n,this.extension=[t,n]}}class i_{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 i_(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 vst=kt.define(),QO=kt.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 Mm(e){let t=e.facet(QO);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function gv(e,t){let n="",r=e.tabSize,i=e.facet(QO)[0];if(i==" "){for(;t>=r;)n+=" ",t-=r;i=" "}for(let s=0;s=t?wst(e,n,t):null}class DC{constructor(t,n={}){this.state=t,this.options=n,this.unit=Mm(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 _c(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 pf=new dn;function wst(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 wpe(r,e,n)}function wpe(e,t,n){for(let r=e;r;r=r.next){let i=Est(r.node);if(i)return i(G8.create(t,n,r))}return 0}function Sst(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function Est(e){let t=e.type.prop(pf);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(dn.closedBy))){let i=e.lastChild,s=i&&r.indexOf(i.name)>-1;return a=>Spe(a,!0,1,void 0,s&&!Sst(a)?i.from:void 0)}return e.parent==null?kst:null}function kst(){return 0}class G8 extends DC{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 G8(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(Tst(r,t))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return wpe(this.context.next,this.base,this.pos)}}function Tst(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function _st(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 eb({closing:e,align:t=!0,units:n=1}){return r=>Spe(r,t,n,e)}function Spe(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?_st(e):null;return c?l?e.column(c.from):e.column(c.to):e.baseIndent+(l?0:e.unit*n)}const Ast=e=>e.baseIndent;function tb({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}const Cst=200;function Nst(){return nr.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+Cst)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=X8(a,d.from);if(f==null)continue;let h=/^\s*/.exec(d.text)[0],p=gv(a,f);h!=p&&c.push({from:d.from,to:d.from+h.length,insert:p})}return c.length?[e,{changes:c,sequential:!0}]:e})}const Epe=kt.define(),mf=new dn;function Rw(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 Rst(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function s_(e,t,n){for(let r of e.facet(Epe)){let i=r(e,t,n);if(i)return i}return jst(e,t,n)}function kpe(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 PC=mn.define({map:kpe}),Iw=mn.define({map:kpe});function Tpe(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 Lm=ma.define({create(){return Vt.none},update(e,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges((r,i)=>e=_X(e,r,i)),e=e.map(t.changes);let n=[];for(let r of t.effects)r.is(PC)&&!Ist(e,r.value.from,r.value.to)?n.push(r.value):r.is(Iw)&&(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(Cpe),i=n.map(s=>(r?Vt.replace({widget:new Qst(r(t.state,s))}):AX).range(s.from,s.to));e=e.update({add:i})}return t.selection&&(e=_X(e,t.selection.main.head)),e},provide:e=>pt.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(Lm,!1))===null||r===void 0||r.between(t,n,(s,a)=>{(!i||i.from>s)&&(i={from:s,to:a})}),i}function Ist(e,t,n){let r=!1;return e.between(t,t,(i,s)=>{i==t&&s==n&&(r=!0)}),r}function _pe(e,t){return e.field(Lm,!1)?t:t.concat(mn.appendConfig.of(Npe()))}const Dst=e=>{for(let t of Tpe(e)){let n=s_(e.state,t.from,t.to);if(n)return e.dispatch({effects:_pe(e.state,[PC.of(n),Ape(e,n)])}),!0}return!1},Pst=e=>{if(!e.state.field(Lm,!1))return!1;let t=[];for(let n of Tpe(e)){let r=a_(e.state,n.from,n.to);r&&t.push(Iw.of(r),Ape(e,r,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function Ape(e,t,n=!0){let r=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return pt.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${e.state.phrase("to")} ${i}.`)}const Mst=e=>{let{state:t}=e,n=[];for(let r=0;r{let t=e.state.field(Lm,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(r,i)=>{n.push(Iw.of({from:r,to:i}))}),e.dispatch({effects:n}),!0},$st=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Dst},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Pst},{key:"Ctrl-Alt-[",run:Mst},{key:"Ctrl-Alt-]",run:Lst}],Bst={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},Cpe=kt.define({combine(e){return $u(e,Bst)}});function Npe(e){return[Lm,zst]}function jpe(e,t){let{state:n}=e,r=n.facet(Cpe),i=a=>{let l=e.lineBlockAt(e.posAtDOM(a.target)),c=a_(e.state,l.from,l.to);c&&e.dispatch({effects:Iw.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 AX=Vt.replace({widget:new class extends Pc{toDOM(e){return jpe(e,null)}}});class Qst extends Pc{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return jpe(t,this.value)}}const Fst={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class xI extends Kd{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 Ust(e={}){let t={...Fst,...e},n=new xI(t,!0),r=new xI(t,!1),i=Ki.fromClass(class{constructor(a){this.from=a.viewport.from,this.markers=this.buildMarkers(a)}update(a){(a.docChanged||a.viewportChanged||a.startState.facet(Hh)!=a.state.facet(Hh)||a.startState.field(Lm,!1)!=a.state.field(Lm,!1)||Yr(a.startState)!=Yr(a.state)||t.foldingChanged(a))&&(this.markers=this.buildMarkers(a.view))}buildMarkers(a){let l=new Wd;for(let c of a.viewportLineBlocks){let u=a_(a.state,c.from,c.to)?r:s_(a.state,c.from,c.to)?n:null;u&&l.add(c.from,c.from,u)}return l.finish()}}),{domEventHandlers:s}=t;return[i,est({class:"cm-foldGutter",markers(a){var l;return((l=a.plugin(i))===null||l===void 0?void 0:l.markers)||Yn.empty},initialSpacer(){return new xI(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:Iw.of(u)}),!0;let d=s_(a.state,l.from,l.to);return d?(a.dispatch({effects:PC.of(d)}),!0):!1}}}),Npe()]}const zst=pt.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 Dw{constructor(t,n){this.specs=t;let r;function i(l){let c=zh.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 Wo?l=>l.prop(lh)==a.data:a?l=>l==a:void 0,this.style=xpe(t.map(l=>({tag:l.tag,class:l.class||i(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=r?new zh(r):null,this.themeType=n.themeType}static define(t,n){return new Dw(t,n||{})}}const S3=kt.define(),Rpe=kt.define({combine(e){return e.length?[e[0]]:null}});function vI(e){let t=e.facet(S3);return t.length?t:e.facet(Rpe)}function Ipe(e,t){let n=[qst],r;return e instanceof Dw&&(e.module&&n.push(pt.styleModule.of(e.module)),r=e.themeType),t!=null&&t.fallback?n.push(Rpe.of(e)):r?n.push(S3.computeN([pt.darkTheme],i=>i.facet(pt.darkTheme)==(r=="dark")?[e]:[])):n.push(S3.of(e)),n}class Vst{constructor(t){this.markCache=Object.create(null),this.tree=Yr(t.state),this.decorations=this.buildDeco(t,vI(t.state)),this.decoratedTo=t.viewport.to}update(t){let n=Yr(t.state),r=vI(t.state),i=r!=vI(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 Vt.none;let r=new Wd;for(let{from:i,to:s}of t.visibleRanges)gst(this.tree,n,(a,l,c)=>{r.add(a,l,this.markCache[c]||(this.markCache[c]=Vt.mark({class:c})))},i,s);return r.finish()}}const qst=ff.high(Ki.fromClass(Vst,{decorations:e=>e.decorations})),Hst=Dw.define([{tag:G.meta,color:"#404740"},{tag:G.link,textDecoration:"underline"},{tag:G.heading,textDecoration:"underline",fontWeight:"bold"},{tag:G.emphasis,fontStyle:"italic"},{tag:G.strong,fontWeight:"bold"},{tag:G.strikethrough,textDecoration:"line-through"},{tag:G.keyword,color:"#708"},{tag:[G.atom,G.bool,G.url,G.contentSeparator,G.labelName],color:"#219"},{tag:[G.literal,G.inserted],color:"#164"},{tag:[G.string,G.deleted],color:"#a11"},{tag:[G.regexp,G.escape,G.special(G.string)],color:"#e40"},{tag:G.definition(G.variableName),color:"#00f"},{tag:G.local(G.variableName),color:"#30a"},{tag:[G.typeName,G.namespace],color:"#085"},{tag:G.className,color:"#167"},{tag:[G.special(G.variableName),G.macroName],color:"#256"},{tag:G.definition(G.propertyName),color:"#00c"},{tag:G.comment,color:"#940"},{tag:G.invalid,color:"#f00"}]),Xst=pt.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Dpe=1e4,Ppe="()[]{}",Mpe=kt.define({combine(e){return $u(e,{afterCursor:!0,brackets:Ppe,maxScanDistance:Dpe,renderMatch:Wst})}}),Gst=Vt.mark({class:"cm-matchingBracket"}),Yst=Vt.mark({class:"cm-nonmatchingBracket"});function Wst(e){let t=[],n=e.matched?Gst:Yst;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 CX(e){let t=[],n=e.facet(Mpe);for(let r of e.selection.ranges){if(!r.empty)continue;let i=gu(e,r.head,-1,n)||r.head>0&&gu(e,r.head-1,1,n)||n.afterCursor&&(gu(e,r.head,1,n)||r.heade.decorations}),Kst=[Zst,Xst];function Jst(e={}){return[Mpe.of(e),Kst]}const Lpe=new dn;function E3(e,t,n){let r=e.prop(t<0?dn.openedBy:dn.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 k3(e){let t=e.type.prop(Lpe);return t?t(e.node):e}function gu(e,t,n,r={}){let i=r.maxScanDistance||Dpe,s=r.brackets||Ppe,a=Yr(e),l=a.resolveInner(t,n);for(let c=l;c;c=c.parent){let u=E3(c.type,n,s);if(u&&c.from0?t>=d.from&&td.from&&t<=d.to))return eat(e,t,n,c,d,u,s)}}return tat(e,t,n,a,l.type,i,s)}function eat(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 p=d.value;n<0&&(h+=p.length);let b=t+h*n;for(let g=n>0?0:p.length-1,O=n>0?p.length:-1;g!=O;g+=n){let y=a.indexOf(p[g]);if(!(y<0||r.resolveInner(b+g,1).type!=i))if(y%2==0==n>0)f++;else{if(f==1)return{start:u,end:{from:b+g,to:b+g+1},matched:y>>1==c>>1};f--}}n>0&&(h+=p.length)}return d.done?{start:u,matched:!1}:null}function NX(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 nat(e){return{name:e.name||"",token:e.token,blankLine:e.blankLine||(()=>{}),startState:e.startState||(()=>!0),copyState:e.copyState||rat,indent:e.indent||(()=>null),languageData:e.languageData||{},tokenTable:e.tokenTable||Z8,mergeTokens:e.mergeTokens!==!1}}function rat(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 jX=new WeakMap;class Y8 extends Wo{constructor(t){let n=IC(t.languageData),r=nat(t),i,s=new class extends kC{createParse(a,l,c){return new sat(i,a,l,c)}};super(n,s,[],t.name),this.topNode=lat(n,this),i=this,this.streamParser=r,this.stateAfter=new dn({perNode:!0}),this.tokenTable=t.tokenTable?new Upe(r.tokenTable):oat}static define(t){return new Y8(t)}getIndent(t){let n,{overrideIndentation:r}=t.options;r&&(n=jX.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 Fn&&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&&W8(e,s.tree,0-s.offset,n,l),u;if(c&&c.pos<=r&&(u=Bpe(e,s.tree,n+s.offset,c.pos+s.offset,!1)))return{state:c.state,tree:u}}return{state:e.streamParser.startState(i?Mm(i):4),tree:Fn.empty}}let sat=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=Pm.get(),a=i[0].from,{state:l,tree:c}=iat(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(Mm(s.state)),s.skipUntilInView(this.parsedPos,s.viewport.from),this.parsedPos=s.viewport.from),this.moveRangeIndex()}advance(){let t=Pm.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=EE(t),r=Ig(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=EE(t),r=Ig(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 Qtt(e){const t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new $tt||null,prettyErrors:t}}function zfe(e,t={}){const{lineCounter:n,prettyErrors:r}=Qtt(t),i=new Btt(n==null?void 0:n.addNewLine),s=new Itt(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 c1(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(a.errors.forEach(uH(e,n)),a.warnings.forEach(uH(e,n))),a}function Ftt(e,t,n){let r;const i=zfe(e,n);if(!i)return null;if(i.warnings.forEach(s=>hfe(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 Vfe(e,t,n){let r=null;if(Array.isArray(t)&&(r=t),e===void 0){const{keepUndefined:i}={};if(!i)return}return Ew(e)&&!r?e.toString(n):new Aw(e,r,n).toString(n)}const qfe=1024;let Utt=0,Il=class{constructor(t,n){this.from=t,this.to=n}};class dn{constructor(t={}){this.id=Utt++,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=ws.match(t)),n=>{let r=t(n);return r===void 0?null:[this,r]}}}dn.closedBy=new dn({deserialize:e=>e.split(" ")});dn.openedBy=new dn({deserialize:e=>e.split(" ")});dn.group=new dn({deserialize:e=>e.split(" ")});dn.isolate=new dn({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});dn.contextHash=new dn({perNode:!0});dn.lookAhead=new dn({perNode:!0});dn.mounted=new dn({perNode:!0});class W0{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[dn.mounted.id]}}const ztt=Object.create(null);class ws{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):ztt,r=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new ws(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(dn.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(dn.group),s=-1;s<(i?i.length:0);s++){let a=n[s<0?r.name:i[s]];if(a)return a}}}}ws.none=new ws("",Object.create(null),0,8);class BO{constructor(t){this.types=t;for(let n=0;n0;for(let c=this.cursor(a|Ar.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:_8(ws.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new Un(this.type,n,r,i,this.propValues),t.makeTree||((n,r,i)=>new Un(ws.none,n,r,i)))}static build(t){return Xtt(t)}}Un.empty=new Un(ws.none,[],[],0);class k8{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 k8(this.buffer,this.index)}}class Fh{constructor(t,n,r){this.buffer=t,this.length=n,this.set=r}get type(){return ws.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 av(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&Ar.EnterBracketed&&d instanceof Un&&(h=W0.get(d))&&!h.overlay&&h.bracketed&&r>=f&&r<=f+d.length)&&!Hfe(i,r,f,f+d.length))){if(d instanceof Fh){if(s&Ar.ExcludeBuffers)continue;let p=d.findChild(0,d.buffer.length,n,r-f,i);if(p>-1)return new pu(new Vtt(a,d,t,f),null,p)}else if(s&Ar.IncludeAnonymous||!d.type.isAnonymous||T8(d)){let p;if(!(s&Ar.IgnoreMounts)&&(p=W0.get(d))&&!p.overlay)return new Ca(p.tree,f,t,a);let b=new Ca(d,f,t,a);return s&Ar.IncludeAnonymous||!b.type.isAnonymous?b:b.nextChild(n<0?d.children.length-1:0,n,r,i,s)}}}if(s&Ar.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&Ar.IgnoreOverlays)&&(i=W0.get(this._tree))&&i.overlay){let s=t-this.from,a=r&Ar.EnterBracketed&&i.bracketed;for(let{from:l,to:c}of i.overlay)if((n>0||a?l<=s:l=s:c>s))return new Ca(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 bH(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 FM(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 Vtt{constructor(t,n,r,i){this.parent=t,this.buffer=n,this.index=r,this.start=i}}class pu extends Xfe{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 pu(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&Ar.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 pu(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 pu(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 pu(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 Un(this.type,t,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Gfe(e){if(!e.length)return null;let t=0,n=e[0];for(let s=1;sn.from||a.to=t){let l=new Ca(a.tree,a.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(av(l,t,n,!1))}}return i?Gfe(i):r}class X2{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&~Ar.EnterBracketed,t instanceof Ca)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 Ca?(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&Ar.ExcludeBuffers?!1:this.enterChild(1,t,n):this.yield(this._tree.enter(t,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ar.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&Ar.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&Ar.IncludeAnonymous||l instanceof Fh||!l.type.isAnonymous||T8(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 FM(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 T8(e){return e.children.some(t=>t instanceof Fh||!t.type.isAnonymous||T8(t))}function Xtt(e){var t;let{buffer:n,nodeSet:r,maxBufferLength:i=qfe,reused:s=[],minRepeatType:a=r.types.length}=e,l=Array.isArray(n)?new k8(n,n.length):n,c=r.types,u=0,d=0;function f(S,E,k,T,C,N){let{id:_,start:R,end:$,size:D}=l,M=d,j=u;if(D<0)if(l.next(),D==-1){let q=s[_];k.push(q),T.push(R-S);return}else if(D==-3){u=_;return}else if(D==-4){d=_;return}else throw new RangeError(`Unrecognized record size: ${D}`);let P=c[_],L,U,F=R-S;if($-R<=i&&(U=O(l.pos-E,C))){let q=new Uint16Array(U.size-U.skip),z=l.pos-U.size,B=q.length;for(;l.pos>z;)B=y(U.start,q,B);L=new Fh(q,$-U.start,r),F=U.start-S}else{let q=l.pos-D;l.next();let z=[],B=[],V=_>=a?_:-1,ce=0,we=$;for(;l.pos>q;)V>=0&&l.id==V&&l.size>=0?(l.end<=we-i&&(b(z,B,R,ce,l.end,we,V,M,j),ce=z.length,we=l.end),l.next()):N>2500?h(R,q,z,B):f(R,q,z,B,V,N+1);if(V>=0&&ce>0&&ce-1&&ce>0){let Oe=p(P,j);L=_8(P,z,B,0,z.length,0,$-R,Oe,Oe)}else L=g(P,z,B,$-R,M-$,j)}k.push(L),T.push(F)}function h(S,E,k,T){let C=[],N=0,_=-1;for(;l.pos>E;){let{id:R,start:$,end:D,size:M}=l;if(M>4)l.next();else{if(_>-1&&$<_)break;_<0&&(_=D-i),C.push(R,$,D),N++,l.next()}}if(N){let R=new Uint16Array(N*4),$=C[C.length-2];for(let D=C.length-3,M=0;D>=0;D-=3)R[M++]=C[D],R[M++]=C[D+1]-$,R[M++]=C[D+2]-$,R[M++]=M;k.push(new Fh(R,C[2]-$,r)),T.push($-S)}}function p(S,E){return(k,T,C)=>{let N=0,_=k.length-1,R,$;if(_>=0&&(R=k[_])instanceof Un){if(!_&&R.type==S&&R.length==C)return R;($=R.prop(dn.lookAhead))&&(N=T[_]+R.length+$)}return g(S,k,T,C,N,E)}}function b(S,E,k,T,C,N,_,R,$){let D=[],M=[];for(;S.length>T;)D.push(S.pop()),M.push(E.pop()+k-C);S.push(g(r.types[_],D,M,N-C,R-N,$)),E.push(C-k)}function g(S,E,k,T,C,N,_){if(N){let R=[dn.contextHash,N];_=_?[R].concat(_):[R]}if(C>25){let R=[dn.lookAhead,C];_=_?[R].concat(_):[R]}return new Un(S,E,k,T,_)}function O(S,E){let k=l.fork(),T=0,C=0,N=0,_=k.end-i,R={size:0,start:0,skip:0};e:for(let $=k.pos-S;k.pos>$;){let D=k.size;if(k.id==E&&D>=0){R.size=T,R.start=C,R.skip=N,N+=4,T+=4,k.next();continue}let M=k.pos-D;if(D<0||M<$||k.start<_)break;let j=k.id>=a?4:0,P=k.start;for(k.next();k.pos>M;){if(k.size<0)if(k.size==-3||k.size==-4)j+=4;else break e;else k.id>=a&&(j+=4);k.next()}C=P,T+=D,N+=j}return(E<0||T==S)&&(R.size=T,R.start=C,R.skip=N),R.size>4?R:void 0}function y(S,E,k){let{id:T,start:C,end:N,size:_}=l;if(l.next(),_>=0&&T4){let $=l.pos-(_-4);for(;l.pos>$;)k=y(S,E,k)}E[--k]=R,E[--k]=N-S,E[--k]=C-S,E[--k]=T}else _==-3?u=T:_==-4&&(d=T);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 Un(c[e.topID],v.reverse(),x.reverse(),w)}const OH=new WeakMap;function Kk(e,t){if(!e.isAnonymous||t instanceof Fh||t.type!=e)return 1;let n=OH.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof Un)){n=1;break}n+=Kk(e,r)}OH.set(t,n)}return n}function _8(e,t,n,r,i,s,a,l,c){let u=0;for(let b=r;b=d)break;E+=k}if(x==w+1){if(E>d){let k=b[w];p(k.children,k.positions,0,k.children.length,g[w]+v);continue}f.push(b[w])}else{let k=g[x-1]+b[x-1].length-S;f.push(_8(e,b,g,w,x,S,k,null,c))}h.push(S+v-s)}}return p(t,n,r,i,0),(l||c)(f,h,a)}class A8{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 pu?this.setBuffer(t.context.buffer,t.index,n):t instanceof Ca&&this.map.set(t.tree,n)}get(t){return t instanceof pu?this.getBuffer(t.context.buffer,t.index):t instanceof Ca?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 $d{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 $d(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 p=Math.max(h.from,c)-u,b=Math.min(h.to,f)-u;h=p>=b?null:new $d(p,b,h.tree,h.offset+u,l>0,!!d)}if(h&&i.push(h),a.to>f)break;a=snew Il(i.from,i.to)):[new Il(0,0)]:[new Il(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 Gtt{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 Yfe(e){return(t,n,r,i)=>new Wtt(t,e,n,r,i)}class yH{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 xH(e){if(!e.length||e.some(t=>t.from>=t.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(e))}class Ytt{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 UM=new dn({perNode:!0});class Wtt{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 Un(r.type,r.children,r.positions,r.length,r.propValues.concat([[UM,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[dn.mounted.id]=new W0(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(p=>p.fromf)&&n.ranges.push({from:f,to:h})}}l=!1}else if(r&&(a=Ztt(r.ranges,i.from,i.to)))l=a!=2;else if(!i.type.isAnonymous&&(s=this.nest(i,this.input))&&(i.fromnew Il(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 Il(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=SH(this.ranges,n.ranges);u.length&&(xH(u),this.inner.splice(n.index,0,new yH(n.parser,n.parser.startParse(this.input,EH(n.mounts,u),u),n.ranges.map(d=>new Il(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 Ztt(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 vH(e,t,n,r,i,s){if(t=t&&n.enter(r,1,Ar.IgnoreOverlays|Ar.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 Un)n=n.children[0];else break}return!1}}let Jtt=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(UM))!==null&&n!==void 0?n:r.to,this.inner=new wH(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(UM))!==null&&t!==void 0?t:n.to,this.inner=new wH(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(dn.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 SH(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 Il(l,c.to))):c.to>l?n[s--]=new Il(l,c.to):n.splice(s--,1))}}return r}function ent(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),p=Math.min(d,f,r);hnew Il(h.from+r,h.to+r)),f=ent(t,d,c,u);for(let h=0,p=c;;h++){let b=h==f.length,g=b?u:f[h].from;if(g>p&&n.push(new $d(p,g,i.tree,-a,s.from>=p||s.openStart,s.to<=g||s.openEnd)),b)break;p=f[h].to}}else n.push(new $d(c,u,i.tree,-a,s.from>=a||s.openStart,s.to<=l||s.openEnd))}return n}let zM=[],Wfe=[];(()=>{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=Wfe[r])t=r+1;else return!0;if(t==n)return!1}}function kH(e){return e>=127462&&e<=127487}const TH=8205;function nnt(e,t,n=!0,r=!0){return(n?Zfe:rnt)(e,t,r)}function Zfe(e,t,n){if(t==e.length)return t;t&&Kfe(e.charCodeAt(t))&&Jfe(e.charCodeAt(t-1))&&t--;let r=rI(e,t);for(t+=_H(r);t=0&&kH(rI(e,a));)s++,a-=2;if(s%2==0)break;t+=2}else break}return t}function rnt(e,t,n){for(;t>1;){let r=Zfe(e,t-2,n);if(r=56320&&e<57344}function Jfe(e){return e>=55296&&e<56320}function _H(e){return e<65536?1:2}let Tr=class ehe{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]=zb(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),au.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]=zb(this,t,n);let r=[];return this.decompose(t,n,r,0),au.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 Z1(this),s=new Z1(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 Z1(this,t)}iterRange(t,n=this.length){return new the(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 nhe(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]?ehe.empty:t.length<=32?new is(t):au.from(is.split(t,[]))}};class is extends Tr{constructor(t,n=int(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 snt(i,l,r,a);i=l+1,r++}}decompose(t,n,r,i){let s=t<=0&&n>=this.length?this:new is(AH(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let a=r.pop(),l=Jk(s.text,a.text.slice(),0,s.length);if(l.length<=32)r.push(new is(l,a.length+s.length));else{let c=l.length>>1;r.push(new is(l.slice(0,c)),new is(l.slice(c)))}}else r.push(s)}replace(t,n,r){if(!(r instanceof is))return super.replace(t,n,r);[t,n]=zb(this,t,n);let i=Jk(this.text,Jk(r.text,AH(this.text,0,t)),n),s=this.length+r.length-(n-t);return i.length<=32?new is(i,s):au.from(is.split(i,[]),s)}sliceString(t,n=this.length,r=` +`){[t,n]=zb(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 is(r,i)),r=[],i=-1);return i>-1&&n.push(new is(r,i)),n}}class au extends Tr{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]=zb(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 au(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]=zb(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 au))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 p of t)r+=p.lines;if(r<32){let p=[];for(let b of t)b.flatten(p);return new is(p,n)}let i=Math.max(32,r>>5),s=i<<1,a=i>>1,l=[],c=0,u=-1,d=[];function f(p){let b;if(p.lines>s&&p instanceof au)for(let g of p.children)f(g);else p.lines>a&&(c>a||!c)?(h(),l.push(p)):p instanceof is&&c&&(b=d[d.length-1])instanceof is&&p.lines+b.lines<=32?(c+=p.lines,u+=p.length+1,d[d.length-1]=new is(b.text.concat(p.text),b.length+1+p.length)):(c+p.lines>i&&h(),c+=p.lines,u+=p.length+1,d.push(p))}function h(){c!=0&&(l.push(d.length==1?d[0]:au.from(d,u)),u=-1,c=d.length=0)}for(let p of t)f(p);return h(),l.length==1?l[0]:new au(l,n)}}Tr.empty=new is([""],0);function int(e){let t=-1;for(let n of e)t+=n.length+1;return t}function Jk(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 is?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 is?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 is){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 is?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 the{constructor(t,n,r){this.value="",this.done=!1,this.cursor=new Z1(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 nhe{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"&&(Tr.prototype[Symbol.iterator]=function(){return this.iter()},Z1.prototype[Symbol.iterator]=the.prototype[Symbol.iterator]=nhe.prototype[Symbol.iterator]=function(){return this});let snt=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 zb(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function Ys(e,t,n=!0,r=!0){return nnt(e,t,n,r)}function ant(e){return e>=56320&&e<57344}function ont(e){return e>=55296&&e<56320}function lo(e,t){let n=e.charCodeAt(t);if(!ont(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return ant(r)?(n-55296<<10)+(r-56320)+65536:n}function C8(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function ou(e){return e<65536?1:2}const VM=/\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 Su{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 Su(t)}static create(t){return new Su(t)}}class js extends Su{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 qM(this,(n,r,i,s,a)=>t=t.replace(i,i+(r-n),a),!1),t}mapDesc(t,n=!1){return HM(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&&oh(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 b=p?typeof p=="string"?Tr.of(p.split(r||VM)):p:Tr.empty,g=b.length;if(f==h&&g==0)return;fa&&ka(i,f-a,-1),ka(i,h-f,g),oh(s,i,b),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 oh(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 HM(e,t,n,r=!1){let i=[],s=r?[]:null,a=new ov(e),l=new ov(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);ka(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 ov{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i>1;return n>=t.length?Tr.empty:t[n]}textBit(t){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!t?Tr.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 Zf{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 Zf(r,i,this.flags,this.goalColumn)}extend(t,n=t,r=0){if(t<=this.anchor&&n>=this.anchor)return Fe.range(t,n,void 0,void 0,r);let i=Math.abs(t-this.anchor)>Math.abs(n-this.anchor)?t:n;return Fe.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 Fe.range(t.anchor,t.head)}static create(t,n,r,i){return new Zf(t,n,r,i)}}class Fe{constructor(t,n){this.ranges=t,this.mainIndex=n}map(t,n=-1){return t.empty?this:Fe.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 Fe(t.ranges.map(n=>Zf.fromJSON(n)),t.main)}static single(t,n=t){return new Fe([Fe.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?Fe.range(c,l):Fe.range(l,c))}}return new Fe(t,n)}}function ihe(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let N8=0;class kt{constructor(t,n,r,i,s){this.combine=t,this.compareInput=n,this.compare=r,this.isStatic=i,this.id=N8++,this.default=t([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(t={}){return new kt(t.combine||(n=>n),t.compareInput||((n,r)=>n===r),t.compare||(t.combine?(n,r)=>n===r:j8),!!t.static,t.enables)}of(t){return new eT([],this,0,t)}compute(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new eT(t,this,1,n)}computeN(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new eT(t,this,2,n)}from(t,n){return n||(n=r=>r),this.compute([t],r=>n(r.field(t)))}}function j8(e,t){return e==t||e.length==t.length&&e.every((n,r)=>n===t[r])}class eT{constructor(t,n,r,i){this.dependencies=t,this.facet=n,this.type=r,this.value=i,this.id=N8++}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)||XM(f,d)){let p=r(f);if(l?!CH(p,f.values[a],i):!i(p,f.values[a]))return f.values[a]=p,1}return 0},reconfigure:(f,h)=>{let p,b=h.config.address[s];if(b!=null){let g=Y2(h,b);if(this.dependencies.every(O=>O instanceof kt?h.facet(O)===f.facet(O):O instanceof ga?h.field(O,!1)==f.field(O,!1):!0)||(l?CH(p=r(f),g,i):i(p=r(f),g)))return f.values[a]=g,0}else p=r(f);return f.values[a]=p,1}}}get extension(){return this}}function CH(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(TE).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(TE),a=i.facet(TE),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,TE.of({field:this,create:t})]}get extension(){return this}}const Qp={lowest:4,low:3,default:2,high:1,highest:0};function Cy(e){return t=>new she(t,e)}const ff={highest:Cy(Qp.highest),high:Cy(Qp.high),default:Cy(Qp.default),low:Cy(Qp.low),lowest:Cy(Qp.lowest)};class she{constructor(t,n){this.inner=t,this.prec=n}get extension(){return this}}class AC{of(t){return new GM(this,t)}reconfigure(t){return AC.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class GM{constructor(t,n){this.compartment=t,this.inner=n}get extension(){return this}}class G2{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 cnt(t,n,a))h instanceof ga?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(p=>h.slot(p));let d=r==null?void 0:r.config.facets;for(let h in s){let p=s[h],b=p[0].facet,g=d&&d[h]||[];if(p.every(O=>O.type==0))if(l[b.id]=c.length<<1|1,j8(g,p))c.push(r.facet(b));else{let O=b.combine(p.map(y=>y.value));c.push(r&&b.compare(O,r.facet(b))?r.facet(b):O)}else{for(let O of p)O.type==0?(l[O.id]=c.length<<1|1,c.push(O.value)):(l[O.id]=u.length<<1,u.push(y=>O.dynamicSlot(y)));l[b.id]=u.length<<1,u.push(O=>lnt(O,b,p))}}let f=u.map(h=>h(l));return new G2(t,a,f,l,c,s)}}function cnt(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 GM&&n.delete(a.compartment)}if(i.set(a,l),Array.isArray(a))for(let u of a)s(u,l);else if(a instanceof GM){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 she)s(a.inner,a.prec);else if(a instanceof ga)r[l].push(a),a.provides&&s(a.provides,l);else if(a instanceof eT)r[l].push(a),a.facet.extensions&&s(a.facet.extensions,Qp.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,Qp.default),r.reduce((a,l)=>a.concat(l))}function K1(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 Y2(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}const ahe=kt.define(),YM=kt.define({combine:e=>e.some(t=>t),static:!0}),ohe=kt.define({combine:e=>e.length?e[0]:void 0,static:!0}),lhe=kt.define(),che=kt.define(),uhe=kt.define(),dhe=kt.define({combine:e=>e.length?e[0]:!1});class Lu{constructor(t,n){this.type=t,this.value=n}static define(){return new unt}}class unt{of(t){return new Lu(this,t)}}class dnt{constructor(t){this.map=t}of(t){return new mn(this,t)}}class mn{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 mn(this.type,n)}is(t){return this.type==t}static define(t={}){return new dnt(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}}mn.reconfigure=mn.define();mn.appendConfig=mn.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&&ihe(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=Lu.define();vs.userEvent=Lu.define();vs.addToHistory=Lu.define();vs.remote=Lu.define();function fnt(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=hhe(t,Z0(s),!1)}return e}function pnt(e){let t=e.startState,n=t.facet(uhe),r=e;for(let i=n.length-1;i>=0;i--){let s=n[i](e);s&&Object.keys(s).length&&(r=fhe(r,WM(t,s,e.changes.newLength),!0))}return r==e?e:vs.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}const mnt=[];function Z0(e){return e==null?mnt:Array.isArray(e)?e:[e]}var Ai=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(Ai||(Ai={}));const gnt=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let ZM;try{ZM=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function bnt(e){if(ZM)return ZM.test(e);for(let t=0;t"€"&&(n.toUpperCase()!=n.toLowerCase()||gnt.test(n)))return!0}return!1}function Ont(e){return t=>{if(!/\S/.test(t))return Ai.Space;if(bnt(t))return Ai.Word;for(let n=0;n-1)return Ai.Word;return Ai.Other}}class rr{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(mn.reconfigure)?(n=null,r=l.value):l.is(mn.appendConfig)&&(n=null,r=Z0(r).concat(l.value));let s;n?s=t.startState.values.slice():(n=G2.resolve(r,i,this),s=new rr(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(c,u)=>u.reconfigure(c,this),null).values);let a=t.startState.facet(YM)?t.newSelection:t.newSelection.asSingle();new rr(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:Fe.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=Z0(r.effects);for(let l=1;la.spec.fromJSON(l,c)))}}return rr.create({doc:t.doc,selection:Fe.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(t={}){let n=G2.resolve(t.extensions||[],new Map),r=t.doc instanceof Tr?t.doc:Tr.of((t.doc||"").split(n.staticFacet(rr.lineSeparator)||VM)),i=t.selection?t.selection instanceof Fe?t.selection:Fe.single(t.selection.anchor,t.selection.head):Fe.single(0);return ihe(i,r.length),n.staticFacet(YM)||(i=i.asSingle()),new rr(n,r,i,n.dynamicSlots.map(()=>null),(s,a)=>a.create(s),null)}get tabSize(){return this.facet(rr.tabSize)}get lineBreak(){return this.facet(rr.lineSeparator)||` +`}get readOnly(){return this.facet(dhe)}phrase(t,...n){for(let r of this.facet(rr.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(ahe))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 Ont(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=Ys(n,a,!1);if(s(n.slice(c,a))!=Ai.Word)break;a=c}for(;le.length?e[0]:4});rr.lineSeparator=ohe;rr.readOnly=dhe;rr.phrases=kt.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])}});rr.languageData=ahe;rr.changeFilter=lhe;rr.transactionFilter=che;rr.transactionExtender=uhe;AC.reconfigure=mn.define();function $u(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 Uh{eq(t){return this==t}range(t,n=t){return lv.create(t,n,this)}}Uh.prototype.startSide=Uh.prototype.endSide=0;Uh.prototype.point=!1;Uh.prototype.mapMode=da.TrackDel;function R8(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}class lv{constructor(t,n,r){this.from=t,this.to=n,this.value=r}static create(t,n,r){return new lv(t,n,r)}}function KM(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class I8{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);sp||h==p&&u.startSide>0&&u.endSide<=0)continue;(p-h||u.endSide-u.startSide)<0||(a<0&&(a=h),u.point&&(l=Math.max(l,p-h)),r.push(u),i.push(h-a),s.push(p-a))}return{mapped:r.length?new I8(i,s,r,l):null,pos:a}}}class Yn{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 Yn(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(KM)),this.isEmpty)return n.length?Yn.of(n):this;let l=new phe(this,null,-1).goto(0),c=0,u=[],d=new Wd;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 cv.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,n=0){return cv.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=NH(a,l,r),u=new Ny(a,c,s),d=new Ny(l,c,s);r.iterGaps((f,h,p)=>jH(u,f,d,h,p,i)),r.empty&&r.length==0&&jH(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=NH(s,a),c=new Ny(s,l,0).goto(r),u=new Ny(a,l,0).goto(r);for(;;){if(c.to!=u.to||!JM(c.active,u.active)||c.point&&(!u.point||!R8(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 Ny(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 Wd;for(let i of t instanceof lv?[t]:n?ynt(t):t)r.add(i.from,i.to,i.value);return r.finish()}static join(t){if(!t.length)return Yn.empty;let n=t[t.length-1];for(let r=t.length-2;r>=0;r--)for(let i=t[r];i!=Yn.empty;i=i.nextLayer)n=new Yn(i.chunkPos,i.chunk,n,Math.max(i.maxPoint,n.maxPoint));return n}}Yn.empty=new Yn([],[],null,-1);function ynt(e){if(e.length>1)for(let t=e[0],n=1;n0)return e.slice().sort(KM);t=r}return e}Yn.empty.nextLayer=Yn.empty;class Wd{finishChunk(t){this.chunks.push(new I8(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 Wd)).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(Yn.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let n=Yn.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,n}}function NH(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 phe(a,n,r,s));return i.length==1?i[0]:new cv(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--)iI(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--)iI(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(),iI(this.heap,0)}}}function iI(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 Ny{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=cv.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){_E(this.active,t),_E(this.activeTo,t),_E(this.activeRank,t),this.minActive=RH(this.active,this.activeTo)}addActive(t){let n=0,{value:r,to:i,rank:s}=this.cursor;for(;n0;)n++;AE(this.active,n,r),AE(this.activeTo,n,i),AE(this.activeRank,n,s),t&&AE(t,n,this.cursor.from),this.minActive=RH(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&&_E(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 jH(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,p=h<0?e.to+c:n.to,b=Math.min(p,a);if(e.point||n.point?(e.point&&n.point&&R8(e.point,n.point)&&JM(e.activeForPoint(e.to),n.activeForPoint(n.to))||s.comparePoint(l,b,e.point,n.point),d=!1):(d&&s.boundChange(l),b>l&&!JM(e.active,n.active)&&s.compareRange(l,b,e.active,n.active),u&&ba)break;l=p,h<=0&&e.next(),h>=0&&n.next()}}function JM(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 RH(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=Ys(e,i)}return r===!0?-1:e.length}const t3="ͼ",IH=typeof Symbol>"u"?"__"+t3:Symbol.for(t3),n3=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),DH=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class zh{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 p in l){let b=l[p];if(/&/.test(p))s(p.split(/,\s*/).map(g=>a.map(O=>g.replace(/&/,O))).reduce((g,O)=>g.concat(O)),b,c);else if(b&&typeof b=="object"){if(!f)throw new RangeError("The value of a property ("+p+") should be a primitive value.");s(i(p),b,d,h)}else b!=null&&d.push(p.replace(/_.*/,"").replace(/[A-Z]/g,g=>"-"+g.toLowerCase())+": "+b+";")}(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=DH[IH]||1;return DH[IH]=t+1,t3+t.toString(36)}static mount(t,n,r){let i=t[n3],s=r&&r.nonce;i?s&&i.setNonce(s):i=new xnt(t,s),i.mount(Array.isArray(n)?n:[n],t)}}let PH=new Map;class xnt{constructor(t,n){let r=t.ownerDocument||t,i=r.defaultView;if(!t.head&&t.adoptedStyleSheets&&i.CSSStyleSheet){let s=PH.get(r);if(s)return t[n3]=s;this.sheet=new i.CSSStyleSheet,PH.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],t[n3]=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:'"'},vnt=typeof navigator<"u"&&/Mac/.test(navigator.platform),wnt=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var la=0;la<10;la++)Vh[48+la]=Vh[96+la]=String(la);for(var la=1;la<=24;la++)Vh[la+111]="F"+la;for(var la=65;la<=90;la++)Vh[la]=String.fromCharCode(la+32),uv[la]=String.fromCharCode(la);for(var sI in Vh)uv.hasOwnProperty(sI)||(uv[sI]=Vh[sI]);function Snt(e){var t=vnt&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||wnt&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?uv:Vh)[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 Xr(){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 Et={mac:$H||/Mac/.test(Fa.platform),windows:/Win/.test(Fa.platform),linux:/Linux|X11/.test(Fa.platform),ie:CC,ie_version:ghe?r3.documentMode||6:s3?+s3[1]:i3?+i3[1]:0,gecko:MH,gecko_version:MH?+(/Firefox\/(\d+)/.exec(Fa.userAgent)||[0,0])[1]:0,chrome:!!aI,chrome_version:aI?+aI[1]:0,ios:$H,android:/Android\b/.test(Fa.userAgent),webkit:LH,webkit_version:LH?+(/\bAppleWebKit\/(\d+)/.exec(Fa.userAgent)||[0,0])[1]:0,safari:a3,safari_version:a3?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Fa.userAgent)||[0,0])[1]:0,tabSize:r3.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function D8(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 W2=Object.create(null);function P8(e,t,n){if(e==t)return!0;e||(e=W2),t||(t=W2);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 Ent(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 BH(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 knt(e){let t=Object.create(null);for(let n=0;n0?3e8:-4e8:n>0?1e8:-1e8,new Im(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}=bhe(t,n);r=(s?n?-3e8:-1:5e8)-1,i=(a?n?2e8:1:-6e8)+1}return new Im(t,r,i,n,t.widget||null,!0)}static line(t){return new jw(t)}static set(t,n=!1){return Yn.of(t,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Vt.none=Yn.empty;class Nw extends Vt{constructor(t){let{start:n,end:r}=bhe(t);super(n?-1:5e8,r?1:-6e8,null,t),this.tagName=t.tagName||"span",this.attrs=t.class&&t.attributes?D8(t.attributes,{class:t.class}):t.class?{class:t.class}:t.attributes||W2}eq(t){return this==t||t instanceof Nw&&this.tagName==t.tagName&&P8(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)}}Nw.prototype.point=!1;class jw extends Vt{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof jw&&this.spec.class==t.spec.class&&P8(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)}}jw.prototype.mapMode=da.TrackBefore;jw.prototype.point=!0;class Im extends Vt{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?ma.WidgetRange:this.startSide<=0?ma.WidgetBefore:ma.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof Im&&Tnt(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)}}Im.prototype.point=!0;function bhe(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 Tnt(e,t){return e==t||!!(e&&t&&e.compare(t))}function K0(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 dv extends Uh{constructor(t,n,r){super(),this.tagName=t,this.attributes=n,this.rank=r}eq(t){return t==this||t instanceof dv&&this.tagName==t.tagName&&P8(this.attributes,t.attributes)}static create(t){return new dv(t.tagName,t.attributes||W2,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(t,n=!1){return Yn.of(t,n)}}dv.prototype.startSide=dv.prototype.endSide=-1;function fv(e){let t;return e.nodeType==11?t=e.getSelection?e:e.ownerDocument:t=e,t.getSelection()}function o3(e,t){return t?e==t||e.contains(t.nodeType!=1?t.parentNode:t):!1}function J1(e,t){if(!t.anchorNode)return!1;try{return o3(e,t.anchorNode)}catch{return!1}}function ex(e){return e.nodeType==3?pv(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function tx(e,t,n,r){return n?QH(e,t,n,r,-1)||QH(e,t,n,r,1):!1}function qh(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function Z2(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function QH(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:Zd(e))){if(e.nodeName=="DIV")return!1;let s=e.parentNode;if(!s||s.nodeType!=1)return!1;t=qh(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?Zd(e):0}else return!1}}function Zd(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function hv(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 _nt(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 Ohe(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 Ant(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,p=d==c.body,b=1,g=1;if(p)h=_nt(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:b,scaleY:g}=Ohe(d,v)),h={left:v.left,right:v.left+d.clientWidth*b,top:v.top,bottom:v.top+d.clientHeight*g}}let O=0,y=0;if(i=="nearest")t.top0&&t.bottom>h.bottom+y&&(y=t.bottom-h.bottom+a)):t.bottom>h.bottom-a&&(y=t.bottom-h.bottom+a,n<0&&t.top-y0&&t.right>h.right+O&&(O=t.right-h.right+s)):t.right>h.right-s&&(O=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 yhe(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 Cnt{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?Zd(n):0),r,Math.min(t.focusOffset,r?Zd(r):0))}set(t,n,r,i){this.anchorNode=t,this.anchorOffset=n,this.focusNode=r,this.focusOffset=i}}let Mp=null;Et.safari&&Et.safari_version>=26&&(Mp=!1);function xhe(e){if(e.setActive)return e.setActive();if(Mp)return e.focus(Mp);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(Mp==null?{get preventScroll(){return Mp={preventScroll:!0},!0}}:void 0),!Mp){Mp=!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 whe(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=Zd(n)}else if(n.parentNode&&!Z2(n))r=qh(n),n=n.parentNode;else return null}}function She(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 The(e,t){if(e.length!=t.length)return!1;for(let n=0;n=0;g-=3)if(Yc[g+1]==-p){let O=Yc[g+2],y=O&2?i:O&4?O&1?s:i:0;y&&(ti[f]=ti[Yc[g]]=y),l=g;break}}else{if(Yc.length==189)break;Yc[l++]=f,Yc[l++]=h,Yc[l++]=c}else if((b=ti[f])==2||b==1){let g=b==i;c=g?0:1;for(let O=l-3;O>=0;O-=3){let y=Yc[O+2];if(y&2)break;if(g)Yc[O+2]|=2;else{if(y&4)break;Yc[O+2]|=4}}}}}function Lnt(e,t,n,r){for(let i=0,s=r;i<=n.length;i++){let a=i?n[i-1].to:e,l=ic;)b==O&&(b=n[--g].from,O=g?n[g-1].to:e),ti[--b]=p;c=d}else s=u,c++}}}function c3(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 mu(c,g.from,p));let O=g.direction==Dm!=!(p%2);u3(e,O?r+1:r,i,g.inner,g.from,g.to,a),c=g.to}b=g.to}else{if(b==n||(d?ti[b]!=l:ti[b]==l))break;b++}h?c3(e,c,b,r+1,i,h,a):ct;){let d=!0,f=!1;if(!u||c>s[u-1].to){let g=ti[c-1];g!=l&&(d=!1,f=g==16)}let h=!d&&l==1?[]:null,p=d?r:r+1,b=c;e:for(;;)if(u&&b==s[u-1].to){if(f)break e;let g=s[--u];if(!d)for(let O=g.from,y=u;;){if(O==t)break e;if(y&&s[y-1].to==O)O=s[--y].from;else{if(ti[O-1]==l)break e;break}}if(h)h.push(g);else{g.toti.length;)ti[ti.length]=256;let r=[],i=t==Dm?0:1;return u3(e,i,i,n,0,e.length,r),r}function _he(e){return[new mu(0,e,0)]}let Ahe="";function Bnt(e,t,n,r,i){var s;let a=r.head-e.from,l=mu.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=Ys(e.text,a,c.forward(i,n));(dc.to)&&(d=u),Ahe=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)}),Mhe=kt.define({combine:e=>e.some(t=>t)}),Lhe=kt.define();class eb{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 eb(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 eb(Fe.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const CE=mn.define({map:(e,t)=>e.map(t)}),$he=mn.define();function po(e,t,n){let r=e.facet(Rhe);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 xd=kt.define({combine:e=>e.length?e[0]:!0});let Fnt=0;const _0=kt.define({combine(e){return e.filter((t,n)=>{for(let r=0;r{let c=[];return a&&c.push(NC.of(u=>{let d=u.plugin(l);return d?a(d):Vt.none})),s&&c.push(s(l)),c})}static fromClass(t,n){return Ki.define((r,i)=>new t(r,i),n)}}class oI{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(po(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){po(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){po(t.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Bhe=kt.define(),B8=kt.define(),NC=kt.define(),Qhe=kt.define(),Q8=kt.define(),Rw=kt.define(),Fhe=kt.define();function UH(e,t){let n=e.state.facet(Fhe);if(!n.length)return n;let r=n.map(s=>s instanceof Function?s(e):s),i=[];return Yn.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 p=l[h].spec.bidiIsolate,b;if(p==null&&(p=Qnt(t.text,u,d)),c>0&&f.length&&(b=f[f.length-1]).to==u&&b.direction==p)b.to=d,f=b.inner;else{let g={from:u,to:d,direction:p,inner:[]};f.push(g),f=g.inner}}}}),i}const Uhe=kt.define();function F8(e){let t=0,n=0,r=0,i=0;for(let s of e.state.facet(Uhe)){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 u1=kt.define();class Dl{constructor(t,n,r,i){this.fromA=t,this.toA=n,this.fromB=r,this.toB=i}join(t){return new Dl(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 Dl(s,a,l,c))),this.changedRanges=i}static create(t,n,r){return new K2(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 Unt=[];class Zi{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 Unt}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&&Ent(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=qh(this.dom),i=this.length?t>0:n>0;return new yc(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 RC)return t;return null}static get(t){return t.cmTile}}class jC extends Zi{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=zH(i);else n.insertBefore(l.dom,i);r=l.dom}for(i=r?r.nextSibling:n.firstChild,s&&i&&(s.written=!0);i;)i=zH(i);this.length=a}}function zH(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class RC extends jC{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=Zi.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 Bd)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 Bd extends jC{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 Bd(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}}class Vb extends jC{constructor(t,n){super(t),this.attrs=n}isLine(){return!0}static start(t,n,r){let i=new Vb(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,p=0;h=f&&(b.isComposite()?c(b,f-p):(!a||a.isHidden&&(n>0&&!(a.flags&32)||r&&Vnt(a,b)))&&(g>f||b.flags&32)?(a=b,l=f-p):(pi&&(t=i);let s=t,a=t,l=0;t==0&&n<0||t==i&&n>=0?Et.chrome||Et.gecko||(t?(s--,l=1):a=0)?0:c.length-1];return Et.safari&&!l&&u.width==0&&(u=Array.prototype.find.call(c,d=>d.width)||u),r==null?u:hv(u,(l?l>0:n<0)==r)}static of(t,n){let r=new Kp(n||document.createTextNode(t),t);return n||(r.flags|=2),r}}class Pm extends Zi{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 hv(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 qnt{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 uo&&u.mark.eq(c.mark))u.dom!=c.dom&&u.setDOM(lI(c.dom)),i=u;else{if(this.cache.reused.get(c)){let f=Zi.get(c.dom);f&&f.setDOM(lI(c.dom))}let d=uo.of(c.mark,c.dom);i.append(d),i=d}this.cache.reused.set(c,2)}let s=Zi.get(t.text);s&&this.cache.reused.set(s,2);let a=new Kp(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=zhe);let i=Vb.start(t,n||((r=this.cache.find(Vb))===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 uo&&l.mark.eq(a))i=l,n--;else{let c=uo.of(a,(r=this.cache.find(uo,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||!VH(this.curLine,!1)||t.dom.nodeName!="BR"&&t.isWidget()&&!(Et.ios&&VH(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(cI,0,32)||new Pm(cI.toDOM(),0,cI,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 Hnt(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(J2,void 0,1);return r&&(r.flags=n),r||new J2(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class Gnt{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 e_=[Pm,Vb,Kp,uo,J2,Bd,RC];for(let e=0;e[]),this.index=e_.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 uo&&i.unshift(a.mark)),this.openWidget=!1},leave:a=>{a.isLine()?i.length&&(i.length=s=0):a instanceof uo&&(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=Yn.spans(this.decorations,t,n,{point:(l,c,u,d,f,h)=>{if(u instanceof Im){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 p=u.widget||(u.block?qb.block:qb.inline),b=Znt(u),g=this.cache.findWidget(p,c-l,b)||Pm.of(p,this.view,c-l,b);u.block?(u.startSide>0&&i.addLineStartIfNotCovered(r),i.addBlockWidget(g)):(i.ensureLine(r),i.addInlineWidget(g,d,f))}r=null}else r=Knt(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=Zi.get(i);if(i==this.view.contentDOM)break;s instanceof uo?n.push(s):s!=null&&s.isLine()?r=s:s instanceof Bd||(i.nodeName=="DIV"&&!r&&i!=this.view.contentDOM?r=new Vb(i,zhe):r||n.push(uo.of(new Nw({tagName:i.nodeName.toLowerCase(),attributes:knt(i)}),i)))}return{line:r,marks:n}}}function VH(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 Znt(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 zhe={class:"cm-line"};function Knt(e,t){let n=t.spec.attributes,r=t.spec.class;return!n&&!r||(e||(e={class:"cm-line"}),n&&D8(n,e),r&&(e.class+=" "+r)),e}function Jnt(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 uo&&t.push(r.mark)}return t}function lI(e){let t=Zi.get(e);return t&&t.setDOM(e.cloneNode()),e}class qb extends Pc{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}}qb.inline=new qb("span");qb.block=new qb("div");const cI=new class extends Pc{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class qH{constructor(t){this.view=t,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Vt.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 RC(t,t.contentDOM),this.updateInner([new Dl(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:!lrt(t.changes,this.hasComposition)&&!t.selectionSet&&(i=t.state.selection.main.head));let s=i>-1?trt(this.view,t.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:d,to:f}=this.hasComposition;r=new Dl(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,(Et.ie||Et.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=irt(a,this.decorations,t.changes);c.length&&(r=Dl.extendWithRanges(r,c));let u=art(l,this.blockWrappers,t.changes);return u.length&&(r=Dl.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 Wnt(this.view,a,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&Zi.get(n.text)&&l.cache.reused.set(Zi.get(n.text),2),this.tile=l.run(t,n),f3(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=Et.chrome||Et.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)&&J1(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)),Et.gecko&&c.empty&&!this.hasComposition&&ert(u)){let h=document.createTextNode("");this.view.observer.ignore(()=>u.node.insertBefore(h,u.node.childNodes[u.offset]||null)),u=d=new yc(h,0),l=!0}let f=this.view.observer.selectionRange;(l||!f.focusNode||(!tx(u.node,u.offset,f.anchorNode,f.anchorOffset)||!tx(d.node,d.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,c))&&(this.view.observer.ignore(()=>{Et.android&&Et.chrome&&r.contains(f.focusNode)&&ort(f.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let h=fv(this.view.root);if(h)if(c.empty){if(Et.gecko){let p=nrt(u.node,u.offset);if(p&&p!=3){let b=(p==1?whe:She)(u.node,u.offset);b&&(u=new yc(b.node,b.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 p=document.createRange();c.anchor>c.head&&([u,d]=[d,u]),p.setEnd(d.node,d.offset),p.setStart(u.node,u.offset),h.removeAllRanges(),h.addRange(p)}a&&this.view.root.activeElement==r&&(r.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(u,d)),this.impreciseAnchor=u.precise?null:new yc(f.anchorNode,f.anchorOffset),this.impreciseHead=d.precise?null:new yc(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(t,n){return this.hasComposition&&n.empty&&tx(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=fv(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=Zd(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&&!Zi.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 uI?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==ni.LTR,u=0,d=(f,h,p)=>{for(let b=0;bi);b++){let g=f.children[b],O=h+g.length,y=g.dom.getBoundingClientRect(),{height:v}=y;if(p&&!b&&(u+=y.top-p.top),g instanceof Bd)O>r&&d(g,h,y);else if(h>=r&&(u>0&&n.push(-u),n.push(v+u),u=0,a)){let x=g.dom.lastChild,w=x?ex(x):[];if(w.length){let S=w[w.length-1],E=c?S.right-y.left:y.right-S.left;E>l&&(l=E,this.minWidth=s,this.minWidthFrom=h,this.minWidthTo=O)}}p&&b==f.children.length-1&&(u+=p.bottom-y.bottom),h=O+g.breakAfter}};return d(this.tile,0,null),n}textDirectionAt(t){let{tile:n}=this.tile.resolveBlock(t,1);return getComputedStyle(n.dom).direction=="rtl"?ni.RTL:ni.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=ex(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=ex(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(Vt.replace({widget:new uI(l),block:!0,inclusive:!0,isBlockGap:!0}).range(r,a))}if(!s)break;r=s.to+1}return Vt.set(t)}updateDeco(){let t=1,n=this.view.state.facet(NC).map(s=>(this.dynamicDecorationMap[t++]=typeof s=="function")?s(this.view):s),r=!1,i=this.view.state.facet(Q8).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(Yn.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(Lhe))try{if(u(this.view,t.range,t))return!0}catch(d){po(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=F8(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(Ant(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(){f3(this.tile)}}function f3(e,t){let n=t==null?void 0:t.get(e);if(n!=1){n==null&&e.destroy();for(let r of e.children)f3(r,t)}}function ert(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 Vhe(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=whe(n.focusNode,n.focusOffset),i=She(n.focusNode,n.focusOffset),s=r||i;if(i&&r&&i.node!=r.node){let l=Zi.get(i.node);if(!l||l.isText()&&l.text!=i.node.nodeValue)s=i;else if(e.docView.lastCompositionAfterCursor){let c=Zi.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 trt(e,t,n){let r=Vhe(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 Dl(c.mapPos(s),c.mapPos(a),s,a),text:i}}function nrt(e,t){return e.nodeType!=1?0:(t&&e.childNodes[t-1].contentEditable=="false"?1:0)|(t{rt.from&&(n=!0)}),n}class uI extends Pc{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 crt(e,t,n=1){let r=e.charCategorizer(t),i=e.doc.lineAt(t),s=t-i.from;if(i.length==0)return Fe.cursor(t);s==0?n=1:s==i.length&&(n=-1);let a=s,l=s;n<0?a=Ys(i.text,s,!1):l=Ys(i.text,s);let c=r(i.text.slice(a,l));for(;a>0;){let u=Ys(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+e3(a,s,e.state.tabSize)}function h3(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==ma.Text&&(i.type!=s.type||(n<0?s.fromt)))&&(i=s)}}return i||r}return r}function drt(e,t,n,r){let i=h3(e,t.head,t.assoc||-1),s=!r||i.type!=ma.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==ni.LTR)?a.right-1:a.left+1,y:(s.top+s.bottom)/2});if(c!=null)return Fe.cursor(c,n?-1:1)}return Fe.cursor(n?i.to:i.from,n?-1:1)}function HH(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=Bnt(i,s,a,l,n),d=Ahe;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 frt(e,t,n){let r=e.state.charCategorizer(t),i=r(n);return s=>{let a=r(s);return i==Ai.Space&&(i=a),i==a}}function hrt(e,t,n,r){let i=t.head,s=n?1:-1;if(i==(n?e.state.doc.length:0))return Fe.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 b=e.viewState.lineBlockAt(i);a==null&&(a=Math.min(c.right-c.left,e.defaultCharacterWidth*(i-b.from))),l=(s<0?b.top:b.bottom)+d}let f=c.left+a,h=e.viewState.heightOracle.textHeight>>1,p=r??h;for(let b=0;;b+=h){let g=l+(p+b)*s,O=p3(e,{x:f,y:g},!1,s);if(n?g>c.bottom:gl:v{if(t>s&&ti(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:Fe.cursor(r,re.viewState.docHeight)return new lu(e.state.doc.length,-1);if(u=e.elementAtHeight(c),r==null)break;if(u.type==ma.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==ma.Text){let f=urt(e,i,u,a,l);return new lu(f,f==u.from?1:-1)}}if(u.type!=ma.Text)return c<(u.top+u.bottom)/2?new lu(u.from,1):new lu(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 prt(e,a,l,e.textDirectionAt(u.from)).scanTile(d,u.from)}class prt{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(g)){let y=i+Math.floor(Math.random()*b);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(b+b+g)/3)return this.y=c.bottom-1,this.scan(t,n,!0);if(u&&u.top<(b+g+g)/3)return this.y=u.top+1,this.scan(t,n,!0)}let p=(l?this.dirAt(t[d],1):this.baseDir)==ni.LTR;return{i:d,after:this.x>(h.left+h.right)/2==p}}scanText(t,n){let r=[];for(let s=0;s{let a=r[s]-n,l=r[s+1]-n;return pv(t.dom,a,l).getClientRects()});return i.after?new lu(r[i.i+1],-1):new lu(r[i.i],1)}scanTile(t,n){if(!t.length)return new lu(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:pv(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 lu(r[i.i+1],-1):new lu(a,1)}}const Kg="￿";class mrt{constructor(t,n){this.points=t,this.view=n,this.text="",this.lineSeparator=n.state.facet(rr.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=Kg}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=Zi.get(i),l=i.nextSibling;if(l==n){a!=null&&a.breakAfter&&!l&&r!=this.view.contentDOM&&this.lineBreak();break}let c=Zi.get(l);(a&&c?a.breakAfter:(a?a.breakAfter:Z2(i))||Z2(l)&&(i.nodeName!="BR"||a!=null&&a.isWidget())&&this.text.length>s)&&!brt(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=Zi.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+(grt(t,r.node,r.offset)?n:0))}}function grt(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=Hhe(t.docView.tile,n,r,0))){let c=s||a?[]:xrt(t),u=new mrt(c,t);u.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=u.text,this.newSel=vrt(c,this.bounds.from)}else{let c=t.observer.selectionRange,u=s&&s.node==c.focusNode&&s.offset==c.focusOffset||!o3(t.contentDOM,c.focusNode)?l.main.head:t.docView.posFromDOM(c.focusNode,c.focusOffset),d=a&&a.node==c.anchorNode&&a.offset==c.anchorOffset||!o3(t.contentDOM,c.anchorNode)?l.main.anchor:t.docView.posFromDOM(c.anchorNode,c.anchorOffset),f=t.viewport;if((Et.ios||Et.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(Fe.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),p=0;h&&(p=t.inputState.lastTouchY<=h.bottom?-1:1),this.newSel=Fe.create([Fe.cursor(u,p)])}else this.newSel=Fe.single(d,u)}}}function Hhe(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 Hhe(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 Xhe(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||Et.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:Tr.of(t.text.slice(s.from-l,h).split(Kg))}:(p=Ghe(f,t.text,u-l,d))&&(Et.chrome&&a==13&&p.toB==p.from+2&&t.text.slice(p.from,p.toB)==Kg+Kg&&p.toB--,n={from:l+p.from,to:l+p.toA,insert:Tr.of(t.text.slice(p.from,p.toB).split(Kg))})}else r&&(!e.hasFocus&&i.facet(xd)||t_(r,s))&&(r=null);if(!n&&!r)return!1;if((Et.mac||Et.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=Fe.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:Tr.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)}:Et.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==` + `&&e.lineWrapping&&(r&&(r=Fe.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:Tr.of([" "])}),n)return U8(e,n,r,a);if(r&&!t_(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=qhe(i.facet(Rw).map(u=>u(e)),r))),e.dispatch({selection:r,scrollIntoView:l,userEvent:c}),!0}else return!1}function U8(e,t,n,r=-1){if(Et.ios&&e.inputState.flushIOSKey(t))return!0;let i=e.state.selection.main;if(Et.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&&J0(e.contentDOM,"Enter",13)||(t.from==i.from-1&&t.to==i.to&&t.insert.length==0||r==8&&t.insert.lengthi.head)&&J0(e.contentDOM,"Backspace",8)||t.from==i.from&&t.to==i.to+1&&t.insert.length==0&&J0(e.contentDOM,"Delete",46)))return!0;let s=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let a,l=()=>a||(a=yrt(e,t,n));return e.state.facet(Ihe).some(c=>c(e,t.from,t.to,s,l))||e.dispatch(l()),!0}function yrt(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:Fe.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&&Vhe(e,n.main.head);if(h){let b=t.insert.length-(t.to-t.from);f={from:h.from,to:h.to-b}}else f=e.state.doc.lineAt(s.head);let p=s.to-t.to;r=i.changeByRange(b=>{if(b.from==s.from&&b.to==s.to)return{changes:c,range:u||b.map(c)};let g=b.to-p,O=g-d.length;if(e.state.sliceDoc(O,g)!=d||g>=f.from&&O<=f.to)return{range:b};let y=i.changes({from:O,to:g,insert:t.insert}),v=b.to-s.to;return{changes:y,range:u?Fe.range(Math.max(0,u.anchor+v),Math.max(0,u.head+v)):b.map(y)}})}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 Ghe(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 xrt(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 XH(n,r)),(i!=n||s!=r)&&t.push(new XH(i,s))),t}function vrt(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?Fe.single(n+t,r+t):null}function t_(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class wrt{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,Et.safari&&t.contentDOM.addEventListener("input",()=>null),Et.gecko&&$rt(t.contentDOM.ownerDocument)}handleEvent(t){!jrt(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=Ert(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&&Whe.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),Et.android&&Et.chrome&&!t.synthetic&&(t.keyCode==13||t.keyCode==8))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;if(Et.ios&&!t.synthetic&&!t.altKey&&!t.metaKey&&(Yhe.some(n=>n.keyCode==t.keyCode)&&!t.ctrlKey||krt.indexOf(t.key)>-1&&t.ctrlKey)){let n={ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey,shiftKey:t.shiftKey};return n.shiftKey&&Et.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&Srt(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:Et.safari&&!Et.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 Srt(e){return e.visualViewport?e.visualViewport.height*e.visualViewport.scale/e.document.documentElement.clientHeight<.85:!1}function GH(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(i){po(n.state,i)}}}function Ert(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(GH(r.value,c))}if(a)for(let l in a){let c=a[l];c&&n(l).observers.push(GH(r.value,c))}}for(let r in Ac)n(r).handlers.push(Ac[r]);for(let r in Wa)n(r).observers.push(Wa[r]);return t}const Yhe=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],krt="dthko",Whe=[16,17,18,20,91,92,224,225],NE=6;function jE(e){return Math.max(0,e)*.7+8}function Trt(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}class _rt{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=yhe(t.contentDOM),this.atoms=t.state.facet(Rw).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(rr.allowMultipleSelections)&&Art(t,n),this.dragging=Nrt(t,n)&&Jhe(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&&Trt(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=F8(this.view);t.clientX-c.left<=i+NE?n=-jE(i-t.clientX):t.clientX+c.right>=a-NE&&(n=jE(t.clientX-a)),t.clientY-c.top<=s+NE?r=-jE(s-t.clientY):t.clientY+c.bottom>=l-NE&&(r=jE(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=qhe(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 Art(e,t){let n=e.state.facet(Che);return n.length?n[0](t):Et.mac?t.metaKey:t.ctrlKey}function Crt(e,t){let n=e.state.facet(Nhe);return n.length?n[0](t):Et.mac?!t.altKey:!t.ctrlKey}function Nrt(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=fv(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 jrt(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=Zi.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(t))return!1;return!0}const Ac=Object.create(null),Wa=Object.create(null),Zhe=Et.ie&&Et.ie_version<15||Et.ios&&Et.webkit_version<604;function Rrt(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(),Khe(e,n.value)},50)}function IC(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function Khe(e,t){t=IC(e.state,L8,t);let{state:n}=e,r,i=1,s=n.toText(t),a=s.lines==n.selection.ranges.length;if(m3!=null&&n.selection.ranges.every(c=>c.empty)&&m3==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:Fe.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:Fe.cursor(c.from+u.length)}}):r=n.replaceSelection(s);e.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Wa.scroll=e=>{let t=e.inputState;t.lastScrollTop=e.scrollDOM.scrollTop,t.lastScrollLeft=e.scrollDOM.scrollLeft,Et.ios&&!t.touchActive&&(t.lastIOSMomentumScroll=Date.now())};Wa.wheel=Wa.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()};Ac.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1);Wa.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")};Wa.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")};Wa.touchend=(e,t)=>{e.inputState.touchActive=!1};Ac.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(jhe))if(n=r(e,t),n)break;if(!n&&t.button==0&&(n=Drt(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new _rt(e,t,n,r)),r&&e.observer.ignore(()=>{xhe(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 YH(e,t,n,r){if(r==1)return Fe.cursor(t,n);if(r==2)return crt(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?(ZH+1)%3:1}function Drt(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=Jhe(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=YH(e,c.pos,c.assoc,r);if(n.pos!=c.pos&&!a){let f=YH(e,n.pos,n.assoc,r),h=Math.min(f.from,d.from),p=Math.max(f.to,d.to);d=h1&&(u=Prt(i,c.pos))?u:l?i.addRange(d):Fe.create([d])}}}function Prt(e,t){for(let n=0;n=t)return Fe.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}Ac.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=Fe.undirectionalRange(s,a))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",IC(e.state,$8,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1};Ac.dragend=e=>(e.inputState.draggedContent=null,!1);function JH(e,t,n,r){if(n=IC(e.state,L8,n),!n)return;let i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:s}=e.inputState,a=r&&s&&Crt(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}Ac.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&&JH(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 JH(e,t,r,!0),!0}return!1};Ac.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=Zhe?null:t.clipboardData;return n?(Khe(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(Rrt(e),!1)};function Mrt(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 Lrt(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:IC(e,$8,t.join(e.lineBreak)),ranges:n,linewise:r}}let m3=null;Ac.copy=Ac.cut=(e,t)=>{if(!J1(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:i}=Lrt(e.state);if(!n&&!i)return!1;m3=i?n:null,t.type=="cut"&&!e.state.readOnly&&e.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=Zhe?null:t.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(Mrt(e,n),!1)};const epe=Lu.define();function tpe(e,t){let n=[];for(let r of e.facet(Dhe)){let i=r(e,t);i&&n.push(i)}return n.length?e.update({effects:n,annotations:epe.of(!0)}):null}function npe(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=tpe(e.state,t);n?e.dispatch(n):e.update([])}},10)}Wa.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),npe(e)};Wa.blur=e=>{e.observer.clearSelectionRange(),npe(e)};Wa.compositionstart=Wa.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange==null&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))};Wa.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,Et.chrome&&Et.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))};Wa.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()};Ac.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 U8(e,{from:c,to:u,insert:e.state.toText(s)},null),!0}}let i;if(Et.chrome&&Et.android&&(i=Yhe.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 Et.ios&&t.inputType=="deleteContentForward"&&e.observer.flushSoon(),Et.safari&&t.inputType=="insertText"&&e.inputState.composing>=0&&setTimeout(()=>Wa.compositionend(e,t),20),!1};const eX=new Set;function $rt(e){eX.has(e)||(eX.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}const tX=["pre-wrap","normal","pre-line","break-spaces"];let Hb=!1;function nX(){Hb=!1}class Brt{constructor(t){this.lineWrapping=t,this.doc=Tr.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 tX.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)>tT&&(Hb=!0),this.height=t)}replace(t,n,r){return Ga.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,ci.ByPosNoHeight,r.setDoc(n),0,0),p=h.to>=u?h:s.lineAt(u,ci.ByPosNoHeight,r,0,0);for(f+=p.to-u,u=p.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,ci.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 Fo extends rpe{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 gc(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 Fo||i instanceof oa&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof oa?i=new Fo(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):Ga.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 oa extends Ga{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 oa?r[r.length-1]=new oa(s.length+i):r.push(null,new oa(i-1))}if(t>0){let s=r[0];s instanceof oa?r[0]=new oa(t+s.length):r.unshift(new oa(t-1),null)}return Ga.of(r)}decomposeLeft(t,n){n.push(new oa(t-1),null)}decomposeRight(t,n){n.push(null,new oa(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 oa(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)>=tT&&(c=-2);let p=new Fo(d,f,h);p.outdated=!1,a.push(p),l+=d+1}l<=s&&a.push(null,new oa(s-l).updateHeight(t,l));let u=Ga.of(a);return(c<0||Math.abs(u.height-this.height)>=tT||Math.abs(c-this.heightMetrics(t,n).perLine)>=tT)&&(Hb=!0),n_(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 Urt extends Ga{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==ci.ByPosNoHeight?ci.ByPosNoHeight:ci.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,ci.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&&rX(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?Ga.of(this.break?[t,null,n]:[t,n]):(this.left=n_(this.left,t),this.right=n_(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 rX(e,t){let n,r;e[t]==null&&(n=e[t-1])instanceof oa&&(r=e[t+1])instanceof oa&&e.splice(t-1,3,new oa(n.length+1+r.length))}const zrt=5;class z8{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 Fo?i.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Fo(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=zrt)&&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 Fo(this.pos-t,-1,0)),this.writtenTo=this.pos}blankContent(t,n){let r=new oa(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 Fo)return t;let n=new Fo(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 Fo)&&!this.isCovered?this.nodes.push(new Fo(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 Xrt(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left0&&t.top0}function Grt(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class fI{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 Brt(r),this.stateDeco=aX(n),this.heightMap=Ga.empty().applyChanges(this.stateDeco,Tr.empty,this.heightOracle.setDoc(n.doc),[new Dl(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=Vt.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 RE(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?sX:new V8(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(d1(t,this.scaler))})}update(t,n=null){this.state=t.state;let r=this.stateDeco;this.stateDeco=aX(this.state);let i=t.changedRanges,s=Dl.extendWithRanges(i,Vrt(r,this.stateDeco,t?t.changes:js.empty(this.state.doc.length))),a=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);nX(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=a||Hb)&&(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(Mhe)&&(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"?ni.RTL:ni.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}=Ohe(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 p=yhe(this.view.contentDOM,!1).y;p!=this.scrollParent&&(this.scrollParent=p,this.scrollAnchorHeight=-1,this.scrollOffset=0);let b=this.getScrollOffset();this.scrollOffset!=b&&(this.scrollAnchorHeight=-1,this.scrollOffset=b),this.scrolledToBottom=vhe(this.scrollParent||t.win);let g=(this.printing?Grt:Hrt)(n,this.paddingTop),O=g.top-this.pixelViewport.top,y=g.bottom-this.pixelViewport.bottom;this.pixelViewport=g;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&&!Xrt(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}=t.docView.measureTextSize();a=E>0&&i.refresh(s,E,k,T,Math.max(5,x/k),S),a&&(t.docView.minWidth=0,u|=16)}O>0&&y>0?d=Math.max(O,y):O<0&&y<0&&(d=Math.min(O,y)),nX();for(let E of this.viewports){let k=E.from==this.viewport.from?S:t.docView.measureVisibleLineHeights(E);this.heightMap=(a?Ga.empty().applyChanges(this.stateDeco,Tr.empty,this.heightOracle,[new Dl(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(i,0,a,new Qrt(E.from,k))}Hb&&(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 RE(i.lineAt(a-r*1e3,ci.ByHeight,s,0,0).from,i.lineAt(l+(1-r)*1e3,ci.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,ci.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!=ni.LTR&&!r)return[];let l=[],c=(d,f,h,p)=>{if(f-dd&&yy.from>=h.from&&y.to<=h.to&&Math.abs(y.from-d)y.fromv));if(!O){if(fx.from<=f&&x.to>=f)){let x=n.moveToLineBoundary(Fe.cursor(f),!1,!0).head;x>d&&(f=x)}let y=this.gapSize(h,d,f,p),v=r||y<2e6?y:2e6;O=new fI(d,f,y,v)}l.push(O)},u=d=>{if(d.length2e6)for(let E of t)E.from>=d.from&&E.fromd.from&&c(d.from,p,d,f),bn.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(t){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];Yn.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)||d1(this.heightMap.lineAt(t,ci.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)||d1(this.heightMap.lineAt(this.scaler.fromDOM(t),ci.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 d1(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 RE{constructor(t,n){this.from=t,this.to=n}}function Wrt(e,t,n){let r=[],i=e,s=0;return Yn.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 DE(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 Zrt(e,t){for(let n of e)if(t(n))return n}const sX={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function aX(e){let t=e.facet(NC).filter(r=>typeof r!="function"),n=e.facet(Q8).filter(r=>typeof r!="function");return n.length&&t.push(Yn.join(n)),t}class V8{constructor(t,n,r){let i=0,s=0,a=0;this.viewports=r.map(({from:l,to:c})=>{let u=n.lineAt(l,ci.ByPos,t,0,0).top,d=n.lineAt(c,ci.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 d1(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new gc(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(i=>d1(i,t)):e._content)}const PE=kt.define({combine:e=>e.join(" ")}),g3=kt.define({combine:e=>e.indexOf(!0)>-1}),b3=zh.newName(),ipe=zh.newName(),spe=zh.newName(),ape={"&light":"."+ipe,"&dark":"."+spe};function O3(e,t,n){return new zh(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 Krt=O3("."+b3,{"&":{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"}},ape),Jrt={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},hI=Et.ie&&Et.ie_version<=11;class eit{constructor(t){this.view=t,this.active=!1,this.editContext=null,this.selectionRange=new Cnt,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);(Et.ie&&Et.ie_version<=11||Et.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&&Et.android&&t.constructor.EDIT_CONTEXT!==!1&&!(Et.chrome&&Et.chrome_version<126)&&(this.editContext=new nit(t),t.state.facet(xd)&&(t.contentDOM.editContext=this.editContext.editContext)),hI&&(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(xd)?r.root.activeElement!=this.dom:!J1(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}(Et.ie&&Et.ie_version<=11||Et.android&&Et.chrome)&&!r.state.selection.main.empty&&i.focusNode&&tx(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,n=fv(t.root);if(!n)return!1;let r=Et.safari&&t.root.nodeType==11&&t.root.activeElement==this.dom&&tit(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let i=J1(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&&J0(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&&J1(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 Ort(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=Xhe(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!t_(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=oX(n,t.previousSibling||t.target.previousSibling,-1),i=oX(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(xd)!=t.state.facet(xd)&&(t.view.contentDOM.editContext=t.state.facet(xd)?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 oX(e,t,n){for(;t;){let r=Zi.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 lX(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 tx(a.node,a.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function tit(e,t){if(t.getComposedRanges){let i=t.getComposedRanges(e.root)[0];if(i)return lX(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?lX(e,n):null}class nit{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=Ghe(t.state.sliceDoc(l,c),r.text,(u?i.from:i.to)-l,u?"end":null);if(!d){let h=Fe.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));t_(h,i)||t.dispatch({selection:h,userEvent:"select"});return}let f={from:d.from+l,to:d.toA+l,insert:Tr.of(r.text.slice(d.from,d.toB).split(` +`))};if((Et.mac||Et.android)&&f.from==a-1&&/^\. ?$/.test(r.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:c,insert:Tr.of([r.text.replace("."," ")])}),this.pendingContextChange=f,!t.state.readOnly){let h=this.to-this.from+(f.to-f.from+f.insert.length);U8(t,f,Fe.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=fv(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 pt{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||Nnt(t.parent)||document,this.viewState=new iX(this,t.state||rr.create(t)),t.scrollTo&&t.scrollTo.is(CE)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(_0).map(i=>new oI(i));for(let i of this.plugins)i.update(this);this.observer=new eit(this),this.inputState=new wrt(this),this.inputState.ensureHandlers(this.plugins),this.docView=new qH(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(epe))?(this.inputState.notifiedFocused=a,l=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,c=tpe(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(rr.phrases)!=this.state.facet(rr.phrases))return this.setState(s);i=K2.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:p}=h.state.selection,{x:b,y:g}=this.state.facet(pt.cursorScrollMargin);f=new eb(p.empty?p:Fe.cursor(p.head,p.head>p.anchor?-1:1),"nearest","nearest",g,b)}for(let p of h.effects)p.is(CE)&&(f=p.value.clip(this.state))}this.viewState.update(i,f),this.bidiCache=r_.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(u1)!=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(PE)!=i.state.facet(PE)&&(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(d3))try{h(i)}catch(p){po(this.state,p,"update listener")}(c||d)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),d&&!Xhe(this,d)&&u.force&&J0(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 iX(this,t),this.plugins=t.facet(_0).map(r=>new oI(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new qH(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(_0),r=t.state.facet(_0);if(n!=r){let i=[];for(let s of r){let a=n.indexOf(s);if(a<0)i.push(new oI(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(vhe(r||this.win))s=-1,a=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(i);s=p.from,a=p.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(p=>{try{return p.read(this)}catch(b){return po(this.state,b),cX}}),f=K2.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 p=0;p1||b<-1)&&!(Et.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+b,r?r.scrollTop+=b:this.win.scrollBy(0,b),a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let l of this.state.facet(d3))l(n)}get themeClasses(){return b3+" "+(this.state.facet(g3)?spe:ipe)+" "+this.state.facet(PE)}updateAttrs(){let t=uX(this,Bhe,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(xd)?"true":"false",class:"cm-content",style:`${Et.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),uX(this,B8,n);let r=this.observer.ignore(()=>{let i=BH(this.contentDOM,this.contentAttrs,n),s=BH(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(pt.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(u1);let t=this.state.facet(pt.cspNonce);zh.mount(this.root,this.styleModules.concat(Krt).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 dI(this,t,HH(this,t,n,r))}moveByGroup(t,n){return dI(this,t,HH(this,t,n,r=>frt(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 Fe.cursor(s.side(n,i)+t.from,s.forward(!n,i)?1:-1)}moveToLineBoundary(t,n,r=!0){return drt(this,t,n,r)}moveVertically(t,n,r){return dI(this,t,hrt(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=p3(this,t,n);return r&&r.pos}posAndSideAtCoords(t,n=!0){return this.readMeasured(),p3(this,t,n)}coordsAtPos(t,n=1){this.readMeasured();let r=this.state.doc.lineAt(t),i=this.bidiSpans(r),s=i[mu.find(i,t-r.from,-1,n)];return this.docView.coordsAt(t,n,s.dir==ni.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(Phe)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>rit)return _he(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||The(s.isolates,r=UH(this,t))))return s.order;r||(r=UH(this,t));let i=$nt(t.text,n,r);return this.bidiCache.push(new r_(t.from,t.to,n,r,!0,i)),i}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Et.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{xhe(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 CE.of(new eb(typeof t=="number"?Fe.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 CE.of(new eb(Fe.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 Ki.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return Ki.define(()=>({}),{eventObservers:t})}static theme(t,n){let r=zh.newName(),i=[PE.of(r),u1.of(O3(`.${r}`,t))];return n&&n.dark&&i.push(g3.of(!0)),i}static baseTheme(t){return ff.lowest(u1.of(O3("."+b3,t,ape)))}static findFromDOM(t){var n;let r=t.querySelector(".cm-content"),i=r&&Zi.get(r)||Zi.get(t);return((n=i==null?void 0:i.root)===null||n===void 0?void 0:n.view)||null}}pt.styleModule=u1;pt.inputHandler=Ihe;pt.clipboardInputFilter=L8;pt.clipboardOutputFilter=$8;pt.scrollHandler=Lhe;pt.focusChangeEffect=Dhe;pt.perLineTextDirection=Phe;pt.exceptionSink=Rhe;pt.updateListener=d3;pt.editable=xd;pt.mouseSelectionStyle=jhe;pt.dragMovesSelection=Nhe;pt.clickAddsSelectionRange=Che;pt.decorations=NC;pt.blockWrappers=Qhe;pt.outerDecorations=Q8;pt.atomicRanges=Rw;pt.bidiIsolatedRanges=Fhe;pt.cursorScrollMargin=kt.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}}});pt.scrollMargins=Uhe;pt.darkTheme=g3;pt.cspNonce=kt.define({combine:e=>e.length?e[0]:""});pt.contentAttributes=B8;pt.editorAttributes=Bhe;pt.lineWrapping=pt.contentAttributes.of({class:"cm-lineWrapping"});pt.announce=mn.define();const rit=4096,cX={};class r_{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:ni.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&&D8(a,n)}return n}const iit=Et.mac?"mac":Et.windows?"win":Et.linux?"linux":"key";function sit(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 oit(e,t,n){return lpe(ope(e.state),t,e,n)}let Kf=null;const lit=4e3;function cit(e,t=iit){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 p=n[a]||(n[a]=Object.create(null)),b=l.split(/ (?!$)/).map(y=>sit(y,t));for(let y=1;y{let w=Kf={view:x,prefix:v,scope:a};return setTimeout(()=>{Kf==w&&(Kf=null)},lit),!0}]})}let g=b.join(" ");i(g,!1);let O=p[g]||(p[g]={preventDefault:!1,stopPropagation:!1,run:((h=(f=p._any)===null||f===void 0?void 0:f.run)===null||h===void 0?void 0:h.slice())||[]});c&&O.run.push(c),u&&(O.preventDefault=!0),d&&(O.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(p=>f(p,y3))}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 y3=null;function lpe(e,t,n,r){y3=t;let i=Snt(t),s=lo(i,0),a=ou(s)==i.length&&i!=" ",l="",c=!1,u=!1,d=!1;Kf&&Kf.view==n&&Kf.scope==r&&(l=Kf.prefix+" ",Whe.indexOf(t.keyCode)<0&&(u=!0,Kf=null));let f=new Set,h=O=>{if(O){for(let y of O.run)if(!f.has(y)&&(f.add(y),y(n)))return O.stopPropagation&&(d=!0),!0;O.preventDefault&&(O.stopPropagation&&(d=!0),u=!0)}return!1},p=e[r],b,g;return p&&(h(p[l+ME(i,t,!a)])?c=!0:a&&(t.altKey||t.metaKey||t.ctrlKey)&&!(Et.windows&&t.ctrlKey&&t.altKey)&&!(Et.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(b=Vh[t.keyCode])&&b!=i?(h(p[l+ME(b,t,!0)])||t.shiftKey&&(g=uv[t.keyCode])!=i&&g!=b&&h(p[l+ME(g,t,!1)]))&&(c=!0):a&&t.shiftKey&&h(p[l+ME(i,t,!0)])&&(c=!0),!c&&h(p._any)&&(c=!0)),u&&(c=!0),c&&d&&t.stopPropagation(),y3=null,c}class mm{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=cpe(t);return[new mm(n,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return uit(t,n,r)}}function cpe(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==ni.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function fX(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 uit(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==ni.LTR,a=e.contentDOM,l=a.getBoundingClientRect(),c=cpe(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),p=h3(e,r,1),b=h3(e,i,-1),g=p.type==ma.Text?p:null,O=b.type==ma.Text?b:null;if(g&&(e.lineWrapping||p.widgetLineBreaks)&&(g=fX(e,r,1,g)),O&&(e.lineWrapping||b.widgetLineBreaks)&&(O=fX(e,i,-1,O)),g&&O&&g.from==O.from&&g.to==O.to)return v(x(n.from,n.to,g));{let S=g?x(n.from,null,g):w(p,!1),E=O?x(null,n.to,O):w(b,!0),k=[];return(g||p).to<(O||b).from-(g&&O?1:0)||p.widgetLineBreaks>1&&S.bottom+e.defaultLineHeight/2R&&D.from<$)for(let M=Math.max(D.from,R),j=Math.min(D.to,$);;){let P=e.state.doc.lineAt(M);for(let L of e.bidiSpans(P)){let U=L.from+P.from,F=L.to+P.from;if(U>=j)break;F>M&&_(Math.max(U,M),S==null&&U<=R,Math.min(F,j),E==null&&F>=$,L.dir)}if(M=P.to+1,M>=j)break}return N.length==0&&_(R,S==null,$,E==null,e.textDirection),{top:T,bottom:C,horizontal:N}}function w(S,E){let k=l.top+(E?S.top:S.bottom);return{top:k,bottom:k,horizontal:[]}}}function dit(e,t){return e.constructor==t.constructor&&e.eq(t)}class fit{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(nT)!=t.state.facet(nT)&&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(nT);for(;n!dit(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,Et.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const nT=kt.define();function upe(e){return[Ki.define(t=>new fit(t,e)),nT.of(e)]}const Xb=kt.define({combine(e){return $u(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(t,n)=>Math.min(t,n),drawRangeCursor:(t,n)=>t||n})}});function hit(e={}){return[Xb.of(e),pit,mit,git,Mhe.of(!0)]}function dpe(e){return e.startState.facet(Xb)!=e.state.facet(Xb)}const pit=upe({above:!0,markers(e){let{state:t}=e,n=t.facet(Xb),r=[];for(let i of t.selection.ranges){let s=i==t.selection.main;if(i.empty||n.drawRangeCursor&&!(s&&Et.ios&&n.iosSelectionHandles)){let a=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=i.empty?i:Fe.cursor(i.head,i.assoc);for(let c of mm.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=dpe(e);return n&&hX(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){hX(t.state,e)},class:"cm-cursorLayer"});function hX(e,t){t.style.animationDuration=e.facet(Xb).cursorBlinkRate+"ms"}const mit=upe({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 mm.forRange(e,"cm-selectionBackground",i))t.push(s);if(Et.ios&&!n.empty&&e.state.facet(Xb).iosSelectionHandles){for(let i of mm.forRange(e,"cm-selectionHandle cm-selectionHandle-start",Fe.cursor(n.from,1)))t.push(i);for(let i of mm.forRange(e,"cm-selectionHandle cm-selectionHandle-end",Fe.cursor(n.to,1)))t.push(i)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||dpe(e)},class:"cm-selectionLayer"}),git=ff.highest(pt.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"}}}})),fpe=mn.define({map(e,t){return e==null?null:t.mapPos(e)}}),f1=ga.define({create(){return null},update(e,t){return e!=null&&(e=t.changes.mapPos(e)),t.effects.reduce((n,r)=>r.is(fpe)?r.value:n,e)}}),bit=Ki.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(f1);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(f1)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(f1),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(f1)!=e&&this.view.dispatch({effects:fpe.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 Oit(){return[f1,bit]}function pX(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 yit(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 xit{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 Wd,r=n.add.bind(n);for(let{from:i,to:s}of yit(t,this.maxLength))pX(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(y.range(g,O));if(c==u)for(this.regexp.lastIndex=d-c.from;(p=this.regexp.exec(c.text))&&p.indexthis.addMatch(O,t,g,b));n=n.update({filterFrom:d,filterTo:f,filter:(g,O)=>gf,add:h})}}return n}}const x3=/x/.unicode!=null?"gu":"g",vit=new RegExp(`[\0-\b +--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,x3),wit={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 pI=null;function Sit(){var e;if(pI==null&&typeof document<"u"&&document.body){let t=document.body.style;pI=((e=t.tabSize)!==null&&e!==void 0?e:t.MozTabSize)!=null}return pI||!1}const rT=kt.define({combine(e){let t=$u(e,{render:null,specialChars:vit,addSpecialChars:null});return(t.replaceTabs=!Sit())&&(t.specialChars=new RegExp(" |"+t.specialChars.source,x3)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,x3)),t}});function Eit(e={}){return[rT.of(e),kit()]}let mX=null;function kit(){return mX||(mX=Ki.fromClass(class{constructor(e){this.view=e,this.decorations=Vt.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(rT)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new xit({regexp:e.specialChars,decoration:(t,n,r)=>{let{doc:i}=n.state,s=lo(t[0],0);if(s==9){let a=i.lineAt(r),l=n.state.tabSize,c=_c(a.text,l,r-a.from);return Vt.replace({widget:new Cit((l-c%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=Vt.replace({widget:new Ait(e,s)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(rT);e.startState.facet(rT)!=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 Tit="•";function _it(e){return e>=32?Tit:e==10?"␤":String.fromCharCode(9216+e)}class Ait extends Pc{constructor(t,n){super(),this.options=t,this.code=n}eq(t){return t.code==this.code}toDOM(t){let n=_it(this.code),r=t.state.phrase("Control character")+" "+(wit[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 Cit extends Pc{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 Nit(){return Rit}const jit=Vt.line({class:"cm-activeLine"}),Rit=Ki.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(jit.range(i.from)),t=i.from)}return Vt.set(n)}},{decorations:e=>e.decorations});class Iit extends Pc{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?ex(t.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(t.parentNode),i=hv(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 Dit(e){let t=Ki.fromClass(class{constructor(n){this.view=n,this.placeholder=e?Vt.set([Vt.widget({widget:new Iit(e),side:1}).range(0)]):Vt.none}get decorations(){return this.view.state.doc.length?Vt.none:this.placeholder}},{decorations:n=>n.decorations});return typeof e=="string"?[t,pt.contentAttributes.of({"aria-placeholder":e})]:t}const v3=2e3;function Pit(e,t,n){let r=Math.min(t.line,n.line),i=Math.max(t.line,n.line),s=[];if(t.off>v3||n.off>v3||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(Fe.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=e3(u.text,a,e.tabSize,!0);if(d<0)s.push(Fe.cursor(u.to));else{let f=e3(u.text,l,e.tabSize);s.push(Fe.range(u.from+d,u.from+f))}}}return s}function Mit(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}function gX(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>v3?-1:i==r.length?Mit(e,t.clientX):_c(r.text,e.state.tabSize,n-r.from);return{line:r.number,col:s,off:i}}function Lit(e,t){let n=gX(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=gX(e,i);if(!l)return r;let c=Pit(e.state,n,l);return c.length?a?Fe.create(c.concat(r.ranges)):Fe.create(c):r}}:null}function $it(e){let t=n=>n.altKey&&n.button==0;return pt.mouseSelectionStyle.of((n,r)=>t(r)?Lit(n,r):null)}const Bit={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},Qit={style:"cursor: crosshair"};function Fit(e={}){let[t,n]=Bit[e.key||"Alt"],r=Ki.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,pt.contentAttributes.of(i=>{var s;return!((s=i.plugin(r))===null||s===void 0)&&s.isDown?Qit:null})]}const LE="-10000px";class hpe{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 Uit(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const mI=kt.define({combine:e=>{var t,n,r;return{position:Et.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)||Uit}}}),bX=new WeakMap,q8=Ki.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(mI);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 hpe(e,H8,(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(mI);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=LE,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(Et.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=F8(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(mI).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=LE;continue}let p=c.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,b=p?7:0,g=h.right-h.left,O=(t=bX.get(u))!==null&&t!==void 0?t:h.bottom-h.top,y=u.offset||Vit,v=this.view.textDirection==ni.LTR,x=h.width>r.right-r.left?v?r.left:r.right-h.width:v?Math.max(r.left,Math.min(f.left-(p?14:0)+y.x,r.right-g)):Math.min(Math.max(r.left,f.left-g+(p?14:0)-y.x),r.right-g),w=this.above[l];!c.strictSide&&(w?f.top-O-b-y.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)-b;if(Sx&&T.topE&&(E=w?T.top-O-2-b:T.bottom+b+2);if(this.position=="absolute"?(d.style.top=(E-e.parent.top)/s+"px",OX(d,(x-e.parent.left)/i)):(d.style.top=E/s+"px",OX(d,x/i)),p){let T=f.left+(v?y.x:-y.x)-(x+14-7);p.style.left=T/i+"px"}u.overlap!==!0&&a.push({left:x,top:E,right:k,bottom:E+O}),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=LE}},{eventObservers:{scroll(){this.maybeMeasure()}}});function OX(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const zit=pt.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"}}}),Vit={x:0,y:0},H8=kt.define({enables:[q8,zit]}),i_=kt.define({combine:e=>e.reduce((t,n)=>t.concat(n),[])});class DC{static create(t){return new DC(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new hpe(t,i_,(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 qit=H8.compute([i_],e=>{let t=e.facet(i_);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:DC.create,above:t[0].above,arrow:t.some(n=>n.arrow)}}),ppe=kt.define();class Hit{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==ni.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=>po(t.state,c,"hover tooltip"))}else a(s)}get tooltip(){let t=this.view.plugin(q8),n=t?t.manager.tooltips.findIndex(r=>r.create==DC.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&&!Xit(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:!Git(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 $E=4;function Xit(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-$E&&t.clientX<=r+$E&&t.clientY>=i-$E&&t.clientY<=s+$E}function Git(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 Yit(e,t={}){let n=mn.define(),r=new WeakMap,i=ga.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(Zit)&&!u.value||u.value==i)&&(a=[]);return a.length&&c&&r.set(a,c),a},provide:a=>i_.from(a)});const s=Ki.define(a=>new Hit(a,e,i,r,n,t.hoverTime||300));return{active:i,extension:[i,s,ppe.of(s),qit]}}function Wit(e,t,n,r={}){var i;let s=e.state.facet(ppe).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 mpe(e,t){let n=e.plugin(q8);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}const Zit=mn.define(),yX=kt.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 X8(e,t){let n=e.plugin(gpe),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}const gpe=Ki.fromClass(class{constructor(e){this.input=e.state.facet(mv),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(e));let t=e.state.facet(yX);this.top=new BE(e,!0,t.topContainer),this.bottom=new BE(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(yX);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new BE(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new BE(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(mv);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=>pt.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class BE{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=xX(t);t=t.nextSibling}else this.dom.insertBefore(n.dom,t);for(;t;)t=xX(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 xX(e){let t=e.nextSibling;return e.remove(),t}const mv=kt.define({enables:gpe});function Kit(e,t){let n,r=new Promise(a=>n=a),i=a=>Jit(a,t,n);e.state.field(gI,!1)?e.dispatch({effects:bpe.of(i)}):e.dispatch({effects:mn.appendConfig.of(gI.init(()=>[i]))});let s=Ope.of(i);return{close:s,result:r.then(a=>((e.win.queueMicrotask||(c=>e.win.setTimeout(c,10)))(()=>{e.state.field(gI).indexOf(i)>-1&&e.dispatch({effects:s})}),a))}}const gI=ga.define({create(){return[]},update(e,t){for(let n of t.effects)n.is(bpe)?e=[n.value].concat(e):n.is(Ope)&&(e=e.filter(r=>r!=n.value));return e},provide:e=>mv.computeN([e],t=>t.field(e))}),bpe=mn.define(),Ope=mn.define();function Jit(e,t,n){let r=t.content?t.content(e,()=>a(null)):null;if(!r){if(r=Xr("form"),t.input){let l=Xr("input",t.input);/^(text|password|number|email|tel|url)$/.test(l.type)&&l.classList.add("cm-textfield"),l.name||(l.name="input"),r.appendChild(Xr("label",(t.label||"")+": ",l))}else r.appendChild(document.createTextNode(t.label||""));r.appendChild(document.createTextNode(" ")),r.appendChild(Xr("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=Xr("div",r,Xr("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 Kd extends Uh{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Kd.prototype.elementClass="";Kd.prototype.toDOM=void 0;Kd.prototype.mapMode=da.TrackBefore;Kd.prototype.startSide=Kd.prototype.endSide=-1;Kd.prototype.point=!0;const iT=kt.define(),est=kt.define(),tst={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Yn.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},rx=kt.define();function nst(e){return[ype(),rx.of({...tst,...e})]}const vX=kt.define({combine:e=>e.some(t=>t)});function ype(e){return[rst]}const rst=Ki.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(rx).map(t=>new SX(e,t)),this.fixed=!e.state.facet(vX);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(vX)!=!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=Yn.iter(this.view.state.facet(iT),this.view.viewport.from),r=[],i=this.gutters.map(s=>new ist(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==ma.Text&&a){w3(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==ma.Text){w3(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(rx),n=e.state.facet(rx),r=e.docChanged||e.heightChanged||e.viewportChanged||!Yn.eq(e.startState.facet(iT),e.state.facet(iT),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 SX(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=>pt.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==ni.LTR?{left:r,right:i}:{right:r,left:i}})});function wX(e){return Array.isArray(e)?e:[e]}function w3(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class ist{constructor(t,n,r){this.gutter=t,this.height=r,this.i=0,this.cursor=Yn.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 xpe(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=[];w3(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(est)){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 SX{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=wX(n.markers(t)),n.initialSpacer&&(this.spacer=new xpe(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=wX(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!Yn.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 xpe{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":""),sst(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 bI extends Kd{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function OI(e,t){return e.state.facet(A0).formatNumber(t,e.state)}const lst=rx.compute([A0],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(t){return t.state.facet(ast)},lineMarker(t,n,r){return r.some(i=>i.toDOM)?null:new bI(OI(t,t.state.doc.lineAt(n.from).number))},widgetMarker:(t,n,r)=>{for(let i of t.state.facet(ost)){let s=i(t,n,r);if(s)return s}return null},lineMarkerChange:t=>t.startState.facet(A0)!=t.state.facet(A0),initialSpacer(t){return new bI(OI(t,EX(t.state.doc.lines)))},updateSpacer(t,n){let r=OI(n.view,EX(n.view.state.doc.lines));return r==t.number?t:new bI(r)},domEventHandlers:e.facet(A0).domEventHandlers,side:"before"}));function cst(e={}){return[A0.of(e),ype(),lst]}function EX(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(ust.range(i)))}return Yn.of(t)});function fst(){return dst}let hst=0,iu=class S3{constructor(t,n,r,i){this.name=t,this.set=n,this.base=r,this.modified=i,this.id=hst++}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 S3&&(n=t),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let i=new S3(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 s_(t);return r=>r.modified.indexOf(n)>-1?r:s_.get(r.base||r,r.modified.concat(n).sort((i,s)=>i.id-s.id))}},pst=0;class s_{constructor(t){this.name=t,this.instances=[],this.id=pst++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(l=>l.base==t&&mst(n,l.modified));if(r)return r;let i=[],s=new iu(t.name,i,t,n);for(let l of n)l.instances.push(s);let a=gst(n);for(let l of t.set)if(!l.modified.length)for(let c of a)i.push(s_.get(l,c));return s}}function mst(e,t){return e.length==t.length&&e.every((n,r)=>n==t[r])}function gst(e){let t=[[]];for(let n=0;nr.length-n.length)}function hf(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 p=i[f++];if(f==i.length&&p=="!"){a=0;break}if(p!="/")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 gv(r,a,c>0?s.slice(0,c):null);t[u]=d.sort(t[u])}}return vpe.add(t)}const vpe=new dn({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 gv(i.tags,i.mode,i.context);n?n.next=s:r=s,n=s}return r}});let gv=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 bst(e,t){let n=null;for(let r of e){let i=r.style(t);i&&(n=n?n+" "+i:i)}return n}function Ost(e,t,n,r=0,i=e.length){let s=new yst(r,Array.isArray(t)?t:[t],n);s.highlightRange(e.cursor(),r,i,"",s.highlighters),s.flush(i)}class yst{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(p=>!p.scope||p.scope(a)));let u=i,d=xst(t)||gv.empty,f=bst(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(dn.mounted);if(h&&h.overlay){let p=t.node.enter(h.overlay[0].from+l,1),b=this.highlighters.filter(O=>!O.scope||O.scope(h.tree.type)),g=t.firstChild();for(let O=0,y=l;;O++){let v=O=x||!t.nextSibling())););if(!v||x>r)break;y=v.to+l,y>n&&(this.highlightRange(p.cursor(),Math.max(n,v.from+l),Math.min(r,y),"",b),this.startSpan(Math.min(r,y),u))}g&&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 xst(e){let t=e.type.prop(vpe);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}const Ot=iu.define,QE=Ot(),Vf=Ot(),kX=Ot(Vf),TX=Ot(Vf),qf=Ot(),FE=Ot(qf),yI=Ot(qf),eu=Ot(),xp=Ot(eu),Wc=Ot(),Zc=Ot(),E3=Ot(),jy=Ot(E3),UE=Ot(),G={comment:QE,lineComment:Ot(QE),blockComment:Ot(QE),docComment:Ot(QE),name:Vf,variableName:Ot(Vf),typeName:kX,tagName:Ot(kX),propertyName:TX,attributeName:Ot(TX),className:Ot(Vf),labelName:Ot(Vf),namespace:Ot(Vf),macroName:Ot(Vf),literal:qf,string:FE,docString:Ot(FE),character:Ot(FE),attributeValue:Ot(FE),number:yI,integer:Ot(yI),float:Ot(yI),bool:Ot(qf),regexp:Ot(qf),escape:Ot(qf),color:Ot(qf),url:Ot(qf),keyword:Wc,self:Ot(Wc),null:Ot(Wc),atom:Ot(Wc),unit:Ot(Wc),modifier:Ot(Wc),operatorKeyword:Ot(Wc),controlKeyword:Ot(Wc),definitionKeyword:Ot(Wc),moduleKeyword:Ot(Wc),operator:Zc,derefOperator:Ot(Zc),arithmeticOperator:Ot(Zc),logicOperator:Ot(Zc),bitwiseOperator:Ot(Zc),compareOperator:Ot(Zc),updateOperator:Ot(Zc),definitionOperator:Ot(Zc),typeOperator:Ot(Zc),controlOperator:Ot(Zc),punctuation:E3,separator:Ot(E3),bracket:jy,angleBracket:Ot(jy),squareBracket:Ot(jy),paren:Ot(jy),brace:Ot(jy),content:eu,heading:xp,heading1:Ot(xp),heading2:Ot(xp),heading3:Ot(xp),heading4:Ot(xp),heading5:Ot(xp),heading6:Ot(xp),contentSeparator:Ot(eu),list:Ot(eu),quote:Ot(eu),emphasis:Ot(eu),strong:Ot(eu),link:Ot(eu),monospace:Ot(eu),strikethrough:Ot(eu),inserted:Ot(),deleted:Ot(),changed:Ot(),invalid:Ot(),meta:UE,documentMeta:Ot(UE),annotation:Ot(UE),processingInstruction:Ot(UE),definition:iu.defineModifier("definition"),constant:iu.defineModifier("constant"),function:iu.defineModifier("function"),standard:iu.defineModifier("standard"),local:iu.defineModifier("local"),special:iu.defineModifier("special")};for(let e in G){let t=G[e];t instanceof iu&&(t.name=e)}wpe([{tag:G.link,class:"tok-link"},{tag:G.heading,class:"tok-heading"},{tag:G.emphasis,class:"tok-emphasis"},{tag:G.strong,class:"tok-strong"},{tag:G.keyword,class:"tok-keyword"},{tag:G.atom,class:"tok-atom"},{tag:G.bool,class:"tok-bool"},{tag:G.url,class:"tok-url"},{tag:G.labelName,class:"tok-labelName"},{tag:G.inserted,class:"tok-inserted"},{tag:G.deleted,class:"tok-deleted"},{tag:G.literal,class:"tok-literal"},{tag:G.string,class:"tok-string"},{tag:G.number,class:"tok-number"},{tag:[G.regexp,G.escape,G.special(G.string)],class:"tok-string2"},{tag:G.variableName,class:"tok-variableName"},{tag:G.local(G.variableName),class:"tok-variableName tok-local"},{tag:G.definition(G.variableName),class:"tok-variableName tok-definition"},{tag:G.special(G.variableName),class:"tok-variableName2"},{tag:G.definition(G.propertyName),class:"tok-propertyName tok-definition"},{tag:G.typeName,class:"tok-typeName"},{tag:G.namespace,class:"tok-namespace"},{tag:G.className,class:"tok-className"},{tag:G.macroName,class:"tok-macroName"},{tag:G.propertyName,class:"tok-propertyName"},{tag:G.operator,class:"tok-operator"},{tag:G.comment,class:"tok-comment"},{tag:G.meta,class:"tok-meta"},{tag:G.invalid,class:"tok-invalid"},{tag:G.punctuation,class:"tok-punctuation"}]);var xI;const lh=new dn;function PC(e){return kt.define({combine:e?t=>t.concat(e):void 0})}const G8=new dn;class Wo{constructor(t,n,r=[],i=""){this.data=t,this.name=i,rr.prototype.hasOwnProperty("tree")||Object.defineProperty(rr.prototype,"tree",{get(){return Yr(this)}}),this.parser=n,this.extension=[Hh.of(this),rr.languageData.of((s,a,l)=>{let c=_X(s,a,l),u=c.type.prop(lh);if(!u)return[];let d=s.facet(u),f=c.type.prop(G8);if(f){let h=c.resolve(a-c.from,l);for(let p of f)if(p.test(h,s)){let b=s.facet(p.facet);return p.type=="replace"?b:b.concat(d)}}return d})].concat(r)}isActiveAt(t,n,r=-1){return _X(t,n,r).type.prop(lh)==this.data}findRegions(t){let n=t.facet(Hh);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(lh)==this.data){r.push({from:a,to:a+s.length});return}let l=s.prop(dn.mounted);if(l){if(l.tree.prop(lh)==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 Jd(this.data,this.parser.configure(t),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Yr(e){let t=e.field(Wo.state,!1);return t?t.tree:Un.empty}class vst{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 Ry=null;class Mm{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 Mm(t,n,[],Un.empty,0,r,[],null)}startParse(){return this.parser.startParse(new vst(this.state.doc),this.fragments)}work(t,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Un.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($d.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let n=Ry;Ry=this;try{return t()}finally{Ry=n}}withoutTempSkipped(t){for(let n;n=this.tempSkipped.pop();)t=AX(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=$d.applyChanges(r,c),i=Un.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=AX(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 _C{createParse(n,r,i){let s=i[0].from,a=i[i.length-1].to;return{parsedPos:s,advance(){let c=Ry;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 Un(ws.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 Ry}}function AX(e,t,n){return $d.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class Gb{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 Gb(n)}static init(t){let n=Math.min(3e3,t.doc.length),r=Mm.create(t.facet(Hh).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new Gb(r)}}Wo.state=ga.define({create:Gb.init,update(e,t){for(let n of t.effects)if(n.is(Wo.setState))return n.value;return t.startState.facet(Hh)!=t.state.facet(Hh)?Gb.init(t.state):e.apply(t)}});let Spe=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(Spe=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const vI=typeof navigator<"u"&&(!((xI=navigator.scheduling)===null||xI===void 0)&&xI.isInputPending)?()=>navigator.scheduling.isInputPending():null,wst=Ki.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(Wo.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(Wo.state);(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))&&(this.working=Spe(this.work))}work(t){this.working=null;let n=Date.now();if(this.chunkEndi+1e3,c=s.context.work(()=>vI&&vI()||Date.now()>a,i+(l?0:1e5));this.chunkBudget-=Date.now()-n,(c||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Wo.setState.of(new Gb(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=>po(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()}}}),Hh=kt.define({combine(e){return e.length?e[0]:null},enables:e=>[Wo.state,wst,pt.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]});class Xh{constructor(t,n=[]){this.language=t,this.support=n,this.extension=[t,n]}}class a_{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 a_(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 Sst=kt.define(),FO=kt.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 Lm(e){let t=e.facet(FO);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function bv(e,t){let n="",r=e.tabSize,i=e.facet(FO)[0];if(i==" "){for(;t>=r;)n+=" ",t-=r;i=" "}for(let s=0;s=t?Est(e,n,t):null}class MC{constructor(t,n={}){this.state=t,this.options=n,this.unit=Lm(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 _c(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 pf=new dn;function Est(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 Epe(r,e,n)}function Epe(e,t,n){for(let r=e;r;r=r.next){let i=Tst(r.node);if(i)return i(W8.create(t,n,r))}return 0}function kst(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function Tst(e){let t=e.type.prop(pf);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(dn.closedBy))){let i=e.lastChild,s=i&&r.indexOf(i.name)>-1;return a=>kpe(a,!0,1,void 0,s&&!kst(a)?i.from:void 0)}return e.parent==null?_st:null}function _st(){return 0}class W8 extends MC{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 W8(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(Ast(r,t))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return Epe(this.context.next,this.base,this.pos)}}function Ast(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function Cst(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 tb({closing:e,align:t=!0,units:n=1}){return r=>kpe(r,t,n,e)}function kpe(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?Cst(e):null;return c?l?e.column(c.from):e.column(c.to):e.baseIndent+(l?0:e.unit*n)}const Nst=e=>e.baseIndent;function nb({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}const jst=200;function Rst(){return rr.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+jst)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=Y8(a,d.from);if(f==null)continue;let h=/^\s*/.exec(d.text)[0],p=bv(a,f);h!=p&&c.push({from:d.from,to:d.from+h.length,insert:p})}return c.length?[e,{changes:c,sequential:!0}]:e})}const Tpe=kt.define(),mf=new dn;function Iw(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 Dst(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function o_(e,t,n){for(let r of e.facet(Tpe)){let i=r(e,t,n);if(i)return i}return Ist(e,t,n)}function _pe(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 LC=mn.define({map:_pe}),Dw=mn.define({map:_pe});function Ape(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 $m=ga.define({create(){return Vt.none},update(e,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges((r,i)=>e=CX(e,r,i)),e=e.map(t.changes);let n=[];for(let r of t.effects)r.is(LC)&&!Pst(e,r.value.from,r.value.to)?n.push(r.value):r.is(Dw)&&(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(jpe),i=n.map(s=>(r?Vt.replace({widget:new Ust(r(t.state,s))}):NX).range(s.from,s.to));e=e.update({add:i})}return t.selection&&(e=CX(e,t.selection.main.head)),e},provide:e=>pt.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 l_(e,t,n){var r;let i=null;return(r=e.field($m,!1))===null||r===void 0||r.between(t,n,(s,a)=>{(!i||i.from>s)&&(i={from:s,to:a})}),i}function Pst(e,t,n){let r=!1;return e.between(t,t,(i,s)=>{i==t&&s==n&&(r=!0)}),r}function Cpe(e,t){return e.field($m,!1)?t:t.concat(mn.appendConfig.of(Rpe()))}const Mst=e=>{for(let t of Ape(e)){let n=o_(e.state,t.from,t.to);if(n)return e.dispatch({effects:Cpe(e.state,[LC.of(n),Npe(e,n)])}),!0}return!1},Lst=e=>{if(!e.state.field($m,!1))return!1;let t=[];for(let n of Ape(e)){let r=l_(e.state,n.from,n.to);r&&t.push(Dw.of(r),Npe(e,r,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function Npe(e,t,n=!0){let r=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return pt.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${e.state.phrase("to")} ${i}.`)}const $st=e=>{let{state:t}=e,n=[];for(let r=0;r{let t=e.state.field($m,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(r,i)=>{n.push(Dw.of({from:r,to:i}))}),e.dispatch({effects:n}),!0},Qst=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Mst},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Lst},{key:"Ctrl-Alt-[",run:$st},{key:"Ctrl-Alt-]",run:Bst}],Fst={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},jpe=kt.define({combine(e){return $u(e,Fst)}});function Rpe(e){return[$m,qst]}function Ipe(e,t){let{state:n}=e,r=n.facet(jpe),i=a=>{let l=e.lineBlockAt(e.posAtDOM(a.target)),c=l_(e.state,l.from,l.to);c&&e.dispatch({effects:Dw.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 NX=Vt.replace({widget:new class extends Pc{toDOM(e){return Ipe(e,null)}}});class Ust extends Pc{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return Ipe(t,this.value)}}const zst={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class wI extends Kd{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 Vst(e={}){let t={...zst,...e},n=new wI(t,!0),r=new wI(t,!1),i=Ki.fromClass(class{constructor(a){this.from=a.viewport.from,this.markers=this.buildMarkers(a)}update(a){(a.docChanged||a.viewportChanged||a.startState.facet(Hh)!=a.state.facet(Hh)||a.startState.field($m,!1)!=a.state.field($m,!1)||Yr(a.startState)!=Yr(a.state)||t.foldingChanged(a))&&(this.markers=this.buildMarkers(a.view))}buildMarkers(a){let l=new Wd;for(let c of a.viewportLineBlocks){let u=l_(a.state,c.from,c.to)?r:o_(a.state,c.from,c.to)?n:null;u&&l.add(c.from,c.from,u)}return l.finish()}}),{domEventHandlers:s}=t;return[i,nst({class:"cm-foldGutter",markers(a){var l;return((l=a.plugin(i))===null||l===void 0?void 0:l.markers)||Yn.empty},initialSpacer(){return new wI(t,!1)},domEventHandlers:{...s,click:(a,l,c)=>{if(s.click&&s.click(a,l,c))return!0;let u=l_(a.state,l.from,l.to);if(u)return a.dispatch({effects:Dw.of(u)}),!0;let d=o_(a.state,l.from,l.to);return d?(a.dispatch({effects:LC.of(d)}),!0):!1}}}),Rpe()]}const qst=pt.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 Pw{constructor(t,n){this.specs=t;let r;function i(l){let c=zh.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 Wo?l=>l.prop(lh)==a.data:a?l=>l==a:void 0,this.style=wpe(t.map(l=>({tag:l.tag,class:l.class||i(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=r?new zh(r):null,this.themeType=n.themeType}static define(t,n){return new Pw(t,n||{})}}const k3=kt.define(),Dpe=kt.define({combine(e){return e.length?[e[0]]:null}});function SI(e){let t=e.facet(k3);return t.length?t:e.facet(Dpe)}function Ppe(e,t){let n=[Xst],r;return e instanceof Pw&&(e.module&&n.push(pt.styleModule.of(e.module)),r=e.themeType),t!=null&&t.fallback?n.push(Dpe.of(e)):r?n.push(k3.computeN([pt.darkTheme],i=>i.facet(pt.darkTheme)==(r=="dark")?[e]:[])):n.push(k3.of(e)),n}class Hst{constructor(t){this.markCache=Object.create(null),this.tree=Yr(t.state),this.decorations=this.buildDeco(t,SI(t.state)),this.decoratedTo=t.viewport.to}update(t){let n=Yr(t.state),r=SI(t.state),i=r!=SI(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 Vt.none;let r=new Wd;for(let{from:i,to:s}of t.visibleRanges)Ost(this.tree,n,(a,l,c)=>{r.add(a,l,this.markCache[c]||(this.markCache[c]=Vt.mark({class:c})))},i,s);return r.finish()}}const Xst=ff.high(Ki.fromClass(Hst,{decorations:e=>e.decorations})),Gst=Pw.define([{tag:G.meta,color:"#404740"},{tag:G.link,textDecoration:"underline"},{tag:G.heading,textDecoration:"underline",fontWeight:"bold"},{tag:G.emphasis,fontStyle:"italic"},{tag:G.strong,fontWeight:"bold"},{tag:G.strikethrough,textDecoration:"line-through"},{tag:G.keyword,color:"#708"},{tag:[G.atom,G.bool,G.url,G.contentSeparator,G.labelName],color:"#219"},{tag:[G.literal,G.inserted],color:"#164"},{tag:[G.string,G.deleted],color:"#a11"},{tag:[G.regexp,G.escape,G.special(G.string)],color:"#e40"},{tag:G.definition(G.variableName),color:"#00f"},{tag:G.local(G.variableName),color:"#30a"},{tag:[G.typeName,G.namespace],color:"#085"},{tag:G.className,color:"#167"},{tag:[G.special(G.variableName),G.macroName],color:"#256"},{tag:G.definition(G.propertyName),color:"#00c"},{tag:G.comment,color:"#940"},{tag:G.invalid,color:"#f00"}]),Yst=pt.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Mpe=1e4,Lpe="()[]{}",$pe=kt.define({combine(e){return $u(e,{afterCursor:!0,brackets:Lpe,maxScanDistance:Mpe,renderMatch:Kst})}}),Wst=Vt.mark({class:"cm-matchingBracket"}),Zst=Vt.mark({class:"cm-nonmatchingBracket"});function Kst(e){let t=[],n=e.matched?Wst:Zst;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 jX(e){let t=[],n=e.facet($pe);for(let r of e.selection.ranges){if(!r.empty)continue;let i=gu(e,r.head,-1,n)||r.head>0&&gu(e,r.head-1,1,n)||n.afterCursor&&(gu(e,r.head,1,n)||r.heade.decorations}),eat=[Jst,Yst];function tat(e={}){return[$pe.of(e),eat]}const Bpe=new dn;function T3(e,t,n){let r=e.prop(t<0?dn.openedBy:dn.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 _3(e){let t=e.type.prop(Bpe);return t?t(e.node):e}function gu(e,t,n,r={}){let i=r.maxScanDistance||Mpe,s=r.brackets||Lpe,a=Yr(e),l=a.resolveInner(t,n);for(let c=l;c;c=c.parent){let u=T3(c.type,n,s);if(u&&c.from0?t>=d.from&&td.from&&t<=d.to))return nat(e,t,n,c,d,u,s)}}return rat(e,t,n,a,l.type,i,s)}function nat(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 p=d.value;n<0&&(h+=p.length);let b=t+h*n;for(let g=n>0?0:p.length-1,O=n>0?p.length:-1;g!=O;g+=n){let y=a.indexOf(p[g]);if(!(y<0||r.resolveInner(b+g,1).type!=i))if(y%2==0==n>0)f++;else{if(f==1)return{start:u,end:{from:b+g,to:b+g+1},matched:y>>1==c>>1};f--}}n>0&&(h+=p.length)}return d.done?{start:u,matched:!1}:null}function RX(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 iat(e){return{name:e.name||"",token:e.token,blankLine:e.blankLine||(()=>{}),startState:e.startState||(()=>!0),copyState:e.copyState||sat,indent:e.indent||(()=>null),languageData:e.languageData||{},tokenTable:e.tokenTable||J8,mergeTokens:e.mergeTokens!==!1}}function sat(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 IX=new WeakMap;class Z8 extends Wo{constructor(t){let n=PC(t.languageData),r=iat(t),i,s=new class extends _C{createParse(a,l,c){return new oat(i,a,l,c)}};super(n,s,[],t.name),this.topNode=uat(n,this),i=this,this.streamParser=r,this.stateAfter=new dn({perNode:!0}),this.tokenTable=t.tokenTable?new Vpe(r.tokenTable):cat}static define(t){return new Z8(t)}getIndent(t){let n,{overrideIndentation:r}=t.options;r&&(n=IX.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 Un&&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&&K8(e,s.tree,0-s.offset,n,l),u;if(c&&c.pos<=r&&(u=Fpe(e,s.tree,n+s.offset,c.pos+s.offset,!1)))return{state:c.state,tree:u}}return{state:e.streamParser.startState(i?Lm(i):4),tree:Un.empty}}let oat=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=Mm.get(),a=i[0].from,{state:l,tree:c}=aat(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(Lm(s.state)),s.skipUntilInView(this.parsedPos,s.viewport.from),this.parsedPos=s.viewport.from),this.moveRangeIndex()}advance(){let t=Mm.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 $pe(n,t?t.state.tabSize:4,t?Mm(t.state):2);if(a.eol())s.blankLine(this.state,a.indentUnit);else for(;!a.eol();){let l=Qpe(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 Z8=Object.create(null),bv=[ws.none],aat=new $O(bv),RX=[],IX=Object.create(null),Fpe=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"]])Fpe[e]=zpe(Z8,t);class Upe{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),Fpe)}resolve(t){return t?this.table[t]||(this.table[t]=zpe(this.extra,t)):0}}const oat=new Upe(Z8);function wI(e,t){RX.indexOf(e)>-1||(RX.push(e),console.warn(t))}function zpe(e,t){let n=[];for(let l of t.split(" ")){let c=[];for(let u of l.split(".")){let d=e[u]||G[u];d?typeof d=="function"?c.length?c=c.map(d):wI(u,`Modifier ${u} used at start of tag`):c.length?wI(u,`Tag ${u} used as modifier`):c=Array.isArray(d)?d:[d]:wI(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=IX[i];if(s)return s.id;let a=IX[i]=ws.define({id:bv.length,name:r,props:[hf({[r]:n})]});return bv.push(a),a.id}function lat(e,t){let n=ws.define({id:bv.length,name:"Document",props:[lh.add(()=>e),pf.add(()=>r=>t.getIndent(r))],top:!0});return bv.push(n),n}ti.RTL,ti.LTR;var DX={};class o_{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 o_(t,[],n,r,r,0,[],0,i?new PX(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 o_(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 cat(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 PX{constructor(t,n){this.tracker=t,this.context=n,this.hash=t.strict?t.hash(n):0}}class cat{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 l_{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 l_(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 l_(this.stack,this.pos,this.index)}}function f1(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 rT{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const MX=new rT;class uat{constructor(t,n){this.input=t,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=MX,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=MX,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 nb{constructor(t,n){this.data=t,this.id=n}token(t,n){let{parser:r}=n.p;Vpe(this.data,t,n,this.id,r.data,r.tokenPrecTable)}}nb.prototype.contextual=nb.prototype.fallback=nb.prototype.extend=!1;class c_{constructor(t,n,r){this.precTable=n,this.elseToken=r,this.data=typeof t=="string"?f1(t):t}token(t,n){let r=t.pos,i=0;for(;;){let s=t.next<0,a=t.resolveOffset(1,1);if(Vpe(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))}}c_.prototype.contextual=nb.prototype.fallback=nb.prototype.extend=!1;class ds{constructor(t,n={}){this.token=t,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function Vpe(e,t,n,r,i,s){let a=0,l=1<0){let b=e[p];if(c.allows(b)&&(t.token.value==-1||t.token.value==b||dat(b,t.token.value,i,s))){t.acceptToken(b);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,b=u+p+(p<<1),g=e[b],O=e[b+1]||65536;if(d=O)f=p+1;else{a=e[b+2],t.advance();continue e}}break}}function LX(e,t,n){for(let r=t,i;(i=e[r])!=65535;r++)if(i==n)return r-t;return-1}function dat(e,t,n,r){let i=LX(n,r,t);return i<0||LX(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 fat=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?$X(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?$X(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 Fn){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 hat{constructor(t,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(r=>new rT)}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 rT,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 rT,{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 fat(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&&gat(i);if(a)return Io&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw Io&&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 Io&&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(dn.contextHash)||0)==d))return t.useNode(f,h),Io&&console.log(a+this.stackID(t)+` (via reuse of ${s.getName(f.type.id)})`),!0;if(!(f instanceof Fn)||f.children.length==0||f.positions[0]>0)break;let p=f.children[0];if(p instanceof Fn&&f.positions[0]==0)f=p;else break}}let l=s.stateSlot(t.state,4);if(l>0)return t.reduce(l),Io&&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(b):r.push(b)}return!1}advanceFully(t,n){let r=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>r)return BX(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(),Io&&console.log(d+this.stackID(l)+" (restarted)"),this.advanceFully(l,r))))continue;let f=l.split(),h=d;for(let p=0;p<10&&f.forceReduce()&&(Io&&console.log(h+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,r));p++)Io&&(h=this.stackID(f)+" -> ");for(let p of l.recoverByInsert(c))Io&&console.log(d+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,r);this.stream.end>l.pos?(u==l.pos&&(u++,c=0),l.recoverByDelete(c,u),Io&&console.log(d+this.stackID(l)+` (via recover-delete ${this.parser.getName(c)})`),BX(l,r)):(!i||i.scoree;class MC{constructor(t){this.start=t.start,this.shift=t.shift||EI,this.reduce=t.reduce||EI,this.reuse=t.reuse||EI,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}}class ef extends kC{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 $O(n.map((l,c)=>ws.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=zfe;let a=f1(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 nb(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 pat(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=md(this.data,s+2);else break;i=n(md(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=md(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(ef.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]=QX(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 bat=316,Oat=317,FX=1,yat=2,xat=3,vat=4,wat=318,Sat=320,Eat=321,kat=5,Tat=6,_at=0,T3=[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],qpe=125,Aat=59,_3=47,Cat=42,Nat=43,jat=45,Rat=60,Iat=44,Dat=63,Pat=46,Mat=91,Lat=new MC({start:!1,shift(e,t){return t==kat||t==Tat||t==Sat?e:t==Eat},strict:!1}),$at=new ds((e,t)=>{let{next:n}=e;(n==qpe||n==-1||t.context)&&e.acceptToken(wat)},{contextual:!0,fallback:!0}),Bat=new ds((e,t)=>{let{next:n}=e,r;T3.indexOf(n)>-1||n==_3&&((r=e.peek(1))==_3||r==Cat)||n!=qpe&&n!=Aat&&n!=-1&&!t.context&&e.acceptToken(bat)},{contextual:!0}),Qat=new ds((e,t)=>{e.next==Mat&&!t.context&&e.acceptToken(Oat)},{contextual:!0}),Fat=new ds((e,t)=>{let{next:n}=e;if(n==Nat||n==jat){if(e.advance(),n==e.next){e.advance();let r=!t.context&&t.canShift(FX);e.acceptToken(r?FX:yat)}}else n==Dat&&e.peek(1)==Pat&&(e.advance(),e.advance(),(e.next<48||e.next>57)&&e.acceptToken(xat))},{contextual:!0});function kI(e,t){return e>=65&&e<=90||e>=97&&e<=122||e==95||e>=192||!t&&e>=48&&e<=57}const Uat=new ds((e,t)=>{if(e.next!=Rat||!t.dialectEnabled(_at)||(e.advance(),e.next==_3))return;let n=0;for(;T3.indexOf(e.next)>-1;)e.advance(),n++;if(kI(e.next,!0)){for(e.advance(),n++;kI(e.next,!1);)e.advance(),n++;for(;T3.indexOf(e.next)>-1;)e.advance(),n++;if(e.next==Iat)return;for(let r=0;;r++){if(r==7){if(!kI(e.next,!0))return;break}if(e.next!="extends".charCodeAt(r))break;e.advance(),n++}}e.acceptToken(vat,-n)}),zat=hf({"get set async static":G.modifier,"for while do if else switch try catch finally return throw break continue default case defer":G.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":G.operatorKeyword,"let var const using function class extends":G.definitionKeyword,"import export from":G.moduleKeyword,"with debugger new":G.keyword,TemplateString:G.special(G.string),super:G.atom,BooleanLiteral:G.bool,this:G.self,null:G.null,Star:G.modifier,VariableName:G.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":G.function(G.variableName),VariableDefinition:G.definition(G.variableName),Label:G.labelName,PropertyName:G.propertyName,PrivatePropertyName:G.special(G.propertyName),"CallExpression/MemberExpression/PropertyName":G.function(G.propertyName),"FunctionDeclaration/VariableDefinition":G.function(G.definition(G.variableName)),"ClassDeclaration/VariableDefinition":G.definition(G.className),"NewExpression/VariableName":G.className,PropertyDefinition:G.definition(G.propertyName),PrivatePropertyDefinition:G.definition(G.special(G.propertyName)),UpdateOp:G.updateOperator,"LineComment Hashbang":G.lineComment,BlockComment:G.blockComment,Number:G.number,String:G.string,Escape:G.escape,ArithOp:G.arithmeticOperator,LogicOp:G.logicOperator,BitOp:G.bitwiseOperator,CompareOp:G.compareOperator,RegExp:G.regexp,Equals:G.definitionOperator,Arrow:G.function(G.punctuation),": Spread":G.punctuation,"( )":G.paren,"[ ]":G.squareBracket,"{ }":G.brace,"InterpolationStart InterpolationEnd":G.special(G.brace),".":G.derefOperator,", ;":G.separator,"@":G.meta,TypeName:G.typeName,TypeDefinition:G.definition(G.typeName),"type enum interface implements namespace module declare":G.definitionKeyword,"abstract global Privacy readonly override":G.modifier,"is keyof unique infer asserts":G.operatorKeyword,JSXAttributeValue:G.attributeValue,JSXText:G.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":G.angleBracket,"JSXIdentifier JSXNameSpacedName":G.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":G.attributeName,"JSXBuiltin/JSXIdentifier":G.standard(G.tagName)}),Vat={__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},qat={__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},Hat={__proto__:null,"<":193},Xat=ef.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:Lat,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:[zat],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:[Bat,Qat,Fat,Uat,2,3,4,5,6,7,8,9,10,11,12,13,14,$at,new c_("$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 c_("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=>Vat[e]||-1},{term:343,get:e=>qat[e]||-1},{term:95,get:e=>Hat[e]||-1}],tokenPrec:15201});class K8{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=Yr(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(Xpe(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 UX(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 Gat(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+$/]:Gat(t);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:t,validFor:n}:null}}function Hpe(e,t){return n=>{for(let r=Yr(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)}}let zX=class{constructor(t,n,r,i){this.completion=t,this.source=n,this.match=r,this.score=i}};function mm(e){return e.selection.main.from}function Xpe(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 e9=Lu.define();function Yat(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:Fe.cursor(l.from+s+c.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const VX=new WeakMap;function Wat(e){if(!Array.isArray(e))return e;let t=VX.get(e);return t||VX.set(e,t=J8(e)),t}const u_=mn.define(),Ov=mn.define();class Zat{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=_8(S))!=E.toLowerCase()?1:E!=E.toUpperCase()?2:0;(!v||k==1&&O||w==0&&k!=0)&&(n[f]==S||r[f]==S&&(h=!0)?a[f++]=v:a.length&&(y=!1)),w=k,v+=ou(S)}return f==c&&a[0]==0&&y?this.result(-100+(h?-200:0),a,t):p==c&&b==0?this.ret(-200-t.length+(g==t.length?0:-100),[0,g]):l>-1?this.ret(-700-t.length,[l,l+this.pattern.length]):p==c?this.ret(-900-t.length,[b,g]):f==c?this.result(-100+(h?-200:0)+-700+(y?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?ou(lo(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 Kat{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:Jat,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=>qX(t(r),n(r)),optionClass:(t,n)=>r=>qX(t(r),n(r)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function qX(e,t){return e?t?e+" "+t:e:t}function Jat(e,t,n,r,i,s){let a=e.textDirection==ti.RTL,l=a,c=!1,u="top",d,f,h=t.left-i.left,p=i.right-t.right,b=r.right-r.left,g=r.bottom-r.top;if(l&&h=g||v>t.top?d=n.bottom-t.top:(u="bottom",d=t.bottom-n.top)}let O=(t.bottom-t.top)/s.offsetHeight,y=(t.right-t.left)/s.offsetWidth;return{style:`${u}: ${d/O}px; max-width: ${f/y}px`,class:"cm-completionInfo-"+(c?a?"left-narrow":"right-narrow":l?"left":"right")}}const t9=mn.define();function eot(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 TI(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 tot{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(Hs);this.optionContent=eot(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=TI(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:t9.of(d)}),c.preventDefault())}}),this.dom.addEventListener("focusout",c=>{let u=t.state.field(this.stateField,!1);u&&u.tooltip&&t.state.facet(Hs).closeOnBlur&&c.relatedTarget!=t.contentDOM&&t.dispatch({effects:Ov.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=TI(s.length,a,t.state.facet(Hs).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=TI(n.options.length,n.selected,this.view.state.facet(Hs).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=>po(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&&rot(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 p=i.appendChild(document.createElement("completion-section"));p.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 p=h(l,this.view.state,this.view,c);p&&d.appendChild(p)}}return r.from&&i.classList.add("cm-completionListIncompleteTop"),r.tonew tot(n,e,t)}function rot(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 HX(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function iot(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(p=>p.name==h)||r.push(typeof f=="string"?{name:h}:f)}},a=t.facet(Hs);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 zX(h,d.source,f?f(h):[],1e9-n.length));else{let h=t.sliceDoc(d.from,d.to),p,b=a.filterStrict?new Kat(h):new Zat(h);for(let g of d.result.options)if(p=b.match(g.label)){let O=g.displayLabel?f?f(g,p.matched):[]:p.matched,y=p.score+(g.boost||0);if(s(new zX(g,d.source,O,y)),typeof g.section=="object"&&g.section.rank==="dynamic"){let{name:v}=g.section;i||(i=Object.create(null)),i[v]=Math.max(y,i[v]||-1e9)}}}}if(r){let d=Object.create(null),f=0,h=(p,b)=>(p.rank==="dynamic"&&b.rank==="dynamic"?i[b.name]-i[p.name]:0)||(typeof p.rank=="number"?p.rank:1e9)-(typeof b.rank=="number"?b.rank:1e9)||(p.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):HX(d.completion)>HX(c)&&(l[l.length-1]=d),c=d.completion}return l}class A0{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 A0(this.options,XX(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=iot(t,n);if(!l.length)return i&&t.some(u=>u.isPending)?i.setDisabled():null;let c=n.facet(Hs).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:uot,above:s.aboveCursor},i?i.timestamp:Date.now(),c,!1)}map(t){return new A0(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new A0(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class d_{constructor(t,n,r){this.active=t,this.id=n,this.open=r}static start(){return new d_(lot,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(Hs),s=(r.override||n.languageDataAt("autocomplete",mm(n)).map(Wat)).map(c=>(this.active.find(d=>d.source==c)||new Pl(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(n9));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||s.some(c=>c.hasResult()&&t.changes.touchesRange(c.from,c.to))||!sot(s,this.active)||l?a=A0.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 Pl(c.source,0):c));for(let c of t.effects)c.is(t9)&&(a=a&&a.setSelected(c.value,this.id));return s==this.active&&a==this.open?this:new d_(s,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?aot:oot}}function sot(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n-1&&(n["aria-activedescendant"]=e+"-"+t),n}const lot=[];function Gpe(e,t){if(e.isUserEvent("input.complete")){let r=e.annotation(e9);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 Pl{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=Gpe(t,n),i=this;(r&8||r&16&&this.touches(t))&&(i=new Pl(i.source,0)),r&4&&i.state==0&&(i=new Pl(this.source,1)),i=i.updateFor(t,r);for(let s of t.effects)if(s.is(u_))i=new Pl(i.source,1,s.value);else if(s.is(Ov))i=new Pl(i.source,0);else if(s.is(n9))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(mm(t.state))}}class rb extends Pl{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=mm(t.state);if(l>a||!i||n&2&&(mm(t.startState)==this.from||ln.map(t))}}),co=ma.define({create(){return d_.start()},update(e,t){return e.update(t)},provide:e=>[V8.from(e,t=>t.tooltip),pt.contentAttributes.from(e,t=>t.attrs)]});function r9(e,t){const n=t.completion.apply||t.completion.label;let r=e.state.field(co).active.find(i=>i.source==t.source);return r instanceof rb?(typeof n=="string"?e.dispatch({...Yat(e.state,n,r.from,r.to),annotations:e9.of(t.completion)}):n(e,t.completion,r.from,r.to),!0):!1}const uot=not(co,r9);function zE(e,t="option"){return n=>{let r=n.state.field(co,!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:t9.of(l)}),!0}}const dot=e=>{let t=e.state.field(co,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestampe.state.field(co,!1)?(e.dispatch({effects:u_.of(!0)}),!0):!1,fot=e=>{let t=e.state.field(co,!1);return!t||!t.active.some(n=>n.state!=0)?!1:(e.dispatch({effects:Ov.of(null)}),!0)};class hot{constructor(t,n){this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const pot=50,mot=1e3,got=Ki.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(co).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(co),n=e.state.facet(Hs);if(!e.selectionSet&&!e.docChanged&&e.startState.field(co)==t)return;let r=e.transactions.some(s=>{let a=Gpe(s,n);return a&8||(s.selection||s.docChanged)&&!(a&3)});for(let s=0;spot&&Date.now()-a.time>mot){for(let l of a.context.abortListeners)try{l()}catch(c){po(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(u_)))&&(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(co);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(Hs).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=mm(t),r=new K8(t,n,e.explicit,this.view),i=new hot(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:Ov.of(null)}),po(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(Hs).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(Hs),r=this.view.state.field(co);for(let i=0;il.source==s.active.source);if(a&&a.isPending)if(s.done==null){let l=new Pl(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:n9.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(co,!1);if(t&&t.tooltip&&this.view.state.facet(Hs).closeOnBlur){let n=t.open&&hpe(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Ov.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:u_.of(!1)}),20),this.composing=0}}}),bot=typeof navigator=="object"&&/Win/.test(navigator.platform),Oot=ff.highest(pt.domEventHandlers({keydown(e,t){let n=t.state.field(co,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(bot&&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&&r9(t,r),!1}})),Ype=pt.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 yot{constructor(t,n,r,i){this.field=t,this.line=n,this.from=r,this.to=i}}class i9{constructor(t,n,r){this.field=t,this.from=n,this.to=r}map(t){let n=t.mapPos(this.from,-1,ua.TrackDel),r=t.mapPos(this.to,1,ua.TrackDel);return n==null||r==null?null:new i9(this.field,n,r)}}class s9{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 i9(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 yot(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 s9(r,i)}}let xot=Vt.widget({widget:new class extends Pc{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),vot=Vt.mark({class:"cm-snippetField"});class FO{constructor(t,n){this.ranges=t,this.active=n,this.deco=Vt.set(t.map(r=>(r.from==r.to?xot:vot).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 FO(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 Pw=mn.define({map(e,t){return e&&e.map(t)}}),wot=mn.define(),yv=ma.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(Pw))return n.value;if(n.is(wot)&&e)return new FO(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=>pt.decorations.from(e,t=>t?t.deco:Vt.none)});function a9(e,t){return Fe.create(e.filter(n=>n.field==t).map(n=>Fe.range(n.from,n.to)))}function Sot(e){let t=s9.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:Tr.of(a)},scrollIntoView:!0,annotations:r?[e9.of(r),vs.userEvent.of("input.complete")]:void 0};if(l.length&&(u.selection=a9(l,0)),l.some(d=>d.field>0)){let d=new FO(l,0),f=u.effects=[Pw.of(d)];n.state.field(yv,!1)===void 0&&f.push(mn.appendConfig.of([yv,Aot,Cot,Ype]))}n.dispatch(n.state.update(u))}}function Wpe(e){return({state:t,dispatch:n})=>{let r=t.field(yv,!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:a9(r.ranges,i),effects:Pw.of(s?null:new FO(r.ranges,i)),scrollIntoView:!0})),!0}}const Eot=({state:e,dispatch:t})=>e.field(yv,!1)?(t(e.update({effects:Pw.of(null)})),!0):!1,kot=Wpe(1),Tot=Wpe(-1),_ot=[{key:"Tab",run:kot,shift:Tot},{key:"Escape",run:Eot}],GX=kt.define({combine(e){return e.length?e[0]:_ot}}),Aot=ff.highest(BO.compute([GX],e=>e.facet(GX)));function $i(e,t){return{...t,apply:Sot(e)}}const Cot=pt.domEventHandlers({mousedown(e,t){let n=t.state.field(yv,!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:a9(n.ranges,i.field),effects:Pw.of(n.ranges.some(s=>s.field>i.field)?new FO(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),xv={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Kp=mn.define({map(e,t){let n=t.mapPos(e,-1,ua.TrackAfter);return n??void 0}}),o9=new class extends Uh{};o9.startSide=1;o9.endSide=-1;const Zpe=ma.define({create(){return Yn.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(Kp)&&(e=e.update({add:[o9.range(n.value,n.value+1)]}));return e}});function Not(){return[Rot,Zpe]}const AI="()[]{}<>«»»«[]{}";function Kpe(e){for(let t=0;t{if((jot?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||r.length==2&&ou(lo(r,0))==1||t!=i.from||n!=i.to)return!1;let s=Pot(e.state,r);return s?(e.dispatch(s),!0):!1}),Iot=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=Jpe(e,e.selection.main.head).brackets||xv.brackets,i=null,s=e.changeByRange(a=>{if(a.empty){let l=Mot(e.doc,a.head);for(let c of r)if(c==l&&LC(e.doc,a.head)==Kpe(lo(c,0)))return{changes:{from:a.head-c.length,to:a.head+c.length},range:Fe.cursor(a.head-c.length)}}return{range:i=a}});return i||t(e.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},Dot=[{key:"Backspace",run:Iot}];function Pot(e,t){let n=Jpe(e,e.selection.main.head),r=n.brackets||xv.brackets;for(let i of r){let s=Kpe(lo(i,0));if(t==i)return s==i?Bot(e,i,r.indexOf(i+i+i)>-1,n):Lot(e,i,s,n.before||xv.before);if(t==s&&eme(e,e.selection.main.from))return $ot(e,i,s)}return null}function eme(e,t){let n=!1;return e.field(Zpe).between(0,e.doc.length,r=>{r==t&&(n=!0)}),n}function LC(e,t){let n=e.sliceString(t,t+2);return n.slice(0,ou(lo(n,0)))}function Mot(e,t){let n=e.sliceString(t-2,t);return ou(lo(n,0))==n.length?n:n.slice(1)}function Lot(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:Kp.of(a.to+t.length),range:Fe.range(a.anchor+t.length,a.head+t.length)};let l=LC(e.doc,a.head);return!l||/\s/.test(l)||r.indexOf(l)>-1?{changes:{insert:t+n,from:a.head},effects:Kp.of(a.head+t.length),range:Fe.cursor(a.head+t.length)}:{range:i=a}});return i?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function $ot(e,t,n){let r=null,i=e.changeByRange(s=>s.empty&&LC(e.doc,s.head)==n?{changes:{from:s.head,to:s.head+n.length,insert:n},range:Fe.cursor(s.head+n.length)}:r={range:s});return r?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function Bot(e,t,n,r){let i=r.stringPrefixes||xv.stringPrefixes,s=null,a=e.changeByRange(l=>{if(!l.empty)return{changes:[{insert:t,from:l.from},{insert:t,from:l.to}],effects:Kp.of(l.to+t.length),range:Fe.range(l.anchor+t.length,l.head+t.length)};let c=l.head,u=LC(e.doc,c),d;if(u==t){if(YX(e,c))return{changes:{insert:t+t,from:c},effects:Kp.of(c+t.length),range:Fe.cursor(c+t.length)};if(eme(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:Fe.cursor(c+h.length)}}}else{if(n&&e.sliceDoc(c-2*t.length,c)==t+t&&(d=WX(e,c-2*t.length,i))>-1&&YX(e,d))return{changes:{insert:t+t+t+t,from:c},effects:Kp.of(c+t.length),range:Fe.cursor(c+t.length)};if(e.charCategorizer(c)(u)!=Ai.Word&&WX(e,c,i)>-1&&!Qot(e,c,t,i))return{changes:{insert:t+t,from:c},effects:Kp.of(c+t.length),range:Fe.cursor(c+t.length)}}return{range:s=l}});return s?null:e.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function YX(e,t){let n=Yr(e).resolveInner(t+1);return n.parent&&n.from==t}function Qot(e,t,n,r){let i=Yr(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 WX(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=Ai.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))!=Ai.Word)return s}return-1}function Fot(e={}){return[Oot,co,Hs.of(e),got,Uot,Ype]}const tme=[{key:"Ctrl-Space",run:_I},{mac:"Alt-`",run:_I},{mac:"Alt-i",run:_I},{key:"Escape",run:fot},{key:"ArrowDown",run:zE(!0)},{key:"ArrowUp",run:zE(!1)},{key:"PageDown",run:zE(!0,"page")},{key:"PageUp",run:zE(!1,"page")},{key:"Enter",run:dot}],Uot=ff.highest(BO.computeN([Hs],e=>e.facet(Hs).defaultKeymap?[tme]:[])),nme=[$i("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),$i("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),$i("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),$i("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),$i("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),$i(`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 Qpe(n,t?t.state.tabSize:4,t?Lm(t.state):2);if(a.eol())s.blankLine(this.state,a.indentUnit);else for(;!a.eol();){let l=Upe(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 J8=Object.create(null),Ov=[ws.none],lat=new BO(Ov),DX=[],PX=Object.create(null),zpe=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"]])zpe[e]=qpe(J8,t);class Vpe{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),zpe)}resolve(t){return t?this.table[t]||(this.table[t]=qpe(this.extra,t)):0}}const cat=new Vpe(J8);function EI(e,t){DX.indexOf(e)>-1||(DX.push(e),console.warn(t))}function qpe(e,t){let n=[];for(let l of t.split(" ")){let c=[];for(let u of l.split(".")){let d=e[u]||G[u];d?typeof d=="function"?c.length?c=c.map(d):EI(u,`Modifier ${u} used at start of tag`):c.length?EI(u,`Tag ${u} used as modifier`):c=Array.isArray(d)?d:[d]:EI(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=PX[i];if(s)return s.id;let a=PX[i]=ws.define({id:Ov.length,name:r,props:[hf({[r]:n})]});return Ov.push(a),a.id}function uat(e,t){let n=ws.define({id:Ov.length,name:"Document",props:[lh.add(()=>e),pf.add(()=>r=>t.getIndent(r))],top:!0});return Ov.push(n),n}ni.RTL,ni.LTR;var MX={};class c_{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 c_(t,[],n,r,r,0,[],0,i?new LX(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 c_(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 dat(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 LX{constructor(t,n){this.tracker=t,this.context=n,this.hash=t.strict?t.hash(n):0}}class dat{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 u_{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 u_(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 u_(this.stack,this.pos,this.index)}}function h1(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 $X=new sT;class fat{constructor(t,n){this.input=t,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=$X,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=$X,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 rb{constructor(t,n){this.data=t,this.id=n}token(t,n){let{parser:r}=n.p;Hpe(this.data,t,n,this.id,r.data,r.tokenPrecTable)}}rb.prototype.contextual=rb.prototype.fallback=rb.prototype.extend=!1;class d_{constructor(t,n,r){this.precTable=n,this.elseToken=r,this.data=typeof t=="string"?h1(t):t}token(t,n){let r=t.pos,i=0;for(;;){let s=t.next<0,a=t.resolveOffset(1,1);if(Hpe(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))}}d_.prototype.contextual=rb.prototype.fallback=rb.prototype.extend=!1;class ds{constructor(t,n={}){this.token=t,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function Hpe(e,t,n,r,i,s){let a=0,l=1<0){let b=e[p];if(c.allows(b)&&(t.token.value==-1||t.token.value==b||hat(b,t.token.value,i,s))){t.acceptToken(b);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,b=u+p+(p<<1),g=e[b],O=e[b+1]||65536;if(d=O)f=p+1;else{a=e[b+2],t.advance();continue e}}break}}function BX(e,t,n){for(let r=t,i;(i=e[r])!=65535;r++)if(i==n)return r-t;return-1}function hat(e,t,n,r){let i=BX(n,r,t);return i<0||BX(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 pat=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?QX(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?QX(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 Un){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 mat{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 pat(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&&Oat(i);if(a)return Io&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw Io&&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 Io&&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(dn.contextHash)||0)==d))return t.useNode(f,h),Io&&console.log(a+this.stackID(t)+` (via reuse of ${s.getName(f.type.id)})`),!0;if(!(f instanceof Un)||f.children.length==0||f.positions[0]>0)break;let p=f.children[0];if(p instanceof Un&&f.positions[0]==0)f=p;else break}}let l=s.stateSlot(t.state,4);if(l>0)return t.reduce(l),Io&&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(b):r.push(b)}return!1}advanceFully(t,n){let r=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>r)return FX(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(),Io&&console.log(d+this.stackID(l)+" (restarted)"),this.advanceFully(l,r))))continue;let f=l.split(),h=d;for(let p=0;p<10&&f.forceReduce()&&(Io&&console.log(h+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,r));p++)Io&&(h=this.stackID(f)+" -> ");for(let p of l.recoverByInsert(c))Io&&console.log(d+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,r);this.stream.end>l.pos?(u==l.pos&&(u++,c=0),l.recoverByDelete(c,u),Io&&console.log(d+this.stackID(l)+` (via recover-delete ${this.parser.getName(c)})`),FX(l,r)):(!i||i.scoree;class $C{constructor(t){this.start=t.start,this.shift=t.shift||TI,this.reduce=t.reduce||TI,this.reuse=t.reuse||TI,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}}class ef extends _C{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)=>ws.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=qfe;let a=h1(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 rb(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 gat(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=md(this.data,s+2);else break;i=n(md(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=md(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(ef.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]=UX(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 yat=316,xat=317,zX=1,vat=2,wat=3,Sat=4,Eat=318,kat=320,Tat=321,_at=5,Aat=6,Cat=0,A3=[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],Xpe=125,Nat=59,C3=47,jat=42,Rat=43,Iat=45,Dat=60,Pat=44,Mat=63,Lat=46,$at=91,Bat=new $C({start:!1,shift(e,t){return t==_at||t==Aat||t==kat?e:t==Tat},strict:!1}),Qat=new ds((e,t)=>{let{next:n}=e;(n==Xpe||n==-1||t.context)&&e.acceptToken(Eat)},{contextual:!0,fallback:!0}),Fat=new ds((e,t)=>{let{next:n}=e,r;A3.indexOf(n)>-1||n==C3&&((r=e.peek(1))==C3||r==jat)||n!=Xpe&&n!=Nat&&n!=-1&&!t.context&&e.acceptToken(yat)},{contextual:!0}),Uat=new ds((e,t)=>{e.next==$at&&!t.context&&e.acceptToken(xat)},{contextual:!0}),zat=new ds((e,t)=>{let{next:n}=e;if(n==Rat||n==Iat){if(e.advance(),n==e.next){e.advance();let r=!t.context&&t.canShift(zX);e.acceptToken(r?zX:vat)}}else n==Mat&&e.peek(1)==Lat&&(e.advance(),e.advance(),(e.next<48||e.next>57)&&e.acceptToken(wat))},{contextual:!0});function _I(e,t){return e>=65&&e<=90||e>=97&&e<=122||e==95||e>=192||!t&&e>=48&&e<=57}const Vat=new ds((e,t)=>{if(e.next!=Dat||!t.dialectEnabled(Cat)||(e.advance(),e.next==C3))return;let n=0;for(;A3.indexOf(e.next)>-1;)e.advance(),n++;if(_I(e.next,!0)){for(e.advance(),n++;_I(e.next,!1);)e.advance(),n++;for(;A3.indexOf(e.next)>-1;)e.advance(),n++;if(e.next==Pat)return;for(let r=0;;r++){if(r==7){if(!_I(e.next,!0))return;break}if(e.next!="extends".charCodeAt(r))break;e.advance(),n++}}e.acceptToken(Sat,-n)}),qat=hf({"get set async static":G.modifier,"for while do if else switch try catch finally return throw break continue default case defer":G.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":G.operatorKeyword,"let var const using function class extends":G.definitionKeyword,"import export from":G.moduleKeyword,"with debugger new":G.keyword,TemplateString:G.special(G.string),super:G.atom,BooleanLiteral:G.bool,this:G.self,null:G.null,Star:G.modifier,VariableName:G.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":G.function(G.variableName),VariableDefinition:G.definition(G.variableName),Label:G.labelName,PropertyName:G.propertyName,PrivatePropertyName:G.special(G.propertyName),"CallExpression/MemberExpression/PropertyName":G.function(G.propertyName),"FunctionDeclaration/VariableDefinition":G.function(G.definition(G.variableName)),"ClassDeclaration/VariableDefinition":G.definition(G.className),"NewExpression/VariableName":G.className,PropertyDefinition:G.definition(G.propertyName),PrivatePropertyDefinition:G.definition(G.special(G.propertyName)),UpdateOp:G.updateOperator,"LineComment Hashbang":G.lineComment,BlockComment:G.blockComment,Number:G.number,String:G.string,Escape:G.escape,ArithOp:G.arithmeticOperator,LogicOp:G.logicOperator,BitOp:G.bitwiseOperator,CompareOp:G.compareOperator,RegExp:G.regexp,Equals:G.definitionOperator,Arrow:G.function(G.punctuation),": Spread":G.punctuation,"( )":G.paren,"[ ]":G.squareBracket,"{ }":G.brace,"InterpolationStart InterpolationEnd":G.special(G.brace),".":G.derefOperator,", ;":G.separator,"@":G.meta,TypeName:G.typeName,TypeDefinition:G.definition(G.typeName),"type enum interface implements namespace module declare":G.definitionKeyword,"abstract global Privacy readonly override":G.modifier,"is keyof unique infer asserts":G.operatorKeyword,JSXAttributeValue:G.attributeValue,JSXText:G.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":G.angleBracket,"JSXIdentifier JSXNameSpacedName":G.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":G.attributeName,"JSXBuiltin/JSXIdentifier":G.standard(G.tagName)}),Hat={__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},Xat={__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},Gat={__proto__:null,"<":193},Yat=ef.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:Bat,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:[qat],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:[Fat,Uat,zat,Vat,2,3,4,5,6,7,8,9,10,11,12,13,14,Qat,new d_("$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 d_("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=>Hat[e]||-1},{term:343,get:e=>Xat[e]||-1},{term:95,get:e=>Gat[e]||-1}],tokenPrec:15201});class e9{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=Yr(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(Ype(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 VX(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 Wat(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+$/]:Wat(t);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:t,validFor:n}:null}}function Gpe(e,t){return n=>{for(let r=Yr(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)}}let qX=class{constructor(t,n,r,i){this.completion=t,this.source=n,this.match=r,this.score=i}};function gm(e){return e.selection.main.from}function Ype(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 n9=Lu.define();function Zat(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:Fe.cursor(l.from+s+c.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const HX=new WeakMap;function Kat(e){if(!Array.isArray(e))return e;let t=HX.get(e);return t||HX.set(e,t=t9(e)),t}const f_=mn.define(),yv=mn.define();class Jat{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=C8(S))!=E.toLowerCase()?1:E!=E.toUpperCase()?2:0;(!v||k==1&&O||w==0&&k!=0)&&(n[f]==S||r[f]==S&&(h=!0)?a[f++]=v:a.length&&(y=!1)),w=k,v+=ou(S)}return f==c&&a[0]==0&&y?this.result(-100+(h?-200:0),a,t):p==c&&b==0?this.ret(-200-t.length+(g==t.length?0:-100),[0,g]):l>-1?this.ret(-700-t.length,[l,l+this.pattern.length]):p==c?this.ret(-900-t.length,[b,g]):f==c?this.result(-100+(h?-200:0)+-700+(y?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?ou(lo(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 eot{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:tot,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=>XX(t(r),n(r)),optionClass:(t,n)=>r=>XX(t(r),n(r)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function XX(e,t){return e?t?e+" "+t:e:t}function tot(e,t,n,r,i,s){let a=e.textDirection==ni.RTL,l=a,c=!1,u="top",d,f,h=t.left-i.left,p=i.right-t.right,b=r.right-r.left,g=r.bottom-r.top;if(l&&h=g||v>t.top?d=n.bottom-t.top:(u="bottom",d=t.bottom-n.top)}let O=(t.bottom-t.top)/s.offsetHeight,y=(t.right-t.left)/s.offsetWidth;return{style:`${u}: ${d/O}px; max-width: ${f/y}px`,class:"cm-completionInfo-"+(c?a?"left-narrow":"right-narrow":l?"left":"right")}}const r9=mn.define();function not(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 AI(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 rot{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(Xs);this.optionContent=not(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=AI(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:r9.of(d)}),c.preventDefault())}}),this.dom.addEventListener("focusout",c=>{let u=t.state.field(this.stateField,!1);u&&u.tooltip&&t.state.facet(Xs).closeOnBlur&&c.relatedTarget!=t.contentDOM&&t.dispatch({effects:yv.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=AI(s.length,a,t.state.facet(Xs).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=AI(n.options.length,n.selected,this.view.state.facet(Xs).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=>po(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&&sot(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 p=i.appendChild(document.createElement("completion-section"));p.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 p=h(l,this.view.state,this.view,c);p&&d.appendChild(p)}}return r.from&&i.classList.add("cm-completionListIncompleteTop"),r.tonew rot(n,e,t)}function sot(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 GX(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function aot(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(p=>p.name==h)||r.push(typeof f=="string"?{name:h}:f)}},a=t.facet(Xs);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 qX(h,d.source,f?f(h):[],1e9-n.length));else{let h=t.sliceDoc(d.from,d.to),p,b=a.filterStrict?new eot(h):new Jat(h);for(let g of d.result.options)if(p=b.match(g.label)){let O=g.displayLabel?f?f(g,p.matched):[]:p.matched,y=p.score+(g.boost||0);if(s(new qX(g,d.source,O,y)),typeof g.section=="object"&&g.section.rank==="dynamic"){let{name:v}=g.section;i||(i=Object.create(null)),i[v]=Math.max(y,i[v]||-1e9)}}}}if(r){let d=Object.create(null),f=0,h=(p,b)=>(p.rank==="dynamic"&&b.rank==="dynamic"?i[b.name]-i[p.name]:0)||(typeof p.rank=="number"?p.rank:1e9)-(typeof b.rank=="number"?b.rank:1e9)||(p.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):GX(d.completion)>GX(c)&&(l[l.length-1]=d),c=d.completion}return l}class C0{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 C0(this.options,YX(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=aot(t,n);if(!l.length)return i&&t.some(u=>u.isPending)?i.setDisabled():null;let c=n.facet(Xs).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:fot,above:s.aboveCursor},i?i.timestamp:Date.now(),c,!1)}map(t){return new C0(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new C0(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class h_{constructor(t,n,r){this.active=t,this.id=n,this.open=r}static start(){return new h_(uot,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(Xs),s=(r.override||n.languageDataAt("autocomplete",gm(n)).map(Kat)).map(c=>(this.active.find(d=>d.source==c)||new Pl(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(i9));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||s.some(c=>c.hasResult()&&t.changes.touchesRange(c.from,c.to))||!oot(s,this.active)||l?a=C0.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 Pl(c.source,0):c));for(let c of t.effects)c.is(r9)&&(a=a&&a.setSelected(c.value,this.id));return s==this.active&&a==this.open?this:new h_(s,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?lot:cot}}function oot(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n-1&&(n["aria-activedescendant"]=e+"-"+t),n}const uot=[];function Wpe(e,t){if(e.isUserEvent("input.complete")){let r=e.annotation(n9);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 Pl{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=Wpe(t,n),i=this;(r&8||r&16&&this.touches(t))&&(i=new Pl(i.source,0)),r&4&&i.state==0&&(i=new Pl(this.source,1)),i=i.updateFor(t,r);for(let s of t.effects)if(s.is(f_))i=new Pl(i.source,1,s.value);else if(s.is(yv))i=new Pl(i.source,0);else if(s.is(i9))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(gm(t.state))}}class ib extends Pl{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=gm(t.state);if(l>a||!i||n&2&&(gm(t.startState)==this.from||ln.map(t))}}),co=ga.define({create(){return h_.start()},update(e,t){return e.update(t)},provide:e=>[H8.from(e,t=>t.tooltip),pt.contentAttributes.from(e,t=>t.attrs)]});function s9(e,t){const n=t.completion.apply||t.completion.label;let r=e.state.field(co).active.find(i=>i.source==t.source);return r instanceof ib?(typeof n=="string"?e.dispatch({...Zat(e.state,n,r.from,r.to),annotations:n9.of(t.completion)}):n(e,t.completion,r.from,r.to),!0):!1}const fot=iot(co,s9);function zE(e,t="option"){return n=>{let r=n.state.field(co,!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:r9.of(l)}),!0}}const hot=e=>{let t=e.state.field(co,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestampe.state.field(co,!1)?(e.dispatch({effects:f_.of(!0)}),!0):!1,pot=e=>{let t=e.state.field(co,!1);return!t||!t.active.some(n=>n.state!=0)?!1:(e.dispatch({effects:yv.of(null)}),!0)};class mot{constructor(t,n){this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const got=50,bot=1e3,Oot=Ki.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(co).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(co),n=e.state.facet(Xs);if(!e.selectionSet&&!e.docChanged&&e.startState.field(co)==t)return;let r=e.transactions.some(s=>{let a=Wpe(s,n);return a&8||(s.selection||s.docChanged)&&!(a&3)});for(let s=0;sgot&&Date.now()-a.time>bot){for(let l of a.context.abortListeners)try{l()}catch(c){po(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(f_)))&&(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(co);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(Xs).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=gm(t),r=new e9(t,n,e.explicit,this.view),i=new mot(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:yv.of(null)}),po(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(Xs).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(Xs),r=this.view.state.field(co);for(let i=0;il.source==s.active.source);if(a&&a.isPending)if(s.done==null){let l=new Pl(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:i9.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(co,!1);if(t&&t.tooltip&&this.view.state.facet(Xs).closeOnBlur){let n=t.open&&mpe(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:yv.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:f_.of(!1)}),20),this.composing=0}}}),yot=typeof navigator=="object"&&/Win/.test(navigator.platform),xot=ff.highest(pt.domEventHandlers({keydown(e,t){let n=t.state.field(co,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(yot&&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&&s9(t,r),!1}})),Zpe=pt.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 vot{constructor(t,n,r,i){this.field=t,this.line=n,this.from=r,this.to=i}}class a9{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 a9(this.field,n,r)}}class o9{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 a9(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 vot(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 o9(r,i)}}let wot=Vt.widget({widget:new class extends Pc{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),Sot=Vt.mark({class:"cm-snippetField"});class UO{constructor(t,n){this.ranges=t,this.active=n,this.deco=Vt.set(t.map(r=>(r.from==r.to?wot:Sot).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 UO(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 Mw=mn.define({map(e,t){return e&&e.map(t)}}),Eot=mn.define(),xv=ga.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(Mw))return n.value;if(n.is(Eot)&&e)return new UO(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=>pt.decorations.from(e,t=>t?t.deco:Vt.none)});function l9(e,t){return Fe.create(e.filter(n=>n.field==t).map(n=>Fe.range(n.from,n.to)))}function kot(e){let t=o9.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:Tr.of(a)},scrollIntoView:!0,annotations:r?[n9.of(r),vs.userEvent.of("input.complete")]:void 0};if(l.length&&(u.selection=l9(l,0)),l.some(d=>d.field>0)){let d=new UO(l,0),f=u.effects=[Mw.of(d)];n.state.field(xv,!1)===void 0&&f.push(mn.appendConfig.of([xv,Not,jot,Zpe]))}n.dispatch(n.state.update(u))}}function Kpe(e){return({state:t,dispatch:n})=>{let r=t.field(xv,!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:l9(r.ranges,i),effects:Mw.of(s?null:new UO(r.ranges,i)),scrollIntoView:!0})),!0}}const Tot=({state:e,dispatch:t})=>e.field(xv,!1)?(t(e.update({effects:Mw.of(null)})),!0):!1,_ot=Kpe(1),Aot=Kpe(-1),Cot=[{key:"Tab",run:_ot,shift:Aot},{key:"Escape",run:Tot}],WX=kt.define({combine(e){return e.length?e[0]:Cot}}),Not=ff.highest(QO.compute([WX],e=>e.facet(WX)));function $i(e,t){return{...t,apply:kot(e)}}const jot=pt.domEventHandlers({mousedown(e,t){let n=t.state.field(xv,!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:l9(n.ranges,i.field),effects:Mw.of(n.ranges.some(s=>s.field>i.field)?new UO(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),vv={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Jp=mn.define({map(e,t){let n=t.mapPos(e,-1,da.TrackAfter);return n??void 0}}),c9=new class extends Uh{};c9.startSide=1;c9.endSide=-1;const Jpe=ga.define({create(){return Yn.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(Jp)&&(e=e.update({add:[c9.range(n.value,n.value+1)]}));return e}});function Rot(){return[Dot,Jpe]}const NI="()[]{}<>«»»«[]{}";function eme(e){for(let t=0;t{if((Iot?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||r.length==2&&ou(lo(r,0))==1||t!=i.from||n!=i.to)return!1;let s=Lot(e.state,r);return s?(e.dispatch(s),!0):!1}),Pot=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=tme(e,e.selection.main.head).brackets||vv.brackets,i=null,s=e.changeByRange(a=>{if(a.empty){let l=$ot(e.doc,a.head);for(let c of r)if(c==l&&BC(e.doc,a.head)==eme(lo(c,0)))return{changes:{from:a.head-c.length,to:a.head+c.length},range:Fe.cursor(a.head-c.length)}}return{range:i=a}});return i||t(e.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},Mot=[{key:"Backspace",run:Pot}];function Lot(e,t){let n=tme(e,e.selection.main.head),r=n.brackets||vv.brackets;for(let i of r){let s=eme(lo(i,0));if(t==i)return s==i?Fot(e,i,r.indexOf(i+i+i)>-1,n):Bot(e,i,s,n.before||vv.before);if(t==s&&nme(e,e.selection.main.from))return Qot(e,i,s)}return null}function nme(e,t){let n=!1;return e.field(Jpe).between(0,e.doc.length,r=>{r==t&&(n=!0)}),n}function BC(e,t){let n=e.sliceString(t,t+2);return n.slice(0,ou(lo(n,0)))}function $ot(e,t){let n=e.sliceString(t-2,t);return ou(lo(n,0))==n.length?n:n.slice(1)}function Bot(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:Jp.of(a.to+t.length),range:Fe.range(a.anchor+t.length,a.head+t.length)};let l=BC(e.doc,a.head);return!l||/\s/.test(l)||r.indexOf(l)>-1?{changes:{insert:t+n,from:a.head},effects:Jp.of(a.head+t.length),range:Fe.cursor(a.head+t.length)}:{range:i=a}});return i?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Qot(e,t,n){let r=null,i=e.changeByRange(s=>s.empty&&BC(e.doc,s.head)==n?{changes:{from:s.head,to:s.head+n.length,insert:n},range:Fe.cursor(s.head+n.length)}:r={range:s});return r?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function Fot(e,t,n,r){let i=r.stringPrefixes||vv.stringPrefixes,s=null,a=e.changeByRange(l=>{if(!l.empty)return{changes:[{insert:t,from:l.from},{insert:t,from:l.to}],effects:Jp.of(l.to+t.length),range:Fe.range(l.anchor+t.length,l.head+t.length)};let c=l.head,u=BC(e.doc,c),d;if(u==t){if(ZX(e,c))return{changes:{insert:t+t,from:c},effects:Jp.of(c+t.length),range:Fe.cursor(c+t.length)};if(nme(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:Fe.cursor(c+h.length)}}}else{if(n&&e.sliceDoc(c-2*t.length,c)==t+t&&(d=KX(e,c-2*t.length,i))>-1&&ZX(e,d))return{changes:{insert:t+t+t+t,from:c},effects:Jp.of(c+t.length),range:Fe.cursor(c+t.length)};if(e.charCategorizer(c)(u)!=Ai.Word&&KX(e,c,i)>-1&&!Uot(e,c,t,i))return{changes:{insert:t+t,from:c},effects:Jp.of(c+t.length),range:Fe.cursor(c+t.length)}}return{range:s=l}});return s?null:e.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function ZX(e,t){let n=Yr(e).resolveInner(t+1);return n.parent&&n.from==t}function Uot(e,t,n,r){let i=Yr(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 KX(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=Ai.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))!=Ai.Word)return s}return-1}function zot(e={}){return[xot,co,Xs.of(e),Oot,Vot,Zpe]}const rme=[{key:"Ctrl-Space",run:CI},{mac:"Alt-`",run:CI},{mac:"Alt-i",run:CI},{key:"Escape",run:pot},{key:"ArrowDown",run:zE(!0)},{key:"ArrowUp",run:zE(!1)},{key:"PageDown",run:zE(!0,"page")},{key:"PageUp",run:zE(!1,"page")},{key:"Enter",run:hot}],Vot=ff.highest(QO.computeN([Xs],e=>e.facet(Xs).defaultKeymap?[rme]:[])),ime=[$i("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),$i("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),$i("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),$i("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),$i("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),$i(`try { \${} } catch (\${error}) { \${} @@ -685,36 +685,36 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus constructor(\${params}) { \${} } -}`,{label:"class",detail:"definition",type:"keyword"}),$i('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),$i('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],zot=nme.concat([$i("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),$i("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),$i("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),ZX=new T8,rme=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ry(e){return(t,n)=>{let r=t.node.getChild("VariableDefinition");return r&&n(r,e),!0}}const Vot=["FunctionDeclaration"],qot={FunctionDeclaration:Ry("function"),ClassDeclaration:Ry("class"),ClassExpression:()=>!0,EnumDeclaration:Ry("constant"),TypeAliasDeclaration:Ry("type"),NamespaceDeclaration:Ry("namespace"),VariableDefinition(e,t){e.matchContext(Vot)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function ime(e,t){let n=ZX.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(Ar.IncludeAnonymous).iterate(a=>{if(i)i=!1;else if(a.name){let l=qot[a.name];if(l&&l(a,s)||rme.has(a.name))return!1}else if(a.to-a.from>8192){for(let l of ime(e,a.node))r.push(l);return!1}}),ZX.set(t,r),r}const KX=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,sme=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function Hot(e){let t=Yr(e.state).resolveInner(e.pos,-1);if(sme.indexOf(t.name)>-1)return null;let n=t.name=="VariableName"||t.to-t.from<20&&KX.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let r=[];for(let i=t;i;i=i.parent)rme.has(i.name)&&(r=r.concat(ime(e.state.doc,i)));return{options:r,from:n?t.from:e.pos,validFor:KX}}const Eu=Jd.define({name:"javascript",parser:Xat.configure({props:[pf.add({IfStatement:tb({except:/^\s*({|else\b)/}),TryStatement:tb({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Ast,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:eb({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":tb({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}}),mf.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Rw,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:"$"}}),ame={test:e=>/^JSX/.test(e.name),facet:IC({commentTokens:{block:{open:"{/*",close:"*/}"}}})},ome=Eu.configure({dialect:"ts"},"typescript"),lme=Eu.configure({dialect:"jsx",props:[H8.add(e=>e.isTop?[ame]:void 0)]}),cme=Eu.configure({dialect:"jsx ts",props:[H8.add(e=>e.isTop?[ame]:void 0)]},"typescript");let ume=e=>({label:e,type:"keyword"});const dme="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(ume),Xot=dme.concat(["declare","implements","private","protected","public"].map(ume));function A3(e={}){let t=e.jsx?e.typescript?cme:lme:e.typescript?ome:Eu,n=e.typescript?zot.concat(Xot):nme.concat(dme);return new Xh(t,[Eu.data.of({autocomplete:Hpe(sme,J8(n))}),Eu.data.of({autocomplete:Hot}),e.jsx?Wot:[]])}function Got(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 JX(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 Yot=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Wot=pt.inputHandler.of((e,t,n,r,i)=>{if((Yot?e.composing:e.compositionStarted)||e.state.readOnly||t!=n||r!=">"&&r!="/"||!Eu.isActiveAt(e.state,t,-1))return!1;let s=i(),{state:a}=s,l=a.changeByRange(c=>{var u;let{head:d}=c,f=Yr(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 p=f.parent,b=p.parent;if(b&&p.from==d-2&&((h=JX(a.doc,b.firstChild,d))||((u=b.firstChild)===null||u===void 0?void 0:u.name)=="JSXFragmentTag")){let g=`${h}>`;return{range:Fe.cursor(d+g.length,-1),changes:{from:d,insert:g}}}}else if(r==">"){let p=Got(f);if(p&&p.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(a.doc.sliceString(d,d+2))&&(h=JX(a.doc,p,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)}),Zot=hf({String:G.string,Number:G.number,"True False":G.bool,PropertyName:G.propertyName,Null:G.null,", :":G.separator,"[ ]":G.squareBracket,"{ }":G.brace}),Kot=ef.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:[Zot],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}),Jot=Jd.define({name:"json",parser:Kot.configure({props:[pf.add({Object:tb({except:/^\s*\}/}),Array:tb({except:/^\s*\]/})}),mf.add({"Object Array":Rw})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function elt(){return new Xh(Jot)}class f_{static create(t,n,r,i,s){let a=i+(i<<8)+t+(n<<4)|0;return new f_(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=[[dn.contextHash,i]]}addChild(t,n){t.prop(dn.contextHash)!=this.hash&&(t=new Fn(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 Fn(t.types[this.type],this.children,this.positions,n-this.from).balance({makeTree:(i,s,a)=>new Fn(ws.none,i,s,a,this.hashProp)})}}var ct;(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"})(ct||(ct={}));class tlt{constructor(t,n){this.start=t,this.content=n,this.marks=[],this.parsers=[]}}class nlt{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 rx(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==ct.OrderedList?u9:c9)(n,t,!1);return r>0&&(e.type!=ct.BulletList||l9(n,t,!1)<0)&&n.text.charCodeAt(n.pos+r-1)==e.value}const fme={[ct.Blockquote](e,t,n){return n.next!=62?!1:(n.markers.push(Or(ct.QuoteMark,t.lineStart+n.pos,t.lineStart+n.pos+1)),n.moveBase(n.pos+(Gl(n.text.charCodeAt(n.pos+1))?2:1)),e.end=t.lineStart+n.text.length,!0)},[ct.ListItem](e,t,n){return n.indent-1?!1:(n.moveBaseColumn(n.baseIndent+e.value),!0)},[ct.OrderedList]:eG,[ct.BulletList]:eG,[ct.Document](){return!0}};function Gl(e){return e==32||e==9||e==10||e==13}function rx(e,t=0){for(;tn&&Gl(e.charCodeAt(t-1));)t--;return t}function hme(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(vme.SetextHeading)>-1||r<3?-1:1}function mme(e,t){for(let n=e.stack.length-1;n>=0;n--)if(e.stack[n].type==t)return!0;return!1}function c9(e,t,n){return(e.next==45||e.next==43||e.next==42)&&(e.pos==e.text.length-1||Gl(e.text.charCodeAt(e.pos+1)))&&(!n||mme(t,ct.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 gme(e){if(e.next!=35)return-1;let t=e.pos+1;for(;t6?-1:n}function bme(e){if(e.next!=45&&e.next!=61||e.indent>=e.baseIndent+4)return-1;let t=e.pos+1;for(;t/,yme=/\?>/,N3=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/,vme=/\?>/,R3=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/i.exec(r);if(s)return e.append(Or(ct.Comment,n,n+1+s[0].length));let a=/^\?[^]*?\?>/.exec(r);if(a)return e.append(Or(ct.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(Or(ct.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=wv.test(i),l=wv.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),p=f&&(t==42||!d||l);return e.append(new Uo(t==95?Tme:_me,n,r,(h?1:0)|(p?2:0)))},HardBreak(e,t,n){if(t==92&&e.char(n+1)==10)return e.append(Or(ct.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(Or(ct.HardBreak,n,r+1))}return-1},Link(e,t,n){return t==91?e.append(new Uo(Qp,n,n+1,1)):-1},Image(e,t,n){return t==33&&e.char(n+1)==91?e.append(new Uo(h_,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 Uo&&(i.type==Qp||i.type==h_)){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]=llt(e,s,i.type==Qp?ct.Link:ct.Image,i.from,n+1);if(i.type==Qp)for(let l=0;lt?Or(ct.URL,t+n,s+n):s==e.length?null:!1}}function Cme(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 Uo(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 Uo&&(n.type==Qp||n.type==h_))return!0}return!1}addElement(t){return this.append(t)}resolveMarkers(t){for(let r=t;r=t;c--){let g=this.parts[c];if(g instanceof Uo&&g.side&1&&g.type==i.type&&!(s&&(i.side&1||g.side&2)&&(g.to-g.from+a)%3==0&&((g.to-g.from)%3||a%3))){l=g;break}}if(!l)continue;let u=i.type.resolve,d=[],f=l.from,h=i.to;if(s){let g=Math.min(2,l.to-l.from,a);f=l.to-g,h=i.from+g,u=g==1?"Emphasis":"StrongEmphasis"}l.type.mark&&d.push(this.elt(l.type.mark,f,l.to));for(let g=c+1;g=0;n--){let r=this.parts[n];if(r instanceof Uo&&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 Uo?n:null}skipSpace(t){return rx(this.text,t-this.offset)+this.offset}elt(t,n,r,i){return typeof t=="string"?Or(this.parser.getNodeType(t),n,r,i):new kme(t,n)}}d9.linkStart=Qp;d9.imageStart=h_;function R3(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(dn.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=jme(n.from-r,t.ranges);if(n.to-r<=t.ranges[t.rangeI].to)t.addNode(n.tree,d);else{let f=new Fn(t.parser.nodeSet.types[ct.Paragraph],[],[],0,t.block.hashProp);t.reusePlaceholders.set(f,n.tree),t.addNode(f,d)}if(n.type.is("Block")&&(clt.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 jme(e,t){let n=e;for(let r=1;rVE[e]),Object.keys(VE).map(e=>vme[e]),Object.keys(VE),slt,fme,Object.keys(NI).map(e=>NI[e]),Object.keys(NI),[]);function hlt(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 plt(e){let{codeParser:t,htmlParser:n}=e;return{wrap:Xfe((i,s)=>{let a=i.type.id;if(t&&(a==ct.CodeBlock||a==ct.FencedCode)){let l="";if(a==ct.FencedCode){let u=i.node.getChild(ct.CodeInfo);u&&(l=s.read(u.from,u.to))}let c=t(l);if(c)return{parser:c,overlay:u=>u.type.id==ct.CodeText,bracketed:a==ct.FencedCode}}else if(n&&(a==ct.HTMLBlock||a==ct.HTMLTag||a==ct.CommentBlock))return{parser:n,overlay:hlt(i.node,i.from,i.to)};return null})}}const mlt={resolve:"Strikethrough",mark:"StrikethroughMark"},glt={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":G.strikethrough}},{name:"StrikethroughMark",style:G.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=wv.test(r),c=wv.test(i);return e.addDelimiter(mlt,n,n+2,!a&&(!c||s||l),!s&&(!l||a||c))},after:"Emphasis"}]};function ix(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 iG(e,t){for(let n=t;n\s]*\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;class sG{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)&&Rme.test(i=n.text.slice(n.pos))){let s=[];ix(t,r.content,0,s,r.start)==ix(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=[];ix(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 blt={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":G.heading}},"TableRow",{name:"TableCell",style:G.content},{name:"TableDelimiter",style:G.processingInstruction}],parseBlock:[{name:"Table",leaf(e,t){return iG(t.content,0)?new sG:null},endLeaf(e,t,n){if(n.parsers.some(i=>i instanceof sG)||!iG(t.text,t.basePos))return!1;let r=e.peekLine();return Rme.test(r)&&ix(e,t.text,t.basePos)==ix(e,r,t.basePos)},before:"SetextHeading"}]};class Olt{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 ylt={defineNodes:[{name:"Task",block:!0,style:G.list},{name:"TaskMarker",style:G.atom}],parseBlock:[{name:"TaskList",leaf(e,t){return/^\[[ xX]\][ \t]/.test(t.content)&&e.parentType().name=="ListItem"?new Olt:null},after:"SetextHeading"}]},aG=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,oG=/[\w-]+(\.[\w-]+)+(:\d+)?(\/[^\s<]*)?/gy,xlt=/[\w-]+\.[\w-]+($|[/:])/,lG=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,cG=/\/[a-zA-Z\d@.]+/gy;function uG(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==")"&&uG(e,t,r,")")>uG(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 dG(e,t){lG.lastIndex=t;let n=lG.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 wlt={parseInline:[{name:"Autolink",parse(e,t,n){let r=n-e.offset;if(r&&/\w/.test(e.text[r-1]))return-1;aG.lastIndex=r;let i=aG.exec(e.text),s=-1;if(!i)return-1;if(i[1]||i[2]){if(s=vlt(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=dG(e.text,r):(s=dG(e.text,r+i[0].length),s>-1&&i[0]=="xmpp:"&&(cG.lastIndex=s,i=cG.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)}}]},Slt=[blt,ylt,glt,wlt];function Ime(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 mG=null,gG=null,bG=0;function D3(e,t){let n=e.pos+t;if(bG==n&&gG==e)return mG;let r=e.peek(t),i="";for(;Wlt(r);)i+=String.fromCharCode(r),r=e.peek(++t);return gG=e,bG=n,mG=i?i.toLowerCase():r==Zlt||r==Klt?void 0:null}const Fme=60,p_=62,h9=47,Zlt=63,Klt=33,Jlt=45;function OG(e,t){this.name=e,this.parent=t}const ect=[f9,Lme,Dme,Pme,Mme],tct=new MC({start:null,shift(e,t,n,r){return ect.indexOf(t)>-1?new OG(D3(r,1)||"",e):e},reduce(e,t){return t==$me&&e?e.parent:e},reuse(e,t,n,r){let i=t.type.id;return i==f9||i==Vlt?new OG(D3(r,1)||"",e):e},strict:!1}),nct=new ds((e,t)=>{if(e.next!=Fme){e.next<0&&t.context&&e.acceptToken(jI);return}e.advance();let n=e.next==h9;n&&e.advance();let r=D3(e,0);if(r===void 0)return;if(!r)return e.acceptToken(n?$lt:Llt);let i=t.context?t.context.name:null;if(n){if(r==i)return e.acceptToken(Dlt);if(i&&Ylt[i])return e.acceptToken(jI,-2);if(t.dialectEnabled(Hlt))return e.acceptToken(Plt);for(let s=t.context;s;s=s.parent)if(s.name==r)return;e.acceptToken(Mlt)}else{if(r=="script")return e.acceptToken(Dme);if(r=="style")return e.acceptToken(Pme);if(r=="textarea")return e.acceptToken(Mme);if(Glt.hasOwnProperty(r))return e.acceptToken(Lme);i&&pG[i]&&pG[i][r]?e.acceptToken(jI,-1):e.acceptToken(f9)}},{contextual:!0}),rct=new ds(e=>{for(let t=0,n=0;;n++){if(e.next<0){n&&e.acceptToken(hG);break}if(e.next==Jlt)t++;else if(e.next==p_&&t>=2){n>=3&&e.acceptToken(hG,-2);break}else t=0;e.advance()}});function ict(e){for(;e;e=e.parent)if(e.name=="svg"||e.name=="math")return!0;return!1}const sct=new ds((e,t)=>{if(e.next==h9&&e.peek(1)==p_){let n=t.dialectEnabled(Xlt)||ict(t.context);e.acceptToken(n?Ilt:fG,2)}else e.next==p_&&e.acceptToken(fG,1)});function p9(e,t,n){let r=2+e.length;return new ds(i=>{for(let s=0,a=0,l=0;;l++){if(i.next<0){l&&i.acceptToken(t);break}if(s==0&&i.next==Fme||s==1&&i.next==h9||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 act=p9("script",_lt,Alt),oct=p9("style",Clt,Nlt),lct=p9("textarea",jlt,Rlt),cct=hf({"Text RawText IncompleteTag IncompleteCloseTag":G.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":G.angleBracket,TagName:G.tagName,"MismatchedCloseTag/TagName":[G.tagName,G.invalid],AttributeName:G.attributeName,"AttributeValue UnquotedAttributeValue":G.attributeValue,Is:G.definitionOperator,"EntityReference CharacterReference":G.character,Comment:G.blockComment,ProcessingInst:G.processingInstruction,DoctypeDecl:G.documentMeta}),uct=ef.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:tct,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:[cct],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==Flt)return RI(l,c,n);if(u==Ult)return RI(l,c,r);if(u==zlt)return RI(l,c,i);if(u==$me&&s.length){let d=l.node,f=d.firstChild,h=f&&yG(f,c),p;if(h){for(let b of s)if(b.tag==h&&(!b.attrs||b.attrs(p||(p=Ume(f,c))))){let g=d.lastChild,O=g.type.id==qlt?g.from:d.to;if(O>f.to)return{parser:b.parser,overlay:[{from:f.to,to:O}]}}}}if(a&&u==Bme){let d=l.node,f;if(f=d.firstChild){let h=a[c.read(f.from,f.to)];if(h)for(let p of h){if(p.tagName&&p.tagName!=yG(d.parent,c))continue;let b=d.lastChild;if(b.type.id==I3){let g=b.from+1,O=b.lastChild,y=b.to-(O&&O.isError?0:1);if(y>g)return{parser:p.parser,overlay:[{from:g,to:y}],bracketed:!0}}else if(b.type.id==Qme)return{parser:p.parser,overlay:[{from:b.from,to:b.to}]}}}}return null})}const dct=145,xG=1,fct=146,hct=147,Vme=2,pct=148,mct=3,gct=4,qme=[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],bct=58,Oct=40,Hme=95,yct=91,iT=45,xct=46,vct=35,wct=37,Sct=38,Ect=92,kct=10,Tct=42;function Sv(e){return e>=65&&e<=90||e>=97&&e<=122||e>=161}function m9(e){return e>=48&&e<=57}function vG(e){return m9(e)||e>=97&&e<=102||e>=65&&e<=70}const Xme=(e,t,n)=>(r,i)=>{for(let s=!1,a=0,l=0;;l++){let{next:c}=r;if(Sv(c)||c==iT||c==Hme||s&&m9(c))!s&&(c!=iT||l>0)&&(s=!0),a===l&&c==iT&&a++,r.advance();else if(c==Ect&&r.peek(1)!=kct){if(r.advance(),vG(r.next)){do r.advance();while(vG(r.next));r.next==32&&r.advance()}else r.next>-1&&r.advance();s=!0}else{s&&r.acceptToken(a==2&&i.canShift(Vme)?t:c==Oct?n:e);break}}},_ct=new ds(Xme(fct,Vme,hct),{contextual:!0}),Act=new ds(Xme(pct,mct,gct),{contextual:!0}),Cct=new ds(e=>{if(qme.includes(e.peek(-1))){let{next:t}=e;(Sv(t)||t==Hme||t==vct||t==xct||t==Tct||t==yct||t==bct&&Sv(e.peek(1))||t==iT||t==Sct)&&e.acceptToken(dct)}}),Nct=new ds(e=>{if(!qme.includes(e.peek(-1))){let{next:t}=e;if(t==wct&&(e.advance(),e.acceptToken(xG)),Sv(t)){do e.advance();while(Sv(e.next)||m9(e.next));e.acceptToken(xG)}}}),jct=hf({"AtKeyword import charset namespace keyframes media supports font-feature-values":G.definitionKeyword,"from to selector scope MatchFlag":G.keyword,NamespaceName:G.namespace,KeyframeName:G.labelName,KeyframeRangeName:G.operatorKeyword,TagName:G.tagName,ClassName:G.className,PseudoClassName:G.constant(G.className),IdName:G.labelName,"FeatureName PropertyName":G.propertyName,AttributeName:G.attributeName,NumberLiteral:G.number,KeywordQuery:G.keyword,UnaryQueryOp:G.operatorKeyword,"CallTag ValueName FontName":G.atom,VariableName:G.variableName,Callee:G.operatorKeyword,Unit:G.unit,"UniversalSelector NestingSelector":G.definitionOperator,"MatchOp CompareOp":G.compareOperator,"ChildOp SiblingOp, LogicOp":G.logicOperator,BinOp:G.arithmeticOperator,Important:G.modifier,Comment:G.blockComment,ColorLiteral:G.color,"ParenthesizedContent StringLiteral":G.string,":":G.punctuation,"PseudoOp #":G.derefOperator,"; , |":G.separator,"( )":G.paren,"[ ]":G.squareBracket,"{ }":G.brace}),Rct={__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},Ict={__proto__:null,or:104,and:104,not:112,only:112,layer:206},Dct={__proto__:null,selector:118,style:124,layer:202},Pct={__proto__:null,"@import":198,"@media":210,"@charset":214,"@namespace":218,"@keyframes":224,"@supports":236,"@scope":240,"@font-feature-values":246},Mct={__proto__:null,to:243},Lct=ef.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:[Cct,Nct,_ct,Act,1,2,3,4,new c_("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=>Rct[e]||-1},{term:148,get:e=>Ict[e]||-1},{term:4,get:e=>Dct[e]||-1},{term:28,get:e=>Pct[e]||-1},{term:146,get:e=>Mct[e]||-1}],tokenPrec:2405});let II=null;function DI(){if(!II&&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)));II=t.sort().map(r=>({type:"property",label:r,apply:r+": "}))}return II||[]}const wG=["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})),SG=["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}))),$ct=["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})),Bct=["@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})),td=/^(\w[\w-]*|-\w[\w-]*|)$/,Qct=/^-(-[\w-]*)?$/;function Fct(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 EG=new T8,Uct=["Declaration"];function zct(e){for(let t=e;;){if(t.type.isTop)return t;if(!(t=t.parent))return e}}function Gme(e,t,n){if(t.to-t.from>4096){let r=EG.get(t);if(r)return r;let i=[],s=new Set,a=t.cursor(Ar.IncludeAnonymous);if(a.firstChild())do for(let l of Gme(e,a.node,n))s.has(l.label)||(s.add(l.label),i.push(l));while(a.nextSibling());return EG.set(t,i),i}else{let r=[],i=new Set;return t.cursor().iterate(s=>{var a;if(n(s)&&s.matchContext(Uct)&&((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 Vct=e=>t=>{let{state:n,pos:r}=t,i=Yr(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:DI(),validFor:td};if(i.name=="ValueName")return{from:i.from,options:SG,validFor:td};if(i.name=="PseudoClassName")return{from:i.from,options:wG,validFor:td};if(e(i)||(t.explicit||s)&&Fct(i,n.doc))return{from:e(i)||s?i.from:r,options:Gme(n.doc,zct(i),e),validFor:Qct};if(i.name=="TagName"){for(let{parent:c}=i;c;c=c.parent)if(c.name=="Block")return{from:i.from,options:DI(),validFor:td};return{from:i.from,options:$ct,validFor:td}}if(i.name=="AtKeyword")return{from:i.from,options:Bct,validFor:td};if(!t.explicit)return null;let a=i.resolve(r),l=a.childBefore(r);return l&&l.name==":"&&a.name=="PseudoClassSelector"?{from:r,options:wG,validFor:td}:l&&l.name==":"&&a.name=="Declaration"||a.name=="ArgList"?{from:r,options:SG,validFor:td}:a.name=="Block"||a.name=="Styles"?{from:r,options:DI(),validFor:td}:null},qct=Vct(e=>e.name=="VariableName"),m_=Jd.define({name:"css",parser:Lct.configure({props:[pf.add({Declaration:tb()}),mf.add({"Block KeyframeList":Rw})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Hct(){return new Xh(m_,m_.data.of({autocomplete:qct}))}const Dy=["_blank","_self","_top","_parent"],PI=["ascii","utf-8","utf-16","latin1","latin1"],MI=["get","post","put","delete"],LI=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Do=["true","false"],Ft={},Xct={a:{attrs:{href:null,ping:null,type:null,media:null,target:Dy,hreflang:null}},abbr:Ft,address:Ft,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Ft,aside:Ft,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Ft,base:{attrs:{href:null,target:Dy}},bdi:Ft,bdo:Ft,blockquote:{attrs:{cite:null}},body:Ft,br:Ft,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:LI,formmethod:MI,formnovalidate:["novalidate"],formtarget:Dy,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Ft,center:Ft,cite:Ft,code:Ft,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:Ft,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Ft,div:Ft,dl:Ft,dt:Ft,em:Ft,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Ft,figure:Ft,footer:Ft,form:{attrs:{action:null,name:null,"accept-charset":PI,autocomplete:["on","off"],enctype:LI,method:MI,novalidate:["novalidate"],target:Dy}},h1:Ft,h2:Ft,h3:Ft,h4:Ft,h5:Ft,h6:Ft,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Ft,hgroup:Ft,hr:Ft,html:{attrs:{manifest:null}},i:Ft,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:LI,formmethod:MI,formnovalidate:["novalidate"],formtarget:Dy,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:Ft,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Ft,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:Ft,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:PI,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:Ft,noscript:Ft,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:Ft,param:{attrs:{name:null,value:null}},pre:Ft,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Ft,rt:Ft,ruby:Ft,samp:Ft,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:PI}},section:Ft,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Ft,source:{attrs:{src:null,type:null,media:null}},span:Ft,strong:Ft,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Ft,summary:Ft,sup:Ft,table:Ft,tbody:Ft,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Ft,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:Ft,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Ft,time:{attrs:{datetime:null}},title:Ft,tr:Ft,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Ft,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:Ft},Yme={accesskey:null,class:null,contenteditable:Do,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:Do,autocorrect:Do,autocapitalize:Do,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":Do,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Do,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Do,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Do,"aria-hidden":Do,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Do,"aria-multiselectable":Do,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Do,"aria-relevant":null,"aria-required":Do,"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},Wme="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 Wme)Yme[e]=null;class Ev{constructor(t,n){this.tags={...Xct,...t},this.globalAttrs={...Yme,...n},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}Ev.default=new Ev;function Yb(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 Wb(e,t=!1){for(;e;e=e.parent)if(e.name=="Element")if(t)t=!1;else return e;return null}function Zme(e,t,n){let r=n.tags[Yb(e,Wb(t))];return(r==null?void 0:r.children)||n.allTags}function g9(e,t){let n=[];for(let r=Wb(t);r&&!r.type.isTop;r=Wb(r.parent)){let i=Yb(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 Kme=/^[:\-\.\w\u00b7-\uffff]*$/;function kG(e,t,n,r,i){let s=/\s*>/.test(e.sliceDoc(i,i+5))?"":">",a=Wb(n,n.name=="StartTag"||n.name=="TagName");return{from:r,to:i,options:Zme(e.doc,a,t).map(l=>({label:l,type:"type"})).concat(g9(e.doc,n).map((l,c)=>({label:"/"+l,apply:"/"+l+s,type:"type",boost:99-c}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function TG(e,t,n,r){let i=/\s*>/.test(e.sliceDoc(r,r+5))?"":">";return{from:n,to:r,options:g9(e.doc,t).map((s,a)=>({label:s,apply:s+i,type:"type",boost:99-a})),validFor:Kme}}function Gct(e,t,n,r){let i=[],s=0;for(let a of Zme(e.doc,n,t))i.push({label:"<"+a,type:"type"});for(let a of g9(e.doc,n))i.push({label:"",type:"type",boost:99-s++});return{from:r,to:r,options:i,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function Yct(e,t,n,r,i){let s=Wb(n),a=s?t.tags[Yb(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:Kme}}function Wct(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=Wb(n),h=f?t.tags[Yb(e.doc,f)]:null;d=(h==null?void 0:h.attrs)&&h.attrs[u]}if(d){let f=e.sliceDoc(r,i).toLowerCase(),h='"',p='"';/^['"]/.test(f)?(c=f[0]=='"'?/^[^"]*$/:/^[^']*$/,h="",p=e.sliceDoc(i,i+1)==f[0]?"":f[0],f=f.slice(1),r++):c=/^[^\s<>='"]*$/;for(let b of d)l.push({label:b,apply:h+b+p,type:"constant"})}}return{from:r,to:i,options:l,validFor:c}}function Jme(e,t){let{state:n,pos:r}=t,i=Yr(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.fromJme(r,i)}const Jct=Eu.parser.configure({top:"SingleExpression"}),ege=[{tag:"script",attrs:e=>e.type=="text/typescript"||e.lang=="ts",parser:ome.parser},{tag:"script",attrs:e=>e.type=="text/babel"||e.type=="text/jsx",parser:lme.parser},{tag:"script",attrs:e=>e.type=="text/typescript-jsx",parser:cme.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:Jct},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:Eu.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:m_.parser}],tge=[{name:"style",parser:m_.parser.configure({top:"Styles"})}].concat(Wme.map(e=>({name:e,parser:Eu.parser}))),nge=Jd.define({name:"html",parser:uct.configure({props:[pf.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=nge.configure({wrap:zme(ege,tge)});function eut(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=zme((e.nestedLanguages||[]).concat(ege),(e.nestedAttributes||[]).concat(tge)));let r=n?nge.configure({wrap:n,dialect:t}):t?sT.configure({dialect:t}):sT;return new Xh(r,[sT.data.of({autocomplete:Kct(e)}),e.autoCloseTags!==!1?tut:[],A3().support,Hct().support])}const _G=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),tut=pt.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:p}=c,b=Yr(a).resolveInner(p,-1),g;if(h&&r==">"&&b.name=="EndTag"){let O=b.parent;if(((d=(u=O.parent)===null||u===void 0?void 0:u.lastChild)===null||d===void 0?void 0:d.name)!="CloseTag"&&(g=Yb(a.doc,O.parent,p))&&!_G.has(g)){let y=p+(a.doc.sliceString(p,p+1)===">"?1:0),v=``;return{range:c,changes:{from:p,to:y,insert:v}}}}else if(h&&r=="/"&&b.name=="IncompleteCloseTag"){let O=b.parent;if(b.from==p-2&&((f=O.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(g=Yb(a.doc,O,p))&&!_G.has(g)){let y=p+(a.doc.sliceString(p,p+1)===">"?1:0),v=`${g}>`;return{range:Fe.cursor(p+v.length,-1),changes:{from:p,to:y,insert:v}}}}return{range:c}});return l.changes.empty?!1:(e.dispatch([s,a.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),rge=IC({commentTokens:{block:{open:""}}}),ige=new dn,sge=flt.configure({props:[mf.add(e=>!e.is("Block")||e.is("Document")||P3(e)!=null||nut(e)?void 0:(t,n)=>({from:n.doc.lineAt(t.from).to,to:t.to})),ige.add(P3),pf.add({Document:()=>null}),lh.add({Document:rge})]});function P3(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function nut(e){return e.name=="OrderedList"||e.name=="BulletList"}function rut(e,t){let n=e;for(;;){let r=n.nextSibling,i;if(!r||(i=P3(r.type))!=null&&i<=t)break;n=r}return n.to}const iut=Epe.of((e,t,n)=>{for(let r=Yr(e).resolveInner(n,-1);r&&!(r.fromn)return{from:n,to:s}}return null});function b9(e){return new Wo(rge,e,[],"markdown")}const sut=b9(sge),aut=sge.configure([Slt,klt,Elt,Tlt,{props:[mf.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]),g_=b9(aut);function out(e,t){return n=>{if(n&&e){let r=null;if(n=/\S*/.exec(n)[0],typeof e=="function"?r=e(n):r=i_.matchLanguageName(e,n,!0),r instanceof i_)return r.support?r.support.language.parser:Pm.getSkippingParser(r.load());if(r)return r.parser}return t?t.parser:null}}let $I=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(+oge(this.item,t)[2]+n):"";return this.spaceBefore+r+this.type+this.spaceAfter}};function age(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 $I(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 $I(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 $I(s.parent,c,c+d,a[1],u,f,s))}}return r}function oge(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function BI(e,t,n,r=0){for(let i=-1,s=e;;){if(s.name=="ListItem"){let l=oge(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 O9(e,t){let n=/^[ \t]*/.exec(e)[0].length;if(!n||t.facet(QO)!=" ")return e;let r=_c(e,4,n),i="";for(let s=r;s>0;)s>=4?(i+=" ",s-=4):(i+=" ",s--);return i+e.slice(n)}const lut=(e={})=>({state:t,dispatch:n})=>{let r=Yr(t),{doc:i}=t,s=null,a=t.changeByRange(l=>{if(!l.empty||!g_.isActiveAt(t,l.from,-1)&&!g_.isActiveAt(t,l.from,1))return s={range:l};let c=l.from,u=i.lineAt(c),d=age(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 y=f.node.firstChild,v=f.node.getChild("ListItem","ListItem");if(y.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"&&BI(f.item,i,E,-2),x&&x.node.name=="OrderedList"&&BI(x.item,i,E),{range:Fe.cursor(w+S.length),changes:E}}else{let x=CG(d,t,u);return{range:Fe.cursor(c+x.length+1),changes:{from:u.from,insert:x+t.lineBreak}}}}if(f.node.name=="Blockquote"&&h&&u.from){let y=i.lineAt(u.from-1),v=/>\s*$/.exec(y.text);if(v&&v.index==f.from){let x=t.changes([{from:y.from+v.index,to:y.to},{from:u.from+f.from,to:u.to}]);return{range:l.map(x),changes:x}}}let p=[];f.node.name=="OrderedList"&&BI(f.item,i,p);let b=f.item&&f.item.from]*/.exec(u.text)[0].length>=f.to)for(let y=0,v=d.length-1;y<=v;y++)g+=y==v&&!b?d[y].marker(i,1):d[y].blank(yu.from&&/\s/.test(u.text.charAt(O-u.from-1));)O--;return g=O9(g,t),uut(f.node,t.doc)&&(g=CG(d,t,u)+t.lineBreak+g),p.push({from:O,to:c,insert:t.lineBreak+g}),{range:Fe.cursor(O+g.length+1),changes:p}});return s?!1:(n(t.update(a,{scrollIntoView:!0,userEvent:"input"})),!0)},cut=lut();function AG(e){return e.name=="QuoteMark"||e.name=="ListMark"}function uut(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=Yr(e),r=null,i=e.changeByRange(s=>{let a=s.from,{doc:l}=e;if(s.empty&&g_.isActiveAt(e,s.from)){let c=l.lineAt(a),u=age(dut(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:Fe.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),!g_.isActiveAt(t.state,r.from,1)))return!1;let s=Yr(t.state),a=!1;return s.iterate({from:r.from,to:r.to,enter:l=>{(l.from>r.from||but.test(l.name))&&(a=!0)},leave:l=>{l.to=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}const Odt=new ds((e,t)=>{let n;if(e.next<0)e.acceptToken(wut);else if(t.context.flags&aT)FI(e.next)&&e.acceptToken(vut,1);else if(((n=e.peek(-1))<0||FI(n))&&t.canShift(NG)){let r=0;for(;e.next==y9||e.next==BC;)e.advance(),r++;(e.next==$m||e.next==kv||e.next==x9)&&e.acceptToken(NG,-r)}else FI(e.next)&&e.acceptToken(xut,1)},{contextual:!0}),ydt=new ds((e,t)=>{let n=t.context;if(n.flags)return;let r=e.peek(-1);if(r==$m||r==kv){let i=0,s=0;for(;;){if(e.next==y9)i++;else if(e.next==BC)i+=8-i%8;else break;e.advance(),s++}i!=n.indent&&e.next!=$m&&e.next!=kv&&e.next!=x9&&(i[e,t|mge])),wdt=new MC({start:xdt,reduce(e,t,n,r){return e.flags&aT&&bdt.has(t)||(t==But||t==fge)&&e.flags&mge?e.parent:e},shift(e,t,n,r){return t==cge?new oT(e,vdt(r.read(r.pos,n.pos)),0):t==uge?e.parent:t==kut||t==Cut||t==Rut||t==dge?new oT(e,0,aT):DG.has(t)?new oT(e,0,DG.get(t)|e.flags&aT):e},hash(e){return e.hash}}),Sdt=new ds(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==y9||n==BC)){n!=udt&&n!=ddt&&n!=$m&&n!=kv&&n!=x9&&e.acceptToken(yut);return}}}),Edt=new ds((e,t)=>{let{flags:n}=t.context,r=n&od?pge:hge,i=(n&ld)>0,s=!(n&cd),a=(n&ud)>0,l=e.pos;for(;!(e.next<0);)if(a&&e.next==M3)if(e.peek(1)==M3)e.advance(2);else{if(e.pos==l){e.acceptToken(dge,1);return}break}else if(s&&e.next==IG){if(e.pos==l){e.advance();let c=e.next;c>=0&&(e.advance(),kdt(e,c)),e.acceptToken(Eut);return}break}else if(e.next==IG&&!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(jG,i?3:1);return}break}else if(e.next==$m){if(i)e.advance();else if(e.pos==l){e.acceptToken(jG);return}break}else e.advance();e.pos>l&&e.acceptToken(Sut)});function kdt(e,t){if(t==fdt)for(let n=0;n<2&&e.next>=48&&e.next<=55;n++)e.advance();else if(t==hdt)for(let n=0;n<2&&UI(e.next);n++)e.advance();else if(t==mdt)for(let n=0;n<4&&UI(e.next);n++)e.advance();else if(t==gdt)for(let n=0;n<8&&UI(e.next);n++)e.advance();else if(t==pdt&&e.next==M3){for(e.advance();e.next>=0&&e.next!=RG&&e.next!=hge&&e.next!=pge&&e.next!=$m;)e.advance();e.next==RG&&e.advance()}}const Tdt=hf({'async "*" "**" FormatConversion FormatSpec':G.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":G.controlKeyword,"in not and or is del":G.operatorKeyword,"from def class global nonlocal lambda":G.definitionKeyword,import:G.moduleKeyword,"with as print":G.keyword,Boolean:G.bool,None:G.null,VariableName:G.variableName,"CallExpression/VariableName":G.function(G.variableName),"FunctionDefinition/VariableName":G.function(G.definition(G.variableName)),"ClassDefinition/VariableName":G.definition(G.className),PropertyName:G.propertyName,"CallExpression/MemberExpression/PropertyName":G.function(G.propertyName),Comment:G.lineComment,Number:G.number,String:G.string,FormatString:G.special(G.string),Escape:G.escape,UpdateOp:G.updateOperator,"ArithOp!":G.arithmeticOperator,BitOp:G.bitwiseOperator,CompareOp:G.compareOperator,AssignOp:G.definitionOperator,Ellipsis:G.punctuation,At:G.meta,"( )":G.paren,"[ ]":G.squareBracket,"{ }":G.brace,".":G.derefOperator,", ;":G.separator}),_dt={__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},Adt=ef.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:[Sdt,ydt,Odt,Edt,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:e=>_dt[e]||-1}],tokenPrec:7668}),PG=new T8,gge=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function HE(e){return(t,n,r)=>{if(r)return!1;let i=t.node.getChild("VariableName");return i&&n(i,e),!0}}const Cdt={FunctionDefinition:HE("function"),ClassDefinition:HE("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:HE("variable"),AsPattern:HE("variable"),__proto__:null};function bge(e,t){let n=PG.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(Ar.IncludeAnonymous).iterate(a=>{if(a.name){let l=Cdt[a.name];if(l&&l(a,s,i)||!i&&gge.has(a.name))return!1;i=!1}else if(a.to-a.from>8192){for(let l of bge(e,a.node))r.push(l);return!1}}),PG.set(t,r),r}const MG=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,Oge=["String","FormatString","Comment","PropertyName"];function Ndt(e){let t=Yr(e.state).resolveInner(e.pos,-1);if(Oge.indexOf(t.name)>-1)return null;let n=t.name=="VariableName"||t.to-t.from<20&&MG.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let r=[];for(let i=t;i;i=i.parent)gge.has(i.name)&&(r=r.concat(bge(e.state.doc,i)));return{options:r,from:n?t.from:e.pos,validFor:MG}}const jdt=["__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"}))),Rdt=[$i("def ${name}(${params}):\n ${}",{label:"def",detail:"function",type:"keyword"}),$i("for ${name} in ${collection}:\n ${}",{label:"for",detail:"loop",type:"keyword"}),$i("while ${}:\n ${}",{label:"while",detail:"loop",type:"keyword"}),$i("try:\n ${}\nexcept ${error}:\n ${}",{label:"try",detail:"/ except block",type:"keyword"}),$i(`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=p_.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 Un(this.parser.nodeSet.types[t],Yb,Yb,(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(D3(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?Eme(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=D3(this.parser.parseInline(t.content,t.start),t.marks);this.addNode(this.buffer.writeElements(n,-t.start).finish(ct.Paragraph,t.content.length),t.start)}elt(t,n,r,i){return typeof t=="string"?Or(this.parser.getNodeType(t),n,r,i):new _me(t,n)}get buffer(){return new Tme(this.parser.nodeSet)}}function Eme(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,p=i.get(d.tree);p?h=p:d.to+r>s?(h=Eme(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 Un(n.type,a,l,n.to+r-c,n.tree?n.tree.propValues:void 0)}class QC extends _C{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 clt(this,t,n,r);for(let s of this.wrappers)i=s(i,t,n,r);return i}configure(t){let n=I3(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(Dy(n.defineNodes)){i=Object.assign({},i);let h=r.types.slice(),p;for(let b of n.defineNodes){let{name:g,block:O,composite:y,style:v}=typeof b=="string"?{name:b}:b;if(h.some(S=>S.name==g))continue;y&&(i[h.length]=(S,E,k)=>y(E,k,S.value));let x=h.length,w=y?["Block","BlockContext"]:O?x>=ct.ATXHeading1&&x<=ct.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;h.push(ws.define({id:x,name:g,props:w&&[[dn.group,w]]})),v&&(p||(p={}),Array.isArray(v)||v instanceof iu?p[g]=v:Object.assign(p,v))}r=new BO(h),p&&(r=r.extend(hf(p)))}if(Dy(n.props)&&(r=r.extend(...n.props)),Dy(n.remove))for(let h of n.remove){let p=this.blockNames.indexOf(h),b=this.inlineNames.indexOf(h);p>-1&&(s[p]=a[p]=void 0),b>-1&&(c[b]=void 0)}if(Dy(n.parseBlock))for(let h of n.parseBlock){let p=l.indexOf(h.name);if(p>-1)s[p]=h.parse,a[p]=h.leaf;else{let b=h.before?qE(l,h.before):h.after?qE(l,h.after)+1:l.length-1;s.splice(b,0,h.parse),a.splice(b,0,h.leaf),l.splice(b,0,h.name)}h.endLeaf&&d.push(h.endLeaf)}if(Dy(n.parseInline))for(let h of n.parseInline){let p=u.indexOf(h.name);if(p>-1)c[p]=h.parse;else{let b=h.before?qE(u,h.before):h.after?qE(u,h.after)+1:u.length-1;c.splice(b,0,h.parse),u.splice(b,0,h.name)}}return n.wrap&&(f=f.concat(n.wrap)),new QC(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 h9(this,t,n);e:for(let i=n;i=0){i=l;continue e}}i++}return r.resolveMarkers(0)}}function Dy(e){return e!=null&&e.length>0}function I3(e){if(!Array.isArray(e))return e;if(e.length==0)return null;let t=I3(e[0]);if(e.length==1)return t;let n=I3(e.slice(1));if(!n||!t)return t||n;let r=(a,l)=>(a||Yb).concat(l||Yb),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 qE(e,t){let n=e.indexOf(t);if(n<0)throw new RangeError(`Position specified relative to unknown parser ${t}`);return n}let kme=[ws.none];for(let e=1,t;t=ct[e];e++)kme[e]=ws.define({id:e,name:t,props:e>=ct.Escape?[]:[[dn.group,e in pme?["Block","BlockContext"]:["Block","LeafBlock"]]],top:t=="Document"});const Yb=[];class Tme{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 Un.build({buffer:this.content,nodeSet:this.nodeSet,reused:this.nodes,topID:t,length:n})}}let wv=class{constructor(t,n,r,i=Yb){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 Tme(t).writeElements(this.children,-this.from).finish(this.type,this.to-this.from)}};class _me{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 Yb}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 Or(e,t,n,r){return new wv(e,t,n,r)}const Ame={resolve:"Emphasis",mark:"EmphasisMark"},Cme={resolve:"Emphasis",mark:"EmphasisMark"},Fp={},m_={};class Uo{constructor(t,n,r,i){this.type=t,this.from=n,this.to=r,this.side=i}}const sG="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";let Sv=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;try{Sv=new RegExp("[\\p{S}|\\p{P}]","u")}catch{}const RI={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(Or(ct.Autolink,n,n+1+i[0].length,[Or(ct.LinkMark,n,n+1),Or(ct.URL,n+1,n+i[0].length),Or(ct.LinkMark,n+i[0].length,n+1+i[0].length)]));let s=/^!--[^>](?:-[^-]|[^-])*?-->/i.exec(r);if(s)return e.append(Or(ct.Comment,n,n+1+s[0].length));let a=/^\?[^]*?\?>/.exec(r);if(a)return e.append(Or(ct.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(Or(ct.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=Sv.test(i),l=Sv.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),p=f&&(t==42||!d||l);return e.append(new Uo(t==95?Ame:Cme,n,r,(h?1:0)|(p?2:0)))},HardBreak(e,t,n){if(t==92&&e.char(n+1)==10)return e.append(Or(ct.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(Or(ct.HardBreak,n,r+1))}return-1},Link(e,t,n){return t==91?e.append(new Uo(Fp,n,n+1,1)):-1},Image(e,t,n){return t==33&&e.char(n+1)==91?e.append(new Uo(m_,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 Uo&&(i.type==Fp||i.type==m_)){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]=ult(e,s,i.type==Fp?ct.Link:ct.Image,i.from,n+1);if(i.type==Fp)for(let l=0;lt?Or(ct.URL,t+n,s+n):s==e.length?null:!1}}function jme(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 Uo(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 Uo&&(n.type==Fp||n.type==m_))return!0}return!1}addElement(t){return this.append(t)}resolveMarkers(t){for(let r=t;r=t;c--){let g=this.parts[c];if(g instanceof Uo&&g.side&1&&g.type==i.type&&!(s&&(i.side&1||g.side&2)&&(g.to-g.from+a)%3==0&&((g.to-g.from)%3||a%3))){l=g;break}}if(!l)continue;let u=i.type.resolve,d=[],f=l.from,h=i.to;if(s){let g=Math.min(2,l.to-l.from,a);f=l.to-g,h=i.from+g,u=g==1?"Emphasis":"StrongEmphasis"}l.type.mark&&d.push(this.elt(l.type.mark,f,l.to));for(let g=c+1;g=0;n--){let r=this.parts[n];if(r instanceof Uo&&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 Uo?n:null}skipSpace(t){return ix(this.text,t-this.offset)+this.offset}elt(t,n,r,i){return typeof t=="string"?Or(this.parser.getNodeType(t),n,r,i):new _me(t,n)}}h9.linkStart=Fp;h9.imageStart=m_;function D3(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(dn.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=Ime(n.from-r,t.ranges);if(n.to-r<=t.ranges[t.rangeI].to)t.addNode(n.tree,d);else{let f=new Un(t.parser.nodeSet.types[ct.Paragraph],[],[],0,t.block.hashProp);t.reusePlaceholders.set(f,n.tree),t.addNode(f,d)}if(n.type.is("Block")&&(dlt.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 Ime(e,t){let n=e;for(let r=1;rVE[e]),Object.keys(VE).map(e=>Sme[e]),Object.keys(VE),olt,pme,Object.keys(RI).map(e=>RI[e]),Object.keys(RI),[]);function mlt(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 glt(e){let{codeParser:t,htmlParser:n}=e;return{wrap:Yfe((i,s)=>{let a=i.type.id;if(t&&(a==ct.CodeBlock||a==ct.FencedCode)){let l="";if(a==ct.FencedCode){let u=i.node.getChild(ct.CodeInfo);u&&(l=s.read(u.from,u.to))}let c=t(l);if(c)return{parser:c,overlay:u=>u.type.id==ct.CodeText,bracketed:a==ct.FencedCode}}else if(n&&(a==ct.HTMLBlock||a==ct.HTMLTag||a==ct.CommentBlock))return{parser:n,overlay:mlt(i.node,i.from,i.to)};return null})}}const blt={resolve:"Strikethrough",mark:"StrikethroughMark"},Olt={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":G.strikethrough}},{name:"StrikethroughMark",style:G.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=Sv.test(r),c=Sv.test(i);return e.addDelimiter(blt,n,n+2,!a&&(!c||s||l),!s&&(!l||a||c))},after:"Emphasis"}]};function sx(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 aG(e,t){for(let n=t;n\s]*\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;class oG{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)&&Dme.test(i=n.text.slice(n.pos))){let s=[];sx(t,r.content,0,s,r.start)==sx(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=[];sx(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 ylt={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":G.heading}},"TableRow",{name:"TableCell",style:G.content},{name:"TableDelimiter",style:G.processingInstruction}],parseBlock:[{name:"Table",leaf(e,t){return aG(t.content,0)?new oG:null},endLeaf(e,t,n){if(n.parsers.some(i=>i instanceof oG)||!aG(t.text,t.basePos))return!1;let r=e.peekLine();return Dme.test(r)&&sx(e,t.text,t.basePos)==sx(e,r,t.basePos)},before:"SetextHeading"}]};class xlt{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 vlt={defineNodes:[{name:"Task",block:!0,style:G.list},{name:"TaskMarker",style:G.atom}],parseBlock:[{name:"TaskList",leaf(e,t){return/^\[[ xX]\][ \t]/.test(t.content)&&e.parentType().name=="ListItem"?new xlt:null},after:"SetextHeading"}]},lG=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,cG=/[\w-]+(\.[\w-]+)+(:\d+)?(\/[^\s<]*)?/gy,wlt=/[\w-]+\.[\w-]+($|[/:])/,uG=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,dG=/\/[a-zA-Z\d@.]+/gy;function fG(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==")"&&fG(e,t,r,")")>fG(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 hG(e,t){uG.lastIndex=t;let n=uG.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 Elt={parseInline:[{name:"Autolink",parse(e,t,n){let r=n-e.offset;if(r&&/\w/.test(e.text[r-1]))return-1;lG.lastIndex=r;let i=lG.exec(e.text),s=-1;if(!i)return-1;if(i[1]||i[2]){if(s=Slt(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=hG(e.text,r):(s=hG(e.text,r+i[0].length),s>-1&&i[0]=="xmpp:"&&(dG.lastIndex=s,i=dG.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)}}]},klt=[ylt,vlt,Olt,Elt];function Pme(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 bG=null,OG=null,yG=0;function M3(e,t){let n=e.pos+t;if(yG==n&&OG==e)return bG;let r=e.peek(t),i="";for(;Klt(r);)i+=String.fromCharCode(r),r=e.peek(++t);return OG=e,yG=n,bG=i?i.toLowerCase():r==Jlt||r==ect?void 0:null}const zme=60,g_=62,m9=47,Jlt=63,ect=33,tct=45;function xG(e,t){this.name=e,this.parent=t}const nct=[p9,Bme,Mme,Lme,$me],rct=new $C({start:null,shift(e,t,n,r){return nct.indexOf(t)>-1?new xG(M3(r,1)||"",e):e},reduce(e,t){return t==Qme&&e?e.parent:e},reuse(e,t,n,r){let i=t.type.id;return i==p9||i==Hlt?new xG(M3(r,1)||"",e):e},strict:!1}),ict=new ds((e,t)=>{if(e.next!=zme){e.next<0&&t.context&&e.acceptToken(II);return}e.advance();let n=e.next==m9;n&&e.advance();let r=M3(e,0);if(r===void 0)return;if(!r)return e.acceptToken(n?Qlt:Blt);let i=t.context?t.context.name:null;if(n){if(r==i)return e.acceptToken(Mlt);if(i&&Zlt[i])return e.acceptToken(II,-2);if(t.dialectEnabled(Glt))return e.acceptToken(Llt);for(let s=t.context;s;s=s.parent)if(s.name==r)return;e.acceptToken($lt)}else{if(r=="script")return e.acceptToken(Mme);if(r=="style")return e.acceptToken(Lme);if(r=="textarea")return e.acceptToken($me);if(Wlt.hasOwnProperty(r))return e.acceptToken(Bme);i&&gG[i]&&gG[i][r]?e.acceptToken(II,-1):e.acceptToken(p9)}},{contextual:!0}),sct=new ds(e=>{for(let t=0,n=0;;n++){if(e.next<0){n&&e.acceptToken(mG);break}if(e.next==tct)t++;else if(e.next==g_&&t>=2){n>=3&&e.acceptToken(mG,-2);break}else t=0;e.advance()}});function act(e){for(;e;e=e.parent)if(e.name=="svg"||e.name=="math")return!0;return!1}const oct=new ds((e,t)=>{if(e.next==m9&&e.peek(1)==g_){let n=t.dialectEnabled(Ylt)||act(t.context);e.acceptToken(n?Plt:pG,2)}else e.next==g_&&e.acceptToken(pG,1)});function g9(e,t,n){let r=2+e.length;return new ds(i=>{for(let s=0,a=0,l=0;;l++){if(i.next<0){l&&i.acceptToken(t);break}if(s==0&&i.next==zme||s==1&&i.next==m9||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 lct=g9("script",Clt,Nlt),cct=g9("style",jlt,Rlt),uct=g9("textarea",Ilt,Dlt),dct=hf({"Text RawText IncompleteTag IncompleteCloseTag":G.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":G.angleBracket,TagName:G.tagName,"MismatchedCloseTag/TagName":[G.tagName,G.invalid],AttributeName:G.attributeName,"AttributeValue UnquotedAttributeValue":G.attributeValue,Is:G.definitionOperator,"EntityReference CharacterReference":G.character,Comment:G.blockComment,ProcessingInst:G.processingInstruction,DoctypeDecl:G.documentMeta}),fct=ef.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:rct,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:[dct],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==zlt)return DI(l,c,n);if(u==Vlt)return DI(l,c,r);if(u==qlt)return DI(l,c,i);if(u==Qme&&s.length){let d=l.node,f=d.firstChild,h=f&&vG(f,c),p;if(h){for(let b of s)if(b.tag==h&&(!b.attrs||b.attrs(p||(p=Vme(f,c))))){let g=d.lastChild,O=g.type.id==Xlt?g.from:d.to;if(O>f.to)return{parser:b.parser,overlay:[{from:f.to,to:O}]}}}}if(a&&u==Fme){let d=l.node,f;if(f=d.firstChild){let h=a[c.read(f.from,f.to)];if(h)for(let p of h){if(p.tagName&&p.tagName!=vG(d.parent,c))continue;let b=d.lastChild;if(b.type.id==P3){let g=b.from+1,O=b.lastChild,y=b.to-(O&&O.isError?0:1);if(y>g)return{parser:p.parser,overlay:[{from:g,to:y}],bracketed:!0}}else if(b.type.id==Ume)return{parser:p.parser,overlay:[{from:b.from,to:b.to}]}}}}return null})}const hct=145,wG=1,pct=146,mct=147,Hme=2,gct=148,bct=3,Oct=4,Xme=[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],yct=58,xct=40,Gme=95,vct=91,aT=45,wct=46,Sct=35,Ect=37,kct=38,Tct=92,_ct=10,Act=42;function Ev(e){return e>=65&&e<=90||e>=97&&e<=122||e>=161}function b9(e){return e>=48&&e<=57}function SG(e){return b9(e)||e>=97&&e<=102||e>=65&&e<=70}const Yme=(e,t,n)=>(r,i)=>{for(let s=!1,a=0,l=0;;l++){let{next:c}=r;if(Ev(c)||c==aT||c==Gme||s&&b9(c))!s&&(c!=aT||l>0)&&(s=!0),a===l&&c==aT&&a++,r.advance();else if(c==Tct&&r.peek(1)!=_ct){if(r.advance(),SG(r.next)){do r.advance();while(SG(r.next));r.next==32&&r.advance()}else r.next>-1&&r.advance();s=!0}else{s&&r.acceptToken(a==2&&i.canShift(Hme)?t:c==xct?n:e);break}}},Cct=new ds(Yme(pct,Hme,mct),{contextual:!0}),Nct=new ds(Yme(gct,bct,Oct),{contextual:!0}),jct=new ds(e=>{if(Xme.includes(e.peek(-1))){let{next:t}=e;(Ev(t)||t==Gme||t==Sct||t==wct||t==Act||t==vct||t==yct&&Ev(e.peek(1))||t==aT||t==kct)&&e.acceptToken(hct)}}),Rct=new ds(e=>{if(!Xme.includes(e.peek(-1))){let{next:t}=e;if(t==Ect&&(e.advance(),e.acceptToken(wG)),Ev(t)){do e.advance();while(Ev(e.next)||b9(e.next));e.acceptToken(wG)}}}),Ict=hf({"AtKeyword import charset namespace keyframes media supports font-feature-values":G.definitionKeyword,"from to selector scope MatchFlag":G.keyword,NamespaceName:G.namespace,KeyframeName:G.labelName,KeyframeRangeName:G.operatorKeyword,TagName:G.tagName,ClassName:G.className,PseudoClassName:G.constant(G.className),IdName:G.labelName,"FeatureName PropertyName":G.propertyName,AttributeName:G.attributeName,NumberLiteral:G.number,KeywordQuery:G.keyword,UnaryQueryOp:G.operatorKeyword,"CallTag ValueName FontName":G.atom,VariableName:G.variableName,Callee:G.operatorKeyword,Unit:G.unit,"UniversalSelector NestingSelector":G.definitionOperator,"MatchOp CompareOp":G.compareOperator,"ChildOp SiblingOp, LogicOp":G.logicOperator,BinOp:G.arithmeticOperator,Important:G.modifier,Comment:G.blockComment,ColorLiteral:G.color,"ParenthesizedContent StringLiteral":G.string,":":G.punctuation,"PseudoOp #":G.derefOperator,"; , |":G.separator,"( )":G.paren,"[ ]":G.squareBracket,"{ }":G.brace}),Dct={__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},Pct={__proto__:null,or:104,and:104,not:112,only:112,layer:206},Mct={__proto__:null,selector:118,style:124,layer:202},Lct={__proto__:null,"@import":198,"@media":210,"@charset":214,"@namespace":218,"@keyframes":224,"@supports":236,"@scope":240,"@font-feature-values":246},$ct={__proto__:null,to:243},Bct=ef.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:[jct,Rct,Cct,Nct,1,2,3,4,new d_("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=>Dct[e]||-1},{term:148,get:e=>Pct[e]||-1},{term:4,get:e=>Mct[e]||-1},{term:28,get:e=>Lct[e]||-1},{term:146,get:e=>$ct[e]||-1}],tokenPrec:2405});let PI=null;function MI(){if(!PI&&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)));PI=t.sort().map(r=>({type:"property",label:r,apply:r+": "}))}return PI||[]}const EG=["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})),kG=["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}))),Qct=["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})),Fct=["@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})),td=/^(\w[\w-]*|-\w[\w-]*|)$/,Uct=/^-(-[\w-]*)?$/;function zct(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 TG=new A8,Vct=["Declaration"];function qct(e){for(let t=e;;){if(t.type.isTop)return t;if(!(t=t.parent))return e}}function Wme(e,t,n){if(t.to-t.from>4096){let r=TG.get(t);if(r)return r;let i=[],s=new Set,a=t.cursor(Ar.IncludeAnonymous);if(a.firstChild())do for(let l of Wme(e,a.node,n))s.has(l.label)||(s.add(l.label),i.push(l));while(a.nextSibling());return TG.set(t,i),i}else{let r=[],i=new Set;return t.cursor().iterate(s=>{var a;if(n(s)&&s.matchContext(Vct)&&((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 Hct=e=>t=>{let{state:n,pos:r}=t,i=Yr(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:MI(),validFor:td};if(i.name=="ValueName")return{from:i.from,options:kG,validFor:td};if(i.name=="PseudoClassName")return{from:i.from,options:EG,validFor:td};if(e(i)||(t.explicit||s)&&zct(i,n.doc))return{from:e(i)||s?i.from:r,options:Wme(n.doc,qct(i),e),validFor:Uct};if(i.name=="TagName"){for(let{parent:c}=i;c;c=c.parent)if(c.name=="Block")return{from:i.from,options:MI(),validFor:td};return{from:i.from,options:Qct,validFor:td}}if(i.name=="AtKeyword")return{from:i.from,options:Fct,validFor:td};if(!t.explicit)return null;let a=i.resolve(r),l=a.childBefore(r);return l&&l.name==":"&&a.name=="PseudoClassSelector"?{from:r,options:EG,validFor:td}:l&&l.name==":"&&a.name=="Declaration"||a.name=="ArgList"?{from:r,options:kG,validFor:td}:a.name=="Block"||a.name=="Styles"?{from:r,options:MI(),validFor:td}:null},Xct=Hct(e=>e.name=="VariableName"),b_=Jd.define({name:"css",parser:Bct.configure({props:[pf.add({Declaration:nb()}),mf.add({"Block KeyframeList":Iw})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function Gct(){return new Xh(b_,b_.data.of({autocomplete:Xct}))}const Py=["_blank","_self","_top","_parent"],LI=["ascii","utf-8","utf-16","latin1","latin1"],$I=["get","post","put","delete"],BI=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Do=["true","false"],Ft={},Yct={a:{attrs:{href:null,ping:null,type:null,media:null,target:Py,hreflang:null}},abbr:Ft,address:Ft,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Ft,aside:Ft,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Ft,base:{attrs:{href:null,target:Py}},bdi:Ft,bdo:Ft,blockquote:{attrs:{cite:null}},body:Ft,br:Ft,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:BI,formmethod:$I,formnovalidate:["novalidate"],formtarget:Py,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Ft,center:Ft,cite:Ft,code:Ft,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:Ft,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Ft,div:Ft,dl:Ft,dt:Ft,em:Ft,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Ft,figure:Ft,footer:Ft,form:{attrs:{action:null,name:null,"accept-charset":LI,autocomplete:["on","off"],enctype:BI,method:$I,novalidate:["novalidate"],target:Py}},h1:Ft,h2:Ft,h3:Ft,h4:Ft,h5:Ft,h6:Ft,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Ft,hgroup:Ft,hr:Ft,html:{attrs:{manifest:null}},i:Ft,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:BI,formmethod:$I,formnovalidate:["novalidate"],formtarget:Py,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:Ft,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Ft,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:Ft,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:LI,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:Ft,noscript:Ft,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:Ft,param:{attrs:{name:null,value:null}},pre:Ft,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Ft,rt:Ft,ruby:Ft,samp:Ft,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:LI}},section:Ft,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Ft,source:{attrs:{src:null,type:null,media:null}},span:Ft,strong:Ft,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Ft,summary:Ft,sup:Ft,table:Ft,tbody:Ft,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Ft,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:Ft,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Ft,time:{attrs:{datetime:null}},title:Ft,tr:Ft,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Ft,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:Ft},Zme={accesskey:null,class:null,contenteditable:Do,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:Do,autocorrect:Do,autocapitalize:Do,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":Do,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Do,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Do,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Do,"aria-hidden":Do,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Do,"aria-multiselectable":Do,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Do,"aria-relevant":null,"aria-required":Do,"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},Kme="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 Kme)Zme[e]=null;class kv{constructor(t,n){this.tags={...Yct,...t},this.globalAttrs={...Zme,...n},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}kv.default=new kv;function Wb(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 Zb(e,t=!1){for(;e;e=e.parent)if(e.name=="Element")if(t)t=!1;else return e;return null}function Jme(e,t,n){let r=n.tags[Wb(e,Zb(t))];return(r==null?void 0:r.children)||n.allTags}function O9(e,t){let n=[];for(let r=Zb(t);r&&!r.type.isTop;r=Zb(r.parent)){let i=Wb(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 ege=/^[:\-\.\w\u00b7-\uffff]*$/;function _G(e,t,n,r,i){let s=/\s*>/.test(e.sliceDoc(i,i+5))?"":">",a=Zb(n,n.name=="StartTag"||n.name=="TagName");return{from:r,to:i,options:Jme(e.doc,a,t).map(l=>({label:l,type:"type"})).concat(O9(e.doc,n).map((l,c)=>({label:"/"+l,apply:"/"+l+s,type:"type",boost:99-c}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function AG(e,t,n,r){let i=/\s*>/.test(e.sliceDoc(r,r+5))?"":">";return{from:n,to:r,options:O9(e.doc,t).map((s,a)=>({label:s,apply:s+i,type:"type",boost:99-a})),validFor:ege}}function Wct(e,t,n,r){let i=[],s=0;for(let a of Jme(e.doc,n,t))i.push({label:"<"+a,type:"type"});for(let a of O9(e.doc,n))i.push({label:"",type:"type",boost:99-s++});return{from:r,to:r,options:i,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function Zct(e,t,n,r,i){let s=Zb(n),a=s?t.tags[Wb(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:ege}}function Kct(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=Zb(n),h=f?t.tags[Wb(e.doc,f)]:null;d=(h==null?void 0:h.attrs)&&h.attrs[u]}if(d){let f=e.sliceDoc(r,i).toLowerCase(),h='"',p='"';/^['"]/.test(f)?(c=f[0]=='"'?/^[^"]*$/:/^[^']*$/,h="",p=e.sliceDoc(i,i+1)==f[0]?"":f[0],f=f.slice(1),r++):c=/^[^\s<>='"]*$/;for(let b of d)l.push({label:b,apply:h+b+p,type:"constant"})}}return{from:r,to:i,options:l,validFor:c}}function tge(e,t){let{state:n,pos:r}=t,i=Yr(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.fromtge(r,i)}const tut=Eu.parser.configure({top:"SingleExpression"}),nge=[{tag:"script",attrs:e=>e.type=="text/typescript"||e.lang=="ts",parser:cme.parser},{tag:"script",attrs:e=>e.type=="text/babel"||e.type=="text/jsx",parser:ume.parser},{tag:"script",attrs:e=>e.type=="text/typescript-jsx",parser:dme.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:tut},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:Eu.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:b_.parser}],rge=[{name:"style",parser:b_.parser.configure({top:"Styles"})}].concat(Kme.map(e=>({name:e,parser:Eu.parser}))),ige=Jd.define({name:"html",parser:fct.configure({props:[pf.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:"-_"}}),oT=ige.configure({wrap:qme(nge,rge)});function nut(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=qme((e.nestedLanguages||[]).concat(nge),(e.nestedAttributes||[]).concat(rge)));let r=n?ige.configure({wrap:n,dialect:t}):t?oT.configure({dialect:t}):oT;return new Xh(r,[oT.data.of({autocomplete:eut(e)}),e.autoCloseTags!==!1?rut:[],N3().support,Gct().support])}const CG=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),rut=pt.inputHandler.of((e,t,n,r,i)=>{if(e.composing||e.state.readOnly||t!=n||r!=">"&&r!="/"||!oT.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:p}=c,b=Yr(a).resolveInner(p,-1),g;if(h&&r==">"&&b.name=="EndTag"){let O=b.parent;if(((d=(u=O.parent)===null||u===void 0?void 0:u.lastChild)===null||d===void 0?void 0:d.name)!="CloseTag"&&(g=Wb(a.doc,O.parent,p))&&!CG.has(g)){let y=p+(a.doc.sliceString(p,p+1)===">"?1:0),v=``;return{range:c,changes:{from:p,to:y,insert:v}}}}else if(h&&r=="/"&&b.name=="IncompleteCloseTag"){let O=b.parent;if(b.from==p-2&&((f=O.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(g=Wb(a.doc,O,p))&&!CG.has(g)){let y=p+(a.doc.sliceString(p,p+1)===">"?1:0),v=`${g}>`;return{range:Fe.cursor(p+v.length,-1),changes:{from:p,to:y,insert:v}}}}return{range:c}});return l.changes.empty?!1:(e.dispatch([s,a.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),sge=PC({commentTokens:{block:{open:""}}}),age=new dn,oge=plt.configure({props:[mf.add(e=>!e.is("Block")||e.is("Document")||L3(e)!=null||iut(e)?void 0:(t,n)=>({from:n.doc.lineAt(t.from).to,to:t.to})),age.add(L3),pf.add({Document:()=>null}),lh.add({Document:sge})]});function L3(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function iut(e){return e.name=="OrderedList"||e.name=="BulletList"}function sut(e,t){let n=e;for(;;){let r=n.nextSibling,i;if(!r||(i=L3(r.type))!=null&&i<=t)break;n=r}return n.to}const aut=Tpe.of((e,t,n)=>{for(let r=Yr(e).resolveInner(n,-1);r&&!(r.fromn)return{from:n,to:s}}return null});function y9(e){return new Wo(sge,e,[],"markdown")}const out=y9(oge),lut=oge.configure([klt,_lt,Tlt,Alt,{props:[mf.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]),O_=y9(lut);function cut(e,t){return n=>{if(n&&e){let r=null;if(n=/\S*/.exec(n)[0],typeof e=="function"?r=e(n):r=a_.matchLanguageName(e,n,!0),r instanceof a_)return r.support?r.support.language.parser:Mm.getSkippingParser(r.load());if(r)return r.parser}return t?t.parser:null}}let QI=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(+cge(this.item,t)[2]+n):"";return this.spaceBefore+r+this.type+this.spaceAfter}};function lge(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 QI(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 QI(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 QI(s.parent,c,c+d,a[1],u,f,s))}}return r}function cge(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function FI(e,t,n,r=0){for(let i=-1,s=e;;){if(s.name=="ListItem"){let l=cge(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 x9(e,t){let n=/^[ \t]*/.exec(e)[0].length;if(!n||t.facet(FO)!=" ")return e;let r=_c(e,4,n),i="";for(let s=r;s>0;)s>=4?(i+=" ",s-=4):(i+=" ",s--);return i+e.slice(n)}const uut=(e={})=>({state:t,dispatch:n})=>{let r=Yr(t),{doc:i}=t,s=null,a=t.changeByRange(l=>{if(!l.empty||!O_.isActiveAt(t,l.from,-1)&&!O_.isActiveAt(t,l.from,1))return s={range:l};let c=l.from,u=i.lineAt(c),d=lge(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 y=f.node.firstChild,v=f.node.getChild("ListItem","ListItem");if(y.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"&&FI(f.item,i,E,-2),x&&x.node.name=="OrderedList"&&FI(x.item,i,E),{range:Fe.cursor(w+S.length),changes:E}}else{let x=jG(d,t,u);return{range:Fe.cursor(c+x.length+1),changes:{from:u.from,insert:x+t.lineBreak}}}}if(f.node.name=="Blockquote"&&h&&u.from){let y=i.lineAt(u.from-1),v=/>\s*$/.exec(y.text);if(v&&v.index==f.from){let x=t.changes([{from:y.from+v.index,to:y.to},{from:u.from+f.from,to:u.to}]);return{range:l.map(x),changes:x}}}let p=[];f.node.name=="OrderedList"&&FI(f.item,i,p);let b=f.item&&f.item.from]*/.exec(u.text)[0].length>=f.to)for(let y=0,v=d.length-1;y<=v;y++)g+=y==v&&!b?d[y].marker(i,1):d[y].blank(yu.from&&/\s/.test(u.text.charAt(O-u.from-1));)O--;return g=x9(g,t),fut(f.node,t.doc)&&(g=jG(d,t,u)+t.lineBreak+g),p.push({from:O,to:c,insert:t.lineBreak+g}),{range:Fe.cursor(O+g.length+1),changes:p}});return s?!1:(n(t.update(a,{scrollIntoView:!0,userEvent:"input"})),!0)},dut=uut();function NG(e){return e.name=="QuoteMark"||e.name=="ListMark"}function fut(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=Yr(e),r=null,i=e.changeByRange(s=>{let a=s.from,{doc:l}=e;if(s.empty&&O_.isActiveAt(e,s.from)){let c=l.lineAt(a),u=lge(hut(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:Fe.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),!O_.isActiveAt(t.state,r.from,1)))return!1;let s=Yr(t.state),a=!1;return s.iterate({from:r.from,to:r.to,enter:l=>{(l.from>r.from||yut.test(l.name))&&(a=!0)},leave:l=>{l.to=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}const xdt=new ds((e,t)=>{let n;if(e.next<0)e.acceptToken(Eut);else if(t.context.flags&lT)zI(e.next)&&e.acceptToken(Sut,1);else if(((n=e.peek(-1))<0||zI(n))&&t.canShift(RG)){let r=0;for(;e.next==v9||e.next==FC;)e.advance(),r++;(e.next==Bm||e.next==Tv||e.next==w9)&&e.acceptToken(RG,-r)}else zI(e.next)&&e.acceptToken(wut,1)},{contextual:!0}),vdt=new ds((e,t)=>{let n=t.context;if(n.flags)return;let r=e.peek(-1);if(r==Bm||r==Tv){let i=0,s=0;for(;;){if(e.next==v9)i++;else if(e.next==FC)i+=8-i%8;else break;e.advance(),s++}i!=n.indent&&e.next!=Bm&&e.next!=Tv&&e.next!=w9&&(i[e,t|bge])),Edt=new $C({start:wdt,reduce(e,t,n,r){return e.flags&lT&&ydt.has(t)||(t==Fut||t==pge)&&e.flags&bge?e.parent:e},shift(e,t,n,r){return t==dge?new cT(e,Sdt(r.read(r.pos,n.pos)),0):t==fge?e.parent:t==_ut||t==jut||t==Dut||t==hge?new cT(e,0,lT):MG.has(t)?new cT(e,0,MG.get(t)|e.flags&lT):e},hash(e){return e.hash}}),kdt=new ds(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==v9||n==FC)){n!=fdt&&n!=hdt&&n!=Bm&&n!=Tv&&n!=w9&&e.acceptToken(vut);return}}}),Tdt=new ds((e,t)=>{let{flags:n}=t.context,r=n&od?gge:mge,i=(n&ld)>0,s=!(n&cd),a=(n&ud)>0,l=e.pos;for(;!(e.next<0);)if(a&&e.next==$3)if(e.peek(1)==$3)e.advance(2);else{if(e.pos==l){e.acceptToken(hge,1);return}break}else if(s&&e.next==PG){if(e.pos==l){e.advance();let c=e.next;c>=0&&(e.advance(),_dt(e,c)),e.acceptToken(Tut);return}break}else if(e.next==PG&&!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(IG,i?3:1);return}break}else if(e.next==Bm){if(i)e.advance();else if(e.pos==l){e.acceptToken(IG);return}break}else e.advance();e.pos>l&&e.acceptToken(kut)});function _dt(e,t){if(t==pdt)for(let n=0;n<2&&e.next>=48&&e.next<=55;n++)e.advance();else if(t==mdt)for(let n=0;n<2&&VI(e.next);n++)e.advance();else if(t==bdt)for(let n=0;n<4&&VI(e.next);n++)e.advance();else if(t==Odt)for(let n=0;n<8&&VI(e.next);n++)e.advance();else if(t==gdt&&e.next==$3){for(e.advance();e.next>=0&&e.next!=DG&&e.next!=mge&&e.next!=gge&&e.next!=Bm;)e.advance();e.next==DG&&e.advance()}}const Adt=hf({'async "*" "**" FormatConversion FormatSpec':G.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":G.controlKeyword,"in not and or is del":G.operatorKeyword,"from def class global nonlocal lambda":G.definitionKeyword,import:G.moduleKeyword,"with as print":G.keyword,Boolean:G.bool,None:G.null,VariableName:G.variableName,"CallExpression/VariableName":G.function(G.variableName),"FunctionDefinition/VariableName":G.function(G.definition(G.variableName)),"ClassDefinition/VariableName":G.definition(G.className),PropertyName:G.propertyName,"CallExpression/MemberExpression/PropertyName":G.function(G.propertyName),Comment:G.lineComment,Number:G.number,String:G.string,FormatString:G.special(G.string),Escape:G.escape,UpdateOp:G.updateOperator,"ArithOp!":G.arithmeticOperator,BitOp:G.bitwiseOperator,CompareOp:G.compareOperator,AssignOp:G.definitionOperator,Ellipsis:G.punctuation,At:G.meta,"( )":G.paren,"[ ]":G.squareBracket,"{ }":G.brace,".":G.derefOperator,", ;":G.separator}),Cdt={__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},Ndt=ef.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:[kdt,vdt,xdt,Tdt,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:e=>Cdt[e]||-1}],tokenPrec:7668}),LG=new A8,Oge=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function HE(e){return(t,n,r)=>{if(r)return!1;let i=t.node.getChild("VariableName");return i&&n(i,e),!0}}const jdt={FunctionDefinition:HE("function"),ClassDefinition:HE("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:HE("variable"),AsPattern:HE("variable"),__proto__:null};function yge(e,t){let n=LG.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(Ar.IncludeAnonymous).iterate(a=>{if(a.name){let l=jdt[a.name];if(l&&l(a,s,i)||!i&&Oge.has(a.name))return!1;i=!1}else if(a.to-a.from>8192){for(let l of yge(e,a.node))r.push(l);return!1}}),LG.set(t,r),r}const $G=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,xge=["String","FormatString","Comment","PropertyName"];function Rdt(e){let t=Yr(e.state).resolveInner(e.pos,-1);if(xge.indexOf(t.name)>-1)return null;let n=t.name=="VariableName"||t.to-t.from<20&&$G.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let r=[];for(let i=t;i;i=i.parent)Oge.has(i.name)&&(r=r.concat(yge(e.state.doc,i)));return{options:r,from:n?t.from:e.pos,validFor:$G}}const Idt=["__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"}))),Ddt=[$i("def ${name}(${params}):\n ${}",{label:"def",detail:"function",type:"keyword"}),$i("for ${name} in ${collection}:\n ${}",{label:"for",detail:"loop",type:"keyword"}),$i("while ${}:\n ${}",{label:"while",detail:"loop",type:"keyword"}),$i("try:\n ${}\nexcept ${error}:\n ${}",{label:"try",detail:"/ except block",type:"keyword"}),$i(`if \${}: -`,{label:"if",detail:"block",type:"keyword"}),$i("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),$i("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),$i("import ${module}",{label:"import",detail:"statement",type:"keyword"}),$i("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],Idt=Hpe(Oge,J8(jdt.concat(Rdt)));function zI(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 VI(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 qI=Jd.define({name:"python",parser:Adt.configure({props:[pf.add({Body:e=>{var t;let n=/^\s*(#|$)/.test(e.textAfter)&&zI(e)||e.node;return(t=VI(e,n))!==null&&t!==void 0?t:e.continue()},MatchBody:e=>{var t;let n=zI(e);return(t=VI(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":eb({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":eb({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":eb({closing:"]"}),MemberExpression:e=>e.baseIndent+e.unit,"String FormatString":()=>null,Script:e=>{var t;let n=zI(e);return(t=n&&VI(e,n))!==null&&t!==void 0?t:e.continue()}}),mf.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":Rw,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 Ddt(){return new Xh(qI,[qI.data.of({autocomplete:Ndt}),qI.data.of({autocomplete:Idt})])}const Kg=63,LG=64,Pdt=1,Mdt=2,yge=3,Ldt=4,xge=5,$dt=6,Bdt=7,vge=65,Qdt=66,Fdt=8,Udt=9,zdt=10,Vdt=11,qdt=12,wge=13,Hdt=19,Xdt=20,Gdt=29,Ydt=33,Wdt=34,Zdt=47,Kdt=0,v9=1,L3=2,Tv=3,$3=4;class Fp{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}}Fp.top=new Fp(null,-1,Kdt);function sx(e,t){for(let n=0,r=t-e.pos-1;;r--,n++){let i=e.peek(r);if(tf(i)||i==-1)return n}}function B3(e){return e==32||e==9}function tf(e){return e==10||e==13}function Sge(e){return B3(e)||tf(e)}function Jp(e){return e<0||Sge(e)}const Jdt=new MC({start:Fp.top,reduce(e,t){return e.type==Tv&&(t==Xdt||t==Wdt)?e.parent:e},shift(e,t,n,r){if(t==yge)return new Fp(e,sx(r,r.pos),v9);if(t==vge||t==xge)return new Fp(e,sx(r,r.pos),L3);if(t==Kg)return e.parent;if(t==Hdt||t==Ydt)return new Fp(e,0,Tv);if(t==wge&&e.type==$3)return e.parent;if(t==Zdt){let i=/[1-9]/.exec(r.read(r.pos,n.pos));if(i)return new Fp(e,e.depth+ +i[0],$3)}return e},hash(e){return e.hash}});function Zb(e,t,n=0){return e.peek(n)==t&&e.peek(n+1)==t&&e.peek(n+2)==t&&Jp(e.peek(n+3))}const eft=new ds((e,t)=>{if(e.next==-1&&t.canShift(LG))return e.acceptToken(LG);let n=e.peek(-1);if((tf(n)||n<0)&&t.context.type!=Tv){if(Zb(e,45))if(t.canShift(Kg))e.acceptToken(Kg);else return e.acceptToken(Pdt,3);if(Zb(e,46))if(t.canShift(Kg))e.acceptToken(Kg);else return e.acceptToken(Mdt,3);let r=0;for(;e.next==32;)r++,e.advance();(r{if(t.context.type==Tv){e.next==63&&(e.advance(),Jp(e.next)&&e.acceptToken(Bdt));return}if(e.next==45)e.advance(),Jp(e.next)&&e.acceptToken(t.context.type==v9&&t.context.depth==sx(e,e.pos-1)?Ldt:yge);else if(e.next==63)e.advance(),Jp(e.next)&&e.acceptToken(t.context.type==L3&&t.context.depth==sx(e,e.pos-1)?$dt:xge);else{let n=e.pos;for(;;)if(B3(e.next)){if(e.pos==n)return;e.advance()}else if(e.next==33)Ege(e);else if(e.next==38)Q3(e);else if(e.next==42){Q3(e);break}else if(e.next==39||e.next==34){if(w9(e,!0))break;return}else if(e.next==91||e.next==123){if(!rft(e))return;break}else{kge(e,!0,!1,0);break}for(;B3(e.next);)e.advance();if(e.next==58){if(e.pos==n&&t.canShift(Gdt))return;let r=e.peek(1);Jp(r)&&e.acceptTokenTo(t.context.type==L3&&t.context.depth==sx(e,n)?Qdt:vge,n)}}},{contextual:!0});function nft(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 $G(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function BG(e,t){return e.next==37?(e.advance(),$G(e.next)&&e.advance(),$G(e.next)&&e.advance(),!0):nft(e.next)||t&&e.next==44?(e.advance(),!0):!1}function Ege(e){if(e.advance(),e.next==60){for(e.advance();;)if(!BG(e,!0)){e.next==62&&e.advance();break}}else for(;BG(e,!1););}function Q3(e){for(e.advance();!Jp(e.next)&&b_(e.next)!="f";)e.advance()}function w9(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(tf(s)){if(t)return!1;r=!0}else if(t&&e.pos>=i+1024)return!1}return!r}function rft(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(!w9(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||tf(e.next))return!1;e.advance()}}const ift="iiisiiissisfissssssssssssisssiiissssssssssssssssssssssssssfsfssissssssssssssssssssssssssssfif";function b_(e){return e<33?"u":e>125?"s":ift[e-33]}function HI(e,t){let n=b_(e);return n!="u"&&!(t&&n=="f")}function kge(e,t,n,r){if(b_(e.next)=="s"||(e.next==63||e.next==58||e.next==45)&&HI(e.peek(1),n))e.advance();else return!1;let i=e.pos;for(;;){let s=e.next,a=0,l=r+1;for(;Sge(s);){if(tf(s)){if(t)return!1;l=0}else l++;s=e.peek(++a)}if(!(s>=0&&(s==58?HI(e.peek(a+1),n):s==35?e.peek(a-1)!=32:HI(s,n)))||!n&&l<=r||l==0&&!n&&(Zb(e,45,a)||Zb(e,46,a)))break;if(t&&b_(s)=="f")return!1;for(let u=a;u>=0;u--)e.advance();if(t&&e.pos>i+1024)return!1}return!0}const sft=new ds((e,t)=>{if(e.next==33)Ege(e),e.acceptToken(qdt);else if(e.next==38||e.next==42){let n=e.next==38?zdt:Vdt;Q3(e),e.acceptToken(n)}else e.next==39||e.next==34?(w9(e,!1),e.acceptToken(Udt)):kge(e,!1,t.context.type==Tv,t.context.depth)&&e.acceptToken(Fdt)}),aft=new ds((e,t)=>{let n=t.context.type==$3?t.context.depth:-1,r=e.pos;e:for(;;){let i=0,s=e.next;for(;s==32;)s=e.peek(++i);if(!i&&(Zb(e,45,i)||Zb(e,46,i))||!tf(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:Jdt,nodeProps:[["isolate",-3,8,9,14,""],["openedBy",18,"[",32,"{"],["closedBy",19,"]",33,"}"]],propSources:[oft],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:[eft,tft,sft,aft,0,1],topRules:{Stream:[0,15]},tokenPrec:0}),cft=Jd.define({name:"yaml",parser:lft.configure({props:[pf.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:eb({closing:"}"}),FlowSequence:eb({closing:"]"})}),mf.add({"FlowMapping FlowSequence":Rw,"Item Pair BlockLiteral":(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}),languageData:{commentTokens:{line:"#"},indentOnInput:/^\s*[\]\}]$/}});function uft(){return new Xh(cft)}function dft(e){Tge(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=E9(e.state,n.from);return r.line?_ft(e):r.block?Cft(e):!1};function S9(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 _ft=S9(Rft,0),Aft=S9(jge,0),Cft=S9((e,t)=>jge(e,t,jft(t)),0);function E9(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const Py=50;function Nft(e,{open:t,close:n},r,i){let s=e.sliceDoc(r-Py,r),a=e.sliceDoc(i,i+Py),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*Py?d=f=e.sliceDoc(r,i):(d=e.sliceDoc(r,r+Py),f=e.sliceDoc(i-Py,i));let h=/^\s*/.exec(d)[0].length,p=/\s*$/.exec(f)[0].length,b=f.length-p-n.length;return d.slice(h,h+t.length)==t&&f.slice(b,b+n.length)==n?{open:{pos:r+h+t.length,margin:/\s/.test(d.charAt(h+t.length))?1:0},close:{pos:i-p-n.length,margin:/\s/.test(f.charAt(b-1))?1:0}}:null}function jft(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 jge(e,t,n=t.selection.ranges){let r=n.map(s=>E9(t,s.from).block);if(!r.every(s=>s))return null;let i=n.map((s,a)=>Nft(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,p=h==f.length,b=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 U3=Lu.define(),Ift=Lu.define(),Dft=kt.define(),Rge=kt.define({combine(e){return $u(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)})}}),Ige=ma.define({create(){return bu.empty},update(e,t){let n=t.state.facet(Rge),r=t.annotation(U3);if(r){let c=mo.fromTransaction(t,r.selection),u=r.side,d=u==0?e.undone:e.done;return c?d=O_(d,d.length,n.minDepth,c):d=Mge(d,t.startState.selection),new bu(u==0?r.rest:d,u==0?d:r.rest)}let i=t.annotation(Ift);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=mo.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 bu(e.done.map(mo.fromJSON),e.undone.map(mo.fromJSON))}});function Pft(e={}){return[Ige,Rge.of(e),pt.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?Dge:t.inputType=="historyRedo"?z3:null;return r?(t.preventDefault(),r(n)):!1}})]}function QC(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(Ige,!1);if(!i)return!1;let s=i.pop(e,n,t);return s?(r(s),!0):!1}}const Dge=QC(0,!1),z3=QC(1,!1),Mft=QC(0,!0),Lft=QC(1,!0);class mo{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 mo(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 mo(t.changes&&js.fromJSON(t.changes),[],t.mapped&&Su.fromJSON(t.mapped),t.startSelection&&Fe.fromJSON(t.startSelection),t.selectionsAfter.map(Fe.fromJSON))}static fromTransaction(t,n){let r=Ml;for(let i of t.startState.facet(Dft)){let s=i(t);s.length&&(r=r.concat(s))}return!r.length&&t.changes.empty?null:new mo(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,Ml)}static selection(t){return new mo(void 0,Ml,void 0,void 0,t)}}function O_(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 $ft(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 Bft(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function Pge(e,t){return e.length?t.length?e.concat(t):e:t}const Ml=[],Qft=200;function Mge(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Qft));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),O_(e,e.length-1,1e9,n.setSelAfter(r)))}else return[mo.selection([t])]}function Fft(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 XI(e,t){if(!e.length)return e;let n=e.length,r=Ml;for(;n;){let i=Uft(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?[mo.selection(r)]:Ml}function Uft(e,t,n){let r=Pge(e.selectionsAfter.length?e.selectionsAfter.map(l=>l.map(t)):Ml,n);if(!e.changes)return mo.selection(r);let i=e.changes.map(t),s=t.mapDesc(e.changes,!0),a=e.mapped?e.mapped.composeDesc(s):s;return new mo(i,mn.mapEffects(e.effects,t),a,e.startSelection.map(s),r)}const zft=/^(input\.type|delete)($|\.)/;class bu{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 bu(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||zft.test(r))&&(!l.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?e.moveByChar(n,t):FC(n,t))}function Ra(e){return e.textDirectionAt(e.state.selection.main.head)==ti.LTR}const $ge=e=>Lge(e,!Ra(e)),Bge=e=>Lge(e,Ra(e));function Qge(e,t){return Lc(e,n=>n.empty?e.moveByGroup(n,t):FC(n,t))}const qft=e=>Qge(e,!Ra(e)),Hft=e=>Qge(e,Ra(e));function Xft(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 UC(e,t,n){let r=Yr(e).resolveInner(t.head),i=n?dn.closedBy:dn.openedBy;for(let c=t.head;;){let u=n?r.childAfter(c):r.childBefore(c);if(!u)break;Xft(e,u,i)?r=u:c=n?u.to:u.from}let s=r.type.prop(i),a,l;return s&&(a=n?gu(e,r.from,1):gu(e,r.to,-1))&&a.matched?l=n?a.end.to:a.end.from:l=n?r.to:r.from,Fe.cursor(l,n?-1:1)}const Gft=e=>Lc(e,t=>UC(e.state,t,!Ra(e))),Yft=e=>Lc(e,t=>UC(e.state,t,Ra(e)));function Fge(e,t){return Lc(e,n=>{if(!n.empty)return FC(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const Uge=e=>Fge(e,!1),zge=e=>Fge(e,!0);function Vge(e){let t=e.scrollDOM.clientHeighta.empty?e.moveVertically(a,t,n.height):FC(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.bottomqge(e,!1),V3=e=>qge(e,!0);function rp(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=Fe.cursor(r.from+s))}return i}const Wft=e=>Lc(e,t=>rp(e,t,!0)),Zft=e=>Lc(e,t=>rp(e,t,!1)),Kft=e=>Lc(e,t=>rp(e,t,!Ra(e))),Jft=e=>Lc(e,t=>rp(e,t,Ra(e))),eht=e=>Lc(e,t=>Fe.cursor(e.lineBlockAt(t.head).from,1)),tht=e=>Lc(e,t=>Fe.cursor(e.lineBlockAt(t.head).to,-1));function nht(e,t,n){let r=!1,i=UO(e.selection,s=>{let a=gu(e,s.head,-1)||gu(e,s.head,1)||s.head>0&&gu(e,s.head-1,1)||s.headnht(e,t);function Yl(e,t,n){let r=UO(e.state.selection,i=>{i.undirectional&&i.head>=i.anchor!=t&&(i=Fe.range(i.head,i.anchor));let s=n(i);return Fe.range(i.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return r.eq(e.state.selection)?!1:(e.dispatch(Mc(e.state,r)),!0)}function Hge(e,t){return Yl(e,t,n=>e.moveByChar(n,t))}const Xge=e=>Hge(e,!Ra(e)),Gge=e=>Hge(e,Ra(e));function Yge(e,t){return Yl(e,t,n=>e.moveByGroup(n,t))}const iht=e=>Yge(e,!Ra(e)),sht=e=>Yge(e,Ra(e)),aht=e=>{let t=!Ra(e);return Yl(e,t,n=>UC(e.state,n,t))},oht=e=>{let t=Ra(e);return Yl(e,t,n=>UC(e.state,n,t))};function Wge(e,t){return Yl(e,t,n=>e.moveVertically(n,t))}const Zge=e=>Wge(e,!1),Kge=e=>Wge(e,!0);function Jge(e,t){return Yl(e,t,n=>e.moveVertically(n,t,Vge(e).height))}const FG=e=>Jge(e,!1),UG=e=>Jge(e,!0),lht=e=>Yl(e,!0,t=>rp(e,t,!0)),cht=e=>Yl(e,!1,t=>rp(e,t,!1)),uht=e=>{let t=!Ra(e);return Yl(e,t,n=>rp(e,n,t))},dht=e=>{let t=Ra(e);return Yl(e,t,n=>rp(e,n,t))},fht=e=>Yl(e,!1,t=>Fe.cursor(e.lineBlockAt(t.head).from)),hht=e=>Yl(e,!0,t=>Fe.cursor(e.lineBlockAt(t.head).to)),zG=({state:e,dispatch:t})=>(t(Mc(e,{anchor:0})),!0),VG=({state:e,dispatch:t})=>(t(Mc(e,{anchor:e.doc.length})),!0),qG=({state:e,dispatch:t})=>(t(Mc(e,{anchor:e.selection.main.anchor,head:0})),!0),HG=({state:e,dispatch:t})=>(t(Mc(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),pht=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),mht=({state:e,dispatch:t})=>{let n=zC(e).map(({from:r,to:i})=>Fe.range(r,Math.min(i+1,e.doc.length)));return t(e.update({selection:Fe.create(n),userEvent:"select"})),!0},ght=({state:e,dispatch:t})=>{let n=UO(e.selection,r=>{let i=Yr(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 Fe.range(l.to,l.from)}return r});return n.eq(e.selection)?!1:(t(Mc(e,n)),!0)};function e0e(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(Mc(n,Fe.create(i,i.length-1))),!0)}const bht=e=>e0e(e,!1),Oht=e=>e0e(e,!0),yht=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=Fe.create([n.main]):n.main.empty||(r=Fe.create([Fe.cursor(n.main.head)])),r?(t(Mc(e,r)),!0):!1};function Mw(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=XE(e,c,!0)),a=Math.min(a,c),l=Math.max(l,c)}else a=XE(e,a,!1),l=XE(e,l,!0);return a==l?{range:s}:{changes:{from:a,to:l},range:Fe.cursor(a,ai(e)))r.between(t,t,(i,s)=>{it&&(t=n?s:i)});return t}const t0e=(e,t,n)=>Mw(e,r=>{let i=r.from,{state:s}=e,a=s.doc.lineAt(i),l,c;if(n&&!t&&i>a.from&&it0e(e,!1,!0),n0e=e=>t0e(e,!0,!1),r0e=(e,t)=>Mw(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=Gs(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}),i0e=e=>r0e(e,!1),xht=e=>r0e(e,!0),vht=e=>Mw(e,t=>{let n=e.lineBlockAt(t.head).to;return t.headMw(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),Sht=e=>Mw(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:Tr.of(["",""])},range:Fe.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},kht=({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:Gs(s.text,i-s.from,!1)+s.from,l=i==s.to?i+1:Gs(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:Fe.cursor(l)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function zC(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 s0e(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let s of zC(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(Fe.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(Fe.range(c.anchor-l,c.head-l))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:Fe.create(i,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Tht=({state:e,dispatch:t})=>s0e(e,t,!1),_ht=({state:e,dispatch:t})=>s0e(e,t,!0);function a0e(e,t,n){if(e.readOnly)return!1;let r=[];for(let s of zC(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 Aht=({state:e,dispatch:t})=>a0e(e,t,!1),Cht=({state:e,dispatch:t})=>a0e(e,t,!0),Nht=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(zC(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 jht(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=Yr(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(dn.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 XG=o0e(!1),Rht=o0e(!0);function o0e(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&&jht(t,s);e&&(s=a=(a<=l.to?l:t.doc.lineAt(a)).to);let u=new DC(t,{simulateBreak:s,simulateDoubleBreak:!!c}),d=X8(u,s);for(d==null&&(d=_c(/^\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:Fe.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const Iht=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new DC(e,{overrideIndentation:s=>{let a=n[s];return a??-1}}),i=k9(e,(s,a,l)=>{let c=X8(r,s.from);if(c==null)return;/\S/.test(s.text)||(c=0);let u=/^\s*/.exec(s.text)[0],d=gv(e,c);(u!=d||l.frome.readOnly?!1:(t(e.update(k9(e,(n,r)=>{r.push({from:n.from,insert:e.facet(QO)})}),{userEvent:"input.indent"})),!0),c0e=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(k9(e,(n,r)=>{let i=/^\s*/.exec(n.text)[0];if(!i)return;let s=_c(i,e.tabSize),a=0,l=gv(e,Math.max(0,s-Mm(e)));for(;a(e.setTabFocusMode(),!0),Pht=[{key:"Ctrl-b",run:$ge,shift:Xge,preventDefault:!0},{key:"Ctrl-f",run:Bge,shift:Gge},{key:"Ctrl-p",run:Uge,shift:Zge},{key:"Ctrl-n",run:zge,shift:Kge},{key:"Ctrl-a",run:eht,shift:fht},{key:"Ctrl-e",run:tht,shift:hht},{key:"Ctrl-d",run:n0e},{key:"Ctrl-h",run:q3},{key:"Ctrl-k",run:vht},{key:"Ctrl-Alt-h",run:i0e},{key:"Ctrl-o",run:Eht},{key:"Ctrl-t",run:kht},{key:"Ctrl-v",run:V3}],Mht=[{key:"ArrowLeft",run:$ge,shift:Xge,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:qft,shift:iht,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Kft,shift:uht,preventDefault:!0},{key:"ArrowRight",run:Bge,shift:Gge,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Hft,shift:sht,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Jft,shift:dht,preventDefault:!0},{key:"ArrowUp",run:Uge,shift:Zge,preventDefault:!0},{mac:"Cmd-ArrowUp",run:zG,shift:qG},{mac:"Ctrl-ArrowUp",run:QG,shift:FG},{key:"ArrowDown",run:zge,shift:Kge,preventDefault:!0},{mac:"Cmd-ArrowDown",run:VG,shift:HG},{mac:"Ctrl-ArrowDown",run:V3,shift:UG},{key:"PageUp",run:QG,shift:FG},{key:"PageDown",run:V3,shift:UG},{key:"Home",run:Zft,shift:cht,preventDefault:!0},{key:"Mod-Home",run:zG,shift:qG},{key:"End",run:Wft,shift:lht,preventDefault:!0},{key:"Mod-End",run:VG,shift:HG},{key:"Enter",run:XG,shift:XG},{key:"Mod-a",run:pht},{key:"Backspace",run:q3,shift:q3,preventDefault:!0},{key:"Delete",run:n0e,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:i0e,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:xht,preventDefault:!0},{mac:"Mod-Backspace",run:wht,preventDefault:!0},{mac:"Mod-Delete",run:Sht,preventDefault:!0}].concat(Pht.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),Lht=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Gft,shift:aht},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Yft,shift:oht},{key:"Alt-ArrowUp",run:Tht},{key:"Shift-Alt-ArrowUp",run:Aht},{key:"Alt-ArrowDown",run:_ht},{key:"Shift-Alt-ArrowDown",run:Cht},{key:"Mod-Alt-ArrowUp",run:bht},{key:"Mod-Alt-ArrowDown",run:Oht},{key:"Escape",run:yht},{key:"Mod-Enter",run:Rht},{key:"Alt-l",mac:"Ctrl-l",run:mht},{key:"Mod-i",run:ght,preventDefault:!0},{key:"Mod-[",run:c0e},{key:"Mod-]",run:l0e},{key:"Mod-Alt-\\",run:Iht},{key:"Shift-Mod-k",run:Nht},{key:"Shift-Mod-\\",run:rht},{key:"Mod-/",run:Tft},{key:"Alt-A",run:Aft},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Dht}].concat(Mht),$ht={key:"Tab",run:l0e,shift:c0e},GG=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class Kb{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(GG(l)):GG,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 lo(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=_8(t),r=this.bufferStart+this.bufferPos;this.bufferPos+=ou(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=y_(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 ib(n,t.sliceString(n,r));return GI.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=y_(this.text,i+(r==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=ib.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(d0e.prototype[Symbol.iterator]=f0e.prototype[Symbol.iterator]=function(){return this});function Bht(e){try{return new RegExp(e,T9),!0}catch{return!1}}function y_(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t=56320&&r<57344;)t++;return t}const Qht=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:i}=Wit(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,p=u?+u:l.number;if(u&&f){let O=p/100;c&&(O=O*(c=="-"?-1:1)+l.number/t.doc.lines),p=Math.round(t.doc.lines*O)}else u&&c&&(p=p*(c=="-"?-1:1)+l.number);let b=t.doc.line(Math.max(1,Math.min(t.doc.lines,p))),g=Fe.cursor(b.from+Math.max(0,Math.min(h,b.length)));e.dispatch({effects:[r,pt.scrollIntoView(g.from,{y:"center"})],selection:g})}),!0},Fht={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Uht=kt.define({combine(e){return $u(e,Fht,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function zht(e){return[Ght,Xht]}const Vht=Vt.mark({class:"cm-selectionMatch"}),qht=Vt.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function YG(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=Ai.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=Ai.Word)}function Hht(e,t,n,r){return e(t.sliceDoc(n,n+1))==Ai.Word&&e(t.sliceDoc(r-1,r))==Ai.Word}const Xht=Ki.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(Uht),{state:n}=e,r=n.selection;if(r.ranges.length>1)return Vt.none;let i=r.main,s,a=null;if(i.empty){if(!t.highlightWordAroundCursor)return Vt.none;let c=n.wordAt(i.head);if(!c)return Vt.none;a=n.charCategorizer(i.head),s=n.sliceDoc(c.from,c.to)}else{let c=i.to-i.from;if(c200)return Vt.none;if(t.wholeWords){if(s=n.sliceDoc(i.from,i.to),a=n.charCategorizer(i.head),!(YG(a,n,i.from,i.to)&&Hht(a,n,i.from,i.to)))return Vt.none}else if(s=n.sliceDoc(i.from,i.to),!s)return Vt.none}let l=[];for(let c of e.visibleRanges){let u=new Kb(n.doc,s,c.from,c.to);for(;!u.next().done;){let{from:d,to:f}=u.value;if((!a||YG(a,n,d,f))&&(i.empty&&d<=i.from&&f>=i.to?l.push(qht.range(d,f)):(d>=i.to||f<=i.from)&&l.push(Vht.range(d,f)),l.length>t.maxMatches))return Vt.none}}return Vt.set(l)}},{decorations:e=>e.decorations}),Ght=pt.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Yht=({state:e,dispatch:t})=>{let{selection:n}=e,r=Fe.create(n.ranges.map(i=>e.wordAt(i.head)||Fe.cursor(i.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function Wht(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 Kb(e.doc,t,r[r.length-1].to);;)if(l.next(),l.done){if(a)return null;l=new Kb(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 Zht=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(s=>s.from===s.to))return Yht({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=Wht(e,r);return i?(t(e.update({selection:e.selection.addRange(Fe.range(i.from,i.to),!1),effects:pt.scrollIntoView(i.to)})),!0):!1},zO=kt.define({combine(e){return $u(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new dpt(t),scrollToMatch:t=>pt.scrollIntoView(t)})}});class h0e{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||Bht(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 rpt(this):new ept(this)}getCursor(t,n=0,r){let i=t.doc?t:nr.create({doc:t});return r==null&&(r=i.doc.length),this.regexp?e0(this,i,n,r):Jg(this,i,n,r)}}class p0e{constructor(t){this.spec=t}}function Kht(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 Jg(e,t,n,r){let i;return e.wholeWord&&(i=Jht(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=Kht(e.test,t,i)),new Kb(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:s=>s.toLowerCase(),i)}function Jht(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=Jg(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 tpt(e,t,n){return(r,i,s)=>(!n||n(r,i,s))&&e(s[0],t,r,i)}function e0(e,t,n,r){let i;return e.wholeWord&&(i=npt(t.charCategorizer(t.selection.main.head))),e.test&&(i=tpt(e.test,t,i)),new d0e(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function x_(e,t){return e.slice(Gs(e,t,!1),t)}function v_(e,t){return e.slice(t,Gs(e,t))}function npt(e){return(t,n,r)=>!r[0].length||(e(x_(r.input,r.index))!=Ai.Word||e(v_(r.input,r.index))!=Ai.Word)&&(e(v_(r.input,r.index+r[0].length))!=Ai.Word||e(x_(r.input,r.index+r[0].length))!=Ai.Word)}class rpt extends p0e{nextMatch(t,n,r){let i=e0(this.spec,t,r,t.doc.length).next();return i.done&&(i=e0(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=e0(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=e0(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 _v=mn.define(),_9=mn.define(),Sh=ma.define({create(e){return new YI(H3(e).create(),null)},update(e,t){for(let n of t.effects)n.is(_v)?e=new YI(n.value.create(),e.panel):n.is(_9)&&(e=new YI(e.query,n.value?A9:null));return e},provide:e=>pv.from(e,t=>t.panel)});class YI{constructor(t,n){this.query=t,this.panel=n}}const ipt=Vt.mark({class:"cm-searchMatch"}),spt=Vt.mark({class:"cm-searchMatch cm-searchMatch-selected"}),apt=Ki.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(Sh))}update(e){let t=e.state.field(Sh);(t!=e.startState.field(Sh)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return Vt.none;let{view:n}=this,r=new Wd;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?spt:ipt)})}return r.finish()}},{decorations:e=>e.decorations});function Lw(e){return t=>{let n=t.state.field(Sh,!1);return n&&n.query.spec.valid?e(t,n):b0e(t)}}const w_=Lw((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=Fe.single(r.from,r.to),s=e.state.facet(zO);return e.dispatch({selection:i,effects:[C9(e,r),s.scrollToMatch(i.main,e)],userEvent:"select.search"}),g0e(e),!0}),S_=Lw((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let s=Fe.single(i.from,i.to),a=e.state.facet(zO);return e.dispatch({selection:s,effects:[C9(e,i),a.scrollToMatch(s.main,e)],userEvent:"select.search"}),g0e(e),!0}),opt=Lw((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:Fe.create(n.map(r=>Fe.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),lpt=({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 Kb(e.doc,e.sliceDoc(r,i));!l.next().done;){if(s.length>1e3)return!1;l.value.from==r&&(a=s.length),s.push(Fe.range(l.value.from,l.value.to))}return t(e.update({selection:Fe.create(s,a),userEvent:"select.search.matches"})),!0},WG=Lw((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(pt.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=Fe.single(a.from,a.to).map(f),d.push(C9(e,a)),d.push(n.facet(zO).scrollToMatch(c.main,e))),e.dispatch({changes:f,selection:c,effects:d,userEvent:"input.replace"}),!0}),cpt=Lw((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:pt.announce.of(r),userEvent:"input.replace.all"}),!0});function A9(e){return e.state.facet(zO).createPanel(e)}function H3(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(zO);return new h0e({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 m0e(e){let t=q8(e,A9);return t&&t.dom.querySelector("[main-field]")}function g0e(e){let t=m0e(e);t&&t==e.root.activeElement&&t.select()}const b0e=e=>{let t=e.state.field(Sh,!1);if(t&&t.panel){let n=m0e(e);if(n&&n!=e.root.activeElement){let r=H3(e.state,t.query.spec);r.valid&&e.dispatch({effects:_v.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[_9.of(!0),t?_v.of(H3(e.state,t.query.spec)):mn.appendConfig.of(hpt)]});return!0},O0e=e=>{let t=e.state.field(Sh,!1);if(!t||!t.panel)return!1;let n=q8(e,A9);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:_9.of(!1)}),!0},upt=[{key:"Mod-f",run:b0e,scope:"editor search-panel"},{key:"F3",run:w_,shift:S_,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:w_,shift:S_,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:O0e,scope:"editor search-panel"},{key:"Mod-Shift-l",run:lpt},{key:"Mod-Alt-g",run:Qht},{key:"Mod-d",run:Zht,preventDefault:!0}];class dpt{constructor(t){this.view=t;let n=this.query=t.state.field(Sh).query.spec;this.commit=this.commit.bind(this),this.searchField=Xr("input",{value:n.search,placeholder:Po(t,"Find"),"aria-label":Po(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Xr("input",{value:n.replace,placeholder:Po(t,"Replace"),"aria-label":Po(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Xr("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=Xr("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=Xr("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(i,s,a){return Xr("button",{class:"cm-button",name:i,onclick:s,type:"button"},a)}this.dom=Xr("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,r("next",()=>w_(t),[Po(t,"next")]),r("prev",()=>S_(t),[Po(t,"previous")]),r("select",()=>opt(t),[Po(t,"all")]),Xr("label",null,[this.caseField,Po(t,"match case")]),Xr("label",null,[this.reField,Po(t,"regexp")]),Xr("label",null,[this.wordField,Po(t,"by word")]),...t.state.readOnly?[]:[Xr("br"),this.replaceField,r("replace",()=>WG(t),[Po(t,"replace")]),r("replaceAll",()=>cpt(t),[Po(t,"replace all")])],Xr("button",{name:"close",onclick:()=>O0e(t),"aria-label":Po(t,"close"),type:"button"},["×"])])}commit(){let t=new h0e({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:_v.of(t)}))}keydown(t){sit(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?S_:w_)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),WG(this.view))}update(t){for(let n of t.transactions)for(let r of n.effects)r.is(_v)&&!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(zO).top}}function Po(e,t){return e.state.phrase(t)}const GE=30,YE=/[\s\.,:;?!]/;function C9(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-GE),a=Math.min(i,n+GE),l=e.state.sliceDoc(s,a);if(s!=r.from){for(let c=0;cl.length-GE;c--)if(!YE.test(l[c-1])&&YE.test(l[c])){l=l.slice(0,c);break}}return pt.announce.of(`${e.state.phrase("current match")}. ${l} ${e.state.phrase("on line")} ${r.number}.`)}const fpt=pt.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"}}),hpt=[Sh,ff.low(apt),fpt];class ZG{constructor(t,n,r){this.from=t,this.to=n,this.diagnostic=r}}class Up{constructor(t,n,r){this.diagnostics=t,this.panel=n,this.selected=r}static init(t,n,r){let i=r.facet(Av).markerFilter;i&&(t=i(t,r));let s=t.slice().sort((p,b)=>p.from-b.from||p.to-b.to),a=new Wd,l=[],c=0,u=r.doc.iter(),d=0,f=r.doc.length;for(let p=0;;){let b=p==s.length?null:s[p];if(!b&&!l.length)break;let g,O;if(l.length)g=c,O=l.reduce((x,w)=>Math.min(x,w.to),b&&b.from>g?b.from:1e8);else{if(g=b.from,g>f)break;O=b.to,l.push(b),p++}for(;px.from||x.to==g))l.push(x),p++,O=Math.min(x.to,O);else{O=Math.min(x.from,O);break}}O=Math.min(O,f);let y=!1;if(l.some(x=>x.from==g&&(x.to==O||O==f))&&(y=g==O,!y&&O-g<10)){let x=g-(d+u.value.length);x>0&&(u.next(x),d=g);for(let w=g;;){if(w>=O){y=!0;break}if(!u.lineBreak&&d+u.value.length>w)break;w=d+u.value.length,d+=u.value.length,u.next()}}let v=Tpt(l);if(y)a.add(g,g,Vt.widget({widget:new wpt(v),diagnostics:l.slice()}));else{let x=l.reduce((w,S)=>S.markClass?w+" "+S.markClass:w,"");a.add(g,O,Vt.mark({class:"cm-lintRange cm-lintRange-"+v+x,diagnostics:l.slice(),inclusiveEnd:l.some(w=>w.to>O)}))}if(c=O,c==f)break;for(let x=0;x{if(!(t&&a.diagnostics.indexOf(t)<0))if(!r)r=new ZG(i,s,t||a.diagnostics[0]);else{if(a.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new ZG(r.from,s,r.diagnostic)}}),r}function ppt(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(Av).hideOn(e,n,r);if(i!=null)return i;let s=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(a=>a.is(y0e))||e.changes.touchesRange(s.from,Math.max(s.to,r)))}function mpt(e,t){return e.field(Zo,!1)?t:t.concat(mn.appendConfig.of(_pt))}const y0e=mn.define(),N9=mn.define(),x0e=mn.define(),Zo=ma.define({create(){return new Up(Vt.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=Gh(n,e.selected.diagnostic,s)||Gh(n,null,s)}!n.size&&i&&t.state.facet(Av).autoPanel&&(i=null),e=new Up(n,i,r)}for(let n of t.effects)if(n.is(y0e)){let r=t.state.facet(Av).autoPanel?n.value.length?Cv.open:null:e.panel;e=Up.init(n.value,r,t.state)}else n.is(N9)?e=new Up(e.diagnostics,n.value?Cv.open:null,e.selected):n.is(x0e)&&(e=new Up(e.diagnostics,e.panel,n.value));return e},provide:e=>[pv.from(e,t=>t.panel),pt.decorations.from(e,t=>t.diagnostics)]}),gpt=Vt.mark({class:"cm-lintRange cm-lintRange-active"});function bpt(e,t,n){let{diagnostics:r}=e.state.field(Zo),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)&&(tw0e(e,n,!1)))}const ypt=e=>{let t=e.state.field(Zo,!1);(!t||!t.panel)&&e.dispatch({effects:mpt(e.state,[N9.of(!0)])});let n=q8(e,Cv.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},KG=e=>{let t=e.state.field(Zo,!1);return!t||!t.panel?!1:(e.dispatch({effects:N9.of(!1)}),!0)},xpt=e=>{let t=e.state.field(Zo,!1);if(!t)return!1;let n=e.state.selection.main,r=Gh(t.diagnostics,null,n.to+1);return!r&&(r=Gh(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}),Git(e,r.from,1,{tooltip:S0e,until:i=>i.docChanged||i.newSelection.main.headr.to}),!0)},vpt=[{key:"Mod-Shift-m",run:ypt,preventDefault:!0},{key:"F8",run:xpt}],Av=kt.define({combine(e){return{sources:e.map(t=>t.source).filter(t=>t!=null),...$u(e.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:JG,tooltipFilter:JG,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 JG(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function v0e(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 w0e(e,t,n){var r;let i=n?v0e(t.actions):[];return Xr("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},Xr("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=p=>{if(p.preventDefault(),l)return;l=!0;let b=Gh(e.state.field(Zo).diagnostics,t);b&&s.apply(e,b.from,b.to)},{name:u}=s,d=i[a]?u.indexOf(i[a]):-1,f=d<0?u:[u.slice(0,d),Xr("u",u.slice(d,d+1)),u.slice(d+1)],h=s.markClass?" "+s.markClass:"";return Xr("button",{type:"button",class:"cm-diagnosticAction"+h,onclick:c,onmousedown:c,"aria-label":` Action: ${u}${d<0?"":` (access key "${i[a]})"`}.`},f)}),t.source&&Xr("div",{class:"cm-diagnosticSource"},t.source))}class wpt extends Pc{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return Xr("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class eY{constructor(t,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=w0e(t,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Cv{constructor(t){this.view=t,this.items=[];let n=i=>{if(!(i.ctrlKey||i.altKey||i.metaKey)){if(i.keyCode==27)KG(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=v0e(s.actions);for(let l=0;l{for(let s=0;sKG(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(Zo).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 p=r;pr&&(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(Zo),r=Gh(n.diagnostics,this.items[t].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:x0e.of(r)})}static open(t){return new Cv(t)}}function Spt(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(e)}')`}function WE(e){return Spt(``,'width="6" height="3"')}const Ept=pt.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:WE("#f11")},".cm-lintRange-warning":{backgroundImage:WE("orange")},".cm-lintRange-info":{backgroundImage:WE("#999")},".cm-lintRange-hint":{backgroundImage:WE("#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 kpt(e){return e=="error"?4:e=="warning"?3:e=="info"?2:1}function Tpt(e){let t="hint",n=1;for(let r of e){let i=kpt(r.severity);i>n&&(n=i,t=r.severity)}return t}const S0e=Xit(bpt,{hideOn:ppt}),_pt=[Zo,pt.decorations.compute([Zo],e=>{let{selected:t,panel:n}=e.field(Zo);return!t||!n||t.from==t.to?Vt.none:Vt.set([gpt.range(t.from,t.to)])}),S0e,Ept];var tY=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(Dot)),t.defaultKeymap!==!1&&(s=s.concat(Lht)),t.searchKeymap!==!1&&(s=s.concat(upt)),t.historyKeymap!==!1&&(s=s.concat(Vft)),t.foldKeymap!==!1&&(s=s.concat($st)),t.completionKeymap!==!1&&(s=s.concat(tme)),t.lintKeymap!==!1&&(s=s.concat(vpt));var a=[];return t.lineNumbers!==!1&&a.push(ost()),t.highlightActiveLineGutter!==!1&&a.push(ust()),t.highlightSpecialChars!==!1&&a.push(wit()),t.history!==!1&&a.push(Pft()),t.foldGutter!==!1&&a.push(Ust()),t.drawSelection!==!1&&a.push(dit()),t.dropCursor!==!1&&a.push(git()),t.allowMultipleSelections!==!1&&a.push(nr.allowMultipleSelections.of(!0)),t.indentOnInput!==!1&&a.push(Nst()),t.syntaxHighlighting!==!1&&a.push(Ipe(Hst,{fallback:!0})),t.bracketMatching!==!1&&a.push(Jst()),t.closeBrackets!==!1&&a.push(Not()),t.autocompletion!==!1&&a.push(Fot()),t.rectangularSelection!==!1&&a.push(Mit()),i!==!1&&a.push(Bit()),t.highlightActiveLine!==!1&&a.push(Ait()),t.highlightSelectionMatches!==!1&&a.push(zht()),t.tabSize&&typeof t.tabSize=="number"&&a.push(QO.of(" ".repeat(t.tabSize))),a.concat([BO.of(s.flat())]).filter(Boolean)};const Apt="#e5c07b",nY="#e06c75",Cpt="#56b6c2",Npt="#ffffff",lT="#abb2bf",X3="#7d8799",jpt="#61afef",Rpt="#98c379",rY="#d19a66",Ipt="#c678dd",Dpt="#21252b",iY="#2c313a",sY="#282c34",WI="#353a42",Ppt="#3E4451",aY="#528bff",Mpt=pt.theme({"&":{color:lT,backgroundColor:sY},".cm-content":{caretColor:aY},".cm-cursor, .cm-dropCursor":{borderLeftColor:aY},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Ppt},".cm-panels":{backgroundColor:Dpt,color:lT},".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:sY,color:X3,border:"none"},".cm-activeLineGutter":{backgroundColor:iY},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:WI},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:WI,borderBottomColor:WI},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:iY,color:lT}}},{dark:!0}),Lpt=Dw.define([{tag:G.keyword,color:Ipt},{tag:[G.name,G.deleted,G.character,G.propertyName,G.macroName],color:nY},{tag:[G.function(G.variableName),G.labelName],color:jpt},{tag:[G.color,G.constant(G.name),G.standard(G.name)],color:rY},{tag:[G.definition(G.name),G.separator],color:lT},{tag:[G.typeName,G.className,G.number,G.changed,G.annotation,G.modifier,G.self,G.namespace],color:Apt},{tag:[G.operator,G.operatorKeyword,G.url,G.escape,G.regexp,G.link,G.special(G.string)],color:Cpt},{tag:[G.meta,G.comment],color:X3},{tag:G.strong,fontWeight:"bold"},{tag:G.emphasis,fontStyle:"italic"},{tag:G.strikethrough,textDecoration:"line-through"},{tag:G.link,color:X3,textDecoration:"underline"},{tag:G.heading,fontWeight:"bold",color:nY},{tag:[G.atom,G.bool,G.special(G.variableName)],color:rY},{tag:[G.processingInstruction,G.string,G.inserted],color:Rpt},{tag:G.invalid,color:Npt}]),$pt=[Mpt,Ipe(Lpt)];var Bpt=pt.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),Qpt=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,p=n.basicSetup,b=p===void 0?!0:p,g=[];switch(i&&g.unshift(BO.of([$ht])),b&&(typeof b=="boolean"?g.unshift(tY()):g.unshift(tY(b))),h&&g.unshift(Rit(h)),d){case"light":g.push(Bpt);break;case"dark":g.push($pt);break;case"none":break;default:g.push(d);break}return a===!1&&g.push(pt.editable.of(!1)),c&&g.push(nr.readOnly.of(!0)),[...g]},Fpt=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 Upt{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 oY{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 ZI=null,zpt=()=>typeof window>"u"?new oY:(ZI||(ZI=new oY),ZI),Vpt=pt.theme({"& .cm-scroller":{height:"100% !important"}}),lY=null,KI=null;function qpt(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===lY||(lY=a,KI=pt.theme({"&":{height:e,minHeight:t,maxHeight:n,width:r,minWidth:i,maxWidth:s}})),KI}var cY=Lu.define(),Hpt=200,Xpt=[];function Gpt(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?Xpt:l,u=e.autoFocus,d=e.theme,f=d===void 0?"light":d,h=e.height,p=h===void 0?null:h,b=e.minHeight,g=b===void 0?null:b,O=e.maxHeight,y=O===void 0?null:O,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,T=e.placeholder,C=T===void 0?"":T,N=e.editable,_=N===void 0?!0:N,R=e.readOnly,$=R===void 0?!1:R,D=e.indentWithTab,M=D===void 0?!0:D,j=e.basicSetup,P=j===void 0?!0:j,L=e.root,U=e.initialState,F=m.useState(),q=F[0],z=F[1],B=m.useState(),V=B[0],ce=B[1],we=m.useState(),Oe=we[0],de=we[1],Z=m.useState(()=>({current:null}))[0],J=m.useState(()=>({current:null}))[0],fe=qpt(p,g,y,x,S,k),be=pt.updateListener.of(Me=>{if(Me.docChanged&&typeof r=="function"&&!Me.transactions.some(ye=>ye.annotation(cY))){Z.current?Z.current.reset():(Z.current=new Upt(()=>{if(J.current){var ye=J.current;J.current=null,ye()}Z.current=null},Hpt),zpt().add(Z.current));var le=Me.state.doc,ke=le.toString();r(ke,Me)}i&&i(Fpt(Me))}),je=Qpt({theme:f,editable:_,readOnly:$,placeholder:C,indentWithTab:M,basicSetup:P}),Qe=[be,...fe?[fe]:[],Vpt,...je];return a&&typeof a=="function"&&Qe.push(pt.updateListener.of(a)),Qe=Qe.concat(c),m.useLayoutEffect(()=>{if(q&&!Oe){var Me={doc:t,selection:n,extensions:Qe},le=U?nr.fromJSON(U.json,Me,U.fields):nr.create(Me);if(de(le),!V){var ke=new pt({state:le,parent:q,root:L});ce(ke),s&&s(ke,le)}}return()=>{V&&(de(void 0),ce(void 0))}},[q,Oe]),m.useEffect(()=>{e.container&&z(e.container)},[e.container]),m.useEffect(()=>()=>{V&&(V.destroy(),ce(void 0)),Z.current&&(Z.current.cancel(),Z.current=null)},[V]),m.useEffect(()=>{u&&V&&V.focus()},[u,V]),m.useEffect(()=>{V&&V.dispatch({effects:mn.reconfigure.of(Qe)})},[f,c,p,g,y,x,S,k,C,_,$,M,P,r,a]),m.useEffect(()=>{if(t!==void 0){var Me=V?V.state.doc.toString():"";if(V&&t!==Me){var le=Z.current&&!Z.current.isDone,ke=()=>{V&&t!==V.state.doc.toString()&&V.dispatch({changes:{from:0,to:V.state.doc.toString().length,insert:t||""},annotations:[cY.of(!0)]})};le?J.current=ke:ke()}}},[t,V]),{state:Oe,setState:de,view:V,setView:ce,container:q,setContainer:z}}var Ypt=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],E0e=m.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,p=e.theme,b=p===void 0?"light":p,g=e.height,O=e.minHeight,y=e.maxHeight,v=e.width,x=e.minWidth,w=e.maxWidth,S=e.basicSetup,E=e.placeholder,k=e.indentWithTab,T=e.editable,C=e.readOnly,N=e.root,_=e.initialState,R=kft(e,Ypt),$=m.useRef(null),D=Gpt({root:N,value:i,autoFocus:h,theme:b,height:g,minHeight:O,maxHeight:y,width:v,minWidth:x,maxWidth:w,basicSetup:S,placeholder:E,indentWithTab:k,editable:T,readOnly:C,selection:s,onChange:c,onStatistics:u,onCreateEditor:d,onUpdate:f,extensions:l,initialState:_}),M=D.state,j=D.view,P=D.container,L=D.setContainer;m.useImperativeHandle(t,()=>({editor:$.current,state:M,view:j}),[$,P,M,j]);var U=m.useCallback(q=>{$.current=q,L(q)},[L]);if(typeof i!="string")throw new Error("value must be typeof string but got "+typeof i);var F=typeof b=="string"?"cm-theme-"+b:"cm-theme";return o.jsx("div",F3({ref:U,className:""+F+(n?" "+n:"")},R))});E0e.displayName="CodeMirror";function Wpt(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")?[Y8.define(Eft)]:r==="py"||r==="pyi"?[Ddt()]:["ts","tsx","mts","cts"].includes(r??"")?[A3({typescript:!0,jsx:r==="tsx"})]:["js","jsx","mjs","cjs"].includes(r??"")?[A3({jsx:r==="jsx"})]:r==="json"||r==="jsonc"?[elt()]:r==="yaml"||r==="yml"?[uft()]:["md","markdown"].includes(r??"")?[put()]:[]}function j9({value:e,path:t,onChange:n,readOnly:r=!1}){const i=m.useMemo(()=>Wpt(t),[t]);return o.jsx(E0e,{value:e,height:"100%",theme:"light",extensions:i,editable:!r,onChange:n,basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0,highlightActiveLineGutter:!0,autocompletion:!1}})}const R9=Object.freeze(Object.defineProperty({__proto__:null,default:j9},Symbol.toStringTag,{value:"Module"}));function Zpt(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=Ffe(t.slice(1,n).join(` +`,{label:"if",detail:"block",type:"keyword"}),$i("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),$i("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),$i("import ${module}",{label:"import",detail:"statement",type:"keyword"}),$i("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],Pdt=Gpe(xge,t9(Idt.concat(Ddt)));function qI(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 HI(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 XI=Jd.define({name:"python",parser:Ndt.configure({props:[pf.add({Body:e=>{var t;let n=/^\s*(#|$)/.test(e.textAfter)&&qI(e)||e.node;return(t=HI(e,n))!==null&&t!==void 0?t:e.continue()},MatchBody:e=>{var t;let n=qI(e);return(t=HI(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":tb({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":tb({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":tb({closing:"]"}),MemberExpression:e=>e.baseIndent+e.unit,"String FormatString":()=>null,Script:e=>{var t;let n=qI(e);return(t=n&&HI(e,n))!==null&&t!==void 0?t:e.continue()}}),mf.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":Iw,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 Mdt(){return new Xh(XI,[XI.data.of({autocomplete:Rdt}),XI.data.of({autocomplete:Pdt})])}const Jg=63,BG=64,Ldt=1,$dt=2,vge=3,Bdt=4,wge=5,Qdt=6,Fdt=7,Sge=65,Udt=66,zdt=8,Vdt=9,qdt=10,Hdt=11,Xdt=12,Ege=13,Gdt=19,Ydt=20,Wdt=29,Zdt=33,Kdt=34,Jdt=47,eft=0,S9=1,B3=2,_v=3,Q3=4;class Up{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}}Up.top=new Up(null,-1,eft);function ax(e,t){for(let n=0,r=t-e.pos-1;;r--,n++){let i=e.peek(r);if(tf(i)||i==-1)return n}}function F3(e){return e==32||e==9}function tf(e){return e==10||e==13}function kge(e){return F3(e)||tf(e)}function em(e){return e<0||kge(e)}const tft=new $C({start:Up.top,reduce(e,t){return e.type==_v&&(t==Ydt||t==Kdt)?e.parent:e},shift(e,t,n,r){if(t==vge)return new Up(e,ax(r,r.pos),S9);if(t==Sge||t==wge)return new Up(e,ax(r,r.pos),B3);if(t==Jg)return e.parent;if(t==Gdt||t==Zdt)return new Up(e,0,_v);if(t==Ege&&e.type==Q3)return e.parent;if(t==Jdt){let i=/[1-9]/.exec(r.read(r.pos,n.pos));if(i)return new Up(e,e.depth+ +i[0],Q3)}return e},hash(e){return e.hash}});function Kb(e,t,n=0){return e.peek(n)==t&&e.peek(n+1)==t&&e.peek(n+2)==t&&em(e.peek(n+3))}const nft=new ds((e,t)=>{if(e.next==-1&&t.canShift(BG))return e.acceptToken(BG);let n=e.peek(-1);if((tf(n)||n<0)&&t.context.type!=_v){if(Kb(e,45))if(t.canShift(Jg))e.acceptToken(Jg);else return e.acceptToken(Ldt,3);if(Kb(e,46))if(t.canShift(Jg))e.acceptToken(Jg);else return e.acceptToken($dt,3);let r=0;for(;e.next==32;)r++,e.advance();(r{if(t.context.type==_v){e.next==63&&(e.advance(),em(e.next)&&e.acceptToken(Fdt));return}if(e.next==45)e.advance(),em(e.next)&&e.acceptToken(t.context.type==S9&&t.context.depth==ax(e,e.pos-1)?Bdt:vge);else if(e.next==63)e.advance(),em(e.next)&&e.acceptToken(t.context.type==B3&&t.context.depth==ax(e,e.pos-1)?Qdt:wge);else{let n=e.pos;for(;;)if(F3(e.next)){if(e.pos==n)return;e.advance()}else if(e.next==33)Tge(e);else if(e.next==38)U3(e);else if(e.next==42){U3(e);break}else if(e.next==39||e.next==34){if(E9(e,!0))break;return}else if(e.next==91||e.next==123){if(!sft(e))return;break}else{_ge(e,!0,!1,0);break}for(;F3(e.next);)e.advance();if(e.next==58){if(e.pos==n&&t.canShift(Wdt))return;let r=e.peek(1);em(r)&&e.acceptTokenTo(t.context.type==B3&&t.context.depth==ax(e,n)?Udt:Sge,n)}}},{contextual:!0});function ift(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 QG(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function FG(e,t){return e.next==37?(e.advance(),QG(e.next)&&e.advance(),QG(e.next)&&e.advance(),!0):ift(e.next)||t&&e.next==44?(e.advance(),!0):!1}function Tge(e){if(e.advance(),e.next==60){for(e.advance();;)if(!FG(e,!0)){e.next==62&&e.advance();break}}else for(;FG(e,!1););}function U3(e){for(e.advance();!em(e.next)&&y_(e.next)!="f";)e.advance()}function E9(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(tf(s)){if(t)return!1;r=!0}else if(t&&e.pos>=i+1024)return!1}return!r}function sft(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(!E9(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||tf(e.next))return!1;e.advance()}}const aft="iiisiiissisfissssssssssssisssiiissssssssssssssssssssssssssfsfssissssssssssssssssssssssssssfif";function y_(e){return e<33?"u":e>125?"s":aft[e-33]}function GI(e,t){let n=y_(e);return n!="u"&&!(t&&n=="f")}function _ge(e,t,n,r){if(y_(e.next)=="s"||(e.next==63||e.next==58||e.next==45)&&GI(e.peek(1),n))e.advance();else return!1;let i=e.pos;for(;;){let s=e.next,a=0,l=r+1;for(;kge(s);){if(tf(s)){if(t)return!1;l=0}else l++;s=e.peek(++a)}if(!(s>=0&&(s==58?GI(e.peek(a+1),n):s==35?e.peek(a-1)!=32:GI(s,n)))||!n&&l<=r||l==0&&!n&&(Kb(e,45,a)||Kb(e,46,a)))break;if(t&&y_(s)=="f")return!1;for(let u=a;u>=0;u--)e.advance();if(t&&e.pos>i+1024)return!1}return!0}const oft=new ds((e,t)=>{if(e.next==33)Tge(e),e.acceptToken(Xdt);else if(e.next==38||e.next==42){let n=e.next==38?qdt:Hdt;U3(e),e.acceptToken(n)}else e.next==39||e.next==34?(E9(e,!1),e.acceptToken(Vdt)):_ge(e,!1,t.context.type==_v,t.context.depth)&&e.acceptToken(zdt)}),lft=new ds((e,t)=>{let n=t.context.type==Q3?t.context.depth:-1,r=e.pos;e:for(;;){let i=0,s=e.next;for(;s==32;)s=e.peek(++i);if(!i&&(Kb(e,45,i)||Kb(e,46,i))||!tf(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:tft,nodeProps:[["isolate",-3,8,9,14,""],["openedBy",18,"[",32,"{"],["closedBy",19,"]",33,"}"]],propSources:[cft],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:[nft,rft,oft,lft,0,1],topRules:{Stream:[0,15]},tokenPrec:0}),dft=Jd.define({name:"yaml",parser:uft.configure({props:[pf.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:tb({closing:"}"}),FlowSequence:tb({closing:"]"})}),mf.add({"FlowMapping FlowSequence":Iw,"Item Pair BlockLiteral":(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}),languageData:{commentTokens:{line:"#"},indentOnInput:/^\s*[\]\}]$/}});function fft(){return new Xh(dft)}function hft(e){Age(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=T9(e.state,n.from);return r.line?Cft(e):r.block?jft(e):!1};function k9(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 Cft=k9(Dft,0),Nft=k9(Ige,0),jft=k9((e,t)=>Ige(e,t,Ift(t)),0);function T9(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const My=50;function Rft(e,{open:t,close:n},r,i){let s=e.sliceDoc(r-My,r),a=e.sliceDoc(i,i+My),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*My?d=f=e.sliceDoc(r,i):(d=e.sliceDoc(r,r+My),f=e.sliceDoc(i-My,i));let h=/^\s*/.exec(d)[0].length,p=/\s*$/.exec(f)[0].length,b=f.length-p-n.length;return d.slice(h,h+t.length)==t&&f.slice(b,b+n.length)==n?{open:{pos:r+h+t.length,margin:/\s/.test(d.charAt(h+t.length))?1:0},close:{pos:i-p-n.length,margin:/\s/.test(f.charAt(b-1))?1:0}}:null}function Ift(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 Ige(e,t,n=t.selection.ranges){let r=n.map(s=>T9(t,s.from).block);if(!r.every(s=>s))return null;let i=n.map((s,a)=>Rft(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,p=h==f.length,b=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 V3=Lu.define(),Pft=Lu.define(),Mft=kt.define(),Dge=kt.define({combine(e){return $u(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)})}}),Pge=ga.define({create(){return bu.empty},update(e,t){let n=t.state.facet(Dge),r=t.annotation(V3);if(r){let c=mo.fromTransaction(t,r.selection),u=r.side,d=u==0?e.undone:e.done;return c?d=x_(d,d.length,n.minDepth,c):d=$ge(d,t.startState.selection),new bu(u==0?r.rest:d,u==0?d:r.rest)}let i=t.annotation(Pft);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=mo.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 bu(e.done.map(mo.fromJSON),e.undone.map(mo.fromJSON))}});function Lft(e={}){return[Pge,Dge.of(e),pt.domEventHandlers({beforeinput(t,n){let r=t.inputType=="historyUndo"?Mge:t.inputType=="historyRedo"?q3:null;return r?(t.preventDefault(),r(n)):!1}})]}function UC(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(Pge,!1);if(!i)return!1;let s=i.pop(e,n,t);return s?(r(s),!0):!1}}const Mge=UC(0,!1),q3=UC(1,!1),$ft=UC(0,!0),Bft=UC(1,!0);class mo{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 mo(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 mo(t.changes&&js.fromJSON(t.changes),[],t.mapped&&Su.fromJSON(t.mapped),t.startSelection&&Fe.fromJSON(t.startSelection),t.selectionsAfter.map(Fe.fromJSON))}static fromTransaction(t,n){let r=Ml;for(let i of t.startState.facet(Mft)){let s=i(t);s.length&&(r=r.concat(s))}return!r.length&&t.changes.empty?null:new mo(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,Ml)}static selection(t){return new mo(void 0,Ml,void 0,void 0,t)}}function x_(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 Qft(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 Fft(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((n,r)=>n.empty!=t.ranges[r].empty).length===0}function Lge(e,t){return e.length?t.length?e.concat(t):e:t}const Ml=[],Uft=200;function $ge(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Uft));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),x_(e,e.length-1,1e9,n.setSelAfter(r)))}else return[mo.selection([t])]}function zft(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 YI(e,t){if(!e.length)return e;let n=e.length,r=Ml;for(;n;){let i=Vft(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?[mo.selection(r)]:Ml}function Vft(e,t,n){let r=Lge(e.selectionsAfter.length?e.selectionsAfter.map(l=>l.map(t)):Ml,n);if(!e.changes)return mo.selection(r);let i=e.changes.map(t),s=t.mapDesc(e.changes,!0),a=e.mapped?e.mapped.composeDesc(s):s;return new mo(i,mn.mapEffects(e.effects,t),a,e.startSelection.map(s),r)}const qft=/^(input\.type|delete)($|\.)/;class bu{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 bu(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||qft.test(r))&&(!l.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?e.moveByChar(n,t):zC(n,t))}function Ra(e){return e.textDirectionAt(e.state.selection.main.head)==ni.LTR}const Qge=e=>Bge(e,!Ra(e)),Fge=e=>Bge(e,Ra(e));function Uge(e,t){return Lc(e,n=>n.empty?e.moveByGroup(n,t):zC(n,t))}const Xft=e=>Uge(e,!Ra(e)),Gft=e=>Uge(e,Ra(e));function Yft(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 VC(e,t,n){let r=Yr(e).resolveInner(t.head),i=n?dn.closedBy:dn.openedBy;for(let c=t.head;;){let u=n?r.childAfter(c):r.childBefore(c);if(!u)break;Yft(e,u,i)?r=u:c=n?u.to:u.from}let s=r.type.prop(i),a,l;return s&&(a=n?gu(e,r.from,1):gu(e,r.to,-1))&&a.matched?l=n?a.end.to:a.end.from:l=n?r.to:r.from,Fe.cursor(l,n?-1:1)}const Wft=e=>Lc(e,t=>VC(e.state,t,!Ra(e))),Zft=e=>Lc(e,t=>VC(e.state,t,Ra(e)));function zge(e,t){return Lc(e,n=>{if(!n.empty)return zC(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}const Vge=e=>zge(e,!1),qge=e=>zge(e,!0);function Hge(e){let t=e.scrollDOM.clientHeighta.empty?e.moveVertically(a,t,n.height):zC(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.bottomXge(e,!1),H3=e=>Xge(e,!0);function rp(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=Fe.cursor(r.from+s))}return i}const Kft=e=>Lc(e,t=>rp(e,t,!0)),Jft=e=>Lc(e,t=>rp(e,t,!1)),eht=e=>Lc(e,t=>rp(e,t,!Ra(e))),tht=e=>Lc(e,t=>rp(e,t,Ra(e))),nht=e=>Lc(e,t=>Fe.cursor(e.lineBlockAt(t.head).from,1)),rht=e=>Lc(e,t=>Fe.cursor(e.lineBlockAt(t.head).to,-1));function iht(e,t,n){let r=!1,i=zO(e.selection,s=>{let a=gu(e,s.head,-1)||gu(e,s.head,1)||s.head>0&&gu(e,s.head-1,1)||s.headiht(e,t);function Yl(e,t,n){let r=zO(e.state.selection,i=>{i.undirectional&&i.head>=i.anchor!=t&&(i=Fe.range(i.head,i.anchor));let s=n(i);return Fe.range(i.anchor,s.head,s.goalColumn,s.bidiLevel||void 0,s.assoc)});return r.eq(e.state.selection)?!1:(e.dispatch(Mc(e.state,r)),!0)}function Gge(e,t){return Yl(e,t,n=>e.moveByChar(n,t))}const Yge=e=>Gge(e,!Ra(e)),Wge=e=>Gge(e,Ra(e));function Zge(e,t){return Yl(e,t,n=>e.moveByGroup(n,t))}const aht=e=>Zge(e,!Ra(e)),oht=e=>Zge(e,Ra(e)),lht=e=>{let t=!Ra(e);return Yl(e,t,n=>VC(e.state,n,t))},cht=e=>{let t=Ra(e);return Yl(e,t,n=>VC(e.state,n,t))};function Kge(e,t){return Yl(e,t,n=>e.moveVertically(n,t))}const Jge=e=>Kge(e,!1),e0e=e=>Kge(e,!0);function t0e(e,t){return Yl(e,t,n=>e.moveVertically(n,t,Hge(e).height))}const zG=e=>t0e(e,!1),VG=e=>t0e(e,!0),uht=e=>Yl(e,!0,t=>rp(e,t,!0)),dht=e=>Yl(e,!1,t=>rp(e,t,!1)),fht=e=>{let t=!Ra(e);return Yl(e,t,n=>rp(e,n,t))},hht=e=>{let t=Ra(e);return Yl(e,t,n=>rp(e,n,t))},pht=e=>Yl(e,!1,t=>Fe.cursor(e.lineBlockAt(t.head).from)),mht=e=>Yl(e,!0,t=>Fe.cursor(e.lineBlockAt(t.head).to)),qG=({state:e,dispatch:t})=>(t(Mc(e,{anchor:0})),!0),HG=({state:e,dispatch:t})=>(t(Mc(e,{anchor:e.doc.length})),!0),XG=({state:e,dispatch:t})=>(t(Mc(e,{anchor:e.selection.main.anchor,head:0})),!0),GG=({state:e,dispatch:t})=>(t(Mc(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),ght=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0),bht=({state:e,dispatch:t})=>{let n=qC(e).map(({from:r,to:i})=>Fe.range(r,Math.min(i+1,e.doc.length)));return t(e.update({selection:Fe.create(n),userEvent:"select"})),!0},Oht=({state:e,dispatch:t})=>{let n=zO(e.selection,r=>{let i=Yr(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 Fe.range(l.to,l.from)}return r});return n.eq(e.selection)?!1:(t(Mc(e,n)),!0)};function n0e(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(Mc(n,Fe.create(i,i.length-1))),!0)}const yht=e=>n0e(e,!1),xht=e=>n0e(e,!0),vht=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=Fe.create([n.main]):n.main.empty||(r=Fe.create([Fe.cursor(n.main.head)])),r?(t(Mc(e,r)),!0):!1};function Lw(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=XE(e,c,!0)),a=Math.min(a,c),l=Math.max(l,c)}else a=XE(e,a,!1),l=XE(e,l,!0);return a==l?{range:s}:{changes:{from:a,to:l},range:Fe.cursor(a,ai(e)))r.between(t,t,(i,s)=>{it&&(t=n?s:i)});return t}const r0e=(e,t,n)=>Lw(e,r=>{let i=r.from,{state:s}=e,a=s.doc.lineAt(i),l,c;if(n&&!t&&i>a.from&&ir0e(e,!1,!0),i0e=e=>r0e(e,!0,!1),s0e=(e,t)=>Lw(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=Ys(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}),a0e=e=>s0e(e,!1),wht=e=>s0e(e,!0),Sht=e=>Lw(e,t=>{let n=e.lineBlockAt(t.head).to;return t.headLw(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),kht=e=>Lw(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:Tr.of(["",""])},range:Fe.cursor(r.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},_ht=({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:Ys(s.text,i-s.from,!1)+s.from,l=i==s.to?i+1:Ys(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:Fe.cursor(l)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function qC(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 o0e(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let s of qC(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(Fe.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(Fe.range(c.anchor-l,c.head-l))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:Fe.create(i,e.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Aht=({state:e,dispatch:t})=>o0e(e,t,!1),Cht=({state:e,dispatch:t})=>o0e(e,t,!0);function l0e(e,t,n){if(e.readOnly)return!1;let r=[];for(let s of qC(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 Nht=({state:e,dispatch:t})=>l0e(e,t,!1),jht=({state:e,dispatch:t})=>l0e(e,t,!0),Rht=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(qC(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 Iht(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=Yr(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(dn.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 YG=c0e(!1),Dht=c0e(!0);function c0e(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&&Iht(t,s);e&&(s=a=(a<=l.to?l:t.doc.lineAt(a)).to);let u=new MC(t,{simulateBreak:s,simulateDoubleBreak:!!c}),d=Y8(u,s);for(d==null&&(d=_c(/^\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:Fe.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const Pht=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new MC(e,{overrideIndentation:s=>{let a=n[s];return a??-1}}),i=_9(e,(s,a,l)=>{let c=Y8(r,s.from);if(c==null)return;/\S/.test(s.text)||(c=0);let u=/^\s*/.exec(s.text)[0],d=bv(e,c);(u!=d||l.frome.readOnly?!1:(t(e.update(_9(e,(n,r)=>{r.push({from:n.from,insert:e.facet(FO)})}),{userEvent:"input.indent"})),!0),d0e=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(_9(e,(n,r)=>{let i=/^\s*/.exec(n.text)[0];if(!i)return;let s=_c(i,e.tabSize),a=0,l=bv(e,Math.max(0,s-Lm(e)));for(;a(e.setTabFocusMode(),!0),Lht=[{key:"Ctrl-b",run:Qge,shift:Yge,preventDefault:!0},{key:"Ctrl-f",run:Fge,shift:Wge},{key:"Ctrl-p",run:Vge,shift:Jge},{key:"Ctrl-n",run:qge,shift:e0e},{key:"Ctrl-a",run:nht,shift:pht},{key:"Ctrl-e",run:rht,shift:mht},{key:"Ctrl-d",run:i0e},{key:"Ctrl-h",run:X3},{key:"Ctrl-k",run:Sht},{key:"Ctrl-Alt-h",run:a0e},{key:"Ctrl-o",run:Tht},{key:"Ctrl-t",run:_ht},{key:"Ctrl-v",run:H3}],$ht=[{key:"ArrowLeft",run:Qge,shift:Yge,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Xft,shift:aht,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:eht,shift:fht,preventDefault:!0},{key:"ArrowRight",run:Fge,shift:Wge,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Gft,shift:oht,preventDefault:!0},{mac:"Cmd-ArrowRight",run:tht,shift:hht,preventDefault:!0},{key:"ArrowUp",run:Vge,shift:Jge,preventDefault:!0},{mac:"Cmd-ArrowUp",run:qG,shift:XG},{mac:"Ctrl-ArrowUp",run:UG,shift:zG},{key:"ArrowDown",run:qge,shift:e0e,preventDefault:!0},{mac:"Cmd-ArrowDown",run:HG,shift:GG},{mac:"Ctrl-ArrowDown",run:H3,shift:VG},{key:"PageUp",run:UG,shift:zG},{key:"PageDown",run:H3,shift:VG},{key:"Home",run:Jft,shift:dht,preventDefault:!0},{key:"Mod-Home",run:qG,shift:XG},{key:"End",run:Kft,shift:uht,preventDefault:!0},{key:"Mod-End",run:HG,shift:GG},{key:"Enter",run:YG,shift:YG},{key:"Mod-a",run:ght},{key:"Backspace",run:X3,shift:X3,preventDefault:!0},{key:"Delete",run:i0e,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:a0e,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:wht,preventDefault:!0},{mac:"Mod-Backspace",run:Eht,preventDefault:!0},{mac:"Mod-Delete",run:kht,preventDefault:!0}].concat(Lht.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),Bht=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Wft,shift:lht},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Zft,shift:cht},{key:"Alt-ArrowUp",run:Aht},{key:"Shift-Alt-ArrowUp",run:Nht},{key:"Alt-ArrowDown",run:Cht},{key:"Shift-Alt-ArrowDown",run:jht},{key:"Mod-Alt-ArrowUp",run:yht},{key:"Mod-Alt-ArrowDown",run:xht},{key:"Escape",run:vht},{key:"Mod-Enter",run:Dht},{key:"Alt-l",mac:"Ctrl-l",run:bht},{key:"Mod-i",run:Oht,preventDefault:!0},{key:"Mod-[",run:d0e},{key:"Mod-]",run:u0e},{key:"Mod-Alt-\\",run:Pht},{key:"Shift-Mod-k",run:Rht},{key:"Shift-Mod-\\",run:sht},{key:"Mod-/",run:Aft},{key:"Alt-A",run:Nft},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Mht}].concat($ht),Qht={key:"Tab",run:u0e,shift:d0e},WG=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class Jb{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(WG(l)):WG,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 lo(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=C8(t),r=this.bufferStart+this.bufferPos;this.bufferPos+=ou(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=v_(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 sb(n,t.sliceString(n,r));return WI.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=v_(this.text,i+(r==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=sb.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(h0e.prototype[Symbol.iterator]=p0e.prototype[Symbol.iterator]=function(){return this});function Fht(e){try{return new RegExp(e,A9),!0}catch{return!1}}function v_(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t=56320&&r<57344;)t++;return t}const Uht=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:i}=Kit(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,p=u?+u:l.number;if(u&&f){let O=p/100;c&&(O=O*(c=="-"?-1:1)+l.number/t.doc.lines),p=Math.round(t.doc.lines*O)}else u&&c&&(p=p*(c=="-"?-1:1)+l.number);let b=t.doc.line(Math.max(1,Math.min(t.doc.lines,p))),g=Fe.cursor(b.from+Math.max(0,Math.min(h,b.length)));e.dispatch({effects:[r,pt.scrollIntoView(g.from,{y:"center"})],selection:g})}),!0},zht={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Vht=kt.define({combine(e){return $u(e,zht,{highlightWordAroundCursor:(t,n)=>t||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function qht(e){return[Wht,Yht]}const Hht=Vt.mark({class:"cm-selectionMatch"}),Xht=Vt.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function ZG(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=Ai.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=Ai.Word)}function Ght(e,t,n,r){return e(t.sliceDoc(n,n+1))==Ai.Word&&e(t.sliceDoc(r-1,r))==Ai.Word}const Yht=Ki.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(Vht),{state:n}=e,r=n.selection;if(r.ranges.length>1)return Vt.none;let i=r.main,s,a=null;if(i.empty){if(!t.highlightWordAroundCursor)return Vt.none;let c=n.wordAt(i.head);if(!c)return Vt.none;a=n.charCategorizer(i.head),s=n.sliceDoc(c.from,c.to)}else{let c=i.to-i.from;if(c200)return Vt.none;if(t.wholeWords){if(s=n.sliceDoc(i.from,i.to),a=n.charCategorizer(i.head),!(ZG(a,n,i.from,i.to)&&Ght(a,n,i.from,i.to)))return Vt.none}else if(s=n.sliceDoc(i.from,i.to),!s)return Vt.none}let l=[];for(let c of e.visibleRanges){let u=new Jb(n.doc,s,c.from,c.to);for(;!u.next().done;){let{from:d,to:f}=u.value;if((!a||ZG(a,n,d,f))&&(i.empty&&d<=i.from&&f>=i.to?l.push(Xht.range(d,f)):(d>=i.to||f<=i.from)&&l.push(Hht.range(d,f)),l.length>t.maxMatches))return Vt.none}}return Vt.set(l)}},{decorations:e=>e.decorations}),Wht=pt.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Zht=({state:e,dispatch:t})=>{let{selection:n}=e,r=Fe.create(n.ranges.map(i=>e.wordAt(i.head)||Fe.cursor(i.head)),n.mainIndex);return r.eq(n)?!1:(t(e.update({selection:r})),!0)};function Kht(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 Jb(e.doc,t,r[r.length-1].to);;)if(l.next(),l.done){if(a)return null;l=new Jb(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 Jht=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(s=>s.from===s.to))return Zht({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=Kht(e,r);return i?(t(e.update({selection:e.selection.addRange(Fe.range(i.from,i.to),!1),effects:pt.scrollIntoView(i.to)})),!0):!1},VO=kt.define({combine(e){return $u(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new hpt(t),scrollToMatch:t=>pt.scrollIntoView(t)})}});class m0e{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||Fht(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 spt(this):new npt(this)}getCursor(t,n=0,r){let i=t.doc?t:rr.create({doc:t});return r==null&&(r=i.doc.length),this.regexp?t0(this,i,n,r):e0(this,i,n,r)}}class g0e{constructor(t){this.spec=t}}function ept(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 e0(e,t,n,r){let i;return e.wholeWord&&(i=tpt(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=ept(e.test,t,i)),new Jb(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:s=>s.toLowerCase(),i)}function tpt(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=e0(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 rpt(e,t,n){return(r,i,s)=>(!n||n(r,i,s))&&e(s[0],t,r,i)}function t0(e,t,n,r){let i;return e.wholeWord&&(i=ipt(t.charCategorizer(t.selection.main.head))),e.test&&(i=rpt(e.test,t,i)),new h0e(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function w_(e,t){return e.slice(Ys(e,t,!1),t)}function S_(e,t){return e.slice(t,Ys(e,t))}function ipt(e){return(t,n,r)=>!r[0].length||(e(w_(r.input,r.index))!=Ai.Word||e(S_(r.input,r.index))!=Ai.Word)&&(e(S_(r.input,r.index+r[0].length))!=Ai.Word||e(w_(r.input,r.index+r[0].length))!=Ai.Word)}class spt extends g0e{nextMatch(t,n,r){let i=t0(this.spec,t,r,t.doc.length).next();return i.done&&(i=t0(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=t0(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=t0(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 Av=mn.define(),C9=mn.define(),Sh=ga.define({create(e){return new ZI(G3(e).create(),null)},update(e,t){for(let n of t.effects)n.is(Av)?e=new ZI(n.value.create(),e.panel):n.is(C9)&&(e=new ZI(e.query,n.value?N9:null));return e},provide:e=>mv.from(e,t=>t.panel)});class ZI{constructor(t,n){this.query=t,this.panel=n}}const apt=Vt.mark({class:"cm-searchMatch"}),opt=Vt.mark({class:"cm-searchMatch cm-searchMatch-selected"}),lpt=Ki.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(Sh))}update(e){let t=e.state.field(Sh);(t!=e.startState.field(Sh)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return Vt.none;let{view:n}=this,r=new Wd;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?opt:apt)})}return r.finish()}},{decorations:e=>e.decorations});function $w(e){return t=>{let n=t.state.field(Sh,!1);return n&&n.query.spec.valid?e(t,n):y0e(t)}}const E_=$w((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=Fe.single(r.from,r.to),s=e.state.facet(VO);return e.dispatch({selection:i,effects:[j9(e,r),s.scrollToMatch(i.main,e)],userEvent:"select.search"}),O0e(e),!0}),k_=$w((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let s=Fe.single(i.from,i.to),a=e.state.facet(VO);return e.dispatch({selection:s,effects:[j9(e,i),a.scrollToMatch(s.main,e)],userEvent:"select.search"}),O0e(e),!0}),cpt=$w((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:Fe.create(n.map(r=>Fe.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),upt=({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 Jb(e.doc,e.sliceDoc(r,i));!l.next().done;){if(s.length>1e3)return!1;l.value.from==r&&(a=s.length),s.push(Fe.range(l.value.from,l.value.to))}return t(e.update({selection:Fe.create(s,a),userEvent:"select.search.matches"})),!0},KG=$w((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(pt.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=Fe.single(a.from,a.to).map(f),d.push(j9(e,a)),d.push(n.facet(VO).scrollToMatch(c.main,e))),e.dispatch({changes:f,selection:c,effects:d,userEvent:"input.replace"}),!0}),dpt=$w((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:pt.announce.of(r),userEvent:"input.replace.all"}),!0});function N9(e){return e.state.facet(VO).createPanel(e)}function G3(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(VO);return new m0e({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 b0e(e){let t=X8(e,N9);return t&&t.dom.querySelector("[main-field]")}function O0e(e){let t=b0e(e);t&&t==e.root.activeElement&&t.select()}const y0e=e=>{let t=e.state.field(Sh,!1);if(t&&t.panel){let n=b0e(e);if(n&&n!=e.root.activeElement){let r=G3(e.state,t.query.spec);r.valid&&e.dispatch({effects:Av.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[C9.of(!0),t?Av.of(G3(e.state,t.query.spec)):mn.appendConfig.of(mpt)]});return!0},x0e=e=>{let t=e.state.field(Sh,!1);if(!t||!t.panel)return!1;let n=X8(e,N9);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:C9.of(!1)}),!0},fpt=[{key:"Mod-f",run:y0e,scope:"editor search-panel"},{key:"F3",run:E_,shift:k_,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:E_,shift:k_,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:x0e,scope:"editor search-panel"},{key:"Mod-Shift-l",run:upt},{key:"Mod-Alt-g",run:Uht},{key:"Mod-d",run:Jht,preventDefault:!0}];class hpt{constructor(t){this.view=t;let n=this.query=t.state.field(Sh).query.spec;this.commit=this.commit.bind(this),this.searchField=Xr("input",{value:n.search,placeholder:Po(t,"Find"),"aria-label":Po(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Xr("input",{value:n.replace,placeholder:Po(t,"Replace"),"aria-label":Po(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Xr("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=Xr("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=Xr("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(i,s,a){return Xr("button",{class:"cm-button",name:i,onclick:s,type:"button"},a)}this.dom=Xr("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,r("next",()=>E_(t),[Po(t,"next")]),r("prev",()=>k_(t),[Po(t,"previous")]),r("select",()=>cpt(t),[Po(t,"all")]),Xr("label",null,[this.caseField,Po(t,"match case")]),Xr("label",null,[this.reField,Po(t,"regexp")]),Xr("label",null,[this.wordField,Po(t,"by word")]),...t.state.readOnly?[]:[Xr("br"),this.replaceField,r("replace",()=>KG(t),[Po(t,"replace")]),r("replaceAll",()=>dpt(t),[Po(t,"replace all")])],Xr("button",{name:"close",onclick:()=>x0e(t),"aria-label":Po(t,"close"),type:"button"},["×"])])}commit(){let t=new m0e({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:Av.of(t)}))}keydown(t){oit(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?k_:E_)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),KG(this.view))}update(t){for(let n of t.transactions)for(let r of n.effects)r.is(Av)&&!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(VO).top}}function Po(e,t){return e.state.phrase(t)}const GE=30,YE=/[\s\.,:;?!]/;function j9(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-GE),a=Math.min(i,n+GE),l=e.state.sliceDoc(s,a);if(s!=r.from){for(let c=0;cl.length-GE;c--)if(!YE.test(l[c-1])&&YE.test(l[c])){l=l.slice(0,c);break}}return pt.announce.of(`${e.state.phrase("current match")}. ${l} ${e.state.phrase("on line")} ${r.number}.`)}const ppt=pt.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"}}),mpt=[Sh,ff.low(lpt),ppt];class JG{constructor(t,n,r){this.from=t,this.to=n,this.diagnostic=r}}class zp{constructor(t,n,r){this.diagnostics=t,this.panel=n,this.selected=r}static init(t,n,r){let i=r.facet(Cv).markerFilter;i&&(t=i(t,r));let s=t.slice().sort((p,b)=>p.from-b.from||p.to-b.to),a=new Wd,l=[],c=0,u=r.doc.iter(),d=0,f=r.doc.length;for(let p=0;;){let b=p==s.length?null:s[p];if(!b&&!l.length)break;let g,O;if(l.length)g=c,O=l.reduce((x,w)=>Math.min(x,w.to),b&&b.from>g?b.from:1e8);else{if(g=b.from,g>f)break;O=b.to,l.push(b),p++}for(;px.from||x.to==g))l.push(x),p++,O=Math.min(x.to,O);else{O=Math.min(x.from,O);break}}O=Math.min(O,f);let y=!1;if(l.some(x=>x.from==g&&(x.to==O||O==f))&&(y=g==O,!y&&O-g<10)){let x=g-(d+u.value.length);x>0&&(u.next(x),d=g);for(let w=g;;){if(w>=O){y=!0;break}if(!u.lineBreak&&d+u.value.length>w)break;w=d+u.value.length,d+=u.value.length,u.next()}}let v=Apt(l);if(y)a.add(g,g,Vt.widget({widget:new Ept(v),diagnostics:l.slice()}));else{let x=l.reduce((w,S)=>S.markClass?w+" "+S.markClass:w,"");a.add(g,O,Vt.mark({class:"cm-lintRange cm-lintRange-"+v+x,diagnostics:l.slice(),inclusiveEnd:l.some(w=>w.to>O)}))}if(c=O,c==f)break;for(let x=0;x{if(!(t&&a.diagnostics.indexOf(t)<0))if(!r)r=new JG(i,s,t||a.diagnostics[0]);else{if(a.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new JG(r.from,s,r.diagnostic)}}),r}function gpt(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(Cv).hideOn(e,n,r);if(i!=null)return i;let s=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(a=>a.is(v0e))||e.changes.touchesRange(s.from,Math.max(s.to,r)))}function bpt(e,t){return e.field(Zo,!1)?t:t.concat(mn.appendConfig.of(Cpt))}const v0e=mn.define(),R9=mn.define(),w0e=mn.define(),Zo=ga.define({create(){return new zp(Vt.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=Gh(n,e.selected.diagnostic,s)||Gh(n,null,s)}!n.size&&i&&t.state.facet(Cv).autoPanel&&(i=null),e=new zp(n,i,r)}for(let n of t.effects)if(n.is(v0e)){let r=t.state.facet(Cv).autoPanel?n.value.length?Nv.open:null:e.panel;e=zp.init(n.value,r,t.state)}else n.is(R9)?e=new zp(e.diagnostics,n.value?Nv.open:null,e.selected):n.is(w0e)&&(e=new zp(e.diagnostics,e.panel,n.value));return e},provide:e=>[mv.from(e,t=>t.panel),pt.decorations.from(e,t=>t.diagnostics)]}),Opt=Vt.mark({class:"cm-lintRange cm-lintRange-active"});function ypt(e,t,n){let{diagnostics:r}=e.state.field(Zo),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)&&(tE0e(e,n,!1)))}const vpt=e=>{let t=e.state.field(Zo,!1);(!t||!t.panel)&&e.dispatch({effects:bpt(e.state,[R9.of(!0)])});let n=X8(e,Nv.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},eY=e=>{let t=e.state.field(Zo,!1);return!t||!t.panel?!1:(e.dispatch({effects:R9.of(!1)}),!0)},wpt=e=>{let t=e.state.field(Zo,!1);if(!t)return!1;let n=e.state.selection.main,r=Gh(t.diagnostics,null,n.to+1);return!r&&(r=Gh(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}),Wit(e,r.from,1,{tooltip:k0e,until:i=>i.docChanged||i.newSelection.main.headr.to}),!0)},Spt=[{key:"Mod-Shift-m",run:vpt,preventDefault:!0},{key:"F8",run:wpt}],Cv=kt.define({combine(e){return{sources:e.map(t=>t.source).filter(t=>t!=null),...$u(e.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:tY,tooltipFilter:tY,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 tY(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function S0e(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 E0e(e,t,n){var r;let i=n?S0e(t.actions):[];return Xr("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},Xr("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=p=>{if(p.preventDefault(),l)return;l=!0;let b=Gh(e.state.field(Zo).diagnostics,t);b&&s.apply(e,b.from,b.to)},{name:u}=s,d=i[a]?u.indexOf(i[a]):-1,f=d<0?u:[u.slice(0,d),Xr("u",u.slice(d,d+1)),u.slice(d+1)],h=s.markClass?" "+s.markClass:"";return Xr("button",{type:"button",class:"cm-diagnosticAction"+h,onclick:c,onmousedown:c,"aria-label":` Action: ${u}${d<0?"":` (access key "${i[a]})"`}.`},f)}),t.source&&Xr("div",{class:"cm-diagnosticSource"},t.source))}class Ept extends Pc{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return Xr("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class nY{constructor(t,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=E0e(t,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Nv{constructor(t){this.view=t,this.items=[];let n=i=>{if(!(i.ctrlKey||i.altKey||i.metaKey)){if(i.keyCode==27)eY(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=S0e(s.actions);for(let l=0;l{for(let s=0;seY(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(Zo).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 p=r;pr&&(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(Zo),r=Gh(n.diagnostics,this.items[t].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:w0e.of(r)})}static open(t){return new Nv(t)}}function kpt(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(e)}')`}function WE(e){return kpt(``,'width="6" height="3"')}const Tpt=pt.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:WE("#f11")},".cm-lintRange-warning":{backgroundImage:WE("orange")},".cm-lintRange-info":{backgroundImage:WE("#999")},".cm-lintRange-hint":{backgroundImage:WE("#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 _pt(e){return e=="error"?4:e=="warning"?3:e=="info"?2:1}function Apt(e){let t="hint",n=1;for(let r of e){let i=_pt(r.severity);i>n&&(n=i,t=r.severity)}return t}const k0e=Yit(ypt,{hideOn:gpt}),Cpt=[Zo,pt.decorations.compute([Zo],e=>{let{selected:t,panel:n}=e.field(Zo);return!t||!n||t.from==t.to?Vt.none:Vt.set([Opt.range(t.from,t.to)])}),k0e,Tpt];var rY=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(Mot)),t.defaultKeymap!==!1&&(s=s.concat(Bht)),t.searchKeymap!==!1&&(s=s.concat(fpt)),t.historyKeymap!==!1&&(s=s.concat(Hft)),t.foldKeymap!==!1&&(s=s.concat(Qst)),t.completionKeymap!==!1&&(s=s.concat(rme)),t.lintKeymap!==!1&&(s=s.concat(Spt));var a=[];return t.lineNumbers!==!1&&a.push(cst()),t.highlightActiveLineGutter!==!1&&a.push(fst()),t.highlightSpecialChars!==!1&&a.push(Eit()),t.history!==!1&&a.push(Lft()),t.foldGutter!==!1&&a.push(Vst()),t.drawSelection!==!1&&a.push(hit()),t.dropCursor!==!1&&a.push(Oit()),t.allowMultipleSelections!==!1&&a.push(rr.allowMultipleSelections.of(!0)),t.indentOnInput!==!1&&a.push(Rst()),t.syntaxHighlighting!==!1&&a.push(Ppe(Gst,{fallback:!0})),t.bracketMatching!==!1&&a.push(tat()),t.closeBrackets!==!1&&a.push(Rot()),t.autocompletion!==!1&&a.push(zot()),t.rectangularSelection!==!1&&a.push($it()),i!==!1&&a.push(Fit()),t.highlightActiveLine!==!1&&a.push(Nit()),t.highlightSelectionMatches!==!1&&a.push(qht()),t.tabSize&&typeof t.tabSize=="number"&&a.push(FO.of(" ".repeat(t.tabSize))),a.concat([QO.of(s.flat())]).filter(Boolean)};const Npt="#e5c07b",iY="#e06c75",jpt="#56b6c2",Rpt="#ffffff",uT="#abb2bf",Y3="#7d8799",Ipt="#61afef",Dpt="#98c379",sY="#d19a66",Ppt="#c678dd",Mpt="#21252b",aY="#2c313a",oY="#282c34",KI="#353a42",Lpt="#3E4451",lY="#528bff",$pt=pt.theme({"&":{color:uT,backgroundColor:oY},".cm-content":{caretColor:lY},".cm-cursor, .cm-dropCursor":{borderLeftColor:lY},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Lpt},".cm-panels":{backgroundColor:Mpt,color:uT},".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:oY,color:Y3,border:"none"},".cm-activeLineGutter":{backgroundColor:aY},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:KI},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:KI,borderBottomColor:KI},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:aY,color:uT}}},{dark:!0}),Bpt=Pw.define([{tag:G.keyword,color:Ppt},{tag:[G.name,G.deleted,G.character,G.propertyName,G.macroName],color:iY},{tag:[G.function(G.variableName),G.labelName],color:Ipt},{tag:[G.color,G.constant(G.name),G.standard(G.name)],color:sY},{tag:[G.definition(G.name),G.separator],color:uT},{tag:[G.typeName,G.className,G.number,G.changed,G.annotation,G.modifier,G.self,G.namespace],color:Npt},{tag:[G.operator,G.operatorKeyword,G.url,G.escape,G.regexp,G.link,G.special(G.string)],color:jpt},{tag:[G.meta,G.comment],color:Y3},{tag:G.strong,fontWeight:"bold"},{tag:G.emphasis,fontStyle:"italic"},{tag:G.strikethrough,textDecoration:"line-through"},{tag:G.link,color:Y3,textDecoration:"underline"},{tag:G.heading,fontWeight:"bold",color:iY},{tag:[G.atom,G.bool,G.special(G.variableName)],color:sY},{tag:[G.processingInstruction,G.string,G.inserted],color:Dpt},{tag:G.invalid,color:Rpt}]),Qpt=[$pt,Ppe(Bpt)];var Fpt=pt.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),Upt=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,p=n.basicSetup,b=p===void 0?!0:p,g=[];switch(i&&g.unshift(QO.of([Qht])),b&&(typeof b=="boolean"?g.unshift(rY()):g.unshift(rY(b))),h&&g.unshift(Dit(h)),d){case"light":g.push(Fpt);break;case"dark":g.push(Qpt);break;case"none":break;default:g.push(d);break}return a===!1&&g.push(pt.editable.of(!1)),c&&g.push(rr.readOnly.of(!0)),[...g]},zpt=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 Vpt{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 cY{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 JI=null,qpt=()=>typeof window>"u"?new cY:(JI||(JI=new cY),JI),Hpt=pt.theme({"& .cm-scroller":{height:"100% !important"}}),uY=null,eD=null;function Xpt(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===uY||(uY=a,eD=pt.theme({"&":{height:e,minHeight:t,maxHeight:n,width:r,minWidth:i,maxWidth:s}})),eD}var dY=Lu.define(),Gpt=200,Ypt=[];function Wpt(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?Ypt:l,u=e.autoFocus,d=e.theme,f=d===void 0?"light":d,h=e.height,p=h===void 0?null:h,b=e.minHeight,g=b===void 0?null:b,O=e.maxHeight,y=O===void 0?null:O,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,T=e.placeholder,C=T===void 0?"":T,N=e.editable,_=N===void 0?!0:N,R=e.readOnly,$=R===void 0?!1:R,D=e.indentWithTab,M=D===void 0?!0:D,j=e.basicSetup,P=j===void 0?!0:j,L=e.root,U=e.initialState,F=m.useState(),q=F[0],z=F[1],B=m.useState(),V=B[0],ce=B[1],we=m.useState(),Oe=we[0],de=we[1],Z=m.useState(()=>({current:null}))[0],J=m.useState(()=>({current:null}))[0],fe=Xpt(p,g,y,x,S,k),be=pt.updateListener.of(Me=>{if(Me.docChanged&&typeof r=="function"&&!Me.transactions.some(ye=>ye.annotation(dY))){Z.current?Z.current.reset():(Z.current=new Vpt(()=>{if(J.current){var ye=J.current;J.current=null,ye()}Z.current=null},Gpt),qpt().add(Z.current));var le=Me.state.doc,ke=le.toString();r(ke,Me)}i&&i(zpt(Me))}),je=Upt({theme:f,editable:_,readOnly:$,placeholder:C,indentWithTab:M,basicSetup:P}),Qe=[be,...fe?[fe]:[],Hpt,...je];return a&&typeof a=="function"&&Qe.push(pt.updateListener.of(a)),Qe=Qe.concat(c),m.useLayoutEffect(()=>{if(q&&!Oe){var Me={doc:t,selection:n,extensions:Qe},le=U?rr.fromJSON(U.json,Me,U.fields):rr.create(Me);if(de(le),!V){var ke=new pt({state:le,parent:q,root:L});ce(ke),s&&s(ke,le)}}return()=>{V&&(de(void 0),ce(void 0))}},[q,Oe]),m.useEffect(()=>{e.container&&z(e.container)},[e.container]),m.useEffect(()=>()=>{V&&(V.destroy(),ce(void 0)),Z.current&&(Z.current.cancel(),Z.current=null)},[V]),m.useEffect(()=>{u&&V&&V.focus()},[u,V]),m.useEffect(()=>{V&&V.dispatch({effects:mn.reconfigure.of(Qe)})},[f,c,p,g,y,x,S,k,C,_,$,M,P,r,a]),m.useEffect(()=>{if(t!==void 0){var Me=V?V.state.doc.toString():"";if(V&&t!==Me){var le=Z.current&&!Z.current.isDone,ke=()=>{V&&t!==V.state.doc.toString()&&V.dispatch({changes:{from:0,to:V.state.doc.toString().length,insert:t||""},annotations:[dY.of(!0)]})};le?J.current=ke:ke()}}},[t,V]),{state:Oe,setState:de,view:V,setView:ce,container:q,setContainer:z}}var Zpt=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],T0e=m.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,p=e.theme,b=p===void 0?"light":p,g=e.height,O=e.minHeight,y=e.maxHeight,v=e.width,x=e.minWidth,w=e.maxWidth,S=e.basicSetup,E=e.placeholder,k=e.indentWithTab,T=e.editable,C=e.readOnly,N=e.root,_=e.initialState,R=_ft(e,Zpt),$=m.useRef(null),D=Wpt({root:N,value:i,autoFocus:h,theme:b,height:g,minHeight:O,maxHeight:y,width:v,minWidth:x,maxWidth:w,basicSetup:S,placeholder:E,indentWithTab:k,editable:T,readOnly:C,selection:s,onChange:c,onStatistics:u,onCreateEditor:d,onUpdate:f,extensions:l,initialState:_}),M=D.state,j=D.view,P=D.container,L=D.setContainer;m.useImperativeHandle(t,()=>({editor:$.current,state:M,view:j}),[$,P,M,j]);var U=m.useCallback(q=>{$.current=q,L(q)},[L]);if(typeof i!="string")throw new Error("value must be typeof string but got "+typeof i);var F=typeof b=="string"?"cm-theme-"+b:"cm-theme";return o.jsx("div",z3({ref:U,className:""+F+(n?" "+n:"")},R))});T0e.displayName="CodeMirror";function Kpt(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")?[Z8.define(Tft)]:r==="py"||r==="pyi"?[Mdt()]:["ts","tsx","mts","cts"].includes(r??"")?[N3({typescript:!0,jsx:r==="tsx"})]:["js","jsx","mjs","cjs"].includes(r??"")?[N3({jsx:r==="jsx"})]:r==="json"||r==="jsonc"?[nlt()]:r==="yaml"||r==="yml"?[fft()]:["md","markdown"].includes(r??"")?[gut()]:[]}function I9({value:e,path:t,onChange:n,readOnly:r=!1}){const i=m.useMemo(()=>Kpt(t),[t]);return o.jsx(T0e,{value:e,height:"100%",theme:"light",extensions:i,editable:!r,onChange:n,basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0,highlightActiveLineGutter:!0,autocompletion:!1}})}const D9=Object.freeze(Object.defineProperty({__proto__:null,default:I9},Symbol.toStringTag,{value:"Module"}));function Jpt(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=zfe(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:Ufe(l).trim()}))}}function Kpt(){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 Jpt(){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 emt(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 k0e({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(Jpt,{}),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(Kpt,{}),o.jsx("span",{children:i.name})]}),i.children.length>0?o.jsx(k0e,{nodes:i.children,depth:t+1,activePath:n,onSelect:r}):null]},i.path))}function tmt(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 T0e({files:e}){var f;const t=m.useMemo(()=>emt(e),[e]),[n,r]=m.useState(((f=e[0])==null?void 0:f.path)||""),[i,s]=m.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=m.useMemo(()=>Zpt(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(k0e,{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:()=>tmt(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(_u,{text:d.body,allowRawHtml:!1,className:"skill-file-preview__markdown-body"})]}):o.jsx(j9,{value:a.content,path:a.path,readOnly:!0,onChange:()=>{}})})]}):o.jsx("div",{className:"skill-file-preview__binary",children:"暂无文件"})})]})}const nmt=1200,rmt=3,_0e=2,imt=/SKILL\.md|frontmatter|Skill name|description|根目录|目录名|UTF-8|文本文件|文件数|符号链接|敏感凭证/i,A0e={concise:"简洁实用",strict:"严谨稳健",tutorial:"教程友好",automation:"自动化优先"},smt=[...Object.entries(A0e).map(([e,t])=>({value:e,label:t})),{value:"custom",label:"自定义"}];function uY(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 amt(e){return e?e.state==="ready"?"Skill 已生成并通过格式校验":e.state==="failed"?"生成失败":e.state==="cancelled"?"已停止":e.stage==="validating"?"正在校验 Skill 格式":e.stage==="packaging"?"正在整理文件":"正在生成 Skill":"正在准备 Dev Sandbox"}function JI(e){var t;return e.state==="failed"&&((t=e.validation)==null?void 0:t.valid)===!1&&e.validation.errors.some(n=>imt.test(n))}function dY(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:Vfe(l).trim()}))}}function emt(){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 tmt(){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 nmt(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 _0e({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(tmt,{}),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(emt,{}),o.jsx("span",{children:i.name})]}),i.children.length>0?o.jsx(_0e,{nodes:i.children,depth:t+1,activePath:n,onSelect:r}):null]},i.path))}function rmt(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 A0e({files:e}){var f;const t=m.useMemo(()=>nmt(e),[e]),[n,r]=m.useState(((f=e[0])==null?void 0:f.path)||""),[i,s]=m.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=m.useMemo(()=>Jpt(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(_0e,{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:()=>rmt(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(_u,{text:d.body,allowRawHtml:!1,className:"skill-file-preview__markdown-body"})]}):o.jsx(I9,{value:a.content,path:a.path,readOnly:!0,onChange:()=>{}})})]}):o.jsx("div",{className:"skill-file-preview__binary",children:"暂无文件"})})]})}const imt=1200,smt=3,C0e=2,amt=/SKILL\.md|frontmatter|Skill name|description|根目录|目录名|UTF-8|文本文件|文件数|符号链接|敏感凭证/i,N0e={concise:"简洁实用",strict:"严谨稳健",tutorial:"教程友好",automation:"自动化优先"},omt=[...Object.entries(N0e).map(([e,t])=>({value:e,label:t})),{value:"custom",label:"自定义"}];function fY(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 lmt(e){return e?e.state==="ready"?"Skill 已生成并通过格式校验":e.state==="failed"?"生成失败":e.state==="cancelled"?"已停止":e.stage==="validating"?"正在校验 Skill 格式":e.stage==="packaging"?"正在整理文件":"正在生成 Skill":"正在准备 Dev Sandbox"}function tD(e){var t;return e.state==="failed"&&((t=e.validation)==null?void 0:t.valid)===!1&&e.validation.errors.some(n=>amt.test(n))}function hY(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 omt(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)}/${_0e})`:amt(e.task)}function fY(){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 lmt(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 cmt(e){return e?e.length>64?"Skill 名称不能超过 64 个字符":/^[a-z0-9-]+$/.test(e)?"":"Skill 名称只能包含小写字母、数字和连字符":""}function hY(e){return e?e.length>128?"模型 ID 不能超过 128 个字符":/^[A-Za-z0-9][A-Za-z0-9._:/-]*$/.test(e)?"":"模型 ID 只能包含字母、数字、点、下划线、连字符、斜杠和冒号":""}function eD(e){return`${e.region||""}:${e.id}`}function umt(){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 dmt({operation:e,cloudProvider:t,space:n,availableSpaces:r=[],spacesLoading:i=!1,initialIntent:s="",source:a,onBack:l,onPublished:c}){var W,ne,he,xe;const[u,d]=m.useState(null),[f,h]=m.useState(null),[p,b]=m.useState(s),[g,O]=m.useState(""),[y,v]=m.useState([]),[x,w]=m.useState([]),[S,E]=m.useState(""),[k,T]=m.useState(!1),[C,N]=m.useState(""),[_,R]=m.useState(""),[$,D]=m.useState(null),[M,j]=m.useState(""),[P,L]=m.useState(""),[U,F]=m.useState(n?eD(n):""),[q,z]=m.useState(Date.now()),B=m.useRef([]);m.useEffect(()=>{const re=new AbortController;return hC(re.signal).then(Re=>{d(Re),v([uY(0,Re)])}).catch(Re=>{re.signal.aborted||h(Fs(Re,"读取 Dev Sandbox 配置失败"))}),()=>re.abort()},[]),m.useEffect(()=>{B.current=x},[x]),m.useEffect(()=>{const re=window.setInterval(()=>z(Date.now()),1e3);return()=>window.clearInterval(re)},[]),m.useEffect(()=>{const re=Re=>{B.current.some(nt=>{var Ke;return((Ke=nt.task)==null?void 0:Ke.state)==="running"||nt.repairing})&&Re.preventDefault()};return window.addEventListener("beforeunload",re),()=>{var Re;window.removeEventListener("beforeunload",re);for(const nt of B.current)(Re=nt.task)!=null&&Re.jobId&&DJe(nt.task.jobId).catch(()=>{})}},[]),m.useEffect(()=>{if(!x.some(Ke=>{var tn;return((tn=Ke.task)==null?void 0:tn.state)==="running"||Ke.repairing}))return;let re=!1,Re;const nt=async()=>{const Ke=B.current,tn=await Promise.all(Ke.map(async Gt=>{var At;if(((At=Gt.task)==null?void 0:At.state)!=="running")return Gt;try{const St=await jJe(Gt.task.jobId);if(JI(St)&&(Gt.repairAttempts||0)<_0e){const Ue=(Gt.repairAttempts||0)+1;w(Y=>Y.map(mt=>mt.id===Gt.id?{...mt,task:St,repairing:!0,repairMode:"auto",repairAttempts:Ue,repairError:void 0}:mt));try{const Y=await GR({jobId:St.jobId,intent:dY(St),expectedRevision:St.revision});return{...Gt,task:Y,artifact:void 0,repairing:!1,repairMode:"auto",repairAttempts:Ue,repairError:void 0,error:void 0,pollError:void 0}}catch(Y){return{...Gt,task:St,repairing:!1,repairMode:void 0,repairAttempts:Ue,repairError:Fs(Y,"自动修复格式错误失败"),pollError:void 0}}}let ve=Gt.artifact;return St.state==="ready"&&(ve=await XR(St.jobId,St.revision)),{...Gt,task:St,artifact:ve,repairing:!1,repairMode:St.state==="running"?Gt.repairMode:void 0,repairError:void 0,error:void 0,pollError:void 0}}catch(St){return{...Gt,pollError:Fs(St,"读取候选方案状态失败,正在重试")}}}));re||(w(tn),Re=window.setTimeout(()=>void nt(),nmt))};return nt(),()=>{re=!0,Re!==void 0&&window.clearTimeout(Re)}},[x.some(re=>{var Re;return((Re=re.task)==null?void 0:Re.state)==="running"||re.repairing})]);const V=x.find(re=>re.id===S)||x[0],ce=e==="create"&&!n,we=r.find(re=>eD(re)===U)??null,Oe=n??we,de=r.map(re=>({value:eD(re),label:`${re.name.trim()||"未命名 Skill Space"} · ${Ec(re.region||"cn-beijing",t)}`})),Z=cmt(g),J=!!(u!=null&&u.enabled&&p.trim()&&!Z&&y.length>0&&y.every(re=>re.model.trim()&&!hY(re.model.trim()))),fe=(re,Re)=>{v(nt=>nt.map(Ke=>Ke.id===re?{...Ke,...Re}:Ke))},be=async re=>{const Re={...re,model:re.model.trim()},nt=re.style==="custom"?re.customStyle.trim():re.style;try{const Ke=await NJe({operation:e,intent:p.trim(),model:Re.model,style:nt,name:g.trim()||void 0,source:a});return{id:re.id,config:Re,task:Ke}}catch(Ke){return{id:re.id,config:Re,error:Fs(Ke,"创建候选方案失败")}}},je=async()=>{if(!J)return;T(!0),D(null);const re=y.map(nt=>({id:nt.id,config:nt}));w(re),E(y[0].id);const Re=await Promise.all(y.map(be));w(Re)},Qe=async re=>{w(nt=>nt.map(Ke=>Ke.id===re.id?{...Ke,error:void 0}:Ke));const Re=await be(re.config);w(nt=>nt.map(Ke=>Ke.id===re.id?Re:Ke))},Me=async()=>{if(!(!(V!=null&&V.task)||!C.trim()||V.task.state!=="ready")){R("refine"),D(null);try{const re=await GR({jobId:V.task.jobId,intent:C.trim(),expectedRevision:V.task.revision});w(Re=>Re.map(nt=>nt.id===V.id?{...nt,task:re,artifact:void 0}:nt)),N("")}catch(re){D(Fs(re,"继续调整失败"))}finally{R("")}}},le=async()=>{if(!(!(V!=null&&V.task)||!JI(V.task))){R("refine"),D(null),w(re=>re.map(Re=>Re.id===V.id?{...Re,repairing:!0,repairMode:"manual",repairError:void 0}:Re));try{const re=await GR({jobId:V.task.jobId,intent:dY(V.task),expectedRevision:V.task.revision});w(Re=>Re.map(nt=>nt.id===V.id?{...nt,task:re,artifact:void 0,repairing:!1,repairMode:"manual",repairError:void 0}:nt))}catch(re){w(Re=>Re.map(nt=>nt.id===V.id?{...nt,repairing:!1,repairMode:void 0,repairError:Fs(re,"再次修复格式错误失败")}:nt))}finally{R("")}}},ke=async()=>{if(!(!(V!=null&&V.task)||V.task.state!=="ready"||P)){R("publish"),D(null);try{if(!Oe)throw new Error("请选择上传的 Skill Space");const re=V.artifact||await XR(V.task.jobId,V.task.revision),Re=(a==null?void 0:a.region)||Oe.region||"";if(!a6(Re))throw new Error("当前 Skill 地域不受支持");await IJe({jobId:V.task.jobId,expectedRevision:V.task.revision,expectedArtifactSha256:re.sha256,disposition:e==="optimize"?"update-source":"create-new",skillSpaceIds:[Oe.id],projectName:(a==null?void 0:a.projectName)||Oe.projectName,region:Re,onProgress:nt=>j(nt.message)}),L(V.id),c()}catch(re){D(Fs(re,"上传 Skill 失败"))}finally{R(""),j("")}}},ye=async()=>{if(!(!(V!=null&&V.task)||V.task.state!=="ready")){R("download");try{const re=V.artifact||await XR(V.task.jobId,V.task.revision);await PJe(V.task.jobId,V.task.revision,re.sha256)}catch(re){D(Fs(re,"下载失败"))}finally{R("")}}},$e=async()=>{x.some(re=>{var Re;return((Re=re.task)==null?void 0:Re.state)==="running"})&&!window.confirm("离开后将停止并释放正在运行的 Dev Sandbox,确定离开吗?")||(await Promise.allSettled(x.flatMap(re=>{var Re;return((Re=re.task)==null?void 0:Re.state)==="running"?[RJe({jobId:re.task.jobId,expectedRevision:re.task.revision})]:[]})),l())},ze=e==="create"?"创建技能":`优化 ${(a==null?void 0:a.name)||"技能"}`,Ae=re=>{var Re;return((Re=u==null?void 0:u.models.find(nt=>nt.id===re))==null?void 0:Re.label)||re},Ve=re=>re.config.style==="custom"?re.config.customStyle.trim()||"自定义风格":A0e[re.config.style],ut=re=>re.error||re.repairError?"失败":omt(re),Tt=re=>!re.error&&!re.repairError&&(re.repairing||!re.task||re.task.state==="running"),We=x.some(re=>{var Re;return((Re=re.task)==null?void 0:Re.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 $e(),"aria-label":"返回技能空间",children:o.jsx(umt,{})}),o.jsxs("div",{children:[o.jsx("h1",{children:ze}),o.jsx("p",{children:(n==null?void 0:n.name)||"主页技能生成"})]}),x.length>0?o.jsx("span",{className:"skill-generation__ttl",children:lmt(V==null?void 0:V.task,q)}):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(re=>o.jsxs("button",{type:"button",role:"tab","aria-selected":(V==null?void 0:V.id)===re.id,className:(V==null?void 0:V.id)===re.id?"is-active":"",onClick:()=>E(re.id),children:[o.jsxs("span",{className:"skill-generation__summary-row",children:[o.jsx("span",{children:"风格"}),o.jsx("strong",{children:Ve(re)})]}),o.jsxs("span",{className:"skill-generation__summary-row",children:[o.jsx("span",{children:"模型"}),o.jsx("strong",{children:Ae(re.config.model)})]}),o.jsxs("span",{className:"skill-generation__summary-row",children:[o.jsx("span",{children:"进度"}),o.jsxs("strong",{children:[Tt(re)?o.jsx(fY,{}):null,ut(re)]})]})]},re.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:Ve(V)})]}),o.jsxs("div",{className:"skill-generation__summary-row",children:[o.jsx("span",{children:"模型"}),o.jsx("strong",{children:Ae(V.config.model)})]}),o.jsxs("div",{className:"skill-generation__summary-row","aria-live":"polite",children:[o.jsx("span",{children:"进度"}),o.jsxs("strong",{children:[Tt(V)?o.jsx(fY,{}):null,Tt(V)?o.jsx(Ln,{children:ut(V)}):ut(V)]})]})]})}),V.task?o.jsx(Cet,{activities:V.task.activities}):null,V.pollError?o.jsx("div",{className:"skill-inline-notice",children:o.jsx(Go,{error:V.pollError})}):null,V.repairError?o.jsx("div",{className:"skill-inline-notice",children:o.jsx(Go,{error:V.repairError})}):null,V.error?o.jsxs("div",{className:"skill-inline-error",children:[o.jsx(Go,{error:V.error}),o.jsx("button",{type:"button",onClick:()=>void Qe(V),children:"重试此方案"})]}):null,(W=V.task)!=null&&W.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(re=>o.jsx("p",{children:re},re)),JI(V.task)?o.jsx("button",{type:"button",disabled:!!_,onClick:()=>void le(),children:"再次修复"}):null]}):null]}),o.jsxs("section",{className:"skill-generation__files",children:[o.jsxs("header",{children:[o.jsx("h2",{children:"文件"}),((ne=V.task)==null?void 0:ne.state)==="ready"?o.jsx("button",{type:"button",onClick:()=>void ye(),disabled:!!_,children:"下载 ZIP"}):null]}),V.artifact?o.jsx(T0e,{files:V.artifact.files}):o.jsx("div",{className:"skill-generation__files-empty",children:((he=V.task)==null?void 0:he.state)==="ready"?"正在读取文件…":"生成过程中会在这里显示完整文件树"})]}),((xe=V.task)==null?void 0:xe.state)==="ready"?o.jsxs("div",{className:"skill-generation__ready-actions",children:[ce?o.jsx("div",{className:"skill-generation__publish-target",children:o.jsx(Hk,{label:"上传到 Skill Space",value:U,options:de,onChange:F,disabled:i,placeholder:i?"正在加载 Skill Space":"选择 Skill Space"})}):null,o.jsxs("footer",{className:"skill-generation__followup",children:[o.jsx("textarea",{value:C,onChange:re=>N(re.target.value),placeholder:"继续调整这个候选方案"}),o.jsx("button",{type:"button",className:"skill-button",disabled:!C.trim()||!!_,onClick:()=>void Me(),children:"继续调整"}),o.jsx("button",{type:"button",className:"skill-button skill-button--primary",disabled:!!_||!!P||!Oe,onClick:()=>void ke(),children:_==="publish"?M||"上传中…":e==="optimize"?"覆盖原 Skill":ce?"上传到 Skill Space":"上传到当前空间"})]})]}):null,$?o.jsx("div",{className:"skill-inline-error skill-generation__action-error",children:o.jsx(Go,{error:$})}):null]}):null,!We&&x.every(re=>re.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:p,onChange:re=>b(re.target.value),placeholder:e==="create"?"描述希望这个 Skill 完成什么任务":"描述希望如何优化当前 Skill"})]}),o.jsxs("label",{children:[o.jsx("span",{children:"Skill 名称"}),o.jsx("input",{value:g,onChange:re=>O(re.target.value),placeholder:"留空时自动生成","aria-invalid":!!Z,"aria-describedby":"skill-name-help"}),Z?o.jsx("span",{id:"skill-name-help",className:"skill-generation__field-error",role:"alert",children:Z}):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:[y.map((re,Re)=>o.jsxs("article",{className:"skill-generation__group",children:[o.jsxs("header",{children:[o.jsxs("strong",{children:["方案 ",Re+1]}),y.length>1?o.jsx("button",{type:"button",onClick:()=>v(nt=>nt.filter(Ke=>Ke.id!==re.id)),children:"移除"}):null]}),o.jsx(Hk,{label:"模型",required:!0,value:re.model,options:(u==null?void 0:u.models.map(nt=>({value:nt.id,label:nt.label})))||[],onChange:nt=>fe(re.id,{model:nt}),allowCustom:!0,placeholder:"选择或输入模型 ID",error:hY(re.model.trim())}),o.jsx(Hk,{label:"风格",required:!0,value:re.style,options:smt,onChange:nt=>fe(re.id,{style:nt})}),re.style==="custom"?o.jsxs("label",{children:[o.jsx("span",{children:"自定义风格"}),o.jsx("textarea",{value:re.customStyle,onChange:nt=>fe(re.id,{customStyle:nt.target.value}),placeholder:"描述表达方式、严谨程度或输出偏好"})]}):null]},re.id)),u&&y.lengthv(re=>[...re,uY(re.length,u)]),children:"添加配置"}):null]}),f?o.jsx("div",{className:"skill-inline-error",children:o.jsx(Go,{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:!J,onClick:()=>void je(),children:"生成"})})]})]})}function I9({title:e,children:t,onClose:n,className:r=""}){const i=m.useRef(null);return m.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 fmt({region:e,regionOptions:t,onClose:n,onCreated:r}){const[i,s]=m.useState(""),[a,l]=m.useState(""),[c,u]=m.useState(e),[d,f]=m.useState(!1),[h,p]=m.useState(null),b=async()=>{if(i.trim()){f(!0),p(null);try{const g=await pJe({name:i.trim(),description:a.trim()||void 0,region:c});r({...g,region:g.region||c})}catch(g){p(Fs(g,"创建 Skill 空间失败"))}finally{f(!1)}}};return o.jsxs(I9,{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:g=>s(g.target.value)})]}),o.jsx(Hk,{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:g=>l(g.target.value)})]}),h?o.jsx("div",{className:"skill-inline-error",children:o.jsx(Go,{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 b(),children:d?"创建中…":"创建"})]})]})}function hmt({space:e,region:t,onClose:n,onUpdated:r}){const[i,s]=m.useState(e.name),[a,l]=m.useState(e.description||""),[c,u]=m.useState(!1),[d,f]=m.useState(null),h=async()=>{if(i.trim()){u(!0),f(null);try{const p=await mJe({spaceId:e.id,name:i.trim(),description:a.trim()||void 0,region:t});r({...e,...p,skillCount:e.skillCount})}catch(p){f(Fs(p,"更新 Skill 空间失败"))}finally{u(!1)}}};return o.jsxs(I9,{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:p=>s(p.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"描述(可选)"}),o.jsx("textarea",{value:a,maxLength:1024,onChange:p=>l(p.target.value)})]}),d?o.jsx("div",{className:"skill-inline-error",children:o.jsx(Go,{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 pmt({space:e,region:t,onClose:n,onUploaded:r}){const[i,s]=m.useState(null),[a,l]=m.useState(null),[c,u]=m.useState(!1),[d,f]=m.useState(!1),[h,p]=m.useState(null),[b,g]=m.useState(!1),O=m.useRef(0),y=m.useRef(null),v=async w=>{const S=O.current+1;if(O.current=S,s(w),l(null),p(null),u(!!w),!!w)try{const E=await OJe(w);O.current===S&&l({name:E.name,fileCount:E.files.length})}catch(E){O.current===S&&p(Fs(E,"Skill ZIP 格式校验失败"))}finally{O.current===S&&u(!1)}},x=async()=>{if(!(!i||!a)){f(!0),p(null);try{await bJe({spaceId:e.id,region:t,project:e.projectName,file:i}),r()}catch(w){p(Fs(w,"上传 Skill 失败"))}finally{f(!1)}}};return o.jsxs(I9,{title:`上传到 ${e.name}`,className:"skill-upload-dialog",onClose:n,children:[o.jsxs("div",{className:"skill-dialog__body",children:[o.jsx("input",{ref:y,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${b?" is-dragging":""}`,onClick:()=>{var w;return(w=y.current)==null?void 0:w.click()},onDragEnter:w=>{w.preventDefault(),g(!0)},onDragOver:w=>{w.preventDefault(),w.dataTransfer.dropEffect="copy",g(!0)},onDragLeave:w=>{w.currentTarget.contains(w.relatedTarget)||g(!1)},onDrop:w=>{var S;w.preventDefault(),g(!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(Go,{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?"上传中…":"上传"})]})]})}const mmt=12,pY=12;function E_({disabled:e,placement:t="top",children:n}){const r=m.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 gmt={active:"可用",available:"可用",creating:"创建中",disabled:"已停用",enabled:"已启用",failed:"异常",inactive:"未启用",pending:"等待中",published:"已发布",ready:"就绪",released:"已发布",running:"运行中",success:"正常",unavailable:"不可用",unreleased:"未发布",updating:"更新中"};function G3(e){return gmt[(e||"").trim().toLowerCase()]||"未知"}function mY(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 gY(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 bY(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 cc(e){return`${e.region||"default"}:${e.projectName||"default"}:${e.id}`}function bmt(e,t){const n=new Map(e.map(r=>[cc(r),r]));for(const r of t)n.set(cc(r),r);return[...n.values()].sort((r,i)=>bY(i.updatedAt)-bY(r.updatedAt))}function Omt(e){const t=e.replace(/\r\n/g,` +`)}function cmt(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)}/${C0e})`:lmt(e.task)}function pY(){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 umt(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 dmt(e){return e?e.length>64?"Skill 名称不能超过 64 个字符":/^[a-z0-9-]+$/.test(e)?"":"Skill 名称只能包含小写字母、数字和连字符":""}function mY(e){return e?e.length>128?"模型 ID 不能超过 128 个字符":/^[A-Za-z0-9][A-Za-z0-9._:/-]*$/.test(e)?"":"模型 ID 只能包含字母、数字、点、下划线、连字符、斜杠和冒号":""}function nD(e){return`${e.region||""}:${e.id}`}function fmt(){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 hmt({operation:e,cloudProvider:t,space:n,availableSpaces:r=[],spacesLoading:i=!1,initialIntent:s="",source:a,onBack:l,onPublished:c}){var W,ne,he,xe;const[u,d]=m.useState(null),[f,h]=m.useState(null),[p,b]=m.useState(s),[g,O]=m.useState(""),[y,v]=m.useState([]),[x,w]=m.useState([]),[S,E]=m.useState(""),[k,T]=m.useState(!1),[C,N]=m.useState(""),[_,R]=m.useState(""),[$,D]=m.useState(null),[M,j]=m.useState(""),[P,L]=m.useState(""),[U,F]=m.useState(n?nD(n):""),[q,z]=m.useState(Date.now()),B=m.useRef([]);m.useEffect(()=>{const re=new AbortController;return mC(re.signal).then(Re=>{d(Re),v([fY(0,Re)])}).catch(Re=>{re.signal.aborted||h(Us(Re,"读取 Dev Sandbox 配置失败"))}),()=>re.abort()},[]),m.useEffect(()=>{B.current=x},[x]),m.useEffect(()=>{const re=window.setInterval(()=>z(Date.now()),1e3);return()=>window.clearInterval(re)},[]),m.useEffect(()=>{const re=Re=>{B.current.some(nt=>{var Ke;return((Ke=nt.task)==null?void 0:Ke.state)==="running"||nt.repairing})&&Re.preventDefault()};return window.addEventListener("beforeunload",re),()=>{var Re;window.removeEventListener("beforeunload",re);for(const nt of B.current)(Re=nt.task)!=null&&Re.jobId&&MJe(nt.task.jobId).catch(()=>{})}},[]),m.useEffect(()=>{if(!x.some(Ke=>{var tn;return((tn=Ke.task)==null?void 0:tn.state)==="running"||Ke.repairing}))return;let re=!1,Re;const nt=async()=>{const Ke=B.current,tn=await Promise.all(Ke.map(async Gt=>{var At;if(((At=Gt.task)==null?void 0:At.state)!=="running")return Gt;try{const St=await IJe(Gt.task.jobId);if(tD(St)&&(Gt.repairAttempts||0)Y.map(mt=>mt.id===Gt.id?{...mt,task:St,repairing:!0,repairMode:"auto",repairAttempts:Ue,repairError:void 0}:mt));try{const Y=await WR({jobId:St.jobId,intent:hY(St),expectedRevision:St.revision});return{...Gt,task:Y,artifact:void 0,repairing:!1,repairMode:"auto",repairAttempts:Ue,repairError:void 0,error:void 0,pollError:void 0}}catch(Y){return{...Gt,task:St,repairing:!1,repairMode:void 0,repairAttempts:Ue,repairError:Us(Y,"自动修复格式错误失败"),pollError:void 0}}}let ve=Gt.artifact;return St.state==="ready"&&(ve=await YR(St.jobId,St.revision)),{...Gt,task:St,artifact:ve,repairing:!1,repairMode:St.state==="running"?Gt.repairMode:void 0,repairError:void 0,error:void 0,pollError:void 0}}catch(St){return{...Gt,pollError:Us(St,"读取候选方案状态失败,正在重试")}}}));re||(w(tn),Re=window.setTimeout(()=>void nt(),imt))};return nt(),()=>{re=!0,Re!==void 0&&window.clearTimeout(Re)}},[x.some(re=>{var Re;return((Re=re.task)==null?void 0:Re.state)==="running"||re.repairing})]);const V=x.find(re=>re.id===S)||x[0],ce=e==="create"&&!n,we=r.find(re=>nD(re)===U)??null,Oe=n??we,de=r.map(re=>({value:nD(re),label:`${re.name.trim()||"未命名 Skill Space"} · ${Ec(re.region||"cn-beijing",t)}`})),Z=dmt(g),J=!!(u!=null&&u.enabled&&p.trim()&&!Z&&y.length>0&&y.every(re=>re.model.trim()&&!mY(re.model.trim()))),fe=(re,Re)=>{v(nt=>nt.map(Ke=>Ke.id===re?{...Ke,...Re}:Ke))},be=async re=>{const Re={...re,model:re.model.trim()},nt=re.style==="custom"?re.customStyle.trim():re.style;try{const Ke=await RJe({operation:e,intent:p.trim(),model:Re.model,style:nt,name:g.trim()||void 0,source:a});return{id:re.id,config:Re,task:Ke}}catch(Ke){return{id:re.id,config:Re,error:Us(Ke,"创建候选方案失败")}}},je=async()=>{if(!J)return;T(!0),D(null);const re=y.map(nt=>({id:nt.id,config:nt}));w(re),E(y[0].id);const Re=await Promise.all(y.map(be));w(Re)},Qe=async re=>{w(nt=>nt.map(Ke=>Ke.id===re.id?{...Ke,error:void 0}:Ke));const Re=await be(re.config);w(nt=>nt.map(Ke=>Ke.id===re.id?Re:Ke))},Me=async()=>{if(!(!(V!=null&&V.task)||!C.trim()||V.task.state!=="ready")){R("refine"),D(null);try{const re=await WR({jobId:V.task.jobId,intent:C.trim(),expectedRevision:V.task.revision});w(Re=>Re.map(nt=>nt.id===V.id?{...nt,task:re,artifact:void 0}:nt)),N("")}catch(re){D(Us(re,"继续调整失败"))}finally{R("")}}},le=async()=>{if(!(!(V!=null&&V.task)||!tD(V.task))){R("refine"),D(null),w(re=>re.map(Re=>Re.id===V.id?{...Re,repairing:!0,repairMode:"manual",repairError:void 0}:Re));try{const re=await WR({jobId:V.task.jobId,intent:hY(V.task),expectedRevision:V.task.revision});w(Re=>Re.map(nt=>nt.id===V.id?{...nt,task:re,artifact:void 0,repairing:!1,repairMode:"manual",repairError:void 0}:nt))}catch(re){w(Re=>Re.map(nt=>nt.id===V.id?{...nt,repairing:!1,repairMode:void 0,repairError:Us(re,"再次修复格式错误失败")}:nt))}finally{R("")}}},ke=async()=>{if(!(!(V!=null&&V.task)||V.task.state!=="ready"||P)){R("publish"),D(null);try{if(!Oe)throw new Error("请选择上传的 Skill Space");const re=V.artifact||await YR(V.task.jobId,V.task.revision),Re=(a==null?void 0:a.region)||Oe.region||"";if(!l6(Re))throw new Error("当前 Skill 地域不受支持");await PJe({jobId:V.task.jobId,expectedRevision:V.task.revision,expectedArtifactSha256:re.sha256,disposition:e==="optimize"?"update-source":"create-new",skillSpaceIds:[Oe.id],projectName:(a==null?void 0:a.projectName)||Oe.projectName,region:Re,onProgress:nt=>j(nt.message)}),L(V.id),c()}catch(re){D(Us(re,"上传 Skill 失败"))}finally{R(""),j("")}}},ye=async()=>{if(!(!(V!=null&&V.task)||V.task.state!=="ready")){R("download");try{const re=V.artifact||await YR(V.task.jobId,V.task.revision);await LJe(V.task.jobId,V.task.revision,re.sha256)}catch(re){D(Us(re,"下载失败"))}finally{R("")}}},$e=async()=>{x.some(re=>{var Re;return((Re=re.task)==null?void 0:Re.state)==="running"})&&!window.confirm("离开后将停止并释放正在运行的 Dev Sandbox,确定离开吗?")||(await Promise.allSettled(x.flatMap(re=>{var Re;return((Re=re.task)==null?void 0:Re.state)==="running"?[DJe({jobId:re.task.jobId,expectedRevision:re.task.revision})]:[]})),l())},ze=e==="create"?"创建技能":`优化 ${(a==null?void 0:a.name)||"技能"}`,Ae=re=>{var Re;return((Re=u==null?void 0:u.models.find(nt=>nt.id===re))==null?void 0:Re.label)||re},Ve=re=>re.config.style==="custom"?re.config.customStyle.trim()||"自定义风格":N0e[re.config.style],ut=re=>re.error||re.repairError?"失败":cmt(re),Tt=re=>!re.error&&!re.repairError&&(re.repairing||!re.task||re.task.state==="running"),We=x.some(re=>{var Re;return((Re=re.task)==null?void 0:Re.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 $e(),"aria-label":"返回技能空间",children:o.jsx(fmt,{})}),o.jsxs("div",{children:[o.jsx("h1",{children:ze}),o.jsx("p",{children:(n==null?void 0:n.name)||"主页技能生成"})]}),x.length>0?o.jsx("span",{className:"skill-generation__ttl",children:umt(V==null?void 0:V.task,q)}):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(re=>o.jsxs("button",{type:"button",role:"tab","aria-selected":(V==null?void 0:V.id)===re.id,className:(V==null?void 0:V.id)===re.id?"is-active":"",onClick:()=>E(re.id),children:[o.jsxs("span",{className:"skill-generation__summary-row",children:[o.jsx("span",{children:"风格"}),o.jsx("strong",{children:Ve(re)})]}),o.jsxs("span",{className:"skill-generation__summary-row",children:[o.jsx("span",{children:"模型"}),o.jsx("strong",{children:Ae(re.config.model)})]}),o.jsxs("span",{className:"skill-generation__summary-row",children:[o.jsx("span",{children:"进度"}),o.jsxs("strong",{children:[Tt(re)?o.jsx(pY,{}):null,ut(re)]})]})]},re.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:Ve(V)})]}),o.jsxs("div",{className:"skill-generation__summary-row",children:[o.jsx("span",{children:"模型"}),o.jsx("strong",{children:Ae(V.config.model)})]}),o.jsxs("div",{className:"skill-generation__summary-row","aria-live":"polite",children:[o.jsx("span",{children:"进度"}),o.jsxs("strong",{children:[Tt(V)?o.jsx(pY,{}):null,Tt(V)?o.jsx(Ln,{children:ut(V)}):ut(V)]})]})]})}),V.task?o.jsx(jet,{activities:V.task.activities}):null,V.pollError?o.jsx("div",{className:"skill-inline-notice",children:o.jsx(Go,{error:V.pollError})}):null,V.repairError?o.jsx("div",{className:"skill-inline-notice",children:o.jsx(Go,{error:V.repairError})}):null,V.error?o.jsxs("div",{className:"skill-inline-error",children:[o.jsx(Go,{error:V.error}),o.jsx("button",{type:"button",onClick:()=>void Qe(V),children:"重试此方案"})]}):null,(W=V.task)!=null&&W.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(re=>o.jsx("p",{children:re},re)),tD(V.task)?o.jsx("button",{type:"button",disabled:!!_,onClick:()=>void le(),children:"再次修复"}):null]}):null]}),o.jsxs("section",{className:"skill-generation__files",children:[o.jsxs("header",{children:[o.jsx("h2",{children:"文件"}),((ne=V.task)==null?void 0:ne.state)==="ready"?o.jsx("button",{type:"button",onClick:()=>void ye(),disabled:!!_,children:"下载 ZIP"}):null]}),V.artifact?o.jsx(A0e,{files:V.artifact.files}):o.jsx("div",{className:"skill-generation__files-empty",children:((he=V.task)==null?void 0:he.state)==="ready"?"正在读取文件…":"生成过程中会在这里显示完整文件树"})]}),((xe=V.task)==null?void 0:xe.state)==="ready"?o.jsxs("div",{className:"skill-generation__ready-actions",children:[ce?o.jsx("div",{className:"skill-generation__publish-target",children:o.jsx(Gk,{label:"上传到 Skill Space",value:U,options:de,onChange:F,disabled:i,placeholder:i?"正在加载 Skill Space":"选择 Skill Space"})}):null,o.jsxs("footer",{className:"skill-generation__followup",children:[o.jsx("textarea",{value:C,onChange:re=>N(re.target.value),placeholder:"继续调整这个候选方案"}),o.jsx("button",{type:"button",className:"skill-button",disabled:!C.trim()||!!_,onClick:()=>void Me(),children:"继续调整"}),o.jsx("button",{type:"button",className:"skill-button skill-button--primary",disabled:!!_||!!P||!Oe,onClick:()=>void ke(),children:_==="publish"?M||"上传中…":e==="optimize"?"覆盖原 Skill":ce?"上传到 Skill Space":"上传到当前空间"})]})]}):null,$?o.jsx("div",{className:"skill-inline-error skill-generation__action-error",children:o.jsx(Go,{error:$})}):null]}):null,!We&&x.every(re=>re.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:p,onChange:re=>b(re.target.value),placeholder:e==="create"?"描述希望这个 Skill 完成什么任务":"描述希望如何优化当前 Skill"})]}),o.jsxs("label",{children:[o.jsx("span",{children:"Skill 名称"}),o.jsx("input",{value:g,onChange:re=>O(re.target.value),placeholder:"留空时自动生成","aria-invalid":!!Z,"aria-describedby":"skill-name-help"}),Z?o.jsx("span",{id:"skill-name-help",className:"skill-generation__field-error",role:"alert",children:Z}):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:[y.map((re,Re)=>o.jsxs("article",{className:"skill-generation__group",children:[o.jsxs("header",{children:[o.jsxs("strong",{children:["方案 ",Re+1]}),y.length>1?o.jsx("button",{type:"button",onClick:()=>v(nt=>nt.filter(Ke=>Ke.id!==re.id)),children:"移除"}):null]}),o.jsx(Gk,{label:"模型",required:!0,value:re.model,options:(u==null?void 0:u.models.map(nt=>({value:nt.id,label:nt.label})))||[],onChange:nt=>fe(re.id,{model:nt}),allowCustom:!0,placeholder:"选择或输入模型 ID",error:mY(re.model.trim())}),o.jsx(Gk,{label:"风格",required:!0,value:re.style,options:omt,onChange:nt=>fe(re.id,{style:nt})}),re.style==="custom"?o.jsxs("label",{children:[o.jsx("span",{children:"自定义风格"}),o.jsx("textarea",{value:re.customStyle,onChange:nt=>fe(re.id,{customStyle:nt.target.value}),placeholder:"描述表达方式、严谨程度或输出偏好"})]}):null]},re.id)),u&&y.lengthv(re=>[...re,fY(re.length,u)]),children:"添加配置"}):null]}),f?o.jsx("div",{className:"skill-inline-error",children:o.jsx(Go,{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:!J,onClick:()=>void je(),children:"生成"})})]})]})}function P9({title:e,children:t,onClose:n,className:r=""}){const i=m.useRef(null);return m.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 pmt({region:e,regionOptions:t,onClose:n,onCreated:r}){const[i,s]=m.useState(""),[a,l]=m.useState(""),[c,u]=m.useState(e),[d,f]=m.useState(!1),[h,p]=m.useState(null),b=async()=>{if(i.trim()){f(!0),p(null);try{const g=await gJe({name:i.trim(),description:a.trim()||void 0,region:c});r({...g,region:g.region||c})}catch(g){p(Us(g,"创建 Skill 空间失败"))}finally{f(!1)}}};return o.jsxs(P9,{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:g=>s(g.target.value)})]}),o.jsx(Gk,{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:g=>l(g.target.value)})]}),h?o.jsx("div",{className:"skill-inline-error",children:o.jsx(Go,{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 b(),children:d?"创建中…":"创建"})]})]})}function mmt({space:e,region:t,onClose:n,onUpdated:r}){const[i,s]=m.useState(e.name),[a,l]=m.useState(e.description||""),[c,u]=m.useState(!1),[d,f]=m.useState(null),h=async()=>{if(i.trim()){u(!0),f(null);try{const p=await bJe({spaceId:e.id,name:i.trim(),description:a.trim()||void 0,region:t});r({...e,...p,skillCount:e.skillCount})}catch(p){f(Us(p,"更新 Skill 空间失败"))}finally{u(!1)}}};return o.jsxs(P9,{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:p=>s(p.target.value)})]}),o.jsxs("label",{children:[o.jsx("span",{children:"描述(可选)"}),o.jsx("textarea",{value:a,maxLength:1024,onChange:p=>l(p.target.value)})]}),d?o.jsx("div",{className:"skill-inline-error",children:o.jsx(Go,{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 gmt({space:e,region:t,onClose:n,onUploaded:r}){const[i,s]=m.useState(null),[a,l]=m.useState(null),[c,u]=m.useState(!1),[d,f]=m.useState(!1),[h,p]=m.useState(null),[b,g]=m.useState(!1),O=m.useRef(0),y=m.useRef(null),v=async w=>{const S=O.current+1;if(O.current=S,s(w),l(null),p(null),u(!!w),!!w)try{const E=await xJe(w);O.current===S&&l({name:E.name,fileCount:E.files.length})}catch(E){O.current===S&&p(Us(E,"Skill ZIP 格式校验失败"))}finally{O.current===S&&u(!1)}},x=async()=>{if(!(!i||!a)){f(!0),p(null);try{await yJe({spaceId:e.id,region:t,project:e.projectName,file:i}),r()}catch(w){p(Us(w,"上传 Skill 失败"))}finally{f(!1)}}};return o.jsxs(P9,{title:`上传到 ${e.name}`,className:"skill-upload-dialog",onClose:n,children:[o.jsxs("div",{className:"skill-dialog__body",children:[o.jsx("input",{ref:y,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${b?" is-dragging":""}`,onClick:()=>{var w;return(w=y.current)==null?void 0:w.click()},onDragEnter:w=>{w.preventDefault(),g(!0)},onDragOver:w=>{w.preventDefault(),w.dataTransfer.dropEffect="copy",g(!0)},onDragLeave:w=>{w.currentTarget.contains(w.relatedTarget)||g(!1)},onDrop:w=>{var S;w.preventDefault(),g(!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(Go,{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?"上传中…":"上传"})]})]})}const bmt=12,gY=12;function T_({disabled:e,placement:t="top",children:n}){const r=m.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 Omt={active:"可用",available:"可用",creating:"创建中",disabled:"已停用",enabled:"已启用",failed:"异常",inactive:"未启用",pending:"等待中",published:"已发布",ready:"就绪",released:"已发布",running:"运行中",success:"正常",unavailable:"不可用",unreleased:"未发布",updating:"更新中"};function W3(e){return Omt[(e||"").trim().toLowerCase()]||"未知"}function bY(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 OY(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 yY(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 cc(e){return`${e.region||"default"}:${e.projectName||"default"}:${e.id}`}function ymt(e,t){const n=new Map(e.map(r=>[cc(r),r]));for(const r of t)n.set(cc(r),r);return[...n.values()].sort((r,i)=>yY(i.updatedAt)-yY(r.updatedAt))}function xmt(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 C0e(e){const t=(e||"").trim();return!t||[">",">-","|","|-"].includes(t)?"暂无描述":t}function ymt(){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 OY(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 yY(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 xmt(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m14.5 6-6 6 6 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})})}function xY({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 N0e(){return o.jsx("span",{className:"skillcenter-loading-mark","aria-hidden":!0})}function vmt({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(xY,{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(xY,{direction:"right"})})]})]})}function wmt({children:e}){return o.jsx("div",{className:"skillcenter-empty",children:e})}function tD({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(ln,{fill:"none",children:[o.jsx(ln.Title,{children:t}),n?o.jsx(ln.Description,{children:n}):null,r?o.jsx(Go,{error:r}):null,i?o.jsx(ln.ActionRow,{children:o.jsx(vn,{color:"secondary",size:"lg",onClick:i.onClick,children:i.label})}):null]})})}function vY({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:Ec(i,t)}),o.jsx(Go,{error:s})]},i))]}),o.jsx("button",{type:"button",onClick:r,children:"重新加载"})]})}function Smt({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 m.useEffect(()=>{const h=p=>{p.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:C0e((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(E_,{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(ymt,{})})]})]}),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:G3(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:Ec(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(N0e,{}),"正在读取技能内容…"]}):l?o.jsx("div",{className:"skillcenter-error",children:o.jsx(Go,{error:l})}):s.length>0?o.jsx(T0e,{files:s.map(h=>h.path.endsWith("SKILL.md")&&h.content?{...h,content:Omt(h.content)}:h)}):o.jsx(wmt,{children:"该技能暂无 SKILL.md 内容"})]})]})})}function Emt({space:e,canUseSandbox:t,onUpload:n,onSandbox:r,onClose:i}){return m.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(E_,{disabled:!t,placement:"inside",children:o.jsxs("button",{type:"button",disabled:!t,onClick:r,children:[o.jsx("strong",{children:"自动创建"}),o.jsx("span",{children:"选择模型和风格,通过对话生成技能"})]})})]})]})})}function kmt({cloudProvider:e="volcengine",active:t=!0,activationRevision:n=0,initialWorkspace:r=null,onInitialWorkspaceConsumed:i,onPageTitleChange:s}){var Ut;const a=m.useMemo(()=>kb(e).map(Ce=>Ce.value),[e]),[l,c]=m.useState([]),[u,d]=m.useState({}),[f,h]=m.useState(!1),[p,b]=m.useState(""),[g,O]=m.useState((r==null?void 0:r.space)??null),[y,v]=m.useState([]),[x,w]=m.useState(1),[S,E]=m.useState(0),[k,T]=m.useState(!1),[C,N]=m.useState(null),[_,R]=m.useState(""),[$,D]=m.useState(null),[M,j]=m.useState(null),[P,L]=m.useState([]),[U,F]=m.useState(!1),[q,z]=m.useState(null),[B,V]=m.useState(null),[ce,we]=m.useState(!1),[Oe,de]=m.useState(null),[Z,J]=m.useState(null),[fe,be]=m.useState(null),[je,Qe]=m.useState(0),[Me,le]=m.useState(0),[ke,ye]=m.useState(""),[$e,ze]=m.useState(""),[Ae,Ve]=m.useState(null),[ut,Tt]=m.useState(r),We=m.useRef(0),W=m.useRef(0),ne=m.useRef(!1),he=m.useRef(null),xe=m.useRef(null),re=m.useRef(null),Re=m.useDeferredValue(p),nt=m.useDeferredValue(_),tn=(ut&&(g||ut.selectPublishSpace)?ut.operation==="create"?"创建技能":`优化 ${((Ut=ut.source)==null?void 0:Ut.name)||"技能"}`:"")||(g==null?void 0:g.name)||"技能库";m.useEffect(()=>{t&&(s==null||s(tn))},[t,s,tn]),m.useEffect(()=>{r&&(i==null||i())},[r,i]);const Gt=m.useMemo(()=>{const Ce=Re.trim().toLocaleLowerCase();return Ce?l.filter(Ze=>`${Ze.name} ${Ze.description||""} ${Ze.projectName||""}`.toLocaleLowerCase().includes(Ce)):l},[Re,l]),At=m.useMemo(()=>{const Ce=nt.trim().toLocaleLowerCase();return Ce?y.filter(Ze=>`${Ze.skillName} ${Ze.skillDescription||""}`.toLocaleLowerCase().includes(Ce)):y},[nt,y]),St=(g==null?void 0:g.region)||Hr(e),ve=m.useMemo(()=>a.flatMap(Ce=>{var $t;const Ze=($t=u[Ce])==null?void 0:$t.error;return Ze?[{region:Ce,error:Ze}]:[]}),[u,a]),Ue=a.some(Ce=>{const Ze=u[Ce];return!!(Ze&&!Ze.done&&!Ze.error)}),Y=ve.length===a.length;m.useEffect(()=>{const Ce=new AbortController;return hC(Ce.signal).then(V).catch(()=>V({enabled:!1,reason:"管理员未配置",operations:["create","optimize"],models:[],styles:{}})),()=>Ce.abort()},[]);const mt=m.useCallback(async(Ce,Ze)=>{var at;if(ne.current||Ce.length===0)return;ne.current=!0,h(!0),Ze&&((at=he.current)==null||at.abort(),c([]),d(Object.fromEntries(Ce.map(({region:Lt})=>[Lt,{nextPage:1,loadedCount:0,done:!1,error:null}]))));const $t=new AbortController;he.current=$t;const En=++W.current,gn=await Promise.allSettled(Ce.map(async({region:Lt,page:Wt})=>({region:Lt,page:Wt,result:await hJe({region:Lt,page:Wt,pageSize:mmt,signal:$t.signal})})));if(W.current!==En)return;const xr=gn.map((Lt,Wt)=>{const fn=Ce[Wt];return Lt.status==="rejected"?{request:fn,error:Fs(Lt.reason,"读取技能空间失败,请稍后重试"),items:[],totalCount:0}:{request:fn,error:null,items:(Lt.value.result.items||[]).map(Jt=>({...Jt,region:Jt.region||Lt.value.region})),totalCount:Lt.value.result.totalCount||0}}),Pe=xr.flatMap(Lt=>Lt.items);d(Lt=>{const Wt={...Lt};return xr.forEach(({request:fn,error:Jt,items:or,totalCount:Sr})=>{const si=Wt[fn.region]||{nextPage:fn.page,loadedCount:0,done:!1,error:null};if(Jt){Wt[fn.region]={...si,error:Jt};return}const Yt=si.loadedCount+or.length;Wt[fn.region]={nextPage:fn.page+1,loadedCount:Yt,done:or.length===0||Yt>=Sr,error:null}}),Wt}),c(Lt=>bmt(Ze?[]:Lt,Pe)),O(Lt=>Lt&&(Pe.find(Wt=>cc(Wt)===cc(Lt))||Lt)),ne.current=!1,h(!1)},[]),xt=m.useCallback(()=>{if(ne.current)return;const Ce=a.flatMap(Ze=>{const $t=u[Ze];return $t&&!$t.done&&!$t.error?[{region:Ze,page:$t.nextPage}]:[]});mt(Ce,!1)},[mt,u,a]);m.useEffect(()=>{Pt(),O(null),v([]),w(1)},[e]),m.useEffect(()=>{if(t)return mt(a.map(Ce=>({region:Ce,page:1})),!0),()=>{var Ce;W.current+=1,(Ce=he.current)==null||Ce.abort(),ne.current=!1}},[t,n,mt,a,je]),m.useEffect(()=>{const Ce=re.current,Ze=xe.current;if(!Ce||!Ze||!Ue||f)return;const $t=new IntersectionObserver(([En])=>{En.isIntersecting&&xt()},{root:Ze,rootMargin:"240px 0px",threshold:.01});return $t.observe(Ce),()=>$t.disconnect()},[Ue,xt,f]);const Dt=()=>{const Ce=xe.current;!Ce||!Ue||f||Ce.scrollHeight-Ce.scrollTop-Ce.clientHeight<=240&&xt()};m.useEffect(()=>{if(!g){v([]),E(0);return}let Ce=!0;return T(!0),N(null),wJe(g.id,{region:St,page:x,pageSize:pY,project:g.projectName}).then(Ze=>{Ce&&(v(Ze.items||[]),E(Ze.totalCount||0))}).catch(Ze=>{Ce&&(v([]),E(0),N(Fs(Ze,"读取技能失败,请稍后重试")))}).finally(()=>{Ce&&T(!1)}),()=>{Ce=!1}},[St,g,x,Me]);const Ne=Ce=>{Pt(),O(Ce),w(1),R("")},Ge=()=>{Pt(),O(null),v([]),E(0),w(1),R(""),Ve(null)},Pt=()=>{We.current+=1,D(null),j(null),L([]),z(null),F(!1)},Kt=async Ce=>{if(!g)return;const Ze=We.current+1;We.current=Ze,D(Ce),j(null),z(null),F(!0);try{const[$t,En]=await Promise.all([SJe(g.id,Ce.skillId,Ce.version,St,g.projectName,Ce.skillName,g.name),xJe({spaceId:g.id,skillId:Ce.skillId,version:Ce.version,region:St,skillSpaceName:g.name,skillName:Ce.skillName})]);We.current===Ze&&(j($t),L(En))}catch($t){We.current===Ze&&z(Fs($t,"读取技能详情失败,请稍后重试"))}finally{We.current===Ze&&F(!1)}},tt=Ce=>{if(g)return{kind:"skill-center",skillId:Ce.skillId,version:Ce.version,region:St,projectName:g.projectName,skillSpaceId:g.id,skillSpaceName:g.name,name:Ce.skillName,description:Ce.skillDescription}},an=Ce=>{const Ze=tt(Ce);!Ze||!(B!=null&&B.enabled)||(Pt(),Tt({operation:"optimize",source:Ze}))},ar=async Ce=>{if(!(!g||!window.confirm(`确定删除整个 Skill“${Ce.skillName}”吗?此操作会影响所有引用它的空间。`))){ye(Ce.skillId),Ve(null);try{await yJe({spaceId:g.id,skillId:Ce.skillId,region:St}),le(Ze=>Ze+1),Qe(Ze=>Ze+1)}catch(Ze){Ve(Fs(Ze,"删除 Skill 失败"))}finally{ye("")}}},Qt=async Ce=>{if(!window.confirm(`确定删除 Skill 空间“${Ce.name}”吗?请先确认空间中的技能已删除。`))return;const Ze=cc(Ce);ze(Ze),Ve(null);try{await gJe({spaceId:Ce.id,region:Ce.region||Hr(e)}),g&&cc(g)===Ze&&Ge(),Qe($t=>$t+1)}catch($t){Ve(Fs($t,"删除 Skill 空间失败"))}finally{ze("")}};return ut&&(g||ut.selectPublishSpace)?o.jsx(dmt,{operation:ut.operation,cloudProvider:e,space:g??void 0,availableSpaces:l,spacesLoading:f,initialIntent:ut.initialIntent,source:ut.source,onBack:()=>Tt(null),onPublished:()=>{le(Ce=>Ce+1),Qe(Ce=>Ce+1)}}):o.jsxs("section",{className:`skillcenter${g?" is-space":" my-agents-page"}`,children:[g?o.jsxs(o.Fragment,{children:[o.jsxs("header",{className:"skillcenter-page-header",children:[o.jsxs("div",{className:"skillcenter-page-heading skillcenter-page-heading--back",children:[o.jsx("button",{type:"button",className:"skillcenter-back",onClick:Ge,"aria-label":"返回技能空间",children:o.jsx(xmt,{})}),o.jsxs("div",{children:[o.jsx("h1",{title:g.name,children:g.name}),o.jsx("p",{children:g.description||"管理空间中的技能并创建新的版本"})]})]}),o.jsxs("label",{className:"skillcenter-search",children:[o.jsx(OY,{}),o.jsx("input",{type:"search","aria-label":"搜索技能",value:_,onChange:Ce=>R(Ce.target.value),placeholder:"搜索技能"})]})]}),o.jsxs("div",{className:"skillcenter-toolbar",children:[o.jsxs("div",{className:"skillcenter-detail-facts",children:[o.jsxs("div",{children:[o.jsx("span",{children:"技能数量"}),o.jsx("strong",{children:S})]}),o.jsxs("div",{children:[o.jsx("span",{children:"更新时间"}),o.jsx("strong",{children:g.updatedAt?gY(g.updatedAt):"—"})]})]}),o.jsxs("div",{className:"skillcenter-toolbar-actions",children:[o.jsx("button",{type:"button",className:"skillcenter-secondary-action",onClick:()=>be(g),children:"本地上传"}),o.jsx(E_,{disabled:!(B!=null&&B.enabled),children:o.jsxs("button",{type:"button",className:"skillcenter-primary-action",disabled:!(B!=null&&B.enabled),onClick:()=>Tt({operation:"create"}),children:[o.jsx(yY,{}),o.jsx("span",{children:"创建技能"})]})})]})]}),Ae?o.jsx("div",{className:"skillcenter-inline-error",role:"alert",children:o.jsx(Go,{error:Ae})}):null,o.jsxs("section",{className:"skillcenter-results","aria-label":`${g.name}中的技能`,children:[k&&y.length===0?o.jsxs("div",{className:"skillcenter-loading",children:[o.jsx(N0e,{}),"正在加载技能"]}):C&&y.length===0?o.jsx(tD,{kind:"error",title:"无法加载技能",error:C,action:{label:"重新加载",onClick:()=>le(Ce=>Ce+1)}}):At.length===0?o.jsx(tD,{kind:"empty",title:_.trim()?"没有匹配的技能":"暂无技能",description:_.trim()?"请尝试搜索其他名称":"本地上传 Skill,或自动创建",action:_.trim()?void 0:{label:"本地上传",onClick:()=>be(g)}}):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:At.map(Ce=>o.jsxs("tr",{children:[o.jsx("td",{className:"skillcenter-table__skill",children:o.jsxs("button",{type:"button",onClick:()=>void Kt(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:C0e(Ce.skillDescription)})]})}),o.jsx("td",{children:o.jsx("span",{className:`skillcenter-status ${mY(Ce.skillStatus)}`,children:G3(Ce.skillStatus)})}),o.jsx("td",{children:o.jsxs("div",{className:"skillcenter-table__actions",children:[o.jsx("button",{type:"button",onClick:()=>void Kt(Ce),children:"查看"}),o.jsx(E_,{disabled:!(B!=null&&B.enabled),children:o.jsx("button",{type:"button",disabled:!(B!=null&&B.enabled),onClick:()=>an(Ce),children:"优化"})}),o.jsx("button",{type:"button",className:"is-danger",disabled:ke===Ce.skillId,onClick:()=>void ar(Ce),children:ke===Ce.skillId?"删除中…":"删除"})]})})]},`${Ce.skillId}:${Ce.version}`))})]})}),!_.trim()&&!k&&!C&&S>0?o.jsx(vmt,{page:x,total:S,pageSize:pY,onPage:w}):null]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"my-agent-type-bar skillcenter-list-toolbar library-resource-toolbar",children:[o.jsxs("button",{type:"button",className:"my-agent-create-primary",onClick:()=>we(!0),children:[o.jsx(yY,{}),o.jsx("span",{children:"新建空间"})]}),o.jsxs("label",{className:"my-agent-search",children:[o.jsx(OY,{}),o.jsx("input",{type:"search","aria-label":"搜索技能空间",value:p,onChange:Ce=>b(Ce.target.value),placeholder:"搜索技能空间"})]})]}),Ae?o.jsx("div",{className:"skillcenter-inline-error",role:"alert",children:o.jsx(Go,{error:Ae})}):null,o.jsxs("section",{className:"my-agent-results",ref:xe,"aria-label":"技能空间列表",onScroll:Dt,children:[ve.length>0&&!Y?o.jsx(vY,{errors:ve,cloudProvider:e,onRetry:()=>Qe(Ce=>Ce+1)}):null,f&&l.length===0?o.jsxs("div",{className:"my-agent-initial-loading",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载技能空间"})]}):Y&&l.length===0?o.jsx(vY,{errors:ve,cloudProvider:e,fullPage:!0,onRetry:()=>Qe(Ce=>Ce+1)}):Gt.length===0?o.jsx(tD,{kind:"empty",title:p.trim()?"没有匹配的技能空间":"暂无技能空间",description:p.trim()?"请尝试搜索其他名称":"新建一个空间,开始管理和创建技能",action:p.trim()?void 0:{label:"新建空间",onClick:()=>we(!0)}}):o.jsx(o.Fragment,{children:o.jsx("div",{className:"my-agent-grid",children:Gt.map(Ce=>{const Ze=cc(Ce);return o.jsx(Zle,{className:"skillcenter-space-card",title:Ce.name,status:o.jsx("span",{className:`skillcenter-status ${mY(Ce.status)}`,children:G3(Ce.status)}),description:Ce.description||"暂无描述",metadata:[{label:"地域",value:Ec(Ce.region||Hr(e),e)},{label:"技能数量",value:Ce.skillCount??0},{label:"更新时间",value:Ce.updatedAt?gY(Ce.updatedAt):"—"}],secondaryAction:{label:"添加技能",onClick:()=>J(Ce)},primaryAction:{label:"查看详情",onClick:()=>Ne(Ce)},menuLabel:`更多空间操作:${Ce.name}`,menuAriaLabel:`${Ce.name}空间操作`,menuActions:[{label:"编辑空间",onClick:()=>de(Ce)},{label:"删除空间",danger:!0,disabled:$e===Ze,onClick:()=>void Qt(Ce)}]},Ze)})})}),!Y&&l.length>0?o.jsx("div",{className:"my-agent-load-more",ref:re,"aria-live":"polite",children:f?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载更多技能空间"})]}):Ue?o.jsx("span",{children:"继续下滑加载更多"}):ve.length>0?o.jsx("span",{children:"部分技能空间加载失败"}):o.jsx("span",{children:"已加载全部技能空间"})}):null]})]}),$&&g&&o.jsx(Smt,{skill:$,space:g,region:St,cloudProvider:e,detail:M,files:P,loading:U,error:q,canOptimize:(B==null?void 0:B.enabled)===!0,onOptimize:()=>an($),onDownload:()=>void vJe({spaceId:g.id,skillId:$.skillId,version:$.version,region:St,fallbackName:$.skillName,skillSpaceName:g.name,skillName:$.skillName}).catch(Ce=>z(Fs(Ce,"下载 Skill 失败"))),onClose:Pt}),ce?o.jsx(fmt,{region:Hr(e),regionOptions:kb(e),onClose:()=>we(!1),onCreated:Ce=>{we(!1),Qe(Ze=>Ze+1),O({...Ce,region:Ce.region||Hr(e)})}}):null,Oe?o.jsx(hmt,{space:Oe,region:Oe.region||Hr(e),onClose:()=>de(null),onUpdated:Ce=>{const Ze={...Ce,region:Ce.region||Oe.region||Hr(e)};de(null),O($t=>$t&&cc($t)===cc(Ze)?Ze:$t),c($t=>$t.map(En=>cc(En)===cc(Ze)?Ze:En)),Qe($t=>$t+1)}}):null,Z?o.jsx(Emt,{space:Z,canUseSandbox:(B==null?void 0:B.enabled)===!0,onClose:()=>J(null),onUpload:()=>{be(Z),J(null)},onSandbox:()=>{const Ce=Z;J(null),Ne(Ce),Tt({operation:"create"})}}):null,fe?o.jsx(pmt,{space:fe,region:fe.region||Hr(e),onClose:()=>be(null),onUploaded:()=>{be(null),le(Ce=>Ce+1),Qe(Ce=>Ce+1)}}):null]})}const xp=[{id:"skills",label:"技能库"},{id:"knowledge",label:"知识库"},{id:"artifacts",label:"产物"}];function Tmt({cloudProvider:e,activeTab:t,onTabChange:n,onPageTitleChange:r,skillInitialWorkspace:i=null,onSkillInitialWorkspaceConsumed:s,artifactSources:a=[],artifactUserId:l="",onArtifactActivate:c,onArtifactSourceOpen:u}){const[d,f]=m.useState("技能库"),[h,p]=m.useState(()=>new Set(["skills",t])),[b,g]=m.useState({skills:0,knowledge:0,artifacts:0}),O=m.useRef(c),[y,v]=m.useState([]),[x,w]=m.useState(!1),[S,E]=m.useState(""),k=m.useMemo(()=>{const $=Z4e(a);return{key:JSON.stringify($),candidates:$}},[a]),T=m.useRef(k);T.current.key!==k.key&&(T.current=k);const C=T.current.candidates;m.useEffect(()=>{O.current=c},[c]),m.useEffect(()=>{p($=>{if($.has(t))return $;const D=new Set($);return D.add(t),D})},[t]),m.useEffect(()=>{var D;const $=t==="skills"?d:((D=xp.find(M=>M.id===t))==null?void 0:D.label)||"资源库";r==null||r($)},[t,r,d]),m.useEffect(()=>{var $;t==="artifacts"&&(($=O.current)==null||$.call(O))},[t,b.artifacts]);const N=m.useCallback(async()=>{w(!0),E("");try{v(await a6e(C))}catch($){E($ instanceof Error?$.message:String($))}finally{w(!1)}},[C]);m.useEffect(()=>{t==="artifacts"&&N()},[t,b.artifacts,N]);const _=$=>{p(D=>{if(D.has($))return D;const M=new Set(D);return M.add($),M}),g(D=>({...D,[$]:D[$]+1})),n($)},R=($,D)=>{var L;if(!["ArrowLeft","ArrowRight","Home","End"].includes($.key))return;$.preventDefault();const M=xp.findIndex(U=>U.id===D),j=$.key==="Home"?0:$.key==="End"?xp.length-1:(M+($.key==="ArrowRight"?1:-1)+xp.length)%xp.length,P=xp[j];_(P.id),(L=document.getElementById(`library-${P.id}-tab`))==null||L.focus()};return o.jsxs("section",{className:"library-view","aria-label":"资源库",children:[o.jsxs("header",{className:"library-view__header",children:[o.jsx("h1",{children:"资源库"}),o.jsx("p",{children:"管理您的资源和产物"})]}),o.jsx("nav",{className:"aw-agent-tabs library-tabs","aria-label":"资源库分类",role:"tablist",children:xp.map($=>o.jsx("button",{type:"button",id:`library-${$.id}-tab`,className:t===$.id?"is-active":"",role:"tab","aria-selected":t===$.id,"aria-controls":`library-${$.id}-panel`,tabIndex:t===$.id?0:-1,onClick:()=>_($.id),onKeyDown:D=>R(D,$.id),children:$.label},$.id))}),o.jsxs("div",{className:"library-panels",children:[h.has("skills")?o.jsx("div",{id:"library-skills-panel",className:"library-panel",role:"tabpanel","aria-labelledby":"library-skills-tab",hidden:t!=="skills",children:o.jsx(kmt,{cloudProvider:e,active:t==="skills",activationRevision:b.skills,onPageTitleChange:f,initialWorkspace:i,onInitialWorkspaceConsumed:s})}):null,h.has("knowledge")?o.jsx("div",{id:"library-knowledge-panel",className:"library-panel",role:"tabpanel","aria-labelledby":"library-knowledge-tab",hidden:t!=="knowledge",children:o.jsx(tJe,{cloudProvider:e,active:t==="knowledge",activationRevision:b.knowledge})}):null,h.has("artifacts")?o.jsx("div",{id:"library-artifacts-panel",className:"library-panel",role:"tabpanel","aria-labelledby":"library-artifacts-tab",hidden:t!=="artifacts",children:o.jsx(r6e,{items:y,userId:l,active:t==="artifacts",activationRevision:b.artifacts,loading:x,error:S,onRetry:()=>void N(),onEdit:o6e,onDelete:l6e,onDownload:c6e,onOpenSource:u?$=>u($.appName,$.sessionId):void 0})}):null]})]})}const j0e="veadk_agentkit_connections",_mt=3e3,wY=6e4;function pc(){try{const e=localStorage.getItem(j0e);return(e?JSON.parse(e):[]).filter(n=>!n.runtimeId||!!n.region)}catch{return[]}}function VC(e){try{localStorage.setItem(j0e,JSON.stringify(e))}catch{}}function Sc(e,t){return`agentkit:${e}:${t}`}function R0e(e){try{return new URL(e).host}catch{return e}}function VO(e){Une();for(const t of e)if(!(t.runtimeId&&!t.region))for(const n of t.apps)Fne(Sc(t.id,n),t.runtimeId?{app:n,runtimeId:t.runtimeId,region:t.region}:{app:n,base:t.base,apiKey:t.apiKey})}function I0e(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=pc(),c=l.findIndex(u=>u.runtimeId===e);return c===-1?l.push(a):l[c]=a,VC(l),VO(l),a}async function Amt(e,t,n,r,i){let s=null,a=n||"cn-beijing",l=null;for(const f of Zv(n))try{const h=await bA(e,f,{retryProbe:!0});if(h&&h.length>0){await Qre(e,f),s=h,a=f;break}}catch(h){if(h instanceof fO)throw k_(e),h;if(h instanceof fa&&h.unsupported){l=h;continue}throw h}if(!s||s.length===0)throw k_(e),l||new fa("该 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=I0e(e,t,a,s,u,r);return Sc(d.id,s[0])}function Cmt(e){return new Promise(t=>window.setTimeout(t,e))}async function cT(e,t,n,r,i={}){const s=Date.now();for(;;)try{return await Amt(e,t,n,r,i.agentName)}catch(a){const l=Date.now()-s;if(!i.waitForReady||!(a instanceof fa)||!a.retryable||l>=wY)throw a;const c=Math.min(_mt,wY-l);await Cmt(c)}}async function D0e(e,t,n,r){const i=t.trim().replace(/\/+$/,""),s=await Kv(i,n.trim()),a={id:Date.now().toString(36),name:e.trim()||R0e(i),base:i,apiKey:n.trim(),apps:s,appLabels:r&&s.length>0?{[s[0]]:r}:void 0},l=[...pc().filter(c=>c.base!==i),a];return VC(l),VO(l),a}function Nmt(e){const t=pc().filter(n=>n.id!==e);return VC(t),VO(t),t}function k_(e){const t=pc().filter(n=>n.runtimeId!==e);return VC(t),VO(t),t}function P0e(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:Sc(i.id,s),label:a,app:s,remote:!0,host:i.runtimeId?i.name:R0e(i.base??""),runtimeId:i.runtimeId,region:i.region,currentVersion:i.currentVersion}}));return[...n,...r]}const SY=Object.freeze(Object.defineProperty({__proto__:null,addConnection:D0e,addRuntimeConnection:I0e,buildAgentEntries:P0e,connectRuntime:cT,loadConnections:pc,registerConnections:VO,remoteAppId:Sc,removeConnection:Nmt,removeRuntimeConnection:k_},Symbol.toStringTag,{value:"Module"}));function jmt({onAdded:e,onCancel:t}){const[n,r]=m.useState(""),[i,s]=m.useState(""),[a,l]=m.useState(""),[c,u]=m.useState(!1),[d,f]=m.useState(""),h=n.trim().length>0&&i.trim().length>0&&!c;async function p(){if(h){u(!0),f("");try{const b=await D0e(a,n,i,a);if(b.apps.length===0){f("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。"),u(!1);return}e(Sc(b.id,b.apps[0]))}catch(b){f(`连接失败:${String(b)}。请检查 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:b=>r(b.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:b=>s(b.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:b=>l(b.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:p,disabled:!h,children:[c?o.jsx(ir,{className:"icon spin"}):null,c?"连接中…":"连接并添加"]})]})]})})}const D9=[{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 只读保护。"}],Rmt=[{id:"quality",displayName:"提升回答质量",componentIds:["context_engine","verifier"]},{id:"cost",displayName:"降低运行成本",componentIds:["compressor"]},{id:"stability",displayName:"增强运行稳定性",componentIds:["long_run_control","mcp_resilience"]}],qC=D9.map(e=>e.id),Imt="BytePlus 账号暂不支持 Harness Sidecar 优化项。请保持优化项为空后继续部署,普通 BytePlus 智能体不受影响。";function Dmt(e){return e==="byteplus"?Imt:null}const M0e=["context_engine","compressor","verifier","long_run_control"],Pmt=new Set(["1","true","yes","on"]),P9=[{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 ax(e){var t;return((t=D9.find(n=>n.id===e))==null?void 0:t.displayName)??e}function L0e(e){var t;return((t=P9.find(n=>n.id===e))==null?void 0:t.displayName)??e}function $0e(e){const t=P9.find(n=>n.id===e);return t?[...t.defaultComponents]:[]}function C0(e,t="default"){const n=new Set(e);return{enabled:n.size>0,profile:t,componentOverrides:Object.fromEntries(qC.map(i=>[i,n.has(i)]))}}function nD(e){return Pmt.has((e==null?void 0:e.trim().toLowerCase())??"")}function Mmt(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 Lmt(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(!nD(n))return C0([],r);const i=Mmt(t.get("HARNESS_SIDECAR_COMPONENT_OVERRIDES"));if(i)return{...C0(qC.filter(l=>i[l]===!0),r),enabled:!0};if(r==="ops")return C0($0e(r),r);const s=[...nD(t.get("HARNESS_MODEL_PROXY_ENABLED"))?M0e:[],...nD(t.get("HARNESS_MCP_GATEWAY_ENABLED"))?["mcp_resilience"]:[]];return{...C0(s,r),enabled:!0}}function $mt(e,t){return{...e,modelName:t.modelName||e.modelName,description:t.description,instruction:t.instruction}}function Bmt(e){var t;return((t=e.harnessSidecar)==null?void 0:t.profile)??"default"}function M9(e){var n;const t=(n=e.harnessSidecar)==null?void 0:n.componentOverrides;return t?qC.filter(r=>t[r]):[]}function Qmt(e){const t=new Set(M9(e));return M0e.filter(n=>t.has(n))}function L9({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 Fmt=[{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"}],Umt=[{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"}]}],EY=[{id:"basic",label:"基本信息"},{id:"usage",label:"用量统计"},{id:"evaluations",label:"评测集"},{id:"optimizations",label:"优化项"},{id:"integrations",label:"接入方法"},{id:"versions",label:"版本"}],zmt=20,Vmt=new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1});function qmt(e){const t=Date.parse(e);return Number.isNaN(t)?"暂未提供":Vmt.format(t)}const My=[{id:"api-server",label:"API Server"},{id:"a2a",label:"A2A"}];function rD(e,t){return e?`${e.replace(/\/+$/,"")}${t}`:""}function Hmt(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 kY(e){return e==="key_auth"?"API Key":e==="custom_jwt"?"OAuth / JWT":e==="none"?"无需鉴权":"暂无"}function TY(e){return e==="published"?"已发布":e==="publishing"?"发布中":e==="failed"?"发布失败":e==="pending"?"等待发布":"未知"}function Xmt(e){return e.changeType==="rollback"?"回退事件":e.version}function Y3(e){return JSON.stringify(e)}function B0e(e){return e==="key_auth"?`API_KEY = "" +`,4);return n>=0?t.slice(n+5).trimStart():e}function j0e(e){const t=(e||"").trim();return!t||[">",">-","|","|-"].includes(t)?"暂无描述":t}function vmt(){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 xY(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 vY(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 wmt(e){return o.jsx("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",...e,children:o.jsx("path",{d:"m14.5 6-6 6 6 6",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})})}function wY({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 R0e(){return o.jsx("span",{className:"skillcenter-loading-mark","aria-hidden":!0})}function Smt({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(wY,{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(wY,{direction:"right"})})]})]})}function Emt({children:e}){return o.jsx("div",{className:"skillcenter-empty",children:e})}function rD({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(ln,{fill:"none",children:[o.jsx(ln.Title,{children:t}),n?o.jsx(ln.Description,{children:n}):null,r?o.jsx(Go,{error:r}):null,i?o.jsx(ln.ActionRow,{children:o.jsx(vn,{color:"secondary",size:"lg",onClick:i.onClick,children:i.label})}):null]})})}function SY({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:Ec(i,t)}),o.jsx(Go,{error:s})]},i))]}),o.jsx("button",{type:"button",onClick:r,children:"重新加载"})]})}function kmt({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 m.useEffect(()=>{const h=p=>{p.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:j0e((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(T_,{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(vmt,{})})]})]}),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:W3(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:Ec(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(R0e,{}),"正在读取技能内容…"]}):l?o.jsx("div",{className:"skillcenter-error",children:o.jsx(Go,{error:l})}):s.length>0?o.jsx(A0e,{files:s.map(h=>h.path.endsWith("SKILL.md")&&h.content?{...h,content:xmt(h.content)}:h)}):o.jsx(Emt,{children:"该技能暂无 SKILL.md 内容"})]})]})})}function Tmt({space:e,canUseSandbox:t,onUpload:n,onSandbox:r,onClose:i}){return m.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(T_,{disabled:!t,placement:"inside",children:o.jsxs("button",{type:"button",disabled:!t,onClick:r,children:[o.jsx("strong",{children:"自动创建"}),o.jsx("span",{children:"选择模型和风格,通过对话生成技能"})]})})]})]})})}function _mt({cloudProvider:e="volcengine",active:t=!0,activationRevision:n=0,initialWorkspace:r=null,onInitialWorkspaceConsumed:i,onPageTitleChange:s}){var Ut;const a=m.useMemo(()=>Tb(e).map(Ce=>Ce.value),[e]),[l,c]=m.useState([]),[u,d]=m.useState({}),[f,h]=m.useState(!1),[p,b]=m.useState(""),[g,O]=m.useState((r==null?void 0:r.space)??null),[y,v]=m.useState([]),[x,w]=m.useState(1),[S,E]=m.useState(0),[k,T]=m.useState(!1),[C,N]=m.useState(null),[_,R]=m.useState(""),[$,D]=m.useState(null),[M,j]=m.useState(null),[P,L]=m.useState([]),[U,F]=m.useState(!1),[q,z]=m.useState(null),[B,V]=m.useState(null),[ce,we]=m.useState(!1),[Oe,de]=m.useState(null),[Z,J]=m.useState(null),[fe,be]=m.useState(null),[je,Qe]=m.useState(0),[Me,le]=m.useState(0),[ke,ye]=m.useState(""),[$e,ze]=m.useState(""),[Ae,Ve]=m.useState(null),[ut,Tt]=m.useState(r),We=m.useRef(0),W=m.useRef(0),ne=m.useRef(!1),he=m.useRef(null),xe=m.useRef(null),re=m.useRef(null),Re=m.useDeferredValue(p),nt=m.useDeferredValue(_),tn=(ut&&(g||ut.selectPublishSpace)?ut.operation==="create"?"创建技能":`优化 ${((Ut=ut.source)==null?void 0:Ut.name)||"技能"}`:"")||(g==null?void 0:g.name)||"技能库";m.useEffect(()=>{t&&(s==null||s(tn))},[t,s,tn]),m.useEffect(()=>{r&&(i==null||i())},[r,i]);const Gt=m.useMemo(()=>{const Ce=Re.trim().toLocaleLowerCase();return Ce?l.filter(Ze=>`${Ze.name} ${Ze.description||""} ${Ze.projectName||""}`.toLocaleLowerCase().includes(Ce)):l},[Re,l]),At=m.useMemo(()=>{const Ce=nt.trim().toLocaleLowerCase();return Ce?y.filter(Ze=>`${Ze.skillName} ${Ze.skillDescription||""}`.toLocaleLowerCase().includes(Ce)):y},[nt,y]),St=(g==null?void 0:g.region)||Hr(e),ve=m.useMemo(()=>a.flatMap(Ce=>{var $t;const Ze=($t=u[Ce])==null?void 0:$t.error;return Ze?[{region:Ce,error:Ze}]:[]}),[u,a]),Ue=a.some(Ce=>{const Ze=u[Ce];return!!(Ze&&!Ze.done&&!Ze.error)}),Y=ve.length===a.length;m.useEffect(()=>{const Ce=new AbortController;return mC(Ce.signal).then(V).catch(()=>V({enabled:!1,reason:"管理员未配置",operations:["create","optimize"],models:[],styles:{}})),()=>Ce.abort()},[]);const mt=m.useCallback(async(Ce,Ze)=>{var at;if(ne.current||Ce.length===0)return;ne.current=!0,h(!0),Ze&&((at=he.current)==null||at.abort(),c([]),d(Object.fromEntries(Ce.map(({region:Lt})=>[Lt,{nextPage:1,loadedCount:0,done:!1,error:null}]))));const $t=new AbortController;he.current=$t;const En=++W.current,gn=await Promise.allSettled(Ce.map(async({region:Lt,page:Wt})=>({region:Lt,page:Wt,result:await mJe({region:Lt,page:Wt,pageSize:bmt,signal:$t.signal})})));if(W.current!==En)return;const xr=gn.map((Lt,Wt)=>{const fn=Ce[Wt];return Lt.status==="rejected"?{request:fn,error:Us(Lt.reason,"读取技能空间失败,请稍后重试"),items:[],totalCount:0}:{request:fn,error:null,items:(Lt.value.result.items||[]).map(Jt=>({...Jt,region:Jt.region||Lt.value.region})),totalCount:Lt.value.result.totalCount||0}}),Pe=xr.flatMap(Lt=>Lt.items);d(Lt=>{const Wt={...Lt};return xr.forEach(({request:fn,error:Jt,items:lr,totalCount:Sr})=>{const ai=Wt[fn.region]||{nextPage:fn.page,loadedCount:0,done:!1,error:null};if(Jt){Wt[fn.region]={...ai,error:Jt};return}const Yt=ai.loadedCount+lr.length;Wt[fn.region]={nextPage:fn.page+1,loadedCount:Yt,done:lr.length===0||Yt>=Sr,error:null}}),Wt}),c(Lt=>ymt(Ze?[]:Lt,Pe)),O(Lt=>Lt&&(Pe.find(Wt=>cc(Wt)===cc(Lt))||Lt)),ne.current=!1,h(!1)},[]),xt=m.useCallback(()=>{if(ne.current)return;const Ce=a.flatMap(Ze=>{const $t=u[Ze];return $t&&!$t.done&&!$t.error?[{region:Ze,page:$t.nextPage}]:[]});mt(Ce,!1)},[mt,u,a]);m.useEffect(()=>{Pt(),O(null),v([]),w(1)},[e]),m.useEffect(()=>{if(t)return mt(a.map(Ce=>({region:Ce,page:1})),!0),()=>{var Ce;W.current+=1,(Ce=he.current)==null||Ce.abort(),ne.current=!1}},[t,n,mt,a,je]),m.useEffect(()=>{const Ce=re.current,Ze=xe.current;if(!Ce||!Ze||!Ue||f)return;const $t=new IntersectionObserver(([En])=>{En.isIntersecting&&xt()},{root:Ze,rootMargin:"240px 0px",threshold:.01});return $t.observe(Ce),()=>$t.disconnect()},[Ue,xt,f]);const Dt=()=>{const Ce=xe.current;!Ce||!Ue||f||Ce.scrollHeight-Ce.scrollTop-Ce.clientHeight<=240&&xt()};m.useEffect(()=>{if(!g){v([]),E(0);return}let Ce=!0;return T(!0),N(null),EJe(g.id,{region:St,page:x,pageSize:gY,project:g.projectName}).then(Ze=>{Ce&&(v(Ze.items||[]),E(Ze.totalCount||0))}).catch(Ze=>{Ce&&(v([]),E(0),N(Us(Ze,"读取技能失败,请稍后重试")))}).finally(()=>{Ce&&T(!1)}),()=>{Ce=!1}},[St,g,x,Me]);const Ne=Ce=>{Pt(),O(Ce),w(1),R("")},Ge=()=>{Pt(),O(null),v([]),E(0),w(1),R(""),Ve(null)},Pt=()=>{We.current+=1,D(null),j(null),L([]),z(null),F(!1)},Kt=async Ce=>{if(!g)return;const Ze=We.current+1;We.current=Ze,D(Ce),j(null),z(null),F(!0);try{const[$t,En]=await Promise.all([kJe(g.id,Ce.skillId,Ce.version,St,g.projectName,Ce.skillName,g.name),wJe({spaceId:g.id,skillId:Ce.skillId,version:Ce.version,region:St,skillSpaceName:g.name,skillName:Ce.skillName})]);We.current===Ze&&(j($t),L(En))}catch($t){We.current===Ze&&z(Us($t,"读取技能详情失败,请稍后重试"))}finally{We.current===Ze&&F(!1)}},tt=Ce=>{if(g)return{kind:"skill-center",skillId:Ce.skillId,version:Ce.version,region:St,projectName:g.projectName,skillSpaceId:g.id,skillSpaceName:g.name,name:Ce.skillName,description:Ce.skillDescription}},an=Ce=>{const Ze=tt(Ce);!Ze||!(B!=null&&B.enabled)||(Pt(),Tt({operation:"optimize",source:Ze}))},or=async Ce=>{if(!(!g||!window.confirm(`确定删除整个 Skill“${Ce.skillName}”吗?此操作会影响所有引用它的空间。`))){ye(Ce.skillId),Ve(null);try{await vJe({spaceId:g.id,skillId:Ce.skillId,region:St}),le(Ze=>Ze+1),Qe(Ze=>Ze+1)}catch(Ze){Ve(Us(Ze,"删除 Skill 失败"))}finally{ye("")}}},Qt=async Ce=>{if(!window.confirm(`确定删除 Skill 空间“${Ce.name}”吗?请先确认空间中的技能已删除。`))return;const Ze=cc(Ce);ze(Ze),Ve(null);try{await OJe({spaceId:Ce.id,region:Ce.region||Hr(e)}),g&&cc(g)===Ze&&Ge(),Qe($t=>$t+1)}catch($t){Ve(Us($t,"删除 Skill 空间失败"))}finally{ze("")}};return ut&&(g||ut.selectPublishSpace)?o.jsx(hmt,{operation:ut.operation,cloudProvider:e,space:g??void 0,availableSpaces:l,spacesLoading:f,initialIntent:ut.initialIntent,source:ut.source,onBack:()=>Tt(null),onPublished:()=>{le(Ce=>Ce+1),Qe(Ce=>Ce+1)}}):o.jsxs("section",{className:`skillcenter${g?" is-space":" my-agents-page"}`,children:[g?o.jsxs(o.Fragment,{children:[o.jsxs("header",{className:"skillcenter-page-header",children:[o.jsxs("div",{className:"skillcenter-page-heading skillcenter-page-heading--back",children:[o.jsx("button",{type:"button",className:"skillcenter-back",onClick:Ge,"aria-label":"返回技能空间",children:o.jsx(wmt,{})}),o.jsxs("div",{children:[o.jsx("h1",{title:g.name,children:g.name}),o.jsx("p",{children:g.description||"管理空间中的技能并创建新的版本"})]})]}),o.jsxs("label",{className:"skillcenter-search",children:[o.jsx(xY,{}),o.jsx("input",{type:"search","aria-label":"搜索技能",value:_,onChange:Ce=>R(Ce.target.value),placeholder:"搜索技能"})]})]}),o.jsxs("div",{className:"skillcenter-toolbar",children:[o.jsxs("div",{className:"skillcenter-detail-facts",children:[o.jsxs("div",{children:[o.jsx("span",{children:"技能数量"}),o.jsx("strong",{children:S})]}),o.jsxs("div",{children:[o.jsx("span",{children:"更新时间"}),o.jsx("strong",{children:g.updatedAt?OY(g.updatedAt):"—"})]})]}),o.jsxs("div",{className:"skillcenter-toolbar-actions",children:[o.jsx("button",{type:"button",className:"skillcenter-secondary-action",onClick:()=>be(g),children:"本地上传"}),o.jsx(T_,{disabled:!(B!=null&&B.enabled),children:o.jsxs("button",{type:"button",className:"skillcenter-primary-action",disabled:!(B!=null&&B.enabled),onClick:()=>Tt({operation:"create"}),children:[o.jsx(vY,{}),o.jsx("span",{children:"创建技能"})]})})]})]}),Ae?o.jsx("div",{className:"skillcenter-inline-error",role:"alert",children:o.jsx(Go,{error:Ae})}):null,o.jsxs("section",{className:"skillcenter-results","aria-label":`${g.name}中的技能`,children:[k&&y.length===0?o.jsxs("div",{className:"skillcenter-loading",children:[o.jsx(R0e,{}),"正在加载技能"]}):C&&y.length===0?o.jsx(rD,{kind:"error",title:"无法加载技能",error:C,action:{label:"重新加载",onClick:()=>le(Ce=>Ce+1)}}):At.length===0?o.jsx(rD,{kind:"empty",title:_.trim()?"没有匹配的技能":"暂无技能",description:_.trim()?"请尝试搜索其他名称":"本地上传 Skill,或自动创建",action:_.trim()?void 0:{label:"本地上传",onClick:()=>be(g)}}):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:At.map(Ce=>o.jsxs("tr",{children:[o.jsx("td",{className:"skillcenter-table__skill",children:o.jsxs("button",{type:"button",onClick:()=>void Kt(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:j0e(Ce.skillDescription)})]})}),o.jsx("td",{children:o.jsx("span",{className:`skillcenter-status ${bY(Ce.skillStatus)}`,children:W3(Ce.skillStatus)})}),o.jsx("td",{children:o.jsxs("div",{className:"skillcenter-table__actions",children:[o.jsx("button",{type:"button",onClick:()=>void Kt(Ce),children:"查看"}),o.jsx(T_,{disabled:!(B!=null&&B.enabled),children:o.jsx("button",{type:"button",disabled:!(B!=null&&B.enabled),onClick:()=>an(Ce),children:"优化"})}),o.jsx("button",{type:"button",className:"is-danger",disabled:ke===Ce.skillId,onClick:()=>void or(Ce),children:ke===Ce.skillId?"删除中…":"删除"})]})})]},`${Ce.skillId}:${Ce.version}`))})]})}),!_.trim()&&!k&&!C&&S>0?o.jsx(Smt,{page:x,total:S,pageSize:gY,onPage:w}):null]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"my-agent-type-bar skillcenter-list-toolbar library-resource-toolbar",children:[o.jsxs("button",{type:"button",className:"my-agent-create-primary",onClick:()=>we(!0),children:[o.jsx(vY,{}),o.jsx("span",{children:"新建空间"})]}),o.jsxs("label",{className:"my-agent-search",children:[o.jsx(xY,{}),o.jsx("input",{type:"search","aria-label":"搜索技能空间",value:p,onChange:Ce=>b(Ce.target.value),placeholder:"搜索技能空间"})]})]}),Ae?o.jsx("div",{className:"skillcenter-inline-error",role:"alert",children:o.jsx(Go,{error:Ae})}):null,o.jsxs("section",{className:"my-agent-results",ref:xe,"aria-label":"技能空间列表",onScroll:Dt,children:[ve.length>0&&!Y?o.jsx(SY,{errors:ve,cloudProvider:e,onRetry:()=>Qe(Ce=>Ce+1)}):null,f&&l.length===0?o.jsxs("div",{className:"my-agent-initial-loading",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载技能空间"})]}):Y&&l.length===0?o.jsx(SY,{errors:ve,cloudProvider:e,fullPage:!0,onRetry:()=>Qe(Ce=>Ce+1)}):Gt.length===0?o.jsx(rD,{kind:"empty",title:p.trim()?"没有匹配的技能空间":"暂无技能空间",description:p.trim()?"请尝试搜索其他名称":"新建一个空间,开始管理和创建技能",action:p.trim()?void 0:{label:"新建空间",onClick:()=>we(!0)}}):o.jsx(o.Fragment,{children:o.jsx("div",{className:"my-agent-grid",children:Gt.map(Ce=>{const Ze=cc(Ce);return o.jsx(Jle,{className:"skillcenter-space-card",title:Ce.name,status:o.jsx("span",{className:`skillcenter-status ${bY(Ce.status)}`,children:W3(Ce.status)}),description:Ce.description||"暂无描述",metadata:[{label:"地域",value:Ec(Ce.region||Hr(e),e)},{label:"技能数量",value:Ce.skillCount??0},{label:"更新时间",value:Ce.updatedAt?OY(Ce.updatedAt):"—"}],secondaryAction:{label:"添加技能",onClick:()=>J(Ce)},primaryAction:{label:"查看详情",onClick:()=>Ne(Ce)},menuLabel:`更多空间操作:${Ce.name}`,menuAriaLabel:`${Ce.name}空间操作`,menuActions:[{label:"编辑空间",onClick:()=>de(Ce)},{label:"删除空间",danger:!0,disabled:$e===Ze,onClick:()=>void Qt(Ce)}]},Ze)})})}),!Y&&l.length>0?o.jsx("div",{className:"my-agent-load-more",ref:re,"aria-live":"polite",children:f?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载更多技能空间"})]}):Ue?o.jsx("span",{children:"继续下滑加载更多"}):ve.length>0?o.jsx("span",{children:"部分技能空间加载失败"}):o.jsx("span",{children:"已加载全部技能空间"})}):null]})]}),$&&g&&o.jsx(kmt,{skill:$,space:g,region:St,cloudProvider:e,detail:M,files:P,loading:U,error:q,canOptimize:(B==null?void 0:B.enabled)===!0,onOptimize:()=>an($),onDownload:()=>void SJe({spaceId:g.id,skillId:$.skillId,version:$.version,region:St,fallbackName:$.skillName,skillSpaceName:g.name,skillName:$.skillName}).catch(Ce=>z(Us(Ce,"下载 Skill 失败"))),onClose:Pt}),ce?o.jsx(pmt,{region:Hr(e),regionOptions:Tb(e),onClose:()=>we(!1),onCreated:Ce=>{we(!1),Qe(Ze=>Ze+1),O({...Ce,region:Ce.region||Hr(e)})}}):null,Oe?o.jsx(mmt,{space:Oe,region:Oe.region||Hr(e),onClose:()=>de(null),onUpdated:Ce=>{const Ze={...Ce,region:Ce.region||Oe.region||Hr(e)};de(null),O($t=>$t&&cc($t)===cc(Ze)?Ze:$t),c($t=>$t.map(En=>cc(En)===cc(Ze)?Ze:En)),Qe($t=>$t+1)}}):null,Z?o.jsx(Tmt,{space:Z,canUseSandbox:(B==null?void 0:B.enabled)===!0,onClose:()=>J(null),onUpload:()=>{be(Z),J(null)},onSandbox:()=>{const Ce=Z;J(null),Ne(Ce),Tt({operation:"create"})}}):null,fe?o.jsx(gmt,{space:fe,region:fe.region||Hr(e),onClose:()=>be(null),onUploaded:()=>{be(null),le(Ce=>Ce+1),Qe(Ce=>Ce+1)}}):null]})}const vp=[{id:"skills",label:"技能库"},{id:"knowledge",label:"知识库"},{id:"artifacts",label:"产物"}];function Amt({cloudProvider:e,activeTab:t,onTabChange:n,onPageTitleChange:r,skillInitialWorkspace:i=null,onSkillInitialWorkspaceConsumed:s,artifactSources:a=[],artifactUserId:l="",onArtifactActivate:c,onArtifactSourceOpen:u}){const[d,f]=m.useState("技能库"),[h,p]=m.useState(()=>new Set(["skills",t])),[b,g]=m.useState({skills:0,knowledge:0,artifacts:0}),O=m.useRef(c),[y,v]=m.useState([]),[x,w]=m.useState(!1),[S,E]=m.useState(""),k=m.useMemo(()=>{const $=J4e(a);return{key:JSON.stringify($),candidates:$}},[a]),T=m.useRef(k);T.current.key!==k.key&&(T.current=k);const C=T.current.candidates;m.useEffect(()=>{O.current=c},[c]),m.useEffect(()=>{p($=>{if($.has(t))return $;const D=new Set($);return D.add(t),D})},[t]),m.useEffect(()=>{var D;const $=t==="skills"?d:((D=vp.find(M=>M.id===t))==null?void 0:D.label)||"资源库";r==null||r($)},[t,r,d]),m.useEffect(()=>{var $;t==="artifacts"&&(($=O.current)==null||$.call(O))},[t,b.artifacts]);const N=m.useCallback(async()=>{w(!0),E("");try{v(await l6e(C))}catch($){E($ instanceof Error?$.message:String($))}finally{w(!1)}},[C]);m.useEffect(()=>{t==="artifacts"&&N()},[t,b.artifacts,N]);const _=$=>{p(D=>{if(D.has($))return D;const M=new Set(D);return M.add($),M}),g(D=>({...D,[$]:D[$]+1})),n($)},R=($,D)=>{var L;if(!["ArrowLeft","ArrowRight","Home","End"].includes($.key))return;$.preventDefault();const M=vp.findIndex(U=>U.id===D),j=$.key==="Home"?0:$.key==="End"?vp.length-1:(M+($.key==="ArrowRight"?1:-1)+vp.length)%vp.length,P=vp[j];_(P.id),(L=document.getElementById(`library-${P.id}-tab`))==null||L.focus()};return o.jsxs("section",{className:"library-view","aria-label":"资源库",children:[o.jsxs("header",{className:"library-view__header",children:[o.jsx("h1",{children:"资源库"}),o.jsx("p",{children:"管理您的资源和产物"})]}),o.jsx("nav",{className:"aw-agent-tabs library-tabs","aria-label":"资源库分类",role:"tablist",children:vp.map($=>o.jsx("button",{type:"button",id:`library-${$.id}-tab`,className:t===$.id?"is-active":"",role:"tab","aria-selected":t===$.id,"aria-controls":`library-${$.id}-panel`,tabIndex:t===$.id?0:-1,onClick:()=>_($.id),onKeyDown:D=>R(D,$.id),children:$.label},$.id))}),o.jsxs("div",{className:"library-panels",children:[h.has("skills")?o.jsx("div",{id:"library-skills-panel",className:"library-panel",role:"tabpanel","aria-labelledby":"library-skills-tab",hidden:t!=="skills",children:o.jsx(_mt,{cloudProvider:e,active:t==="skills",activationRevision:b.skills,onPageTitleChange:f,initialWorkspace:i,onInitialWorkspaceConsumed:s})}):null,h.has("knowledge")?o.jsx("div",{id:"library-knowledge-panel",className:"library-panel",role:"tabpanel","aria-labelledby":"library-knowledge-tab",hidden:t!=="knowledge",children:o.jsx(rJe,{cloudProvider:e,active:t==="knowledge",activationRevision:b.knowledge})}):null,h.has("artifacts")?o.jsx("div",{id:"library-artifacts-panel",className:"library-panel",role:"tabpanel","aria-labelledby":"library-artifacts-tab",hidden:t!=="artifacts",children:o.jsx(s6e,{items:y,userId:l,active:t==="artifacts",activationRevision:b.artifacts,loading:x,error:S,onRetry:()=>void N(),onEdit:c6e,onDelete:u6e,onDownload:d6e,onOpenSource:u?$=>u($.appName,$.sessionId):void 0})}):null]})]})}const I0e="veadk_agentkit_connections",Cmt=3e3,EY=6e4;function pc(){try{const e=localStorage.getItem(I0e);return(e?JSON.parse(e):[]).filter(n=>!n.runtimeId||!!n.region)}catch{return[]}}function HC(e){try{localStorage.setItem(I0e,JSON.stringify(e))}catch{}}function Sc(e,t){return`agentkit:${e}:${t}`}function D0e(e){try{return new URL(e).host}catch{return e}}function qO(e){Vne();for(const t of e)if(!(t.runtimeId&&!t.region))for(const n of t.apps)zne(Sc(t.id,n),t.runtimeId?{app:n,runtimeId:t.runtimeId,region:t.region}:{app:n,base:t.base,apiKey:t.apiKey})}function P0e(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=pc(),c=l.findIndex(u=>u.runtimeId===e);return c===-1?l.push(a):l[c]=a,HC(l),qO(l),a}async function Nmt(e,t,n,r,i){let s=null,a=n||"cn-beijing",l=null;for(const f of Kv(n))try{const h=await yA(e,f,{retryProbe:!0});if(h&&h.length>0){await Ure(e,f),s=h,a=f;break}}catch(h){if(h instanceof hO)throw __(e),h;if(h instanceof ha&&h.unsupported){l=h;continue}throw h}if(!s||s.length===0)throw __(e),l||new ha("该 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=P0e(e,t,a,s,u,r);return Sc(d.id,s[0])}function jmt(e){return new Promise(t=>window.setTimeout(t,e))}async function dT(e,t,n,r,i={}){const s=Date.now();for(;;)try{return await Nmt(e,t,n,r,i.agentName)}catch(a){const l=Date.now()-s;if(!i.waitForReady||!(a instanceof ha)||!a.retryable||l>=EY)throw a;const c=Math.min(Cmt,EY-l);await jmt(c)}}async function M0e(e,t,n,r){const i=t.trim().replace(/\/+$/,""),s=await Jv(i,n.trim()),a={id:Date.now().toString(36),name:e.trim()||D0e(i),base:i,apiKey:n.trim(),apps:s,appLabels:r&&s.length>0?{[s[0]]:r}:void 0},l=[...pc().filter(c=>c.base!==i),a];return HC(l),qO(l),a}function Rmt(e){const t=pc().filter(n=>n.id!==e);return HC(t),qO(t),t}function __(e){const t=pc().filter(n=>n.runtimeId!==e);return HC(t),qO(t),t}function L0e(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:Sc(i.id,s),label:a,app:s,remote:!0,host:i.runtimeId?i.name:D0e(i.base??""),runtimeId:i.runtimeId,region:i.region,currentVersion:i.currentVersion}}));return[...n,...r]}const kY=Object.freeze(Object.defineProperty({__proto__:null,addConnection:M0e,addRuntimeConnection:P0e,buildAgentEntries:L0e,connectRuntime:dT,loadConnections:pc,registerConnections:qO,remoteAppId:Sc,removeConnection:Rmt,removeRuntimeConnection:__},Symbol.toStringTag,{value:"Module"}));function Imt({onAdded:e,onCancel:t}){const[n,r]=m.useState(""),[i,s]=m.useState(""),[a,l]=m.useState(""),[c,u]=m.useState(!1),[d,f]=m.useState(""),h=n.trim().length>0&&i.trim().length>0&&!c;async function p(){if(h){u(!0),f("");try{const b=await M0e(a,n,i,a);if(b.apps.length===0){f("连接成功,但该地址未发现任何 Agent(/list-apps 为空)。"),u(!1);return}e(Sc(b.id,b.apps[0]))}catch(b){f(`连接失败:${String(b)}。请检查 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:b=>r(b.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:b=>s(b.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:b=>l(b.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:p,disabled:!h,children:[c?o.jsx(sr,{className:"icon spin"}):null,c?"连接中…":"连接并添加"]})]})]})})}const M9=[{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 只读保护。"}],Dmt=[{id:"quality",displayName:"提升回答质量",componentIds:["context_engine","verifier"]},{id:"cost",displayName:"降低运行成本",componentIds:["compressor"]},{id:"stability",displayName:"增强运行稳定性",componentIds:["long_run_control","mcp_resilience"]}],XC=M9.map(e=>e.id),Pmt="BytePlus 账号暂不支持 Harness Sidecar 优化项。请保持优化项为空后继续部署,普通 BytePlus 智能体不受影响。";function Mmt(e){return e==="byteplus"?Pmt:null}const $0e=["context_engine","compressor","verifier","long_run_control"],Lmt=new Set(["1","true","yes","on"]),L9=[{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 ox(e){var t;return((t=M9.find(n=>n.id===e))==null?void 0:t.displayName)??e}function B0e(e){var t;return((t=L9.find(n=>n.id===e))==null?void 0:t.displayName)??e}function Q0e(e){const t=L9.find(n=>n.id===e);return t?[...t.defaultComponents]:[]}function N0(e,t="default"){const n=new Set(e);return{enabled:n.size>0,profile:t,componentOverrides:Object.fromEntries(XC.map(i=>[i,n.has(i)]))}}function iD(e){return Lmt.has((e==null?void 0:e.trim().toLowerCase())??"")}function $mt(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 Bmt(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(!iD(n))return N0([],r);const i=$mt(t.get("HARNESS_SIDECAR_COMPONENT_OVERRIDES"));if(i)return{...N0(XC.filter(l=>i[l]===!0),r),enabled:!0};if(r==="ops")return N0(Q0e(r),r);const s=[...iD(t.get("HARNESS_MODEL_PROXY_ENABLED"))?$0e:[],...iD(t.get("HARNESS_MCP_GATEWAY_ENABLED"))?["mcp_resilience"]:[]];return{...N0(s,r),enabled:!0}}function Qmt(e,t){return{...e,modelName:t.modelName||e.modelName,description:t.description,instruction:t.instruction}}function Fmt(e){var t;return((t=e.harnessSidecar)==null?void 0:t.profile)??"default"}function $9(e){var n;const t=(n=e.harnessSidecar)==null?void 0:n.componentOverrides;return t?XC.filter(r=>t[r]):[]}function Umt(e){const t=new Set($9(e));return $0e.filter(n=>t.has(n))}function B9({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 zmt=[{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"}],Vmt=[{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"}]}],TY=[{id:"basic",label:"基本信息"},{id:"usage",label:"用量统计"},{id:"evaluations",label:"评测集"},{id:"optimizations",label:"优化项"},{id:"integrations",label:"接入方法"},{id:"versions",label:"版本"}],qmt=20,Hmt=new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1});function Xmt(e){const t=Date.parse(e);return Number.isNaN(t)?"暂未提供":Hmt.format(t)}const Ly=[{id:"api-server",label:"API Server"},{id:"a2a",label:"A2A"}];function sD(e,t){return e?`${e.replace(/\/+$/,"")}${t}`:""}function Gmt(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 _Y(e){return e==="key_auth"?"API Key":e==="custom_jwt"?"OAuth / JWT":e==="none"?"无需鉴权":"暂无"}function AY(e){return e==="published"?"已发布":e==="publishing"?"发布中":e==="failed"?"发布失败":e==="pending"?"等待发布":"未知"}function Ymt(e){return e.changeType==="rollback"?"回退事件":e.version}function Z3(e){return JSON.stringify(e)}function F0e(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 Gmt(e,t,n){const r=e.replace(/\/+$/,"");return`\`\`\`python +HEADERS = {"Authorization": f"Bearer {AUTH_TOKEN}"}`}function Wmt(e,t,n){const r=e.replace(/\/+$/,"");return`\`\`\`python import uuid import requests -BASE_URL = ${Y3(r)} -APP_NAME = ${Y3(t)} +BASE_URL = ${Z3(r)} +APP_NAME = ${Z3(t)} USER_ID = "demo-user" SESSION_ID = str(uuid.uuid4()) -${B0e(n)} +${F0e(n)} session_response = requests.post( f"{BASE_URL}/apps/{APP_NAME}/users/{USER_ID}/sessions/{SESSION_ID}", @@ -744,13 +744,13 @@ with requests.post( for line in response.iter_lines(): if line: print(line.decode("utf-8")) -\`\`\``}function Ymt(e,t){return`\`\`\`python +\`\`\``}function Zmt(e,t){return`\`\`\`python import uuid import requests -AGENT_URL = ${Y3(e)} -${B0e(t)} +AGENT_URL = ${Z3(e)} +${F0e(t)} response = requests.post( AGENT_URL, @@ -771,11 +771,11 @@ response = requests.post( ) response.raise_for_status() print(response.json()) -\`\`\``}function Wmt({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 _Y({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(Wmt,{visible:r})}),s&&o.jsx("span",{className:"aw-integration-secret-error",role:"alert",children:s})]}):"暂无"}function AY({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(_u,{text:i,className:"aw-integration-example-code",allowRawHtml:!1})]})]})}function Zmt(e,t,n){var r;return G6({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 Q0e(e){return e?1+e.children.reduce((t,n)=>t+Q0e(n),0):1}function F0e(e){return 1+e.subAgents.reduce((t,n)=>t+F0e(n),0)}function W3(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 Kmt(e){const t=W3(e);return t?new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(t)):"时间未知"}function Jmt(e){return typeof e.score!="number"||!Number.isFinite(e.score)?"—":`${Math.round(e.score*100)} 分`}function egt(e){return e==="high"?"高":e==="medium"?"中":"低"}const tgt={agent_structure:"Agent 结构",prompt:"提示词",tool:"工具",knowledge:"知识库",memory:"记忆",workflow:"工作流",other:"其他"};function ngt(e){var t;return e.module==="other"?((t=e.customModule)==null?void 0:t.trim())||"其他":tgt[e.module]}function rgt(e,t){return e.find(n=>n.kind===t)}function CY(e){return e.items.map(t=>({...t,tag:t.kind==="good"?"Good case":"Bad case"})).sort((t,n)=>W3(n.createdAt)-W3(t.createdAt))}function igt(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 uT=[{phase:"prepare",label:"准备部署",description:"校验配置并创建部署任务"},{phase:"build",label:"构建镜像",description:"生成运行环境与智能体代码"},{phase:"deploy",label:"部署服务",description:"创建并启动 AgentKit Runtime"},{phase:"publish",label:"发布服务",description:"等待服务就绪并生成访问地址"},{phase:"complete",label:"部署完成",description:"智能体已可以正常使用"}],sgt={phase:"evaluation",label:"创建评测集",description:"自动创建 Good Case 和 Bad Case 评测集"},agt={phase:"github",label:"挂载 GitHub 持续交付",description:"初始化目标分支与 GitHub Actions workflow"};function ogt(e){return{phase:"update",label:"更新实例配置",description:`将 Runtime 实例数调整为 ${e.min}~${e.max}`}}const lgt=uT.findIndex(e=>e.phase==="build");function U0e(e){const t=[...uT.slice(0,-1)];return e.instanceRange&&t.push(ogt(e.instanceRange)),e.createEvaluationSets&&t.push(sgt),e.githubDelivery&&t.push(agt),t.push(uT[uT.length-1]),t}function z0e(e){const t=U0e(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 cgt(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 V0e({log:e,autoExpand:t,title:n,ariaLabel:r,copyLabel:i,defaultPendingMessage:s}){const a=m.useRef(null),l=!!((e==null?void 0:e.status)!=="complete"&&t),[c,u]=m.useState(l),[d,f]=m.useState(!1),h=!!(e!=null&&e.text||e!=null&&e.error),p=(e==null?void 0:e.text)||(e==null?void 0:e.error)||"",b=p.split(` +\`\`\``}function Kmt({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 CY({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(Kmt,{visible:r})}),s&&o.jsx("span",{className:"aw-integration-secret-error",role:"alert",children:s})]}):"暂无"}function NY({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(_u,{text:i,className:"aw-integration-example-code",allowRawHtml:!1})]})]})}function Jmt(e,t,n){var r;return W6({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 U0e(e){return e?1+e.children.reduce((t,n)=>t+U0e(n),0):1}function z0e(e){return 1+e.subAgents.reduce((t,n)=>t+z0e(n),0)}function K3(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 egt(e){const t=K3(e);return t?new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(new Date(t)):"时间未知"}function tgt(e){return typeof e.score!="number"||!Number.isFinite(e.score)?"—":`${Math.round(e.score*100)} 分`}function ngt(e){return e==="high"?"高":e==="medium"?"中":"低"}const rgt={agent_structure:"Agent 结构",prompt:"提示词",tool:"工具",knowledge:"知识库",memory:"记忆",workflow:"工作流",other:"其他"};function igt(e){var t;return e.module==="other"?((t=e.customModule)==null?void 0:t.trim())||"其他":rgt[e.module]}function sgt(e,t){return e.find(n=>n.kind===t)}function jY(e){return e.items.map(t=>({...t,tag:t.kind==="good"?"Good case":"Bad case"})).sort((t,n)=>K3(n.createdAt)-K3(t.createdAt))}function agt(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 fT=[{phase:"prepare",label:"准备部署",description:"校验配置并创建部署任务"},{phase:"build",label:"构建镜像",description:"生成运行环境与智能体代码"},{phase:"deploy",label:"部署服务",description:"创建并启动 AgentKit Runtime"},{phase:"publish",label:"发布服务",description:"等待服务就绪并生成访问地址"},{phase:"complete",label:"部署完成",description:"智能体已可以正常使用"}],ogt={phase:"evaluation",label:"创建评测集",description:"自动创建 Good Case 和 Bad Case 评测集"},lgt={phase:"github",label:"挂载 GitHub 持续交付",description:"初始化目标分支与 GitHub Actions workflow"};function cgt(e){return{phase:"update",label:"更新实例配置",description:`将 Runtime 实例数调整为 ${e.min}~${e.max}`}}const ugt=fT.findIndex(e=>e.phase==="build");function V0e(e){const t=[...fT.slice(0,-1)];return e.instanceRange&&t.push(cgt(e.instanceRange)),e.createEvaluationSets&&t.push(ogt),e.githubDelivery&&t.push(lgt),t.push(fT[fT.length-1]),t}function q0e(e){const t=V0e(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 dgt(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 H0e({log:e,autoExpand:t,title:n,ariaLabel:r,copyLabel:i,defaultPendingMessage:s}){const a=m.useRef(null),l=!!((e==null?void 0:e.status)!=="complete"&&t),[c,u]=m.useState(l),[d,f]=m.useState(!1),h=!!(e!=null&&e.text||e!=null&&e.error),p=(e==null?void 0:e.text)||(e==null?void 0:e.error)||"",b=p.split(` `),g=c?p:b.slice(-36).join(` -`),O=(e==null?void 0:e.pendingMessage)||s;if(m.useEffect(()=>{e&&u(l)},[e==null?void 0:e.status,l]),m.useEffect(()=>{if(!c||!h)return;const E=a.current;E&&(E.scrollTop=E.scrollHeight)},[c,h,g]),!e||!e.text&&e.status!=="error"&&!e.pendingMessage)return null;const y=cgt(e.updatedAt),v=e.status==="complete"?"已同步":e.status==="error"?"读取失败":"同步中",x=e.omittedEarly?"已省略早期日志":e.snapshotTruncated?"仅显示最近的构建日志":e.truncated?"已省略部分日志":"",w=[v,e.lineCount?`${e.lineCount} 行`:"",x,y].filter(Boolean).join(" · ");async function S(){try{await navigator.clipboard.writeText(p),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(rf,{"aria-hidden":!0}):o.jsx(J4,{"aria-hidden":!0}),o.jsx("span",{children:d?"已复制":"复制"})]})]})]}),c&&(h?o.jsx("pre",{ref:a,children:g}):o.jsx("div",{className:"aw-deploy-log-empty",children:O}))]})}function ugt({task:e}){var t;return o.jsx(V0e,{log:e.buildLog,autoExpand:((t=e.buildLog)==null?void 0:t.status)!=="complete"&&(e.status==="running"||e.status==="error")&&z0e(e)===lgt,title:"构建日志",ariaLabel:"构建日志",copyLabel:"构建日志",defaultPendingMessage:"正在等待构建日志…"})}function dgt({task:e}){var t;return o.jsx(V0e,{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 fgt({task:e,onReturnToEdit:t}){const n=U0e(e),r=z0e(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(ir,{className:"spin"}):e.status==="success"?o.jsx($2e,{}):e.status==="error"?o.jsx(Ane,{}):o.jsx(zF,{})}),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),[xr,Pe]=m.useState(()=>new Set),[at,Lt]=m.useState(!1),[Wt,fn]=m.useState(""),[Jt,or]=m.useState(null),[Sr,si]=m.useState([]),[Yt,_r]=m.useState([]),[kn,Wr]=m.useState(!1),[jr,Rr]=m.useState(""),[Rn,lr]=m.useState(""),[Nn,cr]=m.useState(0),[Lr,$r]=m.useState([]),[Zr,bn]=m.useState(!1),[ue,Ie]=m.useState(""),[ot,dt]=m.useState(0),[Zn,Fi]=m.useState(null),[Ui,Es]=m.useState(1),[Ii,Ds]=m.useState(!1),[mr,Ws]=m.useState(""),[$c,Ka]=m.useState(0),[ai,Zl]=m.useState(!1),[To,ga]=m.useState(()=>new Set),[Ja,Ia]=m.useState(!1),[Ji,Zs]=m.useState(""),[Di,Ks]=m.useState(""),[Er,Ps]=m.useState(()=>new Set),zi=m.useRef(!1),xi=m.useRef(""),ba=m.useRef(null),es=m.useRef(0),Kn=m.useRef(0),Oa=m.useRef(0),[_o,Js]=m.useState(Umt),[Ms,Fu]=m.useState("");m.useEffect(()=>{e.length!==0&&Js(X=>X.map((ge,_e)=>_e===0&&ge.agentIds.length===0?{...ge,agentIds:e.slice(0,2).map(He=>He.id)}:ge))},[e]);const ks=m.useMemo(()=>{const X=new Map;for(const ge of e)ge.runtimeId&&X.set(ge.runtimeId,ge);return X},[e]),dl=m.useMemo(()=>{var ge;const X=new Map;for(const _e of t){const He=(ge=_e.deploymentTarget)==null?void 0:ge.runtimeId;if(!He||!ks.has(He))continue;const bt=X.get(He);(!bt||_e.updatedAt>bt.updatedAt)&&X.set(He,_e)}return X},[ks,t]),eo=m.useMemo(()=>{const X=new Map;for(const ge of f){if(!ge.runtimeId)continue;const _e=X.get(ge.runtimeId);(!_e||ge.startedAt>_e.startedAt)&&X.set(ge.runtimeId,ge)}return X},[f]),Kl=m.useMemo(()=>{const X=Y.trim().toLowerCase();return X?e.filter(ge=>{const _e=ge.runtimeId?dl.get(ge.runtimeId):void 0,He=ge.runtimeId?eo.get(ge.runtimeId):void 0;return[ge.label,ge.app,ge.host??"",(_e==null?void 0:_e.draft.name)??"",(_e==null?void 0:_e.draft.description)??"",(He==null?void 0:He.runtimeName)??""].join(" ").toLowerCase().includes(X)}):e},[e,eo,Y,dl]),ea=m.useMemo(()=>{const X=Y.trim().toLowerCase();return t.filter(ge=>{var He;const _e=(He=ge.deploymentTarget)==null?void 0:He.runtimeId;return _e&&ks.has(_e)?!1:X?`${ge.draft.name} ${ge.draft.description}`.toLowerCase().includes(X):!0})},[ks,t,Y]),Uu=m.useMemo(()=>t.filter(X=>{var _e;const ge=(_e=X.deploymentTarget)==null?void 0:_e.runtimeId;return!ge||!ks.has(ge)}).length,[ks,t]),In=m.useMemo(()=>{const X=Y.trim().toLowerCase();return X?_o.filter(ge=>ge.name.toLowerCase().includes(X)):_o},[_o,Y]),ae=e.find(X=>X.id===L),$n=t.find(X=>X.id===F),gr=h?f.find(X=>X.id===h):void 0,ya=ae!=null&&ae.runtimeId?dl.get(ae.runtimeId):void 0,yn=y?At:L&&i===L?r:null,Jn=(yn==null?void 0:yn.appName)||(ae==null?void 0:ae.runtimeApp)||(ae==null?void 0:ae.app)||"",ta=c&&(ae!=null&&ae.runtimeId)?EY:EY.filter(X=>X.id!=="usage"),Bc=JSON.stringify([(ae==null?void 0:ae.runtimeId)??"",(ae==null?void 0:ae.region)??"cn-beijing",Jn,Ui]),fs=(Zn==null?void 0:Zn.requestKey)===Bc?Zn.value:null,Ao=`${(ae==null?void 0:ae.region)??"cn-beijing"}:${(ae==null?void 0:ae.runtimeId)??""}`,Jl=(Qe==null?void 0:Qe.requestKey)===Ao?Qe.value:"",Br=(V==null?void 0:V.requestKey)===Ao?V:null,vi=!!((Gw=Br==null?void 0:Br.apiApps)!=null&&Gw.length),ee=!!(Br!=null&&Br.a2a),Le=((Yw=Br==null?void 0:Br.apiApps)==null?void 0:Yw[0])??Jn,rt=(z==null?void 0:z.endpoint)??"",Mt=Hmt(((Ww=Br==null?void 0:Br.a2a)==null?void 0:Ww.endpoint)??"",rt),Un=JSON.stringify([(ae==null?void 0:ae.runtimeId)??"",(ae==null?void 0:ae.region)??"",Jn]),On=(re==null?void 0:re.requestKey)===Un?re.value:null;m.useEffect(()=>{const X=es.current+1;es.current=X,Re(null),Gt("");const ge=(ae==null?void 0:ae.runtimeId)??"",_e=(ae==null?void 0:ae.region)??"";if(!l||!ge||!_e){Ke(!1);return}const He=new AbortController;return Ke(!0),Vre({runtimeId:ge,region:_e,appName:Jn,signal:He.signal}).then(bt=>{var zt,Pr;if(X===es.current){if(bt.runtime.runtimeId!==ge||bt.runtime.region!==_e||Jn&&((zt=bt.agent)==null?void 0:zt.appName)!==Jn||bt.canUpdate&&!((Pr=bt.agent)!=null&&Pr.appName)){Gt("Runtime 更新能力响应与当前选择不匹配。");return}Re({requestKey:Un,value:bt})}}).catch(bt=>{X!==es.current||He.signal.aborted||Gt(bt instanceof Error?bt.message:"检查 Runtime 更新能力失败。")}).finally(()=>{X===es.current&&!He.signal.aborted&&Ke(!1)}),()=>He.abort()},[l,ae==null?void 0:ae.region,ae==null?void 0:ae.runtimeId,Jn,Un]);const se=m.useMemo(()=>{const X=new Map(e.map((_e,He)=>[_e.id,He])),ge=new Map(n.map((_e,He)=>[_e,He]));return[...Kl].sort((_e,He)=>{const bt=_e.runtimeId?eo.get(_e.runtimeId):void 0,zt=He.runtimeId?eo.get(He.runtimeId):void 0,Pr=(bt==null?void 0:bt.status)==="running"?bt.startedAt:0,Qc=(zt==null?void 0:zt.status)==="running"?zt.startedAt:0;if(Pr!==Qc)return Qc-Pr;const Bn=ge.get(_e.id),Fc=ge.get(He.id);return Bn!=null&&Fc!=null?Bn-Fc:Bn!=null?-1:Fc!=null?1:(X.get(_e.id)??0)-(X.get(He.id)??0)})},[n,e,Kl,eo]),De=(ae==null?void 0:ae.label)||(yn==null?void 0:yn.name)||($n==null?void 0:$n.draft.name)||(gr==null?void 0:gr.agentName)||((lp=gr==null?void 0:gr.agentDraft)==null?void 0:lp.name)||"未选择智能体",qe=_o.find(X=>X.id===Ms),Rt=se.filter(X=>X.canDelete===!0),Se=se.filter(X=>En.has(X.id)&&X.canDelete===!0),Ct=ea.filter(X=>xr.has(X.id)),qt=Rt.length+ea.length,ft=Se.length+Ct.length,_t=m.useMemo(()=>{var ge;if(gr!=null&&gr.agentDraft)return gr.agentDraft;if($n!=null&&$n.draft)return $n.draft;const X=(ge=ae==null?void 0:ae.region)!=null&&ge.startsWith("ap-")?"byteplus":"volcengine";return On!=null&&On.agent?G6(On.agent,X):Zmt(yn,Jn||(ae==null?void 0:ae.label)||"agent",X)},[yn,Jn,ae==null?void 0:ae.label,ae==null?void 0:ae.region,$n==null?void 0:$n.draft,gr==null?void 0:gr.agentDraft,On==null?void 0:On.agent]),un=((Zw=yn==null?void 0:yn.draft)==null?void 0:Zw.harnessSidecar)??Lmt(z==null?void 0:z.envs),br=un?qC.filter(X=>un.componentOverrides[X]):[],wi=$n?a?"":"当前账号没有新建 Agent 的权限。":l?ae!=null&&ae.runtimeId?ae.region?nt?"正在检查 Runtime 更新能力…":tn||(On?On.canUpdate?(Of=On.agent)!=null&&Of.appName?"":"Runtime 更新能力响应缺少智能体信息。":On.reason||"当前 Runtime 不支持原地更新。":"尚未完成 Runtime 更新能力检查。"):"Runtime 缺少地域信息,无法更新。":"仅支持更新已部署的云端智能体。":"当前账号没有管理 Agent 的权限。",sp="aw-update-disabled-reason",ec=m.useMemo(()=>{if(yn)return yn.tools;const X=(_t.builtinTools??[]).map(ge=>{var _e;return((_e=xO.find(He=>He.id===ge))==null?void 0:_e.label)??ge});return Array.from(new Set([..._t.tools,...X,...(_t.customTools??[]).map(ge=>ge.name),...(_t.mcpTools??[]).map(ge=>ge.name)].filter(Boolean)))},[_t,yn]),gf=m.useMemo(()=>yn?yn.skillsPreviewSupported?yn.skills.map(X=>X.name):null:Array.from(new Set([...(_t.selectedSkills??[]).map(X=>X.name),..._t.skills].filter(Boolean))),[_t,yn]),ur=m.useMemo(()=>{if(gr)return gr;if($n)return f.filter(X=>{var ge,_e;return((ge=X.agentDraft)==null?void 0:ge.name)===$n.draft.name||X.agentName===$n.draft.name||!!((_e=$n.deploymentTarget)!=null&&_e.runtimeId)&&X.runtimeId===$n.deploymentTarget.runtimeId}).sort((X,ge)=>ge.startedAt-X.startedAt)[0];if(ae)return f.filter(X=>!!ae.runtimeId&&X.runtimeId===ae.runtimeId||X.agentName===ae.label).sort((X,ge)=>ge.startedAt-X.startedAt)[0]},[f,ae,$n,gr]),rg=!!(h&&ur&&ur.id===h),ig=!!(ur&&(ur.status!=="success"||rg)),fl=(ur==null?void 0:ur.status)==="running",zu=ur!=null&&ur.draftId?t.find(X=>X.id===ur.draftId)??(ur.agentDraft?{id:ur.draftId,draft:ur.agentDraft,updatedAt:ur.startedAt}:void 0):void 0,zn=m.useMemo(()=>igt(_t),[_t]),Ht=(ae==null?void 0:ae.currentVersion)??(z==null?void 0:z.currentVersion)??null,dr=Ht??(gr==null?void 0:gr.startedAt)??"unknown",Ts=yn?`runtime:${(ae==null?void 0:ae.runtimeId)??yn.name}:v${dr}:${zn}`:`draft:${(gr==null?void 0:gr.id)??($n==null?void 0:$n.id)??(ae==null?void 0:ae.id)??De}:${zn}`;m.useEffect(()=>{j==="usage"&&!c&&P("basic")},[c,j]),m.useEffect(()=>{if(!h)return;const X=f.find(_e=>_e.id===h),ge=X!=null&&X.runtimeId?ks.get(X.runtimeId):void 0;if(ge){q(""),U(ge.id),P("basic");return}U(""),q(""),P("basic")},[ks,f,h]),m.useEffect(()=>{if(!p){xi.current="";return}const X=`${p}:${b}:${g}:${c}`;xi.current!==X&&e.some(ge=>ge.id===p)&&(xi.current=X,q(""),U(p),P(b==="usage"&&!c?"basic":b),b==="evaluations"&&(Dt(g),Ge("")))},[e,c,p,b,g]),m.useEffect(()=>{for(const X of se.slice(0,8)){if(!X.runtimeId)continue;const ge=X.region??"cn-beijing";Hre(X.runtimeId,ge),fre(X.runtimeId,ge,X.runtimeApp??"")}},[se]),m.useEffect(()=>{let X=!1;const ge=(ae==null?void 0:ae.runtimeId)??"",_e=(ae==null?void 0:ae.region)??"cn-beijing",He=(ae==null?void 0:ae.runtimeApp)??"",bt=ge?dre(ge,_e,He):null;if(St(bt),Ue(!!bt||!y||!ge),!(!y||!ge))return m6(ge,_e,He,{force:!0}).then(zt=>{X||St(zt)}).catch(()=>{!X&&!bt&&St(null)}).finally(()=>{X||Ue(!0)}),()=>{X=!0}},[y,ae==null?void 0:ae.currentVersion,ae==null?void 0:ae.region,ae==null?void 0:ae.runtimeApp,ae==null?void 0:ae.runtimeId]),m.useEffect(()=>{let X=!1;const ge=(ae==null?void 0:ae.runtimeId)??"",_e=(ae==null?void 0:ae.region)??"cn-beijing";if($r([]),Ie(""),j!=="optimizations"||!ge){bn(!1);return}if(y&&!Jn){bn(!ve);return}return bn(!0),tre({runtimeId:ge,region:_e,appName:Jn}).then(He=>{X||$r(He.groups)}).catch(He=>{X||Ie(He instanceof Error?He.message:String(He))}).finally(()=>{X||bn(!1)}),()=>{X=!0}},[ve,y,ot,j,Jn,ae==null?void 0:ae.region,ae==null?void 0:ae.runtimeId]),m.useEffect(()=>{Es(1)},[ae==null?void 0:ae.runtimeId,Jn]),m.useEffect(()=>{const X=Oa.current+1;Oa.current=X;const ge=(ae==null?void 0:ae.runtimeId)??"",_e=(ae==null?void 0:ae.region)??"cn-beijing",He=Jn;if(Ws(""),j!=="usage"||!ge){Ds(!1);return}if(!He){Ds(y&&!ve);return}const bt=new AbortController;return Ds(!0),Rre({runtimeId:ge,region:_e,appName:He,page:Ui,pageSize:zmt,signal:bt.signal}).then(zt=>{if(X===Oa.current){if(zt.runtimeId!==ge||zt.appName!==He||zt.page!==Ui){Ws("用量响应与当前 Agent 不匹配,请重试。");return}Fi({requestKey:Bc,value:zt})}}).catch(zt=>{X!==Oa.current||bt.signal.aborted||Ws(zt instanceof Error?zt.message:"加载 Agent 用量失败。")}).finally(()=>{X===Oa.current&&Ds(!1)}),()=>{bt.abort()}},[Ui,$c,Bc,ve,y,j,Jn,ae==null?void 0:ae.region,ae==null?void 0:ae.runtimeId]),m.useEffect(()=>{Kn.current+=1,Me(null),ke(!1),$e(!1),Ae(""),je("api-server")},[Ao,j]);function oi(){Kn.current+=1,Me(null),ke(!1),$e(!1),Ae("")}function xa(X){X!==be&&(oi(),je(X))}async function Uw(){if(le){oi();return}const X=(ae==null?void 0:ae.runtimeId)??"",ge=(ae==null?void 0:ae.region)??"cn-beijing";if(!X)return;const _e=Kn.current+1;Kn.current=_e,$e(!0),Ae("");try{const He=await Ure(X,ge);if(_e!==Kn.current)return;Me({requestKey:Ao,value:He}),ke(!0)}catch(He){if(_e!==Kn.current)return;Me(null),ke(!1),Ae(He instanceof Error?He.message:"读取 Runtime API Key 失败。")}finally{_e===Kn.current&&$e(!1)}}m.useEffect(()=>{let X=!1;const ge=(ae==null?void 0:ae.runtimeId)??"",_e=(ae==null?void 0:ae.region)??"cn-beijing",He=ge?qre(ge,_e):null;if(B(He),!!ge)return y6(ge,_e,{force:!0}).then(bt=>{X||B(bt)}).catch(()=>{!X&&!He&&B(null)}),()=>{X=!0}},[ae==null?void 0:ae.currentVersion,ae==null?void 0:ae.region,ae==null?void 0:ae.runtimeId]),m.useEffect(()=>{let X=!1;const ge=(ae==null?void 0:ae.runtimeId)??"";if(ne(""),j!=="versions"||!ge){We(!1),ge||ut(null);return}return We(!0),Ck(ge).then(_e=>{X||ut(_e)}).catch(_e=>{X||(ut(null),ne(_e instanceof Error?_e.message:"读取 GitHub 版本失败。"))}).finally(()=>{X||We(!1)}),()=>{X=!0}},[j,ae==null?void 0:ae.currentVersion,ae==null?void 0:ae.runtimeId]),m.useEffect(()=>{let X=!1;const ge=(ae==null?void 0:ae.runtimeId)??"",_e=(ae==null?void 0:ae.region)??"cn-beijing",He=`${_e}:${ge}`;if(Z(""),j!=="integrations"||!ge){Oe(!1),ge||ce(null);return}Oe(!0);const bt=bA(ge,_e,{retryProbe:!0}).catch(zt=>{if(zt instanceof fa&&zt.unsupported)return null;throw zt});return Promise.all([bt,Fre(ge,_e,{retryProbe:!0})]).then(([zt,Pr])=>{X||ce({requestKey:He,apiApps:zt,a2a:Pr})}).catch(zt=>{X||(ce(null),Z(zt instanceof Error?zt.message:"探测集成方式失败。"))}).finally(()=>{X||Oe(!1)}),()=>{X=!0}},[J,j,ae==null?void 0:ae.currentVersion,ae==null?void 0:ae.region,ae==null?void 0:ae.runtimeId]),m.useEffect(()=>{let X=!1;const ge=(ae==null?void 0:ae.runtimeId)??"",_e=(ae==null?void 0:ae.region)??"cn-beijing",He=ge&&Jn?nre({runtimeId:ge,region:_e,appName:Jn,pageSize:100}):null;if(si(He?CY(He):[]),_r((He==null?void 0:He.sets)??[]),Rr(""),lr((He==null?void 0:He.unsupportedMessage)??""),j!=="evaluations"||!ge){Wr(!1);return}if(y&&!Jn){Wr(!ve);return}return Wr(!He),gA({runtimeId:ge,region:_e,appName:Jn,pageSize:100},{force:!0}).then(bt=>{X||(_r(bt.sets),si(CY(bt)),lr(bt.unsupportedMessage??""))}).catch(bt=>{X||(Rr(bt instanceof Error?bt.message:String(bt)),lr(""))}).finally(()=>{X||Wr(!1)}),()=>{X=!0}},[ve,y,Nn,j,Jn,yn==null?void 0:yn.appName,ae==null?void 0:ae.region,ae==null?void 0:ae.runtimeId]);async function oN(X){const ge=(ae==null?void 0:ae.runtimeId)??"",_e=X.commitSha??"";if(!(!ge||!_e||he)){xe(_e),ne("");try{await Sre({runtimeId:ge,targetCommitSha:_e});const He=await Ck(ge);ut(He)}catch(He){ne(He instanceof Error?He.message:"回退版本失败。")}finally{xe("")}}}m.useEffect(()=>{const X=new Set(Sr.map(ge=>ge.id));ga(ge=>{const _e=new Set([...ge].filter(He=>X.has(He)));return _e.size===ge.size?ge:_e}),Ps(ge=>{const _e=new Set([...ge].filter(He=>X.has(He)));return _e.size===ge.size?ge:_e}),Di&&!X.has(Di)&&Ks("")},[Sr,Di]),m.useEffect(()=>{Zl(!1),ga(new Set),Ps(new Set),Zs(""),Ks("")},[ae==null?void 0:ae.runtimeId]),m.useEffect(()=>{const X=new Set(se.filter(ge=>ge.canDelete===!0).map(ge=>ge.id));gn(ge=>{const _e=new Set([...ge].filter(He=>X.has(He)));return _e.size===ge.size?ge:_e})},[se]),m.useEffect(()=>{const X=new Set(ea.map(ge=>ge.id));Pe(ge=>{const _e=new Set([...ge].filter(He=>X.has(He)));return _e.size===ge.size?ge:_e})},[ea]);const Ir=m.useMemo(()=>!O||!(ae!=null&&ae.runtimeId)||O.runtimeId!==ae.runtimeId||Jn&&O.agentName&&O.agentName!==Jn?null:{...O,tag:O.kind==="good"?"Good case":"Bad case"},[O,ae==null?void 0:ae.runtimeId,Jn]),Vu=m.useMemo(()=>ae!=null&&ae.runtimeId?Ir?[Ir,...Sr.filter(X=>X.id!==Ir.id&&(!X.messageId||X.messageId!==Ir.messageId))]:Sr:Fmt,[Sr,Ir,ae==null?void 0:ae.runtimeId]),bf=Vu.filter(X=>{if(X.kind!==xt||(X.source==="auto"?"auto":"user")!==Pt)return!1;const _e=Ne.trim().toLowerCase();return _e?[X.input,X.output,X.referenceOutput,X.comment,X.tag??"",X.sessionId,X.messageId,X.userId,X.evaluationSetName].join(" ").toLowerCase().includes(_e):!0}),sg=bf.filter(X=>To.has(X.id)),zw=!!(ae!=null&&ae.runtimeId),Vw=X=>{Dt(X),Ge(""),Zs("");const ge=Vu.find(_e=>_e.kind===X);Ks((ge==null?void 0:ge.id)??""),window.setTimeout(()=>{var _e;(_e=ba.current)==null||_e.scrollIntoView({behavior:"smooth",block:"start"})},0)},lN=X=>{Zs(""),ga(ge=>{const _e=new Set(ge);return _e.has(X.id)?_e.delete(X.id):_e.add(X.id),_e})},ag=()=>{Zs(""),ga(new Set(bf.map(X=>X.id)))},og=()=>{Zs(""),ga(new Set),Zl(!1)},qw=X=>{Ps(ge=>{const _e=new Set(ge);return _e.has(X)?_e.delete(X):_e.add(X),_e})},Hw=X=>{Ks(X.id),Zs(""),!(!X.sessionId||!X.messageId)&&(C==null||C(X))},ht=async X=>{if(!(ae!=null&&ae.runtimeId)||!Jn||Ja||X.length===0)return;const ge=X.length===1?"确定删除这条反馈案例?原始聊天记录不会被删除。":`确定删除选中的 ${X.length} 条反馈案例?原始聊天记录不会被删除。`;if(!window.confirm(ge))return;const _e=X.map(bt=>bt.id),He=new Set(_e);Ia(!0),Zs("");try{await sre({runtimeId:ae.runtimeId,region:ae.region??"cn-beijing",appName:Jn,itemIds:_e});const bt=new Map;for(const zt of X)bt.set(zt.kind,(bt.get(zt.kind)??0)+1);si(zt=>zt.filter(Pr=>!He.has(Pr.id))),_r(zt=>zt.map(Pr=>({...Pr,itemCount:Math.max(0,Pr.itemCount-(bt.get(Pr.kind)??0))}))),ga(zt=>new Set([...zt].filter(Pr=>!He.has(Pr)))),Ps(zt=>new Set([...zt].filter(Pr=>!He.has(Pr)))),Di&&He.has(Di)&&Ks(""),X.length>1&&Zl(!1),N==null||N(X)}catch(bt){Zs(bt instanceof Error?bt.message:String(bt))}finally{Ia(!1)}},ap=X=>{Js(ge=>ge.map(_e=>_e.id===X.id?X:_e))},lg=()=>{const X=new Set(e.map(He=>He.id)),ge=n.filter(He=>X.has(He)),_e=new Set(ge);return[...ge,...e.filter(He=>!_e.has(He.id)).map(He=>He.id)]},cg=(X,ge,_e)=>{if(!w||X===ge)return;const He=lg().filter(Pr=>Pr!==X),bt=He.indexOf(ge),zt=bt<0?He.length:_e==="after"?bt+1:bt;He.splice(zt,0,X),w(He)},Dr=(X,ge)=>{if(!tt||tt===ge)return;const _e=X.currentTarget.getBoundingClientRect();Qt(ge),Ce(X.clientY>_e.top+_e.height/2?"after":"before")},qu=(X,ge)=>{if(!w)return;const _e=lg(),He=_e.indexOf(X),bt=Math.max(0,Math.min(_e.length-1,He+ge));He<0||He===bt||(_e.splice(He,1),_e.splice(bt,0,X),w(_e))},Xw=X=>{X.canDelete===!0&&(fn(""),gn(ge=>{const _e=new Set(ge);return _e.has(X.id)?_e.delete(X.id):_e.add(X.id),_e}))},GO=X=>{fn(""),Pe(ge=>{const _e=new Set(ge);return _e.has(X.id)?_e.delete(X.id):_e.add(X.id),_e})},cN=()=>{fn(""),gn(new Set(Rt.map(X=>X.id))),Pe(new Set(ea.map(X=>X.id)))},Hu=()=>{fn(""),gn(new Set),Pe(new Set),$t(!1)},uN=()=>{if(ft===0||at)return;const X=Se.length,ge=Ct.length;fn(""),or({kind:"selection",title:X===1&&ge===0?"删除 Agent?":X===0&&ge===1?"删除草稿?":"删除所选项目?",description:X===1&&ge===0?`"${Se[0].label}" 对应的云端 Runtime 将被永久删除,此操作不可撤销。`:X===0&&ge===1?`"${Ct[0].draft.name||"未命名 Agent"}" 将从本地草稿中删除。`:`将删除选中的 ${ft} 个项目。${X>0?`${X} 个云端 Runtime 将被永久删除,此操作不可撤销。`:"草稿删除后无法恢复。"}`,confirmLabel:X===0&&ge===1?"删除草稿":"删除所选",agents:Se,drafts:Ct})},op=async()=>{if(!(!Jt||at)){Lt(!0),fn("");try{if(Jt.kind==="selection"){const{agents:X,drafts:ge}=Jt;if(X.length>0){if(!S)throw new Error("当前页面不支持删除已部署 Agent。");await S(X)}ge.length>0&&(E==null||E(ge)),gn(new Set),Pe(new Set),$t(!1),X.some(_e=>_e.id===L)&&U(""),ge.some(_e=>_e.id===F)&&q("")}else if(Jt.kind==="agent"){if(!S)throw new Error("当前页面不支持删除已部署 Agent。");await S([Jt.agent]),L===Jt.agent.id&&U("")}else{if(!E)throw new Error("当前页面不支持删除草稿。");E([Jt.draft]),F===Jt.draft.id&&q("")}or(null)}catch(X){fn(X instanceof Error?X.message:String(X))}finally{Lt(!1)}}},dN=X=>{!S||X.canDelete!==!0||at||(fn(""),or({kind:"agent",title:"删除 Agent?",description:`"${X.label}" 对应的云端 Runtime 将被永久删除,此操作不可撤销。`,confirmLabel:"删除 Agent",agent:X}))},Dn=X=>{if(!E||at)return;const ge=X.draft.name||"未命名 Agent";fn(""),or({kind:"draft",title:"删除草稿?",description:`"${ge}" 将从本地草稿中删除。`,confirmLabel:"删除草稿",draft:X})},fN=()=>{const X=`eval-${Date.now()}`,ge={id:X,name:`新评测组 ${_o.length+1}`,agentIds:[],caseSet:"核心回归集",evaluator:"综合质量评估器",metrics:["回答质量"],concurrency:"4",history:[]};Js(_e=>[ge,..._e]),Fu(X)},hN=X=>{ap({...X,history:[{id:`run-${Date.now()}`,createdAt:"刚刚",score:86+X.history.length%7,status:"completed"},...X.history]})};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`aw-root${y?" is-detail-only":""}`,children:[o.jsxs("nav",{className:"aw-view-tabs","aria-label":"智能体工作台",children:[o.jsx("button",{type:"button",className:D==="library"?"is-active":"","aria-pressed":D==="library",onClick:()=>{M("library"),mt("")},children:"智能体库"}),o.jsx("button",{type:"button",className:D==="evaluation"?"is-active":"","aria-pressed":D==="evaluation",onClick:()=>{M("evaluation"),mt("")},children:"评测"})]}),o.jsxs("div",{className:"aw-workspace-frame",children:[o.jsxs("div",{className:"aw-workspace","aria-hidden":D==="evaluation"||void 0,ref:X=>{X==null||X.toggleAttribute("inert",D==="evaluation")},children:[o.jsxs("aside",{className:"aw-sidebar","aria-label":D==="library"?"智能体列表":"评测组列表",children:[o.jsxs("label",{className:"aw-search",children:[o.jsx(n2,{"aria-hidden":!0}),o.jsx("input",{value:Y,onChange:X=>mt(X.currentTarget.value),placeholder:D==="library"?"搜索智能体":"搜索评测组","aria-label":D==="library"?"搜索智能体":"搜索评测组"})]}),o.jsxs("button",{type:"button",className:"aw-create-card",onClick:D==="library"?_:fN,disabled:D==="library"&&!a,children:[o.jsx(qa,{"aria-hidden":!0}),o.jsx("span",{children:D==="library"?"新建 Agent":"新建评测组"})]}),D==="library"&&(S||E)&&o.jsx("div",{className:`aw-selection-toolbar${Ze?" is-active":""}`,children:Ze?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"aw-selection-count",children:["已选 ",ft," 个"]}),o.jsx("button",{type:"button",onClick:cN,disabled:qt===0||at,children:"全选"}),o.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void uN(),disabled:ft===0||at,children:at?"删除中…":"删除所选"}),o.jsx("button",{type:"button",onClick:Hu,disabled:at,children:"取消"})]}):o.jsx("button",{type:"button",onClick:()=>{fn(""),$t(!0)},disabled:qt===0,children:"选择"})}),D==="library"&&Wt&&o.jsx("div",{className:"aw-delete-error",role:"alert",children:Wt}),o.jsx("div",{className:"aw-agent-list",children:D==="evaluation"?In.length===0?o.jsx("div",{className:"aw-list-empty",children:"没有匹配的评测组"}):In.map(X=>o.jsxs("button",{type:"button",className:`aw-agent-item${X.id===Ms?" is-active":""}`,onClick:()=>Fu(X.id),children:[o.jsxs("span",{className:"aw-agent-copy aw-eval-group-copy",children:[o.jsx("strong",{children:X.name}),o.jsxs("small",{children:[X.agentIds.length," 个智能体 · ",X.history.length," 次运行"]})]}),o.jsx(R1,{"aria-hidden":!0})]},X.id)):u&&se.length===0&&ea.length===0?o.jsx("div",{className:"aw-list-empty",children:"正在读取云端智能体…"}):d&&se.length===0&&ea.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:"重试"})]}):se.length===0&&ea.length===0?o.jsx("div",{className:"aw-list-empty",children:"没有匹配的智能体"}):o.jsxs(o.Fragment,{children:[ea.map(X=>{const ge=f.filter(He=>{var bt,zt;return((bt=He.agentDraft)==null?void 0:bt.name)===X.draft.name||He.agentName===X.draft.name||!!((zt=X.deploymentTarget)!=null&&zt.runtimeId)&&He.runtimeId===X.deploymentTarget.runtimeId}).sort((He,bt)=>bt.startedAt-He.startedAt)[0],_e=xr.has(X.id);return o.jsxs("button",{type:"button",className:["aw-agent-item",Ze?"is-selecting":"",_e?"is-selected-for-delete":"",X.id===F?"is-active":""].filter(Boolean).join(" "),"aria-pressed":Ze?_e:void 0,onClick:()=>{if(Ze){GO(X);return}U(""),q(X.id),P("basic")},children:[Ze&&o.jsx("span",{className:`aw-select-marker${_e?" 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:X.draft.name||"未命名 Agent"}),o.jsx("span",{className:`aw-draft-badge${(ge==null?void 0:ge.status)==="running"?" is-deploying":""}`,children:(ge==null?void 0:ge.status)==="running"?"部署中":"草稿"})]}),o.jsx("small",{children:X.deploymentTarget?"待更新":"尚未发布"})]}),o.jsx(R1,{"aria-hidden":!0})]},X.id)}),se.map(X=>{const ge=X.runtimeId?eo.get(X.runtimeId):void 0,_e=X.runtimeId?dl.get(X.runtimeId):void 0,He=En.has(X.id),bt=X.canDelete===!0,zt=(ge==null?void 0:ge.status)==="running"?{label:"部署中",className:" is-deploying"}:(ge==null?void 0:ge.status)==="error"?{label:"失败",className:" is-error"}:(ge==null?void 0:ge.status)==="cancelled"?{label:"已取消",className:" is-muted"}:_e?{label:"待更新",className:""}:null,Pr=(ge==null?void 0:ge.status)==="running"?"正在更新部署":_e?"待更新":X.remote?X.host||"远程智能体":"本地智能体",Qc=["aw-agent-item","aw-agent-item--sortable",X.id===L?"is-active":"",Ze?"is-selecting":"",He?"is-selected-for-delete":"",Ze&&!bt?"is-selection-disabled":"",X.id===tt?"is-dragging":"",X.id===ar&&X.id!==tt?`is-drop-target is-drop-${Ut}`:""].filter(Boolean).join(" ");return o.jsxs("button",{type:"button",draggable:!!w&&!Ze,className:Qc,"aria-pressed":Ze?He:void 0,"aria-keyshortcuts":w?"Alt+ArrowUp Alt+ArrowDown":void 0,onDragStart:Bn=>{w&&(zi.current=!0,an(X.id),Bn.dataTransfer.effectAllowed="move",Bn.dataTransfer.setData("text/plain",X.id))},onDragEnter:Bn=>{Dr(Bn,X.id)},onDragOver:Bn=>{!tt||tt===X.id||(Bn.preventDefault(),Bn.dataTransfer.dropEffect="move",Dr(Bn,X.id))},onDragLeave:Bn=>{const Fc=Bn.relatedTarget;Fc instanceof Node&&Bn.currentTarget.contains(Fc)||ar===X.id&&Qt("")},onDrop:Bn=>{Bn.preventDefault();const Fc=Bn.dataTransfer.getData("text/plain")||tt;cg(Fc,X.id,Ut),an(""),Qt(""),Ce("before")},onDragEnd:()=>{an(""),Qt(""),Ce("before"),window.setTimeout(()=>{zi.current=!1},0)},onKeyDown:Bn=>{Bn.altKey&&(Bn.key==="ArrowUp"?(Bn.preventDefault(),qu(X.id,-1)):Bn.key==="ArrowDown"&&(Bn.preventDefault(),qu(X.id,1)))},onClick:Bn=>{if(Ze){Bn.preventDefault(),Xw(X);return}if(zi.current){Bn.preventDefault(),zi.current=!1;return}q(""),U(X.id),P("basic"),k(X.id)},children:[Ze&&o.jsx("span",{className:`aw-select-marker${He?" 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:X.label}),X.currentVersion!=null&&o.jsxs("span",{className:"aw-version-badge",children:["v",X.currentVersion]}),zt&&o.jsx("span",{className:`aw-draft-badge${zt.className}`,children:zt.label})]}),o.jsx("small",{children:Pr})]}),o.jsx(R1,{"aria-hidden":!0})]},X.id)})]})}),o.jsxs("div",{className:"aw-list-count",children:["共 ",D==="library"?e.length+Uu:_o.length," 个"]})]}),D==="evaluation"&&qe?o.jsx(bgt,{group:qe,agents:e,cases:Vu,onChange:ap,onRun:hN}):D==="evaluation"?o.jsx("main",{className:"aw-main aw-empty-selection",children:o.jsx("p",{children:"未选择评测组"})}):!ae&&!$n&&!gr?o.jsx("main",{className:"aw-main aw-empty-selection",children:o.jsx("p",{children:"未选择智能体"})}):o.jsxs("main",{className:`aw-main${fl?" is-deploying":""}`,children:[ae&&!yn&&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:"正在读取配置与运行信息…"})]})]})}),j==="integrations"&&we&&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.jsxs("div",{className:"aw-agent-head",children:[o.jsxs("div",{className:"aw-agent-heading",children:[y&&v?o.jsx(L9,{label:"返回智能体列表",onClick:v}):null,o.jsxs("div",{className:"aw-agent-heading-copy",children:[o.jsxs("div",{className:"aw-agent-title-row",children:[o.jsx("h2",{children:De}),Ht!=null&&o.jsxs("span",{children:["v",Ht]}),$n&&o.jsx("span",{children:"草稿"}),ya&&o.jsx("span",{children:"待更新"}),!ae&&!$n&&gr&&o.jsx("span",{children:gr.label})]}),o.jsx("p",{children:_t.description||(s||y&&!ve?"正在读取智能体信息…":"暂无描述")})]})]}),($n||ya||(ae==null?void 0:ae.canDelete))&&o.jsxs("div",{className:"aw-head-actions",children:[($n||ya)&&o.jsxs("button",{type:"button",className:"aw-head-delete aw-head-delete--draft",onClick:()=>{const X=$n??ya;X&&Dn(X)},disabled:at,"aria-label":"删除草稿",title:"删除草稿",children:[o.jsx(Rh,{"aria-hidden":!0}),o.jsx("span",{children:"删除草稿"})]}),(ae==null?void 0:ae.canDelete)&&o.jsxs("button",{type:"button",className:"aw-head-delete",onClick:()=>void dN(ae),disabled:at,"aria-label":"删除 Agent",title:"删除 Agent",children:[o.jsx(Rh,{"aria-hidden":!0}),o.jsx("span",{children:at?"删除中…":"删除 Agent"})]})]})]}),ur&&ig&&o.jsx("div",{className:`aw-detail-deployment${fl?" is-running":""}`,children:o.jsx(fgt,{task:ur,onReturnToEdit:zu&&$?()=>$(zu):void 0})}),o.jsx("nav",{className:"aw-agent-tabs","aria-label":"智能体详情",role:"tablist",children:ta.map(X=>o.jsx("button",{type:"button",id:`agent-${X.id}-tab`,className:j===X.id?"is-active":"",role:"tab","aria-selected":j===X.id,"aria-controls":`agent-${X.id}-panel`,tabIndex:j===X.id?0:-1,onClick:()=>P(X.id),onKeyDown:ge=>{var zt;if(!["ArrowLeft","ArrowRight","Home","End"].includes(ge.key))return;ge.preventDefault();const _e=ta.findIndex(Pr=>Pr.id===X.id),He=ge.key==="Home"?0:ge.key==="End"?ta.length-1:(_e+(ge.key==="ArrowRight"?1:-1)+ta.length)%ta.length,bt=ta[He];P(bt.id),(zt=document.getElementById(`agent-${bt.id}-tab`))==null||zt.focus()},children:X.label},X.id))}),o.jsxs("div",{className:"aw-content",id:`agent-${j}-panel`,role:"tabpanel","aria-labelledby":`agent-${j}-tab`,children:[j==="basic"&&o.jsxs("div",{className:"aw-basic-stack",children:[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)||(ae==null?void 0:ae.region)||(ur==null?void 0:ur.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(Ux,{draft:_t,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0},Ts)})]}),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:X6(yn==null?void 0:yn.model)||_t.modelName||"暂未提供"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"智能体数量"}),o.jsx("dd",{children:yn!=null&&yn.graph?Q0e(yn.graph):F0e(_t)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"工具"}),o.jsx("dd",{className:"aw-fact-badges",children:ec.length?ec.map(X=>o.jsx("span",{children:X},X)):"暂无"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"技能"}),o.jsx("dd",{className:"aw-fact-badges",children:gf===null?"暂不支持预览":gf.length?gf.map(X=>o.jsx("span",{children:X},X)):"暂无"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"当前版本"}),o.jsx("dd",{children:Ht!=null?`v${Ht}`:"暂未提供"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"状态"}),o.jsx("dd",{children:$n?"草稿":(ur==null?void 0:ur.status)==="error"?"部署失败":(ur==null?void 0:ur.status)==="cancelled"?"已取消":ya?"待更新":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:un!=null&&un.enabled?"is-ready":void 0,children:un?un.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:un?L0e(un.profile):"旧版本未保存此配置"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"已选优化项"}),o.jsx("dd",{className:"aw-fact-badges",children:un?br.length?br.map(X=>o.jsx("span",{children:ax(X)},X)):"未选择":"旧版本未保存此配置"})]})]})]})]}),j==="usage"&&(ae==null?void 0:ae.runtimeId)&&o.jsxs("section",{className:"aw-usage","aria-busy":Ii,children:[o.jsx("div",{className:"aw-usage-intro",children:o.jsx("h3",{children:"使用概览"})}),Ii&&!fs&&o.jsx("div",{className:"aw-usage-state",role:"status","aria-live":"polite",children:o.jsx(Ln,{as:"span",children:"正在加载用量统计"})}),mr&&o.jsxs("div",{className:"aw-usage-state is-error",role:"alert",children:[o.jsx("span",{children:mr}),o.jsx("button",{type:"button",onClick:()=>Ka(X=>X+1),children:"重试"})]}),!Ii&&!mr&&!fs&&!Jn&&o.jsx("div",{className:"aw-usage-state",children:"当前 Runtime 未返回可用的 Agent 应用名称,暂时无法读取用量。"}),fs&&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:fs.totalInvocations.toLocaleString("zh-CN")})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"使用用户数"}),o.jsx("dd",{children:fs.totalUsers.toLocaleString("zh-CN")})]})]}),o.jsxs("div",{className:"aw-usage-users-head",children:[o.jsx("h3",{children:"用户明细"}),Ii&&o.jsx(Ln,{as:"span",role:"status","aria-live":"polite",children:"正在刷新"})]}),fs.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:fs.users.map(X=>o.jsxs("tr",{children:[o.jsxs("td",{children:[o.jsx("strong",{children:X.displayName||X.userId||"未知用户"}),X.displayName&&X.userId&&o.jsx("small",{title:X.userId,children:X.userId})]}),o.jsx("td",{children:X.invocationCount.toLocaleString("zh-CN")}),o.jsx("td",{children:o.jsx("time",{dateTime:X.lastUsedAt,children:qmt(X.lastUsedAt)})})]},X.userId))})]})}),fs.totalPages>1&&o.jsxs("nav",{className:"aw-usage-pagination","aria-label":"用量用户列表分页",children:[o.jsx("button",{type:"button",disabled:Ii||fs.page<=1,onClick:()=>Es(X=>Math.max(1,X-1)),children:"上一页"}),o.jsxs("span",{"aria-live":"polite",children:["第 ",fs.page," / ",fs.totalPages," 页"]}),o.jsx("button",{type:"button",disabled:Ii||fs.page>=fs.totalPages,onClick:()=>Es(X=>X+1),children:"下一页"})]})]})]}),j==="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:(ug=Ve==null?void 0:Ve.cicd)!=null&&ug.enabled?"展示当前 Runtime 绑定 GitHub 后由 Studio 记录的版本与 PR。":"未挂载 GitHub 时仅展示 Studio 当前版本。"})]}),Tt&&o.jsx("div",{className:"aw-case-empty",children:"正在读取版本…"}),W&&o.jsxs("div",{className:"aw-integration-error",role:"alert",children:[o.jsx("span",{children:W}),(ae==null?void 0:ae.runtimeId)&&o.jsx("button",{type:"button",onClick:()=>void Ck(ae.runtimeId??"").then(ut),children:"重试"})]}),!Tt&&!W&&o.jsxs("div",{className:"aw-version-list",children:[(Ve==null?void 0:Ve.githubSyncError)&&o.jsx("div",{className:"aw-integration-error",role:"alert",children:o.jsx("span",{children:Ve.githubSyncError})}),(Ve==null?void 0:Ve.latestSourceRuntimeStatus)&&Ve.latestSourceRuntimeStatus!=="published"&&((Kw=Ve.versions[0])==null?void 0:Kw.commitSha)&&Ve.versions[0].commitSha!==Ve.currentCommitSha&&o.jsx("div",{className:"aw-integration-notice",role:"status",children:o.jsxs("span",{children:["源码已合入 main,Runtime 仍在",TY(Ve.latestSourceRuntimeStatus),";当前线上版本保持在最近一次发布成功的版本。"]})}),Ve!=null&&Ve.versions.length?Ve.versions.map(X=>{var zt;const ge=X.commitSha??"",_e=X.runtimeStatus??X.status,He=X.changeType==="rollback",bt=!!((zt=Ve.cicd)!=null&&zt.enabled)&&!!ge&&!He&&ge!==Ve.currentCommitSha;return o.jsxs("article",{className:"aw-version-row",children:[o.jsxs("div",{children:[o.jsx("strong",{children:Xmt(X)}),o.jsx("small",{children:X.createdAt||"暂无时间"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"PR 链接"}),X.pullRequestUrl?o.jsx("a",{href:X.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:X.author||"Studio"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"发布状态"}),o.jsx("em",{children:TY(_e)})]}),o.jsxs("div",{className:"aw-version-actions",children:[o.jsx("button",{type:"button",disabled:!bt||he===ge,onClick:()=>void oN(X),children:he===ge?"回退中…":"回退到此版本"}),X.workflowRunUrl&&o.jsx("a",{href:X.workflowRunUrl,target:"_blank",rel:"noopener noreferrer",children:"查看发布"})]})]},`${X.version}-${ge||X.createdAt}`)}):o.jsxs("article",{className:"aw-version-row",children:[o.jsxs("div",{children:[o.jsx("strong",{children:Ht!=null?`v${Ht}`:"暂无版本"}),o.jsx("small",{children:(z==null?void 0:z.updatedAt)||"暂无时间"})]}),o.jsx("p",{children:"未挂载 GitHub 时仅展示 Studio 当前版本。"})]})]})]}),j==="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 可确认的公开协议与地址。"})]}),de&&o.jsxs("div",{className:"aw-integration-error",role:"alert",children:[o.jsx("span",{children:de}),o.jsx("button",{type:"button",onClick:()=>fe(X=>X+1),children:"重试"})]}),!de&&o.jsxs("div",{className:"aw-integration-body",children:[o.jsxs("div",{className:`aw-integration-protocol-tabs${be==="a2a"?" is-a2a":""}`,role:"tablist","aria-label":"接入协议",children:[o.jsx("span",{className:"aw-integration-protocol-slider","aria-hidden":"true"}),My.map((X,ge)=>o.jsx("button",{type:"button",id:`integration-${X.id}-tab`,role:"tab","aria-selected":be===X.id,"aria-controls":`integration-${X.id}-panel`,tabIndex:be===X.id?0:-1,onClick:()=>xa(X.id),onKeyDown:_e=>{var zt;if(!["ArrowLeft","ArrowRight","Home","End"].includes(_e.key))return;_e.preventDefault();const He=_e.key==="Home"?0:_e.key==="End"?My.length-1:(ge+(_e.key==="ArrowRight"?1:-1)+My.length)%My.length,bt=My[He];xa(bt.id),(zt=document.getElementById(`integration-${bt.id}-tab`))==null||zt.focus()},children:X.label},X.id))]}),be==="api-server"?o.jsx(AY,{protocol:"api-server",title:"API Server",available:vi,fields:[{label:"Agent",value:vi?((YO=Br==null?void 0:Br.apiApps)==null?void 0:YO.join("、"))??"":""},{label:"发现接口",value:vi?rD(rt,"/list-apps"):""},{label:"调用接口",value:vi?rD(rt,"/run_sse"):""},{label:"鉴权方式",value:vi?kY(z==null?void 0:z.authType):""},{label:"API Key",value:o.jsx(_Y,{available:vi,authType:z==null?void 0:z.authType,value:Jl,visible:le&&!!Jl,loading:ye,error:ze,onToggle:()=>void Uw()})}],example:vi?Gmt(rt,Le,z==null?void 0:z.authType):""}):o.jsx(AY,{protocol:"a2a",title:"A2A",available:ee,fields:[{label:"Agent",value:((Jw=Br==null?void 0:Br.a2a)==null?void 0:Jw.name)??""},{label:"Agent Card",value:ee?rD(rt,"/.well-known/agent-card.json"):""},{label:"调用地址",value:Mt},{label:"鉴权方式",value:ee?kY(z==null?void 0:z.authType):""},{label:"API Key",value:o.jsx(_Y,{available:ee,authType:z==null?void 0:z.authType,value:Jl,visible:le&&!!Jl,loading:ye,error:ze,onToggle:()=>void Uw()})}],example:ee?Ymt(Mt,z==null?void 0:z.authType):""})]})]}),j==="evaluations"&&o.jsxs("section",{className:"aw-cases",children:[(ae==null?void 0:ae.runtimeId)&&o.jsx("div",{className:"aw-case-summary",children:["good","bad"].map(X=>{const ge=rgt(Yt,X),_e=Vu.filter(bt=>bt.kind===X).length,He=Ir?_e:(ge==null?void 0:ge.itemCount)??_e;return o.jsxs("button",{type:"button",onClick:()=>Vw(X),children:[o.jsx("strong",{children:He}),o.jsx("span",{children:X==="good"?"Good cases":"Bad cases"})]},X)})}),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(X=>o.jsx("button",{type:"button",className:xt===X?"is-active":"","aria-pressed":xt===X,onClick:()=>Dt(X),children:X==="good"?"Good case":"Bad case"},X))}),o.jsx("div",{className:"aw-case-source-filters","aria-label":"回流方式筛选",children:["auto","user"].map(X=>o.jsx("button",{type:"button",className:Pt===X?"is-active":"","aria-pressed":Pt===X,onClick:()=>Kt(X),children:X==="auto"?"自动回流":"手动回流"},X))})]}),o.jsxs("label",{className:"aw-case-search",children:[o.jsx(n2,{"aria-hidden":!0}),o.jsx("input",{type:"search",value:Ne,onChange:X=>Ge(X.currentTarget.value),placeholder:"搜索用户输入、期望行为或标签","aria-label":"搜索评测案例"})]})]}),zw&&o.jsx("div",{className:`aw-case-toolbar${ai?" is-active":""}`,children:ai?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"aw-selection-count",children:["已选 ",sg.length," 条"]}),o.jsx("button",{type:"button",onClick:ag,disabled:bf.length===0||Ja,children:"全选当前"}),o.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void ht(sg),disabled:sg.length===0||Ja,children:Ja?"删除中…":"删除所选"}),o.jsx("button",{type:"button",onClick:og,disabled:Ja,children:"取消"})]}):o.jsx("button",{type:"button",onClick:()=>{Zs(""),Zl(!0)},disabled:bf.length===0||Ja,children:"选择案例"})}),Ji&&o.jsx("div",{className:"aw-delete-error",role:"alert",children:Ji}),o.jsx("div",{ref:ba,children:o.jsx(ggt,{cases:bf,loading:kn&&bf.length===0,error:jr,notice:Rn,runtimeBacked:!!(ae!=null&&ae.runtimeId),selectionMode:ai,selectedCaseIds:To,focusedCaseId:Di,expandedCaseIds:Er,deleting:Ja,canDelete:zw,onOpenCase:Hw,onToggleCase:lN,onToggleExpanded:qw,onDeleteCase:X=>void ht([X]),onRetry:()=>cr(X=>X+1)})})]}),j==="optimizations"&&o.jsxs("section",{className:"aw-optimizations",children:[o.jsxs("div",{className:"aw-optimization-intro",children:[o.jsx("h3",{children:"优化项"}),o.jsx("p",{children:"根据评测结果汇总需要优先处理的改进建议。"})]}),Zr?o.jsxs("div",{className:"aw-optimization-state",role:"status",children:[o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),o.jsx("span",{children:"正在读取优化项"})]}):ue?o.jsxs("div",{className:"aw-optimization-state is-error",role:"alert",children:[o.jsx("span",{children:ue}),o.jsx("button",{type:"button",onClick:()=>dt(X=>X+1),children:"重试"})]}):Lr.length>0?o.jsx(pgt,{groups:Lr}):o.jsx("div",{className:"aw-optimization-state",children:"暂无优化项,自动评测完成后会在这里生成建议。"})]})]}),j==="basic"&&(ae||$n)&&o.jsxs("div",{className:"aw-basic-actions",children:[ae&&o.jsxs("button",{type:"button",className:"aw-talk studio-update-action",onClick:()=>T==null?void 0:T(ae),children:[o.jsx(J2e,{"aria-hidden":!0}),o.jsx("span",{children:"去对话"})]}),o.jsxs("span",{className:`aw-update-wrap${wi?" is-disabled":""}`,tabIndex:wi?0:void 0,"aria-describedby":wi?sp:void 0,children:[o.jsx("button",{type:"button",className:"aw-update studio-update-action",disabled:!!wi,"aria-busy":nt||void 0,"aria-describedby":wi?sp:void 0,onClick:()=>$n?$==null?void 0:$($n):On?R(On):void 0,children:nt?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"loading-gap-spinner aw-update-spinner","aria-hidden":"true"}),o.jsx("span",{children:"检测中"})]}):$n||ya?"继续编辑":"更新"}),wi&&o.jsx("span",{id:sp,className:"aw-update-disabled-reason",role:"tooltip",children:wi})]})]})]})]}),D==="evaluation"&&o.jsx("div",{className:"aw-evaluation-glass",role:"status",children:o.jsx("span",{children:"敬请期待"})})]})]}),Jt&&o.jsx(Bl,{variant:"danger",title:Jt.title,description:Jt.description,confirmLabel:at?"删除中...":Jt.confirmLabel,closeLabel:"关闭删除确认",busy:at,onCancel:()=>or(null),onConfirm:()=>void op()})]})}function pgt({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:egt(t.priority)})}),o.jsx("td",{children:o.jsx("span",{className:"aw-optimization-module",children:ngt(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 mgt(){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 ggt({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:p,onDeleteCase:b,onRetry:g}){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}),g&&o.jsx("button",{type:"button",onClick:g,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(O=>{var T,C;const y=O.id.startsWith("local:"),v=(a==null?void 0:a.has(O.id))??!1,x=(c==null?void 0:c.has(O.id))??!1,S=O.output.length+O.referenceOutput.length>220||(((T=O.reason)==null?void 0:T.length)??0)>120,E=d&&!y,k=!!(O.comment&&O.comment.trim()!==((C=O.reason)==null?void 0:C.trim()));return o.jsxs("div",{className:["aw-case-row",l===O.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(O));return}f==null||f(O)},onKeyDown:N=>{N.target===N.currentTarget&&(N.key!=="Enter"&&N.key!==" "||(N.preventDefault(),s?E&&(h==null||h(O)):f==null||f(O)))},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:O.input,children:O.input||"无用户输入"})]}),k&&o.jsxs("small",{title:O.comment,children:["备注:",O.comment]}),o.jsx("small",{className:"aw-case-time",children:Kmt(O.createdAt)}),(O.userId||O.sessionId)&&o.jsx("small",{title:[O.userId,O.sessionId].filter(Boolean).join(" · "),children:[O.userId,O.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:O.output,children:O.output||"无可见回复"}),O.referenceOutput&&o.jsxs("small",{className:"aw-case-output-preview",title:O.referenceOutput,children:["Reference: ",O.referenceOutput]}),S&&o.jsx("button",{type:"button",className:"aw-case-expand",onClick:N=>{N.stopPropagation(),p==null||p(O.id)},children:x?"收起":"展开"})]}),o.jsx("div",{className:"aw-case-score aw-case-cell","data-label":"评分",children:Jmt(O)}),o.jsx("div",{className:`aw-case-reason aw-case-cell${x?" is-expanded":""}`,"data-label":"评分理由",children:o.jsx("p",{title:O.reason||void 0,children:O.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:N=>{N.stopPropagation(),b==null||b(O)},disabled:u,title:"删除反馈案例","aria-label":"删除反馈案例",children:o.jsx(mgt,{})})})]},O.id)})]})}function bgt({group:e,agents:t,cases:n,onChange:r,onRun:i}){const[s,a]=m.useState("config"),l=e.agentIds.map(f=>t.find(h=>h.id===f)).filter(f=>!!f),c=["回答质量","事实准确性","工具调用","响应效率"];m.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(X2e,{"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(rf,{}),"已完成"]}),o.jsx(R1,{"aria-hidden":!0})]},f.id))})]})})]})}const Ogt="/web/sandbox/sessions",NY="/web/sandbox/codex-project-handoff",jY=3e4,iD=33e4,ygt=6e4,xgt=6e5,Ly=15e3,fd=6e4,vgt=33e4,RY=3e4,wgt=60*60,IY=40;function HC(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 ki(e){const t=new Headers(e);return t.has("Accept")||t.set("Accept","application/json"),t}async function Ti(e,t){const n=await e.text().catch(()=>"");let r={};try{r=JSON.parse(n)}catch{const c=`${t}(HTTP ${e.status})`;return new Error(n?`${c}:${n}`:c)}const i=r.detail,s=i&&typeof i=="object"&&"message"in i?i.message:i??r.error??r.message,a=typeof s=="string"?s:s==null?"":JSON.stringify(s),l=`${t}(HTTP ${e.status})`;return new Error(a?`${l}:${a}`:l)}async function DY(e,t){const n=await e.text().catch(()=>"");try{return JSON.parse(n)}catch{throw new Error(`${t} Studio 服务响应异常,请刷新后重试。`)}}function vp(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??"",threadId:e.threadId??"",cwd:e.cwd??"",workspaceLocked:e.workspaceLocked===!0,busy:e.busy===!0,...typeof e.model=="string"?{model:e.model}:{},permissions:XC(e.permissions),...e.conversation===void 0?{}:{restoredConversation:Mp(e.conversation)}}}function PY(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??""}}function MY(e,t){if(!(t!=null&&t.autoResumeSnapshots))return e;const n=new URLSearchParams({autoResumeSnapshots:"true"});return`${e}?${n.toString()}`}const $y={approvalPolicy:"on-request",approvalsReviewer:"user",sandboxMode:"workspace-write",networkAccess:!1};function XC(e){if(!e||typeof e!="object")return{...$y};const t=e,n=t.approvalPolicy,r=t.approvalsReviewer,i=t.sandboxMode;return{approvalPolicy:n==="untrusted"||n==="on-request"||n==="never"?n:$y.approvalPolicy,approvalsReviewer:r==="user"||r==="auto_review"?r:$y.approvalsReviewer,sandboxMode:i==="read-only"||i==="workspace-write"||i==="danger-full-access"?i:$y.sandboxMode,networkAccess:typeof t.networkAccess=="boolean"?t.networkAccess:$y.networkAccess}}function LY(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:XC(t.permissions)}}function Bs(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function Sgt(e){const t=Bs(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 Egt(e){const t=Bs(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 q0e(e){const t=Bs(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 Mp(e){const t=Bs(e),n=q0e(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=Bs(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=Bs(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:XC(t.permissions)}}function Z3(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 kgt(e){const t=Z3(e.usage);if(!t||typeof e.turnId!="string")return;const n=Z3(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 Tgt(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 _gt(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 g;const b=c?[...a,c]:a;(g=t.onBlocks)==null||g.call(t,b.map(O=>({...O})))}function f(b){s+=b;const g=a[a.length-1],O=a.length-1,y=[...l.values()].includes(O);(g==null?void 0:g.kind)==="text"&&!y?g.text+=b:a.push({kind:"text",text:b}),d()}function h(b){if(typeof b.id!="string"||b.kind!=="thinking"&&b.kind!=="commentary"&&b.kind!=="tool"||b.status!=="running"&&b.status!=="done")return;const g=b.status==="done";let O;if(b.kind==="thinking"){if(typeof b.text!="string"||!b.text)return;O={kind:"thinking",text:b.text,done:g}}else if(b.kind==="commentary"){if(typeof b.text!="string"||!b.text)return;O={kind:"text",text:b.text}}else{if(typeof b.name!="string"||!b.name)return;O={kind:"tool",name:b.name,args:b.args,response:b.response,done:g}}const y=l.get(b.id);y===void 0?(l.set(b.id,a.length),a.push(O)):a[y]=O,d()}function p(b){var v,x,w;let g="message";const O=[];for(const S of b.split(/\r?\n/))S.startsWith("event:")&&(g=S.slice(6).trim()),S.startsWith("data:")&&O.push(S.slice(5).trimStart());if(O.length===0)return;let y;try{y=JSON.parse(O.join(` -`))}catch{throw new Error("沙箱对话服务返回了无法解析的响应。")}if(g==="error")throw new Error(typeof y.message=="string"&&y.message?y.message:"沙箱对话失败,请稍后重试。");if(g==="progress"&&typeof y.text=="string"&&y.text&&(c={kind:"progress",text:y.text},d()),g==="activity"&&h(y),g==="development.source_ready"||g==="development.succeeded"){const S=Bs(y.payload),E=Bs(S==null?void 0:S.delivery),k=g==="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(T=>typeof T=="string")){const T={kind:"delivery",value:{sessionId:E.sessionId,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(N=>N.kind==="delivery"&&N.value.sessionId===E.sessionId&&N.value.artifactSha256===E.artifactSha256&&N.value.validationReportSha256===E.validationReportSha256);C===-1?a.push(T):a[C]=T,d()}}if(g==="approval"){const S=Tgt(y);S&&((v=t.onApproval)==null||v.call(t,S))}if(g==="usage"){const S=kgt(y);S&&(u=S,(x=t.onUsage)==null||x.call(t,S))}g==="approval_resolved"&&typeof y.approvalId=="string"&&((w=t.onApprovalResolved)==null||w.call(t,y.approvalId)),g==="delta"&&typeof y.text=="string"&&f(y.text),g==="done"&&!s&&typeof y.text=="string"&&f(y.text),g==="done"&&c&&(c=void 0,d())}for(;;){const{done:b,value:g}=await n.read();i+=r.decode(g,{stream:!b});const O=i.split(/\r?\n\r?\n/);if(i=O.pop()??"",O.forEach(p),b)break}if(i.trim()&&p(i),c&&(c=void 0,d()),a.length===0)throw new Error("沙箱未返回有效回复,请重试。");return{text:s,blocks:a,...u?{usage:u}:{}}}async function Mo(e,t,n,{method:r="GET",body:i,options:s={},fallback:a}){if(!t)throw new Error("缺少要操作的 AgentKit Session。");const l=await Hn(`${e}/${encodeURIComponent(t)}/${n}`,{method:r,headers:ki(i===void 0?void 0:{"Content-Type":"application/json"}),...i===void 0?{}:{body:JSON.stringify(i)},signal:s.signal},fd);if(!l.ok)throw await Ti(l,a);return l.json()}function H0e(e,t={}){return{async listSessions(n={}){const r=await Hn(MY(e,n),{method:"GET",headers:ki(),signal:n.signal},jY);if(!r.ok)throw await Ti(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=>vp(s)),...(i.snapshots??[]).map(s=>PY(s))]},async startSession(n={}){var i;const r=await Hn(e,{method:"POST",headers:ki({"Content-Type":"application/json"}),body:JSON.stringify({displayName:((i=n.displayName)==null?void 0:i.trim())??"",...t.textOnly?{}:{persistent:n.persistent??!0}}),signal:n.signal},iD);if(!r.ok)throw await Ti(r,"无法启动 AgentKit 沙箱,请稍后重试。");return vp(await r.json())},async listAgentSessions(n,r={}){const i=await Hn(MY(`/web/${n}/sessions`,r),{method:"GET",headers:ki(),signal:r.signal},jY);if(!i.ok)throw await Ti(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=>vp(a,n)),...(s.snapshots??[]).map(a=>PY(a,n))]},async startAgentSession(n,r={}){var s;const i=await Hn(`/web/${n}/sessions`,{method:"POST",headers:ki({"Content-Type":"application/json"}),body:JSON.stringify({displayName:((s=r.displayName)==null?void 0:s.trim())??"",persistent:r.persistent??!0}),signal:r.signal},iD);if(!i.ok)throw await Ti(i,`无法创建 ${n} 智能体,请稍后重试。`);return vp(await i.json(),n)},async openAgentSession(n,r,i={}){if(!r)throw new Error("缺少要打开的 AgentKit Session。");const s=await Hn(`/web/${n}/sessions/${encodeURIComponent(r)}/open`,{method:"POST",headers:ki(),signal:i.signal},fd);if(!s.ok)throw await Ti(s,`无法打开 ${n} 智能体。`);const a=await s.json();if(typeof a.webuiUrl!="string"||!a.webuiUrl.startsWith("/"))throw new Error(`${n} 智能体返回了无效的主页面地址。`);return{session:vp(a,n),kind:n,webuiUrl:bo(a.webuiUrl)}},async launchAgentTerminal(n,r,i={}){if(!r)throw new Error("缺少要打开 Terminal 的 AgentKit Session。");const s=await Hn(`/web/${n}/sessions/${encodeURIComponent(r)}/terminal`,{method:"POST",headers:ki(),signal:i.signal},fd);if(!s.ok)throw await Ti(s,`无法打开 ${n} Terminal。`);const a=await s.json();return{url:X0e(a.url,`${n} Terminal`),...typeof a.shellSessionId=="string"?{shellSessionId:a.shellSessionId}:{}}},async deleteAgentSession(n,r,i={}){if(!r)return;const s=await Hn(`/web/${n}/sessions/${encodeURIComponent(r)}`,{method:"DELETE",headers:ki(),signal:i.signal},Ly);if(!s.ok&&s.status!==404)throw await Ti(s,`无法删除 ${n} 智能体。`)},async resumeSnapshot(n,r,i={}){if(!r)throw new Error("缺少要唤醒的 AgentKit Snapshot。");const s=n==="codex"?"/web/sandbox":`/web/${n}`,a=await Hn(`${s}/snapshots/${encodeURIComponent(r)}/resume`,{method:"POST",headers:ki(),signal:i.signal},iD);if(!a.ok)throw await Ti(a,"无法从快照唤醒智能体,请稍后重试。");return vp(await a.json(),n)},async deleteSnapshot(n,r,i={}){if(!r)return;const s=n==="codex"?"/web/sandbox":`/web/${n}`,a=await Hn(`${s}/snapshots/${encodeURIComponent(r)}`,{method:"DELETE",headers:ki(),signal:i.signal},Ly);if(!a.ok&&a.status!==404)throw await Ti(a,"无法删除智能体快照。")},async connectSession(n,r={}){if(!n)throw new Error("缺少要连接的 AgentKit Session。");const i=await Hn(`${e}/${encodeURIComponent(n)}/connect`,{method:"POST",headers:ki({"Content-Type":"application/json"}),signal:r.signal},ygt);if(!i.ok)throw await Ti(i,"无法连接 Codex 智能体,请稍后重试。");const s=vp(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 Hn(`${e}/${encodeURIComponent(n.sessionId)}/messages`,{method:"POST",headers:ki({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??xgt);if(!i.ok)throw await Ti(i,"沙箱对话失败,请稍后重试。");return _gt(i,r)},async interruptSession(n,r={}){if(!n)return;const i=await Hn(`${e}/${encodeURIComponent(n)}/interrupt`,{method:"POST",headers:ki(),signal:r.signal},t.interruptTimeoutMs??Ly);if(!i.ok&&![404,409].includes(i.status))throw await Ti(i,"无法停止当前任务。")},async getStatus(n,r={}){const i=await Mo(e,n,"status",{options:r,fallback:"无法读取 Codex 状态。"}),s=LY(i),a=Bs(i),l=Z3(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=Bs(await Mo(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 Hn(`${NY}/pairings`,{method:"POST",headers:ki({Accept:"application/json","Content-Type":"application/json"}),body:JSON.stringify({ttlSeconds:wgt}),signal:n.signal},RY);if(!r.ok)throw await Ti(r,"无法生成 Codex 云端接力配对码。");const i=Bs(await DY(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 Hn(`${NY}/pairings/${encodeURIComponent(n)}`,{headers:ki({Accept:"application/json"}),signal:r.signal},RY);if(!i.ok)throw await Ti(i,"无法读取端云接力状态。");const s=Bs(await DY(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=Bs(await Mo(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=Sgt(s);return a?[a]:[]})},async setModel(n,r,i={}){const s=Bs(await Mo(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=Bs(await Mo(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=Egt(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=Bs(await Mo(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=q0e(c);return u?[u]:[]}),...typeof l.nextCursor=="string"?{nextCursor:l.nextCursor}:{}}},async newThread(n,r={}){return Mp(await Mo(e,n,"threads/new",{method:"POST",options:r,fallback:"无法创建新的 Codex Thread。"}))},async readThread(n,r,i={}){if(!r)throw new Error("缺少要读取的 Codex Thread。");return Mp(await Mo(e,n,`threads/${encodeURIComponent(r)}`,{options:i,fallback:"无法读取 Codex 历史消息。"}))},async resumeThread(n,r,i={}){return Mp(await Mo(e,n,"threads/resume",{method:"POST",body:{threadId:r},options:i,fallback:"无法恢复 Codex Thread。"}))},async forkThread(n,r={}){return Mp(await Mo(e,n,"threads/fork",{method:"POST",options:r,fallback:"无法分叉 Codex Thread。"}))},async archiveThread(n,r,i={}){const s=Bs(await Mo(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:Mp(s)}:{}}},async deleteThread(n,r,i={}){const s=Bs(await Mo(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:Mp(s)}:{}}},async compactThread(n,r={}){await Mo(e,n,"threads/compact",{method:"POST",options:r,fallback:"无法压缩 Codex Thread。"})},async getSettings(n,r={}){const i=await Hn(`${e}/${encodeURIComponent(n)}/settings`,{method:"GET",headers:ki(),signal:r.signal},fd);if(!i.ok)throw await Ti(i,"无法读取 Codex 权限与工作空间。");return LY(await i.json())},async updatePermissions(n,r,i={}){const s=await Hn(`${e}/${encodeURIComponent(n)}/permissions`,{method:"PUT",headers:ki({"Content-Type":"application/json"}),body:JSON.stringify(r),signal:i.signal},fd);if(!s.ok)throw await Ti(s,"无法更新 Codex 权限。");const a=await s.json();return XC(a.permissions)},async updateWorkspace(n,r,i={}){const s=await Hn(`${e}/${encodeURIComponent(n)}/workspace`,{method:"PUT",headers:ki({"Content-Type":"application/json"}),body:JSON.stringify({cwd:r}),signal:i.signal},fd);if(!s.ok)throw await Ti(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 Hn(`${e}/${encodeURIComponent(n)}/directories?${s}`,{method:"GET",headers:ki(),signal:i.signal},fd);if(!a.ok)throw await Ti(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 Hn(`${e}/${encodeURIComponent(n)}/approvals/${encodeURIComponent(r)}`,{method:"POST",headers:ki({"Content-Type":"application/json"}),body:JSON.stringify({decision:i}),signal:s.signal},fd);if(!a.ok)throw await Ti(a,"无法提交 Codex 审批决定。")},async launchTerminal(n,r={}){return $Y(e,n,"terminal",r)},async launchBrowser(n,r={}){return $Y(e,n,"browser",r)},async uploadFile(n,r,i={}){const s=new FormData;s.set("file",r,r.name);const a=await Hn(`${e}/${encodeURIComponent(n)}/files`,{method:"POST",headers:ki(),body:s,signal:i.signal},vgt);if(!a.ok)throw await Ti(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 Hn(`${e}/${encodeURIComponent(n)}/disconnect`,{method:"POST",headers:ki(),signal:r.signal},Ly);if(!i.ok&&i.status!==404)throw await Ti(i,"无法断开 Codex 智能体连接。")},async deleteSession(n,r={}){if(!n)return;const i=await Hn(`${e}/${encodeURIComponent(n)}`,{method:"DELETE",headers:ki(),signal:r.signal},Ly);if(!i.ok&&i.status!==404)throw await Ti(i,"无法删除 Codex 智能体。")}}}const Qr=H0e(Ogt),Kc=H0e("/web/intelligent-development/sessions",{textOnly:!0,messageTimeoutMs:36e5,interruptTimeoutMs:45e3});async function $Y(e,t,n,r){const i=await Hn(`${e}/${encodeURIComponent(t)}/${n}`,{method:"POST",headers:ki(),signal:r.signal},fd);if(!i.ok)throw await Ti(i,n==="terminal"?"无法打开 Sandbox Terminal。":"无法打开 Sandbox Browser。");const s=await i.json();return{url:X0e(s.url,"Sandbox 工具"),...typeof s.shellSessionId=="string"?{shellSessionId:s.shellSessionId}:{}}}function X0e(e,t){if(typeof e!="string")throw new Error(`${t} 返回了无效地址。`);if(e.startsWith("/"))return bo(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 N0(e,t,n){const r=e instanceof Error?`${e.name}: ${e.message}`:String(e||"未知错误");return[`${t}失败`,`详细信息:${r}`,n?`请求:${n}`:""].filter(Boolean).join(` -`)}function Bm({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 Agt(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 Cgt(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 Ngt(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 jgt(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 Nv({kind:e,...t}){return e==="codex"?o.jsx(Agt,{...t}):e==="deepseek-harness"?o.jsx(jgt,{...t}):e==="openclaw"?o.jsx(Cgt,{...t}):o.jsx(Ngt,{...t})}const sD=[{id:"general",label:"通用智能体"},{id:"codex",label:"Codex 智能体"},{id:"deepseek-harness",label:"DeepSeek Harness"},{id:"openclaw",label:"OpenClaw 智能体"},{id:"hermes",label:"Hermes 智能体"}],Rgt=24,Igt=3e4,j0=new Map,sb=new Map,Dgt=new Set;function ZE(e){if(!e){j0.clear(),sb.clear();return}const t=new Set(e);if(t.size!==0){for(const[n,r]of sb)r.page.runtimes.some(i=>t.has(i.runtimeId))&&sb.delete(n);j0.clear()}}function Pgt(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 aD(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 Mgt(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 Lgt({type:e}){return e==="general"?o.jsx(Bm,{}):o.jsx(Nv,{kind:e})}function $9(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e.slice(0,10):new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(t).replace(/\//g,"-")}function $gt(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 BY(e){var t;return{id:e.runtimeId,name:e.name,description:((t=e.description)==null?void 0:t.trim())||"暂无描述",createdAt:$9(e.createdAt??""),specificationLabel:"创建人",specification:e.author||"—",isMine:e.isMine,runtime:{runtimeId:e.runtimeId,region:e.region,currentVersion:e.currentVersion,canDelete:e.canDelete}}}function Bgt(e){return{id:e.id,name:e.displayName||`${e.toolName} 智能体`,description:HC(e.status),createdAt:$9(e.createdAt),specificationLabel:"创建人",specification:e.createdBy||"—",sandbox:e}}function Qgt(e){var t;return{id:e.id,name:e.draft.name||"未命名 Agent",description:((t=e.draft.description)==null?void 0:t.trim())||"暂无描述",createdAt:$9(new Date(e.updatedAt).toISOString()),specificationLabel:"存储位置",specification:"当前浏览器",draft:e}}async function Fgt(e,t,n){const r=`${e}:all:${t}`,i=sb.get(r);if(i&&i.expiresAt>Date.now())return n(i.page.runtimes.map(BY)),i.page.nextToken;i&&sb.delete(r);let s=j0.get(r);s||(s=gO({scope:e,region:"all",pageSize:Rgt,nextToken:t}),j0.set(r,s),s.then(()=>j0.delete(r),()=>j0.delete(r)));const a=await s;return sb.set(r,{page:a,expiresAt:Date.now()+Igt}),n(a.runtimes.map(BY)),a.nextToken}function Ugt({agent:e,cloudProvider:t,onUse:n,onViewDetails:r,connecting:i,connected:s,showOwnership:a,deploymentTask:l,nowMs:c,onViewDeploymentTask:u,onEditDraft:d,onDeleteDraft:f}){var O,y,v,x;const h=(O=e.sandbox)==null?void 0:O.status.toLowerCase(),p=((y=e.sandbox)==null?void 0:y.resourceType)==="snapshot",b=!!(e.runtime||h==="ready"||h==="wakeable"),g=((v=e.sandbox)==null?void 0:v.resourceType)==="snapshot"?e.sandbox.sourceSessionId||e.sandbox.snapshotId:(x=e.sandbox)==null?void 0:x.id;return o.jsxs("article",{className:"my-agent-card",children:[o.jsxs("div",{className:"my-agent-card-content",children:[o.jsxs("div",{className:"my-agent-card-title",children:[o.jsxs("div",{className:"my-agent-card-title-copy",children:[o.jsx("h3",{children:e.name}),e.sandbox?o.jsx("span",{className:"my-agent-session-id",title:g,children:g}):null]}),e.draft?o.jsx("span",{className:"my-agent-draft-badge",children:l?"部署中":"草稿"}):e.sandbox?o.jsx("span",{className:"my-agent-status-label","data-ready":e.sandbox.status.toLowerCase()==="ready"||void 0,"data-wakeable":p||void 0,children:e.description}):e.runtime?o.jsxs("div",{className:"my-agent-card-badges",children:[l?o.jsx("span",{className:"my-agent-deploying-badge",children:"部署中"}):null,o.jsx("span",{className:"my-agent-region-badge",children:Ec(e.runtime.region,t)}),a&&e.isMine?o.jsx("span",{className:"runtime-owner-badge",children:"我创建的"}):null]}):null]}),e.sandbox?null:o.jsx("p",{className:"my-agent-description",children:e.description}),o.jsxs("dl",{className:"my-agent-meta",children:[o.jsxs("div",{className:"my-agent-created-at",children:[o.jsx("dt",{children:e.draft?"更新时间":"创建时间"}),o.jsx("dd",{children:e.createdAt})]}),o.jsxs("div",{className:"my-agent-region",children:[o.jsx("dt",{children:e.specificationLabel}),o.jsx("dd",{children:e.specification})]}),e.sandbox?o.jsxs("div",{className:`my-agent-expiry${e.sandbox.resourceType==="session"&&e.sandbox.persistent?"":" is-expiring"}`,children:[o.jsx("dt",{children:"剩余时间"}),o.jsx("dd",{children:e.sandbox.resourceType==="snapshot"?"可唤醒":e.sandbox.persistent?"永不过期":$gt(e.sandbox.expireAt,c)})]}):null]})]}),o.jsx("footer",{className:"my-agent-actions",children:e.draft?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"my-agent-details","aria-label":l?`查看 ${e.name} 部署进度`:`编辑草稿 ${e.name}`,onClick:()=>l?u==null?void 0:u(l):d==null?void 0:d(e.draft),children:l?"查看进度":"编辑"}),o.jsx("button",{type:"button",className:"my-agent-delete","aria-label":`删除草稿 ${e.name}`,onClick:()=>f==null?void 0:f(e.draft),children:"删除"})]}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"my-agent-details",disabled:!b,"aria-label":l?`查看 ${e.name} 部署进度`:`查看 ${e.name} 详情`,onClick:()=>l?u==null?void 0:u(l):r==null?void 0:r(e),children:l?"查看进度":"查看详情"}),o.jsx("button",{type:"button",className:`my-agent-use${s?" is-connected":""}`,disabled:!b||i||s,"aria-busy":i||void 0,"aria-label":s?`${e.name} 已连接`:p?`唤醒 ${e.name}`:`使用 ${e.name}`,onClick:()=>void(n==null?void 0:n(e)),children:i?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-use-spinner","aria-hidden":"true"}),o.jsx("span",{children:p?"唤醒中":"连接中"})]}):s?"已连接":p?"唤醒":"使用"})]})})]})}function zgt({cloudProvider:e,canCreate:t,runtimeScope:n,onCreateAgent:r,onOpenCodexProjectUpload:i,onUseAgent:s,onViewAgentDetails:a,onCreateSandboxAgent:l,onUseSandboxAgent:c,onViewSandboxAgentDetails:u,activeType:d,onActiveTypeChange:f,sandboxRefreshKey:h=0,connectedRuntimeId:p="",hiddenRuntimeIds:b=Dgt,drafts:g=[],deploymentTasks:O=[],draftDeploymentTaskIds:y={},onViewDeploymentTask:v,onEditDraft:x,onDeleteDraft:w}){const S=m.useRef(null),E=m.useRef(null),k=m.useRef(0),T=m.useRef(0),C=m.useRef(null),[N,_]=m.useState(""),[R,$]=m.useState([]),[D,M]=m.useState(""),[j,P]=m.useState(!0),[L,U]=m.useState(""),[F,q]=m.useState([]),[z,B]=m.useState(!1),[V,ce]=m.useState(""),[we,Oe]=m.useState(""),[de,Z]=m.useState(null),[J,fe]=m.useState(()=>Date.now()),be=F.some(he=>{var xe;return((xe=he.sandbox)==null?void 0:xe.resourceType)==="session"&&he.sandbox.persistent===!1});m.useEffect(()=>{if(!be)return;fe(Date.now());const he=window.setInterval(()=>fe(Date.now()),6e4);return()=>window.clearInterval(he)},[be]);const je=m.useMemo(()=>g.map(Qgt),[g]),Qe=m.useMemo(()=>{const he=new Map,xe=new Map;for(const re of O){if(re.status!=="running"||(he.set(re.id,re),!re.runtimeId))continue;const Re=xe.get(re.runtimeId);(!Re||re.startedAt>Re.startedAt)&&xe.set(re.runtimeId,re)}return{byId:he,byRuntimeId:xe}},[O]),Me=m.useCallback(he=>{var re;if(he.draft){const Re=y[he.draft.id];return Re?Qe.byId.get(Re):void 0}const xe=(re=he.runtime)==null?void 0:re.runtimeId;return xe?Qe.byRuntimeId.get(xe):void 0},[Qe,y]),le=m.useCallback((he,xe)=>{const re=++k.current;return P(!0),U(""),Fgt(n,he,Re=>{k.current===re&&$(nt=>xe?Re:[...nt,...Re])}).then(Re=>{k.current===re&&M(Re)}).catch(Re=>{k.current===re&&U(N0(Re,"加载通用智能体","GET /web/runtimes"))}).finally(()=>{k.current===re&&P(!1)})},[n]);m.useEffect(()=>{if(d==="general")return $([]),M(""),le("",!0),()=>{k.current+=1}},[d,le]);const ke=m.useCallback(async he=>{var Re,nt;(Re=C.current)==null||Re.abort();const xe=new AbortController;C.current=xe;const re=++T.current;B(!0),ce(""),q([]);try{const Ke=he==="codex"?await Qr.listSessions({signal:xe.signal,autoResumeSnapshots:!0}):await Qr.listAgentSessions(he,{signal:xe.signal,autoResumeSnapshots:!0});if(T.current!==re)return;q(Ke.map(Bgt))}catch(Ke){if((Ke==null?void 0:Ke.name)==="AbortError"||T.current!==re)return;ce(N0(Ke,`加载 ${((nt=sD.find(tn=>tn.id===he))==null?void 0:nt.label)??he}`,`GET /web/${he==="codex"?"sandbox":he}/sessions`))}finally{C.current===xe&&(C.current=null),T.current===re&&B(!1)}},[]);function ye(he){var xe;he!==d&&(he==="general"?(k.current+=1,$([]),M(""),U(""),P(!0)):((xe=C.current)==null||xe.abort(),C.current=null,T.current+=1,q([]),ce(""),B(!0)),f(he))}m.useEffect(()=>{var he;if(d==="general"){(he=C.current)==null||he.abort(),C.current=null,T.current+=1;return}return ke(d),()=>{var xe;(xe=C.current)==null||xe.abort(),C.current=null,T.current+=1}},[d,ke,h]),m.useEffect(()=>{const he=E.current,xe=S.current;if(!he||!xe||d!=="general"||!D||j)return;const re=new IntersectionObserver(([Re])=>{Re.isIntersecting&&le(D,!1)},{root:xe,rootMargin:"240px 0px",threshold:.01});return re.observe(he),()=>re.disconnect()},[d,le,j,D]);const $e=m.useCallback(async he=>{if(!we){Oe(he.id);try{await new Promise(xe=>requestAnimationFrame(()=>xe())),he.sandbox?await c(he.sandbox):await s(he)}finally{Oe("")}}},[we,s,c]),ze=m.useMemo(()=>{const he=N.trim().toLocaleLowerCase(),xe=d==="general"?[...je,...R]:F,re=he?xe.filter(Ke=>Ke.name.toLocaleLowerCase().includes(he)):xe;if(d!=="general")return re;const Re=b.size>0?re.filter(Ke=>!Ke.runtime||!b.has(Ke.runtime.runtimeId)):re,nt=Re.findIndex(Ke=>{var tn;return((tn=Ke.runtime)==null?void 0:tn.runtimeId)===p});return nt<=0?Re:[Re[nt],...Re.slice(0,nt),...Re.slice(nt+1)]},[d,p,je,b,N,R,F]),Ae=sD.find(he=>he.id===d),Ve=(Ae==null?void 0:Ae.label)??"智能体",ut=d==="general"?j&&R.length===0&&je.length===0:z&&F.length===0,Tt=!ut&&ze.length===0,We=t?d==="general"?()=>r(Hr(e)):()=>l(d):void 0,W=d==="codex"&&t&&!!i,ne=t?void 0:"当前账号没有创建智能体权限";return o.jsxs("div",{className:"my-agents-page",children:[o.jsxs("header",{className:"my-agents-header",children:[o.jsxs("div",{className:"my-agents-heading",children:[o.jsx("div",{className:"my-agents-title-row",children:o.jsx("h1",{children:"智能体"})}),o.jsx("p",{children:n==="all"?"在此处浏览所有智能体":"在此处浏览您的所有智能体"})]}),o.jsxs("label",{className:"my-agent-search",children:[o.jsx(Pgt,{}),o.jsx("input",{type:"search","aria-label":"搜索智能体",value:N,onChange:he=>_(he.target.value),placeholder:"搜索所有类型智能体名称"})]})]}),o.jsxs("div",{className:"my-agent-type-bar",children:[o.jsx("nav",{className:"my-agent-type-pills","aria-label":"智能体类型",children:sD.map(he=>o.jsx("button",{type:"button",className:`my-agent-type-pill${d===he.id?" is-active":""}`,"aria-pressed":d===he.id,onClick:()=>ye(he.id),children:he.label},he.id))}),o.jsxs("div",{className:"my-agent-type-actions",children:[W?o.jsxs("button",{type:"button",className:"my-agent-create-secondary",onClick:i,children:[o.jsx(Mgt,{}),o.jsx("span",{children:"接力"})]}):null,o.jsxs("button",{type:"button",className:"my-agent-create-primary",disabled:!We,title:ne,onClick:()=>We==null?void 0:We(),children:[o.jsx(aD,{}),o.jsx("span",{children:"创建智能体"})]})]})]}),o.jsxs("section",{className:"my-agent-results",ref:S,"aria-label":`${Ve}列表`,children:[ut?o.jsxs("div",{className:"my-agent-initial-loading",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载智能体"})]}):(d==="general"?L:V)&&ze.length===0?o.jsxs("div",{className:"my-agent-empty",role:"alert",children:[o.jsx("p",{children:d==="general"?L:V}),o.jsx("button",{type:"button",onClick:()=>{d==="general"?le("",!0):ke(d)},children:"重新加载"})]}):Tt?N.trim()?o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(ln,{fill:"none",children:[o.jsx(ln.Icon,{children:o.jsx(E2e,{})}),o.jsx(ln.Title,{children:"没有匹配的智能体"}),o.jsx(ln.Description,{children:"请尝试搜索其他名称"})]})}):d!=="general"?o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(ln,{fill:"none",children:[o.jsx(ln.Icon,{children:o.jsx(Lgt,{type:d})}),o.jsxs(ln.Title,{className:"my-agent-sandbox-empty-title",children:["暂无 ",Ve]}),t?o.jsx(ln.ActionRow,{children:o.jsxs(vn,{color:"primary",size:"lg",onClick:()=>l(d),children:[o.jsx(aD,{}),"创建智能体"]})}):null]})}):o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(ln,{fill:"none",children:[o.jsx(ln.Icon,{children:o.jsx(Bm,{})}),o.jsx(ln.Title,{children:"暂无通用智能体"}),o.jsx(ln.Description,{children:"创建一个通用智能体,开始构建和对话"}),t?o.jsx(ln.ActionRow,{children:o.jsxs(vn,{color:"primary",size:"lg",onClick:()=>r(Hr(e)),children:[o.jsx(aD,{}),"创建智能体"]})}):null]})}):o.jsxs(o.Fragment,{children:[d==="general"&&L?o.jsxs("div",{className:"my-agent-inline-error",role:"alert",children:[o.jsx("span",{children:L}),o.jsx("button",{type:"button",onClick:()=>void le("",!0),children:"重新加载"})]}):null,o.jsx("div",{className:"my-agent-grid",children:ze.map(he=>{var xe;return o.jsx(Ugt,{agent:he,cloudProvider:e,deploymentTask:Me(he),nowMs:J,onViewDeploymentTask:v,onUse:$e,onViewDetails:re=>{re.sandbox?u(re.sandbox):a(re)},connecting:he.id===we,connected:((xe=he.runtime)==null?void 0:xe.runtimeId)===p,showOwnership:n==="all",onEditDraft:x,onDeleteDraft:Z},he.id)})})]}),d==="general"&&!L&&!ut&&(ze.length>0||!!D)&&o.jsx("div",{className:"my-agent-load-more",ref:E,"aria-live":"polite",children:j?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载更多智能体"})]}):D?o.jsx("span",{children:"继续下滑加载更多"}):o.jsx("span",{children:"已加载全部智能体"})})]}),de?o.jsx(Bl,{title:"删除草稿?",description:`删除后将无法恢复“${de.draft.name||"未命名 Agent"}”。`,confirmLabel:"删除草稿",variant:"danger",onCancel:()=>Z(null),onConfirm:()=>{w==null||w(de),Z(null)}}):null]})}function Vgt(e){return e==="127.0.0.1"}const qgt={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。"},Hgt={id:"feishu",kind:"feishu",category:"channels",icon:"feishu",name:"飞书机器人",badge:"Beta",description:"创建飞书机器人,并将消息直接接入 AgentKit Runtime。"},Xgt="https://api.github.com",Ggt=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/,QY=/^[A-Za-z0-9][A-Za-z0-9._/-]{0,199}$/,Ygt=/^[A-Za-z0-9._/-]+$/;function Wgt(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 wp(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(`${Xgt}${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(Wgt(r.status,i,t.token));return{status:r.status,payload:i}}function oD(e){return e.split("/").map(encodeURIComponent).join("/")}function Zgt(e){const t=new TextEncoder().encode(e);let n="";const r=32768;for(let i=0;i({...h,path:B9(h.path,"")})),s=AbortSignal.any([t,AbortSignal.timeout(6e4)]),a=`/repos/${n}`;await wp(`${a}`,{token:e.token,expected:[200],signal:s});const c=(f=(await wp(`${a}/git/ref/heads/${oD(r)}`,{token:e.token,expected:[200],signal:s})).payload.object)==null?void 0:f.sha;if(!c)throw new Error("目标分支缺少有效 Git SHA");const u=Kgt(e.branchPrefix);await wp(`${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 p of i){const b=oD(p.path),g=await wp(`${a}/contents/${b}?ref=${encodeURIComponent(r)}`,{token:e.token,expected:[200,404],signal:s});if(p.mustBeNew&&g.status===200)throw new Error(`目标仓库中已存在 ${p.path},未覆盖现有文件`);if(g.status===200&&!g.payload.sha)throw new Error(`目标路径 ${p.path} 不是可更新的文件`);await wp(`${a}/contents/${b}`,{token:e.token,expected:[200,201],signal:s,method:"PUT",body:{message:p.commitMessage,content:Zgt(p.content),branch:u,...g.payload.sha?{sha:g.payload.sha}:{}}})}const h=await wp(`${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 wp(`${a}/git/refs/heads/${oD(u)}`,{token:e.token,expected:[204],signal:AbortSignal.timeout(15e3),method:"DELETE"}).catch(()=>{})}}const F9={name:"repository",label:"GitHub Repo",placeholder:"owner/repository",help:"支持 owner/repository 或完整 github.com URL",required:!0},U9={name:"baseBranch",label:"目标分支",placeholder:"main",help:"留空时使用 main,PR 将以此分支为 base",required:!1},Y0e={name:"runtimeName",label:"Runtime 名称",placeholder:"support-agent",help:"用于 AgentKit 发布配置",required:!0},W0e={name:"runtimeId",label:"Runtime ID",placeholder:"rt-xxxxxxxx",help:"持续更新的目标 AgentKit Runtime",required:!0};function z9(e={}){return{repository:"",baseBranch:"main",projectPath:".",runtimeName:"",runtimeId:"",sandboxToolId:"",modelName:"",modelBaseUrl:"https://ark.cn-beijing.volces.com/api/coding/v3",region:"cn-beijing",token:"",...e}}function V9(e){return{repository:e.repository.trim(),baseBranch:e.baseBranch.trim()||"main",region:e.region,token:e.token.trim()}}const Jgt=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/,e0t=/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/;function t0t(e){if(!Jgt.test(e.sandboxToolId))throw new Error("Sandbox Tool ID 格式不正确");if(!e0t.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 n0t(e){t0t(e);const t=String.raw`name: PR Automated Review +`),O=(e==null?void 0:e.pendingMessage)||s;if(m.useEffect(()=>{e&&u(l)},[e==null?void 0:e.status,l]),m.useEffect(()=>{if(!c||!h)return;const E=a.current;E&&(E.scrollTop=E.scrollHeight)},[c,h,g]),!e||!e.text&&e.status!=="error"&&!e.pendingMessage)return null;const y=dgt(e.updatedAt),v=e.status==="complete"?"已同步":e.status==="error"?"读取失败":"同步中",x=e.omittedEarly?"已省略早期日志":e.snapshotTruncated?"仅显示最近的构建日志":e.truncated?"已省略部分日志":"",w=[v,e.lineCount?`${e.lineCount} 行`:"",x,y].filter(Boolean).join(" · ");async function S(){try{await navigator.clipboard.writeText(p),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(rf,{"aria-hidden":!0}):o.jsx(t6,{"aria-hidden":!0}),o.jsx("span",{children:d?"已复制":"复制"})]})]})]}),c&&(h?o.jsx("pre",{ref:a,children:g}):o.jsx("div",{className:"aw-deploy-log-empty",children:O}))]})}function fgt({task:e}){var t;return o.jsx(H0e,{log:e.buildLog,autoExpand:((t=e.buildLog)==null?void 0:t.status)!=="complete"&&(e.status==="running"||e.status==="error")&&q0e(e)===ugt,title:"构建日志",ariaLabel:"构建日志",copyLabel:"构建日志",defaultPendingMessage:"正在等待构建日志…"})}function hgt({task:e}){var t;return o.jsx(H0e,{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 pgt({task:e,onReturnToEdit:t}){const n=V0e(e),r=q0e(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(sr,{className:"spin"}):e.status==="success"?o.jsx(Q2e,{}):e.status==="error"?o.jsx(Nne,{}):o.jsx(qF,{})}),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),[xr,Pe]=m.useState(()=>new Set),[at,Lt]=m.useState(!1),[Wt,fn]=m.useState(""),[Jt,lr]=m.useState(null),[Sr,ai]=m.useState([]),[Yt,_r]=m.useState([]),[kn,Wr]=m.useState(!1),[jr,Rr]=m.useState(""),[Rn,cr]=m.useState(""),[Nn,ur]=m.useState(0),[Lr,$r]=m.useState([]),[Zr,bn]=m.useState(!1),[ue,Ie]=m.useState(""),[ot,dt]=m.useState(0),[Zn,Fi]=m.useState(null),[Ui,Es]=m.useState(1),[Ii,Ds]=m.useState(!1),[gr,Zs]=m.useState(""),[$c,Ka]=m.useState(0),[oi,Zl]=m.useState(!1),[To,ba]=m.useState(()=>new Set),[Ja,Ia]=m.useState(!1),[Ji,Ks]=m.useState(""),[Di,Js]=m.useState(""),[Er,Ps]=m.useState(()=>new Set),zi=m.useRef(!1),xi=m.useRef(""),Oa=m.useRef(null),es=m.useRef(0),Kn=m.useRef(0),ya=m.useRef(0),[_o,ea]=m.useState(Vmt),[Ms,Fu]=m.useState("");m.useEffect(()=>{e.length!==0&&ea(X=>X.map((ge,_e)=>_e===0&&ge.agentIds.length===0?{...ge,agentIds:e.slice(0,2).map(He=>He.id)}:ge))},[e]);const ks=m.useMemo(()=>{const X=new Map;for(const ge of e)ge.runtimeId&&X.set(ge.runtimeId,ge);return X},[e]),dl=m.useMemo(()=>{var ge;const X=new Map;for(const _e of t){const He=(ge=_e.deploymentTarget)==null?void 0:ge.runtimeId;if(!He||!ks.has(He))continue;const bt=X.get(He);(!bt||_e.updatedAt>bt.updatedAt)&&X.set(He,_e)}return X},[ks,t]),eo=m.useMemo(()=>{const X=new Map;for(const ge of f){if(!ge.runtimeId)continue;const _e=X.get(ge.runtimeId);(!_e||ge.startedAt>_e.startedAt)&&X.set(ge.runtimeId,ge)}return X},[f]),Kl=m.useMemo(()=>{const X=Y.trim().toLowerCase();return X?e.filter(ge=>{const _e=ge.runtimeId?dl.get(ge.runtimeId):void 0,He=ge.runtimeId?eo.get(ge.runtimeId):void 0;return[ge.label,ge.app,ge.host??"",(_e==null?void 0:_e.draft.name)??"",(_e==null?void 0:_e.draft.description)??"",(He==null?void 0:He.runtimeName)??""].join(" ").toLowerCase().includes(X)}):e},[e,eo,Y,dl]),ta=m.useMemo(()=>{const X=Y.trim().toLowerCase();return t.filter(ge=>{var He;const _e=(He=ge.deploymentTarget)==null?void 0:He.runtimeId;return _e&&ks.has(_e)?!1:X?`${ge.draft.name} ${ge.draft.description}`.toLowerCase().includes(X):!0})},[ks,t,Y]),Uu=m.useMemo(()=>t.filter(X=>{var _e;const ge=(_e=X.deploymentTarget)==null?void 0:_e.runtimeId;return!ge||!ks.has(ge)}).length,[ks,t]),In=m.useMemo(()=>{const X=Y.trim().toLowerCase();return X?_o.filter(ge=>ge.name.toLowerCase().includes(X)):_o},[_o,Y]),ae=e.find(X=>X.id===L),$n=t.find(X=>X.id===F),br=h?f.find(X=>X.id===h):void 0,xa=ae!=null&&ae.runtimeId?dl.get(ae.runtimeId):void 0,yn=y?At:L&&i===L?r:null,Jn=(yn==null?void 0:yn.appName)||(ae==null?void 0:ae.runtimeApp)||(ae==null?void 0:ae.app)||"",na=c&&(ae!=null&&ae.runtimeId)?TY:TY.filter(X=>X.id!=="usage"),Bc=JSON.stringify([(ae==null?void 0:ae.runtimeId)??"",(ae==null?void 0:ae.region)??"cn-beijing",Jn,Ui]),fs=(Zn==null?void 0:Zn.requestKey)===Bc?Zn.value:null,Ao=`${(ae==null?void 0:ae.region)??"cn-beijing"}:${(ae==null?void 0:ae.runtimeId)??""}`,Jl=(Qe==null?void 0:Qe.requestKey)===Ao?Qe.value:"",Br=(V==null?void 0:V.requestKey)===Ao?V:null,vi=!!((Gw=Br==null?void 0:Br.apiApps)!=null&&Gw.length),ee=!!(Br!=null&&Br.a2a),Le=((Yw=Br==null?void 0:Br.apiApps)==null?void 0:Yw[0])??Jn,rt=(z==null?void 0:z.endpoint)??"",Mt=Gmt(((Ww=Br==null?void 0:Br.a2a)==null?void 0:Ww.endpoint)??"",rt),zn=JSON.stringify([(ae==null?void 0:ae.runtimeId)??"",(ae==null?void 0:ae.region)??"",Jn]),On=(re==null?void 0:re.requestKey)===zn?re.value:null;m.useEffect(()=>{const X=es.current+1;es.current=X,Re(null),Gt("");const ge=(ae==null?void 0:ae.runtimeId)??"",_e=(ae==null?void 0:ae.region)??"";if(!l||!ge||!_e){Ke(!1);return}const He=new AbortController;return Ke(!0),Hre({runtimeId:ge,region:_e,appName:Jn,signal:He.signal}).then(bt=>{var zt,Pr;if(X===es.current){if(bt.runtime.runtimeId!==ge||bt.runtime.region!==_e||Jn&&((zt=bt.agent)==null?void 0:zt.appName)!==Jn||bt.canUpdate&&!((Pr=bt.agent)!=null&&Pr.appName)){Gt("Runtime 更新能力响应与当前选择不匹配。");return}Re({requestKey:zn,value:bt})}}).catch(bt=>{X!==es.current||He.signal.aborted||Gt(bt instanceof Error?bt.message:"检查 Runtime 更新能力失败。")}).finally(()=>{X===es.current&&!He.signal.aborted&&Ke(!1)}),()=>He.abort()},[l,ae==null?void 0:ae.region,ae==null?void 0:ae.runtimeId,Jn,zn]);const se=m.useMemo(()=>{const X=new Map(e.map((_e,He)=>[_e.id,He])),ge=new Map(n.map((_e,He)=>[_e,He]));return[...Kl].sort((_e,He)=>{const bt=_e.runtimeId?eo.get(_e.runtimeId):void 0,zt=He.runtimeId?eo.get(He.runtimeId):void 0,Pr=(bt==null?void 0:bt.status)==="running"?bt.startedAt:0,Qc=(zt==null?void 0:zt.status)==="running"?zt.startedAt:0;if(Pr!==Qc)return Qc-Pr;const Qn=ge.get(_e.id),Fc=ge.get(He.id);return Qn!=null&&Fc!=null?Qn-Fc:Qn!=null?-1:Fc!=null?1:(X.get(_e.id)??0)-(X.get(He.id)??0)})},[n,e,Kl,eo]),De=(ae==null?void 0:ae.label)||(yn==null?void 0:yn.name)||($n==null?void 0:$n.draft.name)||(br==null?void 0:br.agentName)||((cp=br==null?void 0:br.agentDraft)==null?void 0:cp.name)||"未选择智能体",qe=_o.find(X=>X.id===Ms),Rt=se.filter(X=>X.canDelete===!0),Se=se.filter(X=>En.has(X.id)&&X.canDelete===!0),Ct=ta.filter(X=>xr.has(X.id)),qt=Rt.length+ta.length,ft=Se.length+Ct.length,_t=m.useMemo(()=>{var ge;if(br!=null&&br.agentDraft)return br.agentDraft;if($n!=null&&$n.draft)return $n.draft;const X=(ge=ae==null?void 0:ae.region)!=null&&ge.startsWith("ap-")?"byteplus":"volcengine";return On!=null&&On.agent?W6(On.agent,X):Jmt(yn,Jn||(ae==null?void 0:ae.label)||"agent",X)},[yn,Jn,ae==null?void 0:ae.label,ae==null?void 0:ae.region,$n==null?void 0:$n.draft,br==null?void 0:br.agentDraft,On==null?void 0:On.agent]),un=((Zw=yn==null?void 0:yn.draft)==null?void 0:Zw.harnessSidecar)??Bmt(z==null?void 0:z.envs),dr=un?XC.filter(X=>un.componentOverrides[X]):[],wi=$n?a?"":"当前账号没有新建 Agent 的权限。":l?ae!=null&&ae.runtimeId?ae.region?nt?"正在检查 Runtime 更新能力…":tn||(On?On.canUpdate?(Of=On.agent)!=null&&Of.appName?"":"Runtime 更新能力响应缺少智能体信息。":On.reason||"当前 Runtime 不支持原地更新。":"尚未完成 Runtime 更新能力检查。"):"Runtime 缺少地域信息,无法更新。":"仅支持更新已部署的云端智能体。":"当前账号没有管理 Agent 的权限。",sp="aw-update-disabled-reason",ec=m.useMemo(()=>{if(yn)return yn.tools;const X=(_t.builtinTools??[]).map(ge=>{var _e;return((_e=vO.find(He=>He.id===ge))==null?void 0:_e.label)??ge});return Array.from(new Set([..._t.tools,...X,...(_t.customTools??[]).map(ge=>ge.name),...(_t.mcpTools??[]).map(ge=>ge.name)].filter(Boolean)))},[_t,yn]),gf=m.useMemo(()=>yn?yn.skillsPreviewSupported?yn.skills.map(X=>X.name):null:Array.from(new Set([...(_t.selectedSkills??[]).map(X=>X.name),..._t.skills].filter(Boolean))),[_t,yn]),fr=m.useMemo(()=>{if(br)return br;if($n)return f.filter(X=>{var ge,_e;return((ge=X.agentDraft)==null?void 0:ge.name)===$n.draft.name||X.agentName===$n.draft.name||!!((_e=$n.deploymentTarget)!=null&&_e.runtimeId)&&X.runtimeId===$n.deploymentTarget.runtimeId}).sort((X,ge)=>ge.startedAt-X.startedAt)[0];if(ae)return f.filter(X=>!!ae.runtimeId&&X.runtimeId===ae.runtimeId||X.agentName===ae.label).sort((X,ge)=>ge.startedAt-X.startedAt)[0]},[f,ae,$n,br]),ig=!!(h&&fr&&fr.id===h),sg=!!(fr&&(fr.status!=="success"||ig)),fl=(fr==null?void 0:fr.status)==="running",zu=fr!=null&&fr.draftId?t.find(X=>X.id===fr.draftId)??(fr.agentDraft?{id:fr.draftId,draft:fr.agentDraft,updatedAt:fr.startedAt}:void 0):void 0,Bn=m.useMemo(()=>agt(_t),[_t]),Ht=(ae==null?void 0:ae.currentVersion)??(z==null?void 0:z.currentVersion)??null,er=Ht??(br==null?void 0:br.startedAt)??"unknown",Ts=yn?`runtime:${(ae==null?void 0:ae.runtimeId)??yn.name}:v${er}:${Bn}`:`draft:${(br==null?void 0:br.id)??($n==null?void 0:$n.id)??(ae==null?void 0:ae.id)??De}:${Bn}`;m.useEffect(()=>{j==="usage"&&!c&&P("basic")},[c,j]),m.useEffect(()=>{if(!h)return;const X=f.find(_e=>_e.id===h),ge=X!=null&&X.runtimeId?ks.get(X.runtimeId):void 0;if(ge){q(""),U(ge.id),P("basic");return}U(""),q(""),P("basic")},[ks,f,h]),m.useEffect(()=>{if(!p){xi.current="";return}const X=`${p}:${b}:${g}:${c}`;xi.current!==X&&e.some(ge=>ge.id===p)&&(xi.current=X,q(""),U(p),P(b==="usage"&&!c?"basic":b),b==="evaluations"&&(Dt(g),Ge("")))},[e,c,p,b,g]),m.useEffect(()=>{for(const X of se.slice(0,8)){if(!X.runtimeId)continue;const ge=X.region??"cn-beijing";Gre(X.runtimeId,ge),pre(X.runtimeId,ge,X.runtimeApp??"")}},[se]),m.useEffect(()=>{let X=!1;const ge=(ae==null?void 0:ae.runtimeId)??"",_e=(ae==null?void 0:ae.region)??"cn-beijing",He=(ae==null?void 0:ae.runtimeApp)??"",bt=ge?hre(ge,_e,He):null;if(St(bt),Ue(!!bt||!y||!ge),!(!y||!ge))return b6(ge,_e,He,{force:!0}).then(zt=>{X||St(zt)}).catch(()=>{!X&&!bt&&St(null)}).finally(()=>{X||Ue(!0)}),()=>{X=!0}},[y,ae==null?void 0:ae.currentVersion,ae==null?void 0:ae.region,ae==null?void 0:ae.runtimeApp,ae==null?void 0:ae.runtimeId]),m.useEffect(()=>{let X=!1;const ge=(ae==null?void 0:ae.runtimeId)??"",_e=(ae==null?void 0:ae.region)??"cn-beijing";if($r([]),Ie(""),j!=="optimizations"||!ge){bn(!1);return}if(y&&!Jn){bn(!ve);return}return bn(!0),rre({runtimeId:ge,region:_e,appName:Jn}).then(He=>{X||$r(He.groups)}).catch(He=>{X||Ie(He instanceof Error?He.message:String(He))}).finally(()=>{X||bn(!1)}),()=>{X=!0}},[ve,y,ot,j,Jn,ae==null?void 0:ae.region,ae==null?void 0:ae.runtimeId]),m.useEffect(()=>{Es(1)},[ae==null?void 0:ae.runtimeId,Jn]),m.useEffect(()=>{const X=ya.current+1;ya.current=X;const ge=(ae==null?void 0:ae.runtimeId)??"",_e=(ae==null?void 0:ae.region)??"cn-beijing",He=Jn;if(Zs(""),j!=="usage"||!ge){Ds(!1);return}if(!He){Ds(y&&!ve);return}const bt=new AbortController;return Ds(!0),Dre({runtimeId:ge,region:_e,appName:He,page:Ui,pageSize:qmt,signal:bt.signal}).then(zt=>{if(X===ya.current){if(zt.runtimeId!==ge||zt.appName!==He||zt.page!==Ui){Zs("用量响应与当前 Agent 不匹配,请重试。");return}Fi({requestKey:Bc,value:zt})}}).catch(zt=>{X!==ya.current||bt.signal.aborted||Zs(zt instanceof Error?zt.message:"加载 Agent 用量失败。")}).finally(()=>{X===ya.current&&Ds(!1)}),()=>{bt.abort()}},[Ui,$c,Bc,ve,y,j,Jn,ae==null?void 0:ae.region,ae==null?void 0:ae.runtimeId]),m.useEffect(()=>{Kn.current+=1,Me(null),ke(!1),$e(!1),Ae(""),je("api-server")},[Ao,j]);function Kr(){Kn.current+=1,Me(null),ke(!1),$e(!1),Ae("")}function Ls(X){X!==be&&(Kr(),je(X))}async function ap(){if(le){Kr();return}const X=(ae==null?void 0:ae.runtimeId)??"",ge=(ae==null?void 0:ae.region)??"cn-beijing";if(!X)return;const _e=Kn.current+1;Kn.current=_e,$e(!0),Ae("");try{const He=await Vre(X,ge);if(_e!==Kn.current)return;Me({requestKey:Ao,value:He}),ke(!0)}catch(He){if(_e!==Kn.current)return;Me(null),ke(!1),Ae(He instanceof Error?He.message:"读取 Runtime API Key 失败。")}finally{_e===Kn.current&&$e(!1)}}m.useEffect(()=>{let X=!1;const ge=(ae==null?void 0:ae.runtimeId)??"",_e=(ae==null?void 0:ae.region)??"cn-beijing",He=ge?Xre(ge,_e):null;if(B(He),!!ge)return v6(ge,_e,{force:!0}).then(bt=>{X||B(bt)}).catch(()=>{!X&&!He&&B(null)}),()=>{X=!0}},[ae==null?void 0:ae.currentVersion,ae==null?void 0:ae.region,ae==null?void 0:ae.runtimeId]),m.useEffect(()=>{let X=!1;const ge=(ae==null?void 0:ae.runtimeId)??"";if(ne(""),j!=="versions"||!ge){We(!1),ge||ut(null);return}return We(!0),jk(ge).then(_e=>{X||ut(_e)}).catch(_e=>{X||(ut(null),ne(_e instanceof Error?_e.message:"读取 GitHub 版本失败。"))}).finally(()=>{X||We(!1)}),()=>{X=!0}},[j,ae==null?void 0:ae.currentVersion,ae==null?void 0:ae.runtimeId]),m.useEffect(()=>{let X=!1;const ge=(ae==null?void 0:ae.runtimeId)??"",_e=(ae==null?void 0:ae.region)??"cn-beijing",He=`${_e}:${ge}`;if(Z(""),j!=="integrations"||!ge){Oe(!1),ge||ce(null);return}Oe(!0);const bt=yA(ge,_e,{retryProbe:!0}).catch(zt=>{if(zt instanceof ha&&zt.unsupported)return null;throw zt});return Promise.all([bt,zre(ge,_e,{retryProbe:!0})]).then(([zt,Pr])=>{X||ce({requestKey:He,apiApps:zt,a2a:Pr})}).catch(zt=>{X||(ce(null),Z(zt instanceof Error?zt.message:"探测集成方式失败。"))}).finally(()=>{X||Oe(!1)}),()=>{X=!0}},[J,j,ae==null?void 0:ae.currentVersion,ae==null?void 0:ae.region,ae==null?void 0:ae.runtimeId]),m.useEffect(()=>{let X=!1;const ge=(ae==null?void 0:ae.runtimeId)??"",_e=(ae==null?void 0:ae.region)??"cn-beijing",He=ge&&Jn?ire({runtimeId:ge,region:_e,appName:Jn,pageSize:100}):null;if(ai(He?jY(He):[]),_r((He==null?void 0:He.sets)??[]),Rr(""),cr((He==null?void 0:He.unsupportedMessage)??""),j!=="evaluations"||!ge){Wr(!1);return}if(y&&!Jn){Wr(!ve);return}return Wr(!He),OA({runtimeId:ge,region:_e,appName:Jn,pageSize:100},{force:!0}).then(bt=>{X||(_r(bt.sets),ai(jY(bt)),cr(bt.unsupportedMessage??""))}).catch(bt=>{X||(Rr(bt instanceof Error?bt.message:String(bt)),cr(""))}).finally(()=>{X||Wr(!1)}),()=>{X=!0}},[ve,y,Nn,j,Jn,yn==null?void 0:yn.appName,ae==null?void 0:ae.region,ae==null?void 0:ae.runtimeId]);async function cN(X){const ge=(ae==null?void 0:ae.runtimeId)??"",_e=X.commitSha??"";if(!(!ge||!_e||he)){xe(_e),ne("");try{await kre({runtimeId:ge,targetCommitSha:_e});const He=await jk(ge);ut(He)}catch(He){ne(He instanceof Error?He.message:"回退版本失败。")}finally{xe("")}}}m.useEffect(()=>{const X=new Set(Sr.map(ge=>ge.id));ba(ge=>{const _e=new Set([...ge].filter(He=>X.has(He)));return _e.size===ge.size?ge:_e}),Ps(ge=>{const _e=new Set([...ge].filter(He=>X.has(He)));return _e.size===ge.size?ge:_e}),Di&&!X.has(Di)&&Js("")},[Sr,Di]),m.useEffect(()=>{Zl(!1),ba(new Set),Ps(new Set),Ks(""),Js("")},[ae==null?void 0:ae.runtimeId]),m.useEffect(()=>{const X=new Set(se.filter(ge=>ge.canDelete===!0).map(ge=>ge.id));gn(ge=>{const _e=new Set([...ge].filter(He=>X.has(He)));return _e.size===ge.size?ge:_e})},[se]),m.useEffect(()=>{const X=new Set(ta.map(ge=>ge.id));Pe(ge=>{const _e=new Set([...ge].filter(He=>X.has(He)));return _e.size===ge.size?ge:_e})},[ta]);const Ir=m.useMemo(()=>!O||!(ae!=null&&ae.runtimeId)||O.runtimeId!==ae.runtimeId||Jn&&O.agentName&&O.agentName!==Jn?null:{...O,tag:O.kind==="good"?"Good case":"Bad case"},[O,ae==null?void 0:ae.runtimeId,Jn]),Vu=m.useMemo(()=>ae!=null&&ae.runtimeId?Ir?[Ir,...Sr.filter(X=>X.id!==Ir.id&&(!X.messageId||X.messageId!==Ir.messageId))]:Sr:zmt,[Sr,Ir,ae==null?void 0:ae.runtimeId]),bf=Vu.filter(X=>{if(X.kind!==xt||(X.source==="auto"?"auto":"user")!==Pt)return!1;const _e=Ne.trim().toLowerCase();return _e?[X.input,X.output,X.referenceOutput,X.comment,X.tag??"",X.sessionId,X.messageId,X.userId,X.evaluationSetName].join(" ").toLowerCase().includes(_e):!0}),ag=bf.filter(X=>To.has(X.id)),zw=!!(ae!=null&&ae.runtimeId),Vw=X=>{Dt(X),Ge(""),Ks("");const ge=Vu.find(_e=>_e.kind===X);Js((ge==null?void 0:ge.id)??""),window.setTimeout(()=>{var _e;(_e=Oa.current)==null||_e.scrollIntoView({behavior:"smooth",block:"start"})},0)},uN=X=>{Ks(""),ba(ge=>{const _e=new Set(ge);return _e.has(X.id)?_e.delete(X.id):_e.add(X.id),_e})},og=()=>{Ks(""),ba(new Set(bf.map(X=>X.id)))},lg=()=>{Ks(""),ba(new Set),Zl(!1)},qw=X=>{Ps(ge=>{const _e=new Set(ge);return _e.has(X)?_e.delete(X):_e.add(X),_e})},Hw=X=>{Js(X.id),Ks(""),!(!X.sessionId||!X.messageId)&&(C==null||C(X))},ht=async X=>{if(!(ae!=null&&ae.runtimeId)||!Jn||Ja||X.length===0)return;const ge=X.length===1?"确定删除这条反馈案例?原始聊天记录不会被删除。":`确定删除选中的 ${X.length} 条反馈案例?原始聊天记录不会被删除。`;if(!window.confirm(ge))return;const _e=X.map(bt=>bt.id),He=new Set(_e);Ia(!0),Ks("");try{await ore({runtimeId:ae.runtimeId,region:ae.region??"cn-beijing",appName:Jn,itemIds:_e});const bt=new Map;for(const zt of X)bt.set(zt.kind,(bt.get(zt.kind)??0)+1);ai(zt=>zt.filter(Pr=>!He.has(Pr.id))),_r(zt=>zt.map(Pr=>({...Pr,itemCount:Math.max(0,Pr.itemCount-(bt.get(Pr.kind)??0))}))),ba(zt=>new Set([...zt].filter(Pr=>!He.has(Pr)))),Ps(zt=>new Set([...zt].filter(Pr=>!He.has(Pr)))),Di&&He.has(Di)&&Js(""),X.length>1&&Zl(!1),N==null||N(X)}catch(bt){Ks(bt instanceof Error?bt.message:String(bt))}finally{Ia(!1)}},op=X=>{ea(ge=>ge.map(_e=>_e.id===X.id?X:_e))},cg=()=>{const X=new Set(e.map(He=>He.id)),ge=n.filter(He=>X.has(He)),_e=new Set(ge);return[...ge,...e.filter(He=>!_e.has(He.id)).map(He=>He.id)]},ug=(X,ge,_e)=>{if(!w||X===ge)return;const He=cg().filter(Pr=>Pr!==X),bt=He.indexOf(ge),zt=bt<0?He.length:_e==="after"?bt+1:bt;He.splice(zt,0,X),w(He)},Dr=(X,ge)=>{if(!tt||tt===ge)return;const _e=X.currentTarget.getBoundingClientRect();Qt(ge),Ce(X.clientY>_e.top+_e.height/2?"after":"before")},qu=(X,ge)=>{if(!w)return;const _e=cg(),He=_e.indexOf(X),bt=Math.max(0,Math.min(_e.length-1,He+ge));He<0||He===bt||(_e.splice(He,1),_e.splice(bt,0,X),w(_e))},Xw=X=>{X.canDelete===!0&&(fn(""),gn(ge=>{const _e=new Set(ge);return _e.has(X.id)?_e.delete(X.id):_e.add(X.id),_e}))},YO=X=>{fn(""),Pe(ge=>{const _e=new Set(ge);return _e.has(X.id)?_e.delete(X.id):_e.add(X.id),_e})},dN=()=>{fn(""),gn(new Set(Rt.map(X=>X.id))),Pe(new Set(ta.map(X=>X.id)))},Hu=()=>{fn(""),gn(new Set),Pe(new Set),$t(!1)},fN=()=>{if(ft===0||at)return;const X=Se.length,ge=Ct.length;fn(""),lr({kind:"selection",title:X===1&&ge===0?"删除 Agent?":X===0&&ge===1?"删除草稿?":"删除所选项目?",description:X===1&&ge===0?`"${Se[0].label}" 对应的云端 Runtime 将被永久删除,此操作不可撤销。`:X===0&&ge===1?`"${Ct[0].draft.name||"未命名 Agent"}" 将从本地草稿中删除。`:`将删除选中的 ${ft} 个项目。${X>0?`${X} 个云端 Runtime 将被永久删除,此操作不可撤销。`:"草稿删除后无法恢复。"}`,confirmLabel:X===0&&ge===1?"删除草稿":"删除所选",agents:Se,drafts:Ct})},lp=async()=>{if(!(!Jt||at)){Lt(!0),fn("");try{if(Jt.kind==="selection"){const{agents:X,drafts:ge}=Jt;if(X.length>0){if(!S)throw new Error("当前页面不支持删除已部署 Agent。");await S(X)}ge.length>0&&(E==null||E(ge)),gn(new Set),Pe(new Set),$t(!1),X.some(_e=>_e.id===L)&&U(""),ge.some(_e=>_e.id===F)&&q("")}else if(Jt.kind==="agent"){if(!S)throw new Error("当前页面不支持删除已部署 Agent。");await S([Jt.agent]),L===Jt.agent.id&&U("")}else{if(!E)throw new Error("当前页面不支持删除草稿。");E([Jt.draft]),F===Jt.draft.id&&q("")}lr(null)}catch(X){fn(X instanceof Error?X.message:String(X))}finally{Lt(!1)}}},hN=X=>{!S||X.canDelete!==!0||at||(fn(""),lr({kind:"agent",title:"删除 Agent?",description:`"${X.label}" 对应的云端 Runtime 将被永久删除,此操作不可撤销。`,confirmLabel:"删除 Agent",agent:X}))},Dn=X=>{if(!E||at)return;const ge=X.draft.name||"未命名 Agent";fn(""),lr({kind:"draft",title:"删除草稿?",description:`"${ge}" 将从本地草稿中删除。`,confirmLabel:"删除草稿",draft:X})},pN=()=>{const X=`eval-${Date.now()}`,ge={id:X,name:`新评测组 ${_o.length+1}`,agentIds:[],caseSet:"核心回归集",evaluator:"综合质量评估器",metrics:["回答质量"],concurrency:"4",history:[]};ea(_e=>[ge,..._e]),Fu(X)},mN=X=>{op({...X,history:[{id:`run-${Date.now()}`,createdAt:"刚刚",score:86+X.history.length%7,status:"completed"},...X.history]})};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:`aw-root${y?" is-detail-only":""}`,children:[o.jsxs("nav",{className:"aw-view-tabs","aria-label":"智能体工作台",children:[o.jsx("button",{type:"button",className:D==="library"?"is-active":"","aria-pressed":D==="library",onClick:()=>{M("library"),mt("")},children:"智能体库"}),o.jsx("button",{type:"button",className:D==="evaluation"?"is-active":"","aria-pressed":D==="evaluation",onClick:()=>{M("evaluation"),mt("")},children:"评测"})]}),o.jsxs("div",{className:"aw-workspace-frame",children:[o.jsxs("div",{className:"aw-workspace","aria-hidden":D==="evaluation"||void 0,ref:X=>{X==null||X.toggleAttribute("inert",D==="evaluation")},children:[o.jsxs("aside",{className:"aw-sidebar","aria-label":D==="library"?"智能体列表":"评测组列表",children:[o.jsxs("label",{className:"aw-search",children:[o.jsx(i2,{"aria-hidden":!0}),o.jsx("input",{value:Y,onChange:X=>mt(X.currentTarget.value),placeholder:D==="library"?"搜索智能体":"搜索评测组","aria-label":D==="library"?"搜索智能体":"搜索评测组"})]}),o.jsxs("button",{type:"button",className:"aw-create-card",onClick:D==="library"?_:pN,disabled:D==="library"&&!a,children:[o.jsx(qa,{"aria-hidden":!0}),o.jsx("span",{children:D==="library"?"新建 Agent":"新建评测组"})]}),D==="library"&&(S||E)&&o.jsx("div",{className:`aw-selection-toolbar${Ze?" is-active":""}`,children:Ze?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"aw-selection-count",children:["已选 ",ft," 个"]}),o.jsx("button",{type:"button",onClick:dN,disabled:qt===0||at,children:"全选"}),o.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void fN(),disabled:ft===0||at,children:at?"删除中…":"删除所选"}),o.jsx("button",{type:"button",onClick:Hu,disabled:at,children:"取消"})]}):o.jsx("button",{type:"button",onClick:()=>{fn(""),$t(!0)},disabled:qt===0,children:"选择"})}),D==="library"&&Wt&&o.jsx("div",{className:"aw-delete-error",role:"alert",children:Wt}),o.jsx("div",{className:"aw-agent-list",children:D==="evaluation"?In.length===0?o.jsx("div",{className:"aw-list-empty",children:"没有匹配的评测组"}):In.map(X=>o.jsxs("button",{type:"button",className:`aw-agent-item${X.id===Ms?" is-active":""}`,onClick:()=>Fu(X.id),children:[o.jsxs("span",{className:"aw-agent-copy aw-eval-group-copy",children:[o.jsx("strong",{children:X.name}),o.jsxs("small",{children:[X.agentIds.length," 个智能体 · ",X.history.length," 次运行"]})]}),o.jsx(I1,{"aria-hidden":!0})]},X.id)):u&&se.length===0&&ta.length===0?o.jsx("div",{className:"aw-list-empty",children:"正在读取云端智能体…"}):d&&se.length===0&&ta.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:"重试"})]}):se.length===0&&ta.length===0?o.jsx("div",{className:"aw-list-empty",children:"没有匹配的智能体"}):o.jsxs(o.Fragment,{children:[ta.map(X=>{const ge=f.filter(He=>{var bt,zt;return((bt=He.agentDraft)==null?void 0:bt.name)===X.draft.name||He.agentName===X.draft.name||!!((zt=X.deploymentTarget)!=null&&zt.runtimeId)&&He.runtimeId===X.deploymentTarget.runtimeId}).sort((He,bt)=>bt.startedAt-He.startedAt)[0],_e=xr.has(X.id);return o.jsxs("button",{type:"button",className:["aw-agent-item",Ze?"is-selecting":"",_e?"is-selected-for-delete":"",X.id===F?"is-active":""].filter(Boolean).join(" "),"aria-pressed":Ze?_e:void 0,onClick:()=>{if(Ze){YO(X);return}U(""),q(X.id),P("basic")},children:[Ze&&o.jsx("span",{className:`aw-select-marker${_e?" 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:X.draft.name||"未命名 Agent"}),o.jsx("span",{className:`aw-draft-badge${(ge==null?void 0:ge.status)==="running"?" is-deploying":""}`,children:(ge==null?void 0:ge.status)==="running"?"部署中":"草稿"})]}),o.jsx("small",{children:X.deploymentTarget?"待更新":"尚未发布"})]}),o.jsx(I1,{"aria-hidden":!0})]},X.id)}),se.map(X=>{const ge=X.runtimeId?eo.get(X.runtimeId):void 0,_e=X.runtimeId?dl.get(X.runtimeId):void 0,He=En.has(X.id),bt=X.canDelete===!0,zt=(ge==null?void 0:ge.status)==="running"?{label:"部署中",className:" is-deploying"}:(ge==null?void 0:ge.status)==="error"?{label:"失败",className:" is-error"}:(ge==null?void 0:ge.status)==="cancelled"?{label:"已取消",className:" is-muted"}:_e?{label:"待更新",className:""}:null,Pr=(ge==null?void 0:ge.status)==="running"?"正在更新部署":_e?"待更新":X.remote?X.host||"远程智能体":"本地智能体",Qc=["aw-agent-item","aw-agent-item--sortable",X.id===L?"is-active":"",Ze?"is-selecting":"",He?"is-selected-for-delete":"",Ze&&!bt?"is-selection-disabled":"",X.id===tt?"is-dragging":"",X.id===or&&X.id!==tt?`is-drop-target is-drop-${Ut}`:""].filter(Boolean).join(" ");return o.jsxs("button",{type:"button",draggable:!!w&&!Ze,className:Qc,"aria-pressed":Ze?He:void 0,"aria-keyshortcuts":w?"Alt+ArrowUp Alt+ArrowDown":void 0,onDragStart:Qn=>{w&&(zi.current=!0,an(X.id),Qn.dataTransfer.effectAllowed="move",Qn.dataTransfer.setData("text/plain",X.id))},onDragEnter:Qn=>{Dr(Qn,X.id)},onDragOver:Qn=>{!tt||tt===X.id||(Qn.preventDefault(),Qn.dataTransfer.dropEffect="move",Dr(Qn,X.id))},onDragLeave:Qn=>{const Fc=Qn.relatedTarget;Fc instanceof Node&&Qn.currentTarget.contains(Fc)||or===X.id&&Qt("")},onDrop:Qn=>{Qn.preventDefault();const Fc=Qn.dataTransfer.getData("text/plain")||tt;ug(Fc,X.id,Ut),an(""),Qt(""),Ce("before")},onDragEnd:()=>{an(""),Qt(""),Ce("before"),window.setTimeout(()=>{zi.current=!1},0)},onKeyDown:Qn=>{Qn.altKey&&(Qn.key==="ArrowUp"?(Qn.preventDefault(),qu(X.id,-1)):Qn.key==="ArrowDown"&&(Qn.preventDefault(),qu(X.id,1)))},onClick:Qn=>{if(Ze){Qn.preventDefault(),Xw(X);return}if(zi.current){Qn.preventDefault(),zi.current=!1;return}q(""),U(X.id),P("basic"),k(X.id)},children:[Ze&&o.jsx("span",{className:`aw-select-marker${He?" 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:X.label}),X.currentVersion!=null&&o.jsxs("span",{className:"aw-version-badge",children:["v",X.currentVersion]}),zt&&o.jsx("span",{className:`aw-draft-badge${zt.className}`,children:zt.label})]}),o.jsx("small",{children:Pr})]}),o.jsx(I1,{"aria-hidden":!0})]},X.id)})]})}),o.jsxs("div",{className:"aw-list-count",children:["共 ",D==="library"?e.length+Uu:_o.length," 个"]})]}),D==="evaluation"&&qe?o.jsx(ygt,{group:qe,agents:e,cases:Vu,onChange:op,onRun:mN}):D==="evaluation"?o.jsx("main",{className:"aw-main aw-empty-selection",children:o.jsx("p",{children:"未选择评测组"})}):!ae&&!$n&&!br?o.jsx("main",{className:"aw-main aw-empty-selection",children:o.jsx("p",{children:"未选择智能体"})}):o.jsxs("main",{className:`aw-main${fl?" is-deploying":""}`,children:[ae&&!yn&&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:"正在读取配置与运行信息…"})]})]})}),j==="integrations"&&we&&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.jsxs("div",{className:"aw-agent-head",children:[o.jsxs("div",{className:"aw-agent-heading",children:[y&&v?o.jsx(B9,{label:"返回智能体列表",onClick:v}):null,o.jsxs("div",{className:"aw-agent-heading-copy",children:[o.jsxs("div",{className:"aw-agent-title-row",children:[o.jsx("h2",{children:De}),Ht!=null&&o.jsxs("span",{children:["v",Ht]}),$n&&o.jsx("span",{children:"草稿"}),xa&&o.jsx("span",{children:"待更新"}),!ae&&!$n&&br&&o.jsx("span",{children:br.label})]}),o.jsx("p",{children:_t.description||(s||y&&!ve?"正在读取智能体信息…":"暂无描述")})]})]}),($n||xa||(ae==null?void 0:ae.canDelete))&&o.jsxs("div",{className:"aw-head-actions",children:[($n||xa)&&o.jsxs("button",{type:"button",className:"aw-head-delete aw-head-delete--draft",onClick:()=>{const X=$n??xa;X&&Dn(X)},disabled:at,"aria-label":"删除草稿",title:"删除草稿",children:[o.jsx(Rh,{"aria-hidden":!0}),o.jsx("span",{children:"删除草稿"})]}),(ae==null?void 0:ae.canDelete)&&o.jsxs("button",{type:"button",className:"aw-head-delete",onClick:()=>void hN(ae),disabled:at,"aria-label":"删除 Agent",title:"删除 Agent",children:[o.jsx(Rh,{"aria-hidden":!0}),o.jsx("span",{children:at?"删除中…":"删除 Agent"})]})]})]}),fr&&sg&&o.jsx("div",{className:`aw-detail-deployment${fl?" is-running":""}`,children:o.jsx(pgt,{task:fr,onReturnToEdit:zu&&$?()=>$(zu):void 0})}),o.jsx("nav",{className:"aw-agent-tabs","aria-label":"智能体详情",role:"tablist",children:na.map(X=>o.jsx("button",{type:"button",id:`agent-${X.id}-tab`,className:j===X.id?"is-active":"",role:"tab","aria-selected":j===X.id,"aria-controls":`agent-${X.id}-panel`,tabIndex:j===X.id?0:-1,onClick:()=>P(X.id),onKeyDown:ge=>{var zt;if(!["ArrowLeft","ArrowRight","Home","End"].includes(ge.key))return;ge.preventDefault();const _e=na.findIndex(Pr=>Pr.id===X.id),He=ge.key==="Home"?0:ge.key==="End"?na.length-1:(_e+(ge.key==="ArrowRight"?1:-1)+na.length)%na.length,bt=na[He];P(bt.id),(zt=document.getElementById(`agent-${bt.id}-tab`))==null||zt.focus()},children:X.label},X.id))}),o.jsxs("div",{className:"aw-content",id:`agent-${j}-panel`,role:"tabpanel","aria-labelledby":`agent-${j}-tab`,children:[j==="basic"&&o.jsxs("div",{className:"aw-basic-stack",children:[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)||(ae==null?void 0:ae.region)||(fr==null?void 0:fr.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(zx,{draft:_t,direction:"horizontal",selectedPath:[],onSelect:()=>{},onAdd:()=>{},onInsert:()=>{},onDelete:()=>{},readOnly:!0,interactivePreview:!0},Ts)})]}),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:Y6(yn==null?void 0:yn.model)||_t.modelName||"暂未提供"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"智能体数量"}),o.jsx("dd",{children:yn!=null&&yn.graph?U0e(yn.graph):z0e(_t)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"工具"}),o.jsx("dd",{className:"aw-fact-badges",children:ec.length?ec.map(X=>o.jsx("span",{children:X},X)):"暂无"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"技能"}),o.jsx("dd",{className:"aw-fact-badges",children:gf===null?"暂不支持预览":gf.length?gf.map(X=>o.jsx("span",{children:X},X)):"暂无"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"当前版本"}),o.jsx("dd",{children:Ht!=null?`v${Ht}`:"暂未提供"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"状态"}),o.jsx("dd",{children:$n?"草稿":(fr==null?void 0:fr.status)==="error"?"部署失败":(fr==null?void 0:fr.status)==="cancelled"?"已取消":xa?"待更新":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:un!=null&&un.enabled?"is-ready":void 0,children:un?un.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:un?B0e(un.profile):"旧版本未保存此配置"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"已选优化项"}),o.jsx("dd",{className:"aw-fact-badges",children:un?dr.length?dr.map(X=>o.jsx("span",{children:ox(X)},X)):"未选择":"旧版本未保存此配置"})]})]})]})]}),j==="usage"&&(ae==null?void 0:ae.runtimeId)&&o.jsxs("section",{className:"aw-usage","aria-busy":Ii,children:[o.jsx("div",{className:"aw-usage-intro",children:o.jsx("h3",{children:"使用概览"})}),Ii&&!fs&&o.jsx("div",{className:"aw-usage-state",role:"status","aria-live":"polite",children:o.jsx(Ln,{as:"span",children:"正在加载用量统计"})}),gr&&o.jsxs("div",{className:"aw-usage-state is-error",role:"alert",children:[o.jsx("span",{children:gr}),o.jsx("button",{type:"button",onClick:()=>Ka(X=>X+1),children:"重试"})]}),!Ii&&!gr&&!fs&&!Jn&&o.jsx("div",{className:"aw-usage-state",children:"当前 Runtime 未返回可用的 Agent 应用名称,暂时无法读取用量。"}),fs&&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:fs.totalInvocations.toLocaleString("zh-CN")})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"使用用户数"}),o.jsx("dd",{children:fs.totalUsers.toLocaleString("zh-CN")})]})]}),o.jsxs("div",{className:"aw-usage-users-head",children:[o.jsx("h3",{children:"用户明细"}),Ii&&o.jsx(Ln,{as:"span",role:"status","aria-live":"polite",children:"正在刷新"})]}),fs.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:fs.users.map(X=>o.jsxs("tr",{children:[o.jsxs("td",{children:[o.jsx("strong",{children:X.displayName||X.userId||"未知用户"}),X.displayName&&X.userId&&o.jsx("small",{title:X.userId,children:X.userId})]}),o.jsx("td",{children:X.invocationCount.toLocaleString("zh-CN")}),o.jsx("td",{children:o.jsx("time",{dateTime:X.lastUsedAt,children:Xmt(X.lastUsedAt)})})]},X.userId))})]})}),fs.totalPages>1&&o.jsxs("nav",{className:"aw-usage-pagination","aria-label":"用量用户列表分页",children:[o.jsx("button",{type:"button",disabled:Ii||fs.page<=1,onClick:()=>Es(X=>Math.max(1,X-1)),children:"上一页"}),o.jsxs("span",{"aria-live":"polite",children:["第 ",fs.page," / ",fs.totalPages," 页"]}),o.jsx("button",{type:"button",disabled:Ii||fs.page>=fs.totalPages,onClick:()=>Es(X=>X+1),children:"下一页"})]})]})]}),j==="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:(dg=Ve==null?void 0:Ve.cicd)!=null&&dg.enabled?"展示当前 Runtime 绑定 GitHub 后由 Studio 记录的版本与 PR。":"未挂载 GitHub 时仅展示 Studio 当前版本。"})]}),Tt&&o.jsx("div",{className:"aw-case-empty",children:"正在读取版本…"}),W&&o.jsxs("div",{className:"aw-integration-error",role:"alert",children:[o.jsx("span",{children:W}),(ae==null?void 0:ae.runtimeId)&&o.jsx("button",{type:"button",onClick:()=>void jk(ae.runtimeId??"").then(ut),children:"重试"})]}),!Tt&&!W&&o.jsxs("div",{className:"aw-version-list",children:[(Ve==null?void 0:Ve.githubSyncError)&&o.jsx("div",{className:"aw-integration-error",role:"alert",children:o.jsx("span",{children:Ve.githubSyncError})}),(Ve==null?void 0:Ve.latestSourceRuntimeStatus)&&Ve.latestSourceRuntimeStatus!=="published"&&((Kw=Ve.versions[0])==null?void 0:Kw.commitSha)&&Ve.versions[0].commitSha!==Ve.currentCommitSha&&o.jsx("div",{className:"aw-integration-notice",role:"status",children:o.jsxs("span",{children:["源码已合入 main,Runtime 仍在",AY(Ve.latestSourceRuntimeStatus),";当前线上版本保持在最近一次发布成功的版本。"]})}),Ve!=null&&Ve.versions.length?Ve.versions.map(X=>{var zt;const ge=X.commitSha??"",_e=X.runtimeStatus??X.status,He=X.changeType==="rollback",bt=!!((zt=Ve.cicd)!=null&&zt.enabled)&&!!ge&&!He&&ge!==Ve.currentCommitSha;return o.jsxs("article",{className:"aw-version-row",children:[o.jsxs("div",{children:[o.jsx("strong",{children:Ymt(X)}),o.jsx("small",{children:X.createdAt||"暂无时间"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"PR 链接"}),X.pullRequestUrl?o.jsx("a",{href:X.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:X.author||"Studio"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"发布状态"}),o.jsx("em",{children:AY(_e)})]}),o.jsxs("div",{className:"aw-version-actions",children:[o.jsx("button",{type:"button",disabled:!bt||he===ge,onClick:()=>void cN(X),children:he===ge?"回退中…":"回退到此版本"}),X.workflowRunUrl&&o.jsx("a",{href:X.workflowRunUrl,target:"_blank",rel:"noopener noreferrer",children:"查看发布"})]})]},`${X.version}-${ge||X.createdAt}`)}):o.jsxs("article",{className:"aw-version-row",children:[o.jsxs("div",{children:[o.jsx("strong",{children:Ht!=null?`v${Ht}`:"暂无版本"}),o.jsx("small",{children:(z==null?void 0:z.updatedAt)||"暂无时间"})]}),o.jsx("p",{children:"未挂载 GitHub 时仅展示 Studio 当前版本。"})]})]})]}),j==="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 可确认的公开协议与地址。"})]}),de&&o.jsxs("div",{className:"aw-integration-error",role:"alert",children:[o.jsx("span",{children:de}),o.jsx("button",{type:"button",onClick:()=>fe(X=>X+1),children:"重试"})]}),!de&&o.jsxs("div",{className:"aw-integration-body",children:[o.jsxs("div",{className:`aw-integration-protocol-tabs${be==="a2a"?" is-a2a":""}`,role:"tablist","aria-label":"接入协议",children:[o.jsx("span",{className:"aw-integration-protocol-slider","aria-hidden":"true"}),Ly.map((X,ge)=>o.jsx("button",{type:"button",id:`integration-${X.id}-tab`,role:"tab","aria-selected":be===X.id,"aria-controls":`integration-${X.id}-panel`,tabIndex:be===X.id?0:-1,onClick:()=>Ls(X.id),onKeyDown:_e=>{var zt;if(!["ArrowLeft","ArrowRight","Home","End"].includes(_e.key))return;_e.preventDefault();const He=_e.key==="Home"?0:_e.key==="End"?Ly.length-1:(ge+(_e.key==="ArrowRight"?1:-1)+Ly.length)%Ly.length,bt=Ly[He];Ls(bt.id),(zt=document.getElementById(`integration-${bt.id}-tab`))==null||zt.focus()},children:X.label},X.id))]}),be==="api-server"?o.jsx(NY,{protocol:"api-server",title:"API Server",available:vi,fields:[{label:"Agent",value:vi?((WO=Br==null?void 0:Br.apiApps)==null?void 0:WO.join("、"))??"":""},{label:"发现接口",value:vi?sD(rt,"/list-apps"):""},{label:"调用接口",value:vi?sD(rt,"/run_sse"):""},{label:"鉴权方式",value:vi?_Y(z==null?void 0:z.authType):""},{label:"API Key",value:o.jsx(CY,{available:vi,authType:z==null?void 0:z.authType,value:Jl,visible:le&&!!Jl,loading:ye,error:ze,onToggle:()=>void ap()})}],example:vi?Wmt(rt,Le,z==null?void 0:z.authType):""}):o.jsx(NY,{protocol:"a2a",title:"A2A",available:ee,fields:[{label:"Agent",value:((Jw=Br==null?void 0:Br.a2a)==null?void 0:Jw.name)??""},{label:"Agent Card",value:ee?sD(rt,"/.well-known/agent-card.json"):""},{label:"调用地址",value:Mt},{label:"鉴权方式",value:ee?_Y(z==null?void 0:z.authType):""},{label:"API Key",value:o.jsx(CY,{available:ee,authType:z==null?void 0:z.authType,value:Jl,visible:le&&!!Jl,loading:ye,error:ze,onToggle:()=>void ap()})}],example:ee?Zmt(Mt,z==null?void 0:z.authType):""})]})]}),j==="evaluations"&&o.jsxs("section",{className:"aw-cases",children:[(ae==null?void 0:ae.runtimeId)&&o.jsx("div",{className:"aw-case-summary",children:["good","bad"].map(X=>{const ge=sgt(Yt,X),_e=Vu.filter(bt=>bt.kind===X).length,He=Ir?_e:(ge==null?void 0:ge.itemCount)??_e;return o.jsxs("button",{type:"button",onClick:()=>Vw(X),children:[o.jsx("strong",{children:He}),o.jsx("span",{children:X==="good"?"Good cases":"Bad cases"})]},X)})}),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(X=>o.jsx("button",{type:"button",className:xt===X?"is-active":"","aria-pressed":xt===X,onClick:()=>Dt(X),children:X==="good"?"Good case":"Bad case"},X))}),o.jsx("div",{className:"aw-case-source-filters","aria-label":"回流方式筛选",children:["auto","user"].map(X=>o.jsx("button",{type:"button",className:Pt===X?"is-active":"","aria-pressed":Pt===X,onClick:()=>Kt(X),children:X==="auto"?"自动回流":"手动回流"},X))})]}),o.jsxs("label",{className:"aw-case-search",children:[o.jsx(i2,{"aria-hidden":!0}),o.jsx("input",{type:"search",value:Ne,onChange:X=>Ge(X.currentTarget.value),placeholder:"搜索用户输入、期望行为或标签","aria-label":"搜索评测案例"})]})]}),zw&&o.jsx("div",{className:`aw-case-toolbar${oi?" is-active":""}`,children:oi?o.jsxs(o.Fragment,{children:[o.jsxs("span",{className:"aw-selection-count",children:["已选 ",ag.length," 条"]}),o.jsx("button",{type:"button",onClick:og,disabled:bf.length===0||Ja,children:"全选当前"}),o.jsx("button",{type:"button",className:"aw-selection-danger",onClick:()=>void ht(ag),disabled:ag.length===0||Ja,children:Ja?"删除中…":"删除所选"}),o.jsx("button",{type:"button",onClick:lg,disabled:Ja,children:"取消"})]}):o.jsx("button",{type:"button",onClick:()=>{Ks(""),Zl(!0)},disabled:bf.length===0||Ja,children:"选择案例"})}),Ji&&o.jsx("div",{className:"aw-delete-error",role:"alert",children:Ji}),o.jsx("div",{ref:Oa,children:o.jsx(Ogt,{cases:bf,loading:kn&&bf.length===0,error:jr,notice:Rn,runtimeBacked:!!(ae!=null&&ae.runtimeId),selectionMode:oi,selectedCaseIds:To,focusedCaseId:Di,expandedCaseIds:Er,deleting:Ja,canDelete:zw,onOpenCase:Hw,onToggleCase:uN,onToggleExpanded:qw,onDeleteCase:X=>void ht([X]),onRetry:()=>ur(X=>X+1)})})]}),j==="optimizations"&&o.jsxs("section",{className:"aw-optimizations",children:[o.jsxs("div",{className:"aw-optimization-intro",children:[o.jsx("h3",{children:"优化项"}),o.jsx("p",{children:"根据评测结果汇总需要优先处理的改进建议。"})]}),Zr?o.jsxs("div",{className:"aw-optimization-state",role:"status",children:[o.jsx("span",{className:"loading-gap-spinner","aria-hidden":"true"}),o.jsx("span",{children:"正在读取优化项"})]}):ue?o.jsxs("div",{className:"aw-optimization-state is-error",role:"alert",children:[o.jsx("span",{children:ue}),o.jsx("button",{type:"button",onClick:()=>dt(X=>X+1),children:"重试"})]}):Lr.length>0?o.jsx(ggt,{groups:Lr}):o.jsx("div",{className:"aw-optimization-state",children:"暂无优化项,自动评测完成后会在这里生成建议。"})]})]}),j==="basic"&&(ae||$n)&&o.jsxs("div",{className:"aw-basic-actions",children:[ae&&o.jsxs("button",{type:"button",className:"aw-talk studio-update-action",onClick:()=>T==null?void 0:T(ae),children:[o.jsx(t_e,{"aria-hidden":!0}),o.jsx("span",{children:"去对话"})]}),o.jsxs("span",{className:`aw-update-wrap${wi?" is-disabled":""}`,tabIndex:wi?0:void 0,"aria-describedby":wi?sp:void 0,children:[o.jsx("button",{type:"button",className:"aw-update studio-update-action",disabled:!!wi,"aria-busy":nt||void 0,"aria-describedby":wi?sp:void 0,onClick:()=>$n?$==null?void 0:$($n):On?R(On):void 0,children:nt?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"loading-gap-spinner aw-update-spinner","aria-hidden":"true"}),o.jsx("span",{children:"检测中"})]}):$n||xa?"继续编辑":"更新"}),wi&&o.jsx("span",{id:sp,className:"aw-update-disabled-reason",role:"tooltip",children:wi})]})]})]})]}),D==="evaluation"&&o.jsx("div",{className:"aw-evaluation-glass",role:"status",children:o.jsx("span",{children:"敬请期待"})})]})]}),Jt&&o.jsx(Bl,{variant:"danger",title:Jt.title,description:Jt.description,confirmLabel:at?"删除中...":Jt.confirmLabel,closeLabel:"关闭删除确认",busy:at,onCancel:()=>lr(null),onConfirm:()=>void lp()})]})}function ggt({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:ngt(t.priority)})}),o.jsx("td",{children:o.jsx("span",{className:"aw-optimization-module",children:igt(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 bgt(){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 Ogt({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:p,onDeleteCase:b,onRetry:g}){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}),g&&o.jsx("button",{type:"button",onClick:g,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(O=>{var T,C;const y=O.id.startsWith("local:"),v=(a==null?void 0:a.has(O.id))??!1,x=(c==null?void 0:c.has(O.id))??!1,S=O.output.length+O.referenceOutput.length>220||(((T=O.reason)==null?void 0:T.length)??0)>120,E=d&&!y,k=!!(O.comment&&O.comment.trim()!==((C=O.reason)==null?void 0:C.trim()));return o.jsxs("div",{className:["aw-case-row",l===O.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(O));return}f==null||f(O)},onKeyDown:N=>{N.target===N.currentTarget&&(N.key!=="Enter"&&N.key!==" "||(N.preventDefault(),s?E&&(h==null||h(O)):f==null||f(O)))},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:O.input,children:O.input||"无用户输入"})]}),k&&o.jsxs("small",{title:O.comment,children:["备注:",O.comment]}),o.jsx("small",{className:"aw-case-time",children:egt(O.createdAt)}),(O.userId||O.sessionId)&&o.jsx("small",{title:[O.userId,O.sessionId].filter(Boolean).join(" · "),children:[O.userId,O.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:O.output,children:O.output||"无可见回复"}),O.referenceOutput&&o.jsxs("small",{className:"aw-case-output-preview",title:O.referenceOutput,children:["Reference: ",O.referenceOutput]}),S&&o.jsx("button",{type:"button",className:"aw-case-expand",onClick:N=>{N.stopPropagation(),p==null||p(O.id)},children:x?"收起":"展开"})]}),o.jsx("div",{className:"aw-case-score aw-case-cell","data-label":"评分",children:tgt(O)}),o.jsx("div",{className:`aw-case-reason aw-case-cell${x?" is-expanded":""}`,"data-label":"评分理由",children:o.jsx("p",{title:O.reason||void 0,children:O.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:N=>{N.stopPropagation(),b==null||b(O)},disabled:u,title:"删除反馈案例","aria-label":"删除反馈案例",children:o.jsx(bgt,{})})})]},O.id)})]})}function ygt({group:e,agents:t,cases:n,onChange:r,onRun:i}){const[s,a]=m.useState("config"),l=e.agentIds.map(f=>t.find(h=>h.id===f)).filter(f=>!!f),c=["回答质量","事实准确性","工具调用","响应效率"];m.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(Y2e,{"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(rf,{}),"已完成"]}),o.jsx(I1,{"aria-hidden":!0})]},f.id))})]})})]})}const xgt="/web/sandbox/sessions",RY="/web/sandbox/codex-project-handoff",IY=3e4,aD=33e4,vgt=6e4,wgt=6e5,$y=15e3,fd=6e4,Sgt=33e4,DY=3e4,Egt=60*60,PY=40;function GC(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 ki(e){const t=new Headers(e);return t.has("Accept")||t.set("Accept","application/json"),t}async function Ti(e,t){const n=await e.text().catch(()=>"");let r={};try{r=JSON.parse(n)}catch{const c=`${t}(HTTP ${e.status})`;return new Error(n?`${c}:${n}`:c)}const i=r.detail,s=i&&typeof i=="object"&&"message"in i?i.message:i??r.error??r.message,a=typeof s=="string"?s:s==null?"":JSON.stringify(s),l=`${t}(HTTP ${e.status})`;return new Error(a?`${l}:${a}`:l)}async function MY(e,t){const n=await e.text().catch(()=>"");try{return JSON.parse(n)}catch{throw new Error(`${t} Studio 服务响应异常,请刷新后重试。`)}}function wp(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??"",threadId:e.threadId??"",cwd:e.cwd??"",workspaceLocked:e.workspaceLocked===!0,busy:e.busy===!0,...typeof e.model=="string"?{model:e.model}:{},permissions:YC(e.permissions),...e.conversation===void 0?{}:{restoredConversation:Lp(e.conversation)}}}function LY(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??""}}function $Y(e,t){if(!(t!=null&&t.autoResumeSnapshots))return e;const n=new URLSearchParams({autoResumeSnapshots:"true"});return`${e}?${n.toString()}`}const By={approvalPolicy:"on-request",approvalsReviewer:"user",sandboxMode:"workspace-write",networkAccess:!1};function YC(e){if(!e||typeof e!="object")return{...By};const t=e,n=t.approvalPolicy,r=t.approvalsReviewer,i=t.sandboxMode;return{approvalPolicy:n==="untrusted"||n==="on-request"||n==="never"?n:By.approvalPolicy,approvalsReviewer:r==="user"||r==="auto_review"?r:By.approvalsReviewer,sandboxMode:i==="read-only"||i==="workspace-write"||i==="danger-full-access"?i:By.sandboxMode,networkAccess:typeof t.networkAccess=="boolean"?t.networkAccess:By.networkAccess}}function BY(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:YC(t.permissions)}}function Qs(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function kgt(e){const t=Qs(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 Tgt(e){const t=Qs(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 X0e(e){const t=Qs(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 Lp(e){const t=Qs(e),n=X0e(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=Qs(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=Qs(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:YC(t.permissions)}}function J3(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 _gt(e){const t=J3(e.usage);if(!t||typeof e.turnId!="string")return;const n=J3(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 Agt(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 Cgt(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 g;const b=c?[...a,c]:a;(g=t.onBlocks)==null||g.call(t,b.map(O=>({...O})))}function f(b){s+=b;const g=a[a.length-1],O=a.length-1,y=[...l.values()].includes(O);(g==null?void 0:g.kind)==="text"&&!y?g.text+=b:a.push({kind:"text",text:b}),d()}function h(b){if(typeof b.id!="string"||b.kind!=="thinking"&&b.kind!=="commentary"&&b.kind!=="tool"||b.status!=="running"&&b.status!=="done")return;const g=b.status==="done";let O;if(b.kind==="thinking"){if(typeof b.text!="string"||!b.text)return;O={kind:"thinking",text:b.text,done:g}}else if(b.kind==="commentary"){if(typeof b.text!="string"||!b.text)return;O={kind:"text",text:b.text}}else{if(typeof b.name!="string"||!b.name)return;O={kind:"tool",name:b.name,args:b.args,response:b.response,done:g}}const y=l.get(b.id);y===void 0?(l.set(b.id,a.length),a.push(O)):a[y]=O,d()}function p(b){var v,x,w;let g="message";const O=[];for(const S of b.split(/\r?\n/))S.startsWith("event:")&&(g=S.slice(6).trim()),S.startsWith("data:")&&O.push(S.slice(5).trimStart());if(O.length===0)return;let y;try{y=JSON.parse(O.join(` +`))}catch{throw new Error("沙箱对话服务返回了无法解析的响应。")}if(g==="error")throw new Error(typeof y.message=="string"&&y.message?y.message:"沙箱对话失败,请稍后重试。");if(g==="progress"&&typeof y.text=="string"&&y.text&&(c={kind:"progress",text:y.text},d()),g==="activity"&&h(y),g==="development.source_ready"||g==="development.succeeded"){const S=Qs(y.payload),E=Qs(S==null?void 0:S.delivery),k=g==="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(T=>typeof T=="string")){const T={kind:"delivery",value:{sessionId:E.sessionId,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(N=>N.kind==="delivery"&&N.value.sessionId===E.sessionId&&N.value.artifactSha256===E.artifactSha256&&N.value.validationReportSha256===E.validationReportSha256);C===-1?a.push(T):a[C]=T,d()}}if(g==="approval"){const S=Agt(y);S&&((v=t.onApproval)==null||v.call(t,S))}if(g==="usage"){const S=_gt(y);S&&(u=S,(x=t.onUsage)==null||x.call(t,S))}g==="approval_resolved"&&typeof y.approvalId=="string"&&((w=t.onApprovalResolved)==null||w.call(t,y.approvalId)),g==="delta"&&typeof y.text=="string"&&f(y.text),g==="done"&&!s&&typeof y.text=="string"&&f(y.text),g==="done"&&c&&(c=void 0,d())}for(;;){const{done:b,value:g}=await n.read();i+=r.decode(g,{stream:!b});const O=i.split(/\r?\n\r?\n/);if(i=O.pop()??"",O.forEach(p),b)break}if(i.trim()&&p(i),c&&(c=void 0,d()),a.length===0)throw new Error("沙箱未返回有效回复,请重试。");return{text:s,blocks:a,...u?{usage:u}:{}}}async function Mo(e,t,n,{method:r="GET",body:i,options:s={},fallback:a}){if(!t)throw new Error("缺少要操作的 AgentKit Session。");const l=await Hn(`${e}/${encodeURIComponent(t)}/${n}`,{method:r,headers:ki(i===void 0?void 0:{"Content-Type":"application/json"}),...i===void 0?{}:{body:JSON.stringify(i)},signal:s.signal},fd);if(!l.ok)throw await Ti(l,a);return l.json()}function G0e(e,t={}){return{async listSessions(n={}){const r=await Hn($Y(e,n),{method:"GET",headers:ki(),signal:n.signal},IY);if(!r.ok)throw await Ti(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=>wp(s)),...(i.snapshots??[]).map(s=>LY(s))]},async startSession(n={}){var i;const r=await Hn(e,{method:"POST",headers:ki({"Content-Type":"application/json"}),body:JSON.stringify({displayName:((i=n.displayName)==null?void 0:i.trim())??"",...t.textOnly?{}:{persistent:n.persistent??!0}}),signal:n.signal},aD);if(!r.ok)throw await Ti(r,"无法启动 AgentKit 沙箱,请稍后重试。");return wp(await r.json())},async listAgentSessions(n,r={}){const i=await Hn($Y(`/web/${n}/sessions`,r),{method:"GET",headers:ki(),signal:r.signal},IY);if(!i.ok)throw await Ti(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=>wp(a,n)),...(s.snapshots??[]).map(a=>LY(a,n))]},async startAgentSession(n,r={}){var s;const i=await Hn(`/web/${n}/sessions`,{method:"POST",headers:ki({"Content-Type":"application/json"}),body:JSON.stringify({displayName:((s=r.displayName)==null?void 0:s.trim())??"",persistent:r.persistent??!0}),signal:r.signal},aD);if(!i.ok)throw await Ti(i,`无法创建 ${n} 智能体,请稍后重试。`);return wp(await i.json(),n)},async openAgentSession(n,r,i={}){if(!r)throw new Error("缺少要打开的 AgentKit Session。");const s=await Hn(`/web/${n}/sessions/${encodeURIComponent(r)}/open`,{method:"POST",headers:ki(),signal:i.signal},fd);if(!s.ok)throw await Ti(s,`无法打开 ${n} 智能体。`);const a=await s.json();if(typeof a.webuiUrl!="string"||!a.webuiUrl.startsWith("/"))throw new Error(`${n} 智能体返回了无效的主页面地址。`);return{session:wp(a,n),kind:n,webuiUrl:bo(a.webuiUrl)}},async launchAgentTerminal(n,r,i={}){if(!r)throw new Error("缺少要打开 Terminal 的 AgentKit Session。");const s=await Hn(`/web/${n}/sessions/${encodeURIComponent(r)}/terminal`,{method:"POST",headers:ki(),signal:i.signal},fd);if(!s.ok)throw await Ti(s,`无法打开 ${n} Terminal。`);const a=await s.json();return{url:Y0e(a.url,`${n} Terminal`),...typeof a.shellSessionId=="string"?{shellSessionId:a.shellSessionId}:{}}},async deleteAgentSession(n,r,i={}){if(!r)return;const s=await Hn(`/web/${n}/sessions/${encodeURIComponent(r)}`,{method:"DELETE",headers:ki(),signal:i.signal},$y);if(!s.ok&&s.status!==404)throw await Ti(s,`无法删除 ${n} 智能体。`)},async resumeSnapshot(n,r,i={}){if(!r)throw new Error("缺少要唤醒的 AgentKit Snapshot。");const s=n==="codex"?"/web/sandbox":`/web/${n}`,a=await Hn(`${s}/snapshots/${encodeURIComponent(r)}/resume`,{method:"POST",headers:ki(),signal:i.signal},aD);if(!a.ok)throw await Ti(a,"无法从快照唤醒智能体,请稍后重试。");return wp(await a.json(),n)},async deleteSnapshot(n,r,i={}){if(!r)return;const s=n==="codex"?"/web/sandbox":`/web/${n}`,a=await Hn(`${s}/snapshots/${encodeURIComponent(r)}`,{method:"DELETE",headers:ki(),signal:i.signal},$y);if(!a.ok&&a.status!==404)throw await Ti(a,"无法删除智能体快照。")},async connectSession(n,r={}){if(!n)throw new Error("缺少要连接的 AgentKit Session。");const i=await Hn(`${e}/${encodeURIComponent(n)}/connect`,{method:"POST",headers:ki({"Content-Type":"application/json"}),signal:r.signal},vgt);if(!i.ok)throw await Ti(i,"无法连接 Codex 智能体,请稍后重试。");const s=wp(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 Hn(`${e}/${encodeURIComponent(n.sessionId)}/messages`,{method:"POST",headers:ki({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??wgt);if(!i.ok)throw await Ti(i,"沙箱对话失败,请稍后重试。");return Cgt(i,r)},async interruptSession(n,r={}){if(!n)return;const i=await Hn(`${e}/${encodeURIComponent(n)}/interrupt`,{method:"POST",headers:ki(),signal:r.signal},t.interruptTimeoutMs??$y);if(!i.ok&&![404,409].includes(i.status))throw await Ti(i,"无法停止当前任务。")},async getStatus(n,r={}){const i=await Mo(e,n,"status",{options:r,fallback:"无法读取 Codex 状态。"}),s=BY(i),a=Qs(i),l=J3(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=Qs(await Mo(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 Hn(`${RY}/pairings`,{method:"POST",headers:ki({Accept:"application/json","Content-Type":"application/json"}),body:JSON.stringify({ttlSeconds:Egt}),signal:n.signal},DY);if(!r.ok)throw await Ti(r,"无法生成 Codex 云端接力配对码。");const i=Qs(await MY(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 Hn(`${RY}/pairings/${encodeURIComponent(n)}`,{headers:ki({Accept:"application/json"}),signal:r.signal},DY);if(!i.ok)throw await Ti(i,"无法读取端云接力状态。");const s=Qs(await MY(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=Qs(await Mo(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=kgt(s);return a?[a]:[]})},async setModel(n,r,i={}){const s=Qs(await Mo(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=Qs(await Mo(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=Tgt(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=Qs(await Mo(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=X0e(c);return u?[u]:[]}),...typeof l.nextCursor=="string"?{nextCursor:l.nextCursor}:{}}},async newThread(n,r={}){return Lp(await Mo(e,n,"threads/new",{method:"POST",options:r,fallback:"无法创建新的 Codex Thread。"}))},async readThread(n,r,i={}){if(!r)throw new Error("缺少要读取的 Codex Thread。");return Lp(await Mo(e,n,`threads/${encodeURIComponent(r)}`,{options:i,fallback:"无法读取 Codex 历史消息。"}))},async resumeThread(n,r,i={}){return Lp(await Mo(e,n,"threads/resume",{method:"POST",body:{threadId:r},options:i,fallback:"无法恢复 Codex Thread。"}))},async forkThread(n,r={}){return Lp(await Mo(e,n,"threads/fork",{method:"POST",options:r,fallback:"无法分叉 Codex Thread。"}))},async archiveThread(n,r,i={}){const s=Qs(await Mo(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:Lp(s)}:{}}},async deleteThread(n,r,i={}){const s=Qs(await Mo(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:Lp(s)}:{}}},async compactThread(n,r={}){await Mo(e,n,"threads/compact",{method:"POST",options:r,fallback:"无法压缩 Codex Thread。"})},async getSettings(n,r={}){const i=await Hn(`${e}/${encodeURIComponent(n)}/settings`,{method:"GET",headers:ki(),signal:r.signal},fd);if(!i.ok)throw await Ti(i,"无法读取 Codex 权限与工作空间。");return BY(await i.json())},async updatePermissions(n,r,i={}){const s=await Hn(`${e}/${encodeURIComponent(n)}/permissions`,{method:"PUT",headers:ki({"Content-Type":"application/json"}),body:JSON.stringify(r),signal:i.signal},fd);if(!s.ok)throw await Ti(s,"无法更新 Codex 权限。");const a=await s.json();return YC(a.permissions)},async updateWorkspace(n,r,i={}){const s=await Hn(`${e}/${encodeURIComponent(n)}/workspace`,{method:"PUT",headers:ki({"Content-Type":"application/json"}),body:JSON.stringify({cwd:r}),signal:i.signal},fd);if(!s.ok)throw await Ti(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 Hn(`${e}/${encodeURIComponent(n)}/directories?${s}`,{method:"GET",headers:ki(),signal:i.signal},fd);if(!a.ok)throw await Ti(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 Hn(`${e}/${encodeURIComponent(n)}/approvals/${encodeURIComponent(r)}`,{method:"POST",headers:ki({"Content-Type":"application/json"}),body:JSON.stringify({decision:i}),signal:s.signal},fd);if(!a.ok)throw await Ti(a,"无法提交 Codex 审批决定。")},async launchTerminal(n,r={}){return QY(e,n,"terminal",r)},async launchBrowser(n,r={}){return QY(e,n,"browser",r)},async uploadFile(n,r,i={}){const s=new FormData;s.set("file",r,r.name);const a=await Hn(`${e}/${encodeURIComponent(n)}/files`,{method:"POST",headers:ki(),body:s,signal:i.signal},Sgt);if(!a.ok)throw await Ti(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 Hn(`${e}/${encodeURIComponent(n)}/disconnect`,{method:"POST",headers:ki(),signal:r.signal},$y);if(!i.ok&&i.status!==404)throw await Ti(i,"无法断开 Codex 智能体连接。")},async deleteSession(n,r={}){if(!n)return;const i=await Hn(`${e}/${encodeURIComponent(n)}`,{method:"DELETE",headers:ki(),signal:r.signal},$y);if(!i.ok&&i.status!==404)throw await Ti(i,"无法删除 Codex 智能体。")}}}const Qr=G0e(xgt),Kc=G0e("/web/intelligent-development/sessions",{textOnly:!0,messageTimeoutMs:36e5,interruptTimeoutMs:45e3});async function QY(e,t,n,r){const i=await Hn(`${e}/${encodeURIComponent(t)}/${n}`,{method:"POST",headers:ki(),signal:r.signal},fd);if(!i.ok)throw await Ti(i,n==="terminal"?"无法打开 Sandbox Terminal。":"无法打开 Sandbox Browser。");const s=await i.json();return{url:Y0e(s.url,"Sandbox 工具"),...typeof s.shellSessionId=="string"?{shellSessionId:s.shellSessionId}:{}}}function Y0e(e,t){if(typeof e!="string")throw new Error(`${t} 返回了无效地址。`);if(e.startsWith("/"))return bo(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 j0(e,t,n){const r=e instanceof Error?`${e.name}: ${e.message}`:String(e||"未知错误");return[`${t}失败`,`详细信息:${r}`,n?`请求:${n}`:""].filter(Boolean).join(` +`)}function Qm({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 Ngt(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 jgt(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 Rgt(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 Igt(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 jv({kind:e,...t}){return e==="codex"?o.jsx(Ngt,{...t}):e==="deepseek-harness"?o.jsx(Igt,{...t}):e==="openclaw"?o.jsx(jgt,{...t}):o.jsx(Rgt,{...t})}const oD=[{id:"general",label:"通用智能体"},{id:"codex",label:"Codex 智能体"},{id:"deepseek-harness",label:"DeepSeek Harness"},{id:"openclaw",label:"OpenClaw 智能体"},{id:"hermes",label:"Hermes 智能体"}],Dgt=24,Pgt=3e4,R0=new Map,ab=new Map,Mgt=new Set;function ZE(e){if(!e){R0.clear(),ab.clear();return}const t=new Set(e);if(t.size!==0){for(const[n,r]of ab)r.page.runtimes.some(i=>t.has(i.runtimeId))&&ab.delete(n);R0.clear()}}function Lgt(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 lD(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 $gt(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 Bgt({type:e}){return e==="general"?o.jsx(Qm,{}):o.jsx(jv,{kind:e})}function Q9(e){if(!e)return"—";const t=new Date(e);return Number.isNaN(t.getTime())?e.slice(0,10):new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(t).replace(/\//g,"-")}function Qgt(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 FY(e){var t;return{id:e.runtimeId,name:e.name,description:((t=e.description)==null?void 0:t.trim())||"暂无描述",createdAt:Q9(e.createdAt??""),specificationLabel:"创建人",specification:e.author||"—",isMine:e.isMine,runtime:{runtimeId:e.runtimeId,region:e.region,currentVersion:e.currentVersion,canDelete:e.canDelete}}}function Fgt(e){return{id:e.id,name:e.displayName||`${e.toolName} 智能体`,description:GC(e.status),createdAt:Q9(e.createdAt),specificationLabel:"创建人",specification:e.createdBy||"—",sandbox:e}}function Ugt(e){var t;return{id:e.id,name:e.draft.name||"未命名 Agent",description:((t=e.draft.description)==null?void 0:t.trim())||"暂无描述",createdAt:Q9(new Date(e.updatedAt).toISOString()),specificationLabel:"存储位置",specification:"当前浏览器",draft:e}}async function zgt(e,t,n){const r=`${e}:all:${t}`,i=ab.get(r);if(i&&i.expiresAt>Date.now())return n(i.page.runtimes.map(FY)),i.page.nextToken;i&&ab.delete(r);let s=R0.get(r);s||(s=bO({scope:e,region:"all",pageSize:Dgt,nextToken:t}),R0.set(r,s),s.then(()=>R0.delete(r),()=>R0.delete(r)));const a=await s;return ab.set(r,{page:a,expiresAt:Date.now()+Pgt}),n(a.runtimes.map(FY)),a.nextToken}function Vgt({agent:e,cloudProvider:t,onUse:n,onViewDetails:r,connecting:i,connected:s,showOwnership:a,deploymentTask:l,nowMs:c,onViewDeploymentTask:u,onEditDraft:d,onDeleteDraft:f}){var O,y,v,x;const h=(O=e.sandbox)==null?void 0:O.status.toLowerCase(),p=((y=e.sandbox)==null?void 0:y.resourceType)==="snapshot",b=!!(e.runtime||h==="ready"||h==="wakeable"),g=((v=e.sandbox)==null?void 0:v.resourceType)==="snapshot"?e.sandbox.sourceSessionId||e.sandbox.snapshotId:(x=e.sandbox)==null?void 0:x.id;return o.jsxs("article",{className:"my-agent-card",children:[o.jsxs("div",{className:"my-agent-card-content",children:[o.jsxs("div",{className:"my-agent-card-title",children:[o.jsxs("div",{className:"my-agent-card-title-copy",children:[o.jsx("h3",{children:e.name}),e.sandbox?o.jsx("span",{className:"my-agent-session-id",title:g,children:g}):null]}),e.draft?o.jsx("span",{className:"my-agent-draft-badge",children:l?"部署中":"草稿"}):e.sandbox?o.jsx("span",{className:"my-agent-status-label","data-ready":e.sandbox.status.toLowerCase()==="ready"||void 0,"data-wakeable":p||void 0,children:e.description}):e.runtime?o.jsxs("div",{className:"my-agent-card-badges",children:[l?o.jsx("span",{className:"my-agent-deploying-badge",children:"部署中"}):null,o.jsx("span",{className:"my-agent-region-badge",children:Ec(e.runtime.region,t)}),a&&e.isMine?o.jsx("span",{className:"runtime-owner-badge",children:"我创建的"}):null]}):null]}),e.sandbox?null:o.jsx("p",{className:"my-agent-description",children:e.description}),o.jsxs("dl",{className:"my-agent-meta",children:[o.jsxs("div",{className:"my-agent-created-at",children:[o.jsx("dt",{children:e.draft?"更新时间":"创建时间"}),o.jsx("dd",{children:e.createdAt})]}),o.jsxs("div",{className:"my-agent-region",children:[o.jsx("dt",{children:e.specificationLabel}),o.jsx("dd",{children:e.specification})]}),e.sandbox?o.jsxs("div",{className:`my-agent-expiry${e.sandbox.resourceType==="session"&&e.sandbox.persistent?"":" is-expiring"}`,children:[o.jsx("dt",{children:"剩余时间"}),o.jsx("dd",{children:e.sandbox.resourceType==="snapshot"?"可唤醒":e.sandbox.persistent?"永不过期":Qgt(e.sandbox.expireAt,c)})]}):null]})]}),o.jsx("footer",{className:"my-agent-actions",children:e.draft?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"my-agent-details","aria-label":l?`查看 ${e.name} 部署进度`:`编辑草稿 ${e.name}`,onClick:()=>l?u==null?void 0:u(l):d==null?void 0:d(e.draft),children:l?"查看进度":"编辑"}),o.jsx("button",{type:"button",className:"my-agent-delete","aria-label":`删除草稿 ${e.name}`,onClick:()=>f==null?void 0:f(e.draft),children:"删除"})]}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"my-agent-details",disabled:!b,"aria-label":l?`查看 ${e.name} 部署进度`:`查看 ${e.name} 详情`,onClick:()=>l?u==null?void 0:u(l):r==null?void 0:r(e),children:l?"查看进度":"查看详情"}),o.jsx("button",{type:"button",className:`my-agent-use${s?" is-connected":""}`,disabled:!b||i||s,"aria-busy":i||void 0,"aria-label":s?`${e.name} 已连接`:p?`唤醒 ${e.name}`:`使用 ${e.name}`,onClick:()=>void(n==null?void 0:n(e)),children:i?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-use-spinner","aria-hidden":"true"}),o.jsx("span",{children:p?"唤醒中":"连接中"})]}):s?"已连接":p?"唤醒":"使用"})]})})]})}function qgt({cloudProvider:e,canCreate:t,runtimeScope:n,onCreateAgent:r,onOpenCodexProjectUpload:i,onUseAgent:s,onViewAgentDetails:a,onCreateSandboxAgent:l,onUseSandboxAgent:c,onViewSandboxAgentDetails:u,activeType:d,onActiveTypeChange:f,sandboxRefreshKey:h=0,connectedRuntimeId:p="",hiddenRuntimeIds:b=Mgt,drafts:g=[],deploymentTasks:O=[],draftDeploymentTaskIds:y={},onViewDeploymentTask:v,onEditDraft:x,onDeleteDraft:w}){const S=m.useRef(null),E=m.useRef(null),k=m.useRef(0),T=m.useRef(0),C=m.useRef(null),[N,_]=m.useState(""),[R,$]=m.useState([]),[D,M]=m.useState(""),[j,P]=m.useState(!0),[L,U]=m.useState(""),[F,q]=m.useState([]),[z,B]=m.useState(!1),[V,ce]=m.useState(""),[we,Oe]=m.useState(""),[de,Z]=m.useState(null),[J,fe]=m.useState(()=>Date.now()),be=F.some(he=>{var xe;return((xe=he.sandbox)==null?void 0:xe.resourceType)==="session"&&he.sandbox.persistent===!1});m.useEffect(()=>{if(!be)return;fe(Date.now());const he=window.setInterval(()=>fe(Date.now()),6e4);return()=>window.clearInterval(he)},[be]);const je=m.useMemo(()=>g.map(Ugt),[g]),Qe=m.useMemo(()=>{const he=new Map,xe=new Map;for(const re of O){if(re.status!=="running"||(he.set(re.id,re),!re.runtimeId))continue;const Re=xe.get(re.runtimeId);(!Re||re.startedAt>Re.startedAt)&&xe.set(re.runtimeId,re)}return{byId:he,byRuntimeId:xe}},[O]),Me=m.useCallback(he=>{var re;if(he.draft){const Re=y[he.draft.id];return Re?Qe.byId.get(Re):void 0}const xe=(re=he.runtime)==null?void 0:re.runtimeId;return xe?Qe.byRuntimeId.get(xe):void 0},[Qe,y]),le=m.useCallback((he,xe)=>{const re=++k.current;return P(!0),U(""),zgt(n,he,Re=>{k.current===re&&$(nt=>xe?Re:[...nt,...Re])}).then(Re=>{k.current===re&&M(Re)}).catch(Re=>{k.current===re&&U(j0(Re,"加载通用智能体","GET /web/runtimes"))}).finally(()=>{k.current===re&&P(!1)})},[n]);m.useEffect(()=>{if(d==="general")return $([]),M(""),le("",!0),()=>{k.current+=1}},[d,le]);const ke=m.useCallback(async he=>{var Re,nt;(Re=C.current)==null||Re.abort();const xe=new AbortController;C.current=xe;const re=++T.current;B(!0),ce(""),q([]);try{const Ke=he==="codex"?await Qr.listSessions({signal:xe.signal,autoResumeSnapshots:!0}):await Qr.listAgentSessions(he,{signal:xe.signal,autoResumeSnapshots:!0});if(T.current!==re)return;q(Ke.map(Fgt))}catch(Ke){if((Ke==null?void 0:Ke.name)==="AbortError"||T.current!==re)return;ce(j0(Ke,`加载 ${((nt=oD.find(tn=>tn.id===he))==null?void 0:nt.label)??he}`,`GET /web/${he==="codex"?"sandbox":he}/sessions`))}finally{C.current===xe&&(C.current=null),T.current===re&&B(!1)}},[]);function ye(he){var xe;he!==d&&(he==="general"?(k.current+=1,$([]),M(""),U(""),P(!0)):((xe=C.current)==null||xe.abort(),C.current=null,T.current+=1,q([]),ce(""),B(!0)),f(he))}m.useEffect(()=>{var he;if(d==="general"){(he=C.current)==null||he.abort(),C.current=null,T.current+=1;return}return ke(d),()=>{var xe;(xe=C.current)==null||xe.abort(),C.current=null,T.current+=1}},[d,ke,h]),m.useEffect(()=>{const he=E.current,xe=S.current;if(!he||!xe||d!=="general"||!D||j)return;const re=new IntersectionObserver(([Re])=>{Re.isIntersecting&&le(D,!1)},{root:xe,rootMargin:"240px 0px",threshold:.01});return re.observe(he),()=>re.disconnect()},[d,le,j,D]);const $e=m.useCallback(async he=>{if(!we){Oe(he.id);try{await new Promise(xe=>requestAnimationFrame(()=>xe())),he.sandbox?await c(he.sandbox):await s(he)}finally{Oe("")}}},[we,s,c]),ze=m.useMemo(()=>{const he=N.trim().toLocaleLowerCase(),xe=d==="general"?[...je,...R]:F,re=he?xe.filter(Ke=>Ke.name.toLocaleLowerCase().includes(he)):xe;if(d!=="general")return re;const Re=b.size>0?re.filter(Ke=>!Ke.runtime||!b.has(Ke.runtime.runtimeId)):re,nt=Re.findIndex(Ke=>{var tn;return((tn=Ke.runtime)==null?void 0:tn.runtimeId)===p});return nt<=0?Re:[Re[nt],...Re.slice(0,nt),...Re.slice(nt+1)]},[d,p,je,b,N,R,F]),Ae=oD.find(he=>he.id===d),Ve=(Ae==null?void 0:Ae.label)??"智能体",ut=d==="general"?j&&R.length===0&&je.length===0:z&&F.length===0,Tt=!ut&&ze.length===0,We=t?d==="general"?()=>r(Hr(e)):()=>l(d):void 0,W=d==="codex"&&t&&!!i,ne=t?void 0:"当前账号没有创建智能体权限";return o.jsxs("div",{className:"my-agents-page",children:[o.jsxs("header",{className:"my-agents-header",children:[o.jsxs("div",{className:"my-agents-heading",children:[o.jsx("div",{className:"my-agents-title-row",children:o.jsx("h1",{children:"智能体"})}),o.jsx("p",{children:n==="all"?"在此处浏览所有智能体":"在此处浏览您的所有智能体"})]}),o.jsxs("label",{className:"my-agent-search",children:[o.jsx(Lgt,{}),o.jsx("input",{type:"search","aria-label":"搜索智能体",value:N,onChange:he=>_(he.target.value),placeholder:"搜索所有类型智能体名称"})]})]}),o.jsxs("div",{className:"my-agent-type-bar",children:[o.jsx("nav",{className:"my-agent-type-pills","aria-label":"智能体类型",children:oD.map(he=>o.jsx("button",{type:"button",className:`my-agent-type-pill${d===he.id?" is-active":""}`,"aria-pressed":d===he.id,onClick:()=>ye(he.id),children:he.label},he.id))}),o.jsxs("div",{className:"my-agent-type-actions",children:[W?o.jsxs("button",{type:"button",className:"my-agent-create-secondary",onClick:i,children:[o.jsx($gt,{}),o.jsx("span",{children:"接力"})]}):null,o.jsxs("button",{type:"button",className:"my-agent-create-primary",disabled:!We,title:ne,onClick:()=>We==null?void 0:We(),children:[o.jsx(lD,{}),o.jsx("span",{children:"创建智能体"})]})]})]}),o.jsxs("section",{className:"my-agent-results",ref:S,"aria-label":`${Ve}列表`,children:[ut?o.jsxs("div",{className:"my-agent-initial-loading",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载智能体"})]}):(d==="general"?L:V)&&ze.length===0?o.jsxs("div",{className:"my-agent-empty",role:"alert",children:[o.jsx("p",{children:d==="general"?L:V}),o.jsx("button",{type:"button",onClick:()=>{d==="general"?le("",!0):ke(d)},children:"重新加载"})]}):Tt?N.trim()?o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(ln,{fill:"none",children:[o.jsx(ln.Icon,{children:o.jsx(T2e,{})}),o.jsx(ln.Title,{children:"没有匹配的智能体"}),o.jsx(ln.Description,{children:"请尝试搜索其他名称"})]})}):d!=="general"?o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(ln,{fill:"none",children:[o.jsx(ln.Icon,{children:o.jsx(Bgt,{type:d})}),o.jsxs(ln.Title,{className:"my-agent-sandbox-empty-title",children:["暂无 ",Ve]}),t?o.jsx(ln.ActionRow,{children:o.jsxs(vn,{color:"primary",size:"lg",onClick:()=>l(d),children:[o.jsx(lD,{}),"创建智能体"]})}):null]})}):o.jsx("div",{className:"my-agent-empty-message",children:o.jsxs(ln,{fill:"none",children:[o.jsx(ln.Icon,{children:o.jsx(Qm,{})}),o.jsx(ln.Title,{children:"暂无通用智能体"}),o.jsx(ln.Description,{children:"创建一个通用智能体,开始构建和对话"}),t?o.jsx(ln.ActionRow,{children:o.jsxs(vn,{color:"primary",size:"lg",onClick:()=>r(Hr(e)),children:[o.jsx(lD,{}),"创建智能体"]})}):null]})}):o.jsxs(o.Fragment,{children:[d==="general"&&L?o.jsxs("div",{className:"my-agent-inline-error",role:"alert",children:[o.jsx("span",{children:L}),o.jsx("button",{type:"button",onClick:()=>void le("",!0),children:"重新加载"})]}):null,o.jsx("div",{className:"my-agent-grid",children:ze.map(he=>{var xe;return o.jsx(Vgt,{agent:he,cloudProvider:e,deploymentTask:Me(he),nowMs:J,onViewDeploymentTask:v,onUse:$e,onViewDetails:re=>{re.sandbox?u(re.sandbox):a(re)},connecting:he.id===we,connected:((xe=he.runtime)==null?void 0:xe.runtimeId)===p,showOwnership:n==="all",onEditDraft:x,onDeleteDraft:Z},he.id)})})]}),d==="general"&&!L&&!ut&&(ze.length>0||!!D)&&o.jsx("div",{className:"my-agent-load-more",ref:E,"aria-live":"polite",children:j?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"my-agent-loading-mark","aria-hidden":"true"}),o.jsx("span",{children:"正在加载更多智能体"})]}):D?o.jsx("span",{children:"继续下滑加载更多"}):o.jsx("span",{children:"已加载全部智能体"})})]}),de?o.jsx(Bl,{title:"删除草稿?",description:`删除后将无法恢复“${de.draft.name||"未命名 Agent"}”。`,confirmLabel:"删除草稿",variant:"danger",onCancel:()=>Z(null),onConfirm:()=>{w==null||w(de),Z(null)}}):null]})}function Hgt(e){return e==="127.0.0.1"}const Xgt={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。"},Ggt={id:"feishu",kind:"feishu",category:"channels",icon:"feishu",name:"飞书机器人",badge:"Beta",description:"创建飞书机器人,并将消息直接接入 AgentKit Runtime。"},Ygt="https://api.github.com",Wgt=/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/,UY=/^[A-Za-z0-9][A-Za-z0-9._/-]{0,199}$/,Zgt=/^[A-Za-z0-9._/-]+$/;function Kgt(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 Sp(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(`${Ygt}${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(Kgt(r.status,i,t.token));return{status:r.status,payload:i}}function cD(e){return e.split("/").map(encodeURIComponent).join("/")}function Jgt(e){const t=new TextEncoder().encode(e);let n="";const r=32768;for(let i=0;i({...h,path:F9(h.path,"")})),s=AbortSignal.any([t,AbortSignal.timeout(6e4)]),a=`/repos/${n}`;await Sp(`${a}`,{token:e.token,expected:[200],signal:s});const c=(f=(await Sp(`${a}/git/ref/heads/${cD(r)}`,{token:e.token,expected:[200],signal:s})).payload.object)==null?void 0:f.sha;if(!c)throw new Error("目标分支缺少有效 Git SHA");const u=e0t(e.branchPrefix);await Sp(`${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 p of i){const b=cD(p.path),g=await Sp(`${a}/contents/${b}?ref=${encodeURIComponent(r)}`,{token:e.token,expected:[200,404],signal:s});if(p.mustBeNew&&g.status===200)throw new Error(`目标仓库中已存在 ${p.path},未覆盖现有文件`);if(g.status===200&&!g.payload.sha)throw new Error(`目标路径 ${p.path} 不是可更新的文件`);await Sp(`${a}/contents/${b}`,{token:e.token,expected:[200,201],signal:s,method:"PUT",body:{message:p.commitMessage,content:Jgt(p.content),branch:u,...g.payload.sha?{sha:g.payload.sha}:{}}})}const h=await Sp(`${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 Sp(`${a}/git/refs/heads/${cD(u)}`,{token:e.token,expected:[204],signal:AbortSignal.timeout(15e3),method:"DELETE"}).catch(()=>{})}}const z9={name:"repository",label:"GitHub Repo",placeholder:"owner/repository",help:"支持 owner/repository 或完整 github.com URL",required:!0},V9={name:"baseBranch",label:"目标分支",placeholder:"main",help:"留空时使用 main,PR 将以此分支为 base",required:!1},Z0e={name:"runtimeName",label:"Runtime 名称",placeholder:"support-agent",help:"用于 AgentKit 发布配置",required:!0},K0e={name:"runtimeId",label:"Runtime ID",placeholder:"rt-xxxxxxxx",help:"持续更新的目标 AgentKit Runtime",required:!0};function q9(e={}){return{repository:"",baseBranch:"main",projectPath:".",runtimeName:"",runtimeId:"",sandboxToolId:"",modelName:"",modelBaseUrl:"https://ark.cn-beijing.volces.com/api/coding/v3",region:"cn-beijing",token:"",...e}}function H9(e){return{repository:e.repository.trim(),baseBranch:e.baseBranch.trim()||"main",region:e.region,token:e.token.trim()}}const t0t=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/,n0t=/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/;function r0t(e){if(!t0t.test(e.sandboxToolId))throw new Error("Sandbox Tool ID 格式不正确");if(!n0t.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 i0t(e){r0t(e);const t=String.raw`name: PR Automated Review "on": pull_request: @@ -859,7 +859,7 @@ jobs: gh pr review "__GH__ github.event.pull_request.number }}" \ --comment \ --body-file review-body.md -`,n={__GH__:"${{",__REGION__:JSON.stringify(e.region),__SANDBOX_TOOL_ID__:JSON.stringify(e.sandboxToolId),__MODEL_NAME__:JSON.stringify(e.modelName),__MODEL_BASE_URL__:JSON.stringify(e.modelBaseUrl)};return Object.entries(n).reduce((r,[i,s])=>r.split(i).join(s),t)}const r0t={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:[F9,U9,{name:"sandboxToolId",label:"Sandbox Tool ID",placeholder:"tool-xxxxxxxx",help:"用于运行每次评审的 AgentKit CodeEnv",required:!0},{name:"modelName",label:"评审模型",placeholder:"doubao-seed-code-preview",help:"注入 Sandbox 的代码评审模型名称",required:!0},{name:"modelBaseUrl",label:"模型 API 地址",placeholder:"https://ark.cn-beijing.volces.com/api/coding/v3",help:"必须使用 OpenAI 兼容的 HTTPS 地址",required:!0}],initialValues:z9(),regionHelp:"必须与 Sandbox Tool 所在地域一致",secrets:["VOLCENGINE_ACCESS_KEY、VOLCENGINE_SECRET_KEY(必填)","CODEX_MODEL_API_KEY(必填)","VOLCENGINE_SESSION_TOKEN(使用临时凭据时必填)"],submit(e,t){const n=V9(e);return Q9({...n,files:[{path:".github/workflows/codex-pr-review.yml",content:n0t({sandboxToolId:e.sandboxToolId.trim(),modelName:e.modelName.trim(),modelBaseUrl:e.modelBaseUrl.trim(),region:n.region}),commitMessage:"chore: configure PR automated review"}],branchPrefix:"chore/pr-automated-review",title:"chore: 配置 PR 自动评审",description:"新增 GitHub Actions 工作流,在隔离 Sandbox 中评审同仓库 PR,并将结果发布为 GitHub Review。合并前请配置工作流所需 Secrets。"},t)}},i0t=/^[A-Za-z0-9_-]+$/,Z0e=4,T_=64,__=6,FY="agent-runtime";function K0e(e){const t=e.trim();if(!t)return FY;let n=t.replace(/[^A-Za-z0-9_-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").slice(0,T_);return n?(n.lengthT_?"Runtime 名称长度须为 4-64 个字符":null:"Runtime 名称只能包含英文字母、数字、下划线和连字符":"Runtime 名称为必填项"}const o0t=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;function l0t(e){const t=GC(e.runtimeName);if(t)throw new Error(t);if(!o0t.test(e.runtimeId))throw new Error("Runtime ID 格式不正确")}function ebe(e){l0t(e);const t=`name: Publish to AgentKit Runtime +`,n={__GH__:"${{",__REGION__:JSON.stringify(e.region),__SANDBOX_TOOL_ID__:JSON.stringify(e.sandboxToolId),__MODEL_NAME__:JSON.stringify(e.modelName),__MODEL_BASE_URL__:JSON.stringify(e.modelBaseUrl)};return Object.entries(n).reduce((r,[i,s])=>r.split(i).join(s),t)}const s0t={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:[z9,V9,{name:"sandboxToolId",label:"Sandbox Tool ID",placeholder:"tool-xxxxxxxx",help:"用于运行每次评审的 AgentKit CodeEnv",required:!0},{name:"modelName",label:"评审模型",placeholder:"doubao-seed-code-preview",help:"注入 Sandbox 的代码评审模型名称",required:!0},{name:"modelBaseUrl",label:"模型 API 地址",placeholder:"https://ark.cn-beijing.volces.com/api/coding/v3",help:"必须使用 OpenAI 兼容的 HTTPS 地址",required:!0}],initialValues:q9(),regionHelp:"必须与 Sandbox Tool 所在地域一致",secrets:["VOLCENGINE_ACCESS_KEY、VOLCENGINE_SECRET_KEY(必填)","CODEX_MODEL_API_KEY(必填)","VOLCENGINE_SESSION_TOKEN(使用临时凭据时必填)"],submit(e,t){const n=H9(e);return U9({...n,files:[{path:".github/workflows/codex-pr-review.yml",content:i0t({sandboxToolId:e.sandboxToolId.trim(),modelName:e.modelName.trim(),modelBaseUrl:e.modelBaseUrl.trim(),region:n.region}),commitMessage:"chore: configure PR automated review"}],branchPrefix:"chore/pr-automated-review",title:"chore: 配置 PR 自动评审",description:"新增 GitHub Actions 工作流,在隔离 Sandbox 中评审同仓库 PR,并将结果发布为 GitHub Review。合并前请配置工作流所需 Secrets。"},t)}},a0t=/^[A-Za-z0-9_-]+$/,J0e=4,A_=64,C_=6,zY="agent-runtime";function ebe(e){const t=e.trim();if(!t)return zY;let n=t.replace(/[^A-Za-z0-9_-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").slice(0,A_);return n?(n.lengthA_?"Runtime 名称长度须为 4-64 个字符":null:"Runtime 名称只能包含英文字母、数字、下划线和连字符":"Runtime 名称为必填项"}const c0t=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;function u0t(e){const t=WC(e.runtimeName);if(t)throw new Error(t);if(!c0t.test(e.runtimeId))throw new Error("Runtime ID 格式不正确")}function nbe(e){u0t(e);const t=`name: Publish to AgentKit Runtime on: push: @@ -955,7 +955,7 @@ jobs: if not result.success: raise SystemExit(f"AgentKit publish failed: {result.error}") PY -`,n={__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),__CONCURRENCY_GROUP__:JSON.stringify(`agentkit-runtime-${e.runtimeId}`)};return Object.entries(n).reduce((r,[i,s])=>r.split(i).join(s),t)}const c0t={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:[F9,U9,{name:"projectPath",label:"Agent 项目目录",placeholder:".",help:"留空时使用仓库根目录;目录内需包含挂载完整 Studio App Server 的 app.py",required:!1},Y0e,W0e],initialValues:z9(),regionHelp:"必须与目标 Runtime 所在地域一致",secrets:["VOLCENGINE_ACCESS_KEY、VOLCENGINE_SECRET_KEY(必填)","VOLCENGINE_SESSION_TOKEN(使用临时凭据时必填)"],submit(e,t){const n=V9(e),r=B9(e.projectPath,".");return Q9({...n,files:[{path:".github/workflows/publish-agentkit.yml",content:ebe({baseBranch:n.baseBranch,projectPath:r,runtimeName:e.runtimeName.trim(),runtimeId:e.runtimeId.trim(),region:n.region}),commitMessage:"feat: publish Agent to AgentKit Runtime"}],branchPrefix:"feat/agentkit-release",title:"feat: 持续发布到 AgentKit Runtime",description:"新增 GitHub Actions 工作流,在目标分支更新时持续发布到 AgentKit Runtime。合并前请配置工作流所需的 Volcengine Secrets。"},t)}};function u0t(e,t){return e==="."?t:`${e}/${t}`}function d0t(e){return`.github/workflows/publish-agentkit-${e.replace(/[^A-Za-z0-9]+/g,"-").replace(/^-|-$/g,"").toLowerCase()||"root"}.yml`}function f0t(e){return Object.fromEntries(Object.entries({"app.py":`"""__PROJECT_NAME__ — a VeADK agent with the full Studio App Server.""" +`,n={__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),__CONCURRENCY_GROUP__:JSON.stringify(`agentkit-runtime-${e.runtimeId}`)};return Object.entries(n).reduce((r,[i,s])=>r.split(i).join(s),t)}const d0t={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:[z9,V9,{name:"projectPath",label:"Agent 项目目录",placeholder:".",help:"留空时使用仓库根目录;目录内需包含挂载完整 Studio App Server 的 app.py",required:!1},Z0e,K0e],initialValues:q9(),regionHelp:"必须与目标 Runtime 所在地域一致",secrets:["VOLCENGINE_ACCESS_KEY、VOLCENGINE_SECRET_KEY(必填)","VOLCENGINE_SESSION_TOKEN(使用临时凭据时必填)"],submit(e,t){const n=H9(e),r=F9(e.projectPath,".");return U9({...n,files:[{path:".github/workflows/publish-agentkit.yml",content:nbe({baseBranch:n.baseBranch,projectPath:r,runtimeName:e.runtimeName.trim(),runtimeId:e.runtimeId.trim(),region:n.region}),commitMessage:"feat: publish Agent to AgentKit Runtime"}],branchPrefix:"feat/agentkit-release",title:"feat: 持续发布到 AgentKit Runtime",description:"新增 GitHub Actions 工作流,在目标分支更新时持续发布到 AgentKit Runtime。合并前请配置工作流所需的 Volcengine Secrets。"},t)}};function f0t(e,t){return e==="."?t:`${e}/${t}`}function h0t(e){return`.github/workflows/publish-agentkit-${e.replace(/[^A-Za-z0-9]+/g,"-").replace(/^-|-$/g,"").toLowerCase()||"root"}.yml`}function p0t(e){return Object.fromEntries(Object.entries({"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 @@ -1064,38 +1064,38 @@ __pycache__/ Dockerfile .dockerignore README.md -`}).map(([n,r])=>[n,r.split("__PROJECT_NAME__").join(e)]))}const h0t={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:[F9,U9,{name:"projectPath",label:"Agent 项目目录",placeholder:"agentkit-basic-agent",help:"将在此目录新增 basic 项目;app.py 挂载完整 Studio App Server,并作为服务入口启动",required:!0},Y0e,W0e],initialValues:z9({projectPath:"agentkit-basic-agent"}),regionHelp:"必须与目标 Runtime 所在地域一致",secrets:["VOLCENGINE_ACCESS_KEY、VOLCENGINE_SECRET_KEY(必填)","VOLCENGINE_SESSION_TOKEN(使用临时凭据时必填)"],submit(e,t){const n=V9(e),r=G0e(n.repository),i=B9(e.projectPath,"agentkit-basic-agent"),s=i==="."?r.split("/").slice(-1)[0]||"agentkit-basic-agent":i.split("/").slice(-1)[0]||"agentkit-basic-agent",a=Object.entries(f0t(s)).map(([l,c])=>({path:u0t(i,l),content:c,commitMessage:"feat: import AgentKit basic template",mustBeNew:!0}));return a.push({path:d0t(i),content:ebe({baseBranch:n.baseBranch,projectPath:i,runtimeName:e.runtimeName.trim(),runtimeId:e.runtimeId.trim(),region:n.region}),commitMessage:"feat: add AgentKit Runtime delivery",mustBeNew:!0}),Q9({...n,repository:r,files:a,branchPrefix:"feat/agentkit-basic-template",title:"feat: 导入 AgentKit basic 模板",description:"导入带有 AgentKit Studio App Server 的 basic Agent 项目,并添加持续发布到 AgentKit Runtime 的工作流。合并前请配置 Volcengine Secrets。"},t)}},p0t={id:"website-integration",kind:"website-integration",category:"channels",icon:"website-integration",name:"网站集成",description:"将 AgentKit Runtime 以悬浮聊天窗口嵌入网站。"},UY=[{id:"development",label:"研发"},{id:"channels",label:"消息渠道"}],tbe=[qgt,h0t,c0t,r0t,Hgt,p0t],m0t=new Map(tbe.map(e=>[e.id,e]));function nbe(e){const t=m0t.get(e);if(!t)throw new Error(`Unknown automation: ${e}`);return t}function g0t(e){const t=nbe(e);if(t.kind!=="github")throw new Error(`Automation is not backed by GitHub: ${e}`);return t}const YC="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";function q9(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"})})}function zY(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 b0t(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 O0t(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 y0t({onOpen:e}){var u;const[t,n]=m.useState("development"),[r,i]=m.useState(""),s=m.useDeferredValue(r),a=m.useMemo(()=>{const d=s.trim().toLocaleLowerCase();return tbe.filter(f=>f.category===t).filter(f=>!d||`${f.name} ${f.description}`.toLocaleLowerCase().includes(d))},[t,s]),l=(u=UY.find(d=>d.id===t))==null?void 0:u.label,c=Vgt(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(zY,{}),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:UY.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:YC,alt:"","aria-hidden":"true"}):d.icon==="coding-agents"?o.jsx(b0t,{className:"application-card-icon"}):d.icon==="website-integration"?o.jsx(O0t,{className:"application-card-icon"}):o.jsx(q9,{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(zY,{}),o.jsx("h2",{children:"没有匹配的自动化"}),o.jsx("p",{children:"请尝试搜索其他名称"})]})})]})}const x0t="_Container_1a6nz_1",v0t="_Input_1a6nz_229",VY={Container:x0t,Input:v0t},zp=e=>{const t=m.useRef(null),r=`search-ui-input-${m.useId()}`,{id:i,name:s,type:a="text",variant:l="outline",size:c="md",gutterSize:u,className:d,autoComplete:f,disabled:h=!1,readOnly:p=!1,invalid:b=!1,allowAutofillExtensions:g=a==="password"||!!s||!!f&&f!=="off",onFocus:O,onBlur:y,onAnimationStart:v,onAutofill:x,autoSelect:w,startAdornment:S,endAdornment:E,pill:k,opticallyAlign:T,ref:C,...N}=e,_=M=>{const j=t.current;if(!M.target||!(M.target instanceof Element)||!j||j.contains(M.target)||M.target.closest("button, [type='button'], [role='button'], [role='menuitem']"))return;M.preventDefault(),document.activeElement!==j&&j.focus();const{left:P,top:L}=j.getBoundingClientRect(),{clientX:U,clientY:F}=M,q=F{var M;w&&((M=t.current)==null||M.select())},[w]);const D=M=>{v==null||v(M),M.animationName==="native-autofill-in"&&(x==null||x())};return o.jsxs("div",{className:zr(VY.Container,d),"data-variant":l,"data-size":c,"data-gutter-size":u,"data-focused":R,"data-disabled":h?"":void 0,"data-readonly":p?"":void 0,"data-invalid":b?"":void 0,"data-pill":k?"":void 0,"data-optically-align":T,"data-has-start-adornment":S?"":void 0,"data-has-end-adornment":E?"":void 0,onMouseDown:_,children:[S,o.jsx("input",{...N,ref:aw([C,t]),id:i||(g?void 0:r),className:VY.Input,type:a,name:s,autoComplete:f,readOnly:p,disabled:h,onFocus:M=>{$(!0),O==null||O(M)},onBlur:M=>{$(!1),y==null||y(M)},onAnimationStart:D,"data-lpignore":g?void 0:!0,"data-1p-ignore":g?void 0:!0}),E]})},w0t="_SelectControl_1tyi7_1",S0t="_Clear_1tyi7_436",E0t="_DropdownIcon_1tyi7_437",k0t="_TriggerText_1tyi7_468",T0t="_IndicatorWrapper_1tyi7_476",_0t="_StartIcon_1tyi7_482",A0t="_DropdownIconChevron_1tyi7_534",C0t="_LoadingIndicator_1tyi7_537",gd={SelectControl:w0t,Clear:S0t,DropdownIcon:E0t,TriggerText:k0t,IndicatorWrapper:T0t,StartIcon:_0t,DropdownIconChevron:A0t,LoadingIndicator:C0t},N0t=({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:p=!0,loading:b,onClearClick:g,selected:O=!1,StartIcon:y,dropdownIconType:v="dropdown",...x})=>{const w=m.useRef(null),E=!!g&&O&&!b&&!a,k=v&&v!=="none"&&!b,T=E||b||k,C=!b&&!a,N=R=>{var $;switch(R.key){case"ArrowDown":case"ArrowUp":case" ":R.stopPropagation(),R.preventDefault(),i?i():($=w.current)==null||$.dispatchEvent(new PointerEvent("pointerdown",{bubbles:!0,cancelable:!0,pointerType:"mouse"}));break;case"Enter":break;default:n==null||n(R)}},_=R=>{var $;R.button!==2&&(R.stopPropagation(),i?(R.preventDefault(),i()):(t==null||t(R),($=x.onClick)==null||$.call(x,R)))};return o.jsxs("span",{ref:aw([w,e]),className:zr(gd.SelectControl,c),role:"button",tabIndex:a?-1:0,onPointerEnter:R=>{W6(R),r==null||r(R)},onPointerDown:C?_:void 0,onKeyDown:C?N:void 0,"data-variant":u,"data-block":f?"":void 0,"data-pill":p?"":void 0,"data-size":d,"data-optically-align":h,"aria-busy":b?"true":void 0,"data-selected":O,"data-loading":b?"":void 0,"data-invalid":s?"":void 0,"data-disabled":a?"":void 0,"aria-disabled":a,...x,onClick:void 0,children:[y&&o.jsx(y,{className:gd.StartIcon}),o.jsx("span",{className:gd.TriggerText,children:l}),T&&o.jsxs("div",{className:gd.IndicatorWrapper,children:[E&&o.jsx(vn,{"aria-label":"Clear current value",className:gd.Clear,onPointerDown:R=>{R.stopPropagation()},onClick:R=>{R.stopPropagation(),R.preventDefault(),g()},color:"secondary",variant:k?"ghost":"solid",size:"3xs",uniform:!0,pill:p,"data-only-child":k?void 0:"",children:o.jsx(K4,{})}),b&&o.jsx(LA,{className:gd.LoadingIndicator}),k&&o.jsx(j0t,{iconType:v})]})]})},j0t=({iconType:e})=>e==="chevronDown"?o.jsx(x2e,{className:zr(gd.DropdownIcon,gd.DropdownIconChevron)}):o.jsx(w2e,{className:gd.DropdownIcon}),R0t="_Menu_n4tw6_3",I0t="_MenuList_n4tw6_5",D0t="_MenuInner_n4tw6_50",P0t="_OptionsList_n4tw6_64",M0t="_Option_n4tw6_64",L0t="_PressableInner_n4tw6_111",$0t="_OptionInner_n4tw6_113",B0t="_OptionCheck_n4tw6_118",Q0t="_OptionIndicatorSlot_n4tw6_123",F0t="_OptionGroupHeading_n4tw6_128",U0t="_OptionHardLimitHeading_n4tw6_140",z0t="_OptionsLimit_n4tw6_147",V0t="_Action_n4tw6_152",q0t="_ActionInner_n4tw6_218",H0t="_ActionsContainer_n4tw6_224",X0t="_Search_n4tw6_244",G0t="_SearchEmpty_n4tw6_247",ui={Menu:R0t,MenuList:I0t,MenuInner:D0t,OptionsList:P0t,Option:M0t,PressableInner:L0t,OptionInner:$0t,OptionCheck:B0t,OptionIndicatorSlot:Q0t,OptionGroupHeading:F0t,OptionHardLimitHeading:U0t,OptionsLimit:z0t,Action:V0t,ActionInner:q0t,ActionsContainer:H0t,Search:X0t,SearchEmpty:G0t},rbe=m.createContext(null),ip=()=>{const e=m.use(rbe);if(!e)throw new Error("Select components must be wrapped in